summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2020-05-18 17:53:13 -0400
committerjacobkeeler <jacob.keeler@livioradio.com>2020-05-18 17:53:13 -0400
commit588bd706703830c21a48edcea112c6bc5aa1eda0 (patch)
tree62037f12d8f7c4895577ce22934e6e30aa17b929
parent6e4b35bda8f7888db1364c02f7c22c8ce6ed3e54 (diff)
parent99e8ddcf6cff8d205d5544e4a9ae84de3b2645c9 (diff)
downloadsdl_core-bugfix/onappregistered_timing_issue.tar.gz
Merge remote-tracking branch 'origin/develop' into bugfix/onappregistered_timing_issuebugfix/onappregistered_timing_issue
# Conflicts: # src/components/application_manager/include/application_manager/application.h # src/components/application_manager/include/application_manager/application_impl.h # src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc # src/components/application_manager/test/application_impl_test.cc # src/components/application_manager/test/include/application_manager/mock_application.h
-rw-r--r--.github/CONTRIBUTING.md2
-rw-r--r--.github/ISSUE_TEMPLATE.md4
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md4
-rw-r--r--.gitignore5
-rw-r--r--.gitmodules6
-rw-r--r--.travis.yml10
-rw-r--r--CHANGELOG.md237
-rw-r--r--CMakeLists.txt48
-rw-r--r--Doxyfile4
-rw-r--r--LICENSE2
-rw-r--r--README.md153
-rw-r--r--src/3rd_party-static/CMakeLists.txt11
-rw-r--r--src/3rd_party-static/gmock-1.7.0/gtest/cmake/internal_utils.cmake2
-rw-r--r--src/3rd_party-static/jsoncpp/AUTHORS1
-rw-r--r--src/3rd_party-static/jsoncpp/LICENSE55
-rw-r--r--src/3rd_party-static/jsoncpp/NEWS.txt101
-rw-r--r--src/3rd_party-static/jsoncpp/README.txt172
-rw-r--r--src/3rd_party-static/jsoncpp/SConstruct248
-rw-r--r--src/3rd_party-static/jsoncpp/amalgamate.py147
-rw-r--r--src/3rd_party-static/jsoncpp/devtools/__init__.py1
-rw-r--r--src/3rd_party-static/jsoncpp/devtools/antglob.py201
-rw-r--r--src/3rd_party-static/jsoncpp/devtools/fixeol.py63
-rw-r--r--src/3rd_party-static/jsoncpp/devtools/licenseupdater.py93
-rw-r--r--src/3rd_party-static/jsoncpp/devtools/tarball.py53
-rw-r--r--src/3rd_party-static/jsoncpp/doc/doxyfile.in1534
-rw-r--r--src/3rd_party-static/jsoncpp/doc/footer.html23
-rw-r--r--src/3rd_party-static/jsoncpp/doc/header.html24
-rw-r--r--src/3rd_party-static/jsoncpp/doc/jsoncpp.dox126
-rw-r--r--src/3rd_party-static/jsoncpp/doc/readme.txt1
-rw-r--r--src/3rd_party-static/jsoncpp/doc/roadmap.dox37
-rw-r--r--src/3rd_party-static/jsoncpp/doxybuild.py169
-rw-r--r--src/3rd_party-static/jsoncpp/include/json/autolink.h24
-rw-r--r--src/3rd_party-static/jsoncpp/include/json/config.h96
-rw-r--r--src/3rd_party-static/jsoncpp/include/json/features.h49
-rw-r--r--src/3rd_party-static/jsoncpp/include/json/forwards.h44
-rw-r--r--src/3rd_party-static/jsoncpp/include/json/json.h15
-rw-r--r--src/3rd_party-static/jsoncpp/include/json/reader.h214
-rw-r--r--src/3rd_party-static/jsoncpp/include/json/value.h1103
-rw-r--r--src/3rd_party-static/jsoncpp/include/json/writer.h185
-rw-r--r--src/3rd_party-static/jsoncpp/makefiles/vs71/jsoncpp.sln46
-rw-r--r--src/3rd_party-static/jsoncpp/makefiles/vs71/jsontest.vcproj119
-rw-r--r--src/3rd_party-static/jsoncpp/makefiles/vs71/lib_json.vcproj214
-rw-r--r--src/3rd_party-static/jsoncpp/makefiles/vs71/test_lib_json.vcproj130
-rw-r--r--src/3rd_party-static/jsoncpp/makerelease.py380
-rw-r--r--src/3rd_party-static/jsoncpp/scons-tools/globtool.py53
-rw-r--r--src/3rd_party-static/jsoncpp/scons-tools/srcdist.py179
-rw-r--r--src/3rd_party-static/jsoncpp/scons-tools/substinfile.py79
-rw-r--r--src/3rd_party-static/jsoncpp/scons-tools/targz.py82
-rw-r--r--src/3rd_party-static/jsoncpp/src/jsontestrunner/main.cpp269
-rw-r--r--src/3rd_party-static/jsoncpp/src/jsontestrunner/sconscript9
-rw-r--r--src/3rd_party-static/jsoncpp/src/lib_json/json_batchallocator.h130
-rw-r--r--src/3rd_party-static/jsoncpp/src/lib_json/json_internalarray.inl456
-rw-r--r--src/3rd_party-static/jsoncpp/src/lib_json/json_internalmap.inl615
-rw-r--r--src/3rd_party-static/jsoncpp/src/lib_json/json_reader.cpp884
-rw-r--r--src/3rd_party-static/jsoncpp/src/lib_json/json_tool.h93
-rw-r--r--src/3rd_party-static/jsoncpp/src/lib_json/json_value.cpp1830
-rw-r--r--src/3rd_party-static/jsoncpp/src/lib_json/json_valueiterator.inl299
-rw-r--r--src/3rd_party-static/jsoncpp/src/lib_json/json_writer.cpp838
-rw-r--r--src/3rd_party-static/jsoncpp/src/lib_json/sconscript8
-rw-r--r--src/3rd_party-static/jsoncpp/src/test_lib_json/jsontest.cpp608
-rw-r--r--src/3rd_party-static/jsoncpp/src/test_lib_json/jsontest.h259
-rw-r--r--src/3rd_party-static/jsoncpp/src/test_lib_json/main.cpp430
-rw-r--r--src/3rd_party-static/jsoncpp/src/test_lib_json/sconscript10
-rw-r--r--src/3rd_party-static/jsoncpp/test/cleantests.py10
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/fail_test_array_01.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_01.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_01.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_02.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_02.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_03.expected6
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_03.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_04.expected5
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_04.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_05.expected100
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_05.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_06.expected5
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_array_06.json4
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_01.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_01.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_02.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_02.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_03.expected3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_03.json3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_04.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_04.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_05.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_05.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_06.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_06.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_07.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_07.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_08.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_08.json3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_09.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_basic_09.json4
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_comment_01.expected8
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_comment_01.json8
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_complex_01.expected20
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_complex_01.json17
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_01.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_01.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_02.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_02.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_03.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_03.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_04.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_04.json3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_05.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_05.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_06_64bits.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_06_64bits.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_07_64bits.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_07_64bits.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_08_64bits.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_integer_08_64bits.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_large_01.expected2122
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_large_01.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_object_01.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_object_01.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_object_02.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_object_02.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_object_03.expected4
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_object_03.json5
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_object_04.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_object_04.json3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_preserve_comment_01.expected3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_preserve_comment_01.json14
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_01.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_01.json3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_02.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_02.json3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_03.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_03.json3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_04.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_04.json3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_05.expected3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_05.json3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_06.expected3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_06.json3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_07.expected3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_real_07.json3
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_01.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_01.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_02.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_02.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_03.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_03.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_unicode_01.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_unicode_01.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_unicode_02.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_unicode_02.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_unicode_03.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_unicode_03.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_unicode_04.expected1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_unicode_04.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_unicode_05.expected2
-rw-r--r--src/3rd_party-static/jsoncpp/test/data/test_string_unicode_05.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/generate_expected.py11
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail1.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail10.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail11.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail12.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail13.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail14.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail15.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail16.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail17.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail18.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail19.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail2.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail20.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail21.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail22.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail23.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail24.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail25.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail26.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail27.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail28.json2
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail29.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail3.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail30.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail31.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail32.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail33.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail4.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail5.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail6.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail7.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail8.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/fail9.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/pass1.json58
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/pass2.json1
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/pass3.json6
-rw-r--r--src/3rd_party-static/jsoncpp/test/jsonchecker/readme.txt3
-rw-r--r--src/3rd_party-static/jsoncpp/test/pyjsontestrunner.py64
-rw-r--r--src/3rd_party-static/jsoncpp/test/runjsontests.py134
-rw-r--r--src/3rd_party-static/jsoncpp/test/rununittests.py73
-rw-r--r--src/3rd_party-static/jsoncpp/version1
-rw-r--r--src/3rd_party-static/test/json_reader_test.cc80
-rw-r--r--src/3rd_party/CMakeLists.txt143
-rw-r--r--src/3rd_party/FindBSON.cmake26
-rw-r--r--src/appMain/CMakeLists.txt23
-rw-r--r--src/appMain/audio.8bit.wavbin88244 -> 44144 bytes
-rwxr-xr-xsrc/appMain/hmi_capabilities.json486
-rw-r--r--src/appMain/life_cycle.h171
-rw-r--r--src/appMain/life_cycle_impl.cc (renamed from src/appMain/life_cycle.cc)209
-rw-r--r--src/appMain/life_cycle_impl.h113
-rw-r--r--src/appMain/low_voltage_signals_handler.cc165
-rw-r--r--src/appMain/low_voltage_signals_handler.h132
-rw-r--r--src/appMain/main.cc55
-rw-r--r--src/appMain/sample_policy_manager.py110
-rw-r--r--src/appMain/sdl_preloaded_pt.json6470
-rw-r--r--src/appMain/signal_handlers.cc64
-rw-r--r--src/appMain/signal_handlers.h60
-rw-r--r--src/appMain/smartDeviceLink.ini125
-rw-r--r--src/appMain/start_external_proprietary.sh8
-rw-r--r--src/appMain/test/CMakeLists.txt (renamed from src/3rd_party-static/jsoncpp/CMakeLists.txt)22
-rw-r--r--src/appMain/test/low_voltage_signals_handler_test.cc138
-rw-r--r--src/appMain/test/mock_life_cycle.h54
-rw-r--r--src/components/CMakeLists.txt5
-rw-r--r--src/components/application_manager/CMakeLists.txt10
-rw-r--r--src/components/application_manager/include/application_manager/app_extension.h14
-rw-r--r--src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h24
-rw-r--r--src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h6
-rw-r--r--src/components/application_manager/include/application_manager/app_launch/app_launch_data.h6
-rw-r--r--src/components/application_manager/include/application_manager/app_launch/app_launch_data_db.h14
-rw-r--r--src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h2
-rw-r--r--src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h32
-rw-r--r--src/components/application_manager/include/application_manager/app_launch/apps_launcher.h3
-rw-r--r--src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h40
-rw-r--r--src/components/application_manager/include/application_manager/app_service_manager.h267
-rw-r--r--src/components/application_manager/include/application_manager/application.h446
-rw-r--r--src/components/application_manager/include/application_manager/application_data_impl.h85
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h229
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h624
-rw-r--r--src/components/application_manager/include/application_manager/application_state.h98
-rw-r--r--src/components/application_manager/include/application_manager/command_factory.h29
-rw-r--r--src/components/application_manager/include/application_manager/command_holder.h4
-rw-r--r--src/components/application_manager/include/application_manager/command_holder_impl.h18
-rw-r--r--src/components/application_manager/include/application_manager/commands/command.h28
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_impl.h64
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_impl.h84
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_to_mobile.h74
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_response_from_mobile.h74
-rw-r--r--src/components/application_manager/include/application_manager/commands/notification_from_hmi.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/pending.h4
-rw-r--r--src/components/application_manager/include/application_manager/commands/request_from_hmi.h54
-rw-r--r--src/components/application_manager/include/application_manager/commands/request_to_hmi.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/response_from_hmi.h62
-rw-r--r--src/components/application_manager/include/application_manager/commands/response_to_hmi.h2
-rw-r--r--src/components/application_manager/include/application_manager/display_capabilities_builder.h96
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event.h107
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h36
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h55
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_observer.h29
-rw-r--r--src/components/application_manager/include/application_manager/help_prompt_manager.h96
-rw-r--r--src/components/application_manager/include/application_manager/help_prompt_manager_impl.h197
-rw-r--r--src/components/application_manager/include/application_manager/helpers/application_helper.h25
-rw-r--r--src/components/application_manager/include/application_manager/hmi_capabilities_impl.h97
-rw-r--r--src/components/application_manager/include/application_manager/hmi_interfaces.h3
-rw-r--r--src/components/application_manager/include/application_manager/hmi_interfaces_impl.h2
-rw-r--r--src/components/application_manager/include/application_manager/hmi_language_handler.h20
-rw-r--r--src/components/application_manager/include/application_manager/hmi_state.h114
-rw-r--r--src/components/application_manager/include/application_manager/message.h23
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h302
-rw-r--r--src/components/application_manager/include/application_manager/mobile_message_handler.h6
-rw-r--r--src/components/application_manager/include/application_manager/plugin_manager/plugin_keys.h48
-rw-r--r--src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h46
-rw-r--r--src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager.h14
-rw-r--r--src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h20
-rw-r--r--src/components/application_manager/include/application_manager/policies/custom_vehicle_data_provider.h32
-rw-r--r--src/components/application_manager/include/application_manager/policies/external/delegates/app_permission_delegate.h10
-rw-r--r--src/components/application_manager/include/application_manager/policies/external/delegates/statistics_delegate.h4
-rw-r--r--src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h3
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h290
-rw-r--r--src/components/application_manager/include/application_manager/policies/regular/delegates/app_permission_delegate.h10
-rw-r--r--src/components/application_manager/include/application_manager/policies/regular/delegates/statistics_delegate.h4
-rw-r--r--src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h1
-rw-r--r--src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h9
-rw-r--r--src/components/application_manager/include/application_manager/request_controller.h170
-rw-r--r--src/components/application_manager/include/application_manager/request_info.h70
-rw-r--r--src/components/application_manager/include/application_manager/request_tracker.h58
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl.h66
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h163
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data.h50
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_db.h14
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_json.h50
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h5
-rw-r--r--src/components/application_manager/include/application_manager/rpc_handler_impl.h71
-rw-r--r--src/components/application_manager/include/application_manager/rpc_passing_handler.h123
-rw-r--r--src/components/application_manager/include/application_manager/rpc_protection_manager.h111
-rw-r--r--src/components/application_manager/include/application_manager/rpc_protection_manager_impl.h116
-rw-r--r--src/components/application_manager/include/application_manager/rpc_service_impl.h76
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h122
-rw-r--r--src/components/application_manager/include/application_manager/state_controller_impl.h271
-rw-r--r--src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h10
-rw-r--r--src/components/application_manager/include/application_manager/telemetry_observer.h14
-rw-r--r--src/components/application_manager/include/application_manager/usage_statistics.h12
-rw-r--r--src/components/application_manager/rpc_plugins/CMakeLists.txt1
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt87
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h131
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h66
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h75
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h76
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h81
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h106
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h99
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h78
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h78
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h88
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h94
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h78
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h89
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h80
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h78
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc122
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc77
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc198
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc177
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc120
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc89
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc59
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc59
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc289
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc67
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc90
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc59
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc164
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc64
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc86
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc60
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc97
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc215
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc99
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc134
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc66
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc123
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc119
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc188
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc60
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc66
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc129
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc90
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt34
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/CMakeLists.txt (renamed from src/components/dbus/test/CMakeLists.txt)35
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/app_service_app_extension_test.cc211
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc155
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc140
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc220
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt12
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_button_press_request.h17
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_button_press_response.h14
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_request.h70
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_response.h10
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h10
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h10
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_interior_vehicle_data_notification.h16
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h20
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_global_properties_request.h66
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_global_properties_response.h68
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_request.h10
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_response.h16
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_request.h27
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_response.h17
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_request.h123
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_response.h68
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h31
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h16
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h19
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_request.h71
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_response.h67
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h48
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_response.h16
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_params.h68
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h87
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_cache.h96
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_cache_impl.h67
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager.h94
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager_impl.h130
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h158
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager.h184
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager_impl.h200
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h45
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager.h91
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h178
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h175
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h189
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h64
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_types.h91
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h108
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h125
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc32
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc32
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc54
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc57
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc59
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc258
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc472
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc57
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc293
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc23
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc72
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc194
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc58
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc412
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc152
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc126
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc201
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc65
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc925
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc224
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc416
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc365
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc108
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc392
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt20
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc194
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_consent_request_test.cc402
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc720
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc114
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc85
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc168
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/release_interior_vehicle_data_module_request_test.cc243
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc213
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/grid_test.cc72
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_cache.h58
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_manager.h56
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_capabilities_manager.h93
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_consent_manager.h60
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_helpers.h97
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h55
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/interior_data_cache_test.cc226
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/mock_rc_helpers.cc138
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_consent_manager_impl_test.cc346
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_helpers_test.cc285
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt83
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc886
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc508
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/activate_app_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/activate_app_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/add_statistics_info_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_all_apps_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_app_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_app_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_on_awake_sdl.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_system_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_app_properties_request.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_urls.h)60
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_app_properties_response.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_urls_response.h)38
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h77
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h77
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_set_app_properties_request.h77
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_set_app_properties_response.h78
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/close_popup_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/close_popup_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/decrypt_certificate_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/decrypt_certificate_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/dial_number_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/dial_number_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_response.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/mixing_audio_supported_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/mixing_audio_supported_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_get_way_points_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_get_way_points_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_send_location_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_send_location_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_stop_stream_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_stop_stream_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_request.h14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_response.h8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_update_turn_list_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_update_turn_list_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_permission_changed_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_properties_change_notification.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_registered_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h)71
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_event_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_press_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_file_removed_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_find_applications.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_policy_update.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_put_file_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ready_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_received_policy_update.h10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_record_start_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_resume_audio_source_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_consent_needed_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_persistence_complete_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_service_update_notification.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_subscribe_vehicle_data_request_template.h)57
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_status_update_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_context_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_error_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_request_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_update_device_list.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_request.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_get_vehicle_data_response_template.h)53
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_response.h78
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_status_update_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_policy_update.h10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_policy_update_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_change_registration_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_speak_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_speak_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_stop_speaking_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_stop_speaking_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_alert_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_alert_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_request.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_get_vehicle_data_request_template.h)48
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_response.h)32
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_change_registration_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_change_registration_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_response.h66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_command_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_command_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_submenu_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_submenu_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_interaction_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_interaction_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_scrollable_message_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_app_icon_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_request.h)35
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h74
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_slider_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_slider_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_app_list_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_app_list_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_sdl_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_sdl_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_subscribe_vehicle_data_response_template.h82
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h83
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_change_registration_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_change_registration_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_delete_command_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_delete_command_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_perform_interaction_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_perform_interaction_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_request.h)52
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h85
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h47
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h117
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_response.h67
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h91
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_response.h67
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/generic_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h87
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_response.h)38
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_response.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_interface_unregistered_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_audio_pass_thru_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_command_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_driver_distraction_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hmi_status_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hmi_status_notification_from_mobile.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_keyboard_input_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_language_change_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_permissions_change_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h84
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_request_notification.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_tbt_client_state_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_touch_event_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h69
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h88
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h81
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_response.h74
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h27
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_response.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_response.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_response.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h83
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/hmi_command_factory.h4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_command_factory.h8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h41
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc65
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc144
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc60
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc114
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls.cc230
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc59
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc180
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc145
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc72
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc32
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc49
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc46
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc157
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls_response.cc)15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc64
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_icon_request.cc)14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc56
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc43
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc57
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc117
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc60
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc94
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc119
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc82
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc376
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_response.cc)26
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc162
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc64
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/generic_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc90
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc356
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc86
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc43
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc47
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc252
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc54
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc30
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc343
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc43
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc783
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc45
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc30
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc26
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc81
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc65
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc64
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc466
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_request.cc149
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc143
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc211
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc43
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc107
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc33
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc98
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc1236
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc209
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_get_app_properties_request_test.cc367
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_get_app_properties_response_test.cc66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_set_app_properties_request_test.cc304
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_set_app_properties_response_test.cc66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc391
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc336
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc425
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc24
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_app_properties_change_notification_test.cc (renamed from src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_response_test.cc)72
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc159
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc118
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc287
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_service_status_update_notification_test.cc96
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc23
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc118
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc180
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc27
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc76
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc73
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc23
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc24
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc87
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc32
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc298
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc72
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc39
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc147
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc460
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc40
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc50
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc24
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc51
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc278
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc95
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc54
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc124
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc35
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc35
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc70
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc26
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc59
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc32
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc236
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc47
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc16
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc97
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc531
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc45
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc480
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc205
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc51
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc86
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc563
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc49
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc626
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc52
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc45
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc156
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc85
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc75
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc47
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc98
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt11
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/on_vi_vehicle_data_notification.h10
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_diagnostic_message_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_diagnostic_message_response.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_dtcs_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_dtcs_response.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_request.h11
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_response.h10
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_response.h11
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_response.h10
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_read_did_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_read_did_response.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h11
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_response.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request.h11
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_response.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_response.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h30
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_response.h9
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/on_vehicle_data_notification.h13
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h9
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_response.h9
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h83
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_response.h9
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h80
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_response.h9
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/custom_vehicle_data_manager.h55
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/custom_vehicle_data_manager_impl.h103
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_data_item_schema.h115
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h24
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_command_factory.h31
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_command_params.h31
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_hmi_command_factory.h8
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_mobile_command_factory.h20
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h19
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc36
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc45
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc36
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc36
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc301
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc116
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc21
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc538
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc447
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc15
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc575
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc188
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc26
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc30
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc82
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc170
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc169
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt17
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_request_test.cc110
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc49
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_subscribe_vehicle_data_request_test.cc110
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_unsubscribe_vehicle_data_request_test.cc109
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc38
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc40
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc97
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc69
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc113
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/read_did_request_test.cc34
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc117
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_response_test.cc32
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/custom_vehicle_data_manager_test.cc318
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_command_request_test.h99
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h104
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/mock_custom_vehicle_data_manager.h26
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_data_item_schema_test.cc396
-rw-r--r--src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc9
-rw-r--r--src/components/application_manager/src/app_launch/app_launch_data_db.cc19
-rw-r--r--src/components/application_manager/src/app_launch/app_launch_data_json.cc98
-rw-r--r--src/components/application_manager/src/app_launch/app_launch_sql_queries.cc2
-rw-r--r--src/components/application_manager/src/app_launch/apps_launcher.cc8
-rw-r--r--src/components/application_manager/src/app_launch/device_apps_launcher.cc132
-rw-r--r--src/components/application_manager/src/app_service_manager.cc651
-rw-r--r--src/components/application_manager/src/application_data_impl.cc429
-rw-r--r--src/components/application_manager/src/application_impl.cc361
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc2497
-rw-r--r--src/components/application_manager/src/application_state.cc255
-rw-r--r--src/components/application_manager/src/command_holder_impl.cc26
-rw-r--r--src/components/application_manager/src/commands/command_impl.cc148
-rw-r--r--src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc30
-rw-r--r--src/components/application_manager/src/commands/command_notification_impl.cc2
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc339
-rw-r--r--src/components/application_manager/src/commands/command_request_to_mobile.cc76
-rw-r--r--src/components/application_manager/src/commands/command_response_from_mobile.cc75
-rw-r--r--src/components/application_manager/src/commands/notification_from_hmi.cc25
-rw-r--r--src/components/application_manager/src/commands/request_from_hmi.cc219
-rw-r--r--src/components/application_manager/src/commands/response_from_hmi.cc5
-rw-r--r--src/components/application_manager/src/display_capabilities_builder.cc128
-rw-r--r--src/components/application_manager/src/event_engine/event.cc12
-rw-r--r--src/components/application_manager/src/event_engine/event_dispatcher_impl.cc80
-rw-r--r--src/components/application_manager/src/event_engine/event_observer.cc21
-rw-r--r--src/components/application_manager/src/help_prompt_manager_impl.cc388
-rw-r--r--src/components/application_manager/src/helpers/application_helper.cc7
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc342
-rw-r--r--src/components/application_manager/src/hmi_interfaces_impl.cc27
-rw-r--r--src/components/application_manager/src/hmi_language_handler.cc40
-rw-r--r--src/components/application_manager/src/hmi_state.cc155
-rw-r--r--src/components/application_manager/src/message.cc31
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc1178
-rw-r--r--src/components/application_manager/src/mobile_message_handler.cc15
-rw-r--r--src/components/application_manager/src/plugin_manager/plugin_keys.cc14
-rw-r--r--src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc78
-rw-r--r--src/components/application_manager/src/policies/policy_event_observer.cc20
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc1326
-rw-r--r--src/components/application_manager/src/request_controller.cc48
-rw-r--r--src/components/application_manager/src/request_info.cc44
-rw-r--r--src/components/application_manager/src/request_tracker.cc19
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc706
-rw-r--r--src/components/application_manager/src/resumption/resumption_data.cc52
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc107
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc324
-rw-r--r--src/components/application_manager/src/resumption/resumption_sql_queries.cc18
-rw-r--r--src/components/application_manager/src/rpc_handler_impl.cc299
-rw-r--r--src/components/application_manager/src/rpc_passing_handler.cc444
-rw-r--r--src/components/application_manager/src/rpc_protection_manager_impl.cc222
-rw-r--r--src/components/application_manager/src/rpc_service_impl.cc353
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc111
-rw-r--r--src/components/application_manager/src/state_controller_impl.cc466
-rw-r--r--src/components/application_manager/src/system_time/system_time_handler_impl.cc20
-rw-r--r--src/components/application_manager/src/usage_statistics.cc11
-rwxr-xr-x[-rw-r--r--]src/components/application_manager/test/CMakeLists.txt20
-rw-r--r--src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc30
-rw-r--r--src/components/application_manager/test/app_launch/app_launch_data_db_test.cc22
-rw-r--r--src/components/application_manager/test/app_launch/app_launch_data_json_test.cc88
-rw-r--r--src/components/application_manager/test/app_service_manager_test.cc462
-rw-r--r--src/components/application_manager/test/application_helper_test.cc36
-rw-r--r--src/components/application_manager/test/application_impl_test.cc181
-rw-r--r--src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc54
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc1176
-rw-r--r--src/components/application_manager/test/application_state_test.cc176
-rw-r--r--src/components/application_manager/test/command_holder_test.cc90
-rw-r--r--src/components/application_manager/test/commands/CMakeLists.txt15
-rw-r--r--src/components/application_manager/test/commands/command_impl_test.cc40
-rw-r--r--src/components/application_manager/test/commands/command_request_impl_test.cc199
-rw-r--r--src/components/application_manager/test/commands/command_response_impl_test.cc25
-rw-r--r--src/components/application_manager/test/event_engine_test.cc14
-rw-r--r--src/components/application_manager/test/help_prompt_manager_test.cc372
-rw-r--r--src/components/application_manager/test/hmi_capabilities.json10
-rw-r--r--src/components/application_manager/test/hmi_capabilities_old_apt.json9
-rw-r--r--src/components/application_manager/test/hmi_capabilities_test.cc127
-rw-r--r--src/components/application_manager/test/hmi_language_handler_test.cc39
-rw-r--r--src/components/application_manager/test/include/application_manager/commands/command_request_test.h14
-rw-r--r--src/components/application_manager/test/include/application_manager/commands/commands_test.h135
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_app_launch_data.h2
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_app_service_manager.h97
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h219
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_command_factory.h4
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_command_holder.h (renamed from src/components/dbus/include/dbus/message_descriptions.h)67
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h21
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_event_observer.h5
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h61
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h43
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h78
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_request.h3
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h31
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resumption_data.h70
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_rpc_protection_manager.h65
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_rpc_protection_mediator.h22
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_telemetry_observer.h2
-rw-r--r--src/components/application_manager/test/include/application_manager/resumption_data_test.h36
-rw-r--r--src/components/application_manager/test/include/application_manager/test_resumption_data_db.h6
-rwxr-xr-xsrc/components/application_manager/test/message_helper/CMakeLists.txt1
-rw-r--r--src/components/application_manager/test/message_helper/message_helper_test.cc203
-rw-r--r--src/components/application_manager/test/mobile_event_engine_test.cc171
-rw-r--r--src/components/application_manager/test/mobile_message_handler_test.cc36
-rw-r--r--src/components/application_manager/test/mobile_message_handler_v1_test.cc27
-rw-r--r--src/components/application_manager/test/mock_application_helper.cc11
-rw-r--r--src/components/application_manager/test/mock_hmi_command_factory.cc13
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc132
-rw-r--r--src/components/application_manager/test/policy_event_observer_test.cc13
-rw-r--r--src/components/application_manager/test/policy_handler_test.cc1279
-rw-r--r--src/components/application_manager/test/rc_policy_handler_test.cc98
-rw-r--r--src/components/application_manager/test/request_controller/request_controller_test.cc33
-rw-r--r--src/components/application_manager/test/request_info_test.cc131
-rw-r--r--src/components/application_manager/test/request_tracker_test.cc8
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc856
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_db_test.cc75
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_json_test.cc35
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_test.cc114
-rw-r--r--src/components/application_manager/test/resumption_sql_queries_test.cc244
-rw-r--r--src/components/application_manager/test/rpc_handler_impl_test.cc123
-rw-r--r--src/components/application_manager/test/rpc_passing_handler_test.cc445
-rw-r--r--src/components/application_manager/test/rpc_service_impl_test.cc837
-rw-r--r--src/components/application_manager/test/sdl_preloaded_pt.json8
-rw-r--r--src/components/application_manager/test/sdl_pt_update.json16
-rw-r--r--src/components/application_manager/test/state_controller/state_controller_test.cc1224
-rw-r--r--src/components/application_manager/test/usage_statistics_test.cc23
-rw-r--r--src/components/application_manager/test/zero_request_amount_test.cc12
-rw-r--r--src/components/config_profile/CMakeLists.txt1
-rw-r--r--src/components/config_profile/include/config_profile/ini_file.h2
-rw-r--r--src/components/config_profile/include/config_profile/profile.h323
-rw-r--r--src/components/config_profile/src/ini_file.cc10
-rw-r--r--src/components/config_profile/src/profile.cc717
-rw-r--r--src/components/config_profile/test/ini_file_test.cc2
-rw-r--r--src/components/config_profile/test/profile_test.cc86
-rw-r--r--src/components/config_profile/test/smartDeviceLink_invalid_string.ini4
-rw-r--r--src/components/connection_handler/CMakeLists.txt2
-rw-r--r--src/components/connection_handler/include/connection_handler/connection.h63
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler_impl.h209
-rw-r--r--src/components/connection_handler/include/connection_handler/device.h8
-rw-r--r--src/components/connection_handler/include/connection_handler/heartbeat_monitor.h12
-rw-r--r--src/components/connection_handler/src/connection.cc165
-rw-r--r--src/components/connection_handler/src/connection_handler_impl.cc920
-rw-r--r--src/components/connection_handler/src/device.cc6
-rw-r--r--src/components/connection_handler/src/heartbeat_monitor.cc31
-rw-r--r--src/components/connection_handler/test/connection_handler_impl_test.cc321
-rw-r--r--src/components/connection_handler/test/connection_test.cc182
-rw-r--r--src/components/connection_handler/test/device_test.cc4
-rw-r--r--src/components/connection_handler/test/heart_beat_monitor_test.cc236
-rw-r--r--src/components/dbus/CMakeLists.txt82
-rw-r--r--src/components/dbus/codegen/code_formatter.py58
-rw-r--r--src/components/dbus/codegen/ford_xml_parser.py231
-rw-r--r--src/components/dbus/codegen/introspection_xml.cc327
-rwxr-xr-xsrc/components/dbus/codegen/make_hmi_requests.py343
-rwxr-xr-xsrc/components/dbus/codegen/make_introspection_c.py126
-rwxr-xr-xsrc/components/dbus/codegen/make_message_descriptions.py273
-rwxr-xr-xsrc/components/dbus/codegen/make_notifications_qml.py387
-rwxr-xr-xsrc/components/dbus/codegen/make_qml_dbus_cpp.py736
-rwxr-xr-xsrc/components/dbus/codegen/make_qml_dbus_qml.py217
-rw-r--r--src/components/dbus/codegen/make_qml_requests_cpp.py253
-rwxr-xr-xsrc/components/dbus/codegen/make_request_to_sdl.py335
-rw-r--r--src/components/dbus/include/dbus/dbus_adapter.h375
-rw-r--r--src/components/dbus/include/dbus/dbus_message.h179
-rw-r--r--src/components/dbus/include/dbus/dbus_message_controller.h97
-rw-r--r--src/components/dbus/include/dbus/dbus_message_inl.h214
-rw-r--r--src/components/dbus/include/dbus/schema.h98
-rw-r--r--src/components/dbus/src/dbus_adapter.cc937
-rw-r--r--src/components/dbus/src/dbus_message.cc217
-rw-r--r--src/components/dbus/src/dbus_message_controller.cc90
-rw-r--r--src/components/dbus/src/introspection_xml.cc327
-rw-r--r--src/components/dbus/src/message_descriptions.cc10424
-rw-r--r--src/components/dbus/src/schema.cc145
-rw-r--r--src/components/dbus/test/dbus_message_controller_test.cc116
-rw-r--r--src/components/dbus/test/include/dbus/mock_dbus_message_controller.h75
-rw-r--r--src/components/dbus/test/include/dbus/mock_subscriber.h62
-rw-r--r--src/components/dbus/test/mock_subscriber.cc71
-rw-r--r--src/components/dbus/test/schema_test.cc118
-rw-r--r--src/components/formatters/CMakeLists.txt1
-rw-r--r--src/components/formatters/include/formatters/CFormatterJsonBase.h58
-rw-r--r--src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h53
-rw-r--r--src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h69
-rw-r--r--src/components/formatters/include/formatters/CSmartFactory.h82
-rw-r--r--src/components/formatters/include/formatters/formatter_json_rpc.h65
-rw-r--r--src/components/formatters/include/formatters/generic_json_formatter.h16
-rw-r--r--src/components/formatters/include/formatters/meta_formatter.h54
-rw-r--r--src/components/formatters/src/CFormatterJsonBase.cc40
-rw-r--r--src/components/formatters/src/CFormatterJsonSDLRPCv1.cc32
-rw-r--r--src/components/formatters/src/CFormatterJsonSDLRPCv2.cc28
-rw-r--r--src/components/formatters/src/CSmartFactory.cc34
-rw-r--r--src/components/formatters/src/formatter_json_rpc.cc71
-rw-r--r--src/components/formatters/src/generic_json_formatter.cc23
-rw-r--r--src/components/formatters/src/meta_formatter.cc10
-rw-r--r--src/components/formatters/test/CFormatterJsonBase_test.cc54
-rw-r--r--src/components/formatters/test/CSmartFactory_test.cc44
-rw-r--r--src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc10
-rw-r--r--src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc16
-rw-r--r--src/components/formatters/test/formatter_json_rpc_test.cc30
-rw-r--r--src/components/formatters/test/generic_json_formatter_test.cc16
-rw-r--r--src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h21
-rw-r--r--src/components/formatters/test/include/formatters/create_smartSchema.h8
-rw-r--r--src/components/formatters/test/include/formatters/meta_formatter_test_helper.h18
-rw-r--r--src/components/formatters/test/meta_formatter_test.cc88
-rw-r--r--src/components/formatters/test/src/SmartFactoryTestHelper.cc244
-rw-r--r--src/components/formatters/test/src/create_smartSchema.cc142
-rw-r--r--src/components/formatters/test/src/meta_formatter_test_helper.cc6
-rw-r--r--src/components/hmi_message_handler/CMakeLists.txt10
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/dbus_message_adapter.h98
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h14
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h19
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h2
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h44
-rw-r--r--src/components/hmi_message_handler/mock_hmi_message_handler.h4
-rw-r--r--src/components/hmi_message_handler/src/dbus_message_adapter.cc223
-rw-r--r--src/components/hmi_message_handler/src/mb_controller.cc16
-rw-r--r--src/components/hmi_message_handler/src/messagebroker_adapter.cc17
-rw-r--r--src/components/hmi_message_handler/src/websocket_session.cc35
-rw-r--r--src/components/hmi_message_handler/test/CMakeLists.txt2
-rw-r--r--src/components/hmi_message_handler/test/hmi_message_adapter_test.cc12
-rw-r--r--src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc57
-rw-r--r--src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_adapter_impl.h60
-rw-r--r--src/components/include/application_manager/app_launch_settings.h2
-rw-r--r--src/components/include/application_manager/application_manager.h306
-rw-r--r--src/components/include/application_manager/application_manager_settings.h22
-rw-r--r--src/components/include/application_manager/hmi_capabilities.h92
-rw-r--r--src/components/include/application_manager/policies/policy_encryption_flag_getter.h106
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h334
-rw-r--r--src/components/include/application_manager/policies/policy_handler_observer.h19
-rw-r--r--src/components/include/application_manager/rpc_handler.h14
-rw-r--r--src/components/include/application_manager/rpc_service.h36
-rw-r--r--src/components/include/application_manager/state_controller.h145
-rw-r--r--src/components/include/connection_handler/connection_handler.h132
-rw-r--r--src/components/include/connection_handler/connection_handler_observer.h48
-rw-r--r--src/components/include/hmi_message_handler/hmi_message_adapter.h2
-rw-r--r--src/components/include/hmi_message_handler/hmi_message_handler.h4
-rw-r--r--src/components/include/hmi_message_handler/hmi_message_observer.h8
-rw-r--r--src/components/include/hmi_message_handler/hmi_message_sender.h4
-rw-r--r--src/components/include/media_manager/media_manager.h10
-rw-r--r--src/components/include/media_manager/media_manager_settings.h2
-rw-r--r--src/components/include/policy/policy_external/policy/policy_listener.h50
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h291
-rw-r--r--src/components/include/policy/policy_external/policy/policy_settings.h12
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_listener.h62
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h287
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_settings.h12
-rw-r--r--src/components/include/protocol/bson_object_keys.h7
-rw-r--r--src/components/include/protocol/common.h34
-rw-r--r--src/components/include/protocol/raw_message.h12
-rw-r--r--src/components/include/protocol_handler/protocol_handler.h64
-rw-r--r--src/components/include/protocol_handler/protocol_handler_settings.h28
-rw-r--r--src/components/include/protocol_handler/session_observer.h68
-rw-r--r--src/components/include/protocol_handler/telemetry_observer.h12
-rw-r--r--src/components/include/resumption/last_state.h87
-rw-r--r--src/components/include/resumption/last_state_wrapper.h57
-rw-r--r--src/components/include/rpc_base/validation_report.h2
-rw-r--r--src/components/include/security_manager/crypto_manager.h22
-rw-r--r--src/components/include/security_manager/security_manager.h20
-rw-r--r--src/components/include/security_manager/security_manager_listener.h18
-rw-r--r--src/components/include/security_manager/security_query.h10
-rw-r--r--src/components/include/security_manager/ssl_context.h17
-rw-r--r--src/components/include/test/application_manager/mock_app_extension.h10
-rw-r--r--src/components/include/test/application_manager/mock_app_launch_settings.h2
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h149
-rw-r--r--src/components/include/test/application_manager/mock_application_manager_settings.h22
-rw-r--r--src/components/include/test/application_manager/mock_request_controller_settings.h2
-rw-r--r--src/components/include/test/application_manager/mock_rpc_handler.h43
-rw-r--r--src/components/include/test/application_manager/mock_rpc_plugin.h14
-rw-r--r--src/components/include/test/application_manager/mock_rpc_plugin_manager.h2
-rw-r--r--src/components/include/test/application_manager/mock_rpc_service.h31
-rw-r--r--src/components/include/test/application_manager/mock_state_controller.h52
-rw-r--r--src/components/include/test/application_manager/policies/mock_custom_vehicle_data_provider.h24
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h149
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_observer.h5
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler.h50
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler_observer.h21
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler_settings.h2
-rw-r--r--src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h6
-rw-r--r--src/components/include/test/media_manager/mock_media_manager.h1
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_cache_manager.h81
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_listener.h46
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h148
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_settings.h5
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_ptu_retry_handler.h48
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h79
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h46
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h133
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h5
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_handler.h24
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_handler_settings.h11
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_observer.h2
-rw-r--r--src/components/include/test/protocol_handler/mock_session_observer.h20
-rw-r--r--src/components/include/test/protocol_handler/mock_telemetry_observer.h5
-rw-r--r--src/components/include/test/resumption/mock_last_state.h7
-rw-r--r--src/components/include/test/security_manager/mock_security_manager.h11
-rw-r--r--src/components/include/test/security_manager/mock_security_manager_listener.h6
-rw-r--r--src/components/include/test/telemetry_monitor/mock_telemetry_observable.h2
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager.h30
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager_listener.h6
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager_settings.h19
-rw-r--r--src/components/include/test/transport_manager/transport_adapter/mock_device.h2
-rw-r--r--src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h24
-rw-r--r--src/components/include/test/utils/mock_system_time_handler.h1
-rw-r--r--src/components/include/test/utils/test_async_waiter.h2
-rw-r--r--src/components/include/transport_manager/common.h22
-rw-r--r--src/components/include/transport_manager/error.h4
-rw-r--r--src/components/include/transport_manager/transport_adapter/device.h55
-rw-r--r--src/components/include/transport_manager/transport_adapter/transport_adapter.h99
-rw-r--r--src/components/include/transport_manager/transport_adapter/transport_adapter_event.h31
-rw-r--r--src/components/include/transport_manager/transport_manager.h77
-rw-r--r--src/components/include/transport_manager/transport_manager_listener.h30
-rw-r--r--src/components/include/transport_manager/transport_manager_listener_empty.h21
-rw-r--r--src/components/include/transport_manager/transport_manager_mme_settings.h2
-rw-r--r--src/components/include/transport_manager/transport_manager_settings.h42
-rw-r--r--src/components/include/utils/atomic_object.h112
-rw-r--r--src/components/include/utils/conditional_variable.h19
-rw-r--r--src/components/include/utils/custom_string.h4
-rw-r--r--src/components/include/utils/data_accessor.h11
-rw-r--r--src/components/include/utils/date_time.h99
-rw-r--r--src/components/include/utils/lock.hbin5418 -> 6172 bytes
-rw-r--r--src/components/include/utils/logger.h31
-rw-r--r--src/components/include/utils/macro.h14
-rw-r--r--src/components/include/utils/make_shared.h191
-rw-r--r--src/components/include/utils/message_queue.h15
-rw-r--r--src/components/include/utils/messagemeter.h35
-rw-r--r--src/components/include/utils/mutable_data_accessor.h78
-rw-r--r--src/components/include/utils/prioritized_queue.h4
-rw-r--r--src/components/include/utils/push_log.h2
-rw-r--r--src/components/include/utils/rwlock.h24
-rw-r--r--src/components/include/utils/scope_guard.h2
-rw-r--r--src/components/include/utils/semantic_version.h125
-rw-r--r--src/components/include/utils/shared_ptr.h390
-rw-r--r--src/components/include/utils/threads/async_runner.h6
-rw-r--r--src/components/include/utils/threads/message_loop_thread.h4
-rw-r--r--src/components/include/utils/threads/thread.h4
-rw-r--r--src/components/include/utils/typed_enum_print.h (renamed from src/components/dbus/test/dbus_adapter_test.cc)39
-rw-r--r--src/components/interfaces/CMakeLists.txt48
-rw-r--r--src/components/interfaces/HMI_API.xml2382
-rw-r--r--src/components/interfaces/HMI_API.xsd125
-rw-r--r--src/components/interfaces/Json_HMI_message_specification.txt7
-rw-r--r--src/components/interfaces/MOBILE_API.xml6270
-rw-r--r--src/components/interfaces/QT_HMI_API.xml5517
-rw-r--r--src/components/interfaces/v4_protocol_v1_2_no_extra.xsd83
-rw-r--r--src/components/media_manager/CMakeLists.txt2
-rw-r--r--src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h4
-rw-r--r--src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h6
-rw-r--r--src/components/media_manager/include/media_manager/audio/from_mic_recorder_listener.h1
-rw-r--r--src/components/media_manager/include/media_manager/audio/from_mic_to_file_recorder_thread.h2
-rw-r--r--src/components/media_manager/include/media_manager/file_streamer_adapter.h2
-rw-r--r--src/components/media_manager/include/media_manager/media_adapter_impl.h4
-rw-r--r--src/components/media_manager/include/media_manager/media_manager_impl.h21
-rw-r--r--src/components/media_manager/include/media_manager/streamer_adapter.h10
-rw-r--r--src/components/media_manager/include/media_manager/video/socket_video_streamer_adapter.h2
-rw-r--r--src/components/media_manager/src/audio/a2dp_source_player_adapter.cc36
-rw-r--r--src/components/media_manager/src/audio/audio_stream_sender_thread.cc33
-rw-r--r--src/components/media_manager/src/audio/from_mic_recorder_adapter.cc6
-rw-r--r--src/components/media_manager/src/audio/from_mic_recorder_listener.cc10
-rw-r--r--src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc34
-rw-r--r--src/components/media_manager/src/audio/socket_audio_streamer_adapter.cc2
-rw-r--r--src/components/media_manager/src/file_streamer_adapter.cc4
-rw-r--r--src/components/media_manager/src/media_manager_impl.cc150
-rw-r--r--src/components/media_manager/src/pipe_streamer_adapter.cc67
-rw-r--r--src/components/media_manager/src/socket_streamer_adapter.cc10
-rw-r--r--src/components/media_manager/src/streamer_adapter.cc6
-rw-r--r--src/components/media_manager/src/video/video_stream_to_file_adapter.cc6
-rw-r--r--src/components/media_manager/test/CMakeLists.txt2
-rw-r--r--src/components/media_manager/test/include/media_manager/mock_media_adapter.h2
-rw-r--r--src/components/media_manager/test/include/media_manager/mock_media_adapter_impl.h5
-rw-r--r--src/components/media_manager/test/media_manager_impl_test.cc76
-rw-r--r--src/components/policy/policy_external/.gitignore2
-rw-r--r--src/components/policy/policy_external/CMakeLists.txt84
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/JSONHandler/Formatters/index.txt6
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Types/Value representation.txt4
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Validation/Schema Structure.txt44
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Validation/Validation.txt6
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/ConnectionManagement.txt12
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/DataTransfer.txt10
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/DeviceManagement.txt8
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/index.txt6
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/BluetoothAdapter.txt6
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/TCPAdapter.txt4
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/index.txt60
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/MultiThreading.txt4
-rw-r--r--src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/TrasportManager.txt8
-rw-r--r--src/components/policy/policy_external/doc/doxygen/tools/InterfaceGenerator/How To Use.txt2
-rw-r--r--src/components/policy/policy_external/include/policy/access_remote.h2
-rw-r--r--src/components/policy/policy_external/include/policy/access_remote_impl.h6
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager.h270
-rw-r--r--src/components/policy/policy_external/include/policy/cache_manager_interface.h249
-rw-r--r--src/components/policy/policy_external/include/policy/policy_helper.h93
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h414
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table.h9
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/enums.h131
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/policy_enum_schema_factory.h62
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/types.h179
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml29
-rw-r--r--src/components/policy/policy_external/include/policy/policy_types.h103
-rw-r--r--src/components/policy/policy_external/include/policy/pt_ext_representation.h8
-rw-r--r--src/components/policy/policy_external/include/policy/pt_representation.h29
-rw-r--r--src/components/policy/policy_external/include/policy/ptu_retry_handler.h57
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_ext_representation.h2
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_queries.h27
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_representation.h45
-rw-r--r--src/components/policy/policy_external/include/policy/status.h119
-rw-r--r--src/components/policy/policy_external/include/policy/update_status_manager.h46
-rw-r--r--src/components/policy/policy_external/include/policy/usage_statistics/counter.h24
-rw-r--r--src/components/policy/policy_external/src/access_remote_impl.cc2
-rw-r--r--src/components/policy/policy_external/src/cache_manager.cc609
-rw-r--r--src/components/policy/policy_external/src/policy_helper.cc460
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc983
-rw-r--r--src/components/policy/policy_external/src/policy_table.cc2
-rw-r--r--src/components/policy/policy_external/src/policy_table/enums.cc758
-rw-r--r--src/components/policy/policy_external/src/policy_table/types.cc775
-rw-r--r--src/components/policy/policy_external/src/policy_table/validation.cc71
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_queries.cc14
-rw-r--r--src/components/policy/policy_external/src/sql_pt_ext_representation.cc143
-rw-r--r--src/components/policy/policy_external/src/sql_pt_queries.cc277
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc883
-rw-r--r--src/components/policy/policy_external/src/status.cc59
-rw-r--r--src/components/policy/policy_external/src/update_status_manager.cc56
-rw-r--r--src/components/policy/policy_external/src/usage_statistics/counter.cc17
-rw-r--r--src/components/policy/policy_external/test/CMakeLists.txt2
-rw-r--r--src/components/policy/policy_external/test/counter_test.cc27
-rw-r--r--src/components/policy/policy_external/test/generated_code_test.cc10
-rw-r--r--src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h4
-rw-r--r--src/components/policy/policy_external/test/include/policy/mock_pt_representation.h5
-rw-r--r--src/components/policy/policy_external/test/include/policy/mock_update_status_manager.h3
-rw-r--r--src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h16
-rw-r--r--src/components/policy/policy_external/test/json/PTU.json8
-rw-r--r--src/components/policy/policy_external/test/json/PTU2.json8
-rw-r--r--src/components/policy/policy_external/test/json/PTU3.json8
-rw-r--r--src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json8
-rw-r--r--src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json8
-rw-r--r--src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json8
-rw-r--r--src/components/policy/policy_external/test/json/PTU_without_requestType_field.json8
-rw-r--r--src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json8
-rw-r--r--src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json8
-rw-r--r--src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json8
-rw-r--r--src/components/policy/policy_external/test/json/ptu2_requestType.json8
-rw-r--r--src/components/policy/policy_external/test/json/ptu_requestType.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_preloaded_pt.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_pt_first_update.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_pt_second_update.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_pt_update.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json8
-rw-r--r--src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json8
-rw-r--r--src/components/policy/policy_external/test/json/valid_sdl_pt_update.json16
-rw-r--r--src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc537
-rw-r--r--src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc44
-rw-r--r--src/components/policy/policy_external/test/policy_manager_impl_stress_test.cc6
-rw-r--r--src/components/policy/policy_external/test/policy_manager_impl_test.cc261
-rw-r--r--src/components/policy/policy_external/test/policy_manager_impl_test_base.cc175
-rw-r--r--src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc170
-rw-r--r--src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc50
-rw-r--r--src/components/policy/policy_external/test/sql_pt_representation_test.cc178
-rw-r--r--src/components/policy/policy_external/test/update_status_manager_test.cc100
-rw-r--r--src/components/policy/policy_regular/CMakeLists.txt83
-rw-r--r--src/components/policy/policy_regular/doc/doxygen/components/JSONHandler/Formatters/index.txt6
-rw-r--r--src/components/policy/policy_regular/include/policy/access_remote.h2
-rw-r--r--src/components/policy/policy_regular/include/policy/access_remote_impl.h6
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager.h208
-rw-r--r--src/components/policy/policy_regular/include/policy/cache_manager_interface.h205
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_helper.h69
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h382
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table.h8
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/enums.h124
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/policy_enum_schema_factory.h60
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/types.h179
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_types.h125
-rw-r--r--src/components/policy/policy_regular/include/policy/pt_ext_representation.h336
-rw-r--r--src/components/policy/policy_regular/include/policy/pt_representation.h31
-rw-r--r--src/components/policy/policy_regular/include/policy/sql_pt_ext_queries.h97
-rw-r--r--src/components/policy/policy_regular/include/policy/sql_pt_ext_representation.h206
-rw-r--r--src/components/policy/policy_regular/include/policy/sql_pt_queries.h25
-rw-r--r--src/components/policy/policy_regular/include/policy/sql_pt_representation.h45
-rw-r--r--src/components/policy/policy_regular/include/policy/status.h122
-rw-r--r--src/components/policy/policy_regular/include/policy/update_status_manager.h29
-rw-r--r--src/components/policy/policy_regular/include/policy/update_status_manager_interface.h11
-rw-r--r--src/components/policy/policy_regular/include/policy/usage_statistics/counter.h24
-rw-r--r--src/components/policy/policy_regular/policy_table_interface_ext.xml283
-rw-r--r--src/components/policy/policy_regular/src/access_remote_impl.cc2
-rw-r--r--src/components/policy/policy_regular/src/cache_manager.cc549
-rw-r--r--src/components/policy/policy_regular/src/policy_helper.cc479
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc970
-rw-r--r--src/components/policy/policy_regular/src/policy_table.cc2
-rw-r--r--src/components/policy/policy_regular/src/policy_table/enums.cc659
-rw-r--r--src/components/policy/policy_regular/src/policy_table/types.cc765
-rw-r--r--src/components/policy/policy_regular/src/policy_table/validation.cc59
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_ext_queries.cc268
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_ext_representation.cc1807
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_queries.cc291
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc907
-rw-r--r--src/components/policy/policy_regular/src/status.cc59
-rw-r--r--src/components/policy/policy_regular/src/update_status_manager.cc35
-rw-r--r--src/components/policy/policy_regular/src/usage_statistics/counter.cc17
-rw-r--r--src/components/policy/policy_regular/test/CMakeLists.txt2
-rw-r--r--src/components/policy/policy_regular/test/PTU.json8
-rw-r--r--src/components/policy/policy_regular/test/PTU2.json8
-rw-r--r--src/components/policy/policy_regular/test/PTU3.json8
-rw-r--r--src/components/policy/policy_regular/test/PTU4.json8
-rw-r--r--src/components/policy/policy_regular/test/access_remote_impl_test.cc6
-rw-r--r--src/components/policy/policy_regular/test/counter_test.cc22
-rw-r--r--src/components/policy/policy_regular/test/generated_code_test.cc10
-rw-r--r--src/components/policy/policy_regular/test/include/policy/driver_dbms.h2
-rw-r--r--src/components/policy/policy_regular/test/include/policy/mock_pt_ext_representation.h139
-rw-r--r--src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h5
-rw-r--r--src/components/policy/policy_regular/test/include/policy/mock_update_status_manager.h2
-rw-r--r--src/components/policy/policy_regular/test/policy_manager_impl_test.cc949
-rw-r--r--src/components/policy/policy_regular/test/ptu2_requestType.json8
-rw-r--r--src/components/policy/policy_regular/test/ptu_requestType.json8
-rw-r--r--src/components/policy/policy_regular/test/sdl_preloaded_pt.json8
-rw-r--r--src/components/policy/policy_regular/test/sdl_pt_first_update.json8
-rw-r--r--src/components/policy/policy_regular/test/sdl_pt_second_update.json8
-rw-r--r--src/components/policy/policy_regular/test/sdl_pt_update.json8
-rw-r--r--src/components/policy/policy_regular/test/sql_pt_representation_test.cc247
-rw-r--r--src/components/policy/policy_regular/test/update_status_manager_test.cc25
-rw-r--r--src/components/policy/policy_regular/test/valid_sdl_pt_update.json16
-rw-r--r--src/components/policy/policy_regular/test/vehicle_data_item_type_test.cc260
-rw-r--r--src/components/protocol/src/bson_object_keys.cc7
-rw-r--r--src/components/protocol/src/raw_message.cc6
-rw-r--r--src/components/protocol_handler/CMakeLists.txt6
-rw-r--r--src/components/protocol_handler/docs/SDL.SDD.ServiceStatusUpdate.dox116
-rw-r--r--src/components/protocol_handler/docs/assets/PTU_for_EXTERNAL_PROPRIETARY.pngbin0 -> 95754 bytes
-rw-r--r--src/components/protocol_handler/docs/assets/ServiceStatusUpdate_classes.pngbin0 -> 429855 bytes
-rw-r--r--src/components/protocol_handler/docs/assets/ServiceStatusUpdate_sequence.pngbin0 -> 79236 bytes
-rw-r--r--src/components/protocol_handler/docs/assets/invalid_cert.pngbin0 -> 57118 bytes
-rw-r--r--src/components/protocol_handler/docs/assets/invalid_time.pngbin0 -> 52580 bytes
-rw-r--r--src/components/protocol_handler/docs/assets/ptu_failed.pngbin0 -> 34454 bytes
-rw-r--r--src/components/protocol_handler/include/protocol_handler/handshake_handler.h61
-rw-r--r--src/components/protocol_handler/include/protocol_handler/incoming_data_handler.h2
-rw-r--r--src/components/protocol_handler/include/protocol_handler/multiframe_builder.h40
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h230
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_packet.h79
-rw-r--r--src/components/protocol_handler/include/protocol_handler/service_status_update_handler.h89
-rw-r--r--src/components/protocol_handler/include/protocol_handler/service_status_update_handler_listener.h77
-rw-r--r--src/components/protocol_handler/src/handshake_handler.cc119
-rw-r--r--src/components/protocol_handler/src/incoming_data_handler.cc2
-rw-r--r--src/components/protocol_handler/src/multiframe_builder.cc15
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc1246
-rw-r--r--src/components/protocol_handler/src/protocol_packet.cc146
-rw-r--r--src/components/protocol_handler/src/protocol_payload.cc2
-rw-r--r--src/components/protocol_handler/src/service_status_update_handler.cc117
-rw-r--r--src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h6
-rw-r--r--src/components/protocol_handler/test/include/protocol_handler/mock_service_status_update_handler_listener.h57
-rw-r--r--src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h5
-rw-r--r--src/components/protocol_handler/test/incoming_data_handler_test.cc477
-rw-r--r--src/components/protocol_handler/test/multiframe_builder_test.cc20
-rw-r--r--src/components/protocol_handler/test/protocol_handler_tm_test.cc1808
-rw-r--r--src/components/protocol_handler/test/protocol_header_validator_test.cc14
-rw-r--r--src/components/protocol_handler/test/protocol_packet_test.cc38
-rw-r--r--src/components/protocol_handler/test/protocol_payload_test.cc6
-rw-r--r--src/components/protocol_handler/test/service_status_update_handler_test.cc225
-rw-r--r--src/components/resumption/CMakeLists.txt1
-rw-r--r--src/components/resumption/include/resumption/last_state_impl.h43
-rw-r--r--src/components/resumption/include/resumption/last_state_wrapper_impl.h (renamed from src/components/resumption/include/resumption/last_state.h)33
-rw-r--r--src/components/resumption/src/last_state_impl.cc71
-rw-r--r--src/components/resumption/src/last_state_wrapper_impl.cc49
-rw-r--r--src/components/resumption/test/last_state_test.cc13
-rw-r--r--src/components/rpc_base/include/rpc_base/rpc_base.h33
-rw-r--r--src/components/rpc_base/include/rpc_base/rpc_base_dbus_inl.h501
-rw-r--r--src/components/rpc_base/include/rpc_base/rpc_base_inl.h67
-rw-r--r--src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h7
-rw-r--r--src/components/rpc_base/test/CMakeLists.txt13
-rw-r--r--src/components/rpc_base/test/rpc_base_dbus_test.cc682
-rw-r--r--src/components/rpc_base/test/rpc_base_json_test.cc2
-rw-r--r--src/components/rpc_base/test/rpc_base_test.cc23
-rw-r--r--src/components/rpc_base/test/validation_report_test.cc2
-rw-r--r--src/components/security_manager/CMakeLists.txt1
-rw-r--r--src/components/security_manager/include/security_manager/crypto_manager_impl.h16
-rw-r--r--src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h2
-rw-r--r--src/components/security_manager/include/security_manager/security_manager_impl.h37
-rw-r--r--src/components/security_manager/src/crypto_manager_impl.cc35
-rw-r--r--src/components/security_manager/src/security_manager_impl.cc111
-rw-r--r--src/components/security_manager/src/security_query.cc2
-rw-r--r--src/components/security_manager/src/ssl_context_impl.cc19
-rw-r--r--src/components/security_manager/test/crypto_manager_impl_test.cc15
-rw-r--r--src/components/security_manager/test/security_manager_test.cc105
-rw-r--r--src/components/security_manager/test/security_query_matcher.cc2
-rw-r--r--src/components/security_manager/test/security_query_test.cc6
-rw-r--r--src/components/security_manager/test/ssl_certificate_handshake_test.cc4
-rw-r--r--src/components/security_manager/test/ssl_context_test.cc42
-rw-r--r--src/components/smart_objects/CMakeLists.txt3
-rw-r--r--src/components/smart_objects/include/smart_objects/always_false_schema_item.h33
-rw-r--r--src/components/smart_objects/include/smart_objects/always_true_schema_item.h33
-rw-r--r--src/components/smart_objects/include/smart_objects/array_schema_item.h56
-rw-r--r--src/components/smart_objects/include/smart_objects/bool_schema_item.h12
-rw-r--r--src/components/smart_objects/include/smart_objects/default_shema_item.h55
-rw-r--r--src/components/smart_objects/include/smart_objects/enum_schema_item.h223
-rw-r--r--src/components/smart_objects/include/smart_objects/errors.h12
-rw-r--r--src/components/smart_objects/include/smart_objects/number_schema_item.h69
-rw-r--r--src/components/smart_objects/include/smart_objects/object_schema_item.h142
-rw-r--r--src/components/smart_objects/include/smart_objects/schema_item.h69
-rw-r--r--src/components/smart_objects/include/smart_objects/schema_item_parameter.h8
-rw-r--r--src/components/smart_objects/include/smart_objects/smart_object.h41
-rw-r--r--src/components/smart_objects/include/smart_objects/smart_schema.h54
-rw-r--r--src/components/smart_objects/include/smart_objects/string_schema_item.h34
-rw-r--r--src/components/smart_objects/src/always_false_schema_item.cc27
-rw-r--r--src/components/smart_objects/src/always_true_schema_item.cc25
-rw-r--r--src/components/smart_objects/src/array_schema_item.cc64
-rw-r--r--src/components/smart_objects/src/bool_schema_item.cc12
-rw-r--r--src/components/smart_objects/src/number_schema_item.cc8
-rw-r--r--src/components/smart_objects/src/object_schema_item.cc211
-rw-r--r--src/components/smart_objects/src/schema_item.cc27
-rw-r--r--src/components/smart_objects/src/smart_object.cc55
-rw-r--r--src/components/smart_objects/src/smart_schema.cc37
-rw-r--r--src/components/smart_objects/src/string_schema_item.cc43
-rw-r--r--src/components/smart_objects/test/AlwaysFalseSchemaItem_test.cc22
-rw-r--r--src/components/smart_objects/test/AlwaysTrueSchemaItem_test.cc22
-rw-r--r--src/components/smart_objects/test/ArraySchemaItem_test.cc98
-rw-r--r--src/components/smart_objects/test/BoolSchemaItem_test.cc64
-rw-r--r--src/components/smart_objects/test/CMakeLists.txt6
-rw-r--r--src/components/smart_objects/test/CObjectSchemaItem_test.cc191
-rw-r--r--src/components/smart_objects/test/EnumSchemaItem_test.cc42
-rw-r--r--src/components/smart_objects/test/NumberSchemaItem_test.cc224
-rw-r--r--src/components/smart_objects/test/SmartObjectConvertionTime_test.cc124
-rw-r--r--src/components/smart_objects/test/SmartObjectDraft_test.cc10
-rw-r--r--src/components/smart_objects/test/SmartObjectInvalid_test.cc4
-rw-r--r--src/components/smart_objects/test/SmartObjectStress_test.cc14
-rw-r--r--src/components/smart_objects/test/SmartObjectUnit_test.cc30
-rw-r--r--src/components/smart_objects/test/StringSchemaItem_test.cc78
-rw-r--r--src/components/smart_objects/test/map_performance_test.cc4
-rw-r--r--src/components/smart_objects/test/smart_object_performance_test.cc6
-rw-r--r--src/components/telemetry_monitor/CMakeLists.txt4
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h6
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h6
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/json_keys.h4
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/metric_wrapper.h2
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h6
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h6
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h43
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h2
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_observer.h5
-rw-r--r--src/components/telemetry_monitor/src/application_manager_metric_wrapper.cc17
-rw-r--r--src/components/telemetry_monitor/src/application_manager_observer.cc8
-rw-r--r--src/components/telemetry_monitor/src/metric_wrapper.cc9
-rw-r--r--src/components/telemetry_monitor/src/protocol_handler_metric_wrapper.cc5
-rw-r--r--src/components/telemetry_monitor/src/protocol_handler_observer.cc12
-rw-r--r--src/components/telemetry_monitor/src/telemetry_monitor.cc88
-rw-r--r--src/components/telemetry_monitor/src/transport_manager_metric_wrapper.cc7
-rw-r--r--src/components/telemetry_monitor/src/transport_manager_observer.cc16
-rw-r--r--src/components/telemetry_monitor/test/application_manager_metric_test.cc51
-rw-r--r--src/components/telemetry_monitor/test/application_manager_observer_test.cc10
-rw-r--r--src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h7
-rw-r--r--src/components/telemetry_monitor/test/metric_wrapper_test.cc4
-rw-r--r--src/components/telemetry_monitor/test/protocol_handler_metric_test.cc40
-rw-r--r--src/components/telemetry_monitor/test/protocol_handler_observer_test.cc18
-rw-r--r--src/components/telemetry_monitor/test/telemetry_monitor_test.cc24
-rw-r--r--src/components/telemetry_monitor/test/transport_manager_metric_test.cc38
-rw-r--r--src/components/telemetry_monitor/test/transport_manager_observer_test.cc6
-rw-r--r--src/components/test_main.cc4
-rw-r--r--src/components/transport_manager/CMakeLists.txt53
-rw-r--r--src/components/transport_manager/docs/SDL.SDD.WebEngineSupport.dox127
-rw-r--r--src/components/transport_manager/docs/assets/WES_classes.pngbin0 -> 55856 bytes
-rw-r--r--src/components/transport_manager/docs/assets/WES_sequence.pngbin0 -> 77759 bytes
-rw-r--r--src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h7
-rw-r--r--src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h6
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/cloud_device.h78
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_connection_factory.h98
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h107
-rw-r--r--src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h205
-rw-r--r--src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h42
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/network_interface_listener.h41
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/network_interface_listener_impl.h63
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/platform_specific/linux/platform_specific_network_interface_listener_impl.h201
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/platform_specific/qnx/platform_specific_network_interface_listener_impl.h70
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h54
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/tcp_device.h12
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h36
-rw-r--r--src/components/transport_manager/include/transport_manager/telemetry_observer.h8
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/client_connection_listener.h12
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/connection.h10
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/threaded_socket_connection.h10
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h39
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h144
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h34
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h29
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_manager_default.h41
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_manager_impl.h127
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/common.h8
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/libusb/platform_usb_device.h2
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h6
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/libusb/usb_handler.h3
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/qnx/platform_usb_device.h2
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/qnx/usb_connection.h2
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/qnx/usb_handler.h2
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h7
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/usb_control_transfer.h4
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/usb_device.h2
-rw-r--r--src/components/transport_manager/include/transport_manager/usb/usb_device_scanner.h10
-rw-r--r--src/components/transport_manager/include/transport_manager/websocket_server/websocket_connection.h126
-rw-r--r--src/components/transport_manager/include/transport_manager/websocket_server/websocket_device.h75
-rw-r--r--src/components/transport_manager/include/transport_manager/websocket_server/websocket_listener.h120
-rw-r--r--src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h64
-rw-r--r--src/components/transport_manager/include/transport_manager/websocket_server/websocket_server_transport_adapter.h136
-rw-r--r--src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h107
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc7
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_device.cc8
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc34
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc10
-rw-r--r--src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc52
-rw-r--r--src/components/transport_manager/src/cloud/cloud_device.cc97
-rw-r--r--src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc85
-rw-r--r--src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc145
-rw-r--r--src/components/transport_manager/src/cloud/websocket_client_connection.cc358
-rw-r--r--src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc32
-rw-r--r--src/components/transport_manager/src/tcp/network_interface_listener_impl.cc42
-rw-r--r--src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc673
-rw-r--r--src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc38
-rw-r--r--src/components/transport_manager/src/tcp/tcp_client_listener.cc615
-rw-r--r--src/components/transport_manager/src/tcp/tcp_connection_factory.cc13
-rw-r--r--src/components/transport_manager/src/tcp/tcp_device.cc12
-rw-r--r--src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc8
-rw-r--r--src/components/transport_manager/src/tcp/tcp_transport_adapter.cc63
-rw-r--r--src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc41
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc448
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc61
-rw-r--r--src/components/transport_manager/src/transport_manager_default.cc120
-rw-r--r--src/components/transport_manager/src/transport_manager_impl.cc375
-rw-r--r--src/components/transport_manager/src/usb/libusb/platform_usb_device.cc4
-rw-r--r--src/components/transport_manager/src/usb/libusb/usb_connection.cc122
-rw-r--r--src/components/transport_manager/src/usb/libusb/usb_handler.cc34
-rw-r--r--src/components/transport_manager/src/usb/qnx/platform_usb_device.cc4
-rw-r--r--src/components/transport_manager/src/usb/qnx/usb_connection.cc8
-rw-r--r--src/components/transport_manager/src/usb/qnx/usb_handler.cc8
-rw-r--r--src/components/transport_manager/src/usb/usb_aoa_adapter.cc10
-rw-r--r--src/components/transport_manager/src/usb/usb_connection_factory.cc23
-rw-r--r--src/components/transport_manager/src/usb/usb_device_scanner.cc45
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_connection.cc218
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_device.cc94
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_listener.cc299
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_secure_session.cc79
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc141
-rw-r--r--src/components/transport_manager/src/websocket_server/websocket_session.cc162
-rw-r--r--src/components/transport_manager/test/CMakeLists.txt27
-rw-r--r--src/components/transport_manager/test/include/transport_manager/bt/mock_bluetooth_transport_adapter.h55
-rw-r--r--src/components/transport_manager/test/include/transport_manager/cloud/mock_cloud_websocket_transport_adapter.h64
-rw-r--r--src/components/transport_manager/test/include/transport_manager/cloud/sample_websocket_server.h165
-rw-r--r--src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h4
-rw-r--r--src/components/transport_manager/test/include/transport_manager/mock_transport_manager_listener.h7
-rw-r--r--src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h6
-rw-r--r--src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_client_listener.h34
-rw-r--r--src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_transport_adapter.h27
-rw-r--r--src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_client_connection_listener.h6
-rw-r--r--src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_connection.h1
-rw-r--r--src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_controller.h79
-rw-r--r--src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h37
-rw-r--r--src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h8
-rw-r--r--src/components/transport_manager/test/include/transport_manager/usb/mock_usb_aoa_adapter.h62
-rw-r--r--src/components/transport_manager/test/include/transport_manager/websocket_server/websocket_sample_client.h117
-rw-r--r--src/components/transport_manager/test/network_interface_listener_test.cc57
-rw-r--r--src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc578
-rw-r--r--src/components/transport_manager/test/sample_websocket_server.cc391
-rw-r--r--src/components/transport_manager/test/tcp_client_listener_test.cc555
-rw-r--r--src/components/transport_manager/test/tcp_device_test.cc2
-rw-r--r--src/components/transport_manager/test/tcp_transport_adapter_test.cc143
-rw-r--r--src/components/transport_manager/test/test_certs/ca-cert.pem23
-rw-r--r--src/components/transport_manager/test/test_certs/client-cert.pem21
-rw-r--r--src/components/transport_manager/test/test_certs/client-key.pem28
-rw-r--r--src/components/transport_manager/test/test_certs/invalid_cert.pem22
-rw-r--r--src/components/transport_manager/test/test_certs/invalid_key.pem28
-rw-r--r--src/components/transport_manager/test/test_certs/server-cert.pem21
-rw-r--r--src/components/transport_manager/test/test_certs/server-key.pem28
-rw-r--r--src/components/transport_manager/test/transport_adapter_listener_test.cc22
-rw-r--r--src/components/transport_manager/test/transport_adapter_test.cc656
-rw-r--r--src/components/transport_manager/test/transport_manager_default_test.cc301
-rw-r--r--src/components/transport_manager/test/transport_manager_impl_test.cc162
-rw-r--r--src/components/transport_manager/test/websocket_client_connection_test.cc482
-rw-r--r--src/components/transport_manager/test/websocket_connection_test.cc170
-rw-r--r--src/components/transport_manager/test/websocket_sample_client/websocket_sample_client.cc193
-rw-r--r--src/components/transport_manager/test/websocket_server_listener_test.cc260
-rw-r--r--src/components/utils/CMakeLists.txt20
-rw-r--r--src/components/utils/include/utils/back_trace.h2
-rw-r--r--src/components/utils/include/utils/file_system.h247
-rw-r--r--src/components/utils/include/utils/helpers.h2
-rw-r--r--src/components/utils/include/utils/jsoncpp_reader_wrapper.h52
-rw-r--r--src/components/utils/include/utils/log_message_loop_thread.h14
-rw-r--r--src/components/utils/include/utils/optional.h2
-rw-r--r--src/components/utils/include/utils/qdb_wrapper/sql_query.h4
-rw-r--r--src/components/utils/include/utils/resource_usage.h6
-rw-r--r--src/components/utils/include/utils/signals.h54
-rw-r--r--src/components/utils/include/utils/singleton.h2
-rw-r--r--src/components/utils/include/utils/sqlite_wrapper/sql_database.h2
-rw-r--r--src/components/utils/include/utils/sqlite_wrapper/sql_query.h2
-rw-r--r--src/components/utils/include/utils/stl_utils.h1
-rw-r--r--src/components/utils/include/utils/system.h2
-rw-r--r--src/components/utils/include/utils/system_time_handler.h11
-rw-r--r--src/components/utils/include/utils/threads/pulse_thread_delegate.h22
-rw-r--r--src/components/utils/include/utils/threads/thread_manager.h10
-rw-r--r--src/components/utils/include/utils/timer.h22
-rw-r--r--src/components/utils/include/utils/timer_task_impl.h2
-rw-r--r--src/components/utils/src/back_trace.cc4
-rw-r--r--src/components/utils/src/conditional_variable_boost.cc135
-rw-r--r--src/components/utils/src/conditional_variable_posix.cc149
-rw-r--r--src/components/utils/src/convert_utils.cc2
-rw-r--r--src/components/utils/src/custom_string.cc10
-rw-r--r--src/components/utils/src/date_time.cc128
-rw-r--r--src/components/utils/src/file_system.cc513
-rw-r--r--src/components/utils/src/gen_hash.cc2
-rw-r--r--src/components/utils/src/jsoncpp_reader_wrapper.cc62
-rw-r--r--src/components/utils/src/lock_boost.cc (renamed from src/components/utils/src/lock_posix.cc)114
-rw-r--r--src/components/utils/src/log_message_loop_thread.cc7
-rw-r--r--src/components/utils/src/logger.cc4
-rw-r--r--src/components/utils/src/push_log.cc53
-rw-r--r--src/components/utils/src/qdb_wrapper/sql_database.cc2
-rw-r--r--src/components/utils/src/qdb_wrapper/sql_query.cc4
-rw-r--r--src/components/utils/src/resource_usage.cc4
-rw-r--r--src/components/utils/src/rwlock_posix.cc2
-rw-r--r--src/components/utils/src/semantic_version.cc (renamed from src/components/utils/test/atomic_object_test.cc)30
-rw-r--r--src/components/utils/src/signals_posix.cc46
-rw-r--r--src/components/utils/src/system.cc12
-rw-r--r--src/components/utils/src/threads/async_runner.cc2
-rw-r--r--src/components/utils/src/threads/pulse_thread_delegate.cc2
-rw-r--r--src/components/utils/src/threads/thread_delegate.cc2
-rw-r--r--src/components/utils/src/threads/thread_manager.cc8
-rw-r--r--src/components/utils/src/threads/thread_posix.cc14
-rw-r--r--src/components/utils/src/threads/thread_validator.cc17
-rw-r--r--src/components/utils/src/timer.cc25
-rw-r--r--src/components/utils/test/CMakeLists.txt2
-rw-r--r--src/components/utils/test/async_runner_test.cc20
-rw-r--r--src/components/utils/test/auto_trace_test.cc14
-rw-r--r--src/components/utils/test/back_trace_test.cc2
-rw-r--r--src/components/utils/test/bitstream_test.cc2
-rw-r--r--src/components/utils/test/conditional_variable_test.cc5
-rw-r--r--src/components/utils/test/custom_string_test.cc2
-rw-r--r--src/components/utils/test/data_accessor_test.cc2
-rw-r--r--src/components/utils/test/date_time_test.cc333
-rw-r--r--src/components/utils/test/file_system_test.cc15
-rw-r--r--src/components/utils/test/generated_code_with_sqlite_test.cc2
-rw-r--r--src/components/utils/test/include/utils/generated_code_with_sqlite_test.h2
-rw-r--r--src/components/utils/test/include/utils/mock_signals_posix.h59
-rw-r--r--src/components/utils/test/lock_boost_test.cc (renamed from src/components/utils/test/lock_posix_test.cc)36
-rw-r--r--src/components/utils/test/log_message_loop_thread_test.cc6
-rw-r--r--src/components/utils/test/message_queue_test.cc5
-rw-r--r--src/components/utils/test/messagemeter_test.cc106
-rw-r--r--src/components/utils/test/mock_signals_posix.cc76
-rw-r--r--src/components/utils/test/posix_thread_test.cc2
-rw-r--r--src/components/utils/test/prioritized_queue_test.cc2
-rw-r--r--src/components/utils/test/qdb_wrapper/sql_database_test.cc4
-rw-r--r--src/components/utils/test/qdb_wrapper/sql_query_test.cc4
-rw-r--r--src/components/utils/test/resource_usage_test.cc4
-rw-r--r--src/components/utils/test/scope_guard_test.cc10
-rw-r--r--src/components/utils/test/shared_ptr_test.cc542
-rw-r--r--src/components/utils/test/singleton_test.cc2
-rw-r--r--src/components/utils/test/sqlite_wrapper/sql_database_test.cc62
-rw-r--r--src/components/utils/test/sqlite_wrapper/sql_query_test.cc6
-rw-r--r--src/components/utils/test/stl_utils_test.cc4
-rw-r--r--src/components/utils/test/system_test.cc2
-rw-r--r--src/components/utils/test/test_generator/CMakeLists.txt4
-rw-r--r--src/components/utils/test/test_generator/generated_msg_version_test.cc4
-rw-r--r--src/components/utils/test/timer_test.cc4
-rw-r--r--third_party.md103
-rw-r--r--tools/CMakeLists.txt3
-rwxr-xr-xtools/InterfaceGenerator/Generator.py231
-rw-r--r--tools/InterfaceGenerator/MsgVersionGenerate.py55
-rwxr-xr-xtools/InterfaceGenerator/generator/Model.py326
-rw-r--r--tools/InterfaceGenerator/generator/generators/PolicyTypes.py689
-rwxr-xr-xtools/InterfaceGenerator/generator/generators/SmartFactoryBase.py565
-rwxr-xr-xtools/InterfaceGenerator/generator/generators/SmartFactoryJSONRPC.py78
-rwxr-xr-xtools/InterfaceGenerator/generator/generators/SmartFactorySDLRPC.py27
-rwxr-xr-xtools/InterfaceGenerator/generator/parsers/JSONRPC.py31
-rwxr-xr-xtools/InterfaceGenerator/generator/parsers/RPCBase.py767
-rwxr-xr-xtools/InterfaceGenerator/generator/parsers/SDLRPCV1.py10
-rwxr-xr-xtools/InterfaceGenerator/generator/parsers/SDLRPCV2.py88
-rw-r--r--tools/InterfaceGenerator/requirements.txt7
-rwxr-xr-xtools/InterfaceGenerator/test/CodeFormatAndQuality.py39
-rwxr-xr-xtools/InterfaceGenerator/test/generator/generators/test_SmartFactoryBase.py89
-rwxr-xr-xtools/InterfaceGenerator/test/generator/generators/test_SmartFactoryJSONRPC.py382
-rwxr-xr-xtools/InterfaceGenerator/test/generator/generators/test_SmartFactorySDLRPC.py251
-rw-r--r--tools/InterfaceGenerator/test/generator/generators/test_expected_jsonrpc.cc138
-rw-r--r--tools/InterfaceGenerator/test/generator/generators/test_expected_jsonrpc.h22
-rw-r--r--tools/InterfaceGenerator/test/generator/generators/test_expected_sdlrpc.cc112
-rw-r--r--tools/InterfaceGenerator/test/generator/generators/test_expected_sdlrpc.h22
-rwxr-xr-xtools/InterfaceGenerator/test/generator/parsers/test_JSONRPC.py88
-rwxr-xr-xtools/InterfaceGenerator/test/generator/parsers/test_SDLRPCV1.py64
-rwxr-xr-xtools/InterfaceGenerator/test/generator/parsers/test_SDLRPCV2.py417
-rw-r--r--tools/InterfaceGenerator/test/generator/parsers/valid_JSONRPC.xml38
-rw-r--r--tools/InterfaceGenerator/test/generator/parsers/valid_SDLRPCV1.xml32
-rw-r--r--tools/InterfaceGenerator/test/generator/parsers/valid_SDLRPCV2.xml85
-rwxr-xr-xtools/InterfaceGenerator/test/generator/test_Model.py27
-rwxr-xr-xtools/InterfaceGenerator/test/test_CodeFormatAndQuality.py59
-rw-r--r--tools/cmake/helpers/generators.cmake19
-rw-r--r--tools/cmake/modules/FindDBus.cmake59
-rw-r--r--tools/cmake/modules/FindQt5DBus.cmake10
-rwxr-xr-xtools/infrastructure/check_style.sh2
-rwxr-xr-xtools/infrastructure/git-hooks/pre-commit6
-rw-r--r--tools/intergen/GenerateInterfaceLibrary.cmake10
-rw-r--r--tools/intergen/cppgen/CMakeLists.txt2
-rw-r--r--tools/intergen/cppgen/include/cppgen/generator_preferences.h5
-rw-r--r--tools/intergen/cppgen/include/cppgen/message_factory_function.h3
-rw-r--r--tools/intergen/cppgen/include/cppgen/struct_type_dbus_serializer.h88
-rw-r--r--tools/intergen/cppgen/src/cppgen/cpp_interface_code_generator.cc3
-rw-r--r--tools/intergen/cppgen/src/cppgen/declaration_generator.cc38
-rw-r--r--tools/intergen/cppgen/src/cppgen/definition_generator.cc29
-rw-r--r--tools/intergen/cppgen/src/cppgen/generator_preferences.cc9
-rw-r--r--tools/intergen/cppgen/src/cppgen/handler_interface.cc4
-rw-r--r--tools/intergen/cppgen/src/cppgen/message_factory_function.cc6
-rw-r--r--tools/intergen/cppgen/src/cppgen/module_manager.cc6
-rw-r--r--tools/intergen/cppgen/src/cppgen/struct_type_dbus_serializer.cc177
-rw-r--r--tools/intergen/model/src/model/composite_type.cc1
-rw-r--r--tools/intergen/test/CMakeLists.txt23
-rw-r--r--tools/intergen/test/generated_interface_dbus_tests.cc127
-rw-r--r--tools/intergen/test/generated_interface_json_tests.cc156
-rw-r--r--tools/intergen/test/test_hmi_interface.xml1096
-rw-r--r--tools/intergen/tool/intergen.cc7
-rw-r--r--tools/policy_table_validator/CMakeLists.txt6
-rw-r--r--tools/policy_table_validator/main.cpp9
m---------tools/rpc_spec0
2318 files changed, 113321 insertions, 85120 deletions
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 672768add7..1da30fbf62 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -4,8 +4,8 @@ Third party contributions are essential for making SDL great. However, we do hav
## Environment
Currently supported:
-* Ubuntu Linux 14.04 with GCC 4.9.x
* Ubuntu Linux 16.04 with GCC 5.4.x
+* Ubuntu Linux 18.04 with GCC 7.3.x
* [C++11 standard](https://github.com/smartdevicelink/sdl_evolution/issues/132)
### Issues
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 1b58b20e86..d62fd997a0 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -1,4 +1,4 @@
-[Delete any non-applicable sections, but we may ask for more information.]
+[Delete any non-applicable sections, but we may ask for more information. Please reference the [SmartDeviceLink GitHub Best Practices](https://d83tozu1c8tt6.cloudfront.net/media/resources/SDL_GitHub_BestPractices.pdf) for further instructions on how to enter an issue.]
### Bug Report
[Summary]
@@ -20,4 +20,4 @@
* Testing Against: [What you tested with to observe this behavior. Proxy, App, HMI etc.]
##### Test Case, Sample Code, and / or Example App
-[Paste a link to a PR, gist, or other code that exemplifies this behavior] \ No newline at end of file
+[Paste a link to a PR, gist, or other code that exemplifies this behavior]
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 83c3261f9b..301a22eafe 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,4 +1,4 @@
-[Things to note: Pull Requests **must** fix an issue. Discussion about the feature / bug takes place in the issue, discussion of the implementation takes place in the PR. Please also see the [Contributing Guide](https://github.com/smartdevicelink/sdl_core/blob/master/.github/CONTRIBUTING.md) for information on branch naming and the CLA.
+[Things to note: Pull Requests **must** fix an issue. Discussion about the feature / bug takes place in the issue, discussion of the implementation takes place in the PR. Please also see the [Contributing Guide](https://github.com/smartdevicelink/sdl_core/blob/master/.github/CONTRIBUTING.md) for information on branch naming and the CLA, and the [SmartDeviceLink GitHub Best Practices](https://d83tozu1c8tt6.cloudfront.net/media/resources/SDL_GitHub_BestPractices.pdf) document for more information on how to enter a pull request. Once this PR is ready for review, please request one from @theresalech.
Delete the above section when you've read it.]
@@ -30,4 +30,4 @@ This PR makes **[no / minor / major]** API changes.
- [ ] [Task 2]
### CLA
-- [ ] I have signed [the CLA](https://docs.google.com/forms/d/e/1FAIpQLSdsgJY33VByaX482zHzi-xUm49JNnmuJOyAM6uegPQ2LXYVfA/viewform) \ No newline at end of file
+- [ ] I have signed [the CLA](https://docs.google.com/forms/d/e/1FAIpQLSdsgJY33VByaX482zHzi-xUm49JNnmuJOyAM6uegPQ2LXYVfA/viewform)
diff --git a/.gitignore b/.gitignore
index ec291473fe..3570938a52 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,8 @@ CMakeFiles/
*.pyc
.idea
src/appMain/build_config.txt
+*venv*
+*.DS_Store
+*htmlcov
+*.coverage
+src/components/interfaces/MOBILE_API.* \ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000000..7e9eba6b45
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "src/3rd_party-static/jsoncpp"]
+ path = src/3rd_party-static/jsoncpp
+ url = https://github.com/smartdevicelink/jsoncpp.git
+[submodule "tools/rpc_spec"]
+ path = tools/rpc_spec
+ url = https://github.com/smartdevicelink/rpc_spec.git
diff --git a/.travis.yml b/.travis.yml
index 73bbfbeb2a..9d9cfedb82 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
language: cpp
-dist: trusty
+dist: xenial
sudo: required
only:
- master
@@ -16,17 +16,15 @@ addons:
before_install:
- sudo apt-get update
- - sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck
- - sudo apt-get install -f clang-format-3.6
+ - sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck python3-pip python3-setuptools
+ - sudo apt-get install -f clang-format-6.0
script:
- cppcheck --force -isrc/3rd_party -isrc/3rd_party-static --quiet --error-exitcode=1 src
- ./tools/infrastructure/check_style.sh
- mkdir build && cd build
- cmake ../ -DBUILD_TESTS=ON
- - make install && sudo ldconfig
-after_success:
- - make test
+ - make install-3rd_party && make -j `nproc` install && sudo ldconfig && make test
env:
global:
- LC_CTYPE=en_US.UTF-8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 481f63a805..1c693f2b22 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,61 +1,196 @@
-# Release 4.5.0
+# Release 5.0.0
## Supported Specifications
-- SDL Mobile RPC Spec: [Version 4.5.0](https://github.com/smartdevicelink/rpc_spec/releases/tag/4.5.0)
-- SDL Protocol Spec: [Version 5.0.0](https://github.com/smartdevicelink/protocol_spec/releases/tag/5.0.0)
+- [SDL Mobile RPC Spec: Version 5.0.0](https://github.com/smartdevicelink/rpc_spec/releases/tag/5.0.0)
+- [SDL Protocol Spec: Version 5.1.0](https://github.com/smartdevicelink/protocol_spec/releases/tag/5.1.0)
-## Implemented Proposals
+## Implemented Proposals / New Features
-[Connectivity via iAP-BT and Transport Switch](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0053-Connectivity-via-iAP-BT-and-Transport-Switch.md) - Implementation of a mechanism to change a registered app connected over one transport to another seamlessly.
+- [[SDL 0043] Move to the new C++11 standard](https://github.com/smartdevicelink/sdl_core/issues/1493) - C++11 unique_ptr, shared_ptr, atomic utils implemented
-[Mark public deprecated methods](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0092-Deprecated-interfaces-markup.md) - Implemented a DEPRECATED macro for marking deprecated methods in the project. Using methods marked with this macro will result in a warning being generated.
+- [[SDL 0044] Use Boost library in SDL](https://github.com/smartdevicelink/sdl_core/issues/1523) - Boost Locks, Date/Time, and Filesystem utils implemented
-[Remove QT HMI from SDL Core (Partially Complete)](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0110-remove-qt-hmi-from-sdl-core.md) - The `qt_hmi` component was removed from SDL Core, the QT_HMI_API interface and dbus adapter will be removed in the next major release, due to this aspect of the proposal requiring breaking changes.
+- [[SDL 0122] Handling VR help requests when application does not send VR help prompt](https://github.com/smartdevicelink/sdl_core/issues/2154)
-[Use Boost Library (Partially Complete)](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0044-use-Boost-library.md) - The `boost` library is now installed as a 3rd party library, this library is currently only used in the refactored message broker component.
+- [[SDL 0160] Remote Control Radio Parameter Update](https://github.com/smartdevicelink/sdl_core/issues/2162)
-## Enhancements
-- `DBus` and `libusb` are now dynamically linked, instead of being installed as 3rd-party libraries during the SDL Core build - #2004
+- [[SDL 0181] SDL shall not put RC applications to HMI level NONE when user disables RC in HMI](https://github.com/smartdevicelink/sdl_core/issues/2377)
+
+- [[SDL 0182] Audio Source AM/FM/XM/DAB](https://github.com/smartdevicelink/sdl_core/issues/2338)
+
+- [[SDL 0165] Remote Control Lights More Names and Status Values](https://github.com/smartdevicelink/sdl_core/issues/2172)
+
+- [[SDL 0099] New remote control modules (LIGHT, AUDIO, HMI_SETTINGS) and parameters (SIS Data)](https://github.com/smartdevicelink/sdl_core/issues/1798)
+
+- [[SDL 0178] Interior Vehicle Data Subscription Management and Data Caching in SDL](https://github.com/smartdevicelink/sdl_core/issues/2318)
+
+- [[SDL 0153] Support for Short and Full UUID App ID](https://github.com/smartdevicelink/sdl_core/issues/2159)
+
+- [[SDL 0170] SDL behavior in case of LOW_VOLTAGE event](https://github.com/smartdevicelink/sdl_core/issues/2233)
+
+- [[SDL 0064] Choice-VR optional](https://github.com/smartdevicelink/sdl_core/issues/2160)
+
+- [[SDL 0175] Updating DOP value range for GPS notification](https://github.com/smartdevicelink/sdl_core/issues/2317)
+
+- [[SDL 0089] Mobile API versioning](https://github.com/smartdevicelink/sdl_core/issues/2248)
+
+- [[SDL 0150] Enhancing onHMIStatus with a New Parameter for Video Streaming State](https://github.com/smartdevicelink/sdl_core/issues/2129)
+
+- [[SDL 0109] SetAudioStreamingIndicator RPC](https://github.com/smartdevicelink/sdl_core/issues/2059)
+
+- [[SDL 0041] Provide AppIcon resumption across app registration requests](https://github.com/smartdevicelink/sdl_core/issues/1456)
+
+- [[SDL 0139] Clarification of audio format details of AudioPassThru](https://github.com/smartdevicelink/sdl_core/issues/2014)
+
+- [[SDL 0105] Remote Control - Seat](https://github.com/smartdevicelink/sdl_core/issues/1860)
+
+- [[SDL 0172] Remote Control - Update OnRCStatus with a new allowed parameter](https://github.com/smartdevicelink/sdl_core/issues/2244)
+
+- [[SDL 0106] Remote Control - OnRCStatus notification](https://github.com/smartdevicelink/sdl_core/issues/1930)
+
+- [[SDL 0145] Driver Distraction Notification Upon Registration](https://github.com/smartdevicelink/sdl_core/issues/2054)
+
+- [[SDL 0102] New vehicle data - ElectronicParkBrakeStatus ](https://github.com/smartdevicelink/sdl_core/issues/1815)
+
+- [[SDL 0110] Remove QT HMI from SDL Core](https://github.com/smartdevicelink/sdl_core/issues/1857) - Fully removed from project
+
+- [[SDL 0141] Supporting simultaneous multiple transports](https://github.com/smartdevicelink/sdl_core/issues/2065)
+
+- [[SDL 0149] Add capability to disable resumption based on app type and transport type](https://github.com/smartdevicelink/sdl_core/issues/2130)
+
+- [[SDL 0107] New vehicle data - TurnSignal](https://github.com/smartdevicelink/sdl_core/issues/1859)
+
+- [[SDL 0085] SubMenu Icon](https://github.com/smartdevicelink/sdl_core/issues/1747)
+
+- [[SDL 0168] RPC design refactoring](https://github.com/smartdevicelink/sdl_core/issues/2189)
+
+- [[SDL 0120] GetSystemTime RPC](https://github.com/smartdevicelink/sdl_core/issues/1963)
+
+- [[SDL 0040] DTLS encryption](https://github.com/smartdevicelink/sdl_core/issues/1479)
+
+- [[SDL 0014] Adding Audio File Playback to TTSChunk](https://github.com/smartdevicelink/sdl_core/issues/1277)
+
+- [[SDL 0063] Display name parameter](https://github.com/smartdevicelink/sdl_core/issues/1589)
+
+- [[SDL 0083] Expandable Design for Proprietary Data Exchange](https://github.com/smartdevicelink/sdl_core/issues/1734)
+
+- [[SDL 0042] SDL must transfer RPCs with invalid image reference parameters to the HMI](https://github.com/smartdevicelink/sdl_core/issues/1428)
+
+- [[SDL 0097] Tire pressure additions](https://github.com/smartdevicelink/sdl_core/issues/1766)
+
+- [[SDL 0062] Template images](https://github.com/smartdevicelink/sdl_core/issues/1588)
+
+- [[SDL 0037] Expand Mobile putfile RPC](https://github.com/smartdevicelink/sdl_core/issues/1455)
+
+- [[SDL 0164] Modernize Ubuntu Support](https://github.com/smartdevicelink/sdl_core/issues/2170)
+
+- [[SDL 0162] Define Handling of Duplicate Correlation IDs](https://github.com/smartdevicelink/sdl_core/issues/2169)
+
+- [[SDL 0151] ImageFieldName for SecondaryImage](https://github.com/smartdevicelink/sdl_core/issues/2099)
+
+- [[SDL 0082] New vehicle data - EngineOilLife](https://github.com/smartdevicelink/sdl_core/issues/1733)
+
+- [[SDL 0147] Template Improvements: Color Scheme](https://github.com/smartdevicelink/sdl_core/issues/2082)
+
+- [[SDL 0096] Deliver build configuration](https://github.com/smartdevicelink/sdl_core/issues/1765)
+
+- [[SDL 0072] New vehicle data - FuelRange](https://github.com/smartdevicelink/sdl_core/issues/1656)
+
+- [Inclusion of PLAY_PAUSE as a subscribable button](https://github.com/smartdevicelink/sdl_core/pull/930)
## Bug Fixes
-- [Remove OEM Specific references in SDL policy table preload file](https://github.com/smartdevicelink/sdl_core/issues/1252)
-- ["resultCode" should be more descriptive than "INVALID_DATA"](https://github.com/smartdevicelink/sdl_core/issues/31)
-- [SDL doesn't apply sequence SUSPEND -> OnSDLAwake -> SUSPEND -> IGN_OFF for saving resumption data](https://github.com/smartdevicelink/sdl_core/issues/1395)
-- [SDL responds "resultCode: SUCCESS" while dataType:VEHICLEDATA_EXTERNTEMP is VEHICLE_DATA_NOT_AVAILABLE and not in subscribed list store](https://github.com/smartdevicelink/sdl_core/issues/982)
-- [Policies SDL should be case-insensetive to "AppID" against listed in policies manager](https://github.com/smartdevicelink/sdl_core/issues/992)
-- [App is disconnected due to PROTOCOL_VIOLATION when start audio streaming after rejected 2 times then accepted](https://github.com/smartdevicelink/sdl_core/issues/1004)
-- [SDL doesn't set unsuccessful "message" value to "info" param in case HMI responds via single UI.RPC when Interface.IsReady missing](https://github.com/smartdevicelink/sdl_core/issues/997)
-- [Navigation SDL does not respond info message in case GENERIC_ERROR watchdog timeout from HMI](https://github.com/smartdevicelink/sdl_core/issues/990)
-- [SDL does not respond info message in case GENERIC_ERROR watchdog timeout from HM](https://github.com/smartdevicelink/sdl_core/issues/1012)
-- [SDL doesn't send info parameter when result of ResetGlobalProperties is GENERIC_ERROR](https://github.com/smartdevicelink/sdl_core/issues/1016)
-- [SDL does not send StopAudioStream() if exit app while Video service and Audio service are starting.](https://github.com/smartdevicelink/sdl_core/issues/1002)
-- [APIs AlertManeuver: SDL responds GENERIC_ERROR instead of INVALID_DATA when soft button has Type is Image or Both and Text is whitespace or \t or \n or empty](https://github.com/smartdevicelink/sdl_core/issues/980)
-- [IVSU SDL doesn't reject SystemRequest with filenam=IVSU but w/o binary data.](https://github.com/smartdevicelink/sdl_core/issues/976)
-- [Memory leaks: SDL does not release memory after sending AddCommand limit exhausted](https://github.com/smartdevicelink/sdl_core/issues/1029)
-- [Negative result code send instead of IGNORED for UnsubscribedVehicleData when VehicleInfo IsReady Missing](https://github.com/smartdevicelink/sdl_core/issues/996)
-- [API SDL responds "UNSUPPORTED_RESOURCE", success= false in case only have "UNSUPPORTED_RESOURCE" to Navigation.AlertManeuver](https://github.com/smartdevicelink/sdl_core/issues/989)
-- [Default app policies are never updated after a PTU](https://github.com/smartdevicelink/sdl_core/issues/1772)
-- [Build fails with GCC6+](https://github.com/smartdevicelink/sdl_core/issues/1975)
-- [Remote Control test suite fails](https://github.com/smartdevicelink/sdl_core/issues/1993)
-- [PoliciesManager allows all requested params in case "parameters" field is empty](https://github.com/smartdevicelink/sdl_core/issues/1873)
-- [OnDriverDistraction SDL does not send notification to app right after this app changes level from NONE to any other](https://github.com/smartdevicelink/sdl_core/issues/1881)
-- [Protect access to Resumption data during LastState::SaveStateToFileSystem](https://github.com/smartdevicelink/sdl_core/issues/1953)
-- [Need to protect cache manager "pt_" from concurrent access](https://github.com/smartdevicelink/sdl_core/issues/1961)
-- [Prevent deadlock in EventDispatcherIimpl::raise_event](https://github.com/smartdevicelink/sdl_core/issues/1949)
-- [Bluetooth StartService fail after Core restarted](https://github.com/smartdevicelink/sdl_core/issues/1932)
-- [Silent error caused by implicit conversion of SmartPointer to integer](https://github.com/smartdevicelink/sdl_core/issues/1834)
-- [AOA USB transport buffer size too small](https://github.com/smartdevicelink/sdl_core/issues/1863)
-- [Lock screen icon URL should be updated](https://github.com/smartdevicelink/sdl_core/issues/1646)
-- [Broken link in README.md for Software Architecture Documentation](https://github.com/smartdevicelink/sdl_core/issues/2091)
-- [SDL doesn't send OnPermissionsChange in case of external user consent](https://github.com/smartdevicelink/sdl_core/issues/2072)
-- [Build fails when ENABLE_SECURITY=OFF](https://github.com/smartdevicelink/sdl_core/issues/2073)
-
-### Security Related Fixes
-- [SDL must start PTU for navi app right after app successfully registration](https://github.com/smartdevicelink/sdl_core/issues/1925)
-- [SDL must start PTU for any app except navi right after app successfully request to start first secure service](https://github.com/smartdevicelink/sdl_core/issues/1924)
-- [PolicyTableUpdate is failed by any reason and "ForceProtectedService"=ON at .ini file](https://github.com/smartdevicelink/sdl_core/issues/1923)
-- [PolicyTableUpdate has NO "certificate" and "ForceProtectedService"=ON at .ini file](https://github.com/smartdevicelink/sdl_core/issues/1922)
-- [SDL must respond NACK in case navigation app connected over protocol v2 sends StartService for audio service](https://github.com/smartdevicelink/sdl_core/issues/1912)
-- [PolicyTableUpdate has NO "certificate" and "ForceProtectedService"=OFF at .ini file](https://github.com/smartdevicelink/sdl_core/issues/1894)
-- [PolicyTableUpdate is failed by any reason and "ForceProtectedService"=OFF at .ini file](https://github.com/smartdevicelink/sdl_core/issues/1891)
-- [PolicyTableUpdate is valid and brings "certificate"](https://github.com/smartdevicelink/sdl_core/issues/1888)
+
+- [SDL process RC requests with resultCode DISALLOWED after IGN_OFF and IGN_ON](https://github.com/smartdevicelink/sdl_core/issues/2670)
+
+- [SDL stop sending OnInteriorVehicleData notifications after the app sent a GetInteriorVehicleData without optional parameter subscribe](https://github.com/smartdevicelink/sdl_core/issues/2657)
+
+- [Make Size() function thread safe to avoid core dump](https://github.com/smartdevicelink/sdl_core/issues/2603)
+
+- [SDL does not cut parameters not related to defined module type from RC.SetInteriorVD](https://github.com/smartdevicelink/sdl_core/issues/2664)
+
+- [Add missing PRNDL enum value to the HMI API ](https://github.com/smartdevicelink/sdl_core/issues/2431)
+
+- [EXTERNAL_PROPRIETARY user consent is broken when permissions are in default object](https://github.com/smartdevicelink/sdl_core/issues/2146)
+
+- [Processing invalid PT after cutting off unknown_parameter or unknown_RPC](https://github.com/smartdevicelink/sdl_core/issues/1921)
+
+- [SDL does not check for non-mandatory parameters](https://github.com/smartdevicelink/sdl_core/issues/2443)
+
+- [SDL must close only session in case mobile app does not answer on Heartbeat_request](https://github.com/smartdevicelink/sdl_core/issues/1893)
+
+- [App does not activate when policies are disabled](https://github.com/smartdevicelink/sdl_core/issues/842)
+
+- [Pure virtual method called during SDL shutdown](https://github.com/smartdevicelink/sdl_core/issues/2433)
+
+- [SDL build is failing when ENABLE_LOG=OFF](https://github.com/smartdevicelink/sdl_core/issues/2341)
+
+- [Wrong policy permissions calculation in EXTERNAL_PROPRIETARY flow](https://github.com/smartdevicelink/sdl_core/issues/2405)
+
+- [Functional groupings parameters has max size of 24](https://github.com/smartdevicelink/sdl_core/issues/2470)
+
+- [AudioPassThru does not send audio data in raw PCM data](https://github.com/smartdevicelink/sdl_core/issues/1928)
+
+- [Deprecated GetDataOnSessionKey() cannot be overloaded in cross-compiling](https://github.com/smartdevicelink/sdl_core/issues/2137)
+
+- [V5 Protocol Messages do not encrypt payload of Control Frame Message Types](https://github.com/smartdevicelink/sdl_core/issues/2142)
+
+- [Remove TLS Handshake App Name String Compare](https://github.com/smartdevicelink/sdl_core/issues/1617)
+
+- [The reference of wild pointer cause to memory leak](https://github.com/smartdevicelink/sdl_core/issues/860)
+
+- [Build failing on Fedora 25](https://github.com/smartdevicelink/sdl_core/issues/1495)
+
+- [Add missing RPC changes: SpaceAvailable & CurrentTemperatureAvailable](https://github.com/smartdevicelink/sdl_core/pull/2588)
+
+- [Invalid memory accesses detected by valgrind](https://github.com/smartdevicelink/sdl_core/issues/2177)
+
+- [Memory leaks in media_manager_test unit tests](https://github.com/smartdevicelink/sdl_core/issues/2274)
+
+- [Empty moduleType disallows all RPC requests after ignition cycle](https://github.com/smartdevicelink/sdl_core/issues/2547)
+
+- [Feature/boost datetime implementation](https://github.com/smartdevicelink/sdl_core/pull/2278)
+
+- [Flush logger before deleting message loop thread](https://github.com/smartdevicelink/sdl_core/pull/2532)
+
+- [SDL Proxy crash happens when receiving SDLOnAppInterfaceUnregistered notification with reason -1 (INVALID_ENUM)](https://github.com/smartdevicelink/sdl_core/issues/2300)
+
+- [OnHMIStatus returns null hmiLevel if RPC has invalid/incomplete parameters](https://github.com/smartdevicelink/sdl_core/issues/2285)
+
+- [Invalid memory access in CacheManager::CheckPermissions()](https://github.com/smartdevicelink/sdl_core/issues/2298)
+
+- [Cert processing invalid, module certificate should be updated when a policy table update occurs](https://github.com/smartdevicelink/sdl_core/issues/2191)
+
+- [Cert processing invalid, CertificatePath and CACertificatePath keywords are nonfunctional](https://github.com/smartdevicelink/sdl_core/issues/2190)
+
+- [RegisterAppInterface Display Capabilities Segfault](https://github.com/smartdevicelink/sdl_core/issues/2220)
+
+- [Duplicate "PendingRequestsAmount" entries in smartDeviceLink.ini](https://github.com/smartdevicelink/sdl_core/issues/1790)
+
+## Enhancements
+
+- [PrintSmartObject function can not print to log file](https://github.com/smartdevicelink/sdl_core/issues/2574)
+
+## Best Practice
+
+- [AllowDeviceToConnect is never used](https://github.com/smartdevicelink/sdl_core/issues/494)
+
+- [Fix UnsubscribeWayPoints typo](https://github.com/smartdevicelink/sdl_core/pull/2504)
+
+- [Namespace capitalization](https://github.com/smartdevicelink/sdl_core/issues/33)
+
+- [Remove "SetIcon" Files](https://github.com/smartdevicelink/sdl_core/issues/1594)
+
+- [Initialization (et al) method return values](https://github.com/smartdevicelink/sdl_core/issues/34)
+
+- [Fix misspellings of "subscription"](https://github.com/smartdevicelink/sdl_core/issues/736)
+
+
+## Documentation
+
+- [Add FAQ link to README.md](https://github.com/smartdevicelink/sdl_core/pull/1366)
+
+- [Broken Links in SDD Documentation](https://github.com/smartdevicelink/sdl_core/issues/2107)
+
+- [Alter build instructions for slight clarity improvements](https://github.com/smartdevicelink/sdl_core/pull/218)
+
+- [Add third_party file](https://github.com/smartdevicelink/sdl_core/issues/2610)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97bda27c53..764a050b91 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,8 @@ option(EXTENDED_MEDIA_MODE "Turn on and off extended Madia Manager features rela
option(BUILD_SHARED_LIBS "Build all libraries as shared (if ON) or static (if OFF)" OFF)
option(BUILD_BT_SUPPORT "Bluetooth support" ON)
option(BUILD_USB_SUPPORT "libusb support" ON)
+option(BUILD_CLOUD_APP_SUPPORT "Cloud App Transport Support" ON)
+option(BUILD_WEBSOCKET_SERVER_SUPPORT "Web Engine App Transport Support" ON)
option(BUILD_BACKTRACE_SUPPORT "backtrace support" ON)
option(BUILD_TESTS "Possibility to build and run tests" OFF)
option(TELEMETRY_MONITOR "Enable profiling time test util" ON)
@@ -51,6 +53,7 @@ option(ENABLE_GCOV "gcov code coverage feature" OFF)
option(ENABLE_SANITIZE "Sanitize tool" OFF)
option(ENABLE_SECURITY "Security Ford protocol protection" ON)
option(ENABLE_HMI_PTU_DECRYPTION "Policy table update parsed by hmi" ON)
+option(ENABLE_IAP2EMULATION "IAP2 emulation via tcp" OFF)
option(USE_COTIRE "Use Cotire to speed up build (currently only for commands tests)" ON)
option(USE_GOLD_LD "Use gold linker intead of GNU linker" ON)
option(USE_CCACHE "Turn on ccache usage" ON)
@@ -112,9 +115,6 @@ if (HMI_ADAPTER_OPTION)
if (${HMI_ADAPTER_OPTION} STREQUAL "MESSAGEBROKER")
message(STATUS "Jenkins integration: selected HMI adapter MESSAGEBROKER")
set (HMIADAPTER "messagebroker")
- elseif (${HMI_ADAPTER_OPTION} STREQUAL "DBUS")
- message(STATUS "Jenkins integration: selected HMI adapter DBUS")
- set (HMIADAPTER "dbus")
endif()
endif()
@@ -210,6 +210,13 @@ get_property(cValue CACHE ENABLE_HMI_PTU_DECRYPTION PROPERTY VALUE)
file(APPEND "${build_config_path}" "//${cHelpString}\n")
file(APPEND "${build_config_path}" "ENABLE_HMI_PTU_DECRYPTION:${cType}=${cValue}\n")
+get_property(cHelpString CACHE BUILD_WEBSOCKET_SERVER_SUPPORT PROPERTY HELPSTRING)
+get_property(cType CACHE BUILD_WEBSOCKET_SERVER_SUPPORT PROPERTY TYPE)
+get_property(cValue CACHE BUILD_WEBSOCKET_SERVER_SUPPORT PROPERTY VALUE)
+file(APPEND "${build_config_path}" "//${cHelpString}\n")
+file(APPEND "${build_config_path}" "BUILD_WEBSOCKET_SERVER_SUPPORT:${cType}=${cValue}\n")
+
+
add_custom_target(pasa-tarball
COMMAND ${CMAKE_SOURCE_DIR}/tools/Utils/export-customer-specific.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} pasa
COMMAND tar -cz -C /tmp/PASA -f ${CMAKE_BINARY_DIR}/pasa.tar.gz .
@@ -238,7 +245,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
set(ARCHIVE_OUTPUT_DIRECTORY ./bin)
-set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x -Wall -Werror -Wno-deprecated-declarations -Wuninitialized -Wvla")
+set(EXCLUDE_ERROR_FLAGS "-Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations")
+set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x -Wall -fvisibility=hidden -Werror ${EXCLUDE_ERROR_FLAGS} -Wuninitialized -Wvla")
if (USE_GOLD_LD)
execute_process(COMMAND ld -v OUTPUT_VARIABLE result)
@@ -318,6 +326,16 @@ if (BUILD_BT_SUPPORT)
message(STATUS "Bluetooth support enabled")
endif()
+if (BUILD_CLOUD_APP_SUPPORT)
+ add_definitions(-DCLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ message(STATUS "Cloud app websocket support enabled")
+endif()
+
+if (BUILD_WEBSOCKET_SERVER_SUPPORT)
+ add_definitions(-DWEBSOCKET_SERVER_TRANSPORT_SUPPORT)
+ message(STATUS "Web engine app websocket support enabled")
+endif()
+
if (BUILD_BACKTRACE_SUPPORT)
add_definitions(-DBACKTRACE_SUPPORT)
message(STATUS "Backtrace support enabled")
@@ -339,7 +357,9 @@ endif()
if (${EXTENDED_POLICY} STREQUAL "EXTERNAL_PROPRIETARY")
add_definitions(-DEXTERNAL_PROPRIETARY_MODE)
set(POLICY_PATH ${COMPONENTS_DIR}/policy/policy_external/)
- set(POLICY_GLOBAL_INCLUDE_PATH ${COMPONENTS_DIR}/include/policy/policy_external/)
+ set(POLICY_GLOBAL_INCLUDE_PATH
+ ${COMPONENTS_DIR}/include/policy/policy_external/
+ ${CMAKE_BINARY_DIR}/src/components/policy/policy_external/)
set(POLICY_MOCK_INCLUDE_PATH ${COMPONENTS_DIR}/include/test/policy/policy_external/)
message(STATUS "EXTERNAL_PROPRIETARY policy enabled")
else()
@@ -350,7 +370,9 @@ else()
message(STATUS "HTTP policy enabled")
endif()
set(POLICY_PATH ${COMPONENTS_DIR}/policy/policy_regular/)
- set(POLICY_GLOBAL_INCLUDE_PATH ${COMPONENTS_DIR}/include/policy/policy_regular/)
+ set(POLICY_GLOBAL_INCLUDE_PATH
+ ${COMPONENTS_DIR}/include/policy/policy_regular/
+ ${CMAKE_BINARY_DIR}/src/components/policy/policy_regular/)
set(POLICY_MOCK_INCLUDE_PATH ${COMPONENTS_DIR}/include/test/policy/policy_regular/)
endif()
@@ -381,15 +403,6 @@ if (HMI STREQUAL "web" AND NOT DEFINED HMIADAPTER)
set(HMIADAPTER "messagebroker")
endif()
-if (HMIADAPTER STREQUAL "dbus")
- set(HMI_DBUS_API ON)
- add_definitions(-DDBUS_HMIADAPTER)
- add_definitions(-DHMI_DBUS_API)
-
- find_package(DBus REQUIRED)
- set(DBUS_LIBS_DIRECTORY ${DBUS_LIBRARY_DIRS} PARENT_SCOPE)
- message(${DBUS_INCLUDE_DIRS})
-endif()
if (HMIADAPTER STREQUAL "messagebroker")
set(HMI_JSON_API ON)
add_definitions(-DMESSAGEBROKER_HMIADAPTER)
@@ -423,6 +436,11 @@ if(ENABLE_HMI_PTU_DECRYPTION)
message(STATUS "HMI PTU decription enabled")
endif()
+if(ENABLE_IAP2EMULATION)
+ add_definitions(-DENABLE_IAP2EMULATION)
+ message(STATUS "IAP2 emulation enabled")
+endif()
+
set(RTLIB rt)
if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
set(RTLIB )
diff --git a/Doxyfile b/Doxyfile
index 36155e37a7..79f0c3510e 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -899,7 +899,9 @@ EXAMPLE_RECURSIVE = NO
# \image command).
IMAGE_PATH = \
- src/components/security_manager/docs/assets
+ src/components/security_manager/docs/assets \
+ src/components/protocol_handler/docs/assets \
+ src/components/transport_manager/docs/assets
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
diff --git a/LICENSE b/LICENSE
index ae3e57d852..6dc6f78f09 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2017 - 2018 SmartDeviceLink Consortium, Inc.
+Copyright (c) 2017 - 2020 SmartDeviceLink Consortium, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/README.md b/README.md
index e41006cca5..d75e14465b 100644
--- a/README.md
+++ b/README.md
@@ -1,149 +1,50 @@
[![Slack Status](http://sdlslack.herokuapp.com/badge.svg)](http://slack.smartdevicelink.com)
-[![codecov.io](https://codecov.io/github/smartdevicelink/sdl_core/coverage.svg?branch=develop)](https://codecov.io/github/smartdevicelink/sdl_core?branch=develop)
-[![Build Status](http://opensdl-jenkins.luxoft.com:8080/buildStatus/icon?job=OpenSDL_Nightly)](http://opensdl-jenkins.luxoft.com:8080/view/All/job/OpenSDL_Nightly/)
+[![Build Status](http://opensdl-jenkins.luxoft.com:8080/view/develop/job/develop_nightly_coverage/badge/icon)](http://opensdl-jenkins.luxoft.com:8080/view/develop/job/develop_nightly_coverage/)
# SmartDeviceLink (SDL)
SmartDeviceLink (SDL) is a standard set of protocols and messages that connect applications on a smartphone to a vehicle head unit. This messaging enables a consumer to interact with their application using common in-vehicle interfaces such as a touch screen display, embedded voice recognition, steering wheel controls and various vehicle knobs and buttons. There are three main components that make up the SDL ecosystem.
- * The [Core](https://github.com/smartdevicelink/sdl_core) component is the software which Vehicle Manufacturers (OEMs) implement in their vehicle head units. Integrating this component into their head unit and HMI based on a set of guidelines and templates enables access to various smartphone applications.
+ * The [Core](https://github.com/smartdevicelink/sdl_core) component is the software which Vehicle Manufacturers (OEMs) include in their vehicle head units. Integrating this component into their head unit and HMI based on a set of guidelines and templates enables access to various smartphone applications.
* The optional [SDL Server](https://github.com/smartdevicelink/sdl_server) can be used by Vehicle OEMs to update application policies and gather usage information for connected applications.
* The [iOS](https://github.com/smartdevicelink/sdl_ios) and [Android](https://github.com/smartdevicelink/sdl_android) libraries are implemented by app developers into their applications to enable command and control via the connected head unit.
+## SDL Core
+
+The Core component of SDL runs on a vehicle's computing system (head unit). Core’s primary responsibility is to route messages between connected smartphone applications and the vehicle HMI. It can connect a smartphone to a vehicle's head unit via a variety of transport protocols such as Bluetooth, USB, Android AOA, and TCP. Once a connection is established, Core discovers compatible applications and displays them to the driver for interaction via voice or display. The Core component is configured to follow a set of policies defined in its local policy database and updated by a [policy server](https://www.github.com/smartdevicelink/sdl_server). The messaging between a connected application and SDL Core is defined by the [Mobile API](https://github.com/smartdevicelink/sdl_core/blob/master/src/components/interfaces/MOBILE_API.xml) and the messaging between SDL Core and the vehicle is defined by the [HMI API](https://github.com/smartdevicelink/sdl_core/blob/master/src/components/interfaces/HMI_API.xml).
+
Pull Requests Welcome!
-## Documentation
+## Environment
+Currently supported:
+* Ubuntu Linux 16.04 with GCC 5.4.x
+* Ubuntu Linux 18.04 with GCC 7.3.x
+* [C++11 standard](https://github.com/smartdevicelink/sdl_evolution/issues/132)
- * [Software Architecture Document](https://smartdevicelink.com/en/docs/sdl-core/master/software-architecture-document/table-of-contents/)
- * [Transport Manager Programming Guide](https://smartdevicelink.com/en/guides/core/transport-manager-programming/)
- * [Software Detailed Design](https://app.box.com/s/ohgrvemtx39f8hfea1ab676xxrzvyx1y)
- * [Integration Guidelines](https://smartdevicelink.com/en/docs/hmi/master/overview/)
- * [Evolution Proposals versus Issues](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals_versus_issues.md)
+## Getting Started
+See the [Getting Started](https://smartdevicelink.com/en/guides/core/getting-started/install-and-run/) guide in the developer portal for instructions on how to build and start SDL Core.
-## SDL Core
+## Connect a Web HMI
+After setting up SDL Core, you will need to connect it to an external HMI. The HMI component of SDL needs to be developed separately from this project, and should be tailored to your specific head unit. Several sample browser-based HMIs are available for testing purposes:
-The Core component of SDL runs on a vehicle's computing system (head unit). Core’s primary responsibility is to pass messages between connected smartphone applications and the vehicle HMI, and pass notifications from the vehicle to those applications. It can connect a smartphone to a vehicle's head unit via a variety of transport protocols such as Bluetooth, USB, Android AOA, and TCP. Once a connection is established, Core discovers compatible applications and displays them to the driver for interaction via voice or display. The core component is implemented into the vehicle HMI based on the integration guidelines above. The core component is configured to follow a set of policies defined in a policy database and updated by a [policy server](https://www.github.com/smartdevicelink/sdl_server). The messaging between a connected application and core is defined by the [Mobile API](https://github.com/smartdevicelink/sdl_core/blob/master/src/components/interfaces/MOBILE_API.xml) and the messaging between sdl core and the vehicle is defined by the [HMI API](https://github.com/smartdevicelink/sdl_core/blob/master/src/components/interfaces/HMI_API.xml).
-
-## Project Status
-We're ramping up our efforts to get SmartDeviceLink developed and maintained directly in the open. For the Mobile libraries, we're expecting better integration soon, SDL Core is slightly more complicated. We are currently working on generating documentation, creating a developer portal, an open forum, Mobile validation, and everything else that we've been asked for to renew the community's interest in this project. From a technical standpoint, SDL is stable, and the most work is being put into making it a more robust solution for app connectivity. We are, however, definitely looking for and interested in other people and company's contributions to SDL whether it be feature based, bug fixes, healthy conversation, or even just suggestions for improvement.
-
-# Getting Started
-A quick guide to installing, configuring, and running an instance of the SDL Core on a linux OS.
-
- 1. Clone this repository
- 2. Create a folder for your build outside of the source folder and run `cmake {path_to_sdl_core_source_folder}` from the build folder you created
- 3. If there are any dependency issues, install missing dependencies
- 4. Run the following commands to compile and install smartdevicelink
-
-
-
-```
-%make
-%make install
-```
-
-## Start SDL Core
-Once SDL Core is compiled and installed you can start it from the executable in the bin folder
-
-```
-%cd bin/
-%./start.sh
-```
-
-## Start WEB HMI
-Web HMI is separated from SDL Core and located in another repository. So to make it workable please do next steps.
-
- 1. Clone http://github.com/smartdevicelink/sdl_hmi.git
- 2. Follow the instruction from readme file in sdl_hmi repository.
-
-
-## A quick note about dependencies
-The dependencies for SDL Core vary based on the configuration. You can change SDL Core's configuration in the top level CMakeLists.txt. We have defaulted this file to a configuration which we believe is common for people who are interested in getting up and running quickly, generally on a Linux VM.
-
-### Dependencies list
-
-| Flag | Description | Dependencies |
-|------|-------------|--------------|
-|Web HMI|Use HTML5 HMI|chromium-browser|
-|DBus|Use DBus HMI Adapter|dbus-1-dev|
-|EXTENDED_MEDIA_MODE|Support Video and Audio Streaming|Opengl es2, gstreamer1.0*|
-|Bluetooth|Enable bluetooth transport adapter|libbluetooth3, libbluetooth-dev, bluez-tools|
-|USB|Enable USB transport adapter|libusb-dev|
-|Testing framework|Needed to support running unit tests|libgtest-dev|
-|Cmake|Needed to configure SDL prior to compilation|cmake|
-
-#### Sample Policy Manager
-The included sample policy manager (for use with `EXTERNAL_PROPRIETARY` policy mode) requires the following packages:
- - python-pip
- - python-dev
-
-### Known Dependency Issues
- * log4cxx - We know that the version of log4cxx on a linux machine can conflict with the one used, which is why it is provided in the repository. To avoid the conflict, we recommend removing liblog4cxx*.
- * cmake - on some versions of linux, the included cmake package doesn't have the right version. If apt-get is your package manager, you can find the correct version using
-```
-sudo apt-get install cmake
-sudo add-apt-repository ppa:kalakris/cmake
-sudo apt-get update
-sudo apt-get upgrade
-```
-
-## Required RPCs
-There are several RPCs that are "required" to be implemented in order for SDL to work across vehicle manufacturers and applications, listed below. The RPC specification can be found in the [Mobile API Spec](src/components/interfaces/MOBILE_API.xml).
-
- * RegisterAppInterface
- * UnregisterAppInterface
- * SetGlobalProperties
- * ResetGlobalProperties
- * AddCommand
- * DeleteCommand
- * AddSubMenu
- * DeleteSubMenu
- * CreateInteractionChoiceSet
- * PerformInteraction
- * DeleteInteractionChoiceSet
- * Alert
- * Show
- * SetMediaClockTimer
- * SubscribeButton
- * UnsubscribeButton
- * ChangeRegistration
- * GenericResponse
- * SystemRequest
- * OnHMIStatus
- * OnAppInterfaceUnregistered
- * OnButtonEvent
- * OnButtonPress
- * OnCommand
- * OnDriverDistraction
- * OnPermissionsChange
- * OnLanguageChange
- * OnSystemRequest
- * Speak
+ 1. The [Generic HMI](https://github.com/smartdevicelink/generic_hmi) (preferred) is a reference implementation for an SDL-connected HMI, including examples of many of the UI elements and templates available to SDL applications.
+ 2. The [SDL HMI](https://github.com/smartdevicelink/sdl_hmi) emulates a full infotainment system which includes a simplified SDL component.
-## Frequently Asked Questions
+See the [HMI Development Guide](https://smartdevicelink.com/en/guides/core/integrating-your-hmi/sdl-core-and-hmi-communication/) for more information on building your own HMI.
-If you have any questions regarding the setup of SDL Core or regarding the integration of SDL into an infotainment system, first visit our [SDL Core FAQ](https://smartdevicelink.com/en/guides/core/faq/). If you still have questions, you can post a question in the `core-help` channel of our Slack group (sign up [here](http://slack.smartdevicelink.com/))
+## Manticore
+If you are just developing an SDL-connected application and simply want an environment to test it in, it is not necessary to build SDL Core from scratch. You can use our [Manticore](https://smartdevicelink.com/resources/manticore/) project first, which creates a testing environment in the cloud using SDL Core and the Generic HMI.
-## Test Coverage
-### Used technologies
- * GCOV - test coverage program.
- * LCOV - graphical front-end for GCC's coverage testing tool for gcov.
- * codecov.io - service for assembling code coverage and representing it in a clear for reading form.
+## Frequently Asked Questions
-### Excluded folders
-_We test only sources written by us and we don`t need to test external sources(open source libraries)._
- * '/usr/\*' - local libraries shouldn`t be covered by tests.
- * '\*/test/\*' - we don`t need to cover tests.
- * '\*/src/3rd\*' - open source libraries shouldn`t be covered by tests.
+If you have any questions regarding the setup of SDL Core or regarding the integration of SDL into a head unit, first visit our [SDL Core FAQ](https://smartdevicelink.com/en/guides/core/faq/). If you still have questions, you can post a question in the `core-help` channel of our Slack group (sign up [here](http://slack.smartdevicelink.com/)).
-### Current test coverage
-You can find it in [Coverage report](https://codecov.io/gh/smartdevicelink/sdl_core/branch/develop)
+## Additional References
-### How to get Test Coverage locally
- 1. Build project with enabled flag _-DBUILD_TESTS=on_
- 2. Execute command 'make test'
- 3. Execute './tools/Utils/collect_coverage.sh <path_to_build_directory>'
+ * [Transport Manager Programming Guide](https://smartdevicelink.com/en/guides/core/transport-manager-programming/)
+ * [HMI API Documentation](https://smartdevicelink.com/en/docs/hmi/master/overview/)
+ * [Evolution Proposals versus Issues](https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals_versus_issues.md)
## Contributions
-Conversation regarding the design and development of SmartDeviceLink technology should be directed at the [GENIVI mailing list](https://lists.genivi.org/mailman/listinfo/genivi-smartdevicelink), which anyone can join. Public conference calls regarding the SmartDeviceLink technology will be announced to the GENIVI mailing list, we expect to have conversations every other week. We also encourage interested parties to write issues against our software, and submit pull requests right here in the GitHub repository.
+Conversation regarding the design and development of SmartDeviceLink technology is managed via the [SDL Evolution Process](https://github.com/smartdevicelink/sdl_evolution/blob/master/process.md). We also encourage interested parties to write issues and submit pull requests right here in the GitHub repository. If you choose to do so, please read our [Contributing Guide](https://github.com/smartdevicelink/sdl_core/blob/master/.github/CONTRIBUTING.md) beforehand.
diff --git a/src/3rd_party-static/CMakeLists.txt b/src/3rd_party-static/CMakeLists.txt
index 029c0b3d8d..1b4591e0aa 100644
--- a/src/3rd_party-static/CMakeLists.txt
+++ b/src/3rd_party-static/CMakeLists.txt
@@ -29,9 +29,18 @@
# POSSIBILITY OF SUCH DAMAGE.
# --- jsoncpp
-add_subdirectory(./jsoncpp)
+include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
+
+set(JSONCPP_INCLUDE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/include ${CMAKE_SOURCE_DIR}/src/components/utils/include)
set(JSONCPP_INCLUDE_DIRECTORY ${JSONCPP_INCLUDE_DIRECTORY} PARENT_SCOPE)
+include_directories(
+ ${JSONCPP_INCLUDE_DIRECTORY}
+)
+
+collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/src/lib_json")
+add_library(jsoncpp ${SOURCES})
+
# --- encryption
add_subdirectory(./encryption)
set(ENCRYPTION_INCLUDE_DIRECTORY ${ENCRYPTION_INCLUDE_DIRECTORY} PARENT_SCOPE)
diff --git a/src/3rd_party-static/gmock-1.7.0/gtest/cmake/internal_utils.cmake b/src/3rd_party-static/gmock-1.7.0/gtest/cmake/internal_utils.cmake
index 8cb21894ce..82ad7f9c4e 100644
--- a/src/3rd_party-static/gmock-1.7.0/gtest/cmake/internal_utils.cmake
+++ b/src/3rd_party-static/gmock-1.7.0/gtest/cmake/internal_utils.cmake
@@ -187,7 +187,7 @@ function(cxx_executable name dir libs)
endfunction()
# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE.
-find_package(PythonInterp)
+find_package(PythonInterp 3.5)
# cxx_test_with_flags(name cxx_flags libs srcs...)
#
diff --git a/src/3rd_party-static/jsoncpp/AUTHORS b/src/3rd_party-static/jsoncpp/AUTHORS
deleted file mode 100644
index 333e120d6e..0000000000
--- a/src/3rd_party-static/jsoncpp/AUTHORS
+++ /dev/null
@@ -1 +0,0 @@
-Baptiste Lepilleur <blep@users.sourceforge.net>
diff --git a/src/3rd_party-static/jsoncpp/LICENSE b/src/3rd_party-static/jsoncpp/LICENSE
deleted file mode 100644
index ca2bfe1a03..0000000000
--- a/src/3rd_party-static/jsoncpp/LICENSE
+++ /dev/null
@@ -1,55 +0,0 @@
-The JsonCpp library's source code, including accompanying documentation,
-tests and demonstration applications, are licensed under the following
-conditions...
-
-The author (Baptiste Lepilleur) explicitly disclaims copyright in all
-jurisdictions which recognize such a disclaimer. In such jurisdictions,
-this software is released into the Public Domain.
-
-In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
-2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
-released under the terms of the MIT License (see below).
-
-In jurisdictions which recognize Public Domain property, the user of this
-software may choose to accept it either as 1) Public Domain, 2) under the
-conditions of the MIT License (see below), or 3) under the terms of dual
-Public Domain/MIT License conditions described here, as they choose.
-
-The MIT License is about as close to Public Domain as a license can get, and is
-described in clear, concise terms at:
-
- http://en.wikipedia.org/wiki/MIT_License
-
-The full text of the MIT License follows:
-
-========================================================================
-Copyright (c) 2007-2010 Baptiste Lepilleur
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use, copy,
-modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-========================================================================
-(END LICENSE TEXT)
-
-The MIT license is compatible with both the GPL and commercial
-software, affording one all of the rights of Public Domain with the
-minor nuisance of being required to keep the above copyright notice
-and license text in the source code. Note also that by accepting the
-Public Domain "license" you can re-license your copy using whatever
-license you like.
diff --git a/src/3rd_party-static/jsoncpp/NEWS.txt b/src/3rd_party-static/jsoncpp/NEWS.txt
deleted file mode 100644
index e53b8802c0..0000000000
--- a/src/3rd_party-static/jsoncpp/NEWS.txt
+++ /dev/null
@@ -1,101 +0,0 @@
- New in JsonCpp 0.6.0:
- ---------------------
-
-* Compilation
-
- - LD_LIBRARY_PATH and LIBRARY_PATH environment variables are now
- propagated to the build environment as this is required for some
- compiler installation.
-
- - Added support for Microsoft Visual Studio 2008 (bug #2930462):
- The platform "msvc90" has been added.
-
- Notes: you need to setup the environment by running vcvars32.bat
- (e.g. MSVC 2008 command prompt in start menu) before running scons.
-
- - Added support for amalgamated source and header generation (a la sqlite).
- Refer to README.txt section "Generating amalgamated source and header"
- for detail.
-
-* Value
-
- - Removed experimental ValueAllocator, it caused static
- initialization/destruction order issues (bug #2934500).
- The DefaultValueAllocator has been inlined in code.
-
- - Added support for 64 bits integer:
-
- Types Json::Int64 and Json::UInt64 have been added. They are aliased
- to 64 bits integers on system that support them (based on __int64 on
- Microsoft Visual Studio platform, and long long on other platforms).
-
- Types Json::LargestInt and Json::LargestUInt have been added. They are
- aliased to the largest integer type supported:
- either Json::Int/Json::UInt or Json::Int64/Json::UInt64 respectively.
-
- Json::Value::asInt() and Json::Value::asUInt() still returns plain
- "int" based types, but asserts if an attempt is made to retrieve
- a 64 bits value that can not represented as the return type.
-
- Json::Value::asInt64() and Json::Value::asUInt64() have been added
- to obtain the 64 bits integer value.
-
- Json::Value::asLargestInt() and Json::Value::asLargestUInt() returns
- the integer as a LargestInt/LargestUInt respectively. Those functions
- functions are typically used when implementing writer.
-
- The reader attempts to read number as 64 bits integer, and fall back
- to reading a double if the number is not in the range of 64 bits
- integer.
-
- Warning: Json::Value::asInt() and Json::Value::asUInt() now returns
- long long. This changes break code that was passing the return value
- to *printf() function.
-
- Support for 64 bits integer can be disabled by defining the macro
- JSON_NO_INT64 (uncomment it in json/config.h for example), though
- it should have no impact on existing usage.
-
- - The type Json::ArrayIndex is used for indexes of a JSON value array. It
- is an unsigned int (typically 32 bits).
-
- - Array index can be passed as int to operator[], allowing use of literal:
- Json::Value array;
- array.append( 1234 );
- int value = array[0].asInt(); // did not compile previously
-
- - Added float Json::Value::asFloat() to obtain a floating point value as a
- float (avoid lost of precision warning caused by used of asDouble()
- to initialize a float).
-
-* Reader
-
- - Renamed Reader::getFormatedErrorMessages() to getFormattedErrorMessages.
- Bug #3023708 (Formatted has 2 't'). The old member function is deprecated
- but still present for backward compatibility.
-
-* Tests
-
- - Added test to ensure that the escape sequence "\/" is corrected handled
- by the parser.
-
-* Bug fixes
-
- - Bug #3139677: JSON [1 2 3] was incorrectly parsed as [1, 3]. Error is now
- correctly detected.
-
- - Bug #3139678: stack buffer overflow when parsing a double with a
- length of 32 characters.
-
- - Fixed Value::operator <= implementation (had the semantic of operator >=).
- Found when addigin unit tests for comparison operators.
-
- - Value::compare() is now const and has an actual implementation with
- unit tests.
-
-* License
-
- - See file LICENSE for details. Basically JsonCpp is now licensed under
- MIT license, or public domain if desired and recognized in your jurisdiction.
- Thanks to Stephan G. Beal [http://wanderinghorse.net/home/stephan/]) who
- helped figuring out the solution to the public domain issue.
diff --git a/src/3rd_party-static/jsoncpp/README.txt b/src/3rd_party-static/jsoncpp/README.txt
deleted file mode 100644
index 51a098a810..0000000000
--- a/src/3rd_party-static/jsoncpp/README.txt
+++ /dev/null
@@ -1,172 +0,0 @@
-* Introduction:
- =============
-
-JSON (JavaScript Object Notation) is a lightweight data-interchange format.
-It can represent integer, real number, string, an ordered sequence of
-value, and a collection of name/value pairs.
-
-JsonCpp (http://jsoncpp.sourceforge.net/) is a simple API to manipulate
-JSON value, handle serialization and unserialization to string.
-
-It can also preserve existing comment in unserialization/serialization steps,
-making it a convenient format to store user input files.
-
-Unserialization parsing is user friendly and provides precise error reports.
-
-
-* Building/Testing:
- =================
-
-JsonCpp uses Scons (http://www.scons.org) as a build system. Scons requires
-python to be installed (http://www.python.org).
-
-You download scons-local distribution from the following url:
-http://sourceforge.net/projects/scons/files/scons-local/1.2.0/
-
-Unzip it in the directory where you found this README file. scons.py Should be
-at the same level as README.
-
-python scons.py platform=PLTFRM [TARGET]
-where PLTFRM may be one of:
- suncc Sun C++ (Solaris)
- vacpp Visual Age C++ (AIX)
- mingw
- msvc6 Microsoft Visual Studio 6 service pack 5-6
- msvc70 Microsoft Visual Studio 2002
- msvc71 Microsoft Visual Studio 2003
- msvc80 Microsoft Visual Studio 2005
- msvc90 Microsoft Visual Studio 2008
- linux-gcc Gnu C++ (linux, also reported to work for Mac OS X)
-
-Notes: if you are building with Microsoft Visual Studio 2008, you need to
-setup the environment by running vcvars32.bat (e.g. MSVC 2008 command prompt)
-before running scons.
-
-Adding platform is fairly simple. You need to change the Sconstruct file
-to do so.
-
-and TARGET may be:
- check: build library and run unit tests.
-
-
-* Running the test manually:
- ==========================
-
-Notes that test can be run by scons using the 'check' target (see above).
-
-You need to run test manually only if you are troubleshooting an issue.
-
-In the instruction below, replace "path to jsontest.exe" with the path
-of the 'jsontest' executable that was compiled on your platform.
-
-cd test
-# This will run the Reader/Writer tests
-python runjsontests.py "path to jsontest.exe"
-
-# This will run the Reader/Writer tests, using JSONChecker test suite
-# (http://www.json.org/JSON_checker/).
-# Notes: not all tests pass: JsonCpp is too lenient (for example,
-# it allows an integer to start with '0'). The goal is to improve
-# strict mode parsing to get all tests to pass.
-python runjsontests.py --with-json-checker "path to jsontest.exe"
-
-# This will run the unit tests (mostly Value)
-python rununittests.py "path to test_lib_json.exe"
-
-You can run the tests using valgrind:
-python rununittests.py --valgrind "path to test_lib_json.exe"
-
-
-* Building the documentation:
- ===========================
-
-Run the python script doxybuild.py from the top directory:
-
-python doxybuild.py --open --with-dot
-
-See doxybuild.py --help for options.
-
-Notes that the documentation is also available for download as a tarball.
-The documentation of the latest release is available online at:
-http://jsoncpp.sourceforge.net/
-
-* Generating amalgamated source and header
- ========================================
-
-JsonCpp is provided with a script to generate a single header and a single
-source file to ease inclusion in an existing project.
-
-The amalgamated source can be generated at any time by running the following
-command from the top-directory (requires python 2.6):
-
-python amalgamate.py
-
-It is possible to specify header name. See -h options for detail. By default,
-the following files are generated:
-- dist/jsoncpp.cpp: source file that need to be added to your project
-- dist/json/json.h: header file corresponding to use in your project. It is
-equivalent to including json/json.h in non-amalgamated source. This header
-only depends on standard headers.
-- dist/json/json-forwards.h: header the provides forward declaration
-of all JsonCpp types. This typically what should be included in headers to
-speed-up compilation.
-
-The amalgamated sources are generated by concatenating JsonCpp source in the
-correct order and defining macro JSON_IS_AMALGAMATION to prevent inclusion
-of other headers.
-
-* Using json-cpp in your project:
- ===============================
-
-include/ should be added to your compiler include path. jsoncpp headers
-should be included as follow:
-
-#include <json/json.h>
-
-
-* Adding a reader/writer test:
- ============================
-
-To add a test, you need to create two files in test/data:
-- a TESTNAME.json file, that contains the input document in JSON format.
-- a TESTNAME.expected file, that contains a flatened representation of
- the input document.
-
-TESTNAME.expected file format:
-- each line represents a JSON element of the element tree represented
- by the input document.
-- each line has two parts: the path to access the element separated from
- the element value by '='. Array and object values are always empty
- (e.g. represented by either [] or {}).
-- element path: '.' represented the root element, and is used to separate
- object members. [N] is used to specify the value of an array element
- at index N.
-See test_complex_01.json and test_complex_01.expected to better understand
-element path.
-
-
-* Understanding reader/writer test output:
- ========================================
-
-When a test is run, output files are generated aside the input test files.
-Below is a short description of the content of each file:
-
-- test_complex_01.json: input JSON document
-- test_complex_01.expected: flattened JSON element tree used to check if
- parsing was corrected.
-
-- test_complex_01.actual: flattened JSON element tree produced by
- jsontest.exe from reading test_complex_01.json
-- test_complex_01.rewrite: JSON document written by jsontest.exe using the
- Json::Value parsed from test_complex_01.json and serialized using
- Json::StyledWritter.
-- test_complex_01.actual-rewrite: flattened JSON element tree produced by
- jsontest.exe from reading test_complex_01.rewrite.
-test_complex_01.process-output: jsontest.exe output, typically useful to
- understand parsing error.
-
-* License
- =======
-
-See file LICENSE for details. Basically JsonCpp is licensed under
-MIT license, or public domain if desired and recognized in your jurisdiction.
diff --git a/src/3rd_party-static/jsoncpp/SConstruct b/src/3rd_party-static/jsoncpp/SConstruct
deleted file mode 100644
index e78a5e922b..0000000000
--- a/src/3rd_party-static/jsoncpp/SConstruct
+++ /dev/null
@@ -1,248 +0,0 @@
-"""
-Notes:
-- shared library support is buggy: it assumes that a static and dynamic library can be build from the same object files. This is not true on many platforms. For this reason it is only enabled on linux-gcc at the current time.
-
-To add a platform:
-- add its name in options allowed_values below
-- add tool initialization for this platform. Search for "if platform == 'suncc'" as an example.
-"""
-
-import os
-import os.path
-import sys
-
-JSONCPP_VERSION = open(File('#version').abspath,'rt').read().strip()
-DIST_DIR = '#dist'
-
-options = Variables()
-options.Add( EnumVariable('platform',
- 'Platform (compiler/stl) used to build the project',
- 'msvc71',
- allowed_values='suncc vacpp mingw msvc6 msvc7 msvc71 msvc80 msvc90 linux-gcc'.split(),
- ignorecase=2) )
-
-try:
- platform = ARGUMENTS['platform']
- if platform == 'linux-gcc':
- CXX = 'g++' # not quite right, but env is not yet available.
- import commands
- version = commands.getoutput('%s -dumpversion' %CXX)
- platform = 'linux-gcc-%s' %version
- print "Using platform '%s'" %platform
- LD_LIBRARY_PATH = os.environ.get('LD_LIBRARY_PATH', '')
- LD_LIBRARY_PATH = "%s:libs/%s" %(LD_LIBRARY_PATH, platform)
- os.environ['LD_LIBRARY_PATH'] = LD_LIBRARY_PATH
- print "LD_LIBRARY_PATH =", LD_LIBRARY_PATH
-except KeyError:
- print 'You must specify a "platform"'
- sys.exit(2)
-
-print "Building using PLATFORM =", platform
-
-rootbuild_dir = Dir('#buildscons')
-build_dir = os.path.join( '#buildscons', platform )
-bin_dir = os.path.join( '#bin', platform )
-lib_dir = os.path.join( '#libs', platform )
-sconsign_dir_path = Dir(build_dir).abspath
-sconsign_path = os.path.join( sconsign_dir_path, '.sconsign.dbm' )
-
-# Ensure build directory exist (SConsignFile fail otherwise!)
-if not os.path.exists( sconsign_dir_path ):
- os.makedirs( sconsign_dir_path )
-
-# Store all dependencies signature in a database
-SConsignFile( sconsign_path )
-
-def make_environ_vars():
- """Returns a dictionnary with environment variable to use when compiling."""
- # PATH is required to find the compiler
- # TEMP is required for at least mingw
- # LD_LIBRARY_PATH & co is required on some system for the compiler
- vars = {}
- for name in ('PATH', 'TEMP', 'TMP', 'LD_LIBRARY_PATH', 'LIBRARY_PATH'):
- if name in os.environ:
- vars[name] = os.environ[name]
- return vars
-
-
-env = Environment( ENV = make_environ_vars(),
- toolpath = ['scons-tools'],
- tools=[] ) #, tools=['default'] )
-
-if platform == 'suncc':
- env.Tool( 'sunc++' )
- env.Tool( 'sunlink' )
- env.Tool( 'sunar' )
- env.Append( CCFLAGS = ['-mt'] )
-elif platform == 'vacpp':
- env.Tool( 'default' )
- env.Tool( 'aixcc' )
- env['CXX'] = 'xlC_r' #scons does not pick-up the correct one !
- # using xlC_r ensure multi-threading is enabled:
- # http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.vacpp7a.doc/compiler/ref/cuselect.htm
- env.Append( CCFLAGS = '-qrtti=all',
- LINKFLAGS='-bh:5' ) # -bh:5 remove duplicate symbol warning
-elif platform == 'msvc6':
- env['MSVS_VERSION']='6.0'
- for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
- env.Tool( tool )
- env['CXXFLAGS']='-GR -GX /nologo /MT'
-elif platform == 'msvc70':
- env['MSVS_VERSION']='7.0'
- for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
- env.Tool( tool )
- env['CXXFLAGS']='-GR -GX /nologo /MT'
-elif platform == 'msvc71':
- env['MSVS_VERSION']='7.1'
- for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
- env.Tool( tool )
- env['CXXFLAGS']='-GR -GX /nologo /MT'
-elif platform == 'msvc80':
- env['MSVS_VERSION']='8.0'
- for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
- env.Tool( tool )
- env['CXXFLAGS']='-GR -EHsc /nologo /MT'
-elif platform == 'msvc90':
- env['MSVS_VERSION']='9.0'
- # Scons 1.2 fails to detect the correct location of the platform SDK.
- # So we propagate those from the environment. This requires that the
- # user run vcvars32.bat before compiling.
- if 'INCLUDE' in os.environ:
- env['ENV']['INCLUDE'] = os.environ['INCLUDE']
- if 'LIB' in os.environ:
- env['ENV']['LIB'] = os.environ['LIB']
- for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
- env.Tool( tool )
- env['CXXFLAGS']='-GR -EHsc /nologo /MT'
-elif platform == 'mingw':
- env.Tool( 'mingw' )
- env.Append( CPPDEFINES=[ "WIN32", "NDEBUG", "_MT" ] )
-elif platform.startswith('linux-gcc'):
- env.Tool( 'default' )
- env.Append( LIBS = ['pthread'], CCFLAGS = "-Wall" )
- env['SHARED_LIB_ENABLED'] = True
-else:
- print "UNSUPPORTED PLATFORM."
- env.Exit(1)
-
-env.Tool('targz')
-env.Tool('srcdist')
-env.Tool('globtool')
-
-env.Append( CPPPATH = ['#include'],
- LIBPATH = lib_dir )
-short_platform = platform
-if short_platform.startswith('msvc'):
- short_platform = short_platform[2:]
-# Notes: on Windows you need to rebuild the source for each variant
-# Build script does not support that yet so we only build static libraries.
-# This also fails on AIX because both dynamic and static library ends with
-# extension .a.
-env['SHARED_LIB_ENABLED'] = env.get('SHARED_LIB_ENABLED', False)
-env['LIB_PLATFORM'] = short_platform
-env['LIB_LINK_TYPE'] = 'lib' # static
-env['LIB_CRUNTIME'] = 'mt'
-env['LIB_NAME_SUFFIX'] = '${LIB_PLATFORM}_${LIB_LINK_TYPE}${LIB_CRUNTIME}' # must match autolink naming convention
-env['JSONCPP_VERSION'] = JSONCPP_VERSION
-env['BUILD_DIR'] = env.Dir(build_dir)
-env['ROOTBUILD_DIR'] = env.Dir(rootbuild_dir)
-env['DIST_DIR'] = DIST_DIR
-if 'TarGz' in env['BUILDERS']:
- class SrcDistAdder:
- def __init__( self, env ):
- self.env = env
- def __call__( self, *args, **kw ):
- apply( self.env.SrcDist, (self.env['SRCDIST_TARGET'],) + args, kw )
- env['SRCDIST_BUILDER'] = env.TarGz
-else: # If tarfile module is missing
- class SrcDistAdder:
- def __init__( self, env ):
- pass
- def __call__( self, *args, **kw ):
- pass
-env['SRCDIST_ADD'] = SrcDistAdder( env )
-env['SRCDIST_TARGET'] = os.path.join( DIST_DIR, 'jsoncpp-src-%s.tar.gz' % env['JSONCPP_VERSION'] )
-
-env_testing = env.Clone( )
-env_testing.Append( LIBS = ['json_${LIB_NAME_SUFFIX}'] )
-
-def buildJSONExample( env, target_sources, target_name ):
- env = env.Clone()
- env.Append( CPPPATH = ['#'] )
- exe = env.Program( target=target_name,
- source=target_sources )
- env['SRCDIST_ADD']( source=[target_sources] )
- global bin_dir
- return env.Install( bin_dir, exe )
-
-def buildJSONTests( env, target_sources, target_name ):
- jsontests_node = buildJSONExample( env, target_sources, target_name )
- check_alias_target = env.Alias( 'check', jsontests_node, RunJSONTests( jsontests_node, jsontests_node ) )
- env.AlwaysBuild( check_alias_target )
-
-def buildUnitTests( env, target_sources, target_name ):
- jsontests_node = buildJSONExample( env, target_sources, target_name )
- check_alias_target = env.Alias( 'check', jsontests_node,
- RunUnitTests( jsontests_node, jsontests_node ) )
- env.AlwaysBuild( check_alias_target )
-
-def buildLibrary( env, target_sources, target_name ):
- static_lib = env.StaticLibrary( target=target_name + '_${LIB_NAME_SUFFIX}',
- source=target_sources )
- global lib_dir
- env.Install( lib_dir, static_lib )
- if env['SHARED_LIB_ENABLED']:
- shared_lib = env.SharedLibrary( target=target_name + '_${LIB_NAME_SUFFIX}',
- source=target_sources )
- env.Install( lib_dir, shared_lib )
- env['SRCDIST_ADD']( source=[target_sources] )
-
-Export( 'env env_testing buildJSONExample buildLibrary buildJSONTests buildUnitTests' )
-
-def buildProjectInDirectory( target_directory ):
- global build_dir
- target_build_dir = os.path.join( build_dir, target_directory )
- target = os.path.join( target_directory, 'sconscript' )
- SConscript( target, build_dir=target_build_dir, duplicate=0 )
- env['SRCDIST_ADD']( source=[target] )
-
-
-def runJSONTests_action( target, source = None, env = None ):
- # Add test scripts to python path
- jsontest_path = Dir( '#test' ).abspath
- sys.path.insert( 0, jsontest_path )
- data_path = os.path.join( jsontest_path, 'data' )
- import runjsontests
- return runjsontests.runAllTests( os.path.abspath(source[0].path), data_path )
-
-def runJSONTests_string( target, source = None, env = None ):
- return 'RunJSONTests("%s")' % source[0]
-
-import SCons.Action
-ActionFactory = SCons.Action.ActionFactory
-RunJSONTests = ActionFactory(runJSONTests_action, runJSONTests_string )
-
-def runUnitTests_action( target, source = None, env = None ):
- # Add test scripts to python path
- jsontest_path = Dir( '#test' ).abspath
- sys.path.insert( 0, jsontest_path )
- import rununittests
- return rununittests.runAllTests( os.path.abspath(source[0].path) )
-
-def runUnitTests_string( target, source = None, env = None ):
- return 'RunUnitTests("%s")' % source[0]
-
-RunUnitTests = ActionFactory(runUnitTests_action, runUnitTests_string )
-
-env.Alias( 'check' )
-
-srcdist_cmd = env['SRCDIST_ADD']( source = """
- AUTHORS README.txt SConstruct
- """.split() )
-env.Alias( 'src-dist', srcdist_cmd )
-
-buildProjectInDirectory( 'src/jsontestrunner' )
-buildProjectInDirectory( 'src/lib_json' )
-buildProjectInDirectory( 'src/test_lib_json' )
-#print env.Dump()
-
diff --git a/src/3rd_party-static/jsoncpp/amalgamate.py b/src/3rd_party-static/jsoncpp/amalgamate.py
deleted file mode 100644
index 6e3b11a0af..0000000000
--- a/src/3rd_party-static/jsoncpp/amalgamate.py
+++ /dev/null
@@ -1,147 +0,0 @@
-"""Amalgate json-cpp library sources into a single source and header file.
-
-Requires Python 2.6
-
-Example of invocation (must be invoked from json-cpp top directory):
-python amalgate.py
-"""
-import os
-import os.path
-import sys
-
-class AmalgamationFile:
- def __init__( self, top_dir ):
- self.top_dir = top_dir
- self.blocks = []
-
- def add_text( self, text ):
- if not text.endswith( '\n' ):
- text += '\n'
- self.blocks.append( text )
-
- def add_file( self, relative_input_path, wrap_in_comment=False ):
- def add_marker( prefix ):
- self.add_text( '' )
- self.add_text( '// ' + '/'*70 )
- self.add_text( '// %s of content of file: %s' % (prefix, relative_input_path.replace('\\','/')) )
- self.add_text( '// ' + '/'*70 )
- self.add_text( '' )
- add_marker( 'Beginning' )
- f = open( os.path.join( self.top_dir, relative_input_path ), 'rt' )
- content = f.read()
- if wrap_in_comment:
- content = '/*\n' + content + '\n*/'
- self.add_text( content )
- f.close()
- add_marker( 'End' )
- self.add_text( '\n\n\n\n' )
-
- def get_value( self ):
- return ''.join( self.blocks ).replace('\r\n','\n')
-
- def write_to( self, output_path ):
- output_dir = os.path.dirname( output_path )
- if output_dir and not os.path.isdir( output_dir ):
- os.makedirs( output_dir )
- f = open( output_path, 'wb' )
- f.write( self.get_value() )
- f.close()
-
-def amalgamate_source( source_top_dir=None,
- target_source_path=None,
- header_include_path=None ):
- """Produces amalgated source.
- Parameters:
- source_top_dir: top-directory
- target_source_path: output .cpp path
- header_include_path: generated header path relative to target_source_path.
- """
- print 'Amalgating header...'
- header = AmalgamationFile( source_top_dir )
- header.add_text( '/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).' )
- header.add_text( '/// It is intented to be used with #include <%s>' % header_include_path )
- header.add_file( 'LICENSE', wrap_in_comment=True )
- header.add_text( '#ifndef JSON_AMALGATED_H_INCLUDED' )
- header.add_text( '# define JSON_AMALGATED_H_INCLUDED' )
- header.add_text( '/// If defined, indicates that the source file is amalgated' )
- header.add_text( '/// to prevent private header inclusion.' )
- header.add_text( '#define JSON_IS_AMALGATED' )
- header.add_file( 'include/json/config.h' )
- header.add_file( 'include/json/forwards.h' )
- header.add_file( 'include/json/features.h' )
- header.add_file( 'include/json/value.h' )
- header.add_file( 'include/json/reader.h' )
- header.add_file( 'include/json/writer.h' )
- header.add_text( '#endif //ifndef JSON_AMALGATED_H_INCLUDED' )
-
- target_header_path = os.path.join( os.path.dirname(target_source_path), header_include_path )
- print 'Writing amalgated header to %r' % target_header_path
- header.write_to( target_header_path )
-
- base, ext = os.path.splitext( header_include_path )
- forward_header_include_path = base + '-forwards' + ext
- print 'Amalgating forward header...'
- header = AmalgamationFile( source_top_dir )
- header.add_text( '/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).' )
- header.add_text( '/// It is intented to be used with #include <%s>' % forward_header_include_path )
- header.add_text( '/// This header provides forward declaration for all JsonCpp types.' )
- header.add_file( 'LICENSE', wrap_in_comment=True )
- header.add_text( '#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED' )
- header.add_text( '# define JSON_FORWARD_AMALGATED_H_INCLUDED' )
- header.add_text( '/// If defined, indicates that the source file is amalgated' )
- header.add_text( '/// to prevent private header inclusion.' )
- header.add_text( '#define JSON_IS_AMALGATED' )
- header.add_file( 'include/json/config.h' )
- header.add_file( 'include/json/forwards.h' )
- header.add_text( '#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED' )
-
- target_forward_header_path = os.path.join( os.path.dirname(target_source_path),
- forward_header_include_path )
- print 'Writing amalgated forward header to %r' % target_forward_header_path
- header.write_to( target_forward_header_path )
-
- print 'Amalgating source...'
- source = AmalgamationFile( source_top_dir )
- source.add_text( '/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/).' )
- source.add_text( '/// It is intented to be used with #include <%s>' % header_include_path )
- source.add_file( 'LICENSE', wrap_in_comment=True )
- source.add_text( '' )
- source.add_text( '#include <%s>' % header_include_path )
- source.add_text( '' )
- source.add_file( 'src/lib_json\json_tool.h' )
- source.add_file( 'src/lib_json\json_reader.cpp' )
- source.add_file( 'src/lib_json\json_batchallocator.h' )
- source.add_file( 'src/lib_json\json_valueiterator.inl' )
- source.add_file( 'src/lib_json\json_value.cpp' )
- source.add_file( 'src/lib_json\json_writer.cpp' )
-
- print 'Writing amalgated source to %r' % target_source_path
- source.write_to( target_source_path )
-
-def main():
- usage = """%prog [options]
-Generate a single amalgated source and header file from the sources.
-"""
- from optparse import OptionParser
- parser = OptionParser(usage=usage)
- parser.allow_interspersed_args = False
- parser.add_option('-s', '--source', dest="target_source_path", action='store', default='dist/jsoncpp.cpp',
- help="""Output .cpp source path. [Default: %default]""")
- parser.add_option('-i', '--include', dest="header_include_path", action='store', default='json/json.h',
- help="""Header include path. Used to include the header from the amalgated source file. [Default: %default]""")
- parser.add_option('-t', '--top-dir', dest="top_dir", action='store', default=os.getcwd(),
- help="""Source top-directory. [Default: %default]""")
- parser.enable_interspersed_args()
- options, args = parser.parse_args()
-
- msg = amalgamate_source( source_top_dir=options.top_dir,
- target_source_path=options.target_source_path,
- header_include_path=options.header_include_path )
- if msg:
- sys.stderr.write( msg + '\n' )
- sys.exit( 1 )
- else:
- print 'Source succesfully amalagated'
-
-if __name__ == '__main__':
- main()
diff --git a/src/3rd_party-static/jsoncpp/devtools/__init__.py b/src/3rd_party-static/jsoncpp/devtools/__init__.py
deleted file mode 100644
index 15c796c7e5..0000000000
--- a/src/3rd_party-static/jsoncpp/devtools/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-# module
diff --git a/src/3rd_party-static/jsoncpp/devtools/antglob.py b/src/3rd_party-static/jsoncpp/devtools/antglob.py
deleted file mode 100644
index 30837b576c..0000000000
--- a/src/3rd_party-static/jsoncpp/devtools/antglob.py
+++ /dev/null
@@ -1,201 +0,0 @@
-#!/usr/bin/env python
-# encoding: utf-8
-# Baptiste Lepilleur, 2009
-
-from dircache import listdir
-import re
-import fnmatch
-import os.path
-
-
-# These fnmatch expressions are used by default to prune the directory tree
-# while doing the recursive traversal in the glob_impl method of glob function.
-prune_dirs = '.git .bzr .hg .svn _MTN _darcs CVS SCCS '
-
-# These fnmatch expressions are used by default to exclude files and dirs
-# while doing the recursive traversal in the glob_impl method of glob function.
-##exclude_pats = prune_pats + '*~ #*# .#* %*% ._* .gitignore .cvsignore vssver.scc .DS_Store'.split()
-
-# These ant_glob expressions are used by default to exclude files and dirs and also prune the directory tree
-# while doing the recursive traversal in the glob_impl method of glob function.
-default_excludes = '''
-**/*~
-**/#*#
-**/.#*
-**/%*%
-**/._*
-**/CVS
-**/CVS/**
-**/.cvsignore
-**/SCCS
-**/SCCS/**
-**/vssver.scc
-**/.svn
-**/.svn/**
-**/.git
-**/.git/**
-**/.gitignore
-**/.bzr
-**/.bzr/**
-**/.hg
-**/.hg/**
-**/_MTN
-**/_MTN/**
-**/_darcs
-**/_darcs/**
-**/.DS_Store '''
-
-DIR = 1
-FILE = 2
-DIR_LINK = 4
-FILE_LINK = 8
-LINKS = DIR_LINK | FILE_LINK
-ALL_NO_LINK = DIR | FILE
-ALL = DIR | FILE | LINKS
-
-_ANT_RE = re.compile( r'(/\*\*/)|(\*\*/)|(/\*\*)|(\*)|(/)|([^\*/]*)' )
-
-def ant_pattern_to_re( ant_pattern ):
- """Generates a regular expression from the ant pattern.
- Matching convention:
- **/a: match 'a', 'dir/a', 'dir1/dir2/a'
- a/**/b: match 'a/b', 'a/c/b', 'a/d/c/b'
- *.py: match 'script.py' but not 'a/script.py'
- """
- rex = ['^']
- next_pos = 0
- sep_rex = r'(?:/|%s)' % re.escape( os.path.sep )
-## print 'Converting', ant_pattern
- for match in _ANT_RE.finditer( ant_pattern ):
-## print 'Matched', match.group()
-## print match.start(0), next_pos
- if match.start(0) != next_pos:
- raise ValueError( "Invalid ant pattern" )
- if match.group(1): # /**/
- rex.append( sep_rex + '(?:.*%s)?' % sep_rex )
- elif match.group(2): # **/
- rex.append( '(?:.*%s)?' % sep_rex )
- elif match.group(3): # /**
- rex.append( sep_rex + '.*' )
- elif match.group(4): # *
- rex.append( '[^/%s]*' % re.escape(os.path.sep) )
- elif match.group(5): # /
- rex.append( sep_rex )
- else: # somepath
- rex.append( re.escape(match.group(6)) )
- next_pos = match.end()
- rex.append('$')
- return re.compile( ''.join( rex ) )
-
-def _as_list( l ):
- if isinstance(l, basestring):
- return l.split()
- return l
-
-def glob(dir_path,
- includes = '**/*',
- excludes = default_excludes,
- entry_type = FILE,
- prune_dirs = prune_dirs,
- max_depth = 25):
- include_filter = [ant_pattern_to_re(p) for p in _as_list(includes)]
- exclude_filter = [ant_pattern_to_re(p) for p in _as_list(excludes)]
- prune_dirs = [p.replace('/',os.path.sep) for p in _as_list(prune_dirs)]
- dir_path = dir_path.replace('/',os.path.sep)
- entry_type_filter = entry_type
-
- def is_pruned_dir( dir_name ):
- for pattern in prune_dirs:
- if fnmatch.fnmatch( dir_name, pattern ):
- return True
- return False
-
- def apply_filter( full_path, filter_rexs ):
- """Return True if at least one of the filter regular expression match full_path."""
- for rex in filter_rexs:
- if rex.match( full_path ):
- return True
- return False
-
- def glob_impl( root_dir_path ):
- child_dirs = [root_dir_path]
- while child_dirs:
- dir_path = child_dirs.pop()
- for entry in listdir( dir_path ):
- full_path = os.path.join( dir_path, entry )
-## print 'Testing:', full_path,
- is_dir = os.path.isdir( full_path )
- if is_dir and not is_pruned_dir( entry ): # explore child directory ?
-## print '===> marked for recursion',
- child_dirs.append( full_path )
- included = apply_filter( full_path, include_filter )
- rejected = apply_filter( full_path, exclude_filter )
- if not included or rejected: # do not include entry ?
-## print '=> not included or rejected'
- continue
- link = os.path.islink( full_path )
- is_file = os.path.isfile( full_path )
- if not is_file and not is_dir:
-## print '=> unknown entry type'
- continue
- if link:
- entry_type = is_file and FILE_LINK or DIR_LINK
- else:
- entry_type = is_file and FILE or DIR
-## print '=> type: %d' % entry_type,
- if (entry_type & entry_type_filter) != 0:
-## print ' => KEEP'
- yield os.path.join( dir_path, entry )
-## else:
-## print ' => TYPE REJECTED'
- return list( glob_impl( dir_path ) )
-
-
-if __name__ == "__main__":
- import unittest
-
- class AntPatternToRETest(unittest.TestCase):
-## def test_conversion( self ):
-## self.assertEqual( '^somepath$', ant_pattern_to_re( 'somepath' ).pattern )
-
- def test_matching( self ):
- test_cases = [ ( 'path',
- ['path'],
- ['somepath', 'pathsuffix', '/path', '/path'] ),
- ( '*.py',
- ['source.py', 'source.ext.py', '.py'],
- ['path/source.py', '/.py', 'dir.py/z', 'z.pyc', 'z.c'] ),
- ( '**/path',
- ['path', '/path', '/a/path', 'c:/a/path', '/a/b/path', '//a/path', '/a/path/b/path'],
- ['path/', 'a/path/b', 'dir.py/z', 'somepath', 'pathsuffix', 'a/somepath'] ),
- ( 'path/**',
- ['path/a', 'path/path/a', 'path//'],
- ['path', 'somepath/a', 'a/path', 'a/path/a', 'pathsuffix/a'] ),
- ( '/**/path',
- ['/path', '/a/path', '/a/b/path/path', '/path/path'],
- ['path', 'path/', 'a/path', '/pathsuffix', '/somepath'] ),
- ( 'a/b',
- ['a/b'],
- ['somea/b', 'a/bsuffix', 'a/b/c'] ),
- ( '**/*.py',
- ['script.py', 'src/script.py', 'a/b/script.py', '/a/b/script.py'],
- ['script.pyc', 'script.pyo', 'a.py/b'] ),
- ( 'src/**/*.py',
- ['src/a.py', 'src/dir/a.py'],
- ['a/src/a.py', '/src/a.py'] ),
- ]
- for ant_pattern, accepted_matches, rejected_matches in list(test_cases):
- def local_path( paths ):
- return [ p.replace('/',os.path.sep) for p in paths ]
- test_cases.append( (ant_pattern, local_path(accepted_matches), local_path( rejected_matches )) )
- for ant_pattern, accepted_matches, rejected_matches in test_cases:
- rex = ant_pattern_to_re( ant_pattern )
- print 'ant_pattern:', ant_pattern, ' => ', rex.pattern
- for accepted_match in accepted_matches:
- print 'Accepted?:', accepted_match
- self.assert_( rex.match( accepted_match ) is not None )
- for rejected_match in rejected_matches:
- print 'Rejected?:', rejected_match
- self.assert_( rex.match( rejected_match ) is None )
-
- unittest.main()
diff --git a/src/3rd_party-static/jsoncpp/devtools/fixeol.py b/src/3rd_party-static/jsoncpp/devtools/fixeol.py
deleted file mode 100644
index 4fed6ce4b0..0000000000
--- a/src/3rd_party-static/jsoncpp/devtools/fixeol.py
+++ /dev/null
@@ -1,63 +0,0 @@
-import os.path
-
-def fix_source_eol( path, is_dry_run = True, verbose = True, eol = '\n' ):
- """Makes sure that all sources have the specified eol sequence (default: unix)."""
- if not os.path.isfile( path ):
- raise ValueError( 'Path "%s" is not a file' % path )
- try:
- f = open(path, 'rb')
- except IOError, msg:
- print >> sys.stderr, "%s: I/O Error: %s" % (file, str(msg))
- return False
- try:
- raw_lines = f.readlines()
- finally:
- f.close()
- fixed_lines = [line.rstrip('\r\n') + eol for line in raw_lines]
- if raw_lines != fixed_lines:
- print '%s =>' % path,
- if not is_dry_run:
- f = open(path, "wb")
- try:
- f.writelines(fixed_lines)
- finally:
- f.close()
- if verbose:
- print is_dry_run and ' NEED FIX' or ' FIXED'
- return True
-##
-##
-##
-##def _do_fix( is_dry_run = True ):
-## from waftools import antglob
-## python_sources = antglob.glob( '.',
-## includes = '**/*.py **/wscript **/wscript_build',
-## excludes = antglob.default_excludes + './waf.py',
-## prune_dirs = antglob.prune_dirs + 'waf-* ./build' )
-## for path in python_sources:
-## _fix_python_source( path, is_dry_run )
-##
-## cpp_sources = antglob.glob( '.',
-## includes = '**/*.cpp **/*.h **/*.inl',
-## prune_dirs = antglob.prune_dirs + 'waf-* ./build' )
-## for path in cpp_sources:
-## _fix_source_eol( path, is_dry_run )
-##
-##
-##def dry_fix(context):
-## _do_fix( is_dry_run = True )
-##
-##def fix(context):
-## _do_fix( is_dry_run = False )
-##
-##def shutdown():
-## pass
-##
-##def check(context):
-## # Unit tests are run when "check" target is used
-## ut = UnitTest.unit_test()
-## ut.change_to_testfile_dir = True
-## ut.want_to_see_test_output = True
-## ut.want_to_see_test_error = True
-## ut.run()
-## ut.print_results()
diff --git a/src/3rd_party-static/jsoncpp/devtools/licenseupdater.py b/src/3rd_party-static/jsoncpp/devtools/licenseupdater.py
deleted file mode 100644
index 866eada226..0000000000
--- a/src/3rd_party-static/jsoncpp/devtools/licenseupdater.py
+++ /dev/null
@@ -1,93 +0,0 @@
-"""Updates the license text in source file.
-"""
-
-# An existing license is found if the file starts with the string below,
-# and ends with the first blank line.
-LICENSE_BEGIN = "// Copyright "
-
-BRIEF_LICENSE = LICENSE_BEGIN + """2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-""".replace('\r\n','\n')
-
-def update_license( path, dry_run, show_diff ):
- """Update the license statement in the specified file.
- Parameters:
- path: path of the C++ source file to update.
- dry_run: if True, just print the path of the file that would be updated,
- but don't change it.
- show_diff: if True, print the path of the file that would be modified,
- as well as the change made to the file.
- """
- with open( path, 'rt' ) as fin:
- original_text = fin.read().replace('\r\n','\n')
- newline = fin.newlines and fin.newlines[0] or '\n'
- if not original_text.startswith( LICENSE_BEGIN ):
- # No existing license found => prepend it
- new_text = BRIEF_LICENSE + original_text
- else:
- license_end_index = original_text.index( '\n\n' ) # search first blank line
- new_text = BRIEF_LICENSE + original_text[license_end_index+2:]
- if original_text != new_text:
- if not dry_run:
- with open( path, 'wb' ) as fout:
- fout.write( new_text.replace('\n', newline ) )
- print 'Updated', path
- if show_diff:
- import difflib
- print '\n'.join( difflib.unified_diff( original_text.split('\n'),
- new_text.split('\n') ) )
- return True
- return False
-
-def update_license_in_source_directories( source_dirs, dry_run, show_diff ):
- """Updates license text in C++ source files found in directory source_dirs.
- Parameters:
- source_dirs: list of directory to scan for C++ sources. Directories are
- scanned recursively.
- dry_run: if True, just print the path of the file that would be updated,
- but don't change it.
- show_diff: if True, print the path of the file that would be modified,
- as well as the change made to the file.
- """
- from devtools import antglob
- prune_dirs = antglob.prune_dirs + 'scons-local* ./build* ./libs ./dist'
- for source_dir in source_dirs:
- cpp_sources = antglob.glob( source_dir,
- includes = '''**/*.h **/*.cpp **/*.inl''',
- prune_dirs = prune_dirs )
- for source in cpp_sources:
- update_license( source, dry_run, show_diff )
-
-def main():
- usage = """%prog DIR [DIR2...]
-Updates license text in sources of the project in source files found
-in the directory specified on the command-line.
-
-Example of call:
-python devtools\licenseupdater.py include src -n --diff
-=> Show change that would be made to the sources.
-
-python devtools\licenseupdater.py include src
-=> Update license statement on all sources in directories include/ and src/.
-"""
- from optparse import OptionParser
- parser = OptionParser(usage=usage)
- parser.allow_interspersed_args = False
- parser.add_option('-n', '--dry-run', dest="dry_run", action='store_true', default=False,
- help="""Only show what files are updated, do not update the files""")
- parser.add_option('--diff', dest="show_diff", action='store_true', default=False,
- help="""On update, show change made to the file.""")
- parser.enable_interspersed_args()
- options, args = parser.parse_args()
- update_license_in_source_directories( args, options.dry_run, options.show_diff )
- print 'Done'
-
-if __name__ == '__main__':
- import sys
- import os.path
- sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
- main()
-
diff --git a/src/3rd_party-static/jsoncpp/devtools/tarball.py b/src/3rd_party-static/jsoncpp/devtools/tarball.py
deleted file mode 100644
index ccbda39425..0000000000
--- a/src/3rd_party-static/jsoncpp/devtools/tarball.py
+++ /dev/null
@@ -1,53 +0,0 @@
-import os.path
-import gzip
-import tarfile
-
-TARGZ_DEFAULT_COMPRESSION_LEVEL = 9
-
-def make_tarball(tarball_path, sources, base_dir, prefix_dir=''):
- """Parameters:
- tarball_path: output path of the .tar.gz file
- sources: list of sources to include in the tarball, relative to the current directory
- base_dir: if a source file is in a sub-directory of base_dir, then base_dir is stripped
- from path in the tarball.
- prefix_dir: all files stored in the tarball be sub-directory of prefix_dir. Set to ''
- to make them child of root.
- """
- base_dir = os.path.normpath( os.path.abspath( base_dir ) )
- def archive_name( path ):
- """Makes path relative to base_dir."""
- path = os.path.normpath( os.path.abspath( path ) )
- common_path = os.path.commonprefix( (base_dir, path) )
- archive_name = path[len(common_path):]
- if os.path.isabs( archive_name ):
- archive_name = archive_name[1:]
- return os.path.join( prefix_dir, archive_name )
- def visit(tar, dirname, names):
- for name in names:
- path = os.path.join(dirname, name)
- if os.path.isfile(path):
- path_in_tar = archive_name(path)
- tar.add(path, path_in_tar )
- compression = TARGZ_DEFAULT_COMPRESSION_LEVEL
- tar = tarfile.TarFile.gzopen( tarball_path, 'w', compresslevel=compression )
- try:
- for source in sources:
- source_path = source
- if os.path.isdir( source ):
- os.path.walk(source_path, visit, tar)
- else:
- path_in_tar = archive_name(source_path)
- tar.add(source_path, path_in_tar ) # filename, arcname
- finally:
- tar.close()
-
-def decompress( tarball_path, base_dir ):
- """Decompress the gzipped tarball into directory base_dir.
- """
- # !!! This class method is not documented in the online doc
- # nor is bz2open!
- tar = tarfile.TarFile.gzopen(tarball_path, mode='r')
- try:
- tar.extractall( base_dir )
- finally:
- tar.close()
diff --git a/src/3rd_party-static/jsoncpp/doc/doxyfile.in b/src/3rd_party-static/jsoncpp/doc/doxyfile.in
deleted file mode 100644
index 48861d2385..0000000000
--- a/src/3rd_party-static/jsoncpp/doc/doxyfile.in
+++ /dev/null
@@ -1,1534 +0,0 @@
-# Doxyfile 1.5.9
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = "JsonCpp"
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER = %JSONCPP_VERSION%
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = %DOC_TOPDIR%
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
-# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
-# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
-# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
-# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH = %TOPDIR%
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH = %TOPDIR%/include
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = YES
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 3
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES = "testCaseSetup=\link CppUT::TestCase::setUp() setUp()\endlink" \
- "testCaseRun=\link CppUT::TestCase::run() run()\endlink" \
- "testCaseTearDown=\link CppUT::TestCase::tearDown() tearDown()\endlink" \
- "json_ref=<a HREF='http://www.json.org/'>JSON (JavaScript Object Notation)</a>"
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = YES
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = NO
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = YES
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = YES
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = NO
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = NO
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page.
-# This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE = %WARNING_LOG_PATH%
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ../include ../src/lib_json .
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.h \
- *.cpp \
- *.inl \
- *.dox
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-# If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis.
-# Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match.
-# The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = YES
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code.
-# Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = %HTML_OUTPUT%
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER = header.html
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER = footer.html
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = %HTML_HELP%
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE = jsoncpp-%JSONCPP_VERSION%.chm
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION = "c:\Program Files\HTML Help Workshop\hhc.exe"
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = YES
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = YES
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE =
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to FRAME, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature. Other possible values
-# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list;
-# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
-# disables this behavior completely. For backwards compatibility with previous
-# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
-# respectively.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-# If LATEX_SOURCE_CODE is set to YES then doxygen will include source code with syntax highlighting in the LaTeX output. Note that which sources are shown also depends on other settings such as SOURCE_BROWSER.
-
-LATEX_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader.
-# This is useful
-# if you want to understand what is going on.
-# On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH = ../include
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS = *.h
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED = "_MSC_VER=1400" \
- _CPPRTTI \
- _WIN32 \
- JSONCPP_DOC_EXCLUDE_IMPLEMENTATION \
- JSON_VALUE_USE_INTERNAL_MAP
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-#
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-#
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = NO
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = NO
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = %HAVE_DOT%
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = %UML_LOOK%
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = YES
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH = %DOT_PATH%
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 1000
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = YES
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Options related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
diff --git a/src/3rd_party-static/jsoncpp/doc/footer.html b/src/3rd_party-static/jsoncpp/doc/footer.html
deleted file mode 100644
index a61d9528a1..0000000000
--- a/src/3rd_party-static/jsoncpp/doc/footer.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<hr>
-<table width="100%">
- <tr>
- <td width="10%" align="left" valign="center">
- <a href="http://sourceforge.net">
- <img
- src="http://sourceforge.net/sflogo.php?group_id=144446"
- width="88" height="31" border="0" alt="SourceForge Logo"></a>
- </td>
- <td width="20%" align="left" valign="center">
- hosts this site.
- </td>
- <td>
- </td>
- <td align="right" valign="center">
- Send comments to:<br>
- <a href="mailto:jsoncpp-devel@lists.sourceforge.net">Json-cpp Developers</a>
- </td>
- </tr>
-</table>
-
-</body>
-</html>
diff --git a/src/3rd_party-static/jsoncpp/doc/header.html b/src/3rd_party-static/jsoncpp/doc/header.html
deleted file mode 100644
index 1a6ad6120a..0000000000
--- a/src/3rd_party-static/jsoncpp/doc/header.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<html>
-<head>
-<title>
-JsonCpp - JSON data format manipulation library
-</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css">
-<link href="tabs.css" rel="stylesheet" type="text/css">
-</head>
-
-<body bgcolor="#ffffff">
-<table width="100%">
- <tr>
- <td width="40%" align="left" valign="center">
- <a href="http://sourceforge.net/projects/jsoncpp/">
- JsonCpp project page
- </a>
- </td>
- <td width="40%" align="right" valign="center">
- <a href="http://jsoncpp.sourceforge.net">JsonCpp home page</a>
- </td>
- </tr>
-</table>
-
-<hr>
diff --git a/src/3rd_party-static/jsoncpp/doc/jsoncpp.dox b/src/3rd_party-static/jsoncpp/doc/jsoncpp.dox
deleted file mode 100644
index 97cc108d33..0000000000
--- a/src/3rd_party-static/jsoncpp/doc/jsoncpp.dox
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
-\mainpage
-\section _intro Introduction
-
-<a HREF="http://www.json.org/">JSON (JavaScript Object Notation)</a>
- is a lightweight data-interchange format.
-It can represent integer, real number, string, an ordered sequence of value, and
-a collection of name/value pairs.
-
-Here is an example of JSON data:
-\verbatim
-// Configuration options
-{
- // Default encoding for text
- "encoding" : "UTF-8",
-
- // Plug-ins loaded at start-up
- "plug-ins" : [
- "python",
- "c++",
- "ruby"
- ],
-
- // Tab indent size
- "indent" : { "length" : 3, "use_space": true }
-}
-\endverbatim
-
-\section _features Features
-- read and write JSON document
-- attach C and C++ style comments to element during parsing
-- rewrite JSON document preserving original comments
-
-Notes: Comments used to be supported in JSON but where removed for
-portability (C like comments are not supported in Python). Since
-comments are useful in configuration/input file, this feature was
-preserved.
-
-\section _example Code example
-
-\code
-Json::Value root; // will contains the root value after parsing.
-Json::Reader reader;
-bool parsingSuccessful = reader.parse( config_doc, root );
-if ( !parsingSuccessful )
-{
- // report to the user the failure and their locations in the document.
- std::cout << "Failed to parse configuration\n"
- << reader.getFormattedErrorMessages();
- return;
-}
-
-// Get the value of the member of root named 'encoding', return 'UTF-8' if there is no
-// such member.
-std::string encoding = root.get("encoding", "UTF-8" ).asString();
-// Get the value of the member of root named 'encoding', return a 'null' value if
-// there is no such member.
-const Json::Value plugins = root["plug-ins"];
-for ( int index = 0; index < plugins.size(); ++index ) // Iterates over the sequence elements.
- loadPlugIn( plugins[index].asString() );
-
-setIndentLength( root["indent"].get("length", 3).asInt() );
-setIndentUseSpace( root["indent"].get("use_space", true).asBool() );
-
-// ...
-// At application shutdown to make the new configuration document:
-// Since Json::Value has implicit constructor for all value types, it is not
-// necessary to explicitly construct the Json::Value object:
-root["encoding"] = getCurrentEncoding();
-root["indent"]["length"] = getCurrentIndentLength();
-root["indent"]["use_space"] = getCurrentIndentUseSpace();
-
-Json::StyledWriter writer;
-// Make a new JSON document for the configuration. Preserve original comments.
-std::string outputConfig = writer.write( root );
-
-// You can also use streams. This will put the contents of any JSON
-// stream at a particular sub-value, if you'd like.
-std::cin >> root["subtree"];
-
-// And you can write to a stream, using the StyledWriter automatically.
-std::cout << root;
-\endcode
-
-\section _pbuild Build instructions
-The build instructions are located in the file
-<a HREF="README.txt">README.txt</a> in the top-directory of the project.
-
-Permanent link to the latest revision of the file in subversion:
-<a HREF="http://jsoncpp.svn.sourceforge.net/viewvc/jsoncpp/trunk/jsoncpp/README.txt?view=markup">latest README.txt</a>
-
-\section _pdownload Download
-The sources can be downloaded from
-<a HREF="http://sourceforge.net/projects/jsoncpp/files/">SourceForge download page</a>.
-
-The latest version of the source is available in the project's subversion repository:
-<a HREF="http://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/trunk/">
-http://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/trunk/</a>
-
-To checkout the source, see the following
-<a HREF="http://sourceforge.net/scm/?type=svn&group_id=144446">instructions</a>.
-
-\section _news What's New?
-The description of latest changes can be found in
-<a HREF="NEWS.txt">NEWS.txt</a> in the top-directory of the project.
-
-Permanent link to the latest revision of the file in subversion:
-<a HREF="http://svn.sourceforge.net/viewcvs.cgi/jsoncpp/README.txt?view=markup">latest NEWS.txt</a>
-
-\section _plinks Project links
-- <a HREF="http://jsoncpp.sourceforge.net">json-cpp home</a>
-- <a HREF="http://www.sourceforge.net/projects/jsoncpp/">json-cpp sourceforge project</a>
-
-\section _rlinks Related links
-- <a HREF="http://www.json.org/">JSON</a> Specification and alternate language implementations.
-- <a HREF="http://www.yaml.org/">YAML</a> A data format designed for human readability.
-- <a HREF="http://www.cl.cam.ac.uk/~mgk25/unicode.html">UTF-8 and Unicode FAQ</a>.
-
-\section _license License
-See file <a HREF="LICENSE">LICENSE</a> in the top-directory of the project.
-
-Basically JsonCpp is licensed under MIT license, or public domain if desired
-and recognized in your jurisdiction.
-
-\author Baptiste Lepilleur <blep@users.sourceforge.net>
-*/
diff --git a/src/3rd_party-static/jsoncpp/doc/readme.txt b/src/3rd_party-static/jsoncpp/doc/readme.txt
deleted file mode 100644
index 0e42cdfb4c..0000000000
--- a/src/3rd_party-static/jsoncpp/doc/readme.txt
+++ /dev/null
@@ -1 +0,0 @@
-The documentation is generated using doxygen (http://www.doxygen.org).
diff --git a/src/3rd_party-static/jsoncpp/doc/roadmap.dox b/src/3rd_party-static/jsoncpp/doc/roadmap.dox
deleted file mode 100644
index e6fc17aa68..0000000000
--- a/src/3rd_party-static/jsoncpp/doc/roadmap.dox
+++ /dev/null
@@ -1,37 +0,0 @@
-/*! \page roadmap JsonCpp roadmap
- \section ms_release Makes JsonCpp ready for release
- - Build system clean-up:
- - Fix build on Windows (shared-library build is broken)
- - Add enable/disable flag for static and shared library build
- - Enhance help
- - Platform portability check: (Notes: was ok on last check)
- - linux/gcc,
- - solaris/cc,
- - windows/msvc678,
- - aix/vacpp
- - Add JsonCpp version to header as numeric for use in preprocessor test
- - Remove buggy experimental hash stuff
- \section ms_strict Adds a strict mode to reader/parser
- Strict JSON support as specific in RFC 4627 (http://www.ietf.org/rfc/rfc4627.txt?number=4627).
- - Enforce only object or array as root element
- - Disable comment support
- - Get jsonchecker failing tests to pass in strict mode
- \section ms_writer Writter control
- Provides more control to determine how specific items are serialized when JSON allow choice:
- - Optionally allow escaping of non-ASCII characters using unicode escape sequence "\\u".
- - Optionally allow escaping of "/" using "\/".
- \section ms_separation Expose json reader/writer API that do not impose using Json::Value.
- Some typical use-case involve an application specific structure to/from a JSON document.
- - Event base parser to allow unserializing a Json document directly in datastructure instead of
- using the intermediate Json::Value.
- - Stream based parser to serialized a Json document without using Json::Value as input.
- - Performance oriented parser/writer:
- - Provides an event based parser. Should allow pulling & skipping events for ease of use.
- - Provides a JSON document builder: fast only.
- \section ms_perfo Performance tuning
- - Provides support for static property name definition avoiding allocation
- - Static property dictionnary can be provided to JSON reader
- - Performance scenario & benchmarking
- \section testing Testing
- - Adds more tests for unicode parsing (e.g. including surrogate and error detection).
-*/
diff --git a/src/3rd_party-static/jsoncpp/doxybuild.py b/src/3rd_party-static/jsoncpp/doxybuild.py
deleted file mode 100644
index 03ad68df02..0000000000
--- a/src/3rd_party-static/jsoncpp/doxybuild.py
+++ /dev/null
@@ -1,169 +0,0 @@
-"""Script to generate doxygen documentation.
-"""
-
-import re
-import os
-import os.path
-import sys
-import shutil
-from devtools import tarball
-
-def find_program(*filenames):
- """find a program in folders path_lst, and sets env[var]
- @param filenames: a list of possible names of the program to search for
- @return: the full path of the filename if found, or '' if filename could not be found
-"""
- paths = os.environ.get('PATH', '').split(os.pathsep)
- suffixes = ('win32' in sys.platform ) and '.exe .com .bat .cmd' or ''
- for filename in filenames:
- for name in [filename+ext for ext in suffixes.split()]:
- for directory in paths:
- full_path = os.path.join(directory, name)
- if os.path.isfile(full_path):
- return full_path
- return ''
-
-def do_subst_in_file(targetfile, sourcefile, dict):
- """Replace all instances of the keys of dict with their values.
- For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'},
- then all instances of %VERSION% in the file will be replaced with 1.2345 etc.
- """
- try:
- f = open(sourcefile, 'rb')
- contents = f.read()
- f.close()
- except:
- print "Can't read source file %s"%sourcefile
- raise
- for (k,v) in dict.items():
- v = v.replace('\\','\\\\')
- contents = re.sub(k, v, contents)
- try:
- f = open(targetfile, 'wb')
- f.write(contents)
- f.close()
- except:
- print "Can't write target file %s"%targetfile
- raise
-
-def run_doxygen(doxygen_path, config_file, working_dir, is_silent):
- config_file = os.path.abspath( config_file )
- doxygen_path = doxygen_path
- old_cwd = os.getcwd()
- try:
- os.chdir( working_dir )
- cmd = [doxygen_path, config_file]
- print 'Running:', ' '.join( cmd )
- try:
- import subprocess
- except:
- if os.system( ' '.join( cmd ) ) != 0:
- print 'Documentation generation failed'
- return False
- else:
- if is_silent:
- process = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
- else:
- process = subprocess.Popen( cmd )
- stdout, _ = process.communicate()
- if process.returncode:
- print 'Documentation generation failed:'
- print stdout
- return False
- return True
- finally:
- os.chdir( old_cwd )
-
-def build_doc( options, make_release=False ):
- if make_release:
- options.make_tarball = True
- options.with_dot = True
- options.with_html_help = True
- options.with_uml_look = True
- options.open = False
- options.silent = True
-
- version = open('version','rt').read().strip()
- output_dir = 'dist/doxygen' # relative to doc/doxyfile location.
- if not os.path.isdir( output_dir ):
- os.makedirs( output_dir )
- top_dir = os.path.abspath( '.' )
- html_output_dirname = 'jsoncpp-api-html-' + version
- tarball_path = os.path.join( 'dist', html_output_dirname + '.tar.gz' )
- warning_log_path = os.path.join( output_dir, '../jsoncpp-doxygen-warning.log' )
- html_output_path = os.path.join( output_dir, html_output_dirname )
- def yesno( bool ):
- return bool and 'YES' or 'NO'
- subst_keys = {
- '%JSONCPP_VERSION%': version,
- '%DOC_TOPDIR%': '',
- '%TOPDIR%': top_dir,
- '%HTML_OUTPUT%': os.path.join( '..', output_dir, html_output_dirname ),
- '%HAVE_DOT%': yesno(options.with_dot),
- '%DOT_PATH%': os.path.split(options.dot_path)[0],
- '%HTML_HELP%': yesno(options.with_html_help),
- '%UML_LOOK%': yesno(options.with_uml_look),
- '%WARNING_LOG_PATH%': os.path.join( '..', warning_log_path )
- }
-
- if os.path.isdir( output_dir ):
- print 'Deleting directory:', output_dir
- shutil.rmtree( output_dir )
- if not os.path.isdir( output_dir ):
- os.makedirs( output_dir )
-
- do_subst_in_file( 'doc/doxyfile', 'doc/doxyfile.in', subst_keys )
- ok = run_doxygen( options.doxygen_path, 'doc/doxyfile', 'doc', is_silent=options.silent )
- if not options.silent:
- print open(warning_log_path, 'rb').read()
- index_path = os.path.abspath(os.path.join(subst_keys['%HTML_OUTPUT%'], 'index.html'))
- print 'Generated documentation can be found in:'
- print index_path
- if options.open:
- import webbrowser
- webbrowser.open( 'file://' + index_path )
- if options.make_tarball:
- print 'Generating doc tarball to', tarball_path
- tarball_sources = [
- output_dir,
- 'README.txt',
- 'LICENSE',
- 'NEWS.txt',
- 'version'
- ]
- tarball_basedir = os.path.join( output_dir, html_output_dirname )
- tarball.make_tarball( tarball_path, tarball_sources, tarball_basedir, html_output_dirname )
- return tarball_path, html_output_dirname
-
-def main():
- usage = """%prog
- Generates doxygen documentation in build/doxygen.
- Optionaly makes a tarball of the documentation to dist/.
-
- Must be started in the project top directory.
- """
- from optparse import OptionParser
- parser = OptionParser(usage=usage)
- parser.allow_interspersed_args = False
- parser.add_option('--with-dot', dest="with_dot", action='store_true', default=False,
- help="""Enable usage of DOT to generate collaboration diagram""")
- parser.add_option('--dot', dest="dot_path", action='store', default=find_program('dot'),
- help="""Path to GraphViz dot tool. Must be full qualified path. [Default: %default]""")
- parser.add_option('--doxygen', dest="doxygen_path", action='store', default=find_program('doxygen'),
- help="""Path to Doxygen tool. [Default: %default]""")
- parser.add_option('--with-html-help', dest="with_html_help", action='store_true', default=False,
- help="""Enable generation of Microsoft HTML HELP""")
- parser.add_option('--no-uml-look', dest="with_uml_look", action='store_false', default=True,
- help="""Generates DOT graph without UML look [Default: False]""")
- parser.add_option('--open', dest="open", action='store_true', default=False,
- help="""Open the HTML index in the web browser after generation""")
- parser.add_option('--tarball', dest="make_tarball", action='store_true', default=False,
- help="""Generates a tarball of the documentation in dist/ directory""")
- parser.add_option('-s', '--silent', dest="silent", action='store_true', default=False,
- help="""Hides doxygen output""")
- parser.enable_interspersed_args()
- options, args = parser.parse_args()
- build_doc( options )
-
-if __name__ == '__main__':
- main()
diff --git a/src/3rd_party-static/jsoncpp/include/json/autolink.h b/src/3rd_party-static/jsoncpp/include/json/autolink.h
deleted file mode 100644
index 02328d1f1a..0000000000
--- a/src/3rd_party-static/jsoncpp/include/json/autolink.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSON_AUTOLINK_H_INCLUDED
-# define JSON_AUTOLINK_H_INCLUDED
-
-# include "config.h"
-
-# ifdef JSON_IN_CPPTL
-# include <cpptl/cpptl_autolink.h>
-# endif
-
-# if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && !defined(JSON_IN_CPPTL)
-# define CPPTL_AUTOLINK_NAME "json"
-# undef CPPTL_AUTOLINK_DLL
-# ifdef JSON_DLL
-# define CPPTL_AUTOLINK_DLL
-# endif
-# include "autolink.h"
-# endif
-
-#endif // JSON_AUTOLINK_H_INCLUDED
diff --git a/src/3rd_party-static/jsoncpp/include/json/config.h b/src/3rd_party-static/jsoncpp/include/json/config.h
deleted file mode 100644
index 7609d45e7a..0000000000
--- a/src/3rd_party-static/jsoncpp/include/json/config.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSON_CONFIG_H_INCLUDED
-# define JSON_CONFIG_H_INCLUDED
-
-/// If defined, indicates that json library is embedded in CppTL library.
-//# define JSON_IN_CPPTL 1
-
-/// If defined, indicates that json may leverage CppTL library
-//# define JSON_USE_CPPTL 1
-/// If defined, indicates that cpptl vector based map should be used instead of std::map
-/// as Value container.
-//# define JSON_USE_CPPTL_SMALLMAP 1
-/// If defined, indicates that Json specific container should be used
-/// (hash table & simple deque container with customizable allocator).
-/// THIS FEATURE IS STILL EXPERIMENTAL! There is know bugs: See #3177332
-//# define JSON_VALUE_USE_INTERNAL_MAP 1
-/// Force usage of standard new/malloc based allocator instead of memory pool based allocator.
-/// The memory pools allocator used optimization (initializing Value and ValueInternalLink
-/// as if it was a POD) that may cause some validation tool to report errors.
-/// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined.
-//# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1
-
-/// If defined, indicates that Json use exception to report invalid type manipulation
-/// instead of C assert macro.
-# define JSON_USE_EXCEPTION 1
-
-/// If defined, indicates that the source file is amalgated
-/// to prevent private header inclusion.
-/// Remarks: it is automatically defined in the generated amalgated header.
-// #define JSON_IS_AMALGAMATION
-
-
-# ifdef JSON_IN_CPPTL
-# include <cpptl/config.h>
-# ifndef JSON_USE_CPPTL
-# define JSON_USE_CPPTL 1
-# endif
-# endif
-
-# ifdef JSON_IN_CPPTL
-# define JSON_API CPPTL_API
-# elif defined(JSON_DLL_BUILD)
-# define JSON_API __declspec(dllexport)
-# elif defined(JSON_DLL)
-# define JSON_API __declspec(dllimport)
-# else
-# define JSON_API
-# endif
-
-// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for integer
-// Storages, and 64 bits integer support is disabled.
-// #define JSON_NO_INT64 1
-
-#if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6
-// Microsoft Visual Studio 6 only support conversion from __int64 to double
-// (no conversion from unsigned __int64).
-#define JSON_USE_INT64_DOUBLE_CONVERSION 1
-#endif // if defined(_MSC_VER) && _MSC_VER < 1200 // MSVC 6
-
-#if defined(_MSC_VER) && _MSC_VER >= 1500 // MSVC 2008
-/// Indicates that the following function is deprecated.
-# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
-#endif
-
-#if !defined(JSONCPP_DEPRECATED)
-# define JSONCPP_DEPRECATED(message)
-#endif // if !defined(JSONCPP_DEPRECATED)
-
-namespace Json {
- typedef int Int;
- typedef unsigned int UInt;
-# if defined(JSON_NO_INT64)
- typedef int LargestInt;
- typedef unsigned int LargestUInt;
-# undef JSON_HAS_INT64
-# else // if defined(JSON_NO_INT64)
- // For Microsoft Visual use specific types as long long is not supported
-# if defined(_MSC_VER) // Microsoft Visual Studio
- typedef __int64 Int64;
- typedef unsigned __int64 UInt64;
-# else // if defined(_MSC_VER) // Other platforms, use long long
- typedef long long int Int64;
- typedef unsigned long long int UInt64;
-# endif // if defined(_MSC_VER)
- typedef Int64 LargestInt;
- typedef UInt64 LargestUInt;
-# define JSON_HAS_INT64
-# endif // if defined(JSON_NO_INT64)
-} // end namespace Json
-
-
-#endif // JSON_CONFIG_H_INCLUDED
diff --git a/src/3rd_party-static/jsoncpp/include/json/features.h b/src/3rd_party-static/jsoncpp/include/json/features.h
deleted file mode 100644
index 4353278446..0000000000
--- a/src/3rd_party-static/jsoncpp/include/json/features.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef CPPTL_JSON_FEATURES_H_INCLUDED
-# define CPPTL_JSON_FEATURES_H_INCLUDED
-
-#if !defined(JSON_IS_AMALGAMATION)
-# include "forwards.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-
-namespace Json {
-
- /** \brief Configuration passed to reader and writer.
- * This configuration object can be used to force the Reader or Writer
- * to behave in a standard conforming way.
- */
- class JSON_API Features
- {
- public:
- /** \brief A configuration that allows all features and assumes all strings are UTF-8.
- * - C & C++ comments are allowed
- * - Root object can be any JSON value
- * - Assumes Value strings are encoded in UTF-8
- */
- static Features all();
-
- /** \brief A configuration that is strictly compatible with the JSON specification.
- * - Comments are forbidden.
- * - Root object must be either an array or an object value.
- * - Assumes Value strings are encoded in UTF-8
- */
- static Features strictMode();
-
- /** \brief Initialize the configuration like JsonConfig::allFeatures;
- */
- Features();
-
- /// \c true if comments are allowed. Default: \c true.
- bool allowComments_;
-
- /// \c true if root must be either an array or an object value. Default: \c false.
- bool strictRoot_;
- };
-
-} // namespace Json
-
-#endif // CPPTL_JSON_FEATURES_H_INCLUDED
diff --git a/src/3rd_party-static/jsoncpp/include/json/forwards.h b/src/3rd_party-static/jsoncpp/include/json/forwards.h
deleted file mode 100644
index ab863da853..0000000000
--- a/src/3rd_party-static/jsoncpp/include/json/forwards.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSON_FORWARDS_H_INCLUDED
-# define JSON_FORWARDS_H_INCLUDED
-
-#if !defined(JSON_IS_AMALGAMATION)
-# include "config.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-
-namespace Json {
-
- // writer.h
- class FastWriter;
- class StyledWriter;
-
- // reader.h
- class Reader;
-
- // features.h
- class Features;
-
- // value.h
- typedef unsigned int ArrayIndex;
- class StaticString;
- class Path;
- class PathArgument;
- class Value;
- class ValueIteratorBase;
- class ValueIterator;
- class ValueConstIterator;
-#ifdef JSON_VALUE_USE_INTERNAL_MAP
- class ValueMapAllocator;
- class ValueInternalLink;
- class ValueInternalArray;
- class ValueInternalMap;
-#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
-
-} // namespace Json
-
-
-#endif // JSON_FORWARDS_H_INCLUDED
diff --git a/src/3rd_party-static/jsoncpp/include/json/json.h b/src/3rd_party-static/jsoncpp/include/json/json.h
deleted file mode 100644
index da5fc967eb..0000000000
--- a/src/3rd_party-static/jsoncpp/include/json/json.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSON_JSON_H_INCLUDED
-# define JSON_JSON_H_INCLUDED
-
-# include "autolink.h"
-# include "value.h"
-# include "reader.h"
-# include "writer.h"
-# include "features.h"
-
-#endif // JSON_JSON_H_INCLUDED
diff --git a/src/3rd_party-static/jsoncpp/include/json/reader.h b/src/3rd_party-static/jsoncpp/include/json/reader.h
deleted file mode 100644
index 0a324dfc5c..0000000000
--- a/src/3rd_party-static/jsoncpp/include/json/reader.h
+++ /dev/null
@@ -1,214 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef CPPTL_JSON_READER_H_INCLUDED
-# define CPPTL_JSON_READER_H_INCLUDED
-
-#if !defined(JSON_IS_AMALGAMATION)
-# include "features.h"
-# include "value.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-# include <deque>
-# include <stack>
-# include <string>
-# include <iostream>
-
-namespace Json {
-
- /** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a Value.
- *
- */
- class JSON_API Reader
- {
- public:
- typedef char Char;
- typedef const Char *Location;
-
- /** \brief Constructs a Reader allowing all features
- * for parsing.
- */
- Reader();
-
- /** \brief Constructs a Reader allowing the specified feature set
- * for parsing.
- */
- Reader( const Features &features );
-
- /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
- * \param document UTF-8 encoded string containing the document to read.
- * \param root [out] Contains the root value of the document if it was
- * successfully parsed.
- * \param collectComments \c true to collect comment and allow writing them back during
- * serialization, \c false to discard comments.
- * This parameter is ignored if Features::allowComments_
- * is \c false.
- * \return \c true if the document was successfully parsed, \c false if an error occurred.
- */
- bool parse( const std::string &document,
- Value &root,
- bool collectComments = true );
-
- /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a> document.
- * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the document to read.
- * \param endDoc Pointer on the end of the UTF-8 encoded string of the document to read.
- \ Must be >= beginDoc.
- * \param root [out] Contains the root value of the document if it was
- * successfully parsed.
- * \param collectComments \c true to collect comment and allow writing them back during
- * serialization, \c false to discard comments.
- * This parameter is ignored if Features::allowComments_
- * is \c false.
- * \return \c true if the document was successfully parsed, \c false if an error occurred.
- */
- bool parse( const char *beginDoc, const char *endDoc,
- Value &root,
- bool collectComments = true );
-
- /// \brief Parse from input stream.
- /// \see Json::operator>>(std::istream&, Json::Value&).
- bool parse( std::istream &is,
- Value &root,
- bool collectComments = true );
-
- /** \brief Returns a user friendly string that list errors in the parsed document.
- * \return Formatted error message with the list of errors with their location in
- * the parsed document. An empty string is returned if no error occurred
- * during parsing.
- * \deprecated Use getFormattedErrorMessages() instead (typo fix).
- */
- JSONCPP_DEPRECATED("Use getFormattedErrorMessages instead")
- std::string getFormatedErrorMessages() const;
-
- /** \brief Returns a user friendly string that list errors in the parsed document.
- * \return Formatted error message with the list of errors with their location in
- * the parsed document. An empty string is returned if no error occurred
- * during parsing.
- */
- std::string getFormattedErrorMessages() const;
-
- private:
- enum TokenType
- {
- tokenEndOfStream = 0,
- tokenObjectBegin,
- tokenObjectEnd,
- tokenArrayBegin,
- tokenArrayEnd,
- tokenString,
- tokenNumber,
- tokenTrue,
- tokenFalse,
- tokenNull,
- tokenArraySeparator,
- tokenMemberSeparator,
- tokenComment,
- tokenError
- };
-
- class Token
- {
- public:
- TokenType type_;
- Location start_;
- Location end_;
- };
-
- class ErrorInfo
- {
- public:
- Token token_;
- std::string message_;
- Location extra_;
- };
-
- typedef std::deque<ErrorInfo> Errors;
-
- bool expectToken( TokenType type, Token &token, const char *message );
- bool readToken( Token &token );
- void skipSpaces();
- bool match( Location pattern,
- int patternLength );
- bool readComment();
- bool readCStyleComment();
- bool readCppStyleComment();
- bool readString();
- void readNumber();
- bool readValue();
- bool readObject( Token &token );
- bool readArray( Token &token );
- bool decodeNumber( Token &token );
- bool decodeString( Token &token );
- bool decodeString( Token &token, std::string &decoded );
- bool decodeDouble( Token &token );
- bool decodeUnicodeCodePoint( Token &token,
- Location &current,
- Location end,
- unsigned int &unicode );
- bool decodeUnicodeEscapeSequence( Token &token,
- Location &current,
- Location end,
- unsigned int &unicode );
- bool addError( const std::string &message,
- Token &token,
- Location extra = 0 );
- bool recoverFromError( TokenType skipUntilToken );
- bool addErrorAndRecover( const std::string &message,
- Token &token,
- TokenType skipUntilToken );
- void skipUntilSpace();
- Value &currentValue();
- Char getNextChar();
- void getLocationLineAndColumn( Location location,
- int &line,
- int &column ) const;
- std::string getLocationLineAndColumn( Location location ) const;
- void addComment( Location begin,
- Location end,
- CommentPlacement placement );
- void skipCommentTokens( Token &token );
-
- typedef std::stack<Value *> Nodes;
- Nodes nodes_;
- Errors errors_;
- std::string document_;
- Location begin_;
- Location end_;
- Location current_;
- Location lastValueEnd_;
- Value *lastValue_;
- std::string commentsBefore_;
- Features features_;
- bool collectComments_;
- };
-
- /** \brief Read from 'sin' into 'root'.
-
- Always keep comments from the input JSON.
-
- This can be used to read a file into a particular sub-object.
- For example:
- \code
- Json::Value root;
- cin >> root["dir"]["file"];
- cout << root;
- \endcode
- Result:
- \verbatim
- {
- "dir": {
- "file": {
- // The input stream JSON would be nested here.
- }
- }
- }
- \endverbatim
- \throw std::exception on parse error.
- \see Json::operator<<()
- */
- std::istream& operator>>( std::istream&, Value& );
-
-} // namespace Json
-
-#endif // CPPTL_JSON_READER_H_INCLUDED
diff --git a/src/3rd_party-static/jsoncpp/include/json/value.h b/src/3rd_party-static/jsoncpp/include/json/value.h
deleted file mode 100644
index 32e3455ec6..0000000000
--- a/src/3rd_party-static/jsoncpp/include/json/value.h
+++ /dev/null
@@ -1,1103 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef CPPTL_JSON_H_INCLUDED
-# define CPPTL_JSON_H_INCLUDED
-
-#if !defined(JSON_IS_AMALGAMATION)
-# include "forwards.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-# include <string>
-# include <vector>
-
-# ifndef JSON_USE_CPPTL_SMALLMAP
-# include <map>
-# else
-# include <cpptl/smallmap.h>
-# endif
-# ifdef JSON_USE_CPPTL
-# include <cpptl/forwards.h>
-# endif
-
-/** \brief JSON (JavaScript Object Notation).
- */
-namespace Json {
-
- /** \brief Type of the value held by a Value object.
- */
- enum ValueType
- {
- nullValue = 0, ///< 'null' value
- intValue, ///< signed integer value
- uintValue, ///< unsigned integer value
- realValue, ///< double value
- stringValue, ///< UTF-8 string value
- booleanValue, ///< bool value
- arrayValue, ///< array value (ordered list)
- objectValue ///< object value (collection of name/value pairs).
- };
-
- enum CommentPlacement
- {
- commentBefore = 0, ///< a comment placed on the line before a value
- commentAfterOnSameLine, ///< a comment just after a value on the same line
- commentAfter, ///< a comment on the line after a value (only make sense for root value)
- numberOfCommentPlacement
- };
-
-//# ifdef JSON_USE_CPPTL
-// typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
-// typedef CppTL::AnyEnumerator<const Value &> EnumValues;
-//# endif
-
- /** \brief Lightweight wrapper to tag static string.
- *
- * Value constructor and objectValue member assignement takes advantage of the
- * StaticString and avoid the cost of string duplication when storing the
- * string or the member name.
- *
- * Example of usage:
- * \code
- * Json::Value aValue( StaticString("some text") );
- * Json::Value object;
- * static const StaticString code("code");
- * object[code] = 1234;
- * \endcode
- */
- class JSON_API StaticString
- {
- public:
- explicit StaticString( const char *czstring )
- : str_( czstring )
- {
- }
-
- operator const char *() const
- {
- return str_;
- }
-
- const char *c_str() const
- {
- return str_;
- }
-
- private:
- const char *str_;
- };
-
- /** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
- *
- * This class is a discriminated union wrapper that can represents a:
- * - signed integer [range: Value::minInt - Value::maxInt]
- * - unsigned integer (range: 0 - Value::maxUInt)
- * - double
- * - UTF-8 string
- * - boolean
- * - 'null'
- * - an ordered list of Value
- * - collection of name/value pairs (javascript object)
- *
- * The type of the held value is represented by a #ValueType and
- * can be obtained using type().
- *
- * values of an #objectValue or #arrayValue can be accessed using operator[]() methods.
- * Non const methods will automatically create the a #nullValue element
- * if it does not exist.
- * The sequence of an #arrayValue will be automatically resize and initialized
- * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue.
- *
- * The get() methods can be used to obtanis default value in the case the required element
- * does not exist.
- *
- * It is possible to iterate over the list of a #objectValue values using
- * the getMemberNames() method.
- */
- class JSON_API Value
- {
- friend class ValueIteratorBase;
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- friend class ValueInternalLink;
- friend class ValueInternalMap;
-# endif
- public:
- typedef std::vector<std::string> Members;
- typedef ValueIterator iterator;
- typedef ValueConstIterator const_iterator;
- typedef Json::UInt UInt;
- typedef Json::Int Int;
-# if defined(JSON_HAS_INT64)
- typedef Json::UInt64 UInt64;
- typedef Json::Int64 Int64;
-#endif // defined(JSON_HAS_INT64)
- typedef Json::LargestInt LargestInt;
- typedef Json::LargestUInt LargestUInt;
- typedef Json::ArrayIndex ArrayIndex;
-
- static const Value null;
- /// Minimum signed integer value that can be stored in a Json::Value.
- static const LargestInt minLargestInt;
- /// Maximum signed integer value that can be stored in a Json::Value.
- static const LargestInt maxLargestInt;
- /// Maximum unsigned integer value that can be stored in a Json::Value.
- static const LargestUInt maxLargestUInt;
-
- /// Minimum signed int value that can be stored in a Json::Value.
- static const Int minInt;
- /// Maximum signed int value that can be stored in a Json::Value.
- static const Int maxInt;
- /// Maximum unsigned int value that can be stored in a Json::Value.
- static const UInt maxUInt;
-
- /// Minimum signed 64 bits int value that can be stored in a Json::Value.
- static const Int64 minInt64;
- /// Maximum signed 64 bits int value that can be stored in a Json::Value.
- static const Int64 maxInt64;
- /// Maximum unsigned 64 bits int value that can be stored in a Json::Value.
- static const UInt64 maxUInt64;
-
- private:
-#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
-# ifndef JSON_VALUE_USE_INTERNAL_MAP
- class CZString
- {
- public:
- enum DuplicationPolicy
- {
- noDuplication = 0,
- duplicate,
- duplicateOnCopy
- };
- CZString( ArrayIndex index );
- CZString( const char *cstr, DuplicationPolicy allocate );
- CZString( const CZString &other );
- ~CZString();
- CZString &operator =( const CZString &other );
- bool operator<( const CZString &other ) const;
- bool operator==( const CZString &other ) const;
- ArrayIndex index() const;
- const char *c_str() const;
- bool isStaticString() const;
- private:
- void swap( CZString &other );
- const char *cstr_;
- ArrayIndex index_;
- };
-
- public:
-# ifndef JSON_USE_CPPTL_SMALLMAP
- typedef std::map<CZString, Value> ObjectValues;
-# else
- typedef CppTL::SmallMap<CZString, Value> ObjectValues;
-# endif // ifndef JSON_USE_CPPTL_SMALLMAP
-# endif // ifndef JSON_VALUE_USE_INTERNAL_MAP
-#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
-
- public:
- /** \brief Create a default Value of the given type.
-
- This is a very useful constructor.
- To create an empty array, pass arrayValue.
- To create an empty object, pass objectValue.
- Another Value can then be set to this one by assignment.
- This is useful since clear() and resize() will not alter types.
-
- Examples:
- \code
- Json::Value null_value; // null
- Json::Value arr_value(Json::arrayValue); // []
- Json::Value obj_value(Json::objectValue); // {}
- \endcode
- */
- Value( ValueType type = nullValue );
- Value( Int value );
- Value( UInt value );
-#if defined(JSON_HAS_INT64)
- Value( Int64 value );
- Value( UInt64 value );
-#endif // if defined(JSON_HAS_INT64)
- Value( double value );
- Value( const char *value );
- Value( const char *beginValue, const char *endValue );
- /** \brief Constructs a value from a static string.
-
- * Like other value string constructor but do not duplicate the string for
- * internal storage. The given string must remain alive after the call to this
- * constructor.
- * Example of usage:
- * \code
- * Json::Value aValue( StaticString("some text") );
- * \endcode
- */
- Value( const StaticString &value );
- Value( const std::string &value );
-# ifdef JSON_USE_CPPTL
- Value( const CppTL::ConstString &value );
-# endif
- Value( bool value );
- Value( const Value &other );
- ~Value();
-
- Value &operator=( const Value &other );
- /// Swap values.
- /// \note Currently, comments are intentionally not swapped, for
- /// both logic and efficiency.
- void swap( Value &other );
-
- ValueType type() const;
-
- bool operator <( const Value &other ) const;
- bool operator <=( const Value &other ) const;
- bool operator >=( const Value &other ) const;
- bool operator >( const Value &other ) const;
-
- bool operator ==( const Value &other ) const;
- bool operator !=( const Value &other ) const;
-
- int compare( const Value &other ) const;
-
- const char *asCString() const;
- std::string asString() const;
-# ifdef JSON_USE_CPPTL
- CppTL::ConstString asConstString() const;
-# endif
- Int asInt() const;
- UInt asUInt() const;
- Int64 asInt64() const;
- UInt64 asUInt64() const;
- LargestInt asLargestInt() const;
- LargestUInt asLargestUInt() const;
- float asFloat() const;
- double asDouble() const;
- bool asBool() const;
-
- bool isNull() const;
- bool isBool() const;
- bool isInt() const;
- bool isUInt() const;
- bool isIntegral() const;
- bool isDouble() const;
- bool isNumeric() const;
- bool isString() const;
- bool isArray() const;
- bool isObject() const;
-
- bool isConvertibleTo( ValueType other ) const;
-
- /// Number of values in array or object
- ArrayIndex size() const;
-
- /// \brief Return true if empty array, empty object, or null;
- /// otherwise, false.
- bool empty() const;
-
- /// Return isNull()
- bool operator!() const;
-
- /// Remove all object members and array elements.
- /// \pre type() is arrayValue, objectValue, or nullValue
- /// \post type() is unchanged
- void clear();
-
- /// Resize the array to size elements.
- /// New elements are initialized to null.
- /// May only be called on nullValue or arrayValue.
- /// \pre type() is arrayValue or nullValue
- /// \post type() is arrayValue
- void resize( ArrayIndex size );
-
- /// Access an array element (zero based index ).
- /// If the array contains less than index element, then null value are inserted
- /// in the array so that its size is index+1.
- /// (You may need to say 'value[0u]' to get your compiler to distinguish
- /// this from the operator[] which takes a string.)
- Value &operator[]( ArrayIndex index );
-
- /// Access an array element (zero based index ).
- /// If the array contains less than index element, then null value are inserted
- /// in the array so that its size is index+1.
- /// (You may need to say 'value[0u]' to get your compiler to distinguish
- /// this from the operator[] which takes a string.)
- Value &operator[]( int index );
-
- /// Access an array element (zero based index )
- /// (You may need to say 'value[0u]' to get your compiler to distinguish
- /// this from the operator[] which takes a string.)
- const Value &operator[]( ArrayIndex index ) const;
-
- /// Access an array element (zero based index )
- /// (You may need to say 'value[0u]' to get your compiler to distinguish
- /// this from the operator[] which takes a string.)
- const Value &operator[]( int index ) const;
-
- /// If the array contains at least index+1 elements, returns the element value,
- /// otherwise returns defaultValue.
- Value get( ArrayIndex index,
- const Value &defaultValue ) const;
- /// Return true if index < size().
- bool isValidIndex( ArrayIndex index ) const;
- /// \brief Append value to array at the end.
- ///
- /// Equivalent to jsonvalue[jsonvalue.size()] = value;
- Value &append( const Value &value );
-
- /// Access an object value by name, create a null member if it does not exist.
- Value &operator[]( const char *key );
- /// Access an object value by name, returns null if there is no member with that name.
- const Value &operator[]( const char *key ) const;
- /// Access an object value by name, create a null member if it does not exist.
- Value &operator[]( const std::string &key );
- /// Access an object value by name, returns null if there is no member with that name.
- const Value &operator[]( const std::string &key ) const;
- /** \brief Access an object value by name, create a null member if it does not exist.
-
- * If the object as no entry for that name, then the member name used to store
- * the new entry is not duplicated.
- * Example of use:
- * \code
- * Json::Value object;
- * static const StaticString code("code");
- * object[code] = 1234;
- * \endcode
- */
- Value &operator[]( const StaticString &key );
-# ifdef JSON_USE_CPPTL
- /// Access an object value by name, create a null member if it does not exist.
- Value &operator[]( const CppTL::ConstString &key );
- /// Access an object value by name, returns null if there is no member with that name.
- const Value &operator[]( const CppTL::ConstString &key ) const;
-# endif
- /// Return the member named key if it exist, defaultValue otherwise.
- Value get( const char *key,
- const Value &defaultValue ) const;
- /// Return the member named key if it exist, defaultValue otherwise.
- Value get( const std::string &key,
- const Value &defaultValue ) const;
-# ifdef JSON_USE_CPPTL
- /// Return the member named key if it exist, defaultValue otherwise.
- Value get( const CppTL::ConstString &key,
- const Value &defaultValue ) const;
-# endif
- /// \brief Remove and return the named member.
- ///
- /// Do nothing if it did not exist.
- /// \return the removed Value, or null.
- /// \pre type() is objectValue or nullValue
- /// \post type() is unchanged
- Value removeMember( const char* key );
- /// Same as removeMember(const char*)
- Value removeMember( const std::string &key );
-
- /// Return true if the object has a member named key.
- bool isMember( const char *key ) const;
- /// Return true if the object has a member named key.
- bool isMember( const std::string &key ) const;
-# ifdef JSON_USE_CPPTL
- /// Return true if the object has a member named key.
- bool isMember( const CppTL::ConstString &key ) const;
-# endif
-
- /// \brief Return a list of the member names.
- ///
- /// If null, return an empty list.
- /// \pre type() is objectValue or nullValue
- /// \post if type() was nullValue, it remains nullValue
- Members getMemberNames() const;
-
-//# ifdef JSON_USE_CPPTL
-// EnumMemberNames enumMemberNames() const;
-// EnumValues enumValues() const;
-//# endif
-
- /// Comments must be //... or /* ... */
- void setComment( const char *comment,
- CommentPlacement placement );
- /// Comments must be //... or /* ... */
- void setComment( const std::string &comment,
- CommentPlacement placement );
- bool hasComment( CommentPlacement placement ) const;
- /// Include delimiters and embedded newlines.
- std::string getComment( CommentPlacement placement ) const;
-
- std::string toStyledString() const;
-
- const_iterator begin() const;
- const_iterator end() const;
-
- iterator begin();
- iterator end();
-
- private:
- Value &resolveReference( const char *key,
- bool isStatic );
-
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- inline bool isItemAvailable() const
- {
- return itemIsUsed_ == 0;
- }
-
- inline void setItemUsed( bool isUsed = true )
- {
- itemIsUsed_ = isUsed ? 1 : 0;
- }
-
- inline bool isMemberNameStatic() const
- {
- return memberNameIsStatic_ == 0;
- }
-
- inline void setMemberNameIsStatic( bool isStatic )
- {
- memberNameIsStatic_ = isStatic ? 1 : 0;
- }
-# endif // # ifdef JSON_VALUE_USE_INTERNAL_MAP
-
- private:
- struct CommentInfo
- {
- CommentInfo();
- ~CommentInfo();
-
- void setComment( const char *text );
-
- char *comment_;
- };
-
- //struct MemberNamesTransform
- //{
- // typedef const char *result_type;
- // const char *operator()( const CZString &name ) const
- // {
- // return name.c_str();
- // }
- //};
-
- union ValueHolder
- {
- LargestInt int_;
- LargestUInt uint_;
- double real_;
- bool bool_;
- char *string_;
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- ValueInternalArray *array_;
- ValueInternalMap *map_;
-#else
- ObjectValues *map_;
-# endif
- } value_;
- ValueType type_ : 8;
- int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container.
- int memberNameIsStatic_ : 1; // used by the ValueInternalMap container.
-# endif
- CommentInfo *comments_;
- };
-
-
- /** \brief Experimental and untested: represents an element of the "path" to access a node.
- */
- class PathArgument
- {
- public:
- friend class Path;
-
- PathArgument();
- PathArgument( ArrayIndex index );
- PathArgument( const char *key );
- PathArgument( const std::string &key );
-
- private:
- enum Kind
- {
- kindNone = 0,
- kindIndex,
- kindKey
- };
- std::string key_;
- ArrayIndex index_;
- Kind kind_;
- };
-
- /** \brief Experimental and untested: represents a "path" to access a node.
- *
- * Syntax:
- * - "." => root node
- * - ".[n]" => elements at index 'n' of root node (an array value)
- * - ".name" => member named 'name' of root node (an object value)
- * - ".name1.name2.name3"
- * - ".[0][1][2].name1[3]"
- * - ".%" => member name is provided as parameter
- * - ".[%]" => index is provied as parameter
- */
- class Path
- {
- public:
- Path( const std::string &path,
- const PathArgument &a1 = PathArgument(),
- const PathArgument &a2 = PathArgument(),
- const PathArgument &a3 = PathArgument(),
- const PathArgument &a4 = PathArgument(),
- const PathArgument &a5 = PathArgument() );
-
- const Value &resolve( const Value &root ) const;
- Value resolve( const Value &root,
- const Value &defaultValue ) const;
- /// Creates the "path" to access the specified node and returns a reference on the node.
- Value &make( Value &root ) const;
-
- private:
- typedef std::vector<const PathArgument *> InArgs;
- typedef std::vector<PathArgument> Args;
-
- void makePath( const std::string &path,
- const InArgs &in );
- void addPathInArg( const std::string &path,
- const InArgs &in,
- InArgs::const_iterator &itInArg,
- PathArgument::Kind kind );
- void invalidPath( const std::string &path,
- int location );
-
- Args args_;
- };
-
-
-
-#ifdef JSON_VALUE_USE_INTERNAL_MAP
- /** \brief Allocator to customize Value internal map.
- * Below is an example of a simple implementation (default implementation actually
- * use memory pool for speed).
- * \code
- class DefaultValueMapAllocator : public ValueMapAllocator
- {
- public: // overridden from ValueMapAllocator
- virtual ValueInternalMap *newMap()
- {
- return new ValueInternalMap();
- }
-
- virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other )
- {
- return new ValueInternalMap( other );
- }
-
- virtual void destructMap( ValueInternalMap *map )
- {
- delete map;
- }
-
- virtual ValueInternalLink *allocateMapBuckets( unsigned int size )
- {
- return new ValueInternalLink[size];
- }
-
- virtual void releaseMapBuckets( ValueInternalLink *links )
- {
- delete [] links;
- }
-
- virtual ValueInternalLink *allocateMapLink()
- {
- return new ValueInternalLink();
- }
-
- virtual void releaseMapLink( ValueInternalLink *link )
- {
- delete link;
- }
- };
- * \endcode
- */
- class JSON_API ValueMapAllocator
- {
- public:
- virtual ~ValueMapAllocator();
- virtual ValueInternalMap *newMap() = 0;
- virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) = 0;
- virtual void destructMap( ValueInternalMap *map ) = 0;
- virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) = 0;
- virtual void releaseMapBuckets( ValueInternalLink *links ) = 0;
- virtual ValueInternalLink *allocateMapLink() = 0;
- virtual void releaseMapLink( ValueInternalLink *link ) = 0;
- };
-
- /** \brief ValueInternalMap hash-map bucket chain link (for internal use only).
- * \internal previous_ & next_ allows for bidirectional traversal.
- */
- class JSON_API ValueInternalLink
- {
- public:
- enum { itemPerLink = 6 }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture.
- enum InternalFlags {
- flagAvailable = 0,
- flagUsed = 1
- };
-
- ValueInternalLink();
-
- ~ValueInternalLink();
-
- Value items_[itemPerLink];
- char *keys_[itemPerLink];
- ValueInternalLink *previous_;
- ValueInternalLink *next_;
- };
-
-
- /** \brief A linked page based hash-table implementation used internally by Value.
- * \internal ValueInternalMap is a tradional bucket based hash-table, with a linked
- * list in each bucket to handle collision. There is an addional twist in that
- * each node of the collision linked list is a page containing a fixed amount of
- * value. This provides a better compromise between memory usage and speed.
- *
- * Each bucket is made up of a chained list of ValueInternalLink. The last
- * link of a given bucket can be found in the 'previous_' field of the following bucket.
- * The last link of the last bucket is stored in tailLink_ as it has no following bucket.
- * Only the last link of a bucket may contains 'available' item. The last link always
- * contains at least one element unless is it the bucket one very first link.
- */
- class JSON_API ValueInternalMap
- {
- friend class ValueIteratorBase;
- friend class Value;
- public:
- typedef unsigned int HashKey;
- typedef unsigned int BucketIndex;
-
-# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
- struct IteratorState
- {
- IteratorState()
- : map_(0)
- , link_(0)
- , itemIndex_(0)
- , bucketIndex_(0)
- {
- }
- ValueInternalMap *map_;
- ValueInternalLink *link_;
- BucketIndex itemIndex_;
- BucketIndex bucketIndex_;
- };
-# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
-
- ValueInternalMap();
- ValueInternalMap( const ValueInternalMap &other );
- ValueInternalMap &operator =( const ValueInternalMap &other );
- ~ValueInternalMap();
-
- void swap( ValueInternalMap &other );
-
- BucketIndex size() const;
-
- void clear();
-
- bool reserveDelta( BucketIndex growth );
-
- bool reserve( BucketIndex newItemCount );
-
- const Value *find( const char *key ) const;
-
- Value *find( const char *key );
-
- Value &resolveReference( const char *key,
- bool isStatic );
-
- void remove( const char *key );
-
- void doActualRemove( ValueInternalLink *link,
- BucketIndex index,
- BucketIndex bucketIndex );
-
- ValueInternalLink *&getLastLinkInBucket( BucketIndex bucketIndex );
-
- Value &setNewItem( const char *key,
- bool isStatic,
- ValueInternalLink *link,
- BucketIndex index );
-
- Value &unsafeAdd( const char *key,
- bool isStatic,
- HashKey hashedKey );
-
- HashKey hash( const char *key ) const;
-
- int compare( const ValueInternalMap &other ) const;
-
- private:
- void makeBeginIterator( IteratorState &it ) const;
- void makeEndIterator( IteratorState &it ) const;
- static bool equals( const IteratorState &x, const IteratorState &other );
- static void increment( IteratorState &iterator );
- static void incrementBucket( IteratorState &iterator );
- static void decrement( IteratorState &iterator );
- static const char *key( const IteratorState &iterator );
- static const char *key( const IteratorState &iterator, bool &isStatic );
- static Value &value( const IteratorState &iterator );
- static int distance( const IteratorState &x, const IteratorState &y );
-
- private:
- ValueInternalLink *buckets_;
- ValueInternalLink *tailLink_;
- BucketIndex bucketsSize_;
- BucketIndex itemCount_;
- };
-
- /** \brief A simplified deque implementation used internally by Value.
- * \internal
- * It is based on a list of fixed "page", each page contains a fixed number of items.
- * Instead of using a linked-list, a array of pointer is used for fast item look-up.
- * Look-up for an element is as follow:
- * - compute page index: pageIndex = itemIndex / itemsPerPage
- * - look-up item in page: pages_[pageIndex][itemIndex % itemsPerPage]
- *
- * Insertion is amortized constant time (only the array containing the index of pointers
- * need to be reallocated when items are appended).
- */
- class JSON_API ValueInternalArray
- {
- friend class Value;
- friend class ValueIteratorBase;
- public:
- enum { itemsPerPage = 8 }; // should be a power of 2 for fast divide and modulo.
- typedef Value::ArrayIndex ArrayIndex;
- typedef unsigned int PageIndex;
-
-# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
- struct IteratorState // Must be a POD
- {
- IteratorState()
- : array_(0)
- , currentPageIndex_(0)
- , currentItemIndex_(0)
- {
- }
- ValueInternalArray *array_;
- Value **currentPageIndex_;
- unsigned int currentItemIndex_;
- };
-# endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
-
- ValueInternalArray();
- ValueInternalArray( const ValueInternalArray &other );
- ValueInternalArray &operator =( const ValueInternalArray &other );
- ~ValueInternalArray();
- void swap( ValueInternalArray &other );
-
- void clear();
- void resize( ArrayIndex newSize );
-
- Value &resolveReference( ArrayIndex index );
-
- Value *find( ArrayIndex index ) const;
-
- ArrayIndex size() const;
-
- int compare( const ValueInternalArray &other ) const;
-
- private:
- static bool equals( const IteratorState &x, const IteratorState &other );
- static void increment( IteratorState &iterator );
- static void decrement( IteratorState &iterator );
- static Value &dereference( const IteratorState &iterator );
- static Value &unsafeDereference( const IteratorState &iterator );
- static int distance( const IteratorState &x, const IteratorState &y );
- static ArrayIndex indexOf( const IteratorState &iterator );
- void makeBeginIterator( IteratorState &it ) const;
- void makeEndIterator( IteratorState &it ) const;
- void makeIterator( IteratorState &it, ArrayIndex index ) const;
-
- void makeIndexValid( ArrayIndex index );
-
- Value **pages_;
- ArrayIndex size_;
- PageIndex pageCount_;
- };
-
- /** \brief Experimental: do not use. Allocator to customize Value internal array.
- * Below is an example of a simple implementation (actual implementation use
- * memory pool).
- \code
-class DefaultValueArrayAllocator : public ValueArrayAllocator
-{
-public: // overridden from ValueArrayAllocator
- virtual ~DefaultValueArrayAllocator()
- {
- }
-
- virtual ValueInternalArray *newArray()
- {
- return new ValueInternalArray();
- }
-
- virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other )
- {
- return new ValueInternalArray( other );
- }
-
- virtual void destruct( ValueInternalArray *array )
- {
- delete array;
- }
-
- virtual void reallocateArrayPageIndex( Value **&indexes,
- ValueInternalArray::PageIndex &indexCount,
- ValueInternalArray::PageIndex minNewIndexCount )
- {
- ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1;
- if ( minNewIndexCount > newIndexCount )
- newIndexCount = minNewIndexCount;
- void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
- if ( !newIndexes )
- throw std::bad_alloc();
- indexCount = newIndexCount;
- indexes = static_cast<Value **>( newIndexes );
- }
- virtual void releaseArrayPageIndex( Value **indexes,
- ValueInternalArray::PageIndex indexCount )
- {
- if ( indexes )
- free( indexes );
- }
-
- virtual Value *allocateArrayPage()
- {
- return static_cast<Value *>( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) );
- }
-
- virtual void releaseArrayPage( Value *value )
- {
- if ( value )
- free( value );
- }
-};
- \endcode
- */
- class JSON_API ValueArrayAllocator
- {
- public:
- virtual ~ValueArrayAllocator();
- virtual ValueInternalArray *newArray() = 0;
- virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) = 0;
- virtual void destructArray( ValueInternalArray *array ) = 0;
- /** \brief Reallocate array page index.
- * Reallocates an array of pointer on each page.
- * \param indexes [input] pointer on the current index. May be \c NULL.
- * [output] pointer on the new index of at least
- * \a minNewIndexCount pages.
- * \param indexCount [input] current number of pages in the index.
- * [output] number of page the reallocated index can handle.
- * \b MUST be >= \a minNewIndexCount.
- * \param minNewIndexCount Minimum number of page the new index must be able to
- * handle.
- */
- virtual void reallocateArrayPageIndex( Value **&indexes,
- ValueInternalArray::PageIndex &indexCount,
- ValueInternalArray::PageIndex minNewIndexCount ) = 0;
- virtual void releaseArrayPageIndex( Value **indexes,
- ValueInternalArray::PageIndex indexCount ) = 0;
- virtual Value *allocateArrayPage() = 0;
- virtual void releaseArrayPage( Value *value ) = 0;
- };
-#endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
-
-
- /** \brief base class for Value iterators.
- *
- */
- class ValueIteratorBase
- {
- public:
- typedef unsigned int size_t;
- typedef int difference_type;
- typedef ValueIteratorBase SelfType;
-
- ValueIteratorBase();
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- explicit ValueIteratorBase( const Value::ObjectValues::iterator &current );
-#else
- ValueIteratorBase( const ValueInternalArray::IteratorState &state );
- ValueIteratorBase( const ValueInternalMap::IteratorState &state );
-#endif
-
- bool operator ==( const SelfType &other ) const
- {
- return isEqual( other );
- }
-
- bool operator !=( const SelfType &other ) const
- {
- return !isEqual( other );
- }
-
- difference_type operator -( const SelfType &other ) const
- {
- return computeDistance( other );
- }
-
- /// Return either the index or the member name of the referenced value as a Value.
- Value key() const;
-
- /// Return the index of the referenced Value. -1 if it is not an arrayValue.
- UInt index() const;
-
- /// Return the member name of the referenced Value. "" if it is not an objectValue.
- const char *memberName() const;
-
- protected:
- Value &deref() const;
-
- void increment();
-
- void decrement();
-
- difference_type computeDistance( const SelfType &other ) const;
-
- bool isEqual( const SelfType &other ) const;
-
- void copy( const SelfType &other );
-
- private:
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- Value::ObjectValues::iterator current_;
- // Indicates that iterator is for a null value.
- bool isNull_;
-#else
- union
- {
- ValueInternalArray::IteratorState array_;
- ValueInternalMap::IteratorState map_;
- } iterator_;
- bool isArray_;
-#endif
- };
-
- /** \brief const iterator for object and array value.
- *
- */
- class ValueConstIterator : public ValueIteratorBase
- {
- friend class Value;
- public:
- typedef unsigned int size_t;
- typedef int difference_type;
- typedef const Value &reference;
- typedef const Value *pointer;
- typedef ValueConstIterator SelfType;
-
- ValueConstIterator();
- private:
- /*! \internal Use by Value to create an iterator.
- */
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- explicit ValueConstIterator( const Value::ObjectValues::iterator &current );
-#else
- ValueConstIterator( const ValueInternalArray::IteratorState &state );
- ValueConstIterator( const ValueInternalMap::IteratorState &state );
-#endif
- public:
- SelfType &operator =( const ValueIteratorBase &other );
-
- SelfType operator++( int )
- {
- SelfType temp( *this );
- ++*this;
- return temp;
- }
-
- SelfType operator--( int )
- {
- SelfType temp( *this );
- --*this;
- return temp;
- }
-
- SelfType &operator--()
- {
- decrement();
- return *this;
- }
-
- SelfType &operator++()
- {
- increment();
- return *this;
- }
-
- reference operator *() const
- {
- return deref();
- }
- };
-
-
- /** \brief Iterator for object and array value.
- */
- class ValueIterator : public ValueIteratorBase
- {
- friend class Value;
- public:
- typedef unsigned int size_t;
- typedef int difference_type;
- typedef Value &reference;
- typedef Value *pointer;
- typedef ValueIterator SelfType;
-
- ValueIterator();
- ValueIterator( const ValueConstIterator &other );
- ValueIterator( const ValueIterator &other );
- private:
- /*! \internal Use by Value to create an iterator.
- */
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- explicit ValueIterator( const Value::ObjectValues::iterator &current );
-#else
- ValueIterator( const ValueInternalArray::IteratorState &state );
- ValueIterator( const ValueInternalMap::IteratorState &state );
-#endif
- public:
-
- SelfType &operator =( const SelfType &other );
-
- SelfType operator++( int )
- {
- SelfType temp( *this );
- ++*this;
- return temp;
- }
-
- SelfType operator--( int )
- {
- SelfType temp( *this );
- --*this;
- return temp;
- }
-
- SelfType &operator--()
- {
- decrement();
- return *this;
- }
-
- SelfType &operator++()
- {
- increment();
- return *this;
- }
-
- reference operator *() const
- {
- return deref();
- }
- };
-
-
-} // namespace Json
-
-
-#endif // CPPTL_JSON_H_INCLUDED
diff --git a/src/3rd_party-static/jsoncpp/include/json/writer.h b/src/3rd_party-static/jsoncpp/include/json/writer.h
deleted file mode 100644
index 478936365a..0000000000
--- a/src/3rd_party-static/jsoncpp/include/json/writer.h
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSON_WRITER_H_INCLUDED
-# define JSON_WRITER_H_INCLUDED
-
-#if !defined(JSON_IS_AMALGAMATION)
-# include "value.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-# include <vector>
-# include <string>
-# include <iostream>
-
-namespace Json {
-
- class Value;
-
- /** \brief Abstract class for writers.
- */
- class JSON_API Writer
- {
- public:
- virtual ~Writer();
-
- virtual std::string write( const Value &root ) = 0;
- };
-
- /** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format without formatting (not human friendly).
- *
- * The JSON document is written in a single line. It is not intended for 'human' consumption,
- * but may be usefull to support feature such as RPC where bandwith is limited.
- * \sa Reader, Value
- */
- class JSON_API FastWriter : public Writer
- {
- public:
- FastWriter();
- virtual ~FastWriter(){}
-
- void enableYAMLCompatibility();
-
- public: // overridden from Writer
- virtual std::string write( const Value &root );
-
- private:
- void writeValue( const Value &value );
-
- std::string document_;
- bool yamlCompatiblityEnabled_;
- };
-
- /** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way.
- *
- * The rules for line break and indent are as follow:
- * - Object value:
- * - if empty then print {} without indent and line break
- * - if not empty the print '{', line break & indent, print one value per line
- * and then unindent and line break and print '}'.
- * - Array value:
- * - if empty then print [] without indent and line break
- * - if the array contains no object value, empty array or some other value types,
- * and all the values fit on one lines, then print the array on a single line.
- * - otherwise, it the values do not fit on one line, or the array contains
- * object or non empty array, then print one value per line.
- *
- * If the Value have comments then they are outputed according to their #CommentPlacement.
- *
- * \sa Reader, Value, Value::setComment()
- */
- class JSON_API StyledWriter: public Writer
- {
- public:
- StyledWriter();
- virtual ~StyledWriter(){}
-
- public: // overridden from Writer
- /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
- * \param root Value to serialize.
- * \return String containing the JSON document that represents the root value.
- */
- virtual std::string write( const Value &root );
-
- private:
- void writeValue( const Value &value );
- void writeArrayValue( const Value &value );
- bool isMultineArray( const Value &value );
- void pushValue( const std::string &value );
- void writeIndent();
- void writeWithIndent( const std::string &value );
- void indent();
- void unindent();
- void writeCommentBeforeValue( const Value &root );
- void writeCommentAfterValueOnSameLine( const Value &root );
- bool hasCommentForValue( const Value &value );
- static std::string normalizeEOL( const std::string &text );
-
- typedef std::vector<std::string> ChildValues;
-
- ChildValues childValues_;
- std::string document_;
- std::string indentString_;
- int rightMargin_;
- int indentSize_;
- bool addChildValues_;
- };
-
- /** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a human friendly way,
- to a stream rather than to a string.
- *
- * The rules for line break and indent are as follow:
- * - Object value:
- * - if empty then print {} without indent and line break
- * - if not empty the print '{', line break & indent, print one value per line
- * and then unindent and line break and print '}'.
- * - Array value:
- * - if empty then print [] without indent and line break
- * - if the array contains no object value, empty array or some other value types,
- * and all the values fit on one lines, then print the array on a single line.
- * - otherwise, it the values do not fit on one line, or the array contains
- * object or non empty array, then print one value per line.
- *
- * If the Value have comments then they are outputed according to their #CommentPlacement.
- *
- * \param indentation Each level will be indented by this amount extra.
- * \sa Reader, Value, Value::setComment()
- */
- class JSON_API StyledStreamWriter
- {
- public:
- StyledStreamWriter( std::string indentation="\t" );
- ~StyledStreamWriter(){}
-
- public:
- /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
- * \param out Stream to write to. (Can be ostringstream, e.g.)
- * \param root Value to serialize.
- * \note There is no point in deriving from Writer, since write() should not return a value.
- */
- void write( std::ostream &out, const Value &root );
-
- private:
- void writeValue( const Value &value );
- void writeArrayValue( const Value &value );
- bool isMultineArray( const Value &value );
- void pushValue( const std::string &value );
- void writeIndent();
- void writeWithIndent( const std::string &value );
- void indent();
- void unindent();
- void writeCommentBeforeValue( const Value &root );
- void writeCommentAfterValueOnSameLine( const Value &root );
- bool hasCommentForValue( const Value &value );
- static std::string normalizeEOL( const std::string &text );
-
- typedef std::vector<std::string> ChildValues;
-
- ChildValues childValues_;
- std::ostream* document_;
- std::string indentString_;
- int rightMargin_;
- std::string indentation_;
- bool addChildValues_;
- };
-
-# if defined(JSON_HAS_INT64)
- std::string JSON_API valueToString( Int value );
- std::string JSON_API valueToString( UInt value );
-# endif // if defined(JSON_HAS_INT64)
- std::string JSON_API valueToString( LargestInt value );
- std::string JSON_API valueToString( LargestUInt value );
- std::string JSON_API valueToString( double value );
- std::string JSON_API valueToString( bool value );
- std::string JSON_API valueToQuotedString( const char *value );
-
- /// \brief Output using the StyledStreamWriter.
- /// \see Json::operator>>()
- std::ostream& operator<<( std::ostream&, const Value &root );
-
-} // namespace Json
-
-
-
-#endif // JSON_WRITER_H_INCLUDED
diff --git a/src/3rd_party-static/jsoncpp/makefiles/vs71/jsoncpp.sln b/src/3rd_party-static/jsoncpp/makefiles/vs71/jsoncpp.sln
deleted file mode 100644
index 5bfa366547..0000000000
--- a/src/3rd_party-static/jsoncpp/makefiles/vs71/jsoncpp.sln
+++ /dev/null
@@ -1,46 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lib_json", "lib_json.vcproj", "{B84F7231-16CE-41D8-8C08-7B523FF4225B}"
- ProjectSection(ProjectDependencies) = postProject
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jsontest", "jsontest.vcproj", "{25AF2DD2-D396-4668-B188-488C33B8E620}"
- ProjectSection(ProjectDependencies) = postProject
- {B84F7231-16CE-41D8-8C08-7B523FF4225B} = {B84F7231-16CE-41D8-8C08-7B523FF4225B}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_lib_json", "test_lib_json.vcproj", "{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}"
- ProjectSection(ProjectDependencies) = postProject
- {B84F7231-16CE-41D8-8C08-7B523FF4225B} = {B84F7231-16CE-41D8-8C08-7B523FF4225B}
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfiguration) = preSolution
- Debug = Debug
- dummy = dummy
- Release = Release
- EndGlobalSection
- GlobalSection(ProjectConfiguration) = postSolution
- {B84F7231-16CE-41D8-8C08-7B523FF4225B}.Debug.ActiveCfg = Debug|Win32
- {B84F7231-16CE-41D8-8C08-7B523FF4225B}.Debug.Build.0 = Debug|Win32
- {B84F7231-16CE-41D8-8C08-7B523FF4225B}.dummy.ActiveCfg = dummy|Win32
- {B84F7231-16CE-41D8-8C08-7B523FF4225B}.dummy.Build.0 = dummy|Win32
- {B84F7231-16CE-41D8-8C08-7B523FF4225B}.Release.ActiveCfg = Release|Win32
- {B84F7231-16CE-41D8-8C08-7B523FF4225B}.Release.Build.0 = Release|Win32
- {25AF2DD2-D396-4668-B188-488C33B8E620}.Debug.ActiveCfg = Debug|Win32
- {25AF2DD2-D396-4668-B188-488C33B8E620}.Debug.Build.0 = Debug|Win32
- {25AF2DD2-D396-4668-B188-488C33B8E620}.dummy.ActiveCfg = Debug|Win32
- {25AF2DD2-D396-4668-B188-488C33B8E620}.dummy.Build.0 = Debug|Win32
- {25AF2DD2-D396-4668-B188-488C33B8E620}.Release.ActiveCfg = Release|Win32
- {25AF2DD2-D396-4668-B188-488C33B8E620}.Release.Build.0 = Release|Win32
- {B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Debug.ActiveCfg = Debug|Win32
- {B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Debug.Build.0 = Debug|Win32
- {B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.dummy.ActiveCfg = Debug|Win32
- {B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.dummy.Build.0 = Debug|Win32
- {B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Release.ActiveCfg = Release|Win32
- {B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}.Release.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- EndGlobalSection
- GlobalSection(ExtensibilityAddIns) = postSolution
- EndGlobalSection
-EndGlobal
diff --git a/src/3rd_party-static/jsoncpp/makefiles/vs71/jsontest.vcproj b/src/3rd_party-static/jsoncpp/makefiles/vs71/jsontest.vcproj
deleted file mode 100644
index 99a4dd6971..0000000000
--- a/src/3rd_party-static/jsoncpp/makefiles/vs71/jsontest.vcproj
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="jsontest"
- ProjectGUID="{25AF2DD2-D396-4668-B188-488C33B8E620}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../build/vs71/debug/jsontest"
- IntermediateDirectory="../../build/vs71/debug/jsontest"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/jsontest.exe"
- LinkIncremental="2"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/jsontest.pdb"
- SubSystem="1"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../build/vs71/release/jsontest"
- IntermediateDirectory="../../build/vs71/release/jsontest"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/jsontest.exe"
- LinkIncremental="1"
- GenerateDebugInformation="TRUE"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="..\..\src\jsontestrunner\main.cpp">
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/src/3rd_party-static/jsoncpp/makefiles/vs71/lib_json.vcproj b/src/3rd_party-static/jsoncpp/makefiles/vs71/lib_json.vcproj
deleted file mode 100644
index 2d7bf99164..0000000000
--- a/src/3rd_party-static/jsoncpp/makefiles/vs71/lib_json.vcproj
+++ /dev/null
@@ -1,214 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="lib_json"
- ProjectGUID="{B84F7231-16CE-41D8-8C08-7B523FF4225B}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../build/vs71/debug/lib_json"
- IntermediateDirectory="../../build/vs71/debug/lib_json"
- ConfigurationType="4"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
- StringPooling="TRUE"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- EnableFunctionLevelLinking="TRUE"
- DisableLanguageExtensions="TRUE"
- ForceConformanceInForLoopScope="FALSE"
- RuntimeTypeInfo="TRUE"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)/json_vc71_libmtd.lib"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../build/vs71/release/lib_json"
- IntermediateDirectory="../../build/vs71/release/lib_json"
- ConfigurationType="4"
- CharacterSet="2"
- WholeProgramOptimization="TRUE">
- <Tool
- Name="VCCLCompilerTool"
- GlobalOptimizations="TRUE"
- EnableIntrinsicFunctions="TRUE"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- StringPooling="TRUE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="TRUE"
- DisableLanguageExtensions="TRUE"
- ForceConformanceInForLoopScope="FALSE"
- RuntimeTypeInfo="TRUE"
- UsePrecompiledHeader="0"
- AssemblerOutput="4"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLibrarianTool"
- OutputFile="$(OutDir)/json_vc71_libmt.lib"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="dummy|Win32"
- OutputDirectory="$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="2"
- WholeProgramOptimization="TRUE">
- <Tool
- Name="VCCLCompilerTool"
- GlobalOptimizations="TRUE"
- EnableIntrinsicFunctions="TRUE"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
- StringPooling="TRUE"
- RuntimeLibrary="4"
- EnableFunctionLevelLinking="TRUE"
- DisableLanguageExtensions="TRUE"
- ForceConformanceInForLoopScope="FALSE"
- RuntimeTypeInfo="TRUE"
- UsePrecompiledHeader="0"
- AssemblerOutput="4"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="..\..\include\json\autolink.h">
- </File>
- <File
- RelativePath="..\..\include\json\config.h">
- </File>
- <File
- RelativePath="..\..\include\json\features.h">
- </File>
- <File
- RelativePath="..\..\include\json\forwards.h">
- </File>
- <File
- RelativePath="..\..\include\json\json.h">
- </File>
- <File
- RelativePath="..\..\src\lib_json\json_batchallocator.h">
- </File>
- <File
- RelativePath="..\..\src\lib_json\json_internalarray.inl">
- </File>
- <File
- RelativePath="..\..\src\lib_json\json_internalmap.inl">
- </File>
- <File
- RelativePath="..\..\src\lib_json\json_reader.cpp">
- </File>
- <File
- RelativePath="..\..\src\lib_json\json_value.cpp">
- </File>
- <File
- RelativePath="..\..\src\lib_json\json_valueiterator.inl">
- </File>
- <File
- RelativePath="..\..\src\lib_json\json_writer.cpp">
- </File>
- <File
- RelativePath="..\..\include\json\reader.h">
- </File>
- <File
- RelativePath="..\..\include\json\value.h">
- </File>
- <File
- RelativePath="..\..\include\json\writer.h">
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/src/3rd_party-static/jsoncpp/makefiles/vs71/test_lib_json.vcproj b/src/3rd_party-static/jsoncpp/makefiles/vs71/test_lib_json.vcproj
deleted file mode 100644
index df36700bdc..0000000000
--- a/src/3rd_party-static/jsoncpp/makefiles/vs71/test_lib_json.vcproj
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="test_lib_json"
- ProjectGUID="{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}"
- RootNamespace="test_lib_json"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../build/vs71/debug/test_lib_json"
- IntermediateDirectory="../../build/vs71/debug/test_lib_json"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/test_lib_json.exe"
- LinkIncremental="2"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/test_lib_json.pdb"
- SubSystem="1"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- Description="Running all unit tests"
- CommandLine="$(TargetPath)"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../build/vs71/release/test_lib_json"
- IntermediateDirectory="../../build/vs71/release/test_lib_json"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="0"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- OutputFile="$(OutDir)/test_lib_json.exe"
- LinkIncremental="1"
- GenerateDebugInformation="TRUE"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- Description="Running all unit tests"
- CommandLine="$(TargetPath)"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath="..\..\src\test_lib_json\jsontest.cpp">
- </File>
- <File
- RelativePath="..\..\src\test_lib_json\jsontest.h">
- </File>
- <File
- RelativePath="..\..\src\test_lib_json\main.cpp">
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
diff --git a/src/3rd_party-static/jsoncpp/makerelease.py b/src/3rd_party-static/jsoncpp/makerelease.py
deleted file mode 100644
index 6b8eec3070..0000000000
--- a/src/3rd_party-static/jsoncpp/makerelease.py
+++ /dev/null
@@ -1,380 +0,0 @@
-"""Tag the sandbox for release, make source and doc tarballs.
-
-Requires Python 2.6
-
-Example of invocation (use to test the script):
-python makerelease.py --platform=msvc6,msvc71,msvc80,msvc90,mingw -ublep 0.6.0 0.7.0-dev
-
-When testing this script:
-python makerelease.py --force --retag --platform=msvc6,msvc71,msvc80,mingw -ublep test-0.6.0 test-0.6.1-dev
-
-Example of invocation when doing a release:
-python makerelease.py 0.5.0 0.6.0-dev
-"""
-import os.path
-import subprocess
-import sys
-import doxybuild
-import subprocess
-import xml.etree.ElementTree as ElementTree
-import shutil
-import urllib2
-import tempfile
-import os
-import time
-from devtools import antglob, fixeol, tarball
-import amalgamate
-
-SVN_ROOT = 'https://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/'
-SVN_TAG_ROOT = SVN_ROOT + 'tags/jsoncpp'
-SCONS_LOCAL_URL = 'http://sourceforge.net/projects/scons/files/scons-local/1.2.0/scons-local-1.2.0.tar.gz/download'
-SOURCEFORGE_PROJECT = 'jsoncpp'
-
-def set_version( version ):
- with open('version','wb') as f:
- f.write( version.strip() )
-
-def rmdir_if_exist( dir_path ):
- if os.path.isdir( dir_path ):
- shutil.rmtree( dir_path )
-
-class SVNError(Exception):
- pass
-
-def svn_command( command, *args ):
- cmd = ['svn', '--non-interactive', command] + list(args)
- print 'Running:', ' '.join( cmd )
- process = subprocess.Popen( cmd,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT )
- stdout = process.communicate()[0]
- if process.returncode:
- error = SVNError( 'SVN command failed:\n' + stdout )
- error.returncode = process.returncode
- raise error
- return stdout
-
-def check_no_pending_commit():
- """Checks that there is no pending commit in the sandbox."""
- stdout = svn_command( 'status', '--xml' )
- etree = ElementTree.fromstring( stdout )
- msg = []
- for entry in etree.getiterator( 'entry' ):
- path = entry.get('path')
- status = entry.find('wc-status').get('item')
- if status != 'unversioned' and path != 'version':
- msg.append( 'File "%s" has pending change (status="%s")' % (path, status) )
- if msg:
- msg.insert(0, 'Pending change to commit found in sandbox. Commit them first!' )
- return '\n'.join( msg )
-
-def svn_join_url( base_url, suffix ):
- if not base_url.endswith('/'):
- base_url += '/'
- if suffix.startswith('/'):
- suffix = suffix[1:]
- return base_url + suffix
-
-def svn_check_if_tag_exist( tag_url ):
- """Checks if a tag exist.
- Returns: True if the tag exist, False otherwise.
- """
- try:
- list_stdout = svn_command( 'list', tag_url )
- except SVNError, e:
- if e.returncode != 1 or not str(e).find('tag_url'):
- raise e
- # otherwise ignore error, meaning tag does not exist
- return False
- return True
-
-def svn_commit( message ):
- """Commit the sandbox, providing the specified comment.
- """
- svn_command( 'ci', '-m', message )
-
-def svn_tag_sandbox( tag_url, message ):
- """Makes a tag based on the sandbox revisions.
- """
- svn_command( 'copy', '-m', message, '.', tag_url )
-
-def svn_remove_tag( tag_url, message ):
- """Removes an existing tag.
- """
- svn_command( 'delete', '-m', message, tag_url )
-
-def svn_export( tag_url, export_dir ):
- """Exports the tag_url revision to export_dir.
- Target directory, including its parent is created if it does not exist.
- If the directory export_dir exist, it is deleted before export proceed.
- """
- rmdir_if_exist( export_dir )
- svn_command( 'export', tag_url, export_dir )
-
-def fix_sources_eol( dist_dir ):
- """Set file EOL for tarball distribution.
- """
- print 'Preparing exported source file EOL for distribution...'
- prune_dirs = antglob.prune_dirs + 'scons-local* ./build* ./libs ./dist'
- win_sources = antglob.glob( dist_dir,
- includes = '**/*.sln **/*.vcproj',
- prune_dirs = prune_dirs )
- unix_sources = antglob.glob( dist_dir,
- includes = '''**/*.h **/*.cpp **/*.inl **/*.txt **/*.dox **/*.py **/*.html **/*.in
- sconscript *.json *.expected AUTHORS LICENSE''',
- excludes = antglob.default_excludes + 'scons.py sconsign.py scons-*',
- prune_dirs = prune_dirs )
- for path in win_sources:
- fixeol.fix_source_eol( path, is_dry_run = False, verbose = True, eol = '\r\n' )
- for path in unix_sources:
- fixeol.fix_source_eol( path, is_dry_run = False, verbose = True, eol = '\n' )
-
-def download( url, target_path ):
- """Download file represented by url to target_path.
- """
- f = urllib2.urlopen( url )
- try:
- data = f.read()
- finally:
- f.close()
- fout = open( target_path, 'wb' )
- try:
- fout.write( data )
- finally:
- fout.close()
-
-def check_compile( distcheck_top_dir, platform ):
- cmd = [sys.executable, 'scons.py', 'platform=%s' % platform, 'check']
- print 'Running:', ' '.join( cmd )
- log_path = os.path.join( distcheck_top_dir, 'build-%s.log' % platform )
- flog = open( log_path, 'wb' )
- try:
- process = subprocess.Popen( cmd,
- stdout=flog,
- stderr=subprocess.STDOUT,
- cwd=distcheck_top_dir )
- stdout = process.communicate()[0]
- status = (process.returncode == 0)
- finally:
- flog.close()
- return (status, log_path)
-
-def write_tempfile( content, **kwargs ):
- fd, path = tempfile.mkstemp( **kwargs )
- f = os.fdopen( fd, 'wt' )
- try:
- f.write( content )
- finally:
- f.close()
- return path
-
-class SFTPError(Exception):
- pass
-
-def run_sftp_batch( userhost, sftp, batch, retry=0 ):
- path = write_tempfile( batch, suffix='.sftp', text=True )
- # psftp -agent -C blep,jsoncpp@web.sourceforge.net -batch -b batch.sftp -bc
- cmd = [sftp, '-agent', '-C', '-batch', '-b', path, '-bc', userhost]
- error = None
- for retry_index in xrange(0, max(1,retry)):
- heading = retry_index == 0 and 'Running:' or 'Retrying:'
- print heading, ' '.join( cmd )
- process = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
- stdout = process.communicate()[0]
- if process.returncode != 0:
- error = SFTPError( 'SFTP batch failed:\n' + stdout )
- else:
- break
- if error:
- raise error
- return stdout
-
-def sourceforge_web_synchro( sourceforge_project, doc_dir,
- user=None, sftp='sftp' ):
- """Notes: does not synchronize sub-directory of doc-dir.
- """
- userhost = '%s,%s@web.sourceforge.net' % (user, sourceforge_project)
- stdout = run_sftp_batch( userhost, sftp, """
-cd htdocs
-dir
-exit
-""" )
- existing_paths = set()
- collect = 0
- for line in stdout.split('\n'):
- line = line.strip()
- if not collect and line.endswith('> dir'):
- collect = True
- elif collect and line.endswith('> exit'):
- break
- elif collect == 1:
- collect = 2
- elif collect == 2:
- path = line.strip().split()[-1:]
- if path and path[0] not in ('.', '..'):
- existing_paths.add( path[0] )
- upload_paths = set( [os.path.basename(p) for p in antglob.glob( doc_dir )] )
- paths_to_remove = existing_paths - upload_paths
- if paths_to_remove:
- print 'Removing the following file from web:'
- print '\n'.join( paths_to_remove )
- stdout = run_sftp_batch( userhost, sftp, """cd htdocs
-rm %s
-exit""" % ' '.join(paths_to_remove) )
- print 'Uploading %d files:' % len(upload_paths)
- batch_size = 10
- upload_paths = list(upload_paths)
- start_time = time.time()
- for index in xrange(0,len(upload_paths),batch_size):
- paths = upload_paths[index:index+batch_size]
- file_per_sec = (time.time() - start_time) / (index+1)
- remaining_files = len(upload_paths) - index
- remaining_sec = file_per_sec * remaining_files
- print '%d/%d, ETA=%.1fs' % (index+1, len(upload_paths), remaining_sec)
- run_sftp_batch( userhost, sftp, """cd htdocs
-lcd %s
-mput %s
-exit""" % (doc_dir, ' '.join(paths) ), retry=3 )
-
-def sourceforge_release_tarball( sourceforge_project, paths, user=None, sftp='sftp' ):
- userhost = '%s,%s@frs.sourceforge.net' % (user, sourceforge_project)
- run_sftp_batch( userhost, sftp, """
-mput %s
-exit
-""" % (' '.join(paths),) )
-
-
-def main():
- usage = """%prog release_version next_dev_version
-Update 'version' file to release_version and commit.
-Generates the document tarball.
-Tags the sandbox revision with release_version.
-Update 'version' file to next_dev_version and commit.
-
-Performs an svn export of tag release version, and build a source tarball.
-
-Must be started in the project top directory.
-
-Warning: --force should only be used when developping/testing the release script.
-"""
- from optparse import OptionParser
- parser = OptionParser(usage=usage)
- parser.allow_interspersed_args = False
- parser.add_option('--dot', dest="dot_path", action='store', default=doxybuild.find_program('dot'),
- help="""Path to GraphViz dot tool. Must be full qualified path. [Default: %default]""")
- parser.add_option('--doxygen', dest="doxygen_path", action='store', default=doxybuild.find_program('doxygen'),
- help="""Path to Doxygen tool. [Default: %default]""")
- parser.add_option('--force', dest="ignore_pending_commit", action='store_true', default=False,
- help="""Ignore pending commit. [Default: %default]""")
- parser.add_option('--retag', dest="retag_release", action='store_true', default=False,
- help="""Overwrite release existing tag if it exist. [Default: %default]""")
- parser.add_option('-p', '--platforms', dest="platforms", action='store', default='',
- help="""Comma separated list of platform passed to scons for build check.""")
- parser.add_option('--no-test', dest="no_test", action='store_true', default=False,
- help="""Skips build check.""")
- parser.add_option('--no-web', dest="no_web", action='store_true', default=False,
- help="""Do not update web site.""")
- parser.add_option('-u', '--upload-user', dest="user", action='store',
- help="""Sourceforge user for SFTP documentation upload.""")
- parser.add_option('--sftp', dest='sftp', action='store', default=doxybuild.find_program('psftp', 'sftp'),
- help="""Path of the SFTP compatible binary used to upload the documentation.""")
- parser.enable_interspersed_args()
- options, args = parser.parse_args()
-
- if len(args) != 2:
- parser.error( 'release_version missing on command-line.' )
- release_version = args[0]
- next_version = args[1]
-
- if not options.platforms and not options.no_test:
- parser.error( 'You must specify either --platform or --no-test option.' )
-
- if options.ignore_pending_commit:
- msg = ''
- else:
- msg = check_no_pending_commit()
- if not msg:
- print 'Setting version to', release_version
- set_version( release_version )
- svn_commit( 'Release ' + release_version )
- tag_url = svn_join_url( SVN_TAG_ROOT, release_version )
- if svn_check_if_tag_exist( tag_url ):
- if options.retag_release:
- svn_remove_tag( tag_url, 'Overwriting previous tag' )
- else:
- print 'Aborting, tag %s already exist. Use --retag to overwrite it!' % tag_url
- sys.exit( 1 )
- svn_tag_sandbox( tag_url, 'Release ' + release_version )
-
- print 'Generated doxygen document...'
-## doc_dirname = r'jsoncpp-api-html-0.5.0'
-## doc_tarball_path = r'e:\prg\vc\Lib\jsoncpp-trunk\dist\jsoncpp-api-html-0.5.0.tar.gz'
- doc_tarball_path, doc_dirname = doxybuild.build_doc( options, make_release=True )
- doc_distcheck_dir = 'dist/doccheck'
- tarball.decompress( doc_tarball_path, doc_distcheck_dir )
- doc_distcheck_top_dir = os.path.join( doc_distcheck_dir, doc_dirname )
-
- export_dir = 'dist/export'
- svn_export( tag_url, export_dir )
- fix_sources_eol( export_dir )
-
- source_dir = 'jsoncpp-src-' + release_version
- source_tarball_path = 'dist/%s.tar.gz' % source_dir
- print 'Generating source tarball to', source_tarball_path
- tarball.make_tarball( source_tarball_path, [export_dir], export_dir, prefix_dir=source_dir )
-
- amalgamation_tarball_path = 'dist/%s-amalgamation.tar.gz' % source_dir
- print 'Generating amalgamation source tarball to', amalgamation_tarball_path
- amalgamation_dir = 'dist/amalgamation'
- amalgamate.amalgamate_source( export_dir, '%s/jsoncpp.cpp' % amalgamation_dir, 'json/json.h' )
- amalgamation_source_dir = 'jsoncpp-src-amalgamation' + release_version
- tarball.make_tarball( amalgamation_tarball_path, [amalgamation_dir],
- amalgamation_dir, prefix_dir=amalgamation_source_dir )
-
- # Decompress source tarball, download and install scons-local
- distcheck_dir = 'dist/distcheck'
- distcheck_top_dir = distcheck_dir + '/' + source_dir
- print 'Decompressing source tarball to', distcheck_dir
- rmdir_if_exist( distcheck_dir )
- tarball.decompress( source_tarball_path, distcheck_dir )
- scons_local_path = 'dist/scons-local.tar.gz'
- print 'Downloading scons-local to', scons_local_path
- download( SCONS_LOCAL_URL, scons_local_path )
- print 'Decompressing scons-local to', distcheck_top_dir
- tarball.decompress( scons_local_path, distcheck_top_dir )
-
- # Run compilation
- print 'Compiling decompressed tarball'
- all_build_status = True
- for platform in options.platforms.split(','):
- print 'Testing platform:', platform
- build_status, log_path = check_compile( distcheck_top_dir, platform )
- print 'see build log:', log_path
- print build_status and '=> ok' or '=> FAILED'
- all_build_status = all_build_status and build_status
- if not build_status:
- print 'Testing failed on at least one platform, aborting...'
- svn_remove_tag( tag_url, 'Removing tag due to failed testing' )
- sys.exit(1)
- if options.user:
- if not options.no_web:
- print 'Uploading documentation using user', options.user
- sourceforge_web_synchro( SOURCEFORGE_PROJECT, doc_distcheck_top_dir, user=options.user, sftp=options.sftp )
- print 'Completed documentation upload'
- print 'Uploading source and documentation tarballs for release using user', options.user
- sourceforge_release_tarball( SOURCEFORGE_PROJECT,
- [source_tarball_path, doc_tarball_path],
- user=options.user, sftp=options.sftp )
- print 'Source and doc release tarballs uploaded'
- else:
- print 'No upload user specified. Web site and download tarbal were not uploaded.'
- print 'Tarball can be found at:', doc_tarball_path
-
- # Set next version number and commit
- set_version( next_version )
- svn_commit( 'Released ' + release_version )
- else:
- sys.stderr.write( msg + '\n' )
-
-if __name__ == '__main__':
- main()
diff --git a/src/3rd_party-static/jsoncpp/scons-tools/globtool.py b/src/3rd_party-static/jsoncpp/scons-tools/globtool.py
deleted file mode 100644
index 811140e8aa..0000000000
--- a/src/3rd_party-static/jsoncpp/scons-tools/globtool.py
+++ /dev/null
@@ -1,53 +0,0 @@
-import fnmatch
-import os
-
-def generate( env ):
- def Glob( env, includes = None, excludes = None, dir = '.' ):
- """Adds Glob( includes = Split( '*' ), excludes = None, dir = '.')
- helper function to environment.
-
- Glob both the file-system files.
-
- includes: list of file name pattern included in the return list when matched.
- excludes: list of file name pattern exluced from the return list.
-
- Example:
- sources = env.Glob( ("*.cpp", '*.h'), "~*.cpp", "#src" )
- """
- def filterFilename(path):
- abs_path = os.path.join( dir, path )
- if not os.path.isfile(abs_path):
- return 0
- fn = os.path.basename(path)
- match = 0
- for include in includes:
- if fnmatch.fnmatchcase( fn, include ):
- match = 1
- break
- if match == 1 and not excludes is None:
- for exclude in excludes:
- if fnmatch.fnmatchcase( fn, exclude ):
- match = 0
- break
- return match
- if includes is None:
- includes = ('*',)
- elif type(includes) in ( type(''), type(u'') ):
- includes = (includes,)
- if type(excludes) in ( type(''), type(u'') ):
- excludes = (excludes,)
- dir = env.Dir(dir).abspath
- paths = os.listdir( dir )
- def makeAbsFileNode( path ):
- return env.File( os.path.join( dir, path ) )
- nodes = filter( filterFilename, paths )
- return map( makeAbsFileNode, nodes )
-
- from SCons.Script import Environment
- Environment.Glob = Glob
-
-def exists(env):
- """
- Tool always exists.
- """
- return True
diff --git a/src/3rd_party-static/jsoncpp/scons-tools/srcdist.py b/src/3rd_party-static/jsoncpp/scons-tools/srcdist.py
deleted file mode 100644
index 864ff40815..0000000000
--- a/src/3rd_party-static/jsoncpp/scons-tools/srcdist.py
+++ /dev/null
@@ -1,179 +0,0 @@
-import os
-import os.path
-from fnmatch import fnmatch
-import targz
-
-##def DoxyfileParse(file_contents):
-## """
-## Parse a Doxygen source file and return a dictionary of all the values.
-## Values will be strings and lists of strings.
-## """
-## data = {}
-##
-## import shlex
-## lex = shlex.shlex(instream = file_contents, posix = True)
-## lex.wordchars += "*+./-:"
-## lex.whitespace = lex.whitespace.replace("\n", "")
-## lex.escape = ""
-##
-## lineno = lex.lineno
-## last_backslash_lineno = lineno
-## token = lex.get_token()
-## key = token # the first token should be a key
-## last_token = ""
-## key_token = False
-## next_key = False
-## new_data = True
-##
-## def append_data(data, key, new_data, token):
-## if new_data or len(data[key]) == 0:
-## data[key].append(token)
-## else:
-## data[key][-1] += token
-##
-## while token:
-## if token in ['\n']:
-## if last_token not in ['\\']:
-## key_token = True
-## elif token in ['\\']:
-## pass
-## elif key_token:
-## key = token
-## key_token = False
-## else:
-## if token == "+=":
-## if not data.has_key(key):
-## data[key] = list()
-## elif token == "=":
-## data[key] = list()
-## else:
-## append_data( data, key, new_data, token )
-## new_data = True
-##
-## last_token = token
-## token = lex.get_token()
-##
-## if last_token == '\\' and token != '\n':
-## new_data = False
-## append_data( data, key, new_data, '\\' )
-##
-## # compress lists of len 1 into single strings
-## for (k, v) in data.items():
-## if len(v) == 0:
-## data.pop(k)
-##
-## # items in the following list will be kept as lists and not converted to strings
-## if k in ["INPUT", "FILE_PATTERNS", "EXCLUDE_PATTERNS"]:
-## continue
-##
-## if len(v) == 1:
-## data[k] = v[0]
-##
-## return data
-##
-##def DoxySourceScan(node, env, path):
-## """
-## Doxygen Doxyfile source scanner. This should scan the Doxygen file and add
-## any files used to generate docs to the list of source files.
-## """
-## default_file_patterns = [
-## '*.c', '*.cc', '*.cxx', '*.cpp', '*.c++', '*.java', '*.ii', '*.ixx',
-## '*.ipp', '*.i++', '*.inl', '*.h', '*.hh ', '*.hxx', '*.hpp', '*.h++',
-## '*.idl', '*.odl', '*.cs', '*.php', '*.php3', '*.inc', '*.m', '*.mm',
-## '*.py',
-## ]
-##
-## default_exclude_patterns = [
-## '*~',
-## ]
-##
-## sources = []
-##
-## data = DoxyfileParse(node.get_contents())
-##
-## if data.get("RECURSIVE", "NO") == "YES":
-## recursive = True
-## else:
-## recursive = False
-##
-## file_patterns = data.get("FILE_PATTERNS", default_file_patterns)
-## exclude_patterns = data.get("EXCLUDE_PATTERNS", default_exclude_patterns)
-##
-## for node in data.get("INPUT", []):
-## if os.path.isfile(node):
-## sources.add(node)
-## elif os.path.isdir(node):
-## if recursive:
-## for root, dirs, files in os.walk(node):
-## for f in files:
-## filename = os.path.join(root, f)
-##
-## pattern_check = reduce(lambda x, y: x or bool(fnmatch(filename, y)), file_patterns, False)
-## exclude_check = reduce(lambda x, y: x and fnmatch(filename, y), exclude_patterns, True)
-##
-## if pattern_check and not exclude_check:
-## sources.append(filename)
-## else:
-## for pattern in file_patterns:
-## sources.extend(glob.glob("/".join([node, pattern])))
-## sources = map( lambda path: env.File(path), sources )
-## return sources
-##
-##
-##def DoxySourceScanCheck(node, env):
-## """Check if we should scan this file"""
-## return os.path.isfile(node.path)
-
-def srcDistEmitter(source, target, env):
-## """Doxygen Doxyfile emitter"""
-## # possible output formats and their default values and output locations
-## output_formats = {
-## "HTML": ("YES", "html"),
-## "LATEX": ("YES", "latex"),
-## "RTF": ("NO", "rtf"),
-## "MAN": ("YES", "man"),
-## "XML": ("NO", "xml"),
-## }
-##
-## data = DoxyfileParse(source[0].get_contents())
-##
-## targets = []
-## out_dir = data.get("OUTPUT_DIRECTORY", ".")
-##
-## # add our output locations
-## for (k, v) in output_formats.items():
-## if data.get("GENERATE_" + k, v[0]) == "YES":
-## targets.append(env.Dir( os.path.join(out_dir, data.get(k + "_OUTPUT", v[1]))) )
-##
-## # don't clobber targets
-## for node in targets:
-## env.Precious(node)
-##
-## # set up cleaning stuff
-## for node in targets:
-## env.Clean(node, node)
-##
-## return (targets, source)
- return (target,source)
-
-def generate(env):
- """
- Add builders and construction variables for the
- SrcDist tool.
- """
-## doxyfile_scanner = env.Scanner(
-## DoxySourceScan,
-## "DoxySourceScan",
-## scan_check = DoxySourceScanCheck,
-## )
-
- if targz.exists(env):
- srcdist_builder = targz.makeBuilder( srcDistEmitter )
-
- env['BUILDERS']['SrcDist'] = srcdist_builder
-
-def exists(env):
- """
- Make sure srcdist exists.
- """
- return targz.exists(env)
diff --git a/src/3rd_party-static/jsoncpp/scons-tools/substinfile.py b/src/3rd_party-static/jsoncpp/scons-tools/substinfile.py
deleted file mode 100644
index 4d305851bb..0000000000
--- a/src/3rd_party-static/jsoncpp/scons-tools/substinfile.py
+++ /dev/null
@@ -1,79 +0,0 @@
-import re
-from SCons.Script import * # the usual scons stuff you get in a SConscript
-
-def generate(env):
- """
- Add builders and construction variables for the
- SubstInFile tool.
-
- Adds SubstInFile builder, which substitutes the keys->values of SUBST_DICT
- from the source to the target.
- The values of SUBST_DICT first have any construction variables expanded
- (its keys are not expanded).
- If a value of SUBST_DICT is a python callable function, it is called and
- the result is expanded as the value.
- If there's more than one source and more than one target, each target gets
- substituted from the corresponding source.
- """
- def do_subst_in_file(targetfile, sourcefile, dict):
- """Replace all instances of the keys of dict with their values.
- For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'},
- then all instances of %VERSION% in the file will be replaced with 1.2345 etc.
- """
- try:
- f = open(sourcefile, 'rb')
- contents = f.read()
- f.close()
- except:
- raise SCons.Errors.UserError, "Can't read source file %s"%sourcefile
- for (k,v) in dict.items():
- contents = re.sub(k, v, contents)
- try:
- f = open(targetfile, 'wb')
- f.write(contents)
- f.close()
- except:
- raise SCons.Errors.UserError, "Can't write target file %s"%targetfile
- return 0 # success
-
- def subst_in_file(target, source, env):
- if not env.has_key('SUBST_DICT'):
- raise SCons.Errors.UserError, "SubstInFile requires SUBST_DICT to be set."
- d = dict(env['SUBST_DICT']) # copy it
- for (k,v) in d.items():
- if callable(v):
- d[k] = env.subst(v()).replace('\\','\\\\')
- elif SCons.Util.is_String(v):
- d[k] = env.subst(v).replace('\\','\\\\')
- else:
- raise SCons.Errors.UserError, "SubstInFile: key %s: %s must be a string or callable"%(k, repr(v))
- for (t,s) in zip(target, source):
- return do_subst_in_file(str(t), str(s), d)
-
- def subst_in_file_string(target, source, env):
- """This is what gets printed on the console."""
- return '\n'.join(['Substituting vars from %s into %s'%(str(s), str(t))
- for (t,s) in zip(target, source)])
-
- def subst_emitter(target, source, env):
- """Add dependency from substituted SUBST_DICT to target.
- Returns original target, source tuple unchanged.
- """
- d = env['SUBST_DICT'].copy() # copy it
- for (k,v) in d.items():
- if callable(v):
- d[k] = env.subst(v())
- elif SCons.Util.is_String(v):
- d[k]=env.subst(v)
- Depends(target, SCons.Node.Python.Value(d))
- return target, source
-
-## env.Append(TOOLS = 'substinfile') # this should be automaticaly done by Scons ?!?
- subst_action = SCons.Action.Action( subst_in_file, subst_in_file_string )
- env['BUILDERS']['SubstInFile'] = Builder(action=subst_action, emitter=subst_emitter)
-
-def exists(env):
- """
- Make sure tool exists.
- """
- return True
diff --git a/src/3rd_party-static/jsoncpp/scons-tools/targz.py b/src/3rd_party-static/jsoncpp/scons-tools/targz.py
deleted file mode 100644
index f5432003df..0000000000
--- a/src/3rd_party-static/jsoncpp/scons-tools/targz.py
+++ /dev/null
@@ -1,82 +0,0 @@
-"""tarball
-
-Tool-specific initialization for tarball.
-
-"""
-
-## Commands to tackle a command based implementation:
-##to unpack on the fly...
-##gunzip < FILE.tar.gz | tar xvf -
-##to pack on the fly...
-##tar cvf - FILE-LIST | gzip -c > FILE.tar.gz
-
-import os.path
-
-import SCons.Builder
-import SCons.Node.FS
-import SCons.Util
-
-try:
- import gzip
- import tarfile
- internal_targz = 1
-except ImportError:
- internal_targz = 0
-
-TARGZ_DEFAULT_COMPRESSION_LEVEL = 9
-
-if internal_targz:
- def targz(target, source, env):
- def archive_name( path ):
- path = os.path.normpath( os.path.abspath( path ) )
- common_path = os.path.commonprefix( (base_dir, path) )
- archive_name = path[len(common_path):]
- return archive_name
-
- def visit(tar, dirname, names):
- for name in names:
- path = os.path.join(dirname, name)
- if os.path.isfile(path):
- tar.add(path, archive_name(path) )
- compression = env.get('TARGZ_COMPRESSION_LEVEL',TARGZ_DEFAULT_COMPRESSION_LEVEL)
- base_dir = os.path.normpath( env.get('TARGZ_BASEDIR', env.Dir('.')).abspath )
- target_path = str(target[0])
- fileobj = gzip.GzipFile( target_path, 'wb', compression )
- tar = tarfile.TarFile(os.path.splitext(target_path)[0], 'w', fileobj)
- for source in source:
- source_path = str(source)
- if source.isdir():
- os.path.walk(source_path, visit, tar)
- else:
- tar.add(source_path, archive_name(source_path) ) # filename, arcname
- tar.close()
-
- targzAction = SCons.Action.Action(targz, varlist=['TARGZ_COMPRESSION_LEVEL','TARGZ_BASEDIR'])
-
- def makeBuilder( emitter = None ):
- return SCons.Builder.Builder(action = SCons.Action.Action('$TARGZ_COM', '$TARGZ_COMSTR'),
- source_factory = SCons.Node.FS.Entry,
- source_scanner = SCons.Defaults.DirScanner,
- suffix = '$TARGZ_SUFFIX',
- multi = 1)
- TarGzBuilder = makeBuilder()
-
- def generate(env):
- """Add Builders and construction variables for zip to an Environment.
- The following environnement variables may be set:
- TARGZ_COMPRESSION_LEVEL: integer, [0-9]. 0: no compression, 9: best compression (same as gzip compression level).
- TARGZ_BASEDIR: base-directory used to determine archive name (this allow archive name to be relative
- to something other than top-dir).
- """
- env['BUILDERS']['TarGz'] = TarGzBuilder
- env['TARGZ_COM'] = targzAction
- env['TARGZ_COMPRESSION_LEVEL'] = TARGZ_DEFAULT_COMPRESSION_LEVEL # range 0-9
- env['TARGZ_SUFFIX'] = '.tar.gz'
- env['TARGZ_BASEDIR'] = env.Dir('.') # Sources archive name are made relative to that directory.
-else:
- def generate(env):
- pass
-
-
-def exists(env):
- return internal_targz
diff --git a/src/3rd_party-static/jsoncpp/src/jsontestrunner/main.cpp b/src/3rd_party-static/jsoncpp/src/jsontestrunner/main.cpp
deleted file mode 100644
index dfb6150e06..0000000000
--- a/src/3rd_party-static/jsoncpp/src/jsontestrunner/main.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-/* This executable is used for testing parser/writer using real JSON files.
- */
-
-
-#include <json/json.h>
-#include <algorithm> // sort
-#include <stdio.h>
-
-#if defined(_MSC_VER) && _MSC_VER >= 1310
-# pragma warning( disable: 4996 ) // disable fopen deprecation warning
-#endif
-
-static std::string
-readInputTestFile( const char *path )
-{
- FILE *file = fopen( path, "rb" );
- if ( !file )
- return std::string("");
- fseek( file, 0, SEEK_END );
- long size = ftell( file );
- fseek( file, 0, SEEK_SET );
- std::string text;
- char *buffer = new char[size+1];
- buffer[size] = 0;
- if ( fread( buffer, 1, size, file ) == (unsigned long)size )
- text = buffer;
- fclose( file );
- delete[] buffer;
- return text;
-}
-
-
-static void
-printValueTree( FILE *fout, Json::Value &value, const std::string &path = "." )
-{
- switch ( value.type() )
- {
- case Json::nullValue:
- fprintf( fout, "%s=null\n", path.c_str() );
- break;
- case Json::intValue:
- fprintf( fout, "%s=%s\n", path.c_str(), Json::valueToString( value.asLargestInt() ).c_str() );
- break;
- case Json::uintValue:
- fprintf( fout, "%s=%s\n", path.c_str(), Json::valueToString( value.asLargestUInt() ).c_str() );
- break;
- case Json::realValue:
- fprintf( fout, "%s=%.16g\n", path.c_str(), value.asDouble() );
- break;
- case Json::stringValue:
- fprintf( fout, "%s=\"%s\"\n", path.c_str(), value.asString().c_str() );
- break;
- case Json::booleanValue:
- fprintf( fout, "%s=%s\n", path.c_str(), value.asBool() ? "true" : "false" );
- break;
- case Json::arrayValue:
- {
- fprintf( fout, "%s=[]\n", path.c_str() );
- int size = value.size();
- for ( int index =0; index < size; ++index )
- {
- static char buffer[16];
- sprintf( buffer, "[%d]", index );
- printValueTree( fout, value[index], path + buffer );
- }
- }
- break;
- case Json::objectValue:
- {
- fprintf( fout, "%s={}\n", path.c_str() );
- Json::Value::Members members( value.getMemberNames() );
- std::sort( members.begin(), members.end() );
- std::string suffix = *(path.end()-1) == '.' ? "" : ".";
- for ( Json::Value::Members::iterator it = members.begin();
- it != members.end();
- ++it )
- {
- const std::string &name = *it;
- printValueTree( fout, value[name], path + suffix + name );
- }
- }
- break;
- default:
- break;
- }
-}
-
-
-static int
-parseAndSaveValueTree( const std::string &input,
- const std::string &actual,
- const std::string &kind,
- Json::Value &root,
- const Json::Features &features,
- bool parseOnly )
-{
- Json::Reader reader( features );
- bool parsingSuccessful = reader.parse( input, root );
- if ( !parsingSuccessful )
- {
- printf( "Failed to parse %s file: \n%s\n",
- kind.c_str(),
- reader.getFormattedErrorMessages().c_str() );
- return 1;
- }
-
- if ( !parseOnly )
- {
- FILE *factual = fopen( actual.c_str(), "wt" );
- if ( !factual )
- {
- printf( "Failed to create %s actual file.\n", kind.c_str() );
- return 2;
- }
- printValueTree( factual, root );
- fclose( factual );
- }
- return 0;
-}
-
-
-static int
-rewriteValueTree( const std::string &rewritePath,
- const Json::Value &root,
- std::string &rewrite )
-{
- //Json::FastWriter writer;
- //writer.enableYAMLCompatibility();
- Json::StyledWriter writer;
- rewrite = writer.write( root );
- FILE *fout = fopen( rewritePath.c_str(), "wt" );
- if ( !fout )
- {
- printf( "Failed to create rewrite file: %s\n", rewritePath.c_str() );
- return 2;
- }
- fprintf( fout, "%s\n", rewrite.c_str() );
- fclose( fout );
- return 0;
-}
-
-
-static std::string
-removeSuffix( const std::string &path,
- const std::string &extension )
-{
- if ( extension.length() >= path.length() )
- return std::string("");
- std::string suffix = path.substr( path.length() - extension.length() );
- if ( suffix != extension )
- return std::string("");
- return path.substr( 0, path.length() - extension.length() );
-}
-
-
-static void
-printConfig()
-{
- // Print the configuration used to compile JsonCpp
-#if defined(JSON_NO_INT64)
- printf( "JSON_NO_INT64=1\n" );
-#else
- printf( "JSON_NO_INT64=0\n" );
-#endif
-}
-
-
-static int
-printUsage( const char *argv[] )
-{
- printf( "Usage: %s [--strict] input-json-file", argv[0] );
- return 3;
-}
-
-
-int
-parseCommandLine( int argc, const char *argv[],
- Json::Features &features, std::string &path,
- bool &parseOnly )
-{
- parseOnly = false;
- if ( argc < 2 )
- {
- return printUsage( argv );
- }
-
- int index = 1;
- if ( std::string(argv[1]) == "--json-checker" )
- {
- features = Json::Features::strictMode();
- parseOnly = true;
- ++index;
- }
-
- if ( std::string(argv[1]) == "--json-config" )
- {
- printConfig();
- return 3;
- }
-
- if ( index == argc || index + 1 < argc )
- {
- return printUsage( argv );
- }
-
- path = argv[index];
- return 0;
-}
-
-
-int main( int argc, const char *argv[] )
-{
- std::string path;
- Json::Features features;
- bool parseOnly;
- int exitCode = parseCommandLine( argc, argv, features, path, parseOnly );
- if ( exitCode != 0 )
- {
- return exitCode;
- }
-
- try
- {
- std::string input = readInputTestFile( path.c_str() );
- if ( input.empty() )
- {
- printf( "Failed to read input or empty input: %s\n", path.c_str() );
- return 3;
- }
-
- std::string basePath = removeSuffix( argv[1], ".json" );
- if ( !parseOnly && basePath.empty() )
- {
- printf( "Bad input path. Path does not end with '.expected':\n%s\n", path.c_str() );
- return 3;
- }
-
- std::string actualPath = basePath + ".actual";
- std::string rewritePath = basePath + ".rewrite";
- std::string rewriteActualPath = basePath + ".actual-rewrite";
-
- Json::Value root;
- exitCode = parseAndSaveValueTree( input, actualPath, "input", root, features, parseOnly );
- if ( exitCode == 0 && !parseOnly )
- {
- std::string rewrite;
- exitCode = rewriteValueTree( rewritePath, root, rewrite );
- if ( exitCode == 0 )
- {
- Json::Value rewriteRoot;
- exitCode = parseAndSaveValueTree( rewrite, rewriteActualPath,
- "rewrite", rewriteRoot, features, parseOnly );
- }
- }
- }
- catch ( const std::exception &e )
- {
- printf( "Unhandled exception:\n%s\n", e.what() );
- exitCode = 1;
- }
-
- return exitCode;
-}
-
diff --git a/src/3rd_party-static/jsoncpp/src/jsontestrunner/sconscript b/src/3rd_party-static/jsoncpp/src/jsontestrunner/sconscript
deleted file mode 100644
index 180c8ec358..0000000000
--- a/src/3rd_party-static/jsoncpp/src/jsontestrunner/sconscript
+++ /dev/null
@@ -1,9 +0,0 @@
-Import( 'env_testing buildJSONTests' )
-
-buildJSONTests( env_testing, Split( """
- main.cpp
- """ ),
- 'jsontestrunner' )
-
-# For 'check' to work, 'libs' must be built first.
-env_testing.Depends('jsontestrunner', '#libs')
diff --git a/src/3rd_party-static/jsoncpp/src/lib_json/json_batchallocator.h b/src/3rd_party-static/jsoncpp/src/lib_json/json_batchallocator.h
deleted file mode 100644
index 173e2ed257..0000000000
--- a/src/3rd_party-static/jsoncpp/src/lib_json/json_batchallocator.h
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSONCPP_BATCHALLOCATOR_H_INCLUDED
-# define JSONCPP_BATCHALLOCATOR_H_INCLUDED
-
-# include <stdlib.h>
-# include <assert.h>
-
-# ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
-
-namespace Json {
-
-/* Fast memory allocator.
- *
- * This memory allocator allocates memory for a batch of object (specified by
- * the page size, the number of object in each page).
- *
- * It does not allow the destruction of a single object. All the allocated objects
- * can be destroyed at once. The memory can be either released or reused for future
- * allocation.
- *
- * The in-place new operator must be used to construct the object using the pointer
- * returned by allocate.
- */
-template<typename AllocatedType
- ,const unsigned int objectPerAllocation>
-class BatchAllocator
-{
-public:
- typedef AllocatedType Type;
-
- BatchAllocator( unsigned int objectsPerPage = 255 )
- : freeHead_( 0 )
- , objectsPerPage_( objectsPerPage )
- {
-// printf( "Size: %d => %s\n", sizeof(AllocatedType), typeid(AllocatedType).name() );
- assert( sizeof(AllocatedType) * objectPerAllocation >= sizeof(AllocatedType *) ); // We must be able to store a slist in the object free space.
- assert( objectsPerPage >= 16 );
- batches_ = allocateBatch( 0 ); // allocated a dummy page
- currentBatch_ = batches_;
- }
-
- ~BatchAllocator()
- {
- for ( BatchInfo *batch = batches_; batch; )
- {
- BatchInfo *nextBatch = batch->next_;
- free( batch );
- batch = nextBatch;
- }
- }
-
- /// allocate space for an array of objectPerAllocation object.
- /// @warning it is the responsability of the caller to call objects constructors.
- AllocatedType *allocate()
- {
- if ( freeHead_ ) // returns node from free list.
- {
- AllocatedType *object = freeHead_;
- freeHead_ = *(AllocatedType **)object;
- return object;
- }
- if ( currentBatch_->used_ == currentBatch_->end_ )
- {
- currentBatch_ = currentBatch_->next_;
- while ( currentBatch_ && currentBatch_->used_ == currentBatch_->end_ )
- currentBatch_ = currentBatch_->next_;
-
- if ( !currentBatch_ ) // no free batch found, allocate a new one
- {
- currentBatch_ = allocateBatch( objectsPerPage_ );
- currentBatch_->next_ = batches_; // insert at the head of the list
- batches_ = currentBatch_;
- }
- }
- AllocatedType *allocated = currentBatch_->used_;
- currentBatch_->used_ += objectPerAllocation;
- return allocated;
- }
-
- /// Release the object.
- /// @warning it is the responsability of the caller to actually destruct the object.
- void release( AllocatedType *object )
- {
- assert( object != 0 );
- *(AllocatedType **)object = freeHead_;
- freeHead_ = object;
- }
-
-private:
- struct BatchInfo
- {
- BatchInfo *next_;
- AllocatedType *used_;
- AllocatedType *end_;
- AllocatedType buffer_[objectPerAllocation];
- };
-
- // disabled copy constructor and assignement operator.
- BatchAllocator( const BatchAllocator & );
- void operator =( const BatchAllocator &);
-
- static BatchInfo *allocateBatch( unsigned int objectsPerPage )
- {
- const unsigned int mallocSize = sizeof(BatchInfo) - sizeof(AllocatedType)* objectPerAllocation
- + sizeof(AllocatedType) * objectPerAllocation * objectsPerPage;
- BatchInfo *batch = static_cast<BatchInfo*>( malloc( mallocSize ) );
- batch->next_ = 0;
- batch->used_ = batch->buffer_;
- batch->end_ = batch->buffer_ + objectsPerPage;
- return batch;
- }
-
- BatchInfo *batches_;
- BatchInfo *currentBatch_;
- /// Head of a single linked list within the allocated space of freeed object
- AllocatedType *freeHead_;
- unsigned int objectsPerPage_;
-};
-
-
-} // namespace Json
-
-# endif // ifndef JSONCPP_DOC_INCLUDE_IMPLEMENTATION
-
-#endif // JSONCPP_BATCHALLOCATOR_H_INCLUDED
-
diff --git a/src/3rd_party-static/jsoncpp/src/lib_json/json_internalarray.inl b/src/3rd_party-static/jsoncpp/src/lib_json/json_internalarray.inl
deleted file mode 100644
index 3a532ad759..0000000000
--- a/src/3rd_party-static/jsoncpp/src/lib_json/json_internalarray.inl
+++ /dev/null
@@ -1,456 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-// included by json_value.cpp
-
-namespace Json {
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class ValueInternalArray
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-ValueArrayAllocator::~ValueArrayAllocator()
-{
-}
-
-// //////////////////////////////////////////////////////////////////
-// class DefaultValueArrayAllocator
-// //////////////////////////////////////////////////////////////////
-#ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
-class DefaultValueArrayAllocator : public ValueArrayAllocator
-{
-public: // overridden from ValueArrayAllocator
- virtual ~DefaultValueArrayAllocator()
- {
- }
-
- virtual ValueInternalArray *newArray()
- {
- return new ValueInternalArray();
- }
-
- virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other )
- {
- return new ValueInternalArray( other );
- }
-
- virtual void destructArray( ValueInternalArray *array )
- {
- delete array;
- }
-
- virtual void reallocateArrayPageIndex( Value **&indexes,
- ValueInternalArray::PageIndex &indexCount,
- ValueInternalArray::PageIndex minNewIndexCount )
- {
- ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1;
- if ( minNewIndexCount > newIndexCount )
- newIndexCount = minNewIndexCount;
- void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
- if ( !newIndexes )
- throw std::bad_alloc();
- indexCount = newIndexCount;
- indexes = static_cast<Value **>( newIndexes );
- }
- virtual void releaseArrayPageIndex( Value **indexes,
- ValueInternalArray::PageIndex indexCount )
- {
- if ( indexes )
- free( indexes );
- }
-
- virtual Value *allocateArrayPage()
- {
- return static_cast<Value *>( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) );
- }
-
- virtual void releaseArrayPage( Value *value )
- {
- if ( value )
- free( value );
- }
-};
-
-#else // #ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
-/// @todo make this thread-safe (lock when accessign batch allocator)
-class DefaultValueArrayAllocator : public ValueArrayAllocator
-{
-public: // overridden from ValueArrayAllocator
- virtual ~DefaultValueArrayAllocator()
- {
- }
-
- virtual ValueInternalArray *newArray()
- {
- ValueInternalArray *array = arraysAllocator_.allocate();
- new (array) ValueInternalArray(); // placement new
- return array;
- }
-
- virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other )
- {
- ValueInternalArray *array = arraysAllocator_.allocate();
- new (array) ValueInternalArray( other ); // placement new
- return array;
- }
-
- virtual void destructArray( ValueInternalArray *array )
- {
- if ( array )
- {
- array->~ValueInternalArray();
- arraysAllocator_.release( array );
- }
- }
-
- virtual void reallocateArrayPageIndex( Value **&indexes,
- ValueInternalArray::PageIndex &indexCount,
- ValueInternalArray::PageIndex minNewIndexCount )
- {
- ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1;
- if ( minNewIndexCount > newIndexCount )
- newIndexCount = minNewIndexCount;
- void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
- if ( !newIndexes )
- throw std::bad_alloc();
- indexCount = newIndexCount;
- indexes = static_cast<Value **>( newIndexes );
- }
- virtual void releaseArrayPageIndex( Value **indexes,
- ValueInternalArray::PageIndex indexCount )
- {
- if ( indexes )
- free( indexes );
- }
-
- virtual Value *allocateArrayPage()
- {
- return static_cast<Value *>( pagesAllocator_.allocate() );
- }
-
- virtual void releaseArrayPage( Value *value )
- {
- if ( value )
- pagesAllocator_.release( value );
- }
-private:
- BatchAllocator<ValueInternalArray,1> arraysAllocator_;
- BatchAllocator<Value,ValueInternalArray::itemsPerPage> pagesAllocator_;
-};
-#endif // #ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
-
-static ValueArrayAllocator *&arrayAllocator()
-{
- static DefaultValueArrayAllocator defaultAllocator;
- static ValueArrayAllocator *arrayAllocator = &defaultAllocator;
- return arrayAllocator;
-}
-
-static struct DummyArrayAllocatorInitializer {
- DummyArrayAllocatorInitializer()
- {
- arrayAllocator(); // ensure arrayAllocator() statics are initialized before main().
- }
-} dummyArrayAllocatorInitializer;
-
-// //////////////////////////////////////////////////////////////////
-// class ValueInternalArray
-// //////////////////////////////////////////////////////////////////
-bool
-ValueInternalArray::equals( const IteratorState &x,
- const IteratorState &other )
-{
- return x.array_ == other.array_
- && x.currentItemIndex_ == other.currentItemIndex_
- && x.currentPageIndex_ == other.currentPageIndex_;
-}
-
-
-void
-ValueInternalArray::increment( IteratorState &it )
-{
- JSON_ASSERT_MESSAGE( it.array_ &&
- (it.currentPageIndex_ - it.array_->pages_)*itemsPerPage + it.currentItemIndex_
- != it.array_->size_,
- "ValueInternalArray::increment(): moving iterator beyond end" );
- ++(it.currentItemIndex_);
- if ( it.currentItemIndex_ == itemsPerPage )
- {
- it.currentItemIndex_ = 0;
- ++(it.currentPageIndex_);
- }
-}
-
-
-void
-ValueInternalArray::decrement( IteratorState &it )
-{
- JSON_ASSERT_MESSAGE( it.array_ && it.currentPageIndex_ == it.array_->pages_
- && it.currentItemIndex_ == 0,
- "ValueInternalArray::decrement(): moving iterator beyond end" );
- if ( it.currentItemIndex_ == 0 )
- {
- it.currentItemIndex_ = itemsPerPage-1;
- --(it.currentPageIndex_);
- }
- else
- {
- --(it.currentItemIndex_);
- }
-}
-
-
-Value &
-ValueInternalArray::unsafeDereference( const IteratorState &it )
-{
- return (*(it.currentPageIndex_))[it.currentItemIndex_];
-}
-
-
-Value &
-ValueInternalArray::dereference( const IteratorState &it )
-{
- JSON_ASSERT_MESSAGE( it.array_ &&
- (it.currentPageIndex_ - it.array_->pages_)*itemsPerPage + it.currentItemIndex_
- < it.array_->size_,
- "ValueInternalArray::dereference(): dereferencing invalid iterator" );
- return unsafeDereference( it );
-}
-
-void
-ValueInternalArray::makeBeginIterator( IteratorState &it ) const
-{
- it.array_ = const_cast<ValueInternalArray *>( this );
- it.currentItemIndex_ = 0;
- it.currentPageIndex_ = pages_;
-}
-
-
-void
-ValueInternalArray::makeIterator( IteratorState &it, ArrayIndex index ) const
-{
- it.array_ = const_cast<ValueInternalArray *>( this );
- it.currentItemIndex_ = index % itemsPerPage;
- it.currentPageIndex_ = pages_ + index / itemsPerPage;
-}
-
-
-void
-ValueInternalArray::makeEndIterator( IteratorState &it ) const
-{
- makeIterator( it, size_ );
-}
-
-
-ValueInternalArray::ValueInternalArray()
- : pages_( 0 )
- , size_( 0 )
- , pageCount_( 0 )
-{
-}
-
-
-ValueInternalArray::ValueInternalArray( const ValueInternalArray &other )
- : pages_( 0 )
- , pageCount_( 0 )
- , size_( other.size_ )
-{
- PageIndex minNewPages = other.size_ / itemsPerPage;
- arrayAllocator()->reallocateArrayPageIndex( pages_, pageCount_, minNewPages );
- JSON_ASSERT_MESSAGE( pageCount_ >= minNewPages,
- "ValueInternalArray::reserve(): bad reallocation" );
- IteratorState itOther;
- other.makeBeginIterator( itOther );
- Value *value;
- for ( ArrayIndex index = 0; index < size_; ++index, increment(itOther) )
- {
- if ( index % itemsPerPage == 0 )
- {
- PageIndex pageIndex = index / itemsPerPage;
- value = arrayAllocator()->allocateArrayPage();
- pages_[pageIndex] = value;
- }
- new (value) Value( dereference( itOther ) );
- }
-}
-
-
-ValueInternalArray &
-ValueInternalArray::operator =( const ValueInternalArray &other )
-{
- ValueInternalArray temp( other );
- swap( temp );
- return *this;
-}
-
-
-ValueInternalArray::~ValueInternalArray()
-{
- // destroy all constructed items
- IteratorState it;
- IteratorState itEnd;
- makeBeginIterator( it);
- makeEndIterator( itEnd );
- for ( ; !equals(it,itEnd); increment(it) )
- {
- Value *value = &dereference(it);
- value->~Value();
- }
- // release all pages
- PageIndex lastPageIndex = size_ / itemsPerPage;
- for ( PageIndex pageIndex = 0; pageIndex < lastPageIndex; ++pageIndex )
- arrayAllocator()->releaseArrayPage( pages_[pageIndex] );
- // release pages index
- arrayAllocator()->releaseArrayPageIndex( pages_, pageCount_ );
-}
-
-
-void
-ValueInternalArray::swap( ValueInternalArray &other )
-{
- Value **tempPages = pages_;
- pages_ = other.pages_;
- other.pages_ = tempPages;
- ArrayIndex tempSize = size_;
- size_ = other.size_;
- other.size_ = tempSize;
- PageIndex tempPageCount = pageCount_;
- pageCount_ = other.pageCount_;
- other.pageCount_ = tempPageCount;
-}
-
-void
-ValueInternalArray::clear()
-{
- ValueInternalArray dummy;
- swap( dummy );
-}
-
-
-void
-ValueInternalArray::resize( ArrayIndex newSize )
-{
- if ( newSize == 0 )
- clear();
- else if ( newSize < size_ )
- {
- IteratorState it;
- IteratorState itEnd;
- makeIterator( it, newSize );
- makeIterator( itEnd, size_ );
- for ( ; !equals(it,itEnd); increment(it) )
- {
- Value *value = &dereference(it);
- value->~Value();
- }
- PageIndex pageIndex = (newSize + itemsPerPage - 1) / itemsPerPage;
- PageIndex lastPageIndex = size_ / itemsPerPage;
- for ( ; pageIndex < lastPageIndex; ++pageIndex )
- arrayAllocator()->releaseArrayPage( pages_[pageIndex] );
- size_ = newSize;
- }
- else if ( newSize > size_ )
- resolveReference( newSize );
-}
-
-
-void
-ValueInternalArray::makeIndexValid( ArrayIndex index )
-{
- // Need to enlarge page index ?
- if ( index >= pageCount_ * itemsPerPage )
- {
- PageIndex minNewPages = (index + 1) / itemsPerPage;
- arrayAllocator()->reallocateArrayPageIndex( pages_, pageCount_, minNewPages );
- JSON_ASSERT_MESSAGE( pageCount_ >= minNewPages, "ValueInternalArray::reserve(): bad reallocation" );
- }
-
- // Need to allocate new pages ?
- ArrayIndex nextPageIndex =
- (size_ % itemsPerPage) != 0 ? size_ - (size_%itemsPerPage) + itemsPerPage
- : size_;
- if ( nextPageIndex <= index )
- {
- PageIndex pageIndex = nextPageIndex / itemsPerPage;
- PageIndex pageToAllocate = (index - nextPageIndex) / itemsPerPage + 1;
- for ( ; pageToAllocate-- > 0; ++pageIndex )
- pages_[pageIndex] = arrayAllocator()->allocateArrayPage();
- }
-
- // Initialize all new entries
- IteratorState it;
- IteratorState itEnd;
- makeIterator( it, size_ );
- size_ = index + 1;
- makeIterator( itEnd, size_ );
- for ( ; !equals(it,itEnd); increment(it) )
- {
- Value *value = &dereference(it);
- new (value) Value(); // Construct a default value using placement new
- }
-}
-
-Value &
-ValueInternalArray::resolveReference( ArrayIndex index )
-{
- if ( index >= size_ )
- makeIndexValid( index );
- return pages_[index/itemsPerPage][index%itemsPerPage];
-}
-
-Value *
-ValueInternalArray::find( ArrayIndex index ) const
-{
- if ( index >= size_ )
- return 0;
- return &(pages_[index/itemsPerPage][index%itemsPerPage]);
-}
-
-ValueInternalArray::ArrayIndex
-ValueInternalArray::size() const
-{
- return size_;
-}
-
-int
-ValueInternalArray::distance( const IteratorState &x, const IteratorState &y )
-{
- return indexOf(y) - indexOf(x);
-}
-
-
-ValueInternalArray::ArrayIndex
-ValueInternalArray::indexOf( const IteratorState &iterator )
-{
- if ( !iterator.array_ )
- return ArrayIndex(-1);
- return ArrayIndex(
- (iterator.currentPageIndex_ - iterator.array_->pages_) * itemsPerPage
- + iterator.currentItemIndex_ );
-}
-
-
-int
-ValueInternalArray::compare( const ValueInternalArray &other ) const
-{
- int sizeDiff( size_ - other.size_ );
- if ( sizeDiff != 0 )
- return sizeDiff;
-
- for ( ArrayIndex index =0; index < size_; ++index )
- {
- int diff = pages_[index/itemsPerPage][index%itemsPerPage].compare(
- other.pages_[index/itemsPerPage][index%itemsPerPage] );
- if ( diff != 0 )
- return diff;
- }
- return 0;
-}
-
-} // namespace Json
diff --git a/src/3rd_party-static/jsoncpp/src/lib_json/json_internalmap.inl b/src/3rd_party-static/jsoncpp/src/lib_json/json_internalmap.inl
deleted file mode 100644
index f2fa160655..0000000000
--- a/src/3rd_party-static/jsoncpp/src/lib_json/json_internalmap.inl
+++ /dev/null
@@ -1,615 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-// included by json_value.cpp
-
-namespace Json {
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class ValueInternalMap
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-/** \internal MUST be safely initialized using memset( this, 0, sizeof(ValueInternalLink) );
- * This optimization is used by the fast allocator.
- */
-ValueInternalLink::ValueInternalLink()
- : previous_( 0 )
- , next_( 0 )
-{
-}
-
-ValueInternalLink::~ValueInternalLink()
-{
- for ( int index =0; index < itemPerLink; ++index )
- {
- if ( !items_[index].isItemAvailable() )
- {
- if ( !items_[index].isMemberNameStatic() )
- free( keys_[index] );
- }
- else
- break;
- }
-}
-
-
-
-ValueMapAllocator::~ValueMapAllocator()
-{
-}
-
-#ifdef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
-class DefaultValueMapAllocator : public ValueMapAllocator
-{
-public: // overridden from ValueMapAllocator
- virtual ValueInternalMap *newMap()
- {
- return new ValueInternalMap();
- }
-
- virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other )
- {
- return new ValueInternalMap( other );
- }
-
- virtual void destructMap( ValueInternalMap *map )
- {
- delete map;
- }
-
- virtual ValueInternalLink *allocateMapBuckets( unsigned int size )
- {
- return new ValueInternalLink[size];
- }
-
- virtual void releaseMapBuckets( ValueInternalLink *links )
- {
- delete [] links;
- }
-
- virtual ValueInternalLink *allocateMapLink()
- {
- return new ValueInternalLink();
- }
-
- virtual void releaseMapLink( ValueInternalLink *link )
- {
- delete link;
- }
-};
-#else
-/// @todo make this thread-safe (lock when accessign batch allocator)
-class DefaultValueMapAllocator : public ValueMapAllocator
-{
-public: // overridden from ValueMapAllocator
- virtual ValueInternalMap *newMap()
- {
- ValueInternalMap *map = mapsAllocator_.allocate();
- new (map) ValueInternalMap(); // placement new
- return map;
- }
-
- virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other )
- {
- ValueInternalMap *map = mapsAllocator_.allocate();
- new (map) ValueInternalMap( other ); // placement new
- return map;
- }
-
- virtual void destructMap( ValueInternalMap *map )
- {
- if ( map )
- {
- map->~ValueInternalMap();
- mapsAllocator_.release( map );
- }
- }
-
- virtual ValueInternalLink *allocateMapBuckets( unsigned int size )
- {
- return new ValueInternalLink[size];
- }
-
- virtual void releaseMapBuckets( ValueInternalLink *links )
- {
- delete [] links;
- }
-
- virtual ValueInternalLink *allocateMapLink()
- {
- ValueInternalLink *link = linksAllocator_.allocate();
- memset( link, 0, sizeof(ValueInternalLink) );
- return link;
- }
-
- virtual void releaseMapLink( ValueInternalLink *link )
- {
- link->~ValueInternalLink();
- linksAllocator_.release( link );
- }
-private:
- BatchAllocator<ValueInternalMap,1> mapsAllocator_;
- BatchAllocator<ValueInternalLink,1> linksAllocator_;
-};
-#endif
-
-static ValueMapAllocator *&mapAllocator()
-{
- static DefaultValueMapAllocator defaultAllocator;
- static ValueMapAllocator *mapAllocator = &defaultAllocator;
- return mapAllocator;
-}
-
-static struct DummyMapAllocatorInitializer {
- DummyMapAllocatorInitializer()
- {
- mapAllocator(); // ensure mapAllocator() statics are initialized before main().
- }
-} dummyMapAllocatorInitializer;
-
-
-
-// h(K) = value * K >> w ; with w = 32 & K prime w.r.t. 2^32.
-
-/*
-use linked list hash map.
-buckets array is a container.
-linked list element contains 6 key/values. (memory = (16+4) * 6 + 4 = 124)
-value have extra state: valid, available, deleted
-*/
-
-
-ValueInternalMap::ValueInternalMap()
- : buckets_( 0 )
- , tailLink_( 0 )
- , bucketsSize_( 0 )
- , itemCount_( 0 )
-{
-}
-
-
-ValueInternalMap::ValueInternalMap( const ValueInternalMap &other )
- : buckets_( 0 )
- , tailLink_( 0 )
- , bucketsSize_( 0 )
- , itemCount_( 0 )
-{
- reserve( other.itemCount_ );
- IteratorState it;
- IteratorState itEnd;
- other.makeBeginIterator( it );
- other.makeEndIterator( itEnd );
- for ( ; !equals(it,itEnd); increment(it) )
- {
- bool isStatic;
- const char *memberName = key( it, isStatic );
- const Value &aValue = value( it );
- resolveReference(memberName, isStatic) = aValue;
- }
-}
-
-
-ValueInternalMap &
-ValueInternalMap::operator =( const ValueInternalMap &other )
-{
- ValueInternalMap dummy( other );
- swap( dummy );
- return *this;
-}
-
-
-ValueInternalMap::~ValueInternalMap()
-{
- if ( buckets_ )
- {
- for ( BucketIndex bucketIndex =0; bucketIndex < bucketsSize_; ++bucketIndex )
- {
- ValueInternalLink *link = buckets_[bucketIndex].next_;
- while ( link )
- {
- ValueInternalLink *linkToRelease = link;
- link = link->next_;
- mapAllocator()->releaseMapLink( linkToRelease );
- }
- }
- mapAllocator()->releaseMapBuckets( buckets_ );
- }
-}
-
-
-void
-ValueInternalMap::swap( ValueInternalMap &other )
-{
- ValueInternalLink *tempBuckets = buckets_;
- buckets_ = other.buckets_;
- other.buckets_ = tempBuckets;
- ValueInternalLink *tempTailLink = tailLink_;
- tailLink_ = other.tailLink_;
- other.tailLink_ = tempTailLink;
- BucketIndex tempBucketsSize = bucketsSize_;
- bucketsSize_ = other.bucketsSize_;
- other.bucketsSize_ = tempBucketsSize;
- BucketIndex tempItemCount = itemCount_;
- itemCount_ = other.itemCount_;
- other.itemCount_ = tempItemCount;
-}
-
-
-void
-ValueInternalMap::clear()
-{
- ValueInternalMap dummy;
- swap( dummy );
-}
-
-
-ValueInternalMap::BucketIndex
-ValueInternalMap::size() const
-{
- return itemCount_;
-}
-
-bool
-ValueInternalMap::reserveDelta( BucketIndex growth )
-{
- return reserve( itemCount_ + growth );
-}
-
-bool
-ValueInternalMap::reserve( BucketIndex newItemCount )
-{
- if ( !buckets_ && newItemCount > 0 )
- {
- buckets_ = mapAllocator()->allocateMapBuckets( 1 );
- bucketsSize_ = 1;
- tailLink_ = &buckets_[0];
- }
-// BucketIndex idealBucketCount = (newItemCount + ValueInternalLink::itemPerLink) / ValueInternalLink::itemPerLink;
- return true;
-}
-
-
-const Value *
-ValueInternalMap::find( const char *key ) const
-{
- if ( !bucketsSize_ )
- return 0;
- HashKey hashedKey = hash( key );
- BucketIndex bucketIndex = hashedKey % bucketsSize_;
- for ( const ValueInternalLink *current = &buckets_[bucketIndex];
- current != 0;
- current = current->next_ )
- {
- for ( BucketIndex index=0; index < ValueInternalLink::itemPerLink; ++index )
- {
- if ( current->items_[index].isItemAvailable() )
- return 0;
- if ( strcmp( key, current->keys_[index] ) == 0 )
- return &current->items_[index];
- }
- }
- return 0;
-}
-
-
-Value *
-ValueInternalMap::find( const char *key )
-{
- const ValueInternalMap *constThis = this;
- return const_cast<Value *>( constThis->find( key ) );
-}
-
-
-Value &
-ValueInternalMap::resolveReference( const char *key,
- bool isStatic )
-{
- HashKey hashedKey = hash( key );
- if ( bucketsSize_ )
- {
- BucketIndex bucketIndex = hashedKey % bucketsSize_;
- ValueInternalLink **previous = 0;
- BucketIndex index;
- for ( ValueInternalLink *current = &buckets_[bucketIndex];
- current != 0;
- previous = &current->next_, current = current->next_ )
- {
- for ( index=0; index < ValueInternalLink::itemPerLink; ++index )
- {
- if ( current->items_[index].isItemAvailable() )
- return setNewItem( key, isStatic, current, index );
- if ( strcmp( key, current->keys_[index] ) == 0 )
- return current->items_[index];
- }
- }
- }
-
- reserveDelta( 1 );
- return unsafeAdd( key, isStatic, hashedKey );
-}
-
-
-void
-ValueInternalMap::remove( const char *key )
-{
- HashKey hashedKey = hash( key );
- if ( !bucketsSize_ )
- return;
- BucketIndex bucketIndex = hashedKey % bucketsSize_;
- for ( ValueInternalLink *link = &buckets_[bucketIndex];
- link != 0;
- link = link->next_ )
- {
- BucketIndex index;
- for ( index =0; index < ValueInternalLink::itemPerLink; ++index )
- {
- if ( link->items_[index].isItemAvailable() )
- return;
- if ( strcmp( key, link->keys_[index] ) == 0 )
- {
- doActualRemove( link, index, bucketIndex );
- return;
- }
- }
- }
-}
-
-void
-ValueInternalMap::doActualRemove( ValueInternalLink *link,
- BucketIndex index,
- BucketIndex bucketIndex )
-{
- // find last item of the bucket and swap it with the 'removed' one.
- // set removed items flags to 'available'.
- // if last page only contains 'available' items, then desallocate it (it's empty)
- ValueInternalLink *&lastLink = getLastLinkInBucket( index );
- BucketIndex lastItemIndex = 1; // a link can never be empty, so start at 1
- for ( ;
- lastItemIndex < ValueInternalLink::itemPerLink;
- ++lastItemIndex ) // may be optimized with dicotomic search
- {
- if ( lastLink->items_[lastItemIndex].isItemAvailable() )
- break;
- }
-
- BucketIndex lastUsedIndex = lastItemIndex - 1;
- Value *valueToDelete = &link->items_[index];
- Value *valueToPreserve = &lastLink->items_[lastUsedIndex];
- if ( valueToDelete != valueToPreserve )
- valueToDelete->swap( *valueToPreserve );
- if ( lastUsedIndex == 0 ) // page is now empty
- { // remove it from bucket linked list and delete it.
- ValueInternalLink *linkPreviousToLast = lastLink->previous_;
- if ( linkPreviousToLast != 0 ) // can not deleted bucket link.
- {
- mapAllocator()->releaseMapLink( lastLink );
- linkPreviousToLast->next_ = 0;
- lastLink = linkPreviousToLast;
- }
- }
- else
- {
- Value dummy;
- valueToPreserve->swap( dummy ); // restore deleted to default Value.
- valueToPreserve->setItemUsed( false );
- }
- --itemCount_;
-}
-
-
-ValueInternalLink *&
-ValueInternalMap::getLastLinkInBucket( BucketIndex bucketIndex )
-{
- if ( bucketIndex == bucketsSize_ - 1 )
- return tailLink_;
- ValueInternalLink *&previous = buckets_[bucketIndex+1].previous_;
- if ( !previous )
- previous = &buckets_[bucketIndex];
- return previous;
-}
-
-
-Value &
-ValueInternalMap::setNewItem( const char *key,
- bool isStatic,
- ValueInternalLink *link,
- BucketIndex index )
-{
- char *duplicatedKey = makeMemberName( key );
- ++itemCount_;
- link->keys_[index] = duplicatedKey;
- link->items_[index].setItemUsed();
- link->items_[index].setMemberNameIsStatic( isStatic );
- return link->items_[index]; // items already default constructed.
-}
-
-
-Value &
-ValueInternalMap::unsafeAdd( const char *key,
- bool isStatic,
- HashKey hashedKey )
-{
- JSON_ASSERT_MESSAGE( bucketsSize_ > 0, "ValueInternalMap::unsafeAdd(): internal logic error." );
- BucketIndex bucketIndex = hashedKey % bucketsSize_;
- ValueInternalLink *&previousLink = getLastLinkInBucket( bucketIndex );
- ValueInternalLink *link = previousLink;
- BucketIndex index;
- for ( index =0; index < ValueInternalLink::itemPerLink; ++index )
- {
- if ( link->items_[index].isItemAvailable() )
- break;
- }
- if ( index == ValueInternalLink::itemPerLink ) // need to add a new page
- {
- ValueInternalLink *newLink = mapAllocator()->allocateMapLink();
- index = 0;
- link->next_ = newLink;
- previousLink = newLink;
- link = newLink;
- }
- return setNewItem( key, isStatic, link, index );
-}
-
-
-ValueInternalMap::HashKey
-ValueInternalMap::hash( const char *key ) const
-{
- HashKey hash = 0;
- while ( *key )
- hash += *key++ * 37;
- return hash;
-}
-
-
-int
-ValueInternalMap::compare( const ValueInternalMap &other ) const
-{
- int sizeDiff( itemCount_ - other.itemCount_ );
- if ( sizeDiff != 0 )
- return sizeDiff;
- // Strict order guaranty is required. Compare all keys FIRST, then compare values.
- IteratorState it;
- IteratorState itEnd;
- makeBeginIterator( it );
- makeEndIterator( itEnd );
- for ( ; !equals(it,itEnd); increment(it) )
- {
- if ( !other.find( key( it ) ) )
- return 1;
- }
-
- // All keys are equals, let's compare values
- makeBeginIterator( it );
- for ( ; !equals(it,itEnd); increment(it) )
- {
- const Value *otherValue = other.find( key( it ) );
- int valueDiff = value(it).compare( *otherValue );
- if ( valueDiff != 0 )
- return valueDiff;
- }
- return 0;
-}
-
-
-void
-ValueInternalMap::makeBeginIterator( IteratorState &it ) const
-{
- it.map_ = const_cast<ValueInternalMap *>( this );
- it.bucketIndex_ = 0;
- it.itemIndex_ = 0;
- it.link_ = buckets_;
-}
-
-
-void
-ValueInternalMap::makeEndIterator( IteratorState &it ) const
-{
- it.map_ = const_cast<ValueInternalMap *>( this );
- it.bucketIndex_ = bucketsSize_;
- it.itemIndex_ = 0;
- it.link_ = 0;
-}
-
-
-bool
-ValueInternalMap::equals( const IteratorState &x, const IteratorState &other )
-{
- return x.map_ == other.map_
- && x.bucketIndex_ == other.bucketIndex_
- && x.link_ == other.link_
- && x.itemIndex_ == other.itemIndex_;
-}
-
-
-void
-ValueInternalMap::incrementBucket( IteratorState &iterator )
-{
- ++iterator.bucketIndex_;
- JSON_ASSERT_MESSAGE( iterator.bucketIndex_ <= iterator.map_->bucketsSize_,
- "ValueInternalMap::increment(): attempting to iterate beyond end." );
- if ( iterator.bucketIndex_ == iterator.map_->bucketsSize_ )
- iterator.link_ = 0;
- else
- iterator.link_ = &(iterator.map_->buckets_[iterator.bucketIndex_]);
- iterator.itemIndex_ = 0;
-}
-
-
-void
-ValueInternalMap::increment( IteratorState &iterator )
-{
- JSON_ASSERT_MESSAGE( iterator.map_, "Attempting to iterator using invalid iterator." );
- ++iterator.itemIndex_;
- if ( iterator.itemIndex_ == ValueInternalLink::itemPerLink )
- {
- JSON_ASSERT_MESSAGE( iterator.link_ != 0,
- "ValueInternalMap::increment(): attempting to iterate beyond end." );
- iterator.link_ = iterator.link_->next_;
- if ( iterator.link_ == 0 )
- incrementBucket( iterator );
- }
- else if ( iterator.link_->items_[iterator.itemIndex_].isItemAvailable() )
- {
- incrementBucket( iterator );
- }
-}
-
-
-void
-ValueInternalMap::decrement( IteratorState &iterator )
-{
- if ( iterator.itemIndex_ == 0 )
- {
- JSON_ASSERT_MESSAGE( iterator.map_, "Attempting to iterate using invalid iterator." );
- if ( iterator.link_ == &iterator.map_->buckets_[iterator.bucketIndex_] )
- {
- JSON_ASSERT_MESSAGE( iterator.bucketIndex_ > 0, "Attempting to iterate beyond beginning." );
- --(iterator.bucketIndex_);
- }
- iterator.link_ = iterator.link_->previous_;
- iterator.itemIndex_ = ValueInternalLink::itemPerLink - 1;
- }
-}
-
-
-const char *
-ValueInternalMap::key( const IteratorState &iterator )
-{
- JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." );
- return iterator.link_->keys_[iterator.itemIndex_];
-}
-
-const char *
-ValueInternalMap::key( const IteratorState &iterator, bool &isStatic )
-{
- JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." );
- isStatic = iterator.link_->items_[iterator.itemIndex_].isMemberNameStatic();
- return iterator.link_->keys_[iterator.itemIndex_];
-}
-
-
-Value &
-ValueInternalMap::value( const IteratorState &iterator )
-{
- JSON_ASSERT_MESSAGE( iterator.link_, "Attempting to iterate using invalid iterator." );
- return iterator.link_->items_[iterator.itemIndex_];
-}
-
-
-int
-ValueInternalMap::distance( const IteratorState &x, const IteratorState &y )
-{
- int offset = 0;
- IteratorState it = x;
- while ( !equals( it, y ) )
- increment( it );
- return offset;
-}
-
-} // namespace Json
diff --git a/src/3rd_party-static/jsoncpp/src/lib_json/json_reader.cpp b/src/3rd_party-static/jsoncpp/src/lib_json/json_reader.cpp
deleted file mode 100644
index d0abe34811..0000000000
--- a/src/3rd_party-static/jsoncpp/src/lib_json/json_reader.cpp
+++ /dev/null
@@ -1,884 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#if !defined(JSON_IS_AMALGAMATION)
-# include <json/reader.h>
-# include <json/value.h>
-# include "json_tool.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-#include <utility>
-#include <cstdio>
-#include <cassert>
-#include <cstring>
-#include <iostream>
-#include <stdexcept>
-
-#if _MSC_VER >= 1400 // VC++ 8.0
-#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated.
-#endif
-
-namespace Json {
-
-// Implementation of class Features
-// ////////////////////////////////
-
-Features::Features()
- : allowComments_( true )
- , strictRoot_( false )
-{
-}
-
-
-Features
-Features::all()
-{
- return Features();
-}
-
-
-Features
-Features::strictMode()
-{
- Features features;
- features.allowComments_ = false;
- features.strictRoot_ = true;
- return features;
-}
-
-// Implementation of class Reader
-// ////////////////////////////////
-
-
-static inline bool
-in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4 )
-{
- return c == c1 || c == c2 || c == c3 || c == c4;
-}
-
-static inline bool
-in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4, Reader::Char c5 )
-{
- return c == c1 || c == c2 || c == c3 || c == c4 || c == c5;
-}
-
-
-static bool
-containsNewLine( Reader::Location begin,
- Reader::Location end )
-{
- for ( ;begin < end; ++begin )
- if ( *begin == '\n' || *begin == '\r' )
- return true;
- return false;
-}
-
-
-// Class Reader
-// //////////////////////////////////////////////////////////////////
-
-Reader::Reader()
- : features_( Features::all() )
-{
-}
-
-
-Reader::Reader( const Features &features )
- : features_( features )
-{
-}
-
-
-bool
-Reader::parse( const std::string &document,
- Value &root,
- bool collectComments )
-{
- document_ = document;
- const char *begin = document_.c_str();
- const char *end = begin + document_.length();
- return parse( begin, end, root, collectComments );
-}
-
-
-bool
-Reader::parse( std::istream& sin,
- Value &root,
- bool collectComments )
-{
- //std::istream_iterator<char> begin(sin);
- //std::istream_iterator<char> end;
- // Those would allow streamed input from a file, if parse() were a
- // template function.
-
- // Since std::string is reference-counted, this at least does not
- // create an extra copy.
- std::string doc;
- std::getline(sin, doc, (char)EOF);
- return parse( doc, root, collectComments );
-}
-
-bool
-Reader::parse( const char *beginDoc, const char *endDoc,
- Value &root,
- bool collectComments )
-{
- if ( !features_.allowComments_ )
- {
- collectComments = false;
- }
-
- begin_ = beginDoc;
- end_ = endDoc;
- collectComments_ = collectComments;
- current_ = begin_;
- lastValueEnd_ = 0;
- lastValue_ = 0;
- commentsBefore_ = "";
- errors_.clear();
- while ( !nodes_.empty() )
- nodes_.pop();
- nodes_.push( &root );
-
- bool successful = readValue();
- Token token;
- skipCommentTokens( token );
- if ( collectComments_ && !commentsBefore_.empty() )
- root.setComment( commentsBefore_, commentAfter );
- if ( features_.strictRoot_ )
- {
- if ( !root.isArray() && !root.isObject() )
- {
- // Set error location to start of doc, ideally should be first token found in doc
- token.type_ = tokenError;
- token.start_ = beginDoc;
- token.end_ = endDoc;
- addError( "A valid JSON document must be either an array or an object value.",
- token );
- return false;
- }
- }
- return successful;
-}
-
-
-bool
-Reader::readValue()
-{
- Token token;
- skipCommentTokens( token );
- bool successful = true;
-
- if ( collectComments_ && !commentsBefore_.empty() )
- {
- currentValue().setComment( commentsBefore_, commentBefore );
- commentsBefore_ = "";
- }
-
-
- switch ( token.type_ )
- {
- case tokenObjectBegin:
- successful = readObject( token );
- break;
- case tokenArrayBegin:
- successful = readArray( token );
- break;
- case tokenNumber:
- successful = decodeNumber( token );
- break;
- case tokenString:
- successful = decodeString( token );
- break;
- case tokenTrue:
- currentValue() = true;
- break;
- case tokenFalse:
- currentValue() = false;
- break;
- case tokenNull:
- currentValue() = Value();
- break;
- default:
- return addError( "Syntax error: value, object or array expected.", token );
- }
-
- if ( collectComments_ )
- {
- lastValueEnd_ = current_;
- lastValue_ = &currentValue();
- }
-
- return successful;
-}
-
-
-void
-Reader::skipCommentTokens( Token &token )
-{
- if ( features_.allowComments_ )
- {
- do
- {
- readToken( token );
- }
- while ( token.type_ == tokenComment );
- }
- else
- {
- readToken( token );
- }
-}
-
-
-bool
-Reader::expectToken( TokenType type, Token &token, const char *message )
-{
- readToken( token );
- if ( token.type_ != type )
- return addError( message, token );
- return true;
-}
-
-
-bool
-Reader::readToken( Token &token )
-{
- skipSpaces();
- token.start_ = current_;
- Char c = getNextChar();
- bool ok = true;
- switch ( c )
- {
- case '{':
- token.type_ = tokenObjectBegin;
- break;
- case '}':
- token.type_ = tokenObjectEnd;
- break;
- case '[':
- token.type_ = tokenArrayBegin;
- break;
- case ']':
- token.type_ = tokenArrayEnd;
- break;
- case '"':
- token.type_ = tokenString;
- ok = readString();
- break;
- case '/':
- token.type_ = tokenComment;
- ok = readComment();
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '-':
- token.type_ = tokenNumber;
- readNumber();
- break;
- case 'T':
- case 't':
- token.type_ = tokenTrue;
- ok = match( "rue", 3 );
- break;
- case 'F':
- case 'f':
- token.type_ = tokenFalse;
- ok = match( "alse", 4 );
- break;
- case 'N':
- case 'n':
- token.type_ = tokenNull;
- ok = match( "ull", 3 );
- break;
- case ',':
- token.type_ = tokenArraySeparator;
- break;
- case ':':
- token.type_ = tokenMemberSeparator;
- break;
- case 0:
- token.type_ = tokenEndOfStream;
- break;
- default:
- ok = false;
- break;
- }
- if ( !ok )
- token.type_ = tokenError;
- token.end_ = current_;
- return true;
-}
-
-
-void
-Reader::skipSpaces()
-{
- while ( current_ != end_ )
- {
- Char c = *current_;
- if ( c == ' ' || c == '\t' || c == '\r' || c == '\n' )
- ++current_;
- else
- break;
- }
-}
-
-
-bool
-Reader::match( Location pattern,
- int patternLength )
-{
- if ( end_ - current_ < patternLength )
- return false;
- int index = patternLength;
- while ( index-- )
- if ( current_[index] != pattern[index] )
- return false;
- current_ += patternLength;
- return true;
-}
-
-
-bool
-Reader::readComment()
-{
- Location commentBegin = current_ - 1;
- Char c = getNextChar();
- bool successful = false;
- if ( c == '*' )
- successful = readCStyleComment();
- else if ( c == '/' )
- successful = readCppStyleComment();
- if ( !successful )
- return false;
-
- if ( collectComments_ )
- {
- CommentPlacement placement = commentBefore;
- if ( lastValueEnd_ && !containsNewLine( lastValueEnd_, commentBegin ) )
- {
- if ( c != '*' || !containsNewLine( commentBegin, current_ ) )
- placement = commentAfterOnSameLine;
- }
-
- addComment( commentBegin, current_, placement );
- }
- return true;
-}
-
-
-void
-Reader::addComment( Location begin,
- Location end,
- CommentPlacement placement )
-{
- assert( collectComments_ );
- if ( placement == commentAfterOnSameLine )
- {
- assert( lastValue_ != 0 );
- lastValue_->setComment( std::string( begin, end ), placement );
- }
- else
- {
- if ( !commentsBefore_.empty() )
- commentsBefore_ += "\n";
- commentsBefore_ += std::string( begin, end );
- }
-}
-
-
-bool
-Reader::readCStyleComment()
-{
- while ( current_ != end_ )
- {
- Char c = getNextChar();
- if ( c == '*' && *current_ == '/' )
- break;
- }
- return getNextChar() == '/';
-}
-
-
-bool
-Reader::readCppStyleComment()
-{
- while ( current_ != end_ )
- {
- Char c = getNextChar();
- if ( c == '\r' || c == '\n' )
- break;
- }
- return true;
-}
-
-
-void
-Reader::readNumber()
-{
- while ( current_ != end_ )
- {
- if ( !(*current_ >= '0' && *current_ <= '9') &&
- !in( *current_, '.', 'e', 'E', '+', '-' ) )
- break;
- ++current_;
- }
-}
-
-bool
-Reader::readString()
-{
- Char c = 0;
- while ( current_ != end_ )
- {
- c = getNextChar();
- if ( c == '\\' )
- getNextChar();
- else if ( c == '"' )
- break;
- }
- return c == '"';
-}
-
-
-bool
-Reader::readObject( Token &/*tokenStart*/ )
-{
- Token tokenName;
- std::string name;
- currentValue() = Value( objectValue );
- while ( readToken( tokenName ) )
- {
- bool initialTokenOk = true;
- while ( tokenName.type_ == tokenComment && initialTokenOk )
- initialTokenOk = readToken( tokenName );
- if ( !initialTokenOk )
- break;
- if ( tokenName.type_ == tokenObjectEnd && name.empty() ) // empty object
- return true;
- if ( tokenName.type_ != tokenString )
- break;
-
- name = "";
- if ( !decodeString( tokenName, name ) )
- return recoverFromError( tokenObjectEnd );
-
- Token colon;
- if ( !readToken( colon ) || colon.type_ != tokenMemberSeparator )
- {
- return addErrorAndRecover( "Missing ':' after object member name",
- colon,
- tokenObjectEnd );
- }
- Value &value = currentValue()[ name ];
- nodes_.push( &value );
- bool ok = readValue();
- nodes_.pop();
- if ( !ok ) // error already set
- return recoverFromError( tokenObjectEnd );
-
- Token comma;
- if ( !readToken( comma )
- || ( comma.type_ != tokenObjectEnd &&
- comma.type_ != tokenArraySeparator &&
- comma.type_ != tokenComment ) )
- {
- return addErrorAndRecover( "Missing ',' or '}' in object declaration",
- comma,
- tokenObjectEnd );
- }
- bool finalizeTokenOk = true;
- while ( comma.type_ == tokenComment &&
- finalizeTokenOk )
- finalizeTokenOk = readToken( comma );
- if ( comma.type_ == tokenObjectEnd )
- return true;
- }
- return addErrorAndRecover( "Missing '}' or object member name",
- tokenName,
- tokenObjectEnd );
-}
-
-
-bool
-Reader::readArray( Token &/*tokenStart*/ )
-{
- currentValue() = Value( arrayValue );
- skipSpaces();
- if ( *current_ == ']' ) // empty array
- {
- Token endArray;
- readToken( endArray );
- return true;
- }
- int index = 0;
- for (;;)
- {
- Value &value = currentValue()[ index++ ];
- nodes_.push( &value );
- bool ok = readValue();
- nodes_.pop();
- if ( !ok ) // error already set
- return recoverFromError( tokenArrayEnd );
-
- Token token;
- // Accept Comment after last item in the array.
- ok = readToken( token );
- while ( token.type_ == tokenComment && ok )
- {
- ok = readToken( token );
- }
- bool badTokenType = ( token.type_ != tokenArraySeparator &&
- token.type_ != tokenArrayEnd );
- if ( !ok || badTokenType )
- {
- return addErrorAndRecover( "Missing ',' or ']' in array declaration",
- token,
- tokenArrayEnd );
- }
- if ( token.type_ == tokenArrayEnd )
- break;
- }
- return true;
-}
-
-
-bool
-Reader::decodeNumber( Token &token )
-{
- bool isDouble = false;
- for ( Location inspect = token.start_; inspect != token.end_; ++inspect )
- {
- isDouble = isDouble
- || in( *inspect, '.', 'e', 'E', '+' )
- || ( *inspect == '-' && inspect != token.start_ );
- }
- if ( isDouble )
- return decodeDouble( token );
- // Attempts to parse the number as an integer. If the number is
- // larger than the maximum supported value of an integer then
- // we decode the number as a double.
- Location current = token.start_;
- bool isNegative = *current == '-';
- if ( isNegative )
- ++current;
- Value::LargestUInt maxIntegerValue = isNegative ? Value::LargestUInt(-Value::minLargestInt)
- : Value::maxLargestUInt;
- Value::LargestUInt threshold = maxIntegerValue / 10;
- Value::UInt lastDigitThreshold = Value::UInt( maxIntegerValue % 10 );
- assert(lastDigitThreshold <= 9 );
- Value::LargestUInt value = 0;
- while ( current < token.end_ )
- {
- Char c = *current++;
- if ( c < '0' || c > '9' )
- return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token );
- Value::UInt digit(c - '0');
- if ( value >= threshold )
- {
- // If the current digit is not the last one, or if it is
- // greater than the last digit of the maximum integer value,
- // the parse the number as a double.
- if ( current != token.end_ || digit > lastDigitThreshold )
- {
- return decodeDouble( token );
- }
- }
- value = value * 10 + digit;
- }
- if ( isNegative )
- currentValue() = -Value::LargestInt( value );
- else if ( value <= Value::LargestUInt(Value::maxInt) )
- currentValue() = Value::LargestInt( value );
- else
- currentValue() = value;
- return true;
-}
-
-
-bool
-Reader::decodeDouble( Token &token )
-{
- double value = 0;
- const int bufferSize = 32;
- int count;
- int length = int(token.end_ - token.start_);
- if ( length <= bufferSize )
- {
- Char buffer[bufferSize+1];
- memcpy( buffer, token.start_, length );
- buffer[length] = 0;
- count = sscanf( buffer, "%lf", &value );
- }
- else
- {
- std::string buffer( token.start_, token.end_ );
- count = sscanf( buffer.c_str(), "%lf", &value );
- }
-
- if ( count != 1 )
- return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token );
- currentValue() = value;
- return true;
-}
-
-
-bool
-Reader::decodeString( Token &token )
-{
- std::string decoded;
- if ( !decodeString( token, decoded ) )
- return false;
- currentValue() = decoded;
- return true;
-}
-
-
-bool
-Reader::decodeString( Token &token, std::string &decoded )
-{
- decoded.reserve( token.end_ - token.start_ - 2 );
- Location current = token.start_ + 1; // skip '"'
- Location end = token.end_ - 1; // do not include '"'
- while ( current != end )
- {
- Char c = *current++;
- if ( c == '"' )
- break;
- else if ( c == '\\' )
- {
- if ( current == end )
- return addError( "Empty escape sequence in string", token, current );
- Char escape = *current++;
- switch ( escape )
- {
- case '"': decoded += '"'; break;
- case '\'': decoded += '\''; break;
- case '/': decoded += '/'; break;
- case '\\': decoded += '\\'; break;
- case 'b': decoded += '\b'; break;
- case 'f': decoded += '\f'; break;
- case 'n': decoded += '\n'; break;
- case 'r': decoded += '\r'; break;
- case 't': decoded += '\t'; break;
- case 'u':
- {
- unsigned int unicode;
- if ( !decodeUnicodeCodePoint( token, current, end, unicode ) )
- return false;
- decoded += codePointToUTF8(unicode);
- }
- break;
- default:
- return addError( "Bad escape sequence in string", token, current );
- }
- }
- else
- {
- decoded += c;
- }
- }
- return true;
-}
-
-bool
-Reader::decodeUnicodeCodePoint( Token &token,
- Location &current,
- Location end,
- unsigned int &unicode )
-{
-
- if ( !decodeUnicodeEscapeSequence( token, current, end, unicode ) )
- return false;
- if (unicode >= 0xD800 && unicode <= 0xDBFF)
- {
- // surrogate pairs
- if (end - current < 6)
- return addError( "additional six characters expected to parse unicode surrogate pair.", token, current );
- unsigned int surrogatePair;
- if (*(current++) == '\\' && *(current++)== 'u')
- {
- if (decodeUnicodeEscapeSequence( token, current, end, surrogatePair ))
- {
- unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF);
- }
- else
- return false;
- }
- else
- return addError( "expecting another \\u token to begin the second half of a unicode surrogate pair", token, current );
- }
- return true;
-}
-
-bool
-Reader::decodeUnicodeEscapeSequence( Token &token,
- Location &current,
- Location end,
- unsigned int &unicode )
-{
- if ( end - current < 4 )
- return addError( "Bad unicode escape sequence in string: four digits expected.", token, current );
- unicode = 0;
- for ( int index =0; index < 4; ++index )
- {
- Char c = *current++;
- unicode *= 16;
- if ( c >= '0' && c <= '9' )
- unicode += c - '0';
- else if ( c >= 'a' && c <= 'f' )
- unicode += c - 'a' + 10;
- else if ( c >= 'A' && c <= 'F' )
- unicode += c - 'A' + 10;
- else
- return addError( "Bad unicode escape sequence in string: hexadecimal digit expected.", token, current );
- }
- return true;
-}
-
-
-bool
-Reader::addError( const std::string &message,
- Token &token,
- Location extra )
-{
- ErrorInfo info;
- info.token_ = token;
- info.message_ = message;
- info.extra_ = extra;
- errors_.push_back( info );
- return false;
-}
-
-
-bool
-Reader::recoverFromError( TokenType skipUntilToken )
-{
- int errorCount = int(errors_.size());
- Token skip;
- for (;;)
- {
- if ( !readToken(skip) )
- errors_.resize( errorCount ); // discard errors caused by recovery
- if ( skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream )
- break;
- }
- errors_.resize( errorCount );
- return false;
-}
-
-
-bool
-Reader::addErrorAndRecover( const std::string &message,
- Token &token,
- TokenType skipUntilToken )
-{
- addError( message, token );
- return recoverFromError( skipUntilToken );
-}
-
-
-Value &
-Reader::currentValue()
-{
- return *(nodes_.top());
-}
-
-
-Reader::Char
-Reader::getNextChar()
-{
- if ( current_ == end_ )
- return 0;
- return *current_++;
-}
-
-
-void
-Reader::getLocationLineAndColumn( Location location,
- int &line,
- int &column ) const
-{
- Location current = begin_;
- Location lastLineStart = current;
- line = 0;
- while ( current < location && current != end_ )
- {
- Char c = *current++;
- if ( c == '\r' )
- {
- if ( *current == '\n' )
- ++current;
- lastLineStart = current;
- ++line;
- }
- else if ( c == '\n' )
- {
- lastLineStart = current;
- ++line;
- }
- }
- // column & line start at 1
- column = int(location - lastLineStart) + 1;
- ++line;
-}
-
-
-std::string
-Reader::getLocationLineAndColumn( Location location ) const
-{
- int line, column;
- getLocationLineAndColumn( location, line, column );
- char buffer[18+16+16+1];
- sprintf( buffer, "Line %d, Column %d", line, column );
- return buffer;
-}
-
-
-// Deprecated. Preserved for backward compatibility
-std::string
-Reader::getFormatedErrorMessages() const
-{
- return getFormattedErrorMessages();
-}
-
-
-std::string
-Reader::getFormattedErrorMessages() const
-{
- std::string formattedMessage;
- for ( Errors::const_iterator itError = errors_.begin();
- itError != errors_.end();
- ++itError )
- {
- const ErrorInfo &error = *itError;
- formattedMessage += "* " + getLocationLineAndColumn( error.token_.start_ ) + "\n";
- formattedMessage += " " + error.message_ + "\n";
- if ( error.extra_ )
- formattedMessage += "See " + getLocationLineAndColumn( error.extra_ ) + " for detail.\n";
- }
- return formattedMessage;
-}
-
-
-std::istream& operator>>( std::istream &sin, Value &root )
-{
- Json::Reader reader;
- bool ok = reader.parse(sin, root, true);
- //JSON_ASSERT( ok );
- if (!ok) throw std::runtime_error(reader.getFormattedErrorMessages());
- return sin;
-}
-
-
-} // namespace Json
diff --git a/src/3rd_party-static/jsoncpp/src/lib_json/json_tool.h b/src/3rd_party-static/jsoncpp/src/lib_json/json_tool.h
deleted file mode 100644
index 658031bbba..0000000000
--- a/src/3rd_party-static/jsoncpp/src/lib_json/json_tool.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
-# define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
-
-/* This header provides common string manipulation support, such as UTF-8,
- * portable conversion from/to string...
- *
- * It is an internal header that must not be exposed.
- */
-
-namespace Json {
-
-/// Converts a unicode code-point to UTF-8.
-static inline std::string
-codePointToUTF8(unsigned int cp)
-{
- std::string result;
-
- // based on description from http://en.wikipedia.org/wiki/UTF-8
-
- if (cp <= 0x7f)
- {
- result.resize(1);
- result[0] = static_cast<char>(cp);
- }
- else if (cp <= 0x7FF)
- {
- result.resize(2);
- result[1] = static_cast<char>(0x80 | (0x3f & cp));
- result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6)));
- }
- else if (cp <= 0xFFFF)
- {
- result.resize(3);
- result[2] = static_cast<char>(0x80 | (0x3f & cp));
- result[1] = 0x80 | static_cast<char>((0x3f & (cp >> 6)));
- result[0] = 0xE0 | static_cast<char>((0xf & (cp >> 12)));
- }
- else if (cp <= 0x10FFFF)
- {
- result.resize(4);
- result[3] = static_cast<char>(0x80 | (0x3f & cp));
- result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
- result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12)));
- result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18)));
- }
-
- return result;
-}
-
-
-/// Returns true if ch is a control character (in range [0,32[).
-static inline bool
-isControlCharacter(char ch)
-{
- return ch > 0 && ch <= 0x1F;
-}
-
-
-enum {
- /// Constant that specify the size of the buffer that must be passed to uintToString.
- uintToStringBufferSize = 3*sizeof(LargestUInt)+1
-};
-
-// Defines a char buffer for use with uintToString().
-typedef char UIntToStringBuffer[uintToStringBufferSize];
-
-
-/** Converts an unsigned integer to string.
- * @param value Unsigned interger to convert to string
- * @param current Input/Output string buffer.
- * Must have at least uintToStringBufferSize chars free.
- */
-static inline void
-uintToString( LargestUInt value,
- char *&current )
-{
- *--current = 0;
- do
- {
- *--current = char(value % 10) + '0';
- value /= 10;
- }
- while ( value != 0 );
-}
-
-} // namespace Json {
-
-#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
diff --git a/src/3rd_party-static/jsoncpp/src/lib_json/json_value.cpp b/src/3rd_party-static/jsoncpp/src/lib_json/json_value.cpp
deleted file mode 100644
index d063c369a3..0000000000
--- a/src/3rd_party-static/jsoncpp/src/lib_json/json_value.cpp
+++ /dev/null
@@ -1,1830 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#if !defined(JSON_IS_AMALGAMATION)
-# include <json/value.h>
-# include <json/writer.h>
-# ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
-# include "json_batchallocator.h"
-# endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR
-#endif // if !defined(JSON_IS_AMALGAMATION)
-#include <iostream>
-#include <utility>
-#include <stdexcept>
-#include <cstring>
-#include <cassert>
-#ifdef JSON_USE_CPPTL
-# include <cpptl/conststring.h>
-#endif
-#include <cstddef> // size_t
-
-#define JSON_ASSERT_UNREACHABLE assert( false )
-#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw
-#define JSON_FAIL_MESSAGE( message ) throw std::runtime_error( message );
-#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) JSON_FAIL_MESSAGE( message )
-
-namespace Json {
-
-const Value Value::null;
-const Int Value::minInt = Int( ~(UInt(-1)/2) );
-const Int Value::maxInt = Int( UInt(-1)/2 );
-const UInt Value::maxUInt = UInt(-1);
-const Int64 Value::minInt64 = Int64( ~(UInt64(-1)/2) );
-const Int64 Value::maxInt64 = Int64( UInt64(-1)/2 );
-const UInt64 Value::maxUInt64 = UInt64(-1);
-const LargestInt Value::minLargestInt = LargestInt( ~(LargestUInt(-1)/2) );
-const LargestInt Value::maxLargestInt = LargestInt( LargestUInt(-1)/2 );
-const LargestUInt Value::maxLargestUInt = LargestUInt(-1);
-
-
-/// Unknown size marker
-static const unsigned int unknown = (unsigned)-1;
-
-
-/** Duplicates the specified string value.
- * @param value Pointer to the string to duplicate. Must be zero-terminated if
- * length is "unknown".
- * @param length Length of the value. if equals to unknown, then it will be
- * computed using strlen(value).
- * @return Pointer on the duplicate instance of string.
- */
-static inline char *
-duplicateStringValue( const char *value,
- unsigned int length = unknown )
-{
- if ( length == unknown )
- length = (unsigned int)strlen(value);
- char *newString = static_cast<char *>( malloc( length + 1 ) );
- JSON_ASSERT_MESSAGE( newString != 0, "Failed to allocate string value buffer" );
- memcpy( newString, value, length );
- newString[length] = 0;
- return newString;
-}
-
-
-/** Free the string duplicated by duplicateStringValue().
- */
-static inline void
-releaseStringValue( char *value )
-{
- if ( value )
- free( value );
-}
-
-} // namespace Json
-
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// ValueInternals...
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-#if !defined(JSON_IS_AMALGAMATION)
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
-# include "json_internalarray.inl"
-# include "json_internalmap.inl"
-# endif // JSON_VALUE_USE_INTERNAL_MAP
-
-# include "json_valueiterator.inl"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-
-namespace Json {
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class Value::CommentInfo
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-
-Value::CommentInfo::CommentInfo()
- : comment_( 0 )
-{
-}
-
-Value::CommentInfo::~CommentInfo()
-{
- if ( comment_ )
- releaseStringValue( comment_ );
-}
-
-
-void
-Value::CommentInfo::setComment( const char *text )
-{
- if ( comment_ )
- releaseStringValue( comment_ );
- JSON_ASSERT( text != 0 );
- JSON_ASSERT_MESSAGE( text[0]=='\0' || text[0]=='/', "Comments must start with /");
- // It seems that /**/ style comments are acceptable as well.
- comment_ = duplicateStringValue( text );
-}
-
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class Value::CZString
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-# ifndef JSON_VALUE_USE_INTERNAL_MAP
-
-// Notes: index_ indicates if the string was allocated when
-// a string is stored.
-
-Value::CZString::CZString( ArrayIndex index )
- : cstr_( 0 )
- , index_( index )
-{
-}
-
-Value::CZString::CZString( const char *cstr, DuplicationPolicy allocate )
- : cstr_( allocate == duplicate ? duplicateStringValue(cstr)
- : cstr )
- , index_( allocate )
-{
-}
-
-Value::CZString::CZString( const CZString &other )
-: cstr_( other.index_ != noDuplication && other.cstr_ != 0
- ? duplicateStringValue( other.cstr_ )
- : other.cstr_ )
- , index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate)
- : other.index_ )
-{
-}
-
-Value::CZString::~CZString()
-{
- if ( cstr_ && index_ == duplicate )
- releaseStringValue( const_cast<char *>( cstr_ ) );
-}
-
-void
-Value::CZString::swap( CZString &other )
-{
- std::swap( cstr_, other.cstr_ );
- std::swap( index_, other.index_ );
-}
-
-Value::CZString &
-Value::CZString::operator =( const CZString &other )
-{
- CZString temp( other );
- swap( temp );
- return *this;
-}
-
-bool
-Value::CZString::operator<( const CZString &other ) const
-{
- if ( cstr_ )
- return strcmp( cstr_, other.cstr_ ) < 0;
- return index_ < other.index_;
-}
-
-bool
-Value::CZString::operator==( const CZString &other ) const
-{
- if ( cstr_ )
- return strcmp( cstr_, other.cstr_ ) == 0;
- return index_ == other.index_;
-}
-
-
-ArrayIndex
-Value::CZString::index() const
-{
- return index_;
-}
-
-
-const char *
-Value::CZString::c_str() const
-{
- return cstr_;
-}
-
-bool
-Value::CZString::isStaticString() const
-{
- return index_ == noDuplication;
-}
-
-#endif // ifndef JSON_VALUE_USE_INTERNAL_MAP
-
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class Value::Value
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-/*! \internal Default constructor initialization must be equivalent to:
- * memset( this, 0, sizeof(Value) )
- * This optimization is used in ValueInternalMap fast allocator.
- */
-Value::Value( ValueType type )
- : type_( type )
- , allocated_( 0 )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- switch ( type )
- {
- case nullValue:
- break;
- case intValue:
- case uintValue:
- value_.int_ = 0;
- break;
- case realValue:
- value_.real_ = 0.0;
- break;
- case stringValue:
- value_.string_ = 0;
- break;
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- case arrayValue:
- case objectValue:
- value_.map_ = new ObjectValues();
- break;
-#else
- case arrayValue:
- value_.array_ = arrayAllocator()->newArray();
- break;
- case objectValue:
- value_.map_ = mapAllocator()->newMap();
- break;
-#endif
- case booleanValue:
- value_.bool_ = false;
- break;
- default:
- JSON_ASSERT_UNREACHABLE;
- }
-}
-
-
-#if defined(JSON_HAS_INT64)
-Value::Value( UInt value )
- : type_( uintValue )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- value_.uint_ = value;
-}
-
-Value::Value( Int value )
- : type_( intValue )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- value_.int_ = value;
-}
-
-#endif // if defined(JSON_HAS_INT64)
-
-
-Value::Value( Int64 value )
- : type_( intValue )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- value_.int_ = value;
-}
-
-
-Value::Value( UInt64 value )
- : type_( uintValue )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- value_.uint_ = value;
-}
-
-Value::Value( double value )
- : type_( realValue )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- value_.real_ = value;
-}
-
-Value::Value( const char *value )
- : type_( stringValue )
- , allocated_( true )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- value_.string_ = duplicateStringValue( value );
-}
-
-
-Value::Value( const char *beginValue,
- const char *endValue )
- : type_( stringValue )
- , allocated_( true )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- value_.string_ = duplicateStringValue( beginValue,
- (unsigned int)(endValue - beginValue) );
-}
-
-
-Value::Value( const std::string &value )
- : type_( stringValue )
- , allocated_( true )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- value_.string_ = duplicateStringValue( value.c_str(),
- (unsigned int)value.length() );
-
-}
-
-Value::Value( const StaticString &value )
- : type_( stringValue )
- , allocated_( false )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- value_.string_ = const_cast<char *>( value.c_str() );
-}
-
-
-# ifdef JSON_USE_CPPTL
-Value::Value( const CppTL::ConstString &value )
- : type_( stringValue )
- , allocated_( true )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- value_.string_ = duplicateStringValue( value, value.length() );
-}
-# endif
-
-Value::Value( bool value )
- : type_( booleanValue )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- value_.bool_ = value;
-}
-
-
-Value::Value( const Value &other )
- : type_( other.type_ )
- , comments_( 0 )
-# ifdef JSON_VALUE_USE_INTERNAL_MAP
- , itemIsUsed_( 0 )
-#endif
-{
- switch ( type_ )
- {
- case nullValue:
- case intValue:
- case uintValue:
- case realValue:
- case booleanValue:
- value_ = other.value_;
- break;
- case stringValue:
- if ( other.value_.string_ )
- {
- value_.string_ = duplicateStringValue( other.value_.string_ );
- allocated_ = true;
- }
- else
- value_.string_ = 0;
- break;
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- case arrayValue:
- case objectValue:
- value_.map_ = new ObjectValues( *other.value_.map_ );
- break;
-#else
- case arrayValue:
- value_.array_ = arrayAllocator()->newArrayCopy( *other.value_.array_ );
- break;
- case objectValue:
- value_.map_ = mapAllocator()->newMapCopy( *other.value_.map_ );
- break;
-#endif
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- if ( other.comments_ )
- {
- comments_ = new CommentInfo[numberOfCommentPlacement];
- for ( int comment =0; comment < numberOfCommentPlacement; ++comment )
- {
- const CommentInfo &otherComment = other.comments_[comment];
- if ( otherComment.comment_ )
- comments_[comment].setComment( otherComment.comment_ );
- }
- }
-}
-
-
-Value::~Value()
-{
- switch ( type_ )
- {
- case nullValue:
- case intValue:
- case uintValue:
- case realValue:
- case booleanValue:
- break;
- case stringValue:
- if ( allocated_ )
- releaseStringValue( value_.string_ );
- break;
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- case arrayValue:
- case objectValue:
- delete value_.map_;
- break;
-#else
- case arrayValue:
- arrayAllocator()->destructArray( value_.array_ );
- break;
- case objectValue:
- mapAllocator()->destructMap( value_.map_ );
- break;
-#endif
- default:
- JSON_ASSERT_UNREACHABLE;
- }
-
- if ( comments_ )
- delete[] comments_;
-}
-
-Value &
-Value::operator=( const Value &other )
-{
- Value temp( other );
- swap( temp );
- return *this;
-}
-
-void
-Value::swap( Value &other )
-{
- ValueType temp = type_;
- type_ = other.type_;
- other.type_ = temp;
- std::swap( value_, other.value_ );
- int temp2 = allocated_;
- allocated_ = other.allocated_;
- other.allocated_ = temp2;
-}
-
-ValueType
-Value::type() const
-{
- return type_;
-}
-
-
-int
-Value::compare( const Value &other ) const
-{
- if ( *this < other )
- return -1;
- if ( *this > other )
- return 1;
- return 0;
-}
-
-
-bool
-Value::operator <( const Value &other ) const
-{
- int typeDelta = type_ - other.type_;
- if ( typeDelta )
- return typeDelta < 0 ? true : false;
- switch ( type_ )
- {
- case nullValue:
- return false;
- case intValue:
- return value_.int_ < other.value_.int_;
- case uintValue:
- return value_.uint_ < other.value_.uint_;
- case realValue:
- return value_.real_ < other.value_.real_;
- case booleanValue:
- return value_.bool_ < other.value_.bool_;
- case stringValue:
- return ( value_.string_ == 0 && other.value_.string_ )
- || ( other.value_.string_
- && value_.string_
- && strcmp( value_.string_, other.value_.string_ ) < 0 );
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- case arrayValue:
- case objectValue:
- {
- int delta = int( value_.map_->size() - other.value_.map_->size() );
- if ( delta )
- return delta < 0;
- return (*value_.map_) < (*other.value_.map_);
- }
-#else
- case arrayValue:
- return value_.array_->compare( *(other.value_.array_) ) < 0;
- case objectValue:
- return value_.map_->compare( *(other.value_.map_) ) < 0;
-#endif
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return false; // unreachable
-}
-
-bool
-Value::operator <=( const Value &other ) const
-{
- return !(other < *this);
-}
-
-bool
-Value::operator >=( const Value &other ) const
-{
- return !(*this < other);
-}
-
-bool
-Value::operator >( const Value &other ) const
-{
- return other < *this;
-}
-
-bool
-Value::operator ==( const Value &other ) const
-{
- //if ( type_ != other.type_ )
- // GCC 2.95.3 says:
- // attempt to take address of bit-field structure member `Json::Value::type_'
- // Beats me, but a temp solves the problem.
- int temp = other.type_;
- if ( type_ != temp )
- return false;
- switch ( type_ )
- {
- case nullValue:
- return true;
- case intValue:
- return value_.int_ == other.value_.int_;
- case uintValue:
- return value_.uint_ == other.value_.uint_;
- case realValue:
- return value_.real_ == other.value_.real_;
- case booleanValue:
- return value_.bool_ == other.value_.bool_;
- case stringValue:
- return ( value_.string_ == other.value_.string_ )
- || ( other.value_.string_
- && value_.string_
- && strcmp( value_.string_, other.value_.string_ ) == 0 );
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- case arrayValue:
- case objectValue:
- return value_.map_->size() == other.value_.map_->size()
- && (*value_.map_) == (*other.value_.map_);
-#else
- case arrayValue:
- return value_.array_->compare( *(other.value_.array_) ) == 0;
- case objectValue:
- return value_.map_->compare( *(other.value_.map_) ) == 0;
-#endif
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return false; // unreachable
-}
-
-bool
-Value::operator !=( const Value &other ) const
-{
- return !( *this == other );
-}
-
-const char *
-Value::asCString() const
-{
- JSON_ASSERT( type_ == stringValue );
- return value_.string_;
-}
-
-
-std::string
-Value::asString() const
-{
- switch ( type_ )
- {
- case nullValue:
- return "";
- case stringValue:
- return value_.string_ ? value_.string_ : "";
- case booleanValue:
- return value_.bool_ ? "true" : "false";
- case intValue:
- case uintValue:
- return valueToString(value_.int_);
- case realValue:
- case arrayValue:
- case objectValue:
- JSON_FAIL_MESSAGE( "Type is not convertible to string" );
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return ""; // unreachable
-}
-
-# ifdef JSON_USE_CPPTL
-CppTL::ConstString
-Value::asConstString() const
-{
- return CppTL::ConstString( asString().c_str() );
-}
-# endif
-
-
-Value::Int
-Value::asInt() const
-{
- switch ( type_ )
- {
- case nullValue:
- return 0;
- case intValue:
- JSON_ASSERT_MESSAGE( value_.int_ >= minInt && value_.int_ <= maxInt, "unsigned integer out of signed int range" );
- return Int(value_.int_);
- case uintValue:
- JSON_ASSERT_MESSAGE( value_.uint_ <= UInt(maxInt), "unsigned integer out of signed int range" );
- return Int(value_.uint_);
- case realValue:
- JSON_ASSERT_MESSAGE( value_.real_ >= minInt && value_.real_ <= maxInt, "Real out of signed integer range" );
- return Int( value_.real_ );
- case booleanValue:
- return value_.bool_ ? 1 : 0;
- case stringValue:
- case arrayValue:
- case objectValue:
- JSON_FAIL_MESSAGE( "Type is not convertible to int" );
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return 0; // unreachable;
-}
-
-
-Value::UInt
-Value::asUInt() const
-{
- switch ( type_ )
- {
- case nullValue:
- return 0;
- case intValue:
- JSON_ASSERT_MESSAGE( value_.int_ >= 0, "Negative integer can not be converted to unsigned integer" );
- JSON_ASSERT_MESSAGE( value_.int_ <= maxUInt, "signed integer out of UInt range" );
- return UInt(value_.int_);
- case uintValue:
- JSON_ASSERT_MESSAGE( value_.uint_ <= maxUInt, "unsigned integer out of UInt range" );
- return UInt(value_.uint_);
- case realValue:
- JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt, "Real out of unsigned integer range" );
- return UInt( value_.real_ );
- case booleanValue:
- return value_.bool_ ? 1 : 0;
- case stringValue:
- case arrayValue:
- case objectValue:
- JSON_FAIL_MESSAGE( "Type is not convertible to uint" );
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return 0; // unreachable;
-}
-
-
-# if defined(JSON_HAS_INT64)
-
-Value::Int64
-Value::asInt64() const
-{
- switch ( type_ )
- {
- case nullValue:
- return 0;
- case intValue:
- return value_.int_;
- case uintValue:
- JSON_ASSERT_MESSAGE( value_.uint_ <= UInt64(maxInt64), "unsigned integer out of Int64 range" );
- return value_.uint_;
- case realValue:
- JSON_ASSERT_MESSAGE( value_.real_ >= minInt64 && value_.real_ <= maxInt64, "Real out of Int64 range" );
- return Int( value_.real_ );
- case booleanValue:
- return value_.bool_ ? 1 : 0;
- case stringValue:
- case arrayValue:
- case objectValue:
- JSON_FAIL_MESSAGE( "Type is not convertible to Int64" );
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return 0; // unreachable;
-}
-
-
-Value::UInt64
-Value::asUInt64() const
-{
- switch ( type_ )
- {
- case nullValue:
- return 0;
- case intValue:
- JSON_ASSERT_MESSAGE( value_.int_ >= 0, "Negative integer can not be converted to UInt64" );
- return value_.int_;
- case uintValue:
- return value_.uint_;
- case realValue:
- JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt64, "Real out of UInt64 range" );
- return UInt( value_.real_ );
- case booleanValue:
- return value_.bool_ ? 1 : 0;
- case stringValue:
- case arrayValue:
- case objectValue:
- JSON_FAIL_MESSAGE( "Type is not convertible to UInt64" );
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return 0; // unreachable;
-}
-# endif // if defined(JSON_HAS_INT64)
-
-
-LargestInt
-Value::asLargestInt() const
-{
-#if defined(JSON_NO_INT64)
- return asInt();
-#else
- return asInt64();
-#endif
-}
-
-
-LargestUInt
-Value::asLargestUInt() const
-{
-#if defined(JSON_NO_INT64)
- return asUInt();
-#else
- return asUInt64();
-#endif
-}
-
-
-double
-Value::asDouble() const
-{
- switch ( type_ )
- {
- case nullValue:
- return 0.0;
- case intValue:
- return static_cast<double>( value_.int_ );
- case uintValue:
-#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
- return static_cast<double>( value_.uint_ );
-#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
- return static_cast<double>( Int(value_.uint_/2) ) * 2 + Int(value_.uint_ & 1);
-#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
- case realValue:
- return value_.real_;
- case booleanValue:
- return value_.bool_ ? 1.0 : 0.0;
- case stringValue:
- case arrayValue:
- case objectValue:
- JSON_FAIL_MESSAGE( "Type is not convertible to double" );
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return 0; // unreachable;
-}
-
-float
-Value::asFloat() const
-{
- switch ( type_ )
- {
- case nullValue:
- return 0.0f;
- case intValue:
- return static_cast<float>( value_.int_ );
- case uintValue:
-#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
- return static_cast<float>( value_.uint_ );
-#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
- return static_cast<float>( Int(value_.uint_/2) ) * 2 + Int(value_.uint_ & 1);
-#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
- case realValue:
- return static_cast<float>( value_.real_ );
- case booleanValue:
- return value_.bool_ ? 1.0f : 0.0f;
- case stringValue:
- case arrayValue:
- case objectValue:
- JSON_FAIL_MESSAGE( "Type is not convertible to float" );
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return 0.0f; // unreachable;
-}
-
-bool
-Value::asBool() const
-{
- switch ( type_ )
- {
- case nullValue:
- return false;
- case intValue:
- case uintValue:
- return value_.int_ != 0;
- case realValue:
- return value_.real_ != 0.0;
- case booleanValue:
- return value_.bool_;
- case stringValue:
- return value_.string_ && value_.string_[0] != 0;
- case arrayValue:
- case objectValue:
- return value_.map_->size() != 0;
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return false; // unreachable;
-}
-
-
-bool
-Value::isConvertibleTo( ValueType other ) const
-{
- switch ( type_ )
- {
- case nullValue:
- return true;
- case intValue:
- return ( other == nullValue && value_.int_ == 0 )
- || other == intValue
- || ( other == uintValue && value_.int_ >= 0 )
- || other == realValue
- || other == stringValue
- || other == booleanValue;
- case uintValue:
- return ( other == nullValue && value_.uint_ == 0 )
- || ( other == intValue && value_.uint_ <= (unsigned)maxInt )
- || other == uintValue
- || other == realValue
- || other == stringValue
- || other == booleanValue;
- case realValue:
- return ( other == nullValue && value_.real_ == 0.0 )
- || ( other == intValue && value_.real_ >= minInt && value_.real_ <= maxInt )
- || ( other == uintValue && value_.real_ >= 0 && value_.real_ <= maxUInt )
- || other == realValue
- || other == stringValue
- || other == booleanValue;
- case booleanValue:
- return ( other == nullValue && value_.bool_ == false )
- || other == intValue
- || other == uintValue
- || other == realValue
- || other == stringValue
- || other == booleanValue;
- case stringValue:
- return other == stringValue
- || ( other == nullValue && (!value_.string_ || value_.string_[0] == 0) );
- case arrayValue:
- return other == arrayValue
- || ( other == nullValue && value_.map_->size() == 0 );
- case objectValue:
- return other == objectValue
- || ( other == nullValue && value_.map_->size() == 0 );
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return false; // unreachable;
-}
-
-
-/// Number of values in array or object
-ArrayIndex
-Value::size() const
-{
- switch ( type_ )
- {
- case nullValue:
- case intValue:
- case uintValue:
- case realValue:
- case booleanValue:
- case stringValue:
- return 0;
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- case arrayValue: // size of the array is highest index + 1
- if ( !value_.map_->empty() )
- {
- ObjectValues::const_iterator itLast = value_.map_->end();
- --itLast;
- return (*itLast).first.index()+1;
- }
- return 0;
- case objectValue:
- return ArrayIndex( value_.map_->size() );
-#else
- case arrayValue:
- return Int( value_.array_->size() );
- case objectValue:
- return Int( value_.map_->size() );
-#endif
- default:
- JSON_ASSERT_UNREACHABLE;
- }
- return 0; // unreachable;
-}
-
-
-bool
-Value::empty() const
-{
- if ( isNull() || isArray() || isObject() )
- return size() == 0u;
- else
- return false;
-}
-
-
-bool
-Value::operator!() const
-{
- return isNull();
-}
-
-
-void
-Value::clear()
-{
- JSON_ASSERT( type_ == nullValue || type_ == arrayValue || type_ == objectValue );
-
- switch ( type_ )
- {
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- case arrayValue:
- case objectValue:
- value_.map_->clear();
- break;
-#else
- case arrayValue:
- value_.array_->clear();
- break;
- case objectValue:
- value_.map_->clear();
- break;
-#endif
- default:
- break;
- }
-}
-
-void
-Value::resize( ArrayIndex newSize )
-{
- JSON_ASSERT( type_ == nullValue || type_ == arrayValue );
- if ( type_ == nullValue )
- *this = Value( arrayValue );
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- ArrayIndex oldSize = size();
- if ( newSize == 0 )
- clear();
- else if ( newSize > oldSize )
- (*this)[ newSize - 1 ];
- else
- {
- for ( ArrayIndex index = newSize; index < oldSize; ++index )
- {
- value_.map_->erase( index );
- }
- assert( size() == newSize );
- }
-#else
- value_.array_->resize( newSize );
-#endif
-}
-
-
-Value &
-Value::operator[]( ArrayIndex index )
-{
- JSON_ASSERT( type_ == nullValue || type_ == arrayValue );
- if ( type_ == nullValue )
- *this = Value( arrayValue );
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- CZString key( index );
- ObjectValues::iterator it = value_.map_->lower_bound( key );
- if ( it != value_.map_->end() && (*it).first == key )
- return (*it).second;
-
- ObjectValues::value_type defaultValue( key, null );
- it = value_.map_->insert( it, defaultValue );
- return (*it).second;
-#else
- return value_.array_->resolveReference( index );
-#endif
-}
-
-
-Value &
-Value::operator[]( int index )
-{
- JSON_ASSERT( index >= 0 );
- return (*this)[ ArrayIndex(index) ];
-}
-
-
-const Value &
-Value::operator[]( ArrayIndex index ) const
-{
- JSON_ASSERT( type_ == nullValue || type_ == arrayValue );
- if ( type_ == nullValue )
- return null;
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- CZString key( index );
- ObjectValues::const_iterator it = value_.map_->find( key );
- if ( it == value_.map_->end() )
- return null;
- return (*it).second;
-#else
- Value *value = value_.array_->find( index );
- return value ? *value : null;
-#endif
-}
-
-
-const Value &
-Value::operator[]( int index ) const
-{
- JSON_ASSERT( index >= 0 );
- return (*this)[ ArrayIndex(index) ];
-}
-
-
-Value &
-Value::operator[]( const char *key )
-{
- return resolveReference( key, false );
-}
-
-
-Value &
-Value::resolveReference( const char *key,
- bool isStatic )
-{
- JSON_ASSERT( type_ == nullValue || type_ == objectValue );
- if ( type_ == nullValue )
- *this = Value( objectValue );
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- CZString actualKey( key, isStatic ? CZString::noDuplication
- : CZString::duplicateOnCopy );
- ObjectValues::iterator it = value_.map_->lower_bound( actualKey );
- if ( it != value_.map_->end() && (*it).first == actualKey )
- return (*it).second;
-
- ObjectValues::value_type defaultValue( actualKey, null );
- it = value_.map_->insert( it, defaultValue );
- Value &value = (*it).second;
- return value;
-#else
- return value_.map_->resolveReference( key, isStatic );
-#endif
-}
-
-
-Value
-Value::get( ArrayIndex index,
- const Value &defaultValue ) const
-{
- const Value *value = &((*this)[index]);
- return value == &null ? defaultValue : *value;
-}
-
-
-bool
-Value::isValidIndex( ArrayIndex index ) const
-{
- return index < size();
-}
-
-
-
-const Value &
-Value::operator[]( const char *key ) const
-{
- JSON_ASSERT( type_ == nullValue || type_ == objectValue );
- if ( type_ == nullValue )
- return null;
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- CZString actualKey( key, CZString::noDuplication );
- ObjectValues::const_iterator it = value_.map_->find( actualKey );
- if ( it == value_.map_->end() )
- return null;
- return (*it).second;
-#else
- const Value *value = value_.map_->find( key );
- return value ? *value : null;
-#endif
-}
-
-
-Value &
-Value::operator[]( const std::string &key )
-{
- return (*this)[ key.c_str() ];
-}
-
-
-const Value &
-Value::operator[]( const std::string &key ) const
-{
- return (*this)[ key.c_str() ];
-}
-
-Value &
-Value::operator[]( const StaticString &key )
-{
- return resolveReference( key, true );
-}
-
-
-# ifdef JSON_USE_CPPTL
-Value &
-Value::operator[]( const CppTL::ConstString &key )
-{
- return (*this)[ key.c_str() ];
-}
-
-
-const Value &
-Value::operator[]( const CppTL::ConstString &key ) const
-{
- return (*this)[ key.c_str() ];
-}
-# endif
-
-
-Value &
-Value::append( const Value &value )
-{
- return (*this)[size()] = value;
-}
-
-
-Value
-Value::get( const char *key,
- const Value &defaultValue ) const
-{
- const Value *value = &((*this)[key]);
- return value == &null ? defaultValue : *value;
-}
-
-
-Value
-Value::get( const std::string &key,
- const Value &defaultValue ) const
-{
- return get( key.c_str(), defaultValue );
-}
-
-Value
-Value::removeMember( const char* key )
-{
- JSON_ASSERT( type_ == nullValue || type_ == objectValue );
- if ( type_ == nullValue )
- return null;
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- CZString actualKey( key, CZString::noDuplication );
- ObjectValues::iterator it = value_.map_->find( actualKey );
- if ( it == value_.map_->end() )
- return null;
- Value old(it->second);
- value_.map_->erase(it);
- return old;
-#else
- Value *value = value_.map_->find( key );
- if (value){
- Value old(*value);
- value_.map_.remove( key );
- return old;
- } else {
- return null;
- }
-#endif
-}
-
-Value
-Value::removeMember( const std::string &key )
-{
- return removeMember( key.c_str() );
-}
-
-# ifdef JSON_USE_CPPTL
-Value
-Value::get( const CppTL::ConstString &key,
- const Value &defaultValue ) const
-{
- return get( key.c_str(), defaultValue );
-}
-# endif
-
-bool
-Value::isMember( const char *key ) const
-{
- const Value *value = &((*this)[key]);
- return value != &null;
-}
-
-
-bool
-Value::isMember( const std::string &key ) const
-{
- return isMember( key.c_str() );
-}
-
-
-# ifdef JSON_USE_CPPTL
-bool
-Value::isMember( const CppTL::ConstString &key ) const
-{
- return isMember( key.c_str() );
-}
-#endif
-
-Value::Members
-Value::getMemberNames() const
-{
- JSON_ASSERT( type_ == nullValue || type_ == objectValue );
- if ( type_ == nullValue )
- return Value::Members();
- Members members;
- members.reserve( value_.map_->size() );
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- ObjectValues::const_iterator it = value_.map_->begin();
- ObjectValues::const_iterator itEnd = value_.map_->end();
- for ( ; it != itEnd; ++it )
- members.push_back( std::string( (*it).first.c_str() ) );
-#else
- ValueInternalMap::IteratorState it;
- ValueInternalMap::IteratorState itEnd;
- value_.map_->makeBeginIterator( it );
- value_.map_->makeEndIterator( itEnd );
- for ( ; !ValueInternalMap::equals( it, itEnd ); ValueInternalMap::increment(it) )
- members.push_back( std::string( ValueInternalMap::key( it ) ) );
-#endif
- return members;
-}
-//
-//# ifdef JSON_USE_CPPTL
-//EnumMemberNames
-//Value::enumMemberNames() const
-//{
-// if ( type_ == objectValue )
-// {
-// return CppTL::Enum::any( CppTL::Enum::transform(
-// CppTL::Enum::keys( *(value_.map_), CppTL::Type<const CZString &>() ),
-// MemberNamesTransform() ) );
-// }
-// return EnumMemberNames();
-//}
-//
-//
-//EnumValues
-//Value::enumValues() const
-//{
-// if ( type_ == objectValue || type_ == arrayValue )
-// return CppTL::Enum::anyValues( *(value_.map_),
-// CppTL::Type<const Value &>() );
-// return EnumValues();
-//}
-//
-//# endif
-
-
-bool
-Value::isNull() const
-{
- return type_ == nullValue;
-}
-
-
-bool
-Value::isBool() const
-{
- return type_ == booleanValue;
-}
-
-
-bool
-Value::isInt() const
-{
- return type_ == intValue;
-}
-
-
-bool
-Value::isUInt() const
-{
- return type_ == uintValue;
-}
-
-
-bool
-Value::isIntegral() const
-{
- return type_ == intValue
- || type_ == uintValue
- || type_ == booleanValue;
-}
-
-
-bool
-Value::isDouble() const
-{
- return type_ == realValue;
-}
-
-
-bool
-Value::isNumeric() const
-{
- return isIntegral() || isDouble();
-}
-
-
-bool
-Value::isString() const
-{
- return type_ == stringValue;
-}
-
-
-bool
-Value::isArray() const
-{
- return type_ == nullValue || type_ == arrayValue;
-}
-
-
-bool
-Value::isObject() const
-{
- return type_ == nullValue || type_ == objectValue;
-}
-
-
-void
-Value::setComment( const char *comment,
- CommentPlacement placement )
-{
- if ( !comments_ )
- comments_ = new CommentInfo[numberOfCommentPlacement];
- comments_[placement].setComment( comment );
-}
-
-
-void
-Value::setComment( const std::string &comment,
- CommentPlacement placement )
-{
- setComment( comment.c_str(), placement );
-}
-
-
-bool
-Value::hasComment( CommentPlacement placement ) const
-{
- return comments_ != 0 && comments_[placement].comment_ != 0;
-}
-
-std::string
-Value::getComment( CommentPlacement placement ) const
-{
- if ( hasComment(placement) )
- return comments_[placement].comment_;
- return "";
-}
-
-
-std::string
-Value::toStyledString() const
-{
- StyledWriter writer;
- return writer.write( *this );
-}
-
-
-Value::const_iterator
-Value::begin() const
-{
- switch ( type_ )
- {
-#ifdef JSON_VALUE_USE_INTERNAL_MAP
- case arrayValue:
- if ( value_.array_ )
- {
- ValueInternalArray::IteratorState it;
- value_.array_->makeBeginIterator( it );
- return const_iterator( it );
- }
- break;
- case objectValue:
- if ( value_.map_ )
- {
- ValueInternalMap::IteratorState it;
- value_.map_->makeBeginIterator( it );
- return const_iterator( it );
- }
- break;
-#else
- case arrayValue:
- case objectValue:
- if ( value_.map_ )
- return const_iterator( value_.map_->begin() );
- break;
-#endif
- default:
- break;
- }
- return const_iterator();
-}
-
-Value::const_iterator
-Value::end() const
-{
- switch ( type_ )
- {
-#ifdef JSON_VALUE_USE_INTERNAL_MAP
- case arrayValue:
- if ( value_.array_ )
- {
- ValueInternalArray::IteratorState it;
- value_.array_->makeEndIterator( it );
- return const_iterator( it );
- }
- break;
- case objectValue:
- if ( value_.map_ )
- {
- ValueInternalMap::IteratorState it;
- value_.map_->makeEndIterator( it );
- return const_iterator( it );
- }
- break;
-#else
- case arrayValue:
- case objectValue:
- if ( value_.map_ )
- return const_iterator( value_.map_->end() );
- break;
-#endif
- default:
- break;
- }
- return const_iterator();
-}
-
-
-Value::iterator
-Value::begin()
-{
- switch ( type_ )
- {
-#ifdef JSON_VALUE_USE_INTERNAL_MAP
- case arrayValue:
- if ( value_.array_ )
- {
- ValueInternalArray::IteratorState it;
- value_.array_->makeBeginIterator( it );
- return iterator( it );
- }
- break;
- case objectValue:
- if ( value_.map_ )
- {
- ValueInternalMap::IteratorState it;
- value_.map_->makeBeginIterator( it );
- return iterator( it );
- }
- break;
-#else
- case arrayValue:
- case objectValue:
- if ( value_.map_ )
- return iterator( value_.map_->begin() );
- break;
-#endif
- default:
- break;
- }
- return iterator();
-}
-
-Value::iterator
-Value::end()
-{
- switch ( type_ )
- {
-#ifdef JSON_VALUE_USE_INTERNAL_MAP
- case arrayValue:
- if ( value_.array_ )
- {
- ValueInternalArray::IteratorState it;
- value_.array_->makeEndIterator( it );
- return iterator( it );
- }
- break;
- case objectValue:
- if ( value_.map_ )
- {
- ValueInternalMap::IteratorState it;
- value_.map_->makeEndIterator( it );
- return iterator( it );
- }
- break;
-#else
- case arrayValue:
- case objectValue:
- if ( value_.map_ )
- return iterator( value_.map_->end() );
- break;
-#endif
- default:
- break;
- }
- return iterator();
-}
-
-
-// class PathArgument
-// //////////////////////////////////////////////////////////////////
-
-PathArgument::PathArgument()
- : kind_( kindNone )
-{
-}
-
-
-PathArgument::PathArgument( ArrayIndex index )
- : index_( index )
- , kind_( kindIndex )
-{
-}
-
-
-PathArgument::PathArgument( const char *key )
- : key_( key )
- , kind_( kindKey )
-{
-}
-
-
-PathArgument::PathArgument( const std::string &key )
- : key_( key.c_str() )
- , kind_( kindKey )
-{
-}
-
-// class Path
-// //////////////////////////////////////////////////////////////////
-
-Path::Path( const std::string &path,
- const PathArgument &a1,
- const PathArgument &a2,
- const PathArgument &a3,
- const PathArgument &a4,
- const PathArgument &a5 )
-{
- InArgs in;
- in.push_back( &a1 );
- in.push_back( &a2 );
- in.push_back( &a3 );
- in.push_back( &a4 );
- in.push_back( &a5 );
- makePath( path, in );
-}
-
-
-void
-Path::makePath( const std::string &path,
- const InArgs &in )
-{
- const char *current = path.c_str();
- const char *end = current + path.length();
- InArgs::const_iterator itInArg = in.begin();
- while ( current != end )
- {
- if ( *current == '[' )
- {
- ++current;
- if ( *current == '%' )
- addPathInArg( path, in, itInArg, PathArgument::kindIndex );
- else
- {
- ArrayIndex index = 0;
- for ( ; current != end && *current >= '0' && *current <= '9'; ++current )
- index = index * 10 + ArrayIndex(*current - '0');
- args_.push_back( index );
- }
- if ( current == end || *current++ != ']' )
- invalidPath( path, int(current - path.c_str()) );
- }
- else if ( *current == '%' )
- {
- addPathInArg( path, in, itInArg, PathArgument::kindKey );
- ++current;
- }
- else if ( *current == '.' )
- {
- ++current;
- }
- else
- {
- const char *beginName = current;
- while ( current != end && !strchr( "[.", *current ) )
- ++current;
- args_.push_back( std::string( beginName, current ) );
- }
- }
-}
-
-
-void
-Path::addPathInArg( const std::string &path,
- const InArgs &in,
- InArgs::const_iterator &itInArg,
- PathArgument::Kind kind )
-{
- if ( itInArg == in.end() )
- {
- // Error: missing argument %d
- }
- else if ( (*itInArg)->kind_ != kind )
- {
- // Error: bad argument type
- }
- else
- {
- args_.push_back( **itInArg );
- }
-}
-
-
-void
-Path::invalidPath( const std::string &path,
- int location )
-{
- // Error: invalid path.
-}
-
-
-const Value &
-Path::resolve( const Value &root ) const
-{
- const Value *node = &root;
- for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it )
- {
- const PathArgument &arg = *it;
- if ( arg.kind_ == PathArgument::kindIndex )
- {
- if ( !node->isArray() || node->isValidIndex( arg.index_ ) )
- {
- // Error: unable to resolve path (array value expected at position...
- }
- node = &((*node)[arg.index_]);
- }
- else if ( arg.kind_ == PathArgument::kindKey )
- {
- if ( !node->isObject() )
- {
- // Error: unable to resolve path (object value expected at position...)
- }
- node = &((*node)[arg.key_]);
- if ( node == &Value::null )
- {
- // Error: unable to resolve path (object has no member named '' at position...)
- }
- }
- }
- return *node;
-}
-
-
-Value
-Path::resolve( const Value &root,
- const Value &defaultValue ) const
-{
- const Value *node = &root;
- for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it )
- {
- const PathArgument &arg = *it;
- if ( arg.kind_ == PathArgument::kindIndex )
- {
- if ( !node->isArray() || node->isValidIndex( arg.index_ ) )
- return defaultValue;
- node = &((*node)[arg.index_]);
- }
- else if ( arg.kind_ == PathArgument::kindKey )
- {
- if ( !node->isObject() )
- return defaultValue;
- node = &((*node)[arg.key_]);
- if ( node == &Value::null )
- return defaultValue;
- }
- }
- return *node;
-}
-
-
-Value &
-Path::make( Value &root ) const
-{
- Value *node = &root;
- for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it )
- {
- const PathArgument &arg = *it;
- if ( arg.kind_ == PathArgument::kindIndex )
- {
- if ( !node->isArray() )
- {
- // Error: node is not an array at position ...
- }
- node = &((*node)[arg.index_]);
- }
- else if ( arg.kind_ == PathArgument::kindKey )
- {
- if ( !node->isObject() )
- {
- // Error: node is not an object at position...
- }
- node = &((*node)[arg.key_]);
- }
- }
- return *node;
-}
-
-
-} // namespace Json
diff --git a/src/3rd_party-static/jsoncpp/src/lib_json/json_valueiterator.inl b/src/3rd_party-static/jsoncpp/src/lib_json/json_valueiterator.inl
deleted file mode 100644
index 7457ca389e..0000000000
--- a/src/3rd_party-static/jsoncpp/src/lib_json/json_valueiterator.inl
+++ /dev/null
@@ -1,299 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-// included by json_value.cpp
-
-namespace Json {
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class ValueIteratorBase
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-ValueIteratorBase::ValueIteratorBase()
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- : current_()
- , isNull_( true )
-{
-}
-#else
- : isArray_( true )
- , isNull_( true )
-{
- iterator_.array_ = ValueInternalArray::IteratorState();
-}
-#endif
-
-
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
-ValueIteratorBase::ValueIteratorBase( const Value::ObjectValues::iterator &current )
- : current_( current )
- , isNull_( false )
-{
-}
-#else
-ValueIteratorBase::ValueIteratorBase( const ValueInternalArray::IteratorState &state )
- : isArray_( true )
-{
- iterator_.array_ = state;
-}
-
-
-ValueIteratorBase::ValueIteratorBase( const ValueInternalMap::IteratorState &state )
- : isArray_( false )
-{
- iterator_.map_ = state;
-}
-#endif
-
-Value &
-ValueIteratorBase::deref() const
-{
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- return current_->second;
-#else
- if ( isArray_ )
- return ValueInternalArray::dereference( iterator_.array_ );
- return ValueInternalMap::value( iterator_.map_ );
-#endif
-}
-
-
-void
-ValueIteratorBase::increment()
-{
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- ++current_;
-#else
- if ( isArray_ )
- ValueInternalArray::increment( iterator_.array_ );
- ValueInternalMap::increment( iterator_.map_ );
-#endif
-}
-
-
-void
-ValueIteratorBase::decrement()
-{
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- --current_;
-#else
- if ( isArray_ )
- ValueInternalArray::decrement( iterator_.array_ );
- ValueInternalMap::decrement( iterator_.map_ );
-#endif
-}
-
-
-ValueIteratorBase::difference_type
-ValueIteratorBase::computeDistance( const SelfType &other ) const
-{
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
-# ifdef JSON_USE_CPPTL_SMALLMAP
- return current_ - other.current_;
-# else
- // Iterator for null value are initialized using the default
- // constructor, which initialize current_ to the default
- // std::map::iterator. As begin() and end() are two instance
- // of the default std::map::iterator, they can not be compared.
- // To allow this, we handle this comparison specifically.
- if ( isNull_ && other.isNull_ )
- {
- return 0;
- }
-
-
- // Usage of std::distance is not portable (does not compile with Sun Studio 12 RogueWave STL,
- // which is the one used by default).
- // Using a portable hand-made version for non random iterator instead:
- // return difference_type( std::distance( current_, other.current_ ) );
- difference_type myDistance = 0;
- for ( Value::ObjectValues::iterator it = current_; it != other.current_; ++it )
- {
- ++myDistance;
- }
- return myDistance;
-# endif
-#else
- if ( isArray_ )
- return ValueInternalArray::distance( iterator_.array_, other.iterator_.array_ );
- return ValueInternalMap::distance( iterator_.map_, other.iterator_.map_ );
-#endif
-}
-
-
-bool
-ValueIteratorBase::isEqual( const SelfType &other ) const
-{
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- if ( isNull_ )
- {
- return other.isNull_;
- }
- return current_ == other.current_;
-#else
- if ( isArray_ )
- return ValueInternalArray::equals( iterator_.array_, other.iterator_.array_ );
- return ValueInternalMap::equals( iterator_.map_, other.iterator_.map_ );
-#endif
-}
-
-
-void
-ValueIteratorBase::copy( const SelfType &other )
-{
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- current_ = other.current_;
-#else
- if ( isArray_ )
- iterator_.array_ = other.iterator_.array_;
- iterator_.map_ = other.iterator_.map_;
-#endif
-}
-
-
-Value
-ValueIteratorBase::key() const
-{
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- const Value::CZString czstring = (*current_).first;
- if ( czstring.c_str() )
- {
- if ( czstring.isStaticString() )
- return Value( StaticString( czstring.c_str() ) );
- return Value( czstring.c_str() );
- }
- return Value( czstring.index() );
-#else
- if ( isArray_ )
- return Value( ValueInternalArray::indexOf( iterator_.array_ ) );
- bool isStatic;
- const char *memberName = ValueInternalMap::key( iterator_.map_, isStatic );
- if ( isStatic )
- return Value( StaticString( memberName ) );
- return Value( memberName );
-#endif
-}
-
-
-UInt
-ValueIteratorBase::index() const
-{
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- const Value::CZString czstring = (*current_).first;
- if ( !czstring.c_str() )
- return czstring.index();
- return Value::UInt( -1 );
-#else
- if ( isArray_ )
- return Value::UInt( ValueInternalArray::indexOf( iterator_.array_ ) );
- return Value::UInt( -1 );
-#endif
-}
-
-
-const char *
-ValueIteratorBase::memberName() const
-{
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
- const char *name = (*current_).first.c_str();
- return name ? name : "";
-#else
- if ( !isArray_ )
- return ValueInternalMap::key( iterator_.map_ );
- return "";
-#endif
-}
-
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class ValueConstIterator
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-ValueConstIterator::ValueConstIterator()
-{
-}
-
-
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
-ValueConstIterator::ValueConstIterator( const Value::ObjectValues::iterator &current )
- : ValueIteratorBase( current )
-{
-}
-#else
-ValueConstIterator::ValueConstIterator( const ValueInternalArray::IteratorState &state )
- : ValueIteratorBase( state )
-{
-}
-
-ValueConstIterator::ValueConstIterator( const ValueInternalMap::IteratorState &state )
- : ValueIteratorBase( state )
-{
-}
-#endif
-
-ValueConstIterator &
-ValueConstIterator::operator =( const ValueIteratorBase &other )
-{
- copy( other );
- return *this;
-}
-
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// class ValueIterator
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-ValueIterator::ValueIterator()
-{
-}
-
-
-#ifndef JSON_VALUE_USE_INTERNAL_MAP
-ValueIterator::ValueIterator( const Value::ObjectValues::iterator &current )
- : ValueIteratorBase( current )
-{
-}
-#else
-ValueIterator::ValueIterator( const ValueInternalArray::IteratorState &state )
- : ValueIteratorBase( state )
-{
-}
-
-ValueIterator::ValueIterator( const ValueInternalMap::IteratorState &state )
- : ValueIteratorBase( state )
-{
-}
-#endif
-
-ValueIterator::ValueIterator( const ValueConstIterator &other )
- : ValueIteratorBase( other )
-{
-}
-
-ValueIterator::ValueIterator( const ValueIterator &other )
- : ValueIteratorBase( other )
-{
-}
-
-ValueIterator &
-ValueIterator::operator =( const SelfType &other )
-{
- copy( other );
- return *this;
-}
-
-} // namespace Json
diff --git a/src/3rd_party-static/jsoncpp/src/lib_json/json_writer.cpp b/src/3rd_party-static/jsoncpp/src/lib_json/json_writer.cpp
deleted file mode 100644
index 1bda183fec..0000000000
--- a/src/3rd_party-static/jsoncpp/src/lib_json/json_writer.cpp
+++ /dev/null
@@ -1,838 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#if !defined(JSON_IS_AMALGAMATION)
-# include <json/writer.h>
-# include "json_tool.h"
-#endif // if !defined(JSON_IS_AMALGAMATION)
-#include <utility>
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-#include <iostream>
-#include <sstream>
-#include <iomanip>
-
-#if _MSC_VER >= 1400 // VC++ 8.0
-#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated.
-#endif
-
-namespace Json {
-
-static bool containsControlCharacter( const char* str )
-{
- while ( *str )
- {
- if ( isControlCharacter( *(str++) ) )
- return true;
- }
- return false;
-}
-
-
-std::string valueToString( LargestInt value )
-{
- UIntToStringBuffer buffer;
- char *current = buffer + sizeof(buffer);
- bool isNegative = value < 0;
- if ( isNegative )
- value = -value;
- uintToString( LargestUInt(value), current );
- if ( isNegative )
- *--current = '-';
- assert( current >= buffer );
- return current;
-}
-
-
-std::string valueToString( LargestUInt value )
-{
- UIntToStringBuffer buffer;
- char *current = buffer + sizeof(buffer);
- uintToString( value, current );
- assert( current >= buffer );
- return current;
-}
-
-#if defined(JSON_HAS_INT64)
-
-std::string valueToString( Int value )
-{
- return valueToString( LargestInt(value) );
-}
-
-
-std::string valueToString( UInt value )
-{
- return valueToString( LargestUInt(value) );
-}
-
-#endif // # if defined(JSON_HAS_INT64)
-
-
-std::string valueToString( double value )
-{
- char buffer[32];
-#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with visual studio 2005 to avoid warning.
- sprintf_s(buffer, sizeof(buffer), "%#.16g", value);
-#else
- sprintf(buffer, "%#.16g", value);
-#endif
- char* ch = buffer + strlen(buffer) - 1;
- if (*ch != '0') return buffer; // nothing to truncate, so save time
- while(ch > buffer && *ch == '0'){
- --ch;
- }
- char* last_nonzero = ch;
- while(ch >= buffer){
- switch(*ch){
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- --ch;
- continue;
- case '.':
- // Truncate zeroes to save bytes in output, but keep one.
- *(last_nonzero+2) = '\0';
- return buffer;
- default:
- return buffer;
- }
- }
- return buffer;
-}
-
-
-std::string valueToString( bool value )
-{
- return value ? "true" : "false";
-}
-
-std::string valueToQuotedString( const char *value )
-{
- // Not sure how to handle unicode...
- if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value ))
- return std::string("\"") + value + "\"";
- // We have to walk value and escape any special characters.
- // Appending to std::string is not efficient, but this should be rare.
- // (Note: forward slashes are *not* rare, but I am not escaping them.)
- std::string::size_type maxsize = strlen(value)*2 + 3; // allescaped+quotes+NULL
- std::string result;
- result.reserve(maxsize); // to avoid lots of mallocs
- result += "\"";
- for (const char* c=value; *c != 0; ++c)
- {
- switch(*c)
- {
- case '\"':
- result += "\\\"";
- break;
- case '\\':
- result += "\\\\";
- break;
- case '\b':
- result += "\\b";
- break;
- case '\f':
- result += "\\f";
- break;
- case '\n':
- result += "\\n";
- break;
- case '\r':
- result += "\\r";
- break;
- case '\t':
- result += "\\t";
- break;
- //case '/':
- // Even though \/ is considered a legal escape in JSON, a bare
- // slash is also legal, so I see no reason to escape it.
- // (I hope I am not misunderstanding something.
- // blep notes: actually escaping \/ may be useful in javascript to avoid </
- // sequence.
- // Should add a flag to allow this compatibility mode and prevent this
- // sequence from occurring.
- default:
- if ( isControlCharacter( *c ) )
- {
- std::ostringstream oss;
- oss << "\\u" << std::hex << std::uppercase << std::setfill('0') << std::setw(4) << static_cast<int>(*c);
- result += oss.str();
- }
- else
- {
- result += *c;
- }
- break;
- }
- }
- result += "\"";
- return result;
-}
-
-// Class Writer
-// //////////////////////////////////////////////////////////////////
-Writer::~Writer()
-{
-}
-
-
-// Class FastWriter
-// //////////////////////////////////////////////////////////////////
-
-FastWriter::FastWriter()
- : yamlCompatiblityEnabled_( false )
-{
-}
-
-
-void
-FastWriter::enableYAMLCompatibility()
-{
- yamlCompatiblityEnabled_ = true;
-}
-
-
-std::string
-FastWriter::write( const Value &root )
-{
- document_ = "";
- writeValue( root );
- document_ += "\n";
- return document_;
-}
-
-
-void
-FastWriter::writeValue( const Value &value )
-{
- switch ( value.type() )
- {
- case nullValue:
- document_ += "null";
- break;
- case intValue:
- document_ += valueToString( value.asLargestInt() );
- break;
- case uintValue:
- document_ += valueToString( value.asLargestUInt() );
- break;
- case realValue:
- document_ += valueToString( value.asDouble() );
- break;
- case stringValue:
- document_ += valueToQuotedString( value.asCString() );
- break;
- case booleanValue:
- document_ += valueToString( value.asBool() );
- break;
- case arrayValue:
- {
- document_ += "[";
- int size = value.size();
- for ( int index =0; index < size; ++index )
- {
- if ( index > 0 )
- document_ += ",";
- writeValue( value[index] );
- }
- document_ += "]";
- }
- break;
- case objectValue:
- {
- Value::Members members( value.getMemberNames() );
- document_ += "{";
- for ( Value::Members::iterator it = members.begin();
- it != members.end();
- ++it )
- {
- const std::string &name = *it;
- if ( it != members.begin() )
- document_ += ",";
- document_ += valueToQuotedString( name.c_str() );
- document_ += yamlCompatiblityEnabled_ ? ": "
- : ":";
- writeValue( value[name] );
- }
- document_ += "}";
- }
- break;
- }
-}
-
-
-// Class StyledWriter
-// //////////////////////////////////////////////////////////////////
-
-StyledWriter::StyledWriter()
- : rightMargin_( 74 )
- , indentSize_( 3 )
-{
-}
-
-
-std::string
-StyledWriter::write( const Value &root )
-{
- document_ = "";
- addChildValues_ = false;
- indentString_ = "";
- writeCommentBeforeValue( root );
- writeValue( root );
- writeCommentAfterValueOnSameLine( root );
- document_ += "\n";
- return document_;
-}
-
-
-void
-StyledWriter::writeValue( const Value &value )
-{
- switch ( value.type() )
- {
- case nullValue:
- pushValue( "null" );
- break;
- case intValue:
- pushValue( valueToString( value.asLargestInt() ) );
- break;
- case uintValue:
- pushValue( valueToString( value.asLargestUInt() ) );
- break;
- case realValue:
- pushValue( valueToString( value.asDouble() ) );
- break;
- case stringValue:
- pushValue( valueToQuotedString( value.asCString() ) );
- break;
- case booleanValue:
- pushValue( valueToString( value.asBool() ) );
- break;
- case arrayValue:
- writeArrayValue( value);
- break;
- case objectValue:
- {
- Value::Members members( value.getMemberNames() );
- if ( members.empty() )
- pushValue( "{}" );
- else
- {
- writeWithIndent( "{" );
- indent();
- Value::Members::iterator it = members.begin();
- for (;;)
- {
- const std::string &name = *it;
- const Value &childValue = value[name];
- writeCommentBeforeValue( childValue );
- writeWithIndent( valueToQuotedString( name.c_str() ) );
- document_ += " : ";
- writeValue( childValue );
- if ( ++it == members.end() )
- {
- writeCommentAfterValueOnSameLine( childValue );
- break;
- }
- document_ += ",";
- writeCommentAfterValueOnSameLine( childValue );
- }
- unindent();
- writeWithIndent( "}" );
- }
- }
- break;
- }
-}
-
-
-void
-StyledWriter::writeArrayValue( const Value &value )
-{
- unsigned size = value.size();
- if ( size == 0 )
- pushValue( "[]" );
- else
- {
- bool isArrayMultiLine = isMultineArray( value );
- if ( isArrayMultiLine )
- {
- writeWithIndent( "[" );
- indent();
- bool hasChildValue = !childValues_.empty();
- unsigned index =0;
- for (;;)
- {
- const Value &childValue = value[index];
- writeCommentBeforeValue( childValue );
- if ( hasChildValue )
- writeWithIndent( childValues_[index] );
- else
- {
- writeIndent();
- writeValue( childValue );
- }
- if ( ++index == size )
- {
- writeCommentAfterValueOnSameLine( childValue );
- break;
- }
- document_ += ",";
- writeCommentAfterValueOnSameLine( childValue );
- }
- unindent();
- writeWithIndent( "]" );
- }
- else // output on a single line
- {
- assert( childValues_.size() == size );
- document_ += "[ ";
- for ( unsigned index =0; index < size; ++index )
- {
- if ( index > 0 )
- document_ += ", ";
- document_ += childValues_[index];
- }
- document_ += " ]";
- }
- }
-}
-
-
-bool
-StyledWriter::isMultineArray( const Value &value )
-{
- int size = value.size();
- bool isMultiLine = size*3 >= rightMargin_ ;
- childValues_.clear();
- for ( int index =0; index < size && !isMultiLine; ++index )
- {
- const Value &childValue = value[index];
- isMultiLine = isMultiLine ||
- ( (childValue.isArray() || childValue.isObject()) &&
- childValue.size() > 0 );
- }
- if ( !isMultiLine ) // check if line length > max line length
- {
- childValues_.reserve( size );
- addChildValues_ = true;
- int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]'
- for ( int index =0; index < size && !isMultiLine; ++index )
- {
- writeValue( value[index] );
- lineLength += int( childValues_[index].length() );
- isMultiLine = isMultiLine && hasCommentForValue( value[index] );
- }
- addChildValues_ = false;
- isMultiLine = isMultiLine || lineLength >= rightMargin_;
- }
- return isMultiLine;
-}
-
-
-void
-StyledWriter::pushValue( const std::string &value )
-{
- if ( addChildValues_ )
- childValues_.push_back( value );
- else
- document_ += value;
-}
-
-
-void
-StyledWriter::writeIndent()
-{
- if ( !document_.empty() )
- {
- char last = document_[document_.length()-1];
- if ( last == ' ' ) // already indented
- return;
- if ( last != '\n' ) // Comments may add new-line
- document_ += '\n';
- }
- document_ += indentString_;
-}
-
-
-void
-StyledWriter::writeWithIndent( const std::string &value )
-{
- writeIndent();
- document_ += value;
-}
-
-
-void
-StyledWriter::indent()
-{
- indentString_ += std::string( indentSize_, ' ' );
-}
-
-
-void
-StyledWriter::unindent()
-{
- assert( int(indentString_.size()) >= indentSize_ );
- indentString_.resize( indentString_.size() - indentSize_ );
-}
-
-
-void
-StyledWriter::writeCommentBeforeValue( const Value &root )
-{
- if ( !root.hasComment( commentBefore ) )
- return;
- document_ += normalizeEOL( root.getComment( commentBefore ) );
- document_ += "\n";
-}
-
-
-void
-StyledWriter::writeCommentAfterValueOnSameLine( const Value &root )
-{
- if ( root.hasComment( commentAfterOnSameLine ) )
- document_ += " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) );
-
- if ( root.hasComment( commentAfter ) )
- {
- document_ += "\n";
- document_ += normalizeEOL( root.getComment( commentAfter ) );
- document_ += "\n";
- }
-}
-
-
-bool
-StyledWriter::hasCommentForValue( const Value &value )
-{
- return value.hasComment( commentBefore )
- || value.hasComment( commentAfterOnSameLine )
- || value.hasComment( commentAfter );
-}
-
-
-std::string
-StyledWriter::normalizeEOL( const std::string &text )
-{
- std::string normalized;
- normalized.reserve( text.length() );
- const char *begin = text.c_str();
- const char *end = begin + text.length();
- const char *current = begin;
- while ( current != end )
- {
- char c = *current++;
- if ( c == '\r' ) // mac or dos EOL
- {
- if ( *current == '\n' ) // convert dos EOL
- ++current;
- normalized += '\n';
- }
- else // handle unix EOL & other char
- normalized += c;
- }
- return normalized;
-}
-
-
-// Class StyledStreamWriter
-// //////////////////////////////////////////////////////////////////
-
-StyledStreamWriter::StyledStreamWriter( std::string indentation )
- : document_(NULL)
- , rightMargin_( 74 )
- , indentation_( indentation )
-{
-}
-
-
-void
-StyledStreamWriter::write( std::ostream &out, const Value &root )
-{
- document_ = &out;
- addChildValues_ = false;
- indentString_ = "";
- writeCommentBeforeValue( root );
- writeValue( root );
- writeCommentAfterValueOnSameLine( root );
- *document_ << "\n";
- document_ = NULL; // Forget the stream, for safety.
-}
-
-
-void
-StyledStreamWriter::writeValue( const Value &value )
-{
- switch ( value.type() )
- {
- case nullValue:
- pushValue( "null" );
- break;
- case intValue:
- pushValue( valueToString( value.asLargestInt() ) );
- break;
- case uintValue:
- pushValue( valueToString( value.asLargestUInt() ) );
- break;
- case realValue:
- pushValue( valueToString( value.asDouble() ) );
- break;
- case stringValue:
- pushValue( valueToQuotedString( value.asCString() ) );
- break;
- case booleanValue:
- pushValue( valueToString( value.asBool() ) );
- break;
- case arrayValue:
- writeArrayValue( value);
- break;
- case objectValue:
- {
- Value::Members members( value.getMemberNames() );
- if ( members.empty() )
- pushValue( "{}" );
- else
- {
- writeWithIndent( "{" );
- indent();
- Value::Members::iterator it = members.begin();
- for (;;)
- {
- const std::string &name = *it;
- const Value &childValue = value[name];
- writeCommentBeforeValue( childValue );
- writeWithIndent( valueToQuotedString( name.c_str() ) );
- *document_ << " : ";
- writeValue( childValue );
- if ( ++it == members.end() )
- {
- writeCommentAfterValueOnSameLine( childValue );
- break;
- }
- *document_ << ",";
- writeCommentAfterValueOnSameLine( childValue );
- }
- unindent();
- writeWithIndent( "}" );
- }
- }
- break;
- }
-}
-
-
-void
-StyledStreamWriter::writeArrayValue( const Value &value )
-{
- unsigned size = value.size();
- if ( size == 0 )
- pushValue( "[]" );
- else
- {
- bool isArrayMultiLine = isMultineArray( value );
- if ( isArrayMultiLine )
- {
- writeWithIndent( "[" );
- indent();
- bool hasChildValue = !childValues_.empty();
- unsigned index =0;
- for (;;)
- {
- const Value &childValue = value[index];
- writeCommentBeforeValue( childValue );
- if ( hasChildValue )
- writeWithIndent( childValues_[index] );
- else
- {
- writeIndent();
- writeValue( childValue );
- }
- if ( ++index == size )
- {
- writeCommentAfterValueOnSameLine( childValue );
- break;
- }
- *document_ << ",";
- writeCommentAfterValueOnSameLine( childValue );
- }
- unindent();
- writeWithIndent( "]" );
- }
- else // output on a single line
- {
- assert( childValues_.size() == size );
- *document_ << "[ ";
- for ( unsigned index =0; index < size; ++index )
- {
- if ( index > 0 )
- *document_ << ", ";
- *document_ << childValues_[index];
- }
- *document_ << " ]";
- }
- }
-}
-
-
-bool
-StyledStreamWriter::isMultineArray( const Value &value )
-{
- int size = value.size();
- bool isMultiLine = size*3 >= rightMargin_ ;
- childValues_.clear();
- for ( int index =0; index < size && !isMultiLine; ++index )
- {
- const Value &childValue = value[index];
- isMultiLine = isMultiLine ||
- ( (childValue.isArray() || childValue.isObject()) &&
- childValue.size() > 0 );
- }
- if ( !isMultiLine ) // check if line length > max line length
- {
- childValues_.reserve( size );
- addChildValues_ = true;
- int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]'
- for ( int index =0; index < size && !isMultiLine; ++index )
- {
- writeValue( value[index] );
- lineLength += int( childValues_[index].length() );
- isMultiLine = isMultiLine && hasCommentForValue( value[index] );
- }
- addChildValues_ = false;
- isMultiLine = isMultiLine || lineLength >= rightMargin_;
- }
- return isMultiLine;
-}
-
-
-void
-StyledStreamWriter::pushValue( const std::string &value )
-{
- if ( addChildValues_ )
- childValues_.push_back( value );
- else
- *document_ << value;
-}
-
-
-void
-StyledStreamWriter::writeIndent()
-{
- /*
- Some comments in this method would have been nice. ;-)
-
- if ( !document_.empty() )
- {
- char last = document_[document_.length()-1];
- if ( last == ' ' ) // already indented
- return;
- if ( last != '\n' ) // Comments may add new-line
- *document_ << '\n';
- }
- */
- *document_ << '\n' << indentString_;
-}
-
-
-void
-StyledStreamWriter::writeWithIndent( const std::string &value )
-{
- writeIndent();
- *document_ << value;
-}
-
-
-void
-StyledStreamWriter::indent()
-{
- indentString_ += indentation_;
-}
-
-
-void
-StyledStreamWriter::unindent()
-{
- assert( indentString_.size() >= indentation_.size() );
- indentString_.resize( indentString_.size() - indentation_.size() );
-}
-
-
-void
-StyledStreamWriter::writeCommentBeforeValue( const Value &root )
-{
- if ( !root.hasComment( commentBefore ) )
- return;
- *document_ << normalizeEOL( root.getComment( commentBefore ) );
- *document_ << "\n";
-}
-
-
-void
-StyledStreamWriter::writeCommentAfterValueOnSameLine( const Value &root )
-{
- if ( root.hasComment( commentAfterOnSameLine ) )
- *document_ << " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) );
-
- if ( root.hasComment( commentAfter ) )
- {
- *document_ << "\n";
- *document_ << normalizeEOL( root.getComment( commentAfter ) );
- *document_ << "\n";
- }
-}
-
-
-bool
-StyledStreamWriter::hasCommentForValue( const Value &value )
-{
- return value.hasComment( commentBefore )
- || value.hasComment( commentAfterOnSameLine )
- || value.hasComment( commentAfter );
-}
-
-
-std::string
-StyledStreamWriter::normalizeEOL( const std::string &text )
-{
- std::string normalized;
- normalized.reserve( text.length() );
- const char *begin = text.c_str();
- const char *end = begin + text.length();
- const char *current = begin;
- while ( current != end )
- {
- char c = *current++;
- if ( c == '\r' ) // mac or dos EOL
- {
- if ( *current == '\n' ) // convert dos EOL
- ++current;
- normalized += '\n';
- }
- else // handle unix EOL & other char
- normalized += c;
- }
- return normalized;
-}
-
-
-std::ostream& operator<<( std::ostream &sout, const Value &root )
-{
- Json::StyledStreamWriter writer;
- writer.write(sout, root);
- return sout;
-}
-
-
-} // namespace Json
diff --git a/src/3rd_party-static/jsoncpp/src/lib_json/sconscript b/src/3rd_party-static/jsoncpp/src/lib_json/sconscript
deleted file mode 100644
index f6520d185a..0000000000
--- a/src/3rd_party-static/jsoncpp/src/lib_json/sconscript
+++ /dev/null
@@ -1,8 +0,0 @@
-Import( 'env buildLibrary' )
-
-buildLibrary( env, Split( """
- json_reader.cpp
- json_value.cpp
- json_writer.cpp
- """ ),
- 'json' )
diff --git a/src/3rd_party-static/jsoncpp/src/test_lib_json/jsontest.cpp b/src/3rd_party-static/jsoncpp/src/test_lib_json/jsontest.cpp
deleted file mode 100644
index 02e7b21699..0000000000
--- a/src/3rd_party-static/jsoncpp/src/test_lib_json/jsontest.cpp
+++ /dev/null
@@ -1,608 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#define _CRT_SECURE_NO_WARNINGS 1 // Prevents deprecation warning with MSVC
-#include "jsontest.h"
-#include <stdio.h>
-#include <string>
-
-#if defined(_MSC_VER)
-// Used to install a report hook that prevent dialog on assertion and error.
-# include <crtdbg.h>
-#endif // if defined(_MSC_VER)
-
-#if defined(_WIN32)
-// Used to prevent dialog on memory fault.
-// Limits headers included by Windows.h
-# define WIN32_LEAN_AND_MEAN
-# define NOSERVICE
-# define NOMCX
-# define NOIME
-# define NOSOUND
-# define NOCOMM
-# define NORPC
-# define NOGDI
-# define NOUSER
-# define NODRIVERS
-# define NOLOGERROR
-# define NOPROFILER
-# define NOMEMMGR
-# define NOLFILEIO
-# define NOOPENFILE
-# define NORESOURCE
-# define NOATOM
-# define NOLANGUAGE
-# define NOLSTRING
-# define NODBCS
-# define NOKEYBOARDINFO
-# define NOGDICAPMASKS
-# define NOCOLOR
-# define NOGDIOBJ
-# define NODRAWTEXT
-# define NOTEXTMETRIC
-# define NOSCALABLEFONT
-# define NOBITMAP
-# define NORASTEROPS
-# define NOMETAFILE
-# define NOSYSMETRICS
-# define NOSYSTEMPARAMSINFO
-# define NOMSG
-# define NOWINSTYLES
-# define NOWINOFFSETS
-# define NOSHOWWINDOW
-# define NODEFERWINDOWPOS
-# define NOVIRTUALKEYCODES
-# define NOKEYSTATES
-# define NOWH
-# define NOMENUS
-# define NOSCROLL
-# define NOCLIPBOARD
-# define NOICONS
-# define NOMB
-# define NOSYSCOMMANDS
-# define NOMDI
-# define NOCTLMGR
-# define NOWINMESSAGES
-# include <windows.h>
-#endif // if defined(_WIN32)
-
-namespace JsonTest {
-
-
-// class TestResult
-// //////////////////////////////////////////////////////////////////
-
-TestResult::TestResult()
- : predicateId_( 1 )
- , lastUsedPredicateId_( 0 )
- , messageTarget_( 0 )
-{
- // The root predicate has id 0
- rootPredicateNode_.id_ = 0;
- rootPredicateNode_.next_ = 0;
- predicateStackTail_ = &rootPredicateNode_;
-}
-
-
-void
-TestResult::setTestName( const std::string &name )
-{
- name_ = name;
-}
-
-TestResult &
-TestResult::addFailure( const char *file, unsigned int line,
- const char *expr )
-{
- /// Walks the PredicateContext stack adding them to failures_ if not already added.
- unsigned int nestingLevel = 0;
- PredicateContext *lastNode = rootPredicateNode_.next_;
- for ( ; lastNode != 0; lastNode = lastNode->next_ )
- {
- if ( lastNode->id_ > lastUsedPredicateId_ ) // new PredicateContext
- {
- lastUsedPredicateId_ = lastNode->id_;
- addFailureInfo( lastNode->file_, lastNode->line_, lastNode->expr_,
- nestingLevel );
- // Link the PredicateContext to the failure for message target when
- // popping the PredicateContext.
- lastNode->failure_ = &( failures_.back() );
- }
- ++nestingLevel;
- }
-
- // Adds the failed assertion
- addFailureInfo( file, line, expr, nestingLevel );
- messageTarget_ = &( failures_.back() );
- return *this;
-}
-
-
-void
-TestResult::addFailureInfo( const char *file, unsigned int line,
- const char *expr, unsigned int nestingLevel )
-{
- Failure failure;
- failure.file_ = file;
- failure.line_ = line;
- if ( expr )
- {
- failure.expr_ = expr;
- }
- failure.nestingLevel_ = nestingLevel;
- failures_.push_back( failure );
-}
-
-
-TestResult &
-TestResult::popPredicateContext()
-{
- PredicateContext *lastNode = &rootPredicateNode_;
- while ( lastNode->next_ != 0 && lastNode->next_->next_ != 0 )
- {
- lastNode = lastNode->next_;
- }
- // Set message target to popped failure
- PredicateContext *tail = lastNode->next_;
- if ( tail != 0 && tail->failure_ != 0 )
- {
- messageTarget_ = tail->failure_;
- }
- // Remove tail from list
- predicateStackTail_ = lastNode;
- lastNode->next_ = 0;
- return *this;
-}
-
-
-bool
-TestResult::failed() const
-{
- return !failures_.empty();
-}
-
-
-unsigned int
-TestResult::getAssertionNestingLevel() const
-{
- unsigned int level = 0;
- const PredicateContext *lastNode = &rootPredicateNode_;
- while ( lastNode->next_ != 0 )
- {
- lastNode = lastNode->next_;
- ++level;
- }
- return level;
-}
-
-
-void
-TestResult::printFailure( bool printTestName ) const
-{
- if ( failures_.empty() )
- {
- return;
- }
-
- if ( printTestName )
- {
- printf( "* Detail of %s test failure:\n", name_.c_str() );
- }
-
- // Print in reverse to display the callstack in the right order
- Failures::const_iterator itEnd = failures_.end();
- for ( Failures::const_iterator it = failures_.begin(); it != itEnd; ++it )
- {
- const Failure &failure = *it;
- std::string indent( failure.nestingLevel_ * 2, ' ' );
- if ( failure.file_ )
- {
- printf( "%s%s(%d): ", indent.c_str(), failure.file_, failure.line_ );
- }
- if ( !failure.expr_.empty() )
- {
- printf( "%s\n", failure.expr_.c_str() );
- }
- else if ( failure.file_ )
- {
- printf( "\n" );
- }
- if ( !failure.message_.empty() )
- {
- std::string reindented = indentText( failure.message_, indent + " " );
- printf( "%s\n", reindented.c_str() );
- }
- }
-}
-
-
-std::string
-TestResult::indentText( const std::string &text,
- const std::string &indent )
-{
- std::string reindented;
- std::string::size_type lastIndex = 0;
- while ( lastIndex < text.size() )
- {
- std::string::size_type nextIndex = text.find( '\n', lastIndex );
- if ( nextIndex == std::string::npos )
- {
- nextIndex = text.size() - 1;
- }
- reindented += indent;
- reindented += text.substr( lastIndex, nextIndex - lastIndex + 1 );
- lastIndex = nextIndex + 1;
- }
- return reindented;
-}
-
-
-TestResult &
-TestResult::addToLastFailure( const std::string &message )
-{
- if ( messageTarget_ != 0 )
- {
- messageTarget_->message_ += message;
- }
- return *this;
-}
-
-
-TestResult &
-TestResult::operator << ( bool value )
-{
- return addToLastFailure( value ? "true" : "false" );
-}
-
-
-TestResult &
-TestResult::operator << ( int value )
-{
- char buffer[32];
- sprintf( buffer, "%d", value );
- return addToLastFailure( buffer );
-}
-
-
-TestResult &
-TestResult::operator << ( unsigned int value )
-{
- char buffer[32];
- sprintf( buffer, "%u", value );
- return addToLastFailure( buffer );
-}
-
-
-TestResult &
-TestResult::operator << ( double value )
-{
- char buffer[32];
- sprintf( buffer, "%16g", value );
- return addToLastFailure( buffer );
-}
-
-
-TestResult &
-TestResult::operator << ( const char *value )
-{
- return addToLastFailure( value ? value
- : "<NULL>" );
-}
-
-
-TestResult &
-TestResult::operator << ( const std::string &value )
-{
- return addToLastFailure( value );
-}
-
-
-
-// class TestCase
-// //////////////////////////////////////////////////////////////////
-
-TestCase::TestCase()
- : result_( 0 )
-{
-}
-
-
-TestCase::~TestCase()
-{
-}
-
-
-void
-TestCase::run( TestResult &result )
-{
- result_ = &result;
- runTestCase();
-}
-
-
-
-// class Runner
-// //////////////////////////////////////////////////////////////////
-
-Runner::Runner()
-{
-}
-
-
-Runner &
-Runner::add( TestCaseFactory factory )
-{
- tests_.push_back( factory );
- return *this;
-}
-
-
-unsigned int
-Runner::testCount() const
-{
- return static_cast<unsigned int>( tests_.size() );
-}
-
-
-std::string
-Runner::testNameAt( unsigned int index ) const
-{
- TestCase *test = tests_[index]();
- std::string name = test->testName();
- delete test;
- return name;
-}
-
-
-void
-Runner::runTestAt( unsigned int index, TestResult &result ) const
-{
- TestCase *test = tests_[index]();
- result.setTestName( test->testName() );
- printf( "Testing %s: ", test->testName() );
- fflush( stdout );
-#if JSON_USE_EXCEPTION
- try
- {
-#endif // if JSON_USE_EXCEPTION
- test->run( result );
-#if JSON_USE_EXCEPTION
- }
- catch ( const std::exception &e )
- {
- result.addFailure( __FILE__, __LINE__,
- "Unexpected exception caugth:" ) << e.what();
- }
-#endif // if JSON_USE_EXCEPTION
- delete test;
- const char *status = result.failed() ? "FAILED"
- : "OK";
- printf( "%s\n", status );
- fflush( stdout );
-}
-
-
-bool
-Runner::runAllTest( bool printSummary ) const
-{
- unsigned int count = testCount();
- std::deque<TestResult> failures;
- for ( unsigned int index = 0; index < count; ++index )
- {
- TestResult result;
- runTestAt( index, result );
- if ( result.failed() )
- {
- failures.push_back( result );
- }
- }
-
- if ( failures.empty() )
- {
- if ( printSummary )
- {
- printf( "All %d tests passed\n", count );
- }
- return true;
- }
- else
- {
- for ( unsigned int index = 0; index < failures.size(); ++index )
- {
- TestResult &result = failures[index];
- result.printFailure( count > 1 );
- }
-
- if ( printSummary )
- {
- unsigned int failedCount = static_cast<unsigned int>( failures.size() );
- unsigned int passedCount = count - failedCount;
- printf( "%d/%d tests passed (%d failure(s))\n", passedCount, count, failedCount );
- }
- return false;
- }
-}
-
-
-bool
-Runner::testIndex( const std::string &testName,
- unsigned int &indexOut ) const
-{
- unsigned int count = testCount();
- for ( unsigned int index = 0; index < count; ++index )
- {
- if ( testNameAt(index) == testName )
- {
- indexOut = index;
- return true;
- }
- }
- return false;
-}
-
-
-void
-Runner::listTests() const
-{
- unsigned int count = testCount();
- for ( unsigned int index = 0; index < count; ++index )
- {
- printf( "%s\n", testNameAt( index ).c_str() );
- }
-}
-
-
-int
-Runner::runCommandLine( int argc, const char *argv[] ) const
-{
- typedef std::deque<std::string> TestNames;
- Runner subrunner;
- for ( int index = 1; index < argc; ++index )
- {
- std::string opt = argv[index];
- if ( opt == "--list-tests" )
- {
- listTests();
- return 0;
- }
- else if ( opt == "--test-auto" )
- {
- preventDialogOnCrash();
- }
- else if ( opt == "--test" )
- {
- ++index;
- if ( index < argc )
- {
- unsigned int testNameIndex;
- if ( testIndex( argv[index], testNameIndex ) )
- {
- subrunner.add( tests_[testNameIndex] );
- }
- else
- {
- fprintf( stderr, "Test '%s' does not exist!\n", argv[index] );
- return 2;
- }
- }
- else
- {
- printUsage( argv[0] );
- return 2;
- }
- }
- else
- {
- printUsage( argv[0] );
- return 2;
- }
- }
- bool succeeded;
- if ( subrunner.testCount() > 0 )
- {
- succeeded = subrunner.runAllTest( subrunner.testCount() > 1 );
- }
- else
- {
- succeeded = runAllTest( true );
- }
- return succeeded ? 0
- : 1;
-}
-
-
-#if defined(_MSC_VER)
-// Hook MSVCRT assertions to prevent dialog from appearing
-static int
-msvcrtSilentReportHook( int reportType, char *message, int *returnValue )
-{
- // The default CRT handling of error and assertion is to display
- // an error dialog to the user.
- // Instead, when an error or an assertion occurs, we force the
- // application to terminate using abort() after display
- // the message on stderr.
- if ( reportType == _CRT_ERROR ||
- reportType == _CRT_ASSERT )
- {
- // calling abort() cause the ReportHook to be called
- // The following is used to detect this case and let's the
- // error handler fallback on its default behaviour (
- // display a warning message)
- static volatile bool isAborting = false;
- if ( isAborting )
- {
- return TRUE;
- }
- isAborting = true;
-
- fprintf( stderr, "CRT Error/Assert:\n%s\n", message );
- fflush( stderr );
- abort();
- }
- // Let's other reportType (_CRT_WARNING) be handled as they would by default
- return FALSE;
-}
-#endif // if defined(_MSC_VER)
-
-
-void
-Runner::preventDialogOnCrash()
-{
-#if defined(_MSC_VER)
- // Install a hook to prevent MSVCRT error and assertion from
- // popping a dialog.
- _CrtSetReportHook( &msvcrtSilentReportHook );
-#endif // if defined(_MSC_VER)
-
- // @todo investiguate this handler (for buffer overflow)
- // _set_security_error_handler
-
-#if defined(_WIN32)
- // Prevents the system from popping a dialog for debugging if the
- // application fails due to invalid memory access.
- SetErrorMode( SEM_FAILCRITICALERRORS
- | SEM_NOGPFAULTERRORBOX
- | SEM_NOOPENFILEERRORBOX );
-#endif // if defined(_WIN32)
-}
-
-void
-Runner::printUsage( const char *appName )
-{
- printf(
- "Usage: %s [options]\n"
- "\n"
- "If --test is not specified, then all the test cases be run.\n"
- "\n"
- "Valid options:\n"
- "--list-tests: print the name of all test cases on the standard\n"
- " output and exit.\n"
- "--test TESTNAME: executes the test case with the specified name.\n"
- " May be repeated.\n"
- "--test-auto: prevent dialog prompting for debugging on crash.\n"
- , appName );
-}
-
-
-
-// Assertion functions
-// //////////////////////////////////////////////////////////////////
-
-TestResult &
-checkStringEqual( TestResult &result,
- const std::string &expected, const std::string &actual,
- const char *file, unsigned int line, const char *expr )
-{
- if ( expected != actual )
- {
- result.addFailure( file, line, expr );
- result << "Expected: '" << expected << "'\n";
- result << "Actual : '" << actual << "'";
- }
- return result;
-}
-
-
-} // namespace JsonTest
diff --git a/src/3rd_party-static/jsoncpp/src/test_lib_json/jsontest.h b/src/3rd_party-static/jsoncpp/src/test_lib_json/jsontest.h
deleted file mode 100644
index 0d072382e1..0000000000
--- a/src/3rd_party-static/jsoncpp/src/test_lib_json/jsontest.h
+++ /dev/null
@@ -1,259 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#ifndef JSONTEST_H_INCLUDED
-# define JSONTEST_H_INCLUDED
-
-# include <json/config.h>
-# include <stdio.h>
-# include <deque>
-# include <string>
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// Mini Unit Testing framework
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-
-
-/** \brief Unit testing framework.
- * \warning: all assertions are non-aborting, test case execution will continue
- * even if an assertion namespace.
- * This constraint is for portability: the framework needs to compile
- * on Visual Studio 6 and must not require exception usage.
- */
-namespace JsonTest {
-
-
- class Failure
- {
- public:
- const char *file_;
- unsigned int line_;
- std::string expr_;
- std::string message_;
- unsigned int nestingLevel_;
- };
-
-
- /// Context used to create the assertion callstack on failure.
- /// Must be a POD to allow inline initialisation without stepping
- /// into the debugger.
- struct PredicateContext
- {
- typedef unsigned int Id;
- Id id_;
- const char *file_;
- unsigned int line_;
- const char *expr_;
- PredicateContext *next_;
- /// Related Failure, set when the PredicateContext is converted
- /// into a Failure.
- Failure *failure_;
- };
-
- class TestResult
- {
- public:
- TestResult();
-
- /// \internal Implementation detail for assertion macros
- /// Not encapsulated to prevent step into when debugging failed assertions
- /// Incremented by one on assertion predicate entry, decreased by one
- /// by addPredicateContext().
- PredicateContext::Id predicateId_;
-
- /// \internal Implementation detail for predicate macros
- PredicateContext *predicateStackTail_;
-
- void setTestName( const std::string &name );
-
- /// Adds an assertion failure.
- TestResult &addFailure( const char *file, unsigned int line,
- const char *expr = 0 );
-
- /// Removes the last PredicateContext added to the predicate stack
- /// chained list.
- /// Next messages will be targed at the PredicateContext that was removed.
- TestResult &popPredicateContext();
-
- bool failed() const;
-
- void printFailure( bool printTestName ) const;
-
- TestResult &operator << ( bool value );
- TestResult &operator << ( int value );
- TestResult &operator << ( unsigned int value );
- TestResult &operator << ( double value );
- TestResult &operator << ( const char *value );
- TestResult &operator << ( const std::string &value );
-
- private:
- TestResult &addToLastFailure( const std::string &message );
- unsigned int getAssertionNestingLevel() const;
- /// Adds a failure or a predicate context
- void addFailureInfo( const char *file, unsigned int line,
- const char *expr, unsigned int nestingLevel );
- static std::string indentText( const std::string &text,
- const std::string &indent );
-
- typedef std::deque<Failure> Failures;
- Failures failures_;
- std::string name_;
- PredicateContext rootPredicateNode_;
- PredicateContext::Id lastUsedPredicateId_;
- /// Failure which is the target of the messages added using operator <<
- Failure *messageTarget_;
- };
-
-
- class TestCase
- {
- public:
- TestCase();
-
- virtual ~TestCase();
-
- void run( TestResult &result );
-
- virtual const char *testName() const = 0;
-
- protected:
- TestResult *result_;
-
- private:
- virtual void runTestCase() = 0;
- };
-
- /// Function pointer type for TestCase factory
- typedef TestCase *(*TestCaseFactory)();
-
- class Runner
- {
- public:
- Runner();
-
- /// Adds a test to the suite
- Runner &add( TestCaseFactory factory );
-
- /// Runs test as specified on the command-line
- /// If no command-line arguments are provided, run all tests.
- /// If --list-tests is provided, then print the list of all test cases
- /// If --test <testname> is provided, then run test testname.
- int runCommandLine( int argc, const char *argv[] ) const;
-
- /// Runs all the test cases
- bool runAllTest( bool printSummary ) const;
-
- /// Returns the number of test case in the suite
- unsigned int testCount() const;
-
- /// Returns the name of the test case at the specified index
- std::string testNameAt( unsigned int index ) const;
-
- /// Runs the test case at the specified index using the specified TestResult
- void runTestAt( unsigned int index, TestResult &result ) const;
-
- static void printUsage( const char *appName );
-
- private: // prevents copy construction and assignment
- Runner( const Runner &other );
- Runner &operator =( const Runner &other );
-
- private:
- void listTests() const;
- bool testIndex( const std::string &testName, unsigned int &index ) const;
- static void preventDialogOnCrash();
-
- private:
- typedef std::deque<TestCaseFactory> Factories;
- Factories tests_;
- };
-
- template<typename T>
- TestResult &
- checkEqual( TestResult &result, const T &expected, const T &actual,
- const char *file, unsigned int line, const char *expr )
- {
- if ( expected != actual )
- {
- result.addFailure( file, line, expr );
- result << "Expected: " << expected << "\n";
- result << "Actual : " << actual;
- }
- return result;
- }
-
- TestResult &
- checkStringEqual( TestResult &result,
- const std::string &expected, const std::string &actual,
- const char *file, unsigned int line, const char *expr );
-
-} // namespace JsonTest
-
-
-/// \brief Asserts that the given expression is true.
-/// JSONTEST_ASSERT( x == y ) << "x=" << x << ", y=" << y;
-/// JSONTEST_ASSERT( x == y );
-#define JSONTEST_ASSERT( expr ) \
- if ( expr ) \
- { \
- } \
- else \
- result_->addFailure( __FILE__, __LINE__, #expr )
-
-/// \brief Asserts that the given predicate is true.
-/// The predicate may do other assertions and be a member function of the fixture.
-#define JSONTEST_ASSERT_PRED( expr ) \
- { \
- JsonTest::PredicateContext _minitest_Context = { \
- result_->predicateId_, __FILE__, __LINE__, #expr }; \
- result_->predicateStackTail_->next_ = &_minitest_Context; \
- result_->predicateId_ += 1; \
- result_->predicateStackTail_ = &_minitest_Context; \
- (expr); \
- result_->popPredicateContext(); \
- } \
- *result_
-
-/// \brief Asserts that two values are equals.
-#define JSONTEST_ASSERT_EQUAL( expected, actual ) \
- JsonTest::checkEqual( *result_, expected, actual, \
- __FILE__, __LINE__, \
- #expected " == " #actual )
-
-/// \brief Asserts that two values are equals.
-#define JSONTEST_ASSERT_STRING_EQUAL( expected, actual ) \
- JsonTest::checkStringEqual( *result_, \
- std::string(expected), std::string(actual), \
- #expected " == " #actual )
-
-/// \brief Begin a fixture test case.
-#define JSONTEST_FIXTURE( FixtureType, name ) \
- class Test##FixtureType##name : public FixtureType \
- { \
- public: \
- static JsonTest::TestCase *factory() \
- { \
- return new Test##FixtureType##name(); \
- } \
- public: /* overidden from TestCase */ \
- virtual const char *testName() const \
- { \
- return #FixtureType "/" #name; \
- } \
- virtual void runTestCase(); \
- }; \
- \
- void Test##FixtureType##name::runTestCase()
-
-#define JSONTEST_FIXTURE_FACTORY( FixtureType, name ) \
- &Test##FixtureType##name::factory
-
-#define JSONTEST_REGISTER_FIXTURE( runner, FixtureType, name ) \
- (runner).add( JSONTEST_FIXTURE_FACTORY( FixtureType, name ) )
-
-#endif // ifndef JSONTEST_H_INCLUDED
diff --git a/src/3rd_party-static/jsoncpp/src/test_lib_json/main.cpp b/src/3rd_party-static/jsoncpp/src/test_lib_json/main.cpp
deleted file mode 100644
index 3275219658..0000000000
--- a/src/3rd_party-static/jsoncpp/src/test_lib_json/main.cpp
+++ /dev/null
@@ -1,430 +0,0 @@
-// Copyright 2007-2010 Baptiste Lepilleur
-// Distributed under MIT license, or public domain if desired and
-// recognized in your jurisdiction.
-// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
-
-#include <json/json.h>
-#include "jsontest.h"
-
-
-// TODO:
-// - boolean value returns that they are integral. Should not be.
-// - unsigned integer in integer range are not considered to be valid integer. Should check range.
-
-
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-// Json Library test cases
-// //////////////////////////////////////////////////////////////////
-// //////////////////////////////////////////////////////////////////
-
-
-struct ValueTest : JsonTest::TestCase
-{
- Json::Value null_;
- Json::Value emptyArray_;
- Json::Value emptyObject_;
- Json::Value integer_;
- Json::Value unsignedInteger_;
- Json::Value smallUnsignedInteger_;
- Json::Value real_;
- Json::Value float_;
- Json::Value array1_;
- Json::Value object1_;
- Json::Value emptyString_;
- Json::Value string1_;
- Json::Value string_;
- Json::Value true_;
- Json::Value false_;
-
-
- ValueTest()
- : emptyArray_( Json::arrayValue )
- , emptyObject_( Json::objectValue )
- , integer_( 123456789 )
- , smallUnsignedInteger_( Json::Value::UInt( Json::Value::maxInt ) )
- , unsignedInteger_( 34567890u )
- , real_( 1234.56789 )
- , float_( 0.00390625f )
- , emptyString_( "" )
- , string1_( "a" )
- , string_( "sometext with space" )
- , true_( true )
- , false_( false )
- {
- array1_.append( 1234 );
- object1_["id"] = 1234;
- }
-
- struct IsCheck
- {
- /// Initialize all checks to \c false by default.
- IsCheck();
-
- bool isObject_;
- bool isArray_;
- bool isBool_;
- bool isDouble_;
- bool isInt_;
- bool isUInt_;
- bool isIntegral_;
- bool isNumeric_;
- bool isString_;
- bool isNull_;
- };
-
- void checkConstMemberCount( const Json::Value &value, unsigned int expectedCount );
-
- void checkMemberCount( Json::Value &value, unsigned int expectedCount );
-
- void checkIs( const Json::Value &value, const IsCheck &check );
-
- void checkIsLess( const Json::Value &x, const Json::Value &y );
-
- void checkIsEqual( const Json::Value &x, const Json::Value &y );
-};
-
-
-JSONTEST_FIXTURE( ValueTest, size )
-{
- JSONTEST_ASSERT_PRED( checkMemberCount(emptyArray_, 0) );
- JSONTEST_ASSERT_PRED( checkMemberCount(emptyObject_, 0) );
- JSONTEST_ASSERT_PRED( checkMemberCount(array1_, 1) );
- JSONTEST_ASSERT_PRED( checkMemberCount(object1_, 1) );
- JSONTEST_ASSERT_PRED( checkMemberCount(null_, 0) );
- JSONTEST_ASSERT_PRED( checkMemberCount(integer_, 0) );
- JSONTEST_ASSERT_PRED( checkMemberCount(real_, 0) );
- JSONTEST_ASSERT_PRED( checkMemberCount(emptyString_, 0) );
- JSONTEST_ASSERT_PRED( checkMemberCount(string_, 0) );
- JSONTEST_ASSERT_PRED( checkMemberCount(true_, 0) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, isObject )
-{
- IsCheck checks;
- checks.isObject_ = true;
- JSONTEST_ASSERT_PRED( checkIs( emptyObject_, checks ) );
- JSONTEST_ASSERT_PRED( checkIs( object1_, checks ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, isArray )
-{
- IsCheck checks;
- checks.isArray_ = true;
- JSONTEST_ASSERT_PRED( checkIs( emptyArray_, checks ) );
- JSONTEST_ASSERT_PRED( checkIs( array1_, checks ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, isNull )
-{
- IsCheck checks;
- checks.isNull_ = true;
- checks.isObject_ = true;
- checks.isArray_ = true;
- JSONTEST_ASSERT_PRED( checkIs( null_, checks ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, isString )
-{
- IsCheck checks;
- checks.isString_ = true;
- JSONTEST_ASSERT_PRED( checkIs( emptyString_, checks ) );
- JSONTEST_ASSERT_PRED( checkIs( string_, checks ) );
- JSONTEST_ASSERT_PRED( checkIs( string1_, checks ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, isBool )
-{
- IsCheck checks;
- checks.isBool_ = true;
- checks.isIntegral_ = true;
- checks.isNumeric_ = true;
- JSONTEST_ASSERT_PRED( checkIs( false_, checks ) );
- JSONTEST_ASSERT_PRED( checkIs( true_, checks ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, isDouble )
-{
- IsCheck checks;
- checks.isDouble_ = true;
- checks.isNumeric_ = true;
- JSONTEST_ASSERT_PRED( checkIs( real_, checks ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, isInt )
-{
- IsCheck checks;
- checks.isInt_ = true;
- checks.isNumeric_ = true;
- checks.isIntegral_ = true;
- JSONTEST_ASSERT_PRED( checkIs( integer_, checks ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, isUInt )
-{
- IsCheck checks;
- checks.isUInt_ = true;
- checks.isNumeric_ = true;
- checks.isIntegral_ = true;
- JSONTEST_ASSERT_PRED( checkIs( unsignedInteger_, checks ) );
- JSONTEST_ASSERT_PRED( checkIs( smallUnsignedInteger_, checks ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, accessArray )
-{
- const unsigned int index0 = 0;
- JSONTEST_ASSERT( Json::Value(1234) == array1_[index0] ) << "Json::Value::operator[ArrayIndex]";
- JSONTEST_ASSERT( Json::Value(1234) == array1_[0] ) << "Json::Value::operator[int]";
-
- const Json::Value &constArray = array1_;
- JSONTEST_ASSERT( Json::Value(1234) == constArray[index0] ) << "Json::Value::operator[ArrayIndex] const";
- JSONTEST_ASSERT( Json::Value(1234) == constArray[0] ) << "Json::Value::operator[int] const";
-}
-
-
-JSONTEST_FIXTURE( ValueTest, asFloat )
-{
- JSONTEST_ASSERT_EQUAL( 0.00390625f, float_.asFloat() ) << "Json::Value::asFloat()";
-}
-
-void
-ValueTest::checkConstMemberCount( const Json::Value &value, unsigned int expectedCount )
-{
- unsigned int count = 0;
- Json::Value::const_iterator itEnd = value.end();
- for ( Json::Value::const_iterator it = value.begin(); it != itEnd; ++it )
- {
- ++count;
- }
- JSONTEST_ASSERT_EQUAL( expectedCount, count ) << "Json::Value::const_iterator";
-}
-
-void
-ValueTest::checkMemberCount( Json::Value &value, unsigned int expectedCount )
-{
- JSONTEST_ASSERT_EQUAL( expectedCount, value.size() );
-
- unsigned int count = 0;
- Json::Value::iterator itEnd = value.end();
- for ( Json::Value::iterator it = value.begin(); it != itEnd; ++it )
- {
- ++count;
- }
- JSONTEST_ASSERT_EQUAL( expectedCount, count ) << "Json::Value::iterator";
-
- JSONTEST_ASSERT_PRED( checkConstMemberCount(value, expectedCount) );
-}
-
-
-ValueTest::IsCheck::IsCheck()
- : isObject_( false )
- , isArray_( false )
- , isBool_( false )
- , isDouble_( false )
- , isInt_( false )
- , isUInt_( false )
- , isIntegral_( false )
- , isNumeric_( false )
- , isString_( false )
- , isNull_( false )
-{
-}
-
-
-void
-ValueTest::checkIs( const Json::Value &value, const IsCheck &check )
-{
- JSONTEST_ASSERT_EQUAL( check.isObject_, value.isObject() );
- JSONTEST_ASSERT_EQUAL( check.isArray_, value.isArray() );
- JSONTEST_ASSERT_EQUAL( check.isBool_, value.isBool() );
- JSONTEST_ASSERT_EQUAL( check.isDouble_, value.isDouble() );
- JSONTEST_ASSERT_EQUAL( check.isInt_, value.isInt() );
- JSONTEST_ASSERT_EQUAL( check.isUInt_, value.isUInt() );
- JSONTEST_ASSERT_EQUAL( check.isIntegral_, value.isIntegral() );
- JSONTEST_ASSERT_EQUAL( check.isNumeric_, value.isNumeric() );
- JSONTEST_ASSERT_EQUAL( check.isString_, value.isString() );
- JSONTEST_ASSERT_EQUAL( check.isNull_, value.isNull() );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, compareNull )
-{
- JSONTEST_ASSERT_PRED( checkIsEqual( Json::Value(), Json::Value() ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, compareInt )
-{
- JSONTEST_ASSERT_PRED( checkIsLess( 0, 10 ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( 10, 10 ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( -10, -10 ) );
- JSONTEST_ASSERT_PRED( checkIsLess( -10, 0 ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, compareUInt )
-{
- JSONTEST_ASSERT_PRED( checkIsLess( 0u, 10u ) );
- JSONTEST_ASSERT_PRED( checkIsLess( 0u, Json::Value::maxUInt ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( 10u, 10u ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, compareDouble )
-{
- JSONTEST_ASSERT_PRED( checkIsLess( 0.0, 10.0 ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( 10.0, 10.0 ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( -10.0, -10.0 ) );
- JSONTEST_ASSERT_PRED( checkIsLess( -10.0, 0.0 ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, compareString )
-{
- JSONTEST_ASSERT_PRED( checkIsLess( "", " " ) );
- JSONTEST_ASSERT_PRED( checkIsLess( "", "a" ) );
- JSONTEST_ASSERT_PRED( checkIsLess( "abcd", "zyui" ) );
- JSONTEST_ASSERT_PRED( checkIsLess( "abc", "abcd" ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( "abcd", "abcd" ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( " ", " " ) );
- JSONTEST_ASSERT_PRED( checkIsLess( "ABCD", "abcd" ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( "ABCD", "ABCD" ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, compareBoolean )
-{
- JSONTEST_ASSERT_PRED( checkIsLess( false, true ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( false, false ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( true, true ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, compareArray )
-{
- // array compare size then content
- Json::Value emptyArray(Json::arrayValue);
- Json::Value l1aArray;
- l1aArray.append( 0 );
- Json::Value l1bArray;
- l1bArray.append( 10 );
- Json::Value l2aArray;
- l2aArray.append( 0 );
- l2aArray.append( 0 );
- Json::Value l2bArray;
- l2bArray.append( 0 );
- l2bArray.append( 10 );
- JSONTEST_ASSERT_PRED( checkIsLess( emptyArray, l1aArray ) );
- JSONTEST_ASSERT_PRED( checkIsLess( emptyArray, l2aArray ) );
- JSONTEST_ASSERT_PRED( checkIsLess( l1aArray, l2aArray ) );
- JSONTEST_ASSERT_PRED( checkIsLess( l2aArray, l2bArray ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( emptyArray, Json::Value( emptyArray ) ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( l1aArray, Json::Value( l1aArray) ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( l2bArray, Json::Value( l2bArray) ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, compareObject )
-{
- // object compare size then content
- Json::Value emptyObject(Json::objectValue);
- Json::Value l1aObject;
- l1aObject["key1"] = 0;
- Json::Value l1bObject;
- l1aObject["key1"] = 10;
- Json::Value l2aObject;
- l2aObject["key1"] = 0;
- l2aObject["key2"] = 0;
- JSONTEST_ASSERT_PRED( checkIsLess( emptyObject, l1aObject ) );
- JSONTEST_ASSERT_PRED( checkIsLess( emptyObject, l2aObject ) );
- JSONTEST_ASSERT_PRED( checkIsLess( l1aObject, l2aObject ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( emptyObject, Json::Value( emptyObject ) ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( l1aObject, Json::Value( l1aObject ) ) );
- JSONTEST_ASSERT_PRED( checkIsEqual( l2aObject, Json::Value( l2aObject ) ) );
-}
-
-
-JSONTEST_FIXTURE( ValueTest, compareType )
-{
- // object of different type are ordered according to their type
- JSONTEST_ASSERT_PRED( checkIsLess( Json::Value(), Json::Value(1) ) );
- JSONTEST_ASSERT_PRED( checkIsLess( Json::Value(1), Json::Value(1u) ) );
- JSONTEST_ASSERT_PRED( checkIsLess( Json::Value(1u), Json::Value(1.0) ) );
- JSONTEST_ASSERT_PRED( checkIsLess( Json::Value(1.0), Json::Value("a") ) );
- JSONTEST_ASSERT_PRED( checkIsLess( Json::Value("a"), Json::Value(true) ) );
- JSONTEST_ASSERT_PRED( checkIsLess( Json::Value(true), Json::Value(Json::arrayValue) ) );
- JSONTEST_ASSERT_PRED( checkIsLess( Json::Value(Json::arrayValue), Json::Value(Json::objectValue) ) );
-}
-
-
-void
-ValueTest::checkIsLess( const Json::Value &x, const Json::Value &y )
-{
- JSONTEST_ASSERT( x < y );
- JSONTEST_ASSERT( y > x );
- JSONTEST_ASSERT( x <= y );
- JSONTEST_ASSERT( y >= x );
- JSONTEST_ASSERT( !(x == y) );
- JSONTEST_ASSERT( !(y == x) );
- JSONTEST_ASSERT( !(x >= y) );
- JSONTEST_ASSERT( !(y <= x) );
- JSONTEST_ASSERT( !(x > y) );
- JSONTEST_ASSERT( !(y < x) );
- JSONTEST_ASSERT( x.compare( y ) < 0 );
- JSONTEST_ASSERT( y.compare( x ) >= 0 );
-}
-
-
-void
-ValueTest::checkIsEqual( const Json::Value &x, const Json::Value &y )
-{
- JSONTEST_ASSERT( x == y );
- JSONTEST_ASSERT( y == x );
- JSONTEST_ASSERT( x <= y );
- JSONTEST_ASSERT( y <= x );
- JSONTEST_ASSERT( x >= y );
- JSONTEST_ASSERT( y >= x );
- JSONTEST_ASSERT( !(x < y) );
- JSONTEST_ASSERT( !(y < x) );
- JSONTEST_ASSERT( !(x > y) );
- JSONTEST_ASSERT( !(y > x) );
- JSONTEST_ASSERT( x.compare( y ) == 0 );
- JSONTEST_ASSERT( y.compare( x ) == 0 );
-}
-
-
-int main( int argc, const char *argv[] )
-{
- JsonTest::Runner runner;
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, size );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isObject );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isArray );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isBool );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isInt );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isUInt );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isDouble );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isString );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isNull );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isNull );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, accessArray );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, asFloat );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, compareNull );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, compareInt );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, compareUInt );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, compareDouble );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, compareString );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, compareBoolean );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, compareArray );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, compareObject );
- JSONTEST_REGISTER_FIXTURE( runner, ValueTest, compareType );
- return runner.runCommandLine( argc, argv );
-}
diff --git a/src/3rd_party-static/jsoncpp/src/test_lib_json/sconscript b/src/3rd_party-static/jsoncpp/src/test_lib_json/sconscript
deleted file mode 100644
index 84f56b6a02..0000000000
--- a/src/3rd_party-static/jsoncpp/src/test_lib_json/sconscript
+++ /dev/null
@@ -1,10 +0,0 @@
-Import( 'env_testing buildUnitTests' )
-
-buildUnitTests( env_testing, Split( """
- main.cpp
- jsontest.cpp
- """ ),
- 'test_lib_json' )
-
-# For 'check' to work, 'libs' must be built first.
-env_testing.Depends('test_lib_json', '#libs')
diff --git a/src/3rd_party-static/jsoncpp/test/cleantests.py b/src/3rd_party-static/jsoncpp/test/cleantests.py
deleted file mode 100644
index c38fd8ffdd..0000000000
--- a/src/3rd_party-static/jsoncpp/test/cleantests.py
+++ /dev/null
@@ -1,10 +0,0 @@
-# removes all files created during testing
-import glob
-import os
-
-paths = []
-for pattern in [ '*.actual', '*.actual-rewrite', '*.rewrite', '*.process-output' ]:
- paths += glob.glob( 'data/' + pattern )
-
-for path in paths:
- os.unlink( path )
diff --git a/src/3rd_party-static/jsoncpp/test/data/fail_test_array_01.json b/src/3rd_party-static/jsoncpp/test/data/fail_test_array_01.json
deleted file mode 100644
index 900fcc2093..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/fail_test_array_01.json
+++ /dev/null
@@ -1 +0,0 @@
-[ 1 2 3]
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_01.expected b/src/3rd_party-static/jsoncpp/test/data/test_array_01.expected
deleted file mode 100644
index 4aa8fb3379..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_01.expected
+++ /dev/null
@@ -1 +0,0 @@
-.=[]
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_01.json b/src/3rd_party-static/jsoncpp/test/data/test_array_01.json
deleted file mode 100644
index 60b0742537..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_01.json
+++ /dev/null
@@ -1 +0,0 @@
-[]
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_02.expected b/src/3rd_party-static/jsoncpp/test/data/test_array_02.expected
deleted file mode 100644
index 5b7c72af40..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_02.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=[]
-.[0]=1
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_02.json b/src/3rd_party-static/jsoncpp/test/data/test_array_02.json
deleted file mode 100644
index c02be12907..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_02.json
+++ /dev/null
@@ -1 +0,0 @@
-[1]
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_03.expected b/src/3rd_party-static/jsoncpp/test/data/test_array_03.expected
deleted file mode 100644
index 0ba568e0d8..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_03.expected
+++ /dev/null
@@ -1,6 +0,0 @@
-.=[]
-.[0]=1
-.[1]=2
-.[2]=3
-.[3]=4
-.[4]=5
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_03.json b/src/3rd_party-static/jsoncpp/test/data/test_array_03.json
deleted file mode 100644
index ac8f422f0a..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_03.json
+++ /dev/null
@@ -1 +0,0 @@
-[ 1, 2 , 3,4,5]
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_04.expected b/src/3rd_party-static/jsoncpp/test/data/test_array_04.expected
deleted file mode 100644
index db58c306a3..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_04.expected
+++ /dev/null
@@ -1,5 +0,0 @@
-.=[]
-.[0]=1
-.[1]="abc"
-.[2]=12.3
-.[3]=-4
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_04.json b/src/3rd_party-static/jsoncpp/test/data/test_array_04.json
deleted file mode 100644
index 075547881e..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_04.json
+++ /dev/null
@@ -1 +0,0 @@
-[1, "abc" , 12.3, -4]
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_05.expected b/src/3rd_party-static/jsoncpp/test/data/test_array_05.expected
deleted file mode 100644
index 82ad48434f..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_05.expected
+++ /dev/null
@@ -1,100 +0,0 @@
-.=[]
-.[0]=1
-.[1]=2
-.[2]=3
-.[3]=4
-.[4]=5
-.[5]=6
-.[6]=7
-.[7]=8
-.[8]=9
-.[9]=10
-.[10]=11
-.[11]=12
-.[12]=13
-.[13]=14
-.[14]=15
-.[15]=16
-.[16]=17
-.[17]=18
-.[18]=19
-.[19]=20
-.[20]=21
-.[21]=22
-.[22]=23
-.[23]=24
-.[24]=25
-.[25]=26
-.[26]=27
-.[27]=28
-.[28]=29
-.[29]=30
-.[30]=31
-.[31]=32
-.[32]=33
-.[33]=34
-.[34]=35
-.[35]=36
-.[36]=37
-.[37]=38
-.[38]=39
-.[39]=40
-.[40]=41
-.[41]=42
-.[42]=43
-.[43]=44
-.[44]=45
-.[45]=46
-.[46]=47
-.[47]=48
-.[48]=49
-.[49]=50
-.[50]=51
-.[51]=52
-.[52]=53
-.[53]=54
-.[54]=55
-.[55]=56
-.[56]=57
-.[57]=58
-.[58]=59
-.[59]=60
-.[60]=61
-.[61]=62
-.[62]=63
-.[63]=64
-.[64]=65
-.[65]=66
-.[66]=67
-.[67]=68
-.[68]=69
-.[69]=70
-.[70]=71
-.[71]=72
-.[72]=73
-.[73]=74
-.[74]=75
-.[75]=76
-.[76]=77
-.[77]=78
-.[78]=79
-.[79]=80
-.[80]=81
-.[81]=82
-.[82]=83
-.[83]=84
-.[84]=85
-.[85]=86
-.[86]=87
-.[87]=88
-.[88]=89
-.[89]=90
-.[90]=91
-.[91]=92
-.[92]=93
-.[93]=94
-.[94]=95
-.[95]=96
-.[96]=97
-.[97]=98
-.[98]=99
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_05.json b/src/3rd_party-static/jsoncpp/test/data/test_array_05.json
deleted file mode 100644
index 7809d6c9a1..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_05.json
+++ /dev/null
@@ -1 +0,0 @@
-[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_06.expected b/src/3rd_party-static/jsoncpp/test/data/test_array_06.expected
deleted file mode 100644
index e087b6328a..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_06.expected
+++ /dev/null
@@ -1,5 +0,0 @@
-.=[]
-.[0]="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-.[1]="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
-.[2]="ccccccccccccccccccccccc"
-.[3]="dddddddddddddddddddddddddddddddddddddddddddddddddddd"
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_array_06.json b/src/3rd_party-static/jsoncpp/test/data/test_array_06.json
deleted file mode 100644
index 9777a64084..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_array_06.json
+++ /dev/null
@@ -1,4 +0,0 @@
-[ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
- "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
- "ccccccccccccccccccccccc",
- "dddddddddddddddddddddddddddddddddddddddddddddddddddd" ] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_01.expected b/src/3rd_party-static/jsoncpp/test/data/test_basic_01.expected
deleted file mode 100644
index 0527387017..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_01.expected
+++ /dev/null
@@ -1 +0,0 @@
-.=123456789
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_01.json b/src/3rd_party-static/jsoncpp/test/data/test_basic_01.json
deleted file mode 100644
index 57cf9b9115..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_01.json
+++ /dev/null
@@ -1 +0,0 @@
-0123456789
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_02.expected b/src/3rd_party-static/jsoncpp/test/data/test_basic_02.expected
deleted file mode 100644
index 9040e845eb..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_02.expected
+++ /dev/null
@@ -1 +0,0 @@
-.=-123456789
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_02.json b/src/3rd_party-static/jsoncpp/test/data/test_basic_02.json
deleted file mode 100644
index fe84da4d15..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_02.json
+++ /dev/null
@@ -1 +0,0 @@
--0123456789
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_03.expected b/src/3rd_party-static/jsoncpp/test/data/test_basic_03.expected
deleted file mode 100644
index 494278df28..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_03.expected
+++ /dev/null
@@ -1,3 +0,0 @@
-.=1.2345678
-
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_03.json b/src/3rd_party-static/jsoncpp/test/data/test_basic_03.json
deleted file mode 100644
index feac15012c..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_03.json
+++ /dev/null
@@ -1,3 +0,0 @@
-1.2345678
-
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_04.expected b/src/3rd_party-static/jsoncpp/test/data/test_basic_04.expected
deleted file mode 100644
index 659f7440e9..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_04.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.="abcdef"
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_04.json b/src/3rd_party-static/jsoncpp/test/data/test_basic_04.json
deleted file mode 100644
index 01374bd286..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_04.json
+++ /dev/null
@@ -1,2 +0,0 @@
-"abcdef"
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_05.expected b/src/3rd_party-static/jsoncpp/test/data/test_basic_05.expected
deleted file mode 100644
index cb1cdada81..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_05.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=null
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_05.json b/src/3rd_party-static/jsoncpp/test/data/test_basic_05.json
deleted file mode 100644
index a6d4f5a687..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_05.json
+++ /dev/null
@@ -1,2 +0,0 @@
-null
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_06.expected b/src/3rd_party-static/jsoncpp/test/data/test_basic_06.expected
deleted file mode 100644
index 8b2273103d..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_06.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=true
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_06.json b/src/3rd_party-static/jsoncpp/test/data/test_basic_06.json
deleted file mode 100644
index 5d967af031..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_06.json
+++ /dev/null
@@ -1,2 +0,0 @@
-true
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_07.expected b/src/3rd_party-static/jsoncpp/test/data/test_basic_07.expected
deleted file mode 100644
index 4979ed5049..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_07.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=false
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_07.json b/src/3rd_party-static/jsoncpp/test/data/test_basic_07.json
deleted file mode 100644
index b7ee6c5b34..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_07.json
+++ /dev/null
@@ -1,2 +0,0 @@
-false
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_08.expected b/src/3rd_party-static/jsoncpp/test/data/test_basic_08.expected
deleted file mode 100644
index cb1cdada81..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_08.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=null
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_08.json b/src/3rd_party-static/jsoncpp/test/data/test_basic_08.json
deleted file mode 100644
index fe107f47b9..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_08.json
+++ /dev/null
@@ -1,3 +0,0 @@
-// C++ style comment
-null
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_09.expected b/src/3rd_party-static/jsoncpp/test/data/test_basic_09.expected
deleted file mode 100644
index cb1cdada81..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_09.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=null
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_basic_09.json b/src/3rd_party-static/jsoncpp/test/data/test_basic_09.json
deleted file mode 100644
index e0cb0890e4..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_basic_09.json
+++ /dev/null
@@ -1,4 +0,0 @@
-/* C style comment
- */
-null
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_comment_01.expected b/src/3rd_party-static/jsoncpp/test/data/test_comment_01.expected
deleted file mode 100644
index 0b8f42d504..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_comment_01.expected
+++ /dev/null
@@ -1,8 +0,0 @@
-.={}
-.test=[]
-.test[0]={}
-.test[0].a="aaa"
-.test[1]={}
-.test[1].b="bbb"
-.test[2]={}
-.test[2].c="ccc"
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_comment_01.json b/src/3rd_party-static/jsoncpp/test/data/test_comment_01.json
deleted file mode 100644
index 0de8f9cf73..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_comment_01.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "test":
- [
- { "a" : "aaa" }, // Comment for a
- { "b" : "bbb" }, // Comment for b
- { "c" : "ccc" } // Comment for c
- ]
-}
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_complex_01.expected b/src/3rd_party-static/jsoncpp/test/data/test_complex_01.expected
deleted file mode 100644
index 44e753bfde..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_complex_01.expected
+++ /dev/null
@@ -1,20 +0,0 @@
-.={}
-.attribute=[]
-.attribute[0]="random"
-.attribute[1]="short"
-.attribute[2]="bold"
-.attribute[3]=12
-.attribute[4]={}
-.attribute[4].height=7
-.attribute[4].width=64
-.count=1234
-.name={}
-.name.aka="T.E.S.T."
-.name.id=123987
-.test={}
-.test.1={}
-.test.1.2={}
-.test.1.2.3={}
-.test.1.2.3.coord=[]
-.test.1.2.3.coord[0]=1
-.test.1.2.3.coord[1]=2
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_complex_01.json b/src/3rd_party-static/jsoncpp/test/data/test_complex_01.json
deleted file mode 100644
index fb2f86c64b..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_complex_01.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "count" : 1234,
- "name" : { "aka" : "T.E.S.T.", "id" : 123987 },
- "attribute" : [
- "random",
- "short",
- "bold",
- 12,
- { "height" : 7, "width" : 64 }
- ],
- "test": { "1" :
- { "2" :
- { "3" : { "coord" : [ 1,2] }
- }
- }
- }
-}
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_01.expected b/src/3rd_party-static/jsoncpp/test/data/test_integer_01.expected
deleted file mode 100644
index 24aa29e223..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_01.expected
+++ /dev/null
@@ -1 +0,0 @@
-.=2147483647
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_01.json b/src/3rd_party-static/jsoncpp/test/data/test_integer_01.json
deleted file mode 100644
index e82c7ad728..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_01.json
+++ /dev/null
@@ -1,2 +0,0 @@
-// Max signed integer
-2147483647
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_02.expected b/src/3rd_party-static/jsoncpp/test/data/test_integer_02.expected
deleted file mode 100644
index dab99eb8e9..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_02.expected
+++ /dev/null
@@ -1 +0,0 @@
-.=-2147483648
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_02.json b/src/3rd_party-static/jsoncpp/test/data/test_integer_02.json
deleted file mode 100644
index 548764eba3..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_02.json
+++ /dev/null
@@ -1,2 +0,0 @@
-// Min signed integer
--2147483648
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_03.expected b/src/3rd_party-static/jsoncpp/test/data/test_integer_03.expected
deleted file mode 100644
index dde326050f..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_03.expected
+++ /dev/null
@@ -1 +0,0 @@
-.=4294967295
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_03.json b/src/3rd_party-static/jsoncpp/test/data/test_integer_03.json
deleted file mode 100644
index 18aeaf612a..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_03.json
+++ /dev/null
@@ -1,2 +0,0 @@
-// Max unsigned integer
-4294967295
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_04.expected b/src/3rd_party-static/jsoncpp/test/data/test_integer_04.expected
deleted file mode 100644
index 8da90136bc..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_04.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=0
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_04.json b/src/3rd_party-static/jsoncpp/test/data/test_integer_04.json
deleted file mode 100644
index 82024833a5..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_04.json
+++ /dev/null
@@ -1,3 +0,0 @@
-// Min unsigned integer
-0
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_05.expected b/src/3rd_party-static/jsoncpp/test/data/test_integer_05.expected
deleted file mode 100644
index 238d1d6e17..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_05.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=1
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_05.json b/src/3rd_party-static/jsoncpp/test/data/test_integer_05.json
deleted file mode 100644
index 4797790135..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_05.json
+++ /dev/null
@@ -1,2 +0,0 @@
-1
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_06_64bits.expected b/src/3rd_party-static/jsoncpp/test/data/test_integer_06_64bits.expected
deleted file mode 100644
index bc9520a1d8..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_06_64bits.expected
+++ /dev/null
@@ -1 +0,0 @@
-.=9223372036854775808
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_06_64bits.json b/src/3rd_party-static/jsoncpp/test/data/test_integer_06_64bits.json
deleted file mode 100644
index 360d66078a..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_06_64bits.json
+++ /dev/null
@@ -1,2 +0,0 @@
-9223372036854775808
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_07_64bits.expected b/src/3rd_party-static/jsoncpp/test/data/test_integer_07_64bits.expected
deleted file mode 100644
index 39eb798db6..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_07_64bits.expected
+++ /dev/null
@@ -1 +0,0 @@
-.=-9223372036854775808
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_07_64bits.json b/src/3rd_party-static/jsoncpp/test/data/test_integer_07_64bits.json
deleted file mode 100644
index 11d8513cf2..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_07_64bits.json
+++ /dev/null
@@ -1,2 +0,0 @@
--9223372036854775808
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_08_64bits.expected b/src/3rd_party-static/jsoncpp/test/data/test_integer_08_64bits.expected
deleted file mode 100644
index 831f4325e2..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_08_64bits.expected
+++ /dev/null
@@ -1 +0,0 @@
-.=18446744073709551615
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_integer_08_64bits.json b/src/3rd_party-static/jsoncpp/test/data/test_integer_08_64bits.json
deleted file mode 100644
index 6e1fb04364..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_integer_08_64bits.json
+++ /dev/null
@@ -1,2 +0,0 @@
-18446744073709551615
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_large_01.expected b/src/3rd_party-static/jsoncpp/test/data/test_large_01.expected
deleted file mode 100644
index ee2fafc010..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_large_01.expected
+++ /dev/null
@@ -1,2122 +0,0 @@
-.=[]
-.[0]=[]
-.[0][0]="A"
-.[0][1]=0
-.[0][2]=1
-.[0][3]=2
-.[0][4]=3
-.[0][5]=4
-.[0][6]=5
-.[0][7]=6
-.[0][8]=7
-.[0][9]=8
-.[0][10]=9
-.[0][11]=10
-.[0][12]=11
-.[0][13]=12
-.[0][14]=13
-.[0][15]=14
-.[0][16]=15
-.[0][17]=16
-.[0][18]=17
-.[0][19]=18
-.[0][20]=19
-.[0][21]=20
-.[0][22]=21
-.[0][23]=22
-.[0][24]=23
-.[0][25]=24
-.[0][26]=25
-.[0][27]=26
-.[0][28]=27
-.[0][29]=28
-.[0][30]=29
-.[0][31]=30
-.[0][32]=31
-.[0][33]=32
-.[0][34]=33
-.[0][35]=34
-.[0][36]=35
-.[0][37]=36
-.[0][38]=37
-.[0][39]=38
-.[0][40]=39
-.[0][41]=40
-.[0][42]=41
-.[0][43]=42
-.[0][44]=43
-.[0][45]=44
-.[0][46]=45
-.[0][47]=46
-.[0][48]=47
-.[0][49]=48
-.[0][50]=49
-.[0][51]=50
-.[0][52]=51
-.[0][53]=52
-.[0][54]=53
-.[0][55]=54
-.[0][56]=55
-.[0][57]=56
-.[0][58]=57
-.[0][59]=58
-.[0][60]=59
-.[0][61]=60
-.[0][62]=61
-.[0][63]=62
-.[0][64]=63
-.[0][65]=64
-.[0][66]=65
-.[0][67]=66
-.[0][68]=67
-.[0][69]=68
-.[0][70]=69
-.[0][71]=70
-.[0][72]=71
-.[0][73]=72
-.[0][74]=73
-.[0][75]=74
-.[0][76]=75
-.[0][77]=76
-.[0][78]=77
-.[0][79]=78
-.[0][80]=79
-.[0][81]=80
-.[0][82]=81
-.[0][83]=82
-.[0][84]=83
-.[0][85]=84
-.[0][86]=85
-.[0][87]=86
-.[0][88]=87
-.[0][89]=88
-.[0][90]=89
-.[0][91]=90
-.[0][92]=91
-.[0][93]=92
-.[0][94]=93
-.[0][95]=94
-.[0][96]=95
-.[0][97]=96
-.[0][98]=97
-.[0][99]=98
-.[0][100]=99
-.[0][101]=100
-.[0][102]=101
-.[0][103]=102
-.[0][104]=103
-.[0][105]=104
-.[0][106]=105
-.[0][107]=106
-.[0][108]=107
-.[0][109]=108
-.[0][110]=109
-.[0][111]=110
-.[0][112]=111
-.[0][113]=112
-.[0][114]=113
-.[0][115]=114
-.[0][116]=115
-.[0][117]=116
-.[0][118]=117
-.[0][119]=118
-.[0][120]=119
-.[0][121]=120
-.[0][122]=121
-.[0][123]=122
-.[0][124]=123
-.[0][125]=124
-.[0][126]=125
-.[0][127]=126
-.[0][128]=127
-.[0][129]=128
-.[0][130]=129
-.[0][131]=130
-.[0][132]=131
-.[0][133]=132
-.[0][134]=133
-.[0][135]=134
-.[0][136]=135
-.[0][137]=136
-.[0][138]=137
-.[0][139]=138
-.[0][140]=139
-.[0][141]=140
-.[0][142]=141
-.[0][143]=142
-.[0][144]=143
-.[0][145]=144
-.[0][146]=145
-.[0][147]=146
-.[0][148]=147
-.[0][149]=148
-.[0][150]=149
-.[0][151]=150
-.[0][152]=151
-.[0][153]=152
-.[0][154]=153
-.[0][155]=154
-.[0][156]=155
-.[0][157]=156
-.[0][158]=157
-.[0][159]=158
-.[0][160]=159
-.[0][161]=160
-.[0][162]=161
-.[0][163]=162
-.[0][164]=163
-.[0][165]=164
-.[0][166]=165
-.[0][167]=166
-.[0][168]=167
-.[0][169]=168
-.[0][170]=169
-.[0][171]=170
-.[0][172]=171
-.[0][173]=172
-.[0][174]=173
-.[0][175]=174
-.[0][176]=175
-.[0][177]=176
-.[0][178]=177
-.[0][179]=178
-.[0][180]=179
-.[0][181]=180
-.[0][182]=181
-.[0][183]=182
-.[0][184]=183
-.[0][185]=184
-.[0][186]=185
-.[0][187]=186
-.[0][188]=187
-.[0][189]=188
-.[0][190]=189
-.[0][191]=190
-.[0][192]=191
-.[0][193]=192
-.[0][194]=193
-.[0][195]=194
-.[0][196]=195
-.[0][197]=196
-.[0][198]=197
-.[0][199]=198
-.[0][200]=199
-.[0][201]=200
-.[0][202]=201
-.[0][203]=202
-.[0][204]=203
-.[0][205]=204
-.[0][206]=205
-.[0][207]=206
-.[0][208]=207
-.[0][209]=208
-.[0][210]=209
-.[0][211]=210
-.[0][212]=211
-.[0][213]=212
-.[0][214]=213
-.[0][215]=214
-.[0][216]=215
-.[0][217]=216
-.[0][218]=217
-.[0][219]=218
-.[0][220]=219
-.[0][221]=220
-.[0][222]=221
-.[0][223]=222
-.[0][224]=223
-.[0][225]=224
-.[0][226]=225
-.[0][227]=226
-.[0][228]=227
-.[0][229]=228
-.[0][230]=229
-.[0][231]=230
-.[0][232]=231
-.[0][233]=232
-.[0][234]=233
-.[0][235]=234
-.[0][236]=235
-.[0][237]=236
-.[0][238]=237
-.[0][239]=238
-.[0][240]=239
-.[0][241]=240
-.[0][242]=241
-.[0][243]=242
-.[0][244]=243
-.[0][245]=244
-.[0][246]=245
-.[0][247]=246
-.[0][248]=247
-.[0][249]=248
-.[0][250]=249
-.[0][251]=250
-.[0][252]=251
-.[0][253]=252
-.[0][254]=253
-.[0][255]=254
-.[0][256]=255
-.[0][257]=256
-.[0][258]=257
-.[0][259]=258
-.[0][260]=259
-.[0][261]=260
-.[0][262]=261
-.[0][263]=262
-.[0][264]=263
-.[0][265]=264
-.[0][266]=265
-.[0][267]=266
-.[0][268]=267
-.[0][269]=268
-.[0][270]=269
-.[0][271]=270
-.[0][272]=271
-.[0][273]=272
-.[0][274]=273
-.[0][275]=274
-.[0][276]=275
-.[0][277]=276
-.[0][278]=277
-.[0][279]=278
-.[0][280]=279
-.[0][281]=280
-.[0][282]=281
-.[0][283]=282
-.[0][284]=283
-.[0][285]=284
-.[0][286]=285
-.[0][287]=286
-.[0][288]=287
-.[0][289]=288
-.[0][290]=289
-.[0][291]=290
-.[0][292]=291
-.[0][293]=292
-.[0][294]=293
-.[0][295]=294
-.[0][296]=295
-.[0][297]=296
-.[0][298]=297
-.[0][299]=298
-.[0][300]=299
-.[0][301]=300
-.[0][302]=301
-.[0][303]=302
-.[0][304]=303
-.[0][305]=304
-.[0][306]=305
-.[0][307]=306
-.[0][308]=307
-.[0][309]=308
-.[0][310]=309
-.[0][311]=310
-.[0][312]=311
-.[0][313]=312
-.[0][314]=313
-.[0][315]=314
-.[0][316]=315
-.[0][317]=316
-.[0][318]=317
-.[0][319]=318
-.[0][320]=319
-.[0][321]=320
-.[0][322]=321
-.[0][323]=322
-.[0][324]=323
-.[0][325]=324
-.[0][326]=325
-.[0][327]=326
-.[0][328]=327
-.[0][329]=328
-.[0][330]=329
-.[0][331]=330
-.[0][332]=331
-.[0][333]=332
-.[0][334]=333
-.[0][335]=334
-.[0][336]=335
-.[0][337]=336
-.[0][338]=337
-.[0][339]=338
-.[0][340]=339
-.[0][341]=340
-.[0][342]=341
-.[0][343]=342
-.[0][344]=343
-.[0][345]=344
-.[0][346]=345
-.[0][347]=346
-.[0][348]=347
-.[0][349]=348
-.[0][350]=349
-.[0][351]=350
-.[0][352]=351
-.[0][353]=352
-.[0][354]=353
-.[0][355]=354
-.[0][356]=355
-.[0][357]=356
-.[0][358]=357
-.[0][359]=358
-.[0][360]=359
-.[0][361]=360
-.[0][362]=361
-.[0][363]=362
-.[0][364]=363
-.[0][365]=364
-.[0][366]=365
-.[0][367]=366
-.[0][368]=367
-.[0][369]=368
-.[0][370]=369
-.[0][371]=370
-.[0][372]=371
-.[0][373]=372
-.[0][374]=373
-.[0][375]=374
-.[0][376]=375
-.[0][377]=376
-.[0][378]=377
-.[0][379]=378
-.[0][380]=379
-.[0][381]=380
-.[0][382]=381
-.[0][383]=382
-.[0][384]=383
-.[0][385]=384
-.[0][386]=385
-.[0][387]=386
-.[0][388]=387
-.[0][389]=388
-.[0][390]=389
-.[0][391]=390
-.[0][392]=391
-.[0][393]=392
-.[0][394]=393
-.[0][395]=394
-.[0][396]=395
-.[0][397]=396
-.[0][398]=397
-.[0][399]=398
-.[0][400]=399
-.[0][401]=400
-.[0][402]=401
-.[0][403]=402
-.[0][404]=403
-.[0][405]=404
-.[0][406]=405
-.[0][407]=406
-.[0][408]=407
-.[0][409]=408
-.[0][410]=409
-.[0][411]=410
-.[0][412]=411
-.[0][413]=412
-.[0][414]=413
-.[0][415]=414
-.[0][416]=415
-.[0][417]=416
-.[0][418]=417
-.[0][419]=418
-.[0][420]=419
-.[0][421]=420
-.[0][422]=421
-.[0][423]=422
-.[0][424]=423
-.[0][425]=424
-.[0][426]=425
-.[0][427]=426
-.[0][428]=427
-.[0][429]=428
-.[0][430]=429
-.[0][431]=430
-.[0][432]=431
-.[0][433]=432
-.[0][434]=433
-.[0][435]=434
-.[0][436]=435
-.[0][437]=436
-.[0][438]=437
-.[0][439]=438
-.[0][440]=439
-.[0][441]=440
-.[0][442]=441
-.[0][443]=442
-.[0][444]=443
-.[0][445]=444
-.[0][446]=445
-.[0][447]=446
-.[0][448]=447
-.[0][449]=448
-.[0][450]=449
-.[0][451]=450
-.[0][452]=451
-.[0][453]=452
-.[0][454]=453
-.[0][455]=454
-.[0][456]=455
-.[0][457]=456
-.[0][458]=457
-.[0][459]=458
-.[0][460]=459
-.[0][461]=460
-.[0][462]=461
-.[0][463]=462
-.[0][464]=463
-.[0][465]=464
-.[0][466]=465
-.[0][467]=466
-.[0][468]=467
-.[0][469]=468
-.[0][470]=469
-.[0][471]=470
-.[0][472]=471
-.[0][473]=472
-.[0][474]=473
-.[0][475]=474
-.[0][476]=475
-.[0][477]=476
-.[0][478]=477
-.[0][479]=478
-.[0][480]=479
-.[0][481]=480
-.[0][482]=481
-.[0][483]=482
-.[0][484]=483
-.[0][485]=484
-.[0][486]=485
-.[0][487]=486
-.[0][488]=487
-.[0][489]=488
-.[0][490]=489
-.[0][491]=490
-.[0][492]=491
-.[0][493]=492
-.[0][494]=493
-.[0][495]=494
-.[0][496]=495
-.[0][497]=496
-.[0][498]=497
-.[0][499]=498
-.[0][500]=499
-.[0][501]=500
-.[0][502]=501
-.[0][503]=502
-.[0][504]=503
-.[0][505]=504
-.[0][506]=505
-.[0][507]=506
-.[0][508]=507
-.[0][509]=508
-.[0][510]=509
-.[0][511]=510
-.[0][512]=511
-.[0][513]=512
-.[0][514]=513
-.[0][515]=514
-.[0][516]=515
-.[0][517]=516
-.[0][518]=517
-.[0][519]=518
-.[0][520]=519
-.[0][521]=520
-.[0][522]=521
-.[0][523]=522
-.[0][524]=523
-.[0][525]=524
-.[0][526]=525
-.[0][527]=526
-.[0][528]=527
-.[0][529]=528
-.[0][530]=529
-.[0][531]=530
-.[0][532]=531
-.[0][533]=532
-.[0][534]=533
-.[0][535]=534
-.[0][536]=535
-.[0][537]=536
-.[0][538]=537
-.[0][539]=538
-.[0][540]=539
-.[0][541]=540
-.[0][542]=541
-.[0][543]=542
-.[0][544]=543
-.[0][545]=544
-.[0][546]=545
-.[0][547]=546
-.[0][548]=547
-.[0][549]=548
-.[0][550]=549
-.[0][551]=550
-.[0][552]=551
-.[0][553]=552
-.[0][554]=553
-.[0][555]=554
-.[0][556]=555
-.[0][557]=556
-.[0][558]=557
-.[0][559]=558
-.[0][560]=559
-.[0][561]=560
-.[0][562]=561
-.[0][563]=562
-.[0][564]=563
-.[0][565]=564
-.[0][566]=565
-.[0][567]=566
-.[0][568]=567
-.[0][569]=568
-.[0][570]=569
-.[0][571]=570
-.[0][572]=571
-.[0][573]=572
-.[0][574]=573
-.[0][575]=574
-.[0][576]=575
-.[0][577]=576
-.[0][578]=577
-.[0][579]=578
-.[0][580]=579
-.[0][581]=580
-.[0][582]=581
-.[0][583]=582
-.[0][584]=583
-.[0][585]=584
-.[0][586]=585
-.[0][587]=586
-.[0][588]=587
-.[0][589]=588
-.[0][590]=589
-.[0][591]=590
-.[0][592]=591
-.[0][593]=592
-.[0][594]=593
-.[0][595]=594
-.[0][596]=595
-.[0][597]=596
-.[0][598]=597
-.[0][599]=598
-.[0][600]=599
-.[0][601]=600
-.[0][602]=601
-.[0][603]=602
-.[0][604]=603
-.[0][605]=604
-.[0][606]=605
-.[0][607]=606
-.[0][608]=607
-.[0][609]=608
-.[0][610]=609
-.[0][611]=610
-.[0][612]=611
-.[0][613]=612
-.[0][614]=613
-.[0][615]=614
-.[0][616]=615
-.[0][617]=616
-.[0][618]=617
-.[0][619]=618
-.[0][620]=619
-.[0][621]=620
-.[0][622]=621
-.[0][623]=622
-.[0][624]=623
-.[0][625]=624
-.[0][626]=625
-.[0][627]=626
-.[0][628]=627
-.[0][629]=628
-.[0][630]=629
-.[0][631]=630
-.[0][632]=631
-.[0][633]=632
-.[0][634]=633
-.[0][635]=634
-.[0][636]=635
-.[0][637]=636
-.[0][638]=637
-.[0][639]=638
-.[0][640]=639
-.[0][641]=640
-.[0][642]=641
-.[0][643]=642
-.[0][644]=643
-.[0][645]=644
-.[0][646]=645
-.[0][647]=646
-.[0][648]=647
-.[0][649]=648
-.[0][650]=649
-.[0][651]=650
-.[0][652]=651
-.[0][653]=652
-.[0][654]=653
-.[0][655]=654
-.[0][656]=655
-.[0][657]=656
-.[0][658]=657
-.[0][659]=658
-.[0][660]=659
-.[0][661]=660
-.[0][662]=661
-.[0][663]=662
-.[0][664]=663
-.[0][665]=664
-.[0][666]=665
-.[0][667]=666
-.[0][668]=667
-.[0][669]=668
-.[0][670]=669
-.[0][671]=670
-.[0][672]=671
-.[0][673]=672
-.[0][674]=673
-.[0][675]=674
-.[0][676]=675
-.[0][677]=676
-.[0][678]=677
-.[0][679]=678
-.[0][680]=679
-.[0][681]=680
-.[0][682]=681
-.[0][683]=682
-.[0][684]=683
-.[0][685]=684
-.[0][686]=685
-.[0][687]=686
-.[0][688]=687
-.[0][689]=688
-.[0][690]=689
-.[0][691]=690
-.[0][692]=691
-.[0][693]=692
-.[0][694]=693
-.[0][695]=694
-.[0][696]=695
-.[0][697]=696
-.[0][698]=697
-.[0][699]=698
-.[0][700]=699
-.[0][701]=700
-.[0][702]=701
-.[0][703]=702
-.[0][704]=703
-.[0][705]=704
-.[0][706]=705
-.[0][707]=706
-.[0][708]=707
-.[0][709]=708
-.[0][710]=709
-.[0][711]=710
-.[0][712]=711
-.[0][713]=712
-.[0][714]=713
-.[0][715]=714
-.[0][716]=715
-.[0][717]=716
-.[0][718]=717
-.[0][719]=718
-.[0][720]=719
-.[0][721]=720
-.[0][722]=721
-.[0][723]=722
-.[0][724]=723
-.[0][725]=724
-.[0][726]=725
-.[0][727]=726
-.[0][728]=727
-.[0][729]=728
-.[0][730]=729
-.[0][731]=730
-.[0][732]=731
-.[0][733]=732
-.[0][734]=733
-.[0][735]=734
-.[0][736]=735
-.[0][737]=736
-.[0][738]=737
-.[0][739]=738
-.[0][740]=739
-.[0][741]=740
-.[0][742]=741
-.[0][743]=742
-.[0][744]=743
-.[0][745]=744
-.[0][746]=745
-.[0][747]=746
-.[0][748]=747
-.[0][749]=748
-.[0][750]=749
-.[0][751]=750
-.[0][752]=751
-.[0][753]=752
-.[0][754]=753
-.[0][755]=754
-.[0][756]=755
-.[0][757]=756
-.[0][758]=757
-.[0][759]=758
-.[0][760]=759
-.[0][761]=760
-.[0][762]=761
-.[0][763]=762
-.[0][764]=763
-.[0][765]=764
-.[0][766]=765
-.[0][767]=766
-.[0][768]=767
-.[0][769]=768
-.[0][770]=769
-.[0][771]=770
-.[0][772]=771
-.[0][773]=772
-.[0][774]=773
-.[0][775]=774
-.[0][776]=775
-.[0][777]=776
-.[0][778]=777
-.[0][779]=778
-.[0][780]=779
-.[0][781]=780
-.[0][782]=781
-.[0][783]=782
-.[0][784]=783
-.[0][785]=784
-.[0][786]=785
-.[0][787]=786
-.[0][788]=787
-.[0][789]=788
-.[0][790]=789
-.[0][791]=790
-.[0][792]=791
-.[0][793]=792
-.[0][794]=793
-.[0][795]=794
-.[0][796]=795
-.[0][797]=796
-.[0][798]=797
-.[0][799]=798
-.[0][800]=799
-.[0][801]=800
-.[0][802]=801
-.[0][803]=802
-.[0][804]=803
-.[0][805]=804
-.[0][806]=805
-.[0][807]=806
-.[0][808]=807
-.[0][809]=808
-.[0][810]=809
-.[0][811]=810
-.[0][812]=811
-.[0][813]=812
-.[0][814]=813
-.[0][815]=814
-.[0][816]=815
-.[0][817]=816
-.[0][818]=817
-.[0][819]=818
-.[0][820]=819
-.[0][821]=820
-.[0][822]=821
-.[0][823]=822
-.[0][824]=823
-.[0][825]=824
-.[0][826]=825
-.[0][827]=826
-.[0][828]=827
-.[0][829]=828
-.[0][830]=829
-.[0][831]=830
-.[0][832]=831
-.[0][833]=832
-.[0][834]=833
-.[0][835]=834
-.[0][836]=835
-.[0][837]=836
-.[0][838]=837
-.[0][839]=838
-.[0][840]=839
-.[0][841]=840
-.[0][842]=841
-.[0][843]=842
-.[0][844]=843
-.[0][845]=844
-.[0][846]=845
-.[0][847]=846
-.[0][848]=847
-.[0][849]=848
-.[0][850]=849
-.[0][851]=850
-.[0][852]=851
-.[0][853]=852
-.[0][854]=853
-.[0][855]=854
-.[0][856]=855
-.[0][857]=856
-.[0][858]=857
-.[0][859]=858
-.[0][860]=859
-.[0][861]=860
-.[0][862]=861
-.[0][863]=862
-.[0][864]=863
-.[0][865]=864
-.[0][866]=865
-.[0][867]=866
-.[0][868]=867
-.[0][869]=868
-.[0][870]=869
-.[0][871]=870
-.[0][872]=871
-.[0][873]=872
-.[0][874]=873
-.[0][875]=874
-.[0][876]=875
-.[0][877]=876
-.[0][878]=877
-.[0][879]=878
-.[0][880]=879
-.[0][881]=880
-.[0][882]=881
-.[0][883]=882
-.[0][884]=883
-.[0][885]=884
-.[0][886]=885
-.[0][887]=886
-.[0][888]=887
-.[0][889]=888
-.[0][890]=889
-.[0][891]=890
-.[0][892]=891
-.[0][893]=892
-.[0][894]=893
-.[0][895]=894
-.[0][896]=895
-.[0][897]=896
-.[0][898]=897
-.[0][899]=898
-.[0][900]=899
-.[0][901]=900
-.[0][902]=901
-.[0][903]=902
-.[0][904]=903
-.[0][905]=904
-.[0][906]=905
-.[0][907]=906
-.[0][908]=907
-.[0][909]=908
-.[0][910]=909
-.[0][911]=910
-.[0][912]=911
-.[0][913]=912
-.[0][914]=913
-.[0][915]=914
-.[0][916]=915
-.[0][917]=916
-.[0][918]=917
-.[0][919]=918
-.[0][920]=919
-.[0][921]=920
-.[0][922]=921
-.[0][923]=922
-.[0][924]=923
-.[0][925]=924
-.[0][926]=925
-.[0][927]=926
-.[0][928]=927
-.[0][929]=928
-.[0][930]=929
-.[0][931]=930
-.[0][932]=931
-.[0][933]=932
-.[0][934]=933
-.[0][935]=934
-.[0][936]=935
-.[0][937]=936
-.[0][938]=937
-.[0][939]=938
-.[0][940]=939
-.[0][941]=940
-.[0][942]=941
-.[0][943]=942
-.[0][944]=943
-.[0][945]=944
-.[0][946]=945
-.[0][947]=946
-.[0][948]=947
-.[0][949]=948
-.[0][950]=949
-.[0][951]=950
-.[0][952]=951
-.[0][953]=952
-.[0][954]=953
-.[0][955]=954
-.[0][956]=955
-.[0][957]=956
-.[0][958]=957
-.[0][959]=958
-.[0][960]=959
-.[0][961]=960
-.[0][962]=961
-.[0][963]=962
-.[0][964]=963
-.[0][965]=964
-.[0][966]=965
-.[0][967]=966
-.[0][968]=967
-.[0][969]=968
-.[0][970]=969
-.[0][971]=970
-.[0][972]=971
-.[0][973]=972
-.[0][974]=973
-.[0][975]=974
-.[0][976]=975
-.[0][977]=976
-.[0][978]=977
-.[0][979]=978
-.[0][980]=979
-.[0][981]=980
-.[0][982]=981
-.[0][983]=982
-.[0][984]=983
-.[0][985]=984
-.[0][986]=985
-.[0][987]=986
-.[0][988]=987
-.[0][989]=988
-.[0][990]=989
-.[0][991]=990
-.[0][992]=991
-.[0][993]=992
-.[0][994]=993
-.[0][995]=994
-.[0][996]=995
-.[0][997]=996
-.[0][998]=997
-.[0][999]=998
-.[0][1000]=999
-.[0][1001]=1000
-.[0][1002]=1001
-.[0][1003]=1002
-.[0][1004]=1003
-.[0][1005]=1004
-.[0][1006]=1005
-.[0][1007]=1006
-.[0][1008]=1007
-.[0][1009]=1008
-.[0][1010]=1009
-.[0][1011]=1010
-.[0][1012]=1011
-.[0][1013]=1012
-.[0][1014]=1013
-.[0][1015]=1014
-.[0][1016]=1015
-.[0][1017]=1016
-.[0][1018]=1017
-.[0][1019]=1018
-.[0][1020]=1019
-.[0][1021]=1020
-.[0][1022]=1021
-.[0][1023]=1022
-.[0][1024]=1023
-.[0][1025]=1024
-.[0][1026]=1025
-.[0][1027]=1026
-.[0][1028]=1027
-.[0][1029]=1028
-.[0][1030]=1029
-.[0][1031]=1030
-.[0][1032]=1031
-.[0][1033]=1032
-.[0][1034]=1033
-.[0][1035]=1034
-.[0][1036]=1035
-.[0][1037]=1036
-.[0][1038]=1037
-.[0][1039]=1038
-.[0][1040]=1039
-.[0][1041]=1040
-.[0][1042]=1041
-.[0][1043]=1042
-.[0][1044]=1043
-.[0][1045]=1044
-.[0][1046]=1045
-.[0][1047]=1046
-.[0][1048]=1047
-.[0][1049]=1048
-.[0][1050]=1049
-.[0][1051]=1050
-.[0][1052]=1051
-.[0][1053]=1052
-.[0][1054]=1053
-.[0][1055]=1054
-.[0][1056]=1055
-.[0][1057]=1056
-.[0][1058]=1057
-.[0][1059]=1058
-.[0][1060]=1059
-.[0][1061]=1060
-.[0][1062]=1061
-.[0][1063]=1062
-.[0][1064]=1063
-.[0][1065]=1064
-.[0][1066]=1065
-.[0][1067]=1066
-.[0][1068]=1067
-.[0][1069]=1068
-.[0][1070]=1069
-.[0][1071]=1070
-.[0][1072]=1071
-.[0][1073]=1072
-.[0][1074]=1073
-.[0][1075]=1074
-.[0][1076]=1075
-.[0][1077]=1076
-.[0][1078]=1077
-.[0][1079]=1078
-.[0][1080]=1079
-.[0][1081]=1080
-.[0][1082]=1081
-.[0][1083]=1082
-.[0][1084]=1083
-.[0][1085]=1084
-.[0][1086]=1085
-.[0][1087]=1086
-.[0][1088]=1087
-.[0][1089]=1088
-.[0][1090]=1089
-.[0][1091]=1090
-.[0][1092]=1091
-.[0][1093]=1092
-.[0][1094]=1093
-.[0][1095]=1094
-.[0][1096]=1095
-.[0][1097]=1096
-.[0][1098]=1097
-.[0][1099]=1098
-.[0][1100]=1099
-.[0][1101]=1100
-.[0][1102]=1101
-.[0][1103]=1102
-.[0][1104]=1103
-.[0][1105]=1104
-.[0][1106]=1105
-.[0][1107]=1106
-.[0][1108]=1107
-.[0][1109]=1108
-.[0][1110]=1109
-.[0][1111]=1110
-.[0][1112]=1111
-.[0][1113]=1112
-.[0][1114]=1113
-.[0][1115]=1114
-.[0][1116]=1115
-.[0][1117]=1116
-.[0][1118]=1117
-.[0][1119]=1118
-.[0][1120]=1119
-.[0][1121]=1120
-.[0][1122]=1121
-.[0][1123]=1122
-.[0][1124]=1123
-.[0][1125]=1124
-.[0][1126]=1125
-.[0][1127]=1126
-.[0][1128]=1127
-.[0][1129]=1128
-.[0][1130]=1129
-.[0][1131]=1130
-.[0][1132]=1131
-.[0][1133]=1132
-.[0][1134]=1133
-.[0][1135]=1134
-.[0][1136]=1135
-.[0][1137]=1136
-.[0][1138]=1137
-.[0][1139]=1138
-.[0][1140]=1139
-.[0][1141]=1140
-.[0][1142]=1141
-.[0][1143]=1142
-.[0][1144]=1143
-.[0][1145]=1144
-.[0][1146]=1145
-.[0][1147]=1146
-.[0][1148]=1147
-.[0][1149]=1148
-.[0][1150]=1149
-.[0][1151]=1150
-.[0][1152]=1151
-.[0][1153]=1152
-.[0][1154]=1153
-.[0][1155]=1154
-.[0][1156]=1155
-.[0][1157]=1156
-.[0][1158]=1157
-.[0][1159]=1158
-.[0][1160]=1159
-.[0][1161]=1160
-.[0][1162]=1161
-.[0][1163]=1162
-.[0][1164]=1163
-.[0][1165]=1164
-.[0][1166]=1165
-.[0][1167]=1166
-.[0][1168]=1167
-.[0][1169]=1168
-.[0][1170]=1169
-.[0][1171]=1170
-.[0][1172]=1171
-.[0][1173]=1172
-.[0][1174]=1173
-.[0][1175]=1174
-.[0][1176]=1175
-.[0][1177]=1176
-.[0][1178]=1177
-.[0][1179]=1178
-.[0][1180]=1179
-.[0][1181]=1180
-.[0][1182]=1181
-.[0][1183]=1182
-.[0][1184]=1183
-.[0][1185]=1184
-.[0][1186]=1185
-.[0][1187]=1186
-.[0][1188]=1187
-.[0][1189]=1188
-.[0][1190]=1189
-.[0][1191]=1190
-.[0][1192]=1191
-.[0][1193]=1192
-.[0][1194]=1193
-.[0][1195]=1194
-.[0][1196]=1195
-.[0][1197]=1196
-.[0][1198]=1197
-.[0][1199]=1198
-.[0][1200]=1199
-.[0][1201]=1200
-.[0][1202]=1201
-.[0][1203]=1202
-.[0][1204]=1203
-.[0][1205]=1204
-.[0][1206]=1205
-.[0][1207]=1206
-.[0][1208]=1207
-.[0][1209]=1208
-.[0][1210]=1209
-.[0][1211]=1210
-.[0][1212]=1211
-.[0][1213]=1212
-.[0][1214]=1213
-.[0][1215]=1214
-.[0][1216]=1215
-.[0][1217]=1216
-.[0][1218]=1217
-.[0][1219]=1218
-.[0][1220]=1219
-.[0][1221]=1220
-.[0][1222]=1221
-.[0][1223]=1222
-.[0][1224]=1223
-.[0][1225]=1224
-.[0][1226]=1225
-.[0][1227]=1226
-.[0][1228]=1227
-.[0][1229]=1228
-.[0][1230]=1229
-.[0][1231]=1230
-.[0][1232]=1231
-.[0][1233]=1232
-.[0][1234]=1233
-.[0][1235]=1234
-.[0][1236]=1235
-.[0][1237]=1236
-.[0][1238]=1237
-.[0][1239]=1238
-.[0][1240]=1239
-.[0][1241]=1240
-.[0][1242]=1241
-.[0][1243]=1242
-.[0][1244]=1243
-.[0][1245]=1244
-.[0][1246]=1245
-.[0][1247]=1246
-.[0][1248]=1247
-.[0][1249]=1248
-.[0][1250]=1249
-.[0][1251]=1250
-.[0][1252]=1251
-.[0][1253]=1252
-.[0][1254]=1253
-.[0][1255]=1254
-.[0][1256]=1255
-.[0][1257]=1256
-.[0][1258]=1257
-.[0][1259]=1258
-.[0][1260]=1259
-.[0][1261]=1260
-.[0][1262]=1261
-.[0][1263]=1262
-.[0][1264]=1263
-.[0][1265]=1264
-.[0][1266]=1265
-.[0][1267]=1266
-.[0][1268]=1267
-.[0][1269]=1268
-.[0][1270]=1269
-.[0][1271]=1270
-.[0][1272]=1271
-.[0][1273]=1272
-.[0][1274]=1273
-.[0][1275]=1274
-.[0][1276]=1275
-.[0][1277]=1276
-.[0][1278]=1277
-.[0][1279]=1278
-.[0][1280]=1279
-.[0][1281]=1280
-.[0][1282]=1281
-.[0][1283]=1282
-.[0][1284]=1283
-.[0][1285]=1284
-.[0][1286]=1285
-.[0][1287]=1286
-.[0][1288]=1287
-.[0][1289]=1288
-.[0][1290]=1289
-.[0][1291]=1290
-.[0][1292]=1291
-.[0][1293]=1292
-.[0][1294]=1293
-.[0][1295]=1294
-.[0][1296]=1295
-.[0][1297]=1296
-.[0][1298]=1297
-.[0][1299]=1298
-.[0][1300]=1299
-.[0][1301]=1300
-.[0][1302]=1301
-.[0][1303]=1302
-.[0][1304]=1303
-.[0][1305]=1304
-.[0][1306]=1305
-.[0][1307]=1306
-.[0][1308]=1307
-.[0][1309]=1308
-.[0][1310]=1309
-.[0][1311]=1310
-.[0][1312]=1311
-.[0][1313]=1312
-.[0][1314]=1313
-.[0][1315]=1314
-.[0][1316]=1315
-.[0][1317]=1316
-.[0][1318]=1317
-.[0][1319]=1318
-.[0][1320]=1319
-.[0][1321]=1320
-.[0][1322]=1321
-.[0][1323]=1322
-.[0][1324]=1323
-.[0][1325]=1324
-.[0][1326]=1325
-.[0][1327]=1326
-.[0][1328]=1327
-.[0][1329]=1328
-.[0][1330]=1329
-.[0][1331]=1330
-.[0][1332]=1331
-.[0][1333]=1332
-.[0][1334]=1333
-.[0][1335]=1334
-.[0][1336]=1335
-.[0][1337]=1336
-.[0][1338]=1337
-.[0][1339]=1338
-.[0][1340]=1339
-.[0][1341]=1340
-.[0][1342]=1341
-.[0][1343]=1342
-.[0][1344]=1343
-.[0][1345]=1344
-.[0][1346]=1345
-.[0][1347]=1346
-.[0][1348]=1347
-.[0][1349]=1348
-.[0][1350]=1349
-.[0][1351]=1350
-.[0][1352]=1351
-.[0][1353]=1352
-.[0][1354]=1353
-.[0][1355]=1354
-.[0][1356]=1355
-.[0][1357]=1356
-.[0][1358]=1357
-.[0][1359]=1358
-.[0][1360]=1359
-.[0][1361]=1360
-.[0][1362]=1361
-.[0][1363]=1362
-.[0][1364]=1363
-.[0][1365]=1364
-.[0][1366]=1365
-.[0][1367]=1366
-.[0][1368]=1367
-.[0][1369]=1368
-.[0][1370]=1369
-.[0][1371]=1370
-.[0][1372]=1371
-.[0][1373]=1372
-.[0][1374]=1373
-.[0][1375]=1374
-.[0][1376]=1375
-.[0][1377]=1376
-.[0][1378]=1377
-.[0][1379]=1378
-.[0][1380]=1379
-.[0][1381]=1380
-.[0][1382]=1381
-.[0][1383]=1382
-.[0][1384]=1383
-.[0][1385]=1384
-.[0][1386]=1385
-.[0][1387]=1386
-.[0][1388]=1387
-.[0][1389]=1388
-.[0][1390]=1389
-.[0][1391]=1390
-.[0][1392]=1391
-.[0][1393]=1392
-.[0][1394]=1393
-.[0][1395]=1394
-.[0][1396]=1395
-.[0][1397]=1396
-.[0][1398]=1397
-.[0][1399]=1398
-.[0][1400]=1399
-.[0][1401]=1400
-.[0][1402]=1401
-.[0][1403]=1402
-.[0][1404]=1403
-.[0][1405]=1404
-.[0][1406]=1405
-.[0][1407]=1406
-.[0][1408]=1407
-.[0][1409]=1408
-.[0][1410]=1409
-.[0][1411]=1410
-.[0][1412]=1411
-.[0][1413]=1412
-.[0][1414]=1413
-.[0][1415]=1414
-.[0][1416]=1415
-.[0][1417]=1416
-.[0][1418]=1417
-.[0][1419]=1418
-.[0][1420]=1419
-.[0][1421]=1420
-.[0][1422]=1421
-.[0][1423]=1422
-.[0][1424]=1423
-.[0][1425]=1424
-.[0][1426]=1425
-.[0][1427]=1426
-.[0][1428]=1427
-.[0][1429]=1428
-.[0][1430]=1429
-.[0][1431]=1430
-.[0][1432]=1431
-.[0][1433]=1432
-.[0][1434]=1433
-.[0][1435]=1434
-.[0][1436]=1435
-.[0][1437]=1436
-.[0][1438]=1437
-.[0][1439]=1438
-.[0][1440]=1439
-.[0][1441]=1440
-.[0][1442]=1441
-.[0][1443]=1442
-.[0][1444]=1443
-.[0][1445]=1444
-.[0][1446]=1445
-.[0][1447]=1446
-.[0][1448]=1447
-.[0][1449]=1448
-.[0][1450]=1449
-.[0][1451]=1450
-.[0][1452]=1451
-.[0][1453]=1452
-.[0][1454]=1453
-.[0][1455]=1454
-.[0][1456]=1455
-.[0][1457]=1456
-.[0][1458]=1457
-.[0][1459]=1458
-.[0][1460]=1459
-.[0][1461]=1460
-.[0][1462]=1461
-.[0][1463]=1462
-.[0][1464]=1463
-.[0][1465]=1464
-.[0][1466]=1465
-.[0][1467]=1466
-.[0][1468]=1467
-.[0][1469]=1468
-.[0][1470]=1469
-.[0][1471]=1470
-.[0][1472]=1471
-.[0][1473]=1472
-.[0][1474]=1473
-.[0][1475]=1474
-.[0][1476]=1475
-.[0][1477]=1476
-.[0][1478]=1477
-.[0][1479]=1478
-.[0][1480]=1479
-.[0][1481]=1480
-.[0][1482]=1481
-.[0][1483]=1482
-.[0][1484]=1483
-.[0][1485]=1484
-.[0][1486]=1485
-.[0][1487]=1486
-.[0][1488]=1487
-.[0][1489]=1488
-.[0][1490]=1489
-.[0][1491]=1490
-.[0][1492]=1491
-.[0][1493]=1492
-.[0][1494]=1493
-.[0][1495]=1494
-.[0][1496]=1495
-.[0][1497]=1496
-.[0][1498]=1497
-.[0][1499]=1498
-.[0][1500]=1499
-.[0][1501]=1500
-.[0][1502]=1501
-.[0][1503]=1502
-.[0][1504]=1503
-.[0][1505]=1504
-.[0][1506]=1505
-.[0][1507]=1506
-.[0][1508]=1507
-.[0][1509]=1508
-.[0][1510]=1509
-.[0][1511]=1510
-.[0][1512]=1511
-.[0][1513]=1512
-.[0][1514]=1513
-.[0][1515]=1514
-.[0][1516]=1515
-.[0][1517]=1516
-.[0][1518]=1517
-.[0][1519]=1518
-.[0][1520]=1519
-.[0][1521]=1520
-.[0][1522]=1521
-.[0][1523]=1522
-.[0][1524]=1523
-.[0][1525]=1524
-.[0][1526]=1525
-.[0][1527]=1526
-.[0][1528]=1527
-.[0][1529]=1528
-.[0][1530]=1529
-.[0][1531]=1530
-.[0][1532]=1531
-.[0][1533]=1532
-.[0][1534]=1533
-.[0][1535]=1534
-.[0][1536]=1535
-.[0][1537]=1536
-.[0][1538]=1537
-.[0][1539]=1538
-.[0][1540]=1539
-.[0][1541]=1540
-.[0][1542]=1541
-.[0][1543]=1542
-.[0][1544]=1543
-.[0][1545]=1544
-.[0][1546]=1545
-.[0][1547]=1546
-.[0][1548]=1547
-.[0][1549]=1548
-.[0][1550]=1549
-.[0][1551]=1550
-.[0][1552]=1551
-.[0][1553]=1552
-.[0][1554]=1553
-.[0][1555]=1554
-.[0][1556]=1555
-.[0][1557]=1556
-.[0][1558]=1557
-.[0][1559]=1558
-.[0][1560]=1559
-.[0][1561]=1560
-.[0][1562]=1561
-.[0][1563]=1562
-.[0][1564]=1563
-.[0][1565]=1564
-.[0][1566]=1565
-.[0][1567]=1566
-.[0][1568]=1567
-.[0][1569]=1568
-.[0][1570]=1569
-.[0][1571]=1570
-.[0][1572]=1571
-.[0][1573]=1572
-.[0][1574]=1573
-.[0][1575]=1574
-.[0][1576]=1575
-.[0][1577]=1576
-.[0][1578]=1577
-.[0][1579]=1578
-.[0][1580]=1579
-.[0][1581]=1580
-.[0][1582]=1581
-.[0][1583]=1582
-.[0][1584]=1583
-.[0][1585]=1584
-.[0][1586]=1585
-.[0][1587]=1586
-.[0][1588]=1587
-.[0][1589]=1588
-.[0][1590]=1589
-.[0][1591]=1590
-.[0][1592]=1591
-.[0][1593]=1592
-.[0][1594]=1593
-.[0][1595]=1594
-.[0][1596]=1595
-.[0][1597]=1596
-.[0][1598]=1597
-.[0][1599]=1598
-.[0][1600]=1599
-.[0][1601]=1600
-.[0][1602]=1601
-.[0][1603]=1602
-.[0][1604]=1603
-.[0][1605]=1604
-.[0][1606]=1605
-.[0][1607]=1606
-.[0][1608]=1607
-.[0][1609]=1608
-.[0][1610]=1609
-.[0][1611]=1610
-.[0][1612]=1611
-.[0][1613]=1612
-.[0][1614]=1613
-.[0][1615]=1614
-.[0][1616]=1615
-.[0][1617]=1616
-.[0][1618]=1617
-.[0][1619]=1618
-.[0][1620]=1619
-.[0][1621]=1620
-.[0][1622]=1621
-.[0][1623]=1622
-.[0][1624]=1623
-.[0][1625]=1624
-.[0][1626]=1625
-.[0][1627]=1626
-.[0][1628]=1627
-.[0][1629]=1628
-.[0][1630]=1629
-.[0][1631]=1630
-.[0][1632]=1631
-.[0][1633]=1632
-.[0][1634]=1633
-.[0][1635]=1634
-.[0][1636]=1635
-.[0][1637]=1636
-.[0][1638]=1637
-.[0][1639]=1638
-.[0][1640]=1639
-.[0][1641]=1640
-.[0][1642]=1641
-.[0][1643]=1642
-.[0][1644]=1643
-.[0][1645]=1644
-.[0][1646]=1645
-.[0][1647]=1646
-.[0][1648]=1647
-.[0][1649]=1648
-.[0][1650]=1649
-.[0][1651]=1650
-.[0][1652]=1651
-.[0][1653]=1652
-.[0][1654]=1653
-.[0][1655]=1654
-.[0][1656]=1655
-.[0][1657]=1656
-.[0][1658]=1657
-.[0][1659]=1658
-.[0][1660]=1659
-.[0][1661]=1660
-.[0][1662]=1661
-.[0][1663]=1662
-.[0][1664]=1663
-.[0][1665]=1664
-.[0][1666]=1665
-.[0][1667]=1666
-.[0][1668]=1667
-.[0][1669]=1668
-.[0][1670]=1669
-.[0][1671]=1670
-.[0][1672]=1671
-.[0][1673]=1672
-.[0][1674]=1673
-.[0][1675]=1674
-.[0][1676]=1675
-.[0][1677]=1676
-.[0][1678]=1677
-.[0][1679]=1678
-.[0][1680]=1679
-.[0][1681]=1680
-.[0][1682]=1681
-.[0][1683]=1682
-.[0][1684]=1683
-.[0][1685]=1684
-.[0][1686]=1685
-.[0][1687]=1686
-.[0][1688]=1687
-.[0][1689]=1688
-.[0][1690]=1689
-.[0][1691]=1690
-.[0][1692]=1691
-.[0][1693]=1692
-.[0][1694]=1693
-.[0][1695]=1694
-.[0][1696]=1695
-.[0][1697]=1696
-.[0][1698]=1697
-.[0][1699]=1698
-.[0][1700]=1699
-.[0][1701]=1700
-.[0][1702]=1701
-.[0][1703]=1702
-.[0][1704]=1703
-.[0][1705]=1704
-.[0][1706]=1705
-.[0][1707]=1706
-.[0][1708]=1707
-.[0][1709]=1708
-.[0][1710]=1709
-.[0][1711]=1710
-.[0][1712]=1711
-.[0][1713]=1712
-.[0][1714]=1713
-.[0][1715]=1714
-.[0][1716]=1715
-.[0][1717]=1716
-.[0][1718]=1717
-.[0][1719]=1718
-.[0][1720]=1719
-.[0][1721]=1720
-.[0][1722]=1721
-.[0][1723]=1722
-.[0][1724]=1723
-.[0][1725]=1724
-.[0][1726]=1725
-.[0][1727]=1726
-.[0][1728]=1727
-.[0][1729]=1728
-.[0][1730]=1729
-.[0][1731]=1730
-.[0][1732]=1731
-.[0][1733]=1732
-.[0][1734]=1733
-.[0][1735]=1734
-.[0][1736]=1735
-.[0][1737]=1736
-.[0][1738]=1737
-.[0][1739]=1738
-.[0][1740]=1739
-.[0][1741]=1740
-.[0][1742]=1741
-.[0][1743]=1742
-.[0][1744]=1743
-.[0][1745]=1744
-.[0][1746]=1745
-.[0][1747]=1746
-.[0][1748]=1747
-.[0][1749]=1748
-.[0][1750]=1749
-.[0][1751]=1750
-.[0][1752]=1751
-.[0][1753]=1752
-.[0][1754]=1753
-.[0][1755]=1754
-.[0][1756]=1755
-.[0][1757]=1756
-.[0][1758]=1757
-.[0][1759]=1758
-.[0][1760]=1759
-.[0][1761]=1760
-.[0][1762]=1761
-.[0][1763]=1762
-.[0][1764]=1763
-.[0][1765]=1764
-.[0][1766]=1765
-.[0][1767]=1766
-.[0][1768]=1767
-.[0][1769]=1768
-.[0][1770]=1769
-.[0][1771]=1770
-.[0][1772]=1771
-.[0][1773]=1772
-.[0][1774]=1773
-.[0][1775]=1774
-.[0][1776]=1775
-.[0][1777]=1776
-.[0][1778]=1777
-.[0][1779]=1778
-.[0][1780]=1779
-.[0][1781]=1780
-.[0][1782]=1781
-.[0][1783]=1782
-.[0][1784]=1783
-.[0][1785]=1784
-.[0][1786]=1785
-.[0][1787]=1786
-.[0][1788]=1787
-.[0][1789]=1788
-.[0][1790]=1789
-.[0][1791]=1790
-.[0][1792]=1791
-.[0][1793]=1792
-.[0][1794]=1793
-.[0][1795]=1794
-.[0][1796]=1795
-.[0][1797]=1796
-.[0][1798]=1797
-.[0][1799]=1798
-.[0][1800]=1799
-.[0][1801]=1800
-.[0][1802]=1801
-.[0][1803]=1802
-.[0][1804]=1803
-.[0][1805]=1804
-.[0][1806]=1805
-.[0][1807]=1806
-.[0][1808]=1807
-.[0][1809]=1808
-.[0][1810]=1809
-.[0][1811]=1810
-.[0][1812]=1811
-.[0][1813]=1812
-.[0][1814]=1813
-.[0][1815]=1814
-.[0][1816]=1815
-.[0][1817]=1816
-.[0][1818]=1817
-.[0][1819]=1818
-.[0][1820]=1819
-.[0][1821]=1820
-.[0][1822]=1821
-.[0][1823]=1822
-.[0][1824]=1823
-.[0][1825]=1824
-.[0][1826]=1825
-.[0][1827]=1826
-.[0][1828]=1827
-.[0][1829]=1828
-.[0][1830]=1829
-.[0][1831]=1830
-.[0][1832]=1831
-.[0][1833]=1832
-.[0][1834]=1833
-.[0][1835]=1834
-.[0][1836]=1835
-.[0][1837]=1836
-.[0][1838]=1837
-.[0][1839]=1838
-.[0][1840]=1839
-.[0][1841]=1840
-.[0][1842]=1841
-.[0][1843]=1842
-.[0][1844]=1843
-.[0][1845]=1844
-.[0][1846]=1845
-.[0][1847]=1846
-.[0][1848]=1847
-.[0][1849]=1848
-.[0][1850]=1849
-.[0][1851]=1850
-.[0][1852]=1851
-.[0][1853]=1852
-.[0][1854]=1853
-.[0][1855]=1854
-.[0][1856]=1855
-.[0][1857]=1856
-.[0][1858]=1857
-.[0][1859]=1858
-.[0][1860]=1859
-.[0][1861]=1860
-.[0][1862]=1861
-.[0][1863]=1862
-.[0][1864]=1863
-.[0][1865]=1864
-.[0][1866]=1865
-.[0][1867]=1866
-.[0][1868]=1867
-.[0][1869]=1868
-.[0][1870]=1869
-.[0][1871]=1870
-.[0][1872]=1871
-.[0][1873]=1872
-.[0][1874]=1873
-.[0][1875]=1874
-.[0][1876]=1875
-.[0][1877]=1876
-.[0][1878]=1877
-.[0][1879]=1878
-.[0][1880]=1879
-.[0][1881]=1880
-.[0][1882]=1881
-.[0][1883]=1882
-.[0][1884]=1883
-.[0][1885]=1884
-.[0][1886]=1885
-.[0][1887]=1886
-.[0][1888]=1887
-.[0][1889]=1888
-.[0][1890]=1889
-.[0][1891]=1890
-.[0][1892]=1891
-.[0][1893]=1892
-.[0][1894]=1893
-.[0][1895]=1894
-.[0][1896]=1895
-.[0][1897]=1896
-.[0][1898]=1897
-.[0][1899]=1898
-.[0][1900]=1899
-.[0][1901]=1900
-.[0][1902]=1901
-.[0][1903]=1902
-.[0][1904]=1903
-.[0][1905]=1904
-.[0][1906]=1905
-.[0][1907]=1906
-.[0][1908]=1907
-.[0][1909]=1908
-.[0][1910]=1909
-.[0][1911]=1910
-.[0][1912]=1911
-.[0][1913]=1912
-.[0][1914]=1913
-.[0][1915]=1914
-.[0][1916]=1915
-.[0][1917]=1916
-.[0][1918]=1917
-.[0][1919]=1918
-.[0][1920]=1919
-.[0][1921]=1920
-.[0][1922]=1921
-.[0][1923]=1922
-.[0][1924]=1923
-.[0][1925]=1924
-.[0][1926]=1925
-.[0][1927]=1926
-.[0][1928]=1927
-.[0][1929]=1928
-.[0][1930]=1929
-.[0][1931]=1930
-.[0][1932]=1931
-.[0][1933]=1932
-.[0][1934]=1933
-.[0][1935]=1934
-.[0][1936]=1935
-.[0][1937]=1936
-.[0][1938]=1937
-.[0][1939]=1938
-.[0][1940]=1939
-.[0][1941]=1940
-.[0][1942]=1941
-.[0][1943]=1942
-.[0][1944]=1943
-.[0][1945]=1944
-.[0][1946]=1945
-.[0][1947]=1946
-.[0][1948]=1947
-.[0][1949]=1948
-.[0][1950]=1949
-.[0][1951]=1950
-.[0][1952]=1951
-.[0][1953]=1952
-.[0][1954]=1953
-.[0][1955]=1954
-.[0][1956]=1955
-.[0][1957]=1956
-.[0][1958]=1957
-.[0][1959]=1958
-.[0][1960]=1959
-.[0][1961]=1960
-.[0][1962]=1961
-.[0][1963]=1962
-.[0][1964]=1963
-.[0][1965]=1964
-.[0][1966]=1965
-.[0][1967]=1966
-.[0][1968]=1967
-.[0][1969]=1968
-.[0][1970]=1969
-.[0][1971]=1970
-.[0][1972]=1971
-.[0][1973]=1972
-.[0][1974]=1973
-.[0][1975]=1974
-.[0][1976]=1975
-.[0][1977]=1976
-.[0][1978]=1977
-.[0][1979]=1978
-.[0][1980]=1979
-.[0][1981]=1980
-.[0][1982]=1981
-.[0][1983]=1982
-.[0][1984]=1983
-.[0][1985]=1984
-.[0][1986]=1985
-.[0][1987]=1986
-.[0][1988]=1987
-.[0][1989]=1988
-.[0][1990]=1989
-.[0][1991]=1990
-.[0][1992]=1991
-.[0][1993]=1992
-.[0][1994]=1993
-.[0][1995]=1994
-.[0][1996]=1995
-.[0][1997]=1996
-.[0][1998]=1997
-.[0][1999]=1998
-.[0][2000]=1999
-.[0][2001]=2000
-.[0][2002]=2001
-.[0][2003]=2002
-.[0][2004]=2003
-.[0][2005]=2004
-.[0][2006]=2005
-.[0][2007]=2006
-.[0][2008]=2007
-.[0][2009]=2008
-.[0][2010]=2009
-.[0][2011]=2010
-.[0][2012]=2011
-.[0][2013]=2012
-.[0][2014]=2013
-.[0][2015]=2014
-.[0][2016]=2015
-.[0][2017]=2016
-.[0][2018]=2017
-.[0][2019]=2018
-.[0][2020]=2019
-.[0][2021]=2020
-.[0][2022]=2021
-.[0][2023]=2022
-.[0][2024]=2023
-.[0][2025]=2024
-.[0][2026]=2025
-.[0][2027]=2026
-.[0][2028]=2027
-.[0][2029]=2028
-.[0][2030]=2029
-.[0][2031]=2030
-.[0][2032]=2031
-.[0][2033]=2032
-.[0][2034]=2033
-.[0][2035]=2034
-.[0][2036]=2035
-.[0][2037]=2036
-.[0][2038]=2037
-.[0][2039]=2038
-.[0][2040]=2039
-.[0][2041]=2040
-.[0][2042]=2041
-.[0][2043]=2042
-.[0][2044]=2043
-.[0][2045]=2044
-.[0][2046]=2045
-.[0][2047]=2046
-.[0][2048]=2047
-.[0][2049]=2048
-.[0][2050]=2049
-.[0][2051]=2050
-.[0][2052]=2051
-.[0][2053]=2052
-.[0][2054]=2053
-.[0][2055]=2054
-.[0][2056]=2055
-.[0][2057]=2056
-.[0][2058]=2057
-.[0][2059]=2058
-.[0][2060]=2059
-.[0][2061]=2060
-.[0][2062]=2061
-.[0][2063]=2062
-.[0][2064]=2063
-.[0][2065]=2064
-.[0][2066]=2065
-.[0][2067]=2066
-.[0][2068]=2067
-.[0][2069]=2068
-.[0][2070]=2069
-.[0][2071]=2070
-.[0][2072]=2071
-.[0][2073]=2072
-.[0][2074]=2073
-.[0][2075]=2074
-.[0][2076]=2075
-.[0][2077]=2076
-.[0][2078]=2077
-.[0][2079]=2078
-.[0][2080]=2079
-.[0][2081]=2080
-.[0][2082]=2081
-.[0][2083]=2082
-.[0][2084]=2083
-.[0][2085]=2084
-.[0][2086]=2085
-.[0][2087]=2086
-.[0][2088]=2087
-.[0][2089]=2088
-.[0][2090]=2089
-.[0][2091]=2090
-.[0][2092]=2091
-.[0][2093]=2092
-.[0][2094]=2093
-.[0][2095]=2094
-.[0][2096]=2095
-.[0][2097]=2096
-.[0][2098]=2097
-.[0][2099]=2098
-.[0][2100]=2099
-.[0][2101]=2100
-.[0][2102]=2101
-.[0][2103]=2102
-.[0][2104]=2103
-.[0][2105]=2104
-.[0][2106]=2105
-.[0][2107]=2106
-.[0][2108]=2107
-.[0][2109]=2108
-.[0][2110]=2109
-.[0][2111]=2110
-.[0][2112]=2111
-.[0][2113]=2112
-.[0][2114]=2113
-.[0][2115]=2114
-.[0][2116]=2115
-.[0][2117]=2116
-.[0][2118]=2117
-.[0][2119]=2118
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_large_01.json b/src/3rd_party-static/jsoncpp/test/data/test_large_01.json
deleted file mode 100644
index e4ab4cd433..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_large_01.json
+++ /dev/null
@@ -1,2 +0,0 @@
-[["A",0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730,1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,1806,1807,1808,1809,1810,1811,1812,1813,1814,1815,1816,1817,1818,1819,1820,1821,1822,1823,1824,1825,1826,1827,1828,1829,1830,1831,1832,1833,1834,1835,1836,1837,1838,1839,1840,1841,1842,1843,1844,1845,1846,1847,1848,1849,1850,1851,1852,1853,1854,1855,1856,1857,1858,1859,1860,1861,1862,1863,1864,1865,1866,1867,1868,1869,1870,1871,1872,1873,1874,1875,1876,1877,1878,1879,1880,1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1893,1894,1895,1896,1897,1898,1899,1900,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2049,2050,2051,2052,2053,2054,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064,2065,2066,2067,2068,2069,2070,2071,2072,2073,2074,2075,2076,2077,2078,2079,2080,2081,2082,2083,2084,2085,2086,2087,2088,2089,2090,2091,2092,2093,2094,2095,2096,2097,2098,2099,2100,2101,2102,2103,2104,2105,2106,2107,2108,2109,2110,2111,2112,2113,2114,2115,2116,2117,2118]
-] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_object_01.expected b/src/3rd_party-static/jsoncpp/test/data/test_object_01.expected
deleted file mode 100644
index 8e0634ef09..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_object_01.expected
+++ /dev/null
@@ -1 +0,0 @@
-.={}
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_object_01.json b/src/3rd_party-static/jsoncpp/test/data/test_object_01.json
deleted file mode 100644
index 69a88e3b65..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_object_01.json
+++ /dev/null
@@ -1 +0,0 @@
-{}
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_object_02.expected b/src/3rd_party-static/jsoncpp/test/data/test_object_02.expected
deleted file mode 100644
index 2c9de063ee..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_object_02.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.={}
-.count=1234
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_object_02.json b/src/3rd_party-static/jsoncpp/test/data/test_object_02.json
deleted file mode 100644
index bd157ec4e2..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_object_02.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "count" : 1234 }
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_object_03.expected b/src/3rd_party-static/jsoncpp/test/data/test_object_03.expected
deleted file mode 100644
index 235a28e3db..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_object_03.expected
+++ /dev/null
@@ -1,4 +0,0 @@
-.={}
-.attribute="random"
-.count=1234
-.name="test"
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_object_03.json b/src/3rd_party-static/jsoncpp/test/data/test_object_03.json
deleted file mode 100644
index 0947a44da6..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_object_03.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "count" : 1234,
- "name" : "test",
- "attribute" : "random"
-}
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_object_04.expected b/src/3rd_party-static/jsoncpp/test/data/test_object_04.expected
deleted file mode 100644
index cf4d7c3e4b..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_object_04.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.={}
-.=1234
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_object_04.json b/src/3rd_party-static/jsoncpp/test/data/test_object_04.json
deleted file mode 100644
index f1e364ae8e..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_object_04.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "" : 1234
-}
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_preserve_comment_01.expected b/src/3rd_party-static/jsoncpp/test/data/test_preserve_comment_01.expected
deleted file mode 100644
index b5616a970f..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_preserve_comment_01.expected
+++ /dev/null
@@ -1,3 +0,0 @@
-.={}
-.first=1
-.second=2
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_preserve_comment_01.json b/src/3rd_party-static/jsoncpp/test/data/test_preserve_comment_01.json
deleted file mode 100644
index 0291fff000..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_preserve_comment_01.json
+++ /dev/null
@@ -1,14 +0,0 @@
-/* A comment
- at the beginning of the file.
- */
-{
- "first" : 1, // comment after 'first' on the same line
-
-/* Comment before 'second'
- */
- "second" : 2
-}
-
-/* A comment at
- the end of the file.
- */
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_01.expected b/src/3rd_party-static/jsoncpp/test/data/test_real_01.expected
deleted file mode 100644
index 57dee39e1c..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_01.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=8589934592
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_01.json b/src/3rd_party-static/jsoncpp/test/data/test_real_01.json
deleted file mode 100644
index 5cb1bbf807..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_01.json
+++ /dev/null
@@ -1,3 +0,0 @@
-// 2^33 => out of integer range, switch to double
-8589934592
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_02.expected b/src/3rd_party-static/jsoncpp/test/data/test_real_02.expected
deleted file mode 100644
index 181592a3e3..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_02.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=-4294967295
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_02.json b/src/3rd_party-static/jsoncpp/test/data/test_real_02.json
deleted file mode 100644
index 45092efc9a..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_02.json
+++ /dev/null
@@ -1,3 +0,0 @@
-// -2^32 => out of signed integer range, switch to double
--4294967295
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_03.expected b/src/3rd_party-static/jsoncpp/test/data/test_real_03.expected
deleted file mode 100644
index 181592a3e3..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_03.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=-4294967295
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_03.json b/src/3rd_party-static/jsoncpp/test/data/test_real_03.json
deleted file mode 100644
index 45092efc9a..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_03.json
+++ /dev/null
@@ -1,3 +0,0 @@
-// -2^32 => out of signed integer range, switch to double
--4294967295
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_04.expected b/src/3rd_party-static/jsoncpp/test/data/test_real_04.expected
deleted file mode 100644
index 2f84bf1527..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_04.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.=1.2345678
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_04.json b/src/3rd_party-static/jsoncpp/test/data/test_real_04.json
deleted file mode 100644
index 7e71794a9f..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_04.json
+++ /dev/null
@@ -1,3 +0,0 @@
-// 1.2345678
-12345678e-7
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_05.expected b/src/3rd_party-static/jsoncpp/test/data/test_real_05.expected
deleted file mode 100644
index 168f6e8277..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_05.expected
+++ /dev/null
@@ -1,3 +0,0 @@
-.=1234567.8
-
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_05.json b/src/3rd_party-static/jsoncpp/test/data/test_real_05.json
deleted file mode 100644
index 950f6a78e6..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_05.json
+++ /dev/null
@@ -1,3 +0,0 @@
-// 1234567.8
-0.12345678e7
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_06.expected b/src/3rd_party-static/jsoncpp/test/data/test_real_06.expected
deleted file mode 100644
index 45906e3154..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_06.expected
+++ /dev/null
@@ -1,3 +0,0 @@
-.=-1.2345678
-
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_06.json b/src/3rd_party-static/jsoncpp/test/data/test_real_06.json
deleted file mode 100644
index dde1916134..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_06.json
+++ /dev/null
@@ -1,3 +0,0 @@
-// -1.2345678
--12345678e-7
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_07.expected b/src/3rd_party-static/jsoncpp/test/data/test_real_07.expected
deleted file mode 100644
index f2922f94bc..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_07.expected
+++ /dev/null
@@ -1,3 +0,0 @@
-.=-1234567.8
-
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_real_07.json b/src/3rd_party-static/jsoncpp/test/data/test_real_07.json
deleted file mode 100644
index dd43ba7caf..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_real_07.json
+++ /dev/null
@@ -1,3 +0,0 @@
-// -1234567.8
--0.12345678e7
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_01.expected b/src/3rd_party-static/jsoncpp/test/data/test_string_01.expected
deleted file mode 100644
index 8fd37b1e0e..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_01.expected
+++ /dev/null
@@ -1 +0,0 @@
-.="!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~" \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_01.json b/src/3rd_party-static/jsoncpp/test/data/test_string_01.json
deleted file mode 100644
index c8c059ba5e..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_01.json
+++ /dev/null
@@ -1 +0,0 @@
-"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_02.expected b/src/3rd_party-static/jsoncpp/test/data/test_string_02.expected
deleted file mode 100644
index 0443bc3649..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_02.expected
+++ /dev/null
@@ -1 +0,0 @@
-.="!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~" \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_02.json b/src/3rd_party-static/jsoncpp/test/data/test_string_02.json
deleted file mode 100644
index f0fe56a650..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_02.json
+++ /dev/null
@@ -1 +0,0 @@
-"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_03.expected b/src/3rd_party-static/jsoncpp/test/data/test_string_03.expected
deleted file mode 100644
index 6ed627a850..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_03.expected
+++ /dev/null
@@ -1 +0,0 @@
-.="http://jsoncpp.sourceforge.net/" \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_03.json b/src/3rd_party-static/jsoncpp/test/data/test_string_03.json
deleted file mode 100644
index f0a220fce3..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_03.json
+++ /dev/null
@@ -1 +0,0 @@
-"http:\/\/jsoncpp.sourceforge.net\/"
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_01.expected b/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_01.expected
deleted file mode 100644
index 447f85a30f..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_01.expected
+++ /dev/null
@@ -1 +0,0 @@
-.="a"
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_01.json b/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_01.json
deleted file mode 100644
index 024114bc09..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_01.json
+++ /dev/null
@@ -1 +0,0 @@
-"\u0061" \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_02.expected b/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_02.expected
deleted file mode 100644
index c0b3b43ba3..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_02.expected
+++ /dev/null
@@ -1 +0,0 @@
-.="¢"
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_02.json b/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_02.json
deleted file mode 100644
index 4961024fab..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_02.json
+++ /dev/null
@@ -1 +0,0 @@
-"\u00A2" \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_03.expected b/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_03.expected
deleted file mode 100644
index 7289743ecf..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_03.expected
+++ /dev/null
@@ -1 +0,0 @@
-.="€"
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_03.json b/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_03.json
deleted file mode 100644
index e7e1a9e138..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_03.json
+++ /dev/null
@@ -1 +0,0 @@
-"\u20AC" \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_04.expected b/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_04.expected
deleted file mode 100644
index 868fbc3309..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_04.expected
+++ /dev/null
@@ -1 +0,0 @@
-.="𝄞"
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_04.json b/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_04.json
deleted file mode 100644
index dae65c5155..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_04.json
+++ /dev/null
@@ -1 +0,0 @@
-"\uD834\uDD1E" \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_05.expected b/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_05.expected
deleted file mode 100644
index 19b2c403b8..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_05.expected
+++ /dev/null
@@ -1,2 +0,0 @@
-.="Zażółć gęślą jaźń"
-
diff --git a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_05.json b/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_05.json
deleted file mode 100644
index 8770410946..0000000000
--- a/src/3rd_party-static/jsoncpp/test/data/test_string_unicode_05.json
+++ /dev/null
@@ -1 +0,0 @@
-"Zażółć gęślą jaźń" \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/generate_expected.py b/src/3rd_party-static/jsoncpp/test/generate_expected.py
deleted file mode 100644
index 5b215c4670..0000000000
--- a/src/3rd_party-static/jsoncpp/test/generate_expected.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import glob
-import os.path
-for path in glob.glob( '*.json' ):
- text = file(path,'rt').read()
- target = os.path.splitext(path)[0] + '.expected'
- if os.path.exists( target ):
- print 'skipping:', target
- else:
- print 'creating:', target
- file(target,'wt').write(text)
-
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail1.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail1.json
deleted file mode 100644
index 6216b865f1..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail1.json
+++ /dev/null
@@ -1 +0,0 @@
-"A JSON payload should be an object or array, not a string." \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail10.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail10.json
deleted file mode 100644
index 5d8c0047bd..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail10.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Extra value after close": true} "misplaced quoted value" \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail11.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail11.json
deleted file mode 100644
index 76eb95b458..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail11.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Illegal expression": 1 + 2} \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail12.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail12.json
deleted file mode 100644
index 77580a4522..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail12.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Illegal invocation": alert()} \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail13.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail13.json
deleted file mode 100644
index 379406b59b..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail13.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Numbers cannot have leading zeroes": 013} \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail14.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail14.json
deleted file mode 100644
index 0ed366b38a..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail14.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Numbers cannot be hex": 0x14} \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail15.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail15.json
deleted file mode 100644
index fc8376b605..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail15.json
+++ /dev/null
@@ -1 +0,0 @@
-["Illegal backslash escape: \x15"] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail16.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail16.json
deleted file mode 100644
index 3fe21d4b53..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail16.json
+++ /dev/null
@@ -1 +0,0 @@
-[\naked] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail17.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail17.json
deleted file mode 100644
index 62b9214aed..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail17.json
+++ /dev/null
@@ -1 +0,0 @@
-["Illegal backslash escape: \017"] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail18.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail18.json
deleted file mode 100644
index edac92716f..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail18.json
+++ /dev/null
@@ -1 +0,0 @@
-[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail19.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail19.json
deleted file mode 100644
index 3b9c46fa9a..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail19.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Missing colon" null} \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail2.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail2.json
deleted file mode 100644
index 6b7c11e5a5..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail2.json
+++ /dev/null
@@ -1 +0,0 @@
-["Unclosed array" \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail20.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail20.json
deleted file mode 100644
index 27c1af3e72..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail20.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Double colon":: null} \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail21.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail21.json
deleted file mode 100644
index 62474573b2..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail21.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Comma instead of colon", null} \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail22.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail22.json
deleted file mode 100644
index a7752581bc..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail22.json
+++ /dev/null
@@ -1 +0,0 @@
-["Colon instead of comma": false] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail23.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail23.json
deleted file mode 100644
index 494add1ca1..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail23.json
+++ /dev/null
@@ -1 +0,0 @@
-["Bad value", truth] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail24.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail24.json
deleted file mode 100644
index caff239bfc..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail24.json
+++ /dev/null
@@ -1 +0,0 @@
-['single quote'] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail25.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail25.json
deleted file mode 100644
index 8b7ad23e01..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail25.json
+++ /dev/null
@@ -1 +0,0 @@
-[" tab character in string "] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail26.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail26.json
deleted file mode 100644
index 845d26a6a5..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail26.json
+++ /dev/null
@@ -1 +0,0 @@
-["tab\ character\ in\ string\ "] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail27.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail27.json
deleted file mode 100644
index 6b01a2ca4a..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail27.json
+++ /dev/null
@@ -1,2 +0,0 @@
-["line
-break"] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail28.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail28.json
deleted file mode 100644
index 621a0101c6..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail28.json
+++ /dev/null
@@ -1,2 +0,0 @@
-["line\
-break"] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail29.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail29.json
deleted file mode 100644
index 47ec421bb6..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail29.json
+++ /dev/null
@@ -1 +0,0 @@
-[0e] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail3.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail3.json
deleted file mode 100644
index 168c81eb78..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail3.json
+++ /dev/null
@@ -1 +0,0 @@
-{unquoted_key: "keys must be quoted"} \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail30.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail30.json
deleted file mode 100644
index 8ab0bc4b8b..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail30.json
+++ /dev/null
@@ -1 +0,0 @@
-[0e+] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail31.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail31.json
deleted file mode 100644
index 1cce602b51..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail31.json
+++ /dev/null
@@ -1 +0,0 @@
-[0e+-1] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail32.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail32.json
deleted file mode 100644
index 45cba7396f..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail32.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Comma instead if closing brace": true, \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail33.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail33.json
deleted file mode 100644
index ca5eb19dc9..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail33.json
+++ /dev/null
@@ -1 +0,0 @@
-["mismatch"} \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail4.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail4.json
deleted file mode 100644
index 9de168bf34..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail4.json
+++ /dev/null
@@ -1 +0,0 @@
-["extra comma",] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail5.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail5.json
deleted file mode 100644
index ddf3ce3d24..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail5.json
+++ /dev/null
@@ -1 +0,0 @@
-["double extra comma",,] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail6.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail6.json
deleted file mode 100644
index ed91580e1b..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail6.json
+++ /dev/null
@@ -1 +0,0 @@
-[ , "<-- missing value"] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail7.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail7.json
deleted file mode 100644
index 8a96af3e4e..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail7.json
+++ /dev/null
@@ -1 +0,0 @@
-["Comma after the close"], \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail8.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail8.json
deleted file mode 100644
index b28479c6ec..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail8.json
+++ /dev/null
@@ -1 +0,0 @@
-["Extra close"]] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail9.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/fail9.json
deleted file mode 100644
index 5815574f36..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/fail9.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Extra comma": true,} \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/pass1.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/pass1.json
deleted file mode 100644
index 70e2685436..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/pass1.json
+++ /dev/null
@@ -1,58 +0,0 @@
-[
- "JSON Test Pattern pass1",
- {"object with 1 member":["array with 1 element"]},
- {},
- [],
- -42,
- true,
- false,
- null,
- {
- "integer": 1234567890,
- "real": -9876.543210,
- "e": 0.123456789e-12,
- "E": 1.234567890E+34,
- "": 23456789012E66,
- "zero": 0,
- "one": 1,
- "space": " ",
- "quote": "\"",
- "backslash": "\\",
- "controls": "\b\f\n\r\t",
- "slash": "/ & \/",
- "alpha": "abcdefghijklmnopqrstuvwyz",
- "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
- "digit": "0123456789",
- "0123456789": "digit",
- "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
- "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
- "true": true,
- "false": false,
- "null": null,
- "array":[ ],
- "object":{ },
- "address": "50 St. James Street",
- "url": "http://www.JSON.org/",
- "comment": "// /* <!-- --",
- "# -- --> */": " ",
- " s p a c e d " :[1,2 , 3
-
-,
-
-4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7],
- "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
- "quotes": "&#34; \u0022 %22 0x22 034 &#x22;",
- "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
-: "A key can be any string"
- },
- 0.5 ,98.6
-,
-99.44
-,
-
-1066,
-1e1,
-0.1e1,
-1e-1,
-1e00,2e+00,2e-00
-,"rosebud"] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/pass2.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/pass2.json
deleted file mode 100644
index d3c63c7ad8..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/pass2.json
+++ /dev/null
@@ -1 +0,0 @@
-[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] \ No newline at end of file
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/pass3.json b/src/3rd_party-static/jsoncpp/test/jsonchecker/pass3.json
deleted file mode 100644
index 4528d51f1a..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/pass3.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "JSON Test Pattern pass3": {
- "The outermost value": "must be an object or array.",
- "In this test": "It is an object."
- }
-}
diff --git a/src/3rd_party-static/jsoncpp/test/jsonchecker/readme.txt b/src/3rd_party-static/jsoncpp/test/jsonchecker/readme.txt
deleted file mode 100644
index 321d89d998..0000000000
--- a/src/3rd_party-static/jsoncpp/test/jsonchecker/readme.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-Test suite from http://json.org/JSON_checker/.
-
-If the JSON_checker is working correctly, it must accept all of the pass*.json files and reject all of the fail*.json files.
diff --git a/src/3rd_party-static/jsoncpp/test/pyjsontestrunner.py b/src/3rd_party-static/jsoncpp/test/pyjsontestrunner.py
deleted file mode 100644
index 504f3db2e7..0000000000
--- a/src/3rd_party-static/jsoncpp/test/pyjsontestrunner.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# Simple implementation of a json test runner to run the test against json-py.
-
-import sys
-import os.path
-import json
-import types
-
-if len(sys.argv) != 2:
- print "Usage: %s input-json-file", sys.argv[0]
- sys.exit(3)
-
-input_path = sys.argv[1]
-base_path = os.path.splitext(input_path)[0]
-actual_path = base_path + '.actual'
-rewrite_path = base_path + '.rewrite'
-rewrite_actual_path = base_path + '.actual-rewrite'
-
-def valueTreeToString( fout, value, path = '.' ):
- ty = type(value)
- if ty is types.DictType:
- fout.write( '%s={}\n' % path )
- suffix = path[-1] != '.' and '.' or ''
- names = value.keys()
- names.sort()
- for name in names:
- valueTreeToString( fout, value[name], path + suffix + name )
- elif ty is types.ListType:
- fout.write( '%s=[]\n' % path )
- for index, childValue in zip( xrange(0,len(value)), value ):
- valueTreeToString( fout, childValue, path + '[%d]' % index )
- elif ty is types.StringType:
- fout.write( '%s="%s"\n' % (path,value) )
- elif ty is types.IntType:
- fout.write( '%s=%d\n' % (path,value) )
- elif ty is types.FloatType:
- fout.write( '%s=%.16g\n' % (path,value) )
- elif value is True:
- fout.write( '%s=true\n' % path )
- elif value is False:
- fout.write( '%s=false\n' % path )
- elif value is None:
- fout.write( '%s=null\n' % path )
- else:
- assert False and "Unexpected value type"
-
-def parseAndSaveValueTree( input, actual_path ):
- root = json.loads( input )
- fout = file( actual_path, 'wt' )
- valueTreeToString( fout, root )
- fout.close()
- return root
-
-def rewriteValueTree( value, rewrite_path ):
- rewrite = json.dumps( value )
- #rewrite = rewrite[1:-1] # Somehow the string is quoted ! jsonpy bug ?
- file( rewrite_path, 'wt').write( rewrite + '\n' )
- return rewrite
-
-input = file( input_path, 'rt' ).read()
-root = parseAndSaveValueTree( input, actual_path )
-rewrite = rewriteValueTree( json.write( root ), rewrite_path )
-rewrite_root = parseAndSaveValueTree( rewrite, rewrite_actual_path )
-
-sys.exit( 0 )
diff --git a/src/3rd_party-static/jsoncpp/test/runjsontests.py b/src/3rd_party-static/jsoncpp/test/runjsontests.py
deleted file mode 100644
index ffe8bd51ea..0000000000
--- a/src/3rd_party-static/jsoncpp/test/runjsontests.py
+++ /dev/null
@@ -1,134 +0,0 @@
-import sys
-import os
-import os.path
-from glob import glob
-import optparse
-
-VALGRIND_CMD = 'valgrind --tool=memcheck --leak-check=yes --undef-value-errors=yes '
-
-def compareOutputs( expected, actual, message ):
- expected = expected.strip().replace('\r','').split('\n')
- actual = actual.strip().replace('\r','').split('\n')
- diff_line = 0
- max_line_to_compare = min( len(expected), len(actual) )
- for index in xrange(0,max_line_to_compare):
- if expected[index].strip() != actual[index].strip():
- diff_line = index + 1
- break
- if diff_line == 0 and len(expected) != len(actual):
- diff_line = max_line_to_compare+1
- if diff_line == 0:
- return None
- def safeGetLine( lines, index ):
- index += -1
- if index >= len(lines):
- return ''
- return lines[index].strip()
- return """ Difference in %s at line %d:
- Expected: '%s'
- Actual: '%s'
-""" % (message, diff_line,
- safeGetLine(expected,diff_line),
- safeGetLine(actual,diff_line) )
-
-def safeReadFile( path ):
- try:
- return file( path, 'rt' ).read()
- except IOError, e:
- return '<File "%s" is missing: %s>' % (path,e)
-
-def runAllTests( jsontest_executable_path, input_dir = None,
- use_valgrind=False, with_json_checker=False ):
- if not input_dir:
- input_dir = os.path.join( os.getcwd(), 'data' )
- tests = glob( os.path.join( input_dir, '*.json' ) )
- if with_json_checker:
- test_jsonchecker = glob( os.path.join( input_dir, '../jsonchecker', '*.json' ) )
- else:
- test_jsonchecker = []
- failed_tests = []
- valgrind_path = use_valgrind and VALGRIND_CMD or ''
- for input_path in tests + test_jsonchecker:
- expect_failure = os.path.basename( input_path ).startswith( 'fail' )
- is_json_checker_test = (input_path in test_jsonchecker) or expect_failure
- print 'TESTING:', input_path,
- options = is_json_checker_test and '--json-checker' or ''
- pipe = os.popen( "%s%s %s %s" % (
- valgrind_path, jsontest_executable_path, options,
- input_path) )
- process_output = pipe.read()
- status = pipe.close()
- if is_json_checker_test:
- if expect_failure:
- if status is None:
- print 'FAILED'
- failed_tests.append( (input_path, 'Parsing should have failed:\n%s' %
- safeReadFile(input_path)) )
- else:
- print 'OK'
- else:
- if status is not None:
- print 'FAILED'
- failed_tests.append( (input_path, 'Parsing failed:\n' + process_output) )
- else:
- print 'OK'
- else:
- base_path = os.path.splitext(input_path)[0]
- actual_output = safeReadFile( base_path + '.actual' )
- actual_rewrite_output = safeReadFile( base_path + '.actual-rewrite' )
- file(base_path + '.process-output','wt').write( process_output )
- if status:
- print 'parsing failed'
- failed_tests.append( (input_path, 'Parsing failed:\n' + process_output) )
- else:
- expected_output_path = os.path.splitext(input_path)[0] + '.expected'
- expected_output = file( expected_output_path, 'rt' ).read()
- detail = ( compareOutputs( expected_output, actual_output, 'input' )
- or compareOutputs( expected_output, actual_rewrite_output, 'rewrite' ) )
- if detail:
- print 'FAILED'
- failed_tests.append( (input_path, detail) )
- else:
- print 'OK'
-
- if failed_tests:
- print
- print 'Failure details:'
- for failed_test in failed_tests:
- print '* Test', failed_test[0]
- print failed_test[1]
- print
- print 'Test results: %d passed, %d failed.' % (len(tests)-len(failed_tests),
- len(failed_tests) )
- return 1
- else:
- print 'All %d tests passed.' % len(tests)
- return 0
-
-def main():
- from optparse import OptionParser
- parser = OptionParser( usage="%prog [options] <path to jsontestrunner.exe> [test case directory]" )
- parser.add_option("--valgrind",
- action="store_true", dest="valgrind", default=False,
- help="run all the tests using valgrind to detect memory leaks")
- parser.add_option("-c", "--with-json-checker",
- action="store_true", dest="with_json_checker", default=False,
- help="run all the tests from the official JSONChecker test suite of json.org")
- parser.enable_interspersed_args()
- options, args = parser.parse_args()
-
- if len(args) < 1 or len(args) > 2:
- parser.error( 'Must provides at least path to jsontestrunner executable.' )
- sys.exit( 1 )
-
- jsontest_executable_path = os.path.normpath( os.path.abspath( args[0] ) )
- if len(args) > 1:
- input_path = os.path.normpath( os.path.abspath( args[1] ) )
- else:
- input_path = None
- status = runAllTests( jsontest_executable_path, input_path,
- use_valgrind=options.valgrind, with_json_checker=options.with_json_checker )
- sys.exit( status )
-
-if __name__ == '__main__':
- main()
diff --git a/src/3rd_party-static/jsoncpp/test/rununittests.py b/src/3rd_party-static/jsoncpp/test/rununittests.py
deleted file mode 100644
index 366184cfb5..0000000000
--- a/src/3rd_party-static/jsoncpp/test/rununittests.py
+++ /dev/null
@@ -1,73 +0,0 @@
-import sys
-import os
-import os.path
-import subprocess
-from glob import glob
-import optparse
-
-VALGRIND_CMD = 'valgrind --tool=memcheck --leak-check=yes --undef-value-errors=yes'
-
-class TestProxy(object):
- def __init__( self, test_exe_path, use_valgrind=False ):
- self.test_exe_path = os.path.normpath( os.path.abspath( test_exe_path ) )
- self.use_valgrind = use_valgrind
-
- def run( self, options ):
- if self.use_valgrind:
- cmd = VALGRIND_CMD.split()
- else:
- cmd = []
- cmd.extend( [self.test_exe_path, '--test-auto'] + options )
- process = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
- stdout = process.communicate()[0]
- if process.returncode:
- return False, stdout
- return True, stdout
-
-def runAllTests( exe_path, use_valgrind=False ):
- test_proxy = TestProxy( exe_path, use_valgrind=use_valgrind )
- status, test_names = test_proxy.run( ['--list-tests'] )
- if not status:
- print >> sys.stderr, "Failed to obtain unit tests list:\n" + test_names
- return 1
- test_names = [name.strip() for name in test_names.strip().split('\n')]
- failures = []
- for name in test_names:
- print 'TESTING %s:' % name,
- succeed, result = test_proxy.run( ['--test', name] )
- if succeed:
- print 'OK'
- else:
- failures.append( (name, result) )
- print 'FAILED'
- failed_count = len(failures)
- pass_count = len(test_names) - failed_count
- if failed_count:
- print
- for name, result in failures:
- print result
- print '%d/%d tests passed (%d failure(s))' % (
- pass_count, len(test_names), failed_count)
- return 1
- else:
- print 'All %d tests passed' % len(test_names)
- return 0
-
-def main():
- from optparse import OptionParser
- parser = OptionParser( usage="%prog [options] <path to test_lib_json.exe>" )
- parser.add_option("--valgrind",
- action="store_true", dest="valgrind", default=False,
- help="run all the tests using valgrind to detect memory leaks")
- parser.enable_interspersed_args()
- options, args = parser.parse_args()
-
- if len(args) != 1:
- parser.error( 'Must provides at least path to test_lib_json executable.' )
- sys.exit( 1 )
-
- exit_code = runAllTests( args[0], use_valgrind=options.valgrind )
- sys.exit( exit_code )
-
-if __name__ == '__main__':
- main()
diff --git a/src/3rd_party-static/jsoncpp/version b/src/3rd_party-static/jsoncpp/version
deleted file mode 100644
index 673adfb9f2..0000000000
--- a/src/3rd_party-static/jsoncpp/version
+++ /dev/null
@@ -1 +0,0 @@
-0.6.0-rc2 \ No newline at end of file
diff --git a/src/3rd_party-static/test/json_reader_test.cc b/src/3rd_party-static/test/json_reader_test.cc
index 75001af6b7..ca82ff9220 100644
--- a/src/3rd_party-static/test/json_reader_test.cc
+++ b/src/3rd_party-static/test/json_reader_test.cc
@@ -32,7 +32,7 @@
#include "gtest/gtest.h"
-#include "json/reader.h"
+#include "utils/jsoncpp_reader_wrapper.h"
namespace test {
namespace third_party_libs {
@@ -62,9 +62,9 @@ class JSONReaderTest : public ::testing::Test {
std::string comaString_;
std::string colonString_;
- Json::Reader reader;
Json::Value json;
-
+public:
+ bool Parse(const std::string &str);
};
void JSONReaderTest::SetUp()
@@ -88,72 +88,78 @@ void JSONReaderTest::SetUp()
colonString_ = "{\"field\" : \"va:lue\" }";
}
-TEST_F(JSONReaderTest, ParseNormalString) {
- ASSERT_TRUE(reader.parse(normalString_, json));
+bool JSONReaderTest::Parse(const std::string &str)
+{
+ utils::JsonReader reader;
+ return reader.parse(str, &json);
}
-TEST_F(JSONReaderTest, ParseBackspaceString) {
- ASSERT_TRUE(reader.parse(backspaceString_, json));
+TEST_F(JSONReaderTest, Parse_NormalString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(normalString_));
}
-TEST_F(JSONReaderTest, ParseFormFeedString) {
- ASSERT_TRUE(reader.parse(formfeedString_, json));
+TEST_F(JSONReaderTest, Parse_BackspaceString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(backspaceString_));
+}
+TEST_F(JSONReaderTest, Parse_FormFeedString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(formfeedString_));
}
-TEST_F(JSONReaderTest, ParseLineFeedString) {
- ASSERT_TRUE(reader.parse(linefeedString_, json));
+TEST_F(JSONReaderTest, Parse_LineFeedString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(linefeedString_));
}
-TEST_F(JSONReaderTest, ParseReturnString) {
- ASSERT_TRUE(reader.parse(returnString_, json));
+TEST_F(JSONReaderTest, ParseReturnString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(returnString_));
}
-TEST_F(JSONReaderTest, ParseTabString) {
- ASSERT_TRUE(reader.parse(tabString_, json));
+TEST_F(JSONReaderTest, Parse_TabString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(tabString_));
}
-TEST_F(JSONReaderTest, ParseBellString) {
- ASSERT_TRUE(reader.parse(bellString_, json));
+TEST_F(JSONReaderTest, Parse_BellString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(bellString_));
}
-TEST_F(JSONReaderTest, ParseQuoteString) {
- ASSERT_FALSE(reader.parse(quoteString_, json));
+TEST_F(JSONReaderTest, Parse_QuoteString_ExpectUnsuccessfulParsing) {
+ ASSERT_FALSE(Parse(quoteString_));
}
-TEST_F(JSONReaderTest, ParseSlashString) {
- ASSERT_TRUE(reader.parse(slashString_, json));
+TEST_F(JSONReaderTest, Parse_SlashString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(slashString_));
}
-TEST_F(JSONReaderTest, ParseBackslashString) {
- ASSERT_FALSE(reader.parse(backslashString_, json));
+TEST_F(JSONReaderTest, Parse_BackslashString_ExpectUnsuccessfulParsing) {
+ ASSERT_FALSE(Parse(backslashString_));
}
-TEST_F(JSONReaderTest, ParseSinglequoteString) {
- ASSERT_TRUE(reader.parse(singlequoteString_, json));
+TEST_F(JSONReaderTest, Parse_SinglequoteString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(singlequoteString_));
}
-TEST_F(JSONReaderTest, ParseColonString) {
- ASSERT_TRUE(reader.parse(colonString_, json));
+TEST_F(JSONReaderTest, Parse_ColonString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(colonString_));
}
-TEST_F(JSONReaderTest, ParseComaString) {
- ASSERT_TRUE(reader.parse(comaString_, json));
+TEST_F(JSONReaderTest, Parse_ComaString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(comaString_));
}
-TEST_F(JSONReaderTest, ParseOpeningbraceString) {
- ASSERT_TRUE(reader.parse(openingbraceString_, json));
+TEST_F(JSONReaderTest, Parse_OpeningbraceString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(openingbraceString_));
}
-TEST_F(JSONReaderTest, ParseClosingbraceString) {
- ASSERT_TRUE(reader.parse(closingbraceString_, json));
+TEST_F(JSONReaderTest, Parse_ClosingbraceString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(closingbraceString_));
}
-TEST_F(JSONReaderTest, ParseOpeningbracketString) {
- ASSERT_TRUE(reader.parse(openingbracketString_, json));
+TEST_F(JSONReaderTest, Parse_OpeningbracketString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(openingbracketString_));
}
-TEST_F(JSONReaderTest, ParseClosingbracketString) {
- ASSERT_TRUE(reader.parse(closingbracketString_, json));
+
+TEST_F(JSONReaderTest, Parse_ClosingbracketString_ExpectSuccessfulParsing) {
+ ASSERT_TRUE(Parse(closingbracketString_));
}
} // namespace json_reader_test
diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt
index 6f1e3dc353..4415a1bd7b 100644
--- a/src/3rd_party/CMakeLists.txt
+++ b/src/3rd_party/CMakeLists.txt
@@ -30,8 +30,8 @@
include("./set_3rd_party_paths.cmake")
-set(3RD_PARTY_SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-set(3RD_PARTY_BINARY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+set(3RD_PARTY_SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+set(3RD_PARTY_BINARY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set (install-3rd_party_logger_var "")
@@ -41,30 +41,32 @@ endif()
if(FORCE_3RD_PARTY)
if(NO_REBUILD_3RD_PARTY)
- message(FATAL_ERROR "Please don't turn on both FORCE_3RD_PARTY and NO_REBUILD_3RD_PARTY at the same time.")
+ message(FATAL_ERROR "Please don't turn on both FORCE_3RD_PARTY and NO_REBUILD_3RD_PARTY at the same time.")
else()
- set(FORCE_3RD_PARTY_LOGGER ON)
- set(FORCE_3RD_PARTY_DBUS ON)
+ set(FORCE_3RD_PARTY_LOGGER ON)
endif()
endif()
-if(ENABLE_LOG OR HMI_DBUS_API)
+if(ENABLE_LOG)
# --- libexpat
add_subdirectory(expat-2.1.0)
set(EXPAT_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib PARENT_SCOPE)
-endif()
-if(ENABLE_LOG)
if(NO_REBUILD_3RD_PARTY_LOGGER)
message(STATUS "Not rebuilding logger.")
else()
+ set(LOGGER_INSTALL_COMMAND make install)
+ if (${USE_DEFAULT_3RD_PARTY_PATH} STREQUAL "true")
+ set(LOGGER_INSTALL_COMMAND sudo make install)
+ endif()
if(FORCE_3RD_PARTY_LOGGER)
message(STATUS "Force to rebuild logger.")
#build logger
add_custom_target(3rd_party_logger
make
- WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
+ DEPENDS apr-util
+ WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}/apache-log4cxx-cmake
)
#install logger
@@ -74,12 +76,15 @@ if(ENABLE_LOG)
COMMAND /bin/bash -c \"USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
sudo -k \;
- sudo make install\;
- else
- make install\;
- fi\"
+ fi\;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}/apr-cmake\;
+ ${LOGGER_INSTALL_COMMAND}\;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}/apr-util-cmake\;
+ ${LOGGER_INSTALL_COMMAND}\;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}/apache-log4cxx-cmake\;
+ ${LOGGER_INSTALL_COMMAND}\"
DEPENDS 3rd_party_logger
- WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
+ WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}/apache-log4cxx-cmake
)
else()
#build logger
@@ -97,17 +102,18 @@ if(ENABLE_LOG)
fi\;
if [ \\$$VAR1 != \\$$VAR2 ]\; then
echo " Need to rebuild logger. " \;
- cd ${3RD_PARTY_BINARY_DIRECTORY}\;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}/apache-log4cxx-cmake\;
make\;
else
echo " Logger is actual. " \;
fi\;
else
echo " Need to build logger. " \;
- cd ${3RD_PARTY_BINARY_DIRECTORY}\;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}/apache-log4cxx-cmake\;
make\;
fi\"
- WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
+ DEPENDS apr-util
+ WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}/apache-log4cxx-build
)
#install logger
@@ -128,27 +134,29 @@ if(ENABLE_LOG)
if [ \\$$VAR1 != \\$$VAR2 ]\; then
USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
- cd ${3RD_PARTY_BINARY_DIRECTORY}\;
sudo -k \;
- sudo make install\;
- else
- cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- make install\;
fi\;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}/apr-cmake\;
+ ${LOGGER_INSTALL_COMMAND}\;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}/apr-util-cmake\;
+ ${LOGGER_INSTALL_COMMAND}\;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}/apache-log4cxx-cmake\;
+ ${LOGGER_INSTALL_COMMAND}\;
fi\;
else
USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
- cd ${3RD_PARTY_BINARY_DIRECTORY}\;
sudo -k \;
- sudo make install\;
- else
- cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- make install\;
fi\;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}/apr-cmake\;
+ ${LOGGER_INSTALL_COMMAND}\;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}/apr-util-cmake\;
+ ${LOGGER_INSTALL_COMMAND}\;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}/apache-log4cxx-cmake\;
+ ${LOGGER_INSTALL_COMMAND}\;
fi\"
DEPENDS 3rd_party_logger
- WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
+ WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}/apache-log4cxx-build
)
endif()
@@ -172,12 +180,13 @@ if(ENABLE_LOG)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}")
-set(CMAKE_SOURCE_PREFIX ${CMAKE_SOURCE_PREFIX} "${3RD_PARTY_INSTALL_PREFIX}")
-find_package (BSON)
-message (STATUS "bson installed in " ${BSON_LIBS_DIRECTORY} " , " ${BSON_INCLUDE_DIRECTORY})
-message (STATUS "emhashmap installed in " ${EMHASHMAP_LIBS_DIRECTORY} " , " ${EMHASHMAP_INCLUDE_DIRECTORY})
+set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${3RD_PARTY_INSTALL_PREFIX}/etc")
+set(ENV{PKG_CONFIG_PATH} $ENV{CMAKE_PREFIX_PATH} "${3RD_PARTY_INSTALL_PREFIX}/etc")
+find_package(PkgConfig)
+pkg_check_modules(BSON libbson)
+message (STATUS "bson installed in " ${BSON_LIBDIR} ", " ${BSON_INCLUDEDIR})
-if (${BSON_LIB} MATCHES "BSON_LIB-NOTFOUND")
+if ((NOT "${BSON_FOUND}") OR ("${BSON_VERSION}" VERSION_LESS "1.2.0"))
message (STATUS "Building bson required")
set(BSON_LIB_SOURCE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bson_c_lib CACHE INTERNAL "Sources of bson library" FORCE)
set(BSON_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/lib CACHE INTERNAL "Installation path of bson libraries" FORCE)
@@ -191,20 +200,19 @@ if (${BSON_LIB} MATCHES "BSON_LIB-NOTFOUND")
endif()
include(ExternalProject)
ExternalProject_Add(libbson
- GIT_REPOSITORY "http://github.com/smartdevicelink/bson_c_lib.git"
+ GIT_REPOSITORY "https://github.com/smartdevicelink/bson_c_lib.git"
GIT_TAG "master"
BINARY_DIR ${BSON_LIB_SOURCE_DIRECTORY}
INSTALL_DIR ${3RD_PARTY_INSTALL_PREFIX}
DOWNLOAD_DIR ${BSON_LIB_SOURCE_DIRECTORY}
SOURCE_DIR ${BSON_LIB_SOURCE_DIRECTORY}
- CONFIGURE_COMMAND touch aclocal.m4 configure.ac Makefile.am Makefile.in configure config.h.in && ./configure --prefix=${3RD_PARTY_INSTALL_PREFIX}
+ CONFIGURE_COMMAND touch aclocal.m4 configure.ac Makefile.am Makefile.in configure config.h.in libbson.pc.in && ./configure --prefix=${3RD_PARTY_INSTALL_PREFIX}
BUILD_COMMAND make
- INSTALL_COMMAND ${BSON_INSTALL_COMMAND})
+ INSTALL_COMMAND ${BSON_INSTALL_COMMAND}
+ UPDATE_COMMAND git pull)
else()
- get_filename_component(BSON_LIBS_DIRECTORY ${BSON_LIB} DIRECTORY)
- get_filename_component(EMHASHMAP_LIBS_DIRECTORY ${EMHASHMAP_LIB} DIRECTORY)
- set(BSON_LIBS_DIRECTORY ${BSON_LIBS_DIRECTORY} CACHE INTERNAL "Installation path of bson libraries" FORCE)
- set(EMHASHMAP_LIBS_DIRECTORY ${BSON_LIBS_DIRECTORY} CACHE INTERNAL "Installation path of emashmap libraries" FORCE)
+ set(BSON_LIBS_DIRECTORY ${BSON_LIBDIR} CACHE INTERNAL "Installation path of bson libraries" FORCE)
+ set(EMHASHMAP_LIBS_DIRECTORY ${BSON_LIBDIR} CACHE INTERNAL "Installation path of emashmap libraries" FORCE)
add_custom_target(
libbson
DEPENDS ${BSON_LIBS_DIRECTORY}
@@ -212,40 +220,37 @@ else()
)
endif()
-if (HMIADAPTER STREQUAL "messagebroker")
- find_package(Boost 1.66.0 COMPONENTS system)
- set(BOOST_LIB_SOURCE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/boost_src)
- set(BOOST_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/lib)
- SET_PROPERTY(GLOBAL PROPERTY GLOBAL_BOOST_LIBS ${BOOST_LIBS_DIRECTORY})
- set(BOOST_INCLUDE_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/include )
- if (NOT ${Boost_FOUND})
- message(STATUS "Did not find boost. Downloading and installing boost 1.66")
- set(BOOST_INSTALL_COMMAND ./b2 install)
- if (${3RD_PARTY_INSTALL_PREFIX} MATCHES "/usr/local")
- set(BOOST_INSTALL_COMMAND sudo ./b2 install)
- endif()
- include(ExternalProject)
- ExternalProject_Add(
- Boost
- URL https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
- DOWNLOAD_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
- SOURCE_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
- CONFIGURE_COMMAND ./bootstrap.sh --with-libraries=system --prefix=${3RD_PARTY_INSTALL_PREFIX}
- BUILD_COMMAND ./b2
- INSTALL_COMMAND ${BOOST_INSTALL_COMMAND} --with-system --prefix=${3RD_PARTY_INSTALL_PREFIX} > boost_install.log
- INSTALL_DIR ${3RD_PARTY_INSTALL_PREFIX}
- BUILD_IN_SOURCE true
- )
-
- set(BOOST_INCLUDE_DIR ${BOOST_ROOT_DIR}/Boost-prefix/src/Boost)
- set(BOOST_LIB_DIR ${BOOST_ROOT_DIR}/Boost-prefix/src/Boost/stage/lib/)
+set(BOOST_ROOT ${3RD_PARTY_INSTALL_PREFIX})
+find_package(Boost 1.66.0 COMPONENTS system thread date_time filesystem regex)
+set(BOOST_LIB_SOURCE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/boost_src)
+set(BOOST_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/lib)
+set(BOOST_INCLUDE_DIR ${3RD_PARTY_INSTALL_PREFIX}/include PARENT_SCOPE)
+SET_PROPERTY(GLOBAL PROPERTY GLOBAL_BOOST_LIBS ${BOOST_LIBS_DIRECTORY})
+if (NOT ${Boost_FOUND})
+ message(STATUS "Did not find boost. Downloading and installing boost 1.66")
+ set(BOOST_INSTALL_COMMAND ./b2 install)
+ if (${3RD_PARTY_INSTALL_PREFIX} MATCHES "/usr/local")
+ set(BOOST_INSTALL_COMMAND sudo ./b2 install)
endif()
+ include(ExternalProject)
+ ExternalProject_Add(
+ Boost
+ URL https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
+ DOWNLOAD_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
+ SOURCE_DIR ${BOOST_LIB_SOURCE_DIRECTORY}
+ CONFIGURE_COMMAND ./bootstrap.sh --with-libraries=system,thread,date_time,filesystem,regex --prefix=${3RD_PARTY_INSTALL_PREFIX}
+ BUILD_COMMAND ./b2
+ INSTALL_COMMAND ${BOOST_INSTALL_COMMAND} --with-system --with-thread --with-date_time --with-filesystem --with-regex --prefix=${3RD_PARTY_INSTALL_PREFIX} > boost_install.log
+ INSTALL_DIR ${3RD_PARTY_INSTALL_PREFIX}
+ BUILD_IN_SOURCE true
+ )
+else()
+add_custom_target(Boost) # empty target, Boost is already installed
endif()
add_custom_target(install-3rd_party
- DEPENDS ${install-3rd_party_logger_var}
DEPENDS libbson
DEPENDS Boost
+ DEPENDS ${install-3rd_party_logger_var}
WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
)
-
diff --git a/src/3rd_party/FindBSON.cmake b/src/3rd_party/FindBSON.cmake
deleted file mode 100644
index 91d53624f1..0000000000
--- a/src/3rd_party/FindBSON.cmake
+++ /dev/null
@@ -1,26 +0,0 @@
-set(INCLUDE_PATH "${CMAKE_SOURCE_PREFIX}/include")
-set(LIB_PATH "${CMAKE_SOURCE_PREFIX}/lib")
-
-find_path(BSON_INCLUDE_DIRECTORY bson_object.h bson_array.h bson_util.h
- PATHS "${INCLUDE_PATH}")
-
-find_library(BSON_LIB
- NAMES bson
- PATHS ${LIB_PATH})
-
-find_path(EMHASHMAP_INCLUDE_DIRECTORY emhashmap.h
- PATHS ${INCLUDE_PATH}
- PATH_SUFFIXES emhashmap)
-
-find_library(EMHASHMAP_LIB
- NAMES emhashmap
- PATHS ${LIB_PATH})
-
-
-include(FindPackageHandleStandardArgs)
-
-find_package_handle_standard_args(BSON DEFAULT_MSG BSON_INCLUDE_DIRECTORY BSON_LIB
- EMHASHMAP_INCLUDE_DIRECTORY EMHASHMAP_LIB)
-
-mark_as_advanced(BSON_INCLUDE_DIRECTORY BSON_LIB)
-mark_as_advanced(EMHASHMAP_INCLUDE_DIRECTORY EMHASHMAP_LIB)
diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt
index e82d95f904..86be828c6b 100644
--- a/src/appMain/CMakeLists.txt
+++ b/src/appMain/CMakeLists.txt
@@ -62,7 +62,6 @@ include_directories(
${POLICY_GLOBAL_INCLUDE_PATH}/
${COMPONENTS_DIR}/rpc_base/include
${COMPONENTS_DIR}/resumption/include
- ${COMPONENTS_DIR}/dbus/include
${CMAKE_BINARY_DIR}/src/components
${JSONCPP_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
@@ -71,9 +70,20 @@ include_directories(
${default_media_inc}
${MESSAGE_BROKER_INCLUDE_DIRECTORY}
${BOOST_INCLUDE_DIR}
+ ${CMAKE_SOURCE_DIR}/src
)
-collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}")
+# Create object library
+add_library("LowVoltageHandlerObjLibrary" OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/low_voltage_signals_handler.cc
+)
+add_dependencies("LowVoltageHandlerObjLibrary" Boost)
+
+set (SOURCES
+ ${CMAKE_CURRENT_SOURCE_DIR}/main.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/life_cycle_impl.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/signal_handlers.cc
+ $<TARGET_OBJECTS:LowVoltageHandlerObjLibrary>
+)
cmake_policy(PUSH)
# make link_directories() treat paths relative to the source dir
@@ -142,7 +152,8 @@ add_executable(${PROJECT} ${SOURCES})
if (HMIADAPTER STREQUAL "messagebroker")
add_dependencies(${PROJECT} Boost)
- list(APPEND LIBRARIES libboost_system.so)
+ GET_PROPERTY(BOOST_LIBS_DIRECTORY GLOBAL PROPERTY GLOBAL_BOOST_LIBS)
+ list(APPEND LIBRARIES boost_system -L${BOOST_LIBS_DIRECTORY})
endif()
target_link_libraries(${PROJECT} ${LIBRARIES})
@@ -206,7 +217,8 @@ endif ()
# Install rules
install(TARGETS ${PROJECT} DESTINATION bin)
install(
- FILES build_config.txt log4cxx.properties audio.8bit.wav test.txt smartDeviceLink.ini
+ FILES build_config.txt log4cxx.properties audio.8bit.wav test.txt
+ ${CMAKE_CURRENT_BINARY_DIR}/smartDeviceLink.ini
hmi_capabilities.json sdl_preloaded_pt.json sample_policy_manager.py
${CMAKE_SOURCE_DIR}/mycert.pem ${CMAKE_SOURCE_DIR}/mykey.pem
DESTINATION bin
@@ -243,3 +255,6 @@ else()
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()
+if(BUILD_TESTS)
+ add_subdirectory(test)
+endif()
diff --git a/src/appMain/audio.8bit.wav b/src/appMain/audio.8bit.wav
index cebf6cc0e2..7a3f970a21 100644
--- a/src/appMain/audio.8bit.wav
+++ b/src/appMain/audio.8bit.wav
Binary files differ
diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json
index 50cb479a74..91ddaf6d6c 100755
--- a/src/appMain/hmi_capabilities.json
+++ b/src/appMain/hmi_capabilities.json
@@ -6,7 +6,7 @@
"JA-JP", "AR-SA", "KO-KR", "PT-BR", "CS-CZ", "DA-DK", "NO-NO"
],
"displayCapabilities": {
- "displayType": "GEN2_8_DMA",
+ "displayType": "SDL_GENERIC",
"displayName": "GENERIC_DISPLAY",
"textFields": [{
"name": "mainField1",
@@ -242,6 +242,16 @@
"resolutionWidth": 35,
"resolutionHeight": 35
}
+ },
+ {
+ "name": "alertIcon",
+ "imageTypeSupported": [
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution": {
+ "resolutionWidth": 225,
+ "resolutionHeight": 225
+ }
}
],
@@ -249,6 +259,7 @@
"CLOCK1", "CLOCK2", "CLOCK3", "CLOCKTEXT1", "CLOCKTEXT2", "CLOCKTEXT3", "CLOCKTEXT4"
],
"graphicSupported": true,
+ "menuLayoutsAvailable": [ "LIST", "TILES" ],
"templatesAvailable": [
"DEFAULT", "MEDIA", "NON-MEDIA", "ONSCREEN_PRESETS", "NAV_FULLSCREEN_MAP", "NAV_KEYBOARD",
"GRAPHIC_WITH_TEXT", "TEXT_WITH_GRAPHIC", "TILES_ONLY", "TEXTBUTTONS_ONLY",
@@ -274,11 +285,11 @@
"STATIC"
]
},
- "audioPassThruCapabilities": {
+ "audioPassThruCapabilities": [{
"samplingRate": "44KHZ",
"bitsPerSample": "RATE_8_BIT",
"audioType": "PCM"
- },
+ }],
"pcmStreamCapabilities": {
"samplingRate": "16KHZ",
"bitsPerSample": "RATE_16_BIT",
@@ -309,125 +320,220 @@
"protocol": "RAW",
"codec": "H264"
}],
- "hapticSpatialDataSupported": false
+ "hapticSpatialDataSupported": false,
+ "diagonalScreenSize": 8,
+ "pixelPerInch": 117,
+ "scale": 1
+ },
+ "seatLocationCapability": {
+ "rows": 2,
+ "columns": 3,
+ "levels": 1,
+ "seats": [
+ {
+ "row": 0,
+ "col": 0,
+ "level": 0,
+ "rowspan": 1,
+ "levelspan": 1,
+ "colspan": 1
+ }
+ ]
},
"remoteControlCapability": {
"buttonCapabilities": [
{
"longPressAvailable": true,
"name": "AC_MAX",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "AC",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "RECIRCULATE",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "FAN_UP",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "FAN_DOWN",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "TEMP_UP",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "TEMP_DOWN",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "DEFROST_MAX",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "DEFROST",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "DEFROST_REAR",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "UPPER_VENT",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "LOWER_VENT",
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "VOLUME_UP",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "VOLUME_DOWN",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "EJECT",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "SOURCE",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "SHUFFLE",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
},
{
"longPressAvailable": true,
"name": "REPEAT",
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": false
+ },
"shortPressAvailable": true,
"upDownAvailable": false
}
],
"climateControlCapabilities": [
{
+ "moduleInfo": {
+ "moduleId": "34045662-a9dc-4823-8435-91056d4c26cb",
+ "allowMultipleAccess": false
+ },
"acEnableAvailable": true,
"acMaxEnableAvailable": true,
"autoModeEnableAvailable": true,
"circulateAirEnableAvailable": true,
+ "climateEnableAvailable": true,
"currentTemperatureAvailable": true,
"defrostZone": [
"FRONT",
@@ -438,6 +544,10 @@
"defrostZoneAvailable": true,
"desiredTemperatureAvailable": true,
"dualModeEnableAvailable": true,
+ "heatedMirrorsAvailable":true,
+ "heatedRearWindowAvailable":true,
+ "heatedSteeringWheelAvailable":true,
+ "heatedWindshieldAvailable":true,
"fanSpeedAvailable": true,
"moduleName": "primary_climate",
"ventilationMode": [
@@ -451,7 +561,11 @@
],
"radioControlCapabilities": [
{
- "availableHDsAvailable": true,
+ "moduleInfo": {
+ "moduleId": "eb7739ea-b263-4fe1-af9c-9311d1acac2d",
+ "allowMultipleAccess": true
+ },
+ "availableHdChannelsAvailable": true,
"hdChannelAvailable": true,
"moduleName": "radio",
"radioBandAvailable": true,
@@ -460,9 +574,357 @@
"rdsDataAvailable": true,
"signalChangeThresholdAvailable": true,
"signalStrengthAvailable": true,
+ "hdRadioEnableAvailable" : true,
+ "siriusxmRadioAvailable" : true,
+ "sisDataAvailable":true,
"stateAvailable": true
}
- ]
+ ],
+ "audioControlCapabilities": [
+ {
+ "moduleName": "audio",
+ "moduleInfo": {
+ "moduleId": "a279fe12-4587-4d12-8514-50f4ea9e9537",
+ "allowMultipleAccess": true
+ },
+ "sourceAvailable": true,
+ "volumeAvailable": true,
+ "equalizerAvailable": true,
+ "keepContextAvailable" : true,
+ "equalizerMaxChannelId": 10
+ }
+ ],
+ "seatControlCapabilities": [
+ {
+ "moduleName": "driver_seat",
+ "moduleInfo": {
+ "moduleId": "06cdec22-920e-4865-bf2e-9518463edc68",
+ "allowMultipleAccess": false
+ },
+ "heatingEnabledAvailable" : true,
+ "coolingEnabledAvailable": true,
+ "heatingLevelAvailable": true,
+ "coolingLevelAvailable": true,
+ "horizontalPositionAvailable": true,
+ "verticalPositionAvailable" : true,
+ "frontVerticalPositionAvailable": true,
+ "backVerticalPositionAvailable": true,
+ "backTiltAngleAvailable": true,
+ "headSupportHorizontalPositionAvailable": true,
+ "headSupportVerticalPositionAvailable" : true,
+ "massageEnabledAvailable": true,
+ "massageModeAvailable": true,
+ "massageCushionFirmnessAvailable": true,
+ "memoryAvailable": true
+ }
+ ],
+ "lightControlCapabilities": {
+ "moduleName": "light",
+ "moduleInfo": {
+ "moduleId": "8d73e369-6a1f-4459-ab5a-6e432631881d",
+ "allowMultipleAccess": false
+ },
+ "supportedLights":[
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_HIGH_BEAM",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_HIGH_BEAM",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_LOW_BEAM",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_LOW_BEAM",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_PARKING_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_PARKING_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_FOG_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_FOG_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_DAYTIME_RUNNING_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_DAYTIME_RUNNING_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_LEFT_TURN_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FRONT_RIGHT_TURN_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_LEFT_FOG_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_RIGHT_FOG_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_LEFT_TAIL_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_RIGHT_TAIL_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_LEFT_BRAKE_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_RIGHT_BRAKE_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_LEFT_TURN_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_RIGHT_TURN_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_REGISTRATION_PLATE_LIGHT",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"HIGH_BEAMS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"LOW_BEAMS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"FOG_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"RUNNING_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"PARKING_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"BRAKE_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"REAR_REVERSING_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"SIDE_MARKER_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"LEFT_TURN_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"RIGHT_TURN_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"HAZARD_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"AMBIENT_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"OVERHEAD_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"READING_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"TRUNK_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"EXTERIOR_FRONT_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"EXTERIOR_REAR_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"EXTERIOR_LEFT_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":true,
+ "name":"EXTERIOR_RIGHT_LIGHTS",
+ "rgbColorSpaceAvailable":true
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"REAR_CARGO_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"REAR_TRUCK_BED_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"REAR_TRAILER_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"LEFT_SPOT_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"RIGHT_SPOT_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"LEFT_PUDDLE_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":false,
+ "densityAvailable":false,
+ "name":"RIGHT_PUDDLE_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ },
+ {
+ "statusAvailable":true,
+ "densityAvailable":false,
+ "name":"EXTERIOR_ALL_LIGHTS",
+ "rgbColorSpaceAvailable":false
+ }
+ ]
+ },
+ "hmiSettingsControlCapabilities": {
+ "moduleName": "hmiSettings",
+ "moduleInfo": {
+ "moduleId": "c8cace3c-d482-4be1-8862-624a21e34563",
+ "allowMultipleAccess": true
+ },
+ "distanceUnitAvailable": true,
+ "temperatureUnitAvailable": true,
+ "displayModeUnitAvailable": true
+ }
}
}
},
@@ -550,6 +1012,12 @@
"upDownAvailable": true
},
{
+ "name":"PLAY_PAUSE",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
"name": "SEEKLEFT",
"shortPressAvailable": true,
"longPressAvailable": true,
@@ -579,9 +1047,9 @@
}
},
"VehicleInfo": {
- "make": "Ford",
- "model": "Fiesta",
- "modelYear": "2013",
+ "make": "SDL",
+ "model": "Generic",
+ "modelYear": "2019",
"trim": "SE"
},
"SyncMessageVersion": {
diff --git a/src/appMain/life_cycle.h b/src/appMain/life_cycle.h
index 69f4b987f5..b2e3c39f37 100644
--- a/src/appMain/life_cycle.h
+++ b/src/appMain/life_cycle.h
@@ -1,116 +1,91 @@
/*
-* Copyright (c) 2016, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef SRC_APPMAIN_LIFE_CYCLE_H_
#define SRC_APPMAIN_LIFE_CYCLE_H_
-#include <thread>
-#include <unistd.h>
-#include "utils/macro.h"
-#include "utils/shared_ptr.h"
-
-#include "config_profile/profile.h"
-#include "hmi_message_handler/hmi_message_handler_impl.h"
-#ifdef DBUS_HMIADAPTER
-#include "hmi_message_handler/dbus_message_adapter.h"
-#endif // DBUS_HMIADAPTER
-#if (defined(MESSAGEBROKER_HMIADAPTER) || defined(PASA_HMI))
-#include "hmi_message_handler/messagebroker_adapter.h"
-#endif // #if ( defined (MESSAGEBROKER_HMIADAPTER) || defined(PASA_HMI) )
-#include "application_manager/application_manager_impl.h"
-#include "connection_handler/connection_handler_impl.h"
-#include "protocol_handler/protocol_handler_impl.h"
-#include "transport_manager/transport_manager.h"
-#include "transport_manager/transport_manager_default.h"
-#include "media_manager/media_manager_impl.h"
-#ifdef TELEMETRY_MONITOR
-#include "telemetry_monitor/telemetry_monitor.h"
-#endif
-#ifdef ENABLE_SECURITY
-namespace security_manager {
-class CryptoManager;
-class SecurityManagerImpl;
-} // namespace security_manager
-#endif // ENABLE_SECURITY
+namespace main_namespace {
-namespace utils {
-class SystemTimeHandler;
-} // namespace utils
+/**
+ * Class responsible for all system components creation,
+ * start, stop, suspend and restore
+ */
-namespace main_namespace {
class LifeCycle {
public:
- LifeCycle(const profile::Profile& profile);
- bool StartComponents();
+ virtual ~LifeCycle() {}
/**
- * Initialize MessageBroker component
- * @return true if success otherwise false.
- */
- bool InitMessageSystem();
+ * Creates and starts all system components
+ * @return true if all components started successfully
+ * otherwise false.
+ */
+ virtual bool StartComponents() = 0;
+
/**
- * \brief Main loop
- */
- void Run();
- void StopComponents();
+ * Initializes MessageBroker component
+ * @return true if success otherwise false.
+ */
+ virtual bool InitMessageSystem() = 0;
- private:
- transport_manager::TransportManagerImpl* transport_manager_;
- protocol_handler::ProtocolHandlerImpl* protocol_handler_;
- connection_handler::ConnectionHandlerImpl* connection_handler_;
- application_manager::ApplicationManagerImpl* app_manager_;
-#ifdef ENABLE_SECURITY
- security_manager::CryptoManager* crypto_manager_;
- security_manager::SecurityManager* security_manager_;
-#endif // ENABLE_SECURITY
- hmi_message_handler::HMIMessageHandlerImpl* hmi_handler_;
- hmi_message_handler::HMIMessageAdapter* hmi_message_adapter_;
- media_manager::MediaManagerImpl* media_manager_;
- resumption::LastState* last_state_;
-#ifdef TELEMETRY_MONITOR
- telemetry_monitor::TelemetryMonitor* telemetry_monitor_;
-#endif // TELEMETRY_MONITOR
-#ifdef DBUS_HMIADAPTER
- hmi_message_handler::DBusMessageAdapter* dbus_adapter_;
- std::thread* dbus_adapter_thread_;
-#endif // DBUS_HMIADAPTER
+ /**
+ * @brief Main loop
+ */
+ virtual void Run() = 0;
+
+ /**
+ * Stops all system components
+ */
+ virtual void StopComponents() = 0;
-#ifdef MESSAGEBROKER_HMIADAPTER
- hmi_message_handler::MessageBrokerAdapter* mb_adapter_;
- std::thread* mb_adapter_thread_;
-#endif // MESSAGEBROKER_HMIADAPTER
+ /**
+ * Makes appropriate actions when Low Voltage signal received:
+ * Stops all SDL activities except of waiting of UNIX signals
+ * from HMI
+ */
+ virtual void LowVoltage() = 0;
- const profile::Profile& profile_;
- DISALLOW_COPY_AND_ASSIGN(LifeCycle);
+ /**
+ * Makes appropriate actions when Wake Up signal received:
+ * Restores all SDL activities stopped due to LOW VOLTAGE
+ * from HMI
+ */
+ virtual void WakeUp() = 0;
+
+ /**
+ * Makes appropriate actions when Ignition Off signal received:
+ * Triggers all SDL components stop and deletion
+ */
+ virtual void IgnitionOff() = 0;
};
} // namespace main_namespace
diff --git a/src/appMain/life_cycle.cc b/src/appMain/life_cycle_impl.cc
index e42032a5cb..4c2d1e88ac 100644
--- a/src/appMain/life_cycle.cc
+++ b/src/appMain/life_cycle_impl.cc
@@ -1,60 +1,61 @@
/*
-* Copyright (c) 2017, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "life_cycle.h"
-#include "utils/signals.h"
-#include "utils/make_shared.h"
-#include "config_profile/profile.h"
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "appMain/life_cycle_impl.h"
#include "application_manager/system_time/system_time_handler_impl.h"
+#include "config_profile/profile.h"
#include "resumption/last_state_impl.h"
-
+#include "resumption/last_state_wrapper_impl.h"
+#include "utils/signals.h"
#ifdef ENABLE_SECURITY
-#include "security_manager/security_manager_impl.h"
+#include "application_manager/policies/policy_handler.h"
#include "security_manager/crypto_manager_impl.h"
#include "security_manager/crypto_manager_settings_impl.h"
-#include "application_manager/policies/policy_handler.h"
+#include "security_manager/security_manager_impl.h"
#endif // ENABLE_SECURITY
#ifdef ENABLE_LOG
#include "utils/log_message_loop_thread.h"
#endif // ENABLE_LOG
+#include "appMain/low_voltage_signals_handler.h"
+
using threads::Thread;
namespace main_namespace {
CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain")
-LifeCycle::LifeCycle(const profile::Profile& profile)
+LifeCycleImpl::LifeCycleImpl(const profile::Profile& profile)
: transport_manager_(NULL)
, protocol_handler_(NULL)
, connection_handler_(NULL)
@@ -66,14 +67,9 @@ LifeCycle::LifeCycle(const profile::Profile& profile)
, hmi_handler_(NULL)
, hmi_message_adapter_(NULL)
, media_manager_(NULL)
- , last_state_(NULL)
#ifdef TELEMETRY_MONITOR
, telemetry_monitor_(NULL)
#endif // TELEMETRY_MONITOR
-#ifdef DBUS_HMIADAPTER
- , dbus_adapter_(NULL)
- , dbus_adapter_thread_(NULL)
-#endif // DBUS_HMIADAPTER
#ifdef MESSAGEBROKER_HMIADAPTER
, mb_adapter_(NULL)
, mb_adapter_thread_(NULL)
@@ -81,14 +77,18 @@ LifeCycle::LifeCycle(const profile::Profile& profile)
, profile_(profile) {
}
-bool LifeCycle::StartComponents() {
+bool LifeCycleImpl::StartComponents() {
LOG4CXX_AUTO_TRACE(logger_);
- DCHECK(!last_state_);
- last_state_ = new resumption::LastStateImpl(profile_.app_storage_folder(),
- profile_.app_info_storage());
+ DCHECK(!last_state_wrapper_);
+
+ auto last_state = std::make_shared<resumption::LastStateImpl>(
+ profile_.app_storage_folder(), profile_.app_info_storage());
+ last_state_wrapper_ =
+ std::make_shared<resumption::LastStateWrapperImpl>(last_state);
DCHECK(!transport_manager_);
- transport_manager_ = new transport_manager::TransportManagerDefault(profile_);
+ transport_manager_ = new transport_manager::TransportManagerDefault(
+ profile_, transport_manager::TransportAdapterFactory());
DCHECK(!connection_handler_);
connection_handler_ = new connection_handler::ConnectionHandlerImpl(
@@ -106,6 +106,13 @@ bool LifeCycle::StartComponents() {
app_manager_ =
new application_manager::ApplicationManagerImpl(profile_, profile_);
+ auto service_status_update_handler =
+ std::unique_ptr<protocol_handler::ServiceStatusUpdateHandler>(
+ new protocol_handler::ServiceStatusUpdateHandler(app_manager_));
+
+ protocol_handler_->set_service_status_update_handler(
+ std::move(service_status_update_handler));
+
DCHECK(!hmi_handler_);
hmi_handler_ = new hmi_message_handler::HMIMessageHandlerImpl(profile_);
@@ -114,7 +121,8 @@ bool LifeCycle::StartComponents() {
media_manager_ = new media_manager::MediaManagerImpl(*app_manager_, profile_);
app_manager_->set_connection_handler(connection_handler_);
- if (!app_manager_->Init(*last_state_, media_manager_)) {
+ app_manager_->AddPolicyObserver(protocol_handler_);
+ if (!app_manager_->Init(last_state_wrapper_, media_manager_)) {
LOG4CXX_ERROR(logger_, "Application manager init failed.");
return false;
}
@@ -126,7 +134,7 @@ bool LifeCycle::StartComponents() {
security_manager_ =
new security_manager::SecurityManagerImpl(std::move(system_time_handler));
crypto_manager_ = new security_manager::CryptoManagerImpl(
- utils::MakeShared<security_manager::CryptoManagerSettingsImpl>(
+ std::make_shared<security_manager::CryptoManagerSettingsImpl>(
profile_, app_manager_->GetPolicyHandler().RetrieveCertificate()));
protocol_handler_->AddProtocolObserver(security_manager_);
protocol_handler_->set_security_manager(security_manager_);
@@ -137,7 +145,6 @@ bool LifeCycle::StartComponents() {
security_manager_->AddListener(app_manager_);
app_manager_->AddPolicyObserver(security_manager_);
- app_manager_->AddPolicyObserver(protocol_handler_);
if (!crypto_manager_->Init()) {
LOG4CXX_ERROR(logger_, "CryptoManager initialization fail.");
return false;
@@ -166,15 +173,50 @@ bool LifeCycle::StartComponents() {
// It's important to initialise TM after setting up listener chain
// [TM -> CH -> AM], otherwise some events from TM could arrive at nowhere
app_manager_->set_protocol_handler(protocol_handler_);
- transport_manager_->Init(*last_state_);
+ if (transport_manager::E_SUCCESS !=
+ transport_manager_->Init(last_state_wrapper_)) {
+ LOG4CXX_ERROR(logger_, "Transport manager init failed.");
+ return false;
+ }
// start transport manager
- transport_manager_->Visibility(true);
+ transport_manager_->PerformActionOnClients(
+ transport_manager::TransportAction::kVisibilityOn);
+
+ LowVoltageSignalsOffset signals_offset{profile_.low_voltage_signal_offset(),
+ profile_.wake_up_signal_offset(),
+ profile_.ignition_off_signal_offset()};
+
+ low_voltage_signals_handler_.reset(
+ new LowVoltageSignalsHandler(*this, signals_offset));
return true;
}
+void LifeCycleImpl::LowVoltage() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ transport_manager_->PerformActionOnClients(
+ transport_manager::TransportAction::kListeningOff);
+ transport_manager_->StopEventsProcessing();
+ transport_manager_->Deinit();
+ app_manager_->OnLowVoltage();
+}
+
+void LifeCycleImpl::IgnitionOff() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ kill(getpid(), SIGINT);
+}
+
+void LifeCycleImpl::WakeUp() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ transport_manager_->Reinit();
+ transport_manager_->PerformActionOnClients(
+ transport_manager::TransportAction::kListeningOn);
+ app_manager_->OnWakeUp();
+ transport_manager_->StartEventsProcessing();
+}
+
#ifdef MESSAGEBROKER_HMIADAPTER
-bool LifeCycle::InitMessageSystem() {
+bool LifeCycleImpl::InitMessageSystem() {
mb_adapter_ = new hmi_message_handler::MessageBrokerAdapter(
hmi_handler_, profile_.server_address(), profile_.server_port());
@@ -189,30 +231,6 @@ bool LifeCycle::InitMessageSystem() {
}
#endif // MESSAGEBROKER_HMIADAPTER
-#ifdef DBUS_HMIADAPTER
-/**
- * Initialize DBus component
- * @return true if success otherwise false.
- */
-bool LifeCycle::InitMessageSystem() {
- dbus_adapter_ = new hmi_message_handler::DBusMessageAdapter(hmi_handler_);
-
- hmi_handler_->AddHMIMessageAdapter(dbus_adapter_);
- if (!dbus_adapter_->Init()) {
- LOG4CXX_FATAL(logger_, "Cannot init DBus service!");
- return false;
- }
-
- dbus_adapter_->SubscribeTo();
-
- LOG4CXX_INFO(logger_, "Start DBusMessageAdapter thread!");
- dbus_adapter_thread_ = new std::thread(
- &hmi_message_handler::DBusMessageAdapter::Run, dbus_adapter_);
-
- return true;
-}
-#endif // DBUS_HMIADAPTER
-
namespace {
void sig_handler(int sig) {
switch (sig) {
@@ -235,16 +253,16 @@ void sig_handler(int sig) {
}
} // namespace
-void LifeCycle::Run() {
+void LifeCycleImpl::Run() {
LOG4CXX_AUTO_TRACE(logger_);
// Register signal handlers and wait sys signals
// from OS
- if (!utils::WaitTerminationSignals(&sig_handler)) {
+ if (!utils::Signals::WaitTerminationSignals(&sig_handler)) {
LOG4CXX_FATAL(logger_, "Fail to catch system signal!");
}
}
-void LifeCycle::StopComponents() {
+void LifeCycleImpl::StopComponents() {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(hmi_handler_);
@@ -285,7 +303,8 @@ void LifeCycle::StopComponents() {
LOG4CXX_INFO(logger_, "Destroying Transport Manager.");
DCHECK_OR_RETURN_VOID(transport_manager_);
- transport_manager_->Visibility(false);
+ transport_manager_->PerformActionOnClients(
+ transport_manager::TransportAction::kVisibilityOff);
transport_manager_->Stop();
delete transport_manager_;
transport_manager_ = NULL;
@@ -303,32 +322,18 @@ void LifeCycle::StopComponents() {
delete connection_handler_;
connection_handler_ = NULL;
- LOG4CXX_INFO(logger_, "Destroying Last State");
- DCHECK(last_state_);
- delete last_state_;
- last_state_ = NULL;
+ LOG4CXX_INFO(logger_, "Destroying Last State.");
+ last_state_wrapper_.reset();
LOG4CXX_INFO(logger_, "Destroying Application Manager.");
DCHECK(app_manager_);
delete app_manager_;
app_manager_ = NULL;
- LOG4CXX_INFO(logger_, "Destroying HMI Message Handler and MB adapter.");
+ LOG4CXX_INFO(logger_, "Destroying Low Voltage Signals Handler.");
+ low_voltage_signals_handler_.reset();
-#ifdef DBUS_HMIADAPTER
- if (dbus_adapter_) {
- DCHECK_OR_RETURN_VOID(hmi_handler_);
- hmi_handler_->RemoveHMIMessageAdapter(dbus_adapter_);
- dbus_adapter_->Shutdown();
- if (dbus_adapter_thread_ != NULL) {
- dbus_adapter_thread_->join();
- }
- delete dbus_adapter_;
- dbus_adapter_ = NULL;
- delete dbus_adapter_thread_;
- dbus_adapter_thread_ = NULL;
- }
-#endif // DBUS_HMIADAPTER
+ LOG4CXX_INFO(logger_, "Destroying HMI Message Handler and MB adapter.");
#ifdef MESSAGEBROKER_HMIADAPTER
if (mb_adapter_) {
diff --git a/src/appMain/life_cycle_impl.h b/src/appMain/life_cycle_impl.h
new file mode 100644
index 0000000000..4a2e41b52f
--- /dev/null
+++ b/src/appMain/life_cycle_impl.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_APPMAIN_LIFE_CYCLE_IMPL_H_
+#define SRC_APPMAIN_LIFE_CYCLE_IMPL_H_
+
+#include "appMain/life_cycle.h"
+
+#include <unistd.h>
+#include <memory>
+#include <thread>
+#include "utils/macro.h"
+
+#include "config_profile/profile.h"
+#include "hmi_message_handler/hmi_message_handler_impl.h"
+#if (defined(MESSAGEBROKER_HMIADAPTER) || defined(PASA_HMI))
+#include "hmi_message_handler/messagebroker_adapter.h"
+#endif // #if ( defined (MESSAGEBROKER_HMIADAPTER) || defined(PASA_HMI) )
+#include "application_manager/application_manager_impl.h"
+#include "connection_handler/connection_handler_impl.h"
+#include "media_manager/media_manager_impl.h"
+#include "protocol_handler/protocol_handler_impl.h"
+#include "transport_manager/transport_manager.h"
+#include "transport_manager/transport_manager_default.h"
+#ifdef TELEMETRY_MONITOR
+#include "telemetry_monitor/telemetry_monitor.h"
+#endif
+
+#ifdef ENABLE_SECURITY
+namespace security_manager {
+class CryptoManager;
+class SecurityManagerImpl;
+} // namespace security_manager
+#endif // ENABLE_SECURITY
+
+namespace utils {
+class SystemTimeHandler;
+} // namespace utils
+
+namespace main_namespace {
+
+class LowVoltageSignalsHandler;
+
+class LifeCycleImpl : public LifeCycle {
+ public:
+ explicit LifeCycleImpl(const profile::Profile& profile);
+
+ bool StartComponents() OVERRIDE;
+ bool InitMessageSystem() OVERRIDE;
+ void Run() OVERRIDE;
+ void StopComponents() OVERRIDE;
+ void LowVoltage() OVERRIDE;
+ void WakeUp() OVERRIDE;
+ void IgnitionOff() OVERRIDE;
+
+ private:
+ transport_manager::TransportManagerImpl* transport_manager_;
+ protocol_handler::ProtocolHandlerImpl* protocol_handler_;
+ connection_handler::ConnectionHandlerImpl* connection_handler_;
+ application_manager::ApplicationManagerImpl* app_manager_;
+ std::unique_ptr<LowVoltageSignalsHandler> low_voltage_signals_handler_;
+#ifdef ENABLE_SECURITY
+ security_manager::CryptoManager* crypto_manager_;
+ security_manager::SecurityManager* security_manager_;
+#endif // ENABLE_SECURITY
+ hmi_message_handler::HMIMessageHandlerImpl* hmi_handler_;
+ hmi_message_handler::HMIMessageAdapter* hmi_message_adapter_;
+ media_manager::MediaManagerImpl* media_manager_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
+#ifdef TELEMETRY_MONITOR
+ telemetry_monitor::TelemetryMonitor* telemetry_monitor_;
+#endif // TELEMETRY_MONITOR
+
+#ifdef MESSAGEBROKER_HMIADAPTER
+ hmi_message_handler::MessageBrokerAdapter* mb_adapter_;
+ std::thread* mb_adapter_thread_;
+#endif // MESSAGEBROKER_HMIADAPTER
+
+ const profile::Profile& profile_;
+ DISALLOW_COPY_AND_ASSIGN(LifeCycleImpl);
+};
+} // namespace main_namespace
+
+#endif // SRC_APPMAIN_LIFE_CYCLE_IMPL_H_
diff --git a/src/appMain/low_voltage_signals_handler.cc b/src/appMain/low_voltage_signals_handler.cc
new file mode 100644
index 0000000000..bb7bbfbac7
--- /dev/null
+++ b/src/appMain/low_voltage_signals_handler.cc
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "appMain/low_voltage_signals_handler.h"
+
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <iostream>
+#include "appMain/life_cycle.h"
+#include "config_profile/profile.h"
+#include "utils/logger.h"
+#include "utils/signals.h"
+#include "utils/typed_enum_print.h"
+
+namespace main_namespace {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "LowVoltageSignalsHandler")
+
+LowVoltageSignalsHandler::LowVoltageSignalsHandler(
+ LifeCycle& life_cycle, const LowVoltageSignalsOffset& offset_data)
+ : notifications_delegate_(new NotificationThreadDelegate(*this))
+ , signals_handler_thread_(threads::CreateThread(
+ "LV_SIGNALS_HANDLER_THREAD", notifications_delegate_.get()))
+ , life_cycle_(life_cycle)
+ , SIGLOWVOLTAGE_(offset_data.low_voltage_signal_offset + SIGRTMIN)
+ , SIGWAKEUP_(offset_data.wake_up_signal_offset + SIGRTMIN)
+ , SIGIGNOFF_(offset_data.ignition_off_signal_offset + SIGRTMIN)
+ , cpid_(-1) {
+ sigemptyset(&lv_mask_);
+ sigaddset(&lv_mask_, SIGLOWVOLTAGE_);
+ signals_handler_thread_->start();
+}
+
+sigset_t LowVoltageSignalsHandler::LowVoltageSignalsMask() const {
+ return lv_mask_;
+}
+
+int LowVoltageSignalsHandler::low_voltage_signo() const {
+ return SIGLOWVOLTAGE_;
+}
+
+int LowVoltageSignalsHandler::wake_up_signo() const {
+ return SIGWAKEUP_;
+}
+
+int LowVoltageSignalsHandler::ignition_off_signo() const {
+ return SIGIGNOFF_;
+}
+
+void LowVoltageSignalsHandler::Destroy() {
+ if (signals_handler_thread_) {
+ signals_handler_thread_->join();
+ }
+ notifications_delegate_.reset();
+ threads::DeleteThread(signals_handler_thread_);
+}
+
+LowVoltageSignalsHandler::~LowVoltageSignalsHandler() {
+ Destroy();
+}
+
+void LowVoltageSignalsHandler::HandleSignal(const int signo) {
+ if (SIGLOWVOLTAGE_ == signo) {
+ LOG4CXX_DEBUG(logger_, "Received LOW_VOLTAGE signal");
+
+ life_cycle_.LowVoltage();
+ cpid_ = utils::Signals::Fork();
+
+ if (0 > cpid_) {
+ LOG4CXX_FATAL(logger_,
+ "Error due fork() call. Error: " << strerror(errno));
+ utils::Signals::ExitProcess(EXIT_FAILURE);
+ }
+
+ if (0 != cpid_) {
+ // In Parent process
+ LOG4CXX_DEBUG(logger_, "Child PID: " << cpid_);
+ utils::Signals::WaitPid(cpid_, nullptr, 0);
+ LOG4CXX_DEBUG(logger_, "Child process: " << cpid_ << " is stopped");
+ life_cycle_.WakeUp();
+ } else {
+ // In Child process
+ sigset_t signal_set;
+ sigfillset(&signal_set);
+ pthread_sigmask(SIG_BLOCK, &signal_set, nullptr);
+ sigemptyset(&lv_mask_);
+ sigaddset(&lv_mask_, SIGWAKEUP_);
+ sigaddset(&lv_mask_, SIGIGNOFF_);
+ std::cout << "Stopping parent process: " << getppid() << std::endl;
+ utils::Signals::SendSignal(SIGSTOP, getppid());
+ std::cout << "SIGSTOP signal sent to " << getppid() << std::endl;
+ }
+ return;
+ }
+
+ if (SIGWAKEUP_ == signo) {
+ std::cout << "Received WAKE UP signal" << std::endl;
+ std::cout << "Waking Up parent process: " << getppid() << std::endl;
+ utils::Signals::SendSignal(SIGCONT, getppid());
+ std::cout << "Stopping child process: " << getpid() << std::endl;
+ utils::Signals::ExitProcess(0);
+ }
+
+ if (SIGIGNOFF_ == signo) {
+ std::cout << "Received IGNITION_OFF signal" << std::endl;
+ std::cout << "Stopping all SDL processes..." << std::endl;
+ utils::Signals::SendSignal(SIGKILL, getppid());
+ utils::Signals::ExitProcess(0);
+ }
+}
+
+void NotificationThreadDelegate::threadMain() {
+ while (true) {
+ int signo = 0;
+ const sigset_t lv_mask =
+ low_voltage_signals_handler_.LowVoltageSignalsMask();
+ const int err = sigwait(&lv_mask, &signo);
+ if (0 != err) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Sigwait() error! Signals set contains an invalid signal number!");
+ continue;
+ }
+ low_voltage_signals_handler_.HandleSignal(signo);
+ }
+}
+
+void NotificationThreadDelegate::exitThreadMain() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ThreadDelegate::exitThreadMain();
+}
+
+} // namespace main_namespace
diff --git a/src/appMain/low_voltage_signals_handler.h b/src/appMain/low_voltage_signals_handler.h
new file mode 100644
index 0000000000..bedde38c5c
--- /dev/null
+++ b/src/appMain/low_voltage_signals_handler.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_APPMAIN_LOW_VOLTAGE_SIGNALS_HANDLER_H_
+#define SRC_APPMAIN_LOW_VOLTAGE_SIGNALS_HANDLER_H_
+
+#include <unistd.h>
+#include <memory>
+#include "utils/threads/thread.h"
+#include "utils/threads/thread_delegate.h"
+
+namespace main_namespace {
+
+typedef struct LowVoltageSignalsOffset {
+ int low_voltage_signal_offset;
+ int wake_up_signal_offset;
+ int ignition_off_signal_offset;
+} LowVoltageSignalsOffset;
+
+class LifeCycle;
+class NotificationThreadDelegate;
+
+/**
+ * @brief Class which handles real-time POSIX signals
+ * dedicated for LOW VOLTAGE functionality
+ */
+class LowVoltageSignalsHandler {
+ public:
+ /**
+ * @brief Constructor
+ * @param life_cycle - life_cycle object to interact with other system
+ * components
+ * @param offset_data offset data needed to calculate correct SIGNAL numbers
+ * used for LOW VOLTAGE functionality (as offset from SIGRTMIN)
+ */
+ LowVoltageSignalsHandler(LifeCycle& life_cycle,
+ const LowVoltageSignalsOffset& offset_data);
+ /**
+ * @brief Handles RT signals related to Low Voltage functionality
+ * @param signal number to handle
+ */
+ void HandleSignal(const int signo);
+
+ /**
+ * @brief Returns signals mask required for handling
+ * LOW VOLTAGE functionality
+ */
+ sigset_t LowVoltageSignalsMask() const;
+
+ /**
+ * @brief Returns LOW VOLTAGE signal number
+ */
+ int low_voltage_signo() const;
+
+ /**
+ * @brief Returns WAKE UP signal number
+ */
+ int wake_up_signo() const;
+
+ /**
+ * @brief Returns IGNITION OFF signal number
+ */
+ int ignition_off_signo() const;
+
+ /**
+ * @brief Destructor
+ */
+ ~LowVoltageSignalsHandler();
+
+ private:
+ /**
+ * @brief Destroys all parts of Low Voltage signals handler
+ * Invoked from destructor
+ */
+ void Destroy();
+ std::unique_ptr<NotificationThreadDelegate> notifications_delegate_;
+ threads::Thread* signals_handler_thread_;
+ LifeCycle& life_cycle_;
+ int SIGLOWVOLTAGE_;
+ int SIGWAKEUP_;
+ int SIGIGNOFF_;
+ pid_t cpid_;
+ sigset_t lv_mask_;
+};
+
+class NotificationThreadDelegate : public threads::ThreadDelegate {
+ public:
+ NotificationThreadDelegate(
+ LowVoltageSignalsHandler& low_voltage_signals_handler)
+ : low_voltage_signals_handler_(low_voltage_signals_handler) {}
+
+ ~NotificationThreadDelegate() {}
+
+ void threadMain() OVERRIDE;
+ void exitThreadMain() OVERRIDE;
+
+ private:
+ LowVoltageSignalsHandler& low_voltage_signals_handler_;
+};
+
+} // namespace main_namespace
+
+#endif // SRC_APPMAIN_LOW_VOLTAGE_SIGNALS_HANDLER_H_
diff --git a/src/appMain/main.cc b/src/appMain/main.cc
index feb5b5830e..cb59f63b1d 100644
--- a/src/appMain/main.cc
+++ b/src/appMain/main.cc
@@ -30,28 +30,31 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <signal.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <signal.h>
#include <cstdio>
#include <cstdlib>
-#include <vector>
-#include <string>
-#include <iostream> // cpplint: Streams are highly discouraged.
#include <fstream> // cpplint: Streams are highly discouraged.
+#include <iostream> // cpplint: Streams are highly discouraged.
+#include <memory>
+#include <string>
+#include <vector>
// ----------------------------------------------------------------------------
+#ifdef ENABLE_LOG
#include "utils/log_message_loop_thread.h"
+#endif // ENABLE_LOG
#include "utils/logger.h"
-#include "./life_cycle.h"
+#include "appMain/life_cycle_impl.h"
#include "signal_handlers.h"
-#include "utils/signals.h"
-#include "utils/system.h"
#include "config_profile/profile.h"
#include "utils/appenders_loader.h"
+#include "utils/signals.h"
+#include "utils/system.h"
#if defined(EXTENDED_MEDIA_MODE)
#include <gst/gst.h>
@@ -85,7 +88,7 @@ bool InitHmi(std::string hmi_link) {
.Execute();
}
#endif // WEB_HMI
-}
+} // namespace
/**
* \brief Entry point of the program.
@@ -94,8 +97,8 @@ bool InitHmi(std::string hmi_link) {
* \return EXIT_SUCCESS or EXIT_FAILURE
*/
int32_t main(int32_t argc, char** argv) {
- // Unsibscribe once for all threads
- if (!utils::UnsibscribeFromTermination()) {
+ // Unsubscribe once for all threads
+ if (!utils::Signals::UnsubscribeFromTermination()) {
// Can't use internal logger here
exit(EXIT_FAILURE);
}
@@ -103,13 +106,31 @@ int32_t main(int32_t argc, char** argv) {
// --------------------------------------------------------------------------
// Components initialization
profile::Profile profile_instance;
- main_namespace::LifeCycle life_cycle(profile_instance);
+ std::unique_ptr<main_namespace::LifeCycle> life_cycle(
+ new main_namespace::LifeCycleImpl(profile_instance));
+
if ((argc > 1) && (0 != argv)) {
profile_instance.set_config_file_name(argv[1]);
} else {
profile_instance.set_config_file_name("smartDeviceLink.ini");
}
+ // Reading profile offsets for real-time signals dedicated
+ // for Low Voltage functionality handling
+ main_namespace::LowVoltageSignalsOffset signals_offset{
+ profile_instance.low_voltage_signal_offset(),
+ profile_instance.wake_up_signal_offset(),
+ profile_instance.ignition_off_signal_offset()};
+
+ // Unsubscribe once for all threads
+ // except specific thread dedicated for
+ // Low Voltage signals handling
+ // Thread will be created later
+ if (!utils::Signals::UnsubscribeFromLowVoltageSignals(signals_offset)) {
+ // Can't use internal logger here
+ exit(EXIT_FAILURE);
+ }
+
// --------------------------------------------------------------------------
// Logger initialization
INIT_LOGGER("log4cxx.properties", profile_instance.logs_enabled());
@@ -134,9 +155,9 @@ int32_t main(int32_t argc, char** argv) {
// --------------------------------------------------------------------------
// Components initialization
- if (!life_cycle.StartComponents()) {
+ if (!life_cycle->StartComponents()) {
LOG4CXX_FATAL(logger_, "Failed to start components");
- life_cycle.StopComponents();
+ life_cycle->StopComponents();
DEINIT_LOGGER();
exit(EXIT_FAILURE);
}
@@ -145,9 +166,9 @@ int32_t main(int32_t argc, char** argv) {
// --------------------------------------------------------------------------
// Third-Party components initialization.
- if (!life_cycle.InitMessageSystem()) {
+ if (!life_cycle->InitMessageSystem()) {
LOG4CXX_FATAL(logger_, "Failed to init message system");
- life_cycle.StopComponents();
+ life_cycle->StopComponents();
DEINIT_LOGGER();
_exit(EXIT_FAILURE);
}
@@ -167,10 +188,10 @@ int32_t main(int32_t argc, char** argv) {
}
// --------------------------------------------------------------------------
- life_cycle.Run();
+ life_cycle->Run();
LOG4CXX_INFO(logger_, "Stop SDL due to caught signal");
- life_cycle.StopComponents();
+ life_cycle->StopComponents();
LOG4CXX_INFO(logger_, "Application has been stopped successfuly");
DEINIT_LOGGER();
diff --git a/src/appMain/sample_policy_manager.py b/src/appMain/sample_policy_manager.py
index 681c7bbb91..542aa5339b 100644
--- a/src/appMain/sample_policy_manager.py
+++ b/src/appMain/sample_policy_manager.py
@@ -42,49 +42,95 @@ def http_header(data):
return json.dumps(header)
-def crypt(data):
+def encrypt(data):
return data
def decrypt(data):
return data
-def pack(file_path, encryption, add_http_header):
- file = open(file_path, "r+")
- data = file.read()
- file.seek(0)
- file.truncate()
-
- if encryption:
- data = crypt(data)
- if add_http_header:
- data = http_header(data)
+def pack(data, encryption, add_http_header):
+ file_path = data['fileName']
+ file_ptr = open(file_path, "r+")
- file.write(data)
- file.close()
- return file_path
+ request_type = data['requestType']
+ pack_handler = get_handler(request_type, 'pack')
+
+ new_data = pack_handler(data, file_ptr)
+ if new_data is not None:
+ if encryption:
+ new_data = encrypt(new_data)
+ if add_http_header:
+ new_data = http_header(new_data)
+
+ file_ptr.write(new_data)
+ file_ptr.close()
+ return file_path
-def unpack(file_path, encryption):
- file = open(file_path, 'r+')
- read_data = file.read()
- file.seek(0)
- file.truncate()
+def unpack(data, encryption):
+ file_path = data['fileName']
+ file_ptr = open(file_path, 'r+')
- json_data = json.loads(read_data)
- policy_data = json.dumps(json_data['data'][0])
+ request_type = data['requestType']
+ unpack_handler = get_handler(request_type, 'unpack')
- if encryption:
- policy_data = decrypt(policy_data)
+ new_data = unpack_handler(data, file_ptr)
+ if new_data is not None:
+ if encryption:
+ new_data = decrypt(new_data)
- file.write(policy_data)
- file.close()
+ file_ptr.write(new_data)
+ file_ptr.close()
return file_path
+def get_handler(request_type, handler_type):
+ handlers_map = {
+ "PROPRIETARY": get_proprietary_handler
+ }
+ if request_type not in handlers_map:
+ print('\033[33;1mUnhandled request type: %s. Using default request handler\033[0m' % request_type)
+ default_handler = lambda data, file_ptr: None
+ return default_handler
+
+ return handlers_map[request_type](handler_type)
+
+# Handler getter template
+# def get_<request_type>_handler(handler_type):
+# def pack(data, file_ptr):
+# ...
+# def unpack(data, file_ptr):
+# ...
+# return pack if handler_type == 'pack' else unpack
+
+def get_proprietary_handler(handler_type):
+ def pack(data, file_ptr):
+ read_data = file_ptr.read()
+ file_ptr.seek(0)
+ file_ptr.truncate()
+ return read_data
+
+ def unpack(data, file_ptr):
+ read_data = file_ptr.read()
+ file_ptr.seek(0)
+ file_ptr.truncate()
+
+ try:
+ json_data = json.loads(read_data)
+ except ValueError:
+ print('\033[31;1mInvalid JSON data: %s\033[0m' % read_data)
+ return None
+
+ policy_data = json.dumps(json_data['data'][0])
+ return policy_data
+
+ return pack if handler_type == 'pack' else unpack
+
+
class WebSocketHandler(tornado.websocket.WebSocketHandler):
def initialize(self,encryption, add_http_header, handle_func):
@@ -96,7 +142,19 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
print ("Socket Connected\n")
def on_message(self, data):
- self.write_message(self.handle_func(data, self.encryption, self.add_http_header))
+ try:
+ json_data = json.loads(data)
+ except ValueError:
+ print('\033[31;1mInvalid JSON message: %s\033[0m' % data)
+ return
+ if 'requestType' not in json_data:
+ print('\033[31;1mMissing requestType parameter: %s\033[0m' % str(json_data))
+ return
+ if 'fileName' not in json_data:
+ print('\033[31;1mMissing fileName parameter: %s\033[0m' % str(json_data))
+ return
+
+ self.write_message(self.handle_func(json_data, self.encryption, self.add_http_header))
def on_close(self):
print ("Connection Closed\n")
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index 1cf3bf52c1..4f97d90b09 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -1,2381 +1,4089 @@
-{
- "policy_table": {
- "module_config": {
- "preloaded_pt": true,
- "exchange_after_x_ignition_cycles": 100,
- "exchange_after_x_kilometers": 1800,
- "exchange_after_x_days": 30,
- "timeout_after_x_seconds": 60,
- "seconds_between_retries": [1,
- 5,
- 25,
- 125,
- 625],
- "endpoints": {
- "0x07": {
- "default": ["http://x.x.x.x:3000/api/1/policies/proprietary"]
- },
- "0x04": {
- "default": ["http://x.x.x.x:3000/api/1/softwareUpdate"]
- },
- "queryAppsUrl": {
- "default": ["http://sdl.shaid.server"]
- },
- "lock_screen_icon_url": {
- "default": ["http://i.imgur.com/TgkvOIZ.png"]
- }
- },
- "notifications_per_minute_by_priority": {
- "EMERGENCY": 60,
- "NAVIGATION": 15,
- "PROJECTION": 15,
- "VOICECOM": 20,
- "COMMUNICATION": 6,
- "NORMAL": 4,
- "NONE": 0
- }
- },
- "functional_groupings": {
- "Base-4": {
- "rpcs": {
- "AddCommand": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "AddSubMenu": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "Alert": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "ChangeRegistration": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "CreateInteractionChoiceSet": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "DeleteCommand": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "DeleteFile": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "DeleteInteractionChoiceSet": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "DeleteSubMenu": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "EncodedSyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "EndAudioPassThru": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "GenericResponse": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "GetSystemCapability": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "ListFiles": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnAppInterfaceUnregistered": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnAudioPassThru": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "OnButtonEvent": {
- "hmi_levels": ["FULL",
- "LIMITED",
- "BACKGROUND"]
- },
- "OnButtonPress": {
- "hmi_levels": ["FULL",
- "LIMITED",
- "BACKGROUND"]
- },
- "OnCommand": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "OnDriverDistraction": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "OnEncodedSyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnHashChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnHMIStatus": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnLanguageChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnPermissionsChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnSystemRequest": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "PerformAudioPassThru": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "PerformInteraction": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "PutFile": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "RegisterAppInterface": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "ResetGlobalProperties": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "ScrollableMessage": {
- "hmi_levels": ["FULL"]
- },
- "SetAppIcon": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetDisplayLayout": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetGlobalProperties": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetMediaClockTimer": {
- "hmi_levels": ["FULL",
- "LIMITED",
- "BACKGROUND"]
- },
- "Show": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "Slider": {
- "hmi_levels": ["FULL"]
- },
- "Speak": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "SubscribeButton": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "SystemRequest": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "UnregisterAppInterface": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "UnsubscribeButton": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "Location-1": {
- "user_consent_prompt": "Location",
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["gps",
- "speed"]
- },
- "OnVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["gps",
- "speed"]
- },
- "SubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["gps",
- "speed"]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["gps",
- "speed"]
- }
- }
- },
- "Notifications": {
- "user_consent_prompt": "Notifications",
- "rpcs": {
- "Alert": {
- "hmi_levels": ["BACKGROUND"]
- }
- }
- },
- "Notifications-RC": {
- "rpcs": {
- "OnHMIStatus": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnPermissionsChange": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnSystemRequest": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- }
- }
- },
- "DrivingCharacteristics-3": {
- "user_consent_prompt": "DrivingCharacteristics",
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["accPedalPosition",
- "beltStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"]
- },
- "OnVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["accPedalPosition",
- "beltStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"]
- },
- "SubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["accPedalPosition",
- "beltStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["accPedalPosition",
- "beltStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"]
- }
- }
- },
- "VehicleInfo-3": {
- "user_consent_prompt": "VehicleInfo",
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["bodyInformation",
- "deviceStatus",
- "engineOilLife",
- "engineTorque",
- "externalTemperature",
- "turnSignal",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "fuelRange",
- "odometer",
- "tirePressure",
- "vin",
- "wiperStatus"]
- },
- "OnVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["bodyInformation",
- "deviceStatus",
- "engineOilLife",
- "engineTorque",
- "externalTemperature",
- "turnSignal",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "fuelRange",
- "odometer",
- "tirePressure",
- "vin",
- "wiperStatus"]
- },
- "SubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["bodyInformation",
- "deviceStatus",
- "engineOilLife",
- "engineTorque",
- "externalTemperature",
- "turnSignal",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "fuelRange",
- "odometer",
- "tirePressure",
- "wiperStatus"]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["bodyInformation",
- "deviceStatus",
- "engineOilLife",
- "engineTorque",
- "externalTemperature",
- "turnSignal",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "fuelRange",
- "odometer",
- "tirePressure",
- "wiperStatus"]
- }
- }
- },
- "PropriataryData-1": {
- "rpcs": {
- "DiagnosticMessage": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "GetDTCs": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "ReadDID": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "PropriataryData-2": {
- "rpcs": {
- "DiagnosticMessage": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "GetDTCs": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "ReadDID": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "ProprietaryData-3": {
- "rpcs": {
- "GetDTCs": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "ReadDID": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "RemoteControl": {
- "rpcs": {
- "ButtonPress": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "GetInteriorVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "SetInteriorVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "OnInteriorVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "SystemRequest": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- }
- }
- },
- "Emergency-1": {
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"]
- },
- "OnVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"]
- },
- "SubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"],
- "parameters": ["airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"]
- }
- }
- },
- "Navigation-1": {
- "rpcs": {
- "AlertManeuver": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "ShowConstantTBT": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "UpdateTurnList": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "Base-6": {
- "rpcs": {
- "AddCommand": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "AddSubMenu": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "Alert": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "ChangeRegistration": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "CreateInteractionChoiceSet": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "DeleteCommand": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "DeleteFile": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "DeleteInteractionChoiceSet": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "DeleteSubMenu": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "EncodedSyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "EndAudioPassThru": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "GenericResponse": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "ListFiles": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnAppInterfaceUnregistered": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnAudioPassThru": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "OnButtonEvent": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "OnButtonPress": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "OnCommand": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "OnDriverDistraction": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "OnEncodedSyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnHMIStatus": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnLanguageChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnPermissionsChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnSyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnTBTClientState": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "PerformAudioPassThru": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "PerformInteraction": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "PutFile": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "RegisterAppInterface": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "ResetGlobalProperties": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "ScrollableMessage": {
- "hmi_levels": ["FULL"]
- },
- "SetAppIcon": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetDisplayLayout": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetGlobalProperties": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "SetMediaClockTimer": {
- "hmi_levels": ["FULL"]
- },
- "Show": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "Slider": {
- "hmi_levels": ["FULL"]
- },
- "Speak": {
- "hmi_levels": ["FULL",
- "LIMITED"]
- },
- "SubscribeButton": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "SyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "UnregisterAppInterface": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "UnsubscribeButton": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "OnKeyboardInputOnlyGroup": {
- "rpcs": {
- "OnKeyboardInput": {
- "hmi_levels": ["FULL"]
- }
- }
- },
- "OnTouchEventOnlyGroup": {
- "rpcs": {
- "OnTouchEvent": {
- "hmi_levels": ["FULL"]
- }
- }
- },
- "DiagnosticMessageOnly": {
- "rpcs": {
- "DiagnosticMessage": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "DataConsent-2": {
- "user_consent_prompt": "DataConsent",
- "rpcs": null
- },
- "BaseBeforeDataConsent": {
- "rpcs": {
- "ChangeRegistration": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "DeleteFile": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "EncodedSyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "ListFiles": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnAppInterfaceUnregistered": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnEncodedSyncPData": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnHashChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnHMIStatus": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnLanguageChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnPermissionsChange": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "OnSystemRequest": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "PutFile": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "RegisterAppInterface": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "ResetGlobalProperties": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetGlobalProperties": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetAppIcon": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SetDisplayLayout": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "SystemRequest": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- },
- "UnregisterAppInterface": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"]
- }
- }
- },
- "SendLocation": {
- "rpcs": {
- "SendLocation": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "WayPoints": {
- "rpcs": {
- "GetWayPoints": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "SubscribeWayPoints": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- },
- "UnsubscribeWayPoints": {
- "hmi_levels": ["BACKGROUND",
- "FULL",
- "LIMITED"]
- }
- }
- },
- "BackgroundAPT": {
- "rpcs": {
- "EndAudioPassThru": {
- "hmi_levels": ["BACKGROUND"]
- },
- "OnAudioPassThru": {
- "hmi_levels": ["BACKGROUND"]
- },
- "PerformAudioPassThru": {
- "hmi_levels": ["BACKGROUND"]
- }
- }
- },
- "HapticGroup": {
- "rpcs": {
- "OnTouchEvent": {
- "hmi_levels": ["FULL"]
- },
- "SendHapticData": {
- "hmi_levels": ["FULL"]
- }
- }
- }
- },
- "consumer_friendly_messages": {
- "version": "001.001.021",
- "messages": {
- "AppPermissions": {
- "languages": {
- "de-de": {
- "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
- "line1": "Zugriffsanfrage(n)",
- "line2": "erlauben?"
- },
- "en-au": {
- "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
- "line1": "Grant requested",
- "line2": "permission(s)?"
- },
- "en-gb": {
- "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
- "line1": "Grant requested",
- "line2": "permission(s)?",
- "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
- },
- "en-ie": {
- "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
- "line1": "Grant requested",
- "line2": "permission(s)?"
- },
- "en-us": {
- "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.",
- "line1": "Grant Requested",
- "line2": "Permission(s)?",
- "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
- },
- "es-en": {
- "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
- "line1": "¿Otorgar permiso(s)",
- "line2": "solicitado(s)?",
- "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
- },
- "es-es": {
- "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
- "line1": "¿Conceder permisos",
- "line2": "solicitados?"
- },
- "es-mx": {
- "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
- "line1": "¿Otorgar permiso(s)",
- "line2": "solicitado(s)?",
- "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. \n\nSi presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
- },
- "fr-ca": {
- "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
- "line1": "Accorder permission(s)",
- "line2": "demandée(s)",
- "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles."
- },
- "fr-fr": {
- "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
- "line1": "Accorder permission(s)",
- "line2": "demandée(s)"
- },
- "it-it": {
- "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
- "line1": "Concedi autorizzaz.",
- "line2": "richiesta(e)?"
- },
- "nl-nl": {
- "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
- "line1": "Aangevraagde",
- "line2": "permissie(s) verlenen?"
- },
- "pl-pl": {
- "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
- "line1": "Udzielić żądanych",
- "line2": "pozwoleń?"
- },
- "pt-br": {
- "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
- "line1": "Conceder permissão",
- "line2": "solicitada?"
- },
- "pt-pt": {
- "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
- "line1": "Conceder permiss.",
- "line2": "solicitada(s)?"
- },
- "ru-ru": {
- "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
- "line1": "Предост. заправш.",
- "line2": "разрешения?"
- },
- "sv-se": {
- "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
- "line1": "Vill du ge",
- "line2": "tillstånd?"
- },
- "tr-tr": {
- "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
- "line1": "İstenen izinler",
- "line2": "verilsin mi?"
- },
- "zh-cn": {
- "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
- "line1": "是否允许请求的",
- "line2": "权限?"
- },
- "zh-tw": {
- "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
- "line1": "允許",
- "line2": "授權請求?"
- }
- }
- },
- "AppPermissionsHelp": {
- "languages": {
- "de-de": {
- "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
- },
- "en-au": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
- "en-gb": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
- "en-ie": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
- "en-us": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
- },
- "es-en": {
- "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
- "es-es": {
- "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
- },
- "es-mx": {
- "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
- "fr-ca": {
- "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
- },
- "fr-fr": {
- "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
- },
- "it-it": {
- "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
- },
- "nl-nl": {
- "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
- },
- "pl-pl": {
- "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
- },
- "pt-br": {
- "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
- },
- "pt-pt": {
- "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
- },
- "ru-ru": {
- "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
- },
- "sv-se": {
- "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
- },
- "tr-tr": {
- "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
- },
- "zh-cn": {
- "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
- },
- "zh-tw": {
- "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
- }
- }
- },
- "AppPermissionsRevoked": {
- "languages": {
- "de-de": {
- "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
- },
- "en-au": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "en-gb": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "en-ie": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "en-us": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "es-en": {
- "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
- "es-es": {
- "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
- },
- "es-mx": {
- "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
- "fr-ca": {
- "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
- },
- "fr-fr": {
- "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
- },
- "it-it": {
- "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
- },
- "nl-nl": {
- "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
- },
- "pl-pl": {
- "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
- },
- "pt-br": {
- "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
- },
- "pt-pt": {
- "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
- },
- "ru-ru": {
- "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
- },
- "sv-se": {
- "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
- },
- "tr-tr": {
- "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
- },
- "zh-cn": {
- "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
- },
- "zh-tw": {
- "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
- }
- }
- },
- "AppUnauthorized": {
- "languages": {
- "de-de": {
- "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
- "line1": "nicht autorisiert"
- },
- "en-au": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "not authorized"
- },
- "en-gb": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "not authorized",
- "textBody": "This version of %appName% is not authorized and will not work with SYNC."
- },
- "en-ie": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "not authorized"
- },
- "en-us": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "Not Authorized",
- "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
- },
- "es-en": {
- "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
- "line1": "no autorizada",
- "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
- },
- "es-es": {
- "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
- "line1": "No autorizada"
- },
- "es-mx": {
- "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
- "line1": "no autorizada",
- "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
- },
- "fr-ca": {
- "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
- "line1": "non autorisée",
- "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
- },
- "fr-fr": {
- "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
- "line1": "non autorisée"
- },
- "it-it": {
- "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
- "line1": "non autorizzata"
- },
- "nl-nl": {
- "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
- "line1": "niet geautoriseerd"
- },
- "pl-pl": {
- "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
- "line1": "brak autoryzacji"
- },
- "pt-br": {
- "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
- "line1": "não autorizado"
- },
- "pt-pt": {
- "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
- "line1": "não autorizada"
- },
- "ru-ru": {
- "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
- "line1": "не авторизировано"
- },
- "sv-se": {
- "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
- "line1": "är ej godkänd"
- },
- "tr-tr": {
- "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
- "line1": "için izin yok"
- },
- "zh-cn": {
- "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
- "line1": "未得到授权"
- },
- "zh-tw": {
- "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
- "line1": "無授權"
- }
- }
- },
- "AppUnsupported": {
- "languages": {
- "de-de": {
- "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
- "line1": "nicht unterstützt"
- },
- "en-au": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "not supported"
- },
- "en-gb": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "not supported",
- "textBody": "This version of %appName% is not supported by SYNC."
- },
- "en-ie": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "not supported"
- },
- "en-us": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "Not Supported",
- "textBody": "Your version of %appName% is not supported by SYNC."
- },
- "es-en": {
- "tts": "Esta versión de %appName% no es compatible con SYNC.",
- "line1": "no compatible",
- "textBody": "Esta versión de %appName% no es compatible con SYNC."
- },
- "es-es": {
- "tts": "Esta versión de %appName% no es compatible con SYNC.",
- "line1": "No compatible"
- },
- "es-mx": {
- "tts": "Esta versión de %appName% no es compatible con SYNC.",
- "line1": "no compatible",
- "textBody": "Esta versión de %appName% no es compatible con SYNC."
- },
- "fr-ca": {
- "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
- "line1": "incompatible",
- "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
- },
- "fr-fr": {
- "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
- "line1": "incompatible"
- },
- "it-it": {
- "tts": "Questa versione di %appName% non è supportata dal SYNC.",
- "line1": "non supportata"
- },
- "nl-nl": {
- "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
- "line1": "niet ondersteund"
- },
- "pl-pl": {
- "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
- "line1": "aplikacja nie obsług."
- },
- "pt-br": {
- "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
- "line1": "não suportado"
- },
- "pt-pt": {
- "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
- "line1": "não suportada"
- },
- "ru-ru": {
- "tts": "Эта версия %appName% не поддерживается SYNC.",
- "line1": "не поддерживается"
- },
- "sv-se": {
- "tts": "SYNC har inte stöd för den här versionen av %appName%.",
- "line1": "stöds ej"
- },
- "tr-tr": {
- "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
- "line1": "desteklenmiyor"
- },
- "zh-cn": {
- "tts": "SYNC不支持此版本的%appName%。",
- "line1": "不受支持"
- },
- "zh-tw": {
- "tts": "SYNC 不支援此版本的%appName% 。",
- "line1": "不支援"
- }
- }
- },
- "DataConsent": {
- "languages": {
- "en-gb": {
- "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. \r\n\r\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
- },
- "en-us": {
- "line1": "Enable Mobile Apps",
- "line2": "on SYNC? (Uses Data)",
- "textBody": "Would you like to enable Mobile Apps on SYNC?\r\n\r\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\r\n\r\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
- },
- "es-mx": {
- "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. \n\nLas actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. \n\nPresione Sí para permitir y No para denegar."
- },
- "fr-ca": {
- "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements.\r\n\r\nVeuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
- }
- }
- },
- "DataConsentHelp": {
- "languages": {
- "en-us": {
- "textBody": "By enabling mobile apps, you consent to allowing SYNC to communicate with Ford at least once per month using your mobile device’s data plan. Disabling will stop all data usage, but you will not be able to use mobile apps on SYNC. See your Owner Guide for more information."
- },
- "es-mx": {
- "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
- },
- "fr-ca": {
- "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
- }
- }
- },
- "DisableApps": {
- "languages": {
- "de-de": {
- "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
- "line1": "Auto-Update",
- "line2": "und Mobile Apps deaktivieren"
- },
- "en-au": {
- "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
- "line1": "Disable auto-updates",
- "line2": "and Mobile Apps?"
- },
- "en-gb": {
- "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
- "line1": "Disable auto-updates",
- "line2": "and Mobile Apps?",
- "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
- },
- "en-ie": {
- "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
- "line1": "Disable auto-updates",
- "line2": "and Mobile Apps?"
- },
- "en-us": {
- "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
- "line1": "Disable Auto-Updates",
- "line2": "and Mobile Apps?",
- "textBody": "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel."
- },
- "es-en": {
- "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
- "line1": "¿Deshab. actualiz.",
- "line2": "autom. y aplic. móv.?",
- "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
- },
- "es-es": {
- "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
- "line1": "¿Desact. actual. auto",
- "line2": "y apl. móviles?"
- },
- "es-mx": {
- "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
- "line1": "¿Deshab. actualiz.",
- "line2": "autom. y aplic. móv.?",
- "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
- },
- "fr-ca": {
- "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
- "line1": "Désactiver màj autom.",
- "line2": "et app. mobiles?",
- "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
- },
- "fr-fr": {
- "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
- "line1": "Désactiver màj autom.",
- "line2": "et app. mobiles?"
- },
- "it-it": {
- "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
- "line1": "Disabilitare agg. aut.",
- "line2": "e app mobili?"
- },
- "nl-nl": {
- "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
- "line1": "Auto-updates en mob.",
- "line2": "apps uitschakelen?"
- },
- "pl-pl": {
- "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
- "line1": "Wył. automat. aktual.",
- "line2": "i aplikacje mobilne?"
- },
- "pt-br": {
- "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
- "line1": "Desativar atualizações",
- "line2": "autom. e aplicativos?"
- },
- "pt-pt": {
- "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
- "line1": "Desact. actual. autom.",
- "line2": "e aplicações móveis?"
- },
- "ru-ru": {
- "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
- "line1": "Откл. автообновления",
- "line2": "и мобил. прилож.?"
- },
- "sv-se": {
- "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
- "line1": "Avaktiverar autouppdat.",
- "line2": "och mobilappar?"
- },
- "tr-tr": {
- "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
- "line1": "Oto. güncelleme ve",
- "line2": "mobil uygul. kapat?"
- },
- "zh-cn": {
- "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
- "line1": "是否禁用自动更新和",
- "line2": "移动应用程序?"
- },
- "zh-tw": {
- "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
- "line1": "停用自動更新",
- "line2": "和行動應用程式?"
- }
- }
- },
- "DrivingCharacteristics": {
- "languages": {
- "de-de": {
- "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
- "label": "Fahreigenschaften"
- },
- "en-au": {
- "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
- "label": "Driving characteristics"
- },
- "en-gb": {
- "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
- "label": "Driving characteristics",
- "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
- },
- "en-ie": {
- "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
- "label": "Driving characteristics"
- },
- "en-us": {
- "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.",
- "label": "Driving Characteristics",
- "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
- "label": "Características del manejo",
- "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
- },
- "es-es": {
- "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
- "label": "Características de conducción"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
- "label": "Características del manejo",
- "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
- },
- "fr-ca": {
- "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
- "label": "Caractéristiques de conduite",
- "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
- },
- "fr-fr": {
- "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
- "label": "Caractéristiques de conduite"
- },
- "it-it": {
- "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
- "label": "Caratteristiche di guida"
- },
- "nl-nl": {
- "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
- "label": "Rijkenmerken"
- },
- "pl-pl": {
- "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
- "label": "Informacje dotyczące stylu jazdy"
- },
- "pt-br": {
- "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
- "label": "Características de condução"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
- "label": "Características de condução"
- },
- "ru-ru": {
- "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
- "label": "Характеристики движения"
- },
- "sv-se": {
- "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
- "label": "Köregenskaper"
- },
- "tr-tr": {
- "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
- "label": "Sürüş karakteristikleri"
- },
- "zh-cn": {
- "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
- "label": "行驶特性"
- },
- "zh-tw": {
- "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
- "label": "駕駛特性"
- }
- }
- },
- "Location": {
- "languages": {
- "de-de": {
- "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
- "label": "GPS und Geschwindigkeit"
- },
- "en-au": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and speed"
- },
- "en-gb": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and speed",
- "textBody": "An app can access vehicle GPS and speed."
- },
- "en-ie": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and speed"
- },
- "en-us": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and speed",
- "textBody": "An app can access vehicle GPS and speed."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
- "label": "GPS y velocidad",
- "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
- },
- "es-es": {
- "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
- "label": "GPS y velocidad"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
- "label": "GPS y velocidad",
- "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
- },
- "fr-ca": {
- "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
- "label": "GPS et vitesse",
- "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
- },
- "fr-fr": {
- "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
- "label": "GPS et vitesse"
- },
- "it-it": {
- "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
- "label": "GPS e velocità"
- },
- "nl-nl": {
- "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
- "label": "Gps en snelheid"
- },
- "pl-pl": {
- "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
- "label": "GPS i prędkość"
- },
- "pt-br": {
- "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
- "label": "GPS e velocidade"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
- "label": "GPS e velocidade"
- },
- "ru-ru": {
- "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
- "label": "GPS и скорость"
- },
- "sv-se": {
- "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
- "label": "GPS och hastighet"
- },
- "tr-tr": {
- "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
- "label": "GPS ve hız"
- },
- "zh-cn": {
- "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
- "label": "GPS 和车速"
- },
- "zh-tw": {
- "tts": "應用程式可存取車輛的GPS和速度。",
- "label": "GPS和車速"
- }
- }
- },
- "Notifications": {
- "languages": {
- "de-de": {
- "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
- "label": "Push-Benachrichtigungen"
- },
- "en-au": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push notifications"
- },
- "en-gb": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push notifications",
- "textBody": "An app can send notifications when running in the background."
- },
- "en-ie": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push notifications"
- },
- "en-us": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push notifications",
- "textBody": "An app can send notifications when running in the background."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
- "label": "Notificaciones tipo Push",
- "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
- },
- "es-es": {
- "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
- "label": "Notificaciones push"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
- "label": "Notificaciones tipo Push",
- "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
- },
- "fr-ca": {
- "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
- "label": "Notifications instantanées",
- "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
- },
- "fr-fr": {
- "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
- "label": "Notifications push"
- },
- "it-it": {
- "tts": "Un'app può inviare notifiche se eseguita in background.",
- "label": "Notifiche push"
- },
- "nl-nl": {
- "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
- "label": "Push-meldingen"
- },
- "pl-pl": {
- "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
- "label": "Powiadomienia Push"
- },
- "pt-br": {
- "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
- "label": "Notificações Push"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
- "label": "Notificações push"
- },
- "ru-ru": {
- "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
- "label": "Оповещения о пересылке"
- },
- "sv-se": {
- "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
- "label": "Push-notiser"
- },
- "tr-tr": {
- "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
- "label": "Anlık bildirimleri"
- },
- "zh-cn": {
- "tts": "移动应用程序在后台运行时可推送通知。",
- "label": "推送通知"
- },
- "zh-tw": {
- "tts": "車輛行進時,應用程式可在背景中傳送通知。",
- "label": "傳送通知"
- }
- }
- },
- "SettingDisableUpdates": {
- "languages": {
- "de-de": {
- "line1": "Updates deakt."
- },
- "en-au": {
- "line1": "Disable updates"
- },
- "en-gb": {
- "line1": "Disable updates"
- },
- "en-ie": {
- "line1": "Disable updates"
- },
- "en-us": {
- "line1": "Disable Updates",
- "textBody": "Disable Updates"
- },
- "es-en": {
- "line1": "Deshab. actual.",
- "textBody": "Deshab. actual."
- },
- "es-es": {
- "line1": "Desact. actual."
- },
- "es-mx": {
- "line1": "Deshab. actual.",
- "textBody": "Deshab. actual."
- },
- "fr-ca": {
- "line1": "Désactiver MAJ",
- "textBody": "Désactiver MAJ"
- },
- "fr-fr": {
- "line1": "Désactiver màj"
- },
- "it-it": {
- "line1": "Disabilita agg."
- },
- "nl-nl": {
- "line1": "Upd. uitschak."
- },
- "pl-pl": {
- "line1": "Wyłącz aktual."
- },
- "pt-br": {
- "line1": "Desat. atualiz."
- },
- "pt-pt": {
- "line1": "Desact. actualiz."
- },
- "ru-ru": {
- "line1": "Откл. обновл."
- },
- "sv-se": {
- "line1": "Inaktivera uppd."
- },
- "tr-tr": {
- "line1": "Güncell. Kapat"
- },
- "zh-cn": {
- "line1": "禁用更新"
- },
- "zh-tw": {
- "line1": "停用更新"
- }
- }
- },
- "SettingEnableUpdates": {
- "languages": {
- "de-de": {
- "line1": "Apps aktivieren"
- },
- "en-au": {
- "line1": "Enable Apps"
- },
- "en-gb": {
- "line1": "Enable Apps"
- },
- "en-ie": {
- "line1": "Enable Apps"
- },
- "en-us": {
- "line1": "Enable Apps"
- },
- "es-en": {
- "line1": "Hab. aplic."
- },
- "es-es": {
- "line1": "Activar apl."
- },
- "es-mx": {
- "line1": "Hab. aplic."
- },
- "fr-ca": {
- "line1": "Activer app.",
- "textBody": "Activer app."
- },
- "fr-fr": {
- "line1": "Activer app."
- },
- "it-it": {
- "line1": "Abilita app"
- },
- "nl-nl": {
- "line1": "Apps inschak."
- },
- "pl-pl": {
- "line1": "Włącz aplikacje"
- },
- "pt-br": {
- "line1": "Ativar aplic."
- },
- "pt-pt": {
- "line1": "Activar actualiz."
- },
- "ru-ru": {
- "line1": "Вкл. прилож."
- },
- "sv-se": {
- "line1": "Aktivera appar"
- },
- "tr-tr": {
- "line1": "Uygulamaları aç"
- },
- "zh-cn": {
- "line1": "启用应用程序"
- },
- "zh-tw": {
- "line1": "啟用應用程式"
- }
- }
- },
- "SettingUpdateAuto": {
- "languages": {
- "de-de": {
- "line1": "Update anford."
- },
- "en-au": {
- "line1": "Request update"
- },
- "en-gb": {
- "line1": "Request update"
- },
- "en-ie": {
- "line1": "Request update"
- },
- "en-us": {
- "line1": "Request Update",
- "textBody": "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
- },
- "es-en": {
- "line1": "Solicit. actualiz.",
- "textBody": "Solicit. actualiz."
- },
- "es-es": {
- "line1": "Solicitar actual."
- },
- "es-mx": {
- "line1": "Solicit. actualiz.",
- "textBody": "Solicit. actualiz."
- },
- "fr-ca": {
- "line1": "Demander MAJ",
- "textBody": "Demander MAJ"
- },
- "fr-fr": {
- "line1": "Demander màj"
- },
- "it-it": {
- "line1": "Rich. aggiorn."
- },
- "nl-nl": {
- "line1": "Upd. aanvragen"
- },
- "pl-pl": {
- "line1": "Zażądaj aktual."
- },
- "pt-br": {
- "line1": "Solicitar atualiz."
- },
- "pt-pt": {
- "line1": "Solicit. actualiz."
- },
- "ru-ru": {
- "line1": "Запрос на обн."
- },
- "sv-se": {
- "line1": "Begär uppdat."
- },
- "tr-tr": {
- "line1": "Güncelleme iste"
- },
- "zh-cn": {
- "line1": "请求更新"
- },
- "zh-tw": {
- "line1": "請求更新"
- }
- }
- },
- "StatusNeeded": {
- "languages": {
- "de-de": {
- "line1": "Update benötigt"
- },
- "en-au": {
- "line1": "Update needed"
- },
- "en-gb": {
- "line1": "Update needed",
- "textBody": "Update needed"
- },
- "en-ie": {
- "line1": "Update needed"
- },
- "en-us": {
- "line1": "Update Needed",
- "textBody": "Update Needed"
- },
- "es-en": {
- "line1": "Actualiz. neces.",
- "textBody": "Actualiz. neces."
- },
- "es-es": {
- "line1": "Actu. necesaria"
- },
- "es-mx": {
- "line1": "Actualiz. neces.",
- "textBody": "Actualiz. neces."
- },
- "fr-ca": {
- "line1": "Màj requise",
- "textBody": "Màj requise"
- },
- "fr-fr": {
- "line1": "Mise à jour requise"
- },
- "it-it": {
- "line1": "Necess. aggiorn."
- },
- "nl-nl": {
- "line1": "Update nodig"
- },
- "pl-pl": {
- "line1": "Potrzeba aktual."
- },
- "pt-br": {
- "line1": "Atualiz. necess."
- },
- "pt-pt": {
- "line1": "Actual. necess."
- },
- "ru-ru": {
- "line1": "Необх. обновл."
- },
- "sv-se": {
- "line1": "Uppdat. krävs"
- },
- "tr-tr": {
- "line1": "Güncellenmeli"
- },
- "zh-cn": {
- "line1": "需要进行更新"
- },
- "zh-tw": {
- "line1": "需更新"
- }
- }
- },
- "StatusPending": {
- "languages": {
- "de-de": {
- "line1": "Aktualisieren..."
- },
- "en-au": {
- "line1": "Updating..."
- },
- "en-gb": {
- "line1": "Updating...",
- "textBody": "Updating..."
- },
- "en-ie": {
- "line1": "Updating..."
- },
- "en-us": {
- "line1": "Updating...",
- "textBody": "Updating..."
- },
- "es-en": {
- "line1": "Actualizando...",
- "textBody": "Actualizando..."
- },
- "es-es": {
- "line1": "Actualizando..."
- },
- "es-mx": {
- "line1": "Actualizando...",
- "textBody": "Actualizando..."
- },
- "fr-ca": {
- "line1": "MAJ en cours...",
- "textBody": "MAJ en cours..."
- },
- "fr-fr": {
- "line1": "Màj en cours..."
- },
- "it-it": {
- "line1": "Aggiornamento"
- },
- "nl-nl": {
- "line1": "Updaten..."
- },
- "pl-pl": {
- "line1": "Aktualizowanie"
- },
- "pt-br": {
- "line1": "Atualizando..."
- },
- "pt-pt": {
- "line1": "A actualizar..."
- },
- "ru-ru": {
- "line1": "Обновление..."
- },
- "sv-se": {
- "line1": "Uppdaterar..."
- },
- "tr-tr": {
- "line1": "Güncelleniyor..."
- },
- "zh-cn": {
- "line1": "正在更新......"
- },
- "zh-tw": {
- "line1": "更新中..."
- }
- }
- },
- "StatusUpToDate": {
- "languages": {
- "de-de": {
- "line1": "Aktuelle Version"
- },
- "en-au": {
- "line1": "Up-to-date"
- },
- "en-gb": {
- "line1": "Up-to-date",
- "textBody": "Up-to-date"
- },
- "en-ie": {
- "line1": "Up-to-date"
- },
- "en-us": {
- "line1": "Up-To-Date",
- "textBody": "Up-To-Date"
- },
- "es-en": {
- "line1": "Actualizado",
- "textBody": "Actualizado"
- },
- "es-es": {
- "line1": "Actualizada"
- },
- "es-mx": {
- "line1": "Actualizado",
- "textBody": "Actualizado"
- },
- "fr-ca": {
- "line1": "Déjà à jour",
- "textBody": "Déjà à jour"
- },
- "fr-fr": {
- "line1": "Déjà à jour"
- },
- "it-it": {
- "line1": "più recente"
- },
- "nl-nl": {
- "line1": "Up-to-date"
- },
- "pl-pl": {
- "line1": "Aktualne"
- },
- "pt-br": {
- "line1": "Atualizado"
- },
- "pt-pt": {
- "line1": "Actualizado"
- },
- "ru-ru": {
- "line1": "Обновлено"
- },
- "sv-se": {
- "line1": "Uppdat. krävs ej"
- },
- "tr-tr": {
- "line1": "Güncel"
- },
- "zh-cn": {
- "line1": "最新更新"
- },
- "zh-tw": {
- "line1": "更新最新"
- }
- }
- },
- "VehicleInfo": {
- "languages": {
- "de-de": {
- "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
- "label": "Fahrzeuginformationen"
- },
- "en-au": {
- "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
- "label": "Vehicle information"
- },
- "en-gb": {
- "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
- "label": "Vehicle information",
- "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
- },
- "en-ie": {
- "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
- "label": "Vehicle information"
- },
- "en-us": {
- "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.",
- "label": "Vehicle information",
- "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
- "label": "Información del vehículo",
- "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
- },
- "es-es": {
- "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
- "label": "Información del vehículo"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
- "label": "Información del vehículo",
- "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
- },
- "fr-ca": {
- "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.",
- "label": "Renseignements du véhicule",
- "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
- },
- "fr-fr": {
- "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
- "label": "Renseignements du véhicule"
- },
- "it-it": {
- "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
- "label": "Informazioni sul veicolo"
- },
- "nl-nl": {
- "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
- "label": "Voertuiginformatie"
- },
- "pl-pl": {
- "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
- "label": "Informacje o pojeździe"
- },
- "pt-br": {
- "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
- "label": "Informações sobre o veículo"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
- "label": "Informações do veículo"
- },
- "ru-ru": {
- "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
- "label": "Информация об автомобиле"
- },
- "sv-se": {
- "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
- "label": "Fordonsinformation"
- },
- "tr-tr": {
- "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
- "label": "Araç bilgisi"
- },
- "zh-cn": {
- "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
- "label": "车辆信息"
- },
- "zh-tw": {
- "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
- "label": "車輛資訊"
- }
- }
- }
- }
- },
- "app_policies": {
- "default": {
- "keep_context": false,
- "steal_focus": false,
- "priority": "NONE",
- "default_hmi": "NONE",
- "groups": ["Base-4"],
- "RequestType": [],
- "RequestSubType": []
- },
- "device": {
- "keep_context": false,
- "steal_focus": false,
- "priority": "NONE",
- "default_hmi": "NONE",
- "groups": ["DataConsent-2"]
- },
- "pre_DataConsent": {
- "keep_context": false,
- "steal_focus": false,
- "priority": "NONE",
- "default_hmi": "NONE",
- "groups": ["BaseBeforeDataConsent"]
- }
- }
- }
-}
-
+{
+ "policy_table": {
+ "module_config": {
+ "preloaded_pt": true,
+ "exchange_after_x_ignition_cycles": 100,
+ "exchange_after_x_kilometers": 1800,
+ "exchange_after_x_days": 30,
+ "timeout_after_x_seconds": 60,
+ "seconds_between_retries": [
+ 1,
+ 5,
+ 25,
+ 125,
+ 625
+ ],
+ "endpoints": {
+ "0x07": {
+ "default": [
+ "http://x.x.x.x:3000/api/1/policies/proprietary"
+ ]
+ },
+ "0x04": {
+ "default": [
+ "http://x.x.x.x:3000/api/1/softwareUpdate"
+ ]
+ },
+ "queryAppsUrl": {
+ "default": [
+ "http://sdl.shaid.server"
+ ]
+ },
+ "lock_screen_icon_url": {
+ "default": [
+ "http://i.imgur.com/TgkvOIZ.png"
+ ]
+ },
+ "custom_vehicle_data_mapping_url": {
+ "default": [
+ "http://x.x.x.x:3000/api/1/vehicleDataMap"
+ ]
+ }
+ },
+ "endpoint_properties": {
+ "custom_vehicle_data_mapping_url": {
+ "version": "0.0.0"
+ }
+ },
+ "notifications_per_minute_by_priority": {
+ "EMERGENCY": 60,
+ "NAVIGATION": 15,
+ "PROJECTION": 15,
+ "VOICECOM": 20,
+ "COMMUNICATION": 6,
+ "NORMAL": 4,
+ "NONE": 0
+ },
+ "lock_screen_dismissal_enabled": true
+ },
+ "functional_groupings": {
+ "Base-4": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "AddSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ShowAppMenu": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "Alert": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GenericResponse": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GetSystemCapability": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ListFiles": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
+ },
+ "OnButtonPress": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
+ },
+ "OnCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHashChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSystemCapabilityUpdated": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PerformInteraction": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PutFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "SetAppIcon": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
+ },
+ "Show": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "Slider": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "Speak": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "CancelInteraction": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "CloseApplication": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
+ }
+ }
+ },
+ "Location-1": {
+ "user_consent_prompt": "Location",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ }
+ }
+ },
+ "Notifications": {
+ "user_consent_prompt": "Notifications",
+ "rpcs": {
+ "Alert": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ }
+ }
+ },
+ "Notifications-RC": {
+ "rpcs": {
+ "OnHMIStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ }
+ }
+ },
+ "DrivingCharacteristics-3": {
+ "user_consent_prompt": "DrivingCharacteristics",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "electronicParkBrakeStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "electronicParkBrakeStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "electronicParkBrakeStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "electronicParkBrakeStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ }
+ }
+ },
+ "VehicleInfo-3": {
+ "user_consent_prompt": "VehicleInfo",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineOilLife",
+ "engineTorque",
+ "externalTemperature",
+ "turnSignal",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "fuelRange",
+ "cloudAppVehicleID",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineOilLife",
+ "engineTorque",
+ "externalTemperature",
+ "turnSignal",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "fuelRange",
+ "cloudAppVehicleID",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineOilLife",
+ "engineTorque",
+ "externalTemperature",
+ "turnSignal",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "fuelRange",
+ "cloudAppVehicleID",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineOilLife",
+ "engineTorque",
+ "externalTemperature",
+ "turnSignal",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "fuelRange",
+ "cloudAppVehicleID",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ }
+ }
+ },
+ "PropriataryData-1": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GetDTCs": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ReadDID": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "PropriataryData-2": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GetDTCs": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ReadDID": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "ProprietaryData-3": {
+ "rpcs": {
+ "GetDTCs": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ReadDID": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "CloudAppStore": {
+ "rpcs": {
+ "SetCloudAppProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GetCloudAppProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "CloudApp": {
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "cloudAppVehicleID"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "cloudAppVehicleID"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "cloudAppVehicleID"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "cloudAppVehicleID"
+ ]
+ }
+ }
+ },
+ "AppServiceProvider": {
+ "rpcs": {
+ "PublishAppService": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "UnpublishAppService": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "GetAppServiceData": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "OnAppServiceData": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "PerformAppServiceInteraction": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ }
+ }
+ },
+ "AppServiceConsumer": {
+ "rpcs": {
+ "GetFile": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "GetAppServiceData": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "OnAppServiceData": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ },
+ "PerformAppServiceInteraction": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND",
+ "NONE"
+ ]
+ }
+ }
+ },
+ "RemoteControl": {
+ "rpcs": {
+ "ButtonPress": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GetInteriorVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SetInteriorVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnInteriorVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnRCStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ReleaseInteriorVehicleDataModule": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "GetInteriorVehicleDataConsent": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ }
+ }
+ },
+ "Emergency-1": {
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ }
+ }
+ },
+ "Navigation-1": {
+ "rpcs": {
+ "AlertManeuver": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ShowConstantTBT": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "UpdateTurnList": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "Base-6": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "AddSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ShowAppMenu": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "Alert": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GenericResponse": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ListFiles": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnButtonPress": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnCommand": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnTBTClientState": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PerformInteraction": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PutFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "SetAppIcon": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "Show": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "Slider": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "Speak": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "OnKeyboardInputOnlyGroup": {
+ "rpcs": {
+ "OnKeyboardInput": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ }
+ }
+ },
+ "OnTouchEventOnlyGroup": {
+ "rpcs": {
+ "OnTouchEvent": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ }
+ }
+ },
+ "DiagnosticMessageOnly": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "DataConsent-2": {
+ "user_consent_prompt": "DataConsent",
+ "rpcs": null
+ },
+ "BaseBeforeDataConsent": {
+ "rpcs": {
+ "ChangeRegistration": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "DeleteFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ListFiles": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHashChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "PutFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetAppIcon": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ }
+ }
+ },
+ "SendLocation": {
+ "rpcs": {
+ "SendLocation": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "WayPoints": {
+ "rpcs": {
+ "GetWayPoints": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SubscribeWayPoints": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "UnsubscribeWayPoints": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnWayPointChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "BackgroundAPT": {
+ "rpcs": {
+ "EndAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ }
+ }
+ },
+ "HapticGroup": {
+ "rpcs": {
+ "OnTouchEvent": {
+ "hmi_levels": ["FULL"]
+ },
+ "SendHapticData": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ }
+ }
+ },
+ "WidgetSupport": {
+ "rpcs": {
+ "CreateWindow": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteWindow": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "Show": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnSystemCapabilityUpdated": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ }
+ }
+ }
+ },
+ "consumer_friendly_messages": {
+ "version": "001.001.021",
+ "messages": {
+ "AppPermissions": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
+ "line1": "Zugriffsanfrage(n)",
+ "line2": "erlauben?"
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.",
+ "line1": "Grant Requested",
+ "line2": "Permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "es-en": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
+ "line1": "¿Conceder permisos",
+ "line2": "solicitados?"
+ },
+ "es-mx": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. \n\nSi presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)",
+ "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)"
+ },
+ "it-it": {
+ "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
+ "line1": "Concedi autorizzaz.",
+ "line2": "richiesta(e)?"
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
+ "line1": "Aangevraagde",
+ "line2": "permissie(s) verlenen?"
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
+ "line1": "Udzielić żądanych",
+ "line2": "pozwoleń?"
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
+ "line1": "Conceder permissão",
+ "line2": "solicitada?"
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
+ "line1": "Conceder permiss.",
+ "line2": "solicitada(s)?"
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
+ "line1": "Предост. заправш.",
+ "line2": "разрешения?"
+ },
+ "sv-se": {
+ "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
+ "line1": "Vill du ge",
+ "line2": "tillstånd?"
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
+ "line1": "İstenen izinler",
+ "line2": "verilsin mi?"
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
+ "line1": "是否允许请求的",
+ "line2": "权限?"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
+ "line1": "允許",
+ "line2": "授權請求?"
+ }
+ }
+ },
+ "AppPermissionsHelp": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it": {
+ "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se": {
+ "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked": {
+ "languages": {
+ "de-de": {
+ "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it": {
+ "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl": {
+ "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl": {
+ "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br": {
+ "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt": {
+ "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru": {
+ "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se": {
+ "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr": {
+ "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn": {
+ "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw": {
+ "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
+ "line1": "nicht autorisiert"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized",
+ "textBody": "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "Not Authorized",
+ "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
+ "line1": "No autorizada"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée",
+ "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
+ "line1": "non autorizzata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
+ "line1": "niet geautoriseerd"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
+ "line1": "brak autoryzacji"
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
+ "line1": "não autorizado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
+ "line1": "não autorizada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
+ "line1": "не авторизировано"
+ },
+ "sv-se": {
+ "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
+ "line1": "är ej godkänd"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
+ "line1": "için izin yok"
+ },
+ "zh-cn": {
+ "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
+ "line1": "未得到授权"
+ },
+ "zh-tw": {
+ "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
+ "line1": "無授權"
+ }
+ }
+ },
+ "AppUnsupported": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
+ "line1": "nicht unterstützt"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported",
+ "textBody": "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "Not Supported",
+ "textBody": "Your version of %appName% is not supported by SYNC."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "No compatible"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible",
+ "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è supportata dal SYNC.",
+ "line1": "non supportata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
+ "line1": "niet ondersteund"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
+ "line1": "aplikacja nie obsług."
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
+ "line1": "não suportado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
+ "line1": "não suportada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не поддерживается SYNC.",
+ "line1": "не поддерживается"
+ },
+ "sv-se": {
+ "tts": "SYNC har inte stöd för den här versionen av %appName%.",
+ "line1": "stöds ej"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
+ "line1": "desteklenmiyor"
+ },
+ "zh-cn": {
+ "tts": "SYNC不支持此版本的%appName%。",
+ "line1": "不受支持"
+ },
+ "zh-tw": {
+ "tts": "SYNC 不支援此版本的%appName% 。",
+ "line1": "不支援"
+ }
+ }
+ },
+ "DataConsent": {
+ "languages": {
+ "en-gb": {
+ "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. \r\n\r\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "en-us": {
+ "line1": "Enable Mobile Apps",
+ "line2": "on SYNC? (Uses Data)",
+ "textBody": "Would you like to enable Mobile Apps on SYNC?\r\n\r\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\r\n\r\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "es-mx": {
+ "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. \n\nLas actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. \n\nPresione Sí para permitir y No para denegar."
+ },
+ "fr-ca": {
+ "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements.\r\n\r\nVeuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ }
+ }
+ },
+ "DataConsentHelp": {
+ "languages": {
+ "en-us": {
+ "textBody": "By enabling mobile apps, you consent to allowing SYNC to communicate with Ford at least once per month using your mobile device’s data plan. Disabling will stop all data usage, but you will not be able to use mobile apps on SYNC. See your Owner Guide for more information."
+ },
+ "es-mx": {
+ "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
+ },
+ "fr-ca": {
+ "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
+ }
+ }
+ },
+ "DisableApps": {
+ "languages": {
+ "de-de": {
+ "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
+ "line1": "Auto-Update",
+ "line2": "und Mobile Apps deaktivieren"
+ },
+ "en-au": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-gb": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-us": {
+ "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
+ "line1": "Disable Auto-Updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel."
+ },
+ "es-en": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es": {
+ "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
+ "line1": "¿Desact. actual. auto",
+ "line2": "y apl. móviles?"
+ },
+ "es-mx": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "fr-ca": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?",
+ "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?"
+ },
+ "it-it": {
+ "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
+ "line1": "Disabilitare agg. aut.",
+ "line2": "e app mobili?"
+ },
+ "nl-nl": {
+ "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
+ "line1": "Auto-updates en mob.",
+ "line2": "apps uitschakelen?"
+ },
+ "pl-pl": {
+ "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
+ "line1": "Wył. automat. aktual.",
+ "line2": "i aplikacje mobilne?"
+ },
+ "pt-br": {
+ "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
+ "line1": "Desativar atualizações",
+ "line2": "autom. e aplicativos?"
+ },
+ "pt-pt": {
+ "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
+ "line1": "Desact. actual. autom.",
+ "line2": "e aplicações móveis?"
+ },
+ "ru-ru": {
+ "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
+ "line1": "Откл. автообновления",
+ "line2": "и мобил. прилож.?"
+ },
+ "sv-se": {
+ "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
+ "line1": "Avaktiverar autouppdat.",
+ "line2": "och mobilappar?"
+ },
+ "tr-tr": {
+ "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
+ "line1": "Oto. güncelleme ve",
+ "line2": "mobil uygul. kapat?"
+ },
+ "zh-cn": {
+ "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
+ "line1": "是否禁用自动更新和",
+ "line2": "移动应用程序?"
+ },
+ "zh-tw": {
+ "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
+ "line1": "停用自動更新",
+ "line2": "和行動應用程式?"
+ }
+ }
+ },
+ "DrivingCharacteristics": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
+ "label": "Fahreigenschaften"
+ },
+ "en-au": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-gb": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-us": {
+ "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.",
+ "label": "Driving Characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
+ "label": "Características de conducción"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite",
+ "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
+ "label": "Caratteristiche di guida"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
+ "label": "Rijkenmerken"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
+ "label": "Informacje dotyczące stylu jazdy"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
+ "label": "Características de condução"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
+ "label": "Características de condução"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
+ "label": "Характеристики движения"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
+ "label": "Köregenskaper"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
+ "label": "Sürüş karakteristikleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
+ "label": "行驶特性"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
+ "label": "駕駛特性"
+ }
+ }
+ },
+ "Location": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
+ "label": "GPS und Geschwindigkeit"
+ },
+ "en-au": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-gb": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "en-ie": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-us": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse",
+ "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
+ "label": "GPS e velocità"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
+ "label": "Gps en snelheid"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
+ "label": "GPS i prędkość"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
+ "label": "GPS и скорость"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
+ "label": "GPS och hastighet"
+ },
+ "tr-tr": {
+ "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
+ "label": "GPS ve hız"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
+ "label": "GPS 和车速"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取車輛的GPS和速度。",
+ "label": "GPS和車速"
+ }
+ }
+ },
+ "LockScreenDismissalWarning": {
+ "languages": {
+ "en-us": {
+ "textBody": "Swipe down to dismiss, acknowledging that you are not the driver"
+ }
+ }
+ },
+ "Notifications": {
+ "languages": {
+ "de-de": {
+ "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
+ "label": "Push-Benachrichtigungen"
+ },
+ "en-au": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-gb": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "en-ie": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-us": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
+ "label": "Notificaciones push"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "fr-ca": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications instantanées",
+ "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications push"
+ },
+ "it-it": {
+ "tts": "Un'app può inviare notifiche se eseguita in background.",
+ "label": "Notifiche push"
+ },
+ "nl-nl": {
+ "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
+ "label": "Push-meldingen"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
+ "label": "Powiadomienia Push"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
+ "label": "Notificações Push"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
+ "label": "Notificações push"
+ },
+ "ru-ru": {
+ "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
+ "label": "Оповещения о пересылке"
+ },
+ "sv-se": {
+ "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
+ "label": "Push-notiser"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
+ "label": "Anlık bildirimleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序在后台运行时可推送通知。",
+ "label": "推送通知"
+ },
+ "zh-tw": {
+ "tts": "車輛行進時,應用程式可在背景中傳送通知。",
+ "label": "傳送通知"
+ }
+ }
+ },
+ "SettingDisableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Updates deakt."
+ },
+ "en-au": {
+ "line1": "Disable updates"
+ },
+ "en-gb": {
+ "line1": "Disable updates"
+ },
+ "en-ie": {
+ "line1": "Disable updates"
+ },
+ "en-us": {
+ "line1": "Disable Updates",
+ "textBody": "Disable Updates"
+ },
+ "es-en": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "es-es": {
+ "line1": "Desact. actual."
+ },
+ "es-mx": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "fr-ca": {
+ "line1": "Désactiver MAJ",
+ "textBody": "Désactiver MAJ"
+ },
+ "fr-fr": {
+ "line1": "Désactiver màj"
+ },
+ "it-it": {
+ "line1": "Disabilita agg."
+ },
+ "nl-nl": {
+ "line1": "Upd. uitschak."
+ },
+ "pl-pl": {
+ "line1": "Wyłącz aktual."
+ },
+ "pt-br": {
+ "line1": "Desat. atualiz."
+ },
+ "pt-pt": {
+ "line1": "Desact. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Откл. обновл."
+ },
+ "sv-se": {
+ "line1": "Inaktivera uppd."
+ },
+ "tr-tr": {
+ "line1": "Güncell. Kapat"
+ },
+ "zh-cn": {
+ "line1": "禁用更新"
+ },
+ "zh-tw": {
+ "line1": "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Apps aktivieren"
+ },
+ "en-au": {
+ "line1": "Enable Apps"
+ },
+ "en-gb": {
+ "line1": "Enable Apps"
+ },
+ "en-ie": {
+ "line1": "Enable Apps"
+ },
+ "en-us": {
+ "line1": "Enable Apps"
+ },
+ "es-en": {
+ "line1": "Hab. aplic."
+ },
+ "es-es": {
+ "line1": "Activar apl."
+ },
+ "es-mx": {
+ "line1": "Hab. aplic."
+ },
+ "fr-ca": {
+ "line1": "Activer app.",
+ "textBody": "Activer app."
+ },
+ "fr-fr": {
+ "line1": "Activer app."
+ },
+ "it-it": {
+ "line1": "Abilita app"
+ },
+ "nl-nl": {
+ "line1": "Apps inschak."
+ },
+ "pl-pl": {
+ "line1": "Włącz aplikacje"
+ },
+ "pt-br": {
+ "line1": "Ativar aplic."
+ },
+ "pt-pt": {
+ "line1": "Activar actualiz."
+ },
+ "ru-ru": {
+ "line1": "Вкл. прилож."
+ },
+ "sv-se": {
+ "line1": "Aktivera appar"
+ },
+ "tr-tr": {
+ "line1": "Uygulamaları aç"
+ },
+ "zh-cn": {
+ "line1": "启用应用程序"
+ },
+ "zh-tw": {
+ "line1": "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto": {
+ "languages": {
+ "de-de": {
+ "line1": "Update anford."
+ },
+ "en-au": {
+ "line1": "Request update"
+ },
+ "en-gb": {
+ "line1": "Request update"
+ },
+ "en-ie": {
+ "line1": "Request update"
+ },
+ "en-us": {
+ "line1": "Request Update",
+ "textBody": "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
+ },
+ "es-en": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "es-es": {
+ "line1": "Solicitar actual."
+ },
+ "es-mx": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "fr-ca": {
+ "line1": "Demander MAJ",
+ "textBody": "Demander MAJ"
+ },
+ "fr-fr": {
+ "line1": "Demander màj"
+ },
+ "it-it": {
+ "line1": "Rich. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Upd. aanvragen"
+ },
+ "pl-pl": {
+ "line1": "Zażądaj aktual."
+ },
+ "pt-br": {
+ "line1": "Solicitar atualiz."
+ },
+ "pt-pt": {
+ "line1": "Solicit. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Запрос на обн."
+ },
+ "sv-se": {
+ "line1": "Begär uppdat."
+ },
+ "tr-tr": {
+ "line1": "Güncelleme iste"
+ },
+ "zh-cn": {
+ "line1": "请求更新"
+ },
+ "zh-tw": {
+ "line1": "請求更新"
+ }
+ }
+ },
+ "StatusNeeded": {
+ "languages": {
+ "de-de": {
+ "line1": "Update benötigt"
+ },
+ "en-au": {
+ "line1": "Update needed"
+ },
+ "en-gb": {
+ "line1": "Update needed",
+ "textBody": "Update needed"
+ },
+ "en-ie": {
+ "line1": "Update needed"
+ },
+ "en-us": {
+ "line1": "Update Needed",
+ "textBody": "Update Needed"
+ },
+ "es-en": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "es-es": {
+ "line1": "Actu. necesaria"
+ },
+ "es-mx": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "fr-ca": {
+ "line1": "Màj requise",
+ "textBody": "Màj requise"
+ },
+ "fr-fr": {
+ "line1": "Mise à jour requise"
+ },
+ "it-it": {
+ "line1": "Necess. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Update nodig"
+ },
+ "pl-pl": {
+ "line1": "Potrzeba aktual."
+ },
+ "pt-br": {
+ "line1": "Atualiz. necess."
+ },
+ "pt-pt": {
+ "line1": "Actual. necess."
+ },
+ "ru-ru": {
+ "line1": "Необх. обновл."
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs"
+ },
+ "tr-tr": {
+ "line1": "Güncellenmeli"
+ },
+ "zh-cn": {
+ "line1": "需要进行更新"
+ },
+ "zh-tw": {
+ "line1": "需更新"
+ }
+ }
+ },
+ "StatusPending": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktualisieren..."
+ },
+ "en-au": {
+ "line1": "Updating..."
+ },
+ "en-gb": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "en-ie": {
+ "line1": "Updating..."
+ },
+ "en-us": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "es-en": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "es-es": {
+ "line1": "Actualizando..."
+ },
+ "es-mx": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "fr-ca": {
+ "line1": "MAJ en cours...",
+ "textBody": "MAJ en cours..."
+ },
+ "fr-fr": {
+ "line1": "Màj en cours..."
+ },
+ "it-it": {
+ "line1": "Aggiornamento"
+ },
+ "nl-nl": {
+ "line1": "Updaten..."
+ },
+ "pl-pl": {
+ "line1": "Aktualizowanie"
+ },
+ "pt-br": {
+ "line1": "Atualizando..."
+ },
+ "pt-pt": {
+ "line1": "A actualizar..."
+ },
+ "ru-ru": {
+ "line1": "Обновление..."
+ },
+ "sv-se": {
+ "line1": "Uppdaterar..."
+ },
+ "tr-tr": {
+ "line1": "Güncelleniyor..."
+ },
+ "zh-cn": {
+ "line1": "正在更新......"
+ },
+ "zh-tw": {
+ "line1": "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktuelle Version"
+ },
+ "en-au": {
+ "line1": "Up-to-date"
+ },
+ "en-gb": {
+ "line1": "Up-to-date",
+ "textBody": "Up-to-date"
+ },
+ "en-ie": {
+ "line1": "Up-to-date"
+ },
+ "en-us": {
+ "line1": "Up-To-Date",
+ "textBody": "Up-To-Date"
+ },
+ "es-en": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "es-es": {
+ "line1": "Actualizada"
+ },
+ "es-mx": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "fr-ca": {
+ "line1": "Déjà à jour",
+ "textBody": "Déjà à jour"
+ },
+ "fr-fr": {
+ "line1": "Déjà à jour"
+ },
+ "it-it": {
+ "line1": "più recente"
+ },
+ "nl-nl": {
+ "line1": "Up-to-date"
+ },
+ "pl-pl": {
+ "line1": "Aktualne"
+ },
+ "pt-br": {
+ "line1": "Atualizado"
+ },
+ "pt-pt": {
+ "line1": "Actualizado"
+ },
+ "ru-ru": {
+ "line1": "Обновлено"
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs ej"
+ },
+ "tr-tr": {
+ "line1": "Güncel"
+ },
+ "zh-cn": {
+ "line1": "最新更新"
+ },
+ "zh-tw": {
+ "line1": "更新最新"
+ }
+ }
+ },
+ "VehicleInfo": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
+ "label": "Fahrzeuginformationen"
+ },
+ "en-au": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-gb": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
+ },
+ "en-ie": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-us": {
+ "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.",
+ "label": "Renseignements du véhicule",
+ "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
+ "label": "Renseignements du véhicule"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
+ "label": "Informazioni sul veicolo"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
+ "label": "Voertuiginformatie"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
+ "label": "Informacje o pojeździe"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
+ "label": "Informações sobre o veículo"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
+ "label": "Informações do veículo"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
+ "label": "Информация об автомобиле"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
+ "label": "Fordonsinformation"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
+ "label": "Araç bilgisi"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
+ "label": "车辆信息"
+ },
+ "zh-tw": {
+ "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
+ "label": "車輛資訊"
+ }
+ }
+ }
+ }
+ },
+ "app_policies": {
+ "default": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": [
+ "Base-4"
+ ],
+ "RequestType": [],
+ "RequestSubType": []
+ },
+ "device": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": [
+ "DataConsent-2"
+ ]
+ },
+ "pre_DataConsent": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": [
+ "BaseBeforeDataConsent"
+ ]
+ }
+ },
+ "vehicle_data": {
+ "schema_version": "0.0.0",
+ "schema_items": [
+ {
+ "name": "gps",
+ "params": [
+ {
+ "name": "longitudeDegrees",
+ "key": "OEM_REF_LONG_DEG",
+ "type": "Float",
+ "mandatory": true,
+ "minvalue": -180,
+ "maxvalue": 180
+ },
+ {
+ "name": "latitudeDegrees",
+ "key": "OEM_REF_LAT_DEG",
+ "type": "Float",
+ "mandatory": true,
+ "minvalue": -90,
+ "maxvalue": 90
+ },
+ {
+ "name": "utcYear",
+ "key": "OEM_REF_UTC_YEAR",
+ "type": "Integer",
+ "mandatory": false,
+ "minvalue": 2010,
+ "maxvalue": 2100,
+ "since": "5.0"
+ },
+ {
+ "name": "utcYear",
+ "key": "OEM_REF_UTC_YEAR",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": 2010,
+ "maxvalue": 2100,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "utcMonth",
+ "key": "OEM_REF_UTC_MONTH",
+ "type": "Integer",
+ "mandatory": false,
+ "minvalue": 1,
+ "maxvalue": 12,
+ "since": "5.0"
+ },
+ {
+ "name": "utcMonth",
+ "key": "OEM_REF_UTC_MONTH",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": 1,
+ "maxvalue": 12,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "utcDay",
+ "key": "OEM_REF_UTC_DAY",
+ "type": "Integer",
+ "mandatory": false,
+ "minvalue": 1,
+ "maxvalue": 31,
+ "since": "5.0"
+ },
+ {
+ "name": "utcDay",
+ "key": "OEM_REF_UTC_DAY",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": 1,
+ "maxvalue": 31,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "utcHours",
+ "key": "OEM_REF_UTC_HOURS",
+ "type": "Integer",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 23,
+ "since": "5.0"
+ },
+ {
+ "name": "utcHours",
+ "key": "OEM_REF_UTC_HOURS",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 23,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "utcMinutes",
+ "key": "OEM_REF_UTC_MIN",
+ "type": "Integer",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 59,
+ "since": "5.0"
+ },
+ {
+ "name": "utcMinutes",
+ "key": "OEM_REF_UTC_MIN",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 59,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "utcSeconds",
+ "key": "OEM_REF_UTC_SEC",
+ "type": "Integer",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 59,
+ "since": "5.0"
+ },
+ {
+ "name": "utcSeconds",
+ "key": "OEM_REF_UTC_SEC",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 59,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "compassDirection",
+ "key": "OEM_REF_COM_DIR",
+ "type": "CompassDirection",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "compassDirection",
+ "key": "OEM_REF_COM_DIR",
+ "type": "CompassDirection",
+ "mandatory": true,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "pdop",
+ "key": "OEM_REF_PDOP",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 1000,
+ "since": "5.0"
+ },
+ {
+ "name": "pdop",
+ "key": "OEM_REF_PDOP",
+ "type": "Float",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 10,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "hdop",
+ "key": "OEM_REF_HDOP",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 1000,
+ "since": "5.0"
+ },
+ {
+ "name": "hdop",
+ "key": "OEM_REF_HDOP",
+ "type": "Float",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 10,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "vdop",
+ "key": "OEM_REF_VDOP",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 1000,
+ "since": "5.0"
+ },
+ {
+ "name": "vdop",
+ "key": "OEM_REF_VDOP",
+ "type": "Float",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 10,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "actual",
+ "key": "OEM_REF_ACT",
+ "type": "Boolean",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "actual",
+ "key": "OEM_REF_ACT",
+ "type": "Boolean",
+ "mandatory": true,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "satellites",
+ "key": "OEM_REF_SAT",
+ "type": "Integer",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 31,
+ "since": "5.0"
+ },
+ {
+ "name": "satellites",
+ "key": "OEM_REF_SAT",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 31,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "dimension",
+ "key": "OEM_REF_DIM",
+ "type": "Dimension",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "dimension",
+ "key": "OEM_REF_DIM",
+ "type": "Dimension",
+ "mandatory": true,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "altitude",
+ "key": "OEM_REF_ALT",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": -10000,
+ "maxvalue": 10000,
+ "since": "5.0"
+ },
+ {
+ "name": "altitude",
+ "key": "OEM_REF_ALT",
+ "type": "Float",
+ "mandatory": true,
+ "minvalue": -10000,
+ "maxvalue": 10000,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "heading",
+ "key": "OEM_REF_HEAD",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 359.99,
+ "since": "5.0"
+ },
+ {
+ "name": "heading",
+ "key": "OEM_REF_HEAD",
+ "type": "Float",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 359.99,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "speed",
+ "key": "OEM_REF_GPS_SPEED",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 500,
+ "since": "5.0"
+ },
+ {
+ "name": "speed",
+ "key": "OEM_REF_GPS_SPEED",
+ "type": "Float",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 500,
+ "since": "2.0",
+ "until": "5.0"
+ },
+ {
+ "name": "shifted",
+ "key": "OEM_REF_SHIFT",
+ "type": "Boolean",
+ "mandatory": false,
+ "since": "6.0"
+ }
+ ],
+ "key": "OEM_REF_GPS",
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "speed",
+ "key": "OEM_REF_SPEED",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 700
+ },
+ {
+ "name": "rpm",
+ "key": "OEM_REF_RPM",
+ "type": "Integer",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 20000
+ },
+ {
+ "name": "fuelLevel",
+ "key": "OEM_REF_FUEL_LEV",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": -6,
+ "maxvalue": 106
+ },
+ {
+ "name": "fuelLevel_State",
+ "key": "OEM_REF_FUEL_LEV_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": false
+ },
+ {
+ "name": "instantFuelConsumption",
+ "key": "OEM_REF_INS_FUEL_CON",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 25575
+ },
+ {
+ "name": "fuelRange",
+ "params": [
+ {
+ "name": "type",
+ "key": "OEM_REF_FUEL_RAN_TYPE",
+ "type": "FuelType",
+ "mandatory": false
+ },
+ {
+ "name": "range",
+ "key": "OEM_REF_FUEL_RAN_RANG",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 10000
+ }
+ ],
+ "key": "OEM_REF_FUEL_RAN",
+ "array": true,
+ "type": "Struct",
+ "mandatory": false,
+ "minsize": 0,
+ "maxsize": 100,
+ "since": "5.0"
+ },
+ {
+ "name": "externalTemperature",
+ "key": "OEM_REF_EXT_TEMP",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": -40,
+ "maxvalue": 100
+ },
+ {
+ "name": "turnSignal",
+ "key": "OEM_REF_TURN_SIGN",
+ "type": "TurnSignal",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "vin",
+ "key": "OEM_REF_VIN",
+ "type": "String",
+ "mandatory": false,
+ "maxlength": 17,
+ "since": "5.0"
+ },
+ {
+ "name": "prndl",
+ "key": "OEM_REF_PRNDL",
+ "type": "PRNDL",
+ "mandatory": false
+ },
+ {
+ "name": "tirePressure",
+ "params": [
+ {
+ "name": "pressureTelltale",
+ "key": "OEM_REF_PRES_TEL",
+ "type": "WarningLightStatus",
+ "mandatory": true
+ },
+ {
+ "name": "leftFront",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_LEFT_FR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_LEFT_FR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_LEFT_FR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_LEFT_FR",
+ "type": "Struct",
+ "mandatory": true
+ },
+ {
+ "name": "rightFront",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_RIGHT_FR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_RIGHT_FR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_RIGHT_FR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_RIGHT_FR",
+ "type": "Struct",
+ "mandatory": true
+ },
+ {
+ "name": "leftRear",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_LEFT_REAR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_LEFT_REAR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_LEFT_REAR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_LEFT_REAR",
+ "type": "Struct",
+ "mandatory": true
+ },
+ {
+ "name": "rightRear",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_RIGHT_REAR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_RIGHT_REAR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_RIGHT_REAR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_RIGHT_REAR",
+ "type": "Struct",
+ "mandatory": true
+ },
+ {
+ "name": "innerLeftRear",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_IN_LEFT_REAR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_IN_LEFT_REAR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_IN_LEFT_REAR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_IN_LEFT_REAR",
+ "type": "Struct",
+ "mandatory": true
+ },
+ {
+ "name": "innerRightRear",
+ "params": [
+ {
+ "name": "status",
+ "key": "OEM_REF_IN_RIGHT_REAR_ST",
+ "type": "ComponentVolumeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "tpms",
+ "key": "OEM_REF_IN_RIGHT_REAR_TMPS",
+ "type": "TPMS",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "pressure",
+ "key": "OEM_REF_IN_RIGHT_REAR_PRES",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 2000,
+ "since": "5.0"
+ }
+ ],
+ "key": "OEM_REF_IN_RIGHT_REAR",
+ "type": "Struct",
+ "mandatory": true
+ }
+ ],
+ "key": "OEM_REF_TIRE_PRES",
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "odometer",
+ "key": "OEM_REF_ODOM",
+ "type": "Integer",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 17000000
+ },
+ {
+ "name": "beltStatus",
+ "params": [
+ {
+ "name": "driverBeltDeployed",
+ "key": "OEM_REF_DR_BELT_DEP",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "passengerBeltDeployed",
+ "key": "OEM_REF_PAS_BELT_DEP",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "passengerBuckleBelted",
+ "key": "OEM_REF_PAS_BUCK_BELT",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "driverBuckleBelted",
+ "key": "OEM_REF_DR_BUCK_BELT",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "leftRow2BuckleBelted",
+ "key": "OEM_REF_LEFT_R2_BUCK_BELT",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "passengerChildDetected",
+ "key": "OEM_REF_PASS_CH_DET",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "rightRow2BuckleBelted",
+ "key": "OEM_REF_RIGHT_R2_BUCK_BELT",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "middleRow2BuckleBelted",
+ "key": "OEM_REF_MID_R2_BUCK_BELT",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "middleRow3BuckleBelted",
+ "key": "OEM_REF_MID_R3_BUCK_BELT",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "leftRow3BuckleBelted",
+ "key": "OEM_REF_LEFT_R3_BUCK_BELT",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "rightRow3BuckleBelted",
+ "key": "OEM_REF_RIGHT_R3_BUCK_BELT",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "leftRearInflatableBelted",
+ "key": "OEM_REF_LEFT_REAR_INF_BELT",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "rightRearInflatableBelted",
+ "key": "OEM_REF_RIGHT_REAR_INF_BELT",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "middleRow1BeltDeployed",
+ "key": "OEM_REF_MID_R1_BELT_DEP",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "middleRow1BuckleBelted",
+ "key": "OEM_REF_MID_R1_BUCK_BELT",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ }
+ ],
+ "key": "OEM_REF_BELT_ST",
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "bodyInformation",
+ "params": [
+ {
+ "name": "parkBrakeActive",
+ "key": "OEM_REF_PARK_BR_ACT",
+ "type": "Boolean",
+ "mandatory": true
+ },
+ {
+ "name": "ignitionStableStatus",
+ "key": "OEM_REF_IGN_STAB_ST",
+ "type": "IgnitionStableStatus",
+ "mandatory": true
+ },
+ {
+ "name": "ignitionStatus",
+ "key": "OEM_REF_IGN_ST",
+ "type": "IgnitionStatus",
+ "mandatory": true
+ },
+ {
+ "name": "driverDoorAjar",
+ "key": "OEM_REF_DR_DOOR_AJ",
+ "type": "Boolean",
+ "mandatory": false
+ },
+ {
+ "name": "passengerDoorAjar",
+ "key": "OEM_REF_PAS_DOOR_AJ",
+ "type": "Boolean",
+ "mandatory": false
+ },
+ {
+ "name": "rearLeftDoorAjar",
+ "key": "OEM_REF_REAR_LEFT_DOOR_AJ",
+ "type": "Boolean",
+ "mandatory": false
+ },
+ {
+ "name": "rearRightDoorAjar",
+ "key": "OEM_REF_REAR_RIGHT_DOOR_AJ",
+ "type": "Boolean",
+ "mandatory": false
+ }
+ ],
+ "key": "OEM_REF_BODY_INF",
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "deviceStatus",
+ "params": [
+ {
+ "name": "voiceRecOn",
+ "key": "OEM_REF_VOICE_REC_ON",
+ "type": "Boolean",
+ "mandatory": true
+ },
+ {
+ "name": "btIconOn",
+ "key": "OEM_REF_BT_ICO_ON",
+ "type": "Boolean",
+ "mandatory": true
+ },
+ {
+ "name": "callActive",
+ "key": "OEM_REF_CAL_ACT",
+ "type": "Boolean",
+ "mandatory": true
+ },
+ {
+ "name": "phoneRoaming",
+ "key": "OEM_REF_PH_ROAM",
+ "type": "Boolean",
+ "mandatory": true
+ },
+ {
+ "name": "textMsgAvailable",
+ "key": "OEM_REF_TEXT_MSG_AV",
+ "type": "Boolean",
+ "mandatory": true
+ },
+ {
+ "name": "battLevelStatus",
+ "key": "OEM_REF_BAT_LEV_ST",
+ "type": "DeviceLevelStatus",
+ "mandatory": true
+ },
+ {
+ "name": "stereoAudioOutputMuted",
+ "key": "OEM_REF_STER_AUD_OUT_MUT",
+ "type": "Boolean",
+ "mandatory": true
+ },
+ {
+ "name": "monoAudioOutputMuted",
+ "key": "OEM_REF_MONO_AUD_OUT_MUT",
+ "type": "Boolean",
+ "mandatory": true
+ },
+ {
+ "name": "signalLevelStatus",
+ "key": "OEM_REF_SIG_LEV_ST",
+ "type": "DeviceLevelStatus",
+ "mandatory": true
+ },
+ {
+ "name": "primaryAudioSource",
+ "key": "OEM_REF_PR_AUD_SOUR",
+ "type": "PrimaryAudioSource",
+ "mandatory": true
+ },
+ {
+ "name": "eCallEventActive",
+ "key": "OEM_REF_E_CALL_INF_ACT",
+ "type": "Boolean",
+ "mandatory": true
+ }
+ ],
+ "key": "OEM_REF_DEV_ST",
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "driverBraking",
+ "key": "OEM_REF_DR_BRAK",
+ "type": "VehicleDataEventStatus",
+ "mandatory": false
+ },
+ {
+ "name": "wiperStatus",
+ "key": "OEM_REF_WI_ST",
+ "type": "WiperStatus",
+ "mandatory": false
+ },
+ {
+ "name": "headLampStatus",
+ "params": [
+ {
+ "name": "ambientLightSensorStatus",
+ "key": "OEM_REF_AMB_LIGHT",
+ "type": "AmbientLightStatus",
+ "mandatory": false
+ },
+ {
+ "name": "highBeamsOn",
+ "key": "OEM_REF_HIGH_BEAM",
+ "type": "Boolean",
+ "mandatory": true
+ },
+ {
+ "name": "lowBeamsOn",
+ "key": "OEM_REF_LOW_BEAM",
+ "type": "Boolean",
+ "mandatory": true
+ }
+ ],
+ "key": "OEM_REF_HLSTATUS",
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "engineTorque",
+ "key": "OEM_REF_ENG_TORQ",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": -1000,
+ "maxvalue": 2000
+ },
+ {
+ "name": "accPedalPosition",
+ "key": "OEM_REF_ACC_PED_POS",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 100
+ },
+ {
+ "name": "steeringWheelAngle",
+ "key": "OEM_REF_STE_WH_ANG",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": -2000,
+ "maxvalue": 2000
+ },
+ {
+ "name": "engineOilLife",
+ "key": "OEM_REF_ENG_OIL_LIFE",
+ "type": "Float",
+ "mandatory": false,
+ "minvalue": 0,
+ "maxvalue": 100,
+ "since": "5.0"
+ },
+ {
+ "name": "electronicParkBrakeStatus",
+ "key": "OEM_REF_EL_PARK_BR_ST",
+ "type": "ElectronicParkBrakeStatus",
+ "mandatory": false,
+ "since": "5.0"
+ },
+ {
+ "name": "cloudAppVehicleID",
+ "key": "OEM_REF_CL_APP_VEH_ID",
+ "type": "String",
+ "mandatory": false,
+ "since": "5.1"
+ },
+ {
+ "name": "eCallInfo",
+ "params": [
+ {
+ "name": "eCallNotificationStatus",
+ "key": "OEM_REF_E_CALL_NOT_ST",
+ "type": "VehicleDataNotificationStatus",
+ "mandatory": true
+ },
+ {
+ "name": "auxECallNotificationStatus",
+ "key": "OEM_REF_AUX_E_CALL_NOT_ST",
+ "type": "VehicleDataNotificationStatus",
+ "mandatory": true
+ },
+ {
+ "name": "eCallConfirmationStatus",
+ "key": "OEM_REF_E_CALL_CONF_ST",
+ "type": "ECallConfirmationStatus",
+ "mandatory": true
+ }
+ ],
+ "key": "OEM_REF_E_CALL_INF",
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "airbagStatus",
+ "params": [
+ {
+ "name": "driverAirbagDeployed",
+ "key": "OEM_REF_DR_AIR_DEP",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "driverSideAirbagDeployed",
+ "key": "OEM_REF_DR_SIDE_AIR_DEP",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "driverCurtainAirbagDeployed",
+ "key": "OEM_REF_DR_CUR_AIR_DEP",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "passengerAirbagDeployed",
+ "key": "OEM_REF_PASS_AIR_DEP",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "passengerCurtainAirbagDeployed",
+ "key": "OEM_REF_PASS_CUR_AIR_DEP",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "driverKneeAirbagDeployed",
+ "key": "OEM_REF_DR_KNEE_AIR_DEP",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "passengerSideAirbagDeployed",
+ "key": "OEM_REF_PASS_SIDE_AIR_DEP",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "passengerKneeAirbagDeployed",
+ "key": "OEM_REF_PASS_KNEE_AIR_DEP",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ }
+ ],
+ "key": "OEM_REF_AIR_ST",
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "emergencyEvent",
+ "params": [
+ {
+ "name": "emergencyEventType",
+ "key": "OEM_REF_EM_EV_TYPE",
+ "type": "EmergencyEventType",
+ "mandatory": true
+ },
+ {
+ "name": "fuelCutoffStatus",
+ "key": "OEM_REF_FUEL_CUT_ST",
+ "type": "FuelCutoffStatus",
+ "mandatory": true
+ },
+ {
+ "name": "rolloverEvent",
+ "key": "OEM_REF_ROL_EV",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ },
+ {
+ "name": "maximumChangeVelocity",
+ "key": "OEM_REF_MAX_CH_VEL",
+ "type": "Integer",
+ "mandatory": true,
+ "minvalue": 0,
+ "maxvalue": 255
+ },
+ {
+ "name": "multipleEvents",
+ "key": "OEM_REF_MUL_EV",
+ "type": "VehicleDataEventStatus",
+ "mandatory": true
+ }
+ ],
+ "key": "OEM_REF_EM_EV",
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "clusterModeStatus",
+ "params": [
+ {
+ "name": "powerModeActive",
+ "key": "OEM_REF_POW_MOD_ACT",
+ "type": "Boolean",
+ "mandatory": true
+ },
+ {
+ "name": "powerModeQualificationStatus",
+ "key": "OEM_REF_POW_MOD_QU_ST",
+ "type": "PowerModeQualificationStatus",
+ "mandatory": true
+ },
+ {
+ "name": "carModeStatus",
+ "key": "OEM_REF_CAR_MOD_ST",
+ "type": "CarModeStatus",
+ "mandatory": true
+ },
+ {
+ "name": "powerModeStatus",
+ "key": "OEM_REF_POW_MOD_ST",
+ "type": "PowerModeStatus",
+ "mandatory": true
+ }
+ ],
+ "key": "OEM_REF_CL_MOD_ST",
+ "type": "Struct",
+ "mandatory": false
+ },
+ {
+ "name": "myKey",
+ "params": [
+ {
+ "name": "e911Override",
+ "key": "OEM_REF_E_9110_VE",
+ "type": "VehicleDataStatus",
+ "mandatory": true,
+ "since": "2.0"
+ }
+ ],
+ "key": "OEM_REF_MY_KEY",
+ "type": "Struct",
+ "mandatory": false
+ }
+ ]
+ }
+ }
+}
diff --git a/src/appMain/signal_handlers.cc b/src/appMain/signal_handlers.cc
index c695467ae2..c9c09d10a2 100644
--- a/src/appMain/signal_handlers.cc
+++ b/src/appMain/signal_handlers.cc
@@ -1,37 +1,37 @@
/*
-* Copyright (c) 2014, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
-#include "signal_handlers.h"
-#include "life_cycle.h"
+#include "appMain/signal_handlers.h"
+#include "appMain/life_cycle.h"
#include "utils/logger.h"
namespace main_namespace {
diff --git a/src/appMain/signal_handlers.h b/src/appMain/signal_handlers.h
index f3adefb929..458a121d42 100644
--- a/src/appMain/signal_handlers.h
+++ b/src/appMain/signal_handlers.h
@@ -1,34 +1,34 @@
/*
-* Copyright (c) 2014, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef SRC_APPMAIN_SIGNAL_HANDLERS_H_
#define SRC_APPMAIN_SIGNAL_HANDLERS_H_
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini
index aa15b7c5fe..31302f24c6 100644
--- a/src/appMain/smartDeviceLink.ini
+++ b/src/appMain/smartDeviceLink.ini
@@ -96,6 +96,12 @@ AppTransportChangeTimer = 500
; The time used as addition for AppTransportChangeTimer
AppTransportChangeTimerAddition = 0
+; Signal offsets used by SDL for setting up real time signals
+; used by LOW VOLTAGE functionality
+LowVoltageSignal = 1 ; Offset from SIGRTMIN
+WakeUpSignal = 2 ; Offset from SIGRTMIN
+IgnitionOffSignal = 3 ; Offset from SIGRTMIN
+
[MEDIA MANAGER]
; where 3 is a number of retries and 1000 is a timeout in milliseconds for request frequency
StartStreamRetry = 3, 1000
@@ -186,10 +192,42 @@ PathToSnapshot = sdl_snapshot.json
AttemptsToOpenPolicyDB = 5
; Timeout between attempts during opening DB in milliseconds
OpenAttemptTimeoutMs = 500
+; Whether to use the fullAppID over the short-form appID in policy lookups
+UseFullAppID = true
[TransportManager]
; Listening port form incoming TCP mobile connection
TCPAdapterPort = 12345
+; Name of the network interface that Core will listen on for incoming TCP connection, e.g. eth0.
+; If the name is omitted, Core will listen on all network interfaces by binding to INADDR_ANY.
+TCPAdapterNetworkInterface =
+
+; WebSocket connection address used for incoming connections
+WebSocketServerAddress = 0.0.0.0
+; Listening port for incoming connection to websocket server
+WebSocketServerPort = 2020
+; WS Server Certificate
+; WSServerCertificatePath = server-cert.pem
+; WSServerKeyPath = server-key.pem
+; WSServerCACertificatePath = ca-cert.pem
+
+; 128 bit uuid for bluetooth device discovery. Please format as 16 seperate bytes.
+;BluetoothUUID = 0x93, 0x6D, 0xA0, 0x1F, 0x9A, 0xBD, 0x4D, 0x9D, 0x80, 0xC7, 0x02, 0xAF, 0x85, 0xC8, 0x22, 0xA8
+
+; AOA USB Transport Configuration
+; USBAccessory Filter Parameters
+AOAFilterManufacturer = SDL
+AOAFilterModelName = Core
+AOAFilterDescription = SmartDeviceLink Core Component USB
+AOAFilterVersion = 1.0
+AOAFilterURI = http://www.smartdevicelink.org
+AOAFilterSerialNumber = N000000
+
+[CloudAppConnections]
+; Value in milliseconds for time between retry attempts on a failed websocket connection
+CloudAppRetryTimeout = 1000
+; MaxNn number of retry attempts for a cloud websocket connection
+CloudAppMaxRetryAttempts = 5
[ProtocolHandler]
; SDL supported protocol version
@@ -264,6 +302,57 @@ AttemptsToOpenResumptionDB = 5
; Timeout between attempts during opening DB in milliseconds
OpenAttemptTimeoutMsResumptionDB = 500
+[TransportRequiredForResumption]
+; This section specifies transport types that are required to trigger resumption for each
+; AppHMIType. App has to be connected through at least one of the transports listed (either as
+; the primary transport or secondary transport) to trigger resumption. If the app is not
+; connected with any of the transports listed, its HMIlevel will be kept in NONE and the state
+; stays in NOT_AUDIBLE.
+; In case an app has multiple AppHMIType, requirements of all of the AppHMITypes are applied.
+;
+; Possible AppHMITypes: Default, Communication, Media, Messaging, Navigation, Information,
+; Social, BackgroundProcess, Testing, System, Projection, RemoteControl,
+; EmptyApp
+; Possible transport types: TCP_WIFI, IAP_CARPLAY, IAP_USB_HOST_MODE, IAP_USB_DEVICE_MODE,
+; IAP_USB, AOA_USB, IAP_BLUETOOTH, SPP_BLUETOOTH
+;
+; The default behavior is to always enable resumption. If an AppHMIType is not listed in this
+; section, resumption is enabled for an app with the AppHMIType.
+; On the other hand, if you want to disable resumption and always keep an app in NONE and
+; NOT_AUDIBLE state after registration, specify an empty value for the AppHMIType.
+;
+; NAVIGATION apps, PROJECTION apps and apps that declare themselves as media apps have a
+; special exception. When these apps do not have any of the transports listed here, they will
+; be still resumed into particular HMIlevel defined in LowBandwidthTransportResumptionLevel
+; section.
+
+;DefaultTransportRequiredForResumption =
+;CommunicationTransportRequiredForResumption =
+;MediaTransportRequiredForResumption =
+;MessagingTransportRequiredForResumption =
+;NavigationTransportRequiredForResumption =
+;InformationTransportRequiredForResumption =
+;SocialTransportRequiredForResumption =
+;BackgroundProcessTransportRequiredForResumption =
+;TestingTransportRequiredForResumption =
+;SystemTransportRequiredForResumption =
+;ProjectionTransportRequiredForResumption =
+;RemoteControlTransportRequiredForResumption =
+; "EmptyAppTransportRequiredForResumption" applies to apps that don't specify any AppHMIType
+;EmptyAppTransportRequiredForResumption =
+
+[LowBandwidthTransportResumptionLevel]
+; The HMI Level that an app will resume to if no high bandwidth connection is active.
+; High bandwidth connections for each app type are defined under TransportRequiredForResumption
+; section.
+; Possible values: NONE, BACKGROUND, LIMITED and FULL
+; this is for NAVIGATION apps
+;NavigationLowBandwidthResumptionLevel =
+; this is for PROJECTION apps
+;ProjectionLowBandwidthResumptionLevel =
+; this is for apps who declare themselves as media apps. (Don't be confused with AppHMIType=MEDIA.)
+;MediaLowBandwidthResumptionLevel =
+
[AppLaunch]
; time in milliseconds started from device connection - after expiring SDL remotely launches all known not-yet-registered apps from this device
AppLaunchWaitTime = 5000
@@ -279,3 +368,39 @@ MaxNumberOfiOSDevice = 10
WaitTimeBetweenApps = 4000
; App Launch on iOS devices SDL feature enabler/disabler
EnableAppLaunchIOS = true
+
+[MultipleTransports]
+; Whether multiple-transports feature is enabled
+;MultipleTransportsEnabled = true
+
+; Comma-separated list of transports that can be used as Secondary Transport for each Primary Transport.
+; Possible values are: WiFi, USB and Bluetooth.
+; Core will not suggest Secondary Transport if the value is empty.
+;SecondaryTransportForBluetooth = WiFi
+;SecondaryTransportForUSB =
+;SecondaryTransportForWiFi =
+
+[ServicesMap]
+; A matrix to specify which service is allowed on which transports. The transports are listed
+; in preferred order. If a transport is not listed, then the service is not allowed
+; to run on the transport.
+; Only video and audio services are configurable.
+; If the entry of a service is completely omitted, the service will be allowed on all transports.
+; Possible values are: IAP_BLUETOOTH, IAP_USB, IAP_USB_HOST_MODE, IAP_USB_DEVICE_MODE, IAP_CARPLAY, SPP_BLUETOOTH, AOA_USB and TCP_WIFI.
+; Note: this configuration is applied even if multiple-transports feature is not enabled.
+;AudioServiceTransports = TCP_WIFI, IAP_CARPLAY, IAP_USB_HOST_MODE, IAP_USB_DEVICE_MODE, IAP_USB, AOA_USB
+;VideoServiceTransports = TCP_WIFI, IAP_CARPLAY, IAP_USB_HOST_MODE, IAP_USB_DEVICE_MODE, IAP_USB, AOA_USB
+
+[AppServices]
+; The ID used to fill the originApp field when the HMI sends a PerformAppServiceInteraction request
+HMIOriginID = "HMI_ID"
+
+; Services that exist on the module. Values are of AppServiceType in RPC Spec. These services will be used as default and app services will only become primary service publisher with direct user interaction. These services will also be a fallback if no app service publisher is registered with the system of that type.
+EmbeddedServices = MEDIA, WEATHER, NAVIGATION
+
+; Additional time added to RPC timeout when passing through to App service
+RpcPassThroughTimeout = 10000
+
+[RCModuleConsent]
+; The period (in days) after which consent for module_id should be removed.
+PeriodForConsentExpiration = 30
diff --git a/src/appMain/start_external_proprietary.sh b/src/appMain/start_external_proprietary.sh
index 15ee2ecae5..35d4fe900c 100644
--- a/src/appMain/start_external_proprietary.sh
+++ b/src/appMain/start_external_proprietary.sh
@@ -1,12 +1,14 @@
#!/bin/bash
-pip list | grep -F tornado > /dev/null
+pip3 list | grep -F tornado > /dev/null
+
if [ $? -eq 1 ]
then
echo "Installing tornado python package"
- sudo pip install tornado
+ sudo -H pip3 install tornado
fi
+
echo "Starting Policy Manager"
-python sample_policy_manager.py --pack_port 8088 --unpack_port 8089 --add_http_header --encryption &
+python3 sample_policy_manager.py --pack_port 8088 --unpack_port 8089 --add_http_header --encryption &
POLICY_MANAGER=$!
trap ctrl_c INT
diff --git a/src/3rd_party-static/jsoncpp/CMakeLists.txt b/src/appMain/test/CMakeLists.txt
index ac273cfe7b..057e1e9869 100644
--- a/src/3rd_party-static/jsoncpp/CMakeLists.txt
+++ b/src/appMain/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2016, Ford Motor Company
+# Copyright (c) 2018, Ford Motor Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -28,15 +28,19 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
-include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
-
-set(JSONCPP_INCLUDE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include)
-set(JSONCPP_INCLUDE_DIRECTORY ${JSONCPP_INCLUDE_DIRECTORY} PARENT_SCOPE)
+include_directories (
+ ${GMOCK_INCLUDE_DIRECTORY}
+ ${COMPONENTS_DIR}/utils/test/include
+)
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}/include
+set(testSources
+ $<TARGET_OBJECTS:LowVoltageHandlerObjLibrary>
+ ${CMAKE_SOURCE_DIR}/src/appMain/test/low_voltage_signals_handler_test.cc
+ ${COMPONENTS_DIR}/utils/test/mock_signals_posix.cc
)
-collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/lib_json")
+set(LIBRARIES
+ gmock
+)
-add_library(jsoncpp ${SOURCES})
+create_test(low_voltage_signals_handler_test "${testSources}" "${LIBRARIES}")
diff --git a/src/appMain/test/low_voltage_signals_handler_test.cc b/src/appMain/test/low_voltage_signals_handler_test.cc
new file mode 100644
index 0000000000..3dec0cc96d
--- /dev/null
+++ b/src/appMain/test/low_voltage_signals_handler_test.cc
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "appMain/low_voltage_signals_handler.h"
+
+#include <memory>
+#include "appMain/test/mock_life_cycle.h"
+#include "gtest/gtest.h"
+#include "utils/macro.h"
+#include "utils/mock_signals_posix.h"
+
+namespace test {
+
+using ::testing::_;
+using ::testing::InSequence;
+using ::testing::Return;
+
+const int kLowVoltageSignalOffset = 1;
+const int kWakeUpSignalOffset = 2;
+const int kIgnitionOffSignalOffset = 3;
+
+class LowVoltageSignalsHandlerTest : public ::testing::Test {
+ protected:
+ LowVoltageSignalsHandlerTest()
+ : mock_life_cycle_(std::make_shared<main_namespace::MockLifeCycle>())
+ , mock_signals_posix_(*utils::MockSignalsPosix::signals_posix_mock()) {}
+
+ void SetUp() OVERRIDE {
+ signals_offset_ = {
+ kLowVoltageSignalOffset, kWakeUpSignalOffset, kIgnitionOffSignalOffset};
+
+ low_voltage_signals_handler_ =
+ std::unique_ptr<main_namespace::LowVoltageSignalsHandler>(
+ new main_namespace::LowVoltageSignalsHandler(
+ *mock_life_cycle_.get(), signals_offset_));
+ }
+
+ main_namespace::LowVoltageSignalsOffset signals_offset_;
+ std::unique_ptr<main_namespace::LowVoltageSignalsHandler>
+ low_voltage_signals_handler_;
+ std::shared_ptr<main_namespace::MockLifeCycle> mock_life_cycle_;
+ utils::MockSignalsPosix& mock_signals_posix_;
+};
+
+TEST_F(
+ LowVoltageSignalsHandlerTest,
+ LowVoltageSignalReceived_CheckParentProcessBehavior_ExpectChildCreationAndtLowVoltageCall) {
+ // To guarantee strict call orders
+ InSequence guarantees_calls_sequence;
+ // Set expectation after LOW VOLTAGE signal
+ EXPECT_CALL(*mock_life_cycle_, LowVoltage());
+ // Expect child process creation
+ const pid_t cpid = 111;
+ EXPECT_CALL(mock_signals_posix_, Fork()).WillOnce(Return(cpid));
+ // Expect parent process sleep
+ EXPECT_CALL(mock_signals_posix_, WaitPid(_, nullptr, 0));
+ // Expect parent process wakes up
+ EXPECT_CALL(*mock_life_cycle_, WakeUp());
+ const int low_voltage_signo =
+ low_voltage_signals_handler_->low_voltage_signo();
+ // Emulate LOW VOLTAGE signal receipt and handling
+ low_voltage_signals_handler_->HandleSignal(low_voltage_signo);
+}
+
+TEST_F(
+ LowVoltageSignalsHandlerTest,
+ LowVoltageSignalReceived_CheckChildProcessBehavior_ExpectChildSendsStopToParentProcess) {
+ // To guarantee strict call orders
+ InSequence guarantees_calls_sequence;
+ // Set expectation after LOW VOLTAGE signal
+ EXPECT_CALL(*mock_life_cycle_, LowVoltage());
+ // Expect child process creation
+ const pid_t cpid = 0;
+ EXPECT_CALL(mock_signals_posix_, Fork()).WillOnce(Return(cpid));
+ // Expect SIGCONT signal to be sent to parent process
+ EXPECT_CALL(mock_signals_posix_, SendSignal(SIGSTOP, _));
+ const int low_voltage_signo =
+ low_voltage_signals_handler_->low_voltage_signo();
+ // Emulate LOW VOLTAGE signal receipt and handling
+ low_voltage_signals_handler_->HandleSignal(low_voltage_signo);
+}
+
+TEST_F(LowVoltageSignalsHandlerTest,
+ WakeUpSignalReceived_ExpectParentProcessWakeUpAndChildProcessExit) {
+ // To guarantee strict call orders
+ InSequence guarantees_calls_sequence;
+ // Expect SIGCONT signal to be sent to parent process
+ EXPECT_CALL(mock_signals_posix_, SendSignal(SIGCONT, _));
+ // Expect child process exit
+ EXPECT_CALL(mock_signals_posix_, ExitProcess(0));
+ const int wake_up_signo = low_voltage_signals_handler_->wake_up_signo();
+ // Emulate WAKE UP signal receipt and handling
+ low_voltage_signals_handler_->HandleSignal(wake_up_signo);
+}
+
+TEST_F(LowVoltageSignalsHandlerTest,
+ IgnitionOffSignalReceived_ExpectAllProcessesStopped) {
+ // To guarantee strict call orders
+ InSequence guarantees_calls_sequence;
+ // Expect SIGKILL signal to be sent to parent process
+ EXPECT_CALL(mock_signals_posix_, SendSignal(SIGKILL, _));
+ // Expect child process exit
+ EXPECT_CALL(mock_signals_posix_, ExitProcess(0));
+ const int ign_off_signo = low_voltage_signals_handler_->ignition_off_signo();
+ // Emulate IGN OFF signal receipt and handling
+ low_voltage_signals_handler_->HandleSignal(ign_off_signo);
+}
+
+} // namespace test
diff --git a/src/appMain/test/mock_life_cycle.h b/src/appMain/test/mock_life_cycle.h
new file mode 100644
index 0000000000..98973bd153
--- /dev/null
+++ b/src/appMain/test/mock_life_cycle.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_APPMAIN_TEST_MOCK_LIFE_CYCLE_H_
+#define SRC_APPMAIN_TEST_MOCK_LIFE_CYCLE_H_
+
+#include "appMain/life_cycle.h"
+#include "gmock/gmock.h"
+
+namespace main_namespace {
+
+class MockLifeCycle : public LifeCycle {
+ public:
+ MOCK_METHOD0(StartComponents, bool());
+ MOCK_METHOD0(InitMessageSystem, bool());
+ MOCK_METHOD0(Run, void());
+ MOCK_METHOD0(StopComponents, void());
+ MOCK_METHOD0(LowVoltage, void());
+ MOCK_METHOD0(WakeUp, void());
+ MOCK_METHOD0(IgnitionOff, void());
+};
+
+} // namespace main_namespace
+
+#endif // SRC_APPMAIN_TEST_MOCK_LIFE_CYCLE_H_
diff --git a/src/components/CMakeLists.txt b/src/components/CMakeLists.txt
index 4f984bb3a8..f262f201c2 100644
--- a/src/components/CMakeLists.txt
+++ b/src/components/CMakeLists.txt
@@ -91,8 +91,3 @@ add_subdirectory(./media_manager)
if(TELEMETRY_MONITOR)
add_subdirectory(./telemetry_monitor)
endif()
-
-# --- DBus
-if(HMI_DBUS_API)
- add_subdirectory(./dbus)
-endif()
diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt
index b7a6d94503..c7f2aede9a 100644
--- a/src/components/application_manager/CMakeLists.txt
+++ b/src/components/application_manager/CMakeLists.txt
@@ -61,6 +61,7 @@ include_directories (
${ENCRYPTION_INCLUDE_DIRECTORY}
${MESSAGE_BROKER_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
${BSON_INCLUDE_DIRECTORY}
)
@@ -118,12 +119,6 @@ collect_sources(EVENT_ENGINE_SOURCES "${EVENT_ENGINE_PATHS}")
collect_sources(POLICIES_SOURCES "${POLICIES_PATHS}")
-if (${HMI_JSON_API})
- set (HMI_COMMANDS_SOURCES ${HMI_COMMANDS_SOURCES} ${HMI_COMMANDS_SOURCES_JSON})
-endif (${HMI_JSON_API})
-
-set (HMI_COMMANDS_SOURCES ${HMI_COMMANDS_SOURCES} ${HMI_COMMANDS_SOURCES_DBUS})
-
set(EXCLUDE_PATHS
${EVENT_ENGINE_SOURCE_DIR}
${MESSAGE_HELPER_SOURCE_DIR}
@@ -147,6 +142,7 @@ set(LIBRARIES
formatters
dbms
Utils
+ policy_struct
bson -L${BSON_LIBS_DIRECTORY}
emhashmap -L${EMHASHMAP_LIBS_DIRECTORY}
)
@@ -164,7 +160,7 @@ add_library("AMEventEngine" ${EVENT_ENGINE_SOURCES})
target_link_libraries("AMEventEngine" ${LIBRARIES})
add_library("AMPolicyLibrary" ${POLICIES_MANAGER_SOURCES} )
-target_link_libraries("AMPolicyLibrary" ${LIBRARIES} AMEventEngine)
+target_link_libraries("AMPolicyLibrary" ${LIBRARIES} AMEventEngine policy_struct)
add_library("SystemTimeLibrary" ${SYSTEM_TIME_SOURCES})
target_link_libraries("SystemTimeLibrary" ${LIBRARIES} AMEventEngine)
diff --git a/src/components/application_manager/include/application_manager/app_extension.h b/src/components/application_manager/include/application_manager/app_extension.h
index ee7eca190c..5167aa88c0 100644
--- a/src/components/application_manager/include/application_manager/app_extension.h
+++ b/src/components/application_manager/include/application_manager/app_extension.h
@@ -33,13 +33,13 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_EXTENSION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_EXTENSION_H_
-#include "utils/shared_ptr.h"
+#include <memory>
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
class SmartObject;
}
-}
+} // namespace ns_smart_device_link
namespace application_manager {
@@ -60,21 +60,21 @@ class AppExtension {
* plugin
*/
virtual void SaveResumptionData(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& resumption_data) = 0;
+ ns_smart_device_link::ns_smart_objects::SmartObject& resumption_data) = 0;
/**
* @brief ProcessResumption Method called by SDL during resumption.
* @param resumption_data list of resumption data
*/
virtual void ProcessResumption(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject&
+ const ns_smart_device_link::ns_smart_objects::SmartObject&
resumption_data) = 0;
private:
const AppExtensionUID kUid_;
};
-typedef utils::SharedPtr<AppExtension> AppExtensionPtr;
+typedef std::shared_ptr<AppExtension> AppExtensionPtr;
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h
index 9fc85db38c..2dd64a2941 100644
--- a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h
+++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h
@@ -32,12 +32,12 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APP_LAUNCH_CTRL_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APP_LAUNCH_CTRL_H_
+#include <memory>
#include <string>
-#include "utils/shared_ptr.h"
namespace application_manager {
class Application;
-typedef utils::SharedPtr<const Application> ApplicationConstSharedPtr;
+typedef std::shared_ptr<const Application> ApplicationConstSharedPtr;
} // namespace application_manager
namespace app_launch {
@@ -49,22 +49,22 @@ namespace app_launch {
class AppLaunchCtrl {
public:
/**
- * @brief OnAppRegistered should be called when application registered
- * Save application parameters to database
- * @param app application to save
- */
+ * @brief OnAppRegistered should be called when application registered
+ * Save application parameters to database
+ * @param app application to save
+ */
virtual void OnAppRegistered(const application_manager::Application& app) = 0;
/**
- * @brief OnDeviceConnected shoudl be called on device connected event
- * Start launching saaved applications on ios device
- * @param device_mac
- */
+ * @brief OnDeviceConnected shoudl be called on device connected event
+ * Start launching saaved applications on ios device
+ * @param device_mac
+ */
virtual void OnDeviceConnected(const std::string& device_mac) = 0;
/**
- * @brief OnMasterReset clear database of saved applications
- */
+ * @brief OnMasterReset clear database of saved applications
+ */
virtual void OnMasterReset() = 0;
virtual ~AppLaunchCtrl() {}
};
diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h
index 1f508eebe5..986f4ad4ff 100644
--- a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h
+++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h
@@ -41,15 +41,15 @@
namespace connection_handler {
class ConnectionHandler;
-} // connection_handler
+} // namespace connection_handler
namespace resumption {
class ResumeCtrl;
-} // resumption
+} // namespace resumption
namespace app_launch {
// TODO(AK) Use unique pointer
-typedef utils::SharedPtr<timer::Timer> TimerPtr;
+typedef std::shared_ptr<timer::Timer> TimerPtr;
class MultipleAppsLauncherFactoryImpl;
class AppLaunchCtrlImpl : public AppLaunchCtrl {
diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h
index 0d52384018..c1ad8d4003 100644
--- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h
+++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h
@@ -34,9 +34,9 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APP_LAUNCH_DATA_H_
#include <stdint.h>
-#include <vector>
+#include <memory>
#include <string>
-#include "utils/shared_ptr.h"
+#include <vector>
namespace app_launch {
@@ -59,7 +59,7 @@ struct ApplicationData {
bundle_id_ == app_data.bundle_id_ && device_mac_ == device_mac_;
}
};
-typedef utils::SharedPtr<ApplicationData> ApplicationDataPtr;
+typedef std::shared_ptr<ApplicationData> ApplicationDataPtr;
/**
* @brief class contains interfaces to AppLaunchDataDB and AppLaunchDataJson
diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_db.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_db.h
index 92d6bbd9ef..b232d1874c 100644
--- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_db.h
+++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_db.h
@@ -104,8 +104,8 @@ class AppLaunchDataDB : public AppLaunchDataImpl {
bool IsAppDataAlreadyExisted(const ApplicationData& app_data) const OVERRIDE;
/**
- * @brief returns pointer to data base
- */
+ * @brief returns pointer to data base
+ */
utils::dbms::SQLDatabase* db() const;
enum ApplicationDataDBIndexes {
@@ -151,13 +151,13 @@ class AppLaunchDataDB : public AppLaunchDataImpl {
bool WriteDb();
/**
- * @brief returns pointer to data base
- */
- std::auto_ptr<utils::dbms::SQLDatabase> db_;
+ * @brief returns pointer to data base
+ */
+ std::unique_ptr<utils::dbms::SQLDatabase> db_;
/**
- * @brief indicate initializing status of DB
- */
+ * @brief indicate initializing status of DB
+ */
bool init_successeful_;
DISALLOW_COPY_AND_ASSIGN(AppLaunchDataDB);
diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h
index 111ff25ab2..b28c7fdd3d 100644
--- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h
+++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h
@@ -33,8 +33,10 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APP_LAUNCH_DATA_IMPL_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APP_LAUNCH_DATA_IMPL_H_
+#include <memory>
#include "application_manager/app_launch/app_launch_data.h"
#include "application_manager/app_launch_settings.h"
+#include "utils/macro.h"
namespace app_launch {
diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h
index 61117e552b..9e60183960 100644
--- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h
+++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APP_LAUNCH_DATA_JSON_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APP_LAUNCH_DATA_JSON_H_
+#include <memory>
#include "application_manager/app_launch/app_launch_data_impl.h"
-#include "smart_objects/smart_object.h"
-#include "resumption/last_state.h"
+#include "resumption/last_state_wrapper.h"
#include "utils/lock.h"
#include "utils/macro.h"
@@ -52,7 +52,12 @@ class AppLaunchDataJson : public AppLaunchDataImpl {
* @brief Constructor of AppLaunchDataJson object
*/
AppLaunchDataJson(const AppLaunchSettings& settings,
+ resumption::LastStateWrapperPtr last_state_wrapper);
+
+ DEPRECATED
+ AppLaunchDataJson(const AppLaunchSettings& settings,
resumption::LastState& last_state);
+
/**
* @brief allows to destroy AppLaunchDataJson object
*/
@@ -87,9 +92,15 @@ class AppLaunchDataJson : public AppLaunchDataImpl {
* @param app_data - searching filled in object
* @param founded_index - referenceto index of founded record
* in case it wasn't found it'll be -1
+ * @param dictionary - data dictionary where all necessary info stored
* @return pointer to json list object
*/
Json::Value& GetApplicationListAndIndex(const ApplicationData& app_data,
+ int32_t& found_index,
+ Json::Value& dictionary) const;
+
+ DEPRECATED
+ Json::Value& GetApplicationListAndIndex(const ApplicationData& app_data,
int32_t& founded_index) const;
private:
@@ -116,37 +127,32 @@ class AppLaunchDataJson : public AppLaunchDataImpl {
const std::string& dev_mac) const OVERRIDE;
/**
- * @return pointer to LastState functionality
- */
- resumption::LastState& last_state() const {
- return last_state_;
- }
-
- /**
* @brief delete record with oldest timestamp
* @return true in success cases and false othrewise
*/
bool DeleteOldestAppData();
/**
+ * @param dictionary - data dictionary where all necessary info stored
* @return pointer to AppLaunch data block in Json file
*/
- Json::Value& GetSavedApplicationDataList() const;
+ Json::Value& GetSavedApplicationDataList(Json::Value& dictionary) const;
/**
+ * @param dictionary - data dictionary where all necessary info stored
* @return pointer to AppLaunch records block in Json file
*/
- Json::Value& GetApplicationData() const;
+ Json::Value& GetApplicationData(Json::Value& dictionary) const;
/**
* @brief lock to protected common data
*/
- mutable sync_primitives::Lock app_launch_json_lock_;
+ mutable sync_primitives::RecursiveLock app_launch_json_lock_;
/**
* @brief ponter to Last State object
*/
- resumption::LastState& last_state_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
DISALLOW_COPY_AND_ASSIGN(AppLaunchDataJson);
};
diff --git a/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h b/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h
index 751e04bada..7e360aa460 100644
--- a/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h
+++ b/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h
@@ -1,5 +1,6 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APPS_LAUNCHER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APPS_LAUNCHER_H_
+#include <memory>
#include "application_manager/app_launch/app_launch_data.h"
#include "connection_handler/connection_handler.h"
#include "utils/timer.h"
@@ -69,7 +70,7 @@ class AppsLauncher {
connection_handler::ConnectionHandler& connection_handler_;
AppsLauncher& parent_;
};
- typedef utils::SharedPtr<Launcher> LauncherPtr;
+ typedef std::shared_ptr<Launcher> LauncherPtr;
typedef std::vector<LauncherPtr> AppLaunchers;
private:
diff --git a/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h b/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h
index f1f29471e6..f27e4569fc 100644
--- a/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h
+++ b/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h
@@ -1,18 +1,48 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_DEVICE_APPS_LAUNCHER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_DEVICE_APPS_LAUNCHER_H_
#include <stdint.h>
-#include <vector>
-#include <string>
#include <memory>
+#include <string>
+#include <vector>
#include "application_manager/app_launch/app_launch_data.h"
-#include "application_manager/application_manager.h"
#include "application_manager/app_launch_settings.h"
+#include "application_manager/application_manager.h"
namespace app_launch {
class AppLaunchCtrlImpl;
-class DeviceAppsLauncherImpl;
+class DeviceAppsLauncher;
class AppsLauncher;
class AppLaunchSettings;
+class Launcher;
+class LauncherGenerator;
+
+// impl class must be defined for unique_ptr in DeviceAppsLauncher
+class DeviceAppsLauncherImpl {
+ public:
+ DeviceAppsLauncherImpl(DeviceAppsLauncher& interface,
+ AppsLauncher& apps_launcher);
+
+ bool LaunchAppsOnDevice(
+ const std::string& device_mac,
+ const std::vector<ApplicationDataPtr>& applications_to_launch);
+
+ struct LauncherFinder {
+ LauncherFinder(const std::string& device_mac) : device_mac_(device_mac) {}
+
+ bool operator()(const std::shared_ptr<Launcher>& launcher) const;
+
+ std::string device_mac_;
+ };
+
+ bool StopLaunchingAppsOnDevice(const std::string& device_mac);
+
+ private:
+ sync_primitives::Lock launchers_lock_;
+ std::vector<std::shared_ptr<Launcher> > free_launchers_;
+ std::vector<std::shared_ptr<Launcher> > works_launchers_;
+ DeviceAppsLauncher& interface_;
+};
+
/**
* @brief The MultipleAppsLauncher struct
* should manage launching applications and gaps between launching application
@@ -36,7 +66,7 @@ class DeviceAppsLauncher {
private:
application_manager::ApplicationManager& app_mngr_;
const AppLaunchSettings& settings_;
- std::auto_ptr<DeviceAppsLauncherImpl> impl_;
+ std::unique_ptr<DeviceAppsLauncherImpl> impl_;
friend class DeviceAppsLauncherImpl;
DISALLOW_COPY_AND_ASSIGN(DeviceAppsLauncher);
};
diff --git a/src/components/application_manager/include/application_manager/app_service_manager.h b/src/components/application_manager/include/application_manager/app_service_manager.h
new file mode 100644
index 0000000000..d26598c1e9
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/app_service_manager.h
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_SERVICE_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_SERVICE_MANAGER_H_
+
+#include "application_manager/application.h"
+#include "application_manager/rpc_passing_handler.h"
+#include "interfaces/MOBILE_API.h"
+#include "resumption/last_state_wrapper.h"
+#include "smart_objects/smart_object.h"
+#include "utils/macro.h"
+
+namespace application_manager {
+
+struct AppService {
+ uint32_t connection_key;
+ bool mobile_service;
+ bool default_service = false;
+ smart_objects::SmartObject record;
+};
+
+class RPCPassingHandler;
+class ApplicationManager;
+/**
+ * @brief The AppServiceManager is TODO.
+ */
+class AppServiceManager {
+ public:
+ const std::string kEmbeddedService = "EMBEDDED_SERVICE";
+
+ /**
+ * @brief Class constructor
+ * @param app_manager
+ */
+ AppServiceManager(ApplicationManager& app_manager,
+ resumption::LastStateWrapperPtr last_state);
+
+ DEPRECATED AppServiceManager(ApplicationManager& app_manager,
+ resumption::LastState& last_state);
+
+ /**
+ * @brief Class destructor
+ */
+ virtual ~AppServiceManager();
+
+ /**
+ * @brief Publish an app service. This service will be activated if it is the
+ * default service for its type, or if it is the first service to register of
+ * its type.
+ * @param manifest - The app service manifest of the service to be published
+ * @param mobile_service - True, if the service is being published by a mobile
+ * app. False, if published by the embedded system.
+ * @param connection_key - If mobile_service is true, the connection key of
+ * the app publishing this service.
+ * @return The app service record of the published app service on success, a
+ * Null SmartObject value on failure
+ */
+ virtual smart_objects::SmartObject PublishAppService(
+ const smart_objects::SmartObject& manifest,
+ const bool mobile_service,
+ const uint32_t connection_key = 0u);
+
+ /**
+ * @brief Unpublish an existing app service
+ * @param service_id - The ID of the app service to be deleted.
+ * @return True on success, false otherwise
+ */
+ virtual bool UnpublishAppService(const std::string service_id);
+
+ /**
+ * @brief Callback for when an application is activated. Will activate all
+ * services which were published by this app.
+ * @param app - The application that was activated.
+ */
+ virtual void OnAppActivated(ApplicationConstSharedPtr app);
+
+ /**
+ * @brief Unpublish any published services for a given mobile application
+ * @param connection_key - The connection key of the application from which
+ * all published services should be deleted.
+ */
+ virtual void UnpublishServices(const uint32_t connection_key);
+
+ /**
+ * @brief Sets a service to the default service for its type
+ * @param service_id - The ID of the service to become the default
+ * @return True on success, false otherwise
+ */
+ virtual bool SetDefaultService(const std::string service_id);
+
+ /**
+ * @brief Removes a service from the list of default services.
+ * @param service_id - The ID of the existing default service.
+ * @return True on success, false otherwise
+ */
+ virtual bool RemoveDefaultService(const std::string service_id);
+
+ /**
+ * @brief Activate an existing service
+ * @param service_id - The ID of the service to be activated.
+ * @return True if the service is active, false otherwise
+ */
+ virtual bool ActivateAppService(const std::string service_id);
+
+ /**
+ * @brief Deactivate an existing active service
+ * @param service_id - The ID of the service to be deactivated.
+ * @return True if the service was deactivated, false otherwise
+ */
+ virtual bool DeactivateAppService(const std::string service_id);
+
+ /**
+ * @brief Get a list of all published service records.
+ * @return A list of all all published service records.
+ */
+ virtual std::vector<smart_objects::SmartObject> GetAllServiceRecords();
+
+ /**
+ * @brief Get a list of all active app services.
+ * @return A list of all all active app services.
+ */
+ virtual std::vector<AppService> GetActiveServices();
+
+ /**
+ * @brief Retrieve the active service provider for a given service type
+ * @param service_type - The service type of the provider to be retrieved
+ * @param mobile_consumer - True, if the consumer trying to communicate with
+ * the provider is a mobile application
+ * @param app - Output parameter that will be filled with the application
+ * providing the requested service on success, unchanged on failure
+ * @param hmi_service - Output parameter set to true if the service
+ * provider is the HMI, unchanged on failure
+ */
+ virtual void GetProviderByType(const std::string& service_type,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service);
+
+ /**
+ * @brief Retrieve the service provider with a given service ID
+ * @param service_type - The service type of the provider to be retrieved
+ * @param mobile_consumer - True, if the consumer trying to communicate with
+ * the provider is a mobile application
+ * @param app - Output parameter that will be filled with the application
+ * providing the requested service on success, unchanged on failure
+ * @param hmi_service - Output parameter set to true if the service
+ * provider is the HMI, unchanged on failure
+ */
+ virtual void GetProviderByID(const std::string& service_id,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service);
+
+ /**
+ * @brief Get the active service for a given service type.
+ * @param service_type - The service type
+ * @return A pointer to the active service for the given service type on
+ * success, NULL on failure
+ */
+ virtual AppService* ActiveServiceForType(const std::string service_type);
+
+ /**
+ * @brief Get the embedded service for a given service type.
+ * @param service_type - The service type
+ * @return A pointer to the embedded service for the given service type on
+ * success, NULL on failure
+ */
+ virtual AppService* EmbeddedServiceForType(const std::string service_type);
+
+ /**
+ * @brief Get the service with a given service ID.
+ * @param service_id - The service ID
+ * @return A pointer to requested service on success, NULL on failure
+ */
+ virtual AppService* FindServiceByID(const std::string service_id);
+
+ /**
+ * @brief Update a navigation system capability struct with the capabilities
+ * of the active navigation service.
+ * @param out_params - The struct to be modified
+ * @return True on success, false otherwise (if there was no active NAVIGATION
+ * service)
+ */
+ virtual bool UpdateNavigationCapabilities(
+ smart_objects::SmartObject& out_params);
+
+ /**
+ * @brief Get the RPCPassingHandler tied to this object
+ * @return The RPCPassingHandler tied to this object
+ */
+ virtual RPCPassingHandler& GetRPCPassingHandler();
+
+ private:
+ ApplicationManager& app_manager_;
+ resumption::LastStateWrapperPtr last_state_;
+
+ sync_primitives::RecursiveLock published_services_lock_;
+ std::map<std::string, AppService> published_services_;
+ RPCPassingHandler rpc_passing_handler_;
+
+ void SetServicePublished(const std::string service_id,
+ bool service_published);
+ void AppServiceUpdated(
+ const smart_objects::SmartObject& service_record,
+ const mobile_apis::ServiceUpdateReason::eType update_reason,
+ smart_objects::SmartObject& msg_params);
+ void GetProviderFromService(const AppService& service,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service);
+
+ /**
+ * @brief Get the policy app ID of the default service provider for a given
+ * service type.
+ * @param service_type - The service type
+ * @return The policy app ID of the default service provider for the given
+ * service type on success, "" on failure
+ */
+ std::string DefaultServiceByType(const std::string service_type);
+ AppService* FindServiceByPolicyAppID(const std::string policy_app_id,
+ const std::string type);
+
+ /**
+ * @brief Get the service of a given type published by a given provider.
+ * @param connection_key - The connection key of the service provider
+ * @param service_type - The service type
+ * @return A pointer to requested service on success, NULL on failure
+ */
+ AppService* FindServiceByProvider(const uint32_t connection_key,
+ const std::string service_type);
+ AppService* FindServiceByName(std::string name);
+ std::string GetPolicyAppID(AppService service);
+};
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_SERVICE_MANAGER_H_
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index 97f0c96735..0ca7a0af40 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -33,22 +33,25 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_H_
-#include <string>
+#include <list>
#include <map>
+#include <memory>
#include <set>
-#include <list>
+#include <string>
#include <vector>
-#include "utils/shared_ptr.h"
-#include "utils/data_accessor.h"
-#include "interfaces/MOBILE_API.h"
-#include "connection_handler/device.h"
+
#include "application_manager/app_extension.h"
-#include "application_manager/message.h"
-#include "application_manager/hmi_state.h"
#include "application_manager/application_state.h"
+#include "application_manager/help_prompt_manager.h"
+#include "application_manager/hmi_state.h"
+#include "application_manager/message.h"
+#include "connection_handler/device.h"
+#include "interfaces/MOBILE_API.h"
#include "protocol_handler/protocol_handler.h"
#include "smart_objects/smart_object.h"
+#include "utils/data_accessor.h"
#include "utils/macro.h"
+#include "utils/semantic_version.h"
namespace application_manager {
@@ -59,13 +62,17 @@ typedef int32_t ErrorCode;
class UsageStatistics;
+class DisplayCapabilitiesBuilder;
+
enum APIVersion {
kUnknownAPI = -1,
kAPIV0 = 0,
kAPIV1 = 1,
kAPIV2 = 2,
kAPIV3 = 3,
- kAPIV4 = 4
+ kAPIV4 = 4,
+ kAPIV5 = 5,
+ kAPIV6 = 6
};
enum TLimitSource { POLICY_TABLE = 0, CONFIG_FILE };
@@ -113,6 +120,7 @@ class InitialApplicationData {
virtual const smart_objects::SmartObject* ngn_media_screen_name() const = 0;
virtual const mobile_api::Language::eType& language() const = 0;
virtual const mobile_api::Language::eType& ui_language() const = 0;
+ virtual const utils::SemanticVersion& msg_version() const = 0;
virtual void set_app_types(const smart_objects::SmartObject& app_types) = 0;
virtual void set_vr_synonyms(
const smart_objects::SmartObject& vr_synonyms) = 0;
@@ -123,6 +131,7 @@ class InitialApplicationData {
virtual void set_language(const mobile_api::Language::eType& language) = 0;
virtual void set_ui_language(
const mobile_api::Language::eType& ui_language) = 0;
+ virtual void set_msg_version(const utils::SemanticVersion& version) = 0;
};
/*
@@ -141,6 +150,12 @@ typedef std::map<uint32_t, smart_objects::SmartObject*> SubMenuMap;
typedef std::map<uint32_t, smart_objects::SmartObject*> ChoiceSetMap;
/*
+ * @brief Typedef for map of window ids to data used as parameters
+ * to CreateWindow request.
+ */
+typedef std::map<WindowID, smart_objects::SmartObjectSPtr> WindowParamsMap;
+
+/*
* @brief Typedef for perform interaction choice
* @param choice id
* @param SmartObject choice
@@ -157,7 +172,7 @@ typedef std::map<uint32_t, PerformChoice> PerformChoiceSetMap;
/**
* @brief Defines id of SoftButton
*/
-typedef std::set<uint32_t> SoftButtonID;
+typedef std::set<std::pair<uint32_t, WindowID> > SoftButtonID;
/**
* @brief Defines set of buttons subscription
@@ -183,9 +198,25 @@ class DynamicApplicationData {
virtual const smart_objects::SmartObject* keyboard_props() const = 0;
virtual const smart_objects::SmartObject* menu_title() const = 0;
virtual const smart_objects::SmartObject* menu_icon() const = 0;
- virtual const smart_objects::SmartObject* day_color_scheme() const = 0;
- virtual const smart_objects::SmartObject* night_color_scheme() const = 0;
- virtual const std::string& display_layout() const = 0;
+ virtual smart_objects::SmartObject day_color_scheme() const = 0;
+ virtual smart_objects::SmartObject night_color_scheme() const = 0;
+ virtual std::string display_layout() const = 0;
+
+ /**
+ * @brief Specific display capabilities of application
+ * @return display capabilities of application or NULL-initialized pointer if
+ * not specified
+ */
+ virtual smart_objects::SmartObjectSPtr display_capabilities() const = 0;
+
+ /**
+ * @brief Specific display capabilities of application
+ * @param window id - id of an affected widget
+ * @return display capabilities of application or NULL-initialized pointer if
+ * not specified
+ */
+ virtual smart_objects::SmartObjectSPtr display_capabilities(
+ const WindowID window_id) const = 0;
virtual void load_global_properties(const smart_objects::SmartObject& so) = 0;
virtual void set_help_prompt(
@@ -217,12 +248,84 @@ class DynamicApplicationData {
virtual void set_video_stream_retry_number(
const uint32_t& video_stream_retry_number) = 0;
+ virtual void set_display_layout(const std::string& layout) = 0;
virtual void set_day_color_scheme(
const smart_objects::SmartObject& color_scheme) = 0;
virtual void set_night_color_scheme(
const smart_objects::SmartObject& color_scheme) = 0;
- virtual void set_display_layout(const std::string& layout) = 0;
+ /**
+ * @brief Set specific application display capabilities
+ * @param display_capabilities new display capabilities of application
+ */
+ virtual void set_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) = 0;
+
+ /**
+ * @brief deletes stored window capability for given window id
+ * @param window id of capability to remove
+ */
+ virtual void remove_window_capability(const WindowID window_id) = 0;
+
+ /**
+ * @brief checks whether a specific menu layout is supported
+ * @param menu layout to check
+ */
+ virtual bool menu_layout_supported(
+ const mobile_apis::MenuLayout::eType layout) const = 0;
+
+ /**
+ * @brief Sets layout for application's specific window
+ * @param window_id window id for which layout should be set
+ * @param layout - layout to be set
+ */
+ virtual void set_window_layout(const WindowID window_id,
+ const std::string& layout) = 0;
+
+ /**
+ * @brief Sets day color scheme for application's specific window
+ * @param window_id window id for which day color scheme should be set
+ * @param color_scheme - color scheme to be set
+ */
+ virtual void set_day_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) = 0;
+
+ /**
+ * @brief Sets night color scheme for application's specific window
+ * @param window_id window id for which night color scheme should be set
+ * @param color_scheme - color scheme to be set
+ */
+ virtual void set_night_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) = 0;
+
+ /**
+ * @brief Gets window layout for application's specific window_id
+ * @param window_id window id for which display layout should be returned
+ * @return string containing set display layout,
+ * if no display layout is set - empty string is returned
+ */
+ virtual std::string window_layout(const WindowID window_id) const = 0;
+
+ /**
+ * @brief Gets day color scheme for application's specific window_id
+ * @param window_id window id for which color scheme should be returned
+ * @return day color scheme which is set for specified app window,
+ * if no day color scheme is set - Smart object with NullType is returned
+ */
+ virtual smart_objects::SmartObject day_color_scheme(
+ const WindowID window_id) const = 0;
+
+ /**
+ * @brief Gets night color scheme for application's specific window_id
+ * @param window_id window id for which color scheme should be returned
+ * @return night color scheme which is set for specified app window
+ * if no night color scheme is set - Smart object with NullType is returned
+ */
+ virtual smart_objects::SmartObject night_color_scheme(
+ const WindowID window_id) const = 0;
+
/**
* @brief Checks if application is media, voice communication or navigation
* @return true if application is media, voice communication or navigation,
@@ -231,8 +334,8 @@ class DynamicApplicationData {
virtual bool is_audio() const = 0;
/*
- * @brief Adds a command to the in application menu
- */
+ * @brief Adds a command to the in application menu
+ */
virtual void AddCommand(uint32_t cmd_id,
const smart_objects::SmartObject& command) = 0;
@@ -285,6 +388,20 @@ class DynamicApplicationData {
virtual void RemoveChoiceSet(uint32_t choice_set_id) = 0;
/*
+ * @brief Adds window info
+ * @param window_id unique id of a window
+ * @param window_info SmartObject that represent window info
+ */
+ virtual void SetWindowInfo(const WindowID window_id,
+ const smart_objects::SmartObject& window_info) = 0;
+
+ /*
+ * @brief Removes window info
+ * @param window_id unique id of a window
+ */
+ virtual void RemoveWindowInfo(const WindowID window_id) = 0;
+
+ /*
* @brief Finds choice set with the specified choice_set_id id
*
* @param choice_set_id Unique ID of the interaction choice set
@@ -319,6 +436,16 @@ class DynamicApplicationData {
const = 0;
/*
+ * @brief Retrieves window info map
+ */
+ virtual DataAccessor<WindowParamsMap> window_optional_params_map() const = 0;
+
+ /*
+ * @brief Retrieves display capabilities builder
+ */
+ virtual DisplayCapabilitiesBuilder& display_capabilities_builder() = 0;
+
+ /*
* @brief Retrieve application commands
*/
virtual DataAccessor<CommandsMap> commands_map() const = 0;
@@ -348,10 +475,10 @@ class DynamicApplicationData {
virtual uint32_t is_perform_interaction_active() const = 0;
/*
- * @brief Set perform interaction layout
- *
- * @param Current Interaction layout of the perform interaction
- */
+ * @brief Set perform interaction layout
+ *
+ * @param Current Interaction layout of the perform interaction
+ */
virtual void set_perform_interaction_layout(
mobile_api::LayoutMode::eType layout) = 0;
@@ -361,10 +488,10 @@ class DynamicApplicationData {
virtual mobile_api::LayoutMode::eType perform_interaction_layout() const = 0;
/*
- * @brief Sets the mode for perform interaction: UI/VR/BOTH
- *
- * @param mode Mode that was selected (MENU; VR; BOTH)
- */
+ * @brief Sets the mode for perform interaction: UI/VR/BOTH
+ *
+ * @param mode Mode that was selected (MENU; VR; BOTH)
+ */
virtual void set_perform_interaction_mode(int32_t mode) = 0;
/*
@@ -444,6 +571,20 @@ class Application : public virtual InitialApplicationData,
*/
virtual void set_is_application_data_changed(bool state_application_data) = 0;
+ /**
+ * @brief Checks if application data is allowed to be resumed
+ * @return TRUE if data of application is allowed to be resumed, otherwise
+ * return FALSE
+ */
+ virtual bool is_app_data_resumption_allowed() const = 0;
+
+ /**
+ * @brief Sets resumption allowance for application data
+ * @param allowed - true if app data allowed to be resumed,
+ * false value means that app data is disallowed for resumption
+ */
+ virtual void set_app_data_resumption_allowance(const bool allowed) = 0;
+
virtual void CloseActiveMessage() = 0;
virtual bool IsFullscreen() const = 0;
virtual void ChangeSupportingAppHMIType() = 0;
@@ -515,8 +656,10 @@ class Application : public virtual InitialApplicationData,
/**
* @brief Wakes up streaming process for application
* @param service_type Type of streaming service
+ * @param timer_len The amount of time in ms the timer will wait
*/
- virtual void WakeUpStreaming(protocol_handler::ServiceType service_type) = 0;
+ virtual void WakeUpStreaming(protocol_handler::ServiceType service_type,
+ uint32_t timer_len = 0) = 0;
virtual bool is_voice_communication_supported() const = 0;
virtual void set_voice_communication_supported(
@@ -540,17 +683,38 @@ class Application : public virtual InitialApplicationData,
virtual bool is_media_application() const = 0;
virtual bool is_foreground() const = 0;
virtual void set_foreground(const bool is_foreground) = 0;
- virtual const mobile_api::HMILevel::eType hmi_level() const = 0;
+
+ /**
+ * @brief hmi_level current HMI level of application's window
+ * @param window_id id of application's window to get
+ * @return HMI level of application's window
+ */
+ virtual const mobile_api::HMILevel::eType hmi_level(
+ const WindowID window_id) const = 0;
+
virtual const uint32_t put_file_in_none_count() const = 0;
virtual const uint32_t delete_file_in_none_count() const = 0;
virtual const uint32_t list_files_in_none_count() const = 0;
- virtual const mobile_api::SystemContext::eType system_context() const = 0;
+
+ /**
+ * @brief system_context current system context of application's window
+ * @param window_id id of application's window to get
+ * @return system context of application's window
+ */
+ virtual const mobile_api::SystemContext::eType system_context(
+ const WindowID window_id) const = 0;
virtual const mobile_api::AudioStreamingState::eType audio_streaming_state()
const = 0;
virtual const mobile_api::VideoStreamingState::eType video_streaming_state()
const = 0;
virtual const std::string& app_icon_path() const = 0;
virtual connection_handler::DeviceHandle device() const = 0;
+ /**
+ * @brief Returns handle of the device on which secondary transport of this
+ * app is running
+ * @return handle of the device on which secondary transport is running
+ */
+ virtual connection_handler::DeviceHandle secondary_device() const = 0;
/**
* @brief sets true if application has sent TTS GlobalProperties
@@ -578,6 +742,18 @@ class Application : public virtual InitialApplicationData,
* @return flag tts_properties_in_full
*/
virtual bool tts_properties_in_full() = 0;
+ /**
+ * @brief sets true if application should keep it's HMI Level after an audio
+ * source change
+ * @param value of keep context
+ */
+ virtual void set_keep_context(bool keep_context) = 0;
+ /**
+ * @brief returns true if application should keep keep it's HMI Level after
+ * an audio source change, otherwise return false
+ * @return value of keep_context flag
+ */
+ virtual bool keep_context() = 0;
virtual void set_version(const Version& version) = 0;
virtual void set_name(const custom_str::CustomString& name) = 0;
virtual void set_is_media_application(bool is_media) = 0;
@@ -586,8 +762,13 @@ class Application : public virtual InitialApplicationData,
virtual void increment_list_files_in_none_count() = 0;
virtual bool set_app_icon_path(const std::string& file_name) = 0;
virtual void set_app_allowed(const bool allowed) = 0;
- DEPRECATED virtual void set_device(
- connection_handler::DeviceHandle device) = 0;
+ /**
+ * @brief Sets the handle of the device on which secondary transport of this
+ * app is running
+ * @param handle of the device on which secondary transport is running
+ */
+ virtual void set_secondary_device(
+ connection_handler::DeviceHandle secondary_device) = 0;
virtual uint32_t get_grammar_id() const = 0;
virtual void set_grammar_id(uint32_t value) = 0;
@@ -598,6 +779,24 @@ class Application : public virtual InitialApplicationData,
virtual void set_is_resuming(bool is_resuming) = 0;
virtual bool is_resuming() const = 0;
+ /**
+ * @brief Remembers the HMI level which the app would resume into if high-
+ * bandwidth transport were available.
+ * @param level The HMI level which the app would resume into. Specify
+ * INVALID_ENUM to clear the state.
+ */
+ virtual void set_deferred_resumption_hmi_level(
+ mobile_api::HMILevel::eType level) = 0;
+ /**
+ * @brief Returns the HMI level which the app would resume into if high-
+ * bandwidth transport were available.
+ *
+ * A value of INVALID_ENUM indicates that the app does not have deferred
+ * HMI level.
+ * @return HMI level which the app would resume into
+ */
+ virtual mobile_api::HMILevel::eType deferred_resumption_hmi_level() const = 0;
+
virtual bool AddFile(const AppFile& file) = 0;
virtual const AppFilesMap& getAppFiles() const = 0;
@@ -640,68 +839,114 @@ class Application : public virtual InitialApplicationData,
virtual UsageStatistics& usage_report() = 0;
/**
+ * @brief Access to HelpPromptManager interface
+ * @return object for Handling VR help
+ */
+ virtual HelpPromptManager& help_prompt_manager() = 0;
+
+ /**
* @brief SetInitialState sets initial HMI state for application on
* registration
+ * @param window_id window id for HMI state
+ * @param window_name name of inited window
* @param state Hmi state value
*/
- virtual void SetInitialState(HmiStatePtr state) = 0;
+ virtual void SetInitialState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) = 0;
/**
* @brief SetRegularState set permanent state of application
- *
+ * @param window_id window id for HMI state
* @param state state to setup
*/
- virtual void SetRegularState(HmiStatePtr state) = 0;
+ virtual void SetRegularState(const WindowID window_id, HmiStatePtr state) = 0;
/**
- * @brief SetPostponedState sets postponed state to application.
- * This state could be set as regular later
- *
- * @param state state to setup
- */
- virtual void SetPostponedState(HmiStatePtr state) = 0;
+ * @brief SetPostponedState sets postponed state to application.
+ * This state could be set as regular later
+ * @param window_id window id for HMI state
+ * @param state state to setup
+ */
+ virtual void SetPostponedState(const WindowID window_id,
+ HmiStatePtr state) = 0;
- virtual void RemovePostponedState() = 0;
+ /**
+ * @brief RemovePostponedState removes postponed state for application
+ * After removal, this state will not be set as regular later
+ * @param window_id window id for HMI state
+ */
+ virtual void RemovePostponedState(const WindowID window_id) = 0;
/**
* @brief AddHMIState the function that will change application's
* hmi state.
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state
*
* @param state new hmi state for certain application.
*/
- virtual void AddHMIState(HmiStatePtr state) = 0;
+ virtual void AddHMIState(const WindowID window_id, HmiStatePtr state) = 0;
/**
* @brief RemoveHMIState the function that will turn back hmi_level after end
* of some event
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state
*
* @param state_id that should be removed
*/
- virtual void RemoveHMIState(HmiState::StateID state_id) = 0;
+ virtual void RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) = 0;
/**
* @brief HmiState of application within active events PhoneCall, TTS< etc ...
+ * @param window_id window id for HMI state
* @return Active HmiState of application
*/
- virtual const HmiStatePtr CurrentHmiState() const = 0;
+ virtual const HmiStatePtr CurrentHmiState(const WindowID window_id) const = 0;
+
+ /**
+ * @brief Getter for a list of available application windows including the
+ * main
+ * @return list of available window IDs created by application
+ */
+ virtual WindowIds GetWindowIds() const = 0;
+
+ /**
+ * @brief Getter for a list of all existing window names
+ * @return list of available window names created by application
+ */
+ virtual WindowNames GetWindowNames() const = 0;
+
+ /**
+ * @brief Check if application has specified window
+ * @param window_id - id of window to check
+ * @return true if app has specified window , otherwise false
+ */
+ virtual bool WindowIdExists(const WindowID window_id) const = 0;
/**
* @brief RegularHmiState of application without active events VR, TTS etc ...
+ * @param window_id window id for HMI state
* @return HmiState of application
*/
- virtual const HmiStatePtr RegularHmiState() const = 0;
+ virtual const HmiStatePtr RegularHmiState(const WindowID window_id) const = 0;
+
+ /**
+ * @brief Checks if app is allowed to change audio source
+ * @return True - if allowed, otherwise - False
+ */
+ virtual bool IsAllowedToChangeAudioSource() const = 0;
/**
* @brief PostponedHmiState returns postponed hmi state of application
* if it's present
- *
+ * @param window_id window id for HMI state
* @return Postponed hmi state of application
*/
- virtual const HmiStatePtr PostponedHmiState() const = 0;
+ virtual const HmiStatePtr PostponedHmiState(
+ const WindowID window_id) const = 0;
/**
* @brief Keeps id of softbuttons which is created in commands:
@@ -714,6 +959,13 @@ class Application : public virtual InitialApplicationData,
const SoftButtonID& softbuttons_id) = 0;
/**
+ * @brief Retreives window id on which given button is created
+ * @param button_id identifier of a button
+ * @param window id of a widget containing button
+ */
+ virtual WindowID GetSoftButtonWindowID(const uint32_t button_id) = 0;
+
+ /**
* @brief Determine the existence of softbutton
* @param Softbutton_id contains id of softbutton
* @return Returns true if application contains softbutton id otherwise
@@ -743,16 +995,6 @@ class Application : public virtual InitialApplicationData,
virtual bool IsVideoApplication() const = 0;
/**
- * DEPRECATED
- * @brief GetDeviceId allows to obtain device id which posseses
- * by this application.
- * @return device the device id.
- */
- std::string GetDeviceId() const {
- return device_id_;
- }
-
- /**
* @brief IsRegistered allows to distinguish if this
* application has been registered.
*
@@ -853,9 +1095,11 @@ class Application : public virtual InitialApplicationData,
/**
* @brief set_system_context Set system context for application
+ * @param window_id window id for HMI state
* @param system_context Current context
*/
virtual void set_system_context(
+ const WindowID window_id,
const mobile_api::SystemContext::eType& system_context) = 0;
/**
@@ -867,9 +1111,11 @@ class Application : public virtual InitialApplicationData,
/**
* @brief set_hmi_level Set HMI level for application
+ * @param window_id window id for HMI state
* @param hmi_level Current HMI level
*/
- virtual void set_hmi_level(const mobile_api::HMILevel::eType& hmi_level) = 0;
+ virtual void set_hmi_level(const WindowID window_id,
+ const mobile_api::HMILevel::eType& hmi_level) = 0;
/**
* @brief Return pointer to extension by uid
@@ -899,6 +1145,86 @@ class Application : public virtual InitialApplicationData,
virtual const std::list<AppExtensionPtr>& Extensions() const = 0;
/**
+ * @brief Get cloud app endpoint for websocket connection
+ * @return cloud app endpoint
+ */
+ virtual const std::string& cloud_app_endpoint() const = 0;
+
+ /**
+ * @brief Get cloud app auth token to be used in connection handshake after
+ * websocket open.
+ * @return cloud app auth token
+ */
+ virtual const std::string& auth_token() const = 0;
+
+ /**
+ * @brief Get cloud app transport type. Defines the type of websocket
+ * connection used.
+ * @return cloud app transport type
+ */
+ virtual const std::string& cloud_app_transport_type() const = 0;
+
+ /**
+ * @brief Get hybrid app preference. Defines behaviour for when a similar
+ * mobile and cloud app are connected simultaneously.
+ * @return hybrid app preference
+ */
+ virtual const mobile_apis::HybridAppPreference::eType& hybrid_app_preference()
+ const = 0;
+
+ /**
+ * @brief Get cloud app certificate. Used for secured websocket connections.
+ * @return cloud app certificate.
+ */
+ virtual const std::string& cloud_app_certificate() const = 0;
+
+ /**
+ * @brief Check whether the given application is a cloud app.
+ * @return true if the application is a cloud application, false otherwise.
+ */
+ virtual bool is_cloud_app() const = 0;
+
+ /**
+ * @brief Set cloud app endpoint
+ */
+ virtual void set_cloud_app_endpoint(const std::string& endpoint) = 0;
+
+ /**
+ * @brief Set cloud app auth token
+ */
+ virtual void set_auth_token(const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set cloud app transport type
+ */
+ virtual void set_cloud_app_transport_type(
+ const std::string& transport_type) = 0;
+
+ /**
+ * @brief Set hybrid app preference
+ */
+ virtual void set_hybrid_app_preference(
+ const mobile_apis::HybridAppPreference::eType& hybrid_app_preference) = 0;
+
+ /**
+ * @brief Set cloud app certificate
+ */
+ virtual void set_cloud_app_certificate(const std::string& certificate) = 0;
+
+ /**
+ * @brief Set user location
+ * @param smart object of user location
+ */
+ virtual void set_user_location(
+ const smart_objects::SmartObject& user_location) = 0;
+
+ /**
+ * @brief Get user location
+ * @return smart object of user location
+ */
+ virtual const smart_objects::SmartObject& get_user_location() const = 0;
+
+ /**
* @brief Update internal state to indicate whether setup is running or not.
*
* The method WaitForSetupDone() will block when setup is running. Also, the
@@ -928,8 +1254,8 @@ class Application : public virtual InitialApplicationData,
bool is_greyed_out_;
};
-typedef utils::SharedPtr<Application> ApplicationSharedPtr;
-typedef utils::SharedPtr<const Application> ApplicationConstSharedPtr;
+typedef std::shared_ptr<Application> ApplicationSharedPtr;
+typedef std::shared_ptr<const Application> ApplicationConstSharedPtr;
typedef uint32_t ApplicationId;
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/application_data_impl.h b/src/components/application_manager/include/application_manager/application_data_impl.h
index 8da8dec8f1..5f62c8d5b5 100644
--- a/src/components/application_manager/include/application_manager/application_data_impl.h
+++ b/src/components/application_manager/include/application_manager/application_data_impl.h
@@ -34,10 +34,12 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_DATA_IMPL_H_
#include <string>
-#include "utils/lock.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/application.h"
+#include "application_manager/display_capabilities_builder.h"
#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+#include "utils/lock.h"
+#include "utils/semantic_version.h"
namespace application_manager {
@@ -55,6 +57,7 @@ class InitialApplicationDataImpl : public virtual Application {
const smart_objects::SmartObject* ngn_media_screen_name() const;
const mobile_api::Language::eType& language() const;
const mobile_api::Language::eType& ui_language() const;
+ const utils::SemanticVersion& msg_version() const;
void set_app_types(const smart_objects::SmartObject& app_types);
void set_vr_synonyms(const smart_objects::SmartObject& vr_synonyms);
@@ -63,6 +66,7 @@ class InitialApplicationDataImpl : public virtual Application {
void set_ngn_media_screen_name(const smart_objects::SmartObject& ngn_name);
void set_language(const mobile_api::Language::eType& language);
void set_ui_language(const mobile_api::Language::eType& ui_language);
+ void set_msg_version(const utils::SemanticVersion& version);
void set_perform_interaction_layout(
mobile_api::LayoutMode::eType layout) OVERRIDE;
@@ -77,6 +81,7 @@ class InitialApplicationDataImpl : public virtual Application {
mobile_api::Language::eType language_;
mobile_api::Language::eType ui_language_;
mobile_apis::LayoutMode::eType perform_interaction_layout_;
+ utils::SemanticVersion msg_version_;
private:
DISALLOW_COPY_AND_ASSIGN(InitialApplicationDataImpl);
@@ -84,6 +89,7 @@ class InitialApplicationDataImpl : public virtual Application {
class DynamicApplicationDataImpl : public virtual Application {
public:
+ typedef std::map<WindowID, smart_objects::SmartObject> AppWindowsTemplates;
DynamicApplicationDataImpl();
~DynamicApplicationDataImpl();
const smart_objects::SmartObject* help_prompt() const;
@@ -96,9 +102,31 @@ class DynamicApplicationDataImpl : public virtual Application {
const smart_objects::SmartObject* keyboard_props() const;
const smart_objects::SmartObject* menu_title() const;
const smart_objects::SmartObject* menu_icon() const;
- const smart_objects::SmartObject* day_color_scheme() const;
- const smart_objects::SmartObject* night_color_scheme() const;
- const std::string& display_layout() const;
+
+ smart_objects::SmartObject day_color_scheme() const OVERRIDE;
+ smart_objects::SmartObject night_color_scheme() const OVERRIDE;
+ std::string display_layout() const OVERRIDE;
+ smart_objects::SmartObjectSPtr display_capabilities() const OVERRIDE;
+ smart_objects::SmartObjectSPtr display_capabilities(
+ const WindowID window_id) const OVERRIDE;
+
+ void set_window_layout(const WindowID window_id,
+ const std::string& layout) OVERRIDE;
+
+ void set_day_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) OVERRIDE;
+ void set_night_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) OVERRIDE;
+
+ std::string window_layout(const WindowID window_id) const OVERRIDE;
+
+ smart_objects::SmartObject day_color_scheme(
+ const WindowID window_id) const OVERRIDE;
+
+ smart_objects::SmartObject night_color_scheme(
+ const WindowID window_id) const OVERRIDE;
void load_global_properties(const smart_objects::SmartObject& properties_so);
void set_help_prompt(const smart_objects::SmartObject& help_prompt);
@@ -116,21 +144,37 @@ class DynamicApplicationDataImpl : public virtual Application {
void set_day_color_scheme(const smart_objects::SmartObject& color_scheme);
void set_night_color_scheme(const smart_objects::SmartObject& color_scheme);
void set_display_layout(const std::string& layout);
+ void set_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) OVERRIDE;
+ void remove_window_capability(const WindowID window_id) OVERRIDE;
+
+ /**
+ * @brief checks whether a specific menu layout is supported
+ * @param menu layout to check
+ */
+ bool menu_layout_supported(
+ const mobile_apis::MenuLayout::eType layout) const OVERRIDE;
+
/*
- * @brief Adds a command to the in application menu
+ * @brief Adds a command to the application menu
+ * @param[in] internal_id Internal consecutive command id
+ * @param[in] command Command to add
*/
- void AddCommand(uint32_t cmd_id, const smart_objects::SmartObject& command);
+ void AddCommand(const uint32_t internal_id,
+ const smart_objects::SmartObject& command);
/*
* @brief Deletes all commands from the application menu with the specified
* command id
+ * @param[in] cmd_id Command id
*/
- void RemoveCommand(uint32_t cmd_id);
+ void RemoveCommand(const uint32_t cmd_id);
/*
* @brief Finds command with the specified command id
+ * @param[in] cmd_id Command id
*/
- smart_objects::SmartObject* FindCommand(uint32_t cmd_id);
+ smart_objects::SmartObject* FindCommand(const uint32_t cmd_id);
/*
* @brief Adds a menu to the application
@@ -152,6 +196,11 @@ class DynamicApplicationDataImpl : public virtual Application {
*/
bool IsSubMenuNameAlreadyExist(const std::string& name);
+ void SetWindowInfo(const WindowID window_id,
+ const smart_objects::SmartObject& window_info) OVERRIDE;
+
+ void RemoveWindowInfo(const WindowID window_id) OVERRIDE;
+
/*
* @brief Adds a interaction choice set to the application
*
@@ -217,6 +266,10 @@ class DynamicApplicationDataImpl : public virtual Application {
*/
inline DataAccessor<ChoiceSetMap> choice_set_map() const;
+ DataAccessor<WindowParamsMap> window_optional_params_map() const;
+
+ DisplayCapabilitiesBuilder& display_capabilities_builder();
+
/*
* @brief Sets perform interaction state
*
@@ -270,28 +323,30 @@ class DynamicApplicationDataImpl : public virtual Application {
smart_objects::SmartObject* menu_title_;
smart_objects::SmartObject* menu_icon_;
smart_objects::SmartObject* tbt_show_command_;
- smart_objects::SmartObject* day_color_scheme_;
- smart_objects::SmartObject* night_color_scheme_;
- std::string display_layout_;
+ smart_objects::SmartObjectSPtr display_capabilities_;
+ AppWindowsTemplates window_templates_;
CommandsMap commands_;
- mutable std::shared_ptr<sync_primitives::Lock> commands_lock_ptr_;
+ mutable std::shared_ptr<sync_primitives::RecursiveLock> commands_lock_ptr_;
SubMenuMap sub_menu_;
mutable std::shared_ptr<sync_primitives::Lock> sub_menu_lock_ptr_;
ChoiceSetMap choice_set_map_;
mutable std::shared_ptr<sync_primitives::Lock> choice_set_map_lock_ptr_;
PerformChoiceSetMap performinteraction_choice_set_map_;
- mutable std::shared_ptr<sync_primitives::Lock>
+ mutable std::shared_ptr<sync_primitives::RecursiveLock>
performinteraction_choice_set_lock_ptr_;
+ WindowParamsMap window_params_map_;
+ mutable std::shared_ptr<sync_primitives::Lock> window_params_map_lock_ptr_;
uint32_t is_perform_interaction_active_;
bool is_reset_global_properties_active_;
int32_t perform_interaction_mode_;
+ DisplayCapabilitiesBuilder display_capabilities_builder_;
private:
void SetGlobalProperties(
const smart_objects::SmartObject& param,
void (DynamicApplicationData::*callback)(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject&));
+ const ns_smart_device_link::ns_smart_objects::SmartObject&));
DISALLOW_COPY_AND_ASSIGN(DynamicApplicationDataImpl);
};
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index 435aae6b95..0eacb18af9 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -33,26 +33,28 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_IMPL_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_IMPL_H_
+#include <stdint.h>
+#include <forward_list>
+#include <list>
#include <map>
#include <set>
-#include <vector>
#include <utility>
-#include <list>
-#include <forward_list>
-#include <stdint.h>
+#include <vector>
-#include "utils/date_time.h"
+#include "application_manager/application.h"
#include "application_manager/application_data_impl.h"
-#include "application_manager/usage_statistics.h"
+#include "application_manager/help_prompt_manager_impl.h"
#include "application_manager/hmi_state.h"
+#include "application_manager/usage_statistics.h"
#include "protocol_handler/protocol_handler.h"
+#include <atomic>
#include "connection_handler/device.h"
-#include "utils/lock.h"
-#include "utils/atomic_object.h"
#include "utils/custom_string.h"
-#include "utils/timer.h"
+#include "utils/date_time.h"
+#include "utils/lock.h"
#include "utils/macro.h"
+#include "utils/timer.h"
namespace usage_statistics {
@@ -89,15 +91,7 @@ class ApplicationImpl : public virtual Application,
const std::string& mac_address,
const connection_handler::DeviceHandle device_id,
const custom_str::CustomString& app_name,
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
- ApplicationManager& application_manager);
-
- DEPRECATED ApplicationImpl(
- uint32_t application_id,
- const std::string& policy_app_id,
- const std::string& mac_address,
- const custom_str::CustomString& app_name,
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager,
ApplicationManager& application_manager);
~ApplicationImpl();
@@ -145,7 +139,8 @@ class ApplicationImpl : public virtual Application,
void StopStreamingForce(protocol_handler::ServiceType service_type);
void StopStreaming(protocol_handler::ServiceType service_type);
void SuspendStreaming(protocol_handler::ServiceType service_type);
- void WakeUpStreaming(protocol_handler::ServiceType service_type);
+ void WakeUpStreaming(protocol_handler::ServiceType service_type,
+ uint32_t timer_len = 0);
virtual bool is_voice_communication_supported() const;
virtual void set_voice_communication_supported(
@@ -164,17 +159,20 @@ class ApplicationImpl : public virtual Application,
bool is_media_application() const;
bool is_foreground() const OVERRIDE;
void set_foreground(const bool is_foreground) OVERRIDE;
- const mobile_apis::HMILevel::eType hmi_level() const;
+ const mobile_apis::HMILevel::eType hmi_level(
+ const WindowID window_id) const OVERRIDE;
const uint32_t put_file_in_none_count() const;
const uint32_t delete_file_in_none_count() const;
const uint32_t list_files_in_none_count() const;
- const mobile_api::SystemContext::eType system_context() const;
+ const mobile_api::SystemContext::eType system_context(
+ const WindowID window_id) const OVERRIDE;
inline const mobile_apis::AudioStreamingState::eType audio_streaming_state()
const;
inline const mobile_apis::VideoStreamingState::eType video_streaming_state()
const;
const std::string& app_icon_path() const;
connection_handler::DeviceHandle device() const;
+ connection_handler::DeviceHandle secondary_device() const;
const std::string& mac_address() const OVERRIDE;
const std::string& bundle_id() const OVERRIDE;
void set_bundle_id(const std::string& bundle_id) OVERRIDE;
@@ -182,6 +180,8 @@ class ApplicationImpl : public virtual Application,
bool tts_properties_in_none();
void set_tts_properties_in_full(bool active);
bool tts_properties_in_full();
+ void set_keep_context(bool keep_context);
+ bool keep_context();
void set_version(const Version& ver);
void set_name(const custom_str::CustomString& name);
void set_is_media_application(bool is_media);
@@ -191,6 +191,7 @@ class ApplicationImpl : public virtual Application,
bool set_app_icon_path(const std::string& path);
void set_app_allowed(const bool allowed);
void set_device(connection_handler::DeviceHandle device);
+ void set_secondary_device(connection_handler::DeviceHandle secondary_device);
virtual uint32_t get_grammar_id() const;
virtual void set_grammar_id(uint32_t value);
bool is_audio() const OVERRIDE;
@@ -202,6 +203,24 @@ class ApplicationImpl : public virtual Application,
virtual void set_is_resuming(bool is_resuming);
virtual bool is_resuming() const;
+ /**
+ * @brief Remembers the HMI level which the app would resume into if high-
+ * bandwidth transport were available.
+ * @param level The HMI level which the app would resume into. Specify
+ * INVALID_ENUM to clear the state.
+ */
+ void set_deferred_resumption_hmi_level(
+ mobile_api::HMILevel::eType level) OVERRIDE;
+ /**
+ * @brief Returns the HMI level which the app would resume into if high-
+ * bandwidth transport were available.
+ *
+ * A value of INVALID_ENUM indicates that the app does not have deferred
+ * HMI level.
+ * @return HMI level which the app would resume into
+ */
+ mobile_api::HMILevel::eType deferred_resumption_hmi_level() const OVERRIDE;
+
bool AddFile(const AppFile& file);
bool UpdateFile(const AppFile& file);
bool DeleteFile(const std::string& file_name);
@@ -213,6 +232,8 @@ class ApplicationImpl : public virtual Application,
bool IsSubscribedToButton(mobile_apis::ButtonName::eType btn_name);
bool UnsubscribeFromButton(mobile_apis::ButtonName::eType btn_name);
+ WindowID GetSoftButtonWindowID(const uint32_t button_id) OVERRIDE;
+
inline bool IsRegistered() const OVERRIDE;
/**
@@ -247,6 +268,12 @@ class ApplicationImpl : public virtual Application,
UsageStatistics& usage_report();
+ /**
+ * @brief Access to HelpPromptManager interface
+ * @return object for Handling VR help
+ */
+ HelpPromptManager& help_prompt_manager() OVERRIDE;
+
bool AreCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id,
TLimitSource source);
virtual void SubscribeToSoftButtons(int32_t cmd_id,
@@ -257,6 +284,9 @@ class ApplicationImpl : public virtual Application,
virtual bool is_application_data_changed() const;
+ bool is_app_data_resumption_allowed() const OVERRIDE;
+ void set_app_data_resumption_allowance(const bool allowed) OVERRIDE;
+
virtual void set_is_application_data_changed(bool state_application_data);
/**
@@ -277,26 +307,35 @@ class ApplicationImpl : public virtual Application,
/**
* @brief SetInitialState sets initial HMI state for application on
* registration
+ * @param window_id window id for HMI state
+ * @param window_name name of inited window
* @param state Hmi state value
*/
- void SetInitialState(HmiStatePtr state) FINAL;
+ void SetInitialState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) FINAL;
/**
- * @brief SetRegularState set permanent state of application
- *
- * @param state state to setup
- */
- virtual void SetRegularState(HmiStatePtr state);
+ * @brief SetRegularState set permanent state of application
+ * @param window_id window id for HMI state
+ * @param state state to setup
+ */
+ void SetRegularState(const WindowID window_id, HmiStatePtr state) FINAL;
/**
- * @brief SetPostponedState sets postponed state to application.
- * This state could be set as regular later
- *
- * @param state state to setup
- */
- virtual void SetPostponedState(HmiStatePtr state);
+ * @brief SetPostponedState sets postponed state to application.
+ * This state could be set as regular later
+ * @param window_id window id for HMI state
+ * @param state state to setup
+ */
+ void SetPostponedState(const WindowID window_id, HmiStatePtr state) FINAL;
- virtual void RemovePostponedState();
+ /**
+ * @brief RemovePostponedState removes postponed state for application
+ * After removal, this state will not be set as regular later
+ * @param window_id window id for HMI state
+ */
+ void RemovePostponedState(const WindowID window_id) FINAL;
/**
* @brief AddHMIState the function that will change application's
@@ -306,7 +345,7 @@ class ApplicationImpl : public virtual Application,
*
* @param state new hmi state for certain application.
*/
- virtual void AddHMIState(HmiStatePtr state);
+ void AddHMIState(const WindowID window_id, HmiStatePtr state) FINAL;
/**
* @brief RemoveHMIState the function that will turn back hmi_level after end
@@ -316,19 +355,32 @@ class ApplicationImpl : public virtual Application,
*
* @param state_id that should be removed
*/
- virtual void RemoveHMIState(HmiState::StateID state_id);
+ void RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) FINAL;
/**
* @brief HmiState of application within active events PhoneCall, TTS< etc ...
* @return Active HmiState of application
*/
- virtual const HmiStatePtr CurrentHmiState() const;
+ const HmiStatePtr CurrentHmiState(const WindowID window_i) const FINAL;
+
+ WindowNames GetWindowNames() const FINAL;
+
+ WindowIds GetWindowIds() const FINAL;
+
+ bool WindowIdExists(const WindowID window_id) const FINAL;
+
+ /**
+ * @brief Checks if app is allowed to change audio source
+ * @return True - if allowed, otherwise - False
+ */
+ virtual bool IsAllowedToChangeAudioSource() const;
/**
* @brief RegularHmiState of application without active events VR, TTS etc ...
* @return HmiState of application
*/
- virtual const HmiStatePtr RegularHmiState() const;
+ const HmiStatePtr RegularHmiState(const WindowID window_id) const FINAL;
/**
* @brief PostponedHmiState returns postponed hmi state of application
@@ -336,7 +388,7 @@ class ApplicationImpl : public virtual Application,
*
* @return Postponed hmi state of application
*/
- virtual const HmiStatePtr PostponedHmiState() const;
+ const HmiStatePtr PostponedHmiState(const WindowID window_id) const FINAL;
uint32_t audio_stream_retry_number() const;
@@ -363,6 +415,7 @@ class ApplicationImpl : public virtual Application,
* @param system_context new system context
*/
void set_system_context(
+ const WindowID window_id,
const mobile_api::SystemContext::eType& system_context) OVERRIDE;
/**
* @brief Sets current audio streaming state
@@ -374,7 +427,8 @@ class ApplicationImpl : public virtual Application,
* @brief Sets current HMI level
* @param hmi_level new HMI level
*/
- void set_hmi_level(const mobile_api::HMILevel::eType& hmi_level) OVERRIDE;
+ void set_hmi_level(const WindowID window_id,
+ const mobile_api::HMILevel::eType& hmi_level) OVERRIDE;
void PushMobileMessage(
smart_objects::SmartObjectSPtr mobile_message) OVERRIDE;
@@ -382,6 +436,77 @@ class ApplicationImpl : public virtual Application,
void SwapMobileMessageQueue(MobileMessageQueue& mobile_messages) OVERRIDE;
/**
+ * @brief Get cloud app endpoint for websocket connection
+ * @return cloud app endpoint
+ */
+ const std::string& cloud_app_endpoint() const OVERRIDE;
+
+ /**
+ * @brief Get cloud app auth token to be used in connection handshake after
+ * websocket open.
+ * @return cloud app auth token
+ */
+ const std::string& auth_token() const OVERRIDE;
+
+ /**
+ * @brief Get cloud app transport type. Defines the type of websocket
+ * connection used.
+ * @return cloud app transport type
+ */
+ const std::string& cloud_app_transport_type() const OVERRIDE;
+
+ /**
+ * @brief Get hybrid app preference. Defines behaviour for when a similar
+ * mobile and cloud app are connected simultaneously.
+ * @return hybrid app preference
+ */
+ const mobile_apis::HybridAppPreference::eType& hybrid_app_preference()
+ const OVERRIDE;
+
+ /**
+ * @brief Get cloud app certificate. Used for secured websocket connections.
+ * @return cloud app certificate.
+ */
+ const std::string& cloud_app_certificate() const OVERRIDE;
+
+ /**
+ * @brief Check whether the given application is a cloud app.
+ * @return true if the application is a cloud application, false otherwise.
+ */
+ bool is_cloud_app() const OVERRIDE;
+
+ /**
+ * @brief Set cloud app endpoint
+ */
+ void set_cloud_app_endpoint(const std::string& endpoint) OVERRIDE;
+
+ /**
+ * @brief Set cloud app auth token
+ */
+ void set_auth_token(const std::string& auth_token) OVERRIDE;
+
+ /**
+ * @brief Set cloud app transport type
+ */
+ void set_cloud_app_transport_type(const std::string& transport_type) OVERRIDE;
+
+ /**
+ * @brief Set hybrid app preference
+ */
+ void set_hybrid_app_preference(const mobile_apis::HybridAppPreference::eType&
+ hybrid_app_preference) OVERRIDE;
+
+ /**
+ * @brief Set cloud app certificate
+ */
+ void set_cloud_app_certificate(const std::string& certificate) OVERRIDE;
+
+ void set_user_location(
+ const smart_objects::SmartObject& user_location) OVERRIDE;
+
+ const smart_objects::SmartObject& get_user_location() const OVERRIDE;
+
+ /**
* @brief Update internal state to indicate whether setup is running or not.
*
* The method WaitForSetupDone() will block when setup is running. Also, the
@@ -467,11 +592,14 @@ class ApplicationImpl : public virtual Application,
bool audio_streaming_suspended_;
sync_primitives::Lock video_streaming_suspended_lock_;
sync_primitives::Lock audio_streaming_suspended_lock_;
+ sync_primitives::Lock streaming_stop_lock_;
bool is_app_allowed_;
+ bool is_app_data_resumption_allowed_;
bool has_been_activated_;
bool tts_properties_in_none_;
bool tts_properties_in_full_;
+ bool keep_context_;
bool is_foreground_;
bool is_application_data_changed_;
uint32_t put_file_in_none_count_;
@@ -480,14 +608,18 @@ class ApplicationImpl : public virtual Application,
std::string app_icon_path_;
std::string mac_address_;
connection_handler::DeviceHandle device_id_;
+ connection_handler::DeviceHandle secondary_device_id_;
std::string bundle_id_;
AppFilesMap app_files_;
std::set<mobile_apis::ButtonName::eType> subscribed_buttons_;
UsageStatistics usage_report_;
+ HelpPromptManagerImpl help_prompt_manager_impl_;
protocol_handler::MajorProtocolVersion protocol_version_;
bool is_voice_communication_application_;
- sync_primitives::atomic_bool is_resuming_;
+ std::atomic_bool is_resuming_;
+ mobile_api::HMILevel::eType deferred_resumption_hmi_level_;
bool is_hash_changed_during_suspend_;
+ smart_objects::SmartObject user_location_;
uint32_t video_stream_retry_number_;
uint32_t audio_stream_retry_number_;
@@ -498,10 +630,17 @@ class ApplicationImpl : public virtual Application,
std::list<AppExtensionPtr> extensions_;
+ // Cloud app properties
+ std::string endpoint_;
+ std::string auth_token_;
+ std::string cloud_transport_type_;
+ mobile_apis::HybridAppPreference::eType hybrid_app_preference_;
+ std::string certificate_;
+
/**
* @brief Defines number per time in seconds limits
*/
- typedef std::pair<TimevalStruct, uint32_t> TimeToNumberLimit;
+ typedef std::pair<date_time::TimeDuration, uint32_t> TimeToNumberLimit;
/**
* @brief Defines specific command number per time in seconds limits
@@ -548,7 +687,8 @@ uint32_t ApplicationImpl::app_id() const {
const mobile_api::AudioStreamingState::eType
ApplicationImpl::audio_streaming_state() const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state =
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
return hmi_state ? hmi_state->audio_streaming_state()
: AudioStreamingState::INVALID_ENUM;
}
@@ -556,7 +696,8 @@ ApplicationImpl::audio_streaming_state() const {
const mobile_api::VideoStreamingState::eType
ApplicationImpl::video_streaming_state() const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state =
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
return hmi_state ? hmi_state->video_streaming_state()
: VideoStreamingState::INVALID_ENUM;
}
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index 7433a5560f..49059e4955 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -34,40 +34,44 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_IMPL_H_
#include <stdint.h>
-#include <vector>
-#include <map>
-#include <set>
-#include <deque>
#include <algorithm>
+#include <deque>
+#include <map>
#include <memory>
+#include <set>
+#include <vector>
+#include "application_manager/app_launch/app_launch_data.h"
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager.h"
+#include "application_manager/application_manager_settings.h"
+#include "application_manager/command_factory.h"
+#include "application_manager/command_holder.h"
+#include "application_manager/event_engine/event_dispatcher_impl.h"
#include "application_manager/hmi_capabilities.h"
+#include "application_manager/hmi_interfaces_impl.h"
#include "application_manager/message.h"
#include "application_manager/message_helper.h"
#include "application_manager/request_controller.h"
#include "application_manager/resumption/resume_ctrl.h"
-#include "application_manager/state_controller_impl.h"
-#include "application_manager/app_launch/app_launch_data.h"
-#include "application_manager/application_manager_settings.h"
-#include "application_manager/event_engine/event_dispatcher_impl.h"
-#include "application_manager/hmi_interfaces_impl.h"
-#include "application_manager/command_holder.h"
-#include "application_manager/command_factory.h"
+#include "application_manager/rpc_handler.h"
#include "application_manager/rpc_service.h"
+#include "application_manager/state_controller_impl.h"
+
#include "application_manager/rpc_handler.h"
-#include "protocol_handler/protocol_observer.h"
-#include "protocol_handler/protocol_handler.h"
-#include "hmi_message_handler/hmi_message_observer.h"
-#include "hmi_message_handler/hmi_message_sender.h"
#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/policies/policy_handler_observer.h"
#include "connection_handler/connection_handler.h"
#include "connection_handler/connection_handler_observer.h"
#include "connection_handler/device.h"
#include "formatters/CSmartFactory.h"
+#include "hmi_message_handler/hmi_message_observer.h"
+#include "hmi_message_handler/hmi_message_sender.h"
#include "policies/policy_handler.h"
+#include "protocol_handler/protocol_handler.h"
+#include "protocol_handler/protocol_observer.h"
+#include "protocol_handler/service_status_update_handler_listener.h"
#include "interfaces/HMI_API.h"
#include "interfaces/HMI_API_schema.h"
@@ -86,15 +90,15 @@
#endif // TELEMETRY_MONITOR
#include "utils/macro.h"
-#include "utils/shared_ptr.h"
+
+#include "smart_objects/smart_object.h"
+#include "utils/data_accessor.h"
+#include "utils/lock.h"
#include "utils/message_queue.h"
#include "utils/prioritized_queue.h"
-#include "utils/threads/thread.h"
#include "utils/threads/message_loop_thread.h"
-#include "utils/lock.h"
-#include "utils/data_accessor.h"
+#include "utils/threads/thread.h"
#include "utils/timer.h"
-#include "smart_objects/smart_object.h"
struct BsonObject;
@@ -113,26 +117,38 @@ class ApplicationManagerImpl;
enum VRTTSSessionChanging { kVRSessionChanging = 0, kTTSSessionChanging };
+typedef std::map<protocol_handler::ServiceType, std::set<uint32_t> >
+ ServiceStreamingStatusMap;
+
struct CommandParametersPermissions;
typedef std::map<std::string, hmi_apis::Common_TransportType::eType>
DeviceTypes;
+struct AppIconInfo {
+ std::string endpoint;
+ bool pending_request;
+ AppIconInfo();
+ AppIconInfo(std::string ws_endpoint, bool pending)
+ : endpoint(ws_endpoint), pending_request(pending) {}
+};
+
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
-typedef utils::SharedPtr<timer::Timer> TimerSPtr;
+typedef std::shared_ptr<timer::Timer> TimerSPtr;
class ApplicationManagerImpl
: public ApplicationManager,
public connection_handler::ConnectionHandlerObserver,
- public policy::PolicyHandlerObserver
+ public policy::PolicyHandlerObserver,
+ public protocol_handler::ServiceStatusUpdateHandlerListener
#ifdef ENABLE_SECURITY
- ,
+ ,
public security_manager::SecurityManagerListener
#endif // ENABLE_SECURITY
#ifdef TELEMETRY_MONITOR
- ,
+ ,
public telemetry_monitor::TelemetryObservable<AMTelemetryObserver>
#endif // TELEMETRY_MONITOR
- {
+{
friend class ResumeCtrl;
friend class CommandImpl;
@@ -142,10 +158,14 @@ class ApplicationManagerImpl
const policy::PolicySettings& policy_settings);
~ApplicationManagerImpl();
+ DEPRECATED
+ bool Init(resumption::LastState&,
+ media_manager::MediaManager* media_manager) OVERRIDE;
+
/**
* Inits application manager
*/
- bool Init(resumption::LastState& last_state,
+ bool Init(resumption::LastStateWrapperPtr last_state_wrapper,
media_manager::MediaManager* media_manager) OVERRIDE;
/**
@@ -156,15 +176,27 @@ class ApplicationManagerImpl
bool Stop() OVERRIDE;
DataAccessor<ApplicationSet> applications() const OVERRIDE;
+ DataAccessor<AppsWaitRegistrationSet> pending_applications() const OVERRIDE;
+ DataAccessor<ReregisterWaitList> reregister_applications() const OVERRIDE;
ApplicationSharedPtr application(uint32_t app_id) const OVERRIDE;
ApplicationSharedPtr active_application() const OVERRIDE;
+ ApplicationSharedPtr get_full_or_limited_application() const OVERRIDE;
+
ApplicationSharedPtr application_by_hmi_app(
uint32_t hmi_app_id) const OVERRIDE;
ApplicationSharedPtr application_by_policy_id(
const std::string& policy_app_id) const OVERRIDE;
+ DEPRECATED ApplicationSharedPtr
+ application_by_name(const std::string& app_name) const OVERRIDE;
+ ApplicationSharedPtr pending_application_by_policy_id(
+ const std::string& policy_app_id) const OVERRIDE;
+ ApplicationSharedPtr reregister_application_by_policy_id(
+ const std::string& policy_app_id) const OVERRIDE;
+ std::vector<ApplicationSharedPtr> applications_by_name(
+ const std::string& app_name) const OVERRIDE;
std::vector<ApplicationSharedPtr> applications_by_button(
uint32_t button) OVERRIDE;
std::vector<ApplicationSharedPtr> applications_with_navi() OVERRIDE;
@@ -181,12 +213,23 @@ class ApplicationManagerImpl
void set_application_id(const int32_t correlation_id,
const uint32_t app_id) OVERRIDE;
- void OnHMILevelChanged(uint32_t app_id,
- mobile_apis::HMILevel::eType from,
- mobile_apis::HMILevel::eType to) OVERRIDE;
+ uint32_t get_current_audio_source() const OVERRIDE;
+
+ void set_current_audio_source(const uint32_t source) OVERRIDE;
+
+ void OnHMIStateChanged(const uint32_t app_id,
+ const HmiStatePtr from,
+ const HmiStatePtr to) OVERRIDE;
+
+ void ProcessOnDataStreamingNotification(
+ const protocol_handler::ServiceType service_type,
+ const uint32_t app_id,
+ const bool streaming_data_available) FINAL;
+
+ void SendDriverDistractionState(ApplicationSharedPtr application);
- void SendHMIStatusNotification(
- const utils::SharedPtr<Application> app) OVERRIDE;
+ void SendGetIconUrlNotifications(const uint32_t connection_key,
+ ApplicationSharedPtr application);
ApplicationSharedPtr application(
const std::string& device_id,
@@ -207,6 +250,11 @@ class ApplicationManagerImpl
return *plugin_manager_;
}
+ virtual AppServiceManager& GetAppServiceManager() OVERRIDE {
+ DCHECK(app_service_manager_);
+ return *app_service_manager_;
+ }
+
std::vector<std::string> devices(
const std::string& policy_app_id) const OVERRIDE;
@@ -222,29 +270,6 @@ class ApplicationManagerImpl
bool IsAppTypeExistsInFullOrLimited(ApplicationConstSharedPtr app) const;
/**
- * DEPRECATED
- * @brief Checks if Application is subscribed for way points
- * @param Application AppID
- * @return true if Application is subscribed for way points
- * otherwise false
- */
- bool IsAppSubscribedForWayPoints(const uint32_t app_id) const OVERRIDE;
-
- /**
- * DEPRECATED
- * @brief Subscribe Application for way points
- * @param Application AppID
- */
- void SubscribeAppForWayPoints(const uint32_t app_id) OVERRIDE;
-
- /**
- * DEPRECATED
- * @brief Unsubscribe Application for way points
- * @param Application AppID
- */
- void UnsubscribeAppFromWayPoints(const uint32_t app_id) OVERRIDE;
-
- /**
* @brief Checks if Application is subscribed for way points
* @param Application pointer
* @return true if Application is subscribed for way points
@@ -274,7 +299,7 @@ class ApplicationManagerImpl
* @brief Get subscribed for way points
* @return reference to set of subscribed apps for way points
*/
- const std::set<int32_t> GetAppsSubscribedForWayPoints() const OVERRIDE;
+ const std::set<uint32_t> GetAppsSubscribedForWayPoints() const OVERRIDE;
/**
* @brief Notifies all components interested in Vehicle Data update
@@ -283,8 +308,7 @@ class ApplicationManagerImpl
* @param vehicle_info Enum value of type of vehicle data
* @param new value (for integer values currently) of vehicle data
*/
- void IviInfoUpdated(mobile_apis::VehicleDataType::eType vehicle_info,
- int value) OVERRIDE;
+ void IviInfoUpdated(const std::string& vehicle_info, int value) OVERRIDE;
void OnApplicationRegistered(ApplicationSharedPtr app) OVERRIDE;
@@ -319,8 +343,9 @@ class ApplicationManagerImpl
void SetTelemetryObserver(AMTelemetryObserver* observer) OVERRIDE;
#endif // TELEMETRY_MONITOR
- ApplicationSharedPtr RegisterApplication(const utils::SharedPtr<
- smart_objects::SmartObject>& request_for_registration) OVERRIDE;
+ ApplicationSharedPtr RegisterApplication(
+ const std::shared_ptr<smart_objects::SmartObject>&
+ request_for_registration) OVERRIDE;
/*
* @brief Closes application by id
*
@@ -337,9 +362,9 @@ class ApplicationManagerImpl
bool is_unexpected_disconnect = false) OVERRIDE;
/**
- * @brief Handle sequence for unauthorized application
- * @param app_id Application id
- */
+ * @brief Handle sequence for unauthorized application
+ * @param app_id Application id
+ */
void OnAppUnauthorized(const uint32_t& app_id) OVERRIDE;
/*
@@ -363,10 +388,6 @@ class ApplicationManagerImpl
* @brief Closes all registered applications
*/
void UnregisterAllApplications();
-
- DEPRECATED bool RemoveAppDataFromHMI(ApplicationSharedPtr app);
-
- DEPRECATED bool LoadAppDataToHMI(ApplicationSharedPtr app);
bool ActivateApplication(ApplicationSharedPtr app) OVERRIDE;
/**
@@ -381,19 +402,56 @@ class ApplicationManagerImpl
void ConnectToDevice(const std::string& device_mac) OVERRIDE;
void OnHMIStartedCooperation() OVERRIDE;
+ void DisconnectCloudApp(ApplicationSharedPtr app) OVERRIDE;
+
+ void RefreshCloudAppInformation() OVERRIDE;
+
+ void CreatePendingApplication(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info,
+ connection_handler::DeviceHandle device_id) OVERRIDE;
+
+ void OnWebEngineDeviceCreated() OVERRIDE;
+
+ void CreatePendingLocalApplication(const std::string& policy_app_id) OVERRIDE;
+
+ void RemovePendingApplication(const std::string& policy_app_id) OVERRIDE;
+
+ void SetPendingApplicationState(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info);
+
+ std::string PolicyIDByIconUrl(const std::string url) OVERRIDE;
+
+ void SetIconFileFromSystemRequest(const std::string policy_id) OVERRIDE;
+
+ /**
+ * @brief Notifies the applicaiton manager that a cloud connection status has
+ * updated and should trigger an UpdateAppList RPC to the HMI
+ */
+ void OnConnectionStatusUpdated();
+
+ /**
+ * @brief Retrieve the current connection status of a cloud app
+ * @param app A cloud application
+ * @return The current CloudConnectionStatus of app
+ */
+ hmi_apis::Common_CloudConnectionStatus::eType GetCloudAppConnectionStatus(
+ ApplicationConstSharedPtr app) const;
+
/*
- * @brief Returns unique correlation ID for HMI request
+ * @brief Returns unique correlation ID for to mobile request
*
* @return Unique correlation ID
*/
- uint32_t GetNextHMICorrelationID() OVERRIDE;
+ uint32_t GetNextMobileCorrelationID() OVERRIDE;
- /* @brief Starts audio passthru process
- * @deprecated Use BeginAudioPassThru(uint32_t app_id) instead
+ /*
+ * @brief Returns unique correlation ID for HMI request
*
- * @return true on success, false if passthru is already in process
+ * @return Unique correlation ID
*/
- bool BeginAudioPassThrough() OVERRIDE;
+ uint32_t GetNextHMICorrelationID() OVERRIDE;
/**
* @brief Starts AudioPassThru process by given application
@@ -402,14 +460,6 @@ class ApplicationManagerImpl
*/
bool BeginAudioPassThru(uint32_t app_id) OVERRIDE;
- /*
- * @brief Finishes already started audio passthru process
- * @deprecated Use EndAudioPassThru(uint32_t app_id) instead
- *
- * @return true on success, false if passthru is not active
- */
- bool EndAudioPassThrough() OVERRIDE;
-
/**
* @brief Finishes already started AudioPassThru process by given application
* @param app_id ID of the application which started the process
@@ -435,22 +485,6 @@ class ApplicationManagerImpl
const hmi_apis::Common_DriverDistractionState::eType state) OVERRIDE;
/*
- * DEPRECATED
- * @brief Retrieves if VR session has started
- *
- * @return Current VR session state (started, stopped)
- */
- inline bool vr_session_started() const;
-
- /*
- * DEPRECATED
- * @brief Sets VR session state
- *
- * @param state Current HMI VR session state
- */
- void set_vr_session_started(const bool state);
-
- /*
* @brief Retrieves SDL access to all mobile apps
*
* @return Currently active state of the access
@@ -467,38 +501,25 @@ class ApplicationManagerImpl
/**
* @brief CreateRegularState create regular HMI state for application
* @param app Application
+ * @param window_type type of window
* @param hmi_level of returned state
* @param audio_state of returned state
* @param system_context of returned state
* @return new regular HMI state
*/
HmiStatePtr CreateRegularState(
- utils::SharedPtr<Application> app,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::VideoStreamingState::eType video_state,
- mobile_apis::SystemContext::eType system_context) const OVERRIDE;
-
- /**
- * DEPRECATED
- * @brief CreateRegularState create regular HMI state for application
- * @param app_id Application id
- * @param hmi_level of returned state
- * @param audio_state of returned state
- * @param system_context of returned state
- * @return new regular HMI state
- */
- DEPRECATED HmiStatePtr CreateRegularState(
- uint32_t app_id,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::SystemContext::eType system_context) const OVERRIDE;
+ std::shared_ptr<Application> app,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::VideoStreamingState::eType video_state,
+ const mobile_apis::SystemContext::eType system_context) const OVERRIDE;
/**
* @brief Checks, if given RPC is allowed at current HMI level for specific
* application in policy table
* @param app Application
- * @param hmi_level Current HMI level of application
+ * @param window_id id of application's window
* @param function_id FunctionID of RPC
* @param params_permissions Permissions for RPC parameters (e.g.
* SubscribeVehicleData) defined in policy table
@@ -506,6 +527,7 @@ class ApplicationManagerImpl
*/
mobile_apis::Result::eType CheckPolicyPermissions(
const ApplicationSharedPtr app,
+ const WindowID window_id,
const std::string& function_id,
const RPCParams& rpc_params,
CommandParametersPermissions* params_permissions = NULL) OVERRIDE;
@@ -523,38 +545,6 @@ class ApplicationManagerImpl
bool IsApplicationForbidden(uint32_t connection_key,
const std::string& mobile_app_id);
- struct ApplicationsAppIdSorter {
- bool operator()(const ApplicationSharedPtr lhs,
- const ApplicationSharedPtr rhs) {
- return lhs->app_id() < rhs->app_id();
- }
- };
-
- struct ApplicationsMobileAppIdSorter {
- bool operator()(const ApplicationSharedPtr lhs,
- const ApplicationSharedPtr rhs) {
- if (lhs->policy_app_id() == rhs->policy_app_id()) {
- return lhs->device() < rhs->device();
- }
- return lhs->policy_app_id() < rhs->policy_app_id();
- }
- };
-
- // typedef for Applications list
- typedef std::set<ApplicationSharedPtr, ApplicationsAppIdSorter> ApplictionSet;
-
- typedef std::set<ApplicationSharedPtr, ApplicationsPolicyAppIdSorter>
- AppsWaitRegistrationSet;
-
- // typedef for Applications list iterator
- typedef ApplictionSet::iterator ApplictionSetIt;
-
- // typedef for Applications list const iterator
- typedef ApplictionSet::const_iterator ApplictionSetConstIt;
-
- DataAccessor<AppsWaitRegistrationSet> apps_waiting_for_registration() const;
- ApplicationConstSharedPtr waiting_app(const uint32_t hmi_id) const;
-
/**
* @brief Notification from PolicyHandler about PTU.
* Compares AppHMIType between saved in app and received from PTU. If they are
@@ -576,6 +566,52 @@ class ApplicationManagerImpl
*/
void OnPTUFinished(const bool ptu_result) FINAL;
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
+ /**
+ * @brief OnCertDecryptFailed is called when certificate decryption fails in
+ * external flow
+ * @return since this callback is a part of SecurityManagerListener, bool
+ * return value is used to indicate whether listener instance can be deleted
+ * by calling entity. if true - listener can be deleted and removed from
+ * listeners by SecurityManager, false - listener retains its place within
+ * SecurityManager.
+ */
+ bool OnCertDecryptFailed() FINAL;
+
+ /**
+ * @brief OnCertDecryptFinished is called when certificate decryption is
+ * finished in the external flow
+ * @param decrypt_result bool value indicating whether decryption was
+ * successful
+ */
+ void OnCertDecryptFinished(const bool decrypt_result) FINAL;
+#endif
+
+ /**
+ * @brief OnPTUTimeoutExceeded is called on policy table update timed out
+ */
+ void OnPTUTimeoutExceeded() FINAL;
+
+ /**
+ *@brief ProcessServiceStatusUpdate callback that is invoked in case of
+ *service status update
+ *@param connection_key - connection key
+ *@param service_type enum value containing type of service.
+ *@param service_event enum value containing event that occured during service
+ *start.
+ *@param service_update_reason enum value containing reason why service_event
+ *occured.
+ **/
+ void ProcessServiceStatusUpdate(
+ const uint32_t connection_key,
+ hmi_apis::Common_ServiceType::eType service_type,
+ hmi_apis::Common_ServiceEvent::eType service_event,
+ utils::Optional<hmi_apis::Common_ServiceStatusUpdateReason::eType>
+ service_update_reason) FINAL;
+
+#ifdef ENABLE_SECURITY
+ bool OnPTUFailed() FINAL;
+#endif // ENABLE_SECURITY
/*
* @brief Starts audio pass thru thread
*
@@ -620,7 +656,8 @@ class ApplicationManagerImpl
void StartDevicesDiscovery();
void RemoveHMIFakeParameters(
- application_manager::commands::MessageSharedPtr& message) OVERRIDE;
+ application_manager::commands::MessageSharedPtr& message,
+ const hmi_apis::FunctionID::eType& function_id) OVERRIDE;
/**
* @brief TerminateRequest forces termination of request
@@ -632,6 +669,9 @@ class ApplicationManagerImpl
const uint32_t corr_id,
const int32_t function_id) OVERRIDE;
+ void OnQueryAppsRequest(
+ const connection_handler::DeviceHandle device) OVERRIDE;
+
// Overriden ConnectionHandlerObserver method
void OnDeviceListUpdated(
const connection_handler::DeviceMap& device_list) OVERRIDE;
@@ -658,10 +698,6 @@ class ApplicationManagerImpl
*/
void OnDeviceSwitchingFinish(const std::string& device_uid) FINAL;
- DEPRECATED bool OnServiceStartedCallback(
- const connection_handler::DeviceHandle& device_handle,
- const int32_t& session_key,
- const protocol_handler::ServiceType& type) OVERRIDE;
void OnServiceStartedCallback(
const connection_handler::DeviceHandle& device_handle,
const int32_t& session_key,
@@ -671,6 +707,10 @@ class ApplicationManagerImpl
const int32_t& session_key,
const protocol_handler::ServiceType& type,
const connection_handler::CloseSessionReason& close_reason) OVERRIDE;
+ void OnSecondaryTransportStartedCallback(
+ const connection_handler::DeviceHandle device_handle,
+ const int32_t session_key) OVERRIDE;
+ void OnSecondaryTransportEndedCallback(const int32_t session_key) OVERRIDE;
/**
* @brief Check if application with specified app_id has NAVIGATION HMI type
@@ -694,7 +734,7 @@ class ApplicationManagerImpl
* @brief Notification about handshake failure
* @return true on success notification handling or false otherwise
*/
- bool OnHandshakeFailed() OVERRIDE;
+ bool OnGetSystemTimeFailed() OVERRIDE;
/**
* @brief Notification that certificate update is required.
@@ -744,6 +784,15 @@ class ApplicationManagerImpl
uint32_t new_timeout_value) OVERRIDE;
/**
+ * @brief TODO
+ *
+ * @param connection_key Connection key of application
+ * @param mobile_correlation_id Correlation ID of the mobile request
+ */
+ void IncreaseForwardedRequestTimeout(uint32_t connection_key,
+ uint32_t mobile_correlation_id) OVERRIDE;
+
+ /**
* @brief AddPolicyObserver allows to subscribe needed component to events
* from policy.
*
@@ -759,12 +808,13 @@ class ApplicationManagerImpl
void RemovePolicyObserver(PolicyHandlerObserver* listener);
/**
- * @brief Checks HMI level and returns true if streaming is allowed
+ * @brief Checks application HMI state and returns true if streaming is
+ * allowed
* @param app_id Application id
* @param service_type Service type to check
* @return True if streaming is allowed, false in other case
*/
- bool HMILevelAllowsStreaming(
+ bool HMIStateAllowsStreaming(
uint32_t app_id,
protocol_handler::ServiceType service_type) const OVERRIDE;
@@ -784,12 +834,12 @@ class ApplicationManagerImpl
*/
void EndNaviServices(uint32_t app_id) OVERRIDE;
- /**
- * @brief ForbidStreaming forbid the stream over the certain application.
- * @param app_id the application's id which should stop streaming.
- */
+ DEPRECATED
void ForbidStreaming(uint32_t app_id) OVERRIDE;
+ void ForbidStreaming(uint32_t app_id,
+ protocol_handler::ServiceType service_type) OVERRIDE;
+
/**
* @brief Called when application completes streaming configuration
* @param app_id Streaming application id
@@ -818,9 +868,21 @@ class ApplicationManagerImpl
ApplicationConstSharedPtr application) const;
/**
- * Getter for resume_controller
- * @return Resume Controller
- */
+ * @brief Checks if required transport for resumption is available
+ *
+ * The required transport can be configured through smartDeviceLink.ini file.
+ *
+ * @param application an instance of the app to check
+ * @return true if the app is connected through one of the required
+ * transports, false otherwise
+ */
+ bool CheckResumptionRequiredTransportAvailable(
+ ApplicationConstSharedPtr application) const;
+
+ /**
+ * Getter for resume_controller
+ * @return Resume Controller
+ */
resumption::ResumeCtrl& resume_controller() OVERRIDE {
return *resume_ctrl_.get();
}
@@ -843,20 +905,6 @@ class ApplicationManagerImpl
*/
uint32_t GenerateNewHMIAppID() OVERRIDE;
- /**
- * DERPECATED
- * @brief Parse smartObject and replace mobile app Id by HMI app ID
- * @param message Smartobject to be parsed
- */
- void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message);
-
- /**
- * DEPRECATED
- * @brief Parse smartObject and replace HMI app ID by mobile app Id
- * @param message Smartobject to be parsed
- */
- void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message);
-
/*
* @brief Save binary data to specified directory
*
@@ -872,7 +920,7 @@ class ApplicationManagerImpl
mobile_apis::Result::eType SaveBinary(const std::vector<uint8_t>& binary_data,
const std::string& file_path,
const std::string& file_name,
- const int64_t offset) OVERRIDE;
+ const uint64_t offset) OVERRIDE;
/**
* @brief Get available app space
@@ -908,22 +956,6 @@ class ApplicationManagerImpl
*/
void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) OVERRIDE;
- /**
- * DEPRECATED
- * @brief method adds application in FULL and LIMITED state
- * to on_phone_call_app_list_.
- * Also OnHMIStateNotification with BACKGROUND state sent for these apps
- */
- void CreatePhoneCallAppList();
-
- /**
- * DEPRECATED
- * @brief method removes application from on_phone_call_app_list_.
- *
- * Also OnHMIStateNotification with previous HMI state sent for these apps
- */
- void ResetPhoneCallAppList();
-
// TODO(AOleynik): Temporary added, to fix build. Should be reworked.
connection_handler::ConnectionHandler& connection_handler() const OVERRIDE;
protocol_handler::ProtocolHandler& protocol_handler() const OVERRIDE;
@@ -1019,8 +1051,7 @@ class ApplicationManagerImpl
AppV4DevicePredicate(const connection_handler::DeviceHandle handle)
: handle_(handle) {}
bool operator()(const ApplicationSharedPtr app) const {
- return app
- ? handle_ == app->device() &&
+ return app ? handle_ == app->device() &&
Message::is_sufficient_version(
protocol_handler::MajorProtocolVersion::
PROTOCOL_VERSION_4,
@@ -1046,6 +1077,14 @@ class ApplicationManagerImpl
}
};
+ struct AppNamePredicate {
+ std::string app_name_;
+ AppNamePredicate(const std::string& app_name) : app_name_(app_name) {}
+ bool operator()(const ApplicationSharedPtr app) const {
+ return app ? app->name() == app_name_ : false;
+ }
+ };
+
/**
* @brief Sends UpdateAppList notification to HMI
*/
@@ -1078,24 +1117,26 @@ class ApplicationManagerImpl
* @brief IsAppInReconnectMode check if application belongs to session
* affected by transport switching at the moment by checking internal
* waiting list prepared on switching start
+ * @param device_id device identifier
* @param policy_app_id Application id
* @return True if application is in the waiting list, otherwise - false
*/
- bool IsAppInReconnectMode(const std::string& policy_app_id) const FINAL;
+ bool IsAppInReconnectMode(const connection_handler::DeviceHandle& device_id,
+ const std::string& policy_app_id) const FINAL;
bool IsStopping() const OVERRIDE {
return is_stopping_;
}
/**
- * @brief ProcessReconnection handles reconnection flow for application on
- * transport switch
- * @param application Pointer to switched application, must be validated
- * before passing
- * @param connection_key Connection key from registration request of
- * switched
- * application
- */
+ * @brief ProcessReconnection handles reconnection flow for application on
+ * transport switch
+ * @param application Pointer to switched application, must be validated
+ * before passing
+ * @param connection_key Connection key from registration request of
+ * switched
+ * application
+ */
void ProcessReconnection(ApplicationSharedPtr application,
const uint32_t connection_key) FINAL;
@@ -1106,6 +1147,8 @@ class ApplicationManagerImpl
StateController& state_controller() OVERRIDE;
const ApplicationManagerSettings& get_settings() const OVERRIDE;
+ std::string GetCorrectMobileIDFromMessage(
+ const commands::MessageSharedPtr& message) const OVERRIDE;
virtual event_engine::EventDispatcher& event_dispatcher() OVERRIDE;
app_launch::AppLaunchCtrl& app_launch_ctrl() OVERRIDE;
@@ -1119,8 +1162,27 @@ class ApplicationManagerImpl
*/
protocol_handler::MajorProtocolVersion SupportedSDLVersion() const OVERRIDE;
+ void ApplyFunctorForEachPlugin(
+ std::function<void(plugin_manager::RPCPlugin&)> functor) OVERRIDE;
+
private:
/**
+ * @brief Adds application to registered applications list and marks it as
+ * registered
+ * @param application Application that should be added to registered
+ * applications list.
+ */
+ void AddAppToRegisteredAppList(const ApplicationSharedPtr application);
+
+ /**
+ * @brief Removes service status record for service that failed to start
+ * @param app Application whose service status record should be removed
+ * @param Service type which status record should be removed
+ */
+ bool HandleRejectedServiceStatus(
+ ApplicationSharedPtr app,
+ const hmi_apis::Common_ServiceType::eType service_type);
+ /**
* @brief PullLanguagesInfo allows to pull information about languages.
*
* @param app_data entry to parse
@@ -1140,6 +1202,14 @@ class ApplicationManagerImpl
mobile_apis::AppHMIType::eType StringToAppHMIType(std::string str);
/**
+ * @brief Returns a string representation of AppHMIType
+ * @param type an enum value of AppHMIType
+ * @return string representation of the enum value
+ */
+ const std::string AppHMITypeToString(
+ mobile_apis::AppHMIType::eType type) const;
+
+ /**
* @brief Method compares arrays of app HMI type
* @param from_policy contains app HMI type from policy
* @param from_application contains app HMI type from application
@@ -1152,7 +1222,8 @@ class ApplicationManagerImpl
mobile_apis::MOBILE_API& mobile_so_factory();
bool ConvertSOtoMessage(const smart_objects::SmartObject& message,
- Message& output);
+ Message& output,
+ const bool allow_unknown_parameters = false);
template <typename ApplicationList>
void PrepareApplicationListSO(ApplicationList app_list,
@@ -1164,7 +1235,7 @@ class ApplicationManagerImpl
uint32_t app_count = NULL == app_array ? 0 : app_array->size();
typename ApplicationList::const_iterator it;
for (it = app_list.begin(); it != app_list.end(); ++it) {
- if (!it->valid()) {
+ if (it->use_count() == 0) {
LOG4CXX_ERROR(logger_, "Application not found ");
continue;
}
@@ -1208,10 +1279,10 @@ class ApplicationManagerImpl
*/
void SendOnSDLClose();
- /*
+ /**
* @brief returns true if low voltage state is active
*/
- bool IsLowVoltage();
+ bool IsLowVoltage() const OVERRIDE;
/**
* @brief Allows to process postponed commands for application
@@ -1229,8 +1300,14 @@ class ApplicationManagerImpl
* @param to the new HMILevel for the certain app.
*/
void ProcessApp(const uint32_t app_id,
- const mobile_apis::HMILevel::eType from,
- const mobile_apis::HMILevel::eType to);
+ const HmiStatePtr from,
+ const HmiStatePtr to);
+
+ /**
+ * @brief Starts EndStream timer for a specified application
+ * @param app_id Application to process
+ */
+ void StartEndStreamTimer(const uint32_t app_id);
/**
* @brief Allows to send appropriate message to mobile device.
@@ -1285,15 +1362,6 @@ class ApplicationManagerImpl
* @brief Starts specified navi service for application
* @param app_id Application to proceed
* @param service_type Type of service to start
- * @return True on success, false on fail
- */
- DEPRECATED bool StartNaviService(uint32_t app_id,
- protocol_handler::ServiceType service_type);
-
- /**
- * @brief Starts specified navi service for application
- * @param app_id Application to proceed
- * @param service_type Type of service to start
* @param params configuration parameters specified by mobile
* @return True if service is immediately started or configuration
* parameters are sent to HMI, false on other cases
@@ -1325,14 +1393,6 @@ class ApplicationManagerImpl
void DisallowStreaming(uint32_t app_id);
/**
- * @brief Checks if driver distraction state is valid, creates message
- * and puts it to postponed message.
- * @param application contains registered application.
- */
- void PutDriverDistractionMessageToPostponed(
- ApplicationSharedPtr application) const;
-
- /**
* @brief Types of directories used by Application Manager
*/
enum DirectoryType { TYPE_STORAGE, TYPE_SYSTEM, TYPE_ICONS };
@@ -1396,6 +1456,15 @@ class ApplicationManagerImpl
const std::string& mac_address);
/**
+ * @brief Converts device handle to transport type string used in
+ * smartDeviceLink.ini file, e.g. "TCP_WIFI"
+ * @param device_handle A device handle
+ * @return string representation of the transport of the device
+ */
+ const std::string GetTransportTypeProfileString(
+ connection_handler::DeviceHandle device_handle) const;
+
+ /**
* @brief Converts BSON object containing video parameters to
* smart object's map object
* @param output the smart object to add video parameters
@@ -1421,11 +1490,14 @@ class ApplicationManagerImpl
ApplicationSet applications_;
AppsWaitRegistrationSet apps_to_register_;
ForbiddenApps forbidden_applications;
+ ReregisterWaitList reregister_wait_list_;
// Lock for applications list
- mutable std::shared_ptr<sync_primitives::Lock> applications_list_lock_ptr_;
+ mutable std::shared_ptr<sync_primitives::RecursiveLock>
+ applications_list_lock_ptr_;
mutable std::shared_ptr<sync_primitives::Lock>
apps_to_register_list_lock_ptr_;
+ mutable std::shared_ptr<sync_primitives::Lock> reregister_wait_list_lock_ptr_;
mutable sync_primitives::Lock subscribed_way_points_apps_lock_;
/**
@@ -1436,32 +1508,35 @@ class ApplicationManagerImpl
/**
* @brief Set AppIDs of subscribed apps for way points
*/
- std::set<int32_t> subscribed_way_points_apps_list_;
+ std::set<uint32_t> subscribed_way_points_apps_list_;
/**
* @brief Map contains applications which
* will send TTS global properties to HMI after timeout
*/
- std::map<uint32_t, TimevalStruct> tts_global_properties_app_list_;
-
+ std::map<uint32_t, date_time::TimeDuration> tts_global_properties_app_list_;
+ std::set<connection_handler::DeviceHandle> query_apps_devices_;
bool audio_pass_thru_active_;
uint32_t audio_pass_thru_app_id_;
sync_primitives::Lock audio_pass_thru_lock_;
sync_primitives::Lock tts_global_properties_app_list_lock_;
+ mutable sync_primitives::Lock query_apps_devices_lock_;
hmi_apis::Common_DriverDistractionState::eType driver_distraction_state_;
bool is_vr_session_strated_;
bool hmi_cooperating_;
bool is_all_apps_allowed_;
+ uint32_t current_audio_source_;
event_engine::EventDispatcherImpl event_dispatcher_;
media_manager::MediaManager* media_manager_;
hmi_message_handler::HMIMessageHandler* hmi_handler_;
connection_handler::ConnectionHandler* connection_handler_;
- std::auto_ptr<policy::PolicyHandlerInterface> policy_handler_;
+ std::unique_ptr<policy::PolicyHandlerInterface> policy_handler_;
protocol_handler::ProtocolHandler* protocol_handler_;
- request_controller::RequestController request_ctrl_;
std::unique_ptr<plugin_manager::RPCPluginManager> plugin_manager_;
+ request_controller::RequestController request_ctrl_;
+ std::unique_ptr<application_manager::AppServiceManager> app_service_manager_;
/**
* @brief Map contains apps with HMI state before incoming call
@@ -1484,10 +1559,11 @@ class ApplicationManagerImpl
hmi_apis::HMI_API* hmi_so_factory_;
mobile_apis::MOBILE_API* mobile_so_factory_;
+ static uint32_t mobile_corelation_id_;
static uint32_t corelation_id_;
static const uint32_t max_corelation_id_;
- std::auto_ptr<HMICapabilities> hmi_capabilities_;
+ std::unique_ptr<HMICapabilities> hmi_capabilities_;
// The reason of HU shutdown
mobile_api::AppInterfaceUnregisteredReason::eType unregister_reason_;
@@ -1496,32 +1572,40 @@ class ApplicationManagerImpl
* about persistent application data on disk, and save session ID for resuming
* application in case INGITION_OFF or MASTER_RESSET
*/
- std::auto_ptr<resumption::ResumeCtrl> resume_ctrl_;
+ std::unique_ptr<resumption::ResumeCtrl> resume_ctrl_;
HmiInterfacesImpl hmi_interfaces_;
NaviServiceStatusMap navi_service_status_;
sync_primitives::Lock navi_service_status_lock_;
std::deque<uint32_t> navi_app_to_stop_;
+ sync_primitives::Lock navi_app_to_stop_lock_;
std::deque<uint32_t> navi_app_to_end_stream_;
uint32_t navi_close_app_timeout_;
uint32_t navi_end_stream_timeout_;
- std::vector<TimerSPtr> timer_pool_;
- sync_primitives::Lock timer_pool_lock_;
- mutable sync_primitives::Lock stopping_application_mng_lock_;
+ std::vector<TimerSPtr> close_app_timer_pool_;
+ std::vector<TimerSPtr> end_stream_timer_pool_;
+ sync_primitives::Lock close_app_timer_pool_lock_;
+ sync_primitives::Lock end_stream_timer_pool_lock_;
+
+ mutable sync_primitives::RecursiveLock stopping_application_mng_lock_;
StateControllerImpl state_ctrl_;
- std::auto_ptr<app_launch::AppLaunchData> app_launch_dto_;
- std::auto_ptr<app_launch::AppLaunchCtrl> app_launch_ctrl_;
+ std::unique_ptr<app_launch::AppLaunchData> app_launch_dto_;
+ std::unique_ptr<app_launch::AppLaunchCtrl> app_launch_ctrl_;
- /**
- * @brief ReregisterWaitList is list of applications expected to be
- * re-registered after transport switching is complete
- */
- typedef std::vector<ApplicationSharedPtr> ReregisterWaitList;
- ReregisterWaitList reregister_wait_list_;
+ // This is a cache to remember DeviceHandle of secondary transports. Only used
+ // during RegisterApplication().
+ typedef std::map<int32_t, connection_handler::DeviceHandle> DeviceMap;
+
+ DeviceMap secondary_transport_devices_cache_;
+
+ mutable std::shared_ptr<sync_primitives::RecursiveLock>
+ pending_device_map_lock_ptr_;
+ std::map<std::string, std::string> pending_device_map_;
- mutable sync_primitives::Lock reregister_wait_list_lock_;
+ sync_primitives::Lock app_icon_map_lock_ptr_;
+ std::map<std::string, AppIconInfo> app_icon_map_;
#ifdef TELEMETRY_MONITOR
AMTelemetryObserver* metric_observer_;
@@ -1531,10 +1615,14 @@ class ApplicationManagerImpl
Timer tts_global_properties_timer_;
+ Timer clear_pool_timer_;
+
bool is_low_voltage_;
uint32_t apps_size_;
+ std::atomic<bool> registered_during_timer_execution_;
+
volatile bool is_stopping_;
std::unique_ptr<CommandHolder> commands_holder_;
@@ -1542,6 +1630,9 @@ class ApplicationManagerImpl
std::unique_ptr<rpc_service::RPCService> rpc_service_;
std::unique_ptr<rpc_handler::RPCHandler> rpc_handler_;
+ ServiceStreamingStatusMap streaming_application_services_;
+ sync_primitives::Lock streaming_services_lock_;
+
#ifdef BUILD_TESTS
public:
/**
@@ -1552,28 +1643,53 @@ class ApplicationManagerImpl
void AddMockApplication(ApplicationSharedPtr mock_app);
/**
+ * @brief Add a mock application to the pending application list without going
+ * through the formal registration process. Only for unit testing.
+ * @param mock_app the mock app to be added to the pending application list
+ */
+ void AddMockPendingApplication(ApplicationSharedPtr mock_app);
+
+ /**
* @brief set a mock media manager without running Init(). Only for unit
* testing.
- * @param mock_app the mock app to be registered
+ * @param mock_media_manager the mock media manager to be assigned
*/
void SetMockMediaManager(media_manager::MediaManager* mock_media_manager);
+ /**
+ * @brief set a mock rpc service directly. Only for unit
+ * testing.
+ * @param mock_app the mock rpc service to be assigned
+ */
+ void SetMockRPCService(rpc_service::RPCService* rpc_service) {
+ rpc_service_.reset(rpc_service);
+ }
+
+ /**
+ * @brief set a mock rpc service directly. Only for unit
+ * testing.
+ * @param mock_app the mock rpc service to be assigned
+ */
+ void SetMockPolicyHandler(policy::PolicyHandlerInterface* policy_handler) {
+ policy_handler_.reset(policy_handler);
+ }
+
virtual void SetPluginManager(
std::unique_ptr<plugin_manager::RPCPluginManager>& plugin_manager)
OVERRIDE {
plugin_manager_.reset(plugin_manager.release());
}
+ virtual void SetAppServiceManager(AppServiceManager* app_service_manager) {
+ app_service_manager_.reset(app_service_manager);
+ }
+
private:
#endif
DISALLOW_COPY_AND_ASSIGN(ApplicationManagerImpl);
};
-DEPRECATED bool ApplicationManagerImpl::vr_session_started() const {
- return is_vr_session_strated_;
-}
-
inline bool ApplicationManagerImpl::all_apps_allowed() const {
return is_all_apps_allowed_;
}
diff --git a/src/components/application_manager/include/application_manager/application_state.h b/src/components/application_manager/include/application_manager/application_state.h
index bf894eaf94..8c4d2d49d6 100644
--- a/src/components/application_manager/include/application_manager/application_state.h
+++ b/src/components/application_manager/include/application_manager/application_state.h
@@ -32,14 +32,21 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_
+
+#include <map>
#include <vector>
+
+#include "application_manager/hmi_state.h"
#include "utils/lock.h"
#include "utils/macro.h"
-#include "application_manager/hmi_state.h"
namespace application_manager {
+typedef std::vector<WindowID> WindowIds;
typedef std::vector<HmiStatePtr> HmiStates;
+typedef std::map<WindowID, HmiStates> HmiStatesMap;
+typedef std::vector<std::string> WindowNames;
+typedef std::map<WindowID, std::string> WindowNamesMap;
/*
* Class represents application state, i.e. current HMI level, audio streaming
@@ -63,97 +70,140 @@ class ApplicationState {
/**
* @brief Init state
+ * @param window_id window id for HMI state
+ * @param window_name name of inited window
* @param state Initial state
*/
- void InitState(HmiStatePtr state);
+ void InitState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state);
/**
* @brief Adds state to states storage
+ * @param window_id window id for HMI state
* @param state State of application
*/
- void AddState(HmiStatePtr state);
+ void AddState(const WindowID window_id, HmiStatePtr state);
/**
* @brief Removes state from states storage
+ * @param window_id window id for HMI state
* @param state State of application
*/
- void RemoveState(HmiState::StateID state);
+ void RemoveState(const WindowID window_id, HmiState::StateID state);
/**
* @brief Gets state by state id
+ * @param window_id window id for HMI state
* @param state_id State id
* @return Pointer to application state
*/
- HmiStatePtr GetState(HmiState::StateID state_id) const;
+ HmiStatePtr GetState(const WindowID window_id,
+ HmiState::StateID state_id) const;
+
+ /**
+ * @brief Gets the list of all states matches provided state id
+ * @param state_id state id to get
+ * @return list of all states matches provided state id
+ */
+ HmiStates GetStates(const HmiState::StateID state_id) const;
+
+ /**
+ * @brief Getter for a list of available application windows including the
+ * main
+ * @return list of available window ids
+ */
+ WindowIds GetWindowIds() const;
+
+ /**
+ * @brief Getter f0r a list of all existing window names
+ * @return list of available window names
+ */
+ WindowNames GetWindowNames() const;
private:
/**
* @brief AddHMIState the function that will change application's
* hmi state.
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state
*
* @param state new hmi state for certain application.
*/
- void AddHMIState(HmiStatePtr state);
+ void AddHMIState(const WindowID window_id, HmiStatePtr state);
/**
* @brief RemoveHMIState the function that will turn back hmi_level after end
* of some event
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state.
*
* @param state_id that should be removed
*/
- void RemoveHMIState(HmiState::StateID state_id);
+ void RemoveHMIState(const WindowID window_id, HmiState::StateID state_id);
+
+ /**
+ * @brief RemoveWindowHMIStates removes all HMI states related to specified
+ * window
+ * @param window_id window ID to remove
+ */
+ void RemoveWindowHMIStates(const WindowID window_id);
/**
* @brief Removes postponed state
+ * @param window_id window id for HMI state
*/
- void RemovePostponedState();
+ void RemovePostponedState(const WindowID window_id);
/**
* @brief Sets regular state of application
+ * @param window_id window id for HMI state
* @param state State of application
*/
- void SetRegularState(HmiStatePtr state);
+ void SetRegularState(const WindowID window_id, HmiStatePtr state);
/**
- * @brief Sets postponed state of application.
- * This state could be set as regular later on
- *
- * @param state state to setup
- */
- void SetPostponedState(HmiStatePtr state);
+ * @brief Sets postponed state of application.
+ * This state could be set as regular later on
+ * @param window_id window id for HMI state
+ * @param state state to setup
+ */
+ void SetPostponedState(const WindowID window_id, HmiStatePtr state);
/**
* @brief HmiState of application within active events PhoneCall, TTS< etc ...
+ * @param window_id window id for HMI state
* @return Active HmiState of application
*/
- HmiStatePtr CurrentHmiState() const;
+ HmiStatePtr CurrentHmiState(const WindowID window_id) const;
/**
* @brief RegularHmiState of application without active events VR, TTS etc ...
+ * @param window_id window id for HMI state
* @return HmiState of application
*/
- HmiStatePtr RegularHmiState() const;
+ HmiStatePtr RegularHmiState(const WindowID window_id) const;
/**
* @brief PostponedHmiState returns postponed hmi state of application
* if it's present
- *
+ * @param window_id window id for HMI state
* @return Postponed hmi state of application
*/
- HmiStatePtr PostponedHmiState() const;
+ HmiStatePtr PostponedHmiState(const WindowID window_id) const;
/**
* @brief Active states of application
*/
- HmiStates hmi_states_;
- mutable sync_primitives::Lock hmi_states_lock_;
+ HmiStatesMap hmi_states_map_;
+
+ /**
+ * @brief hmi_states_map_lock_
+ */
+ mutable sync_primitives::Lock hmi_states_map_lock_;
DISALLOW_COPY_AND_ASSIGN(ApplicationState);
};
-}
+} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_
diff --git a/src/components/application_manager/include/application_manager/command_factory.h b/src/components/application_manager/include/application_manager/command_factory.h
index ce2706f9a0..f479ee7f37 100644
--- a/src/components/application_manager/include/application_manager/command_factory.h
+++ b/src/components/application_manager/include/application_manager/command_factory.h
@@ -33,16 +33,16 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMAND_FACTORY_H
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMAND_FACTORY_H
-#include "application_manager/commands/command.h"
#include "application_manager/application_manager.h"
-#include "application_manager/rpc_service.h"
+#include "application_manager/commands/command.h"
+#include "application_manager/hmi_capabilities.h"
#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/rpc_service.h"
#include "utils/macro.h"
namespace application_manager {
-using rpc_service::RPCService;
using policy::PolicyHandlerInterface;
-typedef utils::SharedPtr<commands::Command> CommandSharedPtr;
+typedef std::shared_ptr<commands::Command> CommandSharedPtr;
/**
* @brief Factory class for command creation
@@ -50,6 +50,11 @@ typedef utils::SharedPtr<commands::Command> CommandSharedPtr;
class CommandFactory {
public:
/**
+ * @brief Class destructor
+ */
+ virtual ~CommandFactory() {}
+
+ /**
* @brief Create command object and return pointer to it
*
* @param message SmartObject shared pointer.
@@ -59,10 +64,10 @@ class CommandFactory {
const commands::MessageSharedPtr& message,
commands::Command::CommandSource source) = 0;
/**
- * @param int32_t command id
- * @param CommandSource source
- * @return return true if command can be create, else return false
- **/
+ * @param int32_t command id
+ * @param CommandSource source
+ * @return return true if command can be create, else return false
+ **/
virtual bool IsAbleToProcess(
const int32_t,
const application_manager::commands::Command::CommandSource source)
@@ -105,7 +110,7 @@ class DefaultCommandCreator : public CommandCreator {
* @param policy_handler PolicyHandlerInterface.
*/
DefaultCommandCreator(ApplicationManager& application_manager,
- RPCService& rpc_service,
+ rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
PolicyHandlerInterface& policy_handler)
: application_manager_(application_manager)
@@ -137,7 +142,7 @@ class DefaultCommandCreator : public CommandCreator {
}
ApplicationManager& application_manager_;
- RPCService& rpc_service_;
+ rpc_service::RPCService& rpc_service_;
HMICapabilities& hmi_capabilities_;
PolicyHandlerInterface& policy_handler_;
};
@@ -158,7 +163,7 @@ class DefaultCommandCreator<InvalidCommand> : public CommandCreator {
* @param policy_handler PolicyHandlerInterface.
*/
DefaultCommandCreator(ApplicationManager& application_manager,
- RPCService& rpc_service,
+ rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
PolicyHandlerInterface& policy_handler) {
UNUSED(application_manager);
@@ -203,7 +208,7 @@ struct CommandCreatorFactory {
return res;
}
ApplicationManager& application_manager_;
- RPCService& rpc_service_;
+ rpc_service::RPCService& rpc_service_;
HMICapabilities& hmi_capabilities_;
PolicyHandlerInterface& policy_handler_;
};
diff --git a/src/components/application_manager/include/application_manager/command_holder.h b/src/components/application_manager/include/application_manager/command_holder.h
index d3171aedbb..3f5f657a0e 100644
--- a/src/components/application_manager/include/application_manager/command_holder.h
+++ b/src/components/application_manager/include/application_manager/command_holder.h
@@ -35,8 +35,8 @@
#include <string>
#include "application_manager/application.h"
+#include "application_manager/commands/command.h"
#include "smart_objects/smart_object.h"
-#include "utils/shared_ptr.h"
namespace application_manager {
/**
@@ -60,10 +60,12 @@ class CommandHolder {
* internally
* @param application Application pointer
* @param type Command type
+ * @param source The source of suspended command
* @param command Command
*/
virtual void Suspend(ApplicationSharedPtr application,
CommandType type,
+ commands::Command::CommandSource source,
smart_objects::SmartObjectSPtr command) = 0;
/**
diff --git a/src/components/application_manager/include/application_manager/command_holder_impl.h b/src/components/application_manager/include/application_manager/command_holder_impl.h
index c15506ac75..530aae47d2 100644
--- a/src/components/application_manager/include/application_manager/command_holder_impl.h
+++ b/src/components/application_manager/include/application_manager/command_holder_impl.h
@@ -35,14 +35,14 @@
#include "application_manager/command_holder.h"
+#include <map>
#include <string>
#include <vector>
-#include <map>
#include "application_manager/application.h"
#include "application_manager/rpc_service.h"
#include "smart_objects/smart_object.h"
#include "utils/lock.h"
-#include "utils/shared_ptr.h"
+
#include "utils/macro.h"
namespace application_manager {
@@ -64,10 +64,12 @@ class CommandHolderImpl : public CommandHolder {
* @brief Suspend collects command for specific application id internally
* @param application Application pointer
* @param type Command type
+ * @param source The source of suspended command
* @param command Command
*/
void Suspend(ApplicationSharedPtr application,
CommandType type,
+ commands::Command::CommandSource source,
smart_objects::SmartObjectSPtr command) FINAL;
/**
@@ -97,9 +99,17 @@ class CommandHolderImpl : public CommandHolder {
*/
void ResumeMobileCommand(ApplicationSharedPtr application);
+ /**
+ * @brief Descriptor of each suspended command containing all necessary
+ * command info
+ */
+ struct AppCommandInfo {
+ std::shared_ptr<smart_objects::SmartObject> command_ptr_;
+ commands::Command::CommandSource command_source_;
+ };
+
using AppCommands =
- std::map<ApplicationSharedPtr,
- std::vector<utils::SharedPtr<smart_objects::SmartObject> > >;
+ std::map<ApplicationSharedPtr, std::vector<AppCommandInfo> >;
ApplicationManager& app_manager_;
sync_primitives::Lock commands_lock_;
diff --git a/src/components/application_manager/include/application_manager/commands/command.h b/src/components/application_manager/include/application_manager/commands/command.h
index 6524799f45..0536c7aee1 100644
--- a/src/components/application_manager/include/application_manager/commands/command.h
+++ b/src/components/application_manager/include/application_manager/commands/command.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_
#include <stdint.h>
+#include "application_manager/hmi_state.h"
#include "smart_objects/smart_object.h"
-#include "utils/shared_ptr.h"
namespace application_manager {
@@ -94,6 +94,11 @@ class Command {
virtual int32_t function_id() const = 0;
/*
+ * @brief Retrieves Window ID
+ */
+ virtual WindowID window_id() const = 0;
+
+ /*
* @brief Function is called by RequestController when request execution time
* has exceed it's limit
*
@@ -101,19 +106,24 @@ class Command {
virtual void onTimeOut() = 0;
/**
- * @brief AllowedToTerminate tells if request controller is allowed
- * to terminate this command
- * @return
- */
+ * @brief AllowedToTerminate tells if request controller is allowed
+ * to terminate this command
+ * @return
+ */
virtual bool AllowedToTerminate() = 0;
/**
- * @brief SetAllowedToTerminate set up allowed to terminate flag.
- * If true, request controller will terminate request on response
- */
+ * @brief SetAllowedToTerminate set up allowed to terminate flag.
+ * If true, request controller will terminate request on response
+ */
virtual void SetAllowedToTerminate(const bool allowed) = 0;
- enum CommandSource { SOURCE_SDL, SOURCE_MOBILE, SOURCE_HMI };
+ enum CommandSource {
+ SOURCE_SDL,
+ SOURCE_MOBILE,
+ SOURCE_HMI,
+ SOURCE_SDL_TO_HMI
+ };
};
typedef smart_objects::SmartObjectSPtr MessageSharedPtr;
diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h
index be79d9e8d1..4af7f124fa 100644
--- a/src/components/application_manager/include/application_manager/commands/command_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_impl.h
@@ -33,10 +33,11 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_IMPL_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_IMPL_H_
+#include "application_manager/application_manager.h"
#include "application_manager/commands/command.h"
#include "application_manager/event_engine/event_observer.h"
-#include "application_manager/application_manager.h"
#include "application_manager/smart_object_keys.h"
+#include "policy/policy_types.h"
#include "utils/logger.h"
namespace application_manager {
@@ -117,6 +118,11 @@ class CommandImpl : public Command {
int32_t function_id() const OVERRIDE;
/*
+ * @brief Retrieves Window ID
+ */
+ WindowID window_id() const OVERRIDE;
+
+ /*
* @brief Function is called by RequestController when request execution time
* has exceed it's limit
*
@@ -124,20 +130,31 @@ class CommandImpl : public Command {
void onTimeOut() OVERRIDE;
/**
- * @brief AllowedToTerminate tells request Controller if it can terminate this
- * request by response.
- * By default, RequestCtrl should terminate all requests by their responses.
- * If request need to terminate itself, it should override this function false
- * @return allowed_to_terminate_ value
- */
+ * @brief AllowedToTerminate tells request Controller if it can terminate this
+ * request by response.
+ * By default, RequestCtrl should terminate all requests by their responses.
+ * If request need to terminate itself, it should override this function
+ * false
+ * @return allowed_to_terminate_ value
+ */
bool AllowedToTerminate() OVERRIDE;
/**
- * @brief SetAllowedToTerminate set up allowed to terminate flag.
- * If true, request controller will terminate request on response
- */
+ * @brief SetAllowedToTerminate set up allowed to terminate flag.
+ * If true, request controller will terminate request on response
+ */
void SetAllowedToTerminate(const bool allowed) OVERRIDE;
+ /**
+ * @brief Calculates command`s internal consecutive number
+ * for specified application used during resumption.
+ * This method is called when a new command is added.
+ * @param[in] app Application for wich a consecutive number is calculated
+ * @return internal consecutive number
+ */
+ static uint32_t CalcCommandInternalConsecutiveNumber(
+ application_manager::ApplicationConstSharedPtr app);
+
// members
static const int32_t hmi_protocol_type_;
static const int32_t mobile_protocol_type_;
@@ -145,32 +162,32 @@ class CommandImpl : public Command {
protected:
/**
- * @brief Parses mobile message and replaces mobile app id with HMI app id
- * @param message Message to replace its ids
- * @return True if replacement succeeded, otherwise - false
+ * @brief Checks message permissions and parameters according to policy table
+ * permissions
+ * @param source The source of the command (used to determine if a response
+ * should be sent on failure)
+ * @return true if the RPC is allowed, false otherwise
*/
- bool ReplaceMobileWithHMIAppId(smart_objects::SmartObject& message);
+ bool CheckAllowedParameters(const Command::CommandSource source);
/**
- * DEPRECATED
- * @brief Parses mobile message and replaces mobile app id with HMI app id
- * @param message Message to replace its ids
+ * @brief Remove from current message parameters disallowed by policy table
*/
- void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message);
+ void RemoveDisallowedParameters();
/**
- * @brief Parses message from HMI and replaces HMI app id with mobile app id
+ * @brief Parses mobile message and replaces mobile app id with HMI app id
* @param message Message to replace its ids
* @return True if replacement succeeded, otherwise - false
*/
- bool ReplaceHMIWithMobileAppId(smart_objects::SmartObject& message);
+ bool ReplaceMobileWithHMIAppId(smart_objects::SmartObject& message);
/**
- * DEPRECATED
* @brief Parses message from HMI and replaces HMI app id with mobile app id
* @param message Message to replace its ids
+ * @return True if replacement succeeded, otherwise - false
*/
- void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message);
+ bool ReplaceHMIWithMobileAppId(smart_objects::SmartObject& message);
MessageSharedPtr message_;
uint32_t default_timeout_;
@@ -180,6 +197,9 @@ class CommandImpl : public Command {
HMICapabilities& hmi_capabilities_;
policy::PolicyHandlerInterface& policy_handler_;
+ CommandParametersPermissions parameters_permissions_;
+ CommandParametersPermissions removed_parameters_permissions_;
+
#ifdef ENABLE_LOG
static log4cxx::LoggerPtr logger_;
#endif // ENABLE_LOG
diff --git a/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h b/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h
index 8741dae540..4a1d6efbc5 100644
--- a/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_notification_from_mobile_impl.h
@@ -50,9 +50,15 @@ class CommandNotificationFromMobileImpl : public CommandImpl {
policy::PolicyHandlerInterface& policy_handler);
virtual ~CommandNotificationFromMobileImpl();
virtual bool Init();
+ bool CheckPermissions() OVERRIDE;
virtual bool CleanUp();
virtual void Run();
void SendNotification();
+ void SendNotificationToMobile();
+ void SendNotificationToHMI(
+ const hmi_apis::FunctionID::eType& hmi_function_id);
+ void SendNotificationToConsumers(
+ const hmi_apis::FunctionID::eType& hmi_function_id);
private:
DISALLOW_COPY_AND_ASSIGN(CommandNotificationFromMobileImpl);
diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
index e790fc9af6..08b1c9cf28 100644
--- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h
@@ -34,17 +34,15 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_IMPL_H_
#include "application_manager/commands/command_impl.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
-#include "utils/lock.h"
+#include "interfaces/MOBILE_API.h"
#include "smart_objects/smart_object.h"
+#include "utils/lock.h"
namespace application_manager {
namespace commands {
struct ResponseInfo {
- DEPRECATED ResponseInfo(hmi_apis::Common_Result::eType result,
- HmiInterfaces::InterfaceID interface);
ResponseInfo();
ResponseInfo(const hmi_apis::Common_Result::eType result,
const HmiInterfaces::InterfaceID hmi_interface,
@@ -57,7 +55,7 @@ struct ResponseInfo {
bool is_not_used;
};
-namespace NsSmart = NsSmartDeviceLink::NsSmartObjects;
+namespace ns_smart = ns_smart_device_link::ns_smart_objects;
/**
* @brief MergeInfos merge 2 infos in one string
@@ -151,6 +149,8 @@ class CommandRequestImpl : public CommandImpl,
*/
virtual void on_event(const event_engine::Event& event);
+ virtual void on_event(const event_engine::MobileEvent& event);
+
/*
* @brief Creates Mobile response
*
@@ -159,10 +159,12 @@ class CommandRequestImpl : public CommandImpl,
* @param info Provides additional human readable info regarding the result
* @param response_params Additional params in response
*/
- void SendResponse(const bool success,
- const mobile_apis::Result::eType& result_code,
- const char* info = NULL,
- const smart_objects::SmartObject* response_params = NULL);
+ void SendResponse(
+ const bool success,
+ const mobile_apis::Result::eType& result_code,
+ const char* info = NULL,
+ const smart_objects::SmartObject* response_params = NULL,
+ const std::vector<uint8_t> binary_data = std::vector<uint8_t>());
/**
* @brief Check syntax of string from mobile
@@ -172,6 +174,16 @@ class CommandRequestImpl : public CommandImpl,
*/
bool CheckSyntax(const std::string& str, bool allow_empty_line = false);
+ void SendProviderRequest(
+ const mobile_apis::FunctionID::eType& mobile_function_id,
+ const hmi_apis::FunctionID::eType& hmi_function_id,
+ const smart_objects::SmartObject* msg,
+ bool use_events = false);
+
+ void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id,
+ smart_objects::SmartObjectSPtr msg,
+ bool use_events = false);
+
/*
* @brief Sends HMI request
*
@@ -191,7 +203,7 @@ class CommandRequestImpl : public CommandImpl,
* @param msg_params HMI request msg params
*/
void CreateHMINotification(const hmi_apis::FunctionID::eType& function_id,
- const NsSmart::SmartObject& msg_params) const;
+ const ns_smart::SmartObject& msg_params) const;
/**
* @brief Converts HMI result code to Mobile result code
@@ -202,12 +214,33 @@ class CommandRequestImpl : public CommandImpl,
mobile_apis::Result::eType GetMobileResultCode(
const hmi_apis::Common_Result::eType& hmi_code) const;
+ /**
+ * @brief Checks Mobile result code for single RPC
+ * @param result_code contains result code from response to Mobile
+ * @return true if result code complies to successful result codes,
+ * false otherwise.
+ */
+ static bool IsMobileResultSuccess(
+ const mobile_apis::Result::eType result_code);
+
+ /**
+ * @brief Checks HMI result code for single RPC
+ * @param result_code contains result code from HMI response
+ * @return true if result code complies to successful result codes,
+ * false otherwise.
+ */
+ static bool IsHMIResultSuccess(
+ const hmi_apis::Common_Result::eType result_code);
+
protected:
/**
* @brief Checks message permissions and parameters according to policy table
* permissions
+ * @param source The source of the command (used to determine if a response
+ * should be sent on failure)
+ * @return true if the RPC is allowed, false otherwise
*/
- bool CheckAllowedParameters();
+ bool CheckAllowedParameters(const Command::CommandSource source);
/**
* @brief Checks HMI capabilities for specified button support
@@ -218,11 +251,6 @@ class CommandRequestImpl : public CommandImpl,
bool CheckHMICapabilities(const mobile_apis::ButtonName::eType button) const;
/**
- * @brief Remove from current message parameters disallowed by policy table
- */
- void RemoveDisallowedParameters();
-
- /**
* @brief Adds disallowed parameters back to response with appropriate
* reasons
* @param response Response message, which should be extended with blocked
@@ -297,6 +325,16 @@ class CommandRequestImpl : public CommandImpl,
bool IsResultCodeUnsupported(const ResponseInfo& first,
const ResponseInfo& second) const;
+ /**
+ * @brief CheckResult checks whether the overall result
+ * of the responses is successful
+ * @param first response
+ * @param second response
+ * @return true if the overall result is successful
+ * otherwise - false
+ */
+ bool CheckResult(const ResponseInfo& first, const ResponseInfo& second) const;
+
protected:
/**
* @brief Returns policy parameters permissions
@@ -315,7 +353,7 @@ class CommandRequestImpl : public CommandImpl,
* @param interface_id interface which SDL awaits for response in given time
* @return true if SDL awaits for response from given interface in
* interface_id
- */
+ */
bool IsInterfaceAwaited(const HmiInterfaces::InterfaceID& interface_id) const;
/**
@@ -326,7 +364,7 @@ class CommandRequestImpl : public CommandImpl,
void EndAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id);
/**
- * @brief This set stores all the interfaces which are awaited by SDL to
+ * @brief This set stores all the interfaces which are awaited by SDL to
* return a response on some request
*/
std::set<HmiInterfaces::InterfaceID> awaiting_response_interfaces_;
@@ -335,8 +373,6 @@ class CommandRequestImpl : public CommandImpl,
RequestState current_state_;
sync_primitives::Lock state_lock_;
- CommandParametersPermissions parameters_permissions_;
- CommandParametersPermissions removed_parameters_permissions_;
/**
* @brief hash_update_mode_ Defines whether request must update hash value of
@@ -367,10 +403,10 @@ class CommandRequestImpl : public CommandImpl,
const hmi_apis::FunctionID::eType& function_id);
/**
- * @brief UpdateHash updates hash field for application and sends
- * OnHashChanged notification to mobile side in case of approriate hash mode
- * is set
- */
+ * @brief UpdateHash updates hash field for application and sends
+ * OnHashChanged notification to mobile side in case of approriate hash mode
+ * is set
+ */
void UpdateHash();
/**
diff --git a/src/components/application_manager/include/application_manager/commands/command_request_to_mobile.h b/src/components/application_manager/include/application_manager/commands/command_request_to_mobile.h
new file mode 100644
index 0000000000..6b6dbde141
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/command_request_to_mobile.h
@@ -0,0 +1,74 @@
+/*
+ Copyright (c) 2018, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_TO_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_TO_MOBILE_H_
+
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_impl.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+
+namespace application_manager {
+
+namespace commands {
+
+class CommandRequestToMobile : public CommandImpl {
+ public:
+ CommandRequestToMobile(const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ ~CommandRequestToMobile();
+ bool Init() OVERRIDE;
+ bool CheckPermissions() OVERRIDE;
+ bool CleanUp() OVERRIDE;
+ void Run() OVERRIDE;
+ void SendRequest();
+
+ /*
+ * @brief Retrieves application ID
+ */
+ inline uint32_t application_id() const {
+ return (*message_)[strings::msg_params][strings::app_id].asUInt();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CommandRequestToMobile);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_TO_MOBILE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/command_response_from_mobile.h b/src/components/application_manager/include/application_manager/commands/command_response_from_mobile.h
new file mode 100644
index 0000000000..f428d8561b
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/command_response_from_mobile.h
@@ -0,0 +1,74 @@
+/*
+ Copyright (c) 2018, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_RESPONSE_TO_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_RESPONSE_TO_MOBILE_H_
+
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_impl.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+
+namespace application_manager {
+
+namespace commands {
+
+class CommandResponseFromMobile : public CommandImpl {
+ public:
+ CommandResponseFromMobile(const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ ~CommandResponseFromMobile();
+ bool Init() OVERRIDE;
+ bool CheckPermissions() OVERRIDE;
+ bool CleanUp() OVERRIDE;
+ void Run() OVERRIDE;
+ void SendResponse();
+
+ /*
+ * @brief Retrieves application ID
+ */
+ inline uint32_t application_id() const {
+ return (*message_)[strings::msg_params][strings::app_id].asUInt();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CommandResponseFromMobile);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_RESPONSE_TO_MOBILE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h b/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h
index 8bbbd0e3de..25cfd7b207 100644
--- a/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/notification_from_hmi.h
@@ -53,8 +53,14 @@ class NotificationFromHMI : public CommandImpl {
virtual bool CleanUp();
virtual void Run();
void SendNotificationToMobile(const MessageSharedPtr& message);
+ void SendNotificationToMobile(
+ const MessageSharedPtr& message,
+ const mobile_apis::FunctionID::eType& mobile_function_id);
+ void SendNotificationToHMI(MessageSharedPtr& message);
void CreateHMIRequest(const hmi_apis::FunctionID::eType& function_id,
const smart_objects::SmartObject& msg_params) const;
+ void SendNotificationToConsumers(
+ const mobile_apis::FunctionID::eType& mobile_function_id);
private:
DISALLOW_COPY_AND_ASSIGN(NotificationFromHMI);
diff --git a/src/components/application_manager/include/application_manager/commands/pending.h b/src/components/application_manager/include/application_manager/commands/pending.h
index bbfc246659..9083d81d73 100644
--- a/src/components/application_manager/include/application_manager/commands/pending.h
+++ b/src/components/application_manager/include/application_manager/commands/pending.h
@@ -35,9 +35,9 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_PENDING_H_
#include <set>
-#include "utils/macro.h"
-#include "utils/lock.h"
#include "interfaces/HMI_API.h"
+#include "utils/lock.h"
+#include "utils/macro.h"
namespace application_manager {
diff --git a/src/components/application_manager/include/application_manager/commands/request_from_hmi.h b/src/components/application_manager/include/application_manager/commands/request_from_hmi.h
index 11cd602b8e..4464056175 100644
--- a/src/components/application_manager/include/application_manager/commands/request_from_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/request_from_hmi.h
@@ -41,7 +41,7 @@ namespace application_manager {
namespace commands {
-namespace NsSmart = NsSmartDeviceLink::NsSmartObjects;
+namespace ns_smart = ns_smart_device_link::ns_smart_objects;
class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
public:
@@ -55,16 +55,22 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
virtual bool CleanUp();
virtual void Run();
virtual void on_event(const event_engine::Event& event);
+ void on_event(const event_engine::MobileEvent& event) OVERRIDE;
/**
* @brief SendResponse allows to send response to hmi
* @param correlation_id the correlation id for the rfesponse.
* @param function_id the function id for which response will be sent
* @param result_code the result code.
+ * @param response_params extra response params.
+ * @param source command source.
*/
- void SendResponse(const bool success,
- const uint32_t correlation_id,
- const hmi_apis::FunctionID::eType function_id,
- const hmi_apis::Common_Result::eType result_code);
+ void SendResponse(
+ const bool success,
+ const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const hmi_apis::Common_Result::eType result_code,
+ const smart_objects::SmartObject* response_params = NULL,
+ commands::Command::CommandSource source = commands::Command::SOURCE_HMI);
/**
* @brief SendResponse allows to send error response to hmi
@@ -72,11 +78,39 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
* @param function_id the function id for which response will be sent
* @param result_code the result code.
* @param error_message info message for error.
+ * @param source command source.
*/
- void SendErrorResponse(const uint32_t correlation_id,
- const hmi_apis::FunctionID::eType function_id,
- const hmi_apis::Common_Result::eType result_code,
- const std::string error_message);
+ void SendErrorResponse(
+ const uint32_t correlation_id,
+ const hmi_apis::FunctionID::eType function_id,
+ const hmi_apis::Common_Result::eType result_code,
+ const std::string error_message,
+ commands::Command::CommandSource source = commands::Command::SOURCE_HMI);
+
+ void SendProviderRequest(
+ const mobile_apis::FunctionID::eType& mobile_function_id,
+ const hmi_apis::FunctionID::eType& hmi_function_id,
+ const smart_objects::SmartObject* msg,
+ bool use_events = false);
+
+ void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id,
+ const ApplicationSharedPtr app,
+ const smart_objects::SmartObject* msg_params,
+ bool use_events);
+
+ void SendHMIRequest(const hmi_apis::FunctionID::eType& function_id,
+ const smart_objects::SmartObject* msg_params,
+ bool use_events);
+
+ bool ProcessHMIInterfacesAvailability(
+ const uint32_t hmi_correlation_id,
+ const hmi_apis::FunctionID::eType& function_id);
+
+ protected:
+ bool IsMobileResultSuccess(mobile_apis::Result::eType result_code) const;
+
+ bool IsHMIResultSuccess(hmi_apis::Common_Result::eType result_code,
+ HmiInterfaces::InterfaceID interface) const;
private:
/**
@@ -86,7 +120,7 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver {
* @param function_id the function id for which response will be sent
*/
void FillCommonParametersOfSO(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& message,
+ ns_smart_device_link::ns_smart_objects::SmartObject& message,
const uint32_t correlation_id,
const hmi_apis::FunctionID::eType function_id);
diff --git a/src/components/application_manager/include/application_manager/commands/request_to_hmi.h b/src/components/application_manager/include/application_manager/commands/request_to_hmi.h
index 91586a74ce..e8850fbe8d 100644
--- a/src/components/application_manager/include/application_manager/commands/request_to_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/request_to_hmi.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_TO_HMI_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_TO_HMI_H_
-#include "application_manager/commands/command_impl.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_impl.h"
namespace application_manager {
diff --git a/src/components/application_manager/include/application_manager/commands/response_from_hmi.h b/src/components/application_manager/include/application_manager/commands/response_from_hmi.h
index 605d04067e..6c00957d3f 100644
--- a/src/components/application_manager/include/application_manager/commands/response_from_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/response_from_hmi.h
@@ -1,40 +1,40 @@
/*
-* Copyright (c) 2018, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_RESPONSE_FROM_HMI_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_RESPONSE_FROM_HMI_H_
-#include "application_manager/commands/command_impl.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_impl.h"
#include "interfaces/HMI_API.h"
namespace application_manager {
diff --git a/src/components/application_manager/include/application_manager/commands/response_to_hmi.h b/src/components/application_manager/include/application_manager/commands/response_to_hmi.h
index c8f5e90d4e..aa43d2e6d1 100644
--- a/src/components/application_manager/include/application_manager/commands/response_to_hmi.h
+++ b/src/components/application_manager/include/application_manager/commands/response_to_hmi.h
@@ -42,7 +42,7 @@ namespace application_manager {
namespace commands {
-namespace NsSmart = NsSmartDeviceLink::NsSmartObjects;
+namespace ns_smart = ns_smart_device_link::ns_smart_objects;
class ResponseToHMI : public CommandImpl {
public:
diff --git a/src/components/application_manager/include/application_manager/display_capabilities_builder.h b/src/components/application_manager/include/application_manager/display_capabilities_builder.h
new file mode 100644
index 0000000000..529c9a32c1
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/display_capabilities_builder.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DISPLAY_CAPABILITIES_BUILDER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DISPLAY_CAPABILITIES_BUILDER_H_
+#include "application_manager/application.h"
+
+namespace application_manager {
+/**
+ * @brief DisplayCapabilitiesBuilder utility class used for building cached
+ * notification, which is sent to mobile on resumption finish
+ */
+class DisplayCapabilitiesBuilder {
+ typedef std::function<void(Application&, const smart_objects::SmartObject)>
+ ResumeCallback;
+
+ public:
+ /**
+ * @brief DisplayCapabilitiesBuilder class constructor
+ * @param Application reference to application owner
+ */
+ DisplayCapabilitiesBuilder(Application& application);
+
+ /**
+ * @brief InitBuilder initialize builder with callback and windows to be
+ * restored
+ * @param resume_callback callback to be called when notifications for all
+ * windows have been received
+ * @param windows_info SO containing data of windows to be restored
+ */
+ void InitBuilder(ResumeCallback resume_callback,
+ const smart_objects::SmartObject& windows_info);
+
+ /**
+ * @brief UpdateDisplayCapabilities update cached notification
+ * @param display_capabilities to update cached notification with
+ */
+ void UpdateDisplayCapabilities(
+ const smart_objects::SmartObject& display_capabilities);
+
+ /**
+ * @brief ResetDisplayCapabilities resets stored notification
+ */
+ void ResetDisplayCapabilities();
+
+ /**
+ * @brief StopWaitingForWindow stop waiting for window resumption by removing
+ * window_id from windows pending resumption
+ * @param window_id window id to be removed
+ */
+ void StopWaitingForWindow(const WindowID window_id);
+
+ /**
+ * @brief retreives stored notification data
+ */
+ const smart_objects::SmartObjectSPtr display_capabilities() const;
+
+ private:
+ smart_objects::SmartObjectSPtr display_capabilities_;
+ typedef std::set<WindowID> WindowIDsToResume;
+ WindowIDsToResume window_ids_to_resume_;
+ Application& owner_;
+ ResumeCallback resume_callback_;
+ sync_primitives::Lock display_capabilities_lock_;
+};
+} // namespace application_manager
+#endif
diff --git a/src/components/application_manager/include/application_manager/event_engine/event.h b/src/components/application_manager/include/application_manager/event_engine/event.h
index 68ee508a9b..e7382e01a4 100644
--- a/src/components/application_manager/include/application_manager/event_engine/event.h
+++ b/src/components/application_manager/include/application_manager/event_engine/event.h
@@ -34,9 +34,10 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_ENGINE_EVENT_H_
#include <interfaces/HMI_API.h>
+#include <interfaces/MOBILE_API.h>
-#include "smart_objects/smart_object.h"
#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace application_manager {
namespace event_engine {
@@ -130,9 +131,9 @@ int32_t Event::smart_object_function_id() const {
}
int32_t Event::smart_object_correlation_id() const {
- return response_so_.getElement(strings::params)
- .getElement(strings::correlation_id)
- .asInt();
+ return static_cast<int32_t>(response_so_.getElement(strings::params)
+ .getElement(strings::correlation_id)
+ .asInt());
}
int32_t Event::smart_object_type() const {
@@ -141,6 +142,104 @@ int32_t Event::smart_object_type() const {
.asInt();
}
+class MobileEvent {
+ public:
+ // Typedef for possible Event ID's from mobile_apis functionID enum
+ typedef mobile_apis::FunctionID::eType MobileEventID;
+
+ /*
+ * @brief Constructor with parameters
+ *
+ * @param id Event ID. Please see mobile_apis::FunctionID for possible ID's
+ */
+ explicit MobileEvent(const MobileEventID& id);
+
+ /*
+ * @brief Destructor
+ */
+ virtual ~MobileEvent();
+
+ /*
+ * @brief Sends synchronously event to all subscribers.
+ *
+ */
+ void raise(EventDispatcher& event_dispatcher);
+
+ /*
+ * @brief Provides event ID
+ */
+ inline const MobileEventID& id() const;
+
+ /*
+ * @brief Sets event smart object
+ *
+ * @param so The smart_object received in Mobile response
+ */
+ void set_smart_object(const smart_objects::SmartObject& so);
+
+ /*
+ * @brief Retrieves event smart object
+ *
+ * @return The smart_object received in Mobile response
+ */
+ inline const smart_objects::SmartObject& smart_object() const;
+
+ /*
+ * @brief Retrieves smart object request ID
+ */
+ inline int32_t smart_object_function_id() const;
+
+ /*
+ * @brief Retrieves smart object correlation ID
+ */
+ inline int32_t smart_object_correlation_id() const;
+
+ /*
+ * @brief Retrieves smart_object response type
+ */
+ inline int32_t smart_object_type() const;
+
+ protected:
+ private:
+ MobileEventID id_;
+ smart_objects::SmartObject response_so_;
+
+ /*
+ * @brief Default constructor
+ *
+ * Unimplemented to avoid misusing
+ */
+ MobileEvent();
+
+ DISALLOW_COPY_AND_ASSIGN(MobileEvent);
+};
+
+const MobileEvent::MobileEventID& MobileEvent::id() const {
+ return id_;
+}
+
+const smart_objects::SmartObject& MobileEvent::smart_object() const {
+ return response_so_;
+}
+
+int32_t MobileEvent::smart_object_function_id() const {
+ return static_cast<int32_t>(response_so_.getElement(strings::params)
+ .getElement(strings::function_id)
+ .asInt());
+}
+
+int32_t MobileEvent::smart_object_correlation_id() const {
+ return static_cast<int32_t>(response_so_.getElement(strings::params)
+ .getElement(strings::correlation_id)
+ .asInt());
+}
+
+int32_t MobileEvent::smart_object_type() const {
+ return static_cast<int32_t>(response_so_.getElement(strings::params)
+ .getElement(strings::message_type)
+ .asInt());
+}
+
} // namespace event_engine
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h
index 813dda0295..0656372f47 100644
--- a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h
+++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h
@@ -77,6 +77,42 @@ class EventDispatcher {
*/
virtual void remove_observer(EventObserver& observer) = 0;
+ // Mobile Events
+
+ /*
+ * @brief Delivers the event to all subscribers
+ *
+ * @param event Received event
+ */
+ virtual void raise_mobile_event(const MobileEvent& event) = 0;
+
+ /*
+ * @brief Subscribe the observer to event
+ *
+ * @param event_id The event ID to subscribe for
+ * @param hmi_correlation_id The event HMI correlation ID
+ * @param observer The observer to subscribe for event
+ */
+ virtual void add_mobile_observer(const MobileEvent::MobileEventID& event_id,
+ int32_t mobile_correlation_id,
+ EventObserver& observer) = 0;
+
+ /*
+ * @brief Unsubscribes the observer from specific event
+ *
+ * @param event_id The event ID to unsubscribe from
+ * @param observer The observer to be unsubscribed
+ */
+ virtual void remove_mobile_observer(
+ const MobileEvent::MobileEventID& event_id, EventObserver& observer) = 0;
+
+ /*
+ * @brief Unsubscribes the observer from all events
+ *
+ * @param observer The observer to be unsubscribed
+ */
+ virtual void remove_mobile_observer(EventObserver& observer) = 0;
+
/*
* @brief Destructor
*/
diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h
index 4cdbb902de..3644299499 100644
--- a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h
+++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_ENGINE_EVENT_DISPATCHER_IMPL_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_ENGINE_EVENT_DISPATCHER_IMPL_H_
-#include <vector>
#include <map>
+#include <vector>
#include "utils/lock.h"
@@ -52,6 +52,8 @@ class EventDispatcherImpl : public EventDispatcher {
typedef std::vector<EventObserver*> ObserverVector;
typedef std::map<int32_t, ObserverVector> ObserversMap;
typedef std::map<Event::EventID, ObserversMap> EventObserverMap;
+ typedef std::map<MobileEvent::MobileEventID, ObserversMap>
+ MobileEventObserverMap;
/*
* @brief Destructor
*/
@@ -66,6 +68,9 @@ class EventDispatcherImpl : public EventDispatcher {
EventObserverMap get_observers() const {
return observers_event_;
}
+ MobileEventObserverMap get_mobile_observers() const {
+ return mobile_observers_event_;
+ }
ObserverVector get_observers_list() const {
return observers_;
}
@@ -105,6 +110,41 @@ class EventDispatcherImpl : public EventDispatcher {
*/
void remove_observer(EventObserver& observer) OVERRIDE;
+ // Mobile requests
+ /*
+ * @brief Delivers the event to all subscribers
+ *
+ * @param event Received event
+ */
+ void raise_mobile_event(const MobileEvent& event) OVERRIDE;
+
+ /*
+ * @brief Subscribe the observer to event
+ *
+ * @param event_id The event ID to subscribe for
+ * @param hmi_correlation_id The event HMI correlation ID
+ * @param observer The observer to subscribe for event
+ */
+ void add_mobile_observer(const MobileEvent::MobileEventID& event_id,
+ int32_t mobile_correlation_id,
+ EventObserver& observer) OVERRIDE;
+
+ /*
+ * @brief Unsubscribes the observer from specific event
+ *
+ * @param event_id The event ID to unsubscribe from
+ * @param observer The observer to be unsubscribed
+ */
+ void remove_mobile_observer(const MobileEvent::MobileEventID& event_id,
+ EventObserver& observer) OVERRIDE;
+
+ /*
+ * @brief Unsubscribes the observer from all events
+ *
+ * @param observer The observer to be unsubscribed
+ */
+ void remove_mobile_observer(EventObserver& observer) OVERRIDE;
+
private:
/*
* @brief removes observer
@@ -113,14 +153,25 @@ class EventDispatcherImpl : public EventDispatcher {
*/
void remove_observer_from_vector(EventObserver& observer);
+ /*
+ * @brief removes observer
+ * when occurs unsubscribe from event
+ * @param observer to be removed
+ */
+ void remove_mobile_observer_from_vector(EventObserver& observer);
+
DISALLOW_COPY_AND_ASSIGN(EventDispatcherImpl);
private:
// Members section
sync_primitives::Lock state_lock_;
- sync_primitives::Lock observer_lock_;
+ sync_primitives::Lock mobile_state_lock_;
+ sync_primitives::RecursiveLock observer_lock_;
+ sync_primitives::RecursiveLock mobile_observer_lock_;
EventObserverMap observers_event_;
+ MobileEventObserverMap mobile_observers_event_;
ObserverVector observers_;
+ ObserverVector mobile_observers_;
};
} // namespace event_engine
diff --git a/src/components/application_manager/include/application_manager/event_engine/event_observer.h b/src/components/application_manager/include/application_manager/event_engine/event_observer.h
index 593f1df657..1f4eccaf46 100644
--- a/src/components/application_manager/include/application_manager/event_engine/event_observer.h
+++ b/src/components/application_manager/include/application_manager/event_engine/event_observer.h
@@ -72,6 +72,8 @@ class EventObserver {
*/
virtual void on_event(const Event& event) = 0;
+ virtual void on_event(const MobileEvent& event);
+
protected:
/*
* @brief Subscribe to an event
@@ -94,7 +96,32 @@ class EventObserver {
* @brief Unsubscribes the observer from all events
*
*/
- void unsubscribe_from_all_events();
+ void unsubscribe_from_all_hmi_events();
+
+ // Mobile Events
+
+ /*
+ * @brief Subscribe to an event
+ *
+ * @param event_id The event ID to subscribe for
+ * @param mobile_correlation_id The event mobile correlation ID.
+ * If param is omitted, it means subscription for mobile notification
+ */
+ void subscribe_on_event(const MobileEvent::MobileEventID& event_id,
+ int32_t mobile_correlation_id = 0);
+
+ /*
+ * @brief Unsubscribes the observer from specific event
+ *
+ * @param event_id The event ID to unsubscribe from
+ */
+ void unsubscribe_from_event(const MobileEvent::MobileEventID& event_id);
+
+ /*
+ * @brief Unsubscribes the observer from all events
+ *
+ */
+ void unsubscribe_from_all_mobile_events();
private:
ObserverID id_;
diff --git a/src/components/application_manager/include/application_manager/help_prompt_manager.h b/src/components/application_manager/include/application_manager/help_prompt_manager.h
new file mode 100644
index 0000000000..eb45705d9f
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/help_prompt_manager.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELP_PROMPT_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELP_PROMPT_MANAGER_H_
+
+#include "smart_objects/smart_object.h"
+
+namespace application_manager {
+/**
+ * @brief The HelpPromptManager is a mechanism for handling "help" requests
+ * by the user when the application does not provide any or such information.
+ */
+class HelpPromptManager {
+ public:
+ /**
+ * @brief Class destructor
+ */
+ virtual ~HelpPromptManager() {}
+
+ /**
+ * @brief Adds command to constructed values, and sends SetGlobalProperties if
+ * required
+ * @param cmd_id command unique ID
+ * @param command smart object with commands to add
+ * @param is_resumption flag for identifying if command was added during data
+ * resumption process
+ */
+ virtual void OnVrCommandAdded(const uint32_t cmd_id,
+ const smart_objects::SmartObject& command,
+ const bool is_resumption) = 0;
+
+ /**
+ * @brief Removes command from constructed values, and send
+ * SetGlobalProperties if required
+ * @param cmd_id command unique ID
+ * @param is_resumption flag for identifying if command was added during data
+ * resumption process
+ */
+ virtual void OnVrCommandDeleted(const uint32_t cmd_id,
+ const bool is_resumption) = 0;
+
+ /**
+ * @brief Stop constructing vrHelp and/or helpPrompt if they are present in
+ * message
+ * @param msg containing GlobalProperties
+ * @param is_response determines is the request or response for the for
+ * the SetGlobalPropertiesRequest
+ */
+ virtual void OnSetGlobalPropertiesReceived(
+ const smart_objects::SmartObject& msg, const bool is_response) = 0;
+
+ /**
+ * @brief Requests sending type behavior
+ */
+ enum class SendingType { kNoneSend, kSendHelpPrompt, kSendVRHelp, kSendBoth };
+
+ /**
+ * @brief Get current sending type
+ * @return current sending type
+ */
+ virtual SendingType GetSendingType() const = 0;
+};
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELP_PROMPT_MANAGER_H_
diff --git a/src/components/application_manager/include/application_manager/help_prompt_manager_impl.h b/src/components/application_manager/include/application_manager/help_prompt_manager_impl.h
new file mode 100644
index 0000000000..3cd22a6afc
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/help_prompt_manager_impl.h
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELP_PROMPT_MANAGER_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELP_PROMPT_MANAGER_IMPL_H_
+
+#include "application_manager/help_prompt_manager.h"
+
+#include <algorithm>
+#include <vector>
+
+#include "utils/lock.h"
+#include "utils/timer.h"
+
+namespace application_manager {
+
+class Application;
+class ApplicationManager;
+
+/**
+ * @brief The HelpPromptManagerImpl class implemented interface
+ * HelpPromptManager
+ * is a mechanism for handling "help" requests
+ * by the user when the application does not provide any or such information.
+ */
+class HelpPromptManagerImpl : public HelpPromptManager {
+ public:
+ /**
+ * @brief Container for buffering VR help commands
+ */
+ typedef std::pair<uint32_t, smart_objects::SmartObjectSPtr> VRCommandPair;
+ typedef std::vector<VRCommandPair> VRCommandPairs;
+
+ /**
+ * @brief Class constructor
+ * @param app owner for this class
+ */
+ HelpPromptManagerImpl(Application& app, ApplicationManager& app_manager);
+
+ /**
+ * @brief Class destructor
+ */
+ ~HelpPromptManagerImpl();
+
+ /**
+ * @brief Adds command to constructed values, and sends SetGlobalProperties if
+ * required
+ * @param cmd_id command unique ID
+ * @param command smart object with commands to add
+ * @param is_resumption flag for identifying if command was added during data
+ * resumption process
+ */
+ void OnVrCommandAdded(const uint32_t cmd_id,
+ const smart_objects::SmartObject& command,
+ const bool is_resumption) OVERRIDE;
+
+ /**
+ * @brief Removes command from constructed values, and send
+ * SetGlobalProperties if required
+ * @param cmd_id command unique ID
+ * @param is_resumption flag for identifying if command was added during data
+ * resumption process
+ */
+ void OnVrCommandDeleted(const uint32_t cmd_id,
+ const bool is_resumption) OVERRIDE;
+
+ /**
+ * @brief Stop constructing vrHelp and/or helpPrompt if they are present in
+ * message
+ * @param msg containing GlobalProperties
+ * @param is_response determines is the request or response for the for
+ * the SetGlobalPropertiesRequest
+ */
+ void OnSetGlobalPropertiesReceived(const smart_objects::SmartObject& msg,
+ const bool is_response) OVERRIDE;
+
+ /**
+ * @brief Get current sending type
+ * @return current sending type
+ */
+ SendingType GetSendingType() const OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(HelpPromptManagerImpl);
+
+ /**
+ * @brief Add new smart object with VR command to the map
+ * @param cmd_id ID of VR command
+ * @param command smart object containing VR command structure
+ * @return true if first kLimitCommand commands was changed after adding
+ * of the current command otherwise returns false
+ */
+ bool AddCommand(const uint32_t cmd_id,
+ const smart_objects::SmartObject& command);
+ /**
+ * @brief Delete VR command from map by its cmd_id
+ * @param cmd_id ID of VR command
+ * @return true if first kLimitCommand commands was changed after deleting
+ * of the current command otherwise returns false
+ */
+ bool DeleteCommand(const uint32_t cmd_id);
+
+ /**
+ * @brief Send TTS request to HMI
+ */
+ void SendTTSRequest();
+
+ /**
+ * @brief Send UI request to HMI
+ */
+ void SendUIRequest();
+
+ /**
+ * @brief Send TTS and UI requests to HMI
+ */
+ void SendBothRequests();
+
+ /**
+ * @brief Send TTS or UI or both Requests
+ */
+ void SendRequests();
+
+ /**
+ * @brief Construct the helpPrompt parameter
+ */
+ void CreatePromptMsg(smart_objects::SmartObject& out_msg_params);
+
+ /**
+ * @brief Construct the vrHelp parameter
+ */
+ void CreateVRMsg(smart_objects::SmartObject& out_msg_params);
+
+ /**
+ * @brief Setting request type to send HMI
+ * @param msg containing request or response for the
+ * SetGlobalPropertiesRequest
+ */
+ void SetSendingType(const smart_objects::SmartObject& msg);
+
+ /**
+ * @brief Get the total count of commands in VRCommand pairs
+ * @param end_element pointer to VRCommandPairs element to which commands
+ * should be counted
+ * @return total count of commands
+ */
+ size_t GetCommandsCount(VRCommandPairs::const_iterator end_element) const;
+
+ /**
+ * @brief Generate help prompt/vr help items array and write it into provided
+ * smart object
+ * @param out_msg_params output smart object
+ * @param vr_key name of vr item in response
+ */
+ void GenerateVrItems(smart_objects::SmartObject& out_msg_params,
+ const char* vr_key) const;
+
+ Application& app_;
+ ApplicationManager& app_manager_;
+ VRCommandPairs vr_commands_;
+ sync_primitives::Lock vr_commands_lock_;
+ SendingType sending_type_;
+ bool is_tts_send_;
+ bool is_ui_send_;
+};
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELP_PROMPT_MANAGER_IMPL_H_
diff --git a/src/components/application_manager/include/application_manager/helpers/application_helper.h b/src/components/application_manager/include/application_manager/helpers/application_helper.h
index 145bef659e..a7933c2451 100644
--- a/src/components/application_manager/include/application_manager/helpers/application_helper.h
+++ b/src/components/application_manager/include/application_manager/helpers/application_helper.h
@@ -57,6 +57,31 @@ ApplicationSharedPtr FindApp(DataAccessor<ApplicationSet> accessor,
return app;
}
+template <class UnaryPredicate>
+ApplicationSharedPtr FindPendingApp(
+ DataAccessor<AppsWaitRegistrationSet> accessor, UnaryPredicate finder) {
+ AppsWaitRegistrationSet::iterator it = std::find_if(
+ accessor.GetData().begin(), accessor.GetData().end(), finder);
+ if (accessor.GetData().end() == it) {
+ return ApplicationSharedPtr();
+ }
+ ApplicationSharedPtr app = *it;
+ return app;
+}
+
+template <class UnaryPredicate>
+ApplicationSharedPtr FindReregisterApp(
+ DataAccessor<ReregisterWaitList> accessor, UnaryPredicate finder) {
+ ReregisterWaitList::const_iterator begin = accessor.GetData().begin();
+ ReregisterWaitList::const_iterator end = accessor.GetData().end();
+ ReregisterWaitList::const_iterator it = std::find_if(begin, end, finder);
+ if (accessor.GetData().end() == it) {
+ return ApplicationSharedPtr();
+ }
+ ApplicationSharedPtr app = *it;
+ return app;
+}
+
/**
* Helper function for lookup through applications list and returning all
* applications satisfying predicate logic
diff --git a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
index 9380fb41ac..b7f41ca297 100644
--- a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
+++ b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
@@ -28,22 +28,18 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
-*/
+ */
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_IMPL_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_IMPL_H_
#include "application_manager/hmi_capabilities.h"
+#include "application_manager/hmi_language_handler.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
#include "json/json.h"
-#include "utils/macro.h"
-#include "application_manager/hmi_language_handler.h"
#include "smart_objects/smart_object.h"
-
-namespace resumption {
-class LastState;
-} // namespace resumption
+#include "utils/macro.h"
namespace application_manager {
class ApplicationManager;
@@ -219,7 +215,7 @@ class HMICapabilitiesImpl : public HMICapabilities {
*
* @return Currently supported display capabilities
*/
- const smart_objects::SmartObject* display_capabilities() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr display_capabilities() const OVERRIDE;
/*
* @brief Sets supported display capabilities
@@ -230,11 +226,25 @@ class HMICapabilitiesImpl : public HMICapabilities {
const smart_objects::SmartObject& display_capabilities) OVERRIDE;
/*
+ * @brief Retrieves information about the display capability
+ * @return Currently supported display capability
+ */
+ const smart_objects::SmartObjectSPtr system_display_capabilities()
+ const OVERRIDE;
+
+ /*
+ * @brief Sets supported display capability
+ * @param display_capabilities supported display capability
+ */
+ void set_system_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities);
+
+ /*
* @brief Retrieves information about the HMI zone capabilities
*
* @return Currently supported HMI zone capabilities
*/
- const smart_objects::SmartObject* hmi_zone_capabilities() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr hmi_zone_capabilities() const OVERRIDE;
/*
* @brief Sets supported HMI zone capabilities
@@ -249,7 +259,8 @@ class HMICapabilitiesImpl : public HMICapabilities {
*
* @return Currently supported SoftButton's capabilities
*/
- const smart_objects::SmartObject* soft_button_capabilities() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr soft_button_capabilities()
+ const OVERRIDE;
/*
* @brief Sets supported SoftButton's capabilities
@@ -264,7 +275,7 @@ class HMICapabilitiesImpl : public HMICapabilities {
*
* @return Currently supported Button's capabilities
*/
- const smart_objects::SmartObject* button_capabilities() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr button_capabilities() const OVERRIDE;
/*
* @brief Sets supported Button's capabilities
@@ -287,7 +298,7 @@ class HMICapabilitiesImpl : public HMICapabilities {
*
* @return Currently supported speech capabilities
*/
- const smart_objects::SmartObject* speech_capabilities() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr speech_capabilities() const OVERRIDE;
/*
* @brief Sets supported VR capabilities
@@ -302,7 +313,7 @@ class HMICapabilitiesImpl : public HMICapabilities {
*
* @return Currently supported VR capabilities
*/
- const smart_objects::SmartObject* vr_capabilities() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr vr_capabilities() const OVERRIDE;
/*
* @brief Sets supported audio_pass_thru capabilities
@@ -317,7 +328,7 @@ class HMICapabilitiesImpl : public HMICapabilities {
*
* @return Currently supported audio_pass_thru capabilities
*/
- const smart_objects::SmartObject* audio_pass_thru_capabilities()
+ const smart_objects::SmartObjectSPtr audio_pass_thru_capabilities()
const OVERRIDE;
/*
@@ -333,14 +344,15 @@ class HMICapabilitiesImpl : public HMICapabilities {
*
* @return Currently supported pcm_streaming capabilities
*/
- const smart_objects::SmartObject* pcm_stream_capabilities() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr pcm_stream_capabilities() const OVERRIDE;
/*
* @brief Retrieves information about the preset bank capabilities
*
* @return Currently supported preset bank capabilities
*/
- const smart_objects::SmartObject* preset_bank_capabilities() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr preset_bank_capabilities()
+ const OVERRIDE;
/*
* @brief Sets supported preset bank capabilities
@@ -363,14 +375,14 @@ class HMICapabilitiesImpl : public HMICapabilities {
*
* @param vehicle_type Cuurent vehicle information
*/
- const smart_objects::SmartObject* vehicle_type() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr vehicle_type() const OVERRIDE;
/*
* @brief Retrieves information about the prerecorded speech
*
* @return Currently supported prerecorded speech
*/
- const smart_objects::SmartObject* prerecorded_speech() const OVERRIDE;
+ const smart_objects::SmartObjectSPtr prerecorded_speech() const OVERRIDE;
/*
* @brief Sets supported prerecorded speech
@@ -493,6 +505,14 @@ class HMICapabilitiesImpl : public HMICapabilities {
const smart_objects::SmartObject* rc_capability() const OVERRIDE;
+ void set_seat_location_capability(
+ const smart_objects::SmartObject& seat_location_capability) OVERRIDE;
+
+ const smart_objects::SmartObject* seat_location_capability() const OVERRIDE;
+
+ void Init(resumption::LastStateWrapperPtr last_state_wrapper) OVERRIDE;
+
+ DEPRECATED
void Init(resumption::LastState* last_state) OVERRIDE;
/*
@@ -542,6 +562,18 @@ class HMICapabilitiesImpl : public HMICapabilities {
const Json::Value& json_languages,
smart_objects::SmartObject& languages) const OVERRIDE;
+ /*
+ * @brief function that converts a single entry of audio pass thru capability
+ * to smart object
+ *
+ * @param capability json object that represents a single entry of audio pass
+ * thru capability
+ * @param output_so the converted object
+ */
+ void convert_audio_capability_to_obj(
+ const Json::Value& capability,
+ smart_objects::SmartObject& output_so) const OVERRIDE;
+
private:
bool is_vr_cooperating_;
bool is_tts_cooperating_;
@@ -554,20 +586,26 @@ class HMICapabilitiesImpl : public HMICapabilities {
hmi_apis::Common_Language::eType ui_language_;
hmi_apis::Common_Language::eType vr_language_;
hmi_apis::Common_Language::eType tts_language_;
- smart_objects::SmartObject* vehicle_type_;
+ smart_objects::SmartObjectSPtr vehicle_type_;
smart_objects::SmartObject* ui_supported_languages_;
smart_objects::SmartObject* tts_supported_languages_;
smart_objects::SmartObject* vr_supported_languages_;
- smart_objects::SmartObject* display_capabilities_;
- smart_objects::SmartObject* hmi_zone_capabilities_;
- smart_objects::SmartObject* soft_buttons_capabilities_;
- smart_objects::SmartObject* button_capabilities_;
- smart_objects::SmartObject* preset_bank_capabilities_;
- smart_objects::SmartObject* vr_capabilities_;
- smart_objects::SmartObject* speech_capabilities_;
- smart_objects::SmartObject* audio_pass_thru_capabilities_;
- smart_objects::SmartObject* pcm_stream_capabilities_;
- smart_objects::SmartObject* prerecorded_speech_;
+ /*
+ * display_capabilities_ is deprecated and replaced by
+ * system_display_capabilities_. For backward compatibility
+ * display_capabilities_ is not removed.
+ */
+ smart_objects::SmartObjectSPtr display_capabilities_;
+ smart_objects::SmartObjectSPtr system_display_capabilities_;
+ smart_objects::SmartObjectSPtr hmi_zone_capabilities_;
+ smart_objects::SmartObjectSPtr soft_buttons_capabilities_;
+ smart_objects::SmartObjectSPtr button_capabilities_;
+ smart_objects::SmartObjectSPtr preset_bank_capabilities_;
+ smart_objects::SmartObjectSPtr vr_capabilities_;
+ smart_objects::SmartObjectSPtr speech_capabilities_;
+ smart_objects::SmartObjectSPtr audio_pass_thru_capabilities_;
+ smart_objects::SmartObjectSPtr pcm_stream_capabilities_;
+ smart_objects::SmartObjectSPtr prerecorded_speech_;
bool is_navigation_supported_;
bool is_phone_call_supported_;
bool is_video_streaming_supported_;
@@ -577,6 +615,7 @@ class HMICapabilitiesImpl : public HMICapabilities {
smart_objects::SmartObject* phone_capability_;
smart_objects::SmartObject* video_streaming_capability_;
smart_objects::SmartObject* rc_capability_;
+ smart_objects::SmartObject* seat_location_capability_;
ApplicationManager& app_mngr_;
HMILanguageHandler hmi_language_handler_;
diff --git a/src/components/application_manager/include/application_manager/hmi_interfaces.h b/src/components/application_manager/include/application_manager/hmi_interfaces.h
index 59ec32694a..5f172b415d 100644
--- a/src/components/application_manager/include/application_manager/hmi_interfaces.h
+++ b/src/components/application_manager/include/application_manager/hmi_interfaces.h
@@ -60,7 +60,8 @@ class HmiInterfaces {
HMI_INTERFACE_Navigation,
HMI_INTERFACE_VehicleInfo,
HMI_INTERFACE_SDL,
- HMI_INTERFACE_RC
+ HMI_INTERFACE_RC,
+ HMI_INTERFACE_AppService
};
/**
diff --git a/src/components/application_manager/include/application_manager/hmi_interfaces_impl.h b/src/components/application_manager/include/application_manager/hmi_interfaces_impl.h
index 2b2d1e1361..3202d44e1e 100644
--- a/src/components/application_manager/include/application_manager/hmi_interfaces_impl.h
+++ b/src/components/application_manager/include/application_manager/hmi_interfaces_impl.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_INTERFACES_IMPL_H_
#include <map>
#include "application_manager/hmi_interfaces.h"
-#include "utils/macro.h"
#include "utils/lock.h"
+#include "utils/macro.h"
/**
* @brief The HmiInterfacesImpl class handles
* hmi interfaces states
diff --git a/src/components/application_manager/include/application_manager/hmi_language_handler.h b/src/components/application_manager/include/application_manager/hmi_language_handler.h
index 6158cb4585..2ef034450d 100644
--- a/src/components/application_manager/include/application_manager/hmi_language_handler.h
+++ b/src/components/application_manager/include/application_manager/hmi_language_handler.h
@@ -28,19 +28,17 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
-*/
+ */
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_LANGUAGE_HANDLER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_LANGUAGE_HANDLER_H_
#include "application_manager/event_engine/event_observer.h"
-#include "utils/lock.h"
#include "interfaces/HMI_API.h"
+#include "resumption/last_state_wrapper.h"
#include "smart_objects/smart_object.h"
+#include "utils/lock.h"
-namespace resumption {
-class LastState;
-}
namespace application_manager {
class ApplicationManager;
@@ -56,8 +54,8 @@ class HMILanguageHandler : public event_engine::EventObserver {
typedef std::map<uint32_t, bool> Apps;
/**
- * @brief System interfaces
- */
+ * @brief System interfaces
+ */
enum Interface { INTERFACE_UI, INTERFACE_VR, INTERFACE_TTS };
/**
@@ -97,7 +95,11 @@ class HMILanguageHandler : public event_engine::EventObserver {
void set_default_capabilities_languages(hmi_apis::Common_Language::eType ui,
hmi_apis::Common_Language::eType vr,
hmi_apis::Common_Language::eType tts);
- void Init(resumption::LastState* value);
+
+ DEPRECATED
+ void Init(resumption::LastState*);
+
+ void Init(resumption::LastStateWrapperPtr value);
/**
* @brief Removes application from container after
@@ -179,7 +181,7 @@ class HMILanguageHandler : public event_engine::EventObserver {
* @brief Indicates if current TTS language has been received from HMI
*/
bool is_tts_language_received_;
- resumption::LastState* last_state_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
ApplicationManager& application_manager_;
};
diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h
index a22d32920a..5b9e201391 100644
--- a/src/components/application_manager/include/application_manager/hmi_state.h
+++ b/src/components/application_manager/include/application_manager/hmi_state.h
@@ -35,8 +35,8 @@
#include <iosfwd>
#include <list>
+#include <memory>
#include "interfaces/MOBILE_API.h"
-#include "utils/shared_ptr.h"
#include "utils/macro.h"
namespace application_manager {
@@ -45,14 +45,15 @@ class HmiState;
class ApplicationManager;
class Application;
-typedef utils::SharedPtr<HmiState> HmiStatePtr;
+typedef std::shared_ptr<HmiState> HmiStatePtr;
+typedef int32_t WindowID;
/**
-* @brief The HmiState class
-* Handle Hmi state of application (hmi level,
-* audio streaming state, system context)
-*
-*/
+ * @brief The HmiState class
+ * Handle Hmi state of application (hmi level,
+ * audio streaming state, system context)
+ *
+ */
class HmiState {
friend std::ostream& operator<<(std::ostream& os, const HmiState& src);
@@ -62,18 +63,18 @@ class HmiState {
* If no events occurred STATE_ID_DEFAULT should be presented
*/
enum StateID {
- STATE_ID_CURRENT,
- STATE_ID_REGULAR,
- STATE_ID_POSTPONED,
- STATE_ID_PHONE_CALL,
- STATE_ID_SAFETY_MODE,
- STATE_ID_VR_SESSION,
- STATE_ID_TTS_SESSION,
- STATE_ID_VIDEO_STREAMING,
- STATE_ID_NAVI_STREAMING,
- STATE_ID_DEACTIVATE_HMI,
- STATE_ID_AUDIO_SOURCE,
- STATE_ID_EMBEDDED_NAVI
+ STATE_ID_CURRENT = 1,
+ STATE_ID_REGULAR = 2,
+ STATE_ID_POSTPONED = 3,
+ STATE_ID_PHONE_CALL = 4,
+ STATE_ID_SAFETY_MODE = 5,
+ STATE_ID_VR_SESSION = 6,
+ STATE_ID_TTS_SESSION = 7,
+ STATE_ID_VIDEO_STREAMING = 8,
+ STATE_ID_NAVI_STREAMING = 9,
+ STATE_ID_DEACTIVATE_HMI = 10,
+ STATE_ID_AUDIO_SOURCE = 11,
+ STATE_ID_EMBEDDED_NAVI = 12
};
/**
@@ -81,7 +82,7 @@ class HmiState {
* @param app Application pointer
* @param app_mngr Application manager
*/
- HmiState(utils::SharedPtr<Application> app,
+ HmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
/**
@@ -90,26 +91,7 @@ class HmiState {
* @param app_mngr Application manager
* @param state_id HMI state to assign
*/
- HmiState(utils::SharedPtr<Application> app,
- const ApplicationManager& app_mngr,
- StateID state_id);
-
- /**
- * DEPRECATED
- * @brief HmiState constructor
- * @param app_id Application id
- * @param app_mngr Application manager
- */
- HmiState(uint32_t app_id, const ApplicationManager& app_mngr);
-
- /**
- * DEPRECATED
- * @brief HmiState constructor
- * @param app_id Application id
- * @param app_mngr Application manager
- * @param state_id HMI state to assign
- */
- HmiState(uint32_t app_id,
+ HmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr,
StateID state_id);
@@ -225,11 +207,24 @@ class HmiState {
state_id_ = state_id;
}
+ /**
+ * @brief window_type getter for a window type for this type
+ * @return current state window type
+ */
+ mobile_apis::WindowType::eType window_type() const;
+
+ /**
+ * @brief set_window_type sets current state window type
+ * @param window_type new window type
+ */
+ void set_window_type(const mobile_apis::WindowType::eType window_type);
+
protected:
- utils::SharedPtr<Application> app_;
+ uint32_t hmi_app_id_;
StateID state_id_;
const ApplicationManager& app_mngr_;
HmiStatePtr parent_;
+ mobile_apis::WindowType::eType window_type_;
mobile_apis::HMILevel::eType hmi_level_;
mobile_apis::AudioStreamingState::eType audio_streaming_state_;
mobile_apis::VideoStreamingState::eType video_streaming_state_;
@@ -272,10 +267,8 @@ class VRHmiState : public HmiState {
public:
virtual mobile_apis::AudioStreamingState::eType audio_streaming_state()
const OVERRIDE;
- VRHmiState(utils::SharedPtr<Application> app,
+ VRHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
-
- DEPRECATED VRHmiState(uint32_t app_id, const ApplicationManager& app_mngr);
};
/**
@@ -283,11 +276,9 @@ class VRHmiState : public HmiState {
*/
class TTSHmiState : public HmiState {
public:
- TTSHmiState(utils::SharedPtr<Application> app,
+ TTSHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
- DEPRECATED TTSHmiState(uint32_t app_id, const ApplicationManager& app_mngr);
-
virtual mobile_apis::AudioStreamingState::eType audio_streaming_state()
const OVERRIDE;
};
@@ -298,7 +289,7 @@ class TTSHmiState : public HmiState {
*/
class VideoStreamingHmiState : public HmiState {
public:
- VideoStreamingHmiState(utils::SharedPtr<Application> app,
+ VideoStreamingHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
mobile_apis::VideoStreamingState::eType video_streaming_state()
@@ -311,7 +302,7 @@ class VideoStreamingHmiState : public HmiState {
*/
class NaviStreamingHmiState : public VideoStreamingHmiState {
public:
- NaviStreamingHmiState(utils::SharedPtr<Application> app,
+ NaviStreamingHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
mobile_apis::AudioStreamingState::eType audio_streaming_state()
@@ -324,12 +315,9 @@ class NaviStreamingHmiState : public VideoStreamingHmiState {
*/
class PhoneCallHmiState : public HmiState {
public:
- PhoneCallHmiState(utils::SharedPtr<Application> app,
+ PhoneCallHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
- DEPRECATED PhoneCallHmiState(uint32_t app_id,
- const ApplicationManager& app_mngr);
-
mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
mobile_apis::AudioStreamingState::eType audio_streaming_state()
const OVERRIDE {
@@ -343,12 +331,9 @@ class PhoneCallHmiState : public HmiState {
*/
class SafetyModeHmiState : public HmiState {
public:
- SafetyModeHmiState(utils::SharedPtr<Application> app,
+ SafetyModeHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
- DEPRECATED SafetyModeHmiState(uint32_t app_id,
- const ApplicationManager& app_mngr);
-
mobile_apis::AudioStreamingState::eType audio_streaming_state()
const OVERRIDE {
return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
@@ -365,11 +350,9 @@ class SafetyModeHmiState : public HmiState {
*/
class DeactivateHMI : public HmiState {
public:
- DeactivateHMI(utils::SharedPtr<Application> app,
+ DeactivateHMI(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
- DEPRECATED DeactivateHMI(uint32_t app_id, const ApplicationManager& app_mngr);
-
mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
mobile_apis::AudioStreamingState::eType audio_streaming_state()
const OVERRIDE {
@@ -387,11 +370,9 @@ class DeactivateHMI : public HmiState {
*/
class AudioSource : public HmiState {
public:
- AudioSource(utils::SharedPtr<Application> app,
+ AudioSource(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
- DEPRECATED AudioSource(uint32_t app_id, const ApplicationManager& app_mngr);
-
mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
mobile_apis::AudioStreamingState::eType audio_streaming_state()
const OVERRIDE {
@@ -401,6 +382,9 @@ class AudioSource : public HmiState {
const OVERRIDE {
return mobile_apis::VideoStreamingState::NOT_STREAMABLE;
}
+
+ private:
+ bool keep_context_;
};
/**
@@ -410,11 +394,9 @@ class AudioSource : public HmiState {
*/
class EmbeddedNavi : public HmiState {
public:
- EmbeddedNavi(utils::SharedPtr<Application> app,
+ EmbeddedNavi(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr);
- DEPRECATED EmbeddedNavi(uint32_t app_id, const ApplicationManager& app_mngr);
-
mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
mobile_apis::AudioStreamingState::eType audio_streaming_state()
const OVERRIDE {
diff --git a/src/components/application_manager/include/application_manager/message.h b/src/components/application_manager/include/application_manager/message.h
index 7ca3e59f09..1ce7596bf2 100644
--- a/src/components/application_manager/include/application_manager/message.h
+++ b/src/components/application_manager/include/application_manager/message.h
@@ -36,10 +36,9 @@
#include <string>
#include <vector>
-#include "utils/shared_ptr.h"
+#include "protocol/common.h"
#include "protocol/message_priority.h"
#include "protocol/rpc_type.h"
-#include "protocol/common.h"
#include "smart_objects/smart_object.h"
namespace application_manager {
@@ -72,6 +71,12 @@ class Message {
int32_t correlation_id() const;
int32_t connection_key() const;
+ /**
+ * @brief retreives message's protection flag
+ * @return true if message is encrypted, otherwise returns false
+ */
+ bool is_message_encrypted() const;
+
MessageType type() const;
protocol_handler::MajorProtocolVersion protocol_version() const;
@@ -89,7 +94,6 @@ class Message {
void set_correlation_id(int32_t id);
void set_connection_key(int32_t key);
void set_message_type(MessageType type);
- DEPRECATED void set_binary_data(BinaryData* data);
void set_binary_data(const BinaryData* data);
void set_json_message(const std::string& json_message);
void set_protocol_version(protocol_handler::MajorProtocolVersion version);
@@ -97,6 +101,13 @@ class Message {
void set_data_size(size_t data_size);
void set_payload_size(size_t payload_size);
+ /**
+ * @brief sets message's protection flag
+ * @param protection - bool value, if message is encrypted - true, otherwise
+ * - false
+ */
+ void set_message_encryption(const bool protection);
+
static bool is_sufficient_version(
protocol_handler::MajorProtocolVersion minVersion,
protocol_handler::MajorProtocolVersion version);
@@ -124,10 +135,12 @@ class Message {
size_t data_size_;
size_t payload_size_;
protocol_handler::MajorProtocolVersion version_;
+
+ bool is_message_encrypted_;
};
-typedef utils::SharedPtr<application_manager::Message> MobileMessage;
-typedef utils::SharedPtr<application_manager::Message> MessagePtr;
+typedef std::shared_ptr<application_manager::Message> MobileMessage;
+typedef std::shared_ptr<application_manager::Message> MessagePtr;
} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_MESSAGE_H_
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index 6590098a01..5d95a2468d 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -37,19 +37,21 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_MESSAGE_HELPER_H_
#include <map>
-#include <vector>
#include <string>
+#include <vector>
-#include "interfaces/MOBILE_API.h"
-#include "interfaces/HMI_API.h"
-#include "utils/macro.h"
-#include "connection_handler/device.h"
+#include <application_manager/smart_object_keys.h>
#include "application_manager/application.h"
+#include "application_manager/hmi_capabilities.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "connection_handler/device.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
#include "policy/policy_types.h"
#include "protocol_handler/session_observer.h"
-#include "application_manager/policies/policy_handler_interface.h"
#include "smart_objects/smart_object.h"
#include "transport_manager/common.h"
+#include "utils/macro.h"
namespace policy {
class PolicyHandlerInterface;
@@ -72,9 +74,33 @@ typedef std::map<std::string, mobile_apis::VehicleDataType::eType> VehicleData;
class MessageHelper {
public:
/**
- * @brief Creates request for different interfaces(JSON, DBUS)
+ * @brief CreateNotification creates basic mobile notification smart object
+ * @param function_id Notification function ID
+ * @param app_id application to send notification
+ * @return basic mobile notification smart object
+ */
+ static smart_objects::SmartObjectSPtr CreateNotification(
+ mobile_apis::FunctionID::eType function_id, uint32_t app_id);
+ /**
+ * @brief CreateHMINotification creates basic hmi notification smart object
+ * @param function_id Notification function ID
+ * @return basic hmi notification smart object
+ */
+ static smart_objects::SmartObjectSPtr CreateHMINotification(
+ hmi_apis::FunctionID::eType function_id);
+
+ static smart_objects::SmartObjectSPtr CreateOnServiceUpdateNotification(
+ const hmi_apis::Common_ServiceType::eType type,
+ const hmi_apis::Common_ServiceEvent::eType event,
+ const hmi_apis::Common_ServiceStatusUpdateReason::eType reason =
+ hmi_apis::Common_ServiceStatusUpdateReason::INVALID_ENUM,
+ const uint32_t app_id = 0);
+
+ /**
+ * @brief Creates request for different interfaces(JSON)
* @param correlation_id unique ID
- * @param params Vector of arguments that we need in GetVehicleData request
+ * @param params Vector of arguments that we need in GetVehicleData
+ * request
* (e.g. gps, odometer, fuel_level)
*/
static void CreateGetVehicleDataRequest(
@@ -101,18 +127,18 @@ class MessageHelper {
static void SendOnLanguageChangeToMobile(uint32_t connection_key);
/**
- * @brief Sends DecryptCertificate request to HMI
- * @param file_name path to file containing encrypted certificate
- */
+ * @brief Sends DecryptCertificate request to HMI
+ * @param file_name path to file containing encrypted certificate
+ */
static void SendDecryptCertificateToHMI(const std::string& file_name,
ApplicationManager& app_mngr);
/**
- * @brief SendGetSystemTimeRequest sends mentioned request to HMI.
- * @param correlation_id the message correlation id, required for proper
- * response processing.
- * @param app_mngr
- */
+ * @brief SendGetSystemTimeRequest sends mentioned request to HMI.
+ * @param correlation_id the message correlation id, required for proper
+ * response processing.
+ * @param app_mngr
+ */
static void SendGetSystemTimeRequest(const uint32_t correlation_id,
ApplicationManager& app_mngr);
@@ -188,17 +214,17 @@ class MessageHelper {
const std::string& hmi_level);
/*
- * @brief Used to obtain string representation of app's
- * HMI Level.
- * @param hmi_level Desired HMI Level
- */
+ * @brief Used to obtain string representation of app's
+ * HMI Level.
+ * @param hmi_level Desired HMI Level
+ */
static std::string StringifiedHMILevel(
const mobile_apis::HMILevel::eType hmi_level);
/*
- * @brief Used to obtain function name by its id
- * @param function_id Function ID
- */
+ * @brief Used to obtain function name by its id
+ * @param function_id Function ID
+ */
static std::string StringifiedFunctionID(
mobile_apis::FunctionID::eType function_id);
@@ -285,6 +311,48 @@ class MessageHelper {
const uint32_t app_id,
ApplicationManager& app_mngr);
+ /**
+ * @brief Creates UI.CreateWindow request
+ * @param application application instance
+ * @param app_mngr reference to application manager
+ * @param windows_info smart object containing saved windows info
+ * @return smart object with UI.CreateWindow request
+ */
+ static smart_objects::SmartObjectSPtr CreateUICreateWindowRequestToHMI(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& window_info);
+
+ /**
+ * @brief Creates UI.CreateWindow requests
+ * @param application application instance
+ * @param app_mngr reference to application manager
+ * @param windows_info smart object containing saved windows info
+ * @return list of smart objects with UI.CreateWindow requests
+ */
+ static smart_objects::SmartObjectList CreateUICreateWindowRequestsToHMI(
+ application_manager::ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& windows_info);
+
+ /*
+ * @brief Create Common.DeviceInfo struct from device handle
+ * @param device_handle device handle of the app
+ * @param session_observer instance of SessionObserver to retrieve device
+ * information
+ * @param policy_handler instance of PolicyHandlerInterface to get the value
+ * of 'isSDLAllowed'
+ * @param app_mngr instance of ApplicationManager
+ * @param output smart object to store created Common.DeviceInfo struct
+ * @return true on success, false otherwise
+ */
+ static bool CreateDeviceInfo(
+ connection_handler::DeviceHandle device_handle,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ ApplicationManager& app_mngr,
+ smart_objects::SmartObject* output);
+
/*
* @brief Create Common.HMIApplication struct application instance
* @param app : applicaton instace
@@ -312,41 +380,51 @@ class MessageHelper {
static void SendOnAppUnregNotificationToHMI(ApplicationConstSharedPtr app,
bool is_unexpected_disconnect,
ApplicationManager& app_mngr);
+ /**
+ * @brief Creates BasicCommunication.OnAppPropertiesChange
+ * notification to the HMI
+ * @param policy_app_id unique policy app id
+ * @param app_mngr application manager
+ * @return smart object with BC.OnAppPropertiesChange notification
+ */
+ static smart_objects::SmartObjectSPtr CreateOnAppPropertiesChangeNotification(
+ const std::string& policy_app_id, ApplicationManager& app_mngr);
- static NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr
- GetBCActivateAppRequestToHMI(
+ static smart_objects::SmartObjectSPtr GetBCActivateAppRequestToHMI(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr);
+ static smart_objects::SmartObjectSPtr GetBCCloseApplicationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
+
static void SendOnResumeAudioSourceToHMI(const uint32_t app_id,
ApplicationManager& app_mngr);
/**
- * @brief Send SDL_ActivateApp response to HMI
- * @param permissions response parameters
- */
+ * @brief Send SDL_ActivateApp response to HMI
+ * @param permissions response parameters
+ */
static void SendSDLActivateAppResponse(policy::AppPermissions& permissions,
uint32_t correlation_id,
ApplicationManager& app_mngr);
/**
- * @brief Send OnSDLConsentNeeded to HMI for device data consent by user
- * @param device_info Device info, e.g. mac, handle, name
- */
+ * @brief Send OnSDLConsentNeeded to HMI for device data consent by user
+ * @param device_info Device info, e.g. mac, handle, name
+ */
static void SendOnSDLConsentNeeded(const policy::DeviceParams& device_info,
ApplicationManager& app_man);
/**
- * @brief Send request to SyncP process to read file and send
- * Policy Table Snapshot using Retry Strategy
- * @param file_path Path to file with PTS
- * @param timeout Timeout to wait for PTU in seconds
- * @param retries Seconds between retries
- */
+ * @brief Send request to SyncP process to read file and send
+ * Policy Table Snapshot using Retry Strategy
+ * @param file_path Path to file with PTS
+ * @param timeout Timeout to wait for PTU in seconds
+ * @param retries Seconds between retries
+ */
static void SendPolicyUpdate(const std::string& file_path,
const uint32_t timeout,
const std::vector<int>& retries,
@@ -410,13 +488,13 @@ class MessageHelper {
static void SendNaviStopStream(int32_t app_id, ApplicationManager& app_mngr);
/*
- * @brief Send notification for Update of Policy Table
- * with PT Snapshot.
- * @param connection_key Id of application to send message to
- * @param policy_data PT Snapshot
- * @param url If empty string, no URL is provided
- * @param timeout If -1 no timeout is provdied
- */
+ * @brief Send notification for Update of Policy Table
+ * with PT Snapshot.
+ * @param connection_key Id of application to send message to
+ * @param policy_data PT Snapshot
+ * @param url If empty string, no URL is provided
+ * @param timeout If -1 no timeout is provdied
+ */
static void SendPolicySnapshotNotification(
uint32_t connection_key,
const std::vector<uint8_t>& policy_data,
@@ -425,7 +503,7 @@ class MessageHelper {
static void SendSystemRequestNotification(
uint32_t connection_key,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& content,
+ ns_smart_device_link::ns_smart_objects::SmartObject& content,
ApplicationManager& app_mngr);
/**
@@ -450,20 +528,23 @@ class MessageHelper {
ApplicationManager& app_man);
/*
- * @brief Send notification to mobile on application permissions update
- * @param connection_key Id of application to send message to
- * @param permissions updated permissions for application
- */
+ * @brief Send notification to mobile on application permissions update
+ * @param connection_key Id of application to send message to
+ * @param permissions updated permissions for application
+ * @param app_mngr reference to application manager
+ * @param require_encryption require encryption flag
+ */
static void SendOnPermissionsChangeNotification(
uint32_t connection_key,
const policy::Permissions& permissions,
- ApplicationManager& app_mngr);
+ ApplicationManager& app_mngr,
+ const policy::EncryptionRequired encryprion_required);
/*
- * @brief Send notification to HMI on application permissions update
- * @param connection_key Id of application to send message to
- * @param permissions updated permissions for application
- */
+ * @brief Send notification to HMI on application permissions update
+ * @param connection_key Id of application to send message to
+ * @param permissions updated permissions for application
+ */
static void SendOnAppPermissionsChangedNotification(
uint32_t connection_key,
const policy::AppPermissions& permissions,
@@ -533,7 +614,7 @@ class MessageHelper {
/**
* @brief Sends UnsubscribeWayPoints request
- * @return true if UnSubscribedWayPoints is send otherwise false
+ * @return true if UnsubscribedWayPoints is send otherwise false
*/
static bool SendUnsubscribedWayPoints(ApplicationManager& app_mngr);
@@ -575,16 +656,15 @@ class MessageHelper {
ApplicationManager& app_mngr);
/**
- * @brief Verify image and add image file full path
- * and add path, although the image doesn't exist
- * @param SmartObject with image
- * @param app current application
- * @return verification result
- */
- static mobile_apis::Result::eType VerifyImageApplyPath(
- smart_objects::SmartObject& image,
- ApplicationConstSharedPtr app,
- ApplicationManager& app_mngr);
+ * @brief Verify image and add image file full path
+ * and add path, although the image doesn't exist
+ * @param SmartObject with image
+ * @param app current application
+ * @return verification result
+ */
+ static void ApplyImagePath(smart_objects::SmartObject& image,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr);
/*
* @brief Verify image and add image file full path
@@ -601,6 +681,21 @@ class MessageHelper {
ApplicationConstSharedPtr app,
ApplicationManager& app_mngr);
+ /**
+ * @brief Stores whether each choice in a set has the vrCommands parameter
+ * MIXED means some choices have vrCommands and others don't
+ * ALL means all do, NONE means none do
+ */
+ enum ChoiceSetVRCommandsStatus { MIXED, ALL, NONE };
+
+ /**
+ * @brief Check whether each choice in the set has the vrCommands parameter
+ * @param choice set to check
+ * @return a ChoiceSetVRCommandsStatus with the state of the choice set
+ */
+ static ChoiceSetVRCommandsStatus CheckChoiceSetVRCommands(
+ const smart_objects::SmartObject& choice_set);
+
/*
* @brief Finds "Image" structure in request and verify image file presence
* in Core.
@@ -629,7 +724,7 @@ class MessageHelper {
* @return returns FALSE if string contains incorrect character or
* string is empty otherwise returns TRUE
*/
- static bool VerifySoftButtonString(const std::string& str);
+ static bool VerifyString(const std::string& str);
static mobile_apis::Result::eType ProcessSoftButtons(
smart_objects::SmartObject& message_params,
@@ -645,14 +740,48 @@ class MessageHelper {
* @param app current application
*
* @param function_id Unique command id from mobile API
+ *
+ * @param window_id window id containing soft buttons
+ */
+ static void SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id,
+ const WindowID window_id);
+
+ /*
+ * @brief subscribe application to softbutton
+ *
+ * @param message_params contains data of request
+ *
+ * @param app current application
+ *
+ * @param function_id Unique command id from mobile API
*/
static void SubscribeApplicationToSoftButton(
smart_objects::SmartObject& message_params,
ApplicationSharedPtr app,
int32_t function_id);
+ /**
+ * @brief Prints SmartObject contents to log file
+ * @param object - SmartObject to print
+ * @return always True as this function is used for internal debug purposes
+ * only
+ * @note Function prints SmartObject only in DEBUG build mode. There will not
+ * be any print in RELEASE build mode
+ */
static bool PrintSmartObject(const smart_objects::SmartObject& object);
+ /**
+ * @brief Extract window unique ID from message, this id is used for identify
+ * the window
+ * @param s_map contains application's window id
+ * @return window id from current message
+ */
+ static WindowID ExtractWindowIdFromSmartObject(
+ const smart_objects::SmartObject& s_map);
+
template <typename From, typename To>
static To ConvertEnumAPINoCheck(const From& input) {
return static_cast<To>(input);
@@ -668,6 +797,14 @@ class MessageHelper {
hmi_apis::Common_Language::eType language);
/**
+ * @brief Converts mobile language to string representation
+ * @param language Mobile UI language
+ * @return Mobile language string representation
+ */
+ static std::string MobileLanguageToString(
+ mobile_apis::Language::eType language);
+
+ /**
* @brief Converts string to mobile language enum value
* @param language language as string
* @return Mobile language enum value
@@ -729,6 +866,14 @@ class MessageHelper {
static hmi_apis::Common_Language::eType CommonLanguageFromString(
const std::string& language);
+ /**
+ * @brief CommonLightNameFromString convert string to LightName enum value
+ * @param lightName string to convert
+ * @return value LightName enum value
+ */
+ static hmi_apis::Common_LightName::eType CommonLightNameFromString(
+ const std::string& lightName);
+
static smart_objects::SmartObjectSPtr
GetOnAppInterfaceUnregisteredNotificationToMobile(
int32_t connection_key,
@@ -790,10 +935,13 @@ class MessageHelper {
/**
* @brief Sends HMI status notification to mobile
- * @param application_impl application with changed HMI status
+ * @param application application with changed HMI status
+ * @param window_id id of affected window
+ * @param application_manager reference to application manager
**/
static void SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager);
/**
@@ -821,6 +969,22 @@ class MessageHelper {
static smart_objects::SmartObjectSPtr CreateMessageForHMI(
hmi_apis::messageType::eType message_type, const uint32_t correlation_id);
+ static smart_objects::SmartObject CreateAppServiceCapabilities(
+ std::vector<smart_objects::SmartObject>& all_services);
+
+ static void BroadcastCapabilityUpdate(smart_objects::SmartObject& msg_params,
+ ApplicationManager& app_mngr);
+
+ /**
+ * @brief CreateDisplayCapabilityUpdateToMobile creates notification with
+ * updated display capabilities acccoring to message type
+ * @param system_capabilities SO containing notification data
+ * @param app reference to application
+ * @return shared ptr to notification SO
+ */
+ static smart_objects::SmartObjectSPtr CreateDisplayCapabilityUpdateToMobile(
+ const smart_objects::SmartObject& system_capabilities, Application& app);
+
private:
/**
* @brief Allows to fill SO according to the current permissions.
diff --git a/src/components/application_manager/include/application_manager/mobile_message_handler.h b/src/components/application_manager/include/application_manager/mobile_message_handler.h
index ad660d0b66..3b02424e1f 100644
--- a/src/components/application_manager/include/application_manager/mobile_message_handler.h
+++ b/src/components/application_manager/include/application_manager/mobile_message_handler.h
@@ -33,12 +33,12 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_MOBILE_MESSAGE_HANDLER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_MOBILE_MESSAGE_HANDLER_H_
-#include "utils/macro.h"
-#include "protocol/common.h"
#include "application_manager/message.h"
+#include "protocol/common.h"
+#include "utils/macro.h"
namespace application_manager {
-typedef utils::SharedPtr<application_manager::Message> MobileMessage;
+typedef std::shared_ptr<application_manager::Message> MobileMessage;
class MobileMessageHandler {
public:
static application_manager::Message* HandleIncomingMessageProtocol(
diff --git a/src/components/application_manager/include/application_manager/plugin_manager/plugin_keys.h b/src/components/application_manager/include/application_manager/plugin_manager/plugin_keys.h
new file mode 100644
index 0000000000..96a7f27064
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/plugin_manager/plugin_keys.h
@@ -0,0 +1,48 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_PLUGIN_KEYS_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_PLUGIN_KEYS_H
+
+namespace application_manager {
+namespace plugin_manager {
+
+namespace plugin_names {
+extern const char* vehicle_info_rpc_plugin;
+extern const char* app_service_rpc_plugin;
+extern const char* rc_rpc_plugin;
+extern const char* sdl_rpc_plugin;
+} // namespace plugin_names
+
+} // namespace plugin_manager
+} // namespace application_manager
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_PLUGIN_KEYS_H
diff --git a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h
index c9a34a75d6..88f91d14fc 100644
--- a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h
+++ b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h
@@ -33,12 +33,15 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_RPC_PLUGIN_H
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_RPC_PLUGIN_H
#include <memory>
-#include "utils/macro.h"
-#include "application_manager/commands/command.h"
#include "application_manager/application.h"
-#include "application_manager/rpc_service.h"
+#include "application_manager/commands/command.h"
#include "application_manager/hmi_capabilities.h"
-#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/rpc_service.h"
+#include "utils/macro.h"
+
+namespace policy {
+class PolicyHandlerInterface;
+}
namespace application_manager {
class CommandFactory;
@@ -57,23 +60,39 @@ enum ApplicationEvent {
kApplicationExit = 0,
kApplicationRegistered,
kApplicationUnregistered,
- kDeleteApplicationData
+ kDeleteApplicationData,
+ kGlobalPropertiesUpdated,
+ kRCStatusChanged
};
class RPCPlugin {
public:
/**
- * @brief Command initialization function
- * @param app_manager ApplicationManager
- * @param rpc_service RPCService
- * @param hmi_capabilities HMICapabilities
- * @param policy_handler PolicyHandlerInterface
- * @return true in case initialization was succesful, false otherwise.
- **/
+ * @brief Class destructor
+ */
+ virtual ~RPCPlugin() {}
+
+ /**
+ * @brief Command initialization function
+ * @param app_manager ApplicationManager
+ * @param rpc_service RPCService
+ * @param hmi_capabilities HMICapabilities
+ * @param policy_handler PolicyHandlerInterface
+ * @return true in case initialization was succesful, false otherwise.
+ **/
virtual bool Init(ApplicationManager& app_manager,
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler) = 0;
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) = 0;
+
+ DEPRECATED
+ virtual bool Init(ApplicationManager& app_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state) = 0;
+
/**
* @brief IsAbleToProcess check if plugin is able to process function
* @param function_id RPC identifier
@@ -112,7 +131,6 @@ class RPCPlugin {
ApplicationEvent event,
application_manager::ApplicationSharedPtr application) = 0;
};
-typedef std::unique_ptr<RPCPlugin> RPCPluginPtr;
} // namespace plugin_manager
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager.h b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager.h
index 692d296607..eb14f26ae6 100644
--- a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager.h
+++ b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager.h
@@ -33,10 +33,10 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_RPC_PLUGIN_MANAGER_H
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_RPC_PLUGIN_MANAGER_H
#include <cstdint>
-#include <string>
+#include <functional>
#include <memory>
+#include <string>
#include <vector>
-#include <functional>
#include "application_manager/plugin_manager/rpc_plugin.h"
#include "utils/optional.h"
@@ -44,6 +44,10 @@ namespace application_manager {
namespace plugin_manager {
class RPCPluginManager {
+ protected:
+ typedef std::unique_ptr<RPCPlugin, std::function<void(RPCPlugin*)> >
+ RPCPluginPtr;
+
public:
virtual ~RPCPluginManager() {}
/**
@@ -56,12 +60,6 @@ class RPCPluginManager {
virtual uint32_t LoadPlugins(const std::string& plugins_path) = 0;
/**
- * @brief GetPlugins get list of plugins
- * @return list of loaded plugins
- */
- virtual std::vector<RPCPluginPtr>& GetPlugins() = 0;
-
- /**
* @brief FindPluginToProcess find plugin to process message
* @param function_id RPC identifier to process
* @param message_source message_source source of message to process
diff --git a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h
index 5f85d45b6e..004d6418f5 100644
--- a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h
@@ -32,11 +32,12 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_RPC_PLUGIN_MANAGER_IMPL_H
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_RPC_PLUGIN_MANAGER_IMPL_H
-#include "application_manager/plugin_manager/rpc_plugin_manager.h"
#include "application_manager/application_manager.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/hmi_capabilities.h"
+#include "application_manager/plugin_manager/rpc_plugin_manager.h"
#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/rpc_service.h"
+#include "resumption/last_state_wrapper.h"
#include "utils/optional.h"
namespace application_manager {
@@ -55,20 +56,31 @@ class RPCPluginManagerImpl : public RPCPluginManager {
RPCPluginManagerImpl(ApplicationManager& app_manager,
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state);
+
+ DEPRECATED
+ RPCPluginManagerImpl(ApplicationManager& app_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state);
uint32_t LoadPlugins(const std::string& plugins_path) OVERRIDE;
- std::vector<RPCPluginPtr>& GetPlugins() OVERRIDE;
+
utils::Optional<RPCPlugin> FindPluginToProcess(
const int32_t function_id,
const commands::Command::CommandSource message_source) OVERRIDE;
private:
+ RPCPluginPtr LoadPlugin(const std::string& full_plugin_path) const;
+
std::vector<RPCPluginPtr> loaded_plugins_;
ApplicationManager& app_manager_;
rpc_service::RPCService& rpc_service_;
HMICapabilities& hmi_capabilities_;
policy::PolicyHandlerInterface& policy_handler_;
+ resumption::LastStateWrapperPtr last_state_;
// RPCPluginManager interface
public:
diff --git a/src/components/application_manager/include/application_manager/policies/custom_vehicle_data_provider.h b/src/components/application_manager/include/application_manager/policies/custom_vehicle_data_provider.h
new file mode 100644
index 0000000000..307f0b93df
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/policies/custom_vehicle_data_provider.h
@@ -0,0 +1,32 @@
+#ifndef CUSTOM_VEHICLE_DATA_PROVIDER_H
+#define CUSTOM_VEHICLE_DATA_PROVIDER_H
+
+#include <vector>
+
+namespace rpc {
+namespace policy_table_interface_base {
+struct VehicleDataItem;
+}
+} // namespace rpc
+
+namespace policy {
+
+class VehicleDataItemProvider {
+ public:
+ /**
+ * @brief Gets vehicle data items
+ * @return Structure with vehicle data items
+ */
+ virtual const std::vector<rpc::policy_table_interface_base::VehicleDataItem>
+ GetVehicleDataItems() const = 0;
+
+ /**
+ * @brief Gets vehicle data items removed by policies
+ * @return Structure with vehicle data items
+ */
+ virtual std::vector<rpc::policy_table_interface_base::VehicleDataItem>
+ GetRemovedVehicleDataItems() const = 0;
+};
+} // namespace policy
+
+#endif // CUSTOM_VEHICLE_DATA_PROVIDER_H
diff --git a/src/components/application_manager/include/application_manager/policies/external/delegates/app_permission_delegate.h b/src/components/application_manager/include/application_manager/policies/external/delegates/app_permission_delegate.h
index f501598e0f..114b4e2d77 100644
--- a/src/components/application_manager/include/application_manager/policies/external/delegates/app_permission_delegate.h
+++ b/src/components/application_manager/include/application_manager/policies/external/delegates/app_permission_delegate.h
@@ -33,19 +33,19 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_DELEGATES_APP_PERMISSION_DELEGATE_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_DELEGATES_APP_PERMISSION_DELEGATE_H_
+#include "utils/conditional_variable.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
-#include "utils/conditional_variable.h"
-#include "policy/policy_types.h"
#include "application_manager/policies/policy_handler_interface.h"
+#include "policy/policy_types.h"
namespace policy {
class PolicyHandler;
/**
-*@brief The AppPermissionDelegate class allows to call OnAppPermissionConsent
-*in async way.
-*/
+ *@brief The AppPermissionDelegate class allows to call OnAppPermissionConsent
+ *in async way.
+ */
class AppPermissionDelegate : public threads::ThreadDelegate {
public:
/**
diff --git a/src/components/application_manager/include/application_manager/policies/external/delegates/statistics_delegate.h b/src/components/application_manager/include/application_manager/policies/external/delegates/statistics_delegate.h
index 2fe4265f54..38a60b29c4 100644
--- a/src/components/application_manager/include/application_manager/policies/external/delegates/statistics_delegate.h
+++ b/src/components/application_manager/include/application_manager/policies/external/delegates/statistics_delegate.h
@@ -35,10 +35,10 @@
#include <string>
+#include "application_manager/usage_statistics.h"
+#include "utils/conditional_variable.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
-#include "utils/conditional_variable.h"
-#include "application_manager/usage_statistics.h"
namespace policy {
diff --git a/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h b/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h
index 8c904bf513..7d71611a3c 100644
--- a/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h
+++ b/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_EVENT_OBSERVER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_EVENT_OBSERVER_H_
-#include "smart_objects/smart_object.h"
#include "application_manager/event_engine/event_observer.h"
+#include "smart_objects/smart_object.h"
#include "utils/lock.h"
namespace policy {
@@ -48,6 +48,7 @@ class PolicyEventObserver
application_manager::event_engine::EventDispatcher& event_dispatcher);
void set_policy_handler(policy::PolicyHandlerInterface* const policy_handler);
void on_event(const application_manager::event_engine::Event& event);
+ void on_event(const application_manager::event_engine::MobileEvent& event);
void subscribe_on_event(
const application_manager::event_engine::Event::EventID& event_id,
int32_t hmi_correlation_id = 0);
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h
index 8d019784fc..2c7b878023 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h
@@ -33,28 +33,30 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_HANDLER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_HANDLER_H_
-#include <string>
+#include <stdint.h>
+#include <list>
#include <map>
#include <set>
+#include <string>
#include <vector>
-#include <list>
-#include <stdint.h>
-#include "policy/policy_manager.h"
#include "application_manager/application.h"
-#include "application_manager/policies/policy_handler_interface.h"
-#include "application_manager/policies/policy_event_observer.h"
#include "application_manager/policies/delegates/statistics_delegate.h"
+#include "application_manager/policies/policy_event_observer.h"
+#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/policies/policy_handler_observer.h"
-#include "utils/logger.h"
-#include "utils/threads/thread.h"
-#include "utils/threads/thread_delegate.h"
+
+#include "application_manager/policies/custom_vehicle_data_provider.h"
+#include "policy/policy_manager.h"
+#include "policy/policy_settings.h"
+#include "policy/usage_statistics/statistics_manager.h"
#include "utils/conditional_variable.h"
-#include "utils/rwlock.h"
#include "utils/custom_string.h"
-#include "policy/usage_statistics/statistics_manager.h"
+#include "utils/logger.h"
+#include "utils/rwlock.h"
#include "utils/threads/async_runner.h"
-#include "policy/policy_settings.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/thread_delegate.h"
namespace Json {
class Value;
@@ -77,34 +79,45 @@ class PolicyHandler : public PolicyHandlerInterface,
PolicyHandler(const policy::PolicySettings& get_settings,
application_manager::ApplicationManager& application_manager);
virtual ~PolicyHandler();
+ PolicyEncryptionFlagGetterInterfaceSPtr PolicyEncryptionFlagGetter()
+ const OVERRIDE;
bool LoadPolicyLibrary() OVERRIDE;
bool PolicyEnabled() const OVERRIDE;
bool InitPolicyTable() OVERRIDE;
bool ResetPolicyTable() OVERRIDE;
bool ClearUserConsent() OVERRIDE;
- bool SendMessageToSDK(const BinaryMessage& pt_string,
- const std::string& url) OVERRIDE;
+ DEPRECATED bool SendMessageToSDK(const BinaryMessage& pt_string,
+ const std::string& url) OVERRIDE;
bool ReceiveMessageFromSDK(const std::string& file,
const BinaryMessage& pt_string) OVERRIDE;
bool UnloadPolicyLibrary() OVERRIDE;
- virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+
+ virtual void OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions,
const HMILevel& default_hmi) OVERRIDE;
- virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ virtual void OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions) OVERRIDE;
#ifdef EXTERNAL_PROPRIETARY_MODE
void OnSnapshotCreated(const BinaryMessage& pt_string,
const std::vector<int>& retry_delay_seconds,
uint32_t timeout_exchange) OVERRIDE;
+
+ PTURetryHandler& ptu_retry_handler() const OVERRIDE;
#else // EXTERNAL_PROPRIETARY_MODE
- void OnSnapshotCreated(const BinaryMessage& pt_string) OVERRIDE;
+ void OnSnapshotCreated(const BinaryMessage& pt_string,
+ const PTUIterationType iteration_type) OVERRIDE;
+ std::string GetNextUpdateUrl(const PTUIterationType iteration_type,
+ uint32_t& app_id) OVERRIDE;
#endif // EXTERNAL_PROPRIETARY_MODE
virtual bool GetPriority(const std::string& policy_app_id,
std::string* priority) const OVERRIDE;
virtual void CheckPermissions(
const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const PTString& rpc,
const RPCParams& rpc_params,
CheckPermissionResult& result) OVERRIDE;
@@ -113,12 +126,16 @@ class PolicyHandler : public PolicyHandlerInterface,
virtual DeviceConsent GetUserConsentForDevice(
const std::string& device_id) const OVERRIDE;
+ Json::Value GetPolicyTableData() const OVERRIDE;
+
/**
* @brief Sets HMI default type for specified application
+ * @param device_handle device identifier
* @param application_id ID application
* @param app_types list of HMI types
*/
- void SetDefaultHmiTypes(const std::string& application_id,
+ void SetDefaultHmiTypes(const transport_manager::DeviceHandle& device_handle,
+ const std::string& application_id,
const smart_objects::SmartObject* app_types) OVERRIDE;
/**
@@ -168,6 +185,8 @@ class PolicyHandler : public PolicyHandlerInterface,
const std::string& policy_app_id,
const std::string& hmi_level) OVERRIDE;
+ void OnPTUTimeOut() OVERRIDE;
+
/**
* Gets all allowed module types
* @param app_id unique identifier of application
@@ -177,16 +196,20 @@ class PolicyHandler : public PolicyHandlerInterface,
bool GetModuleTypes(const std::string& policy_app_id,
std::vector<std::string>* modules) const OVERRIDE;
- bool GetDefaultHmi(const std::string& policy_app_id,
+ bool GetDefaultHmi(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi) const OVERRIDE;
bool GetInitialAppData(const std::string& application_id,
StringArray* nicknames = NULL,
StringArray* app_hmi_types = NULL) OVERRIDE;
void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) OVERRIDE;
- virtual std::string GetLockScreenIconUrl() const OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
+ virtual std::string GetLockScreenIconUrl(
+ const std::string& policy_app_id = kDefaultId) const OVERRIDE;
+ virtual std::string GetIconUrl(
+ const std::string& policy_app_id) const OVERRIDE;
uint32_t NextRetryTimeout() OVERRIDE;
/**
@@ -201,12 +224,14 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
uint32_t TimeoutExchangeMSec() const OVERRIDE;
void OnExceededTimeout() OVERRIDE;
- void OnSystemReady() OVERRIDE;
+ const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
+ const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const OVERRIDE;
void PTUpdatedAt(Counters counter, int value) OVERRIDE;
void add_listener(PolicyHandlerObserver* listener) OVERRIDE;
void remove_listener(PolicyHandlerObserver* listener) OVERRIDE;
- utils::SharedPtr<usage_statistics::StatisticsManager> GetStatisticManager()
+ std::shared_ptr<usage_statistics::StatisticsManager> GetStatisticManager()
const OVERRIDE;
/**
@@ -245,7 +270,8 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
void OnIgnitionCycleOver() OVERRIDE;
- void OnPendingPermissionChange(const std::string& policy_app_id) OVERRIDE;
+ void OnPendingPermissionChange(const std::string& device_id,
+ const std::string& policy_app_id) OVERRIDE;
/**
* Initializes PT exchange at user request
@@ -296,6 +322,10 @@ class PolicyHandler : public PolicyHandlerInterface,
const PermissionConsent& permissions) OVERRIDE;
#endif
+ void OnSystemRequestReceived() const OVERRIDE;
+
+ void TriggerPTUOnStartupIfRequired() OVERRIDE;
+
/**
* @brief Get appropriate message parameters and send them with response
* to HMI
@@ -332,9 +362,11 @@ class PolicyHandler : public PolicyHandlerInterface,
/**
* @brief Update currently used device id in policies manager for given
* application
+ * @param device_handle device identifier
* @param policy_app_id Application id
*/
std::string OnCurrentDeviceIdUpdateRequired(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) OVERRIDE;
/**
@@ -354,11 +386,6 @@ class PolicyHandler : public PolicyHandlerInterface,
const std::string& language) OVERRIDE;
/**
- * @brief Send request to HMI to get update on system parameters
- */
- virtual void OnSystemInfoUpdateRequired() OVERRIDE;
-
- /**
* @brief Sends GetVehicleData request in case when Vechicle info is ready.
*/
virtual void OnVIIsReady() OVERRIDE;
@@ -388,24 +415,126 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
void OnSystemError(int code) OVERRIDE;
+#ifndef EXTERNAL_PROPRIETARY_MODE
+ uint32_t ChoosePTUApplication(
+ const PTUIterationType iteration_type =
+ PTUIterationType::DefaultIteration) OVERRIDE;
+ void CacheRetryInfo(const uint32_t app_id, const std::string url) OVERRIDE;
+#endif // EXTERNAL_PROPRIETARY_MODE
+
+ uint32_t GetAppIdForSending() const OVERRIDE;
+
/**
- * @brief Chooses random application id to be used for snapshot sending
- * considering HMI level
- * @return Application id or 0, if there are no suitable applications
+ * @brief Add application to PTU queue if no application with
+ * the same app id exists
+ * @param new_app_id app id new application
*/
- uint32_t GetAppIdForSending() const OVERRIDE;
+ void PushAppIdToPTUQueue(const uint32_t new_app_id);
+
+ /**
+ * @brief Remove the first application from applications queue
+ */
+ void PopAppIdFromPTUQueue();
custom_str::CustomString GetAppName(
const std::string& policy_app_id) OVERRIDE;
+ std::vector<std::string> GetApplicationPolicyIDs() const OVERRIDE;
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const OVERRIDE;
+
+ /**
+ * @brief Get a list of enabled local applications
+ * @return enabled_apps List filled with the policy app id of each enabled
+ * local application
+ */
+ std::vector<std::string> GetEnabledLocalApps() const OVERRIDE;
+
+ /**
+ * @brief Checks if a given application is an enabled cloud application
+ * @param policy_app_id Unique application id
+ * @return true, if the application is an enabled cloud application,
+ * otherwise - false
+ */
+ const bool CheckCloudAppEnabled(
+ const std::string& policy_app_id) const OVERRIDE;
+
+ bool GetAppProperties(
+ const std::string& policy_app_id,
+ policy::AppProperties& out_app_properties) const OVERRIDE;
+
+ void OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) OVERRIDE;
+
+ void OnSetAppProperties(
+ const smart_objects::SmartObject& properties) OVERRIDE;
+
+ AppPropertiesState GetAppPropertiesStatus(
+ const smart_objects::SmartObject& properties,
+ const std::string& app_id) const OVERRIDE;
+
+ bool IsNewApplication(const std::string& policy_app_id) const OVERRIDE;
+
+ void OnLocalAppAdded() OVERRIDE;
+
+ /**
+ * @brief Callback for when a SetCloudAppProperties message is received
+ * from a mobile app
+ * @param message The SetCloudAppProperties message
+ */
+ void OnSetCloudAppProperties(
+ const smart_objects::SmartObject& message) OVERRIDE;
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ void GetAppServiceParameters(const std::string& policy_app_id,
+ policy_table::AppServiceParameters*
+ app_service_parameters) const OVERRIDE;
+ /**
+ * @brief Check app service parameters from an app against policies
+ * @param policy_app_id Unique application id
+ * @param requested_service_name Service name published by app service
+ * provider
+ * @param requested_service_type Service type published by app service
+ * provider
+ * @param requested_handled_rpcs Vector of requested function ids an app
+ * service wants to handle from consumers
+ */
+ bool CheckAppServiceParameters(
+ const std::string& policy_app_id,
+ const std::string& requested_service_name,
+ const std::string& requested_service_type,
+ smart_objects::SmartArray* requested_handled_rpcs) const OVERRIDE;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const OVERRIDE;
+
virtual void OnUpdateHMIAppType(
std::map<std::string, StringArray> app_hmi_types) OVERRIDE;
virtual void OnCertificateUpdated(
const std::string& certificate_data) OVERRIDE;
+
#ifdef EXTERNAL_PROPRIETARY_MODE
void OnCertificateDecrypted(bool is_succeeded) OVERRIDE;
+ void ProcessCertDecryptFailed();
#endif // EXTERNAL_PROPRIETARY_MODE
+
virtual bool CanUpdate() OVERRIDE;
virtual void OnDeviceConsentChanged(const std::string& device_id,
@@ -413,6 +542,10 @@ class PolicyHandler : public PolicyHandlerInterface,
virtual void SendOnAppPermissionsChanged(
const AppPermissions& permissions,
+ const std::string& device_id,
+ const std::string& policy_app_id) const OVERRIDE;
+
+ void SendOnAppPropertiesChangeNotification(
const std::string& policy_app_id) const OVERRIDE;
virtual void OnPTExchangeNeeded() OVERRIDE;
@@ -422,11 +555,13 @@ class PolicyHandler : public PolicyHandlerInterface,
/**
* @brief Allows to add new or update existed application during
* registration process
+ * @param device_id device identifier
* @param application_id The policy aplication id.
* @param hmi_types list of hmi types
* @return function that will notify update manager about new application
*/
StatusNotifier AddApplication(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) OVERRIDE;
@@ -465,22 +600,34 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
void OnAppsSearchCompleted(const bool trigger_ptu) OVERRIDE;
+ void OnAddedNewApplicationToAppList(const uint32_t new_app_id,
+ const std::string& policy_id) OVERRIDE;
+
+ /**
+ * @brief Queue applications for which PTU has not yet been completed
+ */
+ std::set<uint32_t> applications_ptu_queue_;
+
/**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
* succesfully registered on mobile device.
* It will send OnAppPermissionSend notification and will try to start PTU.
*
+ * @param device_id device identifier
* @param application_id registered application.
*/
- void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE;
+ void OnAppRegisteredOnMobile(const std::string& device_id,
+ const std::string& application_id) OVERRIDE;
/**
* @brief Checks if certain request type is allowed for application
+ * @param device_handle device identifier
* @param policy_app_id Unique applicaion id
* @param type Request type
* @return true, if allowed, otherwise - false
*/
bool IsRequestTypeAllowed(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id,
mobile_apis::RequestType::eType type) const OVERRIDE;
@@ -512,10 +659,12 @@ class PolicyHandler : public PolicyHandlerInterface,
/**
* @brief Gets application request types
+ * @param device_id device identifier
* @param policy_app_id Unique application id
* @return request types
*/
const std::vector<std::string> GetAppRequestTypes(
+ const transport_manager::DeviceHandle& device_id,
const std::string& policy_app_id) const OVERRIDE;
/**
@@ -526,12 +675,6 @@ class PolicyHandler : public PolicyHandlerInterface,
const std::vector<std::string> GetAppRequestSubTypes(
const std::string& policy_app_id) const OVERRIDE;
- /**
- * @brief Gets vehicle information
- * @return Structure with vehicle information
- */
- const VehicleInfo GetVehicleInfo() const OVERRIDE;
-
#ifdef EXTERNAL_PROPRIETARY_MODE
/**
* @brief Gets meta information
@@ -552,7 +695,7 @@ class PolicyHandler : public PolicyHandlerInterface,
int32_t timespan_seconds) OVERRIDE;
#ifdef BUILD_TESTS
- void SetPolicyManager(utils::SharedPtr<PolicyManager> pm) {
+ void SetPolicyManager(std::shared_ptr<PolicyManager> pm) {
policy_manager_ = pm;
}
#endif // BUILD_TESTS
@@ -565,6 +708,10 @@ class PolicyHandler : public PolicyHandlerInterface,
virtual void OnPTUFinished(const bool ptu_result) OVERRIDE;
+ virtual void OnPTInited() OVERRIDE;
+
+ void StopRetrySequence() OVERRIDE;
+
/**
* @brief OnDeviceSwitching Notifies policy manager on device switch event so
* policy permissions should be processed accordingly
@@ -574,6 +721,19 @@ class PolicyHandler : public PolicyHandlerInterface,
void OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) FINAL;
+ // VehicleDataItemProvider interface :
+ /**
+ * @brief Gets vehicle data items
+ * @return Structure with vehicle data items
+ */
+ const std::vector<rpc::policy_table_interface_base::VehicleDataItem>
+ GetVehicleDataItems() const OVERRIDE;
+
+ std::vector<rpc::policy_table_interface_base::VehicleDataItem>
+ GetRemovedVehicleDataItems() const OVERRIDE;
+
+ void OnLockScreenDismissalStateChanged() FINAL;
+
protected:
/**
* Starts next retry exchange policy table
@@ -633,7 +793,7 @@ class PolicyHandler : public PolicyHandlerInterface,
void UpdateHMILevel(application_manager::ApplicationSharedPtr app,
mobile_apis::HMILevel::eType level);
std::vector<std::string> GetDevicesIds(
- const std::string& policy_app_id) OVERRIDE;
+ const std::string& policy_app_id) const OVERRIDE;
/**
* @brief Sets days after epoch on successful policy update
@@ -723,20 +883,28 @@ class PolicyHandler : public PolicyHandlerInterface,
private:
static const std::string kLibrary;
+ bool SendMessageToSDK(const BinaryMessage& pt_string,
+ const std::string& url,
+ const uint32_t app_id);
+
/**
- * @brief Collects currently registered applications ids linked to their
- * device id
- * @param out_links Collection of device_id-to-app_id links
- */
+ * @brief Collects currently registered applications ids linked to their
+ * device id
+ * @param out_links Collection of device_id-to-app_id links
+ */
void GetRegisteredLinks(std::map<std::string, std::string>& out_links) const;
- private:
mutable sync_primitives::RWLock policy_manager_lock_;
- utils::SharedPtr<PolicyManager> policy_manager_;
- void* dl_handle_;
- utils::SharedPtr<PolicyEventObserver> event_observer_;
+ std::shared_ptr<PolicyManager> policy_manager_;
+ std::shared_ptr<PolicyEventObserver> event_observer_;
uint32_t last_activated_app_id_;
+#ifndef EXTERNAL_PROPRIETARY_MODE
+ // PTU retry information
+ uint32_t last_ptu_app_id_;
+ std::string retry_update_url_;
+#endif // EXTERNAL_PROPRIETARY_MODE
+
/**
* @brief Contains device handles, which were sent for user consent to HMI
*/
@@ -747,6 +915,7 @@ class PolicyHandler : public PolicyHandlerInterface,
typedef std::list<PolicyHandlerObserver*> HandlersCollection;
HandlersCollection listeners_;
mutable sync_primitives::Lock listeners_lock_;
+ mutable sync_primitives::Lock app_id_queue_lock_;
/**
* @brief Application-to-device links are used for collecting their current
@@ -756,23 +925,26 @@ class PolicyHandler : public PolicyHandlerInterface,
std::map<std::string, std::string> app_to_device_link_;
// Lock for app to device list
- sync_primitives::Lock app_to_device_link_lock_;
+ sync_primitives::RecursiveLock app_to_device_link_lock_;
- utils::SharedPtr<StatisticManagerImpl> statistic_manager_impl_;
+ std::shared_ptr<StatisticManagerImpl> statistic_manager_impl_;
const PolicySettings& settings_;
application_manager::ApplicationManager& application_manager_;
+ std::string last_registered_policy_app_id_;
+
friend class AppPermissionDelegate;
/**
- * @brief Checks if the application with the given policy
- * application id is registered or it is default id
- * @param app_idx Application idx from EndpointUrls vector
- * @param urls EndpointUrls vector
+ * @brief Checks if an application is able to perform a PTU using the
+ * specified URL list
+ * @param app_id ID of application used for PTU
+ * @param app_data EndpointData struct with list of URLs
* @return TRUE if the vector with URLs with given idx is not empty
- * and is related to a registered application or these are default URLs,
+ * and is related to the provided application or if these are default URLs,
* otherwise FALSE
*/
- bool IsUrlAppIdValid(const uint32_t app_idx, const EndpointUrls& urls) const;
+ bool IsUrlAppIdValid(const std::string app_id,
+ const EndpointData& app_data) const;
DISALLOW_COPY_AND_ASSIGN(PolicyHandler);
};
diff --git a/src/components/application_manager/include/application_manager/policies/regular/delegates/app_permission_delegate.h b/src/components/application_manager/include/application_manager/policies/regular/delegates/app_permission_delegate.h
index 6913f5038e..7e83aefe81 100644
--- a/src/components/application_manager/include/application_manager/policies/regular/delegates/app_permission_delegate.h
+++ b/src/components/application_manager/include/application_manager/policies/regular/delegates/app_permission_delegate.h
@@ -33,18 +33,18 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_APP_PERMISSION_DELEGATE_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DELEGATES_APP_PERMISSION_DELEGATE_H_
+#include "utils/conditional_variable.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
-#include "utils/conditional_variable.h"
-#include "policy/policy_types.h"
#include "application_manager/policies/policy_handler_interface.h"
+#include "policy/policy_types.h"
namespace policy {
/**
-*@brief The AppPermissionDelegate class allows to call OnAppPermissionConsent
-*in async way.
-*/
+ *@brief The AppPermissionDelegate class allows to call OnAppPermissionConsent
+ *in async way.
+ */
class AppPermissionDelegate : public threads::ThreadDelegate {
public:
/**
diff --git a/src/components/application_manager/include/application_manager/policies/regular/delegates/statistics_delegate.h b/src/components/application_manager/include/application_manager/policies/regular/delegates/statistics_delegate.h
index 3dc9ad925c..74d88fac69 100644
--- a/src/components/application_manager/include/application_manager/policies/regular/delegates/statistics_delegate.h
+++ b/src/components/application_manager/include/application_manager/policies/regular/delegates/statistics_delegate.h
@@ -35,10 +35,10 @@
#include <string>
+#include "application_manager/usage_statistics.h"
+#include "utils/conditional_variable.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
-#include "utils/conditional_variable.h"
-#include "application_manager/usage_statistics.h"
namespace policy {
diff --git a/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h b/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h
index f4924111b3..4a104812a4 100644
--- a/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h
+++ b/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h
@@ -48,6 +48,7 @@ class PolicyEventObserver
application_manager::event_engine::EventDispatcher& event_dispatcher);
void set_policy_handler(policy::PolicyHandlerInterface* const policy_handler);
void on_event(const application_manager::event_engine::Event& event);
+ void on_event(const application_manager::event_engine::MobileEvent& event);
void subscribe_on_event(
const application_manager::event_engine::Event::EventID& event_id,
int32_t hmi_correlation_id = 0);
diff --git a/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h b/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h
index 07d234f036..fdfed698c4 100644
--- a/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h
+++ b/src/components/application_manager/include/application_manager/policies/regular/policy_handler_observer.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_OBSERVER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_OBSERVER_H_
-#include <vector>
-#include <string>
#include <map>
+#include <string>
+#include <vector>
namespace policy {
@@ -48,8 +48,13 @@ class PolicyHandlerObserver {
return false;
}
+ virtual void OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) {}
+
virtual void OnPTUFinished(const bool ptu_result) {}
+ virtual void OnPTUTimeoutExceeded() {}
+
virtual ~PolicyHandlerObserver() {}
};
} // namespace policy
diff --git a/src/components/application_manager/include/application_manager/request_controller.h b/src/components/application_manager/include/application_manager/request_controller.h
index c0bae1aac8..8a3c90061e 100644
--- a/src/components/application_manager/include/application_manager/request_controller.h
+++ b/src/components/application_manager/include/application_manager/request_controller.h
@@ -34,21 +34,21 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_
#include <climits>
-#include <vector>
#include <list>
+#include <vector>
#include "utils/lock.h"
-#include "utils/shared_ptr.h"
-#include "utils/threads/thread.h"
+
#include "utils/conditional_variable.h"
+#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
#include "utils/timer.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
-#include "application_manager/request_info.h"
#include "application_manager/request_controller_settings.h"
+#include "application_manager/request_info.h"
#include "application_manager/request_tracker.h"
namespace application_manager {
@@ -56,14 +56,14 @@ namespace application_manager {
namespace request_controller {
/**
-* @brief RequestController class is used to control currently active mobile
-* requests.
-*/
+ * @brief RequestController class is used to control currently active mobile
+ * requests.
+ */
class RequestController {
public:
/**
- * @brief Result code for addRequest
- */
+ * @brief Result code for addRequest
+ */
enum TResult {
SUCCESS = 0,
TOO_MANY_REQUESTS,
@@ -73,8 +73,8 @@ class RequestController {
};
/**
- * @brief Thread pool state
- */
+ * @brief Thread pool state
+ */
enum TPoolState {
UNDEFINED = 0,
STARTED,
@@ -84,121 +84,121 @@ class RequestController {
// Methods
/**
- * @brief Class constructor
- *
- */
+ * @brief Class constructor
+ *
+ */
RequestController(const RequestControlerSettings& settings);
/**
- * @brief Class destructor
- *
- */
+ * @brief Class destructor
+ *
+ */
virtual ~RequestController();
/**
- * @brief Initialize thread pool
- *
- */
+ * @brief Initialize thread pool
+ *
+ */
void InitializeThreadpool();
/**
- * @brief Destroy thread pool
- *
- */
+ * @brief Destroy thread pool
+ *
+ */
void DestroyThreadpool();
/**
- * @brief Check if max request amount wasn't exceed and adds request to queue.
- *
- * @param request Active mobile request
- * @param hmi_level Current application hmi_level
- *
- * @return Result code
- *
- */
+ * @brief Check if max request amount wasn't exceed and adds request to queue.
+ *
+ * @param request Active mobile request
+ * @param hmi_level Current application hmi_level
+ *
+ * @return Result code
+ *
+ */
TResult addMobileRequest(const RequestPtr request,
const mobile_apis::HMILevel::eType& hmi_level);
/**
- * @brief Store HMI request until response or timeout won't remove it
- *
- * @param request Active hmi request
- * @return Result code
- *
- */
+ * @brief Store HMI request until response or timeout won't remove it
+ *
+ * @param request Active hmi request
+ * @return Result code
+ *
+ */
TResult addHMIRequest(const RequestPtr request);
/**
- * @ Add notification to collection
- *
- * @param ptr Reference to shared pointer that point on hmi notification
- */
+ * @ Add notification to collection
+ *
+ * @param ptr Reference to shared pointer that point on hmi notification
+ */
void addNotification(const RequestPtr ptr);
/**
- * @brief Removes request from queue
- *
- * @param correlation_id Active request correlation ID,
- * @param connection_key Active request connection key (0 for HMI requersts)
- * @param function_id Active request function id
- * @param force_terminate if true, request controller will terminate
- * even if not allowed by request
- */
+ * @brief Removes request from queue
+ *
+ * @param correlation_id Active request correlation ID,
+ * @param connection_key Active request connection key (0 for HMI requersts)
+ * @param function_id Active request function id
+ * @param force_terminate if true, request controller will terminate
+ * even if not allowed by request
+ */
void TerminateRequest(const uint32_t correlation_id,
const uint32_t connection_key,
const int32_t function_id,
bool force_terminate = false);
/**
- * @brief Removes request from queue
- *
- * @param mobile_correlation_id Active mobile request correlation ID
- *
- */
+ * @brief Removes request from queue
+ *
+ * @param mobile_correlation_id Active mobile request correlation ID
+ *
+ */
void OnMobileResponse(const uint32_t mobile_correlation_id,
const uint32_t connection_key,
const int32_t function_id);
/**
- * @brief Removes request from queue
- *
- * @param mobile_correlation_id Active mobile request correlation ID
- *
- */
+ * @brief Removes request from queue
+ *
+ * @param mobile_correlation_id Active mobile request correlation ID
+ *
+ */
void OnHMIResponse(const uint32_t correlation_id, const int32_t function_id);
/**
- * @ Add notification to collection
- *
- * @param ptr Reference to shared pointer that point on hmi notification
- */
+ * @ Add notification to collection
+ *
+ * @param ptr Reference to shared pointer that point on hmi notification
+ */
void removeNotification(const commands::Command* notification);
/**
- * @brief Removes all requests from queue for specified application
- *
- * @param app_id Mobile application ID (app_id)
- *
- */
+ * @brief Removes all requests from queue for specified application
+ *
+ * @param app_id Mobile application ID (app_id)
+ *
+ */
void terminateAppRequests(const uint32_t& app_id);
/**
- * @brief Terminates all requests from HMI
- */
+ * @brief Terminates all requests from HMI
+ */
void terminateAllHMIRequests();
/**
- * @brief Terminates all requests from Mobile
- */
+ * @brief Terminates all requests from Mobile
+ */
void terminateAllMobileRequests();
/**
- * @brief Updates request timeout
- *
- * @param app_id Connection key of application
- * @param mobile_correlation_id Correlation ID of the mobile request
- * @param new_timeout_value New timeout to be set in milliseconds
- */
+ * @brief Updates request timeout
+ *
+ * @param app_id Connection key of application
+ * @param mobile_correlation_id Correlation ID of the mobile request
+ * @param new_timeout_value New timeout to be set in milliseconds
+ */
void updateRequestTimeout(const uint32_t& app_id,
const uint32_t& mobile_correlation_id,
const uint32_t& new_timeout);
@@ -217,13 +217,13 @@ class RequestController {
protected:
/**
- * @brief Timer callback which handles all request timeouts
- */
+ * @brief Timer callback which handles all request timeouts
+ */
void TimeoutThread();
/**
- * @brief Signal timer condition variable
- */
+ * @brief Signal timer condition variable
+ */
void NotifyTimer();
void terminateWaitingForExecutionAppRequests(const uint32_t& app_id);
@@ -285,8 +285,8 @@ class RequestController {
RequestTracker request_tracker_;
/**
- * @brief Set of HMI notifications with timeout.
- */
+ * @brief Set of HMI notifications with timeout.
+ */
std::list<RequestPtr> notification_list_;
/**
diff --git a/src/components/application_manager/include/application_manager/request_info.h b/src/components/application_manager/include/application_manager/request_info.h
index 95585279ca..6900a50926 100644
--- a/src/components/application_manager/include/application_manager/request_info.h
+++ b/src/components/application_manager/include/application_manager/request_info.h
@@ -29,9 +29,9 @@
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_INFO_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_INFO_H_
@@ -52,7 +52,7 @@ namespace request_controller {
* @brief Typedef for active mobile request
*
*/
-typedef utils::SharedPtr<commands::Command> RequestPtr;
+typedef std::shared_ptr<commands::Command> RequestPtr;
struct RequestInfo {
enum RequestType { RequestNone, MobileRequest, HMIRequest };
@@ -60,25 +60,28 @@ struct RequestInfo {
RequestInfo()
: timeout_msec_(0)
, app_id_(0)
- , requst_type_(RequestNone)
+ , request_type_(RequestNone)
, correlation_id_(0) {
- start_time_ = date_time::DateTime::getCurrentTime();
+ start_time_ = date_time::getCurrentTime();
updateEndTime();
}
virtual ~RequestInfo() {}
RequestInfo(RequestPtr request,
- const RequestType requst_type,
+ const RequestType request_type,
const uint64_t timeout_msec)
- : request_(request), timeout_msec_(timeout_msec), correlation_id_(0) {
- start_time_ = date_time::DateTime::getCurrentTime();
+ : request_(request)
+ , timeout_msec_(timeout_msec)
+ , app_id_(0)
+ , correlation_id_(0) {
+ start_time_ = date_time::getCurrentTime();
updateEndTime();
- requst_type_ = requst_type;
+ request_type_ = request_type;
}
RequestInfo(RequestPtr request,
- const RequestType requst_type,
- const TimevalStruct& start_time,
+ const RequestType request_type,
+ const date_time::TimeDuration& start_time,
const uint64_t timeout_msec);
void updateEndTime();
@@ -87,11 +90,11 @@ struct RequestInfo {
bool isExpired();
- TimevalStruct start_time() {
+ date_time::TimeDuration start_time() {
return start_time_;
}
- void update_start_time(TimevalStruct start_time) {
+ void update_start_time(date_time::TimeDuration start_time) {
start_time_ = start_time;
}
@@ -103,7 +106,7 @@ struct RequestInfo {
timeout_msec_ = timeout;
}
- TimevalStruct end_time() {
+ date_time::TimeDuration end_time() {
return end_time_;
}
@@ -111,8 +114,8 @@ struct RequestInfo {
return app_id_;
}
- RequestType requst_type() const {
- return requst_type_;
+ RequestType request_type() const {
+ return request_type_;
}
uint32_t requestId() {
@@ -124,31 +127,31 @@ struct RequestInfo {
}
uint64_t hash();
static uint64_t GenerateHash(uint32_t var1, uint32_t var2);
- static uint32_t HmiConnectoinKey;
+ static uint32_t HmiConnectionKey;
protected:
RequestPtr request_;
- TimevalStruct start_time_;
+ date_time::TimeDuration start_time_;
uint64_t timeout_msec_;
- TimevalStruct end_time_;
+ date_time::TimeDuration end_time_;
uint32_t app_id_;
- RequestType requst_type_;
+ RequestType request_type_;
uint32_t correlation_id_;
};
-typedef utils::SharedPtr<RequestInfo> RequestInfoPtr;
+typedef std::shared_ptr<RequestInfo> RequestInfoPtr;
struct MobileRequestInfo : public RequestInfo {
MobileRequestInfo(RequestPtr request, const uint64_t timeout_msec);
MobileRequestInfo(RequestPtr request,
- const TimevalStruct& start_time,
+ const date_time::TimeDuration& start_time,
const uint64_t timeout_msec);
};
struct HMIRequestInfo : public RequestInfo {
HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec);
HMIRequestInfo(RequestPtr request,
- const TimevalStruct& start_time,
+ const date_time::TimeDuration& start_time,
const uint64_t timeout_msec);
};
@@ -261,22 +264,21 @@ class RequestInfoSet {
TimeSortedRequestInfoSet time_sorted_pending_requests_;
HashSortedRequestInfoSet hash_sorted_pending_requests_;
- // the lock caled this_lock_, since the class represent collection by itself.
- sync_primitives::Lock this_lock_;
+ sync_primitives::Lock pending_requests_lock_;
};
/**
-* @brief Structure used in std algorithms to determine amount of request
-* during time scale
-*/
+ * @brief Structure used in std algorithms to determine amount of request
+ * during time scale
+ */
struct TimeScale {
- TimeScale(const TimevalStruct& start,
- const TimevalStruct& end,
+ TimeScale(const date_time::TimeDuration& start,
+ const date_time::TimeDuration& end,
const uint32_t& app_id)
: start_(start), end_(end), app_id_(app_id) {}
bool operator()(RequestInfoPtr setEntry) {
- if (!setEntry.valid()) {
+ if (setEntry.use_count() == 0) {
return false;
}
@@ -292,8 +294,8 @@ struct TimeScale {
}
private:
- TimevalStruct start_;
- TimevalStruct end_;
+ date_time::TimeDuration start_;
+ date_time::TimeDuration end_;
uint32_t app_id_;
};
diff --git a/src/components/application_manager/include/application_manager/request_tracker.h b/src/components/application_manager/include/application_manager/request_tracker.h
index 36ab3eaefb..72d04abf4a 100644
--- a/src/components/application_manager/include/application_manager/request_tracker.h
+++ b/src/components/application_manager/include/application_manager/request_tracker.h
@@ -1,39 +1,39 @@
/*
- * Copyright (c) 2017, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * Copyright (c) 2017, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_TRACKER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_TRACKER_H_
-#include <string>
#include <map>
+#include <string>
#include <vector>
#include "application_manager/request_controller_settings.h"
#include "interfaces/MOBILE_API.h"
@@ -85,7 +85,7 @@ class RequestTracker {
const mobile_apis::HMILevel::eType level);
private:
- typedef std::vector<TimevalStruct> RequestAddedAt;
+ typedef std::vector<date_time::TimeDuration> RequestAddedAt;
typedef std::map<ApplicationID, RequestAddedAt> ApplicationsRequestsTracker;
/**
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
index 0ec58f2419..e572eaec39 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
@@ -34,21 +34,19 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUME_CTRL_H_
#include <stdint.h>
-#include "utils/shared_ptr.h"
+#include <time.h>
#include "application_manager/resumption/resumption_data.h"
namespace application_manager {
class ApplicationManager;
class Application;
-typedef utils::SharedPtr<Application> ApplicationSharedPtr;
-typedef utils::SharedPtr<const Application> ApplicationConstSharedPtr;
-}
+typedef std::shared_ptr<Application> ApplicationSharedPtr;
+typedef std::shared_ptr<const Application> ApplicationConstSharedPtr;
+} // namespace application_manager
namespace app_mngr = application_manager;
namespace resumption {
-class LastState;
-
/**
* @brief Contains logic for storage/restore data of applications.
*/
@@ -81,6 +79,13 @@ class ResumeCtrl {
application_manager::ApplicationSharedPtr application) = 0;
/**
+ * @brief Restore widgets HMI level on the resumption response from HMI
+ * @param response_message smart_object with HMI message
+ */
+ virtual void RestoreWidgetsHMIState(
+ const smart_objects::SmartObject& response_message) = 0;
+
+ /**
* @brief Set application HMI Level as stored in policy
* @param application is application witch HMI Level is need to setup
* @return true if success, otherwise return false
@@ -103,6 +108,16 @@ class ResumeCtrl {
bool check_policy = true) = 0;
/**
+ * @brief RestoreAppWidgets add widgets for the application
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ * @return the number of widget windows to be resumed
+ */
+ virtual size_t RestoreAppWidgets(
+ application_manager::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) = 0;
+
+ /**
* @brief Remove application from list of saved applications
* @param application is application which need to be removed
* @return return true, if success, otherwise return false
@@ -125,6 +140,16 @@ class ResumeCtrl {
virtual void OnAwake() = 0;
/**
+ * @brief Saves Low Voltage signal timestamp
+ */
+ virtual void SaveLowVoltageTime() = 0;
+
+ /**
+ * @brief Saves Wake Up signal timestamp
+ */
+ virtual void SaveWakeUpTime() = 0;
+
+ /**
* @brief Checks if SDL has already received OnExitAllApplication notification
* with "SUSPEND" reason
*
@@ -134,13 +159,19 @@ class ResumeCtrl {
virtual bool is_suspended() const = 0;
/**
- * @brief Method stops timer "RsmCtrlPercist" when SDL
+ * @brief Method stops timer "RsmCtrlPersist" when SDL
* receives OnExitAllApplication notification
* with reason "SUSPEND"
*/
virtual void StopSavePersistentDataTimer() = 0;
/**
+ * @brief Method starts timer "RsmCtrlPersist" when
+ * SDL receives onAwakeSDL notification
+ */
+ virtual void StartSavePersistentDataTimer() = 0;
+
+ /**
* @brief Start timer for resumption applications
* Restore D1-D5 data
* @param application that is need to be restored
@@ -158,6 +189,13 @@ class ResumeCtrl {
app_mngr::ApplicationSharedPtr application) = 0;
/**
+ * @brief Retry resumption of an app if it has been disabled or limited
+ * due to absence of high-bandwidth transport.
+ * @param app_id ID of the app to resume
+ */
+ virtual void RetryResumption(const uint32_t app_id) = 0;
+
+ /**
* @brief Check if there are all files need for resumption
* @param application that is need to be restored
* @return true if it all files exist, otherwise return false
@@ -210,7 +248,7 @@ class ResumeCtrl {
* @param application - application to restore hmi level
* and audio streaming state
*/
- virtual void StartAppHmiStateResumption(
+ virtual bool StartAppHmiStateResumption(
application_manager::ApplicationSharedPtr application) = 0;
/**
@@ -232,12 +270,15 @@ class ResumeCtrl {
*/
virtual void RemoveFromResumption(uint32_t app_id) = 0;
+ DEPRECATED
+ virtual bool Init(resumption::LastState& last_state) = 0;
+
/**
* @brief Initialization data for Resume controller
* @return true if initialization is success otherwise
* returns false
*/
- virtual bool Init(LastState& last_state) = 0;
+ virtual bool Init(resumption::LastStateWrapperPtr last_state_wrapper) = 0;
/**
* @brief Notify resume controller about new application
@@ -259,11 +300,16 @@ class ResumeCtrl {
virtual int32_t GetSavedAppHmiLevel(const std::string& app_id,
const std::string& device_id) const = 0;
+ virtual void StartWaitingForDisplayCapabilitiesUpdate(
+ app_mngr::ApplicationSharedPtr application) = 0;
+
virtual time_t LaunchTime() const = 0;
#ifdef BUILD_TESTS
virtual void set_resumption_storage(
- utils::SharedPtr<ResumptionData> mock_storage) = 0;
+ std::shared_ptr<ResumptionData> mock_storage) = 0;
+
+ virtual bool get_resumption_active() const = 0;
#endif // BUILD_TESTS
};
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
index d7ff621c95..3ac59b9f88 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
@@ -33,26 +33,25 @@
#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"
+
#include <stdint.h>
-#include <vector>
+#include <list>
#include <map>
#include <set>
-#include <list>
+#include <vector>
+#include "application_manager/application.h"
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/resumption/resumption_data.h"
#include "interfaces/HMI_API.h"
#include "interfaces/HMI_API_schema.h"
#include "interfaces/MOBILE_API_schema.h"
-#include "application_manager/event_engine/event_observer.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/application.h"
-#include "application_manager/resumption/resumption_data.h"
-#include "application_manager/resumption/resume_ctrl.h"
#include "utils/timer.h"
namespace resumption {
-class LastState;
-
/**
* @brief Contains logic for storage/restore data of applications.
*/
@@ -94,6 +93,9 @@ class ResumeCtrlImpl : public ResumeCtrl,
*/
bool RestoreAppHMIState(app_mngr::ApplicationSharedPtr application) OVERRIDE;
+ void RestoreWidgetsHMIState(
+ const smart_objects::SmartObject& response_message) OVERRIDE;
+
/**
* @brief Set application HMI Level as stored in policy
* @param application is application witch HMI Level is need to setup
@@ -116,6 +118,15 @@ class ResumeCtrlImpl : public ResumeCtrl,
bool check_policy = true) OVERRIDE;
/**
+ * @brief RestoreAppWidgets add widgets for the application
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ size_t RestoreAppWidgets(
+ application_manager::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) OVERRIDE;
+
+ /**
* @brief Remove application from list of saved applications
* @param application is application which need to be removed
* @return return true, if success, otherwise return false
@@ -138,6 +149,10 @@ class ResumeCtrlImpl : public ResumeCtrl,
*/
void OnAwake() OVERRIDE;
+ void SaveLowVoltageTime() OVERRIDE;
+
+ void SaveWakeUpTime() OVERRIDE;
+
/**
* @brief Checks if SDL has already received OnExitAllApplication notification
* with "SUSPEND" reason
@@ -155,6 +170,13 @@ class ResumeCtrlImpl : public ResumeCtrl,
void StopSavePersistentDataTimer() OVERRIDE;
/**
+ * @brief Check if all IGNITION OFF and IGNITION ON records
+ * saved in resumption data base
+ * @return True if all records saved, otherwise False
+ */
+ bool CheckIgnCyclesData() const;
+
+ /**
* @brief Method stops restore_hmi_level_timer_ "RsmCtrlRstore" in OnSuspend()
*/
void StopRestoreHmiLevelTimer();
@@ -178,6 +200,13 @@ class ResumeCtrlImpl : public ResumeCtrl,
app_mngr::ApplicationSharedPtr application) OVERRIDE;
/**
+ * @brief Retry resumption of an app if it has been disabled or limited
+ * due to absence of high-bandwidth transport.
+ * @param app_id ID of the app to resume
+ */
+ void RetryResumption(const uint32_t app_id) OVERRIDE;
+
+ /**
* @brief Check if there are all files need for resumption
* @param application that is need to be restored
* @return true if it all files exist, otherwise return false
@@ -231,8 +260,9 @@ class ResumeCtrlImpl : public ResumeCtrl,
* @brief Resume HMI Level and audio streaming state if needed
* @param application - application to restore hmi level
* and audio streaming state
+ * @return true if success otherwise false
*/
- void StartAppHmiStateResumption(
+ bool StartAppHmiStateResumption(
app_mngr::ApplicationSharedPtr application) OVERRIDE;
/**
@@ -254,12 +284,14 @@ class ResumeCtrlImpl : public ResumeCtrl,
*/
void RemoveFromResumption(uint32_t app_id) OVERRIDE;
+ DEPRECATED bool Init(resumption::LastState& last_state) FINAL;
+
/**
* @brief Initialization data for Resume controller
* @return true if initialization is success otherwise
* returns false
*/
- bool Init(LastState& last_state) OVERRIDE;
+ bool Init(resumption::LastStateWrapperPtr last_state_wrapper) FINAL;
/**
* @brief Notify resume controller about new application
@@ -277,6 +309,9 @@ class ResumeCtrlImpl : public ResumeCtrl,
int32_t GetSavedAppHmiLevel(const std::string& app_id,
const std::string& device_id) const OVERRIDE;
+ void StartWaitingForDisplayCapabilitiesUpdate(
+ app_mngr::ApplicationSharedPtr application) OVERRIDE;
+
/**
* @brief geter for launch_time_
* @return value of launch_time_
@@ -293,14 +328,30 @@ class ResumeCtrlImpl : public ResumeCtrl,
* @brief Method starts timer "RsmCtrlPercist" when
* SDL receives onAwakeSDL notification
*/
- void StartSavePersistentDataTimer();
+ void StartSavePersistentDataTimer() OVERRIDE;
#ifdef BUILD_TESTS
void set_resumption_storage(
- utils::SharedPtr<ResumptionData> mock_storage) OVERRIDE;
+ std::shared_ptr<ResumptionData> mock_storage) OVERRIDE;
+
+ bool get_resumption_active() const OVERRIDE;
#endif // BUILD_TESTS
private:
/**
+ * @brief Returns Low Voltage signal timestamp
+ * @return Low Voltage event timestamp if event LOW VOLTAGE event occures
+ * otherwise 0
+ */
+ time_t LowVoltageTime() const;
+
+ /**
+ * @brief Returns Wake Up signal timestamp
+ * @return Wake Up timestamp if Wake Up signal occures
+ * otherwise 0
+ */
+ time_t WakeUpTime() const;
+
+ /**
* @brief restores saved data of application
* @param application contains application for which restores data
* @return true if success, otherwise return false
@@ -381,11 +432,27 @@ class ResumeCtrlImpl : public ResumeCtrl,
void AddWayPointsSubscription(app_mngr::ApplicationSharedPtr application,
const smart_objects::SmartObject& saved_app);
+ /**
+ * @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 if allowed , otherwise - False
+ */
bool CheckIgnCycleRestrictions(const smart_objects::SmartObject& saved_app);
- bool DisconnectedJustBeforeIgnOff(
- const smart_objects::SmartObject& saved_app);
+ /**
+ * @brief Checks if saved HMI level is allowed for resumption
+ * by Low Voltage restrictions
+ * @param saved_app application specific section from backup file
+ * @return True if allowed , otherwise - False
+ */
+ bool CheckLowVoltageRestrictions(const smart_objects::SmartObject& saved_app);
+ /**
+ * @brief Checks if saved HMI level is applicable for resumption
+ * @param saved_app application specific section from backup file
+ * @return True fs allowed , otherwise - False
+ */
bool CheckAppRestrictions(app_mngr::ApplicationConstSharedPtr application,
const smart_objects::SmartObject& saved_app);
@@ -400,10 +467,38 @@ class ResumeCtrlImpl : public ResumeCtrl,
/**
* @brief CheckDelayAfterIgnOn should check if SDL was started less
- * then N seconds ago. N will be readed from profile.
+ * than N seconds ago. N will be read from profile.
* @return true if SDL started N seconds ago, otherwise return false
*/
- bool CheckDelayAfterIgnOn();
+ bool CheckDelayAfterIgnOn() const;
+
+ /**
+ * @brief CheckDelayBeforeIgnOff checks if app was unregistered less
+ * than N seconds before Ignition OFF. N will be read from profile.
+ * @return true if app was disconnected within timeframe of N seconds before
+ * Ignition Off,
+ * otherwise return false
+ */
+ bool CheckDelayBeforeIgnOff(
+ const smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief CheckDelayAfterWakeUp should check if app was registered
+ * during the first N seconds after WakeUp signal. N will be read from
+ * profile.
+ * @return true if app registered within N seconds after WakeUp, otherwise
+ * return false
+ */
+ bool CheckDelayAfterWakeUp() const;
+
+ /**
+ * @brief CheckDelayBeforeLowVoltage checks if app was unregistered within
+ * N seconds before Low Voltage signal. N will be read from profile.
+ * @return true if app was disconnected within timeframe of N seconds before
+ * Low Voltage , otherwise return false
+ */
+ bool CheckDelayBeforeLowVoltage(
+ const smart_objects::SmartObject& saved_app) const;
typedef std::pair<uint32_t, uint32_t> application_timestamp;
@@ -438,7 +533,7 @@ class ResumeCtrlImpl : public ResumeCtrl,
* @brief Get the last ignition off time from LastState
* @return the last ignition off time from LastState
*/
- time_t GetIgnOffTime();
+ time_t GetIgnOffTime() const;
/**
* @brief Setup IgnOff time to LastState
@@ -500,6 +595,29 @@ class ResumeCtrlImpl : public ResumeCtrl,
const application_manager::ApplicationSharedPtr application) const;
/**
+ * @brief Retrieve the HMI level of the app when high-bandwidth transport
+ *isn't available
+ *
+ * The value is configured through smartDeviceLink.ini file
+ *
+ * @param application an instance of the app
+ * @return HMI level that the app is allowed when high-bandwidth transport
+ *isn't available
+ */
+ mobile_apis::HMILevel::eType GetHmiLevelOnLowBandwidthTransport(
+ app_mngr::ApplicationConstSharedPtr application) const;
+
+ /**
+ * @brief Constructs and sends system capability mobile notification
+ *
+ * @param app to send display capabilities updated
+ * @param display_capabilities SO containing notification data
+ */
+ void ProcessSystemCapabilityUpdated(
+ app_mngr::Application& app,
+ const smart_objects::SmartObject& display_capabilities);
+
+ /**
*@brief Mapping applications to time_stamps
* wait for timer to resume HMI Level
*
@@ -513,8 +631,17 @@ class ResumeCtrlImpl : public ResumeCtrl,
bool is_data_saved_;
bool is_suspended_;
time_t launch_time_;
- utils::SharedPtr<ResumptionData> resumption_storage_;
+ time_t low_voltage_time_;
+ time_t wake_up_time_;
+ std::shared_ptr<ResumptionData> resumption_storage_;
application_manager::ApplicationManager& application_manager_;
+ /**
+ *@brief Mapping correlation id to request
+ *wait for on event response from HMI to resume HMI Level
+ */
+ typedef std::map<int32_t, smart_objects::SmartObjectSPtr>
+ WaitingResponseToRequest;
+ WaitingResponseToRequest requests_msg_;
};
} // namespace resumption
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data.h b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
index bee2bce570..69fc5437de 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
+/*
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_H_
-#include "smart_objects/smart_object.h"
#include "application_manager/application.h"
#include "application_manager/application_manager.h"
+#include "smart_objects/smart_object.h"
#include "utils/macro.h"
namespace application_manager {
@@ -95,20 +95,26 @@ class ResumptionData {
virtual void IncrementIgnOffCount() = 0;
/**
- * @brief Increments ignition counter for all registered applications
- * and remember ign_off time stamp
+ * @brief Decrements ignition counter for all registered applications
*/
- DEPRECATED virtual void OnSuspend() = 0;
+ virtual void DecrementIgnOffCount() = 0;
/**
- * @brief Decrements ignition counter for all registered applications
+ * @brief Increments global ignition on counter
+ * by 1
*/
- virtual void DecrementIgnOffCount() = 0;
+ virtual void IncrementGlobalIgnOnCounter() = 0;
/**
- * @brief Decrements ignition counter for all registered applications
+ * @brief Get the global ignition on counter
+ * @return the global ignition on counter
*/
- DEPRECATED virtual void OnAwake() = 0;
+ virtual uint32_t GetGlobalIgnOnCounter() const = 0;
+
+ /**
+ * @brief Resets global ignition on counter
+ */
+ virtual void ResetGlobalIgnOnCount() = 0;
/**
* @brief Retrieves hash ID for the given mobile app ID
@@ -250,6 +256,14 @@ class ResumptionData {
app_mngr::ApplicationConstSharedPtr application) const;
/**
+ * @brief Retrieves of windows info from list of available window
+ * @param application contains list of available windows
+ * @return windows info from list of available window
+ */
+ smart_objects::SmartObject GetApplicationWidgetsInfo(
+ app_mngr::ApplicationConstSharedPtr application) const;
+
+ /**
* @brief checks pointer that it is not equal NULL
* @param ptr - contains pointer which need to check
* @return smartObject from pointer
@@ -258,6 +272,21 @@ class ResumptionData {
const smart_objects::SmartObject* ptr) const;
/**
+ * @brief creates smart object containing window info
+ * @param window_id window id
+ * @param window_type window type
+ * @param window_name window name
+ * @param window_optional_params_map collection containing optional params for
+ * creating window
+ * @return smart object with window data
+ */
+ smart_objects::SmartObject CreateWindowInfoSO(
+ const application_manager::WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const application_manager::WindowParamsMap& window_optional_params_map)
+ const;
+
+ /**
* @brief Creates smart array from received data
* @param first - iterator points to beginning of the data
* @param last - iterator points to ending of the data
@@ -276,7 +305,6 @@ class ResumptionData {
++first;
}
}
- mutable sync_primitives::Lock resumption_lock_;
const application_manager::ApplicationManager& application_manager_;
};
} // namespace resumption
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
index 780aac82c1..a667dbf8e2 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
@@ -110,16 +110,11 @@ class ResumptionDataDB : public ResumptionData {
virtual uint32_t GetHMIApplicationID(const std::string& policy_app_id,
const std::string& device_id) const;
- /**
- * @brief Increments ignition counter for all registered applications
- * and remember ign_off time stamp
- */
- DEPRECATED void OnSuspend() FINAL;
+ void IncrementGlobalIgnOnCounter() OVERRIDE;
- /**
- * @brief Decrements ignition counter for all registered applications
- */
- DEPRECATED void OnAwake() FINAL;
+ uint32_t GetGlobalIgnOnCounter() const OVERRIDE;
+
+ void ResetGlobalIgnOnCount() OVERRIDE;
/**
* @brief Increments ignition counter for all registered applications
@@ -843,6 +838,7 @@ class ResumptionDataDB : public ResumptionData {
DISALLOW_COPY_AND_ASSIGN(ResumptionDataDB);
utils::dbms::SQLDatabase* db_;
+ mutable sync_primitives::RecursiveLock resumption_lock_;
};
} // namespace resumption
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
index 82ec1d9e5c..2394fe00dc 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
@@ -35,7 +35,7 @@
#include "application_manager/resumption/resumption_data.h"
#include "json/json.h"
-#include "resumption/last_state.h"
+#include "resumption/last_state_wrapper.h"
namespace resumption {
@@ -49,7 +49,12 @@ class ResumptionDataJson : public ResumptionData {
* @brief Constructor of ResumptionDataJson
*/
ResumptionDataJson(
- LastState& last_state,
+ resumption::LastStateWrapperPtr last_state_wrapper,
+ const application_manager::ApplicationManager& application_manager);
+
+ DEPRECATED
+ ResumptionDataJson(
+ LastState&,
const application_manager::ApplicationManager& application_manager);
/**
@@ -80,18 +85,6 @@ class ResumptionDataJson : public ResumptionData {
*/
virtual uint32_t GetHMIApplicationID(const std::string& policy_app_id,
const std::string& device_id) const;
-
- /**
- * @brief Increments ignition counter for all registered applications
- * and remember ign_off time stamp
- */
- DEPRECATED void OnSuspend() FINAL;
-
- /**
- * @brief Decrements ignition counter for all registered applications
- */
- DEPRECATED void OnAwake() FINAL;
-
/**
* @brief Increments ignition counter for all registered applications
* and remember ign_off time stamp
@@ -145,6 +138,12 @@ class ResumptionDataJson : public ResumptionData {
*/
virtual uint32_t GetIgnOffTime() const;
+ void IncrementGlobalIgnOnCounter() OVERRIDE;
+
+ uint32_t GetGlobalIgnOnCounter() const OVERRIDE;
+
+ void ResetGlobalIgnOnCount() OVERRIDE;
+
/**
* @brief Checks if saved data have application
* @param policy_app_id - mobile application id
@@ -181,9 +180,8 @@ class ResumptionDataJson : public ResumptionData {
*/
void Persist() OVERRIDE;
- resumption::LastState& last_state() const {
- return last_state_;
- }
+ DEPRECATED
+ resumption::LastState& last_state() const;
private:
/**
@@ -191,22 +189,26 @@ class ResumptionDataJson : public ResumptionData {
* or adds the new one.
* @param policy_app_id application id.
* @param device_id unique id of device.
+ * @param dictionary - data dictionary where all necessary info stored
* @return the reference to the record in applications array.
*/
Json::Value& GetFromSavedOrAppend(const std::string& policy_app_id,
- const std::string& device_id) const;
+ const std::string& device_id,
+ Json::Value& dictionary) const;
/**
* @brief Get applications for resumption of LastState
+ * @param dictionary - data dictionary where all necessary info stored
* @return applications for resumption of LastState
*/
- Json::Value& GetSavedApplications() const;
+ Json::Value& GetSavedApplications(Json::Value& dictionary) const;
/**
* @brief Get Resumption section of LastState
+ * @param dictionary - data dictionary where all necessary info stored
* @return Resumption section of LastState in Json
*/
- Json::Value& GetResumptionData() const;
+ Json::Value& GetResumptionData(Json::Value& dictionary) const;
/**
* @brief GetObjectIndex allows to obtain specified object index from
@@ -220,15 +222,17 @@ class ResumptionDataJson : public ResumptionData {
/**
* @brief Set applications for resumption to LastState
+ * @param dictionary - data dictionary where all necessary info stored
* @parems apps_json applications to write in LastState
*/
- void SetSavedApplication(Json::Value& apps_json);
+ void SetSavedApplication(Json::Value& apps_json, Json::Value& dictionary);
/**
* @brief Setup IgnOff time to LastState
+ * @param dictionary - data dictionary where all necessary info stored
* @param ign_off_time - igition off time
*/
- void SetLastIgnOffTime(time_t ign_off_time);
+ void SetLastIgnOffTime(time_t ign_off_time, Json::Value& dictionary);
/*
* @brief Return true if application resumption data is valid,
@@ -237,7 +241,7 @@ class ResumptionDataJson : public ResumptionData {
*/
bool IsResumptionDataValid(uint32_t index) const;
- LastState& last_state_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
DISALLOW_COPY_AND_ASSIGN(ResumptionDataJson);
};
} // namespace resumption
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
index 33d62740f7..eee7650697 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
@@ -57,7 +57,10 @@ extern const std::string kUpdateIgnOffCount;
extern const std::string kCountApplicationsIgnOff;
extern const std::string kSelectApplicationsIgnOffCount;
extern const std::string kUpdateSuspendData;
-extern const std::string KUpdateLastIgnOffTime;
+extern const std::string kUpdateLastIgnOffTime;
+extern const std::string kUpdateGlobalIgnOnCount;
+extern const std::string kResetGlobalIgnOnCount;
+extern const std::string kSelectGlobalIgnOnCounter;
extern const std::string kDeleteFile;
extern const std::string kDeleteApplicationFilesArray;
extern const std::string kDeleteSubMenu;
diff --git a/src/components/application_manager/include/application_manager/rpc_handler_impl.h b/src/components/application_manager/include/application_manager/rpc_handler_impl.h
index 5e891608c6..11ac1745ee 100644
--- a/src/components/application_manager/include/application_manager/rpc_handler_impl.h
+++ b/src/components/application_manager/include/application_manager/rpc_handler_impl.h
@@ -35,18 +35,18 @@
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
-#include "application_manager/rpc_handler.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/mobile_message_handler.h"
#include "application_manager/policies/policy_handler_observer.h"
+#include "application_manager/rpc_handler.h"
+#include "application_manager/rpc_service.h"
-#include "protocol_handler/protocol_observer.h"
#include "hmi_message_handler/hmi_message_observer.h"
#include "hmi_message_handler/hmi_message_sender.h"
+#include "protocol_handler/protocol_observer.h"
-#include "formatters/formatter_json_rpc.h"
-#include "formatters/CFormatterJsonSDLRPCv2.h"
#include "formatters/CFormatterJsonSDLRPCv1.h"
+#include "formatters/CFormatterJsonSDLRPCv2.h"
+#include "formatters/formatter_json_rpc.h"
#include "interfaces/HMI_API_schema.h"
#include "interfaces/MOBILE_API_schema.h"
#ifdef TELEMETRY_MONITOR
@@ -56,27 +56,26 @@
#include "interfaces/v4_protocol_v1_2_no_extra.h"
#include "interfaces/v4_protocol_v1_2_no_extra_schema.h"
+#include "utils/semantic_version.h"
#include "utils/threads/message_loop_thread.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
namespace application_manager {
namespace rpc_handler {
namespace impl {
-struct MessageFromMobile : public utils::SharedPtr<Message> {
+struct MessageFromMobile : public std::shared_ptr<Message> {
MessageFromMobile() {}
- explicit MessageFromMobile(const utils::SharedPtr<Message>& message)
- : utils::SharedPtr<Message>(message) {}
+ explicit MessageFromMobile(const std::shared_ptr<Message>& message)
+ : std::shared_ptr<Message>(message) {}
// PrioritizedQueue requires this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
}
};
-struct MessageFromHmi : public utils::SharedPtr<Message> {
+struct MessageFromHmi : public std::shared_ptr<Message> {
MessageFromHmi() {}
- explicit MessageFromHmi(const utils::SharedPtr<Message>& message)
- : utils::SharedPtr<Message>(message) {}
+ explicit MessageFromHmi(const std::shared_ptr<Message>& message)
+ : std::shared_ptr<Message>(message) {}
// PrioritizedQueue requires this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
@@ -88,13 +87,15 @@ typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromMobile> >
FromMobileQueue;
typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromHmi> >
FromHmiQueue;
-}
+} // namespace impl
class RPCHandlerImpl : public RPCHandler,
public impl::FromMobileQueue::Handler,
public impl::FromHmiQueue::Handler {
public:
- RPCHandlerImpl(ApplicationManager& app_manager);
+ RPCHandlerImpl(ApplicationManager& app_manager,
+ hmi_apis::HMI_API& hmi_so_factory,
+ mobile_apis::MOBILE_API& mobile_so_factory);
~RPCHandlerImpl();
// CALLED ON messages_from_mobile_ thread!
@@ -144,12 +145,40 @@ class RPCHandlerImpl : public RPCHandler,
void SetTelemetryObserver(AMTelemetryObserver* observer) OVERRIDE;
#endif // TELEMETRY_MONITOR
+ /**
+ * @brief Extracts and validates the syncMsgVersion included in
+ * a RegisterAppInterfaceRequest
+ *
+ * @param output - SmartObject Message received from mobile
+ * @param messageVersion - message version to be updated
+ */
+ void GetMessageVersion(
+ ns_smart_device_link::ns_smart_objects::SmartObject& output,
+ utils::SemanticVersion& message_version);
+
+ bool ValidateRpcSO(smart_objects::SmartObject& message,
+ utils::SemanticVersion& msg_version,
+ rpc::ValidationReport& report_out,
+ bool allow_unknown_parameters) OVERRIDE;
+
private:
- void ProcessMessageFromMobile(const utils::SharedPtr<Message> message);
- void ProcessMessageFromHMI(const utils::SharedPtr<Message> message);
+ /**
+ * @brief Checks if message has to be sent to mobile or not
+ * update output message according to checks
+ * @param output - message to check
+ * @returns true if message type is response otherwise false
+ */
+ bool HandleWrongMessageType(smart_objects::SmartObject& output,
+ rpc::ValidationReport report) const;
+
+ void ProcessMessageFromMobile(const std::shared_ptr<Message> message);
+ void ProcessMessageFromHMI(const std::shared_ptr<Message> message);
+
bool ConvertMessageToSO(const Message& message,
- smart_objects::SmartObject& output);
- utils::SharedPtr<Message> ConvertRawMsgToMessage(
+ smart_objects::SmartObject& output,
+ const bool allow_unknown_parameters = false,
+ const bool validate_params = true);
+ std::shared_ptr<Message> ConvertRawMsgToMessage(
const ::protocol_handler::RawMessagePtr message);
hmi_apis::HMI_API& hmi_so_factory();
mobile_apis::MOBILE_API& mobile_so_factory();
@@ -160,8 +189,8 @@ class RPCHandlerImpl : public RPCHandler,
// Thread that pumps messages coming from HMI.
impl::FromHmiQueue messages_from_hmi_;
- hmi_apis::HMI_API hmi_so_factory_;
- mobile_apis::MOBILE_API mobile_so_factory_;
+ hmi_apis::HMI_API& hmi_so_factory_;
+ mobile_apis::MOBILE_API& mobile_so_factory_;
#ifdef TELEMETRY_MONITOR
AMTelemetryObserver* metric_observer_;
#endif // TELEMETRY_MONITOR
diff --git a/src/components/application_manager/include/application_manager/rpc_passing_handler.h b/src/components/application_manager/include/application_manager/rpc_passing_handler.h
new file mode 100644
index 0000000000..45fe4cad2f
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/rpc_passing_handler.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RPC_PASSING_HANDLER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RPC_PASSING_HANDLER_H_
+
+#include <deque>
+#include "application_manager/application.h"
+#include "application_manager/commands/command.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+#include "utils/timer.h"
+
+namespace application_manager {
+
+struct ServiceInfo {
+ std::string service_id;
+ uint32_t connection_key;
+};
+
+typedef std::shared_ptr<timer::Timer> TimerSPtr;
+
+class AppServiceManager;
+
+class RPCPassingHandler {
+ public:
+ RPCPassingHandler(AppServiceManager& asm_ref, ApplicationManager& am_ref);
+
+ /**
+ * @brief Class destructor
+ */
+ ~RPCPassingHandler();
+
+ /**
+ * @brief Check if function id is in the handled_rpcs list of an active app
+ * service
+ * @param function_id RPC function id
+ * @return true if function id exists in handled_rpcs list of an active app
+ * service
+ */
+ bool CanHandleFunctionID(int32_t function_id);
+
+ /**
+ * @brief Check if app services or core is being used to handle the RPC
+ * @param correlation_id correlation id of RPC response
+ * @return true if an app service was used to handle the RPC
+ */
+ bool IsPassThroughMessage(uint32_t correlation_id,
+ commands::Command::CommandSource source,
+ int32_t message_type);
+ /**
+ * @brief Check if passthrough is allowed by policies for a given message
+ * @param rpc_message RPC message SmartObject
+ * @return true if the request is allowed to be passed through, false
+ * otherwise
+ */
+ bool IsPassthroughAllowed(smart_objects::SmartObject rpc_message);
+
+ /**
+ * @brief Function to handle sending and receiving RPC Passing
+ * requests/responses
+ * @param rpc_message RPC message SmartObject
+ * @return true if the request was handled, false otherwise
+ */
+ bool RPCPassThrough(smart_objects::SmartObject rpc_message);
+
+ private:
+ bool PerformNextRequest(uint32_t correlation_id);
+ void OnPassThroughRequestTimeout();
+ void AddRequestTimer(uint32_t correlation_id);
+ void RemoveRequestTimer(uint32_t correlation_id);
+ void ClearCompletedTimers();
+ void ForwardRequestToMobile(uint32_t correlation_id);
+ void ForwardRequestToCore(uint32_t correlation_id);
+ void ForwardResponseToMobile(uint32_t correlation_id,
+ smart_objects::SmartObject response_message);
+ void PopulateRPCRequestQueue(smart_objects::SmartObject request_message);
+ bool ExtractRPCParams(const smart_objects::SmartObject& s_map,
+ const ApplicationSharedPtr app,
+ const std::string& function_id_str);
+
+ AppServiceManager& app_service_manager_;
+ ApplicationManager& app_manager_;
+ sync_primitives::RecursiveLock rpc_request_queue_lock_;
+ std::map<uint32_t,
+ std::pair<smart_objects::SmartObject, std::deque<ServiceInfo> > >
+ rpc_request_queue;
+ sync_primitives::RecursiveLock timeout_queue_lock_;
+ std::vector<std::pair<TimerSPtr, uint32_t> > timeout_queue_;
+};
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RPC_PASSING_HANDLER_H_
diff --git a/src/components/application_manager/include/application_manager/rpc_protection_manager.h b/src/components/application_manager/include/application_manager/rpc_protection_manager.h
new file mode 100644
index 0000000000..34188da4e9
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/rpc_protection_manager.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_PROTOCOL_HANDLER_RPC_PROTECTION_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_PROTOCOL_HANDLER_RPC_PROTECTION_MANAGER_H_
+
+#include <cstdint>
+#include <memory>
+
+#include "application_manager/application.h"
+#include "application_manager/policies/policy_handler_observer.h"
+#include "smart_objects/smart_object.h"
+
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
+class SmartObject;
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
+namespace smart_objects = ns_smart_device_link::ns_smart_objects;
+
+namespace application_manager {
+class Application;
+} // namespace application_manager
+
+namespace application_manager {
+/**
+ * @brief RPCProtectionManager interface
+ * This entity exists to get info from policy table regarding encryption on
+ * application and function group level, as well as make decisions whether
+ * certain RPC should be encrypted or not.
+ * It mediates communication between PRCService and
+ * PolicyEncryptionFlagGetterInterface which is implemented by PolicyManager,
+ * providing adequate level of abstraction.
+ */
+class RPCProtectionManager : public policy::PolicyHandlerObserver {
+ public:
+ /*
+ * @brief virtual destructor RPCProtectionManager
+ */
+ virtual ~RPCProtectionManager() {}
+
+ /*
+ * @brief checks whether given rpc requires encryption by policy
+ * @param function_id function id
+ * @param app ref to Application
+ * @param is_rpc_service_secure the flag the secure service started
+ * @return true if function need encryption for current app, else false
+ */
+ virtual bool CheckPolicyEncryptionFlag(
+ const uint32_t function_id,
+ const ApplicationSharedPtr app,
+ const bool is_rpc_service_secure) const = 0;
+ /*
+ * @brief check whether given rpc is saved to internal cache and needs to be
+ * encrypted before sending to mobile
+ * @param app_id application id
+ * @param correlation_id correlation id
+ * @return true if the message with correlation id correlation_id needed e
+ * ncryption else false
+ */
+ virtual bool IsInEncryptionNeededCache(
+ const uint32_t app_id, const uint32_t conrrelation_id) const = 0;
+
+ /*
+ * @brief Adds app id and correlation id of a message to internal cache
+ * @param app_id application if
+ * @param correlation_id correlation id
+ */
+ virtual void AddToEncryptionNeededCache(const uint32_t app_id,
+ const uint32_t correlation_id) = 0;
+
+ /*
+ * @brief Removes app id and correlation id of a message from internal cache
+ * @param app_id application if
+ * @param correlation_id correlation id
+ */
+ virtual void RemoveFromEncryptionNeededCache(
+ const uint32_t app_id, const uint32_t correlation_id) = 0;
+};
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_PROTOCOL_HANDLER_RPC_PROTECTION_MANAGER_H_
diff --git a/src/components/application_manager/include/application_manager/rpc_protection_manager_impl.h b/src/components/application_manager/include/application_manager/rpc_protection_manager_impl.h
new file mode 100644
index 0000000000..b971ace480
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/rpc_protection_manager_impl.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_PROTOCOL_HANDLER_RPC_PROTECTION_MANAGER_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_PROTOCOL_HANDLER_RPC_PROTECTION_MANAGER_IMPL_H_
+
+#include <map>
+#include <set>
+#include "application_manager/policies/policy_handler.h"
+#include "application_manager/rpc_protection_manager.h"
+
+namespace application_manager {
+/*
+ * @brief RPCProtectionManager implementation
+ */
+class RPCProtectionManagerImpl : public RPCProtectionManager {
+ public:
+ typedef std::pair<uint32_t, uint32_t> AppIdCorrIdPair;
+ typedef std::set<std::string> FunctionNames;
+ typedef std::map<std::string, FunctionNames> AppEncryptedRpcMap;
+
+ RPCProtectionManagerImpl(policy::PolicyHandlerInterface& policy_handler);
+
+ ~RPCProtectionManagerImpl() OVERRIDE {}
+
+ bool CheckPolicyEncryptionFlag(
+ const uint32_t function_id,
+ const ApplicationSharedPtr app,
+ const bool is_rpc_service_secure) const OVERRIDE;
+
+ bool IsInEncryptionNeededCache(const uint32_t app_id,
+ const uint32_t conrrelation_id) const OVERRIDE;
+
+ void AddToEncryptionNeededCache(const uint32_t app_id,
+ const uint32_t correlation_id) OVERRIDE;
+
+ void RemoveFromEncryptionNeededCache(const uint32_t app_id,
+ const uint32_t correlation_id) OVERRIDE;
+
+ // PolicyHandlerObserver interface
+ void OnPTUFinished(const bool ptu_result) OVERRIDE;
+
+ void OnPTInited() OVERRIDE;
+
+ private:
+ /*
+ * @brief check whether given rpc is an exception
+ * @param function_id function id
+ * @return true if function_id is an exception (rpc that can be sent before
+ * app is registered, hence before secure rpc service is established)
+ */
+ bool IsExceptionRPC(const uint32_t function_id) const;
+
+ /*
+ * @brief retreives list of rpcs that require encryption by policy
+ * @param policy_app_id policy application name
+ * @return container with function names that require encryption by policy
+ */
+ FunctionNames GetEncryptedRPCsForApp(const std::string& policy_app_id);
+
+ /*
+ * @brief checks whether given function name is in saved encrypted rpc list
+ * @param policy_app_id policy application name
+ * @param function_name policy function name
+ * @return true if function_name for this policy_app_id is saved, otherwise -
+ * false
+ */
+ bool IsEncryptionRequiredByPolicy(const std::string& policy_app_id,
+ const std::string& function_name) const;
+
+ /*
+ * @brief saves rpcs that have encryption_required flag in policy table to
+ * internal container
+ */
+ void SaveEncryptedRPC();
+
+ policy::PolicyHandlerInterface& policy_handler_;
+
+ AppEncryptedRpcMap encrypted_rpcs_;
+ sync_primitives::Lock encrypted_rpcs_lock_;
+
+ std::set<AppIdCorrIdPair> encryption_needed_cache_;
+ sync_primitives::Lock message_needed_encryption_lock_;
+};
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_PROTOCOL_HANDLER_RPC_PROTECTION_MANAGER_IMPL_H_
diff --git a/src/components/application_manager/include/application_manager/rpc_service_impl.h b/src/components/application_manager/include/application_manager/rpc_service_impl.h
index 6f39e11592..3e3d83a519 100644
--- a/src/components/application_manager/include/application_manager/rpc_service_impl.h
+++ b/src/components/application_manager/include/application_manager/rpc_service_impl.h
@@ -34,35 +34,36 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RPC_SERVICE_IMPL_H
#include "application_manager/application_manager.h"
-#include "application_manager/rpc_service.h"
-#include "application_manager/request_controller.h"
+#include "application_manager/command_holder_impl.h"
#include "application_manager/message_helper.h"
-#include "application_manager/usage_statistics.h"
#include "application_manager/mobile_message_handler.h"
-#include "application_manager/command_holder_impl.h"
+#include "application_manager/request_controller.h"
+#include "application_manager/rpc_protection_manager.h"
+#include "application_manager/rpc_service.h"
+#include "application_manager/usage_statistics.h"
-#include "formatters/formatter_json_rpc.h"
-#include "formatters/CFormatterJsonSDLRPCv2.h"
#include "formatters/CFormatterJsonSDLRPCv1.h"
+#include "formatters/CFormatterJsonSDLRPCv2.h"
+#include "formatters/formatter_json_rpc.h"
#include "interfaces/HMI_API_schema.h"
#include "interfaces/MOBILE_API_schema.h"
#include "interfaces/v4_protocol_v1_2_no_extra.h"
#include "interfaces/v4_protocol_v1_2_no_extra_schema.h"
-#include "utils/threads/message_loop_thread.h"
#include "utils/logger.h"
+#include "utils/threads/message_loop_thread.h"
namespace application_manager {
namespace rpc_service {
namespace impl {
-struct MessageToMobile : public utils::SharedPtr<Message> {
+struct MessageToMobile : public std::shared_ptr<Message> {
MessageToMobile() : is_final(false) {}
- explicit MessageToMobile(const utils::SharedPtr<Message>& message,
+ explicit MessageToMobile(const std::shared_ptr<Message>& message,
bool final_message)
- : utils::SharedPtr<Message>(message), is_final(final_message) {}
+ : std::shared_ptr<Message>(message), is_final(final_message) {}
// PrioritizedQueue requires this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
@@ -71,10 +72,10 @@ struct MessageToMobile : public utils::SharedPtr<Message> {
bool is_final;
};
-struct MessageToHmi : public utils::SharedPtr<Message> {
+struct MessageToHmi : public std::shared_ptr<Message> {
MessageToHmi() {}
- explicit MessageToHmi(const utils::SharedPtr<Message>& message)
- : utils::SharedPtr<Message>(message) {}
+ explicit MessageToHmi(const std::shared_ptr<Message>& message)
+ : std::shared_ptr<Message>(message) {}
// PrioritizedQueue requires this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
@@ -85,7 +86,15 @@ typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToMobile> >
ToMobileQueue;
typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToHmi> >
ToHmiQueue;
-}
+} // namespace impl
+
+typedef std::shared_ptr<RPCProtectionManager> RPCProtectionManagerSPtr;
+
+enum class EncryptionFlagCheckResult {
+ kSuccess_Protected,
+ kSuccess_NotProtected,
+ kError_EncryptionNeeded
+};
class RPCServiceImpl : public RPCService,
public impl::ToMobileQueue::Handler,
@@ -103,12 +112,19 @@ class RPCServiceImpl : public RPCService,
request_controller::RequestController& request_ctrl,
protocol_handler::ProtocolHandler* protocol_handler,
hmi_message_handler::HMIMessageHandler* hmi_handler,
- CommandHolder& commands_holder);
+ CommandHolder& commands_holder,
+ RPCProtectionManagerSPtr rpc_protection_manager,
+ hmi_apis::HMI_API& hmi_so_factory_,
+ mobile_apis::MOBILE_API& mobile_so_factory_);
~RPCServiceImpl();
+ void Stop() OVERRIDE;
+
bool ManageMobileCommand(const commands::MessageSharedPtr message,
commands::Command::CommandSource source) OVERRIDE;
- bool ManageHMICommand(const commands::MessageSharedPtr message) OVERRIDE;
+ bool ManageHMICommand(const commands::MessageSharedPtr message,
+ commands::Command::CommandSource source =
+ commands::Command::SOURCE_HMI) OVERRIDE;
// CALLED ON messages_to_hmi_ thread!
void Handle(const impl::MessageToHmi message) OVERRIDE;
@@ -119,29 +135,51 @@ class RPCServiceImpl : public RPCService,
bool final_message = false) OVERRIDE;
void SendMessageToHMI(const commands::MessageSharedPtr message) OVERRIDE;
+ bool IsAppServiceRPC(int32_t function_id,
+ commands::Command::CommandSource source) OVERRIDE;
+
void set_protocol_handler(
protocol_handler::ProtocolHandler* handler) OVERRIDE;
void set_hmi_message_handler(
hmi_message_handler::HMIMessageHandler* handler) OVERRIDE;
+ void UpdateMobileRPCParams(
+ const mobile_apis::FunctionID::eType& function_id,
+ const mobile_apis::messageType::eType& message_type,
+ const std::map<std::string, SMember>& members) OVERRIDE;
+ void UpdateHMIRPCParams(
+ const hmi_apis::FunctionID::eType& function_id,
+ const hmi_apis::messageType::eType& message_type,
+ const std::map<std::string, SMember>& members) OVERRIDE;
+
private:
bool ConvertSOtoMessage(const smart_objects::SmartObject& message,
- Message& output);
+ Message& output,
+ const bool allow_unknown_parameters = false);
+
+ EncryptionFlagCheckResult IsEncryptionRequired(
+ const smart_objects::SmartObject& message,
+ ApplicationSharedPtr app,
+ const bool is_rpc_service_secure) const;
hmi_apis::HMI_API& hmi_so_factory();
mobile_apis::MOBILE_API& mobile_so_factory();
+ void CheckSourceForUnsupportedRequest(
+ const commands::MessageSharedPtr message,
+ commands::Command::CommandSource source);
ApplicationManager& app_manager_;
request_controller::RequestController& request_ctrl_;
protocol_handler::ProtocolHandler* protocol_handler_;
hmi_message_handler::HMIMessageHandler* hmi_handler_;
+ RPCProtectionManagerSPtr rpc_protection_manager_;
CommandHolder& commands_holder_;
// Thread that pumps messages being passed to mobile side.
impl::ToMobileQueue messages_to_mobile_;
// Thread that pumps messages being passed to HMI.
impl::ToHmiQueue messages_to_hmi_;
- hmi_apis::HMI_API hmi_so_factory_;
- mobile_apis::MOBILE_API mobile_so_factory_;
+ hmi_apis::HMI_API& hmi_so_factory_;
+ mobile_apis::MOBILE_API& mobile_so_factory_;
};
} // namespace rpc_service
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h
index 80e475a680..19dd6fbe3b 100644
--- a/src/components/application_manager/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/include/application_manager/smart_object_keys.h
@@ -1,8 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
- All rights reserved.
-
- Copyright (c) 2017 Xevo Inc.
+ Copyright (c) 2019, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -16,7 +13,7 @@
disclaimer in the documentation and/or other materials provided with the
distribution.
- Neither the name of the copyright holders nor the names of their contributors
+ Neither the name of the Ford Motor Company nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
@@ -41,6 +38,8 @@ namespace application_manager {
namespace strings {
extern const char* params;
+extern const char* require_encryption;
+extern const char* protection;
extern const char* message_type;
extern const char* correlation_id;
extern const char* function_id;
@@ -54,7 +53,9 @@ extern const char* msg_params;
extern const char* method_name;
extern const char* info;
extern const char* app_id;
+extern const char* full_app_id;
extern const char* bundle_id;
+extern const char* window_id;
extern const char* app_info;
extern const char* app_launch;
extern const char* app_launch_list;
@@ -62,6 +63,7 @@ extern const char* app_launch_last_session;
extern const char* policy_app_id;
extern const char* hmi_app_id;
extern const char* device_id;
+extern const char* subscribe;
extern const char* subscribed_for_way_points;
extern const char* url;
extern const char* urlScheme;
@@ -78,7 +80,7 @@ extern const char* ngn_media_screen_app_name;
extern const char* vr_synonyms;
extern const char* uses_vehicle_data;
extern const char* is_media_application;
-extern const char* greyOut;
+extern const char* grey_out;
extern const char* language_desired;
extern const char* auto_activated_id;
extern const char* app_type;
@@ -93,6 +95,7 @@ extern const char* main_field_1;
extern const char* main_field_2;
extern const char* main_field_3;
extern const char* main_field_4;
+extern const char* template_title;
extern const char* metadata_tags;
extern const char* eta;
extern const char* time_to_destination;
@@ -111,10 +114,13 @@ extern const char* menu_icon;
extern const char* keyboard_properties;
extern const char* vr_commands;
extern const char* position;
+extern const char* user_location;
extern const char* num_ticks;
extern const char* slider_footer;
extern const char* menu_id;
extern const char* menu_name;
+extern const char* menu_layout;
+extern const char* menu_layouts_available;
extern const char* interaction_choice_set_id;
extern const char* interaction_choice_set_id_list;
extern const char* choice_set;
@@ -130,7 +136,10 @@ extern const char* initial_prompt;
extern const char* initial_text;
extern const char* duration;
extern const char* progress_indicator;
+extern const char* func_id;
+extern const char* cancel_id;
extern const char* alert_type;
+extern const char* alert_icon;
extern const char* play_tone;
extern const char* soft_buttons;
extern const char* soft_button_id;
@@ -160,15 +169,24 @@ extern const char* hours;
extern const char* minutes;
extern const char* seconds;
extern const char* update_mode;
+extern const char* audioStreamingIndicator;
extern const char* trigger_source;
extern const char* hmi_level;
extern const char* activate_app_hmi_level;
extern const char* audio_streaming_state;
extern const char* video_streaming_state;
extern const char* system_context;
+extern const char* window_name;
+extern const char* window_type;
+extern const char* window_type_supported;
+extern const char* maximum_number_of_windows;
+extern const char* window_capabilities;
+extern const char* associated_service_type;
+extern const char* duplicate_updates_from_window_id;
extern const char* speech_capabilities;
extern const char* vr_capabilities;
extern const char* audio_pass_thru_capabilities;
+extern const char* audio_pass_thru_capabilities_list;
extern const char* pcm_stream_capabilities;
extern const char* audio_pass_thru_icon;
extern const char* way_points;
@@ -179,6 +197,8 @@ extern const char* navigation_capability;
extern const char* phone_capability;
extern const char* video_streaming_capability;
extern const char* rc_capability;
+extern const char* seat_location_capability;
+extern const char* app_services_capabilities;
extern const char* day_color_scheme;
extern const char* night_color_scheme;
extern const char* primary_color;
@@ -188,11 +208,27 @@ extern const char* red;
extern const char* green;
extern const char* blue;
extern const char* display_layout;
+extern const char* template_configuration;
+extern const char* template_layout;
extern const char* icon_resumed;
+extern const char* nicknames;
+extern const char* enabled;
+extern const char* auth_token;
+extern const char* cloud_transport_type;
+extern const char* hybrid_app_preference;
+extern const char* is_cloud_application;
+extern const char* cloud_connection_status;
+extern const char* endpoint;
+extern const char* display_capabilities;
+extern const char* policy_type;
+extern const char* property;
+extern const char* displays;
+extern const char* seat_location;
// PutFile
extern const char* sync_file_name;
extern const char* file_name;
+extern const char* file_path;
extern const char* file_type;
extern const char* file_size;
extern const char* crc32_check_sum;
@@ -206,6 +242,7 @@ extern const char* is_template;
extern const char* image;
extern const char* type;
extern const char* system_file;
+extern const char* is_system_file;
extern const char* offset;
extern const char* length;
extern const char* secondary_image;
@@ -218,6 +255,7 @@ extern const char* did_location;
extern const char* app_list;
extern const char* device_list;
extern const char* device_info;
+extern const char* secondary_device_info;
extern const char* name;
extern const char* id;
extern const char* isSDLAllowed;
@@ -243,6 +281,7 @@ extern const char* key_press_mode;
// duplicate names from hmi_request
extern const char* limited_character_list;
extern const char* auto_complete_text;
+extern const char* auto_complete_list;
extern const char* navigation_text;
// vehicle info
@@ -253,6 +292,7 @@ extern const char* fuel_level;
extern const char* fuel_level_state;
extern const char* instant_fuel_consumption;
extern const char* fuel_range;
+extern const char* cloud_app_vehicle_id;
extern const char* external_temp;
extern const char* turn_signal;
extern const char* vin;
@@ -260,6 +300,7 @@ extern const char* prndl;
extern const char* tire_pressure;
extern const char* odometer;
extern const char* belt_status;
+extern const char* electronic_park_brake_status;
extern const char* body_information;
extern const char* device_status;
extern const char* driver_braking;
@@ -272,6 +313,7 @@ extern const char* e_call_info;
extern const char* airbag_status;
extern const char* emergency_event;
extern const char* cluster_mode_status;
+extern const char* cluster_modes;
extern const char* my_key;
extern const char* help_prompt;
extern const char* scroll_message_body;
@@ -291,6 +333,50 @@ extern const char* sdl_version;
extern const char* system_software_version;
extern const char* priority;
extern const char* engine_oil_life;
+extern const char* oem_custom_data_type;
+
+// app services
+extern const char* app_service_manifest;
+extern const char* service_name;
+extern const char* service_type;
+extern const char* service_icon;
+extern const char* allow_app_consumers;
+extern const char* rpc_spec_version;
+extern const char* handled_rpcs;
+extern const char* media_service_manifest;
+extern const char* app_service_record;
+extern const char* service_id;
+extern const char* service_manifest;
+extern const char* service_published;
+extern const char* service_active;
+extern const char* app_service_id;
+extern const char* service_data;
+extern const char* media_service_data;
+extern const char* media_image;
+extern const char* weather_service_data;
+extern const char* location;
+extern const char* current_forecast;
+extern const char* minute_forecast;
+extern const char* hourly_forecast;
+extern const char* multiday_forecast;
+extern const char* weather_icon;
+extern const char* navigation_service_data;
+extern const char* origin;
+extern const char* destination;
+extern const char* instructions;
+extern const char* location_details;
+extern const char* request_service_active;
+extern const char* app_services;
+extern const char* update_reason;
+extern const char* updated_app_service_record;
+extern const char* service_records;
+extern const char* activate;
+extern const char* set_as_default;
+extern const char* origin_app;
+
+// sis data
+extern const char* station_short_name;
+extern const char* station_location;
// resuming
extern const char* application_commands;
@@ -310,11 +396,18 @@ extern const char* resume_vr_grammars;
extern const char* ign_off_count;
+extern const char* global_ign_on_counter;
+
+extern const char* suspend_count;
+
extern const char* connection_info;
extern const char* is_download_complete;
+extern const char* shifted;
+extern const char* altitude;
extern const char* longitude_degrees;
extern const char* latitude_degrees;
+
extern const char* address;
extern const char* country_name;
extern const char* country_code;
@@ -343,6 +436,8 @@ extern const char* delivery_mode;
extern const char* audio_streaming_indicator;
+extern const char* windows_info;
+
// keys for default parameters loaded from hmi_capabilities.json:
extern const char* const keyboard_properties_default;
extern const char* const language_default;
@@ -355,7 +450,8 @@ extern const char* const language_supported;
extern const char* const keyboard_layout_supported;
extern const char* const keypress_mode_supported;
extern const char* const limited_characters_list_supported;
-extern const char* const auto_complete_text_supported;
+extern const char* const send_location_enabled;
+extern const char* const get_way_points_enabled;
extern const char* const entity_type;
extern const char* const entity_id;
extern const char* const status;
@@ -374,6 +470,9 @@ extern const char* const resolution_height;
extern const char* const max_bitrate;
extern const char* const supported_formats;
extern const char* const haptic_spatial_data_supported;
+extern const char* const diagonal_screen_size;
+extern const char* const pixel_per_inch;
+extern const char* const scale;
extern const char* const haptic_rect_data;
extern const char* const rect;
extern const char* const x;
@@ -410,12 +509,14 @@ extern const char* instance_follow_redirect;
extern const char* charset;
extern const char* content_lenght;
extern const char* GET;
-} // http_request
+} // namespace http_request
namespace mobile_notification {
extern const char* state;
extern const char* syncp_timeout;
extern const char* syncp_url;
+extern const char* lock_screen_dismissal_enabled;
+extern const char* lock_screen_dismissal_warning;
} // namespace mobile_notification
namespace hmi_levels {
@@ -462,7 +563,7 @@ extern const char* keyboard_properties;
extern const char* method_name;
extern const char* keyboard_layout;
extern const char* limited_character_list;
-extern const char* auto_complete_text;
+extern const char* auto_complete_list;
extern const char* file;
extern const char* file_name;
extern const char* retry;
@@ -523,6 +624,9 @@ extern const char* policyfile;
extern const char* is_active;
extern const char* is_deactivated;
extern const char* event_name;
+extern const char* service_type;
+extern const char* service_event;
+extern const char* reason;
} // namespace hmi_notification
diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h
index 58747fdd6e..c6121f5d1d 100644
--- a/src/components/application_manager/include/application_manager/state_controller_impl.h
+++ b/src/components/application_manager/include/application_manager/state_controller_impl.h
@@ -35,15 +35,15 @@
#include <list>
#include <map>
-#include "application_manager/hmi_state.h"
#include "application_manager/application.h"
#include "application_manager/application_manager.h"
-#include "event_engine/event_observer.h"
-#include "application_manager/state_controller.h"
+#include "application_manager/hmi_state.h"
#include "application_manager/message_helper.h"
+#include "application_manager/state_controller.h"
+#include "event_engine/event_observer.h"
#include "interfaces/MOBILE_API.h"
-#include "utils/lock.h"
#include "utils/helpers.h"
+#include "utils/lock.h"
namespace application_manager {
@@ -52,166 +52,114 @@ class StateControllerImpl : public event_engine::EventObserver,
public:
explicit StateControllerImpl(ApplicationManager& app_mngr);
- /**
- * @brief SetRegularState setup regular hmi state, that will appear if
- * no specific events are active
- * @param app appication to setup regular State
- * @param state state of new regular state
- */
-
- virtual void SetRegularState(ApplicationSharedPtr app,
- HmiStatePtr state,
- const bool SendActivateApp);
-
- /**
- * @brief SetRegularState Change regular hmi level and audio state
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- * @paran video_state of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state,
+ const bool SendActivateApp) OVERRIDE;
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
- const bool SendActivateApp);
+ const bool SendActivateApp) OVERRIDE;
- /**
- * @brief SetRegularState Change regular hmi level
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI
- */
- virtual void SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level,
- const bool SendActivateApp);
-
- /**
- * @brief SetRegularState Change regular hmi level, audio state and system
- * context
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- * @param video_state of new regular state
- * @param system_context of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const bool SendActivateApp) OVERRIDE;
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
- const bool SendActivateApp);
+ const bool SendActivateApp) OVERRIDE;
- /**
- * @brief SetRegularState Sets regular state with new hmi level
- * to application
- * @param app appication to setup regular state
- * @param hmi_level new hmi level for application
- */
- virtual void SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level);
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::HMILevel::eType hmi_level) OVERRIDE;
- /**
- * @brief SetRegularState Change regular audio state
- * @param app appication to setup regular State
- * @param audio_state of new regular state
- * @param video_state of new regular state
- */
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::AudioStreamingState::eType audio_state,
- const mobile_apis::VideoStreamingState::eType video_state);
+ const mobile_apis::VideoStreamingState::eType video_state) OVERRIDE;
- /**
- * @brief SetRegularState Change regular system context
- * @param app appication to setup regular State
- * @param system_context of new regular state
- */
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
- const mobile_apis::SystemContext::eType system_context);
+ const WindowID window_id,
+ const mobile_apis::SystemContext::eType system_context) OVERRIDE;
- /**
- * @brief SetRegularState Sets new regular state to application
- * @param app appication to setup regular state
- * @param state new hmi state for application
- */
- virtual void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state);
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state) OVERRIDE;
- // EventObserver interface
- void on_event(const event_engine::Event& event);
+ void OnApplicationRegistered(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType default_level) OVERRIDE;
- /**
- * @brief Sets default application state and apply currently active HMI states
- * on application registration
- * @param app application to apply states
- * @param default_level default HMI level
- */
- virtual void OnApplicationRegistered(
+ void OnAppWindowAdded(
ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType default_level);
+ const WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType default_level) OVERRIDE;
- /**
- * @brief OnVideoStreamingStarted process video streaming started
- * @param app projection or navigation application starting streaming
- */
- virtual void OnVideoStreamingStarted(ApplicationConstSharedPtr app);
+ void OnVideoStreamingStarted(ApplicationConstSharedPtr app) OVERRIDE;
- /**
- * @brief OnVideoStreamingStopped process video streaming stopped
- * @param app projection or navigation application stopping streaming
- */
- virtual void OnVideoStreamingStopped(ApplicationConstSharedPtr app);
+ void OnVideoStreamingStopped(ApplicationConstSharedPtr app) OVERRIDE;
- /**
- * @brief OnStateChanged send HMIStatusNotification if needed
- * @param app application
- * @param old_state state before change
- * @param new_state state after change
- */
- virtual void OnStateChanged(ApplicationSharedPtr app,
- HmiStatePtr old_state,
- HmiStatePtr new_state);
+ void OnStateChanged(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr old_state,
+ HmiStatePtr new_state) OVERRIDE;
- /**
- * @brief Checks activity of Deactivate HMI state.
- * @return Returns TRUE if deactivate HMI state is active, otherwise returns
- * FALSE.
- */
- virtual bool IsStateActive(HmiState::StateID state_id) const;
+ bool IsStateActive(HmiState::StateID state_id) const OVERRIDE;
+
+ // EventObserver interface
+ void on_event(const event_engine::Event& event) OVERRIDE;
+ void on_event(const event_engine::MobileEvent& event) OVERRIDE;
+
+ void ActivateDefaultWindow(ApplicationSharedPtr app) OVERRIDE;
+ void ExitDefaultWindow(ApplicationSharedPtr app) OVERRIDE;
private:
- int64_t SendBCActivateApp(ApplicationConstSharedPtr app,
- hmi_apis::Common_HMILevel::eType level,
- bool send_policy_priority);
+ int64_t RequestHMIStateChange(ApplicationConstSharedPtr app,
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority);
/**
* @brief The HmiLevelConflictResolver struct
* Move other application to HmiStates if applied moved to FULL or LIMITED
*/
struct HmiLevelConflictResolver {
const ApplicationSharedPtr applied_;
+ const WindowID window_id_;
const HmiStatePtr state_;
StateControllerImpl* state_ctrl_;
HmiLevelConflictResolver(const ApplicationSharedPtr app,
+ const WindowID window_id,
const HmiStatePtr state,
StateControllerImpl* state_ctrl)
- : applied_(app), state_(state), state_ctrl_(state_ctrl) {}
+ : applied_(app)
+ , window_id_(window_id)
+ , state_(state)
+ , state_ctrl_(state_ctrl) {}
void operator()(ApplicationSharedPtr to_resolve);
};
template <typename UnaryFunction>
void ForEachApplication(UnaryFunction func) const {
- DataAccessor<ApplicationSet> accessor = app_mngr_.applications();
- ApplicationSet::iterator it = accessor.GetData().begin();
- for (; it != accessor.GetData().end(); ++it) {
- ApplicationConstSharedPtr const_app = *it;
- if (const_app) {
- func(app_mngr_.application(const_app->app_id()));
- }
+ ApplicationSet applications;
+ {
+ DataAccessor<ApplicationSet> accessor = app_mngr_.applications();
+ applications = accessor.GetData();
+ }
+
+ for (const auto& app : applications) {
+ func(app);
}
}
@@ -297,14 +245,19 @@ class StateControllerImpl : public event_engine::EventObserver,
template <HmiState::StateID ID>
void HMIStateStarted(ApplicationSharedPtr app) {
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr old_hmi_state = app->CurrentHmiState();
- HmiStatePtr new_hmi_state = CreateHmiState(app, ID);
- DCHECK_OR_RETURN_VOID(new_hmi_state);
- DCHECK_OR_RETURN_VOID(new_hmi_state->state_id() !=
- HmiState::STATE_ID_REGULAR);
- new_hmi_state->set_parent(old_hmi_state);
- app->AddHMIState(new_hmi_state);
- OnStateChanged(app, old_hmi_state, new_hmi_state);
+ const WindowIds window_ids = app->GetWindowIds();
+
+ for (auto window_id : window_ids) {
+ HmiStatePtr old_hmi_state = app->CurrentHmiState(window_id);
+ HmiStatePtr new_hmi_state = CreateHmiState(app, ID);
+ DCHECK_OR_RETURN_VOID(new_hmi_state);
+ DCHECK_OR_RETURN_VOID(new_hmi_state->state_id() !=
+ HmiState::STATE_ID_REGULAR);
+ new_hmi_state->set_parent(old_hmi_state);
+ new_hmi_state->set_window_type(old_hmi_state->window_type());
+ app->AddHMIState(window_id, new_hmi_state);
+ OnStateChanged(app, window_id, old_hmi_state, new_hmi_state);
+ }
}
/**
@@ -325,7 +278,7 @@ class StateControllerImpl : public event_engine::EventObserver,
* depends on application type
* @param app Application to deactivate
*/
- void DeactivateApp(ApplicationSharedPtr app);
+ void DeactivateApp(ApplicationSharedPtr app, const WindowID window_id);
/**
* Function to remove temporary HmiState for application
@@ -333,54 +286,78 @@ class StateControllerImpl : public event_engine::EventObserver,
template <HmiState::StateID ID>
void HMIStateStopped(ApplicationSharedPtr app) {
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr cur = app->CurrentHmiState();
- HmiStatePtr old_hmi_state =
- CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
- DCHECK_OR_RETURN_VOID(old_hmi_state);
- old_hmi_state->set_hmi_level(cur->hmi_level());
- old_hmi_state->set_audio_streaming_state(cur->audio_streaming_state());
- old_hmi_state->set_video_streaming_state(cur->video_streaming_state());
- old_hmi_state->set_system_context(cur->system_context());
- app->RemoveHMIState(ID);
- HmiStatePtr new_hmi_state = app->CurrentHmiState();
- OnStateChanged(app, old_hmi_state, new_hmi_state);
+ const WindowIds window_ids = app->GetWindowIds();
+
+ for (auto window_id : window_ids) {
+ HmiStatePtr cur = app->CurrentHmiState(window_id);
+ HmiStatePtr old_hmi_state =
+ CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(old_hmi_state);
+ old_hmi_state->set_hmi_level(cur->hmi_level());
+ old_hmi_state->set_window_type(cur->window_type());
+ old_hmi_state->set_audio_streaming_state(cur->audio_streaming_state());
+ old_hmi_state->set_video_streaming_state(cur->video_streaming_state());
+ old_hmi_state->set_system_context(cur->system_context());
+ app->RemoveHMIState(window_id, ID);
+ HmiStatePtr new_hmi_state = app->CurrentHmiState(window_id);
+ OnStateChanged(app, window_id, old_hmi_state, new_hmi_state);
+ }
}
/**
* @brief ApplyRegularState setup regular hmi state, that will appear if no
* specific events are active, without sending ActivateApp
* @param app appication to setup default State
+ * @param window_id id of applicaion's window to apply HMI state
* @param state state of new defailt state
*/
- void ApplyRegularState(ApplicationSharedPtr app, HmiStatePtr state);
+ void ApplyRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state);
+
+ /**
+ * @brief UpdateAppWindowsStreamingState updates all application windows
+ * audio/video streaming state according to a new HMI state of the main window
+ * @param app pointer to affected application
+ * @param state pointer to state with the new streaming state of the main
+ * window
+ */
+ void UpdateAppWindowsStreamingState(ApplicationSharedPtr app,
+ HmiStatePtr state);
/**
* @brief SetupRegularHmiState set regular HMI State without
* resolving conflicts and ActivateApp request
* @param app application
+ * @param window_id id of applicaion's window to apply HMI state
* @param state hmi_state to setup
*/
- void SetupRegularHmiState(ApplicationSharedPtr app, HmiStatePtr state);
+ void SetupRegularHmiState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state);
/**
* @brief SetupRegularHmiState set regular HMI State without
* resolving conflicts and ActivateApp request
* @param app application
+ * @param window_id id of applicaion's window to apply HMI state
* @param hmi_level of new regular state
* @param audio_state of new regular state
* @param video_state of new regular state
*/
void SetupRegularHmiState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state);
/**
- * @brief OnActivateAppResponse calback for activate app response
+ * @brief OnHMIResponse callback for activate app or close application
+ * response
* @param message Smart Object
*/
- void OnActivateAppResponse(const smart_objects::SmartObject& message);
+ void OnHMIResponse(const smart_objects::SmartObject& message);
/**
* @brief OnAppDeactivated callback for OnAppDeactivated notification
@@ -420,7 +397,7 @@ class StateControllerImpl : public event_engine::EventObserver,
* @param state_id state id
* @return
*/
- HmiStatePtr CreateHmiState(utils::SharedPtr<Application> app,
+ HmiStatePtr CreateHmiState(std::shared_ptr<Application> app,
HmiState::StateID state_id) const;
/**
@@ -448,9 +425,9 @@ class StateControllerImpl : public event_engine::EventObserver,
typedef std::list<HmiState::StateID> StateIDList;
StateIDList active_states_;
mutable sync_primitives::Lock active_states_lock_;
- std::map<uint32_t, HmiStatePtr> waiting_for_activate_;
+ std::map<uint32_t, HmiStatePtr> waiting_for_response_;
ApplicationManager& app_mngr_;
};
-}
+} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_IMPL_H_
diff --git a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h
index add440ad80..a8ba796a1b 100644
--- a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h
+++ b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h
@@ -36,11 +36,11 @@
#include <time.h>
#include <vector>
+#include "application_manager/application_manager.h"
+#include "application_manager/event_engine/event_observer.h"
#include "utils/lock.h"
#include "utils/macro.h"
#include "utils/system_time_handler.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/event_engine/event_observer.h"
namespace application_manager {
@@ -130,6 +130,12 @@ class SystemTimeHandlerImpl : public utils::SystemTimeHandler,
void ProcessSystemTimeReadyNotification();
/**
+ * @brief ResetPendingSystemTimeRequests resets waiting for system time
+ * requests flag
+ */
+ void ResetPendingSystemTimeRequests() OVERRIDE;
+
+ /**
* @brief Checks if UTC time is ready to provided by HMI
* and can be requested by GetSystemTime request
* @return True if HMI is ready to provide UTC time
diff --git a/src/components/application_manager/include/application_manager/telemetry_observer.h b/src/components/application_manager/include/application_manager/telemetry_observer.h
index 20b3aaca5a..afd5397db9 100644
--- a/src/components/application_manager/include/application_manager/telemetry_observer.h
+++ b/src/components/application_manager/include/application_manager/telemetry_observer.h
@@ -33,10 +33,10 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_TELEMETRY_OBSERVER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_TELEMETRY_OBSERVER_H_
-#include "smart_objects/smart_object.h"
#include "application_manager/smart_object_keys.h"
#include "json/json.h"
-#include "utils/shared_ptr.h"
+#include "smart_objects/smart_object.h"
+
#include "utils/date_time.h"
namespace application_manager {
@@ -44,14 +44,14 @@ namespace application_manager {
class AMTelemetryObserver {
public:
struct MessageMetric {
- TimevalStruct begin;
- TimevalStruct end;
- utils::SharedPtr<smart_objects::SmartObject> message;
+ date_time::TimeDuration begin;
+ date_time::TimeDuration end;
+ std::shared_ptr<smart_objects::SmartObject> message;
};
- typedef utils::SharedPtr<MessageMetric> MessageMetricSharedPtr;
+ typedef std::shared_ptr<MessageMetric> MessageMetricSharedPtr;
virtual void OnMessage(MessageMetricSharedPtr) = 0;
virtual ~AMTelemetryObserver() {}
};
-} // application_manager
+} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_TELEMETRY_OBSERVER_H_
diff --git a/src/components/application_manager/include/application_manager/usage_statistics.h b/src/components/application_manager/include/application_manager/usage_statistics.h
index 886389b05c..ebd8e4729b 100644
--- a/src/components/application_manager/include/application_manager/usage_statistics.h
+++ b/src/components/application_manager/include/application_manager/usage_statistics.h
@@ -33,12 +33,12 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_USAGE_STATISTICS_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_USAGE_STATISTICS_H_
-#include <string>
#include <memory>
-#include "policy/usage_statistics/counter.h"
+#include <string>
#include "policy/usage_statistics/app_stopwatch.h"
+#include "policy/usage_statistics/counter.h"
#include "utils/macro.h"
-#include "utils/shared_ptr.h"
+
#include "interfaces/MOBILE_API.h"
namespace application_manager {
@@ -47,10 +47,10 @@ class UsageStatistics {
public:
UsageStatistics(
const std::string& app_id,
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager);
+ std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager);
UsageStatistics(
const std::string& app_id,
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager,
usage_statistics::AppStopwatch* time_in_hmi_state_ptr);
void RecordHmiStateChanged(mobile_apis::HMILevel::eType new_hmi_level);
void RecordAppRegistrationGuiLanguage(
@@ -66,7 +66,7 @@ class UsageStatistics {
void RecordTLSError();
private:
- std::auto_ptr<usage_statistics::AppStopwatch> time_in_hmi_state_sptr_;
+ std::unique_ptr<usage_statistics::AppStopwatch> time_in_hmi_state_sptr_;
usage_statistics::AppInfo app_registration_language_gui_;
usage_statistics::AppInfo app_registration_language_vui_;
usage_statistics::AppCounter count_of_rejected_rpc_calls_;
diff --git a/src/components/application_manager/rpc_plugins/CMakeLists.txt b/src/components/application_manager/rpc_plugins/CMakeLists.txt
index c9ef282c12..8884b30532 100644
--- a/src/components/application_manager/rpc_plugins/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/CMakeLists.txt
@@ -32,3 +32,4 @@
add_subdirectory(vehicle_info_plugin)
add_subdirectory(sdl_rpc_plugin)
add_subdirectory(rc_rpc_plugin)
+add_subdirectory(app_service_rpc_plugin)
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt
new file mode 100644
index 0000000000..ef215cdd5a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt
@@ -0,0 +1,87 @@
+# Copyright (c) 2019, Ford Motor Company, Livio
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided with the
+# distribution.
+#
+# Neither the name of the copyright holders nor the names of their contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+include_directories(
+ include
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/sdl_rpc_plugin/include
+ )
+
+set (COMMANDS_SOURCE_DIR
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/commands
+)
+
+set (MOBILE_COMMANDS_SOURCE_DIR
+ ${COMMANDS_SOURCE_DIR}/mobile
+)
+
+set (HMI_COMMANDS_SOURCE_DIR
+ ${COMMANDS_SOURCE_DIR}/hmi
+)
+
+collect_sources(MOBILE_COMMANDS "${MOBILE_COMMANDS_SOURCE_DIR}")
+collect_sources(HMI_COMMANDS "${HMI_COMMANDS_SOURCE_DIR}")
+collect_sources(PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src")
+collect_sources(COMMANDS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/commands")
+
+set(LIBRARIES
+ HMI_API
+ MOBILE_API
+ MessageHelper
+ ApplicationManager
+ Resumption
+ v4_protocol_v1_2_no_extra
+ SmartObjects
+ Utils
+ sdl_rpc_plugin_static
+)
+
+if(ENABLE_LOG)
+ list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
+endif()
+
+add_library("app_service_rpc_plugin_static" ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS})
+target_link_libraries("app_service_rpc_plugin_static" ${LIBRARIES})
+
+add_library("app_service_rpc_plugin" SHARED "src/app_service_rpc_plugin.cc")
+target_link_libraries("app_service_rpc_plugin" app_service_rpc_plugin_static)
+
+
+set(INSTALL_DESTINATION bin)
+
+install(TARGETS app_service_rpc_plugin
+ DESTINATION ${INSTALL_DESTINATION}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE
+)
+
+if(BUILD_TESTS)
+ add_subdirectory(test)
+endif()
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h
new file mode 100644
index 0000000000..b04edbe2f4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h
@@ -0,0 +1,131 @@
+/*
+ Copyright (c) 2018, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_APP_EXTENSION_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_APP_EXTENSION_H
+
+#include <application_manager/application_manager.h>
+#include "application_manager/app_extension.h"
+
+#include <set>
+#include <string>
+
+namespace app_service_rpc_plugin {
+class AppServiceRpcPlugin;
+
+namespace app_mngr = application_manager;
+
+typedef int AppExtensionUID;
+typedef mobile_apis::VehicleDataType::eType VehicleDataType;
+/**
+ * @brief Defines set of app service types
+ */
+typedef std::set<std::string> AppServiceSubscriptions;
+
+class AppServiceAppExtension : public app_mngr::AppExtension {
+ public:
+ /**
+ * @brief AppServiceAppExtension constructor
+ * @param plugin app service plugin
+ * @param app application that contains this plugin
+ */
+ AppServiceAppExtension(AppServiceRpcPlugin& plugin,
+ app_mngr::Application& app);
+ virtual ~AppServiceAppExtension();
+
+ /**
+ * @brief subscribeToAppService add vehicle_data to list of subscriptions of
+ * application extension
+ * @param vehicle_data data to subscribe
+ * @return true in case if subscription is successful
+ */
+ bool SubscribeToAppService(const std::string app_service_type);
+
+ /**
+ * @brief unsubscribeFromAppService remove vehicle_data from list of
+ * subscriptions of application extension
+ * @param vehicle_data data to unsubscribe
+ * @return true in case if unsubscription is successful
+ */
+ bool UnsubscribeFromAppService(const std::string app_service_type);
+ /**
+ * @brief unsubscribeFromAppService unsubscribe from all app service types
+ */
+ void UnsubscribeFromAppService();
+
+ /**
+ * @brief isSubscribedToAppService checks if extension is subscribed to
+ * app service type
+ * @param app_service_type data type to check subscription
+ * @return true if extension is subscribed this app_service_type, otherwise
+ * return false
+ */
+ bool IsSubscribedToAppService(const std::string app_service_type) const;
+
+ /**
+ * @brief Subscriptions get list of subscriptions for application extension
+ * @return list of subscriptions for application extension
+ */
+ AppServiceSubscriptions Subscriptions();
+
+ /**
+ * @brief SaveResumptionData saves vehicle info data
+ * @param resumption_data plase to store resumption data
+ */
+ void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject&
+ resumption_data) OVERRIDE;
+
+ /**
+ * @brief ProcessResumption load resumtion data back to plugin during
+ * resumption
+ * @param resumption_data resumption data
+ */
+ void ProcessResumption(
+ const smart_objects::SmartObject& resumption_data) OVERRIDE;
+
+ /**
+ * @brief ExtractVIExtension utility function to extract application extension
+ * from application
+ * @param app : applicaiton that contains vehicle info app_extension
+ * @return application extension extracted from application
+ */
+ static AppServiceAppExtension& ExtractASExtension(
+ application_manager::Application& app);
+
+ private:
+ AppServiceSubscriptions subscribed_data_;
+ AppServiceRpcPlugin& plugin_;
+ app_mngr::Application& app_;
+};
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_APP_EXTENSION_H
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h
new file mode 100644
index 0000000000..193b79e26f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_command_factory.h
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H
+
+#include "app_service_rpc_plugin/app_service_hmi_command_factory.h"
+#include "app_service_rpc_plugin/app_service_mobile_command_factory.h"
+#include "application_manager/application_manager.h"
+
+namespace app_service_rpc_plugin {
+namespace commands = application_manager::commands;
+namespace app_mngr = application_manager;
+
+class AppServiceCommandFactory : public app_mngr::CommandFactory {
+ public:
+ AppServiceCommandFactory(app_mngr::ApplicationManager& app_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ virtual ~AppServiceCommandFactory();
+
+ app_mngr::CommandSharedPtr CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) OVERRIDE;
+
+ bool IsAbleToProcess(
+ const int32_t,
+ const application_manager::commands::Command::CommandSource)
+ const OVERRIDE;
+
+ private:
+ std::unique_ptr<AppServiceHmiCommandFactory> hmi_command_factory_;
+ std::unique_ptr<AppServiceMobileCommandFactory> mobile_command_factory_;
+};
+} // namespace app_service_rpc_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_SDL_COMMAND_FACTORY_H
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h
new file mode 100644
index 0000000000..fd96bf0fb6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_hmi_command_factory.h
@@ -0,0 +1,75 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H
+
+#include "application_manager/application_manager.h"
+#include "application_manager/command_factory.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+/**
+ * @brief The vehicle info hmi command factory.
+ */
+class AppServiceHmiCommandFactory : public app_mngr::CommandFactory {
+ public:
+ AppServiceHmiCommandFactory(app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ app_mngr::CommandSharedPtr CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) OVERRIDE;
+
+ bool IsAbleToProcess(
+ const int32_t function_id,
+ const app_mngr::commands::Command::CommandSource source) const OVERRIDE;
+
+ private:
+ app_mngr::ApplicationManager& application_manager_;
+ app_mngr::rpc_service::RPCService& rpc_service_;
+ app_mngr::HMICapabilities& hmi_capabilities_;
+ policy::PolicyHandlerInterface& policy_handler_;
+
+ app_mngr::CommandCreator& buildCommandCreator(
+ const int32_t function_id,
+ const int32_t message_type,
+ const app_mngr::commands::Command::CommandSource source) const;
+
+ DISALLOW_COPY_AND_ASSIGN(AppServiceHmiCommandFactory);
+};
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_HMI_COMMAND_FACTORY_H
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h
new file mode 100644
index 0000000000..a6300dbb3d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_mobile_command_factory.h
@@ -0,0 +1,76 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H
+
+#include "application_manager/application_manager.h"
+#include "application_manager/command_factory.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+/**
+ * @brief The vehicle info mobile command factory.
+ */
+class AppServiceMobileCommandFactory : public app_mngr::CommandFactory {
+ public:
+ AppServiceMobileCommandFactory(
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ app_mngr::CommandSharedPtr CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) OVERRIDE;
+
+ bool IsAbleToProcess(
+ const int32_t function_id,
+ const app_mngr::commands::Command::CommandSource source) const OVERRIDE;
+
+ private:
+ app_mngr::ApplicationManager& application_manager_;
+ app_mngr::rpc_service::RPCService& rpc_service_;
+ app_mngr::HMICapabilities& hmi_capabilities_;
+ policy::PolicyHandlerInterface& policy_handler_;
+
+ app_mngr::CommandCreator& buildCommandCreator(
+ const int32_t function_id,
+ const int32_t message_type,
+ const app_mngr::commands::Command::CommandSource source) const;
+
+ DISALLOW_COPY_AND_ASSIGN(AppServiceMobileCommandFactory);
+};
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_APP_SERVICE_RPC_MOBILE_COMMAND_FACTORY_H
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
new file mode 100644
index 0000000000..5d85237899
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
@@ -0,0 +1,81 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_RPC_PLUGIN_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_RPC_PLUGIN_H
+
+#include "application_manager/command_factory.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+namespace plugins = application_manager::plugin_manager;
+
+class AppServiceRpcPlugin : public plugins::RPCPlugin {
+ public:
+ AppServiceRpcPlugin();
+
+ bool Init(app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) OVERRIDE;
+
+ DEPRECATED
+ bool Init(app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state);
+
+ bool IsAbleToProcess(
+ const int32_t function_id,
+ const app_mngr::commands::Command::CommandSource source) OVERRIDE;
+
+ std::string PluginName() OVERRIDE;
+ app_mngr::CommandFactory& GetCommandFactory() OVERRIDE;
+
+ void OnPolicyEvent(plugins::PolicyEvent event) OVERRIDE;
+ void OnApplicationEvent(plugins::ApplicationEvent event,
+ app_mngr::ApplicationSharedPtr application) OVERRIDE;
+
+ private:
+ void DeleteSubscriptions(app_mngr::ApplicationSharedPtr app);
+
+ std::unique_ptr<app_mngr::CommandFactory> command_factory_;
+ app_mngr::ApplicationManager* application_manager_;
+};
+} // namespace app_service_rpc_plugin
+
+extern "C" application_manager::plugin_manager::RPCPlugin* Create();
+extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data);
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_PLUGIN_H
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h
new file mode 100644
index 0000000000..c98979da0f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_REQUEST_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/request_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASAppServiceActivationRequest command class
+ **/
+class ASAppServiceActivationRequest
+ : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASAppServiceActivationRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASAppServiceActivationRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASAppServiceActivationRequest class destructor
+ **/
+ virtual ~ASAppServiceActivationRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASAppServiceActivationRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h
new file mode 100644
index 0000000000..68b77cb7e3
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_RESPONSE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASAppServiceActivationResponse command class
+ **/
+class ASAppServiceActivationResponse
+ : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASAppServiceActivationResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASAppServiceActivationResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASAppServiceActivationResponse class destructor
+ **/
+ virtual ~ASAppServiceActivationResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASAppServiceActivationResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_APP_SERVICE_ACTIVATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h
new file mode 100644
index 0000000000..2286d4c67c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetActiveServiceConsentRequest command class
+ **/
+class ASGetActiveServiceConsentRequest
+ : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief ASGetActiveServiceConsentRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetActiveServiceConsentRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASGetActiveServiceConsentRequest class destructor
+ **/
+ virtual ~ASGetActiveServiceConsentRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetActiveServiceConsentRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h
new file mode 100644
index 0000000000..f69152208c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetActiveServiceConsentResponse command class
+ **/
+class ASGetActiveServiceConsentResponse
+ : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief ASGetActiveServiceConsentResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetActiveServiceConsentResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASGetActiveServiceConsentResponse class destructor
+ **/
+ virtual ~ASGetActiveServiceConsentResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetActiveServiceConsentResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_ACTIVE_SERVICE_CONSENT_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h
new file mode 100644
index 0000000000..d9eb7528e4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h
@@ -0,0 +1,106 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_
+
+#include "application_manager/commands/request_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetAppServiceDataRequestFromHMI command class
+ **/
+class ASGetAppServiceDataRequestFromHMI
+ : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceDataRequestFromHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceDataRequestFromHMI(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASGetAppServiceDataRequestFromHMI class destructor
+ **/
+ virtual ~ASGetAppServiceDataRequestFromHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ /**
+ * @brief onTimeOut from request controller
+ */
+ virtual void onTimeOut();
+
+ /**
+ * @brief on_event allows to handle events
+ *
+ * @param event event type that current request subscribed on.
+ */
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+
+ /**
+ * @brief on_event allows to handle events
+ *
+ * @param event event type that current request subscribed on.
+ */
+ void on_event(const app_mngr::event_engine::MobileEvent& event) OVERRIDE;
+
+ private:
+ void GetWeatherImagePaths(smart_objects::SmartObject& data,
+ application_manager::ApplicationSharedPtr app);
+ void GetNavigationImagePaths(smart_objects::SmartObject& data,
+ application_manager::ApplicationSharedPtr app);
+ void GetMediaImagePaths(smart_objects::SmartObject& data,
+ application_manager::ApplicationSharedPtr app);
+ bool ValidateResponse(smart_objects::SmartObject& message_params);
+
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataRequestFromHMI);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h
new file mode 100644
index 0000000000..c4b3026176
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_TO_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_REQUEST_TO_HMI_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetAppServiceDataRequestToHMI command class
+ **/
+class ASGetAppServiceDataRequestToHMI
+ : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceDataRequestToHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceDataRequestToHMI(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASGetAppServiceDataRequestToHMI class destructor
+ **/
+ virtual ~ASGetAppServiceDataRequestToHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataRequestToHMI);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_TO_HMI_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h
new file mode 100644
index 0000000000..b46626a56b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetAppServiceDataResponseFromHMI command class
+ **/
+class ASGetAppServiceDataResponseFromHMI
+ : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceDataResponseFromHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceDataResponseFromHMI(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASGetAppServiceDataResponseFromHMI class destructor
+ **/
+ virtual ~ASGetAppServiceDataResponseFromHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataResponseFromHMI);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h
new file mode 100644
index 0000000000..e48a9d1429
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_
+
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetAppServiceDataResponseToHMI command class
+ **/
+class ASGetAppServiceDataResponseToHMI
+ : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceDataResponseToHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceDataResponseToHMI(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASGetAppServiceDataResponseToHMI class destructor
+ **/
+ virtual ~ASGetAppServiceDataResponseToHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceDataResponseToHMI);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_DATA_RESPONSE_TO_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h
new file mode 100644
index 0000000000..79ea0922a8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_REQUEST_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/request_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetAppServiceRecordsRequest command class
+ **/
+class ASGetAppServiceRecordsRequest
+ : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceRecordsRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceRecordsRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASGetAppServiceRecordsRequest class destructor
+ **/
+ virtual ~ASGetAppServiceRecordsRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceRecordsRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h
new file mode 100644
index 0000000000..6db24132af
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_RESPONSE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASGetAppServiceRecordsResponse command class
+ **/
+class ASGetAppServiceRecordsResponse
+ : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASGetAppServiceRecordsResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASGetAppServiceRecordsResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASGetAppServiceRecordsResponse class destructor
+ **/
+ virtual ~ASGetAppServiceRecordsResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASGetAppServiceRecordsResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_GET_APP_SERVICE_RECORDS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h
new file mode 100644
index 0000000000..36acf116f4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h
@@ -0,0 +1,99 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/request_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASPerformAppServiceInteractionRequestFromHMI command class
+ **/
+class ASPerformAppServiceInteractionRequestFromHMI
+ : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASPerformAppServiceInteractionRequestFromHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPerformAppServiceInteractionRequestFromHMI(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASPerformAppServiceInteractionRequestFromHMI class destructor
+ **/
+ virtual ~ASPerformAppServiceInteractionRequestFromHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ /**
+ * @brief on_event allows to handle events
+ *
+ * @param event event type that current request subscribed on.
+ */
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+
+ /**
+ * @brief on_event allows to handle events
+ *
+ * @param event event type that current request subscribed on.
+ */
+ void on_event(const app_mngr::event_engine::MobileEvent& event) OVERRIDE;
+
+ /**
+ * @brief onTimeOut from request controller
+ */
+ virtual void onTimeOut();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestFromHMI);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h
new file mode 100644
index 0000000000..0b67dd5624
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASPerformAppServiceInteractionRequestToHMI command class
+ **/
+class ASPerformAppServiceInteractionRequestToHMI
+ : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief ASPerformAppServiceInteractionRequestToHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPerformAppServiceInteractionRequestToHMI(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASPerformAppServiceInteractionRequestToHMI class destructor
+ **/
+ virtual ~ASPerformAppServiceInteractionRequestToHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestToHMI);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h
new file mode 100644
index 0000000000..f807348833
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASPerformAppServiceInteractionResponseFromHMI command class
+ **/
+class ASPerformAppServiceInteractionResponseFromHMI
+ : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief ASPerformAppServiceInteractionResponseFromHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPerformAppServiceInteractionResponseFromHMI(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASPerformAppServiceInteractionResponseFromHMI class destructor
+ **/
+ virtual ~ASPerformAppServiceInteractionResponseFromHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionResponseFromHMI);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h
new file mode 100644
index 0000000000..7ce05bdba1
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASPerformAppServiceInteractionResponseToHMI command class
+ **/
+class ASPerformAppServiceInteractionResponseToHMI
+ : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASPerformAppServiceInteractionResponseToHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPerformAppServiceInteractionResponseToHMI(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASPerformAppServiceInteractionResponseToHMI class destructor
+ **/
+ virtual ~ASPerformAppServiceInteractionResponseToHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionResponseToHMI);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_TO_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h
new file mode 100644
index 0000000000..4433444602
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/request_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASPublishAppServiceRequest command class
+ **/
+class ASPublishAppServiceRequest : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASPublishAppServiceRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPublishAppServiceRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASPublishAppServiceRequest class destructor
+ **/
+ virtual ~ASPublishAppServiceRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h
new file mode 100644
index 0000000000..519d57c609
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASPublishAppServiceResponse command class
+ **/
+class ASPublishAppServiceResponse : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASPublishAppServiceResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASPublishAppServiceResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASPublishAppServiceResponse class destructor
+ **/
+ virtual ~ASPublishAppServiceResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASPublishAppServiceResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_PUBLISH_APP_SERVICE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h
new file mode 100644
index 0000000000..fdeadfa7c0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_REQUEST_H_
+
+#include "application_manager/commands/request_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASUnpublishAppServiceRequest command class
+ **/
+class ASUnpublishAppServiceRequest : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASUnpublishAppServiceRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASUnpublishAppServiceRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASUnpublishAppServiceRequest class destructor
+ **/
+ virtual ~ASUnpublishAppServiceRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASUnpublishAppServiceRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h
new file mode 100644
index 0000000000..51edd2dadb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASUnpublishAppServiceResponse command class
+ **/
+class ASUnpublishAppServiceResponse : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASUnpublishAppServiceResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASUnpublishAppServiceResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief ASUnpublishAppServiceResponse class destructor
+ **/
+ virtual ~ASUnpublishAppServiceResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASUnpublishAppServiceResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h
new file mode 100644
index 0000000000..2dcd5ec251
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h
@@ -0,0 +1,88 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/notification_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnASAppServiceDataNotification command class
+ **/
+class OnASAppServiceDataNotification
+ : public app_mngr::commands::NotificationToHMI {
+ public:
+ /**
+ * @brief OnASAppServiceDataNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnASAppServiceDataNotification(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief OnASAppServiceDataNotification class destructor
+ **/
+ virtual ~OnASAppServiceDataNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ void GetMediaImagePaths(smart_objects::SmartObject& data,
+ application_manager::ApplicationSharedPtr app);
+ void GetWeatherImagePaths(smart_objects::SmartObject& data,
+ application_manager::ApplicationSharedPtr app);
+ void GetNavigationImagePaths(smart_objects::SmartObject& data,
+ application_manager::ApplicationSharedPtr app);
+ bool ValidateParams(smart_objects::SmartObject& message_params);
+
+ DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotification);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h
new file mode 100644
index 0000000000..5a23e35df0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/notification_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnASAppServiceDataNotificationFromHMI command class
+ **/
+class OnASAppServiceDataNotificationFromHMI
+ : public app_mngr::commands::NotificationFromHMI {
+ public:
+ /**
+ * @brief OnASAppServiceDataNotificationFromHMI class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnASAppServiceDataNotificationFromHMI(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief OnASAppServiceDataNotificationFromHMI class destructor
+ **/
+ virtual ~OnASAppServiceDataNotificationFromHMI();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnASAppServiceDataNotificationFromHMI);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_ON_AS_APP_SERVICE_DATA_NOTIFICATION_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h
new file mode 100644
index 0000000000..6971354806
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h
@@ -0,0 +1,94 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_request_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetAppServiceDataRequest command class
+ **/
+class GetAppServiceDataRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief GetAppServiceDataRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetAppServiceDataRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief GetAppServiceDataRequest class destructor
+ **/
+ virtual ~GetAppServiceDataRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ /**
+ * @brief Init sets hash update mode for request
+ **/
+ bool Init() FINAL;
+
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ virtual void on_event(const app_mngr::event_engine::Event& event);
+
+ virtual void on_event(const app_mngr::event_engine::MobileEvent& event);
+
+ private:
+ void HandleSubscribe();
+
+ DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h
new file mode 100644
index 0000000000..279cf15055
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_
+
+#include "application_manager/commands/command_request_to_mobile.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetAppServiceDataRequestToMobile command class
+ **/
+class GetAppServiceDataRequestToMobile
+ : public app_mngr::commands::CommandRequestToMobile {
+ public:
+ /**
+ * @brief GetAppServiceDataRequestToMobile class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetAppServiceDataRequestToMobile(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief GetAppServiceDataRequestToMobile class destructor
+ **/
+ virtual ~GetAppServiceDataRequestToMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataRequestToMobile);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_TO_MOBILE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h
new file mode 100644
index 0000000000..f5758e1c39
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetAppServiceDataResponse command class
+ **/
+class GetAppServiceDataResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief GetAppServiceDataResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetAppServiceDataResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief GetAppServiceDataResponse class destructor
+ **/
+ virtual ~GetAppServiceDataResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h
new file mode 100644
index 0000000000..7e2b26d8fb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_response_from_mobile.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetAppServiceDataResponseFromMobile command class
+ **/
+class GetAppServiceDataResponseFromMobile
+ : public app_mngr::commands::CommandResponseFromMobile {
+ public:
+ /**
+ * @brief GetAppServiceDataResponseFromMobile class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetAppServiceDataResponseFromMobile(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief GetAppServiceDataResponseFromMobile class destructor
+ **/
+ virtual ~GetAppServiceDataResponseFromMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetAppServiceDataResponseFromMobile);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_RESPONSE_FROM_MOBILE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h
new file mode 100644
index 0000000000..719f5ebf5b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_notification_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnAppServiceDataNotification command class
+ **/
+class OnAppServiceDataNotification
+ : public app_mngr::commands::CommandNotificationImpl {
+ public:
+ /**
+ * @brief OnAppServiceDataNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnAppServiceDataNotification(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief OnAppServiceDataNotification class destructor
+ **/
+ virtual ~OnAppServiceDataNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotification);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h
new file mode 100644
index 0000000000..c41fabf7b1
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_notification_from_mobile_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnAppServiceDataNotificationFromMobile command class
+ **/
+class OnAppServiceDataNotificationFromMobile
+ : public app_mngr::commands::CommandNotificationFromMobileImpl {
+ public:
+ /**
+ * @brief OnAppServiceDataNotificationFromMobile class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnAppServiceDataNotificationFromMobile(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief OnAppServiceDataNotificationFromMobile class destructor
+ **/
+ virtual ~OnAppServiceDataNotificationFromMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnAppServiceDataNotificationFromMobile);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_SERVICE_DATA_NOTIFICATION_FROM_MOBILE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h
new file mode 100644
index 0000000000..854ed3c6aa
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h
@@ -0,0 +1,89 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_request_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief PerformAppServiceInteractionRequest command class
+ **/
+class PerformAppServiceInteractionRequest
+ : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief PerformAppServiceInteractionRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PerformAppServiceInteractionRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief PerformAppServiceInteractionRequest class destructor
+ **/
+ virtual ~PerformAppServiceInteractionRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ virtual void on_event(const app_mngr::event_engine::Event& event);
+
+ virtual void on_event(const app_mngr::event_engine::MobileEvent& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h
new file mode 100644
index 0000000000..5c38e6a71e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_request_to_mobile.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief PerformAppServiceInteractionRequestToMobile command class
+ **/
+class PerformAppServiceInteractionRequestToMobile
+ : public app_mngr::commands::CommandRequestToMobile {
+ public:
+ /**
+ * @brief PerformAppServiceInteractionRequestToMobile class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PerformAppServiceInteractionRequestToMobile(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief PerformAppServiceInteractionRequestToMobile class destructor
+ **/
+ virtual ~PerformAppServiceInteractionRequestToMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionRequestToMobile);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_TO_MOBILE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h
new file mode 100644
index 0000000000..b4c422fac6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_response_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief PerformAppServiceInteractionResponse command class
+ **/
+class PerformAppServiceInteractionResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief PerformAppServiceInteractionResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PerformAppServiceInteractionResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief PerformAppServiceInteractionResponse class destructor
+ **/
+ virtual ~PerformAppServiceInteractionResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h
new file mode 100644
index 0000000000..4530cb2dfd
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_MOBILE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_MOBILE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_response_from_mobile.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief PerformAppServiceInteractionResponseFromMobile command class
+ **/
+class PerformAppServiceInteractionResponseFromMobile
+ : public app_mngr::commands::CommandResponseFromMobile {
+ public:
+ /**
+ * @brief PerformAppServiceInteractionResponseFromMobile class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PerformAppServiceInteractionResponseFromMobile(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief PerformAppServiceInteractionResponseFromMobile class destructor
+ **/
+ virtual ~PerformAppServiceInteractionResponseFromMobile();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PerformAppServiceInteractionResponseFromMobile);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_RESPONSE_FROM_MOBILE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h
new file mode 100644
index 0000000000..d70f279658
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_request_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief PublishAppServiceRequest command class
+ **/
+class PublishAppServiceRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief PublishAppServiceRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PublishAppServiceRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief PublishAppServiceRequest class destructor
+ **/
+ virtual ~PublishAppServiceRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PublishAppServiceRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h
new file mode 100644
index 0000000000..9275f9e468
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_response.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/commands/command_response_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief PublishAppServiceResponse command class
+ **/
+class PublishAppServiceResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief PublishAppServiceResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ PublishAppServiceResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief PublishAppServiceResponse class destructor
+ **/
+ virtual ~PublishAppServiceResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PublishAppServiceResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h
new file mode 100644
index 0000000000..4a883b92ee
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UnpublishAppServiceRequest command class
+ **/
+class UnpublishAppServiceRequest
+ : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief UnpublishAppServiceRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ UnpublishAppServiceRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief UnpublishAppServiceRequest class destructor
+ **/
+ virtual ~UnpublishAppServiceRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UnpublishAppServiceRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h
new file mode 100644
index 0000000000..512e39eea0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UnpublishAppServiceResponse command class
+ **/
+class UnpublishAppServiceResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief UnpublishAppServiceResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ UnpublishAppServiceResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief UnpublishAppServiceResponse class destructor
+ **/
+ virtual ~UnpublishAppServiceResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UnpublishAppServiceResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc
new file mode 100644
index 0000000000..87f947d250
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc
@@ -0,0 +1,122 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/app_service_app_extension.h"
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+
+namespace app_service_rpc_plugin {
+
+const AppExtensionUID AppServiceAppExtensionUID = 455;
+
+AppServiceAppExtension::AppServiceAppExtension(
+ AppServiceRpcPlugin& plugin, application_manager::Application& app)
+ : app_mngr::AppExtension(AppServiceAppExtensionUID)
+ , plugin_(plugin)
+ , app_(app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+AppServiceAppExtension::~AppServiceAppExtension() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+bool AppServiceAppExtension::SubscribeToAppService(
+ const std::string app_service_type) {
+ LOG4CXX_DEBUG(logger_, "Subscribe to app service: " << app_service_type);
+ return subscribed_data_.insert(app_service_type).second;
+}
+
+bool AppServiceAppExtension::UnsubscribeFromAppService(
+ const std::string app_service_type) {
+ LOG4CXX_DEBUG(logger_, app_service_type);
+ auto it = subscribed_data_.find(app_service_type);
+ if (it != subscribed_data_.end()) {
+ subscribed_data_.erase(it);
+ return true;
+ }
+ return false;
+}
+
+void AppServiceAppExtension::UnsubscribeFromAppService() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ subscribed_data_.clear();
+}
+
+bool AppServiceAppExtension::IsSubscribedToAppService(
+ const std::string app_service_type) const {
+ LOG4CXX_DEBUG(logger_,
+ "isSubscribedToAppService for type: " << app_service_type);
+ return subscribed_data_.find(app_service_type) != subscribed_data_.end();
+}
+
+AppServiceSubscriptions AppServiceAppExtension::Subscriptions() {
+ return subscribed_data_;
+}
+
+void AppServiceAppExtension::SaveResumptionData(
+ smart_objects::SmartObject& resumption_data) {
+ const char* app_service_info = "appService";
+ resumption_data[app_service_info] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ int i = 0;
+ for (const auto& subscription : subscribed_data_) {
+ resumption_data[app_service_info][i] = subscription;
+ i++;
+ }
+}
+
+void AppServiceAppExtension::ProcessResumption(
+ const smart_objects::SmartObject& resumption_data) {
+ const char* app_service_info = "appService";
+ if (resumption_data.keyExists(app_service_info)) {
+ const smart_objects::SmartObject& subscriptions_app_services =
+ resumption_data[app_service_info];
+ for (size_t i = 0; i < subscriptions_app_services.length(); ++i) {
+ std::string service_type = subscriptions_app_services[i].asString();
+ SubscribeToAppService(service_type);
+ }
+ }
+}
+
+AppServiceAppExtension& AppServiceAppExtension::ExtractASExtension(
+ application_manager::Application& app) {
+ auto ext_ptr = app.QueryInterface(AppServiceAppExtensionUID);
+ DCHECK(ext_ptr);
+ DCHECK(dynamic_cast<AppServiceAppExtension*>(ext_ptr.get()));
+ auto vi_app_extension =
+ std::static_pointer_cast<AppServiceAppExtension>(ext_ptr);
+ DCHECK(vi_app_extension);
+ return *vi_app_extension;
+}
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc
new file mode 100644
index 0000000000..8ce4d10b6e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_command_factory.cc
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/app_service_command_factory.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+
+namespace app_service_rpc_plugin {
+
+AppServiceCommandFactory::AppServiceCommandFactory(
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : hmi_command_factory_(new AppServiceHmiCommandFactory(
+ application_manager, rpc_service, hmi_capabilities, policy_handler))
+ , mobile_command_factory_(new AppServiceMobileCommandFactory(
+ application_manager, rpc_service, hmi_capabilities, policy_handler)) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+AppServiceCommandFactory::~AppServiceCommandFactory() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+app_mngr::CommandSharedPtr AppServiceCommandFactory::CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) {
+ if (app_mngr::commands::Command::SOURCE_HMI == source ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) {
+ return hmi_command_factory_->CreateCommand(message, source);
+ } else {
+ return mobile_command_factory_->CreateCommand(message, source);
+ }
+}
+
+bool AppServiceCommandFactory::IsAbleToProcess(
+ const int32_t function_id,
+ const commands::Command::CommandSource source) const {
+ LOG4CXX_DEBUG(logger_,
+ "AppServiceCommandFactory::IsAbleToProcess" << function_id
+ << " " << source);
+ return (commands::Command::SOURCE_HMI == source ||
+ commands::Command::SOURCE_SDL_TO_HMI == source)
+ ? hmi_command_factory_->IsAbleToProcess(function_id, source)
+ : mobile_command_factory_->IsAbleToProcess(function_id, source);
+}
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
new file mode 100644
index 0000000000..3090ea8ced
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
@@ -0,0 +1,198 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/app_service_hmi_command_factory.h"
+#include "application_manager/message.h"
+#include "interfaces/HMI_API.h"
+
+#include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h"
+#include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h"
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h"
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h"
+#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h"
+#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h"
+#include "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h"
+#include "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h"
+#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h"
+#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+
+namespace app_service_rpc_plugin {
+namespace strings = app_mngr::strings;
+
+AppServiceHmiCommandFactory::AppServiceHmiCommandFactory(
+ application_manager::ApplicationManager& application_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : application_manager_(application_manager)
+ , rpc_service_(rpc_service)
+ , hmi_capabilities_(hmi_capabilities)
+ , policy_handler_(policy_handler) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+app_mngr::CommandSharedPtr AppServiceHmiCommandFactory::CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) {
+ UNUSED(source);
+
+ const hmi_apis::FunctionID::eType function_id =
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*message)[strings::params][strings::function_id].asInt());
+
+ const hmi_apis::messageType::eType message_type =
+ static_cast<hmi_apis::messageType::eType>(
+ (*message)[strings::params][strings::message_type].asInt());
+
+ auto message_type_str = "request";
+ if (hmi_apis::messageType::response == message_type) {
+ message_type_str = "response";
+ } else if (hmi_apis::messageType::error_response == message_type) {
+ message_type_str = "error response";
+ } else if (hmi_apis::messageType::notification == message_type) {
+ message_type_str = "notification";
+ }
+
+ UNUSED(message_type_str);
+ LOG4CXX_DEBUG(logger_,
+ "HMICommandFactory::CreateCommand function_id: "
+ << function_id << ", message type: " << message_type_str);
+
+ return buildCommandCreator(function_id, message_type, source).create(message);
+}
+
+bool AppServiceHmiCommandFactory::IsAbleToProcess(
+ const int32_t function_id,
+ const app_mngr::commands::Command::CommandSource source) const {
+ LOG4CXX_DEBUG(logger_,
+ "HMI App Service Plugin IsAbleToProcess: " << function_id);
+ UNUSED(source);
+ return buildCommandCreator(
+ function_id, hmi_apis::messageType::INVALID_ENUM, source)
+ .CanBeCreated();
+}
+
+app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator(
+ const int32_t function_id,
+ const int32_t message_type,
+ const app_mngr::commands::Command::CommandSource source) const {
+ auto factory = app_mngr::CommandCreatorFactory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+
+ LOG4CXX_DEBUG(logger_,
+ "buildCommandCreator: " << function_id << " " << source);
+
+ switch (function_id) {
+ case hmi_apis::FunctionID::AppService_PublishAppService:
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::ASPublishAppServiceRequest>()
+ : factory.GetCreator<commands::ASPublishAppServiceResponse>();
+ case hmi_apis::FunctionID::AppService_UnpublishAppService:
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::ASUnpublishAppServiceRequest>()
+ : factory
+ .GetCreator<commands::ASUnpublishAppServiceResponse>();
+ case hmi_apis::FunctionID::AppService_OnAppServiceData:
+ return app_mngr::commands::Command::CommandSource::SOURCE_HMI == source
+ ? factory.GetCreator<
+ commands::OnASAppServiceDataNotificationFromHMI>()
+ : factory
+ .GetCreator<commands::OnASAppServiceDataNotification>();
+ case hmi_apis::FunctionID::AppService_GetAppServiceData:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_HMI == source) {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::ASGetAppServiceDataRequestFromHMI>()
+ : factory.GetCreator<
+ commands::ASGetAppServiceDataResponseFromHMI>();
+ } else if (app_mngr::commands::Command::CommandSource::
+ SOURCE_SDL_TO_HMI == source) {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::ASGetAppServiceDataRequestToHMI>()
+ : factory.GetCreator<
+ commands::ASGetAppServiceDataResponseToHMI>();
+ }
+ break;
+ case hmi_apis::FunctionID::AppService_GetAppServiceRecords:
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::ASGetAppServiceRecordsRequest>()
+ : factory
+ .GetCreator<commands::ASGetAppServiceRecordsResponse>();
+ case hmi_apis::FunctionID::AppService_AppServiceActivation:
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::ASAppServiceActivationRequest>()
+ : factory
+ .GetCreator<commands::ASAppServiceActivationResponse>();
+ case hmi_apis::FunctionID::AppService_PerformAppServiceInteraction:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_HMI == source) {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::
+ ASPerformAppServiceInteractionRequestFromHMI>()
+ : factory.GetCreator<
+ commands::
+ ASPerformAppServiceInteractionResponseFromHMI>();
+ } else if (app_mngr::commands::Command::CommandSource::
+ SOURCE_SDL_TO_HMI == source) {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::ASPerformAppServiceInteractionRequestToHMI>()
+ : factory.GetCreator<
+ commands::
+ ASPerformAppServiceInteractionResponseToHMI>();
+ }
+ break;
+ case hmi_apis::FunctionID::AppService_GetActiveServiceConsent:
+ return hmi_apis::messageType::request == message_type
+ ? factory
+ .GetCreator<commands::ASGetActiveServiceConsentRequest>()
+ : factory.GetCreator<
+ commands::ASGetActiveServiceConsentResponse>();
+ default:
+ LOG4CXX_WARN(logger_, "Unsupported HMI function_id: " << function_id);
+ }
+ return factory.GetCreator<app_mngr::InvalidCommand>();
+}
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
new file mode 100644
index 0000000000..5c44fb5fae
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
@@ -0,0 +1,177 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/app_service_mobile_command_factory.h"
+
+#include "application_manager/message.h"
+#include "interfaces/MOBILE_API.h"
+
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h"
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h"
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h"
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h"
+#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h"
+#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h"
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h"
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h"
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h"
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h"
+#include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h"
+#include "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h"
+#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h"
+#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+
+namespace app_service_rpc_plugin {
+namespace strings = app_mngr::strings;
+
+AppServiceMobileCommandFactory::AppServiceMobileCommandFactory(
+ application_manager::ApplicationManager& application_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : application_manager_(application_manager)
+ , rpc_service_(rpc_service)
+ , hmi_capabilities_(hmi_capabilities)
+ , policy_handler_(policy_handler) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+app_mngr::CommandSharedPtr AppServiceMobileCommandFactory::CreateCommand(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::commands::Command::CommandSource source) {
+ UNUSED(source);
+
+ const mobile_apis::FunctionID::eType function_id =
+ static_cast<mobile_apis::FunctionID::eType>(
+ (*message)[strings::params][strings::function_id].asInt());
+
+ const mobile_apis::messageType::eType message_type =
+ static_cast<mobile_apis::messageType::eType>(
+ (*message)[strings::params][strings::message_type].asInt());
+
+ auto message_type_str = "request";
+ if (mobile_apis::messageType::response == message_type) {
+ message_type_str = "response";
+ } else if (mobile_apis::messageType::notification == message_type) {
+ message_type_str = "notification";
+ }
+
+ UNUSED(message_type_str);
+ LOG4CXX_DEBUG(logger_,
+ "HMICommandFactory::CreateCommand function_id: "
+ << function_id << ", message type: " << message_type_str);
+
+ return buildCommandCreator(function_id, message_type, source).create(message);
+}
+
+bool AppServiceMobileCommandFactory::IsAbleToProcess(
+ const int32_t function_id,
+ const app_mngr::commands::Command::CommandSource source) const {
+ UNUSED(source);
+ return buildCommandCreator(
+ function_id, mobile_apis::messageType::INVALID_ENUM, source)
+ .CanBeCreated();
+}
+
+app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator(
+ const int32_t function_id,
+ const int32_t message_type,
+ const app_mngr::commands::Command::CommandSource source) const {
+ auto factory = app_mngr::CommandCreatorFactory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+
+ switch (function_id) {
+ case mobile_apis::FunctionID::PublishAppServiceID:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source &&
+ mobile_apis::messageType::response != message_type) {
+ return factory.GetCreator<commands::PublishAppServiceRequest>();
+ } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL ==
+ source &&
+ mobile_apis::messageType::request != message_type) {
+ return factory.GetCreator<commands::PublishAppServiceResponse>();
+ }
+ break;
+ case mobile_apis::FunctionID::UnpublishAppServiceID:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source &&
+ mobile_apis::messageType::response != message_type) {
+ return factory.GetCreator<commands::UnpublishAppServiceRequest>();
+ } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL ==
+ source &&
+ mobile_apis::messageType::request != message_type) {
+ return factory.GetCreator<commands::UnpublishAppServiceResponse>();
+ }
+ break;
+ case mobile_apis::FunctionID::OnAppServiceDataID:
+ return app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source
+ ? factory.GetCreator<
+ commands::OnAppServiceDataNotificationFromMobile>()
+ : factory.GetCreator<commands::OnAppServiceDataNotification>();
+ case mobile_apis::FunctionID::GetAppServiceDataID:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) {
+ return mobile_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::GetAppServiceDataRequest>()
+ : factory.GetCreator<
+ commands::GetAppServiceDataResponseFromMobile>();
+ } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL ==
+ source) {
+ return mobile_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::GetAppServiceDataRequestToMobile>()
+ : factory.GetCreator<commands::GetAppServiceDataResponse>();
+ }
+ break;
+ case mobile_apis::FunctionID::PerformAppServiceInteractionID:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) {
+ return mobile_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::PerformAppServiceInteractionRequest>()
+ : factory.GetCreator<
+ commands::
+ PerformAppServiceInteractionResponseFromMobile>();
+ } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL ==
+ source) {
+ return mobile_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::
+ PerformAppServiceInteractionRequestToMobile>()
+ : factory.GetCreator<
+ commands::PerformAppServiceInteractionResponse>();
+ }
+ break;
+ default:
+ LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id);
+ }
+ return factory.GetCreator<app_mngr::InvalidCommand>();
+}
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
new file mode 100644
index 0000000000..1c3a9c77c5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
@@ -0,0 +1,120 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "app_service_rpc_plugin/app_service_app_extension.h"
+#include "app_service_rpc_plugin/app_service_command_factory.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/plugin_manager/plugin_keys.h"
+#include "application_manager/smart_object_keys.h"
+
+namespace app_service_rpc_plugin {
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
+
+namespace strings = application_manager::strings;
+namespace plugins = application_manager::plugin_manager;
+
+AppServiceRpcPlugin::AppServiceRpcPlugin() : application_manager_(nullptr) {}
+
+bool AppServiceRpcPlugin::Init(
+ application_manager::ApplicationManager& app_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) {
+ UNUSED(last_state);
+ application_manager_ = &app_manager;
+ command_factory_.reset(new app_service_rpc_plugin::AppServiceCommandFactory(
+ app_manager, rpc_service, hmi_capabilities, policy_handler));
+ return true;
+}
+
+bool AppServiceRpcPlugin::Init(app_mngr::ApplicationManager& app_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state) {
+ UNUSED(last_state);
+ application_manager_ = &app_manager;
+ command_factory_.reset(new app_service_rpc_plugin::AppServiceCommandFactory(
+ app_manager, rpc_service, hmi_capabilities, policy_handler));
+ return true;
+}
+
+bool AppServiceRpcPlugin::IsAbleToProcess(
+ const int32_t function_id, const commands::Command::CommandSource source) {
+ return command_factory_->IsAbleToProcess(function_id, source);
+}
+
+std::string AppServiceRpcPlugin::PluginName() {
+ return plugins::plugin_names::app_service_rpc_plugin;
+}
+
+app_mngr::CommandFactory& AppServiceRpcPlugin::GetCommandFactory() {
+ return *command_factory_;
+}
+
+void AppServiceRpcPlugin::OnPolicyEvent(plugins::PolicyEvent event) {}
+
+void AppServiceRpcPlugin::OnApplicationEvent(
+ plugins::ApplicationEvent event,
+ app_mngr::ApplicationSharedPtr application) {
+ if (plugins::ApplicationEvent::kApplicationRegistered == event) {
+ application->AddExtension(
+ std::make_shared<AppServiceAppExtension>(*this, *application));
+ } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) {
+ DeleteSubscriptions(application);
+ }
+}
+
+void AppServiceRpcPlugin::DeleteSubscriptions(
+ application_manager::ApplicationSharedPtr app) {
+ auto& ext = AppServiceAppExtension::ExtractASExtension(*app);
+ auto subscriptions = ext.Subscriptions();
+ for (auto& service_type : subscriptions) {
+ ext.UnsubscribeFromAppService(service_type);
+ }
+}
+
+} // namespace app_service_rpc_plugin
+
+extern "C" __attribute__((visibility("default")))
+application_manager::plugin_manager::RPCPlugin*
+Create() {
+ return new app_service_rpc_plugin::AppServiceRpcPlugin();
+}
+
+extern "C" __attribute__((visibility("default"))) void Delete(
+ application_manager::plugin_manager::RPCPlugin* data) {
+ delete data;
+ DELETE_THREAD_LOGGER(app_service_rpc_plugin::logger_);
+}
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc
new file mode 100644
index 0000000000..fd7312ca98
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_request.cc
@@ -0,0 +1,89 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_request.h"
+
+#include "application_manager/app_service_manager.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASAppServiceActivationRequest::ASAppServiceActivationRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASAppServiceActivationRequest::~ASAppServiceActivationRequest() {}
+
+void ASAppServiceActivationRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AppServiceManager& service_manager =
+ application_manager_.GetAppServiceManager();
+ smart_objects::SmartObject params = (*message_)[strings::msg_params];
+ smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
+ std::string service_id = params[strings::service_id].asString();
+ response_params[strings::service_id] = service_id;
+ if (params[strings::activate].asBool()) {
+ response_params[strings::activate] =
+ service_manager.ActivateAppService(service_id);
+ } else {
+ service_manager.DeactivateAppService(service_id);
+ response_params[strings::activate] = false;
+ }
+
+ if (params.keyExists(strings::set_as_default)) {
+ if (params[strings::set_as_default].asBool()) {
+ response_params[strings::set_as_default] =
+ service_manager.SetDefaultService(service_id);
+ } else {
+ service_manager.RemoveDefaultService(service_id);
+ response_params[strings::set_as_default] = false;
+ }
+ }
+
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_AppServiceActivation,
+ hmi_apis::Common_Result::SUCCESS,
+ &response_params);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc
new file mode 100644
index 0000000000..c77d3ed381
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_app_service_activation_response.cc
@@ -0,0 +1,59 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_app_service_activation_response.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASAppServiceActivationResponse::ASAppServiceActivationResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASAppServiceActivationResponse::~ASAppServiceActivationResponse() {}
+
+void ASAppServiceActivationResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc
new file mode 100644
index 0000000000..b1f3d6fdbf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_request.cc
@@ -0,0 +1,59 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_request.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetActiveServiceConsentRequest::ASGetActiveServiceConsentRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetActiveServiceConsentRequest::~ASGetActiveServiceConsentRequest() {}
+
+void ASGetActiveServiceConsentRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc
new file mode 100644
index 0000000000..038c2922ad
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_active_service_consent_response.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_get_active_service_consent_response.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetActiveServiceConsentResponse::ASGetActiveServiceConsentResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetActiveServiceConsentResponse::~ASGetActiveServiceConsentResponse() {}
+
+void ASGetActiveServiceConsentResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ event_engine::Event event(
+ hmi_apis::FunctionID::AppService_GetActiveServiceConsent);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc
new file mode 100644
index 0000000000..e03c0ad15a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc
@@ -0,0 +1,289 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/enum_schema_item.h"
+
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceDataRequestFromHMI::ASGetAppServiceDataRequestFromHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetAppServiceDataRequestFromHMI::~ASGetAppServiceDataRequestFromHMI() {}
+
+void ASGetAppServiceDataRequestFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string service_type =
+ (*message_)[strings::msg_params][strings::service_type].asString();
+
+ LOG4CXX_DEBUG(logger_, "Get Service Type: " << service_type);
+
+ SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID,
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ &(*message_),
+ true);
+}
+
+void ASGetAppServiceDataRequestFromHMI::GetWeatherImagePaths(
+ smart_objects::SmartObject& data, ApplicationSharedPtr app) {
+ if (data[strings::location].keyExists(strings::location_image)) {
+ MessageHelper::VerifyImage(data[strings::location][strings::location_image],
+ app,
+ application_manager_);
+ }
+
+ if (data.keyExists(strings::current_forecast) &&
+ data[strings::current_forecast].keyExists(strings::weather_icon)) {
+ MessageHelper::VerifyImage(
+ data[strings::current_forecast][strings::weather_icon],
+ app,
+ application_manager_);
+ }
+
+ if (data.keyExists(strings::minute_forecast)) {
+ smart_objects::SmartObject& minute_forecast =
+ data[strings::minute_forecast];
+ for (size_t i = 0; i < minute_forecast.length(); i++) {
+ if (minute_forecast[i].keyExists(strings::weather_icon)) {
+ MessageHelper::VerifyImage(minute_forecast[i][strings::weather_icon],
+ app,
+ application_manager_);
+ }
+ }
+ }
+
+ if (data.keyExists(strings::hourly_forecast)) {
+ smart_objects::SmartObject& hourly_forecast =
+ data[strings::hourly_forecast];
+ for (size_t i = 0; i < hourly_forecast.length(); i++) {
+ if (hourly_forecast[i].keyExists(strings::weather_icon)) {
+ MessageHelper::VerifyImage(hourly_forecast[i][strings::weather_icon],
+ app,
+ application_manager_);
+ }
+ }
+ }
+
+ if (data.keyExists(strings::multiday_forecast)) {
+ smart_objects::SmartObject& multiday_forecast =
+ data[strings::multiday_forecast];
+ for (size_t i = 0; i < multiday_forecast.length(); i++) {
+ if (multiday_forecast[i].keyExists(strings::weather_icon)) {
+ MessageHelper::VerifyImage(multiday_forecast[i][strings::weather_icon],
+ app,
+ application_manager_);
+ }
+ }
+ }
+}
+
+void ASGetAppServiceDataRequestFromHMI::GetNavigationImagePaths(
+ smart_objects::SmartObject& data, ApplicationSharedPtr app) {
+ if (data.keyExists(strings::origin) &&
+ data[strings::origin].keyExists(strings::location_image)) {
+ MessageHelper::VerifyImage(data[strings::origin][strings::location_image],
+ app,
+ application_manager_);
+ }
+
+ if (data.keyExists(strings::destination) &&
+ data[strings::destination].keyExists(strings::location_image)) {
+ MessageHelper::VerifyImage(
+ data[strings::destination][strings::location_image],
+ app,
+ application_manager_);
+ }
+
+ if (data.keyExists(strings::instructions)) {
+ smart_objects::SmartObject& instructions = data[strings::instructions];
+ for (size_t i = 0; i < instructions.length(); i++) {
+ if (instructions[i].keyExists(strings::image)) {
+ MessageHelper::VerifyImage(
+ instructions[i][strings::image], app, application_manager_);
+ }
+
+ if (instructions[i].keyExists(strings::location_details) &&
+ instructions[i][strings::location_details].keyExists(
+ strings::location_image)) {
+ MessageHelper::VerifyImage(
+ instructions[i][strings::location_details][strings::location_image],
+ app,
+ application_manager_);
+ }
+ }
+ }
+}
+
+void ASGetAppServiceDataRequestFromHMI::GetMediaImagePaths(
+ smart_objects::SmartObject& data, ApplicationSharedPtr app) {
+ if (data.keyExists(strings::media_image)) {
+ MessageHelper::VerifyImage(
+ data[strings::media_image], app, application_manager_);
+ }
+}
+
+bool ASGetAppServiceDataRequestFromHMI::ValidateResponse(
+ smart_objects::SmartObject& message_params) {
+ if (!message_params.keyExists(strings::service_data)) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "GASD response received without any service data, passing through");
+ return true;
+ }
+ smart_objects::SmartObject& service_data =
+ message_params[strings::service_data];
+ std::string service_type = service_data[strings::service_type].asString();
+ mobile_apis::AppServiceType::eType service_type_value;
+ const std::string& service_id = service_data[strings::service_id].asString();
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service) {
+ LOG4CXX_ERROR(logger_,
+ "GASD response received with an unpublished service ID");
+ SendErrorResponse(
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ hmi_apis::Common_Result::GENERIC_ERROR,
+ "The provider responded with incorrect data",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return false;
+ }
+
+ using namespace ns_smart_device_link::ns_smart_objects;
+ if (service && service->mobile_service &&
+ EnumConversionHelper<mobile_apis::AppServiceType::eType>::StringToEnum(
+ service_type, &service_type_value)) {
+ auto app = application_manager_.application(service->connection_key);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to find service provider for GASD response");
+ SendErrorResponse(
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ hmi_apis::Common_Result::GENERIC_ERROR,
+ "The provider responded with incorrect data",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return false;
+ }
+
+ if (service_type_value == mobile_apis::AppServiceType::WEATHER &&
+ service_data.keyExists(strings::weather_service_data)) {
+ GetWeatherImagePaths(service_data[strings::weather_service_data], app);
+ }
+
+ if (service_type_value == mobile_apis::AppServiceType::NAVIGATION &&
+ service_data.keyExists(strings::navigation_service_data)) {
+ GetNavigationImagePaths(service_data[strings::navigation_service_data],
+ app);
+ }
+
+ if (service_type_value == mobile_apis::AppServiceType::MEDIA &&
+ service_data.keyExists(strings::media_service_data)) {
+ GetMediaImagePaths(service_data[strings::media_service_data], app);
+ }
+ }
+ return true;
+}
+
+void ASGetAppServiceDataRequestFromHMI::on_event(
+ const event_engine::Event& event) {
+ smart_objects::SmartObject event_message(event.smart_object());
+
+ auto& msg_params = event_message[strings::msg_params];
+
+ hmi_apis::Common_Result::eType result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ event_message[strings::params][hmi_response::code].asInt());
+ bool success =
+ IsHMIResultSuccess(result, HmiInterfaces::HMI_INTERFACE_AppService);
+ if (ValidateResponse(msg_params)) {
+ SendResponse(success,
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ result,
+ &msg_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ }
+}
+
+void ASGetAppServiceDataRequestFromHMI::on_event(
+ const event_engine::MobileEvent& event) {
+ smart_objects::SmartObject event_message(event.smart_object());
+
+ auto& msg_params = event_message[strings::msg_params];
+
+ mobile_apis::Result::eType mobile_result =
+ static_cast<mobile_apis::Result::eType>(
+ msg_params[strings::result_code].asInt());
+ hmi_apis::Common_Result::eType result =
+ MessageHelper::MobileToHMIResult(mobile_result);
+ bool success = IsMobileResultSuccess(mobile_result);
+
+ if (ValidateResponse(msg_params)) {
+ SendResponse(success,
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ result,
+ &msg_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ }
+}
+
+void ASGetAppServiceDataRequestFromHMI::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendErrorResponse(correlation_id(),
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ hmi_apis::Common_Result::GENERIC_ERROR,
+ "The provider did not respond to the request",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc
new file mode 100644
index 0000000000..635cd7319a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_to_hmi.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_to_hmi.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceDataRequestToHMI::ASGetAppServiceDataRequestToHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetAppServiceDataRequestToHMI::~ASGetAppServiceDataRequestToHMI() {}
+
+void ASGetAppServiceDataRequestToHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc
new file mode 100644
index 0000000000..c0b1b274fb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_from_hmi.cc
@@ -0,0 +1,67 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_from_hmi.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/HMI_API.h"
+
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceDataResponseFromHMI::ASGetAppServiceDataResponseFromHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetAppServiceDataResponseFromHMI::~ASGetAppServiceDataResponseFromHMI() {}
+
+void ASGetAppServiceDataResponseFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(hmi_apis::FunctionID::AppService_GetAppServiceData);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc
new file mode 100644
index 0000000000..b489ec4765
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_response_to_hmi.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_data_response_to_hmi.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceDataResponseToHMI::ASGetAppServiceDataResponseToHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetAppServiceDataResponseToHMI::~ASGetAppServiceDataResponseToHMI() {}
+
+void ASGetAppServiceDataResponseToHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc
new file mode 100644
index 0000000000..fa704c1995
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_request.h"
+
+#include "application_manager/app_service_manager.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceRecordsRequest::ASGetAppServiceRecordsRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetAppServiceRecordsRequest::~ASGetAppServiceRecordsRequest() {}
+
+void ASGetAppServiceRecordsRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::string type;
+ if ((*message_)[strings::msg_params].keyExists(strings::service_type)) {
+ type = (*message_)[strings::msg_params][strings::service_type].asString();
+ }
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject records =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ std::vector<smart_objects::SmartObject> service_records =
+ application_manager_.GetAppServiceManager().GetAllServiceRecords();
+
+ int index = 0;
+ for (auto& record : service_records) {
+ if (!type.empty() &&
+ record[strings::service_manifest][strings::service_type].asString() !=
+ type) {
+ continue;
+ }
+ records[index] = record;
+ index++;
+ }
+
+ if (!records.empty()) {
+ response_params[strings::service_records] = records;
+ }
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_GetAppServiceRecords,
+ hmi_apis::Common_Result::SUCCESS,
+ &response_params);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc
new file mode 100644
index 0000000000..0479aa8d31
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_response.cc
@@ -0,0 +1,59 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_get_app_service_records_response.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASGetAppServiceRecordsResponse::ASGetAppServiceRecordsResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASGetAppServiceRecordsResponse::~ASGetAppServiceRecordsResponse() {}
+
+void ASGetAppServiceRecordsResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
new file mode 100644
index 0000000000..6499b08c28
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc
@@ -0,0 +1,164 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPerformAppServiceInteractionRequestFromHMI::
+ ASPerformAppServiceInteractionRequestFromHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASPerformAppServiceInteractionRequestFromHMI::
+ ~ASPerformAppServiceInteractionRequestFromHMI() {}
+
+void ASPerformAppServiceInteractionRequestFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
+ std::string hmi_origin_id =
+ application_manager_.get_settings().hmi_origin_id();
+ if (!msg_params.keyExists(strings::origin_app)) {
+ if (hmi_origin_id.empty()) {
+ SendErrorResponse(
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ hmi_apis::Common_Result::INVALID_DATA,
+ "No HMI origin ID to use for interaction passthrough",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+ msg_params[strings::origin_app] = hmi_origin_id;
+ }
+
+ std::string service_id = msg_params[strings::service_id].asString();
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service) {
+ SendErrorResponse(
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ hmi_apis::Common_Result::INVALID_ID,
+ "The requested service ID does not exist",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ bool request_service_active = false;
+ if (msg_params.keyExists(strings::request_service_active)) {
+ request_service_active =
+ msg_params[strings::request_service_active].asBool();
+ msg_params.erase(strings::request_service_active);
+ }
+
+ // Only activate service if it is not already active
+ bool activate_service = request_service_active &&
+ !service->record[strings::service_active].asBool();
+ if (activate_service) {
+ application_manager_.GetAppServiceManager().ActivateAppService(service_id);
+ }
+
+ SendProviderRequest(
+ mobile_apis::FunctionID::PerformAppServiceInteractionID,
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ &(*message_),
+ true);
+}
+
+void ASPerformAppServiceInteractionRequestFromHMI::on_event(
+ const event_engine::Event& event) {
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ hmi_apis::Common_Result::eType result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ event_message[strings::params][hmi_response::code].asInt());
+ bool success =
+ IsHMIResultSuccess(result, HmiInterfaces::HMI_INTERFACE_AppService);
+ SendResponse(success,
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ result,
+ &msg_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+void ASPerformAppServiceInteractionRequestFromHMI::on_event(
+ const event_engine::MobileEvent& event) {
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ mobile_apis::Result::eType mobile_result =
+ static_cast<mobile_apis::Result::eType>(
+ msg_params[strings::result_code].asInt());
+ hmi_apis::Common_Result::eType result =
+ MessageHelper::MobileToHMIResult(mobile_result);
+ bool success = IsMobileResultSuccess(mobile_result);
+ SendResponse(success,
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ result,
+ &msg_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+void ASPerformAppServiceInteractionRequestFromHMI::onTimeOut() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject response_params;
+ response_params[strings::info] =
+ "The provider did not respond to the request";
+ SendErrorResponse(
+ correlation_id(),
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ hmi_apis::Common_Result::GENERIC_ERROR,
+ "The provider did not respond to the request",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc
new file mode 100644
index 0000000000..22876328de
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_to_hmi.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPerformAppServiceInteractionRequestToHMI::
+ ASPerformAppServiceInteractionRequestToHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASPerformAppServiceInteractionRequestToHMI::
+ ~ASPerformAppServiceInteractionRequestToHMI() {}
+
+void ASPerformAppServiceInteractionRequestToHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc
new file mode 100644
index 0000000000..a2ffa65a73
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_from_hmi.cc
@@ -0,0 +1,64 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPerformAppServiceInteractionResponseFromHMI::
+ ASPerformAppServiceInteractionResponseFromHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASPerformAppServiceInteractionResponseFromHMI::
+ ~ASPerformAppServiceInteractionResponseFromHMI() {}
+
+void ASPerformAppServiceInteractionResponseFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ event_engine::Event event(
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc
new file mode 100644
index 0000000000..5ddef55c2a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_response_to_hmi.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPerformAppServiceInteractionResponseToHMI::
+ ASPerformAppServiceInteractionResponseToHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASPerformAppServiceInteractionResponseToHMI::
+ ~ASPerformAppServiceInteractionResponseToHMI() {}
+
+void ASPerformAppServiceInteractionResponseToHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc
new file mode 100644
index 0000000000..35a3e8a6b3
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_request.cc
@@ -0,0 +1,86 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPublishAppServiceRequest::ASPublishAppServiceRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASPublishAppServiceRequest::~ASPublishAppServiceRequest() {}
+
+void ASPublishAppServiceRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Received a PublishAppService request from HMI");
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject manifest =
+ (*message_)[strings::msg_params][strings::app_service_manifest];
+ smart_objects::SmartObject service_record =
+ application_manager_.GetAppServiceManager().PublishAppService(manifest,
+ false);
+ if (service_record.empty()) {
+ SendErrorResponse(
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_PublishAppService,
+ hmi_apis::Common_Result::REJECTED,
+ "Failed to publish service",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ response_params[strings::app_service_record] = service_record;
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_PublishAppService,
+ hmi_apis::Common_Result::SUCCESS,
+ &response_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc
new file mode 100644
index 0000000000..c143315b8c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_publish_app_service_response.cc
@@ -0,0 +1,60 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h"
+#include "application_manager/message_helper.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASPublishAppServiceResponse::ASPublishAppServiceResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASPublishAppServiceResponse::~ASPublishAppServiceResponse() {}
+
+void ASPublishAppServiceResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc
new file mode 100644
index 0000000000..30905b5fa2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc
@@ -0,0 +1,97 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASUnpublishAppServiceRequest::ASUnpublishAppServiceRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASUnpublishAppServiceRequest::~ASUnpublishAppServiceRequest() {}
+
+void ASUnpublishAppServiceRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_id].asString();
+
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service || service->mobile_service) {
+ SendErrorResponse(
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_UnpublishAppService,
+ hmi_apis::Common_Result::INVALID_ID,
+ "Invalid Service ID",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ bool ret = application_manager_.GetAppServiceManager().UnpublishAppService(
+ service_id);
+
+ if (!ret) {
+ SendErrorResponse(
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_UnpublishAppService,
+ hmi_apis::Common_Result::REJECTED,
+ "The app service with that requested service ID does not exist",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_UnpublishAppService,
+ hmi_apis::Common_Result::SUCCESS,
+ NULL,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc
new file mode 100644
index 0000000000..0c8b479da8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASUnpublishAppServiceResponse::ASUnpublishAppServiceResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASUnpublishAppServiceResponse::~ASUnpublishAppServiceResponse() {}
+
+void ASUnpublishAppServiceResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc
new file mode 100644
index 0000000000..db1716ecb8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc
@@ -0,0 +1,215 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/enum_schema_item.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+OnASAppServiceDataNotification::OnASAppServiceDataNotification(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : NotificationToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnASAppServiceDataNotification::~OnASAppServiceDataNotification() {}
+
+void OnASAppServiceDataNotification::GetMediaImagePaths(
+ smart_objects::SmartObject& data, ApplicationSharedPtr app) {
+ if (data.keyExists(strings::media_image)) {
+ MessageHelper::VerifyImage(
+ data[strings::media_image], app, application_manager_);
+ }
+}
+
+void OnASAppServiceDataNotification::GetWeatherImagePaths(
+ smart_objects::SmartObject& data, ApplicationSharedPtr app) {
+ if (data[strings::location].keyExists(strings::location_image)) {
+ MessageHelper::VerifyImage(data[strings::location][strings::location_image],
+ app,
+ application_manager_);
+ }
+
+ if (data.keyExists(strings::current_forecast) &&
+ data[strings::current_forecast].keyExists(strings::weather_icon)) {
+ MessageHelper::VerifyImage(
+ data[strings::current_forecast][strings::weather_icon],
+ app,
+ application_manager_);
+ }
+
+ if (data.keyExists(strings::minute_forecast)) {
+ smart_objects::SmartObject& minute_forecast =
+ data[strings::minute_forecast];
+ for (size_t i = 0; i < minute_forecast.length(); i++) {
+ if (minute_forecast[i].keyExists(strings::weather_icon)) {
+ MessageHelper::VerifyImage(minute_forecast[i][strings::weather_icon],
+ app,
+ application_manager_);
+ }
+ }
+ }
+
+ if (data.keyExists(strings::hourly_forecast)) {
+ smart_objects::SmartObject& hourly_forecast =
+ data[strings::hourly_forecast];
+ for (size_t i = 0; i < hourly_forecast.length(); i++) {
+ if (hourly_forecast[i].keyExists(strings::weather_icon)) {
+ MessageHelper::VerifyImage(hourly_forecast[i][strings::weather_icon],
+ app,
+ application_manager_);
+ }
+ }
+ }
+
+ if (data.keyExists(strings::multiday_forecast)) {
+ smart_objects::SmartObject& multiday_forecast =
+ data[strings::multiday_forecast];
+ for (size_t i = 0; i < multiday_forecast.length(); i++) {
+ if (multiday_forecast[i].keyExists(strings::weather_icon)) {
+ MessageHelper::VerifyImage(multiday_forecast[i][strings::weather_icon],
+ app,
+ application_manager_);
+ }
+ }
+ }
+}
+
+void OnASAppServiceDataNotification::GetNavigationImagePaths(
+ smart_objects::SmartObject& data, ApplicationSharedPtr app) {
+ if (data.keyExists(strings::origin) &&
+ data[strings::origin].keyExists(strings::location_image)) {
+ MessageHelper::VerifyImage(data[strings::origin][strings::location_image],
+ app,
+ application_manager_);
+ }
+
+ if (data.keyExists(strings::destination) &&
+ data[strings::destination].keyExists(strings::location_image)) {
+ MessageHelper::VerifyImage(
+ data[strings::destination][strings::location_image],
+ app,
+ application_manager_);
+ }
+
+ if (data.keyExists(strings::instructions)) {
+ smart_objects::SmartObject& instructions = data[strings::instructions];
+ for (size_t i = 0; i < instructions.length(); i++) {
+ if (instructions[i].keyExists(strings::image)) {
+ MessageHelper::VerifyImage(
+ instructions[i][strings::image], app, application_manager_);
+ }
+
+ if (instructions[i].keyExists(strings::location_details) &&
+ instructions[i][strings::location_details].keyExists(
+ strings::location_image)) {
+ MessageHelper::VerifyImage(
+ instructions[i][strings::location_details][strings::location_image],
+ app,
+ application_manager_);
+ }
+ }
+ }
+}
+
+bool OnASAppServiceDataNotification::ValidateParams(
+ smart_objects::SmartObject& message_params) {
+ if (!message_params.keyExists(strings::service_data)) {
+ LOG4CXX_DEBUG(logger_,
+ "OASD notification received without any service data");
+ return false;
+ }
+ smart_objects::SmartObject& service_data =
+ message_params[strings::service_data];
+ std::string service_type = service_data[strings::service_type].asString();
+ mobile_apis::AppServiceType::eType service_type_value;
+ const std::string& service_id = service_data[strings::service_id].asString();
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service) {
+ LOG4CXX_ERROR(logger_,
+ "OASD notification received with an unpublished service ID");
+ return false;
+ }
+
+ using namespace ns_smart_device_link::ns_smart_objects;
+ if (service && service->mobile_service &&
+ EnumConversionHelper<mobile_apis::AppServiceType::eType>::StringToEnum(
+ service_type, &service_type_value)) {
+ auto app = application_manager_.application(service->connection_key);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to find service provider for OASD message");
+ return false;
+ }
+
+ if (service_type_value == mobile_apis::AppServiceType::WEATHER &&
+ service_data.keyExists(strings::weather_service_data)) {
+ GetWeatherImagePaths(service_data[strings::weather_service_data], app);
+ }
+
+ if (service_type_value == mobile_apis::AppServiceType::NAVIGATION &&
+ service_data.keyExists(strings::navigation_service_data)) {
+ GetNavigationImagePaths(service_data[strings::navigation_service_data],
+ app);
+ }
+
+ if (service_type_value == mobile_apis::AppServiceType::MEDIA &&
+ service_data.keyExists(strings::media_service_data)) {
+ GetMediaImagePaths(service_data[strings::media_service_data], app);
+ }
+ }
+ return true;
+}
+
+void OnASAppServiceDataNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Sending AS data to HMI");
+ if (ValidateParams((*message_)[strings::msg_params])) {
+ SendNotification();
+ }
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc
new file mode 100644
index 0000000000..1c73fc73f4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification_from_hmi.cc
@@ -0,0 +1,99 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h"
+
+#include "application_manager/app_service_manager.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+OnASAppServiceDataNotificationFromHMI::OnASAppServiceDataNotificationFromHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : NotificationFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnASAppServiceDataNotificationFromHMI::
+ ~OnASAppServiceDataNotificationFromHMI() {}
+
+void OnASAppServiceDataNotificationFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData from HMI");
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_id]
+ .asString();
+ AppService* service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service) {
+ LOG4CXX_ERROR(
+ logger_, "No published services exist with service ID: " << service_id);
+ return;
+ } else if (service->mobile_service) {
+ LOG4CXX_ERROR(logger_, "Service was not published by the HMI");
+ return;
+ } else if (!service->record[strings::service_active].asBool()) {
+ LOG4CXX_ERROR(logger_, "Service is not active");
+ return;
+ }
+
+ std::string service_type =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_type]
+ .asString();
+ std::string published_service_type =
+ service->record[strings::service_manifest][strings::service_type]
+ .asString();
+ if (published_service_type != service_type) {
+ LOG4CXX_ERROR(logger_,
+ "Service type mismatch, expected "
+ << service_type
+ << ", but service was published with type "
+ << published_service_type);
+ return;
+ }
+
+ SendNotificationToConsumers(
+ mobile_apis::FunctionID::eType::OnAppServiceDataID);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
new file mode 100644
index 0000000000..e3bf40308d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc
@@ -0,0 +1,134 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h"
+#include "app_service_rpc_plugin/app_service_app_extension.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/enum_schema_item.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetAppServiceDataRequest::GetAppServiceDataRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetAppServiceDataRequest::~GetAppServiceDataRequest() {}
+
+void GetAppServiceDataRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SendProviderRequest(mobile_apis::FunctionID::GetAppServiceDataID,
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ &(*message_),
+ true);
+}
+
+bool GetAppServiceDataRequest::Init() {
+ hash_update_mode_ = HashUpdateMode::kDoHashUpdate;
+ return true;
+}
+
+void GetAppServiceDataRequest::HandleSubscribe() {
+ std::string service_type =
+ (*message_)[strings::msg_params][strings::service_type].asString();
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ if (app && (*message_)[strings::msg_params].keyExists(strings::subscribe)) {
+ bool subscribe =
+ (*message_)[strings::msg_params][strings::subscribe].asBool();
+ auto& ext = AppServiceAppExtension::ExtractASExtension(*app);
+ if (subscribe) {
+ ext.SubscribeToAppService(service_type);
+ } else {
+ ext.UnsubscribeFromAppService(service_type);
+ }
+ }
+}
+
+void GetAppServiceDataRequest::on_event(
+ const event_engine::MobileEvent& event) {
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ mobile_apis::Result::eType result = static_cast<mobile_apis::Result::eType>(
+ msg_params[strings::result_code].asInt());
+ bool success = IsMobileResultSuccess(result);
+ if (success) {
+ HandleSubscribe();
+ }
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(success, result, info, &msg_params);
+}
+
+void GetAppServiceDataRequest::on_event(const event_engine::Event& event) {
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ event_message[strings::params][hmi_response::code].asInt());
+
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_AppService);
+ if (success) {
+ HandleSubscribe();
+ }
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(success, result, info, &msg_params);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc
new file mode 100644
index 0000000000..0af1a5436b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request_to_mobile.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_request_to_mobile.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetAppServiceDataRequestToMobile::GetAppServiceDataRequestToMobile(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestToMobile(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetAppServiceDataRequestToMobile::~GetAppServiceDataRequestToMobile() {}
+
+void GetAppServiceDataRequestToMobile::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc
new file mode 100644
index 0000000000..32ad8e014d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetAppServiceDataResponse::GetAppServiceDataResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetAppServiceDataResponse::~GetAppServiceDataResponse() {}
+
+void GetAppServiceDataResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc
new file mode 100644
index 0000000000..90fca04eb2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_response_from_mobile.cc
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/get_app_service_data_response_from_mobile.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetAppServiceDataResponseFromMobile::GetAppServiceDataResponseFromMobile(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseFromMobile(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetAppServiceDataResponseFromMobile::~GetAppServiceDataResponseFromMobile() {}
+
+void GetAppServiceDataResponseFromMobile::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::MobileEvent event(mobile_apis::FunctionID::GetAppServiceDataID);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc
new file mode 100644
index 0000000000..1ffe99462d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification.cc
@@ -0,0 +1,123 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h"
+
+#include "app_service_rpc_plugin/app_service_app_extension.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/helpers/application_helper.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+#include "smart_objects/enum_schema_item.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+OnAppServiceDataNotification::OnAppServiceDataNotification(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandNotificationImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnAppServiceDataNotification::~OnAppServiceDataNotification() {}
+
+void OnAppServiceDataNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Sending OnAppServiceData to consumer");
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_id]
+ .asString();
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+
+ if (!service) {
+ LOG4CXX_ERROR(logger_, "Service sending OnAppServiceData is not published");
+ return;
+ } else if (!service
+ ->record[strings::service_manifest]
+ [strings::allow_app_consumers]
+ .asBool()) {
+ LOG4CXX_ERROR(logger_,
+ "Service does not allow for app consumers, skipping mobile "
+ "OnAppServiceData notification");
+ return;
+ }
+
+ std::string service_type =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_type]
+ .asString();
+
+ auto subscribed_to_app_service_predicate =
+ [service_type](const ApplicationSharedPtr app) {
+ DCHECK_OR_RETURN(app, false);
+ auto& ext = AppServiceAppExtension::ExtractASExtension(*app);
+ LOG4CXX_DEBUG(logger_, "Check subscription for type: " << service_type);
+ return ext.IsSubscribedToAppService(service_type);
+ };
+
+ const std::vector<ApplicationSharedPtr>& applications =
+ application_manager::FindAllApps(application_manager_.applications(),
+ subscribed_to_app_service_predicate);
+
+ std::vector<ApplicationSharedPtr>::const_iterator app_it =
+ applications.begin();
+
+ for (; applications.end() != app_it; ++app_it) {
+ const ApplicationSharedPtr app = *app_it;
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "NULL pointer");
+ continue;
+ }
+ LOG4CXX_DEBUG(logger_,
+ "Sending OnAppServiceDataNotification to mobile connection: "
+ << app->app_id());
+ (*message_)[app_mngr::strings::params][app_mngr::strings::connection_key] =
+ app->app_id();
+ SendNotification();
+ }
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
new file mode 100644
index 0000000000..5caacc9801
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/on_app_service_data_notification_from_mobile.cc
@@ -0,0 +1,119 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification_from_mobile.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+OnAppServiceDataNotificationFromMobile::OnAppServiceDataNotificationFromMobile(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandNotificationFromMobileImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnAppServiceDataNotificationFromMobile::
+ ~OnAppServiceDataNotificationFromMobile() {}
+
+void OnAppServiceDataNotificationFromMobile::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Received an OnAppServiceData");
+ MessageHelper::PrintSmartObject(*message_);
+
+ uint32_t app_connection_key = connection_key();
+ std::string service_type =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_type]
+ .asString();
+
+ ApplicationSharedPtr app =
+ application_manager_.application(app_connection_key);
+
+ bool result = policy_handler_.CheckAppServiceParameters(
+ app->policy_app_id(), std::string(), service_type, NULL);
+
+ if (!result) {
+ LOG4CXX_DEBUG(logger_,
+ "Incorrect service type received in "
+ "OnAppServiceDataNotificationFromMobile");
+ return;
+ }
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_data]
+ [strings::service_id]
+ .asString();
+ AppService* service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service) {
+ LOG4CXX_ERROR(
+ logger_, "No published services exist with service ID: " << service_id);
+ return;
+ } else if (!service->mobile_service ||
+ service->connection_key != app_connection_key) {
+ LOG4CXX_ERROR(logger_, "Service was not published by this application");
+ return;
+ } else if (!service->record[strings::service_active].asBool()) {
+ LOG4CXX_ERROR(logger_, "Service is not active");
+ return;
+ }
+
+ std::string published_service_type =
+ service->record[strings::service_manifest][strings::service_type]
+ .asString();
+ if (published_service_type != service_type) {
+ LOG4CXX_ERROR(logger_,
+ "Service type mismatch, expected "
+ << service_type
+ << ", but service was published with type "
+ << published_service_type);
+ return;
+ }
+
+ SendNotificationToConsumers(
+ hmi_apis::FunctionID::eType::AppService_OnAppServiceData);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
new file mode 100644
index 0000000000..63b6e47d8e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc
@@ -0,0 +1,188 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PerformAppServiceInteractionRequest::PerformAppServiceInteractionRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+PerformAppServiceInteractionRequest::~PerformAppServiceInteractionRequest() {}
+
+void PerformAppServiceInteractionRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto app = application_manager_.application(connection_key());
+ if (!app) {
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
+ std::string service_id = msg_params[strings::service_id].asString();
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service) {
+ SendResponse(false,
+ mobile_apis::Result::INVALID_ID,
+ "The requested service ID does not exist");
+ return;
+ }
+
+ if (!service->record[strings::service_manifest][strings::allow_app_consumers]
+ .asBool()) {
+ SendResponse(
+ false,
+ mobile_apis::Result::REJECTED,
+ "The requested service ID does not allow mobile app consumers");
+ return;
+ }
+
+ bool request_service_active = false;
+ if (msg_params.keyExists(strings::request_service_active)) {
+ request_service_active =
+ msg_params[strings::request_service_active].asBool();
+ msg_params.erase(strings::request_service_active);
+ }
+
+ // Only activate service if it is not already active
+ bool activate_service = request_service_active &&
+ !service->record[strings::service_active].asBool();
+ if (activate_service) {
+ if (app->IsFullscreen()) {
+ // App is in foreground, we can just activate the service
+ application_manager_.GetAppServiceManager().ActivateAppService(
+ service_id);
+ } else {
+ // App is not in foreground, we need to prompt the user to activate the
+ // service
+ smart_objects::SmartObject request_params;
+ request_params[strings::service_id] = service_id;
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
+ SendHMIRequest(hmi_apis::FunctionID::AppService_GetActiveServiceConsent,
+ &request_params,
+ true);
+ return;
+ }
+ }
+
+ SendProviderRequest(
+ mobile_apis::FunctionID::PerformAppServiceInteractionID,
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ &(*message_),
+ true);
+}
+
+void PerformAppServiceInteractionRequest::on_event(
+ const event_engine::Event& event) {
+ LOG4CXX_DEBUG(logger_, "HMI PerformAppServiceInteraction on_event");
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ event_message[strings::params][hmi_response::code].asInt());
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_AppService);
+
+ switch (event.id()) {
+ case hmi_apis::FunctionID::AppService_PerformAppServiceInteraction:
+ SendResponse(success, result, info, &msg_params);
+ break;
+ case hmi_apis::FunctionID::AppService_GetActiveServiceConsent:
+ if (msg_params[strings::activate].asBool()) {
+ // User agreed to activate service, we can now send the provider request
+ application_manager_.GetAppServiceManager().ActivateAppService(
+ (*message_)[strings::msg_params][strings::service_id].asString());
+ SendProviderRequest(
+ mobile_apis::FunctionID::PerformAppServiceInteractionID,
+ hmi_apis::FunctionID::AppService_PerformAppServiceInteraction,
+ &(*message_),
+ true);
+ } else if (mobile_apis::Result::SUCCESS == result) {
+ // Request was successful, but user denied the request to activate the
+ // service
+ SendResponse(false,
+ mobile_apis::Result::USER_DISALLOWED,
+ "Request to activate service was denied by driver");
+ } else {
+ SendResponse(success, result, info);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void PerformAppServiceInteractionRequest::on_event(
+ const event_engine::MobileEvent& event) {
+ LOG4CXX_DEBUG(logger_, "Mobile PerformAppServiceInteraction on_event");
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ auto msg_params = event_message[strings::msg_params];
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+ mobile_apis::Result::eType result = static_cast<mobile_apis::Result::eType>(
+ msg_params[strings::result_code].asInt());
+ bool success = IsMobileResultSuccess(result);
+
+ SendResponse(success, result, info, &msg_params);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc
new file mode 100644
index 0000000000..2a7b644cb3
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request_to_mobile.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request_to_mobile.h"
+#include "application_manager/application_impl.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PerformAppServiceInteractionRequestToMobile::
+ PerformAppServiceInteractionRequestToMobile(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestToMobile(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+PerformAppServiceInteractionRequestToMobile::
+ ~PerformAppServiceInteractionRequestToMobile() {}
+
+void PerformAppServiceInteractionRequestToMobile::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc
new file mode 100644
index 0000000000..5e84f42c34
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response.cc
@@ -0,0 +1,60 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response.h"
+#include "application_manager/application_impl.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PerformAppServiceInteractionResponse::PerformAppServiceInteractionResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+PerformAppServiceInteractionResponse::~PerformAppServiceInteractionResponse() {}
+
+void PerformAppServiceInteractionResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc
new file mode 100644
index 0000000000..9912df84ce
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_response_from_mobile.cc
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h"
+#include "application_manager/application_impl.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PerformAppServiceInteractionResponseFromMobile::
+ PerformAppServiceInteractionResponseFromMobile(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseFromMobile(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+PerformAppServiceInteractionResponseFromMobile::
+ ~PerformAppServiceInteractionResponseFromMobile() {}
+
+void PerformAppServiceInteractionResponseFromMobile::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ event_engine::MobileEvent event(
+ mobile_apis::FunctionID::PerformAppServiceInteractionID);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
new file mode 100644
index 0000000000..53d1bf82fa
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
@@ -0,0 +1,129 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PublishAppServiceRequest::PublishAppServiceRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+PublishAppServiceRequest::~PublishAppServiceRequest() {}
+
+void PublishAppServiceRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Received a PublishAppService " << connection_key());
+ MessageHelper::PrintSmartObject(*message_);
+
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject manifest =
+ (*message_)[strings::msg_params][strings::app_service_manifest];
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ std::string requested_service_name = "";
+
+ if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists(
+ strings::service_name)) {
+ requested_service_name =
+ (*message_)[strings::msg_params][strings::app_service_manifest]
+ [strings::service_name]
+ .asString();
+ }
+
+ std::string requested_service_type =
+ (*message_)[strings::msg_params][strings::app_service_manifest]
+ [strings::service_type]
+ .asString();
+
+ smart_objects::SmartArray* requested_handled_rpcs = NULL;
+ if ((*message_)[strings::msg_params][strings::app_service_manifest].keyExists(
+ strings::handled_rpcs)) {
+ requested_handled_rpcs =
+ (*message_)[strings::msg_params][strings::app_service_manifest]
+ [strings::handled_rpcs]
+ .asArray();
+ }
+
+ bool result =
+ policy_handler_.CheckAppServiceParameters(app->policy_app_id(),
+ requested_service_name,
+ requested_service_type,
+ requested_handled_rpcs);
+
+ if (!result) {
+ SendResponse(false,
+ mobile_apis::Result::DISALLOWED,
+ "Service disallowed by policies");
+ return;
+ }
+
+ auto& ext =
+ sdl_rpc_plugin::SystemCapabilityAppExtension::ExtractExtension(*app);
+ ext.SubscribeTo(mobile_apis::SystemCapabilityType::APP_SERVICES);
+
+ smart_objects::SmartObject service_record =
+ application_manager_.GetAppServiceManager().PublishAppService(
+ manifest, true, connection_key());
+
+ if (service_record.empty()) {
+ SendResponse(
+ false, mobile_apis::Result::REJECTED, "Failed to publish service");
+ return;
+ }
+
+ response_params[strings::app_service_record] = service_record;
+
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc
new file mode 100644
index 0000000000..d1bfc6e154
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_response.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+PublishAppServiceResponse::PublishAppServiceResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+PublishAppServiceResponse::~PublishAppServiceResponse() {}
+
+void PublishAppServiceResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
new file mode 100644
index 0000000000..2cb43bce07
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+UnpublishAppServiceRequest::UnpublishAppServiceRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+UnpublishAppServiceRequest::~UnpublishAppServiceRequest() {}
+
+void UnpublishAppServiceRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_id].asString();
+
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+
+ if (!service || service->connection_key != connection_key()) {
+ SendResponse(false,
+ mobile_apis::Result::INVALID_ID,
+ "No app service with the requested service ID was published "
+ "by this application");
+ return;
+ }
+
+ bool ret = application_manager_.GetAppServiceManager().UnpublishAppService(
+ service_id);
+
+ if (!ret) {
+ SendResponse(
+ false,
+ mobile_apis::Result::INVALID_ID,
+ "The app service with that requested service ID does not exist");
+ return;
+ }
+
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL, NULL);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc
new file mode 100644
index 0000000000..22450ecc4c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+UnpublishAppServiceResponse::UnpublishAppServiceResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+UnpublishAppServiceResponse::~UnpublishAppServiceResponse() {}
+
+void UnpublishAppServiceResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt
new file mode 100644
index 0000000000..1670ba5c22
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt
@@ -0,0 +1,34 @@
+include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
+
+include_directories(
+ ${GMOCK_INCLUDE_DIRECTORY}
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/app_service_rpc_plugin/include
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/
+ ${COMPONENTS_DIR}/application_manager/test/include/
+ ${POLICY_MOCK_INCLUDE_PATH}/
+ ${CMAKE_SOURCE_DIR}/src
+ ${COMPONENTS_DIR}/resumption/include
+)
+
+
+set(COMMANDS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/commands)
+
+file(GLOB SOURCES
+ ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc
+ ${COMPONENTS_DIR}/application_manager/test/mock_application_helper.cc
+ ${COMPONENTS_DIR}/application_manager/src/smart_object_keys.cc
+ ${COMMANDS_TEST_DIR}/hmi/*
+ ${COMMANDS_TEST_DIR}/mobile/*
+ ${COMPONENTS_DIR}/application_manager/src/message.cc
+ ${COMPONENTS_DIR}/application_manager/src/event_engine/*
+)
+
+set(LIBRARIES
+ gmock
+ sdl_rpc_plugin_static
+ app_service_rpc_plugin_static
+)
+
+create_cotired_test("app_services_commands_test" "${SOURCES}" "${LIBRARIES}" )
+
+add_subdirectory("app_service_plugin")
diff --git a/src/components/dbus/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/CMakeLists.txt
index 914bd2ca84..9abe251204 100644
--- a/src/components/dbus/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014, Ford Motor Company
+# Copyright (c) 2019, Ford Motor Company, Livio
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -12,7 +12,7 @@
# disclaimer in the documentation and/or other materials provided with the
# distribution.
#
-# Neither the name of the Ford Motor Company nor the names of its contributors
+# Neither the name of the copyright holders nor the names of their contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
@@ -30,24 +30,25 @@
include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
-include_directories (
+
+set(APP_SERVICE_DIR "${COMPONENTS_DIR}/application_manager/rpc_plugins/app_service_rpc_plugin")
+set(APP_SERVICE_SRC_DIR "${APP_SERVICE_DIR}/src")
+set(APP_SERVICE_INCLUDE_DIR "${APP_SERVICE_DIR}/include/app_service_rpc_plugin")
+set(APP_SERVICE_TEST_DIR "${APP_SERVICE_DIR}/test")
+
+include_directories(
${GMOCK_INCLUDE_DIRECTORY}
- ${COMPONENTS_DIR}/dbus/include/
- ${COMPONENTS_DIR}/dbus/test/include/
-)
+ ${APP_SERVICE_INCLUDE_DIR}
+)
-#FIXME: exclude some tests
-set (EXCLUDE_PATHS
- dbus_message_controller_test.cc
+set(SOURCES ${APP_SERVICE_TEST_DIR}/app_service_plugin/app_service_app_extension_test.cc
+ ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc
)
-collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}" ${EXCLUDE_PATHS})
-
-set (LIBRARIES
- gmock
- DBus
- formatters
- SmartObjects
+set(LIBRARIES
+ gmock
+ sdl_rpc_plugin_static
+ app_service_rpc_plugin_static
)
-create_test(test_DBus_test "${SOURCES}" "${LIBRARIES}")
+create_test("app_service_plugin_test" "${SOURCES}" "${LIBRARIES}" )
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/app_service_app_extension_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/app_service_app_extension_test.cc
new file mode 100644
index 0000000000..785cdd5200
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/app_service_plugin/app_service_app_extension_test.cc
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/app_service_app_extension.h"
+#include <memory>
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/mock_application.h"
+#include "gtest/gtest.h"
+
+namespace {
+const std::string kAppServiceType1 = "AppServiceType1";
+const std::string kAppServiceType2 = "AppServiceType2";
+const std::string kResumptionDataKey = "kResumptionDataKey";
+const std::string kAppServiceInfoKey = "appService";
+} // namespace
+
+namespace test {
+namespace components {
+namespace app_service_plugin_test {
+
+using test::components::application_manager_test::MockApplication;
+using ::testing::_;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnNull;
+using ::testing::ReturnRef;
+using ::testing::SaveArg;
+
+using namespace app_service_rpc_plugin;
+namespace strings = application_manager::strings;
+namespace plugins = application_manager::plugin_manager;
+
+class AppServiceAppExtensionTest : public ::testing::Test {
+ public:
+ AppServiceAppExtensionTest() : mock_app_(new NiceMock<MockApplication>()) {}
+
+ protected:
+ void SetUp() OVERRIDE {
+ app_service_app_extension_.reset(
+ new AppServiceAppExtension(app_service_plugin_, *mock_app_));
+ }
+
+ void TearDown() OVERRIDE {
+ app_service_app_extension_.reset();
+ }
+
+ app_service_rpc_plugin::AppServiceRpcPlugin app_service_plugin_;
+ std::unique_ptr<MockApplication> mock_app_;
+ std::unique_ptr<AppServiceAppExtension> app_service_app_extension_;
+};
+
+TEST_F(AppServiceAppExtensionTest, SubscribeToAppService_SUCCESS) {
+ EXPECT_TRUE(
+ app_service_app_extension_->SubscribeToAppService(kAppServiceType1));
+ const auto& subs = app_service_app_extension_->Subscriptions();
+ EXPECT_EQ(1u, subs.size());
+ EXPECT_TRUE(
+ app_service_app_extension_->IsSubscribedToAppService(kAppServiceType1));
+}
+
+TEST_F(AppServiceAppExtensionTest,
+ SubscribeToAppService_SubscribeOneAppServiceType_Twice_FAIL) {
+ ASSERT_TRUE(
+ app_service_app_extension_->SubscribeToAppService(kAppServiceType1));
+ ASSERT_TRUE(
+ app_service_app_extension_->IsSubscribedToAppService(kAppServiceType1));
+
+ EXPECT_FALSE(
+ app_service_app_extension_->SubscribeToAppService(kAppServiceType1));
+ EXPECT_TRUE(
+ app_service_app_extension_->IsSubscribedToAppService(kAppServiceType1));
+ const auto& subs = app_service_app_extension_->Subscriptions();
+ EXPECT_EQ(1u, subs.size());
+}
+
+TEST_F(
+ AppServiceAppExtensionTest,
+ UnsubscribeFromAppService_AppServiceType1Unsubscribed_AppServiceType2Remains_SUCCESS) {
+ // Subscribe
+ ASSERT_TRUE(
+ app_service_app_extension_->SubscribeToAppService(kAppServiceType1));
+ ASSERT_TRUE(
+ app_service_app_extension_->SubscribeToAppService(kAppServiceType2));
+ auto subs = app_service_app_extension_->Subscriptions();
+ ASSERT_EQ(2u, subs.size());
+ ASSERT_TRUE(
+ app_service_app_extension_->IsSubscribedToAppService(kAppServiceType1));
+ ASSERT_TRUE(
+ app_service_app_extension_->IsSubscribedToAppService(kAppServiceType2));
+
+ // Unsubscribe
+ EXPECT_TRUE(
+ app_service_app_extension_->UnsubscribeFromAppService(kAppServiceType1));
+ EXPECT_FALSE(
+ app_service_app_extension_->IsSubscribedToAppService(kAppServiceType1));
+ EXPECT_TRUE(
+ app_service_app_extension_->IsSubscribedToAppService(kAppServiceType2));
+ subs = app_service_app_extension_->Subscriptions();
+ EXPECT_EQ(1u, subs.size());
+}
+
+TEST_F(AppServiceAppExtensionTest,
+ UnsubscribeFromAppService_UnsubscribeNotSubscribedAppServiceType_FAIL) {
+ ASSERT_TRUE(
+ app_service_app_extension_->SubscribeToAppService(kAppServiceType1));
+ ASSERT_EQ(1u, app_service_app_extension_->Subscriptions().size());
+ ASSERT_TRUE(
+ app_service_app_extension_->IsSubscribedToAppService(kAppServiceType1));
+
+ EXPECT_FALSE(
+ app_service_app_extension_->UnsubscribeFromAppService(kAppServiceType2));
+ EXPECT_TRUE(
+ app_service_app_extension_->IsSubscribedToAppService(kAppServiceType1));
+ EXPECT_EQ(1u, app_service_app_extension_->Subscriptions().size());
+}
+
+TEST_F(AppServiceAppExtensionTest,
+ UnsubscribeFromAppService_UnsubscribeAll_SUCCESS) {
+ auto app_service_types = {kAppServiceType1, kAppServiceType2};
+
+ for (const auto& app_service_type : app_service_types) {
+ ASSERT_TRUE(
+ app_service_app_extension_->SubscribeToAppService(app_service_type));
+ ASSERT_TRUE(
+ app_service_app_extension_->IsSubscribedToAppService(app_service_type));
+ }
+ ASSERT_EQ(2u, app_service_app_extension_->Subscriptions().size());
+
+ app_service_app_extension_->UnsubscribeFromAppService();
+
+ for (const auto& app_service_type : app_service_types) {
+ EXPECT_FALSE(
+ app_service_app_extension_->IsSubscribedToAppService(app_service_type));
+ }
+ EXPECT_EQ(0u, app_service_app_extension_->Subscriptions().size());
+}
+
+TEST_F(AppServiceAppExtensionTest, SaveResumptionData_SUCCESS) {
+ ASSERT_TRUE(
+ app_service_app_extension_->SubscribeToAppService(kAppServiceType1));
+ ASSERT_EQ(1u, app_service_app_extension_->Subscriptions().size());
+ ASSERT_TRUE(
+ app_service_app_extension_->IsSubscribedToAppService(kAppServiceType1));
+
+ smart_objects::SmartObject resumption_data;
+ resumption_data[kResumptionDataKey] = "some resumption data";
+
+ app_service_app_extension_->SaveResumptionData(resumption_data);
+
+ EXPECT_TRUE(resumption_data.keyExists(kResumptionDataKey));
+ EXPECT_TRUE(resumption_data.keyExists(kAppServiceInfoKey));
+ EXPECT_EQ(kAppServiceType1,
+ resumption_data[kAppServiceInfoKey][0].asString());
+}
+
+TEST_F(AppServiceAppExtensionTest, ProcessResumption_SUCCESS) {
+ app_service_app_extension_->UnsubscribeFromAppService();
+ ASSERT_EQ(0u, app_service_app_extension_->Subscriptions().size());
+
+ smart_objects::SmartObject app_service_data =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ app_service_data.asArray()->push_back(
+ smart_objects::SmartObject(kAppServiceType1));
+ app_service_data.asArray()->push_back(
+ smart_objects::SmartObject(kAppServiceType2));
+
+ smart_objects::SmartObject resumption_data;
+ resumption_data[kAppServiceInfoKey] = app_service_data;
+
+ app_service_app_extension_->ProcessResumption(resumption_data);
+
+ for (const auto& app_service_type : {kAppServiceType1, kAppServiceType2}) {
+ EXPECT_TRUE(
+ app_service_app_extension_->IsSubscribedToAppService(app_service_type));
+ }
+ EXPECT_EQ(2u, app_service_app_extension_->Subscriptions().size());
+}
+
+} // namespace app_service_plugin_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
new file mode 100644
index 0000000000..4236ac23f9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/commands/command_request_test.h"
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+#include "gtest/gtest.h"
+
+#include "hmi/as_app_service_activation_request.h"
+#include "hmi/as_app_service_activation_response.h"
+#include "hmi/as_get_active_service_consent_request.h"
+#include "hmi/as_get_active_service_consent_response.h"
+#include "hmi/as_get_app_service_data_request_from_hmi.h"
+#include "hmi/as_get_app_service_data_request_to_hmi.h"
+#include "hmi/as_get_app_service_data_response_from_hmi.h"
+#include "hmi/as_get_app_service_data_response_to_hmi.h"
+#include "hmi/as_get_app_service_records_request.h"
+#include "hmi/as_get_app_service_records_response.h"
+#include "hmi/as_perform_app_service_interaction_request_from_hmi.h"
+#include "hmi/as_perform_app_service_interaction_request_to_hmi.h"
+#include "hmi/as_perform_app_service_interaction_response_from_hmi.h"
+#include "hmi/as_perform_app_service_interaction_response_to_hmi.h"
+#include "hmi/as_publish_app_service_request.h"
+#include "hmi/as_publish_app_service_response.h"
+#include "hmi/as_unpublish_app_service_request.h"
+#include "hmi/as_unpublish_app_service_response.h"
+#include "hmi/on_as_app_service_data_notification.h"
+#include "hmi/on_as_app_service_data_notification_from_hmi.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_event_dispatcher.h"
+
+namespace am = application_manager;
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace dummy_hmi_commands_test {
+
+namespace commands = app_service_rpc_plugin::commands;
+
+using ::application_manager::ApplicationSharedPtr;
+using application_manager::commands::MessageSharedPtr;
+using ::test::components::application_manager_test::MockApplication;
+using ::test::components::application_manager_test::MockApplicationManager;
+using ::test::components::application_manager_test::
+ MockApplicationManagerSettings;
+using ::test::components::event_engine_test::MockEventDispatcher;
+using ::testing::_;
+using ::testing::NotNull;
+using ::testing::Types;
+
+template <class Command>
+class HMICommandsTest : public components::commands_test::CommandRequestTest<
+ CommandsTestMocks::kIsNice> {
+ public:
+ typedef Command CommandType;
+
+ void InitCommand(const uint32_t& timeout) OVERRIDE {
+ stream_retry_.first = 0;
+ stream_retry_.second = 0;
+ EXPECT_CALL(app_mngr_settings_, default_timeout())
+ .WillOnce(ReturnRef(timeout));
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, start_stream_retry_amount())
+ .WillByDefault(ReturnRef(stream_retry_));
+ }
+
+ protected:
+ std::pair<uint32_t, int32_t> stream_retry_;
+};
+
+template <class Command>
+class HMICommandsTestFirst : public HMICommandsTest<Command> {
+ public:
+ using typename HMICommandsTest<Command>::CommandType;
+};
+
+/* macro TYPED_TEST_CASE takes max 50 args. That is why there are few
+ * TYPED_TEST_CASE for HMI and mobile commands
+ */
+
+typedef Types<commands::ASAppServiceActivationRequest,
+ commands::ASAppServiceActivationResponse,
+ commands::ASGetActiveServiceConsentRequest,
+ commands::ASGetActiveServiceConsentResponse,
+ commands::ASPerformAppServiceInteractionRequestFromHMI,
+ commands::ASGetAppServiceDataRequestToHMI,
+ commands::ASGetAppServiceDataResponseFromHMI,
+ commands::ASGetAppServiceDataResponseToHMI,
+ commands::ASGetAppServiceRecordsRequest,
+ commands::ASGetAppServiceRecordsResponse,
+ commands::ASPerformAppServiceInteractionRequestFromHMI,
+ commands::ASPerformAppServiceInteractionRequestToHMI,
+ commands::ASPerformAppServiceInteractionResponseFromHMI,
+ commands::ASPerformAppServiceInteractionResponseToHMI,
+ commands::ASPublishAppServiceRequest,
+ commands::ASPublishAppServiceResponse,
+ commands::ASUnpublishAppServiceRequest,
+ commands::ASUnpublishAppServiceResponse,
+ commands::OnASAppServiceDataNotification,
+ commands::OnASAppServiceDataNotificationFromHMI>
+ HMICommandsListFirst;
+
+TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst);
+
+TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) {
+ std::shared_ptr<typename TestFixture::CommandType> command =
+ this->template CreateCommand<typename TestFixture::CommandType>();
+ EXPECT_NE(command.use_count(), 0);
+}
+
+} // namespace dummy_hmi_commands_test
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
new file mode 100644
index 0000000000..69bff3ad76
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/commands/command_request_test.h"
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+#include "gtest/gtest.h"
+
+#include "mobile/get_app_service_data_request.h"
+#include "mobile/get_app_service_data_request_to_mobile.h"
+#include "mobile/get_app_service_data_response.h"
+#include "mobile/get_app_service_data_response_from_mobile.h"
+#include "mobile/on_app_service_data_notification.h"
+#include "mobile/on_app_service_data_notification_from_mobile.h"
+#include "mobile/perform_app_service_interaction_request.h"
+#include "mobile/perform_app_service_interaction_request_to_mobile.h"
+#include "mobile/perform_app_service_interaction_response.h"
+#include "mobile/perform_app_service_interaction_response_from_mobile.h"
+#include "mobile/publish_app_service_request.h"
+#include "mobile/publish_app_service_response.h"
+#include "mobile/unpublish_app_service_request.h"
+#include "mobile/unpublish_app_service_response.h"
+
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "test/application_manager/mock_application_manager_settings.h"
+
+namespace am = application_manager;
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace dummy_mobile_commands_test {
+
+namespace commands = app_service_rpc_plugin::commands;
+using am::commands::MessageSharedPtr;
+using ::application_manager::ApplicationSharedPtr;
+using ::test::components::application_manager_test::MockApplication;
+using ::test::components::application_manager_test::MockApplicationManager;
+using ::test::components::application_manager_test::
+ MockApplicationManagerSettings;
+using ::test::components::event_engine_test::MockEventDispatcher;
+using ::testing::_;
+using ::testing::NotNull;
+using ::testing::Types;
+
+namespace {
+const std::string kEmptyString_ = "";
+} // namespace
+
+template <class Command>
+class MobileCommandsTest : public components::commands_test::CommandRequestTest<
+ CommandsTestMocks::kIsNice> {
+ public:
+ typedef Command CommandType;
+
+ void InitCommand(const uint32_t& timeout) OVERRIDE {
+ EXPECT_CALL(app_mngr_settings_, default_timeout())
+ .WillOnce(ReturnRef(timeout));
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, app_icons_folder())
+ .WillByDefault(ReturnRef(kEmptyString_));
+ }
+};
+
+template <class Command>
+class MobileCommandsTestFirst : public MobileCommandsTest<Command> {
+ public:
+ using typename MobileCommandsTest<Command>::CommandType;
+};
+
+/* macro TYPED_TEST_CASE takes max 50 args. That is why there are few
+ * TYPED_TEST_CASE for HMI and mobile commands
+ */
+
+typedef Types<commands::GetAppServiceDataRequest,
+ commands::GetAppServiceDataRequestToMobile,
+ commands::GetAppServiceDataResponse,
+ commands::GetAppServiceDataResponseFromMobile,
+ commands::OnAppServiceDataNotification,
+ commands::OnAppServiceDataNotificationFromMobile,
+ commands::PerformAppServiceInteractionRequest,
+ commands::PerformAppServiceInteractionRequestToMobile,
+ commands::PerformAppServiceInteractionResponse,
+ commands::PerformAppServiceInteractionResponseFromMobile,
+ commands::PublishAppServiceRequest,
+ commands::PublishAppServiceResponse,
+ commands::UnpublishAppServiceRequest,
+ commands::UnpublishAppServiceResponse>
+ MobileCommandsListFirst;
+
+TYPED_TEST_CASE(MobileCommandsTestFirst, MobileCommandsListFirst);
+
+TYPED_TEST(MobileCommandsTestFirst, CtorAndDtorCall) {
+ std::shared_ptr<typename TestFixture::CommandType> command =
+ this->template CreateCommand<typename TestFixture::CommandType>();
+ EXPECT_NE(command.use_count(), 0);
+}
+
+} // namespace dummy_mobile_commands_test
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc
new file mode 100644
index 0000000000..6949a3aff0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/on_app_service_data_notification_test.cc
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "app_service_rpc_plugin/commands/mobile/on_app_service_data_notification.h"
+#include "app_service_rpc_plugin/app_service_app_extension.h"
+#include "app_service_rpc_plugin/app_service_rpc_plugin.h"
+#include "application_manager/application.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_app_service_manager.h"
+#include "application_manager/mock_application.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
+
+namespace am = application_manager;
+using am::ApplicationSet;
+using am::commands::MessageSharedPtr;
+using app_service_rpc_plugin::commands::OnAppServiceDataNotification;
+using test::components::application_manager_test::MockApplication;
+using test::components::application_manager_test::MockApplicationManager;
+using test::components::application_manager_test::MockAppServiceManager;
+using test::components::commands_test::CommandsTest;
+using test::components::commands_test::CommandsTestMocks;
+using ::testing::_;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnNull;
+using ::testing::ReturnRef;
+using ::testing::SaveArg;
+
+namespace {
+const uint32_t kAppId = 0u;
+const uint32_t kConnectionKey = 1u;
+const std::string kPolicyAppId = "Test";
+const int kModuleId = 153u;
+} // namespace
+
+namespace app_service_plugin_test {
+using namespace app_service_rpc_plugin;
+using application_manager::ApplicationSet;
+
+class OnAppServiceDataNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnAppServiceDataNotificationTest()
+ : mock_app_(std::make_shared<NiceMock<MockApplication> >())
+ , app_service_app_extension_(
+ std::make_shared<app_service_rpc_plugin::AppServiceAppExtension>(
+ app_service_plugin_, *mock_app_))
+ , apps_lock_(std::make_shared<sync_primitives::Lock>())
+ , apps_da_(apps_, apps_lock_)
+ , last_state_(std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>("app_storage_folder",
+ "app_info_storage")))
+ , app_service_manager_(app_mngr_, last_state_) {
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app_, is_remote_control_supported())
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, QueryInterface(_))
+ .WillByDefault(Return(app_service_app_extension_));
+ }
+
+ MessageSharedPtr CreateBasicMessage() {
+ MessageSharedPtr message = CreateMessage();
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::function_id] =
+ mobile_apis::FunctionID::OnAppServiceDataID;
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::connection_key] = kConnectionKey;
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::app_id] = kAppId;
+
+ return message;
+ }
+
+ protected:
+ std::shared_ptr<MockApplication> mock_app_;
+ std::shared_ptr<AppServiceAppExtension> app_service_app_extension_;
+ app_service_rpc_plugin::AppServiceRpcPlugin app_service_plugin_;
+ application_manager::ApplicationSet apps_;
+ const std::shared_ptr<sync_primitives::Lock> apps_lock_;
+ DataAccessor<application_manager::ApplicationSet> apps_da_;
+ resumption::LastStateWrapperPtr last_state_;
+ MockAppServiceManager app_service_manager_;
+};
+
+TEST_F(OnAppServiceDataNotificationTest, Run_SendMessageToMobile_Notification) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_type] = "MEDIA";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_id] = "mediaid1234";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ ["mediaServiceData"]["mediaTitle"] = "media title";
+
+ apps_.insert(mock_app_);
+ app_service_app_extension_->SubscribeToAppService("MEDIA");
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
+
+ am::AppService service;
+ service.connection_key = 1;
+ service.mobile_service = true;
+ service
+ .record[am::strings::service_manifest][am::strings::allow_app_consumers] =
+ true;
+ EXPECT_CALL(app_service_manager_, FindServiceByID(_))
+ .WillOnce(Return(&service));
+
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager_));
+
+ std::shared_ptr<OnAppServiceDataNotification> command =
+ CreateCommand<OnAppServiceDataNotification>(mobile_message);
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false))
+ .WillOnce(SaveArg<0>(&mobile_message));
+ // Act
+ command->Run();
+
+ // Assertions
+ ASSERT_TRUE(mobile_message.get());
+ Mock::VerifyAndClearExpectations(&app_mngr_);
+}
+
+TEST_F(OnAppServiceDataNotificationTest, Run_NoService) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_type] = "MEDIA";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_id] = "mediaid1234";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ ["mediaServiceData"]["mediaTitle"] = "media title";
+
+ apps_.insert(mock_app_);
+ app_service_app_extension_->SubscribeToAppService("MEDIA");
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
+
+ EXPECT_CALL(app_service_manager_, FindServiceByID(_)).WillOnce(ReturnNull());
+
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager_));
+
+ std::shared_ptr<OnAppServiceDataNotification> command =
+ CreateCommand<OnAppServiceDataNotification>(mobile_message);
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false)).Times(0);
+ command->Run();
+
+ Mock::VerifyAndClearExpectations(&app_mngr_);
+}
+
+TEST_F(OnAppServiceDataNotificationTest, Run_NoSubscribedApps) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_type] = "MEDIA";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ [am::strings::service_id] = "mediaid1234";
+ (*mobile_message)[am::strings::msg_params][am::strings::service_data]
+ ["mediaServiceData"]["mediaTitle"] = "media title";
+
+ apps_.insert(mock_app_);
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
+
+ am::AppService service;
+ service.connection_key = 1;
+ service.mobile_service = true;
+ service
+ .record[am::strings::service_manifest][am::strings::allow_app_consumers] =
+ true;
+ EXPECT_CALL(app_service_manager_, FindServiceByID(_))
+ .WillOnce(Return(&service));
+
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager_));
+
+ std::shared_ptr<OnAppServiceDataNotification> command =
+ CreateCommand<OnAppServiceDataNotification>(mobile_message);
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false)).Times(0);
+ command->Run();
+
+ Mock::VerifyAndClearExpectations(&app_mngr_);
+}
+
+} // namespace app_service_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt
index 00de927b6e..8129e1240d 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt
@@ -50,7 +50,10 @@ collect_sources(COMMANDS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/commands")
set(LIBRARIES
HMI_API
MOBILE_API
+ MessageHelper
ApplicationManager
+ ProtocolHandler
+ connectionHandler
v4_protocol_v1_2_no_extra
SmartObjects
Utils
@@ -60,11 +63,12 @@ if(ENABLE_LOG)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
-add_library("rc_rpc_plugin" SHARED ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${COMMANDS_SOURCES})
-target_link_libraries("rc_rpc_plugin" ${LIBRARIES})
+add_library("rc_rpc_plugin_static" ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS})
+target_link_libraries("rc_rpc_plugin_static" ${LIBRARIES})
+
+add_library("rc_rpc_plugin" SHARED "src/rc_rpc_plugin.cc")
+target_link_libraries("rc_rpc_plugin" rc_rpc_plugin_static)
-add_library("RCRpcPluginStaticLib" ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS})
-target_link_libraries("RCRpcPluginStaticLib" ${LIBRARIES})
set(INSTALL_DESTINATION bin)
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_button_press_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_button_press_request.h
index fc3721e763..08082d98bb 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_button_press_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_button_press_request.h
@@ -30,10 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_BUTTON_PRESS_REQUEST_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_BUTTON_PRESS_REQUEST_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_BUTTON_PRESS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_BUTTON_PRESS_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -41,8 +43,7 @@ namespace rc_rpc_plugin {
namespace app_mngr = application_manager;
namespace commands {
-class RCButtonPressRequest
- : public application_manager::commands::RequestToHMI {
+class RCButtonPressRequest : public app_mngr::commands::RequestToHMI {
public:
/**
* @brief RCButtonPressRequest class constructor
@@ -54,11 +55,7 @@ class RCButtonPressRequest
* @param resource_allocation_manager ResourceAllocationManager
**/
RCButtonPressRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const RCCommandParams& params);
/**
* @brief Execute command
*/
@@ -68,4 +65,4 @@ class RCButtonPressRequest
} // namespace commands
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_BUTTON_PRESS_REQUEST_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_BUTTON_PRESS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_button_press_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_button_press_response.h
index c16f4de0cc..5ed2236d9c 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_button_press_response.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_button_press_response.h
@@ -30,10 +30,12 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_BUTTON_PRESS_RESPONSE_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_BUTTON_PRESS_RESPONSE_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_BUTTON_PRESS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_BUTTON_PRESS_RESPONSE_H_
#include "application_manager/commands/response_from_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -54,11 +56,7 @@ class RCButtonPressResponse
* @param resource_allocation_manager ResourceAllocationManager
**/
RCButtonPressResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const RCCommandParams& params);
void Run() OVERRIDE;
@@ -67,4 +65,4 @@ class RCButtonPressResponse
} // namespace commands
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_BUTTON_PRESS_RESPONSE_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_BUTTON_PRESS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_request.h
index fc2e0d6536..9a6cf9e290 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_request.h
@@ -1,39 +1,41 @@
/*
-* Copyright (c) 2018, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_GET_INTERIOR_VEHICLE_DATA_CONSENT_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_GET_INTERIOR_VEHICLE_DATA_CONSENT_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -45,12 +47,8 @@ class RCGetInteriorVehicleDataConsentRequest
: public application_manager::commands::RequestToHMI {
public:
RCGetInteriorVehicleDataConsentRequest(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
void Run() OVERRIDE;
~RCGetInteriorVehicleDataConsentRequest();
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_response.h
index a037d33d5a..677e3ad1f0 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_response.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_response.h
@@ -34,6 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_GET_INTERIOR_VEHICLE_DATA_CONSENT_RESPONSE_H_
#include "application_manager/commands/response_from_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -54,12 +56,8 @@ class RCGetInteriorVehicleDataConsentResponse
* @param resource_allocation_manager ResourceAllocationManager
**/
RCGetInteriorVehicleDataConsentResponse(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
void Run() OVERRIDE;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h
index 9f7b1211b7..a75020956c 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h
@@ -34,6 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -45,12 +47,8 @@ class RCGetInteriorVehicleDataRequest
: public application_manager::commands::RequestToHMI {
public:
RCGetInteriorVehicleDataRequest(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
void Run() OVERRIDE;
~RCGetInteriorVehicleDataRequest();
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h
index 28f9b4b9c7..059164dc9f 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h
@@ -34,6 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_GET_INTERIOR_VEHICLE_DATA_RESPONSE_H_
#include "application_manager/commands/response_from_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -45,12 +47,8 @@ class RCGetInteriorVehicleDataResponse
: public application_manager::commands::ResponseFromHMI {
public:
RCGetInteriorVehicleDataResponse(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
void Run() OVERRIDE;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_interior_vehicle_data_notification.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_interior_vehicle_data_notification.h
index 0afa613c7c..2a15f3816a 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_interior_vehicle_data_notification.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_interior_vehicle_data_notification.h
@@ -30,10 +30,12 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_
#include "application_manager/commands/notification_from_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -54,12 +56,8 @@ class RCOnInteriorVehicleDataNotification
* @param resource_allocation_manager ResourceAllocationManager
**/
RCOnInteriorVehicleDataNotification(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
~RCOnInteriorVehicleDataNotification();
@@ -71,4 +69,4 @@ class RCOnInteriorVehicleDataNotification
} // namespace commands
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_ON_INTERIOR_VEHICLE_DATA_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h
index b9ab821176..82e0a8c13b 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h
@@ -30,15 +30,18 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_
#include "application_manager/commands/notification_from_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
namespace rc_rpc_plugin {
namespace app_mngr = application_manager;
+class InteriorDataManager;
namespace commands {
class RCOnRemoteControlSettingsNotification
@@ -54,12 +57,8 @@ class RCOnRemoteControlSettingsNotification
* @param resource_allocation_manager ResourceAllocationManager
**/
RCOnRemoteControlSettingsNotification(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- rc_rpc_plugin::ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
/**
* @brief Execute command
**/
@@ -69,7 +68,8 @@ class RCOnRemoteControlSettingsNotification
private:
ResourceAllocationManager& resource_allocation_manager_;
-
+ InteriorDataManager& interior_data_manager_;
+ RCConsentManager& rc_consent_manager_;
/**
* @brief Disalows RC functionality for all RC apps
* All registered apps will be unsubsribed from OnInteriorVehicleData
@@ -80,4 +80,4 @@ class RCOnRemoteControlSettingsNotification
} // namespace commands
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_RC_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_ON_REMOTE_CONTROL_SETTINGS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_global_properties_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_global_properties_request.h
new file mode 100644
index 0000000000..64b11c3d7b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_global_properties_request.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_RC_SET_GLOBAL_PROPERTIES_REQUEST_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_RC_SET_GLOBAL_PROPERTIES_REQUEST_H
+
+#include "application_manager/commands/request_to_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+
+namespace rc_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class RCSetGlobalPropertiesRequest : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief RCSetGlobalPropertiesRequest class constructor
+ *
+ * @param message Command message as smart pointer to SmartObject
+ * @param params structure that contains references to
+ * parameters used in remote сontrol commands
+ */
+ RCSetGlobalPropertiesRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
+ /**
+ * @brief Execute command
+ */
+ void Run() OVERRIDE;
+
+ ~RCSetGlobalPropertiesRequest();
+};
+} // namespace commands
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_RC_SET_GLOBAL_PROPERTIES_REQUEST_H
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_global_properties_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_global_properties_response.h
new file mode 100644
index 0000000000..2e1494364c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_global_properties_response.h
@@ -0,0 +1,68 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_RC_SET_GLOBAL_PROPERTIES_RESPONSE_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_RC_SET_GLOBAL_PROPERTIES_RESPONSE_H
+
+#include "application_manager/commands/response_from_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+
+namespace rc_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+class RCSetGlobalPropertiesResponse
+ : public application_manager::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief RCSetGlobalPropertiesResponse class constructor
+ *
+ * @param message Command message as smart pointer to SmartObject
+ * @param params Structure that contains references to
+ * parameters used in remote сontrol commands
+ */
+ RCSetGlobalPropertiesResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
+
+ /**
+ * @brief Execute command
+ */
+ void Run() OVERRIDE;
+
+ ~RCSetGlobalPropertiesResponse();
+};
+
+} // namespace commands
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_RC_SET_GLOBAL_PROPERTIES_RESPONSE_H
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_request.h
index 194b423b1a..aeba2f1440 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_request.h
@@ -34,6 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -54,12 +56,8 @@ class RCSetInteriorVehicleDataRequest
* @param resource_allocation_manager ResourceAllocationManager
**/
RCSetInteriorVehicleDataRequest(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
void Run() OVERRIDE;
~RCSetInteriorVehicleDataRequest();
};
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_response.h
index f23acda4d4..8369941c30 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_response.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_response.h
@@ -30,10 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H_
#include "application_manager/commands/response_from_hmi.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -54,12 +56,8 @@ class RCSetInteriorVehicleDataResponse
* @param resource_allocation_manager ResourceAllocationManager
**/
RCSetInteriorVehicleDataResponse(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
void Run() OVERRIDE;
@@ -68,4 +66,4 @@ class RCSetInteriorVehicleDataResponse
} // namespace commands
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_HMI_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_HMI_RC_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_request.h
index fa89c10bf9..3946d80508 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_request.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_BUTTON_PRESS_REQUEST_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_BUTTON_PRESS_REQUEST_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_BUTTON_PRESS_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_BUTTON_PRESS_REQUEST_H_
#include "rc_rpc_plugin/commands/rc_command_request.h"
@@ -41,12 +41,9 @@ namespace app_mngr = application_manager;
namespace commands {
class ButtonPressRequest : public RCCommandRequest {
public:
- ButtonPressRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ ButtonPressRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
/**
* @brief Execute command
@@ -67,9 +64,11 @@ class ButtonPressRequest : public RCCommandRequest {
/**
* @brief IsResourceFree check resource state
* @param module_type Resource name
+ * @param module_id Resource id
* @return True if free, otherwise - false
*/
- bool IsResourceFree(const std::string& module_type) const FINAL;
+ bool IsResourceFree(const std::string& module_type,
+ const std::string& module_id) const FINAL;
/**
* @brief SetResourceState changes state of resource
@@ -85,15 +84,21 @@ class ButtonPressRequest : public RCCommandRequest {
*/
void on_event(const app_mngr::event_engine::Event& event) FINAL;
- std::string ModuleType() FINAL;
+ std::string ModuleType() const FINAL;
+
+ std::string ModuleId() const FINAL;
/**
* @brief ButtonPressRequest class destructor
*/
~ButtonPressRequest();
+
+ private:
+ const mobile_apis::ButtonName::eType GetButtonId() const;
+ std::string GetButtonName() const;
};
} // namespace commands
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_BUTTON_PRESS_REQUEST_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_BUTTON_PRESS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_response.h
index 16d7b0e3fe..69122c19f3 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_response.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/button_press_response.h
@@ -30,10 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_BUTTON_PRESS_RESPONSE_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_BUTTON_PRESS_RESPONSE_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_BUTTON_PRESS_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_BUTTON_PRESS_RESPONSE_H_
#include "application_manager/commands/command_response_impl.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -44,12 +46,9 @@ namespace commands {
class ButtonPressResponse
: public application_manager::commands::CommandResponseImpl {
public:
- ButtonPressResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ ButtonPressResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
void Run() OVERRIDE;
/**
* @brief ButtonPressResponse class destructor
@@ -59,4 +58,4 @@ class ButtonPressResponse
} // namespace commands
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_BUTTON_PRESS_RESPONSE_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_BUTTON_PRESS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_request.h
new file mode 100644
index 0000000000..c41169d027
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_request.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RC_GET_INTERIOR_VEHICLE_DATA_CONSENT_REQUEST_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RC_GET_INTERIOR_VEHICLE_DATA_CONSENT_REQUEST_H
+
+#include <string>
+
+#include "rc_rpc_plugin/commands/rc_command_params.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "utils/macro.h"
+
+namespace rc_rpc_plugin {
+namespace commands {
+
+class GetInteriorVehicleDataConsentRequest
+ : public rc_rpc_plugin::commands::RCCommandRequest {
+ public:
+ /**
+ * @brief GetInteriorVehicleDataConsentRequest constructor
+ * @param message smart pointer with SmartObject
+ * @param params structure that contains references to
+ * parameters used in remote сontrol commands
+ */
+ GetInteriorVehicleDataConsentRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
+
+ /**
+ * @brief Execute command
+ */
+ void Execute() FINAL;
+
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
+ std::string ModuleType() const FINAL;
+
+ /**
+ * @brief For this RPC this method isn't correct, because SDL receives array
+ * of module_ids instead of only one module_id. This method returns empty
+ * string.
+ */
+ std::string ModuleId() const FINAL;
+
+ ~GetInteriorVehicleDataConsentRequest();
+
+ private:
+ /**
+ * @brief Saves ModuleId consents (saved before moduleids + received moduleId
+ * consents + date_of_consent) to file.
+ *
+ * @param msg_params Message params from response message as SmartObject.
+ */
+ bool SaveModuleIdConsents(std::string& info_out,
+ const smart_objects::SmartObject& msg_params);
+
+ /**
+ * @brief Gets calculated vehicle data consent and puts it into provided smart
+ * object
+ * @param out_response output smart object
+ * @return true in case all required consent information was provided in
+ * output smart object, otherwise returns false
+ */
+ bool GetCalculatedVehicleDataConsent(
+ smart_objects::SmartObject& out_response) const;
+
+ /**
+ * @brief Checks whether the user_location is covered by the module's
+ * serviceArea
+ * @param module_uid module key(module_type + module_id)
+ * @return true if the user_location is covered by the module's serviceArea or
+ * the user is the driver (or if seatLocationCapabilities don't exists)
+ * otherwise false
+ */
+ bool IsUserLocationValid(const ModuleUid& module_uid) const;
+
+ /**
+ * @brief Checks whether user should have access to module using the specific
+ * accessMode's rules
+ * @param module_uid module key(moudle_type + module_id)
+ * @param access_mode current HMI accessMode
+ * @return consent enum value
+ */
+ rc_rpc_types::ModuleConsent GetModuleConsentByAccessMode(
+ const ModuleUid& module_uid,
+ const hmi_apis::Common_RCAccessMode::eType access_mode) const;
+
+ smart_objects::SmartObject hmi_request_consents_;
+};
+
+} // namespace commands
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RC_GET_INTERIOR_VEHICLE_DATA_CONSENT_REQUEST_H
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_response.h
new file mode 100644
index 0000000000..c163b02a80
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_response.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RC_GET_INTERIOR_VEHICLE_DATA_CONSENT_RESPONSE_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RC_GET_INTERIOR_VEHICLE_DATA_CONSENT_RESPONSE_H
+
+#include "application_manager/commands/command_response_impl.h"
+#include "rc_rpc_plugin/commands/rc_command_params.h"
+#include "utils/macro.h"
+
+namespace rc_rpc_plugin {
+
+namespace commands {
+
+class GetInteriorVehicleDataConsentResponse
+ : public application_manager::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief GetInteriorVehicleDataConsentResponse constructor
+ *
+ * @param message smart pointer with SmartObject
+ * @param params structure which contains references for next
+ * entities: ApplicationManager, RPCService, HMICapabilities,
+ * PolicyHandlerInterface, ResourceAllocationManager, InteriorDataCache,
+ * InteriorDataManager.
+ */
+ GetInteriorVehicleDataConsentResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
+
+ void Run() OVERRIDE;
+
+ ~GetInteriorVehicleDataConsentResponse();
+};
+
+} // namespace commands
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RC_GET_INTERIOR_VEHICLE_DATA_CONSENT_RESPONSE_H
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h
index c2ae0e887f..7be37f0756 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_GET_INTERIOR_VEHICLE_DATA_REQUEST_H_
-#include "rc_rpc_plugin/commands/rc_command_request.h"
#include <string>
+#include "rc_rpc_plugin/commands/rc_command_request.h"
namespace rc_rpc_plugin {
namespace app_mngr = application_manager;
@@ -43,12 +43,8 @@ namespace commands {
class GetInteriorVehicleDataRequest : public RCCommandRequest {
public:
GetInteriorVehicleDataRequest(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
/**
* @brief Execute command
*/
@@ -67,6 +63,9 @@ class GetInteriorVehicleDataRequest : public RCCommandRequest {
~GetInteriorVehicleDataRequest();
private:
+ std::vector<application_manager::ApplicationSharedPtr> AppsSubscribedToModule(
+ const ModuleUid& module);
+
/**
* @brief Check if app wants to proceed with already setup subscription
* @param request_params request parameters to check
@@ -77,11 +76,10 @@ class GetInteriorVehicleDataRequest : public RCCommandRequest {
bool HasRequestExcessiveSubscription();
/**
- * @brief Handle subscription to vehicle data
- * @param hmi_response json message with response from HMI
- */
- void ProccessSubscription(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& hmi_response);
+ * @brief Handle subscription to vehicle data
+ * @param hmi_response json message with response from HMI
+ */
+ void ProccessSubscription(const smart_objects::SmartObject& hmi_response);
/**
* @brief Cuts off subscribe parameter
@@ -89,8 +87,15 @@ class GetInteriorVehicleDataRequest : public RCCommandRequest {
*/
void RemoveExcessiveSubscription();
- std::string ModuleType() FINAL;
+ std::string ModuleType() const FINAL;
+ std::string ModuleId() const FINAL;
bool excessive_subscription_occured_;
+ bool ProcessCapabilities();
+ void ProcessResponseToMobileFromCache(app_mngr::ApplicationSharedPtr app);
+ bool CheckRateLimits();
+ bool AppShouldBeUnsubscribed();
+ bool TheLastAppShouldBeUnsubscribed(app_mngr::ApplicationSharedPtr app);
+ void FilterDisabledModuleData(smart_objects::SmartObject& module_data);
};
} // namespace commands
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h
index 78148ab7df..58dac85633 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h
@@ -30,10 +30,12 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_GET_INTERIOR_VEHICLE_DATA_RESPONSE_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_GET_INTERIOR_VEHICLE_DATA_RESPONSE_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_GET_INTERIOR_VEHICLE_DATA_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_GET_INTERIOR_VEHICLE_DATA_RESPONSE_H_
#include "application_manager/commands/command_response_impl.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -45,12 +47,8 @@ class GetInteriorVehicleDataResponse
: public application_manager::commands::CommandResponseImpl {
public:
GetInteriorVehicleDataResponse(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
void Run() OVERRIDE;
@@ -59,4 +57,4 @@ class GetInteriorVehicleDataResponse
} // namespace commands
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_GET_INTERIOR_VEHICLE_DATA_RESPONSE_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_GET_INTERIOR_VEHICLE_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h
index 20a7e69868..4663b4b371 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h
@@ -35,6 +35,8 @@
#include <string>
#include "application_manager/commands/command_notification_impl.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -46,18 +48,21 @@ class OnInteriorVehicleDataNotification
: public application_manager::commands::CommandNotificationImpl {
public:
OnInteriorVehicleDataNotification(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
void Run() OVERRIDE;
- std::string ModuleType();
+ std::string ModuleType() const;
+
+ std::string ModuleId() const;
~OnInteriorVehicleDataNotification();
+
+ private:
+ InteriorDataCache& interior_data_cache_;
+ RCCapabilitiesManager& rc_capabilities_manager_;
+ void AddDataToCache(const ModuleUid& module);
};
} // namespace commands
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_request.h
new file mode 100644
index 0000000000..316dc29a1d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_request.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RELEASE_INTERIOR_VEHICLE_DATA_MODULE_REQUEST_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RELEASE_INTERIOR_VEHICLE_DATA_MODULE_REQUEST_H
+
+#include "rc_rpc_plugin/commands/rc_command_params.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "utils/macro.h"
+
+namespace rc_rpc_plugin {
+namespace commands {
+
+class ReleaseInteriorVehicleDataModuleRequest
+ : public rc_rpc_plugin::commands::RCCommandRequest {
+ public:
+ /**
+ * @brief ReleaseInteriorVehicleDataModule constructor
+ * @param message smart pointer with SmartObject
+ * @param params structure that contains references to
+ * parameters used in remote сontrol commands
+ */
+ ReleaseInteriorVehicleDataModuleRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
+
+ void Execute() FINAL;
+
+ std::string ModuleType() const FINAL;
+
+ std::string ModuleId() const FINAL;
+
+ ~ReleaseInteriorVehicleDataModuleRequest();
+
+ private:
+ bool ProcessCapabilities();
+};
+
+} // namespace commands
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RELEASE_INTERIOR_VEHICLE_DATA_MODULE_REQUEST_H
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_response.h
new file mode 100644
index 0000000000..42e0775a83
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_response.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RELEASE_INTERIOR_VEHICLE_DATA_MODULE_RESPONSE_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RELEASE_INTERIOR_VEHICLE_DATA_MODULE_RESPONSE_H
+
+#include "application_manager/commands/command_response_impl.h"
+#include "rc_rpc_plugin/commands/rc_command_params.h"
+#include "utils/macro.h"
+
+namespace rc_rpc_plugin {
+namespace commands {
+
+class ReleaseInteriorVehicleDataModuleResponse
+ : public application_manager::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief ReleaseInteriorVehicleDataModuleResponse constructor
+ *
+ * @param message smart pointer with SmartObject
+ * @param params structure which contains references for next
+ * entities: ApplicationManager, RPCService, HMICapabilities,
+ * PolicyHandlerInterface, ResourceAllocationManager, InteriorDataCache,
+ * InteriorDataManager.
+ */
+ ReleaseInteriorVehicleDataModuleResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
+
+ void Run() OVERRIDE;
+
+ ~ReleaseInteriorVehicleDataModuleResponse();
+};
+
+} // namespace commands
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_RELEASE_INTERIOR_VEHICLE_DATA_MODULE_RESPONSE_H
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h
index 83a8dfdd75..bb152a52f8 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_
#include "rc_rpc_plugin/commands/rc_command_request.h"
@@ -39,15 +39,12 @@ namespace rc_rpc_plugin {
namespace app_mngr = application_manager;
namespace commands {
+
class SetInteriorVehicleDataRequest : public RCCommandRequest {
public:
SetInteriorVehicleDataRequest(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- rc_rpc_plugin::ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
/**
* @brief Execute command
@@ -65,9 +62,11 @@ class SetInteriorVehicleDataRequest : public RCCommandRequest {
/**
* @brief IsResourceFree check resource state
* @param module_type Resource name
+ * @param module_id Resource id
* @return True if free, otherwise - false
*/
- bool IsResourceFree(const std::string& module_type) const FINAL;
+ bool IsResourceFree(const std::string& module_type,
+ const std::string& module_id) const FINAL;
/**
* @brief SetResourceState changes state of resource
@@ -84,26 +83,14 @@ class SetInteriorVehicleDataRequest : public RCCommandRequest {
void on_event(const app_mngr::event_engine::Event& event) FINAL;
/**
- * @brief Method that check if READ_ONLY parameters present
- * @param request_params params from received message
- * @return true if present , false - otherwise
- */
- bool AreReadOnlyParamsPresent(const smart_objects::SmartObject& module_data);
-
- /**
- * @brief Method that check if all request parameters are READ_ONLY
- * @param request_params params from received message
- * @return true if all are read only , false - otherwise
- */
- bool AreAllParamsReadOnly(const smart_objects::SmartObject& module_data);
-
- /**
* @brief Method that cuts-off READ_ONLY parameters
- * @param request_params params to handle
+ * @param module_data params to handle
*/
void CutOffReadOnlyParams(smart_objects::SmartObject& module_data);
- std::string ModuleType() FINAL;
+ std::string ModuleType() const FINAL;
+
+ std::string ModuleId() const FINAL;
/**
* @brief SetInteriorVehicleDataRequest class destructor
@@ -112,14 +99,15 @@ class SetInteriorVehicleDataRequest : public RCCommandRequest {
private:
/**
- * @brief ControlData
+ * @brief CheckAudioSource check that if app wants to change
+ * the audio source from MOBILE_APP to other types of audio
+ * source without keepContext parameter or with keepContext=false
+ * then this app will go to HMI level 'BACKGROUND'
* @param module_data received params
- * @return value of module data depending on module type
*/
- const smart_objects::SmartObject& ControlData(
- const smart_objects::SmartObject& module_data);
+ void CheckAudioSource(const smart_objects::SmartObject& audio_data);
};
} // namespace commands
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_SET_INTERIOR_VEHICLE_DATA_REQUEST_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_SET_INTERIOR_VEHICLE_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_response.h
index 5661a57c07..f54418fc08 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_response.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_response.h
@@ -30,10 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H_
#include "application_manager/commands/command_response_impl.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -45,12 +47,8 @@ class SetInteriorVehicleDataResponse
: public application_manager::commands::CommandResponseImpl {
public:
SetInteriorVehicleDataResponse(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
void Run() OVERRIDE;
@@ -59,4 +57,4 @@ class SetInteriorVehicleDataResponse
} // namespace commands
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_COMMANDS_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_MOBILE_SET_INTERIOR_VEHICLE_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_params.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_params.h
new file mode 100644
index 0000000000..3b46b7ea30
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_params.h
@@ -0,0 +1,68 @@
+/*
+ Copyright (c) 2018, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_PARAMS_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_PARAMS_H_
+
+namespace application_manager {
+class ApplicationManager;
+namespace rpc_service {
+class RPCService;
+}
+class HMICapabilities;
+} // namespace application_manager
+
+namespace policy {
+class PolicyHandlerInterface;
+}
+
+namespace rc_rpc_plugin {
+
+class ResourceAllocationManager;
+class InteriorDataCache;
+class InteriorDataManager;
+class RCCapabilitiesManager;
+class RCConsentManager;
+
+struct RCCommandParams {
+ application_manager::ApplicationManager& application_manager_;
+ application_manager::rpc_service::RPCService& rpc_service_;
+ application_manager::HMICapabilities& hmi_capabilities_;
+ policy::PolicyHandlerInterface& policy_handler_;
+ rc_rpc_plugin::ResourceAllocationManager& resource_allocation_manager_;
+ rc_rpc_plugin::InteriorDataCache& interior_data_cache_;
+ rc_rpc_plugin::InteriorDataManager& interior_data_manager_;
+ rc_rpc_plugin::RCCapabilitiesManager& rc_capabilities_manager_;
+ rc_rpc_plugin::RCConsentManager& rc_consent_manager_;
+};
+} // namespace rc_rpc_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_PARAMS_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h
index 7c5e6f0ebc..6bca1017e0 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h
@@ -30,12 +30,16 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H_
-#include "rc_rpc_plugin/resource_allocation_manager.h"
-#include "rc_rpc_plugin/rc_app_extension.h"
#include "application_manager/commands/command_request_impl.h"
+#include "rc_rpc_plugin/commands/rc_command_params.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
+#include "rc_rpc_plugin/rc_app_extension.h"
+#include "rc_rpc_plugin/rc_capabilities_manager.h"
+#include "rc_rpc_plugin/rc_consent_manager.h"
+#include "rc_rpc_plugin/resource_allocation_manager.h"
namespace rc_rpc_plugin {
namespace app_mngr = application_manager;
@@ -56,12 +60,8 @@ class RCCommandRequest : public app_mngr::commands::CommandRequestImpl {
* @param resource_allocation_manager ResourceAllocationManager
**/
RCCommandRequest(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handl,
- rc_rpc_plugin::ResourceAllocationManager& resource_allocation_manager);
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params);
virtual ~RCCommandRequest();
@@ -73,9 +73,13 @@ class RCCommandRequest : public app_mngr::commands::CommandRequestImpl {
protected:
bool is_subscribed;
- ResourceAllocationManager& resource_allocation_manager_;
bool auto_allowed_;
+ ResourceAllocationManager& resource_allocation_manager_;
+ InteriorDataCache& interior_data_cache_;
+ InteriorDataManager& interior_data_manager_;
+ RCCapabilitiesManager& rc_capabilities_manager_;
+ RCConsentManager& rc_consent_manager_;
/**
* @brief AcquireResource try to allocate resource for application
* In case if allocation of resource is not required, return ALLOWED by
@@ -94,10 +98,13 @@ class RCCommandRequest : public app_mngr::commands::CommandRequestImpl {
* This is default implementation which has to be redefined for RPCs which
* need to manage the resources
* @param module_type Resource name
+ * @param module_id Resource id
* @return True if free, otherwise - false
*/
- virtual bool IsResourceFree(const std::string& module_type) const {
+ virtual bool IsResourceFree(const std::string& module_type,
+ const std::string& module_id) const {
UNUSED(module_type);
+ UNUSED(module_id);
return true;
}
/**
@@ -136,7 +143,24 @@ class RCCommandRequest : public app_mngr::commands::CommandRequestImpl {
disallowed_info_ = info;
}
- virtual std::string ModuleType() = 0;
+ virtual std::string ModuleType() const = 0;
+
+ /**
+ * @brief Extracts ModuleId from command message. Each inherited class should
+ * implement its own functionality
+ *
+ * @return ModuleId as string.
+ */
+ virtual std::string ModuleId() const = 0;
+
+ /**
+ * @brief IsModuleIdProvided checks if moduleId parameter
+ * is provided in the hmi response
+ * @param hmi_response response from hmi
+ * @return true if provided, otherwise - false
+ */
+
+ bool IsModuleIdProvided(const smart_objects::SmartObject& hmi_response) const;
private:
/**
@@ -158,15 +182,44 @@ class RCCommandRequest : public app_mngr::commands::CommandRequestImpl {
/**
* @brief SendGetUserConsent sends consent request to HMI
* @param module_type Resource name
+ * @param module_ids Array of module IDs of the module type that needed user
+ * consent for acquiring their resources
*/
- void SendGetUserConsent(const std::string& module_type);
+ void SendGetUserConsent(const std::string& module_type,
+ const smart_objects::SmartObject& module_ids);
+
void ProcessAccessResponse(const app_mngr::event_engine::Event& event);
+
+ /**
+ * @brief Precesses consents result which has been received from HMI
+ * If module resource consented, resource state will be switched to state BUSY
+ * and called method Execute. Otherwise will be sent response to Mobile with
+ * result code REJECTED.
+ * @param is_allowed consent result
+ * @param module_type Module type
+ * @param module_id Module ID
+ * @param app_id Application, which has asked for module resource consent.
+ */
+ void ProcessConsentResult(const bool is_allowed,
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id);
+ /**
+ * @brief Processes ASK_DRIVE Mode. Tries to retrieve module consents from
+ * LastState. If consent is absent in LastState, will send
+ * GetInteriorVehicleDataConsent to HMI. Otherwise will start to process
+ * consent result.
+ * @param module_type Module type
+ * @param module_id Module ID
+ */
+ void ProcessAskDriverMode(const std::string& module_type,
+ const std::string& module_id);
bool IsInterfaceAvailable(
const app_mngr::HmiInterfaces::InterfaceID interface) const;
std::string disallowed_info_;
};
-}
-}
+} // namespace commands
+} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_cache.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_cache.h
new file mode 100644
index 0000000000..dad37edd1b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_cache.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_CACHE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_CACHE_H_
+#include <string>
+#include "smart_objects/smart_object.h"
+
+namespace rc_rpc_plugin {
+
+/**
+ * @brief ModuleUid uniquely identify a module
+ * moduleType + moduleID
+ */
+typedef std::pair<std::string, std::string> ModuleUid;
+
+/**
+ * @brief The InteriorDataCache interface for caching data class
+ * Provide ability to cache module data by module type name and module id
+ * and clear cache
+ */
+class InteriorDataCache {
+ public:
+ /**
+ * @brief Class destructor
+ */
+ virtual ~InteriorDataCache() {}
+
+ /**
+ * @brief Add module data to cache
+ * @param module module type + module id
+ * @param module_data data to be cached
+ */
+ virtual void Add(const ModuleUid& module,
+ const smart_objects::SmartObject& module_data) = 0;
+
+ /**
+ * @brief Retrieve Get cached data
+ * @param module data type to get from cache
+ * @return smart object with cached data, or nulll smart object
+ */
+ virtual smart_objects::SmartObject Retrieve(
+ const ModuleUid& module) const = 0;
+
+ virtual std::vector<ModuleUid> GetCachedModulesByType(
+ const std::string& module_type) const = 0;
+
+ /**
+ * @brief Contains check if data exists in cache
+ * @param module module name + module id to check in cache
+ * @return true if cached, false otherwize
+ */
+ virtual bool Contains(const ModuleUid& module) const = 0;
+
+ /**
+ * @brief Remove cached data
+ * @param module data type to remove from cache
+ */
+ virtual void Remove(const ModuleUid& module) = 0;
+
+ /**
+ * @brief Clear clear all cached data
+ */
+ virtual void Clear() = 0;
+};
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_CACHE_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_cache_impl.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_cache_impl.h
new file mode 100644
index 0000000000..d21b0e4162
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_cache_impl.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_CACHE_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_CACHE_IMPL_H_
+
+#include <map>
+
+#include "rc_rpc_plugin/interior_data_cache.h"
+#include "utils/lock.h"
+#include "utils/macro.h"
+
+namespace rc_rpc_plugin {
+class InteriorDataCacheImpl : public InteriorDataCache {
+ public:
+ InteriorDataCacheImpl();
+
+ ~InteriorDataCacheImpl();
+
+ void Add(const ModuleUid& module,
+ const smart_objects::SmartObject& module_data) OVERRIDE;
+ smart_objects::SmartObject Retrieve(const ModuleUid& module) const OVERRIDE;
+
+ std::vector<ModuleUid> GetCachedModulesByType(
+ const std::string& module_type) const OVERRIDE;
+
+ bool Contains(const ModuleUid& module) const OVERRIDE;
+ void Remove(const ModuleUid& module) OVERRIDE;
+ void Clear() OVERRIDE;
+
+ private:
+ std::map<ModuleUid, smart_objects::SmartObject> cached_data_;
+ mutable sync_primitives::Lock cached_data_lock_;
+};
+
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_CACHE_IMPL_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager.h
new file mode 100644
index 0000000000..c1fe30fa4d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager.h
@@ -0,0 +1,94 @@
+/*
+ Copyright (c) 2018, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_MANAGER_H_
+
+#include "application_manager/application.h"
+#include "application_manager/plugin_manager/rpc_plugin.h"
+
+namespace rc_rpc_plugin {
+
+namespace app_mngr = application_manager;
+namespace plugins = application_manager::plugin_manager;
+
+/**
+ * @brief ModuleUid uniquely identify a module
+ * moduleType + moduleID
+ */
+typedef std::pair<std::string, std::string> ModuleUid;
+
+class InteriorDataManager {
+ public:
+ virtual ~InteriorDataManager() {}
+ /**
+ * @brief OnPolicyEvent Processes policy related events
+ * @param event Policy event
+ */
+ virtual void OnPolicyEvent(app_mngr::plugin_manager::PolicyEvent event) = 0;
+
+ /**
+ * @brief OnApplicationEvent Notifies modules on certain application events
+ * @param event Event
+ * @param application Pointer to application struct
+ */
+ virtual void OnApplicationEvent(
+ plugins::ApplicationEvent event,
+ app_mngr::ApplicationSharedPtr application) = 0;
+
+ /**
+ * @brief OnDisablingRC process disable RC event. Unsubscribe from all modules
+ * and clear cache
+ */
+ virtual void OnDisablingRC() = 0;
+
+ /**
+ * @brief StoreRequestToHMITime save information and time stamp of
+ * current interior data subscriptions
+ * @param module Module resource (module_type + module_id)
+ */
+ virtual void StoreRequestToHMITime(const ModuleUid& module) = 0;
+
+ /**
+ * @brief CheckRequestsToHMIFrequency check that rate limits are not allowed
+ * of bounce during current time frame. calculate amount of requests per
+ * module in time frame and checks if it bigger then allowed by ini file
+ * @param module module to calculate frequency on
+ * @return true if amount of requests was not exceeded, otherwise return
+ * false.
+ */
+ virtual bool CheckRequestsToHMIFrequency(const ModuleUid& module) = 0;
+};
+
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_MANAGER_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager_impl.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager_impl.h
new file mode 100644
index 0000000000..791016cdcd
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/interior_data_manager_impl.h
@@ -0,0 +1,130 @@
+/*
+ Copyright (c) 2018, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_MANAGER_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_MANAGER_IMPL_H_
+#include "rc_rpc_plugin/interior_data_manager.h"
+#include "utils/date_time.h"
+
+namespace application_manager {
+class ApplicationManager;
+namespace rpc_service {
+class RPCService;
+}
+} // namespace application_manager
+namespace rc_rpc_plugin {
+
+class InteriorDataCache;
+class RCRPCPlugin;
+
+class InteriorDataManagerImpl : public InteriorDataManager {
+ public:
+ InteriorDataManagerImpl(
+ RCRPCPlugin& rc_plugin,
+ InteriorDataCache& cache,
+ application_manager::ApplicationManager& app_mngr,
+ application_manager::rpc_service::RPCService& rpc_service);
+
+ void OnPolicyEvent(app_mngr::plugin_manager::PolicyEvent event) OVERRIDE;
+
+ void OnApplicationEvent(plugins::ApplicationEvent event,
+ app_mngr::ApplicationSharedPtr application) OVERRIDE;
+
+ void OnDisablingRC() OVERRIDE;
+
+ void StoreRequestToHMITime(const ModuleUid& module) OVERRIDE;
+
+ bool CheckRequestsToHMIFrequency(const ModuleUid& module) OVERRIDE;
+
+ private:
+ /**
+ * @brief UpdateHMISubscriptionsOnPolicyUpdated process policy update event.
+ * If some modules was disabeled by policies and there are no applications
+ * that subscribed to them - send RC.GetInteriorVehicleData(subscribe=false)
+ * and clear cache
+ */
+ void UpdateHMISubscriptionsOnPolicyUpdated();
+
+ /**
+ * @brief UpdateHMISubscriptionsOnAppUnregistered process AppUnregistered
+ * event and unsubscribed from not actual module types
+ * @param app application that was unregistered
+ */
+ void UpdateHMISubscriptionsOnAppUnregistered(
+ application_manager::Application& app);
+
+ /**
+ * @brief UnsubscribeFromInteriorVehicleData remove module from cache and
+ * send RC.GetInteriorVehicleData(subscribe=false) to HMI
+ * @param module module that needs to be unsubscribed
+ */
+ void UnsubscribeFromInteriorVehicleData(const ModuleUid& module);
+
+ void UnsubscribeFromInteriorVehicleDataOfType(const std::string& module_type);
+
+ void ClearOldRequestsToHMIHistory();
+ /**
+ * @brief AppsModules mapping from applications to list of modules
+ */
+ typedef std::map<application_manager::ApplicationSharedPtr,
+ std::vector<ModuleUid> >
+ AppsModules;
+
+ /**
+ * @brief AppsSubscribedModules get mapping of application to list of
+ * subscribed modules
+ * @return map of applications to list of subscribed modules
+ */
+ AppsModules AppsSubscribedModules();
+
+ typedef std::map<application_manager::ApplicationSharedPtr,
+ std::vector<std::string> >
+ AppsModuleTypes;
+ AppsModuleTypes AppsSubscribedModuleTypes();
+
+ /**
+ * @brief RequestsToHMIHistory mapping from module type to vector of time
+ * stamps
+ */
+ typedef std::map<ModuleUid, std::deque<date_time::TimeDuration> >
+ RequestsToHMIHistory;
+ RequestsToHMIHistory requests_to_hmi_history_;
+ mutable sync_primitives::Lock requests_to_hmi_history_lock_;
+
+ RCRPCPlugin& rc_plugin_;
+ InteriorDataCache& cache_;
+ application_manager::ApplicationManager& app_mngr_;
+ application_manager::rpc_service::RPCService& rpc_service_;
+};
+
+} // namespace rc_rpc_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_INTERIOR_DATA_MANAGER_IMPL_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h
index 05994492c2..33271e64fd 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h
@@ -30,14 +30,113 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_APP_EXTENSION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_APP_EXTENSION_H_
-#include <string>
+#include <memory>
#include <set>
+#include <string>
#include "application_manager/app_extension.h"
+#include "utils/macro.h"
namespace rc_rpc_plugin {
+
+typedef std::pair<std::string, std::string> ModuleUid;
+
+struct Grid {
+ int32_t col_;
+ int32_t row_;
+ int32_t level_;
+ int32_t colspan_;
+ int32_t rowspan_;
+ int32_t levelspan_;
+
+ Grid()
+ : col_(0), row_(0), level_(0), colspan_(0), rowspan_(0), levelspan_(0) {}
+
+ Grid(int32_t col,
+ int32_t row,
+ int32_t level,
+ int32_t colspan,
+ int32_t rowspan,
+ int32_t levelspan)
+ : col_(col)
+ , row_(row)
+ , level_(level)
+ , colspan_(colspan)
+ , rowspan_(rowspan)
+ , levelspan_(levelspan) {}
+
+ Grid& operator=(const Grid& grid) {
+ col_ = grid.col_;
+ row_ = grid.row_;
+ level_ = grid.level_;
+ colspan_ = grid.colspan_;
+ rowspan_ = grid.rowspan_;
+ levelspan_ = grid.levelspan_;
+
+ return *this;
+ }
+
+ bool operator==(const Grid& grid) const {
+ return col_ == grid.col_ && row_ == grid.row_ && level_ == grid.level_ &&
+ colspan_ == grid.colspan_ && rowspan_ == grid.rowspan_ &&
+ levelspan_ == grid.levelspan_;
+ }
+
+ /**
+ * @brief LevelIntersectionExists checks if the grids have an
+ * intersection by levels.
+ * @param grid with which to check intersection
+ * @return true if intersection exists, otherwise - false
+ */
+ bool LevelIntersectionExists(const Grid& grid) const {
+ const int32_t top_level = (level_ + levelspan_) - 1;
+ const int32_t grid_top_level = (grid.level_ + grid.levelspan_) - 1;
+
+ const int32_t min_level = std::max(level_, grid.level_);
+ const int32_t max_level = std::min(top_level, grid_top_level);
+ if ((max_level - min_level) < 0) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @brief IntersectionExists checks if the grids have an
+ * intersection. Grid can be represented by its bottom-left
+ * and top-right coordinates like a rectangle. First, the
+ * coordinates of the intersection are calculated, then checked
+ * that the rectangle which is formed by the intersections of two
+ * grids has non-zero width and height.
+ * @param grid with which to check intersection
+ * @return true if intersection exists, otherwise - false
+ */
+ bool IntersectionExists(const Grid& grid) const {
+ if (!LevelIntersectionExists(grid)) {
+ return false;
+ }
+
+ const int32_t right_top_col = (col_ + colspan_) - 1;
+ const int32_t right_top_row = (row_ + rowspan_) - 1;
+ const int32_t grid_right_top_col = (grid.col_ + grid.colspan_) - 1;
+ const int32_t grid_right_top_row = (grid.row_ + grid.rowspan_) - 1;
+
+ const int32_t left = std::max(col_, grid.col_);
+ const int32_t bottom = std::max(row_, grid.row_);
+ const int32_t right = std::min(right_top_col, grid_right_top_col);
+ const int32_t top = std::min(right_top_row, grid_right_top_row);
+
+ const int32_t width = right - left;
+ const int32_t height = top - bottom;
+
+ if ((width < 0) || (height < 0)) {
+ return false;
+ }
+ return true;
+ }
+};
+
class RCAppExtension : public application_manager::AppExtension {
public:
explicit RCAppExtension(application_manager::AppExtensionUID uid);
@@ -47,13 +146,15 @@ class RCAppExtension : public application_manager::AppExtension {
* @brief Subscribe to OnInteriorVehicleDataNotification
* @param module interior data specification(zone, data type)
*/
- void SubscribeToInteriorVehicleData(const std::string& module_type);
+ void SubscribeToInteriorVehicleData(const ModuleUid& module);
/**
* @brief Unsubscribe from OnInteriorVehicleDataNotification
* @param module interior data specification(zone, data type)
*/
- void UnsubscribeFromInteriorVehicleData(const std::string& module_type);
+ void UnsubscribeFromInteriorVehicleData(const ModuleUid& module);
+
+ void UnsubscribeFromInteriorVehicleDataOfType(const std::string& module_type);
/**
* @brief UnsubscribeFromInteriorVehicleData removes all subscriptions for
@@ -65,21 +166,52 @@ class RCAppExtension : public application_manager::AppExtension {
* @brief Check if application subscribed to OnInteriorVehicleDataNotification
* @param module interior data specification(zone, data type)
*/
- bool IsSubscibedToInteriorVehicleData(const std::string& module_type);
+ bool IsSubscribedToInteriorVehicleData(const ModuleUid& module);
+
+ bool IsSubscribedToInteriorVehicleDataOfType(const std::string& module_type);
+
+ /**
+ * @brief get list of subscriptions of application
+ * @return list of subscriptions of application
+ */
+ std::set<ModuleUid> InteriorVehicleDataSubscriptions() const;
+
+ /**
+ * @brief GetUserLocation
+ * @return grid of user location
+ */
+ Grid GetUserLocation() const;
+
+ /**
+ * @brief SetUserLocation sets user location
+ * from object to the grid
+ * @param user_location smart object for user_location
+ */
+ void SetUserLocation(
+ const ns_smart_device_link::ns_smart_objects::SmartObject& user_location);
+
+ /**
+ * @brief SetUserLocation sets user location from grid
+ * @param grid grid of user_location
+ */
+ void SetUserLocation(const Grid& grid);
private:
- std::set<std::string> subscribed_interior_vehicle_data_;
+ std::set<ModuleUid> subscribed_interior_vehicle_data_;
+
+ Grid user_location_;
// AppExtension interface
public:
- void SaveResumptionData(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& resumption_data) OVERRIDE;
- void ProcessResumption(const NsSmartDeviceLink::NsSmartObjects::SmartObject&
- resumption_data) OVERRIDE;
+ void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject&
+ resumption_data) OVERRIDE;
+ void ProcessResumption(
+ const ns_smart_device_link::ns_smart_objects::SmartObject&
+ resumption_data) OVERRIDE;
};
-typedef utils::SharedPtr<RCAppExtension> RCAppExtensionPtr;
+typedef std::shared_ptr<RCAppExtension> RCAppExtensionPtr;
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_APP_EXTENSION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_APP_EXTENSION_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager.h
new file mode 100644
index 0000000000..36fd8bbbf9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager.h
@@ -0,0 +1,184 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_CAPABILITIES_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_CAPABILITIES_MANAGER_H_
+#include "application_manager/application_manager.h"
+#include "rc_rpc_plugin/resource_allocation_manager.h"
+
+namespace rc_rpc_plugin {
+
+enum capabilitiesStatus { success, missedLightName, missedParam, readOnly };
+typedef std::pair<std::string, capabilitiesStatus> ModuleTypeCapability;
+
+class RCCapabilitiesManager {
+ public:
+ /**
+ * @brief CheckIfButtonExistInRCCaps checks if the
+ * specified button exists in rc_capabilities
+ * @param button button name
+ * @return true if present, otherwise - false
+ */
+ virtual bool CheckIfButtonExistInRCCaps(
+ const mobile_apis::ButtonName::eType button) const = 0;
+
+ /**
+ * @brief CheckButtonName checks if the button
+ * corresponds to the module_type
+ * @param module_type resource name
+ * @param button_name button name
+ * @return true if they match, otherwise - false
+ */
+ virtual bool CheckButtonName(const std::string& module_type,
+ const std::string& button_name) const = 0;
+
+ /**
+ * @brief CheckIfModuleExistsInCapabilities checks
+ * if the specified module exists in rc_capabilities
+ * @param module moduleType + moduleId
+ * @return true if exists, otherwise - false
+ */
+ virtual bool CheckIfModuleExistsInCapabilities(
+ const ModuleUid& module) const = 0;
+
+ /**
+ * @brief GetModuleDataCapabilities checks whether rc module data
+ * capabilities are presented
+ * @param module_data smart object of module_data
+ * @param module_id module id
+ * @return pair of state and capability status - ModuleCapability
+ */
+ virtual ModuleTypeCapability GetModuleDataCapabilities(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_id) const = 0;
+
+ /**
+ * @brief ControlData retrieves control data
+ * for specified module type
+ * @param module_data smart object of module_data
+ * @param module_type resource name
+ * @return smart object of control data
+ */
+ virtual const smart_objects::SmartObject& ControlDataForType(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_type) const = 0;
+
+ /**
+ * @brief AreReadOnlyParamsPresent checks if there are
+ * any read only params in the module data
+ * @param module_data smart object of module_data
+ * @param module_type resource name
+ * @param module_data_capabilities smart object of capabilities
+ * @return true if read only params exist, otherwise - false
+ */
+ virtual bool AreReadOnlyParamsPresent(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_type,
+ ModuleTypeCapability& module_data_capabilities) const = 0;
+
+ /**
+ * @brief AreAllParamsReadOnly checks that all params from module
+ * data are read only
+ * @param module_data smart object of module_data
+ * @param module_type resource name
+ * @return true if all params are read only, otherwise - false
+ */
+ virtual bool AreAllParamsReadOnly(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_type) const = 0;
+
+ /**
+ * @brief GetDefaultModuleIdFromCapabilities returns the moduleId
+ * from the first item published by xyz-ControlCapabilities
+ * @param module_type resource name
+ * @return default module id from HMI capabilities
+ */
+ virtual const std::string GetDefaultModuleIdFromCapabilities(
+ const std::string& module_type) const = 0;
+
+ /**
+ * @brief GetResources get list of ModuleUids(moduleType + moduleId)
+ * of all known resources
+ * @return vector contains all known moduleUids
+ */
+ virtual const std::vector<ModuleUid> GetResources() const = 0;
+
+ /**
+ * @brief GetModuleServiceArea retrieves service area of module,
+ * if module serviceArea is missed in capabilities, serviceArea is
+ * assumed to be the same as location, if location
+ * is missed in capabilities, it is assumed that serviceArea covers
+ * the whole area of vehicle
+ * @param module module type + module id
+ * @return Grid of module service area
+ */
+ virtual Grid GetModuleServiceArea(const ModuleUid& module) const = 0;
+
+ /**
+ * @brief IsMultipleAccessAllowed checks if multiple access allowed
+ * for requested module
+ * @param module module type + module id
+ * @return true if allowed, otherwise - false
+ */
+ virtual bool IsMultipleAccessAllowed(const ModuleUid& module) const = 0;
+
+ /**
+ * @brief GetDriverLocationFromSeatLocationCapability retrieves the driver's
+ * location from seat location capabilities
+ * @return Grid of driver's location
+ */
+ virtual const Grid GetDriverLocationFromSeatLocationCapability() const = 0;
+
+ /**
+ * @brief IsSeatLocationCapabilityProvided checks whether all necessary
+ * parameters are provided in seat location capabilities
+ * @return true if provided, otherwise - false
+ */
+ virtual bool IsSeatLocationCapabilityProvided() const = 0;
+
+ /**
+ * @brief GetModuleIdForSeatLocation returns the moduleId if request from
+ * mobile contains the id parameter and doesn't contain the moduleId
+ * parameter. If the vehicle support at least one seat control, seat control
+ * capability includes at least two items. SupportedSeat id shall be converted
+ * to the moduleId according to capabilities: 1st item from capabilities for
+ * driver’s seat. 2nd item for front passenger’s seat.
+ * @param id supported seat id
+ */
+ virtual const std::string GetModuleIdForSeatLocation(
+ mobile_apis::SupportedSeat::eType id) const = 0;
+
+ virtual ~RCCapabilitiesManager() {}
+};
+
+} // namespace rc_rpc_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_CAPABILITIES_MANAGER_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager_impl.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager_impl.h
new file mode 100644
index 0000000000..844647940f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_capabilities_manager_impl.h
@@ -0,0 +1,200 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_CAPABILITIES_MANAGER_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_CAPABILITIES_MANAGER_IMPL_H_
+#include "application_manager/application_manager.h"
+#include "rc_rpc_plugin/rc_capabilities_manager.h"
+
+namespace rc_rpc_plugin {
+class RCCapabilitiesManagerImpl : public RCCapabilitiesManager {
+ public:
+ RCCapabilitiesManagerImpl(
+ application_manager::HMICapabilities& hmi_capabilities);
+
+ bool CheckIfButtonExistInRCCaps(
+ const mobile_apis::ButtonName::eType button) const FINAL;
+
+ bool CheckButtonName(const std::string& module_type,
+ const std::string& button_name) const FINAL;
+
+ bool CheckIfModuleExistsInCapabilities(const ModuleUid& module) const FINAL;
+
+ ModuleTypeCapability GetModuleDataCapabilities(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_id) const FINAL;
+
+ const smart_objects::SmartObject& ControlDataForType(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_type) const FINAL;
+
+ bool AreReadOnlyParamsPresent(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_type,
+ ModuleTypeCapability& module_data_capabilities) const FINAL;
+
+ bool AreAllParamsReadOnly(const smart_objects::SmartObject& module_data,
+ const std::string& module_type) const FINAL;
+
+ const std::string GetDefaultModuleIdFromCapabilities(
+ const std::string& module_type) const FINAL;
+
+ const std::vector<ModuleUid> GetResources() const FINAL;
+
+ Grid GetModuleServiceArea(const ModuleUid& module) const FINAL;
+
+ bool IsMultipleAccessAllowed(const ModuleUid& module) const FINAL;
+
+ const Grid GetDriverLocationFromSeatLocationCapability() const FINAL;
+
+ bool IsSeatLocationCapabilityProvided() const FINAL;
+
+ const std::string GetModuleIdForSeatLocation(
+ mobile_apis::SupportedSeat::eType id) const FINAL;
+
+ private:
+ const std::map<std::string, std::string> GetLightCapabilitiesMapping() const;
+
+ const std::map<std::string, std::string> GetModuleDataToCapabilitiesMapping()
+ const;
+
+ /**
+ * @brief Check whether the exists light data related to correspondent
+ * capabilities
+ * @param capabilities smart object of capabilities
+ * @param control_data smart object of control_data
+ * @return pair of state and capability status - ModuleTypeCapability
+ */
+ ModuleTypeCapability GetControlDataCapabilities(
+ const smart_objects::SmartObject& capabilities,
+ const smart_objects::SmartObject& control_data) const;
+
+ /**
+ * @brief Check whether the parameter exist in capabilities
+ * @param capabilities smart object of capabilities
+ * @param mapping - map of module data and capabilities
+ * @param request_parameter - string
+ * @param switched_off_result - ref of mobile_apis::Result
+ * @return success if the parameter exists in capabilities,
+ * otherwise - missedParam
+ */
+ capabilitiesStatus GetItemCapability(
+ const smart_objects::SmartObject& capabilities,
+ const std::map<std::string, std::string>& mapping,
+ const std::string& request_parameter,
+ const mobile_apis::Result::eType& switched_off_result) const;
+
+ /**
+ * @brief Check whether the capabilities for light are allowed
+ * @param capabilities smart object of capabilities
+ * @param control_data smart object of control_data
+ * @return pair of state and capability status - ModuleTypeCapability
+ */
+ ModuleTypeCapability GetLightDataCapabilities(
+ const smart_objects::SmartObject& capabilities,
+ const smart_objects::SmartObject& control_data) const;
+
+ /**
+ * @brief Check whether the light name exists in capabilities
+ * @param capabilities_status smart object of capabilities_status
+ * @param light_data smart object of light_data
+ * @return pair of state and capability status - ModuleTypeCapability
+ */
+ ModuleTypeCapability GetLightNameCapabilities(
+ const smart_objects::SmartObject& capabilities_status,
+ const smart_objects::SmartObject& light_data) const;
+
+ ModuleTypeCapability GetRadioBandByCapabilities(
+ const smart_objects::SmartObject& capabilities_status,
+ const smart_objects::SmartObject& request_parameter) const;
+
+ bool CheckReadOnlyParamsForAudio(
+ const smart_objects::SmartObject& module_type_params) const;
+
+ bool CheckReadOnlyParamsForLight(
+ const smart_objects::SmartObject& module_type_params) const;
+
+ smart_objects::SmartObject GetCapabilitiesByModuleIdFromArray(
+ const smart_objects::SmartObject& module_data_capabilities,
+ const std::string& module_id) const;
+
+ const bool CheckModuleIdWithCapabilities(
+ const smart_objects::SmartObject& rc_capabilities,
+ const ModuleUid& module) const;
+
+ const bool CheckModuleIdWithCapabilitiesArrays(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& module_id) const;
+
+ const bool CheckModuleIdWithCapabilitiesStructure(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& module_id) const;
+
+ const std::string GetDefaultModuleIdFromCapabilitiesStructure(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& module_type) const;
+
+ const std::string GetDefaultModuleIdFromCapabilitiesArray(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& module_type) const;
+
+ const std::vector<std::string> GetCapabilitiesList() const;
+
+ const std::function<std::string(const std::string& control_cap)>
+ GetCapabilitiesToModuleTypeMapping() const;
+
+ void GetResourcesFromCapabilitiesStructure(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& capabitity_key,
+ std::vector<ModuleUid>& out_resources) const;
+
+ void GetResourcesFromCapabilitiesArray(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& capability_key,
+ std::vector<ModuleUid>& out_resources) const;
+
+ Grid GetModuleServiceAreaFromControlCapability(
+ const smart_objects::SmartObject& control_capabilities) const;
+
+ Grid GetModuleLocationFromControlCapability(
+ const smart_objects::SmartObject& control_capabilities) const;
+
+ bool IsMultipleAccessAllowedInControlCaps(
+ const smart_objects::SmartObject& control_capabilities) const;
+
+ Grid GetWholeVehicleArea() const;
+
+ application_manager::HMICapabilities& hmi_capabilities_;
+};
+
+} // namespace rc_rpc_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_CAPABILITIES_MANAGER_IMPL_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h
index 6f101cefef..aa01b608b4 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_command_factory.h
@@ -30,16 +30,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_COMMAND_FACTORY_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_COMMAND_FACTORY_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_COMMAND_FACTORY_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_COMMAND_FACTORY_H_
#include <memory>
-#include "application_manager/command_factory.h"
#include "application_manager/application_manager.h"
#include "application_manager/command_factory.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/hmi_capabilities.h"
#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/rpc_service.h"
+#include "rc_rpc_plugin/commands/rc_command_params.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/macro.h"
@@ -56,20 +57,16 @@ class RCCommandFactory : public application_manager::CommandFactory {
* @param policy_handler PolicyHandlerInterface
* @param allocation_manager ResourceAllocationManager
**/
- RCCommandFactory(app_mngr::ApplicationManager& app_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- ResourceAllocationManager& allocation_manager);
+ RCCommandFactory(const RCCommandParams& params);
application_manager::CommandSharedPtr CreateCommand(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::commands::Command::CommandSource source) OVERRIDE;
/**
- * @param int32_t command id
- * @param CommandSource source
- * @return return true if command can be create, else return false
- **/
+ * @param int32_t command id
+ * @param CommandSource source
+ * @return return true if command can be create, else return false
+ **/
virtual bool IsAbleToProcess(
const int32_t,
const application_manager::commands::Command::CommandSource)
@@ -77,18 +74,20 @@ class RCCommandFactory : public application_manager::CommandFactory {
private:
app_mngr::CommandCreator& get_mobile_creator_factory(
- mobile_apis::FunctionID::eType id,
- mobile_apis::messageType::eType message_type) const;
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const;
+ app_mngr::CommandCreator& get_mobile_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const;
+ app_mngr::CommandCreator& get_mobile_notification_creator(
+ const mobile_apis::FunctionID::eType id) const;
app_mngr::CommandCreator& get_hmi_creator_factory(
- hmi_apis::FunctionID::eType id,
- hmi_apis::messageType::eType message_type) const;
+ const hmi_apis::FunctionID::eType id,
+ const hmi_apis::messageType::eType message_type) const;
- app_mngr::ApplicationManager& app_manager_;
- app_mngr::rpc_service::RPCService& rpc_service_;
- app_mngr::HMICapabilities& hmi_capabilities_;
- PolicyHandlerInterface& policy_handler_;
- ResourceAllocationManager& allocation_manager_;
+ RCCommandParams params_;
};
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_COMMAND_FACTORY_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_COMMAND_FACTORY_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager.h
new file mode 100644
index 0000000000..c8b99cc724
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_CONSENT_MANAGER_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_CONSENT_MANAGER_H
+
+#include <string>
+
+#include "rc_rpc_types.h"
+
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
+class SmartObject;
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
+
+namespace rc_rpc_plugin {
+
+class RCConsentManager {
+ public:
+ /**
+ * @brief Saves consents (is_consented + date_of_consent) for module resources
+ * (module_type + module_id) for specified application
+ * @param policy_app_id Application id which module consents should be saved
+ * @param mac_address Device mac address
+ * @param module_consents - Module resources consents
+ */
+ virtual void SaveModuleConsents(
+ const std::string& policy_app_id,
+ const std::string& mac_address,
+ const rc_rpc_types::ModuleIdConsentVector& module_consents) = 0;
+
+ /**
+ * @brief Retrieves saved consent for specified module resource (module_type
+ * + module_id)
+ * @param app_id Application which related to specified module resource
+ * @param mac_address Device mac address
+ * @param module_id Module resource (module_type + module_id)
+ * @return Module consent state
+ */
+ virtual rc_rpc_plugin::rc_rpc_types::ModuleConsent GetModuleConsent(
+ const std::string& app_id,
+ const std::string& mac_address,
+ const rc_rpc_types::ModuleUid& module_id) = 0;
+
+ /**
+ * @brief Remove modules consents from LastState if they exist
+ */
+ virtual void RemoveAllConsents() = 0;
+
+ /**
+ * @brief Remove all expired module consents from LastState
+ * if they exist
+ */
+ virtual void RemoveExpiredConsents() = 0;
+
+ virtual ~RCConsentManager() {}
+};
+
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_CONSENT_MANAGER_H
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h
new file mode 100644
index 0000000000..5cbc4b977e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_CONSENT_MANAGER_IMPL_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_CONSENT_MANAGER_IMPL_H
+
+#include "rc_consent_manager.h"
+#include "resumption/last_state_wrapper.h"
+#include "utils/lock.h"
+
+namespace Json {
+class Value;
+} // namespace Json
+
+namespace rc_rpc_plugin {
+
+class RCConsentManagerImpl : public RCConsentManager {
+ public:
+ RCConsentManagerImpl(
+ resumption::LastStateWrapperPtr last_state,
+ application_manager::ApplicationManager& application_manager,
+ const uint32_t period_of_consent_expired);
+
+ DEPRECATED
+ RCConsentManagerImpl(
+ resumption::LastState& last_state,
+ application_manager::ApplicationManager& application_manager,
+ const uint32_t period_of_consent_expired);
+
+ void SaveModuleConsents(
+ const std::string& policy_app_id,
+ const std::string& mac_address,
+ const rc_rpc_types::ModuleIdConsentVector& module_consents) OVERRIDE;
+
+ rc_rpc_types::ModuleConsent GetModuleConsent(
+ const std::string& app_id,
+ const std::string& mac_address,
+ const rc_rpc_types::ModuleUid& module_id) OVERRIDE;
+
+ void RemoveExpiredConsents() OVERRIDE;
+
+ void RemoveAllConsents() OVERRIDE;
+
+ ~RCConsentManagerImpl() OVERRIDE;
+
+ private:
+ /**
+ * @brief Saves module consents for specified application
+ * @param app_module_consents Application consents for which new
+ * consents should be added or existing ones should be overwritten
+ * @param consent_to_save module consents which should be saved
+ */
+ void SaveAppModuleConsent(
+ Json::Value& app_module_consents,
+ const rc_rpc_types::ModuleIdConsent& consent_to_save);
+
+ /**
+ * @brief Checks if module consent is expired
+ * @param module_consent Module consent
+ * @return ModuleConsentState
+ */
+ rc_rpc_types::ModuleConsentState CheckModuleConsentState(
+ const Json::Value& module_consent) const;
+
+ /**
+ * @brief Removes devices expired consents
+ * @param device Device section in AppConsensts section of LastState in Json
+ */
+ void RemoveDeviceExpiredConsents(Json::Value& device);
+
+ /**
+ * @brief Remove expired module consents which are related to specified
+ * application
+ * @param app_consents Application consents
+ */
+ void RemoveAppExpiredConsents(Json::Value& app_consents);
+
+ /**
+ * @brief Remove expired module consents which are related to specified
+ * module type
+ * @param module_consents Module consents wich should be checked for expired
+ * consents
+ */
+ void RemoveModuleExpiredConsents(Json::Value& module_consents);
+
+ /**
+ * @brief Get Remote Control section of LastState.
+ * In case the section is absent, will be appended a new empty section.
+ * @return Remote Control section of LastState in Json
+ */
+ Json::Value& GetRemoteControlDataOrAppend(Json::Value& last_state_data);
+
+ /**
+ * @brief Gets Device applications section for specified device mac adress
+ * In case the section is absent, will be appended a new empty section.
+ * @param mac_aress Device MAC adress
+ * @return Device applications section of LastState in Json
+ */
+ Json::Value& GetDeviceApplicationsOrAppend(const std::string& mac_address,
+ Json::Value& last_state_data);
+
+ /**
+ * @brief Get AppConsentsList section of LastState for specified application.
+ * In case the consent list is absent, will be appended a new empty section.
+ * @param policy_app_id Application policy ID
+ * @param mac_address Device MAC address
+ * @return AppConsentsList of LastState in Json
+ */
+ Json::Value& GetAppConsentsListOrAppend(const std::string& policy_app_id,
+ const std::string& mac_address,
+ Json::Value& last_state_data);
+
+ /**
+ * @brief Get Application consents section of Remote Control section of
+ * LastState with all consents for all applications. In case if this section
+ * is absent, will be created a new empty section
+ * @return AppConsents section of RemoteControl section of LastState in Jason
+ */
+ Json::Value& GetAppsConsentsOrAppend(Json::Value& last_state_data);
+
+ /**
+ * @brief Get all module resource consents for specified application and
+ * module type. In case if section with specified module type consents is
+ * absent, will be created a new empty section
+ * @param policy_app_id Application id which contains specified module type
+ * @param mac_adress MAC address of mobile device that needs user consent for
+ * acquiring resource
+ * @param module_type Module type with consents
+ */
+ Json::Value& GetModuleTypeConsentsOrAppend(const std::string& policy_app_id,
+ const std::string& mac_address,
+ const std::string& module_type,
+ Json::Value& last_state_data);
+
+ private:
+ application_manager::ApplicationManager& app_manager_;
+ resumption::LastStateWrapperPtr last_state_;
+ const uint32_t period_of_consent_expired_;
+ mutable sync_primitives::Lock dictionary_control_lock_;
+ mutable sync_primitives::Lock remote_control_lock_;
+ mutable sync_primitives::Lock device_applications_lock_;
+ mutable sync_primitives::Lock applications_lock_;
+ mutable sync_primitives::Lock app_consents_lock_;
+ mutable sync_primitives::Lock module_consents_lock_;
+};
+
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_CONSENT_MANAGER_IMPL_H
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h
new file mode 100644
index 0000000000..eed860fc7f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h
@@ -0,0 +1,175 @@
+/*
+ Copyright (c) 2018, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_HELPERS_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_HELPERS_H_
+
+#include <map>
+#include <string>
+#include "application_manager/application.h"
+#include "rc_rpc_plugin/rc_app_extension.h"
+#include "rc_rpc_plugin/rc_rpc_types.h"
+
+namespace rc_rpc_plugin {
+class RCRPCPlugin;
+
+/**
+ * @brief The RCHelpers class contains frequently used static data
+ * structures related strictly to RC
+ * Converters, mapping, factory functions
+ */
+class RCHelpers {
+ public:
+ /**
+ * @brief GetModuleTypeToDataMapping get mapping of module type enum naming to
+ * actual module data filed name
+ * @return module mapping from enum naming to filed name
+ */
+ static const std::function<std::string(const std::string& module_type)>
+ GetModuleTypeToDataMapping();
+
+ /**
+ * @brief GetModuleTypeToDataMapping get mapping of module type enum naming to
+ * actual module capabilities key
+ * @return module mapping from enum naming to capabilities key
+ */
+ static const std::function<std::string(const std::string& module_type)>
+ GetModuleTypeToCapabilitiesMapping();
+
+ /**
+ * @brief GetModuleTypesList get list of all known module types
+ * @return vector contains all known module types
+ */
+ static const std::vector<std::string> GetModuleTypesList();
+
+ /**
+ * @brief GetRCExtension extract RC extension from application
+ * @param app application to extract extension
+ * @return rc extension of app is rc applicaiton, otherwise return emty shared
+ * pointer.
+ */
+ static RCAppExtensionPtr GetRCExtension(
+ application_manager::Application& app);
+
+ static smart_objects::SmartObjectSPtr CreateUnsubscribeRequestToHMI(
+ const ModuleUid& module, const uint32_t correlation_id);
+
+ static std::vector<application_manager::ApplicationSharedPtr>
+ AppsSubscribedToModule(application_manager::ApplicationManager& app_mngr,
+ const ModuleUid& module);
+
+ static std::vector<application_manager::ApplicationSharedPtr>
+ AppsSubscribedToModuleType(application_manager::ApplicationManager& app_mngr,
+ const std::string& module_type);
+
+ typedef std::map<application_manager::ApplicationSharedPtr,
+ std::vector<std::string> >
+ AppsModuleTypes;
+
+ static AppsModuleTypes GetApplicationsAllowedModuleTypes(
+ application_manager::ApplicationManager& app_mngr);
+
+ typedef std::map<std::string, mobile_apis::ButtonName::eType> ButtonsMap;
+
+ static const std::vector<std::string> buttons_climate();
+
+ static const std::vector<std::string> buttons_radio();
+
+ static const ButtonsMap buttons_map();
+
+ static std::vector<std::string> GetModuleReadOnlyParams(
+ const std::string& module_type);
+
+ /**
+ * @brief Combines module ids and alloweds for these ids and fills vector with
+ * ModuleConsents
+ * @param module_type Module type as string
+ * @param module_ids Modules ids which needed consents from driver
+ * @param allowed Consents for modules
+ */
+ static rc_rpc_types::ModuleIdConsentVector FillModuleConsents(
+ const std::string& module_type,
+ const std::vector<std::string>& module_ids,
+ const std::vector<bool> allowed);
+
+ /**
+ * @brief Retrieves module ids from SmartObject.
+ * @param moduleIds Smartobject which contains collection of module ids
+ * @return Collection of module ids
+ */
+ static std::vector<std::string> RetrieveModuleIds(
+ const smart_objects::SmartObject& moduleIds);
+
+ /**
+ * @brief Retrieves module ids consents from SmartObject.
+ * @param moduleIds Smartobject which contains collection of module ids
+ * consents
+ * @return Collection of module ids consents.
+ */
+ static std::vector<bool> RetrieveModuleConsents(
+ const smart_objects::SmartObject& consents);
+
+ /**
+ * @brief RemoveRedundantGPSDataFromVIDataMsg removes redundant GPS data
+ * params from interior vehicle data response message if one contains radio
+ * station location data
+ * @param msg_params Params of the interior vehicle data response message
+ */
+ static void RemoveRedundantGPSDataFromIVDataMsg(
+ smart_objects::SmartObject& msg_params);
+
+ /**
+ * @brief MergeModuleData all keys and values from first parameter and
+ * update and append keys and values from the second
+ * @param data1 - initial data
+ * @param data2 - updated data
+ * @return updated data1 with data2 keys and values
+ */
+ static smart_objects::SmartObject MergeModuleData(
+ const smart_objects::SmartObject& data1,
+ const smart_objects::SmartObject& data2);
+
+ /**
+ * @brief MergeArray merge two arrays if their elements contain an `id`
+ * parameter
+ * @param data1 - initial data
+ * @param data2 - updated data
+ * @return updated data1 with any values in data2 if the arrays can be merged,
+ * otherwise data2
+ */
+ static smart_objects::SmartObject MergeArray(
+ const smart_objects::SmartObject& data1,
+ const smart_objects::SmartObject& data2);
+};
+
+} // namespace rc_rpc_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_HELPERS_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
index e22f2b64a8..5ee2e0725c 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
@@ -30,8 +30,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_MODULE_CONSTANTS_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_MODULE_CONSTANTS_H_
namespace rc_rpc_plugin {
@@ -40,11 +40,101 @@ namespace strings {
const char kclimateControlCapabilities[] = "climateControlCapabilities";
const char kradioControlCapabilities[] = "radioControlCapabilities";
const char kbuttonCapabilities[] = "buttonCapabilities";
+const char kaudioControlCapabilities[] = "audioControlCapabilities";
+const char klightControlCapabilities[] = "lightControlCapabilities";
+const char khmiSettingsControlCapabilities[] = "hmiSettingsControlCapabilities";
+const char kseatControlCapabilities[] = "seatControlCapabilities";
// RemoteControlCapabilities constants
-const char kRadioControlData[] = "radioControlData";
-const char kClimateControlData[] = "climateControlData";
-} // strings
+const char kServiceArea[] = "serviceArea";
+const char kLocation[] = "location";
+const char kCol[] = "col";
+const char kRow[] = "row";
+const char kLevel[] = "level";
+const char kColspan[] = "colspan";
+const char kRowspan[] = "rowspan";
+const char kLevelspan[] = "levelspan";
+
+// SeatLocationCapability constants
+const char kCols[] = "columns";
+const char kRows[] = "rows";
+const char kLevels[] = "levels";
+const char kSeats[] = "seats";
+const char kGrid[] = "grid";
+// SeatLocationCapability constants
+
+const char kAllowMultipleAccess[] = "allowMultipleAccess";
+
+const char kSupportedLights[] = "supportedLights";
+
+// ClimateControlCapabilities
+const char kFanSpeedAvailable[] = "fanSpeedAvailable";
+const char kCurrentTemperatureAvailable[] = "currentTemperatureAvailable";
+const char kDesiredTemperatureAvailable[] = "desiredTemperatureAvailable";
+const char kAcEnableAvailable[] = "acEnableAvailable";
+const char kCirculateAirEnableAvailable[] = "circulateAirEnableAvailable";
+const char kAutoModeEnableAvailable[] = "autoModeEnableAvailable";
+const char kDefrostZoneAvailable[] = "defrostZoneAvailable";
+const char kDualModeEnableAvailable[] = "dualModeEnableAvailable";
+const char kAcMaxEnableAvailable[] = "acMaxEnableAvailable";
+const char kVentilationModeAvailable[] = "ventilationModeAvailable";
+const char kHeatedSteeringWheelAvailable[] = "heatedSteeringWheelAvailable";
+const char kHeatedWindshieldAvailable[] = "heatedWindshieldAvailable";
+const char kHeatedMirrorsAvailable[] = "heatedMirrorsAvailable";
+const char kHeatedRearWindowAvailable[] = "heatedRearWindowAvailable";
+
+// LightControlCapabilities
+const char kName[] = "name";
+const char kStatusAvailable[] = "statusAvailable";
+const char kDensityAvailable[] = "densityAvailable";
+const char kRGBColorSpaceAvailable[] = "rgbColorSpaceAvailable";
+
+// RadioControlCapabilities
+const char kRadioBandAvailable[] = "radioBandAvailable";
+const char kRadioFrequencyAvailable[] = "radioFrequencyAvailable";
+const char kRdsDataAvailable[] = "rdsDataAvailable";
+const char kAvailableHDsAvailable[] = "availableHDsAvailable";
+const char kHdRadioEnableAvailable[] = "hdRadioEnableAvailable";
+const char kSignalStrengthAvailable[] = "signalStrengthAvailable";
+const char kSignalChangeThresholdAvailable[] = "signalChangeThresholdAvailable";
+const char kRadioEnableAvailable[] = "radioEnableAvailable";
+const char kStateAvailable[] = "stateAvailable";
+const char kSisDataAvailable[] = "sisDataAvailable";
+
+const char kSiriusxmRadioAvailable[] = "siriusxmRadioAvailable";
+
+// SeatControlCapabilities
+const char kHeatingEnabledAvailable[] = "heatingEnabledAvailable";
+const char kCoolingEnabledAvailable[] = "coolingEnabledAvailable";
+const char kHeatingLevelAvailable[] = "heatingLevelAvailable";
+const char kCoolingLevelAvailable[] = "coolingLevelAvailable";
+const char kHorizontalPositionAvailable[] = "horizontalPositionAvailable";
+const char kVerticalPositionAvailable[] = "verticalPositionAvailable";
+const char kFrontVerticalPositionAvailable[] = "frontVerticalPositionAvailable";
+const char kBackVerticalPositionAvailable[] = "backVerticalPositionAvailable";
+const char kBackTiltAngleAvailable[] = "backTiltAngleAvailable";
+const char kHeadSupportHorizontalPositionAvailable[] =
+ "headSupportHorizontalPositionAvailable";
+const char kHeadSupportVerticalPositionAvailable[] =
+ "headSupportVerticalPositionAvailable";
+const char kMassageEnabledAvailable[] = "massageEnabledAvailable";
+const char kMassageModeAvailable[] = "massageModeAvailable";
+const char kMassageCushionFirmnessAvailable[] =
+ "massageCushionFirmnessAvailable";
+const char kMemoryAvailable[] = "memoryAvailable";
+
+// AudioControlCapabilities
+const char kSourceAvailable[] = "sourceAvailable";
+const char kKeepContextAvailable[] = "keepContextAvailable";
+const char kVolumeAvailable[] = "volumeAvailable";
+const char kEqualizerAvailable[] = "equalizerAvailable";
+
+// HmiSettingsCapabilities
+const char kDistanceUnitAvailable[] = "distanceUnitAvailable";
+const char kTemperatureUnitAvailable[] = "temperatureUnitAvailable";
+const char kDisplayModeUnitAvailable[] = "displayModeUnitAvailable";
+
+} // namespace strings
namespace result_codes {
const char kSuccess[] = "SUCCESS";
@@ -70,7 +160,7 @@ const char kWrongLanguage[] = "WRONG_LANGUAGE";
const char kGenericError[] = "GENERIC_ERROR";
const char kUserDisallowed[] = "USER_DISALLOWED";
const char kReadOnly[] = "READ_ONLY";
-} // result_codes
+} // namespace result_codes
namespace json_keys {
const char kParams[] = "params";
@@ -86,10 +176,25 @@ const char kMessage[] = "message";
const char kData[] = "data";
const char kAppId[] = "appID";
const char kCode[] = "code";
-} // json_keys
+} // namespace json_keys
namespace message_params {
const char kName[] = "name";
+const char kId[] = "id";
+
+// RCConsentManager, ResumptionCtrl, GetInteriorVehicleDataConsent request
+const char kModuleId[] = "moduleId";
+const char kModuleInfo[] = "moduleInfo";
+const char kAppConsents[] = "appConsents";
+const char kAppConsentList[] = "appConsentsList";
+const char kConsent[] = "consent";
+const char kConsentDate[] = "consentDate";
+const char kModuleConsents[] = "moduleConsents";
+const char kAppId[] = "appId";
+const char kModuleIds[] = "moduleIds";
+const char kMacAddress[] = "macAddress";
+const char kApplications[] = "applications";
+// RCConsentManager, ResumptionCtrl, GetInteriorVehicleDataConsent request
// SetInteriorVehicleData request
const char kModuleData[] = "moduleData";
@@ -114,6 +219,11 @@ const char kButtonName[] = "buttonName";
const char kButtonPressMode[] = "buttonPressMode";
// ButtonPress request
+// OnRCStatusNotification
+const char kAllocatedModules[] = "allocatedModules";
+const char kFreeModules[] = "freeModules";
+// OnRCStatusNotification
+
// RdsData struct
const char kPS[] = "PS";
const char kRT[] = "RT";
@@ -130,12 +240,16 @@ const char kFrequencyInteger[] = "frequencyInteger";
const char kFrequencyFraction[] = "frequencyFraction";
const char kBand[] = "band";
const char kRdsData[] = "rdsData";
+const char kHdRadioEnable[] = "hdRadioEnable";
const char kAvailableHDs[] = "availableHDs";
+const char kAvailableHdChannels[] = "availableHdChannels";
+const char kAvailableHdChannelsAvailable[] = "availableHdChannelsAvailable";
const char kHdChannel[] = "hdChannel";
const char kSignalStrength[] = "signalStrength";
const char kSignalChangeThreshold[] = "signalChangeThreshold";
const char kRadioEnable[] = "radioEnable";
const char kState[] = "state";
+const char kSisData[] = "sisData";
// RadioControlData struct
// ClimateControlData struct
@@ -150,17 +264,70 @@ const char kDefrostZone[] = "defrostZone";
const char kDualModeEnable[] = "dualModeEnable";
const char kACMaxEnable[] = "acMaxEnable";
const char kVentilationMode[] = "ventilationMode";
+const char kHeatedSteeringWheelEnable[] = "heatedSteeringWheelEnable";
+const char kHeatedWindshieldEnable[] = "heatedWindshieldEnable";
+const char kHeatedRearWindowEnable[] = "heatedRearWindowEnable";
+const char kHeatedMirrorsEnable[] = "heatedMirrorsEnable";
+const char kClimateEnable[] = "climateEnable";
+const char kClimateEnableAvailable[] = "climateEnableAvailable";
// ClimateControlData struct
+// SeatControlData
+const char kHeatingEnabled[] = "heatingEnabled";
+const char kCoolingEnabled[] = "coolingEnabled";
+const char kHeatingLevele[] = "heatingLevel";
+const char kCoolingLevel[] = "coolingLevel";
+const char kHorizontalPosition[] = "horizontalPosition";
+const char kVerticalPosition[] = "verticalPosition";
+const char kFrontVerticalPosition[] = "frontVerticalPosition";
+const char kBackVerticalPosition[] = "backVerticalPosition";
+const char kBackTiltAngle[] = "backTiltAngle";
+const char kHeadSupportHorizontalPosition[] = "headSupportHorizontalPosition";
+const char kHeadSupportVerticalPosition[] = "headSupportVerticalPosition";
+const char kMassageEnabled[] = "massageEnabled";
+const char kMassageMode[] = "massageMode";
+const char kMassageCushionFirmness[] = "massageCushionFirmness";
+const char kMemory[] = "memory";
+
+// LightControlData
+const char kLightState[] = "lightState";
+const char kLightStatus[] = "status";
+const char kLightDensity[] = "density";
+const char kLightColor[] = "color";
+
+// AudioControlData
+const char kSource[] = "source";
+const char kVolume[] = "volume";
+const char kKeepContext[] = "keepContext";
+const char kEqualizerSettings[] = "equalizerSettings";
+const char kChannelName[] = "channelName";
+
+// HmiSettingsControlData
+const char kDistanceUnit[] = "distanceUnit";
+const char kDisplayMode[] = "displayMode";
+
// ModuleData struct
const char kRadioControlData[] = "radioControlData";
const char kClimateControlData[] = "climateControlData";
+const char kAudioControlData[] = "audioControlData";
+const char kLightControlData[] = "lightControlData";
+const char kHmiSettingsControlData[] = "hmiSettingsControlData";
+const char kSeatControlData[] = "seatControlData";
// ModuleData struct
const char kHMIAppID[] = "appID";
const char kHmiLevel[] = "hmiLevel";
const char kSysContext[] = "systemContext";
const char kAudioState[] = "audioStreamingState";
+
+// Grid struct
+const char kCol[] = "col";
+const char kRow[] = "row";
+const char kLevel[] = "level";
+const char kColspan[] = "colspan";
+const char kRowspan[] = "rowspan";
+const char kLevelspan[] = "levelspan";
+
} // namespace message_params
namespace enums_value {
@@ -168,6 +335,10 @@ namespace enums_value {
// ModuleType enum
const char kClimate[] = "CLIMATE";
const char kRadio[] = "RADIO";
+const char kSeat[] = "SEAT";
+const char kAudio[] = "AUDIO";
+const char kLight[] = "LIGHT";
+const char kHmiSettings[] = "HMI_SETTINGS";
// ModuleType enum
// RadioBand enum
@@ -228,6 +399,6 @@ const char kAskDriver[] = "ASK_DRIVER";
} // namespace enums_value
-} // namespace remote_control
+} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RC_MODULE_CONSTANTS_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_MODULE_CONSTANTS_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
index 910eda6d3c..e12bd88e58 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
@@ -30,34 +30,50 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_PLUGIN_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_PLUGIN_H
-#include "application_manager/plugin_manager/rpc_plugin.h"
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_RPC_PLUGIN_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_RPC_PLUGIN_H_
+
+#include <memory>
+
#include "application_manager/command_factory.h"
+#include "application_manager/plugin_manager/rpc_plugin.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
+#include "rc_rpc_plugin/interior_data_manager.h"
+#include "rc_rpc_plugin/rc_capabilities_manager.h"
+#include "rc_rpc_plugin/rc_consent_manager.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
namespace rc_rpc_plugin {
namespace plugins = application_manager::plugin_manager;
namespace app_mngr = application_manager;
+
class RCRPCPlugin : public plugins::RPCPlugin {
public:
/**
- * @brief Command initialization function
- * @param app_manager ApplicationManager
- * @param rpc_service RPCService
- * @param hmi_capabilities HMICapabilities
- * @param policy_handler PolicyHandlerInterface
- * @return true in case initialization was succesful, false otherwise.
- **/
+ * @brief Command initialization function
+ * @param app_manager ApplicationManager
+ * @param rpc_service RPCService
+ * @param hmi_capabilities HMICapabilities
+ * @param policy_handler PolicyHandlerInterface
+ * @return true in case initialization was succesful, false otherwise.
+ **/
bool Init(app_mngr::ApplicationManager& app_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler) OVERRIDE;
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) OVERRIDE;
+
+ DEPRECATED
+ bool Init(app_mngr::ApplicationManager& app_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state) OVERRIDE;
/**
- * @param int32_t command id
- * @param CommandSource source
- * @return return true if command can be create, else return false
- **/
+ * @param int32_t command id
+ * @param CommandSource source
+ * @return return true if command can be create, else return false
+ **/
bool IsAbleToProcess(
const int32_t function_id,
const app_mngr::commands::Command::CommandSource message_source) OVERRIDE;
@@ -72,16 +88,17 @@ class RCRPCPlugin : public plugins::RPCPlugin {
* @return plugins command factory
*/
app_mngr::CommandFactory& GetCommandFactory() OVERRIDE;
+
/**
* @brief OnPolicyEvent Processes policy related events
* @param event Policy event
*/
void OnPolicyEvent(app_mngr::plugin_manager::PolicyEvent event) OVERRIDE;
/**
- * @brief OnApplicationEvent Notifies modules on certain application events
- * @param event Event
- * @param application Pointer to application struct
- */
+ * @brief OnApplicationEvent Notifies modules on certain application events
+ * @param event Event
+ * @param application Pointer to application struct
+ */
void OnApplicationEvent(plugins::ApplicationEvent event,
app_mngr::ApplicationSharedPtr application) OVERRIDE;
@@ -92,11 +109,18 @@ class RCRPCPlugin : public plugins::RPCPlugin {
application_manager::ApplicationManager& app_mngr);
private:
+ application_manager::rpc_service::RPCService* rpc_service_;
+ application_manager::ApplicationManager* app_mngr_;
+ std::unique_ptr<rc_rpc_plugin::RCConsentManager> rc_consent_manager_;
std::unique_ptr<application_manager::CommandFactory> command_factory_;
std::unique_ptr<ResourceAllocationManager> resource_allocation_manager_;
+ std::unique_ptr<InteriorDataCache> interior_data_cache_;
+ std::unique_ptr<InteriorDataManager> interior_data_manager_;
+ std::unique_ptr<RCCapabilitiesManager> rc_capabilities_manager_;
};
} // namespace rc_rpc_plugin
extern "C" application_manager::plugin_manager::RPCPlugin* Create();
+extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data);
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_PLUGIN_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_RPC_PLUGIN_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_types.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_types.h
new file mode 100644
index 0000000000..3698728aa6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_types.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_TYPES_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_TYPES_H
+
+#include <ctime>
+#include <string>
+#include <utility>
+#include <vector>
+
+namespace resumption {
+class LastState;
+} // namespace resumption
+
+namespace application_manager {
+class ApplicationManager;
+} // namespace application_manager
+
+namespace rc_rpc_plugin {
+namespace rc_rpc_types {
+/**
+ * @brief Module resource (module_type(first) + module_id(second))
+ */
+typedef std::pair<std::string, std::string> ModuleUid;
+
+/**
+ * @brief Module consent enum.
+ */
+enum class ModuleConsent {
+ NOT_EXISTS = 0, /**< Consent is absent for specified module resource */
+ CONSENTED, /**< Module resource is consented */
+ NOT_CONSENTED /**< Module resource isn't consented */
+};
+
+enum class ModuleConsentState {
+ NOT_EXISTS = 0, /**< Consent is absent for specified module resource */
+ EXPIRED, /**< Module resource is expired */
+ ACTIVE /**< Module resource isn't expired */
+};
+
+/**
+ * @brief Module consent
+ * @param module_id - Module resource for consent
+ * @param consent - Is module resource consented by driver
+ * @param date_of_consent - Date, when module resource has been consented (in
+ * seconds [UNIX time])
+ */
+struct ModuleIdConsent {
+ ModuleUid module_id;
+ ModuleConsent consent;
+ std::time_t date_of_consent;
+};
+
+/**
+ * @brief ModuleIdConsent collection
+ */
+typedef std::vector<ModuleIdConsent> ModuleIdConsentVector;
+} // namespace rc_rpc_types
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_TYPES_H
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h
index 0dc8b59f8f..ee0bd11885 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h
@@ -30,13 +30,13 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RESOURCE_ALLOCATION_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RESOURCE_ALLOCATION_MANAGER_H_
#include <string>
#include "utils/macro.h"
-#include "utils/shared_ptr.h"
-#include "interfaces/HMI_API.h"
+
#include "application_manager/plugin_manager/rpc_plugin.h"
+#include "interfaces/HMI_API.h"
#include "rc_rpc_plugin/rc_app_extension.h"
namespace rc_rpc_plugin {
@@ -56,55 +56,97 @@ enum eType { FREE = 0, BUSY };
}
/**
+ * Defines triggers for OnRCStatus notification sending
+ */
+namespace NotificationTrigger {
+/**
+ * @brief The eType
+ * APP_REGISTRATION RC app registation event
+ * RC_STATE_CHANGING enabling/disabling RC on HMI event
+ * MODULE_ALLOCATION module allocation/deallocation event
+ */
+enum eType { APP_REGISTRATION = 0, MODULE_ALLOCATION, RC_STATE_CHANGING };
+} // namespace NotificationTrigger
+
+/**
+ * Defines result of releasing specified module type resource.
+ */
+namespace ResourceReleasedState {
+/**
+ * NOT_ALLOCATED Module's resource is not allocated
+ * IS_ALLOCATED Module's resource is already allocated by
+ * different application
+ * IS_RELEASED Module's resource is released.
+ */
+enum eType { NOT_ALLOCATED = 0, IS_ALLOCATED, IS_RELEASED };
+} // namespace ResourceReleasedState
+
+/**
+ * @brief ModuleUid uniquely identify a module
+ * moduleType + moduleID
+ */
+typedef std::pair<std::string, std::string> ModuleUid;
+
+/**
* @brief Resources defines list of resources
*/
-typedef std::vector<std::string> Resources;
+typedef std::vector<ModuleUid> Resources;
class ResourceAllocationManager {
public:
/**
* @brief AcquireResource acquires resource by application
* @param module_type resource to acquire
+ * @param module_id uuid of a resource
* @param app_id application that acquire resource
* @return ALLOWED if resource acquired \
* IN_USE if resource already acquired
* ASK_DRIVER if driver confirmation is required
*/
virtual AcquireResult::eType AcquireResource(const std::string& module_type,
+ const std::string& module_id,
const uint32_t app_id) = 0;
/**
* @brief SetResourceState changes resource state. Resource must be acquired
* beforehand.
* @param module_type Resource to change its state
+ * @param module_id uuid of a resource
* @param app_id Application aquired resource before
* @param state State to set for resource
*/
virtual void SetResourceState(const std::string& module_type,
+ const std::string& module_id,
const uint32_t app_id,
const ResourceState::eType state) = 0;
/**
* @brief IsResourceFree check resource state
* @param module_type Resource name
+ * @param module_id uuid of a resource
* @return True if free, otherwise - false
*/
- virtual bool IsResourceFree(const std::string& module_type) const = 0;
+ virtual bool IsResourceFree(const std::string& module_type,
+ const std::string& module_id) const = 0;
/**
* @brief AcquireResource forces acquiring resource by application
* @param module_type resource to acquire
+ * @param module_id uuid of a resource
* @param app_id application that acquire resource
*/
virtual void ForceAcquireResource(const std::string& module_type,
+ const std::string& module_id,
const uint32_t app_id) = 0;
/**
* @brief OnDriverDisallowed callback for rejecting acquiring resource
* @param module_type resource type
+ * @param module_id uuid of a resource
* @param app_id application id
*/
virtual void OnDriverDisallowed(const std::string& module_type,
+ const std::string& module_id,
const uint32_t app_id) = 0;
/**
@@ -141,11 +183,61 @@ class ResourceAllocationManager {
*/
virtual void ResetAllAllocations() = 0;
- virtual RCAppExtensionPtr GetApplicationExtention(
+ /**
+ * @brief Create and send OnRCStatusNotification to mobile and HMI
+ * @param event trigger for notification sending
+ * @param application - app that should receive notification
+ * in case of registration; in cases of RC enabling/disabling
+ * or module allocation - application is just empty shared ptr,
+ * because in these cases all registered RC apps should
+ * receive a notification
+ */
+ virtual void SendOnRCStatusNotifications(
+ NotificationTrigger::eType event,
application_manager::ApplicationSharedPtr application) = 0;
+ virtual bool is_rc_enabled() const = 0;
+
+ virtual void set_rc_enabled(const bool value) = 0;
+
+ /**
+ * @brief ReleaseResource Releases resource acquired by application
+ * @param module_type Module name
+ * @param module_id uuid of a module
+ * @param application_id Application id
+ */
+ virtual ResourceReleasedState::eType ReleaseResource(
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t application_id) = 0;
+
+ /**
+ * @brief SetResourceAquired mark resourse as aquired and process logic of
+ * changing state of aquired resources
+ * @param module_type resource name
+ * @param module_id uuid of a resource
+ * @param app applicastion that aquire resource
+ */
+ virtual void SetResourceAcquired(const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) = 0;
+
+ /**
+ * @brief Checks if specific resource is already aquired by specific
+ * application
+ * @param moduleUid Module resurce (module type + module ID)
+ * @param app_id Application ID which try to aquire resource
+ * @return true In case when resource is already aquired by specific
+ * application
+ * @return false In case when isn't aquired by specific
+ * application
+ */
+ virtual bool IsResourceAlreadyAcquiredByApp(
+ const rc_rpc_plugin::ModuleUid& moduleUid,
+ const uint32_t app_id) const = 0;
+
virtual ~ResourceAllocationManager() {}
};
} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RESOURCE_ALLOCATION_MANAGER_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h
index bb875bb180..0fd5449912 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h
@@ -30,13 +30,14 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H
-#define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H
-#include "rc_rpc_plugin/resource_allocation_manager.h"
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RESOURCE_ALLOCATION_MANAGER_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RESOURCE_ALLOCATION_MANAGER_IMPL_H_
#include "application_manager/application_impl.h"
#include "rc_rpc_plugin/rc_app_extension.h"
-#include "utils/macro.h"
+#include "rc_rpc_plugin/rc_capabilities_manager.h"
+#include "rc_rpc_plugin/resource_allocation_manager.h"
#include "utils/lock.h"
+#include "utils/macro.h"
namespace rc_rpc_plugin {
@@ -46,43 +47,52 @@ class ResourceAllocationManagerImpl : public ResourceAllocationManager {
public:
ResourceAllocationManagerImpl(
application_manager::ApplicationManager& app_mngr,
- application_manager::rpc_service::RPCService& rpc_service);
+ application_manager::rpc_service::RPCService& rpc_service,
+ rc_rpc_plugin::RCCapabilitiesManager& rc_capabilities_manager);
~ResourceAllocationManagerImpl();
/**
* @brief AcquireResource forces acquiring resource by application
* @param module_type resource to acquire
+ * @param module_id uuid of a resource
* @param app_id application that acquire resourc
* @return result of acauiring resources
*/
AcquireResult::eType AcquireResource(const std::string& module_type,
+ const std::string& module_id,
const uint32_t app_id) OVERRIDE FINAL;
/**
* @brief ForceAcquireResource forces acquiring resource by application
* @param module_type resource to acquire
+ * @param module_id uuid of a resource
* @param app_id application that acquire resource
*/
void ForceAcquireResource(const std::string& module_type,
+ const std::string& module_id,
const uint32_t app_id) FINAL;
/**
- * @brief SetResourceState changes resource state. Resource must be acquired
- * beforehand.
- * @param module_type Resource to change its state
- * @param app_id Application aquired resource before
- * @param state State to set for resource
- */
+ * @brief SetResourceState changes resource state. Resource must be acquired
+ * beforehand.
+ * @param module_type Resource to change its state
+ * @param module_id uuid of a resource
+ * @param app_id Application aquired resource before
+ * @param state State to set for resource
+ */
void SetResourceState(const std::string& module_type,
+ const std::string& module_id,
const uint32_t app_id,
const ResourceState::eType state) FINAL;
/**
* @brief IsResourceFree check resource state
* @param module_type Resource name
+ * @param module_id uuid of a resource
* @return True if free, otherwise - false
*/
- bool IsResourceFree(const std::string& module_type) const FINAL;
+ bool IsResourceFree(const std::string& module_type,
+ const std::string& module_id) const FINAL;
void SetAccessMode(
const hmi_apis::Common_RCAccessMode::eType access_mode) FINAL;
@@ -90,6 +100,7 @@ class ResourceAllocationManagerImpl : public ResourceAllocationManager {
hmi_apis::Common_RCAccessMode::eType GetAccessMode() const FINAL;
void OnDriverDisallowed(const std::string& module_type,
+ const std::string& module_id,
const uint32_t app_id) FINAL;
/**
@@ -110,33 +121,62 @@ class ResourceAllocationManagerImpl : public ResourceAllocationManager {
void ResetAllAllocations() FINAL;
- /**
- * @brief GetApplicationExtention Provides access to application RC extention
- * @param application Application
- * @return Pointer to RC extention of application or NULL if not available
- */
- RCAppExtensionPtr GetApplicationExtention(
+ void SendOnRCStatusNotifications(
+ NotificationTrigger::eType event,
application_manager::ApplicationSharedPtr application) FINAL;
+ bool is_rc_enabled() const FINAL;
+
+ void set_rc_enabled(const bool value) FINAL;
+
+ ResourceReleasedState::eType ReleaseResource(
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t application_id) FINAL;
+
+ void SetResourceAcquired(const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) FINAL;
+
+ bool IsResourceAlreadyAcquiredByApp(const rc_rpc_plugin::ModuleUid& moduleUid,
+ const uint32_t app_id) const FINAL;
+
private:
+ typedef std::vector<application_manager::ApplicationSharedPtr> Apps;
+
+ /**
+ * @brief Create OnRCStatusNotification creates OnRCStatus notification smart
+ * object for mobile application
+ * @param app_id application to send OnRCStatusNotification
+ * @return smart object with mobile OnRCStatusNotification
+ */
+ smart_objects::SmartObjectSPtr CreateOnRCStatusNotificationToMobile(
+ const application_manager::ApplicationSharedPtr app);
+
+ smart_objects::SmartObjectSPtr CreateOnRCStatusNotificationToHmi(
+ const application_manager::ApplicationSharedPtr app);
+
/**
* @brief IsModuleTypeRejected check if current resource was rejected by
* driver for current application
* @param module_type resource to check
+ * @param module_id uuid of a resource
* @param app_id application id
* @return true if current resource was rejected by driver for current
* application, otherwise - false
*/
bool IsModuleTypeRejected(const std::string& module_type,
+ const std::string& module_id,
const uint32_t app_id);
/**
- * @brief ReleaseResource Releases resource acquired by application
+ * @brief ReleaseModuleType Releases all resources related to
+ * the corresponding module type acquired by application
* @param module_type Module name
* @param application_id Application id
*/
- void ReleaseResource(const std::string& module_type,
- const uint32_t application_id);
+ void ReleaseModuleType(const std::string& module_type,
+ const uint32_t application_id);
/**
* @brief GetAcquiredResources Provides resources acquired by particular
@@ -147,6 +187,15 @@ class ResourceAllocationManagerImpl : public ResourceAllocationManager {
Resources GetAcquiredResources(const uint32_t application_id) const;
/**
+ * @brief GetAcquiredModuleTypes Provides module types acquired by particular
+ * application currently
+ * @param application_id Application id
+ * @return List of acquired module types by specific application
+ */
+ std::set<std::string> GetAcquiredModuleTypes(
+ const uint32_t application_id) const;
+
+ /**
* @brief ProcessApplicationPolicyUpdate Checks if allowed modules list is
* changed for registered RC applications and releases in case some modules
* now out of the list
@@ -161,34 +210,38 @@ class ResourceAllocationManagerImpl : public ResourceAllocationManager {
void RemoveAppsSubscriptions(const Apps& apps);
/**
- * @brief SetResourceAquired mark resourse as aquired and process logic of
+ * @brief SetResourceFree mark resourse as free and process logic of
* changing state of aquired resources
* @param module_type resource name
+ * @param module_id uuid of a resource
* @param app applicastion that aquire resource
*/
- void SetResourceAquired(const std::string& module_type,
- const uint32_t app_id);
+ ResourceReleasedState::eType SetResourceFree(const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id);
/**
- * @brief SetResourceFree mark resourse as free and process logic of
- * changing state of aquired resources
- * @param module_type resource name
- * @param app applicastion that aquire resource
+ * @brief CheckLocation checks if the user's grid is equal to or is within the
+ * service area of the module, or user location is driver's seat
+ * @param module module type + module id
+ * @return true if the user's grid equals to or is within module service
+ * area or user location is driver's seat, otherwise - false
*/
- void SetResourceFree(const std::string& module_type, const uint32_t app_id);
+ bool IsUserLocationValid(ModuleUid& module,
+ application_manager::ApplicationSharedPtr app);
- std::vector<std::string> all_supported_modules();
/**
* @brief AllocatedResources contains link between resource and application
* owning that resource
*/
- typedef std::map<std::string, uint32_t> AllocatedResources;
+
+ typedef std::map<ModuleUid, uint32_t> AllocatedResources;
AllocatedResources allocated_resources_;
mutable sync_primitives::Lock allocated_resources_lock_;
/**
* @brief ResourcesState contains states of ALLOCATED resources
*/
- typedef std::map<std::string, ResourceState::eType> ResourcesState;
+ typedef std::map<ModuleUid, ResourceState::eType> ResourcesState;
ResourcesState resources_state_;
mutable sync_primitives::Lock resources_state_lock_;
@@ -197,14 +250,16 @@ class ResourceAllocationManagerImpl : public ResourceAllocationManager {
* driver for application
* application_id : [vector of rejected resources]
*/
- typedef std::map<uint32_t, std::vector<std::string> > RejectedResources;
+ typedef std::map<uint32_t, std::vector<ModuleUid> > RejectedResources;
RejectedResources rejected_resources_for_application_;
mutable sync_primitives::Lock rejected_resources_for_application_lock_;
hmi_apis::Common_RCAccessMode::eType current_access_mode_;
application_manager::ApplicationManager& app_mngr_;
application_manager::rpc_service::RPCService& rpc_service_;
+ rc_rpc_plugin::RCCapabilitiesManager& rc_capabilities_manager_;
+ bool is_rc_enabled_;
};
-} // rc_rpc_plugin
+} // namespace rc_rpc_plugin
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_IMPL_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RESOURCE_ALLOCATION_MANAGER_IMPL_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc
index d392420238..75faf5db8c 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_request.cc
@@ -31,6 +31,8 @@
*/
#include "rc_rpc_plugin/commands/hmi/rc_button_press_request.h"
+#include "rc_rpc_plugin/resource_allocation_manager_impl.h"
+
#include "utils/macro.h"
namespace rc_rpc_plugin {
@@ -38,18 +40,12 @@ namespace commands {
RCButtonPressRequest::RCButtonPressRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager::commands::RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ const RCCommandParams& params)
+ : app_mngr::commands::RequestToHMI(message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
RCButtonPressRequest::~RCButtonPressRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc
index c7c11354c7..5c1691ed7b 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_button_press_response.cc
@@ -37,19 +37,14 @@ namespace rc_rpc_plugin {
namespace commands {
RCButtonPressResponse::RCButtonPressResponse(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager::commands::ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params)
+ : application_manager::commands::ResponseFromHMI(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
void RCButtonPressResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc
index 875f1c8fbf..774ee04677 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_request.cc
@@ -38,18 +38,12 @@ namespace commands {
RCGetInteriorVehicleDataConsentRequest::RCGetInteriorVehicleDataConsentRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
+ const RCCommandParams& params)
: application_manager::commands::RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
RCGetInteriorVehicleDataConsentRequest::
~RCGetInteriorVehicleDataConsentRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc
index 3a9bb12df1..3244857656 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_consent_response.cc
@@ -38,19 +38,14 @@ namespace commands {
RCGetInteriorVehicleDataConsentResponse::
RCGetInteriorVehicleDataConsentResponse(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager::commands::ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params)
+ : application_manager::commands::ResponseFromHMI(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
void RCGetInteriorVehicleDataConsentResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc
index 0bb5f73c1b..c7baf75e27 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc
@@ -38,18 +38,12 @@ namespace commands {
RCGetInteriorVehicleDataRequest::RCGetInteriorVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
+ const RCCommandParams& params)
: application_manager::commands::RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
RCGetInteriorVehicleDataRequest::~RCGetInteriorVehicleDataRequest() {}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc
index f12512a38d..a366aa65fa 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_response.cc
@@ -32,30 +32,38 @@
#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h"
#include "application_manager/event_engine/event.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
namespace rc_rpc_plugin {
namespace commands {
RCGetInteriorVehicleDataResponse::RCGetInteriorVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager::commands::ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ const RCCommandParams& params)
+ : application_manager::commands::ResponseFromHMI(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
void RCGetInteriorVehicleDataResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
app_mngr::event_engine::Event event(
hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+
+ smart_objects::SmartObject& module_data =
+ (*message_)[application_manager::strings::msg_params]
+ [message_params::kModuleData];
+ if (module_data.keyExists(message_params::kAudioControlData)) {
+ smart_objects::SmartObject& audio_control_data =
+ module_data[message_params::kAudioControlData];
+ if (audio_control_data.keyExists(message_params::kKeepContext)) {
+ audio_control_data.erase(message_params::kKeepContext);
+ }
+ }
+
event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc
index 487193bc4d..c6cf1b0d5a 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_interior_vehicle_data_notification.cc
@@ -31,6 +31,7 @@
*/
#include "rc_rpc_plugin/commands/hmi/rc_on_interior_vehicle_data_notification.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
#include "utils/macro.h"
namespace rc_rpc_plugin {
@@ -38,18 +39,13 @@ namespace commands {
RCOnInteriorVehicleDataNotification::RCOnInteriorVehicleDataNotification(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager::commands::NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ const RCCommandParams& params)
+ : application_manager::commands::NotificationFromHMI(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
RCOnInteriorVehicleDataNotification::~RCOnInteriorVehicleDataNotification() {}
@@ -57,6 +53,18 @@ void RCOnInteriorVehicleDataNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
(*message_)[app_mngr::strings::params][app_mngr::strings::function_id] =
static_cast<int>(mobile_apis::FunctionID::eType::OnInteriorVehicleDataID);
+
+ smart_objects::SmartObject& module_data =
+ (*message_)[application_manager::strings::msg_params]
+ [message_params::kModuleData];
+ if (module_data.keyExists(rc_rpc_plugin::message_params::kAudioControlData)) {
+ smart_objects::SmartObject& audio_control_data =
+ module_data[message_params::kAudioControlData];
+ if (audio_control_data.keyExists(message_params::kKeepContext)) {
+ audio_control_data.erase(message_params::kKeepContext);
+ }
+ }
+
SendNotificationToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
index 817223a369..45b0d13582 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc
@@ -31,8 +31,10 @@
*/
#include "rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h"
-#include "rc_rpc_plugin/rc_rpc_plugin.h"
+#include "rc_rpc_plugin/interior_data_manager.h"
+#include "rc_rpc_plugin/rc_helpers.h"
#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
#include "utils/macro.h"
namespace rc_rpc_plugin {
@@ -49,17 +51,16 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
RCOnRemoteControlSettingsNotification::RCOnRemoteControlSettingsNotification(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager::commands::NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle)
- , resource_allocation_manager_(resource_allocation_manager) {}
+ const RCCommandParams& params)
+ : application_manager::commands::NotificationFromHMI(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
+ , resource_allocation_manager_(params.resource_allocation_manager_)
+ , interior_data_manager_(params.interior_data_manager_)
+ , rc_consent_manager_(params.rc_consent_manager_) {}
RCOnRemoteControlSettingsNotification::
~RCOnRemoteControlSettingsNotification() {}
@@ -87,30 +88,9 @@ std::string AccessModeToString(
return error;
}
-void UnsubscribeFromInteriorVehicleDataForAllModules(
- RCAppExtensionPtr extension) {
- LOG4CXX_AUTO_TRACE(logger_);
- extension->UnsubscribeFromInteriorVehicleData(enums_value::kClimate);
- extension->UnsubscribeFromInteriorVehicleData(enums_value::kRadio);
-}
-
void RCOnRemoteControlSettingsNotification::DisallowRCFunctionality() {
LOG4CXX_AUTO_TRACE(logger_);
- typedef std::vector<application_manager::ApplicationSharedPtr> Apps;
- Apps apps = RCRPCPlugin::GetRCApplications(application_manager_);
- for (Apps::iterator it = apps.begin(); it != apps.end(); ++it) {
- application_manager::ApplicationSharedPtr app = *it;
- DCHECK(app);
- application_manager_.ChangeAppsHMILevel(
- app->app_id(), mobile_apis::HMILevel::eType::HMI_NONE);
-
- const RCAppExtensionPtr extension =
- application_manager::AppExtensionPtr::static_pointer_cast<
- RCAppExtension>(app->QueryInterface(RCRPCPlugin::kRCPluginID));
- if (extension) {
- UnsubscribeFromInteriorVehicleDataForAllModules(extension);
- }
- }
+ interior_data_manager_.OnDisablingRC();
}
void RCOnRemoteControlSettingsNotification::Run() {
@@ -131,11 +111,13 @@ void RCOnRemoteControlSettingsNotification::Run() {
hmi_apis::Common_RCAccessMode::eType access_mode =
hmi_apis::Common_RCAccessMode::INVALID_ENUM;
LOG4CXX_DEBUG(logger_, "Allowing RC Functionality");
+ resource_allocation_manager_.set_rc_enabled(true);
if ((*message_)[app_mngr::strings::msg_params].keyExists(
message_params::kAccessMode)) {
access_mode = static_cast<hmi_apis::Common_RCAccessMode::eType>(
(*message_)[app_mngr::strings::msg_params]
- [message_params::kAccessMode].asUInt());
+ [message_params::kAccessMode]
+ .asUInt());
LOG4CXX_DEBUG(
logger_,
"Setting up access mode : " << AccessModeToString(access_mode));
@@ -150,6 +132,8 @@ void RCOnRemoteControlSettingsNotification::Run() {
LOG4CXX_DEBUG(logger_, "Disallowing RC Functionality");
DisallowRCFunctionality();
resource_allocation_manager_.ResetAllAllocations();
+ resource_allocation_manager_.set_rc_enabled(false);
+ rc_consent_manager_.RemoveAllConsents();
}
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc
new file mode 100644
index 0000000000..2f203afc2d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_request.cc
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "rc_rpc_plugin/commands/hmi/rc_set_global_properties_request.h"
+
+namespace rc_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+RCSetGlobalPropertiesRequest::RCSetGlobalPropertiesRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ const RCCommandParams& params)
+ : app_mngr::commands::RequestToHMI(message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
+
+void RCSetGlobalPropertiesRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+RCSetGlobalPropertiesRequest::~RCSetGlobalPropertiesRequest() {}
+
+} // namespace commands
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc
new file mode 100644
index 0000000000..c31314ec21
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_global_properties_response.cc
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "rc_rpc_plugin/commands/hmi/rc_set_global_properties_response.h"
+
+namespace rc_rpc_plugin {
+namespace commands {
+
+RCSetGlobalPropertiesResponse::RCSetGlobalPropertiesResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ const RCCommandParams& params)
+ : application_manager::commands::ResponseFromHMI(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
+
+void RCSetGlobalPropertiesResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ app_mngr::event_engine::Event event(
+ hmi_apis::FunctionID::RC_SetGlobalProperties);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+RCSetGlobalPropertiesResponse::~RCSetGlobalPropertiesResponse() {}
+} // namespace commands
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc
index 69ceed17e9..f0d5ecc177 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_request.cc
@@ -38,18 +38,12 @@ namespace commands {
RCSetInteriorVehicleDataRequest::RCSetInteriorVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
+ const RCCommandParams& params)
: application_manager::commands::RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
RCSetInteriorVehicleDataRequest::~RCSetInteriorVehicleDataRequest() {}
void RCSetInteriorVehicleDataRequest::Run() {
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc
index 42c2452943..56d924debe 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_set_interior_vehicle_data_response.cc
@@ -38,18 +38,13 @@ namespace commands {
RCSetInteriorVehicleDataResponse::RCSetInteriorVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager::commands::ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ const RCCommandParams& params)
+ : application_manager::commands::ResponseFromHMI(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
void RCSetInteriorVehicleDataResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc
index 88e4ebaa3c..3adc48dfbf 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc
@@ -31,12 +31,13 @@
*/
#include "rc_rpc_plugin/commands/mobile/button_press_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "json/json.h"
+#include "rc_rpc_plugin/rc_helpers.h"
#include "rc_rpc_plugin/rc_module_constants.h"
#include "smart_objects/enum_schema_item.h"
-#include "utils/macro.h"
-#include "json/json.h"
#include "utils/helpers.h"
-#include "interfaces/MOBILE_API.h"
+#include "utils/macro.h"
namespace rc_rpc_plugin {
namespace commands {
@@ -46,164 +47,51 @@ using namespace message_params;
CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
-typedef std::map<std::string, mobile_apis::ButtonName::eType> ButtonsMap;
-
ButtonPressRequest::ButtonPressRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : RCCommandRequest(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle,
- resource_allocation_manager) {}
+ const RCCommandParams& params)
+ : RCCommandRequest(message, params) {}
ButtonPressRequest::~ButtonPressRequest() {}
-const std::vector<std::string> buttons_climate() {
- std::vector<std::string> data;
- data.push_back(enums_value::kACMax);
- data.push_back(enums_value::kAC);
- data.push_back(enums_value::kRecirculate);
- data.push_back(enums_value::kFanUp);
- data.push_back(enums_value::kFanDown);
- data.push_back(enums_value::kTempUp);
- data.push_back(enums_value::kTempDown);
- data.push_back(enums_value::kDefrostMax);
- data.push_back(enums_value::kDefrost);
- data.push_back(enums_value::kDefrostRear);
- data.push_back(enums_value::kUpperVent);
- data.push_back(enums_value::kLowerVent);
- return data;
-}
-
-const std::vector<std::string> buttons_radio() {
- std::vector<std::string> data;
- data.push_back(enums_value::kVolumeUp);
- data.push_back(enums_value::kVolumeDown);
- data.push_back(enums_value::kEject);
- data.push_back(enums_value::kSource);
- data.push_back(enums_value::kShuffle);
- data.push_back(enums_value::kRepeat);
- return data;
-}
-
-const ButtonsMap buttons_map() {
- using namespace mobile_apis;
-
- ButtonsMap buttons_map;
- buttons_map[enums_value::kACMax] = ButtonName::AC_MAX;
- buttons_map[enums_value::kAC] = ButtonName::AC;
- buttons_map[enums_value::kRecirculate] = ButtonName::RECIRCULATE;
- buttons_map[enums_value::kFanUp] = ButtonName::FAN_UP;
- buttons_map[enums_value::kFanDown] = ButtonName::FAN_DOWN;
- buttons_map[enums_value::kTempUp] = ButtonName::TEMP_UP;
- buttons_map[enums_value::kTempDown] = ButtonName::TEMP_DOWN;
- buttons_map[enums_value::kDefrostMax] = ButtonName::DEFROST_MAX;
- buttons_map[enums_value::kDefrost] = ButtonName::DEFROST;
- buttons_map[enums_value::kDefrostRear] = ButtonName::DEFROST_REAR;
- buttons_map[enums_value::kUpperVent] = ButtonName::UPPER_VENT;
- buttons_map[enums_value::kLowerVent] = ButtonName::LOWER_VENT;
- buttons_map[enums_value::kVolumeUp] = ButtonName::VOLUME_UP;
- buttons_map[enums_value::kVolumeDown] = ButtonName::VOLUME_DOWN;
- buttons_map[enums_value::kEject] = ButtonName::EJECT;
- buttons_map[enums_value::kSource] = ButtonName::SOURCE;
- buttons_map[enums_value::kShuffle] = ButtonName::SHUFFLE;
- buttons_map[enums_value::kRepeat] = ButtonName::REPEAT;
-
- return buttons_map;
-}
-
-bool CheckIfButtonExistInRCCaps(
- const smart_objects::SmartObject& rc_capabilities,
- const mobile_apis::ButtonName::eType button) {
- if (rc_capabilities.keyExists(strings::kbuttonCapabilities)) {
- const smart_objects::SmartObject& button_caps =
- rc_capabilities[strings::kbuttonCapabilities];
- auto it = button_caps.asArray()->begin();
- for (; it != button_caps.asArray()->end(); ++it) {
- smart_objects::SmartObject& so = *it;
- int64_t current_id = so[message_params::kName].asInt();
- if (-1 == current_id) {
- // capabilities received from HMI contains enum values
- // capabilities loaded from file contains string values
- // TODO : unificate capabilities storing
- const std::string& bt_name = so[message_params::kName].asString();
- static ButtonsMap btn_map = buttons_map();
- current_id = btn_map[bt_name];
- }
- const mobile_apis::ButtonName::eType current_button =
- static_cast<mobile_apis::ButtonName::eType>(current_id);
- if (current_button == button) {
- LOG4CXX_TRACE(logger_,
- "Button id " << current_button
- << " exist in capabilities");
- return true;
- }
- }
- }
- LOG4CXX_TRACE(logger_,
- "Button id " << button << " do not exist in capabilities");
- return false;
+std::string ButtonPressRequest::GetButtonName() const {
+ mobile_apis::ButtonName::eType button_name =
+ static_cast<mobile_apis::ButtonName::eType>(
+ (*message_)[app_mngr::strings::msg_params]
+ [message_params::kButtonName]
+ .asUInt());
+ const char* str;
+ const bool ok = ns_smart_device_link::ns_smart_objects::EnumConversionHelper<
+ mobile_apis::ButtonName::eType>::EnumToCString(button_name, &str);
+ return ok ? str : "unknown";
}
-bool CheckButtonName(const std::string& module_type,
- const std::string& button_name,
- const smart_objects::SmartObject* rc_capabilities) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (rc_capabilities == NULL) {
- LOG4CXX_ERROR(logger_, "No remote controll capabilities available");
- return false;
- }
-
- if (enums_value::kRadio == module_type) {
- if (!helpers::in_range(buttons_radio(), button_name)) {
- LOG4CXX_WARN(logger_,
- "Trying to acceess climate button with module type radio");
- return false;
- }
- }
-
- if (enums_value::kClimate == module_type) {
- if (!helpers::in_range(buttons_climate(), button_name)) {
- LOG4CXX_WARN(logger_,
- "Trying to acceess radio button with module type climate");
- return false;
- }
+const mobile_apis::ButtonName::eType ButtonPressRequest::GetButtonId() const {
+ const auto button_name = GetButtonName();
+ static RCHelpers::ButtonsMap btn_map = RCHelpers::buttons_map();
+ mobile_apis::ButtonName::eType button_id =
+ mobile_apis::ButtonName::INVALID_ENUM;
+ if (btn_map.end() != btn_map.find(button_name)) {
+ button_id = btn_map[button_name];
}
- return true;
+ return button_id;
}
void ButtonPressRequest::Execute() {
LOG4CXX_AUTO_TRACE(logger_);
-
- const char* button_name;
- NsSmartDeviceLink::NsSmartObjects::
- EnumConversionHelper<mobile_apis::ButtonName::eType>::EnumToCString(
- static_cast<mobile_apis::ButtonName::eType>(
- (*message_)[app_mngr::strings::msg_params]
- [message_params::kButtonName].asUInt()),
- &button_name);
-
const std::string module_type = ModuleType();
- static ButtonsMap btn_map = buttons_map();
- mobile_apis::ButtonName::eType button_id =
- mobile_apis::ButtonName::INVALID_ENUM;
- if (btn_map.end() != btn_map.find(button_name)) {
- button_id = btn_map[button_name];
- }
- const smart_objects::SmartObject* rc_capabilities =
- hmi_capabilities_.rc_capability();
const bool button_name_matches_module_type =
- CheckButtonName(module_type, button_name, rc_capabilities);
- const bool button_id_exist_in_caps =
- rc_capabilities &&
- CheckIfButtonExistInRCCaps(*rc_capabilities, button_id);
+ rc_capabilities_manager_.CheckButtonName(module_type, GetButtonName());
+
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
+ const bool is_module_exists =
+ rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module);
+
+ const bool button_valid_by_caps =
+ is_module_exists &&
+ rc_capabilities_manager_.CheckIfButtonExistInRCCaps(GetButtonId());
app_mngr::ApplicationSharedPtr app =
application_manager_.application(connection_key());
@@ -211,7 +99,9 @@ void ButtonPressRequest::Execute() {
(*message_)[app_mngr::strings::msg_params][app_mngr::strings::app_id] =
app->app_id();
- if (button_name_matches_module_type && button_id_exist_in_caps) {
+ if (button_name_matches_module_type && button_valid_by_caps) {
+ (*message_)[app_mngr::strings::msg_params][message_params::kModuleId] =
+ module_id;
SendHMIRequest(hmi_apis::FunctionID::Buttons_ButtonPress,
&(*message_)[app_mngr::strings::msg_params],
true);
@@ -222,11 +112,12 @@ void ButtonPressRequest::Execute() {
mobile_apis::Result::INVALID_DATA,
"Request module type and button name mismatch!");
} else {
- LOG4CXX_WARN(logger_, "Requested button is not exists in capabilities!");
+ LOG4CXX_WARN(logger_,
+ "Requested button or module does not exist in capabilities!");
SetResourceState(module_type, ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
- "Requested button is not exists in capabilities!");
+ "Requested button or module does not exist in capabilities!");
}
}
@@ -236,13 +127,15 @@ AcquireResult::eType ButtonPressRequest::AcquireResource(
const std::string module_type = ModuleType();
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
- return resource_allocation_manager_.AcquireResource(module_type,
- app->app_id());
+
+ return resource_allocation_manager_.AcquireResource(
+ module_type, ModuleId(), app->app_id());
}
-bool ButtonPressRequest::IsResourceFree(const std::string& module_type) const {
+bool ButtonPressRequest::IsResourceFree(const std::string& module_type,
+ const std::string& module_id) const {
LOG4CXX_AUTO_TRACE(logger_);
- return resource_allocation_manager_.IsResourceFree(module_type);
+ return resource_allocation_manager_.IsResourceFree(module_type, module_id);
}
void ButtonPressRequest::SetResourceState(const std::string& module_type,
@@ -250,8 +143,9 @@ void ButtonPressRequest::SetResourceState(const std::string& module_type,
LOG4CXX_AUTO_TRACE(logger_);
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
+
resource_allocation_manager_.SetResourceState(
- module_type, app->app_id(), state);
+ module_type, ModuleId(), app->app_id(), state);
}
void ButtonPressRequest::on_event(const app_mngr::event_engine::Event& event) {
@@ -278,22 +172,64 @@ void ButtonPressRequest::on_event(const app_mngr::event_engine::Event& event) {
result = false;
result_code = mobile_apis::Result::GENERIC_ERROR;
}
+
+ const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+
+ const rc_rpc_types::ModuleUid resource{module_type, module_id};
+ auto app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "NULL pointer.");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, "");
+ return;
+ }
+
+ const auto app_id = app->app_id();
+
+ bool is_resource_acquired = false;
+
+ if (result && !resource_allocation_manager_.IsResourceAlreadyAcquiredByApp(
+ resource, app_id)) {
+ resource_allocation_manager_.SetResourceAcquired(
+ module_type, module_id, app_id);
+
+ is_resource_acquired = true;
+ }
+
std::string response_info;
GetInfo(message, response_info);
- SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(result, result_code, response_info.c_str());
+
+ if (is_resource_acquired) {
+ resource_allocation_manager_.SendOnRCStatusNotifications(
+ NotificationTrigger::MODULE_ALLOCATION,
+ std::shared_ptr<application_manager::Application>());
+ }
}
-std::string ButtonPressRequest::ModuleType() {
- mobile_apis::ModuleType::eType module_type = static_cast<
- mobile_apis::ModuleType::eType>(
- (*message_)[app_mngr::strings::msg_params][message_params::kModuleType]
- .asUInt());
+std::string ButtonPressRequest::ModuleType() const {
+ mobile_apis::ModuleType::eType module_type =
+ static_cast<mobile_apis::ModuleType::eType>(
+ (*message_)[app_mngr::strings::msg_params]
+ [message_params::kModuleType]
+ .asUInt());
const char* str;
- const bool ok = NsSmartDeviceLink::NsSmartObjects::EnumConversionHelper<
+ const bool ok = ns_smart_device_link::ns_smart_objects::EnumConversionHelper<
mobile_apis::ModuleType::eType>::EnumToCString(module_type, &str);
return ok ? str : "unknown";
}
+std::string ButtonPressRequest::ModuleId() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto msg_params = (*message_)[app_mngr::strings::msg_params];
+ if (msg_params.keyExists(message_params::kModuleId)) {
+ return msg_params[message_params::kModuleId].asString();
+ }
+ const std::string module_id =
+ rc_capabilities_manager_.GetDefaultModuleIdFromCapabilities(ModuleType());
+ return module_id;
+}
+
} // namespace commands
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc
index dfdb128322..491b0363c9 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_response.cc
@@ -38,18 +38,13 @@ namespace commands {
ButtonPressResponse::ButtonPressResponse(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager::commands::CommandResponseImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ const RCCommandParams& params)
+ : application_manager::commands::CommandResponseImpl(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
ButtonPressResponse::~ButtonPressResponse() {}
void ButtonPressResponse::Run() {
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc
new file mode 100644
index 0000000000..fd661afd5f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc
@@ -0,0 +1,472 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <algorithm>
+#include <ctime>
+#include <numeric>
+#include <vector>
+
+#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_request.h"
+#include "rc_rpc_plugin/rc_helpers.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_types.h"
+#include "smart_objects/enum_schema_item.h"
+
+namespace rc_rpc_plugin {
+namespace app_mngr = application_manager;
+namespace commands {
+
+GetInteriorVehicleDataConsentRequest::GetInteriorVehicleDataConsentRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params)
+ : RCCommandRequest(message, params) {}
+
+void GetInteriorVehicleDataConsentRequest::Execute() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto& msg_params = (*message_)[app_mngr::strings::msg_params];
+
+ const bool module_ids_exists =
+ msg_params.keyExists(message_params::kModuleIds);
+ if (!module_ids_exists) {
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "ModuleIds collection is absent in request message");
+ return;
+ }
+
+ if (msg_params[message_params::kModuleIds].empty()) {
+ LOG4CXX_DEBUG(logger_,
+ "ModuleIds collection is empty. Will be add default "
+ "module_id from capabilities");
+
+ const auto module_id =
+ rc_capabilities_manager_.GetDefaultModuleIdFromCapabilities(
+ ModuleType());
+
+ msg_params[message_params::kModuleIds][0] = module_id;
+ }
+
+ const std::string module_type = ModuleType();
+ for (const auto module_id :
+ *(msg_params[message_params::kModuleIds].asArray())) {
+ const ModuleUid module(module_type, module_id.asString());
+ if (!rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) {
+ LOG4CXX_WARN(logger_,
+ "Accessing not supported module: " << module_type << " "
+ << module_id.asString());
+ SetResourceState(module_type, ResourceState::FREE);
+ SendResponse(false,
+ mobile_apis::Result::UNSUPPORTED_RESOURCE,
+ "Accessing not supported module data");
+ return;
+ }
+ }
+
+ smart_objects::SmartObject response_params;
+ if (GetCalculatedVehicleDataConsent(response_params)) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "No need to send request to HMI. Sending cached consents to mobile");
+ SendResponse(true, mobile_apis::Result::SUCCESS, nullptr, &response_params);
+ return;
+ }
+
+ (*message_)[application_manager::strings::msg_params]
+ [application_manager::strings::app_id] = connection_key();
+
+ hmi_request_consents_ =
+ smart_objects::SmartObject(response_params[message_params::kAllowed]);
+
+ LOG4CXX_DEBUG(
+ logger_, "Filtering out module ids with successfully calculated consent");
+
+ smart_objects::SmartObject hmi_msg_params(msg_params);
+ auto module_ids_for_consent =
+ hmi_msg_params[message_params::kModuleIds].asArray();
+ module_ids_for_consent->clear();
+
+ auto module_ids = msg_params[message_params::kModuleIds].asArray();
+ for (uint32_t i = 0; i < module_ids->size(); i++) {
+ // Only add modules whose consent is unknown(needs to be sent to the hmi)
+ bool is_consent_undefined =
+ (*hmi_request_consents_.asArray())[i].getType() ==
+ smart_objects::SmartType::SmartType_Null;
+ if (is_consent_undefined) {
+ module_ids_for_consent->push_back((*module_ids)[i]);
+ }
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Forwarding request to HMI with moduleIds for modules with "
+ "unknown consent");
+ SendHMIRequest(hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent,
+ (&hmi_msg_params),
+ true);
+}
+
+void GetInteriorVehicleDataConsentRequest::on_event(
+ const app_mngr::event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (event.id() != hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent) {
+ LOG4CXX_ERROR(logger_, "Received wrong event. FunctionID: " << event.id());
+ return;
+ }
+
+ auto temp_response = event.smart_object();
+
+ auto result_code =
+ GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
+ temp_response[app_mngr::strings::params][app_mngr::hmi_response::code]
+ .asUInt()));
+
+ const bool success_result =
+ helpers::Compare<mobile_apis::Result::eType, helpers::EQ, helpers::ONE>(
+ result_code,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WARNINGS);
+
+ if (!success_result) {
+ std::string info;
+ GetInfo(temp_response, info);
+ SendResponse(false, result_code, info.c_str(), nullptr);
+ return;
+ }
+
+ if (!temp_response[app_mngr::strings::msg_params].keyExists(
+ message_params::kAllowed) ||
+ temp_response[app_mngr::strings::msg_params][message_params::kAllowed]
+ .empty()) {
+ std::string info_out =
+ "Collection of consents is absent in HMI response or empty";
+ LOG4CXX_ERROR(logger_, info_out);
+ SendResponse(false, mobile_apis::Result::GENERIC_ERROR, info_out.c_str());
+ return;
+ }
+
+ uint32_t number_of_expected_response_consents = std::accumulate(
+ hmi_request_consents_.asArray()->begin(),
+ hmi_request_consents_.asArray()->end(),
+ uint32_t(0),
+ [](uint32_t num_consents, smart_objects::SmartObject& consent) {
+ // Only module ids with valid location consents were sent to the hmi
+ bool is_consent_undefined =
+ consent.getType() == smart_objects::SmartType::SmartType_Null;
+ return (is_consent_undefined) ? num_consents + 1 : num_consents;
+ });
+
+ const auto response_consents =
+ temp_response[app_mngr::strings::msg_params][message_params::kAllowed]
+ .asArray();
+
+ if (number_of_expected_response_consents != response_consents->size()) {
+ std::string info_out =
+ "HMI response has incorrect number of consents expected: " +
+ std::to_string(number_of_expected_response_consents) +
+ ", actual: " + std::to_string(response_consents->size());
+ LOG4CXX_ERROR(logger_, info_out);
+ SendResponse(false, mobile_apis::Result::GENERIC_ERROR, info_out.c_str());
+ return;
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Adding back filtered out module ids for response to mobile");
+ uint32_t response_consents_counter = 0;
+ for (auto& consent : *(hmi_request_consents_.asArray())) {
+ // Only modify consent for moduleIds allowed by location constraints
+ bool is_consent_undefined =
+ consent.getType() == smart_objects::SmartType::SmartType_Null;
+ if (is_consent_undefined) {
+ consent = (*response_consents)[response_consents_counter];
+ response_consents_counter++;
+ }
+ }
+
+ temp_response[app_mngr::strings::msg_params][message_params::kAllowed] =
+ hmi_request_consents_;
+
+ const auto hmi_response = temp_response;
+ std::string response_info;
+ const bool result_of_saving = SaveModuleIdConsents(
+ response_info, hmi_response[app_mngr::strings::msg_params]);
+
+ if (!result_of_saving) {
+ LOG4CXX_DEBUG(logger_, "Consent saving failed");
+ SendResponse(
+ false, mobile_apis::Result::GENERIC_ERROR, response_info.c_str());
+ return;
+ }
+
+ smart_objects::SmartObject response_params =
+ hmi_response[app_mngr::strings::msg_params];
+ std::string info;
+ GetInfo(hmi_response, info);
+ SendResponse(success_result, result_code, info.c_str(), &response_params);
+}
+
+std::string GetInteriorVehicleDataConsentRequest::ModuleType() const {
+ mobile_apis::ModuleType::eType module_type =
+ static_cast<mobile_apis::ModuleType::eType>(
+ (*message_)[app_mngr::strings::msg_params]
+ [message_params::kModuleType]
+ .asUInt());
+
+ const char* str;
+ const bool ok = smart_objects::EnumConversionHelper<
+ mobile_apis::ModuleType::eType>::EnumToCString(module_type, &str);
+ return ok ? str : "unknown";
+}
+
+std::string GetInteriorVehicleDataConsentRequest::ModuleId() const {
+ return std::string();
+}
+
+GetInteriorVehicleDataConsentRequest::~GetInteriorVehicleDataConsentRequest() {}
+
+bool GetInteriorVehicleDataConsentRequest::IsUserLocationValid(
+ const ModuleUid& module_uid) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!rc_capabilities_manager_.IsSeatLocationCapabilityProvided()) {
+ return true;
+ }
+ const auto app_ptr = application_manager_.application(connection_key());
+ const auto extension = RCHelpers::GetRCExtension(*app_ptr);
+ const auto module_service_area =
+ rc_capabilities_manager_.GetModuleServiceArea(module_uid);
+ const auto user_location = extension->GetUserLocation();
+ const auto driver =
+ rc_capabilities_manager_.GetDriverLocationFromSeatLocationCapability();
+ const bool is_driver = (user_location == driver);
+ if (is_driver || user_location.IntersectionExists(module_service_area)) {
+ return true;
+ }
+ return false;
+}
+
+rc_rpc_types::ModuleConsent
+GetInteriorVehicleDataConsentRequest::GetModuleConsentByAccessMode(
+ const ModuleUid& module_uid,
+ const hmi_apis::Common_RCAccessMode::eType access_mode) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto get_auto_allow_consent = [](const ModuleUid& module_uid) {
+ return rc_rpc_types::ModuleConsent::CONSENTED;
+ };
+
+ auto get_auto_deny_consent = [this](const ModuleUid& module_uid) {
+ auto app = application_manager_.application(connection_key());
+ const uint32_t app_id = app->app_id();
+ const bool is_resource_available =
+ (resource_allocation_manager_.AcquireResource(
+ module_uid.first, module_uid.second, app_id) ==
+ AcquireResult::ALLOWED);
+ return (is_resource_available) ? rc_rpc_types::ModuleConsent::CONSENTED
+ : rc_rpc_types::ModuleConsent::NOT_CONSENTED;
+ };
+
+ auto get_ask_driver_consent = [this](const ModuleUid& module_uid) {
+ auto app = application_manager_.application(connection_key());
+ const std::string policy_app_id = app->policy_app_id();
+ const std::string mac_address = app->mac_address();
+
+ auto consent = rc_consent_manager_.GetModuleConsent(
+ policy_app_id, mac_address, module_uid);
+
+ if (rc_rpc_types::ModuleConsent::NOT_EXISTS == consent) {
+ auto acquire_result = resource_allocation_manager_.AcquireResource(
+ module_uid.first, module_uid.second, app->app_id());
+ const bool is_resource_available =
+ (acquire_result == AcquireResult::ALLOWED);
+ const bool is_resource_rejected =
+ (acquire_result == AcquireResult::REJECTED);
+
+ if (!is_resource_available && !is_resource_rejected) {
+ return rc_rpc_types::ModuleConsent::NOT_EXISTS;
+ }
+
+ return (is_resource_available)
+ ? rc_rpc_types::ModuleConsent::CONSENTED
+ : rc_rpc_types::ModuleConsent::NOT_CONSENTED;
+ }
+
+ const bool is_consent_allowed =
+ (rc_rpc_types::ModuleConsent::CONSENTED == consent);
+ return (is_consent_allowed) ? rc_rpc_types::ModuleConsent::CONSENTED
+ : rc_rpc_types::ModuleConsent::NOT_CONSENTED;
+ };
+
+ switch (access_mode) {
+ case hmi_apis::Common_RCAccessMode::AUTO_ALLOW: {
+ LOG4CXX_DEBUG(logger_,
+ "Calculating consent for module("
+ << module_uid.first << ", " << module_uid.second
+ << ") in accessMode: AUTO_ALLOW");
+ return get_auto_allow_consent(module_uid);
+ }
+ case hmi_apis::Common_RCAccessMode::AUTO_DENY: {
+ LOG4CXX_DEBUG(logger_,
+ "Calculating consent for module("
+ << module_uid.first << ", " << module_uid.second
+ << ") in accessMode: AUTO_DENY");
+ return get_auto_deny_consent(module_uid);
+ }
+ case hmi_apis::Common_RCAccessMode::ASK_DRIVER: {
+ LOG4CXX_DEBUG(logger_,
+ "Calculating consent for module("
+ << module_uid.first << ", " << module_uid.second
+ << ") in accessMode: ASK_DRIVER");
+ return get_ask_driver_consent(module_uid);
+ }
+ default: {
+ LOG4CXX_DEBUG(logger_,
+ "Unknown accessMode specified. Denying consent for module("
+ << module_uid.first << ", " << module_uid.second
+ << ")");
+ return rc_rpc_types::ModuleConsent::NOT_CONSENTED;
+ }
+ }
+}
+
+bool GetInteriorVehicleDataConsentRequest::GetCalculatedVehicleDataConsent(
+ smart_objects::SmartObject& out_response) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ out_response =
+ smart_objects::SmartObject(smart_objects::SmartType::SmartType_Map);
+ out_response[message_params::kAllowed] =
+ smart_objects::SmartObject(smart_objects::SmartType::SmartType_Array);
+
+ auto modules_consent_array = out_response[message_params::kAllowed].asArray();
+ const auto module_ids =
+ (*message_)[app_mngr::strings::msg_params][message_params::kModuleIds]
+ .asArray();
+ const std::string module_type = ModuleType();
+ bool can_handle_internally = true;
+
+ auto get_disallowed_multiple_access_consent =
+ [this](const ModuleUid& module_uid) {
+ auto app = application_manager_.application(connection_key());
+ const uint32_t app_id = app->app_id();
+ const bool is_resource_available =
+ (resource_allocation_manager_.AcquireResource(
+ module_uid.first, module_uid.second, app_id) ==
+ AcquireResult::ALLOWED);
+ return (is_resource_available)
+ ? rc_rpc_types::ModuleConsent::CONSENTED
+ : rc_rpc_types::ModuleConsent::NOT_CONSENTED;
+ };
+
+ for (const auto module_id : *(module_ids)) {
+ const ModuleUid module_uid(module_type, module_id.asString());
+ // Check if the user_location is covered by the module's serviceArea
+ if (!IsUserLocationValid(module_uid)) {
+ LOG4CXX_DEBUG(logger_,
+ "User is outside the serviceArea for module("
+ << module_uid.first << ", " << module_uid.second
+ << "). Denying consent");
+ modules_consent_array->push_back(smart_objects::SmartObject(false));
+ continue;
+ }
+
+ rc_rpc_types::ModuleConsent module_consent;
+
+ const bool is_multiple_access_allowed =
+ rc_capabilities_manager_.IsMultipleAccessAllowed(module_uid);
+ if (!is_multiple_access_allowed) {
+ LOG4CXX_DEBUG(logger_,
+ "multipleAccess disallowed for module("
+ << module_uid.first << ", " << module_uid.second
+ << ")");
+ module_consent = get_disallowed_multiple_access_consent(module_uid);
+ modules_consent_array->push_back(smart_objects::SmartObject(
+ module_consent == rc_rpc_types::ModuleConsent::CONSENTED));
+ continue;
+ }
+
+ const auto access_mode = resource_allocation_manager_.GetAccessMode();
+
+ module_consent = GetModuleConsentByAccessMode(module_uid, access_mode);
+ if (module_consent == rc_rpc_types::ModuleConsent::NOT_EXISTS) {
+ LOG4CXX_DEBUG(logger_,
+ "Unable to calculate consent for module("
+ << module_uid.first << ", " << module_uid.second
+ << "), should send moduleId to HMI for consent");
+ modules_consent_array->push_back(smart_objects::SmartObject());
+ can_handle_internally = false;
+ continue;
+ }
+ modules_consent_array->push_back(smart_objects::SmartObject(
+ module_consent == rc_rpc_types::ModuleConsent::CONSENTED));
+ }
+ return can_handle_internally;
+}
+
+bool GetInteriorVehicleDataConsentRequest::SaveModuleIdConsents(
+ std::string& info_out, const smart_objects::SmartObject& msg_params) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const auto& allowed = msg_params[message_params::kAllowed];
+ const auto& moduleIds =
+ (*message_)[app_mngr::strings::msg_params][message_params::kModuleIds];
+
+ if (allowed.length() != moduleIds.length()) {
+ info_out =
+ "The received module_id collection from mobile and received consent "
+ "collection from HMI are not equal by size.";
+ LOG4CXX_ERROR(logger_, info_out);
+ return false;
+ }
+ std::string module_type = ModuleType();
+ auto module_ids = RCHelpers::RetrieveModuleIds(moduleIds);
+ auto module_allowed = RCHelpers::RetrieveModuleConsents(allowed);
+
+ auto module_consents =
+ RCHelpers::FillModuleConsents(module_type, module_ids, module_allowed);
+
+ auto application = application_manager_.application(connection_key());
+ if (!application) {
+ LOG4CXX_ERROR(logger_,
+ "Application with connection key:" << connection_key()
+ << " isn't registered");
+ return false;
+ }
+ std::string policy_app_id = application->policy_app_id();
+ const auto mac_address = application->mac_address();
+ rc_consent_manager_.SaveModuleConsents(
+ policy_app_id, mac_address, module_consents);
+ return true;
+}
+
+} // namespace commands
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc
new file mode 100644
index 0000000000..3e197fbdea
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_response.cc
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_response.h"
+
+namespace rc_rpc_plugin {
+namespace commands {
+
+GetInteriorVehicleDataConsentResponse::GetInteriorVehicleDataConsentResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params)
+ : application_manager::commands::CommandResponseImpl(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
+
+void GetInteriorVehicleDataConsentResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ application_manager_.GetRPCService().SendMessageToMobile(message_);
+}
+
+GetInteriorVehicleDataConsentResponse::
+ ~GetInteriorVehicleDataConsentResponse() {}
+
+} // namespace commands
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
index 38f94637c2..10f6303ac9 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
@@ -31,10 +31,12 @@
*/
#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "rc_rpc_plugin/rc_helpers.h"
#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
#include "smart_objects/enum_schema_item.h"
#include "utils/macro.h"
-#include "interfaces/MOBILE_API.h"
namespace rc_rpc_plugin {
namespace commands {
@@ -46,71 +48,171 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
GetInteriorVehicleDataRequest::GetInteriorVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : RCCommandRequest(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle,
- resource_allocation_manager)
+ const RCCommandParams& params)
+ : RCCommandRequest(message, params)
, excessive_subscription_occured_(false) {}
-bool CheckIfModuleTypeExistInCapabilities(
- const smart_objects::SmartObject& rc_capabilities,
- const std::string& module_type) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (enums_value::kRadio == module_type &&
- !rc_capabilities.keyExists(strings::kradioControlCapabilities)) {
- LOG4CXX_DEBUG(logger_, " Radio control capabilities not present");
- return false;
- }
- if (enums_value::kClimate == module_type &&
- !rc_capabilities.keyExists(strings::kclimateControlCapabilities)) {
- LOG4CXX_DEBUG(logger_, " Climate control capabilities not present");
- return false;
- }
-
- return true;
-}
-
-void GetInteriorVehicleDataRequest::Execute() {
+bool GetInteriorVehicleDataRequest::ProcessCapabilities() {
LOG4CXX_AUTO_TRACE(logger_);
-
const smart_objects::SmartObject* rc_capabilities =
hmi_capabilities_.rc_capability();
const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
if (rc_capabilities &&
- !CheckIfModuleTypeExistInCapabilities(*rc_capabilities, module_type)) {
- LOG4CXX_WARN(logger_, "Accessing not supported module data");
+ !rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) {
+ LOG4CXX_WARN(
+ logger_,
+ "Accessing not supported module: " << module_type << " " << module_id);
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
"Accessing not supported module data");
- return;
+ return false;
}
+ return true;
+}
- app_mngr::ApplicationSharedPtr app =
- application_manager_.application(connection_key());
+void GetInteriorVehicleDataRequest::FilterDisabledModuleData(
+ smart_objects::SmartObject& module_data) {
+ // If radioEnable is false, remove all other radio parameters from the
+ // message.
+ if (module_data.keyExists(message_params::kRadioEnable) &&
+ module_data[message_params::kRadioEnable].asBool() == false) {
+ for (auto data = module_data.map_begin(); data != module_data.map_end();) {
+ auto key = data->first;
+ ++data;
+ if (key != message_params::kRadioEnable) {
+ module_data.erase(key);
+ }
+ }
+ }
+ // If hdRadioEnable is false, find and remove the HDChannel if parameter is
+ // present.
+ if (module_data.keyExists(message_params::kHdRadioEnable) &&
+ module_data[message_params::kHdRadioEnable].asBool() == false) {
+ module_data.erase(message_params::kHdChannel);
+ module_data.erase(message_params::kAvailableHDs);
+ module_data.erase(message_params::kAvailableHdChannels);
+ module_data.erase(message_params::kSisData);
+ }
+}
- if (HasRequestExcessiveSubscription()) {
- excessive_subscription_occured_ = true;
- is_subscribed =
- (*message_)[app_mngr::strings::msg_params][message_params::kSubscribe]
- .asBool();
- RemoveExcessiveSubscription();
+void GetInteriorVehicleDataRequest::ProcessResponseToMobileFromCache(
+ app_mngr::ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping();
+ const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
+ auto data = interior_data_cache_.Retrieve(module);
+ FilterDisabledModuleData(data);
+ auto response_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ response_msg_params[message_params::kModuleData][data_mapping(module_type)] =
+ data;
+ response_msg_params[message_params::kModuleData]
+ [message_params::kModuleType] = module_type;
+
+ response_msg_params[message_params::kModuleData][message_params::kModuleId] =
+ module_id;
+
+ const auto& request_msg_params = (*message_)[app_mngr::strings::msg_params];
+ LOG4CXX_DEBUG(logger_,
+ "kSubscribe exist" << request_msg_params.keyExists(
+ message_params::kSubscribe));
+ if (request_msg_params.keyExists(message_params::kSubscribe)) {
+ response_msg_params[message_params::kIsSubscribed] =
+ request_msg_params[message_params::kSubscribe].asBool();
+ if (request_msg_params[message_params::kSubscribe].asBool()) {
+ auto extension = RCHelpers::GetRCExtension(*app);
+ DCHECK(extension);
+ extension->SubscribeToInteriorVehicleData(module);
+ }
+ }
+ SendResponse(
+ true, mobile_apis::Result::SUCCESS, nullptr, &response_msg_params);
+ if (AppShouldBeUnsubscribed()) {
+ auto extension = RCHelpers::GetRCExtension(*app);
+ DCHECK(extension);
+ extension->UnsubscribeFromInteriorVehicleData(module);
+ }
+}
+
+bool GetInteriorVehicleDataRequest::CheckRateLimits() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
+ return interior_data_manager_.CheckRequestsToHMIFrequency(module);
+}
+
+bool GetInteriorVehicleDataRequest::AppShouldBeUnsubscribed() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto& msg_params = (*message_)[app_mngr::strings::msg_params];
+ if (msg_params.keyExists(message_params::kSubscribe)) {
+ return !(msg_params[message_params::kSubscribe].asBool());
+ }
+ return false;
+}
+
+bool GetInteriorVehicleDataRequest::TheLastAppShouldBeUnsubscribed(
+ app_mngr::ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (AppShouldBeUnsubscribed()) {
+ const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
+ const auto subscribed_to_module_type =
+ RCHelpers::AppsSubscribedToModule(application_manager_, module);
+ if (subscribed_to_module_type.size() == 1 &&
+ subscribed_to_module_type.front() == app) {
+ LOG4CXX_DEBUG(logger_,
+ "The last application unsubscribes from "
+ << module_type << " " << module_id);
+ return true;
+ }
}
+ return false;
+}
+
+void GetInteriorVehicleDataRequest::Execute() {
+ LOG4CXX_AUTO_TRACE(logger_);
- (*message_)[app_mngr::strings::msg_params][app_mngr::strings::app_id] =
- app->app_id();
+ if (!ProcessCapabilities()) {
+ return;
+ }
- SendHMIRequest(hmi_apis::FunctionID::RC_GetInteriorVehicleData,
- &(*message_)[app_mngr::strings::msg_params],
- true);
+ app_mngr::ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+ const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
+
+ if (TheLastAppShouldBeUnsubscribed(app) ||
+ !interior_data_cache_.Contains(module)) {
+ if (HasRequestExcessiveSubscription()) {
+ excessive_subscription_occured_ = true;
+ is_subscribed =
+ (*message_)[app_mngr::strings::msg_params][message_params::kSubscribe]
+ .asBool();
+ RemoveExcessiveSubscription();
+ }
+ if (!CheckRateLimits()) {
+ LOG4CXX_WARN(logger_, "GetInteriorVehicleData frequency is too high.");
+ SendResponse(false, mobile_apis::Result::REJECTED);
+ return;
+ }
+ interior_data_manager_.StoreRequestToHMITime(module);
+ (*message_)[app_mngr::strings::msg_params][message_params::kModuleId] =
+ ModuleId();
+ SendHMIRequest(hmi_apis::FunctionID::RC_GetInteriorVehicleData,
+ &(*message_)[app_mngr::strings::msg_params],
+ true);
+ return;
+ }
+ ProcessResponseToMobileFromCache(app);
}
void GetInteriorVehicleDataRequest::on_event(
@@ -142,7 +244,33 @@ void GetInteriorVehicleDataRequest::on_event(
}
if (result) {
+ if (!IsModuleIdProvided(hmi_response)) {
+ LOG4CXX_WARN(logger_,
+ "conditional mandatory parameter "
+ << message_params::kModuleId
+ << " missed in hmi response");
+ result = false;
+ result_code = mobile_apis::Result::GENERIC_ERROR;
+ }
+ app_mngr::ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+
+ DCHECK_OR_RETURN_VOID(app);
+ const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
+
+ if (TheLastAppShouldBeUnsubscribed(app)) {
+ interior_data_cache_.Remove(module);
+ }
ProccessSubscription(hmi_response);
+ if (is_subscribed) {
+ const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping();
+ const auto module_data =
+ hmi_response[app_mngr::strings::msg_params]
+ [message_params::kModuleData][data_mapping(module_type)];
+ interior_data_cache_.Add(module, module_data);
+ }
} else {
hmi_response[app_mngr::strings::msg_params].erase(
message_params::kIsSubscribed);
@@ -150,6 +278,7 @@ void GetInteriorVehicleDataRequest::on_event(
std::string response_info;
GetInfo(hmi_response, response_info);
SetResourceState(ModuleType(), ResourceState::FREE);
+
SendResponse(result,
result_code,
response_info.c_str(),
@@ -159,7 +288,7 @@ void GetInteriorVehicleDataRequest::on_event(
GetInteriorVehicleDataRequest::~GetInteriorVehicleDataRequest() {}
void GetInteriorVehicleDataRequest::ProccessSubscription(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& hmi_response) {
+ const ns_smart_device_link::ns_smart_objects::SmartObject& hmi_response) {
LOG4CXX_AUTO_TRACE(logger_);
const bool is_subscribe_present_in_request =
@@ -176,18 +305,25 @@ void GetInteriorVehicleDataRequest::ProccessSubscription(
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
- RCAppExtensionPtr extension =
- resource_allocation_manager_.GetApplicationExtention(app);
+ const auto extension = RCHelpers::GetRCExtension(*app);
const char* module_type;
- NsSmartDeviceLink::NsSmartObjects::
+ ns_smart_device_link::ns_smart_objects::
EnumConversionHelper<mobile_apis::ModuleType::eType>::EnumToCString(
static_cast<mobile_apis::ModuleType::eType>(
hmi_response[app_mngr::strings::msg_params]
[message_params::kModuleData]
- [message_params::kModuleType].asUInt()),
+ [message_params::kModuleType]
+ .asUInt()),
&module_type);
+
+ const std::string module_id =
+ hmi_response[app_mngr::strings::msg_params][message_params::kModuleData]
+ [message_params::kModuleId]
+ .asString();
+ const ModuleUid module(module_type, module_id);
+
if (excessive_subscription_occured_) {
- is_subscribed = extension->IsSubscibedToInteriorVehicleData(module_type);
+ is_subscribed = extension->IsSubscribedToInteriorVehicleData(module);
temp_hmi_response[app_mngr::strings::msg_params]
[message_params::kIsSubscribed] = is_subscribed;
return;
@@ -202,7 +338,7 @@ void GetInteriorVehicleDataRequest::ProccessSubscription(
<< message_params::kIsSubscribed
<< " missed in hmi response");
- is_subscribed = extension->IsSubscibedToInteriorVehicleData(module_type);
+ is_subscribed = extension->IsSubscribedToInteriorVehicleData(module);
temp_hmi_response[app_mngr::strings::msg_params]
[message_params::kIsSubscribed] = is_subscribed;
return;
@@ -233,16 +369,21 @@ void GetInteriorVehicleDataRequest::ProccessSubscription(
LOG4CXX_TRACE(logger_, "response_subscribe = " << response_subscribe);
if (request_subscribe == response_subscribe) {
const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
+
if (response_subscribe) {
LOG4CXX_DEBUG(logger_,
"SubscribeToInteriorVehicleData " << app->app_id() << " "
- << module_type);
- extension->SubscribeToInteriorVehicleData(module_type);
+ << module_type << " "
+ << module_id);
+ extension->SubscribeToInteriorVehicleData(module);
} else {
LOG4CXX_DEBUG(logger_,
"UnsubscribeFromInteriorVehicleData "
- << app->app_id() << " " << module_type);
- extension->UnsubscribeFromInteriorVehicleData(module_type);
+ << app->app_id() << " " << module_type << " "
+ << module_id);
+ extension->UnsubscribeFromInteriorVehicleData(module);
}
}
}
@@ -256,11 +397,14 @@ bool GetInteriorVehicleDataRequest::HasRequestExcessiveSubscription() {
if (is_subscribe_present_in_request) {
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
- RCAppExtensionPtr extension =
- resource_allocation_manager_.GetApplicationExtention(app);
+ const auto extension = RCHelpers::GetRCExtension(*app);
+
+ const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
const bool is_app_already_subscribed =
- extension->IsSubscibedToInteriorVehicleData(ModuleType());
+ extension->IsSubscribedToInteriorVehicleData(module);
const bool app_wants_to_subscribe =
(*message_)[app_mngr::strings::msg_params][message_params::kSubscribe]
.asBool();
@@ -277,16 +421,29 @@ void GetInteriorVehicleDataRequest::RemoveExcessiveSubscription() {
(*message_)[app_mngr::strings::msg_params].erase(message_params::kSubscribe);
}
-std::string GetInteriorVehicleDataRequest::ModuleType() {
- mobile_apis::ModuleType::eType module_type = static_cast<
- mobile_apis::ModuleType::eType>(
- (*message_)[app_mngr::strings::msg_params][message_params::kModuleType]
- .asUInt());
+std::string GetInteriorVehicleDataRequest::ModuleType() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ mobile_apis::ModuleType::eType module_type =
+ static_cast<mobile_apis::ModuleType::eType>(
+ (*message_)[app_mngr::strings::msg_params]
+ [message_params::kModuleType]
+ .asUInt());
const char* str;
- const bool ok = NsSmartDeviceLink::NsSmartObjects::EnumConversionHelper<
+ const bool ok = ns_smart_device_link::ns_smart_objects::EnumConversionHelper<
mobile_apis::ModuleType::eType>::EnumToCString(module_type, &str);
return ok ? str : "unknown";
}
+std::string GetInteriorVehicleDataRequest::ModuleId() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto msg_params = (*message_)[app_mngr::strings::msg_params];
+ if (msg_params.keyExists(message_params::kModuleId)) {
+ return msg_params[message_params::kModuleId].asString();
+ }
+ const std::string module_id =
+ rc_capabilities_manager_.GetDefaultModuleIdFromCapabilities(ModuleType());
+ return module_id;
+}
+
} // namespace commands
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc
index 18ccc5b497..b1fa8d6ea0 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc
@@ -31,6 +31,7 @@
*/
#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h"
+#include "rc_rpc_plugin/rc_helpers.h"
#include "utils/macro.h"
namespace rc_rpc_plugin {
@@ -38,22 +39,20 @@ namespace commands {
GetInteriorVehicleDataResponse::GetInteriorVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager::commands::CommandResponseImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ const RCCommandParams& params)
+ : application_manager::commands::CommandResponseImpl(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
GetInteriorVehicleDataResponse::~GetInteriorVehicleDataResponse() {}
void GetInteriorVehicleDataResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+
+ RCHelpers::RemoveRedundantGPSDataFromIVDataMsg(
+ (*message_)[app_mngr::strings::msg_params]);
application_manager_.GetRPCService().SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc
index dfe2feb622..91ecbe77eb 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc
@@ -31,8 +31,9 @@
*/
#include "rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h"
-#include "rc_rpc_plugin/rc_rpc_plugin.h"
+#include "rc_rpc_plugin/rc_helpers.h"
#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
#include "smart_objects/enum_schema_item.h"
#include "utils/macro.h"
@@ -43,56 +44,87 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
OnInteriorVehicleDataNotification::OnInteriorVehicleDataNotification(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- ResourceAllocationManager& resource_allocation_manager)
+ const RCCommandParams& params)
: app_mngr::commands::CommandNotificationImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {
- UNUSED(resource_allocation_manager);
-}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
+ , interior_data_cache_(params.interior_data_cache_)
+ , rc_capabilities_manager_(params.rc_capabilities_manager_) {}
OnInteriorVehicleDataNotification::~OnInteriorVehicleDataNotification() {}
+void OnInteriorVehicleDataNotification::AddDataToCache(
+ const ModuleUid& module) {
+ const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping();
+ const auto module_data =
+ (*message_)[app_mngr::strings::msg_params][message_params::kModuleData]
+ [data_mapping(module.first)];
+ interior_data_cache_.Add(module, module_data);
+}
+
void OnInteriorVehicleDataNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
+ auto apps_subscribed =
+ RCHelpers::AppsSubscribedToModule(application_manager_, module);
+ if (!apps_subscribed.empty()) {
+ AddDataToCache(module);
+ }
typedef std::vector<application_manager::ApplicationSharedPtr> AppPtrs;
AppPtrs apps = RCRPCPlugin::GetRCApplications(application_manager_);
+ RCHelpers::RemoveRedundantGPSDataFromIVDataMsg(
+ (*message_)[app_mngr::strings::msg_params]);
for (AppPtrs::iterator it = apps.begin(); it != apps.end(); ++it) {
DCHECK(*it);
application_manager::Application& app = **it;
- RCAppExtensionPtr extension =
- application_manager::AppExtensionPtr::static_pointer_cast<
- RCAppExtension>(app.QueryInterface(RCRPCPlugin::kRCPluginID));
+ const auto extension = RCHelpers::GetRCExtension(app);
DCHECK(extension);
LOG4CXX_TRACE(logger_,
- "Check subscription for "
- << app.app_id() << "and module type " << module_type);
- if (extension->IsSubscibedToInteriorVehicleData(module_type)) {
+ "Check subscription for " << app.app_id()
+ << "and module type " << module_type
+ << " " << module_id);
+
+ if (extension->IsSubscribedToInteriorVehicleData(module)) {
(*message_)[app_mngr::strings::params]
[app_mngr::strings::connection_key] = app.app_id();
+
+ (*message_)[app_mngr::strings::msg_params][message_params::kModuleData]
+ [message_params::kModuleId] = module_id;
+
SendNotification();
}
}
}
-std::string OnInteriorVehicleDataNotification::ModuleType() {
+std::string OnInteriorVehicleDataNotification::ModuleId() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto msg_params = (*message_)[app_mngr::strings::msg_params];
+ if (msg_params[message_params::kModuleData].keyExists(
+ message_params::kModuleId)) {
+ return msg_params[message_params::kModuleData][message_params::kModuleId]
+ .asString();
+ }
+ const std::string module_id =
+ rc_capabilities_manager_.GetDefaultModuleIdFromCapabilities(ModuleType());
+ return module_id;
+}
+
+std::string OnInteriorVehicleDataNotification::ModuleType() const {
mobile_apis::ModuleType::eType module_type =
static_cast<mobile_apis::ModuleType::eType>(
(*message_)[app_mngr::strings::msg_params]
[message_params::kModuleData][message_params::kModuleType]
.asUInt());
const char* str;
- const bool ok = NsSmartDeviceLink::NsSmartObjects::EnumConversionHelper<
+ const bool ok = ns_smart_device_link::ns_smart_objects::EnumConversionHelper<
mobile_apis::ModuleType::eType>::EnumToCString(module_type, &str);
return ok ? str : "unknown";
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc
new file mode 100644
index 0000000000..e30d7869bd
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_request.cc
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string>
+
+#include "application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h"
+#include "rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_request.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "smart_objects/enum_schema_item.h"
+
+namespace rc_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+namespace {
+struct ResponseParams {
+ std::string response_info;
+ std::string module_type;
+ std::string module_id;
+ mobile_apis::Result::eType result_code;
+ uint32_t app_id;
+ bool success_result;
+};
+
+void PrepareResponseResult(
+ ResponseParams& response_params_out,
+ rc_rpc_plugin::ResourceReleasedState::eType& released_result) {
+ std::stringstream ss;
+ auto info_inserter = [&ss, response_params_out](std::string info) {
+ ss << "Module [" << response_params_out.module_type << ":"
+ << response_params_out.module_id << "] " << info;
+ };
+ switch (released_result) {
+ case rc_rpc_plugin::ResourceReleasedState::eType::IS_RELEASED: {
+ response_params_out.success_result = true;
+ response_params_out.result_code = mobile_apis::Result::eType::SUCCESS;
+ info_inserter("is released successfully.");
+ break;
+ }
+ case rc_rpc_plugin::ResourceReleasedState::eType::IS_ALLOCATED: {
+ response_params_out.success_result = false;
+ response_params_out.result_code = mobile_apis::Result::eType::REJECTED;
+ info_inserter("is allocated to a different application.");
+ break;
+ }
+ case rc_rpc_plugin::ResourceReleasedState::eType::NOT_ALLOCATED: {
+ response_params_out.success_result = false;
+ response_params_out.result_code = mobile_apis::Result::eType::IGNORED;
+ info_inserter("is not allocated to any application.");
+ break;
+ }
+ }
+ response_params_out.response_info = ss.str();
+}
+} // namespace
+
+ReleaseInteriorVehicleDataModuleRequest::
+ ReleaseInteriorVehicleDataModuleRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params)
+ : RCCommandRequest(message, params) {}
+
+bool ReleaseInteriorVehicleDataModuleRequest::ProcessCapabilities() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject* rc_capabilities =
+ hmi_capabilities_.rc_capability();
+
+ const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
+ if (rc_capabilities &&
+ !rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) {
+ LOG4CXX_WARN(
+ logger_,
+ "Accessing not supported module: " << module_type << " " << module_id);
+ SendResponse(false,
+ mobile_apis::Result::UNSUPPORTED_RESOURCE,
+ "Accessing not supported module");
+ return false;
+ }
+ return true;
+}
+
+void ReleaseInteriorVehicleDataModuleRequest::Execute() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!ProcessCapabilities()) {
+ return;
+ }
+
+ const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ const uint32_t app_id = app->app_id();
+
+ ResourceReleasedState::eType released_result =
+ resource_allocation_manager_.ReleaseResource(
+ module_type, module_id, app_id);
+
+ bool success_result = true;
+ mobile_apis::Result::eType result_code = mobile_apis::Result::eType::SUCCESS;
+ std::string response_info;
+ ResponseParams response_params{response_info,
+ ModuleType(),
+ module_id,
+ result_code,
+ app_id,
+ success_result};
+ PrepareResponseResult(response_params, released_result);
+
+ if (response_params.success_result) {
+ resource_allocation_manager_.SendOnRCStatusNotifications(
+ NotificationTrigger::MODULE_ALLOCATION, app);
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Resource for module: "
+ << ModuleType() << " with id: " << module_id
+ << " was released with result " << std::boolalpha
+ << response_params.success_result
+ << " and result_code: " << response_params.result_code);
+
+ SendResponse(response_params.success_result,
+ response_params.result_code,
+ response_params.response_info.c_str());
+}
+
+std::string ReleaseInteriorVehicleDataModuleRequest::ModuleType() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ mobile_apis::ModuleType::eType module_type =
+ static_cast<mobile_apis::ModuleType::eType>(
+ (*message_)[app_mngr::strings::msg_params]
+ [message_params::kModuleType]
+ .asUInt());
+
+ const char* str;
+ const bool ok = ns_smart_device_link::ns_smart_objects::EnumConversionHelper<
+ mobile_apis::ModuleType::eType>::EnumToCString(module_type, &str);
+ return ok ? str : "unknown";
+}
+
+std::string ReleaseInteriorVehicleDataModuleRequest::ModuleId() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto msg_params = (*message_)[app_mngr::strings::msg_params];
+ if (msg_params.keyExists(message_params::kModuleId)) {
+ return msg_params[message_params::kModuleId].asString();
+ }
+ const std::string module_id =
+ rc_capabilities_manager_.GetDefaultModuleIdFromCapabilities(ModuleType());
+ return module_id;
+}
+
+ReleaseInteriorVehicleDataModuleRequest::
+ ~ReleaseInteriorVehicleDataModuleRequest() {}
+
+} // namespace commands
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc
new file mode 100644
index 0000000000..fae792f143
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/release_interior_vehicle_data_module_response.cc
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_response.h"
+
+namespace rc_rpc_plugin {
+namespace commands {
+
+ReleaseInteriorVehicleDataModuleResponse::
+ ReleaseInteriorVehicleDataModuleResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ const RCCommandParams& params)
+ : application_manager::commands::CommandResponseImpl(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
+
+void ReleaseInteriorVehicleDataModuleResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ application_manager_.GetRPCService().SendMessageToMobile(message_);
+}
+
+ReleaseInteriorVehicleDataModuleResponse::
+ ~ReleaseInteriorVehicleDataModuleResponse() {}
+
+} // namespace commands
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
index 160915f347..c3e5e807d7 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
@@ -31,144 +31,80 @@
*/
#include "rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h"
+#include "interfaces/MOBILE_API.h"
+#include "json/json.h"
+#include "rc_rpc_plugin/rc_helpers.h"
#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
#include "smart_objects/enum_schema_item.h"
-#include "utils/macro.h"
-#include "json/json.h"
#include "utils/helpers.h"
-#include "interfaces/MOBILE_API.h"
+#include "utils/macro.h"
namespace rc_rpc_plugin {
namespace commands {
using namespace json_keys;
using namespace message_params;
-
-namespace {
-std::vector<std::string> GetModuleReadOnlyParams(
- const std::string& module_type) {
- std::vector<std::string> module_ro_params;
- if (enums_value::kClimate == module_type) {
- module_ro_params.push_back(kCurrentTemperature);
- } else if (enums_value::kRadio == module_type) {
- module_ro_params.push_back(kRdsData);
- module_ro_params.push_back(kAvailableHDs);
- module_ro_params.push_back(kSignalStrength);
- module_ro_params.push_back(kSignalChangeThreshold);
- module_ro_params.push_back(kState);
- }
- return module_ro_params;
-}
-
-const std::map<std::string, std::string> GetModuleDataToCapabilitiesMapping() {
- std::map<std::string, std::string> mapping;
- // climate
- mapping["fanSpeed"] = "fanSpeedAvailable";
- mapping["currentTemperature"] = "currentTemperatureAvailable";
- mapping["desiredTemperature"] = "desiredTemperatureAvailable";
- mapping["acEnable"] = "acEnableAvailable";
- mapping["circulateAirEnable"] = "circulateAirEnableAvailable";
- mapping["autoModeEnable"] = "autoModeEnableAvailable";
- mapping["defrostZone"] = "defrostZoneAvailable";
- mapping["dualModeEnable"] = "dualModeEnableAvailable";
- mapping["acMaxEnable"] = "acMaxEnableAvailable";
- mapping["ventilationMode"] = "ventilationModeAvailable";
-
- // radio
- mapping["band"] = "radioBandAvailable";
- mapping["frequencyInteger"] = "radioFrequencyAvailable";
- mapping["frequencyFraction"] = "radioFrequencyAvailable";
- mapping["rdsData"] = "rdsDataAvailable";
- mapping["availableHDs"] = "availableHDsAvailable";
- mapping["hdChannel"] = "availableHDsAvailable";
- mapping["signalStrength"] = "signalStrengthAvailable";
- mapping["signalChangeThreshold"] = "signalChangeThresholdAvailable";
- mapping["radioEnable"] = "radioEnableAvailable";
- mapping["state"] = "stateAvailable";
-
- return mapping;
-}
-} // namespace
-
CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
SetInteriorVehicleDataRequest::SetInteriorVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : RCCommandRequest(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle,
- resource_allocation_manager) {}
+ const RCCommandParams& params)
+ : RCCommandRequest(message, params) {}
SetInteriorVehicleDataRequest::~SetInteriorVehicleDataRequest() {}
-bool CheckControlDataByCapabilities(
- const smart_objects::SmartObject& module_caps,
- const smart_objects::SmartObject& control_data) {
- std::map<std::string, std::string> mapping =
- GetModuleDataToCapabilitiesMapping();
-
- auto it = control_data.map_begin();
- for (; it != control_data.map_end(); ++it) {
- const std::string& request_parameter = it->first;
- const std::string& caps_key = mapping[request_parameter];
- const smart_objects::SmartObject& capabilities_status = module_caps[0];
- LOG4CXX_DEBUG(logger_,
- "Checking request parameter "
- << request_parameter
- << " with capabilities. Appropriate key is " << caps_key);
- if (!capabilities_status.keyExists(caps_key)) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << caps_key
- << " is missed in RemoteControl capabilities");
- return false;
- }
- if (!capabilities_status[caps_key].asBool()) {
- LOG4CXX_DEBUG(logger_,
- "Capability "
- << caps_key
- << " is switched off in RemoteControl capabilities");
- return false;
+/**
+ * @brief Clears unrelated module data parameters
+ * @param module type in request
+ * @param smart object of module_data
+ * @return true if the correct module parameter is present, false otherwise
+ */
+bool ClearUnrelatedModuleData(const std::string& module_type,
+ smart_objects::SmartObject& module_data) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto& all_module_types = RCHelpers::GetModuleTypesList();
+ const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping();
+ bool module_type_and_data_match = false;
+ for (const auto& type : all_module_types) {
+ const std::string module_key = data_mapping(type);
+ if (type == module_type) {
+ module_type_and_data_match = module_data.keyExists(module_key);
+ } else if (module_data.keyExists(module_key)) {
+ // Cutting unrelated module data
+ module_data.erase(module_key);
}
}
- return true;
+ return module_type_and_data_match;
}
-bool CheckIfModuleDataExistInCapabilities(
- const smart_objects::SmartObject& rc_capabilities,
- const smart_objects::SmartObject& module_data) {
- LOG4CXX_AUTO_TRACE(logger_);
- bool is_radio_data_valid = true;
- bool is_climate_data_valid = true;
- if (module_data.keyExists(message_params::kRadioControlData)) {
- if (!rc_capabilities.keyExists(strings::kradioControlCapabilities)) {
- LOG4CXX_DEBUG(logger_, " Radio control capabilities not present");
- return false;
- }
- const smart_objects::SmartObject& radio_caps =
- rc_capabilities[strings::kradioControlCapabilities];
- is_radio_data_valid = CheckControlDataByCapabilities(
- radio_caps, module_data[strings::kRadioControlData]);
- }
- if (module_data.keyExists(message_params::kClimateControlData)) {
- if (!rc_capabilities.keyExists(strings::kclimateControlCapabilities)) {
- LOG4CXX_DEBUG(logger_, " Climate control capabilities not present");
- return false;
+mobile_apis::Result::eType PrepareResultCodeAndInfo(
+ const ModuleTypeCapability module_data_capabilities, std::string& info) {
+ mobile_apis::Result::eType result_code =
+ mobile_apis::Result::UNSUPPORTED_RESOURCE;
+ if (message_params::kLightState == module_data_capabilities.first) {
+ switch (module_data_capabilities.second) {
+ case capabilitiesStatus::missedLightName:
+ info = "The requested LightName is not supported by the vehicle.";
+ break;
+ case capabilitiesStatus::missedParam:
+ info =
+ "The requested parameter of the given LightName is not supported "
+ "by the vehicle.";
+ break;
+ case capabilitiesStatus::readOnly:
+ info = "The requested parameter is read-only.";
+ result_code = mobile_apis::Result::READ_ONLY;
+ break;
+ default:
+ break;
}
- const smart_objects::SmartObject& climate_caps =
- rc_capabilities[strings::kclimateControlCapabilities];
- is_climate_data_valid = CheckControlDataByCapabilities(
- climate_caps, module_data[strings::kClimateControlData]);
- }
- return is_radio_data_valid && is_climate_data_valid;
+ } else {
+ info = "Accessing not supported module data.";
+ }
+ return result_code;
+ LOG4CXX_WARN(logger_, info);
}
void SetInteriorVehicleDataRequest::Execute() {
@@ -177,31 +113,37 @@ void SetInteriorVehicleDataRequest::Execute() {
smart_objects::SmartObject& module_data =
(*message_)[app_mngr::strings::msg_params][message_params::kModuleData];
const std::string module_type = ModuleType();
- bool module_type_and_data_match = true;
-
- if (enums_value::kRadio == module_type) {
- module_type_and_data_match =
- !(module_data.keyExists(message_params::kClimateControlData));
- }
- if (enums_value::kClimate == module_type) {
- module_type_and_data_match =
- !(module_data.keyExists(message_params::kRadioControlData));
- }
-
- if (module_type_and_data_match) {
- const smart_objects::SmartObject* rc_capabilities =
- hmi_capabilities_.rc_capability();
- if (rc_capabilities &&
- !CheckIfModuleDataExistInCapabilities(*rc_capabilities, module_data)) {
- LOG4CXX_WARN(logger_, "Accessing not supported module data");
+ if (ClearUnrelatedModuleData(module_type, module_data)) {
+ const std::string module_id = ModuleId();
+ const ModuleUid module(module_type, module_id);
+ if (!rc_capabilities_manager_.CheckIfModuleExistsInCapabilities(module)) {
+ LOG4CXX_WARN(logger_,
+ "Accessing not supported module: " << module_type << " "
+ << module_id);
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
"Accessing not supported module data");
return;
}
- if (AreAllParamsReadOnly(module_data)) {
+
+ ModuleTypeCapability module_data_capabilities;
+ module_data_capabilities =
+ rc_capabilities_manager_.GetModuleDataCapabilities(module_data,
+ module_id);
+
+ if (capabilitiesStatus::success != module_data_capabilities.second) {
+ SetResourceState(ModuleType(), ResourceState::FREE);
+ std::string info;
+ mobile_apis::Result::eType result =
+ PrepareResultCodeAndInfo(module_data_capabilities, info);
+ SendResponse(false, result, info.c_str());
+ return;
+ }
+
+ if (rc_capabilities_manager_.AreAllParamsReadOnly(module_data,
+ module_type)) {
LOG4CXX_WARN(logger_, "All request params in module type are READ ONLY!");
SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
@@ -209,23 +151,65 @@ void SetInteriorVehicleDataRequest::Execute() {
"All request params in module type are READ ONLY!");
return;
}
- if (AreReadOnlyParamsPresent(module_data)) {
+
+ module_data_capabilities = std::make_pair("", capabilitiesStatus::success);
+
+ if (rc_capabilities_manager_.AreReadOnlyParamsPresent(
+ module_data, module_type, module_data_capabilities)) {
LOG4CXX_DEBUG(logger_, "Request module type has READ ONLY parameters");
+
+ if (enums_value::kLight == module_data_capabilities.first &&
+ capabilitiesStatus::success != module_data_capabilities.second) {
+ SetResourceState(ModuleType(), ResourceState::FREE);
+ SendResponse(
+ false,
+ mobile_apis::Result::READ_ONLY,
+ "The LightStatus enum passed is READ ONLY and cannot be written.");
+ return;
+ }
+
LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameters... ");
+
CutOffReadOnlyParams(module_data);
}
- application_manager_.RemoveHMIFakeParameters(message_);
+
+ application_manager_.RemoveHMIFakeParameters(
+ message_, hmi_apis::FunctionID::RC_SetInteriorVehicleData);
app_mngr::ApplicationSharedPtr app =
application_manager_.application(connection_key());
(*message_)[app_mngr::strings::msg_params][app_mngr::strings::app_id] =
app->app_id();
+ const bool app_wants_to_set_audio_src =
+ module_data.keyExists(message_params::kAudioControlData) &&
+ module_data[message_params::kAudioControlData].keyExists(
+ message_params::kSource);
+
+ if (app_wants_to_set_audio_src) {
+ if (!app->IsAllowedToChangeAudioSource()) {
+ LOG4CXX_WARN(logger_, "App is not allowed to change audio source");
+ SetResourceState(ModuleType(), ResourceState::FREE);
+ SendResponse(false,
+ mobile_apis::Result::REJECTED,
+ "App is not allowed to change audio source");
+ return;
+ } else if (module_data[message_params::kAudioControlData].keyExists(
+ message_params::kKeepContext)) {
+ app->set_keep_context(module_data[message_params::kAudioControlData]
+ [message_params::kKeepContext]
+ .asBool());
+ }
+ }
+
+ (*message_)[app_mngr::strings::msg_params][message_params::kModuleData]
+ [message_params::kModuleId] = module_id;
SendHMIRequest(hmi_apis::FunctionID::RC_SetInteriorVehicleData,
&(*message_)[app_mngr::strings::msg_params],
true);
} else {
LOG4CXX_WARN(logger_, "Request module type & data mismatch!");
+ SetResourceState(ModuleType(), ResourceState::FREE);
SendResponse(false,
mobile_apis::Result::INVALID_DATA,
"Request module type & data mismatch!");
@@ -254,102 +238,150 @@ void SetInteriorVehicleDataRequest::on_event(
mobile_apis::Result::WARNINGS);
smart_objects::SmartObject response_params;
+ bool is_resource_acquired = false;
+
if (result) {
+ if (!IsModuleIdProvided(hmi_response)) {
+ LOG4CXX_WARN(logger_,
+ "conditional mandatory parameter "
+ << message_params::kModuleId
+ << " missed in hmi response");
+ result = false;
+ result_code = mobile_apis::Result::GENERIC_ERROR;
+ }
response_params = hmi_response[app_mngr::strings::msg_params];
+ if (enums_value::kAudio == ModuleType()) {
+ CheckAudioSource((
+ *message_)[app_mngr::strings::msg_params][message_params::kModuleData]
+ [message_params::kAudioControlData]);
+ }
+
+ const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
+
+ const rc_rpc_types::ModuleUid resource{module_type, module_id};
+ auto app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "NULL pointer.");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, "");
+ return;
+ }
+
+ const auto app_id = app->app_id();
+
+ if (!resource_allocation_manager_.IsResourceAlreadyAcquiredByApp(resource,
+ app_id)) {
+ resource_allocation_manager_.SetResourceAcquired(
+ module_type, module_id, app_id);
+ is_resource_acquired = true;
+ }
+
+ } else {
+ app_mngr::ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+ app->set_keep_context(false);
}
std::string info;
GetInfo(hmi_response, info);
SendResponse(
result, result_code, info.c_str(), result ? &response_params : nullptr);
-}
-
-const smart_objects::SmartObject& SetInteriorVehicleDataRequest::ControlData(
- const smart_objects::SmartObject& module_data) {
- const std::string module = ModuleType();
-
- if (enums_value::kRadio == module) {
- return module_data[message_params::kRadioControlData];
- } else {
- return module_data[message_params::kClimateControlData];
- }
-}
-bool SetInteriorVehicleDataRequest::AreAllParamsReadOnly(
- const smart_objects::SmartObject& module_data) {
- LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject& module_type_params =
- ControlData(module_data);
- auto it = module_type_params.map_begin();
- std::vector<std::string> ro_params = GetModuleReadOnlyParams(ModuleType());
- for (; it != module_type_params.map_end(); ++it) {
- if (!helpers::in_range(ro_params, it->first)) {
- return false;
- }
+ if (is_resource_acquired) {
+ resource_allocation_manager_.SendOnRCStatusNotifications(
+ NotificationTrigger::MODULE_ALLOCATION,
+ std::shared_ptr<application_manager::Application>());
}
- return true;
}
-bool SetInteriorVehicleDataRequest::AreReadOnlyParamsPresent(
- const smart_objects::SmartObject& module_data) {
+void SetInteriorVehicleDataRequest::CheckAudioSource(
+ const smart_objects::SmartObject& audio_data) {
LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject& module_type_params =
- ControlData(module_data);
- auto it = module_type_params.map_begin();
- std::vector<std::string> ro_params = GetModuleReadOnlyParams(ModuleType());
- for (; it != module_type_params.map_end(); ++it) {
- if (helpers::in_range(ro_params, it->first)) {
- return true;
- }
+ if (audio_data.keyExists(message_params::kSource)) {
+ application_manager_.set_current_audio_source(
+ audio_data[message_params::kSource].asUInt());
}
- return false;
}
void SetInteriorVehicleDataRequest::CutOffReadOnlyParams(
smart_objects::SmartObject& module_data) {
LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject& module_type_params =
- ControlData(module_data);
const std::string module_type = ModuleType();
- std::vector<std::string> ro_params = GetModuleReadOnlyParams(module_type);
-
- for (auto& it : ro_params) {
- if (module_type_params.keyExists(it)) {
- if (enums_value::kClimate == module_type) {
- module_data[message_params::kClimateControlData].erase(it);
- LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << it);
- } else if (enums_value::kRadio == module_type) {
- module_data[message_params::kRadioControlData].erase(it);
- LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << it);
+ const auto& module_type_params =
+ rc_capabilities_manager_.ControlDataForType(module_data, module_type);
+
+ if (enums_value::kAudio == module_type) {
+ auto& equalizer_settings = module_data[message_params::kAudioControlData]
+ [message_params::kEqualizerSettings];
+ auto it = equalizer_settings.asArray()->begin();
+ for (; it != equalizer_settings.asArray()->end(); ++it) {
+ if (it->keyExists(message_params::kChannelName)) {
+ it->erase(message_params::kChannelName);
+ LOG4CXX_DEBUG(logger_,
+ "Cutting-off READ ONLY parameter: "
+ << message_params::kChannelName);
}
}
}
+
+ std::vector<std::string> ro_params =
+ RCHelpers::GetModuleReadOnlyParams(module_type);
+ const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping();
+ for (const auto& param : ro_params) {
+ if (module_type_params.keyExists(param)) {
+ module_data[data_mapping(module_type)].erase(param);
+ LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << param);
+ }
+ }
}
-std::string SetInteriorVehicleDataRequest::ModuleType() {
+std::string SetInteriorVehicleDataRequest::ModuleType() const {
+ LOG4CXX_AUTO_TRACE(logger_);
mobile_apis::ModuleType::eType module_type =
static_cast<mobile_apis::ModuleType::eType>(
(*message_)[app_mngr::strings::msg_params]
[message_params::kModuleData][message_params::kModuleType]
.asUInt());
const char* str;
- const bool ok = NsSmartDeviceLink::NsSmartObjects::EnumConversionHelper<
+ const bool ok = ns_smart_device_link::ns_smart_objects::EnumConversionHelper<
mobile_apis::ModuleType::eType>::EnumToCString(module_type, &str);
return ok ? str : "unknown";
}
+std::string SetInteriorVehicleDataRequest::ModuleId() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto msg_params = (*message_)[app_mngr::strings::msg_params];
+ if (msg_params[message_params::kModuleData].keyExists(
+ message_params::kModuleId)) {
+ return msg_params[message_params::kModuleData][message_params::kModuleId]
+ .asString();
+ }
+ if (enums_value::kSeat == ModuleType()) {
+ const auto id = static_cast<mobile_apis::SupportedSeat::eType>(
+ msg_params[message_params::kModuleData]
+ [message_params::kSeatControlData][message_params::kId]
+ .asUInt());
+ return rc_capabilities_manager_.GetModuleIdForSeatLocation(id);
+ }
+ const std::string module_id =
+ rc_capabilities_manager_.GetDefaultModuleIdFromCapabilities(ModuleType());
+ return module_id;
+}
+
AcquireResult::eType SetInteriorVehicleDataRequest::AcquireResource(
const app_mngr::commands::MessageSharedPtr& message) {
LOG4CXX_AUTO_TRACE(logger_);
const std::string module_type = ModuleType();
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
- return resource_allocation_manager_.AcquireResource(module_type,
- app->app_id());
+
+ return resource_allocation_manager_.AcquireResource(
+ module_type, ModuleId(), app->app_id());
}
bool SetInteriorVehicleDataRequest::IsResourceFree(
- const std::string& module_type) const {
- return resource_allocation_manager_.IsResourceFree(module_type);
+ const std::string& module_type, const std::string& module_id) const {
+ return resource_allocation_manager_.IsResourceFree(module_type, module_id);
}
void SetInteriorVehicleDataRequest::SetResourceState(
@@ -358,7 +390,7 @@ void SetInteriorVehicleDataRequest::SetResourceState(
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
resource_allocation_manager_.SetResourceState(
- module_type, app->app_id(), state);
+ module_type, ModuleId(), app->app_id(), state);
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc
index 2d5d0350e1..4dedd4b5a2 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_response.cc
@@ -1,4 +1,5 @@
#include "rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_response.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "utils/macro.h"
namespace rc_rpc_plugin {
@@ -6,18 +7,13 @@ namespace commands {
SetInteriorVehicleDataResponse::SetInteriorVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager::commands::CommandResponseImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {
- UNUSED(resource_allocation_manager);
-}
+ const RCCommandParams& params)
+ : application_manager::commands::CommandResponseImpl(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
SetInteriorVehicleDataResponse::~SetInteriorVehicleDataResponse() {}
void SetInteriorVehicleDataResponse::Run() {
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
index 4f968dd2d8..885c5ac0dd 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc
@@ -31,9 +31,14 @@
*/
#include "rc_rpc_plugin/commands/rc_command_request.h"
-#include "rc_rpc_plugin/rc_module_constants.h"
-#include "application_manager/message_helper.h"
+#include <sstream>
#include "application_manager/hmi_interfaces.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "rc_rpc_plugin/commands/rc_command_request.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
+#include "rc_rpc_plugin/rc_helpers.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
#include "smart_objects/enum_schema_item.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
@@ -43,18 +48,20 @@ namespace commands {
RCCommandRequest::RCCommandRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle,
- rc_rpc_plugin::ResourceAllocationManager& resource_allocation_manager)
- : application_manager::commands::CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle)
+ const RCCommandParams& params)
+ : application_manager::commands::CommandRequestImpl(
+ message,
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
, is_subscribed(false)
- , resource_allocation_manager_(resource_allocation_manager) {}
+ , auto_allowed_(false)
+ , resource_allocation_manager_(params.resource_allocation_manager_)
+ , interior_data_cache_(params.interior_data_cache_)
+ , interior_data_manager_(params.interior_data_manager_)
+ , rc_capabilities_manager_(params.rc_capabilities_manager_)
+ , rc_consent_manager_(params.rc_consent_manager_) {}
RCCommandRequest::~RCCommandRequest() {}
@@ -79,12 +86,6 @@ bool RCCommandRequest::CheckDriverConsent() {
LOG4CXX_AUTO_TRACE(logger_);
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
- RCAppExtensionPtr extension =
- resource_allocation_manager_.GetApplicationExtention(app);
- if (!extension) {
- LOG4CXX_ERROR(logger_, "NULL pointer.");
- return false;
- }
const std::string module_type = ModuleType();
rc_rpc_plugin::TypeAccess access = CheckModule(module_type, app);
@@ -105,6 +106,14 @@ rc_rpc_plugin::TypeAccess RCCommandRequest::CheckModule(
: rc_rpc_plugin::TypeAccess::kDisallowed;
}
+bool RCCommandRequest::IsModuleIdProvided(
+ const smart_objects::SmartObject& hmi_response) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return hmi_response[app_mngr::strings::msg_params]
+ [message_params::kModuleData]
+ .keyExists(message_params::kModuleId);
+}
+
void RCCommandRequest::SendDisallowed(rc_rpc_plugin::TypeAccess access) {
LOG4CXX_AUTO_TRACE(logger_);
std::string info;
@@ -140,6 +149,23 @@ void RCCommandRequest::Run() {
SendResponse(false, mobile_apis::Result::DISALLOWED, "");
return;
}
+ if (!resource_allocation_manager_.is_rc_enabled()) {
+ LOG4CXX_WARN(logger_, "Remote control is disabled by user");
+ SetResourceState(ModuleType(), ResourceState::FREE);
+ SendResponse(false,
+ mobile_apis::Result::USER_DISALLOWED,
+ "Remote control is disabled by user");
+ return;
+ }
+ auto rc_capabilities = hmi_capabilities_.rc_capability();
+ if (!rc_capabilities || rc_capabilities->empty()) {
+ LOG4CXX_WARN(logger_, "Accessing not supported module: " << ModuleType());
+ SetResourceState(ModuleType(), ResourceState::FREE);
+ SendResponse(false,
+ mobile_apis::Result::UNSUPPORTED_RESOURCE,
+ "Accessing not supported module");
+ return;
+ }
if (CheckDriverConsent()) {
if (AcquireResources()) {
@@ -154,8 +180,9 @@ void RCCommandRequest::Run() {
bool RCCommandRequest::AcquireResources() {
LOG4CXX_AUTO_TRACE(logger_);
const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
- if (!IsResourceFree(module_type)) {
+ if (!IsResourceFree(module_type, module_id)) {
LOG4CXX_WARN(logger_, "Resource is busy.");
SendResponse(false, mobile_apis::Result::IN_USE, "");
return false;
@@ -172,7 +199,7 @@ bool RCCommandRequest::AcquireResources() {
return false;
}
case AcquireResult::ASK_DRIVER: {
- SendGetUserConsent(module_type);
+ ProcessAskDriverMode(module_type, module_id);
return false;
}
case AcquireResult::REJECTED: {
@@ -200,6 +227,7 @@ void RCCommandRequest::ProcessAccessResponse(
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
const std::string module_type = ModuleType();
+ const std::string module_id = ModuleId();
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, "");
@@ -224,23 +252,18 @@ void RCCommandRequest::ProcessAccessResponse(
if (message[app_mngr::strings::msg_params].keyExists(
message_params::kAllowed)) {
is_allowed =
- message[app_mngr::strings::msg_params][message_params::kAllowed]
+ message[app_mngr::strings::msg_params][message_params::kAllowed][0]
.asBool();
}
- if (is_allowed) {
- resource_allocation_manager_.ForceAcquireResource(module_type,
- app->app_id());
- SetResourceState(module_type, ResourceState::BUSY);
- Execute(); // run child's logic
- } else {
- resource_allocation_manager_.OnDriverDisallowed(module_type,
- app->app_id());
- SendResponse(
- false,
- mobile_apis::Result::REJECTED,
- "The resource is in use and the driver disallows this remote "
- "control RPC");
- }
+ std::string policy_app_id = app->policy_app_id();
+ const auto mac_address = app->mac_address();
+ std::vector<std::string> module_ids{module_id};
+ std::vector<bool> module_allowed{is_allowed};
+ auto module_consents =
+ RCHelpers::FillModuleConsents(module_type, module_ids, module_allowed);
+ rc_consent_manager_.SaveModuleConsents(
+ policy_app_id, mac_address, module_consents);
+ ProcessConsentResult(is_allowed, module_type, module_id, app->app_id());
} else {
std::string response_info;
GetInfo(message, response_info);
@@ -248,7 +271,56 @@ void RCCommandRequest::ProcessAccessResponse(
}
}
-void RCCommandRequest::SendGetUserConsent(const std::string& module_type) {
+void RCCommandRequest::ProcessConsentResult(const bool is_allowed,
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (is_allowed) {
+ SetResourceState(module_type, ResourceState::BUSY);
+ Execute(); // run child's logic
+ } else {
+ resource_allocation_manager_.OnDriverDisallowed(
+ module_type, module_id, app_id);
+
+ std::stringstream ss;
+ ss << "The resource [" << module_type << ":" << module_id
+ << "] is in use and the driver disallows this remote "
+ "control RPC";
+ SendResponse(false, mobile_apis::Result::REJECTED, ss.str().c_str());
+ }
+}
+
+void RCCommandRequest::ProcessAskDriverMode(const std::string& module_type,
+ const std::string& module_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto app =
+ application_manager_.application(CommandRequestImpl::connection_key());
+ const std::string policy_app_id = app->policy_app_id();
+ const std::string mac_address = app->mac_address();
+
+ auto consent = rc_consent_manager_.GetModuleConsent(
+ policy_app_id, mac_address, {module_type, module_id});
+ switch (consent) {
+ case rc_rpc_types::ModuleConsent::NOT_EXISTS: {
+ smart_objects::SmartObject module_ids(
+ smart_objects::SmartType::SmartType_Array);
+ module_ids[0] = module_id;
+ SendGetUserConsent(module_type, module_ids);
+ break;
+ }
+ case rc_rpc_types::ModuleConsent::NOT_CONSENTED:
+ case rc_rpc_types::ModuleConsent::CONSENTED: {
+ const bool is_allowed = rc_rpc_types::ModuleConsent::CONSENTED == consent;
+ ProcessConsentResult(is_allowed, module_type, module_id, app->app_id());
+ break;
+ }
+ };
+}
+
+void RCCommandRequest::SendGetUserConsent(
+ const std::string& module_type,
+ const smart_objects::SmartObject& module_ids) {
LOG4CXX_AUTO_TRACE(logger_);
app_mngr::ApplicationSharedPtr app =
application_manager_.application(CommandRequestImpl::connection_key());
@@ -257,9 +329,11 @@ void RCCommandRequest::SendGetUserConsent(const std::string& module_type) {
smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[app_mngr::strings::app_id] = app->app_id();
msg_params[message_params::kModuleType] = module_type;
+ msg_params[message_params::kModuleIds] = module_ids;
+
SendHMIRequest(hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent,
&msg_params,
true);
}
-}
-}
+} // namespace commands
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc
new file mode 100644
index 0000000000..3e50818210
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "rc_rpc_plugin/interior_data_cache_impl.h"
+#include <chrono>
+#include <iostream>
+#include <thread>
+#include "application_manager/smart_object_keys.h"
+#include "rc_rpc_plugin/rc_helpers.h"
+#include "utils/date_time.h"
+#include "utils/logger.h"
+
+namespace rc_rpc_plugin {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule");
+
+InteriorDataCacheImpl::InteriorDataCacheImpl() {}
+
+InteriorDataCacheImpl::~InteriorDataCacheImpl() {}
+
+void InteriorDataCacheImpl::Add(const ModuleUid& module,
+ const smart_objects::SmartObject& module_data) {
+ LOG4CXX_TRACE(
+ logger_,
+ "module_type : " << module.first << " module_id : " << module.second);
+ sync_primitives::AutoLock autolock(cached_data_lock_);
+ auto it = cached_data_.find(module);
+ if (cached_data_.end() == it) {
+ cached_data_[module] = module_data;
+ return;
+ }
+ cached_data_[module] = RCHelpers::MergeModuleData(it->second, module_data);
+}
+
+smart_objects::SmartObject InteriorDataCacheImpl::Retrieve(
+ const ModuleUid& module) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(cached_data_lock_);
+ auto it = cached_data_.find(module);
+ if (it == cached_data_.end()) {
+ LOG4CXX_WARN(logger_,
+ "Module with type: " << module.first
+ << " and id: " << module.second
+ << " was not found in cache");
+ return smart_objects::SmartObject(smart_objects::SmartType_Null);
+ }
+ LOG4CXX_TRACE(
+ logger_,
+ "module_type : " << module.first << " module_id : " << module.second);
+ return it->second;
+}
+
+std::vector<ModuleUid> InteriorDataCacheImpl::GetCachedModulesByType(
+ const std::string& module_type) const {
+ std::vector<ModuleUid> modules;
+ for (auto& item : cached_data_) {
+ auto& module = item.first;
+ if (module_type == module.first) {
+ modules.push_back(module);
+ }
+ }
+ return modules;
+}
+
+bool InteriorDataCacheImpl::Contains(const ModuleUid& module) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(cached_data_lock_);
+ auto it = cached_data_.find(module);
+ const bool contains = it != cached_data_.end();
+ LOG4CXX_TRACE(logger_,
+ "module_type : " << module.first
+ << " module_id : " << module.second << " "
+ << (contains ? "true" : "false"));
+ return contains;
+}
+
+void InteriorDataCacheImpl::Remove(const ModuleUid& module) {
+ LOG4CXX_TRACE(
+ logger_,
+ "module_type : " << module.first << " module_id : " << module.second);
+ sync_primitives::AutoLock autolock(cached_data_lock_);
+ auto it = cached_data_.find(module);
+ if (cached_data_.end() == it) {
+ LOG4CXX_TRACE(
+ logger_,
+ "Not existing module : " << module.first << " " << module.second);
+ return;
+ }
+ cached_data_.erase(it);
+}
+
+void InteriorDataCacheImpl::Clear() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(cached_data_lock_);
+ cached_data_.clear();
+}
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc
new file mode 100644
index 0000000000..50568de63a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc
@@ -0,0 +1,201 @@
+#include "rc_rpc_plugin/interior_data_manager_impl.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/rpc_service.h"
+#include "rc_rpc_plugin/rc_helpers.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
+
+namespace rc_rpc_plugin {
+CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule");
+
+InteriorDataManagerImpl::InteriorDataManagerImpl(
+ RCRPCPlugin& rc_plugin,
+ InteriorDataCache& cache,
+ application_manager::ApplicationManager& app_mngr,
+ application_manager::rpc_service::RPCService& rpc_service)
+ : rc_plugin_(rc_plugin)
+ , cache_(cache)
+ , app_mngr_(app_mngr)
+ , rpc_service_(rpc_service) {}
+
+void InteriorDataManagerImpl::OnPolicyEvent(plugins::PolicyEvent event) {
+ UpdateHMISubscriptionsOnPolicyUpdated();
+}
+
+void InteriorDataManagerImpl::OnApplicationEvent(
+ plugins::ApplicationEvent event,
+ app_mngr::ApplicationSharedPtr application) {
+ if (plugins::ApplicationEvent::kApplicationUnregistered == event ||
+ plugins::ApplicationEvent::kApplicationExit == event) {
+ UpdateHMISubscriptionsOnAppUnregistered(*application);
+ }
+}
+
+void InteriorDataManagerImpl::OnDisablingRC() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto existing_subscription = AppsSubscribedModules();
+ std::set<ModuleUid> subscribed_modules;
+ for (auto& pair : existing_subscription) {
+ auto& app = pair.first;
+ auto rc_extension = RCHelpers::GetRCExtension(*app);
+ for (const auto& module : pair.second) {
+ subscribed_modules.insert(module);
+ rc_extension->UnsubscribeFromInteriorVehicleData(module);
+ }
+ }
+ for (auto& module : subscribed_modules) {
+ LOG4CXX_TRACE(logger_,
+ "unsubscribe from module type: " << module.first
+ << " id: " << module.second);
+ UnsubscribeFromInteriorVehicleData(module);
+ }
+}
+
+void InteriorDataManagerImpl::StoreRequestToHMITime(const ModuleUid& module) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(requests_to_hmi_history_lock_);
+ requests_to_hmi_history_[module].push_back(date_time::getCurrentTime());
+}
+
+bool InteriorDataManagerImpl::CheckRequestsToHMIFrequency(
+ const ModuleUid& module) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(requests_to_hmi_history_lock_);
+ ClearOldRequestsToHMIHistory();
+ const auto& history = requests_to_hmi_history_[module];
+ const auto limit =
+ app_mngr_.get_settings().get_interior_vehicle_data_frequency().first;
+ return history.size() < limit;
+}
+
+void InteriorDataManagerImpl::UpdateHMISubscriptionsOnPolicyUpdated() {
+ auto apps_allowed_module_types =
+ RCHelpers::GetApplicationsAllowedModuleTypes(app_mngr_);
+ auto apps_subscribed_module_types = AppsSubscribedModuleTypes();
+ InteriorDataManagerImpl::AppsModuleTypes apps_disallowed_modules;
+ for (auto& pair : apps_subscribed_module_types) {
+ auto& allowed = apps_allowed_module_types[pair.first];
+ auto& subscribed = pair.second;
+ std::vector<std::string> disallowed_modules;
+ std::set_difference(subscribed.begin(),
+ subscribed.end(),
+ allowed.begin(),
+ allowed.end(),
+ std::back_inserter(disallowed_modules));
+
+ std::sort(disallowed_modules.begin(), disallowed_modules.end());
+
+ auto unique_result =
+ std::unique(disallowed_modules.begin(), disallowed_modules.end());
+
+ disallowed_modules.erase(unique_result, disallowed_modules.end());
+ apps_disallowed_modules[pair.first] = disallowed_modules;
+ }
+
+ for (auto& pair : apps_disallowed_modules) {
+ auto& app = pair.first;
+ auto rc_extension = RCHelpers::GetRCExtension(*app);
+ for (const auto& module_type : pair.second) {
+ rc_extension->UnsubscribeFromInteriorVehicleDataOfType(module_type);
+ auto apps_subscribed =
+ RCHelpers::AppsSubscribedToModuleType(app_mngr_, module_type);
+ if (apps_subscribed.empty()) {
+ UnsubscribeFromInteriorVehicleDataOfType(module_type);
+ }
+ }
+ }
+}
+
+void InteriorDataManagerImpl::UpdateHMISubscriptionsOnAppUnregistered(
+ application_manager::Application& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto rc_extension = RCHelpers::GetRCExtension(app);
+ auto subscribed_data = rc_extension->InteriorVehicleDataSubscriptions();
+ rc_extension->UnsubscribeFromInteriorVehicleData();
+ for (auto& data : subscribed_data) {
+ auto apps_subscribed = RCHelpers::AppsSubscribedToModule(app_mngr_, data);
+ if (apps_subscribed.empty()) {
+ UnsubscribeFromInteriorVehicleData(data);
+ }
+ if (apps_subscribed.size() == 1 &&
+ apps_subscribed.front()->hmi_app_id() == app.hmi_app_id()) {
+ UnsubscribeFromInteriorVehicleData(data);
+ }
+ }
+}
+
+void InteriorDataManagerImpl::UnsubscribeFromInteriorVehicleData(
+ const ModuleUid& module) {
+ cache_.Remove(module);
+ auto unsubscribe_request = RCHelpers::CreateUnsubscribeRequestToHMI(
+ module, app_mngr_.GetNextHMICorrelationID());
+ LOG4CXX_DEBUG(logger_,
+ "Send Unsubscribe from module type: " << module.first << " id: "
+ << module.second);
+ rpc_service_.ManageHMICommand(unsubscribe_request);
+}
+
+void InteriorDataManagerImpl::UnsubscribeFromInteriorVehicleDataOfType(
+ const std::string& module_type) {
+ const auto& modules = cache_.GetCachedModulesByType(module_type);
+
+ for (const auto& module : modules) {
+ cache_.Remove(module);
+ auto unsubscribe_request = RCHelpers::CreateUnsubscribeRequestToHMI(
+ module, app_mngr_.GetNextHMICorrelationID());
+ LOG4CXX_DEBUG(logger_,
+ "Send Unsubscribe from module type: "
+ << module.first << " id: " << module.second);
+ rpc_service_.ManageHMICommand(unsubscribe_request);
+ }
+}
+
+void InteriorDataManagerImpl::ClearOldRequestsToHMIHistory() {
+ auto limit =
+ app_mngr_.get_settings().get_interior_vehicle_data_frequency().second;
+ uint32_t time_frame = limit * date_time::MILLISECONDS_IN_SECOND;
+ auto lest_that_time_frame_ago = [time_frame](date_time::TimeDuration time) {
+ auto span = date_time::calculateTimeSpan(time);
+ return span < time_frame;
+ };
+ for (auto& it : requests_to_hmi_history_) {
+ auto& history = it.second;
+ auto first_actual =
+ std::find_if(history.begin(), history.end(), lest_that_time_frame_ago);
+ history.erase(history.begin(), first_actual);
+ }
+}
+
+InteriorDataManagerImpl::AppsModules
+InteriorDataManagerImpl::AppsSubscribedModules() {
+ auto apps_list = RCRPCPlugin::GetRCApplications(app_mngr_);
+ InteriorDataManagerImpl::AppsModules result;
+ for (auto& app_ptr : apps_list) {
+ const auto rc_extension = RCHelpers::GetRCExtension(*app_ptr);
+ auto app_subscriptions = rc_extension->InteriorVehicleDataSubscriptions();
+ result[app_ptr] = std::vector<ModuleUid>(app_subscriptions.size());
+ std::copy(app_subscriptions.begin(),
+ app_subscriptions.end(),
+ result[app_ptr].begin());
+ }
+ return result;
+}
+
+InteriorDataManagerImpl::AppsModuleTypes
+InteriorDataManagerImpl::AppsSubscribedModuleTypes() {
+ auto apps_list = RCRPCPlugin::GetRCApplications(app_mngr_);
+ RCHelpers::AppsModuleTypes result;
+ for (auto& app_ptr : apps_list) {
+ const auto rc_extension = RCHelpers::GetRCExtension(*app_ptr);
+ auto app_subscriptions = rc_extension->InteriorVehicleDataSubscriptions();
+ std::vector<std::string> app_module_types;
+
+ for (auto& app_subscription : app_subscriptions) {
+ app_module_types.push_back(app_subscription.first);
+ }
+
+ std::sort(app_module_types.begin(), app_module_types.end());
+ result[app_ptr] = app_module_types;
+ }
+ return result;
+}
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
index 5c0a94cccc..ea9c13113c 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
@@ -31,38 +31,85 @@
*/
#include "rc_rpc_plugin/rc_app_extension.h"
+#include <algorithm>
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "smart_objects/smart_object.h"
namespace rc_rpc_plugin {
RCAppExtension::RCAppExtension(application_manager::AppExtensionUID uid)
: AppExtension(uid) {}
-void RCAppExtension::SubscribeToInteriorVehicleData(
- const std::string& module_type) {
- subscribed_interior_vehicle_data_.insert(module_type);
+void RCAppExtension::SubscribeToInteriorVehicleData(const ModuleUid& module) {
+ subscribed_interior_vehicle_data_.insert(module);
}
void RCAppExtension::UnsubscribeFromInteriorVehicleData(
+ const ModuleUid& module) {
+ subscribed_interior_vehicle_data_.erase(module);
+}
+
+void RCAppExtension::UnsubscribeFromInteriorVehicleDataOfType(
const std::string& module_type) {
- subscribed_interior_vehicle_data_.erase(module_type);
+ for (auto& item : subscribed_interior_vehicle_data_) {
+ if (module_type == item.first) {
+ subscribed_interior_vehicle_data_.erase(item);
+ }
+ }
}
void RCAppExtension::UnsubscribeFromInteriorVehicleData() {
subscribed_interior_vehicle_data_.clear();
}
-bool RCAppExtension::IsSubscibedToInteriorVehicleData(
+bool RCAppExtension::IsSubscribedToInteriorVehicleDataOfType(
const std::string& module_type) {
- std::set<std::string>::iterator it =
- subscribed_interior_vehicle_data_.find(module_type);
+ auto it = std::find_if(subscribed_interior_vehicle_data_.begin(),
+ subscribed_interior_vehicle_data_.end(),
+ [&module_type](ModuleUid module) -> bool {
+ return module_type == module.first;
+ });
+
+ return (it != subscribed_interior_vehicle_data_.end());
+}
+
+bool RCAppExtension::IsSubscribedToInteriorVehicleData(
+ const ModuleUid& module) {
+ std::set<ModuleUid>::iterator it =
+ subscribed_interior_vehicle_data_.find(module);
return (it != subscribed_interior_vehicle_data_.end());
}
void RCAppExtension::SaveResumptionData(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& resumption_data) {}
+ ns_smart_device_link::ns_smart_objects::SmartObject& resumption_data) {}
void RCAppExtension::ProcessResumption(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& resumption_data) {}
+ const ns_smart_device_link::ns_smart_objects::SmartObject&
+ resumption_data) {}
+
+std::set<ModuleUid> RCAppExtension::InteriorVehicleDataSubscriptions() const {
+ return subscribed_interior_vehicle_data_;
+}
+
+Grid RCAppExtension::GetUserLocation() const {
+ return user_location_;
+}
+
+void RCAppExtension::SetUserLocation(
+ const ns_smart_device_link::ns_smart_objects::SmartObject& user_location) {
+ const auto grid = user_location[strings::kGrid];
+ const int32_t col = grid[strings::kCol].asInt();
+ const int32_t row = grid[strings::kRow].asInt();
+ const int32_t level = grid[strings::kLevel].asInt();
+ const int32_t colspan = grid[strings::kColspan].asInt();
+ const int32_t rowspan = grid[strings::kRowspan].asInt();
+ const int32_t levelspan = grid[strings::kLevelspan].asInt();
+ user_location_ = Grid(col, row, level, colspan, rowspan, levelspan);
+}
+
+void RCAppExtension::SetUserLocation(const Grid& grid) {
+ user_location_ = grid;
+}
RCAppExtension::~RCAppExtension() {}
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
new file mode 100644
index 0000000000..dbedd0167f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
@@ -0,0 +1,925 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the copyright holders nor the names of their contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "rc_rpc_plugin/rc_capabilities_manager_impl.h"
+#include "rc_rpc_plugin/rc_helpers.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+
+namespace rc_rpc_plugin {
+CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
+
+RCCapabilitiesManagerImpl::RCCapabilitiesManagerImpl(
+ application_manager::HMICapabilities& hmi_capabilities)
+ : hmi_capabilities_(hmi_capabilities) {}
+
+const std::string
+RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilitiesStructure(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& module_type) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (control_capabilities.keyExists(message_params::kModuleInfo)) {
+ // moduleId - mandatory param for ModuleInfo structure
+ const auto module_id = control_capabilities[message_params::kModuleInfo]
+ [message_params::kModuleId]
+ .asString();
+ LOG4CXX_WARN(logger_,
+ "Use default moduleId from hmi capabilities: "
+ << module_id
+ << " for requested moduleType: " << module_type);
+ return module_id;
+ }
+ LOG4CXX_WARN(logger_,
+ "There are no moduleInfo in hmi capabilities for requested "
+ "moduleType "
+ << module_type);
+ return "";
+}
+
+const std::string
+RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilitiesArray(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& module_type) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ for (auto& cap_item : *(control_capabilities.asArray())) {
+ if (cap_item.keyExists(message_params::kModuleInfo)) {
+ // moduleId - mandatory param for ModuleInfo structure
+ const auto module_id =
+ cap_item[message_params::kModuleInfo][message_params::kModuleId]
+ .asString();
+ LOG4CXX_WARN(logger_,
+ "Use default moduleId from hmi capabilities: "
+ << module_id
+ << " for requested moduleType: " << module_type);
+ return module_id;
+ }
+ }
+ LOG4CXX_WARN(logger_,
+ "There are no moduleInfo in hmi capabilities for requested "
+ "moduleType "
+ << module_type);
+ return "";
+}
+
+const std::string RCCapabilitiesManagerImpl::GetDefaultModuleIdFromCapabilities(
+ const std::string& module_type) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ const auto& mapping = RCHelpers::GetModuleTypeToCapabilitiesMapping();
+ if (!rc_capabilities.keyExists(mapping(module_type))) {
+ LOG4CXX_WARN(
+ logger_,
+ "There is no RC capability for requested module_type " << module_type);
+ return "";
+ }
+ if (enums_value::kHmiSettings == module_type ||
+ enums_value::kLight == module_type) {
+ return GetDefaultModuleIdFromCapabilitiesStructure(
+ rc_capabilities[mapping(module_type)], module_type);
+ }
+ return GetDefaultModuleIdFromCapabilitiesArray(
+ rc_capabilities[mapping(module_type)], module_type);
+}
+
+const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilitiesStructure(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& module_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (control_capabilities.keyExists(message_params::kModuleInfo) &&
+ (module_id == control_capabilities[message_params::kModuleInfo]
+ [message_params::kModuleId]
+ .asString())) {
+ return true;
+ }
+ LOG4CXX_WARN(logger_,
+ "There are no moduleInfo in hmi capabilities for requested "
+ "moduleId "
+ << module_id);
+ return false;
+}
+
+const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilitiesArrays(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& module_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ for (auto& cap_item : *(control_capabilities.asArray())) {
+ if (cap_item.keyExists(message_params::kModuleInfo) &&
+ (module_id ==
+ cap_item[message_params::kModuleInfo][message_params::kModuleId]
+ .asString())) {
+ return true;
+ }
+ }
+ LOG4CXX_WARN(logger_,
+ "There are no moduleInfo in hmi capabilities for requested "
+ "moduleId "
+ << module_id);
+ return false;
+}
+
+const bool RCCapabilitiesManagerImpl::CheckModuleIdWithCapabilities(
+ const smart_objects::SmartObject& rc_capabilities,
+ const ModuleUid& module) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (module.second.empty()) {
+ return true;
+ }
+ const auto& mapping = RCHelpers::GetModuleTypeToCapabilitiesMapping();
+ if (enums_value::kHmiSettings == module.first ||
+ enums_value::kLight == module.first) {
+ return CheckModuleIdWithCapabilitiesStructure(
+ rc_capabilities[mapping(module.first)], module.second);
+ }
+ return CheckModuleIdWithCapabilitiesArrays(
+ rc_capabilities[mapping(module.first)], module.second);
+}
+
+bool RCCapabilitiesManagerImpl::CheckIfModuleExistsInCapabilities(
+ const ModuleUid& module) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ const auto& mapping = RCHelpers::GetModuleTypeToCapabilitiesMapping();
+ const auto& resource_list = GetResources();
+ bool is_module_type_valid = false;
+ for (const auto& resource : resource_list) {
+ if (resource.first == module.first) {
+ if (rc_capabilities.keyExists(mapping(module.first)) &&
+ CheckModuleIdWithCapabilities(rc_capabilities, module)) {
+ is_module_type_valid = true;
+ break;
+ }
+ }
+ }
+ return is_module_type_valid;
+}
+
+const std::vector<std::string> RCCapabilitiesManagerImpl::GetCapabilitiesList()
+ const {
+ using namespace enums_value;
+ return {strings::kclimateControlCapabilities,
+ strings::kradioControlCapabilities,
+ strings::kseatControlCapabilities,
+ strings::kaudioControlCapabilities,
+ strings::klightControlCapabilities,
+ strings::khmiSettingsControlCapabilities};
+}
+
+const std::function<std::string(const std::string& control_cap)>
+RCCapabilitiesManagerImpl::GetCapabilitiesToModuleTypeMapping() const {
+ auto mapping_lambda = [](const std::string& control_cap) -> std::string {
+ static std::map<std::string, std::string> mapping = {
+ {strings::kclimateControlCapabilities, enums_value::kClimate},
+ {strings::kradioControlCapabilities, enums_value::kRadio},
+ {strings::kseatControlCapabilities, enums_value::kSeat},
+ {strings::kaudioControlCapabilities, enums_value::kAudio},
+ {strings::klightControlCapabilities, enums_value::kLight},
+ {strings::khmiSettingsControlCapabilities, enums_value::kHmiSettings}};
+ auto it = mapping.find(control_cap);
+ if (mapping.end() == it) {
+ LOG4CXX_ERROR(logger_, "Unknown control capability " << control_cap);
+ return std::string();
+ }
+ return it->second;
+ };
+
+ return mapping_lambda;
+}
+
+void RCCapabilitiesManagerImpl::GetResourcesFromCapabilitiesStructure(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& capability_key,
+ std::vector<ModuleUid>& out_resources) const {
+ const auto& mapping = GetCapabilitiesToModuleTypeMapping();
+ if (control_capabilities.keyExists(message_params::kModuleInfo)) {
+ std::string module_id = control_capabilities[message_params::kModuleInfo]
+ [message_params::kModuleId]
+ .asString();
+ out_resources.push_back(std::make_pair(mapping(capability_key), module_id));
+ } else {
+ LOG4CXX_WARN(logger_, "There are no moduleId in " << capability_key);
+ out_resources.push_back(std::make_pair(mapping(capability_key), ""));
+ }
+}
+
+void RCCapabilitiesManagerImpl::GetResourcesFromCapabilitiesArray(
+ const smart_objects::SmartObject& control_capabilities,
+ const std::string& capability_key,
+ std::vector<ModuleUid>& out_resources) const {
+ const auto& mapping = GetCapabilitiesToModuleTypeMapping();
+ for (auto cap_item : *(control_capabilities.asArray())) {
+ if (cap_item.keyExists(message_params::kModuleInfo)) {
+ std::string module_id =
+ cap_item[message_params::kModuleInfo][message_params::kModuleId]
+ .asString();
+ out_resources.push_back(
+ std::make_pair(mapping(capability_key), module_id));
+ } else {
+ LOG4CXX_WARN(logger_,
+ "There are no moduleId for item from " << capability_key);
+ out_resources.push_back(std::make_pair(mapping(capability_key), ""));
+ }
+ }
+}
+
+const std::vector<ModuleUid> RCCapabilitiesManagerImpl::GetResources() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<ModuleUid> resources;
+ auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ const auto& control_caps_list = GetCapabilitiesList();
+ for (const auto& capability_key : control_caps_list) {
+ if (rc_capabilities.keyExists(capability_key)) {
+ if (strings::khmiSettingsControlCapabilities == capability_key ||
+ strings::klightControlCapabilities == capability_key) {
+ GetResourcesFromCapabilitiesStructure(
+ rc_capabilities[capability_key], capability_key, resources);
+ } else {
+ GetResourcesFromCapabilitiesArray(
+ rc_capabilities[capability_key], capability_key, resources);
+ }
+ }
+ }
+ return resources;
+}
+
+const std::string RCCapabilitiesManagerImpl::GetModuleIdForSeatLocation(
+ const mobile_apis::SupportedSeat::eType id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ const auto seat_capabilities =
+ rc_capabilities[strings::kseatControlCapabilities];
+ if (seat_capabilities.length() > 0) {
+ if (mobile_apis::SupportedSeat::DRIVER == id) {
+ return seat_capabilities[0][message_params::kModuleInfo]
+ [message_params::kModuleId]
+ .asString();
+ }
+ if ((seat_capabilities.length() > 1) &&
+ mobile_apis::SupportedSeat::FRONT_PASSENGER == id) {
+ return seat_capabilities[1][message_params::kModuleInfo]
+ [message_params::kModuleId]
+ .asString();
+ }
+ }
+ LOG4CXX_DEBUG(logger_, "There are no capabitities for requested id: " << id);
+ return "";
+}
+
+bool RCCapabilitiesManagerImpl::CheckIfButtonExistInRCCaps(
+ const mobile_apis::ButtonName::eType button) const {
+ auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ if (rc_capabilities.keyExists(strings::kbuttonCapabilities)) {
+ const smart_objects::SmartObject& button_caps =
+ rc_capabilities[strings::kbuttonCapabilities];
+ for (auto& button_cap : *(button_caps.asArray())) {
+ int64_t current_id = button_cap[message_params::kName].asInt();
+ if (-1 == current_id) {
+ // capabilities received from HMI contains enum values
+ // capabilities loaded from file contains string values
+ // TODO : unificate capabilities storing
+ const std::string& bt_name =
+ button_cap[message_params::kName].asString();
+ static RCHelpers::ButtonsMap btn_map = RCHelpers::buttons_map();
+ current_id = btn_map[bt_name];
+ }
+ const mobile_apis::ButtonName::eType current_button =
+ static_cast<mobile_apis::ButtonName::eType>(current_id);
+ if (current_button == button) {
+ LOG4CXX_TRACE(
+ logger_,
+ "Button id " << current_button << " exist in capabilities");
+ return true;
+ }
+ }
+ }
+ LOG4CXX_TRACE(logger_,
+ "Button id " << button << " do not exist in capabilities");
+ return false;
+}
+
+smart_objects::SmartObject
+RCCapabilitiesManagerImpl::GetCapabilitiesByModuleIdFromArray(
+ const smart_objects::SmartObject& module_data_capabilities,
+ const std::string& module_id) const {
+ for (auto& cap_item : *(module_data_capabilities.asArray())) {
+ std::string current_id =
+ cap_item[message_params::kModuleInfo][message_params::kModuleId]
+ .asString();
+ if (module_id == current_id) {
+ return cap_item;
+ }
+ }
+ LOG4CXX_WARN(logger_,
+ "Capabilities for moduleId " << module_id
+ << " do not exist in capabilities");
+ return smart_objects::SmartObject(smart_objects::SmartType_Null);
+}
+
+bool RCCapabilitiesManagerImpl::CheckButtonName(
+ const std::string& module_type, const std::string& button_name) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto rc_capabilities = hmi_capabilities_.rc_capability();
+ if (!rc_capabilities) {
+ LOG4CXX_ERROR(logger_, "No remote controll capabilities available");
+ return false;
+ }
+
+ if (enums_value::kRadio == module_type) {
+ if (!helpers::in_range(RCHelpers::buttons_radio(), button_name)) {
+ LOG4CXX_WARN(logger_,
+ "Trying to acceess climate button with module type radio");
+ return false;
+ }
+ }
+
+ if (enums_value::kClimate == module_type) {
+ if (!helpers::in_range(RCHelpers::buttons_climate(), button_name)) {
+ LOG4CXX_WARN(logger_,
+ "Trying to acceess radio button with module type climate");
+ return false;
+ }
+ }
+ return true;
+}
+
+const std::map<std::string, std::string>
+RCCapabilitiesManagerImpl::GetLightCapabilitiesMapping() const {
+ std::map<std::string, std::string> mapping = {
+ {message_params::kId, strings::kName},
+ {message_params::kLightStatus, strings::kStatusAvailable},
+ {message_params::kLightDensity, strings::kDensityAvailable},
+ {message_params::kLightColor, strings::kRGBColorSpaceAvailable}};
+ return mapping;
+}
+
+const std::map<std::string, std::string>
+RCCapabilitiesManagerImpl::GetModuleDataToCapabilitiesMapping() const {
+ std::map<std::string, std::string> mapping;
+ using namespace message_params;
+ using namespace rc_rpc_plugin::strings;
+ // climate
+ mapping[kFanSpeed] = kFanSpeedAvailable;
+ mapping[kCurrentTemperature] = kCurrentTemperatureAvailable;
+ mapping[kDesiredTemperature] = kDesiredTemperatureAvailable;
+ mapping[kACEnable] = kAcEnableAvailable;
+ mapping[kCirculateAirEnable] = kCirculateAirEnableAvailable;
+ mapping[kAutoModeEnable] = kAutoModeEnableAvailable;
+ mapping[kDefrostZone] = kDefrostZoneAvailable;
+ mapping[kDualModeEnable] = kDualModeEnableAvailable;
+ mapping[kACMaxEnable] = kAcMaxEnableAvailable;
+ mapping[kVentilationMode] = kVentilationModeAvailable;
+ mapping[kHeatedSteeringWheelEnable] = kHeatedSteeringWheelAvailable;
+ mapping[kHeatedWindshieldEnable] = kHeatedWindshieldAvailable;
+ mapping[kHeatedMirrorsEnable] = kHeatedMirrorsAvailable;
+ mapping[kHeatedRearWindowEnable] = kHeatedRearWindowAvailable;
+ mapping[kClimateEnable] = kClimateEnableAvailable;
+ mapping[kClimateEnableAvailable] = kClimateEnableAvailable;
+
+ // radio
+ mapping[kBand] = kRadioBandAvailable;
+ mapping[kFrequencyInteger] = kRadioFrequencyAvailable;
+ mapping[kFrequencyFraction] = kRadioFrequencyAvailable;
+ mapping[kRdsData] = kRdsDataAvailable;
+ mapping[kAvailableHDs] = kAvailableHDsAvailable;
+ mapping[kAvailableHdChannels] = kAvailableHdChannelsAvailable;
+ mapping[kHdChannel] = kAvailableHdChannelsAvailable;
+ mapping[kHdRadioEnable] = kHdRadioEnableAvailable;
+ mapping[kSignalStrength] = kSignalStrengthAvailable;
+ mapping[kSignalChangeThreshold] = kSignalChangeThresholdAvailable;
+ mapping[kRadioEnable] = kRadioEnableAvailable;
+ mapping[kState] = kStateAvailable;
+ mapping[kSisData] = kSisDataAvailable;
+
+ // seat
+ mapping[kHeatingEnabled] = kHeatingEnabledAvailable;
+ mapping[kCoolingEnabled] = kCoolingEnabledAvailable;
+ mapping[kHeatingLevele] = kHeatingLevelAvailable;
+ mapping[kCoolingLevel] = kCoolingLevelAvailable;
+ mapping[kHorizontalPosition] = kHorizontalPositionAvailable;
+ mapping[kVerticalPosition] = kVerticalPositionAvailable;
+ mapping[kFrontVerticalPosition] = kFrontVerticalPositionAvailable;
+ mapping[kBackVerticalPosition] = kBackVerticalPositionAvailable;
+ mapping[kBackTiltAngle] = kBackTiltAngleAvailable;
+ mapping[kHeadSupportHorizontalPosition] =
+ kHeadSupportHorizontalPositionAvailable;
+ mapping[kHeadSupportVerticalPosition] = kHeadSupportVerticalPositionAvailable;
+ mapping[kMassageEnabled] = kMassageEnabledAvailable;
+ mapping[kMassageMode] = kMassageModeAvailable;
+ mapping[kMassageCushionFirmness] = kMassageCushionFirmnessAvailable;
+ mapping[kMemory] = kMemoryAvailable;
+
+ // audio
+ mapping[kSource] = kSourceAvailable;
+ mapping[kKeepContext] = kKeepContextAvailable;
+ mapping[kVolume] = kVolumeAvailable;
+ mapping[kEqualizerSettings] = kEqualizerAvailable;
+
+ // hmi settings
+ mapping[kDistanceUnit] = kDistanceUnitAvailable;
+ mapping[kTemperatureUnit] = kTemperatureUnitAvailable;
+ mapping[kDisplayMode] = kDisplayModeUnitAvailable;
+
+ return mapping;
+}
+
+ModuleTypeCapability RCCapabilitiesManagerImpl::GetModuleDataCapabilities(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+
+ const auto& all_module_types = RCHelpers::GetModuleTypesList();
+ const auto& get_module_data_key = RCHelpers::GetModuleTypeToDataMapping();
+ const auto& get_capabilities_key =
+ RCHelpers::GetModuleTypeToCapabilitiesMapping();
+ ModuleTypeCapability module_data_capabilities =
+ std::make_pair("", capabilitiesStatus::missedParam);
+
+ for (const auto& module_type : all_module_types) {
+ const auto module_data_key = get_module_data_key(module_type);
+ const auto capabilities_key = get_capabilities_key(module_type);
+ if (module_data.keyExists(module_data_key)) {
+ if (!rc_capabilities.keyExists(capabilities_key)) {
+ LOG4CXX_DEBUG(logger_, module_data_key << " capabilities not present");
+ return module_data_capabilities;
+ }
+ const auto& caps = rc_capabilities[capabilities_key];
+
+ if (message_params::kHmiSettingsControlData == module_data_key ||
+ message_params::kLightControlData == module_data_key) {
+ module_data_capabilities =
+ GetControlDataCapabilities(caps, module_data[module_data_key]);
+ } else {
+ module_data_capabilities = GetControlDataCapabilities(
+ GetCapabilitiesByModuleIdFromArray(caps, module_id),
+ module_data[module_data_key]);
+ }
+ }
+ }
+
+ return module_data_capabilities;
+}
+
+ModuleTypeCapability RCCapabilitiesManagerImpl::GetControlDataCapabilities(
+ const smart_objects::SmartObject& capabilities,
+ const smart_objects::SmartObject& control_data) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::map<std::string, std::string> mapping =
+ GetModuleDataToCapabilitiesMapping();
+
+ for (auto it = control_data.map_begin(); it != control_data.map_end(); ++it) {
+ const std::string& request_parameter = it->first;
+ if (message_params::kId == request_parameter) {
+ continue;
+ }
+ if (message_params::kLightState == request_parameter) {
+ ModuleTypeCapability light_capability =
+ std::make_pair("", capabilitiesStatus::success);
+
+ for (auto& light_data : *(control_data[request_parameter].asArray())) {
+ light_capability = GetLightNameCapabilities(
+ capabilities[strings::kSupportedLights], light_data);
+
+ if (capabilitiesStatus::success != light_capability.second) {
+ return light_capability;
+ }
+ }
+
+ return light_capability;
+ }
+ if (message_params::kBand == request_parameter) {
+ ModuleTypeCapability radio_capability = GetRadioBandByCapabilities(
+ capabilities, control_data[request_parameter]);
+ if (capabilitiesStatus::success != radio_capability.second) {
+ return radio_capability;
+ }
+ }
+
+ const capabilitiesStatus status_item_capability =
+ GetItemCapability(capabilities,
+ mapping,
+ request_parameter,
+ mobile_apis::Result::UNSUPPORTED_RESOURCE);
+
+ if (capabilitiesStatus::success != status_item_capability) {
+ return std::make_pair("", status_item_capability);
+ }
+ }
+
+ return std::make_pair("", capabilitiesStatus::success);
+}
+
+capabilitiesStatus RCCapabilitiesManagerImpl::GetItemCapability(
+ const smart_objects::SmartObject& capabilities,
+ const std::map<std::string, std::string>& mapping,
+ const std::string& request_parameter,
+ const mobile_apis::Result::eType& switched_off_result) const {
+ const auto it = mapping.find(request_parameter);
+
+ if (it == mapping.end()) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Parameter " << request_parameter << " doesn't exist in capabilities.");
+ return capabilitiesStatus::missedParam;
+ }
+
+ const std::string& caps_key = it->second;
+
+ LOG4CXX_DEBUG(logger_,
+ "Checking request parameter "
+ << request_parameter
+ << " with capabilities. Appropriate key is " << caps_key);
+
+ if (!capabilities.keyExists(caps_key)) {
+ LOG4CXX_DEBUG(logger_,
+ "Capability " << caps_key
+ << " is missed in RemoteControl capabilities");
+ return capabilitiesStatus::missedParam;
+ }
+
+ if (!capabilities[caps_key].asBool()) {
+ LOG4CXX_DEBUG(logger_,
+ "Capability "
+ << caps_key
+ << " is switched off in RemoteControl capabilities");
+ capabilitiesStatus status = capabilitiesStatus::missedParam;
+ if (mobile_apis::Result::READ_ONLY == switched_off_result) {
+ status = capabilitiesStatus::readOnly;
+ }
+ return status;
+ }
+
+ return capabilitiesStatus::success;
+}
+
+ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightDataCapabilities(
+ const smart_objects::SmartObject& capabilities,
+ const smart_objects::SmartObject& control_data) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::map<std::string, std::string> mapping = GetLightCapabilitiesMapping();
+
+ for (auto it = control_data.map_begin(); it != control_data.map_end(); ++it) {
+ const std::string& request_parameter = it->first;
+
+ if (message_params::kId == request_parameter) {
+ continue;
+ }
+
+ const capabilitiesStatus status_item_capability =
+ GetItemCapability(capabilities,
+ mapping,
+ request_parameter,
+ mobile_apis::Result::READ_ONLY);
+
+ if (capabilitiesStatus::success != status_item_capability) {
+ return std::make_pair(message_params::kLightState,
+ status_item_capability);
+ }
+ }
+
+ return std::make_pair("", capabilitiesStatus::success);
+}
+
+ModuleTypeCapability RCCapabilitiesManagerImpl::GetLightNameCapabilities(
+ const smart_objects::SmartObject& capabilities_status,
+ const smart_objects::SmartObject& light_data) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ for (auto& so : *(capabilities_status.asArray())) {
+ const int64_t current_id = so[message_params::kName].asInt();
+ if (current_id == light_data[message_params::kId].asInt()) {
+ return GetLightDataCapabilities(so, light_data);
+ }
+ }
+ LOG4CXX_DEBUG(logger_, "There is no such light name in capabilities");
+ return std::make_pair(message_params::kLightState,
+ capabilitiesStatus::missedLightName);
+}
+
+ModuleTypeCapability RCCapabilitiesManagerImpl::GetRadioBandByCapabilities(
+ const smart_objects::SmartObject& capabilities_status,
+ const smart_objects::SmartObject& request_parameter) const {
+ mobile_apis::RadioBand::eType radio_band =
+ static_cast<mobile_apis::RadioBand::eType>(request_parameter.asUInt());
+ if (mobile_apis::RadioBand::XM == radio_band) {
+ if (!capabilities_status.keyExists(strings::kSiriusxmRadioAvailable)) {
+ LOG4CXX_DEBUG(logger_,
+ "Capability "
+ << strings::kSiriusxmRadioAvailable
+ << " is missed in RemoteControl capabilities");
+ return std::make_pair(strings::kSiriusxmRadioAvailable,
+ capabilitiesStatus::missedParam);
+ }
+ if (!capabilities_status[strings::kSiriusxmRadioAvailable].asBool()) {
+ LOG4CXX_DEBUG(logger_,
+ "Capability "
+ << strings::kSiriusxmRadioAvailable
+ << " is switched off in RemoteControl capabilities");
+ return std::make_pair(strings::kSiriusxmRadioAvailable,
+ capabilitiesStatus::missedParam);
+ }
+ }
+ return std::make_pair("", capabilitiesStatus::success);
+}
+
+const smart_objects::SmartObject& RCCapabilitiesManagerImpl::ControlDataForType(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_type) const {
+ const auto& all_module_types = RCHelpers::GetModuleTypesList();
+ const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping();
+ for (const auto& type : all_module_types) {
+ if (type == module_type) {
+ return module_data[data_mapping(type)];
+ }
+ }
+ NOTREACHED();
+ return module_data[0];
+}
+
+bool RCCapabilitiesManagerImpl::CheckReadOnlyParamsForAudio(
+ const smart_objects::SmartObject& module_type_params) const {
+ if (module_type_params.keyExists(message_params::kEqualizerSettings)) {
+ const auto& equalizer_settings =
+ module_type_params[message_params::kEqualizerSettings];
+
+ for (auto& so : *(equalizer_settings.asArray())) {
+ if (so.keyExists(message_params::kChannelName)) {
+ LOG4CXX_DEBUG(logger_,
+ "READ ONLY parameter. ChannelName = "
+ << so[message_params::kChannelName].asString());
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool RCCapabilitiesManagerImpl::CheckReadOnlyParamsForLight(
+ const smart_objects::SmartObject& module_type_params) const {
+ if (module_type_params.keyExists(message_params::kLightState)) {
+ const auto& light_state = module_type_params[message_params::kLightState];
+
+ for (auto& light_data : *(light_state.asArray())) {
+ if (light_data.keyExists(message_params::kLightStatus)) {
+ const mobile_apis::LightStatus::eType light_status =
+ static_cast<mobile_apis::LightStatus::eType>(
+ light_data[message_params::kLightStatus].asUInt());
+
+ if (helpers::Compare<mobile_apis::LightStatus::eType,
+ helpers::EQ,
+ helpers::ONE>(light_status,
+ mobile_apis::LightStatus::RAMP_UP,
+ mobile_apis::LightStatus::RAMP_DOWN,
+ mobile_apis::LightStatus::UNKNOWN,
+ mobile_apis::LightStatus::INVALID)) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "READ ONLY parameter. Status = "
+ << light_data[message_params::kLightStatus].asInt());
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+bool RCCapabilitiesManagerImpl::AreReadOnlyParamsPresent(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_type,
+ ModuleTypeCapability& module_data_capabilities) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject& module_type_params =
+ ControlDataForType(module_data, module_type);
+
+ if (enums_value::kAudio == module_type) {
+ return CheckReadOnlyParamsForAudio(module_type_params);
+ }
+
+ if (enums_value::kLight == module_type) {
+ const bool result = CheckReadOnlyParamsForLight(module_type_params);
+
+ if (result) {
+ module_data_capabilities =
+ std::make_pair(module_type, capabilitiesStatus::readOnly);
+ }
+ return result;
+ }
+
+ const std::vector<std::string> ro_params =
+ RCHelpers::GetModuleReadOnlyParams(module_type);
+ auto it = module_type_params.map_begin();
+
+ for (; it != module_type_params.map_end(); ++it) {
+ if (helpers::in_range(ro_params, it->first)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool RCCapabilitiesManagerImpl::AreAllParamsReadOnly(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_type) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject& module_type_params =
+ ControlDataForType(module_data, module_type);
+ auto it = module_type_params.map_begin();
+ std::vector<std::string> ro_params =
+ RCHelpers::GetModuleReadOnlyParams(module_type);
+ for (; it != module_type_params.map_end(); ++it) {
+ if (!helpers::in_range(ro_params, it->first)) {
+ return false;
+ }
+ }
+
+ LOG4CXX_DEBUG(logger_, "All params are ReadOnly");
+ return true;
+}
+
+bool RCCapabilitiesManagerImpl::IsSeatLocationCapabilityProvided() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto seat_location_capability = hmi_capabilities_.seat_location_capability();
+ if (!seat_location_capability || seat_location_capability->empty()) {
+ LOG4CXX_DEBUG(logger_, "Seat Location capability is not provided by HMI");
+ return false;
+ }
+
+ if (seat_location_capability->keyExists(strings::kRows) &&
+ seat_location_capability->keyExists(strings::kCols) &&
+ seat_location_capability->keyExists(strings::kLevels) &&
+ seat_location_capability->keyExists(strings::kSeats)) {
+ const auto* seats = (*seat_location_capability)[strings::kSeats].asArray();
+ if (!seats->empty()) {
+ return true;
+ }
+ }
+
+ LOG4CXX_DEBUG(
+ logger_,
+ "Seat Location capability doesn't contain all necessary parameters");
+ return false;
+}
+
+const Grid
+RCCapabilitiesManagerImpl::GetDriverLocationFromSeatLocationCapability() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ Grid grid;
+ if (IsSeatLocationCapabilityProvided()) {
+ auto seat_location_capability =
+ hmi_capabilities_.seat_location_capability();
+ const auto* seats = (*seat_location_capability)[strings::kSeats].asArray();
+ const auto& driver_seat = (*seats)[0];
+ if (driver_seat.keyExists(strings::kGrid)) {
+ const auto& driver_location = driver_seat[strings::kGrid];
+ grid = Grid(driver_location[strings::kCol].asInt(),
+ driver_location[strings::kRow].asInt(),
+ driver_location[strings::kLevel].asInt(),
+ driver_location[strings::kColspan].asInt(),
+ driver_location[strings::kRowspan].asInt(),
+ driver_location[strings::kLevelspan].asInt());
+ } else {
+ LOG4CXX_DEBUG(logger_, "Driver's location doesn't provided");
+ }
+ }
+ return grid;
+}
+
+Grid RCCapabilitiesManagerImpl::GetWholeVehicleArea() const {
+ auto seat_location_capability =
+ *(hmi_capabilities_.seat_location_capability());
+ int32_t colspan = seat_location_capability.keyExists(strings::kCols)
+ ? seat_location_capability[strings::kCols].asInt()
+ : 0;
+
+ int32_t rowspan = seat_location_capability.keyExists(strings::kRows)
+ ? seat_location_capability[strings::kRows].asInt()
+ : 0;
+
+ int32_t levelspan = seat_location_capability.keyExists(strings::kLevels)
+ ? seat_location_capability[strings::kLevels].asInt()
+ : 0;
+ return Grid(0, 0, 0, colspan, rowspan, levelspan);
+}
+
+Grid RCCapabilitiesManagerImpl::GetModuleLocationFromControlCapability(
+ const smart_objects::SmartObject& control_capabilities) const {
+ if (control_capabilities[message_params::kModuleInfo].keyExists(
+ strings::kLocation)) {
+ const auto& location =
+ control_capabilities[message_params::kModuleInfo][strings::kLocation];
+
+ return Grid(location[strings::kCol].asInt(),
+ location[strings::kRow].asInt(),
+ location[strings::kLevel].asInt(),
+ location[strings::kColspan].asInt(),
+ location[strings::kRowspan].asInt(),
+ location[strings::kLevelspan].asInt());
+ }
+ return GetWholeVehicleArea();
+}
+
+Grid RCCapabilitiesManagerImpl::GetModuleServiceAreaFromControlCapability(
+ const smart_objects::SmartObject& control_capabilities) const {
+ if (control_capabilities.keyExists(message_params::kModuleInfo)) {
+ if (control_capabilities[message_params::kModuleInfo].keyExists(
+ strings::kServiceArea)) {
+ const auto& serviceArea =
+ control_capabilities[message_params::kModuleInfo]
+ [strings::kServiceArea];
+
+ return Grid(serviceArea[strings::kCol].asInt(),
+ serviceArea[strings::kRow].asInt(),
+ serviceArea[strings::kLevel].asInt(),
+ serviceArea[strings::kColspan].asInt(),
+ serviceArea[strings::kRowspan].asInt(),
+ serviceArea[strings::kLevelspan].asInt());
+ }
+ }
+ return GetModuleLocationFromControlCapability(control_capabilities);
+}
+
+Grid RCCapabilitiesManagerImpl::GetModuleServiceArea(
+ const ModuleUid& module) const {
+ auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ const auto& mapping = RCHelpers::GetModuleTypeToCapabilitiesMapping();
+ const auto& module_type = module.first;
+ const auto& capabilities_key = mapping(module_type);
+ if (!rc_capabilities.keyExists(capabilities_key)) {
+ LOG4CXX_DEBUG(logger_, module_type << "control capabilities not present");
+ return Grid();
+ }
+ const auto& caps = rc_capabilities[capabilities_key];
+
+ if (strings::khmiSettingsControlCapabilities == capabilities_key ||
+ strings::klightControlCapabilities == capabilities_key) {
+ return GetModuleServiceAreaFromControlCapability(caps);
+ } else {
+ const auto& capability_item =
+ GetCapabilitiesByModuleIdFromArray(caps, module.second);
+ return GetModuleServiceAreaFromControlCapability(capability_item);
+ }
+}
+
+bool RCCapabilitiesManagerImpl::IsMultipleAccessAllowedInControlCaps(
+ const smart_objects::SmartObject& control_capabilities) const {
+ if (control_capabilities.keyExists(message_params::kModuleInfo) &&
+ control_capabilities[message_params::kModuleInfo].keyExists(
+ strings::kAllowMultipleAccess)) {
+ return control_capabilities[message_params::kModuleInfo]
+ [strings::kAllowMultipleAccess]
+ .asBool();
+ }
+ return true;
+}
+
+bool RCCapabilitiesManagerImpl::IsMultipleAccessAllowed(
+ const ModuleUid& module) const {
+ auto rc_capabilities = *(hmi_capabilities_.rc_capability());
+ const auto& mapping = RCHelpers::GetModuleTypeToCapabilitiesMapping();
+ const auto& module_type = module.first;
+ const auto& capabilities_key = mapping(module_type);
+ if (!rc_capabilities.keyExists(capabilities_key)) {
+ LOG4CXX_DEBUG(logger_, module_type << "control capabilities not present");
+ return false;
+ }
+ const auto& caps = rc_capabilities[capabilities_key];
+
+ if (strings::khmiSettingsControlCapabilities == capabilities_key ||
+ strings::klightControlCapabilities == capabilities_key) {
+ return IsMultipleAccessAllowedInControlCaps(caps);
+ } else {
+ return IsMultipleAccessAllowedInControlCaps(
+ GetCapabilitiesByModuleIdFromArray(caps, module.second));
+ }
+}
+
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc
index 707d35aa0f..4ca2cf5182 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc
@@ -29,48 +29,49 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <iostream>
-#include "rc_rpc_plugin/rc_command_factory.h"
-#include "rc_rpc_plugin/commands/mobile/button_press_request.h"
-#include "rc_rpc_plugin/commands/mobile/button_press_response.h"
-#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h"
-#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h"
-#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_request.h"
-#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_response.h"
-#include "rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h"
-#include "rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_response.h"
-#include "rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h"
#include "rc_rpc_plugin/commands/hmi/rc_button_press_request.h"
#include "rc_rpc_plugin/commands/hmi/rc_button_press_response.h"
+#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_request.h"
+#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_response.h"
#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h"
#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_response.h"
#include "rc_rpc_plugin/commands/hmi/rc_on_interior_vehicle_data_notification.h"
#include "rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h"
+#include "rc_rpc_plugin/commands/hmi/rc_set_global_properties_request.h"
+#include "rc_rpc_plugin/commands/hmi/rc_set_global_properties_response.h"
#include "rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_request.h"
#include "rc_rpc_plugin/commands/hmi/rc_set_interior_vehicle_data_response.h"
+#include "rc_rpc_plugin/commands/mobile/button_press_request.h"
+#include "rc_rpc_plugin/commands/mobile/button_press_response.h"
+#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_request.h"
+#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_response.h"
+#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h"
+#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h"
+#include "rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h"
+#include "rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_request.h"
+#include "rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_response.h"
+#include "rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h"
+#include "rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_response.h"
+#include "rc_rpc_plugin/rc_command_factory.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
#include "rc_rpc_plugin/resource_allocation_manager.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
namespace application_manager {
+using rc_rpc_plugin::InteriorDataCache;
+using rc_rpc_plugin::RCCommandParams;
using rc_rpc_plugin::ResourceAllocationManager;
template <typename RCCommandType>
class RCCommandCreator : public CommandCreator {
public:
- RCCommandCreator(ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- PolicyHandlerInterface& policy_handler,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager_(application_manager)
- , rpc_service_(rpc_service)
- , hmi_capabilities_(hmi_capabilities)
- , policy_handler_(policy_handler)
- , resource_allocation_manager_(resource_allocation_manager) {}
+ RCCommandCreator(const RCCommandParams& params) : params_(params) {}
private:
bool CanBeCreated() const override {
@@ -79,20 +80,11 @@ class RCCommandCreator : public CommandCreator {
CommandSharedPtr create(
const commands::MessageSharedPtr& message) const override {
- CommandSharedPtr command(new RCCommandType(message,
- application_manager_,
- rpc_service_,
- hmi_capabilities_,
- policy_handler_,
- resource_allocation_manager_));
+ CommandSharedPtr command(new RCCommandType(message, params_));
return command;
}
- ApplicationManager& application_manager_;
- RPCService& rpc_service_;
- HMICapabilities& hmi_capabilities_;
- PolicyHandlerInterface& policy_handler_;
- ResourceAllocationManager& resource_allocation_manager_;
+ RCCommandParams params_;
};
struct RCInvalidCommand {};
@@ -100,16 +92,8 @@ struct RCInvalidCommand {};
template <>
class RCCommandCreator<RCInvalidCommand> : public CommandCreator {
public:
- RCCommandCreator(ApplicationManager& application_manager,
- RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- PolicyHandlerInterface& policy_handler,
- ResourceAllocationManager& resource_allocation_manager) {
- UNUSED(application_manager);
- UNUSED(rpc_service);
- UNUSED(hmi_capabilities);
- UNUSED(policy_handler);
- UNUSED(resource_allocation_manager);
+ RCCommandCreator(const RCCommandParams& params) {
+ UNUSED(params);
}
private:
@@ -125,54 +109,29 @@ class RCCommandCreator<RCInvalidCommand> : public CommandCreator {
};
struct RCCommandCreatorFactory {
- RCCommandCreatorFactory(
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- PolicyHandlerInterface& policy_handler,
- ResourceAllocationManager& resource_allocation_manager)
- : application_manager_(application_manager)
- , rpc_service_(rpc_service)
- , hmi_capabilities_(hmi_capabilities)
- , policy_handler_(policy_handler)
- , resource_allocation_manager_(resource_allocation_manager) {}
+ RCCommandCreatorFactory(const RCCommandParams& params) : params_(params) {}
template <typename RCCommandType>
CommandCreator& GetCreator() {
- static RCCommandCreator<RCCommandType> res(application_manager_,
- rpc_service_,
- hmi_capabilities_,
- policy_handler_,
- resource_allocation_manager_);
+ LOG4CXX_AUTO_TRACE(logger_);
+ static RCCommandCreator<RCCommandType> res(params_);
return res;
}
- ApplicationManager& application_manager_;
- RPCService& rpc_service_;
- HMICapabilities& hmi_capabilities_;
- PolicyHandlerInterface& policy_handler_;
- ResourceAllocationManager& resource_allocation_manager_;
+ const RCCommandParams params_;
};
-}
+} // namespace application_manager
namespace rc_rpc_plugin {
using namespace application_manager;
-RCCommandFactory::RCCommandFactory(
- app_mngr::ApplicationManager& app_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler,
- ResourceAllocationManager& allocation_manager)
- : app_manager_(app_manager)
- , rpc_service_(rpc_service)
- , hmi_capabilities_(hmi_capabilities)
- , policy_handler_(policy_handler)
- , allocation_manager_(allocation_manager) {}
+RCCommandFactory::RCCommandFactory(const RCCommandParams& params)
+ : params_(params) {}
CommandSharedPtr RCCommandFactory::CreateCommand(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::commands::Command::CommandSource source) {
- if (app_mngr::commands::Command::SOURCE_HMI == source) {
+ if (app_mngr::commands::Command::SOURCE_HMI == source ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) {
hmi_apis::messageType::eType message_type =
static_cast<hmi_apis::messageType::eType>(
(*message)[strings::params][strings::message_type].asInt());
@@ -191,7 +150,7 @@ CommandSharedPtr RCCommandFactory::CreateCommand(
static_cast<mobile_apis::FunctionID::eType>(
(*message)[strings::params][strings::function_id].asInt());
- return get_mobile_creator_factory(function_id, message_type)
+ return get_mobile_creator_factory(function_id, message_type, source)
.create(message);
}
}
@@ -201,69 +160,117 @@ bool RCCommandFactory::IsAbleToProcess(
const application_manager::commands::Command::CommandSource message_source)
const {
using app_mngr::commands::Command;
- if (Command::SOURCE_HMI == message_source) {
+ if (Command::SOURCE_HMI == message_source ||
+ Command::SOURCE_SDL_TO_HMI == message_source) {
return get_hmi_creator_factory(
static_cast<hmi_apis::FunctionID::eType>(function_id),
- hmi_apis::messageType::INVALID_ENUM).CanBeCreated();
+ hmi_apis::messageType::INVALID_ENUM)
+ .CanBeCreated();
} else {
- return get_mobile_creator_factory(
- static_cast<mobile_api::FunctionID::eType>(function_id),
- mobile_api::messageType::INVALID_ENUM).CanBeCreated();
+ auto id = static_cast<mobile_apis::FunctionID::eType>(function_id);
+ return get_mobile_command_creator(id,
+ mobile_apis::messageType::INVALID_ENUM)
+ .CanBeCreated() ||
+ get_mobile_notification_creator(id).CanBeCreated();
}
}
-CommandCreator& RCCommandFactory::get_mobile_creator_factory(
- mobile_api::FunctionID::eType id,
- mobile_api::messageType::eType message_type) const {
+CommandCreator& RCCommandFactory::get_mobile_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const {
LOG4CXX_DEBUG(logger_,
- "CreateMobileCommand function_id: " << id << " message_type: "
- << message_type);
- RCCommandCreatorFactory rc_factory(app_manager_,
- rpc_service_,
- hmi_capabilities_,
- policy_handler_,
- allocation_manager_);
-
+ "get_mobile_command_creator function_id: "
+ << id << " message_type: " << message_type);
+ RCCommandCreatorFactory rc_factory(params_);
switch (id) {
case mobile_apis::FunctionID::ButtonPressID: {
- return mobile_api::messageType::request == message_type
+ return mobile_apis::messageType::request == message_type
? rc_factory.GetCreator<commands::ButtonPressRequest>()
: rc_factory.GetCreator<commands::ButtonPressResponse>();
}
case mobile_apis::FunctionID::GetInteriorVehicleDataID: {
- return mobile_api::messageType::request == message_type
+ return mobile_apis::messageType::request == message_type
? rc_factory
.GetCreator<commands::GetInteriorVehicleDataRequest>()
: rc_factory
.GetCreator<commands::GetInteriorVehicleDataResponse>();
}
case mobile_apis::FunctionID::SetInteriorVehicleDataID: {
- return mobile_api::messageType::request == message_type
+ return mobile_apis::messageType::request == message_type
? rc_factory
.GetCreator<commands::SetInteriorVehicleDataRequest>()
: rc_factory
.GetCreator<commands::SetInteriorVehicleDataResponse>();
}
+ case mobile_apis::FunctionID::ReleaseInteriorVehicleDataModuleID: {
+ return mobile_apis::messageType::request == message_type
+ ? rc_factory.GetCreator<
+ commands::ReleaseInteriorVehicleDataModuleRequest>()
+ : rc_factory.GetCreator<
+ commands::ReleaseInteriorVehicleDataModuleResponse>();
+ }
+ case mobile_apis::FunctionID::GetInteriorVehicleDataConsentID: {
+ return mobile_apis::messageType::request == message_type
+ ? rc_factory.GetCreator<
+ commands::GetInteriorVehicleDataConsentRequest>()
+ : rc_factory.GetCreator<
+ commands::GetInteriorVehicleDataConsentResponse>();
+ }
+ default: {}
+ }
+ return rc_factory.GetCreator<RCInvalidCommand>();
+}
+
+CommandCreator& RCCommandFactory::get_mobile_notification_creator(
+ const mobile_apis::FunctionID::eType id) const {
+ RCCommandCreatorFactory rc_factory(params_);
+ switch (id) {
case mobile_apis::FunctionID::OnInteriorVehicleDataID: {
return rc_factory
.GetCreator<commands::OnInteriorVehicleDataNotification>();
}
- default: { return rc_factory.GetCreator<RCInvalidCommand>(); }
+ default: {}
}
+ return rc_factory.GetCreator<RCInvalidCommand>();
+}
+
+CommandCreator& RCCommandFactory::get_mobile_creator_factory(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const {
+ RCCommandCreatorFactory rc_factory(params_);
+ switch (message_type) {
+ case mobile_apis::messageType::request: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) {
+ return get_mobile_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_apis::messageType::response: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_mobile_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_apis::messageType::notification: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_mobile_notification_creator(id);
+ }
+ break;
+ }
+ default: {}
+ }
+ return rc_factory.GetCreator<RCInvalidCommand>();
}
CommandCreator& RCCommandFactory::get_hmi_creator_factory(
- hmi_apis::FunctionID::eType id,
- hmi_apis::messageType::eType message_type) const {
+ const hmi_apis::FunctionID::eType id,
+ const hmi_apis::messageType::eType message_type) const {
LOG4CXX_DEBUG(logger_,
"CreateHMICommand function_id: " << id << " message_type: "
<< message_type);
- RCCommandCreatorFactory rc_factory(app_manager_,
- rpc_service_,
- hmi_capabilities_,
- policy_handler_,
- allocation_manager_);
+ RCCommandCreatorFactory rc_factory(params_);
switch (id) {
case hmi_apis::FunctionID::Buttons_ButtonPress: {
@@ -300,7 +307,14 @@ CommandCreator& RCCommandFactory::get_hmi_creator_factory(
return rc_factory
.GetCreator<commands::RCOnRemoteControlSettingsNotification>();
}
+ case hmi_apis::FunctionID::RC_SetGlobalProperties: {
+ return hmi_apis::messageType::request == message_type
+ ? rc_factory
+ .GetCreator<commands::RCSetGlobalPropertiesRequest>()
+ : rc_factory
+ .GetCreator<commands::RCSetGlobalPropertiesResponse>();
+ }
default: { return rc_factory.GetCreator<RCInvalidCommand>(); }
}
}
-}
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc
new file mode 100644
index 0000000000..1d7db181eb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc
@@ -0,0 +1,416 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <algorithm>
+
+#include "application_manager/application_manager.h"
+#include "application_manager/smart_object_keys.h"
+#include "json/json.h"
+#include "rc_rpc_plugin/rc_consent_manager_impl.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "resumption/last_state.h"
+#include "smart_objects/smart_object.h"
+#include "utils/date_time.h"
+#include "utils/logger.h"
+
+namespace rc_rpc_plugin {
+namespace app_mngr = application_manager;
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "RCConsentManager")
+
+RCConsentManagerImpl::RCConsentManagerImpl(
+ resumption::LastStateWrapperPtr last_state,
+ application_manager::ApplicationManager& application_manager,
+ const uint32_t period_of_consent_expired)
+ : app_manager_(application_manager)
+ , last_state_(last_state)
+ , period_of_consent_expired_(period_of_consent_expired) {}
+
+void RCConsentManagerImpl::SaveModuleConsents(
+ const std::string& policy_app_id,
+ const std::string& mac_address,
+ const rc_rpc_types::ModuleIdConsentVector& module_consents) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ for (const auto& consent : module_consents) {
+ std::string module_type = consent.module_id.first;
+
+ auto last_state_accessor = last_state_->get_accessor();
+ auto last_state_dictionary = last_state_accessor.GetData().dictionary();
+
+ auto& app_module_consents = GetModuleTypeConsentsOrAppend(
+ policy_app_id, mac_address, module_type, last_state_dictionary);
+ SaveAppModuleConsent(app_module_consents, consent);
+
+ last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary);
+ }
+}
+
+rc_rpc_types::ModuleConsent RCConsentManagerImpl::GetModuleConsent(
+ const std::string& app_id,
+ const std::string& mac_address,
+ const rc_rpc_types::ModuleUid& module_id) {
+ sync_primitives::AutoLock autolock(module_consents_lock_);
+
+ auto last_state_accessor = last_state_->get_accessor();
+ auto last_state_dictionary = last_state_accessor.GetData().dictionary();
+
+ auto& module_consents = GetModuleTypeConsentsOrAppend(
+ app_id, mac_address, module_id.first, last_state_dictionary);
+
+ last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary);
+
+ if (module_consents.empty()) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "For app: " << app_id << " module type doesn't have any consents");
+ return rc_rpc_types::ModuleConsent::NOT_EXISTS;
+ }
+
+ for (const auto& conset_item : module_consents) {
+ if (conset_item[message_params::kModuleId].asString() == module_id.second) {
+ return static_cast<rc_rpc_types::ModuleConsent>(
+ conset_item[message_params::kConsent].asUInt());
+ }
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "For app: " << app_id << " and module resource ["
+ << module_id.first << ":" << module_id.second
+ << "] consent is absent");
+
+ return rc_rpc_types::ModuleConsent::NOT_EXISTS;
+}
+
+void RCConsentManagerImpl::RemoveExpiredConsents() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto last_state_accessor = last_state_->get_accessor();
+ auto last_state_dictionary = last_state_accessor.GetData().dictionary();
+
+ auto& remote_control = GetRemoteControlDataOrAppend(last_state_dictionary);
+ if (remote_control.empty()) {
+ last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary);
+ return;
+ }
+
+ auto& devices = GetAppsConsentsOrAppend(last_state_dictionary);
+
+ sync_primitives::AutoLock autolock(device_applications_lock_);
+
+ for (auto& device_item : devices) {
+ RemoveDeviceExpiredConsents(device_item);
+ }
+
+ last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary);
+}
+
+void RCConsentManagerImpl::RemoveAllConsents() {
+ auto last_state_accessor = last_state_->get_accessor();
+ auto last_state_dictionary = last_state_accessor.GetData().dictionary();
+
+ auto& remote_control = GetRemoteControlDataOrAppend(last_state_dictionary);
+ remote_control.removeMember(message_params::kAppConsents);
+
+ last_state_accessor.GetMutableData().set_dictionary(last_state_dictionary);
+}
+
+rc_rpc_types::ModuleConsentState RCConsentManagerImpl::CheckModuleConsentState(
+ const Json::Value& module_consent) const {
+ if (!module_consent.isMember(message_params::kConsentDate)) {
+ LOG4CXX_DEBUG(logger_, "Date of consent is absent");
+ return rc_rpc_types::ModuleConsentState::NOT_EXISTS;
+ }
+
+ const uint32_t period_for_expiring =
+ app_manager_.get_settings().period_for_consent_expiration();
+
+ const time_t consent_date = static_cast<time_t>(
+ module_consent[message_params::kConsentDate].asUInt());
+
+ const auto past_period_in_days =
+ date_time::calculateAmountDaysFromDate(consent_date);
+
+ LOG4CXX_DEBUG(
+ logger_,
+ "Keeping time of consent is: " << past_period_in_days << " days");
+ LOG4CXX_DEBUG(logger_, "Period for expired: " << period_for_expiring);
+
+ return (past_period_in_days >= period_for_expiring)
+ ? rc_rpc_types::ModuleConsentState::EXPIRED
+ : rc_rpc_types::ModuleConsentState::ACTIVE;
+}
+
+void RCConsentManagerImpl::RemoveDeviceExpiredConsents(Json::Value& device) {
+ sync_primitives::AutoLock autolock(applications_lock_);
+
+ if (device.isMember(message_params::kApplications)) {
+ auto& applications = device[message_params::kApplications];
+
+ for (auto& app : applications) {
+ if (app.isMember(message_params::kAppConsentList)) {
+ RemoveAppExpiredConsents(app[message_params::kAppConsentList]);
+ }
+ }
+ }
+}
+
+void RCConsentManagerImpl::RemoveAppExpiredConsents(Json::Value& app_consents) {
+ for (auto& module : app_consents) {
+ if (module.isMember(message_params::kModuleConsents)) {
+ auto& module_consents = module[message_params::kModuleConsents];
+ RemoveModuleExpiredConsents(module_consents);
+ }
+ }
+}
+
+void RCConsentManagerImpl::RemoveModuleExpiredConsents(
+ Json::Value& module_consents) {
+ sync_primitives::AutoLock autolock(module_consents_lock_);
+ Json::Value temp_consents;
+
+ for (auto& consent : module_consents) {
+ const bool is_module_id_exists =
+ consent.isMember(message_params::kModuleId);
+
+ const bool is_expired = rc_rpc_types::ModuleConsentState::EXPIRED ==
+ CheckModuleConsentState(consent);
+ if (is_expired) {
+ LOG4CXX_DEBUG(logger_,
+ "Consent for module resource ["
+ << consent[message_params::kModuleId].asString()
+ << "] is expired and will be removed");
+ }
+
+ if (is_module_id_exists && !is_expired) {
+ LOG4CXX_DEBUG(logger_,
+ "Consent for module resource ["
+ << consent[message_params::kModuleId].asString()
+ << "] is actual.");
+ temp_consents.append(consent);
+ }
+ }
+
+ module_consents.clear();
+ if (!temp_consents.empty()) {
+ std::swap(module_consents, temp_consents);
+ }
+}
+
+Json::Value& RCConsentManagerImpl::GetRemoteControlDataOrAppend(
+ Json::Value& last_state_data) {
+ sync_primitives::AutoLock autolock(dictionary_control_lock_);
+ if (!last_state_data.isMember(app_mngr::strings::remote_control)) {
+ last_state_data[app_mngr::strings::remote_control] =
+ Json::Value(Json::objectValue);
+ LOG4CXX_DEBUG(logger_, "remote_control section is missed");
+ }
+
+ Json::Value& remote_control =
+ last_state_data[app_mngr::strings::remote_control];
+
+ if (!remote_control.isObject()) {
+ LOG4CXX_ERROR(logger_, "remote_control type INVALID rewrite");
+ remote_control = Json::Value(Json::objectValue);
+ }
+ return remote_control;
+}
+
+Json::Value& RCConsentManagerImpl::GetDeviceApplicationsOrAppend(
+ const std::string& mac_address, Json::Value& last_state_data) {
+ sync_primitives::AutoLock autolock(device_applications_lock_);
+
+ auto& apps_consents = GetAppsConsentsOrAppend(last_state_data);
+
+ if (!apps_consents.isArray()) {
+ LOG4CXX_DEBUG(logger_, "applications_consents type INVALID rewrite");
+ apps_consents = Json::Value(Json::arrayValue);
+ }
+
+ for (auto& device_applications_item : apps_consents) {
+ const bool is_device_section_exists =
+ device_applications_item.isMember(message_params::kMacAddress);
+
+ if (is_device_section_exists) {
+ auto saved_mac_adress =
+ device_applications_item[message_params::kMacAddress].asString();
+
+ if (saved_mac_adress == mac_address) {
+ return device_applications_item[message_params::kApplications];
+ }
+ }
+ }
+
+ auto device_applications = Json::Value(Json::objectValue);
+ device_applications[message_params::kMacAddress] = Json::Value(mac_address);
+ device_applications[message_params::kApplications] =
+ Json::Value(Json::arrayValue);
+
+ apps_consents.append(device_applications);
+ return apps_consents[apps_consents.size() - 1][message_params::kApplications];
+}
+
+Json::Value& RCConsentManagerImpl::GetAppConsentsListOrAppend(
+ const std::string& policy_app_id,
+ const std::string& mac_address,
+ Json::Value& last_state_data) {
+ auto& device_applications =
+ GetDeviceApplicationsOrAppend(mac_address, last_state_data);
+
+ sync_primitives::AutoLock autolock(applications_lock_);
+ if (!device_applications.isArray()) {
+ LOG4CXX_DEBUG(logger_, "applications_consents type INVALID rewrite");
+ device_applications = Json::Value(Json::arrayValue);
+ }
+
+ for (auto& application : device_applications) {
+ const bool is_app_id_section_exists =
+ application.isMember(message_params::kAppId);
+
+ if (is_app_id_section_exists) {
+ auto saved_app_id = application[message_params::kAppId].asString();
+
+ if (saved_app_id == policy_app_id) {
+ return application[message_params::kAppConsentList];
+ }
+ }
+ }
+
+ // In case when specified application section is absent in json file,
+ // will be created new section and added to dictionary.
+ auto application = Json::Value(Json::objectValue);
+ application[message_params::kAppId] = Json::Value(policy_app_id);
+ application[message_params::kAppConsentList] = Json::Value(Json::arrayValue);
+ device_applications.append(application);
+
+ // Returns last appended object
+ return device_applications[device_applications.size() - 1]
+ [message_params::kAppConsentList];
+}
+
+Json::Value& RCConsentManagerImpl::GetAppsConsentsOrAppend(
+ Json::Value& last_state_data) {
+ Json::Value& remote_control = GetRemoteControlDataOrAppend(last_state_data);
+ sync_primitives::AutoLock autolock(remote_control_lock_);
+
+ if (!remote_control.isMember(message_params::kAppConsents)) {
+ LOG4CXX_DEBUG(logger_, "app_consents section is missed");
+ remote_control[message_params::kAppConsents] =
+ Json::Value(Json::arrayValue);
+ }
+
+ auto& app_consents = remote_control[message_params::kAppConsents];
+ if (!app_consents.isArray()) {
+ LOG4CXX_DEBUG(logger_, "applications_consents type INVALID rewrite");
+ app_consents = Json::Value(Json::arrayValue);
+ }
+ return app_consents;
+}
+
+Json::Value& RCConsentManagerImpl::GetModuleTypeConsentsOrAppend(
+ const std::string& policy_app_id,
+ const std::string& mac_address,
+ const std::string& module_type,
+ Json::Value& last_state_data) {
+ auto& app_consents_list =
+ GetAppConsentsListOrAppend(policy_app_id, mac_address, last_state_data);
+
+ sync_primitives::AutoLock autolock(app_consents_lock_);
+ for (auto& module_consents : app_consents_list) {
+ const bool module_exists =
+ module_consents.isMember(message_params::kModuleType);
+
+ if (module_exists &&
+ (module_consents[message_params::kModuleType].asString() ==
+ module_type)) {
+ return module_consents[message_params::kModuleConsents];
+ }
+ }
+
+ // In case of absent specified module_type in section of specified
+ // application, will be added empty section with this module type.
+ LOG4CXX_DEBUG(
+ logger_,
+ "Section module_type: " << module_type
+ << " is missed for app_id:" << policy_app_id);
+ auto consent_item = Json::Value(Json::objectValue);
+ consent_item[message_params::kModuleType] = module_type;
+ consent_item[message_params::kModuleConsents] = Json::Value(Json::arrayValue);
+
+ app_consents_list.append(consent_item);
+
+ // Returns last (appended) object
+ return app_consents_list[app_consents_list.size() - 1]
+ [message_params::kModuleConsents];
+}
+
+RCConsentManagerImpl::~RCConsentManagerImpl() {}
+
+void RCConsentManagerImpl::SaveAppModuleConsent(
+ Json::Value& app_module_consents,
+ const rc_rpc_types::ModuleIdConsent& consent_to_save) {
+ bool is_found = false;
+
+ sync_primitives::AutoLock autolock(app_consents_lock_);
+ for (auto& consent : app_module_consents) {
+ const bool is_module_id_exists =
+ consent.isMember(message_params::kModuleId);
+
+ // In case existing consent of specified ModuelResource (module_type +
+ // module_id), old value will be rewritten by new value.
+
+ if (is_module_id_exists && (consent[message_params::kModuleId].asString() ==
+ consent_to_save.module_id.second)) {
+ is_found = true;
+ consent[message_params::kConsent] =
+ Json::Value(static_cast<uint32_t>(consent_to_save.consent));
+ consent[message_params::kConsentDate] = Json::Value(
+ static_cast<Json::UInt64>(consent_to_save.date_of_consent));
+ }
+ }
+
+ // Otherwise, new item will be added to the "consents" collection
+
+ if (!is_found) {
+ auto new_consent = Json::Value(Json::objectValue);
+ new_consent[message_params::kModuleId] =
+ Json::Value(consent_to_save.module_id.second);
+ new_consent[message_params::kConsent] =
+ Json::Value(static_cast<uint32_t>(consent_to_save.consent));
+ new_consent[message_params::kConsentDate] =
+ Json::Value(static_cast<Json::UInt64>(consent_to_save.date_of_consent));
+
+ app_module_consents.append(new_consent);
+ }
+}
+
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
new file mode 100644
index 0000000000..f344dd15a7
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
@@ -0,0 +1,365 @@
+#include "rc_rpc_plugin/rc_helpers.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/message.h"
+#include "application_manager/smart_object_keys.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
+
+namespace rc_rpc_plugin {
+CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule");
+
+const std::vector<std::string> RCHelpers::buttons_climate() {
+ std::vector<std::string> data;
+ data.push_back(enums_value::kACMax);
+ data.push_back(enums_value::kAC);
+ data.push_back(enums_value::kRecirculate);
+ data.push_back(enums_value::kFanUp);
+ data.push_back(enums_value::kFanDown);
+ data.push_back(enums_value::kTempUp);
+ data.push_back(enums_value::kTempDown);
+ data.push_back(enums_value::kDefrostMax);
+ data.push_back(enums_value::kDefrost);
+ data.push_back(enums_value::kDefrostRear);
+ data.push_back(enums_value::kUpperVent);
+ data.push_back(enums_value::kLowerVent);
+ return data;
+}
+
+const std::vector<std::string> RCHelpers::buttons_radio() {
+ std::vector<std::string> data;
+ data.push_back(enums_value::kVolumeUp);
+ data.push_back(enums_value::kVolumeDown);
+ data.push_back(enums_value::kEject);
+ data.push_back(enums_value::kSource);
+ data.push_back(enums_value::kShuffle);
+ data.push_back(enums_value::kRepeat);
+ return data;
+}
+
+const RCHelpers::ButtonsMap RCHelpers::buttons_map() {
+ using namespace mobile_apis;
+
+ ButtonsMap buttons_map;
+ buttons_map[enums_value::kACMax] = ButtonName::AC_MAX;
+ buttons_map[enums_value::kAC] = ButtonName::AC;
+ buttons_map[enums_value::kRecirculate] = ButtonName::RECIRCULATE;
+ buttons_map[enums_value::kFanUp] = ButtonName::FAN_UP;
+ buttons_map[enums_value::kFanDown] = ButtonName::FAN_DOWN;
+ buttons_map[enums_value::kTempUp] = ButtonName::TEMP_UP;
+ buttons_map[enums_value::kTempDown] = ButtonName::TEMP_DOWN;
+ buttons_map[enums_value::kDefrostMax] = ButtonName::DEFROST_MAX;
+ buttons_map[enums_value::kDefrost] = ButtonName::DEFROST;
+ buttons_map[enums_value::kDefrostRear] = ButtonName::DEFROST_REAR;
+ buttons_map[enums_value::kUpperVent] = ButtonName::UPPER_VENT;
+ buttons_map[enums_value::kLowerVent] = ButtonName::LOWER_VENT;
+ buttons_map[enums_value::kVolumeUp] = ButtonName::VOLUME_UP;
+ buttons_map[enums_value::kVolumeDown] = ButtonName::VOLUME_DOWN;
+ buttons_map[enums_value::kEject] = ButtonName::EJECT;
+ buttons_map[enums_value::kSource] = ButtonName::SOURCE;
+ buttons_map[enums_value::kShuffle] = ButtonName::SHUFFLE;
+ buttons_map[enums_value::kRepeat] = ButtonName::REPEAT;
+
+ return buttons_map;
+}
+
+std::vector<std::string> RCHelpers::GetModuleReadOnlyParams(
+ const std::string& module_type) {
+ using namespace message_params;
+ std::vector<std::string> module_ro_params;
+ if (enums_value::kClimate == module_type) {
+ module_ro_params.push_back(kCurrentTemperature);
+ } else if (enums_value::kRadio == module_type) {
+ module_ro_params.push_back(kRdsData);
+ module_ro_params.push_back(kAvailableHDs);
+ module_ro_params.push_back(kAvailableHdChannels);
+ module_ro_params.push_back(kSignalStrength);
+ module_ro_params.push_back(kSignalChangeThreshold);
+ module_ro_params.push_back(kState);
+ module_ro_params.push_back(kSisData);
+ } else if (enums_value::kLight == module_type) {
+ module_ro_params.push_back(kLightStatus);
+ }
+
+ return module_ro_params;
+}
+
+rc_rpc_types::ModuleIdConsentVector RCHelpers::FillModuleConsents(
+ const std::string& module_type,
+ const std::vector<std::string>& module_ids,
+ const std::vector<bool> allowed) {
+ using namespace rc_rpc_types;
+ if (module_ids.size() != allowed.size()) {
+ return rc_rpc_types::ModuleIdConsentVector();
+ }
+
+ rc_rpc_types::ModuleIdConsentVector module_consents;
+ std::time_t current_date = std::time(0);
+ size_t array_size = module_ids.size();
+
+ for (size_t i = 0; i < array_size; ++i) {
+ rc_rpc_types::ModuleIdConsent module_consent;
+ module_consent.module_id = {module_type, module_ids[i]};
+ module_consent.consent =
+ allowed[i] ? ModuleConsent::CONSENTED : ModuleConsent::NOT_CONSENTED;
+ module_consent.date_of_consent = current_date;
+
+ module_consents.push_back(module_consent);
+ }
+ return module_consents;
+}
+
+std::vector<std::string> RCHelpers::RetrieveModuleIds(
+ const ns_smart_device_link::ns_smart_objects::SmartObject& moduleIds) {
+ std::vector<std::string> module_ids;
+ for (const auto& module_id : (*moduleIds.asArray())) {
+ module_ids.push_back(module_id.asString());
+ }
+ return module_ids;
+}
+
+std::vector<bool> RCHelpers::RetrieveModuleConsents(
+ const ns_smart_device_link::ns_smart_objects::SmartObject& consents) {
+ std::vector<bool> module_consents;
+ for (const auto& allowed_item : (*consents.asArray())) {
+ module_consents.push_back(allowed_item.asBool());
+ }
+ return module_consents;
+}
+
+const std::function<std::string(const std::string& module_type)>
+RCHelpers::GetModuleTypeToDataMapping() {
+ auto mapping_lambda = [](const std::string& module_type) -> std::string {
+ static std::map<std::string, std::string> mapping = {
+ {enums_value::kClimate, message_params::kClimateControlData},
+ {enums_value::kRadio, message_params::kRadioControlData},
+ {enums_value::kSeat, message_params::kSeatControlData},
+ {enums_value::kAudio, message_params::kAudioControlData},
+ {enums_value::kLight, message_params::kLightControlData},
+ {enums_value::kHmiSettings, message_params::kHmiSettingsControlData}};
+ auto it = mapping.find(module_type);
+ if (mapping.end() == it) {
+ LOG4CXX_ERROR(logger_, "Unknown module type" << module_type);
+ return std::string();
+ }
+ return it->second;
+ };
+
+ return mapping_lambda;
+}
+
+const std::function<std::string(const std::string& module_type)>
+RCHelpers::GetModuleTypeToCapabilitiesMapping() {
+ auto mapping_lambda = [](const std::string& module_type) -> std::string {
+ static std::map<std::string, std::string> mapping = {
+ {enums_value::kClimate, strings::kclimateControlCapabilities},
+ {enums_value::kRadio, strings::kradioControlCapabilities},
+ {enums_value::kSeat, strings::kseatControlCapabilities},
+ {enums_value::kAudio, strings::kaudioControlCapabilities},
+ {enums_value::kLight, strings::klightControlCapabilities},
+ {enums_value::kHmiSettings, strings::khmiSettingsControlCapabilities}};
+ auto it = mapping.find(module_type);
+ if (mapping.end() == it) {
+ LOG4CXX_ERROR(logger_, "Unknown module type" << module_type);
+ return std::string();
+ }
+ return it->second;
+ };
+
+ return mapping_lambda;
+}
+
+const std::vector<std::string> RCHelpers::GetModuleTypesList() {
+ using namespace enums_value;
+ return {kClimate, kRadio, kSeat, kAudio, kLight, kHmiSettings};
+}
+
+RCAppExtensionPtr RCHelpers::GetRCExtension(
+ application_manager::Application& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto extension_interface = app.QueryInterface(RCRPCPlugin::kRCPluginID);
+ auto extension =
+ std::static_pointer_cast<RCAppExtension>(extension_interface);
+ return extension;
+}
+
+smart_objects::SmartObjectSPtr RCHelpers::CreateUnsubscribeRequestToHMI(
+ const ModuleUid& module, const uint32_t correlation_id) {
+ using namespace smart_objects;
+ namespace commands = application_manager::commands;
+ namespace am_strings = application_manager::strings;
+
+ SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map);
+ SmartObject& params = (*message)[am_strings::params];
+ SmartObject& msg_params = (*message)[am_strings::msg_params];
+
+ params[am_strings::message_type] =
+ static_cast<int>(application_manager::kRequest);
+ params[am_strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ params[am_strings::protocol_type] = commands::CommandImpl::hmi_protocol_type_;
+ params[am_strings::correlation_id] = correlation_id;
+ params[am_strings::function_id] =
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData;
+ msg_params[message_params::kSubscribe] = false;
+ msg_params[message_params::kModuleType] = module.first;
+ msg_params[message_params::kModuleId] = module.second;
+ return message;
+}
+
+std::vector<application_manager::ApplicationSharedPtr>
+RCHelpers::AppsSubscribedToModule(
+ application_manager::ApplicationManager& app_mngr,
+ const ModuleUid& module) {
+ std::vector<application_manager::ApplicationSharedPtr> result;
+ auto rc_apps = RCRPCPlugin::GetRCApplications(app_mngr);
+ for (auto& app : rc_apps) {
+ auto rc_ext = RCHelpers::GetRCExtension(*app);
+ DCHECK_OR_RETURN(rc_ext, result);
+ if (rc_ext->IsSubscribedToInteriorVehicleData(module)) {
+ result.push_back(app);
+ }
+ }
+ return result;
+}
+
+std::vector<application_manager::ApplicationSharedPtr>
+RCHelpers::AppsSubscribedToModuleType(
+ application_manager::ApplicationManager& app_mngr,
+ const std::string& module_type) {
+ std::vector<application_manager::ApplicationSharedPtr> result;
+ auto rc_apps = RCRPCPlugin::GetRCApplications(app_mngr);
+ for (auto& app : rc_apps) {
+ auto rc_ext = RCHelpers::GetRCExtension(*app);
+ DCHECK_OR_RETURN(rc_ext, result);
+ if (rc_ext->IsSubscribedToInteriorVehicleDataOfType(module_type)) {
+ result.push_back(app);
+ }
+ }
+ return result;
+}
+
+RCHelpers::AppsModuleTypes RCHelpers::GetApplicationsAllowedModuleTypes(
+ app_mngr::ApplicationManager& app_mngr) {
+ auto apps_list = RCRPCPlugin::GetRCApplications(app_mngr);
+ RCHelpers::AppsModuleTypes result;
+ for (auto& app_ptr : apps_list) {
+ std::vector<std::string> allowed_modules;
+ app_mngr.GetPolicyHandler().GetModuleTypes(app_ptr->policy_app_id(),
+ &allowed_modules);
+ std::sort(allowed_modules.begin(), allowed_modules.end());
+ result[app_ptr] = allowed_modules;
+ }
+ return result;
+}
+
+void RCHelpers::RemoveRedundantGPSDataFromIVDataMsg(
+ smart_objects::SmartObject& msg_params) {
+ using namespace message_params;
+ using namespace application_manager::strings;
+
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!msg_params.keyExists(kModuleData)) {
+ return;
+ }
+ auto& module_data = msg_params[kModuleData];
+ if (!module_data.keyExists(kRadioControlData) ||
+ !module_data[kRadioControlData].keyExists(kSisData) ||
+ !module_data[kRadioControlData][kSisData].keyExists(station_location)) {
+ return;
+ }
+
+ auto& location_data =
+ module_data[kRadioControlData][kSisData][station_location];
+ auto new_location_data =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ new_location_data[latitude_degrees] = location_data[latitude_degrees];
+ new_location_data[longitude_degrees] = location_data[longitude_degrees];
+ if (location_data.keyExists(altitude)) {
+ new_location_data[altitude] = location_data[altitude];
+
+ location_data = new_location_data;
+ }
+}
+
+smart_objects::SmartObject RCHelpers::MergeModuleData(
+ const smart_objects::SmartObject& data1,
+ const smart_objects::SmartObject& data2) {
+ if (data1.getType() != smart_objects::SmartType::SmartType_Map ||
+ data2.getType() != smart_objects::SmartType::SmartType_Map) {
+ return data2;
+ }
+
+ smart_objects::SmartObject result = data1;
+
+ for (auto it = data2.map_begin(); it != data2.map_end(); ++it) {
+ const std::string& key = it->first;
+ smart_objects::SmartObject& value = it->second;
+ if (!result.keyExists(key) || value.getType() != result[key].getType()) {
+ result[key] = value;
+ continue;
+ }
+
+ // Merge maps and arrays with `id` param included, replace other types
+ if (value.getType() == smart_objects::SmartType::SmartType_Map) {
+ value = MergeModuleData(result[key], value);
+ } else if (value.getType() == smart_objects::SmartType::SmartType_Array) {
+ value = MergeArray(result[key], value);
+ }
+ result[key] = value;
+ }
+ return result;
+}
+
+smart_objects::SmartObject RCHelpers::MergeArray(
+ const smart_objects::SmartObject& data1,
+ const smart_objects::SmartObject& data2) {
+ // Merge data only in the case where each value in the array is an Object with
+ // an ID included, otherwise replace
+
+ if (data1.getType() != smart_objects::SmartType::SmartType_Array ||
+ data2.getType() != smart_objects::SmartType::SmartType_Array ||
+ data2.empty()) {
+ return data2;
+ }
+
+ auto& data2_array = *data2.asArray();
+ for (const auto& data_item : data2_array) {
+ if (data_item.getType() != smart_objects::SmartType_Map ||
+ !data_item.keyExists(application_manager::strings::id)) {
+ return data2;
+ }
+ }
+
+ smart_objects::SmartObject result = data1;
+ smart_objects::SmartArray* result_array = result.asArray();
+
+ auto find_by_id = [](smart_objects::SmartArray* array,
+ const smart_objects::SmartObject& id)
+ -> smart_objects::SmartArray::iterator {
+ return std::find_if(array->begin(),
+ array->end(),
+ [&id](const smart_objects::SmartObject& obj) -> bool {
+ return id == obj[application_manager::strings::id];
+ });
+ };
+
+ auto merge = [&result_array,
+ &find_by_id](const smart_objects::SmartObject& data) -> void {
+ auto element_id = data[application_manager::strings::id];
+ auto result_it = find_by_id(result_array, element_id);
+
+ if (result_array->end() != result_it) {
+ *result_it = RCHelpers::MergeModuleData(*result_it, data);
+ } else {
+ result_array->push_back(data);
+ }
+ };
+
+ for (const auto& data : data2_array) {
+ merge(data);
+ }
+
+ return result;
+}
+
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
index 36377c620b..c2aa639fda 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
@@ -29,32 +29,68 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
-
#include "rc_rpc_plugin/rc_rpc_plugin.h"
-#include "rc_rpc_plugin/rc_command_factory.h"
+#include <memory>
+#include "application_manager/plugin_manager/plugin_keys.h"
+#include "rc_rpc_plugin/interior_data_cache_impl.h"
+#include "rc_rpc_plugin/interior_data_manager_impl.h"
#include "rc_rpc_plugin/rc_app_extension.h"
+#include "rc_rpc_plugin/rc_capabilities_manager_impl.h"
+#include "rc_rpc_plugin/rc_command_factory.h"
+#include "rc_rpc_plugin/rc_consent_manager_impl.h"
+#include "rc_rpc_plugin/rc_helpers.h"
#include "rc_rpc_plugin/resource_allocation_manager_impl.h"
#include "utils/helpers.h"
namespace rc_rpc_plugin {
+CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule");
+
namespace plugins = application_manager::plugin_manager;
bool RCRPCPlugin::Init(
application_manager::ApplicationManager& app_manager,
application_manager::rpc_service::RPCService& rpc_service,
application_manager::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler) {
- resource_allocation_manager_.reset(
- new ResourceAllocationManagerImpl(app_manager, rpc_service));
- command_factory_.reset(
- new rc_rpc_plugin::RCCommandFactory(app_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler,
- *resource_allocation_manager_));
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) {
+ rc_consent_manager_.reset(new rc_rpc_plugin::RCConsentManagerImpl(
+ last_state,
+ app_manager,
+ app_manager.get_settings().period_for_consent_expiration()));
+ interior_data_cache_.reset(new InteriorDataCacheImpl());
+ interior_data_manager_.reset(new InteriorDataManagerImpl(
+ *this, *interior_data_cache_, app_manager, rpc_service));
+ rc_capabilities_manager_.reset(
+ new RCCapabilitiesManagerImpl(hmi_capabilities));
+ resource_allocation_manager_.reset(new ResourceAllocationManagerImpl(
+ app_manager, rpc_service, *(rc_capabilities_manager_.get())));
+ RCCommandParams params{app_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler,
+ *(resource_allocation_manager_.get()),
+ *(interior_data_cache_.get()),
+ *(interior_data_manager_.get()),
+ *(rc_capabilities_manager_.get()),
+ *(rc_consent_manager_.get())};
+ command_factory_.reset(new rc_rpc_plugin::RCCommandFactory(params));
+ rpc_service_ = &rpc_service;
+ app_mngr_ = &app_manager;
+
+ // Check all saved consents and remove expired
+ rc_consent_manager_->RemoveExpiredConsents();
+
return true;
}
+bool RCRPCPlugin::Init(application_manager::ApplicationManager&,
+ application_manager::rpc_service::RPCService&,
+ application_manager::HMICapabilities&,
+ policy::PolicyHandlerInterface&,
+ resumption::LastState&) {
+ return false;
+}
+
bool RCRPCPlugin::IsAbleToProcess(
const int32_t function_id,
const application_manager::commands::Command::CommandSource
@@ -63,7 +99,7 @@ bool RCRPCPlugin::IsAbleToProcess(
}
std::string RCRPCPlugin::PluginName() {
- return "RC RPC Plugin";
+ return plugins::plugin_names::rc_rpc_plugin;
}
application_manager::CommandFactory& RCRPCPlugin::GetCommandFactory() {
@@ -72,33 +108,51 @@ application_manager::CommandFactory& RCRPCPlugin::GetCommandFactory() {
void RCRPCPlugin::OnPolicyEvent(
application_manager::plugin_manager::PolicyEvent event) {
- switch (event) {
- case plugins::kApplicationPolicyUpdated: {
- resource_allocation_manager_->OnPolicyEvent(event);
- break;
- }
- default:
- break;
- }
+ resource_allocation_manager_->OnPolicyEvent(event);
+ interior_data_manager_->OnPolicyEvent(event);
}
void RCRPCPlugin::OnApplicationEvent(
application_manager::plugin_manager::ApplicationEvent event,
application_manager::ApplicationSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!application->is_remote_control_supported()) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Remote control is not supported for application with app_id: "
+ << application->app_id());
return;
}
switch (event) {
case plugins::kApplicationRegistered: {
- application->AddExtension(new RCAppExtension(kRCPluginID));
+ auto extension =
+ std::shared_ptr<RCAppExtension>(new RCAppExtension(kRCPluginID));
+ application->AddExtension(extension);
+ const auto driver_location =
+ rc_capabilities_manager_
+ ->GetDriverLocationFromSeatLocationCapability();
+ extension->SetUserLocation(driver_location);
break;
}
case plugins::kApplicationExit: {
resource_allocation_manager_->OnApplicationEvent(event, application);
+ interior_data_manager_->OnApplicationEvent(event, application);
break;
}
case plugins::kApplicationUnregistered: {
resource_allocation_manager_->OnApplicationEvent(event, application);
+ interior_data_manager_->OnApplicationEvent(event, application);
+ break;
+ }
+ case plugins::kGlobalPropertiesUpdated: {
+ const auto user_location = application->get_user_location();
+ auto extension = RCHelpers::GetRCExtension(*application);
+ extension->SetUserLocation(user_location);
+ break;
+ }
+ case plugins::kRCStatusChanged: {
+ resource_allocation_manager_->SendOnRCStatusNotifications(
+ NotificationTrigger::APP_REGISTRATION, application);
break;
}
default:
@@ -108,8 +162,8 @@ void RCRPCPlugin::OnApplicationEvent(
RCRPCPlugin::Apps RCRPCPlugin::GetRCApplications(
application_manager::ApplicationManager& app_mngr) {
- using application_manager::ApplicationSharedPtr;
using application_manager::ApplicationSet;
+ using application_manager::ApplicationSharedPtr;
ApplicationSet accessor = app_mngr.applications().GetData();
std::vector<ApplicationSharedPtr> result;
@@ -123,6 +177,14 @@ RCRPCPlugin::Apps RCRPCPlugin::GetRCApplications(
} // namespace rc_rpc_plugin
-extern "C" application_manager::plugin_manager::RPCPlugin* Create() {
+extern "C" __attribute__((visibility("default")))
+application_manager::plugin_manager::RPCPlugin*
+Create() {
return new rc_rpc_plugin::RCRPCPlugin();
+} // namespace rc_rpc_plugin
+
+extern "C" __attribute__((visibility("default"))) void Delete(
+ application_manager::plugin_manager::RPCPlugin* data) {
+ delete data;
+ DELETE_THREAD_LOGGER(rc_rpc_plugin::logger_);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
index c2962863e3..049f9a3cf3 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
@@ -33,15 +33,15 @@
#include "rc_rpc_plugin/resource_allocation_manager_impl.h"
#include "application_manager/application.h"
#include "application_manager/application_manager.h"
+#include "application_manager/message_helper.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
-#include "smart_objects/enum_schema_item.h"
-#include "rc_rpc_plugin/rc_rpc_plugin.h"
-#include "application_manager/message_helper.h"
-#include "rc_rpc_plugin/rc_module_constants.h"
#include "json/json.h"
+#include "rc_rpc_plugin/rc_helpers.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
+#include "smart_objects/enum_schema_item.h"
#include "utils/helpers.h"
-#include "utils/make_shared.h"
namespace rc_rpc_plugin {
@@ -49,15 +49,20 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "RemoteControlModule")
ResourceAllocationManagerImpl::ResourceAllocationManagerImpl(
application_manager::ApplicationManager& app_mngr,
- application_manager::rpc_service::RPCService& rpc_service)
+ application_manager::rpc_service::RPCService& rpc_service,
+ RCCapabilitiesManager& rc_capabilities_manager)
: current_access_mode_(hmi_apis::Common_RCAccessMode::AUTO_ALLOW)
, app_mngr_(app_mngr)
- , rpc_service_(rpc_service) {}
+ , rpc_service_(rpc_service)
+ , rc_capabilities_manager_(rc_capabilities_manager)
+ , is_rc_enabled_(true) {}
ResourceAllocationManagerImpl::~ResourceAllocationManagerImpl() {}
AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
- const std::string& module_type, const uint32_t app_id) {
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
const application_manager::ApplicationSharedPtr acquiring_app =
app_mngr_.application(app_id);
@@ -66,40 +71,57 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
return AcquireResult::IN_USE;
}
+ ModuleUid module(module_type, module_id);
+
+ if (rc_capabilities_manager_.IsSeatLocationCapabilityProvided() &&
+ !IsUserLocationValid(module, acquiring_app)) {
+ LOG4CXX_WARN(logger_,
+ "Resource acquisition is not allowed "
+ "according to location verification.");
+ return AcquireResult::REJECTED;
+ }
+
sync_primitives::AutoLock lock(allocated_resources_lock_);
const AllocatedResources::const_iterator allocated_it =
- allocated_resources_.find(module_type);
+ allocated_resources_.find(module);
if (allocated_resources_.end() == allocated_it) {
- SetResourceAquired(module_type, app_id);
LOG4CXX_DEBUG(logger_,
"Resource is not acquired yet. "
<< "App: " << app_id << " is allowed to acquire "
- << module_type);
+ << module_type << " " << module_id);
return AcquireResult::ALLOWED;
}
- if (app_id == allocated_resources_[module_type]) {
+ if (app_id == allocated_resources_[module]) {
LOG4CXX_DEBUG(logger_,
"App: " << app_id << " is already acquired resource "
- << module_type);
+ << module_type << " " << module_id);
return AcquireResult::ALLOWED;
}
- if (IsModuleTypeRejected(module_type, app_id)) {
+ if (IsModuleTypeRejected(module_type, module_id, app_id)) {
LOG4CXX_DEBUG(logger_,
"Driver disallowed app: " << app_id << " to acquire "
- << module_type);
+ << module_type << " " << module_id);
return AcquireResult::REJECTED;
}
const mobile_apis::HMILevel::eType acquiring_app_hmi_level =
- acquiring_app->hmi_level();
+ acquiring_app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if (mobile_apis::HMILevel::HMI_FULL != acquiring_app_hmi_level) {
LOG4CXX_DEBUG(logger_,
"Aquiring resources is not allowed in HMI level: "
<< acquiring_app_hmi_level << ". App: " << app_id
- << " is disallowed to acquire " << module_type);
+ << " is disallowed to acquire " << module_type << " "
+ << module_id);
+ return AcquireResult::REJECTED;
+ }
+
+ if (!rc_capabilities_manager_.IsMultipleAccessAllowed(module)) {
+ LOG4CXX_DEBUG(logger_,
+ "Multiple access for the: " << module_type << " " << module_id
+ << " isn't allowed");
return AcquireResult::REJECTED;
}
@@ -108,34 +130,58 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
LOG4CXX_DEBUG(logger_,
"Current access_mode is AUTO_DENY. "
<< "App: " << app_id << " is disallowed to acquire "
- << module_type);
+ << module_type << " " << module_id);
return AcquireResult::IN_USE;
}
case hmi_apis::Common_RCAccessMode::ASK_DRIVER: {
LOG4CXX_DEBUG(logger_,
"Current access_mode is ASK_DRIVER. "
"Driver confirmation is required for app: "
- << app_id << " to acquire " << module_type);
+ << app_id << " to acquire " << module_type << " "
+ << module_id);
return AcquireResult::ASK_DRIVER;
}
case hmi_apis::Common_RCAccessMode::AUTO_ALLOW: {
LOG4CXX_DEBUG(logger_,
"Current access_mode is AUTO_ALLOW. "
<< "App: " << app_id << " is allowed to acquire "
- << module_type);
-
- SetResourceAquired(module_type, app_id);
+ << module_type << " " << module_id);
return AcquireResult::ALLOWED;
}
default: { DCHECK_OR_RETURN(false, AcquireResult::IN_USE); }
}
}
-void ResourceAllocationManagerImpl::ReleaseResource(
+bool ResourceAllocationManagerImpl::IsUserLocationValid(
+ ModuleUid& module, application_manager::ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto extension = RCHelpers::GetRCExtension(*app);
+ DCHECK_OR_RETURN(extension, false);
+ const auto user_location = extension->GetUserLocation();
+ const auto module_service_area =
+ rc_capabilities_manager_.GetModuleServiceArea(module);
+ const auto driver =
+ rc_capabilities_manager_.GetDriverLocationFromSeatLocationCapability();
+ const bool is_driver = user_location == driver;
+ if (is_driver || user_location.IntersectionExists(module_service_area)) {
+ return true;
+ }
+ LOG4CXX_DEBUG(logger_, "User location is not valid");
+ return false;
+}
+
+void ResourceAllocationManagerImpl::ReleaseModuleType(
const std::string& module_type, const uint32_t application_id) {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Release " << module_type << " by " << application_id);
- SetResourceFree(module_type, application_id);
+ LOG4CXX_DEBUG(logger_,
+ "Release " << module_type << " "
+ << " by " << application_id);
+ Resources allocated_resources = GetAcquiredResources(application_id);
+ for (const auto& resource : allocated_resources) {
+ if (module_type == resource.first) {
+ SetResourceFree(module_type, resource.second, application_id);
+ }
+ }
}
void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() {
@@ -146,10 +192,10 @@ void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() {
for (; app_list.end() != app; ++app) {
application_manager::ApplicationSharedPtr app_ptr = *app;
const uint32_t application_id = app_ptr->app_id();
- Resources acquired_modules = GetAcquiredResources(application_id);
- std::sort(acquired_modules.begin(), acquired_modules.end());
+ std::set<std::string> acquired_modules =
+ GetAcquiredModuleTypes(application_id);
- Resources allowed_modules;
+ std::vector<std::string> allowed_modules;
app_mngr_.GetPolicyHandler().GetModuleTypes((*app)->policy_app_id(),
&allowed_modules);
std::sort(allowed_modules.begin(), allowed_modules.end());
@@ -159,85 +205,223 @@ void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() {
<< " , allowed modules: "
<< allowed_modules.size());
- Resources disallowed_modules;
+ std::vector<std::string> disallowed_modules;
std::set_difference(acquired_modules.begin(),
acquired_modules.end(),
allowed_modules.begin(),
allowed_modules.end(),
std::back_inserter(disallowed_modules));
- RCAppExtensionPtr rc_extention = GetApplicationExtention(app_ptr);
- Resources::const_iterator module = disallowed_modules.begin();
+ auto module = disallowed_modules.begin();
for (; disallowed_modules.end() != module; ++module) {
- ReleaseResource(*module, application_id);
- if (rc_extention) {
- rc_extention->UnsubscribeFromInteriorVehicleData(*module);
- }
+ ReleaseModuleType(*module, application_id);
+ }
+ if (!disallowed_modules.empty()) {
+ SendOnRCStatusNotifications(
+ NotificationTrigger::MODULE_ALLOCATION,
+ std::shared_ptr<application_manager::Application>());
}
}
}
-RCAppExtensionPtr ResourceAllocationManagerImpl::GetApplicationExtention(
- application_manager::ApplicationSharedPtr application) {
+template <typename EnumType>
+EnumType StringToEnum(const std::string& str) {
+ using smart_objects::EnumConversionHelper;
+ EnumType val;
+ EnumConversionHelper<EnumType>::StringToEnum(str, &val);
+ return val;
+}
+
+void ConstructOnRCStatusNotificationParams(
+ smart_objects::SmartObject& msg_params,
+ const std::map<ModuleUid, uint32_t>& allocated_resources,
+ const std::vector<ModuleUid>& supported_resources,
+ const uint32_t app_id) {
+ namespace strings = application_manager::strings;
+ namespace message_params = rc_rpc_plugin::message_params;
+ using smart_objects::SmartObject;
+ using smart_objects::SmartType_Array;
+ using smart_objects::SmartType_Map;
LOG4CXX_AUTO_TRACE(logger_);
- RCAppExtensionPtr rc_app_extension;
- if (!application) {
- return rc_app_extension;
- }
- application_manager::AppExtensionPtr app_extension =
- application->QueryInterface(RCRPCPlugin::kRCPluginID);
- if (!app_extension) {
- return rc_app_extension;
+ auto modules_inserter = [](SmartObject& result_modules) {
+ return [&result_modules](const ModuleUid& module) {
+ smart_objects::SmartObject module_data =
+ SmartObject(smart_objects::SmartType_Map);
+ auto module_type =
+ StringToEnum<mobile_apis::ModuleType::eType>(module.first);
+ module_data[message_params::kModuleType] = module_type;
+ module_data[message_params::kModuleId] = module.second;
+ result_modules.asArray()->push_back(module_data);
+ };
+ };
+ SmartObject allocated_modules = SmartObject(SmartType_Array);
+ for (const auto& module : allocated_resources) {
+ if (module.second == app_id) {
+ modules_inserter(allocated_modules)(module.first);
+ }
+ }
+ SmartObject free_modules = SmartObject(SmartType_Array);
+ for (auto& module : supported_resources) {
+ if (allocated_resources.find(module) == allocated_resources.end()) {
+ modules_inserter(free_modules)(module);
+ }
}
- rc_app_extension =
- application_manager::AppExtensionPtr::static_pointer_cast<RCAppExtension>(
- app_extension);
+ msg_params[message_params::kAllocatedModules] = allocated_modules;
+ msg_params[message_params::kFreeModules] = free_modules;
+}
- return rc_app_extension;
+smart_objects::SmartObjectSPtr
+ResourceAllocationManagerImpl::CreateOnRCStatusNotificationToMobile(
+ const application_manager::ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using application_manager::MessageHelper;
+ auto msg_to_mobile = MessageHelper::CreateNotification(
+ mobile_apis::FunctionID::OnRCStatusID, app->app_id());
+ auto& msg_params = (*msg_to_mobile)[application_manager::strings::msg_params];
+ if (is_rc_enabled()) {
+ ConstructOnRCStatusNotificationParams(
+ msg_params,
+ allocated_resources_,
+ rc_capabilities_manager_.GetResources(),
+ app->app_id());
+ } else {
+ msg_params[message_params::kAllocatedModules] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ msg_params[message_params::kFreeModules] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ }
+ return msg_to_mobile;
}
-void ResourceAllocationManagerImpl::RemoveAppsSubscriptions(const Apps& apps) {
+smart_objects::SmartObjectSPtr
+ResourceAllocationManagerImpl::CreateOnRCStatusNotificationToHmi(
+ const application_manager::ApplicationSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
- Apps::const_iterator app = apps.begin();
- for (; apps.end() != app; ++app) {
- application_manager::ApplicationSharedPtr app_ptr = *app;
- if (!app_ptr) {
- continue;
- }
- RCAppExtensionPtr rc_extention = GetApplicationExtention(app_ptr);
- if (rc_extention) {
- rc_extention->UnsubscribeFromInteriorVehicleData();
+ using application_manager::MessageHelper;
+ auto msg_to_hmi =
+ MessageHelper::CreateHMINotification(hmi_apis::FunctionID::RC_OnRCStatus);
+ auto& msg_params = (*msg_to_hmi)[application_manager::strings::msg_params];
+ ConstructOnRCStatusNotificationParams(msg_params,
+ allocated_resources_,
+ rc_capabilities_manager_.GetResources(),
+ app->app_id());
+ msg_params[application_manager::strings::app_id] = app->hmi_app_id();
+ return msg_to_hmi;
+}
+
+void ResourceAllocationManagerImpl::SendOnRCStatusNotifications(
+ NotificationTrigger::eType event,
+ application_manager::ApplicationSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr msg_to_mobile;
+ smart_objects::SmartObjectSPtr msg_to_hmi;
+ if (NotificationTrigger::APP_REGISTRATION == event) {
+ DCHECK(application);
+ msg_to_mobile = CreateOnRCStatusNotificationToMobile(application);
+ (*msg_to_mobile)[application_manager::strings::msg_params]
+ [message_params::kAllowed] = is_rc_enabled();
+ rpc_service_.SendMessageToMobile(msg_to_mobile);
+ } else {
+ auto rc_apps = RCRPCPlugin::GetRCApplications(app_mngr_);
+ for (const auto& rc_app : rc_apps) {
+ msg_to_mobile = CreateOnRCStatusNotificationToMobile(rc_app);
+ (*msg_to_mobile)[application_manager::strings::msg_params]
+ [message_params::kAllowed] = is_rc_enabled();
+ rpc_service_.SendMessageToMobile(msg_to_mobile);
+ msg_to_hmi = CreateOnRCStatusNotificationToHmi(rc_app);
+ rpc_service_.SendMessageToHMI(msg_to_hmi);
}
}
}
-void ResourceAllocationManagerImpl::SetResourceAquired(
- const std::string& module_type, const uint32_t app_id) {
+bool ResourceAllocationManagerImpl::is_rc_enabled() const {
+ return is_rc_enabled_;
+}
+
+void ResourceAllocationManagerImpl::set_rc_enabled(const bool value) {
+ is_rc_enabled_ = value;
+ SendOnRCStatusNotifications(
+ NotificationTrigger::RC_STATE_CHANGING,
+ std::shared_ptr<application_manager::Application>());
+}
+
+ResourceReleasedState::eType ResourceAllocationManagerImpl::ReleaseResource(
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t application_id) {
LOG4CXX_AUTO_TRACE(logger_);
- allocated_resources_[module_type] = app_id;
+ LOG4CXX_DEBUG(logger_,
+ "Release " << module_type << " " << module_id << " by "
+ << application_id);
+ return SetResourceFree(module_type, module_id, application_id);
+}
+
+void ResourceAllocationManagerImpl::SetResourceAcquired(
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ModuleUid module(module_type, module_id);
+ allocated_resources_[module] = app_id;
+}
+
+bool ResourceAllocationManagerImpl::IsResourceAlreadyAcquiredByApp(
+ const ModuleUid& moduleUid, const uint32_t app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto allocation = allocated_resources_.find(moduleUid);
+
+ if (allocated_resources_.end() == allocation) {
+ LOG4CXX_DEBUG(logger_,
+ "Resource " << moduleUid.first
+ << " is not allocated for any application.");
+ return false;
+ }
+
+ if (allocation->second != app_id) {
+ LOG4CXX_DEBUG(logger_,
+ "Resource "
+ << moduleUid.first
+ << " is already allocated by app:" << allocation->second
+ << ". Asquire has been asked for app:" << app_id);
+ return false;
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Resource " << moduleUid.first
+ << " is allocated by app:" << allocation->second);
+
+ return true;
}
-void ResourceAllocationManagerImpl::SetResourceFree(
- const std::string& module_type, const uint32_t app_id) {
+ResourceReleasedState::eType ResourceAllocationManagerImpl::SetResourceFree(
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) {
+ ModuleUid module(module_type, module_id);
AllocatedResources::const_iterator allocation =
- allocated_resources_.find(module_type);
+ allocated_resources_.find(module);
if (allocated_resources_.end() == allocation) {
LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is not allocated.");
- return;
+ return ResourceReleasedState::NOT_ALLOCATED;
}
if (app_id != allocation->second) {
LOG4CXX_ERROR(logger_,
"Resource " << module_type
<< " is allocated by different application "
<< allocation->second);
+ return ResourceReleasedState::IS_ALLOCATED;
}
allocated_resources_.erase(allocation);
- LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is released.");
+ LOG4CXX_DEBUG(
+ logger_,
+ "Resource " << module_type << ":" << module_id << " is released.");
+ return ResourceReleasedState::IS_RELEASED;
}
-std::vector<std::string> ResourceAllocationManagerImpl::GetAcquiredResources(
+std::vector<ModuleUid> ResourceAllocationManagerImpl::GetAcquiredResources(
const uint32_t application_id) const {
LOG4CXX_AUTO_TRACE(logger_);
Resources allocated_resources;
@@ -256,18 +440,37 @@ std::vector<std::string> ResourceAllocationManagerImpl::GetAcquiredResources(
return allocated_resources;
}
+std::set<std::string> ResourceAllocationManagerImpl::GetAcquiredModuleTypes(
+ const uint32_t application_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ Resources allocated_resources = GetAcquiredResources(application_id);
+ std::set<std::string> acquired_module_types;
+ for (const auto& resource : allocated_resources) {
+ acquired_module_types.insert(resource.first);
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Application " << application_id << " acquired "
+ << acquired_module_types.size()
+ << " module type(s).");
+
+ return acquired_module_types;
+}
+
void ResourceAllocationManagerImpl::SetResourceState(
const std::string& module_type,
+ const std::string& module_id,
const uint32_t app_id,
const ResourceState::eType state) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_,
"Setting state for " << module_type << " by app_id " << app_id
<< " to state " << state);
+ ModuleUid module(module_type, module_id);
{
sync_primitives::AutoLock lock(allocated_resources_lock_);
const AllocatedResources::const_iterator allocated_it =
- allocated_resources_.find(module_type);
+ allocated_resources_.find(module);
const bool acquired = allocated_resources_.end() != allocated_it;
if (acquired) {
@@ -283,16 +486,16 @@ void ResourceAllocationManagerImpl::SetResourceState(
}
sync_primitives::AutoLock lock(resources_state_lock_);
- resources_state_[module_type] = state;
+ resources_state_[module] = state;
LOG4CXX_DEBUG(logger_, "Resource " << module_type << " got state " << state);
}
bool ResourceAllocationManagerImpl::IsResourceFree(
- const std::string& module_type) const {
+ const std::string& module_type, const std::string& module_id) const {
LOG4CXX_AUTO_TRACE(logger_);
+ ModuleUid module(module_type, module_id);
sync_primitives::AutoLock lock(resources_state_lock_);
- const ResourcesState::const_iterator resource =
- resources_state_.find(module_type);
+ const ResourcesState::const_iterator resource = resources_state_.find(module);
if (resources_state_.end() == resource) {
LOG4CXX_DEBUG(logger_, "Resource " << module_type << " is free.");
@@ -320,15 +523,20 @@ ResourceAllocationManagerImpl::GetAccessMode() const {
}
void ResourceAllocationManagerImpl::ForceAcquireResource(
- const std::string& module_type, const uint32_t app_id) {
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) {
LOG4CXX_DEBUG(logger_, "Force " << app_id << " acquiring " << module_type);
sync_primitives::AutoLock lock(allocated_resources_lock_);
- SetResourceAquired(module_type, app_id);
+ SetResourceAcquired(module_type, module_id, app_id);
}
bool ResourceAllocationManagerImpl::IsModuleTypeRejected(
- const std::string& module_type, const uint32_t app_id) {
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
+ ModuleUid module(module_type, module_id);
sync_primitives::AutoLock lock(rejected_resources_for_application_lock_);
RejectedResources::iterator it =
rejected_resources_for_application_.find(app_id);
@@ -337,24 +545,27 @@ bool ResourceAllocationManagerImpl::IsModuleTypeRejected(
return false;
}
- const std::vector<std::string>& list_of_rejected_resources =
+ const std::vector<ModuleUid>& list_of_rejected_resources =
rejected_resources_for_application_[app_id];
- return helpers::in_range(list_of_rejected_resources, module_type);
+ return helpers::in_range(list_of_rejected_resources, module);
}
void ResourceAllocationManagerImpl::OnDriverDisallowed(
- const std::string& module_type, const uint32_t app_id) {
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
+ ModuleUid module(module_type, module_id);
sync_primitives::AutoLock lock(rejected_resources_for_application_lock_);
auto it = rejected_resources_for_application_.find(app_id);
if (rejected_resources_for_application_.end() == it) {
- rejected_resources_for_application_[app_id] = std::vector<std::string>();
+ rejected_resources_for_application_[app_id] = std::vector<ModuleUid>();
}
- std::vector<std::string>& list_of_rejected_resources =
+ std::vector<ModuleUid>& list_of_rejected_resources =
rejected_resources_for_application_[app_id];
- list_of_rejected_resources.push_back(module_type);
+ list_of_rejected_resources.push_back(module);
}
void ResourceAllocationManagerImpl::OnApplicationEvent(
@@ -367,15 +578,16 @@ void ResourceAllocationManagerImpl::OnApplicationEvent(
if (ApplicationEvent::kApplicationExit == event ||
ApplicationEvent::kApplicationUnregistered == event) {
- Resources acquired_modules = GetAcquiredResources(application->app_id());
- Resources::const_iterator module = acquired_modules.begin();
+ auto acquired_modules = GetAcquiredModuleTypes(application->app_id());
+ auto module = acquired_modules.begin();
for (; acquired_modules.end() != module; ++module) {
- ReleaseResource(*module, application->app_id());
+ ReleaseModuleType(*module, application->app_id());
+ }
+ if (!acquired_modules.empty()) {
+ SendOnRCStatusNotifications(
+ NotificationTrigger::MODULE_ALLOCATION,
+ std::shared_ptr<application_manager::Application>());
}
-
- Apps app_list;
- app_list.push_back(application);
- RemoveAppsSubscriptions(app_list);
}
}
@@ -392,8 +604,6 @@ void ResourceAllocationManagerImpl::OnPolicyEvent(
if (PolicyEvent::kApplicationsDisabled == event) {
ResetAllAllocations();
- Apps app_list = RCRPCPlugin::GetRCApplications(app_mngr_);
- RemoveAppsSubscriptions(app_list);
return;
}
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
index a66ab107be..bd46bdf11f 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
@@ -37,10 +37,14 @@ include_directories (
${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/test/include/
${COMPONENTS_DIR}/include/test/application_manager/
${COMPONENTS_DIR}/rc_rpc_plugin/test/include
+ ${COMPONENTS_DIR}/resumption/include
)
set (RC_TEST_SOURCES
-${CMAKE_CURRENT_SOURCE_DIR}/resource_allocation_manager_impl_test.cc
+${CMAKE_CURRENT_SOURCE_DIR}/interior_data_cache_test.cc
+${CMAKE_CURRENT_SOURCE_DIR}/rc_consent_manager_impl_test.cc
+${CMAKE_CURRENT_SOURCE_DIR}/grid_test.cc
+${CMAKE_CURRENT_SOURCE_DIR}/rc_helpers_test.cc
)
set(RC_COMMANDS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/commands)
@@ -51,16 +55,9 @@ file(GLOB SOURCES
)
set(LIBRARIES
- RCRpcPluginStaticLib
- ApplicationManager
- SmartObjects
- ProtocolHandler
- MessageHelper
- connectionHandler
- Utils
- jsoncpp
+ rc_rpc_plugin_static
+ Resumption
gmock_main
- dl
)
if(ENABLE_LOG)
@@ -71,5 +68,6 @@ if(ENABLE_LOG)
endif()
create_test("rc_commands_test" "${SOURCES}" "${LIBRARIES}" )
-create_test("resource_allocation_manager_test" "${RC_TEST_SOURCES}" "${LIBRARIES}")
+create_test("rc_plugin_test" "${RC_TEST_SOURCES}" "${LIBRARIES}")
+add_subdirectory(resource_allocation_manager)
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc
index 5098f6472e..fb8de0bb9c 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc
@@ -30,22 +30,28 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "rc_rpc_plugin/commands/mobile/button_press_request.h"
-#include "rc_rpc_plugin/rc_command_factory.h"
-#include "rc_rpc_plugin/rc_app_extension.h"
-#include "rc_rpc_plugin/rc_rpc_plugin.h"
-#include "rc_rpc_plugin/rc_module_constants.h"
-#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
+#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
+#include "gtest/gtest.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_cache.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_capabilities_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_consent_manager.h"
+#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
+#include "rc_rpc_plugin/rc_app_extension.h"
+#include "rc_rpc_plugin/rc_command_factory.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
+using ::application_manager::Message;
+using ::application_manager::MessageType;
+using application_manager::commands::MessageSharedPtr;
+using ::protocol_handler::MessagePriority;
using test::components::application_manager_test::MockApplication;
using test::components::commands_test::CommandRequestTest;
using test::components::commands_test::CommandsTestMocks;
@@ -57,17 +63,13 @@ using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::SaveArg;
-using ::application_manager::Message;
-using ::application_manager::MessageType;
-using application_manager::commands::MessageSharedPtr;
-using ::protocol_handler::MessagePriority;
namespace {
const int kModuleId = 153u;
const uint32_t kConnectionKey = 1u;
const uint32_t kAppId = 0u;
const std::string kPolicyAppId = "Test";
-}
+} // namespace
namespace rc_rpc_plugin_test {
@@ -78,46 +80,15 @@ class ButtonPressRequestTest
public:
ButtonPressRequestTest()
: rc_capabilities_(smart_objects::SmartType_Map)
- , mock_app_(utils::MakeShared<NiceMock<MockApplication> >())
+ , mock_app_(std::make_shared<NiceMock<MockApplication> >())
, rc_app_extention_(
- utils::MakeShared<rc_rpc_plugin::RCAppExtension>(kModuleId)) {}
-
- smart_objects::SmartObject ButtonCapability(
- const mobile_apis::ButtonName::eType button_name) {
- smart_objects::SmartObject button(smart_objects::SmartType_Map);
- button["name"] = button_name;
- return button;
- }
+ std::make_shared<rc_rpc_plugin::RCAppExtension>(kModuleId)) {}
void SetUp() OVERRIDE {
- using namespace mobile_apis;
-
- std::vector<ButtonName::eType> button_names = {ButtonName::AC_MAX,
- ButtonName::AC,
- ButtonName::RECIRCULATE,
- ButtonName::FAN_UP,
- ButtonName::FAN_DOWN,
- ButtonName::TEMP_UP,
- ButtonName::TEMP_DOWN,
- ButtonName::DEFROST_MAX,
- ButtonName::DEFROST,
- ButtonName::DEFROST_REAR,
- ButtonName::UPPER_VENT,
- ButtonName::LOWER_VENT,
- ButtonName::VOLUME_UP,
- ButtonName::VOLUME_DOWN,
- ButtonName::EJECT,
- ButtonName::SOURCE,
- ButtonName::SHUFFLE,
- ButtonName::REPEAT};
-
- smart_objects::SmartObject button_caps(smart_objects::SmartType_Array);
- for (size_t i = 0; i < button_names.size(); i++) {
- button_caps[i] = ButtonCapability(button_names[i]);
- }
- rc_capabilities_[strings::kbuttonCapabilities] = button_caps;
+ smart_objects::SmartObject control_caps((smart_objects::SmartType_Array));
+ rc_capabilities_[strings::kradioControlCapabilities] = control_caps;
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- ON_CALL(mock_allocation_manager_, GetApplicationExtention(_))
+ ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID))
.WillByDefault(Return(rc_app_extention_));
ON_CALL(app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(mock_policy_handler_));
@@ -129,7 +100,16 @@ class ButtonPressRequestTest
ON_CALL(mock_policy_handler_,
CheckHMIType(kPolicyAppId,
mobile_apis::AppHMIType::eType::REMOTE_CONTROL,
- nullptr)).WillByDefault(Return(true));
+ nullptr))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_allocation_manager_, is_rc_enabled())
+ .WillByDefault(Return(true));
+ ON_CALL(mock_rc_capabilities_manager_, CheckButtonName(_, _))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_rc_capabilities_manager_, CheckIfModuleExistsInCapabilities(_))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_rc_capabilities_manager_, CheckIfButtonExistInRCCaps(_))
+ .WillByDefault(Return(true));
}
MessageSharedPtr CreateBasicMessage() {
@@ -145,56 +125,71 @@ class ButtonPressRequestTest
}
template <class Command>
- application_manager::SharedPtr<Command> CreateRCCommand(
- MessageSharedPtr& msg) {
+ std::shared_ptr<Command> CreateRCCommand(MessageSharedPtr& msg) {
InitCommand(kDefaultTimeout_);
- return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(),
- app_mngr_,
- mock_rpc_service_,
- mock_hmi_capabilities_,
- mock_policy_handler_,
- mock_allocation_manager_);
+ RCCommandParams params{app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_,
+ mock_allocation_manager_,
+ mock_interior_data_cache_,
+ mock_interior_data_manager_,
+ mock_rc_capabilities_manager_,
+ mock_rc_consent_manger_};
+ return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), params);
}
protected:
smart_objects::SmartObject rc_capabilities_;
- utils::SharedPtr<MockApplication> mock_app_;
- utils::SharedPtr<rc_rpc_plugin::RCAppExtension> rc_app_extention_;
+ std::shared_ptr<MockApplication> mock_app_;
+ std::shared_ptr<rc_rpc_plugin::RCAppExtension> rc_app_extention_;
test::components::policy_test::MockPolicyHandlerInterface
mock_policy_handler_;
testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager>
mock_allocation_manager_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataCache>
+ mock_interior_data_cache_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataManager>
+ mock_interior_data_manager_;
+ testing::NiceMock<rc_rpc_plugin_test::MockRCCapabilitiesManager>
+ mock_rc_capabilities_manager_;
+ testing::NiceMock<MockRCConsentManager> mock_rc_consent_manger_;
};
TEST_F(ButtonPressRequestTest,
Execute_ButtonNameMatchesModuleType_ExpectCorrectMessageSentToHMI) {
// Arrange
+ const std::string resource = "CLIMATE";
+ const std::string resource_id = "id1";
MessageSharedPtr mobile_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& msg_params =
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_params =
(*mobile_message)[application_manager::strings::msg_params];
msg_params[message_params::kModuleType] = mobile_apis::ModuleType::CLIMATE;
+ msg_params[message_params::kModuleId] = resource_id;
msg_params[message_params::kButtonName] = mobile_apis::ButtonName::AC;
msg_params[message_params::kButtonPressMode] =
mobile_apis::ButtonPressMode::SHORT;
// Expectations
- const std::string resource = "CLIMATE";
ON_CALL(mock_policy_handler_, CheckModule(_, _)).WillByDefault(Return(true));
- EXPECT_CALL(mock_allocation_manager_, IsResourceFree(resource))
+
+ EXPECT_CALL(mock_allocation_manager_, IsResourceFree(resource, resource_id))
.WillOnce(Return(true));
- EXPECT_CALL(mock_allocation_manager_, AcquireResource(resource, _))
+ EXPECT_CALL(mock_allocation_manager_, AcquireResource(resource, _, _))
.WillOnce(Return(rc_rpc_plugin::AcquireResult::ALLOWED));
EXPECT_CALL(
mock_allocation_manager_,
- SetResourceState(resource, kAppId, rc_rpc_plugin::ResourceState::BUSY));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress)))
+ SetResourceState(
+ resource, resource_id, kAppId, rc_rpc_plugin::ResourceState::BUSY));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress), _))
.WillOnce(Return(true));
// Act
- application_manager::SharedPtr<rc_rpc_plugin::commands::ButtonPressRequest>
- command = CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>(
+ std::shared_ptr<rc_rpc_plugin::commands::ButtonPressRequest> command =
+ CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>(
mobile_message);
ASSERT_TRUE(command->Init());
command->Run();
@@ -204,27 +199,34 @@ TEST_F(
ButtonPressRequestTest,
Execute_ButtonNameDoesNotMatchModuleType_ExpectMessageNotSentToHMI_AndFalseSentToMobile) {
// Arrange
+ const std::string resource = "RADIO";
+ const std::string resource_id = "id1";
MessageSharedPtr mobile_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& msg_params =
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_params =
(*mobile_message)[application_manager::strings::msg_params];
msg_params[message_params::kModuleType] = mobile_apis::ModuleType::RADIO;
+ msg_params[message_params::kModuleId] = resource_id;
msg_params[message_params::kButtonName] = mobile_apis::ButtonName::AC;
msg_params[message_params::kButtonPressMode] =
mobile_apis::ButtonPressMode::SHORT;
// Expectations
- const std::string resource = "RADIO";
+ EXPECT_CALL(mock_rc_capabilities_manager_, CheckButtonName(_, _))
+ .WillOnce(Return(false));
ON_CALL(mock_policy_handler_, CheckModule(_, _)).WillByDefault(Return(true));
- EXPECT_CALL(mock_allocation_manager_, IsResourceFree(resource))
+ EXPECT_CALL(mock_allocation_manager_, IsResourceFree(resource, resource_id))
.WillOnce(Return(true));
- EXPECT_CALL(mock_allocation_manager_, AcquireResource(resource, _))
+ EXPECT_CALL(mock_allocation_manager_, AcquireResource(resource, _, _))
.WillOnce(Return(rc_rpc_plugin::AcquireResult::ALLOWED));
- EXPECT_CALL(mock_allocation_manager_, SetResourceState(resource, kAppId, _))
+ EXPECT_CALL(mock_allocation_manager_,
+ SetResourceState(resource, resource_id, kAppId, _))
.Times(2);
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Buttons_ButtonPress))).Times(0);
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_ButtonPress), _))
+ .Times(0);
MessageSharedPtr command_result;
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
@@ -232,8 +234,8 @@ TEST_F(
.WillOnce(DoAll(SaveArg<0>(&command_result), Return(true)));
// Act
- application_manager::SharedPtr<rc_rpc_plugin::commands::ButtonPressRequest>
- command = CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>(
+ std::shared_ptr<rc_rpc_plugin::commands::ButtonPressRequest> command =
+ CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>(
mobile_message);
ASSERT_TRUE(command->Init());
command->Run();
@@ -242,7 +244,7 @@ TEST_F(
TEST_F(ButtonPressRequestTest, OnEvent_ExpectSuccessfullResponseSentToMobile) {
// Arrange
MessageSharedPtr mobile_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& msg_params =
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_params =
(*mobile_message)[application_manager::strings::msg_params];
msg_params[message_params::kModuleType] = mobile_apis::ModuleType::CLIMATE;
msg_params[message_params::kButtonName] = mobile_apis::ButtonName::AC;
@@ -250,7 +252,7 @@ TEST_F(ButtonPressRequestTest, OnEvent_ExpectSuccessfullResponseSentToMobile) {
mobile_apis::ButtonPressMode::SHORT;
MessageSharedPtr hmi_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& hmi_msg_params =
+ ns_smart_device_link::ns_smart_objects::SmartObject& hmi_msg_params =
(*hmi_message)[application_manager::strings::msg_params];
hmi_apis::Common_Result::eType response_code =
hmi_apis::Common_Result::SUCCESS;
@@ -258,9 +260,10 @@ TEST_F(ButtonPressRequestTest, OnEvent_ExpectSuccessfullResponseSentToMobile) {
hmi_msg_params[application_manager::strings::connection_key] = kConnectionKey;
// Expectations
- EXPECT_CALL(mock_allocation_manager_,
- SetResourceState(_, kAppId, rc_rpc_plugin::ResourceState::FREE))
- .Times(2);
+ EXPECT_CALL(
+ mock_allocation_manager_,
+ SetResourceState(_, _, kAppId, rc_rpc_plugin::ResourceState::FREE))
+ .Times(1);
EXPECT_CALL(
mock_rpc_service_,
@@ -271,8 +274,8 @@ TEST_F(ButtonPressRequestTest, OnEvent_ExpectSuccessfullResponseSentToMobile) {
application_manager::event_engine::Event event(
hmi_apis::FunctionID::Buttons_ButtonPress);
event.set_smart_object(*hmi_message);
- application_manager::SharedPtr<rc_rpc_plugin::commands::ButtonPressRequest>
- command = CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>(
+ std::shared_ptr<rc_rpc_plugin::commands::ButtonPressRequest> command =
+ CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>(
mobile_message);
command->on_event(event);
}
@@ -281,7 +284,7 @@ TEST_F(ButtonPressRequestTest,
OnEvent_ReadOnlyParamFromHMI_ExpectFalseSentToMobile) {
// Arrange
MessageSharedPtr mobile_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& msg_params =
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_params =
(*mobile_message)[application_manager::strings::msg_params];
msg_params[message_params::kModuleType] = mobile_apis::ModuleType::CLIMATE;
msg_params[message_params::kButtonName] = mobile_apis::ButtonName::AC;
@@ -289,7 +292,7 @@ TEST_F(ButtonPressRequestTest,
mobile_apis::ButtonPressMode::SHORT;
MessageSharedPtr hmi_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& hmi_msg_params =
+ ns_smart_device_link::ns_smart_objects::SmartObject& hmi_msg_params =
(*hmi_message)[application_manager::strings::params];
hmi_apis::Common_Result::eType response_code =
hmi_apis::Common_Result::READ_ONLY;
@@ -297,9 +300,10 @@ TEST_F(ButtonPressRequestTest,
hmi_msg_params[application_manager::strings::connection_key] = kConnectionKey;
// Expectations
- EXPECT_CALL(mock_allocation_manager_,
- SetResourceState(_, kAppId, rc_rpc_plugin::ResourceState::FREE))
- .Times(2);
+ EXPECT_CALL(
+ mock_allocation_manager_,
+ SetResourceState(_, _, kAppId, rc_rpc_plugin::ResourceState::FREE))
+ .Times(1);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
@@ -310,8 +314,8 @@ TEST_F(ButtonPressRequestTest,
application_manager::event_engine::Event event(
hmi_apis::FunctionID::Buttons_ButtonPress);
event.set_smart_object(*hmi_message);
- application_manager::SharedPtr<rc_rpc_plugin::commands::ButtonPressRequest>
- command = CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>(
+ std::shared_ptr<rc_rpc_plugin::commands::ButtonPressRequest> command =
+ CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>(
mobile_message);
command->on_event(event);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_consent_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_consent_request_test.cc
new file mode 100644
index 0000000000..29708d05bd
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_consent_request_test.cc
@@ -0,0 +1,402 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <memory>
+#include <string>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_consent_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/mock_application.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_cache.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_capabilities_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_consent_manager.h"
+#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+
+using application_manager::commands::MessageSharedPtr;
+using rc_rpc_plugin_test::MockInteriorDataCache;
+using rc_rpc_plugin_test::MockInteriorDataManager;
+using rc_rpc_plugin_test::MockRCCapabilitiesManager;
+using rc_rpc_plugin_test::MockRCConsentManager;
+using rc_rpc_plugin_test::MockResourceAllocationManager;
+using test::components::application_manager_test::MockApplication;
+using test::components::commands_test::CommandRequestTest;
+using test::components::commands_test::CommandsTestMocks;
+
+using ::testing::_;
+using ::testing::DoAll;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::SaveArg;
+
+typedef std::shared_ptr<
+ rc_rpc_plugin::commands::GetInteriorVehicleDataConsentRequest>
+ GIVDConsentPtr;
+
+namespace {
+const uint32_t kConnectionKey = 1u;
+const uint32_t kAppId = 2u;
+const std::string kPolicyAppId = "policy_app_id";
+const std::string kMacAddress = "device1";
+const std::string kModuleId_1 = "34045662-a9dc-4823-8435-91056d4c26cb";
+const std::string kModuleId_2 = "eb7739ea-b263-4fe1-af9c-9311d1acac2d";
+const std::string kModuleId_3 = "06cdec22-920e-4865-bf2e-9518463edc68";
+const mobile_apis::ModuleType::eType kModule_Type =
+ mobile_apis::ModuleType::eType::RADIO;
+} // namespace
+
+namespace rc_rpc_plugin_test {
+namespace get_interior_vehicle_data_consent_request_test {
+using namespace rc_rpc_plugin;
+
+class GetInteriorVehicleDataConsentRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ GetInteriorVehicleDataConsentRequestTest() : mock_app_(CreateMockApp()) {}
+
+ void SetUp() OVERRIDE {
+ TestPrecondition();
+ }
+
+ void TestPrecondition() {
+ message_ = CreateBasicMessage();
+ ON_CALL(mock_rc_capabilities_manager_, CheckIfModuleExistsInCapabilities(_))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_rc_capabilities_manager_, IsMultipleAccessAllowed(_))
+ .WillByDefault(Return(true));
+ }
+
+ void PrepareNoConsentExistInCache() {
+ ON_CALL(mock_allocation_manager_, GetAccessMode())
+ .WillByDefault(Return(hmi_apis::Common_RCAccessMode::ASK_DRIVER));
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
+ ON_CALL(*mock_app_, mac_address()).WillByDefault(ReturnRef(kMacAddress));
+ ON_CALL(mock_rc_consent_manger_,
+ GetModuleConsent(kPolicyAppId, kMacAddress, _))
+ .WillByDefault(Return(rc_rpc_types::ModuleConsent::NOT_EXISTS));
+ ON_CALL(mock_allocation_manager_,
+ AcquireResource(_, _, mock_app_->app_id()))
+ .WillByDefault(Return(AcquireResult::IN_USE));
+ }
+
+ void PrepareMobileMessage() {
+ auto& msg_params = (*message_)[application_manager::strings::msg_params];
+ msg_params[message_params::kModuleType] = kModule_Type;
+
+ msg_params[message_params::kModuleIds][0] = kModuleId_1;
+ msg_params[message_params::kModuleIds][1] = kModuleId_2;
+ msg_params[message_params::kModuleIds][2] = kModuleId_3;
+ }
+
+ /**
+ * @brief CreateBasicMessage creates message for
+ * GetInteriorVehicleData request for app1
+ * @return message shared ptr
+ */
+ MessageSharedPtr CreateBasicMessage() {
+ MessageSharedPtr message = CreateMessage();
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::function_id] =
+ mobile_apis::FunctionID::GetInteriorVehicleDataID;
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::connection_key] = kConnectionKey;
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::app_id] = kAppId;
+ return message;
+ }
+
+ template <class Command>
+ std::shared_ptr<Command> CreateRCCommand(MessageSharedPtr& msg) {
+ InitCommand(kDefaultTimeout_);
+ RCCommandParams params{app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_,
+ mock_allocation_manager_,
+ mock_interior_data_cache_,
+ mock_interior_data_manager_,
+ mock_rc_capabilities_manager_,
+ mock_rc_consent_manger_};
+ return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), params);
+ }
+
+ protected:
+ GIVDConsentPtr command_;
+ MessageSharedPtr message_;
+
+ MockAppPtr mock_app_;
+ NiceMock<MockResourceAllocationManager> mock_allocation_manager_;
+ NiceMock<MockInteriorDataCache> mock_interior_data_cache_;
+ NiceMock<MockInteriorDataManager> mock_interior_data_manager_;
+ NiceMock<MockRCCapabilitiesManager> mock_rc_capabilities_manager_;
+ NiceMock<MockRCConsentManager> mock_rc_consent_manger_;
+};
+
+TEST_F(GetInteriorVehicleDataConsentRequestTest,
+ ModuleIDReturnsEmptyString_SUCCESS) {
+ std::string empty_str;
+ command_ =
+ CreateRCCommand<commands::GetInteriorVehicleDataConsentRequest>(message_);
+
+ EXPECT_EQ(empty_str, command_->ModuleId());
+}
+
+TEST_F(GetInteriorVehicleDataConsentRequestTest,
+ Execute_ModuleIdsIsAbsentInMessage_Response_INVALID_DATA) {
+ command_ =
+ CreateRCCommand<commands::GetInteriorVehicleDataConsentRequest>(message_);
+
+ auto response_to_mobile = CreateMessage();
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ command_->Execute();
+
+ const bool result =
+ (*response_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::success]
+ .asBool();
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*response_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::result_code]
+ .asUInt());
+ EXPECT_FALSE(result);
+ EXPECT_EQ(mobile_apis::Result::INVALID_DATA, result_code);
+}
+
+TEST_F(GetInteriorVehicleDataConsentRequestTest,
+ Execute_ModuleIdsIsEmpty_AddDefaultModuleID) {
+ (*message_)[application_manager::strings::msg_params]
+ [message_params::kModuleIds] = smart_objects::SmartObject(
+ smart_objects::SmartType::SmartType_Array);
+ (*message_)[application_manager::strings::msg_params]
+ [message_params::kModuleType] = kModule_Type;
+ command_ =
+ CreateRCCommand<commands::GetInteriorVehicleDataConsentRequest>(message_);
+
+ auto message_to_hmi = CreateMessage();
+
+ const std::string module_type = "RADIO";
+ const std::string default_module_id = "34045662-a9dc-4823-8435-91056d4c26cb";
+ ON_CALL(mock_rc_capabilities_manager_,
+ GetDefaultModuleIdFromCapabilities(module_type))
+ .WillByDefault(Return(default_module_id));
+
+ PrepareNoConsentExistInCache();
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_hmi), Return(true)));
+
+ command_->Execute();
+
+ ASSERT_FALSE((*message_to_hmi)[application_manager::strings::msg_params]
+ [message_params::kModuleIds]
+ .empty());
+ const auto sent_module_id =
+ (*message_to_hmi)[application_manager::strings::msg_params]
+ [message_params::kModuleIds][0]
+ .asString();
+ EXPECT_EQ(sent_module_id, default_module_id);
+}
+
+TEST_F(GetInteriorVehicleDataConsentRequestTest,
+ Execute_SDLForwardsMobileMessageToHMI_SUCCESS) {
+ auto message_to_hmi = CreateMessage();
+
+ PrepareMobileMessage();
+ PrepareNoConsentExistInCache();
+
+ command_ =
+ CreateRCCommand<commands::GetInteriorVehicleDataConsentRequest>(message_);
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_hmi), Return(true)));
+
+ command_->Execute();
+
+ auto outgoing_msg_params =
+ (*message_to_hmi)[application_manager::strings::msg_params];
+
+ auto module_type = static_cast<mobile_apis::ModuleType::eType>(
+ outgoing_msg_params[message_params::kModuleType].asUInt());
+
+ EXPECT_EQ(kModule_Type, module_type);
+ EXPECT_EQ(kModuleId_1,
+ outgoing_msg_params[message_params::kModuleIds][0].asString());
+ EXPECT_EQ(kModuleId_2,
+ outgoing_msg_params[message_params::kModuleIds][1].asString());
+ EXPECT_EQ(kModuleId_3,
+ outgoing_msg_params[message_params::kModuleIds][2].asString());
+}
+
+TEST_F(GetInteriorVehicleDataConsentRequestTest,
+ On_Event_ConsentCollectionIsAbsentOrEmpty_Response_GENERIC_ERROR) {
+ PrepareMobileMessage();
+
+ command_ =
+ CreateRCCommand<commands::GetInteriorVehicleDataConsentRequest>(message_);
+
+ // Consent collection in HMI response is absent
+ auto event_message = CreateMessage();
+ application_manager::event_engine::Event event_collection_is_absent(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent);
+ event_collection_is_absent.set_smart_object(*event_message);
+
+ auto response_to_mobile = CreateMessage();
+
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ command_->on_event(event_collection_is_absent);
+
+ const auto result_code_is_absent = static_cast<mobile_apis::Result::eType>(
+ (*response_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::result_code]
+ .asUInt());
+ EXPECT_EQ(mobile_apis::Result::GENERIC_ERROR, result_code_is_absent);
+
+ // Consent coolection in HMI response isn't absent but is empty
+ event_message = CreateMessage();
+ application_manager::event_engine::MobileEvent event_collection_is_empty(
+ mobile_apis::FunctionID::GetInteriorVehicleDataConsentID);
+ (*event_message)[application_manager::strings::msg_params]
+ [message_params::kAllowed] = smart_objects::SmartObject(
+ smart_objects::SmartType::SmartType_Array);
+ event_collection_is_empty.set_smart_object(*event_message);
+
+ response_to_mobile = CreateMessage();
+
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ command_->on_event(event_collection_is_absent);
+
+ const auto result_code_is_empty = static_cast<mobile_apis::Result::eType>(
+ (*response_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::result_code]
+ .asUInt());
+ EXPECT_EQ(mobile_apis::Result::GENERIC_ERROR, result_code_is_empty);
+}
+
+TEST_F(GetInteriorVehicleDataConsentRequestTest,
+ On_Event_ConsentsSizeIsNotEqualModuleIdsSize_Response_GENERIC_ERROR) {
+ PrepareMobileMessage();
+ PrepareNoConsentExistInCache();
+
+ // ModuleIds collection will be saved
+ command_ =
+ CreateRCCommand<commands::GetInteriorVehicleDataConsentRequest>(message_);
+ command_->Execute();
+
+ auto event_message = CreateMessage();
+ (*event_message)[application_manager::strings::msg_params]
+ [message_params::kAllowed] = smart_objects::SmartObject(
+ smart_objects::SmartType::SmartType_Array);
+
+ // Consent collection will contain only two items in collection
+ (*event_message)[application_manager::strings::msg_params]
+ [message_params::kAllowed][0] = true;
+ (*event_message)[application_manager::strings::msg_params]
+ [message_params::kAllowed][1] = false;
+
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent);
+ event.set_smart_object(*event_message);
+
+ auto response_to_mobile = CreateMessage();
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ command_->on_event(event);
+
+ const auto result_code_is_empty = static_cast<mobile_apis::Result::eType>(
+ (*response_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::result_code]
+ .asUInt());
+ EXPECT_EQ(mobile_apis::Result::GENERIC_ERROR, result_code_is_empty);
+}
+
+TEST_F(GetInteriorVehicleDataConsentRequestTest,
+ On_Event_SaveModuleConsentsToLastState_Response_SUCCESS) {
+ PrepareMobileMessage();
+ PrepareNoConsentExistInCache();
+
+ // ModuleIds collection will be saved
+ command_ =
+ CreateRCCommand<commands::GetInteriorVehicleDataConsentRequest>(message_);
+ command_->Execute();
+
+ // Consent collection will have same size as moduelIds collection
+ auto event_message = CreateMessage();
+ (*event_message)[application_manager::strings::msg_params]
+ [message_params::kAllowed][0] = true;
+ (*event_message)[application_manager::strings::msg_params]
+ [message_params::kAllowed][1] = false;
+ (*event_message)[application_manager::strings::msg_params]
+ [message_params::kAllowed][2] = false;
+
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent);
+ event.set_smart_object(*event_message);
+
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
+ ON_CALL(*mock_app_, mac_address()).WillByDefault(ReturnRef(kMacAddress));
+
+ EXPECT_CALL(mock_rc_consent_manger_, SaveModuleConsents(kPolicyAppId, _, _));
+
+ auto response_to_mobile = CreateMessage();
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ command_->on_event(event);
+
+ const auto result_code_is_empty = static_cast<mobile_apis::Result::eType>(
+ (*response_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::result_code]
+ .asUInt());
+ EXPECT_EQ(mobile_apis::Result::SUCCESS, result_code_is_empty);
+}
+
+} // namespace get_interior_vehicle_data_consent_request_test
+} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
index 7074bfb9c5..532a62df3b 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,43 +31,57 @@
*/
#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_request.h"
-#include "gtest/gtest.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event_dispatcher.h"
+#include "application_manager/message_helper.h"
#include "application_manager/mock_application.h"
+#include "gtest/gtest.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_cache.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_capabilities_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_consent_manager.h"
+#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
#include "rc_rpc_plugin/rc_app_extension.h"
-#include "rc_rpc_plugin/rc_module_constants.h"
-#include "application_manager/message_helper.h"
#include "rc_rpc_plugin/rc_command_factory.h"
-#include "application_manager/event_engine/event_dispatcher.h"
-#include "application_manager/commands/command_request_test.h"
-#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
-using ::testing::_;
-using ::testing::Mock;
-using ::testing::NiceMock;
-using ::testing::StrictMock;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::SaveArg;
+#include <stdint.h>
+#include <chrono>
+#include <thread>
+
+using application_manager::ApplicationSet;
+using ::application_manager::ApplicationSharedPtr;
using ::application_manager::Message;
using ::application_manager::MessageType;
using application_manager::commands::MessageSharedPtr;
-using ::application_manager::ApplicationSharedPtr;
using ::protocol_handler::MessagePriority;
using test::components::application_manager_test::MockApplication;
using test::components::application_manager_test::MockApplicationManager;
-using test::components::commands_test::MockApplicationManager;
using test::components::commands_test::CommandRequestTest;
using test::components::commands_test::CommandsTestMocks;
using test::components::commands_test::HMIResultCodeIs;
using test::components::commands_test::MobileResultCodeIs;
+using test::components::commands_test::MockApplicationManager;
+using ::testing::_;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::SaveArg;
+using ::testing::StrictMock;
namespace {
const int32_t kConnectionKey = 5u;
const uint32_t kAppId = 0u;
+const uint32_t kAppId2 = 1u;
const int kModuleId = 153u;
-}
+const auto module_eType = mobile_apis::ModuleType::RADIO;
+const auto module_type = "RADIO";
+const auto module_id = "eb7739ea-b263-4fe1-af9c-9311d1acac2d";
+const int32_t time_frame_of_allowed_requests = 1;
+const uint32_t max_request_in_time_frame = 5u;
+} // namespace
namespace rc_rpc_plugin_test {
@@ -76,20 +90,62 @@ class GetInteriorVehicleDataRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
GetInteriorVehicleDataRequestTest()
- : mock_app_(utils::MakeShared<NiceMock<MockApplication> >())
- , rc_app_extention_(utils::MakeShared<RCAppExtension>(kModuleId)) {
+ : mock_app_(std::make_shared<NiceMock<MockApplication> >())
+ , mock_app2_(std::make_shared<NiceMock<MockApplication> >())
+ , rc_app_extention_(std::make_shared<RCAppExtension>(kModuleId))
+ , rc_app_extention2_(std::make_shared<RCAppExtension>(kModuleId))
+ , apps_lock_(std::make_shared<sync_primitives::Lock>())
+ , apps_da_(apps_, apps_lock_)
+ , rc_capabilities_(smart_objects::SmartType::SmartType_Array) {
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app2_, app_id()).WillByDefault(Return(kAppId2));
+ ON_CALL(*mock_app_, is_remote_control_supported())
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app2_, is_remote_control_supported())
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, QueryInterface(_))
+ .WillByDefault(Return(rc_app_extention_));
+ ON_CALL(*mock_app2_, QueryInterface(_))
+ .WillByDefault(Return(rc_app_extention2_));
+ }
+
+ /**
+ * @brief CreateBasicMessage creates message for
+ * GetInteriorVehicleData request for app1
+ * @return message shared ptr
+ */
+ MessageSharedPtr CreateBasicMessage() {
+ MessageSharedPtr message = CreateMessage();
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::function_id] =
+ mobile_apis::FunctionID::GetInteriorVehicleDataID;
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::connection_key] = kConnectionKey;
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::connection_key] = kAppId;
+ return message;
+ }
+
+ void SetUp() OVERRIDE {
+ std::pair<uint32_t, int32_t> frequency;
+ frequency.first = max_request_in_time_frame;
+ frequency.second = time_frame_of_allowed_requests;
+ smart_objects::SmartObject control_caps((smart_objects::SmartType_Array));
+ rc_capabilities_[strings::kradioControlCapabilities] = control_caps;
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_settings_, get_interior_vehicle_data_frequency())
+ .WillByDefault(ReturnRef(frequency));
+
ON_CALL(app_mngr_, hmi_interfaces())
.WillByDefault(ReturnRef(mock_hmi_interfaces_));
-
ON_CALL(
mock_hmi_interfaces_,
GetInterfaceState(application_manager::HmiInterfaces::HMI_INTERFACE_RC))
.WillByDefault(Return(application_manager::HmiInterfaces::
InterfaceState::STATE_AVAILABLE));
ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
- ON_CALL(mock_allocation_manager_, GetApplicationExtention(_))
- .WillByDefault(Return(rc_app_extention_));
+ ON_CALL(app_mngr_, application(kAppId2)).WillByDefault(Return(mock_app2_));
ON_CALL(app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(mock_policy_handler_));
ON_CALL(app_mngr_, hmi_capabilities())
@@ -100,139 +156,623 @@ class GetInteriorVehicleDataRequestTest
CheckHMIType(
_, mobile_apis::AppHMIType::eType::REMOTE_CONTROL, nullptr))
.WillByDefault(Return(true));
+ ON_CALL(mock_policy_handler_, CheckModule(_, _))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_allocation_manager_, is_rc_enabled())
+ .WillByDefault(Return(true));
+ ON_CALL(mock_rc_capabilities_manager_, CheckIfModuleExistsInCapabilities(_))
+ .WillByDefault(Return(true));
}
- MessageSharedPtr CreateBasicMessage() {
- MessageSharedPtr message = CreateMessage();
- (*message)[application_manager::strings::params]
- [application_manager::strings::function_id] =
- mobile_apis::FunctionID::GetInteriorVehicleDataID;
- (*message)[application_manager::strings::params]
- [application_manager::strings::connection_key] = kConnectionKey;
- (*message)[application_manager::strings::params]
- [application_manager::strings::connection_key] = kAppId;
- return message;
- }
template <class Command>
- application_manager::SharedPtr<Command> CreateRCCommand(
- MessageSharedPtr& msg) {
+ std::shared_ptr<Command> CreateRCCommand(MessageSharedPtr& msg) {
InitCommand(kDefaultTimeout_);
- return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(),
- app_mngr_,
- mock_rpc_service_,
- mock_hmi_capabilities_,
- mock_policy_handler_,
- mock_allocation_manager_);
+ RCCommandParams params{app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_,
+ mock_allocation_manager_,
+ mock_interior_data_cache_,
+ mock_interior_data_manager_,
+ mock_rc_capabilities_manager_,
+ mock_rc_consent_manger_};
+ return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), params);
}
protected:
- smart_objects::SmartObject rc_capabilities_;
- utils::SharedPtr<MockApplication> mock_app_;
- utils::SharedPtr<RCAppExtension> rc_app_extention_;
+ std::shared_ptr<MockApplication> mock_app_;
+ std::shared_ptr<MockApplication> mock_app2_;
+ std::shared_ptr<RCAppExtension> rc_app_extention_;
+ std::shared_ptr<RCAppExtension> rc_app_extention2_;
testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager>
mock_allocation_manager_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataCache>
+ mock_interior_data_cache_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataManager>
+ mock_interior_data_manager_;
+ application_manager::ApplicationSet apps_;
+ const std::shared_ptr<sync_primitives::Lock> apps_lock_;
+ DataAccessor<application_manager::ApplicationSet> apps_da_;
+ testing::NiceMock<rc_rpc_plugin_test::MockRCCapabilitiesManager>
+ mock_rc_capabilities_manager_;
+ smart_objects::SmartObject rc_capabilities_;
+ testing::NiceMock<MockRCConsentManager> mock_rc_consent_manger_;
};
+
TEST_F(GetInteriorVehicleDataRequestTest,
- Execute_MessageValidationOk_ExpectCorrectMessageSentToHMI) {
+ Execute_ExpectCorrectMessageSentToHMI_NoSubscriptionNoCache) {
// Arrange
- ON_CALL(mock_policy_handler_, CheckModule(_, _)).WillByDefault(Return(true));
- EXPECT_CALL(mock_hmi_capabilities_, rc_capability())
- .WillOnce(Return(nullptr));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::RC_GetInteriorVehicleData)))
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleType] = module_eType;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleType] = module_id;
+ const ModuleUid module(module_type, module_id);
+ ON_CALL(mock_interior_data_cache_, Contains(module))
+ .WillByDefault(Return(false));
+ ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
+ .WillByDefault(Return(true));
+ auto command =
+ CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
+ mobile_message);
+
+ // Expectations
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
.WillOnce(Return(true));
+ // Act
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(GetInteriorVehicleDataRequestTest,
+ Execute_ExpectCorrectMessageSentToHMI_SupscribeAppNoCache) {
+ // Arrange
MessageSharedPtr mobile_message = CreateBasicMessage();
- application_manager::SharedPtr<
- rc_rpc_plugin::commands::GetInteriorVehicleDataRequest> command =
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleType] = module_eType;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleId] = module_id;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kSubscribe] = true;
+ const ModuleUid module(module_type, module_id);
+ ON_CALL(mock_interior_data_cache_, Contains(module))
+ .WillByDefault(Return(false));
+ ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
+ .WillByDefault(Return(true));
+ auto command =
CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
mobile_message);
+
+ // Expectations
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
+ .WillOnce(Return(true));
+ // Act
+ ASSERT_TRUE(command->Init());
command->Run();
}
TEST_F(
GetInteriorVehicleDataRequestTest,
- Execute_MessageValidationFailed_ExpectMessageNotSentToHMI_AndFalseSentToMobile) {
+ Execute_ExpectMessageNotSentToHMI_SuccessSentToMobile_AppSubscribed_DataFromCache) {
// Arrange
+ const ModuleUid module(module_type, module_id);
+ rc_app_extention_->SubscribeToInteriorVehicleData(module);
MessageSharedPtr mobile_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& msg_params =
- (*mobile_message)[application_manager::strings::msg_params];
- msg_params[message_params::kModuleType] = mobile_apis::ModuleType::RADIO;
- ON_CALL(mock_policy_handler_, CheckModule(_, _)).WillByDefault(Return(true));
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleType] = module_eType;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleId] = module_id;
+ smart_objects::SmartObject radio_data;
+ smart_objects::SmartObject sis_data;
+ smart_objects::SmartObject gps_data;
+
+ gps_data[application_manager::strings::longitude_degrees] = 1.0;
+ gps_data[application_manager::strings::latitude_degrees] = 1.0;
+
+ sis_data[application_manager::strings::station_short_name] =
+ "dummy_short_name";
+ sis_data[application_manager::strings::station_location] = gps_data;
+
+ radio_data[message_params::kBand] = enums_value::kAM;
+ radio_data[message_params::kSisData] = sis_data;
+
+ auto command =
+ CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
+ mobile_message);
+
+ // Expectations
+ EXPECT_CALL(mock_interior_data_cache_, Contains(module))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_interior_data_cache_, Retrieve(module))
+ .WillOnce(Return(radio_data));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
MessageSharedPtr command_result;
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::RC_GetInteriorVehicleData))).Times(0);
EXPECT_CALL(
mock_rpc_service_,
- ManageMobileCommand(
- MobileResultCodeIs(mobile_apis::Result::UNSUPPORTED_RESOURCE), _))
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _))
.WillOnce(DoAll(SaveArg<0>(&command_result), Return(true)));
- application_manager::SharedPtr<
- rc_rpc_plugin::commands::GetInteriorVehicleDataRequest> command =
- CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
- mobile_message);
+
+ // Act
+ ASSERT_TRUE(command->Init());
command->Run();
+
+ // Assert
+ EXPECT_EQ((*command_result)[application_manager::strings::msg_params]
+ [message_params::kModuleData]
+ [message_params::kRadioControlData],
+ radio_data);
}
-TEST_F(GetInteriorVehicleDataRequestTest,
- OnEvent_ValidHmiResponse_ExpectSuccessfullResponseSentToMobile) {
+TEST_F(
+ GetInteriorVehicleDataRequestTest,
+ Execute_ExpectCorrectMessageSentToHMI_LastAppSubscribedUnsubscribe_ClearCache) {
// Arrange
MessageSharedPtr mobile_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& msg_params =
- (*mobile_message)[application_manager::strings::msg_params];
- msg_params[message_params::kModuleType] = mobile_apis::ModuleType::CLIMATE;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleType] = module_eType;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kSubscribe] = false;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleId] = module_id;
+ const ModuleUid module(module_type, module_id);
- MessageSharedPtr hmi_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& hmi_msg_params =
- (*hmi_message)[application_manager::strings::msg_params];
+ MessageSharedPtr hmi_response = CreateBasicMessage();
+ ns_smart_device_link::ns_smart_objects::SmartObject& hmi_msg_params =
+ (*hmi_response)[application_manager::strings::msg_params];
hmi_apis::Common_Result::eType response_code =
hmi_apis::Common_Result::SUCCESS;
hmi_msg_params[application_manager::hmi_response::code] = response_code;
hmi_msg_params[application_manager::strings::connection_key] = kConnectionKey;
+ hmi_msg_params[message_params::kModuleData][message_params::kModuleId] =
+ module_id;
+
+ apps_.insert(mock_app_);
+ rc_app_extention_->SubscribeToInteriorVehicleData(module);
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
+ ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
+ .WillByDefault(Return(true));
+ // Expectations
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
+ .WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _))
.WillOnce(Return(true));
+ EXPECT_CALL(mock_interior_data_cache_, Remove(module));
+
+ // Act
+ auto command =
+ CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
+ mobile_message);
+ ASSERT_TRUE(command->Init());
+ command->Run();
application_manager::event_engine::Event event(
hmi_apis::FunctionID::RC_GetInteriorVehicleData);
- event.set_smart_object(*hmi_message);
- application_manager::SharedPtr<
- rc_rpc_plugin::commands::GetInteriorVehicleDataRequest> command =
+ event.set_smart_object(*hmi_response);
+ command->on_event(event);
+}
+
+TEST_F(GetInteriorVehicleDataRequestTest,
+ Execute_ExpectMessageNotSentToHMI_TwoApps_OneUnsubscribed) {
+ // Arrange
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleType] = module_eType;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kSubscribe] = false;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleId] = module_id;
+ const ModuleUid module(module_type, module_id);
+
+ apps_.insert(mock_app_);
+ apps_.insert(mock_app2_);
+ rc_app_extention_->SubscribeToInteriorVehicleData(module);
+ rc_app_extention2_->SubscribeToInteriorVehicleData(module);
+
+ smart_objects::SmartObject radio_data;
+ radio_data[message_params::kBand] = enums_value::kAM;
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
+
+ auto command =
+ CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
+ mobile_message);
+
+ // Expectations
+ EXPECT_CALL(mock_interior_data_cache_, Contains(module))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_interior_data_cache_, Retrieve(module))
+ .WillOnce(Return(radio_data));
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+ MessageSharedPtr command_result;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _))
+ .WillOnce(DoAll(SaveArg<0>(&command_result), Return(true)));
+
+ // Act
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ // Assert
+ EXPECT_FALSE(rc_app_extention_->IsSubscribedToInteriorVehicleDataOfType(
+ enums_value::kRadio));
+ EXPECT_EQ((*command_result)[application_manager::strings::msg_params]
+ [message_params::kModuleData]
+ [message_params::kRadioControlData],
+ radio_data);
+}
+
+TEST_F(
+ GetInteriorVehicleDataRequestTest,
+ Execute_CapabilitiesValidationFailed_ExpectMessageNotSentToHMI_AndFalseSentToMobile) {
+ // Arrange
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_params =
+ (*mobile_message)[application_manager::strings::msg_params];
+ msg_params[message_params::kModuleType] = module_eType;
+ auto command =
+ CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
+ mobile_message);
+ ON_CALL(mock_hmi_capabilities_, rc_capability())
+ .WillByDefault(Return(nullptr));
+
+ // Expectations
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_apis::Result::UNSUPPORTED_RESOURCE), _))
+ .WillOnce((Return(true)));
+ // Act
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(
+ GetInteriorVehicleDataRequestTest,
+ Execute_PolicyValidationFailed_ExpectMessageNotSentToHMI_AndFalseSentToMobile) {
+ // Arrange
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_params =
+ (*mobile_message)[application_manager::strings::msg_params];
+ msg_params[message_params::kModuleType] = module_eType;
+ auto command =
CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
mobile_message);
+ ON_CALL(mock_policy_handler_, CheckModule(_, _)).WillByDefault(Return(false));
+
+ // Expectations
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_apis::Result::DISALLOWED), _))
+ .WillOnce((Return(true)));
+
+ // Act
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(GetInteriorVehicleDataRequestTest,
+ OnEvent_ValidHmiResponse_ExpectSuccessfulResponseSentToMobile_NoCache) {
+ using rc_rpc_plugin::commands::GetInteriorVehicleDataRequest;
+ namespace hmi_response = application_manager::hmi_response;
+ namespace strings = application_manager::strings;
+
+ // Arrange
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ auto& msg_params = (*mobile_message)[strings::msg_params];
+ msg_params[message_params::kModuleType] = module_eType;
+
+ MessageSharedPtr hmi_response_message = CreateBasicMessage();
+ auto& hmi_response_params = (*hmi_response_message)[strings::msg_params];
+ hmi_response_params[hmi_response::code] = hmi_apis::Common_Result::SUCCESS;
+ hmi_response_params[strings::connection_key] = kConnectionKey;
+ hmi_response_params[message_params::kModuleData][message_params::kModuleId] =
+ module_id;
+
+ ON_CALL(mock_interior_data_cache_, Contains(_)).WillByDefault(Return(false));
+ ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
+ .WillByDefault(Return(true));
+
+ // Expectations
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _))
+ .WillOnce(Return(true));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
+ .WillOnce(Return(true));
+
+ // Act
+ auto command = CreateRCCommand<GetInteriorVehicleDataRequest>(mobile_message);
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+ event.set_smart_object(*hmi_response_message);
+ ASSERT_TRUE(command->Init());
+ command->Run();
command->on_event(event);
}
TEST_F(GetInteriorVehicleDataRequestTest,
OnEvent_InvalidHmiResponse_ExpectGenericErrorResponseSentToMobile) {
+ using rc_rpc_plugin::commands::GetInteriorVehicleDataRequest;
+ namespace hmi_response = application_manager::hmi_response;
+ namespace strings = application_manager::strings;
+
// Arrange
MessageSharedPtr mobile_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& msg_params =
+ auto& msg_params =
(*mobile_message)[application_manager::strings::msg_params];
- msg_params[message_params::kModuleType] = mobile_apis::ModuleType::CLIMATE;
+ msg_params[message_params::kModuleType] = module_eType;
MessageSharedPtr hmi_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& hmi_msg_params =
- (*hmi_message)[application_manager::strings::params];
- hmi_apis::Common_Result::eType response_code =
+ auto& hmi_msg_params = (*hmi_message)[strings::params];
+ hmi_msg_params[hmi_response::code] = hmi_apis::Common_Result::READ_ONLY;
+ hmi_msg_params[strings::connection_key] = kConnectionKey;
+ ON_CALL(mock_interior_data_cache_, Contains(_)).WillByDefault(Return(false));
+ ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
+ .WillByDefault(Return(true));
+
+ // Expectations
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR), _))
+ .WillOnce(Return(true));
+
+ // Act
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+ event.set_smart_object(*hmi_message);
+ auto command = CreateRCCommand<GetInteriorVehicleDataRequest>(mobile_message);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ command->on_event(event);
+}
+
+TEST_F(GetInteriorVehicleDataRequestTest,
+ OnEvent_InvalidHmiResponse_DontUnsubscribeLastApp_NoClearCache) {
+ // Arrange
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleType] = module_eType;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleId] = module_id;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kSubscribe] = false;
+ const ModuleUid module(module_type, module_id);
+ MessageSharedPtr hmi_response = CreateBasicMessage();
+ ns_smart_device_link::ns_smart_objects::SmartObject& hmi_msg_params =
+ (*hmi_response)[application_manager::strings::params];
+ hmi_msg_params[application_manager::hmi_response::code] =
hmi_apis::Common_Result::READ_ONLY;
- hmi_msg_params[application_manager::hmi_response::code] = response_code;
hmi_msg_params[application_manager::strings::connection_key] = kConnectionKey;
+
+ apps_.insert(mock_app_);
+ rc_app_extention_->SubscribeToInteriorVehicleData(module);
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
+ ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
+ .WillByDefault(Return(true));
+
+ // Expectations
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
+ .WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR), _))
- .WillOnce(Return(false));
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_interior_data_cache_, Clear()).Times(0);
+
+ // Act
+ auto command =
+ CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
+ mobile_message);
+ ASSERT_TRUE(command->Init());
+ command->Run();
application_manager::event_engine::Event event(
hmi_apis::FunctionID::RC_GetInteriorVehicleData);
- event.set_smart_object(*hmi_message);
- application_manager::SharedPtr<
- rc_rpc_plugin::commands::GetInteriorVehicleDataRequest> command =
+ event.set_smart_object(*hmi_response);
+ command->on_event(event);
+
+ // Assert
+ EXPECT_TRUE(rc_app_extention_->IsSubscribedToInteriorVehicleData(module));
+}
+
+TEST_F(GetInteriorVehicleDataRequestTest,
+ Execute_ExpectRejectDuToRequestLimitation_NoCahce) {
+ // Arrange
+ rc_app_extention_->UnsubscribeFromInteriorVehicleDataOfType(
+ enums_value::kRadio);
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleType] = module_eType;
+ (*mobile_message)[application_manager::strings::msg_params]
+ [message_params::kModuleId] = module_id;
+ smart_objects::SmartObject radio_data;
+ radio_data[message_params::kBand] = enums_value::kAM;
+ auto command =
CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
mobile_message);
+ const ModuleUid module(module_type, module_id);
+ size_t i = 0;
+ for (; i <= max_request_in_time_frame; ++i) {
+ // Expectations
+ EXPECT_CALL(mock_interior_data_manager_,
+ CheckRequestsToHMIFrequency(module))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_interior_data_manager_, StoreRequestToHMITime(module));
+ EXPECT_CALL(mock_interior_data_cache_, Contains(module))
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData),
+ _))
+ .WillRepeatedly(Return(true));
+ // Act
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ }
+
+ // Expectations
+ EXPECT_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(module))
+ .WillOnce(Return(false));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::REJECTED), _))
+ .WillOnce(Return(false));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+
+ // Act
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(GetInteriorVehicleDataRequestTest,
+ OnEvent_ValidHmiResponse_AvailableHDChanelsIsArrayWithHDChanels) {
+ using rc_rpc_plugin::commands::GetInteriorVehicleDataRequest;
+ namespace hmi_response = application_manager::hmi_response;
+ namespace strings = application_manager::strings;
+
+ const uint32_t chanel1_index = 1u;
+ const uint32_t chanel2_index = 2u;
+ const uint32_t chanel3_index = 3u;
+
+ const uint32_t expected_array_length = 3u;
+
+ // Arrange
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+
+ MessageSharedPtr hmi_response_message = CreateBasicMessage();
+ auto& hmi_response_params = (*hmi_response_message)[strings::msg_params];
+ hmi_response_params[hmi_response::code] = hmi_apis::Common_Result::SUCCESS;
+ hmi_response_params[strings::connection_key] = kAppId;
+
+ auto& msg_params = (*hmi_response_message)[strings::msg_params];
+ msg_params[message_params::kModuleType] = module_type;
+
+ auto available_hd_chanels =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ available_hd_chanels[0] = chanel1_index;
+ available_hd_chanels[1] = chanel2_index;
+ available_hd_chanels[2] = chanel3_index;
+
+ msg_params[message_params::kModuleData][message_params::kRadioControlData]
+ [message_params::kAvailableHdChannels] = available_hd_chanels;
+
+ ON_CALL(mock_interior_data_cache_, Contains(_)).WillByDefault(Return(false));
+ ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
+ .WillByDefault(Return(true));
+
+ MessageSharedPtr message_to_mob = CreateBasicMessage();
+
+ // Expectations
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mob), Return(true)));
+
+ // Act
+ auto command = CreateRCCommand<GetInteriorVehicleDataRequest>(mobile_message);
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ event.set_smart_object(*hmi_response_message);
command->on_event(event);
+
+ auto& hd_chanels =
+ (*message_to_mob)[strings::msg_params][message_params::kModuleData]
+ [message_params::kRadioControlData]
+ [message_params::kAvailableHdChannels];
+ const size_t array_length = hd_chanels.length();
+
+ EXPECT_EQ(expected_array_length, array_length);
+
+ EXPECT_EQ(chanel1_index, hd_chanels[0].asUInt());
+ EXPECT_EQ(chanel2_index, hd_chanels[1].asUInt());
+ EXPECT_EQ(chanel3_index, hd_chanels[2].asUInt());
}
+
+TEST_F(GetInteriorVehicleDataRequestTest,
+ OnEvent_ValidHmiResponse_ClimateEnableAvailable) {
+ using rc_rpc_plugin::commands::GetInteriorVehicleDataRequest;
+ namespace hmi_response = application_manager::hmi_response;
+ namespace strings = application_manager::strings;
+
+ // Arrange
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+
+ MessageSharedPtr hmi_response_message = CreateBasicMessage();
+ auto& hmi_response_params = (*hmi_response_message)[strings::msg_params];
+ hmi_response_params[hmi_response::code] = hmi_apis::Common_Result::SUCCESS;
+ hmi_response_params[strings::connection_key] = kAppId;
+
+ auto& msg_params = (*hmi_response_message)[strings::msg_params];
+
+ auto climate_control_data =
+ smart_objects::SmartObject(smart_objects::SmartType_Boolean);
+ climate_control_data = true;
+
+ msg_params[message_params::kModuleData][message_params::kClimateControlData]
+ [message_params::kClimateEnableAvailable] = climate_control_data;
+
+ ON_CALL(mock_interior_data_cache_, Contains(_)).WillByDefault(Return(false));
+ ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
+ .WillByDefault(Return(true));
+
+ auto message_to_mob = CreateBasicMessage();
+
+ // Expectations
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mob), Return(true)));
+
+ // Act
+ auto command = CreateRCCommand<GetInteriorVehicleDataRequest>(mobile_message);
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ event.set_smart_object(*hmi_response_message);
+ command->on_event(event);
+
+ const bool climate_enable_available =
+ (*message_to_mob)[strings::msg_params][message_params::kModuleData]
+ [message_params::kClimateControlData]
+ [message_params::kClimateEnableAvailable]
+ .asBool();
+
+ EXPECT_TRUE(climate_enable_available);
+}
+
} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc
index 78d20c6b13..d6771c534d 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc
@@ -30,33 +30,40 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application.h"
#include "application_manager/commands/commands_test.h"
-#include "rc_rpc_plugin/commands/mobile/on_interior_vehicle_data_notification.h"
-#include "rc_rpc_plugin/rc_rpc_plugin.h"
-#include "rc_rpc_plugin/rc_module_constants.h"
-#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
+#include "application_manager/mock_application.h"
#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_cache.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_capabilities_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_consent_manager.h"
+#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
-using ::testing::_;
-using ::testing::Return;
-using ::testing::NiceMock;
-using ::testing::SaveArg;
-using ::testing::Mock;
using application_manager::ApplicationSet;
using application_manager::commands::MessageSharedPtr;
using test::components::application_manager_test::MockApplication;
using test::components::application_manager_test::MockApplicationManager;
using test::components::commands_test::CommandsTest;
using test::components::commands_test::CommandsTestMocks;
+using ::testing::_;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::SaveArg;
namespace {
const uint32_t kAppId = 0u;
const uint32_t kConnectionKey = 1u;
const std::string kPolicyAppId = "Test";
-}
+const std::string module_type = "CLIMATE";
+const std::string module_id = "34045662-a9dc-4823-8435-91056d4c26cb";
+const int kModuleId = 153u;
+} // namespace
namespace rc_rpc_plugin_test {
using namespace rc_rpc_plugin;
@@ -66,74 +73,91 @@ class OnInteriorVehicleDataNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
OnInteriorVehicleDataNotificationTest()
- : mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) {}
+ : mock_app_(std::make_shared<NiceMock<MockApplication> >())
+ , rc_app_extention_(std::make_shared<RCAppExtension>(kModuleId))
+ , apps_lock_(std::make_shared<sync_primitives::Lock>())
+ , apps_da_(apps_, apps_lock_) {
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app_, is_remote_control_supported())
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, QueryInterface(_))
+ .WillByDefault(Return(rc_app_extention_));
+ }
MessageSharedPtr CreateBasicMessage() {
MessageSharedPtr message = CreateMessage();
(*message)[application_manager::strings::params]
[application_manager::strings::function_id] =
- mobile_apis::FunctionID::SetInteriorVehicleDataID;
+ mobile_apis::FunctionID::OnInteriorVehicleDataID;
(*message)[application_manager::strings::params]
[application_manager::strings::connection_key] = kConnectionKey;
(*message)[application_manager::strings::params]
- [application_manager::strings::connection_key] = kAppId;
+ [application_manager::strings::app_id] = kAppId;
smart_objects::SmartObject& msg_param =
(*message)[application_manager::strings::msg_params];
- msg_param[message_params::kModuleType] = mobile_apis::ModuleType::CLIMATE;
-
+ msg_param[message_params::kModuleData][message_params::kModuleType] =
+ mobile_apis::ModuleType::CLIMATE;
+ msg_param[message_params::kModuleData][message_params::kModuleId] =
+ module_id;
return message;
}
template <class Command>
- application_manager::SharedPtr<Command> CreateRCCommand(
- MessageSharedPtr& msg) {
+ std::shared_ptr<Command> CreateRCCommand(MessageSharedPtr& msg) {
InitCommand(kDefaultTimeout_);
- return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(),
- app_mngr_,
- mock_rpc_service_,
- mock_hmi_capabilities_,
- mock_policy_handler_,
- mock_allocation_manager_);
+ RCCommandParams params{app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_,
+ mock_allocation_manager_,
+ mock_interior_data_cache_,
+ mock_interior_data_manager_,
+ mock_rc_capabilities_manager_,
+ mock_rc_consent_manger_};
+ return ::std::make_shared<Command>(msg ? msg : msg = CreateMessage(),
+ params);
}
protected:
- utils::SharedPtr<MockApplication> mock_app_;
+ std::shared_ptr<MockApplication> mock_app_;
+ std::shared_ptr<RCAppExtension> rc_app_extention_;
testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager>
mock_allocation_manager_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataCache>
+ mock_interior_data_cache_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataManager>
+ mock_interior_data_manager_;
+ application_manager::ApplicationSet apps_;
+ const std::shared_ptr<sync_primitives::Lock> apps_lock_;
+ DataAccessor<application_manager::ApplicationSet> apps_da_;
+ testing::NiceMock<rc_rpc_plugin_test::MockRCCapabilitiesManager>
+ mock_rc_capabilities_manager_;
+ testing::NiceMock<MockRCConsentManager> mock_rc_consent_manger_;
};
TEST_F(OnInteriorVehicleDataNotificationTest,
Run_SendMessageToMobile_Notification) {
// Arrange
MessageSharedPtr mobile_message = CreateBasicMessage();
- ApplicationSet app_set = {mock_app_};
- MessageSharedPtr message;
- std::shared_ptr<sync_primitives::Lock> apps_lock =
- std::make_shared<sync_primitives::Lock>();
- DataAccessor<ApplicationSet> accessor(app_set, apps_lock);
- // Expectations
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
-
- RCAppExtensionPtr rc_extention_ptr =
- utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
- rc_extention_ptr->SubscribeToInteriorVehicleData(enums_value::kClimate);
- ON_CALL(*mock_app_, QueryInterface(_))
- .WillByDefault(Return(rc_extention_ptr));
- ON_CALL(*mock_app_, is_remote_control_supported())
- .WillByDefault(Return(true));
+ apps_.insert(mock_app_);
+ const ModuleUid module(module_type, module_id);
+ rc_app_extention_->SubscribeToInteriorVehicleData(module);
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da_));
+ // Expectations
+ EXPECT_CALL(mock_interior_data_cache_, Add(module, _));
+ MessageSharedPtr message;
EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false))
.WillOnce(SaveArg<0>(&message));
// Act
- application_manager::SharedPtr<
- rc_rpc_plugin::commands::OnInteriorVehicleDataNotification> command =
- CreateRCCommand<
+ std::shared_ptr<rc_rpc_plugin::commands::OnInteriorVehicleDataNotification>
+ command = CreateRCCommand<
rc_rpc_plugin::commands::OnInteriorVehicleDataNotification>(
mobile_message);
command->Run();
+
// Assertions
- ASSERT_TRUE(message);
+ ASSERT_TRUE(message.get());
Mock::VerifyAndClearExpectations(&app_mngr_);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
index f3ac768a4e..62b726ac60 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc
@@ -32,32 +32,36 @@
#include "application_manager/application.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application.h"
#include "application_manager/commands/commands_test.h"
-#include "rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h"
-#include "rc_rpc_plugin/rc_rpc_plugin.h"
-#include "rc_rpc_plugin/rc_module_constants.h"
-#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
+#include "application_manager/mock_application.h"
#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
+#include "rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_cache.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_capabilities_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_consent_manager.h"
+#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
-using ::testing::_;
-using ::testing::Return;
-using ::testing::NiceMock;
-using ::testing::SaveArg;
-using ::testing::Mock;
using application_manager::ApplicationSet;
using application_manager::commands::MessageSharedPtr;
using test::components::application_manager_test::MockApplication;
using test::components::application_manager_test::MockApplicationManager;
using test::components::commands_test::CommandsTest;
using test::components::commands_test::CommandsTestMocks;
+using ::testing::_;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::SaveArg;
namespace {
const uint32_t kAppId = 0u;
const uint32_t kConnectionKey = 1u;
const std::string kPolicyAppId = "Test";
-}
+} // namespace
namespace rc_rpc_plugin_test {
using namespace rc_rpc_plugin;
@@ -67,7 +71,7 @@ class RCOnRemoteControlSettingsNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
RCOnRemoteControlSettingsNotificationTest()
- : mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) {}
+ : mock_app_(std::make_shared<NiceMock<MockApplication> >()) {}
MessageSharedPtr CreateBasicMessage() {
MessageSharedPtr message = CreateMessage();
(*message)[application_manager::strings::params]
@@ -85,21 +89,31 @@ class RCOnRemoteControlSettingsNotificationTest
}
template <class Command>
- application_manager::SharedPtr<Command> CreateRCCommand(
- MessageSharedPtr& msg) {
+ std::shared_ptr<Command> CreateRCCommand(MessageSharedPtr& msg) {
InitCommand(kDefaultTimeout_);
- return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(),
- app_mngr_,
- mock_rpc_service_,
- mock_hmi_capabilities_,
- mock_policy_handler_,
- mock_allocation_manager_);
+ RCCommandParams params{app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_,
+ mock_allocation_manager_,
+ mock_interior_data_cache_,
+ mock_interior_data_manager_,
+ mock_rc_capabilities_manager_,
+ mock_rc_consent_manger_};
+ return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), params);
}
protected:
- utils::SharedPtr<MockApplication> mock_app_;
+ std::shared_ptr<MockApplication> mock_app_;
testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager>
mock_allocation_manager_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataCache>
+ mock_interior_data_cache_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataManager>
+ mock_interior_data_manager_;
+ testing::NiceMock<rc_rpc_plugin_test::MockRCCapabilitiesManager>
+ mock_rc_capabilities_manager_;
+ testing::NiceMock<MockRCConsentManager> mock_rc_consent_manger_;
};
TEST_F(RCOnRemoteControlSettingsNotificationTest,
@@ -116,9 +130,9 @@ TEST_F(RCOnRemoteControlSettingsNotificationTest,
EXPECT_CALL(mock_allocation_manager_,
SetAccessMode(hmi_apis::Common_RCAccessMode::ASK_DRIVER));
// Act
- application_manager::SharedPtr<
- rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification> command =
- CreateRCCommand<
+ std::shared_ptr<
+ rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>
+ command = CreateRCCommand<
rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>(
mobile_message);
@@ -132,27 +146,14 @@ TEST_F(RCOnRemoteControlSettingsNotificationTest,
(*mobile_message)[application_manager::strings::msg_params]
[message_params::kAllowed] = false;
- ApplicationSet app_set = {mock_app_};
-
- std::shared_ptr<sync_primitives::Lock> apps_lock =
- std::make_shared<sync_primitives::Lock>();
- DataAccessor<ApplicationSet> accessor(app_set, apps_lock);
- // Expectations
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
-
- RCAppExtensionPtr rc_extention_ptr =
- utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
- rc_extention_ptr->SubscribeToInteriorVehicleData(enums_value::kClimate);
- ON_CALL(*mock_app_, QueryInterface(_))
- .WillByDefault(Return(rc_extention_ptr));
-
EXPECT_CALL(mock_allocation_manager_, ResetAllAllocations());
+ EXPECT_CALL(mock_interior_data_manager_, OnDisablingRC());
+ EXPECT_CALL(mock_rc_consent_manger_, RemoveAllConsents());
// Act
- application_manager::SharedPtr<
- rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification> command =
- CreateRCCommand<
+ std::shared_ptr<
+ rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>
+ command = CreateRCCommand<
rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>(
mobile_message);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc
index 8fad1aef60..55be43f37b 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc
@@ -31,59 +31,61 @@
*/
#include "application_manager/application.h"
-#include "application_manager/mock_application.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/rpc_service_impl.h"
-#include "application_manager/mock_request_controller_settings.h"
#include "application_manager/include/application_manager/command_holder_impl.h"
-#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/request_controller.h"
-#include "application_manager/mock_rpc_plugin_manager.h"
-#include "application_manager/mock_rpc_plugin.h"
+#include "application_manager/message.h"
+#include "application_manager/mock_application.h"
#include "application_manager/mock_command_factory.h"
#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/message.h"
-#include "rc_rpc_plugin/rc_rpc_plugin.h"
-#include "rc_rpc_plugin/rc_module_constants.h"
-#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
-#include "rc_rpc_plugin/commands/mobile/button_press_request.h"
-#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_response.h"
-#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_request.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_request_controller_settings.h"
+#include "application_manager/mock_rpc_plugin.h"
+#include "application_manager/mock_rpc_plugin_manager.h"
+#include "application_manager/mock_rpc_protection_manager.h"
+#include "application_manager/request_controller.h"
+#include "application_manager/rpc_service_impl.h"
#include "hmi_message_handler/mock_hmi_message_handler.h"
-#include "interfaces/MOBILE_API.h"
#include "include/test/protocol_handler/mock_protocol_handler.h"
+#include "interfaces/MOBILE_API.h"
+#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_request.h"
+#include "rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_consent_response.h"
+#include "rc_rpc_plugin/commands/mobile/button_press_request.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_cache.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_capabilities_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_consent_manager.h"
+#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
#include "test/application_manager/mock_application_manager_settings.h"
-#include "utils/make_shared.h"
using ::testing::_;
+using ::testing::Mock;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
using ::testing::SaveArg;
-using ::testing::Mock;
-using ::testing::NiceMock;
-using ::utils::SharedPtr;
namespace am = ::application_manager;
using am::ApplicationSet;
-using am::commands::MessageSharedPtr;
using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using am::plugin_manager::MockRPCPlugin;
+using am::plugin_manager::MockRPCPluginManager;
using am::plugin_manager::RPCPlugin;
-using ::smart_objects::SmartObject;
+using rc_rpc_plugin::RCRPCPlugin;
using rc_rpc_plugin::commands::ButtonPressRequest;
-using rc_rpc_plugin::commands::RCGetInteriorVehicleDataConsentResponse;
using rc_rpc_plugin::commands::RCGetInteriorVehicleDataConsentRequest;
-using rc_rpc_plugin::RCRPCPlugin;
-using test::components::commands_test::CommandsTestMocks;
-using test::components::commands_test::CommandRequestTest;
-using am::plugin_manager::MockRPCPluginManager;
-using am::plugin_manager::MockRPCPlugin;
+using rc_rpc_plugin::commands::RCGetInteriorVehicleDataConsentResponse;
+using ::smart_objects::SmartObject;
using test::components::application_manager_test::MockApplication;
+using test::components::application_manager_test::MockCommandFactory;
+using test::components::application_manager_test::MockHMICapabilities;
using test::components::application_manager_test::MockRequestControlerSettings;
-using test::components::protocol_handler_test::MockProtocolHandler;
+using test::components::commands_test::CommandRequestTest;
+using test::components::commands_test::CommandsTestMocks;
using test::components::hmi_message_handler_test::MockHMIMessageHandler;
-using test::components::application_manager_test::MockHMICapabilities;
-using test::components::application_manager_test::MockCommandFactory;
using test::components::policy_test::MockPolicyHandlerInterface;
+using test::components::protocol_handler_test::MockProtocolHandler;
namespace rc_rpc_plugin_test {
using namespace rc_rpc_plugin;
@@ -92,6 +94,9 @@ namespace {
const uint32_t kConnectionKey = 2u;
const uint32_t kAppId = 5u;
const std::string kResource = "CLIMATE";
+const std::string kResourceId = "34045662-a9dc-4823-8435-91056d4c26cb";
+const std::string kPolicyAppId = "policy_app_id";
+const std::string kMacAddress = "device1";
const uint32_t kPluginID = RCRPCPlugin::kRCPluginID;
} // namespace
@@ -99,19 +104,27 @@ class RCGetInteriorVehicleDataConsentTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
RCGetInteriorVehicleDataConsentTest()
- : mock_app_(utils::MakeShared<NiceMock<MockApplication> >())
+ : mock_app_(std::make_shared<NiceMock<MockApplication> >())
, command_holder(app_mngr_)
+ , rc_capabilities_(smart_objects::SmartType::SmartType_Array)
, request_controller(mock_request_controler)
- , rpc_service(app_mngr_,
- request_controller,
- &mock_protocol_handler,
- &mock_hmi_handler,
- command_holder)
- , rc_app_extention_(utils::MakeShared<RCAppExtension>(kPluginID))
+ , rpc_protection_manager_(
+ std::make_shared<application_manager::MockRPCProtectionManager>())
+ , rpc_service_(app_mngr_,
+ request_controller,
+ &mock_protocol_handler,
+ &mock_hmi_handler,
+ command_holder,
+ rpc_protection_manager_,
+ hmi_so_factory_,
+ mobile_so_factoy_)
+ , rc_app_extention_(std::make_shared<RCAppExtension>(kPluginID))
, mock_rpc_plugin_manager(
- utils::MakeShared<NiceMock<MockRPCPluginManager> >())
+ std::make_shared<NiceMock<MockRPCPluginManager> >())
, rpc_plugin(mock_rpc_plugin)
, optional_mock_rpc_plugin(mock_rpc_plugin) {
+ smart_objects::SmartObject control_caps((smart_objects::SmartType_Array));
+ rc_capabilities_[strings::kradioControlCapabilities] = control_caps;
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
ON_CALL(app_mngr_, hmi_interfaces())
.WillByDefault(ReturnRef(mock_hmi_interfaces_));
@@ -121,8 +134,10 @@ class RCGetInteriorVehicleDataConsentTest
.WillByDefault(Return(application_manager::HmiInterfaces::
InterfaceState::STATE_AVAILABLE));
ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
- ON_CALL(mock_allocation_manager_, GetApplicationExtention(_))
+ ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID))
.WillByDefault(Return(rc_app_extention_));
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataCache>
+ mock_interior_data_cache_;
ON_CALL(app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(mock_policy_handler_));
ON_CALL(app_mngr_, hmi_capabilities())
@@ -139,20 +154,31 @@ class RCGetInteriorVehicleDataConsentTest
.WillByDefault(ReturnRef(*mock_rpc_plugin_manager));
ON_CALL(*mock_rpc_plugin_manager, FindPluginToProcess(_, _))
.WillByDefault(Return(rpc_plugin));
- ON_CALL(mock_allocation_manager_, IsResourceFree(kResource))
+ ON_CALL(mock_allocation_manager_, IsResourceFree(kResource, kResourceId))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_allocation_manager_, is_rc_enabled())
+ .WillByDefault(Return(true));
+ ON_CALL(mock_protocol_handler, IsRPCServiceSecure(_))
+ .WillByDefault(Return(false));
+ ON_CALL(*rpc_protection_manager_, CheckPolicyEncryptionFlag(_, _, _))
+ .WillByDefault(Return(false));
+ ON_CALL(mock_rc_capabilities_manager_, CheckIfModuleExistsInCapabilities(_))
.WillByDefault(Return(true));
}
template <class Command>
- application_manager::SharedPtr<Command> CreateRCCommand(
- MessageSharedPtr& msg) {
+ std::shared_ptr<Command> CreateRCCommand(MessageSharedPtr& msg) {
InitCommand(kDefaultTimeout_);
- return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(),
- app_mngr_,
- rpc_service,
- mock_hmi_capabilities_,
- mock_policy_handler_,
- mock_allocation_manager_);
+ RCCommandParams params{app_mngr_,
+ rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_,
+ mock_allocation_manager_,
+ mock_interior_data_cache_,
+ mock_interior_data_manager_,
+ mock_rc_capabilities_manager_,
+ mock_rc_consent_manger_};
+ return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), params);
}
MessageSharedPtr CreateBasicMessage() {
@@ -164,27 +190,42 @@ class RCGetInteriorVehicleDataConsentTest
[application_manager::strings::connection_key] = kConnectionKey;
(*message)[application_manager::strings::params]
[application_manager::strings::connection_key] = kAppId;
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_params =
+ (*message)[application_manager::strings::msg_params];
+ msg_params[message_params::kModuleType] = kResource;
+ msg_params[message_params::kModuleId] = kResourceId;
return message;
}
protected:
- utils::SharedPtr<MockApplication> mock_app_;
+ std::shared_ptr<MockApplication> mock_app_;
MockRequestControlerSettings mock_request_controler;
MockProtocolHandler mock_protocol_handler;
MockHMIMessageHandler mock_hmi_handler;
am::CommandHolderImpl command_holder;
testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager>
mock_allocation_manager_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataCache>
+ mock_interior_data_cache_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataManager>
+ mock_interior_data_manager_;
smart_objects::SmartObject rc_capabilities_;
MockRPCPlugin mock_rpc_plugin;
MockCommandFactory mock_command_factory;
am::request_controller::RequestController request_controller;
- am::rpc_service::RPCServiceImpl rpc_service;
- utils::SharedPtr<RCAppExtension> rc_app_extention_;
- utils::SharedPtr<am::plugin_manager::MockRPCPluginManager>
+ std::shared_ptr<application_manager::MockRPCProtectionManager>
+ rpc_protection_manager_;
+ am::rpc_service::RPCServiceImpl rpc_service_;
+ std::shared_ptr<RCAppExtension> rc_app_extention_;
+ std::shared_ptr<am::plugin_manager::MockRPCPluginManager>
mock_rpc_plugin_manager;
utils::Optional<RPCPlugin> rpc_plugin;
utils::Optional<MockRPCPlugin> optional_mock_rpc_plugin;
+ hmi_apis::HMI_API hmi_so_factory_;
+ mobile_apis::MOBILE_API mobile_so_factoy_;
+ testing::NiceMock<rc_rpc_plugin_test::MockRCCapabilitiesManager>
+ mock_rc_capabilities_manager_;
+ testing::NiceMock<MockRCConsentManager> mock_rc_consent_manger_;
};
TEST_F(RCGetInteriorVehicleDataConsentTest,
@@ -193,8 +234,17 @@ TEST_F(RCGetInteriorVehicleDataConsentTest,
auto mobile_message = CreateBasicMessage();
// Expectations
- EXPECT_CALL(mock_allocation_manager_, AcquireResource(_, _))
+ EXPECT_CALL(mock_allocation_manager_, AcquireResource(_, _, _))
.WillOnce(Return(rc_rpc_plugin::AcquireResult::ASK_DRIVER));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
+ ON_CALL(*mock_app_, mac_address()).WillByDefault(ReturnRef(kMacAddress));
+
+ rc_rpc_types::ModuleUid moduleUid{kResource, kResourceId};
+ EXPECT_CALL(mock_rc_consent_manger_,
+ GetModuleConsent(kPolicyAppId, _, moduleUid))
+ .WillOnce(Return(rc_rpc_types::ModuleConsent::NOT_EXISTS));
+
EXPECT_CALL(*optional_mock_rpc_plugin, GetCommandFactory())
.WillOnce(ReturnRef(mock_command_factory));
auto rc_consent_request =
@@ -215,15 +265,17 @@ TEST_F(RCGetInteriorVehicleDataConsentTest,
TEST_F(RCGetInteriorVehicleDataConsentTest,
Run_MobileSendButtonPressMessage_HMISendINUSEModeToMobile) {
- // Arrange
- auto mobile_message = CreateBasicMessage();
-
// Expectations
- EXPECT_CALL(mock_allocation_manager_, AcquireResource(_, _))
+ EXPECT_CALL(mock_allocation_manager_, AcquireResource(_, _, _))
.WillOnce(Return(rc_rpc_plugin::AcquireResult::IN_USE));
+ auto msg_ver = utils::SemanticVersion();
+ ON_CALL(*mock_app_, msg_version()).WillByDefault(ReturnRef(msg_ver));
+
EXPECT_CALL(*optional_mock_rpc_plugin, GetCommandFactory())
.WillOnce(ReturnRef(mock_command_factory));
+
+ auto mobile_message = CreateBasicMessage();
auto rc_consent_response =
CreateRCCommand<commands::RCGetInteriorVehicleDataConsentResponse>(
mobile_message);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/release_interior_vehicle_data_module_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/release_interior_vehicle_data_module_request_test.cc
new file mode 100644
index 0000000000..200e458c17
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/release_interior_vehicle_data_module_request_test.cc
@@ -0,0 +1,243 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <memory>
+#include <string>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "rc_rpc_plugin/commands/mobile/release_interior_vehicle_data_module_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/mock_application.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_cache.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_capabilities_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_consent_manager.h"
+#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+
+using application_manager::commands::MessageSharedPtr;
+using rc_rpc_plugin_test::MockInteriorDataCache;
+using rc_rpc_plugin_test::MockInteriorDataManager;
+using rc_rpc_plugin_test::MockRCCapabilitiesManager;
+using rc_rpc_plugin_test::MockRCConsentManager;
+using rc_rpc_plugin_test::MockResourceAllocationManager;
+using test::components::application_manager_test::MockApplication;
+using test::components::commands_test::CommandRequestTest;
+using test::components::commands_test::CommandsTestMocks;
+
+using testing::_;
+using ::testing::DoAll;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::SaveArg;
+
+typedef std::shared_ptr<
+ rc_rpc_plugin::commands::ReleaseInteriorVehicleDataModuleRequest>
+ ReleaseCommandPtr;
+
+namespace {
+std::string kPolicyAppID = "app_id";
+std::uint32_t kAppID = 2u;
+std::uint32_t kConnectionKey = 1u;
+std::string kModuleType = "RADIO";
+std::string kModuleID = "76149d9b-5317-4cf5-9196-b8fac690fec5";
+std::string kDefaultModuleID = "eb7739ea-b263-4fe1-af9c-9311d1acac2d";
+} // namespace
+
+namespace rc_rpc_plugin_test {
+namespace release_interior_vehicle_data_module_request {
+using namespace rc_rpc_plugin;
+
+class ReleaseInteriorVehicleDataModuleRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ ReleaseInteriorVehicleDataModuleRequestTest() : mock_app_(CreateMockApp()) {}
+
+ void SetUp() OVERRIDE {
+ TestPreCondition();
+ ON_CALL(app_mngr_, application(kAppID)).WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppID));
+ ON_CALL(mock_rc_capabilities_manager_,
+ GetDefaultModuleIdFromCapabilities(kModuleType))
+ .WillByDefault(Return(kDefaultModuleID));
+ }
+
+ MessageSharedPtr CreateBasicMessage() {
+ MessageSharedPtr message = CreateMessage();
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::function_id] =
+ mobile_apis::FunctionID::ReleaseInteriorVehicleDataModuleID;
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::connection_key] = kConnectionKey;
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::connection_key] = kAppID;
+ (*message)[application_manager::strings::msg_params]
+ [message_params::kModuleType] = mobile_apis::ModuleType::RADIO;
+ (*message)[application_manager::strings::msg_params]
+ [message_params::kModuleId] = kModuleID;
+ return message;
+ }
+
+ void TestPreCondition() {
+ message_ = CreateBasicMessage();
+ command_ =
+ CreateRCCommand<commands::ReleaseInteriorVehicleDataModuleRequest>(
+ message_);
+ }
+
+ template <class Command>
+ std::shared_ptr<Command> CreateRCCommand(MessageSharedPtr& msg) {
+ InitCommand(kDefaultTimeout_);
+ RCCommandParams params{app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_,
+ mock_allocation_manager_,
+ mock_interior_data_cache_,
+ mock_interior_data_manager_,
+ mock_rc_capabilities_manager_,
+ mock_rc_consent_manger_};
+ return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), params);
+ }
+
+ protected:
+ MessageSharedPtr message_;
+ ReleaseCommandPtr command_;
+
+ MockAppPtr mock_app_;
+ NiceMock<MockResourceAllocationManager> mock_allocation_manager_;
+ MockInteriorDataCache mock_interior_data_cache_;
+ MockInteriorDataManager mock_interior_data_manager_;
+ NiceMock<MockRCCapabilitiesManager> mock_rc_capabilities_manager_;
+ MockRCConsentManager mock_rc_consent_manger_;
+};
+
+TEST_F(ReleaseInteriorVehicleDataModuleRequestTest,
+ ModuleIDIsAbsnetInMessage_ReturnsDefaultFromCapabilities) {
+ (*message_)[application_manager::strings::msg_params].erase(
+ message_params::kModuleId);
+
+ auto module_id = command_->ModuleId();
+ EXPECT_EQ(kDefaultModuleID, module_id);
+}
+
+TEST_F(ReleaseInteriorVehicleDataModuleRequestTest,
+ ResourceIsNotAllocated_ResponseToMobile_UNSUCCESS_IGNORED) {
+ ON_CALL(mock_allocation_manager_,
+ ReleaseResource(kModuleType, kModuleID, kAppID))
+ .WillByDefault(Return(ResourceReleasedState::eType::NOT_ALLOCATED));
+
+ MessageSharedPtr message_to_mobile = CreateMessage();
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ _, application_manager::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+
+ command_->Execute();
+
+ const bool success =
+ (*message_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::success]
+ .asBool();
+ auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*message_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::result_code]
+ .asUInt());
+
+ EXPECT_FALSE(success);
+ EXPECT_EQ(mobile_apis::Result::eType::IGNORED, result_code);
+}
+
+TEST_F(ReleaseInteriorVehicleDataModuleRequestTest,
+ ResourceIsAllocated_ResponseToMobile_UNSUCCESS_REJECTED) {
+ ON_CALL(mock_allocation_manager_,
+ ReleaseResource(kModuleType, kModuleID, kAppID))
+ .WillByDefault(Return(ResourceReleasedState::eType::IS_ALLOCATED));
+ MessageSharedPtr message_to_mobile = CreateMessage();
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ _, application_manager::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+
+ command_->Execute();
+
+ const bool success =
+ (*message_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::success]
+ .asBool();
+ auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*message_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::result_code]
+ .asUInt());
+
+ EXPECT_FALSE(success);
+ EXPECT_EQ(mobile_apis::Result::eType::REJECTED, result_code);
+}
+
+TEST_F(ReleaseInteriorVehicleDataModuleRequestTest,
+ ResourceIsReleased_ResponseToMobile_SUCCESS_SUCCESS) {
+ ON_CALL(mock_allocation_manager_,
+ ReleaseResource(kModuleType, kModuleID, kAppID))
+ .WillByDefault(Return(ResourceReleasedState::eType::IS_RELEASED));
+
+ MessageSharedPtr message_to_mobile = CreateMessage();
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ _, application_manager::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+
+ command_->Execute();
+
+ const bool success =
+ (*message_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::success]
+ .asBool();
+ auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*message_to_mobile)[application_manager::strings::msg_params]
+ [application_manager::strings::result_code]
+ .asUInt());
+
+ EXPECT_TRUE(success);
+ EXPECT_EQ(mobile_apis::Result::eType::SUCCESS, result_code);
+}
+} // namespace release_interior_vehicle_data_module_request
+} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
index 68985e5f94..5a822a2fe4 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
@@ -30,32 +30,40 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h"
#include "application_manager/application.h"
#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application.h"
-#include "rc_rpc_plugin/commands/mobile/set_interior_vehicle_data_request.h"
-#include "rc_rpc_plugin/rc_rpc_plugin.h"
-#include "rc_rpc_plugin/rc_module_constants.h"
+#include "interfaces/MOBILE_API.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_cache.h"
+#include "rc_rpc_plugin/mock/mock_interior_data_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_capabilities_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_consent_manager.h"
#include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
+
+#include <stdint.h>
#include "gtest/gtest.h"
-#include "interfaces/MOBILE_API.h"
-using ::testing::_;
-using ::testing::Return;
-using ::testing::NiceMock;
using application_manager::ApplicationSet;
using application_manager::commands::MessageSharedPtr;
using test::components::application_manager_test::MockApplication;
using test::components::application_manager_test::MockApplicationManager;
using test::components::commands_test::CommandRequestTest;
using test::components::commands_test::CommandsTestMocks;
+using test::components::commands_test::HMIResultCodeIs;
+using ::testing::_;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::SaveArg;
namespace {
const uint32_t kAppId = 0u;
const int kModuleId = 153u;
const uint32_t kConnectionKey = 1u;
const std::string kPolicyAppId = "Test";
-}
+} // namespace
namespace rc_rpc_plugin_test {
using namespace rc_rpc_plugin;
@@ -64,10 +72,13 @@ class SetInteriorVehicleDataRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
SetInteriorVehicleDataRequestTest()
- : mock_app_(utils::MakeShared<NiceMock<MockApplication> >())
- , rc_app_extention_(utils::MakeShared<RCAppExtension>(kModuleId)) {}
+ : mock_app_(std::make_shared<NiceMock<MockApplication> >())
+ , rc_app_extention_(std::make_shared<RCAppExtension>(kModuleId))
+ , rc_capabilities_(smart_objects::SmartType::SmartType_Array) {}
void SetUp() OVERRIDE {
+ smart_objects::SmartObject control_caps((smart_objects::SmartType_Array));
+ rc_capabilities_[strings::kradioControlCapabilities] = control_caps;
ON_CALL(app_mngr_, hmi_interfaces())
.WillByDefault(ReturnRef(mock_hmi_interfaces_));
ON_CALL(
@@ -76,19 +87,28 @@ class SetInteriorVehicleDataRequestTest
.WillByDefault(Return(application_manager::HmiInterfaces::
InterfaceState::STATE_AVAILABLE));
ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
- ON_CALL(mock_allocation_manager_, GetApplicationExtention(_))
+ ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID))
.WillByDefault(Return(rc_app_extention_));
ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
- ON_CALL(mock_allocation_manager_, IsResourceFree(_))
+ ON_CALL(mock_allocation_manager_, IsResourceFree(_, _))
.WillByDefault(Return(true));
- ON_CALL(mock_allocation_manager_, AcquireResource(_, _))
+ ON_CALL(mock_allocation_manager_, AcquireResource(_, _, _))
.WillByDefault(Return(AcquireResult::ALLOWED));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
ON_CALL(mock_policy_handler_,
CheckHMIType(kPolicyAppId,
mobile_apis::AppHMIType::eType::REMOTE_CONTROL,
- nullptr)).WillByDefault(Return(true));
+ nullptr))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_hmi_capabilities_, rc_capability())
+ .WillByDefault(Return(&rc_capabilities_));
+ ON_CALL(mock_allocation_manager_, is_rc_enabled())
+ .WillByDefault(Return(true));
+ ON_CALL(mock_rc_capabilities_manager_, CheckIfModuleExistsInCapabilities(_))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_rc_capabilities_manager_, GetModuleDataCapabilities(_, _))
+ .WillByDefault(Return(std::make_pair("", capabilitiesStatus::success)));
}
MessageSharedPtr CreateBasicMessage() {
@@ -104,51 +124,62 @@ class SetInteriorVehicleDataRequestTest
}
template <class Command>
- application_manager::SharedPtr<Command> CreateRCCommand(
- MessageSharedPtr& msg) {
+ std::shared_ptr<Command> CreateRCCommand(MessageSharedPtr& msg) {
InitCommand(kDefaultTimeout_);
- return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(),
- app_mngr_,
- mock_rpc_service_,
- mock_hmi_capabilities_,
- mock_policy_handler_,
- mock_allocation_manager_);
+ RCCommandParams params{app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_,
+ mock_allocation_manager_,
+ mock_interior_data_cache_,
+ mock_interior_data_manager_,
+ mock_rc_capabilities_manager_,
+ mock_rc_consent_manger_};
+ return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), params);
}
protected:
testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager>
mock_allocation_manager_;
- utils::SharedPtr<MockApplication> mock_app_;
- utils::SharedPtr<RCAppExtension> rc_app_extention_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataCache>
+ mock_interior_data_cache_;
+ testing::NiceMock<rc_rpc_plugin_test::MockInteriorDataManager>
+ mock_interior_data_manager_;
+ std::shared_ptr<MockApplication> mock_app_;
+ std::shared_ptr<RCAppExtension> rc_app_extention_;
+ testing::NiceMock<rc_rpc_plugin_test::MockRCCapabilitiesManager>
+ mock_rc_capabilities_manager_;
+ smart_objects::SmartObject rc_capabilities_;
+ testing::NiceMock<MockRCConsentManager> mock_rc_consent_manger_;
};
TEST_F(SetInteriorVehicleDataRequestTest,
Execute_ValidWithoutReadOnlyParams_ExpectResendToHMI) {
// Arrange
MessageSharedPtr mobile_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& msg_params =
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_params =
(*mobile_message)[application_manager::strings::msg_params];
msg_params[message_params::kModuleData][message_params::kModuleType] =
mobile_apis::ModuleType::CLIMATE;
+ smart_objects::SmartObject climate_control_data(smart_objects::SmartType_Map);
+ climate_control_data[message_params::kFanSpeed] = 10;
+
msg_params[message_params::kModuleData][message_params::kClimateControlData] =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+ climate_control_data;
// Expectations
EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _))
.WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed));
- EXPECT_CALL(mock_hmi_capabilities_, rc_capability())
- .WillOnce(Return(nullptr));
-
EXPECT_CALL(
mock_rpc_service_,
- ManageMobileCommand(test::components::commands_test::MobileResultCodeIs(
- mobile_apis::Result::READ_ONLY),
- application_manager::commands::Command::SOURCE_SDL));
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_SetInteriorVehicleData), _))
+ .WillOnce(Return(true));
// Act
- application_manager::SharedPtr<
- rc_rpc_plugin::commands::SetInteriorVehicleDataRequest> command =
+ auto command =
CreateRCCommand<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
mobile_message);
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -158,7 +189,7 @@ TEST_F(
// Arrange
MessageSharedPtr mobile_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& msg_params =
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_params =
(*mobile_message)[application_manager::strings::msg_params];
msg_params[message_params::kModuleData][message_params::kModuleType] =
mobile_apis::ModuleType::RADIO;
@@ -172,22 +203,20 @@ TEST_F(
EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _))
.WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed));
- EXPECT_CALL(mock_hmi_capabilities_, rc_capability())
- .WillOnce(Return(nullptr));
-
- EXPECT_CALL(app_mngr_, RemoveHMIFakeParameters(_));
+ EXPECT_CALL(app_mngr_, RemoveHMIFakeParameters(_, _));
EXPECT_CALL(
mock_rpc_service_,
- ManageMobileCommand(test::components::commands_test::MobileResultCodeIs(
- mobile_apis::Result::OUT_OF_MEMORY),
- application_manager::commands::Command::SOURCE_SDL));
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_SetInteriorVehicleData), _))
+ .WillOnce(Return(true));
// Act
- application_manager::SharedPtr<
- rc_rpc_plugin::commands::SetInteriorVehicleDataRequest> command =
- CreateRCCommand<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
+ std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>
+ command = CreateRCCommand<
+ rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
mobile_message);
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -196,7 +225,7 @@ TEST_F(
Execute_MessageValidationFailed_ExpectMessageNotSentToHMI_AndFalseSentToMobile) {
// Arrange
MessageSharedPtr mobile_message = CreateBasicMessage();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& msg_params =
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_params =
(*mobile_message)[application_manager::strings::msg_params];
msg_params[message_params::kModuleData][message_params::kModuleType] =
mobile_apis::ModuleType::RADIO;
@@ -215,11 +244,97 @@ TEST_F(
application_manager::commands::Command::SOURCE_SDL));
// Act
- application_manager::SharedPtr<
- rc_rpc_plugin::commands::SetInteriorVehicleDataRequest> command =
- CreateRCCommand<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
+ std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>
+ command = CreateRCCommand<
+ rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
mobile_message);
+ ASSERT_TRUE(command->Init());
command->Run();
}
+TEST_F(SetInteriorVehicleDataRequestTest,
+ Execute_ValidWithSettableParams_SUCCESSSendToHMI) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ auto& msg_params =
+ (*mobile_message)[application_manager::strings::msg_params];
+ msg_params[message_params::kModuleData][message_params::kModuleType] =
+ mobile_apis::ModuleType::CLIMATE;
+
+ msg_params[message_params::kModuleData][message_params::kClimateControlData] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ msg_params[message_params::kModuleData][message_params::kClimateControlData]
+ [message_params::kClimateEnable] = true;
+
+ // Expectations
+ EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _))
+ .WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed));
+
+ MessageSharedPtr message_from_mobile = CreateBasicMessage();
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_from_mobile), Return(true)));
+
+ std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>
+ command = CreateRCCommand<
+ rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
+ mobile_message);
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ auto& msg_params_from_mobile =
+ (*message_from_mobile)[application_manager::strings::msg_params];
+
+ const bool climate_enable =
+ msg_params_from_mobile[message_params::kModuleData]
+ [message_params::kClimateControlData]
+ [message_params::kClimateEnable]
+ .asBool();
+ EXPECT_TRUE(climate_enable);
+}
+
+TEST_F(SetInteriorVehicleDataRequestTest,
+ Execute_ValidWithSettableParams_SUCCESSSendToHMI_HDChannel) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ auto& msg_params =
+ (*mobile_message)[application_manager::strings::msg_params];
+ msg_params[message_params::kModuleData][message_params::kModuleType] =
+ mobile_apis::ModuleType::RADIO;
+
+ msg_params[message_params::kModuleData][message_params::kRadioControlData] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ const std::uint32_t hd_channel = 2u;
+ msg_params[message_params::kModuleData][message_params::kRadioControlData]
+ [message_params::kHdChannel] = hd_channel;
+
+ // Expectations
+ EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _))
+ .WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed));
+
+ auto message_from_mobile = CreateBasicMessage();
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_from_mobile), Return(true)));
+
+ std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>
+ command = CreateRCCommand<
+ rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
+ mobile_message);
+
+ command->Init();
+ command->Run();
+
+ auto& msg_params_from_mobile =
+ (*message_from_mobile)[application_manager::strings::msg_params];
+
+ const uint64_t hd_channel_from_hmi =
+ msg_params_from_mobile[message_params::kModuleData]
+ [message_params::kRadioControlData]
+ [message_params::kHdChannel]
+ .asUInt();
+
+ EXPECT_EQ(hd_channel, hd_channel_from_hmi);
+}
} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/grid_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/grid_test.cc
new file mode 100644
index 0000000000..b8a0d71203
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/grid_test.cc
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+
+#include "rc_rpc_plugin/rc_app_extension.h"
+
+namespace rc_rpc_plugin_test {
+namespace grid_test {
+using namespace rc_rpc_plugin;
+
+TEST(Grid, IsLevelIntersectionExists) {
+ Grid grid_level0{1, 1, 0, 1, 1, 1};
+ Grid grid_level1{1, 1, 1, 1, 1, 1};
+ EXPECT_FALSE(grid_level0.LevelIntersectionExists(grid_level1));
+
+ Grid grid_level1_v2{1, 2, 1, 1, 2, 1};
+ EXPECT_TRUE(grid_level1.LevelIntersectionExists(grid_level1_v2));
+}
+
+TEST(Grid, TwoSameGrisAreEqual) {
+ Grid grid2{1, 1, 0, 1, 1, 1};
+ Grid grid1{1, 1, 0, 1, 1, 1};
+
+ EXPECT_EQ(grid1, grid2);
+}
+
+TEST(Grid, IsIntersectionExists) {
+ Grid grid_1{0, 1, 2, 1, 1, 1};
+ Grid grid_2{0, 0, 1, 0, 0, 1};
+
+ // There is intersection but levels missmatch
+ EXPECT_FALSE(grid_1.IntersectionExists(grid_2));
+
+ Grid grid_3{1, 0, 2, 0, 0, 0};
+ // There isn't intersection but level match
+ EXPECT_FALSE(grid_1.IntersectionExists(grid_3));
+
+ Grid grid_4{0, 1, 2, 1, 1, 1};
+ EXPECT_TRUE(grid_1.IntersectionExists(grid_4));
+}
+} // namespace grid_test
+} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_cache.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_cache.h
new file mode 100644
index 0000000000..025cef2165
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_cache.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_INTERIOR_DATA_CACHE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_INTERIOR_DATA_CACHE_H_
+
+#include <string>
+#include "gmock/gmock.h"
+#include "rc_rpc_plugin/interior_data_cache.h"
+
+namespace rc_rpc_plugin_test {
+
+class MockInteriorDataCache : public rc_rpc_plugin::InteriorDataCache {
+ public:
+ MOCK_METHOD2(Add,
+ void(const rc_rpc_plugin::ModuleUid&,
+ const smart_objects::SmartObject&));
+ MOCK_CONST_METHOD1(
+ Retrieve, smart_objects::SmartObject(const rc_rpc_plugin::ModuleUid&));
+ MOCK_CONST_METHOD1(GetCachedModulesByType,
+ std::vector<rc_rpc_plugin::ModuleUid>(const std::string&));
+ MOCK_CONST_METHOD1(Contains, bool(const rc_rpc_plugin::ModuleUid&));
+ MOCK_METHOD1(Remove, void(const rc_rpc_plugin::ModuleUid&));
+ MOCK_METHOD0(Clear, void());
+};
+
+} // namespace rc_rpc_plugin_test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_INTERIOR_DATA_CACHE_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_manager.h
new file mode 100644
index 0000000000..231ac2ae36
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_interior_data_manager.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_INTERIOR_DATA_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_INTERIOR_DATA_MANAGER_H_
+
+#include <string>
+#include "gmock/gmock.h"
+#include "rc_rpc_plugin/interior_data_manager.h"
+namespace rc_rpc_plugin_test {
+
+class MockInteriorDataManager : public rc_rpc_plugin::InteriorDataManager {
+ public:
+ MOCK_METHOD1(OnPolicyEvent,
+ void(application_manager::plugin_manager::PolicyEvent));
+ MOCK_METHOD2(OnApplicationEvent,
+ void(application_manager::plugin_manager::ApplicationEvent,
+ application_manager::ApplicationSharedPtr));
+ MOCK_METHOD0(OnDisablingRC, void());
+ MOCK_METHOD1(StoreRequestToHMITime, void(const rc_rpc_plugin::ModuleUid&));
+ MOCK_METHOD1(CheckRequestsToHMIFrequency,
+ bool(const rc_rpc_plugin::ModuleUid&));
+};
+
+} // namespace rc_rpc_plugin_test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_INTERIOR_DATA_MANAGER_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_capabilities_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_capabilities_manager.h
new file mode 100644
index 0000000000..6f1593dcbb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_capabilities_manager.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_RC_CAPABILITIES_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_RC_CAPABILITIES_MANAGER_H_
+#include "gmock/gmock.h"
+#include "rc_rpc_plugin/rc_capabilities_manager.h"
+
+namespace rc_rpc_plugin_test {
+class MockRCCapabilitiesManager : public rc_rpc_plugin::RCCapabilitiesManager {
+ public:
+ MOCK_CONST_METHOD2(CheckButtonName,
+ bool(const std::string& module_type,
+ const std::string& button_name));
+
+ MOCK_CONST_METHOD1(CheckIfModuleExistsInCapabilities,
+ bool(const rc_rpc_plugin::ModuleUid& module_type));
+
+ MOCK_CONST_METHOD2(GetModuleDataCapabilities,
+ rc_rpc_plugin::ModuleTypeCapability(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_id));
+
+ MOCK_CONST_METHOD2(ControlDataForType,
+ const smart_objects::SmartObject&(
+ const smart_objects::SmartObject& module_data,
+ const std::string& module_type));
+
+ MOCK_CONST_METHOD3(
+ AreReadOnlyParamsPresent,
+ bool(const smart_objects::SmartObject& module_data,
+ const std::string& module_type,
+ rc_rpc_plugin::ModuleTypeCapability& module_data_capabilities));
+
+ MOCK_CONST_METHOD2(AreAllParamsReadOnly,
+ bool(const smart_objects::SmartObject& module_data,
+ const std::string& module_type));
+
+ MOCK_CONST_METHOD1(GetDefaultModuleIdFromCapabilities,
+ const std::string(const std::string& module_type));
+
+ MOCK_CONST_METHOD1(CheckIfButtonExistInRCCaps,
+ bool(const mobile_apis::ButtonName::eType button));
+
+ MOCK_CONST_METHOD0(GetResources,
+ const std::vector<rc_rpc_plugin::ModuleUid>());
+
+ MOCK_CONST_METHOD1(GetModuleServiceArea,
+ rc_rpc_plugin::Grid(const rc_rpc_plugin::ModuleUid&));
+
+ MOCK_CONST_METHOD1(IsMultipleAccessAllowed,
+ bool(const rc_rpc_plugin::ModuleUid&));
+
+ MOCK_CONST_METHOD0(GetDriverLocationFromSeatLocationCapability,
+ const rc_rpc_plugin::Grid());
+
+ MOCK_CONST_METHOD0(IsSeatLocationCapabilityProvided, bool());
+
+ MOCK_CONST_METHOD1(
+ GetModuleIdForSeatLocation,
+ const std::string(const mobile_apis::SupportedSeat::eType id));
+};
+} // namespace rc_rpc_plugin_test
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_RC_СAPABILITIES_MANAGER_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_consent_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_consent_manager.h
new file mode 100644
index 0000000000..a89202b5f5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_consent_manager.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_MOCK_RC_CONSENT_MANAGER_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_MOCK_RC_CONSENT_MANAGER_H
+
+#include <string>
+
+#include "gmock/gmock.h"
+#include "rc_rpc_plugin/rc_consent_manager.h"
+
+namespace rc_rpc_plugin_test {
+
+class MockRCConsentManager : public rc_rpc_plugin::RCConsentManager {
+ public:
+ MOCK_METHOD3(SaveModuleConsents,
+ void(const std::string&,
+ const std::string&,
+ const rc_rpc_plugin::rc_rpc_types::ModuleIdConsentVector&));
+ MOCK_METHOD3(GetModuleConsent,
+ rc_rpc_plugin::rc_rpc_types::ModuleConsent(
+ const std::string&,
+ const std::string&,
+ const rc_rpc_plugin::rc_rpc_types::ModuleUid&));
+ MOCK_METHOD0(RemoveExpiredConsents, void());
+ MOCK_METHOD0(RemoveAllConsents, void());
+};
+
+} // namespace rc_rpc_plugin_test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_MOCK_RC_CONSENT_MANAGER_H
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_helpers.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_helpers.h
new file mode 100644
index 0000000000..c73472d2a8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_rc_helpers.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RC_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_RC_HELPERS_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RC_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_RC_HELPERS_H
+
+#include <functional>
+#include <map>
+#include <string>
+#include "gmock/gmock.h"
+
+#include "application_manager/application.h"
+#include "application_manager/application_manager.h"
+#include "rc_rpc_plugin/rc_helpers.h"
+
+namespace rc_rpc_plugin {
+
+class MockRCHelpers {
+ public:
+ MOCK_METHOD0(GetModuleTypeToDataMapping,
+ std::function<std::string(const std::string&)>());
+ MOCK_METHOD0(GetModuleTypeToCapabilitiesMapping,
+ std::function<std::string(const std::string&)>());
+ MOCK_METHOD0(GetModuleTypesList, const std::vector<std::string>());
+ MOCK_METHOD1(
+ GetRCExtension,
+ rc_rpc_plugin::RCAppExtensionPtr(application_manager::Application&));
+ MOCK_METHOD2(CreateUnsubscribeRequestToHMI,
+ smart_objects::SmartObjectSPtr(const rc_rpc_plugin::ModuleUid&,
+ const uint32_t));
+ MOCK_METHOD2(AppsSubscribedToModule,
+ std::vector<application_manager::ApplicationSharedPtr>(
+ application_manager::ApplicationManager&,
+ const rc_rpc_plugin::ModuleUid&));
+ MOCK_METHOD2(AppsSubscribedToModuleType,
+ std::vector<application_manager::ApplicationSharedPtr>(
+ application_manager::ApplicationManager&,
+ const std::string&));
+ MOCK_METHOD1(GetApplicationsAllowedModuleTypes,
+ rc_rpc_plugin::RCHelpers::AppsModuleTypes(
+ application_manager::ApplicationManager&));
+ MOCK_METHOD0(buttons_climate, const std::vector<std::string>());
+ MOCK_METHOD0(buttons_radio, const std::vector<std::string>());
+ MOCK_METHOD0(buttons_map, const rc_rpc_plugin::RCHelpers::ButtonsMap());
+ MOCK_METHOD1(GetModuleReadOnlyParams,
+ std::vector<std::string>(const std::string&));
+ MOCK_METHOD3(
+ FillModuleConsents,
+ rc_rpc_types::ModuleIdConsentVector(const std::string&,
+ const std::vector<std::string>&,
+ const std::vector<bool>));
+ MOCK_METHOD1(RetrieveModuleIds,
+ std::vector<std::string>(const smart_objects::SmartObject&));
+ MOCK_METHOD1(RetrieveModuleConsents,
+ std::vector<bool>(const smart_objects::SmartObject& consents));
+ MOCK_METHOD1(RemoveRedundantGPSDataFromIVDataMsg,
+ void(smart_objects::SmartObject& msg_params));
+ MOCK_METHOD2(
+ MergeModuleData,
+ smart_objects::SmartObject(const smart_objects::SmartObject& data1,
+ const smart_objects::SmartObject& data2));
+
+ static MockRCHelpers* rc_helpers_mock();
+};
+
+} // namespace rc_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RC_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_RC_HELPERS_H
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h
index fb9326209c..fca6c9c77e 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h
@@ -30,24 +30,30 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_RESOURCE_ALLOCATION_MANAGER_H_
-#define SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_RESOURCE_ALLOCATION_MANAGER_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_RESOURCE_ALLOCATION_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_RESOURCE_ALLOCATION_MANAGER_H_
-#include "gmock/gmock.h"
#include "application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h"
+#include "gmock/gmock.h"
namespace rc_rpc_plugin_test {
class MockResourceAllocationManager
: public rc_rpc_plugin::ResourceAllocationManager {
public:
- MOCK_METHOD2(AcquireResource,
- rc_rpc_plugin::AcquireResult::eType(
- const std::string& module_type, const uint32_t app_id));
- MOCK_METHOD2(ForceAcquireResource,
- void(const std::string& module_type, const uint32_t app_id));
- MOCK_METHOD2(OnDriverDisallowed,
- void(const std::string& module_type, const uint32_t app_id));
+ MOCK_METHOD3(
+ AcquireResource,
+ rc_rpc_plugin::AcquireResult::eType(const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id));
+ MOCK_METHOD3(ForceAcquireResource,
+ void(const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id));
+ MOCK_METHOD3(OnDriverDisallowed,
+ void(const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id));
MOCK_METHOD2(OnApplicationEvent,
void(application_manager::plugin_manager::ApplicationEvent event,
application_manager::ApplicationSharedPtr application));
@@ -56,17 +62,34 @@ class MockResourceAllocationManager
MOCK_METHOD1(SetAccessMode,
void(const hmi_apis::Common_RCAccessMode::eType access_mode));
MOCK_CONST_METHOD0(GetAccessMode, hmi_apis::Common_RCAccessMode::eType());
- MOCK_METHOD3(SetResourceState,
+ MOCK_METHOD4(SetResourceState,
void(const std::string& module_type,
+ const std::string& module_id,
const uint32_t app_id,
const rc_rpc_plugin::ResourceState::eType state));
- MOCK_CONST_METHOD1(IsResourceFree, bool(const std::string& module_type));
- MOCK_METHOD1(GetApplicationExtention,
- rc_rpc_plugin::RCAppExtensionPtr(
- application_manager::ApplicationSharedPtr application));
+ MOCK_CONST_METHOD2(IsResourceFree,
+ bool(const std::string& module_type,
+ const std::string& module_id));
MOCK_METHOD0(ResetAllAllocations, void());
+ MOCK_METHOD2(SendOnRCStatusNotifications,
+ void(rc_rpc_plugin::NotificationTrigger::eType,
+ application_manager::ApplicationSharedPtr application));
+ MOCK_CONST_METHOD0(is_rc_enabled, bool());
+ MOCK_METHOD1(set_rc_enabled, void(const bool value));
+ MOCK_METHOD3(ReleaseResource,
+ rc_rpc_plugin::ResourceReleasedState::eType(
+ const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t application_id));
+ MOCK_METHOD3(SetResourceAcquired,
+ void(const std::string& module_type,
+ const std::string& module_id,
+ const uint32_t app_id));
+ MOCK_CONST_METHOD2(IsResourceAlreadyAcquiredByApp,
+ bool(const rc_rpc_plugin::ModuleUid& moduleUid,
+ const uint32_t app_id));
};
} // namespace rc_rpc_plugin_test
-#endif // SRC_COMPONENTS_REMOTE_CONTROL_TEST_INCLUDE_MOCK_RESOURCE_ALLOCATION_MANAGER_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_TEST_INCLUDE_RC_RPC_PLUGIN_MOCK_MOCK_RESOURCE_ALLOCATION_MANAGER_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/interior_data_cache_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/interior_data_cache_test.cc
new file mode 100644
index 0000000000..40a6bdf41d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/interior_data_cache_test.cc
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. */
+
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "rc_rpc_plugin/interior_data_cache_impl.h"
+
+namespace rc_rpc_plugin_test {
+
+class InteriorDataCacheTest : public ::testing::Test {};
+
+namespace {
+const uint32_t time_frame_alowed_requests = 1;
+const std::string kValueKey = "value";
+const std::string kArray = "array";
+} // namespace
+
+TEST_F(InteriorDataCacheTest,
+ InteriorDataCacheDoesNotContainRandomDataInitialy) {
+ rc_rpc_plugin::InteriorDataCacheImpl cache;
+ std::string module_type_key = "random_module_type";
+ std::string module_id = "34045662-a9dc-4823-8435-91056d4c26cb";
+ rc_rpc_plugin::ModuleUid module(module_type_key, module_id);
+ EXPECT_FALSE(cache.Contains(module));
+ auto retrieved_data = cache.Retrieve(module);
+ EXPECT_EQ(smart_objects::SmartType_Null, retrieved_data.getType());
+}
+
+TEST_F(InteriorDataCacheTest, CheckThatCacheContansDataAfterAdding) {
+ rc_rpc_plugin::InteriorDataCacheImpl cache;
+ const std::string module_type_key = "random_module_type";
+ std::string module_id = "34045662-a9dc-4823-8435-91056d4c26cb";
+ rc_rpc_plugin::ModuleUid module(module_type_key, module_id);
+ smart_objects::SmartObject data;
+ data["key"] = "value";
+
+ cache.Add(module, data);
+ EXPECT_TRUE(cache.Contains(module));
+ auto retrieved_data = cache.Retrieve(module);
+ EXPECT_EQ(data, retrieved_data);
+}
+
+TEST_F(InteriorDataCacheTest, DataDoesNotExistAfterClear) {
+ rc_rpc_plugin::InteriorDataCacheImpl cache;
+ const std::string module_type_key = "random_module_type";
+ std::string module_id = "34045662-a9dc-4823-8435-91056d4c26cb";
+ rc_rpc_plugin::ModuleUid module(module_type_key, module_id);
+ smart_objects::SmartObject data;
+ data["key"] = "value";
+
+ cache.Add(module, data);
+ EXPECT_TRUE(cache.Contains(module));
+ auto Retrieved_data = cache.Retrieve(module);
+ EXPECT_EQ(Retrieved_data, data);
+ cache.Clear();
+ auto Retrieved_data_after_clear = cache.Retrieve(module);
+ EXPECT_EQ(smart_objects::SmartType_Null,
+ Retrieved_data_after_clear.getType());
+}
+
+TEST_F(InteriorDataCacheTest, MultipleDataCached) {
+ rc_rpc_plugin::InteriorDataCacheImpl cache;
+
+ const std::string module_type_key1 = "random_module_type";
+ std::string module_id1 = "34045662-a9dc-4823-8435-91056d4c26cb";
+ rc_rpc_plugin::ModuleUid module1(module_type_key1, module_id1);
+ smart_objects::SmartObject data1;
+ data1["key"] = "value1";
+ cache.Add(module1, data1);
+ EXPECT_TRUE(cache.Contains(module1));
+ auto retrieved_data1 = cache.Retrieve(module1);
+ EXPECT_EQ(data1, retrieved_data1);
+
+ std::string module_type_key2 = "random_module_type2";
+ std::string module_id2 = "eb7739ea-b263-4fe1-af9c-9311d1acac2d";
+ rc_rpc_plugin::ModuleUid module2(module_type_key2, module_id2);
+ smart_objects::SmartObject data2;
+ data2["key"] = "value2";
+ cache.Add(module2, data2);
+ EXPECT_TRUE(cache.Contains(module2));
+ auto retrieved_data2 = cache.Retrieve(module2);
+ EXPECT_EQ(retrieved_data2, data2);
+
+ ASSERT_TRUE(data1 != data2);
+ EXPECT_TRUE(data2 != retrieved_data1);
+ EXPECT_TRUE(data1 != retrieved_data2);
+}
+
+TEST_F(InteriorDataCacheTest, RemoveFromChacheSuccessful) {
+ rc_rpc_plugin::InteriorDataCacheImpl cache;
+
+ const std::string module_type = "random_module_type";
+ std::string module_id = "34045662-a9dc-4823-8435-91056d4c26cb";
+ rc_rpc_plugin::ModuleUid module(module_type, module_id);
+ smart_objects::SmartObject data;
+ data["key"] = "value1";
+ cache.Add(module, data);
+ EXPECT_TRUE(cache.Contains(module));
+ auto retrieved_data1 = cache.Retrieve(module);
+ EXPECT_EQ(data, retrieved_data1);
+
+ cache.Remove(module);
+ EXPECT_FALSE(cache.Contains(module));
+ auto retreived = cache.Retrieve(module);
+ EXPECT_EQ(smart_objects::SmartType_Null, retreived.getType());
+}
+
+TEST_F(InteriorDataCacheTest, RemoveNotExistingNoSideEffects) {
+ rc_rpc_plugin::InteriorDataCacheImpl cache;
+ const std::string module_type_key = "random_module_type";
+ std::string module_id = "34045662-a9dc-4823-8435-91056d4c26cb";
+ rc_rpc_plugin::ModuleUid module(module_type_key, module_id);
+ smart_objects::SmartObject data;
+ data["key"] = "value";
+
+ cache.Add(module, data);
+ rc_rpc_plugin::ModuleUid other_module("some other module_type",
+ "some other module id");
+ cache.Remove(other_module);
+
+ EXPECT_TRUE(cache.Contains(module));
+ auto retrieved_data = cache.Retrieve(module);
+ EXPECT_EQ(data, retrieved_data);
+}
+
+TEST_F(InteriorDataCacheTest, Exist2ModuleTypesRemoveOneAnotherOneLeft) {
+ rc_rpc_plugin::InteriorDataCacheImpl cache;
+
+ const std::string module_type_key1 = "random_module_type";
+ std::string module_id1 = "34045662-a9dc-4823-8435-91056d4c26cb";
+ rc_rpc_plugin::ModuleUid module1(module_type_key1, module_id1);
+ smart_objects::SmartObject data1;
+ data1["key"] = "value1";
+ cache.Add(module1, data1);
+
+ std::string module_type_key2 = "random_module_type2";
+ std::string module_id2 = "eb7739ea-b263-4fe1-af9c-9311d1acac2d";
+ rc_rpc_plugin::ModuleUid module2(module_type_key2, module_id2);
+ smart_objects::SmartObject data2;
+ data2["key"] = "value2";
+ cache.Add(module2, data2);
+
+ ASSERT_TRUE(data1 != data2);
+
+ cache.Remove(module1);
+ EXPECT_FALSE(cache.Contains(module1));
+ EXPECT_TRUE(cache.Contains(module2));
+
+ auto retrieved_data1 = cache.Retrieve(module1);
+ EXPECT_EQ(smart_objects::SmartType_Null, retrieved_data1.getType());
+ auto retrieved_data2 = cache.Retrieve(module2);
+ EXPECT_EQ(data2, retrieved_data2);
+}
+
+TEST_F(InteriorDataCacheTest, CheckCacheDataMerge) {
+ using namespace smart_objects;
+ const std::string module_type_key = "random_module_type";
+ const std::string module_id = "random_module_id";
+ rc_rpc_plugin::ModuleUid module(module_type_key, module_id);
+
+ auto gen_smart_object = [](const std::string& id,
+ const std::string& value) -> SmartObject {
+ SmartObject result(SmartType_Map);
+ result[application_manager::strings::id] = id;
+ result[kValueKey] = value;
+ return result;
+ };
+
+ SmartObject data1;
+ SmartObject data1_array(SmartType_Array);
+ (*data1_array.asArray()) = SmartArray{gen_smart_object("id1", "value1"),
+ gen_smart_object("id2", "value2")};
+ data1[kArray] = data1_array;
+
+ SmartObject data2(SmartType_Map);
+ SmartObject data2_array(SmartType_Array);
+ (*data2_array.asArray()) = SmartArray{gen_smart_object("id1", "value3"),
+ gen_smart_object("id3", "value4")};
+ data2[kArray] = data2_array;
+
+ SmartObject expected_data(SmartType_Map);
+ SmartObject expected_array(SmartType_Array);
+ (*expected_array.asArray()) = SmartArray{gen_smart_object("id1", "value3"),
+ gen_smart_object("id2", "value2"),
+ gen_smart_object("id3", "value4")};
+ expected_data[kArray] = expected_array;
+
+ rc_rpc_plugin::InteriorDataCacheImpl cache;
+ cache.Add(module, data1);
+ cache.Add(module, data2);
+
+ const auto retrieved_data = cache.Retrieve(module);
+
+ EXPECT_TRUE(cache.Contains(module));
+ EXPECT_EQ(expected_data, retrieved_data);
+}
+
+} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/mock_rc_helpers.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/mock_rc_helpers.cc
new file mode 100644
index 0000000000..3e60591c6b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/mock_rc_helpers.cc
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "rc_rpc_plugin/mock/mock_rc_helpers.h"
+
+namespace rc_rpc_plugin {
+
+smart_objects::SmartObject RCHelpers::MergeModuleData(
+ const smart_objects::SmartObject& data1,
+ const smart_objects::SmartObject& data2) {
+ return MockRCHelpers::rc_helpers_mock()->MergeModuleData(data1, data2);
+}
+
+const std::function<std::string(const std::string&)>
+rc_rpc_plugin::RCHelpers::GetModuleTypeToDataMapping() {
+ return MockRCHelpers::rc_helpers_mock()->GetModuleTypeToDataMapping();
+}
+
+const std::function<std::string(const std::string&)>
+rc_rpc_plugin::RCHelpers::GetModuleTypeToCapabilitiesMapping() {
+ return MockRCHelpers::rc_helpers_mock()->GetModuleTypeToCapabilitiesMapping();
+}
+
+const std::vector<std::string> rc_rpc_plugin::RCHelpers::GetModuleTypesList() {
+ return MockRCHelpers::rc_helpers_mock()->GetModuleTypesList();
+}
+
+rc_rpc_plugin::RCAppExtensionPtr rc_rpc_plugin::RCHelpers::GetRCExtension(
+ application_manager::Application& app) {
+ return MockRCHelpers::rc_helpers_mock()->GetRCExtension(app);
+}
+
+smart_objects::SmartObjectSPtr
+rc_rpc_plugin::RCHelpers::CreateUnsubscribeRequestToHMI(
+ const ModuleUid& module, const uint32_t correlation_id) {
+ return MockRCHelpers::rc_helpers_mock()->CreateUnsubscribeRequestToHMI(
+ module, correlation_id);
+}
+
+std::vector<application_manager::ApplicationSharedPtr>
+rc_rpc_plugin::RCHelpers::AppsSubscribedToModule(
+ application_manager::ApplicationManager& app_mngr,
+ const ModuleUid& module) {
+ return MockRCHelpers::rc_helpers_mock()->AppsSubscribedToModule(app_mngr,
+ module);
+}
+
+std::vector<application_manager::ApplicationSharedPtr>
+rc_rpc_plugin::RCHelpers::AppsSubscribedToModuleType(
+ application_manager::ApplicationManager& app_mngr,
+ const std::string& module_type) {
+ return MockRCHelpers::rc_helpers_mock()->AppsSubscribedToModuleType(
+ app_mngr, module_type);
+}
+
+rc_rpc_plugin::RCHelpers::AppsModuleTypes
+rc_rpc_plugin::RCHelpers::GetApplicationsAllowedModuleTypes(
+ application_manager::ApplicationManager& app_mngr) {
+ return MockRCHelpers::rc_helpers_mock()->GetApplicationsAllowedModuleTypes(
+ app_mngr);
+}
+
+const std::vector<std::string> RCHelpers::buttons_climate() {
+ return MockRCHelpers::rc_helpers_mock()->buttons_climate();
+}
+
+const std::vector<std::string> RCHelpers::buttons_radio() {
+ return MockRCHelpers::rc_helpers_mock()->buttons_radio();
+}
+
+const rc_rpc_plugin::RCHelpers::ButtonsMap RCHelpers::buttons_map() {
+ return MockRCHelpers::rc_helpers_mock()->buttons_map();
+}
+
+std::vector<std::string> RCHelpers::GetModuleReadOnlyParams(
+ const std::string& module_type) {
+ return MockRCHelpers::rc_helpers_mock()->GetModuleReadOnlyParams(module_type);
+}
+
+rc_rpc_types::ModuleIdConsentVector RCHelpers::FillModuleConsents(
+ const std::string& module_type,
+ const std::vector<std::string>& module_ids,
+ const std::vector<bool> allowed) {
+ return MockRCHelpers::rc_helpers_mock()->FillModuleConsents(
+ module_type, module_ids, allowed);
+}
+
+std::vector<std::string> RCHelpers::RetrieveModuleIds(
+ const smart_objects::SmartObject& moduleIds) {
+ return MockRCHelpers::rc_helpers_mock()->RetrieveModuleIds(moduleIds);
+}
+
+std::vector<bool> RCHelpers::RetrieveModuleConsents(
+ const smart_objects::SmartObject& consents) {
+ return MockRCHelpers::rc_helpers_mock()->RetrieveModuleConsents(consents);
+}
+
+void RCHelpers::RemoveRedundantGPSDataFromIVDataMsg(
+ smart_objects::SmartObject& msg_params) {
+ return MockRCHelpers::rc_helpers_mock()->RemoveRedundantGPSDataFromIVDataMsg(
+ msg_params);
+}
+
+MockRCHelpers* MockRCHelpers::rc_helpers_mock() {
+ static ::testing::NiceMock<MockRCHelpers> mock_rc_helpers;
+ return &mock_rc_helpers;
+}
+
+} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_consent_manager_impl_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_consent_manager_impl_test.cc
new file mode 100644
index 0000000000..a2e9f6d83b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_consent_manager_impl_test.cc
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <ctime>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "application_manager/mock_application_manager_settings.h"
+#include "rc_rpc_plugin/rc_consent_manager_impl.h"
+#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "utils/date_time.h"
+#include "utils/file_system.h"
+
+#include "application_manager/mock_application_manager.h"
+
+using test::components::application_manager_test::MockApplicationManager;
+using test::components::application_manager_test::
+ MockApplicationManagerSettings;
+
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+namespace {
+const std::string kPolicyApp1Id = "app1_id";
+const std::string kPolicyApp2Id = "app2_id";
+const std::string kMacAddress1 = "device1";
+const std::string kMacAddress2 = "device2";
+const std::string kClimateModule = "CLIMATE";
+const std::string kRadioModule = "RADIO";
+const std::string kAppTestStorageFolder = "app_test_storage_folder";
+const std::string kAppTestInfoStorage = "app_test_info_storage";
+const uint32_t kPeriodOfConsentExpired = 30; // in days
+} // namespace
+
+namespace rc_rpc_plugin_test {
+namespace rc_consent_manager_test {
+using namespace rc_rpc_plugin::rc_rpc_types;
+using namespace rc_rpc_plugin;
+
+class RCConsentManagerImplTest : public ::testing::Test {
+ public:
+ RCConsentManagerImplTest()
+ : current_date_(0u)
+ , last_state_(std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>(kAppTestStorageFolder,
+ kAppTestInfoStorage)))
+ , rc_consent_manager_(new rc_rpc_plugin::RCConsentManagerImpl(
+ last_state_, mock_app_mngr_, kPeriodOfConsentExpired)) {}
+
+ void SetUp() OVERRIDE {
+ current_date_ = std::time(0);
+ RemoveTemproraryTetsFiles();
+
+ ON_CALL(mock_app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(mock_app_mnrg_settings_));
+ ON_CALL(mock_app_mnrg_settings_, period_for_consent_expiration())
+ .WillByDefault(Return(kPeriodOfConsentExpired));
+ }
+
+ void RemoveTemproraryTetsFiles() {
+ // Remove exists storage file
+ if (file_system::FileExists(kAppTestInfoStorage)) {
+ file_system::DeleteFile(kAppTestInfoStorage);
+ }
+
+ // Remove exists storage folder
+ if (file_system::DirectoryExists(kAppTestStorageFolder)) {
+ file_system::RemoveDirectory(kAppTestStorageFolder);
+ }
+
+ auto last_state_accessor = last_state_->get_accessor();
+ last_state_accessor.GetMutableData().set_dictionary(Json::Value());
+ }
+
+ void SaveStateToFileSystem() {
+ auto last_state_accessor = last_state_->get_accessor();
+ last_state_accessor.GetMutableData().SaveToFileSystem();
+ }
+
+ protected:
+ time_t current_date_;
+ NiceMock<MockApplicationManagerSettings> mock_app_mnrg_settings_;
+ NiceMock<MockApplicationManager> mock_app_mngr_;
+ resumption::LastStateWrapperPtr last_state_;
+ std::unique_ptr<rc_rpc_plugin::RCConsentManagerImpl> rc_consent_manager_;
+};
+
+TEST_F(RCConsentManagerImplTest, SaveAndGetModuleConsents_SUCCESS) {
+ const std::string radio_moduleId = "eb7739ea-b263-4fe1-af9c-9311d1acac2d";
+ const std::string climate_moduleId = "34045662-a9dc-4823-8435-91056d4c26cb";
+
+ ModuleIdConsent radio_module_consent{
+ {kRadioModule, radio_moduleId}, ModuleConsent::CONSENTED, current_date_};
+
+ ModuleIdConsent climate_module_consent{{kClimateModule, climate_moduleId},
+ ModuleConsent::NOT_CONSENTED,
+ current_date_};
+
+ ModuleIdConsentVector module_consents{radio_module_consent,
+ climate_module_consent};
+
+ rc_consent_manager_->SaveModuleConsents(
+ kPolicyApp1Id, kMacAddress1, module_consents);
+ SaveStateToFileSystem();
+
+ auto radio_consent = rc_consent_manager_->GetModuleConsent(
+ kPolicyApp1Id, kMacAddress1, {kRadioModule, radio_moduleId});
+ auto climate_consent = rc_consent_manager_->GetModuleConsent(
+ kPolicyApp1Id, kMacAddress1, {kClimateModule, climate_moduleId});
+
+ EXPECT_EQ(ModuleConsent::CONSENTED, radio_consent);
+ EXPECT_EQ(ModuleConsent::NOT_CONSENTED, climate_consent);
+}
+
+TEST_F(RCConsentManagerImplTest, ModuleId_NOT_EXISTS) {
+ const std::string radio_moduleId = "eb7739ea-b263-4fe1-af9c-9311d1acac2d";
+ const std::string climate_moduleId = "34045662-a9dc-4823-8435-91056d4c26cb";
+
+ ModuleIdConsent radio_module_consent{
+ {kRadioModule, radio_moduleId}, ModuleConsent::CONSENTED, current_date_};
+ ModuleIdConsent climate_module_consent{{kClimateModule, climate_moduleId},
+ ModuleConsent::CONSENTED,
+ current_date_};
+
+ const std::string uknown_moduleId = "639f1b7f-1d25-4dca-a2ce-00530860adea";
+ const std::string uknown_moduleType = "UNKNOWN_TYPE";
+
+ ModuleUid unknown_module{uknown_moduleId, uknown_moduleType};
+
+ ModuleIdConsentVector module_consents{radio_module_consent,
+ climate_module_consent};
+
+ rc_consent_manager_->SaveModuleConsents(
+ kPolicyApp1Id, kMacAddress1, module_consents);
+ SaveStateToFileSystem();
+
+ ModuleConsent consent = rc_consent_manager_->GetModuleConsent(
+ kPolicyApp1Id, kMacAddress1, unknown_module);
+
+ EXPECT_EQ(ModuleConsent::NOT_EXISTS, consent);
+}
+
+TEST_F(RCConsentManagerImplTest, ConsentIsExpired) {
+ time_t expired_date_45_days =
+ current_date_ - (date_time::SECONDS_IN_DAY * 45);
+ time_t expired_date_30_days =
+ current_date_ - (date_time::SECONDS_IN_DAY * 30);
+ time_t not_expired_date_29_days =
+ current_date_ - (date_time::SECONDS_IN_DAY * 29);
+
+ const std::string moduleId1 = "dbef7693-adf9-42f1-95c7-5dff314d9985";
+ const std::string moduleId2 = "1536b2ac-213f-463f-8589-a11453cd3729";
+ const std::string moduleId3 = "e8b8169a-9f29-4499-a60b-2d126a1beffc";
+
+ ModuleUid module_resource1{kRadioModule, moduleId1};
+ ModuleUid module_resource2{kRadioModule, moduleId2};
+ ModuleUid module_resource3{kRadioModule, moduleId3};
+
+ ModuleIdConsent module_consent_expired1{
+ module_resource1, ModuleConsent::CONSENTED, expired_date_45_days};
+ ModuleIdConsent module_consent_expired2{
+ module_resource2, ModuleConsent::CONSENTED, expired_date_30_days};
+
+ ModuleIdConsent module_consent_not_expired{
+ module_resource3, ModuleConsent::CONSENTED, not_expired_date_29_days};
+
+ ModuleIdConsentVector module_consents{module_consent_expired1,
+ module_consent_expired2,
+ module_consent_not_expired};
+ rc_consent_manager_->SaveModuleConsents(
+ kPolicyApp1Id, kMacAddress1, module_consents);
+ SaveStateToFileSystem();
+
+ // All consents, which consent has been saved more than 30 days, will be
+ // removed.
+ rc_consent_manager_->RemoveExpiredConsents();
+
+ ModuleConsent expired_consent_45_days = rc_consent_manager_->GetModuleConsent(
+ kPolicyApp1Id, kMacAddress1, module_resource1);
+ EXPECT_EQ(ModuleConsent::NOT_EXISTS, expired_consent_45_days);
+
+ ModuleConsent expired_consent_30_days = rc_consent_manager_->GetModuleConsent(
+ kPolicyApp1Id, kMacAddress1, module_resource2);
+ EXPECT_EQ(ModuleConsent::NOT_EXISTS, expired_consent_30_days);
+
+ ModuleConsent not_expired_consent = rc_consent_manager_->GetModuleConsent(
+ kPolicyApp1Id, kMacAddress1, module_resource3);
+ EXPECT_EQ(ModuleConsent::CONSENTED, not_expired_consent);
+}
+
+TEST_F(RCConsentManagerImplTest,
+ SaveModuleConsents_SameAppID_DifferentDeviceID_NotReplaced) {
+ const std::string moduleId = "cef4eae6-e22c-4943-bdc3-60e792414c4c";
+ ModuleUid module_resource{kRadioModule, moduleId};
+
+ ModuleIdConsent radio_module_consent_app1_deviceId1{
+ module_resource, ModuleConsent::CONSENTED, current_date_};
+
+ ModuleIdConsent radio_module_consent_app1_deviceId2{
+ module_resource, ModuleConsent::NOT_CONSENTED, current_date_};
+
+ ModuleIdConsentVector module_consents_app1{
+ radio_module_consent_app1_deviceId1};
+ ModuleIdConsentVector module_consents_app2{
+ radio_module_consent_app1_deviceId2};
+
+ rc_consent_manager_->SaveModuleConsents(
+ kPolicyApp1Id, kMacAddress1, module_consents_app1);
+
+ rc_consent_manager_->SaveModuleConsents(
+ kPolicyApp1Id, kMacAddress2, module_consents_app2);
+
+ SaveStateToFileSystem();
+
+ // Module consents for same app ids and different device_id (mac_adress) will
+ // haven't been replaced each other
+
+ ModuleConsent module_consent_deviceID1 =
+ rc_consent_manager_->GetModuleConsent(
+ kPolicyApp1Id, kMacAddress1, module_resource);
+
+ ModuleConsent module_consent_deviceID2 =
+ rc_consent_manager_->GetModuleConsent(
+ kPolicyApp1Id, kMacAddress2, module_resource);
+
+ EXPECT_EQ(ModuleConsent::CONSENTED, module_consent_deviceID1);
+
+ // // Module consent for app_id2 has different value as has been saved above
+ EXPECT_EQ(ModuleConsent::NOT_CONSENTED, module_consent_deviceID2);
+}
+
+TEST_F(RCConsentManagerImplTest,
+ SaveModuleConsents_SameAppID_SameDeviceID_Replaced) {
+ const std::string moduleId = "194aee9e-26cb-4f48-a775-8841a658002d";
+
+ ModuleUid radio_module_resource_consented{kRadioModule, moduleId};
+ ModuleUid radio_module_resource_not_consented{kRadioModule, moduleId};
+
+ ModuleIdConsent radio_module_consent_app1_deviceId1{
+ radio_module_resource_consented, ModuleConsent::CONSENTED, current_date_};
+
+ ModuleIdConsent radio_module_consent_app1_deviceId2{
+ radio_module_resource_not_consented,
+ ModuleConsent::NOT_CONSENTED,
+ current_date_};
+
+ ModuleIdConsentVector module_consents_app1{
+ radio_module_consent_app1_deviceId1};
+ ModuleIdConsentVector module_consents_app2{
+ radio_module_consent_app1_deviceId2};
+
+ rc_consent_manager_->SaveModuleConsents(
+ kPolicyApp1Id, kMacAddress1, module_consents_app1);
+
+ SaveStateToFileSystem();
+
+ rc_consent_manager_->SaveModuleConsents(
+ kPolicyApp1Id, kMacAddress1, module_consents_app2);
+
+ SaveStateToFileSystem();
+
+ // Module consents for same app ids and same device_id (mac_adress) will
+ // have been replaced each other
+
+ ModuleConsent module_consent = rc_consent_manager_->GetModuleConsent(
+ kPolicyApp1Id, kMacAddress1, radio_module_resource_not_consented);
+
+ EXPECT_EQ(ModuleConsent::NOT_CONSENTED, module_consent);
+}
+
+TEST_F(RCConsentManagerImplTest, RemoveAllModuleConsents_SUCCESS) {
+ const std::string moduleId = "1c5408f2-9766-464c-a7bf-d834b62f43fa";
+
+ ModuleUid module_resource{kRadioModule, moduleId};
+
+ ModuleIdConsent radio_module_consent_app1_deviceId1{
+ module_resource, ModuleConsent::CONSENTED, current_date_};
+
+ ModuleIdConsent radio_module_consent_app1_deviceId2{
+ module_resource, ModuleConsent::NOT_CONSENTED, current_date_};
+
+ ModuleIdConsentVector module_consents_app1{
+ radio_module_consent_app1_deviceId1};
+ ModuleIdConsentVector module_consents_app2{
+ radio_module_consent_app1_deviceId2};
+
+ rc_consent_manager_->SaveModuleConsents(
+ kPolicyApp1Id, kMacAddress1, module_consents_app1);
+
+ rc_consent_manager_->SaveModuleConsents(
+ kPolicyApp1Id, kMacAddress2, module_consents_app2);
+
+ SaveStateToFileSystem();
+
+ rc_consent_manager_->RemoveAllConsents();
+
+ ModuleConsent module_consent_deviceID1 =
+ rc_consent_manager_->GetModuleConsent(
+ kPolicyApp1Id, kMacAddress1, module_resource);
+
+ ModuleConsent module_consent_deviceID2 =
+ rc_consent_manager_->GetModuleConsent(
+ kPolicyApp1Id, kMacAddress2, module_resource);
+
+ EXPECT_EQ(ModuleConsent::NOT_EXISTS, module_consent_deviceID1);
+
+ EXPECT_EQ(ModuleConsent::NOT_EXISTS, module_consent_deviceID2);
+}
+
+} // namespace rc_consent_manager_test
+} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_helpers_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_helpers_test.cc
new file mode 100644
index 0000000000..21876c4c19
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_helpers_test.cc
@@ -0,0 +1,285 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. */
+
+#include "rc_rpc_plugin/rc_helpers.h"
+#include <map>
+#include <memory>
+#include <string>
+#include <type_traits>
+#include <vector>
+#include "gtest/gtest.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+
+namespace {
+const std::string kKeyId = "id";
+const std::string kKeyStatus = "status";
+const std::string kKeyDensity = "density";
+const std::string kKeyValue = "value";
+const std::string kArray = "array";
+} // namespace
+
+namespace rc_rpc_plugin_test {
+
+using namespace rc_rpc_plugin;
+using namespace smart_objects;
+
+class RCHelpersTest : public ::testing::Test {
+ public:
+ /**
+ * @brief Generates smart object with next structure:
+ * {
+ * "status": "status<n>",
+ * "value": "value<n>",
+ * "id": "id<n>"
+ * }
+ * where <n> is number specified with 'object_number' param.
+ *
+ * @param int object_number - number of object
+ * @param bool use_id_key - defines, whether "id" key must be added to smart
+ * object
+ *
+ * @return smart_objects::SmartObject - generated smart object
+ */
+ smart_objects::SmartObject gen_smart_object(int object_number,
+ bool use_id_key) {
+ smart_objects::SmartObject result(smart_objects::SmartType_Map);
+ result[kKeyStatus] = kKeyStatus + std::to_string(object_number);
+ result[kKeyValue] = kKeyValue + std::to_string(object_number);
+ if (use_id_key) {
+ result[kKeyId] = kKeyId + std::to_string(object_number);
+ }
+ return result;
+ }
+};
+
+TEST_F(RCHelpersTest,
+ MergeModuleData_OneOfParamsNotSmartMap_ExpectDataReplacedWithNewOne) {
+ SmartObject data1(SmartType_Map);
+ SmartObject data2(SmartType_Array);
+
+ const auto result = RCHelpers::MergeModuleData(data1, data2);
+ EXPECT_NE(result, data1);
+ EXPECT_EQ(result, data2);
+}
+
+TEST_F(RCHelpersTest,
+ MergeModuleData_FirstObjectDontContainKey_ExpectDataAppendedWithNewOne) {
+ SmartObject data1(SmartType_Map);
+ SmartObject data2(SmartType_Map);
+
+ std::map<std::string, std::string> expected_keys_values = {
+ {"key1", "value1"}, {"key2", "value2"}};
+ auto it = expected_keys_values.begin();
+
+ data1[it->first] = it->second;
+ ++it;
+ data2[it->first] = it->second;
+
+ const auto result = RCHelpers::MergeModuleData(data1, data2);
+ for (auto& item : expected_keys_values) {
+ EXPECT_TRUE(result.keyExists(item.first));
+ EXPECT_EQ(result[item.first], expected_keys_values[item.first]);
+ }
+}
+
+TEST_F(
+ RCHelpersTest,
+ MergeModuleData_SecondObjectContainsDifferentValueType_ExpectDataReplacedWithNewOne) {
+ SmartObject data1(SmartType_Map);
+ SmartObject data2(SmartType_Map);
+
+ data1["key1"] = "value1";
+ data2["key1"] = 30;
+
+ const auto result = RCHelpers::MergeModuleData(data1, data2);
+ EXPECT_EQ(data2["key1"], result["key1"]);
+}
+
+TEST_F(RCHelpersTest, MergeModuleData_Recursive) {
+ SmartObject data1(SmartType_Map);
+ SmartObject data2(SmartType_Map);
+
+ data1["key1"]["subkey1"] = "subvalue1";
+ data2["key1"]["subkey2"] = 30;
+
+ const auto result = RCHelpers::MergeModuleData(data1, data2);
+ EXPECT_EQ(result["key1"]["subkey1"], data1["key1"]["subkey1"]);
+ EXPECT_EQ(result["key1"]["subkey2"], data2["key1"]["subkey2"]);
+}
+
+TEST_F(
+ RCHelpersTest,
+ MergeModuleData_MergeObjectsThatContainArrays_ExpectDataReplacedWithNewOne) {
+ SmartObject data1(SmartType_Map);
+ SmartObject data1_array(SmartType_Array);
+ (*data1_array.asArray()) =
+ SmartArray{gen_smart_object(1, true), gen_smart_object(2, false)};
+ data1[kArray] = data1_array;
+
+ SmartObject data2(SmartType_Map);
+ SmartObject data2_array(SmartType_Array);
+ (*data2_array.asArray()) =
+ SmartArray{gen_smart_object(3, true), gen_smart_object(4, false)};
+ data2[kArray] = data2_array;
+
+ SmartObject expected_result(SmartType_Map);
+ SmartObject expected_result_array(SmartType_Array);
+ (*expected_result_array.asArray()) =
+ SmartArray{data2[kArray].getElement(0), data2[kArray].getElement(1)};
+
+ expected_result[kArray] = expected_result_array;
+
+ const auto result = RCHelpers::MergeModuleData(data1, data2);
+ EXPECT_EQ(expected_result, result);
+}
+
+TEST_F(RCHelpersTest,
+ MergeArray_OneOfParamsNotSmartArray_ExpectDataReplacedWithSecond) {
+ SmartObject data1(SmartType_Array);
+ SmartObject data2(SmartType_Map);
+
+ const auto result = RCHelpers::MergeArray(data1, data2);
+ EXPECT_NE(result, data1);
+ EXPECT_EQ(result, data2);
+}
+
+TEST_F(RCHelpersTest, MergeArray_FirstArrayEmpty_ExpectDataReplacedWithSecond) {
+ SmartObject data1(SmartType_Array);
+ SmartObject data2(SmartType_Array);
+ for (int object : {0, 1}) {
+ data2.asArray()->emplace(data2.asArray()->begin(), SmartObject(object));
+ }
+
+ ASSERT_EQ(0u, data1.length());
+ ASSERT_EQ(2u, data2.length());
+
+ const auto result = RCHelpers::MergeArray(data1, data2);
+ EXPECT_NE(result, data1);
+ EXPECT_EQ(result, data2);
+}
+
+TEST_F(RCHelpersTest,
+ MergeArray_SecondArrayEmpty_ExpectDataReplacedWithSecond) {
+ SmartObject data1(SmartType_Array);
+ for (int object : {0, 1}) {
+ data1.asArray()->emplace(data1.asArray()->begin(), SmartObject(object));
+ }
+ SmartObject data2(SmartType_Array);
+
+ ASSERT_EQ(2u, data1.length());
+ ASSERT_EQ(0u, data2.length());
+
+ const auto result = RCHelpers::MergeArray(data1, data2);
+ EXPECT_NE(result, data1);
+ EXPECT_EQ(result, data2);
+}
+
+TEST_F(RCHelpersTest, MergeArray_SimpleArrays_ExpectDataReplacedWithSecond) {
+ SmartObject data1(SmartType_Array);
+ for (int object : {0, 1, 2, 3, 4, 5}) {
+ data1.asArray()->emplace(data1.asArray()->begin(), SmartObject(object));
+ }
+
+ SmartObject data2(SmartType_Array);
+ for (int object : {0, 1}) {
+ data2.asArray()->emplace(data2.asArray()->begin(), SmartObject(object));
+ }
+
+ ASSERT_EQ(6u, data1.length());
+ ASSERT_EQ(2u, data2.length());
+
+ const auto result = RCHelpers::MergeArray(data1, data2);
+ EXPECT_NE(result, data1);
+ EXPECT_EQ(result, data2);
+}
+
+TEST_F(RCHelpersTest,
+ MergeArray_ObjectsHaveNotEqualIds_ExpectDataAppendedWithNewOne) {
+ SmartObject data1 = gen_smart_object(1, true);
+ SmartObject data2 = gen_smart_object(2, true);
+
+ SmartObject array1(SmartType_Array);
+ array1.asArray()->push_back(data1);
+ SmartObject array2(SmartType_Array);
+ array2.asArray()->push_back(data2);
+
+ SmartObject expected_array(SmartType_Array);
+ expected_array.asArray()->push_back(data1);
+ expected_array.asArray()->push_back(data2);
+ ASSERT_EQ(2u, expected_array.length());
+
+ const auto result = RCHelpers::MergeArray(array1, array2);
+ EXPECT_EQ(expected_array, result);
+}
+
+TEST_F(RCHelpersTest,
+ MergeArray_SomeObjectsDontHaveIdKey_ExpectDataReplacedWithSecond) {
+ int object_number = 1;
+
+ SmartObject array1(SmartType_Array);
+ array1.asArray()->push_back(gen_smart_object(object_number++, true));
+
+ SmartObject array2(SmartType_Array);
+ array2.asArray()->push_back(gen_smart_object(object_number++, false));
+ array2.asArray()->push_back(gen_smart_object(object_number++, true));
+
+ const auto result = RCHelpers::MergeArray(array1, array2);
+ EXPECT_EQ(array2, result);
+}
+
+TEST_F(
+ RCHelpersTest,
+ MergeArray_SomeObjectsHaveEqualIds_ExpectDataWithSameIdUpdateValueOnlyNewDataAdded) {
+ SmartObject temp = gen_smart_object(1, true);
+
+ SmartObject data1(SmartType_Array);
+ auto& data1_array = *data1.asArray();
+
+ data1_array.push_back(temp);
+ data1_array.push_back(gen_smart_object(2, true));
+
+ SmartObject data2(SmartType_Array);
+ auto& data2_array = *data2.asArray();
+
+ temp[kKeyValue] = "CUSTOM VALUE";
+ data2_array.push_back(temp);
+ data2_array.push_back(gen_smart_object(3, true));
+
+ SmartObject expected_result(SmartType_Array);
+ expected_result.asArray()->push_back(temp);
+ expected_result.asArray()->push_back(data1_array[1]);
+ expected_result.asArray()->push_back(data2_array[1]);
+
+ const auto result = RCHelpers::MergeArray(data1, data2);
+ EXPECT_EQ(expected_result, result);
+}
+
+} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt
new file mode 100644
index 0000000000..4b10d34643
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt
@@ -0,0 +1,83 @@
+# Copyright (c) 2019, Ford Motor Company
+# All rights reserved.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+
+# Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+
+# Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided with the
+# distribution.
+
+# Neither the name of the copyright holders nor the names of their contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
+
+include_directories (
+ ${GMOCK_INCLUDE_DIRECTORY}
+ ${COMPONENTS_DIR}/application_manager/test/include
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/include
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/test/include/
+ ${COMPONENTS_DIR}/include/test/application_manager/
+ ${COMPONENTS_DIR}/rc_rpc_plugin/test/include
+)
+
+set (RESOURCE_ALLOC_MANAGER_TEST_SOURCES
+${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_manager_impl.cc
+${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/interior_data_cache_impl.cc
+${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
+${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
+${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc
+${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_consent_manager_impl.cc
+${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
+${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc
+${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/test/mock_rc_helpers.cc
+${CMAKE_CURRENT_SOURCE_DIR}/resource_allocation_manager_impl_test.cc
+)
+
+set(RC_COMMANDS_TEST_SOURCE_DIR ${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/test/commands)
+set(RC_COMMANDS_SOURCE_DIR ${COMPONENTS_DIR}/application_manager/rpc_plugins/rc_rpc_plugin/src/commands)
+collect_sources(COMMANDS_SOURCES "${RC_COMMANDS_SOURCE_DIR}" "${RC_COMMANDS_TEST_SOURCE_DIR}")
+
+set(LIBRARIES
+ ApplicationManager
+ connectionHandler
+ SmartObjects
+ ProtocolHandler
+ MessageHelper
+ connectionHandler
+ Utils
+ Resumption
+ jsoncpp
+ gmock_main
+ dl
+)
+
+if(ENABLE_LOG)
+ list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
+ list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY})
+ list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY})
+ list(APPEND LIBRARIES expat -L${EXPAT_LIBS_DIRECTORY})
+endif()
+
+list(APPEND COMMANDS_SOURCES ${RESOURCE_ALLOC_MANAGER_TEST_SOURCES})
+
+create_test("resource_allocation_manager_test" "${COMMANDS_SOURCES}" "${LIBRARIES}")
+
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc
new file mode 100644
index 0000000000..70ed832cb1
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc
@@ -0,0 +1,886 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. */
+
+#include <algorithm>
+#include <memory>
+#include "gtest/gtest.h"
+
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_rpc_service.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+#include "rc_rpc_plugin/mock/mock_rc_capabilities_manager.h"
+#include "rc_rpc_plugin/mock/mock_rc_helpers.h"
+#include "rc_rpc_plugin/rc_module_constants.h"
+#include "rc_rpc_plugin/rc_rpc_plugin.h"
+#include "rc_rpc_plugin/resource_allocation_manager_impl.h"
+
+using test::components::application_manager_test::MockApplication;
+using test::components::application_manager_test::MockApplicationManager;
+using test::components::application_manager_test::MockRPCService;
+
+using ::application_manager::ApplicationSharedPtr;
+using ::application_manager::Message;
+using ::application_manager::MessageType;
+using ::protocol_handler::MessagePriority;
+using ::rc_rpc_plugin::MockRCHelpers;
+using ::testing::_;
+using ::testing::DoAll;
+using ::testing::Eq;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::SaveArg;
+using ::testing::SetArgPointee;
+using ::testing::StrictMock;
+
+namespace {
+const bool kDeviceHandle = 1u;
+const std::string kModuleType1 = "CLIMATE";
+const std::string kModuleType2 = "RADIO";
+const std::string kModuleId = "id1";
+const int32_t kConnectionKey = 5;
+const int32_t kCorrelationId = 5;
+const uint32_t kAppId1 = 11u;
+const uint32_t kHMIAppId1 = 1u;
+const uint32_t kAppId2 = 22u;
+const std::string policy_app_id_1_ = "policy_id_1";
+const uint32_t kSizeOfModules = 6u;
+const application_manager::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const rc_rpc_plugin::Grid KDefaultUserLocation = {2, 0, 0, 1, 1, 1};
+const rc_rpc_plugin::Grid kDriverLocation = {0, 0, 0, 1, 1, 1};
+const rc_rpc_plugin::Grid kInvalidLocation = {0, 0, 0, 0, 0, 0};
+const std::vector<std::string> kModuleList = {
+ rc_rpc_plugin::enums_value::kClimate,
+ rc_rpc_plugin::enums_value::kRadio,
+ rc_rpc_plugin::enums_value::kSeat,
+ rc_rpc_plugin::enums_value::kAudio,
+ rc_rpc_plugin::enums_value::kLight,
+ rc_rpc_plugin::enums_value::kHmiSettings};
+
+} // namespace
+
+namespace rc_rpc_plugin_test {
+
+using namespace rc_rpc_plugin;
+
+typedef std::shared_ptr<MockRCHelpers> MockRCHelpersPtr;
+
+class RAManagerTest : public ::testing::Test {
+ public:
+ RAManagerTest()
+ : message_(std::make_shared<Message>(MessagePriority::FromServiceType(
+ protocol_handler::ServiceType::kRpc)))
+ , mock_app_1_(std::make_shared<NiceMock<MockApplication> >())
+ , mock_app_2_(std::make_shared<NiceMock<MockApplication> >())
+ , apps_lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , apps_da_(apps_, apps_lock_ptr_)
+ , module_service_area_(0, 0, 0, 3, 2, 1)
+ , mock_rc_helpers_(MockRCHelpers::rc_helpers_mock()) {
+ ON_CALL(mock_app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ auto plugin_id = rc_rpc_plugin::RCRPCPlugin::kRCPluginID;
+ app_ext_ptr_ = std::make_shared<rc_rpc_plugin::RCAppExtension>(plugin_id);
+ ON_CALL(*mock_app_1_, app_id()).WillByDefault(Return(kAppId1));
+
+ PrepareResources();
+ ON_CALL(mock_rc_capabilities_manager_, GetResources())
+ .WillByDefault(Return(resources_));
+ ON_CALL(mock_rc_capabilities_manager_, IsSeatLocationCapabilityProvided())
+ .WillByDefault(Return(false));
+ ON_CALL(mock_rc_capabilities_manager_, IsMultipleAccessAllowed(_))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_rc_capabilities_manager_, GetModuleServiceArea(_))
+ .WillByDefault(Return(module_service_area_));
+
+ ON_CALL(mock_app_mngr_, application(kAppId1))
+ .WillByDefault(Return(mock_app_1_));
+ ON_CALL(*mock_app_1_,
+ QueryInterface(rc_rpc_plugin::RCRPCPlugin::kRCPluginID))
+ .WillByDefault(Return(app_ext_ptr_));
+
+ ON_CALL(mock_app_mngr_, application(kAppId2))
+ .WillByDefault(Return(mock_app_2_));
+ ON_CALL(*mock_app_2_,
+ QueryInterface(rc_rpc_plugin::RCRPCPlugin::kRCPluginID))
+ .WillByDefault(Return(app_ext_ptr_));
+
+ OnRCStatusNotificationExpectations();
+ }
+
+ void SetUp() OVERRIDE {
+ rc_app_extension_ = std::make_shared<rc_rpc_plugin::RCAppExtension>(
+ static_cast<application_manager::AppExtensionUID>(
+ rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
+ ON_CALL(mock_rc_capabilities_manager_,
+ GetDriverLocationFromSeatLocationCapability())
+ .WillByDefault(Return(kDriverLocation));
+ ON_CALL(*mock_rc_helpers_, GetRCExtension(_))
+ .WillByDefault(Return(rc_app_extension_));
+ }
+
+ void CheckResultWithHMILevelAndAccessMode(
+ ResourceAllocationManagerImpl& ra_manager,
+ mobile_apis::HMILevel::eType app_level,
+ const rc_rpc_plugin::AcquireResult::eType expected_result,
+ const hmi_apis::Common_RCAccessMode::eType access_mode);
+
+ void PrepareResources();
+ void OnRCStatusNotificationExpectations();
+
+ protected:
+ NiceMock<MockApplicationManager> mock_app_mngr_;
+ NiceMock<MockRPCService> mock_rpc_service_;
+ test::components::policy_test::MockPolicyHandlerInterface
+ mock_policy_handler_;
+ application_manager::MessagePtr message_;
+
+ application_manager::AppExtensionPtr app_ext_ptr_;
+ std::shared_ptr<NiceMock<MockApplication> > mock_app_1_;
+ std::shared_ptr<NiceMock<MockApplication> > mock_app_2_;
+ application_manager::ApplicationSet apps_;
+ std::shared_ptr<sync_primitives::Lock> apps_lock_ptr_;
+ DataAccessor<application_manager::ApplicationSet> apps_da_;
+ testing::NiceMock<rc_rpc_plugin_test::MockRCCapabilitiesManager>
+ mock_rc_capabilities_manager_;
+ std::vector<ModuleUid> resources_;
+ Grid module_service_area_;
+ RCAppExtensionPtr rc_app_extension_;
+ MockRCHelpers* mock_rc_helpers_;
+};
+
+void RAManagerTest::CheckResultWithHMILevelAndAccessMode(
+ ResourceAllocationManagerImpl& ra_manager,
+ mobile_apis::HMILevel::eType app_level,
+ const AcquireResult::eType expected_result,
+ const hmi_apis::Common_RCAccessMode::eType access_mode) {
+ // Arrange
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillOnce(Return(mock_app_1_));
+ ra_manager.SetAccessMode(access_mode);
+
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ ra_manager.SetResourceAcquired(kModuleType1, kModuleId, kAppId1);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId2))
+ .WillOnce(Return(mock_app_2_));
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
+ .WillOnce(Return(app_level));
+ // Second app tries to get already acquired resource by 1st app
+ EXPECT_EQ(expected_result,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+}
+
+void RAManagerTest::PrepareResources() {
+ for (auto& module_type : kModuleList) {
+ ModuleUid module(module_type, kModuleId);
+ resources_.push_back(module);
+ }
+}
+
+void RAManagerTest::OnRCStatusNotificationExpectations() {
+ apps_.insert(mock_app_1_);
+ ON_CALL(mock_app_mngr_, applications()).WillByDefault(Return(apps_da_));
+}
+
+TEST_F(RAManagerTest, AcquireResource_NoAppRegistered_Expect_InUse) {
+ // Arrange
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillOnce(Return(ApplicationSharedPtr()));
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ // Act & Assert
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+}
+
+TEST_F(RAManagerTest,
+ AcquireResource_AppRegisteredAnyHmiLevelResourceFree_Expect_Allowed) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ // Act & Assert
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+}
+
+TEST_F(
+ RAManagerTest,
+ AcquireResource_AppInAnyHmiLevelWantsToAcquireSameResourceTwice_Expect_Allowed) {
+ // Arrange
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillOnce(Return(mock_app_1_));
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillOnce(Return(mock_app_1_));
+ // Same app tries to get already acquired resource
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+}
+
+TEST_F(
+ RAManagerTest,
+ AcquireResource_App2_NotInFULLWantsToGetAcquiredResource_Expect_Rejected) {
+ using namespace mobile_apis;
+ using namespace hmi_apis;
+ using namespace rc_rpc_plugin;
+ const HMILevel::eType app_level = HMILevel::eType::HMI_BACKGROUND;
+ const AcquireResult::eType expected_result = AcquireResult::REJECTED;
+ const Common_RCAccessMode::eType access_mode =
+ Common_RCAccessMode::eType::AUTO_ALLOW;
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ CheckResultWithHMILevelAndAccessMode(
+ ra_manager, app_level, expected_result, access_mode);
+}
+
+TEST_F(
+ RAManagerTest,
+ AcquireResource_App2_InFULLWantsToGetAcquiredResource_AUTO_DENY_Expect_InUse) {
+ using namespace mobile_apis;
+ using namespace hmi_apis;
+ using namespace rc_rpc_plugin;
+ const HMILevel::eType app_level = HMILevel::eType::HMI_FULL;
+ const AcquireResult::eType expected_result = AcquireResult::IN_USE;
+ const Common_RCAccessMode::eType access_mode =
+ Common_RCAccessMode::eType::AUTO_DENY;
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ CheckResultWithHMILevelAndAccessMode(
+ ra_manager, app_level, expected_result, access_mode);
+}
+
+TEST_F(
+ RAManagerTest,
+ AcquireResource_App2_InFULLWantsToGetAcquiredResource_AUTO_ALLOW_Expect_Allowed) {
+ using namespace mobile_apis;
+ using namespace hmi_apis;
+ using namespace rc_rpc_plugin;
+ const HMILevel::eType app_level = HMILevel::eType::HMI_FULL;
+ const AcquireResult::eType expected_result = AcquireResult::ALLOWED;
+ const Common_RCAccessMode::eType access_mode =
+ Common_RCAccessMode::eType::AUTO_ALLOW;
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ CheckResultWithHMILevelAndAccessMode(
+ ra_manager, app_level, expected_result, access_mode);
+}
+
+TEST_F(
+ RAManagerTest,
+ AcquireResource_App2_InFULLWantsToGetAcquiredResource_ASK_DRIVER_Expect_AskDriver) {
+ using namespace mobile_apis;
+ using namespace hmi_apis;
+ using namespace rc_rpc_plugin;
+ const HMILevel::eType app_level = HMILevel::eType::HMI_FULL;
+ const AcquireResult::eType expected_result = AcquireResult::ASK_DRIVER;
+ const Common_RCAccessMode::eType access_mode =
+ Common_RCAccessMode::eType::ASK_DRIVER;
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ CheckResultWithHMILevelAndAccessMode(
+ ra_manager, app_level, expected_result, access_mode);
+}
+
+TEST_F(RAManagerTest,
+ AcquireResource_AcquiredModuleIsRejectedForApp2_ExpectApp2Rejected) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillRepeatedly(Return(mock_app_1_));
+ EXPECT_EQ(AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ ra_manager.SetResourceAcquired(kModuleType1, kModuleId, kAppId1);
+
+ // Act
+ ra_manager.OnDriverDisallowed(kModuleType1, kModuleId, kAppId2);
+
+ // Assert
+ EXPECT_CALL(mock_app_mngr_, application(kAppId2))
+ .WillOnce(Return(mock_app_2_));
+ EXPECT_EQ(AcquireResult::REJECTED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+}
+
+TEST_F(RAManagerTest, AppExit_ReleaseResource) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillRepeatedly(Return(mock_app_1_));
+
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ // Act
+ ra_manager.OnApplicationEvent(
+ application_manager::plugin_manager::kApplicationExit, mock_app_1_);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId2))
+ .WillRepeatedly(Return(mock_app_2_));
+
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+}
+
+TEST_F(RAManagerTest, AnotherAppExit_NoReleaseResource) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillOnce(Return(mock_app_1_));
+
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ ra_manager.SetResourceAcquired(kModuleType1, kModuleId, kAppId1);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId2))
+ .WillRepeatedly(Return(mock_app_2_));
+
+ // Act
+ application_manager::ApplicationSharedPtr app_ptr(mock_app_2_);
+ EXPECT_CALL(*mock_app_2_, app_id()).WillRepeatedly(Return(kAppId2));
+ ra_manager.OnApplicationEvent(
+ application_manager::plugin_manager::kApplicationExit, app_ptr);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId2))
+ .WillOnce(Return(mock_app_2_));
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
+ .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+}
+
+TEST_F(RAManagerTest, AppUnregistered_ReleaseResource) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
+
+ RCAppExtensionPtr rc_extention_ptr =
+ std::make_shared<RCAppExtension>(application_manager::AppExtensionUID(
+ rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
+
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ // Act
+ application_manager::ApplicationSharedPtr app_ptr(mock_app_1_);
+ EXPECT_CALL(*mock_app_1_, app_id()).WillRepeatedly(Return(kAppId1));
+
+ ra_manager.OnApplicationEvent(
+ application_manager::plugin_manager::kApplicationUnregistered, app_ptr);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId2))
+ .WillOnce(Return(mock_app_2_));
+
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+}
+
+TEST_F(RAManagerTest, AnotherAppUnregistered_NoReleaseResource) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillOnce(Return(mock_app_1_));
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ ra_manager.SetResourceAcquired(kModuleType1, kModuleId, kAppId1);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillRepeatedly(Return(mock_app_2_));
+
+ // Act
+ application_manager::ApplicationSharedPtr app_ptr(mock_app_2_);
+ EXPECT_CALL(*mock_app_2_, app_id()).WillRepeatedly(Return(kAppId2));
+
+ ra_manager.OnApplicationEvent(
+ application_manager::plugin_manager::kApplicationUnregistered, app_ptr);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId2))
+ .WillOnce(Return(mock_app_2_));
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
+ .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+}
+
+TEST_F(RAManagerTest, AppsDisallowed_ReleaseAllResources) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillRepeatedly(Return(mock_app_1_));
+
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType2, kModuleId, kAppId1));
+
+ application_manager::ApplicationSet apps;
+ apps.insert(mock_app_1_);
+ std::shared_ptr<sync_primitives::Lock> apps_lock =
+ std::make_shared<sync_primitives::Lock>();
+ DataAccessor<application_manager::ApplicationSet> apps_da(apps, apps_lock);
+
+ EXPECT_CALL(mock_app_mngr_, applications()).WillRepeatedly(Return(apps_da));
+
+ RCAppExtensionPtr rc_extention_ptr =
+ std::make_shared<RCAppExtension>(application_manager::AppExtensionUID(
+ rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
+
+ EXPECT_CALL(*mock_app_1_, QueryInterface(RCRPCPlugin::kRCPluginID))
+ .WillRepeatedly(Return(rc_extention_ptr));
+
+ // Act
+ ra_manager.OnPolicyEvent(
+ application_manager::plugin_manager::PolicyEvent::kApplicationsDisabled);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId2))
+ .WillRepeatedly(Return(mock_app_2_));
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
+ .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType2, kModuleId, kAppId2));
+ Mock::VerifyAndClearExpectations(&mock_app_mngr_);
+}
+
+TEST_F(RAManagerTest, AppGotRevokedModulesWithPTU_ReleaseRevokedResource) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillRepeatedly(Return(mock_app_1_));
+
+ RCAppExtensionPtr rc_extention_ptr =
+ std::make_shared<rc_rpc_plugin::RCAppExtension>(
+ application_manager::AppExtensionUID(
+ rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
+
+ EXPECT_CALL(*mock_app_1_, QueryInterface(RCRPCPlugin::kRCPluginID))
+ .WillRepeatedly(Return(rc_extention_ptr));
+
+ ON_CALL(*mock_app_1_, is_remote_control_supported())
+ .WillByDefault(Return(true));
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId1))
+ .WillRepeatedly(Return(mock_app_1_));
+
+ EXPECT_CALL(*mock_app_1_, app_id()).WillRepeatedly(Return(kAppId1));
+
+ EXPECT_CALL(*mock_app_1_, policy_app_id())
+ .WillRepeatedly(Return(policy_app_id_1_));
+
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ ra_manager.SetResourceAcquired(kModuleType1, kModuleId, kAppId1);
+
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType2, kModuleId, kAppId1));
+ ra_manager.SetResourceAcquired(kModuleType2, kModuleId, kAppId1);
+
+ application_manager::ApplicationSet apps;
+ apps.insert(mock_app_1_);
+ std::shared_ptr<sync_primitives::Lock> apps_lock =
+ std::make_shared<sync_primitives::Lock>();
+ DataAccessor<application_manager::ApplicationSet> apps_da(apps, apps_lock);
+
+ EXPECT_CALL(mock_app_mngr_, applications()).WillRepeatedly(Return(apps_da));
+
+ std::vector<std::string> allowed_modules;
+ allowed_modules.push_back(kModuleType1);
+
+ EXPECT_CALL(mock_policy_handler_, GetModuleTypes(policy_app_id_1_, _))
+ .WillOnce(DoAll(SetArgPointee<1>(allowed_modules), Return(true)));
+
+ EXPECT_CALL(mock_app_mngr_, application(kAppId2))
+ .WillRepeatedly(Return(mock_app_2_));
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
+ .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
+
+ // Act
+ ra_manager.OnPolicyEvent(application_manager::plugin_manager::PolicyEvent::
+ kApplicationPolicyUpdated);
+
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType2, kModuleId, kAppId2));
+ Mock::VerifyAndClearExpectations(&mock_app_mngr_);
+}
+
+TEST_F(RAManagerTest, GetAccessMode_ExpectedSameAsHadSet) {
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::AUTO_DENY);
+ EXPECT_EQ(hmi_apis::Common_RCAccessMode::AUTO_DENY,
+ ra_manager.GetAccessMode());
+
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::ASK_DRIVER);
+ EXPECT_EQ(hmi_apis::Common_RCAccessMode::ASK_DRIVER,
+ ra_manager.GetAccessMode());
+
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::AUTO_ALLOW);
+ EXPECT_EQ(hmi_apis::Common_RCAccessMode::AUTO_ALLOW,
+ ra_manager.GetAccessMode());
+
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::INVALID_ENUM);
+ EXPECT_EQ(hmi_apis::Common_RCAccessMode::INVALID_ENUM,
+ ra_manager.GetAccessMode());
+}
+
+TEST_F(RAManagerTest, OnRCStatus_AppRegistation_RC_allowed) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ ON_CALL((*mock_app_1_), is_remote_control_supported())
+ .WillByDefault(Return(true));
+ ON_CALL((*mock_app_1_), hmi_app_id()).WillByDefault(Return(kHMIAppId1));
+
+ application_manager::commands::MessageSharedPtr message_to_mob;
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false))
+ .WillOnce(SaveArg<0>(&message_to_mob));
+ application_manager::commands::MessageSharedPtr message_to_hmi;
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0);
+
+ // Act
+ ra_manager.SendOnRCStatusNotifications(NotificationTrigger::APP_REGISTRATION,
+ mock_app_1_);
+
+ auto msg_to_mob_params =
+ (*message_to_mob)[application_manager::strings::msg_params];
+
+ // Assert
+ EXPECT_EQ(msg_to_mob_params[message_params::kAllowed].asBool(), true);
+ EXPECT_EQ(
+ msg_to_mob_params[message_params::kAllocatedModules].asArray()->size(),
+ 0u);
+ EXPECT_EQ(msg_to_mob_params[message_params::kFreeModules].asArray()->size(),
+ kSizeOfModules);
+}
+
+TEST_F(RAManagerTest, OnRCStatus_AppRegistation_RC_disallowed) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ ra_manager.set_rc_enabled(false);
+
+ ON_CALL((*mock_app_1_), is_remote_control_supported())
+ .WillByDefault(Return(true));
+
+ application_manager::commands::MessageSharedPtr message_to_mob;
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false))
+ .WillOnce(SaveArg<0>(&message_to_mob));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0);
+
+ // Act
+ ra_manager.SendOnRCStatusNotifications(NotificationTrigger::APP_REGISTRATION,
+ mock_app_1_);
+
+ auto msg_to_mob_params =
+ (*message_to_mob)[application_manager::strings::msg_params];
+ // Assert
+ EXPECT_EQ(msg_to_mob_params[message_params::kAllowed].asBool(), false);
+ EXPECT_EQ(
+ msg_to_mob_params[message_params::kAllocatedModules].asArray()->size(),
+ 0u);
+ EXPECT_EQ(msg_to_mob_params[message_params::kFreeModules].asArray()->size(),
+ 0u);
+}
+
+TEST_F(RAManagerTest, OnRCStatus_RCStateChanging_RC_disabling) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ ON_CALL((*mock_app_1_), is_remote_control_supported())
+ .WillByDefault(Return(true));
+ ON_CALL((*mock_app_1_), hmi_app_id()).WillByDefault(Return(kHMIAppId1));
+
+ application_manager::commands::MessageSharedPtr message_to_mob;
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false))
+ .WillOnce(SaveArg<0>(&message_to_mob));
+ application_manager::commands::MessageSharedPtr message_to_hmi;
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_))
+ .WillOnce(SaveArg<0>(&message_to_hmi));
+
+ // Act
+ ra_manager.set_rc_enabled(false);
+
+ auto msg_to_mob_params =
+ (*message_to_mob)[application_manager::strings::msg_params];
+ auto msg_to_hmi_params =
+ (*message_to_hmi)[application_manager::strings::msg_params];
+ // Assert
+ EXPECT_EQ(msg_to_mob_params[message_params::kAllowed].asBool(), false);
+ EXPECT_EQ(
+ msg_to_mob_params[message_params::kAllocatedModules].asArray()->size(),
+ 0u);
+ EXPECT_EQ(msg_to_mob_params[message_params::kFreeModules].asArray()->size(),
+ 0u);
+ EXPECT_EQ(
+ msg_to_hmi_params[message_params::kAllocatedModules].asArray()->size(),
+ 0u);
+ EXPECT_EQ(msg_to_hmi_params[message_params::kFreeModules].asArray()->size(),
+ kSizeOfModules);
+ EXPECT_EQ(msg_to_hmi_params[application_manager::strings::app_id].asInt(),
+ kHMIAppId1);
+}
+
+TEST_F(RAManagerTest, OnRCStatus_RCStateChanging_RC_enabling) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+ ON_CALL((*mock_app_1_), is_remote_control_supported())
+ .WillByDefault(Return(true));
+ ON_CALL((*mock_app_1_), hmi_app_id()).WillByDefault(Return(kHMIAppId1));
+
+ application_manager::commands::MessageSharedPtr message_to_mob;
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false))
+ .WillOnce(SaveArg<0>(&message_to_mob));
+ application_manager::commands::MessageSharedPtr message_to_hmi;
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_))
+ .WillOnce(SaveArg<0>(&message_to_hmi));
+
+ // Act
+ ra_manager.set_rc_enabled(true);
+
+ auto msg_to_mob_params =
+ (*message_to_mob)[application_manager::strings::msg_params];
+ auto msg_to_hmi_params =
+ (*message_to_hmi)[application_manager::strings::msg_params];
+ // Assert
+ EXPECT_EQ(msg_to_mob_params[message_params::kAllowed].asBool(), true);
+ EXPECT_EQ(
+ msg_to_mob_params[message_params::kAllocatedModules].asArray()->size(),
+ 0u);
+ EXPECT_EQ(msg_to_mob_params[message_params::kFreeModules].asArray()->size(),
+ kSizeOfModules);
+ EXPECT_EQ(
+ msg_to_hmi_params[message_params::kAllocatedModules].asArray()->size(),
+ 0u);
+ EXPECT_EQ(msg_to_hmi_params[message_params::kFreeModules].asArray()->size(),
+ kSizeOfModules);
+ EXPECT_EQ(msg_to_hmi_params[application_manager::strings::app_id].asInt(),
+ kHMIAppId1);
+}
+
+TEST_F(RAManagerTest, OnRCStatus_ModuleAllocation) {
+ // Arrange
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+
+ ON_CALL((*mock_app_1_), is_remote_control_supported())
+ .WillByDefault(Return(true));
+ ON_CALL((*mock_app_1_), hmi_app_id()).WillByDefault(Return(kHMIAppId1));
+
+ EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ ra_manager.SetResourceAcquired(kModuleType1, kModuleId, kAppId1);
+
+ application_manager::commands::MessageSharedPtr message_to_mob;
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false))
+ .WillOnce(SaveArg<0>(&message_to_mob));
+
+ application_manager::commands::MessageSharedPtr message_to_hmi;
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_))
+ .WillOnce(SaveArg<0>(&message_to_hmi));
+
+ // Act
+ ra_manager.SendOnRCStatusNotifications(
+ NotificationTrigger::MODULE_ALLOCATION,
+ std::shared_ptr<application_manager::Application>());
+
+ auto msg_to_mob_params =
+ (*message_to_mob)[application_manager::strings::msg_params];
+ auto msg_to_hmi_params =
+ (*message_to_hmi)[application_manager::strings::msg_params];
+ // Assert
+ EXPECT_EQ(msg_to_mob_params[message_params::kAllowed].asBool(), true);
+ EXPECT_EQ(
+ msg_to_mob_params[message_params::kAllocatedModules].asArray()->size(),
+ 1u);
+ EXPECT_EQ(msg_to_mob_params[message_params::kFreeModules].asArray()->size(),
+ kSizeOfModules - 1u);
+ EXPECT_EQ(
+ msg_to_hmi_params[message_params::kAllocatedModules].asArray()->size(),
+ 1u);
+ EXPECT_EQ(msg_to_hmi_params[message_params::kFreeModules].asArray()->size(),
+ kSizeOfModules - 1u);
+ EXPECT_EQ(msg_to_hmi_params[application_manager::strings::app_id].asInt(),
+ kHMIAppId1);
+}
+
+// UL - User Location
+// If User Location is invalid, in any case AcquireResult will be REJECTED
+TEST_F(RAManagerTest, AcquireResource_UL_IsInvalid_REJECTED) {
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+
+ ON_CALL(mock_rc_capabilities_manager_, IsSeatLocationCapabilityProvided())
+ .WillByDefault(Return(true));
+ rc_app_extension_->SetUserLocation(kInvalidLocation);
+
+ EXPECT_EQ(AcquireResult::REJECTED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+}
+
+// UL - User Location, MA - Multiple Access
+TEST_F(RAManagerTest,
+ AcquireResource_UL_IsValid_ResourceIsFree_MA_False_ALLOWED) {
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+
+ ON_CALL(mock_rc_capabilities_manager_, IsSeatLocationCapabilityProvided())
+ .WillByDefault(Return(true));
+ rc_app_extension_->SetUserLocation(KDefaultUserLocation);
+
+ EXPECT_EQ(AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+}
+
+// UL - User Location, MA - Multiple Access
+TEST_F(RAManagerTest,
+ AcquireResource_UL_IsValid_ResourceIsAcquired_MA_False_REJECTED) {
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+
+ ON_CALL(mock_rc_capabilities_manager_, IsSeatLocationCapabilityProvided())
+ .WillByDefault(Return(true));
+ rc_app_extension_->SetUserLocation(KDefaultUserLocation);
+
+ EXPECT_EQ(AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ ra_manager.SetResourceAcquired(kModuleType1, kModuleId, kAppId1);
+ ON_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
+ ON_CALL(mock_rc_capabilities_manager_, IsMultipleAccessAllowed(_))
+ .WillByDefault(Return(false));
+ EXPECT_EQ(AcquireResult::REJECTED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+}
+
+// UL - User Location, MA - Multiple Access
+TEST_F(RAManagerTest,
+ AcquireResource_UL_IsValid_ResourceIsFree_MA_True_ALLOWED) {
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+
+ ON_CALL(mock_rc_capabilities_manager_, IsSeatLocationCapabilityProvided())
+ .WillByDefault(Return(true));
+ rc_app_extension_->SetUserLocation(KDefaultUserLocation);
+
+ EXPECT_EQ(AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ ON_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
+ EXPECT_EQ(AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+}
+
+// UL - User Location, MA - Multiple Access, AM - Access Mode
+TEST_F(RAManagerTest,
+ AcquireResource_UL_IsValid_ResourceIsAcquired_MA_True_AM_AUTO_DENY) {
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+
+ ON_CALL(mock_rc_capabilities_manager_, IsSeatLocationCapabilityProvided())
+ .WillByDefault(Return(true));
+ rc_app_extension_->SetUserLocation(KDefaultUserLocation);
+
+ EXPECT_EQ(AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ ra_manager.SetResourceAcquired(kModuleType1, kModuleId, kAppId1);
+
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::AUTO_DENY);
+
+ ON_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
+ EXPECT_EQ(AcquireResult::IN_USE,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+}
+
+TEST_F(RAManagerTest,
+ AcquireResource_UL_IsValid_ResourceIsAcquired_MA_True_AM_ASK_DRIVER) {
+ ResourceAllocationManagerImpl ra_manager(
+ mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_);
+
+ ON_CALL(mock_rc_capabilities_manager_, IsSeatLocationCapabilityProvided())
+ .WillByDefault(Return(true));
+ rc_app_extension_->SetUserLocation(KDefaultUserLocation);
+
+ EXPECT_EQ(AcquireResult::ALLOWED,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1));
+
+ ra_manager.SetResourceAcquired(kModuleType1, kModuleId, kAppId1);
+
+ ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::ASK_DRIVER);
+
+ ON_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
+ EXPECT_EQ(AcquireResult::ASK_DRIVER,
+ ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId2));
+}
+
+} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc
deleted file mode 100644
index 26840a1b33..0000000000
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * Copyright (c) 2018, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE. */
-
-#include <algorithm>
-#include "gtest/gtest.h"
-
-#include "rc_rpc_plugin/resource_allocation_manager_impl.h"
-#include "rc_rpc_plugin/rc_rpc_plugin.h"
-#include "application_manager/mock_application.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_rpc_service.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-#include "interfaces/HMI_API.h"
-#include "interfaces/MOBILE_API.h"
-
-using test::components::application_manager_test::MockApplication;
-using test::components::application_manager_test::MockApplicationManager;
-using test::components::application_manager_test::MockRPCService;
-
-using ::testing::_;
-using ::testing::Mock;
-using ::testing::NiceMock;
-using ::testing::StrictMock;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::SaveArg;
-using ::testing::Eq;
-using ::testing::DoAll;
-using ::testing::SetArgPointee;
-using ::application_manager::Message;
-using ::application_manager::MessageType;
-using ::application_manager::ApplicationSharedPtr;
-using ::protocol_handler::MessagePriority;
-
-namespace {
-const bool kDeviceHandle = 1u;
-const std::string kModuleType1 = "CLIMATE";
-const std::string kModuleType2 = "RADIO";
-const int32_t kConnectionKey = 5;
-const int32_t kCorrelationId = 5;
-const uint32_t kAppId1 = 11u;
-const uint32_t kAppId2 = 22u;
-const std::string policy_app_id_1_ = "policy_id_1";
-}
-
-namespace rc_rpc_plugin_test {
-
-using namespace rc_rpc_plugin;
-
-class RAManagerTest : public ::testing::Test {
- public:
- RAManagerTest()
- : message_(utils::MakeShared<Message>(MessagePriority::FromServiceType(
- protocol_handler::ServiceType::kRpc)))
- , mock_app_1_(utils::MakeShared<NiceMock<MockApplication> >())
- , mock_app_2_(utils::MakeShared<NiceMock<MockApplication> >())
- , apps_lock_ptr_(std::make_shared<sync_primitives::Lock>())
- , apps_da_(apps_, apps_lock_ptr_) {
- ON_CALL(mock_app_mngr_, GetPolicyHandler())
- .WillByDefault(ReturnRef(mock_policy_handler_));
- auto plugin_id = rc_rpc_plugin::RCRPCPlugin::kRCPluginID;
- app_ext_ptr_ = utils::MakeShared<rc_rpc_plugin::RCAppExtension>(plugin_id);
- ON_CALL(*mock_app_1_, app_id()).WillByDefault(Return(kAppId1));
- }
-
- void CheckResultWithHMILevelAndAccessMode(
- ResourceAllocationManagerImpl& ra_manager,
- mobile_apis::HMILevel::eType app_level,
- const rc_rpc_plugin::AcquireResult::eType expected_result,
- const hmi_apis::Common_RCAccessMode::eType access_mode);
-
- protected:
- NiceMock<MockApplicationManager> mock_app_mngr_;
- NiceMock<MockRPCService> mock_rpc_service_;
- test::components::policy_test::MockPolicyHandlerInterface
- mock_policy_handler_;
- application_manager::MessagePtr message_;
-
- application_manager::AppExtensionPtr app_ext_ptr_;
- utils::SharedPtr<NiceMock<MockApplication> > mock_app_1_;
- utils::SharedPtr<NiceMock<MockApplication> > mock_app_2_;
- application_manager::ApplicationSet apps_;
- std::shared_ptr<sync_primitives::Lock> apps_lock_ptr_;
- DataAccessor<application_manager::ApplicationSet> apps_da_;
-};
-
-void RAManagerTest::CheckResultWithHMILevelAndAccessMode(
- ResourceAllocationManagerImpl& ra_manager,
- mobile_apis::HMILevel::eType app_level,
- const AcquireResult::eType expected_result,
- const hmi_apis::Common_RCAccessMode::eType access_mode) {
- // Arrange
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillOnce(Return(mock_app_1_));
- ra_manager.SetAccessMode(access_mode);
-
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
- EXPECT_CALL(mock_app_mngr_, application(kAppId2))
- .WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level()).WillOnce(Return(app_level));
- // Second app tries to get already acquired resource by 1st app
- EXPECT_EQ(expected_result, ra_manager.AcquireResource(kModuleType1, kAppId2));
-}
-
-TEST_F(RAManagerTest, AcquireResource_NoAppRegistered_Expect_InUse) {
- // Arrange
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillOnce(Return(ApplicationSharedPtr()));
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- // Act & Assert
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-}
-
-TEST_F(RAManagerTest,
- AcquireResource_AppRegisteredAnyHmiLevelResourceFree_Expect_Allowed) {
- // Arrange
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillOnce(Return(mock_app_1_));
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- // Act & Assert
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-}
-
-TEST_F(
- RAManagerTest,
- AcquireResource_AppInAnyHmiLevelWantsToAcquireSameResourceTwice_Expect_Allowed) {
- // Arrange
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillOnce(Return(mock_app_1_));
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillOnce(Return(mock_app_1_));
- // Same app tries to get already acquired resource
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-}
-
-TEST_F(
- RAManagerTest,
- AcquireResource_App2_NotInFULLWantsToGetAcquiredResource_Expect_Rejected) {
- using namespace mobile_apis;
- using namespace hmi_apis;
- using namespace rc_rpc_plugin;
- const HMILevel::eType app_level = HMILevel::eType::HMI_BACKGROUND;
- const AcquireResult::eType expected_result = AcquireResult::REJECTED;
- const Common_RCAccessMode::eType access_mode =
- Common_RCAccessMode::eType::AUTO_ALLOW;
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- CheckResultWithHMILevelAndAccessMode(
- ra_manager, app_level, expected_result, access_mode);
-}
-
-TEST_F(
- RAManagerTest,
- AcquireResource_App2_InFULLWantsToGetAcquiredResource_AUTO_DENY_Expect_InUse) {
- using namespace mobile_apis;
- using namespace hmi_apis;
- using namespace rc_rpc_plugin;
- const HMILevel::eType app_level = HMILevel::eType::HMI_FULL;
- const AcquireResult::eType expected_result = AcquireResult::IN_USE;
- const Common_RCAccessMode::eType access_mode =
- Common_RCAccessMode::eType::AUTO_DENY;
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- CheckResultWithHMILevelAndAccessMode(
- ra_manager, app_level, expected_result, access_mode);
-}
-
-TEST_F(
- RAManagerTest,
- AcquireResource_App2_InFULLWantsToGetAcquiredResource_AUTO_ALLOW_Expect_Allowed) {
- using namespace mobile_apis;
- using namespace hmi_apis;
- using namespace rc_rpc_plugin;
- const HMILevel::eType app_level = HMILevel::eType::HMI_FULL;
- const AcquireResult::eType expected_result = AcquireResult::ALLOWED;
- const Common_RCAccessMode::eType access_mode =
- Common_RCAccessMode::eType::AUTO_ALLOW;
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- CheckResultWithHMILevelAndAccessMode(
- ra_manager, app_level, expected_result, access_mode);
-}
-
-TEST_F(
- RAManagerTest,
- AcquireResource_App2_InFULLWantsToGetAcquiredResource_ASK_DRIVER_Expect_AskDriver) {
- using namespace mobile_apis;
- using namespace hmi_apis;
- using namespace rc_rpc_plugin;
- const HMILevel::eType app_level = HMILevel::eType::HMI_FULL;
- const AcquireResult::eType expected_result = AcquireResult::ASK_DRIVER;
- const Common_RCAccessMode::eType access_mode =
- Common_RCAccessMode::eType::ASK_DRIVER;
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- CheckResultWithHMILevelAndAccessMode(
- ra_manager, app_level, expected_result, access_mode);
-}
-
-TEST_F(RAManagerTest,
- AcquireResource_AcquiredModuleIsRejectedForApp2_ExpectApp2Rejected) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillRepeatedly(Return(mock_app_1_));
- EXPECT_EQ(AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-
- // Act
- ra_manager.OnDriverDisallowed(kModuleType1, kAppId2);
-
- // Assert
- EXPECT_CALL(mock_app_mngr_, application(kAppId2))
- .WillOnce(Return(mock_app_2_));
- EXPECT_EQ(AcquireResult::REJECTED,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
-}
-
-TEST_F(RAManagerTest, AppExit_ReleaseResource) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillRepeatedly(Return(mock_app_1_));
-
- RCAppExtensionPtr rc_extention_ptr =
- utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
-
- EXPECT_CALL(*mock_app_1_, QueryInterface(_))
- .WillOnce(Return(rc_extention_ptr));
-
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-
- // Act
- ra_manager.OnApplicationEvent(
- application_manager::plugin_manager::kApplicationExit, mock_app_1_);
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId2))
- .WillRepeatedly(Return(mock_app_2_));
-
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
-}
-
-TEST_F(RAManagerTest, AnotherAppExit_NoReleaseResource) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillOnce(Return(mock_app_1_));
-
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId2))
- .WillRepeatedly(Return(mock_app_2_));
-
- RCAppExtensionPtr rc_extention_ptr =
- utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
-
- EXPECT_CALL(*mock_app_2_, QueryInterface(_))
- .WillOnce(Return(rc_extention_ptr));
-
- // Act
- application_manager::ApplicationSharedPtr app_ptr(mock_app_2_);
- EXPECT_CALL(*mock_app_2_, app_id()).WillRepeatedly(Return(kAppId2));
- ra_manager.OnApplicationEvent(
- application_manager::plugin_manager::kApplicationExit, app_ptr);
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId2))
- .WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
- .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
-}
-
-TEST_F(RAManagerTest, AppUnregistered_ReleaseResource) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- RCAppExtensionPtr rc_extention_ptr =
- utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
-
- EXPECT_CALL(*mock_app_1_, QueryInterface(_))
- .WillOnce(Return(rc_extention_ptr));
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillRepeatedly(Return(mock_app_1_));
-
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-
- // Act
- application_manager::ApplicationSharedPtr app_ptr(mock_app_1_);
- EXPECT_CALL(*mock_app_1_, app_id()).WillRepeatedly(Return(kAppId1));
-
- ra_manager.OnApplicationEvent(
- application_manager::plugin_manager::kApplicationUnregistered, app_ptr);
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId2))
- .WillOnce(Return(mock_app_2_));
-
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
-}
-
-TEST_F(RAManagerTest, AnotherAppUnregistered_NoReleaseResource) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillOnce(Return(mock_app_1_));
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillRepeatedly(Return(mock_app_2_));
-
- RCAppExtensionPtr rc_extention_ptr =
- utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
-
- EXPECT_CALL(*mock_app_2_, QueryInterface(_))
- .WillOnce(Return(rc_extention_ptr));
-
- // Act
- application_manager::ApplicationSharedPtr app_ptr(mock_app_2_);
- EXPECT_CALL(*mock_app_2_, app_id()).WillRepeatedly(Return(kAppId2));
-
- ra_manager.OnApplicationEvent(
- application_manager::plugin_manager::kApplicationUnregistered, app_ptr);
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId2))
- .WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
- .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
-}
-
-TEST_F(RAManagerTest, AppsDisallowed_ReleaseAllResources) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillRepeatedly(Return(mock_app_1_));
-
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType2, kAppId1));
-
- application_manager::ApplicationSet apps;
- apps.insert(mock_app_1_);
- std::shared_ptr<sync_primitives::Lock> apps_lock =
- std::make_shared<sync_primitives::Lock>();
- DataAccessor<application_manager::ApplicationSet> apps_da(apps, apps_lock);
-
- EXPECT_CALL(mock_app_mngr_, applications()).WillRepeatedly(Return(apps_da));
-
- RCAppExtensionPtr rc_extention_ptr =
- utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
-
- EXPECT_CALL(*mock_app_1_, QueryInterface(RCRPCPlugin::kRCPluginID))
- .WillRepeatedly(Return(rc_extention_ptr));
-
- // Act
- ra_manager.OnPolicyEvent(
- application_manager::plugin_manager::PolicyEvent::kApplicationsDisabled);
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId2))
- .WillRepeatedly(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType2, kAppId2));
- Mock::VerifyAndClearExpectations(&mock_app_mngr_);
-}
-
-TEST_F(RAManagerTest, AppGotRevokedModulesWithPTU_ReleaseRevokedResource) {
- // Arrange
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY);
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillRepeatedly(Return(mock_app_1_));
-
- RCAppExtensionPtr rc_extention_ptr =
- utils::MakeShared<rc_rpc_plugin::RCAppExtension>(
- application_manager::AppExtensionUID(
- rc_rpc_plugin::RCRPCPlugin::kRCPluginID));
-
- EXPECT_CALL(*mock_app_1_, QueryInterface(RCRPCPlugin::kRCPluginID))
- .WillRepeatedly(Return(rc_extention_ptr));
-
- ON_CALL(*mock_app_1_, is_remote_control_supported())
- .WillByDefault(Return(true));
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId1))
- .WillRepeatedly(Return(mock_app_1_));
-
- EXPECT_CALL(*mock_app_1_, app_id()).WillRepeatedly(Return(kAppId1));
-
- EXPECT_CALL(*mock_app_1_, policy_app_id())
- .WillRepeatedly(Return(policy_app_id_1_));
-
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType1, kAppId1));
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType2, kAppId1));
-
- application_manager::ApplicationSet apps;
- apps.insert(mock_app_1_);
- std::shared_ptr<sync_primitives::Lock> apps_lock =
- std::make_shared<sync_primitives::Lock>();
- DataAccessor<application_manager::ApplicationSet> apps_da(apps, apps_lock);
-
- EXPECT_CALL(mock_app_mngr_, applications()).WillRepeatedly(Return(apps_da));
-
- Resources allowed_modules;
- allowed_modules.push_back(kModuleType1);
-
- EXPECT_CALL(mock_policy_handler_, GetModuleTypes(policy_app_id_1_, _))
- .WillOnce(DoAll(SetArgPointee<1>(allowed_modules), Return(true)));
-
- // Act
- ra_manager.OnPolicyEvent(application_manager::plugin_manager::PolicyEvent::
- kApplicationPolicyUpdated);
-
- EXPECT_CALL(mock_app_mngr_, application(kAppId2))
- .WillRepeatedly(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
- ra_manager.AcquireResource(kModuleType1, kAppId2));
- EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
- ra_manager.AcquireResource(kModuleType2, kAppId2));
- Mock::VerifyAndClearExpectations(&mock_app_mngr_);
-}
-
-TEST_F(RAManagerTest, GetAccessMode_ExpectedSameAsHadSet) {
- ResourceAllocationManagerImpl ra_manager(mock_app_mngr_, mock_rpc_service_);
-
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::AUTO_DENY);
- EXPECT_EQ(hmi_apis::Common_RCAccessMode::AUTO_DENY,
- ra_manager.GetAccessMode());
-
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::ASK_DRIVER);
- EXPECT_EQ(hmi_apis::Common_RCAccessMode::ASK_DRIVER,
- ra_manager.GetAccessMode());
-
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::AUTO_ALLOW);
- EXPECT_EQ(hmi_apis::Common_RCAccessMode::AUTO_ALLOW,
- ra_manager.GetAccessMode());
-
- ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::INVALID_ENUM);
- EXPECT_EQ(hmi_apis::Common_RCAccessMode::INVALID_ENUM,
- ra_manager.GetAccessMode());
-}
-
-} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
index 11dd35d061..fe8857b6b1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
@@ -42,26 +42,36 @@ set (HMI_COMMANDS_SOURCE_DIR
${COMMANDS_SOURCE_DIR}/hmi
)
+set (EXTENSIONS_SOURCE_DIR
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/extensions
+)
collect_sources(MOBILE_COMMANDS "${MOBILE_COMMANDS_SOURCE_DIR}")
collect_sources(HMI_COMMANDS "${HMI_COMMANDS_SOURCE_DIR}")
+collect_sources(APP_EXTENSIONS "${EXTENSIONS_SOURCE_DIR}")
collect_sources(RPC_PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(LIBRARIES
+ ApplicationManager
HMI_API
MOBILE_API
- ApplicationManager
+ MessageHelper
+ connectionHandler
v4_protocol_v1_2_no_extra
SmartObjects
Utils
- Policy
+ PolicyStatic
+ jsoncpp
)
if(ENABLE_LOG)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
-add_library("sdl_rpc_plugin" SHARED ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${RPC_PLUGIN_SOURCES})
-target_link_libraries("sdl_rpc_plugin" ${LIBRARIES})
+add_library("sdl_rpc_plugin_static" ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${RPC_PLUGIN_SOURCES} ${APP_EXTENSIONS})
+target_link_libraries("sdl_rpc_plugin_static" ${LIBRARIES})
+
+add_library("sdl_rpc_plugin" SHARED "src/sdl_rpc_plugin.cc")
+target_link_libraries("sdl_rpc_plugin" sdl_rpc_plugin_static)
set(INSTALL_DESTINATION bin)
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/activate_app_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/activate_app_request.h
index 7b0911fef9..6d8f5e4b2b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/activate_app_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/activate_app_request.h
@@ -72,6 +72,6 @@ class ActivateAppRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ACTIVATE_APP_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/activate_app_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/activate_app_response.h
index f937b4f63b..93be297bf6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/activate_app_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/activate_app_response.h
@@ -72,6 +72,6 @@ class ActivateAppResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ACTIVATE_APP_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/add_statistics_info_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/add_statistics_info_notification.h
index 4e9e4d54d7..6e7ef63cf4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/add_statistics_info_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/add_statistics_info_notification.h
@@ -74,6 +74,6 @@ class AddStatisticsInfoNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ADD_STATISTICS_INFO_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h
index 45acb3a424..54a81f50f3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h
@@ -72,6 +72,6 @@ class AllowAllAppsRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ALLOW_ALL_APPS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_all_apps_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_all_apps_response.h
index 41d1c9e752..ffd60a61d8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_all_apps_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_all_apps_response.h
@@ -72,6 +72,6 @@ class AllowAllAppsResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ALLOW_ALL_APPS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_app_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_app_request.h
index b3a2d88d7d..c8c0198cc8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_app_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_app_request.h
@@ -72,6 +72,6 @@ class AllowAppRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ALLOW_APP_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_app_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_app_response.h
index 55637e1756..5f6ee670ec 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_app_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/allow_app_response.h
@@ -72,6 +72,6 @@ class AllowAppResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ALLOW_APP_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h
new file mode 100644
index 0000000000..9847f567e0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BasicCommunicationCloseApplicationRequest command class
+ **/
+class BasicCommunicationCloseApplicationRequest
+ : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief BasicCommunicationCloseApplicationRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BasicCommunicationCloseApplicationRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief BasicCommunicationCloseApplicationRequest class destructor
+ **/
+ ~BasicCommunicationCloseApplicationRequest() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BasicCommunicationCloseApplicationRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h
new file mode 100644
index 0000000000..9576684b77
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BasicCommunicationCloseApplicationResponse command class
+ **/
+class BasicCommunicationCloseApplicationResponse
+ : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief BasicCommunicationCloseApplicationResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BasicCommunicationCloseApplicationResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief BasicCommunicationCloseApplicationResponse class destructor
+ **/
+ ~BasicCommunicationCloseApplicationResponse() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BasicCommunicationCloseApplicationResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h
index 90160d9953..e90e6cd20f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h
@@ -35,8 +35,8 @@
#include "application_manager/commands/response_from_hmi.h"
+#include "application_manager/application_manager.h"
#include "utils/macro.h"
-#include "application_manager/application_manager_impl.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_on_awake_sdl.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_on_awake_sdl.h
index 2ac1be2580..82ac7b0efa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_on_awake_sdl.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_on_awake_sdl.h
@@ -72,6 +72,6 @@ class OnAwakeSDLNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_ON_AWAKE_SDL_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h
index a7eb820146..71eb9e4105 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h
@@ -74,6 +74,6 @@ class BasicCommunicationSystemRequest
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_SYSTEM_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_system_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_system_response.h
index 20483a45e3..c76993cc6f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_system_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_system_response.h
@@ -74,6 +74,6 @@ class BasicCommunicationSystemResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_SYSTEM_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_urls.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_app_properties_request.h
index 93b414c8c4..484a82ca4c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_urls.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_app_properties_request.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,67 +30,51 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_GET_URLS_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_GET_URLS_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_APP_PROPERTIES_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_APP_PROPERTIES_REQUEST_H_
#include "application_manager/commands/request_from_hmi.h"
-#include "policy/policy_types.h"
-#include "smart_objects/smart_object.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
+
namespace commands {
+
/**
- * @brief GetUrls command class
+ * @brief BCGetAppPropertiesRequest command class
**/
-class GetUrls : public app_mngr::commands::RequestFromHMI {
+class BCGetAppPropertiesRequest : public app_mngr::commands::RequestFromHMI {
public:
/**
- * @brief GetUrls class constructor
+ * @brief BCGetAppPropertiesRequest class constructor
*
* @param message Incoming SmartObject message
**/
- GetUrls(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ BCGetAppPropertiesRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
/**
- * @brief GetUrls class destructor
+ * @brief BCGetAppPropertiesRequest class destructor
**/
- virtual ~GetUrls();
+ virtual ~BCGetAppPropertiesRequest() = default;
/**
* @brief Execute command
**/
- void Run() OVERRIDE;
+ void Run() FINAL;
private:
-#ifdef PROPRIETARY_MODE
- /**
- * @brief Processes URLs collecting for policy service
- * @param endpoints Endpoints section of policy table
- */
- void ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints);
-#endif // PROPRIETARY_MODE
-
- /**
- * @brief Process URLs collecting for service
- * @param endpoints Endpoints section of policy table
- */
- void ProcessServiceURLs(const policy::EndpointUrls& endpoints);
-
- /**
- * @brief Sends response to HMI
- * @param result Result code
- */
- void SendResponseToHMI(hmi_apis::Common_Result::eType result);
+ void FillAppProperties(const std::string& policy_app_id,
+ smart_objects::SmartObject& out_properties) const;
- DISALLOW_COPY_AND_ASSIGN(GetUrls);
+ DISALLOW_COPY_AND_ASSIGN(BCGetAppPropertiesRequest);
};
} // namespace commands
-} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_GET_URLS_H_
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_APP_PROPERTIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_urls_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_app_properties_response.h
index 1ff38194b8..5634663254 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_urls_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_app_properties_response.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,43 +30,49 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_GET_URLS_RESPONSE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_GET_URLS_RESPONSE_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_APP_PROPERTIES_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_APP_PROPERTIES_RESPONSE_H_
#include "application_manager/commands/response_to_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
+
namespace commands {
-class GetUrlsResponse : public app_mngr::commands::ResponseToHMI {
+/**
+ * @brief BCGetAppPropertiesResponse command class
+ **/
+class BCGetAppPropertiesResponse : public app_mngr::commands::ResponseToHMI {
public:
/**
- * @brief GetUrlsResponse class constructor
+ * @brief BCGetAppPropertiesResponse class constructor
*
* @param message Incoming SmartObject message
**/
- GetUrlsResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ BCGetAppPropertiesResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
/**
- * @brief GetUrlsResponse class destructor
+ * @brief BCGetAppPropertiesResponse class destructor
**/
- virtual ~GetUrlsResponse();
+ virtual ~BCGetAppPropertiesResponse() = default;
/**
* @brief Execute command
**/
- virtual void Run();
+ void Run() FINAL;
private:
- DISALLOW_COPY_AND_ASSIGN(GetUrlsResponse);
+ DISALLOW_COPY_AND_ASSIGN(BCGetAppPropertiesResponse);
};
} // namespace commands
-} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_GET_URLS_RESPONSE_H_
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_APP_PROPERTIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h
new file mode 100644
index 0000000000..fd241da3c4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BCGetFilePathRequest command class
+ **/
+class BCGetFilePathRequest : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief BCGetFilePathRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BCGetFilePathRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief BCGetFilePathRequest class destructor
+ **/
+ virtual ~BCGetFilePathRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BCGetFilePathRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_sdl_RPC_PLUGIN_INCLUDE_sdl_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h
new file mode 100644
index 0000000000..2a6025cbdf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h
@@ -0,0 +1,77 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BCGetFilePathResponse command class
+ **/
+class BCGetFilePathResponse : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief BCGetFilePathResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BCGetFilePathResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief BCGetFilePathResponse class destructor
+ **/
+ virtual ~BCGetFilePathResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BCGetFilePathResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_GET_FILE_PATH_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_set_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_set_app_properties_request.h
new file mode 100644
index 0000000000..491d2196e5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_set_app_properties_request.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_SET_APP_PROPERTIES_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_SET_APP_PROPERTIES_REQUEST_H_
+
+#include "application_manager/commands/request_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BCSetAppPropertiesRequest command class
+ **/
+class BCSetAppPropertiesRequest : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief BCSetAppPropertiesRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BCSetAppPropertiesRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief BCSetAppPropertiesRequest class destructor
+ **/
+ virtual ~BCSetAppPropertiesRequest() = default;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BCSetAppPropertiesRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_SET_APP_PROPERTIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_set_app_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_set_app_properties_response.h
new file mode 100644
index 0000000000..e9872196c9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/bc_set_app_properties_response.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_SET_APP_PROPERTIES_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_SET_APP_PROPERTIES_RESPONSE_H_
+
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BCSetAppPropertiesResponse command class
+ **/
+class BCSetAppPropertiesResponse : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief BCSetAppPropertiesResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BCSetAppPropertiesResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief BCSetAppPropertiesResponse class destructor
+ **/
+ virtual ~BCSetAppPropertiesResponse() = default;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BCSetAppPropertiesResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BC_SET_APP_PROPERTIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h
index 5c650fb8e4..9bb3d9a6fb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h
@@ -73,6 +73,6 @@ class ButtonGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BUTTON_GET_CAPABILITIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_response.h
index bf2f15c18a..4431ea1224 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_response.h
@@ -74,6 +74,6 @@ class ButtonGetCapabilitiesResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BUTTON_GET_CAPABILITIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/close_popup_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/close_popup_request.h
index 635b0579f4..bfcf478930 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/close_popup_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/close_popup_request.h
@@ -72,6 +72,6 @@ class ClosePopupRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_CLOSE_POPUP_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/close_popup_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/close_popup_response.h
index 199b40f070..7477bda854 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/close_popup_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/close_popup_response.h
@@ -72,6 +72,6 @@ class ClosePopupResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_CLOSE_POPUP_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/decrypt_certificate_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/decrypt_certificate_request.h
index a70bff2553..f59b36fe09 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/decrypt_certificate_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/decrypt_certificate_request.h
@@ -67,6 +67,6 @@ class DecryptCertificateRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_DECRYPT_CERTIFICATE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/decrypt_certificate_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/decrypt_certificate_response.h
index 88b216eeea..9844ed9165 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/decrypt_certificate_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/decrypt_certificate_response.h
@@ -73,6 +73,6 @@ class DecryptCertificateResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_DECRYPT_CERTIFICATE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/dial_number_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/dial_number_request.h
index fa0efb90e6..bafe9c1e91 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/dial_number_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/dial_number_request.h
@@ -75,6 +75,6 @@ class DialNumberRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_DIAL_NUMBER_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/dial_number_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/dial_number_response.h
index 33d4788eca..9097757ab2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/dial_number_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/dial_number_response.h
@@ -76,6 +76,6 @@ class DialNumberResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_DIAL_NUMBER_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h
index d771167798..8d3be68539 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h
@@ -72,6 +72,6 @@ class GetSystemInfoRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_GET_SYSTEM_INFO_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_response.h
index 5bf5f41b73..d4f35a4e2a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_response.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_GET_SYSTEM_INFO_RESPONSE_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_GET_SYSTEM_INFO_RESPONSE_H_
-#include "application_manager/commands/response_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/response_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -82,6 +82,6 @@ class GetSystemInfoResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_GET_SYSTEM_INFO_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/mixing_audio_supported_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/mixing_audio_supported_request.h
index 34c10cedf1..46aa575eb5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/mixing_audio_supported_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/mixing_audio_supported_request.h
@@ -73,6 +73,6 @@ class MixingAudioSupportedRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_MIXING_AUDIO_SUPPORTED_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/mixing_audio_supported_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/mixing_audio_supported_response.h
index 5c67666225..32dd23d352 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/mixing_audio_supported_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/mixing_audio_supported_response.h
@@ -74,6 +74,6 @@ class MixingAudioSupportedResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_MIXING_AUDIO_SUPPORTED_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_request.h
index 3f63ef883d..a04488df76 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_request.h
@@ -72,6 +72,6 @@ class NaviAlertManeuverRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_ALERT_MANEUVER_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_response.h
index 7d7c4de85e..610af3fbfc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_response.h
@@ -72,6 +72,6 @@ class NaviAlertManeuverResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_ALERT_MANEUVER_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h
index 80e948ad25..fa9eee485e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h
@@ -63,8 +63,8 @@ class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI,
virtual ~AudioStartStreamRequest();
/**
- * @brief onTimeOut from requrst Controller
- */
+ * @brief onTimeOut from requrst Controller
+ */
virtual void onTimeOut();
/**
@@ -78,9 +78,9 @@ class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI,
virtual void on_event(const app_mngr::event_engine::Event& event);
/**
- * @brief RetryStartSession resend HMI startSession request if needed.
- * If limit expired, set audio_stream_retry_number counter to 0
- */
+ * @brief RetryStartSession resend HMI startSession request if needed.
+ * If limit expired, set audio_stream_retry_number counter to 0
+ */
void RetryStartSession();
private:
@@ -90,6 +90,6 @@ class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI,
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_AUDIO_START_STREAM_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_response.h
index 926cfc36ed..0f669084cb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_response.h
@@ -71,6 +71,6 @@ class AudioStartStreamResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_AUDIO_START_STREAM_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_request.h
index 7c5fbbdd3d..9f3aa8c312 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_request.h
@@ -71,6 +71,6 @@ class AudioStopStreamRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_AUDIO_STOP_STREAM_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_response.h
index 8eb091dd92..740efc2d19 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_response.h
@@ -71,6 +71,6 @@ class AudioStopStreamResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_AUDIO_STOP_STREAM_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_get_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_get_way_points_request.h
index dab5fc1022..0e2ad8b9a3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_get_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_get_way_points_request.h
@@ -70,6 +70,6 @@ class NaviGetWayPointsRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_GET_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_get_way_points_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_get_way_points_response.h
index fb93c2c64a..9fef4f041e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_get_way_points_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_get_way_points_response.h
@@ -72,6 +72,6 @@ class NaviGetWayPointsResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_GET_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h
index 404ddc9f00..17d4eb483f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h
@@ -78,6 +78,6 @@ class NaviIsReadyRequest : public app_mngr::commands::RequestToHMI,
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_IS_READY_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_response.h
index 7f94312d04..5dcbdd46df 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_response.h
@@ -72,6 +72,6 @@ class NaviIsReadyResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_IS_READY_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_send_location_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_send_location_request.h
index 7bdf0e4787..02068779a9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_send_location_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_send_location_request.h
@@ -72,6 +72,6 @@ class NaviSendLocationRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_SEND_LOCATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_send_location_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_send_location_response.h
index 6a65eb00a1..e322177e45 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_send_location_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_send_location_response.h
@@ -72,6 +72,6 @@ class NaviSendLocationResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_SEND_LOCATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h
index a981b8ff81..437d58861c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h
@@ -84,6 +84,6 @@ class NaviSetVideoConfigRequest : public app_mngr::commands::RequestToHMI,
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_SET_VIDEO_CONFIG_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_response.h
index f5f9e7a5ee..3cf3ca17ae 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_response.h
@@ -74,6 +74,6 @@ class NaviSetVideoConfigResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_SET_VIDEO_CONFIG_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_request.h
index f64bdf6ce0..efe6743d88 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_request.h
@@ -73,6 +73,6 @@ class NaviShowConstantTBTRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_SHOW_CONSTANT_TBT_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_response.h
index fd4da08cf0..a77d2b9dbb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_response.h
@@ -73,6 +73,6 @@ class NaviShowConstantTBTResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_SHOW_CONSTANT_TBT_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h
index d5aae67661..afad744eb3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h
@@ -47,10 +47,10 @@ class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI,
public app_mngr::event_engine::EventObserver {
public:
/**
- * @brief NaviStartStreamRequest class constructor
- *
- * @param message Incoming SmartObject message
- **/
+ * @brief NaviStartStreamRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
NaviStartStreamRequest(const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
@@ -78,9 +78,9 @@ class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI,
virtual void onTimeOut();
/**
- * @brief RetryStartSession resend HMI startSession request if needed.
- * If limit expired, set video_stream_retry_number counter to 0
- */
+ * @brief RetryStartSession resend HMI startSession request if needed.
+ * If limit expired, set video_stream_retry_number counter to 0
+ */
void RetryStartSession();
private:
@@ -90,6 +90,6 @@ class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI,
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_START_STREAM_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_response.h
index b4770e82fe..38d9ba905c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_response.h
@@ -71,6 +71,6 @@ class NaviStartStreamResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_START_STREAM_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_stop_stream_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_stop_stream_request.h
index 400c61ba07..0d14d0595f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_stop_stream_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_stop_stream_request.h
@@ -71,6 +71,6 @@ class NaviStopStreamRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_STOP_STREAM_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_stop_stream_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_stop_stream_response.h
index 39512ac2bb..10b5ef0f80 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_stop_stream_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_stop_stream_response.h
@@ -71,6 +71,6 @@ class NaviStopStreamResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_STOP_STREAM_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h
index 052c3c7151..3def06ba9a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h
@@ -71,6 +71,6 @@ class NaviSubscribeWayPointsRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_response.h
index 73aab4633f..c424ae0857 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_response.h
@@ -74,6 +74,6 @@ class NaviSubscribeWayPointsResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_SUBSCRIBE_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_request.h
index 6061858e5c..be1ccbb45b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_request.h
@@ -43,35 +43,35 @@ namespace commands {
/**
* @brief NaviSubscribeWayPointsRequest command class
**/
-class NaviUnSubscribeWayPointsRequest
+class NaviUnsubscribeWayPointsRequest
: public app_mngr::commands::RequestToHMI {
public:
/**
- * @brief NaviUnSubscribeWayPointsRequest class constructor
+ * @brief NaviUnsubscribeWayPointsRequest class constructor
*
* @param message Incoming SmartObject message
**/
- NaviUnSubscribeWayPointsRequest(
+ NaviUnsubscribeWayPointsRequest(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handle);
/**
- * @brief NaviUnSubscribeWayPointsRequest class destructor
+ * @brief NaviUnsubscribeWayPointsRequest class destructor
**/
- virtual ~NaviUnSubscribeWayPointsRequest();
+ virtual ~NaviUnsubscribeWayPointsRequest();
/**
* @brief Execute command
**/
virtual void Run() OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(NaviUnSubscribeWayPointsRequest);
+ DISALLOW_COPY_AND_ASSIGN(NaviUnsubscribeWayPointsRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_response.h
index 3a02228b8b..d4f98a871c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_response.h
@@ -41,13 +41,13 @@ namespace app_mngr = application_manager;
namespace commands {
/**
- * @brief NaviUnSubscribeWaypoints command class
+ * @brief NaviUnsubscribeWaypoints command class
**/
class NaviUnsubscribeWayPointsResponse
: public app_mngr::commands::ResponseFromHMI {
public:
/**
- * @brief NaviUnSubscribeWaypoints class constructor
+ * @brief NaviUnsubscribeWaypoints class constructor
*
* @param message Incoming SmartObject message
**/
@@ -59,7 +59,7 @@ class NaviUnsubscribeWayPointsResponse
policy::PolicyHandlerInterface& policy_handle);
/**
- * @brief NaviUnSubscribeWaypoints class destructor
+ * @brief NaviUnsubscribeWaypoints class destructor
**/
virtual ~NaviUnsubscribeWayPointsResponse();
@@ -74,5 +74,5 @@ class NaviUnsubscribeWayPointsResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_update_turn_list_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_update_turn_list_request.h
index db269a65d3..a80d111dae 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_update_turn_list_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_update_turn_list_request.h
@@ -72,6 +72,6 @@ class NaviUpdateTurnListRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_UPDATE_TURN_LIST_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_update_turn_list_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_update_turn_list_response.h
index 20295485a3..8f715ac33d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_update_turn_list_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_update_turn_list_response.h
@@ -73,6 +73,6 @@ class NaviUpdateTurnListResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_NAVI_UPDATE_TURN_LIST_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h
index 42bf877f2d..3f9d096625 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h
@@ -74,6 +74,6 @@ class OnAllowSDLFunctionalityNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_ALLOW_SDL_FUNCTIONALITY_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h
index cc21d699fb..f856ce966e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h
@@ -74,6 +74,6 @@ class OnAppActivatedNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_APP_ACTIVATED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h
index 9b4a6ba5a0..6a7fd00632 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h
@@ -74,6 +74,6 @@ class OnAppDeactivatedNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_APP_DEACTIVATED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_permission_changed_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_permission_changed_notification.h
index 6008a8ce51..afed4bfa39 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_permission_changed_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_permission_changed_notification.h
@@ -74,6 +74,6 @@ class OnAppPermissionChangedNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_APP_PERMISSION_CHANGED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h
index a751b25d85..1f06e38ccd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h
@@ -74,6 +74,6 @@ class OnAppPermissionConsentNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_APP_PERMISSION_CONSENT_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_properties_change_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_properties_change_notification.h
new file mode 100644
index 0000000000..7feb2ef85e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_properties_change_notification.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_APP_PROPERTIES_CHANGE_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_APP_PROPERTIES_CHANGE_NOTIFICATION_H_
+
+#include "application_manager/commands/notification_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnAppPropertiesChangeNotification command class
+ **/
+class OnAppPropertiesChangeNotification
+ : public app_mngr::commands::NotificationToHMI {
+ public:
+ /**
+ * @brief OnAppPropertiesChangeNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnAppPropertiesChangeNotification(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief OnAppPropertiesChangeNotification class destructor
+ **/
+ virtual ~OnAppPropertiesChangeNotification() = default;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnAppPropertiesChangeNotification);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_APP_PROPERTIES_CHANGE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_registered_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_registered_notification.h
index 3548786d1d..00c75d2c23 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_registered_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_registered_notification.h
@@ -74,6 +74,6 @@ class OnAppRegisteredNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_APP_REGISTERED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h
index 097eb1eb28..791374f6f4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h
@@ -64,13 +64,13 @@ class OnAppUnregisteredNotification
~OnAppUnregisteredNotification() FINAL;
/**
- * @brief Init overrides and skips replacement of app id with hmi id since
- * 1) at the moment this notification is being sent there is no application
- * registered in application manager
- * 2) hmi id is already used whenever this message is being constructed, so
- * its already there
- * @return True in any case
- */
+ * @brief Init overrides and skips replacement of app id with hmi id since
+ * 1) at the moment this notification is being sent there is no application
+ * registered in application manager
+ * 2) hmi id is already used whenever this message is being constructed, so
+ * its already there
+ * @return True in any case
+ */
bool Init() FINAL;
/**
@@ -84,6 +84,6 @@ class OnAppUnregisteredNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_APP_UNREGISTERED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h
index cac306f760..8f51a822a2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h
@@ -74,6 +74,6 @@ class OnAudioDataStreamingNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_AUDIO_DATA_STREAMING_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h
new file mode 100644
index 0000000000..0e956e8688
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
+
+#include "application_manager/commands/notification_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnASSystemCapabilityUpdatedNotification command class
+ **/
+class OnBCSystemCapabilityUpdatedNotification
+ : public app_mngr::commands::NotificationToHMI {
+ public:
+ /**
+ * @brief OnASSystemCapabilityUpdatedNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnBCSystemCapabilityUpdatedNotification(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief OnASSystemCapabilityUpdatedNotification class destructor
+ **/
+ virtual ~OnBCSystemCapabilityUpdatedNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnBCSystemCapabilityUpdatedNotification);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h
index 6138aa59fb..39b5c3aee3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,55 +30,68 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_UNSUBSCRIBE_VEHICLE_DATA_RESPONSE_TEMPLATE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_UNSUBSCRIBE_VEHICLE_DATA_RESPONSE_TEMPLATE_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_FROM_HMI_H_
-#include "application_manager/event_engine/event.h"
-#include "application_manager/commands/response_from_hmi.h"
-#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
+
namespace commands {
/**
- * @brief VIUnsubscriveVehicleDataResponseTemplate command class
+ * @brief OnBCSystemCapabilityUpdatedNotificationFromHMI command class
**/
-template <event_engine::Event::EventID eventID>
-class VIUnsubscribeVehicleDataResponseTemplate : public ResponseFromHMI {
+class OnBCSystemCapabilityUpdatedNotificationFromHMI
+ : public app_mngr::commands::NotificationFromHMI {
public:
/**
- * @brief VISubscriveVehicleDataResponseTemplate class constructor
- *
- * @param message Incoming SmartObject message
+ * @brief OnBCSystemCapabilityUpdatedNotificationFromHMI class constructor
+ * @param message Incoming SmartObject message from HMI
+ * @note all parameters described below required for base class
+ * @param application_manager Application manager instance to interact with
+ * related application
+ * @param rpc_service - service to handle appropriate RPC
+ * @param hmi_capabilities - HMI capabilities
+ * @param policy_handle - instance which allows interaction between
+ * application manager and application policies
**/
- VIUnsubscribeVehicleDataResponseTemplate(
+ OnBCSystemCapabilityUpdatedNotificationFromHMI(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ policy::PolicyHandlerInterface& policy_handle);
/**
- * @brief Execute command
+ * @brief OnBCSystemCapabilityUpdatedNotificationFromHMI class destructor
**/
- virtual void Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- event_engine::Event event(eventID);
- event.set_smart_object(*message_);
- event.raise(application_manager_.event_dispatcher());
- }
+ ~OnBCSystemCapabilityUpdatedNotificationFromHMI() FINAL;
+
+ void Run() FINAL;
private:
- DISALLOW_COPY_AND_ASSIGN(VIUnsubscribeVehicleDataResponseTemplate<eventID>);
+ enum ProcessSystemDisplayCapabilitiesResult {
+ SUCCESS,
+ FAIL,
+ CAPABILITIES_CACHED
+ };
+ /**
+ * @brief ProcessSystemDisplayCapabilities processes provided display
+ * capabilities according to its structure
+ * @param display_capabilities display capabilities to process
+ * @return true if display capabilities have been processed properly,
+ * otherwise returns false
+ */
+ ProcessSystemDisplayCapabilitiesResult ProcessSystemDisplayCapabilities(
+ const smart_objects::SmartObject& display_capabilities);
+
+ DISALLOW_COPY_AND_ASSIGN(OnBCSystemCapabilityUpdatedNotificationFromHMI);
};
} // namespace commands
-} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_UNSUBSCRIBE_VEHICLE_DATA_RESPONSE_TEMPLATE_H_
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_event_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_event_notification.h
index b83fe1bfe0..955249bd4b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_event_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_event_notification.h
@@ -74,6 +74,6 @@ class OnButtonEventNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BUTTON_EVENT_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_press_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_press_notification.h
index e996c9952c..9de86d1d9c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_press_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_press_notification.h
@@ -74,6 +74,6 @@ class OnButtonPressNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BUTTON_PRESS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h
index 4ed60f9a07..0a0a8c3c5d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h
@@ -78,6 +78,6 @@ class OnButtonSubscriptionNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BUTTON_SUBSCRIPTION_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h
index 99c165c12f..7fe0b2a8c3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h
@@ -74,6 +74,6 @@ class OnDeviceChosenNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_DEVICE_CHOSEN_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h
index 7701e2a601..df1efb4d30 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h
@@ -74,6 +74,6 @@ class OnDeviceStateChangedNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_DEVICE_STATE_CHANGED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h
index 51fb49c6bc..df8dd3d401 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h
@@ -80,6 +80,6 @@ class OnDriverDistractionNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_DRIVER_DISTRACTION_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h
index cff0a0e617..4fcde5f7d0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h
@@ -74,6 +74,6 @@ class OnEventChangedNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_EVENT_CHANGED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h
index 116932d87a..dbbbe925fe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h
@@ -79,6 +79,6 @@ class OnExitAllApplicationsNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_EXIT_ALL_APPLICATIONS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h
index 11c397bfe7..403642f64d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h
@@ -74,6 +74,6 @@ class OnExitApplicationNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_EXIT_APPLICATION_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_file_removed_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_file_removed_notification.h
index 38c5dcf535..7658017364 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_file_removed_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_file_removed_notification.h
@@ -72,6 +72,6 @@ class OnFileRemovedNotification : public app_mngr::commands::NotificationToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_FILE_REMOVED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_find_applications.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_find_applications.h
index 672ded9dcf..bf3a9d530e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_find_applications.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_find_applications.h
@@ -72,6 +72,6 @@ class OnFindApplications : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_FIND_APPLICATIONS_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h
index 85b7ed356e..d215b3d07d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_IGNITION_CYCLE_OVER_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_IGNITION_CYCLE_OVER_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_impl.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnIgnitionCycleOverNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_IGNITION_CYCLE_OVER_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h
index 075dc2cb5c..a07af99df1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_NAVI_TBT_CLIENT_STATE_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_NAVI_TBT_CLIENT_STATE_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnNaviTBTClientStateNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_NAVI_TBT_CLIENT_STATE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h
index 3efde9c8c1..74058e246c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_NAVI_WAY_POINT_CHANGE_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_NAVI_WAY_POINT_CHANGE_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,5 +75,5 @@ class OnNaviWayPointChangeNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_NAVI_WAY_POINT_CHANGE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_policy_update.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_policy_update.h
index 331e352795..ede78dd362 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_policy_update.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_policy_update.h
@@ -66,6 +66,6 @@ class OnPolicyUpdate : public app_mngr::commands::NotificationFromHMI {
DISALLOW_COPY_AND_ASSIGN(OnPolicyUpdate);
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_POLICY_UPDATE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_put_file_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_put_file_notification.h
index 503013ff58..e64edd51bc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_put_file_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_put_file_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_PUT_FILE_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_PUT_FILE_NOTIFICATION_H_
-#include "application_manager/commands/notification_to_hmi.h"
#include "application_manager/application_impl.h"
+#include "application_manager/commands/notification_to_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -73,6 +73,6 @@ class OnPutFileNotification : public app_mngr::commands::NotificationToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_PUT_FILE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ready_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ready_notification.h
index c4adc20090..f540abbf4a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ready_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ready_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_READY_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_READY_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -73,6 +73,6 @@ class OnReadyNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_READY_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_received_policy_update.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_received_policy_update.h
index c1e1b01a18..1ffe038a82 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_received_policy_update.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_received_policy_update.h
@@ -43,10 +43,10 @@ namespace commands {
class OnReceivedPolicyUpdate : public app_mngr::commands::NotificationFromHMI {
public:
/**
- * @brief OnReceivedPolicyUpdate class constructor
- *
- * @param message Incoming SmartObject message
- **/
+ * @brief OnReceivedPolicyUpdate class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
OnReceivedPolicyUpdate(const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
@@ -69,6 +69,6 @@ class OnReceivedPolicyUpdate : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_RECEIVED_POLICY_UPDATE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_record_start_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_record_start_notification.h
index c5755a364c..68cc5ca487 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_record_start_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_record_start_notification.h
@@ -74,6 +74,6 @@ class OnRecordStartdNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_RECORD_START_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_resume_audio_source_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_resume_audio_source_notification.h
index ef2b5a34eb..63ea659747 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_resume_audio_source_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_resume_audio_source_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_RESUME_AUDIO_SOURCE_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_RESUME_AUDIO_SOURCE_NOTIFICATION_H_
-#include "application_manager/commands/notification_to_hmi.h"
#include "application_manager/application_impl.h"
+#include "application_manager/commands/notification_to_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnResumeAudioSourceNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_RESUME_AUDIO_SOURCE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h
index 34fe41de81..a40872b578 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h
@@ -72,6 +72,6 @@ class OnSDLCloseNotification : public app_mngr::commands::NotificationToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SDL_CLOSE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_consent_needed_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_consent_needed_notification.h
index 9fe736a595..00bc6c9a05 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_consent_needed_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_consent_needed_notification.h
@@ -74,6 +74,6 @@ class OnSDLConsentNeededNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SDL_CONSENT_NEEDED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_persistence_complete_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_persistence_complete_notification.h
index 96f63845e1..6ae9aee1f5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_persistence_complete_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_sdl_persistence_complete_notification.h
@@ -74,6 +74,6 @@ class OnSDLPersistenceCompleteNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SDL_PERSISTENCE_COMPLETE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_subscribe_vehicle_data_request_template.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_service_update_notification.h
index b74d013a82..bfa9b6e6ae 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_subscribe_vehicle_data_request_template.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_service_update_notification.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,54 +30,53 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_SUBSCRIBE_VEHICLE_DATA_REQUEST_TEMPLATE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_SUBSCRIBE_VEHICLE_DATA_REQUEST_TEMPLATE_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SERVICE_UPDATE_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SERVICE_UPDATE_NOTIFICATION_H_
-#include "application_manager/event_engine/event.h"
-#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/commands/notification_to_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
+
namespace commands {
+namespace hmi {
/**
- * @brief VISubscriveVehicleDataRequestTemplate command class
- *
- * Template class for sending 1 subscribe thin request
+ * @brief OnServiceUpdateNotification command class
**/
-template <event_engine::Event::EventID eventID>
-class VISubscribeVehicleDataRequestTemplate
- : public app_mngr::commands::RequestToHMI {
+class OnServiceUpdateNotification
+ : public app_mngr::commands::NotificationToHMI {
public:
/**
- * @brief VISubscriveVehicleDataRequestTemplate class constructor
- *
- * @param message Incoming SmartObject message
+ * @brief OnServiceUpdateNotification class constructor
+ * @param application_manager ref to application manager
+ * @param rpc_service ref to rpc service
+ * @param hmi_capabilities ref to HMI capabilities
+ * @param policy_handle ref to policy handler
**/
- VISubscribeVehicleDataRequestTemplate(
+ OnServiceUpdateNotification(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief OnServiceUpdateNotification class destructor
+ **/
+ virtual ~OnServiceUpdateNotification() OVERRIDE;
/**
- * @brief Execute command with sending DBus thin request to HMI
+ * @brief Execute command
**/
- virtual void Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- SendRequest();
- }
+ void Run() OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(VISubscribeVehicleDataRequestTemplate<eventID>);
+ DISALLOW_COPY_AND_ASSIGN(OnServiceUpdateNotification);
};
+} // namespace hmi
} // namespace commands
-} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_SUBSCRIBE_VEHICLE_DATA_REQUEST_TEMPLATE_H_
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SERVICE_UPDATE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h
index da049b1dc4..38bb1db03e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h
@@ -72,6 +72,6 @@ class OnStartDeviceDiscovery : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_START_DEVICE_DISCOVERY_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_status_update_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_status_update_notification.h
index 7c61fac041..7a6e8b871a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_status_update_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_status_update_notification.h
@@ -74,6 +74,6 @@ class OnStatusUpdateNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_STATUS_UPDATE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_context_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_context_notification.h
index d4c940bac7..a239203053 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_context_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_context_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_CONTEXT_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_CONTEXT_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -76,6 +76,6 @@ class OnSystemContextNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_CONTEXT_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_error_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_error_notification.h
index 76325b078f..3993eefd8b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_error_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_error_notification.h
@@ -73,6 +73,6 @@ class OnSystemErrorNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_ERROR_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h
index 1e4046b83b..a5ab636464 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h
@@ -74,6 +74,6 @@ class OnSystemInfoChangedNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_INFO_CHANGED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_request_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_request_notification.h
index 1e1e1818b8..6f9f63b517 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_request_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_request_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_REQUEST_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_REQUEST_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_impl.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnSystemRequestNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_REQUEST_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h
index 0beba8dc6b..799af1e134 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_TIME_READY_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_SYSTEM_TIME_READY_NOTIFICATION_H_
+#include "application_manager/application_manager.h"
#include "application_manager/commands/notification_from_hmi.h"
-#include "application_manager/application_manager_impl.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h
index 33c7d98b6f..0462925f71 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h
@@ -74,6 +74,6 @@ class OnTTSLanguageChangeNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_TTS_LANGUAGE_CHANGE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h
index 70050a667e..c8bd159064 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h
@@ -78,6 +78,6 @@ class OnTTSResetTimeoutNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_TTS_RESET_TIMEOUT_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h
index 93dac3f292..315acf3a5f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h
@@ -73,6 +73,6 @@ class OnTTSStartedNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_TTS_STARTED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h
index 362e96f4be..0dafd61c58 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h
@@ -73,6 +73,6 @@ class OnTTSStoppedNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_TTS_STOPPED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h
index 0cc4e9e772..f468ce5b0a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h
@@ -72,6 +72,6 @@ class OnUICommandNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_COMMAND_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h
index c487894770..31b7eef3a3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_KEYBOARD_INPUT_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_KEYBOARD_INPUT_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -79,6 +79,6 @@ class OnUIKeyBoardInputNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_KEYBOARD_INPUT_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h
index f30b8573aa..2495aa2b96 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h
@@ -74,6 +74,6 @@ class OnUILanguageChangeNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_LANGUAGE_CHANGE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h
index bbdf4d04ef..1c87f82349 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h
@@ -78,6 +78,6 @@ class OnUIResetTimeoutNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_RESET_TIMEOUT_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h
index 5c7dd0128b..26c25f437a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_TOUCH_EVENT_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_TOUCH_EVENT_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -79,6 +79,6 @@ class OnUITouchEventNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_TOUCH_EVENT_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_update_device_list.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_update_device_list.h
index 2942c36053..d638629b3a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_update_device_list.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_update_device_list.h
@@ -72,6 +72,6 @@ class OnUpdateDeviceList : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UPDATE_DEVICE_LIST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h
index ed0b1572ff..c848233497 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ACC_PEDAL_POSITION_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ACC_PEDAL_POSITION_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVIAccPedalPositionNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ACC_PEDAL_POSITION_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h
index cc81160ccb..0cb3e04f4e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BELT_STATUS_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BELT_STATUS_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVIBeltStatusNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BELT_STATUS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h
index 2b46b69f55..6ab920204d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BODY_INFORMATION_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BODY_INFORMATION_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVIBodyInformationNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BODY_INFORMATION_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h
index 05da9a775d..b3afeb82b3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DEVICE_STATUS_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DEVICE_STATUS_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVIDeviceStatusNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DEVICE_STATUS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h
index 6640d7953a..a1885c5e29 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DRIVER_BRAKING_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DRIVER_BRAKING_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVIDriverBrakingNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DRIVER_BRAKING_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h
index f8c0526f8c..feb6cc6060 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ENGINE_TORQUE_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ENGINE_TORQUE_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVIEngineTorqueNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ENGINE_TORQUE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h
index 900aecd845..734420aaee 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_EXTERNAL_TEMPERATURE_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_EXTERNAL_TEMPERATURE_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVIExternalTemperatureNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_EXTERNAL_TEMPERATURE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h
index 7374de9ad9..a5588901f7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -74,6 +74,6 @@ class OnVIFuelLevelNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h
index a705fcbd04..5ed661cdbf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_STATE_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_STATE_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVIFuelLevelStateNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_STATE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h
index 984e1e4c0b..70ee5f6c00 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_GPS_DATA_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_GPS_DATA_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -73,6 +73,6 @@ class OnVIGpsDataNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_GPS_DATA_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h
index 1dfda8a9e0..5ef1e3ed92 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_HEAD_LAMP_STATUS_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_HEAD_LAMP_STATUS_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVIHeadLampStatusNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_HEAD_LAMP_STATUS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h
index fd8743907c..7bb7756fc5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_INSTANT_FUEL_CONSUMPTION_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_INSTANT_FUEL_CONSUMPTION_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVIInstantFuelConsumptionNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_INSTANT_FUEL_CONSUMPTION_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h
index 25ace2821d..cdebc99768 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_MY_KEY_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_MY_KEY_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -73,6 +73,6 @@ class OnVIMyKeyNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_MY_KEY_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h
index ad141e733c..1da26dd316 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ODOMETER_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ODOMETER_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -74,6 +74,6 @@ class OnVIOdometerNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ODOMETER_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h
index 95fb873957..7d03c62633 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_PRNDL_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_PRNDL_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -73,6 +73,6 @@ class OnVIPrndlNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_PRNDL_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h
index d4b121a96f..60a0ce0782 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_RPM_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_RPM_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -73,6 +73,6 @@ class OnVIRpmNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_RPM_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h
index 4afaafc9ff..4920fbd661 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_SPEED_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_SPEED_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -73,6 +73,6 @@ class OnVISpeedNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_SPEED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h
index 0d0aeadad8..cff99ecf8e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_STEERING_WHEEL_ANGLE_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_STEERING_WHEEL_ANGLE_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVISteeringWheelAngleNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_STEERING_WHEEL_ANGLE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h
index c358ed37e9..0399780869 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_TIRE_PRESSURE_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_TIRE_PRESSURE_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVITirePressureNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_TIRE_PRESSURE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h
index 75062a51e1..60b686683f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_VIN_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_VIN_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -73,6 +73,6 @@ class OnVIVinNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_VIN_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h
index de7a5dfc9e..a6e1ba9921 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_WIPER_STATUS_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_WIPER_STATUS_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -75,6 +75,6 @@ class OnVIWiperStatusNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_WIPER_STATUS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h
index 7a7cf3cd96..6d6d4a69db 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h
@@ -74,6 +74,6 @@ class OnVideoDataStreamingNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VIDEO_DATA_STREAMING_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h
index 3ef21fc568..58ea2e07b5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VR_COMMAND_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VR_COMMAND_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_impl.h"
+#include "application_manager/commands/notification_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -73,6 +73,6 @@ class OnVRCommandNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VR_COMMAND_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h
index e6bd39d46e..f583d1e2fe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h
@@ -74,6 +74,6 @@ class OnVRLanguageChangeNotification
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VR_LANGUAGE_CHANGE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h
index abca9db91d..98ed40101b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h
@@ -72,6 +72,6 @@ class OnVRStartedNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VR_STARTED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h
index 9b53214f8f..e16b440da7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h
@@ -72,6 +72,6 @@ class OnVRStoppedNotification : public app_mngr::commands::NotificationFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VR_STOPPED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h
index 8f94d4876a..57a90955f4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h
@@ -72,6 +72,6 @@ class RCGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_RC_GET_CAPABILITIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_response.h
index dec31c9ea1..e0c305f796 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_response.h
@@ -72,6 +72,6 @@ class RCGetCapabilitiesResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_RC_GET_CAPABILITIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h
index 3ba614f823..305a866659 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h
@@ -89,6 +89,6 @@ class RCIsReadyRequest : public app_mngr::commands::RequestToHMI,
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_RC_IS_READY_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h
index 93f30e795c..5f4af23527 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h
@@ -72,6 +72,6 @@ class RCIsReadyResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_RC_IS_READY_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h
index e97312b881..2751104486 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_ACTIVATE_APP_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_ACTIVATE_APP_REQUEST_H_
-#include "application_manager/commands/request_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/request_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -109,6 +109,6 @@ class SDLActivateAppRequest : public app_mngr::commands::RequestFromHMI {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_ACTIVATE_APP_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h
index 7a3f5157da..fd8b885e88 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h
@@ -71,6 +71,6 @@ class SDLActivateAppResponse : public app_mngr::commands::ResponseToHMI {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_ACTIVATE_APP_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_request.h
index 61426e0af3..acf390cfbc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_request.h
@@ -73,6 +73,6 @@ class SDLGetListOfPermissionsRequest
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_LIST_OF_PERMISSIONS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h
index e2556bac3d..4fc1775c72 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h
@@ -74,6 +74,6 @@ class SDLGetListOfPermissionsResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_LIST_OF_PERMISSIONS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_get_vehicle_data_response_template.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_request.h
index e28c55ba12..043a4369c5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_get_vehicle_data_response_template.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_request.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,54 +30,55 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_DATA_RESPONSE_TEMPLATE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_DATA_RESPONSE_TEMPLATE_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_POLICY_CONFIGURATION_DATA_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_POLICY_CONFIGURATION_DATA_REQUEST_H_
-#include "application_manager/event_engine/event.h"
-#include "application_manager/commands/response_from_hmi.h"
-#include "application_manager/application_manager.h"
+#include "application_manager/commands/request_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
+
namespace commands {
/**
- * @brief VIGetVehicleDataResponseTemplate command class
+ * @brief SDLGetPolicyConfigurationDataRequest command class
**/
-template <event_engine::Event::EventID eventID>
-class VIGetVehicleDataResponseTemplate : public ResponseFromHMI {
+class SDLGetPolicyConfigurationDataRequest
+ : public app_mngr::commands::RequestFromHMI {
public:
/**
- * @brief VIGetVehicleDataResponseTemplate class constructor
+ * @brief SDLGetPolicyConfigurationDataRequest class constructor
*
* @param message Incoming SmartObject message
**/
- VIGetVehicleDataResponseTemplate(
+ SDLGetPolicyConfigurationDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief SDLGetPolicyConfigurationDataRequest class destructor
+ **/
+ ~SDLGetPolicyConfigurationDataRequest() OVERRIDE;
/**
* @brief Execute command
**/
- virtual void Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- event_engine::Event event(eventID);
- event.set_smart_object(*message_);
- event.raise(application_manager_.event_dispatcher());
- }
+ void Run() OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(VIGetVehicleDataResponseTemplate<eventID>);
+ hmi_apis::Common_Result::eType PrepareResponseParams(
+ smart_objects::SmartObject& response_out) const;
+
+ smart_objects::SmartObject GetValueParam(
+ const Json::Value& policy_property) const;
+
+ DISALLOW_COPY_AND_ASSIGN(SDLGetPolicyConfigurationDataRequest);
};
} // namespace commands
-} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_DATA_RESPONSE_TEMPLATE_H_
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_POLICY_CONFIGURATION_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_response.h
new file mode 100644
index 0000000000..2c22f69281
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_response.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_POLICY_CONFIGURATION_DATA_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_POLICY_CONFIGURATION_DATA_RESPONSE_H_
+
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief SDLGetPolicyConfigurationDataResponse command class
+ **/
+class SDLGetPolicyConfigurationDataResponse
+ : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief SDLGetPolicyConfigurationDataResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ SDLGetPolicyConfigurationDataResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief SDLGetPolicyConfigurationDataResponse class destructor
+ **/
+ virtual ~SDLGetPolicyConfigurationDataResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SDLGetPolicyConfigurationDataResponse);
+};
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_POLICY_CONFIGURATION_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_status_update_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_status_update_request.h
index b6376bacc6..fae0b6480d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_status_update_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_status_update_request.h
@@ -71,6 +71,6 @@ class SDLGetStatusUpdateRequest : public app_mngr::commands::RequestFromHMI {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_STATUS_UPDATE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h
index 4e6da22370..1c10142c99 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h
@@ -72,6 +72,6 @@ class SDLGetStatusUpdateResponse : public app_mngr::commands::ResponseToHMI {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_STATUS_UPDATE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_request.h
index 75902e2733..18ad1fa535 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_request.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_USER_FRIENDLY_MESSAGE_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_USER_FRIENDLY_MESSAGE_REQUEST_H_
-#include "application_manager/commands/request_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/request_from_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -74,6 +74,6 @@ class SDLGetUserFriendlyMessageRequest
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_USER_FRIENDLY_MESSAGE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h
index a02d6894e3..101a13b218 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h
@@ -74,6 +74,6 @@ class SDLGetUserFriendlyMessageResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_GET_USER_FRIENDLY_MESSAGE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_policy_update.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_policy_update.h
index f164aed775..e330e847b0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_policy_update.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_policy_update.h
@@ -43,10 +43,10 @@ namespace commands {
class SDLPolicyUpdate : public app_mngr::commands::RequestToHMI {
public:
/**
- * @brief SDLPolicyUpdate class constructor
- *
- * @param message Incoming SmartObject message
- **/
+ * @brief SDLPolicyUpdate class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
SDLPolicyUpdate(const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
@@ -66,6 +66,6 @@ class SDLPolicyUpdate : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_POLICY_UPDATE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_policy_update_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_policy_update_response.h
index 63f33477b6..ce7125f251 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_policy_update_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_policy_update_response.h
@@ -69,6 +69,6 @@ class SDLPolicyUpdateResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SDL_POLICY_UPDATE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h
index 229ed92947..0905e90b45 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h
@@ -73,6 +73,6 @@ class TTSChangeRegistrationRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_CHANGE_REGISTRATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_change_registration_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_change_registration_response.h
index 8462178283..1988a7ee62 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_change_registration_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_change_registration_response.h
@@ -74,6 +74,6 @@ class TTSChangeRegistratioResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_CHANGE_REGISTRATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h
index df6cf3b4a4..d636485915 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h
@@ -72,6 +72,6 @@ class TTSGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_GET_CAPABILITIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_response.h
index 7919f213a4..5c9b60e2f8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_response.h
@@ -73,6 +73,6 @@ class TTSGetCapabilitiesResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_GET_CAPABILITIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h
index 09345c02d7..73ef8c5234 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h
@@ -72,6 +72,6 @@ class TTSGetLanguageRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_GET_LANGUAGE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_response.h
index e52dbf1ada..b29b3e7314 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_response.h
@@ -72,6 +72,6 @@ class TTSGetLanguageResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_GET_LANGUAGE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h
index c42d0257d3..a24a6446b3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h
@@ -74,6 +74,6 @@ class TTSGetSupportedLanguagesRequest
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_GET_SUPPORTED_LANGUAGES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_response.h
index cc24db22b9..25850de5f2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_response.h
@@ -74,6 +74,6 @@ class TTSGetSupportedLanguagesResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_GET_SUPPORTED_LANGUAGES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h
index b7dffd5bde..dd360eeb4a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h
@@ -88,6 +88,6 @@ class TTSIsReadyRequest : public app_mngr::commands::RequestToHMI,
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_IS_READY_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_response.h
index 268edd0eeb..881cd98179 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_response.h
@@ -72,6 +72,6 @@ class TTSIsReadyResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_IS_READY_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h
index f416b3a787..009ee8f0be 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h
@@ -73,6 +73,6 @@ class TTSSetGlobalPropertiesRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_SET_GLOBAL_PROPERTIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_response.h
index ff5622296c..d7ac422e57 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_response.h
@@ -74,6 +74,6 @@ class TTSSetGlobalPropertiesResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_SET_GLOBAL_PROPERTIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_speak_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_speak_request.h
index 9e8915a440..efb67243fa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_speak_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_speak_request.h
@@ -72,6 +72,6 @@ class TTSSpeakRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_SPEAK_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_speak_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_speak_response.h
index e4b2c8adbd..d516a9df1e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_speak_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_speak_response.h
@@ -72,6 +72,6 @@ class TTSSpeakResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_SPEAK_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_stop_speaking_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_stop_speaking_request.h
index 8eb6a66c95..f3ce24d928 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_stop_speaking_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_stop_speaking_request.h
@@ -72,6 +72,6 @@ class TTSStopSpeakingRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_STOP_SPEAKING_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_stop_speaking_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_stop_speaking_response.h
index d433fe2280..6399193ae6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_stop_speaking_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_stop_speaking_response.h
@@ -72,6 +72,6 @@ class TTSStopSpeakingResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_TTS_STOP_SPEAKING_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h
index e5d2483576..2d1e84fbec 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h
@@ -72,6 +72,6 @@ class UIAddCommandRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_ADD_COMMAND_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_response.h
index 90a9666561..cf69368551 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_response.h
@@ -72,6 +72,6 @@ class UIAddCommandResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_ADD_COMMAND_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h
index 5de5e41cd6..0cd120b3cd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h
@@ -72,6 +72,6 @@ class UIAddSubmenuRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_ADD_SUBMENU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_response.h
index 20f830be27..5e951600bd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_response.h
@@ -72,6 +72,6 @@ class UIAddSubmenuResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_ADD_SUBMENU_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_alert_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_alert_request.h
index 6235a51c7d..3c0423e35e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_alert_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_alert_request.h
@@ -72,6 +72,6 @@ class UIAlertRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_ALERT_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_alert_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_alert_response.h
index b43185af78..0392da0c7b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_alert_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_alert_response.h
@@ -72,6 +72,6 @@ class UIAlertResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_ALERT_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_get_vehicle_data_request_template.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_request.h
index 0c3c63c32c..a637f53df3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_get_vehicle_data_request_template.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_request.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,54 +30,50 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_DATA_REQUEST_TEMPLATE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_DATA_REQUEST_TEMPLATE_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CANCEL_INTERACTION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CANCEL_INTERACTION_REQUEST_H_
-#include "application_manager/event_engine/event.h"
#include "application_manager/commands/request_to_hmi.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
+
namespace commands {
/**
- * @brief VIGetVehicleDataRequestTemplate command class
- *
- * Template class for sending 1 subscribe thin request
+ * @brief UICancelInteractionRequest command class
**/
-template <event_engine::Event::EventID eventID>
-class VIGetVehicleDataRequestTemplate
- : public app_mngr::commands::RequestToHMI {
+class UICancelInteractionRequest : public app_mngr::commands::RequestToHMI {
public:
/**
- * @brief VIGetVehicleDataRequestTemplate class constructor
+ * @brief UICancelInteractionRequest class constructor
*
* @param message Incoming SmartObject message
**/
- VIGetVehicleDataRequestTemplate(
+ UICancelInteractionRequest(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ policy::PolicyHandlerInterface& policy_handle);
/**
- * @brief Execute command with sending DBus thin request to HMI
+ * @brief UICancelInteractionRequest class destructor
**/
- virtual void Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- SendRequest();
- }
+ virtual ~UICancelInteractionRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
private:
- DISALLOW_COPY_AND_ASSIGN(VIGetVehicleDataRequestTemplate<eventID>);
+ DISALLOW_COPY_AND_ASSIGN(UICancelInteractionRequest);
};
} // namespace commands
-} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_DATA_REQUEST_TEMPLATE_H_
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CANCEL_INTERACTION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h
index 654dff25b5..751a2ceef8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_RESPONSE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_RESPONSE_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CANCEL_INTERACTION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CANCEL_INTERACTION_RESPONSE_H_
#include "application_manager/commands/response_from_hmi.h"
@@ -41,24 +41,26 @@ namespace app_mngr = application_manager;
namespace commands {
/**
- * @brief UISetIconResponse command class
+ * @brief UICancelInteractionResponse command class
**/
-class UISetIconResponse : public app_mngr::commands::ResponseFromHMI {
+class UICancelInteractionResponse : public app_mngr::commands::ResponseFromHMI {
public:
/**
- * @brief UISetIconResponse class constructor
+ * @brief UICancelInteractionResponse class constructor
*
* @param message Incoming SmartObject message
**/
- UISetIconResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ UICancelInteractionResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
/**
- * @brief UISetIconResponse class destructor
+ * @brief UICancelInteractionResponse class destructor
**/
- virtual ~UISetIconResponse();
+ virtual ~UICancelInteractionResponse();
/**
* @brief Execute command
@@ -66,11 +68,11 @@ class UISetIconResponse : public app_mngr::commands::ResponseFromHMI {
virtual void Run();
private:
- DISALLOW_COPY_AND_ASSIGN(UISetIconResponse);
+ DISALLOW_COPY_AND_ASSIGN(UICancelInteractionResponse);
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_RESPONSE_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CANCEL_INTERACTION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_change_registration_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_change_registration_request.h
index c504c55727..44440bf49d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_change_registration_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_change_registration_request.h
@@ -73,6 +73,6 @@ class UIChangeRegistrationRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CHANGE_REGISTRATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_change_registration_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_change_registration_response.h
index d7fca83d3e..e0077744a1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_change_registration_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_change_registration_response.h
@@ -73,6 +73,6 @@ class UIChangeRegistratioResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CHANGE_REGISTRATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h
new file mode 100644
index 0000000000..6fe8e182c4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UI.CreateWindow request command class
+ **/
+class UICreateWindowRequest : public app_mngr::commands::RequestToHMI {
+ public:
+ UICreateWindowRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ ~UICreateWindowRequest() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UICreateWindowRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_response.h
new file mode 100644
index 0000000000..b9452fce1f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_response.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UI.CreateWindow response command class
+ **/
+class UICreateWindowResponse : public app_mngr::commands::ResponseFromHMI {
+ public:
+ UICreateWindowResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ ~UICreateWindowResponse() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UICreateWindowResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_command_request.h
index ecc0b44495..4af8b91793 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_command_request.h
@@ -72,6 +72,6 @@ class UIDeleteCommandRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_COMMAND_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_command_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_command_response.h
index f9601b7491..1eda0d362a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_command_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_command_response.h
@@ -72,6 +72,6 @@ class UIDeleteCommandResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_COMMAND_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_submenu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_submenu_request.h
index 3161c84b7c..9a7cd97ec7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_submenu_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_submenu_request.h
@@ -72,6 +72,6 @@ class UIDeleteSubmenuRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_SUBMENU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_submenu_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_submenu_response.h
index 7c73a53c3e..3edb8489e0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_submenu_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_submenu_response.h
@@ -72,6 +72,6 @@ class UIDeleteSubmenuResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_SUBMENU_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h
new file mode 100644
index 0000000000..58b2c3989f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UI.DeleteWindow request command class
+ **/
+class UIDeleteWindowRequest : public app_mngr::commands::RequestToHMI {
+ public:
+ UIDeleteWindowRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ ~UIDeleteWindowRequest() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UIDeleteWindowRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h
new file mode 100644
index 0000000000..1500a3f9b2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UI.DeleteWindow response command class
+ **/
+class UIDeleteWindowResponse : public app_mngr::commands::ResponseFromHMI {
+ public:
+ UIDeleteWindowResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ ~UIDeleteWindowResponse() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UIDeleteWindowResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_request.h
index 8d34e1852b..90bf6f7dbc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_request.h
@@ -73,6 +73,6 @@ class UIEndAudioPassThruRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_END_AUDIO_PASS_THRU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_response.h
index b1c3bfd87a..69a7959e53 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_response.h
@@ -73,6 +73,6 @@ class UIEndAudioPassThruResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_END_AUDIO_PASS_THRU_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h
index 47782cc7a9..58d8d0f732 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h
@@ -72,6 +72,6 @@ class UIGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_GET_CAPABILITIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_response.h
index 421844560d..d83d5f211b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_response.h
@@ -72,6 +72,6 @@ class UIGetCapabilitiesResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_GET_CAPABILITIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h
index 7c82584178..842a97a717 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h
@@ -72,6 +72,6 @@ class UIGetLanguageRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_GET_LANGUAGE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_response.h
index 7354e87ee4..ec02b6fde9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_response.h
@@ -72,6 +72,6 @@ class UIGetLanguageResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_GET_LANGUAGE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h
index 7fd456b92b..42ea555358 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h
@@ -73,6 +73,6 @@ class UIGetSupportedLanguagesRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_GET_SUPPORTED_LANGUAGES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_response.h
index 26d8e98892..45137ba518 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_response.h
@@ -74,6 +74,6 @@ class UIGetSupportedLanguagesResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_GET_SUPPORTED_LANGUAGES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h
index 2e7806cd2b..18536032b7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h
@@ -88,6 +88,6 @@ class UIIsReadyRequest : public app_mngr::commands::RequestToHMI,
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_IS_READY_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_response.h
index f2b4f201f3..790c0115aa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_response.h
@@ -72,6 +72,6 @@ class UIIsReadyResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_IS_READY_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_request.h
index 6d4e870228..be7d384583 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_request.h
@@ -73,6 +73,6 @@ class UIPerformAudioPassThruRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_PERFORM_AUDIO_PASS_THRU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_response.h
index e36a292573..05f2cc84fd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_response.h
@@ -74,6 +74,6 @@ class UIPerformAudioPassThruResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_PERFORM_AUDIO_PASS_THRU_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_interaction_request.h
index ff4540de23..15cec6c17e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_interaction_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_interaction_request.h
@@ -73,6 +73,6 @@ class UIPerformInteractionRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_PERFORM_INTERACTION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_interaction_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_interaction_response.h
index caf5716e18..2d13e15ad2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_interaction_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_perform_interaction_response.h
@@ -74,6 +74,6 @@ class UIPerformInteractionResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_PERFORM_INTERACTION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h
index f5acf41c8d..bc25259662 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h
@@ -73,6 +73,6 @@ class UIScrollableMessageRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SCROLLABLE_MESSAGE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_scrollable_message_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_scrollable_message_response.h
index e46265c0e4..f7f92600cd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_scrollable_message_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_scrollable_message_response.h
@@ -73,6 +73,6 @@ class UIScrollableMessageResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SCROLLABLE_MESSAGE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h
index 4e260a99ff..56ffe40c21 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h
@@ -73,6 +73,6 @@ class UISendHapticDataRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_response.h
index 1bf38939be..439c2f2682 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_response.h
@@ -73,6 +73,6 @@ class UISendHapticDataResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SEND_HAPTIC_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h
index ea526df135..a7d07628e3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h
@@ -72,6 +72,6 @@ class UISetAppIconRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_APP_ICON_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_app_icon_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_app_icon_response.h
index af2c4fafea..3e4b338439 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_app_icon_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_app_icon_response.h
@@ -72,6 +72,6 @@ class UISetAppIconResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_APP_ICON_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h
index f60f7325fd..446b77b997 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h
@@ -71,6 +71,6 @@ class UiSetDisplayLayoutRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_DISPLAY_LAYOUT_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h
index ce404a4049..ade6aa1c13 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h
@@ -73,6 +73,6 @@ class UiSetDisplayLayoutResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_DISPLAY_LAYOUT_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h
index 44e8bba450..8df60a318a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h
@@ -73,6 +73,6 @@ class UISetGlobalPropertiesRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_GLOBAL_PROPERTIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_response.h
index a9c27a423b..a189093fc7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_response.h
@@ -74,6 +74,6 @@ class UISetGlobalPropertiesResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_GLOBAL_PROPERTIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_request.h
index 24f4d76d89..b1b196a25f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_request.h
@@ -73,6 +73,6 @@ class UISetMediaClockTimerRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_MEDIA_CLOCK_TIMER_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_response.h
index c664bd04f9..23b6d3aefa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_response.h
@@ -74,6 +74,6 @@ class UISetMediaClockTimerResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_MEDIA_CLOCK_TIMER_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h
index 84c275ec5a..c47d73b858 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_icon_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_REQUEST_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_REQUEST_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
@@ -41,37 +41,34 @@ namespace app_mngr = application_manager;
namespace commands {
/**
- * @brief UISetIconRequest command class
+ * @brief UIShowAppMenuRequest command class
**/
-class UISetIconRequest : public app_mngr::commands::RequestToHMI {
+class UIShowAppMenuRequest : public app_mngr::commands::RequestToHMI {
public:
/**
- * @brief UISetIconRequest class constructor
- *
- * @param message Incoming SmartObject message
+ * @brief UIShowAppMenuRequest class constructor
**/
- UISetIconRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ UIShowAppMenuRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
/**
- * @brief UISetIconRequest class destructor
+ * @brief UIShowAppMenuRequest class destructor
**/
- virtual ~UISetIconRequest();
+ ~UIShowAppMenuRequest() OVERRIDE;
/**
* @brief Execute command
**/
- virtual void Run();
+ void Run() OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(UISetIconRequest);
+ DISALLOW_COPY_AND_ASSIGN(UIShowAppMenuRequest);
};
} // namespace commands
+} // namespace sdl_rpc_plugin
-} // namespace application_manager
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SET_ICON_REQUEST_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h
new file mode 100644
index 0000000000..c03a043e12
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UIShowAppMenuResponse command class
+ **/
+class UIShowAppMenuResponse : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief UIShowAppMenuResponse class constructor
+ **/
+ UIShowAppMenuResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief UIShowAppMenuResponse class destructor
+ **/
+ ~UIShowAppMenuResponse() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UIShowAppMenuResponse);
+};
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_request.h
index 7ba950d530..6024243481 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_request.h
@@ -72,6 +72,6 @@ class UIShowRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_response.h
index f9f7a61056..4d19667153 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_response.h
@@ -72,6 +72,6 @@ class UIShowResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_slider_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_slider_request.h
index 3de1b4e775..c41e02b44f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_slider_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_slider_request.h
@@ -72,6 +72,6 @@ class UISliderRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SLIDER_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_slider_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_slider_response.h
index 17d1f8a8ed..f4e4465568 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_slider_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_slider_response.h
@@ -72,6 +72,6 @@ class UISliderResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SLIDER_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_app_list_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_app_list_request.h
index dc0166e33f..b352a3b273 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_app_list_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_app_list_request.h
@@ -72,6 +72,6 @@ class UpdateAppListRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UPDATE_APP_LIST_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_app_list_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_app_list_response.h
index 2e3bb79233..a31621dbd5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_app_list_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_app_list_response.h
@@ -72,6 +72,6 @@ class UpdateAppListResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UPDATE_APP_LIST_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_request.h
index c4c9f11e06..db4f265a9f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_request.h
@@ -35,8 +35,8 @@
#include "application_manager/commands/request_to_hmi.h"
#include "application_manager/event_engine/event_observer.h"
-#include "utils/lock.h"
#include "utils/conditional_variable.h"
+#include "utils/lock.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -92,6 +92,6 @@ class UpdateDeviceListRequest : public app_mngr::commands::RequestToHMI,
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UPDATE_DEVICE_LIST_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_response.h
index c33518a545..5f7afed2c3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_device_list_response.h
@@ -72,6 +72,6 @@ class UpdateDeviceListResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UPDATE_DEVICE_LIST_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_sdl_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_sdl_request.h
index e30b045fcb..3e001b2582 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_sdl_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_sdl_request.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UPDATE_SDL_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UPDATE_SDL_REQUEST_H_
-#include "application_manager/commands/request_to_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/request_to_hmi.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -73,6 +73,6 @@ class UpdateSDLRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UPDATE_SDL_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_sdl_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_sdl_response.h
index f71921ea3a..a6fc917872 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_sdl_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/update_sdl_response.h
@@ -72,6 +72,6 @@ class UpdateSDLResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UPDATE_SDL_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_subscribe_vehicle_data_response_template.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_subscribe_vehicle_data_response_template.h
deleted file mode 100644
index 42dba56345..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_subscribe_vehicle_data_response_template.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2018, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_SUBSCRIBE_VEHICLE_DATA_RESPONSE_TEMPLATE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_SUBSCRIBE_VEHICLE_DATA_RESPONSE_TEMPLATE_H_
-
-#include "application_manager/event_engine/event.h"
-#include "application_manager/commands/response_from_hmi.h"
-#include "application_manager/application_manager.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-namespace commands {
-/**
- * @brief VISubscriveVehicleDataResponseTemplate command class
- **/
-template <event_engine::Event::EventID eventID>
-class VISubscribeVehicleDataResponseTemplate : public ResponseFromHMI {
- public:
- /**
- * @brief VISubscriveVehicleDataResponseTemplate class constructor
- *
- * @param message Incoming SmartObject message
- **/
- VISubscribeVehicleDataResponseTemplate(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
- /**
- * @brief Execute command
- **/
- virtual void Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- event_engine::Event event(eventID);
- event.set_smart_object(*message_);
- event.raise(application_manager_.event_dispatcher());
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(VISubscribeVehicleDataResponseTemplate<eventID>);
-};
-
-} // namespace commands
-} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_SUBSCRIBE_VEHICLE_DATA_RESPONSE_TEMPLATE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h
deleted file mode 100644
index 2cb5d622b1..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2018, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_UNSUBSCRIBE_VEHICLE_DATA_REQUEST_TEMPLATE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_UNSUBSCRIBE_VEHICLE_DATA_REQUEST_TEMPLATE_H_
-
-#include "application_manager/event_engine/event.h"
-#include "application_manager/commands/request_to_hmi.h"
-
-namespace sdl_rpc_plugin {
-namespace app_mngr = application_manager;
-namespace commands {
-
-/**
- * @brief VIUnsubscriveVehicleDataRequestTemplate command class
- *
- * Template class for sending 1 unsubscribe thin request
- **/
-template <event_engine::Event::EventID eventID>
-class VIUnsubscribeVehicleDataRequestTemplate
- : public app_mngr::commands::RequestToHMI {
- public:
- /**
- * @brief VIUnsubscriveVehicleDataRequestTemplate class constructor
- *
- * @param message Incoming SmartObject message
- **/
- VIUnsubscribeVehicleDataRequestTemplate(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
- /**
- * @brief Execute command with sending DBus thin request to HMI
- **/
- virtual void Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- SendRequest();
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(VIUnsubscribeVehicleDataRequestTemplate<eventID>);
-};
-
-} // namespace commands
-} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_UNSUBSCRIBE_VEHICLE_DATA_REQUEST_TEMPLATE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h
index 0abb37adbc..b40245256e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h
@@ -72,6 +72,6 @@ class VRAddCommandRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_ADD_COMMAND_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_response.h
index 5f9c99a483..dc123bc82f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_response.h
@@ -72,6 +72,6 @@ class VRAddCommandResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_ADD_COMMAND_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_change_registration_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_change_registration_request.h
index 4af28cb542..418842395d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_change_registration_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_change_registration_request.h
@@ -73,6 +73,6 @@ class VRChangeRegistrationRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_CHANGE_REGISTRATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_change_registration_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_change_registration_response.h
index a80df0968b..08f3dfa501 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_change_registration_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_change_registration_response.h
@@ -74,6 +74,6 @@ class VRChangeRegistrationResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_CHANGE_REGISTRATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_delete_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_delete_command_request.h
index 0ed9521ec5..2e1aa7c0d1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_delete_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_delete_command_request.h
@@ -72,6 +72,6 @@ class VRDeleteCommandRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_DELETE_COMMAND_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_delete_command_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_delete_command_response.h
index 63efcab355..a7d45ed5ea 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_delete_command_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_delete_command_response.h
@@ -72,6 +72,6 @@ class VRDeleteCommandResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_DELETE_COMMAND_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h
index f8ac83af58..254d00452f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h
@@ -72,6 +72,6 @@ class VRGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_GET_CAPABILITIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_response.h
index 9c9bb55b1b..781e38cda2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_response.h
@@ -72,6 +72,6 @@ class VRGetCapabilitiesResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_GET_CAPABILITIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h
index e764cbef91..441795cfb5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h
@@ -72,6 +72,6 @@ class VRGetLanguageRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_GET_LANGUAGE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_response.h
index 470fe3ebdc..2bc08e5173 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_response.h
@@ -72,6 +72,6 @@ class VRGetLanguageResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_GET_LANGUAGE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h
index 8d9e9e2a61..ad87415a87 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h
@@ -73,6 +73,6 @@ class VRGetSupportedLanguagesRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_GET_SUPPORTED_LANGUAGES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_response.h
index 735844cd99..16a67d6468 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_response.h
@@ -74,6 +74,6 @@ class VRGetSupportedLanguagesResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_GET_SUPPORTED_LANGUAGES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h
index 0b580f6c1d..2dba80065a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h
@@ -89,6 +89,6 @@ class VRIsReadyRequest : public app_mngr::commands::RequestToHMI,
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_IS_READY_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_response.h
index 42c47f5077..f901147094 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_response.h
@@ -72,6 +72,6 @@ class VRIsReadyResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_IS_READY_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_perform_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_perform_interaction_request.h
index 6f206c010f..8cbd2e346e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_perform_interaction_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_perform_interaction_request.h
@@ -73,6 +73,6 @@ class VRPerformInteractionRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_PERFORM_INTERACTION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_perform_interaction_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_perform_interaction_response.h
index 9e8599419f..60cb4cb80c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_perform_interaction_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_perform_interaction_response.h
@@ -74,6 +74,6 @@ class VRPerformInteractionResponse
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VR_PERFORM_INTERACTION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h
index 745fb3ec18..8cac0d686d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h
@@ -164,6 +164,6 @@ class AddCommandRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ADD_COMMAND_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_response.h
index fb3f172b0b..811bda2cc7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_response.h
@@ -73,6 +73,6 @@ class AddCommandResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ADD_COMMAND_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h
index 37ba9a5990..d99c5dab38 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h
@@ -88,10 +88,12 @@ class AddSubMenuRequest : public app_mngr::commands::CommandRequestImpl {
*/
bool CheckSubMenuName();
+ bool is_menu_layout_available_ = true;
+
DISALLOW_COPY_AND_ASSIGN(AddSubMenuRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ADD_SUB_MENU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_response.h
index 253556f899..ba15f04cd0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_response.h
@@ -73,6 +73,6 @@ class AddSubMenuResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ADD_SUB_MENU_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h
index 93f716cb65..8b7e86fb3f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h
@@ -105,6 +105,6 @@ class AlertManeuverRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ALERT_MANEUVER_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_response.h
index 8b21aa64eb..2f21fadb54 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_response.h
@@ -73,6 +73,6 @@ class AlertManeuverResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ALERT_MANEUVER_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h
index e34653daf4..dfc7b73487 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h
@@ -149,6 +149,6 @@ class AlertRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ALERT_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_response.h
index 4ae95fb979..51de24fd41 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_response.h
@@ -73,6 +73,6 @@ class AlertResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ALERT_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h
index f994f06ca3..0063c07512 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h
@@ -1,6 +1,5 @@
/*
-
- Copyright (c) 2018, Ford Motor Company
+ Copyright (c) 2019, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -31,12 +30,11 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_REQUEST_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_REQUEST_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_REQUEST_H_
#include "application_manager/commands/command_request_impl.h"
-#include "application_manager/application_manager.h"
-#include "utils/macro.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -44,30 +42,30 @@ namespace app_mngr = application_manager;
namespace commands {
/**
- * @brief SetIconRequest command class
+ * @brief CancelInteractionRequest command class
**/
-class SetIconRequest : public app_mngr::commands::CommandRequestImpl {
+class CancelInteractionRequest : public app_mngr::commands::CommandRequestImpl {
public:
/**
- * @brief Contains information about the type of image
- */
- typedef enum { STATIC = 0, DYNAMIC } ImageType;
-
- /**
- * @brief SetIconRequest class constructor
+ * @brief CancelInteractionRequest class constructor
*
* @param message Incoming SmartObject message
**/
- SetIconRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ CancelInteractionRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
/**
- * @brief SetIconRequest class destructor
+ * @brief CancelInteractionRequest class destructor
**/
- virtual ~SetIconRequest();
+ virtual ~CancelInteractionRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
/**
* @brief Interface method that is called whenever new event received
@@ -76,16 +74,12 @@ class SetIconRequest : public app_mngr::commands::CommandRequestImpl {
*/
void on_event(const app_mngr::event_engine::Event& event);
- /**
- * @brief Execute command
- **/
- virtual void Run();
-
private:
- DISALLOW_COPY_AND_ASSIGN(SetIconRequest);
+ DISALLOW_COPY_AND_ASSIGN(CancelInteractionRequest);
};
} // namespace commands
-} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_REQUEST_H_
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h
new file mode 100644
index 0000000000..3e8536e617
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CancelInteractionResponse command class
+ **/
+class CancelInteractionResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief CancelInteractionResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ CancelInteractionResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief CancelInteractionResponse class destructor
+ **/
+ virtual ~CancelInteractionResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CancelInteractionResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h
index bd5c34ebd1..f9f780b84b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h
@@ -38,8 +38,8 @@
#include "application_manager/commands/command_request_impl.h"
#include "application_manager/commands/pending.h"
-#include "utils/macro.h"
#include "utils/custom_string.h"
+#include "utils/macro.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -123,11 +123,12 @@ class ChangeRegistrationRequest
/**
* @brief Check parameters (name, vr) for
* coincidence with already known parameters of registered applications
- *
+ * @param device_id device identifier
* @return SUCCESS if there is no coincidence of app.name/VR synonyms,
* otherwise appropriate error code returns
*/
- mobile_apis::Result::eType CheckCoincidence();
+ mobile_apis::Result::eType CheckCoincidence(
+ const connection_handler::DeviceHandle& device_id);
/**
* @brief Checks if requested name is allowed by policy
@@ -146,11 +147,11 @@ class ChangeRegistrationRequest
std::string& ResponseInfo);
/**
- * @brief Predicate for using with CheckCoincidence method to compare with VR
- * synonym SO
- *
- * @return TRUE if there is coincidence of VR, otherwise FALSE
- */
+ * @brief Predicate for using with CheckCoincidence method to compare with VR
+ * synonym SO
+ *
+ * @return TRUE if there is coincidence of VR, otherwise FALSE
+ */
struct CoincidencePredicateVR {
CoincidencePredicateVR(const custom_str::CustomString& newItem)
: newItem_(newItem) {}
@@ -186,6 +187,6 @@ class ChangeRegistrationRequest
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CHANGE_REGISTRATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_response.h
index 4cb8c394c7..8c3b7f0be3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_response.h
@@ -75,6 +75,6 @@ class ChangeRegistrationResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CHANGE_REGISTRATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h
new file mode 100644
index 0000000000..b965e880b4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h
@@ -0,0 +1,85 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CloseApplicationRequest command class
+ **/
+class CloseApplicationRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief CloseApplicationRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ CloseApplicationRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief CloseApplicationRequest class destructor
+ **/
+ ~CloseApplicationRequest() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ void on_event(const app_mngr::event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CloseApplicationRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h
new file mode 100644
index 0000000000..c7b649f4e9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CloseApplicationResponse command class
+ **/
+class CloseApplicationResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief CloseApplicationResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ CloseApplicationResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief CloseApplicationResponse class destructor
+ **/
+ ~CloseApplicationResponse() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CloseApplicationResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h
index 285b0b10db..a1bc866347 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h
@@ -128,6 +128,7 @@ class CreateInteractionChoiceSetRequest
int32_t choice_set_id_;
size_t expected_chs_count_;
size_t received_chs_count_;
+ bool should_send_warnings_;
/**
* @brief Flag for stop sending VR commands to HMI, in case one of responses
@@ -142,7 +143,7 @@ class CreateInteractionChoiceSetRequest
volatile bool is_timed_out_;
sync_primitives::Lock is_timed_out_lock_;
- sync_primitives::Lock vr_commands_lock_;
+ sync_primitives::RecursiveLock vr_commands_lock_;
/*
* @brief Sends VR AddCommand request to HMI
*
@@ -161,11 +162,11 @@ class CreateInteractionChoiceSetRequest
app_mngr::ApplicationConstSharedPtr app);
/*
- * @brief Predicate for using with CheckChoiceSet method to compare choice ID
- *param
- *
- * return TRUE if there is coincidence of choice ID, otherwise FALSE
- */
+ * @brief Predicate for using with CheckChoiceSet method to compare choice ID
+ *param
+ *
+ * return TRUE if there is coincidence of choice ID, otherwise FALSE
+ */
struct CoincidencePredicateChoiceID {
CoincidencePredicateChoiceID(const uint32_t newItem) : newItem_(newItem) {}
@@ -177,11 +178,11 @@ class CreateInteractionChoiceSetRequest
};
/*
- * @brief Predicate for using with CheckChoiceSet method to compare menu name
- *param
- *
- * return TRUE if there is coincidence of menu name, otherwise FALSE
- */
+ * @brief Predicate for using with CheckChoiceSet method to compare menu name
+ *param
+ *
+ * return TRUE if there is coincidence of menu name, otherwise FALSE
+ */
struct CoincidencePredicateMenuName {
CoincidencePredicateMenuName(const std::string& newItem)
: newItem_(newItem) {}
@@ -194,11 +195,11 @@ class CreateInteractionChoiceSetRequest
};
/*
- * @brief Predicate for using with CheckChoiceSet method to compare VR commands
- *param
- *
- * return TRUE if there is coincidence of VR commands, otherwise FALSE
- */
+ * @brief Predicate for using with CheckChoiceSet method to compare VR
+ *commands param
+ *
+ * return TRUE if there is coincidence of VR commands, otherwise FALSE
+ */
struct CoincidencePredicateVRCommands {
CoincidencePredicateVRCommands(const smart_objects::SmartObject& newItem)
: newItem_(newItem) {}
@@ -218,10 +219,10 @@ class CreateInteractionChoiceSetRequest
*
* return Return TRUE if there are similar VR synonyms in choice set,
* otherwise FALSE
- */
+ */
bool compareSynonyms(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice1,
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice2);
+ const ns_smart_device_link::ns_smart_objects::SmartObject& choice1,
+ const ns_smart_device_link::ns_smart_objects::SmartObject& choice2);
/*
* @brief Checks VR synonyms ignoring differences in case.
@@ -231,10 +232,10 @@ class CreateInteractionChoiceSetRequest
*
* return Return TRUE if there are similar VR synonyms in choice set,
* otherwise FALSE
- */
+ */
static bool compareStr(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& str1,
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& str2);
+ const ns_smart_device_link::ns_smart_objects::SmartObject& str1,
+ const ns_smart_device_link::ns_smart_objects::SmartObject& str2);
/**
* @brief Checks choice set params(menuName, tertiaryText, ...)
@@ -272,6 +273,6 @@ class CreateInteractionChoiceSetRequest
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_INTERACTION_CHOICE_SET_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_response.h
index 76718bc2c3..0bfc0e5cdf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_response.h
@@ -75,6 +75,6 @@ class CreateInteractionChoiceSetResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_INTERACTION_CHOICE_SET_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h
new file mode 100644
index 0000000000..cfbfc460b7
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h
@@ -0,0 +1,117 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/hmi_state.h"
+#include "utils/macro.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CreateWindow request command class
+ **/
+class CreateWindowRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ CreateWindowRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ ~CreateWindowRequest() FINAL;
+
+ app_mngr::WindowID window_id() const FINAL;
+
+ void Run() FINAL;
+
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
+ /**
+ * @brief Init sets hash update mode for request
+ */
+ bool Init() FINAL;
+
+ private:
+ /**
+ * @brief CheckWindowName checks if provided window_name exists and allowed to
+ * be created
+ * @param app pointer to application owns affected window
+ * @param window_name window name to check
+ * @return true if window_name is valid, otherwise returns false
+ */
+ bool CheckWindowName(app_mngr::ApplicationSharedPtr app,
+ const app_mngr::WindowID window_id,
+ const std::string& window_name) const;
+
+ /**
+ * @brief ValidateWindowCreation checks whether window can be created
+ * @return true if window can be created, otherwise returns false
+ */
+ bool ValidateWindowCreation(app_mngr::ApplicationSharedPtr app,
+ const app_mngr::WindowID window_id);
+
+ /**
+ * @brief IsWindowForAssociatedServiceCreated check whether a window with
+ * current associated type has already been created
+ * @return true if window has been created, otherwise returns false
+ */
+ bool IsWindowForAssociatedServiceCreated(
+ app_mngr::ApplicationSharedPtr app) const;
+
+ /**
+ * @brief DoesExceedMaxAllowedWindows check wheter max allowed amount of
+ * windows is exceeded
+ * @return true if amount us exceeded, otherwise returns false
+ */
+ bool DoesExceedMaxAllowedWindows(app_mngr::ApplicationSharedPtr app) const;
+
+ /**
+ * @brief ApplyWindowInitialState apply changes related to window HMI state
+ * initialization
+ * @param app pointer to application owns affected window
+ */
+ void ApplyWindowInitialState(app_mngr::ApplicationSharedPtr app) const;
+
+ DISALLOW_COPY_AND_ASSIGN(CreateWindowRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_response.h
new file mode 100644
index 0000000000..5163293a7c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_response.h
@@ -0,0 +1,67 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "utils/macro.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CreateWindow response command class
+ **/
+class CreateWindowResponse : public app_mngr::commands::CommandResponseImpl {
+ public:
+ CreateWindowResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ ~CreateWindowResponse() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CreateWindowResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h
index a21b1928d0..45864ca3aa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h
@@ -114,6 +114,6 @@ class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_COMMAND_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_response.h
index f81f119792..a91012a934 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_response.h
@@ -73,6 +73,6 @@ class DeleteCommandResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_COMMAND_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h
index 02cd0086b6..8e4d63df4a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h
@@ -78,6 +78,6 @@ class DeleteFileRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_FILE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_response.h
index fbdc70c9bc..8fbc79ba9f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_response.h
@@ -73,6 +73,6 @@ class DeleteFileResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_FILE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h
index 4dec11a67b..c1d8759962 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h
@@ -34,8 +34,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_INTERACTION_CHOICE_SET_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_INTERACTION_CHOICE_SET_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application.h"
+#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -90,6 +90,6 @@ class DeleteInteractionChoiceSetRequest
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_INTERACTION_CHOICE_SET_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_response.h
index 0fce16ea9f..bd67f9c556 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_response.h
@@ -75,6 +75,6 @@ class DeleteInteractionChoiceSetResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_INTERACTION_CHOICE_SET_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h
index c947fda78a..2f85065ee7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h
@@ -34,8 +34,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_SUB_MENU_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_SUB_MENU_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application.h"
+#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -104,6 +104,6 @@ class DeleteSubMenuRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_SUB_MENU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_response.h
index e5b0c58a34..c569d61258 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_response.h
@@ -73,6 +73,6 @@ class DeleteSubMenuResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_SUB_MENU_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h
new file mode 100644
index 0000000000..b837724d7b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h
@@ -0,0 +1,91 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/hmi_state.h"
+#include "utils/macro.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CreateWindow request command class
+ **/
+class DeleteWindowRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ DeleteWindowRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ ~DeleteWindowRequest() FINAL;
+
+ void Run() FINAL;
+
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
+ app_mngr::WindowID window_id() const FINAL;
+
+ /**
+ * @brief Init sets hash update mode for request
+ */
+ bool Init() FINAL;
+
+ private:
+ /**
+ * @brief CheckWindowId checks if provided window_id exists and allowed to be
+ * deleted
+ * @param app pointer to application owns affected window
+ * @return true if window_id is valid, otherwise returns false
+ */
+ bool CheckWindowId(app_mngr::ApplicationSharedPtr app) const;
+
+ /**
+ * @brief DeleteWindow deletes data related to a request window id
+ * @param app pointer to applications owns affected window
+ */
+ void DeleteWindow(app_mngr::ApplicationSharedPtr app) const;
+
+ DISALLOW_COPY_AND_ASSIGN(DeleteWindowRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_response.h
new file mode 100644
index 0000000000..279541724a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_response.h
@@ -0,0 +1,67 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "utils/macro.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief DeleteWindow response command class
+ **/
+class DeleteWindowResponse : public app_mngr::commands::CommandResponseImpl {
+ public:
+ DeleteWindowResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ ~DeleteWindowResponse() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DeleteWindowResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h
index 3e313602c7..750288f5e8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h
@@ -61,13 +61,13 @@ class DialNumberRequest : public app_mngr::commands::CommandRequestImpl {
~DialNumberRequest() OVERRIDE;
/**
- * @brief Initialize request params
+ * @brief Initialize request params
**/
bool Init() OVERRIDE;
/**
- * @brief Execute command
- **/
+ * @brief Execute command
+ **/
void Run() OVERRIDE;
/**
@@ -90,6 +90,6 @@ class DialNumberRequest : public app_mngr::commands::CommandRequestImpl {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAL_NUMBER_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_response.h
index 6181231458..9c47537c6f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_response.h
@@ -73,6 +73,6 @@ class DialNumberResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAL_NUMBER_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h
index 319a20958e..1c18de3237 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h
@@ -80,6 +80,6 @@ class EndAudioPassThruRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_END_AUDIO_PASS_THRU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_response.h
index e2a667f272..1003d9d2d7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_response.h
@@ -74,6 +74,6 @@ class EndAudioPassThruResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_END_AUDIO_PASS_THRU_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/generic_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/generic_response.h
index b780daaf03..6516d3cef1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/generic_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/generic_response.h
@@ -72,6 +72,6 @@ class GenericResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GENERIC_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h
new file mode 100644
index 0000000000..3d74a80dc2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h
@@ -0,0 +1,31 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class GetCloudAppPropertiesRequest
+ : public app_mngr::commands::CommandRequestImpl {
+ public:
+ GetCloudAppPropertiesRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ virtual ~GetCloudAppPropertiesRequest();
+ virtual void Run();
+ virtual void on_event(const app_mngr::event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetCloudAppPropertiesRequest);
+}; // GetCloudAppPropertiesRequest
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h
new file mode 100644
index 0000000000..f716c7dcb5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h
@@ -0,0 +1,31 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class GetCloudAppPropertiesResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ GetCloudAppPropertiesResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ virtual ~GetCloudAppPropertiesResponse();
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GetCloudAppPropertiesResponse);
+
+}; // GetCloudAppPropertiesResponse
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h
new file mode 100644
index 0000000000..d4182ea004
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h
@@ -0,0 +1,87 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/event_engine/event.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief GetFileRequest command class
+ **/
+class GetFileRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief GetFileRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ GetFileRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief GetFileRequest class destructor
+ **/
+ virtual ~GetFileRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ bool GetFilePath(std::string& file_path, bool& forward_to_hmi);
+
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
+ private:
+ std::string file_name_;
+ mobile_apis::FileType::eType file_type_;
+ uint32_t length_;
+ uint32_t offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(GetFileRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h
index c83ea3607a..bc191d224c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_icon_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_response.h
@@ -1,6 +1,5 @@
/*
-
- Copyright (c) 2018, Ford Motor Company
+ Copyright (c) 2019, Ford Motor Company, Livio
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -14,9 +13,9 @@
disclaimer in the documentation and/or other materials provided with the
distribution.
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -31,12 +30,10 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_RESPONSE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_RESPONSE_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_
#include "application_manager/commands/command_response_impl.h"
-#include "application_manager/application_manager.h"
-#include "utils/macro.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -44,25 +41,25 @@ namespace app_mngr = application_manager;
namespace commands {
/**
- * @brief SetIconResponse command class
+ * @brief GetFileResponse command class
**/
-class SetIconResponse : public app_mngr::commands::CommandResponseImpl {
+class GetFileResponse : public app_mngr::commands::CommandResponseImpl {
public:
/**
- * @brief SetIconResponse class constructor
+ * @brief GetFileResponse class constructor
*
* @param message Incoming SmartObject message
**/
- SetIconResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& app_man,
+ GetFileResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ policy::PolicyHandlerInterface& policy_handle);
/**
- * @brief SetIconResponse class destructor
+ * @brief GetFileResponse class destructor
**/
- virtual ~SetIconResponse();
+ virtual ~GetFileResponse();
/**
* @brief Execute command
@@ -70,10 +67,11 @@ class SetIconResponse : public app_mngr::commands::CommandResponseImpl {
virtual void Run();
private:
- DISALLOW_COPY_AND_ASSIGN(SetIconResponse);
+ DISALLOW_COPY_AND_ASSIGN(GetFileResponse);
};
} // namespace commands
-} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_ICON_RESPONSE_H_
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h
index b8da061870..a5d1611f02 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h
@@ -61,7 +61,7 @@ class GetSystemCapabilityRequest
DISALLOW_COPY_AND_ASSIGN(GetSystemCapabilityRequest);
}; // GetSystemCapabilityRequest
-} // commands
-} // application_manager
+} // namespace commands
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_response.h
index 9fa954c89f..61079b3ac2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_response.h
@@ -60,7 +60,7 @@ class GetSystemCapabilityResponse
DISALLOW_COPY_AND_ASSIGN(GetSystemCapabilityResponse);
}; // GetSystemCapabilityResponse
-} // commands
-} // application_manager
+} // namespace commands
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h
index 7197874475..ec656820e5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h
@@ -76,6 +76,6 @@ class GetWayPointsRequest : public app_mngr::commands::CommandRequestImpl {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_response.h
index bb480a7ac0..1b8f055e9c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_response.h
@@ -71,6 +71,6 @@ class GetWayPointsResponse : public app_mngr::commands::CommandResponseImpl {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h
index 53d75819f8..d98fa433b4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h
@@ -73,6 +73,6 @@ class ListFilesRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_LIST_FILES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_response.h
index 1b3cdf1b02..d259b27ecf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_response.h
@@ -73,6 +73,6 @@ class ListFilesResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_LIST_FILES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_interface_unregistered_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_interface_unregistered_notification.h
index ba01d4bb28..28508d386c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_interface_unregistered_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_app_interface_unregistered_notification.h
@@ -75,6 +75,6 @@ class OnAppInterfaceUnregisteredNotification
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_APP_INTERFACE_UNREGISTERED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_audio_pass_thru_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_audio_pass_thru_notification.h
index e3410bd873..a6de6b929c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_audio_pass_thru_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_audio_pass_thru_notification.h
@@ -77,6 +77,6 @@ class OnAudioPassThruNotification
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_AUDIO_PASS_THRU_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h
index 6afdc0e1cf..afde9bac92 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h
@@ -34,8 +34,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_BUTTON_EVENT_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_BUTTON_EVENT_NOTIFICATION_H_
-#include "application_manager/commands/command_notification_impl.h"
#include "application_manager/application.h"
+#include "application_manager/commands/command_notification_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -87,6 +87,6 @@ class OnButtonEventNotification
} // namespace mobile
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_BUTTON_EVENT_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h
index fe9bc449be..57fda49be7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h
@@ -34,8 +34,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_BUTTON_PRESS_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_BUTTON_PRESS_NOTIFICATION_H_
-#include "application_manager/commands/command_notification_impl.h"
#include "application_manager/application.h"
+#include "application_manager/commands/command_notification_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -86,6 +86,6 @@ class OnButtonPressNotification
} // namespace mobile
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_BUTTON_PRESS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_command_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_command_notification.h
index 367b280e73..76ee0b4052 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_command_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_command_notification.h
@@ -77,6 +77,6 @@ class OnCommandNotification
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_COMMAND_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_driver_distraction_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_driver_distraction_notification.h
index 82e6097d84..9c7fb5e91b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_driver_distraction_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_driver_distraction_notification.h
@@ -79,6 +79,6 @@ class OnDriverDistractionNotification
} // namespace mobile
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_DRIVER_DISTRACTION_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h
index 76c9cf34c5..b62f74e199 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h
@@ -76,6 +76,6 @@ class OnHashChangeNotification
} // namespace mobile
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_HASH_CHANGE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hmi_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hmi_status_notification.h
index 0e1919676b..ef040de3de 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hmi_status_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hmi_status_notification.h
@@ -74,6 +74,6 @@ class OnHMIStatusNotification
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_HMI_STATUS_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hmi_status_notification_from_mobile.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hmi_status_notification_from_mobile.h
index 12e3b54be9..6f3ef40076 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hmi_status_notification_from_mobile.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_hmi_status_notification_from_mobile.h
@@ -34,8 +34,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_HMI_STATUS_NOTIFICATION_FROM_MOBILE_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_HMI_STATUS_NOTIFICATION_FROM_MOBILE_H_
-#include "application_manager/commands/command_notification_from_mobile_impl.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_notification_from_mobile_impl.h"
#include "interfaces/MOBILE_API.h"
#include "utils/macro.h"
@@ -77,6 +77,6 @@ class OnHMIStatusNotificationFromMobile
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_HMI_STATUS_NOTIFICATION_FROM_MOBILE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_keyboard_input_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_keyboard_input_notification.h
index d34815ff2f..52f6e5d487 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_keyboard_input_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_keyboard_input_notification.h
@@ -78,6 +78,6 @@ class OnKeyBoardInputNotification
} // namespace mobile
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_KEYBOARD_INPUT_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_language_change_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_language_change_notification.h
index b234b93796..1bc1e94b1f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_language_change_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_language_change_notification.h
@@ -75,6 +75,6 @@ class OnLanguageChangeNotification
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_LANGUAGE_CHANGE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_permissions_change_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_permissions_change_notification.h
index f586a0d36c..eca3cebf31 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_permissions_change_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_permissions_change_notification.h
@@ -75,6 +75,6 @@ class OnPermissionsChangeNotification
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_PERMISSIONS_CHANGE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h
new file mode 100644
index 0000000000..f29c7dcf2b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h
@@ -0,0 +1,84 @@
+/*
+ Copyright (c) 2018, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
+
+#include <vector>
+#include "application_manager/commands/command_notification_impl.h"
+#include "policy/policy_table/enums.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+namespace mobile {
+
+/**
+ * @brief OnSystemCapabilityUpdatedNotification class
+ **/
+class OnSystemCapabilityUpdatedNotification
+ : public app_mngr::commands::CommandNotificationImpl {
+ public:
+ typedef std::vector<uint8_t> BinaryMessage;
+ /**
+ * @brief OnSystemCapabilityUpdatedNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ OnSystemCapabilityUpdatedNotification(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief OnSystemCapabilityUpdatedNotification class destructor
+ **/
+ ~OnSystemCapabilityUpdatedNotification() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnSystemCapabilityUpdatedNotification);
+};
+
+} // namespace mobile
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_request_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_request_notification.h
index b369ad38f2..a0148a4abd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_request_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_system_request_notification.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_REQUEST_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_REQUEST_NOTIFICATION_H_
+#include <vector>
#include "application_manager/commands/command_notification_impl.h"
#include "policy/policy_table/enums.h"
-#include <vector>
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -88,6 +88,6 @@ class OnSystemRequestNotification
} // namespace mobile
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_SYSTEM_REQUEST_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_tbt_client_state_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_tbt_client_state_notification.h
index 39b12fea15..cbb7525092 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_tbt_client_state_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_tbt_client_state_notification.h
@@ -75,6 +75,6 @@ class OnTBTClientStateNotification
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_TBT_CLIENT_STATE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_touch_event_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_touch_event_notification.h
index 858759b793..48872d9b27 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_touch_event_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_touch_event_notification.h
@@ -77,6 +77,6 @@ class OnTouchEventNotification
} // namespace mobile
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_TOUCH_EVENT_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h
index c379fceb02..ed7cbccf4a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h
@@ -71,5 +71,5 @@ class OnWayPointChangeNotification
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_WAY_POINT_CHANGE_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h
index 6db222a401..434b6de028 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h
@@ -35,8 +35,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_AUDIO_PASS_THRU_REQUEST_H_
#include "application_manager/commands/command_request_impl.h"
-#include "utils/macro.h"
#include "interfaces/MOBILE_API.h"
+#include "utils/macro.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -109,15 +109,6 @@ class PerformAudioPassThruRequest
ResponseParams response_params_;
/**
- * @brief Prepare result code, result and info for sending to mobile
- * application
- * @param result_code contains result code for sending to mobile application
- * @return result for sending to mobile application.
- * @deprecated
- */
- DEPRECATED bool PrepareResponseParameters(
- mobile_apis::Result::eType& result_code, std::string& info);
- /**
* @brief Prepare result code, 'success' result and info for sending
* to mobile application
* @param result_code contains result code for sending to mobile application
@@ -193,6 +184,6 @@ class PerformAudioPassThruRequest
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_AUDIO_PASS_THRU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_response.h
index 6654762067..300ea6531f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_response.h
@@ -75,6 +75,6 @@ class PerformAudioPassThruResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_AUDIO_PASS_THRU_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
index 40e706b851..52a0ad4dc1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
@@ -36,8 +36,8 @@
#include <string>
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application.h"
+#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -93,6 +93,33 @@ class PerformInteractionRequest
*/
virtual void onTimeOut();
+ protected:
+ /**
+ * @brief Prepare result code for sending to mobile application
+ * @param ui_response contains result_code from HMI response and
+ * interface that returns response
+ * @param vr_response contains result_code from HMI response and
+ * interface that returns response.
+ * @return resulting code for sending to mobile application.
+ */
+ mobile_apis::Result::eType PrepareResultCodeForResponse(
+ const app_mngr::commands::ResponseInfo& ui_response,
+ const app_mngr::commands::ResponseInfo& vr_response);
+
+ /**
+ * @brief Checks result code from HMI for splitted RPC
+ * and returns parameter for sending to mobile app.
+ * @param ui_response contains result_code from HMI response and
+ * interface that returns response
+ * @param vr_response contains result_code from HMI response and
+ * interface that returns response
+ * @return true if result code complies successful result code
+ * otherwise returns false
+ */
+ bool PrepareResultForMobileResponse(
+ app_mngr::commands::ResponseInfo& out_first,
+ app_mngr::commands::ResponseInfo& out_second) const;
+
private:
/**
* @brief Function will be called when VR_OnCommand event
@@ -194,7 +221,7 @@ class PerformInteractionRequest
* otherwise returns FALSE.
*/
bool CheckChoiceIDFromResponse(app_mngr::ApplicationSharedPtr app,
- int32_t choice_id);
+ const int32_t choice_id);
/**
* @brief Checks for a match of choice ID, in
@@ -213,6 +240,13 @@ class PerformInteractionRequest
const smart_objects::SmartObject& choice_set_id_list) const;
/**
+ * @brief Checks each choice in each set for having a VRcommands parameter
+ * @param app contains pointer to application.
+ * @return returns false if request has choice sets with no vrCommands
+ */
+ bool CheckChoiceSetListVRCommands(app_mngr::ApplicationSharedPtr app);
+
+ /**
* @brief Tells if there are sent requests without responses
* @return If there is request without response method returns TRUE
* otherwise returns FALSE
@@ -225,7 +259,27 @@ class PerformInteractionRequest
*/
void SendBothModeResponse(const smart_objects::SmartObject& msg_param);
+ /**
+ * @brief Sends UiClosePopUp request to HMI
+ */
+ void SendClosePopupRequestToHMI();
+
+ /**
+ * @brief Sets the choice according to the current interaction mode and first
+ * received choice id (UI or VR).
+ *
+ * @param msg_param Message parameters which will be included in the response
+ * to mobile device.
+ * @return Returns false, if choice_id received from UI and VR are valid and
+ * not equal. Otherwise returns true.
+ */
+ bool SetChoiceIdToResponseMsgParams(
+ smart_objects::SmartObject& msg_param) const;
+
mobile_apis::InteractionMode::eType interaction_mode_;
+ std::int32_t ui_choice_id_received_;
+ std::int32_t vr_choice_id_received_;
+
bool ui_response_received_;
bool vr_response_received_;
bool app_pi_was_active_before_;
@@ -234,11 +288,12 @@ class PerformInteractionRequest
hmi_apis::Common_Result::eType ui_result_code_;
std::string ui_info_;
std::string vr_info_;
+ smart_objects::SmartObject response_msg_params;
DISALLOW_COPY_AND_ASSIGN(PerformInteractionRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_INTERACTION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_response.h
index 6bb9135dcc..113757a1ad 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_response.h
@@ -75,6 +75,6 @@ class PerformInteractionResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_INTERACTION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h
index f82af197b9..b3e04f7796 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h
@@ -34,9 +34,9 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PUT_FILE_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PUT_FILE_REQUEST_H_
+#include "application_manager/application_manager.h"
#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
-#include "application_manager/application_manager.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -70,17 +70,17 @@ class PutFileRequest : public app_mngr::commands::CommandRequestImpl {
virtual void Run();
private:
- int64_t offset_;
+ uint64_t offset_;
std::string sync_file_name_;
int64_t length_;
mobile_apis::FileType::eType file_type_;
bool is_persistent_file_;
- void SendOnPutFileNotification();
+ void SendOnPutFileNotification(bool is_system_file);
DISALLOW_COPY_AND_ASSIGN(PutFileRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PUT_FILE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_response.h
index 22dbf1b5d5..348a217eba 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_response.h
@@ -73,6 +73,6 @@ class PutFileResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PUT_FILE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
index 9cac2ab34f..d59964bbc7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
@@ -36,8 +36,8 @@
#include "application_manager/commands/command_request_impl.h"
#include "application_manager/policies/policy_handler_interface.h"
-#include "utils/macro.h"
#include "utils/custom_string.h"
+#include "utils/macro.h"
namespace policy {
struct DeviceInfo;
@@ -83,12 +83,6 @@ class RegisterAppInterfaceRequest
**/
virtual void Run();
- /**
- * @brief Prepares and sends RegisterAppInterface response to mobile
- * considering application type
- **/
- void SendRegisterAppInterfaceResponseToMobile();
-
private:
/**
* @brief The AppicationType enum defines whether application is newly
@@ -130,35 +124,50 @@ class RegisterAppInterfaceRequest
/**
* @brief Sends OnAppRegistered notification to HMI
*
- *@param application_impl application with changed HMI status
- *
+ * @param app application with changed HMI status
+ * @param resumption If true, resumption-related parameters will be sent to
+ * the HMI
+ * @param need_restore_vr If resumption is true, whether or not VR commands
+ *should be resumed
**/
void SendOnAppRegisteredNotificationToHMI(
- const app_mngr::Application& application_impl,
+ app_mngr::ApplicationConstSharedPtr app,
bool resumption = false,
bool need_restore_vr = false);
- /*
+
+ /**
* @brief Check new ID along with known mobile application ID
*
* return TRUE if ID is known already, otherwise - FALSE
*/
bool IsApplicationWithSameAppIdRegistered();
- /*
+ /**
* @brief Check new application parameters (name, tts, vr) for
* coincidence with already known parameters of registered applications
*
- * return SUCCESS if there is no coincidence of app.name/TTS/VR synonyms,
+ * @return SUCCESS if there is no coincidence of app.name/TTS/VR synonyms,
* otherwise appropriate error code returns
- */
+ */
mobile_apis::Result::eType CheckCoincidence();
- /*
- * @brief Predicate for using with CheckCoincidence method to compare with VR
- * synonym SO
- *
- * return TRUE if there is coincidence of VR, otherwise FALSE
- */
+ /**
+ * @brief Search for any apps with the same appName as the one being
+ * registered
+ * @param out_duplicate_apps To be filled with a list of all of the apps which
+ * have duplicate appNames to the app being registered (registered or pending)
+ *
+ * @return TRUE if at least one duplicate app was found, otherwise FALSE
+ */
+ bool GetDuplicateNames(
+ std::vector<app_mngr::ApplicationSharedPtr>& out_duplicate_apps);
+
+ /**
+ * @brief Predicate for using with CheckCoincidence method to compare with VR
+ * synonym SO
+ *
+ * @return TRUE if there is coincidence of VR, otherwise FALSE
+ */
struct CoincidencePredicateVR {
CoincidencePredicateVR(const custom_str::CustomString& newItem)
: newItem_(newItem) {}
@@ -207,17 +216,31 @@ class RegisterAppInterfaceRequest
void SendSubscribeCustomButtonNotification();
/**
- * @brief IsApplicationSwitched checks whether application is switched from
- * another transport. If application id is found, but not in reconnection
+ * @brief IsApplicationSwitched checks whether application is switched
+ * from another transport. If application id is found, but not in reconnection
* list, returns 'already registered' code. Otherwise - proceed with
* switching.
* @return True if application is detected as switched, otherwise false.
*/
bool IsApplicationSwitched();
+ /**
+ * @brief Information about given Connection Key.
+ * @param key Unique key used by other components as session identifier
+ * @param device_id device identifier.
+ * @param mac_address uniq address
+ * @return false in case of error or true in case of success
+ */
+ bool GetDataOnSessionKey(
+ const uint32_t key,
+ connection_handler::DeviceHandle* device_id = nullptr,
+ std::string* mac_address = nullptr) const;
+
private:
std::string response_info_;
mobile_apis::Result::eType result_code_;
+ connection_handler::DeviceHandle device_handle_;
+ std::string device_id_;
policy::PolicyHandlerInterface& GetPolicyHandler();
DISALLOW_COPY_AND_ASSIGN(RegisterAppInterfaceRequest);
@@ -225,6 +248,6 @@ class RegisterAppInterfaceRequest
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_response.h
index d591d67794..2a6e847067 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_response.h
@@ -79,6 +79,6 @@ class RegisterAppInterfaceResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h
index 6f7e330bf5..880fced6ba 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h
@@ -34,8 +34,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_RESET_GLOBAL_PROPERTIES_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_RESET_GLOBAL_PROPERTIES_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application.h"
+#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -144,6 +144,6 @@ class ResetGlobalPropertiesRequest
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_RESET_GLOBAL_PROPERTIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_response.h
index b33ef41426..6d9b604b41 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_response.h
@@ -75,6 +75,6 @@ class ResetGlobalPropertiesResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_RESET_GLOBAL_PROPERTIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h
index a641fa0cd4..58b7b4491a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h
@@ -85,6 +85,6 @@ class ScrollableMessageRequest : public app_mngr::commands::CommandRequestImpl {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SCROLLABLE_MESSAGE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_response.h
index 8bc8a36363..e5c668b424 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_response.h
@@ -68,6 +68,6 @@ class ScrollableMessageResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SCROLLABLE_MESSAGE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h
index e3ed6ef28b..2f00b58d9e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SEND_HAPTIC_DATA_REQUEST_H_
#include <string>
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_request_impl.h"
#include "application_manager/event_engine/event.h"
#include "smart_objects/smart_object.h"
@@ -83,6 +83,6 @@ class SendHapticDataRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SEND_HAPTIC_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h
index 53e8766241..515fe3f74d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h
@@ -72,6 +72,6 @@ class SendHapticDataResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SEND_HAPTIC_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h
index 6626da4c9d..5a0dc67f35 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h
@@ -75,10 +75,10 @@ class SendLocationRequest : public app_mngr::commands::CommandRequestImpl {
private:
/**
- * @brief CheckFieldsCompatibility checks if fields are compatible with each
- * other.
- * @return true if compatible, otherwise return false
- */
+ * @brief CheckFieldsCompatibility checks if fields are compatible with each
+ * other.
+ * @return true if compatible, otherwise return false
+ */
bool CheckFieldsCompatibility();
/**
@@ -95,6 +95,6 @@ class SendLocationRequest : public app_mngr::commands::CommandRequestImpl {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SEND_LOCATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_response.h
index cb461f9a60..a2e9d1eb0a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_response.h
@@ -66,6 +66,6 @@ class SendLocationResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SEND_LOCATION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h
index 1075999af9..520f27d8b9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h
@@ -83,9 +83,11 @@ class SetAppIconRequest : public app_mngr::commands::CommandRequestImpl {
private:
/**
* @brief Copies file to icon storage
+ * @param policy_app_id application policy app id
* @param path_to_file Path to icon
*/
- void CopyToIconStorage(const std::string& path_to_file) const;
+ void CopyToIconStorage(const std::string& policy_app_id,
+ const std::string& path_to_file) const;
/**
* @brief Remove oldest icons
@@ -108,9 +110,14 @@ class SetAppIconRequest : public app_mngr::commands::CommandRequestImpl {
* @brief Checks, if icons saving to configured folder is enabled
*/
bool is_icons_saving_enabled_;
+
+ /**
+ * @brief Contains full file path to icon
+ */
+ std::string full_file_path_for_hmi_;
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_APP_ICON_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_response.h
index e4ce0725dc..a9b203bec7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_response.h
@@ -73,6 +73,6 @@ class SetAppIconResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_APP_ICON_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h
new file mode 100644
index 0000000000..a3a3ea12f9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h
@@ -0,0 +1,31 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class SetCloudAppPropertiesRequest
+ : public app_mngr::commands::CommandRequestImpl {
+ public:
+ SetCloudAppPropertiesRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ virtual ~SetCloudAppPropertiesRequest();
+ virtual void Run();
+ virtual void on_event(const app_mngr::event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesRequest);
+}; // SetCloudAppPropertiesRequest
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h
new file mode 100644
index 0000000000..df71a2aaf5
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h
@@ -0,0 +1,31 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+class SetCloudAppPropertiesResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ SetCloudAppPropertiesResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+ virtual ~SetCloudAppPropertiesResponse();
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetCloudAppPropertiesResponse);
+
+}; // SetCloudAppPropertiesResponse
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_RESPONSE_H_ \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h
index 4bd800988c..2f9c0946d3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h
@@ -80,6 +80,6 @@ class SetDisplayLayoutRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_DISPLAY_LAYOUT_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_response.h
index 73f57fc187..7b43613ac4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_response.h
@@ -74,6 +74,6 @@ class SetDisplayLayoutResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_DISPLAY_LAYOUT_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
index 7a8abaaad6..3a32d1b671 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_GLOBAL_PROPERTIES_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_GLOBAL_PROPERTIES_REQUEST_H_
#include <string>
+#include "application_manager/application.h"
#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
-#include "application_manager/application.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -82,10 +82,75 @@ class SetGlobalPropertiesRequest
*/
bool Init() FINAL;
+ /**
+ * @brief Prepares total result for mobile according to three results:
+ * ui_properties_result, tts_properties_result, rc_properties_result.
+ * @param first ResponseInfo as first argument
+ * @param second ResponseInfo as secondargument
+ * @param third ResponseInfo as third argument
+ * @return total result
+ */
+ bool PrepareResultForMobileResponse(
+ const app_mngr::commands::ResponseInfo& first,
+ const app_mngr::commands::ResponseInfo& second,
+ const app_mngr::commands::ResponseInfo& third) const;
+
+ /**
+ * @brief Prepare result code for sending to mobile application
+ * @param first contains result_code from HMI response and
+ * interface that returns response
+ * @param second contains result_code from HMI response and
+ * interface that returns response.
+ * * @param third contains result_code from HMI response and
+ * interface that returns response.
+ * @return resulting code for sending to mobile application.
+ */
+ mobile_apis::Result::eType PrepareResultCodeForResponse(
+ const app_mngr::commands::ResponseInfo& first,
+ const app_mngr::commands::ResponseInfo& second,
+ const app_mngr::commands::ResponseInfo& third);
+
+ /**
+ * @brief Resolves if the return code must be
+ * UNSUPPORTED_RESOURCE
+ * @param first contains result_code from HMI response and
+ * interface that returns response
+ * @param second contains result_code from HMI response and
+ * interface that returns response.
+ * * @param third contains result_code from HMI response and
+ * interface that returns response.
+ * @return True, if the communication return code must be
+ * UNSUPPORTED_RESOURCE, otherwise false.
+ */
+ bool IsResultCodeUnsupported(
+ const app_mngr::commands::ResponseInfo& first,
+ const app_mngr::commands::ResponseInfo& second,
+ const app_mngr::commands::ResponseInfo& third) const;
+
private:
- // Verify correctness VrHelptitle value
- static bool ValidateVRHelpTitle(
- const smart_objects::SmartObject* const vr_help_so_ptr);
+ /**
+ * @brief MergeInfos merge 2 infos into one string with info
+ * @param first_info -contains result_code from HMI response and
+ * interface that returns response
+ * @param first_str - info string that should be first in result info
+ * @param second_info -contains result_code from HMI response and
+ * interface that returns response
+ * @param second_str - info string that should be second in result info
+ * @param third_info - contains result_code from HMI response and
+ * interface that returns response
+ * @param third_str - info string that should be third in result info
+ * @return if first_info is not available and second_str and third_info not
+ * empty return second if second_info is not available and first_str and
+ * third_info not empty return first if third_info is not available and
+ * first_str and second_str not empty return first other cases return result
+ * MergeInfos for 2 params
+ */
+ std::string MergeInfos(const app_mngr::commands::ResponseInfo& first_info,
+ const std::string& first_str,
+ const app_mngr::commands::ResponseInfo& second_info,
+ const std::string& second_str,
+ const app_mngr::commands::ResponseInfo& third_info,
+ const std::string& third_str);
// prepare UI sending data (VrHelps, Menus, Keyboard) to SmartObject
static void PrepareUIRequestVRHelpData(
@@ -93,10 +158,6 @@ class SetGlobalPropertiesRequest
const smart_objects::SmartObject& msg_params,
smart_objects::SmartObject& out_params);
- static bool PrepareUIRequestDefaultVRHelpData(
- const app_mngr::ApplicationSharedPtr app,
- smart_objects::SmartObject& out_params);
-
static void PrepareUIRequestMenuAndKeyboardData(
const app_mngr::ApplicationSharedPtr app,
const smart_objects::SmartObject& msg_params,
@@ -109,6 +170,9 @@ class SetGlobalPropertiesRequest
// Send UI request to HMI
void SendUIRequest(const smart_objects::SmartObject& params, bool use_events);
+ // Send SetGlobalProperties with userLocation parameter
+ void SendRCRequest(const smart_objects::SmartObject& params, bool use_events);
+
// VRHelp shall contain sequential positions and start from 1
static bool CheckVrHelpItemsOrder(const smart_objects::SmartObject& vr_help);
@@ -148,19 +212,25 @@ class SetGlobalPropertiesRequest
bool is_ui_send_;
bool is_tts_send_;
+ bool is_rc_send_;
bool is_ui_received_;
bool is_tts_received_;
+ bool is_rc_received_;
hmi_apis::Common_Result::eType ui_result_;
hmi_apis::Common_Result::eType tts_result_;
+ hmi_apis::Common_Result::eType rc_result_;
std::string ui_response_info_;
std::string tts_response_info_;
+ std::string rc_response_info_;
+
+ bool is_menu_layout_available_ = true;
DISALLOW_COPY_AND_ASSIGN(SetGlobalPropertiesRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_GLOBAL_PROPERTIES_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_response.h
index 778dc9b7d7..f8d8117250 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_response.h
@@ -75,6 +75,6 @@ class SetGlobalPropertiesResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_GLOBAL_PROPERTIES_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h
index ef674f1c38..adced13d73 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h
@@ -81,6 +81,6 @@ class SetMediaClockRequest : public app_mngr::commands::CommandRequestImpl {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_MEDIA_CLOCK_TIMER_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_response.h
index 2fb3f25839..240d1be8d1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_response.h
@@ -69,6 +69,6 @@ class SetMediaClockTimerResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_MEDIA_CLOCK_TIMER_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h
new file mode 100644
index 0000000000..c9691a808f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ShowAppMenuRequest command class
+ **/
+class ShowAppMenuRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief ShowAppMenuRequest class constructor
+ **/
+ ShowAppMenuRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief ShowAppMenuRequest class destructor
+ **/
+ ~ShowAppMenuRequest() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ **/
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ShowAppMenuRequest);
+};
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_response.h
new file mode 100644
index 0000000000..1e357e8a11
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_response.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ShowAppMenuResponse command class
+ **/
+class ShowAppMenuResponse : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief ShowAppMenuResponse class constructor
+ **/
+ ShowAppMenuResponse(const app_mngr::commands::MessageSharedPtr& messasge,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief ShowAppMenuResponse class destructor
+ **/
+ ~ShowAppMenuResponse() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ShowAppMenuResponse);
+};
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h
index cadc87cef6..7694070a72 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h
@@ -89,6 +89,6 @@ class ShowConstantTBTRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_CONSTANT_TBT_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_response.h
index 4129a7640e..4b2136ad11 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_response.h
@@ -73,6 +73,6 @@ class ShowConstantTBTResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_CONSTANT_TBT_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h
index 2277a38f11..26612609a4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h
@@ -90,14 +90,39 @@ class ShowRequest : public app_mngr::commands::CommandRequestImpl {
int32_t field_index,
smart_objects::SmartObject& msg_params);
+ /**
+ * @brief Handle the template configuration information from the
+ * incoming mobile json message format for specified application
+ * @param app - application for which configuration should be checked
+ * @return True if template config can be successfully applied otherwise -
+ * false
+ */
+ bool CheckTemplateConfigurationForApp(application_manager::Application& app);
+
+ /**
+ * @brief Applies the template configuration which was set up beforehand
+ * @param result - result code on which template application is dependent
+ * @param app - application for which configuration should be applied
+ */
+ void ApplyTemplateConfigurationForApp(mobile_apis::Result::eType result,
+ application_manager::Application& app);
+
mobile_apis::Result::eType core_result_code_;
std::string core_response_info_;
+ app_mngr::WindowID current_window_id_;
+ smart_objects::SmartObject template_config_;
+ bool layout_change_required_;
+
+ // dcs - abbreviation of Day Color Scheme
+ bool dcs_change_required_;
+ // ncd - abbreviation of Night Color Scheme
+ bool ncs_change_required_;
DISALLOW_COPY_AND_ASSIGN(ShowRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_response.h
index c78820a26e..97843c2148 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_response.h
@@ -67,6 +67,6 @@ class ShowResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h
index f1e06e8d8d..5dbcbb7d41 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h
@@ -91,6 +91,6 @@ class SliderRequest : public app_mngr::commands::CommandRequestImpl {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SLIDER_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_response.h
index 2a93103632..842e52f595 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_response.h
@@ -67,6 +67,6 @@ class SliderResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SLIDER_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h
index d6d47bb869..68e35fcd1d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h
@@ -93,6 +93,6 @@ class SpeakRequest : public app_mngr::commands::CommandRequestImpl {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SPEAK_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_response.h
index 30eda07810..02b7baae54 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_response.h
@@ -67,6 +67,6 @@ class SpeakResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SPEAK_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h
index 011c0aa359..2b9887daad 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h
@@ -34,8 +34,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_BUTTON_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_BUTTON_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application_impl.h"
+#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
namespace sdl_rpc_plugin {
@@ -98,6 +98,6 @@ class SubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_BUTTON_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_response.h
index 28e942ec17..b42ccb91e1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_response.h
@@ -73,6 +73,6 @@ class SubscribeButtonResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_BUTTON_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h
index 6105f08750..8b88a1c884 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h
@@ -80,8 +80,8 @@ class SubscribeWayPointsRequest
DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsRequest);
};
-} // commands
+} // namespace commands
-} // application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_response.h
index cd27e96d25..4039f21f8e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_response.h
@@ -71,8 +71,8 @@ class SubscribeWayPointsResponse
DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsResponse);
};
-} // commands
+} // namespace commands
-} // application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h
index c34db34506..eb2398f279 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h
@@ -35,8 +35,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SYSTEM_REQUEST_H_
#include <string>
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_request_impl.h"
#include "application_manager/event_engine/event.h"
#include "smart_objects/smart_object.h"
@@ -93,6 +93,6 @@ class SystemRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SYSTEM_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_response.h
index afbd557d12..5c3f69d757 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_response.h
@@ -72,6 +72,6 @@ class SystemResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SYSTEM_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h
index 172f934a15..0bc01f2aaa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h
@@ -80,6 +80,6 @@ class UnregisterAppInterfaceRequest
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNREGISTER_APP_INTERFACE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_response.h
index 13d8b549e8..d1ac004ca0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_response.h
@@ -76,6 +76,6 @@ class UnregisterAppInterfaceResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNREGISTER_APP_INTERFACE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h
index 8cbaafbfe1..51c10642cf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h
@@ -84,6 +84,6 @@ class UnsubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_BUTTON_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_response.h
index 1db067acce..efd5478363 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_response.h
@@ -74,6 +74,6 @@ class UnsubscribeButtonResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_BUTTON_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h
index b7b87f8b51..e83e9b7509 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h
@@ -40,13 +40,13 @@ namespace app_mngr = application_manager;
namespace commands {
-class UnSubscribeWayPointsRequest
+class UnsubscribeWayPointsRequest
: public app_mngr::commands::CommandRequestImpl {
public:
/**
- * \brief UnSubscribeWayPointsRequest class constructor
+ * \brief UnsubscribeWayPointsRequest class constructor
**/
- UnSubscribeWayPointsRequest(
+ UnsubscribeWayPointsRequest(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
@@ -54,9 +54,9 @@ class UnSubscribeWayPointsRequest
policy::PolicyHandlerInterface& policy_handler);
/**
- * \brief UnSubscribeWayPointsRequest class destructor
+ * \brief UnsubscribeWayPointsRequest class destructor
**/
- ~UnSubscribeWayPointsRequest();
+ ~UnsubscribeWayPointsRequest();
/**
* @brief Execute command
@@ -76,11 +76,11 @@ class UnSubscribeWayPointsRequest
bool Init() FINAL;
private:
- DISALLOW_COPY_AND_ASSIGN(UnSubscribeWayPointsRequest);
+ DISALLOW_COPY_AND_ASSIGN(UnsubscribeWayPointsRequest);
};
-} // commands
+} // namespace commands
-} // application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_response.h
index c578bf9f99..9ab167284a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_response.h
@@ -71,8 +71,8 @@ class UnsubscribeWayPointsResponse
DISALLOW_COPY_AND_ASSIGN(UnsubscribeWayPointsResponse);
};
-} // commands
+} // namespace commands
-} // application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h
index 8766339f96..e1e5df2289 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h
@@ -97,6 +97,6 @@ class UpdateTurnListRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UPDATE_TURN_LIST_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_response.h
index 59d3bf0b2c..80e143644f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_response.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_response.h
@@ -73,6 +73,6 @@ class UpdateTurnListResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UPDATE_TURN_LIST_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h
new file mode 100644
index 0000000000..935716aa30
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h
@@ -0,0 +1,83 @@
+/*
+ Copyright (c) 2018, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H
+#include <application_manager/application_manager.h>
+#include <set>
+#include <string>
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+class SDLRPCPlugin;
+
+namespace app_mngr_ = application_manager;
+
+typedef mobile_apis::SystemCapabilityType::eType SystemCapabilityType;
+typedef std::set<mobile_apis::SystemCapabilityType::eType>
+ SystemCapabilitySubscriptions;
+
+class SystemCapabilityAppExtension : public app_mngr_::AppExtension {
+ public:
+ SystemCapabilityAppExtension(SDLRPCPlugin& plugin,
+ app_mngr_::Application& app);
+ virtual ~SystemCapabilityAppExtension();
+
+ bool SubscribeTo(const SystemCapabilityType system_capability_type);
+
+ bool UnsubscribeFrom(const SystemCapabilityType system_capability_type);
+
+ void UnsubscribeFromAll();
+
+ bool IsSubscribedTo(const SystemCapabilityType system_capability_type) const;
+
+ SystemCapabilitySubscriptions Subscriptions();
+
+ void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject&
+ resumption_data) OVERRIDE;
+
+ void ProcessResumption(
+ const smart_objects::SmartObject& resumption_data) OVERRIDE;
+
+ static const app_mngr_::AppExtensionUID SystemCapabilityAppExtensionUID;
+
+ static SystemCapabilityAppExtension& ExtractExtension(
+ app_mngr_::Application& app);
+
+ private:
+ SystemCapabilitySubscriptions subscribed_data_;
+ SDLRPCPlugin& plugin_;
+ app_mngr_::Application& app_;
+};
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_EXTENSIONS_SYSTEM_CAPABILITY_APP_EXTENSION_H
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/hmi_command_factory.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/hmi_command_factory.h
index eee454fb00..95bb253120 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/hmi_command_factory.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/hmi_command_factory.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_HMI_COMMAND_FACTORY_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_HMI_COMMAND_FACTORY_H_
-#include "application_manager/command_factory.h"
#include "application_manager/application_manager.h"
+#include "application_manager/command_factory.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -70,6 +70,6 @@ class HMICommandFactory : public app_mngr::CommandFactory {
DISALLOW_COPY_AND_ASSIGN(HMICommandFactory);
};
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_HMI_COMMAND_FACTORY_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h
index f0840dde41..132b68aaec 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/mobile_command_factory.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_MOBILE_COMMAND_FACTORY_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_MOBILE_COMMAND_FACTORY_H_
-#include "application_manager/command_factory.h"
#include "application_manager/application_manager.h"
+#include "application_manager/command_factory.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -59,9 +59,16 @@ class MobileCommandFactory : public app_mngr::CommandFactory {
private:
app_mngr::CommandCreator& get_creator_factory(
- mobile_apis::FunctionID::eType id,
- mobile_apis::messageType::eType message_type,
- app_mngr::commands::Command::CommandSource source) const;
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const;
+ app_mngr::CommandCreator& get_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const;
+ app_mngr::CommandCreator& get_notification_creator(
+ const mobile_apis::FunctionID::eType id) const;
+ app_mngr::CommandCreator& get_notification_from_mobile_creator(
+ const mobile_apis::FunctionID::eType id) const;
app_mngr::ApplicationManager& application_manager_;
app_mngr::rpc_service::RPCService& rpc_service_;
@@ -70,6 +77,6 @@ class MobileCommandFactory : public app_mngr::CommandFactory {
DISALLOW_COPY_AND_ASSIGN(MobileCommandFactory);
};
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_MOBILE_COMMAND_FACTORY_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_command_factory.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_command_factory.h
index 5b5f0ae49f..edbfe1bdc0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_command_factory.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_command_factory.h
@@ -36,11 +36,11 @@
#include <memory>
#include "application_manager/application_manager.h"
#include "application_manager/command_factory.h"
-#include "sdl_rpc_plugin/hmi_command_factory.h"
-#include "sdl_rpc_plugin/mobile_command_factory.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/hmi_capabilities.h"
#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/rpc_service.h"
+#include "sdl_rpc_plugin/hmi_command_factory.h"
+#include "sdl_rpc_plugin/mobile_command_factory.h"
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -69,5 +69,5 @@ class SDLCommandFactory : public app_mngr::CommandFactory {
std::unique_ptr<HMICommandFactory> hmi_command_factory_;
std::unique_ptr<MobileCommandFactory> mobile_command_factory_;
};
-}
+} // namespace sdl_rpc_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_COMMAND_FACTORY_H
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
index 6ae3a0b6bc..9c770279ab 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
@@ -32,37 +32,48 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_RPC_PLUGIN_H
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_RPC_PLUGIN_H
-#include "application_manager/plugin_manager/rpc_plugin.h"
#include "application_manager/command_factory.h"
+#include "application_manager/plugin_manager/rpc_plugin.h"
namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
namespace plugins = application_manager::plugin_manager;
+
+class SystemCapabilityAppExtension;
+
class SDLRPCPlugin : public plugins::RPCPlugin {
// RPCPlugin interface
public:
- bool Init(application_manager::ApplicationManager& app_manager,
- application_manager::rpc_service::RPCService& rpc_service,
- application_manager::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler) OVERRIDE;
+ bool Init(app_mngr::ApplicationManager& app_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) OVERRIDE;
+
+ DEPRECATED
+ bool Init(app_mngr::ApplicationManager& app_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state) OVERRIDE;
bool IsAbleToProcess(
const int32_t function_id,
- const application_manager::commands::Command::CommandSource
- message_source) OVERRIDE;
+ const app_mngr::commands::Command::CommandSource message_source) OVERRIDE;
std::string PluginName() OVERRIDE;
- application_manager::CommandFactory& GetCommandFactory() OVERRIDE;
- void OnPolicyEvent(
- application_manager::plugin_manager::PolicyEvent event) OVERRIDE;
- void OnApplicationEvent(
- application_manager::plugin_manager::ApplicationEvent event,
- application_manager::ApplicationSharedPtr application) OVERRIDE;
+ app_mngr::CommandFactory& GetCommandFactory() OVERRIDE;
+ void OnPolicyEvent(plugins::PolicyEvent event) OVERRIDE;
+ void OnApplicationEvent(plugins::ApplicationEvent event,
+ app_mngr::ApplicationSharedPtr application) OVERRIDE;
private:
+ void ClearSubscriptions(app_mngr::ApplicationSharedPtr app);
+
std::unique_ptr<application_manager::CommandFactory> command_factory_;
};
-}
+} // namespace sdl_rpc_plugin
extern "C" application_manager::plugin_manager::RPCPlugin* Create();
-
+extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data);
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_RPC_PLUGIN_H
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc
index 19d01b594f..c6d181bf57 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_request.cc
@@ -75,4 +75,4 @@ void ActivateAppRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc
index d7e38c5d5b..b829ef711e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/activate_app_response.cc
@@ -63,4 +63,4 @@ void ActivateAppResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc
index 3e46bd353a..93999f704d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/add_statistics_info_notification.cc
@@ -64,4 +64,4 @@ void AddStatisticsInfoNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc
index b227dd79dc..68c7896a7f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_request.cc
@@ -59,4 +59,4 @@ void AllowAllAppsRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc
index 2fdf29a7dd..c2182f4853 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_all_apps_response.cc
@@ -59,4 +59,4 @@ void AllowAllAppsResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc
index 0c6e5145c7..6b5af76fb1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_request.cc
@@ -59,4 +59,4 @@ void AllowAppRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc
index 4853c3764a..c62645c6c0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/allow_app_response.cc
@@ -70,4 +70,4 @@ void AllowAppResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc
new file mode 100644
index 0000000000..b021faefd8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BasicCommunicationCloseApplicationRequest::
+ BasicCommunicationCloseApplicationRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BasicCommunicationCloseApplicationRequest::
+ ~BasicCommunicationCloseApplicationRequest() {}
+
+void BasicCommunicationCloseApplicationRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc
new file mode 100644
index 0000000000..2e56271cf2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc
@@ -0,0 +1,65 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BasicCommunicationCloseApplicationResponse::
+ BasicCommunicationCloseApplicationResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BasicCommunicationCloseApplicationResponse::
+ ~BasicCommunicationCloseApplicationResponse() {}
+
+void BasicCommunicationCloseApplicationResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_CloseApplication);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc
index fb87612e19..19c9fa91d8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc
@@ -51,7 +51,7 @@ BasicCommunicationGetSystemTimeRequest::BasicCommunicationGetSystemTimeRequest(
void BasicCommunicationGetSystemTimeRequest::onTimeOut() {
LOG4CXX_AUTO_TRACE(logger_);
- application_manager_.protocol_handler().NotifyOnFailedHandshake();
+ application_manager_.protocol_handler().NotifyOnGetSystemTimeFailed();
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc
index c067debf36..e26753b3f2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_response.cc
@@ -62,4 +62,4 @@ void BasicCommunicationGetSystemTimeResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc
index 0c39389116..361dc5fea6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_on_awake_sdl.cc
@@ -79,4 +79,4 @@ void OnAwakeSDLNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc
index 04e44a6979..052a40a888 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_request.cc
@@ -58,4 +58,4 @@ void BasicCommunicationSystemRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc
index 5f8221fdbe..0b052de88d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_system_response.cc
@@ -63,4 +63,4 @@ void BasicCommunicationSystemResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc
new file mode 100644
index 0000000000..0dafa21e33
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_request.cc
@@ -0,0 +1,144 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/bc_get_app_properties_request.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BCGetAppPropertiesRequest::BCGetAppPropertiesRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+void BCGetAppPropertiesRequest::FillAppProperties(
+ const std::string& policy_app_id,
+ smart_objects::SmartObject& out_properties) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ policy::AppProperties app_properties;
+ const bool result =
+ policy_handler_.GetAppProperties(policy_app_id, app_properties);
+
+ if (!result) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Failed to get app parameters for policy_app_id: " << policy_app_id);
+ return;
+ }
+
+ out_properties[strings::policy_app_id] = policy_app_id;
+ out_properties[strings::enabled] = app_properties.enabled;
+
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+
+ policy_handler_.GetInitialAppData(policy_app_id, &nicknames, &app_hmi_types);
+
+ smart_objects::SmartObject nicknames_array(smart_objects::SmartType_Array);
+ size_t i = 0;
+ for (const auto& nickname : nicknames) {
+ nicknames_array[i++] = nickname;
+ }
+ out_properties[strings::nicknames] = nicknames_array;
+
+ if (!app_properties.auth_token.empty()) {
+ out_properties[strings::auth_token] = app_properties.auth_token;
+ }
+ if (!app_properties.transport_type.empty()) {
+ out_properties[strings::transport_type] = app_properties.transport_type;
+ }
+ if (!app_properties.hybrid_app_preference.empty()) {
+ out_properties[strings::hybrid_app_preference] =
+ app_properties.hybrid_app_preference;
+ }
+ if (!app_properties.endpoint.empty()) {
+ out_properties[strings::endpoint] = app_properties.endpoint;
+ }
+}
+
+void BCGetAppPropertiesRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const auto& msg_params = (*message_)[strings::msg_params];
+ smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
+
+ if (msg_params.keyExists(strings::policy_app_id)) {
+ const auto policy_app_id = msg_params[strings::policy_app_id].asString();
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ FillAppProperties(policy_app_id, properties);
+ if (!properties.empty()) {
+ response_params[strings::properties][0] = properties;
+ }
+ } else {
+ LOG4CXX_DEBUG(logger_,
+ "policyAppID was absent in request, all apps properties "
+ "will be returned.");
+ const auto app_ids = policy_handler_.GetApplicationPolicyIDs();
+ int i = 0;
+ for (auto& app_id : app_ids) {
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ FillAppProperties(app_id, properties);
+ response_params[strings::properties][i++] = properties;
+ }
+ }
+
+ if (response_params[strings::properties].empty()) {
+ SendErrorResponse(
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::BasicCommunication_GetAppProperties,
+ hmi_apis::Common_Result::DATA_NOT_AVAILABLE,
+ "Requested data not available",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::BasicCommunication_GetAppProperties,
+ hmi_apis::Common_Result::SUCCESS,
+ &response_params);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc
new file mode 100644
index 0000000000..57949a949b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_app_properties_response.cc
@@ -0,0 +1,60 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/bc_get_app_properties_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BCGetAppPropertiesResponse::BCGetAppPropertiesResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+void BCGetAppPropertiesResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
+}
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc
new file mode 100644
index 0000000000..b735cd9bdf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_request.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BCGetFilePathRequest::BCGetFilePathRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BCGetFilePathRequest::~BCGetFilePathRequest() {}
+
+void BCGetFilePathRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc
new file mode 100644
index 0000000000..58cda68a2b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_get_file_path_response.cc
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BCGetFilePathResponse::BCGetFilePathResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BCGetFilePathResponse::~BCGetFilePathResponse() {}
+
+void BCGetFilePathResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_GetFilePath);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc
new file mode 100644
index 0000000000..a4c5d6b1b4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_request.cc
@@ -0,0 +1,114 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/bc_set_app_properties_request.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BCSetAppPropertiesRequest::BCSetAppPropertiesRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+void BCSetAppPropertiesRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto& properties =
+ (*message_)[strings::msg_params][strings::properties];
+
+ const auto policy_app_id(properties[strings::policy_app_id].asString());
+
+ const auto properties_change_status =
+ policy_handler_.GetAppPropertiesStatus(properties, policy_app_id);
+
+ using AppPropertiesState = policy::PolicyHandlerInterface::AppPropertiesState;
+ const bool are_properties_changed =
+ AppPropertiesState::NO_CHANGES != properties_change_status;
+
+ const bool is_new_app = policy_handler_.IsNewApplication(policy_app_id);
+
+ policy_handler_.OnSetAppProperties(properties);
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::BasicCommunication_SetAppProperties,
+ hmi_apis::Common_Result::SUCCESS);
+
+ if (are_properties_changed || is_new_app) {
+ const auto notification =
+ MessageHelper::CreateOnAppPropertiesChangeNotification(
+ policy_app_id, application_manager_);
+ application_manager_.GetRPCService().ManageHMICommand(notification);
+ }
+ if (is_new_app) {
+ LOG4CXX_ERROR(logger_,
+ "Message contains unknow policyAppId: "
+ << policy_app_id << ", PTU will be triggered");
+ policy_handler_.OnLocalAppAdded();
+ }
+
+ auto app_enabled = [this]() -> bool {
+ auto& properties = (*message_)[strings::msg_params][strings::properties];
+ if (properties.keyExists(strings::enabled)) {
+ return properties[strings::enabled].asBool();
+ }
+ return false;
+ };
+
+ const bool enable_flag_switch =
+ AppPropertiesState::ENABLED_FLAG_SWITCH == properties_change_status;
+
+ if (app_enabled() && (enable_flag_switch || is_new_app)) {
+ application_manager_.CreatePendingLocalApplication(policy_app_id);
+ application_manager_.SendUpdateAppList();
+ return;
+ }
+
+ if (enable_flag_switch) {
+ application_manager_.RemovePendingApplication(policy_app_id);
+ application_manager_.SendUpdateAppList();
+ }
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc
new file mode 100644
index 0000000000..928a17d0f8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/bc_set_app_properties_response.cc
@@ -0,0 +1,62 @@
+/*
+ Copyright (c) 2020, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/bc_set_app_properties_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BCSetAppPropertiesResponse::BCSetAppPropertiesResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+void BCSetAppPropertiesResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc
index cf2fbd9761..6696689174 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc
@@ -60,4 +60,4 @@ void ButtonGetCapabilitiesRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc
index 863e179040..b6ab822c47 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_response.cc
@@ -68,10 +68,14 @@ void ButtonGetCapabilitiesResponse::Run() {
hmi_capabilities.set_button_capabilities(
(*message_)[strings::msg_params][hmi_response::capabilities]);
- hmi_capabilities.set_preset_bank_capabilities(
- (*message_)[strings::msg_params][hmi_response::preset_bank_capabilities]);
+ if ((*message_)[strings::msg_params].keyExists(
+ hmi_response::preset_bank_capabilities)) {
+ hmi_capabilities.set_preset_bank_capabilities(
+ (*message_)[strings::msg_params]
+ [hmi_response::preset_bank_capabilities]);
+ }
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc
index 84a47b9deb..988794f668 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_request.cc
@@ -58,4 +58,4 @@ void ClosePopupRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc
index 25396af337..072e1960e9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/close_popup_response.cc
@@ -58,4 +58,4 @@ void ClosePopupResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc
index 0e09c14650..71782ef575 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_request.cc
@@ -59,4 +59,4 @@ void DecryptCertificateRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc
index 694298ed91..cf2a4d092c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/decrypt_certificate_response.cc
@@ -64,5 +64,5 @@ void DecryptCertificateResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
#endif // EXTERNAL_PROPRIETARY_MODE
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_request.cc
index 63f5c2e815..97b5109642 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_request.cc
@@ -61,4 +61,4 @@ void DialNumberRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_response.cc
index 6d37ece2bf..4ff6785052 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/dial_number_response.cc
@@ -63,4 +63,4 @@ void DialNumberResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc
index c06c90973d..8546252119 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc
@@ -61,4 +61,4 @@ void GetSystemInfoRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc
index aef428b39f..baff925a4e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_response.cc
@@ -31,6 +31,7 @@
*/
#include "sdl_rpc_plugin/commands/hmi/get_system_info_response.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -90,4 +91,4 @@ const SystemInfo GetSystemInfoResponse::GetSystemInfo(
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls.cc
deleted file mode 100644
index 52b95d3fa3..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls.cc
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2018, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "sdl_rpc_plugin/commands/hmi/get_urls.h"
-#include "application_manager/message.h"
-#include "application_manager/application_manager.h"
-#include "application_manager/rpc_service.h"
-#include "application_manager/policies/policy_handler.h"
-#include "utils/helpers.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-namespace commands {
-
-GetUrls::GetUrls(const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
- : RequestFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
-
-GetUrls::~GetUrls() {}
-
-void GetUrls::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- namespace Common_Result = hmi_apis::Common_Result;
- using policy::EndpointUrls;
-
- if (!policy_handler_.PolicyEnabled()) {
- SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE);
- return;
- }
-
- const uint32_t service_to_check =
- (*message_)[strings::msg_params][hmi_request::service].asUInt();
-
- EndpointUrls endpoints;
- policy_handler_.GetUpdateUrls(service_to_check, endpoints);
-
- if (endpoints.empty()) {
- LOG4CXX_ERROR(logger_, "No URLs for service " << service_to_check);
- SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE);
- return;
- }
-
-#ifdef PROPRIETARY_MODE
- const uint32_t policy_service = 7u;
-
- if (policy_service == service_to_check) {
- ProcessPolicyServiceURLs(endpoints);
- return;
- }
-#endif // PROPRIETARY_MODE
-
- ProcessServiceURLs(endpoints);
-}
-
-void GetUrls::ProcessServiceURLs(const policy::EndpointUrls& endpoints) {
- namespace Common_Result = hmi_apis::Common_Result;
- using smart_objects::SmartObject;
-
- (*message_)[strings::msg_params].erase(hmi_request::service);
- SmartObject& urls = (*message_)[strings::msg_params][hmi_response::urls];
-
- size_t index = 0;
- for (size_t e = 0; e < endpoints.size(); ++e) {
- ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(endpoints[e].app_id);
-
-#ifndef PROPRIETARY_MODE
- bool registered_not_default = false;
- if (policy::kDefaultId != endpoints[e].app_id) {
- if (!app) {
- LOG4CXX_ERROR(logger_,
- "Can't find application with policy id "
- << endpoints[e].app_id
- << " URLs adding for this application is skipped.");
- continue;
- }
- registered_not_default = true;
- }
-#endif // EXTERNAL_PROPRIETARY_MODE || HTTP
- for (size_t u = 0; u < endpoints[e].url.size(); ++u, ++index) {
- const std::string& app_url = endpoints[e].url[u];
- SmartObject& service_info = urls[index];
-
- service_info[strings::url] = app_url;
-#ifndef PROPRIETARY_MODE
- if (registered_not_default) {
- service_info[strings::app_id] = app->hmi_app_id();
- }
-#else // EXTERNAL_PROPRIETARY_MODE || HTTP
- service_info[hmi_response::policy_app_id] = endpoints[e].app_id;
-#endif
- }
- }
- SendResponseToHMI(Common_Result::SUCCESS);
-}
-
-void GetUrls::SendResponseToHMI(hmi_apis::Common_Result::eType result) {
- (*message_)[strings::params][strings::message_type] = MessageType::kResponse;
- (*message_)[strings::params][hmi_response::code] = result;
- rpc_service_.ManageHMICommand(message_);
-}
-
-#ifdef PROPRIETARY_MODE
-struct PolicyAppIdComparator {
- PolicyAppIdComparator(const std::string& policy_app_id)
- : policy_app_id_(policy_app_id) {}
-
- bool operator()(const policy::EndpointData& data) {
- return data.app_id == policy_app_id_;
- }
- std::string policy_app_id_;
-};
-
-void FillSODefaultUrls(smart_objects::SmartObject& urls,
- const policy::EndpointUrls& endpoints) {
- using smart_objects::SmartObject;
- PolicyAppIdComparator comparator(policy::kDefaultId);
- policy::EndpointUrls::const_iterator it =
- std::find_if(endpoints.begin(), endpoints.end(), comparator);
- if (it == endpoints.end()) {
- return;
- }
- SmartObject service_info = SmartObject(smart_objects::SmartType_Map);
- for (size_t i = 0; i < (*it).url.size(); ++i) {
- service_info[strings::url] = (*it).url[i];
- urls[i] = service_info;
- }
-}
-
-void GetUrls::ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints) {
- LOG4CXX_AUTO_TRACE(logger_);
- using namespace smart_objects;
- using namespace application_manager;
- using namespace strings;
- using namespace hmi_apis;
-
- const uint32_t app_id_to_send_to = policy_handler_.GetAppIdForSending();
-
- if (!app_id_to_send_to) {
- LOG4CXX_ERROR(logger_,
- "There are no available applications for processing.");
- SmartObject urls(SmartType_Array);
- FillSODefaultUrls(urls, endpoints);
- if (!urls.empty()) {
- (*message_)[msg_params][hmi_response::urls] = urls;
- }
- (*message_).erase(hmi_request::service);
- SendResponseToHMI(Common_Result::SUCCESS);
- return;
- }
-
- ApplicationSharedPtr app =
- application_manager_.application(app_id_to_send_to);
-
- if (!app.valid()) {
- LOG4CXX_WARN(logger_,
- "There is no registered application with "
- "connection key '"
- << app_id_to_send_to << "'");
- SendResponseToHMI(Common_Result::DATA_NOT_AVAILABLE);
- return;
- }
-
- SmartObject& object = *message_;
- object[msg_params].erase(hmi_request::service);
- object[msg_params][hmi_response::urls] = SmartObject(SmartType_Array);
- SmartObject& urls = object[msg_params][hmi_response::urls];
- const std::string mobile_app_id = app->policy_app_id();
-
- size_t index = 0;
- for (size_t i = 0; i < endpoints.size(); ++i) {
- using namespace helpers;
-
- const bool to_add = Compare<std::string, EQ, ONE>(
- endpoints[i].app_id, mobile_app_id, policy::kDefaultId);
- const bool is_default = policy::kDefaultId == endpoints[i].app_id;
-
- if (to_add) {
- for (size_t k = 0; k < endpoints[i].url.size(); ++k) {
- if (!is_default) {
- urls[index][strings::app_id] = app_id_to_send_to;
- }
- urls[index][strings::url] = endpoints[i].url[k];
- ++index;
- }
- }
- }
- SendResponseToHMI(Common_Result::SUCCESS);
- return;
-}
-#endif // PROPRIETARY_MODE
-
-} // namespace commands
-} // namespace application_manager
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc
index 39f7e61c06..b8c61ca902 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_request.cc
@@ -59,4 +59,4 @@ void MixingAudioSupportedRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc
index 26fa967844..089e56e598 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/mixing_audio_supported_response.cc
@@ -60,4 +60,4 @@ void MixingAudioSupportedResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc
index ae3695b68e..8390fea5bc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_request.cc
@@ -59,4 +59,4 @@ void NaviAlertManeuverRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc
index 6a6307038a..a1603f069d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_alert_maneuver_response.cc
@@ -63,4 +63,4 @@ void NaviAlertManeuverResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
index 3d2370d55b..47f2f2505e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc
@@ -63,7 +63,10 @@ AudioStartStreamRequest::AudioStartStreamRequest(
<< "; retry_number_ = " << retry_number_);
}
-AudioStartStreamRequest::~AudioStartStreamRequest() {}
+AudioStartStreamRequest::~AudioStartStreamRequest() {
+ // see comment in NaviStartStreamRequest
+ unsubscribe_from_event(hmi_apis::FunctionID::Navigation_StartAudioStream);
+}
void AudioStartStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -76,8 +79,8 @@ void AudioStartStreamRequest::Run() {
application_manager_.application_by_hmi_app(application_id());
if (!app) {
LOG4CXX_ERROR(logger_,
- "Applcation with hmi_app_id " << application_id()
- << " does not exist");
+ "Application with hmi_app_id " << application_id()
+ << " does not exist");
return;
}
SetAllowedToTerminate(false);
@@ -110,7 +113,7 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
if (hmi_apis::Common_Result::SUCCESS == code) {
LOG4CXX_INFO(logger_, "StartAudioStream response SUCCESS");
- if (application_manager_.HMILevelAllowsStreaming(app->app_id(),
+ if (application_manager_.HMIStateAllowsStreaming(app->app_id(),
ServiceType::kAudio)) {
app->set_audio_streaming_approved(true);
} else {
@@ -168,11 +171,11 @@ void AudioStartStreamRequest::RetryStartSession() {
}
uint32_t curr_retry_number = app->audio_stream_retry_number();
- LOG4CXX_DEBUG(
- logger_, "Retry number " << curr_retry_number << " of " << retry_number_);
- if (curr_retry_number < retry_number_) {
- LOG4CXX_DEBUG(logger_, "Send AudioStartStream retry");
+ if (curr_retry_number <= retry_number_) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Retry number " << curr_retry_number << " of " << retry_number_);
MessageHelper::SendAudioStartStream(app->app_id(), application_manager_);
app->set_audio_stream_retry_number(++curr_retry_number);
} else {
@@ -186,4 +189,4 @@ void AudioStartStreamRequest::RetryStartSession() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc
index 362a46cc19..61d49577f6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_response.cc
@@ -60,4 +60,4 @@ void AudioStartStreamResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc
index ba2b8c8157..a5d436f015 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_request.cc
@@ -62,4 +62,4 @@ void AudioStopStreamRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc
index 87ddc81696..98023ab571 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_stop_stream_response.cc
@@ -56,4 +56,4 @@ void AudioStopStreamResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc
index 77ef3e3369..edc4afe1e4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_request.cc
@@ -59,4 +59,4 @@ void NaviGetWayPointsRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc
index 0aad5e5724..0f0b652d01 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_get_way_points_response.cc
@@ -63,4 +63,4 @@ void NaviGetWayPointsResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc
index 781b8d3045..15e5b46b36 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc
@@ -84,4 +84,4 @@ void NaviIsReadyRequest::on_event(const event_engine::Event& event) {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc
index b4e64e2a3e..073513eda9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_response.cc
@@ -58,4 +58,4 @@ void NaviIsReadyResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc
index a10f61310d..360870e21c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_request.cc
@@ -59,4 +59,4 @@ void NaviSendLocationRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc
index f93e2e17c3..dc60f2fbf0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_send_location_response.cc
@@ -61,4 +61,4 @@ void NaviSendLocationResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc
index 5e4426bd20..764315f37f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc
@@ -65,9 +65,9 @@ void NaviSetVideoConfigRequest::Run() {
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "Application with hmi_app_id " << application_id()
- << "does not exist");
+ LOG4CXX_ERROR(
+ logger_,
+ "Application with hmi_app_id " << application_id() << "does not exist");
return;
}
@@ -100,9 +100,9 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) {
LOG4CXX_DEBUG(logger_, "Received SetVideoConfig success response");
result = true;
} else {
- LOG4CXX_DEBUG(logger_,
- "Received SetVideoConfig failure response (" << event.id()
- << ")");
+ LOG4CXX_DEBUG(
+ logger_,
+ "Received SetVideoConfig failure response (" << event.id() << ")");
result = false;
if (message[strings::msg_params].keyExists(strings::rejected_params)) {
const smart_objects::SmartArray* list =
@@ -153,4 +153,4 @@ void NaviSetVideoConfigRequest::onTimeOut() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc
index c5f1c5307f..e4a30c9da5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_response.cc
@@ -61,4 +61,4 @@ void NaviSetVideoConfigResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc
index 22d604ab0d..95dd4561fc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_request.cc
@@ -59,4 +59,4 @@ void NaviShowConstantTBTRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc
index d2ff26b645..f73099d29a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_show_constant_tbt_response.cc
@@ -63,4 +63,4 @@ void NaviShowConstantTBTResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
index e44d89f93a..00974085c3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc
@@ -63,7 +63,12 @@ NaviStartStreamRequest::NaviStartStreamRequest(
<< "; retry_number_ = " << retry_number_);
}
-NaviStartStreamRequest::~NaviStartStreamRequest() {}
+NaviStartStreamRequest::~NaviStartStreamRequest() {
+ // unsubscribe_from_all_hmi_events() in EventObserver's destructor isn't
+ // enough; we must unsubscribe before this NaviStartStreamRequest instance is
+ // removed
+ unsubscribe_from_event(hmi_apis::FunctionID::Navigation_StartStream);
+}
void NaviStartStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -75,9 +80,9 @@ void NaviStartStreamRequest::Run() {
ApplicationSharedPtr app =
application_manager_.application_by_hmi_app(application_id());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "Applcation with hmi_app_id " << application_id()
- << "does not exist");
+ LOG4CXX_ERROR(
+ logger_,
+ "Application with hmi_app_id " << application_id() << "does not exist");
return;
}
SetAllowedToTerminate(false);
@@ -110,7 +115,7 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) {
if (hmi_apis::Common_Result::SUCCESS == code) {
LOG4CXX_INFO(logger_, "NaviStartStreamResponse SUCCESS");
- if (application_manager_.HMILevelAllowsStreaming(
+ if (application_manager_.HMIStateAllowsStreaming(
app->app_id(), ServiceType::kMobileNav)) {
app->set_video_streaming_approved(true);
} else {
@@ -168,11 +173,11 @@ void NaviStartStreamRequest::RetryStartSession() {
}
uint32_t curr_retry_number = app->video_stream_retry_number();
- LOG4CXX_DEBUG(
- logger_, "Retry number " << curr_retry_number << " of " << retry_number_);
- if (curr_retry_number < retry_number_) {
- LOG4CXX_DEBUG(logger_, "Send NaviStartStream retry");
+ if (curr_retry_number <= retry_number_) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Retry number " << curr_retry_number << " of " << retry_number_);
MessageHelper::SendNaviStartStream(app->app_id(), application_manager_);
app->set_video_stream_retry_number(++curr_retry_number);
} else {
@@ -186,4 +191,4 @@ void NaviStartStreamRequest::RetryStartSession() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc
index f09a334f51..eafd81148a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_response.cc
@@ -60,4 +60,4 @@ void NaviStartStreamResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc
index 3e27692d62..ad09b0aee1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_request.cc
@@ -62,4 +62,4 @@ void NaviStopStreamRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc
index 61b8d5a1e2..ff8c0bddff 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_stop_stream_response.cc
@@ -56,4 +56,4 @@ void NaviStopStreamResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc
index a4445ebce8..ba29f552b7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc
@@ -59,4 +59,4 @@ void NaviSubscribeWayPointsRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc
index ae5f236f6f..ddf8f75e58 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_response.cc
@@ -64,4 +64,4 @@ void NaviSubscribeWayPointsResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc
index e7d416bc61..d3c998cfdf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_request.cc
@@ -37,7 +37,7 @@ using namespace application_manager;
namespace commands {
-NaviUnSubscribeWayPointsRequest::NaviUnSubscribeWayPointsRequest(
+NaviUnsubscribeWayPointsRequest::NaviUnsubscribeWayPointsRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
@@ -49,9 +49,9 @@ NaviUnSubscribeWayPointsRequest::NaviUnSubscribeWayPointsRequest(
hmi_capabilities,
policy_handle) {}
-NaviUnSubscribeWayPointsRequest::~NaviUnSubscribeWayPointsRequest() {}
+NaviUnsubscribeWayPointsRequest::~NaviUnsubscribeWayPointsRequest() {}
-void NaviUnSubscribeWayPointsRequest::Run() {
+void NaviUnsubscribeWayPointsRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
@@ -59,4 +59,4 @@ void NaviUnSubscribeWayPointsRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc
index c084bd52d3..beed29e1e2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_unsubscribe_way_points_response.cc
@@ -32,8 +32,8 @@
#include "sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_response.h"
#include "application_manager/event_engine/event.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -65,4 +65,4 @@ void NaviUnsubscribeWayPointsResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc
index 9c507c3637..a8a258b1c0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_request.cc
@@ -59,4 +59,4 @@ void NaviUpdateTurnListRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc
index eb232e6d01..a2f737df38 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_update_turn_list_response.cc
@@ -63,4 +63,4 @@ void NaviUpdateTurnListResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc
index 398c2dac30..204cc7d347 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_allow_sdl_functionality_notification.cc
@@ -66,4 +66,4 @@ void OnAllowSDLFunctionalityNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc
index 189596c58a..e882020f8b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_activated_notification.cc
@@ -64,4 +64,4 @@ void OnAppActivatedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc
index ee45f9bf1e..18b796eaa8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_deactivated_notification.cc
@@ -66,4 +66,4 @@ void OnAppDeactivatedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc
index e13299ece7..a1eb412c66 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_changed_notification.cc
@@ -58,4 +58,4 @@ void OnAppPermissionChangedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc
index 839c16ca08..0033b392d2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc
@@ -32,15 +32,14 @@
*/
#include "sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h"
-#include "application_manager/application_manager.h"
-#include "application_manager/policies/policy_handler.h"
-#include "application_manager/message_helper.h"
#include <algorithm>
#include <functional>
#include <string>
+#include "application_manager/application_manager.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler.h"
#include "policy/policy_types.h"
#include "smart_objects/smart_object.h"
-#include "utils/make_shared.h"
namespace {
@@ -179,5 +178,5 @@ void OnAppPermissionConsentNotification::Run() {
policy_handler_.OnAppPermissionConsent(connection_key, permission_consent);
#endif
}
-} // commands
-} // namespace application_manager
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc
new file mode 100644
index 0000000000..f1fa703bbb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_properties_change_notification.cc
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/on_app_properties_change_notification.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+OnAppPropertiesChangeNotification::OnAppPropertiesChangeNotification(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : NotificationToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+void OnAppPropertiesChangeNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendNotification();
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc
index 24c5a94272..51c3125921 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_registered_notification.cc
@@ -64,4 +64,4 @@ void OnAppRegisteredNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc
index 001b9fa5e0..07aadada81 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_unregistered_notification.cc
@@ -73,4 +73,4 @@ void OnAppUnregisteredNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc
index e2cd6d2cbf..d9c1120409 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_audio_data_streaming_notification.cc
@@ -58,4 +58,4 @@ void OnAudioDataStreamingNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
new file mode 100644
index 0000000000..1a104c0fa1
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
@@ -0,0 +1,180 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/HMI_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+OnBCSystemCapabilityUpdatedNotification::
+ OnBCSystemCapabilityUpdatedNotification(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : NotificationToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnBCSystemCapabilityUpdatedNotification::
+ ~OnBCSystemCapabilityUpdatedNotification() {}
+
+void OnBCSystemCapabilityUpdatedNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "Sending BasicCommunication.OnSystemCapabilityUpdated "
+ "Notification to HMI");
+
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
+
+ hmi_apis::Common_SystemCapabilityType::eType system_capability_type =
+ static_cast<hmi_apis::Common_SystemCapabilityType::eType>(
+ msg_params[strings::system_capability]
+ [strings::system_capability_type]
+ .asInt());
+ switch (system_capability_type) {
+ case hmi_apis::Common_SystemCapabilityType::NAVIGATION: {
+ smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map);
+ bool has_nav_capability = false;
+ if (hmi_capabilities_.navigation_capability()) {
+ has_nav_capability = true;
+ nav_capability = *hmi_capabilities_.navigation_capability();
+ }
+ has_nav_capability = application_manager_.GetAppServiceManager()
+ .UpdateNavigationCapabilities(nav_capability) ||
+ has_nav_capability;
+
+ if (has_nav_capability) {
+ msg_params[strings::system_capability][strings::navigation_capability] =
+ nav_capability;
+ } else {
+ return;
+ }
+ break;
+ }
+ case hmi_apis::Common_SystemCapabilityType::PHONE_CALL: {
+ if (hmi_capabilities_.phone_capability()) {
+ msg_params[strings::system_capability][strings::phone_capability] =
+ *hmi_capabilities_.phone_capability();
+ } else {
+ return;
+ }
+ break;
+ }
+ case hmi_apis::Common_SystemCapabilityType::REMOTE_CONTROL: {
+ if (!hmi_capabilities_.is_rc_cooperating()) {
+ return;
+ }
+ if (hmi_capabilities_.rc_capability()) {
+ msg_params[strings::system_capability][strings::rc_capability] =
+ *hmi_capabilities_.rc_capability();
+ } else {
+ return;
+ }
+ break;
+ }
+ case hmi_apis::Common_SystemCapabilityType::VIDEO_STREAMING:
+ if (hmi_capabilities_.video_streaming_capability()) {
+ msg_params[strings::system_capability]
+ [strings::video_streaming_capability] =
+ *hmi_capabilities_.video_streaming_capability();
+ } else {
+ return;
+ }
+ break;
+ case hmi_apis::Common_SystemCapabilityType::APP_SERVICES: {
+ auto all_services =
+ application_manager_.GetAppServiceManager().GetAllServiceRecords();
+ auto app_service_caps =
+ MessageHelper::CreateAppServiceCapabilities(all_services);
+
+ smart_objects::SmartArray* app_services =
+ app_service_caps[strings::app_services].asArray();
+ smart_objects::SmartObject& updated_capabilities =
+ msg_params[strings::system_capability]
+ [strings::app_services_capabilities][strings::app_services];
+ for (size_t i = 0; i < updated_capabilities.length(); i++) {
+ std::string service_id =
+ updated_capabilities[i][strings::updated_app_service_record]
+ [strings::service_id]
+ .asString();
+ auto matching_service_predicate =
+ [&service_id](
+ const smart_objects::SmartObject& app_service_capability) {
+ return service_id ==
+ app_service_capability[strings::updated_app_service_record]
+ [strings::service_id]
+ .asString();
+ };
+
+ auto it = std::find_if(app_services->begin(),
+ app_services->end(),
+ matching_service_predicate);
+ if (it != app_services->end()) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Replacing updated record with service_id " << service_id);
+ app_services->erase(it);
+ }
+ app_services->push_back(updated_capabilities[i]);
+ }
+ msg_params[strings::system_capability]
+ [strings::app_services_capabilities] = app_service_caps;
+ break;
+ }
+ case mobile_apis::SystemCapabilityType::DISPLAYS: {
+ if (!hmi_capabilities_.system_display_capabilities()) {
+ LOG4CXX_INFO(logger_, "system_display_capabilities are not available");
+ return;
+ }
+ msg_params[strings::system_capability][strings::display_capabilities] =
+ *hmi_capabilities_.system_display_capabilities();
+ break;
+ }
+ default:
+ return;
+ }
+ SendNotification();
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc
new file mode 100644
index 0000000000..f32aef1102
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h"
+
+#include "application_manager/display_capabilities_builder.h"
+#include "application_manager/message_helper.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+OnBCSystemCapabilityUpdatedNotificationFromHMI::
+ OnBCSystemCapabilityUpdatedNotificationFromHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : NotificationFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+OnBCSystemCapabilityUpdatedNotificationFromHMI::
+ ~OnBCSystemCapabilityUpdatedNotificationFromHMI() {}
+
+OnBCSystemCapabilityUpdatedNotificationFromHMI::
+ ProcessSystemDisplayCapabilitiesResult
+ OnBCSystemCapabilityUpdatedNotificationFromHMI::
+ ProcessSystemDisplayCapabilities(
+ const smart_objects::SmartObject& display_capabilities) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!(*message_)[strings::msg_params].keyExists(strings::app_id)) {
+ LOG4CXX_DEBUG(logger_, "Updating general display capabilities");
+ hmi_capabilities_.set_system_display_capabilities(display_capabilities);
+ return ProcessSystemDisplayCapabilitiesResult::SUCCESS;
+ }
+
+ const auto app_id =
+ (*message_)[strings::msg_params][strings::app_id].asUInt();
+ auto app = application_manager_.application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with app_id " << app_id << " is not registered");
+ return ProcessSystemDisplayCapabilitiesResult::FAIL;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Updating display capabilities for app " << app_id);
+ app->set_display_capabilities(display_capabilities);
+
+ // Remove app_id from notification to mobile
+ (*message_)[strings::params][strings::connection_key] =
+ (*message_)[strings::msg_params][strings::app_id];
+ (*message_)[strings::msg_params].erase(strings::app_id);
+ if (app->is_resuming() && app->is_app_data_resumption_allowed()) {
+ LOG4CXX_DEBUG(logger_, "Application is resuming");
+ app->display_capabilities_builder().UpdateDisplayCapabilities(
+ display_capabilities);
+ return ProcessSystemDisplayCapabilitiesResult::CAPABILITIES_CACHED;
+ }
+
+ return ProcessSystemDisplayCapabilitiesResult::SUCCESS;
+}
+
+void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // Prepare SmartObject for mobile factory
+ (*message_)[strings::params][strings::function_id] = static_cast<int32_t>(
+ mobile_apis::FunctionID::OnSystemCapabilityUpdatedID);
+
+ const auto& system_capability =
+ (*message_)[strings::msg_params][strings::system_capability];
+
+ switch (system_capability[strings::system_capability_type].asInt()) {
+ case mobile_apis::SystemCapabilityType::DISPLAYS: {
+ if (system_capability.keyExists(strings::display_capabilities)) {
+ const auto result = ProcessSystemDisplayCapabilities(
+ system_capability[strings::display_capabilities]);
+ if (ProcessSystemDisplayCapabilitiesResult::FAIL == result) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Failed to process display capabilities. Notification will "
+ "be ignored");
+ return;
+ } else if (ProcessSystemDisplayCapabilitiesResult::
+ CAPABILITIES_CACHED == result) {
+ LOG4CXX_TRACE(logger_,
+ "Capabilities are being cached for resuming app");
+ return;
+ }
+ }
+ break;
+ }
+ case mobile_apis::SystemCapabilityType::REMOTE_CONTROL: {
+ if (system_capability.keyExists(strings::rc_capability)) {
+ LOG4CXX_DEBUG(logger_, "Updating RC Capabilities");
+ hmi_capabilities_.set_rc_capability(
+ system_capability[strings::rc_capability]);
+ }
+ break;
+ }
+ }
+
+ SendNotificationToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc
index 1f052b865b..f25e6202cd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_event_notification.cc
@@ -67,4 +67,4 @@ void OnButtonEventNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc
index 6c5d8f5a43..fee6b1b485 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_press_notification.cc
@@ -33,8 +33,8 @@
#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h"
#include "application_manager/application_impl.h"
-#include "utils/logger.h"
#include "application_manager/event_engine/event.h"
+#include "utils/logger.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -69,4 +69,4 @@ void OnButtonPressNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc
index 70ff1c3fad..4ac752d6c5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc
@@ -63,4 +63,4 @@ void OnButtonSubscriptionNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc
index 2c4f9a1ccc..f27c1fe5e5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_chosen_notification.cc
@@ -63,4 +63,4 @@ void OnDeviceChosenNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc
index 307dccd09b..129ba8c9ba 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_device_state_changed_notification.cc
@@ -30,12 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <algorithm>
#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h"
+#include <algorithm>
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
-#include "interfaces/HMI_API.h"
+#include "application_manager/policies/policy_handler_interface.h"
#include "encryption/hashing.h"
+#include "interfaces/HMI_API.h"
namespace {
// TODO(AOleynik) : replace this !!!
@@ -72,7 +73,7 @@ std::string convert_to_bt_mac(std::string& deviceInternalId) {
return bt_mac;
}
-}
+} // namespace
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -121,4 +122,4 @@ void OnDeviceStateChangedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
index 16ca48a2d4..a743c58672 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
@@ -30,14 +30,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <set>
#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h"
+#include <set>
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/policies/policy_handler_interface.h"
#include "interfaces/HMI_API.h"
-#include "utils/make_shared.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -60,12 +60,39 @@ struct OnDriverDistractionProcessor {
void operator()(ApplicationSharedPtr application) {
if (application) {
- (*on_driver_distraction_so_)[strings::params][strings::connection_key] =
- application->app_id();
+ // Create modifiable copy of base message
+ smart_objects::SmartObject message = *on_driver_distraction_so_;
+ message[strings::params][strings::connection_key] = application->app_id();
const RPCParams params;
policy::CheckPermissionResult result;
application_manager_.GetPolicyHandler().CheckPermissions(
- application, stringified_function_id_, params, result);
+ application,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ stringified_function_id_,
+ params,
+ result);
+ auto& msg_params = message[strings::msg_params];
+ const bool is_lock_screen_dismissal_exists = msg_params.keyExists(
+ mobile_notification::lock_screen_dismissal_enabled);
+
+ if (is_lock_screen_dismissal_exists &&
+ msg_params[mobile_notification::lock_screen_dismissal_enabled]
+ .asBool()) {
+ const auto language =
+ MessageHelper::MobileLanguageToString(application->ui_language());
+
+ const auto warning_message =
+ application_manager_.GetPolicyHandler()
+ .LockScreenDismissalWarningMessage(language);
+ // Only allow lock screen dismissal if a warning message is available
+ if (warning_message && !warning_message->empty()) {
+ msg_params[mobile_notification::lock_screen_dismissal_warning] =
+ *warning_message;
+ } else {
+ msg_params[mobile_notification::lock_screen_dismissal_enabled] =
+ false;
+ }
+ }
if (result.hmi_level_permitted != policy::kRpcAllowed) {
MobileMessageQueue messages;
application->SwapMobileMessageQueue(messages);
@@ -73,15 +100,19 @@ struct OnDriverDistractionProcessor {
std::remove_if(
messages.begin(),
messages.end(),
- [this](smart_objects::SmartObjectSPtr message) {
+ [](smart_objects::SmartObjectSPtr message) {
return (*message)[strings::params][strings::function_id]
- .asString() == stringified_function_id_;
+ .asUInt() ==
+ mobile_api::FunctionID::OnDriverDistractionID;
}),
messages.end());
- application->PushMobileMessage(on_driver_distraction_so_);
+ application->SwapMobileMessageQueue(messages);
+ application->PushMobileMessage(
+ std::make_shared<smart_objects::SmartObject>(message));
return;
}
- command_.SendNotificationToMobile(on_driver_distraction_so_);
+ command_.SendNotificationToMobile(
+ std::make_shared<smart_objects::SmartObject>(message));
}
}
@@ -91,7 +122,7 @@ struct OnDriverDistractionProcessor {
ApplicationManager& application_manager_;
std::string stringified_function_id_;
};
-}
+} // namespace
OnDriverDistractionNotification::OnDriverDistractionNotification(
const application_manager::commands::MessageSharedPtr& message,
@@ -109,14 +140,12 @@ OnDriverDistractionNotification::~OnDriverDistractionNotification() {}
void OnDriverDistractionNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- const hmi_apis::Common_DriverDistractionState::eType state =
+ const auto state =
static_cast<hmi_apis::Common_DriverDistractionState::eType>(
(*message_)[strings::msg_params][hmi_notification::state].asInt());
application_manager_.set_driver_distraction_state(state);
- smart_objects::SmartObjectSPtr on_driver_distraction =
- utils::MakeShared<smart_objects::SmartObject>();
-
+ auto on_driver_distraction = std::make_shared<smart_objects::SmartObject>();
if (!on_driver_distraction) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
@@ -128,6 +157,17 @@ void OnDriverDistractionNotification::Run() {
(*on_driver_distraction)[strings::msg_params][mobile_notification::state] =
state;
+ const auto lock_screen_dismissal =
+ application_manager_.GetPolicyHandler().LockScreenDismissalEnabledState();
+
+ if (lock_screen_dismissal &&
+ hmi_apis::Common_DriverDistractionState::DD_ON == state) {
+ (*on_driver_distraction)
+ [strings::msg_params]
+ [mobile_notification::lock_screen_dismissal_enabled] =
+ *lock_screen_dismissal;
+ }
+
const ApplicationSet applications =
application_manager_.applications().GetData();
@@ -140,4 +180,4 @@ void OnDriverDistractionNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc
index cd3f2c23e6..f6ea22ae34 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_event_changed_notification.cc
@@ -61,4 +61,4 @@ void OnEventChangedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc
index 9131bf7392..4c168f9eff 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc
@@ -32,13 +32,13 @@
#include "sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h"
+#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
-#include <signal.h>
#include "application_manager/application_manager.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/rpc_service.h"
#include "interfaces/HMI_API.h"
namespace sdl_rpc_plugin {
@@ -109,7 +109,8 @@ void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr message =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
hmi_apis::FunctionID::BasicCommunication_OnSDLPersistenceComplete;
(*message)[strings::params][strings::message_type] =
@@ -121,4 +122,4 @@ void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
index d2a149bf94..3eec6c5d1a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
@@ -33,11 +33,11 @@
#include "sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h"
#include "application_manager/application_impl.h"
-#include "application_manager/state_controller.h"
#include "application_manager/message_helper.h"
#include "application_manager/rpc_service.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/state_controller.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -67,7 +67,7 @@ void OnExitApplicationNotification::Run() {
uint32_t app_id = (*message_)[strings::msg_params][strings::app_id].asUInt();
ApplicationSharedPtr app_impl = application_manager_.application(app_id);
- if (!(app_impl.valid())) {
+ if (app_impl.use_count() == 0) {
LOG4CXX_ERROR(logger_, "Application does not exist");
return;
}
@@ -106,20 +106,22 @@ void OnExitApplicationNotification::Run() {
application_manager_.UnregisterApplication(app_id, Result::SUCCESS);
return;
}
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ case Common_ApplicationExitReason::CLOSE_CLOUD_CONNECTION: {
+ application_manager_.DisconnectCloudApp(app_impl);
+ break;
+ }
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+
default: {
LOG4CXX_WARN(logger_, "Unhandled reason");
return;
}
}
- application_manager_.state_controller().SetRegularState(
- app_impl,
- HMILevel::HMI_NONE,
- AudioStreamingState::NOT_AUDIBLE,
- VideoStreamingState::NOT_STREAMABLE,
- false);
+ application_manager_.state_controller().ExitDefaultWindow(app_impl);
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc
index ec680c667d..e1f0e2b104 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_file_removed_notification.cc
@@ -59,4 +59,4 @@ void OnFileRemovedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc
index c74dd70c84..2e8f15387f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_find_applications.cc
@@ -59,4 +59,4 @@ void OnFindApplications::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc
index 9ff1851e3f..1e8da19c0a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ignition_cycle_over_notification.cc
@@ -32,6 +32,7 @@
#include "sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h"
#include "application_manager/application_manager.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -59,4 +60,4 @@ void OnIgnitionCycleOverNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc
index 20f20ece08..f611b81764 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_tbt_client_state_notification.cc
@@ -64,4 +64,4 @@ void OnNaviTBTClientStateNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
index fa8819ca5b..2a1a9c29fb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_navi_way_point_change_notification.cc
@@ -60,4 +60,4 @@ void OnNaviWayPointChangeNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc
index e069bea740..a0e75371b5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_policy_update.cc
@@ -32,6 +32,7 @@
#include "sdl_rpc_plugin/commands/hmi/on_policy_update.h"
#include "application_manager/application_manager.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -57,4 +58,4 @@ void OnPolicyUpdate::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc
index 1524aa9ea2..441e36a385 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_put_file_notification.cc
@@ -59,4 +59,4 @@ void OnPutFileNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc
index 76c9115662..da3612b043 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ready_notification.cc
@@ -62,4 +62,4 @@ void OnReadyNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc
index 1eaef0b5e1..b2c9151b40 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_received_policy_update.cc
@@ -30,9 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h"
+#include <string>
#include "application_manager/application_manager.h"
+#include "application_manager/policies/policy_handler_interface.h"
#include "utils/file_system.h"
namespace sdl_rpc_plugin {
@@ -74,4 +75,4 @@ void OnReceivedPolicyUpdate::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc
index 60699e5b9c..dbef717539 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_record_start_notification.cc
@@ -59,4 +59,4 @@ void OnRecordStartdNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc
index 9f8a713ffe..11d549655e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_resume_audio_source_notification.cc
@@ -59,4 +59,4 @@ void OnResumeAudioSourceNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc
index 65879edce6..d0c584c66c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_close_notification.cc
@@ -59,4 +59,4 @@ void OnSDLCloseNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc
index cf8feb4ca1..314a9e8f71 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_consent_needed_notification.cc
@@ -59,4 +59,4 @@ void OnSDLConsentNeededNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc
index 0ac4afd4d2..5db38d070b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_sdl_persistence_complete_notification.cc
@@ -58,4 +58,4 @@ void OnSDLPersistenceCompleteNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc
new file mode 100644
index 0000000000..de03b75214
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_service_update_notification.cc
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/on_service_update_notification.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+namespace hmi {
+
+OnServiceUpdateNotification::OnServiceUpdateNotification(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : NotificationToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnServiceUpdateNotification::~OnServiceUpdateNotification() {}
+
+void OnServiceUpdateNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendNotification();
+}
+
+} // namespace hmi
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc
index 2cee7926bd..035def10e0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_start_device_discovery.cc
@@ -59,4 +59,4 @@ void OnStartDeviceDiscovery::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc
index 4cb01e7e90..5ee2ede198 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_status_update_notification.cc
@@ -58,4 +58,4 @@ void OnStatusUpdateNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc
index 242fb1d8cd..bf52492ae1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc
@@ -33,8 +33,8 @@
#include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h"
#include "application_manager/application_impl.h"
-#include "application_manager/state_controller.h"
#include "application_manager/message_helper.h"
+#include "application_manager/state_controller.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -62,13 +62,27 @@ void OnSystemContextNotification::Run() {
(*message_)[strings::msg_params][hmi_notification::system_context]
.asInt());
+ WindowID window_id = mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ window_id = (*message_)[strings::msg_params][strings::window_id].asInt();
+ }
+
ApplicationSharedPtr app;
- if ((mobile_api::SystemContext::SYSCTXT_VRSESSION == system_context) ||
- (mobile_api::SystemContext::SYSCTXT_MENU == system_context) ||
- (mobile_api::SystemContext::SYSCTXT_HMI_OBSCURED == system_context)) {
+ if (helpers::
+ Compare<mobile_api::SystemContext::eType, helpers::EQ, helpers::ONE>(
+ system_context,
+ mobile_api::SystemContext::SYSCTXT_VRSESSION,
+ mobile_api::SystemContext::SYSCTXT_MENU,
+ mobile_api::SystemContext::SYSCTXT_HMI_OBSCURED)) {
app = application_manager_.active_application();
- } else if ((mobile_api::SystemContext::SYSCTXT_ALERT == system_context) ||
- (mobile_api::SystemContext::SYSCTXT_MAIN == system_context)) {
+ }
+
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id ||
+ helpers::Compare<mobile_api::SystemContext::eType,
+ helpers::EQ,
+ helpers::ONE>(system_context,
+ mobile_api::SystemContext::SYSCTXT_ALERT,
+ mobile_api::SystemContext::SYSCTXT_MAIN)) {
if ((*message_)[strings::msg_params].keyExists(strings::app_id)) {
app = application_manager_.application(
(*message_)[strings::msg_params][strings::app_id].asUInt());
@@ -76,8 +90,8 @@ void OnSystemContextNotification::Run() {
}
if (app && mobile_api::SystemContext::INVALID_ENUM != system_context) {
- application_manager_.state_controller().SetRegularState(app,
- system_context);
+ application_manager_.state_controller().SetRegularState(
+ app, window_id, system_context);
} else {
LOG4CXX_ERROR(logger_, "Application does not exist");
}
@@ -85,4 +99,4 @@ void OnSystemContextNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc
index 5591d59355..9b8523e882 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_error_notification.cc
@@ -32,6 +32,7 @@
#include "sdl_rpc_plugin/commands/hmi/on_system_error_notification.h"
#include "application_manager/application_manager.h"
+#include "application_manager/policies/policy_handler_interface.h"
#include "interfaces/HMI_API.h"
namespace sdl_rpc_plugin {
@@ -64,4 +65,4 @@ void OnSystemErrorNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc
index 11b2471294..171c144055 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_info_changed_notification.cc
@@ -33,6 +33,7 @@
#include "sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h"
#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -66,4 +67,4 @@ void OnSystemInfoChangedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc
index cfb860a1c7..d96d2bb90e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc
@@ -32,11 +32,15 @@
#include "application_manager/application_impl.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h"
#include "application_manager/policies/policy_handler_interface.h"
#include "interfaces/MOBILE_API.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h"
#include "utils/macro.h"
+#ifdef EXTERNAL_PROPRIETARY_MODE
+#include "policy/ptu_retry_handler.h"
+#endif // EXTERNAL_PROPRIETARY_MODE
+
using policy::PolicyHandlerInterface;
namespace sdl_rpc_plugin {
@@ -67,6 +71,37 @@ void OnSystemRequestNotification::Run() {
params[strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::eType::OnSystemRequestID);
+ using namespace rpc::policy_table_interface_base;
+ const auto request_type =
+ static_cast<rpc::policy_table_interface_base::RequestType>(
+ (*message_)[strings::msg_params][strings::request_type].asUInt());
+
+#ifdef PROPRIETARY_MODE
+ if (RequestType::RT_PROPRIETARY == request_type) {
+ if (msg_params.keyExists(strings::url)) {
+ // For backward-compatibility, the URL is cached for retries if provided
+ // by HMI
+ policy_handler_.CacheRetryInfo(msg_params.keyExists(strings::app_id)
+ ? msg_params[strings::app_id].asUInt()
+ : 0,
+ msg_params[strings::url].asString());
+ } else {
+ // Clear cached retry info
+ policy_handler_.CacheRetryInfo(0, std::string());
+
+ // URL and app are chosen by Core for PROPRIETARY mode normally
+ uint32_t app_id = 0;
+ msg_params[strings::url] = policy_handler_.GetNextUpdateUrl(
+ policy::PTUIterationType::DefaultIteration, app_id);
+ if (0 == app_id) {
+ LOG4CXX_WARN(logger_,
+ "Can't select application to forward OnSystemRequest.");
+ return;
+ }
+ msg_params[strings::app_id] = app_id;
+ }
+ }
+#endif
// According to HMI API, this should be HMI unique id, but during processing
// messages from HMI this param is replaced by connection key, so below it
// will be treated as connection key
@@ -81,8 +116,7 @@ void OnSystemRequestNotification::Run() {
"Received OnSystemRequest without appID."
" One of registered apps will be used.");
LOG4CXX_DEBUG(logger_, "Searching registered app to send OnSystemRequest.");
- const PolicyHandlerInterface& policy_handler = policy_handler_;
- const uint32_t selected_app_id = policy_handler.GetAppIdForSending();
+ const uint32_t selected_app_id = policy_handler_.GetAppIdForSending();
if (0 == selected_app_id) {
LOG4CXX_WARN(logger_,
"Can't select application to forward OnSystemRequest.");
@@ -91,7 +125,7 @@ void OnSystemRequestNotification::Run() {
app = application_manager_.application(selected_app_id);
}
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_WARN(logger_,
"No valid application found to forward OnSystemRequest.");
return;
@@ -116,9 +150,14 @@ void OnSystemRequestNotification::Run() {
"Sending request with application id " << app->policy_app_id());
params[strings::connection_key] = app->app_id();
+
+ if (helpers::Compare<RequestType, helpers::EQ, helpers::ONE>(
+ request_type, RequestType::RT_PROPRIETARY, RequestType::RT_HTTP)) {
+ policy_handler_.OnSystemRequestReceived();
+ }
SendNotificationToMobile(message_);
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc
index b5fd1a007e..b068835545 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_time_ready_notification.cc
@@ -59,4 +59,4 @@ void OnSystemTimeReadyNotification::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc
index 5b5cfeefb1..f89baad737 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc
@@ -100,4 +100,4 @@ void OnTTSLanguageChangeNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc
index 701dbe0538..8b60762b31 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc
@@ -66,4 +66,4 @@ void OnTTSResetTimeoutNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc
index 34ba82df1d..2d215b2ec9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_started_notification.cc
@@ -60,4 +60,4 @@ void OnTTSStartedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc
index 0935a36848..6910b188f2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_stopped_notification.cc
@@ -63,4 +63,4 @@ void OnTTSStoppedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc
index 21cf0d9628..6cc9f85d6f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_command_notification.cc
@@ -65,4 +65,4 @@ void OnUICommandNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc
index fbdd4fce2b..f069e4ed65 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_keyboard_input_notification.cc
@@ -67,4 +67,4 @@ void OnUIKeyBoardInputNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc
index 3bf5a5aed4..697b2036c4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc
@@ -99,4 +99,4 @@ void OnUILanguageChangeNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc
index 953932cdb6..bd1e1b8ea7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc
@@ -67,4 +67,4 @@ void OnUIResetTimeoutNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc
index e5b321e1ff..193c3666d2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_touch_event_notification.cc
@@ -67,4 +67,4 @@ void OnUITouchEventNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc
index 2a5e6ba797..e6275adab2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_update_device_list.cc
@@ -56,4 +56,4 @@ void OnUpdateDeviceList::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
index c8ecba458a..99c6520fee 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc
@@ -64,4 +64,4 @@ void OnVIAccPedalPositionNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc
index ee909d19dc..dbfd9487e3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc
@@ -64,4 +64,4 @@ void OnVIBeltStatusNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc
index f0386646ce..b8e66b9c0f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc
@@ -64,4 +64,4 @@ void OnVIBodyInformationNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc
index 549c73065a..418c751d1c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc
@@ -64,4 +64,4 @@ void OnVIDeviceStatusNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc
index 23f0d37068..29545fcd87 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc
@@ -64,4 +64,4 @@ void OnVIDriverBrakingNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc
index 735a225225..4c2fb94400 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc
@@ -64,4 +64,4 @@ void OnVIEngineTorqueNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc
index 0b4bfa893f..6ac26a74fc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc
@@ -64,4 +64,4 @@ void OnVIExternalTemperatureNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc
index a5e84f1108..1f1cad5b8b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc
@@ -64,4 +64,4 @@ void OnVIFuelLevelNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc
index 950b5a36f1..31c80860fd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc
@@ -64,4 +64,4 @@ void OnVIFuelLevelStateNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc
index 0d94194f76..43ae3524ad 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc
@@ -64,4 +64,4 @@ void OnVIGpsDataNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc
index 80edb88e38..282a173b69 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc
@@ -64,4 +64,4 @@ void OnVIHeadLampStatusNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
index a2b0b1a8fd..f9bb3eca3f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc
@@ -65,4 +65,4 @@ void OnVIInstantFuelConsumptionNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc
index 5e3555bbc4..8f5e845c02 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc
@@ -64,4 +64,4 @@ void OnVIMyKeyNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc
index 1dbef77fa3..ea5d8be9ca 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc
@@ -64,4 +64,4 @@ void OnVIOdometerNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc
index d4ae93b324..73231ff4de 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc
@@ -64,4 +64,4 @@ void OnVIPrndlNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc
index 77f694c92e..4587939b8f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc
@@ -64,4 +64,4 @@ void OnVIRpmNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc
index e5860c9eec..df0bfd5cd7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc
@@ -64,4 +64,4 @@ void OnVISpeedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc
index db591d9da3..b7eaad7edf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc
@@ -64,4 +64,4 @@ void OnVISteeringWheelAngleNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc
index b5c7e18803..5f438ef8d1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc
@@ -64,4 +64,4 @@ void OnVITirePressureNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc
index 323fe5b885..1b40da4c40 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc
@@ -64,4 +64,4 @@ void OnVIVinNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc
index 6a3b863e7c..7221e88ef1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc
@@ -64,4 +64,4 @@ void OnVIWiperStatusNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc
index 701dee5385..7d5c0165aa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_video_data_streaming_notification.cc
@@ -59,4 +59,4 @@ void OnVideoDataStreamingNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc
index 386ef1d1c7..c4678f69e0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc
@@ -32,13 +32,13 @@
#include "sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h"
-#include "application_manager/policies/policy_handler.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler.h"
#include "application_manager/state_controller.h"
-#include "interfaces/MOBILE_API.h"
-#include "interfaces/HMI_API.h"
#include "application_manager/event_engine/event.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -65,14 +65,17 @@ void OnVRCommandNotification::Run() {
(*message_)[strings::msg_params][strings::cmd_id].asUInt();
uint32_t max_cmd_id = application_manager_.get_settings().max_cmd_id();
- // Check if this is one of standart VR commands (i.e. "Help")
+ // Check if this is one of standard VR commands (i.e. "Help")
if (cmd_id > max_cmd_id + 1) {
LOG4CXX_INFO(logger_, "Switched App");
const uint32_t app_id = cmd_id - max_cmd_id;
ApplicationSharedPtr app = application_manager_.application(app_id);
if (app) {
application_manager_.state_controller().SetRegularState(
- app, mobile_apis::HMILevel::HMI_FULL, true);
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_FULL,
+ true);
} else {
LOG4CXX_ERROR(logger_, "Unable to find appication " << app_id);
}
@@ -110,4 +113,4 @@ void OnVRCommandNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
index 6a58ab9ffa..c308af9b92 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
@@ -33,9 +33,9 @@
#include "sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h"
#include "application_manager/application_impl.h"
-#include "application_manager/state_controller.h"
#include "application_manager/message_helper.h"
#include "application_manager/rpc_service.h"
+#include "application_manager/state_controller.h"
#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
@@ -83,7 +83,10 @@ void OnVRLanguageChangeNotification::Run() {
if (static_cast<int32_t>(app->language()) !=
(*message_)[strings::msg_params][strings::language].asInt()) {
application_manager_.state_controller().SetRegularState(
- app, mobile_api::HMILevel::HMI_NONE, false);
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_NONE,
+ false);
rpc_service_.ManageMobileCommand(
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
@@ -98,4 +101,4 @@ void OnVRLanguageChangeNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc
index 04eb9a9ed0..bfc033a865 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_started_notification.cc
@@ -61,4 +61,4 @@ void OnVRStartedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc
index 8fea5ddd1c..ede1efab85 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_stopped_notification.cc
@@ -61,4 +61,4 @@ void OnVRStoppedNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc
index 5947454517..d8ad6087a6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc
@@ -59,4 +59,4 @@ void RCGetCapabilitiesRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc
index b14c28426c..128b111c5e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_response.cc
@@ -54,16 +54,26 @@ void RCGetCapabilitiesResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
HMICapabilities& hmi_capabilities = hmi_capabilities_;
- bool capability_exists =
+ bool rc_capability_exists =
(*message_)[strings::msg_params].keyExists(strings::rc_capability);
- if (capability_exists) {
+ if (rc_capability_exists) {
hmi_capabilities.set_rc_capability(
(*message_)[strings::msg_params][strings::rc_capability]);
}
- hmi_capabilities.set_rc_supported(capability_exists);
+
+ bool seat_location_capability_exists =
+ (*message_)[strings::msg_params].keyExists(
+ strings::seat_location_capability);
+
+ if (seat_location_capability_exists) {
+ hmi_capabilities.set_seat_location_capability(
+ (*message_)[strings::msg_params][strings::seat_location_capability]);
+ }
+
+ hmi_capabilities.set_rc_supported(rc_capability_exists);
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc
index 4b3d303089..5e4af1503a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc
@@ -97,7 +97,7 @@ void RCIsReadyRequest::onTimeOut() {
}
void RCIsReadyRequest::SendMessageToHMI() {
- utils::SharedPtr<smart_objects::SmartObject> get_capabilities(
+ std::shared_ptr<smart_objects::SmartObject> get_capabilities(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::RC_GetCapabilities, application_manager_));
rpc_service_.ManageHMICommand(get_capabilities);
@@ -105,4 +105,4 @@ void RCIsReadyRequest::SendMessageToHMI() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc
index 7534567204..71e16a831c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_response.cc
@@ -58,4 +58,4 @@ void RCIsReadyResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
index f89ae1f697..0a6632fca8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc
@@ -31,8 +31,9 @@
*/
#include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h"
-#include "application_manager/state_controller.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/state_controller.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -45,8 +46,7 @@ struct ProtoV4AppsOnDevice : std::unary_function<ApplicationSharedPtr, bool> {
ProtoV4AppsOnDevice(const connection_handler::DeviceHandle handle)
: handle_(handle) {}
bool operator()(const ApplicationSharedPtr app) const {
- return app
- ? handle_ == app->device() &&
+ return app ? handle_ == app->device() &&
Message::is_sufficient_version(
protocol_handler::MajorProtocolVersion::
PROTOCOL_VERSION_4,
@@ -80,7 +80,7 @@ struct SendLaunchApp
return;
}
};
-}
+} // namespace
SDLActivateAppRequest::SDLActivateAppRequest(
const application_manager::commands::MessageSharedPtr& message,
@@ -115,6 +115,8 @@ void SDLActivateAppRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
using namespace hmi_apis::FunctionID;
+ ApplicationConstSharedPtr app =
+ application_manager_.WaitingApplicationByID(app_id());
if (application_manager_.state_controller().IsStateActive(
HmiState::STATE_ID_DEACTIVATE_HMI)) {
LOG4CXX_DEBUG(logger_,
@@ -124,6 +126,16 @@ void SDLActivateAppRequest::Run() {
static_cast<eType>(function_id()),
hmi_apis::Common_Result::REJECTED,
"HMIDeactivate is active");
+ } else if (app && !app->IsRegistered() && app->is_cloud_app()) {
+ LOG4CXX_DEBUG(logger_, "Starting cloud application.");
+ const ApplicationManagerSettings& settings =
+ application_manager_.get_settings();
+ uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() *
+ settings.cloud_app_max_retry_attempts());
+ application_manager_.updateRequestTimeout(
+ 0, correlation_id(), default_timeout_ + total_retry_timeout);
+ subscribe_on_event(BasicCommunication_OnAppRegistered);
+ application_manager_.connection_handler().ConnectToDevice(app->device());
} else {
const uint32_t application_id = app_id();
policy_handler_.OnActivateApp(application_id, correlation_id());
@@ -142,10 +154,6 @@ void SDLActivateAppRequest::Run() {
application_manager_.application(application_id);
if (!app_to_activate) {
- LOG4CXX_WARN(
- logger_,
- "Can't find application within regular apps: " << application_id);
-
// Here is the hack - in fact SDL gets hmi_app_id in appID field and
// replaces it with connection_key only for normally registered apps, but
// for apps_to_be_registered (waiting) it keeps original value (hmi_app_id)
@@ -181,6 +189,18 @@ void SDLActivateAppRequest::Run() {
LOG4CXX_DEBUG(logger_, "Application is registered. Activating.");
policy_handler_.OnActivateApp(application_id, correlation_id());
return;
+ } else if (app_to_activate->is_cloud_app()) {
+ LOG4CXX_DEBUG(logger_, "Starting cloud application.");
+ const ApplicationManagerSettings& settings =
+ application_manager_.get_settings();
+ uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() *
+ settings.cloud_app_max_retry_attempts());
+ application_manager_.updateRequestTimeout(
+ 0, correlation_id(), default_timeout_ + total_retry_timeout);
+ subscribe_on_event(BasicCommunication_OnAppRegistered);
+ application_manager_.connection_handler().ConnectToDevice(
+ app_to_activate->device());
+ return;
}
connection_handler::DeviceHandle device_handle = app_to_activate->device();
@@ -225,8 +245,10 @@ void SDLActivateAppRequest::onTimeOut() {
using namespace hmi_apis::Common_Result;
using namespace application_manager;
unsubscribe_from_event(BasicCommunication_OnAppRegistered);
- SendErrorResponse(
- correlation_id(), SDL_ActivateApp, APPLICATION_NOT_REGISTERED, "");
+ SendErrorResponse(correlation_id(),
+ SDL_ActivateApp,
+ APPLICATION_NOT_REGISTERED,
+ "App registration timed out");
}
void SDLActivateAppRequest::on_event(const event_engine::Event& event) {
@@ -262,7 +284,7 @@ uint32_t SDLActivateAppRequest::hmi_app_id(
LOG4CXX_DEBUG(logger_, application << " section is absent in the message.");
return 0;
}
- if (so[msg_params][application].keyExists(strings::app_id)) {
+ if (!so[msg_params][application].keyExists(strings::app_id)) {
LOG4CXX_DEBUG(logger_,
strings::app_id << " section is absent in the message.");
return 0;
@@ -291,4 +313,4 @@ ApplicationSharedPtr SDLActivateAppRequest::get_foreground_app(
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc
index 3262b12759..560b75213c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_response.cc
@@ -61,4 +61,4 @@ void SDLActivateAppResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc
index 6b983d566a..c8266e0f39 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_request.cc
@@ -32,6 +32,7 @@
#include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_request.h"
#include "application_manager/application_manager.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -64,4 +65,4 @@ void SDLGetListOfPermissionsRequest::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc
index 784b4922d4..280d2cb071 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_list_of_permissions_response.cc
@@ -61,4 +61,4 @@ void SDLGetListOfPermissionsResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc
new file mode 100644
index 0000000000..52b7f83e9b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_request.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/policies/policy_handler_interface.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+SDLGetPolicyConfigurationDataRequest::SDLGetPolicyConfigurationDataRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+SDLGetPolicyConfigurationDataRequest::~SDLGetPolicyConfigurationDataRequest() {}
+
+void SDLGetPolicyConfigurationDataRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ smart_objects::SmartObject response_value(
+ smart_objects::SmartType::SmartType_Array);
+
+ hmi_apis::Common_Result::eType result_code =
+ PrepareResponseParams(response_value);
+
+ if (hmi_apis::Common_Result::SUCCESS != result_code) {
+ LOG4CXX_ERROR(logger_, "Unable to PrepareResponseParams");
+ SendErrorResponse(
+ correlation_id(),
+ hmi_apis::FunctionID::SDL_GetPolicyConfigurationData,
+ result_code,
+ "",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ smart_objects::SmartObject response_msg_params(
+ smart_objects::SmartType::SmartType_Map);
+ response_msg_params[strings::value] = response_value;
+ SendResponse(true,
+ correlation_id(),
+ hmi_apis::FunctionID::SDL_GetPolicyConfigurationData,
+ result_code,
+ &response_msg_params,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+hmi_apis::Common_Result::eType
+SDLGetPolicyConfigurationDataRequest::PrepareResponseParams(
+ smart_objects::SmartObject& response_out) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto policy_type =
+ (*message_)[strings::msg_params][strings::policy_type].asString();
+
+ const auto property =
+ (*message_)[strings::msg_params][strings::property].asString();
+
+ auto policy_table_data = policy_handler_.GetPolicyTableData();
+ if (!policy_table_data.isMember(policy_type)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "policy_type " << policy_type << " doesn't exist in policy table.");
+ return hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
+ }
+
+ auto& policy_section_table_data = policy_table_data[policy_type];
+ if (!policy_section_table_data.isMember(property)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "property " << property << " doesn't exist in " << policy_type);
+ return hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
+ }
+
+ auto& property_table_data = policy_section_table_data[property];
+ response_out = GetValueParam(property_table_data);
+
+ return hmi_apis::Common_Result::SUCCESS;
+}
+
+void clear_new_line_symbol(std::string& str_to_clear) {
+ str_to_clear.erase(
+ std::remove_if(str_to_clear.begin(),
+ str_to_clear.end(),
+ [](char character) { return '\n' == character; }),
+ str_to_clear.end());
+}
+
+smart_objects::SmartObject SDLGetPolicyConfigurationDataRequest::GetValueParam(
+ const Json::Value& policy_property) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject value(smart_objects::SmartType_Array);
+
+ auto put_element_in_value_array = [&value](const Json::Value& element,
+ const int32_t index) {
+ Json::StreamWriterBuilder writer_builder;
+ writer_builder["indentation"] = "";
+ std::string str;
+ if (element.type() == Json::objectValue) {
+ str = Json::writeString(writer_builder, element);
+ clear_new_line_symbol(str);
+ } else {
+ str = element.asString();
+ }
+ value[index] = str;
+ };
+
+ if (policy_property.type() == Json::arrayValue) {
+ for (Json::ArrayIndex i = 0; i < policy_property.size(); i++) {
+ put_element_in_value_array(policy_property[i], i);
+ }
+ return value;
+ }
+ put_element_in_value_array(policy_property, 0);
+ return value;
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc
index 57c925e08f..21b7dea41c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_response.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,14 +30,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "sdl_rpc_plugin/commands/hmi/get_urls_response.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_response.h"
#include "application_manager/rpc_service.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
+
namespace commands {
-GetUrlsResponse::GetUrlsResponse(
+SDLGetPolicyConfigurationDataResponse::SDLGetPolicyConfigurationDataResponse(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
@@ -49,15 +50,15 @@ GetUrlsResponse::GetUrlsResponse(
hmi_capabilities,
policy_handle) {}
-GetUrlsResponse::~GetUrlsResponse() {}
+SDLGetPolicyConfigurationDataResponse::
+ ~SDLGetPolicyConfigurationDataResponse() {}
-void GetUrlsResponse::Run() {
+void SDLGetPolicyConfigurationDataResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
(*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
(*message_)[strings::params][strings::protocol_version] = protocol_version_;
-
rpc_service_.SendMessageToHMI(message_);
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc
index 9a6c0fd520..b494be56e8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_request.cc
@@ -32,6 +32,7 @@
#include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_request.h"
#include "application_manager/application_manager.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -59,4 +60,4 @@ void SDLGetStatusUpdateRequest::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc
index 8fc85da481..4b0f3d0ca8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_status_update_response.cc
@@ -61,4 +61,4 @@ void SDLGetStatusUpdateResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc
index ab8ec4e3d9..38a63611fa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_request.cc
@@ -32,6 +32,7 @@
#include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_request.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -93,4 +94,4 @@ void SDLGetUserFriendlyMessageRequest::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc
index c5b3450723..b95591c4fa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_user_friendly_message_response.cc
@@ -61,4 +61,4 @@ void SDLGetUserFriendlyMessageResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc
index aef2e286d7..5f69903548 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update.cc
@@ -64,4 +64,4 @@ void SDLPolicyUpdate::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc
index d16fc578ab..bfbf73270e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_policy_update_response.cc
@@ -31,6 +31,7 @@
*/
#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update_response.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -52,8 +53,21 @@ SDLPolicyUpdateResponse::~SDLPolicyUpdateResponse() {}
void SDLPolicyUpdateResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- // TODO(PV): add some logic here
+ const hmi_apis::Common_Result::eType code =
+ static_cast<hmi_apis::Common_Result::eType>(
+ (*message_)[strings::params][hmi_response::code].asInt());
+
+ if (helpers::Compare<hmi_apis::Common_Result::eType,
+ helpers::NEQ,
+ helpers::ALL>(code,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS)) {
+ LOG4CXX_ERROR(logger_, "Error is returned. PTU won't be started.");
+ return;
+ }
+
+ application_manager_.GetPolicyHandler().OnUpdateRequestSentToMobile();
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc
index 163d749426..988be68a80 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_request.cc
@@ -59,4 +59,4 @@ void TTSChangeRegistrationRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc
index 2c28d615d3..e5e38ef34a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_change_registration_response.cc
@@ -63,4 +63,4 @@ void TTSChangeRegistratioResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc
index 49623e01d7..9baaabf401 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc
@@ -59,4 +59,4 @@ void TTSGetCapabilitiesRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc
index 1cef3daf15..c0581a6380 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_response.cc
@@ -69,4 +69,4 @@ void TTSGetCapabilitiesResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc
index 5533537b33..7d2c15a9bf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc
@@ -59,4 +59,4 @@ void TTSGetLanguageRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc
index ac423a2bf3..627056dce1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_response.cc
@@ -77,4 +77,4 @@ void TTSGetLanguageResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc
index 8b87b9c6ea..2cb47380d5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc
@@ -59,4 +59,4 @@ void TTSGetSupportedLanguagesRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc
index a4e97d9d70..a70d1c89a3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_response.cc
@@ -69,4 +69,4 @@ void TTSGetSupportedLanguagesResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc
index 32d3cba48a..89b5961895 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc
@@ -31,8 +31,8 @@
*/
#include "sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -94,22 +94,22 @@ void TTSIsReadyRequest::onTimeOut() {
}
void TTSIsReadyRequest::SendMessageToHMI() {
- utils::SharedPtr<smart_objects::SmartObject> get_language(
+ std::shared_ptr<smart_objects::SmartObject> get_language(
MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetLanguage,
application_manager_));
HMICapabilities& hmi_capabilities = hmi_capabilities_;
hmi_capabilities.set_handle_response_for(*get_language);
rpc_service_.ManageHMICommand(get_language);
- utils::SharedPtr<smart_objects::SmartObject> get_all_languages(
+ std::shared_ptr<smart_objects::SmartObject> get_all_languages(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::TTS_GetSupportedLanguages,
application_manager_));
rpc_service_.ManageHMICommand(get_all_languages);
- utils::SharedPtr<smart_objects::SmartObject> get_capabilities(
+ std::shared_ptr<smart_objects::SmartObject> get_capabilities(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::TTS_GetCapabilities, application_manager_));
rpc_service_.ManageHMICommand(get_capabilities);
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc
index c7d634bee2..67e0fb6396 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_response.cc
@@ -59,4 +59,4 @@ void TTSIsReadyResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc
index 8c7443d465..0b3d9a77bf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc
@@ -59,4 +59,4 @@ void TTSSetGlobalPropertiesRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc
index dae06d75f9..0901378c4a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_response.cc
@@ -63,4 +63,4 @@ void TTSSetGlobalPropertiesResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc
index 96b93b724f..6dce94f931 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_request.cc
@@ -59,4 +59,4 @@ void TTSSpeakRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc
index cb2346083b..69be5ab160 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_speak_response.cc
@@ -32,8 +32,8 @@
#include "sdl_rpc_plugin/commands/hmi/tts_speak_response.h"
#include "application_manager/event_engine/event.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -64,4 +64,4 @@ void TTSSpeakResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc
index 25a05f085b..43c595040c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_request.cc
@@ -59,4 +59,4 @@ void TTSStopSpeakingRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc
index a2620c1340..892b3e6295 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_stop_speaking_response.cc
@@ -62,4 +62,4 @@ void TTSStopSpeakingResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc
index 749b3ad56b..7c95e8a919 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc
@@ -59,4 +59,4 @@ void UIAddCommandRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc
index 266dffd225..72d841a878 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_response.cc
@@ -62,4 +62,4 @@ void UIAddCommandResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc
index de338d4670..15342c6ecb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc
@@ -59,4 +59,4 @@ void UIAddSubmenuRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc
index 85e600c87d..ae699dc2bd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_response.cc
@@ -63,4 +63,4 @@ void UIAddSubmenuResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc
index ae5f861ba6..793e70d9e1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_request.cc
@@ -47,7 +47,11 @@ UIAlertRequest::UIAlertRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle) {}
+ policy_handle) {
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::duration].asUInt();
+ default_timeout_ += request_timeout;
+}
UIAlertRequest::~UIAlertRequest() {}
@@ -59,4 +63,4 @@ void UIAlertRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc
index 3076eabc4c..f53f14e050 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_alert_response.cc
@@ -63,4 +63,4 @@ void UIAlertResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc
new file mode 100644
index 0000000000..c186077b1e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+UICancelInteractionRequest::UICancelInteractionRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UICancelInteractionRequest::~UICancelInteractionRequest() {}
+
+void UICancelInteractionRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SendRequest();
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc
new file mode 100644
index 0000000000..2d5db4eecb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h"
+#include "application_manager/event_engine/event.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+UICancelInteractionResponse::UICancelInteractionResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UICancelInteractionResponse::~UICancelInteractionResponse() {}
+
+void UICancelInteractionResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(hmi_apis::FunctionID::UI_CancelInteraction);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc
index d109987009..bb001b37c7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_request.cc
@@ -59,4 +59,4 @@ void UIChangeRegistrationRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc
index 6557269e49..8acd654488 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_change_registration_response.cc
@@ -63,4 +63,4 @@ void UIChangeRegistratioResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc
index 44049338a8..b354009e3f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_icon_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018, Ford Motor Company
+/*
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,14 +30,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "sdl_rpc_plugin/commands/hmi/ui_set_icon_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_create_window_request.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
namespace commands {
-UISetIconRequest::UISetIconRequest(
+UICreateWindowRequest::UICreateWindowRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
@@ -49,9 +49,9 @@ UISetIconRequest::UISetIconRequest(
hmi_capabilities,
policy_handle) {}
-UISetIconRequest::~UISetIconRequest() {}
+UICreateWindowRequest::~UICreateWindowRequest() {}
-void UISetIconRequest::Run() {
+void UICreateWindowRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
@@ -59,4 +59,4 @@ void UISetIconRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc
new file mode 100644
index 0000000000..c3a323818d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "sdl_rpc_plugin/commands/hmi/ui_create_window_response.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+UICreateWindowResponse::UICreateWindowResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UICreateWindowResponse::~UICreateWindowResponse() {}
+
+void UICreateWindowResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(hmi_apis::FunctionID::UI_CreateWindow);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc
index 9e52f5fc18..1d741bba74 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_request.cc
@@ -59,4 +59,4 @@ void UIDeleteCommandRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc
index a8f5b59d39..40a5ec8a73 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_command_response.cc
@@ -63,4 +63,4 @@ void UIDeleteCommandResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc
index 1b84df8bed..fdca37cee6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_request.cc
@@ -59,4 +59,4 @@ void UIDeleteSubmenuRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc
index ec4025bea1..9d522431dc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_submenu_response.cc
@@ -63,4 +63,4 @@ void UIDeleteSubmenuResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc
new file mode 100644
index 0000000000..7933574d92
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+UIDeleteWindowRequest::UIDeleteWindowRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UIDeleteWindowRequest::~UIDeleteWindowRequest() {}
+
+void UIDeleteWindowRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SendRequest();
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc
new file mode 100644
index 0000000000..ba703e18ae
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+UIDeleteWindowResponse::UIDeleteWindowResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UIDeleteWindowResponse::~UIDeleteWindowResponse() {}
+
+void UIDeleteWindowResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(hmi_apis::FunctionID::UI_DeleteWindow);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc
index fe11185c62..92f51bc9cf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_request.cc
@@ -59,4 +59,4 @@ void UIEndAudioPassThruRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc
index 3a6d4efbe4..b6639dcbb9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_end_audio_pass_thru_response.cc
@@ -63,4 +63,4 @@ void UIEndAudioPassThruResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc
index 3bd56a0682..5f8704b3e5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc
@@ -59,4 +59,4 @@ void UIGetCapabilitiesRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
index cd5f3c9a42..a3eb9244bd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
@@ -73,9 +73,17 @@ void UIGetCapabilitiesResponse::Run() {
msg_params[hmi_response::soft_button_capabilities]);
}
- if (msg_params.keyExists(strings::audio_pass_thru_capabilities)) {
+ // use newer parameter "audioPassThruCapabilitiesList" when available
+ if (msg_params.keyExists(strings::audio_pass_thru_capabilities_list)) {
hmi_capabilities.set_audio_pass_thru_capabilities(
- msg_params[strings::audio_pass_thru_capabilities]);
+ msg_params[strings::audio_pass_thru_capabilities_list]);
+ } else if (msg_params.keyExists(strings::audio_pass_thru_capabilities)) {
+ smart_objects::SmartObject audio_pass_thru_capabilities_list(
+ smart_objects::SmartType_Array);
+ audio_pass_thru_capabilities_list[0] =
+ msg_params[strings::audio_pass_thru_capabilities];
+ hmi_capabilities.set_audio_pass_thru_capabilities(
+ audio_pass_thru_capabilities_list);
}
if (msg_params.keyExists(strings::hmi_capabilities)) {
@@ -113,9 +121,15 @@ void UIGetCapabilitiesResponse::Run() {
msg_params[strings::system_capabilities]
[strings::video_streaming_capability]);
}
+ if (msg_params[strings::system_capabilities].keyExists(
+ strings::display_capabilities)) {
+ hmi_capabilities.set_system_display_capabilities(
+ msg_params[strings::system_capabilities]
+ [strings::display_capabilities]);
+ }
}
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc
index 8acba42493..d3b44d1168 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc
@@ -59,4 +59,4 @@ void UIGetLanguageRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc
index 27e46e52b4..2a5c0ab016 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_response.cc
@@ -78,4 +78,4 @@ void UIGetLanguageResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc
index 2f8ef12a25..0665612525 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc
@@ -59,4 +59,4 @@ void UIGetSupportedLanguagesRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc
index d20dd8545f..19ee62e51d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_response.cc
@@ -69,4 +69,4 @@ void UIGetSupportedLanguagesResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc
index 3b2c77f16e..2546b704b2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc
@@ -93,18 +93,18 @@ void UIIsReadyRequest::onTimeOut() {
}
void UIIsReadyRequest::SendMessageToHMI() {
- utils::SharedPtr<smart_objects::SmartObject> get_language(
+ std::shared_ptr<smart_objects::SmartObject> get_language(
MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_GetLanguage,
application_manager_));
HMICapabilities& hmi_capabilities = hmi_capabilities_;
hmi_capabilities.set_handle_response_for(*get_language);
rpc_service_.ManageHMICommand(get_language);
- utils::SharedPtr<smart_objects::SmartObject> get_all_languages(
+ std::shared_ptr<smart_objects::SmartObject> get_all_languages(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::UI_GetSupportedLanguages,
application_manager_));
rpc_service_.ManageHMICommand(get_all_languages);
- utils::SharedPtr<smart_objects::SmartObject> get_capabilities(
+ std::shared_ptr<smart_objects::SmartObject> get_capabilities(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::UI_GetCapabilities, application_manager_));
rpc_service_.ManageHMICommand(get_capabilities);
@@ -112,4 +112,4 @@ void UIIsReadyRequest::SendMessageToHMI() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc
index e25e8ee8ab..96a2d1212c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_response.cc
@@ -60,4 +60,4 @@ void UIIsReadyResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc
index cca89e3073..18d5376b25 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_request.cc
@@ -59,4 +59,4 @@ void UIPerformAudioPassThruRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc
index 057448ab33..afbd1bbed7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_audio_pass_thru_response.cc
@@ -62,4 +62,4 @@ void UIPerformAudioPassThruResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc
index d5696a39e7..a07c72cbf4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_request.cc
@@ -47,7 +47,11 @@ UIPerformInteractionRequest::UIPerformInteractionRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle) {}
+ policy_handle) {
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::timeout].asUInt();
+ default_timeout_ += request_timeout;
+}
UIPerformInteractionRequest::~UIPerformInteractionRequest() {}
@@ -59,4 +63,4 @@ void UIPerformInteractionRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc
index 7629faa131..4cbc58d278 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_perform_interaction_response.cc
@@ -61,4 +61,4 @@ void UIPerformInteractionResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc
index dbe0ceb529..cad68e23aa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_request.cc
@@ -47,7 +47,11 @@ UIScrollableMessageRequest::UIScrollableMessageRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle) {}
+ policy_handle) {
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::timeout].asUInt();
+ default_timeout_ += request_timeout;
+}
UIScrollableMessageRequest::~UIScrollableMessageRequest() {}
@@ -59,4 +63,4 @@ void UIScrollableMessageRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc
index a96b9fa3ee..4e844095b4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_scrollable_message_response.cc
@@ -62,4 +62,4 @@ void UIScrollableMessageResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc
index f5f8f7bafd..4a538ac992 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_request.cc
@@ -58,4 +58,4 @@ void UISendHapticDataRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc
index 4555d81a0a..92afdaaa4a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_send_haptic_data_response.cc
@@ -62,4 +62,4 @@ void UISendHapticDataResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc
index d25bbd1cd9..821f78a046 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_request.cc
@@ -59,4 +59,4 @@ void UISetAppIconRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc
index 711b5767f2..68e96725d4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_app_icon_response.cc
@@ -62,4 +62,4 @@ void UISetAppIconResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc
index 73b813d0eb..63166157c8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_request.cc
@@ -58,4 +58,4 @@ void UiSetDisplayLayoutRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc
index d5d2e02e33..f35427895e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_display_layout_response.cc
@@ -63,4 +63,4 @@ void UiSetDisplayLayoutResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc
index 0664404361..0aaaae7cc7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc
@@ -59,4 +59,4 @@ void UISetGlobalPropertiesRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc
index 2e5fecf2af..48d73d146c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_response.cc
@@ -62,4 +62,4 @@ void UISetGlobalPropertiesResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc
index 4e87b9ccc3..4c8fcefcdf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_request.cc
@@ -59,4 +59,4 @@ void UISetMediaClockTimerRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc
index 39e7e1c232..fb5b25fc2b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_media_clock_timer_response.cc
@@ -62,4 +62,4 @@ void UISetMediaClockTimerResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc
new file mode 100644
index 0000000000..c2c8566e82
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+UIShowAppMenuRequest::UIShowAppMenuRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UIShowAppMenuRequest::~UIShowAppMenuRequest() {}
+
+void UIShowAppMenuRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SendRequest();
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc
new file mode 100644
index 0000000000..14bbc79e03
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h"
+#include "application_manager/event_engine/event.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+UIShowAppMenuResponse::UIShowAppMenuResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UIShowAppMenuResponse::~UIShowAppMenuResponse() {}
+
+void UIShowAppMenuResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ app_mngr::event_engine::Event event(hmi_apis::FunctionID::UI_ShowAppMenu);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc
index 5b7568abfe..d7160dc70b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_request.cc
@@ -59,4 +59,4 @@ void UIShowRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc
index 3e3c0b79d8..768069bf3a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_response.cc
@@ -61,4 +61,4 @@ void UIShowResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc
index 4df3adbe14..eae8cc523c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_request.cc
@@ -47,7 +47,11 @@ UISliderRequest::UISliderRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle) {}
+ policy_handle) {
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::timeout].asUInt();
+ default_timeout_ += request_timeout;
+}
UISliderRequest::~UISliderRequest() {}
@@ -59,4 +63,4 @@ void UISliderRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc
index 2431c65ddf..9cf7224ddb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_slider_response.cc
@@ -62,4 +62,4 @@ void UISliderResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc
index 05b08cb723..c5966fcb36 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_request.cc
@@ -59,4 +59,4 @@ void UpdateAppListRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc
index 3dd03993ef..7fc830b4e6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_app_list_response.cc
@@ -59,4 +59,4 @@ void UpdateAppListResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc
index 7736f2b1e6..3a014480c1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_request.cc
@@ -100,4 +100,4 @@ bool UpdateDeviceListRequest::CleanUp() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc
index 25dc9be5bd..d69e683f2b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_device_list_response.cc
@@ -58,4 +58,4 @@ void UpdateDeviceListResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc
index cafacea28f..a52f03b998 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_request.cc
@@ -32,6 +32,7 @@
*/
#include "sdl_rpc_plugin/commands/hmi/update_sdl_request.h"
+#include "application_manager/policies/policy_handler_interface.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -61,4 +62,4 @@ void UpdateSDLRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc
index a35571ec26..c02cde4111 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/update_sdl_response.cc
@@ -61,4 +61,4 @@ void UpdateSDLResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc
index 72ce387f77..788eda5a87 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc
@@ -59,4 +59,4 @@ void VRAddCommandRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc
index 19d43616ff..37b3e4696d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_response.cc
@@ -63,4 +63,4 @@ void VRAddCommandResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc
index 9ba5fa3571..d1be04ad44 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_request.cc
@@ -59,4 +59,4 @@ void VRChangeRegistrationRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc
index 42c5b6d65b..27bde2bafa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_change_registration_response.cc
@@ -62,4 +62,4 @@ void VRChangeRegistrationResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc
index efc09dc157..ebcfe78fa9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_request.cc
@@ -59,4 +59,4 @@ void VRDeleteCommandRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc
index f8f7535e68..d1d725b356 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_delete_command_response.cc
@@ -62,4 +62,4 @@ void VRDeleteCommandResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc
index 7e9c846857..b06bfa0e77 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc
@@ -59,4 +59,4 @@ void VRGetCapabilitiesRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc
index 47ffb3a675..80c308ea40 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_response.cc
@@ -61,4 +61,4 @@ void VRGetCapabilitiesResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc
index d57faa08fd..84179f6357 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc
@@ -59,4 +59,4 @@ void VRGetLanguageRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc
index 469452d108..6b7fec736d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_response.cc
@@ -78,4 +78,4 @@ void VRGetLanguageResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc
index bb27168a77..351940bf68 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc
@@ -59,4 +59,4 @@ void VRGetSupportedLanguagesRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc
index 722040388d..4c725267fa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_response.cc
@@ -31,8 +31,8 @@
*/
#include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_response.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -69,4 +69,4 @@ void VRGetSupportedLanguagesResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc
index dcf7f35e90..12414eab10 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc
@@ -93,18 +93,18 @@ void VRIsReadyRequest::onTimeOut() {
}
void VRIsReadyRequest::SendMessageToHMI() {
- utils::SharedPtr<smart_objects::SmartObject> get_language(
+ std::shared_ptr<smart_objects::SmartObject> get_language(
MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage,
application_manager_));
HMICapabilities& hmi_capabilities = hmi_capabilities_;
hmi_capabilities.set_handle_response_for(*get_language);
rpc_service_.ManageHMICommand(get_language);
- utils::SharedPtr<smart_objects::SmartObject> get_all_languages(
+ std::shared_ptr<smart_objects::SmartObject> get_all_languages(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::VR_GetSupportedLanguages,
application_manager_));
rpc_service_.ManageHMICommand(get_all_languages);
- utils::SharedPtr<smart_objects::SmartObject> get_capabilities(
+ std::shared_ptr<smart_objects::SmartObject> get_capabilities(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::VR_GetCapabilities, application_manager_));
rpc_service_.ManageHMICommand(get_capabilities);
@@ -112,4 +112,4 @@ void VRIsReadyRequest::SendMessageToHMI() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc
index 48d9c3e075..373f97bf80 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_response.cc
@@ -59,4 +59,4 @@ void VRIsReadyResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc
index 26e308a0bc..4257158f6a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_request.cc
@@ -47,7 +47,11 @@ VRPerformInteractionRequest::VRPerformInteractionRequest(
application_manager,
rpc_service,
hmi_capabilities,
- policy_handle) {}
+ policy_handle) {
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::timeout].asUInt();
+ default_timeout_ += request_timeout;
+}
VRPerformInteractionRequest::~VRPerformInteractionRequest() {}
@@ -59,4 +63,4 @@ void VRPerformInteractionRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc
index dec371e889..16378ab55a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_perform_interaction_response.cc
@@ -60,4 +60,4 @@ void VRPerformInteractionResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
index d1cb9763d9..1dbfc97458 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
@@ -31,14 +31,14 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include "sdl_rpc_plugin/commands/mobile/add_command_request.h"
+#include <string>
#include "application_manager/application.h"
#include "application_manager/message_helper.h"
+#include "utils/custom_string.h"
#include "utils/file_system.h"
#include "utils/helpers.h"
-#include "utils/custom_string.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -96,7 +96,7 @@ void AddCommandRequest::Run() {
app,
application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(
logger_, "MessageHelper::VerifyImage return " << verification_result);
SendResponse(false, verification_result);
@@ -126,9 +126,9 @@ void AddCommandRequest::Run() {
}
if (((*message_)[strings::msg_params][strings::menu_params].keyExists(
hmi_request::parent_id)) &&
- (0 !=
- (*message_)[strings::msg_params][strings::menu_params]
- [hmi_request::parent_id].asUInt())) {
+ (0 != (*message_)[strings::msg_params][strings::menu_params]
+ [hmi_request::parent_id]
+ .asUInt())) {
if (!CheckCommandParentId(app)) {
SendResponse(
false, mobile_apis::Result::INVALID_ID, "Parent ID doesn't exist");
@@ -160,7 +160,9 @@ void AddCommandRequest::Run() {
return;
}
- app->AddCommand((*message_)[strings::msg_params][strings::cmd_id].asUInt(),
+ const uint32_t internal_consecutive_number = application_manager::commands::
+ CommandImpl::CalcCommandInternalConsecutiveNumber(app);
+ app->AddCommand(internal_consecutive_number,
(*message_)[strings::msg_params]);
smart_objects::SmartObject ui_msg_params =
@@ -224,7 +226,8 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) {
if ((*message_)[strings::msg_params][strings::menu_params].keyExists(
hmi_request::parent_id)) {
parent_id = (*message_)[strings::msg_params][strings::menu_params]
- [hmi_request::parent_id].asUInt();
+ [hmi_request::parent_id]
+ .asUInt();
}
for (; commands.end() != i; ++i) {
@@ -239,7 +242,8 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) {
}
if (((*i->second)[strings::menu_params][strings::menu_name].asString() ==
(*message_)[strings::msg_params][strings::menu_params]
- [strings::menu_name].asString()) &&
+ [strings::menu_name]
+ .asString()) &&
(saved_parent_id == parent_id)) {
LOG4CXX_INFO(logger_,
"AddCommandRequest::CheckCommandName received"
@@ -293,7 +297,8 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) {
const int32_t parent_id =
(*message_)[strings::msg_params][strings::menu_params]
- [hmi_request::parent_id].asInt();
+ [hmi_request::parent_id]
+ .asInt();
smart_objects::SmartObject* parent = app->FindSubMenu(parent_id);
if (!parent) {
@@ -320,9 +325,10 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
return;
}
+ const uint32_t cmd_id =
+ (*message_)[strings::msg_params][strings::cmd_id].asUInt();
smart_objects::SmartObject msg_param(smart_objects::SmartType_Map);
- msg_param[strings::cmd_id] =
- (*message_)[strings::msg_params][strings::cmd_id];
+ msg_param[strings::cmd_id] = cmd_id;
msg_param[strings::app_id] = application->app_id();
switch (event.id()) {
@@ -458,8 +464,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
- application->RemoveCommand(
- (*message_)[strings::msg_params][strings::cmd_id].asUInt());
+ application->RemoveCommand(cmd_id);
result = false;
LOG4CXX_DEBUG(logger_, "Result " << result);
}
@@ -474,8 +479,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params);
- application->RemoveCommand(
- (*message_)[strings::msg_params][strings::cmd_id].asUInt());
+ application->RemoveCommand(cmd_id);
result = false;
LOG4CXX_DEBUG(logger_, "Result " << result);
}
@@ -501,7 +505,10 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
result = false;
}
- if (!result) {
+ if (result) {
+ application->help_prompt_manager().OnVrCommandAdded(
+ cmd_id, (*message_)[strings::msg_params], false);
+ } else {
RemoveCommand();
}
@@ -522,7 +529,8 @@ bool AddCommandRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) {
str = (*message_)[strings::msg_params][strings::menu_params]
- [strings::menu_name].asCharArray();
+ [strings::menu_name]
+ .asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_, "Invalid menu name syntax check failed.");
return true;
@@ -590,18 +598,18 @@ const std::string AddCommandRequest::GenerateMobileResponseInfo() {
void AddCommandRequest::RemoveCommand() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = application_manager_.application(connection_key());
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_ERROR(logger_, "No application associated with session key");
return;
}
+ const uint32_t cmd_id =
+ (*message_)[strings::msg_params][strings::cmd_id].asUInt();
smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
- msg_params[strings::cmd_id] =
- (*message_)[strings::msg_params][strings::cmd_id];
+ msg_params[strings::cmd_id] = cmd_id;
msg_params[strings::app_id] = app->app_id();
- app->RemoveCommand(
- (*message_)[strings::msg_params][strings::cmd_id].asUInt());
+ app->RemoveCommand(cmd_id);
if (BothSend() && !(is_vr_received_ || is_ui_received_)) {
// in case we have send bth UI and VR and no one respond
@@ -622,4 +630,4 @@ void AddCommandRequest::RemoveCommand() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc
index ccb84cecbb..24ff3b5a28 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_response.cc
@@ -61,4 +61,4 @@ void AddCommandResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
index 3dcc414f9e..89ccfb8bd7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
@@ -33,8 +33,8 @@
#include "sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h"
-#include "application_manager/message_helper.h"
#include "application_manager/application.h"
+#include "application_manager/message_helper.h"
#include "utils/helpers.h"
namespace sdl_rpc_plugin {
@@ -76,7 +76,7 @@ void AddSubMenuRequest::Run() {
verification_result = MessageHelper::VerifyImage(
received_msg_params[strings::menu_icon], app, application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(
logger_, "MessageHelper::VerifyImage return " << verification_result);
SendResponse(false, verification_result);
@@ -109,19 +109,29 @@ void AddSubMenuRequest::Run() {
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if (received_msg_params.keyExists(strings::menu_layout)) {
+ auto menu_layout = static_cast<mobile_apis::MenuLayout::eType>(
+ received_msg_params[strings::menu_layout].asUInt());
+ if (app->menu_layout_supported(menu_layout)) {
+ msg_params[strings::menu_layout] =
+ received_msg_params[strings::menu_layout];
+ } else {
+ is_menu_layout_available_ = false;
+ }
+ }
+
msg_params[strings::menu_id] = received_msg_params[strings::menu_id];
if (received_msg_params.keyExists(strings::position)) {
msg_params[strings::menu_params][strings::position] =
received_msg_params[strings::position];
}
+ if (received_msg_params.keyExists(strings::menu_icon)) {
+ msg_params[strings::menu_icon] = received_msg_params[strings::menu_icon];
+ }
msg_params[strings::menu_params][strings::menu_name] =
received_msg_params[strings::menu_name];
msg_params[strings::app_id] = app->app_id();
- if (mobile_apis::Result::SUCCESS == verification_result) {
- msg_params[strings::menu_icon] = received_msg_params[strings::menu_icon];
- }
-
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_AddSubMenu, &msg_params, true);
}
@@ -153,11 +163,22 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) {
application->AddSubMenu(
(*message_)[strings::msg_params][strings::menu_id].asInt(),
(*message_)[strings::msg_params]);
+ response_info =
+ "The MenuLayout specified is unsupported, the "
+ "default MenuLayout will be used." +
+ response_info;
+ SendResponse(result,
+ is_menu_layout_available_
+ ? MessageHelper::HMIToMobileResult(result_code)
+ : mobile_apis::Result::WARNINGS,
+ is_menu_layout_available_ ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
+ } else {
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
}
- SendResponse(result,
- MessageHelper::HMIToMobileResult(result_code),
- response_info.empty() ? NULL : response_info.c_str(),
- &(message[strings::msg_params]));
break;
}
default: {
@@ -186,4 +207,4 @@ bool AddSubMenuRequest::CheckSubMenuName() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc
index d0ec635dd0..d91f13f1df 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_response.cc
@@ -32,8 +32,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/add_sub_menu_response.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -62,4 +62,4 @@ void AddSubMenuResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
index 5dda34b743..9f36f260ae 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc
@@ -25,12 +25,12 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h"
#include <cstring>
#include <string>
-#include "sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h"
#include "application_manager/application_impl.h"
-#include "application_manager/policies/policy_handler.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -107,9 +107,9 @@ void AlertManeuverRequest::Run() {
MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(logger_,
- "MessageHelper::VerifyTtsFiles return "
- << verification_result);
+ LOG4CXX_ERROR(
+ logger_,
+ "MessageHelper::VerifyTtsFiles return " << verification_result);
SendResponse(false,
mobile_apis::Result::FILE_NOT_FOUND,
"One or more files needed for tts_chunks are not present");
@@ -288,4 +288,4 @@ bool AlertManeuverRequest::IsWhiteSpaceExist() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc
index d3e527f6ae..97c93d7455 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_response.cc
@@ -62,4 +62,4 @@ void AlertManeuverResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
index 2806ac1d93..57912e7087 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
@@ -35,12 +35,12 @@
#include <string.h>
-#include "application_manager/message_helper.h"
#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
#include "application_manager/policies/policy_handler.h"
-#include "utils/helpers.h"
#include "smart_objects/smart_object.h"
+#include "utils/helpers.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -73,18 +73,15 @@ AlertRequest::~AlertRequest() {}
bool AlertRequest::Init() {
/* Timeout in milliseconds.
- If omitted a standard value of 10000 milliseconds is used.*/
- if ((*message_)[strings::msg_params].keyExists(strings::duration)) {
- default_timeout_ =
- (*message_)[strings::msg_params][strings::duration].asUInt();
- } else {
- const int32_t def_value = 5000;
- default_timeout_ = def_value;
- }
+ If omitted a standard value of 10000 milliseconds is used.*/
+ auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t duration_timeout = msg_params[strings::duration].asUInt();
+
+ default_timeout_ += duration_timeout;
// If soft buttons are present, SDL will not use initiate timeout tracking for
// response.
- if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
+ if (msg_params.keyExists(strings::soft_buttons)) {
LOG4CXX_INFO(logger_,
"Request contains soft buttons - request timeout "
"will be set to 0.");
@@ -251,7 +248,8 @@ bool AlertRequest::Validate(uint32_t app_id) {
return false;
}
- if (mobile_apis::HMILevel::HMI_BACKGROUND == app->hmi_level() &&
+ if (mobile_apis::HMILevel::HMI_BACKGROUND ==
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) &&
app->AreCommandLimitsExceeded(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
application_manager::TLimitSource::POLICY_TABLE)) {
@@ -298,9 +296,9 @@ bool AlertRequest::Validate(uint32_t app_id) {
MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(logger_,
- "MessageHelper::VerifyTtsFiles return "
- << verification_result);
+ LOG4CXX_ERROR(
+ logger_,
+ "MessageHelper::VerifyTtsFiles return " << verification_result);
SendResponse(false,
mobile_apis::Result::FILE_NOT_FOUND,
"One or more files needed for tts_chunks are not present");
@@ -321,6 +319,11 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
msg_params[hmi_request::alert_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
+
int32_t index = 0;
if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) {
msg_params[hmi_request::alert_strings][index][hmi_request::field_name] =
@@ -349,10 +352,30 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
(*message_)[strings::msg_params][strings::soft_buttons];
MessageHelper::SubscribeApplicationToSoftButton(
(*message_)[strings::msg_params], app, function_id());
+ msg_params[strings::duration] = 0;
+ } else {
+ msg_params[strings::duration] =
+ (*message_)[strings::msg_params][strings::duration].asUInt();
+ }
+
+ if ((*message_)[strings::msg_params].keyExists(strings::alert_icon)) {
+ auto verification_result = MessageHelper::VerifyImage(
+ (*message_)[strings::msg_params][strings::alert_icon],
+ app,
+ application_manager_);
+
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
+ LOG4CXX_ERROR(logger_, "Image verification failed.");
+ SendResponse(false, verification_result);
+ return;
+ }
+
+ msg_params[strings::alert_icon] =
+ (*message_)[strings::msg_params][strings::alert_icon];
}
+
// app_id
msg_params[strings::app_id] = app_id;
- msg_params[strings::duration] = default_timeout_;
// NAVI platform progressIndicator
if ((*message_)[strings::msg_params].keyExists(strings::progress_indicator)) {
@@ -450,4 +473,4 @@ bool AlertRequest::HasHmiResponsesToWait() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc
index bab5e5a5d8..b709d13958 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_response.cc
@@ -32,10 +32,10 @@
*/
#include "sdl_rpc_plugin/commands/mobile/alert_response.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/application_impl.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/rpc_service.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -64,4 +64,4 @@ void AlertResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc
new file mode 100644
index 0000000000..82e0703da1
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc
@@ -0,0 +1,117 @@
+
+/*
+Copyright (c) 2019, Ford Motor Company, Livio
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following
+disclaimer in the documentation and/or other materials provided with the
+distribution.
+
+Neither the name of the the copyright holders nor the names of their
+contributors may be used to endorse or promote products derived from this
+software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "interfaces/MOBILE_API.h"
+#include "utils/helpers.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+CancelInteractionRequest::CancelInteractionRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CancelInteractionRequest::~CancelInteractionRequest() {}
+
+void CancelInteractionRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto function_id = static_cast<mobile_apis::FunctionID::eType>(
+ (*message_)[strings::msg_params][strings::func_id].asInt());
+
+ if (helpers::
+ Compare<mobile_apis::FunctionID::eType, helpers::NEQ, helpers::ALL>(
+ function_id,
+ mobile_apis::FunctionID::PerformInteractionID,
+ mobile_apis::FunctionID::AlertID,
+ mobile_apis::FunctionID::ScrollableMessageID,
+ mobile_apis::FunctionID::SliderID)) {
+ LOG4CXX_ERROR(logger_, "Bad function ID" << function_id);
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return;
+ }
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::app_id] = connection_key();
+ msg_params[strings::func_id] = function_id;
+
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
+
+ SendHMIRequest(hmi_apis::FunctionID::UI_CancelInteraction, &msg_params, true);
+}
+
+void CancelInteractionRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (event.id() != hmi_apis::FunctionID::UI_CancelInteraction) {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ return;
+ }
+
+ auto message = event.smart_object();
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_UI);
+
+ auto msg_params = message[strings::msg_params];
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(success, result, info, &msg_params);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc
new file mode 100644
index 0000000000..af73e72a6f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc
@@ -0,0 +1,60 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h"
+#include "application_manager/application_impl.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+CancelInteractionResponse::CancelInteractionResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CancelInteractionResponse::~CancelInteractionResponse() {}
+
+void CancelInteractionResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
index 6af930ea53..50217a9c8a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
@@ -31,14 +31,15 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "sdl_rpc_plugin/commands/mobile/change_registration_request.h"
#include <string.h>
#include <algorithm>
-#include "sdl_rpc_plugin/commands/mobile/change_registration_request.h"
-#include "application_manager/application_manager.h"
#include "application_manager/application_impl.h"
-#include "interfaces/MOBILE_API.h"
-#include "interfaces/HMI_API.h"
+#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace {
namespace custom_str = utils::custom_string;
@@ -49,9 +50,9 @@ struct IsSameNickname {
}
private:
- const custom_str::CustomString& app_id_;
+ const custom_str::CustomString app_id_;
};
-}
+} // namespace
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -160,7 +161,7 @@ void ChangeRegistrationRequest::Run() {
return;
}
- if (mobile_apis::Result::SUCCESS != CheckCoincidence()) {
+ if (mobile_apis::Result::SUCCESS != CheckCoincidence(app->device())) {
SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
return;
}
@@ -194,9 +195,9 @@ void ChangeRegistrationRequest::Run() {
MessageHelper::VerifyTtsFiles(tts_name, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(logger_,
- "MessageHelper::VerifyTtsFiles return "
- << verification_result);
+ LOG4CXX_ERROR(
+ logger_,
+ "MessageHelper::VerifyTtsFiles return " << verification_result);
SendResponse(false,
mobile_apis::Result::FILE_NOT_FOUND,
"One or more files needed for tts_name are not present");
@@ -216,9 +217,9 @@ void ChangeRegistrationRequest::Run() {
hmi_interfaces.GetInterfaceState(
HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS);
+ using helpers::ALL;
using helpers::Compare;
using helpers::EQ;
- using helpers::ALL;
if (Compare<HmiInterfaces::InterfaceState, EQ, ALL>(
HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE,
@@ -578,36 +579,46 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
return false;
}
-mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() {
+mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
+ const connection_handler::DeviceHandle& device_id) {
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
- ApplicationSet accessor = application_manager_.applications().GetData();
+ auto compare_tts_name = [](const smart_objects::SmartObject& obj_1,
+ const smart_objects::SmartObject& obj_2) {
+ return obj_1[application_manager::strings::text]
+ .asCustomString()
+ .CompareIgnoreCase(
+ obj_2[application_manager::strings::text].asCustomString());
+ };
+
+ const auto& accessor = application_manager_.applications().GetData();
custom_str::CustomString app_name;
- uint32_t app_id = connection_key();
+ const uint32_t app_id = connection_key();
if (msg_params.keyExists(strings::app_name)) {
app_name = msg_params[strings::app_name].asCustomString();
}
- ApplicationSetConstIt it = accessor.begin();
- for (; accessor.end() != it; ++it) {
- if (app_id == (*it)->app_id()) {
+ for (const auto& app : accessor) {
+ if (app->device() != device_id) {
+ continue;
+ }
+
+ if (app->app_id() == app_id) {
continue;
}
- const custom_str::CustomString& cur_name = (*it)->name();
+ const auto& cur_name = app->name();
if (msg_params.keyExists(strings::app_name)) {
if (app_name.CompareIgnoreCase(cur_name)) {
LOG4CXX_ERROR(logger_, "Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
}
-
- const smart_objects::SmartObject* vr = (*it)->vr_synonyms();
- const std::vector<smart_objects::SmartObject>* curr_vr = NULL;
- if (NULL != vr) {
- curr_vr = vr->asArray();
+ const auto vr = app->vr_synonyms();
+ if (vr) {
+ const auto curr_vr = vr->asArray();
CoincidencePredicateVR v(app_name);
if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) {
@@ -617,18 +628,37 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() {
}
}
- // vr check
+ // VR check
if (msg_params.keyExists(strings::vr_synonyms)) {
- const std::vector<smart_objects::SmartObject>* new_vr =
- msg_params[strings::vr_synonyms].asArray();
+ const auto new_vr = msg_params[strings::vr_synonyms].asArray();
CoincidencePredicateVR v(cur_name);
if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) {
LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name .");
return mobile_apis::Result::DUPLICATE_NAME;
}
- } // end vr check
- } // application for end
+ } // End vr check
+
+ // TTS check
+ if (msg_params.keyExists(strings::tts_name) && app->tts_name()) {
+ const auto tts_array = msg_params[strings::tts_name].asArray();
+ const auto tts_curr = app->tts_name()->asArray();
+ const auto& it_tts = std::find_first_of(tts_array->begin(),
+ tts_array->end(),
+ tts_curr->begin(),
+ tts_curr->end(),
+ compare_tts_name);
+ if (it_tts != tts_array->end()) {
+ LOG4CXX_ERROR(
+ logger_,
+ "TTS name: "
+ << (*it_tts)[strings::text].asCustomString().AsMBString()
+ << " is known already");
+ return mobile_apis::Result::DUPLICATE_NAME;
+ }
+ } // End tts check
+
+ } // Application for end
return mobile_apis::Result::SUCCESS;
}
@@ -638,9 +668,9 @@ bool ChangeRegistrationRequest::IsNicknameAllowed(
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "Can't find appication with connection key "
- << connection_key());
+ LOG4CXX_ERROR(
+ logger_,
+ "Can't find appication with connection key " << connection_key());
return false;
}
@@ -681,4 +711,4 @@ bool ChangeRegistrationRequest::IsNicknameAllowed(
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc
index 2dae92cd9b..78c60bc746 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_response.cc
@@ -61,4 +61,4 @@ void ChangeRegistrationResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
new file mode 100644
index 0000000000..275f1d82a6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
@@ -0,0 +1,119 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/close_application_request.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+CloseApplicationRequest::CloseApplicationRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CloseApplicationRequest::~CloseApplicationRequest() {}
+
+void CloseApplicationRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (app.use_count() == 0) {
+ LOG4CXX_ERROR(logger_, "Application does not exist");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::app_id] = connection_key();
+ SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_CloseApplication,
+ &msg_params,
+ true);
+}
+
+void CloseApplicationRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject& message = event.smart_object();
+
+ auto msg_params = message[strings::msg_params];
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_BasicCommunication);
+ if (success) {
+ ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+
+ if (app.use_count() == 0) {
+ LOG4CXX_ERROR(logger_, "Application does not exist");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ auto on_app_exit = [app](plugin_manager::RPCPlugin& plugin) {
+ plugin.OnApplicationEvent(plugin_manager::kApplicationExit, app);
+ };
+
+ application_manager_.GetPluginManager().ForEachPlugin(on_app_exit);
+ application_manager_.state_controller().SetRegularState(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_NONE,
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE,
+ mobile_apis::VideoStreamingState::NOT_STREAMABLE,
+ false);
+ }
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(success, result, info, &msg_params);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc
new file mode 100644
index 0000000000..934804e1b1
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/close_application_response.h"
+#include "application_manager/application_impl.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+CloseApplicationResponse::CloseApplicationResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CloseApplicationResponse::~CloseApplicationResponse() {}
+
+void CloseApplicationResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
index 7451ea7905..258aefd63f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
@@ -31,22 +31,24 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
-#include <cstring>
+#include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h"
#include <algorithm>
+#include <cstring>
+#include <string>
#include <vector>
-#include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
#include "utils/gen_hash.h"
#include "utils/helpers.h"
-namespace sdl_rpc_plugin {
-using namespace application_manager;
+const char* kInvalidImageWarningInfo = "Requested image(s) not found.";
+namespace sdl_rpc_plugin {
namespace commands {
+using namespace application_manager;
+
CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -61,9 +63,9 @@ CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest(
, choice_set_id_(0)
, expected_chs_count_(0)
, received_chs_count_(0)
+ , should_send_warnings_(false)
, error_from_hmi_(false)
- , is_timed_out_(false)
- , vr_commands_lock_(true) {}
+ , is_timed_out_(false) {}
CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -79,6 +81,7 @@ void CreateInteractionChoiceSetRequest::Run() {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
+
for (uint32_t i = 0;
i < (*message_)[strings::msg_params][strings::choice_set].length();
++i) {
@@ -105,6 +108,10 @@ void CreateInteractionChoiceSetRequest::Run() {
LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, Result::INVALID_DATA);
return;
+ } else if (verification_result_image == Result::WARNINGS ||
+ verification_result_secondary_image == Result::WARNINGS) {
+ should_send_warnings_ = true;
+ break;
}
}
@@ -124,10 +131,30 @@ void CreateInteractionChoiceSetRequest::Run() {
SendResponse(false, result);
return;
}
- uint32_t grammar_id = application_manager_.GenerateGrammarID();
- (*message_)[strings::msg_params][strings::grammar_id] = grammar_id;
+ auto vr_status = MessageHelper::CheckChoiceSetVRCommands(
+ (*message_)[strings::msg_params][strings::choice_set]);
+ if (vr_status == MessageHelper::ChoiceSetVRCommandsStatus::MIXED) {
+ // this is an error
+ SendResponse(false,
+ Result::INVALID_DATA,
+ "Some choices don't contain VR commands. Either all or none "
+ "must have voice commands.");
+ return; // exit now, this is a bad set
+ } else if (vr_status == MessageHelper::ChoiceSetVRCommandsStatus::ALL) {
+ // everyone had a vr command, setup the grammar
+ uint32_t grammar_id = application_manager_.GenerateGrammarID();
+ (*message_)[strings::msg_params][strings::grammar_id] = grammar_id;
+ }
+ // continue on as usual
app->AddChoiceSet(choice_set_id_, (*message_)[strings::msg_params]);
- SendVRAddCommandRequests(app);
+
+ if (vr_status == MessageHelper::ChoiceSetVRCommandsStatus::ALL) {
+ // we have VR commands
+ SendVRAddCommandRequests(app);
+ } else {
+ // we have none, just return with success
+ SendResponse(true, Result::SUCCESS);
+ }
}
mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet(
@@ -149,7 +176,7 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet(
(*current_choice_set_it)[strings::choice_id].asInt());
if (!ins_res.second) {
LOG4CXX_ERROR(logger_,
- "Choise with ID "
+ "Choice with ID "
<< (*current_choice_set_it)[strings::choice_id].asInt()
<< " already exists");
return mobile_apis::Result::INVALID_ID;
@@ -171,14 +198,17 @@ mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet(
}
bool CreateInteractionChoiceSetRequest::compareSynonyms(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice1,
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& choice2) {
+ const ns_smart_device_link::ns_smart_objects::SmartObject& choice1,
+ const ns_smart_device_link::ns_smart_objects::SmartObject& choice2) {
+ // only compare if they both have vr commands
+ if (!(choice1.keyExists(strings::vr_commands) &&
+ choice2.keyExists(strings::vr_commands))) {
+ return false; // clearly there isn't a duplicate if one of them is null
+ }
smart_objects::SmartArray* vr_cmds_1 =
choice1[strings::vr_commands].asArray();
- DCHECK(vr_cmds_1 != NULL);
smart_objects::SmartArray* vr_cmds_2 =
choice2[strings::vr_commands].asArray();
- DCHECK(vr_cmds_2 != NULL);
smart_objects::SmartArray::iterator it;
it = std::find_first_of(vr_cmds_1->begin(),
@@ -188,9 +218,9 @@ bool CreateInteractionChoiceSetRequest::compareSynonyms(
CreateInteractionChoiceSetRequest::compareStr);
if (it != vr_cmds_1->end()) {
- LOG4CXX_INFO(logger_,
- "Incoming choice set has duplicated VR synonyms "
- << it->asString());
+ LOG4CXX_INFO(
+ logger_,
+ "Incoming choice set has duplicated VR synonyms " << it->asString());
return true;
}
@@ -198,8 +228,8 @@ bool CreateInteractionChoiceSetRequest::compareSynonyms(
}
bool CreateInteractionChoiceSetRequest::compareStr(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& str1,
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& str2) {
+ const ns_smart_device_link::ns_smart_objects::SmartObject& str1,
+ const ns_smart_device_link::ns_smart_objects::SmartObject& str2) {
return 0 == strcasecmp(str1.asCharArray(), str2.asCharArray());
}
@@ -302,9 +332,9 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests(
VRCommandInfo vr_command(vr_cmd_id);
sent_commands_map_[vr_corr_id] = vr_command;
- LOG4CXX_DEBUG(logger_,
- "VR_command sent corr_id " << vr_corr_id << " cmd_id "
- << vr_corr_id);
+ LOG4CXX_DEBUG(
+ logger_,
+ "VR_command sent corr_id " << vr_corr_id << " cmd_id " << vr_corr_id);
}
expected_chs_count_ = chs_num;
LOG4CXX_DEBUG(logger_, "expected_chs_count_ = " << expected_chs_count_);
@@ -436,7 +466,9 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() {
void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() {
LOG4CXX_AUTO_TRACE(logger_);
- if (!error_from_hmi_) {
+ if (!error_from_hmi_ && should_send_warnings_) {
+ SendResponse(true, mobile_apis::Result::WARNINGS, kInvalidImageWarningInfo);
+ } else if (!error_from_hmi_) {
SendResponse(true, mobile_apis::Result::SUCCESS);
} else {
DeleteChoices();
@@ -448,4 +480,4 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc
index 807770ed12..43dba2f238 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_response.cc
@@ -72,4 +72,4 @@ void CreateInteractionChoiceSetResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc
new file mode 100644
index 0000000000..b69b0ee801
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc
@@ -0,0 +1,376 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/create_window_request.h"
+
+#include <algorithm>
+
+#include "application_manager/application_impl.h"
+#include "application_manager/application_state.h"
+#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+using app_mngr::ApplicationSharedPtr;
+
+namespace commands {
+
+CreateWindowRequest::CreateWindowRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CreateWindowRequest::~CreateWindowRequest() {}
+
+bool CreateWindowRequest::CheckWindowName(
+ app_mngr::ApplicationSharedPtr app,
+ const app_mngr::WindowID window_id,
+ const std::string& window_name) const {
+ if (mobile_apis::PredefinedWindows::PRIMARY_WIDGET == window_id) {
+ LOG4CXX_DEBUG(logger_,
+ "Window name check is ignored for the primary widgets");
+ return true;
+ }
+
+ const bool names_are_equal = window_name == app->name().c_str();
+ if (names_are_equal &&
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ LOG4CXX_ERROR(logger_,
+ "Regular widget can't have the same name as application: "
+ << window_name);
+ return false;
+ }
+
+ const WindowNames window_names = app->GetWindowNames();
+ return !helpers::in_range(window_names, window_name);
+}
+
+void CreateWindowRequest::ApplyWindowInitialState(
+ ApplicationSharedPtr app) const {
+ const mobile_apis::WindowType::eType window_type =
+ static_cast<mobile_apis::WindowType::eType>(
+ (*message_)[strings::msg_params][strings::window_type].asInt());
+
+ // State should be initialized with INVALID_ENUM value to let state controller
+ // trigger OnHmiStatus notifiation sending
+ HmiStatePtr initial_state = application_manager_.CreateRegularState(
+ app,
+ window_type,
+ mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_api::SystemContext::INVALID_ENUM);
+
+ const WindowID window_id =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ const std::string window_name =
+ (*message_)[strings::msg_params][strings::window_name].asString();
+
+ smart_objects::SmartObject window_info(smart_objects::SmartType_Map);
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::associated_service_type)) {
+ window_info[strings::associated_service_type] =
+ (*message_)[strings::msg_params][strings::associated_service_type];
+ }
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::duplicate_updates_from_window_id)) {
+ window_info[strings::duplicate_updates_from_window_id] =
+ (*message_)[strings::msg_params]
+ [strings::duplicate_updates_from_window_id];
+ }
+
+ window_info[strings::window_name] = window_name;
+
+ app->SetWindowInfo(window_id, window_info);
+
+ app->SetInitialState(window_id, window_name, initial_state);
+
+ // Default HMI level for all windows except the main one is always NONE
+ application_manager_.state_controller().OnAppWindowAdded(
+ app, window_id, window_type, mobile_apis::HMILevel::HMI_NONE);
+}
+
+app_mngr::WindowID CreateWindowRequest::window_id() const {
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
+void CreateWindowRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const auto application = application_manager_.application(connection_key());
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ const auto window_id =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ if (application->WindowIdExists(window_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Window with id #" << window_id << " does already exist");
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return;
+ }
+
+ const auto window_type =
+ (*message_)[strings::msg_params][strings::window_type].asInt();
+
+ if (mobile_apis::WindowType::eType::MAIN == window_type) {
+ LOG4CXX_ERROR(logger_, "MAIN application window already exists");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::duplicate_updates_from_window_id)) {
+ const auto duplicate_updates_from_window_id =
+ (*message_)[strings::msg_params]
+ [strings::duplicate_updates_from_window_id]
+ .asInt();
+ if (!application->WindowIdExists(duplicate_updates_from_window_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Window with id #" << duplicate_updates_from_window_id
+ << " does not exist");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+ }
+
+ const std::string window_name =
+ (*message_)[strings::msg_params][strings::window_name].asString();
+ if (!CheckWindowName(application, window_id, window_name)) {
+ LOG4CXX_ERROR(logger_,
+ "Window name \"" << window_name
+ << "\" is disallowed for window #"
+ << window_id);
+ SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
+ return;
+ }
+
+ if (!ValidateWindowCreation(application, window_id)) {
+ return;
+ }
+
+ smart_objects::SmartObject msg_params = (*message_)[strings::msg_params];
+ msg_params[strings::app_id] = application->hmi_app_id();
+
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+ SendHMIRequest(hmi_apis::FunctionID::UI_CreateWindow, &msg_params, true);
+}
+
+void CreateWindowRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (hmi_apis::FunctionID::UI_CreateWindow != event.id()) {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ return;
+ }
+
+ auto application = application_manager_.application(connection_key());
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ LOG4CXX_INFO(logger_, "Received CreateWindow event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+
+ const smart_objects::SmartObject& response_message = event.smart_object();
+ const auto result_code = CommandRequestImpl::GetMobileResultCode(
+ static_cast<hmi_apis::Common_Result::eType>(
+ response_message[strings::params][hmi_response::code].asInt()));
+
+ const bool is_success = IsMobileResultSuccess(result_code);
+ std::string response_info;
+ GetInfo(response_message, response_info);
+
+ if (!is_success) {
+ LOG4CXX_ERROR(logger_, "CreateWindow request has failed on HMI side");
+ SendResponse(is_success,
+ result_code,
+ response_info.empty() ? nullptr : response_info.c_str());
+ return;
+ }
+
+ ApplyWindowInitialState(application);
+
+ SendResponse(is_success,
+ result_code,
+ response_info.empty() ? nullptr : response_info.c_str());
+}
+
+bool CreateWindowRequest::Init() {
+ hash_update_mode_ = HashUpdateMode::kDoHashUpdate;
+ return true;
+}
+
+bool CreateWindowRequest::IsWindowForAssociatedServiceCreated(
+ app_mngr::ApplicationSharedPtr app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const auto window_optional_params_map =
+ app->window_optional_params_map().GetData();
+
+ if (!(*message_)[strings::msg_params].keyExists(
+ strings::associated_service_type)) {
+ return false;
+ }
+
+ const auto associated_service_type =
+ (*message_)[strings::msg_params][strings::associated_service_type]
+ .asString();
+
+ const auto find_res = std::find_if(
+ window_optional_params_map.begin(),
+ window_optional_params_map.end(),
+ [&associated_service_type](
+ const std::pair<WindowID, smart_objects::SmartObjectSPtr>& element) {
+ LOG4CXX_DEBUG(logger_,
+ "Searching for " << associated_service_type
+ << " in window info for id "
+ << element.first);
+ if (element.second->keyExists(strings::associated_service_type) &&
+ associated_service_type ==
+ (*element.second)[strings::associated_service_type]
+ .asString()) {
+ return true;
+ }
+
+ return false;
+ });
+
+ return find_res != window_optional_params_map.end();
+}
+
+bool CreateWindowRequest::DoesExceedMaxAllowedWindows(
+ app_mngr::ApplicationSharedPtr app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto get_current_number_of_windows =
+ [&app](const mobile_apis::WindowType::eType window_type) -> size_t {
+ switch (window_type) {
+ case mobile_apis::WindowType::MAIN: {
+ return 1u;
+ }
+ case mobile_apis::WindowType::WIDGET: {
+ return app->window_optional_params_map().GetData().size();
+ }
+
+ default: {
+ LOG4CXX_WARN(logger_, "Unknown window type");
+ return 0u;
+ }
+ }
+ };
+
+ const auto window_type = static_cast<mobile_apis::WindowType::eType>(
+ (*message_)[strings::msg_params][strings::window_type].asInt());
+
+ auto display_capabilities = hmi_capabilities_.system_display_capabilities();
+ if (app->display_capabilities()) {
+ display_capabilities = app->display_capabilities();
+ }
+
+ if (!display_capabilities) {
+ LOG4CXX_WARN(logger_, "Application has no capabilities");
+ return false;
+ }
+
+ MessageHelper::PrintSmartObject(*display_capabilities);
+
+ const auto windowTypeSupported =
+ (*display_capabilities)[0][strings::window_type_supported].asArray();
+
+ DCHECK(windowTypeSupported);
+
+ const auto find_res = std::find_if(
+ windowTypeSupported->begin(),
+ windowTypeSupported->end(),
+ [&window_type](const smart_objects::SmartObject& element) {
+ if (window_type == static_cast<mobile_apis::WindowType::eType>(
+ element[strings::window_type].asInt())) {
+ return true;
+ }
+
+ return false;
+ });
+
+ if (find_res == windowTypeSupported->end()) {
+ LOG4CXX_WARN(logger_, "Requested Window Type is not supported by the HMI");
+ return true;
+ }
+
+ if (get_current_number_of_windows(window_type) + 1 >
+ (*find_res)[strings::maximum_number_of_windows].asUInt()) {
+ return true;
+ }
+
+ return false;
+}
+
+bool CreateWindowRequest::ValidateWindowCreation(
+ app_mngr::ApplicationSharedPtr app, const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (DoesExceedMaxAllowedWindows(app)) {
+ std::string info("Maximum allowed amount of windows is exceeded");
+ LOG4CXX_WARN(logger_, info);
+ SendResponse(false, mobile_apis::Result::REJECTED, info.c_str());
+ return false;
+ }
+
+ if (IsWindowForAssociatedServiceCreated(app)) {
+ std::string info(
+ "Window for this associated service type is already created");
+ LOG4CXX_WARN(logger_, info);
+ SendResponse(false, mobile_apis::Result::REJECTED, info.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc
index 514c6ad6d4..0d9bbc2815 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2018, Ford Motor Company
+ Copyright (c) 2019, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -31,8 +31,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include "sdl_rpc_plugin/commands/mobile/set_icon_response.h"
-#include "application_manager/application_manager.h"
+#include "sdl_rpc_plugin/commands/mobile/create_window_response.h"
#include "application_manager/rpc_service.h"
namespace sdl_rpc_plugin {
@@ -40,18 +39,21 @@ using namespace application_manager;
namespace commands {
-SetIconResponse::SetIconResponse(
+CreateWindowResponse::CreateWindowResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& app_man,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
policy::PolicyHandlerInterface& policy_handler)
- : CommandResponseImpl(
- message, app_man, rpc_service, hmi_capabilities, policy_handler) {}
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
-SetIconResponse::~SetIconResponse() {}
+CreateWindowResponse::~CreateWindowResponse() {}
-void SetIconResponse::Run() {
+void CreateWindowResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
rpc_service_.SendMessageToMobile(message_);
@@ -59,4 +61,4 @@ void SetIconResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc
index bbe787a123..363b14f92f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc
@@ -35,8 +35,8 @@
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
#include "utils/helpers.h"
namespace sdl_rpc_plugin {
@@ -198,14 +198,15 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
}
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
- const int32_t cmd_id = msg_params[strings::cmd_id].asInt();
+ const uint32_t cmd_id = msg_params[strings::cmd_id].asUInt();
smart_objects::SmartObject* command = application->FindCommand(cmd_id);
if (!command) {
LOG4CXX_ERROR(logger_,
- "Command id " << cmd_id << " not found for "
- "application with connection key "
+ "Command id " << cmd_id
+ << " not found for "
+ "application with connection key "
<< connection_key());
return;
}
@@ -213,7 +214,8 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
std::string info;
const bool result = PrepareResponseParameters(result_code, info);
if (result) {
- application->RemoveCommand(msg_params[strings::cmd_id].asInt());
+ application->RemoveCommand(cmd_id);
+ application->help_prompt_manager().OnVrCommandDeleted(cmd_id, false);
}
SendResponse(
result, result_code, info.empty() ? NULL : info.c_str(), &msg_params);
@@ -231,4 +233,4 @@ bool DeleteCommandRequest::IsPendingResponseExist() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc
index 8f85d50e28..919385ee50 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_response.cc
@@ -61,4 +61,4 @@ void DeleteCommandResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
index cf8a6d259f..46af8353b7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
@@ -68,7 +68,9 @@ void DeleteFileRequest::Run() {
return;
}
- if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) &&
+ if ((mobile_api::HMILevel::HMI_NONE ==
+ application->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) &&
(application_manager_.get_settings().delete_file_in_none() <=
application->delete_file_in_none_count())) {
// If application is in the HMI_NONE level the quantity of allowed
@@ -129,4 +131,4 @@ void DeleteFileRequest::SendFileRemovedNotification(
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc
index 66c61c9e4a..732a1e56b5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_response.cc
@@ -72,4 +72,4 @@ void DeleteFileResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
index a9db3975db..7950595b1c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
@@ -34,9 +34,9 @@
#include "sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h"
#include "application_manager/application_impl.h"
-#include "interfaces/MOBILE_API.h"
-#include "interfaces/HMI_API.h"
#include "application_manager/message_helper.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -63,9 +63,9 @@ void DeleteInteractionChoiceSetRequest::Run() {
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "No application associated with connection key "
- << connection_key());
+ LOG4CXX_ERROR(
+ logger_,
+ "No application associated with connection key " << connection_key());
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -165,4 +165,4 @@ void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand(
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc
index 18ca60f255..cf5ad3a2c2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_response.cc
@@ -34,8 +34,8 @@
#include "sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_response.h"
#include "application_manager/application_impl.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -81,4 +81,4 @@ void DeleteInteractionChoiceSetResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc
index 38113afcc2..6aaa2406e8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc
@@ -33,8 +33,8 @@
#include "sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h"
-#include "application_manager/message_helper.h"
#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
#include "interfaces/HMI_API.h"
#include "utils/helpers.h"
@@ -134,9 +134,11 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands(
(*it->second)[strings::menu_params][hmi_request::parent_id].asInt()) {
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+ const uint32_t cmd_id = (*it->second)[strings::cmd_id].asUInt();
msg_params[strings::app_id] = app->app_id();
- msg_params[strings::cmd_id] = (*it->second)[strings::cmd_id].asInt();
- app->RemoveCommand((*it->second)[strings::cmd_id].asInt());
+ msg_params[strings::cmd_id] = cmd_id;
+ app->RemoveCommand(cmd_id);
+ app->help_prompt_manager().OnVrCommandDeleted(cmd_id, false);
it = commands.begin(); // Can not relay on
// iterators after erase was called
@@ -198,4 +200,4 @@ bool DeleteSubMenuRequest::Init() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc
index 6831a66e1e..3cefef5c38 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_response.cc
@@ -61,4 +61,4 @@ void DeleteSubMenuResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc
new file mode 100644
index 0000000000..7f253e25fd
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc
@@ -0,0 +1,162 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/delete_window_request.h"
+
+#include <algorithm>
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+DeleteWindowRequest::DeleteWindowRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+DeleteWindowRequest::~DeleteWindowRequest() {}
+
+bool DeleteWindowRequest::CheckWindowId(
+ app_mngr::ApplicationSharedPtr app) const {
+ const WindowID window_id =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id) {
+ LOG4CXX_ERROR(logger_, "Main application window can't be deleted");
+ return false;
+ }
+
+ if (!app->WindowIdExists(window_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Window with id #" << window_id << " does not exist");
+ return false;
+ }
+
+ return true;
+}
+
+app_mngr::WindowID DeleteWindowRequest::window_id() const {
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
+void DeleteWindowRequest::DeleteWindow(
+ app_mngr::ApplicationSharedPtr app) const {
+ const WindowID window_id =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ app->RemoveWindowInfo(window_id);
+ app->RemoveHMIState(window_id, HmiState::StateID::STATE_ID_REGULAR);
+ app->remove_window_capability(window_id);
+}
+
+void DeleteWindowRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr application =
+ application_manager_.application(connection_key());
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ if (!CheckWindowId(application)) {
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return;
+ }
+
+ smart_objects::SmartObject msg_params = (*message_)[strings::msg_params];
+ msg_params[strings::app_id] = application->hmi_app_id();
+
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+ SendHMIRequest(hmi_apis::FunctionID::UI_DeleteWindow, &msg_params, true);
+}
+
+void DeleteWindowRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (hmi_apis::FunctionID::UI_DeleteWindow != event.id()) {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ return;
+ }
+
+ ApplicationSharedPtr application =
+ application_manager_.application(connection_key());
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ LOG4CXX_INFO(logger_, "Received DeleteWindow event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+
+ const smart_objects::SmartObject& response_message = event.smart_object();
+ const auto result_code = CommandRequestImpl::GetMobileResultCode(
+ static_cast<hmi_apis::Common_Result::eType>(
+ response_message[strings::params][hmi_response::code].asInt()));
+
+ const bool is_success = IsMobileResultSuccess(result_code);
+ std::string response_info;
+ GetInfo(response_message, response_info);
+
+ if (!is_success) {
+ LOG4CXX_ERROR(logger_, "DeleteWindow request has failed on HMI side");
+ SendResponse(is_success,
+ result_code,
+ response_info.empty() ? nullptr : response_info.c_str());
+ return;
+ }
+
+ DeleteWindow(application);
+
+ SendResponse(is_success,
+ result_code,
+ response_info.empty() ? nullptr : response_info.c_str());
+}
+
+bool DeleteWindowRequest::Init() {
+ hash_update_mode_ = HashUpdateMode::kDoHashUpdate;
+ return true;
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc
new file mode 100644
index 0000000000..f9ac9a46d6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc
@@ -0,0 +1,64 @@
+/*
+
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/delete_window_response.h"
+#include "application_manager/rpc_service.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+DeleteWindowResponse::DeleteWindowResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+DeleteWindowResponse::~DeleteWindowResponse() {}
+
+void DeleteWindowResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc
index ee0297ded6..1de7a3ea03 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc
@@ -30,9 +30,9 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "sdl_rpc_plugin/commands/mobile/dial_number_request.h"
#include <algorithm>
#include <string>
-#include "sdl_rpc_plugin/commands/mobile/dial_number_request.h"
#include "application_manager/application_impl.h"
@@ -153,4 +153,4 @@ void DialNumberRequest::StripNumberParam(std::string& number) {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc
index a264f96e0d..4385b3fe90 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_response.cc
@@ -60,4 +60,4 @@ void DialNumberResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc
index 3650a8226c..66ff7b48d5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc
@@ -97,4 +97,4 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc
index f9f9f89d11..6c9bd05e09 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_response.cc
@@ -61,4 +61,4 @@ void EndAudioPassThruResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/generic_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/generic_response.cc
index eef2750376..fda6cc64e5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/generic_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/generic_response.cc
@@ -41,7 +41,7 @@ using namespace application_manager;
namespace commands {
void GenericResponse::Run() {
- /*NsSmartDeviceLink::NsSmartObjects::SmartObject response;
+ /*ns_smart_device_link::ns_smart_objects::SmartObject response;
response[strings::params][strings::correlation_id] =
(*message_)[strings::params][strings::correlation_id];
@@ -63,4 +63,4 @@ void GenericResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
new file mode 100644
index 0000000000..c5e94da378
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc
@@ -0,0 +1,90 @@
+#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h"
+#include "application_manager/policies/policy_handler_interface.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetCloudAppPropertiesRequest::~GetCloudAppPropertiesRequest() {}
+
+void GetCloudAppPropertiesRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ std::string policy_app_id =
+ (*message_)[strings::msg_params][strings::app_id].asString();
+
+ policy::AppProperties app_properties;
+
+ const bool result =
+ policy_handler_.GetAppProperties(policy_app_id, app_properties);
+
+ if (!result) {
+ SendResponse(false,
+ mobile_apis::Result::DATA_NOT_AVAILABLE,
+ "Cloud app does not exist on module");
+ return;
+ }
+
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+
+ policy_handler_.GetInitialAppData(policy_app_id, &nicknames, &app_hmi_types);
+
+ smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ smart_objects::SmartObject nicknames_array(smart_objects::SmartType_Array);
+ size_t i = 0;
+ for (std::string nickname : nicknames) {
+ nicknames_array[i] = nickname;
+ ++i;
+ }
+ properties[strings::nicknames] = nicknames_array;
+ properties[strings::app_id] = policy_app_id;
+ properties[strings::enabled] = app_properties.enabled;
+
+ if (!app_properties.auth_token.empty()) {
+ properties[strings::auth_token] = app_properties.auth_token;
+ }
+ if (!app_properties.transport_type.empty()) {
+ properties[strings::cloud_transport_type] = app_properties.transport_type;
+ }
+ if (!app_properties.hybrid_app_preference.empty()) {
+ properties[strings::hybrid_app_preference] =
+ app_properties.hybrid_app_preference;
+ }
+ if (!app_properties.endpoint.empty()) {
+ properties[strings::endpoint] = app_properties.endpoint;
+ }
+
+ response_params[strings::properties] = properties;
+
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
+}
+
+void GetCloudAppPropertiesRequest::on_event(
+ const app_mngr::event_engine::Event& event) {
+ LOG4CXX_INFO(logger_, "GetCloudAppPropertiesRequest on_event");
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc
new file mode 100644
index 0000000000..f50897303a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_response.cc
@@ -0,0 +1,31 @@
+#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/rpc_service.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+GetCloudAppPropertiesResponse::GetCloudAppPropertiesResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetCloudAppPropertiesResponse::~GetCloudAppPropertiesResponse() {}
+
+void GetCloudAppPropertiesResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
new file mode 100644
index 0000000000..75263494c2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc
@@ -0,0 +1,356 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/get_file_request.h"
+
+#include <boost/crc.hpp>
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+#include "utils/file_system.h"
+
+namespace {
+/**
+ * Calculates CRC32 checksum
+ * @param binary_data - input data for which CRC32 should be calculated
+ * @return calculated CRC32 checksum
+ */
+uint32_t GetCrc32CheckSum(const std::vector<uint8_t>& binary_data) {
+ const std::size_t file_size = binary_data.size();
+ boost::crc_32_type result;
+ result.process_bytes(&binary_data[0], file_size);
+ return result.checksum();
+}
+
+} // namespace
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetFileRequest::GetFileRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler)
+ , file_name_("")
+ , file_type_(mobile_apis::FileType::INVALID_ENUM)
+ , length_(0)
+ , offset_(0) {}
+
+GetFileRequest::~GetFileRequest() {}
+
+bool GetFileRequest::GetFilePath(std::string& file_path, bool& forward_to_hmi) {
+ std::string path = application_manager_.get_settings().app_storage_folder();
+ auto connect_key = connection_key();
+ forward_to_hmi = false;
+
+ if ((*message_)[strings::msg_params].keyExists(strings::app_service_id)) {
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::app_service_id].asString();
+ LOG4CXX_DEBUG(logger_,
+ "Finding storage directory for service id: " << service_id);
+
+ AppService* app_service_info =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (app_service_info) {
+ if (app_service_info->mobile_service) {
+ connect_key = app_service_info->connection_key;
+ } else {
+ forward_to_hmi = true;
+ return true;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ LOG4CXX_DEBUG(logger_, "Using current storage directory");
+ }
+
+ ApplicationSharedPtr app = application_manager_.application(connect_key);
+ file_path = path + "/" + app->folder_name();
+ return true;
+}
+
+void GetFileRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_INFO(logger_, "Received GetFile request");
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ file_name_ = (*message_)[strings::msg_params][strings::file_name].asString();
+
+ if (!file_system::IsFileNameValid(file_name_)) {
+ LOG4CXX_ERROR(logger_,
+ "File name " << file_name_ << " contains forbidden symbols.");
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "File name contains forbidden symbols",
+ &response_params);
+ return;
+ }
+
+ // Initialize other params with default values. If exists overwrite the values
+ LOG4CXX_DEBUG(logger_, "Intialize non manadatory params with default values");
+
+ if ((*message_)[strings::msg_params].keyExists(strings::file_type)) {
+ file_type_ = static_cast<mobile_apis::FileType::eType>(
+ (*message_)[strings::msg_params][strings::file_type].asInt());
+ }
+
+ // Check if file exists on system (may have to use app service id to get the
+ // correct app folder)
+ LOG4CXX_DEBUG(logger_, "Check if file exists on system");
+ std::string file_path;
+ bool forward_to_hmi;
+
+ if (GetFilePath(file_path, forward_to_hmi)) {
+ if (forward_to_hmi) {
+ LOG4CXX_DEBUG(logger_, "Forwarding GetFile request to HMI");
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
+ SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_GetFilePath,
+ &(*message_)[strings::msg_params],
+ true);
+ return;
+ }
+ } else {
+ LOG4CXX_ERROR(logger_, "Could not get file path");
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Could not get file path",
+ &response_params);
+ return;
+ }
+
+ const std::string full_path = file_path + "/" + file_name_;
+ if (!file_system::FileExists(full_path)) {
+ LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist");
+ SendResponse(false,
+ mobile_apis::Result::FILE_NOT_FOUND,
+ "File does not exist",
+ &response_params);
+ return;
+ }
+
+ // Handle offset
+ LOG4CXX_DEBUG(logger_, "Handle offset and length parameters");
+ const uint64_t file_size = file_system::FileSize(full_path);
+
+ if ((*message_)[strings::msg_params].keyExists(strings::offset)) {
+ offset_ = (*message_)[strings::msg_params][strings::offset].asUInt();
+ }
+
+ length_ = file_size - offset_;
+ if ((*message_)[strings::msg_params].keyExists(strings::length)) {
+ length_ = std::min(
+ static_cast<uint32_t>(
+ (*message_)[strings::msg_params][strings::length].asUInt()),
+ length_);
+ }
+
+ if (offset_ > file_size) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Offset " << offset_ << " greater than file size " << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Offset greater than file size",
+ &response_params);
+ return;
+ }
+ if (length_ > file_size - offset_) {
+ LOG4CXX_ERROR(logger_,
+ "Length " << length_ << " greater than file size - offset"
+ << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Length greater than file size - offset",
+ &response_params);
+ return;
+ }
+
+ // Load data from file as binary data
+ LOG4CXX_DEBUG(logger_, "Load binary data from file");
+ std::vector<uint8_t> bin_data;
+ if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) {
+ LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path);
+ SendResponse(false,
+ mobile_apis::Result::GENERIC_ERROR,
+ "Unable to read from file",
+ &response_params);
+ return;
+ }
+
+ // Construct response message
+ if ((*message_)[strings::msg_params].keyExists(strings::offset)) {
+ response_params[strings::offset] = offset_;
+ }
+ if ((*message_)[strings::msg_params].keyExists(strings::length)) {
+ response_params[strings::length] = length_;
+ }
+ if ((*message_)[strings::msg_params].keyExists(strings::file_type)) {
+ response_params[strings::file_type] = file_type_;
+ }
+ const uint32_t crc_calculated = GetCrc32CheckSum(bin_data);
+ response_params[strings::crc32_check_sum] = crc_calculated;
+
+ SendResponse(true,
+ mobile_apis::Result::SUCCESS,
+ "File uploaded",
+ &response_params,
+ bin_data);
+}
+
+void GetFileRequest::on_event(const app_mngr::event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (hmi_apis::FunctionID::BasicCommunication_GetFilePath != event.id()) {
+ return;
+ }
+ const smart_objects::SmartObject& event_message = event.smart_object();
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ event_message[strings::params][hmi_response::code].asInt());
+
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_AppService);
+
+ if (!success) {
+ auto msg_params = event_message[strings::msg_params];
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(false, result, info, &msg_params);
+ return;
+ }
+ smart_objects::SmartObject response_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ std::vector<uint8_t> bin_data;
+
+ if (event_message[strings::msg_params].keyExists(strings::file_type)) {
+ response_params[strings::file_type] =
+ event_message[strings::msg_params][strings::file_type];
+ }
+
+ if (event_message[strings::msg_params].keyExists(strings::file_path)) {
+ std::string full_path =
+ event_message[strings::msg_params][strings::file_path].asString();
+
+ if (!file_system::FileExists(full_path)) {
+ LOG4CXX_ERROR(logger_, "File " << full_path << " does not exist");
+ SendResponse(false,
+ mobile_apis::Result::FILE_NOT_FOUND,
+ "File does not exist",
+ &response_params);
+ return;
+ }
+
+ const uint64_t file_size = file_system::FileSize(full_path);
+ if ((*message_)[strings::msg_params].keyExists(strings::offset)) {
+ offset_ = (*message_)[strings::msg_params][strings::offset].asUInt();
+ }
+
+ length_ = file_size - offset_;
+ if ((*message_)[strings::msg_params].keyExists(strings::length)) {
+ length_ = std::min(
+ static_cast<uint32_t>(
+ (*message_)[strings::msg_params][strings::length].asUInt()),
+ length_);
+ }
+
+ if (offset_ > file_size) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Offset " << offset_ << " greater than file size " << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Offset greater than file size",
+ &response_params);
+ return;
+ }
+ if (length_ > file_size - offset_) {
+ LOG4CXX_ERROR(logger_,
+ "Length " << length_ << " greater than file size - offset"
+ << file_size);
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Length greater than file size - offset",
+ &response_params);
+ return;
+ }
+ if (!file_system::ReadBinaryFile(full_path, bin_data, offset_, length_)) {
+ LOG4CXX_ERROR(logger_, "Failed to read from file: " << full_path);
+ SendResponse(false,
+ mobile_apis::Result::GENERIC_ERROR,
+ "Failed to read from file",
+ &response_params);
+ return;
+ }
+
+ const uint32_t crc_calculated = GetCrc32CheckSum(bin_data);
+ response_params[strings::crc32_check_sum] = crc_calculated;
+
+ } else {
+ LOG4CXX_ERROR(logger_, "HMI did not return a file path: ");
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "HMI did not return a file path",
+ &response_params);
+ return;
+ }
+
+ SendResponse(true, result, "File uploaded", &response_params, bin_data);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc
new file mode 100644
index 0000000000..2ea8dde02a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_response.cc
@@ -0,0 +1,63 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/get_file_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+GetFileResponse::GetFileResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+GetFileResponse::~GetFileResponse() {}
+
+void GetFileResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_INFO(logger_, "Sending GetFile response");
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
index a6c627aad2..6121747ccc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
@@ -32,6 +32,11 @@
#include "sdl_rpc_plugin/commands/mobile/get_system_capability_request.h"
+#include <set>
+#include "application_manager/app_service_manager.h"
+#include "application_manager/message_helper.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -80,10 +85,20 @@ void GetSystemCapabilityRequest::Run() {
switch (response_type) {
case mobile_apis::SystemCapabilityType::NAVIGATION: {
+ smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map);
+ bool has_nav_capability = false;
if (hmi_capabilities.navigation_capability()) {
+ has_nav_capability = true;
+ nav_capability = *hmi_capabilities.navigation_capability();
+ }
+
+ has_nav_capability = application_manager_.GetAppServiceManager()
+ .UpdateNavigationCapabilities(nav_capability) ||
+ has_nav_capability;
+
+ if (has_nav_capability) {
response_params[strings::system_capability]
- [strings::navigation_capability] =
- *hmi_capabilities.navigation_capability();
+ [strings::navigation_capability] = nav_capability;
} else {
SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE);
return;
@@ -118,6 +133,17 @@ void GetSystemCapabilityRequest::Run() {
}
break;
}
+ case mobile_apis::SystemCapabilityType::SEAT_LOCATION: {
+ if (hmi_capabilities.seat_location_capability()) {
+ response_params[strings::system_capability]
+ [strings::seat_location_capability] =
+ *hmi_capabilities.seat_location_capability();
+ } else {
+ SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE);
+ return;
+ }
+ break;
+ }
case mobile_apis::SystemCapabilityType::VIDEO_STREAMING:
if (hmi_capabilities.video_streaming_capability()) {
response_params[strings::system_capability]
@@ -128,11 +154,63 @@ void GetSystemCapabilityRequest::Run() {
return;
}
break;
+ case mobile_apis::SystemCapabilityType::APP_SERVICES: {
+ auto all_services =
+ application_manager_.GetAppServiceManager().GetAllServiceRecords();
+ response_params[strings::system_capability]
+ [strings::app_services_capabilities] =
+ MessageHelper::CreateAppServiceCapabilities(
+ all_services);
+ break;
+ }
+ case mobile_apis::SystemCapabilityType::DISPLAYS: {
+ auto capabilities = hmi_capabilities.system_display_capabilities();
+ if (app->display_capabilities()) {
+ capabilities = app->display_capabilities();
+ }
+
+ if (!capabilities) {
+ SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE);
+ LOG4CXX_INFO(logger_, "system_display_capabilities are not available");
+ return;
+ }
+
+ response_params[strings::system_capability]
+ [strings::display_capabilities] = *capabilities;
+ break;
+ }
default: // Return unsupported resource
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
return;
}
- SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
+
+ const char* info = nullptr;
+ // Ignore subscription/unsubscription for DISPLAYS type
+ if (mobile_apis::SystemCapabilityType::DISPLAYS != response_type) {
+ if ((*message_)[app_mngr::strings::msg_params].keyExists(
+ strings::subscribe)) {
+ auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
+ if ((*message_)[app_mngr::strings::msg_params][strings::subscribe]
+ .asBool() == true) {
+ LOG4CXX_DEBUG(logger_,
+ "Subscribe to system capability: " << response_type);
+ ext.SubscribeTo(response_type);
+ } else {
+ LOG4CXX_DEBUG(logger_,
+ "Unsubscribe from system capability: " << response_type);
+ ext.UnsubscribeFrom(response_type);
+ }
+ }
+ } else {
+ if ((*message_)[app_mngr::strings::msg_params].keyExists(
+ strings::subscribe)) {
+ info =
+ "Subscribe parameter is ignored. Auto Subscription/Unsubscription is "
+ "used for DISPLAY capability type.";
+ }
+ }
+
+ SendResponse(true, mobile_apis::Result::SUCCESS, info, &response_params);
}
void GetSystemCapabilityRequest::on_event(const event_engine::Event& event) {
@@ -140,4 +218,4 @@ void GetSystemCapabilityRequest::on_event(const event_engine::Event& event) {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc
index dd5461081c..5df0c72607 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_response.cc
@@ -30,9 +30,9 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "sdl_rpc_plugin/commands/mobile/get_system_capability_response.h"
#include "application_manager/application_manager.h"
#include "application_manager/rpc_service.h"
-#include "sdl_rpc_plugin/commands/mobile/get_system_capability_response.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -61,4 +61,4 @@ void GetSystemCapabilityResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc
index 7dc9eb9ad9..cd7d7a37b7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc
@@ -30,8 +30,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/application_manager.h"
#include "sdl_rpc_plugin/commands/mobile/get_way_points_request.h"
+#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
namespace sdl_rpc_plugin {
@@ -113,4 +113,4 @@ void GetWayPointsRequest::on_event(const event_engine::Event& event) {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc
index 7581990273..e481c926b8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_response.cc
@@ -30,8 +30,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/application_manager.h"
#include "sdl_rpc_plugin/commands/mobile/get_way_points_response.h"
+#include "application_manager/application_manager.h"
#include "application_manager/rpc_service.h"
namespace sdl_rpc_plugin {
@@ -61,4 +61,4 @@ void GetWayPointsResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
index e671dab463..b8714b4784 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
@@ -31,8 +31,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include "sdl_rpc_plugin/commands/mobile/list_files_request.h"
+#include <string>
#include "application_manager/application_impl.h"
@@ -70,7 +70,9 @@ void ListFilesRequest::Run() {
return;
}
- if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) &&
+ if ((mobile_api::HMILevel::HMI_NONE ==
+ application->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) &&
(application_manager_.get_settings().list_files_in_none() <=
application->list_files_in_none_count())) {
// If application is in the HMI_NONE level the quantity of allowed
@@ -112,4 +114,4 @@ void ListFilesRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc
index d025f05358..ffa8a443d5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_response.cc
@@ -32,8 +32,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/list_files_response.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -62,4 +62,4 @@ void ListFilesResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc
index 128ce1e3bf..5714043a51 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_app_interface_unregistered_notification.cc
@@ -60,4 +60,4 @@ void OnAppInterfaceUnregisteredNotification::Run() {
SendNotification();
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc
index ff88ae96bd..3088c7df33 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_audio_pass_thru_notification.cc
@@ -57,4 +57,4 @@ void OnAudioPassThruNotification::Run() {
SendNotification();
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
index 0dda8b3277..bca3b20fe0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
@@ -79,9 +79,8 @@ void OnButtonEventNotification::Run() {
(*message_)[strings::msg_params][strings::app_id].asUInt());
// custom_button_id is mandatory for CUSTOM_BUTTON notification
- if (false ==
- (*message_)[strings::msg_params].keyExists(
- hmi_response::custom_button_id)) {
+ if (false == (*message_)[strings::msg_params].keyExists(
+ hmi_response::custom_button_id)) {
LOG4CXX_ERROR(logger_,
"CUSTOM_BUTTON OnButtonEvent without custom_button_id.");
return;
@@ -103,11 +102,13 @@ void OnButtonEventNotification::Run() {
return;
}
- if ((mobile_api::HMILevel::HMI_FULL != app->hmi_level()) &&
- (mobile_api::HMILevel::HMI_LIMITED != app->hmi_level())) {
+ const auto window_id = app->GetSoftButtonWindowID(custom_btn_id);
+ (*message_)[strings::msg_params][strings::window_id] = window_id;
+ const auto window_hmi_level = app->hmi_level(window_id);
+ if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) {
LOG4CXX_WARN(logger_,
- "CUSTOM_BUTTON OnButtonEvent notification is allowed only "
- << "in FULL or LIMITED hmi level");
+ "CUSTOM_BUTTON OnButtonEvent notification is not allowed in "
+ "NONE hmi level");
return;
}
@@ -128,8 +129,11 @@ void OnButtonEventNotification::Run() {
}
// Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode
- if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) &&
- (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) {
+ const mobile_apis::HMILevel::eType app_hmi_level =
+ subscribed_app->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) &&
+ (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) {
LOG4CXX_WARN(logger_,
"OnButtonEvent notification is allowed only"
<< "in FULL or LIMITED hmi level");
@@ -149,7 +153,7 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
}
smart_objects::SmartObjectSPtr on_btn_event =
- new smart_objects::SmartObject();
+ std::make_shared<smart_objects::SmartObject>();
if (!on_btn_event) {
LOG4CXX_ERROR(logger_, "OnButtonEvent NULL pointer");
@@ -161,8 +165,16 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
(*on_btn_event)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::eType::OnButtonEventID);
- (*on_btn_event)[strings::msg_params][strings::button_name] =
- (*message_)[strings::msg_params][hmi_response::button_name];
+ mobile_apis::ButtonName::eType btn_id =
+ static_cast<mobile_apis::ButtonName::eType>(
+ (*message_)[strings::msg_params][hmi_response::button_name].asInt());
+
+ if (btn_id == mobile_apis::ButtonName::PLAY_PAUSE &&
+ app->msg_version() < utils::rpc_version_5) {
+ btn_id = mobile_apis::ButtonName::OK;
+ }
+
+ (*on_btn_event)[strings::msg_params][strings::button_name] = btn_id;
(*on_btn_event)[strings::msg_params][strings::button_event_mode] =
(*message_)[strings::msg_params][hmi_response::button_mode];
@@ -172,6 +184,11 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
(*message_)[strings::msg_params][strings::custom_button_id];
}
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ (*on_btn_event)[strings::msg_params][strings::window_id] =
+ (*message_)[strings::msg_params][strings::window_id];
+ }
+
message_ = on_btn_event;
SendNotification();
}
@@ -180,4 +197,4 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
index 06ff29134c..c51991742d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
@@ -35,6 +35,7 @@
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
+#include "utils/semantic_version.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -79,9 +80,8 @@ void OnButtonPressNotification::Run() {
(*message_)[strings::msg_params][strings::app_id].asUInt());
// custom_button_id is mandatory for CUSTOM_BUTTON notification
- if (false ==
- (*message_)[strings::msg_params].keyExists(
- hmi_response::custom_button_id)) {
+ if (false == (*message_)[strings::msg_params].keyExists(
+ hmi_response::custom_button_id)) {
LOG4CXX_ERROR(logger_,
"CUSTOM_BUTTON OnButtonPress without custom_button_id.");
return;
@@ -104,11 +104,14 @@ void OnButtonPressNotification::Run() {
}
// Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode
- if ((mobile_api::HMILevel::HMI_FULL != app->hmi_level()) &&
- (mobile_api::HMILevel::HMI_LIMITED != app->hmi_level())) {
+ const auto window_id = app->GetSoftButtonWindowID(custom_btn_id);
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ (*message_)[strings::msg_params][strings::window_id] = window_id;
+ const auto window_hmi_level = app->hmi_level(window_id);
+ if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) {
LOG4CXX_WARN(logger_,
- "CUSTOM_BUTTON OnButtonPress notification is allowed only "
- << "in FULL or LIMITED hmi level");
+ "CUSTOM_BUTTON OnButtonPress notification is not allowed in "
+ "NONE hmi level");
return;
}
@@ -129,8 +132,11 @@ void OnButtonPressNotification::Run() {
}
// Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode
- if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) &&
- (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) {
+ const mobile_apis::HMILevel::eType app_hmi_level =
+ subscribed_app->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) &&
+ (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) {
LOG4CXX_WARN(logger_,
"OnButtonPress notification is allowed only"
<< "in FULL or LIMITED hmi level");
@@ -138,7 +144,7 @@ void OnButtonPressNotification::Run() {
}
// if "appID" is present, send it to named app only if its FULL or
// LIMITED
- if (app.valid()) {
+ if (app.use_count() != 0) {
if (app->app_id() == subscribed_app->app_id()) {
SendButtonPress(subscribed_app);
}
@@ -156,7 +162,7 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
}
smart_objects::SmartObjectSPtr on_btn_press =
- new smart_objects::SmartObject();
+ std::make_shared<smart_objects::SmartObject>();
if (!on_btn_press) {
LOG4CXX_ERROR(logger_, "OnButtonPress NULL pointer");
@@ -168,8 +174,16 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
(*on_btn_press)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::eType::OnButtonPressID);
- (*on_btn_press)[strings::msg_params][strings::button_name] =
- (*message_)[strings::msg_params][hmi_response::button_name];
+ mobile_apis::ButtonName::eType btn_id =
+ static_cast<mobile_apis::ButtonName::eType>(
+ (*message_)[strings::msg_params][hmi_response::button_name].asInt());
+
+ if (btn_id == mobile_apis::ButtonName::PLAY_PAUSE &&
+ app->msg_version() < utils::rpc_version_5) {
+ btn_id = mobile_apis::ButtonName::OK;
+ }
+
+ (*on_btn_press)[strings::msg_params][strings::button_name] = btn_id;
(*on_btn_press)[strings::msg_params][strings::button_press_mode] =
(*message_)[strings::msg_params][hmi_response::button_mode];
@@ -179,6 +193,11 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
(*message_)[strings::msg_params][strings::custom_button_id];
}
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ (*on_btn_press)[strings::msg_params][strings::window_id] =
+ (*message_)[strings::msg_params][strings::window_id];
+ }
+
message_ = on_btn_press;
SendNotification();
}
@@ -187,4 +206,4 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc
index dff3aa6808..9c7edf74e6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_command_notification.cc
@@ -84,4 +84,4 @@ void OnCommandNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc
index ca5d4bfed4..42a1928f2e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_driver_distraction_notification.cc
@@ -67,4 +67,4 @@ void OnDriverDistractionNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc
index e252b031e6..c2ce2550b9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hash_change_notification.cc
@@ -34,9 +34,9 @@
#include "sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h"
+#include <string>
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
-#include <string>
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -81,4 +81,4 @@ void OnHashChangeNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc
index a495423bce..df3bce0154 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc
@@ -33,8 +33,8 @@
#include "sdl_rpc_plugin/commands/mobile/on_hmi_status_notification.h"
-#include "application_manager/message_helper.h"
#include "application_manager/message.h"
+#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
@@ -61,7 +61,7 @@ void OnHMIStatusNotification::Run() {
(*message_)[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kNotification);
ApplicationSharedPtr app = application_manager_.application(connection_key());
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_ERROR(logger_, "OnHMIStatusNotification application doesn't exist");
return;
}
@@ -78,17 +78,8 @@ void OnHMIStatusNotification::Run() {
mobile_apis::HMILevel::eType hmi_level =
static_cast<mobile_apis::HMILevel::eType>(
(*message_)[strings::msg_params][strings::hmi_level].asInt());
- if ((mobile_apis::HMILevel::HMI_BACKGROUND == hmi_level) ||
- (mobile_apis::HMILevel::HMI_NONE == hmi_level)) {
- if (!(app->tts_properties_in_none())) {
- app->set_tts_properties_in_none(true);
- LOG4CXX_INFO(logger_,
- "OnHMIStatusNotification::Send TTS GlobalProperties"
- " with empty array to HMI");
- MessageHelper::SendTTSGlobalProperties(app, false, application_manager_);
- }
- } else if ((mobile_apis::HMILevel::HMI_FULL == hmi_level) ||
- (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) {
+ if ((mobile_apis::HMILevel::HMI_FULL == hmi_level) ||
+ (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) {
if (!(app->tts_properties_in_full())) {
app->set_tts_properties_in_full(true);
LOG4CXX_INFO(logger_,
@@ -101,4 +92,4 @@ void OnHMIStatusNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
index 45caedfc2e..28325a40f5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
@@ -32,8 +32,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/on_hmi_status_notification_from_mobile.h"
-#include "application_manager/message_helper.h"
#include "application_manager/message.h"
+#include "application_manager/message_helper.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -60,7 +60,7 @@ void OnHMIStatusNotificationFromMobile::Run() {
static_cast<int32_t>(application_manager::MessageType::kNotification);
ApplicationSharedPtr app = application_manager_.application(connection_key());
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_ERROR(
logger_, "OnHMIStatusNotificationFromMobile application doesn't exist");
return;
@@ -132,4 +132,4 @@ void OnHMIStatusNotificationFromMobile::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc
index 2065c0b52d..1c0609e17d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc
@@ -76,13 +76,14 @@ void OnKeyBoardInputNotification::Run() {
break;
}
- if (mobile_apis::HMILevel::eType::HMI_FULL == app->hmi_level()) {
+ if (mobile_apis::HMILevel::eType::HMI_FULL ==
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) {
LOG4CXX_INFO(logger_, "There is application in HMI_FULL level");
app_to_notify = app;
}
}
- if (app_to_notify.valid()) {
+ if (app_to_notify.use_count() != 0) {
(*message_)[strings::params][strings::connection_key] =
app_to_notify->app_id();
SendNotification();
@@ -93,4 +94,4 @@ void OnKeyBoardInputNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc
index fdbdd910a0..9605fd6074 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_language_change_notification.cc
@@ -60,4 +60,4 @@ void OnLanguageChangeNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc
index 32d940aca2..f64ca34bf2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_permissions_change_notification.cc
@@ -62,4 +62,4 @@ void OnPermissionsChangeNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
new file mode 100644
index 0000000000..cc6ab7b65b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
@@ -0,0 +1,252 @@
+#include "sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/display_capabilities_builder.h"
+#include "application_manager/helpers/application_helper.h"
+#include "application_manager/message_helper.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+#include "smart_objects/enum_schema_item.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+namespace mobile {
+
+OnSystemCapabilityUpdatedNotification::OnSystemCapabilityUpdatedNotification(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandNotificationImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+OnSystemCapabilityUpdatedNotification::
+ ~OnSystemCapabilityUpdatedNotification() {}
+
+void OnSystemCapabilityUpdatedNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
+ const auto system_capability_type =
+ static_cast<mobile_apis::SystemCapabilityType::eType>(
+ msg_params[strings::system_capability]
+ [strings::system_capability_type]
+ .asInt());
+
+ switch (system_capability_type) {
+ case mobile_apis::SystemCapabilityType::NAVIGATION: {
+ smart_objects::SmartObject nav_capability(smart_objects::SmartType_Map);
+ bool has_nav_capability = false;
+ if (hmi_capabilities_.navigation_capability()) {
+ has_nav_capability = true;
+ nav_capability = *hmi_capabilities_.navigation_capability();
+ }
+ has_nav_capability = application_manager_.GetAppServiceManager()
+ .UpdateNavigationCapabilities(nav_capability) ||
+ has_nav_capability;
+
+ if (has_nav_capability) {
+ msg_params[strings::system_capability][strings::navigation_capability] =
+ nav_capability;
+ } else {
+ return;
+ }
+ break;
+ }
+ case mobile_apis::SystemCapabilityType::PHONE_CALL: {
+ if (hmi_capabilities_.phone_capability()) {
+ msg_params[strings::system_capability][strings::phone_capability] =
+ *hmi_capabilities_.phone_capability();
+ } else {
+ return;
+ }
+ break;
+ }
+ case mobile_apis::SystemCapabilityType::REMOTE_CONTROL: {
+ if (!hmi_capabilities_.is_rc_cooperating()) {
+ return;
+ }
+ if (hmi_capabilities_.rc_capability()) {
+ msg_params[strings::system_capability][strings::rc_capability] =
+ *hmi_capabilities_.rc_capability();
+ } else {
+ return;
+ }
+ break;
+ }
+ case mobile_apis::SystemCapabilityType::VIDEO_STREAMING:
+ if (hmi_capabilities_.video_streaming_capability()) {
+ msg_params[strings::system_capability]
+ [strings::video_streaming_capability] =
+ *hmi_capabilities_.video_streaming_capability();
+ } else {
+ return;
+ }
+ break;
+ case mobile_apis::SystemCapabilityType::APP_SERVICES: {
+ auto all_services =
+ application_manager_.GetAppServiceManager().GetAllServiceRecords();
+ auto app_service_caps =
+ MessageHelper::CreateAppServiceCapabilities(all_services);
+
+ smart_objects::SmartArray* app_services =
+ app_service_caps[strings::app_services].asArray();
+ smart_objects::SmartObject& updated_capabilities =
+ msg_params[strings::system_capability]
+ [strings::app_services_capabilities][strings::app_services];
+ for (size_t i = 0; i < updated_capabilities.length(); i++) {
+ std::string service_id =
+ updated_capabilities[i][strings::updated_app_service_record]
+ [strings::service_id]
+ .asString();
+ auto matching_service_predicate =
+ [&service_id](
+ const smart_objects::SmartObject& app_service_capability) {
+ return service_id ==
+ app_service_capability[strings::updated_app_service_record]
+ [strings::service_id]
+ .asString();
+ };
+
+ auto it = std::find_if(app_services->begin(),
+ app_services->end(),
+ matching_service_predicate);
+ if (it != app_services->end()) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Replacing updated record with service_id " << service_id);
+ app_services->erase(it);
+ }
+ app_services->push_back(updated_capabilities[i]);
+ }
+ msg_params[strings::system_capability]
+ [strings::app_services_capabilities] = app_service_caps;
+ break;
+ }
+
+ case mobile_apis::SystemCapabilityType::DISPLAYS: {
+ // Display capabilities content will be populated in the code after the
+ // switch so just breaking here
+ break;
+ }
+
+ default: {
+ LOG4CXX_ERROR(logger_,
+ "Unknown system capability type: "
+ << msg_params[strings::system_capability]
+ [strings::system_capability_type]
+ .asInt());
+ return;
+ }
+ }
+
+ const char* capability_type_string;
+ ns_smart_device_link::ns_smart_objects::EnumConversionHelper<
+ mobile_apis::SystemCapabilityType::eType>::
+ EnumToCString(system_capability_type, &capability_type_string);
+
+ const auto initial_connection_key =
+ (*message_)[strings::params][strings::connection_key].asUInt();
+
+ auto subscribed_to_capability_predicate =
+ [&system_capability_type,
+ &initial_connection_key](const ApplicationSharedPtr app) {
+ DCHECK_OR_RETURN(app, false);
+ auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
+ if (!ext.IsSubscribedTo(system_capability_type)) {
+ LOG4CXX_DEBUG(logger_,
+ "App " << app->app_id()
+ << " is not subscribed to this capability type");
+ return false;
+ }
+
+ if (mobile_apis::SystemCapabilityType::DISPLAYS ==
+ system_capability_type &&
+ initial_connection_key > 0) {
+ LOG4CXX_DEBUG(logger_,
+ "Display capabilities notification for app "
+ << initial_connection_key << " only");
+ return app->app_id() == initial_connection_key;
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "App " << app->app_id()
+ << " is subscribed to specified capability type");
+ return true;
+ };
+
+ const std::vector<ApplicationSharedPtr>& applications = FindAllApps(
+ application_manager_.applications(), subscribed_to_capability_predicate);
+
+ LOG4CXX_DEBUG(logger_,
+ "Number of Notifications to be sent: " << applications.size());
+
+ std::vector<ApplicationSharedPtr>::const_iterator app_it =
+ applications.begin();
+
+ for (; applications.end() != app_it; ++app_it) {
+ const ApplicationSharedPtr app = *app_it;
+ if (system_capability_type ==
+ mobile_apis::SystemCapabilityType::REMOTE_CONTROL &&
+ !app->is_remote_control_supported()) {
+ LOG4CXX_WARN(
+ logger_,
+ "App with connection key: "
+ << app->app_id()
+ << " was subcribed to REMOTE_CONTROL system capabilities, but "
+ "does not have RC permissions. Unsubscribing");
+ auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
+ ext.UnsubscribeFrom(system_capability_type);
+ continue;
+ }
+
+ if (mobile_apis::SystemCapabilityType::DISPLAYS == system_capability_type) {
+ LOG4CXX_DEBUG(logger_, "Using common display capabilities");
+ auto capabilities = hmi_capabilities_.system_display_capabilities();
+ if (app->is_resuming() && app->is_app_data_resumption_allowed()) {
+ LOG4CXX_DEBUG(logger_,
+ "Application "
+ << app->app_id()
+ << " is resuming. Providing cached capabilities");
+ auto display_caps =
+ app->display_capabilities_builder().display_capabilities();
+ capabilities = display_caps;
+ } else if (app->display_capabilities()) {
+ LOG4CXX_DEBUG(logger_,
+ "Application " << app->app_id()
+ << " has specific display capabilities");
+ const WindowID window_id =
+ msg_params[strings::system_capability]
+ [strings::display_capabilities][0]
+ [strings::window_capabilities][0][strings::window_id]
+ .asInt();
+ capabilities = app->display_capabilities(window_id);
+ }
+
+ if (!capabilities) {
+ LOG4CXX_WARN(logger_,
+ "No available display capabilities for sending. Skipping");
+ continue;
+ }
+
+ msg_params[strings::system_capability][strings::display_capabilities] =
+ *capabilities;
+ }
+
+ LOG4CXX_INFO(logger_,
+ "Sending OnSystemCapabilityUpdated " << capability_type_string
+ << " application id "
+ << app->app_id());
+ (*message_)[strings::params][strings::connection_key] = app->app_id();
+ SendNotification();
+ }
+}
+
+} // namespace mobile
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
index 419024f9b0..991144d7cf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
@@ -30,15 +30,16 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <cstring>
+#include "sdl_rpc_plugin/commands/mobile/on_system_request_notification.h"
#include <cstdio>
+#include <cstring>
#include <string>
-#include "sdl_rpc_plugin/commands/mobile/on_system_request_notification.h"
-#include "interfaces/MOBILE_API.h"
-#include "utils/file_system.h"
-#include "policy/policy_table/enums.h"
#include "application_manager/application_manager.h"
#include "application_manager/policies/policy_handler_interface.h"
+#include "interfaces/MOBILE_API.h"
+#include "policy/policy_table/enums.h"
+#include "utils/file_system.h"
+#include "utils/helpers.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -65,10 +66,11 @@ void OnSystemRequestNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
using namespace application_manager;
using namespace mobile_apis;
+ using namespace helpers;
ApplicationSharedPtr app = application_manager_.application(connection_key());
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_ERROR(logger_,
"Application with connection key " << connection_key()
<< " is not registered.");
@@ -84,8 +86,8 @@ void OnSystemRequestNotification::Run() {
static_cast<rpc::policy_table_interface_base::RequestType>(
request_type));
- if (!policy_handler.IsRequestTypeAllowed(app->policy_app_id(),
- request_type)) {
+ if (!policy_handler.IsRequestTypeAllowed(
+ app->device(), app->policy_app_id(), request_type)) {
LOG4CXX_WARN(logger_,
"Request type " << stringified_request_type
<< " is not allowed by policies");
@@ -106,17 +108,30 @@ void OnSystemRequestNotification::Run() {
}
}
- if (mobile_apis::RequestType::PROPRIETARY == request_type) {
- /* According to requirements:
- "If the requestType = PROPRIETARY, add to mobile API fileType = JSON
- If the requestType = HTTP, add to mobile API fileType = BINARY"
- Also in Genivi SDL we don't save the PT to file - we put it directly in
- binary_data */
+ LOG4CXX_DEBUG(logger_,
+ "Processing Request type : " << stringified_request_type);
+
+ const bool binary_data_is_required =
+ Compare<mobile_apis::RequestType::eType, EQ, ONE>(
+ request_type,
+ mobile_apis::RequestType::PROPRIETARY,
+ mobile_apis::RequestType::OEM_SPECIFIC);
+ BinaryMessage binary_data;
+ if (binary_data_is_required) {
const std::string filename =
(*message_)[strings::msg_params][strings::file_name].asString();
- BinaryMessage binary_data;
file_system::ReadBinaryFile(filename, binary_data);
+ }
+
+ if (mobile_apis::RequestType::OEM_SPECIFIC == request_type) {
+ (*message_)[strings::params][strings::binary_data] = binary_data;
+ } else if (mobile_apis::RequestType::PROPRIETARY == request_type) {
+ /* According to requirements:
+ "If the requestType = PROPRIETARY, add to mobile API fileType = JSON
+ If the requestType = HTTP, add to mobile API fileType = BINARY"
+ Also we don't save the PT to file - we put it directly in binary_data */
+
#if defined(PROPRIETARY_MODE)
AddHeader(binary_data);
#endif // PROPRIETARY_MODE
@@ -132,6 +147,13 @@ void OnSystemRequestNotification::Run() {
(*message_)[strings::msg_params][strings::timeout] =
policy_handler.TimeoutExchangeSec();
}
+ } else if (mobile_apis::RequestType::LOCK_SCREEN_ICON_URL == request_type) {
+ if (!(*message_)[strings::msg_params].keyExists(strings::url) ||
+ (*message_)[strings::msg_params][strings::url].empty()) {
+ LOG4CXX_ERROR(logger_,
+ "discarding LOCK_SCREEN_ICON_URL request without URL");
+ return;
+ }
}
SendNotification();
@@ -226,4 +248,4 @@ size_t OnSystemRequestNotification::ParsePTString(
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc
index 503f1b04d5..0a8420b6a3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc
@@ -67,7 +67,8 @@ void OnTBTClientStateNotification::Run() {
std::vector<ApplicationSharedPtr>::const_iterator it = applications.begin();
for (; applications.end() != it; ++it) {
ApplicationSharedPtr app = *it;
- if (mobile_apis::HMILevel::eType::HMI_NONE != app->hmi_level()) {
+ if (mobile_apis::HMILevel::eType::HMI_NONE !=
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) {
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotification();
}
@@ -76,4 +77,4 @@ void OnTBTClientStateNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc
index 502f0ae57d..6ceb381d2e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_touch_event_notification.cc
@@ -93,4 +93,4 @@ void OnTouchEventNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
index e25e4c622b..e89ede53b9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_way_point_change_notification.cc
@@ -55,10 +55,10 @@ OnWayPointChangeNotification::~OnWayPointChangeNotification() {}
void OnWayPointChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- std::set<int32_t> subscribed_for_way_points =
+ std::set<uint32_t> subscribed_for_way_points =
application_manager_.GetAppsSubscribedForWayPoints();
- for (std::set<int32_t>::const_iterator app_id =
+ for (std::set<uint32_t>::const_iterator app_id =
subscribed_for_way_points.begin();
app_id != subscribed_for_way_points.end();
++app_id) {
@@ -67,4 +67,4 @@ void OnWayPointChangeNotification::Run() {
}
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
index 86a644a778..2f3d38f0b0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
@@ -31,8 +31,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <cstring>
#include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h"
+#include <cstring>
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
@@ -87,7 +87,8 @@ void PerformAudioPassThruRequest::Run() {
return;
}
- if (mobile_api::HMILevel::HMI_NONE == app->hmi_level()) {
+ if (mobile_api::HMILevel::HMI_NONE ==
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) {
LOG4CXX_ERROR(logger_, "application isn't activated");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
@@ -113,9 +114,9 @@ void PerformAudioPassThruRequest::Run() {
initial_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(logger_,
- "MessageHelper::VerifyTtsFiles return "
- << verification_result);
+ LOG4CXX_ERROR(
+ logger_,
+ "MessageHelper::VerifyTtsFiles return " << verification_result);
SendResponse(
false,
mobile_apis::Result::FILE_NOT_FOUND,
@@ -250,13 +251,6 @@ PerformAudioPassThruRequest::PrepareResponseParameters() {
return response_params_;
}
-bool PerformAudioPassThruRequest::PrepareResponseParameters(
- mobile_apis::Result::eType& result_code, std::string& info) {
- LOG4CXX_AUTO_TRACE(logger_);
- NOTREACHED();
- return false;
-}
-
void PerformAudioPassThruRequest::SendSpeakRequest() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -293,20 +287,22 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() {
msg_params[hmi_request::audio_pass_display_texts] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
+ int32_t index = 0;
if ((*message_)[str::msg_params].keyExists(str::audio_pass_display_text1)) {
- msg_params[hmi_request::audio_pass_display_texts][0]
+ msg_params[hmi_request::audio_pass_display_texts][index]
[hmi_request::field_name] = static_cast<int32_t>(
hmi_apis::Common_TextFieldName::audioPassThruDisplayText1);
- msg_params[hmi_request::audio_pass_display_texts][0]
+ msg_params[hmi_request::audio_pass_display_texts][index]
[hmi_request::field_text] =
(*message_)[str::msg_params][str::audio_pass_display_text1];
+ ++index;
}
if ((*message_)[str::msg_params].keyExists(str::audio_pass_display_text2)) {
- msg_params[hmi_request::audio_pass_display_texts][1]
+ msg_params[hmi_request::audio_pass_display_texts][index]
[hmi_request::field_name] = static_cast<int32_t>(
hmi_apis::Common_TextFieldName::audioPassThruDisplayText2);
- msg_params[hmi_request::audio_pass_display_texts][1]
+ msg_params[hmi_request::audio_pass_display_texts][index]
[hmi_request::field_text] =
(*message_)[str::msg_params][str::audio_pass_display_text2];
}
@@ -457,4 +453,4 @@ bool PerformAudioPassThruRequest::IsWaitingHMIResponse() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc
index a5eb98f2ba..5dae6327eb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_response.cc
@@ -61,4 +61,4 @@ void PerformAudioPassThruResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
index 8710f3c3d6..881c838c1a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
@@ -31,20 +31,25 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <numeric>
+#include "sdl_rpc_plugin/commands/mobile/perform_interaction_request.h"
+
#include <string.h>
+#include <numeric>
#include <string>
-#include "sdl_rpc_plugin/commands/mobile/perform_interaction_request.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
-#include "utils/file_system.h"
-#include "utils/helpers.h"
+#include "interfaces/MOBILE_API.h"
#include "utils/custom_string.h"
+#include "utils/file_system.h"
#include "utils/gen_hash.h"
+#include "utils/helpers.h"
+
+namespace {
+const std::int32_t INVALID_CHOICE_ID = -1;
+}
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -67,11 +72,15 @@ PerformInteractionRequest::PerformInteractionRequest(
hmi_capabilities,
policy_handler)
, interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM)
+ , ui_choice_id_received_(INVALID_CHOICE_ID)
+ , vr_choice_id_received_(INVALID_CHOICE_ID)
, ui_response_received_(false)
, vr_response_received_(false)
, app_pi_was_active_before_(false)
, vr_result_code_(hmi_apis::Common_Result::INVALID_ENUM)
, ui_result_code_(hmi_apis::Common_Result::INVALID_ENUM) {
+ response_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
subscribe_on_event(hmi_apis::FunctionID::VR_OnCommand);
subscribe_on_event(hmi_apis::FunctionID::Buttons_OnButtonPress);
@@ -82,17 +91,18 @@ PerformInteractionRequest::~PerformInteractionRequest() {}
bool PerformInteractionRequest::Init() {
/* Timeout in milliseconds.
If omitted a standard value of 10000 milliseconds is used.*/
- if ((*message_)[strings::msg_params].keyExists(strings::timeout)) {
- default_timeout_ =
- (*message_)[strings::msg_params][strings::timeout].asUInt();
- }
+ const auto& msg_params = (*message_)[strings::msg_params];
+ uint32_t request_timeout = msg_params[strings::timeout].asUInt();
interaction_mode_ = static_cast<mobile_apis::InteractionMode::eType>(
- (*message_)[strings::msg_params][strings::interaction_mode].asInt());
+ msg_params[strings::interaction_mode].asInt());
if (mobile_apis::InteractionMode::BOTH == interaction_mode_ ||
mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
- default_timeout_ *= 2;
+ const uint32_t increase_value = 2;
+ default_timeout_ += request_timeout * increase_value;
+ } else {
+ default_timeout_ += request_timeout;
}
return true;
}
@@ -165,7 +175,7 @@ void PerformInteractionRequest::Run() {
}
if (msg_params.keyExists(strings::vr_help)) {
- if (mobile_apis::Result::SUCCESS !=
+ if (mobile_apis::Result::INVALID_DATA ==
MessageHelper::VerifyImageVrHelpItems(
msg_params[strings::vr_help], app, application_manager_)) {
LOG4CXX_ERROR(logger_,
@@ -186,7 +196,8 @@ void PerformInteractionRequest::Run() {
case mobile_apis::InteractionMode::BOTH: {
LOG4CXX_DEBUG(logger_, "Interaction Mode: BOTH");
if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) ||
- !CheckVrHelpItemPositions(app)) {
+ !CheckVrHelpItemPositions(app) ||
+ !CheckChoiceSetListVRCommands(app)) {
return;
}
break;
@@ -201,7 +212,8 @@ void PerformInteractionRequest::Run() {
}
case mobile_apis::InteractionMode::VR_ONLY: {
LOG4CXX_DEBUG(logger_, "Interaction Mode: VR_ONLY");
- if (!CheckChoiceSetVRSynonyms(app) || !CheckVrHelpItemPositions(app)) {
+ if (!CheckChoiceSetVRSynonyms(app) || !CheckVrHelpItemPositions(app) ||
+ !CheckChoiceSetListVRCommands(app)) {
return;
}
break;
@@ -224,8 +236,6 @@ void PerformInteractionRequest::Run() {
void PerformInteractionRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
- smart_objects::SmartObject msg_param =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
switch (event.id()) {
case hmi_apis::FunctionID::UI_OnResetTimeout: {
@@ -238,22 +248,24 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
LOG4CXX_DEBUG(logger_, "Received UI_PerformInteraction event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
ui_response_received_ = true;
+
unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
ui_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
GetInfo(message, ui_info_);
- ProcessUIResponse(event.smart_object(), msg_param);
+ ProcessUIResponse(event.smart_object(), response_msg_params);
break;
}
case hmi_apis::FunctionID::VR_PerformInteraction: {
LOG4CXX_DEBUG(logger_, "Received VR_PerformInteraction");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
vr_response_received_ = true;
+
unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction);
vr_result_code_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt());
GetInfo(message, vr_info_);
- if (ProcessVRResponse(event.smart_object(), msg_param)) {
+ if (ProcessVRResponse(event.smart_object(), response_msg_params)) {
return;
}
break;
@@ -265,8 +277,17 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
}
if (!HasHMIResponsesToWait()) {
- LOG4CXX_DEBUG(logger_, "Send response in BOTH iteraction mode");
- SendBothModeResponse(msg_param);
+ LOG4CXX_DEBUG(logger_,
+ "Send response in interaction mode "
+ << static_cast<int32_t>(interaction_mode_));
+ if (SetChoiceIdToResponseMsgParams(response_msg_params)) {
+ SendBothModeResponse(response_msg_params);
+ } else {
+ DisablePerformInteraction();
+ SendResponse(false,
+ mobile_apis::Result::GENERIC_ERROR,
+ "Received two different choice IDs");
+ }
}
}
@@ -282,7 +303,7 @@ void PerformInteractionRequest::onTimeOut() {
CommandRequestImpl::onTimeOut();
} else {
application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
+ connection_key(), correlation_id(), default_timeout_);
}
break;
}
@@ -339,31 +360,47 @@ bool PerformInteractionRequest::ProcessVRResponse(
}
LOG4CXX_DEBUG(logger_, "Update timeout for UI");
application_manager_.updateRequestTimeout(
- connection_key(), correlation_id(), default_timeout());
+ connection_key(), correlation_id(), default_timeout_);
return false;
}
- if (Common_Result::SUCCESS == vr_result_code_ &&
- InteractionMode::MANUAL_ONLY == interaction_mode_) {
- LOG4CXX_DEBUG(logger_,
- "VR response SUCCESS in MANUAL_ONLY mode "
- << "Wait for UI response");
- // in case MANUAL_ONLY mode VR.PI SUCCESS just return
- return false;
+ if (!ui_response_received_ &&
+ InteractionMode::MANUAL_ONLY != interaction_mode_) {
+ SendClosePopupRequestToHMI();
}
const SmartObject& hmi_msg_params = message[strings::msg_params];
if (hmi_msg_params.keyExists(strings::choice_id)) {
- const int choise_id = hmi_msg_params[strings::choice_id].asInt();
- if (!CheckChoiceIDFromResponse(app, choise_id)) {
+ const int choice_id = hmi_msg_params[strings::choice_id].asInt();
+ if (!CheckChoiceIDFromResponse(app, choice_id)) {
LOG4CXX_ERROR(logger_, "Wrong choiceID was received from HMI");
TerminatePerformInteraction();
SendResponse(
false, Result::GENERIC_ERROR, "Wrong choiceID was received from HMI");
return true;
}
- msg_params[strings::choice_id] = choise_id;
+ vr_choice_id_received_ = choice_id;
+ }
+
+ if (mobile_apis::InteractionMode::BOTH == interaction_mode_ ||
+ mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
+ LOG4CXX_DEBUG(logger_, "Update timeout for UI");
+ application_manager_.updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout_);
}
+
+ const bool is_vr_result_success = Compare<Common_Result::eType, EQ, ONE>(
+ vr_result_code_, Common_Result::SUCCESS, Common_Result::WARNINGS);
+
+ if (is_vr_result_success &&
+ InteractionMode::MANUAL_ONLY == interaction_mode_) {
+ LOG4CXX_DEBUG(logger_,
+ "VR response is successfull in MANUAL_ONLY mode "
+ << "Wait for UI response");
+ // in case MANUAL_ONLY mode VR.PI SUCCESS just return
+ return false;
+ }
+
return false;
}
@@ -383,8 +420,8 @@ void PerformInteractionRequest::ProcessUIResponse(
HmiInterfaces::InterfaceState ui_interface_state =
application_manager_.hmi_interfaces().GetInterfaceState(
HmiInterfaces::HMI_INTERFACE_UI);
- bool result = false;
- result = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+
+ bool result = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
ui_result_code_,
hmi_apis::Common_Result::SUCCESS,
hmi_apis::Common_Result::WARNINGS);
@@ -401,26 +438,29 @@ void PerformInteractionRequest::ProcessUIResponse(
ui_result_code_, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
if (result) {
- if (is_pi_warning) {
- ui_result_code_ = hmi_apis::Common_Result::WARNINGS;
- ui_info_ = message[strings::msg_params][strings::info].asString();
- if (message.keyExists(strings::params) &&
- message[strings::params].keyExists(strings::data)) {
- msg_params = message[strings::params][strings::data];
- }
- } else if (is_pi_unsupported) {
+ if (is_pi_unsupported) {
ui_result_code_ = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
ui_info_ = message[strings::msg_params][strings::info].asString();
- } else if (message.keyExists(strings::msg_params)) {
- msg_params = message[strings::msg_params];
+ } else {
+ if (message.keyExists(strings::msg_params)) {
+ msg_params = message[strings::msg_params];
+ }
+ if (is_pi_warning) {
+ ui_result_code_ = hmi_apis::Common_Result::WARNINGS;
+ ui_info_ = message[strings::msg_params][strings::info].asString();
+ }
}
+
// result code must be GENERIC_ERROR in case wrong choice_id
if (msg_params.keyExists(strings::choice_id)) {
- if (!CheckChoiceIDFromResponse(app,
- msg_params[strings::choice_id].asInt())) {
+ const std::int32_t ui_choice_id =
+ static_cast<std::int32_t>(msg_params[strings::choice_id].asInt());
+
+ if (!CheckChoiceIDFromResponse(app, ui_choice_id)) {
ui_result_code_ = hmi_apis::Common_Result::GENERIC_ERROR;
ui_info_ = "Wrong choiceID was received from HMI";
} else {
+ ui_choice_id_received_ = ui_choice_id;
msg_params[strings::trigger_source] =
mobile_apis::TriggerSource::TS_MENU;
}
@@ -443,6 +483,11 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest(
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
+
mobile_apis::InteractionMode::eType mode =
static_cast<mobile_apis::InteractionMode::eType>(
(*message_)[strings::msg_params][strings::interaction_mode].asInt());
@@ -465,12 +510,8 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest(
}
}
- if (mobile_apis::InteractionMode::BOTH == mode ||
- mobile_apis::InteractionMode::MANUAL_ONLY == mode) {
- msg_params[strings::timeout] = default_timeout_ / 2;
- } else {
- msg_params[strings::timeout] = default_timeout_;
- }
+ msg_params[strings::timeout] =
+ (*message_)[strings::msg_params][strings::timeout].asUInt();
msg_params[strings::app_id] = app->app_id();
if (mobile_apis::InteractionMode::VR_ONLY != mode) {
msg_params[strings::choice_set] =
@@ -526,6 +567,11 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
+
smart_objects::SmartObject& choice_list =
(*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
@@ -538,7 +584,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
smart_objects::SmartObject* choice_set =
app->FindChoiceSet(choice_list[i].asInt());
if (!choice_set) {
- LOG4CXX_WARN(logger_, "Couldn't found choiset");
+ LOG4CXX_WARN(logger_, "Couldn't found choiceset");
continue;
}
msg_params[strings::grammar_id][grammar_id_index++] =
@@ -554,9 +600,9 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
MessageHelper::VerifyTtsFiles(help_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_WARN(logger_,
- "MessageHelper::VerifyTtsFiles return "
- << verification_result);
+ LOG4CXX_WARN(
+ logger_,
+ "MessageHelper::VerifyTtsFiles return " << verification_result);
invalid_params.push_back("help_prompt");
} else {
msg_params[strings::help_prompt] = help_prompt;
@@ -602,9 +648,9 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
timeout_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_WARN(logger_,
- "MessageHelper::VerifyTtsFiles return "
- << verification_result);
+ LOG4CXX_WARN(
+ logger_,
+ "MessageHelper::VerifyTtsFiles return " << verification_result);
invalid_params.push_back("timeout_prompt");
} else {
msg_params[strings::timeout_prompt] = timeout_prompt;
@@ -623,9 +669,9 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
initial_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_WARN(logger_,
- "MessageHelper::VerifyTtsFiles return "
- << verification_result);
+ LOG4CXX_WARN(
+ logger_,
+ "MessageHelper::VerifyTtsFiles return " << verification_result);
invalid_params.push_back("initial_prompt");
} else {
msg_params[strings::initial_prompt] = initial_prompt;
@@ -646,16 +692,9 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
return;
}
- mobile_apis::InteractionMode::eType mode =
- static_cast<mobile_apis::InteractionMode::eType>(
- (*message_)[strings::msg_params][strings::interaction_mode].asInt());
-
- if (mobile_apis::InteractionMode::BOTH == mode ||
- mobile_apis::InteractionMode::MANUAL_ONLY == mode) {
- msg_params[strings::timeout] = default_timeout_ / 2;
- } else {
- msg_params[strings::timeout] = default_timeout_;
- }
+ msg_params[strings::timeout] =
+ (*message_)[strings::msg_params][strings::timeout].asUInt();
+ ;
msg_params[strings::app_id] = app->app_id();
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR);
SendHMIRequest(
@@ -746,6 +785,15 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms(
size_t jj = 0;
for (; ii < (*i_choice_set)[strings::choice_set].length(); ++ii) {
for (; jj < (*j_choice_set)[strings::choice_set].length(); ++jj) {
+ if (!((*i_choice_set)[strings::choice_set][ii].keyExists(
+ strings::vr_commands) &&
+ (*j_choice_set)[strings::choice_set][jj].keyExists(
+ strings::vr_commands))) {
+ LOG4CXX_DEBUG(logger_,
+ "One or both sets has missing vr commands, skipping "
+ "synonym check");
+ return true;
+ }
// choice_set pointer contains SmartObject msg_params
smart_objects::SmartObject& ii_vr_commands =
(*i_choice_set)[strings::choice_set][ii][strings::vr_commands];
@@ -909,15 +957,19 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() {
void PerformInteractionRequest::TerminatePerformInteraction() {
LOG4CXX_AUTO_TRACE(logger_);
+ SendClosePopupRequestToHMI();
+ DisablePerformInteraction();
+}
+
+void PerformInteractionRequest::SendClosePopupRequestToHMI() {
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[hmi_request::method_name] = "UI.PerformInteraction";
SendHMIRequest(hmi_apis::FunctionID::UI_ClosePopUp, &msg_params);
- DisablePerformInteraction();
}
bool PerformInteractionRequest::CheckChoiceIDFromResponse(
- ApplicationSharedPtr app, int32_t choice_id) {
+ ApplicationSharedPtr app, const int32_t choice_id) {
LOG4CXX_AUTO_TRACE(logger_);
const DataAccessor<PerformChoiceSetMap> accessor =
app->performinteraction_choice_set_map();
@@ -929,12 +981,14 @@ bool PerformInteractionRequest::CheckChoiceIDFromResponse(
const PerformChoice& choice = choice_set_map_it->second;
PerformChoice::const_iterator it = choice.begin();
for (; choice.end() != it; ++it) {
- const smart_objects::SmartObject& choice_set =
- (*it->second).getElement(strings::choice_set);
- for (size_t j = 0; j < choice_set.length(); ++j) {
- if (choice_id ==
- choice_set.getElement(j).getElement(strings::choice_id).asInt()) {
- return true;
+ if ((*it->second).keyExists(strings::choice_set)) {
+ const smart_objects::SmartObject& choice_set =
+ (*it->second).getElement(strings::choice_set);
+ for (size_t j = 0; j < choice_set.length(); ++j) {
+ if (choice_id ==
+ choice_set.getElement(j).getElement(strings::choice_id).asInt()) {
+ return true;
+ }
}
}
}
@@ -942,6 +996,45 @@ bool PerformInteractionRequest::CheckChoiceIDFromResponse(
return false;
}
+bool PerformInteractionRequest::CheckChoiceSetListVRCommands(
+ ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const smart_objects::SmartObject& choice_set_id_list =
+ (*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
+
+ smart_objects::SmartObject* choice_set = nullptr;
+
+ for (size_t i = 0; i < choice_set_id_list.length(); ++i) {
+ choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt());
+
+ // this should never ever happen since this was already checked
+ if (choice_set == nullptr) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Couldn't find choiceset_id = " << choice_set_id_list[i].asInt());
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return false;
+ }
+
+ const smart_objects::SmartObject& choices_list =
+ (*choice_set)[strings::choice_set];
+ auto vr_status = MessageHelper::CheckChoiceSetVRCommands(choices_list);
+
+ // if not all choices have vr commands
+ if (vr_status != MessageHelper::ChoiceSetVRCommandsStatus::ALL) {
+ LOG4CXX_ERROR(logger_,
+ "PerformInteraction has choice sets with "
+ "missing vrCommands, not in MANUAL_ONLY mode");
+ SendResponse(false,
+ mobile_apis::Result::INVALID_DATA,
+ "Some choices don't contain VR commands.");
+ return false;
+ }
+ }
+ return true;
+}
+
bool PerformInteractionRequest::CheckChoiceIDFromRequest(
ApplicationSharedPtr app,
const size_t choice_set_id_list_length,
@@ -958,9 +1051,10 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest(
if (!choice_set) {
LOG4CXX_ERROR(
logger_,
- "Couldn't find choiset_id = " << choice_set_id_list[i].asInt());
+ "Couldn't find choiceset_id = " << choice_set_id_list[i].asInt());
return false;
}
+
choice_list_length = (*choice_set)[strings::choice_set].length();
const smart_objects::SmartObject& choices_list =
(*choice_set)[strings::choice_set];
@@ -969,7 +1063,7 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest(
choice_id_set.insert(choices_list[k][strings::choice_id].asInt());
if (!ins_res.second) {
LOG4CXX_ERROR(logger_,
- "Choise with ID "
+ "choice with ID "
<< choices_list[k][strings::choice_id].asInt()
<< " already exists");
return false;
@@ -1001,13 +1095,94 @@ void PerformInteractionRequest::SendBothModeResponse(
msg_param.empty() ? NULL : &msg_param;
std::string info = app_mngr::commands::MergeInfos(
ui_perform_info, ui_info_, vr_perform_info, vr_info_);
+
DisablePerformInteraction();
+
SendResponse(result,
perform_interaction_result_code,
info.empty() ? NULL : info.c_str(),
response_params);
}
-} // namespace commands
+mobile_apis::Result::eType
+PerformInteractionRequest::PrepareResultCodeForResponse(
+ const app_mngr::commands::ResponseInfo& ui_response,
+ const app_mngr::commands::ResponseInfo& vr_response) {
+ LOG4CXX_DEBUG(
+ logger_, "InteractionMode = " << static_cast<int32_t>(interaction_mode_));
+
+ auto mobile_vr_result_code =
+ MessageHelper::HMIToMobileResult(vr_result_code_);
+ auto mobile_ui_result_code =
+ MessageHelper::HMIToMobileResult(ui_result_code_);
+
+ if (mobile_apis::Result::eType::WARNINGS == mobile_vr_result_code) {
+ if (mobile_apis::Result::eType::SUCCESS == mobile_ui_result_code) {
+ return mobile_apis::Result::eType::WARNINGS;
+ }
+ } else if (mobile_apis::Result::eType::WARNINGS == mobile_ui_result_code) {
+ if (mobile_apis::Result::eType::SUCCESS == mobile_vr_result_code) {
+ return mobile_apis::Result::eType::WARNINGS;
+ }
+ }
+
+ if (mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) {
+ return mobile_vr_result_code;
+ }
+ if (mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
+ return mobile_ui_result_code;
+ }
+
+ if (INVALID_CHOICE_ID != vr_choice_id_received_) {
+ return mobile_vr_result_code;
+ }
+ if (INVALID_CHOICE_ID != ui_choice_id_received_) {
+ return mobile_ui_result_code;
+ }
+
+ return CommandRequestImpl::PrepareResultCodeForResponse(ui_response,
+ vr_response);
+}
+
+bool PerformInteractionRequest::PrepareResultForMobileResponse(
+ app_mngr::commands::ResponseInfo& ui_response,
+ app_mngr::commands::ResponseInfo& vr_response) const {
+ if (mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) {
+ return vr_response.is_ok;
+ }
+ if (mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) {
+ return ui_response.is_ok;
+ }
+
+ return (vr_response.is_ok || ui_response.is_ok);
+}
-} // namespace application_manager
+bool PerformInteractionRequest::SetChoiceIdToResponseMsgParams(
+ ns_smart_device_link::ns_smart_objects::SmartObject& msg_param) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const bool ui_choice_id_valid = INVALID_CHOICE_ID != ui_choice_id_received_;
+ const bool vr_choice_id_valid = INVALID_CHOICE_ID != vr_choice_id_received_;
+
+ if (ui_choice_id_valid && vr_choice_id_valid &&
+ ui_choice_id_received_ != vr_choice_id_received_) {
+ return false;
+ }
+
+ if (mobile_apis::InteractionMode::eType::MANUAL_ONLY == interaction_mode_) {
+ msg_param[strings::choice_id] = ui_choice_id_received_;
+ return true;
+ }
+
+ if (mobile_apis::InteractionMode::eType::VR_ONLY == interaction_mode_) {
+ msg_param[strings::choice_id] = vr_choice_id_received_;
+ return true;
+ }
+
+ msg_param[strings::choice_id] =
+ ui_choice_id_valid ? ui_choice_id_received_ : vr_choice_id_received_;
+ return true;
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc
index 85bef9b2ad..fa02641c2b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_response.cc
@@ -61,4 +61,4 @@ void PerformInteractionResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
index 18fe00b54a..e25215fb48 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
@@ -31,22 +31,22 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <algorithm>
#include "sdl_rpc_plugin/commands/mobile/put_file_request.h"
+#include <algorithm>
-#include "application_manager/policies/policy_handler.h"
#include "application_manager/application_impl.h"
+#include "application_manager/policies/policy_handler.h"
#include "application_manager/rpc_service.h"
-#include "utils/file_system.h"
#include <boost/crc.hpp>
+#include "utils/file_system.h"
namespace {
/**
-* Calculates CRC32 checksum
-* @param binary_data - input data for which CRC32 should be calculated
-* @return calculated CRC32 checksum
-*/
+ * Calculates CRC32 checksum
+ * @param binary_data - input data for which CRC32 should be calculated
+ * @return calculated CRC32 checksum
+ */
uint32_t GetCrc32CheckSum(const std::vector<uint8_t>& binary_data) {
const std::size_t file_size = binary_data.size();
boost::crc_32_type result;
@@ -94,7 +94,9 @@ void PutFileRequest::Run() {
return;
}
- if (mobile_api::HMILevel::HMI_NONE == application->hmi_level() &&
+ if (mobile_api::HMILevel::HMI_NONE ==
+ application->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW) &&
application_manager_.get_settings().put_file_in_none() <=
application->put_file_in_none_count()) {
// If application is in the HMI_NONE level the quantity of allowed
@@ -212,10 +214,9 @@ void PutFileRequest::Run() {
return;
}
const std::string full_path = file_path + "/" + sync_file_name_;
- const size_t bin_data_size = binary_data.size();
if ((*message_)[strings::msg_params].keyExists(strings::crc32_check_sum)) {
- LOG4CXX_TRACE(logger_, "Binary Data Size: " << bin_data_size);
+ LOG4CXX_TRACE(logger_, "Binary Data Size: " << binary_data.size());
const uint32_t crc_received =
(*message_)[strings::msg_params][strings::crc32_check_sum].asUInt();
LOG4CXX_TRACE(logger_, "CRC32 SUM Received: " << crc_received);
@@ -232,7 +233,7 @@ void PutFileRequest::Run() {
}
LOG4CXX_DEBUG(logger_,
- "Writing " << bin_data_size << " bytes to " << full_path
+ "Writing " << binary_data.size() << " bytes to " << full_path
<< " (current size is"
<< file_system::FileSize(full_path) << ")");
@@ -285,9 +286,7 @@ void PutFileRequest::Run() {
}
SendResponse(true, save_result, "File was downloaded", &response_params);
- if (is_system_file) {
- SendOnPutFileNotification();
- }
+ SendOnPutFileNotification(is_system_file);
break;
}
default:
@@ -298,29 +297,29 @@ void PutFileRequest::Run() {
}
}
-void PutFileRequest::SendOnPutFileNotification() {
+void PutFileRequest::SendOnPutFileNotification(bool is_system_file) {
LOG4CXX_INFO(logger_, "SendOnPutFileNotification");
smart_objects::SmartObjectSPtr notification =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
-
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
smart_objects::SmartObject& message = *notification;
message[strings::params][strings::function_id] =
hmi_apis::FunctionID::BasicCommunication_OnPutFile;
-
message[strings::params][strings::message_type] = MessageType::kNotification;
message[strings::msg_params][strings::app_id] = connection_key();
message[strings::msg_params][strings::sync_file_name] = sync_file_name_;
message[strings::msg_params][strings::offset] = offset_;
- if (0 == offset_) {
- message[strings::msg_params][strings::file_size] =
- (*message_)[strings::msg_params][strings::length];
+ if (0 == offset_ &&
+ !(*message_)[strings::msg_params].keyExists(strings::length)) {
+ message[strings::msg_params][strings::file_size] = length_;
}
message[strings::msg_params][strings::length] = length_;
message[strings::msg_params][strings::persistent_file] = is_persistent_file_;
message[strings::msg_params][strings::file_type] = file_type_;
+ message[strings::msg_params][strings::is_system_file] = is_system_file;
rpc_service_.ManageHMICommand(notification);
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc
index 8c54970a5c..f9ddbf7717 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_response.cc
@@ -32,8 +32,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/put_file_response.h"
-#include "utils/file_system.h"
#include "application_manager/application_impl.h"
+#include "utils/file_system.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -70,4 +70,4 @@ void PutFileResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
index 20924736f8..56d9fa3298 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
@@ -33,21 +33,24 @@
#include "sdl_rpc_plugin/commands/mobile/register_app_interface_request.h"
+#include <string.h>
#include <unistd.h>
#include <algorithm>
#include <map>
-#include <string.h>
-#include <utils/make_shared.h>
#include "utils/scope_guard.h"
#include "application_manager/application_manager.h"
#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/application_impl.h"
#include "application_manager/app_launch/app_launch_ctrl.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/helpers/application_helper.h"
#include "application_manager/message_helper.h"
-#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/plugin_manager/plugin_keys.h"
#include "application_manager/policies/policy_handler.h"
-#include "application_manager/helpers/application_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/rpc_service.h"
#include "config_profile/profile.h"
#include "interfaces/MOBILE_API.h"
@@ -160,15 +163,16 @@ class SmartArrayValueExtractor {
};
struct IsSameNickname {
- IsSameNickname(const custom_str::CustomString& app_id) : app_id_(app_id) {}
+ IsSameNickname(const custom_str::CustomString app_name)
+ : app_name_(app_name) {}
bool operator()(const policy::StringArray::value_type& nickname) const {
- return app_id_.CompareIgnoreCase(nickname.c_str());
+ return app_name_.CompareIgnoreCase(nickname.c_str());
}
private:
- const custom_str::CustomString& app_id_;
+ const custom_str::CustomString app_name_;
};
-}
+} // namespace
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -186,7 +190,8 @@ RegisterAppInterfaceRequest::RegisterAppInterfaceRequest(
rpc_service,
hmi_capabilities,
policy_handler)
- , result_code_(mobile_apis::Result::INVALID_ENUM) {}
+ , result_code_(mobile_apis::Result::INVALID_ENUM)
+ , device_handle_(0) {}
RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {}
@@ -226,15 +231,33 @@ void RegisterAppInterfaceRequest::Run() {
return;
}
- if (IsApplicationSwitched()) {
+ // Cache the original app ID (for legacy behavior)
+ const auto policy_app_id =
+ application_manager_.GetCorrectMobileIDFromMessage(message_);
+
+ if (application_manager_.IsApplicationForbidden(connection_key(),
+ policy_app_id)) {
+ SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS);
return;
}
- const std::string mobile_app_id =
- (*message_)[strings::msg_params][strings::app_id].asString();
+ if (!GetDataOnSessionKey(connection_key(), &device_handle_, &device_id_)) {
+ SendResponse(false,
+ mobile_apis::Result::GENERIC_ERROR,
+ "Could not find a session for your connection key!");
+ return;
+ }
+
+ LOG4CXX_DEBUG(
+ logger_,
+ "device_handle: " << device_handle_ << " device_id: " << device_id_);
+
+ if (IsApplicationSwitched()) {
+ return;
+ }
ApplicationSharedPtr application =
- application_manager_.application(connection_key());
+ application_manager_.application(device_id_, policy_app_id);
if (application) {
SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY);
@@ -244,18 +267,23 @@ void RegisterAppInterfaceRequest::Run() {
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
- const std::string policy_app_id = msg_params[strings::app_id].asString();
- std::string new_policy_app_id = policy_app_id;
- std::transform(policy_app_id.begin(),
- policy_app_id.end(),
- new_policy_app_id.begin(),
+ // transform app IDs to lowercase for usage in policy checks later
+ const std::string app_id_short = msg_params[strings::app_id].asString();
+ std::string new_app_id_short = app_id_short;
+ std::transform(app_id_short.begin(),
+ app_id_short.end(),
+ new_app_id_short.begin(),
::tolower);
- (*message_)[strings::msg_params][strings::app_id] = new_policy_app_id;
-
- if (application_manager_.IsApplicationForbidden(connection_key(),
- policy_app_id)) {
- SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS);
- return;
+ (*message_)[strings::msg_params][strings::app_id] = new_app_id_short;
+ // If full ID is present, shift that to lowercase too
+ if (msg_params.keyExists(strings::full_app_id)) {
+ const std::string app_id_full = msg_params[strings::full_app_id].asString();
+ std::string new_app_id_full = app_id_full;
+ std::transform(app_id_full.begin(),
+ app_id_full.end(),
+ new_app_id_full.begin(),
+ ::tolower);
+ (*message_)[strings::msg_params][strings::full_app_id] = new_app_id_full;
}
if (IsApplicationWithSameAppIdRegistered()) {
@@ -275,15 +303,76 @@ void RegisterAppInterfaceRequest::Run() {
mobile_apis::Result::eType coincidence_result = CheckCoincidence();
+ std::vector<ApplicationSharedPtr> duplicate_apps;
+ if (GetDuplicateNames(duplicate_apps)) {
+ LOG4CXX_ERROR(logger_,
+ "Found duplicate app names, checking for hybrid apps.");
+ // Default preference to BOTH
+ mobile_apis::HybridAppPreference::eType preference =
+ mobile_apis::HybridAppPreference::BOTH;
+ ApplicationSharedPtr app =
+ application_manager_.pending_application_by_policy_id(policy_app_id);
+ bool is_cloud_app = app.use_count() != 0 && app->is_cloud_app();
+ if (is_cloud_app) {
+ // Retrieve hybrid app preference from registering app
+ preference = app->hybrid_app_preference();
+ } else {
+ if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) {
+ usage_statistics::AppCounter count_of_rejections_duplicate_name(
+ GetPolicyHandler().GetStatisticManager(),
+ policy_app_id,
+ usage_statistics::REJECTIONS_DUPLICATE_NAME);
+ ++count_of_rejections_duplicate_name;
+ }
+ // Search for the hybrid app preference in the duplicate app list
+ for (auto duplicate_app : duplicate_apps) {
+ if (duplicate_app->is_cloud_app()) {
+ preference = duplicate_app->hybrid_app_preference();
+ break;
+ }
+ }
+ }
+
+ if (preference == mobile_apis::HybridAppPreference::MOBILE ||
+ preference == mobile_apis::HybridAppPreference::CLOUD) {
+ bool cloud_app_exists = is_cloud_app;
+ bool mobile_app_exists = !is_cloud_app;
+ for (auto duplicate_app : duplicate_apps) {
+ cloud_app_exists = cloud_app_exists || (duplicate_app->IsRegistered() &&
+ duplicate_app->is_cloud_app());
+ mobile_app_exists = mobile_app_exists || !duplicate_app->is_cloud_app();
+ if (is_cloud_app && !duplicate_app->is_cloud_app() &&
+ preference == mobile_apis::HybridAppPreference::CLOUD) {
+ // Unregister mobile application and allow cloud application to
+ // register in it's place
+ LOG4CXX_ERROR(
+ logger_,
+ "Unregistering app because a preferred version is registered.");
+ application_manager_.UnregisterApplication(
+ duplicate_app->app_id(),
+ mobile_apis::Result::USER_DISALLOWED,
+ "App is disabled by user preferences");
+ }
+ }
+
+ bool mobile_app_matches =
+ !is_cloud_app &&
+ preference == mobile_apis::HybridAppPreference::MOBILE;
+ bool cloud_app_matches =
+ is_cloud_app && preference == mobile_apis::HybridAppPreference::CLOUD;
+
+ bool is_preferred_application = mobile_app_matches || cloud_app_matches;
+ if (mobile_app_exists && cloud_app_exists && !is_preferred_application) {
+ SendResponse(false,
+ mobile_apis::Result::USER_DISALLOWED,
+ "App is disabled by user preferences");
+ return;
+ }
+ }
+ }
+
if (mobile_apis::Result::SUCCESS != coincidence_result) {
LOG4CXX_ERROR(logger_, "Coincidence check failed.");
- if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) {
- usage_statistics::AppCounter count_of_rejections_duplicate_name(
- GetPolicyHandler().GetStatisticManager(),
- policy_app_id,
- usage_statistics::REJECTIONS_DUPLICATE_NAME);
- ++count_of_rejections_duplicate_name;
- }
SendResponse(false, coincidence_result);
return;
}
@@ -295,23 +384,47 @@ void RegisterAppInterfaceRequest::Run() {
return;
}
+ uint16_t major =
+ msg_params[strings::sync_msg_version][strings::major_version].asUInt();
+ uint16_t minor =
+ msg_params[strings::sync_msg_version][strings::minor_version].asUInt();
+ uint16_t patch = 0;
+ // Check if patch exists since it is not mandatory.
+ if (msg_params[strings::sync_msg_version].keyExists(strings::patch_version)) {
+ patch =
+ msg_params[strings::sync_msg_version][strings::patch_version].asUInt();
+ }
+
+ utils::SemanticVersion mobile_version(major, minor, patch);
+ utils::SemanticVersion min_module_version(
+ minimum_major_version, minimum_minor_version, minimum_patch_version);
+
+ if (mobile_version < min_module_version) {
+ LOG4CXX_WARN(logger_,
+ "Application RPC Version does not meet minimum requirement");
+ SendResponse(false, mobile_apis::Result::REJECTED);
+ }
+
application = application_manager_.RegisterApplication(message_);
if (!application) {
LOG4CXX_ERROR(logger_, "Application hasn't been registered!");
return;
}
- // For resuming application need to restore hmi_app_id from resumeCtrl
- resumption::ResumeCtrl& resumer = application_manager_.resume_controller();
- const std::string& device_mac = application->mac_address();
- // there is side affect with 2 mobile app with the same mobile app_id
- if (resumer.IsApplicationSaved(policy_app_id, device_mac)) {
- application->set_hmi_application_id(
- resumer.GetHMIApplicationID(policy_app_id, device_mac));
+ // Version negotiation
+ utils::SemanticVersion module_version(
+ major_version, minor_version, patch_version);
+ if (mobile_version < utils::rpc_version_5) {
+ // Mobile versioning did not exist for
+ // versions before 5.0
+ application->set_msg_version(utils::base_rpc_version);
+ } else if (mobile_version < module_version) {
+ // Use mobile RPC version as negotiated version
+ application->set_msg_version(mobile_version);
} else {
- application->set_hmi_application_id(
- application_manager_.GenerateNewHMIAppID());
+ // Use module version as negotiated version
+ application->set_msg_version(module_version);
}
application->set_is_media_application(
@@ -334,9 +447,9 @@ void RegisterAppInterfaceRequest::Run() {
tts_name, application, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_WARN(logger_,
- "MessageHelper::VerifyTtsFiles return "
- << verification_result);
+ LOG4CXX_WARN(
+ logger_,
+ "MessageHelper::VerifyTtsFiles return " << verification_result);
response_info_ = "One or more files needed for tts_name are not present";
result_code_ = mobile_apis::Result::WARNINGS;
}
@@ -377,6 +490,12 @@ void RegisterAppInterfaceRequest::Run() {
}
}
+ auto on_app_registered = [application](plugin_manager::RPCPlugin& plugin) {
+ plugin.OnApplicationEvent(plugin_manager::kApplicationRegistered,
+ application);
+ };
+ application_manager_.ApplyFunctorForEachPlugin(on_app_registered);
+
if (msg_params.keyExists(strings::day_color_scheme)) {
application->set_day_color_scheme(msg_params[strings::day_color_scheme]);
}
@@ -388,17 +507,16 @@ void RegisterAppInterfaceRequest::Run() {
// Add device to policy table and set device info, if any
policy::DeviceParams dev_params;
- if (-1 ==
- application_manager_.connection_handler()
- .get_session_observer()
- .GetDataOnDeviceID(application->device(),
- &dev_params.device_name,
- NULL,
- &dev_params.device_mac_address,
- &dev_params.device_connection_type)) {
- LOG4CXX_ERROR(logger_,
- "Failed to extract information for device "
- << application->device());
+ if (-1 == application_manager_.connection_handler()
+ .get_session_observer()
+ .GetDataOnDeviceID(application->device(),
+ &dev_params.device_name,
+ NULL,
+ &dev_params.device_mac_address,
+ &dev_params.device_connection_type)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Failed to extract information for device " << application->device());
}
policy::DeviceInfo device_info;
device_info.AdoptDeviceType(dev_params.device_connection_type);
@@ -406,12 +524,18 @@ void RegisterAppInterfaceRequest::Run() {
FillDeviceInfo(&device_info);
}
+ const std::string& device_mac = application->mac_address();
+
GetPolicyHandler().SetDeviceInfo(device_mac, device_info);
SendRegisterAppInterfaceResponseToMobile(ApplicationType::kNewApplication);
smart_objects::SmartObjectSPtr so =
GetLockScreenIconUrlNotification(connection_key(), application);
rpc_service_.ManageMobileCommand(so, SOURCE_SDL);
+ application_manager_.SendDriverDistractionState(application);
+ // Create onSystemRequest to mobile to obtain cloud app icons
+ application_manager_.SendGetIconUrlNotifications(connection_key(),
+ application);
}
smart_objects::SmartObjectSPtr
@@ -419,7 +543,7 @@ RegisterAppInterfaceRequest::GetLockScreenIconUrlNotification(
const uint32_t connection_key, ApplicationSharedPtr app) {
DCHECK_OR_RETURN(app.get(), smart_objects::SmartObjectSPtr());
smart_objects::SmartObjectSPtr message =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
mobile_apis::FunctionID::OnSystemRequestID;
@@ -431,37 +555,37 @@ RegisterAppInterfaceRequest::GetLockScreenIconUrlNotification(
(*message)[strings::msg_params][strings::request_type] =
mobile_apis::RequestType::LOCK_SCREEN_ICON_URL;
(*message)[strings::msg_params][strings::url] =
- GetPolicyHandler().GetLockScreenIconUrl();
+ GetPolicyHandler().GetLockScreenIconUrl(app->policy_app_id());
return message;
}
void FillVRRelatedFields(smart_objects::SmartObject& response_params,
const HMICapabilities& hmi_capabilities) {
response_params[strings::language] = hmi_capabilities.active_vr_language();
- if (hmi_capabilities.vr_capabilities()) {
- response_params[strings::vr_capabilities] =
- *hmi_capabilities.vr_capabilities();
+ auto vr_capabilities = hmi_capabilities.vr_capabilities();
+ if (vr_capabilities) {
+ response_params[strings::vr_capabilities] = *vr_capabilities;
}
}
void FillVIRelatedFields(smart_objects::SmartObject& response_params,
const HMICapabilities& hmi_capabilities) {
- if (hmi_capabilities.vehicle_type()) {
- response_params[hmi_response::vehicle_type] =
- *hmi_capabilities.vehicle_type();
+ auto vehicle_type = hmi_capabilities.vehicle_type();
+ if (vehicle_type) {
+ response_params[hmi_response::vehicle_type] = *vehicle_type;
}
}
void FillTTSRelatedFields(smart_objects::SmartObject& response_params,
const HMICapabilities& hmi_capabilities) {
response_params[strings::language] = hmi_capabilities.active_tts_language();
- if (hmi_capabilities.speech_capabilities()) {
- response_params[strings::speech_capabilities] =
- *hmi_capabilities.speech_capabilities();
+ auto speech_capabilities = hmi_capabilities.speech_capabilities();
+ if (speech_capabilities) {
+ response_params[strings::speech_capabilities] = *speech_capabilities;
}
- if (hmi_capabilities.prerecorded_speech()) {
- response_params[strings::prerecorded_speech] =
- *(hmi_capabilities.prerecorded_speech());
+ auto prerecorded_speech = hmi_capabilities.prerecorded_speech();
+ if (prerecorded_speech) {
+ response_params[strings::prerecorded_speech] = *prerecorded_speech;
}
}
@@ -469,88 +593,70 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params,
const HMICapabilities& hmi_capabilities) {
response_params[strings::hmi_display_language] =
hmi_capabilities.active_ui_language();
- if (hmi_capabilities.display_capabilities()) {
+
+ auto display_capabilities = hmi_capabilities.display_capabilities();
+ if (display_capabilities) {
response_params[hmi_response::display_capabilities] =
smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& display_caps =
response_params[hmi_response::display_capabilities];
- if (hmi_capabilities.display_capabilities()->keyExists(
- hmi_response::display_type)) {
+ if (display_capabilities->keyExists(hmi_response::display_type)) {
display_caps[hmi_response::display_type] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::display_type);
+ display_capabilities->getElement(hmi_response::display_type);
}
- if (hmi_capabilities.display_capabilities()->keyExists(
- hmi_response::display_name)) {
+ if (display_capabilities->keyExists(hmi_response::display_name)) {
display_caps[hmi_response::display_name] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::display_name);
+ display_capabilities->getElement(hmi_response::display_name);
}
- if (hmi_capabilities.display_capabilities()->keyExists(
- hmi_response::text_fields)) {
+ if (display_capabilities->keyExists(hmi_response::text_fields)) {
display_caps[hmi_response::text_fields] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::text_fields);
+ display_capabilities->getElement(hmi_response::text_fields);
}
- if (hmi_capabilities.display_capabilities()->keyExists(
- hmi_response::image_fields)) {
+ if (display_capabilities->keyExists(hmi_response::image_fields)) {
display_caps[hmi_response::image_fields] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::image_fields);
+ display_capabilities->getElement(hmi_response::image_fields);
}
- if (hmi_capabilities.display_capabilities()->keyExists(
- hmi_response::media_clock_formats)) {
+ if (display_capabilities->keyExists(hmi_response::media_clock_formats)) {
display_caps[hmi_response::media_clock_formats] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::media_clock_formats);
+ display_capabilities->getElement(hmi_response::media_clock_formats);
}
- if (hmi_capabilities.display_capabilities()->keyExists(
- hmi_response::templates_available)) {
+ if (display_capabilities->keyExists(hmi_response::templates_available)) {
display_caps[hmi_response::templates_available] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::templates_available);
+ display_capabilities->getElement(hmi_response::templates_available);
}
- if (hmi_capabilities.display_capabilities()->keyExists(
- hmi_response::screen_params)) {
+ if (display_capabilities->keyExists(hmi_response::screen_params)) {
display_caps[hmi_response::screen_params] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::screen_params);
+ display_capabilities->getElement(hmi_response::screen_params);
}
- if (hmi_capabilities.display_capabilities()->keyExists(
+ if (display_capabilities->keyExists(
hmi_response::num_custom_presets_available)) {
display_caps[hmi_response::num_custom_presets_available] =
- hmi_capabilities.display_capabilities()->getElement(
+ display_capabilities->getElement(
hmi_response::num_custom_presets_available);
}
- if (hmi_capabilities.display_capabilities()->keyExists(
- hmi_response::image_capabilities)) {
+ if (display_capabilities->keyExists(hmi_response::image_capabilities)) {
display_caps[hmi_response::graphic_supported] =
- (hmi_capabilities.display_capabilities()
- ->getElement(hmi_response::image_capabilities)
+ (display_capabilities->getElement(hmi_response::image_capabilities)
.length() > 0);
}
}
- if (hmi_capabilities.audio_pass_thru_capabilities()) {
- if (smart_objects::SmartType_Array ==
- hmi_capabilities.audio_pass_thru_capabilities()->getType()) {
- // hmi_capabilities json contains array and HMI response object
- response_params[strings::audio_pass_thru_capabilities] =
- *hmi_capabilities.audio_pass_thru_capabilities();
- } else {
- response_params[strings::audio_pass_thru_capabilities][0] =
- *hmi_capabilities.audio_pass_thru_capabilities();
- }
+ auto audio_pass_thru_capabilities =
+ hmi_capabilities.audio_pass_thru_capabilities();
+ if (audio_pass_thru_capabilities) {
+ // hmi_capabilities json contains array and HMI response object
+ response_params[strings::audio_pass_thru_capabilities] =
+ *audio_pass_thru_capabilities;
}
response_params[strings::hmi_capabilities] =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -562,6 +668,11 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params,
hmi_capabilities.video_streaming_supported();
response_params[strings::hmi_capabilities][strings::remote_control] =
hmi_capabilities.rc_supported();
+ response_params[strings::hmi_capabilities][strings::app_services] = true;
+ // Apps are automatically subscribed to the SystemCapability: DISPLAYS
+ response_params[strings::hmi_capabilities][strings::displays] = true;
+ response_params[strings::hmi_capabilities][strings::seat_location] =
+ hmi_capabilities.seat_location_capability() ? true : false;
}
void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
@@ -586,12 +697,14 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
return;
}
+ utils::SemanticVersion negotiated_version = application->msg_version();
+
response_params[strings::sync_msg_version][strings::major_version] =
- major_version; // From generated file interfaces/generated_msg_version.h
+ negotiated_version.major_version_;
response_params[strings::sync_msg_version][strings::minor_version] =
- minor_version; // From generated file interfaces/generated_msg_version.h
+ negotiated_version.minor_version_;
response_params[strings::sync_msg_version][strings::patch_version] =
- patch_version; // From generated file interfaces/generated_msg_version.h
+ negotiated_version.patch_version_;
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
@@ -641,36 +754,39 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
FillVIRelatedFields(response_params, hmi_capabilities);
}
- if (hmi_capabilities.button_capabilities()) {
- response_params[hmi_response::button_capabilities] =
- *hmi_capabilities.button_capabilities();
+ auto button_capabilities = hmi_capabilities.button_capabilities();
+ if (button_capabilities) {
+ response_params[hmi_response::button_capabilities] = *button_capabilities;
}
- if (hmi_capabilities.soft_button_capabilities()) {
+ auto soft_button_capabilities = hmi_capabilities.soft_button_capabilities();
+ if (soft_button_capabilities) {
response_params[hmi_response::soft_button_capabilities] =
- *hmi_capabilities.soft_button_capabilities();
+ *soft_button_capabilities;
}
- if (hmi_capabilities.preset_bank_capabilities()) {
+ auto preset_bank_capabilities = hmi_capabilities.preset_bank_capabilities();
+ if (preset_bank_capabilities) {
response_params[hmi_response::preset_bank_capabilities] =
- *hmi_capabilities.preset_bank_capabilities();
+ *preset_bank_capabilities;
}
- if (hmi_capabilities.hmi_zone_capabilities()) {
- if (smart_objects::SmartType_Array ==
- hmi_capabilities.hmi_zone_capabilities()->getType()) {
+ auto hmi_zone_capabilities = hmi_capabilities.hmi_zone_capabilities();
+ if (hmi_zone_capabilities) {
+ if (smart_objects::SmartType_Array == hmi_zone_capabilities->getType()) {
// hmi_capabilities json contains array and HMI response object
response_params[hmi_response::hmi_zone_capabilities] =
- *hmi_capabilities.hmi_zone_capabilities();
+ *hmi_zone_capabilities;
} else {
response_params[hmi_response::hmi_zone_capabilities][0] =
- *hmi_capabilities.hmi_zone_capabilities();
+ *hmi_zone_capabilities;
}
}
- if (hmi_capabilities.pcm_stream_capabilities()) {
+ auto pcm_stream_capabilities = hmi_capabilities.pcm_stream_capabilities();
+ if (pcm_stream_capabilities) {
response_params[strings::pcm_stream_capabilities] =
- *hmi_capabilities.pcm_stream_capabilities();
+ *pcm_stream_capabilities;
}
const std::vector<uint32_t>& diag_modes =
@@ -712,15 +828,16 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
return;
}
- bool resumption =
+ const bool hash_id_present =
(*message_)[strings::msg_params].keyExists(strings::hash_id);
+ const std::string hash_id =
+ (*message_)[strings::msg_params][strings::hash_id].asString();
+ const bool resumption = hash_id_present && !hash_id.empty();
bool need_restore_vr = resumption;
- std::string hash_id;
std::string add_info;
if (resumption) {
- hash_id = (*message_)[strings::msg_params][strings::hash_id].asString();
if (!resumer.CheckApplicationHash(application, hash_id)) {
LOG4CXX_WARN(logger_,
"Hash from RAI does not match to saved resume data.");
@@ -734,6 +851,8 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
need_restore_vr = false;
} else {
add_info = "Resume succeeded.";
+ application->set_app_data_resumption_allowance(true);
+ application->set_is_resuming(true);
}
}
if ((mobile_apis::Result::SUCCESS == result_code) &&
@@ -742,10 +861,18 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
result_code = result_code_;
}
- // in case application exist in resumption we need to send resumeVrgrammars
- if (false == resumption) {
- resumption = resumer.IsApplicationSaved(application->policy_app_id(),
- application->mac_address());
+ // In case application exist in resumption we need to send resumeVrgrammars
+ const bool is_app_saved_in_resumption = resumer.IsApplicationSaved(
+ application->policy_app_id(), application->mac_address());
+
+ // If app is in resuming state
+ // DisplayCapabilitiesBuilder has to collect all the information
+ // from incoming HMI notifications and send only one notification
+ // to mobile app, even if hash does not match, which means that app data
+ // will not be resumed, notification should be sent for default window as
+ // it will be resumed in any case
+ if (resumption || is_app_saved_in_resumption) {
+ resumer.StartWaitingForDisplayCapabilitiesUpdate(application);
}
AppHmiTypes hmi_types;
@@ -762,12 +889,17 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
}
}
policy::StatusNotifier notify_upd_manager = GetPolicyHandler().AddApplication(
- application->policy_app_id(), hmi_types);
+ application->mac_address(), application->policy_app_id(), hmi_types);
response_params[strings::icon_resumed] =
file_system::FileExists(application->app_icon_path());
SendResponse(true, result_code, add_info.c_str(), &response_params);
+ if (msg_params.keyExists(strings::app_hmi_type)) {
+ GetPolicyHandler().SetDefaultHmiTypes(application->device(),
+ application->policy_app_id(),
+ &(msg_params[strings::app_hmi_type]));
+ }
{
utils::ScopeGuard setup_flag_clearer = utils::MakeObjGuard(
@@ -779,26 +911,29 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
// triggered. It is cleared once we get out of the sclope.
application->SetSetupInProgress(true);
- SendOnAppRegisteredNotificationToHMI(
- *(application.get()), resumption, need_restore_vr);
- if (msg_params.keyExists(strings::app_hmi_type)) {
- GetPolicyHandler().SetDefaultHmiTypes(
- application->policy_app_id(), &(msg_params[strings::app_hmi_type]));
- }
-
// Default HMI level should be set before any permissions validation, since
// it relies on HMI level.
application_manager_.OnApplicationRegistered(application);
+
+ auto send_rc_status = [application](plugin_manager::RPCPlugin& plugin) {
+ plugin.OnApplicationEvent(plugin_manager::kRCStatusChanged, application);
+ };
+ application_manager_.ApplyFunctorForEachPlugin(send_rc_status);
+
+ SendOnAppRegisteredNotificationToHMI(
+ application, resumption, need_restore_vr);
(*notify_upd_manager)();
// Start PTU after successfull registration
// Sends OnPermissionChange notification to mobile right after RAI response
// and HMI level set-up
- GetPolicyHandler().OnAppRegisteredOnMobile(application->policy_app_id());
+ GetPolicyHandler().OnAppRegisteredOnMobile(application->mac_address(),
+ application->policy_app_id());
- if (result_code != mobile_apis::Result::RESUME_FAILED) {
+ if (result_code != mobile_apis::Result::RESUME_FAILED &&
+ application->is_app_data_resumption_allowed()) {
resumer.StartResumption(application, hash_id);
- } else {
+ } else if (is_app_saved_in_resumption) {
resumer.StartResumptionOnlyHMILevel(application);
}
}
@@ -808,11 +943,6 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
SendChangeRegistrationOnHMI(application);
}
-DEPRECATED void
-RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
- SendRegisterAppInterfaceResponseToMobile(ApplicationType::kNewApplication);
-}
-
void RegisterAppInterfaceRequest::SendChangeRegistration(
const hmi_apis::FunctionID::eType function_id,
const int32_t language,
@@ -846,11 +976,9 @@ void RegisterAppInterfaceRequest::SendChangeRegistrationOnHMI(
}
void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI(
- const app_mngr::Application& application_impl,
- bool resumption,
- bool need_restore_vr) {
+ ApplicationConstSharedPtr app, bool resumption, bool need_restore_vr) {
using namespace smart_objects;
- SmartObjectSPtr notification = utils::MakeShared<SmartObject>(SmartType_Map);
+ SmartObjectSPtr notification = std::make_shared<SmartObject>(SmartType_Map);
if (!notification) {
LOG4CXX_ERROR(logger_, "Failed to create smart object");
return;
@@ -872,15 +1000,15 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI(
msg_params[strings::resume_vr_grammars] = need_restore_vr;
}
- if (application_impl.vr_synonyms()) {
- msg_params[strings::vr_synonyms] = *(application_impl.vr_synonyms());
+ if (app->vr_synonyms()) {
+ msg_params[strings::vr_synonyms] = *(app->vr_synonyms());
}
- if (application_impl.tts_name()) {
- msg_params[strings::tts_name] = *(application_impl.tts_name());
+ if (app->tts_name()) {
+ msg_params[strings::tts_name] = *(app->tts_name());
}
- const std::string policy_app_id = application_impl.policy_app_id();
+ const std::string policy_app_id = app->policy_app_id();
std::string priority;
GetPolicyHandler().GetPriority(policy_app_id, &priority);
@@ -890,104 +1018,13 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI(
msg_params[strings::msg_params] = SmartObject(SmartType_Map);
smart_objects::SmartObject& application = msg_params[strings::application];
- application[strings::app_name] = application_impl.name();
- application[strings::app_id] = application_impl.app_id();
- application[hmi_response::policy_app_id] = policy_app_id;
- if (file_system::FileExists(application_impl.app_icon_path())) {
- application[strings::icon] = application_impl.app_icon_path();
- }
-
- const smart_objects::SmartObject* ngn_media_screen_name =
- application_impl.ngn_media_screen_name();
- if (ngn_media_screen_name) {
- application[strings::ngn_media_screen_app_name] = *ngn_media_screen_name;
- }
-
- application[strings::hmi_display_language_desired] =
- static_cast<int32_t>(application_impl.ui_language());
-
- application[strings::is_media_application] =
- application_impl.is_media_application();
-
- const smart_objects::SmartObject* app_type = application_impl.app_types();
- if (app_type) {
- application[strings::app_type] = *app_type;
- }
-
- const policy::RequestType::State app_request_types_state =
- GetPolicyHandler().GetAppRequestTypeState(policy_app_id);
- if (policy::RequestType::State::AVAILABLE == app_request_types_state) {
- const auto request_types =
- GetPolicyHandler().GetAppRequestTypes(policy_app_id);
- application[strings::request_type] = SmartObject(SmartType_Array);
- smart_objects::SmartObject& request_types_array =
- application[strings::request_type];
-
- size_t index = 0;
- for (auto it : request_types) {
- request_types_array[index] = it;
- ++index;
- }
- } else if (policy::RequestType::State::EMPTY == app_request_types_state) {
- application[strings::request_type] = SmartObject(SmartType_Array);
- }
-
- const policy::RequestSubType::State app_request_subtypes_state =
- GetPolicyHandler().GetAppRequestSubTypeState(policy_app_id);
- if (policy::RequestSubType::State::AVAILABLE == app_request_subtypes_state) {
- const auto request_subtypes =
- GetPolicyHandler().GetAppRequestSubTypes(policy_app_id);
- application[strings::request_subtype] = SmartObject(SmartType_Array);
- smart_objects::SmartObject& request_subtypes_array =
- application[strings::request_subtype];
-
- size_t index = 0;
- for (auto it : request_subtypes) {
- request_subtypes_array[index] = it;
- ++index;
- }
- } else if (policy::RequestSubType::State::EMPTY ==
- app_request_subtypes_state) {
- application[strings::request_subtype] = SmartObject(SmartType_Array);
- }
-
- application[strings::device_info] = SmartObject(SmartType_Map);
- smart_objects::SmartObject& device_info = application[strings::device_info];
const protocol_handler::SessionObserver& session_observer =
application_manager_.connection_handler().get_session_observer();
- std::string device_name;
- std::string mac_address;
- std::string transport_type;
- const connection_handler::DeviceHandle handle = application_impl.device();
- if (-1 ==
- session_observer.GetDataOnDeviceID(
- handle, &device_name, NULL, &mac_address, &transport_type)) {
- LOG4CXX_ERROR(logger_,
- "Failed to extract information for device " << handle);
- }
-
- device_info[strings::name] = device_name;
- device_info[strings::id] = mac_address;
-
- const policy::DeviceConsent device_consent =
- GetPolicyHandler().GetUserConsentForDevice(mac_address);
- device_info[strings::isSDLAllowed] =
- policy::DeviceConsent::kDeviceAllowed == device_consent;
-
- device_info[strings::transport_type] =
- application_manager_.GetDeviceTransportType(transport_type);
-
- const smart_objects::SmartObject* day_color_scheme =
- application_impl.day_color_scheme();
- if (day_color_scheme) {
- application[strings::day_color_scheme] = *day_color_scheme;
- }
-
- const smart_objects::SmartObject* night_color_scheme =
- application_impl.night_color_scheme();
- if (night_color_scheme) {
- application[strings::night_color_scheme] = *night_color_scheme;
- }
+ MessageHelper::CreateHMIApplicationStruct(app,
+ session_observer,
+ GetPolicyHandler(),
+ &application,
+ application_manager_);
DCHECK(rpc_service_.ManageHMICommand(notification));
}
@@ -997,24 +1034,30 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
- ApplicationSet accessor = application_manager_.applications().GetData();
+ auto compare_tts_name = [](const smart_objects::SmartObject& obj_1,
+ const smart_objects::SmartObject& obj_2) {
+ return obj_1[application_manager::strings::text]
+ .asCustomString()
+ .CompareIgnoreCase(
+ obj_2[application_manager::strings::text].asCustomString());
+ };
- ApplicationSetConstIt it = accessor.begin();
- const custom_str::CustomString& app_name =
- msg_params[strings::app_name].asCustomString();
+ const auto& accessor = application_manager_.applications().GetData();
+ const auto& app_name = msg_params[strings::app_name].asCustomString();
- for (; accessor.end() != it; ++it) {
- // name check
- const custom_str::CustomString& cur_name = (*it)->name();
+ for (const auto& app : accessor) {
+ if (app->device() != device_handle_) {
+ continue;
+ }
+ // Name check
+ const auto& cur_name = app->name();
if (app_name.CompareIgnoreCase(cur_name)) {
LOG4CXX_ERROR(logger_, "Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
}
-
- const smart_objects::SmartObject* vr = (*it)->vr_synonyms();
- const std::vector<smart_objects::SmartObject>* curr_vr = NULL;
- if (NULL != vr) {
- curr_vr = vr->asArray();
+ const auto vr = app->vr_synonyms();
+ if (vr) {
+ const auto curr_vr = vr->asArray();
CoincidencePredicateVR v(app_name);
if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) {
@@ -1023,23 +1066,76 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
}
}
- // vr check
+ // VR check
if (msg_params.keyExists(strings::vr_synonyms)) {
- const std::vector<smart_objects::SmartObject>* new_vr =
- msg_params[strings::vr_synonyms].asArray();
+ const auto new_vr = msg_params[strings::vr_synonyms].asArray();
CoincidencePredicateVR v(cur_name);
if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) {
LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name .");
return mobile_apis::Result::DUPLICATE_NAME;
}
- } // end vr check
+ } // End vr check
+
+ // TTS check
+ if (msg_params.keyExists(strings::tts_name) && app->tts_name()) {
+ const auto tts_array = msg_params[strings::tts_name].asArray();
+ const auto tts_curr = app->tts_name()->asArray();
+ const auto& it_tts = std::find_first_of(tts_array->begin(),
+ tts_array->end(),
+ tts_curr->begin(),
+ tts_curr->end(),
+ compare_tts_name);
+ if (it_tts != tts_array->end()) {
+ LOG4CXX_ERROR(
+ logger_,
+ "TTS name: "
+ << (*it_tts)[strings::text].asCustomString().AsMBString()
+ << " is known already");
+ return mobile_apis::Result::DUPLICATE_NAME;
+ }
+ } // End tts check
- } // application for end
+ } // Application for end
return mobile_apis::Result::SUCCESS;
} // method end
+bool RegisterAppInterfaceRequest::GetDuplicateNames(
+ std::vector<ApplicationSharedPtr>& out_duplicate_apps) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject& msg_params =
+ (*message_)[strings::msg_params];
+
+ const auto& app_name = msg_params[strings::app_name].asCustomString();
+ {
+ const auto& accessor = application_manager_.applications().GetData();
+
+ for (const auto& app : accessor) {
+ const auto& cur_name = app->name();
+ if (app_name.CompareIgnoreCase(cur_name)) {
+ out_duplicate_apps.push_back(app);
+ }
+ }
+ }
+
+ const std::string policy_app_id =
+ application_manager_.GetCorrectMobileIDFromMessage(message_);
+ {
+ const auto& accessor =
+ application_manager_.pending_applications().GetData();
+
+ for (const auto& app : accessor) {
+ const auto& cur_name = app->name();
+ if (app_name.CompareIgnoreCase(cur_name) &&
+ policy_app_id != app->policy_app_id()) {
+ out_duplicate_apps.push_back(app);
+ }
+ }
+ }
+ return !out_duplicate_apps.empty();
+}
+
mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
LOG4CXX_AUTO_TRACE(logger_);
// TODO(AOleynik): Check is necessary to allow register application in case
@@ -1054,7 +1150,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
policy::StringArray app_hmi_types;
const std::string mobile_app_id =
- message[strings::msg_params][strings::app_id].asString();
+ application_manager_.GetCorrectMobileIDFromMessage(message_);
const bool init_result = GetPolicyHandler().GetInitialAppData(
mobile_app_id, &app_nicknames, &app_hmi_types);
@@ -1158,17 +1254,22 @@ void RegisterAppInterfaceRequest::FillDeviceInfo(
bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
LOG4CXX_AUTO_TRACE(logger_);
- const custom_string::CustomString mobile_app_id =
- (*message_)[strings::msg_params][strings::app_id].asCustomString();
-
- const ApplicationSet& applications =
- application_manager_.applications().GetData();
-
- ApplicationSetConstIt it = applications.begin();
- ApplicationSetConstIt it_end = applications.end();
-
- for (; it != it_end; ++it) {
- if (mobile_app_id.CompareIgnoreCase((*it)->policy_app_id().c_str())) {
+ const custom_string::CustomString mobile_app_id(
+ application_manager_.GetCorrectMobileIDFromMessage(message_));
+
+ const auto& applications = application_manager_.applications().GetData();
+
+ for (const auto& app : applications) {
+ if (mobile_app_id.CompareIgnoreCase(app->policy_app_id().c_str())) {
+ if (app->device() != device_handle_) {
+ LOG4CXX_DEBUG(logger_,
+ "These policy_app_id equal, but applications have "
+ "different device id"
+ << " mobile_app_id: " << mobile_app_id.c_str()
+ << " device_handle: " << device_handle_
+ << " device_handle: " << app->device());
+ continue;
+ }
return true;
}
}
@@ -1241,7 +1342,8 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params][strings::device_info].keyExists(
strings::hardware)) {
str = (*message_)[strings::msg_params][strings::device_info]
- [strings::hardware].asCharArray();
+ [strings::hardware]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid device_info hardware syntax check failed");
@@ -1252,7 +1354,8 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params][strings::device_info].keyExists(
strings::firmware_rev)) {
str = (*message_)[strings::msg_params][strings::device_info]
- [strings::firmware_rev].asCharArray();
+ [strings::firmware_rev]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid device_info firmware_rev syntax check failed");
@@ -1273,7 +1376,8 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params][strings::device_info].keyExists(
strings::os_version)) {
str = (*message_)[strings::msg_params][strings::device_info]
- [strings::os_version].asCharArray();
+ [strings::os_version]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid device_info os_version syntax check failed");
@@ -1284,7 +1388,8 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params][strings::device_info].keyExists(
strings::carrier)) {
str = (*message_)[strings::msg_params][strings::device_info]
- [strings::carrier].asCharArray();
+ [strings::carrier]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid device_info carrier syntax check failed");
@@ -1301,6 +1406,17 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
}
}
+ if (application_manager_.get_settings().use_full_app_id()) {
+ if ((*message_)[strings::msg_params].keyExists(strings::full_app_id)) {
+ str =
+ (*message_)[strings::msg_params][strings::full_app_id].asCharArray();
+ if (!CheckSyntax(str)) {
+ LOG4CXX_ERROR(logger_, "Invalid app_id syntax check failed");
+ return true;
+ }
+ }
+ }
+
return false;
}
@@ -1323,40 +1439,39 @@ void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam(
void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() {
using namespace smart_objects;
- using namespace hmi_apis;
-
SmartObject msg_params = SmartObject(SmartType_Map);
msg_params[strings::app_id] = connection_key();
- msg_params[strings::name] = Common_ButtonName::CUSTOM_BUTTON;
+ msg_params[strings::name] = hmi_apis::Common_ButtonName::CUSTOM_BUTTON;
msg_params[strings::is_suscribed] = true;
- CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params);
+ CreateHMINotification(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ msg_params);
}
bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
- const smart_objects::SmartObject& msg_params =
- (*message_)[strings::msg_params];
-
- const std::string& policy_app_id = msg_params[strings::app_id].asString();
+ const std::string& policy_app_id =
+ application_manager_.GetCorrectMobileIDFromMessage(message_);
LOG4CXX_DEBUG(logger_, "Looking for application id " << policy_app_id);
-
- auto app = application_manager_.application_by_policy_id(policy_app_id);
+ auto app =
+ application_manager_.reregister_application_by_policy_id(policy_app_id);
if (!app) {
- LOG4CXX_DEBUG(logger_,
- "Application with policy id " << policy_app_id
- << " is not found.");
+ LOG4CXX_DEBUG(
+ logger_,
+ "Application with policy id " << policy_app_id << " is not found.");
return false;
}
LOG4CXX_DEBUG(logger_,
"Application with policy id " << policy_app_id << " is found.");
- if (!application_manager_.IsAppInReconnectMode(policy_app_id)) {
+
+ const auto app_device_handle = app->device();
+ if (app_device_handle == device_handle_) {
LOG4CXX_DEBUG(logger_,
- "Policy id " << policy_app_id
- << " is not found in reconnection list.");
+ "Application " << policy_app_id
+ << " is already registered from this device.");
SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY);
- return false;
+ return true;
}
LOG4CXX_DEBUG(logger_, "Application is found in reconnection list.");
@@ -1375,13 +1490,61 @@ bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
application_manager_.ProcessReconnection(app, connection_key());
SendRegisterAppInterfaceResponseToMobile(app_type);
- application_manager_.SendHMIStatusNotification(app);
+ MessageHelper::SendHMIStatusNotification(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ application_manager_);
application_manager_.OnApplicationSwitched(app);
return true;
}
+bool RegisterAppInterfaceRequest::GetDataOnSessionKey(
+ const uint32_t key,
+ connection_handler::DeviceHandle* device_id,
+ std::string* mac_address) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if ((nullptr == mac_address) && (nullptr == device_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Can't get data on session key because device id and mac "
+ "address are empty.");
+ return false;
+ }
+
+ connection_handler::DeviceHandle device_handle = 0;
+ auto& connect_handler = application_manager_.connection_handler();
+
+ auto result = connect_handler.GetDataOnSessionKey(
+ connection_key(), nullptr, nullptr, &device_handle);
+
+ if (result) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Failed to get device info for connection key: " << connection_key());
+ return false;
+ }
+
+ if (mac_address) {
+ result = connect_handler.get_session_observer().GetDataOnDeviceID(
+ device_handle, nullptr, nullptr, mac_address, nullptr);
+ }
+
+ if (result) {
+ LOG4CXX_DEBUG(logger_,
+ "Failed get unique address info for connection key: "
+ << connection_key());
+ return false;
+ }
+
+ if (device_id) {
+ *device_id = device_handle;
+ }
+
+ return true;
+}
+
policy::PolicyHandlerInterface&
RegisterAppInterfaceRequest::GetPolicyHandler() {
return policy_handler_;
@@ -1389,4 +1552,4 @@ RegisterAppInterfaceRequest::GetPolicyHandler() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc
index 73b38823d8..b5683c62cb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_response.cc
@@ -32,11 +32,10 @@
*/
#include "sdl_rpc_plugin/commands/mobile/register_app_interface_response.h"
-#include "interfaces/MOBILE_API.h"
#include "application_manager/application_manager.h"
#include "application_manager/policies/policy_handler_interface.h"
#include "connection_handler/connection_handler.h"
-#include "application_manager/policies/policy_handler_interface.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -60,6 +59,40 @@ void RegisterAppInterfaceResponse::Run() {
}
}
+ application_manager::ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+
+ if (app && app->msg_version() < utils::rpc_version_5 &&
+ app->is_media_application() &&
+ (*message_)[strings::msg_params].keyExists(
+ hmi_response::button_capabilities)) {
+ const smart_objects::SmartObject& button_caps =
+ (*message_)[strings::msg_params][hmi_response::button_capabilities];
+ auto it = button_caps.asArray()->begin();
+ auto ok_btn_it = it;
+ bool ok_btn_exists = false;
+ bool play_pause_btn_exists = false;
+ for (; it != button_caps.asArray()->end(); ++it) {
+ smart_objects::SmartObject& so = *it;
+ int64_t current_id = so[strings::name].asInt();
+ if (current_id == -1) {
+ continue;
+ }
+ const mobile_apis::ButtonName::eType current_button =
+ static_cast<mobile_apis::ButtonName::eType>(current_id);
+ if (current_button == mobile_apis::ButtonName::PLAY_PAUSE) {
+ play_pause_btn_exists = true;
+ so[strings::name] = mobile_apis::ButtonName::OK;
+ } else if (current_button == mobile_apis::ButtonName::OK) {
+ ok_btn_exists = true;
+ ok_btn_it = it;
+ }
+ }
+ if (ok_btn_exists && play_pause_btn_exists) {
+ button_caps.asArray()->erase(ok_btn_it);
+ }
+ }
+
SendResponse(success, result_code, last_message);
if (mobile_apis::Result::SUCCESS != result_code) {
@@ -68,16 +101,14 @@ void RegisterAppInterfaceResponse::Run() {
// Add registered application to the policy db right after response sent to
// mobile to be able to check all other API according to app permissions
- application_manager::ApplicationSharedPtr application =
- application_manager_.application(connection_key());
- if (!application) {
+ if (!app) {
LOG4CXX_ERROR(logger_,
"Application with connection key " << connection_key()
<< " is not registered.");
return;
}
- SetHeartBeatTimeout(connection_key(), application->policy_app_id());
+ SetHeartBeatTimeout(connection_key(), app->policy_app_id());
}
void RegisterAppInterfaceResponse::SetHeartBeatTimeout(
@@ -96,4 +127,4 @@ void RegisterAppInterfaceResponse::SetHeartBeatTimeout(
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
index ab6e1cc143..a0e178d0e2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
@@ -36,8 +36,8 @@
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -161,7 +161,8 @@ void ResetGlobalPropertiesRequest::Run() {
key_board_properties[hmi_request::limited_character_list] =
limited_character_list;*/
- key_board_properties[hmi_request::auto_complete_text] = "";
+ key_board_properties[hmi_request::auto_complete_list] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
msg_params[hmi_request::keyboard_properties] = key_board_properties;
}
@@ -197,8 +198,21 @@ bool ResetGlobalPropertiesRequest::ResetHelpPromt(
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return false;
}
+ const std::vector<std::string>& help_prompt =
+ application_manager_.get_settings().help_prompt();
+
smart_objects::SmartObject so_help_prompt =
smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ for (size_t i = 0; i < help_prompt.size(); ++i) {
+ smart_objects::SmartObject help_prompt_item =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ help_prompt_item[strings::text] = help_prompt[i];
+ help_prompt_item[strings::type] =
+ hmi_apis::Common_SpeechCapabilities::SC_TEXT;
+ so_help_prompt[i] = help_prompt_item;
+ }
+
app->set_help_prompt(so_help_prompt);
return true;
}
@@ -217,7 +231,7 @@ bool ResetGlobalPropertiesRequest::ResetTimeoutPromt(
smart_objects::SmartObject so_time_out_promt =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- for (uint32_t i = 0; i < time_out_promt.size(); ++i) {
+ for (size_t i = 0; i < time_out_promt.size(); ++i) {
smart_objects::SmartObject timeoutPrompt =
smart_objects::SmartObject(smart_objects::SmartType_Map);
timeoutPrompt[strings::text] = time_out_promt[i];
@@ -237,8 +251,16 @@ bool ResetGlobalPropertiesRequest::ResetVrHelpTitleItems(
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return false;
}
+
+ const std::string& vr_help_title =
+ application_manager_.get_settings().vr_help_title();
+ smart_objects::SmartObject so_vr_help_title =
+ smart_objects::SmartObject(smart_objects::SmartType_String);
+ so_vr_help_title = vr_help_title;
+
app->reset_vr_help_title();
app->reset_vr_help();
+ app->set_vr_help_title(so_vr_help_title);
return true;
}
@@ -333,4 +355,4 @@ bool ResetGlobalPropertiesRequest::IsPendingResponseExist() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc
index f5542ab26b..07aa23d9c9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_response.cc
@@ -61,4 +61,4 @@ void ResetGlobalPropertiesResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
index 0b28e09210..90dbb91b5f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
@@ -31,14 +31,14 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string.h>
#include "sdl_rpc_plugin/commands/mobile/scrollable_message_request.h"
+#include <string.h>
#include "application_manager/application_impl.h"
-#include "application_manager/policies/policy_handler.h"
#include "application_manager/message_helper.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/policies/policy_handler.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
#include "utils/helpers.h"
namespace sdl_rpc_plugin {
@@ -65,13 +65,9 @@ ScrollableMessageRequest::~ScrollableMessageRequest() {}
bool ScrollableMessageRequest::Init() {
/* Timeout in milliseconds.
If omitted a standard value of 10000 milliseconds is used.*/
- if ((*message_)[strings::msg_params].keyExists(strings::timeout)) {
- default_timeout_ =
- (*message_)[strings::msg_params][strings::timeout].asUInt();
- } else {
- const int32_t def_value = 30000;
- default_timeout_ = def_value;
- }
+ uint32_t request_timeout =
+ (*message_)[strings::msg_params][strings::timeout].asUInt();
+ default_timeout_ += request_timeout;
return true;
}
@@ -110,7 +106,13 @@ void ScrollableMessageRequest::Run() {
msg_params[hmi_request::message_text][hmi_request::field_text] =
(*message_)[strings::msg_params][strings::scroll_message_body];
msg_params[strings::app_id] = app->app_id();
- msg_params[strings::timeout] = default_timeout_;
+ msg_params[strings::timeout] =
+ (*message_)[strings::msg_params][strings::timeout].asUInt();
+
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
msg_params[strings::soft_buttons] =
@@ -160,4 +162,4 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc
index 4eee819497..6236506c00 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_response.cc
@@ -69,4 +69,4 @@ void ScrollableMessageResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc
index a09434ebb6..6e745fe0db 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc
@@ -105,4 +105,4 @@ void SendHapticDataRequest::on_event(const event_engine::Event& event) {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc
index f4515472a4..79a0516928 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_response.cc
@@ -60,4 +60,4 @@ void SendHapticDataResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
index ab8de5923a..805c0f0e41 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc
@@ -30,8 +30,8 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <algorithm>
#include "sdl_rpc_plugin/commands/mobile/send_location_request.h"
+#include <algorithm>
#include "application_manager/message_helper.h"
#include "utils/custom_string.h"
@@ -124,7 +124,7 @@ void SendLocationRequest::Run() {
(*message_)[strings::msg_params][strings::location_image],
app,
application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
return;
@@ -254,10 +254,10 @@ bool SendLocationRequest::CheckHMICapabilities(
return false;
}
- if (hmi_capabilities.display_capabilities()) {
- const SmartObject disp_cap = (*hmi_capabilities.display_capabilities());
+ auto display_capabilities = hmi_capabilities.display_capabilities();
+ if (display_capabilities) {
const SmartObject& text_fields =
- disp_cap.getElement(hmi_response::text_fields);
+ display_capabilities->getElement(hmi_response::text_fields);
const size_t len = text_fields.length();
for (size_t i = 0; i < len; ++i) {
const SmartObject& text_field = text_fields[i];
@@ -281,4 +281,4 @@ bool SendLocationRequest::CheckHMICapabilities(
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc
index 59dab4a9a7..934008b816 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_response.cc
@@ -32,8 +32,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/send_location_response.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
#include "interfaces/HMI_API.h"
namespace sdl_rpc_plugin {
@@ -63,4 +63,4 @@ void SendLocationResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc
index 3cb57c90e8..ed77d8a550 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc
@@ -34,10 +34,10 @@
#include "sdl_rpc_plugin/commands/mobile/set_app_icon_request.h"
#include <algorithm>
-#include "application_manager/message_helper.h"
#include "application_manager/application_impl.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/message_helper.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
#include "utils/file_system.h"
#include "utils/helpers.h"
@@ -60,6 +60,14 @@ SetAppIconRequest::SetAppIconRequest(
, is_icons_saving_enabled_(false) {
const std::string path =
application_manager_.get_settings().app_icons_folder();
+
+ if (!file_system::DirectoryExists(path)) {
+ LOG4CXX_WARN(logger_, "App icons folder doesn't exist.");
+ if (!file_system::CreateDirectoryRecursively(path)) {
+ LOG4CXX_ERROR(logger_, "Unable to create app icons directory: " << path);
+ }
+ }
+
is_icons_saving_enabled_ = file_system::IsWritingAllowed(path) &&
file_system::IsReadingAllowed(path);
}
@@ -106,25 +114,22 @@ void SetAppIconRequest::Run() {
msg_params[strings::sync_file_name] =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- // Panasonic requres unchanged path value without encoded special characters
- const std::string full_file_path_for_hmi =
- file_system::ConvertPathForURL(full_file_path);
+ // For further use in on_event function
+ full_file_path_for_hmi_ = file_system::ConvertPathForURL(full_file_path);
- msg_params[strings::sync_file_name][strings::value] = full_file_path_for_hmi;
+ msg_params[strings::sync_file_name][strings::value] = full_file_path_for_hmi_;
// TODO(VS): research why is image_type hardcoded
msg_params[strings::sync_file_name][strings::image_type] =
static_cast<int32_t>(SetAppIconRequest::ImageType::DYNAMIC);
- // for further use in on_event function
- (*message_)[strings::msg_params][strings::sync_file_name] =
- msg_params[strings::sync_file_name];
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_SetAppIcon, &msg_params, true);
}
void SetAppIconRequest::CopyToIconStorage(
- const std::string& path_to_file) const {
+ const std::string& policy_app_id, const std::string& path_to_file) const {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!(application_manager_.protocol_handler()
.get_settings()
.max_supported_protocol_version() >=
@@ -146,17 +151,25 @@ void SetAppIconRequest::CopyToIconStorage(
application_manager_.get_settings().app_icons_folder_max_size());
const uint64_t file_size = file_system::FileSize(path_to_file);
+ if (0 == file_size) {
+ LOG4CXX_ERROR(logger_, "Can't get the icon file size: " << path_to_file);
+ return;
+ }
+
if (storage_max_size < file_size) {
LOG4CXX_ERROR(logger_,
- "Icon size (" << file_size << ") is bigger, than "
- " icons storage maximum size ("
- << storage_max_size << ")."
- "Copying skipped.");
+ "Icon size (" << file_size
+ << ") is bigger, than "
+ " icons storage maximum size ("
+ << storage_max_size
+ << ")."
+ "Copying skipped.");
return;
}
const uint64_t storage_size =
static_cast<uint64_t>(file_system::DirectorySize(icon_storage));
+
if (storage_max_size < (file_size + storage_size)) {
const uint32_t icons_amount =
application_manager_.get_settings().app_icons_amount_to_remove();
@@ -172,23 +185,15 @@ void SetAppIconRequest::CopyToIconStorage(
RemoveOldestIcons(icon_storage, icons_amount);
}
}
- ApplicationConstSharedPtr app =
- application_manager_.application(connection_key());
- if (!app) {
- LOG4CXX_ERROR(
- logger_,
- "Can't get application for connection key: " << connection_key());
- return;
- }
+ const std::string icon_path = icon_storage + "/" + policy_app_id;
- const std::string icon_path = icon_storage + "/" + app->policy_app_id();
if (!file_system::CreateFile(icon_path)) {
LOG4CXX_ERROR(logger_, "Can't create icon: " << icon_path);
return;
}
- if (!file_system::Write(icon_path, file_content)) {
+ if (!file_system::WriteBinaryFile(icon_path, file_content)) {
LOG4CXX_ERROR(logger_, "Can't write icon: " << icon_path);
return;
}
@@ -203,7 +208,12 @@ void SetAppIconRequest::CopyToIconStorage(
void SetAppIconRequest::RemoveOldestIcons(const std::string& storage,
const uint32_t icons_amount) const {
const std::vector<std::string> icons_list = file_system::ListFiles(storage);
- std::map<uint64_t, std::string> icon_modification_time;
+ auto compareTime = [](const time_t t1, const time_t t2) -> bool {
+ return difftime(t1, t2) > 0;
+ };
+ std::
+ map<time_t, std::string, std::function<bool(const time_t, const time_t)> >
+ icon_modification_time(compareTime);
std::vector<std::string>::const_iterator it = icons_list.begin();
for (; it != icons_list.end(); ++it) {
const std::string file_name = *it;
@@ -211,7 +221,7 @@ void SetAppIconRequest::RemoveOldestIcons(const std::string& storage,
if (!file_system::FileExists(file_path)) {
continue;
}
- const uint64_t time = file_system::GetFileModificationTime(file_path);
+ const time_t time = file_system::GetFileModificationTime(file_path);
icon_modification_time[time] = file_name;
}
@@ -259,20 +269,19 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) {
ApplicationSharedPtr app =
application_manager_.application(connection_key());
- if (!message_.valid() || !app.valid()) {
- LOG4CXX_ERROR(logger_, "NULL pointer.");
+ if (!app) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Can't get application for connection key: " << connection_key());
return;
}
- const std::string& path =
- (*message_)[strings::msg_params][strings::sync_file_name]
- [strings::value].asString();
-
- if (is_icons_saving_enabled_) {
- CopyToIconStorage(path);
+ if (is_icons_saving_enabled_ && !full_file_path_for_hmi_.empty()) {
+ const auto policy_app_id = app->policy_app_id();
+ CopyToIconStorage(policy_app_id, full_file_path_for_hmi_);
}
- app->set_app_icon_path(path);
+ app->set_app_icon_path(full_file_path_for_hmi_);
LOG4CXX_INFO(logger_,
"Icon path was set to '" << app->app_icon_path() << "'");
@@ -293,4 +302,4 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc
index aa8731f062..55255920d0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_response.cc
@@ -61,4 +61,4 @@ void SetAppIconResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc
new file mode 100644
index 0000000000..680429d3b6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc
@@ -0,0 +1,65 @@
+#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {}
+
+void SetCloudAppPropertiesRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ const auto& properties =
+ (*message_)[strings::msg_params][strings::properties];
+
+ const auto app_id(properties[strings::app_id].asString());
+
+ const auto properties_change_status =
+ policy_handler_.GetAppPropertiesStatus(properties, app_id);
+
+ using AppPropertiesState = policy::PolicyHandlerInterface::AppPropertiesState;
+ const bool is_properties_changed =
+ AppPropertiesState::NO_CHANGES != properties_change_status;
+
+ const bool is_new_app = policy_handler_.IsNewApplication(app_id);
+
+ policy_handler_.OnSetCloudAppProperties(*message_);
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+
+ if (is_properties_changed || is_new_app) {
+ const auto notification =
+ MessageHelper::CreateOnAppPropertiesChangeNotification(
+ app_id, application_manager_);
+ application_manager_.GetRPCService().ManageHMICommand(notification);
+ }
+}
+
+void SetCloudAppPropertiesRequest::on_event(
+ const app_mngr::event_engine::Event& event) {
+ LOG4CXX_INFO(logger_, "SetCloudAppPropertiesRequest on_event");
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc
new file mode 100644
index 0000000000..39d2ea7f90
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_response.cc
@@ -0,0 +1,31 @@
+#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/rpc_service.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+SetCloudAppPropertiesResponse::SetCloudAppPropertiesResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+SetCloudAppPropertiesResponse::~SetCloudAppPropertiesResponse() {}
+
+void SetCloudAppPropertiesResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
index 32164b8f0e..0cd9f6635c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
@@ -33,8 +33,8 @@
#include "sdl_rpc_plugin/commands/mobile/set_display_layout_request.h"
-#include "application_manager/message_helper.h"
#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -75,8 +75,8 @@ void SetDisplayLayoutRequest::Run() {
new_layout = msg_params[strings::display_layout].asString();
}
- if (new_layout != old_layout &&
- !new_layout.empty()) { // Template switched, allow any color change
+ if (new_layout != old_layout && !new_layout.empty()) {
+ // Template switched, hence allow any color change
LOG4CXX_DEBUG(logger_,
"SetDisplayLayoutRequest New Layout: " << new_layout);
app->set_display_layout(new_layout);
@@ -85,22 +85,20 @@ void SetDisplayLayoutRequest::Run() {
// Template layout is the same as previous layout
// Reject message if colors are set
if (msg_params.keyExists(strings::day_color_scheme) &&
- app->day_color_scheme() != NULL &&
- !(msg_params[strings::day_color_scheme] ==
- *(app->day_color_scheme()))) {
- // Color scheme param exists and has been previously set, do not allow
- // color change
+ app->day_color_scheme().getType() != smart_objects::SmartType_Null &&
+ msg_params[strings::day_color_scheme] != app->day_color_scheme()) {
+ // Color scheme param exists and has been previously set,
+ // hence do not allow color change
LOG4CXX_DEBUG(logger_, "Reject Day Color Scheme Change");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
if (msg_params.keyExists(strings::night_color_scheme) &&
- app->night_color_scheme() != NULL &&
- !(msg_params[strings::night_color_scheme] ==
- *(app->night_color_scheme()))) {
- // Color scheme param exists and has been previously set, do not allow
- // color change
+ app->night_color_scheme().getType() != smart_objects::SmartType_Null &&
+ msg_params[strings::night_color_scheme] != app->night_color_scheme()) {
+ // Color scheme param exists and has been previously set,
+ // hence do not allow color change
LOG4CXX_DEBUG(logger_, "Reject Night Color Scheme Change");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
@@ -127,6 +125,14 @@ void SetDisplayLayoutRequest::Run() {
void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetDisplayLayout: {
@@ -143,21 +149,35 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
if (response_success) {
HMICapabilities& hmi_capabilities = hmi_capabilities_;
- // in case templates_available is empty copy from hmi capabilities
+ // In case templates_available is empty copy from hmi capabilities
if (msg_params.keyExists(hmi_response::display_capabilities)) {
- if (0 ==
+ if (0 == msg_params[hmi_response::display_capabilities]
+ [hmi_response::templates_available]
+ .length()) {
+ auto display_capabilities = hmi_capabilities.display_capabilities();
+ if (display_capabilities) {
msg_params[hmi_response::display_capabilities]
- [hmi_response::templates_available].length()) {
- msg_params[hmi_response::display_capabilities]
- [hmi_response::templates_available] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::templates_available);
+ [hmi_response::templates_available] =
+ display_capabilities->getElement(
+ hmi_response::templates_available);
+ }
}
}
+ const Version& app_version = app->version();
+ if (app_version.max_supported_api_version >= APIVersion::kAPIV6) {
+ // In case of successful response warn user that this RPC is
+ // deprecated from 6.0 and higher API versions
+ result_code = hmi_apis::Common_Result::WARNINGS;
+ info =
+ "The RPC is deprecated and will be removed in a future version. "
+ "The requested display layout is set to the main window. Please "
+ "use `Show.templateConfiguration` instead.";
+ }
}
+
SendResponse(response_success,
MessageHelper::HMIToMobileResult(result_code),
- info.empty() ? NULL : info.c_str(),
+ info.empty() ? nullptr : info.c_str(),
&msg_params);
break;
}
@@ -170,4 +190,4 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc
index 4bab4a3e5b..0999b596b5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_response.cc
@@ -62,4 +62,4 @@ void SetDisplayLayoutResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
index 90ec06025e..a567d1b32f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
@@ -30,14 +30,15 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "sdl_rpc_plugin/commands/mobile/set_global_properties_request.h"
#include <string.h>
-#include <numeric>
#include <algorithm>
-#include "sdl_rpc_plugin/commands/mobile/set_global_properties_request.h"
+#include <numeric>
#include "application_manager/message_helper.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+
#include "utils/helpers.h"
namespace sdl_rpc_plugin {
@@ -45,6 +46,24 @@ using namespace application_manager;
namespace commands {
+namespace {
+bool IsResultCodeWarning(const app_mngr::commands::ResponseInfo& first,
+ const app_mngr::commands::ResponseInfo& second,
+ const app_mngr::commands::ResponseInfo& third) {
+ const bool first_is_ok_second_is_warn =
+ (first.is_ok || first.is_not_used) &&
+ (hmi_apis::Common_Result::WARNINGS == second.result_code) &&
+ (hmi_apis::Common_Result::WARNINGS == third.result_code);
+
+ const bool final_warnings =
+ hmi_apis::Common_Result::WARNINGS == first.result_code &&
+ ((hmi_apis::Common_Result::WARNINGS == second.result_code) &&
+ (hmi_apis::Common_Result::WARNINGS == third.result_code));
+
+ return first_is_ok_second_is_warn || final_warnings;
+}
+} // namespace
+
SetGlobalPropertiesRequest::SetGlobalPropertiesRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -58,25 +77,27 @@ SetGlobalPropertiesRequest::SetGlobalPropertiesRequest(
policy_handler)
, is_ui_send_(false)
, is_tts_send_(false)
+ , is_rc_send_(false)
, is_ui_received_(false)
, is_tts_received_(false)
+ , is_rc_received_(false)
, ui_result_(hmi_apis::Common_Result::INVALID_ENUM)
- , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
+ , tts_result_(hmi_apis::Common_Result::INVALID_ENUM)
+ , rc_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {}
void SetGlobalPropertiesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject& msg_params =
- (*message_)[strings::msg_params];
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_,
- "No application associated with connection key "
- << connection_key());
+ LOG4CXX_ERROR(
+ logger_,
+ "No application associated with connection key " << connection_key());
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -90,12 +111,10 @@ void SetGlobalPropertiesRequest::Run() {
mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS;
- if ((*message_)[strings::msg_params].keyExists(strings::menu_icon)) {
+ if (msg_params.keyExists(strings::menu_icon)) {
verification_result = MessageHelper::VerifyImage(
- (*message_)[strings::msg_params][strings::menu_icon],
- app,
- application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ msg_params[strings::menu_icon], app, application_manager_);
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(
logger_, "MessageHelper::VerifyImage return " << verification_result);
SendResponse(false, verification_result);
@@ -103,18 +122,29 @@ void SetGlobalPropertiesRequest::Run() {
}
}
// Check for image file(s) in vrHelpItem
- if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) {
- if (mobile_apis::Result::SUCCESS !=
+ if (msg_params.keyExists(strings::vr_help)) {
+ if (mobile_apis::Result::INVALID_DATA ==
MessageHelper::VerifyImageVrHelpItems(
- (*message_)[strings::msg_params][strings::vr_help],
- app,
- application_manager_)) {
+ msg_params[strings::vr_help], app, application_manager_)) {
LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA!");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
}
+ if (msg_params.keyExists(strings::keyboard_properties)) {
+ if (!msg_params[strings::keyboard_properties].keyExists(
+ strings::auto_complete_list) &&
+ msg_params[strings::keyboard_properties].keyExists(
+ strings::auto_complete_text)) {
+ LOG4CXX_ERROR(logger_, "Replacing deprecated autoCompleteText property");
+ msg_params[strings::keyboard_properties][strings::auto_complete_list][0] =
+ msg_params[strings::keyboard_properties][strings::auto_complete_text]
+ .asString();
+ }
+ msg_params[strings::keyboard_properties].erase(strings::auto_complete_text);
+ }
+
if (IsWhiteSpaceExist()) {
LOG4CXX_ERROR(logger_, "White spaces found");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
@@ -138,6 +168,19 @@ void SetGlobalPropertiesRequest::Run() {
return;
}
+ smart_objects::SmartObject params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ if (msg_params.keyExists(strings::menu_layout)) {
+ auto menu_layout = static_cast<mobile_apis::MenuLayout::eType>(
+ msg_params[strings::menu_layout].asUInt());
+ if (app->menu_layout_supported(menu_layout)) {
+ params[strings::menu_layout] = msg_params[strings::menu_layout];
+ } else {
+ is_menu_layout_available_ = false;
+ }
+ }
+
/* Need to set flags before sending request to HMI
* for correct processing this flags in method on_event */
if (is_help_prompt_present || is_timeout_prompt_present) {
@@ -154,30 +197,18 @@ void SetGlobalPropertiesRequest::Run() {
return;
}
- smart_objects::SmartObject params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
PrepareUIRequestVRHelpData(app, msg_params, params);
PrepareUIRequestMenuAndKeyboardData(app, msg_params, params);
params[strings::app_id] = app->app_id();
SendUIRequest(params, true);
+
+ auto& help_prompt_manager = app->help_prompt_manager();
+ help_prompt_manager.OnSetGlobalPropertiesReceived(params, false);
} else {
LOG4CXX_DEBUG(logger_, "VRHelp params does not present");
DCHECK_OR_RETURN_VOID(!is_vr_help_title_present && !is_vr_help_present);
- smart_objects::SmartObject params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- if (ValidateVRHelpTitle(app->vr_help_title())) {
- LOG4CXX_DEBUG(logger_, "App already contains VRHelp data");
- } else {
- if (!PrepareUIRequestDefaultVRHelpData(app, params)) {
- LOG4CXX_ERROR(logger_, "default VRHElp data could not be generated");
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
- return;
- }
- }
PrepareUIRequestMenuAndKeyboardData(app, msg_params, params);
// Preparing data
@@ -189,45 +220,71 @@ void SetGlobalPropertiesRequest::Run() {
}
}
+ // Check RC params
+ const bool is_user_location_present =
+ msg_params.keyExists(strings::user_location);
+ if (is_user_location_present) {
+ if (msg_params[strings::user_location].empty()) {
+ SendResponse(
+ false, mobile_apis::Result::INVALID_DATA, "UserLocation is empty");
+ return;
+ }
+ LOG4CXX_DEBUG(logger_, "Userlocation params presents");
+ const auto& user_location = msg_params[strings::user_location];
+ app->set_user_location(user_location);
+
+ auto on_global_properties_updated = [app](
+ plugin_manager::RPCPlugin& plugin) {
+ plugin.OnApplicationEvent(plugin_manager::kGlobalPropertiesUpdated, app);
+ };
+
+ application_manager_.GetPluginManager().ForEachPlugin(
+ on_global_properties_updated);
+
+ smart_objects::SmartObject params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ params[strings::app_id] = app->app_id();
+ params[strings::user_location] = user_location;
+ SendRCRequest(params, true);
+ }
+
// check TTS params
if (is_help_prompt_present || is_timeout_prompt_present) {
LOG4CXX_DEBUG(logger_, "TTS params presents");
- smart_objects::SmartObject params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+ auto tts_params = smart_objects::SmartObject(smart_objects::SmartType_Map);
std::vector<std::string> invalid_params;
if (is_help_prompt_present) {
smart_objects::SmartObject& help_prompt =
(*message_)[strings::msg_params][strings::help_prompt];
- mobile_apis::Result::eType verification_result =
+ verification_result =
MessageHelper::VerifyTtsFiles(help_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(logger_,
- "MessageHelper::VerifyTtsFiles return "
- << verification_result);
+ LOG4CXX_ERROR(
+ logger_,
+ "MessageHelper::VerifyTtsFiles return " << verification_result);
invalid_params.push_back("help_prompt");
} else {
app->set_help_prompt(help_prompt);
- params[strings::help_prompt] = (*app->help_prompt());
+ tts_params[strings::help_prompt] = (*app->help_prompt());
}
}
if (is_timeout_prompt_present) {
smart_objects::SmartObject& timeout_prompt =
(*message_)[strings::msg_params][strings::timeout_prompt];
- mobile_apis::Result::eType verification_result =
- MessageHelper::VerifyTtsFiles(
- timeout_prompt, app, application_manager_);
+ verification_result = MessageHelper::VerifyTtsFiles(
+ timeout_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(logger_,
- "MessageHelper::VerifyTtsFiles return "
- << verification_result);
+ LOG4CXX_ERROR(
+ logger_,
+ "MessageHelper::VerifyTtsFiles return " << verification_result);
invalid_params.push_back("timeout_prompt");
} else {
app->set_timeout_prompt(timeout_prompt);
- params[strings::timeout_prompt] = (*app->timeout_prompt());
+ tts_params[strings::timeout_prompt] = (*app->timeout_prompt());
}
}
@@ -245,8 +302,18 @@ void SetGlobalPropertiesRequest::Run() {
return;
}
- params[strings::app_id] = app->app_id();
- SendTTSRequest(params, true);
+ tts_params[strings::app_id] = app->app_id();
+ SendTTSRequest(tts_params, true);
+
+ auto& help_prompt_manager = app->help_prompt_manager();
+ help_prompt_manager.OnSetGlobalPropertiesReceived(tts_params, false);
+ } else if (!is_ui_send_ && !is_rc_send_) {
+ std::string response_info = "There are no parameters present in request.";
+ if (!is_menu_layout_available_) {
+ response_info += " The MenuLayout specified is unsupported.";
+ }
+ SendResponse(
+ false, mobile_apis::Result::INVALID_DATA, response_info.c_str());
}
}
@@ -276,23 +343,43 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
+ ApplicationSharedPtr application =
+ application_manager_.application(connection_key());
+
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetGlobalProperties: {
- LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event");
+ LOG4CXX_DEBUG(logger_, "Received UI_SetGlobalProperties event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
is_ui_received_ = true;
ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
GetInfo(message, ui_response_info_);
+ if (application.use_count() != 0) {
+ auto& help_prompt_manager = application->help_prompt_manager();
+ help_prompt_manager.OnSetGlobalPropertiesReceived(message, true);
+ }
break;
}
case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
- LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event");
+ LOG4CXX_DEBUG(logger_, "Received TTS_SetGlobalProperties event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS);
is_tts_received_ = true;
tts_result_ = static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
GetInfo(message, tts_response_info_);
+ if (application.use_count() != 0) {
+ auto& help_prompt_manager = application->help_prompt_manager();
+ help_prompt_manager.OnSetGlobalPropertiesReceived(message, true);
+ }
+ break;
+ }
+ case hmi_apis::FunctionID::RC_SetGlobalProperties: {
+ LOG4CXX_DEBUG(logger_, "Received RC_SetGlobalProperties event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_RC);
+ is_rc_received_ = true;
+ rc_result_ = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ GetInfo(message, rc_response_info_);
break;
}
default: {
@@ -309,14 +396,21 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
std::string response_info;
const bool result = PrepareResponseParameters(result_code, response_info);
- // TODO{ALeshin} APPLINK-15858. connection_key removed during SendResponse
- ApplicationSharedPtr application =
- application_manager_.application(connection_key());
-
- SendResponse(result,
- result_code,
- response_info.empty() ? NULL : response_info.c_str(),
- &(message[strings::msg_params]));
+ if (result && !is_menu_layout_available_) {
+ response_info =
+ "The MenuLayout specified is unsupported, the "
+ "default MenuLayout will be used." +
+ response_info;
+ SendResponse(result,
+ mobile_apis::Result::WARNINGS,
+ response_info.c_str(),
+ &(message[strings::msg_params]));
+ } else {
+ SendResponse(result,
+ result_code,
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
+ }
}
bool SetGlobalPropertiesRequest::Init() {
@@ -334,37 +428,171 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters(
app_mngr::commands::ResponseInfo tts_properties_info(
tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_);
- const bool result =
- PrepareResultForMobileResponse(ui_properties_info, tts_properties_info);
+
+ app_mngr::commands::ResponseInfo rc_properties_info(
+ rc_result_, HmiInterfaces::HMI_INTERFACE_RC, application_manager_);
+
+ bool result = false;
+
+ if (!is_rc_send_) {
+ result = CommandRequestImpl::PrepareResultForMobileResponse(
+ ui_properties_info, tts_properties_info);
+ } else {
+ result = PrepareResultForMobileResponse(
+ ui_properties_info, tts_properties_info, rc_properties_info);
+ }
if (result &&
(HmiInterfaces::STATE_AVAILABLE == tts_properties_info.interface_state) &&
(tts_properties_info.is_unsupported_resource)) {
result_code = mobile_apis::Result::WARNINGS;
tts_response_info_ = "Unsupported phoneme type sent in a prompt";
- info = app_mngr::commands::MergeInfos(tts_properties_info,
- tts_response_info_,
- ui_properties_info,
- ui_response_info_);
+ info = MergeInfos(tts_properties_info,
+ tts_response_info_,
+ ui_properties_info,
+ ui_response_info_,
+ rc_properties_info,
+ rc_response_info_);
return result;
}
- result_code =
- PrepareResultCodeForResponse(ui_properties_info, tts_properties_info);
- info = app_mngr::commands::MergeInfos(tts_properties_info,
- tts_response_info_,
- ui_properties_info,
- ui_response_info_);
+
+ if (!is_rc_send_) {
+ result_code = CommandRequestImpl::PrepareResultCodeForResponse(
+ ui_properties_info, tts_properties_info);
+ } else {
+ result_code = PrepareResultCodeForResponse(
+ ui_properties_info, tts_properties_info, rc_properties_info);
+ }
+ info = MergeInfos(tts_properties_info,
+ tts_response_info_,
+ ui_properties_info,
+ ui_response_info_,
+ rc_properties_info,
+ rc_response_info_);
return result;
}
-bool SetGlobalPropertiesRequest::ValidateVRHelpTitle(
- const smart_objects::SmartObject* const vr_help_so_ptr) {
+bool SetGlobalPropertiesRequest::PrepareResultForMobileResponse(
+ const app_mngr::commands::ResponseInfo& first,
+ const app_mngr::commands::ResponseInfo& second,
+ const app_mngr::commands::ResponseInfo& third) const {
LOG4CXX_AUTO_TRACE(logger_);
- if (vr_help_so_ptr) {
- const std::string& vr_help = vr_help_so_ptr->asString();
- LOG4CXX_TRACE(logger_, "App contains vr_help_title: \"" << vr_help << '"');
- return !vr_help.empty();
+
+ app_mngr::commands::ResponseInfo both_info;
+ std::vector<hmi_apis::Common_Result::eType> success_result_codes{
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED};
+
+ both_info.is_ok =
+ helpers::in_range(success_result_codes, first.result_code) &&
+ helpers::in_range(success_result_codes, second.result_code);
+
+ both_info.is_not_used =
+ (hmi_apis::Common_Result::INVALID_ENUM == first.result_code) ||
+ (hmi_apis::Common_Result::INVALID_ENUM == second.result_code);
+
+ both_info.is_unsupported_resource =
+ (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == first.result_code) ||
+ (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == second.result_code);
+
+ const bool final_result = CommandRequestImpl::CheckResult(both_info, third) ||
+ CommandRequestImpl::CheckResult(third, both_info);
+
+ return final_result;
+}
+
+mobile_apis::Result::eType
+SetGlobalPropertiesRequest::PrepareResultCodeForResponse(
+ const app_mngr::commands::ResponseInfo& first,
+ const app_mngr::commands::ResponseInfo& second,
+ const app_mngr::commands::ResponseInfo& third) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
+ if (IsResultCodeUnsupported(first, second, third) ||
+ IsResultCodeUnsupported(second, third, first) ||
+ IsResultCodeUnsupported(third, first, second)) {
+ return mobile_apis::Result::UNSUPPORTED_RESOURCE;
}
- return false;
+ if (IsResultCodeWarning(first, second, third) ||
+ IsResultCodeWarning(second, third, first) ||
+ IsResultCodeWarning(third, first, second)) {
+ return mobile_apis::Result::WARNINGS;
+ }
+ // If response contains erroneous result code SDL need return erroneous
+ // result code.
+ auto first_result = hmi_apis::Common_Result::INVALID_ENUM;
+ auto second_result = hmi_apis::Common_Result::INVALID_ENUM;
+ auto third_result = hmi_apis::Common_Result::INVALID_ENUM;
+
+ if (!first.is_unsupported_resource) {
+ first_result = first.result_code;
+ }
+ if (!second.is_unsupported_resource) {
+ second_result = second.result_code;
+ }
+ if (!third.is_unsupported_resource) {
+ third_result = third.result_code;
+ }
+
+ hmi_apis::Common_Result::eType intermediate_result =
+ std::max(first_result, second_result);
+ result_code = MessageHelper::HMIToMobileResult(
+ std::max(intermediate_result, third_result));
+
+ return result_code;
+}
+
+bool SetGlobalPropertiesRequest::IsResultCodeUnsupported(
+ const application_manager::commands::ResponseInfo& first,
+ const application_manager::commands::ResponseInfo& second,
+ const application_manager::commands::ResponseInfo& third) const {
+ const bool first_ok_second_or_third_unsupported =
+ (first.is_ok || first.is_not_used) &&
+ (second.is_unsupported_resource || third.is_unsupported_resource);
+ const bool final_unsupported = first.is_unsupported_resource &&
+ second.is_unsupported_resource &&
+ third.is_unsupported_resource;
+
+ return first_ok_second_or_third_unsupported || final_unsupported;
+}
+
+std::string SetGlobalPropertiesRequest::MergeInfos(
+ const app_mngr::commands::ResponseInfo& first_info,
+ const std::string& first_str,
+ const app_mngr::commands::ResponseInfo& second_info,
+ const std::string& second_str,
+ const app_mngr::commands::ResponseInfo& third_info,
+ const std::string& third_str) {
+ if ((first_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) &&
+
+ ((second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ !second_str.empty()) &&
+ ((third_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ !third_str.empty())) {
+ return second_str;
+ }
+
+ if ((second_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ ((first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ !first_str.empty()) &&
+ ((third_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ !third_str.empty())) {
+ return first_str;
+ }
+
+ if ((third_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ ((first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ !first_str.empty()) &&
+ ((second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) &&
+ !second_str.empty())) {
+ return third_str;
+ }
+
+ std::string intermediate_result =
+ app_mngr::commands::MergeInfos(first_str, second_str);
+ return app_mngr::commands::MergeInfos(intermediate_result, third_str);
}
void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData(
@@ -381,41 +609,6 @@ void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData(
out_params[strings::vr_help] = (*app->vr_help());
}
-bool SetGlobalPropertiesRequest::PrepareUIRequestDefaultVRHelpData(
- const ApplicationSharedPtr app, smart_objects::SmartObject& out_params) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN(app, false);
-
- LOG4CXX_DEBUG(logger_, "Generate default VRHelp data");
- const DataAccessor<CommandsMap> accessor = app->commands_map();
- const CommandsMap& cmdMap = accessor.GetData();
-
- int32_t index = 0;
- smart_objects::SmartObject vr_help_items;
- for (CommandsMap::const_iterator command_it = cmdMap.begin();
- cmdMap.end() != command_it;
- ++command_it) {
- const smart_objects::SmartObject& command = *command_it->second;
- if (!command.keyExists(strings::vr_commands)) {
- LOG4CXX_ERROR(logger_, "VR synonyms are empty");
- return false;
- }
- // use only first
- vr_help_items[index][strings::position] = (index + 1);
- vr_help_items[index++][strings::text] =
- (*command_it->second)[strings::vr_commands][0];
- }
-
- app->set_vr_help_title(smart_objects::SmartObject(app->name()));
-
- out_params[strings::vr_help_title] = (*app->vr_help_title());
- if (vr_help_items.length() > 0) {
- app->set_vr_help(vr_help_items);
- out_params[strings::vr_help] = (*app->vr_help());
- }
- return true;
-}
-
void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData(
const ApplicationSharedPtr app,
const smart_objects::SmartObject& msg_params,
@@ -464,8 +657,19 @@ void SetGlobalPropertiesRequest::SendUIRequest(
hmi_apis::FunctionID::UI_SetGlobalProperties, &params, use_events);
}
+void SetGlobalPropertiesRequest::SendRCRequest(
+ const ns_smart_device_link::ns_smart_objects::SmartObject& params,
+ bool use_events) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ is_rc_send_ = true;
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_RC);
+ SendHMIRequest(
+ hmi_apis::FunctionID::RC_SetGlobalProperties, &params, use_events);
+}
+
bool SetGlobalPropertiesRequest::IsPendingResponseExist() {
- return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_;
+ return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_ ||
+ is_rc_send_ != is_rc_received_;
}
bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters(
@@ -477,7 +681,9 @@ bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters(
params.keyExists(strings::vr_help) ||
params.keyExists(strings::menu_title) ||
params.keyExists(strings::menu_icon) ||
- params.keyExists(strings::keyboard_properties);
+ params.keyExists(strings::keyboard_properties) ||
+ params.keyExists(strings::menu_layout) ||
+ params.keyExists(strings::user_location);
}
bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
@@ -573,7 +779,8 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
strings::limited_character_list)) {
const smart_objects::SmartArray* lcl_array =
msg_params[strings::keyboard_properties]
- [strings::limited_character_list].asArray();
+ [strings::limited_character_list]
+ .asArray();
smart_objects::SmartArray::const_iterator it_lcl = lcl_array->begin();
smart_objects::SmartArray::const_iterator it_lcl_end = lcl_array->end();
@@ -590,16 +797,21 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
}
if (msg_params[strings::keyboard_properties].keyExists(
- strings::auto_complete_text)) {
- str =
- msg_params[strings::keyboard_properties][strings::auto_complete_text]
- .asCharArray();
+ strings::auto_complete_list)) {
+ const smart_objects::SmartArray* acl_array =
+ msg_params[strings::keyboard_properties][strings::auto_complete_list]
+ .asArray();
- if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid keyboard_properties "
- "auto_complete_text syntax check failed");
- return true;
+ smart_objects::SmartArray::const_iterator it = acl_array->begin();
+
+ for (; it != acl_array->end(); ++it) {
+ str = it->asCharArray();
+ if (!CheckSyntax(str)) {
+ LOG4CXX_ERROR(logger_,
+ "Invalid keyboard_properties "
+ "auto_complete_list syntax check failed");
+ return true;
+ }
}
}
}
@@ -607,4 +819,4 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc
index 567a1a088b..1de2b97d3a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_response.cc
@@ -61,4 +61,4 @@ void SetGlobalPropertiesResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_request.cc
deleted file mode 100644
index 54c202f7b0..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_icon_request.cc
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-
- Copyright (c) 2018, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "sdl_rpc_plugin/commands/mobile/set_icon_request.h"
-#include "application_manager/application_manager.h"
-#include "application_manager/application_impl.h"
-#include "config_profile/profile.h"
-#include "interfaces/MOBILE_API.h"
-#include "interfaces/HMI_API.h"
-#include "utils/file_system.h"
-
-namespace sdl_rpc_plugin {
-using namespace application_manager;
-
-namespace commands {
-
-SetIconRequest::SetIconRequest(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
-
-SetIconRequest::~SetIconRequest() {}
-
-void SetIconRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- ApplicationSharedPtr app = application_manager_.application(connection_key());
-
- if (!app) {
- LOG4CXX_ERROR(logger_, "Application is not registered");
- SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- return;
- }
-
- const std::string& sync_file_name =
- (*message_)[strings::msg_params][strings::sync_file_name].asString();
-
- std::string full_file_path =
- application_manager_.get_settings().app_storage_folder() + "/";
- full_file_path += app->folder_name();
- full_file_path += "/";
- full_file_path += sync_file_name;
-
- if (!file_system::FileExists(full_file_path)) {
- LOG4CXX_ERROR(logger_, "No such file " << full_file_path);
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
- return;
- }
-
- smart_objects::SmartObject msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- msg_params[strings::app_id] = app->app_id();
- msg_params[strings::sync_file_name] =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- // Panasonic requres unchanged path value without encoded special characters
- const std::string full_file_path_for_hmi =
- file_system::ConvertPathForURL(full_file_path);
-
- msg_params[strings::sync_file_name][strings::value] = full_file_path_for_hmi;
-
- // TODO(VS): research why is image_type hardcoded
- msg_params[strings::sync_file_name][strings::image_type] =
- static_cast<int32_t>(SetIconRequest::ImageType::DYNAMIC);
-
- // for further use in on_event function
- (*message_)[strings::msg_params][strings::sync_file_name] =
- msg_params[strings::sync_file_name];
- StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
- SendHMIRequest(hmi_apis::FunctionID::UI_SetAppIcon, &msg_params, true);
-}
-
-void SetIconRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject& message = event.smart_object();
-
- switch (event.id()) {
- case hmi_apis::FunctionID::UI_SetAppIcon: {
- EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
- mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(
- message[strings::params][hmi_response::code].asInt());
-
- bool result = mobile_apis::Result::SUCCESS == result_code;
-
- if (result) {
- ApplicationSharedPtr app =
- application_manager_.application(connection_key());
-
- const std::string path =
- (*message_)[strings::msg_params][strings::sync_file_name]
- [strings::value].asString();
- app->set_app_icon_path(path);
-
- LOG4CXX_INFO(logger_,
- "Icon path was set to '" << app->app_icon_path() << "'");
- }
-
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
- break;
- }
- default: {
- LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
- return;
- }
- }
-}
-
-} // namespace commands
-
-} // namespace application_manager
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
index 55bd164368..d610090aa4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc
@@ -33,10 +33,10 @@
#include "sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h"
-#include "application_manager/message_helper.h"
#include "application_manager/application_impl.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/message_helper.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -163,4 +163,4 @@ bool SetMediaClockRequest::isDataValid() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc
index e777533ce4..948ff84156 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_response.cc
@@ -61,4 +61,4 @@ void SetMediaClockTimerResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
new file mode 100644
index 0000000000..36278168dc
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/show_app_menu_request.h"
+
+#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+ShowAppMenuRequest::ShowAppMenuRequest(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ShowAppMenuRequest::~ShowAppMenuRequest() {}
+
+void ShowAppMenuRequest::Run() {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Application with id " << connection_key() << " is not registered.");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ if (mobile_apis::HMILevel::HMI_FULL !=
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) ||
+ helpers::Compare<mobile_apis::SystemContext::eType,
+ helpers::NEQ,
+ helpers::ALL>(
+ app->system_context(mobile_apis::PredefinedWindows::DEFAULT_WINDOW),
+ mobile_apis::SystemContext::SYSCTXT_MAIN,
+ mobile_apis::SystemContext::SYSCTXT_MENU)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Application with id " << connection_key() << " is not activated.");
+ SendResponse(false, mobile_apis::Result::REJECTED);
+ return;
+ }
+
+ auto msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map);
+ msg_params[strings::app_id] = app->app_id();
+
+ const auto& received_msg_params = (*message_)[strings::msg_params];
+ if (received_msg_params.keyExists(strings::menu_id)) {
+ const int32_t menu_id = received_msg_params[strings::menu_id].asInt();
+ if (!app->FindSubMenu(menu_id)) {
+ LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found.");
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return;
+ }
+ msg_params[strings::menu_id] = menu_id;
+ }
+
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+ SendHMIRequest(hmi_apis::FunctionID::UI_ShowAppMenu, &msg_params, true);
+}
+
+void ShowAppMenuRequest::on_event(const app_mngr::event_engine::Event& event) {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject& message = event.smart_object();
+
+ switch (event.id()) {
+ case hmi_apis::FunctionID::UI_ShowAppMenu: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+ const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ std::string response_info;
+ GetInfo(message, response_info);
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_UI);
+
+ ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with id " << connection_key()
+ << " is not registered.");
+ return;
+ }
+
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty() ? NULL : response_info.c_str(),
+ &message[strings::msg_params]);
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Received unknown event: " << event.id());
+ return;
+ }
+ }
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc
new file mode 100644
index 0000000000..2b952ea9ac
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sdl_rpc_plugin/commands/mobile/show_app_menu_response.h"
+
+#include "application_manager/rpc_service.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+ShowAppMenuResponse::ShowAppMenuResponse(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ShowAppMenuResponse::~ShowAppMenuResponse() {}
+
+void ShowAppMenuResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
index c2eb067e18..b439c1cb16 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc
@@ -31,15 +31,15 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <cstring>
#include "sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h"
+#include <cstring>
-#include "application_manager/policies/policy_handler.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler.h"
#include "application_manager/policies/policy_handler_interface.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -105,7 +105,7 @@ void ShowConstantTBTRequest::Run() {
if (msg_params.keyExists(strings::turn_icon)) {
verification_result = MessageHelper::VerifyImage(
msg_params[strings::turn_icon], app, application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
return;
@@ -115,7 +115,7 @@ void ShowConstantTBTRequest::Run() {
if (msg_params.keyExists(strings::next_turn_icon)) {
verification_result = MessageHelper::VerifyImage(
msg_params[strings::next_turn_icon], app, application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
SendResponse(false, verification_result);
return;
@@ -228,7 +228,8 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params].keyExists(strings::next_turn_icon)) {
str = (*message_)[strings::msg_params][strings::next_turn_icon]
- [strings::value].asCharArray();
+ [strings::value]
+ .asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid next_turn_icon value syntax check failed");
@@ -289,4 +290,4 @@ bool ShowConstantTBTRequest::IsWhiteSpaceExist() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc
index 239040a3b3..d027daf77d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_response.cc
@@ -63,4 +63,4 @@ void ShowConstantTBTResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
index 80a28b288c..84d11f8e09 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
@@ -30,12 +30,12 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string.h>
#include "sdl_rpc_plugin/commands/mobile/show_request.h"
+#include <string.h>
-#include "application_manager/policies/policy_handler.h"
#include "application_manager/application.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler.h"
#include "utils/file_system.h"
#include "utils/helpers.h"
@@ -55,7 +55,12 @@ ShowRequest::ShowRequest(
rpc_service,
hmi_capabilities,
policy_handler)
- , core_result_code_(mobile_apis::Result::INVALID_ENUM) {}
+ , core_result_code_(mobile_apis::Result::INVALID_ENUM)
+ , current_window_id_(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)
+ , template_config_(smart_objects::SmartType::SmartType_Null)
+ , layout_change_required_(false)
+ , dcs_change_required_(false)
+ , ncs_change_required_(false) {}
ShowRequest::~ShowRequest() {}
@@ -94,6 +99,137 @@ void ShowRequest::HandleMetadata(const char* field_id,
}
}
+bool ShowRequest::CheckTemplateConfigurationForApp(
+ application_manager::Application& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ current_window_id_ =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ }
+
+ const auto set_window_layout = [&app, this]() -> bool {
+ const auto new_template_layout =
+ template_config_[strings::template_layout].asString();
+ const auto old_template_layout = app.window_layout(current_window_id_);
+ LOG4CXX_DEBUG(logger_, "New layout: " << new_template_layout);
+ LOG4CXX_DEBUG(logger_, "Old layout: " << old_template_layout);
+
+ const bool layouts_equal = (new_template_layout == old_template_layout);
+
+ if (!new_template_layout.empty() && !layouts_equal) {
+ // Template switched, hence allow any color change
+ LOG4CXX_DEBUG(logger_,
+ "Show Request: Setting new Layout: " << new_template_layout
+ << " for window ID: "
+ << current_window_id_);
+ layout_change_required_ = true;
+ return true;
+ }
+ LOG4CXX_DEBUG(logger_, "Show Request: No Layout Change");
+ return false;
+ };
+
+ const auto set_day_color_scheme = [&app, this]() -> bool {
+ if (!template_config_.keyExists(strings::day_color_scheme)) {
+ return false;
+ }
+ if (app.day_color_scheme(current_window_id_).getType() !=
+ smart_objects::SmartType_Null &&
+ template_config_[strings::day_color_scheme] !=
+ app.day_color_scheme(current_window_id_)) {
+ // Color scheme param exists and has been previously set,
+ // hence do not allow color change
+ LOG4CXX_DEBUG(logger_, "Day Color Scheme change is rejected");
+ return false;
+ }
+ LOG4CXX_DEBUG(logger_, "Day Color Scheme change is allowed");
+ dcs_change_required_ = true;
+
+ return true;
+ };
+
+ const auto set_night_color_scheme = [&app, this]() -> bool {
+ if (!template_config_.keyExists(strings::night_color_scheme)) {
+ return false;
+ }
+ if (app.night_color_scheme(current_window_id_).getType() !=
+ smart_objects::SmartType_Null &&
+ template_config_[strings::night_color_scheme] !=
+ app.night_color_scheme(current_window_id_)) {
+ // Color scheme param exists and has been previously set,
+ // hence do not allow color change
+ LOG4CXX_DEBUG(logger_, "Night Color Scheme change is rejected");
+ return false;
+ }
+ LOG4CXX_DEBUG(logger_, "Night Color Scheme Change is allowed");
+ ncs_change_required_ = true;
+
+ return true;
+ };
+
+ const bool set_layout_result = set_window_layout();
+
+ if (set_layout_result) {
+ set_day_color_scheme();
+ set_night_color_scheme();
+ return true;
+ }
+
+ if (!template_config_.keyExists(strings::night_color_scheme) &&
+ !template_config_.keyExists(strings::day_color_scheme)) {
+ // In case current layout was not changed and day and night color
+ // schemes are absent in mobile message SDL has to forward message
+ // to HMI with the only layout even it was not changed
+ return true;
+ }
+
+ const bool set_schemes_result =
+ (set_day_color_scheme() && set_night_color_scheme());
+
+ return set_schemes_result;
+}
+
+void ShowRequest::ApplyTemplateConfigurationForApp(
+ mobile_apis::Result::eType result, application_manager::Application& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (helpers::Compare<mobile_apis::Result::eType, helpers::EQ, helpers::ONE>(
+ result,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WARNINGS)) {
+ if (layout_change_required_) {
+ const std::string new_layout =
+ template_config_[strings::template_layout].asString();
+ LOG4CXX_DEBUG(logger_, "New layout : " << new_layout << " is applied");
+ app.set_window_layout(current_window_id_, new_layout);
+
+ if (template_config_.keyExists(strings::day_color_scheme)) {
+ app.set_day_color_scheme(current_window_id_,
+ template_config_[strings::day_color_scheme]);
+ }
+
+ if (template_config_.keyExists(strings::night_color_scheme)) {
+ app.set_night_color_scheme(
+ current_window_id_, template_config_[strings::night_color_scheme]);
+ }
+
+ return;
+ }
+
+ if (dcs_change_required_) {
+ LOG4CXX_DEBUG(logger_, "New day color scheme is applied");
+ app.set_day_color_scheme(current_window_id_,
+ template_config_[strings::day_color_scheme]);
+ }
+
+ if (ncs_change_required_) {
+ LOG4CXX_DEBUG(logger_, "New night color scheme is applied");
+ app.set_night_color_scheme(current_window_id_,
+ template_config_[strings::night_color_scheme]);
+ }
+ }
+}
+
void ShowRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -138,12 +274,13 @@ void ShowRequest::Run() {
mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS;
if (((*message_)[strings::msg_params].keyExists(strings::graphic)) &&
((*message_)[strings::msg_params][strings::graphic][strings::value]
- .asString()).length()) {
+ .asString())
+ .length()) {
verification_result = MessageHelper::VerifyImage(
(*message_)[strings::msg_params][strings::graphic],
app,
application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, verification_result);
return;
@@ -155,7 +292,7 @@ void ShowRequest::Run() {
(*message_)[strings::msg_params][strings::secondary_graphic],
app,
application_manager_);
- if (mobile_apis::Result::SUCCESS != verification_result) {
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, verification_result);
return;
@@ -217,6 +354,14 @@ void ShowRequest::Run() {
HandleMetadata(strings::main_field_4, main_field_4_index, msg_params);
}
+ if ((*message_)[strings::msg_params].keyExists(strings::template_title)) {
+ msg_params[hmi_request::show_strings][index][hmi_request::field_name] =
+ static_cast<int32_t>(hmi_apis::Common_TextFieldName::templateTitle);
+ msg_params[hmi_request::show_strings][index][hmi_request::field_text] =
+ (*message_)[strings::msg_params][strings::template_title];
+ ++index;
+ }
+
if ((*message_)[strings::msg_params].keyExists(strings::media_clock)) {
msg_params[hmi_request::show_strings][index][hmi_request::field_name] =
static_cast<int32_t>(hmi_apis::Common_TextFieldName::mediaClock);
@@ -263,7 +408,7 @@ void ShowRequest::Run() {
app->UnsubscribeFromSoftButtons(function_id());
} else {
MessageHelper::SubscribeApplicationToSoftButton(
- (*message_)[strings::msg_params], app, function_id());
+ (*message_)[strings::msg_params], app, function_id(), window_id());
}
}
@@ -272,11 +417,38 @@ void ShowRequest::Run() {
(*message_)[strings::msg_params][strings::custom_presets];
}
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ const auto window_id =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ if (!app->WindowIdExists(window_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Window with id #" << window_id << " does not exist");
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return;
+ }
+ msg_params[strings::window_id] = window_id;
+ }
+
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::template_configuration)) {
+ template_config_ =
+ (*message_)[strings::msg_params][strings::template_configuration];
+ const bool result = CheckTemplateConfigurationForApp(*app);
+ if (!result) {
+ const char* info(
+ "Color schemes can not be changed without a new template set");
+ SendResponse(false, mobile_apis::Result::REJECTED, info);
+ return;
+ }
+ msg_params[strings::template_configuration] =
+ (*message_)[strings::msg_params][strings::template_configuration];
+ }
+
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_Show, &msg_params, true);
app_mngr::commands::MessageSharedPtr persistentData =
- new smart_objects::SmartObject(msg_params);
+ std::make_shared<smart_objects::SmartObject>(msg_params);
app->set_show_command(*persistentData);
}
@@ -285,6 +457,13 @@ void ShowRequest::on_event(const event_engine::Event& event) {
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
switch (event.id()) {
case hmi_apis::FunctionID::UI_Show: {
@@ -304,6 +483,9 @@ void ShowRequest::on_event(const event_engine::Event& event) {
}
mobile_apis::Result::eType converted_result_code =
MessageHelper::HMIToMobileResult(result_code);
+
+ ApplyTemplateConfigurationForApp(converted_result_code, *app);
+
if (mobile_apis::Result::SUCCESS == converted_result_code &&
mobile_apis::Result::INVALID_ENUM != core_result_code_) {
converted_result_code = core_result_code_;
@@ -354,6 +536,14 @@ bool ShowRequest::CheckStringsOfShowRequest() {
return false;
}
}
+ if ((*message_)[strings::msg_params].keyExists(strings::template_title)) {
+ str =
+ (*message_)[strings::msg_params][strings::template_title].asCharArray();
+ if (strlen(str) && !CheckSyntax(str)) {
+ LOG4CXX_ERROR(logger_, "Invalid templateTitle syntax check failed");
+ return false;
+ }
+ }
if ((*message_)[strings::msg_params].keyExists(strings::status_bar)) {
str = (*message_)[strings::msg_params][strings::status_bar].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
@@ -398,7 +588,8 @@ bool ShowRequest::CheckStringsOfShowRequest() {
if ((*message_)[strings::msg_params].keyExists(strings::secondary_graphic)) {
str = (*message_)[strings::msg_params][strings::secondary_graphic]
- [strings::value].asCharArray();
+ [strings::value]
+ .asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid secondary_graphic value syntax check failed");
@@ -410,4 +601,4 @@ bool ShowRequest::CheckStringsOfShowRequest() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc
index 4e167e7531..f5667189b7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_response.cc
@@ -32,8 +32,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/show_response.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
#include "interfaces/HMI_API.h"
namespace sdl_rpc_plugin {
@@ -63,4 +63,4 @@ void ShowResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
index 08b4775d3f..dd7b426b40 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
@@ -35,8 +35,8 @@
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
-#include "utils/helpers.h"
#include "config_profile/profile.h"
+#include "utils/helpers.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -116,6 +116,11 @@ void SliderRequest::Run() {
msg_params[strings::timeout] = default_timeout_;
}
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
+
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_Slider, &msg_params, true);
}
@@ -204,4 +209,4 @@ bool SliderRequest::IsWhiteSpaceExist() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc
index 4d6e714e88..4ac96a272e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_response.cc
@@ -61,4 +61,4 @@ void SliderResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc
index e14321c488..0730a8730f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc
@@ -31,8 +31,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string.h>
#include "sdl_rpc_plugin/commands/mobile/speak_request.h"
+#include <string.h>
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
@@ -84,9 +84,9 @@ void SpeakRequest::Run() {
MessageHelper::VerifyTtsFiles(tts_chunks, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
- LOG4CXX_ERROR(logger_,
- "MessageHelper::VerifyTtsFiles return "
- << verification_result);
+ LOG4CXX_ERROR(
+ logger_,
+ "MessageHelper::VerifyTtsFiles return " << verification_result);
SendResponse(false,
mobile_apis::Result::FILE_NOT_FOUND,
"One or more files needed for tts_chunks are not present");
@@ -181,4 +181,4 @@ bool SpeakRequest::IsWhiteSpaceExist() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc
index f57bd91cd5..69b04977ef 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_response.cc
@@ -32,8 +32,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/speak_response.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
#include "interfaces/HMI_API.h"
namespace sdl_rpc_plugin {
@@ -63,4 +63,4 @@ void SpeakResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
index 908a251962..1acb2a7438 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
@@ -32,6 +32,7 @@
*/
#include "sdl_rpc_plugin/commands/mobile/subscribe_button_request.h"
+#include "utils/semantic_version.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -65,7 +66,7 @@ void SubscribeButtonRequest::Run() {
return;
}
- const mobile_apis::ButtonName::eType btn_id =
+ mobile_apis::ButtonName::eType btn_id =
static_cast<mobile_apis::ButtonName::eType>(
(*message_)[str::msg_params][str::button_name].asInt());
@@ -76,7 +77,20 @@ void SubscribeButtonRequest::Run() {
return;
}
- if (!CheckHMICapabilities(btn_id)) {
+ if (app->msg_version() < utils::rpc_version_5 &&
+ btn_id == mobile_apis::ButtonName::OK && app->is_media_application()) {
+ bool ok_supported = CheckHMICapabilities(mobile_apis::ButtonName::OK);
+ bool play_pause_supported =
+ CheckHMICapabilities(mobile_apis::ButtonName::PLAY_PAUSE);
+ if (play_pause_supported) {
+ LOG4CXX_DEBUG(logger_, "Converting Legacy OK button to PLAY_PAUSE");
+ btn_id = mobile_apis::ButtonName::PLAY_PAUSE;
+ (*message_)[str::msg_params][str::button_name] = btn_id;
+ } else if (!ok_supported) {
+ LOG4CXX_ERROR(logger_, "OK button isn't allowed by HMI capabilities");
+ SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
+ }
+ } else if (!CheckHMICapabilities(btn_id)) {
LOG4CXX_ERROR(logger_,
"Subscribe on button "
<< btn_id << " isn't allowed by HMI capabilities");
@@ -105,12 +119,33 @@ bool SubscribeButtonRequest::Init() {
bool SubscribeButtonRequest::IsSubscriptionAllowed(
ApplicationSharedPtr app, mobile_apis::ButtonName::eType btn_id) {
if (!app->is_media_application() &&
- ((mobile_apis::ButtonName::SEEKLEFT == btn_id) ||
+ ((mobile_apis::ButtonName::PLAY_PAUSE == btn_id) ||
+ (mobile_apis::ButtonName::SEEKLEFT == btn_id) ||
(mobile_apis::ButtonName::SEEKRIGHT == btn_id) ||
(mobile_apis::ButtonName::TUNEUP == btn_id) ||
(mobile_apis::ButtonName::TUNEDOWN == btn_id))) {
return false;
}
+
+ if (!app->is_navi() &&
+ ((mobile_apis::ButtonName::NAV_CENTER_LOCATION == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ZOOM_IN == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ZOOM_OUT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_TILT_TOGGLE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ROTATE_CLOCKWISE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ROTATE_COUNTERCLOCKWISE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_HEADING_TOGGLE == btn_id))) {
+ return false;
+ }
+
return true;
}
@@ -129,4 +164,4 @@ void SubscribeButtonRequest::SendSubscribeButtonNotification() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc
index 1350cfb66e..e584f84f4c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_response.cc
@@ -70,4 +70,4 @@ void SubscribeButtonResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
index eb4ca42568..2ee7771833 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc
@@ -30,8 +30,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/application_manager.h"
#include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h"
+#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
namespace sdl_rpc_plugin {
@@ -120,4 +120,4 @@ bool SubscribeWayPointsRequest::Init() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc
index 7d051df7e9..45486792d7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_response.cc
@@ -30,9 +30,9 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_response.h"
#include "application_manager/application_manager.h"
#include "application_manager/rpc_service.h"
-#include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_response.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -61,4 +61,4 @@ void SubscribeWayPointsResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
index 62eb2d59c5..033e70a29c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
@@ -33,19 +33,20 @@ Copyright (c) 2018, Ford Motor Company
#include "sdl_rpc_plugin/commands/mobile/system_request.h"
-#include <vector>
-#include <string>
#include <stdio.h>
#include <algorithm>
#include <sstream>
+#include <string>
+#include <vector>
#include "application_manager/policies/policy_handler_interface.h"
-#include "interfaces/MOBILE_API.h"
-#include "utils/file_system.h"
-#include "policy/policy_table/enums.h"
#include "formatters/CFormatterJsonBase.h"
+#include "interfaces/MOBILE_API.h"
#include "json/json.h"
-#include "utils/helpers.h"
+#include "policy/policy_table/enums.h"
#include "utils/custom_string.h"
+#include "utils/file_system.h"
+#include "utils/helpers.h"
+#include "utils/jsoncpp_reader_wrapper.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -170,17 +171,18 @@ class QueryAppsDataValidator {
<< "Package name length ["
<< app_data[json::android][json::packageName]
.asString()
- .length() << "] exceeds max length ["
- << kPackageNameLengthMax << "]in json file.");
+ .length()
+ << "] exceeds max length [" << kPackageNameLengthMax
+ << "]in json file.");
return false;
}
}
// Languages verification
if (!app_data[os_type].keyExists(json::languages)) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "'languages' doesn't exist");
+ LOG4CXX_WARN(
+ logger_,
+ kQueryAppsValidationFailedPrefix << "'languages' doesn't exist");
return false;
}
if (!ValidateLanguages(app_data[os_type][json::languages],
@@ -217,9 +219,9 @@ class QueryAppsDataValidator {
ApplicationSharedPtr registered_app =
manager_.application_by_policy_id(app_id);
if (registered_app) {
- LOG4CXX_INFO(logger_,
- "Application with the id: " << app_id
- << " is already registered.");
+ LOG4CXX_INFO(
+ logger_,
+ "Application with the id: " << app_id << " is already registered.");
}
// And app name length
const std::string appName(app_data[json::name].asString());
@@ -250,9 +252,9 @@ class QueryAppsDataValidator {
for (size_t idx = 0; idx < languages_array_size; ++idx) {
const smart_objects::SmartObject& language = languages.getElement(idx);
if (smart_objects::SmartType_Map != language.getType()) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "language is not a map.");
+ LOG4CXX_WARN(
+ logger_,
+ kQueryAppsValidationFailedPrefix << "language is not a map.");
return false;
}
if (language.length() != 1) {
@@ -263,9 +265,9 @@ class QueryAppsDataValidator {
}
const std::string language_name = (*language.map_begin()).first;
if (!language_name.length()) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "language name is empty");
+ LOG4CXX_WARN(
+ logger_,
+ kQueryAppsValidationFailedPrefix << "language name is empty");
return false;
}
// Verify default language defined
@@ -329,9 +331,9 @@ class QueryAppsDataValidator {
const smart_objects::SmartArray* synonyms_array =
language[language_name][json::vrSynonyms].asArray();
if (!synonyms_array) {
- LOG4CXX_WARN(logger_,
- kQueryAppsValidationFailedPrefix
- << "vrSynonyms is not array.");
+ LOG4CXX_WARN(
+ logger_,
+ kQueryAppsValidationFailedPrefix << "vrSynonyms is not array.");
return false;
}
const size_t synonyms_array_size = synonyms_array->size();
@@ -421,7 +423,7 @@ class QueryAppsDataValidator {
DISALLOW_COPY_AND_ASSIGN(QueryAppsDataValidator);
};
-}
+} // namespace
namespace commands {
@@ -452,7 +454,7 @@ void SystemRequest::Run() {
ApplicationSharedPtr application =
application_manager_.application(connection_key());
- if (!(application.valid())) {
+ if (application.use_count() == 0) {
LOG4CXX_ERROR(logger_, "NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
@@ -469,8 +471,8 @@ void SystemRequest::Run() {
static_cast<rpc::policy_table_interface_base::RequestType>(
request_type));
- if (!policy_handler.IsRequestTypeAllowed(application->policy_app_id(),
- request_type)) {
+ if (!policy_handler.IsRequestTypeAllowed(
+ application->device(), application->policy_app_id(), request_type)) {
LOG4CXX_ERROR(logger_,
"RequestType " << stringified_request_type
<< " is DISALLOWED by policies");
@@ -511,7 +513,8 @@ void SystemRequest::Run() {
return;
}
- if (!file_system::IsFileNameValid(file_name)) {
+ if (!file_system::IsFileNameValid(file_name) &&
+ mobile_apis::RequestType::ICON_URL != request_type) {
const std::string err_msg = "Sync file name contains forbidden symbols.";
LOG4CXX_ERROR(logger_, err_msg);
SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
@@ -533,8 +536,22 @@ void SystemRequest::Run() {
std::string binary_data_folder;
if ((*message_)[strings::params].keyExists(strings::binary_data)) {
binary_data = (*message_)[strings::params][strings::binary_data].asBinary();
- binary_data_folder =
- application_manager_.get_settings().system_files_path();
+ if (mobile_apis::RequestType::ICON_URL == request_type) {
+ binary_data_folder =
+ application_manager_.get_settings().app_icons_folder();
+ // Use the URL file name to identify the policy id.
+ // Save the icon file with the policy id as the name.
+ file_name = application_manager_.PolicyIDByIconUrl(file_name);
+ if (file_name.empty()) {
+ const std::string err_msg = "Invalid file name";
+ SendResponse(false, mobile_apis::Result::INVALID_DATA, err_msg.c_str());
+ return;
+ }
+ LOG4CXX_DEBUG(logger_, "Got ICON_URL Request. File name: " << file_name);
+ } else {
+ binary_data_folder =
+ application_manager_.get_settings().system_files_path();
+ }
} else {
binary_data_folder =
application_manager_.get_settings().app_storage_folder();
@@ -581,6 +598,12 @@ void SystemRequest::Run() {
LOG4CXX_DEBUG(logger_, "Binary data ok.");
+ if (mobile_apis::RequestType::ICON_URL == request_type) {
+ application_manager_.SetIconFileFromSystemRequest(file_name);
+ SendResponse(true, mobile_apis::Result::SUCCESS);
+ return;
+ }
+
if (mobile_apis::RequestType::HTTP == request_type &&
(*message_)[strings::msg_params].keyExists(strings::file_name)) {
const std::string& file =
@@ -589,18 +612,22 @@ void SystemRequest::Run() {
SendResponse(true, mobile_apis::Result::SUCCESS);
return;
} else if (mobile_apis::RequestType::QUERY_APPS == request_type) {
- using namespace NsSmartDeviceLink::NsJSONHandler::Formatters;
+ using namespace ns_smart_device_link::ns_json_handler::formatters;
+ application_manager_.OnQueryAppsRequest(application->device());
- smart_objects::SmartObject sm_object;
- Json::Reader reader;
+ utils::JsonReader reader;
std::string json(binary_data.begin(), binary_data.end());
Json::Value root;
- if (!reader.parse(json.c_str(), root)) {
- LOG4CXX_DEBUG(logger_, "Unable to parse query_app json file.");
+
+ if (!reader.parse(json, &root)) {
+ LOG4CXX_DEBUG(logger_, "Unable to parse query_app json file. ");
return;
}
+ smart_objects::SmartObject sm_object;
+
CFormatterJsonBase::jsonValueToObj(root, sm_object);
+
if (!ValidateQueryAppData(sm_object)) {
SendResponse(false, mobile_apis::Result::GENERIC_ERROR);
return;
@@ -655,7 +682,7 @@ void SystemRequest::on_event(const event_engine::Event& event) {
ApplicationSharedPtr application =
application_manager_.application(connection_key());
- if (!(application.valid())) {
+ if (application.use_count() == 0) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
@@ -678,9 +705,9 @@ void SystemRequest::on_event(const event_engine::Event& event) {
bool SystemRequest::ValidateQueryAppData(
smart_objects::SmartObject& data) const {
if (!data.isValid()) {
- LOG4CXX_ERROR(logger_,
- kQueryAppsValidationFailedPrefix
- << "QueryApps response is not valid.");
+ LOG4CXX_ERROR(
+ logger_,
+ kQueryAppsValidationFailedPrefix << "QueryApps response is not valid.");
return false;
}
if (!data.keyExists(json::response)) {
@@ -697,4 +724,4 @@ bool SystemRequest::ValidateQueryAppData(
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc
index dc2e3ea3f5..428901a1c5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_response.cc
@@ -61,4 +61,4 @@ void SystemResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc
index 9119fb48da..3ba0513aeb 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_request.cc
@@ -32,8 +32,8 @@
*/
#include "sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -62,4 +62,4 @@ void UnregisterAppInterfaceRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc
index 4e7c879b58..7c90639968 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unregister_app_interface_response.cc
@@ -45,4 +45,4 @@ void UnregisterAppInterfaceResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
index 6537f0e7b2..ec8de68c9e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc
@@ -34,6 +34,7 @@
#include "sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h"
#include "application_manager/application_impl.h"
+#include "utils/semantic_version.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -67,11 +68,24 @@ void UnsubscribeButtonRequest::Run() {
return;
}
- const mobile_apis::ButtonName::eType btn_id =
+ mobile_apis::ButtonName::eType btn_id =
static_cast<mobile_apis::ButtonName::eType>(
(*message_)[str::msg_params][str::button_name].asInt());
- if (!CheckHMICapabilities(btn_id)) {
+ if (app->msg_version() < utils::rpc_version_5 &&
+ btn_id == mobile_apis::ButtonName::OK && app->is_media_application()) {
+ bool ok_supported = CheckHMICapabilities(mobile_apis::ButtonName::OK);
+ bool play_pause_supported =
+ CheckHMICapabilities(mobile_apis::ButtonName::PLAY_PAUSE);
+ if (play_pause_supported) {
+ LOG4CXX_DEBUG(logger_, "Converting Legacy OK button to PLAY_PAUSE");
+ btn_id = mobile_apis::ButtonName::PLAY_PAUSE;
+ (*message_)[str::msg_params][str::button_name] = btn_id;
+ } else if (!ok_supported) {
+ LOG4CXX_ERROR(logger_, "OK button isn't allowed by HMI capabilities");
+ SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
+ }
+ } else if (!CheckHMICapabilities(btn_id)) {
LOG4CXX_ERROR(logger_,
"Button " << btn_id << " isn't allowed by HMI capabilities");
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
@@ -80,7 +94,7 @@ void UnsubscribeButtonRequest::Run() {
if (!app->UnsubscribeFromButton(
static_cast<mobile_apis::ButtonName::eType>(btn_id))) {
- LOG4CXX_ERROR(logger_, "App doesn't subscibe to button " << btn_id);
+ LOG4CXX_ERROR(logger_, "App doesn't subscribe to button " << btn_id);
SendResponse(false, mobile_apis::Result::IGNORED);
return;
}
@@ -109,4 +123,4 @@ void UnsubscribeButtonRequest::SendUnsubscribeButtonNotification() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc
index 592b91851e..c69d49bca1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_response.cc
@@ -71,4 +71,4 @@ void UnsubscribeButtonResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
index 0d0836878f..17326a99a0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc
@@ -30,8 +30,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/application_manager.h"
#include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h"
+#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
namespace sdl_rpc_plugin {
@@ -39,7 +39,7 @@ using namespace application_manager;
namespace commands {
-UnSubscribeWayPointsRequest::UnSubscribeWayPointsRequest(
+UnsubscribeWayPointsRequest::UnsubscribeWayPointsRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
@@ -51,9 +51,9 @@ UnSubscribeWayPointsRequest::UnSubscribeWayPointsRequest(
hmi_capabilities,
policy_handler) {}
-UnSubscribeWayPointsRequest::~UnSubscribeWayPointsRequest() {}
+UnsubscribeWayPointsRequest::~UnsubscribeWayPointsRequest() {}
-void UnSubscribeWayPointsRequest::Run() {
+void UnsubscribeWayPointsRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = application_manager_.application(connection_key());
@@ -71,18 +71,29 @@ void UnSubscribeWayPointsRequest::Run() {
return;
}
- StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
- SendHMIRequest(
- hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true);
+ std::set<uint32_t> subscribed_apps =
+ application_manager_.GetAppsSubscribedForWayPoints();
+
+ if (subscribed_apps.size() > 1) {
+ // More than 1 subscribed app, don't send HMI unsubscribe request
+ application_manager_.UnsubscribeAppFromWayPoints(app);
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL);
+ return;
+ } else {
+ // Only subscribed app, send HMI unsubscribe request
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
+ SendHMIRequest(
+ hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true);
+ }
}
-void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
+void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = application_manager_.application(connection_key());
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: {
- LOG4CXX_INFO(logger_, "Received Navigation_UnSubscribeWayPoints event");
+ LOG4CXX_INFO(logger_, "Received Navigation_UnsubscribeWayPoints event");
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation);
const hmi_apis::Common_Result::eType result_code =
static_cast<hmi_apis::Common_Result::eType>(
@@ -107,11 +118,11 @@ void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) {
}
}
-bool UnSubscribeWayPointsRequest::Init() {
+bool UnsubscribeWayPointsRequest::Init() {
hash_update_mode_ = HashUpdateMode::kDoHashUpdate;
return true;
}
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc
index 67e3466a44..a7a180fb46 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_response.cc
@@ -30,8 +30,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/application_manager.h"
#include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_response.h"
+#include "application_manager/application_manager.h"
#include "application_manager/rpc_service.h"
namespace sdl_rpc_plugin {
@@ -61,4 +61,4 @@ void UnsubscribeWayPointsResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
index 69379135b5..8c2cce9765 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc
@@ -31,14 +31,14 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include "sdl_rpc_plugin/commands/mobile/update_turn_list_request.h"
+#include <string>
-#include "application_manager/policies/policy_handler.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/policies/policy_handler.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
#include "utils/custom_string.h"
namespace sdl_rpc_plugin {
@@ -100,7 +100,7 @@ void UpdateTurnListRequest::Run() {
((*message_)[strings::msg_params][strings::turn_list]);
for (uint32_t i = 0; i < turn_list_array.length(); ++i) {
if ((turn_list_array[i].keyExists(strings::turn_icon)) &&
- (mobile_apis::Result::SUCCESS !=
+ (mobile_apis::Result::INVALID_DATA ==
MessageHelper::VerifyImage(turn_list_array[i][strings::turn_icon],
app,
application_manager_))) {
@@ -240,4 +240,4 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc
index 5ddf355f88..eca9e3703c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_response.cc
@@ -62,4 +62,4 @@ void UpdateTurnListResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc
new file mode 100644
index 0000000000..5ffbbd83bb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc
@@ -0,0 +1,98 @@
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+
+namespace sdl_rpc_plugin {
+CREATE_LOGGERPTR_GLOBAL(logger_, "GetSystemCapabilitiesAppExtension")
+
+namespace app_mngr_ = application_manager;
+const app_mngr_::AppExtensionUID
+ SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID = 200;
+
+SystemCapabilityAppExtension::SystemCapabilityAppExtension(
+ sdl_rpc_plugin::SDLRPCPlugin& plugin, app_mngr_::Application& app)
+ : app_mngr_::AppExtension(
+ SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID)
+ , plugin_(plugin)
+ , app_(app) {}
+
+SystemCapabilityAppExtension::~SystemCapabilityAppExtension() {}
+
+bool SystemCapabilityAppExtension::SubscribeTo(
+ const SystemCapabilityType system_capability_type) {
+ LOG4CXX_INFO(logger_,
+ "Subscribing to System Capability " << system_capability_type);
+ return subscribed_data_.insert(system_capability_type).second;
+}
+
+bool SystemCapabilityAppExtension::UnsubscribeFrom(
+ const SystemCapabilityType system_capability_type) {
+ LOG4CXX_INFO(
+ logger_,
+ "Unsubscribing from System Capability " << system_capability_type);
+ auto it = subscribed_data_.find(system_capability_type);
+ if (it != subscribed_data_.end()) {
+ subscribed_data_.erase(it);
+ return true;
+ }
+ return false;
+}
+
+void SystemCapabilityAppExtension::UnsubscribeFromAll() {
+ LOG4CXX_INFO(logger_, "Unsubscribing from ALL System Capabilities");
+ subscribed_data_.clear();
+}
+
+bool SystemCapabilityAppExtension::IsSubscribedTo(
+ const SystemCapabilityType system_capability_type) const {
+ LOG4CXX_DEBUG(logger_, system_capability_type);
+ return subscribed_data_.find(system_capability_type) !=
+ subscribed_data_.end();
+}
+
+SystemCapabilitySubscriptions SystemCapabilityAppExtension::Subscriptions() {
+ return subscribed_data_;
+}
+
+void SystemCapabilityAppExtension::SaveResumptionData(
+ ns_smart_device_link::ns_smart_objects::SmartObject& resumption_data) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const char* application_system_capability = "systemCapability";
+
+ resumption_data[application_system_capability] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ int i = 0;
+ for (const auto& subscription : subscribed_data_) {
+ resumption_data[application_system_capability][i] = subscription;
+ i++;
+ }
+}
+
+void SystemCapabilityAppExtension::ProcessResumption(
+ const smart_objects::SmartObject& resumption_data) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const char* application_system_capability = "systemCapability";
+ if (resumption_data.keyExists(application_system_capability)) {
+ const smart_objects::SmartObject& subscriptions =
+ resumption_data[application_system_capability];
+ for (size_t i = 0; i < subscriptions.length(); ++i) {
+ SystemCapabilityType capability_type =
+ static_cast<SystemCapabilityType>((resumption_data[i]).asInt());
+ SubscribeTo(capability_type);
+ }
+ }
+}
+
+SystemCapabilityAppExtension& SystemCapabilityAppExtension::ExtractExtension(
+ app_mngr_::Application& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto ext_ptr = app.QueryInterface(
+ SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID);
+ DCHECK(ext_ptr);
+ DCHECK(dynamic_cast<SystemCapabilityAppExtension*>(ext_ptr.get()));
+ auto app_extension =
+ std::static_pointer_cast<SystemCapabilityAppExtension>(ext_ptr);
+ DCHECK(app_extension);
+ return *app_extension;
+}
+} // namespace sdl_rpc_plugin \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
index 83edb76264..b89a8dbd68 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
@@ -35,245 +35,238 @@
#include "application_manager/message.h"
#include "interfaces/HMI_API.h"
-#include "sdl_rpc_plugin/commands/hmi/update_device_list_request.h"
-#include "sdl_rpc_plugin/commands/hmi/update_device_list_response.h"
-#include "sdl_rpc_plugin/commands/hmi/on_update_device_list.h"
-#include "sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h"
-#include "sdl_rpc_plugin/commands/hmi/update_app_list_request.h"
-#include "sdl_rpc_plugin/commands/hmi/update_app_list_response.h"
-#include "sdl_rpc_plugin/commands/hmi/on_find_applications.h"
+#include "sdl_rpc_plugin/commands/hmi/activate_app_request.h"
+#include "sdl_rpc_plugin/commands/hmi/activate_app_response.h"
#include "sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h"
#include "sdl_rpc_plugin/commands/hmi/allow_all_apps_response.h"
#include "sdl_rpc_plugin/commands/hmi/allow_app_request.h"
#include "sdl_rpc_plugin/commands/hmi/allow_app_response.h"
-#include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_request.h"
-#include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h"
-#include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_request.h"
-#include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h"
-#include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_request.h"
-#include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h"
-#include "sdl_rpc_plugin/commands/hmi/on_status_update_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/update_sdl_request.h"
-#include "sdl_rpc_plugin/commands/hmi/update_sdl_response.h"
-#include "sdl_rpc_plugin/commands/hmi/activate_app_request.h"
-#include "sdl_rpc_plugin/commands/hmi/activate_app_response.h"
+#include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h"
+#include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_response.h"
+#include "sdl_rpc_plugin/commands/hmi/close_popup_request.h"
+#include "sdl_rpc_plugin/commands/hmi/close_popup_response.h"
+#include "sdl_rpc_plugin/commands/hmi/get_system_info_request.h"
+#include "sdl_rpc_plugin/commands/hmi/get_system_info_response.h"
#include "sdl_rpc_plugin/commands/hmi/mixing_audio_supported_request.h"
#include "sdl_rpc_plugin/commands/hmi/mixing_audio_supported_response.h"
#include "sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_app_permission_changed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_sdl_consent_needed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_find_applications.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_put_file_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_resume_audio_source_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_sdl_consent_needed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h"
+#include "sdl_rpc_plugin/commands/hmi/on_status_update_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/get_system_info_request.h"
-#include "sdl_rpc_plugin/commands/hmi/get_system_info_response.h"
-#include "sdl_rpc_plugin/commands/hmi/close_popup_request.h"
-#include "sdl_rpc_plugin/commands/hmi/close_popup_response.h"
-#include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h"
-#include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_response.h"
+#include "sdl_rpc_plugin/commands/hmi/on_update_device_list.h"
+#include "sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_request.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_request.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_get_policy_configuration_data_response.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_request.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_request.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_response.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_response.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_language_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_language_response.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_response.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_is_ready_response.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_set_global_properties_response.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_speak_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_speak_response.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_stop_speaking_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_stop_speaking_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_add_command_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_add_command_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_delete_command_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_delete_command_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_add_submenu_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_alert_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_alert_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_change_registration_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_change_registration_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_create_window_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_create_window_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_delete_command_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_delete_command_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_delete_submenu_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_delete_submenu_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_get_language_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_get_language_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_get_capabilities_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_change_registration_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_change_registration_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_show_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_show_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_alert_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_alert_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_get_language_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_get_language_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_is_ready_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_slider_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_slider_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_global_properties_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_perform_interaction_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_perform_interaction_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_scrollable_message_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_set_app_icon_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_perform_interaction_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_perform_interaction_response.h"
-#include "sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h"
-#include "sdl_rpc_plugin/commands/hmi/vr_is_ready_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_global_properties_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_show_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_show_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_slider_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_slider_response.h"
+#include "sdl_rpc_plugin/commands/hmi/update_app_list_request.h"
+#include "sdl_rpc_plugin/commands/hmi/update_app_list_response.h"
+#include "sdl_rpc_plugin/commands/hmi/update_device_list_request.h"
+#include "sdl_rpc_plugin/commands/hmi/update_device_list_response.h"
+#include "sdl_rpc_plugin/commands/hmi/update_sdl_request.h"
+#include "sdl_rpc_plugin/commands/hmi/update_sdl_response.h"
#include "sdl_rpc_plugin/commands/hmi/vr_add_command_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_add_command_response.h"
-#include "sdl_rpc_plugin/commands/hmi/vr_delete_command_request.h"
-#include "sdl_rpc_plugin/commands/hmi/vr_delete_command_response.h"
#include "sdl_rpc_plugin/commands/hmi/vr_change_registration_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_change_registration_response.h"
-#include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h"
-#include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_response.h"
-#include "sdl_rpc_plugin/commands/hmi/vr_get_language_request.h"
-#include "sdl_rpc_plugin/commands/hmi/vr_get_language_response.h"
+#include "sdl_rpc_plugin/commands/hmi/vr_delete_command_request.h"
+#include "sdl_rpc_plugin/commands/hmi/vr_delete_command_response.h"
#include "sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_get_capabilities_response.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_is_ready_response.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_response.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_response.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_language_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_language_response.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_stop_speaking_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_stop_speaking_response.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_speak_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_speak_response.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_set_global_properties_response.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_response.h"
+#include "sdl_rpc_plugin/commands/hmi/vr_get_language_request.h"
+#include "sdl_rpc_plugin/commands/hmi/vr_get_language_response.h"
+#include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h"
+#include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_response.h"
+#include "sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h"
+#include "sdl_rpc_plugin/commands/hmi/vr_is_ready_response.h"
#include "sdl_rpc_plugin/commands/hmi/vr_perform_interaction_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_perform_interaction_response.h"
-#include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h"
-#include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h"
-#include "sdl_rpc_plugin/commands/hmi/on_app_permission_changed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h"
#ifdef EXTERNAL_PROPRIETARY_MODE
#include "sdl_rpc_plugin/commands/hmi/decrypt_certificate_request.h"
#include "sdl_rpc_plugin/commands/hmi/decrypt_certificate_response.h"
#endif // EXTERNAL_PROPRIETARY_MODE
-#ifdef HMI_DBUS_API
-#include "sdl_rpc_plugin/commands/hmi/vi_get_vehicle_data_request_template.h"
-#include "sdl_rpc_plugin/commands/hmi/vi_get_vehicle_data_response_template.h"
-#include "sdl_rpc_plugin/commands/hmi/vi_subscribe_vehicle_data_request_template.h"
-#include "sdl_rpc_plugin/commands/hmi/vi_subscribe_vehicle_data_response_template.h"
-#include "sdl_rpc_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h"
-#include "sdl_rpc_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h"
-#endif // #ifdef HMI_DBUS_API
-
+#include "sdl_rpc_plugin/commands/hmi/add_statistics_info_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h"
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h"
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h"
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h"
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_on_awake_sdl.h"
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h"
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_system_response.h"
+#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h"
+#include "sdl_rpc_plugin/commands/hmi/dial_number_response.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_request.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_response.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_response.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_request.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_response.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_get_way_points_request.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_get_way_points_response.h"
#include "sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_is_ready_response.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_send_location_request.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_send_location_response.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_set_video_config_response.h"
#include "sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_request.h"
#include "sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_response.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_is_ready_response.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_response.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_update_turn_list_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_update_turn_list_response.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_start_stream_response.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_stop_stream_request.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_stop_stream_response.h"
#include "sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h"
#include "sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_response.h"
#include "sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_request.h"
#include "sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_response.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_get_way_points_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_get_way_points_response.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ready_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_file_removed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_update_turn_list_request.h"
+#include "sdl_rpc_plugin/commands/hmi/navi_update_turn_list_response.h"
+#include "sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_app_registered_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_set_video_config_response.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_start_stream_response.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_stop_stream_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_stop_stream_response.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_response.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_response.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h"
+#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_file_removed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_policy_update.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ready_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h"
+#include "sdl_rpc_plugin/commands/hmi/on_record_start_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_persistence_complete_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_record_start_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/add_statistics_info_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_system_error_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h"
-#include "sdl_rpc_plugin/commands/hmi/basic_communication_system_response.h"
-#include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h"
-#include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h"
-#include "sdl_rpc_plugin/commands/hmi/basic_communication_on_awake_sdl.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update_response.h"
-#include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h"
-#include "sdl_rpc_plugin/commands/hmi/on_policy_update.h"
-#include "sdl_rpc_plugin/commands/hmi/get_urls.h"
-#include "sdl_rpc_plugin/commands/hmi/get_urls_response.h"
-#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_send_location_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_send_location_response.h"
-#include "sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h"
-#include "sdl_rpc_plugin/commands/hmi/dial_number_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h"
-#include "sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h"
-#include "sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h"
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h"
+#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h"
+#include "sdl_rpc_plugin/commands/hmi/on_service_update_notification.h"
#include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h"
#include "sdl_rpc_plugin/commands/hmi/rc_get_capabilities_response.h"
+#include "sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h"
+#include "sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h"
+
+#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h"
+
+#include "sdl_rpc_plugin/commands/hmi/bc_get_app_properties_request.h"
+#include "sdl_rpc_plugin/commands/hmi/bc_get_app_properties_response.h"
+#include "sdl_rpc_plugin/commands/hmi/bc_set_app_properties_request.h"
+#include "sdl_rpc_plugin/commands/hmi/bc_set_app_properties_response.h"
+#include "sdl_rpc_plugin/commands/hmi/on_app_properties_change_notification.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
+CREATE_LOGGERPTR_GLOBAL(logger_, "HMICommandFactory")
+
HMICommandFactory::HMICommandFactory(
ApplicationManager& application_manager,
rpc_service::RPCService& rpc_service,
@@ -317,7 +310,8 @@ bool HMICommandFactory::IsAbleToProcess(
return get_creator_factory(
static_cast<hmi_apis::FunctionID::eType>(function_id),
hmi_apis::messageType::INVALID_ENUM,
- message_source).CanBeCreated();
+ message_source)
+ .CanBeCreated();
}
CommandCreator& HMICommandFactory::get_creator_factory(
@@ -341,6 +335,13 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::ActivateAppRequest>()
: factory.GetCreator<commands::ActivateAppResponse>();
}
+ case hmi_apis::FunctionID::BasicCommunication_CloseApplication: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::BasicCommunicationCloseApplicationRequest>()
+ : factory.GetCreator<
+ commands::BasicCommunicationCloseApplicationResponse>();
+ }
#ifdef EXTERNAL_PROPRIETARY_MODE
case hmi_apis::FunctionID::BasicCommunication_DecryptCertificate: {
return hmi_apis::messageType::request == message_type
@@ -363,11 +364,6 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::SDLPolicyUpdate>()
: factory.GetCreator<commands::SDLPolicyUpdateResponse>();
}
- case hmi_apis::FunctionID::SDL_GetURLS: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::GetUrls>()
- : factory.GetCreator<commands::GetUrlsResponse>();
- }
case hmi_apis::FunctionID::SDL_OnAppPermissionChanged: {
return factory.GetCreator<commands::OnAppPermissionChangedNotification>();
}
@@ -390,6 +386,13 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::SDLGetStatusUpdateRequest>()
: factory.GetCreator<commands::SDLGetStatusUpdateResponse>();
}
+ case hmi_apis::FunctionID::SDL_GetPolicyConfigurationData: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::SDLGetPolicyConfigurationDataRequest>()
+ : factory.GetCreator<
+ commands::SDLGetPolicyConfigurationDataResponse>();
+ }
case hmi_apis::FunctionID::SDL_OnStatusUpdate: {
return factory.GetCreator<commands::OnStatusUpdateNotification>();
}
@@ -409,6 +412,11 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::UIAddCommandRequest>()
: factory.GetCreator<commands::UIAddCommandResponse>();
}
+ case hmi_apis::FunctionID::UI_CancelInteraction: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::UICancelInteractionRequest>()
+ : factory.GetCreator<commands::UICancelInteractionResponse>();
+ }
case hmi_apis::FunctionID::UI_DeleteCommand: {
return hmi_apis::messageType::request == message_type
? factory.GetCreator<commands::UIDeleteCommandRequest>()
@@ -424,6 +432,16 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::UIDeleteSubmenuRequest>()
: factory.GetCreator<commands::UIDeleteSubmenuResponse>();
}
+ case hmi_apis::FunctionID::UI_ShowAppMenu: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::UIShowAppMenuRequest>()
+ : factory.GetCreator<commands::UIShowAppMenuResponse>();
+ }
+ case hmi_apis::FunctionID::UI_DeleteWindow: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::UIDeleteWindowRequest>()
+ : factory.GetCreator<commands::UIDeleteWindowResponse>();
+ }
case hmi_apis::FunctionID::UI_SetMediaClockTimer: {
return hmi_apis::messageType::request == message_type
? factory.GetCreator<commands::UISetMediaClockTimerRequest>()
@@ -472,6 +490,11 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::UIChangeRegistrationRequest>()
: factory.GetCreator<commands::UIChangeRegistratioResponse>();
}
+ case hmi_apis::FunctionID::UI_CreateWindow: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::UICreateWindowRequest>()
+ : factory.GetCreator<commands::UICreateWindowResponse>();
+ }
case hmi_apis::FunctionID::UI_PerformAudioPassThru: {
return hmi_apis::messageType::request == message_type
? factory.GetCreator<commands::UIPerformAudioPassThruRequest>()
@@ -603,229 +626,6 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::UIIsReadyRequest>()
: factory.GetCreator<commands::UIIsReadyResponse>();
}
-#ifdef HMI_DBUS_API
- case hmi_apis::FunctionID::VehicleInfo_GetGpsData: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetGpsData> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetGpsData> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetSpeed: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetSpeed> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetSpeed> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetRpm: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehitcleInfo_GetRpm> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetRpm> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetFuelLevel: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevel> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevel> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetFuelLevelState> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetInstantFuelConsumption> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetInstantFuelConsumption> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetExternalTemperature> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetExternalTemperature> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetPrndl: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetPrndl> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetPrndl> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetVin: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetVin> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetVin> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetTirePressure: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetTirePressure> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetTirePressure> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetOdometer: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetOdometer> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetOdometer> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetBeltStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetBeltStatus> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetBeltStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetBodyInformation: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetBodyInformation> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetBodyInformation> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetDeviceStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetDriverBraking: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetDriverBraking> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetDriverBraking> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetWiperStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetWiperStatus> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetWiperStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetHeadLampStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetEngineTorque: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetEngineTorque> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetEngineTorque> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetAccPedalPosition> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetAccPedalPosition> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetSteeringWheelAngle> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetSteeringWheelAngle> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetECallInfo: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetECallInfo> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetECallInfo> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetAirbagStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetEmergencyEvent> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetClusterModeStatus> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_GetClusterModeStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_GetMyKey: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::VIGetVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetMyKey> >()
- : factory
- .GetCreator<commands::VIGetVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_GetMyKey> >();
- }
-#endif // #ifdef HMI_DBUS_API
case hmi_apis::FunctionID::Navigation_IsReady: {
return hmi_apis::messageType::request == message_type
? factory.GetCreator<commands::NaviIsReadyRequest>()
@@ -860,7 +660,7 @@ CommandCreator& HMICommandFactory::get_creator_factory(
case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: {
return hmi_apis::messageType::request == message_type
? factory
- .GetCreator<commands::NaviUnSubscribeWayPointsRequest>()
+ .GetCreator<commands::NaviUnsubscribeWayPointsRequest>()
: factory.GetCreator<
commands::NaviUnsubscribeWayPointsResponse>();
}
@@ -955,610 +755,6 @@ CommandCreator& HMICommandFactory::get_creator_factory(
return factory
.GetCreator<commands::hmi::OnButtonSubscriptionNotification>();
}
-#ifdef HMI_DBUS_API
- case hmi_apis::FunctionID::VehicleInfo_SubscribeGps: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_SubscribeGps> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_SubscribeGps> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeSpeed> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeRpm: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_SubscribeRpm> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_SubscribeRpm> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeFuelLevel> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeFuelLevel> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeFuelLevel_State> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeFuelLevel_State> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeInstantFuelConsumption> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeInstantFuelConsumption> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeExternalTemperature> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeExternalTemperature> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribePrndl: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_SubscribePrndl> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribePrndl> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeVin: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_SubscribeVin> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::VehicleInfo_SubscribeVin> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeTirePressure> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeTirePressure> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeOdometer> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeOdometer> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeBeltStatus> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeBeltStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeBodyInformation> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeBodyInformation> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeDeviceStatus> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeDeviceStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeDriverBraking> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeDriverBraking> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeWiperStatus> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeWiperStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeHeadLampStatus> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeHeadLampStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeEngineTorque> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeEngineTorque> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeAccPedalPosition> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeAccPedalPosition> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeSteeringWheelAngle> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeSteeringWheelAngle> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeECallInfo> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeECallInfo> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeAirbagStatus> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeAirbagStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeEmergencyEvent> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeEmergencyEvent> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeClusterModeStatus> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeClusterModeStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VISubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey> >()
- : factory.GetCreator<
- commands::VISubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_SubscribeMyKey> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator <
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps>()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeGps> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeSpeed> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeSpeed> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeRpm> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeFuelLevel> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeFuelLevel> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeFuelLevel_State> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeFuelLevel_State> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeInstantFuelConsumption> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeInstantFuelConsumption> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeExternalTemperature> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeExternalTemperature> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribePrndl> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribePrndl> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeVin> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeTirePressure> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeTirePressure> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeOdometer> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeOdometer> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeBeltStatus> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeBeltStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeBodyInformation> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeBodyInformation> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeDeviceStatus> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeDeviceStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeDriverBraking> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeDriverBraking> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeWiperStatus> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeWiperStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeHeadLampStatus> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeHeadLampStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeEngineTorque> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeEngineTorque> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeAccPedalPosition> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeAccPedalPosition> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeSteeringWheelAngle> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeSteeringWheelAngle> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeECallInfo> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeECallInfo> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeAirbagStatus> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeAirbagStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeEmergencyEvent> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeEmergencyEvent> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<
- commands::VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeClusterModeStatus> >()
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeClusterModeStatus> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey: {
- return hmi_apis::messageType::request == message_type
- ? factory.GetCreator<commands::>(
- VIUnsubscribeVehicleDataRequestTemplate<
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey>)
- : factory.GetCreator<
- commands::VIUnsubscribeVehicleDataResponseTemplate<
- hmi_apis::FunctionID::
- VehicleInfo_UnsubscribeMyKey> >();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnGpsData: {
- return factory.GetCreator<commands::OnVIGpsDataNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnSpeed: {
- return factory.GetCreator<commands::OnVISpeedNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnRpm: {
- return factory.GetCreator<commands::OnVIRpmNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnFuelLevel: {
- return factory.GetCreator<commands::OnVifuelLevelNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnFuelLevelState: {
- return factory.GetCreator<commands::OnVifuelLevelStateNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnInstantFuelConsumption: {
- return factory
- .GetCreator<commands::OnVIInstantFuelConsumptionNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnExternalTemperature: {
- return factory
- .GetCreator<commands::OnVIExternalTemperatureNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnVin: {
- return factory.GetCreator<commands::OnVIVinNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnPrndl: {
- return factory.GetCreator<commands::OnVIPrndlNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnTirePressure: {
- return factory.GetCreator<commands::OnVITirePressureNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnOdometer: {
- return factory.GetCreator<commands::OnVIOdometerNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnBeltStatus: {
- return factory.GetCreator<commands::OnVIBeltStatusNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnBodyInformation: {
- return factory.GetCreator<commands::OnVIBodyInformationNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnDeviceStatus: {
- return factory.GetCreator<commands::OnVIDeviceStatusNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnDriverBraking: {
- return factory.GetCreator<commands::OnVIDriverBrakingNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnWiperStatus: {
- return factory.GetCreator<commands::OnVIWiperStatusNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnHeadLampStatus: {
- return factory.GetCreator<commands::OnVIHeadLampStatusNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnEngineTorque: {
- return factory.GetCreator<commands::OnVIEngineTorqueNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnAccPedalPosition: {
- return factory.GetCreator<commands::OnVIAccPedalPositionNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnSteeringWheelAngle: {
- return factory.GetCreator<commands::OnVISteeringWheelAngleNotification>();
- }
- case hmi_apis::FunctionID::VehicleInfo_OnMyKey: {
- return factory.GetCreator<commands::OnVIMyKeyNotification>();
- }
-#endif // #ifdef HMI_DBUS_API
case hmi_apis::FunctionID::Navigation_OnTBTClientState: {
return factory.GetCreator<commands::OnNaviTBTClientStateNotification>();
}
@@ -1679,6 +875,9 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::hmi::DialNumberRequest>()
: factory.GetCreator<commands::hmi::DialNumberResponse>();
}
+ case hmi_apis::FunctionID::BasicCommunication_OnServiceUpdate: {
+ return factory.GetCreator<commands::hmi::OnServiceUpdateNotification>();
+ }
case hmi_apis::FunctionID::Navigation_OnWayPointChange: {
return factory.GetCreator<commands::OnNaviWayPointChangeNotification>();
}
@@ -1697,8 +896,35 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::UISendHapticDataRequest>()
: factory.GetCreator<commands::UISendHapticDataResponse>();
}
+ case hmi_apis::FunctionID::BasicCommunication_GetFilePath: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::BCGetFilePathRequest>()
+ : factory.GetCreator<commands::BCGetFilePathResponse>();
+ }
+ case hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated: {
+ return (application_manager::commands::Command::CommandSource::
+ SOURCE_HMI == source)
+ ? factory.GetCreator<
+ commands::
+ OnBCSystemCapabilityUpdatedNotificationFromHMI>()
+ : factory.GetCreator<
+ commands::OnBCSystemCapabilityUpdatedNotification>();
+ }
+ case hmi_apis::FunctionID::BasicCommunication_GetAppProperties: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::BCGetAppPropertiesRequest>()
+ : factory.GetCreator<commands::BCGetAppPropertiesResponse>();
+ }
+ case hmi_apis::FunctionID::BasicCommunication_SetAppProperties: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::BCSetAppPropertiesRequest>()
+ : factory.GetCreator<commands::BCSetAppPropertiesResponse>();
+ }
+ case hmi_apis::FunctionID::BasicCommunication_OnAppPropertiesChange: {
+ return factory.GetCreator<commands::OnAppPropertiesChangeNotification>();
+ }
default: { return factory.GetCreator<InvalidCommand>(); }
}
}
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
index d27161ff77..c6f4b64636 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
@@ -31,29 +31,44 @@
*/
#include "sdl_rpc_plugin/mobile_command_factory.h"
+#include "interfaces/MOBILE_API.h"
#include "sdl_rpc_plugin/commands/mobile/add_command_request.h"
#include "sdl_rpc_plugin/commands/mobile/add_command_response.h"
-#include "sdl_rpc_plugin/commands/mobile/delete_command_request.h"
-#include "sdl_rpc_plugin/commands/mobile/delete_command_response.h"
#include "sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h"
#include "sdl_rpc_plugin/commands/mobile/add_sub_menu_response.h"
-#include "sdl_rpc_plugin/commands/mobile/alert_request.h"
-#include "sdl_rpc_plugin/commands/mobile/alert_response.h"
#include "sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h"
#include "sdl_rpc_plugin/commands/mobile/alert_maneuver_response.h"
+#include "sdl_rpc_plugin/commands/mobile/alert_request.h"
+#include "sdl_rpc_plugin/commands/mobile/alert_response.h"
+#include "sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h"
+#include "sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h"
#include "sdl_rpc_plugin/commands/mobile/change_registration_request.h"
#include "sdl_rpc_plugin/commands/mobile/change_registration_response.h"
+#include "sdl_rpc_plugin/commands/mobile/close_application_request.h"
+#include "sdl_rpc_plugin/commands/mobile/close_application_response.h"
#include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h"
#include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_response.h"
+#include "sdl_rpc_plugin/commands/mobile/create_window_request.h"
+#include "sdl_rpc_plugin/commands/mobile/create_window_response.h"
+#include "sdl_rpc_plugin/commands/mobile/delete_command_request.h"
+#include "sdl_rpc_plugin/commands/mobile/delete_command_response.h"
#include "sdl_rpc_plugin/commands/mobile/delete_file_request.h"
#include "sdl_rpc_plugin/commands/mobile/delete_file_response.h"
#include "sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h"
#include "sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_response.h"
#include "sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h"
#include "sdl_rpc_plugin/commands/mobile/delete_sub_menu_response.h"
+#include "sdl_rpc_plugin/commands/mobile/delete_window_request.h"
+#include "sdl_rpc_plugin/commands/mobile/delete_window_response.h"
+#include "sdl_rpc_plugin/commands/mobile/dial_number_request.h"
+#include "sdl_rpc_plugin/commands/mobile/dial_number_response.h"
#include "sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h"
#include "sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_response.h"
#include "sdl_rpc_plugin/commands/mobile/generic_response.h"
+#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h"
+#include "sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_response.h"
+#include "sdl_rpc_plugin/commands/mobile/get_file_request.h"
+#include "sdl_rpc_plugin/commands/mobile/get_file_response.h"
#include "sdl_rpc_plugin/commands/mobile/get_system_capability_request.h"
#include "sdl_rpc_plugin/commands/mobile/get_system_capability_response.h"
#include "sdl_rpc_plugin/commands/mobile/get_way_points_request.h"
@@ -64,14 +79,18 @@
#include "sdl_rpc_plugin/commands/mobile/on_audio_pass_thru_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_button_event_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_button_press_notification.h"
+#include "sdl_rpc_plugin/commands/mobile/on_command_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_driver_distraction_notification.h"
+#include "sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_hmi_status_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_hmi_status_notification_from_mobile.h"
+#include "sdl_rpc_plugin/commands/mobile/on_keyboard_input_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/mobile/on_command_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_permissions_change_notification.h"
+#include "sdl_rpc_plugin/commands/mobile/on_system_capability_updated_notification.h"
+#include "sdl_rpc_plugin/commands/mobile/on_system_request_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_tbt_client_state_notification.h"
-#include "sdl_rpc_plugin/commands/mobile/on_hash_change_notification.h"
+#include "sdl_rpc_plugin/commands/mobile/on_touch_event_notification.h"
#include "sdl_rpc_plugin/commands/mobile/on_way_point_change_notification.h"
#include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h"
#include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_response.h"
@@ -85,14 +104,22 @@
#include "sdl_rpc_plugin/commands/mobile/reset_global_properties_response.h"
#include "sdl_rpc_plugin/commands/mobile/scrollable_message_request.h"
#include "sdl_rpc_plugin/commands/mobile/scrollable_message_response.h"
+#include "sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h"
+#include "sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h"
+#include "sdl_rpc_plugin/commands/mobile/send_location_request.h"
+#include "sdl_rpc_plugin/commands/mobile/send_location_response.h"
+#include "sdl_rpc_plugin/commands/mobile/set_app_icon_request.h"
+#include "sdl_rpc_plugin/commands/mobile/set_app_icon_response.h"
+#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h"
+#include "sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_response.h"
#include "sdl_rpc_plugin/commands/mobile/set_display_layout_request.h"
#include "sdl_rpc_plugin/commands/mobile/set_display_layout_response.h"
#include "sdl_rpc_plugin/commands/mobile/set_global_properties_request.h"
#include "sdl_rpc_plugin/commands/mobile/set_global_properties_response.h"
-#include "sdl_rpc_plugin/commands/mobile/set_app_icon_request.h"
-#include "sdl_rpc_plugin/commands/mobile/set_app_icon_response.h"
#include "sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h"
#include "sdl_rpc_plugin/commands/mobile/set_media_clock_timer_response.h"
+#include "sdl_rpc_plugin/commands/mobile/show_app_menu_request.h"
+#include "sdl_rpc_plugin/commands/mobile/show_app_menu_response.h"
#include "sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h"
#include "sdl_rpc_plugin/commands/mobile/show_constant_tbt_response.h"
#include "sdl_rpc_plugin/commands/mobile/show_request.h"
@@ -105,39 +132,26 @@
#include "sdl_rpc_plugin/commands/mobile/subscribe_button_response.h"
#include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h"
#include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_response.h"
-#include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h"
-#include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_response.h"
+#include "sdl_rpc_plugin/commands/mobile/system_request.h"
+#include "sdl_rpc_plugin/commands/mobile/system_response.h"
#include "sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h"
#include "sdl_rpc_plugin/commands/mobile/unregister_app_interface_response.h"
#include "sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h"
#include "sdl_rpc_plugin/commands/mobile/unsubscribe_button_response.h"
+#include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h"
+#include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_response.h"
#include "sdl_rpc_plugin/commands/mobile/update_turn_list_request.h"
#include "sdl_rpc_plugin/commands/mobile/update_turn_list_response.h"
-#include "sdl_rpc_plugin/commands/mobile/system_request.h"
-#include "sdl_rpc_plugin/commands/mobile/system_response.h"
-#include "sdl_rpc_plugin/commands/mobile/on_keyboard_input_notification.h"
-#include "sdl_rpc_plugin/commands/mobile/on_touch_event_notification.h"
-#include "sdl_rpc_plugin/commands/mobile/on_system_request_notification.h"
-#include "sdl_rpc_plugin/commands/mobile/send_location_request.h"
-#include "sdl_rpc_plugin/commands/mobile/send_location_response.h"
-#include "sdl_rpc_plugin/commands/mobile/dial_number_request.h"
-#include "sdl_rpc_plugin/commands/mobile/dial_number_response.h"
-#include "sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h"
-#include "sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h"
-#include "interfaces/MOBILE_API.h"
-#include "utils/make_shared.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
namespace sdl_rpc_plugin {
using namespace application_manager;
-CommandCreator& MobileCommandFactory::get_creator_factory(
- mobile_apis::FunctionID::eType id,
- mobile_apis::messageType::eType message_type,
- app_mngr::commands::Command::CommandSource source) const {
+CommandCreator& MobileCommandFactory::get_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const {
CommandCreatorFactory factory(
application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
-
switch (id) {
case mobile_apis::FunctionID::RegisterAppInterfaceID: {
return mobile_api::messageType::request == message_type
@@ -166,6 +180,11 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::AddCommandRequest>()
: factory.GetCreator<commands::AddCommandResponse>();
}
+ case mobile_apis::FunctionID::CreateWindowID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::CreateWindowRequest>()
+ : factory.GetCreator<commands::CreateWindowResponse>();
+ }
case mobile_apis::FunctionID::DeleteCommandID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<commands::DeleteCommandRequest>()
@@ -176,12 +195,21 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::AddSubMenuRequest>()
: factory.GetCreator<commands::AddSubMenuResponse>();
}
-
case mobile_apis::FunctionID::DeleteSubMenuID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<commands::DeleteSubMenuRequest>()
: factory.GetCreator<commands::DeleteSubMenuResponse>();
}
+ case mobile_apis::FunctionID::ShowAppMenuID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::ShowAppMenuRequest>()
+ : factory.GetCreator<commands::ShowAppMenuResponse>();
+ }
+ case mobile_apis::FunctionID::DeleteWindowID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::DeleteWindowRequest>()
+ : factory.GetCreator<commands::DeleteWindowResponse>();
+ }
case mobile_apis::FunctionID::DeleteInteractionChoiceSetID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<
@@ -209,7 +237,11 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::PerformAudioPassThruRequest>()
: factory.GetCreator<commands::PerformAudioPassThruResponse>();
}
-
+ case mobile_apis::FunctionID::CancelInteractionID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::CancelInteractionRequest>()
+ : factory.GetCreator<commands::CancelInteractionResponse>();
+ }
case mobile_apis::FunctionID::CreateInteractionChoiceSetID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<
@@ -232,6 +264,11 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::PutFileRequest>()
: factory.GetCreator<commands::PutFileResponse>();
}
+ case mobile_apis::FunctionID::GetFileID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::GetFileRequest>()
+ : factory.GetCreator<commands::GetFileResponse>();
+ }
case mobile_apis::FunctionID::DeleteFileID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<commands::DeleteFileRequest>()
@@ -264,7 +301,7 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
}
case mobile_apis::FunctionID::GetWayPointsID: {
return mobile_api::messageType::request == message_type
- ? factory.GetCreator<commands::ShowConstantTBTRequest>()
+ ? factory.GetCreator<commands::GetWayPointsRequest>()
: factory.GetCreator<commands::GetWayPointsResponse>();
}
case mobile_apis::FunctionID::SubscribeWayPointsID: {
@@ -274,8 +311,8 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
}
case mobile_apis::FunctionID::UnsubscribeWayPointsID: {
return mobile_api::messageType::request == message_type
- ? factory.GetCreator<commands::ShowConstantTBTRequest>()
- : factory.GetCreator<commands::ShowConstantTBTResponse>();
+ ? factory.GetCreator<commands::UnsubscribeWayPointsRequest>()
+ : factory.GetCreator<commands::UnsubscribeWayPointsResponse>();
}
case mobile_apis::FunctionID::GetSystemCapabilityID: {
return mobile_api::messageType::request == message_type
@@ -287,7 +324,6 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::ScrollableMessageRequest>()
: factory.GetCreator<commands::ScrollableMessageResponse>();
}
-
case mobile_apis::FunctionID::AlertManeuverID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<commands::AlertManeuverRequest>()
@@ -338,6 +374,37 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
? factory.GetCreator<commands::SendHapticDataRequest>()
: factory.GetCreator<commands::SendHapticDataResponse>();
}
+ case mobile_apis::FunctionID::SetCloudAppPropertiesID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::SetCloudAppPropertiesRequest>()
+ : factory
+ .GetCreator<commands::SetCloudAppPropertiesResponse>();
+ }
+ case mobile_apis::FunctionID::GetCloudAppPropertiesID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::GetCloudAppPropertiesRequest>()
+ : factory
+ .GetCreator<commands::GetCloudAppPropertiesResponse>();
+ }
+ case mobile_apis::FunctionID::CloseApplicationID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::CloseApplicationRequest>()
+ : factory.GetCreator<commands::CloseApplicationResponse>();
+ }
+ case mobile_apis::FunctionID::GenericResponseID: {
+ using app_mngr::commands::Command;
+ return factory.GetCreator<commands::GenericResponse>();
+ }
+ default: {}
+ }
+ return factory.GetCreator<InvalidCommand>();
+}
+
+CommandCreator& MobileCommandFactory::get_notification_creator(
+ const mobile_apis::FunctionID::eType id) const {
+ CommandCreatorFactory factory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+ switch (id) {
case mobile_apis::FunctionID::OnButtonEventID: {
return factory.GetCreator<commands::mobile::OnButtonEventNotification>();
}
@@ -368,11 +435,7 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
return factory.GetCreator<commands::OnPermissionsChangeNotification>();
}
case mobile_apis::FunctionID::OnHMIStatusID: {
- using app_mngr::commands::Command;
- return Command::CommandSource::SOURCE_MOBILE == source
- ? factory.GetCreator<
- commands::OnHMIStatusNotificationFromMobile>()
- : factory.GetCreator<commands::OnHMIStatusNotification>();
+ return factory.GetCreator<commands::OnHMIStatusNotification>();
}
case mobile_apis::FunctionID::OnKeyboardInputID: {
return factory
@@ -381,24 +444,69 @@ CommandCreator& MobileCommandFactory::get_creator_factory(
case mobile_apis::FunctionID::OnTouchEventID: {
return factory.GetCreator<commands::mobile::OnTouchEventNotification>();
}
+ case mobile_apis::FunctionID::OnSystemCapabilityUpdatedID: {
+ return factory.GetCreator<
+ commands::mobile::OnSystemCapabilityUpdatedNotification>();
+ }
case mobile_apis::FunctionID::OnSystemRequestID: {
return factory
.GetCreator<commands::mobile::OnSystemRequestNotification>();
}
case mobile_apis::FunctionID::OnHashChangeID: {
- using app_mngr::commands::Command;
return factory.GetCreator<commands::mobile::OnHashChangeNotification>();
}
case mobile_apis::FunctionID::OnWayPointChangeID: {
- using app_mngr::commands::Command;
return factory.GetCreator<commands::OnWayPointChangeNotification>();
}
- case mobile_apis::FunctionID::GenericResponseID: {
- using app_mngr::commands::Command;
- return factory.GetCreator<commands::GenericResponse>();
+ default: {}
+ }
+ return factory.GetCreator<InvalidCommand>();
+}
+
+CommandCreator& MobileCommandFactory::get_notification_from_mobile_creator(
+ const mobile_apis::FunctionID::eType id) const {
+ CommandCreatorFactory factory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+ switch (id) {
+ case mobile_apis::FunctionID::OnHMIStatusID: {
+ return factory.GetCreator<commands::OnHMIStatusNotificationFromMobile>();
}
- default: { return factory.GetCreator<InvalidCommand>(); }
+ default: {}
}
+ return factory.GetCreator<InvalidCommand>();
+}
+
+CommandCreator& MobileCommandFactory::get_creator_factory(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const {
+ switch (message_type) {
+ case mobile_api::messageType::request: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) {
+ return get_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_api::messageType::response: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_api::messageType::notification: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_notification_creator(id);
+ } else if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE ==
+ source) {
+ return get_notification_from_mobile_creator(id);
+ }
+ break;
+ }
+ default: {}
+ }
+ CommandCreatorFactory factory(
+ application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
+ return factory.GetCreator<InvalidCommand>();
}
MobileCommandFactory::MobileCommandFactory(
@@ -415,11 +523,10 @@ bool MobileCommandFactory::IsAbleToProcess(
const int32_t function_id,
const application_manager::commands::Command::CommandSource message_source)
const {
- using app_mngr::commands::Command;
- return get_creator_factory(
- static_cast<mobile_apis::FunctionID::eType>(function_id),
- mobile_apis::messageType::INVALID_ENUM,
- message_source).CanBeCreated();
+ auto id = static_cast<mobile_apis::FunctionID::eType>(function_id);
+ return get_command_creator(id, mobile_apis::messageType::INVALID_ENUM)
+ .CanBeCreated() ||
+ get_notification_creator(id).CanBeCreated();
}
CommandSharedPtr MobileCommandFactory::CreateCommand(
@@ -440,4 +547,4 @@ CommandSharedPtr MobileCommandFactory::CreateCommand(
return get_creator_factory(function_id, message_type, source).create(message);
}
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc
index efdcde7526..21f15a33fe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_command_factory.cc
@@ -55,7 +55,8 @@ SDLCommandFactory::SDLCommandFactory(
app_mngr::CommandSharedPtr SDLCommandFactory::CreateCommand(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::commands::Command::CommandSource source) {
- if (app_mngr::commands::Command::SOURCE_HMI == source) {
+ if (app_mngr::commands::Command::SOURCE_HMI == source ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) {
return hmi_command_factory_->CreateCommand(message, source);
} else {
return mobile_command_factory_->CreateCommand(message, source);
@@ -70,9 +71,10 @@ bool SDLCommandFactory::IsAbleToProcess(
bool is_mobile_command_factory_able_to_process =
mobile_command_factory_->IsAbleToProcess(FunctionID, source);
- return app_mngr::commands::Command::SOURCE_HMI == source
+ return (app_mngr::commands::Command::SOURCE_HMI == source ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source)
? is_hmi_command_factory_able_to_process
: is_mobile_command_factory_able_to_process;
}
-} // namespace application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
index 22b818f5e0..2a1261f643 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
@@ -31,16 +31,34 @@
*/
#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+#include "application_manager/plugin_manager/plugin_keys.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
#include "sdl_rpc_plugin/sdl_command_factory.h"
namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
namespace plugins = application_manager::plugin_manager;
+CREATE_LOGGERPTR_GLOBAL(logger_, "SdlRPCPlugin")
+
+bool SDLRPCPlugin::Init(app_mngr::ApplicationManager& app_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) {
+ UNUSED(last_state);
+ command_factory_.reset(new sdl_rpc_plugin::SDLCommandFactory(
+ app_manager, rpc_service, hmi_capabilities, policy_handler));
+ return true;
+}
+
bool SDLRPCPlugin::Init(
application_manager::ApplicationManager& app_manager,
application_manager::rpc_service::RPCService& rpc_service,
application_manager::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler) {
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state) {
+ UNUSED(last_state);
command_factory_.reset(new sdl_rpc_plugin::SDLCommandFactory(
app_manager, rpc_service, hmi_capabilities, policy_handler));
return true;
@@ -48,28 +66,52 @@ bool SDLRPCPlugin::Init(
bool SDLRPCPlugin::IsAbleToProcess(
const int32_t function_id,
- const application_manager::commands::Command::CommandSource
- message_source) {
+ const app_mngr::commands::Command::CommandSource message_source) {
return command_factory_->IsAbleToProcess(function_id, message_source);
}
std::string SDLRPCPlugin::PluginName() {
- return "SDL RPC Plugin";
+ return plugins::plugin_names::sdl_rpc_plugin;
}
-application_manager::CommandFactory& SDLRPCPlugin::GetCommandFactory() {
+app_mngr::CommandFactory& SDLRPCPlugin::GetCommandFactory() {
return *command_factory_;
}
-void SDLRPCPlugin::OnPolicyEvent(
- application_manager::plugin_manager::PolicyEvent event) {}
+void SDLRPCPlugin::OnPolicyEvent(plugins::PolicyEvent event) {}
void SDLRPCPlugin::OnApplicationEvent(
- application_manager::plugin_manager::ApplicationEvent event,
- application_manager::ApplicationSharedPtr application) {}
+ plugins::ApplicationEvent event,
+ app_mngr::ApplicationSharedPtr application) {
+ if (plugins::ApplicationEvent::kApplicationRegistered == event) {
+ auto sys_cap_ext_ptr =
+ std::make_shared<SystemCapabilityAppExtension>(*this, *application);
+ application->AddExtension(sys_cap_ext_ptr);
+ // Processing automatic subscription to SystemCapabilities for DISPLAY type
+ const auto capability_type =
+ mobile_apis::SystemCapabilityType::eType::DISPLAYS;
+ LOG4CXX_DEBUG(logger_, "Subscription to DISPLAYS capability is enabled");
+ sys_cap_ext_ptr->SubscribeTo(capability_type);
+ } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) {
+ ClearSubscriptions(application);
+ }
+}
+
+void SDLRPCPlugin::ClearSubscriptions(app_mngr::ApplicationSharedPtr app) {
+ auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
+ ext.UnsubscribeFromAll();
+}
} // namespace sdl_rpc_plugin
-extern "C" application_manager::plugin_manager::RPCPlugin* Create() {
+extern "C" __attribute__((visibility("default")))
+application_manager::plugin_manager::RPCPlugin*
+Create() {
return new sdl_rpc_plugin::SDLRPCPlugin();
}
+
+extern "C" __attribute__((visibility("default"))) void Delete(
+ application_manager::plugin_manager::RPCPlugin* data) {
+ delete data;
+ DELETE_THREAD_LOGGER(sdl_rpc_plugin::logger_);
+}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
index da51c3e4e4..b21ab9dca8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
@@ -6,6 +6,7 @@ include_directories(
${COMPONENTS_DIR}/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/
${COMPONENTS_DIR}/application_manager/test/include/
${POLICY_MOCK_INCLUDE_PATH}/
+ ${CMAKE_SOURCE_DIR}/src
)
@@ -22,15 +23,8 @@ file(GLOB SOURCES
)
set(LIBRARIES
+ sdl_rpc_plugin_static
gmock
- Utils
- SmartObjects
- HMI_API
- MOBILE_API
- connectionHandler
- sdl_rpc_plugin
- jsoncpp
- Policy
)
create_cotired_test("sdl_commands_test" "${SOURCES}" "${LIBRARIES}" )
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc
index 8cb5e97891..7dadad59fe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc
@@ -30,13 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/activate_app_request.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/command_impl.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -45,17 +44,17 @@ namespace hmi_commands_test {
namespace activate_app_request {
using ::testing::_;
-using ::utils::SharedPtr;
+
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::ActivateAppRequest;
-using am::commands::CommandImpl;
using ::test::components::application_manager_test::MockApplication;
-typedef SharedPtr<MockApplication> MockAppPtr;
-typedef ::utils::SharedPtr<ActivateAppRequest> ActivateAppRequestPtr;
+typedef std::shared_ptr<MockApplication> MockAppPtr;
+typedef std::shared_ptr<ActivateAppRequest> ActivateAppRequestPtr;
MATCHER_P(CheckMessage, level, "") {
return level ==
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc
index d43d70b5ca..01487284a4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc
@@ -30,15 +30,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/add_statistics_info_notification.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
+#include "gtest/gtest.h"
+
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/policies/policy_handler.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/policies/policy_handler.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -49,16 +49,16 @@ namespace add_statistics_info_notification {
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_notification = ::application_manager::hmi_notification;
-using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::AddStatisticsInfoNotification;
using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
using policy::PolicyHandler;
using policy_test::MockPolicyHandlerInterface;
+using sdl_rpc_plugin::commands::AddStatisticsInfoNotification;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
-typedef ::utils::SharedPtr<AddStatisticsInfoNotification> NotificationPtr;
+typedef std::shared_ptr<AddStatisticsInfoNotification> NotificationPtr;
namespace {
const uint32_t kStatisticType = 1u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc
index 4b7fb0fc09..251fe230fc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/allow_all_apps_response.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
+#include "gtest/gtest.h"
+
#include "application_manager/commands/command_impl.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace commands_test {
@@ -49,11 +49,11 @@ using sdl_rpc_plugin::commands::AllowAllAppsResponse;
namespace strings = ::application_manager::strings;
namespace hmi_response = ::application_manager::hmi_response;
-typedef ::utils::SharedPtr<AllowAllAppsResponse> ResponsePtr;
+typedef std::shared_ptr<AllowAllAppsResponse> ResponsePtr;
namespace {
const bool kResponseIsAllowed = true;
-} //
+} // namespace
class AllowAllAppsResponseTest
: public CommandsTest<CommandsTestMocks::kIsNice> {};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc
index 3681bf01b6..a0e23d7b9d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/allow_app_response.h"
-#include "utils/shared_ptr.h"
+#include "gtest/gtest.h"
+
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
@@ -53,9 +53,9 @@ namespace hmi_response = ::application_manager::hmi_response;
namespace {
const uint32_t kConnectionKey = 1u;
const bool kIsResponseAllowed = true;
-}
+} // namespace
-typedef ::utils::SharedPtr<AllowAppResponse> ResponsePtr;
+typedef std::shared_ptr<AllowAppResponse> ResponsePtr;
class AllowAppResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> {};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc
index 78fec997e9..9cd87b053d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc
@@ -28,12 +28,12 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
-*/
+ */
#include "hmi/basic_communication_get_system_time_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
+
#include "application_manager/commands/command_request_test.h"
#include "protocol_handler/mock_protocol_handler.h"
@@ -60,7 +60,7 @@ TEST_F(BasicCommunicationGetSystemTimeRequestTest, OnTimeout) {
ON_CALL(app_mngr_, protocol_handler())
.WillByDefault(ReturnRef(mock_protocol_handler));
- EXPECT_CALL(mock_protocol_handler, NotifyOnFailedHandshake());
+ EXPECT_CALL(mock_protocol_handler, NotifyOnGetSystemTimeFailed());
command->onTimeOut();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc
index 8f56c6462c..0c8e986fc6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc
@@ -30,12 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "hmi/basic_communication_get_system_time_response.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "interfaces/HMI_API.h"
namespace test {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_get_app_properties_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_get_app_properties_request_test.cc
new file mode 100644
index 0000000000..0d70226645
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_get_app_properties_request_test.cc
@@ -0,0 +1,367 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/mock_application.h"
+#include "hmi/bc_get_app_properties_request.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace bc_get_app_properties_request_test {
+
+namespace am = ::application_manager;
+namespace strings = ::application_manager::strings;
+
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::BCGetAppPropertiesRequest;
+
+using testing::DoAll;
+using testing::Return;
+using testing::ReturnRef;
+using testing::SaveArg;
+
+namespace {
+const std::string kPolicyAppId = "00001";
+const uint32_t kCorrelationId = 1u;
+const auto kSource = am::commands::Command::SOURCE_HMI;
+
+const std::string kAuthToken = "auth_token";
+const std::string kCertificate = "certificate";
+const std::string kTransportType = "WS";
+const std::string kHybridAppPreference = "local_app";
+const bool kEnabled = true;
+
+const std::string kNickname1 = "nickname1";
+const std::string kNickname2 = "nickname2";
+} // namespace
+
+bool CompareAppProperties(const smart_objects::SmartObject& app_propersties_so,
+ const policy::AppProperties& app_properties) {
+ return (app_propersties_so[strings::auth_token].asString() ==
+ app_properties.auth_token) &&
+ (app_propersties_so[strings::transport_type].asString() ==
+ app_properties.transport_type) &&
+ (app_propersties_so[strings::hybrid_app_preference].asString() ==
+ app_properties.hybrid_app_preference);
+}
+
+bool CompareNicknames(const smart_objects::SmartObject& nicknames_so,
+ const policy::StringArray& nicknames) {
+ if (nicknames_so.length() != nicknames.size()) {
+ return false;
+ }
+
+ for (size_t i = 0; i < nicknames_so.length(); ++i) {
+ if (nicknames_so[i].asString() != nicknames[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+
+ACTION_P(SetTestAppProperties, app_properties) {
+ arg1 = app_properties;
+}
+
+ACTION_P(SetTestNickNames, nicknames) {
+ *arg1 = nicknames;
+}
+
+class BCGetAppPropertiesRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ BCGetAppPropertiesRequestTest() : mock_app_(CreateMockApp()) {
+ ON_CALL(app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ }
+
+ MockAppPtr mock_app_;
+};
+
+TEST_F(BCGetAppPropertiesRequestTest, Run_PolicyAppId_Exist_SUCCESS) {
+ auto msg = CreateMessage();
+
+ (*msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*msg)[strings::msg_params][strings::policy_app_id] = kPolicyAppId;
+ auto command = CreateCommand<BCGetAppPropertiesRequest>(msg);
+
+ // Fills app properties with default test values
+ EXPECT_CALL(mock_policy_handler_, GetAppProperties(kPolicyAppId, _))
+ .WillOnce(DoAll(
+ SetTestAppProperties(policy::AppProperties("",
+ kCertificate,
+ kEnabled,
+ kAuthToken,
+ kTransportType,
+ kHybridAppPreference)),
+ Return(true)));
+
+ // Fills app nicknames with default test values
+ EXPECT_CALL(mock_policy_handler_, GetInitialAppData(kPolicyAppId, _, _))
+ .WillOnce(
+ DoAll(SetTestNickNames(policy::StringArray{kNickname1, kNickname2}),
+ Return(true)));
+
+ auto message_to_hmi = CreateMessage();
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIMessageParametersAre(
+ kCorrelationId,
+ hmi_apis::FunctionID::BasicCommunication_GetAppProperties,
+ hmi_apis::Common_Result::SUCCESS),
+ kSource))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_hmi), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const smart_objects::SmartObject& sent_app_properties =
+ (*message_to_hmi)[strings::msg_params][strings::properties][0];
+
+ EXPECT_FALSE(sent_app_properties.empty());
+
+ const std::string auth_token =
+ sent_app_properties[strings::auth_token].asString();
+ const std::string transport_type =
+ sent_app_properties[strings::transport_type].asString();
+ const std::string hybrid_app_preference =
+ sent_app_properties[strings::hybrid_app_preference].asString();
+ // ENDPOINT should be omitted for local application properties.
+ EXPECT_FALSE(sent_app_properties.keyExists(strings::endpoint));
+
+ EXPECT_EQ(kAuthToken, auth_token);
+ EXPECT_EQ(kTransportType, transport_type);
+ EXPECT_EQ(kHybridAppPreference, hybrid_app_preference);
+
+ EXPECT_TRUE(sent_app_properties.keyExists(strings::nicknames));
+
+ const auto nick_names = sent_app_properties[strings::nicknames];
+ EXPECT_EQ(kNickname1, nick_names[0].asString());
+ EXPECT_EQ(kNickname2, nick_names[1].asString());
+}
+
+TEST_F(BCGetAppPropertiesRequestTest,
+ PolicyAppIdExistsInMessage_GetAppPropertiesFailed_UNSUCCESS) {
+ auto msg = CreateMessage();
+
+ (*msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*msg)[strings::msg_params][strings::policy_app_id] = kPolicyAppId;
+ auto command = CreateCommand<BCGetAppPropertiesRequest>(msg);
+
+ EXPECT_CALL(mock_policy_handler_, GetAppProperties(kPolicyAppId, _))
+ .WillOnce(Return(false));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIMessageParametersAre(
+ kCorrelationId,
+ hmi_apis::FunctionID::BasicCommunication_GetAppProperties,
+ hmi_apis::Common_Result::DATA_NOT_AVAILABLE),
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(
+ BCGetAppPropertiesRequestTest,
+ Run_PolicyAppIdIsAbsentInMessage_AppParametersAreAbsent_NickNamesAreAbsent_UNSUCCESS) {
+ auto msg = CreateMessage();
+
+ (*msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ auto command = CreateCommand<BCGetAppPropertiesRequest>(msg);
+
+ EXPECT_CALL(mock_policy_handler_, GetApplicationPolicyIDs())
+ .WillOnce(Return(policy::StringArray()));
+
+ EXPECT_CALL(mock_policy_handler_, GetAppProperties(_, _)).Times(0);
+ EXPECT_CALL(mock_policy_handler_, GetInitialAppData(_, _, _)).Times(0);
+
+ auto message_to_hmi = CreateMessage();
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIMessageParametersAre(
+ kCorrelationId,
+ hmi_apis::FunctionID::BasicCommunication_GetAppProperties,
+ hmi_apis::Common_Result::DATA_NOT_AVAILABLE),
+ Command::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_hmi), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ EXPECT_FALSE(
+ (*message_to_hmi)[strings::msg_params].keyExists(strings::properties));
+}
+
+TEST_F(BCGetAppPropertiesRequestTest,
+ Run_PolicyAppIdIsAbsentInMessage_ReturnsAllAppProperties_SUCCESS) {
+ auto msg = CreateMessage();
+
+ (*msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ auto command = CreateCommand<BCGetAppPropertiesRequest>(msg);
+
+ const std::string test_policy_app_id1 = "test_policy_app_id1";
+ const policy::AppProperties test_app1_properties("",
+ "cert1",
+ true,
+ "auth_token1",
+ "transport_type1",
+ "hybrid_app_preference1");
+ const policy::StringArray test_nicknames1{"nickname1", "nickname2"};
+
+ const std::string test_policy_app_id2 = "test_policy_app_id2";
+ const policy::AppProperties test_app2_properties("",
+ "cert2",
+ false,
+ "auth_token2",
+ "transport_type2",
+ "hybrid_app_preference2");
+ const policy::StringArray test_nicknames2{"nickname3", "nickname4"};
+
+ EXPECT_CALL(mock_policy_handler_, GetApplicationPolicyIDs())
+ .WillOnce(Return(
+ policy::StringArray{test_policy_app_id1, test_policy_app_id2}));
+
+ EXPECT_CALL(mock_policy_handler_, GetAppProperties(test_policy_app_id1, _))
+ .WillOnce(
+ DoAll(SetTestAppProperties(test_app1_properties), Return(true)));
+ EXPECT_CALL(mock_policy_handler_,
+ GetInitialAppData(test_policy_app_id1, _, _))
+ .WillOnce(DoAll(SetTestNickNames(test_nicknames1), Return(true)));
+
+ EXPECT_CALL(mock_policy_handler_, GetAppProperties(test_policy_app_id2, _))
+ .WillOnce(
+ DoAll(SetTestAppProperties(test_app2_properties), Return(true)));
+ EXPECT_CALL(mock_policy_handler_,
+ GetInitialAppData(test_policy_app_id2, _, _))
+ .WillOnce(DoAll(SetTestNickNames(test_nicknames2), Return(true)));
+
+ auto message_to_hmi = CreateMessage();
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIMessageParametersAre(
+ kCorrelationId,
+ hmi_apis::FunctionID::BasicCommunication_GetAppProperties,
+ hmi_apis::Common_Result::SUCCESS),
+ kSource))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_hmi), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const auto& sent_app_properties =
+ (*message_to_hmi)[strings::msg_params][strings::properties];
+
+ EXPECT_EQ(2u, sent_app_properties.length());
+
+ // Compare test_app1 app_properties with sent app properties
+ const auto& sent_test_app1_properties = sent_app_properties[0];
+ EXPECT_FALSE(sent_test_app1_properties.keyExists(strings::endpoint));
+ EXPECT_TRUE(
+ CompareAppProperties(sent_test_app1_properties, test_app1_properties));
+
+ const auto& sent_test_app1_nicknames =
+ sent_app_properties[0][strings::nicknames];
+ EXPECT_TRUE(CompareNicknames(sent_test_app1_nicknames, test_nicknames1));
+
+ // Compare test_app2 app_properties with sent app properties
+ const auto& sent_test_app2_properties = sent_app_properties[1];
+ EXPECT_FALSE(sent_test_app2_properties.keyExists(strings::endpoint));
+ EXPECT_TRUE(
+ CompareAppProperties(sent_test_app2_properties, test_app2_properties));
+
+ const auto& sent_test_app2_nicknames =
+ sent_app_properties[1][strings::nicknames];
+ EXPECT_TRUE(CompareNicknames(sent_test_app2_nicknames, test_nicknames2));
+}
+
+TEST_F(BCGetAppPropertiesRequestTest,
+ Run_PolicyAppIdExist_NickNamesAreAbsent_SendEmptyArray_SUCCESS) {
+ auto msg = CreateMessage();
+
+ (*msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*msg)[strings::msg_params][strings::policy_app_id] = kPolicyAppId;
+ auto command = CreateCommand<BCGetAppPropertiesRequest>(msg);
+
+ // Fills app properties with default test values
+ EXPECT_CALL(mock_policy_handler_, GetAppProperties(kPolicyAppId, _))
+ .WillOnce(DoAll(
+ SetTestAppProperties(policy::AppProperties("",
+ kCertificate,
+ kEnabled,
+ kAuthToken,
+ kTransportType,
+ kHybridAppPreference)),
+ Return(true)));
+
+ // In the case when nicknames array is empty, SDL should forward the empty
+ // array to HMI in the app properties
+ EXPECT_CALL(mock_policy_handler_, GetInitialAppData(kPolicyAppId, _, _))
+ .WillOnce(DoAll(SetTestNickNames(policy::StringArray{}), Return(true)));
+
+ auto message_to_hmi = CreateMessage();
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIMessageParametersAre(
+ kCorrelationId,
+ hmi_apis::FunctionID::BasicCommunication_GetAppProperties,
+ hmi_apis::Common_Result::SUCCESS),
+ kSource))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_hmi), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const auto& sent_app_properties =
+ (*message_to_hmi)[strings::msg_params][strings::properties];
+
+ EXPECT_TRUE(sent_app_properties[0].keyExists(strings::nicknames));
+ EXPECT_TRUE(sent_app_properties[0][strings::nicknames].empty());
+}
+
+} // namespace bc_get_app_properties_request_test
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_get_app_properties_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_get_app_properties_response_test.cc
new file mode 100644
index 0000000000..f9df8db1e3
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_get_app_properties_response_test.cc
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2020 Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the names of the copyright holders nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "hmi/bc_get_app_properties_response.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace bc_get_app_properties_response {
+
+using sdl_rpc_plugin::commands::BCGetAppPropertiesResponse;
+
+class BCGetAppPropertiesResponseTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(BCGetAppPropertiesResponseTest, RUN_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage();
+
+ std::shared_ptr<BCGetAppPropertiesResponse> command(
+ CreateCommand<BCGetAppPropertiesResponse>(msg));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(msg));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+} // namespace bc_get_app_properties_response
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_set_app_properties_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_set_app_properties_request_test.cc
new file mode 100644
index 0000000000..5804476649
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_set_app_properties_request_test.cc
@@ -0,0 +1,304 @@
+/*
+ * Copyright (c) 2020 Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the names of the copyright holders nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+
+#include "application_manager/policies/policy_handler.h"
+#include "hmi/bc_set_app_properties_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/policies/policy_handler.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace bc_set_app_properties_request {
+
+namespace am = ::application_manager;
+namespace strings = am::strings;
+
+using sdl_rpc_plugin::commands::BCSetAppPropertiesRequest;
+using ::testing::_;
+using ::testing::ReturnRef;
+
+namespace {
+const uint32_t kAppId = 1u;
+const std::string kPolicyAppId = "00001";
+const std::string kToken = "TOKEN";
+const uint32_t kHmiAppId = 13u;
+const uint32_t kCorrelationId = 1u;
+const auto kSource = am::commands::Command::SOURCE_HMI;
+} // namespace
+
+typedef std::shared_ptr<BCSetAppPropertiesRequest> BCSetAppPropertiesRequestPtr;
+
+class BCSetAppPropertiesRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ BCSetAppPropertiesRequestTest() : mock_app_(CreateMockApp()) {
+ ON_CALL((*mock_app_), app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(event_dispatcher_));
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
+ ON_CALL(app_mngr_, application_by_hmi_app(_))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ ON_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillByDefault(Return(true));
+ }
+
+ MessageSharedPtr CreateMessageWithCustomProperties(
+ const smart_objects::SmartObject& properties) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*msg)[strings::msg_params][strings::app_id] = kAppId;
+ (*msg)[strings::msg_params][strings::properties] = properties;
+ return msg;
+ }
+
+ MockAppPtr mock_app_;
+};
+
+TEST_F(BCSetAppPropertiesRequestTest,
+ Run_NoAppPropertyChanges_AppIsSame_FailToUpdateAppList) {
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ properties[strings::policy_app_id] = kPolicyAppId;
+
+ MessageSharedPtr msg = CreateMessageWithCustomProperties(properties);
+ auto command = CreateCommand<BCSetAppPropertiesRequest>(msg);
+
+ const auto change_status =
+ policy::PolicyHandler::AppPropertiesState::NO_CHANGES;
+ ON_CALL(mock_policy_handler_,
+ GetAppPropertiesStatus(properties, kPolicyAppId))
+ .WillByDefault(Return(change_status));
+ ON_CALL(mock_policy_handler_, IsNewApplication(kPolicyAppId))
+ .WillByDefault(Return(false));
+
+ MessageSharedPtr notification = CreateMessage();
+ ON_CALL(mock_message_helper_,
+ CreateOnAppPropertiesChangeNotification(kPolicyAppId, _))
+ .WillByDefault(Return(notification));
+
+ EXPECT_CALL(mock_message_helper_,
+ CreateOnAppPropertiesChangeNotification(_, _))
+ .Times(0);
+ EXPECT_CALL(mock_policy_handler_,
+ GetAppPropertiesStatus(properties, kPolicyAppId));
+ EXPECT_CALL(mock_policy_handler_, OnSetAppProperties(properties));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_SetAppProperties),
+ kSource));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(notification, kSource))
+ .Times(0);
+ EXPECT_CALL(app_mngr_, CreatePendingLocalApplication(kPolicyAppId)).Times(0);
+ EXPECT_CALL(app_mngr_, SendUpdateAppList()).Times(0);
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(BCSetAppPropertiesRequestTest,
+ Run_AppAuthTokenChanged_AppIsSame_NoUpdateAppList) {
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ properties[strings::auth_token] = kToken;
+ properties[strings::policy_app_id] = kPolicyAppId;
+
+ MessageSharedPtr msg = CreateMessageWithCustomProperties(properties);
+ auto command = CreateCommand<BCSetAppPropertiesRequest>(msg);
+
+ const auto change_status =
+ policy::PolicyHandler::AppPropertiesState::AUTH_TOKEN_CHANGED;
+ ON_CALL(mock_policy_handler_,
+ GetAppPropertiesStatus(properties, kPolicyAppId))
+ .WillByDefault(Return(change_status));
+ ON_CALL(mock_policy_handler_, IsNewApplication(kPolicyAppId))
+ .WillByDefault(Return(false));
+
+ MessageSharedPtr notification = CreateMessage();
+ ON_CALL(mock_message_helper_,
+ CreateOnAppPropertiesChangeNotification(kPolicyAppId, _))
+ .WillByDefault(Return(notification));
+
+ EXPECT_CALL(mock_message_helper_,
+ CreateOnAppPropertiesChangeNotification(kPolicyAppId, _));
+ EXPECT_CALL(mock_policy_handler_,
+ GetAppPropertiesStatus(properties, kPolicyAppId));
+ EXPECT_CALL(mock_policy_handler_, OnSetAppProperties(properties));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_SetAppProperties),
+ kSource));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(notification, kSource));
+ EXPECT_CALL(app_mngr_, CreatePendingLocalApplication(kPolicyAppId)).Times(0);
+ EXPECT_CALL(app_mngr_, SendUpdateAppList()).Times(0);
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(BCSetAppPropertiesRequestTest,
+ Run_NoAppPropetiesChanged_AppIsNewAndEnabled_AppListUpdated) {
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ properties[strings::policy_app_id] = kPolicyAppId;
+ properties[strings::enabled] = true;
+
+ MessageSharedPtr msg = CreateMessageWithCustomProperties(properties);
+ auto command = CreateCommand<BCSetAppPropertiesRequest>(msg);
+
+ const auto change_status =
+ policy::PolicyHandler::AppPropertiesState::NO_CHANGES;
+ ON_CALL(mock_policy_handler_,
+ GetAppPropertiesStatus(properties, kPolicyAppId))
+ .WillByDefault(Return(change_status));
+ ON_CALL(mock_policy_handler_, IsNewApplication(kPolicyAppId))
+ .WillByDefault(Return(true));
+
+ MessageSharedPtr notification = CreateMessage();
+ ON_CALL(mock_message_helper_,
+ CreateOnAppPropertiesChangeNotification(kPolicyAppId, _))
+ .WillByDefault(Return(notification));
+
+ EXPECT_CALL(mock_message_helper_,
+ CreateOnAppPropertiesChangeNotification(kPolicyAppId, _));
+ EXPECT_CALL(mock_policy_handler_,
+ GetAppPropertiesStatus(properties, kPolicyAppId));
+ EXPECT_CALL(mock_policy_handler_, OnSetAppProperties(properties));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_SetAppProperties),
+ kSource));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(notification, kSource));
+ EXPECT_CALL(app_mngr_, CreatePendingLocalApplication(kPolicyAppId));
+ EXPECT_CALL(app_mngr_, SendUpdateAppList());
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(BCSetAppPropertiesRequestTest,
+ Run_AppEnabledFlagChanged_AppListUpdated) {
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ properties[strings::policy_app_id] = kPolicyAppId;
+ properties[strings::enabled] = true;
+
+ MessageSharedPtr msg = CreateMessageWithCustomProperties(properties);
+ auto command = CreateCommand<BCSetAppPropertiesRequest>(msg);
+
+ const auto change_status =
+ policy::PolicyHandler::AppPropertiesState::ENABLED_FLAG_SWITCH;
+ ON_CALL(mock_policy_handler_,
+ GetAppPropertiesStatus(properties, kPolicyAppId))
+ .WillByDefault(Return(change_status));
+ ON_CALL(mock_policy_handler_, IsNewApplication(kPolicyAppId))
+ .WillByDefault(Return(false));
+
+ MessageSharedPtr notification = CreateMessage();
+ ON_CALL(mock_message_helper_,
+ CreateOnAppPropertiesChangeNotification(kPolicyAppId, _))
+ .WillByDefault(Return(notification));
+
+ EXPECT_CALL(mock_message_helper_,
+ CreateOnAppPropertiesChangeNotification(kPolicyAppId, _));
+ EXPECT_CALL(mock_policy_handler_,
+ GetAppPropertiesStatus(properties, kPolicyAppId));
+ EXPECT_CALL(mock_policy_handler_, OnSetAppProperties(properties));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_SetAppProperties),
+ kSource));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(notification, kSource));
+ EXPECT_CALL(app_mngr_, CreatePendingLocalApplication(kPolicyAppId));
+ EXPECT_CALL(app_mngr_, SendUpdateAppList());
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(BCSetAppPropertiesRequestTest,
+ Run_AppEnabledFlagChangedToFalse_AppRemoveFromList_AppListUpdated) {
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ properties[strings::policy_app_id] = kPolicyAppId;
+ properties[strings::enabled] = false;
+
+ MessageSharedPtr msg = CreateMessageWithCustomProperties(properties);
+ auto command = CreateCommand<BCSetAppPropertiesRequest>(msg);
+
+ const auto change_status =
+ policy::PolicyHandler::AppPropertiesState::ENABLED_FLAG_SWITCH;
+ ON_CALL(mock_policy_handler_,
+ GetAppPropertiesStatus(properties, kPolicyAppId))
+ .WillByDefault(Return(change_status));
+ ON_CALL(mock_policy_handler_, IsNewApplication(kPolicyAppId))
+ .WillByDefault(Return(false));
+
+ MessageSharedPtr notification = CreateMessage();
+ ON_CALL(mock_message_helper_,
+ CreateOnAppPropertiesChangeNotification(kPolicyAppId, _))
+ .WillByDefault(Return(notification));
+
+ EXPECT_CALL(mock_message_helper_,
+ CreateOnAppPropertiesChangeNotification(kPolicyAppId, _));
+ EXPECT_CALL(mock_policy_handler_,
+ GetAppPropertiesStatus(properties, kPolicyAppId));
+ EXPECT_CALL(mock_policy_handler_, OnSetAppProperties(properties));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_SetAppProperties),
+ kSource));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(notification, kSource));
+ EXPECT_CALL(app_mngr_, CreatePendingLocalApplication(kPolicyAppId)).Times(0);
+ EXPECT_CALL(app_mngr_, RemovePendingApplication(kPolicyAppId));
+ EXPECT_CALL(app_mngr_, SendUpdateAppList());
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+} // namespace bc_set_app_properties_request
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_set_app_properties_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_set_app_properties_response_test.cc
new file mode 100644
index 0000000000..d4b7447d0d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/bc_set_app_properties_response_test.cc
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2020 Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the names of the copyright holders nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+
+#include "hmi/bc_set_app_properties_response.h"
+
+#include "application_manager/commands/commands_test.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace bc_set_app_properties_response {
+
+using sdl_rpc_plugin::commands::BCSetAppPropertiesResponse;
+
+class BCSetAppPropertiesResponseTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(BCSetAppPropertiesResponseTest, RUN_SUCCESS) {
+ MessageSharedPtr msg = CreateMessage();
+
+ std::shared_ptr<BCSetAppPropertiesResponse> command(
+ CreateCommand<BCSetAppPropertiesResponse>(msg));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(msg));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+} // namespace bc_set_app_properties_response
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc
index 930e024b4b..7d9ed899a6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/button_get_capabilities_response.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
+#include "gtest/gtest.h"
+
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace commands_test {
@@ -45,13 +45,13 @@ namespace button_get_capabilities_response {
using application_manager::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::ButtonGetCapabilitiesResponse;
-using ::testing::ReturnRef;
using ::testing::NiceMock;
+using ::testing::ReturnRef;
namespace strings = ::application_manager::strings;
namespace hmi_response = ::application_manager::hmi_response;
-typedef ::utils::SharedPtr<ButtonGetCapabilitiesResponse> ResponsePtr;
+typedef std::shared_ptr<ButtonGetCapabilitiesResponse> ResponsePtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
@@ -100,7 +100,8 @@ TEST_F(ButtonGetCapabilitiesResponseTest, Run_CodeAborted_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_, set_button_capabilities(capabilities_))
.Times(0);
EXPECT_CALL(mock_hmi_capabilities_,
- set_preset_bank_capabilities(preset_bank_capabilities_)).Times(0);
+ set_preset_bank_capabilities(preset_bank_capabilities_))
+ .Times(0);
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc
index 1bae77bb30..087109c871 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc
@@ -34,14 +34,14 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
+
#include "application_manager/commands/command.h"
-#include "application_manager/commands/response_from_hmi.h"
-#include "hmi/close_popup_response.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/response_from_hmi.h"
#include "application_manager/mock_application.h"
+#include "application_manager/smart_object_keys.h"
+#include "hmi/close_popup_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -49,13 +49,12 @@ namespace commands_test {
namespace hmi_commands_test {
namespace close_popup_response {
-using ::utils::SharedPtr;
namespace am = ::application_manager;
+using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::ClosePopupResponse;
-using am::commands::CommandImpl;
-typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr;
+typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
class ClosePopupResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> {
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
index 2374609774..c66cb81141 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
@@ -37,214 +37,191 @@
#include <vector>
#include "gtest/gtest.h"
+#include "hmi/activate_app_request.h"
+#include "hmi/activate_app_response.h"
+#include "hmi/add_statistics_info_notification.h"
#include "hmi/allow_all_apps_request.h"
#include "hmi/allow_all_apps_response.h"
#include "hmi/allow_app_request.h"
#include "hmi/allow_app_response.h"
+#include "hmi/basic_communication_system_request.h"
+#include "hmi/basic_communication_system_response.h"
+#include "hmi/bc_get_file_path_request.h"
+#include "hmi/bc_get_file_path_response.h"
+#include "hmi/button_get_capabilities_request.h"
+#include "hmi/button_get_capabilities_response.h"
+#include "hmi/close_popup_request.h"
+#include "hmi/close_popup_response.h"
+#include "hmi/dial_number_request.h"
+#include "hmi/dial_number_response.h"
+#include "hmi/get_system_info_request.h"
+#include "hmi/get_system_info_response.h"
+#include "hmi/mixing_audio_supported_request.h"
+#include "hmi/mixing_audio_supported_response.h"
+#include "hmi/navi_alert_maneuver_request.h"
+#include "hmi/navi_alert_maneuver_response.h"
#include "hmi/navi_audio_start_stream_request.h"
#include "hmi/navi_audio_start_stream_response.h"
#include "hmi/navi_audio_stop_stream_request.h"
#include "hmi/navi_audio_stop_stream_response.h"
-#include "hmi/update_device_list_request.h"
-#include "hmi/update_device_list_response.h"
-#include "hmi/on_update_device_list.h"
-#include "hmi/on_start_device_discovery.h"
-#include "hmi/update_app_list_request.h"
-#include "hmi/update_app_list_response.h"
-#include "hmi/on_find_applications.h"
-#include "hmi/sdl_get_list_of_permissions_request.h"
-#include "hmi/sdl_get_list_of_permissions_response.h"
-#include "hmi/sdl_get_user_friendly_message_request.h"
-#include "hmi/sdl_get_user_friendly_message_response.h"
-#include "hmi/sdl_get_status_update_request.h"
-#include "hmi/sdl_get_status_update_response.h"
-#include "hmi/on_status_update_notification.h"
-#include "hmi/update_sdl_request.h"
-#include "hmi/update_sdl_response.h"
-#include "hmi/activate_app_request.h"
-#include "hmi/activate_app_response.h"
-#include "hmi/mixing_audio_supported_request.h"
-#include "hmi/mixing_audio_supported_response.h"
+#include "hmi/navi_get_way_points_request.h"
+#include "hmi/navi_get_way_points_response.h"
+#include "hmi/navi_is_ready_request.h"
+#include "hmi/navi_is_ready_response.h"
+#include "hmi/navi_send_location_request.h"
+#include "hmi/navi_send_location_response.h"
+#include "hmi/navi_show_constant_tbt_request.h"
+#include "hmi/navi_show_constant_tbt_response.h"
+#include "hmi/navi_start_stream_request.h"
+#include "hmi/navi_start_stream_response.h"
+#include "hmi/navi_stop_stream_request.h"
+#include "hmi/navi_stop_stream_response.h"
+#include "hmi/navi_subscribe_way_points_request.h"
+#include "hmi/navi_subscribe_way_points_response.h"
+#include "hmi/navi_unsubscribe_way_points_request.h"
+#include "hmi/navi_unsubscribe_way_points_response.h"
+#include "hmi/navi_update_turn_list_request.h"
+#include "hmi/navi_update_turn_list_response.h"
#include "hmi/on_allow_sdl_functionality_notification.h"
+#include "hmi/on_app_activated_notification.h"
+#include "hmi/on_app_deactivated_notification.h"
#include "hmi/on_app_permission_changed_notification.h"
#include "hmi/on_app_permission_consent_notification.h"
-#include "hmi/on_app_activated_notification.h"
+#include "hmi/on_app_registered_notification.h"
+#include "hmi/on_app_unregistered_notification.h"
#include "hmi/on_audio_data_streaming_notification.h"
-#include "hmi/on_video_data_streaming_notification.h"
-#include "hmi/on_sdl_consent_needed_notification.h"
+#include "hmi/on_button_event_notification.h"
+#include "hmi/on_button_press_notification.h"
+#include "hmi/on_button_subscription_notification.h"
+#include "hmi/on_device_chosen_notification.h"
+#include "hmi/on_device_state_changed_notification.h"
+#include "hmi/on_driver_distraction_notification.h"
+#include "hmi/on_event_changed_notification.h"
#include "hmi/on_exit_all_applications_notification.h"
#include "hmi/on_exit_application_notification.h"
+#include "hmi/on_file_removed_notification.h"
+#include "hmi/on_find_applications.h"
+#include "hmi/on_ignition_cycle_over_notification.h"
+#include "hmi/on_navi_tbt_client_state_notification.h"
+#include "hmi/on_navi_way_point_change_notification.h"
+#include "hmi/on_policy_update.h"
#include "hmi/on_put_file_notification.h"
+#include "hmi/on_ready_notification.h"
+#include "hmi/on_received_policy_update.h"
+#include "hmi/on_record_start_notification.h"
#include "hmi/on_resume_audio_source_notification.h"
-#include "hmi/on_ignition_cycle_over_notification.h"
+#include "hmi/on_sdl_close_notification.h"
+#include "hmi/on_sdl_consent_needed_notification.h"
+#include "hmi/on_sdl_persistence_complete_notification.h"
+#include "hmi/on_start_device_discovery.h"
+#include "hmi/on_status_update_notification.h"
+#include "hmi/on_system_context_notification.h"
+#include "hmi/on_system_error_notification.h"
#include "hmi/on_system_info_changed_notification.h"
-#include "hmi/get_system_info_request.h"
-#include "hmi/get_system_info_response.h"
-#include "hmi/close_popup_request.h"
-#include "hmi/close_popup_response.h"
-#include "hmi/button_get_capabilities_request.h"
-#include "hmi/button_get_capabilities_response.h"
+#include "hmi/on_system_request_notification.h"
+#include "hmi/on_tts_language_change_notification.h"
+#include "hmi/on_tts_reset_timeout_notification.h"
+#include "hmi/on_tts_started_notification.h"
+#include "hmi/on_tts_stopped_notification.h"
+#include "hmi/on_ui_command_notification.h"
+#include "hmi/on_ui_keyboard_input_notification.h"
+#include "hmi/on_ui_language_change_notification.h"
+#include "hmi/on_ui_reset_timeout_notification.h"
+#include "hmi/on_ui_touch_event_notification.h"
+#include "hmi/on_update_device_list.h"
+#include "hmi/on_video_data_streaming_notification.h"
+#include "hmi/on_vr_command_notification.h"
+#include "hmi/on_vr_language_change_notification.h"
+#include "hmi/on_vr_started_notification.h"
+#include "hmi/on_vr_stopped_notification.h"
+#include "hmi/sdl_activate_app_request.h"
+#include "hmi/sdl_activate_app_response.h"
+#include "hmi/sdl_get_list_of_permissions_request.h"
+#include "hmi/sdl_get_list_of_permissions_response.h"
+#include "hmi/sdl_get_status_update_request.h"
+#include "hmi/sdl_get_status_update_response.h"
+#include "hmi/sdl_get_user_friendly_message_request.h"
+#include "hmi/sdl_get_user_friendly_message_response.h"
+#include "hmi/sdl_policy_update.h"
+#include "hmi/sdl_policy_update_response.h"
+#include "hmi/tts_change_registration_request.h"
+#include "hmi/tts_change_registration_response.h"
+#include "hmi/tts_get_capabilities_request.h"
+#include "hmi/tts_get_capabilities_response.h"
+#include "hmi/tts_get_language_request.h"
+#include "hmi/tts_get_language_response.h"
+#include "hmi/tts_get_supported_languages_request.h"
+#include "hmi/tts_get_supported_languages_response.h"
+#include "hmi/tts_is_ready_request.h"
+#include "hmi/tts_is_ready_response.h"
+#include "hmi/tts_set_global_properties_request.h"
+#include "hmi/tts_set_global_properties_response.h"
+#include "hmi/tts_speak_request.h"
+#include "hmi/tts_speak_response.h"
+#include "hmi/tts_stop_speaking_request.h"
+#include "hmi/tts_stop_speaking_response.h"
#include "hmi/ui_add_command_request.h"
#include "hmi/ui_add_command_response.h"
-#include "hmi/ui_delete_command_request.h"
-#include "hmi/ui_delete_command_response.h"
#include "hmi/ui_add_submenu_request.h"
#include "hmi/ui_add_submenu_response.h"
+#include "hmi/ui_alert_request.h"
+#include "hmi/ui_alert_response.h"
+#include "hmi/ui_change_registration_request.h"
+#include "hmi/ui_change_registration_response.h"
+#include "hmi/ui_delete_command_request.h"
+#include "hmi/ui_delete_command_response.h"
#include "hmi/ui_delete_submenu_request.h"
#include "hmi/ui_delete_submenu_response.h"
-#include "hmi/ui_get_supported_languages_request.h"
-#include "hmi/ui_get_supported_languages_response.h"
-#include "hmi/ui_get_language_request.h"
-#include "hmi/ui_get_language_response.h"
+#include "hmi/ui_end_audio_pass_thru_request.h"
+#include "hmi/ui_end_audio_pass_thru_response.h"
#include "hmi/ui_get_capabilities_request.h"
#include "hmi/ui_get_capabilities_response.h"
-#include "hmi/ui_change_registration_request.h"
-#include "hmi/ui_change_registration_response.h"
-#include "hmi/ui_show_request.h"
-#include "hmi/ui_show_response.h"
-#include "hmi/ui_alert_request.h"
-#include "hmi/ui_alert_response.h"
+#include "hmi/ui_get_language_request.h"
+#include "hmi/ui_get_language_response.h"
+#include "hmi/ui_get_supported_languages_request.h"
+#include "hmi/ui_get_supported_languages_response.h"
#include "hmi/ui_is_ready_request.h"
#include "hmi/ui_is_ready_response.h"
-#include "hmi/ui_slider_request.h"
-#include "hmi/ui_slider_response.h"
-#include "hmi/ui_set_media_clock_timer_request.h"
-#include "hmi/ui_set_media_clock_timer_response.h"
-#include "hmi/ui_set_global_properties_request.h"
-#include "hmi/ui_set_global_properties_response.h"
+#include "hmi/ui_perform_audio_pass_thru_request.h"
+#include "hmi/ui_perform_audio_pass_thru_response.h"
+#include "hmi/ui_perform_interaction_request.h"
+#include "hmi/ui_perform_interaction_response.h"
#include "hmi/ui_scrollable_message_request.h"
#include "hmi/ui_scrollable_message_response.h"
#include "hmi/ui_set_app_icon_request.h"
#include "hmi/ui_set_app_icon_response.h"
-#include "hmi/ui_perform_audio_pass_thru_response.h"
-#include "hmi/ui_perform_audio_pass_thru_request.h"
-#include "hmi/ui_end_audio_pass_thru_request.h"
-#include "hmi/ui_end_audio_pass_thru_response.h"
-#include "hmi/ui_perform_interaction_request.h"
-#include "hmi/ui_perform_interaction_response.h"
-#include "hmi/vr_is_ready_request.h"
-#include "hmi/vr_is_ready_response.h"
+#include "hmi/ui_set_display_layout_request.h"
+#include "hmi/ui_set_display_layout_response.h"
+#include "hmi/ui_set_global_properties_request.h"
+#include "hmi/ui_set_global_properties_response.h"
+#include "hmi/ui_set_media_clock_timer_request.h"
+#include "hmi/ui_set_media_clock_timer_response.h"
+#include "hmi/ui_show_request.h"
+#include "hmi/ui_show_response.h"
+#include "hmi/ui_slider_request.h"
+#include "hmi/ui_slider_response.h"
+#include "hmi/update_app_list_request.h"
+#include "hmi/update_app_list_response.h"
+#include "hmi/update_device_list_request.h"
+#include "hmi/update_device_list_response.h"
+#include "hmi/update_sdl_request.h"
+#include "hmi/update_sdl_response.h"
#include "hmi/vr_add_command_request.h"
#include "hmi/vr_add_command_response.h"
-#include "hmi/vr_delete_command_request.h"
-#include "hmi/vr_delete_command_response.h"
#include "hmi/vr_change_registration_request.h"
#include "hmi/vr_change_registration_response.h"
-#include "hmi/vr_get_supported_languages_request.h"
-#include "hmi/vr_get_supported_languages_response.h"
-#include "hmi/vr_get_language_request.h"
-#include "hmi/vr_get_language_response.h"
+#include "hmi/vr_delete_command_request.h"
+#include "hmi/vr_delete_command_response.h"
#include "hmi/vr_get_capabilities_request.h"
#include "hmi/vr_get_capabilities_response.h"
-#include "hmi/tts_is_ready_request.h"
-#include "hmi/tts_is_ready_response.h"
-#include "hmi/tts_change_registration_request.h"
-#include "hmi/tts_change_registration_response.h"
-#include "hmi/tts_get_supported_languages_request.h"
-#include "hmi/tts_get_supported_languages_response.h"
-#include "hmi/tts_get_language_request.h"
-#include "hmi/tts_get_language_response.h"
-#include "hmi/tts_stop_speaking_request.h"
-#include "hmi/tts_stop_speaking_response.h"
-#include "hmi/tts_speak_request.h"
-#include "hmi/tts_speak_response.h"
-#include "hmi/tts_set_global_properties_request.h"
-#include "hmi/tts_set_global_properties_response.h"
-#include "hmi/tts_get_capabilities_request.h"
-#include "hmi/tts_get_capabilities_response.h"
+#include "hmi/vr_get_language_request.h"
+#include "hmi/vr_get_language_response.h"
+#include "hmi/vr_get_supported_languages_request.h"
+#include "hmi/vr_get_supported_languages_response.h"
+#include "hmi/vr_is_ready_request.h"
+#include "hmi/vr_is_ready_response.h"
#include "hmi/vr_perform_interaction_request.h"
#include "hmi/vr_perform_interaction_response.h"
-#include "hmi/sdl_activate_app_request.h"
-#include "hmi/sdl_activate_app_response.h"
-#include "hmi/on_app_permission_changed_notification.h"
-#include "hmi/on_event_changed_notification.h"
-#include "hmi/navi_is_ready_request.h"
-#include "hmi/navi_show_constant_tbt_request.h"
-#include "hmi/navi_show_constant_tbt_response.h"
-#include "hmi/navi_is_ready_response.h"
-#include "hmi/navi_alert_maneuver_request.h"
-#include "hmi/navi_alert_maneuver_response.h"
-#include "hmi/navi_update_turn_list_request.h"
-#include "hmi/navi_update_turn_list_response.h"
-#include "hmi/navi_subscribe_way_points_request.h"
-#include "hmi/navi_subscribe_way_points_response.h"
-#include "hmi/navi_unsubscribe_way_points_request.h"
-#include "hmi/navi_unsubscribe_way_points_response.h"
-#include "hmi/navi_get_way_points_request.h"
-#include "hmi/navi_get_way_points_response.h"
-#include "hmi/on_ready_notification.h"
-#include "hmi/on_device_chosen_notification.h"
-#include "hmi/on_file_removed_notification.h"
-#include "hmi/on_system_context_notification.h"
-#include "hmi/on_app_registered_notification.h"
-#include "hmi/on_app_unregistered_notification.h"
-#include "hmi/on_driver_distraction_notification.h"
-#include "hmi/on_tts_started_notification.h"
-#include "hmi/on_tts_stopped_notification.h"
-#include "hmi/on_vr_started_notification.h"
-#include "hmi/on_vr_stopped_notification.h"
-#include "hmi/on_vr_command_notification.h"
-#include "hmi/on_ui_command_notification.h"
-#include "hmi/on_app_deactivated_notification.h"
-#include "hmi/on_ui_language_change_notification.h"
-#include "hmi/on_vr_language_change_notification.h"
-#include "hmi/on_tts_language_change_notification.h"
-#include "hmi/on_navi_tbt_client_state_notification.h"
-#include "hmi/on_navi_way_point_change_notification.h"
-#include "hmi/on_button_event_notification.h"
-#include "hmi/on_button_press_notification.h"
-#include "hmi/on_button_subscription_notification.h"
-#include "hmi/on_ui_keyboard_input_notification.h"
-#include "hmi/on_ui_touch_event_notification.h"
-#include "hmi/on_ui_reset_timeout_notification.h"
-#include "hmi/navi_start_stream_request.h"
-#include "hmi/navi_start_stream_response.h"
-#include "hmi/navi_stop_stream_request.h"
-#include "hmi/navi_stop_stream_response.h"
-#include "hmi/on_system_request_notification.h"
-#include "hmi/ui_set_display_layout_request.h"
-#include "hmi/ui_set_display_layout_response.h"
-#include "hmi/on_sdl_close_notification.h"
-#include "hmi/on_sdl_persistence_complete_notification.h"
-#include "hmi/on_record_start_notification.h"
-#include "hmi/add_statistics_info_notification.h"
-#include "hmi/on_system_error_notification.h"
-#include "hmi/basic_communication_system_request.h"
-#include "hmi/basic_communication_system_response.h"
-#include "hmi/sdl_policy_update.h"
-#include "hmi/sdl_policy_update_response.h"
-#include "hmi/on_received_policy_update.h"
-#include "hmi/on_policy_update.h"
-#include "hmi/get_urls.h"
-#include "hmi/get_urls_response.h"
-#include "hmi/on_device_state_changed_notification.h"
-#include "hmi/navi_send_location_request.h"
-#include "hmi/navi_send_location_response.h"
-#include "hmi/on_tts_reset_timeout_notification.h"
-#include "hmi/dial_number_request.h"
-#include "hmi/dial_number_response.h"
-#include "hmi/on_vi_gps_data_notification.h"
-#include "hmi/on_vi_speed_notification.h"
-#include "hmi/on_vi_rpm_notification.h"
-#include "hmi/on_vi_fuel_level_notification.h"
-#include "hmi/on_vi_fuel_level_state_notification.h"
-#include "hmi/on_vi_instant_fuel_consumption_notification.h"
-#include "hmi/on_vi_external_temperature_notification.h"
-#include "hmi/on_vi_vin_notification.h"
-#include "hmi/on_vi_prndl_notification.h"
-#include "hmi/on_vi_tire_pressure_notification.h"
-#include "hmi/on_vi_odometer_notification.h"
-#include "hmi/on_vi_belt_status_notification.h"
-#include "hmi/on_vi_body_information_notification.h"
-#include "hmi/on_vi_device_status_notification.h"
-#include "hmi/on_vi_driver_braking_notification.h"
-#include "hmi/on_vi_wiper_status_notification.h"
-#include "hmi/on_vi_head_lamp_status_notification.h"
-#include "hmi/on_vi_engine_torque_notification.h"
-#include "hmi/on_vi_acc_pedal_position_notification.h"
-#include "hmi/on_vi_steering_wheel_angle_notification.h"
-#include "hmi/on_vi_my_key_notification.h"
-#include "hmi/ui_set_icon_request.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
@@ -262,16 +239,16 @@ namespace dummy_hmi_commands_test {
namespace commands = sdl_rpc_plugin::commands;
-using ::testing::_;
-using ::testing::NotNull;
-using ::testing::Types;
+using ::application_manager::ApplicationSharedPtr;
using application_manager::commands::MessageSharedPtr;
-using ::test::components::event_engine_test::MockEventDispatcher;
+using ::test::components::application_manager_test::MockApplication;
using ::test::components::application_manager_test::MockApplicationManager;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
-using ::application_manager::ApplicationSharedPtr;
-using ::test::components::application_manager_test::MockApplication;
+using ::test::components::event_engine_test::MockEventDispatcher;
+using ::testing::_;
+using ::testing::NotNull;
+using ::testing::Types;
template <class Command>
class HMICommandsTest : public components::commands_test::CommandRequestTest<
@@ -341,8 +318,6 @@ typedef Types<commands::OnStartDeviceDiscovery,
commands::SDLActivateAppRequest,
commands::SDLPolicyUpdateResponse,
commands::SDLPolicyUpdate,
- commands::GetUrlsResponse,
- commands::GetUrls,
commands::OnAppPermissionChangedNotification,
commands::SDLGetListOfPermissionsResponse,
commands::SDLGetListOfPermissionsRequest,
@@ -379,7 +354,8 @@ typedef Types<commands::OnStartDeviceDiscovery,
commands::UIGetLanguageRequest,
commands::UIGetCapabilitiesResponse,
commands::UIGetCapabilitiesRequest,
- commands::UIChangeRegistratioResponse> HMICommandsListFirst;
+ commands::UIChangeRegistratioResponse>
+ HMICommandsListFirst;
typedef Types<commands::UIChangeRegistrationRequest,
commands::UIPerformAudioPassThruResponse,
@@ -429,7 +405,8 @@ typedef Types<commands::UIChangeRegistrationRequest,
commands::ClosePopupResponse,
commands::ClosePopupRequest,
commands::UIIsReadyResponse,
- commands::UIIsReadyRequest> HMICommandsListSecond;
+ commands::UIIsReadyRequest>
+ HMICommandsListSecond;
typedef Types<commands::NaviIsReadyResponse,
commands::NaviIsReadyRequest,
@@ -444,7 +421,7 @@ typedef Types<commands::NaviIsReadyResponse,
commands::NaviSubscribeWayPointsResponse,
commands::NaviSubscribeWayPointsRequest,
commands::NaviUnsubscribeWayPointsResponse,
- commands::NaviUnSubscribeWayPointsRequest,
+ commands::NaviUnsubscribeWayPointsRequest,
commands::ButtonGetCapabilitiesResponse,
commands::ButtonGetCapabilitiesRequest,
commands::OnAllowSDLFunctionalityNotification,
@@ -467,7 +444,8 @@ typedef Types<commands::NaviIsReadyResponse,
commands::OnVRStoppedNotification,
commands::OnVRCommandNotification,
commands::OnUICommandNotification,
- commands::OnAppDeactivatedNotification> HMICommandsListThird;
+ commands::OnAppDeactivatedNotification>
+ HMICommandsListThird;
typedef Types<commands::hmi::OnButtonEventNotification,
commands::hmi::OnButtonPressNotification,
@@ -513,33 +491,16 @@ typedef Types<commands::hmi::OnButtonEventNotification,
commands::OnNaviWayPointChangeNotification,
commands::OnUILanguageChangeNotification,
commands::OnVRLanguageChangeNotification,
- commands::OnTTSLanguageChangeNotification> HMICommandsListFourth;
+ commands::OnTTSLanguageChangeNotification>
+ HMICommandsListFourth;
-typedef Types<commands::OnVIGpsDataNotification,
- commands::OnVISpeedNotification,
- commands::OnVIRpmNotification,
- commands::OnVIFuelLevelNotification,
- commands::OnVIFuelLevelStateNotification,
- commands::OnVIInstantFuelConsumptionNotification,
- commands::OnVIExternalTemperatureNotification,
- commands::OnVIVinNotification,
- commands::OnVIPrndlNotification,
- commands::OnVITirePressureNotification,
- commands::OnVIOdometerNotification,
- commands::OnVIBeltStatusNotification,
- commands::OnVIBodyInformationNotification,
- commands::OnVIDeviceStatusNotification,
- commands::OnVIDriverBrakingNotification,
- commands::OnVIWiperStatusNotification,
- commands::OnVIHeadLampStatusNotification,
- commands::OnVIEngineTorqueNotification,
- commands::OnVIAccPedalPositionNotification,
- commands::OnVISteeringWheelAngleNotification,
- commands::OnVIMyKeyNotification,
- commands::AllowAllAppsRequest,
+typedef Types<commands::AllowAllAppsRequest,
commands::AllowAllAppsResponse,
commands::AllowAppRequest,
- commands::AllowAppResponse> HMICommandsListFifth;
+ commands::AllowAppResponse,
+ commands::BCGetFilePathRequest,
+ commands::BCGetFilePathResponse>
+ HMICommandsListFifth;
TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst);
TYPED_TEST_CASE(HMICommandsTestSecond, HMICommandsListSecond);
@@ -548,32 +509,32 @@ TYPED_TEST_CASE(HMICommandsTestFourth, HMICommandsListFourth);
TYPED_TEST_CASE(HMICommandsTestFifth, HMICommandsListFifth);
TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) {
- utils::SharedPtr<typename TestFixture::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(HMICommandsTestSecond, CtorAndDtorCall) {
- utils::SharedPtr<typename TestFixture::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(HMICommandsTestThird, CtorAndDtorCall) {
- utils::SharedPtr<typename TestFixture::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(HMICommandsTestFourth, CtorAndDtorCall) {
- utils::SharedPtr<typename TestFixture::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(HMICommandsTestFifth, CtorAndDtorCall) {
- utils::SharedPtr<typename TestFixture::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
} // namespace dummy_hmi_commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc
index 6262e1dd8a..5b860499dd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc
@@ -34,14 +34,14 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/smart_object_keys.h"
#include "hmi/get_system_info_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -49,14 +49,13 @@ namespace commands_test {
namespace hmi_commands_test {
namespace get_system_info_request {
-using ::utils::SharedPtr;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
using am::commands::RequestToHMI;
using sdl_rpc_plugin::commands::GetSystemInfoRequest;
-using am::commands::CommandImpl;
-typedef SharedPtr<RequestToHMI> RequestToHMIPtr;
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
namespace {
const uint32_t kConnectionKey = 2u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc
index 3a68264e2a..11589683be 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc
@@ -33,36 +33,34 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/response_from_hmi.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/commands/response_from_hmi.h"
-#include "hmi/get_system_info_response.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/get_system_info_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace commands_test {
namespace hmi_commands_test {
namespace get_system_info_response {
-using ::testing::Return;
-using ::utils::SharedPtr;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
+using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::GetSystemInfoResponse;
using sdl_rpc_plugin::commands::SystemInfo;
-using am::commands::CommandImpl;
-typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr;
+typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
MockHMICapabilities;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc
deleted file mode 100644
index 7788cb2ebe..0000000000
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Copyright (c) 2018, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdint.h>
-#include <string>
-
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "application_manager/message.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_application.h"
-#include "application_manager/mock_application_manager.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/command.h"
-#include "hmi/get_urls.h"
-#include "application_manager/policies/policy_handler.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/commands/command_request_test.h"
-#include "application_manager/commands/request_from_hmi.h"
-#include "policy/mock_policy_manager.h"
-#include "application_manager/event_engine/event_dispatcher.h"
-
-namespace test {
-namespace components {
-namespace commands_test {
-namespace hmi_commands_test {
-namespace get_urls {
-
-using namespace hmi_apis;
-using namespace policy;
-using ::utils::SharedPtr;
-using ::testing::NiceMock;
-using ::testing::_;
-using ::testing::SetArgReferee;
-using ::test::components::application_manager_test::MockApplication;
-namespace am = ::application_manager;
-namespace strings = ::application_manager::strings;
-using am::commands::RequestFromHMI;
-using sdl_rpc_plugin::commands::GetUrls;
-using am::commands::CommandImpl;
-using policy::PolicyHandler;
-using policy_test::MockPolicyHandlerInterface;
-
-typedef SharedPtr<RequestFromHMI> RequestFromHMIPtr;
-
-namespace {
-const uint32_t kInvalidAppId_ = 0u;
-const uint32_t kAppIdForSending = 1u;
-const uint32_t kConnectionKey = 2u;
-const uint32_t kServiceType = 0u;
-const std::string kInitialService = "0x0";
-const std::string kPolicyService = "7";
-const std::string kDefaultUrl = "URL is not found";
-const std::string kDefaultId = "default";
-const std::string kPolicyAppId = "policy_app_id";
-} // namespace
-
-class GetUrlsTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- MessageSharedPtr command_msg_;
- RequestFromHMIPtr request_command_;
-
- GetUrlsTest() {
- command_msg_ =
- CreateMessage(NsSmartDeviceLink::NsSmartObjects::SmartType_Map);
- (*command_msg_)[am::strings::params][am::strings::connection_key] =
- kConnectionKey;
- (*command_msg_)[am::strings::msg_params][am::hmi_request::service] =
- kInitialService;
-
- request_command_ = CreateCommand<GetUrls>(command_msg_);
- }
-};
-
-TEST_F(GetUrlsTest, RUN_SUCCESS) {
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
- // EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(_, _));
-
- request_command_->Run();
-}
-
-TEST_F(GetUrlsTest, RUN_PolicyNotEnabled_UNSUCCESS) {
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(false));
-
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
- .WillOnce(Return(true));
-
- request_command_->Run();
-
- EXPECT_EQ(am::MessageType::kResponse,
- (*command_msg_)[strings::params][strings::message_type].asInt());
- EXPECT_EQ(Common_Result::DATA_NOT_AVAILABLE,
- (*command_msg_)[strings::params][am::hmi_response::code].asInt());
-}
-
-TEST_F(GetUrlsTest, RUN_EmptyEndpoints_UNSUCCESS) {
- EndpointUrls endpoints_;
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kServiceType, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
- .WillOnce(Return(true));
-
- request_command_->Run();
-
- EXPECT_EQ(am::MessageType::kResponse,
- (*command_msg_)[strings::params][strings::message_type].asInt());
- EXPECT_EQ(Common_Result::DATA_NOT_AVAILABLE,
- (*command_msg_)[strings::params][am::hmi_response::code].asInt());
-}
-
-#ifdef EXTENDED_POLICY
-TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_SUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_request::service] =
- kPolicyService;
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- endpoints_.push_back(data);
-
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
-
- MockAppPtr mock_app = CreateMockApp();
-
- EXPECT_CALL(mock_policy_handler_, GetAppIdForSending())
- .WillOnce(Return(kAppIdForSending));
-
- EXPECT_CALL(app_mngr_, application(kAppIdForSending))
- .WillOnce(Return(mock_app));
- EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppIdForSending));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
- .WillOnce(Return(true));
-
- request_command_->Run();
-
- EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists(
- am::hmi_request::service));
-
- EXPECT_EQ(am::MessageType::kResponse,
- (*command_msg_)[strings::params][strings::message_type].asInt());
- EXPECT_EQ(Common_Result::SUCCESS,
- (*command_msg_)[strings::params][am::hmi_response::code].asInt());
-
- EXPECT_EQ(kAppIdForSending,
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [strings::app_id].asInt());
- EXPECT_EQ(kDefaultUrl,
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [strings::url].asString());
-}
-
-TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_IncorrectIdForSending_UNSUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_request::service] =
- kPolicyService;
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- endpoints_.push_back(data);
-
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
-
- EXPECT_CALL(mock_policy_handler_, GetAppIdForSending())
- .WillOnce(Return(kInvalidAppId_));
-
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
- .WillOnce(Return(true));
-
- EXPECT_CALL(app_mngr_, application(kInvalidAppId_)).Times(0);
-
- request_command_->Run();
-}
-
-TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_ApplicationIsNotValid_UNSUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_request::service] =
- kPolicyService;
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- endpoints_.push_back(data);
-
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
-
- MockAppPtr invalid_mock_app;
-
- EXPECT_CALL(mock_policy_handler_, GetAppIdForSending())
- .WillOnce(Return(kAppIdForSending));
-
- EXPECT_CALL(app_mngr_, application(kAppIdForSending))
- .WillOnce(Return(invalid_mock_app));
-
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
- .WillOnce(Return(true));
-
- request_command_->Run();
-
- EXPECT_EQ(am::MessageType::kResponse,
- (*command_msg_)[strings::params][strings::message_type].asInt());
- EXPECT_EQ(Common_Result::DATA_NOT_AVAILABLE,
- (*command_msg_)[strings::params][am::hmi_response::code].asInt());
-}
-
-TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_FoundURLForApplication_SUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_request::service] =
- kPolicyService;
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- data.app_id = kPolicyAppId;
- endpoints_.push_back(data);
-
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
-
- MockAppPtr mock_app = CreateMockApp();
-
- EXPECT_CALL(mock_policy_handler_, GetAppIdForSending())
- .WillOnce(Return(kAppIdForSending));
-
- EXPECT_CALL(app_mngr_, application(kAppIdForSending))
- .WillOnce(Return(mock_app));
-
- EXPECT_CALL(*mock_app, policy_app_id()).WillOnce(Return(kPolicyAppId));
-
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_))
- .WillOnce(Return(true));
-
- request_command_->Run();
-
- EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists(
- am::hmi_request::service));
-
- EXPECT_EQ(am::MessageType::kResponse,
- (*command_msg_)[strings::params][strings::message_type].asInt());
- EXPECT_EQ(Common_Result::SUCCESS,
- (*command_msg_)[strings::params][am::hmi_response::code].asInt());
-}
-#endif
-
-TEST_F(GetUrlsTest, DISABLED_ProcessServiceURLs_SUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] =
- kDefaultUrl;
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [am::hmi_response::policy_app_id] = "1";
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
-
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- data.app_id = "1";
- endpoints_.push_back(data);
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kServiceType, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
-
- request_command_->Run();
-
- EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists(
- am::hmi_request::service));
- EXPECT_EQ(kDefaultUrl,
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [am::strings::url].asString());
- EXPECT_EQ(endpoints_[0].app_id,
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [am::hmi_response::policy_app_id].asString());
-}
-
-TEST_F(GetUrlsTest, ProcessServiceURLs_PolicyDefaultId_SUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] =
- kDefaultUrl;
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- [am::hmi_response::policy_app_id] = kDefaultId;
-
- EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true));
- EndpointUrls endpoints_;
- EndpointData data(kDefaultUrl);
- endpoints_.push_back(data);
- EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kServiceType, _))
- .WillOnce(SetArgReferee<1>(endpoints_));
- MockAppPtr mock_app = CreateMockApp();
- EXPECT_CALL(app_mngr_, application_by_policy_id(_))
- .WillOnce(Return(mock_app));
- request_command_->Run();
-
- EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists(
- am::hmi_request::service));
- EXPECT_TRUE(
- (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0]
- .keyExists(am::hmi_response::policy_app_id));
-}
-
-} // namespace get_urls
-} // namespace hmi_commands_test
-} // namespace commands_test
-} // namespace components
-} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
index b498d07d99..26f7a63872 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
@@ -33,104 +33,81 @@
#include <stdint.h>
#include <string>
#include <vector>
-#include "gtest/gtest.h"
#include "application_manager/commands/commands_test.h"
-
-#include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h"
+#include "gtest/gtest.h"
+#include "sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_app_permission_changed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_app_registered_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_file_removed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_policy_update.h"
#include "sdl_rpc_plugin/commands/hmi/on_put_file_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ready_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h"
+#include "sdl_rpc_plugin/commands/hmi/on_record_start_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_resume_audio_source_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_consent_needed_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_sdl_persistence_complete_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h"
#include "sdl_rpc_plugin/commands/hmi/on_status_update_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_record_start_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ready_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_error_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_policy_update.h"
-#include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_error_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h"
#include "sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h"
-#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h"
-#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h"
-#include "utils/lock.h"
#include "utils/data_accessor.h"
+#include "utils/lock.h"
#include "utils/signals.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-#include "utils/file_system.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_rpc_plugin_manager.h"
-#include "application_manager/mock_state_controller.h"
+
+#include "application_manager/hmi_capabilities_impl.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/hmi_capabilities_impl.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "transport_manager/mock_transport_manager.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/mock_rpc_plugin_manager.h"
+#include "application_manager/mock_state_controller.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
#include "connection_handler/mock_connection_handler.h"
#include "connection_handler/mock_connection_handler_settings.h"
-#include "test/application_manager/mock_application_manager_settings.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_message_helper.h"
#include "protocol_handler/mock_session_observer.h"
-#include "application_manager/mock_resume_ctrl.h"
+#include "smart_objects/smart_object.h"
+#include "test/application_manager/mock_application_manager_settings.h"
+#include "transport_manager/mock_transport_manager.h"
+#include "utils/file_system.h"
namespace am = application_manager;
@@ -140,27 +117,26 @@ namespace commands_test {
namespace hmi_commands_test {
namespace hmi_notifications_test {
-using ::testing::_;
-using ::testing::Test;
-using ::testing::Types;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::NiceMock;
-using ::testing::InSequence;
-using ::utils::SharedPtr;
-using ::smart_objects::SmartObject;
+using ::application_manager::ApplicationSharedPtr;
+using ::application_manager::MockMessageHelper;
using ::application_manager::commands::MessageSharedPtr;
+using ::smart_objects::SmartObject;
+using ::test::components::application_manager_test::MockApplication;
using ::test::components::application_manager_test::MockApplicationManager;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
-using ::application_manager::ApplicationSharedPtr;
-using ::test::components::application_manager_test::MockApplication;
using ::test::components::event_engine_test::MockEventDispatcher;
-using ::application_manager::MockMessageHelper;
+using ::testing::_;
+using ::testing::InSequence;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::Test;
+using ::testing::Types;
using namespace sdl_rpc_plugin::commands;
using namespace am::commands;
-typedef SharedPtr<MockApplication> MockAppPtr;
+typedef std::shared_ptr<MockApplication> MockAppPtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
MockHMICapabilities;
@@ -172,6 +148,11 @@ typedef NiceMock<
#define NAVI true
#define NOT_NAVI false
+namespace {
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
ACTION_P(GetEventId, event_id) {
*event_id = arg0.id();
}
@@ -179,8 +160,8 @@ ACTION_P(GetArg, arg) {
*arg = arg0;
}
-ACTION_P(GetArg3, result) {
- arg3 = *result;
+ACTION_P(GetArg4, result) {
+ arg4 = *result;
}
ACTION_P2(GetConnectIdPermissionConsent, connect_id, consent) {
@@ -216,6 +197,14 @@ const int32_t kMobileProtocolType_ = 0;
const int32_t kProtocolVersion_ = 3;
const uint32_t kCorrelationId_ = 1939u;
const uint32_t kAppId_ = 2014u;
+const std::string kDefaultLanguage = "en-us";
+const mobile_apis::Language::eType kMobileLanguage =
+ mobile_apis::Language::EN_US;
+
+// LSDW - lock screen dismissal warning
+const std::string kLockScreenDismissalWarningMessage_en =
+ "Swipe down to dismiss, acknowledging that you are not the driver";
+const uint32_t kConnectionKey = 2u;
} // namespace
class HMICommandsNotificationsTest
@@ -264,6 +253,9 @@ class HMICommandsNotificationsTest
.WillByDefault(ReturnRef(mock_event_dispatcher_));
ON_CALL(app_mngr_, application_by_hmi_app(_)).WillByDefault(Return(app_));
ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_));
+ ON_CALL(app_mngr_, application(kConnectionKey)).WillByDefault(Return(app_));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(kMobileLanguage))
+ .WillByDefault(Return(kDefaultLanguage));
}
am::ApplicationSharedPtr ConfigureApp(NiceMock<MockApplication>** app_mock,
@@ -283,6 +275,8 @@ class HMICommandsNotificationsTest
.WillByDefault(Return(vc));
ON_CALL(**app_mock, IsAudioApplication())
.WillByDefault(Return(media || navi || vc));
+ ON_CALL(**app_mock, ui_language())
+ .WillByDefault(ReturnRef(kMobileLanguage));
return app;
}
#if defined(OS_POSIX)
@@ -312,12 +306,6 @@ void sig_handler(int sig) {
} // namespace
template <class Command>
-class HMIOnViNotifications : public commands_test::CommandsTest<kIsNice> {
- public:
- typedef Command CommandType;
-};
-
-template <class Command>
class HMIOnNotificationsListToHMI
: public commands_test::CommandsTest<kIsNice> {
public:
@@ -349,7 +337,8 @@ typedef Types<OnAppPermissionChangedNotification,
OnSDLPersistenceCompleteNotification,
OnStatusUpdateNotification,
OnVideoDataStreamingNotification,
- OnRecordStartdNotification> HMIOnNotificationsListToHMITypes;
+ OnRecordStartdNotification>
+ HMIOnNotificationsListToHMITypes;
typedef Types<
CommandPair<OnAppActivatedNotification,
@@ -375,7 +364,7 @@ TYPED_TEST_CASE(HMIOnNotificationsEventDispatcher,
TYPED_TEST(HMIOnNotificationsListToHMI, CommandsSendNotificationToHmi) {
MessageSharedPtr message =
commands_test::CommandsTest<kIsNice>::CreateMessage();
- utils::SharedPtr<typename TestFixture::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>(message);
EXPECT_CALL(commands_test::CommandsTest<kIsNice>::mock_rpc_service_,
SendMessageToHMI(_));
@@ -393,7 +382,7 @@ TYPED_TEST(HMIOnNotificationsEventDispatcher,
int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM;
MessageSharedPtr message =
commands_test::CommandsTest<kIsNice>::CreateMessage();
- utils::SharedPtr<typename TestFixture::CommandType::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType::CommandType> command =
this->template CreateCommand<
typename TestFixture::CommandType::CommandType>(message);
EXPECT_CALL(commands_test::CommandsTest<kIsNice>::app_mngr_,
@@ -408,7 +397,7 @@ TYPED_TEST(HMIOnNotificationsEventDispatcher,
// notifications(SendNotificationToMobile)
TEST_F(HMICommandsNotificationsTest, OnButtonEventSendNotificationToMobile) {
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<hmi::OnButtonEventNotification>(message);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
@@ -421,7 +410,7 @@ TEST_F(HMICommandsNotificationsTest, OnButtonEventSendNotificationToMobile) {
TEST_F(HMICommandsNotificationsTest, OnNaviTBTClientSendNotificationToMobile) {
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnNaviTBTClientStateNotification>(message);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
@@ -435,7 +424,7 @@ TEST_F(HMICommandsNotificationsTest, OnNaviTBTClientSendNotificationToMobile) {
TEST_F(HMICommandsNotificationsTest,
OnNaviWayPointChangeSendNotificationToMobile) {
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnNaviWayPointChangeNotification>(message);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
@@ -448,7 +437,7 @@ TEST_F(HMICommandsNotificationsTest,
TEST_F(HMICommandsNotificationsTest, OnUICommandSendNotificationToMobile) {
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnUICommandNotification>(message);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
@@ -465,7 +454,7 @@ TEST_F(HMICommandsNotificationsTest, OnUICommandSendNotificationToMobile) {
TEST_F(HMICommandsNotificationsTest,
OnUIKeyBoardInputSendNotificationToMobile) {
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<hmi::OnUIKeyBoardInputNotification>(message);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
@@ -478,7 +467,7 @@ TEST_F(HMICommandsNotificationsTest,
TEST_F(HMICommandsNotificationsTest, OnUITouchEventSendNotificationToMobile) {
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<hmi::OnUITouchEventNotification>(message);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
@@ -493,7 +482,7 @@ TEST_F(HMICommandsNotificationsTest,
OnAppRegisteredNotificationSendNotificationToHmi) {
int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM;
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnAppRegisteredNotification>(message);
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_));
EXPECT_CALL(app_mngr_, event_dispatcher());
@@ -515,7 +504,7 @@ TEST_F(HMICommandsNotificationsTest,
OnAppUnregisteredNotificationEventDispatcher) {
int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM;
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnAppUnregisteredNotification>(message);
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_));
EXPECT_CALL(app_mngr_, event_dispatcher());
@@ -536,7 +525,7 @@ TEST_F(HMICommandsNotificationsTest,
TEST_F(HMICommandsNotificationsTest, OnButtonPressNotificationEventDispatcher) {
int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM;
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<hmi::OnButtonPressNotification>(message);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL));
@@ -553,7 +542,7 @@ TEST_F(HMICommandsNotificationsTest, OnButtonPressNotificationEventDispatcher) {
TEST_F(HMICommandsNotificationsTest, OnReadyNotificationEventDispatcher) {
int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM;
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnReadyNotification>(message);
EXPECT_CALL(app_mngr_, OnHMIStartedCooperation());
@@ -568,7 +557,7 @@ TEST_F(HMICommandsNotificationsTest, OnReadyNotificationEventDispatcher) {
TEST_F(HMICommandsNotificationsTest,
OnIgnitionCycleOverNotificationPolicyHandler) {
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnIgnitionCycleOverNotification>(message);
EXPECT_CALL(mock_policy_handler_, OnIgnitionCycleOver());
@@ -577,7 +566,7 @@ TEST_F(HMICommandsNotificationsTest,
TEST_F(HMICommandsNotificationsTest, OnPolicyUpdateNotificationPolicyHandler) {
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command = CreateCommand<OnPolicyUpdate>(message);
+ std::shared_ptr<Command> command = CreateCommand<OnPolicyUpdate>(message);
EXPECT_CALL(mock_policy_handler_, OnPTExchangeNeeded());
command->Run();
@@ -594,7 +583,7 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage(smart_objects::SmartType_String);
(*message)[am::strings::msg_params][am::hmi_notification::policyfile] = kFile;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnReceivedPolicyUpdate>(message);
EXPECT_CALL(mock_policy_handler_, ReceiveMessageFromSDK(kFile, data));
@@ -606,7 +595,7 @@ TEST_F(HMICommandsNotificationsTest,
TEST_F(HMICommandsNotificationsTest,
OnReceivePolicyUpdateNotification_UNSUCCESS) {
MessageSharedPtr message = CreateMessage(smart_objects::SmartType_String);
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnReceivedPolicyUpdate>(message);
EXPECT_CALL(mock_policy_handler_, ReceiveMessageFromSDK(_, _)).Times(0);
@@ -624,7 +613,7 @@ TEST_F(HMICommandsNotificationsTest,
smart_objects::SmartObject hmi_application_temp(smart_objects::SmartType_Map);
applications[0] = hmi_application_temp;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnAppPermissionConsentNotification>(message);
int32_t connection_id = -1;
@@ -646,11 +635,11 @@ TEST_F(HMICommandsNotificationsTest,
smart_objects::SmartObject(smart_objects::SmartType_Array);
smart_objects::SmartObjectSPtr consented_function =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*message)[am::strings::msg_params]["consentedFunctions"][0] =
*consented_function;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnAppPermissionConsentNotification>(message);
int32_t connection_id = -1;
@@ -680,14 +669,14 @@ TEST_F(HMICommandsNotificationsTest,
(*message)[am::strings::msg_params]["source"] = "test_content_source";
smart_objects::SmartObjectSPtr consented_function =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*consented_function)["allowed"] = true;
(*consented_function)[am::strings::id] = 999;
(*consented_function)[am::strings::name] = "test_group_alias";
(*message)[am::strings::msg_params]["consentedFunctions"][0] =
*consented_function;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnAppPermissionConsentNotification>(message);
int32_t connection_id = -1;
@@ -721,14 +710,14 @@ TEST_F(HMICommandsNotificationsTest,
(*message)[am::strings::msg_params]["source"] = "test_content_source";
smart_objects::SmartObjectSPtr consented_function =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*consented_function)["allowed"] = false;
(*consented_function)[am::strings::id] = 999;
(*consented_function)[am::strings::name] = "test_group_alias";
(*message)[am::strings::msg_params]["consentedFunctions"][0] =
*consented_function;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnAppPermissionConsentNotification>(message);
int32_t connection_id = -1;
@@ -759,7 +748,7 @@ TEST_F(HMICommandsNotificationsTest,
(*message)[am::strings::msg_params][am::hmi_notification::error] =
hmi_apis::Common_SystemError::SYNC_REBOOTED;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnSystemErrorNotification>(message);
int32_t code = hmi_apis::Common_SystemError::INVALID_ENUM;
@@ -775,7 +764,7 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::language] = kLangCode;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnSystemInfoChangedNotification>(message);
EXPECT_CALL(mock_message_helper_, CommonLanguageToString(_));
@@ -788,7 +777,7 @@ TEST_F(HMICommandsNotificationsTest,
const std::string kDeviceId = "";
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_response::allowed] = true;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnAllowSDLFunctionalityNotification>(message);
bool value = false;
@@ -806,7 +795,7 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_response::allowed] = true;
(*message)[am::strings::msg_params]["device"]["id"] = kDeviceId;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnAllowSDLFunctionalityNotification>(message);
bool value;
@@ -823,7 +812,7 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params]["deviceState"] =
hmi_apis::Common_DeviceState::INVALID_ENUM;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnDeviceStateChangedNotification>(message);
EXPECT_CALL(mock_policy_handler_, RemoveDevice(_)).Times(0);
@@ -839,7 +828,7 @@ TEST_F(HMICommandsNotificationsTest,
hmi_apis::Common_DeviceState::UNPAIRED;
(*message)[am::strings::msg_params]["deviceInternalId"] = device_id;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnDeviceStateChangedNotification>(message);
EXPECT_CALL(mock_policy_handler_, RemoveDevice(_));
@@ -854,7 +843,7 @@ TEST_F(HMICommandsNotificationsTest,
hmi_apis::Common_DeviceState::UNPAIRED;
(*message)[am::strings::msg_params]["deviceInternalId"] = empty_device_id;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnDeviceStateChangedNotification>(message);
std::string device_id = "default_id";
@@ -874,7 +863,7 @@ TEST_F(HMICommandsNotificationsTest,
(*message)[am::strings::msg_params]["deviceInternalId"] = empty_device_id;
(*message)[am::strings::msg_params]["deviceId"]["id"] = id;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnDeviceStateChangedNotification>(message);
std::string device_id = "default_id";
@@ -891,7 +880,7 @@ TEST_F(HMICommandsNotificationsTest,
(*message)[am::strings::msg_params][am::hmi_request::reason] =
hmi_apis::Common_ApplicationsCloseReason::IGNITION_OFF;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnExitAllApplicationsNotification>(message);
#if defined(OS_POSIX)
am::mobile_api::AppInterfaceUnregisteredReason::eType mob_reason;
@@ -902,7 +891,7 @@ TEST_F(HMICommandsNotificationsTest,
SubscribeForSignal();
command->Run();
- utils::WaitTerminationSignals(sig_handler);
+ utils::Signals::WaitTerminationSignals(sig_handler);
EXPECT_EQ(am::mobile_api::AppInterfaceUnregisteredReason::IGNITION_OFF,
mob_reason);
@@ -933,7 +922,7 @@ TEST_F(HMICommandsNotificationsTest,
for (; it_reason != reason_list.end(); ++it_reason, ++it_mob_reason) {
(*message)[am::strings::msg_params][am::hmi_request::reason] = *it_reason;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnExitAllApplicationsNotification>(message);
#if defined(OS_POSIX)
am::mobile_api::AppInterfaceUnregisteredReason::eType mob_reason =
@@ -944,7 +933,7 @@ TEST_F(HMICommandsNotificationsTest,
SubscribeForSignal();
command->Run();
- utils::WaitTerminationSignals(sig_handler);
+ utils::Signals::WaitTerminationSignals(sig_handler);
#endif
}
}
@@ -955,7 +944,7 @@ TEST_F(HMICommandsNotificationsTest,
(*message)[am::strings::msg_params][am::hmi_request::reason] =
hmi_apis::Common_ApplicationsCloseReason::SUSPEND;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnExitAllApplicationsNotification>(message);
MessageSharedPtr ethalon_message =
@@ -975,7 +964,7 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(kCorrelationId_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(GetMessage(temp_message));
command->Run();
@@ -997,13 +986,13 @@ TEST_F(HMICommandsNotificationsTest,
(*message)[am::strings::msg_params][am::hmi_request::reason] =
hmi_apis::Common_ApplicationsCloseReason::INVALID_ENUM;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnExitAllApplicationsNotification>(message);
EXPECT_CALL(app_mngr_, SetUnregisterAllApplicationsReason(_)).Times(0);
EXPECT_CALL(app_mngr_, HeadUnitReset(_)).Times(0);
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
command->Run();
}
@@ -1012,7 +1001,7 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::app_id] = kAppId_;
smart_objects::SmartObjectSPtr notification =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*notification)[am::strings::params][am::strings::function_id] =
static_cast<int32_t>(
mobile_apis::FunctionID::OnAppInterfaceUnregisteredID);
@@ -1040,7 +1029,7 @@ TEST_F(HMICommandsNotificationsTest,
for (; it_reason != reason_list.end(); ++it_reason, ++it_mobile_reason) {
(*message)[am::strings::msg_params][am::strings::reason] = *it_reason;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnExitApplicationNotification>(message);
(*notification)[am::strings::msg_params][am::strings::reason] =
@@ -1053,7 +1042,8 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, application(kAppId_)).WillRepeatedly(Return(app_));
EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
- kAppId_, *it_mobile_reason)).WillOnce(Return(notification));
+ kAppId_, *it_mobile_reason))
+ .WillOnce(Return(notification));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(notification, Command::SOURCE_SDL));
EXPECT_CALL(app_mngr_,
@@ -1071,7 +1061,7 @@ TEST_F(HMICommandsNotificationsTest,
(*message)[am::strings::msg_params][am::strings::reason] =
hmi_apis::Common_ApplicationExitReason::INVALID_ENUM;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnExitApplicationNotification>(message);
am::plugin_manager::MockRPCPluginManager mock_rpc_plugin_manager_;
@@ -1091,7 +1081,7 @@ TEST_F(HMICommandsNotificationsTest, OnExitApplicationNotificationInvalidApp) {
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::app_id] = kAppId_;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnExitApplicationNotification>(message);
am::ApplicationSharedPtr invalid_app;
@@ -1109,7 +1099,7 @@ TEST_F(HMICommandsNotificationsTest,
(*message)[am::strings::msg_params][am::strings::app_id] = kAppId_;
(*message)[am::strings::msg_params][am::strings::reason] =
hmi_apis::Common_ApplicationExitReason::DRIVER_DISTRACTION_VIOLATION;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnExitApplicationNotification>(message);
EXPECT_CALL(app_mngr_, application(kAppId_)).WillRepeatedly(Return(app_));
@@ -1118,6 +1108,7 @@ TEST_F(HMICommandsNotificationsTest,
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
SetRegularState(app_,
+ kDefaultWindowId,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
@@ -1131,7 +1122,7 @@ TEST_F(HMICommandsNotificationsTest,
(*message)[am::strings::msg_params][am::strings::app_id] = kAppId_;
(*message)[am::strings::msg_params][am::strings::reason] =
hmi_apis::Common_ApplicationExitReason::USER_EXIT;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnExitApplicationNotification>(message);
am::plugin_manager::MockRPCPluginManager mock_rpc_plugin_manager_;
EXPECT_CALL(app_mngr_, GetPluginManager())
@@ -1142,12 +1133,7 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, UnregisterApplication(_, _, _, _)).Times(0);
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_,
- SetRegularState(app_,
- mobile_apis::HMILevel::HMI_NONE,
- mobile_apis::AudioStreamingState::NOT_AUDIBLE,
- mobile_apis::VideoStreamingState::NOT_STREAMABLE,
- false));
+ EXPECT_CALL(mock_state_controller_, ExitDefaultWindow(app_));
command->Run();
}
@@ -1158,14 +1144,15 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::cmd_id] = cmd_id;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnVRCommandNotification>(message);
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
- SetRegularState(_, mobile_apis::HMILevel::HMI_FULL, true));
+ SetRegularState(
+ _, kDefaultWindowId, mobile_apis::HMILevel::HMI_FULL, true));
EXPECT_CALL(app_mngr_, get_settings())
.WillOnce(ReturnRef(app_mngr_settings_));
@@ -1180,7 +1167,7 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::cmd_id] = kCmdId;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnVRCommandNotification>(message);
am::ApplicationSharedPtr invalid_app;
@@ -1199,7 +1186,7 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::cmd_id] = kCmdId;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnVRCommandNotification>(message);
EXPECT_CALL(app_mngr_, application(_)).Times(0);
@@ -1216,7 +1203,7 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::cmd_id] = kCmdId;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnVRCommandNotification>(message);
am::ApplicationSharedPtr invalid_app;
@@ -1237,7 +1224,7 @@ TEST_F(HMICommandsNotificationsTest,
int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::cmd_id] = kCmdId;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnVRCommandNotification>(message);
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
@@ -1263,7 +1250,7 @@ TEST_F(HMICommandsNotificationsTest,
(*message)[am::strings::msg_params][am::strings::cmd_id] = kCmdId;
(*message)[am::strings::msg_params][am::strings::function_id] =
mobile_apis::FunctionID::eType::OnCommandID;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnVRCommandNotification>(message);
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
@@ -1290,7 +1277,7 @@ TEST_F(HMICommandsNotificationsTest, OnVRLanguageChangeNotificationEmptyData) {
const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::language] = kLang;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnVRLanguageChangeNotification>(message);
EXPECT_CALL(mock_hmi_capabilities_, active_ui_language())
@@ -1308,7 +1295,7 @@ TEST_F(HMICommandsNotificationsTest,
const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::language] = kLang;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnVRLanguageChangeNotification>(message);
application_set_.insert(app_);
@@ -1341,12 +1328,12 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::language] =
mobile_apis::Language::EN_US;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnVRLanguageChangeNotification>(message);
application_set_.insert(app_);
smart_objects::SmartObjectSPtr notification =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*notification)[am::strings::params][am::strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
(*notification)[am::strings::params][am::strings::message_type] =
@@ -1366,8 +1353,10 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_,
- SetRegularState(app_, mobile_apis::HMILevel::HMI_NONE, false));
+ EXPECT_CALL(
+ mock_state_controller_,
+ SetRegularState(
+ app_, kDefaultWindowId, mobile_apis::HMILevel::HMI_NONE, false));
EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kAppId_,
@@ -1394,7 +1383,7 @@ TEST_F(HMICommandsNotificationsTest,
TEST_F(HMICommandsNotificationsTest, OnStartDeviceDiscoveryRun) {
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnStartDeviceDiscovery>(message);
EXPECT_CALL(app_mngr_, StartDevicesDiscovery());
command->Run();
@@ -1405,19 +1394,20 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::device_info]
[am::strings::id] = "2014";
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnDeviceChosenNotification>(message);
- EXPECT_CALL(app_mngr_,
- ConnectToDevice(
- (*message)[am::strings::msg_params][am::strings::device_info]
- [am::strings::id].asString()));
+ EXPECT_CALL(
+ app_mngr_,
+ ConnectToDevice((*message)[am::strings::msg_params]
+ [am::strings::device_info][am::strings::id]
+ .asString()));
command->Run();
}
TEST_F(HMICommandsNotificationsTest,
OnDeviceChosenNotificationDeviceInfoNotExists) {
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnDeviceChosenNotification>(message);
EXPECT_CALL(app_mngr_, ConnectToDevice(_)).Times(0);
command->Run();
@@ -1438,12 +1428,13 @@ TEST_F(HMICommandsNotificationsTest,
for (; it != system_context_list.end(); ++it) {
(*message)[am::strings::msg_params][am::hmi_notification::system_context] =
*it;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnSystemContextNotification>(message);
EXPECT_CALL(app_mngr_, active_application()).WillOnce(Return(app_));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(app_, *it));
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(app_, kDefaultWindowId, *it));
command->Run();
}
}
@@ -1453,7 +1444,7 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_notification::system_context] =
am::mobile_api::SystemContext::SYSCTXT_VRSESSION;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnSystemContextNotification>(message);
ApplicationSharedPtr invalid_app;
EXPECT_CALL(app_mngr_, active_application()).WillOnce(Return(invalid_app));
@@ -1466,7 +1457,7 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_notification::system_context] =
am::mobile_api::SystemContext::INVALID_ENUM;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnSystemContextNotification>(message);
EXPECT_CALL(app_mngr_, active_application()).Times(0);
EXPECT_CALL(app_mngr_, application(_)).Times(0);
@@ -1487,12 +1478,13 @@ TEST_F(HMICommandsNotificationsTest,
for (; it != system_context_list.end(); ++it) {
(*message)[am::strings::msg_params][am::hmi_notification::system_context] =
*it;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnSystemContextNotification>(message);
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(app_, *it));
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(app_, kDefaultWindowId, *it));
command->Run();
}
}
@@ -1502,7 +1494,7 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_notification::system_context] =
am::mobile_api::SystemContext::SYSCTXT_ALERT;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnSystemContextNotification>(message);
EXPECT_CALL(app_mngr_, application(_)).Times(0);
EXPECT_CALL(app_mngr_, state_controller()).Times(0);
@@ -1513,7 +1505,7 @@ TEST_F(HMICommandsNotificationsTest,
OnSystemRequestNotificationAppIdExistsAndValidApp) {
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::app_id] = kAppId_;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnSystemRequestNotification>(message);
EXPECT_CALL(app_mngr_, application(kAppId_)).WillOnce(Return(app_));
@@ -1547,7 +1539,7 @@ TEST_F(HMICommandsNotificationsTest,
OnSystemRequestNotificationAppIdExistsAndInvalidApp) {
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::app_id] = kAppId_;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnSystemRequestNotification>(message);
ApplicationSharedPtr invalid_app;
EXPECT_CALL(app_mngr_, application(kAppId_)).WillOnce(Return(invalid_app));
@@ -1562,7 +1554,7 @@ TEST_F(HMICommandsNotificationsTest,
TEST_F(HMICommandsNotificationsTest,
OnSystemRequestNotificationAppIdDoesntExistsAndValidApp) {
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnSystemRequestNotification>(message);
EXPECT_CALL(mock_policy_handler_, GetAppIdForSending())
@@ -1598,7 +1590,7 @@ TEST_F(HMICommandsNotificationsTest,
OnSystemRequestNotificationAppIdDoesntExistsAndNullAppId) {
const uint32_t kNullApppId = 0u;
MessageSharedPtr message = CreateMessage();
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnSystemRequestNotification>(message);
EXPECT_CALL(mock_policy_handler_, GetAppIdForSending())
@@ -1612,7 +1604,7 @@ TEST_F(HMICommandsNotificationsTest, OnTTSLanguageChangeNotificationEmptyData) {
const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::language] = kLang;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnTTSLanguageChangeNotification>(message);
EXPECT_CALL(mock_hmi_capabilities_, set_active_tts_language(_));
@@ -1631,7 +1623,7 @@ TEST_F(HMICommandsNotificationsTest,
const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::language] = kLang;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnTTSLanguageChangeNotification>(message);
application_set_.insert(app_);
@@ -1665,12 +1657,12 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::language] =
mobile_apis::Language::EN_US;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnTTSLanguageChangeNotification>(message);
application_set_.insert(app_);
smart_objects::SmartObjectSPtr notification =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*notification)[am::strings::params][am::strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
(*notification)[am::strings::params][am::strings::message_type] =
@@ -1717,7 +1709,7 @@ TEST_F(HMICommandsNotificationsTest, OnUILanguageChangeNotificationEmptyData) {
const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::language] = kLang;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnUILanguageChangeNotification>(message);
EXPECT_CALL(mock_hmi_capabilities_, set_active_ui_language(_));
@@ -1735,7 +1727,7 @@ TEST_F(HMICommandsNotificationsTest,
const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::language] = kLang;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnUILanguageChangeNotification>(message);
application_set_.insert(app_);
@@ -1768,12 +1760,12 @@ TEST_F(HMICommandsNotificationsTest,
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::strings::language] =
mobile_apis::Language::EN_US;
- utils::SharedPtr<Command> command =
+ std::shared_ptr<Command> command =
CreateCommand<OnUILanguageChangeNotification>(message);
application_set_.insert(app_);
smart_objects::SmartObjectSPtr notification =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*notification)[am::strings::params][am::strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID);
(*notification)[am::strings::params][am::strings::message_type] =
@@ -1820,11 +1812,26 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) {
hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_notification::state] = state;
- utils::SharedPtr<Command> command =
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
EXPECT_CALL(app_mngr_, set_driver_distraction_state(state));
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
EXPECT_CALL(*app_ptr_, app_id()).Times(0);
command->Run();
@@ -1832,16 +1839,28 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) {
TEST_F(HMICommandsNotificationsTest,
OnDriverDistractionNotificationInvalidApp) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_notification::state] = state;
- utils::SharedPtr<Command> command =
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
ApplicationSharedPtr invalid_app;
application_set_.insert(invalid_app);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
EXPECT_CALL(*app_ptr_, app_id()).Times(0);
command->Run();
@@ -1852,21 +1871,33 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationValidApp) {
hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::mobile_notification::state] = state;
- utils::SharedPtr<Command> command =
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
application_set_.insert(app_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_));
- EXPECT_CALL(mock_policy_handler_, CheckPermissions(_, _, _, _))
- .WillOnce(GetArg3(&result));
+ EXPECT_CALL(mock_policy_handler_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
+
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL))
.WillOnce(GetMessage(message));
- EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_));
+ ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_));
command->Run();
EXPECT_EQ(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc
index 7759dace96..64bf167f83 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc
@@ -33,14 +33,13 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/mixing_audio_supported_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -50,14 +49,13 @@ namespace mixing_audio_supported_request {
using ::testing::_;
using ::testing::Return;
-using ::utils::SharedPtr;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
+using am::commands::CommandImpl;
using am::commands::RequestToHMI;
using sdl_rpc_plugin::commands::MixingAudioSupportedRequest;
-using am::commands::CommandImpl;
-typedef SharedPtr<RequestToHMI> RequestToHMIPtr;
+typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr;
namespace {
const uint32_t kConnectionKey = 2u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc
index 9c8c30f493..8c2f07a1d6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc
@@ -33,19 +33,18 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/response_from_hmi.h"
-#include "interfaces/HMI_API.h"
-#include "interfaces/MOBILE_API.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
#include "sdl_rpc_plugin/commands/hmi/mixing_audio_supported_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,19 +52,18 @@ namespace commands_test {
namespace hmi_commands_test {
namespace mixing_audio_supported_response {
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
-using ::utils::SharedPtr;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
-using sdl_rpc_plugin::commands::MixingAudioSupportedResponse;
-using application_manager::commands::ResponseFromHMI;
-using am::commands::CommandImpl;
using am::HMICapabilities;
+using am::commands::CommandImpl;
+using application_manager::commands::ResponseFromHMI;
+using sdl_rpc_plugin::commands::MixingAudioSupportedResponse;
namespace hmi_response = ::application_manager::hmi_response;
-typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr;
+typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
MockHMICapabilities;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc
index 69cb04f073..926e51446f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc
@@ -35,14 +35,14 @@
#include "hmi/navi_audio_start_stream_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
+
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/hmi_interfaces.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
-#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -54,9 +54,9 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
namespace commands = am::commands;
+using am::event_engine::Event;
using commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::AudioStartStreamRequest;
-using am::event_engine::Event;
namespace {
const uint32_t kHmiAppId = 13u;
@@ -76,7 +76,7 @@ class AudioStartStreamRequestTest
std::pair<uint32_t, int32_t> start_stream_retry_amount_;
MessageSharedPtr msg_;
- SharedPtr<AudioStartStreamRequest> command_;
+ std::shared_ptr<AudioStartStreamRequest> command_;
};
TEST_F(AudioStartStreamRequestTest, Run_HmiInterfaceNotAvailable_NoRequest) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc
index 49145d1644..5e13755a32 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc
@@ -33,16 +33,16 @@
#include "hmi/navi_is_ready_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
+
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/hmi_interfaces.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/hmi_interfaces.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -54,15 +54,15 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::NaviIsReadyRequest;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::NaviIsReadyRequest;
namespace {
const hmi_apis::FunctionID::eType kEventID =
hmi_apis::FunctionID::Navigation_IsReady;
} // namespace
-typedef SharedPtr<NaviIsReadyRequest> NaviIsReadyRequestPtr;
+typedef std::shared_ptr<NaviIsReadyRequest> NaviIsReadyRequestPtr;
class NaviIsReadyRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc
index 3bcea20be7..e166928348 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc
@@ -33,12 +33,12 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "gtest/gtest.h"
#include "hmi/navi_is_ready_response.h"
namespace test {
@@ -46,16 +46,15 @@ namespace components {
namespace commands_test {
namespace hmi_commands_test {
namespace navi_is_ready_responce {
-
namespace am = ::application_manager;
namespace commands = sdl_rpc_plugin::commands;
using ::testing::ReturnRef;
-using ::utils::SharedPtr;
+
using application_manager::commands::ResponseFromHMI;
using test::components::event_engine_test::MockEventDispatcher;
-typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr;
+typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
class NaviIsReadyResponseTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc
index c7287c024a..d6ef540bc0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc
@@ -35,15 +35,15 @@
#include "hmi/navi_set_video_config_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
+
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/hmi_interfaces.h"
-#include "application_manager/mock_hmi_interface.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/hmi_interfaces.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -55,8 +55,8 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::NaviSetVideoConfigRequest;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::NaviSetVideoConfigRequest;
namespace {
const uint32_t kAppId = 1u;
@@ -65,7 +65,7 @@ const hmi_apis::FunctionID::eType kEventID =
hmi_apis::FunctionID::Navigation_SetVideoConfig;
} // namespace
-typedef SharedPtr<NaviSetVideoConfigRequest> NaviSetVideoConfigRequestPtr;
+typedef std::shared_ptr<NaviSetVideoConfigRequest> NaviSetVideoConfigRequestPtr;
class NaviSetVideoConfigRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc
index 6469966ca2..c4e7976bde 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "hmi/navi_set_video_config_response.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -44,12 +44,11 @@ namespace commands_test {
namespace hmi_commands_test {
namespace navi_set_video_config_response {
-using utils::SharedPtr;
using sdl_rpc_plugin::commands::NaviSetVideoConfigResponse;
using test::components::event_engine_test::MockEventDispatcher;
using testing::_;
-using testing::ReturnRef;
using ::testing::NiceMock;
+using testing::ReturnRef;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
@@ -61,7 +60,7 @@ class NaviSetVideoConfigResponseTest
TEST_F(NaviSetVideoConfigResponseTest, RUN_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<NaviSetVideoConfigResponse> command(
+ std::shared_ptr<NaviSetVideoConfigResponse> command(
CreateCommand<NaviSetVideoConfigResponse>(msg));
MockEventDispatcher mock_event_dispatcher;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc
index 6700aa68ab..232d5ab628 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc
@@ -35,13 +35,13 @@
#include "hmi/navi_start_stream_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
+
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
#include "application_manager/hmi_interfaces.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,9 +53,9 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
namespace commands = am::commands;
+using am::event_engine::Event;
using commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::NaviStartStreamRequest;
-using am::event_engine::Event;
namespace {
const uint32_t kHmiAppId = 13u;
@@ -75,7 +75,7 @@ class NaviStartStreamRequestTest
std::pair<uint32_t, int32_t> start_stream_retry_amount_;
MessageSharedPtr msg_;
- SharedPtr<NaviStartStreamRequest> command_;
+ std::shared_ptr<NaviStartStreamRequest> command_;
};
TEST_F(NaviStartStreamRequestTest, Run_HmiInterfaceNotAvailable_NoRequest) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc
index 0ef903224b..b32189ce1a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc
@@ -30,17 +30,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "hmi/navi_stop_stream_request.h"
#include "hmi/navi_audio_stop_stream_request.h"
+#include "hmi/navi_stop_stream_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
+
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
#include "application_manager/hmi_interfaces.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -72,11 +72,12 @@ class NaviStopStreamRequestsTest
}
MessageSharedPtr msg_;
- SharedPtr<Command> command_;
+ std::shared_ptr<Command> command_;
};
typedef testing::Types<commands::AudioStopStreamRequest,
- commands::NaviStopStreamRequest> RequestCommandsList;
+ commands::NaviStopStreamRequest>
+ RequestCommandsList;
TYPED_TEST_CASE(NaviStopStreamRequestsTest, RequestCommandsList);
TYPED_TEST(NaviStopStreamRequestsTest, Run_HmiInterfaceNotAvailable_NoRequest) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_app_properties_change_notification_test.cc
index 05169e5067..0ab0bc5a35 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_app_properties_change_notification_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,61 +29,63 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-
#include <stdint.h>
-#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/command.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/application.h"
+#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/commands/response_to_hmi.h"
-#include "hmi/get_urls_response.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/on_app_properties_change_notification.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace commands_test {
namespace hmi_commands_test {
-namespace get_urls_response {
+namespace on_app_properties_change_notification {
-using ::testing::_;
-using ::testing::Return;
-using ::utils::SharedPtr;
-namespace am = ::application_manager;
-namespace strings = ::application_manager::strings;
-using sdl_rpc_plugin::commands::GetUrlsResponse;
-using am::commands::ResponseToHMI;
-using am::commands::CommandImpl;
+using namespace application_manager;
+using sdl_rpc_plugin::commands::OnAppPropertiesChangeNotification;
-typedef SharedPtr<ResponseToHMI> ResponseToHMIPtr;
+typedef std::shared_ptr<OnAppPropertiesChangeNotification> NotificationPtr;
+typedef hmi_apis::Common_ServiceType::eType ServiceType;
+typedef hmi_apis::Common_ServiceEvent::eType ServiceEvent;
namespace {
-const uint32_t kConnectionKey = 2u;
+const uint32_t kConnectionKey = 1232u;
+const uint32_t kHmiAppId = 321u;
} // namespace
-class GetUrlResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> {};
+class OnAppPropertiesChangeNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnAppPropertiesChangeNotificationTest()
+ : message_(CreateMessage(smart_objects::SmartType_Map)) {}
+
+ protected:
+ MessageSharedPtr message_;
+ NotificationPtr command_;
+};
+
+TEST_F(OnAppPropertiesChangeNotificationTest, SendNotificationToHMI) {
+ (*message_)[strings::msg_params][strings::app_id] = kConnectionKey;
+ command_ = CreateCommand<OnAppPropertiesChangeNotification>(message_);
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(message_)).Times(1);
-TEST_F(GetUrlResponseTest, RUN_SendRequest_SUCCESS) {
- MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
- (*command_msg)[strings::msg_params][strings::number] = "123";
- (*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ auto mock_app = std::make_shared<NiceMock<MockApplication> >();
- ResponseToHMIPtr command(CreateCommand<GetUrlsResponse>(command_msg));
- EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
- command->Run();
+ ON_CALL(*mock_app, hmi_app_id()).WillByDefault(Return(kHmiAppId));
- EXPECT_EQ((*command_msg)[strings::params][strings::protocol_type].asInt(),
- CommandImpl::hmi_protocol_type_);
- EXPECT_EQ((*command_msg)[strings::params][strings::protocol_version].asInt(),
- CommandImpl::protocol_version_);
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
}
-} // namespace get_urls_response
+} // namespace on_app_properties_change_notification
} // namespace hmi_commands_test
} // namespace commands_test
} // namespace components
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
new file mode 100644
index 0000000000..f3ed480180
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "hmi/on_bc_system_capability_updated_notification_from_hmi.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace on_bc_system_capability_updated_notification_from_hmi {
+
+using sdl_rpc_plugin::commands::OnBCSystemCapabilityUpdatedNotificationFromHMI;
+using ::testing::_;
+using ::testing::Return;
+
+typedef std::shared_ptr<OnBCSystemCapabilityUpdatedNotificationFromHMI>
+ OnBCSystemCapabilityUpdatedNotificationFromHMIPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kAppId = 1u;
+} // namespace
+
+MATCHER(CheckMessageToMobile, "") {
+ const auto function_id = mobile_apis::FunctionID::OnSystemCapabilityUpdatedID;
+
+ const bool is_function_id_matched =
+ function_id == static_cast<am::mobile_api::FunctionID::eType>(
+ (*arg)[strings::params][strings::function_id].asInt());
+ const bool app_id_exist =
+ (*arg)[strings::msg_params].keyExists(strings::app_id);
+ bool is_connection_key_correct = true;
+ if ((*arg)[strings::msg_params].keyExists(strings::connection_key)) {
+ is_connection_key_correct =
+ (*arg)[strings::params][strings::connection_key] == kAppId;
+ }
+ return is_function_id_matched && !app_id_exist && is_connection_key_correct;
+}
+
+MATCHER_P(CheckDisplayCapabilitiesNotChanged, display_capability, "") {
+ return display_capability == arg;
+}
+
+class OnBCSystemCapabilityUpdatedNotificationFromHMITest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ protected:
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest()
+ : message_(CreateMessage())
+ , display_capability_(
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [strings::display_capabilities]) {
+ command_ =
+ CreateCommand<OnBCSystemCapabilityUpdatedNotificationFromHMI>(message_);
+ mock_app_ = CreateMockApp();
+ }
+
+ OnBCSystemCapabilityUpdatedNotificationFromHMIPtr command_;
+ MockAppPtr mock_app_;
+ MessageSharedPtr message_;
+ const SmartObject display_capability_;
+};
+
+TEST_F(
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_AppIdNotPresentedInMessage_SetSystemDisplayCapabilitiesToHMICapabilities_SendMessageToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ set_system_display_capabilities(
+ CheckDisplayCapabilitiesNotChanged(display_capability_)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(),
+ ::application_manager::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_AppNotRegisteredWithPresentedAppIdInMessage_MessageNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ (*message_)[strings::msg_params][strings::app_id] = kAppId;
+ ApplicationSharedPtr app; // Empty application shared pointer
+
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(app));
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_AppRegisteredWithPresentedAppIdInMessage_SetDisplayCapabilitiesToApp_SendMessageToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ (*message_)[strings::msg_params][strings::app_id] = kAppId;
+
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
+
+ EXPECT_CALL(*mock_app_,
+ set_display_capabilities(
+ CheckDisplayCapabilitiesNotChanged(display_capability_)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(),
+ ::application_manager::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace on_bc_system_capability_updated_notification_from_hmi
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc
new file mode 100644
index 0000000000..cb8894749f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "hmi/on_bc_system_capability_updated_notification.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace on_bc_system_capability_updated_notification {
+
+using sdl_rpc_plugin::commands::OnBCSystemCapabilityUpdatedNotification;
+using ::testing::_;
+using ::testing::Return;
+
+typedef std::shared_ptr<OnBCSystemCapabilityUpdatedNotification>
+ OnBCSystemCapabilityUpdatedNotificationPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kConnectionKey = 1u;
+}
+
+MATCHER_P(CheckDisplayCapabilities, display_capabilities, "") {
+ return display_capabilities ==
+ (*arg)[strings::msg_params][strings::system_capability]
+ [strings::display_capabilities];
+}
+
+class OnBCSystemCapabilityUpdatedNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void SetUp() OVERRIDE {
+ message_ = CreateMessage();
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+
+ command_ = CreateCommand<OnBCSystemCapabilityUpdatedNotification>(message_);
+ mock_app_ = CreateMockApp();
+ }
+
+ OnBCSystemCapabilityUpdatedNotificationPtr command_;
+ MockAppPtr mock_app_;
+ MessageSharedPtr message_;
+};
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationTest,
+ SystemDisplayCapabilities_SUCCESS) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ EXPECT_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .Times(2)
+ .WillRepeatedly(Return(system_display_capabilities));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ SendMessageToHMI(CheckDisplayCapabilities(*system_display_capabilities)));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationTest,
+ SystemDisplayCapabilities_DATA_NOT_AVAILABLE) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ EXPECT_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillOnce(Return(nullptr));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace on_bc_system_capability_updated_notification
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
index 60a7b01612..fe6ba7c4e3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
@@ -33,19 +33,17 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "utils/shared_ptr.h"
-#include "utils/lock.h"
-#include "utils/make_shared.h"
-#include "utils/data_accessor.h"
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/on_driver_distraction_notification.h"
#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+#include "utils/data_accessor.h"
+#include "utils/lock.h"
namespace test {
namespace components {
@@ -54,24 +52,65 @@ namespace hmi_commands_test {
namespace on_driver_distraction_notification {
using ::testing::_;
-using ::testing::Return;
+using ::testing::DoAll;
using ::testing::Eq;
-using ::utils::SharedPtr;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::SaveArg;
+using ::testing::SetArgumentPointee;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::hmi::OnDriverDistractionNotification;
using namespace am::commands;
+using test::components::commands_test::MobileResultCodeIs;
-typedef ::utils::SharedPtr<OnDriverDistractionNotification> NotificationPtr;
+namespace {
+const std::string kDefaultLanguage = "en-us";
+const mobile_apis::Language::eType kMobileLanguage =
+ mobile_apis::Language::EN_US;
+
+// LSDW - lock screen dismissal warning
+const std::string kLockScreenDismissalWarningMessage_en =
+ "Swipe down to dismiss, acknowledging that you are not the driver";
+const uint32_t kConnectionKey = 2u;
+} // namespace
class HMIOnDriverDistractionNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
HMIOnDriverDistractionNotificationTest()
- : app_set_lock_(std::make_shared<sync_primitives::Lock>()) {}
+ : mock_app_(CreateMockApp())
+ , app_set_lock_(std::make_shared<sync_primitives::Lock>())
+ , accessor(app_set_, app_set_lock_) {
+ app_set_.insert(mock_app_);
+ InitMocksRelations();
+ }
+
+ typedef std::shared_ptr<OnDriverDistractionNotification> NotificationPtr;
+ typedef boost::optional<bool> OptionalBool;
+
+ void SetUp() OVERRIDE {
+ ON_CALL(*mock_app_, ui_language())
+ .WillByDefault(ReturnRef(kMobileLanguage));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(kMobileLanguage))
+ .WillByDefault(Return(kDefaultLanguage));
+ }
+
+ MockAppPtr mock_app_;
std::shared_ptr<sync_primitives::Lock> app_set_lock_;
- policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_;
+ am::ApplicationSet app_set_;
+ DataAccessor<am::ApplicationSet> accessor;
+ NiceMock<policy_test::MockPolicyHandlerInterface>
+ mock_policy_handler_interface_;
+
+ void InitMocksRelations() {
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(accessor));
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_interface_));
+ }
};
MATCHER_P2(CheckNotificationParams, function_id, state, "") {
@@ -87,76 +126,238 @@ MATCHER_P2(CheckNotificationParams, function_id, state, "") {
return is_function_id_matched && is_state_matched;
}
-ACTION_P(GetArg3, result) {
- arg3 = *result;
+ACTION_P(GetArg4, result) {
+ arg4 = *result;
}
-TEST_F(HMIOnDriverDistractionNotificationTest, Run_PushMobileMessage_SUCCESS) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ACTION_P(SetMessage, lockScreenDismissalWarning) {
+ smart_objects::SmartObject& notification = arg0;
+
+ notification[application_manager::strings::msg_params]
+ [application_manager::mobile_notification::
+ lock_screen_dismissal_warning] = lockScreenDismissalWarning;
+}
+
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationToMobile_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
(*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
NotificationPtr command(
CreateCommand<OnDriverDistractionNotification>(commands_msg));
EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
- MockAppPtr mock_app = CreateMockApp();
- am::ApplicationSet app_set;
- app_set.insert(mock_app);
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
+
+ MessageSharedPtr message_to_mobile(
+ CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckNotificationParams(
+ am::mobile_api::FunctionID::OnDriverDistractionID, state),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+ command->Run();
+
+ ASSERT_TRUE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto LSDW_message =
+ (*message_to_mobile)
+ [am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en, LSDW_message);
+}
+
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_PushMobileMessage_If_DisallowedByPolicy) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(boost::optional<bool>(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
- DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcDisallowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_interface_));
- EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
- .WillOnce(GetArg3(&result));
+ EXPECT_CALL(app_mngr_, GetPolicyHandler()).Times(3);
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
- EXPECT_CALL(*mock_app,
+ MessageSharedPtr pushed_message(CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(*mock_app_,
PushMobileMessage(CheckNotificationParams(
- am::mobile_api::FunctionID::OnDriverDistractionID, state)));
+ am::mobile_api::FunctionID::OnDriverDistractionID, state)))
+ .WillOnce(SaveArg<0>(&pushed_message));
+
+ EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
+ command->Run();
+
+ ASSERT_TRUE((*pushed_message)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto lock_screen_dismissal_warning_message =
+ (*pushed_message)[am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en,
+ lock_screen_dismissal_warning_message);
+}
+
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationIfLockScreenDismissalMissed) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(boost::optional<bool>()));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ ON_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillByDefault(GetArg4(&result));
+
+ MessageSharedPtr command_result;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&command_result), Return(true)));
command->Run();
+
+ auto& msg_params =
+ (*command_result)[application_manager::strings::msg_params];
+ EXPECT_FALSE(msg_params.keyExists(
+ application_manager::mobile_notification::lock_screen_dismissal_enabled));
+ EXPECT_FALSE(msg_params.keyExists(
+ application_manager::mobile_notification::lock_screen_dismissal_warning));
}
+// LSDW - lock screen dimissal
TEST_F(HMIOnDriverDistractionNotificationTest,
- Run_SendNotificationToMobile_SUCCESS) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ Run_SendNotificationToMobile_LSDWMessageIsAbsent_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
(*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
NotificationPtr command(
CreateCommand<OnDriverDistractionNotification>(commands_msg));
EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
- MockAppPtr mock_app = CreateMockApp();
- am::ApplicationSet app_set;
- app_set.insert(mock_app);
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(false)));
- DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
+ // LockScreenDismissalWarning won't be added to message if value of
+ // LockScreenDismissalEnabledState is false
+ std::string required_language = "en-us";
+ EXPECT_CALL(mock_policy_handler_interface_,
+ LockScreenDismissalWarningMessage(required_language))
+ .Times(0);
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_interface_));
- EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
- .WillOnce(GetArg3(&result));
+ MessageSharedPtr message_to_mobile(
+ CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(app_mngr_, GetPolicyHandler()).Times(2);
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
CheckNotificationParams(
am::mobile_api::FunctionID::OnDriverDistractionID, state),
- Command::CommandSource::SOURCE_SDL));
-
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
command->Run();
+
+ EXPECT_FALSE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
}
-} // on_driver_distraction_notification
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationToMobile_SpecifiedLanguageIsAbsent_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
+ EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
+
+ // In case when specified language is absent in policy table, will added
+ // message on default language (en-us)
+ const mobile_apis::Language::eType mobile_language =
+ mobile_apis::Language::FR_FR;
+ std::string required_language = "FR-FR";
+ ON_CALL(*mock_app_, ui_language()).WillByDefault(ReturnRef(mobile_language));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(mobile_language))
+ .WillByDefault(Return(required_language));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
+
+ MessageSharedPtr message_to_mobile(
+ CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckNotificationParams(
+ am::mobile_api::FunctionID::OnDriverDistractionID, state),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+ command->Run();
+
+ ASSERT_TRUE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto lock_screen_dismissal_warning_message =
+ (*message_to_mobile)
+ [am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en,
+ lock_screen_dismissal_warning_message);
+}
+} // namespace on_driver_distraction_notification
} // namespace hmi_commands_test
} // namespace commands_test
} // namespace components
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_service_status_update_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_service_status_update_notification_test.cc
new file mode 100644
index 0000000000..a9bc97f842
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_service_status_update_notification_test.cc
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <stdint.h>
+
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/on_service_update_notification.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace on_service_update_notification {
+
+using namespace application_manager;
+using sdl_rpc_plugin::commands::hmi::OnServiceUpdateNotification;
+
+typedef std::shared_ptr<OnServiceUpdateNotification> NotificationPtr;
+typedef hmi_apis::Common_ServiceType::eType ServiceType;
+typedef hmi_apis::Common_ServiceEvent::eType ServiceEvent;
+
+namespace {
+const uint32_t kConnectionKey = 1232u;
+const uint32_t kHmi_app_id = 321u;
+} // namespace
+
+class OnServiceUpdateNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ public:
+ OnServiceUpdateNotificationTest()
+ : message_(CreateMessage(smart_objects::SmartType_Map)) {}
+
+ public:
+ MessageSharedPtr message_;
+ NotificationPtr command_;
+};
+
+TEST_F(OnServiceUpdateNotificationTest, SendNotificationToHMI) {
+ (*message_)[strings::msg_params][hmi_notification::service_type] =
+ ServiceType::AUDIO;
+ (*message_)[strings::msg_params][hmi_notification::service_event] =
+ ServiceEvent::REQUEST_ACCEPTED;
+ (*message_)[strings::msg_params][strings::app_id] = kConnectionKey;
+ command_ = CreateCommand<OnServiceUpdateNotification>(message_);
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(message_)).Times(1);
+
+ auto mock_app = std::make_shared<NiceMock<MockApplication> >();
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
+
+ ON_CALL(*mock_app, hmi_app_id()).WillByDefault(Return(kHmi_app_id));
+
+ command_->Init();
+ command_->Run();
+}
+
+} // namespace on_service_update_notification
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc
index 2d50ec2b72..f9dbbf259f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc
@@ -30,12 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "hmi/on_system_time_ready_notification.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "interfaces/HMI_API.h"
namespace test {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
index bbd5920f9f..67c36dce9c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
@@ -33,14 +33,14 @@
#include <stdint.h>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/MOBILE_API.h"
+
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_impl.h"
#include "hmi/rc_get_capabilities_response.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -48,15 +48,14 @@ namespace commands_test {
namespace hmi_commands_test {
namespace rc_get_capabilities_response {
-using ::utils::SharedPtr;
using ::testing::NiceMock;
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
-using sdl_rpc_plugin::commands::RCGetCapabilitiesResponse;
using am::commands::CommandImpl;
+using sdl_rpc_plugin::commands::RCGetCapabilitiesResponse;
-typedef SharedPtr<RCGetCapabilitiesResponse> RCGetCapabilitiesResponsePtr;
+typedef std::shared_ptr<RCGetCapabilitiesResponse> RCGetCapabilitiesResponsePtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
MockHMICapabilities;
@@ -140,6 +139,7 @@ TEST_F(RCGetCapabilitiesResponseTest, RUN_SUCCESSS) {
radio_control_capability["hdChannelAvailable"] = true;
radio_control_capability["rdsDataAvailable"] = true;
radio_control_capability["availableHDsAvailable"] = true;
+ radio_control_capability["availableHdChannelsAvailable"] = true;
radio_control_capability["stateAvailable"] = true;
radio_control_capability["signalStrengthAvailable"] = true;
radio_control_capability["signalChangeThresholdAvailable"] = true;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
index 41acf67116..539c0efeb3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc
@@ -33,16 +33,16 @@
#include "hmi/rc_is_ready_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
+
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/hmi_interfaces.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -54,10 +54,10 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::RCIsReadyRequest;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::RCIsReadyRequest;
-typedef SharedPtr<RCIsReadyRequest> RCIsReadyRequestPtr;
+typedef std::shared_ptr<RCIsReadyRequest> RCIsReadyRequestPtr;
class RCIsReadyRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -99,7 +99,7 @@ class RCIsReadyRequestTest
EXPECT_CALL(mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::RC_GetCapabilities, _))
.WillOnce(Return(capabilities));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities, _));
}
void PrepareEvent(bool is_message_contain_param,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc
index e07a0c1538..4224e82b5f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc
@@ -34,12 +34,12 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
+
#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "hmi/rc_is_ready_response.h"
-#include "application_manager/mock_event_dispatcher.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -48,7 +48,7 @@ namespace hmi_commands_test {
namespace rc_is_ready_response {
using ::testing::Return;
-using ::utils::SharedPtr;
+
using ::testing::NiceMock;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
@@ -56,7 +56,7 @@ namespace hmi_response = am::hmi_response;
using sdl_rpc_plugin::commands::RCIsReadyResponse;
using test::components::event_engine_test::MockEventDispatcher;
-typedef SharedPtr<RCIsReadyResponse> RCIsReadyResponsePtr;
+typedef std::shared_ptr<RCIsReadyResponse> RCIsReadyResponsePtr;
class RCIsReadyResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> {
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc
index c5b0c2ba24..3e7e6e6f59 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc
@@ -32,32 +32,29 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
+#include "application_manager/commands/command.h"
+#include "application_manager/commands/response_from_hmi.h"
#include "application_manager/smart_object_keys.h"
#include "application_manager/test/include/application_manager/commands/commands_test.h"
-#include "application_manager/commands/command.h"
#include "application_manager/test/include/application_manager/mock_event_dispatcher.h"
-#include "application_manager/commands/response_from_hmi.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace commands_test {
namespace hmi_commands_test {
namespace response_from_hmi {
+using ::test::components::event_engine_test::MockEventDispatcher;
using ::testing::_;
+using ::testing::DoAll;
using ::testing::Return;
using ::testing::SaveArg;
-using ::testing::DoAll;
-
-using ::utils::SharedPtr;
-using ::test::components::event_engine_test::MockEventDispatcher;
namespace am = ::application_manager;
using application_manager::commands::ResponseFromHMI;
-typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr;
+typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
class ResponseFromHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {};
@@ -89,7 +86,7 @@ TEST_F(ResponseFromHMITest, CreateHMIRequest_SUCCESS) {
ResponseFromHMIPtr command(CreateCommand<ResponseFromHMI>());
MessageSharedPtr result_msg;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result_msg), Return(true)));
const hmi_apis::FunctionID::eType posted_function_id =
@@ -97,7 +94,7 @@ TEST_F(ResponseFromHMITest, CreateHMIRequest_SUCCESS) {
MessageSharedPtr dummy_msg_params = CreateMessage();
command->CreateHMIRequest(posted_function_id, *dummy_msg_params);
- ASSERT_TRUE(result_msg);
+ ASSERT_TRUE((bool)result_msg);
const application_manager::MessageType received_message_tipe =
static_cast<application_manager::MessageType>(
@@ -118,7 +115,7 @@ TEST_F(ResponseFromHMITest, CreateHMIRequest_CantManageCommand_Covering) {
MessageSharedPtr result_msg;
ON_CALL(app_mngr_, GetNextHMICorrelationID()).WillByDefault(Return(1u));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result_msg), Return(false)));
const hmi_apis::FunctionID::eType posted_function_id =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc
index c21791e913..93344f1a0d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc
@@ -32,18 +32,19 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "utils/lock.h"
-#include "utils/helpers.h"
-#include "hmi/sdl_activate_app_request.h"
-#include "application_manager/mock_application.h"
#include "application_manager/application_manager.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_state_controller.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "gtest/gtest.h"
+#include "hmi/sdl_activate_app_request.h"
+#include "utils/helpers.h"
+#include "utils/lock.h"
namespace test {
namespace components {
@@ -54,16 +55,17 @@ namespace sdl_activate_app_request {
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
+using am::ApplicationSet;
using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
+using connection_handler_test::MockConnectionHandler;
+using policy_test::MockPolicyHandlerInterface;
using sdl_rpc_plugin::commands::SDLActivateAppRequest;
-using am::ApplicationSet;
+using testing::Gt;
using testing::Mock;
+using ::testing::NiceMock;
using testing::Return;
using testing::ReturnRef;
-using testing::Mock;
-using ::testing::NiceMock;
-using policy_test::MockPolicyHandlerInterface;
-using am::event_engine::Event;
namespace {
const uint32_t kCorrelationID = 1u;
@@ -134,9 +136,11 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
+ EXPECT_CALL(app_mngr_, WaitingApplicationByID(kAppID))
+ .WillOnce(Return(ApplicationSharedPtr()));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
@@ -148,13 +152,13 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) {
command->Run();
}
-TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DactivateApp_REJECTED) {
+TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DeactivateApp_REJECTED) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
(*msg)[strings::msg_params][strings::function_id] =
hmi_apis::FunctionID::SDL_ActivateApp;
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
EXPECT_CALL(app_mngr_, state_controller())
@@ -163,9 +167,9 @@ TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DactivateApp_REJECTED) {
IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::SDL_ActivateApp)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::SDL_ActivateApp), _))
.WillOnce(Return(true));
command->Run();
@@ -176,7 +180,7 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
MockAppPtr mock_app(CreateMockApp());
@@ -189,6 +193,7 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) {
.WillOnce(Return(false));
EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false));
ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle));
MockAppPtr mock_app_first(CreateMockApp());
@@ -222,7 +227,7 @@ TEST_F(SDLActivateAppRequestTest, AppIdNotFound_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
EXPECT_CALL(app_mngr_, application(kAppID))
@@ -237,7 +242,7 @@ TEST_F(SDLActivateAppRequestTest, DevicesAppsEmpty_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
MockAppPtr mock_app(CreateMockApp());
@@ -250,6 +255,7 @@ TEST_F(SDLActivateAppRequestTest, DevicesAppsEmpty_SUCCESS) {
.WillOnce(Return(false));
EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false));
ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle));
DataAccessor<ApplicationSet> accessor(app_list_, lock_);
@@ -263,7 +269,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppActive_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
MockAppPtr mock_app(CreateMockApp());
@@ -301,7 +307,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotActive_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
MockAppPtr mock_app(CreateMockApp());
@@ -322,7 +328,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
MockAppPtr mock_app(CreateMockApp());
@@ -336,6 +342,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) {
EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle));
EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
@@ -362,7 +369,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
MockAppPtr mock_app(CreateMockApp());
@@ -395,7 +402,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
MockAppPtr mock_app(CreateMockApp());
@@ -427,14 +434,63 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) {
}
#endif
+TEST_F(SDLActivateAppRequestTest, WaitingCloudApplication_ConnectDevice) {
+ MessageSharedPtr msg = CreateMessage();
+ SetCorrelationAndAppID(msg);
+
+ std::shared_ptr<SDLActivateAppRequest> command(
+ CreateCommand<SDLActivateAppRequest>(msg));
+
+ MockAppPtr mock_app(CreateMockApp());
+
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle));
+ EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(true));
+
+#ifndef EXTERNAL_PROPRIETARY_MODE
+ EXPECT_CALL(app_mngr_, application(kAppID))
+ .WillOnce(Return(ApplicationSharedPtr()));
+#endif
+ EXPECT_CALL(app_mngr_, WaitingApplicationByID(kAppID))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, state_controller())
+ .WillOnce(ReturnRef(mock_state_controller_));
+ EXPECT_CALL(mock_state_controller_,
+ IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI))
+ .WillOnce(Return(false));
+
+ const uint16_t kRetries = 3;
+ const uint32_t kRetryTimeout = 2000;
+ const uint32_t kMinimumTimeout = kRetries * kRetryTimeout;
+
+ MockApplicationManagerSettings settings;
+ EXPECT_CALL(settings, cloud_app_max_retry_attempts())
+ .WillOnce(Return(kRetries));
+ EXPECT_CALL(settings, cloud_app_retry_timeout())
+ .WillOnce(Return(kRetryTimeout));
+ EXPECT_CALL(app_mngr_, get_settings()).WillOnce(ReturnRef(settings));
+
+ EXPECT_CALL(app_mngr_,
+ updateRequestTimeout(0, kCorrelationID, Gt(kMinimumTimeout)));
+
+ MockConnectionHandler connection_handler;
+ EXPECT_CALL(connection_handler, ConnectToDevice(kHandle));
+
+ EXPECT_CALL(app_mngr_, connection_handler())
+ .WillOnce(ReturnRef(connection_handler));
+
+ command->Run();
+}
+
TEST_F(SDLActivateAppRequestTest, OnTimeout_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
ON_CALL(mock_event_dispatcher_, remove_observer(_, _));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
command->onTimeOut();
}
@@ -443,7 +499,7 @@ TEST_F(SDLActivateAppRequestTest, OnEvent_InvalidEventId_UNSUCCESS) {
MessageSharedPtr event_msg = CreateMessage();
(*event_msg)[strings::params][strings::correlation_id] = kCorrelationID;
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>());
Event event(hmi_apis::FunctionID::INVALID_ENUM);
@@ -458,7 +514,7 @@ TEST_F(SDLActivateAppRequestTest, OnEvent_InvalidAppId_UNSUCCESS) {
(*event_msg)[strings::msg_params][strings::application][strings::app_id] =
kAppID;
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>());
Event event(hmi_apis::FunctionID::BasicCommunication_OnAppRegistered);
@@ -474,7 +530,7 @@ TEST_F(SDLActivateAppRequestTest, OnEvent_InvalidAppId_UNSUCCESS) {
TEST_F(SDLActivateAppRequestTest, OnEvent_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::correlation_id] = kCorrelationID;
- SharedPtr<SDLActivateAppRequest> command(
+ std::shared_ptr<SDLActivateAppRequest> command(
CreateCommand<SDLActivateAppRequest>(msg));
MessageSharedPtr event_msg = CreateMessage();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc
index 716c818269..b35ccde314 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc
@@ -33,13 +33,12 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/sdl_activate_app_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -47,13 +46,12 @@ namespace commands_test {
namespace hmi_commands_test {
namespace sdl_activate_app_response {
-using ::utils::SharedPtr;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
-using sdl_rpc_plugin::commands::SDLActivateAppResponse;
using am::commands::CommandImpl;
+using sdl_rpc_plugin::commands::SDLActivateAppResponse;
-typedef SharedPtr<SDLActivateAppResponse> SDLActivateAppResponsePtr;
+typedef std::shared_ptr<SDLActivateAppResponse> SDLActivateAppResponsePtr;
namespace {
const uint32_t kConnectionKey = 2u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc
index e5f9845b74..c8cc4bb18c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc
@@ -32,11 +32,11 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "hmi/sdl_get_list_of_permissions_request.h"
+#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/commands/command_request_test.h"
+#include "gtest/gtest.h"
+#include "hmi/sdl_get_list_of_permissions_request.h"
namespace test {
namespace components {
@@ -46,8 +46,8 @@ namespace sdl_get_list_of_permissions_request {
using application_manager::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::SDLGetListOfPermissionsRequest;
-using test::components::policy_test::MockPolicyHandlerInterface;
using smart_objects::SmartObject;
+using test::components::policy_test::MockPolicyHandlerInterface;
using testing::Return;
using testing::ReturnRef;
@@ -82,7 +82,7 @@ TEST_F(SDLGetListOfPermissionsRequestTest, Run_SUCCESS) {
EXPECT_CALL(app_mngr_, application_by_hmi_app(kAppID))
.WillOnce(Return(mock_app_));
- SharedPtr<SDLGetListOfPermissionsRequest> command(
+ std::shared_ptr<SDLGetListOfPermissionsRequest> command(
CreateCommand<SDLGetListOfPermissionsRequest>(msg));
EXPECT_CALL(mock_policy_handler_,
@@ -95,7 +95,7 @@ TEST_F(SDLGetListOfPermissionsRequestTest, Run_KeyDoesntExist_SUCCESS) {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Binary);
(*msg)[strings::params][strings::correlation_id] = kCorrelationID;
- SharedPtr<SDLGetListOfPermissionsRequest> command(
+ std::shared_ptr<SDLGetListOfPermissionsRequest> command(
CreateCommand<SDLGetListOfPermissionsRequest>(msg));
EXPECT_CALL(mock_policy_handler_,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc
new file mode 100644
index 0000000000..b5263ece7d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "hmi/sdl_get_policy_configuration_data_request.h"
+#include "application_manager/commands/command_request_test.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace sdl_get_policy_configuration_data_request {
+
+using testing::Return;
+
+using sdl_rpc_plugin::commands::SDLGetPolicyConfigurationDataRequest;
+using test::components::policy_test::MockPolicyHandlerInterface;
+
+namespace strings = ::app_mngr::strings;
+namespace hmi_response = ::app_mngr::hmi_response;
+
+class SDLGetPolicyConfigurationDataRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+MATCHER_P(GetPolicyConfigurationDataFirstElementMatches,
+ string_first_element_value,
+ "") {
+ auto message = static_cast<smart_objects::SmartObject>(*arg);
+ if (!message.keyExists(strings::msg_params) ||
+ !message[strings::msg_params].keyExists(strings::value)) {
+ return false;
+ }
+
+ if (message[strings::msg_params][strings::value].getType() !=
+ smart_objects::SmartType::SmartType_Array ||
+ message[strings::msg_params][strings::value].empty()) {
+ return false;
+ }
+
+ Json::Value msg_json_value(Json::ValueType::arrayValue);
+
+ auto msg_value_first = message[strings::msg_params][strings::value][0];
+ return msg_value_first.asString() == string_first_element_value;
+}
+
+MATCHER_P(HMIResultCodeIs, result_code, "") {
+ return result_code ==
+ static_cast<hmi_apis::Common_Result::eType>(
+ (*arg)[strings::params][hmi_response::code].asInt());
+}
+
+TEST_F(SDLGetPolicyConfigurationDataRequestTest, Run_Fail_DataNotAvailable) {
+ std::string kInvalidKey = "invalid_key";
+
+ PolicyTable pt;
+ ON_CALL(mock_policy_handler_, GetPolicyTableData())
+ .WillByDefault(Return(pt.ToJsonValue()));
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::msg_params][strings::policy_type] = kInvalidKey;
+ (*msg)[strings::msg_params][strings::property] = kInvalidKey;
+
+ std::shared_ptr<SDLGetPolicyConfigurationDataRequest> command(
+ CreateCommand<SDLGetPolicyConfigurationDataRequest>(msg));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::Common_Result::DATA_NOT_AVAILABLE),
+ Command::SOURCE_SDL_TO_HMI));
+
+ command->Run();
+}
+
+void clear_new_line_symbol(std::string& str_to_clear) {
+ str_to_clear.erase(
+ std::remove_if(str_to_clear.begin(),
+ str_to_clear.end(),
+ [](char character) { return '\n' == character; }),
+ str_to_clear.end());
+}
+
+TEST_F(SDLGetPolicyConfigurationDataRequestTest, Run_Success) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::msg_params][strings::policy_type] = "module_config";
+ (*msg)[strings::msg_params][strings::property] = "endpoints";
+
+ std::shared_ptr<SDLGetPolicyConfigurationDataRequest> command(
+ CreateCommand<SDLGetPolicyConfigurationDataRequest>(msg));
+
+ policy_table::ModuleConfig module_config_with_endpoints;
+ policy_table::URLList endpoint_url_list;
+ policy_table::URL urls;
+ urls.push_back("https://url1.com");
+ urls.push_back("https://url2.com");
+ endpoint_url_list["default"] = urls;
+ module_config_with_endpoints.endpoints["0x9"] = endpoint_url_list;
+
+ PolicyTable pt;
+ pt.mark_initialized();
+ pt.module_config.mark_initialized();
+ pt.module_config = module_config_with_endpoints;
+
+ ON_CALL(mock_policy_handler_, GetPolicyTableData())
+ .WillByDefault(Return(pt.ToJsonValue()));
+
+ auto json_val = module_config_with_endpoints.endpoints.ToJsonValue();
+ Json::StreamWriterBuilder writer_builder;
+ writer_builder.settings_["indentation"] = "";
+ std::string expected_string = Json::writeString(writer_builder, json_val);
+ clear_new_line_symbol(expected_string);
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(GetPolicyConfigurationDataFirstElementMatches(
+ expected_string),
+ Command::SOURCE_SDL_TO_HMI));
+ command->Run();
+}
+
+TEST_F(SDLGetPolicyConfigurationDataRequestTest,
+ Run_RetriveStringValueFromPolicy) {
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::msg_params][strings::policy_type] =
+ "consumer_friendly_messages";
+ (*msg)[strings::msg_params][strings::property] = "version";
+
+ auto command = CreateCommand<SDLGetPolicyConfigurationDataRequest>(msg);
+
+ const std::string version_test_value("version string");
+ PolicyTable pt;
+ pt.mark_initialized();
+ pt.consumer_friendly_messages->mark_initialized();
+ pt.consumer_friendly_messages->version =
+ rpc::String<1, 100>(version_test_value);
+
+ ON_CALL(mock_policy_handler_, GetPolicyTableData())
+ .WillByDefault(Return(pt.ToJsonValue()));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(GetPolicyConfigurationDataFirstElementMatches(
+ version_test_value),
+ Command::SOURCE_SDL_TO_HMI));
+
+ command->Run();
+}
+
+} // namespace sdl_get_policy_configuration_data_request
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc
index 7cfd7e49e2..021dfc8b1d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc
@@ -32,11 +32,11 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "hmi/sdl_get_status_update_request.h"
+#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/commands/command_request_test.h"
+#include "gtest/gtest.h"
+#include "hmi/sdl_get_status_update_request.h"
namespace test {
namespace components {
@@ -64,7 +64,7 @@ TEST_F(SDLGetStatusUpdateRequestTest, Run_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::correlation_id] = kCorrelationID;
- SharedPtr<SDLGetStatusUpdateRequest> command(
+ std::shared_ptr<SDLGetStatusUpdateRequest> command(
CreateCommand<SDLGetStatusUpdateRequest>(msg));
EXPECT_CALL(mock_policy_handler_, OnGetStatusUpdate(kCorrelationID));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
index 0ec40f896a..5cac1c823f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
@@ -34,15 +34,15 @@
#include <string>
#include <vector>
-#include "gtest/gtest.h"
-#include "hmi/sdl_get_user_friendly_message_request.h"
+#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_state_controller.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/mock_hmi_capabilities.h"
+#include "gtest/gtest.h"
+#include "hmi/sdl_get_user_friendly_message_request.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/commands/command_request_test.h"
namespace test {
namespace components {
@@ -50,11 +50,11 @@ namespace commands_test {
namespace hmi_commands_test {
namespace sdl_get_user_friendly_message_request {
+using application_manager::MockMessageHelper;
using application_manager::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::SDLGetUserFriendlyMessageRequest;
-using application_manager::MockMessageHelper;
-using test::components::policy_test::MockPolicyHandlerInterface;
using test::components::application_manager_test::MockHMICapabilities;
+using test::components::policy_test::MockPolicyHandlerInterface;
using testing::_;
using testing::Return;
using testing::ReturnRef;
@@ -99,7 +99,7 @@ TEST_F(SDLGetUserFriendlyMessageRequestTest, Run_LanguageSet_SUCCESS) {
(*msg)[strings::msg_params][strings::language] = kLanguage;
- SharedPtr<SDLGetUserFriendlyMessageRequest> command(
+ std::shared_ptr<SDLGetUserFriendlyMessageRequest> command(
CreateCommand<SDLGetUserFriendlyMessageRequest>(msg));
EXPECT_CALL(mock_message_helper_, CommonLanguageToString(kLanguage))
@@ -123,7 +123,7 @@ TEST_F(SDLGetUserFriendlyMessageRequestTest, Run_LanguageNotSet_SUCCESS) {
(*msg)[strings::msg_params][kMessageCodes][0] = SmartObject(kLanguageDe);
(*msg)[strings::msg_params][kMessageCodes][1] = SmartObject(kLanguageEn);
- SharedPtr<SDLGetUserFriendlyMessageRequest> command(
+ std::shared_ptr<SDLGetUserFriendlyMessageRequest> command(
CreateCommand<SDLGetUserFriendlyMessageRequest>(msg));
EXPECT_CALL(mock_hmi_capabilities_, active_ui_language())
@@ -144,7 +144,7 @@ TEST_F(SDLGetUserFriendlyMessageRequestTest, Run_NoMsgCodes_Canceled) {
(*msg)[strings::params][strings::correlation_id] = kCorrelationID;
(*msg)[strings::msg_params][strings::app_id] = kAppID;
- SharedPtr<SDLGetUserFriendlyMessageRequest> command(
+ std::shared_ptr<SDLGetUserFriendlyMessageRequest> command(
CreateCommand<SDLGetUserFriendlyMessageRequest>(msg));
EXPECT_CALL(mock_message_helper_, CommonLanguageToString(_)).Times(0);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc
index d25c9b41e8..57bb018273 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc
@@ -34,8 +34,8 @@
#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/notification_to_hmi.h"
#include "application_manager/commands/command_notification_impl.h"
+#include "application_manager/commands/notification_to_hmi.h"
namespace test {
namespace components {
@@ -45,8 +45,8 @@ namespace simple_notifications_test {
using namespace application_manager;
-using ::testing::Types;
using commands::NotificationToHMI;
+using ::testing::Types;
template <typename Command>
class SimpleNotificationsTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
@@ -62,7 +62,8 @@ TYPED_TEST_CASE(SimpleNotificationsTest, CommandsList);
TYPED_TEST(SimpleNotificationsTest, Run_SendMessageToHMI_SUCCESS) {
typedef typename TestFixture::CommandType CommandType;
- SharedPtr<CommandType> command = this->template CreateCommand<CommandType>();
+ std::shared_ptr<CommandType> command =
+ this->template CreateCommand<CommandType>();
// Current implementation always return `true`
EXPECT_TRUE(command->Init());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc
index e47009583f..fc2cd1cca4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc
@@ -30,15 +30,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_from_hmi.h"
#include "application_manager/event_engine/event.h"
#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/commands/request_from_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -47,14 +46,12 @@ namespace hmi_commands_test {
namespace simple_requests_from_hmi_test {
using ::testing::_;
-using ::testing::Types;
-using ::testing::NotNull;
using ::testing::NiceMock;
-
-using ::utils::SharedPtr;
+using ::testing::NotNull;
+using ::testing::Types;
namespace commands = ::application_manager::commands;
-using commands::MessageSharedPtr;
using ::application_manager::event_engine::EventObserver;
+using commands::MessageSharedPtr;
using ::test::components::event_engine_test::MockEventDispatcher;
class RequestFromHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {
@@ -67,7 +64,7 @@ class RequestFromHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {
};
TEST_F(RequestFromHMITest, BasicMethodsOverloads_SUCCESS) {
- SharedPtr<commands::RequestFromHMI> command(
+ std::shared_ptr<commands::RequestFromHMI> command(
CreateCommand<commands::RequestFromHMI>());
application_manager::event_engine::Event event(
hmi_apis::FunctionID::BasicCommunication_ActivateApp);
@@ -79,12 +76,12 @@ TEST_F(RequestFromHMITest, BasicMethodsOverloads_SUCCESS) {
}
TEST_F(RequestFromHMITest, SendResponse_SUCCESS) {
- SharedPtr<commands::RequestFromHMI> command(
+ std::shared_ptr<commands::RequestFromHMI> command(
CreateCommand<commands::RequestFromHMI>());
const bool success = false;
const uint32_t correlation_id = 1u;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(NotNull()));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(NotNull(), _));
command->SendResponse(success,
correlation_id,
@@ -92,7 +89,7 @@ TEST_F(RequestFromHMITest, SendResponse_SUCCESS) {
hmi_apis::Common_Result::SUCCESS);
}
-} // namespace simple_requests_to_hmi_test
+} // namespace simple_requests_from_hmi_test
} // namespace hmi_commands_test
} // namespace commands_test
} // namespace components
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
index c24cfc48db..162e832e9f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc
@@ -30,17 +30,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/commands/command.h"
-#include "sdl_rpc_plugin/commands/hmi/allow_app_request.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/request_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h"
+#include "sdl_rpc_plugin/commands/hmi/allow_app_request.h"
#include "sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h"
#include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h"
+#include "sdl_rpc_plugin/commands/hmi/close_popup_request.h"
+#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h"
#include "sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_request.h"
#include "sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_request.h"
#include "sdl_rpc_plugin/commands/hmi/navi_get_way_points_request.h"
@@ -54,21 +55,15 @@
#include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h"
-#include "application_manager/commands/request_to_hmi.h"
-#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h"
+#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_language_request.h"
+#include "sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h"
#include "sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h"
#include "sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h"
#include "sdl_rpc_plugin/commands/hmi/tts_speak_request.h"
#include "sdl_rpc_plugin/commands/hmi/tts_stop_speaking_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h"
-#include "sdl_rpc_plugin/commands/hmi/tts_get_language_request.h"
-#include "sdl_rpc_plugin/commands/hmi/close_popup_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_add_command_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_alert_request.h"
@@ -82,6 +77,11 @@
#include "sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_perform_interaction_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_show_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_slider_request.h"
@@ -89,24 +89,11 @@
#include "sdl_rpc_plugin/commands/hmi/vr_change_registration_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_delete_command_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h"
-#include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_get_language_request.h"
+#include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h"
#include "sdl_rpc_plugin/commands/hmi/vr_perform_interaction_request.h"
-#include "sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h"
-#include "sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h"
-#include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h"
-#include "sdl_rpc_plugin/commands/hmi/allow_app_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_send_location_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_update_turn_list_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_stop_stream_request.h"
-#include "sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h"
-#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_set_icon_request.h"
-#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h"
-#include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h"
+#include "smart_objects/smart_object.h"
#include "application_manager/mock_event_dispatcher.h"
@@ -117,11 +104,8 @@ namespace hmi_commands_test {
namespace simple_requests_to_hmi_test {
using ::testing::_;
-using ::testing::Types;
using ::testing::NotNull;
-
-using ::utils::SharedPtr;
-
+using ::testing::Types;
namespace am_commands = application_manager::commands;
using am_commands::MessageSharedPtr;
using event_engine_test::MockEventDispatcher;
@@ -129,7 +113,7 @@ using event_engine_test::MockEventDispatcher;
class RequestToHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(RequestToHMITest, BasicMethodsOverloads_SUCCESS) {
- SharedPtr<am_commands::RequestToHMI> command(
+ std::shared_ptr<am_commands::RequestToHMI> command(
CreateCommand<am_commands::RequestToHMI>());
// Current implementation always return `true`
@@ -139,7 +123,7 @@ TEST_F(RequestToHMITest, BasicMethodsOverloads_SUCCESS) {
}
TEST_F(RequestToHMITest, SendRequest_SUCCESS) {
- SharedPtr<am_commands::RequestToHMI> command(
+ std::shared_ptr<am_commands::RequestToHMI> command(
CreateCommand<am_commands::RequestToHMI>());
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(NotNull()));
@@ -194,7 +178,7 @@ typedef Types<sdl_rpc_plugin::commands::hmi::DialNumberRequest,
sdl_rpc_plugin::commands::BasicCommunicationSystemRequest,
sdl_rpc_plugin::commands::ButtonGetCapabilitiesRequest,
sdl_rpc_plugin::commands::NaviSendLocationRequest,
- sdl_rpc_plugin::commands::NaviUnSubscribeWayPointsRequest,
+ sdl_rpc_plugin::commands::NaviUnsubscribeWayPointsRequest,
sdl_rpc_plugin::commands::NaviUpdateTurnListRequest,
sdl_rpc_plugin::commands::NaviShowConstantTBTRequest,
sdl_rpc_plugin::commands::NaviStopStreamRequest,
@@ -226,7 +210,8 @@ typedef Types<sdl_rpc_plugin::commands::UIScrollableMessageRequest,
typedef Types<sdl_rpc_plugin::commands::TTSIsReadyRequest,
sdl_rpc_plugin::commands::UIIsReadyRequest,
sdl_rpc_plugin::commands::NaviIsReadyRequest,
- sdl_rpc_plugin::commands::VRIsReadyRequest> RequestCommandsList3;
+ sdl_rpc_plugin::commands::VRIsReadyRequest>
+ RequestCommandsList3;
TYPED_TEST_CASE(RequestToHMICommandsTest, RequestCommandsList);
TYPED_TEST_CASE(RequestToHMICommandsTest2, RequestCommandsList2);
@@ -235,7 +220,8 @@ TYPED_TEST_CASE(RequestToHMICommandsTest3, RequestCommandsList3);
TYPED_TEST(RequestToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) {
typedef typename TestFixture::CommandType CommandType;
- SharedPtr<CommandType> command = this->template CreateCommand<CommandType>();
+ std::shared_ptr<CommandType> command =
+ this->template CreateCommand<CommandType>();
EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull()));
@@ -245,7 +231,8 @@ TYPED_TEST(RequestToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) {
TYPED_TEST(RequestToHMICommandsTest2, Run_SendMessageToHMI_SUCCESS) {
typedef typename TestFixture::CommandType CommandType;
- SharedPtr<CommandType> command = this->template CreateCommand<CommandType>();
+ std::shared_ptr<CommandType> command =
+ this->template CreateCommand<CommandType>();
EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull()));
command->Run();
@@ -254,7 +241,8 @@ TYPED_TEST(RequestToHMICommandsTest2, Run_SendMessageToHMI_SUCCESS) {
TYPED_TEST(RequestToHMICommandsTest3, Run_SendMessageToHMI_SUCCESS) {
typedef typename TestFixture::CommandType CommandType;
- SharedPtr<CommandType> command = this->template CreateCommand<CommandType>();
+ std::shared_ptr<CommandType> command =
+ this->template CreateCommand<CommandType>();
EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull()));
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc
index 229f48b5e1..f232240c28 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc
@@ -32,14 +32,18 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/notification_from_hmi.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/activate_app_response.h"
#include "hmi/basic_communication_system_response.h"
+#include "hmi/close_popup_response.h"
+#include "hmi/dial_number_response.h"
#include "hmi/navi_alert_maneuver_response.h"
#include "hmi/navi_audio_start_stream_response.h"
#include "hmi/navi_audio_stop_stream_response.h"
@@ -51,20 +55,13 @@
#include "hmi/navi_subscribe_way_points_response.h"
#include "hmi/navi_unsubscribe_way_points_response.h"
#include "hmi/navi_update_turn_list_response.h"
+#include "hmi/on_find_applications.h"
+#include "hmi/on_update_device_list.h"
+#include "hmi/sdl_policy_update_response.h"
#include "hmi/tts_change_registration_response.h"
-#include "hmi/ui_set_app_icon_response.h"
-#include "hmi/ui_set_display_layout_response.h"
-#include "hmi/ui_set_global_properties_response.h"
-#include "hmi/ui_scrollable_message_response.h"
-#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "hmi/dial_number_response.h"
-#include "hmi/close_popup_response.h"
#include "hmi/tts_set_global_properties_response.h"
#include "hmi/tts_speak_response.h"
#include "hmi/tts_stop_speaking_response.h"
-#include "hmi/tts_change_registration_response.h"
#include "hmi/ui_add_command_response.h"
#include "hmi/ui_add_submenu_response.h"
#include "hmi/ui_alert_response.h"
@@ -74,28 +71,21 @@
#include "hmi/ui_end_audio_pass_thru_response.h"
#include "hmi/ui_perform_audio_pass_thru_response.h"
#include "hmi/ui_perform_interaction_response.h"
+#include "hmi/ui_scrollable_message_response.h"
+#include "hmi/ui_send_haptic_data_response.h"
+#include "hmi/ui_set_app_icon_response.h"
+#include "hmi/ui_set_display_layout_response.h"
+#include "hmi/ui_set_global_properties_response.h"
#include "hmi/ui_set_media_clock_timer_response.h"
#include "hmi/ui_show_response.h"
#include "hmi/ui_slider_response.h"
+#include "hmi/update_app_list_response.h"
+#include "hmi/update_device_list_response.h"
#include "hmi/vr_add_command_response.h"
#include "hmi/vr_change_registration_response.h"
#include "hmi/vr_delete_command_response.h"
#include "hmi/vr_perform_interaction_response.h"
-#include "hmi/activate_app_response.h"
-#include "hmi/basic_communication_system_response.h"
-#include "hmi/navi_unsubscribe_way_points_response.h"
-#include "hmi/navi_update_turn_list_response.h"
-#include "hmi/navi_send_location_response.h"
-#include "hmi/navi_show_constant_tbt_response.h"
-#include "hmi/navi_start_stream_response.h"
-#include "hmi/navi_subscribe_way_points_response.h"
-#include "hmi/on_find_applications.h"
-#include "hmi/on_update_device_list.h"
-#include "hmi/sdl_policy_update_response.h"
-#include "hmi/update_app_list_response.h"
-#include "hmi/update_device_list_response.h"
-#include "application_manager/commands/notification_from_hmi.h"
-#include "hmi/ui_send_haptic_data_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -103,14 +93,12 @@ namespace commands_test {
namespace hmi_commands_test {
namespace simple_response_from_hmi_test {
+using ::test::components::event_engine_test::MockEventDispatcher;
using ::testing::_;
+using ::testing::Eq;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::Types;
-using ::testing::Eq;
-
-using ::utils::SharedPtr;
-using ::test::components::event_engine_test::MockEventDispatcher;
namespace am = ::application_manager;
namespace commands = sdl_rpc_plugin::commands;
@@ -221,7 +209,8 @@ typedef Types<
CommandData<sdl_rpc_plugin::commands::UIScrollableMessageResponse,
hmi_apis::FunctionID::UI_ScrollableMessage>,
CommandData<sdl_rpc_plugin::commands::UISendHapticDataResponse,
- hmi_apis::FunctionID::UI_SendHapticData> > ResponseCommandsList;
+ hmi_apis::FunctionID::UI_SendHapticData> >
+ ResponseCommandsList;
typedef Types<sdl_rpc_plugin::commands::AudioStopStreamResponse,
sdl_rpc_plugin::commands::NaviStopStreamResponse,
@@ -244,7 +233,8 @@ TYPED_TEST(ResponseFromHMICommandsTest, Run_SendMessageToHMI_SUCCESS) {
typedef typename TestFixture::CommandData CommandData;
typedef typename CommandData::CommandType CommandType;
- SharedPtr<CommandType> command = this->template CreateCommand<CommandType>();
+ std::shared_ptr<CommandType> command =
+ this->template CreateCommand<CommandType>();
EXPECT_CALL(this->event_dispatcher_,
raise_event(EventIdIsEqualTo(CommandData::kEventId)));
@@ -255,7 +245,8 @@ TYPED_TEST(ResponseFromHMICommandsTest, Run_SendMessageToHMI_SUCCESS) {
TYPED_TEST(EmptyResponseFromHMICommandsTest, Run_SUCCESS) {
typedef typename TestFixture::CommandType CommandType;
- SharedPtr<CommandType> command = this->template CreateCommand<CommandType>();
+ std::shared_ptr<CommandType> command =
+ this->template CreateCommand<CommandType>();
command->Run();
}
@@ -277,7 +268,7 @@ class NotificationFromHMITest
: public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(NotificationFromHMITest, BasicMethodsOverloads_SUCCESS) {
- SharedPtr<application_manager::commands::NotificationFromHMI> command(
+ std::shared_ptr<application_manager::commands::NotificationFromHMI> command(
CreateCommand<application_manager::commands::NotificationFromHMI>());
// Current implementation always return `true`
EXPECT_TRUE(command->Init());
@@ -290,7 +281,7 @@ TEST_F(NotificationFromHMITest, SendNotificationToMobile_SUCCESS) {
(*command_msg)[am::strings::params][am::strings::message_type] =
static_cast<int32_t>(am::MessageType::kNotification);
- SharedPtr<application_manager::commands::NotificationFromHMI> command(
+ std::shared_ptr<application_manager::commands::NotificationFromHMI> command(
CreateCommand<application_manager::commands::NotificationFromHMI>());
EXPECT_CALL(
mock_rpc_service_,
@@ -303,7 +294,7 @@ TEST_F(NotificationFromHMITest, SendNotificationToMobile_SUCCESS) {
TEST_F(NotificationFromHMITest, CreateHMIRequest_UNSUCCESS) {
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
(*command_msg)[am::strings::msg_params] = 0;
- SharedPtr<application_manager::commands::NotificationFromHMI> command(
+ std::shared_ptr<application_manager::commands::NotificationFromHMI> command(
CreateCommand<application_manager::commands::NotificationFromHMI>(
command_msg));
@@ -311,7 +302,7 @@ TEST_F(NotificationFromHMITest, CreateHMIRequest_UNSUCCESS) {
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(correlation_id));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(CheckMsgType(am::MessageType::kRequest)))
+ ManageHMICommand(CheckMsgType(am::MessageType::kRequest), _))
.WillOnce(Return(false));
command->CreateHMIRequest(hmi_apis::FunctionID::INVALID_ENUM,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc
index ef8978c34c..910c3f2873 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc
@@ -30,17 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/command.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/response_to_hmi.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h"
-#include "application_manager/commands/response_to_hmi.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -49,10 +48,8 @@ namespace hmi_commands_test {
namespace simple_response_to_hmi_test {
using ::testing::_;
-using ::testing::Types;
using ::testing::NotNull;
-using ::utils::SharedPtr;
-
+using ::testing::Types;
namespace commands = sdl_rpc_plugin::commands;
using application_manager::commands::MessageSharedPtr;
@@ -66,14 +63,16 @@ class ResponseToHMICommandsTest
typedef Types<commands::SDLActivateAppResponse,
commands::SDLGetListOfPermissionsResponse,
commands::SDLGetStatusUpdateResponse,
- commands::SDLGetUserFriendlyMessageResponse> ResponseCommandsList;
+ commands::SDLGetUserFriendlyMessageResponse>
+ ResponseCommandsList;
TYPED_TEST_CASE(ResponseToHMICommandsTest, ResponseCommandsList);
TYPED_TEST(ResponseToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) {
typedef typename TestFixture::CommandType CommandType;
- SharedPtr<CommandType> command = this->template CreateCommand<CommandType>();
+ std::shared_ptr<CommandType> command =
+ this->template CreateCommand<CommandType>();
EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull()));
command->Run();
@@ -82,7 +81,7 @@ TYPED_TEST(ResponseToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) {
class ResponseToHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(ResponseToHMITest, BasicMethodsOverloads_SUCCESS) {
- SharedPtr<application_manager::commands::ResponseToHMI> command(
+ std::shared_ptr<application_manager::commands::ResponseToHMI> command(
CreateCommand<application_manager::commands::ResponseToHMI>());
// Current implementation always return `true`
@@ -91,7 +90,7 @@ TEST_F(ResponseToHMITest, BasicMethodsOverloads_SUCCESS) {
}
TEST_F(ResponseToHMITest, Run_SUCCESS) {
- SharedPtr<application_manager::commands::ResponseToHMI> command(
+ std::shared_ptr<application_manager::commands::ResponseToHMI> command(
CreateCommand<application_manager::commands::ResponseToHMI>());
EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(NotNull()));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc
index afc18114de..c7b96f1acf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc
@@ -32,11 +32,11 @@
#include <string>
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_hmi_capabilities.h"
#include "gtest/gtest.h"
#include "hmi/tts_get_capabilities_response.h"
-#include "application_manager/mock_hmi_capabilities.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
namespace test {
namespace components {
@@ -47,7 +47,7 @@ namespace tts_get_capabilities_response {
using application_manager::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::TTSGetCapabilitiesResponse;
using test::components::application_manager_test::MockHMICapabilities;
-using utils::SharedPtr;
+
using testing::_;
namespace strings = ::application_manager::strings;
@@ -71,7 +71,7 @@ TEST_F(TTSGetCapabilitiesResponseTest, Run_BothExist_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_prerecorded_speech(SmartObject(kText)));
- SharedPtr<TTSGetCapabilitiesResponse> command(
+ std::shared_ptr<TTSGetCapabilitiesResponse> command(
CreateCommand<TTSGetCapabilitiesResponse>(msg));
command->Run();
@@ -85,7 +85,7 @@ TEST_F(TTSGetCapabilitiesResponseTest, Run_OnlySpeech_SUCCESS) {
set_speech_capabilities(SmartObject(kText)));
EXPECT_CALL(mock_hmi_capabilities_, set_prerecorded_speech(_)).Times(0);
- SharedPtr<TTSGetCapabilitiesResponse> command(
+ std::shared_ptr<TTSGetCapabilitiesResponse> command(
CreateCommand<TTSGetCapabilitiesResponse>(msg));
command->Run();
@@ -100,7 +100,7 @@ TEST_F(TTSGetCapabilitiesResponseTest, Run_OnlyPrerecorded_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_,
set_prerecorded_speech(SmartObject(kText)));
- SharedPtr<TTSGetCapabilitiesResponse> command(
+ std::shared_ptr<TTSGetCapabilitiesResponse> command(
CreateCommand<TTSGetCapabilitiesResponse>(msg));
command->Run();
@@ -112,7 +112,7 @@ TEST_F(TTSGetCapabilitiesResponseTest, Run_Nothing_SUCCESS) {
EXPECT_CALL(mock_hmi_capabilities_, set_speech_capabilities(_)).Times(0);
EXPECT_CALL(mock_hmi_capabilities_, set_prerecorded_speech(_)).Times(0);
- SharedPtr<TTSGetCapabilitiesResponse> command(
+ std::shared_ptr<TTSGetCapabilitiesResponse> command(
CreateCommand<TTSGetCapabilitiesResponse>(msg));
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc
index 5f2fe1beda..c0d23cb34b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc
@@ -30,13 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/tts_get_language_response.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -44,7 +43,6 @@ namespace commands_test {
namespace hmi_commands_test {
namespace tts_get_language_response {
-using utils::SharedPtr;
using sdl_rpc_plugin::commands::TTSGetLanguageResponse;
using test::components::application_manager_test::MockHMICapabilities;
using test::components::event_engine_test::MockEventDispatcher;
@@ -66,7 +64,7 @@ TEST_F(TTSGetLanguageResponseTest, Run_LanguageSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::msg_params][hmi_response::language] = kLanguage;
- SharedPtr<TTSGetLanguageResponse> command(
+ std::shared_ptr<TTSGetLanguageResponse> command(
CreateCommand<TTSGetLanguageResponse>(msg));
EXPECT_CALL(mock_hmi_capabilities_, set_active_tts_language(kLanguage));
@@ -82,7 +80,7 @@ TEST_F(TTSGetLanguageResponseTest, Run_LanguageSet_SUCCESS) {
TEST_F(TTSGetLanguageResponseTest, Run_LanguageNotSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<TTSGetLanguageResponse> command(
+ std::shared_ptr<TTSGetLanguageResponse> command(
CreateCommand<TTSGetLanguageResponse>(msg));
EXPECT_CALL(mock_hmi_capabilities_,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc
index 2672062aab..c0f187a85f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc
@@ -33,18 +33,17 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/response_from_hmi.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/commands/response_from_hmi.h"
-#include "hmi/tts_get_supported_languages_response.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/tts_get_supported_languages_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,17 +52,16 @@ namespace hmi_commands_test {
namespace tts_get_supported_languages_response {
using ::testing::_;
-using ::testing::Return;
-using ::utils::SharedPtr;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
+using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::TTSGetSupportedLanguagesResponse;
-using am::commands::CommandImpl;
-typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr;
+typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
MockHMICapabilities;
@@ -115,7 +113,8 @@ TEST_F(TTSGetSupportedLanguageResponseTest, RUN_UNSUCCESS) {
CreateCommand<TTSGetSupportedLanguagesResponse>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
- set_tts_supported_languages(supported_languages)).Times(0);
+ set_tts_supported_languages(supported_languages))
+ .Times(0);
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc
index d6d74d18bd..a2f4440c86 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc
@@ -33,19 +33,18 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/commands/response_from_hmi.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/commands/response_from_hmi.h"
-#include "hmi/tts_is_ready_response.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/tts_is_ready_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -54,18 +53,17 @@ namespace hmi_commands_test {
namespace tts_is_ready_response {
using ::testing::_;
-using ::testing::Return;
-using ::utils::SharedPtr;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
+using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::TTSIsReadyResponse;
-using am::commands::CommandImpl;
using test::components::event_engine_test::MockEventDispatcher;
-typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr;
+typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
MockHMICapabilities;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
index 8dbc09fc4f..4683fc62c7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
@@ -32,16 +32,14 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_impl.h"
+#include "gtest/gtest.h"
#include "hmi/ui_get_capabilities_response.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -49,16 +47,15 @@ namespace commands_test {
namespace hmi_commands_test {
namespace ui_get_capabilities_response {
-using ::utils::SharedPtr;
using ::testing::NiceMock;
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
+using am::commands::CommandImpl;
using application_manager::commands::ResponseFromHMI;
using sdl_rpc_plugin::commands::UIGetCapabilitiesResponse;
-using am::commands::CommandImpl;
-typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr;
+typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
MockHMICapabilities;
@@ -116,8 +113,9 @@ TEST_F(UIGetCapabilitiesResponseTest, SetSoftButton_SUCCESS) {
ResponseFromHMIPtr command(
CreateCommand<UIGetCapabilitiesResponse>(command_msg));
- smart_objects::SmartObject soft_button_capabilities_so = (*command_msg)
- [strings::msg_params][hmi_response::soft_button_capabilities];
+ smart_objects::SmartObject soft_button_capabilities_so =
+ (*command_msg)[strings::msg_params]
+ [hmi_response::soft_button_capabilities];
EXPECT_CALL(mock_hmi_capabilities_,
set_soft_button_capabilities(soft_button_capabilities_so));
@@ -147,16 +145,48 @@ TEST_F(UIGetCapabilitiesResponseTest, SetHmiZone_SUCCESS) {
TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThru_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
(*command_msg)[strings::msg_params][strings::audio_pass_thru_capabilities] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ ResponseFromHMIPtr command(
+ CreateCommand<UIGetCapabilitiesResponse>(command_msg));
+
+ smart_objects::SmartObject audio_pass_thru_capabilities_so =
+ (*command_msg)[strings::msg_params]
+ [strings::audio_pass_thru_capabilities];
+
+ // hmi_capabilities will receive a list of capabilities, the first element
+ // being audio_pass_thru_capabilities_so
+ smart_objects::SmartObject audio_pass_thru_capabilities_list_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ audio_pass_thru_capabilities_list_so[0] = audio_pass_thru_capabilities_so;
+ EXPECT_CALL(
+ mock_hmi_capabilities_,
+ set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_list_so));
+
+ command->Run();
+}
+
+TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThruList_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+
+ // if both audioPassThruCapabilities and audioPassThruCapabilitiesList are
+ // supplied, audioPassThruCapabilitiesList should be used
+ smart_objects::SmartObject audio_pass_thru_capabilities_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject audio_pass_thru_capabilities_list_so =
smart_objects::SmartObject(smart_objects::SmartType_Array);
+ (*command_msg)[strings::msg_params][strings::audio_pass_thru_capabilities] =
+ audio_pass_thru_capabilities_so;
+ (*command_msg)[strings::msg_params]
+ [strings::audio_pass_thru_capabilities_list] =
+ audio_pass_thru_capabilities_list_so;
ResponseFromHMIPtr command(
CreateCommand<UIGetCapabilitiesResponse>(command_msg));
- smart_objects::SmartObject audio_pass_thru_capabilities_so = (*command_msg)
- [strings::msg_params][strings::audio_pass_thru_capabilities];
EXPECT_CALL(
mock_hmi_capabilities_,
- set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_so));
+ set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_list_so));
command->Run();
}
@@ -280,7 +310,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
video_streaming_capability[strings::preferred_resolution]
[strings::resolution_width] = 800;
video_streaming_capability[strings::preferred_resolution]
- [strings::resolution_height] = 350;
+ [strings::resolution_height] = 354;
video_streaming_capability[strings::max_bitrate] = 10000;
@@ -298,6 +328,12 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
video_streaming_capability[strings::haptic_spatial_data_supported] = true;
+ video_streaming_capability[strings::diagonal_screen_size] = 7.47;
+
+ video_streaming_capability[strings::pixel_per_inch] = 117.f;
+
+ video_streaming_capability[strings::scale] = 1.f;
+
ResponseFromHMIPtr command(
CreateCommand<UIGetCapabilitiesResponse>(command_msg));
@@ -307,6 +343,25 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
command->Run();
}
+TEST_F(UIGetCapabilitiesResponseTest, SetSystemDisplayCapabilities_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::msg_params][strings::system_capabilities] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ ResponseFromHMIPtr command(
+ CreateCommand<UIGetCapabilitiesResponse>(command_msg));
+
+ const auto& display_capability_so =
+ (*command_msg)[strings::msg_params][strings::system_capabilities]
+ [strings::display_capabilities];
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ set_system_display_capabilities(display_capability_so));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
} // namespace ui_get_capabilities_response
} // namespace hmi_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc
index 285024ed40..7e8040543d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/ui_get_language_response.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -44,12 +44,11 @@ namespace commands_test {
namespace hmi_commands_test {
namespace ui_get_language_response {
-using utils::SharedPtr;
using sdl_rpc_plugin::commands::UIGetLanguageResponse;
using test::components::event_engine_test::MockEventDispatcher;
using testing::_;
-using testing::ReturnRef;
using ::testing::NiceMock;
+using testing::ReturnRef;
namespace strings = application_manager::strings;
namespace hmi_response = application_manager::hmi_response;
@@ -70,7 +69,7 @@ TEST_F(UIGetLanguageResponseTest, Run_LanguageSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::msg_params][hmi_response::language] = kLanguage;
- SharedPtr<UIGetLanguageResponse> command(
+ std::shared_ptr<UIGetLanguageResponse> command(
CreateCommand<UIGetLanguageResponse>(msg));
EXPECT_CALL(mock_hmi_capabilities_, set_active_ui_language(kLanguage));
@@ -86,7 +85,7 @@ TEST_F(UIGetLanguageResponseTest, Run_LanguageSet_SUCCESS) {
TEST_F(UIGetLanguageResponseTest, Run_LanguageNotSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<UIGetLanguageResponse> command(
+ std::shared_ptr<UIGetLanguageResponse> command(
CreateCommand<UIGetLanguageResponse>(msg));
EXPECT_CALL(mock_hmi_capabilities_,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc
index 021ef4fdb6..10cf244bcf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc
@@ -33,16 +33,15 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/application.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_application_manager.h"
-#include "hmi/ui_get_supported_languages_response.h"
+#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/ui_get_supported_languages_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -50,15 +49,14 @@ namespace commands_test {
namespace hmi_commands_test {
namespace ui_get_supported_languages_response {
-using ::testing::Return;
-using ::utils::SharedPtr;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
using sdl_rpc_plugin::commands::UIGetSupportedLanguagesResponse;
-typedef SharedPtr<UIGetSupportedLanguagesResponse>
+typedef std::shared_ptr<UIGetSupportedLanguagesResponse>
UIGetSupportedLanguagesResponsePtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
@@ -109,7 +107,8 @@ TEST_F(UIGetSupportedLanguagesResponseTest, RUN_UNSUCCESS) {
CreateCommand<UIGetSupportedLanguagesResponse>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
- set_ui_supported_languages(supported_languages)).Times(0);
+ set_ui_supported_languages(supported_languages))
+ .Times(0);
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc
index b8fc839f12..837b8438dc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc
@@ -33,17 +33,17 @@
#include "hmi/ui_is_ready_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
+
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/hmi_interfaces.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,14 +53,14 @@ namespace ui_is_ready_request {
namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
+using sdl_rpc_plugin::commands::UIIsReadyRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
-using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::UIIsReadyRequest;
-using am::event_engine::Event;
-typedef SharedPtr<UIIsReadyRequest> UIIsReadyRequestPtr;
+typedef std::shared_ptr<UIIsReadyRequest> UIIsReadyRequestPtr;
class UIIsReadyRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -125,9 +125,9 @@ class UIIsReadyRequestTest
.WillOnce(Return(get_capabilities));
EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*get_language));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_language));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_all_language));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_capabilities));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_language, _));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_all_language, _));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(get_capabilities, _));
}
void PrepareEvent(bool is_message_contain_param,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc
index 6817c5ef0e..44b9504055 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc
@@ -33,13 +33,12 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "gtest/gtest.h"
#include "hmi/ui_is_ready_response.h"
-#include "application_manager/mock_event_dispatcher.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -47,16 +46,15 @@ namespace commands_test {
namespace hmi_commands_test {
namespace ui_is_ready_response {
-using ::testing::Return;
-using ::utils::SharedPtr;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
using sdl_rpc_plugin::commands::UIIsReadyResponse;
using test::components::event_engine_test::MockEventDispatcher;
-typedef SharedPtr<UIIsReadyResponse> UIIsReadyResponsePtr;
+typedef std::shared_ptr<UIIsReadyResponse> UIIsReadyResponsePtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
MockHMICapabilities;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc
index 2ce7d9e8f0..31c03a7ed5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc
@@ -32,21 +32,20 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/HMI_API.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_impl.h"
#include "application_manager/application_manager.h"
#include "application_manager/application_manager_impl.h"
-#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/mock_application.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
-#include "application_manager/request_controller_settings.h"
+#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/request_controller_settings.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/update_device_list_request.h"
+#include "interfaces/HMI_API.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -54,21 +53,20 @@ namespace commands_test {
namespace hmi_commands_test {
namespace update_device_list_request {
-using ::utils::SharedPtr;
-using testing::_;
-using testing::ReturnRef;
-using testing::Return;
-using test::components::event_engine_test::MockEventDispatcher;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
+using test::components::event_engine_test::MockEventDispatcher;
+using testing::_;
+using testing::Return;
+using testing::ReturnRef;
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
+using am::commands::CommandImpl;
using am::event_engine::Event;
using sdl_rpc_plugin::commands::UpdateDeviceListRequest;
-using am::commands::CommandImpl;
-typedef SharedPtr<UpdateDeviceListRequest> UpdateDeviceListRequestPtr;
+typedef std::shared_ptr<UpdateDeviceListRequest> UpdateDeviceListRequestPtr;
namespace {
const uint32_t kConnectionKey = 2u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc
index 2b079a21e0..96f3b38fbf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc
@@ -33,14 +33,13 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/update_sdl_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -48,14 +47,13 @@ namespace commands_test {
namespace hmi_commands_test {
namespace update_sdl_request {
-using ::utils::SharedPtr;
-using ::testing::ReturnRef;
using ::testing::NiceMock;
+using ::testing::ReturnRef;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
using sdl_rpc_plugin::commands::UpdateSDLRequest;
-typedef SharedPtr<UpdateSDLRequest> UpdateSDLRequestPtr;
+typedef std::shared_ptr<UpdateSDLRequest> UpdateSDLRequestPtr;
namespace {
const uint32_t kConnectionKey = 2u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc
index 0035637605..62ffc6be4d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc
@@ -33,13 +33,12 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/application.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
#include "hmi/update_sdl_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -47,13 +46,12 @@ namespace commands_test {
namespace hmi_commands_test {
namespace update_sdl_response {
-using ::utils::SharedPtr;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
-using sdl_rpc_plugin::commands::UpdateSDLResponse;
using am::commands::CommandImpl;
+using sdl_rpc_plugin::commands::UpdateSDLResponse;
-typedef SharedPtr<UpdateSDLResponse> UpdateSDLResponsePtr;
+typedef std::shared_ptr<UpdateSDLResponse> UpdateSDLResponsePtr;
namespace {
const uint32_t kConnectionKey = 2u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc
index 0163fdd1d1..21acf2bb70 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc
@@ -32,15 +32,14 @@
#include <stdint.h>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_impl.h"
+#include "gtest/gtest.h"
#include "hmi/vr_get_capabilities_response.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -48,15 +47,14 @@ namespace commands_test {
namespace hmi_commands_test {
namespace vr_get_capabilities_response {
-using ::utils::SharedPtr;
using ::testing::NiceMock;
namespace am = ::application_manager;
namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
-using sdl_rpc_plugin::commands::VRGetCapabilitiesResponse;
using am::commands::CommandImpl;
+using sdl_rpc_plugin::commands::VRGetCapabilitiesResponse;
-typedef SharedPtr<VRGetCapabilitiesResponse> VRGetCapabilitiesResponsePtr;
+typedef std::shared_ptr<VRGetCapabilitiesResponse> VRGetCapabilitiesResponsePtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
MockHMICapabilities;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc
index 845324925f..8b00b4dded 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "hmi/vr_get_language_response.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -44,12 +44,11 @@ namespace commands_test {
namespace hmi_commands_test {
namespace vr_get_language_response {
-using utils::SharedPtr;
using sdl_rpc_plugin::commands::VRGetLanguageResponse;
using test::components::event_engine_test::MockEventDispatcher;
using testing::_;
-using testing::ReturnRef;
using ::testing::NiceMock;
+using testing::ReturnRef;
namespace strings = application_manager::strings;
namespace hmi_response = application_manager::hmi_response;
@@ -70,7 +69,7 @@ TEST_F(VRGetLanguageResponseTest, Run_LanguageSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::msg_params][hmi_response::language] = kLanguage;
- SharedPtr<VRGetLanguageResponse> command(
+ std::shared_ptr<VRGetLanguageResponse> command(
CreateCommand<VRGetLanguageResponse>(msg));
EXPECT_CALL(mock_hmi_capabilities_, set_active_vr_language(kLanguage));
@@ -86,7 +85,7 @@ TEST_F(VRGetLanguageResponseTest, Run_LanguageSet_SUCCESS) {
TEST_F(VRGetLanguageResponseTest, Run_LanguageNotSet_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<VRGetLanguageResponse> command(
+ std::shared_ptr<VRGetLanguageResponse> command(
CreateCommand<VRGetLanguageResponse>(msg));
EXPECT_CALL(mock_hmi_capabilities_,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc
index 0ac0d8e118..b81823624c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc
@@ -33,16 +33,15 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/application.h"
#include "application_manager/commands/commands_test.h"
-#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_application_manager.h"
-#include "hmi/vr_get_supported_languages_response.h"
+#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "hmi/vr_get_supported_languages_response.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -50,15 +49,14 @@ namespace commands_test {
namespace hmi_commands_test {
namespace vr_get_supported_languages_response {
-using ::testing::Return;
-using ::utils::SharedPtr;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
using sdl_rpc_plugin::commands::VRGetSupportedLanguagesResponse;
-typedef SharedPtr<VRGetSupportedLanguagesResponse>
+typedef std::shared_ptr<VRGetSupportedLanguagesResponse>
VRGetSupportedLanguagesResponsePtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
@@ -109,7 +107,8 @@ TEST_F(VRGetSupportedLanguagesResponseTest, RUN_UNSUCCESS) {
CreateCommand<VRGetSupportedLanguagesResponse>(command_msg));
EXPECT_CALL(mock_hmi_capabilities_,
- set_vr_supported_languages(supported_languages)).Times(0);
+ set_vr_supported_languages(supported_languages))
+ .Times(0);
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc
index 1ec0adb5e0..9bb8e4c2d5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc
@@ -33,16 +33,16 @@
#include "hmi/vr_is_ready_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
+
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/hmi_interfaces.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -54,10 +54,10 @@ using ::testing::_;
using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::VRIsReadyRequest;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::VRIsReadyRequest;
-typedef SharedPtr<VRIsReadyRequest> VRIsReadyRequestPtr;
+typedef std::shared_ptr<VRIsReadyRequest> VRIsReadyRequestPtr;
class VRIsReadyRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -98,7 +98,7 @@ class VRIsReadyRequestTest
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, _))
.WillOnce(Return(language));
EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*language));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(language));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(language, _));
smart_objects::SmartObjectSPtr support_language(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
@@ -106,14 +106,14 @@ class VRIsReadyRequestTest
mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetSupportedLanguages, _))
.WillOnce(Return(support_language));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(support_language));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(support_language, _));
smart_objects::SmartObjectSPtr capabilities(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
EXPECT_CALL(mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities, _))
.WillOnce(Return(capabilities));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(capabilities, _));
}
void PrepareEvent(bool is_message_contain_param,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc
index 452679e189..8b7b0a94f4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc
@@ -33,13 +33,12 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "gtest/gtest.h"
#include "hmi/vr_is_ready_response.h"
-#include "application_manager/mock_event_dispatcher.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -47,16 +46,15 @@ namespace commands_test {
namespace hmi_commands_test {
namespace vr_is_ready_response {
-using ::testing::Return;
-using ::utils::SharedPtr;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
using sdl_rpc_plugin::commands::VRIsReadyResponse;
using test::components::event_engine_test::MockEventDispatcher;
-typedef SharedPtr<VRIsReadyResponse> VRIsReadyResponsePtr;
+typedef std::shared_ptr<VRIsReadyResponse> VRIsReadyResponsePtr;
class VRIsReadyResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> {
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
index 0067be3f1b..b11312eb33 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
@@ -31,24 +31,26 @@
*/
#include <stdint.h>
-#include <string>
+#include <memory>
#include <set>
+#include <string>
#include "mobile/add_command_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
+
#include "utils/helpers.h"
-#include "utils/make_shared.h"
-#include "smart_objects/smart_object.h"
-#include "utils/custom_string.h"
+
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
namespace test {
namespace components {
@@ -57,18 +59,18 @@ namespace mobile_commands_test {
namespace add_command_request {
namespace am = application_manager;
-using am::commands::CommandImpl;
+namespace am_test = application_manager_test;
using am::ApplicationManager;
-using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
-using ::testing::_;
-using ::utils::SharedPtr;
-using ::testing::Return;
-using ::testing::InSequence;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using am::event_engine::EventObserver;
+using ns_smart_device_link::ns_smart_objects::SmartObjectSPtr;
using sdl_rpc_plugin::commands::AddCommandRequest;
-using NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr;
using ::test::components::application_manager_test::MockApplication;
-using am::event_engine::EventObserver;
+using ::testing::_;
+using ::testing::InSequence;
+using ::testing::Return;
using namespace smart_objects;
namespace custom_str = utils::custom_string;
@@ -104,6 +106,8 @@ class AddCommandRequestTest
: msg_(CreateMessage())
, default_app_name_("test_default_app_name_")
, lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , mock_help_prompt_manager_(
+ std::make_shared<am_test::MockHelpPromptManager>())
, mock_app_(CreateMockApp()) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app_));
@@ -178,7 +182,7 @@ class AddCommandRequestTest
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
commands_map, lock_ptr_)));
- so_ptr_ = utils::MakeShared<SmartObject>(SmartType_Map);
+ so_ptr_ = std::make_shared<SmartObject>(SmartType_Map);
EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId))
.WillOnce(Return(so_ptr_.get()));
{
@@ -186,15 +190,15 @@ class AddCommandRequestTest
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
Event event(incoming_cmd);
@@ -203,10 +207,10 @@ class AddCommandRequestTest
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(cmd_to_delete)))
+ ManageHMICommand(HMIResultCodeIs(cmd_to_delete), _))
.WillOnce(Return(true));
- SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map);
+ SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map);
(*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
mock_message_helper_,
@@ -217,8 +221,8 @@ class AddCommandRequestTest
mock_rpc_service_,
ManageMobileCommand(response,
am::commands::Command::CommandSource::SOURCE_SDL));
- utils::SharedPtr<CommandRequestImpl> base_class_request =
- static_cast<utils::SharedPtr<CommandRequestImpl> >(request_ptr);
+ std::shared_ptr<CommandRequestImpl> base_class_request =
+ static_cast<std::shared_ptr<CommandRequestImpl> >(request_ptr);
base_class_request->onTimeOut();
}
@@ -226,6 +230,7 @@ class AddCommandRequestTest
SmartObjectSPtr so_ptr_;
const utils::custom_string::CustomString default_app_name_;
std::shared_ptr<sync_primitives::Lock> lock_ptr_;
+ std::shared_ptr<am_test::MockHelpPromptManager> mock_help_prompt_manager_;
MockAppPtr mock_app_;
};
@@ -238,7 +243,7 @@ TEST_F(AddCommandRequestTest, Run_AppNotExisted_EXPECT_AppNotRegistered) {
mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
}
@@ -253,7 +258,27 @@ TEST_F(AddCommandRequestTest, Run_ImageVerificationFailed_EXPECT_INVALID_DATA) {
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
+ CreateCommand<AddCommandRequest>(msg_);
+ request_ptr->Run();
+}
+
+TEST_F(AddCommandRequestTest, Run_ImageVerificationFailed_EXPECT_WARNINGS) {
+ CreateBasicParamsUIRequest();
+ SmartObject& msg_params = (*msg_)[strings::msg_params];
+ SmartObject& image = msg_params[cmd_icon];
+ EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
+ .WillOnce(Return(mobile_apis::Result::WARNINGS));
+
+ am::CommandsMap commands_map;
+ EXPECT_CALL(*mock_app_, commands_map())
+ .WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
+ commands_map, lock_ptr_)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
+ .WillOnce(Return(true));
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
}
@@ -279,7 +304,7 @@ TEST_F(AddCommandRequestTest, Run_MenuNameHasSyntaxError_EXPECT_INVALID_DATA) {
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
}
@@ -298,7 +323,7 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
}
@@ -324,7 +349,7 @@ TEST_F(AddCommandRequestTest, Run_CMDIconHasError_EXPECT_INVALID_DATA) {
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg);
request_ptr->Run();
}
@@ -335,13 +360,13 @@ TEST_F(AddCommandRequestTest, Run_CommandIDAlreadyExists_EXPECT_INVALID_ID) {
SmartObject& image = msg_params[cmd_icon];
EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- so_ptr_ = utils::MakeShared<SmartObject>(SmartType_Map);
+ so_ptr_ = std::make_shared<SmartObject>(SmartType_Map);
EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get()));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::INVALID_ID), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
}
@@ -366,7 +391,7 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::DUPLICATE_NAME), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
}
@@ -393,7 +418,7 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::INVALID_ID), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
}
@@ -416,14 +441,14 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
commands_map, lock_ptr_)));
- so_ptr_ = utils::MakeShared<SmartObject>(SmartType_Map);
+ so_ptr_ = std::make_shared<SmartObject>(SmartType_Map);
EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId))
.WillOnce(Return(so_ptr_.get()));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::DUPLICATE_NAME), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
}
@@ -439,7 +464,7 @@ TEST_F(AddCommandRequestTest, Run_MsgDataEmpty_EXPECT_INVALID_DATA) {
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg);
request_ptr->Run();
}
@@ -461,23 +486,23 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
commands_map, lock_ptr_)));
- so_ptr_ = utils::MakeShared<SmartObject>(SmartType_Map);
+ so_ptr_ = std::make_shared<SmartObject>(SmartType_Map);
EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId))
.WillOnce(Return(so_ptr_.get()));
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
}
@@ -497,9 +522,9 @@ TEST_F(AddCommandRequestTest, GetRunMethods_SUCCESS) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
}
@@ -522,9 +547,15 @@ TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnVrCommandAdded(kCmdId, (*msg_)[msg_params], false));
+
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
request_ptr->on_event(event);
@@ -547,9 +578,15 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnVrCommandAdded(kCmdId, (*msg_)[msg_params], false));
+
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
request_ptr->on_event(event);
@@ -580,7 +617,7 @@ TEST_F(AddCommandRequestTest, OnEvent_BothSend_SUCCESS) {
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(0);
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(command_msg);
request_ptr->Run();
request_ptr->on_event(event_ui);
@@ -589,7 +626,7 @@ TEST_F(AddCommandRequestTest, OnEvent_BothSend_SUCCESS) {
TEST_F(AddCommandRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
Event event(hmi_apis::FunctionID::INVALID_ENUM);
request_ptr->on_event(event);
@@ -602,7 +639,7 @@ TEST_F(AddCommandRequestTest, OnEvent_AppNotExisted_UNSUCCESS) {
Event event(hmi_apis::FunctionID::UI_AddCommand);
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->on_event(event);
}
@@ -622,9 +659,9 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
@@ -653,19 +690,24 @@ TEST_F(AddCommandRequestTest,
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::WARNINGS), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandAdded(kCmdId, _, false));
+
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
Event event_ui(hmi_apis::FunctionID::UI_AddCommand);
@@ -692,18 +734,18 @@ TEST_F(
commands_map, lock_ptr_)));
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
@@ -737,18 +779,18 @@ TEST_F(
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
@@ -782,16 +824,16 @@ TEST_F(
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
@@ -831,16 +873,16 @@ TEST_F(
commands_map, lock_ptr_)));
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
@@ -879,9 +921,9 @@ TEST_F(
commands_map, lock_ptr_)));
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
EXPECT_CALL(mock_hmi_interfaces_,
@@ -916,9 +958,9 @@ TEST_F(
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
EXPECT_CALL(mock_hmi_interfaces_,
@@ -954,19 +996,19 @@ TEST_F(AddCommandRequestTest,
commands_map, lock_ptr_)));
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
@@ -978,9 +1020,9 @@ TEST_F(AddCommandRequestTest,
event_ui.set_smart_object(*msg_ui);
Event event_vr(hmi_apis::FunctionID::VR_AddCommand);
event_vr.set_smart_object(*msg_);
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2);
request_ptr->on_event(event_ui);
@@ -1002,28 +1044,28 @@ TEST_F(AddCommandRequestTest,
commands_map, lock_ptr_)));
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR), _));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
Event event_ui(hmi_apis::FunctionID::UI_AddCommand);
event_ui.set_smart_object(*msg_);
request_ptr->on_event(event_ui);
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2);
Event event_vr(hmi_apis::FunctionID::VR_AddCommand);
@@ -1041,7 +1083,7 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(ApplicationSharedPtr()));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(0);
- SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map);
+ SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map);
(*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
mock_message_helper_,
@@ -1050,8 +1092,8 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
response, am::commands::Command::CommandSource::SOURCE_SDL));
- utils::SharedPtr<CommandRequestImpl> base_class_request =
- static_cast<utils::SharedPtr<CommandRequestImpl> >(
+ std::shared_ptr<CommandRequestImpl> base_class_request =
+ static_cast<std::shared_ptr<CommandRequestImpl> >(
CreateCommand<AddCommandRequest>(msg_));
base_class_request->onTimeOut();
}
@@ -1072,26 +1114,26 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>(
commands_map, lock_ptr_)));
- so_ptr_ = utils::MakeShared<SmartObject>(SmartType_Map);
+ so_ptr_ = std::make_shared<SmartObject>(SmartType_Map);
EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId))
.WillOnce(Return(so_ptr_.get()));
{
InSequence dummy;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _))
.WillOnce(Return(true));
}
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
- SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map);
+ SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map);
(*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
mock_message_helper_,
@@ -1100,8 +1142,8 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
response, am::commands::Command::CommandSource::SOURCE_SDL));
- utils::SharedPtr<CommandRequestImpl> base_class_request =
- static_cast<utils::SharedPtr<CommandRequestImpl> >(request_ptr);
+ std::shared_ptr<CommandRequestImpl> base_class_request =
+ static_cast<std::shared_ptr<CommandRequestImpl> >(request_ptr);
base_class_request->onTimeOut();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc
index 9fad021c3e..a88a1ade69 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc
@@ -35,14 +35,14 @@
#include "mobile/add_sub_menu_request.h"
-#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -51,13 +51,13 @@ namespace mobile_commands_test {
namespace add_sub_menu_request {
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::AddSubMenuRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::AddSubMenuRequest;
using ::testing::_;
using ::testing::Return;
-typedef SharedPtr<AddSubMenuRequest> AddSubMenuPtr;
+typedef std::shared_ptr<AddSubMenuRequest> AddSubMenuPtr;
namespace {
const uint32_t kConnectionKey = 2u;
@@ -98,7 +98,7 @@ TEST_F(AddSubMenuRequestTest, Run_ImageVerificationFailed_EXPECT_INVALID_DATA) {
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _));
- utils::SharedPtr<AddSubMenuRequest> request_ptr =
+ std::shared_ptr<AddSubMenuRequest> request_ptr =
CreateCommand<AddSubMenuRequest>(msg);
request_ptr->Run();
@@ -110,7 +110,7 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
(*msg)[am::strings::msg_params][am::strings::menu_id] = menu_id;
- utils::SharedPtr<AddSubMenuRequest> command =
+ std::shared_ptr<AddSubMenuRequest> command =
CreateCommand<AddSubMenuRequest>(msg);
ON_CALL(app_mngr_, application(kConnectionKey))
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc
index ac870e7001..e726616345 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc
@@ -34,21 +34,21 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
-#include "mobile/alert_maneuver_request.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "interfaces/MOBILE_API.h"
+#include "mobile/alert_maneuver_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -60,11 +60,11 @@ using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::AlertManeuverRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::AlertManeuverRequest;
-typedef SharedPtr<AlertManeuverRequest> CommandPtr;
+typedef std::shared_ptr<AlertManeuverRequest> CommandPtr;
class AlertManeuverRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -80,7 +80,7 @@ class AlertManeuverRequestTest
am::event_engine::Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*response);
- utils::SharedPtr<AlertManeuverRequest> command =
+ std::shared_ptr<AlertManeuverRequest> command =
CreateCommand<AlertManeuverRequest>(response);
MockAppPtr mock_app(CreateMockApp());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
index 5835cbff81..dc7731bfc8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
@@ -31,19 +31,19 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/alert_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -52,18 +52,17 @@ namespace mobile_commands_test {
namespace alert_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::AlertRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
-using ::utils::SharedPtr;
using am::event_engine::Event;
using policy_test::MockPolicyHandlerInterface;
+using sdl_rpc_plugin::commands::AlertRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
-typedef SharedPtr<AlertRequest> CommandPtr;
+typedef std::shared_ptr<AlertRequest> CommandPtr;
namespace {
const int32_t kCommandId = 1;
@@ -74,6 +73,8 @@ const uint32_t kDefaultTimeout = 1000u;
const uint32_t kCorrelationId = 2u;
const mobile_apis::FunctionID::eType kFunctionId =
mobile_apis::FunctionID::AlertID;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -139,9 +140,9 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
*mock_app_,
AreCommandLimitsExceeded(kFunctionId, am::TLimitSource::POLICY_TABLE))
.WillByDefault(Return(false));
- ON_CALL(*mock_app_, hmi_level())
+ ON_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
- ON_CALL(*mock_app_, hmi_level())
+ ON_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
}
@@ -156,7 +157,8 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
}
void ExpectCallHmiLevel(const mobile_apis::HMILevel::eType level) {
- EXPECT_CALL(*mock_app_, hmi_level()).WillRepeatedly(Return(level));
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
+ .WillRepeatedly(Return(level));
}
void ExpectManageMobileCommandWithResultCode(
@@ -170,11 +172,11 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
void ExpectManageHmiCommandTTSAndUI() {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Alert)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Alert), _))
.WillOnce(Return(true));
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _))
.WillOnce(Return(true));
}
sync_primitives::Lock lock_;
@@ -192,7 +194,7 @@ TEST_F(AlertRequestTest, OnTimeout_GENERIC_ERROR) {
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- utils::SharedPtr<AlertRequest> command = CreateCommand<AlertRequest>();
+ std::shared_ptr<AlertRequest> command = CreateCommand<AlertRequest>();
EXPECT_CALL(
mock_message_helper_,
@@ -223,7 +225,7 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) {
(*command_msg)[am::strings::msg_params][am::strings::menu_params]
[am::strings::menu_name] = "menu_name";
- utils::SharedPtr<AlertRequest> command =
+ std::shared_ptr<AlertRequest> command =
CreateCommand<AlertRequest>(command_msg);
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
@@ -453,7 +455,7 @@ TEST_F(AlertRequestTest, OnEvent_UIAlertHasHmiResponsesToWait_UNSUCCESS) {
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)));
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _));
command->on_event(event);
}
@@ -480,7 +482,7 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarnings_SUCCESS) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _))
.WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
@@ -512,7 +514,7 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSUnsupportedResource_SUCCESS) {
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _))
.WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
@@ -557,9 +559,9 @@ TEST_F(AlertRequestTest,
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_Alert);
@@ -606,9 +608,9 @@ TEST_F(AlertRequestTest, OnEvent_TTSUnsupportedResourceUiAlertSuccess_SUCCESS) {
(*msg_)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_Alert);
@@ -646,7 +648,7 @@ TEST_F(AlertRequestTest, OnEvent_TTSSuccesUiAlertInvalidEnum_SUCCESS) {
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _))
.WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
@@ -655,9 +657,9 @@ TEST_F(AlertRequestTest, OnEvent_TTSSuccesUiAlertInvalidEnum_SUCCESS) {
(*msg_)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::INVALID_ENUM;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_Alert);
@@ -696,7 +698,7 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) {
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)))
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _))
.WillOnce(Return(true));
CommandPtr command(CreateCommand<AlertRequest>(msg_));
@@ -705,9 +707,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) {
(*msg_)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::INVALID_ENUM;
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_Alert);
@@ -744,9 +746,9 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarningUiAlertWarning_SUCCESS) {
CommandPtr command(CreateCommand<AlertRequest>(msg_));
command->Run();
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_Alert);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc
index 3d6a345ced..4394c6fe5e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc
@@ -31,27 +31,25 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/change_registration_request.h"
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "utils/helpers.h"
-#include "utils/make_shared.h"
-#include "utils/custom_string.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/smart_object_keys.h"
-#include "policy/policy_regular/policy/usage_statistics/mock_statistics_manager.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "policy/policy_regular/policy/usage_statistics/mock_statistics_manager.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
+#include "utils/helpers.h"
namespace test {
namespace components {
@@ -60,19 +58,18 @@ namespace mobile_commands_test {
namespace change_registration_request {
namespace am = application_manager;
-using am::commands::CommandImpl;
using am::ApplicationManager;
-using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using policy_test::MockPolicyHandlerInterface;
+using sdl_rpc_plugin::commands::ChangeRegistrationRequest;
+using ::test::components::application_manager_test::MockApplication;
using ::testing::_;
-using ::utils::SharedPtr;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::SetArgPointee;
-using sdl_rpc_plugin::commands::ChangeRegistrationRequest;
-using policy_test::MockPolicyHandlerInterface;
-using ::test::components::application_manager_test::MockApplication;
namespace custom_str = utils::custom_string;
namespace strings = ::application_manager::strings;
@@ -149,7 +146,7 @@ class ChangeRegistrationRequestTest
hmi_apis::Common_Result::UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_from_mobile = CreateMsgFromMobile();
- utils::SharedPtr<ChangeRegistrationRequest> command =
+ std::shared_ptr<ChangeRegistrationRequest> command =
CreateCommand<ChangeRegistrationRequest>(msg_from_mobile);
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
@@ -279,7 +276,7 @@ typedef ChangeRegistrationRequestTest::MockHMICapabilities MockHMICapabilities;
TEST_F(ChangeRegistrationRequestTest,
OnEvent_VRHmiSendSuccess_UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_from_mobile = CreateMsgFromMobile();
- utils::SharedPtr<ChangeRegistrationRequest> command =
+ std::shared_ptr<ChangeRegistrationRequest> command =
CreateCommand<ChangeRegistrationRequest>(msg_from_mobile);
am::ApplicationSet application_set;
@@ -367,7 +364,7 @@ TEST_F(ChangeRegistrationRequestTest,
TEST_F(ChangeRegistrationRequestTest,
OnEvent_TTS_UNSUPPORTED_RESOURCE_STATE_NOT_AVAILABLE_Expect_false) {
MessageSharedPtr msg_from_mobile = CreateMsgFromMobile();
- utils::SharedPtr<ChangeRegistrationRequest> command =
+ std::shared_ptr<ChangeRegistrationRequest> command =
CreateCommand<ChangeRegistrationRequest>(msg_from_mobile);
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
@@ -472,7 +469,7 @@ TEST_F(ChangeRegistrationRequestTest,
OnEvent_UIHmiSendSuccess_UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_from_mobile = CreateMsgFromMobile();
- utils::SharedPtr<ChangeRegistrationRequest> command =
+ std::shared_ptr<ChangeRegistrationRequest> command =
CreateCommand<ChangeRegistrationRequest>(msg_from_mobile);
am::ApplicationSet application_set;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
index 10ffbded09..73a0008624 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
@@ -31,26 +31,24 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/create_interaction_choice_set_request.h"
#include "mobile/create_interaction_choice_set_response.h"
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "utils/helpers.h"
-#include "utils/make_shared.h"
-#include "smart_objects/smart_object.h"
-#include "utils/custom_string.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
+#include "utils/helpers.h"
namespace test {
namespace components {
@@ -59,27 +57,26 @@ namespace mobile_commands_test {
namespace create_interaction_choice_set_request {
namespace am = application_manager;
-using am::commands::CommandImpl;
using am::ApplicationManager;
-using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
-using ::testing::_;
-using ::utils::SharedPtr;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::AtLeast;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::CreateInteractionChoiceSetRequest;
using sdl_rpc_plugin::commands::CreateInteractionChoiceSetResponse;
using ::test::components::application_manager_test::MockApplication;
+using ::testing::_;
+using ::testing::AtLeast;
+using ::testing::Return;
+using ::testing::ReturnRef;
namespace custom_str = utils::custom_string;
namespace strings = ::application_manager::strings;
namespace hmi_response = ::application_manager::hmi_response;
-typedef SharedPtr<CreateInteractionChoiceSetRequest>
+typedef std::shared_ptr<CreateInteractionChoiceSetRequest>
CreateInteractionChoiceSetRequestPtr;
-typedef SharedPtr<CreateInteractionChoiceSetResponse>
+typedef std::shared_ptr<CreateInteractionChoiceSetResponse>
CreateInteractionChoiceSetResponsePtr;
typedef NiceMock<
@@ -171,7 +168,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) {
am::mobile_api::Result::GENERIC_ERROR;
(*msg_vr)[strings::msg_params][strings::success] = false;
- utils::SharedPtr<CreateInteractionChoiceSetRequest> req_vr =
+ std::shared_ptr<CreateInteractionChoiceSetRequest> req_vr =
CreateCommand<CreateInteractionChoiceSetRequest>();
MockAppPtr mock_app = CreateMockApp();
@@ -202,8 +199,10 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
10;
(*msg_vr)[strings::msg_params][strings::choice_set][0][strings::menu_name] =
"menu_name";
+ (*msg_vr)[strings::msg_params][strings::choice_set][0][strings::vr_commands]
+ [0] = kVrCommands1;
(*msg_vr)[strings::msg_params][strings::interaction_choice_set_id] = 11;
- utils::SharedPtr<CreateInteractionChoiceSetRequest> req_vr =
+ std::shared_ptr<CreateInteractionChoiceSetRequest> req_vr =
CreateCommand<CreateInteractionChoiceSetRequest>(msg_vr);
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
@@ -233,8 +232,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
.WillByDefault(
Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
-
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
+ ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL));
req_vr->Run();
MessageSharedPtr vr_command_result;
@@ -439,6 +439,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
+ ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL));
+
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
@@ -484,6 +487,79 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
command_->Run();
}
+TEST_F(CreateInteractionChoiceSetRequestTest, Run_WithoutVrCommands_SUCCESS) {
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::menu_name] = kMenuName;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::image][am::strings::value] = kImage;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::choice_id] = kChoiceId1;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::secondary_image][am::strings::value] = kSecondImage;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][1]
+ [am::strings::choice_id] = kChoiceId2;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][1]
+ [am::strings::menu_name] = kMenuName;
+ (*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
+ kChoiceSetId;
+
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
+
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
+ .WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillOnce(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::NONE));
+
+ smart_objects::SmartObject* choice_set_id = NULL;
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
+ .WillOnce(Return(choice_set_id));
+
+ // No VR commands
+ EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0);
+
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
+
+ command_->Run();
+}
+
+TEST_F(CreateInteractionChoiceSetRequestTest,
+ Run_WithMixedVrCommands_UNSUCCESS) {
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::menu_name] = kMenuName;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::image][am::strings::value] = kImage;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::choice_id] = kChoiceId1;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::secondary_image][am::strings::value] = kSecondImage;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::vr_commands][0] = kVrCommands1;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][1]
+ [am::strings::choice_id] = kChoiceId2;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][1]
+ [am::strings::menu_name] = kMenuName;
+ (*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
+ kChoiceSetId;
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
+
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
+ .WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillOnce(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::MIXED));
+
+ smart_objects::SmartObject* choice_set_id = NULL;
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
+ .WillOnce(Return(choice_set_id));
+
+ EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0);
+
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)).Times(0);
+
+ command_->Run();
+}
+
TEST_F(CreateInteractionChoiceSetRequestTest,
OnEvent_InvalidEventId_UNSUCCESS) {
Event event(hmi_apis::FunctionID::INVALID_ENUM);
@@ -526,6 +602,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_ValidVrNoError_SUCCESS) {
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
+ ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL));
+
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
@@ -560,6 +639,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
+ ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL));
+
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
@@ -595,6 +677,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
+ ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL));
+
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
@@ -643,6 +728,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
+ ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL));
+
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
@@ -685,6 +773,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) {
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
+ ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL));
+
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
@@ -726,6 +817,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
+
+ ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
@@ -799,6 +893,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) {
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillRepeatedly(Return(choice_set_id));
+ ON_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillByDefault(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::ALL));
+
EXPECT_CALL(app_mngr_, GenerateGrammarID())
.WillRepeatedly(Return(kGrammarId));
EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)).Times(2);
@@ -823,4 +920,4 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) {
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc
new file mode 100644
index 0000000000..905c6ceb72
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc
@@ -0,0 +1,460 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <memory>
+#include <set>
+#include <string>
+
+#include "mobile/create_window_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/hmi_state.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_state_controller.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace create_window_request {
+
+namespace am = application_manager;
+using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::CreateWindowRequest;
+using namespace mobile_apis::PredefinedWindows;
+using am::commands::Command;
+using application_manager::WindowID;
+using test::components::application_manager_test::MockStateController;
+using test::components::policy_test::MockPolicyHandlerInterface;
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+namespace {
+const uint32_t kAppId = 1u;
+const uint32_t kConnectionKey = 2u;
+const int32_t kFunctionID = mobile_apis::FunctionID::CreateWindowID;
+const WindowID kTestWindowId = 12;
+const WindowID kDuplicateWindowID = 13;
+const char* const kWindowName = "WindowName";
+const utils::custom_string::CustomString kAppName("TestApp");
+} // namespace
+
+MATCHER_P2(CheckMessageToMobile, result_code, success, "") {
+ const bool is_success =
+ (*arg)[am::strings::msg_params][am::strings::success].asBool() == success;
+
+ const bool is_result_code_correct =
+ (*arg)[am::strings::msg_params][am::strings::result_code].asInt() ==
+ static_cast<int32_t>(result_code);
+ return is_success && is_result_code_correct;
+}
+
+class CreateWindowRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ CreateWindowRequestTest() {
+ mock_app_ = CreateMockApp();
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ }
+
+ protected:
+ MessageSharedPtr CreateMsgParams() {
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*msg)[am::strings::params][am::strings::function_id] = kFunctionID;
+ return msg;
+ }
+
+ void SetupHelperApplyWindowInitialState(const MockAppPtr& app,
+ const MessageSharedPtr& msg) {
+ am::HmiStatePtr state(new am::HmiState(app, app_mngr_));
+ const auto window_type = static_cast<mobile_apis::WindowType::eType>(
+ (*msg)[am::strings::msg_params][am::strings::window_type].asInt());
+ const auto window_id = static_cast<mobile_apis::WindowType::eType>(
+ (*msg)[am::strings::msg_params][am::strings::window_id].asInt());
+ const auto window_name =
+ (*msg)[am::strings::msg_params][am::strings::window_name].asString();
+
+ state->set_window_type(window_type);
+ state->set_hmi_level(mobile_apis::HMILevel::INVALID_ENUM);
+ state->set_audio_streaming_state(
+ mobile_apis::AudioStreamingState::INVALID_ENUM);
+ state->set_video_streaming_state(
+ mobile_apis::VideoStreamingState::INVALID_ENUM);
+ state->set_system_context(mobile_apis::SystemContext::INVALID_ENUM);
+ ApplicationSharedPtr AppPtr = app;
+ ON_CALL(app_mngr_,
+ CreateRegularState(AppPtr,
+ window_type,
+ mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_apis::SystemContext::INVALID_ENUM))
+ .WillByDefault(Return(state));
+ ON_CALL(*mock_app_, SetInitialState(kTestWindowId, window_name, state))
+ .WillByDefault(Return());
+ ON_CALL(app_mngr_, state_controller())
+ .WillByDefault(ReturnRef(mock_state_controller));
+ ON_CALL(
+ mock_state_controller,
+ OnAppWindowAdded(
+ AppPtr, window_id, window_type, mobile_apis::HMILevel::HMI_NONE))
+ .WillByDefault(Return());
+ }
+
+ void SetUp() OVERRIDE {
+ using namespace application_manager;
+ display_capabilities_ = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Array);
+
+ smart_objects::SmartObject window_type_supported(
+ smart_objects::SmartType_Array);
+
+ const uint32_t maximum_widgets_amount = 4;
+ smart_objects::SmartObject maximum_widgets(smart_objects::SmartType_Map);
+ maximum_widgets[strings::window_type] = mobile_apis::WindowType::WIDGET;
+ maximum_widgets[strings::maximum_number_of_windows] =
+ maximum_widgets_amount;
+
+ window_type_supported[window_type_supported.length()] = maximum_widgets;
+
+ (*display_capabilities_)[0][strings::window_type_supported] =
+ window_type_supported;
+
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities_));
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(display_capabilities_));
+
+ window_params_map_lock_ptr_ = std::make_shared<sync_primitives::Lock>();
+
+ DataAccessor<am::WindowParamsMap> window_params_map(
+ test_window_params_map_, window_params_map_lock_ptr_);
+ ON_CALL(*mock_app_, window_optional_params_map())
+ .WillByDefault(Return(window_params_map));
+ }
+
+ MockAppPtr mock_app_;
+ NiceMock<MockStateController> mock_state_controller;
+ std::shared_ptr<sync_primitives::Lock> window_params_map_lock_ptr_;
+ application_manager::WindowParamsMap test_window_params_map_;
+ smart_objects::SmartObjectSPtr display_capabilities_;
+};
+
+TEST_F(CreateWindowRequestTest, WindowID_ExpectDefaultWindowID) {
+ auto msg = CreateMsgParams();
+ const auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ command->window_id());
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_WindowIDAlreadyExist_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_CreateWindowForMAINWindowType_ExpectInvalidDataResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_DATA;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::eType::MAIN;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(
+ CreateWindowRequestTest,
+ Run_DuplicateUpdatesFromNotExistingWindowId_ExpectInvalidDataResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_DATA;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(false));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(
+ CreateWindowRequestTest,
+ Run_DuplicateUpdatesFromExistingWindowId_ExpectUICreateWindowIsSentToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_CreateWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+ ON_CALL(*mock_app_, GetWindowNames())
+ .WillByDefault(Return(std::vector<std::string>()));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::WIDGET;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_WindowNameAppNameAreEqual_ExpectDuplicateNameResponseToMobile) {
+ const auto result_code = mobile_apis::Result::DUPLICATE_NAME;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kAppName;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_AllParametersCorrect_ExpectUICreateWindowIsSentToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_CreateWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ const std::vector<std::string> windowNames = {
+ "WindowName_1", "WindowName_2", "WindowName_3"};
+ ON_CALL(*mock_app_, GetWindowNames()).WillByDefault(Return(windowNames));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+ (*msg)[am::strings::msg_params][am::strings::associated_service_type] =
+ "MEDIA";
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::WIDGET;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(
+ CreateWindowRequestTest,
+ CheckWindowName_AllParametersCorrectCreateWindowForPrimaryWidget_SendMessageToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_CreateWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] =
+ mobile_apis::PredefinedWindows::PRIMARY_WIDGET;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+ (*msg)[am::strings::msg_params][am::strings::associated_service_type] =
+ "MEDIA";
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::WIDGET;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_InvalidFunctionId_MessageNotSendToMobile) {
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+ command->on_event(event);
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::UI_CreateWindow);
+ command->on_event(event);
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_RequestFailedOnHMISide_SendGenericErrorResponseToMobile) {
+ const auto result_code = mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::eType::WIDGET;
+
+ SetupHelperApplyWindowInitialState(mock_app_, msg);
+
+ Event event(hmi_apis::FunctionID::UI_CreateWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_AllParametersCorrect_SendSuccessResponseToMobile) {
+ const auto result_code = mobile_apis::Result::SUCCESS;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, true),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(1);
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::eType::WIDGET;
+
+ SetupHelperApplyWindowInitialState(mock_app_, msg);
+
+ Event event(hmi_apis::FunctionID::UI_CreateWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+} // namespace create_window_request
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc
index ac8803c2ca..081058f05a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc
@@ -36,15 +36,16 @@
#include "mobile/delete_command_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
+
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_hmi_interface.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -56,13 +57,14 @@ using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::DeleteCommandRequest;
+namespace am_test = application_manager_test;
+using am::MockHmiInterfaces;
+using am::MockMessageHelper;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
-using am::MockHmiInterfaces;
+using sdl_rpc_plugin::commands::DeleteCommandRequest;
-typedef SharedPtr<DeleteCommandRequest> DeleteCommandPtr;
+typedef std::shared_ptr<DeleteCommandRequest> DeleteCommandPtr;
namespace {
const int32_t kCommandId = 1;
@@ -74,7 +76,10 @@ const uint32_t kConnectionKey = 2u;
class DeleteCommandRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- DeleteCommandRequestTest() : mock_app_(CreateMockApp()) {}
+ DeleteCommandRequestTest()
+ : mock_help_prompt_manager_(
+ std::make_shared<am_test::MockHelpPromptManager>())
+ , mock_app_(CreateMockApp()) {}
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -132,6 +137,7 @@ class DeleteCommandRequestTest
}
NiceMock<MockHmiInterfaces> hmi_interfaces_;
+ std::shared_ptr<am_test::MockHelpPromptManager> mock_help_prompt_manager_;
MockAppPtr mock_app_;
};
@@ -188,6 +194,11 @@ TEST_F(DeleteCommandRequestTest,
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&vr_command_result), Return(true)));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnVrCommandDeleted(kCommandId, false));
+
command->on_event(event_vr);
ResultCommandExpectations(vr_command_result, "VR is not supported by system");
@@ -241,10 +252,15 @@ TEST_F(DeleteCommandRequestTest,
EXPECT_CALL(*app, UpdateHash());
+ EXPECT_CALL(*app, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnVrCommandDeleted(kCommandId, false));
+
MessageSharedPtr result_msg(
CatchMobileCommandResult(CallOnEvent(*command, event_ui)));
- ASSERT_TRUE(result_msg);
+ ASSERT_TRUE((bool)result_msg);
ResultCommandExpectations(result_msg, "UI is not supported by system");
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc
index 5cc9dcf543..cce53bb480 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc
@@ -31,32 +31,32 @@
*/
#include <stdint.h>
-#include <vector>
-#include <string>
#include <map>
+#include <string>
+#include <vector>
#include "mobile/delete_file_request.h"
#include "mobile/delete_file_response.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "utils/file_system.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "utils/file_system.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/policies/policy_handler.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "interfaces/MOBILE_API.h"
namespace test {
namespace components {
@@ -65,20 +65,20 @@ namespace mobile_commands_test {
namespace delete_file {
using ::testing::_;
-using ::testing::Test;
+using ::testing::AtLeast;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::SetArgReferee;
-using ::testing::AtLeast;
+using ::testing::Test;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::DeleteFileRequest;
-using sdl_rpc_plugin::commands::DeleteFileResponse;
+using am::MockMessageHelper;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
+using sdl_rpc_plugin::commands::DeleteFileRequest;
+using sdl_rpc_plugin::commands::DeleteFileResponse;
-typedef SharedPtr<DeleteFileRequest> DeleteFileRequestPtr;
-typedef SharedPtr<DeleteFileResponse> DeleteFileResponsePtr;
+typedef std::shared_ptr<DeleteFileRequest> DeleteFileRequestPtr;
+typedef std::shared_ptr<DeleteFileResponse> DeleteFileResponsePtr;
typedef NiceMock<
::test::components::application_manager_test::MockHMICapabilities>
MockHMICapabilities;
@@ -98,6 +98,8 @@ namespace {
const uint32_t kConnectionKey = 1u;
const uint32_t kCorrelationId = 10u;
const int32_t kMenuId = 5;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class DeleteFileRequestTest
@@ -134,7 +136,7 @@ TEST_F(DeleteFileRequestTest, Run_HMILevelNone_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_NONE));
EXPECT_CALL(app_mngr_, get_settings())
@@ -161,7 +163,7 @@ TEST_F(DeleteFileRequestTest, Run_ValidFileName_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(app_mngr_, get_settings())
@@ -191,7 +193,7 @@ TEST_F(DeleteFileRequestTest, Run_InvalidFile_UNSUCCESS) {
(*message_)[am::strings::msg_params][am::strings::sync_file_name] = file_name;
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(app_mngr_, get_settings())
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
index b2daef9cd2..fa96b21ca7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
@@ -37,14 +37,14 @@
#include "mobile/delete_interaction_choice_set_response.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
+
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,19 +53,19 @@ namespace mobile_commands_test {
namespace delete_interaction_choice_set {
using ::testing::_;
-using ::testing::Return;
using ::testing::InSequence;
+using ::testing::Return;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::DeleteInteractionChoiceSetRequest;
-using sdl_rpc_plugin::commands::DeleteInteractionChoiceSetResponse;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::DeleteInteractionChoiceSetRequest;
+using sdl_rpc_plugin::commands::DeleteInteractionChoiceSetResponse;
-typedef SharedPtr<DeleteInteractionChoiceSetRequest>
+typedef std::shared_ptr<DeleteInteractionChoiceSetRequest>
DeleteInteractionChoiceSetRequestPtr;
-typedef SharedPtr<DeleteInteractionChoiceSetResponse>
+typedef std::shared_ptr<DeleteInteractionChoiceSetResponse>
DeleteInteractionChoiceSetResponsePtr;
MATCHER_P(CheckMessageSuccess, success, "") {
@@ -252,7 +252,7 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) {
EXPECT_CALL(*app_, UpdateHash());
}
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
DeleteInteractionChoiceSetRequestPtr command =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
index 7a187c46d1..04f12568b4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc
@@ -36,13 +36,14 @@
#include "mobile/delete_sub_menu_request.h"
#include "mobile/delete_sub_menu_response.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -51,20 +52,21 @@ namespace mobile_commands_test {
namespace delete_sub_menu_request {
using ::testing::_;
+using ::testing::InSequence;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::InSequence;
namespace am = ::application_manager;
-using am::commands::MessageSharedPtr;
-using am::event_engine::Event;
+namespace am_test = application_manager_test;
using am::MockHmiInterfaces;
using am::MockMessageHelper;
+using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
using sdl_rpc_plugin::commands::DeleteSubMenuRequest;
using sdl_rpc_plugin::commands::DeleteSubMenuResponse;
-typedef SharedPtr<DeleteSubMenuRequest> DeleteSubMenuRequestPtr;
-typedef SharedPtr<DeleteSubMenuResponse> DeleteSubMenuResponsePtr;
+typedef std::shared_ptr<DeleteSubMenuRequest> DeleteSubMenuRequestPtr;
+typedef std::shared_ptr<DeleteSubMenuResponse> DeleteSubMenuResponsePtr;
MATCHER_P(CheckMessageResultCode, result_code, "") {
return (*arg)[am::strings::msg_params][am::strings::result_code].asInt() ==
@@ -99,6 +101,8 @@ class DeleteSubMenuRequestTest
, accessor_(commands_map_, commands_lock_)
, message_(CreateMessage())
, command_(CreateCommand<DeleteSubMenuRequest>(message_))
+ , mock_help_prompt_manager_(
+ std::make_shared<am_test::MockHelpPromptManager>())
, app_(CreateMockApp()) {}
am::CommandsMap commands_map_;
@@ -107,6 +111,7 @@ class DeleteSubMenuRequestTest
MessageSharedPtr message_;
DeleteSubMenuRequestPtr command_;
+ std::shared_ptr<am_test::MockHelpPromptManager> mock_help_prompt_manager_;
MockAppPtr app_;
};
@@ -118,7 +123,7 @@ TEST_F(DeleteSubMenuRequestTest, DISABLED_OnEvent_UI_UNSUPPORTED_RESOURCE) {
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
(*msg)[am::strings::msg_params][am::strings::menu_id] = 10u;
- utils::SharedPtr<DeleteSubMenuRequest> command =
+ std::shared_ptr<DeleteSubMenuRequest> command =
CreateCommand<DeleteSubMenuRequest>(msg);
MockAppPtr mock_app = CreateMockApp();
@@ -219,9 +224,9 @@ TEST_F(DeleteSubMenuRequestTest, Run_SendHMIRequest_SUCCESS) {
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(kCorrelationId));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteSubMenu)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteSubMenu), _))
.WillOnce(Return(true));
command_->Run();
}
@@ -268,17 +273,20 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) {
EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey));
EXPECT_CALL(*app_, get_grammar_id()).WillOnce(Return(kGrammarId));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(*app_, commands_map()).WillOnce(Return(accessor_));
EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey));
EXPECT_CALL(*app_, RemoveCommand(_)).WillOnce(DeleteCommand(&commands_map_));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand)))
+ EXPECT_CALL(*app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandDeleted(kCmdId, false));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _))
.WillOnce(Return(true));
EXPECT_CALL(*app_, RemoveSubMenu(_));
@@ -287,6 +295,7 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) {
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
am::commands::Command::SOURCE_SDL));
EXPECT_CALL(*app_, UpdateHash());
+
DeleteSubMenuRequestPtr command =
CreateCommand<DeleteSubMenuRequest>(message_);
@@ -321,7 +330,7 @@ TEST_F(DeleteSubMenuRequestTest,
std::make_pair(0, &((*message_)[am::strings::msg_params])));
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_));
EXPECT_CALL(*app_, RemoveCommand(_)).Times(0);
@@ -348,7 +357,7 @@ TEST_F(DeleteSubMenuRequestTest,
std::make_pair(0, &((*message_)[am::strings::msg_params])));
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_));
EXPECT_CALL(*app_, RemoveCommand(_)).Times(0);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc
new file mode 100644
index 0000000000..f951d5c2a7
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <memory>
+#include <set>
+#include <string>
+
+#include "mobile/delete_window_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/hmi_state.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_state_controller.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace delete_window_request {
+
+namespace am = application_manager;
+using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::DeleteWindowRequest;
+using namespace mobile_apis::PredefinedWindows;
+using am::commands::Command;
+using application_manager::WindowID;
+using test::components::application_manager_test::MockStateController;
+using test::components::policy_test::MockPolicyHandlerInterface;
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const int32_t kFunctionID = mobile_apis::FunctionID::DeleteWindowID;
+const WindowID kTestWindowId = 12;
+} // namespace
+
+MATCHER_P2(CheckMessageToMobile, result_code, success, "") {
+ const bool is_success =
+ (*arg)[am::strings::msg_params][am::strings::success].asBool() == success;
+
+ const bool is_result_code_correct =
+ (*arg)[am::strings::msg_params][am::strings::result_code].asInt() ==
+ static_cast<int32_t>(result_code);
+ return is_success && is_result_code_correct;
+}
+
+class DeleteWindowRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ DeleteWindowRequestTest() {
+ mock_app_ = CreateMockApp();
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ }
+
+ protected:
+ MessageSharedPtr CreateMsgParams() {
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*msg)[am::strings::params][am::strings::function_id] = kFunctionID;
+ return msg;
+ }
+
+ MockAppPtr mock_app_;
+ NiceMock<MockStateController> mock_state_controller;
+};
+
+TEST_F(DeleteWindowRequestTest, WindowID_ExpectDefaultWindowID) {
+ auto msg = CreateMsgParams();
+ const auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ command->window_id());
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_WindowIDForMainApplicationWindow_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_WindowIDNotExist_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, GetWindowIds()).WillByDefault(Return(am::WindowIds()));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_AllParametersCorrect_ExpectUIDeleteWindowIsSentToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+
+ ON_CALL(*mock_app_, GetWindowIds())
+ .WillByDefault(Return(am::WindowIds(1, kTestWindowId)));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kTestWindowId)).WillOnce(Return(true));
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_AllParametersCorrectDeleteWindowForPrimaryWidget_SendMessageToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ const auto primary_widget_window_id =
+ mobile_apis::PredefinedWindows::PRIMARY_WIDGET;
+ ON_CALL(*mock_app_, GetWindowIds())
+ .WillByDefault(Return(am::WindowIds(1, primary_widget_window_id)));
+ EXPECT_CALL(*mock_app_, WindowIdExists(primary_widget_window_id))
+ .WillOnce(Return(true));
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] =
+ primary_widget_window_id;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_InvalidFunctionId_MessageNotSendToMobile) {
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+ command->on_event(event);
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::UI_DeleteWindow);
+ command->on_event(event);
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_RequestFailedOnHMISide_SendGenericErrorResponseToMobile) {
+ const auto result_code = mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+
+ Event event(hmi_apis::FunctionID::UI_DeleteWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_AllParametersCorrect_SendSuccessResponseToMobile) {
+ const auto result_code = mobile_apis::Result::SUCCESS;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, true),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(1);
+ EXPECT_CALL(*mock_app_, RemoveHMIState(kTestWindowId, _)).Times(1);
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ Event event(hmi_apis::FunctionID::UI_DeleteWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+} // namespace delete_window_request
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc
index bf689629b4..cf2634b37c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc
@@ -35,17 +35,17 @@
#include <vector>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
-#include "mobile/dial_number_request.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/smart_object_keys.h"
#include "interfaces/MOBILE_API.h"
+#include "mobile/dial_number_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -57,11 +57,11 @@ using ::testing::_;
using ::testing::Return;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::DialNumberRequest;
using am::event_engine::Event;
+using sdl_rpc_plugin::commands::DialNumberRequest;
namespace mobile_result = mobile_apis::Result;
-typedef SharedPtr<DialNumberRequest> DialNumberRequestPtr;
+typedef std::shared_ptr<DialNumberRequest> DialNumberRequestPtr;
namespace {
const uint32_t kConnectionKey = 2u;
@@ -131,56 +131,55 @@ TEST_F(DialNumberRequestTest, Run_SUCCESS) {
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::BasicCommunication_DialNumber)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::BasicCommunication_DialNumber),
+ _));
command->Run();
}
TEST_F(DialNumberRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
- // MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
- // (*command_msg)[am::strings::params][am::strings::connection_key] =
- // kConnectionKey;
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
- // DialNumberRequestPtr
- // command(CreateCommand<DialNumberRequest>(command_msg));
+ DialNumberRequestPtr command(CreateCommand<DialNumberRequest>(command_msg));
- // MockAppPtr app(CreateMockApp());
- // EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- // Event event(hmi_apis::FunctionID::INVALID_ENUM);
- // EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
- // command->on_event(event);
+ command->on_event(event);
}
TEST_F(DialNumberRequestTest, OnEvent_SUCCESS) {
- // MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
- // (*event_msg)[am::strings::params][am::hmi_response::code] =
- // mobile_apis::Result::SUCCESS;
- // (*event_msg)[am::strings::params][am::strings::info] = "test_info";
-
- // Event event(hmi_apis::FunctionID::BasicCommunication_DialNumber);
- // event.set_smart_object(*event_msg);
-
- // MockAppPtr app(CreateMockApp());
- // EXPECT_CALL(app_mngr_, application(kConnectionKey))
- // .WillRepeatedly(Return(app));
- // ON_CALL(app_mngr_,
- // GetRPCService()).WillByDefault(ReturnRef(mock_rpc_service_));
- // EXPECT_CALL(
- // mock_rpc_service_,
- // ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
- // _));
-
- // MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
- // (*command_msg)[am::strings::params][am::strings::connection_key] =
- // kConnectionKey;
-
- // DialNumberRequestPtr
- // command(CreateCommand<DialNumberRequest>(command_msg));
- // command->on_event(event);
+ MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*event_msg)[am::strings::params][am::hmi_response::code] =
+ mobile_apis::Result::SUCCESS;
+ (*event_msg)[am::strings::params][am::strings::info] = "test_info";
+
+ Event event(hmi_apis::FunctionID::BasicCommunication_DialNumber);
+ event.set_smart_object(*event_msg);
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(app));
+ ON_CALL(app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _));
+
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DialNumberRequestPtr command(CreateCommand<DialNumberRequest>(command_msg));
+ command->on_event(event);
}
} // namespace dial_number_request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
index a8afe4007f..8f83a2dd10 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
@@ -62,6 +62,8 @@
#include "mobile/end_audio_pass_thru_request.h"
#include "mobile/end_audio_pass_thru_response.h"
#include "mobile/generic_response.h"
+#include "mobile/get_file_request.h"
+#include "mobile/get_file_response.h"
#include "mobile/get_way_points_request.h"
#include "mobile/get_way_points_response.h"
#include "mobile/list_files_request.h"
@@ -78,6 +80,7 @@
#include "mobile/on_keyboard_input_notification.h"
#include "mobile/on_language_change_notification.h"
#include "mobile/on_permissions_change_notification.h"
+#include "mobile/on_system_capability_updated_notification.h"
#include "mobile/on_system_request_notification.h"
#include "mobile/on_tbt_client_state_notification.h"
#include "mobile/on_touch_event_notification.h"
@@ -128,8 +131,8 @@
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "test/application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "test/application_manager/mock_application_manager_settings.h"
namespace am = application_manager;
@@ -140,16 +143,16 @@ namespace mobile_commands_test {
namespace dummy_mobile_commands_test {
namespace commands = sdl_rpc_plugin::commands;
-using ::testing::_;
-using ::testing::NotNull;
-using ::testing::Types;
using am::commands::MessageSharedPtr;
-using ::test::components::event_engine_test::MockEventDispatcher;
+using ::application_manager::ApplicationSharedPtr;
+using ::test::components::application_manager_test::MockApplication;
using ::test::components::application_manager_test::MockApplicationManager;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
-using ::application_manager::ApplicationSharedPtr;
-using ::test::components::application_manager_test::MockApplication;
+using ::test::components::event_engine_test::MockEventDispatcher;
+using ::testing::_;
+using ::testing::NotNull;
+using ::testing::Types;
namespace {
const std::string kEmptyString_ = "";
@@ -220,6 +223,8 @@ typedef Types<commands::AddCommandRequest,
commands::EndAudioPassThruRequest,
commands::EndAudioPassThruResponse,
commands::GenericResponse,
+ commands::GetFileRequest,
+ commands::GetFileResponse,
commands::GetWayPointsRequest,
commands::GetWayPointsResponse,
commands::ListFilesRequest,
@@ -236,12 +241,13 @@ typedef Types<commands::AddCommandRequest,
commands::mobile::OnKeyBoardInputNotification,
commands::OnLanguageChangeNotification,
commands::OnPermissionsChangeNotification,
- commands::mobile::OnSystemRequestNotification,
- commands::OnTBTClientStateNotification,
- commands::mobile::OnTouchEventNotification>
+ commands::mobile::OnSystemCapabilityUpdatedNotification>
MobileCommandsListFirst;
-typedef Types<commands::OnWayPointChangeNotification,
+typedef Types<commands::mobile::OnSystemRequestNotification,
+ commands::OnTBTClientStateNotification,
+ commands::mobile::OnTouchEventNotification,
+ commands::OnWayPointChangeNotification,
commands::PerformAudioPassThruRequest,
commands::PerformAudioPassThruResponse,
commands::PerformInteractionRequest,
@@ -277,35 +283,37 @@ typedef Types<commands::OnWayPointChangeNotification,
commands::SubscribeWayPointsRequest,
commands::SubscribeWayPointsResponse,
commands::SystemResponse,
- commands::UnregisterAppInterfaceRequest,
- commands::UnregisterAppInterfaceResponse,
- commands::UnsubscribeButtonRequest,
- commands::UnsubscribeButtonResponse> MobileCommandsListSecond;
+ commands::UnregisterAppInterfaceRequest>
+ MobileCommandsListSecond;
-typedef Types<commands::UnSubscribeWayPointsRequest,
+typedef Types<commands::UnregisterAppInterfaceResponse,
+ commands::UnsubscribeButtonRequest,
+ commands::UnsubscribeButtonResponse,
+ commands::UnsubscribeWayPointsRequest,
commands::UnsubscribeWayPointsResponse,
commands::UpdateTurnListRequest,
- commands::UpdateTurnListResponse> MobileCommandsListThird;
+ commands::UpdateTurnListResponse>
+ MobileCommandsListThird;
TYPED_TEST_CASE(MobileCommandsTestFirst, MobileCommandsListFirst);
TYPED_TEST_CASE(MobileCommandsTestSecond, MobileCommandsListSecond);
TYPED_TEST_CASE(MobileCommandsTestThird, MobileCommandsListThird);
TYPED_TEST(MobileCommandsTestFirst, CtorAndDtorCall) {
- utils::SharedPtr<typename TestFixture::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(MobileCommandsTestSecond, CtorAndDtorCall) {
- utils::SharedPtr<typename TestFixture::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
TYPED_TEST(MobileCommandsTestThird, CtorAndDtorCall) {
- utils::SharedPtr<typename TestFixture::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
- UNUSED(command);
+ EXPECT_NE(command.use_count(), 0);
}
} // namespace dummy_mobile_commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc
index 567f46e4ea..ba09e0dabe 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc
@@ -36,14 +36,14 @@
#include "mobile/end_audio_pass_thru_request.h"
-#include "gtest/gtest.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -52,15 +52,15 @@ namespace mobile_commands_test {
namespace end_audio_pass_thru_request {
namespace am = ::application_manager;
+using am::MockMessageHelper;
+using am::commands::MessageSharedPtr;
+using am::event_engine::Event;
+using sdl_rpc_plugin::commands::EndAudioPassThruRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
-using am::commands::MessageSharedPtr;
-using sdl_rpc_plugin::commands::EndAudioPassThruRequest;
-using am::event_engine::Event;
-using am::MockMessageHelper;
-typedef SharedPtr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr;
+typedef std::shared_ptr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr;
class EndAudioPassThruRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc
new file mode 100644
index 0000000000..74c61410e8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc
@@ -0,0 +1,124 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "mobile/get_system_capability_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace get_system_capability_request_test {
+
+using sdl_rpc_plugin::commands::GetSystemCapabilityRequest;
+using ::testing::_;
+using ::testing::Return;
+typedef std::shared_ptr<GetSystemCapabilityRequest>
+ GetSystemCapabilityRequestPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kConnectionKey = 1u;
+}
+
+class GetSystemCapabilityRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void SetUp() OVERRIDE {
+ message_ = CreateMessage();
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+
+ command_ = CreateCommand<GetSystemCapabilityRequest>(message_);
+ mock_app_ = CreateMockApp();
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ }
+
+ GetSystemCapabilityRequestPtr command_;
+ MessageSharedPtr message_;
+ MockAppPtr mock_app_;
+};
+
+TEST_F(
+ GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_SendMessageToMobileWithSUCCESSResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities(
+ std::make_shared<smart_objects::SmartObject>());
+
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_CapabilitiesNotExistSendMessageToMobileWithDATA_NOT_AVAILABLEResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ EXPECT_CALL(*mock_app_, display_capabilities()).WillOnce(Return(nullptr));
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(nullptr));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_apis::Result::DATA_NOT_AVAILABLE),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace get_system_capability_request_test
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc
index 0239f3c7d7..7f7a8b55bd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc
@@ -31,19 +31,18 @@
*/
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
-#include "mobile/get_way_points_request.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
-#include "application_manager/mock_hmi_interface.h"
-#include "application_manager/mock_message_helper.h"
+#include "mobile/get_way_points_request.h"
namespace test {
namespace components {
@@ -52,13 +51,13 @@ namespace mobile_commands_test {
namespace get_way_points_request {
using namespace mobile_apis::Result;
-using ::testing::Return;
-using ::testing::_;
-using sdl_rpc_plugin::commands::GetWayPointsRequest;
-using application_manager::MockMessageHelper;
using application_manager::MockHmiInterfaces;
+using application_manager::MockMessageHelper;
+using sdl_rpc_plugin::commands::GetWayPointsRequest;
+using ::testing::_;
+using ::testing::Return;
-typedef SharedPtr<GetWayPointsRequest> CommandPtr;
+typedef std::shared_ptr<GetWayPointsRequest> CommandPtr;
typedef mobile_apis::Result::eType MobileResult;
typedef hmi_apis::Common_Result::eType HmiResult;
@@ -67,7 +66,7 @@ const uint32_t kCorrelationId = 2u;
const uint32_t kAppId = 3u;
const uint32_t kConnectionKey = kAppId;
const std::string kMethodName = "Navigation.GetWayPoints";
-}
+} // namespace
class GetWayPointsRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -75,7 +74,7 @@ class GetWayPointsRequestTest
GetWayPointsRequestTest() : mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
- message_ = utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map);
+ message_ = std::make_shared<SmartObject>(::smart_objects::SmartType_Map);
(*message_)[am::strings::msg_params] =
::smart_objects::SmartObject(::smart_objects::SmartType_Map);
@@ -85,7 +84,7 @@ class GetWayPointsRequestTest
MockAppPtr mock_app_;
MessageSharedPtr message_;
- utils::SharedPtr<GetWayPointsRequest> command_sptr_;
+ std::shared_ptr<GetWayPointsRequest> command_sptr_;
};
class GetWayPointsRequestOnEventTest
@@ -133,7 +132,7 @@ TEST_F(GetWayPointsRequestTest,
(*message_)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- utils::SharedPtr<am::Application> null_application_sptr;
+ std::shared_ptr<am::Application> null_application_sptr;
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(null_application_sptr));
@@ -205,7 +204,7 @@ TEST_F(GetWayPointsRequestTest, OnEvent_DefaultCase) {
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
CallOnEvent caller(*command_sptr_, event);
caller();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc
index f9fd31f99a..06ecc1116e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc
@@ -34,16 +34,16 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
-#include "mobile/list_files_request.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/smart_object_keys.h"
+#include "interfaces/MOBILE_API.h"
+#include "mobile/list_files_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -52,13 +52,18 @@ namespace mobile_commands_test {
namespace list_files_request {
using ::testing::_;
+using ::testing::DoAll;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::DoAll;
using ::testing::SaveArg;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::ListFilesRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::ListFilesRequest;
+
+namespace {
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
class ListFilesRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -69,10 +74,10 @@ class ListFilesRequestTest
};
TEST_F(ListFilesRequestTest, Run_AppNotRegistered_UNSUCCESS) {
- SharedPtr<ListFilesRequest> command(CreateCommand<ListFilesRequest>());
+ std::shared_ptr<ListFilesRequest> command(CreateCommand<ListFilesRequest>());
ON_CALL(app_mngr_, application(_))
- .WillByDefault(Return(SharedPtr<am::Application>()));
+ .WillByDefault(Return(std::shared_ptr<am::Application>()));
MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
@@ -83,10 +88,10 @@ TEST_F(ListFilesRequestTest, Run_AppNotRegistered_UNSUCCESS) {
TEST_F(ListFilesRequestTest, Run_TooManyHmiNone_UNSUCCESS) {
MockAppPtr app(CreateMockApp());
- SharedPtr<ListFilesRequest> command(CreateCommand<ListFilesRequest>());
+ std::shared_ptr<ListFilesRequest> command(CreateCommand<ListFilesRequest>());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
- ON_CALL(*app, hmi_level())
+ ON_CALL(*app, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_NONE));
const uint32_t kListFilesInNoneAllowed = 1u;
@@ -108,7 +113,7 @@ TEST_F(ListFilesRequestTest, Run_TooManyHmiNone_UNSUCCESS) {
TEST_F(ListFilesRequestTest, Run_SUCCESS) {
MockAppPtr app(CreateMockApp());
- SharedPtr<ListFilesRequest> command(CreateCommand<ListFilesRequest>());
+ std::shared_ptr<ListFilesRequest> command(CreateCommand<ListFilesRequest>());
EXPECT_CALL(app_mngr_, get_settings())
.WillRepeatedly(ReturnRef(app_mngr_settings_));
@@ -121,7 +126,7 @@ TEST_F(ListFilesRequestTest, Run_SUCCESS) {
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
- ON_CALL(*app, hmi_level())
+ ON_CALL(*app, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
ON_CALL(*app, increment_list_files_in_none_count()).WillByDefault(Return());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
index d2e86f0103..aa48e8916b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
@@ -33,17 +33,16 @@
#include <stdint.h>
#include <string>
+#include "application_manager/smart_object_keys.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/commands/command_impl.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "mobile/on_button_event_notification.h"
#include "mobile/on_button_press_notification.h"
@@ -55,19 +54,19 @@ namespace on_button_notification {
namespace am = ::application_manager;
namespace commands = am::commands;
+using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::mobile::OnButtonEventNotification;
using sdl_rpc_plugin::commands::mobile::OnButtonPressNotification;
using ::testing::_;
-using ::testing::Types;
using ::testing::Return;
-
-using ::utils::SharedPtr;
-using am::commands::MessageSharedPtr;
+using ::testing::Types;
namespace {
const uint32_t kAppId = 5u;
const uint32_t kCustomButtonId = 3u;
const mobile_apis::ButtonName::eType kButtonName = mobile_apis::ButtonName::OK;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
template <class NotificationT,
@@ -131,7 +130,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest,
(*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
mobile_apis::ButtonName::CUSTOM_BUTTON;
- SharedPtr<Notification> command(
+ std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
command->Run();
@@ -148,7 +147,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest,
mobile_apis::ButtonName::CUSTOM_BUTTON;
(*notification_msg)[am::strings::msg_params][am::strings::app_id] = kAppId;
- SharedPtr<Notification> command(
+ std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
@@ -170,7 +169,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest,
(*notification_msg)[am::strings::msg_params]
[am::hmi_response::custom_button_id] = kCustomButtonId;
- SharedPtr<Notification> command(
+ std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
EXPECT_CALL(this->app_mngr_, application(kAppId))
@@ -192,7 +191,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest,
(*notification_msg)[am::strings::msg_params]
[am::hmi_response::custom_button_id] = kCustomButtonId;
- SharedPtr<Notification> command(
+ std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
@@ -216,11 +215,11 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) {
(*notification_msg)[am::strings::msg_params]
[am::hmi_response::custom_button_id] = kCustomButtonId;
- SharedPtr<Notification> command(
+ std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
- ON_CALL(*mock_app, hmi_level())
+ ON_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
@@ -232,6 +231,35 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) {
command->Run();
}
+TYPED_TEST(OnButtonNotificationCommandsTest,
+ Run_CustomButton_SUCCESS_BACKGROUND) {
+ typedef typename TestFixture::Notification Notification;
+
+ MessageSharedPtr notification_msg(
+ this->CreateMessage(smart_objects::SmartType_Map));
+
+ (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::CUSTOM_BUTTON;
+ (*notification_msg)[am::strings::msg_params][am::strings::app_id] = kAppId;
+ (*notification_msg)[am::strings::msg_params]
+ [am::hmi_response::custom_button_id] = kCustomButtonId;
+
+ std::shared_ptr<Notification> command(
+ this->template CreateCommand<Notification>(notification_msg));
+
+ typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
+ ON_CALL(*mock_app, hmi_level(kDefaultWindowId))
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
+ EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
+ .WillOnce(Return(true));
+ EXPECT_CALL(this->mock_rpc_service_,
+ SendMessageToMobile(
+ CheckNotificationMessage(TestFixture::kFunctionId), _));
+
+ command->Run();
+}
+
TYPED_TEST(OnButtonNotificationCommandsTest, Run_NoSubscribedApps_UNSUCCESS) {
typedef typename TestFixture::Notification Notification;
@@ -241,7 +269,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_NoSubscribedApps_UNSUCCESS) {
(*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
kButtonName;
- SharedPtr<Notification> command(
+ std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
const std::vector<ApplicationSharedPtr> empty_subscribed_apps_list;
@@ -260,14 +288,14 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_InvalidHmiLevel_UNSUCCESS) {
(*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
kButtonName;
- SharedPtr<Notification> command(
+ std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
std::vector<ApplicationSharedPtr> subscribed_apps_list;
subscribed_apps_list.push_back(mock_app);
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
@@ -286,14 +314,14 @@ TYPED_TEST(OnButtonNotificationCommandsTest,
(*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
kButtonName;
- SharedPtr<Notification> command(
+ std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
std::vector<ApplicationSharedPtr> subscribed_apps_list;
subscribed_apps_list.push_back(mock_app);
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED));
EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
@@ -312,14 +340,14 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_SUCCESS) {
(*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
kButtonName;
- SharedPtr<Notification> command(
+ std::shared_ptr<Notification> command(
this->template CreateCommand<Notification>(notification_msg));
typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
std::vector<ApplicationSharedPtr> subscribed_apps_list;
subscribed_apps_list.push_back(mock_app);
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
ON_CALL(*mock_app, IsFullscreen()).WillByDefault(Return(true));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc
index 9e12303f23..1356b1c5fa 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc
@@ -34,12 +34,12 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
+
#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
#include "mobile/on_command_notification.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -55,7 +55,7 @@ using ::testing::Return;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::OnCommandNotification;
-typedef ::utils::SharedPtr<OnCommandNotification> CommandPtr;
+typedef std::shared_ptr<OnCommandNotification> CommandPtr;
namespace {
const uint32_t kAppId = 1u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc
index 86df3cdab6..15faa5c13f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc
@@ -32,12 +32,12 @@
#include <string>
-#include "gtest/gtest.h"
-#include "mobile/on_hash_change_notification.h"
+#include "application_manager/commands/command_impl.h"
#include "application_manager/mock_message_helper.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/command_impl.h"
#include "application_manager/test/include/application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
+#include "mobile/on_hash_change_notification.h"
namespace test {
namespace components {
@@ -47,13 +47,13 @@ namespace on_hash_change_notification {
namespace strings = application_manager::strings;
-using sdl_rpc_plugin::commands::mobile::OnHashChangeNotification;
using application_manager::MockMessageHelper;
using application_manager::commands::CommandImpl;
+using sdl_rpc_plugin::commands::mobile::OnHashChangeNotification;
+using testing::_;
using testing::Mock;
using testing::Return;
using testing::ReturnRef;
-using testing::_;
class OnHashChangeNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {};
@@ -63,7 +63,7 @@ TEST_F(OnHashChangeNotificationTest, Run_ValidApp_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
- SharedPtr<OnHashChangeNotification> command =
+ std::shared_ptr<OnHashChangeNotification> command =
CreateCommand<OnHashChangeNotification>(msg);
std::string return_string = "1234";
@@ -93,7 +93,7 @@ TEST_F(OnHashChangeNotificationTest, Run_InvalidApp_NoNotification) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
- SharedPtr<OnHashChangeNotification> command =
+ std::shared_ptr<OnHashChangeNotification> command =
CreateCommand<OnHashChangeNotification>(msg);
std::string return_string;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
index 43e01c5a3d..528f1d8618 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "mobile/on_hmi_status_notification_from_mobile.h"
-#include "application_manager/commands/commands_test.h"
#include <application_manager/smart_object_keys.h>
-#include "application_manager/message.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/message.h"
#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -51,12 +51,12 @@ const connection_handler::DeviceHandle kHandle = 2u;
namespace strings = application_manager::strings;
-using sdl_rpc_plugin::commands::OnHMIStatusNotificationFromMobile;
-using protocol_handler::MajorProtocolVersion;
using application_manager::ApplicationSet;
+using protocol_handler::MajorProtocolVersion;
+using sdl_rpc_plugin::commands::OnHMIStatusNotificationFromMobile;
+using testing::_;
using testing::Mock;
using testing::Return;
-using testing::_;
class OnHMIStatusNotificationFromMobileTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
@@ -78,7 +78,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
Run_CurrentStateForeground_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
- SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ std::shared_ptr<OnHMIStatusNotificationFromMobile> command =
CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
MockAppPtr mock_app = CreateMockApp();
@@ -106,7 +106,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
TEST_F(OnHMIStatusNotificationFromMobileTest, Run_InvalidApp_NoNotification) {
MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
- SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ std::shared_ptr<OnHMIStatusNotificationFromMobile> command =
CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
MockAppPtr mock_app = CreateMockApp();
@@ -132,7 +132,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
Run_CurrentStateNotForeground_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND);
- SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ std::shared_ptr<OnHMIStatusNotificationFromMobile> command =
CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
MockAppPtr mock_app = CreateMockApp();
@@ -161,7 +161,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
Run_ProtocolVersionKV3_NoNotification) {
MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND);
- SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ std::shared_ptr<OnHMIStatusNotificationFromMobile> command =
CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
MockAppPtr mock_app = CreateMockApp();
@@ -190,7 +190,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
Run_AppNotRequestedBeforeAndKV3_NoNotification) {
MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
- SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ std::shared_ptr<OnHMIStatusNotificationFromMobile> command =
CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
MockAppPtr mock_app = CreateMockApp();
@@ -218,7 +218,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
Run_AppNotRequestedBefore_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
- SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ std::shared_ptr<OnHMIStatusNotificationFromMobile> command =
CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
MockAppPtr mock_app = CreateMockApp();
@@ -249,7 +249,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
Run_AnotherForegroundSDLApp_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
- SharedPtr<OnHMIStatusNotificationFromMobile> command =
+ std::shared_ptr<OnHMIStatusNotificationFromMobile> command =
CreateCommand<OnHMIStatusNotificationFromMobile>(msg);
MockAppPtr mock_app = CreateMockApp();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc
index 034fff73d7..5bf68414e5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc
@@ -30,11 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "mobile/on_hmi_status_notification.h"
-#include "application_manager/test/include/application_manager/commands/commands_test.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/commands/command_impl.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/test/include/application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -47,13 +47,13 @@ const uint32_t kConnectionKey = 1u;
} // namespace
namespace strings = application_manager::strings;
-using sdl_rpc_plugin::commands::OnHMIStatusNotification;
-using protocol_handler::MajorProtocolVersion;
using application_manager::MockMessageHelper;
using application_manager::commands::CommandImpl;
+using protocol_handler::MajorProtocolVersion;
+using sdl_rpc_plugin::commands::OnHMIStatusNotification;
+using testing::_;
using testing::Mock;
using testing::Return;
-using testing::_;
class OnHMIStatusNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
@@ -85,7 +85,7 @@ class OnHMIStatusNotificationTest
TEST_F(OnHMIStatusNotificationTest, Run_InvalidApp_NoNotification) {
MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
- SharedPtr<OnHMIStatusNotification> command =
+ std::shared_ptr<OnHMIStatusNotification> command =
CreateCommand<OnHMIStatusNotification>(msg);
MockAppPtr mock_app = CreateMockApp();
@@ -104,7 +104,7 @@ TEST_F(OnHMIStatusNotificationTest, Run_InvalidApp_NoNotification) {
TEST_F(OnHMIStatusNotificationTest, Run_InvalidEnum_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::INVALID_ENUM);
- SharedPtr<OnHMIStatusNotification> command =
+ std::shared_ptr<OnHMIStatusNotification> command =
CreateCommand<OnHMIStatusNotification>(msg);
MockAppPtr mock_app = CreateMockApp();
@@ -118,49 +118,10 @@ TEST_F(OnHMIStatusNotificationTest, Run_InvalidEnum_SUCCESS) {
VerifySendNotificationData(msg);
}
-TEST_F(OnHMIStatusNotificationTest, Run_BackgroundAndFalseProperties_SUCCESS) {
- MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND);
- SetSendNotificationExpectations(msg);
-
- SharedPtr<OnHMIStatusNotification> command =
- CreateCommand<OnHMIStatusNotification>(msg);
-
- MockAppPtr mock_app = CreateMockApp();
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app));
-
- EXPECT_CALL(*mock_app, tts_properties_in_none()).WillOnce(Return(false));
- EXPECT_CALL(*mock_app, set_tts_properties_in_none(true));
- EXPECT_CALL(mock_message_helper_, SendTTSGlobalProperties(_, false, _));
-
- command->Run();
-
- VerifySendNotificationData(msg);
-}
-
-TEST_F(OnHMIStatusNotificationTest, Run_BackgroundAndTrueProperties_SUCCESS) {
- MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND);
-
- SharedPtr<OnHMIStatusNotification> command =
- CreateCommand<OnHMIStatusNotification>(msg);
-
- MockAppPtr mock_app = CreateMockApp();
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app));
-
- EXPECT_CALL(*mock_app, tts_properties_in_none()).WillOnce(Return(true));
-
- SetSendNotificationExpectations(msg);
-
- command->Run();
-
- VerifySendNotificationData(msg);
-}
-
TEST_F(OnHMIStatusNotificationTest, Run_FullAndFalseProperties_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
- SharedPtr<OnHMIStatusNotification> command =
+ std::shared_ptr<OnHMIStatusNotification> command =
CreateCommand<OnHMIStatusNotification>(msg);
MockAppPtr mock_app = CreateMockApp();
@@ -182,7 +143,7 @@ TEST_F(OnHMIStatusNotificationTest, Run_FullAndFalseProperties_SUCCESS) {
TEST_F(OnHMIStatusNotificationTest, Run_FullAndTrueProperties_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL);
- SharedPtr<OnHMIStatusNotification> command =
+ std::shared_ptr<OnHMIStatusNotification> command =
CreateCommand<OnHMIStatusNotification>(msg);
MockAppPtr mock_app = CreateMockApp();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc
index ebfc2256ac..b7b827bb4c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "mobile/on_keyboard_input_notification.h"
-#include "application_manager/commands/commands_test.h"
#include <application_manager/smart_object_keys.h>
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/message.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/commands/command_impl.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -48,15 +48,17 @@ namespace strings = application_manager::strings;
namespace {
const uint32_t kConnectionKey = 1u;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
-using sdl_rpc_plugin::commands::mobile::OnKeyBoardInputNotification;
+using application_manager::ApplicationSet;
using application_manager::MockMessageHelper;
using application_manager::commands::CommandImpl;
-using application_manager::ApplicationSet;
+using sdl_rpc_plugin::commands::mobile::OnKeyBoardInputNotification;
+using testing::_;
using testing::Mock;
using testing::Return;
-using testing::_;
class OnKeyBoardInputNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
@@ -79,8 +81,8 @@ class OnKeyBoardInputNotificationTest
(*msg)[strings::params][strings::protocol_version].asInt());
}
- MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) {
- app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set);
+ MockAppPtr InitAppSetDataAccessor(std::shared_ptr<ApplicationSet>& app_set) {
+ app_set = (!app_set ? std::make_shared<ApplicationSet>() : app_set);
MockAppPtr app(CreateMockApp());
app_set->insert(app);
EXPECT_CALL(app_mngr_, applications())
@@ -88,21 +90,21 @@ class OnKeyBoardInputNotificationTest
return app;
}
- SharedPtr<ApplicationSet> app_set_;
+ std::shared_ptr<ApplicationSet> app_set_;
std::shared_ptr<sync_primitives::Lock> lock_;
};
TEST_F(OnKeyBoardInputNotificationTest, Run_ActionActive_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<OnKeyBoardInputNotification> command =
+ std::shared_ptr<OnKeyBoardInputNotification> command =
CreateCommand<OnKeyBoardInputNotification>(msg);
MockAppPtr mock_app(InitAppSetDataAccessor(app_set_));
EXPECT_CALL(*mock_app, is_perform_interaction_active()).WillOnce(Return(1));
EXPECT_CALL(*mock_app, perform_interaction_layout())
.WillOnce(Return(mobile_apis::LayoutMode::KEYBOARD));
- EXPECT_CALL(*mock_app, hmi_level()).Times(0);
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)).Times(0);
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kConnectionKey));
@@ -119,14 +121,14 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_ActionActive_SUCCESS) {
TEST_F(OnKeyBoardInputNotificationTest, Run_ActionNotActive_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<OnKeyBoardInputNotification> command =
+ std::shared_ptr<OnKeyBoardInputNotification> command =
CreateCommand<OnKeyBoardInputNotification>(msg);
MockAppPtr mock_app(InitAppSetDataAccessor(app_set_));
EXPECT_CALL(*mock_app, is_perform_interaction_active())
.WillRepeatedly(Return(0));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::eType::HMI_FULL));
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kConnectionKey));
@@ -144,14 +146,14 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_ActionNotActive_SUCCESS) {
TEST_F(OnKeyBoardInputNotificationTest, Run_InvalidApp_NoNotification) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<OnKeyBoardInputNotification> command =
+ std::shared_ptr<OnKeyBoardInputNotification> command =
CreateCommand<OnKeyBoardInputNotification>(msg);
MockAppPtr mock_app(InitAppSetDataAccessor(app_set_));
EXPECT_CALL(*mock_app, is_perform_interaction_active())
.WillRepeatedly(Return(0));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::eType::HMI_BACKGROUND));
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
new file mode 100644
index 0000000000..349ada66a2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "mobile/on_system_capability_updated_notification.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/display_capabilities_builder.h"
+#include "gtest/gtest.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace on_system_capability_updated_notification {
+
+using sdl_rpc_plugin::commands::mobile::OnSystemCapabilityUpdatedNotification;
+using ::testing::_;
+using ::testing::Return;
+
+typedef std::shared_ptr<OnSystemCapabilityUpdatedNotification>
+ OnSystemCapabilityUpdatedNotificationPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kConnectionKey = 1u;
+const uint32_t kAppId = 2u;
+} // namespace
+
+MATCHER_P(CheckDisplayCapabilities, display_capabilities, "") {
+ return *display_capabilities ==
+ (*arg)[strings::msg_params][strings::system_capability]
+ [strings::display_capabilities];
+}
+
+class OnSystemCapabilityUpdatedNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void SetUp() OVERRIDE {
+ message_ = CreateMessage();
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+
+ command_ = CreateCommand<OnSystemCapabilityUpdatedNotification>(message_);
+ mock_app_ = CreateMockApp();
+ }
+
+ OnSystemCapabilityUpdatedNotificationPtr command_;
+ MockAppPtr mock_app_;
+ MessageSharedPtr message_;
+};
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppExistSubscribedToNotification_SystemDisplayCapabilitiesSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+
+ std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
+ system_capability_app_extension(
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_));
+ system_capability_app_extension->SubscribeTo(
+ mobile_apis::SystemCapabilityType::DISPLAYS);
+ application_manager::ApplicationSet apps({mock_app_});
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, display_capabilities()).WillByDefault(Return(nullptr));
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+ application_manager::DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ SendMessageToMobile(CheckDisplayCapabilities(system_display_capabilities),
+ false));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppExistConnectionKeyNotEqualWithAppId_SystemDisplayCapabilitiesNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+
+ std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
+ system_capability_app_extension(
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_));
+ system_capability_app_extension->SubscribeTo(
+ mobile_apis::SystemCapabilityType::DISPLAYS);
+ application_manager::ApplicationSet apps({mock_app_});
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app_, display_capabilities()).WillByDefault(Return(nullptr));
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppExistNotSubscribedToNotification_SystemDisplayCapabilitiesNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+
+ std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
+ system_capability_app_extension(
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_));
+
+ application_manager::ApplicationSet apps({mock_app_});
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, display_capabilities()).WillByDefault(Return(nullptr));
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppDataEmpty_SystemDisplayCapabilitiesUpdatedNotificationNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ application_manager::ApplicationSet apps;
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace on_system_capability_updated_notification
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
index d6e1b2fe52..ffa7203f1f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
@@ -32,14 +32,13 @@
#include <string>
-#include "gtest/gtest.h"
-#include "mobile/on_system_request_notification.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_impl.h"
+#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
+#include "mobile/on_system_request_notification.h"
namespace test {
namespace components {
@@ -49,20 +48,21 @@ namespace on_system_request_notification {
namespace strings = application_manager::strings;
-using sdl_rpc_plugin::commands::mobile::OnSystemRequestNotification;
-using application_manager::commands::CommandImpl;
using application_manager::MockMessageHelper;
+using application_manager::commands::CommandImpl;
+using sdl_rpc_plugin::commands::mobile::OnSystemRequestNotification;
using test::components::policy_test::MockPolicyHandlerInterface;
using namespace mobile_apis;
-using testing::SaveArg;
+using testing::_;
using testing::Mock;
using testing::Return;
using testing::ReturnRef;
-using testing::_;
+using testing::SaveArg;
namespace {
const uint32_t kConnectionKey = 1u;
const std::string kPolicyAppId = "fake-app-id";
+const connection_handler::DeviceHandle kDeviceId = 1u;
} // namespace
class OnSystemRequestNotificationTest
@@ -74,6 +74,7 @@ class OnSystemRequestNotificationTest
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
+ ON_CALL(*mock_app_, device()).WillByDefault(Return(kDeviceId));
}
protected:
@@ -88,15 +89,17 @@ TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
(*msg)[strings::msg_params][strings::request_type] = request_type;
- SharedPtr<OnSystemRequestNotification> command =
+ std::shared_ptr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
+ PreConditions();
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId));
EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kPolicyAppId, request_type))
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillRepeatedly(Return(true));
#ifdef PROPRIETARY_MODE
@@ -128,13 +131,16 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) {
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
(*msg)[strings::msg_params][strings::request_type] = request_type;
- SharedPtr<OnSystemRequestNotification> command =
+ std::shared_ptr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
+ PreConditions();
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId));
- EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _))
+ EXPECT_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(true));
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
@@ -162,13 +168,13 @@ TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) {
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
(*msg)[strings::msg_params][strings::request_type] = request_type;
- SharedPtr<OnSystemRequestNotification> command =
+ std::shared_ptr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(MockAppPtr()));
EXPECT_CALL(*mock_app_, policy_app_id()).Times(0);
- EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _)).Times(0);
+ EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _, _)).Times(0);
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
@@ -185,13 +191,16 @@ TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) {
(*msg)[strings::params][strings::connection_key] = kConnectionKey;
(*msg)[strings::msg_params][strings::request_type] = request_type;
- SharedPtr<OnSystemRequestNotification> command =
+ std::shared_ptr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
+ PreConditions();
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId));
- EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _))
+ EXPECT_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(false));
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
@@ -215,7 +224,7 @@ TEST_F(
PreConditions();
EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kPolicyAppId, request_type))
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
IsRequestSubTypeAllowed(kPolicyAppId, request_subtype))
@@ -242,7 +251,7 @@ TEST_F(OnSystemRequestNotificationTest,
PreConditions();
EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kPolicyAppId, request_type))
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
IsRequestSubTypeAllowed(kPolicyAppId, request_subtype))
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc
index 14939a433d..c43dea76e1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc
@@ -35,11 +35,11 @@
#include "gtest/gtest.h"
#include "mobile/on_tbt_client_state_notification.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
+
#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
#include "utils/helpers.h"
namespace test {
@@ -56,10 +56,12 @@ using ::testing::Return;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::OnTBTClientStateNotification;
-typedef ::utils::SharedPtr<OnTBTClientStateNotification> NotificationPtr;
+typedef std::shared_ptr<OnTBTClientStateNotification> NotificationPtr;
namespace {
const uint32_t kAppId = 1u;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class OnTBTClientStateNotificationTest
@@ -79,7 +81,7 @@ TEST_F(OnTBTClientStateNotificationTest, Run_HmiLevelNone_UNSUCCESS) {
EXPECT_CALL(app_mngr_, applications_with_navi())
.WillOnce(Return(applications_with_navi));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(*mock_app, app_id()).Times(0);
@@ -122,7 +124,7 @@ TEST_F(OnTBTClientStateNotificationTest,
EXPECT_CALL(app_mngr_, applications_with_navi())
.WillOnce(Return(applications_with_navi));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc
index 4576637d8d..95020328b4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc
@@ -35,11 +35,11 @@
#include "gtest/gtest.h"
#include "mobile/on_touch_event_notification.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
+
#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
#include "utils/helpers.h"
namespace test {
@@ -56,7 +56,7 @@ using ::testing::Return;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::mobile::OnTouchEventNotification;
-typedef ::utils::SharedPtr<OnTouchEventNotification> NotificationPtr;
+typedef std::shared_ptr<OnTouchEventNotification> NotificationPtr;
namespace {
const uint32_t kAppId = 1u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
index e0b7ab3b38..83958954cd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc
@@ -35,11 +35,11 @@
#include "gtest/gtest.h"
#include "mobile/on_way_point_change_notification.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
+
#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
#include "utils/helpers.h"
namespace test {
@@ -56,7 +56,7 @@ using ::testing::Return;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::OnWayPointChangeNotification;
-typedef ::utils::SharedPtr<OnWayPointChangeNotification> NotificationPtr;
+typedef std::shared_ptr<OnWayPointChangeNotification> NotificationPtr;
namespace {
const uint32_t kAppId = 1u;
@@ -98,7 +98,7 @@ MATCHER(CheckMessageData, "") {
TEST_F(OnWayPointChangeNotificationTest,
Run_NotEmptyListOfAppsSubscribedForWayPoints_SUCCESS) {
- std::set<int32_t> apps_subscribed_for_way_points;
+ std::set<uint32_t> apps_subscribed_for_way_points;
apps_subscribed_for_way_points.insert(kAppId);
EXPECT_CALL(app_mngr_, GetAppsSubscribedForWayPoints())
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
index f06a642e3b..2915418d43 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
@@ -31,18 +31,18 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/perform_audio_pass_thru_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -51,15 +51,14 @@ namespace mobile_commands_test {
namespace perform_audio_pass_thru_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::PerformAudioPassThruRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
-using ::utils::SharedPtr;
+using sdl_rpc_plugin::commands::PerformAudioPassThruRequest;
using ::testing::_;
+using ::testing::InSequence;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::InSequence;
namespace {
const int32_t kCommandId = 1;
@@ -73,6 +72,8 @@ const std::string kCorrectDisplayText1 = "CorrectDisplayText1";
const std::string kCorrectDisplayText2 = "CorrectDisplayText2";
const std::string kFunctionId = "FunctionId";
const uint32_t kTimeoutForTTSSpeak = 1u;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class PerformAudioPassThruRequestTest
@@ -80,7 +81,7 @@ class PerformAudioPassThruRequestTest
public:
PerformAudioPassThruRequestTest()
: mock_app_(CreateMockApp())
- , message_(utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map))
+ , message_(std::make_shared<SmartObject>(::smart_objects::SmartType_Map))
, msg_params_((*message_)[am::strings::msg_params]) {}
MessageSharedPtr CreateFullParamsUISO() {
@@ -110,7 +111,7 @@ class PerformAudioPassThruRequestTest
msg_params_[field] = "prompt\\n";
}
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
CallRun caller(*command_sptr_);
@@ -151,7 +152,7 @@ class PerformAudioPassThruRequestTest
MockAppPtr mock_app_;
MessageSharedPtr message_;
::smart_objects::SmartObject& msg_params_;
- utils::SharedPtr<PerformAudioPassThruRequest> command_sptr_;
+ std::shared_ptr<PerformAudioPassThruRequest> command_sptr_;
MockAppPtr application_sptr_;
};
@@ -162,10 +163,10 @@ TEST_F(PerformAudioPassThruRequestTest, OnTimeout_GENERIC_ERROR) {
(*msg_ui)[am::strings::msg_params][am::strings::success] = false;
MessageSharedPtr message =
- utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map);
+ std::make_shared<SmartObject>(::smart_objects::SmartType_Map);
(*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
- utils::SharedPtr<PerformAudioPassThruRequest> command =
+ std::shared_ptr<PerformAudioPassThruRequest> command =
CreateCommand<PerformAudioPassThruRequest>(message);
uint32_t app_id = kConnectionKey;
@@ -207,9 +208,9 @@ TEST_F(PerformAudioPassThruRequestTest,
(*mobile_request)[am::strings::msg_params][am::strings::initial_prompt] =
initial_prompt;
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
- utils::SharedPtr<PerformAudioPassThruRequest> command =
+ std::shared_ptr<PerformAudioPassThruRequest> command =
CreateCommand<PerformAudioPassThruRequest>(mobile_request);
ON_CALL(mock_hmi_interfaces_,
@@ -240,7 +241,7 @@ TEST_F(PerformAudioPassThruRequestTest,
MessageSharedPtr response_to_mobile;
uint32_t app_id = kConnectionKey;
EXPECT_CALL(app_mngr_, EndAudioPassThru(app_id)).WillOnce(Return(false));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillRepeatedly(Return(true));
EXPECT_CALL(
mock_rpc_service_,
@@ -251,7 +252,8 @@ TEST_F(PerformAudioPassThruRequestTest,
VerifyTtsFiles((*mobile_request)[am::strings::msg_params]
[am::strings::initial_prompt],
_,
- _)).WillOnce(Return(mobile_apis::Result::SUCCESS));
+ _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
command->Run();
command->on_event(event_tts);
@@ -271,7 +273,7 @@ TEST_F(PerformAudioPassThruRequestTest,
TEST_F(PerformAudioPassThruRequestTest,
Run_InvalidApp_ApplicationNotRegisteredResponce) {
- utils::SharedPtr<am::Application> null_application_sptr;
+ std::shared_ptr<am::Application> null_application_sptr;
EXPECT_CALL(app_mngr_, application(_))
.WillOnce(Return(null_application_sptr));
@@ -286,7 +288,7 @@ TEST_F(PerformAudioPassThruRequestTest,
}
TEST_F(PerformAudioPassThruRequestTest, Run_HmiLevelNone_Rejected) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_NONE));
CallRun caller(*command_sptr_);
@@ -319,7 +321,7 @@ TEST_F(PerformAudioPassThruRequestTest,
// First we need to call SendSpeakRequest()
// to enable the "is_active_tts_speak" key
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
@@ -343,7 +345,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
// Perform audio path thru request sending
@@ -356,7 +358,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
}
CallRun run_caller(*command_sptr_);
@@ -407,7 +409,7 @@ TEST_F(PerformAudioPassThruRequestTest,
TEST_F(PerformAudioPassThruRequestTest,
Run_InitPromptCorrect_SpeakAndPerformAPTRequestsSendMuteTrue) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
@@ -432,7 +434,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
// Perform audio path thru request sending
@@ -445,7 +447,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
}
CallRun caller(*command_sptr_);
@@ -464,10 +466,12 @@ TEST_F(PerformAudioPassThruRequestTest,
.asString();
const std::string result_display_text_1 =
perform_msg_params[am::hmi_request::audio_pass_display_texts][0]
- [am::hmi_request::field_text].asString();
+ [am::hmi_request::field_text]
+ .asString();
const std::string result_display_text_2 =
perform_msg_params[am::hmi_request::audio_pass_display_texts][1]
- [am::hmi_request::field_text].asString();
+ [am::hmi_request::field_text]
+ .asString();
EXPECT_EQ(kCorrectPrompt, result_initial_prompt);
EXPECT_EQ(kCorrectType, result_prompt_type);
@@ -479,7 +483,7 @@ TEST_F(PerformAudioPassThruRequestTest,
TEST_F(PerformAudioPassThruRequestTest,
Run_InitPromptCorrect_SpeakAndPerformAPTRequestsSendMuteFalse) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
@@ -506,7 +510,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
// Perform audio path thru request sending
@@ -519,7 +523,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
}
CallRun caller(*command_sptr_);
@@ -534,7 +538,7 @@ TEST_F(PerformAudioPassThruRequestTest,
TEST_F(
PerformAudioPassThruRequestTest,
Run_InitPromptEmpty_PerformAndRecordStartNotificationsAndStartRecording) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
MessageSharedPtr start_record_result_msg;
@@ -552,7 +556,7 @@ TEST_F(
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
// Perform audio path thru request sending
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
// Perform audio path thru request sending
@@ -565,7 +569,7 @@ TEST_F(
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
// Start recording notification sending
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&start_record_result_msg), Return(true)));
}
@@ -580,7 +584,8 @@ TEST_F(
const hmi_apis::FunctionID::eType start_record_result_function_id =
static_cast<hmi_apis::FunctionID::eType>(
(*start_record_result_msg)[am::strings::params]
- [am::strings::function_id].asInt());
+ [am::strings::function_id]
+ .asInt());
EXPECT_EQ(hmi_apis::FunctionID::UI_OnRecordStart,
start_record_result_function_id);
}
@@ -614,7 +619,7 @@ TEST_F(PerformAudioPassThruRequestTest,
// Start recording notification sending
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
// Start microphone recording cals
uint32_t app_id = kConnectionKey;
@@ -677,7 +682,7 @@ TEST_F(PerformAudioPassThruRequestTest,
msg_params_[am::strings::function_id] = kFunctionId;
msg_params_[am::strings::correlation_id] = kCorrelationId;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
uint32_t app_id = kConnectionKey;
EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id)).WillOnce(Return(true));
@@ -704,7 +709,7 @@ TEST_F(PerformAudioPassThruRequestTest,
msg_params_[am::strings::function_id] = kFunctionId;
uint32_t app_id = kConnectionKey;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id)).WillOnce(Return(true));
EXPECT_CALL(
@@ -752,7 +757,7 @@ TEST_F(PerformAudioPassThruRequestTest,
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
command_sptr_->SendResponse(true, am::mobile_api::Result::SUCCESS);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
command_sptr_->onTimeOut();
}
@@ -763,7 +768,7 @@ TEST_F(PerformAudioPassThruRequestTest,
EXPECT_CALL(app_mngr_, EndAudioPassThru(app_id)).WillOnce(Return(true));
EXPECT_CALL(app_mngr_, StopAudioPassThru(_));
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
@@ -784,7 +789,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
// Perform audio path thru request sending
@@ -797,7 +802,7 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
@@ -808,7 +813,7 @@ TEST_F(PerformAudioPassThruRequestTest,
// For setting is_active_tts_speak -> true
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.Times(2)
.WillRepeatedly(Return(false));
CallRun caller(*command_sptr_);
@@ -820,9 +825,9 @@ TEST_F(PerformAudioPassThruRequestTest,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL));
command_sptr_->SendResponse(true, am::mobile_api::Result::SUCCESS);
- EXPECT_CALL(
- mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _))
.WillOnce(Return(false));
command_sptr_->onTimeOut();
@@ -832,4 +837,4 @@ TEST_F(PerformAudioPassThruRequestTest,
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
index 2ffe9195b6..193229eeb0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc
@@ -31,24 +31,22 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/perform_interaction_request.h"
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "utils/helpers.h"
-#include "utils/make_shared.h"
-#include "smart_objects/smart_object.h"
-#include "utils/custom_string.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
+#include "utils/helpers.h"
namespace test {
namespace components {
@@ -57,51 +55,122 @@ namespace mobile_commands_test {
namespace perform_interaction_request {
namespace am = application_manager;
-using am::commands::CommandImpl;
using am::ApplicationManager;
-using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::PerformInteractionRequest;
+using ::test::components::application_manager_test::MockApplication;
using ::testing::_;
-using ::utils::SharedPtr;
using ::testing::Return;
using ::testing::ReturnRef;
-using sdl_rpc_plugin::commands::PerformInteractionRequest;
-using ::test::components::application_manager_test::MockApplication;
namespace strings = ::application_manager::strings;
namespace hmi_response = ::application_manager::hmi_response;
namespace {
+const int32_t kCorrelationId = 1u;
const int32_t kCommandId = 1;
const uint32_t kCmdId = 1u;
const uint32_t kConnectionKey = 2u;
+const int32_t kUiChoiceID = 1u;
+const int32_t kVrChoiceID = 2u;
+const int32_t kInvalidChoiceId = -1;
} // namespace
class PerformInteractionRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- PerformInteractionRequestTest() : mock_app_(CreateMockApp()) {}
+ PerformInteractionRequestTest()
+ : mock_app_(CreateMockApp())
+ , performinteraction_choice_set_lock_ptr_(
+ std::make_shared<sync_primitives::RecursiveLock>()) {}
void SetUp() OVERRIDE {
+ smart_objects::SmartObject choice_set1(
+ smart_objects::SmartType::SmartType_Map);
+ smart_objects::SmartObject choice_set2(
+ smart_objects::SmartType::SmartType_Map);
+
+ choice_set1[strings::choice_set] =
+ smart_objects::SmartType::SmartType_Array;
+ choice_set2[strings::choice_set] =
+ smart_objects::SmartType::SmartType_Array;
+
+ choice_set1[strings::choice_set][0][strings::choice_id] = kUiChoiceID;
+ choice_set2[strings::choice_set][0][strings::choice_id] = kVrChoiceID;
+
+ choice_set_map_[kCorrelationId].insert(std::make_pair(
+ kUiChoiceID, new smart_objects::SmartObject(choice_set1)));
+ choice_set_map_[kCorrelationId].insert(std::make_pair(
+ kVrChoiceID, new smart_objects::SmartObject(choice_set2)));
+
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, performinteraction_choice_set_map())
+ .WillByDefault(Return(DataAccessor<app_mngr::PerformChoiceSetMap>(
+ choice_set_map_, performinteraction_choice_set_lock_ptr_)));
}
void ResultCommandExpectations(MessageSharedPtr msg,
+ bool success,
+ hmi_apis::Common_Result::eType result_code,
const std::string& info) {
- EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
- true);
+ EXPECT_EQ((*msg)[strings::msg_params][strings::success].asBool(), success);
+ EXPECT_EQ((*msg)[strings::msg_params][strings::result_code].asInt(),
+ static_cast<int32_t>(result_code));
+ EXPECT_EQ((*msg)[strings::msg_params][strings::info].asString(), info);
+ }
+
+ void HMIRequestExpectations(MessageSharedPtr msg,
+ hmi_apis::FunctionID::eType function_id,
+ const std::string& method_name) {
+ EXPECT_EQ((*msg)[strings::params][strings::function_id].asInt(),
+ static_cast<int32_t>(function_id));
EXPECT_EQ(
- (*msg)[am::strings::msg_params][am::strings::result_code].asInt(),
- static_cast<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));
- EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::info].asString(),
- info);
+ (*msg)[strings::msg_params][am::hmi_request::method_name].asString(),
+ method_name);
+ }
+
+ MessageSharedPtr CreateRequestMessage(
+ const mobile_apis::InteractionMode::eType& interaction_mode) {
+ MessageSharedPtr request_msg = CreateMessage(smart_objects::SmartType_Map);
+ (*request_msg)[strings::params][strings::connection_key] = kConnectionKey;
+ (*request_msg)[strings::params][strings::correlation_id] = kCorrelationId;
+ (*request_msg)[strings::msg_params][strings::interaction_mode] =
+ interaction_mode;
+ return request_msg;
+ }
+
+ MessageSharedPtr CreateHMIResponseMessage(
+ const hmi_apis::Common_Result::eType& response_code,
+ const std::string& message_info,
+ const int32_t command_id = kCommandId) {
+ MessageSharedPtr response_msg = CreateMessage(smart_objects::SmartType_Map);
+ (*response_msg)[strings::params][hmi_response::code] = response_code;
+ (*response_msg)[strings::msg_params][strings::cmd_id] = command_id;
+ (*response_msg)[strings::msg_params][strings::info] = message_info;
+ return response_msg;
+ }
+
+ MessageSharedPtr CreateHMIResponseMessageWithChoiceID(
+ const hmi_apis::Common_Result::eType& response_code,
+ const std::string& message_info,
+ const int32_t choice_id,
+ const int32_t command_id = kCommandId) {
+ MessageSharedPtr response_msg =
+ CreateHMIResponseMessage(response_code, message_info, kCommandId);
+ (*response_msg)[strings::msg_params][strings::choice_id] = choice_id;
+ return response_msg;
}
sync_primitives::Lock lock_;
MockAppPtr mock_app_;
+ app_mngr::PerformChoiceSetMap choice_set_map_;
+ mutable std::shared_ptr<sync_primitives::RecursiveLock>
+ performinteraction_choice_set_lock_ptr_;
};
TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) {
@@ -113,7 +182,7 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) {
MessageSharedPtr request_msg = CreateMessage(smart_objects::SmartType_Map);
(*request_msg)[strings::msg_params][strings::interaction_mode] =
mobile_apis::InteractionMode::BOTH;
- utils::SharedPtr<PerformInteractionRequest> command =
+ std::shared_ptr<PerformInteractionRequest> command =
CreateCommand<PerformInteractionRequest>(request_msg);
MockAppPtr mock_app;
@@ -150,35 +219,101 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) {
}
TEST_F(PerformInteractionRequestTest,
+ OnEvent_BOTHMode_UIChoiceIdReceivedFirst) {
+ MessageSharedPtr msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(
+ hmi_apis::Common_Result::SUCCESS, "", kInvalidChoiceId);
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui = CreateHMIResponseMessageWithChoiceID(
+ hmi_apis::Common_Result::SUCCESS, "", kUiChoiceID);
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ command->on_event(event_ui);
+ command->on_event(event_vr);
+
+ EXPECT_EQ(
+ kUiChoiceID,
+ (*response_to_mobile)[strings::msg_params][strings::choice_id].asInt());
+}
+
+TEST_F(PerformInteractionRequestTest,
+ OnEvent_BOTHMode_VRChoiceIdReceivedFirst) {
+ MessageSharedPtr msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MessageSharedPtr response_msg_vr = CreateHMIResponseMessageWithChoiceID(
+ hmi_apis::Common_Result::SUCCESS, "", kVrChoiceID);
+ MessageSharedPtr response_msg_ui = CreateHMIResponseMessageWithChoiceID(
+ hmi_apis::Common_Result::SUCCESS, "", kInvalidChoiceId);
+
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+
+ command->on_event(event_vr);
+ EXPECT_EQ(hmi_apis::FunctionID::UI_ClosePopUp,
+ (*request_to_hmi)[strings::params][strings::function_id].asInt());
+
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+ command->on_event(event_ui);
+
+ EXPECT_EQ(
+ kVrChoiceID,
+ (*response_to_mobile)[strings::msg_params][strings::choice_id].asInt());
+}
+
+TEST_F(PerformInteractionRequestTest,
OnEvent_VRHmiSendSuccess_UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_from_mobile =
- CreateMessage(smart_objects::SmartType_Map);
- (*msg_from_mobile)[strings::params][strings::connection_key] = kConnectionKey;
- (*msg_from_mobile)[strings::msg_params][strings::interaction_mode] =
- mobile_apis::InteractionMode::VR_ONLY;
- utils::SharedPtr<PerformInteractionRequest> command =
+ CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
+ std::shared_ptr<PerformInteractionRequest> command =
CreateCommand<PerformInteractionRequest>(msg_from_mobile);
- command->Init();
+
+ ASSERT_TRUE(command->Init());
MockAppPtr mock_app;
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app));
MessageSharedPtr response_msg_vr =
- CreateMessage(smart_objects::SmartType_Map);
- (*response_msg_vr)[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
- (*response_msg_vr)[strings::msg_params][strings::cmd_id] = kCommandId;
- (*response_msg_vr)[am::strings::msg_params][am::strings::info] =
- "VR is not supported by system";
-
+ CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "VR is not supported by system");
am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
event_vr.set_smart_object(*response_msg_vr);
MessageSharedPtr response_msg_ui =
- CreateMessage(smart_objects::SmartType_Map);
- (*response_msg_ui)[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::SUCCESS;
-
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
event_ui.set_smart_object(*response_msg_ui);
@@ -200,65 +335,335 @@ TEST_F(PerformInteractionRequestTest,
command->on_event(event_ui);
ResultCommandExpectations(response_to_mobile,
+ false,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
"VR is not supported by system");
}
TEST_F(PerformInteractionRequestTest,
OnEvent_UIHmiSendSuccess_UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_from_mobile =
- CreateMessage(smart_objects::SmartType_Map);
- (*msg_from_mobile)[strings::params][strings::connection_key] = kConnectionKey;
- (*msg_from_mobile)[strings::msg_params][strings::interaction_mode] =
- mobile_apis::InteractionMode::VR_ONLY;
- utils::SharedPtr<PerformInteractionRequest> command =
+ CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
+ std::shared_ptr<PerformInteractionRequest> command =
CreateCommand<PerformInteractionRequest>(msg_from_mobile);
- ON_CALL(mock_hmi_interfaces_,
- GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ ASSERT_TRUE(command->Init());
+
+ MockAppPtr mock_app;
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app));
+
+ MessageSharedPtr response_msg_vr =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "UI is not supported by system");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ ResultCommandExpectations(response_to_mobile,
+ true,
+ hmi_apis::Common_Result::SUCCESS,
+ "UI is not supported by system");
+}
+
+TEST_F(
+ PerformInteractionRequestTest,
+ PrepareResultCodeAndResponseForMobile_GetVRResultCodeOnly_InVR_OnlyMode_SUCCESS) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- ON_CALL(mock_hmi_interfaces_,
- GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
+
+ MessageSharedPtr msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MockAppPtr mock_app;
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app));
+
+ MessageSharedPtr response_msg_vr =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "VR is not supported by system");
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ ResultCommandExpectations(response_to_mobile,
+ false,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "VR is not supported by system");
+}
+
+TEST_F(
+ PerformInteractionRequestTest,
+ PrepareResultCodeAndResponseForMobile_GetVR_ErrorInfoAndCode_InBOTH_Mode_With_UI_success_result_code) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ auto msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
MessageSharedPtr response_msg_vr =
- CreateMessage(smart_objects::SmartType_Map);
- (*response_msg_vr)[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::SUCCESS;
+ CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "VR is not supported by system");
am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
event_vr.set_smart_object(*response_msg_vr);
MessageSharedPtr response_msg_ui =
- CreateMessage(smart_objects::SmartType_Map);
- (*response_msg_ui)[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
- (*response_msg_ui)[strings::msg_params][strings::cmd_id] = kCommandId;
- (*response_msg_ui)[am::strings::msg_params][am::strings::info] =
- "UI is not supported by system";
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+
+ command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ HMIRequestExpectations(request_to_hmi,
+ hmi_apis::FunctionID::UI_ClosePopUp,
+ "UI.PerformInteraction");
+
+ ResultCommandExpectations(response_to_mobile,
+ true,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "VR is not supported by system");
+}
+
+TEST_F(
+ PerformInteractionRequestTest,
+ PrepareResultCodeAndResponseForMobile_Send_GENERIC_ERROR_To_Mobile_When_different_valid_choice_ids_received_in_BOTH_mode_SUCCESS) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ MessageSharedPtr msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MessageSharedPtr response_msg_vr = CreateHMIResponseMessageWithChoiceID(
+ hmi_apis::Common_Result::SUCCESS, "", kVrChoiceID);
+ MessageSharedPtr response_msg_ui = CreateHMIResponseMessageWithChoiceID(
+ hmi_apis::Common_Result::SUCCESS, "", kUiChoiceID);
+
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
event_ui.set_smart_object(*response_msg_ui);
MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+ command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ HMIRequestExpectations(request_to_hmi,
+ hmi_apis::FunctionID::UI_ClosePopUp,
+ "UI.PerformInteraction");
+
+ ResultCommandExpectations(response_to_mobile,
+ false,
+ hmi_apis::Common_Result::GENERIC_ERROR,
+ "Received two different choice IDs");
+}
+
+TEST_F(
+ PerformInteractionRequestTest,
+ VR_response_WARNINGS_UI_response_SUCCESS_MobileResponseContains_true_WARNINGS_warnings_info) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ auto msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(
+ hmi_apis::Common_Result::WARNINGS, "WARNING MESSAGE");
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+
+ command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ HMIRequestExpectations(request_to_hmi,
+ hmi_apis::FunctionID::UI_ClosePopUp,
+ "UI.PerformInteraction");
+
+ ResultCommandExpectations(response_to_mobile,
+ true,
+ hmi_apis::Common_Result::WARNINGS,
+ "WARNING MESSAGE");
+}
+
+TEST_F(
+ PerformInteractionRequestTest,
+ VR_response_SUCCESS_UI_response_WARNINGS_MobileResponseContains_true_WARNINGS_warnings_info) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ auto msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
+
+ ASSERT_TRUE(command->Init());
+
+ MessageSharedPtr response_msg_vr =
+ CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, "");
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui = CreateHMIResponseMessage(
+ hmi_apis::Common_Result::WARNINGS, "WARNING MESSAGE");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+
command->on_event(event_vr);
+ command->on_event(event_ui);
+
+ HMIRequestExpectations(request_to_hmi,
+ hmi_apis::FunctionID::UI_ClosePopUp,
+ "UI.PerformInteraction");
+
+ ResultCommandExpectations(response_to_mobile,
+ true,
+ hmi_apis::Common_Result::WARNINGS,
+ "WARNING MESSAGE");
+}
+
+TEST_F(
+ PerformInteractionRequestTest,
+ VR_response_UNSUPPORTED_RESOURCE_UI_response_WARNINGS_MobileResponseContains_false_UNSUPPORTED_RESOURSE_error_info) {
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ auto msg_from_mobile =
+ CreateRequestMessage(mobile_apis::InteractionMode::BOTH);
+ std::shared_ptr<PerformInteractionRequest> command =
+ CreateCommand<PerformInteractionRequest>(msg_from_mobile);
- EXPECT_CALL(*mock_app_, is_perform_interaction_active())
- .WillOnce(Return(false));
- EXPECT_CALL(*mock_app_, DeletePerformInteractionChoiceSet(_));
+ ASSERT_TRUE(command->Init());
+ MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, "VR error message");
+ am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction);
+ event_vr.set_smart_object(*response_msg_vr);
+
+ MessageSharedPtr response_msg_ui = CreateHMIResponseMessage(
+ hmi_apis::Common_Result::WARNINGS, "UI warning message");
+ am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
+ event_ui.set_smart_object(*response_msg_ui);
+
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+
+ MessageSharedPtr request_to_hmi;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true)));
+
+ command->on_event(event_vr);
command->on_event(event_ui);
+ HMIRequestExpectations(request_to_hmi,
+ hmi_apis::FunctionID::UI_ClosePopUp,
+ "UI.PerformInteraction");
+
ResultCommandExpectations(response_to_mobile,
- "UI is not supported by system");
+ true,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ "UI warning message, VR error message");
}
} // namespace perform_interaction_request
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
index c5feeeba25..8db533f446 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
@@ -36,19 +36,18 @@
#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
-#include "mobile/put_file_response.h"
#include "mobile/put_file_request.h"
+#include "mobile/put_file_response.h"
-#include "utils/make_shared.h"
-#include "utils/file_system.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/MOBILE_API.h"
#include "application_manager/application.h"
#include "application_manager/mock_application.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+#include "utils/file_system.h"
namespace test {
namespace components {
@@ -57,19 +56,19 @@ namespace mobile_commands_test {
namespace put_file {
using ::testing::_;
+using ::testing::AtLeast;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::AtLeast;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::PutFileRequest;
-using sdl_rpc_plugin::commands::PutFileResponse;
using am::commands::MessageSharedPtr;
using policy_test::MockPolicyHandlerInterface;
+using sdl_rpc_plugin::commands::PutFileRequest;
+using sdl_rpc_plugin::commands::PutFileResponse;
-typedef SharedPtr<PutFileRequest> PutFileRequestPtr;
-typedef SharedPtr<PutFileResponse> PutFileResponsePtr;
+typedef std::shared_ptr<PutFileRequest> PutFileRequestPtr;
+typedef std::shared_ptr<PutFileResponse> PutFileResponsePtr;
namespace {
const uint32_t kConnectionKey = 1u;
@@ -79,7 +78,9 @@ const int64_t kZeroOffset = 0u;
const std::string kStorageFolder = "./storage";
const std::string kFolder = "folder";
const std::string kAppFolder = "app_folder";
-}
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+} // namespace
class PutFileRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -100,7 +101,7 @@ class PutFileRequestTest
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
- ON_CALL(*mock_app_, hmi_level())
+ ON_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
}
@@ -131,7 +132,7 @@ class PutFileResponceTest : public CommandsTest<CommandsTestMocks::kIsNice> {
}
MessageSharedPtr message_;
- SharedPtr<PutFileResponse> command_sptr_;
+ std::shared_ptr<PutFileResponse> command_sptr_;
};
TEST_F(PutFileResponceTest, Run_InvalidApp_ApplicationNotRegisteredResponce) {
@@ -140,7 +141,7 @@ TEST_F(PutFileResponceTest, Run_InvalidApp_ApplicationNotRegisteredResponce) {
message_ref[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- utils::SharedPtr<am::Application> null_application_sptr;
+ std::shared_ptr<am::Application> null_application_sptr;
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(null_application_sptr));
EXPECT_CALL(
@@ -158,8 +159,8 @@ TEST_F(PutFileResponceTest, Run_ApplicationRegistered_Success) {
kConnectionKey;
message_ref[am::strings::msg_params][am::strings::success] = true;
- utils::SharedPtr<am::Application> application_sptr =
- utils::MakeShared<MockApplication>();
+ std::shared_ptr<am::Application> application_sptr =
+ std::make_shared<MockApplication>();
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(application_sptr));
@@ -180,7 +181,7 @@ TEST_F(PutFileRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
}
TEST_F(PutFileRequestTest, Run_HmiLevelNone_UNSUCCESS) {
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
const uint32_t settings_put_file_in_none = 1u;
@@ -316,9 +317,11 @@ TEST_F(PutFileRequestTest, Run_SendOnPutFileNotification_SUCCESS) {
EXPECT_CALL(app_mngr_,
SaveBinary(binary_data_, kStorageFolder, kFileName, kZeroOffset))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::BasicCommunication_OnPutFile)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::BasicCommunication_OnPutFile),
+ _))
.WillOnce(Return(true));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::SUCCESS);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
index 8b21ceff17..6376570106 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
@@ -34,28 +34,28 @@
#include <string>
#include <vector>
-#include "gtest/gtest.h"
-#include "mobile/register_app_interface_request.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_helper.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "protocol_handler/mock_session_observer.h"
-#include "connection_handler/mock_connection_handler.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/mock_resume_ctrl.h"
#include "application_manager/mock_hmi_interface.h"
-#include "utils/data_accessor.h"
+#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+#include "mobile/register_app_interface_request.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "smart_objects/smart_object.h"
#include "utils/custom_string.h"
+#include "utils/data_accessor.h"
#include "utils/lock.h"
#include "utils/macro.h"
+#include "utils/semantic_version.h"
namespace test {
namespace components {
@@ -64,26 +64,35 @@ namespace mobile_commands_test {
namespace register_app_interface_request {
using ::testing::_;
+using ::testing::DoAll;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::DoAll;
+using ::testing::SaveArg;
+using ::testing::SetArgPointee;
namespace am = ::application_manager;
-using ::utils::SharedPtr;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::RegisterAppInterfaceRequest;
namespace {
const uint32_t kConnectionKey = 1u;
+const uint32_t kConnectionKey2 = 2u;
+const connection_handler::DeviceHandle kDeviceHandle = 3u;
const hmi_apis::Common_Language::eType kHmiLanguage =
hmi_apis::Common_Language::EN_US;
const mobile_apis::Language::eType kMobileLanguage =
mobile_apis::Language::EN_US;
-const std::string kMacAddress = "test_mac_address";
-const std::string kAppId = "test_app_id";
+const mobile_apis::HybridAppPreference::eType kHybridAppPreference =
+ mobile_apis::HybridAppPreference::INVALID_ENUM;
+const std::string kMacAddress1 = "test_mac_address1";
+const std::string kMacAddress2 = "test_mac_address2";
+const std::string kAppId1 = "test_app1_id";
+const std::string kAppId2 = "test_app2_id";
+const std::string kFullAppId = "test_app_id_long";
const std::string kDummyString = "test_string";
const std::vector<uint32_t> kDummyDiagModes;
+const utils::SemanticVersion mock_semantic_version(1, 0, 0);
} // namespace
class RegisterAppInterfaceRequestTest
@@ -93,7 +102,9 @@ class RegisterAppInterfaceRequestTest
: msg_(CreateMessage())
, command_(CreateCommand<RegisterAppInterfaceRequest>(msg_))
, app_name_("test_app_name_")
+ , app2_name_("test_app2_name_")
, lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , pending_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, mock_application_helper_(
application_manager_test::MockApplicationHelper::
application_helper_mock()) {
@@ -111,22 +122,34 @@ class RegisterAppInterfaceRequestTest
void InitBasicMessage() {
(*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey;
- (*msg_)[am::strings::msg_params][am::strings::app_id] = kAppId;
+ (*msg_)[am::strings::msg_params][am::strings::app_id] = kAppId1;
+ (*msg_)[am::strings::msg_params][am::strings::full_app_id] = kFullAppId;
(*msg_)[am::strings::msg_params][am::strings::app_name] = app_name_;
(*msg_)[am::strings::msg_params][am::strings::language_desired] =
kHmiLanguage;
(*msg_)[am::strings::msg_params]
[am::strings::hmi_display_language_desired] = kHmiLanguage;
+ (*msg_)[am::strings::msg_params][am::strings::sync_msg_version]
+ [am::strings::major_version] = 4;
+ (*msg_)[am::strings::msg_params][am::strings::sync_msg_version]
+ [am::strings::minor_version] = 0;
+ (*msg_)[am::strings::msg_params][am::strings::sync_msg_version]
+ [am::strings::patch_version] = 0;
}
MockAppPtr CreateBasicMockedApp() {
MockAppPtr mock_app = CreateMockApp();
ON_CALL(*mock_app, name()).WillByDefault(ReturnRef(app_name_));
- ON_CALL(*mock_app, mac_address()).WillByDefault(ReturnRef(kMacAddress));
+ ON_CALL(*mock_app, mac_address()).WillByDefault(ReturnRef(kMacAddress1));
ON_CALL(*mock_app, app_icon_path()).WillByDefault(ReturnRef(kDummyString));
ON_CALL(*mock_app, language()).WillByDefault(ReturnRef(kMobileLanguage));
ON_CALL(*mock_app, ui_language()).WillByDefault(ReturnRef(kMobileLanguage));
- ON_CALL(*mock_app, policy_app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(false));
+ ON_CALL(*mock_app, hybrid_app_preference())
+ .WillByDefault(ReturnRef(kHybridAppPreference));
+ ON_CALL(*mock_app, policy_app_id()).WillByDefault(Return(kAppId1));
+ ON_CALL(*mock_app, msg_version())
+ .WillByDefault(ReturnRef(mock_semantic_version));
return mock_app;
}
@@ -143,6 +166,8 @@ class RegisterAppInterfaceRequestTest
}
void InitGetters() {
+ ON_CALL(app_mngr_, GetCorrectMobileIDFromMessage(msg_))
+ .WillByDefault(Return(kAppId1));
ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(true));
ON_CALL(app_mngr_, resume_controller())
.WillByDefault(ReturnRef(mock_resume_crt_));
@@ -154,9 +179,31 @@ class RegisterAppInterfaceRequestTest
.WillByDefault(ReturnRef(kDummyString));
ON_CALL(mock_hmi_capabilities_, ccpu_version())
.WillByDefault(ReturnRef(kDummyString));
+ ON_CALL(mock_hmi_capabilities_, speech_capabilities())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
+ ON_CALL(mock_hmi_capabilities_, prerecorded_speech())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
+ ON_CALL(mock_hmi_capabilities_, vr_capabilities())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
+ ON_CALL(mock_hmi_capabilities_, display_capabilities())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
+ ON_CALL(mock_hmi_capabilities_, audio_pass_thru_capabilities())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
+ ON_CALL(mock_hmi_capabilities_, vehicle_type())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
+ ON_CALL(mock_hmi_capabilities_, button_capabilities())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
+ ON_CALL(mock_hmi_capabilities_, soft_button_capabilities())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
+ ON_CALL(mock_hmi_capabilities_, preset_bank_capabilities())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
+ ON_CALL(mock_hmi_capabilities_, hmi_zone_capabilities())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
+ ON_CALL(mock_hmi_capabilities_, pcm_stream_capabilities())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
ON_CALL(app_mngr_settings_, supported_diag_modes())
.WillByDefault(ReturnRef(kDummyDiagModes));
- ON_CALL(mock_policy_handler_, GetAppRequestTypes(_))
+ ON_CALL(mock_policy_handler_, GetAppRequestTypes(_, _))
.WillByDefault(Return(std::vector<std::string>()));
ON_CALL(mock_policy_handler_, GetAppRequestTypeState(_))
.WillByDefault(Return(policy::RequestType::State::EMPTY));
@@ -168,9 +215,11 @@ class RegisterAppInterfaceRequestTest
.WillByDefault(Return(policy::DeviceConsent::kDeviceAllowed));
ON_CALL(app_mngr_, GetDeviceTransportType(_))
.WillByDefault(Return(hmi_apis::Common_TransportType::WIFI));
- ON_CALL(app_mngr_, IsAppInReconnectMode(_)).WillByDefault(Return(false));
+ ON_CALL(app_mngr_, IsAppInReconnectMode(_, _)).WillByDefault(Return(false));
ON_CALL(app_mngr_, application_by_policy_id(_))
.WillByDefault(Return(ApplicationSharedPtr()));
+ ON_CALL(app_mngr_, pending_application_by_policy_id(_))
+ .WillByDefault(Return(ApplicationSharedPtr()));
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
ON_CALL(
@@ -189,47 +238,60 @@ class RegisterAppInterfaceRequestTest
void SetCommonExpectionsOnSwitchedApplication(
MockAppPtr mock_app, mobile_apis::Result::eType response_result_code) {
- EXPECT_CALL(mock_policy_handler_, AddApplication(_, _)).Times(0);
+ EXPECT_CALL(mock_policy_handler_, AddApplication(_, _, _)).Times(0);
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(response_result_code), _));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::BasicCommunication_OnAppRegistered)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
+ _))
.Times(0);
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Buttons_OnButtonSubscription)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _))
.Times(0);
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_ChangeRegistration))).Times(0);
-
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_ChangeRegistration))).Times(0);
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), _))
+ .Times(0);
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::VR_ChangeRegistration))).Times(0);
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration), _))
+ .Times(0);
EXPECT_CALL(
- app_mngr_,
- OnApplicationSwitched(
- MockAppPtr::static_pointer_cast<application_manager::Application>(
- mock_app)));
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), _))
+ .Times(0);
+
+ EXPECT_CALL(app_mngr_,
+ OnApplicationSwitched(
+ std::static_pointer_cast<application_manager::Application>(
+ mock_app)));
}
MessageSharedPtr msg_;
- SharedPtr<RegisterAppInterfaceRequest> command_;
+ std::shared_ptr<RegisterAppInterfaceRequest> command_;
const utils::custom_string::CustomString app_name_;
+ const utils::custom_string::CustomString app2_name_;
std::shared_ptr<sync_primitives::Lock> lock_ptr_;
am::ApplicationSet app_set_;
+ std::shared_ptr<sync_primitives::Lock> pending_lock_ptr_;
+ am::AppsWaitRegistrationSet pending_app_set_;
typedef IsNiceMock<policy_test::MockPolicyHandlerInterface,
kMocksAreNice>::Result MockPolicyHandlerInterface;
@@ -258,7 +320,7 @@ TEST_F(RegisterAppInterfaceRequestTest, Init_SUCCESS) {
TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
InitBasicMessage();
- (*msg_)[am::strings::msg_params][am::strings::hash_id] = kAppId;
+ (*msg_)[am::strings::msg_params][am::strings::hash_id] = kAppId1;
EXPECT_CALL(app_mngr_, IsStopping())
.WillOnce(Return(false))
.WillOnce(Return(true))
@@ -267,34 +329,56 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false));
+ connection_handler::DeviceHandle handle = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(handle), Return(0)));
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(handle, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(ApplicationSharedPtr()))
- .WillRepeatedly(Return(mock_app));
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(ApplicationSharedPtr()));
+ EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillRepeatedly(Return(ApplicationSharedPtr()));
ON_CALL(app_mngr_, applications())
.WillByDefault(
Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
+ ON_CALL(app_mngr_, pending_applications())
+ .WillByDefault(Return(DataAccessor<am::AppsWaitRegistrationSet>(
+ pending_app_set_, pending_lock_ptr_)));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
- ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId, _, _))
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
.WillByDefault(Return(true));
policy::StatusNotifier notify_upd_manager =
- utils::MakeShared<utils::CallNothing>();
- ON_CALL(mock_policy_handler_, AddApplication(_, _))
+ std::make_shared<utils::CallNothing>();
+ ON_CALL(mock_policy_handler_, AddApplication(kMacAddress1, kAppId1, _))
.WillByDefault(Return(notify_upd_manager));
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app));
+
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::BasicCommunication_OnAppRegistered)))
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
+ _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Buttons_OnButtonSubscription)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _))
.WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.Times(2);
+ EXPECT_CALL(app_mngr_, SendDriverDistractionState(_));
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -332,10 +416,21 @@ TEST_F(RegisterAppInterfaceRequestTest,
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false));
+ connection_handler::DeviceHandle handle = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(handle), Return(0)));
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(_, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
MockAppPtr mock_app = CreateBasicMockedApp();
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(ApplicationSharedPtr()));
+ EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillRepeatedly(Return(ApplicationSharedPtr()));
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(ApplicationSharedPtr()))
- .WillRepeatedly(Return(mock_app));
+ .WillOnce(Return(mock_app));
MessageSharedPtr expected_message =
CreateMessage(smart_objects::SmartType_Map);
@@ -359,25 +454,33 @@ TEST_F(RegisterAppInterfaceRequestTest,
"test_templates_available";
display_capabilities[am::hmi_response::screen_params] = "test_screen_params";
+ auto vehicle_type_ptr = std::make_shared<smart_objects::SmartObject>(
+ (*expected_message)[am::hmi_response::vehicle_type]);
ON_CALL(mock_hmi_capabilities_, vehicle_type())
- .WillByDefault(
- Return(&(*expected_message)[am::hmi_response::vehicle_type]));
+ .WillByDefault(Return(vehicle_type_ptr));
+
+ auto vr_capabilities_ptr = std::make_shared<smart_objects::SmartObject>(
+ (*expected_message)[am::strings::vr_capabilities]);
ON_CALL(mock_hmi_capabilities_, vr_capabilities())
- .WillByDefault(
- Return(&(*expected_message)[am::strings::vr_capabilities]));
+ .WillByDefault(Return(vr_capabilities_ptr));
+
+ auto display_capabilities_ptr = std::make_shared<smart_objects::SmartObject>(
+ (*expected_message)[am::hmi_response::display_capabilities]);
ON_CALL(mock_hmi_capabilities_, display_capabilities())
- .WillByDefault(
- Return(&(*expected_message)[am::hmi_response::display_capabilities]));
+ .WillByDefault(Return(display_capabilities_ptr));
ON_CALL(app_mngr_, applications())
.WillByDefault(
Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
+ ON_CALL(app_mngr_, pending_applications())
+ .WillByDefault(Return(DataAccessor<am::AppsWaitRegistrationSet>(
+ pending_app_set_, pending_lock_ptr_)));
ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
- ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId, _, _))
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
.WillByDefault(Return(true));
policy::StatusNotifier notify_upd_manager =
- utils::MakeShared<utils::CallNothing>();
- ON_CALL(mock_policy_handler_, AddApplication(_, _))
+ std::make_shared<utils::CallNothing>();
+ ON_CALL(mock_policy_handler_, AddApplication(kMacAddress1, kAppId1, _))
.WillByDefault(Return(notify_upd_manager));
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app));
@@ -386,29 +489,37 @@ TEST_F(RegisterAppInterfaceRequestTest,
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::BasicCommunication_OnAppRegistered)))
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
+ _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Buttons_OnButtonSubscription)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_ChangeRegistration)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration), _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), _))
.WillOnce(Return(true));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.Times(2);
-
+ EXPECT_CALL(app_mngr_, SendDriverDistractionState(_));
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -420,10 +531,19 @@ TEST_F(RegisterAppInterfaceRequestTest,
(*msg_)[am::strings::msg_params][am::strings::hash_id] = request_hash_id;
MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
- .WillRepeatedly(Return(mock_app));
+ app_set_.insert(mock_app);
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(mock_app));
+
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
+
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
- EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kDeviceHandle));
EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
@@ -432,9 +552,9 @@ TEST_F(RegisterAppInterfaceRequestTest,
EXPECT_CALL(
mock_resume_crt_,
CheckApplicationHash(
- MockAppPtr::static_pointer_cast<application_manager::Application>(
- mock_app),
- request_hash_id)).WillOnce(Return(true));
+ std::static_pointer_cast<application_manager::Application>(mock_app),
+ request_hash_id))
+ .WillOnce(Return(true));
EXPECT_CALL(mock_resume_crt_, RemoveApplicationFromSaved(_)).Times(0);
@@ -446,6 +566,7 @@ TEST_F(RegisterAppInterfaceRequestTest,
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::SUCCESS);
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -456,26 +577,32 @@ TEST_F(RegisterAppInterfaceRequestTest,
const std::string request_hash_id = "abc123";
(*msg_)[am::strings::msg_params][am::strings::hash_id] = request_hash_id;
- MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
- .WillRepeatedly(Return(mock_app));
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
- EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kDeviceHandle));
EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
EXPECT_CALL(
mock_resume_crt_,
CheckApplicationHash(
- MockAppPtr::static_pointer_cast<application_manager::Application>(
- mock_app),
- request_hash_id)).WillOnce(Return(false));
+ std::static_pointer_cast<application_manager::Application>(mock_app),
+ request_hash_id))
+ .WillOnce(Return(false));
EXPECT_CALL(
mock_application_helper_,
RecallApplicationData(
- MockAppPtr::static_pointer_cast<application_manager::Application>(
- mock_app),
+ std::static_pointer_cast<application_manager::Application>(mock_app),
_));
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).Times(0);
@@ -485,7 +612,7 @@ TEST_F(RegisterAppInterfaceRequestTest,
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::RESUME_FAILED);
-
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -493,19 +620,25 @@ TEST_F(RegisterAppInterfaceRequestTest,
SwitchApplication_NoHash_ExpectCleanupResumeFailed) {
InitBasicMessage();
- MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
- .WillRepeatedly(Return(mock_app));
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
- EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, device()).WillOnce(Return(kDeviceHandle));
EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
EXPECT_CALL(
mock_application_helper_,
RecallApplicationData(
- MockAppPtr::static_pointer_cast<application_manager::Application>(
- mock_app),
+ std::static_pointer_cast<application_manager::Application>(mock_app),
_));
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).Times(0);
@@ -516,6 +649,143 @@ TEST_F(RegisterAppInterfaceRequestTest,
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::RESUME_FAILED);
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ RegisterApp_SameAppId_SameDeviceFailed) {
+ using namespace am;
+
+ InitBasicMessage();
+
+ MockAppPtr mock_app1 = CreateBasicMockedApp();
+
+ app_set_.insert(mock_app1);
+ ON_CALL(app_mngr_, applications())
+ .WillByDefault(
+ Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
+ ON_CALL(app_mngr_, pending_applications())
+ .WillByDefault(Return(DataAccessor<am::AppsWaitRegistrationSet>(
+ pending_app_set_, pending_lock_ptr_)));
+
+ MockAppPtr mock_app2 = CreateBasicMockedApp();
+
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
+
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(ApplicationSharedPtr()));
+ EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillOnce(Return(mock_app1));
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(
+ mobile_apis::Result::APPLICATION_REGISTERED_ALREADY),
+ am::commands::Command::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ RegisterApp_SameAppId_DifferentDevicesSuccess) {
+ MockAppPtr mock_app1 = CreateBasicMockedApp();
+ const connection_handler::DeviceHandle device_id1 = 1u;
+ ON_CALL(*mock_app1, device()).WillByDefault(Return(device_id1));
+ app_set_.insert(mock_app1);
+ ON_CALL(app_mngr_, applications())
+ .WillByDefault(
+ Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
+ ON_CALL(app_mngr_, pending_applications())
+ .WillByDefault(Return(DataAccessor<am::AppsWaitRegistrationSet>(
+ pending_app_set_, pending_lock_ptr_)));
+
+ InitBasicMessage();
+ (*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey2;
+ EXPECT_CALL(app_mngr_, IsStopping())
+ .WillOnce(Return(false))
+ .WillOnce(Return(true))
+ .WillOnce(Return(false));
+ ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(false));
+ EXPECT_CALL(app_mngr_, updateRequestTimeout(kConnectionKey2, _, _));
+ EXPECT_CALL(app_mngr_, IsApplicationForbidden(kConnectionKey2, kAppId1))
+ .WillOnce(Return(false));
+
+ connection_handler::DeviceHandle device_id2 = 2u;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey2, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id2), Return(0)));
+
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id2, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress2), Return(0)));
+
+ MockAppPtr mock_app2 = CreateBasicMockedApp();
+
+ ON_CALL(*mock_app2, device()).WillByDefault(Return(device_id2));
+ ON_CALL(*mock_app2, mac_address()).WillByDefault(ReturnRef(kMacAddress2));
+ EXPECT_CALL(app_mngr_, application(kMacAddress2, kAppId1))
+ .WillRepeatedly(Return(ApplicationSharedPtr()));
+ EXPECT_CALL(app_mngr_, reregister_application_by_policy_id(kAppId1))
+ .WillOnce(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey2))
+ .WillOnce(Return(mock_app2));
+
+ ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
+ .WillByDefault(Return(true));
+ policy::StatusNotifier notify_upd_manager =
+ std::make_shared<utils::CallNothing>();
+ ON_CALL(mock_policy_handler_, AddApplication(kMacAddress2, kAppId1, _))
+ .WillByDefault(Return(notify_upd_manager));
+
+ EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app2));
+
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
+ _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
+ .Times(2);
+ EXPECT_CALL(app_mngr_, SendDriverDistractionState(_));
+
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
index 4cdf4f8858..4b43c302e4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
@@ -37,19 +37,17 @@
#include "mobile/reset_global_properties_request.h"
#include "mobile/reset_global_properties_response.h"
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-#include "smart_objects/smart_object.h"
-#include "interfaces/HMI_API.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/smart_object_keys.h"
+#include "gtest/gtest.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -63,14 +61,15 @@ using ::testing::ReturnRef;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::ResetGlobalPropertiesRequest;
-using sdl_rpc_plugin::commands::ResetGlobalPropertiesResponse;
+using am::MockMessageHelper;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
+using sdl_rpc_plugin::commands::ResetGlobalPropertiesRequest;
+using sdl_rpc_plugin::commands::ResetGlobalPropertiesResponse;
-typedef SharedPtr<ResetGlobalPropertiesRequest> ResetGlobalPropertiesRequestPtr;
-typedef SharedPtr<ResetGlobalPropertiesResponse>
+typedef std::shared_ptr<ResetGlobalPropertiesRequest>
+ ResetGlobalPropertiesRequestPtr;
+typedef std::shared_ptr<ResetGlobalPropertiesResponse>
ResetGlobalPropertiesResponsePtr;
namespace {
@@ -140,8 +139,21 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) {
mobile_apis::GlobalProperty::KEYBOARDPROPERTIES;
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
+ std::vector<std::string> help_prompt = {"help_prompt"};
+
+ EXPECT_CALL(app_mngr_settings_, help_prompt())
+ .WillOnce(ReturnRef(help_prompt));
+
+ smart_objects::SmartObject so_help_prompt =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ so_help_prompt[am::strings::text] = help_prompt[0];
+ so_help_prompt[am::strings::type] =
+ hmi_apis::Common_SpeechCapabilities::SC_TEXT;
+
smart_objects::SmartObject so_prompt =
smart_objects::SmartObject(smart_objects::SmartType_Array);
+ so_prompt[0] = so_help_prompt;
+
EXPECT_CALL(*mock_app_, set_help_prompt(so_prompt));
std::vector<std::string> time_out_prompt;
@@ -162,6 +174,15 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) {
EXPECT_CALL(*mock_app_, set_timeout_prompt(so_time_out_prompt));
+ std::string vr_help_title("vr_help_title");
+ EXPECT_CALL(app_mngr_settings_, vr_help_title())
+ .WillOnce(ReturnRef(vr_help_title));
+
+ smart_objects::SmartObject so_vr_help_title =
+ smart_objects::SmartObject(smart_objects::SmartType_String);
+ so_vr_help_title = vr_help_title;
+ EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title));
+
EXPECT_CALL(*mock_app_, reset_vr_help_title());
EXPECT_CALL(*mock_app_, reset_vr_help());
@@ -171,7 +192,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) {
EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
command_->Run();
}
@@ -191,8 +212,21 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) {
mobile_apis::GlobalProperty::KEYBOARDPROPERTIES;
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
+
+ std::vector<std::string> help_prompt = {"help_prompt"};
+
+ EXPECT_CALL(app_mngr_settings_, help_prompt())
+ .WillOnce(ReturnRef(help_prompt));
+
+ smart_objects::SmartObject so_help_prompt =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ so_help_prompt[am::strings::text] = help_prompt[0];
+ so_help_prompt[am::strings::type] =
+ hmi_apis::Common_SpeechCapabilities::SC_TEXT;
+
smart_objects::SmartObject so_prompt =
smart_objects::SmartObject(smart_objects::SmartType_Array);
+ so_prompt[0] = so_help_prompt;
EXPECT_CALL(*mock_app_, set_help_prompt(so_prompt));
std::vector<std::string> time_out_prompt;
@@ -213,13 +247,22 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) {
EXPECT_CALL(*mock_app_, set_timeout_prompt(so_time_out_prompt));
+ std::string vr_help_title("vr_help_title");
+ EXPECT_CALL(app_mngr_settings_, vr_help_title())
+ .WillOnce(ReturnRef(vr_help_title));
+
+ smart_objects::SmartObject so_vr_help_title =
+ smart_objects::SmartObject(smart_objects::SmartType_String);
+ so_vr_help_title = vr_help_title;
+ EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title));
+
EXPECT_CALL(*mock_app_, reset_vr_help_title());
EXPECT_CALL(*mock_app_, reset_vr_help());
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
smart_objects::SmartObjectSPtr vr_help =
- ::utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
@@ -231,20 +274,18 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) {
EXPECT_CALL(*mock_app_,
set_menu_title(msg_params[am::hmi_request::menu_title]));
- const smart_objects::SmartObjectSPtr so_help_prompt =
- ::utils::MakeShared<smart_objects::SmartObject>(
- smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_app_, help_prompt()).WillOnce(Return(so_help_prompt.get()));
- EXPECT_CALL(*mock_app_, timeout_prompt())
- .WillOnce(Return(so_help_prompt.get()));
+ EXPECT_CALL(*mock_app_, help_prompt()).WillOnce(Return(&so_help_prompt));
+ EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(&so_help_prompt));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
command_->Run();
@@ -266,18 +307,28 @@ TEST_F(ResetGlobalPropertiesRequestTest,
(*msg_)[am::strings::msg_params][am::strings::properties][0] =
mobile_apis::GlobalProperty::VRHELPTITLE;
+ std::string vr_help_title("vr_help_title");
+ EXPECT_CALL(app_mngr_settings_, vr_help_title())
+ .WillOnce(ReturnRef(vr_help_title));
+
+ smart_objects::SmartObject so_vr_help_title =
+ smart_objects::SmartObject(smart_objects::SmartType_String);
+ so_vr_help_title = vr_help_title;
+ EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title));
+
EXPECT_CALL(*mock_app_, reset_vr_help_title());
EXPECT_CALL(*mock_app_, reset_vr_help());
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
smart_objects::SmartObjectSPtr vr_help =
- ::utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
.WillOnce(Return(true));
command_->Run();
@@ -310,7 +361,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
smart_objects::SmartObjectSPtr prompt =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
*prompt = "prompt";
EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
@@ -321,13 +372,15 @@ TEST_F(ResetGlobalPropertiesRequestTest,
(*ui_msg)[am::strings::params][am::strings::correlation_id] = kCorrelationId;
(*ui_msg)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::eType::SUCCESS;
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
Event ui_event(hmi_apis::FunctionID::UI_SetGlobalProperties);
ui_event.set_smart_object(*ui_msg);
@@ -359,16 +412,26 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
(*msg_)[am::strings::msg_params][am::strings::properties][0] =
mobile_apis::GlobalProperty::VRHELPTITLE;
+ std::string vr_help_title("vr_help_title");
+ EXPECT_CALL(app_mngr_settings_, vr_help_title())
+ .WillOnce(ReturnRef(vr_help_title));
+
+ smart_objects::SmartObject so_vr_help_title =
+ smart_objects::SmartObject(smart_objects::SmartType_String);
+ so_vr_help_title = vr_help_title;
+ EXPECT_CALL(*mock_app_, set_vr_help_title(so_vr_help_title));
+
EXPECT_CALL(*mock_app_, reset_vr_help_title());
EXPECT_CALL(*mock_app_, reset_vr_help());
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
.WillOnce(Return(true));
smart_objects::SmartObjectSPtr vr_help =
- ::utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
@@ -406,20 +469,22 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
smart_objects::SmartObjectSPtr prompt =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
*prompt = "prompt";
EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
ResetGlobalPropertiesRequestPtr command =
@@ -439,7 +504,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
// TTS doesn't respond, so timeout should send generic error
smart_objects::SmartObjectSPtr response =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*response)[am::strings::msg_params][am::strings::result_code] =
mobile_apis::Result::GENERIC_ERROR;
EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
@@ -471,20 +536,22 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
smart_objects::SmartObjectSPtr prompt =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
*prompt = "prompt";
EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
command_->Run();
@@ -501,7 +568,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
// UI doesn't respond, so timeout should send generic error
smart_objects::SmartObjectSPtr response =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*response)[am::strings::msg_params][am::strings::result_code] =
mobile_apis::Result::GENERIC_ERROR;
EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
@@ -535,27 +602,29 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
smart_objects::SmartObjectSPtr prompt =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
*prompt = "prompt";
EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
command_->Run();
// TTS and UI don't respond, so timeout should send generic error
std::string info = "TTS, UI component does not respond";
smart_objects::SmartObjectSPtr response =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*response)[am::strings::msg_params][am::strings::result_code] =
mobile_apis::Result::GENERIC_ERROR;
EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
index f550043414..6b17aa238d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc
@@ -31,20 +31,20 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/scrollable_message_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -57,11 +57,10 @@ namespace hmi_response = am::hmi_response;
namespace mobile_result = mobile_apis::Result;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::ScrollableMessageRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
-using ::utils::SharedPtr;
+using sdl_rpc_plugin::commands::ScrollableMessageRequest;
using ::testing::_;
using ::testing::Eq;
using ::testing::Ref;
@@ -116,7 +115,7 @@ class ScrollableMessageRequestTest
MockAppPtr mock_app_;
MessageSharedPtr msg_;
- SharedPtr<ScrollableMessageRequest> command_;
+ std::shared_ptr<ScrollableMessageRequest> command_;
};
typedef ScrollableMessageRequestTest::MockHMICapabilities MockHMICapabilities;
@@ -125,7 +124,7 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_ui = CreateFullParamsUISO();
(*msg_ui)[am::strings::params][am::strings::connection_key] = kConnectionKey;
- utils::SharedPtr<ScrollableMessageRequest> command =
+ std::shared_ptr<ScrollableMessageRequest> command =
CreateCommand<ScrollableMessageRequest>(msg_ui);
MockAppPtr mock_app = CreateMockApp();
@@ -176,7 +175,7 @@ TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_SUCCESS) {
mobile_apis::InteractionMode::MANUAL_ONLY;
EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
command_->Init();
- EXPECT_EQ(kTimeOut, command_->default_timeout());
+ EXPECT_EQ(kTimeOut + kDefaultTimeout_, command_->default_timeout());
}
TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_UNSUCCESS) {
@@ -184,7 +183,7 @@ TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_UNSUCCESS) {
mobile_apis::InteractionMode::MANUAL_ONLY;
EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
command_->Init();
- EXPECT_EQ(kTimeOut, command_->default_timeout());
+ EXPECT_EQ(kDefaultTimeout_, command_->default_timeout());
}
TEST_F(ScrollableMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
@@ -283,4 +282,4 @@ TEST_F(ScrollableMessageRequestTest,
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc
index c0c44922e3..3cb9642021 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc
@@ -32,15 +32,15 @@
#include "gtest/gtest.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "mobile/send_haptic_data_request.h"
#include "mobile/send_haptic_data_response.h"
-#include "interfaces/MOBILE_API.h"
#include "application_manager/application.h"
#include "application_manager/mock_application.h"
+#include "interfaces/MOBILE_API.h"
namespace test {
namespace components {
@@ -53,12 +53,12 @@ using ::testing::Return;
namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::SendHapticDataRequest;
using sdl_rpc_plugin::commands::SendHapticDataResponse;
-using am::commands::MessageSharedPtr;
-typedef SharedPtr<SendHapticDataRequest> SendHapticDataRequestPtr;
-typedef SharedPtr<SendHapticDataResponse> SendHapticDataResponsePtr;
+typedef std::shared_ptr<SendHapticDataRequest> SendHapticDataRequestPtr;
+typedef std::shared_ptr<SendHapticDataResponse> SendHapticDataResponsePtr;
namespace {
const uint32_t kConnectionKey = 1u;
@@ -91,7 +91,7 @@ class SendHapticDataResponseTest
}
MessageSharedPtr message_;
- SharedPtr<SendHapticDataResponse> command_sptr_;
+ std::shared_ptr<SendHapticDataResponse> command_sptr_;
};
TEST_F(SendHapticDataRequestTest, Run_SUCCESS) {
@@ -102,7 +102,7 @@ TEST_F(SendHapticDataRequestTest, Run_SUCCESS) {
EXPECT_CALL(mock_rpc_service_,
ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::UI_SendHapticData)))
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SendHapticData), _))
.WillOnce(Return(true));
SendHapticDataRequestPtr command(CreateCommand<SendHapticDataRequest>(msg_));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
index d0072f6288..968c91b5ce 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
@@ -32,11 +32,11 @@
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "mobile/send_location_request.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_message_helper.h"
-#include "utils/shared_ptr.h"
+#include "gtest/gtest.h"
+#include "mobile/send_location_request.h"
+
#include "application_manager/commands/command_request_test.h"
namespace test {
@@ -45,12 +45,12 @@ namespace commands_test {
namespace mobile_commands_test {
namespace send_location_request {
+using application_manager::MockMessageHelper;
using application_manager::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::SendLocationRequest;
-using application_manager::MockMessageHelper;
-using test::components::application_manager_test::MockHMICapabilities;
using smart_objects::SmartObject;
-using utils::SharedPtr;
+using test::components::application_manager_test::MockHMICapabilities;
+
using testing::_;
using testing::Return;
using testing::ReturnRef;
@@ -95,11 +95,11 @@ class SendLocationRequestTest
}
};
- typedef SharedPtr<UnwrappedSendLocationRequest> CommandSPrt;
+ typedef std::shared_ptr<UnwrappedSendLocationRequest> CommandSPrt;
SendLocationRequestTest() {
mock_app_ = CreateMockApp();
- disp_cap_ = utils::MakeShared<SmartObject>(smart_objects::SmartType_Map);
+ disp_cap_ = std::make_shared<SmartObject>(smart_objects::SmartType_Map);
message_ = CreateMessage();
command_ = CreateCommand<UnwrappedSendLocationRequest>(message_);
}
@@ -110,6 +110,8 @@ class SendLocationRequestTest
(*message_)[strings::msg_params] =
SmartObject(smart_objects::SmartType_Map);
(*message_)[strings::msg_params][strings::address] = kCorrectAddress;
+ ON_CALL(mock_hmi_capabilities_, display_capabilities())
+ .WillByDefault(Return(smart_objects::SmartObjectSPtr()));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -130,22 +132,22 @@ class SendLocationRequestTest
SmartObject(smart_objects::SmartType_Map);
(*disp_cap_)[hmi_response::text_fields][0][strings::name] = field_name;
EXPECT_CALL(mock_hmi_capabilities_, display_capabilities())
- .Times(2)
- .WillRepeatedly(Return(disp_cap_.get()));
+ .WillOnce(Return(disp_cap_));
}
void FinishSetup() {
EXPECT_CALL(*mock_app_, hmi_app_id()).WillOnce(Return(kAppID));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Navigation_SendLocation)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Navigation_SendLocation), _));
}
void FinishSetupCancelled(mobile_apis::Result::eType result) {
EXPECT_CALL(*mock_app_, hmi_app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(result), _));
}
@@ -158,7 +160,7 @@ class SendLocationRequestTest
}
MockAppPtr mock_app_;
- SharedPtr<SmartObject> disp_cap_;
+ std::shared_ptr<SmartObject> disp_cap_;
MessageSharedPtr message_;
CommandSPrt command_;
};
@@ -315,6 +317,21 @@ TEST_F(SendLocationRequestTest, Run_LocationImageValid_Success) {
command_->Run();
}
+TEST_F(SendLocationRequestTest, Run_LocationImageValid_Warnings) {
+ InitialSetup(message_);
+ (*message_)[strings::msg_params][strings::location_image] =
+ SmartObject(smart_objects::SmartType_Map);
+ (*message_)[strings::msg_params][strings::location_image][strings::value] =
+ "notavailable";
+ EXPECT_CALL(
+ mock_message_helper_,
+ VerifyImage(
+ (*message_)[strings::msg_params][strings::location_image], _, _))
+ .WillOnce(Return(mobile_apis::Result::WARNINGS));
+ FinishSetup();
+ command_->Run();
+}
+
TEST_F(SendLocationRequestTest, Run_LocationImageInvalid_Cancelled) {
InitialSetup(message_);
(*message_)[strings::msg_params][strings::location_image] =
@@ -325,8 +342,8 @@ TEST_F(SendLocationRequestTest, Run_LocationImageInvalid_Cancelled) {
mock_message_helper_,
VerifyImage(
(*message_)[strings::msg_params][strings::location_image], _, _))
- .WillOnce(Return(mobile_apis::Result::ABORTED));
- FinishSetupCancelled(mobile_apis::Result::ABORTED);
+ .WillOnce(Return(mobile_apis::Result::INVALID_DATA));
+ FinishSetupCancelled(mobile_apis::Result::INVALID_DATA);
command_->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc
index e1612dbacb..116a796312 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc
@@ -31,20 +31,20 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/set_app_icon_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
#include "protocol_handler/mock_protocol_handler.h"
#include "protocol_handler/mock_protocol_handler_settings.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
namespace test {
namespace components {
@@ -53,14 +53,13 @@ namespace mobile_commands_test {
namespace set_app_icon_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::SetAppIconRequest;
+using am::MockHmiInterfaces;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
-using am::MockHmiInterfaces;
+using sdl_rpc_plugin::commands::SetAppIconRequest;
using test::components::protocol_handler_test::MockProtocolHandler;
using test::components::protocol_handler_test::MockProtocolHandlerSettings;
-using ::utils::SharedPtr;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -110,7 +109,7 @@ TEST_F(SetAppIconRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
ON_CALL(app_mngr_settings_, app_icons_folder())
.WillByDefault(ReturnRef(dir_path));
- utils::SharedPtr<SetAppIconRequest> req_vr =
+ std::shared_ptr<SetAppIconRequest> req_vr =
CreateCommand<SetAppIconRequest>(msg_vr);
MockAppPtr mock_app = CreateMockApp();
@@ -171,4 +170,4 @@ TEST_F(SetAppIconRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
index 0758fb32f4..cc3b5925ce 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
@@ -31,19 +31,19 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/set_display_layout_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -53,16 +53,15 @@ namespace set_display_layout_request {
namespace am = application_manager;
namespace mobile_result = mobile_apis::Result;
-using sdl_rpc_plugin::commands::SetDisplayLayoutRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
-using ::utils::SharedPtr;
+using sdl_rpc_plugin::commands::SetDisplayLayoutRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
-typedef ::utils::SharedPtr<SetDisplayLayoutRequest> CommandPtr;
+typedef std::shared_ptr<SetDisplayLayoutRequest> CommandPtr;
namespace {
const uint32_t kAppId = 1u;
@@ -132,7 +131,7 @@ TEST_F(SetDisplayLayoutRequestTest,
MessageSharedPtr msg_ui = CreateFullParamsUISO();
(*msg_ui)[am::strings::params][am::strings::connection_key] = kConnectionKey;
- utils::SharedPtr<SetDisplayLayoutRequest> command =
+ std::shared_ptr<SetDisplayLayoutRequest> command =
CreateCommand<SetDisplayLayoutRequest>(msg_ui);
MockAppPtr mock_app = CreateMockApp();
@@ -161,6 +160,7 @@ TEST_F(SetDisplayLayoutRequestTest,
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
+ command->Init();
command->on_event(event);
ResultCommandExpectations(ui_command_result, "UI is not supported by system");
@@ -179,6 +179,7 @@ TEST_F(SetDisplayLayoutRequestTest, Run_InvalidApp_UNSUCCESS) {
MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED),
am::commands::Command::CommandSource::SOURCE_SDL));
+ command->Init();
command->Run();
}
@@ -189,7 +190,7 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
- EXPECT_CALL(*mock_app, display_layout()).WillOnce(ReturnRef(kLayout));
+ EXPECT_CALL(*mock_app, display_layout()).WillOnce(Return(kLayout));
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
@@ -202,23 +203,63 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(CheckMshCorrId(kCorrelationKey)))
+ ManageHMICommand(CheckMshCorrId(kCorrelationKey), _))
.WillOnce(Return(true));
+ command->Init();
command->Run();
}
TEST_F(SetDisplayLayoutRequestTest, OnEvent_InvalidEventId_UNSUCCESS) {
- CommandPtr command(CreateCommand<SetDisplayLayoutRequest>());
+ MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg));
+
am::event_engine::Event event(hmi_apis::FunctionID::INVALID_ENUM);
- SmartObject msg(smart_objects::SmartType_Map);
- event.set_smart_object(msg);
+ event.set_smart_object(*msg);
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ command->Init();
+ command->on_event(event);
+}
+TEST_F(SetDisplayLayoutRequestTest, OnEvent_AppVersion_v6_WARNING) {
+ am::event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout);
+ MessageSharedPtr msg = CreateMessage();
+
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[am::strings::msg_params][am::hmi_response::display_capabilities] = 0;
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ event.set_smart_object(*msg);
+
+ MessageSharedPtr dispaly_capabilities_msg = CreateMessage();
+ (*dispaly_capabilities_msg)[am::hmi_response::templates_available] =
+ "templates_available";
+
+ EXPECT_CALL(mock_hmi_capabilities_, display_capabilities())
+ .WillOnce(Return(dispaly_capabilities_msg));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::WARNINGS),
+ am::commands::Command::CommandSource::SOURCE_SDL));
+
+ CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg));
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ ::application_manager::Version app_version;
+ app_version.max_supported_api_version =
+ ::application_manager::APIVersion::kAPIV6;
+ EXPECT_CALL(*mock_app, version()).WillOnce(ReturnRef(app_version));
+
+ command->Init();
command->on_event(event);
}
-TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
+TEST_F(SetDisplayLayoutRequestTest, OnEvent_AppVersion_v5_SUCCESS) {
am::event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout);
MessageSharedPtr msg = CreateMessage();
@@ -233,13 +274,22 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
"templates_available";
EXPECT_CALL(mock_hmi_capabilities_, display_capabilities())
- .WillOnce(Return(dispaly_capabilities_msg.get()));
+ .WillOnce(Return(dispaly_capabilities_msg));
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS),
am::commands::Command::CommandSource::SOURCE_SDL));
CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg));
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ ::application_manager::Version app_version;
+ app_version.max_supported_api_version =
+ ::application_manager::APIVersion::kAPIV5;
+ EXPECT_CALL(*mock_app, version()).WillOnce(ReturnRef(app_version));
+
+ command->Init();
command->on_event(event);
}
@@ -247,4 +297,4 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
index 5d31f48970..9b72d41f7e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
@@ -31,18 +31,21 @@
*/
#include <stdint.h>
-#include <string>
+#include <memory>
#include <set>
+#include <string>
#include "mobile/set_global_properties_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/message_helper.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -51,16 +54,15 @@ namespace mobile_commands_test {
namespace set_global_properties_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::SetGlobalPropertiesRequest;
+using am::CommandsMap;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
-using am::CommandsMap;
-using utils::custom_string::CustomString;
-using ::utils::SharedPtr;
+using sdl_rpc_plugin::commands::SetGlobalPropertiesRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
+using utils::custom_string::CustomString;
namespace {
const int32_t kCommandId = 1;
@@ -69,6 +71,13 @@ const uint32_t kCmdId = 1u;
const uint32_t kConnectionKey = 1u;
const std::string kText = "one";
const uint32_t kPosition = 1u;
+
+const std::vector<hmi_apis::Common_Result::eType> success_result_codes{
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED};
} // namespace
class SetGlobalPropertiesRequestTest
@@ -76,7 +85,11 @@ class SetGlobalPropertiesRequestTest
public:
SetGlobalPropertiesRequestTest()
: lock_ptr_(std::make_shared<sync_primitives::Lock>())
- , mock_app_(CreateMockApp()) {}
+ , mock_app_(CreateMockApp()) {
+ mock_help_prompt_manager_ =
+ std::shared_ptr<application_manager_test::MockHelpPromptManager>(
+ new application_manager_test::MockHelpPromptManager());
+ }
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
@@ -121,8 +134,9 @@ class SetGlobalPropertiesRequestTest
.WillOnce(Return(mock_app_));
}
- void OnEventUISetupHelper(MessageSharedPtr msg,
- SharedPtr<SetGlobalPropertiesRequest> command) {
+ void OnEventUISetupHelper(
+ MessageSharedPtr msg,
+ std::shared_ptr<SetGlobalPropertiesRequest> command) {
SmartObject vr_help_title("yes");
SmartObject vr_help_array(smart_objects::SmartType_Array);
VRArraySetupHelper(msg, vr_help_title, vr_help_array);
@@ -140,11 +154,17 @@ class SetGlobalPropertiesRequestTest
EXPECT_CALL(*mock_app_, set_keyboard_props(_)).Times(0);
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+
command->Run();
}
- void OnEventTTSSetupHelper(MessageSharedPtr msg,
- SharedPtr<SetGlobalPropertiesRequest> command) {
+ void OnEventTTSSetupHelper(
+ MessageSharedPtr msg,
+ std::shared_ptr<SetGlobalPropertiesRequest> command) {
SmartObject help_prompt(smart_objects::SmartType_Array);
help_prompt[0][am::strings::text] = "Help_Prompt_One";
(*msg)[am::strings::msg_params][am::strings::help_prompt] = help_prompt;
@@ -162,14 +182,17 @@ class SetGlobalPropertiesRequestTest
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_,
RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- SmartObject vr_help_title("title");
- EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
EXPECT_CALL(*mock_app_, set_help_prompt(help_prompt));
EXPECT_CALL(*mock_app_, help_prompt()).WillOnce(Return(&help_prompt));
EXPECT_CALL(*mock_app_, set_timeout_prompt(timeout_prompt));
EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(&timeout_prompt));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+
command->Run();
}
@@ -218,9 +241,16 @@ class SetGlobalPropertiesRequestTest
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
- ON_CALL(mock_hmi_interfaces_,
- GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ ON_CALL(mock_app_manager_, hmi_interfaces())
+ .WillByDefault(ReturnRef(mock_hmi_interfaces_));
+ ON_CALL(mock_message_helper_,
+ MobileToHMIResult(mobile_apis::Result::UNSUPPORTED_RESOURCE))
+ .WillByDefault(Return(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));
+ ON_CALL(mock_message_helper_,
+ MobileToHMIResult(mobile_apis::Result::WARNINGS))
+ .WillByDefault(Return(hmi_apis::Common_Result::WARNINGS));
}
void ResultCommandExpectations(MessageSharedPtr msg,
@@ -228,8 +258,8 @@ class SetGlobalPropertiesRequestTest
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
true);
EXPECT_EQ(
- (*msg)[am::strings::msg_params][am::strings::result_code].asInt(),
- static_cast<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));
+ static_cast<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE),
+ (*msg)[am::strings::msg_params][am::strings::result_code].asInt());
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::info].asString(),
info);
}
@@ -250,8 +280,128 @@ class SetGlobalPropertiesRequestTest
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
}
+
+ // Checks total result code for each properties
+ void PrepareResultCodeForResponse_CheckTotalCode(
+ const hmi_apis::Common_Result::eType& ui_result,
+ const hmi_apis::Common_Result::eType& tts_result,
+ const hmi_apis::Common_Result::eType& rc_result,
+ const mobile_apis::Result::eType expected_total_result_code) {
+ using namespace application_manager;
+ using namespace hmi_apis;
+
+ commands::ResponseInfo ui_properties_info(
+ ui_result, HmiInterfaces::HMI_INTERFACE_UI, mock_app_manager_);
+ commands::ResponseInfo tts_properties_info(
+ tts_result, HmiInterfaces::HMI_INTERFACE_TTS, mock_app_manager_);
+ commands::ResponseInfo rc_properties_info(
+ rc_result, HmiInterfaces::HMI_INTERFACE_RC, mock_app_manager_);
+
+ MessageSharedPtr msg = CreateMsgParams();
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto result = command->PrepareResultCodeForResponse(
+ ui_properties_info, tts_properties_info, rc_properties_info);
+
+ EXPECT_EQ(expected_total_result_code, result);
+ }
+
+ // Sets in rotation for each result UNSUPPROTED result code and checks total
+ // result code
+ void PrepareResultCodeForResponse_CheckAllResultsForSpecifiedTotalResult(
+ mobile_apis::Result::eType expected_total_result_code) {
+ using namespace application_manager;
+ using namespace hmi_apis;
+
+ Common_Result::eType ui_result =
+ MessageHelper::MobileToHMIResult(expected_total_result_code);
+ Common_Result::eType tts_result = Common_Result::SUCCESS;
+ Common_Result::eType rc_result = Common_Result::SUCCESS;
+
+ PrepareResultCodeForResponse_CheckTotalCode(
+ ui_result, tts_result, rc_result, expected_total_result_code);
+
+ ui_result = Common_Result::SUCCESS;
+ tts_result = MessageHelper::MobileToHMIResult(expected_total_result_code);
+
+ PrepareResultCodeForResponse_CheckTotalCode(
+ ui_result, tts_result, rc_result, expected_total_result_code);
+
+ tts_result = Common_Result::SUCCESS;
+ rc_result = MessageHelper::MobileToHMIResult(expected_total_result_code);
+
+ PrepareResultCodeForResponse_CheckTotalCode(
+ ui_result, tts_result, rc_result, expected_total_result_code);
+ }
+
+ void PrepareResultForMobileResponse_CheckTotalReault(
+ const hmi_apis::Common_Result::eType& ui_result,
+ const hmi_apis::Common_Result::eType& tts_result,
+ const hmi_apis::Common_Result::eType& rc_result,
+ const bool expected_total_result) {
+ using namespace application_manager;
+ using namespace hmi_apis;
+
+ commands::ResponseInfo ui_properties_info(
+ ui_result, HmiInterfaces::HMI_INTERFACE_UI, mock_app_manager_);
+ commands::ResponseInfo tts_properties_info(
+ tts_result, HmiInterfaces::HMI_INTERFACE_TTS, mock_app_manager_);
+ commands::ResponseInfo rc_properties_info(
+ rc_result, HmiInterfaces::HMI_INTERFACE_RC, mock_app_manager_);
+
+ MessageSharedPtr msg = CreateMsgParams();
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ bool result = command->PrepareResultForMobileResponse(
+ ui_properties_info, tts_properties_info, rc_properties_info);
+
+ EXPECT_EQ(expected_total_result, result);
+ }
+
+ void PrepareResultForMobileResponse_CheckResultsForAllCases() {
+ using namespace application_manager;
+ using namespace hmi_apis;
+
+ Common_Result::eType ui_result = Common_Result::SUCCESS;
+ Common_Result::eType tts_result = Common_Result::SUCCESS;
+ Common_Result::eType rc_result = Common_Result::SUCCESS;
+
+ PrepareResultForMobileResponse_CheckTotalReault(
+ ui_result, tts_result, rc_result, true);
+
+ // Result code isn't success
+ EXPECT_FALSE(helpers::in_range(success_result_codes,
+ Common_Result::UNSUPPORTED_REQUEST));
+
+ ui_result = Common_Result::UNSUPPORTED_REQUEST;
+ tts_result = Common_Result::SUCCESS;
+ rc_result = Common_Result::SUCCESS;
+
+ PrepareResultForMobileResponse_CheckTotalReault(
+ ui_result, tts_result, rc_result, false);
+
+ ui_result = Common_Result::SUCCESS;
+ tts_result = Common_Result::UNSUPPORTED_REQUEST;
+ rc_result = Common_Result::SUCCESS;
+
+ PrepareResultForMobileResponse_CheckTotalReault(
+ ui_result, tts_result, rc_result, false);
+
+ ui_result = Common_Result::SUCCESS;
+ tts_result = Common_Result::SUCCESS;
+ rc_result = Common_Result::UNSUPPORTED_REQUEST;
+
+ PrepareResultForMobileResponse_CheckTotalReault(
+ ui_result, tts_result, rc_result, false);
+ }
+
std::shared_ptr<sync_primitives::Lock> lock_ptr_;
MockAppPtr mock_app_;
+ std::shared_ptr<application_manager_test::MockHelpPromptManager>
+ mock_help_prompt_manager_;
+ NiceMock<MockApplicationManager> mock_app_manager_;
};
TEST_F(SetGlobalPropertiesRequestTest,
@@ -260,7 +410,7 @@ TEST_F(SetGlobalPropertiesRequestTest,
(*msg_vr)[am::strings::msg_params][am::strings::vr_commands][0] =
"vr_command";
- utils::SharedPtr<SetGlobalPropertiesRequest> command =
+ std::shared_ptr<SetGlobalPropertiesRequest> command =
CreateCommand<SetGlobalPropertiesRequest>(msg_vr);
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
@@ -293,25 +443,38 @@ TEST_F(SetGlobalPropertiesRequestTest,
ON_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillByDefault(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false))
+ .Times(2);
+
EXPECT_CALL(
mock_message_helper_,
VerifyTtsFiles(
(*msg_vr)[am::strings::msg_params][am::strings::help_prompt], _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_SetGlobalProperties), _))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_SetGlobalProperties), _))
.WillOnce(Return(true));
+
(*msg_vr)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
Event event_vr(hmi_apis::FunctionID::TTS_SetGlobalProperties);
event_vr.set_smart_object(*msg_vr);
command->Run();
+
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, true));
command->on_event(event_vr);
MessageSharedPtr ui_command_result;
@@ -319,6 +482,8 @@ TEST_F(SetGlobalPropertiesRequestTest,
mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, true));
command->on_event(event);
@@ -334,11 +499,17 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_SUCCESS_Expect_MessageNotSend) {
am::event_engine::Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
event.set_smart_object(*response);
- utils::SharedPtr<SetGlobalPropertiesRequest> command =
+ std::shared_ptr<SetGlobalPropertiesRequest> command =
CreateCommand<SetGlobalPropertiesRequest>(response);
MockAppPtr mock_app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+
+ EXPECT_CALL(*mock_app, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, true));
+
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
@@ -361,12 +532,15 @@ TEST_F(SetGlobalPropertiesRequestTest,
am::event_engine::Event event_ui(
hmi_apis::FunctionID::UI_SetGlobalProperties);
event_tts.set_smart_object(*response);
- utils::SharedPtr<SetGlobalPropertiesRequest> command =
+ std::shared_ptr<SetGlobalPropertiesRequest> command =
CreateCommand<SetGlobalPropertiesRequest>(response);
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+
MessageSharedPtr response_to_mobile;
EXPECT_CALL(
mock_rpc_service_,
@@ -374,6 +548,10 @@ TEST_F(SetGlobalPropertiesRequestTest,
.WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
command->Run();
+
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, true))
+ .Times(2);
command->on_event(event_ui);
command->on_event(event_tts);
@@ -389,7 +567,7 @@ TEST_F(SetGlobalPropertiesRequestTest,
TEST_F(SetGlobalPropertiesRequestTest, Run_VRNoMenuAndKeyboard_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
EXPECT_CALL(
mock_hmi_interfaces_,
@@ -441,7 +619,109 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRWithMenuAndKeyboard_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ Run_VRWithMenuAndKeyboard_Menu_WARNINGS) {
+ MessageSharedPtr msg = CreateMsgParams();
+ SmartObject vr_help_title("yes");
+ SmartObject vr_help_array(smart_objects::SmartType_Array);
+ VRArraySetupHelper(msg, vr_help_title, vr_help_array);
+ (*msg)[am::strings::msg_params][am::strings::vr_help] = vr_help_array;
+ SmartObject menu_title("Menu_Title");
+ (*msg)[am::strings::msg_params][am::hmi_request::menu_title] = menu_title;
+ SmartObject menu_icon(smart_objects::SmartType_Map);
+ menu_icon[am::strings::value] = "1";
+ (*msg)[am::strings::msg_params][am::hmi_request::menu_icon] = menu_icon;
+ SmartObject keyboard_properties(smart_objects::SmartType_Map);
+ (*msg)[am::strings::msg_params][am::hmi_request::keyboard_properties] =
+ keyboard_properties;
+
+ EXPECT_CALL(mock_message_helper_, VerifyImage(menu_icon, _, _))
+ .WillOnce((Return(mobile_apis::Result::WARNINGS)));
+ EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(vr_help_array, _, _))
+ .WillOnce((Return(mobile_apis::Result::SUCCESS)));
+ EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
+ EXPECT_CALL(*mock_app_, set_vr_help_title(vr_help_title));
+ EXPECT_CALL(*mock_app_, set_vr_help(vr_help_array));
+ EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
+ EXPECT_CALL(*mock_app_, vr_help()).WillOnce(Return(&vr_help_array));
+ EXPECT_CALL(*mock_app_, set_menu_title(menu_title));
+ EXPECT_CALL(*mock_app_, set_menu_icon(menu_icon));
+ EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+
+ EXPECT_CALL(
+ mock_hmi_interfaces_,
+ GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
+ .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
+
+ ON_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ command->Run();
+}
+
+TEST_F(SetGlobalPropertiesRequestTest, Run_VRWithMenuAndKeyboard_VR_WARNINGS) {
+ MessageSharedPtr msg = CreateMsgParams();
+ SmartObject vr_help_title("yes");
+ SmartObject vr_help_array(smart_objects::SmartType_Array);
+ VRArraySetupHelper(msg, vr_help_title, vr_help_array);
+ (*msg)[am::strings::msg_params][am::strings::vr_help] = vr_help_array;
+ SmartObject menu_title("Menu_Title");
+ (*msg)[am::strings::msg_params][am::hmi_request::menu_title] = menu_title;
+ SmartObject menu_icon(smart_objects::SmartType_Map);
+ menu_icon[am::strings::value] = "1";
+ (*msg)[am::strings::msg_params][am::hmi_request::menu_icon] = menu_icon;
+ SmartObject keyboard_properties(smart_objects::SmartType_Map);
+ (*msg)[am::strings::msg_params][am::hmi_request::keyboard_properties] =
+ keyboard_properties;
+
+ EXPECT_CALL(mock_message_helper_, VerifyImage(menu_icon, _, _))
+ .WillOnce((Return(mobile_apis::Result::SUCCESS)));
+ EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(vr_help_array, _, _))
+ .WillOnce((Return(mobile_apis::Result::WARNINGS)));
+ EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
+ EXPECT_CALL(*mock_app_, set_vr_help_title(vr_help_title));
+ EXPECT_CALL(*mock_app_, set_vr_help(vr_help_array));
+ EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
+ EXPECT_CALL(*mock_app_, vr_help()).WillOnce(Return(&vr_help_array));
+ EXPECT_CALL(*mock_app_, set_menu_title(menu_title));
+ EXPECT_CALL(*mock_app_, set_menu_icon(menu_icon));
+ EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+
+ EXPECT_CALL(
+ mock_hmi_interfaces_,
+ GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
+ .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
+
+ ON_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -452,7 +732,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRBrokenMenuIcon_Canceled) {
SmartObject vr_help_title("yes");
(*msg)[am::strings::msg_params][am::strings::vr_help_title] = vr_help_title;
SmartObject menu_icon(smart_objects::SmartType_Map);
- menu_icon[am::strings::value] = "1";
+ menu_icon[am::strings::value] = " 1";
(*msg)[am::strings::msg_params][am::hmi_request::menu_icon] = menu_icon;
EXPECT_CALL(app_mngr_, application(kConnectionKey))
@@ -460,10 +740,8 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRBrokenMenuIcon_Canceled) {
EXPECT_CALL(mock_message_helper_, VerifyImage(menu_icon, _, _))
.WillOnce((Return(mobile_apis::Result::ABORTED)));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
- EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(_)).Times(0);
EmptyExpectationsSetupHelper();
-
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -477,15 +755,28 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRBrokenVRHelp_Canceled) {
(*msg)[am::strings::msg_params][am::hmi_request::menu_icon] = menu_icon;
SmartObject vr_help_array(smart_objects::SmartType_Array);
VRArraySetupHelper(msg, vr_help_title, vr_help_array);
+ SmartObject menu_title("Menu_Title");
+ (*msg)[am::strings::msg_params][am::hmi_request::menu_title] = menu_title;
EXPECT_CALL(mock_message_helper_, VerifyImage(menu_icon, _, _))
.WillOnce((Return(mobile_apis::Result::SUCCESS)));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(vr_help_array, _, _))
.WillOnce((Return(mobile_apis::Result::ABORTED)));
- EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(_)).Times(0);
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
+ EXPECT_CALL(*mock_app_, vr_help()).WillOnce(Return(&vr_help_array));
+ EXPECT_CALL(*mock_app_, set_vr_help_title(vr_help_title));
+ EXPECT_CALL(*mock_app_, set_vr_help(vr_help_array));
+ EXPECT_CALL(*mock_app_, set_menu_title(menu_title));
+ EXPECT_CALL(*mock_app_, set_menu_icon(menu_icon));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -509,7 +800,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRIncorrectSyntax_Canceled) {
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(_)).Times(0);
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -530,7 +821,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRMissingTitle_Canceled) {
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -547,7 +838,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRMissingArray_Canceled) {
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -568,7 +859,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRWrongOrder_Canceled) {
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -586,8 +877,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVR_SUCCESS) {
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- SmartObject vr_help_title("Menu_Title");
- EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
EXPECT_CALL(*mock_app_, set_menu_title(menu_title));
EXPECT_CALL(*mock_app_, set_menu_icon(_)).Times(0);
EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
@@ -601,7 +890,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVR_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -617,23 +906,11 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRCouldNotGenerate_INVALID_DATA) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
- EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- SmartObject* vr_help_title = NULL;
- CommandsMap commands_map;
- SmartObject empty_msg(smart_objects::SmartType_Map);
- commands_map.insert(std::pair<uint32_t, SmartObject*>(1u, &empty_msg));
- DataAccessor<CommandsMap> accessor(commands_map, lock_ptr_);
- EXPECT_CALL(*mock_app_, commands_map()).WillOnce(Return(accessor));
- EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(vr_help_title));
- EXPECT_CALL(*mock_app_, set_menu_title(_)).Times(0);
+ EXPECT_CALL(*mock_app_, set_menu_title(menu_title));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
- EXPECT_CALL(
- mock_rpc_service_,
- ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::INVALID_DATA),
- am::commands::Command::SOURCE_SDL));
command->Run();
}
@@ -648,17 +925,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataNoDefault_Canceled) {
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- SmartObject vr_help_title(smart_objects::SmartType_Null);
- EXPECT_CALL(*mock_app_, vr_help_title())
- .WillOnce(Return(&vr_help_title))
- .WillOnce(Return(&vr_help_title));
-
- CommandsMap commands_map;
- DataAccessor<CommandsMap> accessor(commands_map, lock_ptr_);
- EXPECT_CALL(*mock_app_, commands_map()).WillOnce(Return(accessor));
- const CustomString name("name");
- EXPECT_CALL(*mock_app_, name()).WillOnce(ReturnRef(name));
- EXPECT_CALL(*mock_app_, set_vr_help_title(SmartObject(name)));
EXPECT_CALL(*mock_app_, set_menu_title(_)).Times(0);
EXPECT_CALL(*mock_app_, set_menu_icon(_)).Times(0);
EXPECT_CALL(*mock_app_, set_keyboard_props(_));
@@ -672,7 +938,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataNoDefault_Canceled) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -688,23 +954,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataDefaultCreated_SUCCESS) {
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- SmartObject vr_help_title(smart_objects::SmartType_Null);
- EXPECT_CALL(*mock_app_, vr_help_title())
- .Times(2)
- .WillRepeatedly(Return(&vr_help_title));
-
- CommandsMap commands_map;
- SmartObject command_text(smart_objects::SmartType_Map);
- commands_map[0] = &command_text;
- (*commands_map[0])[am::strings::vr_commands] = SmartObject("one");
- DataAccessor<CommandsMap> accessor(commands_map, lock_ptr_);
- EXPECT_CALL(*mock_app_, commands_map()).WillOnce(Return(accessor));
- EXPECT_CALL(*mock_app_, set_vr_help(_));
- const CustomString name("name");
- EXPECT_CALL(*mock_app_, name()).WillOnce(ReturnRef(name));
- EXPECT_CALL(*mock_app_, set_vr_help_title(SmartObject(name)));
- SmartObject vr_help_array(smart_objects::SmartType_Array);
- EXPECT_CALL(*mock_app_, vr_help()).WillOnce(Return(&vr_help_array));
EXPECT_CALL(*mock_app_, set_menu_title(_)).Times(0);
EXPECT_CALL(*mock_app_, set_menu_icon(_)).Times(0);
EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
@@ -717,7 +966,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataDefaultCreated_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -731,25 +980,14 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataFromSynonyms_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
- EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- SmartObject vr_help_title(smart_objects::SmartType_Null);
- EXPECT_CALL(*mock_app_, vr_help_title())
- .Times(2)
- .WillRepeatedly(Return(&vr_help_title));
-
- CommandsMap commands_map;
- DataAccessor<CommandsMap> accessor(commands_map, lock_ptr_);
- EXPECT_CALL(*mock_app_, commands_map()).WillOnce(Return(accessor));
+
SmartObject vr_help_array(smart_objects::SmartType_Array);
vr_help_array[0] = SmartObject(smart_objects::SmartType_Map);
vr_help_array[0][am::strings::text] = kText;
vr_help_array[0][am::strings::position] = kPosition;
SmartObject vr_synonyms(smart_objects::SmartType_Array);
vr_synonyms[0] = vr_help_array;
- const CustomString name("name");
- EXPECT_CALL(*mock_app_, name()).WillOnce(ReturnRef(name));
- EXPECT_CALL(*mock_app_, set_vr_help_title(SmartObject(name)));
EXPECT_CALL(*mock_app_, set_menu_title(_)).Times(0);
EXPECT_CALL(*mock_app_, set_menu_icon(_)).Times(0);
EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
@@ -761,7 +999,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataFromSynonyms_SUCCESS) {
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -784,8 +1022,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSHelpAndTimeout_SUCCESS) {
EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(timeout_prompt, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- SmartObject vr_help_title("title");
- EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
EXPECT_CALL(*mock_app_, set_help_prompt(help_prompt));
EXPECT_CALL(*mock_app_, help_prompt()).WillOnce(Return(&help_prompt));
EXPECT_CALL(*mock_app_, set_timeout_prompt(timeout_prompt));
@@ -800,7 +1036,12 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSHelpAndTimeout_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -818,8 +1059,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyHelp_SUCCESS) {
EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(help_prompt, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- SmartObject vr_help_title("title");
- EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
EXPECT_CALL(*mock_app_, set_help_prompt(help_prompt));
EXPECT_CALL(*mock_app_, help_prompt()).WillOnce(Return(&help_prompt));
EXPECT_CALL(*mock_app_, set_timeout_prompt(_)).Times(0);
@@ -832,7 +1071,11 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyHelp_SUCCESS) {
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -850,8 +1093,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyTimeout_SUCCESS) {
EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(timeout_prompt, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- SmartObject vr_help_title("title");
- EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
EXPECT_CALL(*mock_app_, set_help_prompt(_)).Times(0);
EXPECT_CALL(*mock_app_, help_prompt()).Times(0);
EXPECT_CALL(*mock_app_, set_timeout_prompt(timeout_prompt));
@@ -864,7 +1105,11 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyTimeout_SUCCESS) {
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -881,7 +1126,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSIncorrectSyntax_Canceled) {
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -897,7 +1142,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidHelpPromptText_INVALID_DATA) {
ExpectVerifyImageVrHelpUnsuccess();
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
ExpectInvalidData();
@@ -915,7 +1160,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidVrHelpText_INVALID_DATA) {
ExpectVerifyImageVrHelpSuccess(vr_help);
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
ExpectInvalidData();
@@ -934,7 +1179,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidImageValue_INVALID_DATA) {
ExpectVerifyImageVrHelpSuccess(vr_help);
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
ExpectInvalidData();
@@ -952,7 +1197,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidMenuIcon_INVALID_DATA) {
ExpectVerifyImageSuccess(menu_icon);
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
ExpectInvalidData();
@@ -969,7 +1214,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidMenuTitle_INVALID_DATA) {
ExpectVerifyImageVrHelpUnsuccess();
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
ExpectInvalidData();
@@ -989,7 +1234,7 @@ TEST_F(SetGlobalPropertiesRequestTest,
ExpectVerifyImageVrHelpUnsuccess();
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
ExpectInvalidData();
@@ -1009,7 +1254,7 @@ TEST_F(SetGlobalPropertiesRequestTest,
ExpectVerifyImageVrHelpUnsuccess();
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
ExpectInvalidData();
@@ -1023,7 +1268,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoData_Canceled) {
ExpectVerifyImageVrHelpUnsuccess();
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -1037,7 +1282,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidApp_Canceled) {
EmptyExpectationsSetupHelper();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -1049,12 +1294,17 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_PendingRequest_UNSUCCESS) {
hmi_apis::Common_Result::SUCCESS;
(*msg)[am::strings::params][am::hmi_response::code] = response_code;
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
event.set_smart_object(*msg);
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, true));
+
command->on_event(event);
}
@@ -1072,7 +1322,7 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndSuccessResultCode_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
OnEventUISetupHelper(msg, command);
@@ -1082,6 +1332,9 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndSuccessResultCode_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, true));
+
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
EXPECT_CALL(mock_rpc_service_,
@@ -1097,7 +1350,7 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndWarningResultCode_SUCCESS) {
hmi_apis::Common_Result::WARNINGS;
(*msg)[am::strings::params][am::hmi_response::code] = response_code;
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
ON_CALL(
mock_hmi_interfaces_,
@@ -1114,6 +1367,8 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndWarningResultCode_SUCCESS) {
Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
event.set_smart_object(*msg);
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, true));
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
EXPECT_CALL(mock_rpc_service_,
@@ -1135,7 +1390,7 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidApp_Canceled) {
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
OnEventUISetupHelper(msg, command);
@@ -1156,10 +1411,10 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidApp_Canceled) {
TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidEventID_Canceled) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).Times(0);
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
Event event(hmi_apis::FunctionID::TTS_Stopped);
@@ -1181,7 +1436,7 @@ TEST_F(SetGlobalPropertiesRequestTest,
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
OnEventTTSSetupHelper(msg, command);
@@ -1190,6 +1445,8 @@ TEST_F(SetGlobalPropertiesRequestTest,
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.WillOnce(Return(true));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, true));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -1213,7 +1470,7 @@ TEST_F(SetGlobalPropertiesRequestTest,
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
OnEventTTSSetupHelper(msg, command);
@@ -1221,6 +1478,9 @@ TEST_F(SetGlobalPropertiesRequestTest,
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+
MessageSharedPtr ui_command_result;
EXPECT_CALL(
mock_rpc_service_,
@@ -1229,6 +1489,8 @@ TEST_F(SetGlobalPropertiesRequestTest,
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, true));
Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
event.set_smart_object(*msg);
@@ -1244,6 +1506,51 @@ TEST_F(SetGlobalPropertiesRequestTest,
static_cast<int32_t>(hmi_apis::Common_Result::WARNINGS));
}
+TEST_F(SetGlobalPropertiesRequestTest,
+ PrepareResultCodeForResponse_AllResultsAreSUCCESS_TotalResultSUCCESS) {
+ using namespace application_manager;
+ using namespace hmi_apis;
+ const auto expected_total_result = mobile_apis::Result::eType::SUCCESS;
+
+ Common_Result::eType ui_result = Common_Result::SUCCESS;
+ Common_Result::eType tts_result = Common_Result::SUCCESS;
+ Common_Result::eType rc_result = Common_Result::SUCCESS;
+
+ app_mngr::commands::ResponseInfo ui_properties_info(
+ ui_result, HmiInterfaces::HMI_INTERFACE_UI, mock_app_manager_);
+
+ app_mngr::commands::ResponseInfo tts_properties_info(
+ tts_result, HmiInterfaces::HMI_INTERFACE_TTS, mock_app_manager_);
+
+ app_mngr::commands::ResponseInfo rc_properties_info(
+ rc_result, HmiInterfaces::HMI_INTERFACE_RC, mock_app_manager_);
+
+ MessageSharedPtr msg = CreateMsgParams();
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ auto result = command->PrepareResultCodeForResponse(
+ ui_properties_info, tts_properties_info, rc_properties_info);
+
+ EXPECT_EQ(expected_total_result, result);
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ PrepareResultCodeForResponse_UNSUPPORTED) {
+ PrepareResultCodeForResponse_CheckAllResultsForSpecifiedTotalResult(
+ mobile_apis::Result::UNSUPPORTED_RESOURCE);
+}
+
+TEST_F(SetGlobalPropertiesRequestTest, PrepareResultCodeForResponse_WARNINGS) {
+ PrepareResultCodeForResponse_CheckAllResultsForSpecifiedTotalResult(
+ mobile_apis::Result::WARNINGS);
+}
+
+TEST_F(SetGlobalPropertiesRequestTest,
+ PrepareResultForMobileResponse_AllCases) {
+ PrepareResultForMobileResponse_CheckResultsForAllCases();
+}
+
} // namespace set_global_properties_request
} // namespace mobile_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc
index 9d2dd996bc..86d15e76f2 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc
@@ -35,13 +35,13 @@
#include "mobile/set_media_clock_timer_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -50,17 +50,18 @@ namespace mobile_commands_test {
namespace set_media_clock_timer_request {
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::SetMediaClockRequest;
+using am::MockMessageHelper;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
+using sdl_rpc_plugin::commands::SetMediaClockRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
namespace UpdateMode = mobile_apis::UpdateMode;
+namespace AudioStreamingIndicator = mobile_apis::AudioStreamingIndicator;
-typedef SharedPtr<SetMediaClockRequest> SetMediaClockRequestPtr;
+typedef std::shared_ptr<SetMediaClockRequest> SetMediaClockRequestPtr;
namespace {
const uint32_t kConnectionKey = 2u;
@@ -116,7 +117,7 @@ TEST_F(SetMediaClockRequestTest,
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
- utils::SharedPtr<SetMediaClockRequest> command =
+ std::shared_ptr<SetMediaClockRequest> command =
CreateCommand<SetMediaClockRequest>(msg);
MessageSharedPtr ev_msg = CreateMessage(smart_objects::SmartType_Map);
@@ -159,8 +160,10 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountUp_SUCCESS) {
kMinutes;
(*msg)[am::strings::msg_params][am::strings::end_time][am::strings::seconds] =
kSeconds;
+ (*msg)[am::strings::msg_params][am::strings::audioStreamingIndicator] =
+ AudioStreamingIndicator::PLAY;
- SharedPtr<SetMediaClockRequest> command(
+ std::shared_ptr<SetMediaClockRequest> command(
CreateCommand<SetMediaClockRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
@@ -176,7 +179,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountUp_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
command->Run();
}
@@ -195,8 +198,10 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountDown_SUCCESS) {
kHours;
(*msg)[am::strings::msg_params][am::strings::end_time][am::strings::minutes] =
kMinutes;
+ (*msg)[am::strings::msg_params][am::strings::audioStreamingIndicator] =
+ AudioStreamingIndicator::PLAY;
- SharedPtr<SetMediaClockRequest> command(
+ std::shared_ptr<SetMediaClockRequest> command(
CreateCommand<SetMediaClockRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
@@ -212,7 +217,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountDown_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
command->Run();
}
@@ -231,8 +236,10 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountUpWrongTime_Canceled) {
kHours;
(*msg)[am::strings::msg_params][am::strings::end_time][am::strings::minutes] =
kMinutes;
+ (*msg)[am::strings::msg_params][am::strings::audioStreamingIndicator] =
+ AudioStreamingIndicator::PLAY_PAUSE;
- SharedPtr<SetMediaClockRequest> command(
+ std::shared_ptr<SetMediaClockRequest> command(
CreateCommand<SetMediaClockRequest>(msg));
ExpectationsSetupHelper(true);
@@ -254,8 +261,10 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountDownWrongTime_Canceled) {
kMinutes;
(*msg)[am::strings::msg_params][am::strings::end_time][am::strings::seconds] =
kSeconds;
+ (*msg)[am::strings::msg_params][am::strings::audioStreamingIndicator] =
+ AudioStreamingIndicator::PLAY_PAUSE;
- SharedPtr<SetMediaClockRequest> command(
+ std::shared_ptr<SetMediaClockRequest> command(
CreateCommand<SetMediaClockRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
@@ -273,7 +282,7 @@ TEST_F(SetMediaClockRequestTest, Run_NoStartTime_Canceled) {
(*msg)[am::strings::msg_params][am::strings::update_mode] =
UpdateMode::COUNTDOWN;
- SharedPtr<SetMediaClockRequest> command(
+ std::shared_ptr<SetMediaClockRequest> command(
CreateCommand<SetMediaClockRequest>(msg));
ExpectationsSetupHelper(true);
@@ -284,7 +293,7 @@ TEST_F(SetMediaClockRequestTest, Run_NoStartTime_Canceled) {
TEST_F(SetMediaClockRequestTest, Run_NoUpdateMode_Canceled) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<SetMediaClockRequest> command(
+ std::shared_ptr<SetMediaClockRequest> command(
CreateCommand<SetMediaClockRequest>(msg));
ExpectationsSetupHelper(true);
@@ -295,7 +304,7 @@ TEST_F(SetMediaClockRequestTest, Run_NoUpdateMode_Canceled) {
TEST_F(SetMediaClockRequestTest, Run_NotMediaApp_Canceled) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<SetMediaClockRequest> command(
+ std::shared_ptr<SetMediaClockRequest> command(
CreateCommand<SetMediaClockRequest>(msg));
ExpectationsSetupHelper(false);
@@ -306,7 +315,7 @@ TEST_F(SetMediaClockRequestTest, Run_NotMediaApp_Canceled) {
TEST_F(SetMediaClockRequestTest, Run_InvalidApp_Canceled) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<SetMediaClockRequest> command(
+ std::shared_ptr<SetMediaClockRequest> command(
CreateCommand<SetMediaClockRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
@@ -332,7 +341,7 @@ TEST_F(SetMediaClockRequestTest, OnEvent_Success) {
Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer);
event.set_smart_object(*msg);
- SharedPtr<SetMediaClockRequest> command(
+ std::shared_ptr<SetMediaClockRequest> command(
CreateCommand<SetMediaClockRequest>(msg));
command->on_event(event);
}
@@ -340,7 +349,7 @@ TEST_F(SetMediaClockRequestTest, OnEvent_Success) {
TEST_F(SetMediaClockRequestTest, OnEvent_Canceled) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<SetMediaClockRequest> command(
+ std::shared_ptr<SetMediaClockRequest> command(
CreateCommand<SetMediaClockRequest>(msg));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
Event event(hmi_apis::FunctionID::UI_Slider);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
index 9d5497d4a7..b8cfdd4bfc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
@@ -31,19 +31,21 @@
*/
#include <stdint.h>
-#include <string>
+#include <array>
+#include <memory>
#include <set>
+#include <string>
#include "mobile/show_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -52,12 +54,11 @@ namespace mobile_commands_test {
namespace show_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::ShowRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
+using sdl_rpc_plugin::commands::ShowRequest;
using test::components::policy_test::MockPolicyHandlerInterface;
-using ::utils::SharedPtr;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -68,8 +69,28 @@ const uint32_t kAppId = 1u;
const uint32_t kCmdId = 1u;
const uint32_t kConnectionKey = 2u;
const uint32_t kFunctionID = 3u;
+const std::string kCurrentTemplatelayout = "current_template_layout";
+const std::string kNewTemplateLayout = "new_template_layout";
+const app_mngr::WindowID kCurrentWindowID = 1;
+typedef std::array<int, 3> rgb_color_scheme;
+const rgb_color_scheme kCurrentDayColorRGB = {75, 75, 75};
+const rgb_color_scheme kCurrentNightColorRGB = {200, 200, 200};
+const rgb_color_scheme kNewDayColorRGB = {80, 80, 80};
+const rgb_color_scheme kNewNightColorRGB = {222, 222, 222};
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
+MATCHER_P2(CheckMessageToMobile, result_code, success, "") {
+ const bool is_success =
+ (*arg)[am::strings::msg_params][am::strings::success].asBool() == success;
+
+ const bool is_result_code_correct =
+ (*arg)[am::strings::msg_params][am::strings::result_code].asInt() ==
+ static_cast<int32_t>(result_code);
+ return is_success && is_result_code_correct;
+}
+
class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
ShowRequestTest() {
@@ -104,6 +125,101 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
return msg;
}
+ protected:
+ void SetUp() OVERRIDE {
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+ }
+
+ smart_objects::SmartObject CreateColorScheme(
+ const rgb_color_scheme& rgb_color_scheme) {
+ using namespace application_manager;
+
+ smart_objects::SmartObject primary_color(smart_objects::SmartType_Map);
+ smart_objects::SmartObject secondary_color(smart_objects::SmartType_Map);
+ smart_objects::SmartObject background_color(smart_objects::SmartType_Map);
+
+ primary_color[strings::red] = rgb_color_scheme[0];
+ primary_color[strings::green] = rgb_color_scheme[1];
+ primary_color[strings::blue] = rgb_color_scheme[2];
+
+ secondary_color[strings::red] = rgb_color_scheme[0];
+ secondary_color[strings::green] = rgb_color_scheme[1];
+ secondary_color[strings::blue] = rgb_color_scheme[2];
+
+ background_color[strings::red] = rgb_color_scheme[0];
+ background_color[strings::green] = rgb_color_scheme[1];
+ background_color[strings::blue] = rgb_color_scheme[2];
+
+ smart_objects::SmartObject color_scheme(smart_objects::SmartType_Map);
+ color_scheme[strings::primary_color] = primary_color;
+ color_scheme[strings::secondary_color] = secondary_color;
+ color_scheme[strings::background_color] = background_color;
+
+ return color_scheme;
+ }
+
+ smart_objects::SmartObject CreateTemplateConfiguration(
+ const std::string& layout) {
+ using namespace application_manager;
+
+ smart_objects::SmartObject template_configuration(
+ smart_objects::SmartType_Map);
+
+ template_configuration[strings::template_layout] = layout;
+
+ template_configuration[strings::day_color_scheme] =
+ CreateColorScheme(kCurrentDayColorRGB);
+
+ template_configuration[strings::night_color_scheme] =
+ CreateColorScheme(kCurrentNightColorRGB);
+
+ return template_configuration;
+ }
+
+ MessageSharedPtr CreateMessageWithTemplateLayout(const std::string& layout) {
+ auto msg = CreateMsgParams();
+ (*msg)[app_mngr::strings::msg_params][app_mngr::strings::window_id] =
+ kCurrentWindowID;
+ (*msg)[am::strings::msg_params][am::strings::template_configuration] =
+ CreateTemplateConfiguration(layout);
+
+ return msg;
+ }
+
+ std::shared_ptr<ShowRequest> SetupHelperLayout(
+ const std::string& layout,
+ const rgb_color_scheme& day_colors,
+ const rgb_color_scheme& night_colors) {
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Show),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ const auto current_day_color_scheme = CreateColorScheme(day_colors);
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+ const auto current_night_color_scheme = CreateColorScheme(night_colors);
+ ON_CALL(*mock_app_, night_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+
+ auto msg = CreateMessageWithTemplateLayout(layout);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+ return command;
+ }
+
void TestSetupHelper(MessageSharedPtr msg,
hmi_apis::Common_TextFieldName::eType field_name,
const char* field) {
@@ -125,7 +241,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
static_cast<int32_t>(field_name);
msg_params[am::hmi_request::show_strings][0][am::hmi_request::field_text] =
text_field_;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
}
@@ -143,7 +259,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
}
@@ -196,7 +312,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
}
}
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
}
@@ -211,7 +327,7 @@ TEST_F(ShowRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
(*msg_vr)[am::strings::msg_params][am::strings::menu_params]
[am::strings::menu_name] = "menu_name";
- utils::SharedPtr<ShowRequest> command = CreateCommand<ShowRequest>(msg_vr);
+ std::shared_ptr<ShowRequest> command = CreateCommand<ShowRequest>(msg_vr);
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(kConnectionKey))
@@ -257,7 +373,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) {
msg_params[am::strings::soft_buttons] = "Soft_Buttons";
(*msg)[am::strings::msg_params] = msg_params;
SmartObject creation_msg_params(msg_params);
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -269,10 +385,10 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) {
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(
- mock_message_helper_,
- SubscribeApplicationToSoftButton(creation_msg_params, _, kFunctionID));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_message_helper_,
+ SubscribeApplicationToSoftButton(
+ creation_msg_params, _, kFunctionID, kDefaultWindowId));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -284,7 +400,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) {
SmartObject msg_params(smart_objects::SmartType_Map);
msg_params[am::strings::soft_buttons] = "";
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -296,7 +412,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) {
smart_objects::SmartObject(smart_objects::SmartType_Array);
EXPECT_CALL(*mock_app_, UnsubscribeFromSoftButtons(kFunctionID));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -309,7 +425,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) {
msg_params[am::strings::soft_buttons] = "Soft_Buttons";
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -319,9 +435,10 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) {
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_message_helper_, SubscribeApplicationToSoftButton(_, _, _))
+ EXPECT_CALL(mock_message_helper_,
+ SubscribeApplicationToSoftButton(_, _, _, kDefaultWindowId))
.Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
command->Run();
@@ -336,7 +453,7 @@ TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) {
msg_params[am::strings::graphic] = graphic;
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -348,7 +465,34 @@ TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) {
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
+ EXPECT_CALL(*mock_app_, set_show_command(msg_params));
+
+ command->Run();
+}
+
+TEST_F(ShowRequestTest, Run_Graphic_WARNINGS) {
+ MessageSharedPtr msg = CreateMsgParams();
+
+ SmartObject msg_params(smart_objects::SmartType_Map);
+ SmartObject graphic(smart_objects::SmartType_Map);
+ graphic[am::strings::value] = "1";
+ msg_params[am::strings::graphic] = graphic;
+ (*msg)[am::strings::msg_params] = msg_params;
+
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ EXPECT_CALL(mock_message_helper_, VerifyImage(graphic, _, _))
+ .WillOnce(Return(mobile_apis::Result::WARNINGS));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+
+ msg_params[am::strings::app_id] = kAppId;
+ msg_params[am::hmi_request::show_strings] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -363,15 +507,15 @@ TEST_F(ShowRequestTest, Run_Graphic_Canceled) {
msg_params[am::strings::graphic] = graphic;
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_message_helper_, VerifyImage(graphic, _, _))
- .WillOnce(Return(mobile_apis::Result::ABORTED));
+ .WillOnce(Return(mobile_apis::Result::INVALID_DATA));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
@@ -386,7 +530,7 @@ TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) {
msg_params[am::strings::graphic] = graphic;
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -394,7 +538,7 @@ TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) {
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
@@ -409,7 +553,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) {
msg_params[am::strings::secondary_graphic] = graphic;
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -420,7 +564,33 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) {
msg_params[am::strings::app_id] = kAppId;
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
+ EXPECT_CALL(*mock_app_, set_show_command(msg_params));
+
+ command->Run();
+}
+
+TEST_F(ShowRequestTest, Run_SecondaryGraphic_WARNINGS) {
+ MessageSharedPtr msg = CreateMsgParams();
+
+ SmartObject msg_params(smart_objects::SmartType_Map);
+ SmartObject graphic(smart_objects::SmartType_Map);
+ graphic[am::strings::value] = "1";
+ msg_params[am::strings::secondary_graphic] = graphic;
+ (*msg)[am::strings::msg_params] = msg_params;
+
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ EXPECT_CALL(mock_message_helper_, VerifyImage(graphic, _, _))
+ .WillOnce(Return(mobile_apis::Result::WARNINGS));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+
+ msg_params[am::strings::app_id] = kAppId;
+ msg_params[am::hmi_request::show_strings] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -435,16 +605,16 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) {
msg_params[am::strings::secondary_graphic] = graphic;
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_message_helper_, VerifyImage(graphic, _, _))
- .WillOnce(Return(mobile_apis::Result::ABORTED));
+ .WillOnce(Return(mobile_apis::Result::INVALID_DATA));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
@@ -459,7 +629,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) {
msg_params[am::strings::secondary_graphic] = graphic;
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -467,7 +637,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) {
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
@@ -476,7 +646,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) {
TEST_F(ShowRequestTest, Run_MainField1_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_1";
TestSetupHelper(msg,
@@ -489,7 +659,7 @@ TEST_F(ShowRequestTest, Run_MainField1_SUCCESS) {
TEST_F(ShowRequestTest, Run_MainField1_WrongSyntax) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_1\\n";
TestSetupHelperWrongSyntax(msg,
@@ -502,7 +672,7 @@ TEST_F(ShowRequestTest, Run_MainField1_WrongSyntax) {
TEST_F(ShowRequestTest, Run_MainField2_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_2";
TestSetupHelper(msg,
@@ -514,7 +684,7 @@ TEST_F(ShowRequestTest, Run_MainField2_SUCCESS) {
TEST_F(ShowRequestTest, Run_MainField2_WrongSyntax) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_2\\n";
TestSetupHelperWrongSyntax(msg,
@@ -526,7 +696,7 @@ TEST_F(ShowRequestTest, Run_MainField2_WrongSyntax) {
TEST_F(ShowRequestTest, Run_MainField3_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_3";
TestSetupHelper(msg,
@@ -538,7 +708,7 @@ TEST_F(ShowRequestTest, Run_MainField3_SUCCESS) {
TEST_F(ShowRequestTest, Run_MainField3_WrongSyntax) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_3\\n";
TestSetupHelperWrongSyntax(msg,
@@ -550,7 +720,7 @@ TEST_F(ShowRequestTest, Run_MainField3_WrongSyntax) {
TEST_F(ShowRequestTest, Run_MainField4_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_4";
TestSetupHelper(msg,
@@ -562,7 +732,7 @@ TEST_F(ShowRequestTest, Run_MainField4_SUCCESS) {
TEST_F(ShowRequestTest, Run_MainField4_WrongSyntax) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_4\\n";
TestSetupHelperWrongSyntax(msg,
@@ -574,7 +744,7 @@ TEST_F(ShowRequestTest, Run_MainField4_WrongSyntax) {
TEST_F(ShowRequestTest, Run_MainField1_MetadataTag) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_1";
const size_t num_tags = 1;
@@ -590,7 +760,7 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTag) {
TEST_F(ShowRequestTest, Run_MainField1_MultipleMetadataTags) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_1";
const size_t num_tags = 5;
@@ -610,7 +780,7 @@ TEST_F(ShowRequestTest, Run_MainField1_MultipleMetadataTags) {
TEST_F(ShowRequestTest, Run_MainField2_MetadataTag) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_2";
const size_t num_tags = 1;
@@ -626,7 +796,7 @@ TEST_F(ShowRequestTest, Run_MainField2_MetadataTag) {
TEST_F(ShowRequestTest, Run_MainField3_MetadataTag) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_3";
const size_t num_tags = 1;
@@ -642,7 +812,7 @@ TEST_F(ShowRequestTest, Run_MainField3_MetadataTag) {
TEST_F(ShowRequestTest, Run_MainField4_MetadataTag) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_4";
const size_t num_tags = 1;
@@ -658,7 +828,7 @@ TEST_F(ShowRequestTest, Run_MainField4_MetadataTag) {
TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Main_Field_1";
const size_t num_tags = 1;
@@ -676,10 +846,14 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
hmi_apis::Common_Result::SUCCESS;
(*ev_msg)[am::strings::msg_params][am::strings::app_id] = kConnectionKey;
(*ev_msg)[am::strings::msg_params][am::strings::info] = "";
+ (*ev_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*ev_msg);
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
MessageSharedPtr ui_command_result;
EXPECT_CALL(
mock_rpc_service_,
@@ -700,7 +874,7 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
TEST_F(ShowRequestTest, Run_MediaClock_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Media_Clock";
TestSetupHelper(msg,
@@ -712,7 +886,7 @@ TEST_F(ShowRequestTest, Run_MediaClock_SUCCESS) {
TEST_F(ShowRequestTest, Run_MediaClock_WrongSyntax) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Media_Clock\\n";
TestSetupHelperWrongSyntax(msg,
@@ -724,7 +898,7 @@ TEST_F(ShowRequestTest, Run_MediaClock_WrongSyntax) {
TEST_F(ShowRequestTest, Run_MediaTrack_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Media_Track";
TestSetupHelper(msg,
@@ -736,7 +910,7 @@ TEST_F(ShowRequestTest, Run_MediaTrack_SUCCESS) {
TEST_F(ShowRequestTest, Run_MediaTrack_WrongSyntax) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Media_Track\\n";
TestSetupHelperWrongSyntax(msg,
@@ -748,7 +922,7 @@ TEST_F(ShowRequestTest, Run_MediaTrack_WrongSyntax) {
TEST_F(ShowRequestTest, Run_StatusBar_SUCCESS) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Status_Bar";
TestSetupHelper(
@@ -759,7 +933,7 @@ TEST_F(ShowRequestTest, Run_StatusBar_SUCCESS) {
TEST_F(ShowRequestTest, Run_StatusBar_WrongSyntax) {
MessageSharedPtr msg = CreateMessage();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
text_field_ = "Status_Bar\\n";
TestSetupHelperWrongSyntax(
@@ -773,7 +947,7 @@ TEST_F(ShowRequestTest, Run_Alignment_SUCCESS) {
msg_params[am::strings::alignment] = "Alignment";
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -783,7 +957,7 @@ TEST_F(ShowRequestTest, Run_Alignment_SUCCESS) {
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -797,7 +971,7 @@ TEST_F(ShowRequestTest, Run_CustomPresets_SUCCESS) {
msg_params[am::strings::custom_presets] = custom_presets;
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -806,7 +980,7 @@ TEST_F(ShowRequestTest, Run_CustomPresets_SUCCESS) {
msg_params[am::strings::app_id] = kAppId;
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
@@ -820,47 +994,341 @@ TEST_F(ShowRequestTest, Run_CustomPresets_WrongSyntax) {
msg_params[am::strings::custom_presets] = custom_presets;
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
command->Run();
}
-TEST_F(ShowRequestTest, Run_InvalidApp_Canceled) {
+TEST_F(ShowRequestTest,
+ Run_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<ShowRequest>(msg);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) {
MessageSharedPtr msg = CreateMsgParams();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(MockAppPtr()));
+ .WillOnce(Return(mock_app_));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
+ ASSERT_TRUE(command->Init());
command->Run();
}
-TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) {
- MessageSharedPtr msg = CreateMsgParams();
+TEST_F(ShowRequestTest,
+ Run_WindowWithIDDoesNotExist_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ ON_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillByDefault(Return(false));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kCurrentWindowID;
+
+ auto command = CreateCommand<ShowRequest>(msg);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest,
+ Run_NoLayoutChangeWithoutBothColorScheme_SendRequestToHMI_SUCCESS) {
+ auto msg = CreateMsgParams();
+ (*msg)[app_mngr::strings::msg_params][app_mngr::strings::window_id] =
+ kCurrentWindowID;
+ (*msg)[am::strings::msg_params][am::strings::template_configuration]
+ [am::strings::template_layout] = kCurrentTemplatelayout;
+
+ auto command(CreateCommand<ShowRequest>(msg));
+
+ auto message_to_hmi = CreateMessage();
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_hmi), Return(true)));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const auto template_layout =
+ (*message_to_hmi)[am::strings::msg_params]
+ [am::strings::template_configuration]
+ [am::strings::template_layout]
+ .asString();
+ EXPECT_EQ(kCurrentTemplatelayout, template_layout);
+}
+
+TEST_F(ShowRequestTest,
+ Run_NoLayoutChangeDayColorSchemesNotEqual_Response_REJECTED) {
+ auto msg = CreateMessageWithTemplateLayout(kCurrentTemplatelayout);
+
+ const auto current_day_color_scheme = CreateColorScheme(kNewDayColorRGB);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+
+ auto message_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const bool success =
+ (*message_to_mobile)[am::strings::msg_params][am::strings::success]
+ .asBool();
+ EXPECT_FALSE(success);
+
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*message_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+
+ EXPECT_EQ(mobile_apis::Result::REJECTED, result_code);
+}
+
+TEST_F(ShowRequestTest,
+ Run_NoLayoutChangeNightColorSchemesNotEqual_Response_REJECTED) {
+ auto msg = CreateMessageWithTemplateLayout(kCurrentTemplatelayout);
+
+ const auto current_night_color_scheme = CreateColorScheme(kNewNightColorRGB);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+
+ auto message_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const bool success =
+ (*message_to_mobile)[am::strings::msg_params][am::strings::success]
+ .asBool();
+ EXPECT_FALSE(success);
+
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*message_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+
+ EXPECT_EQ(mobile_apis::Result::REJECTED, result_code);
+}
+
+TEST_F(ShowRequestTest,
+ Run_LayoutNotChangeBothColorSchemeEqual_SendRequestToHMI_SUCCESS) {
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Show),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillOnce(Return(true));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
- EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
- EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
- EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
+ const auto current_day_color_scheme = CreateColorScheme(kCurrentDayColorRGB);
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+ const auto current_night_color_scheme =
+ CreateColorScheme(kCurrentNightColorRGB);
+ ON_CALL(*mock_app_, night_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+
+ auto msg = CreateMessageWithTemplateLayout(kCurrentTemplatelayout);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest,
+ Run_LayoutChangeBothColorSchemeNotEqual_SendRequestToHMI_SUCCESS) {
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Show),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ const auto current_day_color_scheme = CreateColorScheme(kNewDayColorRGB);
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+ const auto current_night_color_scheme = CreateColorScheme(kNewNightColorRGB);
+ ON_CALL(*mock_app_, night_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+
+ auto msg = CreateMessageWithTemplateLayout(kNewTemplateLayout);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_ExpectSetWindowLayoutOnly) {
+ // Precondition
+ auto command =
+ SetupHelperLayout(kNewTemplateLayout, kNewDayColorRGB, kNewNightColorRGB);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_,
+ set_window_layout(kCurrentWindowID, kNewTemplateLayout));
+ EXPECT_CALL(*mock_app_, set_day_color_scheme(_, _));
+ EXPECT_CALL(*mock_app_, set_night_color_scheme(_, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+
+ command->on_event(event);
+}
+
+TEST_F(ShowRequestTest,
+ OnEvent_SuccessResultCode_ExpectSetWindowLayoutAndSetDayColorScheme) {
+ // Precondition
+ auto command = SetupHelperLayout(
+ kNewTemplateLayout, kCurrentDayColorRGB, kNewNightColorRGB);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_,
+ set_window_layout(kCurrentWindowID, kNewTemplateLayout));
+ EXPECT_CALL(*mock_app_,
+ set_day_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentDayColorRGB)));
+ EXPECT_CALL(*mock_app_, set_night_color_scheme(_, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+
+ command->on_event(event);
+}
+
+TEST_F(ShowRequestTest,
+ OnEvent_SuccessResultCode_ExpectSetWindowLayoutAndBothColorScheme) {
+ // Precondition
+ auto command = SetupHelperLayout(
+ kNewTemplateLayout, kCurrentDayColorRGB, kCurrentNightColorRGB);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_,
+ set_window_layout(kCurrentWindowID, kNewTemplateLayout));
+ EXPECT_CALL(*mock_app_,
+ set_day_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentDayColorRGB)));
+ EXPECT_CALL(*mock_app_,
+ set_night_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentNightColorRGB)));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+
+ command->on_event(event);
+}
+
+TEST_F(ShowRequestTest,
+ OnEvent_SuccessResultCode_ExpectBothColorSchemeWithoutSetWindowLayout) {
+ // Precondition
+ auto command = SetupHelperLayout(
+ kCurrentTemplatelayout, kCurrentDayColorRGB, kCurrentNightColorRGB);
+ ASSERT_TRUE(command->Init());
command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_, set_window_layout(_, _)).Times(0);
+ EXPECT_CALL(*mock_app_,
+ set_day_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentDayColorRGB)));
+ EXPECT_CALL(*mock_app_,
+ set_night_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentNightColorRGB)));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+
+ command->on_event(event);
}
TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) {
@@ -869,7 +1337,7 @@ TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) {
hmi_apis::Common_Result::eType::SUCCESS;
(*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS), _));
@@ -878,7 +1346,7 @@ TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) {
event.set_smart_object(*msg);
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
-
+ ASSERT_TRUE(command->Init());
command->on_event(event);
}
@@ -889,7 +1357,7 @@ TEST_F(ShowRequestTest, OnEvent_WarningsResultCode_SUCCESS) {
(*msg)[am::strings::params][am::hmi_response::message] = "Response Info";
(*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
Event event(hmi_apis::FunctionID::UI_Show);
@@ -904,8 +1372,12 @@ TEST_F(ShowRequestTest, OnEvent_WrongFunctionID_Canceled) {
MessageSharedPtr msg = CreateMessage();
(*msg)[am::strings::params][am::hmi_response::code] =
mobile_apis::Result::SUCCESS;
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
Event event(hmi_apis::FunctionID::UI_Alert);
@@ -918,4 +1390,4 @@ TEST_F(ShowRequestTest, OnEvent_WrongFunctionID_Canceled) {
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc
index dcdda55b1c..6e85aff281 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc
@@ -34,17 +34,17 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/mock_message_helper.h"
+
#include "application_manager/commands/command_impl.h"
#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
#include "mobile/on_app_interface_unregistered_notification.h"
#include "mobile/on_audio_pass_thru_notification.h"
#include "mobile/on_driver_distraction_notification.h"
#include "mobile/on_language_change_notification.h"
#include "mobile/on_permissions_change_notification.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -56,8 +56,8 @@ namespace am = ::application_manager;
namespace commands = sdl_rpc_plugin::commands;
using ::testing::_;
-using ::testing::Types;
using ::testing::Return;
+using ::testing::Types;
template <class Command>
class MobileNotificationCommandsTest
@@ -85,7 +85,7 @@ MATCHER(CheckNotificationMessage, "") {
TYPED_TEST_CASE(MobileNotificationCommandsTest, NotificationCommandsList);
TYPED_TEST(MobileNotificationCommandsTest, Run_SendMessageToMobile_SUCCESS) {
- ::utils::SharedPtr<typename TestFixture::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
EXPECT_CALL(this->mock_rpc_service_,
SendMessageToMobile(CheckNotificationMessage(), _));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc
index cf1f7c6711..0034dcf916 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc
@@ -35,40 +35,39 @@
#include "gtest/gtest.h"
#include "utils/helpers.h"
-#include "utils/shared_ptr.h"
+
#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application_manager.h"
-#include "mobile/delete_command_response.h"
+#include "mobile/add_command_response.h"
+#include "mobile/add_sub_menu_response.h"
#include "mobile/alert_maneuver_response.h"
#include "mobile/alert_response.h"
-#include "mobile/list_files_response.h"
-#include "mobile/subscribe_button_response.h"
-#include "mobile/add_sub_menu_response.h"
+#include "mobile/change_registration_response.h"
+#include "mobile/delete_command_response.h"
#include "mobile/dial_number_response.h"
#include "mobile/end_audio_pass_thru_response.h"
-#include "mobile/unregister_app_interface_response.h"
-#include "mobile/unsubscribe_button_response.h"
-#include "mobile/unsubscribe_way_points_response.h"
-#include "mobile/update_turn_list_response.h"
-#include "mobile/slider_response.h"
-#include "mobile/speak_response.h"
-#include "mobile/subscribe_way_points_response.h"
-#include "mobile/system_response.h"
+#include "mobile/generic_response.h"
#include "mobile/get_way_points_response.h"
-#include "mobile/perform_interaction_response.h"
+#include "mobile/list_files_response.h"
#include "mobile/perform_audio_pass_thru_response.h"
+#include "mobile/perform_interaction_response.h"
+#include "mobile/scrollable_message_response.h"
+#include "mobile/send_location_response.h"
+#include "mobile/set_app_icon_response.h"
+#include "mobile/set_display_layout_response.h"
#include "mobile/set_global_properties_response.h"
#include "mobile/set_media_clock_timer_response.h"
#include "mobile/show_constant_tbt_response.h"
#include "mobile/show_response.h"
-#include "mobile/add_command_response.h"
-#include "mobile/send_location_response.h"
-#include "mobile/set_app_icon_response.h"
-#include "mobile/set_display_layout_response.h"
-#include "mobile/generic_response.h"
-#include "mobile/set_app_icon_response.h"
-#include "mobile/scrollable_message_response.h"
-#include "mobile/change_registration_response.h"
+#include "mobile/slider_response.h"
+#include "mobile/speak_response.h"
+#include "mobile/subscribe_button_response.h"
+#include "mobile/subscribe_way_points_response.h"
+#include "mobile/system_response.h"
+#include "mobile/unregister_app_interface_response.h"
+#include "mobile/unsubscribe_button_response.h"
+#include "mobile/unsubscribe_way_points_response.h"
+#include "mobile/update_turn_list_response.h"
namespace test {
namespace components {
@@ -120,12 +119,13 @@ typedef Types<commands::ListFilesResponse,
commands::SendLocationResponse,
commands::SetAppIconResponse,
commands::SetDisplayLayoutResponse,
- commands::ChangeRegistrationResponse> ResponseCommandsList;
+ commands::ChangeRegistrationResponse>
+ ResponseCommandsList;
TYPED_TEST_CASE(MobileResponseCommandsTest, ResponseCommandsList);
TYPED_TEST(MobileResponseCommandsTest, Run_SendResponseToMobile_SUCCESS) {
- ::utils::SharedPtr<typename TestFixture::CommandType> command =
+ std::shared_ptr<typename TestFixture::CommandType> command =
this->template CreateCommand<typename TestFixture::CommandType>();
EXPECT_CALL(this->mock_rpc_service_, SendMessageToMobile(NotNull(), _));
command->Run();
@@ -154,7 +154,7 @@ MATCHER_P2(CheckMessageParams, success, result, "") {
TEST_F(GenericResponseFromHMICommandsTest, Run_SUCCESS) {
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
- SharedPtr<commands::GenericResponse> command(
+ std::shared_ptr<commands::GenericResponse> command(
CreateCommand<commands::GenericResponse>(command_msg));
EXPECT_CALL(
@@ -175,7 +175,7 @@ TEST_F(ScrollableMessageResponseTest, Run_SUCCESS) {
MockAppPtr app(CreateMockApp());
- SharedPtr<commands::ScrollableMessageResponse> command(
+ std::shared_ptr<commands::ScrollableMessageResponse> command(
CreateCommand<commands::ScrollableMessageResponse>(message));
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app));
EXPECT_CALL(*app, UnsubscribeFromSoftButtons(_));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc
index a039581284..0450f06ee1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc
@@ -31,19 +31,19 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "mobile/slider_request.h"
-#include "gtest/gtest.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -52,17 +52,16 @@ namespace mobile_commands_test {
namespace slider_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::SliderRequest;
+using am::MockMessageHelper;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
using policy_test::MockPolicyHandlerInterface;
-using ::utils::SharedPtr;
+using sdl_rpc_plugin::commands::SliderRequest;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
-typedef SharedPtr<SliderRequest> CommandPtr;
+typedef std::shared_ptr<SliderRequest> CommandPtr;
namespace {
const int32_t kCommandId = 1;
@@ -140,8 +139,7 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_ui = CreateFullParamsUISO();
(*msg_ui)[am::strings::params][am::strings::connection_key] = kConnectionKey;
- utils::SharedPtr<SliderRequest> command =
- CreateCommand<SliderRequest>(msg_ui);
+ std::shared_ptr<SliderRequest> command = CreateCommand<SliderRequest>(msg_ui);
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(kConnectionKey))
@@ -270,7 +268,7 @@ TEST_F(SliderRequestTest, Run_SUCCESS) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Slider)));
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Slider), _));
CommandPtr command(CreateCommand<SliderRequest>(msg_));
command->Run();
@@ -339,4 +337,4 @@ TEST_F(SliderRequestTest, OnEvent_UISliderAborted_SUCCESS) {
} // namespace mobile_commands_test
} // namespace commands_test
} // namespace components
-} // namespace tests
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc
index ab086de0e6..87320d3a7a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc
@@ -31,26 +31,26 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "mobile/speak_request.h"
#include <string>
#include "gtest/gtest.h"
-#include "mobile/speak_request.h"
-#include "utils/shared_ptr.h"
-#include "application_manager/commands/commands_test.h"
+
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
-#include "utils/shared_ptr.h"
+
#include "utils/helpers.h"
-#include "utils/make_shared.h"
-#include "smart_objects/smart_object.h"
-#include "utils/custom_string.h"
+
#include "application_manager/application.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
namespace test {
namespace components {
@@ -62,24 +62,24 @@ namespace am = application_manager;
namespace mobile_result = mobile_apis::Result;
namespace hmi_response = ::application_manager::hmi_response;
namespace strings = ::application_manager::strings;
-using am::commands::CommandImpl;
using am::ApplicationManager;
-using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
using ::testing::_;
-using ::utils::SharedPtr;
-using ::testing::Return;
-using ::testing::ReturnRef;
+
using sdl_rpc_plugin::commands::SpeakRequest;
using ::test::components::application_manager_test::MockApplication;
+using ::testing::Return;
+using ::testing::ReturnRef;
-typedef SharedPtr<SpeakRequest> CommandPtr;
+typedef std::shared_ptr<SpeakRequest> CommandPtr;
namespace {
const uint32_t kAppId = 10u;
const uint32_t kConnectionKey = 5u;
-}
+} // namespace
class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
@@ -92,7 +92,7 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
const mobile_apis::Result::eType mobile_response,
const am::HmiInterfaces::InterfaceState state,
const bool success) {
- utils::SharedPtr<SpeakRequest> command =
+ std::shared_ptr<SpeakRequest> command =
CreateCommand<SpeakRequest>(request_);
(*response_)[strings::params][hmi_response::code] = hmi_response;
@@ -129,8 +129,7 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
};
TEST_F(SpeakRequestTest, OnEvent_SUCCESS_Expect_true) {
- utils::SharedPtr<SpeakRequest> command =
- CreateCommand<SpeakRequest>(request_);
+ std::shared_ptr<SpeakRequest> command = CreateCommand<SpeakRequest>(request_);
(*response_)[strings::params][hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
@@ -296,7 +295,7 @@ TEST_F(SpeakRequestTest, Run_MsgWithEmptyString_Success) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)));
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _));
command->Run();
}
@@ -316,7 +315,7 @@ TEST_F(SpeakRequestTest, Run_MsgCorrect_Success) {
EXPECT_CALL(
mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak)));
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_Speak), _));
command->Run();
}
@@ -403,5 +402,5 @@ TEST_F(SpeakRequestTest, OnEvent_ApplicationIsNotRegistered_UNSUCCESS) {
} // namespace speak_request
} // namespace mobile_commands_test
} // namespace commands_test
-} // namespace component
+} // namespace components
} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
index 17c4db36bc..f3bfe12ab1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
@@ -34,17 +34,17 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "mobile/subscribe_button_request.h"
-#include "interfaces/MOBILE_API.h"
#include "application_manager/smart_object_keys.h"
+#include "interfaces/MOBILE_API.h"
+#include "mobile/subscribe_button_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -53,15 +53,15 @@ namespace mobile_commands_test {
namespace subscribe_button_request {
using ::testing::_;
+using ::testing::DoAll;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::DoAll;
using ::testing::SaveArg;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::SubscribeButtonRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::SubscribeButtonRequest;
-typedef SharedPtr<SubscribeButtonRequest> CommandPtr;
+typedef std::shared_ptr<SubscribeButtonRequest> CommandPtr;
class SubscribeButtonRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -73,12 +73,14 @@ class SubscribeButtonRequestTest
};
typedef SubscribeButtonRequestTest::MockHMICapabilities MockHMICapabilities;
+const utils::SemanticVersion mock_semantic_version(5, 0, 0);
+const utils::SemanticVersion mock_base_rpc_version(4, 5, 1);
TEST_F(SubscribeButtonRequestTest, Run_AppNotRegistered_UNSUCCESS) {
CommandPtr command(CreateCommand<SubscribeButtonRequest>());
ON_CALL(app_mngr_, application(_))
- .WillByDefault(Return(SharedPtr<am::Application>()));
+ .WillByDefault(Return(std::shared_ptr<am::Application>()));
MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
@@ -104,12 +106,32 @@ TEST_F(SubscribeButtonRequestTest, Run_SubscriptionNotAllowed_UNSUCCESS) {
.asInt()));
}
+TEST_F(SubscribeButtonRequestTest, Run_NavSubscriptionNotAllowed_UNSUCCESS) {
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] =
+ mobile_apis::ButtonName::NAV_CENTER_LOCATION;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, is_navi()).WillByDefault(Return(false));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::REJECTED,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
TEST_F(SubscribeButtonRequestTest, Run_UiIsNotSupported_UNSUCCESS) {
CommandPtr command(CreateCommand<SubscribeButtonRequest>());
MockAppPtr app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_semantic_version));
+ ON_CALL(*app, is_media_application()).WillByDefault(Return(false));
+
ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
.WillByDefault(Return(false));
@@ -130,6 +152,7 @@ TEST_F(SubscribeButtonRequestTest, Run_IsSubscribedToButton_UNSUCCESS) {
MockAppPtr app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_semantic_version));
ON_CALL(*app, is_media_application()).WillByDefault(Return(true));
ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
@@ -139,7 +162,7 @@ TEST_F(SubscribeButtonRequestTest, Run_IsSubscribedToButton_UNSUCCESS) {
(*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName;
ON_CALL(mock_hmi_capabilities_, button_capabilities())
- .WillByDefault(Return(button_caps_ptr.get()));
+ .WillByDefault(Return(button_caps_ptr));
ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(true));
@@ -160,6 +183,101 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
MockAppPtr app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_semantic_version));
+ ON_CALL(*app, is_media_application()).WillByDefault(Return(true));
+
+ ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
+ .WillByDefault(Return(true));
+
+ MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
+ (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName;
+
+ ON_CALL(mock_hmi_capabilities_, button_capabilities())
+ .WillByDefault(Return(button_caps_ptr));
+
+ ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false));
+
+ MessageSharedPtr hmi_result_msg;
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
+
+ MessageSharedPtr mobile_result_msg;
+ EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*hmi_result_msg)[am::strings::params][am::strings::function_id]
+ .asInt()));
+
+ EXPECT_EQ(mobile_apis::Result::SUCCESS,
+ static_cast<mobile_apis::Result::eType>(
+ (*mobile_result_msg)[am::strings::msg_params]
+ [am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(SubscribeButtonRequestTest, Run_NAV_SUCCESS) {
+ const mobile_apis::ButtonName::eType kButtonName =
+ mobile_apis::ButtonName::NAV_CENTER_LOCATION;
+
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] = kButtonName;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_semantic_version));
+ ON_CALL(*app, is_navi()).WillByDefault(Return(true));
+
+ ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
+ .WillByDefault(Return(true));
+
+ MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
+ (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName;
+
+ ON_CALL(mock_hmi_capabilities_, button_capabilities())
+ .WillByDefault(Return(button_caps_ptr));
+
+ ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false));
+
+ MessageSharedPtr hmi_result_msg;
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
+
+ MessageSharedPtr mobile_result_msg;
+ EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*hmi_result_msg)[am::strings::params][am::strings::function_id]
+ .asInt()));
+
+ EXPECT_EQ(mobile_apis::Result::SUCCESS,
+ static_cast<mobile_apis::Result::eType>(
+ (*mobile_result_msg)[am::strings::msg_params]
+ [am::strings::result_code]
+ .asInt()));
+}
+
+TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) {
+ const mobile_apis::ButtonName::eType kButtonName =
+ mobile_apis::ButtonName::OK;
+
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] = kButtonName;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_base_rpc_version));
ON_CALL(*app, is_media_application()).WillByDefault(Return(true));
ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
@@ -167,15 +285,17 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
(*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName;
+ (*button_caps_ptr)[1][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::PLAY_PAUSE;
ON_CALL(mock_hmi_capabilities_, button_capabilities())
- .WillByDefault(Return(button_caps_ptr.get()));
+ .WillByDefault(Return(button_caps_ptr));
ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false));
MessageSharedPtr hmi_result_msg;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
MessageSharedPtr mobile_result_msg;
@@ -189,10 +309,16 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
(*hmi_result_msg)[am::strings::params][am::strings::function_id]
.asInt()));
+ EXPECT_EQ(hmi_apis::Common_ButtonName::PLAY_PAUSE,
+ static_cast<hmi_apis::Common_ButtonName::eType>(
+ (*hmi_result_msg)[am::strings::msg_params][am::strings::name]
+ .asInt()));
+
EXPECT_EQ(mobile_apis::Result::SUCCESS,
static_cast<mobile_apis::Result::eType>(
(*mobile_result_msg)[am::strings::msg_params]
- [am::strings::result_code].asInt()));
+ [am::strings::result_code]
+ .asInt()));
}
} // namespace subscribe_button_request
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
index e944c3eb39..56e4e05d48 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc
@@ -31,18 +31,18 @@
*/
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_message_helper.h"
-#include "mobile/subscribe_way_points_request.h"
-#include "interfaces/MOBILE_API.h"
#include "application_manager/smart_object_keys.h"
+#include "interfaces/MOBILE_API.h"
+#include "mobile/subscribe_way_points_request.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -52,16 +52,16 @@ namespace subscribe_way_points_request {
using ::testing::_;
using ::testing::A;
+using ::testing::DoAll;
+using ::testing::InSequence;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::DoAll;
using ::testing::SaveArg;
-using ::testing::InSequence;
namespace am = ::application_manager;
-using sdl_rpc_plugin::commands::SubscribeWayPointsRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::SubscribeWayPointsRequest;
-typedef SharedPtr<SubscribeWayPointsRequest> CommandPtr;
+typedef std::shared_ptr<SubscribeWayPointsRequest> CommandPtr;
class SubscribeWayPointsRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {};
@@ -90,7 +90,8 @@ TEST_F(SubscribeWayPointsRequestTest, Run_SUCCESS) {
EXPECT_EQ(mobile_apis::Result::SUCCESS,
static_cast<mobile_apis::Result::eType>(
(*mobile_result_msg)[am::strings::msg_params]
- [am::strings::result_code].asInt()));
+ [am::strings::result_code]
+ .asInt()));
}
TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
index 7214e0eea4..211888d6be 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
@@ -31,18 +31,18 @@
*/
#include <stdint.h>
-#include <string>
#include <set>
+#include <string>
#include "gtest/gtest.h"
-#include "mobile/system_request.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_hmi_interface.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "mobile/system_request.h"
namespace test {
namespace components {
@@ -51,14 +51,14 @@ namespace mobile_commands_test {
namespace system_request {
namespace am = application_manager;
-using sdl_rpc_plugin::commands::SystemRequest;
+using am::MessageType;
+using am::MockHmiInterfaces;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
-using am::MockHmiInterfaces;
using am::event_engine::Event;
-using am::MessageType;
using policy_test::MockPolicyHandlerInterface;
-using ::utils::SharedPtr;
+using sdl_rpc_plugin::commands::SystemRequest;
+
using ::testing::_;
using ::testing::DoAll;
using ::testing::Return;
@@ -74,6 +74,7 @@ const std::string kAppStorageFolder = "fake-storage";
const std::string kSystemFilesPath = "/fake/system/files";
const std::string kFileName = "Filename";
const uint32_t kHmiAppId = 3u;
+const connection_handler::DeviceHandle kDeviceId = 1u;
} // namespace
class SystemRequestTest
@@ -99,13 +100,15 @@ class SystemRequestTest
ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kAppPolicyId));
ON_CALL(*mock_app_, folder_name()).WillByDefault(Return(kAppFolderName));
ON_CALL(*mock_app_, hmi_app_id()).WillByDefault(Return(kHmiAppId));
+ ON_CALL(*mock_app_, device()).WillByDefault(Return(kDeviceId));
ON_CALL(app_mngr_settings_, system_files_path())
.WillByDefault(ReturnRef(kSystemFilesPath));
ON_CALL(app_mngr_settings_, app_storage_folder())
.WillByDefault(ReturnRef(kAppStorageFolder));
- ON_CALL(mock_policy_handler_, IsRequestTypeAllowed(kAppPolicyId, _))
+ ON_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(kDeviceId, kAppPolicyId, _))
.WillByDefault(Return(true));
}
@@ -126,7 +129,7 @@ TEST_F(SystemRequestTest, Run_HTTP_FileName_no_binary_data_REJECTED) {
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::REJECTED);
- SharedPtr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
+ std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
command->Run();
}
@@ -146,9 +149,10 @@ TEST_F(SystemRequestTest,
PreConditions();
- EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kAppPolicyId,
- mobile_apis::RequestType::OEM_SPECIFIC))
+ EXPECT_CALL(
+ mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::OEM_SPECIFIC))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
@@ -160,10 +164,10 @@ TEST_F(SystemRequestTest,
.WillOnce(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObjectSPtr result;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
- SharedPtr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
+ std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
ASSERT_TRUE(command->Init());
command->Run();
@@ -191,9 +195,10 @@ TEST_F(
PreConditions();
- EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kAppPolicyId,
- mobile_apis::RequestType::OEM_SPECIFIC))
+ EXPECT_CALL(
+ mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::OEM_SPECIFIC))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
@@ -201,9 +206,9 @@ TEST_F(
.WillOnce(Return(false));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
- SharedPtr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
+ std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
ASSERT_TRUE(command->Init());
command->Run();
}
@@ -216,15 +221,47 @@ TEST_F(SystemRequestTest, Run_RequestTypeDisallowed_SendDisallowedResponse) {
PreConditions();
- EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kAppPolicyId,
- mobile_apis::RequestType::OEM_SPECIFIC))
+ EXPECT_CALL(
+ mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::OEM_SPECIFIC))
.WillOnce(Return(false));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+
+ std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(SystemRequestTest, Run_RequestType_IconURL_Success) {
+ PreConditions();
+ MessageSharedPtr msg = CreateIVSUMessage();
+ (*msg)[am::strings::msg_params][am::strings::request_type] =
+ mobile_apis::RequestType::ICON_URL;
+
+ const std::string url = "https://www.appsfakeiconurlendpoint.com/icon.png";
+
+ (*msg)[am::strings::msg_params][am::strings::file_name] = url;
+ const std::vector<uint8_t> binary_data = {1u, 2u};
+ (*msg)[am::strings::params][am::strings::binary_data] = binary_data;
+
+ EXPECT_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::ICON_URL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_settings_, app_icons_folder())
+ .WillOnce(ReturnRef(kAppStorageFolder));
+ EXPECT_CALL(app_mngr_, PolicyIDByIconUrl(url)).WillOnce(Return(kAppPolicyId));
+
+ EXPECT_CALL(app_mngr_,
+ SaveBinary(binary_data, kAppStorageFolder, kAppPolicyId, 0u))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(app_mngr_, SetIconFileFromSystemRequest(kAppPolicyId)).Times(1);
- SharedPtr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
+ std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
ASSERT_TRUE(command->Init());
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc
index 1c4df3a463..f244acb8d6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc
@@ -34,7 +34,7 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
+
#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_message_helper.h"
@@ -51,10 +51,10 @@ namespace mobile_result = mobile_apis::Result;
using ::testing::_;
-using sdl_rpc_plugin::commands::UnregisterAppInterfaceRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::UnregisterAppInterfaceRequest;
-typedef ::utils::SharedPtr<UnregisterAppInterfaceRequest> CommandPtr;
+typedef std::shared_ptr<UnregisterAppInterfaceRequest> CommandPtr;
class UnregisterAppInterfaceRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
index 439e94b94f..5735610051 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc
@@ -2,11 +2,11 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
+
#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_message_helper.h"
#include "mobile/unsubscribe_button_request.h"
namespace test {
@@ -20,14 +20,16 @@ namespace mobile_result = mobile_apis::Result;
using ::testing::_;
-using sdl_rpc_plugin::commands::UnsubscribeButtonRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::UnsubscribeButtonRequest;
-typedef ::utils::SharedPtr<UnsubscribeButtonRequest> CommandPtr;
+typedef std::shared_ptr<UnsubscribeButtonRequest> CommandPtr;
namespace {
const uint32_t kConnectionKey = 1u;
const mobile_apis::ButtonName::eType kButtonId = mobile_apis::ButtonName::OK;
+const utils::SemanticVersion mock_semantic_version(5, 0, 0);
+const utils::SemanticVersion mock_base_rpc_version(4, 5, 1);
} // namespace
class UnsubscribeButtonRequestTest
@@ -68,11 +70,13 @@ TEST_F(UnsubscribeButtonRequestTest,
MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
(*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonId;
EXPECT_CALL(mock_hmi_capabilities_, button_capabilities())
- .WillOnce(Return(button_caps_ptr.get()));
+ .WillOnce(Return(button_caps_ptr));
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
+ ON_CALL(*mock_app, msg_version())
+ .WillByDefault(ReturnRef(mock_semantic_version));
EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId))
.WillOnce(Return(false));
@@ -94,13 +98,15 @@ TEST_F(UnsubscribeButtonRequestTest,
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
+ ON_CALL(*mock_app, msg_version())
+ .WillByDefault(ReturnRef(mock_semantic_version));
EXPECT_CALL(mock_hmi_capabilities_, is_ui_cooperating())
.WillOnce(Return(true));
MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
EXPECT_CALL(mock_hmi_capabilities_, button_capabilities())
- .WillOnce(Return(button_caps_ptr.get()));
+ .WillOnce(Return(button_caps_ptr));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
@@ -123,17 +129,66 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) {
MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
(*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonId;
EXPECT_CALL(mock_hmi_capabilities_, button_capabilities())
- .WillOnce(Return(button_caps_ptr.get()));
+ .WillOnce(Return(button_caps_ptr));
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app));
+ ON_CALL(*mock_app, msg_version())
+ .WillByDefault(ReturnRef(mock_semantic_version));
EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId))
.WillOnce(Return(true));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Buttons_OnButtonSubscription)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
+
+ EXPECT_CALL(*mock_app, UpdateHash());
+ command->Init();
+ command->Run();
+}
+
+TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS_Base_RPC_Version) {
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ (*command_msg)[am::strings::msg_params][am::strings::button_name] =
+ mobile_apis::ButtonName::OK;
+
+ CommandPtr command(CreateCommand<UnsubscribeButtonRequest>(command_msg));
+
+ EXPECT_CALL(mock_hmi_capabilities_, is_ui_cooperating())
+ .WillRepeatedly(Return(true));
+
+ MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
+ (*button_caps_ptr)[0][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::OK;
+ (*button_caps_ptr)[1][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::PLAY_PAUSE;
+
+ EXPECT_CALL(mock_hmi_capabilities_, button_capabilities())
+ .WillRepeatedly(Return(button_caps_ptr));
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(mock_app));
+ ON_CALL(*mock_app, msg_version())
+ .WillByDefault(ReturnRef(mock_base_rpc_version));
+ ON_CALL(*mock_app, is_media_application()).WillByDefault(Return(true));
+
+ EXPECT_CALL(*mock_app,
+ UnsubscribeFromButton(mobile_apis::ButtonName::PLAY_PAUSE))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _));
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
index a6e1eb0518..3165d57d44 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc
@@ -34,18 +34,18 @@
#include <string>
#include "gtest/gtest.h"
-#include "mobile/unsubscribe_way_points_request.h"
#include "interfaces/MOBILE_API.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+#include "mobile/unsubscribe_way_points_request.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_message_helper.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/event_engine/event.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -59,29 +59,29 @@ namespace mobile_result = mobile_apis::Result;
using ::testing::_;
using ::testing::Return;
-using sdl_rpc_plugin::commands::UnSubscribeWayPointsRequest;
using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::UnsubscribeWayPointsRequest;
namespace {
const uint32_t kConnectionKey = 3u;
const uint32_t kAppId = 5u;
} // namespace
-class UnSubscribeWayPointsRequestTest
+class UnsubscribeWayPointsRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- UnSubscribeWayPointsRequestTest()
+ UnsubscribeWayPointsRequestTest()
: command_msg_(CreateMessage(smart_objects::SmartType_Map))
- , command_(CreateCommand<UnSubscribeWayPointsRequest>(command_msg_)) {
+ , command_(CreateCommand<UnsubscribeWayPointsRequest>(command_msg_)) {
(*command_msg_)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
}
MessageSharedPtr command_msg_;
- ::utils::SharedPtr<UnSubscribeWayPointsRequest> command_;
+ std::shared_ptr<UnsubscribeWayPointsRequest> command_;
};
-TEST_F(UnSubscribeWayPointsRequestTest,
+TEST_F(UnsubscribeWayPointsRequestTest,
Run_ApplicationIsNotRegistered_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(_))
.WillOnce(Return(ApplicationSharedPtr()));
@@ -94,7 +94,7 @@ TEST_F(UnSubscribeWayPointsRequestTest,
command_->Run();
}
-TEST_F(UnSubscribeWayPointsRequestTest,
+TEST_F(UnsubscribeWayPointsRequestTest,
Run_AppIsNotSubscribedForWayPoints_UNSUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
@@ -112,7 +112,7 @@ TEST_F(UnSubscribeWayPointsRequestTest,
command_->Run();
}
-TEST_F(UnSubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) {
+TEST_F(UnsubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
@@ -122,14 +122,21 @@ TEST_F(UnSubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) {
::testing::Matcher<am::ApplicationSharedPtr>(mock_app)))
.WillOnce(Return(true));
+ const std::set<uint32_t> subscribed_apps{kConnectionKey};
+
+ EXPECT_CALL(app_mngr_, GetAppsSubscribedForWayPoints())
+ .WillOnce(Return(subscribed_apps));
+
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints)));
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints),
+ _));
command_->Run();
}
-TEST_F(UnSubscribeWayPointsRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
+TEST_F(UnsubscribeWayPointsRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
@@ -140,8 +147,8 @@ TEST_F(UnSubscribeWayPointsRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
command_->on_event(event);
}
-TEST_F(UnSubscribeWayPointsRequestTest,
- OnEvent_ReceivedNavigationUnSubscribeWayPointsEvent_SUCCESS) {
+TEST_F(UnsubscribeWayPointsRequestTest,
+ OnEvent_ReceivedNavigationUnsubscribeWayPointsEvent_SUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
index d1f59bb3a4..44628a8e89 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
@@ -34,20 +34,20 @@
#include <string>
#include "gtest/gtest.h"
-#include "mobile/update_turn_list_request.h"
#include "interfaces/MOBILE_API.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+#include "mobile/update_turn_list_request.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
-#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/event_engine/event.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -59,14 +59,14 @@ namespace am = ::application_manager;
namespace mobile_result = mobile_apis::Result;
using ::testing::_;
+using ::testing::Eq;
+using ::testing::Ref;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::Ref;
-using ::testing::Eq;
-using sdl_rpc_plugin::commands::UpdateTurnListRequest;
using am::commands::MessageSharedPtr;
using application_manager_test::MockHMICapabilities;
+using sdl_rpc_plugin::commands::UpdateTurnListRequest;
namespace {
const uint32_t kConnectionKey = 3u;
@@ -88,7 +88,7 @@ class UpdateTurnListRequestTest
}
MessageSharedPtr command_msg_;
- ::utils::SharedPtr<UpdateTurnListRequest> command_;
+ std::shared_ptr<UpdateTurnListRequest> command_;
};
TEST_F(UpdateTurnListRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
@@ -208,13 +208,75 @@ TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_SUCCESS) {
(*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
[am::strings::turn_icon],
Eq(mock_app),
- Ref(app_mngr_))).WillOnce(Return(mobile_result::SUCCESS));
+ Ref(app_mngr_)))
+ .WillOnce(Return(mobile_result::SUCCESS));
+
+ EXPECT_CALL(mock_message_helper_,
+ SubscribeApplicationToSoftButton(_, _, kFunctionId));
+
+ MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command_)));
+ ASSERT_TRUE((bool)result_msg);
+ EXPECT_EQ(
+ hmi_apis::FunctionID::Navigation_UpdateTurnList,
+ (*result_msg)[am::strings::params][am::strings::function_id].asInt());
+
+ ASSERT_TRUE((*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
+ .keyExists(am::hmi_request::navi_text));
+
+ EXPECT_TRUE((*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::hmi_request::navi_text]
+ .keyExists(am::hmi_request::field_name));
+ EXPECT_EQ(
+ hmi_apis::Common_TextFieldName::turnText,
+ (*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::hmi_request::navi_text][am::hmi_request::field_name]
+ .asInt());
+
+ EXPECT_TRUE((*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::hmi_request::navi_text]
+ .keyExists(am::hmi_request::field_text));
+ EXPECT_EQ(
+ kNavigationText,
+ (*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::hmi_request::navi_text][am::hmi_request::field_text]
+ .asString());
+}
+
+TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_WARNINGS) {
+ const std::string kNavigationText = "valid_navigation_text";
+
+ (*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::strings::navigation_text] = kNavigationText;
+ (*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::strings::turn_icon][am::strings::value] =
+ "valid_turn_icon";
+ (*command_msg_)[am::strings::msg_params][am::strings::soft_buttons] = 0;
+
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(mock_message_helper_,
+ ProcessSoftButtons((*command_msg_)[am::strings::msg_params],
+ Eq(mock_app),
+ Ref(mock_policy_handler_),
+ Ref(app_mngr_)))
+ .WillOnce(Return(mobile_result::SUCCESS));
+
+ EXPECT_CALL(
+ mock_message_helper_,
+ VerifyImage(
+ (*command_msg_)[am::strings::msg_params][am::strings::turn_list][0]
+ [am::strings::turn_icon],
+ Eq(mock_app),
+ Ref(app_mngr_)))
+ .WillOnce(Return(mobile_result::WARNINGS));
EXPECT_CALL(mock_message_helper_,
SubscribeApplicationToSoftButton(_, _, kFunctionId));
MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command_)));
- ASSERT_TRUE(result_msg);
+ ASSERT_TRUE(result_msg != nullptr);
EXPECT_EQ(
hmi_apis::FunctionID::Navigation_UpdateTurnList,
(*result_msg)[am::strings::params][am::strings::function_id].asInt());
@@ -223,8 +285,8 @@ TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_SUCCESS) {
.keyExists(am::hmi_request::navi_text));
EXPECT_TRUE((*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
- [am::hmi_request::navi_text].keyExists(
- am::hmi_request::field_name));
+ [am::hmi_request::navi_text]
+ .keyExists(am::hmi_request::field_name));
EXPECT_EQ(
hmi_apis::Common_TextFieldName::turnText,
(*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
@@ -232,8 +294,8 @@ TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_SUCCESS) {
.asInt());
EXPECT_TRUE((*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
- [am::hmi_request::navi_text].keyExists(
- am::hmi_request::field_text));
+ [am::hmi_request::navi_text]
+ .keyExists(am::hmi_request::field_text));
EXPECT_EQ(
kNavigationText,
(*result_msg)[am::strings::msg_params][am::strings::turn_list][0]
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt
index 0e556a6993..8c29cccfff 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt
@@ -45,18 +45,25 @@ collect_sources(VEHICLE_INFO_PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(LIBRARIES
HMI_API
MOBILE_API
+ MessageHelper
ApplicationManager
v4_protocol_v1_2_no_extra
SmartObjects
Utils
+ jsoncpp
+ connectionHandler
)
if(ENABLE_LOG)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
-add_library("vehicle_info_plugin" SHARED ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${VEHICLE_INFO_PLUGIN_SOURCES})
-target_link_libraries("vehicle_info_plugin" ${LIBRARIES})
+add_library("vehicle_info_plugin_static" ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${VEHICLE_INFO_PLUGIN_SOURCES})
+target_link_libraries("vehicle_info_plugin_static" ${LIBRARIES})
+
+add_library(vehicle_info_plugin SHARED "src/vehicle_info_plugin.cc" )
+target_link_libraries(vehicle_info_plugin vehicle_info_plugin_static)
+
set(INSTALL_DESTINATION bin)
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/on_vi_vehicle_data_notification.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/on_vi_vehicle_data_notification.h
index 1fb9c0a008..be2f123f4a 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/on_vi_vehicle_data_notification.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/on_vi_vehicle_data_notification.h
@@ -33,8 +33,9 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_VEHICLE_DATA_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_VEHICLE_DATA_NOTIFICATION_H_
-#include "application_manager/commands/notification_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/notification_from_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -55,10 +56,7 @@ class OnVIVehicleDataNotification
**/
OnVIVehicleDataNotification(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief OnVIVehicleDataNotification class destructor
@@ -76,6 +74,6 @@ class OnVIVehicleDataNotification
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_VEHICLE_DATA_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_diagnostic_message_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_diagnostic_message_request.h
index 0b0a9ef99e..6ae6d1f7f6 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_diagnostic_message_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_diagnostic_message_request.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_DIAGNOSTIC_MESSAGE_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -52,10 +53,7 @@ class VIDiagnosticMessageRequest : public app_mngr::commands::RequestToHMI {
**/
VIDiagnosticMessageRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIDiagnosticMessageRequest class destructor
@@ -73,6 +71,6 @@ class VIDiagnosticMessageRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_DIAGNOSTIC_MESSAGE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_diagnostic_message_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_diagnostic_message_response.h
index 31fc73897e..9b172b9e74 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_diagnostic_message_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_diagnostic_message_response.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_DIAGNOSTIC_MESSAGE_RESPONSE_H_
#include "application_manager/commands/response_from_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -52,10 +53,7 @@ class VIDiagnosticMessageResponse : public app_mngr::commands::ResponseFromHMI {
**/
VIDiagnosticMessageResponse(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIDiagnosticMessageResponse class destructor
@@ -73,6 +71,6 @@ class VIDiagnosticMessageResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_DIAGNOSTIC_MESSAGE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_dtcs_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_dtcs_request.h
index 67308a3898..c77464835b 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_dtcs_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_dtcs_request.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_DTCS_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -51,10 +52,7 @@ class VIGetDTCsRequest : public app_mngr::commands::RequestToHMI {
* @param message Incoming SmartObject message
**/
VIGetDTCsRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIGetDTCsRequest class destructor
@@ -72,6 +70,6 @@ class VIGetDTCsRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_DTCS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_dtcs_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_dtcs_response.h
index 0ddf225c93..f1ddcbe373 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_dtcs_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_dtcs_response.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_DTCS_RESPONSE_H_
#include "application_manager/commands/response_from_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -51,10 +52,7 @@ class VIGetDTCsResponse : public app_mngr::commands::ResponseFromHMI {
* @param message Incoming SmartObject message
**/
VIGetDTCsResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIGetDTCsResponse class destructor
@@ -72,6 +70,6 @@ class VIGetDTCsResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_DTCS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_request.h
index 1b4669cf24..bce49f8201 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_request.h
@@ -34,6 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_DATA_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -51,10 +53,7 @@ class VIGetVehicleDataRequest : public app_mngr::commands::RequestToHMI {
* @param message Incoming SmartObject message
**/
VIGetVehicleDataRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIGetVehicleDataRequest class destructor
@@ -67,11 +66,13 @@ class VIGetVehicleDataRequest : public app_mngr::commands::RequestToHMI {
virtual void Run();
private:
+ CustomVehicleDataManager& custom_vehicle_data_manager_;
+
DISALLOW_COPY_AND_ASSIGN(VIGetVehicleDataRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_response.h
index df5e630aea..7504168aec 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_response.h
@@ -33,8 +33,9 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_DATA_RESPONSE_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_DATA_RESPONSE_H_
-#include "application_manager/commands/response_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/response_from_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -52,10 +53,7 @@ class VIGetVehicleDataResponse : public app_mngr::commands::ResponseFromHMI {
* @param message Incoming SmartObject message
**/
VIGetVehicleDataResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIGetVehicleDataResponse class destructor
@@ -73,6 +71,6 @@ class VIGetVehicleDataResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h
index 79a5270f8d..7f2e8389ad 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_TYPE_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -51,10 +52,7 @@ class VIGetVehicleTypeRequest : public app_mngr::commands::RequestToHMI {
* @param message Incoming SmartObject message
**/
VIGetVehicleTypeRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIGetVehicleTypeRequest class destructor
@@ -72,6 +70,6 @@ class VIGetVehicleTypeRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_TYPE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_response.h
index baa4a936ae..f71eda8077 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_response.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_TYPE_RESPONSE_H_
#include "application_manager/commands/response_from_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -50,12 +51,8 @@ class VIGetVehicleTypeResponse : public app_mngr::commands::ResponseFromHMI {
*
* @param message Incoming SmartObject message
**/
- VIGetVehicleTypeResponse(
- const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- application_manager::rpc_service::RPCService& rpc_service,
- application_manager::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ VIGetVehicleTypeResponse(const app_mngr::commands::MessageSharedPtr& message,
+ const VehicleInfoCommandParams& params);
/**
* @brief VIGetVehicleTypeResponse class destructor
@@ -73,6 +70,6 @@ class VIGetVehicleTypeResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_GET_VEHICLE_TYPE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h
index 3f12a30c8d..fa9bfebad4 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_IS_READY_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -52,10 +53,7 @@ class VIIsReadyRequest : public app_mngr::commands::RequestToHMI,
* @param message Incoming SmartObject message
**/
VIIsReadyRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIIsReadyRequest class destructor
@@ -88,6 +86,6 @@ class VIIsReadyRequest : public app_mngr::commands::RequestToHMI,
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_IS_READY_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_response.h
index 3531aa03c4..f87d9370f5 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_response.h
@@ -33,8 +33,9 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_IS_READY_RESPONSE_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_IS_READY_RESPONSE_H_
-#include "application_manager/commands/response_from_hmi.h"
#include "application_manager/application_manager.h"
+#include "application_manager/commands/response_from_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -52,10 +53,7 @@ class VIIsReadyResponse : public app_mngr::commands::ResponseFromHMI {
* @param message Incoming SmartObject message
**/
VIIsReadyResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIIsReadyResponse class destructor
@@ -73,6 +71,6 @@ class VIIsReadyResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_IS_READY_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_read_did_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_read_did_request.h
index 2d10bbf11d..63bbf10e41 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_read_did_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_read_did_request.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_READ_DID_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -51,10 +52,7 @@ class VIReadDIDRequest : public app_mngr::commands::RequestToHMI {
* @param message Incoming SmartObject message
**/
VIReadDIDRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIReadDIDRequest class destructor
@@ -72,6 +70,6 @@ class VIReadDIDRequest : public app_mngr::commands::RequestToHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_READ_DID_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_read_did_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_read_did_response.h
index 5ac655b499..307960e145 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_read_did_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_read_did_response.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_READ_DID_RESPONSE_H_
#include "application_manager/commands/response_from_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -51,10 +52,7 @@ class VIReadDIDResponse : public app_mngr::commands::ResponseFromHMI {
* @param message Incoming SmartObject message
**/
VIReadDIDResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIReadDIDResponse class destructor
@@ -72,6 +70,6 @@ class VIReadDIDResponse : public app_mngr::commands::ResponseFromHMI {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_READ_DID_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h
index bd22a313e7..0e91006e52 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h
@@ -34,6 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_SUBSCRIBE_VEHICLE_DATA_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -52,10 +54,7 @@ class VISubscribeVehicleDataRequest : public app_mngr::commands::RequestToHMI {
**/
VISubscribeVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VISubscribeVehicleDataRequest class destructor
@@ -68,11 +67,13 @@ class VISubscribeVehicleDataRequest : public app_mngr::commands::RequestToHMI {
virtual void Run();
private:
+ CustomVehicleDataManager& custom_vehicle_data_manager_;
+
DISALLOW_COPY_AND_ASSIGN(VISubscribeVehicleDataRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_SUBSCRIBE_VEHICLE_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_response.h
index 1148a8b41a..523867d87e 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_response.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_SUBSCRIBE_VEHICLE_DATA_RESPONSE_H_
#include "application_manager/commands/response_from_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -53,10 +54,7 @@ class VISubscribeVehicleDataResponse
**/
VISubscribeVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VISubscribeVehicleDataResponse class destructor
@@ -74,6 +72,6 @@ class VISubscribeVehicleDataResponse
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_SUBSCRIBE_VEHICLE_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request.h
index 3b39835fbf..4e3cc59c2e 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request.h
@@ -34,6 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_UNSUBSCRIBE_VEHICLE_DATA_REQUEST_H_
#include "application_manager/commands/request_to_hmi.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -53,10 +55,7 @@ class VIUnsubscribeVehicleDataRequest
**/
VIUnsubscribeVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIUnsubscribeVehicleDataRequest class destructor
@@ -69,11 +68,13 @@ class VIUnsubscribeVehicleDataRequest
virtual void Run();
private:
+ CustomVehicleDataManager& custom_vehicle_data_manager_;
+
DISALLOW_COPY_AND_ASSIGN(VIUnsubscribeVehicleDataRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_UNSUBSCRIBE_VEHICLE_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response.h
index ada6896520..e8f2267ce6 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_UNSUBSCRIBE_VEHICLE_DATA_RESPONSE_H_
#include "application_manager/commands/response_from_hmi.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -53,10 +54,7 @@ class VIUnsubscribeVehicleDataResponse
**/
VIUnsubscribeVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle);
+ const VehicleInfoCommandParams& params);
/**
* @brief VIUnsubscribeVehicleDataResponse class destructor
@@ -74,6 +72,6 @@ class VIUnsubscribeVehicleDataResponse
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_VI_UNSUBSCRIBE_VEHICLE_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h
index e2bc7c4dfd..56f0e39621 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h
@@ -36,6 +36,7 @@
#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -53,10 +54,7 @@ class DiagnosticMessageRequest : public app_mngr::commands::CommandRequestImpl {
* @param message Incoming SmartObject message
**/
DiagnosticMessageRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief DiagnosticMessageRequest class destructor
@@ -80,6 +78,6 @@ class DiagnosticMessageRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAGNOSTIC_MESSAGE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_response.h
index d69a6a0155..5308551f5a 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_response.h
@@ -36,6 +36,7 @@
#include "application_manager/commands/command_response_impl.h"
#include "utils/macro.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -54,10 +55,7 @@ class DiagnosticMessageResponse
* @param message Incoming SmartObject message
**/
DiagnosticMessageResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief DiagnosticMessageResponse class destructor
@@ -74,6 +72,6 @@ class DiagnosticMessageResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAGNOSTIC_MESSAGE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h
index 01f007697d..562d7f236b 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h
@@ -36,6 +36,7 @@
#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -53,10 +54,7 @@ class GetDTCsRequest : public app_mngr::commands::CommandRequestImpl {
* @param message Incoming SmartObject message
**/
GetDTCsRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief GetDTCsRequest class destructor
@@ -80,6 +78,6 @@ class GetDTCsRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_DTCS_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_response.h
index 87024b1860..52836e895f 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_response.h
@@ -36,6 +36,7 @@
#include "application_manager/commands/command_response_impl.h"
#include "utils/macro.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -53,10 +54,7 @@ class GetDTCsResponse : public app_mngr::commands::CommandResponseImpl {
* @param message Incoming SmartObject message
**/
GetDTCsResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief GetDTCsResponse class destructor
@@ -73,6 +71,6 @@ class GetDTCsResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_DTCS_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h
index 17ae1ffd09..8a594b0647 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h
@@ -36,12 +36,11 @@
#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
-class SmartObject;
-
namespace commands {
/**
@@ -55,10 +54,7 @@ class GetVehicleDataRequest : public app_mngr::commands::CommandRequestImpl {
* @param message Incoming SmartObject message
**/
GetVehicleDataRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief GetVehicleDataRequest class destructor
@@ -73,26 +69,22 @@ class GetVehicleDataRequest : public app_mngr::commands::CommandRequestImpl {
protected:
virtual void on_event(const app_mngr::event_engine::Event& event);
-#ifdef HMI_DBUS_API
private:
- void SendRequestsToHmi(const int32_t app_id);
+ /**
+ * @brief CheckFrequency check if mobile does not spam SDL with frequent
+ * GetVehicleData requests
+ * @return
+ */
+ bool CheckFrequency(application_manager::Application& app);
- struct HmiRequest {
- hmi_apis::Common_Result::eType status;
- bool complete;
- smart_objects::SmartObject value;
- const char* str;
- hmi_apis::FunctionID::eType func_id;
- };
+ std::set<std::string> pending_vehicle_data_;
- typedef std::vector<HmiRequest> HmiRequests;
- HmiRequests hmi_requests_;
-#endif // #ifdef HMI_DBUS_API
+ CustomVehicleDataManager& custom_vehicle_data_manager_;
DISALLOW_COPY_AND_ASSIGN(GetVehicleDataRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_VEHICLE_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_response.h
index 22ec1a5a78..8d9722b2b6 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_response.h
@@ -36,7 +36,7 @@
#include "application_manager/commands/command_response_impl.h"
#include "utils/macro.h"
-
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -53,10 +53,7 @@ class GetVehicleDataResponse : public app_mngr::commands::CommandResponseImpl {
* @param message Incoming SmartObject message
**/
GetVehicleDataResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief GetVehicleDataResponse class destructor
@@ -73,6 +70,6 @@ class GetVehicleDataResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_VEHICLE_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/on_vehicle_data_notification.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/on_vehicle_data_notification.h
index 57c30164e4..9163e78b5e 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/on_vehicle_data_notification.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/on_vehicle_data_notification.h
@@ -34,9 +34,11 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_VEHICLE_DATA_NOTIFICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_VEHICLE_DATA_NOTIFICATION_H_
-#include "application_manager/commands/command_notification_impl.h"
#include "application_manager/application.h"
+#include "application_manager/commands/command_notification_impl.h"
#include "utils/macro.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -56,10 +58,7 @@ class OnVehicleDataNotification
* @param message Incoming SmartObject message
**/
OnVehicleDataNotification(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief OnVehicleDataNotification class destructor
@@ -79,10 +78,12 @@ class OnVehicleDataNotification
*/
void SendVehicleData(app_mngr::ApplicationConstSharedPtr app);
+ CustomVehicleDataManager& custom_vehicle_data_manager_;
+
DISALLOW_COPY_AND_ASSIGN(OnVehicleDataNotification);
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_VEHICLE_DATA_NOTIFICATION_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h
index 9a8fbbd62e..8566075504 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h
@@ -36,7 +36,7 @@
#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
-
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -53,10 +53,7 @@ class ReadDIDRequest : public app_mngr::commands::CommandRequestImpl {
* @param message Incoming SmartObject message
**/
ReadDIDRequest(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief ReadDIDRequest class destructor
@@ -80,6 +77,6 @@ class ReadDIDRequest : public app_mngr::commands::CommandRequestImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_READ_DID_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_response.h
index 2b7ab04768..30e5aa45de 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_response.h
@@ -36,7 +36,7 @@
#include "application_manager/commands/command_response_impl.h"
#include "utils/macro.h"
-
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -53,10 +53,7 @@ class ReadDIDResponse : public app_mngr::commands::CommandResponseImpl {
* @param message Incoming SmartObject message
**/
ReadDIDResponse(const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief ReadDIDResponse class destructor
@@ -73,6 +70,6 @@ class ReadDIDResponse : public app_mngr::commands::CommandResponseImpl {
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_READ_DID_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h
index d324d5ca24..663e64f2a0 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h
@@ -37,10 +37,12 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_VEHICLE_DATA_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_VEHICLE_DATA_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application.h"
+#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
#include "vehicle_info_plugin/vehicle_info_app_extension.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -60,10 +62,7 @@ class SubscribeVehicleDataRequest
**/
SubscribeVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ VehicleInfoCommandParams params);
/**
* @brief SubscribeButtonCommandRequest class destructor
@@ -87,20 +86,6 @@ class SubscribeVehicleDataRequest
*/
bool Init() FINAL;
-#ifdef HMI_DBUS_API
- private:
- struct HmiRequest {
- hmi_apis::Common_Result::eType status;
- bool complete;
- smart_objects::SmartObject value;
- const char* str;
- hmi_apis::FunctionID::eType func_id;
- };
-
- typedef std::vector<HmiRequest> HmiRequests;
- HmiRequests hmi_requests_;
-#endif // #ifdef HMI_DBUS_API
-
private:
/**
* @brief Checks, if any app is subscribed for particular VI parameter
@@ -108,7 +93,7 @@ class SubscribeVehicleDataRequest
* @return true, if there are registered apps subscribed for VI parameter,
* otherwise - false
*/
- bool IsSomeoneSubscribedFor(const uint32_t param_id) const;
+ bool IsSomeoneSubscribedFor(const std::string& param_name) const;
/**
* @brief Adds VI parameters being subscribed by another or the same app to
@@ -118,22 +103,13 @@ class SubscribeVehicleDataRequest
void AddAlreadySubscribedVI(smart_objects::SmartObject& msg_params) const;
/**
- * @brief Removes subscription for VI parameters which subsription attempt
- * returned an error
+ * @brief Actual subscription to pending vehicle data after successful
+ * response from HMI
* @param app Pointer to application sent subscribe request
* @param msg_params 'message_parameters' response section reference
*/
- void UnsubscribeFailedSubscriptions(
- app_mngr::ApplicationSharedPtr app,
- const smart_objects::SmartObject& msg_params) const;
-
- DEPRECATED void CheckVISubscribtions(
- app_mngr::ApplicationSharedPtr app,
- std::string& out_info,
- mobile_apis::Result::eType& out_result_code,
- smart_objects::SmartObject& out_response_params,
- smart_objects::SmartObject& out_request_params,
- bool& out_result);
+ bool SubscribePendingVehicleData(app_mngr::ApplicationSharedPtr app,
+ smart_objects::SmartObject& msg_params);
/**
* @brief Checks if current application and other applications
@@ -156,6 +132,43 @@ class SubscribeVehicleDataRequest
bool& out_result);
/**
+ * @brief ConvertResponseToRequestName convert RPCSpec vehicle data names
+ * from response naming to request naming.
+ * This is workaround for cluster mode.
+ * Parameter named in request message as `cluster_mode` and in response
+ * message as `cluster_mode_status`
+ * @param name mobile RPCSpec vehicle data name
+ * @return hmi RPCSpec vehicle data name
+ */
+ const std::string& ConvertResponseToRequestName(const std::string& name);
+
+ /**
+ * @brief ConvertRequestToResponseName convert RPCSpec vehicle data names from
+ * request to response
+ * * This is workaround for cluster mode.
+ * Parameter named in request message as `cluster_mode` and in response
+ * message as `cluster_mode_status`
+ * @param name mobile RPCSpec vehicle data name
+ * @return hmi RPCSpec vehicle data name
+ */
+ const std::string& ConvertRequestToResponseName(const std::string& name);
+
+ /**
+ * @brief Appends data types for vehicle data in response to mobile
+ * @param msg_params 'message_parameters' response section reference
+ */
+ void AppendDataTypesToMobileResponse(
+ smart_objects::SmartObject& msg_params) const;
+
+ /**
+ * @brief Checks subscription status of certain vehicle_item
+ * @param vi_name name of vehicle item to be checked
+ * @param msg_params 'message_parameters' response section reference
+ */
+ bool CheckSubscriptionStatus(std::string vi_name,
+ const smart_objects::SmartObject& msg_params);
+
+ /**
* @brief VI parameters which had been already subscribed by another apps
* befor particular app subscribed for these parameters
*/
@@ -171,10 +184,12 @@ class SubscribeVehicleDataRequest
*/
VehicleInfoSubscriptions vi_waiting_for_subscribe_;
+ CustomVehicleDataManager& custom_vehicle_data_manager_;
+
DISALLOW_COPY_AND_ASSIGN(SubscribeVehicleDataRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_VEHICLE_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_response.h
index 60670afee1..39af8b019b 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_response.h
@@ -36,7 +36,7 @@
#include "application_manager/commands/command_response_impl.h"
#include "utils/macro.h"
-
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -55,10 +55,7 @@ class SubscribeVehicleDataResponse
**/
SubscribeVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief UnsubscribeVehicleDataCommandRequest class destructor
@@ -75,6 +72,6 @@ class SubscribeVehicleDataResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_VEHICLE_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h
index 5730048b85..4f2a01244f 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h
@@ -34,10 +34,12 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_VEHICLE_DATA_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_VEHICLE_DATA_REQUEST_H_
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application.h"
+#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
#include "vehicle_info_plugin/vehicle_info_app_extension.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -57,10 +59,7 @@ class UnsubscribeVehicleDataRequest
**/
UnsubscribeVehicleDataRequest(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief UnsubscribeVehicleDataRequest class destructor
@@ -84,20 +83,6 @@ class UnsubscribeVehicleDataRequest
*/
bool Init() FINAL;
-#ifdef HMI_DBUS_API
- private:
- struct HmiRequest {
- hmi_apis::Common_Result::eType status;
- bool complete;
- smart_objects::SmartObject value;
- const char* str;
- hmi_apis::FunctionID::eType func_id;
- };
-
- typedef std::vector<HmiRequest> HmiRequests;
- HmiRequests hmi_requests_;
-#endif // #ifdef HMI_DBUS_API
-
private:
/**
* @brief Checks, if any app is subscribed for particular VI parameter
@@ -105,7 +90,7 @@ class UnsubscribeVehicleDataRequest
* @return true, if there are registered apps subscribed for VI parameter,
* otherwise - false
*/
- bool IsSomeoneSubscribedFor(const uint32_t param_id) const;
+ bool IsSomeoneSubscribedFor(const std::string& param_name) const;
/**
* @brief Adds VI parameters being unsubscribed by another or the same app to
@@ -115,20 +100,71 @@ class UnsubscribeVehicleDataRequest
void AddAlreadyUnsubscribedVI(smart_objects::SmartObject& response) const;
/**
+ * @brief Actual unsubscription from all pending vehicle data. To be called
+ * after successful HMI response
+ * @param app shared pointer to application, which initialized unsubscription
+ * @param msg_params 'message_params' response section reference
+ */
+ bool UnsubscribePendingVehicleData(
+ app_mngr::ApplicationSharedPtr app,
+ const smart_objects::SmartObject& msg_params);
+
+ /**
+ * @brief ConvertRequestToResponseName convert RPCSpec vehicle data names
+ * from hmi api to mobile api
+ * @param name mobile RPCSpec vehicle data name
+ * @return hmi RPCSpec vehicle data name
+ */
+ const std::string& ConvertRequestToResponseName(const std::string& name);
+
+ /**
+ * @brief ConvertResponseToRequestName convert RPCSpec vehicle data names
+ * from hmi api to mobile api
+ * @param name mobile RPCSpec vehicle data name
+ * @return hmi RPCSpec vehicle data name
+ */
+ const std::string& ConvertResponseToRequestName(const std::string& name);
+
+ /**
+ * @brief Appends data types for vehicle data in response to mobile
+ * @param msg_params 'message_parameters' response section reference
+ */
+ void AppendDataTypesToMobileResponse(
+ smart_objects::SmartObject& msg_params) const;
+
+ /**
+ * @brief Checks subscription status of certain vehicle_item
+ * @param key name of vehicle item to be checked
+ * @param msg_params 'message_parameters' response section reference
+ */
+ bool CheckSubscriptionStatus(std::string key,
+ const smart_objects::SmartObject& msg_params);
+
+ smart_objects::SmartObject response_params_;
+
+ /**
* @brief VI parameters which still being subscribed by another apps after
* particular app had been unsubscribed from these parameters
*/
VehicleInfoSubscriptions vi_still_subscribed_by_another_apps_;
/**
- * @brief VI parameters which had been unsubscribed already by particular app
+ * @brief VI parameters which had been unsubscribed already by particular
+ * app
*/
VehicleInfoSubscriptions vi_already_unsubscribed_by_this_app_;
+ /**
+ * @brief VI parameters to be unsubscribed after HMI response
+ */
+ VehicleInfoSubscriptions vi_waiting_for_unsubscribe_;
+
+ CustomVehicleDataManager& custom_vehicle_data_manager_;
+
DISALLOW_COPY_AND_ASSIGN(UnsubscribeVehicleDataRequest);
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_VEHICLE_DATA_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_response.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_response.h
index 397ae3cbce..f181e7f8c3 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_response.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_response.h
@@ -36,7 +36,7 @@
#include "application_manager/commands/command_response_impl.h"
#include "utils/macro.h"
-
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -55,10 +55,7 @@ class UnsubscribeVehicleDataResponse
**/
UnsubscribeVehicleDataResponse(
const app_mngr::commands::MessageSharedPtr& message,
- app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ const VehicleInfoCommandParams& params);
/**
* @brief UnsubscribeVehicleDataResponse class destructor
@@ -75,6 +72,6 @@ class UnsubscribeVehicleDataResponse
};
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_VEHICLE_DATA_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/custom_vehicle_data_manager.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/custom_vehicle_data_manager.h
new file mode 100644
index 0000000000..9cac76b954
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/custom_vehicle_data_manager.h
@@ -0,0 +1,55 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_CUSTOM_VEHICLE_DATA_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_CUSTOM_VEHICLE_DATA_MANAGER_H_
+#include <set>
+#include <string>
+
+#include "application_manager/plugin_manager/rpc_plugin.h"
+#include "application_manager/rpc_handler.h"
+#include "smart_objects/smart_object.h"
+
+namespace vehicle_info_plugin {
+
+namespace plugin_manager = application_manager::plugin_manager;
+
+class CustomVehicleDataManager {
+ public:
+ /**
+ * @brief Creates message params (nested if needed) to be sent to HMI
+ * according to vehicle data item schema
+ * @param item_names set of names of vehicle data items to be processed
+ * @return smartMap with prepared message params
+ */
+ virtual smart_objects::SmartObject CreateHMIMessageParams(
+ const std::set<std::string>& item_names) = 0;
+
+ /**
+ * @brief Gets data type of vehicle data item
+ * @param vehicle_data_item_name name of vehicle data
+ * @return data type of vehicle_data if one found, item name otherwise
+ */
+ virtual std::string GetVehicleDataItemType(
+ const std::string& vehicle_data_item_name) const = 0;
+
+ /**
+ * @brief Creates message params (nested if needed) to be sent to Mobile
+ * according to vehicle data item schema
+ * @param input_params message params received from hmi
+ */
+ virtual void CreateMobileMessageParams(
+ smart_objects::SmartObject& msg_params) = 0;
+
+ virtual void OnPolicyEvent(plugin_manager::PolicyEvent policy_event) = 0;
+
+ virtual bool IsValidCustomVehicleDataName(const std::string& name) const = 0;
+
+ /**
+ * @brief Checks whether custom vehicle data name was removed after the last
+ * PTU or not
+ * @param name vehicle item name to check
+ * @return true if vehicle data with this name was removed after the last PTU
+ */
+ virtual bool IsRemovedCustomVehicleDataName(
+ const std::string& name) const = 0;
+};
+} // namespace vehicle_info_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_CUSTOM_VEHICLE_DATA_MANAGER_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/custom_vehicle_data_manager_impl.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/custom_vehicle_data_manager_impl.h
new file mode 100644
index 0000000000..239c4edb90
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/custom_vehicle_data_manager_impl.h
@@ -0,0 +1,103 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_VEHICLE_DATA_VALIDATION_MANAGER_IMPL_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_VEHICLE_DATA_VALIDATION_MANAGER_IMPL_H
+
+#include <boost/optional.hpp>
+
+#include "smart_objects/smart_object.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
+
+namespace rpc {
+namespace policy_table_interface_base {
+class VehicleDataItem;
+}
+} // namespace rpc
+
+namespace policy {
+class VehicleDataItemProvider;
+}
+
+namespace vehicle_info_plugin {
+namespace policy_table = rpc::policy_table_interface_base;
+namespace plugin_manager = application_manager::plugin_manager;
+
+typedef boost::optional<const policy_table::VehicleDataItem> OptionalDataItem;
+typedef std::set<std::string> VehicleInfoSubscriptions;
+
+class CustomVehicleDataManagerImpl : public CustomVehicleDataManager {
+ public:
+ CustomVehicleDataManagerImpl(
+ policy::VehicleDataItemProvider& vehicle_data_provider,
+ application_manager::rpc_service::RPCService& rpc_service);
+
+ virtual smart_objects::SmartObject CreateHMIMessageParams(
+ const std::set<std::string>& item_names) OVERRIDE;
+
+ std::string GetVehicleDataItemType(
+ const std::string& vehicle_data_item_name) const OVERRIDE;
+
+ virtual void CreateMobileMessageParams(
+ smart_objects::SmartObject& msg_params) OVERRIDE;
+
+ void OnPolicyEvent(plugin_manager::PolicyEvent policy_event) OVERRIDE;
+
+ bool IsValidCustomVehicleDataName(const std::string& name) const OVERRIDE;
+
+ bool IsRemovedCustomVehicleDataName(const std::string& name) const OVERRIDE;
+
+ private:
+ class RPCParams {
+ public:
+ RPCParams() {}
+ ~RPCParams() {}
+
+ void addBoolParam(
+ const std::pair<std::string, smart_objects::SMember>& param) {
+ rpc_params_bool_.insert(param);
+ }
+ void addVDRParam(
+ const std::pair<std::string, smart_objects::SMember>& param) {
+ rpc_params_vdr_.insert(param);
+ }
+ void addParam(const std::pair<std::string, smart_objects::SMember>& param) {
+ rpc_params_.insert(param);
+ }
+
+ const std::map<std::string, smart_objects::SMember>& getBoolParams() {
+ return rpc_params_bool_;
+ }
+ const std::map<std::string, smart_objects::SMember>& getVDRParams() {
+ return rpc_params_vdr_;
+ }
+ const std::map<std::string, smart_objects::SMember>& getParams() {
+ return rpc_params_;
+ }
+
+ private:
+ std::map<std::string, smart_objects::SMember> rpc_params_bool_;
+ std::map<std::string, smart_objects::SMember> rpc_params_vdr_;
+ std::map<std::string, smart_objects::SMember> rpc_params_;
+ };
+
+ /**
+ * @brief Updates vehicle data schemas according to policy update.
+ */
+ void UpdateVehicleDataItems();
+
+ const OptionalDataItem FindSchemaByNameNonRecursive(
+ const std::string& name) const;
+ const OptionalDataItem FindRemovedSchemaByNameNonRecursive(
+ const std::string& name) const;
+ const OptionalDataItem FindSchemaByKeyNonRecursive(
+ const std::string& key) const;
+ const OptionalDataItem FindSchemaByNameRecursive(
+ const std::string& name) const;
+ const OptionalDataItem FindSchemaByKeyRecursive(
+ const std::string& name) const;
+
+ policy::VehicleDataItemProvider& vehicle_data_provider_;
+ application_manager::rpc_service::RPCService& rpc_service_;
+};
+
+} // namespace vehicle_info_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_VEHICLE_DATA_VALIDATION_MANAGER_IMPL_H
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_data_item_schema.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_data_item_schema.h
new file mode 100644
index 0000000000..5ea73e2dec
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_data_item_schema.h
@@ -0,0 +1,115 @@
+#ifndef VEHICLE_DATA_ITEM_SCHEMA_H
+#define VEHICLE_DATA_ITEM_SCHEMA_H
+#include "policy/policy_table/types.h"
+#include "smart_objects/always_false_schema_item.h"
+#include "smart_objects/always_true_schema_item.h"
+#include "smart_objects/array_schema_item.h"
+#include "smart_objects/bool_schema_item.h"
+#include "smart_objects/enum_schema_item.h"
+#include "smart_objects/number_schema_item.h"
+#include "smart_objects/object_schema_item.h"
+#include "smart_objects/schema_item.h"
+#include "smart_objects/schema_item_parameter.h"
+#include "smart_objects/smart_object.h"
+#include "smart_objects/string_schema_item.h"
+#include "utils/logger.h"
+
+namespace vehicle_info_plugin {
+namespace smart_objects = ns_smart_device_link::ns_smart_objects;
+namespace policy_table = rpc::policy_table_interface_base;
+
+class VehicleDataItemSchema;
+typedef std::shared_ptr<VehicleDataItemSchema> VehicleDataItemSchemaPtr;
+typedef smart_objects::TSchemaItemParameter<policy_table::VehicleDataItem>
+ PolicyDataItem;
+
+/**
+ * @brief VehicleData schema item.
+ **/
+class VehicleDataItemSchema : public smart_objects::ISchemaItem {
+ public:
+ enum SchemaType { MOBILE = 0, HMI };
+
+ /**
+ * @brief Create a new schema item.
+ * @param PolicyDataItem& SchemaItem for VehicleDataItem elements.
+ * @return Shared pointer to a new schema item.
+ **/
+ static VehicleDataItemSchemaPtr create(PolicyDataItem& policy_item,
+ SchemaType schema_type);
+
+ /**
+ * @brief Validate smart object.
+ * @param Object Object to validate.
+ * @param report__ object for reporting errors during validation
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
+ * @return ns_smart_objects::errors::eType
+ **/
+ smart_objects::errors::eType validate(
+ const smart_objects::SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
+
+ private:
+ /**
+ * @brief Constructor.
+ * @param PolicyDataItem& SchemaItem for VehicleDataItem elements.
+ * @param SchemaType defines api type for schema to be generated.
+ **/
+ VehicleDataItemSchema(PolicyDataItem& policy_item, SchemaType schema_type);
+
+ /*
+ * @brief Check whether provided type is POD type
+ * @param const std::string& type_name - name of type to check
+ * @return true - if type is POD type and false - if not
+ */
+ const bool isPODType(const std::string& type_name) const;
+
+ /*
+ * @brief Get Enum schema for provided type
+ * @param const std::string& type_name - name of enum type to provide
+ * @return Shared pointer to a new schema item. If no schema found - nullptr
+ * is returned.
+ */
+ smart_objects::ISchemaItemPtr getEnumSchema(
+ const std::string& type_name) const;
+
+ /**
+ * @brief Apply schema.
+ * @param Object Object to apply schema.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ * parameters from smart object otherwise contains false.
+ **/
+ void applySchema(smart_objects::SmartObject& Object,
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion) OVERRIDE;
+
+ /**
+ * @brief Unapply schema.
+ * @param Object Object to unapply schema.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ * parameters
+ **/
+ void unapplySchema(smart_objects::SmartObject& Object,
+ const bool remove_unknown_parameters) OVERRIDE;
+
+ /*
+ * @brief Get schema for a POD type
+ * @param const VehicleDataItem& policy_item - item, that contains info about
+ * type
+ * @return Shared pointer to a new schema item. If no schema found - nullptr
+ * is returned.
+ */
+ smart_objects::ISchemaItemPtr GetPODTypeSchema(
+ const policy_table::VehicleDataItem& policy_item, SchemaType schema_type);
+
+ smart_objects::ISchemaItemPtr so_schema_item_;
+};
+
+} // namespace vehicle_info_plugin
+#endif // VEHICLE_DATA_ITEM_SCHEMA_H
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h
index f7e6ae7887..fb7c2b0f82 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h
@@ -47,7 +47,7 @@ typedef mobile_apis::VehicleDataType::eType VehicleDataType;
/**
* @brief Defines set of vehicle info types
*/
-typedef std::set<mobile_apis::VehicleDataType::eType> VehicleInfoSubscriptions;
+typedef std::set<std::string> VehicleInfoSubscriptions;
class VehicleInfoAppExtension : public app_mngr::AppExtension {
public:
@@ -61,12 +61,12 @@ class VehicleInfoAppExtension : public app_mngr::AppExtension {
virtual ~VehicleInfoAppExtension();
/**
- * @brief subscribeToVehicleInfo add vehicle_data to list of subscriptions of
- * application extension
- * @param vehicle_data data to subscribe
- * @return true in case if subscription is successful
- */
- bool subscribeToVehicleInfo(const VehicleDataType vehicle_data);
+ * @brief subscribeToVehicleInfo add vehicle_data to list of subscriptions of
+ * application extension
+ * @param vehicle_data data to subscribe
+ * @return true in case if subscription is successful
+ */
+ bool subscribeToVehicleInfo(const std::string& vehicle_data);
/**
* @brief unsubscribeFromVehicleInfo remove vehicle_data from list of
@@ -74,7 +74,7 @@ class VehicleInfoAppExtension : public app_mngr::AppExtension {
* @param vehicle_data data to unsubscribe
* @return true in case if unsubscription is successful
*/
- bool unsubscribeFromVehicleInfo(const VehicleDataType vehicle_data);
+ bool unsubscribeFromVehicleInfo(const std::string& vehicle_data);
/**
* @brief unsubscribeFromVehicleInfo unsubscribe from all vehicle info data
*/
@@ -87,7 +87,7 @@ class VehicleInfoAppExtension : public app_mngr::AppExtension {
* @return true if extension is subscribed this vehicle_data_type, otherwise
* return false
*/
- bool isSubscribedToVehicleInfo(const VehicleDataType vehicle_data_type) const;
+ bool isSubscribedToVehicleInfo(const std::string& vehicle_data_type) const;
/**
* @brief Subscriptions get list of subscriptions for application extension
@@ -99,8 +99,8 @@ class VehicleInfoAppExtension : public app_mngr::AppExtension {
* @brief SaveResumptionData saves vehicle info data
* @param resumption_data plase to store resumption data
*/
- void SaveResumptionData(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& resumption_data) OVERRIDE;
+ void SaveResumptionData(ns_smart_device_link::ns_smart_objects::SmartObject&
+ resumption_data) OVERRIDE;
/**
* @brief ProcessResumption load resumtion data back to plugin during
@@ -130,6 +130,6 @@ class VehicleInfoAppExtension : public app_mngr::AppExtension {
VehicleInfoPlugin& plugin_;
app_mngr::Application& app_;
};
-}
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_APP_EXTENSION_H
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_command_factory.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_command_factory.h
index e36611dfa6..3356f0f823 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_command_factory.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_command_factory.h
@@ -34,37 +34,38 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_COMMAND_FACTORY_H
#include "application_manager/application_manager.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
#include "vehicle_info_plugin/vehicle_info_hmi_command_factory.h"
#include "vehicle_info_plugin/vehicle_info_mobile_command_factory.h"
namespace vehicle_info_plugin {
-namespace app_mngr = application_manager;
-namespace commands = application_manager::commands;
-
/**
* @brief The Vehicle Info command factory.
*/
-class VehicleInfoCommandFactory : public app_mngr::CommandFactory {
+class VehicleInfoCommandFactory : public application_manager::CommandFactory {
public:
- VehicleInfoCommandFactory(app_mngr::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ VehicleInfoCommandFactory(
+ application_manager::ApplicationManager& application_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ CustomVehicleDataManager& custom_vehicle_data_manager);
virtual ~VehicleInfoCommandFactory();
- app_mngr::CommandSharedPtr CreateCommand(
- const commands::MessageSharedPtr& message,
- commands::Command::CommandSource source) OVERRIDE;
+ application_manager::CommandSharedPtr CreateCommand(
+ const application_manager::commands::MessageSharedPtr& message,
+ application_manager::commands::Command::CommandSource source) OVERRIDE;
bool IsAbleToProcess(
const int32_t function_id,
- const commands::Command::CommandSource source) const OVERRIDE;
+ const application_manager::commands::Command::CommandSource source)
+ const OVERRIDE;
private:
- std::unique_ptr<app_mngr::CommandFactory> hmi_command_factory_;
- std::unique_ptr<app_mngr::CommandFactory> mob_command_factory_;
+ std::unique_ptr<application_manager::CommandFactory> hmi_command_factory_;
+ std::unique_ptr<application_manager::CommandFactory> mob_command_factory_;
};
-}
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_COMMAND_FACTORY_H
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_command_params.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_command_params.h
new file mode 100644
index 0000000000..df8dbfd802
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_command_params.h
@@ -0,0 +1,31 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_COMMAND_PARAMS_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_COMMAND_PARAMS_H
+
+namespace application_manager {
+class ApplicationManager;
+class HMICapabilities;
+namespace rpc_service {
+class RPCService;
+}
+class ApplicationManager;
+} // namespace application_manager
+
+namespace policy {
+class PolicyHandlerInterface;
+}
+
+namespace vehicle_info_plugin {
+namespace app_mngr = application_manager;
+
+class CustomVehicleDataManager;
+
+struct VehicleInfoCommandParams {
+ app_mngr::ApplicationManager& application_manager_;
+ app_mngr::rpc_service::RPCService& rpc_service_;
+ app_mngr::HMICapabilities& hmi_capabilities_;
+ policy::PolicyHandlerInterface& policy_handler_;
+ CustomVehicleDataManager& custom_vehicle_data_manager_;
+};
+} // namespace vehicle_info_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_COMMAND_PARAMS_H
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_hmi_command_factory.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_hmi_command_factory.h
index 412949eedb..60d81b5446 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_hmi_command_factory.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_hmi_command_factory.h
@@ -34,6 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_HMI_COMMAND_FACTORY_H
#include "application_manager/application_manager.h"
+#include "application_manager/command_factory.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -47,7 +49,8 @@ class VehicleInfoHmiCommandFactory : public app_mngr::CommandFactory {
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ policy::PolicyHandlerInterface& policy_handler,
+ CustomVehicleDataManager& custom_vehicle_data_manager);
app_mngr::CommandSharedPtr CreateCommand(
const app_mngr::commands::MessageSharedPtr& message,
@@ -62,12 +65,13 @@ class VehicleInfoHmiCommandFactory : public app_mngr::CommandFactory {
app_mngr::rpc_service::RPCService& rpc_service_;
app_mngr::HMICapabilities& hmi_capabilities_;
policy::PolicyHandlerInterface& policy_handler_;
+ CustomVehicleDataManager& custom_vehicle_data_manager_;
app_mngr::CommandCreator& buildCommandCreator(
const int32_t function_id, const int32_t message_type) const;
DISALLOW_COPY_AND_ASSIGN(VehicleInfoHmiCommandFactory);
};
-}
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_HMI_COMMAND_FACTORY_H
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_mobile_command_factory.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_mobile_command_factory.h
index 6cfc77a41c..e3403df5e5 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_mobile_command_factory.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_mobile_command_factory.h
@@ -34,7 +34,8 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_MOBILE_COMMAND_FACTORY_H
#include "application_manager/application_manager.h"
-
+#include "application_manager/command_factory.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
namespace vehicle_info_plugin {
namespace app_mngr = application_manager;
@@ -47,7 +48,8 @@ class VehicleInfoMobileCommandFactory : public app_mngr::CommandFactory {
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler);
+ policy::PolicyHandlerInterface& policy_handler,
+ CustomVehicleDataManager& custom_vehicle_data_manager);
app_mngr::CommandSharedPtr CreateCommand(
const app_mngr::commands::MessageSharedPtr& message,
@@ -62,12 +64,20 @@ class VehicleInfoMobileCommandFactory : public app_mngr::CommandFactory {
app_mngr::rpc_service::RPCService& rpc_service_;
app_mngr::HMICapabilities& hmi_capabilities_;
policy::PolicyHandlerInterface& policy_handler_;
+ CustomVehicleDataManager& custom_vehicle_data_manager_;
- app_mngr::CommandCreator& buildCommandCreator(
- const int32_t function_id, const int32_t message_type) const;
+ app_mngr::CommandCreator& get_creator_factory(
+ const mobile_apis::FunctionID::eType function_id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const;
+ app_mngr::CommandCreator& get_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const;
+ app_mngr::CommandCreator& get_notification_creator(
+ const mobile_apis::FunctionID::eType id) const;
DISALLOW_COPY_AND_ASSIGN(VehicleInfoMobileCommandFactory);
};
-}
+} // namespace vehicle_info_plugin
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_MOBILE_COMMAND_FACTORY_H
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
index b15b7006e6..80336b6967 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_PLUGIN_H
#include "application_manager/command_factory.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
namespace vehicle_info_plugin {
class VehicleInfoAppExtension;
@@ -47,7 +48,15 @@ class VehicleInfoPlugin : public plugins::RPCPlugin {
bool Init(app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler) OVERRIDE;
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) OVERRIDE;
+
+ DEPRECATED
+ bool Init(app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state) OVERRIDE;
bool IsAbleToProcess(
const int32_t function_id,
@@ -70,13 +79,17 @@ class VehicleInfoPlugin : public plugins::RPCPlugin {
VehicleInfoAppExtension& ext);
private:
+ void UnsubscribeFromRemovedVDItems();
+ smart_objects::SmartObjectSPtr GetUnsubscribeIVIRequest(
+ const std::vector<std::string>& ivi_names);
void DeleteSubscriptions(app_mngr::ApplicationSharedPtr app);
std::unique_ptr<app_mngr::CommandFactory> command_factory_;
+ std::unique_ptr<CustomVehicleDataManager> custom_vehicle_data_manager_;
app_mngr::ApplicationManager* application_manager_;
};
-}
+} // namespace vehicle_info_plugin
extern "C" application_manager::plugin_manager::RPCPlugin* Create();
-
+extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data);
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_PLUGIN_H
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc
index 6125c4ee45..b8d1b3a100 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/on_vi_vehicle_data_notification.cc
@@ -40,15 +40,12 @@ namespace commands {
OnVIVehicleDataNotification::OnVIVehicleDataNotification(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: NotificationFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
OnVIVehicleDataNotification::~OnVIVehicleDataNotification() {}
@@ -62,9 +59,8 @@ void OnVIVehicleDataNotification::Run() {
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
if (msg_params.keyExists(strings::odometer)) {
- application_manager_.IviInfoUpdated(
- mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER,
- msg_params[strings::odometer].asInt());
+ application_manager_.IviInfoUpdated(strings::odometer,
+ msg_params[strings::odometer].asInt());
}
SendNotificationToMobile(message_);
@@ -72,4 +68,4 @@ void OnVIVehicleDataNotification::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc
index 8d3b9f13fb..ae64c74f26 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_request.cc
@@ -38,16 +38,13 @@ using namespace application_manager;
namespace commands {
VIDiagnosticMessageRequest::VIDiagnosticMessageRequest(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const app_mngr::commands::MessageSharedPtr& message,
+ const VehicleInfoCommandParams& params)
: RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VIDiagnosticMessageRequest::~VIDiagnosticMessageRequest() {}
@@ -59,4 +56,4 @@ void VIDiagnosticMessageRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc
index e22ba7ddb2..6482d97d10 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_diagnostic_message_response.cc
@@ -40,15 +40,12 @@ namespace commands {
VIDiagnosticMessageResponse::VIDiagnosticMessageResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VIDiagnosticMessageResponse::~VIDiagnosticMessageResponse() {}
@@ -63,4 +60,4 @@ void VIDiagnosticMessageResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc
index 71ce6331ab..620ee4c3e4 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_request.cc
@@ -39,15 +39,12 @@ namespace commands {
VIGetDTCsRequest::VIGetDTCsRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VIGetDTCsRequest::~VIGetDTCsRequest() {}
@@ -59,4 +56,4 @@ void VIGetDTCsRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc
index 9d39c60796..64e948a4e1 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_dtcs_response.cc
@@ -40,15 +40,12 @@ namespace commands {
VIGetDTCsResponse::VIGetDTCsResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VIGetDTCsResponse::~VIGetDTCsResponse() {}
@@ -62,4 +59,4 @@ void VIGetDTCsResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc
index 9fc48c8820..eded6c685b 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_request.cc
@@ -31,6 +31,7 @@
*/
#include "vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_request.h"
+#include "application_manager/message_helper.h"
namespace vehicle_info_plugin {
using namespace application_manager;
@@ -39,24 +40,39 @@ namespace commands {
VIGetVehicleDataRequest::VIGetVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
+ , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {}
VIGetVehicleDataRequest::~VIGetVehicleDataRequest() {}
void VIGetVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data();
+ auto& msg_params = (*message_)[strings::msg_params];
+
+ smart_objects::SmartObject custom_data;
+ for (const auto& name : msg_params.enumerate()) {
+ const auto& found_it = rpc_spec_vehicle_data.find(name);
+ if (rpc_spec_vehicle_data.end() == found_it) {
+ custom_data[name] = msg_params[name];
+ msg_params.erase(name);
+ }
+ }
+
+ auto hmi_custom_msg_params =
+ custom_vehicle_data_manager_.CreateHMIMessageParams(
+ custom_data.enumerate());
+ for (const auto& param : hmi_custom_msg_params.enumerate()) {
+ msg_params[param] = hmi_custom_msg_params[param];
+ }
SendRequest();
}
} // namespace commands
-
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc
index 73ba1a94fe..763ddf1cfa 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_data_response.cc
@@ -31,6 +31,8 @@
*/
#include "vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_response.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/policies/policy_handler_interface.h"
+
#include "interfaces/HMI_API.h"
namespace vehicle_info_plugin {
@@ -39,15 +41,12 @@ namespace commands {
VIGetVehicleDataResponse::VIGetVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VIGetVehicleDataResponse::~VIGetVehicleDataResponse() {}
@@ -56,34 +55,16 @@ void VIGetVehicleDataResponse::Run() {
event_engine::Event event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
- if ((*message_)[strings::params][strings::message_type] ==
- static_cast<int32_t>(hmi_apis::messageType::error_response)) {
- smart_objects::SmartObject result(smart_objects::SmartType_Map);
-
- if ((*message_)[strings::params].keyExists(strings::data)) {
- result[strings::msg_params] = (*message_)[strings::params][strings::data];
- result[strings::params][hmi_response::code] =
- (*message_)[strings::params][hmi_response::code];
- result[strings::params][strings::correlation_id] =
- (*message_)[strings::params][strings::correlation_id];
- result[strings::params][strings::error_msg] =
- (*message_)[strings::params][strings::error_msg];
- result[strings::params][strings::message_type] =
- (*message_)[strings::params][strings::message_type];
- result[strings::params][strings::protocol_type] =
- (*message_)[strings::params][strings::protocol_type];
- result[strings::params][strings::protocol_version] =
- (*message_)[strings::params][strings::protocol_version];
- }
-
- event.set_smart_object(result);
- } else {
- event.set_smart_object(*message_);
+ const bool error_response =
+ (*message_)[strings::params][strings::message_type] ==
+ static_cast<int32_t>(hmi_apis::messageType::error_response);
+ if (!error_response) {
policy_handler_.OnVehicleDataUpdated(*message_);
}
+ event.set_smart_object(*message_);
event.raise(application_manager_.event_dispatcher());
}
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc
index a1a221220a..250584bd12 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc
@@ -39,15 +39,12 @@ namespace commands {
VIGetVehicleTypeRequest::VIGetVehicleTypeRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VIGetVehicleTypeRequest::~VIGetVehicleTypeRequest() {}
@@ -59,4 +56,4 @@ void VIGetVehicleTypeRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc
index 9f14b4e7ea..fb6eadf747 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_response.cc
@@ -38,15 +38,12 @@ namespace commands {
VIGetVehicleTypeResponse::VIGetVehicleTypeResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VIGetVehicleTypeResponse::~VIGetVehicleTypeResponse() {}
@@ -61,4 +58,4 @@ void VIGetVehicleTypeResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc
index 3401849861..93781a7420 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc
@@ -31,8 +31,9 @@
*/
#include "vehicle_info_plugin/commands/hmi/vi_is_ready_request.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/rpc_service.h"
namespace vehicle_info_plugin {
using namespace application_manager;
@@ -41,16 +42,13 @@ namespace commands {
VIIsReadyRequest::VIIsReadyRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle)
- , EventObserver(application_manager.event_dispatcher()) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
+ , EventObserver(application_manager_.event_dispatcher()) {}
VIIsReadyRequest::~VIIsReadyRequest() {}
@@ -100,7 +98,7 @@ void VIIsReadyRequest::onTimeOut() {
}
void VIIsReadyRequest::SendMessageToHMI() {
- utils::SharedPtr<smart_objects::SmartObject> get_type(
+ std::shared_ptr<smart_objects::SmartObject> get_type(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::VehicleInfo_GetVehicleType,
application_manager_));
@@ -109,4 +107,4 @@ void VIIsReadyRequest::SendMessageToHMI() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc
index 35907e11d2..349a1137ce 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_response.cc
@@ -38,15 +38,12 @@ namespace commands {
VIIsReadyResponse::VIIsReadyResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VIIsReadyResponse::~VIIsReadyResponse() {}
@@ -59,4 +56,4 @@ void VIIsReadyResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc
index b55c9e32a0..47373bb4bf 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_request.cc
@@ -39,15 +39,12 @@ namespace commands {
VIReadDIDRequest::VIReadDIDRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VIReadDIDRequest::~VIReadDIDRequest() {}
@@ -59,4 +56,4 @@ void VIReadDIDRequest::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc
index 9d56b2aa78..7c2db1e875 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_read_did_response.cc
@@ -39,15 +39,12 @@ namespace commands {
VIReadDIDResponse::VIReadDIDResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VIReadDIDResponse::~VIReadDIDResponse() {}
@@ -61,4 +58,4 @@ void VIReadDIDResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
index 60e9dc88c3..4c5f067d0d 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc
@@ -31,6 +31,7 @@
*/
#include "vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h"
+#include "application_manager/message_helper.h"
namespace vehicle_info_plugin {
using namespace application_manager;
@@ -39,24 +40,39 @@ namespace commands {
VISubscribeVehicleDataRequest::VISubscribeVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
+ , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {}
VISubscribeVehicleDataRequest::~VISubscribeVehicleDataRequest() {}
void VISubscribeVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data();
+ auto& msg_params = (*message_)[strings::msg_params];
+
+ smart_objects::SmartObject custom_data;
+ for (const auto& name : msg_params.enumerate()) {
+ const auto& found_it = rpc_spec_vehicle_data.find(name);
+ if (rpc_spec_vehicle_data.end() == found_it) {
+ custom_data[name] = msg_params[name];
+ msg_params.erase(name);
+ }
+ }
+
+ auto hmi_custom_msg_params =
+ custom_vehicle_data_manager_.CreateHMIMessageParams(
+ custom_data.enumerate());
+ for (const auto& item : hmi_custom_msg_params.enumerate()) {
+ msg_params[item] = hmi_custom_msg_params[item];
+ }
SendRequest();
}
} // namespace commands
-
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc
index f004d6f3cd..061e13c766 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_response.cc
@@ -39,15 +39,12 @@ namespace commands {
VISubscribeVehicleDataResponse::VISubscribeVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VISubscribeVehicleDataResponse::~VISubscribeVehicleDataResponse() {}
@@ -60,4 +57,4 @@ void VISubscribeVehicleDataResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc
index 9056538514..aa24ac7375 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_request.cc
@@ -31,6 +31,7 @@
*/
#include "vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request.h"
+#include "application_manager/message_helper.h"
namespace vehicle_info_plugin {
using namespace application_manager;
@@ -39,24 +40,39 @@ namespace commands {
VIUnsubscribeVehicleDataRequest::VIUnsubscribeVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: RequestToHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
+ , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {}
VIUnsubscribeVehicleDataRequest::~VIUnsubscribeVehicleDataRequest() {}
void VIUnsubscribeVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data();
+ auto& msg_params = (*message_)[strings::msg_params];
+
+ smart_objects::SmartObject custom_data;
+ for (const auto& name : msg_params.enumerate()) {
+ const auto& found_it = rpc_spec_vehicle_data.find(name);
+ if (rpc_spec_vehicle_data.end() == found_it) {
+ custom_data[name] = msg_params[name];
+ msg_params.erase(name);
+ }
+ }
+
+ auto hmi_custom_msg_params =
+ custom_vehicle_data_manager_.CreateHMIMessageParams(
+ custom_data.enumerate());
+ for (const auto& param : hmi_custom_msg_params.enumerate()) {
+ msg_params[param] = true;
+ }
SendRequest();
}
} // namespace commands
-
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc
index 348bc1b269..01fc521b10 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_unsubscribe_vehicle_data_response.cc
@@ -39,15 +39,12 @@ namespace commands {
VIUnsubscribeVehicleDataResponse::VIUnsubscribeVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handle)
+ const VehicleInfoCommandParams& params)
: ResponseFromHMI(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handle) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
VIUnsubscribeVehicleDataResponse::~VIUnsubscribeVehicleDataResponse() {}
@@ -60,4 +57,4 @@ void VIUnsubscribeVehicleDataResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc
index 4eba894025..ef6c284faf 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc
@@ -31,13 +31,13 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <algorithm>
#include "vehicle_info_plugin/commands/mobile/diagnostic_message_request.h"
+#include <algorithm>
#include "application_manager/application_impl.h"
-#include "interfaces/HMI_API.h"
#include "application_manager/message_helper.h"
+#include "interfaces/HMI_API.h"
namespace vehicle_info_plugin {
using namespace application_manager;
@@ -46,15 +46,12 @@ namespace commands {
DiagnosticMessageRequest::DiagnosticMessageRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
DiagnosticMessageRequest::~DiagnosticMessageRequest() {}
@@ -127,4 +124,4 @@ void DiagnosticMessageRequest::on_event(const event_engine::Event& event) {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc
index 54d8382f5d..f5ccc4d0a7 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_response.cc
@@ -41,15 +41,12 @@ namespace commands {
DiagnosticMessageResponse::DiagnosticMessageResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandResponseImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
DiagnosticMessageResponse::~DiagnosticMessageResponse() {}
@@ -61,4 +58,4 @@ void DiagnosticMessageResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc
index 6c04e874e8..dfa1cf305b 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc
@@ -34,8 +34,8 @@
#include "vehicle_info_plugin/commands/mobile/get_dtcs_request.h"
#include "application_manager/application_impl.h"
-#include "interfaces/HMI_API.h"
#include "application_manager/message_helper.h"
+#include "interfaces/HMI_API.h"
namespace vehicle_info_plugin {
using namespace application_manager;
@@ -44,15 +44,12 @@ namespace commands {
GetDTCsRequest::GetDTCsRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
GetDTCsRequest::~GetDTCsRequest() {}
@@ -116,4 +113,4 @@ void GetDTCsRequest::on_event(const event_engine::Event& event) {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc
index 3686094b73..33945a2f00 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_response.cc
@@ -41,15 +41,12 @@ namespace commands {
GetDTCsResponse::GetDTCsResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandResponseImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
GetDTCsResponse::~GetDTCsResponse() {}
@@ -61,4 +58,4 @@ void GetDTCsResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc
index 7c7a5e61f7..d15cf6a580 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc
@@ -31,13 +31,16 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include "vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
+
+#include <string>
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
-#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+#include "policy/policy_table/types.h"
namespace vehicle_info_plugin {
using namespace application_manager;
@@ -46,227 +49,59 @@ namespace commands {
namespace str = strings;
-#ifdef HMI_DBUS_API
GetVehicleDataRequest::GetVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
- : CommandRequestImpl(message, application_manager) {}
-
-GetVehicleDataRequest::~GetVehicleDataRequest() {}
-
-void GetVehicleDataRequest::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- int32_t app_id =
- (*message_)[strings::params][strings::connection_key].asUInt();
- ApplicationSharedPtr app = application_manager_.application(app_id);
-
- if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
- SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
- return;
- }
-
- const VehicleData& vehicle_data = MessageHelper::vehicle_data();
- VehicleData::const_iterator it = vehicle_data.begin();
-
- for (; vehicle_data.end() != it; ++it) {
- if (true == (*message_)[str::msg_params].keyExists(it->first) &&
- true == (*message_)[str::msg_params][it->first].asBool()) {
- SendRequestsToHmi(app->app_id());
- return;
- }
- }
-
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
-}
-
-namespace {
-struct Subrequest {
- hmi_apis::FunctionID::eType func_id;
- const char* str;
-};
-Subrequest subrequests[] = {
- {hmi_apis::FunctionID::VehicleInfo_GetGpsData, str::gps},
- {hmi_apis::FunctionID::VehicleInfo_GetSpeed, str::speed},
- {hmi_apis::FunctionID::VehicleInfo_GetRpm, str::rpm},
- {hmi_apis::FunctionID::VehicleInfo_GetFuelLevel, str::fuel_level},
- {hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState,
- str::fuel_level_state},
- {hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption,
- str::instant_fuel_consumption},
- {hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature,
- str::external_temp},
- {hmi_apis::FunctionID::VehicleInfo_GetVin, str::vin},
- {hmi_apis::FunctionID::VehicleInfo_GetPrndl, str::prndl},
- {hmi_apis::FunctionID::VehicleInfo_GetTirePressure, str::tire_pressure},
- {hmi_apis::FunctionID::VehicleInfo_GetOdometer, str::odometer},
- {hmi_apis::FunctionID::VehicleInfo_GetBeltStatus, str::belt_status},
- {hmi_apis::FunctionID::VehicleInfo_GetBodyInformation,
- str::body_information},
- {hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus, str::device_status},
- {hmi_apis::FunctionID::VehicleInfo_GetDriverBraking, str::driver_braking},
- {hmi_apis::FunctionID::VehicleInfo_GetWiperStatus, str::wiper_status},
- {hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus,
- str::head_lamp_status},
- {hmi_apis::FunctionID::VehicleInfo_GetEngineTorque, str::engine_torque},
- {hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition, str::acc_pedal_pos},
- {hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle,
- str::steering_wheel_angle},
- {hmi_apis::FunctionID::VehicleInfo_GetECallInfo, str::e_call_info},
- {hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus, str::airbag_status},
- {hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent, str::emergency_event},
- {hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus,
- str::cluster_mode_status},
- {hmi_apis::FunctionID::VehicleInfo_GetMyKey, str::my_key},
-};
-}
-
-void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) {
- smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
- msg_params[strings::app_id] = app_id;
-
- for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) {
- const Subrequest& sr = subrequests[i];
- if (true == (*message_)[str::msg_params].keyExists(sr.str) &&
- true == (*message_)[str::msg_params][sr.str].asBool()) {
- HmiRequest hmi_request;
- hmi_request.str = sr.str;
- hmi_request.func_id = sr.func_id;
- hmi_request.complete = false;
- hmi_requests_.push_back(hmi_request);
- }
- }
-
- LOG4CXX_INFO(logger_,
- hmi_requests_.size() << " requests are going to be sent to HMI");
-
- for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it) {
- SendHMIRequest(it->func_id, &msg_params, true);
- }
-}
-
-void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "GetVehicleDataRequest::on_event " << event.id());
-
- const smart_objects::SmartObject& message = event.smart_object();
-
- for (HmiRequests::iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it) {
- HmiRequest& hmi_request = *it;
- if (hmi_request.func_id == event.id()) {
- hmi_request.status = static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
- if (hmi_apis::Common_Result::SUCCESS == hmi_request.status)
- hmi_request.value = message[str::msg_params][hmi_request.str];
- hmi_request.complete = true;
- break;
- }
- }
-
- bool all_complete = true;
- bool any_arg_success = false;
- mobile_api::Result::eType status = mobile_api::Result::eType::SUCCESS;
- for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it) {
- if (!it->complete) {
- all_complete = false;
- break;
- }
- if (hmi_apis::Common_Result::SUCCESS != it->status) {
- if (mobile_api::Result::SUCCESS == status) {
- status = static_cast<mobile_apis::Result::eType>(it->status);
- } else if (status !=
- static_cast<mobile_apis::Result::eType>(it->status)) {
- status = mobile_api::Result::eType::GENERIC_ERROR;
- }
- LOG4CXX_TRACE(logger_,
- "Status from HMI: " << it->status
- << ", so response status become "
- << status);
- } else {
- any_arg_success = true;
- }
- }
-
- if (all_complete) {
- smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
- if (any_arg_success) {
- for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it) {
- response_params[it->str] = it->value;
- }
- }
- LOG4CXX_INFO(logger_, "All HMI requests are complete");
- const char* info = NULL;
- std::string error_message;
- if (true == message[strings::params].keyExists(strings::error_msg)) {
- error_message = message[strings::params][strings::error_msg].asString();
- info = error_message.c_str();
- }
- SendResponse(any_arg_success, status, info, &response_params);
- }
-}
-#else
-GetVehicleDataRequest::GetVehicleDataRequest(
- const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
+ , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {}
GetVehicleDataRequest::~GetVehicleDataRequest() {}
void GetVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- int32_t app_id =
- (*message_)[strings::params][strings::connection_key].asUInt();
- ApplicationSharedPtr app = application_manager_.application(app_id);
+ auto app = application_manager_.application(connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
+ LOG4CXX_ERROR(logger_, "No such application : " << connection_key());
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
- if (app->AreCommandLimitsExceeded(
- static_cast<mobile_apis::FunctionID::eType>(function_id()),
- application_manager::TLimitSource::CONFIG_FILE)) {
- LOG4CXX_ERROR(logger_, "GetVehicleData frequency is too high.");
+ if (!CheckFrequency(*app)) {
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
- const VehicleData& vehicle_data = MessageHelper::vehicle_data();
- VehicleData::const_iterator it = vehicle_data.begin();
- smart_objects::SmartObject msg_params =
+
+ auto hmi_msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- msg_params[strings::app_id] = app->app_id();
- const uint32_t min_length_msg_params = 1;
- for (; vehicle_data.end() != it; ++it) {
- if (true == (*message_)[str::msg_params].keyExists(it->first) &&
- true == (*message_)[str::msg_params][it->first].asBool()) {
- msg_params[it->first] = (*message_)[strings::msg_params][it->first];
+ hmi_msg_params[strings::app_id] = app->app_id();
+
+ int params_count = 0;
+ auto& msg_params = (*message_)[strings::msg_params];
+ for (const auto& name : msg_params.enumerate()) {
+ auto enabled = msg_params[name].asBool();
+ if (!enabled) {
+ continue;
}
+ hmi_msg_params[name] = msg_params[name];
+ params_count++;
}
- if (msg_params.length() > min_length_msg_params) {
+
+ const int minimal_params_count = 1;
+
+ if (params_count >= minimal_params_count) {
+ for (const auto& param : msg_params.enumerate()) {
+ pending_vehicle_data_.insert(param);
+ }
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
- SendHMIRequest(
- hmi_apis::FunctionID::VehicleInfo_GetVehicleData, &msg_params, true);
- return;
+ SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_GetVehicleData,
+ &hmi_msg_params,
+ true);
} else if (HasDisallowedParams()) {
SendResponse(false, mobile_apis::Result::DISALLOWED);
} else {
@@ -281,16 +116,31 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
switch (event.id()) {
case hmi_apis::FunctionID::VehicleInfo_GetVehicleData: {
EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
- hmi_apis::Common_Result::eType result_code =
- static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
+ auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ auto mobile_result_code = GetMobileResultCode(result_code);
bool result = PrepareResultForMobileResponse(
result_code, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
std::string response_info;
GetInfo(message, response_info);
- result = result ||
- ((hmi_apis::Common_Result::DATA_NOT_AVAILABLE == result_code) &&
- (message[strings::msg_params].length() > 1));
+
+ auto data_not_available_with_params = [this, &result_code, &message]() {
+ if (hmi_apis::Common_Result::DATA_NOT_AVAILABLE != result_code) {
+ return false;
+ }
+
+ const auto& vehicle_data = MessageHelper::vehicle_data();
+ const auto& msg_params = message[strings::msg_params];
+ for (const auto& item : msg_params.enumerate()) {
+ if (vehicle_data.end() != vehicle_data.find(item) ||
+ custom_vehicle_data_manager_.IsValidCustomVehicleDataName(item)) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ result = result || data_not_available_with_params();
if (true ==
message[strings::msg_params].keyExists(hmi_response::method)) {
@@ -299,8 +149,30 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
if (true == message[strings::params].keyExists(strings::error_msg)) {
response_info = message[strings::params][strings::error_msg].asString();
}
+
+ custom_vehicle_data_manager_.CreateMobileMessageParams(
+ const_cast<smart_objects::SmartObject&>(
+ message[strings::msg_params]));
+
+ if (result) {
+ for (const auto& item : message[strings::msg_params].enumerate()) {
+ const auto& found_item = pending_vehicle_data_.find(item);
+ if (pending_vehicle_data_.end() == found_item) {
+ message[strings::msg_params].erase(item);
+ }
+ }
+
+ if (message[strings::msg_params].empty() &&
+ hmi_apis::Common_Result::DATA_NOT_AVAILABLE != result_code) {
+ response_info = "Failed to retrieve data from vehicle";
+ SendResponse(
+ false, mobile_apis::Result::GENERIC_ERROR, response_info.c_str());
+ return;
+ }
+ }
+
SendResponse(result,
- MessageHelper::HMIToMobileResult(result_code),
+ mobile_result_code,
response_info.empty() ? NULL : response_info.c_str(),
&(message[strings::msg_params]));
break;
@@ -312,8 +184,15 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
}
}
-#endif // #ifdef HMI_DBUS_API
+bool GetVehicleDataRequest::CheckFrequency(Application& app) {
+ if (app.AreCommandLimitsExceeded(
+ static_cast<mobile_apis::FunctionID::eType>(function_id()),
+ application_manager::TLimitSource::CONFIG_FILE)) {
+ LOG4CXX_ERROR(logger_, "GetVehicleData frequency is too high.");
+ return false;
+ }
+ return true;
+}
} // namespace commands
-
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc
index 3a7d663756..60a44745a5 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_response.cc
@@ -42,15 +42,12 @@ namespace commands {
GetVehicleDataResponse::GetVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- rpc_service::RPCService& rpc_service,
- HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandResponseImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
GetVehicleDataResponse::~GetVehicleDataResponse() {}
@@ -62,4 +59,4 @@ void GetVehicleDataResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
index f8553c84f8..79134cae40 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
@@ -34,11 +34,11 @@
#include "vehicle_info_plugin/commands/mobile/on_vehicle_data_notification.h"
#include "application_manager/application_impl.h"
+#include "application_manager/helpers/application_helper.h"
#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
-#include "vehicle_info_plugin/vehicle_info_app_extension.h"
-#include "application_manager/helpers/application_helper.h"
#include "utils/macro.h"
+#include "vehicle_info_plugin/vehicle_info_app_extension.h"
namespace vehicle_info_plugin {
using namespace application_manager;
@@ -47,90 +47,74 @@ namespace commands {
OnVehicleDataNotification::OnVehicleDataNotification(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandNotificationImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
+ , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {}
OnVehicleDataNotification::~OnVehicleDataNotification() {}
void OnVehicleDataNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- std::vector<ApplicationSharedPtr> appNotification;
- std::vector<ApplicationSharedPtr>::iterator appNotification_it =
- appNotification.begin();
+ std::vector<ApplicationSharedPtr> notify_apps;
+ std::vector<ApplicationSharedPtr>::iterator notified_app_it =
+ notify_apps.begin();
std::vector<smart_objects::SmartObject> appSO;
- const VehicleData& vehicle_data = MessageHelper::vehicle_data();
- VehicleData::const_iterator it = vehicle_data.begin();
-
- for (; vehicle_data.end() != it; ++it) {
- if (true == (*message_)[strings::msg_params].keyExists(it->first)) {
- LOG4CXX_ERROR(logger_, "vehicle_data nanme" << it->first);
- auto vehicle_data_value =
- (*message_)[strings::msg_params][it->first].asInt();
-
- application_manager_.IviInfoUpdated(it->second, vehicle_data_value);
-
- auto subscribed_to_ivi_predicate = [&it](const ApplicationSharedPtr app) {
- DCHECK_OR_RETURN(app, false);
- auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
- return ext.isSubscribedToVehicleInfo(it->second);
- };
-
- const std::vector<ApplicationSharedPtr>& applications =
- application_manager::FindAllApps(application_manager_.applications(),
- subscribed_to_ivi_predicate);
-
- std::vector<ApplicationSharedPtr>::const_iterator app_it =
- applications.begin();
-
- for (; applications.end() != app_it; ++app_it) {
- const ApplicationSharedPtr app = *app_it;
- if (!app) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
- continue;
- }
-
- appNotification_it =
- find(appNotification.begin(), appNotification.end(), app);
- if (appNotification_it == appNotification.end()) {
- appNotification.push_back(app);
- smart_objects::SmartObject msg_param =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- msg_param[it->first] = (*message_)[strings::msg_params][it->first];
- appSO.push_back(msg_param);
- } else {
- size_t idx =
- std::distance(appNotification.begin(), appNotification_it);
- appSO[idx][it->first] = (*message_)[strings::msg_params][it->first];
- }
+ custom_vehicle_data_manager_.CreateMobileMessageParams(
+ (*message_)[strings::msg_params]);
+
+ const auto& param_names = (*message_)[strings::msg_params].enumerate();
+ for (const auto& name : param_names) {
+ LOG4CXX_DEBUG(logger_, "vehicle_data name: " << name);
+ auto vehicle_data_value = (*message_)[strings::msg_params][name].asInt();
+ application_manager_.IviInfoUpdated(name, vehicle_data_value);
+
+ auto subscribed_to_ivi_predicate = [&name](const ApplicationSharedPtr app) {
+ DCHECK_OR_RETURN(app, false);
+ auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
+ return ext.isSubscribedToVehicleInfo(name);
+ };
+
+ const auto& applications = application_manager::FindAllApps(
+ application_manager_.applications(), subscribed_to_ivi_predicate);
+ for (const auto& app : applications) {
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "NULL pointer");
+ continue;
+ }
+ notified_app_it = find(notify_apps.begin(), notify_apps.end(), app);
+ if (notified_app_it == notify_apps.end()) {
+ notify_apps.push_back(app);
+ smart_objects::SmartObject msg_param =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ msg_param[name] = (*message_)[strings::msg_params][name];
+ appSO.push_back(msg_param);
+ } else {
+ size_t idx = std::distance(notify_apps.begin(), notified_app_it);
+ appSO[idx][name] = (*message_)[strings::msg_params][name];
}
}
}
- LOG4CXX_DEBUG(
- logger_,
- "Number of Notifications to be send: " << appNotification.size());
+ LOG4CXX_DEBUG(logger_,
+ "Number of Notifications to be send: " << notify_apps.size());
- for (size_t idx = 0; idx < appNotification.size(); idx++) {
+ for (size_t idx = 0; idx < notify_apps.size(); idx++) {
LOG4CXX_INFO(logger_,
"Send OnVehicleData PRNDL notification to "
- << appNotification[idx]->name().c_str()
- << " application id " << appNotification[idx]->app_id());
+ << notify_apps[idx]->name().c_str() << " application id "
+ << notify_apps[idx]->app_id());
(*message_)[strings::params][strings::connection_key] =
- appNotification[idx]->app_id();
+ notify_apps[idx]->app_id();
(*message_)[strings::msg_params] = appSO[idx];
SendNotification();
}
}
} // namespace commands
-
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc
index 010cce4c63..c090df7852 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc
@@ -30,13 +30,13 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include "vehicle_info_plugin/commands/mobile/read_did_request.h"
+#include <string>
#include "application_manager/application_impl.h"
-#include "interfaces/MOBILE_API.h"
-#include "interfaces/HMI_API.h"
#include "application_manager/message_helper.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
namespace vehicle_info_plugin {
using namespace application_manager;
@@ -45,15 +45,12 @@ namespace commands {
ReadDIDRequest::ReadDIDRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
ReadDIDRequest::~ReadDIDRequest() {}
@@ -131,4 +128,4 @@ void ReadDIDRequest::on_event(const event_engine::Event& event) {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc
index 82d49574f0..42e7fc1ba9 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_response.cc
@@ -41,15 +41,12 @@ namespace commands {
ReadDIDResponse::ReadDIDResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandResponseImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
ReadDIDResponse::~ReadDIDResponse() {}
@@ -61,4 +58,4 @@ void ReadDIDResponse::Run() {
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc
index 27716855a2..36d972d5fd 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc
@@ -1,26 +1,19 @@
/*
-
Copyright (c) 2018, Ford Motor Company
All rights reserved.
-
Copyright (c) 2018, Livio, Inc.
All rights reserved.
-
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following
disclaimer in the documentation and/or other materials provided with the
distribution.
-
Neither the name of the Ford Motor Company nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -36,82 +29,31 @@
#include "vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h"
+#include <boost/algorithm/string.hpp>
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
+#include "smart_objects/enum_schema_item.h"
#include "utils/helpers.h"
#include "vehicle_info_plugin/vehicle_info_app_extension.h"
+namespace VD_ResultCode = hmi_apis::Common_VehicleDataResultCode;
+
namespace vehicle_info_plugin {
using namespace application_manager;
namespace commands {
SubscribeVehicleDataRequest::SubscribeVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ VehicleInfoCommandParams params)
: CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
+ , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {}
SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() {}
-#ifdef HMI_DBUS_API
-namespace {
-struct Subrequest {
- hmi_apis::FunctionID::eType func_id;
- const char* str;
-};
-Subrequest subrequests[] = {
- {hmi_apis::FunctionID::VehicleInfo_SubscribeGps, strings::gps},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed, strings::speed},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeRpm, strings::rpm},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel, strings::fuel_level},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State,
- strings::fuel_level_state},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption,
- strings::instant_fuel_consumption},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature,
- strings::external_temp},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeVin, strings::vin},
- {hmi_apis::FunctionID::VehicleInfo_SubscribePrndl, strings::prndl},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure,
- strings::tire_pressure},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer, strings::odometer},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus,
- strings::belt_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation,
- strings::body_information},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus,
- strings::device_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking,
- strings::driver_braking},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus,
- strings::wiper_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus,
- strings::head_lamp_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque,
- strings::engine_torque},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition,
- strings::acc_pedal_pos},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle,
- strings::steering_wheel_angle},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo,
- strings::e_call_info},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus,
- strings::airbag_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent,
- strings::emergency_event},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus,
- strings::cluster_mode_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey, strings::my_key},
-};
-}
-#endif // #ifdef HMI_DBUS_API
-
void SubscribeVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -133,6 +75,7 @@ void SubscribeVehicleDataRequest::Run() {
app, info, result_code, response_params, msg_params, result);
if (mobile_apis::Result::INVALID_ENUM != result_code) {
+ AppendDataTypesToMobileResponse(response_params);
SendResponse(result,
result_code,
info.empty() ? NULL : info.c_str(),
@@ -140,33 +83,10 @@ void SubscribeVehicleDataRequest::Run() {
return;
}
-#ifdef HMI_DBUS_API
- // Generate list of subrequests
- for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) {
- const Subrequest& sr = subrequests[i];
- if (true == (*message_)[strings::msg_params].keyExists(sr.str) &&
- true == (*message_)[strings::msg_params][sr.str].asBool()) {
- HmiRequest hmi_request;
- hmi_request.str = sr.str;
- hmi_request.func_id = sr.func_id;
- hmi_request.complete = false;
- hmi_requests_.push_back(hmi_request);
- }
- }
- LOG4CXX_DEBUG(
- logger_, hmi_requests_.size() << " requests are going to be sent to HMI");
-
- // Send subrequests
- for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it)
- SendHMIRequest(it->func_id, &msg_params, true);
-#else
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData,
&msg_params,
true);
-#endif // #ifdef HMI_DBUS_API
}
void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
@@ -188,64 +108,6 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
return;
}
-#ifdef HMI_DBUS_API
- for (HmiRequests::iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it) {
- HmiRequest& hmi_request = *it;
- if (hmi_request.func_id == event.id()) {
- hmi_request.status = static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
- if (hmi_apis::Common_Result::SUCCESS == hmi_request.status)
- hmi_request.value = message[strings::msg_params][hmi_request.str];
- hmi_request.complete = true;
- break;
- }
- }
- bool all_complete = true;
- bool any_arg_success = false;
- mobile_api::Result::eType status = mobile_api::Result::eType::SUCCESS;
- for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it) {
- if (!it->complete) {
- all_complete = false;
- break;
- }
- if (hmi_apis::Common_Result::SUCCESS != it->status) {
- if (mobile_api::Result::SUCCESS == status) {
- status = static_cast<mobile_apis::Result::eType>(it->status);
- } else if (status !=
- static_cast<mobile_apis::Result::eType>(it->status)) {
- status = mobile_api::Result::eType::GENERIC_ERROR;
- }
- LOG4CXX_TRACE(logger_,
- "Status from HMI: " << it->status
- << ", so response status become "
- << status);
- } else {
- any_arg_success = true;
- }
- }
-
- if (all_complete) {
- smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
- if (any_arg_success) {
- for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it) {
- response_params[it->str] = it->value;
- }
- }
- LOG4CXX_DEBUG(logger_, "All HMI requests are complete");
- const bool result = any_arg_success;
- SendResponse(any_arg_success, status, NULL, &response_params);
- if (result) {
- app->UpdateHash();
- }
- }
-#else
-
hmi_apis::Common_Result::eType hmi_result =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
@@ -259,36 +121,121 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
mobile_apis::Result::eType result_code =
MessageHelper::HMIToMobileResult(hmi_result);
+ smart_objects::SmartObject converted_msg_params(message[strings::msg_params]);
+ custom_vehicle_data_manager_.CreateMobileMessageParams(converted_msg_params);
+
if (is_succeeded) {
if (!vi_already_subscribed_by_this_app_.empty()) {
result_code = mobile_apis::Result::IGNORED;
response_info = "Already subscribed on some provided VehicleData.";
}
- if (!vi_waiting_for_subscribe_.empty()) {
- LOG4CXX_DEBUG(logger_, "Subscribing to all pending VehicleData");
- VehicleInfoSubscriptions::const_iterator key =
- vi_waiting_for_subscribe_.begin();
- for (; key != vi_waiting_for_subscribe_.end(); ++key) {
- auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
- ext.subscribeToVehicleInfo(*key);
+ for (const auto& param : converted_msg_params.enumerate()) {
+ const auto& converted_name = ConvertResponseToRequestName(param);
+ if (vi_waiting_for_subscribe_.end() ==
+ vi_waiting_for_subscribe_.find(converted_name)) {
+ LOG4CXX_DEBUG(logger_, "erase " << converted_name);
+ converted_msg_params.erase(param);
}
}
- }
- UnsubscribeFailedSubscriptions(app, message[strings::msg_params]);
+ if (!SubscribePendingVehicleData(app, converted_msg_params)) {
+ result_code = mobile_apis::Result::GENERIC_ERROR;
+ response_info = "Subscription failed for some Vehicle data";
+ SendResponse(false, result_code, response_info.c_str());
+ return;
+ }
+ }
if (!vi_already_subscribed_by_another_apps_.empty() ||
!vi_already_subscribed_by_this_app_.empty()) {
- AddAlreadySubscribedVI(
- const_cast<smart_objects::SmartObject&>(message[strings::msg_params]));
+ AddAlreadySubscribedVI(converted_msg_params);
}
+ AppendDataTypesToMobileResponse(converted_msg_params);
SendResponse(is_succeeded,
result_code,
response_info.empty() ? NULL : response_info.c_str(),
- &(message[strings::msg_params]));
-#endif // #ifdef HMI_DBUS_API
+ &converted_msg_params);
+}
+
+void SubscribeVehicleDataRequest::AppendDataTypesToMobileResponse(
+ smart_objects::SmartObject& msg_params) const {
+ using namespace smart_objects;
+
+ std::string oem_vehicle_data_type_str;
+ EnumConversionHelper<VehicleDataType>::EnumToString(
+ VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA, &oem_vehicle_data_type_str);
+
+ const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data();
+ for (const auto& item : msg_params.enumerate()) {
+ const auto& rpc_spec_vehicle_data_item = rpc_spec_vehicle_data.find(item);
+ if (rpc_spec_vehicle_data.end() == rpc_spec_vehicle_data_item) {
+ msg_params[item][strings::data_type] = oem_vehicle_data_type_str;
+ msg_params[item][strings::oem_custom_data_type] =
+ custom_vehicle_data_manager_.GetVehicleDataItemType(item);
+ } else {
+ msg_params[item][strings::data_type] = rpc_spec_vehicle_data_item->second;
+ }
+ }
+}
+
+bool SubscribeVehicleDataRequest::CheckSubscriptionStatus(
+ std::string vi_name, const smart_objects::SmartObject& msg_params) {
+ const auto subscribed_items = msg_params.enumerate();
+ if (subscribed_items.end() == subscribed_items.find(vi_name)) {
+ LOG4CXX_WARN(logger_,
+ vi_name << " is waiting to be subscribed, but missing in "
+ "vehicle response.");
+ return false;
+ }
+
+ auto res_code = msg_params[vi_name][strings::result_code].asInt();
+ if (VD_ResultCode::VDRC_SUCCESS != res_code &&
+ VD_ResultCode::VDRC_DATA_ALREADY_SUBSCRIBED != res_code) {
+ LOG4CXX_WARN(logger_,
+ "Subscription to " << vi_name << " for " << connection_key()
+ << " failed.");
+ return false;
+ }
+ return true;
+}
+
+bool SubscribeVehicleDataRequest::SubscribePendingVehicleData(
+ ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) {
+ LOG4CXX_DEBUG(logger_, "Subscribing to all pending VehicleData");
+
+ std::set<hmi_apis::Common_VehicleDataResultCode::eType> skiped_result_codes(
+ {VD_ResultCode::VDRC_TRUNCATED_DATA,
+ VD_ResultCode::VDRC_DISALLOWED,
+ VD_ResultCode::VDRC_USER_DISALLOWED,
+ VD_ResultCode::VDRC_INVALID_ID,
+ VD_ResultCode::VDRC_DATA_NOT_AVAILABLE,
+ VD_ResultCode::VDRC_DATA_NOT_SUBSCRIBED,
+ VD_ResultCode::VDRC_IGNORED});
+
+ for (auto vi_name = vi_waiting_for_subscribe_.begin();
+ vi_name != vi_waiting_for_subscribe_.end();) {
+ const bool is_subscription_successful = CheckSubscriptionStatus(
+ ConvertRequestToResponseName(*vi_name), msg_params);
+
+ if (is_subscription_successful) {
+ auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
+ ext.subscribeToVehicleInfo(*vi_name);
+ vi_name = vi_waiting_for_subscribe_.erase(vi_name);
+ } else {
+ auto res_code =
+ static_cast<hmi_apis::Common_VehicleDataResultCode::eType>(
+ msg_params[*vi_name][strings::result_code].asInt());
+ if (skiped_result_codes.find(res_code) != skiped_result_codes.end()) {
+ msg_params[*vi_name][strings::result_code] = res_code;
+ vi_name = vi_waiting_for_subscribe_.erase(vi_name);
+ } else {
+ ++vi_name;
+ }
+ }
+ }
+ return vi_waiting_for_subscribe_.empty();
}
bool SubscribeVehicleDataRequest::Init() {
@@ -300,97 +247,39 @@ void SubscribeVehicleDataRequest::AddAlreadySubscribedVI(
smart_objects::SmartObject& msg_params) const {
LOG4CXX_AUTO_TRACE(logger_);
using namespace mobile_apis;
- auto vi_to_string =
- [](const mobile_apis::VehicleDataType::eType vehicle_data) {
- for (auto& vi_str_to_int_pair : MessageHelper::vehicle_data()) {
- if (vehicle_data == vi_str_to_int_pair.second) {
- return vi_str_to_int_pair.first;
- }
- }
- return std::string();
- };
- VehicleInfoSubscriptions::const_iterator it_same_app =
- vi_already_subscribed_by_this_app_.begin();
- for (; vi_already_subscribed_by_this_app_.end() != it_same_app;
- ++it_same_app) {
- msg_params[vi_to_string(*it_same_app)][strings::result_code] =
+ for (const auto& item : vi_already_subscribed_by_this_app_) {
+ msg_params[item][strings::result_code] =
VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED;
- msg_params[vi_to_string(*it_same_app)][strings::data_type] = *it_same_app;
}
- VehicleInfoSubscriptions::const_iterator it_another_app =
- vi_already_subscribed_by_another_apps_.begin();
- for (; vi_already_subscribed_by_another_apps_.end() != it_another_app;
- ++it_another_app) {
- msg_params[vi_to_string(*it_another_app)][strings::result_code] =
+ for (const auto& item : vi_already_subscribed_by_another_apps_) {
+ msg_params[item][strings::result_code] =
VehicleDataResultCode::VDRC_SUCCESS;
- msg_params[vi_to_string(*it_another_app)][strings::data_type] =
- *it_another_app;
- }
-}
-
-void SubscribeVehicleDataRequest::UnsubscribeFailedSubscriptions(
- ApplicationSharedPtr app,
- const smart_objects::SmartObject& msg_params) const {
- LOG4CXX_AUTO_TRACE(logger_);
- const VehicleData& vehicle_data = MessageHelper::vehicle_data();
- VehicleData::const_iterator it = vehicle_data.begin();
-
- for (; vehicle_data.end() != it; ++it) {
- if (msg_params.keyExists(it->first)) {
- if (msg_params[it->first][strings::result_code].asInt() !=
- hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS) {
- LOG4CXX_DEBUG(logger_,
- "Subscription for VehicleDataType "
- << it->first
- << " is unsuccessfull. "
- "Unsubscribing app with connection key "
- << connection_key() << " from it.");
- VehicleInfoAppExtension::ExtractVIExtension(*app)
- .unsubscribeFromVehicleInfo(it->second);
- }
- }
}
}
struct SubscribedToIVIPredicate {
- int32_t vehicle_info_;
- SubscribedToIVIPredicate(int32_t vehicle_info)
+ std::string vehicle_info_;
+ SubscribedToIVIPredicate(std::string vehicle_info)
: vehicle_info_(vehicle_info) {}
bool operator()(const ApplicationSharedPtr app) const {
DCHECK_OR_RETURN(app, false);
auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
- return ext.isSubscribedToVehicleInfo(
- static_cast<mobile_apis::VehicleDataType::eType>(vehicle_info_));
+ return ext.isSubscribedToVehicleInfo(vehicle_info_);
}
};
bool SubscribeVehicleDataRequest::IsSomeoneSubscribedFor(
- const uint32_t param_id) const {
+ const std::string& param_name) const {
LOG4CXX_AUTO_TRACE(logger_);
- SubscribedToIVIPredicate finder(param_id);
+ SubscribedToIVIPredicate finder(param_name);
DataAccessor<ApplicationSet> accessor = application_manager_.applications();
ApplicationSetConstIt it = std::find_if(
accessor.GetData().begin(), accessor.GetData().end(), finder);
return it != accessor.GetData().end();
}
-void SubscribeVehicleDataRequest::CheckVISubscribtions(
- ApplicationSharedPtr app,
- std::string& out_info,
- mobile_apis::Result::eType& out_result_code,
- smart_objects::SmartObject& out_response_params,
- smart_objects::SmartObject& out_request_params,
- bool& out_result) {
- CheckVISubscriptions(app,
- out_info,
- out_result_code,
- out_response_params,
- out_request_params,
- out_result);
-}
-
void SubscribeVehicleDataRequest::CheckVISubscriptions(
ApplicationSharedPtr app,
std::string& out_info,
@@ -398,93 +287,101 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions(
smart_objects::SmartObject& out_response_params,
smart_objects::SmartObject& out_request_params,
bool& out_result) {
- // counter for items to subscribe
- VehicleInfoSubscriptions::size_type items_to_subscribe = 0;
- // counter for subscribed items by application
- uint32_t subscribed_items = 0;
+ const bool is_interface_not_available =
+ (HmiInterfaces::STATE_NOT_AVAILABLE ==
+ application_manager_.hmi_interfaces().GetInterfaceState(
+ HmiInterfaces::HMI_INTERFACE_VehicleInfo));
+
+ VehicleInfoSubscriptions::size_type subscribed_items = 0;
+
+ auto app_already_subscribed =
+ [this, &out_response_params](
+ const std::string& key_name,
+ const mobile_apis::VehicleDataType::eType vd_type) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "App with connection key "
+ << connection_key()
+ << " is subscribed already for VehicleData: " << key_name);
+ vi_already_subscribed_by_this_app_.insert(key_name);
+ out_response_params[key_name][strings::data_type] = vd_type;
+ out_response_params[key_name][strings::result_code] =
+ mobile_apis::VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED;
+ };
- const VehicleData& vehicle_data = MessageHelper::vehicle_data();
- VehicleData::const_iterator it = vehicle_data.begin();
+ auto another_app_subscribed =
+ [this, &out_response_params, &subscribed_items](
+ const std::string& key_name,
+ const mobile_apis::VehicleDataType::eType vd_type,
+ vehicle_info_plugin::VehicleInfoAppExtension& ext) {
+ LOG4CXX_DEBUG(logger_,
+ "There are apps subscribed already for "
+ "VehicleDataType: "
+ << key_name);
+
+ if (!ext.subscribeToVehicleInfo(key_name)) {
+ LOG4CXX_ERROR(
+ logger_, "Unable to subscribe for VehicleDataType: " << key_name);
+ return;
+ }
+ LOG4CXX_DEBUG(
+ logger_,
+ "App with connection key "
+ << connection_key()
+ << " have been subscribed for VehicleDataType: " << key_name);
+ vi_already_subscribed_by_another_apps_.insert(key_name);
+ out_response_params[key_name][strings::data_type] = vd_type;
+ out_response_params[key_name][strings::result_code] =
+ mobile_apis::VehicleDataResultCode::VDRC_SUCCESS;
+ ++subscribed_items;
+ };
- HmiInterfaces::InterfaceState interface_state =
- application_manager_.hmi_interfaces().GetInterfaceState(
- HmiInterfaces::HMI_INTERFACE_VehicleInfo);
+ auto first_subscription = [this, &out_request_params, &subscribed_items](
+ const std::string& vi_name) {
+ out_request_params[vi_name] = (*message_)[strings::msg_params][vi_name];
- const bool is_interface_not_available =
- interface_state == HmiInterfaces::STATE_NOT_AVAILABLE;
-
- for (; vehicle_data.end() != it; ++it) {
- const std::string& key_name = it->first;
- if ((*message_)[strings::msg_params].keyExists(key_name)) {
- const bool is_key_enabled =
- (*message_)[strings::msg_params][key_name].asBool();
- if (is_key_enabled) {
- ++items_to_subscribe;
- }
- if (!is_interface_not_available && is_key_enabled) {
- mobile_apis::VehicleDataType::eType key_type = it->second;
- const auto is_subscribed =
- VehicleInfoAppExtension::ExtractVIExtension(*app)
- .isSubscribedToVehicleInfo(key_type);
- if (is_subscribed) {
- LOG4CXX_DEBUG(logger_,
- "App with connection key "
- << connection_key()
- << " is subscribed already for VehicleDataType: "
- << key_type);
- ++subscribed_items;
- vi_already_subscribed_by_this_app_.insert(key_type);
- out_response_params[key_name][strings::data_type] = key_type;
- out_response_params[key_name][strings::result_code] =
- mobile_apis::VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED;
- continue;
- }
+ vi_waiting_for_subscribe_.insert(vi_name);
+ LOG4CXX_DEBUG(
+ logger_,
+ "App with connection key "
+ << connection_key()
+ << " will be subscribed for VehicleDataType: " << vi_name);
+ ++subscribed_items;
+ return true;
+ };
- if (IsSomeoneSubscribedFor(key_type)) {
- LOG4CXX_DEBUG(logger_,
- "There are apps subscribed already for "
- "VehicleDataType: "
- << key_type);
- auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
-
- if (!ext.subscribeToVehicleInfo(key_type)) {
- LOG4CXX_ERROR(
- logger_,
- "Unable to subscribe for VehicleDataType: " << key_type);
- continue;
- }
- LOG4CXX_DEBUG(
- logger_,
- "App with connection key "
- << connection_key()
- << " have been subscribed for VehicleDataType: " << key_type);
- ++subscribed_items;
- vi_already_subscribed_by_another_apps_.insert(key_type);
- out_response_params[key_name][strings::data_type] = key_type;
- out_response_params[key_name][strings::result_code] =
- mobile_apis::VehicleDataResultCode::VDRC_SUCCESS;
- continue;
- }
+ auto rpc_spec_vehicle_data = MessageHelper::vehicle_data();
+ auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
- out_request_params[key_name] = is_key_enabled;
+ VehicleInfoSubscriptions::size_type items_to_subscribe = 0;
+ auto item_names = (*message_)[strings::msg_params].enumerate();
+ if (!is_interface_not_available) {
+ for (const auto& name : item_names) {
+ auto enabled = (*message_)[strings::msg_params][name].asBool();
+ if (!enabled) {
+ continue;
+ }
- if (is_key_enabled) {
- vi_waiting_for_subscribe_.insert(key_type);
- LOG4CXX_DEBUG(
- logger_,
- "App with connection key "
- << connection_key()
- << " will be subscribed for VehicleDataType: " << key_type);
- ++subscribed_items;
- }
+ auto vehicle_data = rpc_spec_vehicle_data.find(name);
+ auto vehicle_data_type =
+ (vehicle_data == rpc_spec_vehicle_data.end())
+ ? VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA
+ : vehicle_data->second;
+ if (ext.isSubscribedToVehicleInfo(name)) {
+ app_already_subscribed(name, vehicle_data_type);
+ } else if (IsSomeoneSubscribedFor(name)) {
+ another_app_subscribed(name, vehicle_data_type, ext);
+ } else if (!first_subscription(name)) {
+ continue;
}
+
+ ++items_to_subscribe;
}
}
const bool is_everything_already_subscribed =
- items_to_subscribe ==
- vi_already_subscribed_by_another_apps_.size() +
- vi_already_subscribed_by_this_app_.size();
+ items_to_subscribe == vi_already_subscribed_by_another_apps_.size() +
+ vi_already_subscribed_by_this_app_.size();
if (0 == items_to_subscribe) {
if (HasDisallowedParams()) {
@@ -494,12 +391,14 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions(
out_info = "No data in the request";
}
out_result = false;
+ return;
}
if (0 == subscribed_items && !is_interface_not_available) {
out_result_code = mobile_apis::Result::IGNORED;
out_info = "Already subscribed on provided VehicleData.";
out_result = false;
+ return;
}
if (is_everything_already_subscribed) {
@@ -510,8 +409,35 @@ void SubscribeVehicleDataRequest::CheckVISubscriptions(
out_info = "Already subscribed on some provided VehicleData.";
}
out_result = true;
+ return;
}
}
+const std::string& SubscribeVehicleDataRequest::ConvertResponseToRequestName(
+ const std::string& name) {
+ static std::map<std::string, std::string> parameter_name_conversion_map = {
+ {strings::cluster_modes, strings::cluster_mode_status}};
+ const auto converted_it = parameter_name_conversion_map.find(name);
+ auto result = parameter_name_conversion_map.end() == converted_it
+ ? name
+ : converted_it->second;
+ return parameter_name_conversion_map.end() == converted_it
+ ? name
+ : converted_it->second;
+}
+
+const std::string& SubscribeVehicleDataRequest::ConvertRequestToResponseName(
+ const std::string& name) {
+ static std::map<std::string, std::string> parameter_name_conversion_map = {
+ {strings::cluster_mode_status, strings::cluster_modes}};
+ const auto converted_it = parameter_name_conversion_map.find(name);
+ auto result = parameter_name_conversion_map.end() == converted_it
+ ? name
+ : converted_it->second;
+ return parameter_name_conversion_map.end() == converted_it
+ ? name
+ : converted_it->second;
+}
+
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc
index 2bea839320..8330176af6 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_response.cc
@@ -32,8 +32,8 @@
*/
#include "vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_response.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
#include "interfaces/MOBILE_API.h"
namespace vehicle_info_plugin {
@@ -42,15 +42,12 @@ namespace commands {
SubscribeVehicleDataResponse::SubscribeVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandResponseImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
SubscribeVehicleDataResponse::~SubscribeVehicleDataResponse() {}
@@ -60,4 +57,4 @@ void SubscribeVehicleDataResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc
index de419894c5..32d63f0c35 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc
@@ -36,9 +36,10 @@
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
-#include "interfaces/MOBILE_API.h"
-#include "interfaces/HMI_API.h"
#include "application_manager/smart_object_keys.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/enum_schema_item.h"
#include "utils/helpers.h"
#include "vehicle_info_plugin/vehicle_info_app_extension.h"
@@ -48,72 +49,16 @@ namespace commands {
UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandRequestImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_)
+ , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {}
UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() {}
-#ifdef HMI_DBUS_API
-namespace {
-struct Subrequest {
- hmi_apis::FunctionID::eType func_id;
- const char* str;
-};
-Subrequest subrequests[] = {
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps, strings::gps},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed, strings::speed},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm, strings::rpm},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel,
- strings::fuel_level},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State,
- strings::fuel_level_state},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption,
- strings::instant_fuel_consumption},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature,
- strings::external_temp},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin, strings::vin},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl, strings::prndl},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure,
- strings::tire_pressure},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer, strings::odometer},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus,
- strings::belt_status},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation,
- strings::body_information},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus,
- strings::device_status},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking,
- strings::driver_braking},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus,
- strings::wiper_status},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus,
- strings::head_lamp_status},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque,
- strings::engine_torque},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition,
- strings::acc_pedal_pos},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle,
- strings::steering_wheel_angle},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo,
- strings::e_call_info},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus,
- strings::airbag_status},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent,
- strings::emergency_event},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus,
- strings::cluster_mode_status},
- {hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey, strings::my_key},
-};
-}
-#endif // #ifdef HMI_DBUS_API
-
void UnsubscribeVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -128,67 +73,64 @@ void UnsubscribeVehicleDataRequest::Run() {
int32_t items_to_unsubscribe = 0;
int32_t unsubscribed_items = 0;
- const VehicleData& vehicle_data = MessageHelper::vehicle_data();
- VehicleData::const_iterator it = vehicle_data.begin();
-
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- smart_objects::SmartObject response_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+ response_params_ = smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ auto rpc_spec_vehicle_data = MessageHelper::vehicle_data();
+ std::set<std::string> custom_vehicle_data;
+
+ auto app_not_subscribed_response = [this](const std::string& key_name) {
+ LOG4CXX_DEBUG(logger_,
+ "App with connection key "
+ << connection_key()
+ << " is not subscribed for VehicleData: " << key_name);
+ vi_already_unsubscribed_by_this_app_.insert(key_name);
+ response_params_[key_name][strings::result_code] =
+ mobile_apis::VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED;
+ };
+
+ auto other_app_subscribed_response = [this](const std::string& key_name) {
+ LOG4CXX_DEBUG(logger_,
+ "There are apps still subscribed for "
+ "VehicleDataType: "
+ << key_name);
+ vi_still_subscribed_by_another_apps_.insert(key_name);
+ response_params_[key_name][strings::result_code] =
+ mobile_apis::VehicleDataResultCode::VDRC_SUCCESS;
+ };
+
+ auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
+
+ const auto& param_names = (*message_)[strings::msg_params].enumerate();
+ for (const auto& name : param_names) {
+ const bool enabled = (*message_)[strings::msg_params][name].asBool();
+ if (!enabled) {
+ continue;
+ }
- for (; vehicle_data.end() != it; ++it) {
- const std::string& key_name = it->first;
- if ((*message_)[strings::msg_params].keyExists(key_name)) {
- bool is_key_enabled = (*message_)[strings::msg_params][key_name].asBool();
- if (is_key_enabled) {
- ++items_to_unsubscribe;
-
- mobile_apis::VehicleDataType::eType key_type = it->second;
- const auto is_subscribed =
- VehicleInfoAppExtension::ExtractVIExtension(*app)
- .isSubscribedToVehicleInfo(key_type);
- if (!is_subscribed) {
- ++unsubscribed_items;
- vi_already_unsubscribed_by_this_app_.insert(key_type);
- response_params[key_name][strings::data_type] = key_type;
- response_params[key_name][strings::result_code] =
- mobile_apis::VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED;
- continue;
- }
-
- if (!VehicleInfoAppExtension::ExtractVIExtension(*app)
- .unsubscribeFromVehicleInfo(it->second)) {
- LOG4CXX_ERROR(logger_,
- "Unable to unsubscribe from "
- "VehicleDataType: "
- << key_type);
- continue;
- }
-
- LOG4CXX_DEBUG(logger_,
- "Unsubscribed app with connection key "
- << connection_key()
- << " from VehicleDataType: " << key_type);
-
- ++unsubscribed_items;
-
- if (IsSomeoneSubscribedFor(key_type)) {
- LOG4CXX_DEBUG(logger_,
- "There are another apps still subscribed for "
- "VehicleDataType: "
- << key_type);
-
- vi_still_subscribed_by_another_apps_.insert(key_type);
- response_params[key_name][strings::data_type] = key_type;
- response_params[key_name][strings::result_code] =
- mobile_apis::VehicleDataResultCode::VDRC_SUCCESS;
- continue;
- }
-
- msg_params[key_name] = is_key_enabled;
- }
+ ++items_to_unsubscribe;
+
+ if (!(ext.isSubscribedToVehicleInfo(name))) {
+ app_not_subscribed_response(name);
+ continue;
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Unsubscribed app with connection key "
+ << connection_key() << " from VehicleDataType: " << name);
+
+ ++unsubscribed_items;
+
+ if (IsSomeoneSubscribedFor(name)) {
+ other_app_subscribed_response(name);
+ ext.unsubscribeFromVehicleInfo(name);
+ continue;
}
+
+ vi_waiting_for_unsubscribe_.insert(name);
+ msg_params[name] = true;
}
bool is_everything_already_unsubscribed =
@@ -196,6 +138,8 @@ void UnsubscribeVehicleDataRequest::Run() {
vi_still_subscribed_by_another_apps_.size() +
vi_already_unsubscribed_by_this_app_.size();
+ AppendDataTypesToMobileResponse(response_params_);
+
if (0 == items_to_unsubscribe) {
if (HasDisallowedParams()) {
SendResponse(false, mobile_apis::Result::DISALLOWED);
@@ -210,7 +154,7 @@ void UnsubscribeVehicleDataRequest::Run() {
SendResponse(false,
mobile_apis::Result::IGNORED,
"Was not subscribed on any VehicleData.",
- &response_params);
+ &response_params_);
return;
}
@@ -219,40 +163,17 @@ void UnsubscribeVehicleDataRequest::Run() {
SendResponse(false,
mobile_apis::Result::IGNORED,
"Some provided VehicleData was not subscribed.",
- &response_params);
+ &response_params_);
} else {
- SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params_);
}
return;
}
-#ifdef HMI_DBUS_API
- // Generate list of subrequests
- for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) {
- const Subrequest& sr = subrequests[i];
- if (true == (*message_)[strings::msg_params].keyExists(sr.str) &&
- true == (*message_)[strings::msg_params][sr.str].asBool()) {
- HmiRequest hmi_request;
- hmi_request.str = sr.str;
- hmi_request.func_id = sr.func_id;
- hmi_request.complete = false;
- hmi_requests_.push_back(hmi_request);
- }
- }
- LOG4CXX_INFO(logger_,
- hmi_requests_.size() << " requests are going to be sent to HMI");
-
- // Send subrequests
- for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it)
- SendHMIRequest(it->func_id, &msg_params, true);
-#else
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo);
SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData,
&msg_params,
true);
-#endif // #ifdef HMI_DBUS_API
}
void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
@@ -275,101 +196,61 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
return;
}
-#ifdef HMI_DBUS_API
- for (HmiRequests::iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it) {
- HmiRequest& hmi_request = *it;
- if (hmi_request.func_id == event.id()) {
- hmi_request.status = static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
- if (hmi_apis::Common_Result::SUCCESS == hmi_request.status)
- hmi_request.value = message[strings::msg_params][hmi_request.str];
- hmi_request.complete = true;
- break;
- }
- }
- bool all_complete = true;
- bool any_arg_success = false;
- mobile_api::Result::eType status = mobile_api::Result::eType::SUCCESS;
- for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it) {
- if (!it->complete) {
- all_complete = false;
- break;
- }
- if (hmi_apis::Common_Result::SUCCESS != it->status) {
- if (mobile_api::Result::SUCCESS == status) {
- status = static_cast<mobile_apis::Result::eType>(it->status);
- } else if (status !=
- static_cast<mobile_apis::Result::eType>(it->status)) {
- status = mobile_api::Result::eType::GENERIC_ERROR;
- }
- LOG4CXX_TRACE(logger_,
- "Status from HMI: " << it->status
- << ", so response status become "
- << status);
- } else {
- any_arg_success = true;
- }
- }
- if (all_complete) {
- smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
- if (any_arg_success) {
- for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end();
- ++it) {
- response_params[it->str] = it->value;
- }
- }
-
- LOG4CXX_INFO(logger_, "All HMI requests are complete");
- if (true == any_arg_success) {
- SetAllowedToTerminate(false);
- }
- SendResponse(any_arg_success, status, NULL, &response_params);
- if (true == any_arg_success) {
- app->UpdateHash();
- }
- }
-#else
hmi_apis::Common_Result::eType hmi_result =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
std::string response_info;
GetInfo(message, response_info);
- const bool result = PrepareResultForMobileResponse(
+ bool result = PrepareResultForMobileResponse(
hmi_result, HmiInterfaces::HMI_INTERFACE_VehicleInfo);
+ auto hmi_response_msg_params = message[strings::msg_params];
+
mobile_apis::Result::eType result_code =
MessageHelper::HMIToMobileResult(hmi_result);
+ custom_vehicle_data_manager_.CreateMobileMessageParams(
+ hmi_response_msg_params);
+
+ if (!vi_still_subscribed_by_another_apps_.empty() ||
+ !vi_already_unsubscribed_by_this_app_.empty()) {
+ AddAlreadyUnsubscribedVI(hmi_response_msg_params);
+ }
+
if (result) {
if (vi_already_unsubscribed_by_this_app_.size()) {
result_code = mobile_apis::Result::IGNORED;
response_info = "Some provided VehicleData was not subscribed.";
}
- }
- if (!vi_still_subscribed_by_another_apps_.empty() ||
- !vi_already_unsubscribed_by_this_app_.empty()) {
- AddAlreadyUnsubscribedVI(
- const_cast<smart_objects::SmartObject&>(message[strings::msg_params]));
- }
+ for (const auto& param : hmi_response_msg_params.enumerate()) {
+ const auto converted_param = ConvertResponseToRequestName(param);
+ if (vi_waiting_for_unsubscribe_.end() ==
+ vi_waiting_for_unsubscribe_.find(converted_param)) {
+ hmi_response_msg_params.erase(param);
+ }
+ }
- if (result) {
- SetAllowedToTerminate(false);
+ if (!UnsubscribePendingVehicleData(app, hmi_response_msg_params)) {
+ result = false;
+ result_code = mobile_apis::Result::GENERIC_ERROR;
+ response_info = "Unsubscription failed for some Vehicle data";
+ hmi_response_msg_params = smart_objects::SmartObject();
+ }
}
- SendResponse(result,
- result_code,
- response_info.empty() ? NULL : response_info.c_str(),
- &(message[strings::msg_params]));
- if (result) {
- application_manager_.TerminateRequest(
- connection_key(), correlation_id(), function_id());
+
+ AppendDataTypesToMobileResponse(hmi_response_msg_params);
+ for (const auto& key : hmi_response_msg_params.enumerate()) {
+ response_params_[key] = hmi_response_msg_params[key];
}
-#endif // #ifdef HMI_DBUS_API
+
+ SendResponse(
+ result,
+ result_code,
+ response_info.empty() ? NULL : response_info.c_str(),
+ smart_objects::SmartType::SmartType_Null == response_params_.getType()
+ ? NULL
+ : &response_params_);
}
bool UnsubscribeVehicleDataRequest::Init() {
@@ -377,25 +258,23 @@ bool UnsubscribeVehicleDataRequest::Init() {
return true;
}
-struct SubscribedToIVIPredicate {
- int32_t vehicle_info_;
- SubscribedToIVIPredicate(int32_t vehicle_info)
- : vehicle_info_(vehicle_info) {}
- bool operator()(const ApplicationSharedPtr app) const {
+bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor(
+ const std::string& param_name) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto conn_key = connection_key();
+ auto subscribed_to_ivi = [&param_name,
+ &conn_key](const ApplicationSharedPtr app) {
DCHECK_OR_RETURN(app, false);
+ if (conn_key == app->app_id()) {
+ return false;
+ }
auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
- return ext.isSubscribedToVehicleInfo(
- static_cast<mobile_apis::VehicleDataType::eType>(vehicle_info_));
- }
-};
+ return (ext.isSubscribedToVehicleInfo(param_name));
+ };
-bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor(
- const uint32_t param_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
- SubscribedToIVIPredicate finder(param_id);
DataAccessor<ApplicationSet> accessor = application_manager_.applications();
ApplicationSetConstIt it = std::find_if(
- accessor.GetData().begin(), accessor.GetData().end(), finder);
+ accessor.GetData().begin(), accessor.GetData().end(), subscribed_to_ivi);
return it != accessor.GetData().end();
}
@@ -403,22 +282,94 @@ void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI(
smart_objects::SmartObject& response) const {
LOG4CXX_AUTO_TRACE(logger_);
using namespace mobile_apis;
- VehicleInfoSubscriptions::const_iterator it_same_app =
- vi_already_unsubscribed_by_this_app_.begin();
- for (; vi_already_unsubscribed_by_this_app_.end() != it_same_app;
- ++it_same_app) {
- response[*it_same_app][strings::result_code] =
+
+ for (const auto& item : vi_already_unsubscribed_by_this_app_) {
+ response[item][strings::result_code] =
VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED;
}
- VehicleInfoSubscriptions::const_iterator it_another_app =
- vi_still_subscribed_by_another_apps_.begin();
- for (; vi_still_subscribed_by_another_apps_.end() != it_another_app;
- ++it_another_app) {
- response[*it_another_app][strings::result_code] =
- VehicleDataResultCode::VDRC_SUCCESS;
+ for (const auto& item : vi_still_subscribed_by_another_apps_) {
+ response[item][strings::result_code] = VehicleDataResultCode::VDRC_SUCCESS;
+ }
+}
+
+bool UnsubscribeVehicleDataRequest::CheckSubscriptionStatus(
+ std::string key, const smart_objects::SmartObject& msg_params) {
+ const auto unsubscribed_items = msg_params.enumerate();
+ if (unsubscribed_items.end() == unsubscribed_items.find(key)) {
+ LOG4CXX_WARN(logger_,
+ key << " is waiting to be unsubscribed, but missing in "
+ "vehicle response.");
+ return false;
+ }
+
+ auto res_code = msg_params[key][strings::result_code].asInt();
+ if (hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS != res_code) {
+ LOG4CXX_WARN(logger_,
+ "Unubscribing from " << key << " for " << connection_key()
+ << " failed.");
+ return false;
+ }
+ return true;
+}
+
+bool UnsubscribeVehicleDataRequest::UnsubscribePendingVehicleData(
+ ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params) {
+ LOG4CXX_DEBUG(logger_, "Unsubscribing from all pending VehicleData");
+
+ for (const auto& vi_name : vi_waiting_for_unsubscribe_) {
+ const auto converted_item = ConvertRequestToResponseName(vi_name);
+ const bool is_unsubscription_successful =
+ CheckSubscriptionStatus(converted_item, msg_params);
+ if (is_unsubscription_successful) {
+ auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
+ ext.unsubscribeFromVehicleInfo(vi_name);
+ vi_waiting_for_unsubscribe_.erase(vi_name);
+ }
+ }
+ return vi_waiting_for_unsubscribe_.empty();
+}
+
+const std::string& UnsubscribeVehicleDataRequest::ConvertRequestToResponseName(
+ const std::string& name) {
+ static std::map<std::string, std::string> parameter_name_converion_map = {
+ {strings::cluster_mode_status, strings::cluster_modes}};
+ const auto converted_it = parameter_name_converion_map.find(name);
+ return parameter_name_converion_map.end() == converted_it
+ ? name
+ : converted_it->second;
+}
+
+const std::string& UnsubscribeVehicleDataRequest::ConvertResponseToRequestName(
+ const std::string& name) {
+ static std::map<std::string, std::string> parameter_name_converion_map = {
+ {strings::cluster_modes, strings::cluster_mode_status}};
+ const auto converted_it = parameter_name_converion_map.find(name);
+ return parameter_name_converion_map.end() == converted_it
+ ? name
+ : converted_it->second;
+}
+
+void UnsubscribeVehicleDataRequest::AppendDataTypesToMobileResponse(
+ smart_objects::SmartObject& msg_params) const {
+ using namespace smart_objects;
+
+ std::string oem_vehicle_data_type_str;
+ EnumConversionHelper<VehicleDataType>::EnumToString(
+ VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA, &oem_vehicle_data_type_str);
+
+ const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data();
+ for (const auto& item : msg_params.enumerate()) {
+ const auto& rpc_spec_vehicle_data_item = rpc_spec_vehicle_data.find(item);
+ if (rpc_spec_vehicle_data.end() == rpc_spec_vehicle_data_item) {
+ msg_params[item][strings::data_type] = oem_vehicle_data_type_str;
+ msg_params[item][strings::oem_custom_data_type] =
+ custom_vehicle_data_manager_.GetVehicleDataItemType(item);
+ } else {
+ msg_params[item][strings::data_type] = rpc_spec_vehicle_data_item->second;
+ }
}
}
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc
index 5f79785784..352239c331 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_response.cc
@@ -40,15 +40,12 @@ namespace commands {
UnsubscribeVehicleDataResponse::UnsubscribeVehicleDataResponse(
const application_manager::commands::MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ const VehicleInfoCommandParams& params)
: CommandResponseImpl(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ params.application_manager_,
+ params.rpc_service_,
+ params.hmi_capabilities_,
+ params.policy_handler_) {}
UnsubscribeVehicleDataResponse::~UnsubscribeVehicleDataResponse() {}
@@ -67,4 +64,4 @@ void UnsubscribeVehicleDataResponse::Run() {
}
} // namespace commands
-} // namespace application_manager
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc
new file mode 100644
index 0000000000..9df6d922aa
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc
@@ -0,0 +1,575 @@
+/**
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "vehicle_info_plugin/custom_vehicle_data_manager_impl.h"
+#include <strings.h>
+#include <limits>
+#include "policy/policy_table/types.h"
+#include "vehicle_info_plugin/vehicle_data_item_schema.h"
+
+#include "application_manager/application_manager.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/policies/custom_vehicle_data_provider.h"
+#include "interfaces/MOBILE_API_schema.h"
+#include "policy/policy_table/policy_enum_schema_factory.h"
+#include "smart_objects/enum_schema_item.h"
+#include "utils/helpers.h"
+#include "utils/optional.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
+
+namespace vehicle_info_plugin {
+
+template <typename T, typename U>
+U GetOptional(const rpc::Optional<T>& optional, U def_val) {
+ return optional.is_initialized() ? static_cast<U>(*optional) : def_val;
+}
+
+enum SearchMethod { RECURSIVE = 0, NON_RECURSIVE };
+
+CustomVehicleDataManagerImpl::CustomVehicleDataManagerImpl(
+ policy::VehicleDataItemProvider& vehicle_data_provider,
+ application_manager::rpc_service::RPCService& rpc_service)
+ : vehicle_data_provider_(vehicle_data_provider)
+ , rpc_service_(rpc_service) {}
+
+std::string CustomVehicleDataManagerImpl::GetVehicleDataItemType(
+ const std::string& vehicle_data_item_name) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto& schema = FindSchemaByNameNonRecursive(vehicle_data_item_name);
+
+ return schema.is_initialized() ? std::string(schema->type)
+ : vehicle_data_item_name;
+}
+
+bool CustomVehicleDataManagerImpl::IsValidCustomVehicleDataName(
+ const std::string& name) const {
+ const auto& schema = FindSchemaByNameNonRecursive(name);
+ return schema.is_initialized();
+}
+
+bool CustomVehicleDataManagerImpl::IsRemovedCustomVehicleDataName(
+ const std::string& name) const {
+ const auto& schema = FindRemovedSchemaByNameNonRecursive(name);
+ return schema.is_initialized();
+}
+
+void CustomVehicleDataManagerImpl::CreateMobileMessageParams(
+ smart_objects::SmartObject& msg_params) {
+ using namespace application_manager;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ typedef std::function<smart_objects::SmartObject(
+ const smart_objects::SmartObject& input_params,
+ SearchMethod search_method)>
+ MobileMsgConstructor;
+
+ MobileMsgConstructor fill_mobile_msg =
+ [this, &fill_mobile_msg](
+ const smart_objects::SmartObject& input_params,
+ SearchMethod search_method) -> smart_objects::SmartObject {
+ smart_objects::SmartObject out_params;
+
+ const auto& items = input_params.enumerate();
+ for (const auto& key : items) {
+ auto schema = search_method == SearchMethod::RECURSIVE
+ ? FindSchemaByKeyRecursive(key)
+ : FindSchemaByKeyNonRecursive(key);
+ if (!schema.is_initialized()) {
+ LOG4CXX_DEBUG(logger_, "Schema for: " << key << " cannot be found");
+ continue;
+ }
+
+ const auto& item_name = schema->name;
+ if (policy_table::VehicleDataItem::kStruct == std::string(schema->type)) {
+ auto& input_param = input_params[key];
+ if (*schema->array &&
+ input_param.getType() == smart_objects::SmartType_Array) {
+ for (size_t i = 0; i < input_param.length(); i++) {
+ const auto param =
+ fill_mobile_msg(input_param[i], SearchMethod::RECURSIVE);
+ out_params[item_name][i] = param;
+ }
+ continue;
+ } else {
+ const auto param =
+ fill_mobile_msg(input_param, SearchMethod::RECURSIVE);
+ if (!param.empty()) {
+ out_params[item_name] = param;
+ continue;
+ }
+ }
+ }
+
+ out_params[item_name] = input_params[key];
+ }
+
+ return out_params;
+ };
+
+ const auto& rpc_spec_vehicle_data = MessageHelper::vehicle_data();
+ const auto& item_names = msg_params.enumerate();
+ smart_objects::SmartObject params_to_convert;
+
+ for (const auto& item_key : item_names) {
+ const auto& found_it = rpc_spec_vehicle_data.find(item_key);
+ if (found_it == rpc_spec_vehicle_data.end()) {
+ params_to_convert[item_key] = msg_params[item_key];
+ msg_params.erase(item_key);
+ }
+ }
+
+ const auto& mobile_msg_params =
+ fill_mobile_msg(params_to_convert, SearchMethod::NON_RECURSIVE);
+ for (const auto& name : mobile_msg_params.enumerate()) {
+ msg_params[name] = mobile_msg_params[name];
+ }
+}
+
+smart_objects::SmartObject CustomVehicleDataManagerImpl::CreateHMIMessageParams(
+ const std::set<std::string>& item_names) {
+ typedef std::function<smart_objects::SmartObject(
+ const policy_table::VehicleDataItem&)>
+ ParamsConstructor;
+
+ auto fill_param = [](ParamsConstructor& constructor,
+ const policy_table::VehicleDataItem& param,
+ smart_objects::SmartObject* out_params) {
+ DCHECK_OR_RETURN_VOID(out_params)
+ const auto param_key = std::string(param.key);
+ const auto param_type = std::string(param.type);
+ if (policy_table::VehicleDataItem::kStruct == param_type) {
+ (*out_params)[param_key] = constructor(param);
+ } else {
+ (*out_params)[param_key] = true;
+ }
+ };
+
+ ParamsConstructor fill_hmi_params =
+ [&fill_hmi_params,
+ fill_param](const policy_table::VehicleDataItem& item) {
+ smart_objects::SmartObject out_params;
+ DCHECK(policy_table::VehicleDataItem::kStruct ==
+ std::string(item.type));
+ for (auto& param : *(item.params)) {
+ fill_param(fill_hmi_params, param, &out_params);
+ }
+ return out_params;
+ };
+
+ smart_objects::SmartObject out_params(smart_objects::SmartType_Map);
+ for (const auto& name : item_names) {
+ auto schema = FindSchemaByNameNonRecursive(name);
+ if (schema.is_initialized()) {
+ fill_param(fill_hmi_params, *schema, &out_params);
+ continue;
+ }
+
+ auto removed_schema = FindRemovedSchemaByNameNonRecursive(name);
+ if (removed_schema.is_initialized()) {
+ fill_param(fill_hmi_params, *removed_schema, &out_params);
+ }
+ }
+
+ return out_params;
+}
+
+template <typename Comparer>
+const OptionalDataItem FindSchema(
+ const std::vector<policy_table::VehicleDataItem>& oem_items,
+ SearchMethod search_method,
+ Comparer comparer) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::vector<policy_table::VehicleDataItem> items;
+ for (const auto& item : oem_items) {
+ if (comparer(item)) {
+ items.push_back(item);
+ }
+ if (search_method == SearchMethod::RECURSIVE &&
+ policy_table::VehicleDataItem::kStruct == std::string(item.type)) {
+ auto found_in_params =
+ FindSchema(*(item.params), search_method, comparer);
+ if (found_in_params.is_initialized()) {
+ items.push_back(*found_in_params);
+ }
+ }
+ }
+ std::sort(items.begin(),
+ items.end(),
+ [](const policy_table::VehicleDataItem& left,
+ const policy_table::VehicleDataItem& right) {
+ if (!right.since.is_initialized()) {
+ return false;
+ }
+ if (!left.since.is_initialized()) {
+ return true;
+ }
+ const std::string l = *left.since;
+ const std::string r = *right.since;
+ return std::stof(l.c_str()) > std::stof(r.c_str());
+ });
+
+ if (!items.empty()) {
+ return OptionalDataItem(*items.begin());
+ }
+
+ return OptionalDataItem();
+}
+
+void CustomVehicleDataManagerImpl::UpdateVehicleDataItems() {
+ using namespace ns_smart_device_link::ns_smart_objects;
+ using namespace policy_table;
+
+ enum class SMemberType {
+ SMEMBER_MOBILE,
+ SMEMBER_HMI,
+ SMEMBER_BOOL_MOBILE,
+ SMEMBER_BOOL_HMI,
+ SMEMBER_VDR_MOBILE,
+ SMEMBER_VDR_HMI
+ };
+
+ auto get_custom_vdi = [this]()
+ -> std::vector<rpc::policy_table_interface_base::VehicleDataItem> {
+ using namespace rpc::policy_table_interface_base;
+ std::vector<VehicleDataItem> custom_vehicle_data_items;
+ auto vehicle_data_items = vehicle_data_provider_.GetVehicleDataItems();
+ for (const auto& item : vehicle_data_items) {
+ policy_table::Parameter parameter_enum;
+ if (!policy_table::EnumFromJsonString(item.name, &parameter_enum)) {
+ custom_vehicle_data_items.push_back(item);
+ }
+ }
+ return custom_vehicle_data_items;
+ };
+
+ auto vehicle_data_items = get_custom_vdi();
+
+ auto get_ischema_item = [](const VehicleDataItem& item,
+ SMemberType type,
+ std::vector<SMember> history = {}) -> SMember {
+ switch (type) {
+ case SMemberType::SMEMBER_BOOL_MOBILE: {
+ auto member_schema =
+ CBoolSchemaItem::create(TSchemaItemParameter<bool>());
+ return SMember(
+ member_schema,
+ false, // root level items should not be mandatory
+ item.since.is_initialized() ? std::string(*item.since) : "",
+ item.until.is_initialized() ? std::string(*item.until) : "",
+ bool(*item.deprecated),
+ bool(*item.removed),
+ history);
+ }
+ case SMemberType::SMEMBER_VDR_MOBILE: {
+ // valid since struct_schema_items is not used in
+ // InitStructSchemaItem_VehicleDataResult
+ mobile_apis::MOBILE_API::TStructsSchemaItems mobile_struct_schema_items;
+ auto member_schema =
+ mobile_apis::MOBILE_API::InitStructSchemaItem_VehicleDataResult(
+ mobile_struct_schema_items);
+ return SMember(
+ member_schema,
+ false, // root level items should not be mandatory
+ item.since.is_initialized() ? std::string(*item.since) : "",
+ item.until.is_initialized() ? std::string(*item.until) : "",
+ bool(*item.deprecated),
+ bool(*item.removed),
+ history);
+ }
+ case SMemberType::SMEMBER_MOBILE: {
+ TSchemaItemParameter<VehicleDataItem> tschema_item(item);
+ auto member_schema = VehicleDataItemSchema::create(
+ tschema_item, VehicleDataItemSchema::SchemaType::MOBILE);
+ return SMember(
+ member_schema,
+ false, // root level items should not be mandatory
+ item.since.is_initialized() ? std::string(*item.since) : "",
+ item.until.is_initialized() ? std::string(*item.until) : "",
+ bool(*item.deprecated),
+ bool(*item.removed),
+ history);
+ }
+ case SMemberType::SMEMBER_BOOL_HMI: {
+ auto member_schema =
+ CBoolSchemaItem::create(TSchemaItemParameter<bool>());
+ return SMember(member_schema,
+ false // root level items should not be mandatory
+ );
+ }
+ case SMemberType::SMEMBER_VDR_HMI: {
+ // valid since struct_schema_items is not used in
+ // InitStructSchemaItem_Common_VehicleDataResult
+ hmi_apis::HMI_API::TStructsSchemaItems hmi_struct_schema_items;
+ auto member_schema =
+ hmi_apis::HMI_API::InitStructSchemaItem_Common_VehicleDataResult(
+ hmi_struct_schema_items);
+ return SMember(
+ member_schema, false // root level items should not be mandatory
+ );
+ }
+ case SMemberType::SMEMBER_HMI: {
+ TSchemaItemParameter<VehicleDataItem> tschema_item(item);
+ auto member_schema = VehicleDataItemSchema::create(
+ tschema_item, VehicleDataItemSchema::SchemaType::HMI);
+ return SMember(
+ member_schema, false // root level items should not be mandatory
+ );
+ }
+ default: {
+ auto member_schema = CAlwaysFalseSchemaItem::create();
+ return SMember(member_schema, false);
+ }
+ }
+ };
+
+ auto get_vehicle_data_history =
+ [&vehicle_data_items](std::string name) -> std::vector<VehicleDataItem> {
+ std::vector<VehicleDataItem> result;
+ std::copy_if(vehicle_data_items.begin(),
+ vehicle_data_items.end(),
+ std::back_inserter(result),
+ [&name](VehicleDataItem& item) { return item.name == name; });
+
+ std::sort(result.begin(),
+ result.end(),
+ [](const policy_table::VehicleDataItem& left,
+ const policy_table::VehicleDataItem& right) {
+ if (!right.since.is_initialized()) {
+ return false;
+ }
+ if (!left.since.is_initialized()) {
+ return true;
+ }
+ const std::string l = *left.since;
+ const std::string r = *right.since;
+ return std::stof(l.c_str()) > std::stof(r.c_str());
+ });
+
+ return result;
+ };
+
+ auto get_member_with_history = [&get_ischema_item](
+ std::vector<VehicleDataItem> items,
+ SMemberType type) -> SMember {
+ std::vector<SMember> history = {};
+ std::vector<SMemberType> types{SMemberType::SMEMBER_MOBILE,
+ SMemberType::SMEMBER_VDR_MOBILE,
+ SMemberType::SMEMBER_BOOL_MOBILE};
+ if (helpers::in_range(types, type) && items.size() > 1) {
+ auto history_iterator = items.begin() + 1;
+ for (; history_iterator < items.end(); ++history_iterator) {
+ const auto& item = (*history_iterator);
+ history.push_back(get_ischema_item(item, type));
+ }
+ }
+
+ auto latest_item = (*items.begin());
+ return get_ischema_item(latest_item, type, history);
+ };
+
+ CustomVehicleDataManagerImpl::RPCParams mobile_params;
+ CustomVehicleDataManagerImpl::RPCParams hmi_params;
+
+ std::set<std::string> vehicle_data_names;
+ for (const auto& item : vehicle_data_items) {
+ vehicle_data_names.insert(item.name);
+ }
+
+ for (const auto& name : vehicle_data_names) {
+ auto vehicle_data_history = get_vehicle_data_history(name);
+ const auto& vdi = vehicle_data_history.begin();
+
+ SMember member_bool_hmi = get_member_with_history(
+ vehicle_data_history, SMemberType::SMEMBER_BOOL_HMI);
+ SMember member_bool_mobile = get_member_with_history(
+ vehicle_data_history, SMemberType::SMEMBER_BOOL_MOBILE);
+
+ SMember member_vdr_hmi = get_member_with_history(
+ vehicle_data_history, SMemberType::SMEMBER_VDR_HMI);
+ SMember member_vdr_mobile = get_member_with_history(
+ vehicle_data_history, SMemberType::SMEMBER_VDR_MOBILE);
+ SMember member_hmi =
+ get_member_with_history(vehicle_data_history, SMemberType::SMEMBER_HMI);
+ SMember member_mobile = get_member_with_history(
+ vehicle_data_history, SMemberType::SMEMBER_MOBILE);
+
+ mobile_params.addBoolParam(
+ std::pair<std::string, SMember>(vdi->name, member_bool_mobile));
+ mobile_params.addVDRParam(
+ std::pair<std::string, SMember>(vdi->name, member_vdr_mobile));
+ mobile_params.addParam(
+ std::pair<std::string, SMember>(vdi->name, member_mobile));
+
+ hmi_params.addBoolParam(
+ std::pair<std::string, SMember>(vdi->key, member_bool_hmi));
+ hmi_params.addVDRParam(
+ std::pair<std::string, SMember>(vdi->key, member_vdr_hmi));
+ hmi_params.addParam(std::pair<std::string, SMember>(vdi->key, member_hmi));
+ }
+
+ std::vector<mobile_apis::FunctionID::eType> mobile_subscribe_functions{
+ mobile_apis::FunctionID::SubscribeVehicleDataID,
+ mobile_apis::FunctionID::UnsubscribeVehicleDataID};
+
+ for (const auto& function_id : mobile_subscribe_functions) {
+ rpc_service_.UpdateMobileRPCParams(function_id,
+ mobile_apis::messageType::request,
+ mobile_params.getBoolParams());
+ rpc_service_.UpdateMobileRPCParams(function_id,
+ mobile_apis::messageType::response,
+ mobile_params.getVDRParams());
+ }
+
+ std::vector<hmi_apis::FunctionID::eType> hmi_subscribe_functions{
+ hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData,
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData};
+
+ for (const auto& function_id : hmi_subscribe_functions) {
+ rpc_service_.UpdateHMIRPCParams(function_id,
+ hmi_apis::messageType::request,
+ hmi_params.getBoolParams());
+ rpc_service_.UpdateHMIRPCParams(function_id,
+ hmi_apis::messageType::response,
+ hmi_params.getVDRParams());
+ }
+
+ rpc_service_.UpdateMobileRPCParams(mobile_apis::FunctionID::GetVehicleDataID,
+ mobile_apis::messageType::request,
+ mobile_params.getBoolParams());
+
+ rpc_service_.UpdateMobileRPCParams(mobile_apis::FunctionID::GetVehicleDataID,
+ mobile_apis::messageType::response,
+ mobile_params.getParams());
+
+ rpc_service_.UpdateMobileRPCParams(mobile_apis::FunctionID::OnVehicleDataID,
+ mobile_apis::messageType::notification,
+ mobile_params.getParams());
+
+ rpc_service_.UpdateHMIRPCParams(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleData,
+ hmi_apis::messageType::request,
+ hmi_params.getBoolParams());
+
+ rpc_service_.UpdateHMIRPCParams(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleData,
+ hmi_apis::messageType::response,
+ hmi_params.getParams());
+
+ rpc_service_.UpdateHMIRPCParams(
+ hmi_apis::FunctionID::VehicleInfo_OnVehicleData,
+ hmi_apis::messageType::notification,
+ hmi_params.getParams());
+}
+
+void CustomVehicleDataManagerImpl::OnPolicyEvent(
+ plugin_manager::PolicyEvent policy_event) {
+ using namespace plugin_manager;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ switch (policy_event) {
+ case kApplicationPolicyUpdated:
+ UpdateVehicleDataItems();
+ break;
+ case kApplicationsDisabled:
+ default:
+ return;
+ }
+}
+
+const OptionalDataItem
+CustomVehicleDataManagerImpl::FindSchemaByNameNonRecursive(
+ const std::string& name) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto& oem_items = vehicle_data_provider_.GetVehicleDataItems();
+ auto compare_by_name = [&name](const policy_table::VehicleDataItem& item) {
+ return (name == std::string(item.name));
+ };
+
+ return FindSchema(oem_items, SearchMethod::NON_RECURSIVE, compare_by_name);
+}
+
+const OptionalDataItem
+CustomVehicleDataManagerImpl::FindRemovedSchemaByNameNonRecursive(
+ const std::string& name) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const auto& removed_oem_items =
+ vehicle_data_provider_.GetRemovedVehicleDataItems();
+ auto compare_by_name = [&name](const policy_table::VehicleDataItem& item) {
+ return (name == std::string(item.name));
+ };
+
+ return FindSchema(
+ removed_oem_items, SearchMethod::NON_RECURSIVE, compare_by_name);
+}
+
+const OptionalDataItem CustomVehicleDataManagerImpl::FindSchemaByNameRecursive(
+ const std::string& name) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto& oem_items = vehicle_data_provider_.GetVehicleDataItems();
+ auto compare_by_name = [&name](const policy_table::VehicleDataItem& item) {
+ return (name == std::string(item.name));
+ };
+
+ return FindSchema(oem_items, SearchMethod::RECURSIVE, compare_by_name);
+}
+
+const OptionalDataItem
+CustomVehicleDataManagerImpl::FindSchemaByKeyNonRecursive(
+ const std::string& key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto& oem_items = vehicle_data_provider_.GetVehicleDataItems();
+ auto compare_by_key = [&key](const policy_table::VehicleDataItem& item) {
+ return (key == std::string(item.key));
+ };
+
+ return FindSchema(oem_items, SearchMethod::NON_RECURSIVE, compare_by_key);
+}
+
+const OptionalDataItem CustomVehicleDataManagerImpl::FindSchemaByKeyRecursive(
+ const std::string& key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto& oem_items = vehicle_data_provider_.GetVehicleDataItems();
+ auto compare_by_key = [&key](const policy_table::VehicleDataItem& item) {
+ return (key == std::string(item.key));
+ };
+
+ return FindSchema(oem_items, SearchMethod::RECURSIVE, compare_by_key);
+}
+
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc
new file mode 100644
index 0000000000..750da9fa6e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_data_item_schema.cc
@@ -0,0 +1,188 @@
+#include "vehicle_info_plugin/vehicle_data_item_schema.h"
+#include <limits>
+
+namespace vehicle_info_plugin {
+
+#ifdef ENABLE_LOG
+CREATE_LOGGERPTR_LOCAL(vehicle_data_logger, "VehicleDataItemSchema");
+#endif // ENABLE_LOG
+
+VehicleDataItemSchema::VehicleDataItemSchema(PolicyDataItem& policy_item,
+ SchemaType schema_type) {
+ policy_table::VehicleDataItem policy_data_item;
+ policy_item.getValue(policy_data_item);
+
+ auto get_object_schema = [&policy_data_item,
+ &schema_type]() -> decltype(so_schema_item_) {
+ smart_objects::Members members;
+ auto object_schema = smart_objects::CObjectSchemaItem::create(members);
+
+ for (auto& e : *policy_data_item.params) {
+ auto schema_item = PolicyDataItem(e);
+ smart_objects::SMember member(create(schema_item, schema_type),
+ bool(e.mandatory),
+ std::string(*e.since),
+ std::string(*e.until),
+ bool(*e.deprecated),
+ bool(*e.removed));
+ std::string name;
+ switch (schema_type) {
+ case VehicleDataItemSchema::SchemaType::HMI:
+ name = e.key;
+ break;
+ case VehicleDataItemSchema::SchemaType::MOBILE:
+ default:
+ name = e.name;
+ break;
+ }
+ object_schema->AddMemberSchemaItem(name, member);
+ }
+
+ return object_schema;
+ };
+
+ auto get_schema = [&policy_data_item,
+ &get_object_schema,
+ &schema_type,
+ this]() -> decltype(so_schema_item_) {
+ // Check if policy item has POD type
+ if (isPODType(policy_data_item.type)) {
+ return GetPODTypeSchema(policy_data_item, schema_type);
+ }
+
+ // Check if policy item has Struct type
+ if (policy_data_item.type == policy_table::VehicleDataItem::kStruct) {
+ return get_object_schema();
+ }
+
+ // Check if policy item has Enum type
+ auto enum_schema = getEnumSchema(policy_data_item.type);
+ if (enum_schema != nullptr) {
+ return enum_schema;
+ }
+
+ // If an unknown type is present in the policy table, it is assumed that it
+ // is a future enum type. Since normal validation cannot be performed on
+ // this value, it is treated as a raw string instead
+ policy_data_item.type = "String";
+
+ return GetPODTypeSchema(policy_data_item, schema_type);
+ };
+
+ if (*policy_data_item.array) {
+ so_schema_item_ = smart_objects::CArraySchemaItem::create(
+ get_schema(),
+ policy_data_item.minsize.is_initialized()
+ ? smart_objects::TSchemaItemParameter<size_t>(
+ *policy_data_item.minsize)
+ : smart_objects::TSchemaItemParameter<size_t>(),
+ policy_data_item.maxsize.is_initialized()
+ ? smart_objects::TSchemaItemParameter<size_t>(
+ *policy_data_item.maxsize)
+ : smart_objects::TSchemaItemParameter<size_t>());
+ } else {
+ so_schema_item_ = get_schema();
+ }
+}
+
+VehicleDataItemSchemaPtr VehicleDataItemSchema::create(
+ PolicyDataItem& policy_item, SchemaType schema_type) {
+ return VehicleDataItemSchemaPtr(
+ new VehicleDataItemSchema(policy_item, schema_type));
+}
+
+smart_objects::errors::eType
+vehicle_info_plugin::VehicleDataItemSchema::validate(
+ const smart_objects::SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
+ if (!so_schema_item_) {
+ std::string validation_info =
+ "Invalid type: " +
+ smart_objects::SmartObject::typeToString(Object.getType());
+ report__->set_validation_info(validation_info);
+ return smart_objects::errors::eType::ERROR;
+ }
+
+ return so_schema_item_->validate(
+ Object, report__, MessageVersion, allow_unknown_enums);
+}
+
+smart_objects::ISchemaItemPtr VehicleDataItemSchema::GetPODTypeSchema(
+ const policy_table::VehicleDataItem& policy_item, SchemaType schema_type) {
+ using IntSchemaItem = smart_objects::TNumberSchemaItem<int64_t>;
+ using IntItemParam = smart_objects::TSchemaItemParameter<int64_t>;
+ using FloatSchemaItem = smart_objects::TNumberSchemaItem<double>;
+ using FloatItemParam = smart_objects::TSchemaItemParameter<double>;
+ using StringSchemaItem = smart_objects::CStringSchemaItem;
+ using StringItemParam = smart_objects::TSchemaItemParameter<size_t>;
+ using BoolSchemaItem = smart_objects::CBoolSchemaItem;
+ using BoolItemParam = smart_objects::TSchemaItemParameter<bool>;
+
+ if (policy_item.type == policy_table::VehicleDataItem::kInteger) {
+ return IntSchemaItem::create(policy_item.minvalue.is_initialized()
+ ? IntItemParam(*policy_item.minvalue)
+ : IntItemParam(),
+ policy_item.maxvalue.is_initialized()
+ ? IntItemParam(*policy_item.maxvalue)
+ : IntItemParam());
+ }
+ if (policy_item.type == policy_table::VehicleDataItem::kFloat ||
+ policy_item.type == policy_table::VehicleDataItem::kDouble) {
+ return FloatSchemaItem::create(
+ policy_item.minvalue.is_initialized()
+ ? FloatItemParam(double(*policy_item.minvalue))
+ : FloatItemParam(),
+ policy_item.maxvalue.is_initialized()
+ ? FloatItemParam(double(*policy_item.maxvalue))
+ : FloatItemParam());
+ }
+ if (policy_item.type == policy_table::VehicleDataItem::kString) {
+ return StringSchemaItem::create(
+ StringItemParam(policy_item.minlength.is_initialized()
+ ? *policy_item.minlength
+ : 0),
+ policy_item.maxlength.is_initialized()
+ ? StringItemParam(*policy_item.maxlength)
+ : StringItemParam());
+ }
+ if (policy_item.type == policy_table::VehicleDataItem::kBoolean) {
+ return BoolSchemaItem::create(BoolItemParam(true));
+ }
+
+ std::string error_msg = std::string("Invalid POD type provided: ") +
+ std::string(policy_item.type);
+ LOG4CXX_ERROR(vehicle_data_logger, error_msg.c_str());
+ return nullptr;
+}
+
+const bool VehicleDataItemSchema::isPODType(
+ const std::string& type_name) const {
+ return std::find(policy_table::VehicleDataItem::kPODTypes.begin(),
+ policy_table::VehicleDataItem::kPODTypes.end(),
+ type_name) != policy_table::VehicleDataItem::kPODTypes.end();
+}
+
+smart_objects::ISchemaItemPtr VehicleDataItemSchema::getEnumSchema(
+ const std::string& type_name) const {
+ auto enum_schema = policy_table::EnumSchemaItemFactory::Get(type_name);
+ if (!enum_schema) {
+ LOG4CXX_ERROR(vehicle_data_logger, "NULL pointer: " << type_name);
+ }
+ return enum_schema;
+}
+
+void VehicleDataItemSchema::applySchema(
+ smart_objects::SmartObject& Object,
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion) {
+ so_schema_item_->applySchema(
+ Object, remove_unknown_parameters, MessageVersion);
+}
+
+void VehicleDataItemSchema::unapplySchema(
+ smart_objects::SmartObject& Object, const bool remove_unknown_parameters) {
+ so_schema_item_->unapplySchema(Object, remove_unknown_parameters);
+}
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc
index ed4755a818..149299d3bb 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc
@@ -53,13 +53,13 @@ VehicleInfoAppExtension::~VehicleInfoAppExtension() {
}
bool VehicleInfoAppExtension::subscribeToVehicleInfo(
- const VehicleDataType vehicle_data) {
+ const std::string& vehicle_data) {
LOG4CXX_DEBUG(logger_, vehicle_data);
return subscribed_data_.insert(vehicle_data).second;
}
bool VehicleInfoAppExtension::unsubscribeFromVehicleInfo(
- const VehicleDataType vehicle_data) {
+ const std::string& vehicle_data) {
LOG4CXX_DEBUG(logger_, vehicle_data);
auto it = subscribed_data_.find(vehicle_data);
if (it != subscribed_data_.end()) {
@@ -75,7 +75,7 @@ void VehicleInfoAppExtension::unsubscribeFromVehicleInfo() {
}
bool VehicleInfoAppExtension::isSubscribedToVehicleInfo(
- const VehicleDataType vehicle_data) const {
+ const std::string& vehicle_data) const {
LOG4CXX_DEBUG(logger_, vehicle_data);
return subscribed_data_.find(vehicle_data) != subscribed_data_.end();
}
@@ -91,7 +91,7 @@ void VehicleInfoAppExtension::SaveResumptionData(
smart_objects::SmartObject(smart_objects::SmartType_Array);
int i = 0;
for (const auto& subscription : subscribed_data_) {
- resumption_data[application_vehicle_info][i] = subscription;
+ resumption_data[application_vehicle_info][i++] = subscription;
}
}
@@ -99,13 +99,12 @@ void VehicleInfoAppExtension::ProcessResumption(
const smart_objects::SmartObject& resumption_data) {
const char* application_vehicle_info = "vehicleInfo";
if (resumption_data.keyExists(application_vehicle_info)) {
- const smart_objects::SmartObject& subscriptions_ivi =
- resumption_data[application_vehicle_info];
- for (size_t i = 0; i < subscriptions_ivi.length(); ++i) {
- mobile_apis::VehicleDataType::eType ivi =
- static_cast<mobile_apis::VehicleDataType::eType>(
- (resumption_data[i]).asInt());
- subscribeToVehicleInfo(ivi);
+ const auto* subscriptions_ivi =
+ resumption_data[application_vehicle_info].asArray();
+ if (subscriptions_ivi) {
+ for (const auto& ivi : (*subscriptions_ivi)) {
+ subscribeToVehicleInfo(ivi.asString());
+ }
}
plugin_.ProcessResumptionSubscription(app_, *this);
}
@@ -118,9 +117,8 @@ VehicleInfoAppExtension& VehicleInfoAppExtension::ExtractVIExtension(
DCHECK(ext_ptr);
DCHECK(dynamic_cast<VehicleInfoAppExtension*>(ext_ptr.get()));
auto vi_app_extension =
- application_manager::AppExtensionPtr::static_pointer_cast<
- VehicleInfoAppExtension>(ext_ptr);
+ std::static_pointer_cast<VehicleInfoAppExtension>(ext_ptr);
DCHECK(vi_app_extension);
return *vi_app_extension;
}
-}
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc
index 32959174da..52ee9f476d 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_command_factory.cc
@@ -36,15 +36,27 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
namespace vehicle_info_plugin {
+namespace app_mngr = application_manager;
+namespace commands = application_manager::commands;
+
VehicleInfoCommandFactory::VehicleInfoCommandFactory(
app_mngr::ApplicationManager& application_manager,
app_mngr::rpc_service::RPCService& rpc_service,
app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
- : hmi_command_factory_(new VehicleInfoHmiCommandFactory(
- application_manager, rpc_service, hmi_capabilities, policy_handler))
- , mob_command_factory_(new VehicleInfoMobileCommandFactory(
- application_manager, rpc_service, hmi_capabilities, policy_handler)) {
+ policy::PolicyHandlerInterface& policy_handler,
+ CustomVehicleDataManager& custom_vehicle_data_manager)
+ : hmi_command_factory_(
+ new VehicleInfoHmiCommandFactory(application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler,
+ custom_vehicle_data_manager))
+ , mob_command_factory_(
+ new VehicleInfoMobileCommandFactory(application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler,
+ custom_vehicle_data_manager)) {
LOG4CXX_AUTO_TRACE(logger_);
}
@@ -53,7 +65,8 @@ VehicleInfoCommandFactory::~VehicleInfoCommandFactory() {}
app_mngr::CommandSharedPtr VehicleInfoCommandFactory::CreateCommand(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::commands::Command::CommandSource source) {
- if (app_mngr::commands::Command::SOURCE_HMI == source) {
+ if (app_mngr::commands::Command::SOURCE_HMI == source ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source) {
return hmi_command_factory_->CreateCommand(message, source);
} else {
return mob_command_factory_->CreateCommand(message, source);
@@ -63,8 +76,9 @@ app_mngr::CommandSharedPtr VehicleInfoCommandFactory::CreateCommand(
bool VehicleInfoCommandFactory::IsAbleToProcess(
const int32_t function_id,
const commands::Command::CommandSource source) const {
- return commands::Command::SOURCE_HMI == source
+ return (commands::Command::SOURCE_HMI == source ||
+ app_mngr::commands::Command::SOURCE_SDL_TO_HMI == source)
? hmi_command_factory_->IsAbleToProcess(function_id, source)
: mob_command_factory_->IsAbleToProcess(function_id, source);
}
-}
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc
index 3855d6733b..e8d852b612 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_hmi_command_factory.cc
@@ -41,6 +41,8 @@
#include "vehicle_info_plugin/commands/hmi/vi_get_dtcs_response.h"
#include "vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_request.h"
#include "vehicle_info_plugin/commands/hmi/vi_get_vehicle_data_response.h"
+#include "vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h"
+#include "vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_response.h"
#include "vehicle_info_plugin/commands/hmi/vi_is_ready_request.h"
#include "vehicle_info_plugin/commands/hmi/vi_is_ready_response.h"
#include "vehicle_info_plugin/commands/hmi/vi_read_did_request.h"
@@ -49,23 +51,81 @@
#include "vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_response.h"
#include "vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_request.h"
#include "vehicle_info_plugin/commands/hmi/vi_unsubscribe_vehicle_data_response.h"
-#include "vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h"
-#include "vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_response.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
namespace vehicle_info_plugin {
namespace strings = app_mngr::strings;
+template <typename VehicleInfoCommandType>
+class VehicleInfoCommandCreator : public application_manager::CommandCreator {
+ public:
+ VehicleInfoCommandCreator(const VehicleInfoCommandParams& params)
+ : params_(params) {}
+
+ private:
+ bool CanBeCreated() const override {
+ return true;
+ }
+
+ application_manager::CommandSharedPtr create(
+ const application_manager::commands::MessageSharedPtr& message)
+ const override {
+ application_manager::CommandSharedPtr command(
+ new VehicleInfoCommandType(message, params_));
+ return command;
+ }
+
+ VehicleInfoCommandParams params_;
+};
+
+struct VehicleInfoInvalidCommand {};
+
+template <>
+class VehicleInfoCommandCreator<VehicleInfoInvalidCommand>
+ : public application_manager::CommandCreator {
+ public:
+ VehicleInfoCommandCreator(const VehicleInfoCommandParams& params) {
+ UNUSED(params);
+ }
+
+ private:
+ bool CanBeCreated() const override {
+ return false;
+ }
+
+ application_manager::CommandSharedPtr create(
+ const application_manager::commands::MessageSharedPtr& message)
+ const override {
+ UNUSED(message);
+ return application_manager::CommandSharedPtr();
+ }
+};
+
+struct VehicleInfoCommandCreatorFactory {
+ VehicleInfoCommandCreatorFactory(const VehicleInfoCommandParams& params)
+ : params_(params) {}
+
+ template <typename VehicleInfoCommandType>
+ application_manager::CommandCreator& GetCreator() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ static VehicleInfoCommandCreator<VehicleInfoCommandType> res(params_);
+ return res;
+ }
+ const VehicleInfoCommandParams params_;
+};
+
VehicleInfoHmiCommandFactory::VehicleInfoHmiCommandFactory(
application_manager::ApplicationManager& application_manager,
application_manager::rpc_service::RPCService& rpc_service,
application_manager::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ policy::PolicyHandlerInterface& policy_handler,
+ CustomVehicleDataManager& custom_vehicle_data_manager)
: application_manager_(application_manager)
, rpc_service_(rpc_service)
, hmi_capabilities_(hmi_capabilities)
- , policy_handler_(policy_handler) {
+ , policy_handler_(policy_handler)
+ , custom_vehicle_data_manager_(custom_vehicle_data_manager) {
LOG4CXX_AUTO_TRACE(logger_);
}
@@ -89,6 +149,7 @@ app_mngr::CommandSharedPtr VehicleInfoHmiCommandFactory::CreateCommand(
message_type_str = "error response";
}
+ UNUSED(message_type_str);
LOG4CXX_DEBUG(logger_,
"HMICommandFactory::CreateCommand function_id: "
<< function_id << ", message type: " << message_type_str);
@@ -106,9 +167,12 @@ bool VehicleInfoHmiCommandFactory::IsAbleToProcess(
app_mngr::CommandCreator& VehicleInfoHmiCommandFactory::buildCommandCreator(
const int32_t function_id, const int32_t message_type) const {
- auto factory = app_mngr::CommandCreatorFactory(
- application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
-
+ VehicleInfoCommandParams params = {application_manager_,
+ rpc_service_,
+ hmi_capabilities_,
+ policy_handler_,
+ custom_vehicle_data_manager_};
+ auto factory = VehicleInfoCommandCreatorFactory(params);
switch (function_id) {
case hmi_apis::FunctionID::VehicleInfo_GetVehicleType:
return hmi_apis::messageType::request == message_type
@@ -149,7 +213,7 @@ app_mngr::CommandCreator& VehicleInfoHmiCommandFactory::buildCommandCreator(
: factory.GetCreator<commands::VIDiagnosticMessageResponse>();
default:
LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id);
- return factory.GetCreator<app_mngr::InvalidCommand>();
+ return factory.GetCreator<VehicleInfoInvalidCommand>();
}
}
-}
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
index caa832dde4..c3c8d9c8d7 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc
@@ -34,6 +34,9 @@
#include "application_manager/message.h"
#include "interfaces/MOBILE_API.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
+
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
#include "vehicle_info_plugin/commands/mobile/diagnostic_message_request.h"
#include "vehicle_info_plugin/commands/mobile/diagnostic_message_response.h"
@@ -54,15 +57,75 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
namespace vehicle_info_plugin {
namespace strings = app_mngr::strings;
+template <typename VehicleInfoCommandType>
+class VehicleInfoCommandCreator : public application_manager::CommandCreator {
+ public:
+ VehicleInfoCommandCreator(const VehicleInfoCommandParams& params)
+ : params_(params) {}
+
+ private:
+ bool CanBeCreated() const override {
+ return true;
+ }
+
+ application_manager::CommandSharedPtr create(
+ const application_manager::commands::MessageSharedPtr& message)
+ const override {
+ application_manager::CommandSharedPtr command(
+ new VehicleInfoCommandType(message, params_));
+ return command;
+ }
+
+ VehicleInfoCommandParams params_;
+};
+
+struct VehicleInfoInvalidCommand {};
+
+template <>
+class VehicleInfoCommandCreator<VehicleInfoInvalidCommand>
+ : public application_manager::CommandCreator {
+ public:
+ VehicleInfoCommandCreator(const VehicleInfoCommandParams& params) {
+ UNUSED(params);
+ }
+
+ private:
+ bool CanBeCreated() const override {
+ return false;
+ }
+
+ application_manager::CommandSharedPtr create(
+ const application_manager::commands::MessageSharedPtr& message)
+ const override {
+ UNUSED(message);
+ return application_manager::CommandSharedPtr();
+ }
+};
+
+struct VehicleInfoCommandCreatorFactory {
+ VehicleInfoCommandCreatorFactory(const VehicleInfoCommandParams& params)
+ : params_(params) {}
+
+ template <typename VehicleInfoCommandType>
+ application_manager::CommandCreator& GetCreator() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ static VehicleInfoCommandCreator<VehicleInfoCommandType> res(params_);
+ return res;
+ }
+ const VehicleInfoCommandParams params_;
+};
+
VehicleInfoMobileCommandFactory::VehicleInfoMobileCommandFactory(
application_manager::ApplicationManager& application_manager,
application_manager::rpc_service::RPCService& rpc_service,
application_manager::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ policy::PolicyHandlerInterface& policy_handler,
+ CustomVehicleDataManager& custom_vehicle_data_manager)
: application_manager_(application_manager)
, rpc_service_(rpc_service)
, hmi_capabilities_(hmi_capabilities)
- , policy_handler_(policy_handler) {
+ , policy_handler_(policy_handler)
+ , custom_vehicle_data_manager_(custom_vehicle_data_manager) {
LOG4CXX_AUTO_TRACE(logger_);
}
@@ -86,58 +149,119 @@ app_mngr::CommandSharedPtr VehicleInfoMobileCommandFactory::CreateCommand(
message_type_str = "notification";
}
+ UNUSED(message_type_str);
LOG4CXX_DEBUG(logger_,
"HMICommandFactory::CreateCommand function_id: "
<< function_id << ", message type: " << message_type_str);
- return buildCommandCreator(function_id, message_type).create(message);
+ return get_creator_factory(function_id, message_type, source).create(message);
}
bool VehicleInfoMobileCommandFactory::IsAbleToProcess(
const int32_t function_id,
const app_mngr::commands::Command::CommandSource source) const {
UNUSED(source);
- return buildCommandCreator(function_id,
- mobile_apis::messageType::INVALID_ENUM)
- .CanBeCreated();
+ auto id = static_cast<mobile_apis::FunctionID::eType>(function_id);
+ return get_command_creator(id, mobile_apis::messageType::INVALID_ENUM)
+ .CanBeCreated() ||
+ get_notification_creator(id).CanBeCreated();
}
-app_mngr::CommandCreator& VehicleInfoMobileCommandFactory::buildCommandCreator(
- const int32_t function_id, const int32_t message_type) const {
- auto factory = app_mngr::CommandCreatorFactory(
- application_manager_, rpc_service_, hmi_capabilities_, policy_handler_);
-
- switch (function_id) {
- case mobile_apis::FunctionID::GetVehicleDataID:
+app_mngr::CommandCreator& VehicleInfoMobileCommandFactory::get_command_creator(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type) const {
+ VehicleInfoCommandParams params = {application_manager_,
+ rpc_service_,
+ hmi_capabilities_,
+ policy_handler_,
+ custom_vehicle_data_manager_};
+ auto factory = VehicleInfoCommandCreatorFactory(params);
+ switch (id) {
+ case mobile_apis::FunctionID::GetVehicleDataID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::GetVehicleDataRequest>()
: factory.GetCreator<commands::GetVehicleDataResponse>();
- case mobile_apis::FunctionID::SubscribeVehicleDataID:
+ }
+ case mobile_apis::FunctionID::SubscribeVehicleDataID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::SubscribeVehicleDataRequest>()
: factory.GetCreator<commands::SubscribeVehicleDataResponse>();
- case mobile_apis::FunctionID::UnsubscribeVehicleDataID:
+ }
+ case mobile_apis::FunctionID::UnsubscribeVehicleDataID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::UnsubscribeVehicleDataRequest>()
: factory
.GetCreator<commands::UnsubscribeVehicleDataResponse>();
- case mobile_apis::FunctionID::OnVehicleDataID:
- return factory.GetCreator<commands::OnVehicleDataNotification>();
- case mobile_apis::FunctionID::ReadDIDID:
+ }
+ case mobile_apis::FunctionID::ReadDIDID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::ReadDIDRequest>()
: factory.GetCreator<commands::ReadDIDResponse>();
- case mobile_apis::FunctionID::GetDTCsID:
+ }
+ case mobile_apis::FunctionID::GetDTCsID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::GetDTCsRequest>()
: factory.GetCreator<commands::GetDTCsResponse>();
- case mobile_apis::FunctionID::DiagnosticMessageID:
+ }
+ case mobile_apis::FunctionID::DiagnosticMessageID: {
return mobile_apis::messageType::request == message_type
? factory.GetCreator<commands::DiagnosticMessageRequest>()
: factory.GetCreator<commands::DiagnosticMessageResponse>();
- default:
- LOG4CXX_WARN(logger_, "Unsupported function_id: " << function_id);
- return factory.GetCreator<app_mngr::InvalidCommand>();
+ }
+ default: {}
}
+ return factory.GetCreator<VehicleInfoInvalidCommand>();
}
+
+app_mngr::CommandCreator&
+VehicleInfoMobileCommandFactory::get_notification_creator(
+ const mobile_apis::FunctionID::eType id) const {
+ VehicleInfoCommandParams params = {application_manager_,
+ rpc_service_,
+ hmi_capabilities_,
+ policy_handler_,
+ custom_vehicle_data_manager_};
+ auto factory = VehicleInfoCommandCreatorFactory(params);
+ switch (id) {
+ case mobile_apis::FunctionID::OnVehicleDataID: {
+ return factory.GetCreator<commands::OnVehicleDataNotification>();
+ }
+ default: {}
+ }
+ return factory.GetCreator<VehicleInfoInvalidCommand>();
+}
+
+app_mngr::CommandCreator& VehicleInfoMobileCommandFactory::get_creator_factory(
+ const mobile_apis::FunctionID::eType id,
+ const mobile_apis::messageType::eType message_type,
+ const app_mngr::commands::Command::CommandSource source) const {
+ switch (message_type) {
+ case mobile_apis::messageType::request: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source) {
+ return get_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_apis::messageType::response: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_command_creator(id, message_type);
+ }
+ break;
+ }
+ case mobile_apis::messageType::notification: {
+ if (app_mngr::commands::Command::CommandSource::SOURCE_SDL == source) {
+ return get_notification_creator(id);
+ }
+ break;
+ }
+ default: {}
+ }
+ VehicleInfoCommandParams params = {application_manager_,
+ rpc_service_,
+ hmi_capabilities_,
+ policy_handler_,
+ custom_vehicle_data_manager_};
+ auto factory = VehicleInfoCommandCreatorFactory(params);
+ return factory.GetCreator<VehicleInfoInvalidCommand>();
}
+} // namespace vehicle_info_plugin
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
index 7b94d22312..3e8ef6b29d 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
@@ -31,16 +31,20 @@
*/
#include "vehicle_info_plugin/vehicle_info_plugin.h"
-#include "vehicle_info_plugin/vehicle_info_command_factory.h"
-#include "vehicle_info_plugin/vehicle_info_app_extension.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/message_helper.h"
#include "application_manager/message_helper.h"
+#include "application_manager/plugin_manager/plugin_keys.h"
+#include "application_manager/rpc_handler.h"
+#include "application_manager/smart_object_keys.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager_impl.h"
+#include "vehicle_info_plugin/vehicle_info_app_extension.h"
+#include "vehicle_info_plugin/vehicle_info_command_factory.h"
namespace vehicle_info_plugin {
CREATE_LOGGERPTR_GLOBAL(logger_, "VehicleInfoPlugin")
namespace strings = application_manager::strings;
+namespace plugins = application_manager::plugin_manager;
+namespace commands = application_manager::commands;
VehicleInfoPlugin::VehicleInfoPlugin() : application_manager_(nullptr) {}
@@ -48,10 +52,37 @@ bool VehicleInfoPlugin::Init(
application_manager::ApplicationManager& app_manager,
application_manager::rpc_service::RPCService& rpc_service,
application_manager::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler) {
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state) {
+ UNUSED(last_state);
application_manager_ = &app_manager;
+ custom_vehicle_data_manager_.reset(
+ new CustomVehicleDataManagerImpl(policy_handler, rpc_service));
command_factory_.reset(new vehicle_info_plugin::VehicleInfoCommandFactory(
- app_manager, rpc_service, hmi_capabilities, policy_handler));
+ app_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler,
+ *(custom_vehicle_data_manager_.get())));
+ return true;
+}
+
+bool VehicleInfoPlugin::Init(
+ application_manager::ApplicationManager& application_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state) {
+ UNUSED(last_state);
+ application_manager_ = &application_manager;
+ custom_vehicle_data_manager_.reset(
+ new CustomVehicleDataManagerImpl(policy_handler, rpc_service));
+ command_factory_.reset(new vehicle_info_plugin::VehicleInfoCommandFactory(
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler,
+ *(custom_vehicle_data_manager_.get())));
return true;
}
@@ -61,23 +92,68 @@ bool VehicleInfoPlugin::IsAbleToProcess(
}
std::string VehicleInfoPlugin::PluginName() {
- return "Vehicle Info Plugin";
+ return plugins::plugin_names::vehicle_info_rpc_plugin;
}
app_mngr::CommandFactory& VehicleInfoPlugin::GetCommandFactory() {
return *command_factory_;
}
-void VehicleInfoPlugin::OnPolicyEvent(plugins::PolicyEvent event) {}
+void VehicleInfoPlugin::OnPolicyEvent(plugins::PolicyEvent event) {
+ UnsubscribeFromRemovedVDItems();
+ custom_vehicle_data_manager_->OnPolicyEvent(event);
+}
void VehicleInfoPlugin::OnApplicationEvent(
plugins::ApplicationEvent event,
app_mngr::ApplicationSharedPtr application) {
if (plugins::ApplicationEvent::kApplicationRegistered == event) {
- application->AddExtension(new VehicleInfoAppExtension(*this, *application));
+ application->AddExtension(
+ std::make_shared<VehicleInfoAppExtension>(*this, *application));
+ } else if ((plugins::ApplicationEvent::kDeleteApplicationData == event) ||
+ (plugins::ApplicationEvent::kApplicationUnregistered == event)) {
+ DeleteSubscriptions(application);
}
}
+void VehicleInfoPlugin::UnsubscribeFromRemovedVDItems() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ typedef std::vector<std::string> StringsVector;
+
+ auto get_items_to_unsubscribe = [this]() -> StringsVector {
+ StringsVector output_items_list;
+ auto applications = application_manager_->applications();
+ for (auto& app : applications.GetData()) {
+ auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
+ auto subscription_names = ext.Subscriptions();
+ for (auto& subscription_name : subscription_names) {
+ if (custom_vehicle_data_manager_->IsRemovedCustomVehicleDataName(
+ subscription_name)) {
+ ext.unsubscribeFromVehicleInfo(subscription_name);
+ if (!helpers::in_range(output_items_list, subscription_name)) {
+ LOG4CXX_DEBUG(logger_,
+ "Vehicle data item "
+ << subscription_name
+ << " has been removed by policy");
+ output_items_list.push_back(subscription_name);
+ }
+ }
+ }
+ }
+ return output_items_list;
+ };
+
+ const StringsVector items_to_unsubscribe = get_items_to_unsubscribe();
+
+ if (items_to_unsubscribe.empty()) {
+ LOG4CXX_DEBUG(logger_, "There is no data to unsubscribe");
+ return;
+ }
+
+ auto message = GetUnsubscribeIVIRequest(items_to_unsubscribe);
+ application_manager_->GetRPCService().ManageHMICommand(message);
+}
+
void VehicleInfoPlugin::ProcessResumptionSubscription(
application_manager::Application& app, VehicleInfoAppExtension& ext) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -85,13 +161,15 @@ void VehicleInfoPlugin::ProcessResumptionSubscription(
smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::app_id] = app.app_id();
const auto& subscriptions = ext.Subscriptions();
- for (auto& ivi_data : application_manager::MessageHelper::vehicle_data()) {
- mobile_apis::VehicleDataType::eType type_id = ivi_data.second;
- if (subscriptions.end() != subscriptions.find(type_id)) {
- std::string key_name = ivi_data.first;
- msg_params[key_name] = true;
- }
+ if (subscriptions.empty()) {
+ LOG4CXX_DEBUG(logger_, "No vehicle data to subscribe. Exiting");
+ return;
+ }
+
+ for (const auto& item : subscriptions) {
+ msg_params[item] = true;
}
+
smart_objects::SmartObjectSPtr request =
application_manager::MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData,
@@ -101,38 +179,56 @@ void VehicleInfoPlugin::ProcessResumptionSubscription(
}
application_manager::ApplicationSharedPtr FindAppSubscribedToIVI(
- mobile_apis::VehicleDataType::eType ivi_data,
+ const std::string& ivi_name,
application_manager::ApplicationManager& app_mngr) {
auto applications = app_mngr.applications();
for (auto& app : applications.GetData()) {
auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
- if (ext.isSubscribedToVehicleInfo(ivi_data)) {
+ if (ext.isSubscribedToVehicleInfo(ivi_name)) {
return app;
}
}
return application_manager::ApplicationSharedPtr();
}
-smart_objects::SmartObjectSPtr GetUnsubscribeIVIRequest(
- int32_t ivi_id, application_manager::ApplicationManager& app_mngr) {
+smart_objects::SmartObjectSPtr VehicleInfoPlugin::GetUnsubscribeIVIRequest(
+ const std::vector<std::string>& ivi_names) {
+ LOG4CXX_AUTO_TRACE(logger_);
using namespace smart_objects;
- auto find_ivi_name = [ivi_id]() {
+ auto msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ auto find_ivi_name = [](const std::string& ivi_name) {
for (auto item : application_manager::MessageHelper::vehicle_data()) {
- if (ivi_id == item.second) {
+ if (ivi_name == item.first) {
return item.first;
}
}
return std::string();
};
- std::string key_name = find_ivi_name();
- DCHECK_OR_RETURN(!key_name.empty(), smart_objects::SmartObjectSPtr());
- auto msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map);
- msg_params[key_name] = true;
+
+ for (const auto& ivi_name : ivi_names) {
+ // try to find the name in vehicle data types
+ std::string key_name = find_ivi_name(ivi_name);
+
+ if (key_name.empty()) {
+ // the name hasn't been found in vehicle data types
+ if (custom_vehicle_data_manager_->IsValidCustomVehicleDataName(
+ ivi_name) ||
+ custom_vehicle_data_manager_->IsRemovedCustomVehicleDataName(
+ ivi_name)) {
+ key_name = ivi_name;
+ }
+ }
+
+ DCHECK_OR_RETURN(!key_name.empty(), smart_objects::SmartObjectSPtr());
+ msg_params[key_name] = true;
+ }
auto message = application_manager::MessageHelper::CreateMessageForHMI(
- hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
+ hmi_apis::messageType::request,
+ application_manager_->GetNextHMICorrelationID());
DCHECK(message);
SmartObject& object = *message;
@@ -147,18 +243,31 @@ void VehicleInfoPlugin::DeleteSubscriptions(
application_manager::ApplicationSharedPtr app) {
auto& ext = VehicleInfoAppExtension::ExtractVIExtension(*app);
auto subscriptions = ext.Subscriptions();
+ std::vector<std::string> ivi_to_unsubscribe;
for (auto& ivi : subscriptions) {
ext.unsubscribeFromVehicleInfo(ivi);
auto still_subscribed_app =
FindAppSubscribedToIVI(ivi, *application_manager_);
if (!still_subscribed_app) {
- auto message = GetUnsubscribeIVIRequest(ivi, *application_manager_);
- application_manager_->GetRPCService().ManageHMICommand(message);
+ ivi_to_unsubscribe.push_back(ivi);
}
}
+
+ if (!ivi_to_unsubscribe.empty()) {
+ auto message = GetUnsubscribeIVIRequest(ivi_to_unsubscribe);
+ application_manager_->GetRPCService().ManageHMICommand(message);
+ }
}
-}
+} // namespace vehicle_info_plugin
-extern "C" application_manager::plugin_manager::RPCPlugin* Create() {
+extern "C" __attribute__((visibility("default")))
+application_manager::plugin_manager::RPCPlugin*
+Create() {
return new vehicle_info_plugin::VehicleInfoPlugin();
}
+
+extern "C" __attribute__((visibility("default"))) void Delete(
+ application_manager::plugin_manager::RPCPlugin* data) {
+ delete data;
+ DELETE_THREAD_LOGGER(vehicle_info_plugin::logger_);
+}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
index 3ea4a50a8a..a8193c17f0 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
@@ -31,23 +31,30 @@
include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
include_directories(
+ include
${GMOCK_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}/application_manager/rpc_plugins/vehicle_info_plugin/include
- ${COMPONENTS_DIR}/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands
${COMPONENTS_DIR}/application_manager/test/include/
-)
-
-
+ ${COMPONENTS_DIR}/include/test/application_manager/
+ ${COMPONENTS_DIR}/resumption/include/resumption/
+ )
set(COMMANDS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/commands)
file(GLOB SOURCES
${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc
${COMPONENTS_DIR}/application_manager/test/mock_application_helper.cc
${COMPONENTS_DIR}/application_manager/src/smart_object_keys.cc
+ ${COMPONENTS_DIR}/${POLICY_PATH}/src/policy_table/types.cc
+ ${COMPONENTS_DIR}/${POLICY_PATH}/src/policy_table/validation.cc
+ ${COMPONENTS_DIR}/${POLICY_PATH}/src/policy_table/enums.cc
${COMMANDS_TEST_DIR}/hmi/*
${COMMANDS_TEST_DIR}/mobile/*
+ ${CMAKE_CURRENT_SOURCE_DIR}/custom_vehicle_data_manager_test.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/vehicle_data_item_schema_test.cc
${COMPONENTS_DIR}/application_manager/src/message.cc
${COMPONENTS_DIR}/application_manager/src/event_engine/*
+ ${COMPONENTS_DIR}/resumption/src/last_state_wrapper_impl.cc
)
set(LIBRARIES
@@ -58,6 +65,8 @@ set(LIBRARIES
MOBILE_API
connectionHandler
vehicle_info_plugin
+ SmartObjects
+ formatters
jsoncpp
)
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_request_test.cc
new file mode 100644
index 0000000000..6bc956f65f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_request_test.cc
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "hmi/vi_get_vehicle_data_request.h"
+
+#include "gtest/gtest.h"
+
+#include "smart_objects/enum_schema_item.h"
+#include "smart_objects/smart_object.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace vi_get_vehicle_data_request {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+using vehicle_info_plugin::commands::VIGetVehicleDataRequest;
+
+namespace {
+const std::string kMobileParam = "mobile_param";
+const std::string kHMIParam = "hmi_param";
+} // namespace
+
+class VIGetVehicleDataRequestTest
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+MATCHER_P(EqualMsgParams, msg_params, "") {
+ using namespace app_mngr;
+ auto message = static_cast<smart_objects::SmartObject>(*arg);
+ if (!message.keyExists(strings::msg_params)) {
+ return false;
+ }
+
+ return msg_params == message[strings::msg_params];
+}
+
+TEST_F(VIGetVehicleDataRequestTest, Run_Success) {
+ using namespace app_mngr;
+ auto command_msg = CreateMessage(smart_objects::SmartType_Map);
+ (*command_msg)[strings::msg_params][strings::rpm] = true;
+ (*command_msg)[strings::msg_params][kMobileParam] = true;
+
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(
+ strings::rpm, mobile_apis::VehicleDataType::VEHICLEDATA_RPM));
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(vehicle_data));
+
+ std::string oem_vehicle_data_type_str;
+ smart_objects::EnumConversionHelper<mobile_apis::VehicleDataType::eType>::
+ EnumToString(mobile_apis::VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA,
+ &oem_vehicle_data_type_str);
+
+ smart_objects::SmartObject hmi_params;
+ hmi_params[kHMIParam] = smart_objects::SmartType_Map;
+ hmi_params[kHMIParam][strings::data_type] = oem_vehicle_data_type_str;
+ ON_CALL(mock_custom_vehicle_data_manager_, CreateHMIMessageParams(_))
+ .WillByDefault(Return(hmi_params));
+
+ smart_objects::SmartObject hmi_request_msg;
+ hmi_request_msg[strings::rpm] =
+ (*command_msg)[strings::msg_params][strings::rpm];
+ hmi_request_msg[kHMIParam] = hmi_params[kHMIParam];
+
+ EXPECT_CALL(mock_rpc_service_,
+ SendMessageToHMI(EqualMsgParams(hmi_request_msg)));
+
+ auto command = CreateCommandVI<VIGetVehicleDataRequest>(command_msg);
+ command->Run();
+}
+
+} // namespace vi_get_vehicle_data_request
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc
index ddfc8e8a55..ea8dab0366 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc
@@ -35,18 +35,18 @@
#include <vector>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
+
#include "application_manager/application.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/message_helper.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/event_engine/event.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
#include "hmi/vi_get_vehicle_data_response.h"
+#include "smart_objects/smart_object.h"
+#include "vehicle_info_plugin/commands/vi_commands_test.h"
namespace test {
namespace components {
@@ -61,11 +61,11 @@ namespace am = ::application_manager;
namespace strings = ::application_manager::strings;
namespace hmi_response = am::hmi_response;
using am::commands::MessageSharedPtr;
-using vehicle_info_plugin::commands::VIGetVehicleDataResponse;
using am::event_engine::Event;
using test::components::event_engine_test::MockEventDispatcher;
+using vehicle_info_plugin::commands::VIGetVehicleDataResponse;
-typedef SharedPtr<VIGetVehicleDataResponse> VIGetVehicleDataResponsePtr;
+typedef std::shared_ptr<VIGetVehicleDataResponse> VIGetVehicleDataResponsePtr;
namespace {
const uint32_t kConnectionKey = 2u;
@@ -74,7 +74,7 @@ const std::string kStrNumber = "123";
} // namespace
class VIGetVehicleDataResponseTest
- : public CommandsTest<CommandsTestMocks::kIsNice> {};
+ : public VICommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(VIGetVehicleDataResponseTest, RUN_SUCCESS) {
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
@@ -84,7 +84,7 @@ TEST_F(VIGetVehicleDataResponseTest, RUN_SUCCESS) {
hmi_apis::messageType::response;
VIGetVehicleDataResponsePtr command(
- CreateCommand<VIGetVehicleDataResponse>(command_msg));
+ CreateCommandVI<VIGetVehicleDataResponse>(command_msg));
am::event_engine::Event event(
hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
@@ -97,10 +97,12 @@ TEST_F(VIGetVehicleDataResponseTest, RUN_SUCCESS) {
.WillOnce(ReturnRef(mock_event_dispatcher));
EXPECT_CALL(mock_event_dispatcher, raise_event(_));
+ ASSERT_TRUE(command->Init());
command->Run();
}
-TEST_F(VIGetVehicleDataResponseTest, ErrorResponse_SUCCESS) {
+TEST_F(VIGetVehicleDataResponseTest,
+ ErrorResponse_OnVehicleDataUpdated_NotCalled) {
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
(*command_msg)[strings::msg_params][strings::number] = kStrNumber;
(*command_msg)[strings::params][strings::connection_key] = kConnectionKey;
@@ -108,7 +110,7 @@ TEST_F(VIGetVehicleDataResponseTest, ErrorResponse_SUCCESS) {
hmi_apis::messageType::error_response;
(*command_msg)[strings::params][strings::data][strings::slider_position] = 1;
(*command_msg)[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::SUCCESS;
+ hmi_apis::Common_Result::ABORTED;
(*command_msg)[strings::params][strings::correlation_id] = kCorrelationId;
(*command_msg)[am::strings::params][am::strings::error_msg] = "test_error";
(*command_msg)[am::strings::params][am::strings::protocol_type] =
@@ -116,33 +118,18 @@ TEST_F(VIGetVehicleDataResponseTest, ErrorResponse_SUCCESS) {
(*command_msg)[strings::params][strings::protocol_version] =
am::commands::CommandImpl::protocol_version_;
- smart_objects::SmartObject result(smart_objects::SmartType_Map);
- result[strings::msg_params] = (*command_msg)[strings::params][strings::data];
- result[strings::params][hmi_response::code] =
- (*command_msg)[strings::params][hmi_response::code];
- result[strings::params][strings::correlation_id] =
- (*command_msg)[strings::params][strings::correlation_id];
- result[strings::params][strings::error_msg] =
- (*command_msg)[strings::params][strings::error_msg];
- result[strings::params][strings::message_type] =
- (*command_msg)[strings::params][strings::message_type];
- result[strings::params][strings::protocol_type] =
- (*command_msg)[strings::params][strings::protocol_type];
- result[strings::params][strings::protocol_version] =
- (*command_msg)[strings::params][strings::protocol_version];
-
VIGetVehicleDataResponsePtr command(
- CreateCommand<VIGetVehicleDataResponse>(command_msg));
+ CreateCommandVI<VIGetVehicleDataResponse>(command_msg));
- am::event_engine::Event event(
- hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
- event.set_smart_object(result);
+ EXPECT_CALL(mock_policy_handler_, OnVehicleDataUpdated(*command_msg))
+ .Times(0);
MockEventDispatcher mock_event_dispatcher;
EXPECT_CALL(app_mngr_, event_dispatcher())
.WillOnce(ReturnRef(mock_event_dispatcher));
EXPECT_CALL(mock_event_dispatcher, raise_event(_));
+ ASSERT_TRUE(command->Init());
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc
index d0093f45cf..c083bf4d60 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc
@@ -33,17 +33,17 @@
#include "hmi/vi_is_ready_request.h"
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/command_request_test.h"
-#include "application_manager/mock_application_manager.h"
+
+#include "application_manager/event_engine/event.h"
#include "application_manager/hmi_interfaces.h"
-#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/mock_hmi_interface.h"
#include "application_manager/mock_message_helper.h"
-#include "application_manager/event_engine/event.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
namespace test {
namespace components {
@@ -52,19 +52,19 @@ namespace hmi_commands_test {
namespace vi_is_ready_request {
using ::testing::_;
-using ::testing::ReturnRef;
using ::testing::Return;
+using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using vehicle_info_plugin::commands::VIIsReadyRequest;
using am::event_engine::Event;
+using vehicle_info_plugin::commands::VIIsReadyRequest;
-typedef SharedPtr<VIIsReadyRequest> VIIsReadyRequestPtr;
+typedef std::shared_ptr<VIIsReadyRequest> VIIsReadyRequestPtr;
class VIIsReadyRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- VIIsReadyRequestTest() : command_(CreateCommand<VIIsReadyRequest>()) {}
+ VIIsReadyRequestTest() : command_(CreateCommandVI<VIIsReadyRequest>()) {}
void SetUpExpectations(bool is_vi_cooperating_available,
bool is_send_message_to_hmi,
@@ -101,7 +101,7 @@ class VIIsReadyRequestTest
mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VehicleInfo_GetVehicleType, _))
.WillOnce(Return(ivi_type));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(ivi_type));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(ivi_type, _));
}
void PrepareEvent(bool is_message_contain_param,
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_subscribe_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_subscribe_vehicle_data_request_test.cc
new file mode 100644
index 0000000000..fbaabfed06
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_subscribe_vehicle_data_request_test.cc
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "hmi/vi_subscribe_vehicle_data_request.h"
+
+#include "gtest/gtest.h"
+
+#include "smart_objects/enum_schema_item.h"
+#include "smart_objects/smart_object.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace vi_subscribe_vehicle_data_request {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+using vehicle_info_plugin::commands::VISubscribeVehicleDataRequest;
+
+namespace {
+const std::string kMobileParam = "mobile_param";
+const std::string kHMIParam = "hmi_param";
+} // namespace
+
+class VISubscribeVehicleDataRequestTest
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+MATCHER_P(EqualMsgParams, msg_params, "") {
+ using namespace app_mngr;
+ auto message = static_cast<smart_objects::SmartObject>(*arg);
+ if (!message.keyExists(strings::msg_params)) {
+ return false;
+ }
+
+ return msg_params == message[strings::msg_params];
+}
+
+TEST_F(VISubscribeVehicleDataRequestTest, Run_Success) {
+ using namespace app_mngr;
+ auto command_msg = CreateMessage(smart_objects::SmartType_Map);
+ (*command_msg)[strings::msg_params][strings::rpm] = true;
+ (*command_msg)[strings::msg_params][kMobileParam] = true;
+
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(
+ strings::rpm, mobile_apis::VehicleDataType::VEHICLEDATA_RPM));
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(vehicle_data));
+
+ std::string oem_vehicle_data_type_str;
+ smart_objects::EnumConversionHelper<mobile_apis::VehicleDataType::eType>::
+ EnumToString(mobile_apis::VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA,
+ &oem_vehicle_data_type_str);
+
+ smart_objects::SmartObject hmi_params;
+ hmi_params[kHMIParam] = smart_objects::SmartType_Map;
+ hmi_params[kHMIParam][strings::data_type] = oem_vehicle_data_type_str;
+ ON_CALL(mock_custom_vehicle_data_manager_, CreateHMIMessageParams(_))
+ .WillByDefault(Return(hmi_params));
+
+ smart_objects::SmartObject hmi_request_msg;
+ hmi_request_msg[strings::rpm] =
+ (*command_msg)[strings::msg_params][strings::rpm];
+ hmi_request_msg[kHMIParam] = hmi_params[kHMIParam];
+
+ EXPECT_CALL(mock_rpc_service_,
+ SendMessageToHMI(EqualMsgParams(hmi_request_msg)));
+
+ auto command = CreateCommandVI<VISubscribeVehicleDataRequest>(command_msg);
+ command->Run();
+}
+
+} // namespace vi_subscribe_vehicle_data_request
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_unsubscribe_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_unsubscribe_vehicle_data_request_test.cc
new file mode 100644
index 0000000000..2ce04aa21a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_unsubscribe_vehicle_data_request_test.cc
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "hmi/vi_unsubscribe_vehicle_data_request.h"
+
+#include "gtest/gtest.h"
+
+#include "smart_objects/enum_schema_item.h"
+#include "smart_objects/smart_object.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace vi_unsubscribe_vehicle_data_request {
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+using vehicle_info_plugin::commands::VIUnsubscribeVehicleDataRequest;
+
+namespace {
+const std::string kMobileParam = "mobile_param";
+const std::string kHMIParam = "hmi_param";
+} // namespace
+
+class VIUnsubscribeVehicleDataRequestTest
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {};
+
+MATCHER_P(EqualMsgParams, msg_params, "") {
+ using namespace app_mngr;
+ auto message = static_cast<smart_objects::SmartObject>(*arg);
+ if (!message.keyExists(strings::msg_params)) {
+ return false;
+ }
+
+ return msg_params == message[strings::msg_params];
+}
+
+TEST_F(VIUnsubscribeVehicleDataRequestTest, Run_Success) {
+ using namespace app_mngr;
+ auto command_msg = CreateMessage(smart_objects::SmartType_Map);
+ (*command_msg)[strings::msg_params][strings::rpm] = true;
+ (*command_msg)[strings::msg_params][kMobileParam] = true;
+
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(
+ strings::rpm, mobile_apis::VehicleDataType::VEHICLEDATA_RPM));
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(vehicle_data));
+
+ std::string oem_vehicle_data_type_str;
+ smart_objects::EnumConversionHelper<mobile_apis::VehicleDataType::eType>::
+ EnumToString(mobile_apis::VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA,
+ &oem_vehicle_data_type_str);
+
+ smart_objects::SmartObject hmi_params;
+ hmi_params[kHMIParam] = smart_objects::SmartType_Map;
+ hmi_params[kHMIParam][strings::data_type] = oem_vehicle_data_type_str;
+ ON_CALL(mock_custom_vehicle_data_manager_, CreateHMIMessageParams(_))
+ .WillByDefault(Return(hmi_params));
+
+ smart_objects::SmartObject hmi_request_msg;
+ hmi_request_msg[strings::rpm] = true;
+ hmi_request_msg[kHMIParam] = true;
+
+ EXPECT_CALL(mock_rpc_service_,
+ SendMessageToHMI(EqualMsgParams(hmi_request_msg)));
+
+ auto command = CreateCommandVI<VIUnsubscribeVehicleDataRequest>(command_msg);
+ command->Run();
+}
+
+} // namespace vi_unsubscribe_vehicle_data_request
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc
index 3f684cae3f..afafd1c6c6 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc
@@ -35,18 +35,18 @@
#include <vector>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
#include "vehicle_info_plugin/commands/mobile/diagnostic_message_request.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
+#include "vehicle_info_plugin/mock_custom_vehicle_data_manager.h"
namespace test {
namespace components {
@@ -59,11 +59,11 @@ using ::testing::Return;
using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using vehicle_info_plugin::commands::DiagnosticMessageRequest;
using am::event_engine::Event;
+using vehicle_info_plugin::commands::DiagnosticMessageRequest;
namespace mobile_result = mobile_apis::Result;
-typedef SharedPtr<DiagnosticMessageRequest> DiagnosticMessageRequestPtr;
+typedef std::shared_ptr<DiagnosticMessageRequest> DiagnosticMessageRequestPtr;
namespace {
const uint32_t kConnectionKey = 2u;
@@ -71,7 +71,7 @@ const uint32_t kDiagnosticMode = 5u;
} // namespace
class DiagnosticMessageRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {};
TEST_F(DiagnosticMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
@@ -79,7 +79,7 @@ TEST_F(DiagnosticMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
kConnectionKey;
DiagnosticMessageRequestPtr command(
- CreateCommand<DiagnosticMessageRequest>(command_msg));
+ CreateCommandVI<DiagnosticMessageRequest>(command_msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(ApplicationSharedPtr()));
@@ -100,7 +100,7 @@ TEST_F(DiagnosticMessageRequestTest, Run_NotSupportedDiagnosticMode_UNSUCCESS) {
kConnectionKey;
DiagnosticMessageRequestPtr command(
- CreateCommand<DiagnosticMessageRequest>(command_msg));
+ CreateCommandVI<DiagnosticMessageRequest>(command_msg));
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
@@ -127,7 +127,7 @@ TEST_F(DiagnosticMessageRequestTest, Run_SUCCESS) {
kConnectionKey;
DiagnosticMessageRequestPtr command(
- CreateCommand<DiagnosticMessageRequest>(command_msg));
+ CreateCommandVI<DiagnosticMessageRequest>(command_msg));
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
@@ -141,9 +141,11 @@ TEST_F(DiagnosticMessageRequestTest, Run_SUCCESS) {
EXPECT_CALL(app_mngr_settings_, supported_diag_modes())
.WillOnce(ReturnRef(supported_diag_modes));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage),
+ _));
command->Run();
}
@@ -152,7 +154,7 @@ TEST_F(DiagnosticMessageRequestTest, OnEvent_UNSUCCESS) {
Event event(hmi_apis::FunctionID::INVALID_ENUM);
DiagnosticMessageRequestPtr command(
- CreateCommand<DiagnosticMessageRequest>());
+ CreateCommandVI<DiagnosticMessageRequest>());
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
@@ -169,7 +171,7 @@ TEST_F(DiagnosticMessageRequestTest, OnEvent_SUCCESS) {
event.set_smart_object(*event_message);
DiagnosticMessageRequestPtr command(
- CreateCommand<DiagnosticMessageRequest>());
+ CreateCommandVI<DiagnosticMessageRequest>());
EXPECT_CALL(
mock_rpc_service_,
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc
index 9719d3ceed..e4613feb83 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc
@@ -35,18 +35,17 @@
#include <vector>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application.h"
#include "application_manager/event_engine/event.h"
-#include "mobile/get_dtcs_request.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
#include "interfaces/MOBILE_API.h"
+#include "mobile/get_dtcs_request.h"
+#include "smart_objects/smart_object.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
namespace test {
namespace components {
@@ -57,23 +56,23 @@ namespace get_dtcs_request {
using ::testing::_;
using ::testing::Return;
namespace am = ::application_manager;
+using am::MockMessageHelper;
using am::commands::MessageSharedPtr;
-using vehicle_info_plugin::commands::GetDTCsRequest;
using am::event_engine::Event;
-using am::MockMessageHelper;
using testing::Mock;
+using vehicle_info_plugin::commands::GetDTCsRequest;
namespace mobile_result = mobile_apis::Result;
-typedef SharedPtr<GetDTCsRequest> GetDTCsRequestPtr;
+typedef std::shared_ptr<GetDTCsRequest> GetDTCsRequestPtr;
class GetDTCsRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- GetDTCsRequestTest() : CommandRequestTest<CommandsTestMocks::kIsNice>() {}
+ GetDTCsRequestTest() : VICommandRequestTest<CommandsTestMocks::kIsNice>() {}
};
TEST_F(GetDTCsRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
- GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>());
+ GetDTCsRequestPtr command(CreateCommandVI<GetDTCsRequest>());
EXPECT_CALL(app_mngr_, application(_))
.WillOnce(Return(ApplicationSharedPtr()));
@@ -93,20 +92,21 @@ TEST_F(GetDTCsRequestTest, Run_SUCCESS) {
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>(command_msg));
+ GetDTCsRequestPtr command(CreateCommandVI<GetDTCsRequest>(command_msg));
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(
- HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetDTCs)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetDTCs), _));
command->Run();
}
TEST_F(GetDTCsRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
- GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>());
+ GetDTCsRequestPtr command(CreateCommandVI<GetDTCsRequest>());
Event event(hmi_apis::FunctionID::INVALID_ENUM);
@@ -131,7 +131,7 @@ TEST_F(GetDTCsRequestTest, OnEvent_SUCCESS) {
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app));
- GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>());
+ GetDTCsRequestPtr command(CreateCommandVI<GetDTCsRequest>());
command->on_event(event);
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc
index d8e4c3d075..d27e332601 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc
@@ -35,18 +35,18 @@
#include <vector>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+
#include "application_manager/application.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/message_helper.h"
-#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/event_engine/event.h"
-#include "mobile/get_vehicle_data_request.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
#include "interfaces/MOBILE_API.h"
+#include "mobile/get_vehicle_data_request.h"
+#include "smart_objects/smart_object.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
namespace test {
namespace components {
@@ -59,31 +59,25 @@ using ::testing::Return;
using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
-using vehicle_info_plugin::commands::GetVehicleDataRequest;
using am::event_engine::Event;
+using vehicle_info_plugin::commands::GetVehicleDataRequest;
namespace mobile_result = mobile_apis::Result;
-typedef SharedPtr<GetVehicleDataRequest> GetVehicleDataRequestPtr;
+typedef std::shared_ptr<GetVehicleDataRequest> GetVehicleDataRequestPtr;
namespace {
const uint32_t kConnectionKey = 2u;
} // namespace
class GetVehicleDataRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {};
class UnwrappedGetVehicleDataRequest : public GetVehicleDataRequest {
public:
- UnwrappedGetVehicleDataRequest(const MessageSharedPtr& message,
- am::ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
- : GetVehicleDataRequest(message,
- application_manager,
- rpc_service,
- hmi_capabilities,
- policy_handler) {}
+ UnwrappedGetVehicleDataRequest(
+ const MessageSharedPtr& message,
+ const vehicle_info_plugin::VehicleInfoCommandParams& params)
+ : GetVehicleDataRequest(message, params) {}
policy::RPCParams& get_disallowed_params() {
return removed_parameters_permissions_.disallowed_params;
@@ -92,12 +86,8 @@ class UnwrappedGetVehicleDataRequest : public GetVehicleDataRequest {
using GetVehicleDataRequest::on_event;
};
-#ifdef HMI_DBUS_API
-// HMI_DBUS_API currently not supported
-#else
-
TEST_F(GetVehicleDataRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
- GetVehicleDataRequestPtr command(CreateCommand<GetVehicleDataRequest>());
+ GetVehicleDataRequestPtr command(CreateCommandVI<GetVehicleDataRequest>());
EXPECT_CALL(app_mngr_, application(_))
.WillOnce(Return(ApplicationSharedPtr()));
@@ -119,7 +109,7 @@ TEST_F(GetVehicleDataRequestTest, Run_TooHighFrequency_UNSUCCESS) {
kConnectionKey;
GetVehicleDataRequestPtr command(
- CreateCommand<GetVehicleDataRequest>(command_msg));
+ CreateCommandVI<GetVehicleDataRequest>(command_msg));
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
@@ -142,14 +132,17 @@ TEST_F(GetVehicleDataRequestTest, Run_EmptyMsgParams_UNSUCCESS) {
kConnectionKey;
GetVehicleDataRequestPtr command(
- CreateCommand<GetVehicleDataRequest>(command_msg));
+ CreateCommandVI<GetVehicleDataRequest>(command_msg));
const am::VehicleData kEmptyVehicleData;
- EXPECT_CALL(mock_message_helper_, vehicle_data())
- .WillOnce(ReturnRef(kEmptyVehicleData));
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(kEmptyVehicleData));
+ smart_objects::SmartObject empty_hmi_custom_params;
+ ON_CALL(mock_custom_vehicle_data_manager_, CreateHMIMessageParams(_))
+ .WillByDefault(Return(empty_hmi_custom_params));
MockAppPtr app(CreateMockApp());
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
+ ON_CALL(app_mngr_, application(kConnectionKey)).WillByDefault(Return(app));
EXPECT_CALL(
mock_rpc_service_,
@@ -164,12 +157,16 @@ TEST_F(GetVehicleDataRequestTest,
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- SharedPtr<UnwrappedGetVehicleDataRequest> command(
- CreateCommand<UnwrappedGetVehicleDataRequest>(command_msg));
+ std::shared_ptr<UnwrappedGetVehicleDataRequest> command(
+ CreateCommandVI<UnwrappedGetVehicleDataRequest>(command_msg));
+
+ smart_objects::SmartObject empty_hmi_custom_params;
+ ON_CALL(mock_custom_vehicle_data_manager_, CreateHMIMessageParams(_))
+ .WillByDefault(Return(empty_hmi_custom_params));
const am::VehicleData kEmptyVehicleData;
- EXPECT_CALL(mock_message_helper_, vehicle_data())
- .WillRepeatedly(ReturnRef(kEmptyVehicleData));
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(kEmptyVehicleData));
policy::RPCParams& disallowed_params = command->get_disallowed_params();
disallowed_params.insert("test_param");
@@ -193,20 +190,22 @@ TEST_F(GetVehicleDataRequestTest, Run_SUCCESS) {
(*command_msg)[am::strings::msg_params][kMsgParamKey] = true;
GetVehicleDataRequestPtr command(
- CreateCommand<GetVehicleDataRequest>(command_msg));
+ CreateCommandVI<GetVehicleDataRequest>(command_msg));
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(
kMsgParamKey, mobile_apis::VehicleDataType::VEHICLEDATA_SPEED));
- EXPECT_CALL(mock_message_helper_, vehicle_data())
- .WillOnce(ReturnRef(vehicle_data));
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(vehicle_data));
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::VehicleInfo_GetVehicleData)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VehicleInfo_GetVehicleData),
+ _));
command->Run();
}
@@ -216,8 +215,8 @@ TEST_F(GetVehicleDataRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- SharedPtr<UnwrappedGetVehicleDataRequest> command(
- CreateCommand<UnwrappedGetVehicleDataRequest>(command_msg));
+ std::shared_ptr<UnwrappedGetVehicleDataRequest> command(
+ CreateCommandVI<UnwrappedGetVehicleDataRequest>(command_msg));
Event event(hmi_apis::FunctionID::INVALID_ENUM);
@@ -230,14 +229,18 @@ TEST_F(GetVehicleDataRequestTest, OnEvent_DataNotAvailable_SUCCESS) {
const hmi_apis::Common_Result::eType hmi_response_code =
hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
const mobile_result::eType mobile_response_code =
- mobile_result::DATA_NOT_AVAILABLE;
+ mobile_result::VEHICLE_DATA_NOT_AVAILABLE;
+
+ am::VehicleData vehicle_data;
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(vehicle_data));
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- SharedPtr<UnwrappedGetVehicleDataRequest> command(
- CreateCommand<UnwrappedGetVehicleDataRequest>(command_msg));
+ std::shared_ptr<UnwrappedGetVehicleDataRequest> command(
+ CreateCommandVI<UnwrappedGetVehicleDataRequest>(command_msg));
MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
(*event_msg)[am::strings::params][am::hmi_response::code] = hmi_response_code;
@@ -253,8 +256,6 @@ TEST_F(GetVehicleDataRequestTest, OnEvent_DataNotAvailable_SUCCESS) {
command->on_event(event);
}
-#endif // HMI_DBUS_API
-
} // namespace get_vehicle_data_request
} // namespace mobile_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc
new file mode 100644
index 0000000000..ad7a14ce40
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "vehicle_info_plugin/commands/vi_commands_test.h"
+
+#include "mobile/get_vehicle_data_response.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace get_vehicle_data_response {
+
+namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
+using vehicle_info_plugin::commands::GetVehicleDataResponse;
+
+typedef std::shared_ptr<GetVehicleDataResponse> GetVehicleDataResponsePtr;
+
+class GetVehicleDataResponseTest
+ : public VICommandsTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(GetVehicleDataResponseTest, GetVehicleDataResponse_SUCCESS) {
+ MessageSharedPtr message(CreateMessage(smart_objects::SmartType_Map));
+ GetVehicleDataResponsePtr command(
+ CreateCommandVI<GetVehicleDataResponse>(message));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(message, _));
+ command->Run();
+}
+
+} // namespace get_vehicle_data_response
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
index 3cc5af575e..82eb19c45f 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,21 +30,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdint.h>
-#include <vector>
-#include <map>
+#include <strings.h>
#include "gtest/gtest.h"
#include "mobile/on_vehicle_data_notification.h"
-#include "utils/shared_ptr.h"
-#include "utils/custom_string.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
+
#include "application_manager/commands/command_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/message_helper.h"
#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
#include "utils/helpers.h"
+#include "vehicle_info_plugin/commands/vi_commands_test.h"
+#include "vehicle_info_plugin/vehicle_info_app_extension.h"
+#include "vehicle_info_plugin/vehicle_info_plugin.h"
namespace test {
namespace components {
@@ -61,50 +62,76 @@ using ::testing::ReturnRef;
using am::commands::MessageSharedPtr;
using vehicle_info_plugin::commands::OnVehicleDataNotification;
-typedef ::utils::SharedPtr<OnVehicleDataNotification> NotificationPtr;
+typedef std::shared_ptr<OnVehicleDataNotification> NotificationPtr;
+typedef std::shared_ptr<vehicle_info_plugin::VehicleInfoAppExtension>
+ VehicleInfoAppExtensionPtr;
+typedef DataAccessor<application_manager::ApplicationSet> ApplicationSetDA;
namespace {
const uint32_t kAppId = 1u;
+const utils::custom_string::CustomString kAppName("test_app");
} // namespace
class OnVehicleDataNotificationTest
- : public CommandsTest<CommandsTestMocks::kIsNice> {
+ : public VICommandsTest<CommandsTestMocks::kIsNice> {
public:
- OnVehicleDataNotificationTest()
- : command_msg_(CreateMessage(smart_objects::SmartType_Map))
- , command_(CreateCommand<OnVehicleDataNotification>(command_msg_)) {}
+ OnVehicleDataNotificationTest() : mock_app_(CreateMockApp()) {}
- MessageSharedPtr command_msg_;
- NotificationPtr command_;
+ protected:
+ void SetUp() OVERRIDE {
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ ON_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillByDefault(Return(false));
+ }
+ MockAppPtr mock_app_;
};
-MATCHER_P2(CheckMessageData, key, value, "") {
- const bool kIsMobileProtocolTypeCorrect =
- (*arg)[am::strings::params][am::strings::protocol_type].asInt() ==
- am::commands::CommandImpl::mobile_protocol_type_;
-
- const bool kIsProtocolVersionCorrect =
- (*arg)[am::strings::params][am::strings::protocol_version].asInt() ==
- am::commands::CommandImpl::protocol_version_;
-
- const bool kIsNotificationCorrect =
- (*arg)[am::strings::params][am::strings::message_type].asInt() ==
- am::MessageType::kNotification;
-
- const bool kIsConnectionKeyCorrect =
- (*arg)[am::strings::params][am::strings::connection_key].asUInt() ==
- kAppId;
-
- const bool kAreMsgParamsCorrect =
- (*arg)[am::strings::msg_params][key].asInt() == value;
-
- using namespace helpers;
- return Compare<bool, EQ, ALL>(true,
- kIsMobileProtocolTypeCorrect,
- kIsProtocolVersionCorrect,
- kIsNotificationCorrect,
- kIsConnectionKeyCorrect,
- kAreMsgParamsCorrect);
+MATCHER_P(SmartObjectCheck, checker, "") {
+ return checker(arg);
+}
+
+TEST_F(OnVehicleDataNotificationTest, OnVehicleDataNotification_SUCCESS) {
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(
+ am::strings::gps, mobile_apis::VehicleDataType::VEHICLEDATA_GPS));
+ vehicle_data.insert(am::VehicleData::value_type(
+ am::strings::speed, mobile_apis::VehicleDataType::VEHICLEDATA_SPEED));
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(vehicle_data));
+
+ application_manager::ApplicationSet apps;
+ apps.insert(mock_app_);
+ std::shared_ptr<sync_primitives::Lock> apps_lock =
+ std::make_shared<sync_primitives::Lock>();
+ ApplicationSetDA apps_da(apps, apps_lock);
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_da));
+
+ vehicle_info_plugin::VehicleInfoPlugin vi_plugin;
+ VehicleInfoAppExtensionPtr vi_app_extention_ptr =
+ std::make_shared<vehicle_info_plugin::VehicleInfoAppExtension>(
+ vi_plugin, *mock_app_);
+ vi_app_extention_ptr->subscribeToVehicleInfo("gps");
+ vi_app_extention_ptr->subscribeToVehicleInfo("speed");
+ ON_CALL(*mock_app_,
+ QueryInterface(vehicle_info_plugin::VehicleInfoAppExtension::
+ VehicleInfoAppExtensionUID))
+ .WillByDefault(Return(vi_app_extention_ptr));
+
+ MessageSharedPtr message(CreateMessage(smart_objects::SmartType_Map));
+ smart_objects::SmartObject gps_data;
+ gps_data[am::strings::longitude_degrees] = 1.0;
+ gps_data[am::strings::latitude_degrees] = 1.0;
+ gps_data[am::strings::shifted] = true;
+
+ (*message)[am::strings::msg_params][am::strings::gps] = gps_data;
+ (*message)[am::strings::msg_params][am::strings::speed] = 0;
+
+ NotificationPtr command(CreateCommandVI<OnVehicleDataNotification>(message));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(message, _));
+
+ command->Run();
}
} // namespace on_vehicle_data_notification
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/read_did_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/read_did_request_test.cc
index 7cdeb2541c..372d562965 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/read_did_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/read_did_request_test.cc
@@ -34,19 +34,18 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_test.h"
+
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_message_helper.h"
-#include "interfaces/MOBILE_API.h"
-#include "interfaces/HMI_API.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/event_engine/event.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
#include "vehicle_info_plugin/commands/mobile/read_did_request.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
namespace test {
namespace components {
@@ -59,17 +58,16 @@ using ::testing::DoAll;
using ::testing::Return;
using ::testing::SaveArg;
namespace am = ::application_manager;
-using vehicle_info_plugin::commands::ReadDIDRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using ::utils::SharedPtr;
+using vehicle_info_plugin::commands::ReadDIDRequest;
class ReadDIDRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {};
TEST_F(ReadDIDRequestTest, OnEvent_WrongEventId_UNSUCCESS) {
Event event(Event::EventID::INVALID_ENUM);
- SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>());
+ std::shared_ptr<ReadDIDRequest> command(CreateCommandVI<ReadDIDRequest>());
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
command->on_event(event);
}
@@ -77,7 +75,7 @@ TEST_F(ReadDIDRequestTest, OnEvent_WrongEventId_UNSUCCESS) {
TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) {
Event event(Event::EventID::VehicleInfo_ReadDID);
- SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>());
+ std::shared_ptr<ReadDIDRequest> command(CreateCommandVI<ReadDIDRequest>());
const hmi_apis::Common_Result::eType hmi_response_code =
hmi_apis::Common_Result::SUCCESS;
@@ -99,10 +97,10 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) {
}
TEST_F(ReadDIDRequestTest, Run_AppNotRegistered_UNSUCCESS) {
- SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>());
+ std::shared_ptr<ReadDIDRequest> command(CreateCommandVI<ReadDIDRequest>());
ON_CALL(app_mngr_, application(_))
- .WillByDefault(Return(SharedPtr<am::Application>()));
+ .WillByDefault(Return(std::shared_ptr<am::Application>()));
MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
@@ -112,7 +110,7 @@ TEST_F(ReadDIDRequestTest, Run_AppNotRegistered_UNSUCCESS) {
}
TEST_F(ReadDIDRequestTest, Run_CommandLimitsExceeded_UNSUCCESS) {
- SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>());
+ std::shared_ptr<ReadDIDRequest> command(CreateCommandVI<ReadDIDRequest>());
MockAppPtr app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
@@ -128,7 +126,7 @@ TEST_F(ReadDIDRequestTest, Run_CommandLimitsExceeded_UNSUCCESS) {
TEST_F(ReadDIDRequestTest, Run_EmptyDidLocation_UNSUCCESS) {
MockAppPtr app(CreateMockApp());
- SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>());
+ std::shared_ptr<ReadDIDRequest> command(CreateCommandVI<ReadDIDRequest>());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
@@ -145,7 +143,7 @@ TEST_F(ReadDIDRequestTest, Run_SUCCESS) {
MockAppPtr app(CreateMockApp());
MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
(*msg)[am::strings::msg_params][am::strings::did_location]["SomeData"] = 0;
- SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>(msg));
+ std::shared_ptr<ReadDIDRequest> command(CreateCommandVI<ReadDIDRequest>(msg));
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
index 369a37e388..450bb5ac26 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc
@@ -34,13 +34,18 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
+
#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_message_helper.h"
#include "mobile/unsubscribe_vehicle_data_request.h"
-#include "vehicle_info_plugin/vehicle_info_plugin.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "resumption/mock_last_state.h"
+#include "vehicle_info_plugin/commands/vi_command_request_test.h"
#include "vehicle_info_plugin/vehicle_info_app_extension.h"
+#include "vehicle_info_plugin/vehicle_info_plugin.h"
+
+#include "application_manager/mock_rpc_handler.h"
namespace test {
namespace components {
@@ -53,35 +58,42 @@ namespace mobile_result = mobile_apis::Result;
using ::testing::_;
-using vehicle_info_plugin::commands::UnsubscribeVehicleDataRequest;
using am::commands::MessageSharedPtr;
+using vehicle_info_plugin::commands::UnsubscribeVehicleDataRequest;
-typedef ::utils::SharedPtr<UnsubscribeVehicleDataRequest> CommandPtr;
+typedef std::shared_ptr<UnsubscribeVehicleDataRequest> CommandPtr;
namespace {
const uint32_t kConnectionKey = 1u;
const std::string kMsgParamKey = "test_key";
const mobile_apis::VehicleDataType::eType kVehicleType =
mobile_apis::VehicleDataType::VEHICLEDATA_SPEED;
+const std::string kVehicleTypeStr = am::strings::speed;
} // namespace
class UnsubscribeVehicleRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ : public VICommandRequestTest<CommandsTestMocks::kIsNice> {
public:
UnsubscribeVehicleRequestTest()
: mock_app_(CreateMockApp())
, vi_app_extension_ptr_(
- utils::MakeShared<vehicle_info_plugin::VehicleInfoAppExtension>(
+ std::make_shared<vehicle_info_plugin::VehicleInfoAppExtension>(
vi_plugin_, *mock_app_))
- , app_set_lock_ptr_(std::make_shared<sync_primitives::Lock>()) {}
+ , app_set_lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , mock_last_state_(std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption_test::MockLastState>())) {}
protected:
void UnsubscribeSuccessfully();
void SetUp() OVERRIDE {
+ ON_CALL(app_mngr_, GetRPCHandler())
+ .WillByDefault(ReturnRef(mock_rpc_handler_));
+
vi_plugin_.Init(app_mngr_,
mock_rpc_service_,
mock_hmi_capabilities_,
- mock_policy_handler_);
+ mock_policy_handler_,
+ mock_last_state_);
ON_CALL(*mock_app_, AddExtension(vi_app_extension_ptr_));
vi_plugin_.OnApplicationEvent(application_manager::plugin_manager::
ApplicationEvent::kApplicationRegistered,
@@ -90,16 +102,19 @@ class UnsubscribeVehicleRequestTest
QueryInterface(vehicle_info_plugin::VehicleInfoAppExtension::
VehicleInfoAppExtensionUID))
.WillByDefault(Return(vi_app_extension_ptr_));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
MockAppPtr mock_app_;
application_manager::AppExtensionPtr vi_app_extension_ptr_;
std::shared_ptr<sync_primitives::Lock> app_set_lock_ptr_;
vehicle_info_plugin::VehicleInfoPlugin vi_plugin_;
+ application_manager_test::MockRPCHandler mock_rpc_handler_;
+ resumption::LastStateWrapperPtr mock_last_state_;
};
TEST_F(UnsubscribeVehicleRequestTest, Run_AppNotRegistered_UNSUCCESS) {
- CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>());
+ CommandPtr command(CreateCommandVI<UnsubscribeVehicleDataRequest>());
EXPECT_CALL(app_mngr_, application(_))
.WillOnce(Return(ApplicationSharedPtr()));
@@ -117,11 +132,18 @@ TEST_F(UnsubscribeVehicleRequestTest,
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
(*command_msg)[am::strings::msg_params][am::strings::button_name] =
- kVehicleType;
+ kVehicleTypeStr;
am::VehicleData data;
- EXPECT_CALL(mock_message_helper_, vehicle_data()).WillOnce(ReturnRef(data));
- CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
+ .WillRepeatedly(ReturnRef(data));
+
+ smart_objects::SmartObject empty_hmi_custom_params;
+ ON_CALL(mock_custom_vehicle_data_manager_, CreateHMIMessageParams(_))
+ .WillByDefault(Return(empty_hmi_custom_params));
+
+ CommandPtr command(
+ CreateCommandVI<UnsubscribeVehicleDataRequest>(command_msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -138,30 +160,36 @@ TEST_F(UnsubscribeVehicleRequestTest,
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- (*command_msg)[am::strings::msg_params][kMsgParamKey] = true;
+ (*command_msg)[am::strings::msg_params][kVehicleTypeStr] = true;
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(mock_message_helper_, vehicle_data())
- .WillOnce(ReturnRef(vehicle_data));
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(vehicle_data));
+
+ smart_objects::SmartObject hmi_custom_params(smart_objects::SmartType_Map);
+ hmi_custom_params[kVehicleTypeStr] = true;
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData)))
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData),
+ _))
.WillOnce(Return(true));
vehicle_info_plugin::VehicleInfoAppExtension* vi_app_extension =
dynamic_cast<vehicle_info_plugin::VehicleInfoAppExtension*>(
vi_app_extension_ptr_.get());
- ASSERT_TRUE(vi_app_extension->subscribeToVehicleInfo(kVehicleType));
+ ASSERT_TRUE(vi_app_extension->subscribeToVehicleInfo(kVehicleTypeStr));
application_manager::ApplicationSet app_set = {mock_app_};
DataAccessor<application_manager::ApplicationSet> accessor(app_set,
app_set_lock_ptr_);
// Expectations
EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor));
- CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+ CommandPtr command(
+ CreateCommandVI<UnsubscribeVehicleDataRequest>(command_msg));
command->Run();
}
@@ -169,9 +197,12 @@ TEST_F(UnsubscribeVehicleRequestTest,
Run_EmptyVehicleData_INVALID_DATA_SentToMobile) {
am::VehicleData vehicle_data;
EXPECT_CALL(mock_message_helper_, vehicle_data())
- .WillOnce(ReturnRef(vehicle_data));
+ .WillRepeatedly(ReturnRef(vehicle_data));
+
+ smart_objects::SmartObject empty_hmi_custom_params;
+ ON_CALL(mock_custom_vehicle_data_manager_, CreateHMIMessageParams(_))
+ .WillByDefault(Return(empty_hmi_custom_params));
- MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -183,17 +214,21 @@ TEST_F(UnsubscribeVehicleRequestTest,
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
(*command_msg)[am::strings::msg_params][kMsgParamKey] = false;
- CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+ CommandPtr command(
+ CreateCommandVI<UnsubscribeVehicleDataRequest>(command_msg));
command->Run();
}
TEST_F(UnsubscribeVehicleRequestTest,
Run_UnsubscribeFromNotSubscribedBeforeData_UNSUCCESS) {
+ smart_objects::SmartObject empty_hmi_custom_params;
+ ON_CALL(mock_custom_vehicle_data_manager_, CreateHMIMessageParams(_))
+ .WillByDefault(Return(empty_hmi_custom_params));
+
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
EXPECT_CALL(mock_message_helper_, vehicle_data())
- .WillOnce(ReturnRef(vehicle_data));
-
+ .WillRepeatedly(ReturnRef(vehicle_data));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -205,7 +240,8 @@ TEST_F(UnsubscribeVehicleRequestTest,
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
(*command_msg)[am::strings::msg_params][kMsgParamKey] = true;
- CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+ CommandPtr command(
+ CreateCommandVI<UnsubscribeVehicleDataRequest>(command_msg));
command->Run();
}
@@ -214,15 +250,19 @@ TEST_F(UnsubscribeVehicleRequestTest, Run_UnsubscribeDataDisabled_UNSUCCESS) {
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
+ smart_objects::SmartObject empty_hmi_custom_params;
+ ON_CALL(mock_custom_vehicle_data_manager_, CreateHMIMessageParams(_))
+ .WillByDefault(Return(empty_hmi_custom_params));
+
+ CommandPtr command(
+ CreateCommandVI<UnsubscribeVehicleDataRequest>(command_msg));
+
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
EXPECT_CALL(mock_message_helper_, vehicle_data())
- .WillOnce(ReturnRef(vehicle_data));
- CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
-
- MockAppPtr mock_app(CreateMockApp());
+ .WillRepeatedly(ReturnRef(vehicle_data));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app));
+ .WillOnce(Return(mock_app_));
EXPECT_CALL(
mock_rpc_service_,
@@ -236,7 +276,8 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) {
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
(*command_msg)[am::strings::msg_params][kMsgParamKey] = true;
- CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+ CommandPtr command(
+ CreateCommandVI<UnsubscribeVehicleDataRequest>(command_msg));
am::VehicleData vehicle_data;
@@ -244,7 +285,11 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) {
.WillRepeatedly(Return(mock_app_));
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
EXPECT_CALL(mock_message_helper_, vehicle_data())
- .WillOnce(ReturnRef(vehicle_data));
+ .WillRepeatedly(ReturnRef(vehicle_data));
+
+ smart_objects::SmartObject empty_hmi_custom_params;
+ ON_CALL(mock_custom_vehicle_data_manager_, CreateHMIMessageParams(_))
+ .WillByDefault(Return(empty_hmi_custom_params));
EXPECT_CALL(
mock_rpc_service_,
@@ -274,7 +319,8 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataUnsubscribed_SUCCESS) {
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
(*command_msg)[am::strings::msg_params][kMsgParamKey] = true;
- CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
+ CommandPtr command(
+ CreateCommandVI<UnsubscribeVehicleDataRequest>(command_msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app_));
@@ -287,6 +333,11 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataUnsubscribed_SUCCESS) {
message[am::strings::msg_params][kMsgParamKey] = true;
test_event.set_smart_object(message);
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
+ .WillRepeatedly(ReturnRef(vehicle_data));
+
EXPECT_CALL(
mock_rpc_service_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_response_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_response_test.cc
index bed9cffeb2..7c610c8adb 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_response_test.cc
@@ -30,13 +30,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "mobile/unsubscribe_vehicle_data_response.h"
#include <stdint.h>
#include <string>
-#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application_manager.h"
+#include "gtest/gtest.h"
+#include "mobile/unsubscribe_vehicle_data_response.h"
+
+#include "vehicle_info_plugin/commands/vi_commands_test.h"
+#include "vehicle_info_plugin/mock_custom_vehicle_data_manager.h"
+#include "vehicle_info_plugin/vehicle_info_command_factory.h"
namespace test {
namespace components {
@@ -50,12 +52,12 @@ using ::testing::_;
using ::testing::NotNull;
using ::testing::Types;
-using vehicle_info_plugin::commands::UnsubscribeVehicleDataResponse;
using commands::MessageSharedPtr;
+using vehicle_info_plugin::commands::UnsubscribeVehicleDataResponse;
namespace am = ::application_manager;
class UnsubscribeVehicleResponseTest
- : public CommandsTest<CommandsTestMocks::kIsNice> {};
+ : public VICommandsTest<CommandsTestMocks::kIsNice> {};
MATCHER_P(ResultCodeIs, result_code, "") {
return result_code ==
@@ -66,11 +68,11 @@ MATCHER_P(ResultCodeIs, result_code, "") {
TEST_F(UnsubscribeVehicleResponseTest,
Run_SendFalseResponseToMobile_SendInvalidEnum) {
MessageSharedPtr command_msg =
- ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map);
+ std::make_shared<SmartObject>(smart_objects::SmartType_Map);
(*command_msg)[am::strings::msg_params][am::strings::success] = false;
- ::utils::SharedPtr<UnsubscribeVehicleDataResponse> command =
- CreateCommand<UnsubscribeVehicleDataResponse>(command_msg);
+ std::shared_ptr<UnsubscribeVehicleDataResponse> command =
+ CreateCommandVI<UnsubscribeVehicleDataResponse>(command_msg);
EXPECT_CALL(
mock_rpc_service_,
@@ -81,10 +83,10 @@ TEST_F(UnsubscribeVehicleResponseTest,
TEST_F(UnsubscribeVehicleResponseTest,
Run_SendSuccessfulResponseToMobile_SUCCESS) {
MessageSharedPtr command_msg =
- ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map);
+ std::make_shared<SmartObject>(smart_objects::SmartType_Map);
(*command_msg)[am::strings::msg_params][am::strings::success] = true;
- ::utils::SharedPtr<UnsubscribeVehicleDataResponse> command =
- CreateCommand<UnsubscribeVehicleDataResponse>(command_msg);
+ std::shared_ptr<UnsubscribeVehicleDataResponse> command =
+ CreateCommandVI<UnsubscribeVehicleDataResponse>(command_msg);
EXPECT_CALL(
mock_rpc_service_,
@@ -95,14 +97,14 @@ TEST_F(UnsubscribeVehicleResponseTest,
TEST_F(UnsubscribeVehicleResponseTest,
Run_SendResponseToMobile_SendCodeToMobile) {
MessageSharedPtr command_msg =
- ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map);
+ std::make_shared<SmartObject>(smart_objects::SmartType_Map);
(*command_msg)[am::strings::msg_params][am::strings::success] = true;
mobile_apis::Result::eType result_type = mobile_apis::Result::WARNINGS;
(*command_msg)[am::strings::msg_params][am::strings::result_code] =
result_type;
- ::utils::SharedPtr<UnsubscribeVehicleDataResponse> command =
- CreateCommand<UnsubscribeVehicleDataResponse>(command_msg);
+ std::shared_ptr<UnsubscribeVehicleDataResponse> command =
+ CreateCommandVI<UnsubscribeVehicleDataResponse>(command_msg);
command->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/custom_vehicle_data_manager_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/custom_vehicle_data_manager_test.cc
new file mode 100644
index 0000000000..7d65d989bf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/custom_vehicle_data_manager_test.cc
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. */
+
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_rpc_service.h"
+#include "application_manager/policies/mock_custom_vehicle_data_provider.h"
+#include "gtest/gtest.h"
+#include "test/application_manager/mock_application_manager.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager_impl.h"
+
+namespace vehicle_info_plugin_test {
+
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+using application_manager::MockMessageHelper;
+namespace {
+std::string kName = "rpm";
+std::string kKey = "VD_RPM";
+} // namespace
+class CustomVehicleDataManagerTest : public ::testing::Test {
+ public:
+ CustomVehicleDataManagerTest()
+ : mock_message_helper_(
+ *application_manager::MockMessageHelper::message_helper_mock()) {}
+
+ void SetUp() OVERRIDE {}
+
+ void InitValidationManager(const policy_table::VehicleDataItems& items) {
+ using vehicle_info_plugin::CustomVehicleDataManagerImpl;
+
+ ON_CALL(mock_custom_vehicle_data_provider_, GetVehicleDataItems())
+ .WillByDefault(Return(items));
+ ON_CALL(mock_custom_vehicle_data_provider_, GetRemovedVehicleDataItems())
+ .WillByDefault(Return(policy_table::VehicleDataItems()));
+ custom_vd_manager_.reset(new CustomVehicleDataManagerImpl(
+ mock_custom_vehicle_data_provider_, mock_rpc_service_));
+ }
+
+ test::components::application_manager_test::MockApplicationManager
+ app_manager_mock_;
+ std::unique_ptr<vehicle_info_plugin::CustomVehicleDataManager>
+ custom_vd_manager_;
+ NiceMock<test::components::policy_test::MockCustomVehicleDataProvider>
+ mock_custom_vehicle_data_provider_;
+ NiceMock<test::components::application_manager_test::MockRPCService>
+ mock_rpc_service_;
+ MockMessageHelper& mock_message_helper_;
+};
+
+TEST_F(CustomVehicleDataManagerTest, CreateHMIMessageParamsEmptyItems) {
+ policy_table::VehicleDataItems schema_items;
+ InitValidationManager(schema_items);
+ const std::set<std::string> items;
+ const auto msg_params = custom_vd_manager_->CreateHMIMessageParams(items);
+ EXPECT_EQ(msg_params.getType(), smart_objects::SmartType_Map);
+ EXPECT_TRUE(msg_params.empty());
+}
+
+TEST_F(CustomVehicleDataManagerTest, CreateHMIMessageParamsOnePODItem) {
+ policy_table::VehicleDataItem rpm;
+ rpm.mark_initialized();
+ rpm.name = kName;
+ rpm.type = "Integer";
+ rpm.key = "OEM_REF_RPM";
+ rpm.mandatory = false;
+ *rpm.array = false;
+ rpm.params->mark_initialized();
+
+ policy_table::VehicleDataItems schema_items;
+ schema_items.push_back(rpm);
+ InitValidationManager(schema_items);
+
+ const std::set<std::string> items = {kName};
+ const auto msg_params = custom_vd_manager_->CreateHMIMessageParams(items);
+ EXPECT_EQ(msg_params.getType(), smart_objects::SmartType_Map);
+ EXPECT_EQ(msg_params.length(), 1u);
+ EXPECT_TRUE(msg_params.keyExists("OEM_REF_RPM"));
+ auto key_value = msg_params["OEM_REF_RPM"];
+ EXPECT_TRUE(key_value.asBool());
+}
+
+TEST_F(CustomVehicleDataManagerTest, CreateHMIMessageParamsSeveralPODItems) {
+ policy_table::VehicleDataItem rpm;
+ rpm.mark_initialized();
+ rpm.name = kName;
+ rpm.type = "Integer";
+ rpm.key = "OEM_REF_RPM";
+ rpm.mandatory = false;
+ *rpm.array = false;
+ rpm.params->mark_initialized();
+
+ policy_table::VehicleDataItem speed;
+ speed.mark_initialized();
+ speed.name = "speed";
+ speed.type = "float";
+ speed.key = "OEM_REF_SPEED";
+ speed.mandatory = false;
+ *speed.array = false;
+ speed.params->mark_initialized();
+
+ policy_table::VehicleDataItems schema_items;
+ schema_items.push_back(rpm);
+ schema_items.push_back(speed);
+ InitValidationManager(schema_items);
+
+ const std::set<std::string> items = {kName, "speed"};
+
+ const auto msg_params = custom_vd_manager_->CreateHMIMessageParams(items);
+ EXPECT_EQ(msg_params.getType(), smart_objects::SmartType_Map);
+ EXPECT_EQ(msg_params.length(), 2u);
+
+ EXPECT_TRUE(msg_params.keyExists("OEM_REF_RPM"));
+ auto rpm_key_value = msg_params["OEM_REF_RPM"];
+ EXPECT_TRUE(rpm_key_value.asBool());
+
+ EXPECT_TRUE(msg_params.keyExists("OEM_REF_SPEED"));
+ auto speed_key_value = msg_params["OEM_REF_SPEED"];
+ EXPECT_TRUE(speed_key_value.asBool());
+}
+
+TEST_F(CustomVehicleDataManagerTest,
+ CreateHMIMessageParamsSchemaWithSeveralItemsRequestWithOneItem) {
+ policy_table::VehicleDataItem rpm;
+ rpm.mark_initialized();
+ rpm.name = kName;
+ rpm.type = "Integer";
+ rpm.key = "OEM_REF_RPM";
+ rpm.mandatory = false;
+ *rpm.array = false;
+ rpm.params->mark_initialized();
+
+ policy_table::VehicleDataItem speed;
+ speed.mark_initialized();
+ speed.name = "speed";
+ speed.type = "float";
+ speed.key = "OEM_REF_SPEED";
+ speed.mandatory = false;
+ *speed.array = false;
+ speed.params->mark_initialized();
+
+ policy_table::VehicleDataItems schema_items;
+ schema_items.push_back(rpm);
+ schema_items.push_back(speed);
+ InitValidationManager(schema_items);
+
+ const std::set<std::string> items = {kName};
+
+ const auto msg_params = custom_vd_manager_->CreateHMIMessageParams(items);
+ EXPECT_EQ(msg_params.getType(), smart_objects::SmartType_Map);
+ EXPECT_EQ(msg_params.length(), 1u);
+
+ EXPECT_TRUE(msg_params.keyExists("OEM_REF_RPM"));
+ auto rpm_key_value = msg_params["OEM_REF_RPM"];
+ EXPECT_TRUE(rpm_key_value.asBool());
+}
+
+TEST_F(CustomVehicleDataManagerTest, CreateHMIMessageParamsStructType) {
+ policy_table::VehicleDataItem alss;
+ alss.mark_initialized();
+ alss.name = "ambientLightSensorStatus";
+ alss.type = "AmbientLightStatus";
+ alss.key = "OEM_REF_AMB_LIGHT";
+ alss.mandatory = false;
+ alss.params->mark_initialized();
+
+ policy_table::VehicleDataItem lss;
+ lss.mark_initialized();
+ lss.name = "LightSensorStatus";
+ lss.type = "Struct";
+ lss.key = "OEM_REF_SEN_LIGHT";
+ lss.mandatory = false;
+ lss.params->mark_initialized();
+ lss.params->push_back(alss);
+
+ policy_table::VehicleDataItem hbo;
+ hbo.mark_initialized();
+ hbo.name = "highBeamsOn";
+ hbo.type = "Boolean";
+ hbo.key = "OEM_REF_HIGH_BEAM";
+ hbo.mandatory = true;
+ hbo.params->mark_initialized();
+
+ policy_table::VehicleDataItem lbo;
+ lbo.mark_initialized();
+ lbo.name = "lowBeamsOn";
+ lbo.type = "Boolean";
+ lbo.key = "OEM_REF_LOW_BEAM";
+ lbo.mandatory = false;
+ lbo.params->mark_initialized();
+
+ policy_table::VehicleDataItem hls;
+ hls.mark_initialized();
+ hls.name = "headLampStatus";
+ hls.type = "Struct";
+ hls.key = "OEM_REF_HLSTATUS";
+ hls.mandatory = false;
+ hls.params->mark_initialized();
+ hls.params->push_back(lss);
+ hls.params->push_back(lbo);
+ hls.params->push_back(hbo);
+
+ policy_table::VehicleDataItems schema_items;
+ schema_items.push_back(hls);
+ InitValidationManager(schema_items);
+
+ const std::set<std::string> items = {"headLampStatus"};
+
+ const auto msg_params = custom_vd_manager_->CreateHMIMessageParams(items);
+ EXPECT_EQ(msg_params.getType(), smart_objects::SmartType_Map);
+ EXPECT_EQ(msg_params.length(), 1u);
+
+ EXPECT_TRUE(msg_params.keyExists("OEM_REF_HLSTATUS"));
+ const auto head_lamp_status = msg_params["OEM_REF_HLSTATUS"];
+ EXPECT_EQ(head_lamp_status.getType(), smart_objects::SmartType_Map);
+
+ EXPECT_EQ(head_lamp_status.length(), 3u);
+
+ EXPECT_TRUE(head_lamp_status.keyExists("OEM_REF_HIGH_BEAM"));
+ EXPECT_TRUE(head_lamp_status.keyExists("OEM_REF_LOW_BEAM"));
+ EXPECT_TRUE(head_lamp_status.keyExists("OEM_REF_SEN_LIGHT"));
+
+ EXPECT_TRUE(head_lamp_status["OEM_REF_HIGH_BEAM"].asBool());
+ EXPECT_TRUE(head_lamp_status["OEM_REF_LOW_BEAM"].asBool());
+ auto light_sensor_status = head_lamp_status["OEM_REF_SEN_LIGHT"];
+
+ EXPECT_EQ(light_sensor_status.length(), 1u);
+ EXPECT_TRUE(light_sensor_status.keyExists("OEM_REF_AMB_LIGHT"));
+ EXPECT_TRUE(light_sensor_status["OEM_REF_AMB_LIGHT"].asBool());
+}
+
+TEST_F(CustomVehicleDataManagerTest, CreateHMIMessageParamsNoSchemaForItem) {
+ policy_table::VehicleDataItems schema_items;
+ InitValidationManager(schema_items);
+
+ const std::set<std::string> items = {kName};
+
+ const auto msg_params = custom_vd_manager_->CreateHMIMessageParams(items);
+ EXPECT_EQ(msg_params.getType(), smart_objects::SmartType_Map);
+ EXPECT_TRUE(msg_params.empty());
+}
+
+TEST_F(CustomVehicleDataManagerTest, CreateMobileMessageParamsStruct) {
+ const application_manager::VehicleData kEmptyVehicleData;
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(kEmptyVehicleData));
+
+ policy_table::VehicleDataItems schema_items;
+
+ policy_table::VehicleDataItem custom_vd_item11_struct;
+ custom_vd_item11_struct.mark_initialized();
+ custom_vd_item11_struct.name = "custom_vd_item11_struct";
+ custom_vd_item11_struct.type = "Struct";
+ custom_vd_item11_struct.key = "OEM_REF_STRUCT";
+ custom_vd_item11_struct.mandatory = false;
+ custom_vd_item11_struct.params->mark_initialized();
+
+ policy_table::VehicleDataItem struct_element_1_int;
+ struct_element_1_int.mark_initialized();
+ struct_element_1_int.name = "struct_element_1_int";
+ struct_element_1_int.type = "Integer";
+ struct_element_1_int.key = "OEM_REF_STRUCT_1_INT";
+ struct_element_1_int.mandatory = false;
+ struct_element_1_int.params->mark_initialized();
+ custom_vd_item11_struct.params->push_back(struct_element_1_int);
+ schema_items.push_back(custom_vd_item11_struct);
+ InitValidationManager(schema_items);
+
+ smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
+ msg_params["OEM_REF_STRUCT"] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ auto& oem_ref_struct = msg_params["OEM_REF_STRUCT"];
+ oem_ref_struct["OEM_REF_STRUCT_1_INT"] = 100;
+ custom_vd_manager_->CreateMobileMessageParams(msg_params);
+
+ EXPECT_EQ(msg_params.getType(), smart_objects::SmartType_Map);
+ EXPECT_TRUE(msg_params.keyExists("custom_vd_item11_struct"));
+
+ auto& mobile_response_vd_item_11 = msg_params["custom_vd_item11_struct"];
+ EXPECT_EQ(mobile_response_vd_item_11.getType(), smart_objects::SmartType_Map);
+ EXPECT_TRUE(mobile_response_vd_item_11.keyExists("struct_element_1_int"));
+
+ auto& mobile_response_element1 =
+ mobile_response_vd_item_11["struct_element_1_int"];
+ EXPECT_EQ(mobile_response_element1.getType(),
+ smart_objects::SmartType_Integer);
+ EXPECT_EQ(mobile_response_element1.asInt(), 100);
+}
+} // namespace vehicle_info_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_command_request_test.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_command_request_test.h
new file mode 100644
index 0000000000..a6eac01e1c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_command_request_test.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_TEST_INCLUDE_VIHICLE_INFO_PLUGIN_COMMANDS_VI_COMMAND_REQUEST_TEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_TEST_INCLUDE_VIHICLE_INFO_PLUGIN_COMMANDS_VI_COMMAND_REQUEST_TEST_H_
+
+#include <stdint.h>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "vehicle_info_plugin/mock_custom_vehicle_data_manager.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+
+using ::test::components::event_engine_test::MockEventDispatcher;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::SaveArg;
+namespace am = ::application_manager;
+using am::commands::Command;
+using am::commands::CommandRequestImpl;
+using am::event_engine::Event;
+
+template <const CommandsTestMocks kIsNice = CommandsTestMocks::kNotNice>
+class VICommandRequestTest : public CommandRequestTest<kIsNice> {
+ public:
+ enum { kDefaultTimeout_ = 100 };
+
+ template <class Command>
+ std::shared_ptr<Command> CreateCommandVI() {
+ auto msg = CommandsTest<kIsNice>::CreateMessage();
+ return CreateCommandVI<Command>(msg);
+ }
+
+ template <class Command>
+ std::shared_ptr<Command> CreateCommandVI(MessageSharedPtr& msg) {
+ InitCommandVI(kDefaultTimeout_);
+ vehicle_info_plugin::VehicleInfoCommandParams params = {
+ CommandsTest<kIsNice>::app_mngr_,
+ CommandsTest<kIsNice>::mock_rpc_service_,
+ CommandsTest<kIsNice>::mock_hmi_capabilities_,
+ CommandsTest<kIsNice>::mock_policy_handler_,
+ mock_custom_vehicle_data_manager_};
+ return std::make_shared<Command>(msg, params);
+ }
+
+ testing::NiceMock<vehicle_info_plugin::MockCustomVehicleDataManager>
+ mock_custom_vehicle_data_manager_;
+
+ protected:
+ VICommandRequestTest() : CommandRequestTest<kIsNice>() {}
+
+ void InitCommandVI(const uint32_t& timeout) {
+ CommandRequestTest<kIsNice>::InitCommand(kDefaultTimeout_);
+ }
+};
+
+} // namespace commands_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_TEST_INCLUDE_VIHICLE_INFO_PLUGIN_COMMANDS_VI_COMMAND_REQUEST_TEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h
new file mode 100644
index 0000000000..ae25acea87
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_TEST_INCLUDE_VI_COMMAND_TEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_TEST_INCLUDE_VI_COMMAND_TEST_H_
+
+#include <stdint.h>
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/command.h"
+#include "smart_objects/smart_object.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "vehicle_info_plugin/mock_custom_vehicle_data_manager.h"
+#include "vehicle_info_plugin/vehicle_info_command_params.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+
+namespace am = ::application_manager;
+
+using ::testing::_;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+using am::commands::MessageSharedPtr;
+using ::smart_objects::SmartObject;
+
+template <const CommandsTestMocks kIsNice = CommandsTestMocks::kNotNice>
+class VICommandsTest : public CommandsTest<kIsNice> {
+ public:
+ enum { kDefaultTimeout_ = 100 };
+
+ template <class Command>
+ std::shared_ptr<Command> CreateCommandVI() {
+ auto msg = CommandsTest<kIsNice>::CreateMessage();
+ return CreateCommandVI<Command>(msg);
+ }
+
+ template <class Command>
+ std::shared_ptr<Command> CreateCommandVI(MessageSharedPtr& msg) {
+ InitCommandVI(kDefaultTimeout_);
+ vehicle_info_plugin::VehicleInfoCommandParams params = {
+ CommandsTest<kIsNice>::app_mngr_,
+ CommandsTest<kIsNice>::mock_rpc_service_,
+ CommandsTest<kIsNice>::mock_hmi_capabilities_,
+ CommandsTest<kIsNice>::mock_policy_handler_,
+ mock_custom_vehicle_data_manager_};
+ return std::make_shared<Command>(msg, params);
+ }
+
+ testing::NiceMock<vehicle_info_plugin::MockCustomVehicleDataManager>
+ mock_custom_vehicle_data_manager_;
+
+ protected:
+ void InitCommandVI(const uint32_t& timeout) {
+ ON_CALL(CommandsTest<kIsNice>::app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(CommandsTest<kIsNice>::app_mngr_settings_));
+ ON_CALL(CommandsTest<kIsNice>::app_mngr_settings_, default_timeout())
+ .WillByDefault(ReturnRef(timeout));
+ }
+};
+} // namespace commands_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_TEST_INCLUDE_VI_COMMAND_TEST_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/mock_custom_vehicle_data_manager.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/mock_custom_vehicle_data_manager.h
new file mode 100644
index 0000000000..9a7435f980
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/mock_custom_vehicle_data_manager.h
@@ -0,0 +1,26 @@
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_TEST_INCLUDE_VEHICLE_INFO_PLUGIN_MOCK_CUSTOM_VEHICLE_DATA_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_TEST_INCLUDE_VEHICLE_INFO_PLUGIN_MOCK_CUSTOM_VEHICLE_DATA_MANAGER_H_
+
+#include "gmock/gmock.h"
+#include "vehicle_info_plugin/custom_vehicle_data_manager.h"
+
+namespace vehicle_info_plugin {
+namespace plugin_manager = application_manager::plugin_manager;
+class MockCustomVehicleDataManager : public CustomVehicleDataManager {
+ public:
+ MOCK_METHOD1(
+ CreateHMIMessageParams,
+ smart_objects::SmartObject(const std::set<std::string>& msg_params));
+ MOCK_METHOD1(CreateMobileMessageParams,
+ void(smart_objects::SmartObject& msg_params));
+ MOCK_CONST_METHOD1(GetVehicleDataItemType,
+ std::string(const std::string& vehicle_data_item_name));
+ MOCK_METHOD1(OnPolicyEvent, void(plugin_manager::PolicyEvent policy_event));
+ MOCK_CONST_METHOD1(IsValidCustomVehicleDataName,
+ bool(const std::string& name));
+ MOCK_CONST_METHOD1(IsRemovedCustomVehicleDataName,
+ bool(const std::string& name));
+};
+
+} // namespace vehicle_info_plugin
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_VEHICLE_INFO_PLUGIN_TEST_INCLUDE_VEHICLE_INFO_PLUGIN_MOCK_CUSTOM_VEHICLE_DATA_MANAGER_H_
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_data_item_schema_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_data_item_schema_test.cc
new file mode 100644
index 0000000000..2443310409
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_data_item_schema_test.cc
@@ -0,0 +1,396 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. */
+
+#include "vehicle_info_plugin/vehicle_data_item_schema.h"
+#include <limits>
+#include <set>
+#include <type_traits>
+#include "formatters/formatter_json_rpc.h"
+#include "formatters/generic_json_formatter.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "interfaces/HMI_API.h"
+#include "smart_objects/smart_object.h"
+
+namespace vehicle_info_plugin_test {
+using namespace vehicle_info_plugin;
+using namespace rpc;
+namespace smart_objects = ns_smart_device_link::ns_smart_objects;
+namespace policy_table = rpc::policy_table_interface_base;
+
+using namespace ns_smart_device_link::ns_json_handler::strings;
+using namespace hmi_apis;
+
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+using ErrorCode = smart_objects::errors::eType;
+
+namespace {
+const int kInvalidValue = std::numeric_limits<int32_t>::max();
+const int kDefaultInteger = 20;
+const double kDefaultFloat = 10.05;
+const bool kDefaultBoolean = true;
+const std::string kDefaultString = "string value";
+const std::string kVehicleDataKey = "key";
+} // namespace
+
+typedef Common_ComponentVolumeStatus::eType TestEnumType;
+
+class VehicleDataItemSchemaTest : public ::testing::Test {
+ public:
+ /*
+ * @brief
+ * Specifies whether user wants to generate valid value of SmartObject or not.
+ */
+ enum class SetValidItemValue { NO = 0, YES = 1 };
+
+ /*
+ * @brief
+ * VehicleDataTestObject struct combines schema and data structures for test
+ * object.
+ */
+ struct VehicleDataTestObject {
+ VehicleDataTestObject(const int& key_number) {
+ schema.mark_initialized();
+ schema.params->mark_initialized();
+ schema.mandatory = true;
+ *schema.array = false;
+ // default value bounds
+ *schema.minvalue = 10;
+ *schema.maxvalue = 100;
+ // default string length
+ *schema.minlength = 5;
+ *schema.maxlength = 30;
+ // default array length
+ *schema.minsize = 5;
+ *schema.maxsize = 30;
+ // generate schema unique key
+ schema.key = kVehicleDataKey + std::to_string(key_number);
+ }
+
+ policy_table::VehicleDataItem schema;
+ smart_objects::SmartObject data;
+ };
+
+ public:
+ VehicleDataItemSchemaTest() : key_number_(1) {
+ test_enum_.insert(TestEnumType::CVS_UNKNOWN);
+ test_enum_.insert(TestEnumType::CVS_NORMAL);
+ test_enum_.insert(TestEnumType::CVS_LOW);
+ test_enum_.insert(TestEnumType::CVS_FAULT);
+ test_enum_.insert(TestEnumType::CVS_ALERT);
+ test_enum_.insert(TestEnumType::CVS_NOT_SUPPORTED);
+ }
+
+ void assertSmartObjectSize(const size_t& expected_size,
+ const size_t& actual_size) {
+ ASSERT_EQ(expected_size, actual_size);
+ }
+
+ std::vector<VehicleDataTestObject> generatePODObjects(
+ const SetValidItemValue& set_valid_item) {
+ std::vector<VehicleDataTestObject> generated_objects;
+ VehicleDataTestObject custom_object(key_number_++);
+
+ // Integer item
+ custom_object.schema.type = policy_table::VehicleDataItem::kInteger;
+ if (set_valid_item == SetValidItemValue::YES) {
+ custom_object.data = kDefaultInteger;
+ } else {
+ custom_object.data = kInvalidValue;
+ }
+ generated_objects.push_back(custom_object);
+
+ // Float item
+ custom_object.schema.type = policy_table::VehicleDataItem::kFloat;
+ if (set_valid_item == SetValidItemValue::YES) {
+ custom_object.data = kDefaultFloat;
+ } else {
+ custom_object.data = kInvalidValue;
+ }
+ generated_objects.push_back(custom_object);
+
+ // String item
+ custom_object.schema.type = policy_table::VehicleDataItem::kString;
+ if (set_valid_item == SetValidItemValue::YES) {
+ custom_object.data = kDefaultString;
+ } else {
+ custom_object.data = kInvalidValue;
+ }
+ generated_objects.push_back(custom_object);
+
+ // Boolean item
+ custom_object.schema.type = policy_table::VehicleDataItem::kBoolean;
+ if (set_valid_item == SetValidItemValue::YES) {
+ custom_object.data = kDefaultBoolean;
+ } else {
+ custom_object.data = kInvalidValue;
+ }
+ generated_objects.push_back(custom_object);
+
+ return generated_objects;
+ }
+
+ VehicleDataTestObject generateTestObject(
+ const SetValidItemValue& set_valid_item) {
+ // Enum parameter
+ VehicleDataTestObject enum_object(key_number_++);
+ enum_object.schema.type = "ComponentVolumeStatus";
+ enum_object.data = (set_valid_item == SetValidItemValue::YES)
+ ? TestEnumType::CVS_LOW
+ : kInvalidValue;
+
+ // Integer parameter
+ VehicleDataTestObject int_object(key_number_++);
+ int_object.schema.type = policy_table::VehicleDataItem::kInteger;
+ int_object.data = (set_valid_item == SetValidItemValue::YES)
+ ? kDefaultInteger
+ : kInvalidValue;
+
+ // Main object
+ VehicleDataTestObject main_object(key_number_++);
+ main_object.schema.type = policy_table::VehicleDataItem::kStruct;
+ *main_object.schema.params = std::vector<policy_table::VehicleDataItem>{
+ enum_object.schema, int_object.schema};
+ main_object.data[enum_object.schema.key] = enum_object.data;
+ main_object.data[int_object.schema.key] = int_object.data;
+
+ assertSmartObjectSize(2u, main_object.data.length());
+ return main_object;
+ }
+
+ VehicleDataTestObject generateRecursiveTestObject(
+ const SetValidItemValue& set_valid_item) {
+ // Float item
+ VehicleDataTestObject float_object(key_number_++);
+ float_object.schema.type = policy_table::VehicleDataItem::kFloat;
+ if (set_valid_item == SetValidItemValue::YES) {
+ float_object.data = kDefaultFloat;
+ } else {
+ float_object.data = kInvalidValue;
+ }
+
+ // String item
+ VehicleDataTestObject string_object(key_number_++);
+ string_object.schema.type = policy_table::VehicleDataItem::kString;
+ if (set_valid_item == SetValidItemValue::YES) {
+ string_object.data = kDefaultString;
+ } else {
+ string_object.data = kInvalidValue;
+ }
+
+ // Sub Object
+ VehicleDataTestObject sub_object = generateTestObject(set_valid_item);
+
+ // Main Object
+ VehicleDataTestObject main_object(key_number_++);
+ main_object.schema.type = policy_table::VehicleDataItem::kStruct;
+ *main_object.schema.params = std::vector<policy_table::VehicleDataItem>{
+ float_object.schema, string_object.schema, sub_object.schema};
+ main_object.data[float_object.schema.key] = float_object.data;
+ main_object.data[string_object.schema.key] = string_object.data;
+ main_object.data[sub_object.schema.key] = sub_object.data;
+
+ assertSmartObjectSize(3u, main_object.data.length());
+ return main_object;
+ }
+
+ protected:
+ std::set<TestEnumType> test_enum_;
+ int key_number_;
+};
+
+TEST_F(VehicleDataItemSchemaTest, ValidatePOD_SUCCESS) {
+ rpc::ValidationReport report("RPC");
+ auto valid_pod_objects = generatePODObjects(SetValidItemValue::YES);
+
+ for (auto& object : valid_pod_objects) {
+ auto test_param = PolicyDataItem(object.schema);
+ auto result = VehicleDataItemSchema::create(
+ test_param, VehicleDataItemSchema::SchemaType::HMI);
+ EXPECT_EQ(ErrorCode::OK, result->validate(object.data, &report));
+ EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
+ }
+}
+
+TEST_F(VehicleDataItemSchemaTest, ValidatePOD_FAIL) {
+ rpc::ValidationReport report("RPC");
+ std::vector<VehicleDataTestObject> valid_pod_objects =
+ generatePODObjects(SetValidItemValue::NO);
+
+ for (auto& object : valid_pod_objects) {
+ auto test_param = PolicyDataItem(object.schema);
+ auto result = VehicleDataItemSchema::create(
+ test_param, VehicleDataItemSchema::SchemaType::MOBILE);
+ EXPECT_NE(ErrorCode::OK, result->validate(object.data, &report));
+ EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
+ }
+}
+
+TEST_F(VehicleDataItemSchemaTest, ValidateEnum_SUCCESS) {
+ rpc::ValidationReport report("RPC");
+
+ VehicleDataTestObject test_enum_object(key_number_++);
+ test_enum_object.schema.type = "ComponentVolumeStatus";
+ test_enum_object.data = TestEnumType::CVS_NORMAL;
+
+ auto test_schema = PolicyDataItem(test_enum_object.schema);
+
+ for (auto& enum_value : test_enum_) {
+ test_enum_object.data = enum_value;
+ auto result = VehicleDataItemSchema::create(
+ test_schema, VehicleDataItemSchema::SchemaType::HMI);
+ EXPECT_EQ(ErrorCode::OK, result->validate(test_enum_object.data, &report));
+ EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
+ }
+}
+
+TEST_F(VehicleDataItemSchemaTest, ValidateEnum_FAIL) {
+ rpc::ValidationReport report("RPC");
+
+ VehicleDataTestObject test_enum_object(key_number_++);
+ test_enum_object.schema.type = "ComponentVolumeStatus";
+ test_enum_object.data = kInvalidValue;
+
+ auto test_schema = PolicyDataItem(test_enum_object.schema);
+ auto result = VehicleDataItemSchema::create(
+ test_schema, VehicleDataItemSchema::SchemaType::HMI);
+ EXPECT_EQ(ErrorCode::OUT_OF_RANGE,
+ result->validate(test_enum_object.data, &report));
+ EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
+}
+
+TEST_F(VehicleDataItemSchemaTest, ValidateObject_SUCCESS) {
+ rpc::ValidationReport report("RPC");
+ VehicleDataTestObject complex_object =
+ generateTestObject(SetValidItemValue::YES);
+ auto test_schema = PolicyDataItem(complex_object.schema);
+ auto result = VehicleDataItemSchema::create(
+ test_schema, VehicleDataItemSchema::SchemaType::HMI);
+ EXPECT_EQ(ErrorCode::OK, result->validate(complex_object.data, &report));
+ EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
+}
+
+TEST_F(VehicleDataItemSchemaTest, ValidateObject_FAIL) {
+ rpc::ValidationReport report("RPC");
+ VehicleDataTestObject complex_object =
+ generateTestObject(SetValidItemValue::NO);
+ auto test_schema = PolicyDataItem(complex_object.schema);
+ auto result = VehicleDataItemSchema::create(
+ test_schema, VehicleDataItemSchema::SchemaType::HMI);
+ EXPECT_NE(ErrorCode::OK, result->validate(complex_object.data, &report));
+ EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
+}
+
+TEST_F(VehicleDataItemSchemaTest, ValidateRecursiveObject_SUCCESS) {
+ rpc::ValidationReport report("RPC");
+ VehicleDataTestObject complex_recursive_object =
+ generateRecursiveTestObject(SetValidItemValue::YES);
+ auto test_schema = PolicyDataItem(complex_recursive_object.schema);
+ auto result = VehicleDataItemSchema::create(
+ test_schema, VehicleDataItemSchema::SchemaType::HMI);
+ EXPECT_EQ(ErrorCode::OK,
+ result->validate(complex_recursive_object.data, &report));
+ EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
+}
+
+TEST_F(VehicleDataItemSchemaTest, ValidateRecursiveObject_FAIL) {
+ rpc::ValidationReport report("RPC");
+ VehicleDataTestObject complex_recursive_object =
+ generateRecursiveTestObject(SetValidItemValue::NO);
+ auto test_schema = PolicyDataItem(complex_recursive_object.schema);
+ auto result = VehicleDataItemSchema::create(
+ test_schema, VehicleDataItemSchema::SchemaType::HMI);
+ EXPECT_NE(ErrorCode::OK,
+ result->validate(complex_recursive_object.data, &report));
+ EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
+}
+
+TEST_F(VehicleDataItemSchemaTest, ValidateArray_SUCCESS) {
+ rpc::ValidationReport report("RPC");
+ VehicleDataTestObject array_object(key_number_++);
+ *array_object.schema.array = true;
+ array_object.schema.type = policy_table::VehicleDataItem::kInteger;
+ array_object.data =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ array_object.data.asArray()->push_back(smart_objects::SmartObject(10));
+ array_object.data.asArray()->push_back(smart_objects::SmartObject(20));
+ array_object.data.asArray()->push_back(smart_objects::SmartObject(30));
+ array_object.data.asArray()->push_back(smart_objects::SmartObject(40));
+ array_object.data.asArray()->push_back(smart_objects::SmartObject(50));
+ array_object.data.asArray()->push_back(smart_objects::SmartObject(60));
+ array_object.data.asArray()->push_back(smart_objects::SmartObject(70));
+
+ auto test_schema = PolicyDataItem(array_object.schema);
+ auto result = VehicleDataItemSchema::create(
+ test_schema, VehicleDataItemSchema::SchemaType::HMI);
+ EXPECT_EQ(ErrorCode::OK, result->validate(array_object.data, &report));
+ EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
+}
+
+TEST_F(VehicleDataItemSchemaTest, ValidateArray_FAIL) {
+ rpc::ValidationReport report("RPC");
+ VehicleDataTestObject array_object(key_number_++);
+ *array_object.schema.array = true;
+ array_object.schema.type = policy_table::VehicleDataItem::kInteger;
+ array_object.data =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ array_object.data.asArray()->push_back(smart_objects::SmartObject(10));
+ array_object.data.asArray()->push_back(smart_objects::SmartObject(20));
+ array_object.data.asArray()->push_back(smart_objects::SmartObject(30));
+
+ auto test_schema = PolicyDataItem(array_object.schema);
+ auto result = VehicleDataItemSchema::create(
+ test_schema, VehicleDataItemSchema::SchemaType::HMI);
+ EXPECT_NE(ErrorCode::OK, result->validate(array_object.data, &report));
+ EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
+}
+
+TEST_F(VehicleDataItemSchemaTest, ValidateUnknownType) {
+ rpc::ValidationReport report("RPC");
+
+ VehicleDataTestObject test_object_with_invalid_type(key_number_++);
+ // Set invalid name of type
+ test_object_with_invalid_type.schema.type = "omponentolumetatus";
+ test_object_with_invalid_type.data = TestEnumType::CVS_NORMAL;
+
+ auto test_schema = PolicyDataItem(test_object_with_invalid_type.schema);
+ auto result = VehicleDataItemSchema::create(
+ test_schema, VehicleDataItemSchema::SchemaType::HMI);
+ test_object_with_invalid_type.data = "CVS_NORMAL";
+ EXPECT_EQ(ErrorCode::OK,
+ result->validate(test_object_with_invalid_type.data, &report));
+ EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
+}
+
+} // namespace vehicle_info_plugin_test
diff --git a/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc b/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc
index 481635d8e6..691f8d3259 100644
--- a/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc
+++ b/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc
@@ -29,16 +29,15 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <iterator>
+#include "application_manager/app_launch/app_launch_ctrl_impl.h"
#include <algorithm>
+#include <iterator>
#include <utility>
#include <vector>
-#include "application_manager/app_launch/app_launch_ctrl_impl.h"
+#include "application_manager/application.h"
#include "application_manager/resumption/resume_ctrl.h"
#include "connection_handler/connection_handler.h"
-#include "application_manager/application.h"
#include "utils/timer_task_impl.h"
-#include "utils/make_shared.h"
namespace app_launch {
CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch")
@@ -60,7 +59,7 @@ void AppLaunchCtrlImpl::OnAppRegistered(
const application_manager::Application& app) {
LOG4CXX_AUTO_TRACE(logger_);
// TODO (AKutsan) : get device mac
- ApplicationDataPtr app_data = utils::MakeShared<ApplicationData>(
+ ApplicationDataPtr app_data = std::make_shared<ApplicationData>(
app.policy_app_id(), app.bundle_id(), app.mac_address());
apps_launcher_.OnLaunched(app_data);
app_launch_data_.AddApplicationData(*app_data);
diff --git a/src/components/application_manager/src/app_launch/app_launch_data_db.cc b/src/components/application_manager/src/app_launch/app_launch_data_db.cc
index f3adfc749b..a931b96fa1 100644
--- a/src/components/application_manager/src/app_launch/app_launch_data_db.cc
+++ b/src/components/application_manager/src/app_launch/app_launch_data_db.cc
@@ -29,15 +29,14 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include <unistd.h>
+#include <string>
#include "application_manager/app_launch/app_launch_data_db.h"
-#include "application_manager/application_manager_impl.h"
#include "application_manager/app_launch/app_launch_sql_queries.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/application_manager.h"
#include "application_manager/message_helper.h"
-#include "utils/make_shared.h"
+#include "application_manager/smart_object_keys.h"
namespace app_launch {
CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch")
@@ -276,7 +275,7 @@ std::vector<ApplicationDataPtr> AppLaunchDataDB::GetAppDataByDevMac(
const std::string device_mac = query.GetString(device_mac_index);
const std::string mobile_app_id = query.GetString(application_id_index);
const std::string bundle_id = query.GetString(bundle_id_index);
- dev_apps.push_back(utils::MakeShared<ApplicationData>(
+ dev_apps.push_back(std::make_shared<ApplicationData>(
mobile_app_id, bundle_id, device_mac));
} while (query.Next());
LOG4CXX_DEBUG(logger_, "All application data has been successfully loaded");
@@ -333,9 +332,9 @@ uint32_t AppLaunchDataDB::GetCurentNumberOfAppData() const {
"Values of ignition off counts were updated successfully");
number_of_app_data = query.GetInteger(result_query);
- LOG4CXX_DEBUG(logger_,
- "Total cout saved mobile applications is "
- << number_of_app_data);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Total cout saved mobile applications is " << number_of_app_data);
} else {
LOG4CXX_WARN(logger_,
"Failed execute query 'kGetNumberOfApplicationData'. Reson: "
@@ -384,7 +383,7 @@ bool AppLaunchDataDB::WriteDb() {
utils::dbms::SQLDatabase* AppLaunchDataDB::db() const {
#ifdef __QNX__
- std::auto_ptr<utils::dbms::SQLDatabase> db_qnx(
+ std::unique_ptr<utils::dbms::SQLDatabase> db_qnx(
new utils::dbms::SQLDatabase(kDatabaseName));
db_qnx.get()->Open();
return db_qnx.get();
@@ -393,4 +392,4 @@ utils::dbms::SQLDatabase* AppLaunchDataDB::db() const {
#endif // __QNX__
}
-} // namespace resumption
+} // namespace app_launch
diff --git a/src/components/application_manager/src/app_launch/app_launch_data_json.cc b/src/components/application_manager/src/app_launch/app_launch_data_json.cc
index 7599dcccb3..86d585f215 100644
--- a/src/components/application_manager/src/app_launch/app_launch_data_json.cc
+++ b/src/components/application_manager/src/app_launch/app_launch_data_json.cc
@@ -29,31 +29,30 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <algorithm>
#include "application_manager/app_launch/app_launch_data_json.h"
+#include <algorithm>
#include "application_manager/smart_object_keys.h"
+#include "json/json.h"
#include "smart_objects/smart_object.h"
-#include "utils/make_shared.h"
#include "utils/date_time.h"
-#include "json/json.h"
namespace app_launch {
CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch")
-AppLaunchDataJson::AppLaunchDataJson(const AppLaunchSettings& settings,
- resumption::LastState& last_state)
- : AppLaunchDataImpl(settings)
- , app_launch_json_lock_(true)
- , last_state_(last_state) {}
+AppLaunchDataJson::AppLaunchDataJson(
+ const AppLaunchSettings& settings,
+ resumption::LastStateWrapperPtr last_state_wrapper)
+ : AppLaunchDataImpl(settings), last_state_wrapper_(last_state_wrapper) {}
AppLaunchDataJson::~AppLaunchDataJson() {}
-Json::Value& AppLaunchDataJson::GetSavedApplicationDataList() const {
+Json::Value& AppLaunchDataJson::GetSavedApplicationDataList(
+ Json::Value& dictionary) const {
using namespace application_manager;
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock autolock(app_launch_json_lock_);
- Json::Value& app_launch = GetApplicationData();
+ Json::Value& app_launch = GetApplicationData(dictionary);
if (!app_launch.isMember(strings::app_launch_list)) {
app_launch[strings::app_launch_list] = Json::Value(Json::arrayValue);
LOG4CXX_WARN(logger_, "app_list section is missed");
@@ -66,11 +65,11 @@ Json::Value& AppLaunchDataJson::GetSavedApplicationDataList() const {
return app_launch_list;
}
-Json::Value& AppLaunchDataJson::GetApplicationData() const {
+Json::Value& AppLaunchDataJson::GetApplicationData(
+ Json::Value& dictionary) const {
using namespace application_manager;
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock autolock(app_launch_json_lock_);
- Json::Value& dictionary = last_state().get_dictionary();
if (!dictionary.isMember(strings::app_launch)) {
dictionary[strings::app_launch] = Json::Value(Json::objectValue);
LOG4CXX_WARN(logger_, "app_launch section is missed");
@@ -84,12 +83,14 @@ Json::Value& AppLaunchDataJson::GetApplicationData() const {
}
Json::Value& AppLaunchDataJson::GetApplicationListAndIndex(
- const ApplicationData& app_data, int32_t& founded_index) const {
+ const ApplicationData& app_data,
+ int32_t& found_index,
+ Json::Value& dictionary) const {
using namespace application_manager;
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock autolock(app_launch_json_lock_);
- Json::Value& apps_list = GetSavedApplicationDataList();
+ Json::Value& apps_list = GetSavedApplicationDataList(dictionary);
const Json::ArrayIndex size = apps_list.size();
for (Json::ArrayIndex idx = 0; idx != size; ++idx) {
@@ -105,7 +106,7 @@ Json::Value& AppLaunchDataJson::GetApplicationListAndIndex(
if (deviceID == app_data.device_mac_ && bundleID == app_data.bundle_id_ &&
appID == app_data.mobile_app_id_) {
- founded_index = idx;
+ found_index = idx;
}
}
}
@@ -118,7 +119,11 @@ bool AppLaunchDataJson::IsAppDataAlreadyExisted(
LOG4CXX_AUTO_TRACE(logger_);
int32_t index = NotFound;
- GetApplicationListAndIndex(app_data, index);
+
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ GetApplicationListAndIndex(app_data, index, dictionary);
+ accessor.GetMutableData().set_dictionary(dictionary);
return index == NotFound ? false : true;
}
@@ -129,14 +134,18 @@ bool AppLaunchDataJson::RefreshAppSessionTime(const ApplicationData& app_data) {
bool retVal = false;
int32_t index = NotFound;
- Json::Value& json_data_list = GetApplicationListAndIndex(app_data, index);
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& json_data_list =
+ GetApplicationListAndIndex(app_data, index, dictionary);
if (index != NotFound) {
if (json_data_list.empty() == false) {
json_data_list[index][strings::app_launch_last_session] =
- static_cast<Json::Value::UInt64>(DateTime::getCurrentTime().tv_sec);
+ static_cast<Json::Value::UInt64>(getSecs(getCurrentTime()));
retVal = true;
}
}
+ accessor.GetMutableData().set_dictionary(dictionary);
return retVal;
}
@@ -146,20 +155,22 @@ bool AppLaunchDataJson::AddNewAppData(const ApplicationData& app_data) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock autolock(app_launch_json_lock_);
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
Json::Value& json_app_data =
- GetSavedApplicationDataList().append(Json::Value());
+ GetSavedApplicationDataList(dictionary).append(Json::Value());
json_app_data[strings::device_id] = app_data.device_mac_;
json_app_data[strings::app_id] = app_data.mobile_app_id_;
json_app_data[strings::bundle_id] = app_data.bundle_id_;
json_app_data[strings::app_launch_last_session] =
- static_cast<Json::Value::UInt64>(DateTime::getCurrentTime().tv_sec);
+ static_cast<Json::Value::UInt64>(getSecs(getCurrentTime()));
+ accessor.GetMutableData().set_dictionary(dictionary);
LOG4CXX_DEBUG(logger_,
"New application data saved. Detatils device_id: "
<< app_data.device_mac_
<< ", app_id: " << app_data.mobile_app_id_
<< ", bundle_id: " << app_data.bundle_id_ << ".");
-
return true;
}
@@ -169,7 +180,9 @@ std::vector<ApplicationDataPtr> AppLaunchDataJson::GetAppDataByDevMac(
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock autolock(app_launch_json_lock_);
std::vector<ApplicationDataPtr> dev_apps;
- const Json::Value& apps_list = GetSavedApplicationDataList();
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ const Json::Value& apps_list = GetSavedApplicationDataList(dictionary);
const Json::ArrayIndex size = apps_list.size();
for (Json::ArrayIndex idx = 0; idx != size; ++idx) {
@@ -185,19 +198,20 @@ std::vector<ApplicationDataPtr> AppLaunchDataJson::GetAppDataByDevMac(
if (deviceMac == dev_mac) {
dev_apps.push_back(
- utils::MakeShared<ApplicationData>(appID, bundleID, deviceMac));
+ std::make_shared<ApplicationData>(appID, bundleID, deviceMac));
}
}
}
-
+ accessor.GetMutableData().set_dictionary(dictionary);
return dev_apps;
}
bool AppLaunchDataJson::Clear() {
LOG4CXX_AUTO_TRACE(logger_);
-
- GetSavedApplicationDataList().clear();
-
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ GetSavedApplicationDataList(dictionary).clear();
+ accessor.GetMutableData().set_dictionary(dictionary);
LOG4CXX_DEBUG(logger_,
"Application launch JSON section successfully cleared.");
@@ -206,9 +220,10 @@ bool AppLaunchDataJson::Clear() {
uint32_t AppLaunchDataJson::GetCurentNumberOfAppData() const {
LOG4CXX_AUTO_TRACE(logger_);
-
- uint32_t list_size = GetSavedApplicationDataList().size();
-
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ const uint32_t list_size = GetSavedApplicationDataList(dictionary).size();
+ accessor.GetMutableData().set_dictionary(dictionary);
LOG4CXX_DEBUG(logger_,
"Successfully was gotten app_launch list. Size: " << list_size);
@@ -221,7 +236,9 @@ bool AppLaunchDataJson::DeleteOldestAppData() {
sync_primitives::AutoLock autolock(app_launch_json_lock_);
std::vector<uint64_t> temp_array;
std::vector<Json::Value> temp_json_list;
- Json::Value& apps_list = GetSavedApplicationDataList();
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& apps_list = GetSavedApplicationDataList(dictionary);
const Json::ArrayIndex size = apps_list.size();
// Search oldest record in Json
@@ -243,9 +260,7 @@ bool AppLaunchDataJson::DeleteOldestAppData() {
// Copy in temporary vector Json list without oldest record
int32_t i = 0;
- for (Json::Value::iterator it = GetSavedApplicationDataList().begin();
- it != GetSavedApplicationDataList().end();
- ++it, i++) {
+ for (auto it = apps_list.begin(); it != apps_list.end(); ++it, i++) {
if ((*it).isMember(strings::device_id) &&
(*it).isMember(strings::bundle_id) && (*it).isMember(strings::app_id) &&
(*it).isMember(strings::app_launch_last_session)) {
@@ -257,15 +272,13 @@ bool AppLaunchDataJson::DeleteOldestAppData() {
}
// Clear Json list
- GetSavedApplicationDataList().clear();
+ GetSavedApplicationDataList(dictionary).clear();
// Copy to Json new list without oldest one
- for (std::vector<Json::Value>::iterator it = temp_json_list.begin();
- it != temp_json_list.end();
- ++it) {
- GetSavedApplicationDataList().append((*it));
+ for (const auto& item : temp_json_list) {
+ GetSavedApplicationDataList(dictionary).append(item);
}
-
+ accessor.GetMutableData().set_dictionary(dictionary);
LOG4CXX_DEBUG(
logger_, "Oldest application launch data had been successfully deleted.");
@@ -274,9 +287,8 @@ bool AppLaunchDataJson::DeleteOldestAppData() {
bool AppLaunchDataJson::Persist() {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(app_launch_json_lock_);
- last_state().SaveStateToFileSystem();
+ last_state_wrapper_->get_accessor().GetMutableData().SaveToFileSystem();
return true;
}
-} // app_launch
+} // namespace app_launch
diff --git a/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc b/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc
index cc4765e6c9..7a9402d35e 100644
--- a/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc
+++ b/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc
@@ -75,4 +75,4 @@ const std::string kRefreshApplicationDataSessionTime =
"SET `last_session` = STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')"
"WHERE `deviceMac` = ? AND appID = ? AND bundleID = ?;";
-} // namespace resumption
+} // namespace app_launch
diff --git a/src/components/application_manager/src/app_launch/apps_launcher.cc b/src/components/application_manager/src/app_launch/apps_launcher.cc
index bf3ce1e0a9..993a57364e 100644
--- a/src/components/application_manager/src/app_launch/apps_launcher.cc
+++ b/src/components/application_manager/src/app_launch/apps_launcher.cc
@@ -1,8 +1,8 @@
-#include <algorithm>
#include "application_manager/app_launch/apps_launcher.h"
-#include "utils/make_shared.h"
-#include "utils/timer_task_impl.h"
+#include <algorithm>
+
#include <iostream>
+#include "utils/timer_task_impl.h"
namespace app_launch {
struct LauncherGenerator {
@@ -15,7 +15,7 @@ struct LauncherGenerator {
, app_launch_max_retry_attempt_(app_launch_max_retry_attempt)
, app_launch_retry_wait_time_(app_launch_retry_wait_time) {}
AppsLauncher::LauncherPtr operator()() {
- return utils::MakeShared<AppsLauncher::Launcher>(
+ return std::make_shared<AppsLauncher::Launcher>(
apps_laucnher_,
connection_handler_,
app_launch_max_retry_attempt_,
diff --git a/src/components/application_manager/src/app_launch/device_apps_launcher.cc b/src/components/application_manager/src/app_launch/device_apps_launcher.cc
index 0eb9245cf8..9a7a6658fe 100644
--- a/src/components/application_manager/src/app_launch/device_apps_launcher.cc
+++ b/src/components/application_manager/src/app_launch/device_apps_launcher.cc
@@ -1,22 +1,21 @@
+#include <algorithm>
#include <string>
#include <vector>
-#include <algorithm>
-#include "application_manager/app_launch/device_apps_launcher.h"
#include "application_manager/app_launch/app_launch_data.h"
#include "application_manager/app_launch/apps_launcher.h"
+#include "application_manager/app_launch/device_apps_launcher.h"
#include "application_manager/resumption/resume_ctrl.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
+
+#include <iostream>
#include "utils/timer.h"
#include "utils/timer_task_impl.h"
-#include <iostream>
namespace app_launch {
CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch")
typedef std::pair<std::string, std::vector<ApplicationDataPtr> > AppsOnDevice;
-typedef utils::SharedPtr<AppsOnDevice> AppsOnDevicePtr;
+typedef std::shared_ptr<AppsOnDevice> AppsOnDevicePtr;
class Launcher {
public:
@@ -59,9 +58,9 @@ class Launcher {
device_launcher_.settings().wait_time_between_apps(),
timer::kSingleShot);
} else {
- LOG4CXX_DEBUG(logger_,
- "All Apps on " << apps_on_device_->first
- << " posponed launched");
+ LOG4CXX_DEBUG(
+ logger_,
+ "All Apps on " << apps_on_device_->first << " postponed launched");
device_launcher_.StopLaunchingAppsOnDevice(apps_on_device_->first);
}
}
@@ -95,7 +94,7 @@ class Launcher {
AppsOnDevicePtr apps_on_device_;
};
-typedef utils::SharedPtr<Launcher> LauncherPtr;
+typedef std::shared_ptr<Launcher> LauncherPtr;
typedef std::vector<LauncherPtr> Launchers;
struct LauncherGenerator {
@@ -107,8 +106,7 @@ struct LauncherGenerator {
, apps_launcher_(apps_launcher) {}
LauncherPtr operator()() const {
- return utils::MakeShared<Launcher>(
- resume_ctrl_, interface_, apps_launcher_);
+ return std::make_shared<Launcher>(resume_ctrl_, interface_, apps_launcher_);
}
resumption::ResumeCtrl& resume_ctrl_;
@@ -116,71 +114,59 @@ struct LauncherGenerator {
AppsLauncher& apps_launcher_;
};
-class DeviceAppsLauncherImpl {
- public:
- DeviceAppsLauncherImpl(DeviceAppsLauncher& interface,
- AppsLauncher& apps_launcher)
- : interface_(interface) {
- sync_primitives::AutoLock lock(launchers_lock_);
- LauncherGenerator generate(
- interface.app_mngr_.resume_controller(), interface, apps_launcher);
- free_launchers_.reserve(interface.settings_.max_number_of_ios_device());
- std::generate_n(std::back_inserter(free_launchers_),
- interface.settings_.max_number_of_ios_device(),
- generate);
- }
-
- bool LaunchAppsOnDevice(
- const std::string& device_mac,
- const std::vector<ApplicationDataPtr>& applications_to_launch) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "On Device " << device_mac << " will be launched "
- << applications_to_launch.size() << " apps");
- AppsOnDevicePtr apps_on_device =
- utils::MakeShared<AppsOnDevice>(device_mac, applications_to_launch);
- sync_primitives::AutoLock lock(launchers_lock_);
- DCHECK_OR_RETURN(!free_launchers_.empty(), false)
- const Launchers::iterator it = free_launchers_.begin();
- LauncherPtr launcher = *it;
- works_launchers_.push_back(launcher);
- free_launchers_.erase(it);
- launcher->Start(apps_on_device);
- return true;
- }
+// DeviceAppsLauncherImpl member function definitions
+DeviceAppsLauncherImpl::DeviceAppsLauncherImpl(DeviceAppsLauncher& interface,
+ AppsLauncher& apps_launcher)
+ : interface_(interface) {
+ sync_primitives::AutoLock lock(launchers_lock_);
+ LauncherGenerator generate(
+ interface.app_mngr_.resume_controller(), interface, apps_launcher);
+ free_launchers_.reserve(interface.settings_.max_number_of_ios_device());
+ std::generate_n(std::back_inserter(free_launchers_),
+ interface.settings_.max_number_of_ios_device(),
+ generate);
+}
- struct LauncherFinder {
- LauncherFinder(const std::string& device_mac) : device_mac_(device_mac) {}
+bool DeviceAppsLauncherImpl::LauncherFinder::operator()(
+ const std::shared_ptr<Launcher>& launcher) const {
+ return device_mac_ == launcher->apps_on_device_->first;
+}
- bool operator()(const LauncherPtr& launcher) const {
- return device_mac_ == launcher->apps_on_device_->first;
- }
+bool DeviceAppsLauncherImpl::LaunchAppsOnDevice(
+ const std::string& device_mac,
+ const std::vector<ApplicationDataPtr>& applications_to_launch) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "On Device " << device_mac << " will be launched "
+ << applications_to_launch.size() << " apps");
+ AppsOnDevicePtr apps_on_device =
+ std::make_shared<AppsOnDevice>(device_mac, applications_to_launch);
+ sync_primitives::AutoLock lock(launchers_lock_);
+ DCHECK_OR_RETURN(!free_launchers_.empty(), false)
+ const Launchers::iterator it = free_launchers_.begin();
+ LauncherPtr launcher = *it;
+ works_launchers_.push_back(launcher);
+ free_launchers_.erase(it);
+ launcher->Start(apps_on_device);
+ return true;
+}
- std::string device_mac_;
- };
-
- bool StopLaunchingAppsOnDevice(const std::string& device_mac) {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock lock(launchers_lock_);
- const Launchers::iterator it = std::find_if(works_launchers_.begin(),
- works_launchers_.end(),
- LauncherFinder(device_mac));
- if (it == works_launchers_.end()) {
- return false;
- }
- LauncherPtr launcher = *it;
- launcher->Clear();
- free_launchers_.push_back(launcher);
- works_launchers_.erase(it);
- return true;
+bool DeviceAppsLauncherImpl::StopLaunchingAppsOnDevice(
+ const std::string& device_mac) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(launchers_lock_);
+ const Launchers::iterator it = std::find_if(works_launchers_.begin(),
+ works_launchers_.end(),
+ LauncherFinder(device_mac));
+ if (it == works_launchers_.end()) {
+ return false;
}
-
- private:
- sync_primitives::Lock launchers_lock_;
- Launchers free_launchers_;
- Launchers works_launchers_;
- DeviceAppsLauncher& interface_;
-};
+ LauncherPtr launcher = *it;
+ launcher->Clear();
+ free_launchers_.push_back(launcher);
+ works_launchers_.erase(it);
+ return true;
+}
bool DeviceAppsLauncher::LaunchAppsOnDevice(
const std::string& device_mac,
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc
new file mode 100644
index 0000000000..3e7b4b99fe
--- /dev/null
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -0,0 +1,651 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/app_service_manager.h"
+
+#include <algorithm>
+#include <iterator>
+
+#include "application_manager/application.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "encryption/hashing.h"
+#include "resumption/last_state.h"
+#include "smart_objects/enum_schema_item.h"
+#include "utils/logger.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceManager")
+
+namespace application_manager {
+
+const char* kAppServiceSection = "AppServices";
+const char* kDefaults = "defaults";
+
+AppServiceManager::AppServiceManager(ApplicationManager& app_manager,
+ resumption::LastStateWrapperPtr last_state)
+ : app_manager_(app_manager)
+ , last_state_(last_state)
+ , rpc_passing_handler_(*this, app_manager_) {}
+
+AppServiceManager::~AppServiceManager() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+smart_objects::SmartObject AppServiceManager::PublishAppService(
+ const smart_objects::SmartObject& manifest,
+ const bool mobile_service,
+ const uint32_t connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::string str_to_hash = "";
+ std::string service_id = "";
+
+ std::string service_type = manifest[strings::service_type].asString();
+
+ AppService* found_service =
+ FindServiceByProvider(connection_key, service_type);
+ if (found_service) {
+ // Check if there is a different existing service with the same updated
+ // name.
+ if (manifest.keyExists(strings::service_name)) {
+ auto service_by_name =
+ FindServiceByName(manifest[strings::service_name].asString());
+ if (service_by_name) {
+ auto service_by_name_id =
+ service_by_name->record[strings::service_id].asString();
+ auto found_service_id =
+ found_service->record[strings::service_id].asString();
+ if (service_by_name_id != found_service_id) {
+ LOG4CXX_WARN(logger_,
+ "A service already exists with this name, rejecting");
+ return smart_objects::SmartObject();
+ }
+ }
+ }
+ LOG4CXX_WARN(logger_, "Service already exists for this provider, updating");
+ published_services_lock_.Acquire();
+ found_service->record[strings::service_manifest] = manifest;
+ found_service->record[strings::service_published] = true;
+ smart_objects::SmartObject updated_service_record = found_service->record;
+ published_services_lock_.Release();
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+
+ AppServiceUpdated(updated_service_record,
+ mobile_apis::ServiceUpdateReason::MANIFEST_UPDATE,
+ msg_params);
+
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+
+ return updated_service_record;
+ }
+
+ if (manifest.keyExists(strings::service_name) &&
+ FindServiceByName(manifest[strings::service_name].asString())) {
+ LOG4CXX_WARN(logger_, "A service already exists with this name, rejecting");
+ return smart_objects::SmartObject();
+ }
+
+ published_services_lock_.Acquire();
+ do {
+ str_to_hash = manifest[strings::service_type].asString() +
+ std::to_string(std::rand());
+ service_id = encryption::MakeHash(str_to_hash);
+ } while (published_services_.find(service_id) != published_services_.end());
+
+ AppService app_service;
+ app_service.connection_key = connection_key;
+ app_service.mobile_service = mobile_service;
+
+ smart_objects::SmartObject service_record;
+ service_record[strings::service_manifest] = manifest;
+ service_record[strings::service_id] = service_id;
+ service_record[strings::service_published] = true;
+ service_record[strings::service_active] = false;
+ app_service.record = service_record;
+
+ std::string default_app_id = DefaultServiceByType(service_type);
+ if (default_app_id.empty() && !mobile_service) {
+ auto embedded_services = app_manager_.get_settings().embedded_services();
+ for (const auto& embedded_service : embedded_services) {
+ if (embedded_service == service_type) {
+ auto last_state_accessor = last_state_->get_accessor();
+ Json::Value dictionary = last_state_accessor.GetData().dictionary();
+ dictionary[kAppServiceSection][kDefaults][service_type] =
+ kEmbeddedService;
+ default_app_id = kEmbeddedService;
+ last_state_accessor.GetMutableData().set_dictionary(dictionary);
+ }
+ }
+ }
+ app_service.default_service =
+ !default_app_id.empty() && GetPolicyAppID(app_service) == default_app_id;
+
+ auto ret = published_services_.insert(
+ std::pair<std::string, AppService>(service_id, app_service));
+ smart_objects::SmartObject& published_record = ret.first->second.record;
+ published_services_lock_.Release();
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+ AppServiceUpdated(
+ service_record, mobile_apis::ServiceUpdateReason::PUBLISHED, msg_params);
+
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+
+ // Activate the new service if it is the default for its service type, if
+ // no service is active of its service type, or it is a mobile app in full.
+ AppService* active_service = ActiveServiceForType(service_type);
+ ApplicationSharedPtr app = NULL;
+ if (mobile_service && connection_key) {
+ app = app_manager_.application(connection_key);
+ }
+
+ if (!active_service || app_service.default_service ||
+ (app && app->IsFullscreen())) {
+ ActivateAppService(service_id);
+ }
+
+ return published_record;
+}
+
+bool AppServiceManager::UnpublishAppService(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ return false;
+ }
+ LOG4CXX_DEBUG(logger_, "Unpublishing app service: " << service_id);
+
+ SetServicePublished(service_id, false);
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+
+ auto& record = it->second.record;
+ if (record[strings::service_active].asBool()) {
+ record[strings::service_active] = false;
+
+ // Activate embedded service, if available
+ auto embedded_service = EmbeddedServiceForType(
+ record[strings::service_manifest][strings::service_type].asString());
+ if (embedded_service &&
+ (embedded_service->record[strings::service_id].asString() !=
+ service_id)) {
+ embedded_service->record[strings::service_active] = true;
+ AppServiceUpdated(embedded_service->record,
+ mobile_apis::ServiceUpdateReason::ACTIVATED,
+ msg_params);
+ }
+ }
+ AppServiceUpdated(
+ record, mobile_apis::ServiceUpdateReason::REMOVED, msg_params);
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+ published_services_.erase(it);
+
+ return true;
+}
+
+void AppServiceManager::UnpublishServices(const uint32_t connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Unpublishing all app services: " << connection_key);
+
+ std::list<std::string> app_published_services;
+ {
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ if (it->second.connection_key == connection_key) {
+ app_published_services.push_back(it->first);
+ }
+ }
+ }
+
+ for (auto& service_id : app_published_services) {
+ UnpublishAppService(service_id);
+ }
+}
+
+void AppServiceManager::OnAppActivated(ApplicationConstSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.begin();
+ // Activate all services published by the app
+ for (; it != published_services_.end(); ++it) {
+ if (it->second.connection_key == app->app_id()) {
+ ActivateAppService(it->first);
+ }
+ }
+}
+
+std::vector<smart_objects::SmartObject>
+AppServiceManager::GetAllServiceRecords() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<smart_objects::SmartObject> services;
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ services.push_back(it->second.record);
+ }
+ return services;
+}
+
+void AppServiceManager::GetProviderByType(const std::string& service_type,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto active_service = ActiveServiceForType(service_type);
+ if (!active_service) {
+ LOG4CXX_ERROR(logger_,
+ "There is no active service for the given service type: "
+ << service_type);
+ return;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Found provider for service type: " << service_type);
+ GetProviderFromService(*active_service, mobile_consumer, app, hmi_service);
+}
+
+void AppServiceManager::GetProviderByID(const std::string& service_id,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ return;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Found provider with service ID: " << service_id);
+ GetProviderFromService(it->second, mobile_consumer, app, hmi_service);
+}
+
+void AppServiceManager::GetProviderFromService(const AppService& service,
+ const bool mobile_consumer,
+ ApplicationSharedPtr& app,
+ bool& hmi_service) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (mobile_consumer &&
+ !service.record[strings::service_manifest][strings::allow_app_consumers]
+ .asBool()) {
+ LOG4CXX_ERROR(logger_, "Service does not support app consumers");
+ return;
+ }
+ bool mobile_service = service.mobile_service;
+ if (mobile_service) {
+ app = app_manager_.application(service.connection_key);
+ hmi_service = false;
+ return;
+ }
+ hmi_service = true;
+}
+
+bool AppServiceManager::SetDefaultService(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ return false;
+ }
+ AppService& service = it->second;
+
+ std::string service_type =
+ service.record[strings::service_manifest][strings::service_type]
+ .asString();
+ std::string default_app_id = DefaultServiceByType(service_type);
+ if (!default_app_id.empty()) {
+ auto default_service =
+ FindServiceByPolicyAppID(default_app_id, service_type);
+ if (default_service) {
+ default_service->default_service = false;
+ }
+ }
+ service.default_service = true;
+
+ auto last_state_accessor = last_state_->get_accessor();
+ Json::Value dictionary = last_state_accessor.GetData().dictionary();
+ dictionary[kAppServiceSection][kDefaults][service_type] =
+ GetPolicyAppID(service);
+ last_state_accessor.GetMutableData().set_dictionary(dictionary);
+ return true;
+}
+
+bool AppServiceManager::RemoveDefaultService(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ return false;
+ }
+
+ AppService& service = it->second;
+ if (!service.default_service) {
+ LOG4CXX_ERROR(logger_, "Service was not default " << service_id);
+ return false;
+ }
+ service.default_service = false;
+
+ std::string service_type =
+ service.record[strings::service_manifest][strings::service_type]
+ .asString();
+
+ auto last_state_accessor = last_state_->get_accessor();
+ Json::Value dictionary = last_state_accessor.GetData().dictionary();
+ dictionary[kAppServiceSection][kDefaults].removeMember(service_type);
+ last_state_accessor.GetMutableData().set_dictionary(dictionary);
+ return true;
+}
+
+bool AppServiceManager::ActivateAppService(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ return false;
+ }
+
+ smart_objects::SmartObject& service = it->second.record;
+ if (service[strings::service_active].asBool()) {
+ LOG4CXX_DEBUG(logger_, "Service was already active " << service_id);
+ return true;
+ }
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+
+ const std::string service_type =
+ service[strings::service_manifest][strings::service_type].asString();
+ auto active_service = ActiveServiceForType(service_type);
+ if (active_service) {
+ active_service->record[strings::service_active] = false;
+ AppServiceUpdated(active_service->record,
+ mobile_apis::ServiceUpdateReason::DEACTIVATED,
+ msg_params);
+ }
+ service[strings::service_active] = true;
+ AppServiceUpdated(
+ service, mobile_apis::ServiceUpdateReason::ACTIVATED, msg_params);
+
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+
+ std::string navi_service_type;
+ ns_smart_device_link::ns_smart_objects::
+ EnumConversionHelper<mobile_apis::AppServiceType::eType>::EnumToString(
+ mobile_apis::AppServiceType::NAVIGATION, &navi_service_type);
+ if (service_type == navi_service_type) {
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::NAVIGATION;
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+ }
+ return true;
+}
+
+bool AppServiceManager::DeactivateAppService(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Unable to find published service " << service_id);
+ return false;
+ }
+ smart_objects::SmartObject& service = it->second.record;
+ smart_objects::SmartObject msg_params;
+ bool send_update = false;
+
+ if (service[strings::service_active].asBool()) {
+ service[strings::service_active] = false;
+ AppServiceUpdated(
+ service, mobile_apis::ServiceUpdateReason::DEACTIVATED, msg_params);
+
+ // Activate embedded service, if available
+ const std::string service_type =
+ service[strings::service_manifest][strings::service_type].asString();
+ auto embedded_service = EmbeddedServiceForType(service_type);
+ if (embedded_service &&
+ embedded_service->record[strings::service_id].asString() !=
+ service_id) {
+ embedded_service->record[strings::service_active] = true;
+ AppServiceUpdated(embedded_service->record,
+ mobile_apis::ServiceUpdateReason::ACTIVATED,
+ msg_params);
+ }
+ send_update = true;
+ }
+
+ if (send_update) {
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+ }
+ return true;
+}
+
+AppService* AppServiceManager::ActiveServiceForType(
+ const std::string service_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ if (it->second.record[strings::service_manifest][strings::service_type]
+ .asString() == service_type &&
+ it->second.record[strings::service_published].asBool() &&
+ it->second.record[strings::service_active].asBool()) {
+ return &(it->second);
+ }
+ }
+ return NULL;
+}
+
+AppService* AppServiceManager::EmbeddedServiceForType(
+ const std::string service_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ if (it->second.record[strings::service_manifest][strings::service_type]
+ .asString() == service_type &&
+ !it->second.mobile_service) {
+ return &(it->second);
+ }
+ }
+ return NULL;
+}
+
+AppService* AppServiceManager::FindServiceByPolicyAppID(
+ const std::string policy_app_id, const std::string type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ if (it->second.record[strings::service_manifest][strings::service_type]
+ .asString() != type) {
+ continue;
+ }
+
+ if (policy_app_id == GetPolicyAppID(it->second)) {
+ return &(it->second);
+ }
+ }
+ return NULL;
+}
+
+AppService* AppServiceManager::FindServiceByID(const std::string service_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ return NULL;
+ }
+ return &(it->second);
+}
+
+AppService* AppServiceManager::FindServiceByProvider(
+ const uint32_t connection_key, const std::string service_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto& service : published_services_) {
+ if (service.second.connection_key == connection_key &&
+ service.second.record[strings::service_manifest][strings::service_type]
+ .asString() == service_type) {
+ return &(service.second);
+ }
+ }
+ return NULL;
+}
+
+AppService* AppServiceManager::FindServiceByName(std::string name) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ for (auto& service : published_services_) {
+ if (service.second.record[strings::service_manifest][strings::service_name]
+ .asString() == name) {
+ return &(service.second);
+ }
+ }
+ return NULL;
+}
+
+std::string AppServiceManager::DefaultServiceByType(
+ const std::string service_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto last_state_accessor = last_state_->get_accessor();
+ Json::Value dictionary = last_state_accessor.GetData().dictionary();
+ if (dictionary[kAppServiceSection][kDefaults].isMember(service_type)) {
+ return dictionary[kAppServiceSection][kDefaults][service_type].asString();
+ }
+ return std::string();
+}
+
+void AppServiceManager::SetServicePublished(const std::string service_id,
+ const bool service_published) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(published_services_lock_);
+ auto it = published_services_.find(service_id);
+ if (it == published_services_.end()) {
+ LOG4CXX_ERROR(logger_, "Service id does not exist in published services");
+ return;
+ }
+ it->second.record[strings::service_published] = service_published;
+}
+
+std::string AppServiceManager::GetPolicyAppID(AppService service) {
+ if (service.mobile_service) {
+ auto app = app_manager_.application(service.connection_key);
+ return app ? app->policy_app_id() : std::string();
+ }
+ return kEmbeddedService;
+}
+
+bool AppServiceManager::UpdateNavigationCapabilities(
+ smart_objects::SmartObject& out_params) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::string navi_service_type;
+ ns_smart_device_link::ns_smart_objects::
+ EnumConversionHelper<mobile_apis::AppServiceType::eType>::EnumToString(
+ mobile_apis::AppServiceType::NAVIGATION, &navi_service_type);
+ auto service = ActiveServiceForType(navi_service_type);
+ if (!service) {
+ return false;
+ }
+
+ if (!out_params.keyExists(strings::send_location_enabled)) {
+ out_params[strings::send_location_enabled] = false;
+ }
+ if (!out_params.keyExists(strings::get_way_points_enabled)) {
+ out_params[strings::get_way_points_enabled] = false;
+ }
+
+ if (!service->record[strings::service_manifest].keyExists(
+ strings::handled_rpcs)) {
+ return true;
+ }
+
+ smart_objects::SmartObject& handled_rpcs =
+ service->record[strings::service_manifest][strings::handled_rpcs];
+ for (size_t i = 0; i < handled_rpcs.length(); ++i) {
+ if (handled_rpcs[i].asInt() == mobile_apis::FunctionID::SendLocationID) {
+ out_params[strings::send_location_enabled] = true;
+ } else if (handled_rpcs[i].asInt() ==
+ mobile_apis::FunctionID::GetWayPointsID) {
+ out_params[strings::get_way_points_enabled] = true;
+ }
+ }
+ return true;
+}
+
+void AppServiceManager::AppServiceUpdated(
+ const smart_objects::SmartObject& service_record,
+ const mobile_apis::ServiceUpdateReason::eType update_reason,
+ smart_objects::SmartObject& msg_params) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject& services =
+ msg_params[strings::system_capability][strings::app_services_capabilities]
+ [strings::app_services];
+ smart_objects::SmartObject service(smart_objects::SmartType_Map);
+ service[strings::update_reason] = update_reason;
+ service[strings::updated_app_service_record] = service_record;
+ services[-1] = service;
+}
+
+std::vector<AppService> AppServiceManager::GetActiveServices() {
+ std::vector<AppService> active_services;
+ for (auto it = published_services_.begin(); it != published_services_.end();
+ ++it) {
+ if (it->second.record[strings::service_active].asBool()) {
+ active_services.push_back(it->second);
+ }
+ }
+ return active_services;
+}
+
+RPCPassingHandler& AppServiceManager::GetRPCPassingHandler() {
+ return rpc_passing_handler_;
+}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc
index f271b7ff6a..25fc60f3d9 100644
--- a/src/components/application_manager/src/application_data_impl.cc
+++ b/src/components/application_manager/src/application_data_impl.cc
@@ -39,6 +39,25 @@
namespace application_manager {
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+namespace {
+struct CommandIdComparator {
+ CommandIdComparator(const std::string& key, const uint32_t id)
+ : key_(key), target_id_(id) {}
+
+ bool operator()(const CommandsMap::value_type& new_command) const {
+ smart_objects::SmartObject& command = *(new_command.second);
+ if (command.keyExists(key_)) {
+ return command[key_].asUInt() == target_id_;
+ }
+ return false;
+ }
+
+ private:
+ std::string key_;
+ uint32_t target_id_;
+};
+} // namespace
+
InitialApplicationDataImpl::InitialApplicationDataImpl()
: app_types_(NULL)
, vr_synonyms_(NULL)
@@ -103,6 +122,10 @@ const mobile_api::Language::eType& InitialApplicationDataImpl::ui_language()
return ui_language_;
}
+const utils::SemanticVersion& InitialApplicationDataImpl::msg_version() const {
+ return msg_version_;
+}
+
void InitialApplicationDataImpl::set_app_types(
const smart_objects::SmartObject& app_types) {
if (app_types_) {
@@ -153,6 +176,11 @@ void InitialApplicationDataImpl::set_ui_language(
ui_language_ = ui_language;
}
+void InitialApplicationDataImpl::set_msg_version(
+ const utils::SemanticVersion& version) {
+ msg_version_ = version;
+}
+
void InitialApplicationDataImpl::set_perform_interaction_layout(
mobile_apis::LayoutMode::eType layout) {
perform_interaction_layout_ = layout;
@@ -164,30 +192,31 @@ InitialApplicationDataImpl::perform_interaction_layout() const {
}
DynamicApplicationDataImpl::DynamicApplicationDataImpl()
- : help_prompt_(NULL)
- , timeout_prompt_(NULL)
- , vr_help_title_(NULL)
- , vr_help_(NULL)
+ : help_prompt_(nullptr)
+ , timeout_prompt_(nullptr)
+ , vr_help_title_(nullptr)
+ , vr_help_(nullptr)
, tbt_state_(mobile_api::TBTState::INVALID_ENUM)
- , show_command_(NULL)
- , keyboard_props_(NULL)
- , menu_title_(NULL)
- , menu_icon_(NULL)
- , tbt_show_command_(NULL)
- , day_color_scheme_(NULL)
- , night_color_scheme_(NULL)
- , display_layout_("")
+ , show_command_(nullptr)
+ , keyboard_props_(nullptr)
+ , menu_title_(nullptr)
+ , menu_icon_(nullptr)
+ , tbt_show_command_(nullptr)
, commands_()
- , commands_lock_ptr_(new sync_primitives::Lock(true))
+ , commands_lock_ptr_(std::make_shared<sync_primitives::RecursiveLock>())
, sub_menu_()
, sub_menu_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, choice_set_map_()
, choice_set_map_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, performinteraction_choice_set_map_()
- , performinteraction_choice_set_lock_ptr_(new sync_primitives::Lock(true))
+ , performinteraction_choice_set_lock_ptr_(
+ std::make_shared<sync_primitives::RecursiveLock>())
+ , window_params_map_()
+ , window_params_map_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, is_perform_interaction_active_(false)
, is_reset_global_properties_active_(false)
- , perform_interaction_mode_(-1) {}
+ , perform_interaction_mode_(-1)
+ , display_capabilities_builder_(*this) {}
DynamicApplicationDataImpl::~DynamicApplicationDataImpl() {
if (help_prompt_) {
@@ -220,16 +249,6 @@ DynamicApplicationDataImpl::~DynamicApplicationDataImpl() {
tbt_show_command_ = NULL;
}
- if (day_color_scheme_) {
- delete day_color_scheme_;
- day_color_scheme_ = NULL;
- }
-
- if (night_color_scheme_) {
- delete night_color_scheme_;
- night_color_scheme_ = NULL;
- }
-
for (CommandsMap::iterator command_it = commands_.begin();
commands_.end() != command_it;
++command_it) {
@@ -255,6 +274,8 @@ DynamicApplicationDataImpl::~DynamicApplicationDataImpl() {
performinteraction_choice_set_map_[it->first].clear();
}
performinteraction_choice_set_map_.clear();
+
+ window_params_map_.clear();
}
const smart_objects::SmartObject* DynamicApplicationDataImpl::help_prompt()
@@ -306,18 +327,93 @@ const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_icon()
return menu_icon_;
}
-const smart_objects::SmartObject* DynamicApplicationDataImpl::day_color_scheme()
+smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme()
const {
- return day_color_scheme_;
+ using namespace mobile_apis::PredefinedWindows;
+ auto default_window_it = window_templates_.find(DEFAULT_WINDOW);
+
+ if (window_templates_.end() != default_window_it) {
+ const smart_objects::SmartObject template_config =
+ default_window_it->second;
+ if (template_config.keyExists(strings::day_color_scheme)) {
+ return template_config[strings::day_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
}
-const smart_objects::SmartObject*
-DynamicApplicationDataImpl::night_color_scheme() const {
- return night_color_scheme_;
+smart_objects::SmartObject DynamicApplicationDataImpl::night_color_scheme()
+ const {
+ using namespace mobile_apis::PredefinedWindows;
+ auto default_window_it = window_templates_.find(DEFAULT_WINDOW);
+
+ if (window_templates_.end() != default_window_it) {
+ const smart_objects::SmartObject template_config =
+ default_window_it->second;
+ if (template_config.keyExists(strings::night_color_scheme)) {
+ return template_config[strings::night_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
+}
+
+std::string DynamicApplicationDataImpl::display_layout() const {
+ using namespace mobile_apis::PredefinedWindows;
+ auto default_window_it = window_templates_.find(DEFAULT_WINDOW);
+
+ if (window_templates_.end() != default_window_it) {
+ smart_objects::SmartObject template_config = default_window_it->second;
+ if (template_config.keyExists(strings::template_layout)) {
+ return template_config[strings::template_layout].asString();
+ }
+ }
+
+ return std::string();
}
-const std::string& DynamicApplicationDataImpl::display_layout() const {
- return display_layout_;
+smart_objects::SmartObjectSPtr
+DynamicApplicationDataImpl::display_capabilities() const {
+ return display_capabilities_;
+}
+
+smart_objects::SmartObjectSPtr DynamicApplicationDataImpl::display_capabilities(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto result_display_caps = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Array);
+ const auto window_caps =
+ (*display_capabilities_)[0][strings::window_capabilities].asArray();
+ if (!window_caps) {
+ LOG4CXX_WARN(logger_, "Current window capabilities are empty");
+ // SDL still needs to retreive display capabilities
+ return display_capabilities_;
+ }
+ auto find_res =
+ std::find_if(window_caps->begin(),
+ window_caps->end(),
+ [&window_id](const smart_objects::SmartObject& element) {
+ if (window_id == element[strings::window_id].asInt()) {
+ return true;
+ }
+
+ return false;
+ });
+
+ DCHECK(find_res != window_caps->end());
+ const auto disp_caps_keys = (*display_capabilities_)[0].enumerate();
+ for (const auto& key : disp_caps_keys) {
+ if (strings::window_capabilities == key) {
+ continue;
+ }
+ (*result_display_caps)[0][key] = (*display_capabilities_)[0][key];
+ }
+
+ (*result_display_caps)[0][strings::window_capabilities][0] = *find_res;
+
+ return result_display_caps;
}
void DynamicApplicationDataImpl::load_global_properties(
@@ -437,30 +533,211 @@ void DynamicApplicationDataImpl::set_menu_icon(
void DynamicApplicationDataImpl::set_day_color_scheme(
const smart_objects::SmartObject& color_scheme) {
- if (day_color_scheme_) {
- delete day_color_scheme_;
+ using namespace mobile_apis::PredefinedWindows;
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[DEFAULT_WINDOW][strings::day_color_scheme] = color_scheme;
+}
+
+void DynamicApplicationDataImpl::set_night_color_scheme(
+ const smart_objects::SmartObject& color_scheme) {
+ using namespace mobile_apis::PredefinedWindows;
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[DEFAULT_WINDOW][strings::night_color_scheme] = color_scheme;
+}
+
+void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis::PredefinedWindows;
+ smart_objects::SmartObject template_config(smart_objects::SmartType_Map);
+ template_config[strings::template_layout] = layout;
+ window_templates_[DEFAULT_WINDOW] = template_config;
+}
+
+void DynamicApplicationDataImpl::set_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto& incoming_window_capabilities =
+ display_capabilities[0][strings::window_capabilities];
+
+ smart_objects::SmartObject tmp_window_capabilities;
+ if (display_capabilities_) {
+ tmp_window_capabilities =
+ (*display_capabilities_)[0][strings::window_capabilities];
+ }
+
+ display_capabilities_.reset(
+ new smart_objects::SmartObject(display_capabilities));
+
+ auto get_window_index = [&tmp_window_capabilities](const WindowID window_id) {
+ const auto tmp_window_capabilities_arr = tmp_window_capabilities.asArray();
+ if (!tmp_window_capabilities_arr) {
+ return -1;
+ }
+
+ int index = 0;
+ for (auto element : *tmp_window_capabilities_arr) {
+ if (element.keyExists(strings::window_id)) {
+ if (window_id == element[strings::window_id].asInt())
+ return index;
+ } else if (window_id == 0) {
+ return index;
+ }
+ index++;
+ }
+ return -1;
+ };
+
+ for (uint32_t i = 0; i < incoming_window_capabilities.length(); ++i) {
+ int64_t window_id = 0;
+ if (incoming_window_capabilities[i].keyExists(strings::window_id)) {
+ window_id = incoming_window_capabilities[i][strings::window_id].asInt();
+ }
+ int found_index = get_window_index(window_id);
+ if (0 <= found_index) {
+ // Update the existing window capability
+ tmp_window_capabilities[found_index] = incoming_window_capabilities[i];
+ } else {
+ tmp_window_capabilities[tmp_window_capabilities.length()] =
+ incoming_window_capabilities[i];
+ }
+ }
+
+ (*display_capabilities_)[0][strings::window_capabilities] =
+ tmp_window_capabilities;
+}
+
+void DynamicApplicationDataImpl::remove_window_capability(
+ const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto window_capabilities =
+ (*display_capabilities_)[0][strings::window_capabilities].asArray();
+ DCHECK_OR_RETURN_VOID(window_capabilities);
+
+ for (auto it = window_capabilities->begin(); it != window_capabilities->end();
+ ++it) {
+ const auto cur_window_id = (*it).keyExists(strings::window_id)
+ ? (*it)[strings::window_id].asInt()
+ : 0;
+ if (window_id == cur_window_id) {
+ window_capabilities->erase(it);
+ return;
+ }
}
- day_color_scheme_ = new smart_objects::SmartObject(color_scheme);
+ LOG4CXX_WARN(
+ logger_,
+ "No window id " << window_id << " found in display capabilities");
+}
+
+bool DynamicApplicationDataImpl::menu_layout_supported(
+ const mobile_apis::MenuLayout::eType layout) const {
+ if (!display_capabilities_)
+ return false;
+
+ const auto tmp_window_capabilities_arr =
+ (*display_capabilities_)[0][strings::window_capabilities].asArray();
+
+ if (!tmp_window_capabilities_arr)
+ return false;
+
+ for (auto element : *tmp_window_capabilities_arr) {
+ if ((!element.keyExists(strings::window_id) ||
+ element[strings::window_id].asInt() == 0) &&
+ element.keyExists(strings::menu_layouts_available)) {
+ for (uint32_t i = 0;
+ i < element[strings::menu_layouts_available].length();
+ ++i) {
+ if (static_cast<mobile_apis::MenuLayout::eType>(
+ element[strings::menu_layouts_available][i].asUInt()) ==
+ layout) {
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+void DynamicApplicationDataImpl::set_window_layout(const WindowID window_id,
+ const std::string& layout) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject template_config(smart_objects::SmartType_Map);
+
+ template_config[strings::template_layout] = layout;
+ window_templates_[window_id] = template_config;
+}
+
+void DynamicApplicationDataImpl::set_day_color_scheme(
+ const WindowID window_id, const smart_objects::SmartObject& color_scheme) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[window_id][strings::day_color_scheme] = color_scheme;
}
void DynamicApplicationDataImpl::set_night_color_scheme(
- const smart_objects::SmartObject& color_scheme) {
- if (night_color_scheme_) {
- delete night_color_scheme_;
+ const WindowID window_id, const smart_objects::SmartObject& color_scheme) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[window_id][strings::night_color_scheme] = color_scheme;
+}
+
+std::string DynamicApplicationDataImpl::window_layout(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AppWindowsTemplates::const_iterator window_template_it =
+ window_templates_.find(window_id);
+
+ if (window_templates_.end() != window_template_it) {
+ const smart_objects::SmartObject template_config =
+ window_template_it->second;
+ if (template_config.keyExists(strings::template_layout)) {
+ return template_config[strings::template_layout].asString();
+ }
}
- night_color_scheme_ = new smart_objects::SmartObject(color_scheme);
+ return std::string();
}
-void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) {
- display_layout_ = layout;
+smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AppWindowsTemplates::const_iterator window_template_it =
+ window_templates_.find(window_id);
+
+ if (window_templates_.end() != window_template_it) {
+ const smart_objects::SmartObject template_config =
+ window_template_it->second;
+ if (template_config.keyExists(strings::day_color_scheme)) {
+ return template_config[strings::day_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
+}
+
+smart_objects::SmartObject DynamicApplicationDataImpl::night_color_scheme(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AppWindowsTemplates::const_iterator window_template_it =
+ window_templates_.find(window_id);
+
+ if (window_templates_.end() != window_template_it) {
+ const smart_objects::SmartObject template_config =
+ window_template_it->second;
+ if (template_config.keyExists(strings::night_color_scheme)) {
+ return template_config[strings::night_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
}
void DynamicApplicationDataImpl::SetGlobalProperties(
const smart_objects::SmartObject& param,
void (DynamicApplicationData::*callback)(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject&)) {
+ const ns_smart_device_link::ns_smart_objects::SmartObject&)) {
smart_objects::SmartType so_type = param.getType();
if (so_type != smart_objects::SmartType::SmartType_Invalid &&
so_type != smart_objects::SmartType::SmartType_Null) {
@@ -473,28 +750,53 @@ void DynamicApplicationDataImpl::SetGlobalProperties(
}
void DynamicApplicationDataImpl::AddCommand(
- uint32_t cmd_id, const smart_objects::SmartObject& command) {
+ const uint32_t internal_id, const smart_objects::SmartObject& command) {
sync_primitives::AutoLock lock(commands_lock_ptr_);
- CommandsMap::const_iterator it = commands_.find(cmd_id);
+
+ CommandsMap::const_iterator it = commands_.find(internal_id);
if (commands_.end() == it) {
- commands_[cmd_id] = new smart_objects::SmartObject(command);
+ commands_[internal_id] = new smart_objects::SmartObject(command);
+ LOG4CXX_DEBUG(logger_,
+ "Command with internal number "
+ << internal_id << " and id "
+ << (*commands_[internal_id])[strings::cmd_id].asUInt()
+ << " is added.");
}
}
-void DynamicApplicationDataImpl::RemoveCommand(uint32_t cmd_id) {
+void DynamicApplicationDataImpl::RemoveCommand(const uint32_t cmd_id) {
sync_primitives::AutoLock lock(commands_lock_ptr_);
- CommandsMap::iterator it = commands_.find(cmd_id);
- if (commands_.end() != it) {
+
+ CommandIdComparator is_id_equal(strings::cmd_id, cmd_id);
+ CommandsMap::iterator it =
+ find_if(commands_.begin(), commands_.end(), is_id_equal);
+
+ if (it != commands_.end()) {
delete it->second;
+ LOG4CXX_DEBUG(logger_,
+ "Command with internal number " << (it->first) << " and id "
+ << cmd_id << " is removed.");
commands_.erase(it);
+
+ return;
}
+ LOG4CXX_WARN(
+ logger_,
+ "Command with id " << cmd_id << " is not found. Removal skipped.");
}
smart_objects::SmartObject* DynamicApplicationDataImpl::FindCommand(
- uint32_t cmd_id) {
+ const uint32_t cmd_id) {
sync_primitives::AutoLock lock(commands_lock_ptr_);
- CommandsMap::const_iterator it = commands_.find(cmd_id);
+
+ CommandIdComparator is_id_equal(strings::cmd_id, cmd_id);
+ CommandsMap::const_iterator it =
+ find_if(commands_.begin(), commands_.end(), is_id_equal);
+
if (it != commands_.end()) {
+ LOG4CXX_DEBUG(logger_,
+ "Command with internal number " << (it->first) << " and id "
+ << cmd_id << " is found.");
return it->second;
}
@@ -545,6 +847,33 @@ bool DynamicApplicationDataImpl::IsSubMenuNameAlreadyExist(
return false;
}
+DataAccessor<WindowParamsMap>
+DynamicApplicationDataImpl::window_optional_params_map() const {
+ return DataAccessor<WindowParamsMap>(window_params_map_,
+ window_params_map_lock_ptr_);
+}
+
+void DynamicApplicationDataImpl::SetWindowInfo(
+ const WindowID window_id, const smart_objects::SmartObject& window_info) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto it = window_params_map_.find(window_id);
+ if (window_params_map_.end() == it) {
+ window_params_map_[window_id] =
+ std::make_shared<smart_objects::SmartObject>(window_info);
+ }
+}
+
+DisplayCapabilitiesBuilder&
+DynamicApplicationDataImpl::display_capabilities_builder() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return display_capabilities_builder_;
+}
+
+void DynamicApplicationDataImpl::RemoveWindowInfo(const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ window_params_map_.erase(window_id);
+}
+
void DynamicApplicationDataImpl::AddChoiceSet(
uint32_t choice_set_id, const smart_objects::SmartObject& choice_set) {
sync_primitives::AutoLock lock(choice_set_map_lock_ptr_);
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 07d4723548..435462331d 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Ford Motor Company
+ * Copyright (c) 2018, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,22 +31,21 @@
*/
#include "application_manager/application_impl.h"
-#include <string>
#include <strings.h>
-#include "application_manager/message_helper.h"
-#include "protocol_handler/protocol_handler.h"
+#include <string>
#include "application_manager/application_manager.h"
+#include "application_manager/message_helper.h"
#include "config_profile/profile.h"
#include "interfaces/MOBILE_API.h"
+#include "protocol_handler/protocol_handler.h"
#include "utils/file_system.h"
-#include "utils/logger.h"
#include "utils/gen_hash.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-#include "utils/timer_task_impl.h"
+#include "utils/logger.h"
+
#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/resumption/resume_ctrl.h"
#include "transport_manager/common.h"
+#include "utils/timer_task_impl.h"
namespace {
@@ -83,8 +82,8 @@ void SwitchApplicationParameters(ApplicationSharedPtr app,
const size_t device_id,
const std::string& mac_address) {
LOG4CXX_AUTO_TRACE(logger_);
- utils::SharedPtr<ApplicationImpl> application =
- ApplicationSharedPtr::dynamic_pointer_cast<ApplicationImpl>(app);
+ std::shared_ptr<ApplicationImpl> application =
+ std::dynamic_pointer_cast<ApplicationImpl>(app);
DCHECK_OR_RETURN_VOID(application);
application->app_id_ = app_id;
application->device_id_ = device_id;
@@ -97,7 +96,7 @@ ApplicationImpl::ApplicationImpl(
const std::string& mac_address,
const connection_handler::DeviceHandle device_id,
const custom_str::CustomString& app_name,
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager,
ApplicationManager& application_manager)
: grammar_id_(0)
, hmi_app_id_(0)
@@ -114,9 +113,11 @@ ApplicationImpl::ApplicationImpl(
, video_streaming_suspended_(true)
, audio_streaming_suspended_(true)
, is_app_allowed_(true)
+ , is_app_data_resumption_allowed_(false)
, has_been_activated_(false)
, tts_properties_in_none_(false)
, tts_properties_in_full_(false)
+ , keep_context_(false)
, is_foreground_(false)
, is_application_data_changed_(false)
, put_file_in_none_count_(0)
@@ -124,11 +125,14 @@ ApplicationImpl::ApplicationImpl(
, list_files_in_none_count_(0)
, mac_address_(mac_address)
, device_id_(device_id)
+ , secondary_device_id_(0)
, usage_report_(mobile_app_id, statistics_manager)
+ , help_prompt_manager_impl_(*this, application_manager)
, protocol_version_(
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3)
, is_voice_communication_application_(false)
, is_resuming_(false)
+ , deferred_resumption_hmi_level_(mobile_api::HMILevel::INVALID_ENUM)
, is_hash_changed_during_suspend_(false)
, video_stream_retry_number_(0)
, audio_stream_retry_number_(0)
@@ -140,14 +144,15 @@ ApplicationImpl::ApplicationImpl(
"AudioStreamSuspend",
new ::timer::TimerTaskImpl<ApplicationImpl>(
this, &ApplicationImpl::OnAudioStreamSuspend))
+ , hybrid_app_preference_(mobile_api::HybridAppPreference::INVALID_ENUM)
, vi_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, button_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, application_manager_(application_manager)
, setup_in_progress_(false) {
cmd_number_to_time_limits_[mobile_apis::FunctionID::ReadDIDID] = {
- date_time::DateTime::getCurrentTime(), 0};
+ date_time::getCurrentTime(), 0};
cmd_number_to_time_limits_[mobile_apis::FunctionID::GetVehicleDataID] = {
- date_time::DateTime::getCurrentTime(), 0};
+ date_time::getCurrentTime(), 0};
set_mobile_app_id(mobile_app_id);
set_name(app_name);
@@ -185,7 +190,8 @@ void ApplicationImpl::CloseActiveMessage() {
}
bool ApplicationImpl::IsFullscreen() const {
- return mobile_api::HMILevel::HMI_FULL == hmi_level();
+ return mobile_api::HMILevel::HMI_FULL ==
+ hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
}
bool ApplicationImpl::is_audio() const {
@@ -263,19 +269,21 @@ bool ApplicationImpl::IsVideoApplication() const {
return is_video_app;
}
-void ApplicationImpl::SetRegularState(HmiStatePtr state) {
+void ApplicationImpl::SetRegularState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.AddState(state);
+ state_.AddState(window_id, state);
}
-void ApplicationImpl::RemovePostponedState() {
+void ApplicationImpl::RemovePostponedState(const WindowID window_id) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.RemoveState(HmiState::STATE_ID_POSTPONED);
+ state_.RemoveState(window_id, HmiState::STATE_ID_POSTPONED);
}
-void ApplicationImpl::SetPostponedState(HmiStatePtr state) {
+void ApplicationImpl::SetPostponedState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.AddState(state);
+ state_.AddState(window_id, state);
}
void ApplicationImpl::set_mobile_projection_enabled(bool option) {
@@ -295,26 +303,68 @@ struct StateIDComparator {
}
};
-void ApplicationImpl::AddHMIState(HmiStatePtr state) {
+void ApplicationImpl::AddHMIState(const WindowID window_id, HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.AddState(state);
+ state_.AddState(window_id, state);
}
-void ApplicationImpl::RemoveHMIState(HmiState::StateID state_id) {
+void ApplicationImpl::RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.RemoveState(state_id);
+ state_.RemoveState(window_id, state_id);
}
-const HmiStatePtr ApplicationImpl::CurrentHmiState() const {
- return state_.GetState(HmiState::STATE_ID_CURRENT);
+const HmiStatePtr ApplicationImpl::CurrentHmiState(
+ const WindowID window_id) const {
+ return state_.GetState(window_id, HmiState::STATE_ID_CURRENT);
}
-const HmiStatePtr ApplicationImpl::RegularHmiState() const {
- return state_.GetState(HmiState::STATE_ID_REGULAR);
+const HmiStatePtr ApplicationImpl::RegularHmiState(
+ const WindowID window_id) const {
+ return state_.GetState(window_id, HmiState::STATE_ID_REGULAR);
}
-const HmiStatePtr ApplicationImpl::PostponedHmiState() const {
- return state_.GetState(HmiState::STATE_ID_POSTPONED);
+WindowNames ApplicationImpl::GetWindowNames() const {
+ LOG4CXX_DEBUG(logger_,
+ "Collecting window names for application " << app_id());
+
+ WindowNames window_names;
+ std::string stringified_window_names;
+
+ sync_primitives::AutoLock auto_lock(window_params_map_lock_ptr_);
+ for (const auto& window_info_item : window_params_map_) {
+ const auto window_name =
+ (*window_info_item.second)[strings::window_name].asString();
+ window_names.push_back(window_name);
+ stringified_window_names +=
+ (stringified_window_names.empty() ? "" : ",") + window_name;
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Existing window names: [" + stringified_window_names + "]");
+ return window_names;
+}
+
+WindowIds ApplicationImpl::GetWindowIds() const {
+ LOG4CXX_DEBUG(logger_, "Collecting window IDs for application " << app_id());
+ return state_.GetWindowIds();
+}
+
+bool ApplicationImpl::WindowIdExists(const WindowID window_id) const {
+ const WindowIds window_ids = GetWindowIds();
+ return helpers::in_range(window_ids, window_id);
+}
+
+bool ApplicationImpl::IsAllowedToChangeAudioSource() const {
+ if (is_remote_control_supported() && is_media_application()) {
+ return true;
+ }
+ return false;
+}
+
+const HmiStatePtr ApplicationImpl::PostponedHmiState(
+ const WindowID window_id) const {
+ return state_.GetState(window_id, HmiState::STATE_ID_POSTPONED);
}
const smart_objects::SmartObject* ApplicationImpl::active_message() const {
@@ -345,9 +395,10 @@ bool ApplicationImpl::is_media_application() const {
return is_media_;
}
-const mobile_api::HMILevel::eType ApplicationImpl::hmi_level() const {
+const mobile_api::HMILevel::eType ApplicationImpl::hmi_level(
+ const WindowID window_id) const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state = CurrentHmiState(window_id);
return hmi_state ? hmi_state->hmi_level() : HMILevel::INVALID_ENUM;
}
@@ -371,9 +422,10 @@ const uint32_t ApplicationImpl::list_files_in_none_count() const {
return list_files_in_none_count_;
}
-const mobile_api::SystemContext::eType ApplicationImpl::system_context() const {
+const mobile_api::SystemContext::eType ApplicationImpl::system_context(
+ const WindowID window_id) const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state = CurrentHmiState(window_id);
return hmi_state ? hmi_state->system_context() : SystemContext::INVALID_ENUM;
;
}
@@ -390,6 +442,10 @@ connection_handler::DeviceHandle ApplicationImpl::device() const {
return device_id_;
}
+connection_handler::DeviceHandle ApplicationImpl::secondary_device() const {
+ return secondary_device_id_;
+}
+
const std::string& ApplicationImpl::mac_address() const {
return mac_address_;
}
@@ -426,6 +482,14 @@ bool ApplicationImpl::tts_properties_in_full() {
return tts_properties_in_full_;
}
+void ApplicationImpl::set_keep_context(bool keep_context) {
+ keep_context_ = keep_context;
+}
+
+bool ApplicationImpl::keep_context() {
+ return keep_context_;
+}
+
void ApplicationImpl::set_video_streaming_approved(bool state) {
video_streaming_approved_ = state;
}
@@ -503,6 +567,9 @@ void ApplicationImpl::StopStreamingForce(
using namespace protocol_handler;
LOG4CXX_AUTO_TRACE(logger_);
+ // see the comment in StopStreaming()
+ sync_primitives::AutoLock lock(streaming_stop_lock_);
+
SuspendStreaming(service_type);
if (service_type == ServiceType::kMobileNav) {
@@ -517,6 +584,12 @@ void ApplicationImpl::StopStreaming(
using namespace protocol_handler;
LOG4CXX_AUTO_TRACE(logger_);
+ // since WakeUpStreaming() is called from another thread, it is possible that
+ // the stream will be restarted after we call SuspendStreaming() and before
+ // we call StopXxxStreaming(). To avoid such timing issue, make sure that
+ // we run SuspendStreaming() and StopXxxStreaming() atomically.
+ sync_primitives::AutoLock lock(streaming_stop_lock_);
+
SuspendStreaming(service_type);
if (service_type == ServiceType::kMobileNav && video_streaming_approved()) {
@@ -559,34 +632,45 @@ void ApplicationImpl::SuspendStreaming(
sync_primitives::AutoLock lock(audio_streaming_suspended_lock_);
audio_streaming_suspended_ = true;
}
- MessageHelper::SendOnDataStreaming(service_type, false, application_manager_);
+ application_manager_.ProcessOnDataStreamingNotification(
+ service_type, app_id(), false);
}
void ApplicationImpl::WakeUpStreaming(
- protocol_handler::ServiceType service_type) {
+ protocol_handler::ServiceType service_type, uint32_t timer_len) {
using namespace protocol_handler;
LOG4CXX_AUTO_TRACE(logger_);
+ // See the comment in StopStreaming(). Also, please make sure that we acquire
+ // streaming_stop_lock_ then xxx_streaming_suspended_lock_ in this order!
+ sync_primitives::AutoLock lock(streaming_stop_lock_);
+
if (ServiceType::kMobileNav == service_type) {
- sync_primitives::AutoLock lock(video_streaming_suspended_lock_);
- if (video_streaming_suspended_) {
- application_manager_.OnAppStreaming(app_id(), service_type, true);
- MessageHelper::SendOnDataStreaming(
- ServiceType::kMobileNav, true, application_manager_);
- video_streaming_suspended_ = false;
+ { // reduce the range of video_streaming_suspended_lock_
+ sync_primitives::AutoLock lock(video_streaming_suspended_lock_);
+ if (video_streaming_suspended_) {
+ application_manager_.OnAppStreaming(app_id(), service_type, true);
+ application_manager_.ProcessOnDataStreamingNotification(
+ service_type, app_id(), true);
+ video_streaming_suspended_ = false;
+ }
}
- video_stream_suspend_timer_.Start(video_stream_suspend_timeout_,
- timer::kPeriodic);
+ video_stream_suspend_timer_.Start(
+ timer_len == 0 ? video_stream_suspend_timeout_ : timer_len,
+ timer::kPeriodic);
} else if (ServiceType::kAudio == service_type) {
- sync_primitives::AutoLock lock(audio_streaming_suspended_lock_);
- if (audio_streaming_suspended_) {
- application_manager_.OnAppStreaming(app_id(), service_type, true);
- MessageHelper::SendOnDataStreaming(
- ServiceType::kAudio, true, application_manager_);
- audio_streaming_suspended_ = false;
+ { // reduce the range of audio_streaming_suspended_lock_
+ sync_primitives::AutoLock lock(audio_streaming_suspended_lock_);
+ if (audio_streaming_suspended_) {
+ application_manager_.OnAppStreaming(app_id(), service_type, true);
+ application_manager_.ProcessOnDataStreamingNotification(
+ service_type, app_id(), true);
+ audio_streaming_suspended_ = false;
+ }
}
- audio_stream_suspend_timer_.Start(audio_stream_suspend_timeout_,
- timer::kPeriodic);
+ audio_stream_suspend_timer_.Start(
+ timer_len == 0 ? audio_stream_suspend_timeout_ : timer_len,
+ timer::kPeriodic);
}
}
@@ -646,8 +730,17 @@ void ApplicationImpl::set_app_allowed(const bool allowed) {
is_app_allowed_ = allowed;
}
-void ApplicationImpl::set_device(connection_handler::DeviceHandle device) {
- device_id_ = device;
+bool ApplicationImpl::is_app_data_resumption_allowed() const {
+ return is_app_data_resumption_allowed_;
+}
+
+void ApplicationImpl::set_app_data_resumption_allowance(const bool allowed) {
+ is_app_data_resumption_allowed_ = allowed;
+}
+
+void ApplicationImpl::set_secondary_device(
+ connection_handler::DeviceHandle secondary_device) {
+ secondary_device_id_ = secondary_device;
}
uint32_t ApplicationImpl::get_grammar_id() const {
@@ -695,6 +788,16 @@ bool ApplicationImpl::is_resuming() const {
return is_resuming_;
}
+void ApplicationImpl::set_deferred_resumption_hmi_level(
+ mobile_api::HMILevel::eType level) {
+ deferred_resumption_hmi_level_ = level;
+}
+
+mobile_api::HMILevel::eType ApplicationImpl::deferred_resumption_hmi_level()
+ const {
+ return deferred_resumption_hmi_level_;
+}
+
bool ApplicationImpl::AddFile(const AppFile& file) {
if (app_files_.count(file.file_name) == 0) {
LOG4CXX_INFO(logger_,
@@ -764,9 +867,13 @@ UsageStatistics& ApplicationImpl::usage_report() {
return usage_report_;
}
+HelpPromptManager& ApplicationImpl::help_prompt_manager() {
+ return help_prompt_manager_impl_;
+}
+
bool ApplicationImpl::AreCommandLimitsExceeded(
mobile_apis::FunctionID::eType cmd_id, TLimitSource source) {
- TimevalStruct current = date_time::DateTime::getCurrentTime();
+ date_time::TimeDuration current = date_time::getCurrentTime();
switch (source) {
// In case of config file values there is COMMON limitations for number of
// commands per certain time in seconds, i.e. 5 requests per 10 seconds with
@@ -798,13 +905,15 @@ bool ApplicationImpl::AreCommandLimitsExceeded(
LOG4CXX_INFO(logger_,
"Time Info: "
- << "\n Current: " << current.tv_sec << "\n Limit: ("
- << limit.first.tv_sec << "," << limit.second
+ << "\n Current: " << date_time::getSecs(current)
+ << "\n Limit: (" << date_time::getSecs(limit.first)
+ << "," << limit.second
<< ")"
"\n frequency_restrictions: ("
<< frequency_restrictions.first << ","
<< frequency_restrictions.second << ")");
- if (current.tv_sec < limit.first.tv_sec + frequency_restrictions.second) {
+ if (date_time::getSecs(current) <
+ date_time::getSecs(limit.first) + frequency_restrictions.second) {
if (limit.second < frequency_restrictions.first) {
++limit.second;
return false;
@@ -846,7 +955,8 @@ bool ApplicationImpl::AreCommandLimitsExceeded(
TimeToNumberLimit& limit = it->second;
// Checking even limitation for command
- if (static_cast<uint32_t>(current.tv_sec - limit.first.tv_sec) <
+ if (static_cast<uint32_t>(date_time::getSecs(current) -
+ date_time::getSecs(limit.first)) <
minute / cmd_limit) {
return true;
}
@@ -878,8 +988,10 @@ bool ApplicationImpl::is_application_data_changed() const {
return is_application_data_changed_;
}
-void ApplicationImpl::SetInitialState(HmiStatePtr state) {
- state_.InitState(state);
+void ApplicationImpl::SetInitialState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) {
+ state_.InitState(window_id, window_name, state);
}
void ApplicationImpl::set_is_application_data_changed(
@@ -913,7 +1025,7 @@ void ApplicationImpl::CleanupFiles() {
application_manager_.get_settings().app_storage_folder();
directory_name += "/" + folder_name();
- if (file_system::DirectoryExists(directory_name)) {
+ if (file_system::DirectoryExists(directory_name) && !folder_name().empty()) {
std::vector<std::string> files = file_system::ListFiles(directory_name);
AppFilesMap::const_iterator app_files_it;
@@ -1022,21 +1134,58 @@ void ApplicationImpl::SubscribeToSoftButtons(
cmd_softbuttonid_[cmd_id] = softbuttons_id;
}
} else {
- cmd_softbuttonid_[cmd_id] = softbuttons_id;
+ auto& soft_button_ids = cmd_softbuttonid_[cmd_id];
+ for (auto& softbutton_item : softbuttons_id) {
+ soft_button_ids.insert(softbutton_item);
+ }
}
}
+struct FindSoftButtonId {
+ uint32_t soft_button_id_;
+
+ FindSoftButtonId(const uint32_t soft_button_id)
+ : soft_button_id_(soft_button_id) {}
+
+ bool operator()(const std::pair<uint32_t, WindowID>& element) {
+ return soft_button_id_ == element.first;
+ }
+};
+
bool ApplicationImpl::IsSubscribedToSoftButton(const uint32_t softbutton_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin();
for (; it != cmd_softbuttonid_.end(); ++it) {
- if ((it->second).find(softbutton_id) != (it->second).end()) {
+ const auto& soft_button_ids = (*it).second;
+ FindSoftButtonId finder(softbutton_id);
+ const auto find_res =
+ std::find_if(soft_button_ids.begin(), soft_button_ids.end(), finder);
+ if ((soft_button_ids.end() != find_res)) {
return true;
}
}
return false;
}
+WindowID ApplicationImpl::GetSoftButtonWindowID(const uint32_t softbutton_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
+ CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin();
+ for (; it != cmd_softbuttonid_.end(); ++it) {
+ const auto& soft_button_ids = (*it).second;
+ FindSoftButtonId finder(softbutton_id);
+ const auto find_res =
+ std::find_if(soft_button_ids.begin(), soft_button_ids.end(), finder);
+ if ((soft_button_ids.end() != find_res)) {
+ return find_res->second;
+ }
+ }
+
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
void ApplicationImpl::UnsubscribeFromSoftButtons(int32_t cmd_id) {
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
CommandSoftButtonID::iterator it = cmd_softbuttonid_.find(cmd_id);
@@ -1046,8 +1195,9 @@ void ApplicationImpl::UnsubscribeFromSoftButtons(int32_t cmd_id) {
}
void ApplicationImpl::set_system_context(
+ const WindowID window_id,
const mobile_api::SystemContext::eType& system_context) {
- const HmiStatePtr hmi_state = CurrentHmiState();
+ HmiStatePtr hmi_state = CurrentHmiState(window_id);
hmi_state->set_system_context(system_context);
}
@@ -1060,13 +1210,20 @@ void ApplicationImpl::set_audio_streaming_state(
" for non-media application to different from NOT_AUDIBLE");
return;
}
- CurrentHmiState()->set_audio_streaming_state(state);
+
+ // According to proposal SDL-0216 audio streaming state should
+ // be applied for all windows to keep consistency
+ HmiStates hmi_states = state_.GetStates(HmiState::STATE_ID_CURRENT);
+ for (const auto& hmi_state : hmi_states) {
+ hmi_state->set_audio_streaming_state(state);
+ }
}
void ApplicationImpl::set_hmi_level(
+ const WindowID window_id,
const mobile_api::HMILevel::eType& new_hmi_level) {
using namespace mobile_apis;
- const HMILevel::eType current_hmi_level = hmi_level();
+ const HMILevel::eType current_hmi_level = hmi_level(window_id);
if (HMILevel::HMI_NONE != current_hmi_level &&
HMILevel::HMI_NONE == new_hmi_level) {
put_file_in_none_count_ = 0;
@@ -1075,7 +1232,8 @@ void ApplicationImpl::set_hmi_level(
}
ApplicationSharedPtr app = application_manager_.application(app_id());
DCHECK_OR_RETURN_VOID(app)
- application_manager_.state_controller().SetRegularState(app, new_hmi_level);
+ application_manager_.state_controller().SetRegularState(
+ app, window_id, new_hmi_level);
LOG4CXX_INFO(logger_, "hmi_level = " << new_hmi_level);
usage_report_.RecordHmiStateChanged(new_hmi_level);
}
@@ -1101,9 +1259,9 @@ bool ApplicationImpl::AddExtension(AppExtensionPtr extension) {
bool ApplicationImpl::RemoveExtension(AppExtensionUID uid) {
auto it = std::find_if(
- extensions_.begin(),
- extensions_.end(),
- [uid](AppExtensionPtr extension) { return extension->uid() == uid; });
+ extensions_.begin(), extensions_.end(), [uid](AppExtensionPtr extension) {
+ return extension->uid() == uid;
+ });
return it != extensions_.end();
}
@@ -1112,6 +1270,67 @@ const std::list<AppExtensionPtr>& ApplicationImpl::Extensions() const {
return extensions_;
}
+const std::string& ApplicationImpl::cloud_app_endpoint() const {
+ return endpoint_;
+}
+
+const std::string& ApplicationImpl::auth_token() const {
+ return auth_token_;
+}
+
+const std::string& ApplicationImpl::cloud_app_transport_type() const {
+ return cloud_transport_type_;
+}
+
+const mobile_apis::HybridAppPreference::eType&
+ApplicationImpl::hybrid_app_preference() const {
+ return hybrid_app_preference_;
+}
+
+const std::string& ApplicationImpl::cloud_app_certificate() const {
+ return certificate_;
+}
+
+bool ApplicationImpl::is_cloud_app() const {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ return false;
+#else
+ return !endpoint_.empty();
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+}
+
+void ApplicationImpl::set_cloud_app_endpoint(const std::string& endpoint) {
+ endpoint_ = endpoint;
+}
+
+void ApplicationImpl::set_auth_token(const std::string& auth_token) {
+ auth_token_ = auth_token;
+}
+
+void ApplicationImpl::set_cloud_app_transport_type(
+ const std::string& transport_type) {
+ cloud_transport_type_ = transport_type;
+}
+
+void ApplicationImpl::set_hybrid_app_preference(
+ const mobile_apis::HybridAppPreference::eType& hybrid_app_preference) {
+ hybrid_app_preference_ = hybrid_app_preference;
+}
+
+void ApplicationImpl::set_cloud_app_certificate(
+ const std::string& certificate) {
+ certificate_ = certificate;
+}
+
+void ApplicationImpl::set_user_location(
+ const smart_objects::SmartObject& user_location) {
+ user_location_ = user_location;
+}
+
+const smart_objects::SmartObject& ApplicationImpl::get_user_location() const {
+ return user_location_;
+}
+
void ApplicationImpl::PushMobileMessage(
smart_objects::SmartObjectSPtr mobile_message) {
sync_primitives::AutoLock lock(mobile_message_lock_);
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index fc8ae661fa..eb4dd2edf4 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -32,48 +32,50 @@
#include <stdlib.h> // for rand()
+#include <bson_object.h>
#include <climits>
-#include <string>
#include <fstream>
+#include <string>
#include <utility>
-#include <bson_object.h>
+#include "application_manager/app_launch/app_launch_ctrl_impl.h"
+#include "application_manager/app_launch/app_launch_data_db.h"
+#include "application_manager/app_launch/app_launch_data_json.h"
#include "application_manager/application_manager_impl.h"
+#include "application_manager/command_holder_impl.h"
#include "application_manager/commands/command_impl.h"
#include "application_manager/commands/command_notification_impl.h"
+#include "application_manager/helpers/application_helper.h"
+#include "application_manager/hmi_capabilities_impl.h"
#include "application_manager/message_helper.h"
-#include "application_manager/rpc_service_impl.h"
-#include "application_manager/rpc_handler_impl.h"
#include "application_manager/mobile_message_handler.h"
+#include "application_manager/plugin_manager/rpc_plugin_manager_impl.h"
#include "application_manager/policies/policy_handler.h"
-#include "application_manager/hmi_capabilities_impl.h"
#include "application_manager/resumption/resume_ctrl_impl.h"
-#include "application_manager/app_launch/app_launch_ctrl_impl.h"
-#include "application_manager/app_launch/app_launch_data_db.h"
-#include "application_manager/app_launch/app_launch_data_json.h"
-#include "application_manager/helpers/application_helper.h"
-#include "application_manager/plugin_manager/rpc_plugin_manager_impl.h"
-#include "protocol_handler/protocol_handler.h"
-#include "hmi_message_handler/hmi_message_handler.h"
-#include "application_manager/command_holder_impl.h"
+#include "application_manager/rpc_handler_impl.h"
+#include "application_manager/rpc_protection_manager_impl.h"
+#include "application_manager/rpc_service_impl.h"
#include "connection_handler/connection_handler_impl.h"
-#include "formatters/formatter_json_rpc.h"
-#include "formatters/CFormatterJsonSDLRPCv2.h"
#include "formatters/CFormatterJsonSDLRPCv1.h"
+#include "formatters/CFormatterJsonSDLRPCv2.h"
+#include "formatters/formatter_json_rpc.h"
+#include "hmi_message_handler/hmi_message_handler.h"
#include "protocol/bson_object_keys.h"
+#include "protocol_handler/protocol_handler.h"
-#include "utils/threads/thread.h"
-#include "utils/file_system.h"
-#include "utils/helpers.h"
-#include "utils/make_shared.h"
-#include "utils/timer_task_impl.h"
-#include "smart_objects/enum_schema_item.h"
-#include "interfaces/HMI_API_schema.h"
+#include <time.h>
+#include <boost/filesystem.hpp>
#include "application_manager/application_impl.h"
+#include "encryption/hashing.h"
+#include "interfaces/HMI_API_schema.h"
#include "media_manager/media_manager.h"
#include "policy/usage_statistics/counter.h"
+#include "smart_objects/enum_schema_item.h"
#include "utils/custom_string.h"
-#include <time.h>
+#include "utils/file_system.h"
+#include "utils/helpers.h"
+#include "utils/threads/thread.h"
+#include "utils/timer_task_impl.h"
namespace {
int get_rand_from_range(uint32_t from = 0, int to = RAND_MAX) {
@@ -93,7 +95,17 @@ DeviceTypes devicesType = {
hmi_apis::Common_TransportType::BLUETOOTH),
std::make_pair(std::string("BLUETOOTH_IOS"),
hmi_apis::Common_TransportType::BLUETOOTH),
- std::make_pair(std::string("WIFI"), hmi_apis::Common_TransportType::WIFI)};
+ std::make_pair(std::string("WIFI"), hmi_apis::Common_TransportType::WIFI),
+ std::make_pair(std::string("USB_IOS_HOST_MODE"),
+ hmi_apis::Common_TransportType::USB_IOS),
+ std::make_pair(std::string("USB_IOS_DEVICE_MODE"),
+ hmi_apis::Common_TransportType::USB_IOS),
+ std::make_pair(std::string("CARPLAY_WIRELESS_IOS"),
+ hmi_apis::Common_TransportType::WIFI),
+ std::make_pair(std::string("CLOUD_WEBSOCKET"),
+ hmi_apis::Common_TransportType::CLOUD_WEBSOCKET),
+ std::make_pair(std::string("WEBENGINE_WEBSOCKET"),
+ hmi_apis::Common_TransportType::WEBENGINE_WEBSOCKET)};
}
/**
@@ -113,36 +125,47 @@ bool device_id_comparator(const std::string& device_id,
}
/**
- * @brief policy_app_id_comparator is predicate to compare policy application
- * ids
- * @param policy_app_id Policy id of application
- * @param app Application pointer
- * @return True if policy id of application matches to policy id passed
+ * @brief PolicyAppIdComparator is struct predicate to compare policy
+ * application ids & device
+ * @param device_handle of application
+ * @param id of application
+ * @return True if policy id & device_handle of application matches to policy id
+ * & device_handle passed
*/
-bool policy_app_id_comparator(const std::string& policy_app_id,
- ApplicationSharedPtr app) {
- DCHECK_OR_RETURN(app, false);
- return app->policy_app_id() == policy_app_id;
-}
+struct PolicyAppIdComparator {
+ PolicyAppIdComparator(const connection_handler::DeviceHandle& device_handle,
+ const std::string& policy_app_id)
+ : device_handle_(device_handle), policy_app_id_(policy_app_id) {}
+ bool operator()(const ApplicationSharedPtr app) const {
+ return app && app->device() == device_handle_ &&
+ app->policy_app_id() == policy_app_id_;
+ }
+
+ private:
+ const connection_handler::DeviceHandle& device_handle_;
+ const std::string& policy_app_id_;
+};
+uint32_t ApplicationManagerImpl::mobile_corelation_id_ = 0;
uint32_t ApplicationManagerImpl::corelation_id_ = 0;
const uint32_t ApplicationManagerImpl::max_corelation_id_ = UINT_MAX;
-namespace formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
-namespace jhs = NsSmartDeviceLink::NsJSONHandler::strings;
+namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
+namespace jhs = ns_smart_device_link::ns_json_handler::strings;
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
ApplicationManagerImpl::ApplicationManagerImpl(
const ApplicationManagerSettings& am_settings,
const policy::PolicySettings& policy_settings)
: settings_(am_settings)
- , applications_list_lock_ptr_(std::make_shared<sync_primitives::Lock>(true))
+ , applications_list_lock_ptr_(
+ std::make_shared<sync_primitives::RecursiveLock>())
, apps_to_register_list_lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , reregister_wait_list_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, audio_pass_thru_active_(false)
, audio_pass_thru_app_id_(0)
- , driver_distraction_state_(
- hmi_apis::Common_DriverDistractionState::INVALID_ENUM)
+ , driver_distraction_state_(hmi_apis::Common_DriverDistractionState::DD_OFF)
, is_vr_session_strated_(false)
, hmi_cooperating_(false)
, is_all_apps_allowed_(true)
@@ -160,8 +183,9 @@ ApplicationManagerImpl::ApplicationManagerImpl(
, resume_ctrl_(new resumption::ResumeCtrlImpl(*this))
, navi_close_app_timeout_(am_settings.stop_streaming_timeout())
, navi_end_stream_timeout_(am_settings.stop_streaming_timeout())
- , stopping_application_mng_lock_(true)
, state_ctrl_(*this)
+ , pending_device_map_lock_ptr_(
+ std::make_shared<sync_primitives::RecursiveLock>())
, application_list_update_timer_(
"AM ListUpdater",
new TimerTaskImpl<ApplicationManagerImpl>(
@@ -170,31 +194,37 @@ ApplicationManagerImpl::ApplicationManagerImpl(
"AM TTSGLPRTimer",
new TimerTaskImpl<ApplicationManagerImpl>(
this, &ApplicationManagerImpl::OnTimerSendTTSGlobalProperties))
+ , clear_pool_timer_("ClearPoolTimer",
+ new TimerTaskImpl<ApplicationManagerImpl>(
+ this, &ApplicationManagerImpl::ClearTimerPool))
, is_low_voltage_(false)
, apps_size_(0)
+ , registered_during_timer_execution_(false)
, is_stopping_(false) {
- std::srand(std::time(0));
+ std::srand(std::time(nullptr));
AddPolicyObserver(this);
dir_type_to_string_map_ = {{TYPE_STORAGE, "Storage"},
{TYPE_SYSTEM, "System"},
{TYPE_ICONS, "Icons"}};
- sync_primitives::AutoLock lock(timer_pool_lock_);
- TimerSPtr clearing_timer(utils::MakeShared<timer::Timer>(
- "ClearTimerPoolTimer",
- new TimerTaskImpl<ApplicationManagerImpl>(
- this, &ApplicationManagerImpl::ClearTimerPool)));
const uint32_t timeout_ms = 10000u;
- clearing_timer->Start(timeout_ms, timer::kSingleShot);
- timer_pool_.push_back(clearing_timer);
- rpc_handler_.reset(new rpc_handler::RPCHandlerImpl(*this));
+ clear_pool_timer_.Start(timeout_ms, timer::kPeriodic);
+
+ rpc_handler_.reset(new rpc_handler::RPCHandlerImpl(
+ *this, hmi_so_factory(), mobile_so_factory()));
commands_holder_.reset(new CommandHolderImpl(*this));
+ std::shared_ptr<RPCProtectionManager> rpc_protection_manager =
+ std::make_shared<RPCProtectionManagerImpl>(*policy_handler_);
+ policy_handler_->add_listener(rpc_protection_manager.get());
rpc_service_.reset(new rpc_service::RPCServiceImpl(*this,
request_ctrl_,
protocol_handler_,
hmi_handler_,
- *commands_holder_));
+ *commands_holder_,
+ rpc_protection_manager,
+ hmi_so_factory(),
+ mobile_so_factory()));
}
ApplicationManagerImpl::~ApplicationManagerImpl() {
@@ -217,11 +247,24 @@ ApplicationManagerImpl::~ApplicationManagerImpl() {
LOG4CXX_DEBUG(logger_, "Destroying Policy Handler");
RemovePolicyObserver(this);
- sync_primitives::AutoLock lock(timer_pool_lock_);
- timer_pool_.clear();
+ {
+ sync_primitives::AutoLock lock(close_app_timer_pool_lock_);
+ close_app_timer_pool_.clear();
+ }
+
+ {
+ sync_primitives::AutoLock lock(end_stream_timer_pool_lock_);
+ end_stream_timer_pool_.clear();
+ }
+
+ {
+ sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
+ navi_app_to_stop_.clear();
+ }
- navi_app_to_stop_.clear();
navi_app_to_end_stream_.clear();
+
+ secondary_transport_devices_cache_.clear();
}
DataAccessor<ApplicationSet> ApplicationManagerImpl::applications() const {
@@ -230,6 +273,20 @@ DataAccessor<ApplicationSet> ApplicationManagerImpl::applications() const {
return accessor;
}
+DataAccessor<AppsWaitRegistrationSet>
+ApplicationManagerImpl::pending_applications() const {
+ DataAccessor<AppsWaitRegistrationSet> accessor(
+ apps_to_register_, apps_to_register_list_lock_ptr_);
+ return accessor;
+}
+
+DataAccessor<ReregisterWaitList>
+ApplicationManagerImpl::reregister_applications() const {
+ DataAccessor<ReregisterWaitList> accessor(reregister_wait_list_,
+ reregister_wait_list_lock_ptr_);
+ return accessor;
+}
+
ApplicationSharedPtr ApplicationManagerImpl::application(
uint32_t app_id) const {
AppIdPredicate finder(app_id);
@@ -251,6 +308,28 @@ ApplicationSharedPtr ApplicationManagerImpl::application_by_policy_id(
return FindApp(accessor, finder);
}
+ApplicationSharedPtr ApplicationManagerImpl::pending_application_by_policy_id(
+ const std::string& policy_app_id) const {
+ PolicyAppIdPredicate finder(policy_app_id);
+ DataAccessor<AppsWaitRegistrationSet> accessor = pending_applications();
+ return FindPendingApp(accessor, finder);
+}
+
+ApplicationSharedPtr ApplicationManagerImpl::application_by_name(
+ const std::string& app_name) const {
+ AppNamePredicate finder(app_name);
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindApp(accessor, finder);
+}
+
+ApplicationSharedPtr
+ApplicationManagerImpl::reregister_application_by_policy_id(
+ const std::string& policy_app_id) const {
+ PolicyAppIdPredicate finder(policy_app_id);
+ DataAccessor<ReregisterWaitList> accessor = reregister_applications();
+ return FindReregisterApp(accessor, finder);
+}
+
bool ActiveAppPredicate(const ApplicationSharedPtr app) {
return app ? app->IsFullscreen() : false;
}
@@ -261,8 +340,24 @@ ApplicationSharedPtr ApplicationManagerImpl::active_application() const {
return FindApp(accessor, ActiveAppPredicate);
}
+bool FullOrLimitedAppPredicate(const ApplicationSharedPtr app) {
+ return app ? app->IsFullscreen() ||
+ app->hmi_level(
+ mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED
+ : false;
+}
+
+ApplicationSharedPtr ApplicationManagerImpl::get_full_or_limited_application()
+ const {
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindApp(accessor, FullOrLimitedAppPredicate);
+}
+
bool LimitedAppPredicate(const ApplicationSharedPtr app) {
- return app ? app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED : false;
+ return app ? app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED
+ : false;
}
ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application()
@@ -273,7 +368,8 @@ ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application()
bool LimitedNaviAppPredicate(const ApplicationSharedPtr app) {
return app ? (app->is_navi() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -285,7 +381,8 @@ ApplicationSharedPtr ApplicationManagerImpl::get_limited_navi_application()
bool LimitedVoiceAppPredicate(const ApplicationSharedPtr app) {
return app ? (app->is_voice_communication_supported() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -307,7 +404,8 @@ ApplicationManagerImpl::applications_with_navi() {
bool LimitedMobileProjectionPredicate(const ApplicationSharedPtr app) {
return app ? (app->mobile_projection_enabled() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -335,6 +433,13 @@ ApplicationManagerImpl::applications_by_button(uint32_t button) {
return FindAllApps(accessor, finder);
}
+std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_by_name(
+ const std::string& app_name) const {
+ AppNamePredicate finder(app_name);
+ DataAccessor<ApplicationSet> accessor = applications();
+ return FindAllApps(accessor, finder);
+}
+
struct IsApplication {
IsApplication(connection_handler::DeviceHandle device_handle,
const std::string& policy_app_id)
@@ -348,16 +453,12 @@ struct IsApplication {
connection_handler::DeviceHandle device_handle_;
const std::string& policy_app_id_;
};
-void ApplicationManagerImpl::IviInfoUpdated(
- mobile_apis::VehicleDataType::eType vehicle_info, int value) {
+void ApplicationManagerImpl::IviInfoUpdated(const std::string& vehicle_info,
+ int value) {
// Notify Policy Manager if available about info it's interested in,
// i.e. odometer etc
- switch (vehicle_info) {
- case mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER:
- GetPolicyHandler().KmsChanged(value);
- break;
- default:
- break;
+ if (strings::odometer == vehicle_info) {
+ GetPolicyHandler().KmsChanged(value);
}
}
@@ -367,27 +468,6 @@ void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) {
sync_primitives::AutoLock lock(applications_list_lock_ptr_);
const mobile_apis::HMILevel::eType default_level = GetDefaultHmiLevel(app);
state_ctrl_.OnApplicationRegistered(app, default_level);
-
- std::function<void(plugin_manager::RPCPlugin&)> on_app_registered =
- [app](plugin_manager::RPCPlugin& plugin) {
- plugin.OnApplicationEvent(plugin_manager::kApplicationRegistered, app);
- };
- plugin_manager_->ForEachPlugin(on_app_registered);
-
- // TODO(AOleynik): Is neccessary to be able to know that registration process
- // has been completed and default HMI level is set, otherwise policy will
- // block all the requests/notifications to mobile
- // APPLINK-20764 - introduce usage of internal events or re-implement
- event_engine::Event event(
- hmi_apis::FunctionID::BasicCommunication_OnAppRegistered);
-
- smart_objects::SmartObject msg;
- msg[strings::params][strings::message_type] =
- hmi_apis::messageType::notification;
- msg[strings::params][strings::app_id] = app->app_id();
-
- event.set_smart_object(msg);
- event.raise(event_dispatcher());
}
void ApplicationManagerImpl::OnApplicationSwitched(ApplicationSharedPtr app) {
@@ -398,13 +478,14 @@ void ApplicationManagerImpl::OnApplicationSwitched(ApplicationSharedPtr app) {
bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited(
ApplicationConstSharedPtr app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
bool voice_state = app->is_voice_communication_supported();
bool media_state = app->is_media_application();
bool navi_state = app->is_navi();
bool mobile_projection_state = app->mobile_projection_enabled();
ApplicationSharedPtr active_app = active_application();
// Check app in FULL level
- if (active_app.valid()) {
+ if (active_app.use_count() != 0) {
// If checking app hmi level FULL, we return false
// because we couldn't have two applications with same HMIType in FULL and
// LIMITED HMI level
@@ -431,28 +512,28 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited(
// Check LIMITED apps
if (voice_state) {
- if (get_limited_voice_application().valid() &&
+ if ((get_limited_voice_application().use_count() != 0) &&
(get_limited_voice_application()->app_id() != app->app_id())) {
return true;
}
}
if (media_state) {
- if (get_limited_media_application().valid() &&
+ if ((get_limited_media_application().use_count() != 0) &&
(get_limited_media_application()->app_id() != app->app_id())) {
return true;
}
}
if (navi_state) {
- if (get_limited_navi_application().valid() &&
+ if ((get_limited_navi_application().use_count() != 0) &&
(get_limited_navi_application()->app_id() != app->app_id())) {
return true;
}
}
if (mobile_projection_state) {
- if (get_limited_mobile_projection_application().valid() &&
+ if ((get_limited_mobile_projection_application().use_count() != 0) &&
(get_limited_mobile_projection_application()->app_id() !=
app->app_id())) {
return true;
@@ -463,7 +544,7 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited(
}
ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
- const utils::SharedPtr<smart_objects::SmartObject>&
+ const std::shared_ptr<smart_objects::SmartObject>&
request_for_registration) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -481,7 +562,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
if (connection_handler().get_session_observer().GetDataOnSessionKey(
connection_key, &app_id, &sessions_list, &device_id) == -1) {
LOG4CXX_ERROR(logger_, "Failed to create application: no connection info.");
- utils::SharedPtr<smart_objects::SmartObject> response(
+ std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
connection_key,
mobile_apis::FunctionID::RegisterAppInterfaceID,
@@ -492,7 +573,8 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
}
smart_objects::SmartObject& params = message[strings::msg_params];
- const std::string& policy_app_id = params[strings::app_id].asString();
+ const std::string& policy_app_id =
+ GetCorrectMobileIDFromMessage(request_for_registration);
const custom_str::CustomString& app_name =
message[strings::msg_params][strings::app_name].asCustomString();
std::string device_mac;
@@ -513,7 +595,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
if (!is_all_apps_allowed_) {
LOG4CXX_WARN(logger_,
"RegisterApplication: access to app's disabled by user");
- utils::SharedPtr<smart_objects::SmartObject> response(
+ std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
connection_key,
mobile_apis::FunctionID::RegisterAppInterfaceID,
@@ -531,8 +613,9 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
app_name,
GetPolicyHandler().GetStatisticManager(),
*this));
+
if (!application) {
- utils::SharedPtr<smart_objects::SmartObject> response(
+ std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
connection_key,
mobile_apis::FunctionID::RegisterAppInterfaceID,
@@ -543,13 +626,17 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
}
HmiStatePtr initial_state =
- CreateRegularState(utils::SharedPtr<Application>(application),
+ CreateRegularState(std::shared_ptr<Application>(application),
+ mobile_apis::WindowType::MAIN,
mobile_apis::HMILevel::INVALID_ENUM,
mobile_apis::AudioStreamingState::INVALID_ENUM,
mobile_apis::VideoStreamingState::INVALID_ENUM,
mobile_api::SystemContext::SYSCTXT_MAIN);
- application->SetInitialState(initial_state);
+ application->SetInitialState(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ std::string(), // should not be tracked for main window
+ initial_state);
application->set_folder_name(policy_app_id + "_" +
application->mac_address());
@@ -574,11 +661,13 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
Version version;
int32_t min_version = message[strings::msg_params][strings::sync_msg_version]
- [strings::minor_version].asInt();
+ [strings::minor_version]
+ .asInt();
version.min_supported_api_version = static_cast<APIVersion>(min_version);
int32_t max_version = message[strings::msg_params][strings::sync_msg_version]
- [strings::major_version].asInt();
+ [strings::major_version]
+ .asInt();
version.max_supported_api_version = static_cast<APIVersion>(max_version);
application->set_version(version);
@@ -600,13 +689,48 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
// Keep HMI add id in case app is present in "waiting for registration" list
apps_to_register_list_lock_ptr_->Acquire();
- AppsWaitRegistrationSet::iterator it = apps_to_register_.find(application);
- if (apps_to_register_.end() != it) {
+ PolicyAppIdPredicate finder(application->policy_app_id());
+ ApplicationSet::iterator it =
+ std::find_if(apps_to_register_.begin(), apps_to_register_.end(), finder);
+ bool is_mismatched_cloud_app = false;
+
+ if (apps_to_register_.end() == it) {
+ DevicePredicate finder(application->device());
+ it = std::find_if(
+ apps_to_register_.begin(), apps_to_register_.end(), finder);
+
+ bool found = apps_to_register_.end() != it;
+ is_mismatched_cloud_app = found && (*it)->is_cloud_app() &&
+ policy_app_id != (*it)->policy_app_id();
+ } else {
application->set_hmi_application_id((*it)->hmi_app_id());
- apps_to_register_.erase(application);
+
+ // Set cloud app parameters
+ application->set_cloud_app_endpoint((*it)->cloud_app_endpoint());
+ application->set_cloud_app_certificate((*it)->cloud_app_certificate());
+ application->set_auth_token((*it)->auth_token());
+ application->set_cloud_app_transport_type(
+ (*it)->cloud_app_transport_type());
+ application->set_hybrid_app_preference((*it)->hybrid_app_preference());
+ apps_to_register_.erase(it);
}
apps_to_register_list_lock_ptr_->Release();
+ // Reject registration request if a cloud app registers with the incorrect
+ // appID
+ if (is_mismatched_cloud_app) {
+ std::shared_ptr<smart_objects::SmartObject> response(
+ MessageHelper::CreateNegativeResponse(
+ connection_key,
+ mobile_apis::FunctionID::RegisterAppInterfaceID,
+ message[strings::params][strings::correlation_id].asUInt(),
+ mobile_apis::Result::DISALLOWED));
+ (*response)[strings::msg_params][strings::info] =
+ "Cloud app registered with incorrect app id";
+ rpc_service_->ManageMobileCommand(response, commands::Command::SOURCE_SDL);
+ return ApplicationSharedPtr();
+ }
+
if (!application->hmi_app_id()) {
const bool is_saved =
resume_controller().IsApplicationSaved(policy_app_id, device_mac);
@@ -628,33 +752,30 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
application->set_app_icon_path(full_icon_path);
}
- PutDriverDistractionMessageToPostponed(application);
-
// Stops timer of saving data to resumption in order to
// doesn't erase data from resumption storage.
// Timer will be started after hmi level resumption.
resume_controller().OnAppRegistrationStart(policy_app_id, device_mac);
- // Add application to registered app list and set appropriate mark.
- // Lock has to be released before adding app to policy DB to avoid possible
- // deadlock with simultaneous PTU processing
- applications_list_lock_ptr_->Acquire();
- application->MarkRegistered();
- applications_.insert(application);
- apps_size_ = applications_.size();
- applications_list_lock_ptr_->Release();
+ AddAppToRegisteredAppList(application);
- return application;
-}
+ // Update cloud app information, in case any pending apps are unable to be
+ // registered due to a mobile app taking precedence
+ RefreshCloudAppInformation();
-DEPRECATED bool ApplicationManagerImpl::RemoveAppDataFromHMI(
- ApplicationSharedPtr app) {
- return true;
-}
+ // It is possible that secondary transport of this app has been already
+ // established. Make sure that the information is reflected to application
+ // instance.
+ // Also, make sure that this is done *after* we updated applications_ list to
+ // avoid timing issues.
+ DeviceMap::iterator itr =
+ secondary_transport_devices_cache_.find(connection_key);
+ if (secondary_transport_devices_cache_.end() != itr) {
+ connection_handler::DeviceHandle secondary_device_handle = itr->second;
+ application->set_secondary_device(secondary_device_handle);
+ }
-DEPRECATED bool ApplicationManagerImpl::LoadAppDataToHMI(
- ApplicationSharedPtr app) {
- return true;
+ return application;
}
bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) {
@@ -669,16 +790,15 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) {
LOG4CXX_DEBUG(logger_, "Activating application with id:" << app->app_id());
- // remove from resumption if app was activated by user
+ // Remove from resumption if app was activated by user
resume_controller().OnAppActivated(app);
- const HMILevel::eType hmi_level = HMILevel::HMI_FULL;
- const AudioStreamingState::eType audio_state =
- app->IsAudioApplication() ? AudioStreamingState::AUDIBLE
- : AudioStreamingState::NOT_AUDIBLE;
- const VideoStreamingState::eType video_state =
- app->IsVideoApplication() ? VideoStreamingState::STREAMABLE
- : VideoStreamingState::NOT_STREAMABLE;
- state_ctrl_.SetRegularState(app, hmi_level, audio_state, video_state, false);
+
+ // Activate any app services published by the app
+ GetAppServiceManager().OnAppActivated(app);
+
+ // Activate main window in state controller
+ state_ctrl_.ActivateDefaultWindow(app);
+
return true;
}
@@ -693,7 +813,7 @@ mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed(
const bool is_audio_app = app->IsAudioApplication();
const bool does_audio_app_with_same_type_exist =
IsAppTypeExistsInFullOrLimited(app);
- const bool is_active_app_exist = active_application().valid();
+ const bool is_active_app_exist = (active_application().use_count() != 0);
mobile_api::HMILevel::eType result = mobile_api::HMILevel::HMI_FULL;
if (is_audio_app && does_audio_app_with_same_type_exist) {
@@ -733,49 +853,556 @@ void ApplicationManagerImpl::ConnectToDevice(const std::string& device_mac) {
void ApplicationManagerImpl::OnHMIStartedCooperation() {
LOG4CXX_AUTO_TRACE(logger_);
hmi_cooperating_ = true;
+
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+ connection_handler_->CreateWebEngineDevice();
+#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+
MessageHelper::SendGetSystemInfoRequest(*this);
- utils::SharedPtr<smart_objects::SmartObject> is_vr_ready(
+ std::shared_ptr<smart_objects::SmartObject> is_vr_ready(
MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_IsReady,
*this));
rpc_service_->ManageHMICommand(is_vr_ready);
- utils::SharedPtr<smart_objects::SmartObject> is_tts_ready(
+ std::shared_ptr<smart_objects::SmartObject> is_tts_ready(
MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_IsReady,
*this));
rpc_service_->ManageHMICommand(is_tts_ready);
- utils::SharedPtr<smart_objects::SmartObject> is_ui_ready(
+ std::shared_ptr<smart_objects::SmartObject> is_ui_ready(
MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_IsReady,
*this));
rpc_service_->ManageHMICommand(is_ui_ready);
- utils::SharedPtr<smart_objects::SmartObject> is_navi_ready(
+ std::shared_ptr<smart_objects::SmartObject> is_navi_ready(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::Navigation_IsReady, *this));
rpc_service_->ManageHMICommand(is_navi_ready);
- utils::SharedPtr<smart_objects::SmartObject> is_ivi_ready(
+ std::shared_ptr<smart_objects::SmartObject> is_ivi_ready(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::VehicleInfo_IsReady, *this));
rpc_service_->ManageHMICommand(is_ivi_ready);
- utils::SharedPtr<smart_objects::SmartObject> is_rc_ready(
+ std::shared_ptr<smart_objects::SmartObject> is_rc_ready(
MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::RC_IsReady,
*this));
rpc_service_->ManageHMICommand(is_rc_ready);
- utils::SharedPtr<smart_objects::SmartObject> button_capabilities(
+ std::shared_ptr<smart_objects::SmartObject> button_capabilities(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::Buttons_GetCapabilities, *this));
rpc_service_->ManageHMICommand(button_capabilities);
- utils::SharedPtr<smart_objects::SmartObject> mixing_audio_supported_request(
+ std::shared_ptr<smart_objects::SmartObject> mixing_audio_supported_request(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported,
*this));
rpc_service_->ManageHMICommand(mixing_audio_supported_request);
resume_controller().ResetLaunchTime();
+
+ RefreshCloudAppInformation();
+
+ policy_handler_->TriggerPTUOnStartupIfRequired();
+}
+
+std::string ApplicationManagerImpl::PolicyIDByIconUrl(const std::string url) {
+ sync_primitives::AutoLock lock(app_icon_map_lock_ptr_);
+ for (auto& x : app_icon_map_) {
+ auto policy_id = x.first;
+ std::string icon_url = GetPolicyHandler().GetIconUrl(policy_id);
+ if (icon_url == url) {
+ LOG4CXX_DEBUG(logger_, "Matched icon url: " << url);
+ x.second.pending_request = false;
+ return policy_id;
+ }
+ }
+ return std::string("");
+}
+
+void ApplicationManagerImpl::SetIconFileFromSystemRequest(
+ const std::string policy_id) {
+ app_icon_map_lock_ptr_.Acquire();
+ auto app_icon_it = app_icon_map_.find(policy_id);
+ if (app_icon_it != app_icon_map_.end()) {
+ app_icon_map_.erase(app_icon_it);
+ }
+ app_icon_map_lock_ptr_.Release();
+
+ // Find pending application and set icon path
+ auto app = pending_application_by_policy_id(policy_id);
+ if (!app) {
+ return;
+ }
+ const std::string app_icon_dir(settings_.app_icons_folder());
+ const std::string full_icon_path(app_icon_dir + "/" + policy_id);
+ if (file_system::FileExists(full_icon_path)) {
+ LOG4CXX_DEBUG(logger_, "Set Icon Path: " << full_icon_path);
+ AppFile file;
+ file.is_persistent = true;
+ file.is_download_complete = true;
+ file.file_name = full_icon_path;
+
+ std::string icon_url = GetPolicyHandler().GetIconUrl(policy_id);
+ std::string extension = boost::filesystem::extension(icon_url);
+ if (extension == "bmp" || extension == "BMP") {
+ file.file_type = mobile_apis::FileType::GRAPHIC_BMP;
+ } else if (extension == "JPEG" || extension == "jpeg" ||
+ extension == "JPG" || extension == "jpg") {
+ file.file_type = mobile_apis::FileType::GRAPHIC_JPEG;
+ } else {
+ file.file_type = mobile_apis::FileType::GRAPHIC_PNG;
+ }
+
+ app->AddFile(file);
+ app->set_app_icon_path(full_icon_path);
+ }
+ SendUpdateAppList();
+}
+
+void ApplicationManagerImpl::DisconnectCloudApp(ApplicationSharedPtr app) {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+ return;
+#else
+ std::string policy_app_id = app->policy_app_id();
+ policy::AppProperties app_properties;
+ GetPolicyHandler().GetAppProperties(policy_app_id, app_properties);
+ if (app->IsRegistered() && app->is_cloud_app()) {
+ LOG4CXX_DEBUG(logger_, "Disabled app is registered, unregistering now");
+ GetRPCService().ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app->app_id(),
+ mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED),
+ commands::Command::SOURCE_SDL);
+
+ OnAppUnauthorized(app->app_id());
+ }
+ // Delete the cloud device
+ connection_handler().RemoveCloudAppDevice(app->device());
+
+ transport_manager::transport_adapter::CloudAppProperties properties{
+ app_properties.endpoint,
+ app_properties.certificate,
+ app_properties.enabled,
+ app_properties.auth_token,
+ app_properties.transport_type,
+ app_properties.hybrid_app_preference};
+ // Create device in pending state
+ LOG4CXX_DEBUG(logger_, "Re-adding the cloud app device");
+ connection_handler().AddCloudAppDevice(policy_app_id, properties);
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+}
+
+void ApplicationManagerImpl::RefreshCloudAppInformation() {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+ return;
+#else
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (is_stopping()) {
+ return;
+ }
+ std::vector<std::string> enabled_apps;
+ GetPolicyHandler().GetEnabledCloudApps(enabled_apps);
+ std::vector<std::string>::iterator enabled_it = enabled_apps.begin();
+ std::vector<std::string>::iterator enabled_end = enabled_apps.end();
+
+ // Store old device map and clear the current map
+ pending_device_map_lock_ptr_->Acquire();
+ app_icon_map_lock_ptr_.Acquire();
+ std::map<std::string, std::string> old_device_map = pending_device_map_;
+ pending_device_map_ = std::map<std::string, std::string>();
+ // Create a device for each newly enabled cloud app
+ policy::AppProperties app_properties;
+ for (; enabled_it != enabled_end; ++enabled_it) {
+ GetPolicyHandler().GetAppProperties(*enabled_it, app_properties);
+
+ if (app_properties.endpoint.empty()) {
+ continue;
+ }
+
+ mobile_apis::HybridAppPreference::eType hybrid_app_preference =
+ mobile_apis::HybridAppPreference::INVALID_ENUM;
+ smart_objects::EnumConversionHelper<
+ mobile_apis::HybridAppPreference::eType>::
+ StringToEnum(app_properties.hybrid_app_preference,
+ &hybrid_app_preference);
+
+ auto policy_id = *enabled_it;
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+ GetPolicyHandler().GetInitialAppData(policy_id, &nicknames, &app_hmi_types);
+
+ if (nicknames.empty()) {
+ LOG4CXX_ERROR(logger_, "Cloud App missing nickname");
+ continue;
+ } else if (mobile_apis::HybridAppPreference::MOBILE ==
+ hybrid_app_preference) {
+ auto nickname_it = nicknames.begin();
+ bool duplicate_found = false;
+ for (; nickname_it != nicknames.end(); ++nickname_it) {
+ auto apps = applications_by_name(*nickname_it);
+ for (auto app : apps) {
+ if (app.use_count() != 0 && !app->is_cloud_app()) {
+ LOG4CXX_ERROR(logger_,
+ "Mobile app already registered for cloud app: "
+ << *nickname_it);
+ duplicate_found = true;
+ break;
+ }
+ }
+ }
+
+ if (duplicate_found) {
+ continue;
+ }
+ }
+
+ pending_device_map_.insert(std::pair<std::string, std::string>(
+ app_properties.endpoint, policy_id));
+ // Determine which endpoints were disabled by erasing all enabled apps from
+ // the old device list
+ auto old_device_it = old_device_map.find(app_properties.endpoint);
+ if (old_device_it != old_device_map.end()) {
+ old_device_map.erase(old_device_it);
+ }
+
+ transport_manager::transport_adapter::CloudAppProperties properties{
+ app_properties.endpoint,
+ app_properties.certificate,
+ app_properties.enabled,
+ app_properties.auth_token,
+ app_properties.transport_type,
+ app_properties.hybrid_app_preference};
+
+ // If the device was disconnected, this will reinitialize the device
+ connection_handler().AddCloudAppDevice(policy_id, properties);
+
+ // Look for app icon url data and add to app_icon_url_map
+ std::string url = GetPolicyHandler().GetIconUrl(policy_id);
+
+ if (url.empty()) {
+ LOG4CXX_DEBUG(logger_, "No Icon Url for cloud app");
+ continue;
+ }
+
+ auto app_icon_it = app_icon_map_.find(policy_id);
+ if (app_icon_it != app_icon_map_.end()) {
+ LOG4CXX_DEBUG(logger_, "Cloud App Already Exists in Icon Map");
+ continue;
+ }
+
+ const std::string app_icon_dir(settings_.app_icons_folder());
+ const std::string full_icon_path(app_icon_dir + "/" + policy_id);
+ if (!file_system::FileExists(full_icon_path)) {
+ AppIconInfo icon_info(app_properties.endpoint, false);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Inserting cloud app into icon map: " << app_icon_map_.size());
+ app_icon_map_.insert(
+ std::pair<std::string, AppIconInfo>(policy_id, icon_info));
+ }
+ }
+ app_icon_map_lock_ptr_.Release();
+ pending_device_map_lock_ptr_->Release();
+
+ int removed_app_count = 0;
+ // Clear out devices for existing cloud apps that were disabled
+ for (auto& device : old_device_map) {
+ std::string policy_app_id = device.second;
+ // First search for the disabled app within the registered apps
+ ApplicationSharedPtr app = application_by_policy_id(policy_app_id);
+ if (app.use_count() == 0) {
+ sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
+ // If the disabled app is not present in the registered app list, check
+ // the apps awaiting registration
+ PolicyAppIdPredicate finder(policy_app_id);
+ ApplicationSet::iterator it = std::find_if(
+ apps_to_register_.begin(), apps_to_register_.end(), finder);
+ if (it == apps_to_register_.end()) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Unable to find app to remove (" << policy_app_id << "), skipping");
+ continue;
+ }
+ app = *it;
+ apps_to_register_.erase(it);
+ }
+ // If the disabled app is registered, unregistered it before destroying the
+ // device
+ if (app->IsRegistered() && app->is_cloud_app()) {
+ LOG4CXX_DEBUG(logger_, "Disabled app is registered, unregistering now");
+ GetRPCService().ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app->app_id(),
+ mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED),
+ commands::Command::SOURCE_SDL);
+
+ OnAppUnauthorized(app->app_id());
+ }
+ // Delete the cloud device
+ connection_handler().RemoveCloudAppDevice(app->device());
+ removed_app_count++;
+ }
+
+ // Update app list if disabled apps were removed
+ if (removed_app_count > 0) {
+ LOG4CXX_DEBUG(logger_, "Removed " << removed_app_count << " disabled apps");
+ SendUpdateAppList();
+ }
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+}
+
+void ApplicationManagerImpl::CreatePendingApplication(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info,
+ connection_handler::DeviceHandle device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string name = device_info.name();
+ pending_device_map_lock_ptr_->Acquire();
+ auto it = pending_device_map_.find(name);
+ if (it == pending_device_map_.end()) {
+ pending_device_map_lock_ptr_->Release();
+ return;
+ }
+ pending_device_map_lock_ptr_->Release();
+
+ const std::string policy_app_id = it->second;
+
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+
+ GetPolicyHandler().GetInitialAppData(
+ policy_app_id, &nicknames, &app_hmi_types);
+
+ if (nicknames.empty()) {
+ LOG4CXX_ERROR(logger_, "Cloud App missing nickname");
+ return;
+ }
+
+ const std::string display_name = nicknames[0];
+
+ ApplicationSharedPtr application(
+ new ApplicationImpl(0,
+ policy_app_id,
+ device_info.mac_address(),
+ device_id,
+ custom_str::CustomString(display_name),
+ GetPolicyHandler().GetStatisticManager(),
+ *this));
+
+ if (!application) {
+ LOG4CXX_INFO(logger_, "Could not create application");
+ return;
+ }
+
+ const std::string app_icon_dir(settings_.app_icons_folder());
+ const std::string full_icon_path(app_icon_dir + "/" + policy_app_id);
+ if (file_system::FileExists(full_icon_path)) {
+ application->set_app_icon_path(full_icon_path);
+ }
+ policy::AppProperties app_properties;
+ GetPolicyHandler().GetAppProperties(policy_app_id, app_properties);
+
+ mobile_apis::HybridAppPreference::eType hybrid_app_preference_enum;
+
+ const bool convert_result = smart_objects::EnumConversionHelper<
+ mobile_apis::HybridAppPreference::eType>::
+ StringToEnum(app_properties.hybrid_app_preference,
+ &hybrid_app_preference_enum);
+
+ if (!app_properties.hybrid_app_preference.empty() && !convert_result) {
+ LOG4CXX_ERROR(logger_,
+ "Could not convert string to enum: "
+ << app_properties.hybrid_app_preference);
+ return;
+ }
+
+ application->set_hmi_application_id(GenerateNewHMIAppID());
+ application->set_cloud_app_endpoint(app_properties.endpoint);
+ application->set_auth_token(app_properties.auth_token);
+ application->set_cloud_app_transport_type(app_properties.transport_type);
+ application->set_hybrid_app_preference(hybrid_app_preference_enum);
+ application->set_cloud_app_certificate(app_properties.certificate);
+
+ sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
+ LOG4CXX_DEBUG(logger_,
+ "apps_to_register_ size before: " << apps_to_register_.size());
+ apps_to_register_.insert(application);
+ LOG4CXX_DEBUG(logger_,
+ "apps_to_register_ size after: " << apps_to_register_.size());
+
+ SendUpdateAppList();
+}
+
+void ApplicationManagerImpl::RemovePendingApplication(
+ const std::string& policy_app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
+ PolicyAppIdPredicate finder(policy_app_id);
+ auto app_it =
+ std::find_if(apps_to_register_.begin(), apps_to_register_.end(), finder);
+
+ if (apps_to_register_.end() == app_it) {
+ LOG4CXX_WARN(
+ logger_,
+ "Unable to find app to remove (" << policy_app_id << "), skipping");
+ return;
+ }
+
+ apps_to_register_.erase(app_it);
+ LOG4CXX_DEBUG(logger_,
+ "Remove " << policy_app_id
+ << " from apps_to_register_. new size = "
+ << apps_to_register_.size());
+}
+
+void ApplicationManagerImpl::CreatePendingLocalApplication(
+ const std::string& policy_app_id) {
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+
+ GetPolicyHandler().GetInitialAppData(
+ policy_app_id, &nicknames, &app_hmi_types);
+
+ if (nicknames.empty()) {
+ LOG4CXX_ERROR(logger_,
+ "Cloud/Web App " << policy_app_id << "missing nickname");
+ return;
+ }
+
+ const std::string display_name = nicknames[0];
+
+ const auto web_engine_device = connection_handler_->GetWebEngineDeviceInfo();
+
+ ApplicationSharedPtr application(
+ new ApplicationImpl(0,
+ policy_app_id,
+ web_engine_device.mac_address(),
+ web_engine_device.device_handle(),
+ custom_str::CustomString(display_name),
+ GetPolicyHandler().GetStatisticManager(),
+ *this));
+
+ const std::string app_icon_dir(settings_.app_icons_folder());
+ const std::string full_icon_path(app_icon_dir + "/" + policy_app_id);
+ if (file_system::FileExists(full_icon_path)) {
+ application->set_app_icon_path(full_icon_path);
+ }
+ policy::AppProperties app_properties;
+ GetPolicyHandler().GetAppProperties(policy_app_id, app_properties);
+
+ mobile_apis::HybridAppPreference::eType hybrid_app_preference_enum;
+ const bool convert_result = smart_objects::EnumConversionHelper<
+ mobile_apis::HybridAppPreference::eType>::
+ StringToEnum(app_properties.hybrid_app_preference,
+ &hybrid_app_preference_enum);
+
+ if (!app_properties.hybrid_app_preference.empty() && !convert_result) {
+ LOG4CXX_ERROR(logger_,
+ "Could not convert string to enum: "
+ << app_properties.hybrid_app_preference);
+ return;
+ }
+
+ application->set_hmi_application_id(GenerateNewHMIAppID());
+ application->set_cloud_app_endpoint(app_properties.endpoint);
+ application->set_auth_token(app_properties.auth_token);
+ application->set_cloud_app_transport_type(app_properties.transport_type);
+ application->set_hybrid_app_preference(hybrid_app_preference_enum);
+ application->set_cloud_app_certificate(app_properties.certificate);
+
+ sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
+ apps_to_register_.insert(application);
+ LOG4CXX_DEBUG(logger_,
+ "Insert " << application->name().c_str()
+ << " to apps_to_register_. new size = "
+ << apps_to_register_.size());
+}
+
+void ApplicationManagerImpl::OnWebEngineDeviceCreated() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto enabled_local_apps = policy_handler_->GetEnabledLocalApps();
+
+ if (enabled_local_apps.empty()) {
+ LOG4CXX_DEBUG(logger_, "No enabled local apps present");
+ return;
+ }
+
+ for (auto policy_app_id : enabled_local_apps) {
+ CreatePendingLocalApplication(policy_app_id);
+ }
+ SendUpdateAppList();
+}
+
+void ApplicationManagerImpl::SetPendingApplicationState(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info) {
+ std::string name = device_info.name();
+ pending_device_map_lock_ptr_->Acquire();
+ auto it = pending_device_map_.find(name);
+ if (it == pending_device_map_.end()) {
+ pending_device_map_lock_ptr_->Release();
+ return;
+ }
+ pending_device_map_lock_ptr_->Release();
+
+ const std::string policy_app_id = it->second;
+ auto app = application_by_policy_id(policy_app_id);
+
+ if (!app) {
+ return;
+ }
+ LOG4CXX_DEBUG(logger_,
+ "Unregister application and move into apps_to_register");
+
+ UnregisterApplication(
+ app->app_id(), mobile_apis::Result::INVALID_ENUM, true, true);
+ app->MarkUnregistered();
+
+ {
+ sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
+ apps_to_register_.insert(app);
+ }
+}
+
+void ApplicationManagerImpl::OnConnectionStatusUpdated() {
+ SendUpdateAppList();
+}
+
+hmi_apis::Common_CloudConnectionStatus::eType
+ApplicationManagerImpl::GetCloudAppConnectionStatus(
+ ApplicationConstSharedPtr app) const {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ return hmi_apis::Common_CloudConnectionStatus::INVALID_ENUM;
+#else
+ transport_manager::ConnectionStatus status =
+ connection_handler().GetConnectionStatus(app->device());
+ switch (status) {
+ case transport_manager::ConnectionStatus::CONNECTED:
+ return hmi_apis::Common_CloudConnectionStatus::CONNECTED;
+ case transport_manager::ConnectionStatus::RETRY:
+ return hmi_apis::Common_CloudConnectionStatus::RETRY;
+ case transport_manager::ConnectionStatus::PENDING:
+ case transport_manager::ConnectionStatus::CLOSING:
+ return hmi_apis::Common_CloudConnectionStatus::NOT_CONNECTED;
+ default:
+ return hmi_apis::Common_CloudConnectionStatus::INVALID_ENUM;
+ }
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+}
+
+uint32_t ApplicationManagerImpl::GetNextMobileCorrelationID() {
+ if (mobile_corelation_id_ < max_corelation_id_) {
+ mobile_corelation_id_++;
+ } else {
+ mobile_corelation_id_ = 0;
+ }
+
+ return mobile_corelation_id_;
}
uint32_t ApplicationManagerImpl::GetNextHMICorrelationID() {
@@ -788,16 +1415,6 @@ uint32_t ApplicationManagerImpl::GetNextHMICorrelationID() {
return corelation_id_;
}
-bool ApplicationManagerImpl::BeginAudioPassThrough() {
- sync_primitives::AutoLock lock(audio_pass_thru_lock_);
- if (audio_pass_thru_active_) {
- return false;
- } else {
- audio_pass_thru_active_ = true;
- return true;
- }
-}
-
bool ApplicationManagerImpl::BeginAudioPassThru(uint32_t app_id) {
sync_primitives::AutoLock lock(audio_pass_thru_lock_);
if (audio_pass_thru_active_) {
@@ -809,16 +1426,6 @@ bool ApplicationManagerImpl::BeginAudioPassThru(uint32_t app_id) {
}
}
-bool ApplicationManagerImpl::EndAudioPassThrough() {
- sync_primitives::AutoLock lock(audio_pass_thru_lock_);
- if (audio_pass_thru_active_) {
- audio_pass_thru_active_ = false;
- return true;
- } else {
- return false;
- }
-}
-
bool ApplicationManagerImpl::EndAudioPassThru(uint32_t app_id) {
sync_primitives::AutoLock lock(audio_pass_thru_lock_);
if (audio_pass_thru_active_ && audio_pass_thru_app_id_ == app_id) {
@@ -840,22 +1447,19 @@ void ApplicationManagerImpl::set_driver_distraction_state(
driver_distraction_state_ = state;
}
-DEPRECATED void ApplicationManagerImpl::set_vr_session_started(
- const bool state) {
- is_vr_session_strated_ = state;
-}
-
void ApplicationManagerImpl::SetAllAppsAllowed(const bool allowed) {
is_all_apps_allowed_ = allowed;
}
HmiStatePtr ApplicationManagerImpl::CreateRegularState(
- utils::SharedPtr<Application> app,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::VideoStreamingState::eType video_state,
- mobile_apis::SystemContext::eType system_context) const {
+ std::shared_ptr<Application> app,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::VideoStreamingState::eType video_state,
+ const mobile_apis::SystemContext::eType system_context) const {
HmiStatePtr state(new HmiState(app, *this));
+ state->set_window_type(window_type);
state->set_hmi_level(hmi_level);
state->set_audio_streaming_state(audio_state);
state->set_video_streaming_state(video_state);
@@ -863,18 +1467,6 @@ HmiStatePtr ApplicationManagerImpl::CreateRegularState(
return state;
}
-HmiStatePtr ApplicationManagerImpl::CreateRegularState(
- uint32_t app_id,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::SystemContext::eType system_context) const {
- HmiStatePtr state(new HmiState(app_id, *this));
- state->set_hmi_level(hmi_level);
- state->set_audio_streaming_state(audio_state);
- state->set_system_context(system_context);
- return state;
-}
-
void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key,
int32_t correlation_id,
int32_t max_duration,
@@ -948,15 +1540,8 @@ ApplicationManagerImpl::AppsWaitingForRegistration() const {
bool ApplicationManagerImpl::IsAppsQueriedFrom(
const connection_handler::DeviceHandle handle) const {
- sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
- AppsWaitRegistrationSet::iterator it = apps_to_register_.begin();
- AppsWaitRegistrationSet::const_iterator it_end = apps_to_register_.end();
- for (; it != it_end; ++it) {
- if (handle == (*it)->device()) {
- return true;
- }
- }
- return false;
+ sync_primitives::AutoLock lock(query_apps_devices_lock_);
+ return query_apps_devices_.find(handle) != query_apps_devices_.end();
}
StateController& ApplicationManagerImpl::state_controller() {
@@ -967,6 +1552,22 @@ const ApplicationManagerSettings& ApplicationManagerImpl::get_settings() const {
return settings_;
}
+// Extract the app ID to use for policy based on the UseFullAppID .ini setting
+std::string ApplicationManagerImpl::GetCorrectMobileIDFromMessage(
+ const commands::MessageSharedPtr& message) const {
+ // If core is expecting a fullAppID
+ if (get_settings().use_full_app_id()) {
+ // fullAppID is present and core is configured to use it
+ if ((*message)[strings::msg_params].keyExists(strings::full_app_id)) {
+ return (*message)[strings::msg_params][strings::full_app_id].asString();
+ } else {
+ LOG4CXX_DEBUG(logger_, "UseFullAppID is on but only short ID given!");
+ }
+ }
+ // If core isn't using full or no full given, use regular appID
+ return (*message)[strings::msg_params][strings::app_id].asString();
+}
+
void application_manager::ApplicationManagerImpl::MarkAppsGreyOut(
const connection_handler::DeviceHandle handle, bool is_greyed_out) {
sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
@@ -1009,7 +1610,8 @@ void ApplicationManagerImpl::OnDeviceListUpdated(
return;
}
- smart_objects::SmartObjectSPtr update_list = new smart_objects::SmartObject;
+ smart_objects::SmartObjectSPtr update_list =
+ std::make_shared<smart_objects::SmartObject>();
smart_objects::SmartObject& so_to_send = *update_list;
so_to_send[jhs::S_PARAMS][jhs::S_FUNCTION_ID] =
hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList;
@@ -1020,6 +1622,7 @@ void ApplicationManagerImpl::OnDeviceListUpdated(
so_to_send[jhs::S_PARAMS][jhs::S_CORRELATION_ID] = GetNextHMICorrelationID();
so_to_send[jhs::S_MSG_PARAMS] = *msg_params;
rpc_service_->ManageHMICommand(update_list);
+ RefreshCloudAppInformation();
}
void ApplicationManagerImpl::OnFindNewApplicationsRequest() {
@@ -1030,6 +1633,13 @@ void ApplicationManagerImpl::OnFindNewApplicationsRequest() {
GetPolicyHandler().OnAppsSearchStarted();
}
+void ApplicationManagerImpl::OnQueryAppsRequest(
+ const connection_handler::DeviceHandle device) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(query_apps_devices_lock_);
+ query_apps_devices_.insert(device);
+}
+
void ApplicationManagerImpl::SendUpdateAppList() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1054,18 +1664,21 @@ void ApplicationManagerImpl::SendUpdateAppList() {
void ApplicationManagerImpl::RemoveDevice(
const connection_handler::DeviceHandle& device_handle) {
LOG4CXX_DEBUG(logger_, "device_handle " << device_handle);
+ sync_primitives::AutoLock lock(query_apps_devices_lock_);
+ query_apps_devices_.erase(device_handle);
}
void ApplicationManagerImpl::OnDeviceSwitchingStart(
const connection_handler::Device& device_from,
const connection_handler::Device& device_to) {
LOG4CXX_AUTO_TRACE(logger_);
+ ReregisterWaitList wait_list;
{
auto apps_data_accessor = applications();
std::copy_if(apps_data_accessor.GetData().begin(),
apps_data_accessor.GetData().end(),
- std::back_inserter(reregister_wait_list_),
+ std::back_inserter(wait_list),
std::bind1st(std::ptr_fun(&device_id_comparator),
device_from.mac_address()));
}
@@ -1073,60 +1686,41 @@ void ApplicationManagerImpl::OnDeviceSwitchingStart(
{
// During sending of UpdateDeviceList this lock is acquired also so making
// it scoped
- sync_primitives::AutoLock lock(reregister_wait_list_lock_);
- for (auto i = reregister_wait_list_.begin();
- reregister_wait_list_.end() != i;
- ++i) {
- auto app = *i;
- request_ctrl_.terminateAppRequests(app->app_id());
- resume_ctrl_->SaveApplication(app);
- }
+ sync_primitives::AutoLock lock(reregister_wait_list_lock_ptr_);
+ std::copy(wait_list.begin(),
+ wait_list.end(),
+ std::back_inserter(reregister_wait_list_));
}
- policy_handler_->OnDeviceSwitching(device_from.mac_address(),
- device_to.mac_address());
-
- connection_handler::DeviceMap device_list;
- device_list.insert(std::make_pair(device_to.device_handle(), device_to));
-
- smart_objects::SmartObjectSPtr msg_params =
- MessageHelper::CreateDeviceListSO(device_list, GetPolicyHandler(), *this);
- if (!msg_params) {
- LOG4CXX_ERROR(logger_, "Can't create UpdateDeviceList notification");
- return;
+ for (const auto& app : wait_list) {
+ request_ctrl_.terminateAppRequests(app->app_id());
+ resume_ctrl_->SaveApplication(app);
}
- auto update_list = utils::MakeShared<smart_objects::SmartObject>();
- smart_objects::SmartObject& so_to_send = *update_list;
- so_to_send[jhs::S_PARAMS][jhs::S_FUNCTION_ID] =
- hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList;
- so_to_send[jhs::S_PARAMS][jhs::S_MESSAGE_TYPE] =
- hmi_apis::messageType::request;
- so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_VERSION] = 2;
- so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_TYPE] = 1;
- so_to_send[jhs::S_PARAMS][jhs::S_CORRELATION_ID] = GetNextHMICorrelationID();
- so_to_send[jhs::S_MSG_PARAMS] = *msg_params;
- rpc_service_->ManageHMICommand(update_list);
+ policy_handler_->OnDeviceSwitching(device_from.mac_address(),
+ device_to.mac_address());
}
void ApplicationManagerImpl::OnDeviceSwitchingFinish(
const std::string& device_uid) {
LOG4CXX_AUTO_TRACE(logger_);
UNUSED(device_uid);
- sync_primitives::AutoLock lock(reregister_wait_list_lock_);
+
+ ReregisterWaitList wait_list;
+ {
+ sync_primitives::AutoLock lock(reregister_wait_list_lock_ptr_);
+ wait_list.swap(reregister_wait_list_);
+ }
const bool unexpected_disonnect = true;
const bool is_resuming = true;
- for (auto app_it = reregister_wait_list_.begin();
- app_it != reregister_wait_list_.end();
- ++app_it) {
- auto app = *app_it;
+
+ for (const auto& app : wait_list) {
UnregisterApplication(app->app_id(),
mobile_apis::Result::INVALID_ENUM,
is_resuming,
unexpected_disonnect);
}
- reregister_wait_list_.clear();
}
void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app,
@@ -1143,7 +1737,14 @@ void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app,
<< ". Changing device id to "
<< device_id);
+ bool is_subscribed_to_way_points = IsAppSubscribedForWayPoints(app);
+ if (is_subscribed_to_way_points) {
+ UnsubscribeAppFromWayPoints(app);
+ }
SwitchApplicationParameters(app, connection_key, device_id, mac_address);
+ if (is_subscribed_to_way_points) {
+ SubscribeAppForWayPoints(app);
+ }
// Normally this is done during registration, however since switched apps are
// not being registered again need to set protocol version on session.
@@ -1164,7 +1765,8 @@ mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel(
if (GetPolicyHandler().PolicyEnabled()) {
const std::string policy_app_id = application->policy_app_id();
std::string default_hmi_string = "";
- if (GetPolicyHandler().GetDefaultHmi(policy_app_id, &default_hmi_string)) {
+ if (GetPolicyHandler().GetDefaultHmi(
+ application->mac_address(), policy_app_id, &default_hmi_string)) {
if ("BACKGROUND" == default_hmi_string) {
default_hmi = HMILevel::HMI_BACKGROUND;
} else if ("FULL" == default_hmi_string) {
@@ -1186,127 +1788,95 @@ mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel(
return default_hmi;
}
-uint32_t ApplicationManagerImpl::GenerateGrammarID() {
- return rand();
-}
-
-uint32_t ApplicationManagerImpl::GenerateNewHMIAppID() {
+bool ApplicationManagerImpl::CheckResumptionRequiredTransportAvailable(
+ ApplicationConstSharedPtr application) const {
+ using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
- uint32_t hmi_app_id = get_rand_from_range(1);
- LOG4CXX_DEBUG(logger_, "GenerateNewHMIAppID value is: " << hmi_app_id);
-
- while (resume_controller().IsHMIApplicationIdExist(hmi_app_id)) {
- LOG4CXX_DEBUG(logger_, "HMI appID " << hmi_app_id << " is exists.");
- hmi_app_id = get_rand_from_range(1);
- LOG4CXX_DEBUG(logger_, "Trying new value: " << hmi_app_id);
- }
- return hmi_app_id;
-}
-
-void ApplicationManagerImpl::ReplaceMobileByHMIAppId(
- smart_objects::SmartObject& message) {
- MessageHelper::PrintSmartObject(message);
- if (message.keyExists(strings::app_id)) {
- ApplicationSharedPtr application_ptr =
- application(message[strings::app_id].asUInt());
- if (application_ptr.valid()) {
- LOG4CXX_DEBUG(logger_,
- "ReplaceMobileByHMIAppId from "
- << message[strings::app_id].asInt() << " to "
- << application_ptr->hmi_app_id());
- message[strings::app_id] = application_ptr->hmi_app_id();
+ const std::map<std::string, std::vector<std::string> >& transport_map =
+ get_settings().transport_required_for_resumption_map();
+
+ // retrieve transport type string used in .ini file
+ const std::string transport_type =
+ GetTransportTypeProfileString(application->device());
+ const std::string secondary_transport_type =
+ GetTransportTypeProfileString(application->secondary_device());
+
+ const smart_objects::SmartObject* app_types_array = application->app_types();
+ if (app_types_array == NULL || app_types_array->length() == 0) {
+ // This app does not have any AppHMIType. In this case, check "EMPTY_APP"
+ // entry
+ std::map<std::string, std::vector<std::string> >::const_iterator it =
+ transport_map.find(std::string("EMPTY_APP"));
+ if (it == transport_map.end()) {
+ // if "EMPTY_APP" is not specified, resumption is always enabled
+ return true;
}
- } else {
- switch (message.getType()) {
- case smart_objects::SmartType::SmartType_Array: {
- smart_objects::SmartArray* message_array = message.asArray();
- smart_objects::SmartArray::iterator it = message_array->begin();
- for (; it != message_array->end(); ++it) {
- ReplaceMobileByHMIAppId(*it);
- }
- break;
- }
- case smart_objects::SmartType::SmartType_Map: {
- std::set<std::string> keys = message.enumerate();
- std::set<std::string>::const_iterator key = keys.begin();
- for (; key != keys.end(); ++key) {
- std::string k = *key;
- ReplaceMobileByHMIAppId(message[*key]);
- }
- break;
+ const std::vector<std::string>& required_transport_list = it->second;
+
+ for (std::vector<std::string>::const_iterator itr =
+ required_transport_list.begin();
+ itr != required_transport_list.end();
+ ++itr) {
+ if (transport_type == *itr || secondary_transport_type == *itr) {
+ return true;
}
- default: { break; }
- }
- }
-}
-
-void ApplicationManagerImpl::ReplaceHMIByMobileAppId(
- smart_objects::SmartObject& message) {
- if (message.keyExists(strings::app_id)) {
- ApplicationSharedPtr application =
- application_by_hmi_app(message[strings::app_id].asUInt());
-
- if (application.valid()) {
- LOG4CXX_DEBUG(logger_,
- "ReplaceHMIByMobileAppId from "
- << message[strings::app_id].asInt() << " to "
- << application->app_id());
- message[strings::app_id] = application->app_id();
}
+ return false;
} else {
- switch (message.getType()) {
- case smart_objects::SmartType::SmartType_Array: {
- smart_objects::SmartArray* message_array = message.asArray();
- smart_objects::SmartArray::iterator it = message_array->begin();
- for (; it != message_array->end(); ++it) {
- ReplaceHMIByMobileAppId(*it);
- }
- break;
+ // check all AppHMITypes that the app has
+ for (size_t i = 0; i < app_types_array->length(); i++) {
+ const std::string app_type_string =
+ AppHMITypeToString(static_cast<mobile_apis::AppHMIType::eType>(
+ app_types_array->getElement(i).asUInt()));
+ bool transport_is_found = false;
+
+ std::map<std::string, std::vector<std::string> >::const_iterator it =
+ transport_map.find(app_type_string);
+ if (it == transport_map.end()) {
+ // this AppHMIType is not listed in .ini file, so resumption is always
+ // enabled
+ continue;
}
- case smart_objects::SmartType::SmartType_Map: {
- std::set<std::string> keys = message.enumerate();
- std::set<std::string>::const_iterator key = keys.begin();
- for (; key != keys.end(); ++key) {
- ReplaceHMIByMobileAppId(message[*key]);
+
+ const std::vector<std::string>& required_transport_list = it->second;
+ for (std::vector<std::string>::const_iterator itr =
+ required_transport_list.begin();
+ itr != required_transport_list.end();
+ ++itr) {
+ if (transport_type == *itr || secondary_transport_type == *itr) {
+ transport_is_found = true;
+ break;
}
- break;
}
- default: { break; }
- }
- }
-}
-bool ApplicationManagerImpl::StartNaviService(
- uint32_t app_id, protocol_handler::ServiceType service_type) {
- using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (HMILevelAllowsStreaming(app_id, service_type)) {
- NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
- if (navi_service_status_.end() == it) {
- std::pair<NaviServiceStatusMap::iterator, bool> res =
- navi_service_status_.insert(
- std::pair<uint32_t, std::pair<bool, bool> >(
- app_id, std::make_pair(false, false)));
- if (!res.second) {
- LOG4CXX_WARN(logger_, "Navi service refused");
+ // if neither primary or secondary transport type is included in the list,
+ // then resumption will be disabled
+ if (!transport_is_found) {
return false;
}
- it = res.first;
}
- // Fill NaviServices map. Set true to first value of pair if
- // we've started video service or to second value if we've
- // started audio service
- service_type == ServiceType::kMobileNav ? it->second.first = true
- : it->second.second = true;
- application(app_id)->StartStreaming(service_type);
return true;
- } else {
- LOG4CXX_WARN(logger_, "Refused navi service by HMI level");
}
- return false;
+}
+
+uint32_t ApplicationManagerImpl::GenerateGrammarID() {
+ return rand();
+}
+
+uint32_t ApplicationManagerImpl::GenerateNewHMIAppID() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ uint32_t hmi_app_id = get_rand_from_range(1);
+ LOG4CXX_DEBUG(logger_, "GenerateNewHMIAppID value is: " << hmi_app_id);
+
+ while (resume_controller().IsHMIApplicationIdExist(hmi_app_id)) {
+ LOG4CXX_DEBUG(logger_, "HMI appID " << hmi_app_id << " is exists.");
+ hmi_app_id = get_rand_from_range(1);
+ LOG4CXX_DEBUG(logger_, "Trying new value: " << hmi_app_id);
+ }
+
+ return hmi_app_id;
}
bool ApplicationManagerImpl::StartNaviService(
@@ -1316,7 +1886,7 @@ bool ApplicationManagerImpl::StartNaviService(
using namespace protocol_handler;
LOG4CXX_AUTO_TRACE(logger_);
- if (HMILevelAllowsStreaming(app_id, service_type)) {
+ if (HMIStateAllowsStreaming(app_id, service_type)) {
{
sync_primitives::AutoLock lock(navi_service_status_lock_);
@@ -1334,6 +1904,25 @@ bool ApplicationManagerImpl::StartNaviService(
}
}
+ {
+ /* Fix: For NaviApp1 Switch to NaviApp2, App1's Endcallback() arrives
+ later than App2's Startcallback(). Cause streaming issue on HMI.
+ */
+ sync_primitives::AutoLock lock(applications_list_lock_ptr_);
+ for (auto app : applications_) {
+ if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
+ LOG4CXX_DEBUG(logger_,
+ "Continue, Not Navi App Id: " << app->app_id());
+ continue;
+ }
+ LOG4CXX_DEBUG(logger_,
+ "Abort Stream Service of other NaviAppId: "
+ << app->app_id()
+ << " Service_type: " << service_type);
+ StopNaviService(app->app_id(), service_type);
+ }
+ }
+
if (service_type == ServiceType::kMobileNav) {
smart_objects::SmartObject converted_params(smart_objects::SmartType_Map);
ConvertVideoParamsToSO(converted_params, params);
@@ -1354,9 +1943,7 @@ bool ApplicationManagerImpl::StartNaviService(
return false;
} else if (!converted_params.empty()) {
LOG4CXX_INFO(logger_, "Sending video configuration params");
-#ifdef DEBUG
MessageHelper::PrintSmartObject(converted_params);
-#endif
bool request_sent =
application(app_id)->SetVideoConfig(service_type, converted_params);
if (request_sent) {
@@ -1406,10 +1993,30 @@ void ApplicationManagerImpl::OnStreamingConfigured(
// started audio service
service_type == ServiceType::kMobileNav ? it->second.first = true
: it->second.second = true;
+
+ {
+ sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
+ for (size_t i = 0; i < navi_app_to_stop_.size(); ++i) {
+ if (app_id == navi_app_to_stop_[i]) {
+ sync_primitives::AutoLock lock(close_app_timer_pool_lock_);
+ close_app_timer_pool_.erase(close_app_timer_pool_.begin() + i);
+ navi_app_to_stop_.erase(navi_app_to_stop_.begin() + i);
+ break;
+ }
+ }
+ }
}
application(app_id)->StartStreaming(service_type);
connection_handler().NotifyServiceStartedResult(app_id, true, empty);
+
+ // Fix: For wifi Secondary
+ // Should erase appid from deque of ForbidStreaming() push in the last time
+ std::deque<uint32_t>::const_iterator iter = std::find(
+ navi_app_to_end_stream_.begin(), navi_app_to_end_stream_.end(), app_id);
+ if (navi_app_to_end_stream_.end() != iter) {
+ navi_app_to_end_stream_.erase(iter);
+ }
} else {
std::vector<std::string> converted_params =
ConvertRejectedParamList(rejected_params);
@@ -1430,13 +2037,46 @@ void ApplicationManagerImpl::StopNaviService(
if (navi_service_status_.end() == it) {
LOG4CXX_WARN(logger_,
"No Information about navi service " << service_type);
+ // Fix: Need return for Not navi service at now
+ return;
} else {
+ // Fix: Repeated tests are not executed after they have stopped for Navi
+ if (false == it->second.first &&
+ ServiceType::kMobileNav == service_type) {
+ LOG4CXX_DEBUG(logger_, "appId: " << app_id << "Navi had stopped");
+ return;
+ }
+
+ // Fix: Repeated tests are not executed after they have stopped for Audio
+ if (false == it->second.second && ServiceType::kAudio == service_type) {
+ LOG4CXX_DEBUG(logger_, "appId: " << app_id << "Audio had stopped");
+ return;
+ }
// Fill NaviServices map. Set false to first value of pair if
// we've stopped video service or to second value if we've
// stopped audio service
+ LOG4CXX_DEBUG(logger_,
+ "appId: " << app_id << " service_type: " << service_type
+ << " to stopped");
service_type == ServiceType::kMobileNav ? it->second.first = false
: it->second.second = false;
}
+ // Fix: For wifi Secondary
+ // undisposed data active the VPMService restart again,
+ // because Not set Allowstream flag
+ ApplicationSharedPtr app = application(app_id);
+ if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
+ LOG4CXX_ERROR(logger_, "Navi/Projection application not found");
+ return;
+ }
+ if (service_type == ServiceType::kMobileNav) {
+ app->set_video_streaming_allowed(false);
+ }
+ if (service_type == ServiceType::kAudio) {
+ app->set_audio_streaming_allowed(false);
+ }
+ // push_back for judge in ForbidStreaming(),
+ StartEndStreamTimer(app_id);
}
ApplicationSharedPtr app = application(app_id);
@@ -1448,46 +2088,6 @@ void ApplicationManagerImpl::StopNaviService(
app->StopStreaming(service_type);
}
-// Suppress warning for deprecated method used within another deprecated method
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-bool ApplicationManagerImpl::OnServiceStartedCallback(
- const connection_handler::DeviceHandle& device_handle,
- const int32_t& session_key,
- const protocol_handler::ServiceType& type) {
- using namespace helpers;
- using namespace protocol_handler;
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "ServiceType = " << type << ". Session = " << std::hex
- << session_key);
-
- if (type == kRpc) {
- LOG4CXX_DEBUG(logger_, "RPC service is about to be started.");
- return true;
- }
- ApplicationSharedPtr app = application(session_key);
- if (!app) {
- LOG4CXX_WARN(logger_,
- "The application with id:" << session_key
- << " doesn't exists.");
- return false;
- }
-
- if (Compare<ServiceType, EQ, ONE>(
- type, ServiceType::kMobileNav, ServiceType::kAudio)) {
- if (app->is_navi()) {
- return StartNaviService(session_key, type);
- } else {
- LOG4CXX_WARN(logger_, "Refuse not navi application");
- }
- } else {
- LOG4CXX_WARN(logger_, "Refuse unknown service");
- }
- return false;
-}
-#pragma GCC diagnostic pop
-
void ApplicationManagerImpl::OnServiceStartedCallback(
const connection_handler::DeviceHandle& device_handle,
const int32_t& session_key,
@@ -1496,21 +2096,21 @@ void ApplicationManagerImpl::OnServiceStartedCallback(
using namespace helpers;
using namespace protocol_handler;
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "ServiceType = " << type << ". Session = " << std::hex
- << session_key);
+ LOG4CXX_DEBUG(
+ logger_,
+ "ServiceType = " << type << ". Session = " << std::hex << session_key);
std::vector<std::string> empty;
- if (type == kRpc) {
+ if (kRpc == type) {
LOG4CXX_DEBUG(logger_, "RPC service is about to be started.");
connection_handler().NotifyServiceStartedResult(session_key, true, empty);
return;
}
ApplicationSharedPtr app = application(session_key);
if (!app) {
- LOG4CXX_WARN(logger_,
- "The application with id:" << session_key
- << " doesn't exists.");
+ LOG4CXX_WARN(
+ logger_,
+ "The application with id:" << session_key << " doesn't exists.");
connection_handler().NotifyServiceStartedResult(session_key, false, empty);
return;
}
@@ -1528,6 +2128,7 @@ void ApplicationManagerImpl::OnServiceStartedCallback(
} else {
LOG4CXX_WARN(logger_, "Refuse unknown service");
}
+
connection_handler().NotifyServiceStartedResult(session_key, false, empty);
}
@@ -1550,7 +2151,7 @@ void ApplicationManagerImpl::OnServiceEndedCallback(
return;
}
- if (IsAppInReconnectMode(app->policy_app_id())) {
+ if (IsAppInReconnectMode(app->device(), app->policy_app_id())) {
LOG4CXX_DEBUG(logger_,
"Application is in reconnection list and won't be closed.");
return;
@@ -1610,6 +2211,152 @@ void ApplicationManagerImpl::OnServiceEndedCallback(
}
}
+void ApplicationManagerImpl::ProcessServiceStatusUpdate(
+ const uint32_t connection_key,
+ hmi_apis::Common_ServiceType::eType service_type,
+ hmi_apis::Common_ServiceEvent::eType service_event,
+ utils::Optional<hmi_apis::Common_ServiceStatusUpdateReason::eType>
+ service_update_reason) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ LOG4CXX_DEBUG(logger_,
+ "Processing status update with connection key: "
+ << connection_key << " service type: " << service_type
+ << " service_event " << service_event
+ << " service_update_reason " << service_update_reason);
+
+ const auto app = application(connection_key);
+
+ const uint32_t app_id = app ? app->app_id() : 0u;
+
+ auto reason = service_update_reason
+ ? *service_update_reason
+ : hmi_apis::Common_ServiceStatusUpdateReason::INVALID_ENUM;
+
+ auto notification = MessageHelper::CreateOnServiceUpdateNotification(
+ service_type, service_event, reason, app_id);
+
+ rpc_service_->ManageHMICommand(notification);
+
+ if (hmi_apis::Common_ServiceEvent::REQUEST_REJECTED == service_event &&
+ HandleRejectedServiceStatus(app, service_type)) {
+ state_ctrl_.SetRegularState(app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_NONE,
+ true);
+ }
+}
+
+bool ApplicationManagerImpl::HandleRejectedServiceStatus(
+ ApplicationSharedPtr app,
+ const hmi_apis::Common_ServiceType::eType service_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ LOG4CXX_WARN(logger_, "Received invalid app");
+ return false;
+ }
+
+ switch (service_type) {
+ case hmi_apis::Common_ServiceType::VIDEO:
+ case hmi_apis::Common_ServiceType::AUDIO: {
+ {
+ sync_primitives::AutoLock lock(navi_service_status_lock_);
+ auto app_services = navi_service_status_.find(app->app_id());
+ if (navi_service_status_.end() != app_services) {
+ navi_service_status_.erase(app_services);
+ }
+ }
+ LOG4CXX_DEBUG(logger_,
+ "The start of service"
+ << service_type << " for appID: " << app
+ << " is failed. Service info has been removed");
+ return true;
+ }
+ case hmi_apis::Common_ServiceType::RPC: {
+ connection_handler().SendEndService(app->app_id(),
+ protocol_handler::ServiceType::kRpc);
+ LOG4CXX_DEBUG(logger_, "RPC service for appID: " << app << " is stopped");
+ return true;
+ }
+ default:
+ LOG4CXX_DEBUG(logger_, "Unknown service type: " << service_type);
+ return false;
+ }
+}
+
+void ApplicationManagerImpl::OnSecondaryTransportStartedCallback(
+ const connection_handler::DeviceHandle device_handle,
+ const int32_t session_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (device_handle == 0) {
+ LOG4CXX_WARN(logger_,
+ "Invalid device handle passed for secondary transport of app "
+ << session_key);
+ return;
+ }
+
+ secondary_transport_devices_cache_[session_key] = device_handle;
+
+ {
+ sync_primitives::AutoLock auto_lock(applications_list_lock_ptr_);
+ ApplicationSharedPtr app = application(session_key);
+ if (!app) {
+ // It is possible that secondary transport is established prior to
+ // RegisterAppInterface request being processed. In this case, we will
+ // update the app's information during RegisterApplication().
+ LOG4CXX_DEBUG(logger_,
+ "Application with id: " << session_key << " is not found");
+ return;
+ }
+ app->set_secondary_device(device_handle);
+ }
+
+ // notify the event to HMI through BC.UpdateAppList request
+ SendUpdateAppList();
+
+ // if resumption has not been enabled, run it now
+ resume_controller().RetryResumption(session_key);
+}
+
+void ApplicationManagerImpl::OnSecondaryTransportEndedCallback(
+ const int32_t session_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ DeviceMap::iterator it = secondary_transport_devices_cache_.find(session_key);
+ if (it == secondary_transport_devices_cache_.end()) {
+ LOG4CXX_WARN(
+ logger_,
+ "Unknown session_key specified while removing secondary transport: "
+ << session_key);
+ } else {
+ secondary_transport_devices_cache_.erase(it);
+ }
+
+ {
+ sync_primitives::AutoLock auto_lock(applications_list_lock_ptr_);
+ ApplicationSharedPtr app = application(session_key);
+ if (!app) {
+ LOG4CXX_DEBUG(logger_,
+ "Application with id: " << session_key << " is not found");
+ return;
+ }
+
+ connection_handler::DeviceHandle device_handle = app->secondary_device();
+ if (device_handle == 0) {
+ LOG4CXX_WARN(
+ logger_,
+ "Secondary transport of app " << session_key << " is not found");
+ return;
+ }
+
+ app->set_secondary_device(0);
+ }
+
+ // notify the event to HMI through BC.UpdateAppList request
+ SendUpdateAppList();
+}
+
bool ApplicationManagerImpl::CheckAppIsNavi(const uint32_t app_id) const {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = application(app_id);
@@ -1629,7 +2376,12 @@ bool ApplicationManagerImpl::OnHandshakeDone(
using namespace helpers;
ApplicationSharedPtr app = application(connection_key);
- DCHECK_OR_RETURN(app, false);
+ if (!app) {
+ LOG4CXX_WARN(logger_,
+ "Application for connection key: " << connection_key
+ << " was not found");
+ return false;
+ }
if (Compare<SSLContext::HandshakeResult, EQ, ONE>(
result,
SSLContext::Handshake_Result_CertExpired,
@@ -1641,8 +2393,14 @@ bool ApplicationManagerImpl::OnHandshakeDone(
}
return false;
}
+#ifdef ENABLE_SECURITY
+bool ApplicationManagerImpl::OnPTUFailed() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return false;
+}
+#endif // ENABLE_SECURITY
-bool ApplicationManagerImpl::OnHandshakeFailed() {
+bool ApplicationManagerImpl::OnGetSystemTimeFailed() {
LOG4CXX_AUTO_TRACE(logger_);
return false;
}
@@ -1709,17 +2467,38 @@ void ApplicationManagerImpl::TerminateRequest(const uint32_t connection_key,
}
void ApplicationManagerImpl::RemoveHMIFakeParameters(
- application_manager::commands::MessageSharedPtr& message) {
+ application_manager::commands::MessageSharedPtr& message,
+ const hmi_apis::FunctionID::eType& function_id) {
LOG4CXX_AUTO_TRACE(logger_);
hmi_apis::HMI_API factory;
+ if (!(*message)[jhs::S_PARAMS].keyExists(jhs::S_FUNCTION_ID)) {
+ LOG4CXX_ERROR(logger_,
+ "RemoveHMIFakeParameters message missing function id");
+ return;
+ }
+ mobile_apis::FunctionID::eType mobile_function_id =
+ static_cast<mobile_apis::FunctionID::eType>(
+ (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
+ (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = function_id;
factory.attachSchema(*message, true);
+ (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = mobile_function_id;
}
-bool ApplicationManagerImpl::Init(resumption::LastState& last_state,
- media_manager::MediaManager* media_manager) {
+bool ApplicationManagerImpl::Init(resumption::LastState&,
+ media_manager::MediaManager*) {
+ return false;
+}
+
+bool ApplicationManagerImpl::Init(
+ resumption::LastStateWrapperPtr last_state_wrapper,
+ media_manager::MediaManager* media_manager) {
LOG4CXX_TRACE(logger_, "Init application manager");
- plugin_manager_.reset(new plugin_manager::RPCPluginManagerImpl(
- *this, *rpc_service_, *hmi_capabilities_, *policy_handler_));
+ plugin_manager_.reset(
+ new plugin_manager::RPCPluginManagerImpl(*this,
+ *rpc_service_,
+ *hmi_capabilities_,
+ *policy_handler_,
+ last_state_wrapper));
if (!plugin_manager_->LoadPlugins(get_settings().plugins_folder())) {
LOG4CXX_ERROR(logger_, "Plugins are not loaded");
return false;
@@ -1729,11 +2508,11 @@ bool ApplicationManagerImpl::Init(resumption::LastState& last_state,
!IsReadWriteAllowed(app_storage_folder, TYPE_STORAGE)) {
return false;
}
- if (!resume_controller().Init(last_state)) {
+ if (!resume_controller().Init(last_state_wrapper)) {
LOG4CXX_ERROR(logger_, "Problem with initialization of resume controller");
return false;
}
- hmi_capabilities_->Init(&last_state);
+ hmi_capabilities_->Init(last_state_wrapper);
if (!(file_system::IsWritingAllowed(app_storage_folder) &&
file_system::IsReadingAllowed(app_storage_folder))) {
@@ -1775,10 +2554,20 @@ bool ApplicationManagerImpl::Init(resumption::LastState& last_state,
app_launch_dto_.reset(new app_launch::AppLaunchDataDB(settings_));
} else {
app_launch_dto_.reset(
- new app_launch::AppLaunchDataJson(settings_, last_state));
+ new app_launch::AppLaunchDataJson(settings_, last_state_wrapper));
}
app_launch_ctrl_.reset(new app_launch::AppLaunchCtrlImpl(
*app_launch_dto_.get(), *this, settings_));
+
+ app_service_manager_.reset(
+ new application_manager::AppServiceManager(*this, last_state_wrapper));
+
+ auto on_app_policy_updated = [](plugin_manager::RPCPlugin& plugin) {
+ plugin.OnPolicyEvent(plugin_manager::kApplicationPolicyUpdated);
+ };
+
+ plugin_manager_->ForEachPlugin(on_app_policy_updated);
+
return true;
}
@@ -1789,6 +2578,12 @@ bool ApplicationManagerImpl::Stop() {
stopping_application_mng_lock_.Release();
application_list_update_timer_.Stop();
try {
+ if (unregister_reason_ ==
+ mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM) {
+ SetUnregisterAllApplicationsReason(
+ mobile_api::AppInterfaceUnregisteredReason::IGNITION_OFF);
+ }
+
UnregisterAllApplications();
} catch (...) {
LOG4CXX_ERROR(logger_,
@@ -1800,11 +2595,15 @@ bool ApplicationManagerImpl::Stop() {
LOG4CXX_DEBUG(logger_, "Unloading policy library.");
GetPolicyHandler().UnloadPolicyLibrary();
+ rpc_service_->Stop();
+
return true;
}
bool ApplicationManagerImpl::ConvertSOtoMessage(
- const smart_objects::SmartObject& message, Message& output) {
+ const smart_objects::SmartObject& message,
+ Message& output,
+ const bool allow_unknown_parameters) {
LOG4CXX_AUTO_TRACE(logger_);
if (smart_objects::SmartType_Null == message.getType() ||
@@ -1829,16 +2628,16 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
switch (protocol_type) {
case 0: {
if (protocol_version == 1) {
- if (!formatters::CFormatterJsonSDLRPCv1::toString(message,
- output_string)) {
+ if (!formatters::CFormatterJsonSDLRPCv1::toString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
output.set_protocol_version(
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1);
} else {
- if (!formatters::CFormatterJsonSDLRPCv2::toString(message,
- output_string)) {
+ if (!formatters::CFormatterJsonSDLRPCv2::toString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
@@ -1850,7 +2649,8 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
break;
}
case 1: {
- if (!formatters::FormatterJsonRpc::ToString(message, output_string)) {
+ if (!formatters::FormatterJsonRpc::ToString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
@@ -2005,8 +2805,24 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
}
const std::string policy_app_id(app_data[json::appId].asString());
- ApplicationSharedPtr registered_app =
- application_by_policy_id(policy_app_id);
+
+ connection_handler::DeviceHandle device_handle;
+ if (-1 == connection_handler().get_session_observer().GetDataOnSessionKey(
+ connection_key, nullptr, nullptr, &device_handle)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to create application: no connection info.");
+ continue;
+ }
+
+ std::string device_id;
+ if (-1 == connection_handler().get_session_observer().GetDataOnDeviceID(
+ device_handle, nullptr, nullptr, &device_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to create application: no connection info.");
+ continue;
+ }
+
+ ApplicationSharedPtr registered_app = application(device_id, policy_app_id);
if (registered_app) {
LOG4CXX_DEBUG(logger_,
"Application with the same id: "
@@ -2045,23 +2861,9 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
const std::string app_icon_dir(settings_.app_icons_folder());
const std::string full_icon_path(app_icon_dir + "/" + policy_app_id);
- connection_handler::DeviceHandle device_id = 0;
-
- if (-1 ==
- connection_handler().get_session_observer().GetDataOnSessionKey(
- connection_key, NULL, NULL, &device_id)) {
- LOG4CXX_ERROR(logger_,
- "Failed to create application: no connection info.");
- continue;
- }
-
- std::string device_mac;
- connection_handler().get_session_observer().GetDataOnDeviceID(
- device_id, NULL, NULL, &device_mac, NULL);
-
const uint32_t hmi_app_id =
- resume_controller().IsApplicationSaved(policy_app_id, device_mac)
- ? resume_controller().GetHMIApplicationID(policy_app_id, device_mac)
+ resume_controller().IsApplicationSaved(policy_app_id, device_id)
+ ? resume_controller().GetHMIApplicationID(policy_app_id, device_id)
: GenerateNewHMIAppID();
// AppId = 0 because this is query_app(provided by hmi for download, but not
@@ -2069,8 +2871,8 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
ApplicationSharedPtr app(
new ApplicationImpl(0,
policy_app_id,
- device_mac,
device_id,
+ device_handle,
appName,
GetPolicyHandler().GetStatisticManager(),
*this));
@@ -2149,6 +2951,17 @@ void ApplicationManagerImpl::updateRequestTimeout(
connection_key, mobile_correlation_id, new_timeout_value);
}
+void ApplicationManagerImpl::IncreaseForwardedRequestTimeout(
+ uint32_t connection_key, uint32_t mobile_correlation_id) {
+ LOG4CXX_DEBUG(logger_,
+ "Increasing Request Timeout by "
+ << get_settings().rpc_pass_through_timeout());
+ uint32_t new_timeout_value = get_settings().default_timeout() +
+ get_settings().rpc_pass_through_timeout();
+ request_ctrl_.updateRequestTimeout(
+ connection_key, mobile_correlation_id, new_timeout_value);
+}
+
uint32_t ApplicationManagerImpl::application_id(const int32_t correlation_id) {
// ykazakov: there is no erase for const iterator for QNX
std::map<const int32_t, const uint32_t>::iterator it =
@@ -2168,6 +2981,14 @@ void ApplicationManagerImpl::set_application_id(const int32_t correlation_id,
std::pair<const int32_t, const uint32_t>(correlation_id, app_id));
}
+uint32_t ApplicationManagerImpl::get_current_audio_source() const {
+ return current_audio_source_;
+}
+
+void ApplicationManagerImpl::set_current_audio_source(const uint32_t source) {
+ current_audio_source_ = source;
+}
+
void ApplicationManagerImpl::AddPolicyObserver(
policy::PolicyHandlerObserver* listener) {
GetPolicyHandler().add_listener(listener);
@@ -2260,10 +3081,14 @@ void ApplicationManagerImpl::ClearAppsPersistentData() {
void ApplicationManagerImpl::SendOnSDLClose() {
LOG4CXX_AUTO_TRACE(logger_);
-
+ if (IsLowVoltage()) {
+ LOG4CXX_TRACE(logger_, "SDL is in Low Voltage State");
+ return;
+ }
// must be sent to PASA HMI on shutdown synchronously
smart_objects::SmartObjectSPtr msg =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
(*msg)[strings::params][strings::function_id] =
hmi_apis::FunctionID::BasicCommunication_OnSDLClose;
@@ -2280,7 +3105,7 @@ void ApplicationManagerImpl::SendOnSDLClose() {
}
// SmartObject |message| has no way to declare priority for now
- utils::SharedPtr<Message> message_to_send(
+ std::shared_ptr<Message> message_to_send(
new Message(protocol_handler::MessagePriority::kDefault));
hmi_so_factory().attachSchema(*msg, false);
@@ -2288,15 +3113,11 @@ void ApplicationManagerImpl::SendOnSDLClose() {
logger_,
"Attached schema to message, result if valid: " << msg->isValid());
-#ifdef HMI_DBUS_API
- message_to_send->set_smart_object(*msg);
-#else
if (!ConvertSOtoMessage(*msg, *message_to_send)) {
LOG4CXX_WARN(logger_,
"Cannot send message to HMI: failed to create string");
return;
}
-#endif // HMI_DBUS_API
if (!hmi_handler_) {
LOG4CXX_WARN(logger_, "No HMI Handler set");
@@ -2340,6 +3161,21 @@ void ApplicationManagerImpl::UnregisterAllApplications() {
it = accessor.GetData().begin();
}
}
+
+ bool send_pending_update_app_list = false;
+ {
+ sync_primitives::AutoLock auto_lock(apps_to_register_list_lock_ptr_);
+ if (!apps_to_register_.empty()) {
+ send_pending_update_app_list = true;
+ apps_to_register_.clear();
+ }
+ }
+
+ // Only send update app list if pending apps were removed.
+ if (send_pending_update_app_list) {
+ SendUpdateAppList();
+ }
+
if (is_ignition_off) {
resume_controller().OnIgnitionOff();
}
@@ -2348,18 +3184,24 @@ void ApplicationManagerImpl::UnregisterAllApplications() {
void ApplicationManagerImpl::RemoveAppsWaitingForRegistration(
const connection_handler::DeviceHandle handle) {
+ LOG4CXX_AUTO_TRACE(logger_);
DevicePredicate device_finder(handle);
apps_to_register_list_lock_ptr_->Acquire();
- AppsWaitRegistrationSet::iterator it_app = std::find_if(
- apps_to_register_.begin(), apps_to_register_.end(), device_finder);
-
- while (apps_to_register_.end() != it_app) {
- LOG4CXX_DEBUG(logger_,
- "Waiting app: " << (*it_app)->name().c_str()
- << " is removed.");
- apps_to_register_.erase(it_app);
- it_app = std::find_if(
- apps_to_register_.begin(), apps_to_register_.end(), device_finder);
+ std::vector<ApplicationSharedPtr> apps_to_remove;
+ std::copy_if(apps_to_register_.begin(),
+ apps_to_register_.end(),
+ std::back_inserter(apps_to_remove),
+ device_finder);
+
+ const auto enabled_local_apps = policy_handler_->GetEnabledLocalApps();
+ for (auto app : apps_to_remove) {
+ const bool is_app_enabled =
+ helpers::in_range(enabled_local_apps, app->policy_app_id());
+ if (!is_app_enabled) {
+ LOG4CXX_DEBUG(logger_,
+ "Waiting app: " << app->name().c_str() << " is removed.");
+ apps_to_register_.erase(app);
+ }
}
apps_to_register_list_lock_ptr_->Release();
@@ -2377,6 +3219,8 @@ void ApplicationManagerImpl::UnregisterApplication(
<< is_unexpected_disconnect);
size_t subscribed_for_way_points_app_count = 0;
+ GetAppServiceManager().UnpublishServices(app_id);
+
// SDL sends UnsubscribeWayPoints only for last application
{
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
@@ -2387,6 +3231,7 @@ void ApplicationManagerImpl::UnregisterApplication(
LOG4CXX_ERROR(logger_, "Send UnsubscribeWayPoints");
MessageHelper::SendUnsubscribedWayPoints(*this);
}
+ EndNaviServices(app_id);
{
sync_primitives::AutoLock lock(navi_service_status_lock_);
@@ -2439,6 +3284,7 @@ void ApplicationManagerImpl::UnregisterApplication(
if (app_id == (*it_app)->app_id()) {
app_to_remove = *it_app;
applications_.erase(it_app++);
+ break;
} else {
++it_app;
}
@@ -2453,22 +3299,38 @@ void ApplicationManagerImpl::UnregisterApplication(
return;
}
+
if (is_resuming) {
resume_controller().SaveApplication(app_to_remove);
} else {
resume_controller().RemoveApplicationFromSaved(app_to_remove);
}
+
(hmi_capabilities_->get_hmi_language_handler())
.OnUnregisterApplication(app_id);
- AppV4DevicePredicate finder(handle);
- ApplicationSharedPtr app = FindApp(applications(), finder);
- if (!app) {
- LOG4CXX_DEBUG(
- logger_, "There is no more SDL4 apps with device handle: " << handle);
- RemoveAppsWaitingForRegistration(handle);
- SendUpdateAppList();
+ if (connection_handler().GetDeviceID(app_to_remove->mac_address(),
+ &handle)) {
+ AppV4DevicePredicate finder(handle);
+ ApplicationSharedPtr app = FindApp(applications(), finder);
+ if (!app) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "There is no more SDL4 apps with device handle: " << handle);
+
+ RemoveAppsWaitingForRegistration(handle);
+ }
+ }
+ const auto enabled_local_apps = policy_handler_->GetEnabledLocalApps();
+ if (helpers::in_range(enabled_local_apps, app_to_remove->policy_app_id())) {
+ LOG4CXX_DEBUG(logger_,
+ "Enabled local app has been unregistered. Re-create "
+ "pending application");
+ CreatePendingLocalApplication(app_to_remove->policy_app_id());
}
+
+ RefreshCloudAppInformation();
+ SendUpdateAppList();
}
commands_holder_->Clear(app_to_remove);
@@ -2488,6 +3350,9 @@ void ApplicationManagerImpl::UnregisterApplication(
MessageHelper::SendOnAppUnregNotificationToHMI(
app_to_remove, is_unexpected_disconnect, *this);
request_ctrl_.terminateAppRequests(app_id);
+ if (applications_.empty()) {
+ policy_handler_->StopRetrySequence();
+ }
return;
}
@@ -2498,6 +3363,7 @@ void ApplicationManagerImpl::OnAppUnauthorized(const uint32_t& app_id) {
mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
const ApplicationSharedPtr app,
+ const WindowID window_id,
const std::string& function_id,
const RPCParams& rpc_params,
CommandParametersPermissions* params_permissions) {
@@ -2510,7 +3376,8 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
DCHECK(app);
policy::CheckPermissionResult result;
- GetPolicyHandler().CheckPermissions(app, function_id, rpc_params, result);
+ GetPolicyHandler().CheckPermissions(
+ app, window_id, function_id, rpc_params, result);
if (NULL != params_permissions) {
params_permissions->allowed_params = result.list_of_allowed_params;
@@ -2518,7 +3385,9 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
params_permissions->undefined_params = result.list_of_undefined_params;
}
- if (app->hmi_level() == mobile_apis::HMILevel::HMI_NONE &&
+ // Record statistics for default window only
+ if (app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_apis::HMILevel::HMI_NONE &&
function_id != MessageHelper::StringifiedFunctionID(
mobile_apis::FunctionID::UnregisterAppInterfaceID)) {
if (result.hmi_level_permitted != policy::kRpcAllowed) {
@@ -2529,7 +3398,8 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
#ifdef ENABLE_LOG
const std::string log_msg =
"Application: " + app->policy_app_id() + ", RPC: " + function_id +
- ", HMI status: " + MessageHelper::StringifiedHMILevel(app->hmi_level());
+ ", window_id: " + std::to_string(window_id) + ", HMI status: " +
+ MessageHelper::StringifiedHMILevel(app->hmi_level(window_id));
#endif // ENABLE_LOG
if (result.hmi_level_permitted != policy::kRpcAllowed) {
LOG4CXX_WARN(logger_, "Request is blocked by policies. " << log_msg);
@@ -2561,14 +3431,24 @@ bool ApplicationManagerImpl::is_audio_pass_thru_active() const {
void ApplicationManagerImpl::OnLowVoltage() {
LOG4CXX_AUTO_TRACE(logger_);
is_low_voltage_ = true;
+ resume_ctrl_->SaveLowVoltageTime();
+ resume_ctrl_->StopSavePersistentDataTimer();
request_ctrl_.OnLowVoltage();
}
-bool ApplicationManagerImpl::IsLowVoltage() {
- LOG4CXX_TRACE(logger_, "result: " << is_low_voltage_);
+bool ApplicationManagerImpl::IsLowVoltage() const {
+ LOG4CXX_TRACE(logger_, "Result: " << is_low_voltage_);
return is_low_voltage_;
}
+void ApplicationManagerImpl::OnWakeUp() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ resume_ctrl_->SaveWakeUpTime();
+ resume_ctrl_->StartSavePersistentDataTimer();
+ request_ctrl_.OnWakeUp();
+ is_low_voltage_ = false;
+}
+
std::string ApplicationManagerImpl::GetHashedAppID(
uint32_t connection_key, const std::string& mobile_app_id) const {
connection_handler::DeviceHandle device_id = 0;
@@ -2581,10 +3461,12 @@ std::string ApplicationManagerImpl::GetHashedAppID(
return mobile_app_id + device_name;
}
-bool ApplicationManagerImpl::HMILevelAllowsStreaming(
+bool ApplicationManagerImpl::HMIStateAllowsStreaming(
uint32_t app_id, protocol_handler::ServiceType service_type) const {
LOG4CXX_AUTO_TRACE(logger_);
using namespace mobile_apis::HMILevel;
+ using namespace mobile_apis::PredefinedWindows;
+ using namespace mobile_apis::VideoStreamingState;
using namespace helpers;
ApplicationSharedPtr app = application(app_id);
@@ -2592,7 +3474,15 @@ bool ApplicationManagerImpl::HMILevelAllowsStreaming(
LOG4CXX_WARN(logger_, "An application is not registered.");
return false;
}
- return Compare<eType, EQ, ONE>(app->hmi_level(), HMI_FULL, HMI_LIMITED);
+
+ const auto hmi_state = app->CurrentHmiState(DEFAULT_WINDOW);
+ const bool allow_streaming_by_hmi_level =
+ Compare<mobile_apis::HMILevel::eType, EQ, ONE>(
+ hmi_state->hmi_level(), HMI_FULL, HMI_LIMITED);
+ const bool allow_streaming_by_streaming_state =
+ hmi_state->video_streaming_state() == STREAMABLE;
+
+ return allow_streaming_by_hmi_level && allow_streaming_by_streaming_state;
}
bool ApplicationManagerImpl::CanAppStream(
@@ -2615,7 +3505,7 @@ bool ApplicationManagerImpl::CanAppStream(
LOG4CXX_WARN(logger_, "Unsupported service_type " << service_type);
}
- return HMILevelAllowsStreaming(app_id, service_type) && is_allowed;
+ return HMIStateAllowsStreaming(app_id, service_type) && is_allowed;
}
void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) {
@@ -2632,16 +3522,70 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) {
return;
}
- if (navi_app_to_stop_.end() != std::find(navi_app_to_stop_.begin(),
- navi_app_to_stop_.end(),
- app_id) ||
- navi_app_to_end_stream_.end() !=
- std::find(navi_app_to_end_stream_.begin(),
- navi_app_to_end_stream_.end(),
- app_id)) {
+ {
+ sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
+ if (navi_app_to_stop_.end() != std::find(navi_app_to_stop_.begin(),
+ navi_app_to_stop_.end(),
+ app_id) ||
+ navi_app_to_end_stream_.end() !=
+ std::find(navi_app_to_end_stream_.begin(),
+ navi_app_to_end_stream_.end(),
+ app_id)) {
+ return;
+ }
+ }
+
+ bool unregister = false;
+ {
+ sync_primitives::AutoLock lock(navi_service_status_lock_);
+
+ NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
+ if (navi_service_status_.end() == it ||
+ (!it->second.first && !it->second.second)) {
+ unregister = true;
+ }
+ }
+ if (unregister) {
+ rpc_service_->ManageMobileCommand(
+ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
+ app_id, PROTOCOL_VIOLATION),
+ commands::Command::SOURCE_SDL);
+ UnregisterApplication(app_id, ABORTED);
+ return;
+ }
+ EndNaviServices(app_id);
+}
+
+void ApplicationManagerImpl::ForbidStreaming(
+ uint32_t app_id, protocol_handler::ServiceType service_type) {
+ using namespace mobile_apis::AppInterfaceUnregisteredReason;
+ using namespace mobile_apis::Result;
+ using namespace protocol_handler;
+
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app = application(app_id);
+ if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "There is no navi or projection application with id: " << app_id);
return;
}
+ {
+ sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
+
+ if (navi_app_to_stop_.end() != std::find(navi_app_to_stop_.begin(),
+ navi_app_to_stop_.end(),
+ app_id) ||
+ navi_app_to_end_stream_.end() !=
+ std::find(navi_app_to_end_stream_.begin(),
+ navi_app_to_end_stream_.end(),
+ app_id)) {
+ return;
+ }
+ }
+
bool unregister = false;
{
sync_primitives::AutoLock lock(navi_service_status_lock_);
@@ -2660,6 +3604,18 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) {
UnregisterApplication(app_id, ABORTED);
return;
}
+
+ if (ServiceType::kMobileNav == service_type &&
+ app->video_streaming_allowed()) {
+ LOG4CXX_DEBUG(logger_, "Video streaming is still allowed");
+ return;
+ }
+
+ if (ServiceType::kAudio == service_type && app->audio_streaming_allowed()) {
+ LOG4CXX_DEBUG(logger_, "Audio streaming is still allowed");
+ return;
+ }
+
EndNaviServices(app_id);
}
@@ -2681,7 +3637,7 @@ void ApplicationManagerImpl::OnAppStreaming(
media_manager_->StartStreaming(app_id, service_type);
} else {
media_manager_->StopStreaming(app_id, service_type);
- state_ctrl_.OnVideoStreamingStarted(app);
+ state_ctrl_.OnVideoStreamingStopped(app);
}
}
@@ -2722,25 +3678,28 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) {
connection_handler().SendEndService(app_id, ServiceType::kAudio);
app->StopStreamingForce(ServiceType::kAudio);
}
+
DisallowStreaming(app_id);
- navi_app_to_stop_.push_back(app_id);
+ {
+ sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
+ navi_app_to_stop_.push_back(app_id);
+ }
- TimerSPtr close_timer(utils::MakeShared<timer::Timer>(
+ TimerSPtr close_timer(std::make_shared<timer::Timer>(
"CloseNaviAppTimer",
new TimerTaskImpl<ApplicationManagerImpl>(
this, &ApplicationManagerImpl::CloseNaviApp)));
close_timer->Start(navi_close_app_timeout_, timer::kSingleShot);
- sync_primitives::AutoLock lock(timer_pool_lock_);
- timer_pool_.push_back(close_timer);
+ sync_primitives::AutoLock lock(close_app_timer_pool_lock_);
+ close_app_timer_pool_.push_back(close_timer);
}
}
-void ApplicationManagerImpl::OnHMILevelChanged(
- uint32_t app_id,
- mobile_apis::HMILevel::eType from,
- mobile_apis::HMILevel::eType to) {
+void ApplicationManagerImpl::OnHMIStateChanged(const uint32_t app_id,
+ const HmiStatePtr from,
+ const HmiStatePtr to) {
LOG4CXX_AUTO_TRACE(logger_);
ProcessPostponedMessages(app_id);
ProcessApp(app_id, from, to);
@@ -2756,14 +3715,16 @@ void ApplicationManagerImpl::ProcessPostponedMessages(const uint32_t app_id) {
}
MobileMessageQueue messages;
app->SwapMobileMessageQueue(messages);
- auto push_allowed_messages = [this, &app](
- smart_objects::SmartObjectSPtr message) {
+ auto push_allowed_messages = [this,
+ &app](smart_objects::SmartObjectSPtr message) {
const std::string function_id = MessageHelper::StringifiedFunctionID(
static_cast<mobile_apis::FunctionID::eType>(
(*message)[strings::params][strings::function_id].asUInt()));
+ const WindowID window_id = MessageHelper::ExtractWindowIdFromSmartObject(
+ (*message)[strings::msg_params]);
const RPCParams params;
const mobile_apis::Result::eType check_result =
- CheckPolicyPermissions(app, function_id, params);
+ CheckPolicyPermissions(app, window_id, function_id, params);
if (mobile_api::Result::SUCCESS == check_result) {
rpc_service_->ManageMobileCommand(message, commands::Command::SOURCE_SDL);
} else {
@@ -2773,109 +3734,169 @@ void ApplicationManagerImpl::ProcessPostponedMessages(const uint32_t app_id) {
std::for_each(messages.begin(), messages.end(), push_allowed_messages);
}
+void ApplicationManagerImpl::ProcessOnDataStreamingNotification(
+ const protocol_handler::ServiceType service_type,
+ const uint32_t app_id,
+ const bool streaming_data_available) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ bool should_send_notification = false;
+
+ {
+ sync_primitives::AutoLock lock(streaming_services_lock_);
+ auto& active_services = streaming_application_services_[service_type];
+ should_send_notification = active_services.empty();
+ if (streaming_data_available) {
+ active_services.insert(app_id);
+ LOG4CXX_DEBUG(logger_,
+ "Streaming session with id "
+ << app_id << " for service "
+ << static_cast<uint32_t>(service_type)
+ << " was added. Currently streaming sessions count: "
+ << active_services.size());
+ } else {
+ active_services.erase(app_id);
+ should_send_notification =
+ !should_send_notification && active_services.empty();
+
+ LOG4CXX_DEBUG(logger_,
+ "Streaming session with id "
+ << app_id << " for service "
+ << static_cast<uint32_t>(service_type)
+ << " was removed. Currently streaming sessions count: "
+ << active_services.size());
+ }
+ }
+
+ if (should_send_notification) {
+ MessageHelper::SendOnDataStreaming(
+ service_type, streaming_data_available, *this);
+ }
+}
+
void ApplicationManagerImpl::ProcessApp(const uint32_t app_id,
- const mobile_apis::HMILevel::eType from,
- const mobile_apis::HMILevel::eType to) {
+ const HmiStatePtr from,
+ const HmiStatePtr to) {
using namespace mobile_apis::HMILevel;
+ using namespace mobile_apis::VideoStreamingState;
using namespace helpers;
- if (from == to) {
- LOG4CXX_TRACE(logger_, "HMILevel from = to");
- return;
- }
-
ApplicationSharedPtr app = application(app_id);
if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) {
LOG4CXX_ERROR(logger_, "Navi/Projection application not found");
return;
}
- if (to == HMI_FULL || to == HMI_LIMITED) {
- LOG4CXX_TRACE(logger_, "HMILevel to FULL or LIMITED");
- if (from == HMI_BACKGROUND) {
- LOG4CXX_TRACE(logger_, "HMILevel from BACKGROUND");
- AllowStreaming(app_id);
- }
- } else if (to == HMI_BACKGROUND) {
- LOG4CXX_TRACE(logger_, "HMILevel to BACKGROUND");
- if (from == HMI_FULL || from == HMI_LIMITED) {
- LOG4CXX_TRACE(logger_, "HMILevel from FULL or LIMITED");
- navi_app_to_end_stream_.push_back(app_id);
- TimerSPtr end_stream_timer(utils::MakeShared<timer::Timer>(
- "AppShouldFinishStreaming",
- new TimerTaskImpl<ApplicationManagerImpl>(
- this, &ApplicationManagerImpl::EndNaviStreaming)));
- end_stream_timer->Start(navi_end_stream_timeout_, timer::kPeriodic);
+ const auto hmi_level_from = from->hmi_level();
+ const auto hmi_level_to = to->hmi_level();
+ const auto streaming_state_from = from->video_streaming_state();
+ const auto streaming_state_to = to->video_streaming_state();
- sync_primitives::AutoLock lock(timer_pool_lock_);
- timer_pool_.push_back(end_stream_timer);
- }
- } else if (to == HMI_NONE) {
- LOG4CXX_TRACE(logger_, "HMILevel to NONE");
- if (from == HMI_FULL || from == HMI_LIMITED || from == HMI_BACKGROUND) {
- EndNaviServices(app_id);
- }
+ if (hmi_level_from == hmi_level_to &&
+ streaming_state_from == streaming_state_to) {
+ LOG4CXX_TRACE(logger_, "HMILevel && streaming state were not changed");
+ return;
}
-}
-
-void ApplicationManagerImpl::SendHMIStatusNotification(
- const utils::SharedPtr<Application> app) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(app);
- smart_objects::SmartObjectSPtr notification =
- utils::MakeShared<smart_objects::SmartObject>();
- smart_objects::SmartObject& message = *notification;
-
- message[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_api::FunctionID::OnHMIStatusID);
- message[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
+ auto full_or_limited_hmi_level = [](mobile_apis::HMILevel::eType hmi_level) {
+ return Compare<mobile_apis::HMILevel::eType, EQ, ONE>(
+ hmi_level, HMI_FULL, HMI_LIMITED);
+ };
- message[strings::params][strings::connection_key] =
- static_cast<int32_t>(app->app_id());
+ const bool allow_streaming_by_streaming_state =
+ NOT_STREAMABLE == streaming_state_from &&
+ STREAMABLE == streaming_state_to;
+ const bool allow_streaming_by_hmi_level =
+ HMI_BACKGROUND == hmi_level_from &&
+ full_or_limited_hmi_level(hmi_level_to) &&
+ STREAMABLE == streaming_state_to;
+ if (allow_streaming_by_streaming_state || allow_streaming_by_hmi_level) {
+ LOG4CXX_TRACE(logger_,
+ "Allow streaming by streaming state: "
+ << std::boolalpha << allow_streaming_by_streaming_state
+ << "; by hmi level: " << std::boolalpha
+ << allow_streaming_by_hmi_level);
+ AllowStreaming(app_id);
+ return;
+ }
- message[strings::msg_params][strings::hmi_level] =
- static_cast<int32_t>(app->hmi_level());
+ const bool end_streaming_by_streaming_state =
+ STREAMABLE == streaming_state_from &&
+ NOT_STREAMABLE == streaming_state_to &&
+ full_or_limited_hmi_level(hmi_level_to);
+ const bool start_timer_by_hmi_level =
+ full_or_limited_hmi_level(hmi_level_from) &&
+ HMI_BACKGROUND == hmi_level_to;
+ if (end_streaming_by_streaming_state || start_timer_by_hmi_level) {
+ LOG4CXX_TRACE(logger_,
+ "Start EndStream timer by streaming state: "
+ << std::boolalpha << end_streaming_by_streaming_state
+ << "; by hmi level: " << std::boolalpha
+ << start_timer_by_hmi_level);
+ StartEndStreamTimer(app_id);
+ return;
+ }
- message[strings::msg_params][strings::audio_streaming_state] =
- static_cast<int32_t>(app->audio_streaming_state());
+ const bool end_streaming_by_hmi_level =
+ full_or_limited_hmi_level(hmi_level_from) && HMI_NONE == hmi_level_to;
+ if (end_streaming_by_hmi_level) {
+ LOG4CXX_TRACE(logger_,
+ "End streaming services by hmi level: "
+ << std::boolalpha << end_streaming_by_hmi_level);
+ EndNaviServices(app_id);
+ return;
+ }
- message[strings::msg_params][strings::video_streaming_state] =
- static_cast<int32_t>(app->video_streaming_state());
+ LOG4CXX_TRACE(logger_, "No actions required for app " << app_id);
+}
- message[strings::msg_params][strings::system_context] =
- static_cast<int32_t>(app->system_context());
+void ApplicationManagerImpl::StartEndStreamTimer(const uint32_t app_id) {
+ LOG4CXX_DEBUG(logger_, "Start end stream timer for app " << app_id);
+ navi_app_to_end_stream_.push_back(app_id);
+ TimerSPtr end_stream_timer(std::make_shared<timer::Timer>(
+ "DisallowAppStreamTimer",
+ new TimerTaskImpl<ApplicationManagerImpl>(
+ this, &ApplicationManagerImpl::EndNaviStreaming)));
+ end_stream_timer->Start(navi_end_stream_timeout_, timer::kSingleShot);
- rpc_service_->ManageMobileCommand(notification,
- commands::Command::SOURCE_SDL);
+ sync_primitives::AutoLock lock(end_stream_timer_pool_lock_);
+ end_stream_timer_pool_.push_back(end_stream_timer);
}
void ApplicationManagerImpl::ClearTimerPool() {
LOG4CXX_AUTO_TRACE(logger_);
+ {
+ sync_primitives::AutoLock lock(close_app_timer_pool_lock_);
- std::vector<TimerSPtr> new_timer_pool;
-
- sync_primitives::AutoLock lock(timer_pool_lock_);
- new_timer_pool.push_back(timer_pool_[0]);
-
- for (size_t i = 1; i < timer_pool_.size(); ++i) {
- if (timer_pool_[i]->is_running()) {
- new_timer_pool.push_back(timer_pool_[i]);
- }
+ close_app_timer_pool_.erase(
+ std::remove_if(close_app_timer_pool_.begin(),
+ close_app_timer_pool_.end(),
+ [](TimerSPtr timer) { return !timer->is_running(); }),
+ close_app_timer_pool_.end());
}
- timer_pool_.swap(new_timer_pool);
- new_timer_pool.clear();
+ {
+ sync_primitives::AutoLock lock(end_stream_timer_pool_lock_);
+ end_stream_timer_pool_.erase(
+ std::remove_if(end_stream_timer_pool_.begin(),
+ end_stream_timer_pool_.end(),
+ [](TimerSPtr timer) { return !timer->is_running(); }),
+ end_stream_timer_pool_.end());
+ }
}
void ApplicationManagerImpl::CloseNaviApp() {
LOG4CXX_AUTO_TRACE(logger_);
using namespace mobile_apis::AppInterfaceUnregisteredReason;
using namespace mobile_apis::Result;
- DCHECK_OR_RETURN_VOID(!navi_app_to_stop_.empty());
- uint32_t app_id = navi_app_to_stop_.front();
- navi_app_to_stop_.pop_front();
+ uint32_t app_id;
+
+ {
+ sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
+ DCHECK_OR_RETURN_VOID(!navi_app_to_stop_.empty());
+ app_id = navi_app_to_stop_.front();
+ navi_app_to_stop_.pop_front();
+ }
bool unregister = false;
{
@@ -2885,6 +3906,7 @@ void ApplicationManagerImpl::CloseNaviApp() {
if (navi_service_status_.end() != it) {
if (it->second.first || it->second.second) {
unregister = true;
+ navi_service_status_.erase(it);
}
}
}
@@ -2908,9 +3930,13 @@ void ApplicationManagerImpl::EndNaviStreaming() {
const uint32_t app_id = navi_app_to_end_stream_.front();
navi_app_to_end_stream_.pop_front();
- if (navi_app_to_stop_.end() ==
- std::find(navi_app_to_stop_.begin(), navi_app_to_stop_.end(), app_id)) {
- DisallowStreaming(app_id);
+ {
+ sync_primitives::AutoLock lock(navi_app_to_stop_lock_);
+ if (navi_app_to_stop_.end() == std::find(navi_app_to_stop_.begin(),
+ navi_app_to_stop_.end(),
+ app_id)) {
+ DisallowStreaming(app_id);
+ }
}
}
}
@@ -2972,14 +3998,14 @@ bool ApplicationManagerImpl::IsApplicationForbidden(
}
bool ApplicationManagerImpl::IsAppInReconnectMode(
+ const connection_handler::DeviceHandle& device_id,
const std::string& policy_app_id) const {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock lock(reregister_wait_list_lock_);
+ sync_primitives::AutoLock lock(reregister_wait_list_lock_ptr_);
return reregister_wait_list_.end() !=
std::find_if(reregister_wait_list_.begin(),
reregister_wait_list_.end(),
- std::bind1st(std::ptr_fun(&policy_app_id_comparator),
- policy_app_id));
+ PolicyAppIdComparator(device_id, policy_app_id));
}
policy::DeviceConsent ApplicationManagerImpl::GetUserConsentForDevice(
@@ -2987,17 +4013,11 @@ policy::DeviceConsent ApplicationManagerImpl::GetUserConsentForDevice(
return GetPolicyHandler().GetUserConsentForDevice(device_id);
}
-void ApplicationManagerImpl::OnWakeUp() {
- LOG4CXX_AUTO_TRACE(logger_);
- is_low_voltage_ = false;
- request_ctrl_.OnWakeUp();
-}
-
mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary(
const std::vector<uint8_t>& binary_data,
const std::string& file_path,
const std::string& file_name,
- const int64_t offset) {
+ const uint64_t offset) {
LOG4CXX_DEBUG(logger_,
"SaveBinaryWithOffset binary_size = "
<< binary_data.size() << " offset = " << offset);
@@ -3008,7 +4028,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary(
}
const std::string full_file_path = file_path + "/" + file_name;
- const int64_t file_size = file_system::FileSize(full_file_path);
+ const uint64_t file_size = file_system::FileSize(full_file_path);
std::ofstream* file_stream;
if (offset != 0) {
if (file_size != offset) {
@@ -3075,11 +4095,17 @@ bool ApplicationManagerImpl::IsHMICooperating() const {
void ApplicationManagerImpl::OnApplicationListUpdateTimer() {
LOG4CXX_DEBUG(logger_, "Application list update timer finished");
+ const bool is_new_app_registered = registered_during_timer_execution_;
+ registered_during_timer_execution_ = false;
apps_to_register_list_lock_ptr_->Acquire();
const bool trigger_ptu = apps_size_ != applications_.size();
apps_to_register_list_lock_ptr_->Release();
- SendUpdateAppList();
+
+ if (is_new_app_registered) {
+ SendUpdateAppList();
+ }
+
GetPolicyHandler().OnAppsSearchCompleted(trigger_ptu);
}
@@ -3087,14 +4113,14 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() {
std::vector<uint32_t> app_list;
{
sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_);
- std::map<uint32_t, TimevalStruct>::iterator it =
+ std::map<uint32_t, date_time::TimeDuration>::iterator it =
tts_global_properties_app_list_.begin();
- std::map<uint32_t, TimevalStruct>::iterator it_end =
+ std::map<uint32_t, date_time::TimeDuration>::iterator it_end =
tts_global_properties_app_list_.end();
date_time::TimeCompare time_comp;
for (; it != it_end; ++it) {
- time_comp = date_time::DateTime::compareTime(
- date_time::DateTime::getCurrentTime(), it->second);
+ time_comp =
+ date_time::compareTime(date_time::getCurrentTime(), it->second);
if (date_time::GREATER == time_comp || date_time::EQUAL == time_comp) {
app_list.push_back(it->first);
}
@@ -3115,8 +4141,8 @@ void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList(
const uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
uint16_t timeout = get_settings().tts_global_properties_timeout();
- TimevalStruct current_time = date_time::DateTime::getCurrentTime();
- current_time.tv_sec += timeout;
+ date_time::TimeDuration current_time = date_time::getCurrentTime();
+ current_time += date_time::seconds(timeout);
// please avoid AutoLock usage to avoid deadlock
tts_global_properties_app_list_lock_.Acquire();
if (tts_global_properties_app_list_.end() ==
@@ -3139,7 +4165,7 @@ void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList(
LOG4CXX_AUTO_TRACE(logger_);
// please avoid AutoLock usage to avoid deadlock
tts_global_properties_app_list_lock_.Acquire();
- std::map<uint32_t, TimevalStruct>::iterator it =
+ std::map<uint32_t, date_time::TimeDuration>::iterator it =
tts_global_properties_app_list_.find(app_id);
if (tts_global_properties_app_list_.end() != it) {
tts_global_properties_app_list_.erase(it);
@@ -3184,6 +4210,39 @@ mobile_apis::AppHMIType::eType ApplicationManagerImpl::StringToAppHMIType(
}
}
+const std::string ApplicationManagerImpl::AppHMITypeToString(
+ mobile_apis::AppHMIType::eType type) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ switch (type) {
+ case mobile_apis::AppHMIType::DEFAULT:
+ return "DEFAULT";
+ case mobile_apis::AppHMIType::COMMUNICATION:
+ return "COMMUNICATION";
+ case mobile_apis::AppHMIType::MEDIA:
+ return "MEDIA";
+ case mobile_apis::AppHMIType::MESSAGING:
+ return "MESSAGING";
+ case mobile_apis::AppHMIType::NAVIGATION:
+ return "NAVIGATION";
+ case mobile_apis::AppHMIType::INFORMATION:
+ return "INFORMATION";
+ case mobile_apis::AppHMIType::SOCIAL:
+ return "SOCIAL";
+ case mobile_apis::AppHMIType::BACKGROUND_PROCESS:
+ return "BACKGROUND_PROCESS";
+ case mobile_apis::AppHMIType::TESTING:
+ return "TESTING";
+ case mobile_apis::AppHMIType::SYSTEM:
+ return "SYSTEM";
+ case mobile_apis::AppHMIType::PROJECTION:
+ return "PROJECTION";
+ case mobile_apis::AppHMIType::REMOTE_CONTROL:
+ return "REMOTE_CONTROL";
+ default:
+ return "INVALID_ENUM";
+ }
+}
+
bool ApplicationManagerImpl::CompareAppHMIType(
const smart_objects::SmartObject& from_policy,
const smart_objects::SmartObject& from_application) {
@@ -3254,13 +4313,18 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
if (flag_diffirence_app_hmi_type) {
(*it)->set_app_types(transform_app_hmi_types);
(*it)->ChangeSupportingAppHMIType();
- if ((*it)->hmi_level() == mobile_api::HMILevel::HMI_BACKGROUND) {
+ const mobile_apis::HMILevel::eType app_hmi_level =
+ (*it)->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ if (app_hmi_level == mobile_api::HMILevel::HMI_BACKGROUND) {
MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
- } else if (((*it)->hmi_level() == mobile_api::HMILevel::HMI_FULL) ||
- ((*it)->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)) {
+ } else if ((app_hmi_level == mobile_api::HMILevel::HMI_FULL) ||
+ (app_hmi_level == mobile_api::HMILevel::HMI_LIMITED)) {
MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
state_controller().SetRegularState(
- *it, mobile_apis::HMILevel::HMI_BACKGROUND, true);
+ *it,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_BACKGROUND,
+ true);
}
}
}
@@ -3276,11 +4340,11 @@ void ApplicationManagerImpl::EraseAppFromReconnectionList(
}
const auto policy_app_id = app->policy_app_id();
- sync_primitives::AutoLock lock(reregister_wait_list_lock_);
- auto app_it = std::find_if(
- reregister_wait_list_.begin(),
- reregister_wait_list_.end(),
- std::bind1st(std::ptr_fun(&policy_app_id_comparator), policy_app_id));
+ sync_primitives::AutoLock lock(reregister_wait_list_lock_ptr_);
+ auto app_it =
+ std::find_if(reregister_wait_list_.begin(),
+ reregister_wait_list_.end(),
+ PolicyAppIdComparator(app->device(), policy_app_id));
if (reregister_wait_list_.end() != app_it) {
reregister_wait_list_.erase(app_it);
}
@@ -3312,8 +4376,18 @@ void ApplicationManagerImpl::ProcessReconnection(
void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) {
LOG4CXX_AUTO_TRACE(logger_);
if (!ptu_result) {
+ protocol_handler_->ProcessFailedPTU();
return;
}
+
+ RefreshCloudAppInformation();
+
+ auto app_id = policy_handler_->GetAppIdForSending();
+ auto app = application(app_id);
+ if (app) {
+ SendGetIconUrlNotifications(app->app_id(), app);
+ }
+
auto on_app_policy_updated = [](plugin_manager::RPCPlugin& plugin) {
plugin.OnPolicyEvent(plugin_manager::kApplicationPolicyUpdated);
};
@@ -3321,26 +4395,152 @@ void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) {
plugin_manager_->ForEachPlugin(on_app_policy_updated);
}
-void ApplicationManagerImpl::PutDriverDistractionMessageToPostponed(
- ApplicationSharedPtr application) const {
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
+void ApplicationManagerImpl::OnCertDecryptFinished(const bool decrypt_result) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!decrypt_result) {
+ protocol_handler_->ProcessFailedCertDecrypt();
+ }
+}
+
+bool ApplicationManagerImpl::OnCertDecryptFailed() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return false;
+}
+#endif
+
+void ApplicationManagerImpl::OnPTUTimeoutExceeded() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ protocol_handler_->ProcessFailedPTU();
+}
+
+void ApplicationManagerImpl::SendDriverDistractionState(
+ ApplicationSharedPtr application) {
LOG4CXX_AUTO_TRACE(logger_);
if (hmi_apis::Common_DriverDistractionState::INVALID_ENUM ==
driver_distraction_state()) {
LOG4CXX_WARN(logger_, "DriverDistractionState is INVALID_ENUM");
return;
}
- smart_objects::SmartObjectSPtr on_driver_distraction =
- utils::MakeShared<smart_objects::SmartObject>();
- (*on_driver_distraction)[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
- (*on_driver_distraction)[strings::params][strings::function_id] =
- mobile_api::FunctionID::OnDriverDistractionID;
- (*on_driver_distraction)[strings::msg_params][mobile_notification::state] =
- driver_distraction_state();
- (*on_driver_distraction)[strings::params][strings::connection_key] =
- application->app_id();
- application->PushMobileMessage(on_driver_distraction);
+ auto create_notification = [application, this]() {
+ auto notification = std::make_shared<smart_objects::SmartObject>();
+ auto& msg_params = (*notification)[strings::msg_params];
+ auto& params = (*notification)[strings::params];
+
+ params[strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ params[strings::function_id] =
+ static_cast<int32_t>(mobile_apis::FunctionID::OnDriverDistractionID);
+ msg_params[mobile_notification::state] = driver_distraction_state();
+ const auto lock_screen_dismissal =
+ policy_handler_->LockScreenDismissalEnabledState();
+
+ if (lock_screen_dismissal &&
+ hmi_apis::Common_DriverDistractionState::DD_ON ==
+ driver_distraction_state()) {
+ bool dismissal_enabled = *lock_screen_dismissal;
+ if (dismissal_enabled) {
+ const auto language =
+ MessageHelper::MobileLanguageToString(application->ui_language());
+
+ const auto warning_message =
+ policy_handler_->LockScreenDismissalWarningMessage(language);
+ // Only allow lock screen dismissal if a warning message is available
+ if (warning_message && !warning_message->empty()) {
+ msg_params[mobile_notification::lock_screen_dismissal_warning] =
+ *warning_message;
+ } else {
+ dismissal_enabled = false;
+ }
+ }
+ msg_params[mobile_notification::lock_screen_dismissal_enabled] =
+ dismissal_enabled;
+ }
+
+ params[strings::connection_key] = application->app_id();
+ return notification;
+ };
+
+ const RPCParams params;
+ const std::string function_id = MessageHelper::StringifiedFunctionID(
+ mobile_api::FunctionID::OnDriverDistractionID);
+ const mobile_apis::Result::eType check_result =
+ CheckPolicyPermissions(application,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ function_id,
+ params);
+ if (mobile_api::Result::SUCCESS == check_result) {
+ rpc_service_->ManageMobileCommand(create_notification(),
+ commands::Command::SOURCE_SDL);
+ } else {
+ MobileMessageQueue messages;
+ application->SwapMobileMessageQueue(messages);
+ messages.erase(
+ std::remove_if(
+ messages.begin(),
+ messages.end(),
+ [](smart_objects::SmartObjectSPtr message) {
+ return (*message)[strings::params][strings::function_id]
+ .asUInt() ==
+ mobile_apis::FunctionID::OnDriverDistractionID;
+ }),
+ messages.end());
+ application->SwapMobileMessageQueue(messages);
+ application->PushMobileMessage(create_notification());
+ }
+}
+
+void ApplicationManagerImpl::SendGetIconUrlNotifications(
+ const uint32_t connection_key, ApplicationSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<std::string> enabled_apps;
+ GetPolicyHandler().GetEnabledCloudApps(enabled_apps);
+ std::vector<std::string>::iterator enabled_it = enabled_apps.begin();
+ std::vector<std::string>::iterator enabled_end = enabled_apps.end();
+ sync_primitives::AutoLock lock(app_icon_map_lock_ptr_);
+ for (; enabled_it != enabled_end; ++enabled_it) {
+ auto app_icon_it = app_icon_map_.find(*enabled_it);
+ if (app_icon_it == app_icon_map_.end()) {
+ LOG4CXX_WARN(logger_, "Could not find cloud app in icon map");
+ continue;
+ }
+
+ std::string endpoint = app_icon_it->second.endpoint;
+ bool pending_request = app_icon_it->second.pending_request;
+
+ if (pending_request) {
+ LOG4CXX_DEBUG(logger_, "Cloud app has already sent request");
+ continue;
+ }
+
+ std::string url = GetPolicyHandler().GetIconUrl(*enabled_it);
+
+ if (url.empty()) {
+ LOG4CXX_DEBUG(logger_, "No Icon Url for cloud app");
+ continue;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Creating Get Icon Request");
+
+ smart_objects::SmartObjectSPtr message =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ (*message)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnSystemRequestID;
+ (*message)[strings::params][strings::connection_key] = connection_key;
+ (*message)[strings::params][strings::message_type] =
+ mobile_apis::messageType::notification;
+ (*message)[strings::params][strings::protocol_version] =
+ application->protocol_version();
+ (*message)[strings::msg_params][strings::request_type] =
+ mobile_apis::RequestType::ICON_URL;
+ (*message)[strings::msg_params][strings::url] = url;
+
+ app_icon_it->second.pending_request = true;
+
+ rpc_service_->ManageMobileCommand(message, commands::Command::SOURCE_SDL);
+ }
}
protocol_handler::MajorProtocolVersion
@@ -3350,6 +4550,34 @@ ApplicationManagerImpl::SupportedSDLVersion() const {
get_settings().max_supported_protocol_version());
}
+void ApplicationManagerImpl::AddAppToRegisteredAppList(
+ const ApplicationSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(application);
+ sync_primitives::AutoLock lock(applications_list_lock_ptr_);
+
+ // Add application to registered app list and set appropriate mark.
+ application->MarkRegistered();
+ applications_.insert(application);
+ LOG4CXX_DEBUG(
+ logger_,
+ "App with app_id: " << application->app_id()
+ << " has been added to registered applications list");
+ if (application_list_update_timer_.is_running() &&
+ !registered_during_timer_execution_) {
+ GetPolicyHandler().OnAddedNewApplicationToAppList(
+ application->app_id(), application->policy_app_id());
+ registered_during_timer_execution_ = true;
+ }
+ apps_size_ = static_cast<uint32_t>(applications_.size());
+}
+
+void ApplicationManagerImpl::ApplyFunctorForEachPlugin(
+ std::function<void(plugin_manager::RPCPlugin&)> functor) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ plugin_manager_->ForEachPlugin(functor);
+}
+
event_engine::EventDispatcher& ApplicationManagerImpl::event_dispatcher() {
return event_dispatcher_;
}
@@ -3374,9 +4602,9 @@ bool ApplicationManagerImpl::InitDirectory(
LOG4CXX_WARN(logger_, directory_type << " directory doesn't exist.");
// if storage directory doesn't exist try to create it
if (!file_system::CreateDirectoryRecursively(path)) {
- LOG4CXX_ERROR(logger_,
- "Unable to create " << directory_type << " directory "
- << path);
+ LOG4CXX_ERROR(
+ logger_,
+ "Unable to create " << directory_type << " directory " << path);
return false;
}
LOG4CXX_DEBUG(logger_,
@@ -3391,9 +4619,9 @@ bool ApplicationManagerImpl::IsReadWriteAllowed(const std::string& path,
const std::string directory_type = DirectoryTypeToString(type);
if (!(file_system::IsWritingAllowed(path) &&
file_system::IsReadingAllowed(path))) {
- LOG4CXX_ERROR(logger_,
- directory_type
- << " directory doesn't have read/write permissions.");
+ LOG4CXX_ERROR(
+ logger_,
+ directory_type << " directory doesn't have read/write permissions.");
return false;
}
@@ -3410,37 +4638,13 @@ void ApplicationManagerImpl::ClearTTSGlobalPropertiesList() {
}
bool ApplicationManagerImpl::IsAppSubscribedForWayPoints(
- const uint32_t app_id) const {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
- if (subscribed_way_points_apps_list_.find(app_id) ==
- subscribed_way_points_apps_list_.end()) {
- return false;
- }
- return true;
-}
-
-void ApplicationManagerImpl::SubscribeAppForWayPoints(const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
- subscribed_way_points_apps_list_.insert(app_id);
-}
-
-void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(
- const uint32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
- subscribed_way_points_apps_list_.erase(app_id);
-}
-
-bool ApplicationManagerImpl::IsAppSubscribedForWayPoints(
ApplicationSharedPtr app) const {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
LOG4CXX_DEBUG(logger_,
"There are applications subscribed: "
<< subscribed_way_points_apps_list_.size());
- if (subscribed_way_points_apps_list_.find(app) ==
+ if (subscribed_way_points_apps_list_.find(app->app_id()) ==
subscribed_way_points_apps_list_.end()) {
return false;
}
@@ -3451,7 +4655,8 @@ void ApplicationManagerImpl::SubscribeAppForWayPoints(
ApplicationSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
- subscribed_way_points_apps_list_.insert(app);
+ LOG4CXX_DEBUG(logger_, "Subscribing " << app->app_id());
+ subscribed_way_points_apps_list_.insert(app->app_id());
LOG4CXX_DEBUG(logger_,
"There are applications subscribed: "
<< subscribed_way_points_apps_list_.size());
@@ -3461,7 +4666,8 @@ void ApplicationManagerImpl::UnsubscribeAppFromWayPoints(
ApplicationSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
- subscribed_way_points_apps_list_.erase(app);
+ LOG4CXX_DEBUG(logger_, "Unsubscribing " << app->app_id());
+ subscribed_way_points_apps_list_.erase(app->app_id());
LOG4CXX_DEBUG(logger_,
"There are applications subscribed: "
<< subscribed_way_points_apps_list_.size());
@@ -3476,13 +4682,23 @@ bool ApplicationManagerImpl::IsAnyAppSubscribedForWayPoints() const {
return !subscribed_way_points_apps_list_.empty();
}
-const std::set<int32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints()
+const std::set<uint32_t> ApplicationManagerImpl::GetAppsSubscribedForWayPoints()
const {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_);
return subscribed_way_points_apps_list_;
}
+// retrieve transport type string used in .ini file, e.g. "TCP_WIFI"
+const std::string ApplicationManagerImpl::GetTransportTypeProfileString(
+ connection_handler::DeviceHandle device_handle) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ return connection_handler()
+ .get_session_observer()
+ .TransportTypeProfileStringFromDeviceHandle(device_handle);
+}
+
static hmi_apis::Common_VideoStreamingProtocol::eType ConvertVideoProtocol(
const char* str) {
if (strcmp(str, "RAW") == 0) {
@@ -3572,16 +4788,11 @@ bool ApplicationManagerImpl::IsSOStructValid(
const smart_objects::SmartObject& display_capabilities) {
smart_objects::SmartObject display_capabilities_so = display_capabilities;
if (hmi_so_factory().AttachSchema(struct_id, display_capabilities_so)) {
- if (display_capabilities_so.isValid()) {
- return true;
- } else {
- return false;
- }
- } else {
- LOG4CXX_ERROR(logger_, "Could not find struct id: " << struct_id);
- return false;
+ return display_capabilities_so.isValid();
}
- return true;
+
+ LOG4CXX_ERROR(logger_, "Could not find struct id: " << struct_id);
+ return false;
}
#ifdef BUILD_TESTS
@@ -3592,6 +4803,13 @@ void ApplicationManagerImpl::AddMockApplication(ApplicationSharedPtr mock_app) {
applications_list_lock_ptr_->Release();
}
+void ApplicationManagerImpl::AddMockPendingApplication(
+ ApplicationSharedPtr mock_app) {
+ apps_to_register_list_lock_ptr_->Acquire();
+ apps_to_register_.insert(mock_app);
+ apps_to_register_list_lock_ptr_->Release();
+}
+
void ApplicationManagerImpl::SetMockMediaManager(
media_manager::MediaManager* mock_media_manager) {
media_manager_ = mock_media_manager;
@@ -3657,10 +4875,19 @@ void ApplicationManagerImpl::ChangeAppsHMILevel(
LOG4CXX_ERROR(logger_, "There is no app with id: " << app_id);
return;
}
- const mobile_apis::HMILevel::eType old_level = app->hmi_level();
- if (old_level != level) {
- app->set_hmi_level(level);
- OnHMILevelChanged(app_id, old_level, level);
+
+ const auto old_hmi_state =
+ app->CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ if (old_hmi_state->hmi_level() != level) {
+ app->set_hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW, level);
+ const auto new_hmi_state =
+ CreateRegularState(app,
+ mobile_apis::WindowType::MAIN,
+ level,
+ old_hmi_state->audio_streaming_state(),
+ old_hmi_state->video_streaming_state(),
+ old_hmi_state->system_context());
+ OnHMIStateChanged(app_id, old_hmi_state, new_hmi_state);
} else {
LOG4CXX_WARN(logger_, "Redundant changing HMI level: " << level);
}
diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc
index 3f775ee4e2..6ed784424a 100644
--- a/src/components/application_manager/src/application_state.cc
+++ b/src/components/application_manager/src/application_state.cc
@@ -31,7 +31,10 @@
*/
#include "application_manager/application_state.h"
+
#include <algorithm>
+#include <string>
+
#include "utils/logger.h"
#include "utils/macro.h"
@@ -45,7 +48,7 @@ struct StateIDComparator {
return cur->state_id() == state_id_;
}
};
-}
+} // namespace
namespace application_manager {
@@ -53,193 +56,293 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
ApplicationState::ApplicationState() {}
-void ApplicationState::InitState(HmiStatePtr state) {
+void ApplicationState::InitState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- hmi_states_.clear();
- hmi_states_.push_back(state);
+ LOG4CXX_DEBUG(logger_,
+ "Initing state " << state << " for window " << window_id
+ << " with name " << window_name);
+ {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& states = hmi_states_map_[window_id];
+ states.push_back(state);
+ }
}
-void ApplicationState::AddState(HmiStatePtr state) {
+void ApplicationState::AddState(const WindowID window_id, HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
switch (state->state_id()) {
case HmiState::StateID::STATE_ID_REGULAR:
- SetRegularState(state);
+ SetRegularState(window_id, state);
return;
case HmiState::StateID::STATE_ID_POSTPONED:
- SetPostponedState(state);
+ SetPostponedState(window_id, state);
return;
case HmiState::StateID::STATE_ID_CURRENT:
- LOG4CXX_ERROR(logger_, "State of type '" << state << "' can't be added.");
+ LOG4CXX_ERROR(logger_,
+ "State of type '" << state << "' can't be added for window "
+ << window_id);
return;
default:
- AddHMIState(state);
+ AddHMIState(window_id, state);
break;
}
return;
}
-void ApplicationState::RemoveState(HmiState::StateID state) {
+void ApplicationState::RemoveState(const WindowID window_id,
+ HmiState::StateID state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
switch (state) {
case HmiState::StateID::STATE_ID_CURRENT:
case HmiState::StateID::STATE_ID_REGULAR:
- LOG4CXX_ERROR(logger_,
- "State of type '" << state << "'can't be removed.");
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id) {
+ LOG4CXX_ERROR(logger_,
+ "State of type '" << state
+ << "' can't be removed for window "
+ << window_id);
+ return;
+ }
+
+ RemoveWindowHMIStates(window_id);
break;
case HmiState::StateID::STATE_ID_POSTPONED:
- RemovePostponedState();
+ RemovePostponedState(window_id);
break;
default:
- RemoveHMIState(state);
+ RemoveHMIState(window_id, state);
break;
}
}
-HmiStatePtr ApplicationState::GetState(HmiState::StateID state_id) const {
+HmiStatePtr ApplicationState::GetState(const WindowID window_id,
+ HmiState::StateID state_id) const {
switch (state_id) {
case HmiState::StateID::STATE_ID_REGULAR:
- LOG4CXX_DEBUG(logger_, "Getting regular state.");
- return RegularHmiState();
+ LOG4CXX_DEBUG(logger_, "Getting regular state for window " << window_id);
+ return RegularHmiState(window_id);
case HmiState::StateID::STATE_ID_POSTPONED:
- LOG4CXX_DEBUG(logger_, "Getting postponed state.");
- return PostponedHmiState();
+ LOG4CXX_DEBUG(logger_,
+ "Getting postponed state for window " << window_id);
+ return PostponedHmiState(window_id);
default:
- LOG4CXX_DEBUG(logger_, "Getting current state.");
- return CurrentHmiState();
+ LOG4CXX_DEBUG(logger_, "Getting current state for window " << window_id);
+ return CurrentHmiState(window_id);
}
}
-void ApplicationState::AddHMIState(HmiStatePtr state) {
+HmiStates ApplicationState::GetStates(const HmiState::StateID state_id) const {
+ LOG4CXX_DEBUG(logger_, "Collecting all states of type " << state_id);
+
+ HmiStates hmi_states;
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ for (const auto& hmi_state_pair : hmi_states_map_) {
+ hmi_states.push_back(GetState(hmi_state_pair.first, state_id));
+ }
+
+ return hmi_states;
+}
+
+WindowIds ApplicationState::GetWindowIds() const {
+ LOG4CXX_DEBUG(logger_, "Collecting available window ID's");
+
+ WindowIds window_ids;
+ std::string stringified_window_ids;
+
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ for (const auto& hmi_state_pair : hmi_states_map_) {
+ window_ids.push_back(hmi_state_pair.first);
+ stringified_window_ids += (stringified_window_ids.empty() ? "" : ", ") +
+ std::to_string(hmi_state_pair.first);
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Existing window IDs: [" + stringified_window_ids + "]");
+ return window_ids;
+}
+
+void ApplicationState::AddHMIState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- HmiStates::iterator it = std::find_if(hmi_states_.begin(),
- hmi_states_.end(),
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ HmiStates::iterator it = std::find_if(hmi_states.begin(),
+ hmi_states.end(),
StateIDComparator(state->state_id()));
- if (hmi_states_.end() != it) {
- LOG4CXX_WARN(
- logger_,
- "Hmi state with ID "
- << state->state_id()
- << "has been already applied to this application. Ignoring");
+ if (hmi_states.end() != it) {
+ LOG4CXX_WARN(logger_,
+ "Hmi state with ID " << state->state_id()
+ << "has been already applied for window "
+ << window_id
+ << " of this application. Ignoring");
return;
}
- hmi_states_.push_back(state);
+ hmi_states.push_back(state);
}
-void ApplicationState::RemoveHMIState(HmiState::StateID state_id) {
+void ApplicationState::RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
HmiStates::iterator it = std::find_if(
- hmi_states_.begin(), hmi_states_.end(), StateIDComparator(state_id));
- if (it == hmi_states_.end()) {
- LOG4CXX_ERROR(logger_, "Unsuccesful remove HmiState: " << state_id);
+ hmi_states.begin(), hmi_states.end(), StateIDComparator(state_id));
+ if (hmi_states.end() == it) {
+ LOG4CXX_ERROR(logger_,
+ "Unsuccesful remove HmiState: " << state_id << " for window "
+ << window_id);
return;
}
// unable to remove regular state
- DCHECK_OR_RETURN_VOID(it != hmi_states_.begin());
+ DCHECK_OR_RETURN_VOID(hmi_states.begin() != it);
HmiStates::iterator next = it;
HmiStates::iterator prev = it;
next++;
prev--;
- if (next != hmi_states_.end()) {
+
+ if (next != hmi_states.end()) {
HmiStatePtr next_state = *next;
HmiStatePtr prev_state = *prev;
next_state->set_parent(prev_state);
}
- hmi_states_.erase(it);
+
+ hmi_states.erase(it);
}
-void ApplicationState::RemovePostponedState() {
+void ApplicationState::RemoveWindowHMIStates(const WindowID window_id) {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
+ DCHECK_OR_RETURN_VOID(mobile_apis::PredefinedWindows::DEFAULT_WINDOW !=
+ window_id);
+
+ LOG4CXX_DEBUG(logger_,
+ "Removing HMI states for window with id #" << window_id);
+ {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ hmi_states_map_.erase(window_id);
+ }
+}
+
+void ApplicationState::RemovePostponedState(const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ DCHECK_OR_RETURN_VOID(!hmi_states.empty());
StateIDComparator finder(HmiState::StateID::STATE_ID_POSTPONED);
HmiStates::iterator postponed_state =
- std::find_if(hmi_states_.begin(), hmi_states_.end(), finder);
+ std::find_if(hmi_states.begin(), hmi_states.end(), finder);
- if (hmi_states_.end() == postponed_state) {
- LOG4CXX_ERROR(logger_, "No postponed state is set for app.");
+ if (hmi_states.end() == postponed_state) {
+ LOG4CXX_ERROR(logger_,
+ "No postponed state is set for window " << window_id);
return;
}
- hmi_states_.erase(postponed_state);
+
+ hmi_states.erase(postponed_state);
}
-void ApplicationState::SetRegularState(HmiStatePtr state) {
+void ApplicationState::SetRegularState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() ==
HmiState::StateID::STATE_ID_REGULAR);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ DCHECK_OR_RETURN_VOID(!hmi_states.empty());
- HmiStatePtr front_state = hmi_states_.front();
+ HmiStatePtr front_state = hmi_states.front();
HmiState::StateID front_state_id = front_state->state_id();
if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) {
// Drop postponed state
- hmi_states_.erase(hmi_states_.begin());
+ hmi_states.erase(hmi_states.begin());
}
// Drop regular state
- hmi_states_.erase(hmi_states_.begin());
+ hmi_states.erase(hmi_states.begin());
- if (!hmi_states_.empty()) {
- HmiStatePtr front_state = hmi_states_.front();
+ if (!hmi_states.empty()) {
+ HmiStatePtr front_state = hmi_states.front();
front_state->set_parent(state);
}
- hmi_states_.insert(hmi_states_.begin(), state);
+
+ // Insert new regular state
+ hmi_states.insert(hmi_states.begin(), state);
if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) {
- hmi_states_.insert(hmi_states_.begin(), front_state);
+ // Restore postponed state if it was before
+ hmi_states.insert(hmi_states.begin(), front_state);
}
}
-void ApplicationState::SetPostponedState(HmiStatePtr state) {
+void ApplicationState::SetPostponedState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() ==
HmiState::StateID::STATE_ID_POSTPONED);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
- HmiStatePtr front_state = hmi_states_.front();
+
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ DCHECK_OR_RETURN_VOID(!hmi_states.empty());
+ HmiStatePtr front_state = hmi_states.front();
if (front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED) {
- hmi_states_.erase(hmi_states_.begin());
+ hmi_states.erase(hmi_states.begin());
}
- hmi_states_.insert(hmi_states_.begin(), state);
+
+ hmi_states.insert(hmi_states.begin(), state);
}
-HmiStatePtr ApplicationState::CurrentHmiState() const {
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- HmiStatePtr back_state = hmi_states_.back();
+HmiStatePtr ApplicationState::CurrentHmiState(const WindowID window_id) const {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ auto it_states = hmi_states_map_.find(window_id);
+ DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr());
+
+ const HmiStates& hmi_states = it_states->second;
+ DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
+
+ HmiStatePtr back_state = hmi_states.back();
DCHECK_OR_RETURN(
back_state->state_id() != HmiState::StateID::STATE_ID_POSTPONED,
HmiStatePtr());
+
return back_state;
}
-HmiStatePtr ApplicationState::RegularHmiState() const {
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- HmiStates::const_iterator front_itr = hmi_states_.begin();
+HmiStatePtr ApplicationState::RegularHmiState(const WindowID window_id) const {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ auto it_states = hmi_states_map_.find(window_id);
+ DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr());
+
+ const HmiStates& hmi_states = it_states->second;
+ DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
+
+ HmiStates::const_iterator front_itr = hmi_states.begin();
if ((*front_itr)->state_id() == HmiState::StateID::STATE_ID_POSTPONED) {
++front_itr;
}
+
return *front_itr;
}
-HmiStatePtr ApplicationState::PostponedHmiState() const {
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- HmiStatePtr front_state = hmi_states_.front();
+HmiStatePtr ApplicationState::PostponedHmiState(
+ const WindowID window_id) const {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ auto it_states = hmi_states_map_.find(window_id);
+ DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr());
+
+ const HmiStates& hmi_states = it_states->second;
+ DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
+
+ HmiStatePtr front_state = hmi_states.front();
return front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED
? front_state
: HmiStatePtr();
diff --git a/src/components/application_manager/src/command_holder_impl.cc b/src/components/application_manager/src/command_holder_impl.cc
index 9799b170dc..1c336ac64f 100644
--- a/src/components/application_manager/src/command_holder_impl.cc
+++ b/src/components/application_manager/src/command_holder_impl.cc
@@ -43,20 +43,23 @@ CommandHolderImpl::CommandHolderImpl(ApplicationManager& app_manager)
void CommandHolderImpl::Suspend(
ApplicationSharedPtr application,
CommandType type,
- utils::SharedPtr<smart_objects::SmartObject> command) {
+ commands::Command::CommandSource source,
+ std::shared_ptr<smart_objects::SmartObject> command) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(application);
LOG4CXX_DEBUG(logger_,
"Suspending command(s) for application: "
<< application->policy_app_id());
- sync_primitives::AutoLock lock(commands_lock_);
+ AppCommandInfo info = {command, source};
+
+ sync_primitives::AutoLock lock(commands_lock_);
if (CommandType::kHmiCommand == type) {
- app_hmi_commands_[application].push_back(command);
+ app_hmi_commands_[application].push_back(info);
LOG4CXX_DEBUG(logger_,
"Suspended HMI command(s): " << app_hmi_commands_.size());
} else {
- app_mobile_commands_[application].push_back(command);
+ app_mobile_commands_[application].push_back(info);
LOG4CXX_DEBUG(
logger_,
"Suspended mobile command(s): " << app_mobile_commands_.size());
@@ -113,8 +116,10 @@ void CommandHolderImpl::ResumeHmiCommand(ApplicationSharedPtr application) {
"Resuming HMI command(s): " << app_hmi_commands_.size());
for (auto cmd : app_commands->second) {
- (*cmd)[strings::msg_params][strings::app_id] = application->hmi_app_id();
- app_manager_.GetRPCService().ManageHMICommand(cmd);
+ (*cmd.command_ptr_)[strings::msg_params][strings::app_id] =
+ application->hmi_app_id();
+ app_manager_.GetRPCService().ManageHMICommand(cmd.command_ptr_,
+ cmd.command_source_);
}
app_hmi_commands_.erase(app_commands);
@@ -132,11 +137,12 @@ void CommandHolderImpl::ResumeMobileCommand(ApplicationSharedPtr application) {
"Resuming mobile command(s): " << app_mobile_commands_.size());
for (auto cmd : app_commands->second) {
- (*cmd)[strings::params][strings::connection_key] = application->app_id();
- app_manager_.GetRPCService().ManageMobileCommand(
- cmd, commands::Command::CommandSource::SOURCE_MOBILE);
+ (*cmd.command_ptr_)[strings::params][strings::connection_key] =
+ application->app_id();
+ app_manager_.GetRPCService().ManageMobileCommand(cmd.command_ptr_,
+ cmd.command_source_);
}
app_mobile_commands_.erase(app_commands);
}
-} // application_manager
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc
index dbe89b8881..8fa9cbe919 100644
--- a/src/components/application_manager/src/commands/command_impl.cc
+++ b/src/components/application_manager/src/commands/command_impl.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2014, Ford Motor Company
All rights reserved.
@@ -31,8 +31,10 @@
*/
#include "application_manager/commands/command_impl.h"
+
#include "application_manager/application_impl.h"
#include "application_manager/application_manager.h"
+#include "application_manager/message_helper.h"
namespace application_manager {
@@ -40,10 +42,10 @@ namespace {
struct AppExtensionPredicate {
AppExtensionUID uid;
bool operator()(const ApplicationSharedPtr app) {
- return app ? app->QueryInterface(uid).valid() : false;
+ return app ? (app->QueryInterface(uid).use_count() != 0) : false;
}
};
-}
+} // namespace
namespace commands {
@@ -96,6 +98,15 @@ int32_t CommandImpl::function_id() const {
return (*message_)[strings::params][strings::function_id].asInt();
}
+WindowID CommandImpl::window_id() const {
+ if ((*message_).keyExists(strings::msg_params)) {
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ return (*message_)[strings::msg_params][strings::window_id].asInt();
+ }
+ }
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
uint32_t CommandImpl::connection_key() const {
return (*message_)[strings::params][strings::connection_key].asUInt();
}
@@ -110,8 +121,113 @@ void CommandImpl::SetAllowedToTerminate(const bool allowed) {
allowed_to_terminate_ = allowed;
}
+bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "There is no registered application with "
+ "connection key '"
+ << connection_key() << "'");
+ return false;
+ }
+
+ RPCParams params;
+
+ const smart_objects::SmartObject& s_map = (*message_)[strings::msg_params];
+ smart_objects::SmartMap::const_iterator iter = s_map.map_begin();
+ smart_objects::SmartMap::const_iterator iter_end = s_map.map_end();
+
+ for (; iter != iter_end; ++iter) {
+ LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first);
+ params.insert(iter->first);
+ }
+
+ mobile_apis::Result::eType check_result =
+ mobile_apis::Result::eType::INVALID_ID;
+ const auto current_window_id = window_id();
+ if (app->WindowIdExists(current_window_id)) {
+ check_result = application_manager_.CheckPolicyPermissions(
+ app,
+ current_window_id,
+ MessageHelper::StringifiedFunctionID(
+ static_cast<mobile_api::FunctionID::eType>(function_id())),
+ params,
+ &parameters_permissions_);
+ }
+
+ // Check, if RPC is allowed by policy
+ if (mobile_apis::Result::SUCCESS != check_result) {
+ mobile_apis::messageType::eType message_type =
+ static_cast<mobile_apis::messageType::eType>(
+ (*message_)[strings::params][strings::message_type].asInt());
+ if (message_type == mobile_apis::messageType::request &&
+ source == Command::CommandSource::SOURCE_MOBILE) {
+ smart_objects::SmartObjectSPtr response =
+ MessageHelper::CreateBlockedByPoliciesResponse(
+ static_cast<mobile_api::FunctionID::eType>(function_id()),
+ check_result,
+ correlation_id(),
+ app->app_id());
+ rpc_service_.SendMessageToMobile(response);
+ }
+
+ return false;
+ }
+
+ // If no parameters specified in policy table, no restriction will be
+ // applied for parameters
+ if (parameters_permissions_.allowed_params.empty() &&
+ parameters_permissions_.disallowed_params.empty() &&
+ parameters_permissions_.undefined_params.empty()) {
+ return true;
+ }
+
+ RemoveDisallowedParameters();
+
+ return true;
+}
+
+void CommandImpl::RemoveDisallowedParameters() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ smart_objects::SmartObject& params = (*message_)[strings::msg_params];
+
+ for (const auto& key : params.enumerate()) {
+ if (parameters_permissions_.disallowed_params.end() !=
+ parameters_permissions_.disallowed_params.find(key)) {
+ // Remove from request all disallowed parameters
+ params.erase(key);
+ removed_parameters_permissions_.disallowed_params.insert(key);
+ LOG4CXX_INFO(logger_,
+ "Following parameter is disallowed by user: " << key);
+ }
+
+ else if (removed_parameters_permissions_.undefined_params.end() !=
+ removed_parameters_permissions_.undefined_params.find(key)) {
+ // Remove from request all undefined yet parameters
+ params.erase(key);
+ removed_parameters_permissions_.undefined_params.insert(key);
+ LOG4CXX_INFO(logger_,
+ "Following parameter is disallowed by policy: " << key);
+ }
+
+ else if (parameters_permissions_.allowed_params.end() ==
+ parameters_permissions_.allowed_params.find(key)) {
+ // Remove from request all parameters missed in allowed
+ params.erase(key);
+ removed_parameters_permissions_.undefined_params.insert(key);
+ LOG4CXX_INFO(logger_,
+ "Following parameter is not found among allowed parameters '"
+ << key << "' and will be treated as disallowed.");
+ }
+ }
+}
+
bool CommandImpl::ReplaceMobileWithHMIAppId(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& message) {
+ ns_smart_device_link::ns_smart_objects::SmartObject& message) {
LOG4CXX_AUTO_TRACE(logger_);
if (message.keyExists(strings::app_id)) {
ApplicationSharedPtr application =
@@ -155,15 +271,8 @@ bool CommandImpl::ReplaceMobileWithHMIAppId(
return true;
}
-DEPRECATED void CommandImpl::ReplaceMobileByHMIAppId(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& message) {
- if (!ReplaceMobileWithHMIAppId(message)) {
- LOG4CXX_ERROR(logger_, "Substitution mobile --> HMI id is failed.");
- }
-}
-
bool CommandImpl::ReplaceHMIWithMobileAppId(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& message) {
+ ns_smart_device_link::ns_smart_objects::SmartObject& message) {
if (message.keyExists(strings::app_id)) {
ApplicationSharedPtr application =
application_manager_.application_by_hmi_app(
@@ -207,11 +316,18 @@ bool CommandImpl::ReplaceHMIWithMobileAppId(
return true;
}
-DEPRECATED void CommandImpl::ReplaceHMIByMobileAppId(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& message) {
- if (!ReplaceHMIWithMobileAppId(message)) {
- LOG4CXX_ERROR(logger_, "Substitution HMI --> mobile id is failed.");
+uint32_t CommandImpl::CalcCommandInternalConsecutiveNumber(
+ ApplicationConstSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const DataAccessor<CommandsMap> accessor = app->commands_map();
+ const CommandsMap& commands = accessor.GetData();
+
+ uint32_t last_command_number = 0u;
+ if (!commands.empty()) {
+ last_command_number = commands.rbegin()->first;
}
+
+ return last_command_number + 1;
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
index 4e9a2556de..46c1c87699 100644
--- a/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
+++ b/src/components/application_manager/src/commands/command_notification_from_mobile_impl.cc
@@ -32,8 +32,8 @@
#include "application_manager/commands/command_notification_from_mobile_impl.h"
#include "application_manager/application_manager.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
namespace application_manager {
@@ -57,6 +57,10 @@ bool CommandNotificationFromMobileImpl::Init() {
return true;
}
+bool CommandNotificationFromMobileImpl::CheckPermissions() {
+ return CheckAllowedParameters(Command::CommandSource::SOURCE_MOBILE);
+}
+
bool CommandNotificationFromMobileImpl::CleanUp() {
return true;
}
@@ -75,6 +79,30 @@ void CommandNotificationFromMobileImpl::SendNotification() {
rpc_service_.SendMessageToMobile(message_);
}
+void CommandNotificationFromMobileImpl::SendNotificationToMobile() {
+ auto app = application_manager_.application(connection_key());
+ (*message_)[strings::params][strings::protocol_type] = mobile_protocol_type_;
+ (*message_)[strings::params][strings::protocol_version] =
+ app->protocol_version();
+ (*message_)[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+
+ rpc_service_.ManageMobileCommand(message_, SOURCE_SDL);
+}
+
+void CommandNotificationFromMobileImpl::SendNotificationToHMI(
+ const hmi_apis::FunctionID::eType& hmi_function_id) {
+ (*message_)[strings::params][strings::protocol_type] = hmi_protocol_type_;
+ (*message_)[strings::params][strings::function_id] = hmi_function_id;
+ rpc_service_.ManageHMICommand(message_, SOURCE_SDL_TO_HMI);
+}
+
+void CommandNotificationFromMobileImpl::SendNotificationToConsumers(
+ const hmi_apis::FunctionID::eType& hmi_function_id) {
+ SendNotificationToMobile();
+ SendNotificationToHMI(hmi_function_id);
+}
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/command_notification_impl.cc b/src/components/application_manager/src/commands/command_notification_impl.cc
index 70df95986b..cc2606ab6f 100644
--- a/src/components/application_manager/src/commands/command_notification_impl.cc
+++ b/src/components/application_manager/src/commands/command_notification_impl.cc
@@ -32,8 +32,8 @@
#include "application_manager/commands/command_notification_impl.h"
#include "application_manager/application_manager.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
namespace application_manager {
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index 491fc72de4..f4a352fdc4 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -34,13 +34,17 @@
#include <numeric>
#include <string>
#include "utils/macro.h"
-#include "utils/make_shared.h"
+
#include "application_manager/commands/command_request_impl.h"
+
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager.h"
-#include "application_manager/rpc_service.h"
#include "application_manager/message_helper.h"
+#include "application_manager/rpc_service.h"
#include "smart_objects/smart_object.h"
+#include "smart_objects/enum_schema_item.h"
+
namespace application_manager {
namespace commands {
@@ -108,7 +112,8 @@ const std::string CreateInfoForUnsupportedResult(
}
}
-bool CheckResultCode(const ResponseInfo& first, const ResponseInfo& second) {
+bool CommandRequestImpl::CheckResult(const ResponseInfo& first,
+ const ResponseInfo& second) const {
if (first.is_ok && second.is_unsupported_resource) {
return true;
}
@@ -140,18 +145,21 @@ struct DisallowedParamsInserter {
: response_(response), code_(code) {}
bool operator()(const std::string& param) {
- const VehicleData& vehicle_data =
- application_manager::MessageHelper::vehicle_data();
- VehicleData::const_iterator it = vehicle_data.find(param);
- if (vehicle_data.end() != it) {
- smart_objects::SmartObjectSPtr disallowed_param =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
- (*disallowed_param)[strings::data_type] = (*it).second;
- (*disallowed_param)[strings::result_code] = code_;
- response_[strings::msg_params][param.c_str()] = *disallowed_param;
- return true;
- }
- return false;
+ smart_objects::SmartObjectSPtr disallowed_param =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ auto rpc_spec_vehicle_data = MessageHelper::vehicle_data();
+ auto vehicle_data = rpc_spec_vehicle_data.find(param);
+ auto vehicle_data_type =
+ vehicle_data == rpc_spec_vehicle_data.end()
+ ? mobile_apis::VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA
+ : vehicle_data->second;
+
+ (*disallowed_param)[strings::data_type] = vehicle_data_type;
+ (*disallowed_param)[strings::result_code] = code_;
+ response_[strings::msg_params][param.c_str()] = *disallowed_param;
+ return true;
}
private:
@@ -181,13 +189,7 @@ ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result,
interface_state =
application_manager.hmi_interfaces().GetInterfaceState(hmi_interface);
- is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
- result_code,
- hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::WARNINGS,
- hmi_apis::Common_Result::WRONG_LANGUAGE,
- hmi_apis::Common_Result::RETRY,
- hmi_apis::Common_Result::SAVED);
+ is_ok = CommandRequestImpl::IsHMIResultSuccess(result_code);
is_not_used = hmi_apis::Common_Result::INVALID_ENUM == result_code;
@@ -220,7 +222,7 @@ bool CommandRequestImpl::Init() {
}
bool CommandRequestImpl::CheckPermissions() {
- return CheckAllowedParameters();
+ return CheckAllowedParameters(Command::CommandSource::SOURCE_MOBILE);
}
bool CommandRequestImpl::CleanUp() {
@@ -232,7 +234,8 @@ void CommandRequestImpl::Run() {}
void CommandRequestImpl::onTimeOut() {
LOG4CXX_AUTO_TRACE(logger_);
- unsubscribe_from_all_events();
+ unsubscribe_from_all_hmi_events();
+ unsubscribe_from_all_mobile_events();
{
// FIXME (dchmerev@luxoft.com): atomic_xchg fits better
sync_primitives::AutoLock auto_lock(state_lock_);
@@ -256,11 +259,14 @@ void CommandRequestImpl::onTimeOut() {
void CommandRequestImpl::on_event(const event_engine::Event& event) {}
+void CommandRequestImpl::on_event(const event_engine::MobileEvent& event) {}
+
void CommandRequestImpl::SendResponse(
const bool success,
const mobile_apis::Result::eType& result_code,
const char* info,
- const smart_objects::SmartObject* response_params) {
+ const smart_objects::SmartObject* response_params,
+ const std::vector<uint8_t> binary_data) {
LOG4CXX_AUTO_TRACE(logger_);
{
sync_primitives::AutoLock auto_lock(state_lock_);
@@ -273,7 +279,7 @@ void CommandRequestImpl::SendResponse(
}
smart_objects::SmartObjectSPtr result =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
smart_objects::SmartObject& response = *result;
@@ -285,7 +291,9 @@ void CommandRequestImpl::SendResponse(
CommandImpl::protocol_version_;
response[strings::params][strings::connection_key] = connection_key();
response[strings::params][strings::function_id] = function_id();
-
+ if (!binary_data.empty()) {
+ response[strings::params][strings::binary_data] = binary_data;
+ }
if (response_params) {
response[strings::msg_params] = *response_params;
}
@@ -295,9 +303,9 @@ void CommandRequestImpl::SendResponse(
}
// Add disallowed parameters and info from request back to response with
- // appropriate
- // reasons (VehicleData result codes)
- if (result_code != mobile_apis::Result::APPLICATION_NOT_REGISTERED) {
+ // appropriate reasons (VehicleData result codes)
+ if (result_code != mobile_apis::Result::APPLICATION_NOT_REGISTERED &&
+ result_code != mobile_apis::Result::INVALID_DATA) {
const mobile_apis::FunctionID::eType& id =
static_cast<mobile_apis::FunctionID::eType>(function_id());
if ((id == mobile_apis::FunctionID::SubscribeVehicleDataID) ||
@@ -413,11 +421,100 @@ void CommandRequestImpl::UpdateHash() {
application->UpdateHash();
}
+void CommandRequestImpl::SendProviderRequest(
+ const mobile_apis::FunctionID::eType& mobile_function_id,
+ const hmi_apis::FunctionID::eType& hmi_function_id,
+ const smart_objects::SmartObject* msg,
+ bool use_events) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool hmi_destination = false;
+ ApplicationSharedPtr app;
+ // Default error code and error message
+ std::string error_msg = "No app service provider available";
+ mobile_apis::Result::eType error_code =
+ mobile_apis::Result::DATA_NOT_AVAILABLE;
+
+ if ((*msg)[strings::msg_params].keyExists(strings::service_type)) {
+ std::string service_type =
+ (*msg)[strings::msg_params][strings::service_type].asString();
+ application_manager_.GetAppServiceManager().GetProviderByType(
+ service_type, true, app, hmi_destination);
+ error_msg = "No app service provider with serviceType: " + service_type +
+ " is available";
+ error_code = mobile_apis::Result::DATA_NOT_AVAILABLE;
+ } else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) {
+ std::string service_id =
+ (*msg)[strings::msg_params][strings::service_id].asString();
+ application_manager_.GetAppServiceManager().GetProviderByID(
+ service_id, true, app, hmi_destination);
+ error_msg = "No app service provider with serviceId: " + service_id +
+ " is available";
+ error_code = mobile_apis::Result::INVALID_ID;
+ }
+
+ if (hmi_destination) {
+ LOG4CXX_DEBUG(logger_, "Sending Request to HMI Provider");
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
+ SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events);
+ return;
+ }
+
+ if (!app) {
+ LOG4CXX_DEBUG(logger_, "Invalid App Provider pointer");
+ SendResponse(false, error_code, error_msg.c_str());
+ return;
+ }
+
+ if (connection_key() == app->app_id()) {
+ SendResponse(false,
+ mobile_apis::Result::IGNORED,
+ "Consumer app is same as producer app");
+ return;
+ }
+
+ smart_objects::SmartObjectSPtr new_msg =
+ std::make_shared<smart_objects::SmartObject>();
+ smart_objects::SmartObject& request = *new_msg;
+
+ request[strings::params] = (*msg)[strings::params];
+ request[strings::msg_params] = (*msg)[strings::msg_params];
+ request[strings::params][strings::connection_key] = app->app_id();
+
+ application_manager_.IncreaseForwardedRequestTimeout(connection_key(),
+ correlation_id());
+ SendMobileRequest(mobile_function_id, new_msg, use_events);
+}
+
+void CommandRequestImpl::SendMobileRequest(
+ const mobile_apis::FunctionID::eType& function_id,
+ smart_objects::SmartObjectSPtr msg,
+ bool use_events) {
+ smart_objects::SmartObject& request = *msg;
+
+ const uint32_t mobile_correlation_id =
+ application_manager_.GetNextMobileCorrelationID();
+
+ request[strings::params][strings::correlation_id] = mobile_correlation_id;
+ request[strings::params][strings::message_type] = MessageType::kRequest;
+ if (use_events) {
+ LOG4CXX_DEBUG(logger_,
+ "SendMobileRequest subscribe_on_event "
+ << function_id << " " << mobile_correlation_id);
+ subscribe_on_event(function_id, mobile_correlation_id);
+ }
+
+ if (!rpc_service_.ManageMobileCommand(msg, SOURCE_SDL)) {
+ LOG4CXX_ERROR(logger_, "Unable to send request to mobile");
+ }
+}
+
uint32_t CommandRequestImpl::SendHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
const smart_objects::SmartObject* msg_params,
bool use_events) {
- smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>();
const uint32_t hmi_correlation_id =
application_manager_.GetNextHMICorrelationID();
@@ -437,12 +534,12 @@ uint32_t CommandRequestImpl::SendHMIRequest(
if (use_events) {
LOG4CXX_DEBUG(logger_,
- "subscribe_on_event " << function_id << " "
- << hmi_correlation_id);
+ "SendHMIRequest subscribe_on_event " << function_id << " "
+ << hmi_correlation_id);
subscribe_on_event(function_id, hmi_correlation_id);
}
if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) {
- if (!rpc_service_.ManageHMICommand(result)) {
+ if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) {
LOG4CXX_ERROR(logger_, "Unable to send request");
SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY);
}
@@ -454,8 +551,9 @@ uint32_t CommandRequestImpl::SendHMIRequest(
void CommandRequestImpl::CreateHMINotification(
const hmi_apis::FunctionID::eType& function_id,
- const NsSmart::SmartObject& msg_params) const {
- smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
+ const ns_smart::SmartObject& msg_params) const {
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>();
if (!result) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
return;
@@ -471,7 +569,7 @@ void CommandRequestImpl::CreateHMINotification(
notify[strings::params][strings::function_id] = function_id;
notify[strings::msg_params] = msg_params;
- if (!rpc_service_.ManageHMICommand(result)) {
+ if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) {
LOG4CXX_ERROR(logger_, "Unable to send HMI notification");
}
}
@@ -593,7 +691,8 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
return mobile_result;
}
-bool CommandRequestImpl::CheckAllowedParameters() {
+bool CommandRequestImpl::CheckAllowedParameters(
+ const Command::CommandSource source) {
LOG4CXX_AUTO_TRACE(logger_);
// RegisterAppInterface should always be allowed
@@ -602,59 +701,7 @@ bool CommandRequestImpl::CheckAllowedParameters() {
return true;
}
- const ApplicationSharedPtr app =
- application_manager_.application(connection_key());
- if (!app) {
- LOG4CXX_ERROR(logger_,
- "There is no registered application with "
- "connection key '"
- << connection_key() << "'");
- return false;
- }
-
- RPCParams params;
-
- const smart_objects::SmartObject& s_map = (*message_)[strings::msg_params];
- smart_objects::SmartMap::const_iterator iter = s_map.map_begin();
- smart_objects::SmartMap::const_iterator iter_end = s_map.map_end();
-
- for (; iter != iter_end; ++iter) {
- LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first);
- params.insert(iter->first);
- }
-
- mobile_apis::Result::eType check_result =
- application_manager_.CheckPolicyPermissions(
- app,
- MessageHelper::StringifiedFunctionID(
- static_cast<mobile_api::FunctionID::eType>(function_id())),
- params,
- &parameters_permissions_);
-
- // Check, if RPC is allowed by policy
- if (mobile_apis::Result::SUCCESS != check_result) {
- smart_objects::SmartObjectSPtr response =
- MessageHelper::CreateBlockedByPoliciesResponse(
- static_cast<mobile_api::FunctionID::eType>(function_id()),
- check_result,
- correlation_id(),
- app->app_id());
-
- rpc_service_.SendMessageToMobile(response);
- return false;
- }
-
- // If no parameters specified in policy table, no restriction will be
- // applied for parameters
- if (parameters_permissions_.allowed_params.empty() &&
- parameters_permissions_.disallowed_params.empty() &&
- parameters_permissions_.undefined_params.empty()) {
- return true;
- }
-
- RemoveDisallowedParameters();
-
- return true;
+ return CommandImpl::CheckAllowedParameters(source);
}
bool CommandRequestImpl::CheckHMICapabilities(
@@ -669,16 +716,14 @@ bool CommandRequestImpl::CheckHMICapabilities(
return false;
}
- const SmartObject* button_capabilities_so =
- hmi_capabilities_.button_capabilities();
- if (!button_capabilities_so) {
+ auto button_capabilities = hmi_capabilities_.button_capabilities();
+ if (!button_capabilities) {
LOG4CXX_ERROR(logger_, "Invalid button capabilities object");
return false;
}
- const SmartObject& button_capabilities = *button_capabilities_so;
- for (size_t i = 0; i < button_capabilities.length(); ++i) {
- const SmartObject& capabilities = button_capabilities[i];
+ for (size_t i = 0; i < button_capabilities->length(); ++i) {
+ const SmartObject& capabilities = (*button_capabilities)[i];
const ButtonName::eType current_button = static_cast<ButtonName::eType>(
capabilities.getElement(hmi_response::button_name).asInt());
if (current_button == button) {
@@ -693,63 +738,6 @@ bool CommandRequestImpl::CheckHMICapabilities(
return false;
}
-void CommandRequestImpl::RemoveDisallowedParameters() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- smart_objects::SmartObject& params = (*message_)[strings::msg_params];
-
- // Remove from request all disallowed parameters
- RPCParams::const_iterator it_disallowed =
- parameters_permissions_.disallowed_params.begin();
- RPCParams::const_iterator it_disallowed_end =
- parameters_permissions_.disallowed_params.end();
- for (; it_disallowed != it_disallowed_end; ++it_disallowed) {
- if (params.keyExists(*it_disallowed)) {
- const std::string key = *it_disallowed;
- params.erase(key);
- removed_parameters_permissions_.disallowed_params.insert(key);
- LOG4CXX_INFO(logger_,
- "Following parameter is disallowed by user: " << key);
- }
- }
-
- // Remove from request all undefined yet parameters
- RPCParams::const_iterator it_undefined =
- parameters_permissions_.undefined_params.begin();
- RPCParams::const_iterator it_undefined_end =
- parameters_permissions_.undefined_params.end();
- for (; it_undefined != it_undefined_end; ++it_undefined) {
- if (params.keyExists(*it_undefined)) {
- const std::string key = *it_undefined;
- params.erase(key);
- removed_parameters_permissions_.undefined_params.insert(key);
- LOG4CXX_INFO(logger_,
- "Following parameter is disallowed by policy: " << key);
- }
- }
-
- // Remove from request all parameters missed in allowed
- const VehicleData& vehicle_data =
- application_manager::MessageHelper::vehicle_data();
-
- VehicleData::const_iterator it_vehicle_data = vehicle_data.begin();
- VehicleData::const_iterator it_vehicle_data_end = vehicle_data.end();
- for (; it_vehicle_data != it_vehicle_data_end; ++it_vehicle_data) {
- const std::string key = it_vehicle_data->first;
- if (params.keyExists(key) &&
- parameters_permissions_.allowed_params.end() ==
- std::find(parameters_permissions_.allowed_params.begin(),
- parameters_permissions_.allowed_params.end(),
- key)) {
- params.erase(key);
- removed_parameters_permissions_.undefined_params.insert(key);
- LOG4CXX_INFO(logger_,
- "Following parameter is not found among allowed parameters '"
- << key << "' and will be treated as disallowed.");
- }
- }
-}
-
void CommandRequestImpl::AddDissalowedParameterToInfoString(
std::string& info, const std::string& param) const {
// prepare disallowed params enumeration for response info string
@@ -808,18 +796,39 @@ bool CommandRequestImpl::HasDisallowedParams() const {
(!removed_parameters_permissions_.undefined_params.empty()));
}
+bool CommandRequestImpl::IsMobileResultSuccess(
+ const mobile_apis::Result::eType result_code) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+ return Compare<mobile_apis::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WARNINGS,
+ mobile_apis::Result::WRONG_LANGUAGE,
+ mobile_apis::Result::RETRY,
+ mobile_apis::Result::SAVED,
+ mobile_apis::Result::TRUNCATED_DATA);
+}
+
+bool CommandRequestImpl::IsHMIResultSuccess(
+ const hmi_apis::Common_Result::eType result_code) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+ return Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ result_code,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED,
+ hmi_apis::Common_Result::TRUNCATED_DATA);
+}
+
bool CommandRequestImpl::PrepareResultForMobileResponse(
hmi_apis::Common_Result::eType result_code,
HmiInterfaces::InterfaceID interface) const {
LOG4CXX_AUTO_TRACE(logger_);
- using namespace helpers;
- if (Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
- result_code,
- hmi_apis::Common_Result::SUCCESS,
- hmi_apis::Common_Result::WARNINGS,
- hmi_apis::Common_Result::WRONG_LANGUAGE,
- hmi_apis::Common_Result::RETRY,
- hmi_apis::Common_Result::SAVED)) {
+ if (IsHMIResultSuccess(result_code)) {
return true;
}
@@ -835,8 +844,8 @@ bool CommandRequestImpl::PrepareResultForMobileResponse(
bool CommandRequestImpl::PrepareResultForMobileResponse(
ResponseInfo& out_first, ResponseInfo& out_second) const {
LOG4CXX_AUTO_TRACE(logger_);
- bool result = CheckResultCode(out_first, out_second) ||
- CheckResultCode(out_second, out_first);
+ bool result =
+ CheckResult(out_first, out_second) || CheckResult(out_second, out_first);
return result;
}
@@ -956,7 +965,7 @@ const std::string InfoInterfaceSeparator(
void CommandRequestImpl::AddTimeOutComponentInfoToMessage(
smart_objects::SmartObject& response) const {
- using NsSmartDeviceLink::NsSmartObjects::SmartObject;
+ using ns_smart_device_link::ns_smart_objects::SmartObject;
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_);
if (awaiting_response_interfaces_.empty()) {
diff --git a/src/components/application_manager/src/commands/command_request_to_mobile.cc b/src/components/application_manager/src/commands/command_request_to_mobile.cc
new file mode 100644
index 0000000000..add58c9973
--- /dev/null
+++ b/src/components/application_manager/src/commands/command_request_to_mobile.cc
@@ -0,0 +1,76 @@
+/*
+ Copyright (c) 2014, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/commands/command_request_to_mobile.h"
+#include "application_manager/rpc_service.h"
+
+namespace application_manager {
+
+namespace commands {
+
+CommandRequestToMobile::CommandRequestToMobile(
+ const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CommandRequestToMobile::~CommandRequestToMobile() {}
+
+bool CommandRequestToMobile::Init() {
+ return true;
+}
+
+bool CommandRequestToMobile::CheckPermissions() {
+ return CheckAllowedParameters(Command::CommandSource::SOURCE_SDL);
+}
+
+bool CommandRequestToMobile::CleanUp() {
+ return true;
+}
+
+void CommandRequestToMobile::Run() {
+ SendRequest();
+}
+
+void CommandRequestToMobile::SendRequest() {
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/command_response_from_mobile.cc b/src/components/application_manager/src/commands/command_response_from_mobile.cc
new file mode 100644
index 0000000000..1e31ca8ff5
--- /dev/null
+++ b/src/components/application_manager/src/commands/command_response_from_mobile.cc
@@ -0,0 +1,75 @@
+/*
+ Copyright (c) 2013, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/commands/command_response_from_mobile.h"
+#include "application_manager/rpc_service.h"
+#include "smart_objects/smart_object.h"
+
+namespace application_manager {
+
+namespace commands {
+
+CommandResponseFromMobile::CommandResponseFromMobile(
+ const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : CommandImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+CommandResponseFromMobile::~CommandResponseFromMobile() {}
+
+bool CommandResponseFromMobile::Init() {
+ return true;
+}
+
+bool CommandResponseFromMobile::CheckPermissions() {
+ return CheckAllowedParameters(Command::CommandSource::SOURCE_MOBILE);
+}
+
+bool CommandResponseFromMobile::CleanUp() {
+ return true;
+}
+
+void CommandResponseFromMobile::Run() {}
+
+void CommandResponseFromMobile::SendResponse() {
+ rpc_service_.ManageMobileCommand(message_, SOURCE_SDL);
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/notification_from_hmi.cc b/src/components/application_manager/src/commands/notification_from_hmi.cc
index 1fef383213..5e1314bad3 100644
--- a/src/components/application_manager/src/commands/notification_from_hmi.cc
+++ b/src/components/application_manager/src/commands/notification_from_hmi.cc
@@ -73,10 +73,25 @@ void NotificationFromHMI::SendNotificationToMobile(
rpc_service_.ManageMobileCommand(message, SOURCE_SDL);
}
+void NotificationFromHMI::SendNotificationToMobile(
+ const MessageSharedPtr& message,
+ const mobile_apis::FunctionID::eType& mobile_function_id) {
+ (*message)[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ (*message)[strings::params][strings::function_id] = mobile_function_id;
+ rpc_service_.ManageMobileCommand(message, SOURCE_SDL);
+}
+
+void NotificationFromHMI::SendNotificationToHMI(MessageSharedPtr& message) {
+ (*message)[strings::params][strings::protocol_type] = hmi_protocol_type_;
+ rpc_service_.ManageHMICommand(message, SOURCE_SDL_TO_HMI);
+}
+
void NotificationFromHMI::CreateHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
const smart_objects::SmartObject& msg_params) const {
- smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>();
if (!result) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
return;
@@ -86,7 +101,7 @@ void NotificationFromHMI::CreateHMIRequest(
const uint32_t hmi_correlation_id_ =
application_manager_.GetNextHMICorrelationID();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& request = *result;
+ ns_smart_device_link::ns_smart_objects::SmartObject& request = *result;
request[strings::params][strings::message_type] =
static_cast<int32_t>(application_manager::MessageType::kRequest);
request[strings::params][strings::function_id] =
@@ -105,6 +120,12 @@ void NotificationFromHMI::CreateHMIRequest(
}
}
+void NotificationFromHMI::SendNotificationToConsumers(
+ const mobile_apis::FunctionID::eType& mobile_function_id) {
+ SendNotificationToHMI(message_);
+ SendNotificationToMobile(message_, mobile_function_id);
+}
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc
index f77495ac31..1cf5c50cdd 100644
--- a/src/components/application_manager/src/commands/request_from_hmi.cc
+++ b/src/components/application_manager/src/commands/request_from_hmi.cc
@@ -31,9 +31,16 @@
*/
#include "application_manager/commands/request_from_hmi.h"
+
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager.h"
+#include "application_manager/request_info.h"
#include "application_manager/rpc_service.h"
-#include "utils/make_shared.h"
+#include "utils/helpers.h"
+
+#include "smart_objects/enum_schema_item.h"
+
+#include "smart_objects/enum_schema_item.h"
namespace application_manager {
@@ -68,30 +75,40 @@ void RequestFromHMI::Run() {}
void RequestFromHMI::on_event(const event_engine::Event& event) {}
+void RequestFromHMI::on_event(const event_engine::MobileEvent& event) {}
+
void RequestFromHMI::SendResponse(
const bool success,
const uint32_t correlation_id,
const hmi_apis::FunctionID::eType function_id,
- const hmi_apis::Common_Result::eType result_code) {
+ const hmi_apis::Common_Result::eType result_code,
+ const smart_objects::SmartObject* response_params,
+ commands::Command::CommandSource source) {
smart_objects::SmartObjectSPtr message =
- ::utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
FillCommonParametersOfSO(*message, correlation_id, function_id);
(*message)[strings::params][strings::message_type] = MessageType::kResponse;
- (*message)[strings::params][hmi_response::code] = 0;
+ (*message)[strings::params][hmi_response::code] = result_code;
+
+ if (response_params) {
+ (*message)[strings::msg_params] = *response_params;
+ }
+
(*message)[strings::msg_params][strings::success] = success;
(*message)[strings::msg_params][strings::result_code] = result_code;
- rpc_service_.ManageHMICommand(message);
+ rpc_service_.ManageHMICommand(message, source);
}
void RequestFromHMI::SendErrorResponse(
const uint32_t correlation_id,
const hmi_apis::FunctionID::eType function_id,
const hmi_apis::Common_Result::eType result_code,
- const std::string error_message) {
+ const std::string error_message,
+ commands::Command::CommandSource source) {
smart_objects::SmartObjectSPtr message =
- ::utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
FillCommonParametersOfSO(*message, correlation_id, function_id);
(*message)[strings::params][strings::message_type] =
@@ -99,7 +116,7 @@ void RequestFromHMI::SendErrorResponse(
(*message)[strings::params][hmi_response::code] = result_code;
(*message)[strings::params][strings::error_msg] = error_message;
- rpc_service_.ManageHMICommand(message);
+ rpc_service_.ManageHMICommand(message, source);
}
void RequestFromHMI::FillCommonParametersOfSO(
@@ -112,5 +129,191 @@ void RequestFromHMI::FillCommonParametersOfSO(
(message)[strings::params][strings::correlation_id] = correlation_id;
}
+bool RequestFromHMI::IsMobileResultSuccess(
+ mobile_apis::Result::eType result_code) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+ return Compare<mobile_apis::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WARNINGS,
+ mobile_apis::Result::WRONG_LANGUAGE,
+ mobile_apis::Result::RETRY,
+ mobile_apis::Result::SAVED);
+}
+
+bool RequestFromHMI::IsHMIResultSuccess(
+ hmi_apis::Common_Result::eType result_code,
+ HmiInterfaces::InterfaceID interface) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+ if (Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ result_code,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::WRONG_LANGUAGE,
+ hmi_apis::Common_Result::RETRY,
+ hmi_apis::Common_Result::SAVED)) {
+ return true;
+ }
+
+ const HmiInterfaces::InterfaceState state =
+ application_manager_.hmi_interfaces().GetInterfaceState(interface);
+ if ((hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code) &&
+ (HmiInterfaces::STATE_NOT_AVAILABLE != state)) {
+ return true;
+ }
+ return false;
+}
+
+void RequestFromHMI::SendProviderRequest(
+ const mobile_apis::FunctionID::eType& mobile_function_id,
+ const hmi_apis::FunctionID::eType& hmi_function_id,
+ const smart_objects::SmartObject* msg,
+ bool use_events) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool hmi_destination = false;
+ ApplicationSharedPtr app;
+ // Default error code and error message
+ std::string error_msg = "No app service provider available";
+ hmi_apis::Common_Result::eType error_code =
+ hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
+
+ if ((*msg)[strings::msg_params].keyExists(strings::service_type)) {
+ std::string service_type =
+ (*msg)[strings::msg_params][strings::service_type].asString();
+ application_manager_.GetAppServiceManager().GetProviderByType(
+ service_type, false, app, hmi_destination);
+ error_msg = "No app service provider with serviceType: " + service_type +
+ " is available";
+ error_code = hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
+ } else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) {
+ std::string service_id =
+ (*msg)[strings::msg_params][strings::service_id].asString();
+ application_manager_.GetAppServiceManager().GetProviderByID(
+ service_id, false, app, hmi_destination);
+ error_msg = "No app service provider with serviceId: " + service_id +
+ " is available";
+ error_code = hmi_apis::Common_Result::INVALID_ID;
+ }
+
+ if (hmi_destination) {
+ LOG4CXX_DEBUG(logger_, "Sending Request to HMI Provider");
+ application_manager_.IncreaseForwardedRequestTimeout(
+ application_manager::request_controller::RequestInfo::HmiConnectionKey,
+ correlation_id());
+ SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events);
+ return;
+ }
+
+ if (!app) {
+ LOG4CXX_DEBUG(logger_, "Invalid App Provider pointer");
+ SendErrorResponse(correlation_id(),
+ static_cast<hmi_apis::FunctionID::eType>(function_id()),
+ error_code,
+ error_msg,
+ commands::Command::CommandSource::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Sending Request to Mobile Provider");
+ application_manager_.IncreaseForwardedRequestTimeout(
+ application_manager::request_controller::RequestInfo::HmiConnectionKey,
+ correlation_id());
+ SendMobileRequest(
+ mobile_function_id, app, &(*msg)[strings::msg_params], use_events);
+}
+
+void RequestFromHMI::SendMobileRequest(
+ const mobile_apis::FunctionID::eType& function_id,
+ const ApplicationSharedPtr app,
+ const smart_objects::SmartObject* msg_params,
+ bool use_events) {
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>();
+
+ const uint32_t mobile_correlation_id =
+ application_manager_.GetNextMobileCorrelationID();
+
+ smart_objects::SmartObject& request = *result;
+
+ request[strings::params][strings::message_type] = MessageType::kRequest;
+ request[strings::params][strings::function_id] = function_id;
+ request[strings::params][strings::correlation_id] = mobile_correlation_id;
+ request[strings::params][strings::protocol_version] = app->protocol_version();
+ request[strings::params][strings::protocol_type] =
+ CommandImpl::mobile_protocol_type_;
+
+ request[strings::params][strings::connection_key] = app->app_id();
+
+ if (msg_params) {
+ request[strings::msg_params] = *msg_params;
+ }
+
+ if (use_events) {
+ LOG4CXX_DEBUG(logger_,
+ "RequestFromHMI subscribe_on_event "
+ << function_id << " " << mobile_correlation_id);
+ subscribe_on_event(function_id, mobile_correlation_id);
+ }
+ if (!rpc_service_.ManageMobileCommand(
+ result, commands::Command::CommandSource::SOURCE_SDL)) {
+ LOG4CXX_ERROR(logger_, "Unable to send request to mobile");
+ }
+}
+
+void RequestFromHMI::SendHMIRequest(
+ const hmi_apis::FunctionID::eType& function_id,
+ const smart_objects::SmartObject* msg_params,
+ bool use_events) {
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>();
+
+ const uint32_t hmi_correlation_id =
+ application_manager_.GetNextHMICorrelationID();
+
+ smart_objects::SmartObject& request = *result;
+ request[strings::params][strings::message_type] = MessageType::kRequest;
+ request[strings::params][strings::function_id] = function_id;
+ request[strings::params][strings::correlation_id] = hmi_correlation_id;
+ request[strings::params][strings::protocol_type] =
+ CommandImpl::hmi_protocol_type_;
+
+ if (msg_params) {
+ request[strings::msg_params] = *msg_params;
+ }
+
+ if (use_events) {
+ LOG4CXX_DEBUG(logger_,
+ "RequestFromHMI subscribe_on_event " << function_id << " "
+ << hmi_correlation_id);
+ subscribe_on_event(function_id, hmi_correlation_id);
+ }
+ if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) {
+ if (!rpc_service_.ManageHMICommand(
+ result, commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) {
+ LOG4CXX_ERROR(logger_, "Unable to send request");
+ }
+ } else {
+ LOG4CXX_DEBUG(logger_, "Interface is not available");
+ }
+}
+
+bool RequestFromHMI::ProcessHMIInterfacesAvailability(
+ const uint32_t hmi_correlation_id,
+ const hmi_apis::FunctionID::eType& function_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces();
+ HmiInterfaces::InterfaceID interface =
+ hmi_interfaces.GetInterfaceFromFunction(function_id);
+ DCHECK(interface != HmiInterfaces::HMI_INTERFACE_INVALID_ENUM);
+ const HmiInterfaces::InterfaceState state =
+ hmi_interfaces.GetInterfaceState(interface);
+ if (HmiInterfaces::STATE_NOT_AVAILABLE == state) {
+ return false;
+ }
+ return true;
+}
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/response_from_hmi.cc b/src/components/application_manager/src/commands/response_from_hmi.cc
index 123dbad828..c88b14bf9c 100644
--- a/src/components/application_manager/src/commands/response_from_hmi.cc
+++ b/src/components/application_manager/src/commands/response_from_hmi.cc
@@ -80,7 +80,8 @@ void ResponseFromHMI::SendResponseToMobile(
void ResponseFromHMI::CreateHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
const smart_objects::SmartObject& msg_params) const {
- smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>();
if (!result) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
@@ -91,7 +92,7 @@ void ResponseFromHMI::CreateHMIRequest(
const uint32_t hmi_correlation_id_ =
application_manager_.GetNextHMICorrelationID();
- NsSmartDeviceLink::NsSmartObjects::SmartObject& request = *result;
+ ns_smart_device_link::ns_smart_objects::SmartObject& request = *result;
request[strings::params][strings::message_type] = MessageType::kRequest;
request[strings::params][strings::function_id] = function_id;
request[strings::params][strings::correlation_id] = hmi_correlation_id_;
diff --git a/src/components/application_manager/src/display_capabilities_builder.cc b/src/components/application_manager/src/display_capabilities_builder.cc
new file mode 100644
index 0000000000..8234128280
--- /dev/null
+++ b/src/components/application_manager/src/display_capabilities_builder.cc
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/display_capabilities_builder.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/smart_object_keys.h"
+namespace application_manager {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "DisplayCapabilitiesBuilder")
+
+const WindowID kDefaultWindowID = 0;
+
+DisplayCapabilitiesBuilder::DisplayCapabilitiesBuilder(Application& application)
+ : owner_(application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+void DisplayCapabilitiesBuilder::InitBuilder(
+ DisplayCapabilitiesBuilder::ResumeCallback resume_callback,
+ const smart_objects::SmartObject& windows_info) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+ resume_callback_ = resume_callback;
+ window_ids_to_resume_.insert(kDefaultWindowID);
+ for (size_t i = 0; i < windows_info.length(); ++i) {
+ auto window_id = windows_info[i][strings::window_id].asInt();
+ LOG4CXX_DEBUG(logger_,
+ "Inserting " << window_id << " to waiting container");
+ window_ids_to_resume_.insert(window_id);
+ }
+}
+
+void DisplayCapabilitiesBuilder::UpdateDisplayCapabilities(
+ const smart_objects::SmartObject& incoming_display_capabilities) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace smart_objects;
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+
+ if (!display_capabilities_) {
+ display_capabilities_ = std::make_shared<SmartObject>(SmartType_Array);
+ }
+
+ // As per v6.0, only single display is supported
+ auto cur_window_caps =
+ (*display_capabilities_)[0][strings::window_capabilities];
+
+ const auto& inc_window_caps =
+ incoming_display_capabilities[0][strings::window_capabilities];
+
+ for (size_t i = 0; i < inc_window_caps.length(); ++i) {
+ const WindowID window_id =
+ inc_window_caps[i].keyExists(strings::window_id)
+ ? inc_window_caps[i][strings::window_id].asInt()
+ : kDefaultWindowID;
+ if (window_ids_to_resume_.end() != window_ids_to_resume_.find(window_id)) {
+ cur_window_caps[cur_window_caps.length()] = inc_window_caps[i];
+ LOG4CXX_DEBUG(logger_, "Stop waiting for: " << window_id);
+ window_ids_to_resume_.erase(window_id);
+ }
+ }
+
+ *display_capabilities_ = incoming_display_capabilities;
+ (*display_capabilities_)[0][strings::window_capabilities] = cur_window_caps;
+
+ if (window_ids_to_resume_.empty()) {
+ LOG4CXX_TRACE(logger_, "Invoking resume callback");
+ resume_callback_(owner_, *display_capabilities_);
+ display_capabilities_.reset();
+ }
+} // namespace application_manager
+
+const smart_objects::SmartObjectSPtr
+DisplayCapabilitiesBuilder::display_capabilities() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return display_capabilities_;
+}
+
+void DisplayCapabilitiesBuilder::ResetDisplayCapabilities() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+ display_capabilities_.reset();
+}
+
+void DisplayCapabilitiesBuilder::StopWaitingForWindow(
+ const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+ LOG4CXX_DEBUG(logger_,
+ "Window id " << window_id << " will be erased due to failure");
+ window_ids_to_resume_.erase(window_id);
+ if (window_ids_to_resume_.empty()) {
+ LOG4CXX_TRACE(logger_,
+ window_id << " was the last window pending resumption. "
+ "Invoking resume callback");
+ resume_callback_(owner_, *display_capabilities_);
+ display_capabilities_.reset();
+ }
+}
+} // namespace application_manager
diff --git a/src/components/application_manager/src/event_engine/event.cc b/src/components/application_manager/src/event_engine/event.cc
index cc180ca950..ecdeb41a2e 100644
--- a/src/components/application_manager/src/event_engine/event.cc
+++ b/src/components/application_manager/src/event_engine/event.cc
@@ -48,5 +48,17 @@ void Event::set_smart_object(const smart_objects::SmartObject& so) {
response_so_ = so;
}
+MobileEvent::MobileEvent(const MobileEventID& id) : id_(id), response_so_() {}
+
+MobileEvent::~MobileEvent() {}
+
+void MobileEvent::raise(EventDispatcher& event_dispatcher) {
+ event_dispatcher.raise_mobile_event(*this);
+}
+
+void MobileEvent::set_smart_object(const smart_objects::SmartObject& so) {
+ response_so_ = so;
+}
+
} // namespace event_engine
} // namespace application_manager
diff --git a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc
index b19a6f9194..30b1b83e79 100644
--- a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc
+++ b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc
@@ -31,16 +31,15 @@
*/
#include "application_manager/event_engine/event_dispatcher_impl.h"
-#include "interfaces/HMI_API.h"
-#include "application_manager/event_engine/event_observer.h"
#include <algorithm>
+#include "application_manager/event_engine/event_observer.h"
+#include "interfaces/HMI_API.h"
namespace application_manager {
namespace event_engine {
using namespace sync_primitives;
-EventDispatcherImpl::EventDispatcherImpl()
- : state_lock_(false), observer_lock_(true), observers_event_() {}
+EventDispatcherImpl::EventDispatcherImpl() : observers_event_() {}
EventDispatcherImpl::~EventDispatcherImpl() {}
@@ -123,5 +122,78 @@ void EventDispatcherImpl::remove_observer_from_vector(EventObserver& observer) {
observers_.end());
}
+// Mobile Events
+
+void EventDispatcherImpl::raise_mobile_event(const MobileEvent& event) {
+ AutoLock observer_lock(mobile_observer_lock_);
+ {
+ AutoLock state_lock(mobile_state_lock_);
+
+ // check if event is notification
+ if (mobile_apis::messageType::notification == event.smart_object_type()) {
+ const uint32_t notification_correlation_id = 0;
+ mobile_observers_ =
+ mobile_observers_event_[event.id()][notification_correlation_id];
+ }
+
+ if (mobile_apis::messageType::response == event.smart_object_type()) {
+ mobile_observers_ =
+ mobile_observers_event_[event.id()]
+ [event.smart_object_correlation_id()];
+ }
+ }
+
+ // Call observers
+ while (!mobile_observers_.empty()) {
+ EventObserver* temp = *mobile_observers_.begin();
+ mobile_observers_.erase(mobile_observers_.begin());
+ AutoUnlock unlock_observer(observer_lock);
+ temp->on_event(event);
+ }
+}
+
+void EventDispatcherImpl::add_mobile_observer(
+ const MobileEvent::MobileEventID& event_id,
+ int32_t mobile_correlation_id,
+ EventObserver& observer) {
+ AutoLock auto_lock(mobile_state_lock_);
+ mobile_observers_event_[event_id][mobile_correlation_id].push_back(&observer);
+}
+
+void EventDispatcherImpl::remove_mobile_observer(
+ const MobileEvent::MobileEventID& event_id, EventObserver& observer) {
+ remove_mobile_observer_from_vector(observer);
+ AutoLock auto_lock(mobile_state_lock_);
+ ObserversMap::iterator it = mobile_observers_event_[event_id].begin();
+
+ for (; mobile_observers_event_[event_id].end() != it; ++it) {
+ ObserverVector& obs_vec = it->second;
+ const ObserverVector::iterator obs_vec_it = obs_vec.end();
+ obs_vec.erase(
+ std::remove_if(
+ obs_vec.begin(), obs_vec_it, IdCheckFunctor(observer.id())),
+ obs_vec_it);
+ }
+}
+
+void EventDispatcherImpl::remove_mobile_observer(EventObserver& observer) {
+ remove_mobile_observer_from_vector(observer);
+ MobileEventObserverMap::iterator event_map = mobile_observers_event_.begin();
+
+ for (; mobile_observers_event_.end() != event_map; ++event_map) {
+ remove_mobile_observer(event_map->first, observer);
+ }
+}
+
+void EventDispatcherImpl::remove_mobile_observer_from_vector(
+ EventObserver& observer) {
+ AutoLock auto_lock(mobile_observer_lock_);
+
+ mobile_observers_.erase(
+ std::remove_if(
+ observers_.begin(), observers_.end(), IdCheckFunctor(observer.id())),
+ observers_.end());
+}
+
} // namespace event_engine
} // namespace application_manager
diff --git a/src/components/application_manager/src/event_engine/event_observer.cc b/src/components/application_manager/src/event_engine/event_observer.cc
index f89f6649b1..e17203f2f2 100644
--- a/src/components/application_manager/src/event_engine/event_observer.cc
+++ b/src/components/application_manager/src/event_engine/event_observer.cc
@@ -44,7 +44,8 @@ EventObserver::EventObserver(EventDispatcher& event_dispatcher)
}
EventObserver::~EventObserver() {
- unsubscribe_from_all_events();
+ unsubscribe_from_all_hmi_events();
+ unsubscribe_from_all_mobile_events();
}
void EventObserver::subscribe_on_event(const Event::EventID& event_id,
@@ -56,9 +57,25 @@ void EventObserver::unsubscribe_from_event(const Event::EventID& event_id) {
event_dispatcher_.remove_observer(event_id, *this);
}
-void EventObserver::unsubscribe_from_all_events() {
+void EventObserver::unsubscribe_from_all_hmi_events() {
event_dispatcher_.remove_observer(*this);
}
+void EventObserver::subscribe_on_event(
+ const MobileEvent::MobileEventID& event_id, int32_t mobile_correlation_id) {
+ event_dispatcher_.add_mobile_observer(event_id, mobile_correlation_id, *this);
+}
+
+void EventObserver::unsubscribe_from_event(
+ const MobileEvent::MobileEventID& event_id) {
+ event_dispatcher_.remove_mobile_observer(event_id, *this);
+}
+
+void EventObserver::unsubscribe_from_all_mobile_events() {
+ event_dispatcher_.remove_mobile_observer(*this);
+}
+
+void EventObserver::on_event(const event_engine::MobileEvent& event) {}
+
} // namespace event_engine
} // namespace application_manager
diff --git a/src/components/application_manager/src/help_prompt_manager_impl.cc b/src/components/application_manager/src/help_prompt_manager_impl.cc
new file mode 100644
index 0000000000..ec883e5fc2
--- /dev/null
+++ b/src/components/application_manager/src/help_prompt_manager_impl.cc
@@ -0,0 +1,388 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/help_prompt_manager_impl.h"
+
+#include <algorithm>
+#include <iterator>
+
+#include "application_manager/application.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "utils/logger.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "HelpPromptManagerImpl")
+
+namespace {
+const size_t kLimitCommand = 30;
+}
+
+namespace application_manager {
+
+HelpPromptManagerImpl::HelpPromptManagerImpl(Application& app,
+ ApplicationManager& app_manager)
+ : app_(app)
+ , app_manager_(app_manager)
+ , sending_type_(SendingType::kSendBoth)
+ , is_tts_send_(false)
+ , is_ui_send_(false) {}
+
+HelpPromptManagerImpl::~HelpPromptManagerImpl() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+bool HelpPromptManagerImpl::AddCommand(
+ const uint32_t cmd_id, const smart_objects::SmartObject& command) {
+ if (!command.keyExists(strings::vr_commands)) {
+ LOG4CXX_DEBUG(logger_, "vr_commands does`t present");
+ return false;
+ }
+
+ const smart_objects::SmartObject& commands = command[strings::vr_commands];
+ if (commands.empty()) {
+ LOG4CXX_DEBUG(logger_, "vr_commands array is empty");
+ return false;
+ }
+
+ sync_primitives::AutoLock lock(vr_commands_lock_);
+ auto it = std::find_if(
+ vr_commands_.begin(),
+ vr_commands_.end(),
+ [cmd_id](const VRCommandPair& pair) { return pair.first == cmd_id; });
+
+ if (vr_commands_.end() != it) {
+ LOG4CXX_DEBUG(logger_, "Command with id:" << cmd_id << " already exists");
+ return false;
+ }
+
+ const bool limit_exceeded =
+ kLimitCommand <= GetCommandsCount(vr_commands_.end());
+
+ LOG4CXX_DEBUG(
+ logger_,
+ "Will be added first command from array " << strings::vr_commands);
+
+ smart_objects::SmartObjectSPtr vr_item =
+ std::make_shared<smart_objects::SmartObject>(commands.asArray()->front());
+ vr_commands_.push_back(std::make_pair(cmd_id, vr_item));
+
+ LOG4CXX_DEBUG(logger_,
+ "VR command with id: " << cmd_id << " added for appID: "
+ << app_.app_id() << ". Total "
+ << vr_commands_.size() << " in cache");
+
+ return !limit_exceeded;
+}
+
+bool HelpPromptManagerImpl::DeleteCommand(const uint32_t cmd_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ sync_primitives::AutoLock lock(vr_commands_lock_);
+
+ auto it = std::find_if(
+ vr_commands_.begin(),
+ vr_commands_.end(),
+ [cmd_id](const VRCommandPair& pair) { return pair.first == cmd_id; });
+
+ if (vr_commands_.end() == it) {
+ LOG4CXX_WARN(logger_, "VR command with id: " << cmd_id << " not found");
+ return false;
+ }
+
+ const size_t commands_before_current = GetCommandsCount(it);
+ vr_commands_.erase(it);
+ LOG4CXX_DEBUG(logger_,
+ "VR command with id: "
+ << cmd_id << " found after " << commands_before_current
+ << " commands was deleted for appID: " << app_.app_id()
+ << " Cache size after deleting: " << vr_commands_.size());
+
+ return commands_before_current < kLimitCommand;
+}
+
+void HelpPromptManagerImpl::OnVrCommandAdded(
+ const uint32_t cmd_id,
+ const smart_objects::SmartObject& command,
+ const bool is_resumption) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (SendingType::kNoneSend == sending_type_) {
+ LOG4CXX_DEBUG(logger_,
+ "SendingType::kNoneSend"
+ << " commands with id:" << cmd_id
+ << " will not be added");
+ return;
+ }
+ if (AddCommand(cmd_id, command) && !is_resumption) {
+ SendRequests();
+ }
+}
+
+void HelpPromptManagerImpl::OnVrCommandDeleted(const uint32_t cmd_id,
+ const bool is_resumption) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (SendingType::kNoneSend == sending_type_) {
+ LOG4CXX_DEBUG(logger_,
+ "SendingType::kNoneSend"
+ << " commands with id:" << cmd_id
+ << " will not be deleted");
+ return;
+ }
+ if (DeleteCommand(cmd_id) && !is_resumption) {
+ SendRequests();
+ }
+}
+
+void HelpPromptManagerImpl::OnSetGlobalPropertiesReceived(
+ const smart_objects::SmartObject& msg, const bool is_response) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (SendingType::kNoneSend == sending_type_) {
+ LOG4CXX_DEBUG(logger_,
+ "SendingType::kNoneSend"
+ " do not track SetGlobalProperties");
+ return;
+ }
+
+ if (!is_response) {
+ if (msg.keyExists(strings::help_prompt)) {
+ is_tts_send_ = true;
+ }
+ if (msg.keyExists(strings::vr_help)) {
+ is_ui_send_ = true;
+ }
+
+ LOG4CXX_DEBUG(logger_, "is_tts_send_:" << is_tts_send_);
+ LOG4CXX_DEBUG(logger_, "is_ui_send_:" << is_ui_send_);
+ return;
+ }
+
+ SetSendingType(msg);
+}
+
+HelpPromptManagerImpl::SendingType HelpPromptManagerImpl::GetSendingType()
+ const {
+ return sending_type_;
+}
+
+size_t HelpPromptManagerImpl::GetCommandsCount(
+ VRCommandPairs::const_iterator end_element) const {
+ return std::distance(vr_commands_.begin(), end_element);
+}
+
+void HelpPromptManagerImpl::GenerateVrItems(
+ smart_objects::SmartObject& out_msg_params, const char* vr_key) const {
+ out_msg_params[vr_key] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ const size_t count_to_add = std::min(vr_commands_.size(), kLimitCommand);
+ for (size_t i = 0; i < count_to_add; ++i) {
+ const VRCommandPair& pair = vr_commands_[i];
+
+ smart_objects::SmartObject item(smart_objects::SmartType_Map);
+ item[strings::text] = pair.second->asString();
+ if (strings::help_prompt == vr_key) {
+ item[strings::type] = mobile_apis::SpeechCapabilities::SC_TEXT;
+ } else {
+ item[strings::position] = i + 1;
+ }
+
+ out_msg_params[vr_key][i] = item;
+ }
+}
+
+void HelpPromptManagerImpl::SendTTSRequest() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "TTS request for appID:" << app_.app_id());
+ smart_objects::SmartObjectSPtr tts_global_properties =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ if (tts_global_properties) {
+ smart_objects::SmartObject& ref = *tts_global_properties;
+
+ ref[strings::params][strings::message_type] =
+ hmi_apis::messageType::request;
+ ref[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ ref[strings::params][strings::protocol_type] =
+ commands::CommandImpl::hmi_protocol_type_;
+ ref[strings::params][strings::correlation_id] =
+ app_manager_.GetNextHMICorrelationID();
+
+ smart_objects::SmartObject& so_to_send = *tts_global_properties;
+ so_to_send[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::TTS_SetGlobalProperties;
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ CreatePromptMsg(msg_params);
+
+ msg_params[strings::app_id] = app_.app_id();
+ so_to_send[strings::msg_params] = msg_params;
+ app_manager_.GetRPCService().ManageHMICommand(tts_global_properties);
+ }
+ is_tts_send_ = false;
+}
+
+void HelpPromptManagerImpl::SendUIRequest() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "UI request for appID:" << app_.app_id());
+ smart_objects::SmartObjectSPtr ui_global_properties =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ if (ui_global_properties) {
+ smart_objects::SmartObject& ref = *ui_global_properties;
+
+ ref[strings::params][strings::message_type] =
+ hmi_apis::messageType::request;
+ ref[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ ref[strings::params][strings::protocol_type] =
+ commands::CommandImpl::hmi_protocol_type_;
+ ref[strings::params][strings::correlation_id] =
+ app_manager_.GetNextHMICorrelationID();
+
+ smart_objects::SmartObject& so_to_send = *ui_global_properties;
+ so_to_send[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::UI_SetGlobalProperties;
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ CreateVRMsg(msg_params);
+
+ msg_params[strings::app_id] = app_.app_id();
+ so_to_send[strings::msg_params] = msg_params;
+ app_manager_.GetRPCService().ManageHMICommand(ui_global_properties);
+ }
+ is_ui_send_ = false;
+}
+
+void HelpPromptManagerImpl::SendBothRequests() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendTTSRequest();
+ SendUIRequest();
+}
+
+void HelpPromptManagerImpl::SendRequests() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ sync_primitives::AutoLock lock(vr_commands_lock_);
+ switch (sending_type_) {
+ case SendingType::kSendHelpPrompt:
+ SendTTSRequest();
+ return;
+ case SendingType::kSendVRHelp:
+ SendUIRequest();
+ return;
+ case SendingType::kSendBoth:
+ SendBothRequests();
+ return;
+ case SendingType::kNoneSend:
+ break;
+ }
+ LOG4CXX_DEBUG(logger_,
+ "SendingType:" << static_cast<uint32_t>(sending_type_)
+ << " request not sending");
+}
+
+void HelpPromptManagerImpl::CreatePromptMsg(
+ smart_objects::SmartObject& out_msg_params) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ GenerateVrItems(out_msg_params, strings::help_prompt);
+ app_.set_help_prompt(out_msg_params[strings::help_prompt]);
+}
+
+void HelpPromptManagerImpl::CreateVRMsg(
+ smart_objects::SmartObject& out_msg_params) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (false == out_msg_params.keyExists(strings::vr_help_title)) {
+ if (app_.vr_help_title()) {
+ out_msg_params[strings::vr_help_title] = (*app_.vr_help_title());
+ } else {
+ out_msg_params[strings::vr_help_title] = app_.name();
+ }
+ }
+
+ GenerateVrItems(out_msg_params, strings::vr_help);
+
+ if (out_msg_params[strings::vr_help].empty()) {
+ out_msg_params.erase(strings::vr_help);
+ app_.reset_vr_help();
+ } else {
+ app_.set_vr_help(out_msg_params[strings::vr_help]);
+ }
+}
+
+void HelpPromptManagerImpl::SetSendingType(
+ const smart_objects::SmartObject& msg) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ hmi_apis::Common_Result::eType result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ msg[strings::params][hmi_response::code].asInt());
+ LOG4CXX_DEBUG(logger_, "HMI response result:" << result);
+ if (hmi_apis::Common_Result::eType::SUCCESS == result) {
+ hmi_apis::FunctionID::eType function_id =
+ static_cast<hmi_apis::FunctionID::eType>(
+ msg[strings::params][strings::function_id].asUInt());
+ LOG4CXX_DEBUG(logger_, "Function id:" << function_id);
+ switch (function_id) {
+ case hmi_apis::FunctionID::TTS_SetGlobalProperties: {
+ if (is_tts_send_) {
+ is_tts_send_ = false;
+ sending_type_ = SendingType::kSendHelpPrompt == sending_type_
+ ? SendingType::kNoneSend
+ : SendingType::kSendVRHelp;
+ }
+ break;
+ }
+ case hmi_apis::FunctionID::UI_SetGlobalProperties: {
+ if (is_ui_send_) {
+ is_ui_send_ = false;
+ sending_type_ = SendingType::kSendVRHelp == sending_type_
+ ? SendingType::kNoneSend
+ : SendingType::kSendHelpPrompt;
+ }
+ break;
+ }
+ default: { break; }
+ }
+ LOG4CXX_DEBUG(
+ logger_,
+ "Sending type set to:" << static_cast<uint32_t>(sending_type_));
+ }
+}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc
index 66afd6b0b6..fc86eb5e62 100644
--- a/src/components/application_manager/src/helpers/application_helper.cc
+++ b/src/components/application_manager/src/helpers/application_helper.cc
@@ -1,9 +1,9 @@
-#include <vector>
-#include <string>
#include "application_manager/helpers/application_helper.h"
+#include <string>
+#include <vector>
#include "application_manager/message_helper.h"
-#include "utils/logger.h"
#include "utils/file_system.h"
+#include "utils/logger.h"
namespace {
using namespace application_manager;
@@ -21,6 +21,7 @@ void DeleteCommands(ApplicationSharedPtr app, ApplicationManager& app_manager) {
for (auto cmd : cmap) {
MessageHelper::SendDeleteCommandRequest(cmd.second, app, app_manager);
app->RemoveCommand(cmd.first);
+ app->help_prompt_manager().OnVrCommandDeleted(cmd.first, true);
}
}
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index d00fc2ae19..6a0fbf78e3 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -32,19 +32,21 @@
#include <map>
-#include "utils/logger.h"
+#include "application_manager/application_manager.h"
#include "application_manager/hmi_capabilities_impl.h"
-#include "application_manager/application_manager_impl.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/message_helper.h"
#include "application_manager/smart_object_keys.h"
#include "config_profile/profile.h"
#include "formatters/CFormatterJsonBase.h"
#include "interfaces/HMI_API.h"
+#include "smart_objects/smart_object.h"
#include "utils/file_system.h"
+#include "utils/logger.h"
namespace application_manager {
-namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
+namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "HMICapabilities")
namespace {
std::map<std::string, hmi_apis::Common_VrCapabilities::eType>
@@ -99,6 +101,8 @@ void InitCapabilities() {
button_enum_name.insert(
std::make_pair(std::string("OK"), hmi_apis::Common_ButtonName::OK));
button_enum_name.insert(std::make_pair(
+ std::string("PLAY_PAUSE"), hmi_apis::Common_ButtonName::PLAY_PAUSE));
+ button_enum_name.insert(std::make_pair(
std::string("SEEKLEFT"), hmi_apis::Common_ButtonName::SEEKLEFT));
button_enum_name.insert(std::make_pair(
std::string("SEEKRIGHT"), hmi_apis::Common_ButtonName::SEEKRIGHT));
@@ -131,6 +135,46 @@ void InitCapabilities() {
hmi_apis::Common_ButtonName::CUSTOM_BUTTON));
button_enum_name.insert(std::make_pair(std::string("SEARCH"),
hmi_apis::Common_ButtonName::SEARCH));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_CENTER_LOCATION"),
+ hmi_apis::Common_ButtonName::NAV_CENTER_LOCATION));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_ZOOM_IN"), hmi_apis::Common_ButtonName::NAV_ZOOM_IN));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_ZOOM_OUT"), hmi_apis::Common_ButtonName::NAV_ZOOM_OUT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_UP"), hmi_apis::Common_ButtonName::NAV_PAN_UP));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_UP_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_UP_RIGHT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_RIGHT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_DOWN_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_DOWN_RIGHT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_DOWN"), hmi_apis::Common_ButtonName::NAV_PAN_DOWN));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_DOWN_LEFT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_DOWN_LEFT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_LEFT"), hmi_apis::Common_ButtonName::NAV_PAN_LEFT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_UP_LEFT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_UP_LEFT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_TILT_TOGGLE"),
+ hmi_apis::Common_ButtonName::NAV_TILT_TOGGLE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_ROTATE_CLOCKWISE"),
+ hmi_apis::Common_ButtonName::NAV_ROTATE_CLOCKWISE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_ROTATE_COUNTERCLOCKWISE"),
+ hmi_apis::Common_ButtonName::NAV_ROTATE_COUNTERCLOCKWISE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_HEADING_TOGGLE"),
+ hmi_apis::Common_ButtonName::NAV_HEADING_TOGGLE));
text_fields_enum_name.insert(std::make_pair(
std::string("mainField1"), hmi_apis::Common_TextFieldName::mainField1));
@@ -295,6 +339,8 @@ void InitCapabilities() {
image_field_name_enum.insert(
std::make_pair(std::string("locationImage"),
hmi_apis::Common_ImageFieldName::locationImage));
+ image_field_name_enum.insert(std::make_pair(
+ std::string("alertIcon"), hmi_apis::Common_ImageFieldName::alertIcon));
file_type_enum.insert(std::make_pair(std::string("GRAPHIC_BMP"),
hmi_apis::Common_FileType::GRAPHIC_BMP));
@@ -333,6 +379,8 @@ void InitCapabilities() {
std::make_pair(std::string("MFD5"), hmi_apis::Common_DisplayType::MFD5));
display_type_enum.insert(std::make_pair(
std::string("GEN3_8_INCH"), hmi_apis::Common_DisplayType::GEN3_8_INCH));
+ display_type_enum.insert(std::make_pair(
+ std::string("SDL_GENERIC"), hmi_apis::Common_DisplayType::SDL_GENERIC));
character_set_enum.insert(std::make_pair(
std::string("TYPE2SET"), hmi_apis::Common_CharacterSet::TYPE2SET));
@@ -401,6 +449,7 @@ HMICapabilitiesImpl::HMICapabilitiesImpl(ApplicationManager& app_mngr)
, phone_capability_(NULL)
, video_streaming_capability_(NULL)
, rc_capability_(NULL)
+ , seat_location_capability_(NULL)
, app_mngr_(app_mngr)
, hmi_language_handler_(app_mngr) {
InitCapabilities();
@@ -415,20 +464,9 @@ HMICapabilitiesImpl::HMICapabilitiesImpl(ApplicationManager& app_mngr)
}
HMICapabilitiesImpl::~HMICapabilitiesImpl() {
- delete vehicle_type_;
delete ui_supported_languages_;
delete tts_supported_languages_;
delete vr_supported_languages_;
- delete display_capabilities_;
- delete hmi_zone_capabilities_;
- delete soft_buttons_capabilities_;
- delete button_capabilities_;
- delete preset_bank_capabilities_;
- delete vr_capabilities_;
- delete speech_capabilities_;
- delete audio_pass_thru_capabilities_;
- delete pcm_stream_capabilities_;
- delete prerecorded_speech_;
delete navigation_capability_;
delete phone_capability_;
delete video_streaming_capability_;
@@ -436,13 +474,14 @@ HMICapabilitiesImpl::~HMICapabilitiesImpl() {
}
bool HMICapabilitiesImpl::VerifyImageType(const int32_t image_type) const {
- if (!display_capabilities_) {
+ auto capabilities = display_capabilities();
+ if (!capabilities) {
return false;
}
- if (display_capabilities_->keyExists(hmi_response::image_capabilities)) {
+ if (capabilities->keyExists(hmi_response::image_capabilities)) {
const smart_objects::SmartObject& image_caps =
- display_capabilities_->getElement(hmi_response::image_capabilities);
+ capabilities->getElement(hmi_response::image_capabilities);
for (uint32_t i = 0; i < image_caps.length(); ++i) {
if (image_caps.getElement(i).asInt() == image_type) {
return true;
@@ -556,98 +595,87 @@ void HMICapabilitiesImpl::set_display_capabilities(
if (app_mngr_.IsSOStructValid(
hmi_apis::StructIdentifiers::Common_DisplayCapabilities,
display_capabilities)) {
- if (display_capabilities_) {
- delete display_capabilities_;
- }
- display_capabilities_ =
- new smart_objects::SmartObject(display_capabilities);
+ smart_objects::SmartObjectSPtr new_value =
+ std::make_shared<smart_objects::SmartObject>(display_capabilities);
+ display_capabilities_.swap(new_value);
}
}
+void HMICapabilitiesImpl::set_system_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) {
+ system_display_capabilities_.reset(
+ new smart_objects::SmartObject(display_capabilities));
+}
+
void HMICapabilitiesImpl::set_hmi_zone_capabilities(
const smart_objects::SmartObject& hmi_zone_capabilities) {
- if (hmi_zone_capabilities_) {
- delete hmi_zone_capabilities_;
- }
- hmi_zone_capabilities_ =
- new smart_objects::SmartObject(hmi_zone_capabilities);
+ smart_objects::SmartObjectSPtr new_value =
+ std::make_shared<smart_objects::SmartObject>(hmi_zone_capabilities);
+ hmi_zone_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_soft_button_capabilities(
const smart_objects::SmartObject& soft_button_capabilities) {
- if (soft_buttons_capabilities_) {
- delete soft_buttons_capabilities_;
- }
- soft_buttons_capabilities_ =
- new smart_objects::SmartObject(soft_button_capabilities);
+ smart_objects::SmartObjectSPtr new_value =
+ std::make_shared<smart_objects::SmartObject>(soft_button_capabilities);
+ soft_buttons_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_button_capabilities(
const smart_objects::SmartObject& button_capabilities) {
- if (button_capabilities_) {
- delete button_capabilities_;
- }
- button_capabilities_ = new smart_objects::SmartObject(button_capabilities);
+ smart_objects::SmartObjectSPtr new_value =
+ std::make_shared<smart_objects::SmartObject>(button_capabilities);
+ button_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_vr_capabilities(
const smart_objects::SmartObject& vr_capabilities) {
- if (vr_capabilities_) {
- delete vr_capabilities_;
- }
- vr_capabilities_ = new smart_objects::SmartObject(vr_capabilities);
+ smart_objects::SmartObjectSPtr new_value =
+ std::make_shared<smart_objects::SmartObject>(vr_capabilities);
+ vr_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_speech_capabilities(
const smart_objects::SmartObject& speech_capabilities) {
- if (speech_capabilities_) {
- delete speech_capabilities_;
- }
- speech_capabilities_ = new smart_objects::SmartObject(speech_capabilities);
+ smart_objects::SmartObjectSPtr new_value =
+ std::make_shared<smart_objects::SmartObject>(speech_capabilities);
+ speech_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_audio_pass_thru_capabilities(
const smart_objects::SmartObject& audio_pass_thru_capabilities) {
- if (audio_pass_thru_capabilities_) {
- delete audio_pass_thru_capabilities_;
- }
- audio_pass_thru_capabilities_ =
- new smart_objects::SmartObject(audio_pass_thru_capabilities);
+ smart_objects::SmartObjectSPtr new_value =
+ std::make_shared<smart_objects::SmartObject>(
+ audio_pass_thru_capabilities);
+ audio_pass_thru_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_pcm_stream_capabilities(
const smart_objects::SmartObject& pcm_stream_capabilities) {
- if (pcm_stream_capabilities_) {
- delete pcm_stream_capabilities_;
- }
- pcm_stream_capabilities_ =
- new smart_objects::SmartObject(pcm_stream_capabilities);
+ smart_objects::SmartObjectSPtr new_value =
+ std::make_shared<smart_objects::SmartObject>(pcm_stream_capabilities);
+ pcm_stream_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_preset_bank_capabilities(
const smart_objects::SmartObject& preset_bank_capabilities) {
- if (preset_bank_capabilities_) {
- delete preset_bank_capabilities_;
- }
- preset_bank_capabilities_ =
- new smart_objects::SmartObject(preset_bank_capabilities);
+ smart_objects::SmartObjectSPtr new_value =
+ std::make_shared<smart_objects::SmartObject>(preset_bank_capabilities);
+ preset_bank_capabilities_.swap(new_value);
}
void HMICapabilitiesImpl::set_vehicle_type(
const smart_objects::SmartObject& vehicle_type) {
- if (vehicle_type_) {
- delete vehicle_type_;
- }
- vehicle_type_ = new smart_objects::SmartObject(vehicle_type);
+ smart_objects::SmartObjectSPtr new_value =
+ std::make_shared<smart_objects::SmartObject>(vehicle_type);
+ vehicle_type_.swap(new_value);
}
void HMICapabilitiesImpl::set_prerecorded_speech(
const smart_objects::SmartObject& prerecorded_speech) {
- if (prerecorded_speech_) {
- delete prerecorded_speech_;
- prerecorded_speech_ = NULL;
- }
- prerecorded_speech_ = new smart_objects::SmartObject(prerecorded_speech);
+ smart_objects::SmartObjectSPtr new_value =
+ std::make_shared<smart_objects::SmartObject>(prerecorded_speech);
+ prerecorded_speech_.swap(new_value);
}
void HMICapabilitiesImpl::set_navigation_supported(const bool supported) {
@@ -699,8 +727,18 @@ void HMICapabilitiesImpl::set_rc_capability(
rc_capability_ = new smart_objects::SmartObject(rc_capability);
}
-void HMICapabilitiesImpl::Init(resumption::LastState* last_state) {
- hmi_language_handler_.Init(last_state);
+void HMICapabilitiesImpl::set_seat_location_capability(
+ const smart_objects::SmartObject& seat_location_capability) {
+ if (seat_location_capability_) {
+ delete seat_location_capability_;
+ }
+ seat_location_capability_ =
+ new smart_objects::SmartObject(seat_location_capability);
+}
+
+void HMICapabilitiesImpl::Init(
+ resumption::LastStateWrapperPtr last_state_wrapper) {
+ hmi_language_handler_.Init(last_state_wrapper);
if (false == load_capabilities_from_file()) {
LOG4CXX_ERROR(logger_, "file hmi_capabilities.json was not loaded");
} else {
@@ -710,6 +748,8 @@ void HMICapabilitiesImpl::Init(resumption::LastState* last_state) {
ui_language_, vr_language_, tts_language_);
}
+void HMICapabilitiesImpl::Init(resumption::LastState*) {}
+
bool HMICapabilitiesImpl::is_ui_cooperating() const {
return is_ui_cooperating_;
}
@@ -749,46 +789,52 @@ const smart_objects::SmartObject* HMICapabilitiesImpl::tts_supported_languages()
return tts_supported_languages_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::display_capabilities()
+const smart_objects::SmartObjectSPtr HMICapabilitiesImpl::display_capabilities()
const {
return display_capabilities_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::hmi_zone_capabilities()
- const {
+const smart_objects::SmartObjectSPtr
+HMICapabilitiesImpl::system_display_capabilities() const {
+ return system_display_capabilities_;
+}
+
+const smart_objects::SmartObjectSPtr
+HMICapabilitiesImpl::hmi_zone_capabilities() const {
return hmi_zone_capabilities_;
}
-const smart_objects::SmartObject*
+const smart_objects::SmartObjectSPtr
HMICapabilitiesImpl::soft_button_capabilities() const {
return soft_buttons_capabilities_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::button_capabilities()
+const smart_objects::SmartObjectSPtr HMICapabilitiesImpl::button_capabilities()
const {
return button_capabilities_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::speech_capabilities()
+const smart_objects::SmartObjectSPtr HMICapabilitiesImpl::speech_capabilities()
const {
return speech_capabilities_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::vr_capabilities() const {
+const smart_objects::SmartObjectSPtr HMICapabilitiesImpl::vr_capabilities()
+ const {
return vr_capabilities_;
}
-const smart_objects::SmartObject*
+const smart_objects::SmartObjectSPtr
HMICapabilitiesImpl::audio_pass_thru_capabilities() const {
return audio_pass_thru_capabilities_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::pcm_stream_capabilities()
- const {
+const smart_objects::SmartObjectSPtr
+HMICapabilitiesImpl::pcm_stream_capabilities() const {
return pcm_stream_capabilities_;
}
-const smart_objects::SmartObject*
+const smart_objects::SmartObjectSPtr
HMICapabilitiesImpl::preset_bank_capabilities() const {
return preset_bank_capabilities_;
}
@@ -797,11 +843,11 @@ bool HMICapabilitiesImpl::attenuated_supported() const {
return attenuated_supported_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::vehicle_type() const {
+const smart_objects::SmartObjectSPtr HMICapabilitiesImpl::vehicle_type() const {
return vehicle_type_;
}
-const smart_objects::SmartObject* HMICapabilitiesImpl::prerecorded_speech()
+const smart_objects::SmartObjectSPtr HMICapabilitiesImpl::prerecorded_speech()
const {
return prerecorded_speech_;
}
@@ -841,6 +887,11 @@ const smart_objects::SmartObject* HMICapabilitiesImpl::rc_capability() const {
return rc_capability_;
}
+const smart_objects::SmartObject*
+HMICapabilitiesImpl::seat_location_capability() const {
+ return seat_location_capability_;
+}
+
bool HMICapabilitiesImpl::load_capabilities_from_file() {
std::string json_string;
std::string file_name = app_mngr_.get_settings().hmi_capabilities_file_name();
@@ -854,11 +905,17 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
}
try {
- Json::Reader reader_;
+ Json::CharReaderBuilder reader_builder;
+ const std::unique_ptr<Json::CharReader> reader_(
+ reader_builder.newCharReader());
+ JSONCPP_STRING err;
Json::Value root_json;
+ const size_t json_len = json_string.length();
- bool result = reader_.parse(json_string, root_json, false);
+ const bool result = reader_->parse(
+ json_string.c_str(), json_string.c_str() + json_len, &root_json, &err);
if (!result) {
+ LOG4CXX_DEBUG(logger_, "Json parsing fails: " << err);
return false;
}
// UI
@@ -884,7 +941,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
if (check_existing_json_member(ui, "displayCapabilities")) {
smart_objects::SmartObject display_capabilities_so;
Json::Value display_capabilities = ui.get("displayCapabilities", "");
- Formatters::CFormatterJsonBase::jsonValueToObj(display_capabilities,
+ formatters::CFormatterJsonBase::jsonValueToObj(display_capabilities,
display_capabilities_so);
if (display_capabilities_so.keyExists(hmi_response::display_type)) {
@@ -910,7 +967,8 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
hmi_apis::Common_TextFieldName::eType>::const_iterator
it_text_field_name = text_fields_enum_name.find(
display_capabilities_so[hmi_response::text_fields][i]
- [strings::name].asString());
+ [strings::name]
+ .asString());
display_capabilities_so[hmi_response::text_fields][i].erase(
strings::name);
if (text_fields_enum_name.end() != it_text_field_name) {
@@ -1021,25 +1079,16 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
if (check_existing_json_member(ui, "audioPassThruCapabilities")) {
Json::Value audio_capabilities =
ui.get("audioPassThruCapabilities", "");
- smart_objects::SmartObject audio_capabilities_so =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
- audio_capabilities_so =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- if (check_existing_json_member(audio_capabilities, "samplingRate")) {
- audio_capabilities_so["samplingRate"] =
- sampling_rate_enum.find(audio_capabilities.get("samplingRate", "")
- .asString())->second;
- }
- if (check_existing_json_member(audio_capabilities, "bitsPerSample")) {
- audio_capabilities_so["bitsPerSample"] =
- bit_per_sample_enum.find(audio_capabilities.get("bitsPerSample",
- "").asString())
- ->second;
- }
- if (check_existing_json_member(audio_capabilities, "audioType")) {
- audio_capabilities_so["audioType"] =
- audio_type_enum.find(audio_capabilities.get("audioType", "")
- .asString())->second;
+ smart_objects::SmartObject audio_capabilities_so(
+ smart_objects::SmartType_Array);
+ if (audio_capabilities.type() == Json::arrayValue) {
+ for (uint32_t i = 0; i < audio_capabilities.size(); i++) {
+ convert_audio_capability_to_obj(audio_capabilities[i],
+ audio_capabilities_so[i]);
+ }
+ } else if (audio_capabilities.type() == Json::objectValue) {
+ convert_audio_capability_to_obj(audio_capabilities,
+ audio_capabilities_so[0]);
}
set_audio_pass_thru_capabilities(audio_capabilities_so);
}
@@ -1048,23 +1097,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
Json::Value pcm_capabilities = ui.get("pcmStreamCapabilities", "");
smart_objects::SmartObject pcm_capabilities_so =
smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- if (check_existing_json_member(pcm_capabilities, "samplingRate")) {
- pcm_capabilities_so["samplingRate"] =
- sampling_rate_enum.find(pcm_capabilities.get("samplingRate", "")
- .asString())->second;
- }
- if (check_existing_json_member(pcm_capabilities, "bitsPerSample")) {
- pcm_capabilities_so["bitsPerSample"] =
- bit_per_sample_enum.find(pcm_capabilities.get("bitsPerSample", "")
- .asString())->second;
- }
- if (check_existing_json_member(pcm_capabilities, "audioType")) {
- pcm_capabilities_so["audioType"] =
- audio_type_enum.find(pcm_capabilities.get("audioType", "")
- .asString())->second;
- }
-
+ convert_audio_capability_to_obj(pcm_capabilities, pcm_capabilities_so);
set_pcm_stream_capabilities(pcm_capabilities_so);
}
@@ -1081,10 +1114,11 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
Json::Value soft_button_capabilities =
ui.get("softButtonCapabilities", "");
smart_objects::SmartObject soft_button_capabilities_so;
- Formatters::CFormatterJsonBase::jsonValueToObj(
+ formatters::CFormatterJsonBase::jsonValueToObj(
soft_button_capabilities, soft_button_capabilities_so);
set_soft_button_capabilities(soft_button_capabilities_so);
}
+
if (check_existing_json_member(ui, "systemCapabilities")) {
Json::Value system_capabilities = ui.get("systemCapabilities", "");
if (check_existing_json_member(system_capabilities,
@@ -1092,7 +1126,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
Json::Value navigation_capability =
system_capabilities.get("navigationCapability", "");
smart_objects::SmartObject navigation_capability_so;
- Formatters::CFormatterJsonBase::jsonValueToObj(
+ formatters::CFormatterJsonBase::jsonValueToObj(
navigation_capability, navigation_capability_so);
set_navigation_capability(navigation_capability_so);
if (!navigation_capability_so.empty()) {
@@ -1104,7 +1138,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
Json::Value phone_capability =
system_capabilities.get("phoneCapability", "");
smart_objects::SmartObject phone_capability_so;
- Formatters::CFormatterJsonBase::jsonValueToObj(phone_capability,
+ formatters::CFormatterJsonBase::jsonValueToObj(phone_capability,
phone_capability_so);
set_phone_capability(phone_capability_so);
if (!phone_capability_so.empty()) {
@@ -1116,7 +1150,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
Json::Value vs_capability =
system_capabilities.get("videoStreamingCapability", "");
smart_objects::SmartObject vs_capability_so;
- Formatters::CFormatterJsonBase::jsonValueToObj(vs_capability,
+ formatters::CFormatterJsonBase::jsonValueToObj(vs_capability,
vs_capability_so);
if (vs_capability_so.keyExists("supportedFormats")) {
@@ -1166,13 +1200,36 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
Json::Value rc_capability =
system_capabilities.get("remoteControlCapability", "");
smart_objects::SmartObject rc_capability_so;
- Formatters::CFormatterJsonBase::jsonValueToObj(rc_capability,
+ formatters::CFormatterJsonBase::jsonValueToObj(rc_capability,
rc_capability_so);
+ if (rc_capability_so.keyExists("lightControlCapabilities")) {
+ if (rc_capability_so["lightControlCapabilities"].keyExists(
+ "supportedLights")) {
+ auto& lights = rc_capability_so["lightControlCapabilities"]
+ ["supportedLights"];
+ auto it = lights.asArray()->begin();
+ for (; it != lights.asArray()->end(); ++it) {
+ smart_objects::SmartObject& light_name_so = (*it)["name"];
+ auto light_name = MessageHelper::CommonLightNameFromString(
+ light_name_so.asString());
+ light_name_so = light_name;
+ }
+ }
+ }
set_rc_capability(rc_capability_so);
if (!rc_capability_so.empty()) {
set_rc_supported(true);
}
}
+ if (check_existing_json_member(system_capabilities,
+ "seatLocationCapability")) {
+ Json::Value seat_location_capability =
+ system_capabilities.get("seatLocationCapability", "");
+ smart_objects::SmartObject seat_location_capability_so;
+ formatters::CFormatterJsonBase::jsonValueToObj(
+ seat_location_capability, seat_location_capability_so);
+ set_seat_location_capability(seat_location_capability_so);
+ }
}
} // UI end
@@ -1245,7 +1302,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
if (check_existing_json_member(buttons, "capabilities")) {
Json::Value bt_capabilities = buttons.get("capabilities", "");
smart_objects::SmartObject buttons_capabilities_so;
- Formatters::CFormatterJsonBase::jsonValueToObj(bt_capabilities,
+ formatters::CFormatterJsonBase::jsonValueToObj(bt_capabilities,
buttons_capabilities_so);
for (uint32_t i = 0; i < buttons_capabilities_so.length(); ++i) {
@@ -1265,7 +1322,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
if (check_existing_json_member(buttons, "presetBankCapabilities")) {
Json::Value presetBank = buttons.get("presetBankCapabilities", "");
smart_objects::SmartObject preset_bank_so;
- Formatters::CFormatterJsonBase::jsonValueToObj(presetBank,
+ formatters::CFormatterJsonBase::jsonValueToObj(presetBank,
preset_bank_so);
set_preset_bank_capabilities(preset_bank_so);
}
@@ -1275,7 +1332,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
if (check_existing_json_member(root_json, "VehicleInfo")) {
Json::Value vehicle_info = root_json.get("VehicleInfo", "");
smart_objects::SmartObject vehicle_type_so;
- Formatters::CFormatterJsonBase::jsonValueToObj(vehicle_info,
+ formatters::CFormatterJsonBase::jsonValueToObj(vehicle_info,
vehicle_type_so);
set_vehicle_type(vehicle_type_so);
} // VehicleType end
@@ -1307,6 +1364,27 @@ void HMICapabilitiesImpl::convert_json_languages_to_obj(
}
}
+void HMICapabilitiesImpl::convert_audio_capability_to_obj(
+ const Json::Value& capability,
+ smart_objects::SmartObject& output_so) const {
+ if (check_existing_json_member(capability, "samplingRate")) {
+ output_so[strings::sampling_rate] =
+ sampling_rate_enum.find(capability.get("samplingRate", "").asString())
+ ->second;
+ }
+ if (check_existing_json_member(capability, "bitsPerSample")) {
+ output_so[strings::bits_per_sample] =
+ bit_per_sample_enum
+ .find(capability.get("bitsPerSample", "").asString())
+ ->second;
+ }
+ if (check_existing_json_member(capability, "audioType")) {
+ output_so[strings::audio_type] =
+ audio_type_enum.find(capability.get("audioType", "").asString())
+ ->second;
+ }
+}
+
HMILanguageHandler& HMICapabilitiesImpl::get_hmi_language_handler() {
return hmi_language_handler_;
}
diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc
index e6636ed38f..0c33ea4b11 100644
--- a/src/components/application_manager/src/hmi_interfaces_impl.cc
+++ b/src/components/application_manager/src/hmi_interfaces_impl.cc
@@ -61,8 +61,6 @@ generate_function_to_interface_convert_map() {
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[BasicCommunication_OnFileRemoved] =
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
- convert_map[BasicCommunication_AllowDeviceToConnect] =
- HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[BasicCommunication_OnDeviceChosen] =
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[BasicCommunication_OnFindApplications] =
@@ -105,6 +103,12 @@ generate_function_to_interface_convert_map() {
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[BasicCommunication_OnEventChanged] =
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_OnServiceUpdate] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_GetFilePath] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_CloseApplication] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[VR_IsReady] = HmiInterfaces::HMI_INTERFACE_VR;
convert_map[VR_Started] = HmiInterfaces::HMI_INTERFACE_VR;
convert_map[VR_Stopped] = HmiInterfaces::HMI_INTERFACE_VR;
@@ -135,12 +139,16 @@ generate_function_to_interface_convert_map() {
convert_map[UI_DeleteCommand] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_AddSubMenu] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_DeleteSubMenu] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_ShowAppMenu] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_CreateWindow] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_DeleteWindow] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_PerformInteraction] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_SetMediaClockTimer] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_SetGlobalProperties] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_OnCommand] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_OnSystemContext] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_CancelInteraction] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_ChangeRegistration] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_OnLanguageChange] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_GetSupportedLanguages] = HmiInterfaces::HMI_INTERFACE_UI;
@@ -148,7 +156,6 @@ generate_function_to_interface_convert_map() {
convert_map[UI_OnDriverDistraction] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_SetAppIcon] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_SetDisplayLayout] = HmiInterfaces::HMI_INTERFACE_UI;
- convert_map[UI_ShowCustomForm] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_OnKeyboardInput] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_OnTouchEvent] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_Slider] = HmiInterfaces::HMI_INTERFACE_UI;
@@ -219,7 +226,6 @@ generate_function_to_interface_convert_map() {
convert_map[SDL_OnStatusUpdate] = HmiInterfaces::HMI_INTERFACE_SDL;
convert_map[SDL_OnSystemError] = HmiInterfaces::HMI_INTERFACE_SDL;
convert_map[SDL_AddStatisticsInfo] = HmiInterfaces::HMI_INTERFACE_SDL;
- convert_map[SDL_GetURLS] = HmiInterfaces::HMI_INTERFACE_SDL;
convert_map[RC_IsReady] = HmiInterfaces::HMI_INTERFACE_RC;
convert_map[RC_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_RC;
convert_map[Buttons_ButtonPress] = HmiInterfaces::HMI_INTERFACE_RC;
@@ -229,6 +235,17 @@ generate_function_to_interface_convert_map() {
HmiInterfaces::HMI_INTERFACE_RC;
convert_map[RC_OnInteriorVehicleData] = HmiInterfaces::HMI_INTERFACE_RC;
convert_map[RC_OnRemoteControlSettings] = HmiInterfaces::HMI_INTERFACE_RC;
+ convert_map[RC_SetGlobalProperties] = HmiInterfaces::HMI_INTERFACE_RC;
+ convert_map[AppService_PublishAppService] =
+ HmiInterfaces::HMI_INTERFACE_AppService;
+ convert_map[AppService_UnpublishAppService] =
+ HmiInterfaces::HMI_INTERFACE_AppService;
+ convert_map[AppService_GetAppServiceData] =
+ HmiInterfaces::HMI_INTERFACE_AppService;
+ convert_map[AppService_PerformAppServiceInteraction] =
+ HmiInterfaces::HMI_INTERFACE_AppService;
+ convert_map[AppService_GetActiveServiceConsent] =
+ HmiInterfaces::HMI_INTERFACE_AppService;
return convert_map;
}
@@ -252,6 +269,8 @@ HmiInterfacesImpl::HmiInterfacesImpl() {
HmiInterfaces::STATE_NOT_RESPONSE;
interfaces_states_[HmiInterfaces::HMI_INTERFACE_RC] =
HmiInterfaces::STATE_NOT_RESPONSE;
+ interfaces_states_[HmiInterfaces::HMI_INTERFACE_AppService] =
+ HmiInterfaces::STATE_NOT_RESPONSE;
}
HmiInterfaces::InterfaceState HmiInterfacesImpl::GetInterfaceState(
diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc
index ce8514010f..46231c4596 100644
--- a/src/components/application_manager/src/hmi_language_handler.cc
+++ b/src/components/application_manager/src/hmi_language_handler.cc
@@ -28,16 +28,16 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
-*/
+ */
#include "application_manager/hmi_language_handler.h"
#include "application_manager/application_manager.h"
+#include "application_manager/hmi_capabilities.h"
#include "application_manager/message_helper.h"
#include "application_manager/rpc_service.h"
-#include "application_manager/hmi_capabilities.h"
-#include "utils/helpers.h"
-#include "resumption/last_state.h"
+#include "resumption/last_state_wrapper.h"
#include "smart_objects/smart_object.h"
+#include "utils/helpers.h"
static const std::string LanguagesKey = "Languages";
static const std::string UIKey = "UI";
@@ -78,12 +78,13 @@ void HMILanguageHandler::set_language_for(
LOG4CXX_WARN(logger_, "Unknown interface has been passed " << interface);
return;
}
- LOG4CXX_DEBUG(logger_,
- "Setting language " << language << " for interface "
- << interface);
- Json::Value& dictionary = last_state_->get_dictionary();
- dictionary[LanguagesKey][key] = language;
- return;
+ LOG4CXX_DEBUG(
+ logger_,
+ "Setting language " << language << " for interface " << interface);
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ dictionary[LanguagesKey][key] = static_cast<int32_t>(language);
+ accessor.GetMutableData().set_dictionary(dictionary);
}
hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for(
@@ -107,7 +108,8 @@ hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for(
return Common_Language::INVALID_ENUM;
}
- const Json::Value& dictionary = last_state_->get_dictionary();
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
if (dictionary.isMember(LanguagesKey)) {
if (dictionary[LanguagesKey].isMember(key)) {
Common_Language::eType language = static_cast<Common_Language::eType>(
@@ -223,7 +225,8 @@ void HMILanguageHandler::SendOnLanguageChangeToMobile(
const uint32_t connection_key) {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject;
+ smart_objects::SmartObjectSPtr notification =
+ std::make_shared<smart_objects::SmartObject>();
DCHECK_OR_RETURN_VOID(notification);
smart_objects::SmartObject& message = *notification;
message[strings::params][strings::function_id] =
@@ -272,8 +275,9 @@ void HMILanguageHandler::VerifyWithPersistedLanguages() {
LOG4CXX_INFO(logger_,
"Application with app_id "
- << app->app_id() << " will be unregistered because of "
- "HMI language(s) mismatch.");
+ << app->app_id()
+ << " will be unregistered because of "
+ "HMI language(s) mismatch.");
CheckApplication(std::make_pair(app->app_id(), false));
}
@@ -283,7 +287,7 @@ void HMILanguageHandler::VerifyWithPersistedLanguages() {
LOG4CXX_DEBUG(logger_,
"No registered apps found. HMILanguageHandler unsubscribed "
"from all events.");
- unsubscribe_from_all_events();
+ unsubscribe_from_all_hmi_events();
}
}
@@ -303,7 +307,7 @@ void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) {
if (0 == apps_.size()) {
LOG4CXX_DEBUG(logger_,
"HMILanguageHandler unsubscribed from all events.");
- unsubscribe_from_all_events();
+ unsubscribe_from_all_hmi_events();
}
}
SendOnLanguageChangeToMobile(app.first);
@@ -340,8 +344,8 @@ void HMILanguageHandler::CheckApplication(const Apps::value_type app) {
}
}
-void HMILanguageHandler::Init(resumption::LastState* value) {
- last_state_ = value;
+void HMILanguageHandler::Init(resumption::LastStateWrapperPtr value) {
+ last_state_wrapper_ = value;
persisted_ui_language_ = get_language_for(INTERFACE_UI);
persisted_vr_language_ = get_language_for(INTERFACE_VR);
persisted_tts_language_ = get_language_for(INTERFACE_TTS);
diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc
index e1bc2b5125..844d0254cf 100644
--- a/src/components/application_manager/src/hmi_state.cc
+++ b/src/components/application_manager/src/hmi_state.cc
@@ -32,9 +32,9 @@
*/
#include "application_manager/hmi_state.h"
-#include <ostream>
#include <boost/assign.hpp>
#include <boost/bimap.hpp>
+#include <ostream>
#include "application_manager/application_manager.h"
#include "utils/helpers.h"
@@ -42,12 +42,13 @@ namespace application_manager {
CREATE_LOGGERPTR_GLOBAL(logger_, "HmiState")
-HmiState::HmiState(utils::SharedPtr<Application> app,
+HmiState::HmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr,
StateID state_id)
- : app_(app)
+ : hmi_app_id_(app->hmi_app_id())
, state_id_(state_id)
, app_mngr_(app_mngr)
+ , window_type_(mobile_apis::WindowType::INVALID_ENUM)
, hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
, audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
, video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM)
@@ -55,11 +56,12 @@ HmiState::HmiState(utils::SharedPtr<Application> app,
LOG4CXX_DEBUG(logger_, *this);
}
-HmiState::HmiState(utils::SharedPtr<Application> app,
+HmiState::HmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
- : app_(app)
+ : hmi_app_id_(app->hmi_app_id())
, state_id_(STATE_ID_REGULAR)
, app_mngr_(app_mngr)
+ , window_type_(mobile_apis::WindowType::INVALID_ENUM)
, hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
, audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
, video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM)
@@ -67,46 +69,42 @@ HmiState::HmiState(utils::SharedPtr<Application> app,
LOG4CXX_DEBUG(logger_, *this);
}
-DEPRECATED HmiState::HmiState(uint32_t app_id,
- const ApplicationManager& app_mngr,
- StateID state_id)
- : state_id_(state_id)
- , app_mngr_(app_mngr)
- , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
- , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
- , system_context_(mobile_apis::SystemContext::INVALID_ENUM) {
- app_ = app_mngr_.application(app_id);
-}
-
-DEPRECATED HmiState::HmiState(uint32_t app_id,
- const ApplicationManager& app_mngr)
- : state_id_(STATE_ID_REGULAR)
- , app_mngr_(app_mngr)
- , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
- , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
- , system_context_(mobile_apis::SystemContext::INVALID_ENUM) {
- app_ = app_mngr_.application(app_id);
-}
-
void HmiState::set_parent(HmiStatePtr parent) {
DCHECK_OR_RETURN_VOID(parent);
parent_ = parent;
}
bool HmiState::is_navi_app() const {
- return app_->is_navi();
+ const ApplicationSharedPtr app =
+ app_mngr_.application_by_hmi_app(hmi_app_id_);
+ return app ? app->is_navi() : false;
}
bool HmiState::is_media_app() const {
- return app_->is_media_application();
+ const ApplicationSharedPtr app =
+ app_mngr_.application_by_hmi_app(hmi_app_id_);
+ return app ? app->is_media_application() : false;
}
bool HmiState::is_voice_communication_app() const {
- return app_->is_voice_communication_supported();
+ const ApplicationSharedPtr app =
+ app_mngr_.application_by_hmi_app(hmi_app_id_);
+ return app ? app->is_voice_communication_supported() : false;
}
bool HmiState::is_mobile_projection_app() const {
- return app_->mobile_projection_enabled();
+ const ApplicationSharedPtr app =
+ app_mngr_.application_by_hmi_app(hmi_app_id_);
+ return app ? app->mobile_projection_enabled() : false;
+}
+
+mobile_apis::WindowType::eType HmiState::window_type() const {
+ return window_type_;
+}
+
+void HmiState::set_window_type(
+ const mobile_apis::WindowType::eType window_type) {
+ window_type_ = window_type;
}
mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state()
@@ -115,22 +113,14 @@ mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state()
return AudioStreamingState::NOT_AUDIBLE;
}
-VRHmiState::VRHmiState(utils::SharedPtr<Application> app,
+VRHmiState::VRHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_VR_SESSION) {}
-DEPRECATED VRHmiState::VRHmiState(uint32_t app_id,
- const ApplicationManager& app_mngr)
- : HmiState(app_id, app_mngr, STATE_ID_VR_SESSION) {}
-
-TTSHmiState::TTSHmiState(utils::SharedPtr<Application> app,
+TTSHmiState::TTSHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_TTS_SESSION) {}
-DEPRECATED TTSHmiState::TTSHmiState(uint32_t app_id,
- const ApplicationManager& app_mngr)
- : HmiState(app_id, app_mngr, STATE_ID_TTS_SESSION) {}
-
mobile_apis::AudioStreamingState::eType TTSHmiState::audio_streaming_state()
const {
using namespace helpers;
@@ -147,19 +137,21 @@ mobile_apis::AudioStreamingState::eType TTSHmiState::audio_streaming_state()
}
VideoStreamingHmiState::VideoStreamingHmiState(
- utils::SharedPtr<Application> app, const ApplicationManager& app_mngr)
+ std::shared_ptr<Application> app, const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_VIDEO_STREAMING) {}
mobile_apis::VideoStreamingState::eType
VideoStreamingHmiState::video_streaming_state() const {
- if (app_->IsVideoApplication()) {
+ const ApplicationSharedPtr app =
+ app_mngr_.application_by_hmi_app(hmi_app_id_);
+ if (app && app->IsVideoApplication()) {
return parent()->video_streaming_state();
}
return mobile_apis::VideoStreamingState::NOT_STREAMABLE;
}
-NaviStreamingHmiState::NaviStreamingHmiState(utils::SharedPtr<Application> app,
+NaviStreamingHmiState::NaviStreamingHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: VideoStreamingHmiState(app, app_mngr) {
set_state_id(STATE_ID_NAVI_STREAMING);
@@ -185,50 +177,51 @@ NaviStreamingHmiState::audio_streaming_state() const {
return expected_state;
}
-PhoneCallHmiState::PhoneCallHmiState(utils::SharedPtr<Application> app,
+PhoneCallHmiState::PhoneCallHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_PHONE_CALL) {}
-DEPRECATED PhoneCallHmiState::PhoneCallHmiState(
- uint32_t app_id, const ApplicationManager& app_mngr)
- : HmiState(app_id, app_mngr, STATE_ID_PHONE_CALL) {}
-
mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const {
using namespace helpers;
using namespace mobile_apis;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
HMILevel::HMI_BACKGROUND,
HMILevel::HMI_NONE)) {
return parent()->hmi_level();
}
+
if (is_navi_app() || is_mobile_projection_app()) {
return HMILevel::HMI_LIMITED;
}
+
if (!is_media_app()) {
return parent()->hmi_level();
}
+
return HMILevel::HMI_BACKGROUND;
}
-SafetyModeHmiState::SafetyModeHmiState(utils::SharedPtr<Application> app,
+SafetyModeHmiState::SafetyModeHmiState(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_SAFETY_MODE) {}
-DEPRECATED SafetyModeHmiState::SafetyModeHmiState(
- uint32_t app_id, const ApplicationManager& app_mngr)
- : HmiState(app_id, app_mngr, STATE_ID_SAFETY_MODE) {}
-
-DeactivateHMI::DeactivateHMI(utils::SharedPtr<Application> app,
+DeactivateHMI::DeactivateHMI(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_DEACTIVATE_HMI) {}
-DEPRECATED DeactivateHMI::DeactivateHMI(uint32_t app_id,
- const ApplicationManager& app_mngr)
- : HmiState(app_id, app_mngr, STATE_ID_DEACTIVATE_HMI) {}
-
mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const {
using namespace helpers;
using namespace mobile_apis;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
HMILevel::HMI_BACKGROUND,
HMILevel::HMI_NONE)) {
@@ -238,40 +231,47 @@ mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const {
return HMILevel::HMI_BACKGROUND;
}
-AudioSource::AudioSource(utils::SharedPtr<Application> app,
+AudioSource::AudioSource(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
- : HmiState(app, app_mngr, STATE_ID_AUDIO_SOURCE) {}
-
-DEPRECATED AudioSource::AudioSource(uint32_t app_id,
- const ApplicationManager& app_mngr)
- : HmiState(app_id, app_mngr, STATE_ID_AUDIO_SOURCE) {}
+ : HmiState(app, app_mngr, STATE_ID_AUDIO_SOURCE)
+ , keep_context_(app->keep_context()) {
+ app->set_keep_context(false);
+}
mobile_apis::HMILevel::eType AudioSource::hmi_level() const {
+ using namespace mobile_apis;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
// Checking for NONE is necessary to avoid issue during
// calculation of HMI level during setting default HMI level
- if (mobile_apis::HMILevel::HMI_NONE == parent()->hmi_level()) {
- return mobile_apis::HMILevel::HMI_NONE;
+ if (keep_context_ || HMILevel::HMI_NONE == parent()->hmi_level()) {
+ return parent()->hmi_level();
}
- return mobile_apis::HMILevel::HMI_BACKGROUND;
+ return HMILevel::HMI_BACKGROUND;
}
-EmbeddedNavi::EmbeddedNavi(utils::SharedPtr<Application> app,
+EmbeddedNavi::EmbeddedNavi(std::shared_ptr<Application> app,
const ApplicationManager& app_mngr)
: HmiState(app, app_mngr, STATE_ID_EMBEDDED_NAVI) {}
-DEPRECATED EmbeddedNavi::EmbeddedNavi(uint32_t app_id,
- const ApplicationManager& app_mngr)
- : HmiState(app_id, app_mngr, STATE_ID_EMBEDDED_NAVI) {}
-
mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const {
using namespace mobile_apis;
using namespace helpers;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
HMILevel::HMI_BACKGROUND,
HMILevel::HMI_NONE)) {
return parent()->hmi_level();
}
+
return HMILevel::HMI_BACKGROUND;
}
@@ -305,7 +305,16 @@ std::ostream& operator<<(std::ostream& os, const HmiState::StateID src) {
}
std::ostream& operator<<(std::ostream& os, const HmiState& src) {
- os << "HMIState(app id:" << src.app_->app_id() << ", state:" << src.state_id()
+ const ApplicationSharedPtr app =
+ src.app_mngr_.application_by_hmi_app(src.hmi_app_id_);
+ os << "HMIState(app id:";
+ if (app) {
+ os << app->app_id();
+ } else {
+ os << "(none)";
+ }
+ os << ", hmi app id:" << src.hmi_app_id_
+ << ", window_type:" << src.window_type_ << ", state:" << src.state_id()
<< ", hmi_level:" << src.hmi_level()
<< ", audio:" << src.audio_streaming_state()
<< ", video:" << src.video_streaming_state()
diff --git a/src/components/application_manager/src/message.cc b/src/components/application_manager/src/message.cc
index b005af0fb5..b75428780d 100644
--- a/src/components/application_manager/src/message.cc
+++ b/src/components/application_manager/src/message.cc
@@ -36,7 +36,7 @@ namespace {
bool BinaryDataPredicate(uint8_t i, uint8_t j) {
return (i == j);
}
-}
+} // namespace
namespace application_manager {
@@ -64,8 +64,8 @@ Message::Message(protocol_handler::MessagePriority priority)
, binary_data_(NULL)
, data_size_(0)
, payload_size_(0)
- , version_(
- protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN) {}
+ , version_(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN)
+ , is_message_encrypted_(false) {}
Message::Message(const Message& message)
: function_id_(0)
@@ -76,8 +76,8 @@ Message::Message(const Message& message)
, binary_data_(NULL)
, data_size_(0)
, payload_size_(0)
- , version_(
- protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN) {
+ , version_(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_UNKNOWN)
+ , is_message_encrypted_(false) {
*this = message;
}
@@ -142,6 +142,10 @@ int32_t Message::connection_key() const {
return connection_key_;
}
+bool Message::is_message_encrypted() const {
+ return is_message_encrypted_;
+}
+
MessageType Message::type() const {
return type_;
}
@@ -190,19 +194,6 @@ void Message::set_message_type(MessageType type) {
type_ = type;
}
-void Message::set_binary_data(BinaryData* data) {
- if (NULL == data) {
- NOTREACHED();
- return;
- }
-
- if (binary_data_) {
- delete binary_data_;
- }
-
- binary_data_ = new BinaryData(*data);
-}
-
void Message::set_binary_data(const BinaryData* data) {
if (NULL == data) {
NOTREACHED();
@@ -241,6 +232,10 @@ void Message::set_payload_size(size_t payload_size) {
payload_size_ = payload_size;
}
+void Message::set_message_encryption(const bool protection) {
+ is_message_encrypted_ = protection;
+}
+
bool Message::is_sufficient_version(
protocol_handler::MajorProtocolVersion minVersion,
protocol_handler::MajorProtocolVersion version) {
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 1f1ff4ddf0..9b12eb2889 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -39,13 +39,13 @@
#include <inttypes.h>
#undef __STDC_FORMAT_MACROS
-#include <set>
-#include <string>
#include <strings.h>
#include <algorithm>
-#include <utility>
-#include <map>
#include <functional>
+#include <map>
+#include <set>
+#include <string>
+#include <utility>
#include "application_manager/application.h"
#include "application_manager/application_manager.h"
@@ -55,17 +55,18 @@
#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/rpc_service.h"
#include "connection_handler/connection_handler_impl.h"
-#include "transport_manager/common.h"
#include "interfaces/MOBILE_API.h"
#include "smart_objects/enum_schema_item.h"
+#include "transport_manager/common.h"
#include "utils/file_system.h"
-#include "utils/macro.h"
#include "utils/logger.h"
-#include "utils/make_shared.h"
+#include "utils/macro.h"
-#include "formatters/formatter_json_rpc.h"
-#include "formatters/CFormatterJsonSDLRPCv2.h"
+#include "formatters/CFormatterJsonBase.h"
#include "formatters/CFormatterJsonSDLRPCv1.h"
+#include "formatters/CFormatterJsonSDLRPCv2.h"
+#include "formatters/formatter_json_rpc.h"
+#include "json/json.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
@@ -95,11 +96,8 @@ bool ValidateSoftButtons(smart_objects::SmartObject& soft_buttons) {
// Check if image parameter is valid
if (button.keyExists(strings::image)) {
SmartObject& buttonImage = button[strings::image];
-
- // Image name must not be empty and must not contain incorrect
- // character
- if (false == MessageHelper::VerifySoftButtonString(
- buttonImage[strings::value].asString())) {
+ if (false ==
+ MessageHelper::VerifyString(buttonImage[strings::value].asString())) {
return false;
}
}
@@ -164,123 +162,127 @@ struct ExternalConsentStatusAppender
} // namespace
-std::pair<std::string,
- mobile_apis::VehicleDataType::eType> kVehicleDataInitializer[] = {
- std::make_pair(strings::gps, mobile_apis::VehicleDataType::VEHICLEDATA_GPS),
- std::make_pair(strings::speed,
- mobile_apis::VehicleDataType::VEHICLEDATA_SPEED),
- std::make_pair(strings::rpm, mobile_apis::VehicleDataType::VEHICLEDATA_RPM),
- std::make_pair(strings::fuel_level,
- mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL),
- std::make_pair(strings::fuel_level_state,
- mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL_STATE),
- std::make_pair(strings::instant_fuel_consumption,
- mobile_apis::VehicleDataType::VEHICLEDATA_FUELCONSUMPTION),
- std::make_pair(strings::fuel_range,
- mobile_apis::VehicleDataType::VEHICLEDATA_FUELRANGE),
- std::make_pair(strings::external_temp,
- mobile_apis::VehicleDataType::VEHICLEDATA_EXTERNTEMP),
- std::make_pair(strings::turn_signal,
- mobile_apis::VehicleDataType::VEHICLEDATA_TURNSIGNAL),
- std::make_pair(strings::vin, mobile_apis::VehicleDataType::VEHICLEDATA_VIN),
- std::make_pair(strings::prndl,
- mobile_apis::VehicleDataType::VEHICLEDATA_PRNDL),
- std::make_pair(strings::tire_pressure,
- mobile_apis::VehicleDataType::VEHICLEDATA_TIREPRESSURE),
- std::make_pair(strings::odometer,
- mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER),
- std::make_pair(strings::belt_status,
- mobile_apis::VehicleDataType::VEHICLEDATA_BELTSTATUS),
- std::make_pair(strings::body_information,
- mobile_apis::VehicleDataType::VEHICLEDATA_BODYINFO),
- std::make_pair(strings::device_status,
- mobile_apis::VehicleDataType::VEHICLEDATA_DEVICESTATUS),
- std::make_pair(strings::driver_braking,
- mobile_apis::VehicleDataType::VEHICLEDATA_BRAKING),
- std::make_pair(strings::wiper_status,
- mobile_apis::VehicleDataType::VEHICLEDATA_WIPERSTATUS),
- std::make_pair(strings::head_lamp_status,
- mobile_apis::VehicleDataType::VEHICLEDATA_HEADLAMPSTATUS),
- std::make_pair(strings::e_call_info,
- mobile_apis::VehicleDataType::VEHICLEDATA_ECALLINFO),
- std::make_pair(strings::airbag_status,
- mobile_apis::VehicleDataType::VEHICLEDATA_AIRBAGSTATUS),
- std::make_pair(strings::emergency_event,
- mobile_apis::VehicleDataType::VEHICLEDATA_EMERGENCYEVENT),
- std::make_pair(strings::cluster_mode_status,
- mobile_apis::VehicleDataType::VEHICLEDATA_CLUSTERMODESTATUS),
- std::make_pair(strings::my_key,
- mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY),
- /*
- NOT DEFINED in mobile API
- std::make_pair(strings::gps,
- BATTVOLTAGE),
- */
- std::make_pair(strings::engine_torque,
- mobile_apis::VehicleDataType::VEHICLEDATA_ENGINETORQUE),
- std::make_pair(strings::acc_pedal_pos,
- mobile_apis::VehicleDataType::VEHICLEDATA_ACCPEDAL),
- std::make_pair(strings::steering_wheel_angle,
- mobile_apis::VehicleDataType::VEHICLEDATA_STEERINGWHEEL),
- std::make_pair(strings::engine_oil_life,
- mobile_apis::VehicleDataType::VEHICLEDATA_ENGINEOILLIFE)};
+std::pair<std::string, mobile_apis::VehicleDataType::eType>
+ kVehicleDataInitializer[] = {
+ std::make_pair(strings::gps,
+ mobile_apis::VehicleDataType::VEHICLEDATA_GPS),
+ std::make_pair(strings::speed,
+ mobile_apis::VehicleDataType::VEHICLEDATA_SPEED),
+ std::make_pair(strings::rpm,
+ mobile_apis::VehicleDataType::VEHICLEDATA_RPM),
+ std::make_pair(strings::fuel_level,
+ mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL),
+ std::make_pair(
+ strings::fuel_level_state,
+ mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL_STATE),
+ std::make_pair(
+ strings::instant_fuel_consumption,
+ mobile_apis::VehicleDataType::VEHICLEDATA_FUELCONSUMPTION),
+ std::make_pair(strings::fuel_range,
+ mobile_apis::VehicleDataType::VEHICLEDATA_FUELRANGE),
+ std::make_pair(
+ strings::cloud_app_vehicle_id,
+ mobile_apis::VehicleDataType::VEHICLEDATA_CLOUDAPPVEHICLEID),
+ std::make_pair(strings::external_temp,
+ mobile_apis::VehicleDataType::VEHICLEDATA_EXTERNTEMP),
+ std::make_pair(strings::turn_signal,
+ mobile_apis::VehicleDataType::VEHICLEDATA_TURNSIGNAL),
+ std::make_pair(strings::vin,
+ mobile_apis::VehicleDataType::VEHICLEDATA_VIN),
+ std::make_pair(strings::prndl,
+ mobile_apis::VehicleDataType::VEHICLEDATA_PRNDL),
+ std::make_pair(strings::tire_pressure,
+ mobile_apis::VehicleDataType::VEHICLEDATA_TIREPRESSURE),
+ std::make_pair(strings::odometer,
+ mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER),
+ std::make_pair(strings::belt_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_BELTSTATUS),
+ std::make_pair(strings::electronic_park_brake_status,
+ mobile_apis::VehicleDataType::
+ VEHICLEDATA_ELECTRONICPARKBRAKESTATUS),
+ std::make_pair(strings::body_information,
+ mobile_apis::VehicleDataType::VEHICLEDATA_BODYINFO),
+ std::make_pair(strings::device_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_DEVICESTATUS),
+ std::make_pair(strings::driver_braking,
+ mobile_apis::VehicleDataType::VEHICLEDATA_BRAKING),
+ std::make_pair(strings::wiper_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_WIPERSTATUS),
+ std::make_pair(
+ strings::head_lamp_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_HEADLAMPSTATUS),
+ std::make_pair(strings::e_call_info,
+ mobile_apis::VehicleDataType::VEHICLEDATA_ECALLINFO),
+ std::make_pair(strings::airbag_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_AIRBAGSTATUS),
+ std::make_pair(
+ strings::emergency_event,
+ mobile_apis::VehicleDataType::VEHICLEDATA_EMERGENCYEVENT),
+ std::make_pair(
+ strings::cluster_mode_status,
+ mobile_apis::VehicleDataType::VEHICLEDATA_CLUSTERMODESTATUS),
+ std::make_pair(
+ strings::cluster_modes,
+ mobile_apis::VehicleDataType::VEHICLEDATA_CLUSTERMODESTATUS),
+ std::make_pair(strings::my_key,
+ mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY),
+ /*
+ NOT DEFINED in mobile API
+ std::make_pair(strings::gps,
+ BATTVOLTAGE),
+ */
+ std::make_pair(strings::engine_torque,
+ mobile_apis::VehicleDataType::VEHICLEDATA_ENGINETORQUE),
+ std::make_pair(strings::acc_pedal_pos,
+ mobile_apis::VehicleDataType::VEHICLEDATA_ACCPEDAL),
+ std::make_pair(strings::steering_wheel_angle,
+ mobile_apis::VehicleDataType::VEHICLEDATA_STEERINGWHEEL),
+ std::make_pair(
+ strings::engine_oil_life,
+ mobile_apis::VehicleDataType::VEHICLEDATA_ENGINEOILLIFE)};
const VehicleData MessageHelper::vehicle_data_(
kVehicleDataInitializer,
kVehicleDataInitializer + ARRAYSIZE(kVehicleDataInitializer));
-#ifdef HMI_DBUS_API
-namespace {
-struct VehicleInfo_Requests {
- hmi_apis::FunctionID::eType func_id;
- const char* str;
-};
-static VehicleInfo_Requests ivi_subrequests[] = {
- {hmi_apis::FunctionID::VehicleInfo_SubscribeGps, strings::gps},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed, strings::speed},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeRpm, strings::rpm},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel, strings::fuel_level},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State,
- strings::fuel_level_state},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption,
- strings::instant_fuel_consumption},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature,
- strings::external_temp},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeVin, strings::vin},
- {hmi_apis::FunctionID::VehicleInfo_SubscribePrndl, strings::prndl},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure,
- strings::tire_pressure},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer, strings::odometer},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus,
- strings::belt_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation,
- strings::body_information},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus,
- strings::device_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking,
- strings::driver_braking},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus,
- strings::wiper_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus,
- strings::head_lamp_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque,
- strings::engine_torque},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition,
- strings::acc_pedal_pos},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle,
- strings::steering_wheel_angle},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo,
- strings::e_call_info},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus,
- strings::airbag_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent,
- strings::emergency_event},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus,
- strings::cluster_mode_status},
- {hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey, strings::my_key},
-};
+smart_objects::SmartObjectSPtr MessageHelper::CreateNotification(
+ mobile_apis::FunctionID::eType function_id, uint32_t app_id) {
+ using smart_objects::SmartObject;
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr object(
+ new SmartObject(smart_objects::SmartType_Map));
+ (*object)[strings::params][strings::message_type] =
+ static_cast<int>(kNotification);
+ (*object)[strings::params][strings::function_id] = function_id;
+ (*object)[strings::params][strings::connection_key] = app_id;
+ (*object)[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ (*object)[strings::params][strings::protocol_type] =
+ commands::CommandImpl::mobile_protocol_type_;
+ (*object)[strings::msg_params] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ return object;
+}
+
+ns_smart_device_link::ns_smart_objects::SmartObjectSPtr
+MessageHelper::CreateHMINotification(hmi_apis::FunctionID::eType function_id) {
+ using smart_objects::SmartObject;
+ using smart_objects::SmartObjectSPtr;
+ using smart_objects::SmartType_Map;
+ LOG4CXX_AUTO_TRACE(logger_);
+ SmartObjectSPtr notification_ptr =
+ std::make_shared<SmartObject>(SmartType_Map);
+ SmartObject& notification = *notification_ptr;
+ notification[strings::params][strings::message_type] =
+ static_cast<int32_t>(kNotification);
+ notification[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ notification[strings::params][strings::protocol_type] =
+ commands::CommandImpl::hmi_protocol_type_;
+ notification[strings::params][strings::function_id] = function_id;
+
+ return notification_ptr;
}
-#endif // #ifdef HMI_DBUS_API
const uint32_t MessageHelper::GetPriorityCode(const std::string& priority) {
CommonAppPriorityMap::const_iterator it = app_priority_values.find(priority);
@@ -292,7 +294,7 @@ const uint32_t MessageHelper::GetPriorityCode(const std::string& priority) {
hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString(
const std::string& language) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
hmi_apis::Common_Language::eType value;
if (EnumConversionHelper<hmi_apis::Common_Language::eType>::StringToEnum(
language, &value)) {
@@ -301,6 +303,17 @@ hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString(
return hmi_apis::Common_Language::INVALID_ENUM;
}
+hmi_apis::Common_LightName::eType MessageHelper::CommonLightNameFromString(
+ const std::string& lightName) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+ hmi_apis::Common_LightName::eType value;
+ if (EnumConversionHelper<hmi_apis::Common_LightName::eType>::StringToEnum(
+ lightName, &value)) {
+ return value;
+ }
+ return hmi_apis::Common_LightName::INVALID_ENUM;
+}
+
std::string MessageHelper::GetDeviceMacAddressForHandle(
const transport_manager::DeviceHandle device_handle,
const ApplicationManager& app_mngr) {
@@ -313,7 +326,7 @@ std::string MessageHelper::GetDeviceMacAddressForHandle(
std::string MessageHelper::CommonLanguageToString(
hmi_apis::Common_Language::eType language) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
const char* str = 0;
if (EnumConversionHelper<hmi_apis::Common_Language::eType>::EnumToCString(
language, &str)) {
@@ -322,11 +335,20 @@ std::string MessageHelper::CommonLanguageToString(
return std::string();
}
+std::string MessageHelper::MobileLanguageToString(
+ mobile_apis::Language::eType language) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+ const char* str = 0;
+ EnumConversionHelper<mobile_apis::Language::eType>::EnumToCString(language,
+ &str);
+ return str ? str : std::string();
+}
+
smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
hmi_apis::messageType::eType message_type, const uint32_t correlation_id) {
using namespace smart_objects;
- SmartObjectSPtr message = utils::MakeShared<SmartObject>(SmartType_Map);
+ SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map);
SmartObject& ref = *message;
ref[strings::params][strings::message_type] = static_cast<int>(message_type);
@@ -338,11 +360,84 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
return message;
}
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateDisplayCapabilityUpdateToMobile(
+ const smart_objects::SmartObject& display_capabilities, Application& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto message = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ (*message)[strings::params][strings::message_type] =
+ MessageType::kNotification;
+ (*message)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnSystemCapabilityUpdatedID;
+ (*message)[strings::params][strings::connection_key] = app.app_id();
+ (*message)[strings::params][strings::protocol_type] =
+ commands::CommandImpl::mobile_protocol_type_;
+ (*message)[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+
+ smart_objects::SmartObject system_capability(smart_objects::SmartType_Map);
+ system_capability[strings::system_capability_type] =
+ static_cast<int32_t>(mobile_apis::SystemCapabilityType::DISPLAYS);
+ system_capability[strings::display_capabilities] = display_capabilities;
+ (*message)[strings::msg_params][strings::system_capability] =
+ system_capability;
+
+ return message;
+}
+
+void MessageHelper::BroadcastCapabilityUpdate(
+ smart_objects::SmartObject& msg_params, ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+
+ message[strings::params][strings::message_type] = MessageType::kNotification;
+ message[strings::msg_params] = msg_params;
+
+ // Construct and send mobile notification
+ message[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnSystemCapabilityUpdatedID;
+ smart_objects::SmartObjectSPtr notification =
+ std::make_shared<smart_objects::SmartObject>(message);
+ app_mngr.GetRPCService().ManageMobileCommand(
+ notification, commands::Command::CommandSource::SOURCE_SDL);
+
+ // Construct and send HMI notification
+ message[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated;
+ smart_objects::SmartObjectSPtr hmi_notification =
+ std::make_shared<smart_objects::SmartObject>(message);
+ app_mngr.GetRPCService().ManageHMICommand(
+ hmi_notification, commands::Command::CommandSource::SOURCE_SDL_TO_HMI);
+}
+
+smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities(
+ std::vector<smart_objects::SmartObject>& all_services) {
+ smart_objects::SmartObject app_service_capabilities(
+ smart_objects::SmartType_Map);
+ smart_objects::SmartObject app_services(smart_objects::SmartType_Array);
+
+ std::vector<smart_objects::SmartObject> service_records = all_services;
+
+ int i = 0;
+ for (auto& record : service_records) {
+ smart_objects::SmartObject app_service_capability(
+ smart_objects::SmartType_Map);
+ app_service_capability[strings::updated_app_service_record] = record;
+ app_services[i] = app_service_capability;
+ i++;
+ }
+
+ app_service_capabilities[strings::app_services] = app_services;
+ return app_service_capabilities;
+}
+
smart_objects::SmartObjectSPtr MessageHelper::CreateHashUpdateNotification(
const uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr message =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
mobile_apis::FunctionID::OnHashChangeID;
@@ -410,7 +505,7 @@ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr notification =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
smart_objects::SmartObject& message = *notification;
message[strings::params][strings::function_id] = static_cast<int32_t>(
@@ -568,15 +663,16 @@ void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application,
msg_params = *MessageHelper::CreateAppVrHelp(application);
msg_params[hmi_request::menu_title] = "";
- smart_objects::SmartObject key_board_properties =
+ smart_objects::SmartObject keyboard_properties =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- key_board_properties[strings::language] =
+ keyboard_properties[strings::language] =
static_cast<int32_t>(hmi_apis::Common_Language::EN_US);
- key_board_properties[hmi_request::keyboard_layout] =
+ keyboard_properties[hmi_request::keyboard_layout] =
static_cast<int32_t>(hmi_apis::Common_KeyboardLayout::QWERTY);
- key_board_properties[hmi_request::auto_complete_text] = "";
- msg_params[hmi_request::keyboard_properties] = key_board_properties;
+ keyboard_properties[hmi_request::auto_complete_list] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ msg_params[hmi_request::keyboard_properties] = keyboard_properties;
msg_params[strings::app_id] = application->app_id();
@@ -645,7 +741,7 @@ const VehicleData& MessageHelper::vehicle_data() {
std::string MessageHelper::HMIResultToString(
hmi_apis::Common_Result::eType hmi_result) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
const char* str = 0;
if (EnumConversionHelper<hmi_apis::Common_Result::eType>::EnumToCString(
hmi_result, &str)) {
@@ -656,7 +752,7 @@ std::string MessageHelper::HMIResultToString(
hmi_apis::Common_Result::eType MessageHelper::HMIResultFromString(
const std::string& hmi_result) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
hmi_apis::Common_Result::eType value;
if (EnumConversionHelper<hmi_apis::Common_Result::eType>::StringToEnum(
hmi_result, &value)) {
@@ -667,7 +763,7 @@ hmi_apis::Common_Result::eType MessageHelper::HMIResultFromString(
std::string MessageHelper::MobileResultToString(
mobile_apis::Result::eType mobile_result) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
const char* str = 0;
if (EnumConversionHelper<mobile_apis::Result::eType>::EnumToCString(
mobile_result, &str)) {
@@ -678,7 +774,7 @@ std::string MessageHelper::MobileResultToString(
mobile_apis::Result::eType MessageHelper::MobileResultFromString(
const std::string& mobile_result) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
mobile_apis::Result::eType value;
if (EnumConversionHelper<mobile_apis::Result::eType>::StringToEnum(
mobile_result, &value)) {
@@ -706,10 +802,12 @@ hmi_apis::Common_Result::eType MessageHelper::MobileToHMIResult(
}
void MessageHelper::SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager) {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject;
+ smart_objects::SmartObjectSPtr notification =
+ std::make_shared<smart_objects::SmartObject>();
if (!notification) {
LOG4CXX_ERROR(logger_, "Failed to create smart object");
return;
@@ -723,16 +821,21 @@ void MessageHelper::SendHMIStatusNotification(
static_cast<int32_t>(application_manager::MessageType::kNotification);
message[strings::params][strings::connection_key] =
- static_cast<int32_t>(application_impl.app_id());
+ static_cast<int32_t>(application->app_id());
+
+ message[strings::msg_params][strings::window_id] = window_id;
message[strings::msg_params][strings::hmi_level] =
- static_cast<int32_t>(application_impl.hmi_level());
+ static_cast<int32_t>(application->hmi_level(window_id));
message[strings::msg_params][strings::audio_streaming_state] =
- static_cast<int32_t>(application_impl.audio_streaming_state());
+ static_cast<int32_t>(application->audio_streaming_state());
+
+ message[strings::msg_params][strings::video_streaming_state] =
+ static_cast<int32_t>(application->video_streaming_state());
message[strings::msg_params][strings::system_context] =
- static_cast<int32_t>(application_impl.system_context());
+ static_cast<int32_t>(application->system_context(window_id));
application_manager.GetRPCService().ManageMobileCommand(
notification, commands::Command::SOURCE_SDL);
@@ -750,8 +853,9 @@ void MessageHelper::SendActivateAppToHMI(
return;
}
- utils::SharedPtr<smart_objects::SmartObject> message =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
+ std::shared_ptr<smart_objects::SmartObject> message =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
hmi_apis::FunctionID::BasicCommunication_ActivateApp;
@@ -794,7 +898,7 @@ void MessageHelper::SendActivateAppToHMI(
mobile_apis::HMILevel::eType MessageHelper::StringToHMILevel(
const std::string& hmi_level) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
mobile_apis::HMILevel::eType value;
if (EnumConversionHelper<mobile_apis::HMILevel::eType>::StringToEnum(
hmi_level, &value)) {
@@ -805,7 +909,7 @@ mobile_apis::HMILevel::eType MessageHelper::StringToHMILevel(
std::string MessageHelper::StringifiedHMILevel(
const mobile_apis::HMILevel::eType hmi_level) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
const char* str = 0;
if (EnumConversionHelper<mobile_apis::HMILevel::eType>::EnumToCString(
hmi_level, &str)) {
@@ -817,7 +921,7 @@ std::string MessageHelper::StringifiedHMILevel(
std::string MessageHelper::StringifiedFunctionID(
mobile_apis::FunctionID::eType function_id) {
LOG4CXX_AUTO_TRACE(logger_);
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
const char* str = 0;
if (EnumConversionHelper<mobile_apis::FunctionID::eType>::EnumToCString(
function_id, &str)) {
@@ -830,103 +934,13 @@ std::string MessageHelper::StringifiedFunctionID(
return std::string();
}
-#ifdef HMI_DBUS_API
-namespace {
-const std::map<std::string, uint16_t> create_get_vehicle_data_args() {
- std::map<std::string, uint16_t> rc;
- rc.insert(std::make_pair(strings::gps,
- hmi_apis::FunctionID::VehicleInfo_GetGpsData));
- rc.insert(std::make_pair(strings::speed,
- hmi_apis::FunctionID::VehicleInfo_GetSpeed));
- rc.insert(
- std::make_pair(strings::rpm, hmi_apis::FunctionID::VehicleInfo_GetRpm));
- rc.insert(std::make_pair(strings::fuel_level,
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevel));
- rc.insert(
- std::make_pair(strings::fuel_level_state,
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState));
- rc.insert(std::make_pair(
- strings::instant_fuel_consumption,
- hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption));
- rc.insert(
- std::make_pair(strings::external_temp,
- hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature));
- rc.insert(
- std::make_pair(strings::vin, hmi_apis::FunctionID::VehicleInfo_GetVin));
- rc.insert(std::make_pair(strings::prndl,
- hmi_apis::FunctionID::VehicleInfo_GetPrndl));
- rc.insert(std::make_pair(strings::tire_pressure,
- hmi_apis::FunctionID::VehicleInfo_GetTirePressure));
- rc.insert(std::make_pair(strings::odometer,
- hmi_apis::FunctionID::VehicleInfo_GetOdometer));
- rc.insert(std::make_pair(strings::belt_status,
- hmi_apis::FunctionID::VehicleInfo_GetBeltStatus));
- rc.insert(
- std::make_pair(strings::body_information,
- hmi_apis::FunctionID::VehicleInfo_GetBodyInformation));
- rc.insert(std::make_pair(strings::device_status,
- hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus));
- rc.insert(std::make_pair(strings::driver_braking,
- hmi_apis::FunctionID::VehicleInfo_GetDriverBraking));
- rc.insert(std::make_pair(strings::wiper_status,
- hmi_apis::FunctionID::VehicleInfo_GetWiperStatus));
- rc.insert(
- std::make_pair(strings::head_lamp_status,
- hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus));
- rc.insert(std::make_pair(strings::engine_torque,
- hmi_apis::FunctionID::VehicleInfo_GetEngineTorque));
- rc.insert(
- std::make_pair(strings::acc_pedal_pos,
- hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition));
- rc.insert(
- std::make_pair(strings::steering_wheel_angle,
- hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle));
- rc.insert(std::make_pair(strings::e_call_info,
- hmi_apis::FunctionID::VehicleInfo_GetECallInfo));
- rc.insert(std::make_pair(strings::airbag_status,
- hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus));
- rc.insert(
- std::make_pair(strings::emergency_event,
- hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent));
- rc.insert(
- std::make_pair(strings::cluster_mode_status,
- hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus));
- rc.insert(std::make_pair(strings::my_key,
- hmi_apis::FunctionID::VehicleInfo_GetMyKey));
- return rc;
-}
-static std::map<std::string, uint16_t> vehicle_data_args =
- create_get_vehicle_data_args();
-}
-#endif
-
void MessageHelper::CreateGetVehicleDataRequest(
const uint32_t correlation_id,
const std::vector<std::string>& params,
ApplicationManager& app_mngr) {
LOG4CXX_AUTO_TRACE(logger_);
-#ifdef HMI_DBUS_API
- for (std::vector<std::string>::const_iterator it = params.begin();
- it != params.end();
- it++) {
- smart_objects::SmartObjectSPtr request =
- utils::MakeShared<smart_objects::SmartObject>();
-
- (*request)[strings::params][strings::message_type] =
- static_cast<int>(kRequest);
- (*request)[strings::params][strings::correlation_id] = correlation_id;
- (*request)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*request)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*request)[strings::params][strings::function_id] =
- static_cast<int>(vehicle_data_args[*it]);
- app_mngr.GetRPCService().ManageHMICommand(request);
- }
-#else
-
smart_objects::SmartObjectSPtr request =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*request)[strings::params][strings::message_type] =
static_cast<int>(kRequest);
@@ -945,7 +959,6 @@ void MessageHelper::CreateGetVehicleDataRequest(
(*request)[strings::msg_params][*it] = true;
}
app_mngr.GetRPCService().ManageHMICommand(request);
-#endif
}
smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse(
@@ -955,7 +968,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse(
uint32_t connection_key) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr response =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*response)[strings::params][strings::function_id] =
static_cast<int>(function_id);
@@ -979,7 +992,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO(
ApplicationManager& app_mngr) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr device_list_so =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
(*device_list_so)[strings::device_list] =
@@ -1013,7 +1026,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO(
uint32_t function_id, ApplicationManager& app_mngr) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr module_info =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
smart_objects::SmartObject& object = *module_info;
object[strings::params][strings::message_type] = static_cast<int>(kRequest);
@@ -1029,7 +1042,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon(
const std::string& path_to_icon, uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr set_icon =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
if (!set_icon) {
@@ -1056,7 +1069,7 @@ void MessageHelper::SendOnButtonSubscriptionNotification(
LOG4CXX_AUTO_TRACE(logger_);
SmartObjectSPtr notification_ptr =
- utils::MakeShared<SmartObject>(SmartType_Map);
+ std::make_shared<SmartObject>(SmartType_Map);
if (!notification_ptr) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
return;
@@ -1090,7 +1103,7 @@ void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_ERROR(logger_, "Invalid application pointer ");
return;
}
@@ -1146,7 +1159,7 @@ void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app,
void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app,
ApplicationManager& app_mngr) {
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_ERROR(logger_, "Invalid application");
return;
}
@@ -1166,14 +1179,23 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectList requests;
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_ERROR(logger_, "Invalid application");
return requests;
}
+ auto& help_prompt_manager =
+ const_cast<Application*>(app.get())->help_prompt_manager();
+
+ const bool can_send_ui = helpers::
+ Compare<HelpPromptManager::SendingType, helpers::EQ, helpers::ONE>(
+ help_prompt_manager.GetSendingType(),
+ HelpPromptManager::SendingType::kSendVRHelp,
+ HelpPromptManager::SendingType::kSendBoth);
+
// UI global properties
- if (app->vr_help_title() || app->vr_help()) {
+ if (can_send_ui && (app->vr_help_title() || app->vr_help())) {
smart_objects::SmartObjectSPtr ui_global_properties =
CreateMessageForHMI(hmi_apis::messageType::request, correlation_id);
if (!ui_global_properties) {
@@ -1207,8 +1229,14 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI(
requests.push_back(ui_global_properties);
}
+ const bool can_send_vr = helpers::
+ Compare<HelpPromptManager::SendingType, helpers::EQ, helpers::ONE>(
+ help_prompt_manager.GetSendingType(),
+ HelpPromptManager::SendingType::kSendHelpPrompt,
+ HelpPromptManager::SendingType::kSendBoth);
+
// TTS global properties
- if (app->help_prompt() || app->timeout_prompt()) {
+ if (can_send_vr && (app->help_prompt() || app->timeout_prompt())) {
smart_objects::SmartObjectSPtr tts_global_properties =
CreateMessageForHMI(hmi_apis::messageType::request, correlation_id);
if (!tts_global_properties) {
@@ -1282,15 +1310,24 @@ void MessageHelper::SendTTSGlobalProperties(ApplicationSharedPtr app,
smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp(
ApplicationConstSharedPtr app) {
smart_objects::SmartObjectSPtr result =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
if (!result) {
return NULL;
}
smart_objects::SmartObject& vr_help = *result;
- vr_help[strings::vr_help_title] = app->name();
+ const smart_objects::SmartObject* vr_help_title = app->vr_help_title();
+ if (vr_help_title) {
+ vr_help[strings::vr_help_title] = vr_help_title->asString();
+ }
int32_t index = 0;
+
+ smart_objects::SmartObject so_vr_help(smart_objects::SmartType_Map);
+ so_vr_help[strings::position] = index + 1;
+ so_vr_help[strings::text] = app->name();
+ vr_help[strings::vr_help][index++] = so_vr_help;
+
if (app->vr_synonyms()) {
smart_objects::SmartObject item(smart_objects::SmartType_Map);
item[strings::text] = (*(app->vr_synonyms())).getElement(0);
@@ -1406,7 +1443,13 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- msg_params[strings::cmd_id] = i->first;
+
+ if ((*i->second).keyExists(strings::cmd_id)) {
+ msg_params[strings::cmd_id] = (*i->second)[strings::cmd_id].asUInt();
+ } else {
+ LOG4CXX_ERROR(logger_, "Command ID is missing.");
+ continue;
+ }
msg_params[strings::menu_params] = (*i->second)[strings::menu_params];
msg_params[strings::app_id] = app->app_id();
@@ -1421,8 +1464,9 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
}
// VR Interface
- if ((*i->second).keyExists(strings::vr_commands)) {
- SendAddVRCommandToHMI(i->first,
+ if ((*i->second).keyExists(strings::vr_commands) &&
+ (*i->second).keyExists(strings::cmd_id)) {
+ SendAddVRCommandToHMI((*i->second)[strings::cmd_id].asUInt(),
(*i->second)[strings::vr_commands],
app->app_id(),
app_mngr);
@@ -1505,7 +1549,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateChangeRegistration(
void MessageHelper::SendUIChangeRegistrationRequestToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_ERROR(logger_, "Application is not valid");
return;
}
@@ -1566,13 +1610,108 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateAddVRCommandToHMI(
return vr_command;
}
+smart_objects::SmartObjectSPtr MessageHelper::CreateUICreateWindowRequestToHMI(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& window_info) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto ui_request = CreateMessageForHMI(hmi_apis::messageType::request,
+ app_mngr.GetNextHMICorrelationID());
+
+ (*ui_request)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::UI_CreateWindow);
+
+ (*ui_request)[strings::correlation_id] =
+ (*ui_request)[strings::params][strings::correlation_id];
+ (*ui_request)[strings::function_id] =
+ (*ui_request)[strings::params][strings::function_id];
+
+ smart_objects::SmartObject msg_params(
+ smart_objects::SmartObject(smart_objects::SmartType_Map));
+
+ msg_params[strings::window_id] = window_info[strings::window_id].asInt();
+ msg_params[strings::window_type] = window_info[strings::window_type].asInt();
+ msg_params[strings::window_name] =
+ window_info[strings::window_name].asString();
+
+ if (window_info.keyExists(strings::associated_service_type)) {
+ msg_params[strings::associated_service_type] =
+ window_info[strings::associated_service_type].asString();
+ }
+ if (window_info.keyExists(strings::duplicate_updates_from_window_id)) {
+ msg_params[strings::duplicate_updates_from_window_id] =
+ window_info[strings::duplicate_updates_from_window_id].asInt();
+ }
+
+ msg_params[strings::app_id] = application->hmi_app_id();
+
+ (*ui_request)[strings::msg_params] = msg_params;
+
+ return ui_request;
+}
+
+smart_objects::SmartObjectList MessageHelper::CreateUICreateWindowRequestsToHMI(
+ application_manager::ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& windows_info) {
+ smart_objects::SmartObjectList requests;
+ DCHECK_OR_RETURN(application, requests);
+
+ for (size_t i = 0; i < windows_info.length(); ++i) {
+ const auto& info = windows_info[i];
+
+ const auto ui_request =
+ CreateUICreateWindowRequestToHMI(application, app_mngr, info);
+
+ DCHECK_OR_RETURN(ui_request, requests);
+
+ requests.push_back(ui_request);
+ }
+
+ return requests;
+}
+
+bool MessageHelper::CreateDeviceInfo(
+ connection_handler::DeviceHandle device_handle,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ ApplicationManager& app_mngr,
+ smart_objects::SmartObject* output) {
+ DCHECK_OR_RETURN(output, false);
+
+ std::string device_name;
+ std::string mac_address;
+ std::string transport_type;
+ if (-1 ==
+ session_observer.GetDataOnDeviceID(
+ device_handle, &device_name, NULL, &mac_address, &transport_type)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to extract information for device " << device_handle);
+ }
+
+ smart_objects::SmartObject& device_info_map = *output;
+ device_info_map = smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ device_info_map[strings::name] = device_name;
+ device_info_map[strings::id] = mac_address;
+ device_info_map[strings::transport_type] =
+ app_mngr.GetDeviceTransportType(transport_type);
+
+ const policy::DeviceConsent device_consent =
+ policy_handler.GetUserConsentForDevice(mac_address);
+ device_info_map[strings::isSDLAllowed] =
+ policy::DeviceConsent::kDeviceAllowed == device_consent;
+
+ return true;
+}
+
bool MessageHelper::CreateHMIApplicationStruct(
ApplicationConstSharedPtr app,
const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
- NsSmartDeviceLink::NsSmartObjects::SmartObject* output,
+ ns_smart_device_link::ns_smart_objects::SmartObject* output,
ApplicationManager& app_mngr) {
- using NsSmartDeviceLink::NsSmartObjects::SmartObject;
+ using ns_smart_device_link::ns_smart_objects::SmartObject;
DCHECK_OR_RETURN(output, false);
SmartObject& message = *output;
@@ -1584,31 +1723,27 @@ bool MessageHelper::CreateHMIApplicationStruct(
const smart_objects::SmartObject* app_types = app->app_types();
const smart_objects::SmartObject* ngn_media_screen_name =
app->ngn_media_screen_name();
- const smart_objects::SmartObject* day_color_scheme = app->day_color_scheme();
- const smart_objects::SmartObject* night_color_scheme =
+ const smart_objects::SmartObject day_color_scheme = app->day_color_scheme();
+ const smart_objects::SmartObject night_color_scheme =
app->night_color_scheme();
- std::string device_name;
- std::string mac_address;
- std::string transport_type;
- if (-1 ==
- session_observer.GetDataOnDeviceID(
- app->device(), &device_name, NULL, &mac_address, &transport_type)) {
- LOG4CXX_ERROR(logger_,
- "Failed to extract information for device " << app->device());
- }
message = smart_objects::SmartObject(smart_objects::SmartType_Map);
message[strings::app_name] = app->name();
message[strings::app_id] = app->hmi_app_id();
+
+ const std::string policy_app_id = app->policy_app_id();
+ message[hmi_response::policy_app_id] = policy_app_id;
+
const std::string icon_path = app->app_icon_path();
- if (!icon_path.empty()) {
+
+ if (file_system::FileExists(app->app_icon_path())) {
message[strings::icon] = icon_path;
}
if (app->IsRegistered()) {
message[strings::hmi_display_language_desired] = app->ui_language();
message[strings::is_media_application] = app->is_media_application();
} else {
- message[strings::greyOut] = app->is_greyed_out();
+ message[strings::grey_out] = app->is_greyed_out();
}
if (app->tts_name() && !app->tts_name()->empty()) {
message[json::ttsName] = *(app->tts_name());
@@ -1624,31 +1759,87 @@ bool MessageHelper::CreateHMIApplicationStruct(
message[strings::app_type] = *app_types;
}
- if (day_color_scheme) {
- message[strings::day_color_scheme] = *day_color_scheme;
+ const policy::RequestType::State app_request_types_state =
+ policy_handler.GetAppRequestTypeState(policy_app_id);
+ if (policy::RequestType::State::AVAILABLE == app_request_types_state) {
+ const auto request_types =
+ policy_handler.GetAppRequestTypes(app->device(), policy_app_id);
+ message[strings::request_type] =
+ SmartObject(smart_objects::SmartType_Array);
+ smart_objects::SmartObject& request_types_array =
+ message[strings::request_type];
+
+ size_t index = 0;
+ for (auto it : request_types) {
+ request_types_array[index] = it;
+ ++index;
+ }
+ } else if (policy::RequestType::State::EMPTY == app_request_types_state) {
+ message[strings::request_type] =
+ SmartObject(smart_objects::SmartType_Array);
+ }
+
+ const policy::RequestSubType::State app_request_subtypes_state =
+ policy_handler.GetAppRequestSubTypeState(policy_app_id);
+ if (policy::RequestSubType::State::AVAILABLE == app_request_subtypes_state) {
+ const auto request_subtypes =
+ policy_handler.GetAppRequestSubTypes(policy_app_id);
+ message[strings::request_subtype] =
+ SmartObject(smart_objects::SmartType_Array);
+ smart_objects::SmartObject& request_subtypes_array =
+ message[strings::request_subtype];
+
+ size_t index = 0;
+ for (auto it : request_subtypes) {
+ request_subtypes_array[index] = it;
+ ++index;
+ }
+ } else if (policy::RequestSubType::State::EMPTY ==
+ app_request_subtypes_state) {
+ message[strings::request_subtype] =
+ SmartObject(smart_objects::SmartType_Array);
+ }
+
+ if (day_color_scheme.getType() == smart_objects::SmartType_Map) {
+ message[strings::day_color_scheme] = day_color_scheme;
}
- if (night_color_scheme) {
- message[strings::night_color_scheme] = *night_color_scheme;
+ if (night_color_scheme.getType() == smart_objects::SmartType_Map) {
+ message[strings::night_color_scheme] = night_color_scheme;
}
message[strings::device_info] =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- message[strings::device_info][strings::name] = device_name;
- message[strings::device_info][strings::id] = mac_address;
- const policy::DeviceConsent device_consent =
- policy_handler.GetUserConsentForDevice(mac_address);
- message[strings::device_info][strings::isSDLAllowed] =
- policy::DeviceConsent::kDeviceAllowed == device_consent;
+ smart_objects::SmartObject& device_info = message[strings::device_info];
+ CreateDeviceInfo(
+ app->device(), session_observer, policy_handler, app_mngr, &device_info);
+
+ if (app->secondary_device() != 0) {
+ message[strings::secondary_device_info] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject& secondary_device_info =
+ message[strings::secondary_device_info];
+ CreateDeviceInfo(app->secondary_device(),
+ session_observer,
+ policy_handler,
+ app_mngr,
+ &secondary_device_info);
+ }
+
+ const bool is_cloud_app = app->is_cloud_app();
+ message[strings::is_cloud_application] = is_cloud_app;
+
+ if (is_cloud_app) {
+ message[strings::cloud_connection_status] =
+ app_mngr.GetCloudAppConnectionStatus(app);
+ }
- message[strings::device_info][strings::transport_type] =
- app_mngr.GetDeviceTransportType(transport_type);
return true;
}
void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app,
ApplicationManager& app_mngr) {
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_ERROR(logger_, "Invalid application");
return;
}
@@ -1704,7 +1895,7 @@ void MessageHelper::SendOnAppUnregNotificationToHMI(
bool is_unexpected_disconnect,
ApplicationManager& app_mngr) {
smart_objects::SmartObjectSPtr notification =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
smart_objects::SmartObject& message = *notification;
@@ -1723,18 +1914,73 @@ void MessageHelper::SendOnAppUnregNotificationToHMI(
app_mngr.GetRPCService().ManageHMICommand(notification);
}
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateOnAppPropertiesChangeNotification(
+ const std::string& policy_app_id, ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr notification =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ smart_objects::SmartObject& message = *notification;
+ message[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::BasicCommunication_OnAppPropertiesChange;
+ message[strings::params][strings::message_type] = MessageType::kNotification;
+
+ policy::AppProperties app_properties;
+ app_mngr.GetPolicyHandler().GetAppProperties(policy_app_id, app_properties);
+
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+
+ app_mngr.GetPolicyHandler().GetInitialAppData(
+ policy_app_id, &nicknames, &app_hmi_types);
+
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ properties[strings::policy_app_id] = policy_app_id;
+ properties[strings::enabled] = app_properties.enabled;
+
+ smart_objects::SmartObject nicknames_array(smart_objects::SmartType_Array);
+ size_t i = 0;
+ for (const auto& nickname : nicknames) {
+ nicknames_array[i++] = nickname;
+ }
+ properties[strings::nicknames] = nicknames_array;
+
+ if (!app_properties.auth_token.empty()) {
+ properties[strings::auth_token] = app_properties.auth_token;
+ }
+ if (!app_properties.transport_type.empty()) {
+ properties[strings::transport_type] = app_properties.transport_type;
+ }
+ if (!app_properties.hybrid_app_preference.empty()) {
+ properties[strings::hybrid_app_preference] =
+ app_properties.hybrid_app_preference;
+ }
+ if (!app_properties.endpoint.empty()) {
+ properties[strings::endpoint] = app_properties.endpoint;
+ }
+
+ message[strings::msg_params][strings::properties] = properties;
+ return notification;
+}
+
smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr) {
DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr());
+ if (hmi_apis::Common_HMILevel::NONE == level) {
+ LOG4CXX_WARN(logger_,
+ "BC.ActivateApp cannot be used to deactivate an application");
+ return NULL;
+ }
const uint32_t correlation_id = app_mngr.GetNextHMICorrelationID();
smart_objects::SmartObjectSPtr message =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
hmi_apis::FunctionID::BasicCommunication_ActivateApp;
@@ -1767,6 +2013,23 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
return message;
}
+smart_objects::SmartObjectSPtr MessageHelper::GetBCCloseApplicationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr());
+
+ const uint32_t correlation_id = app_mngr.GetNextHMICorrelationID();
+ smart_objects::SmartObjectSPtr message =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ (*message)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::BasicCommunication_CloseApplication;
+ (*message)[strings::params][strings::message_type] = MessageType::kRequest;
+ (*message)[strings::params][strings::correlation_id] = correlation_id;
+ (*message)[strings::msg_params][strings::app_id] = app->app_id();
+
+ return message;
+}
+
void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id,
ApplicationManager& app_mngr) {
LOG4CXX_WARN(logger_, "SendOnResumeAudioSourceToHMI app_id: " << app_id);
@@ -1777,8 +2040,8 @@ void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id,
return;
}
- utils::SharedPtr<smart_objects::SmartObject> message =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::shared_ptr<smart_objects::SmartObject> message =
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
@@ -1797,7 +2060,7 @@ void MessageHelper::SendSDLActivateAppResponse(
const uint32_t correlation_id,
ApplicationManager& app_mngr) {
smart_objects::SmartObjectSPtr message =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
@@ -1846,7 +2109,7 @@ void MessageHelper::SendSDLActivateAppResponse(
void MessageHelper::SendOnSDLConsentNeeded(
const policy::DeviceParams& device_info, ApplicationManager& app_man) {
smart_objects::SmartObjectSPtr message =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
@@ -1886,7 +2149,8 @@ void MessageHelper::SendGetUserFriendlyMessageResponse(
ApplicationManager& app_mngr) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr message =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
if (!message) {
return;
}
@@ -1956,7 +2220,7 @@ void MessageHelper::SendGetListOfPermissionsResponse(
using namespace smart_objects;
using namespace hmi_apis;
- SmartObjectSPtr message = utils::MakeShared<SmartObject>(SmartType_Map);
+ SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map);
DCHECK_OR_RETURN_VOID(message);
SmartObject& params = (*message)[strings::params];
@@ -1998,7 +2262,7 @@ void MessageHelper::SendGetListOfPermissionsResponse(
using namespace smart_objects;
using namespace hmi_apis;
- SmartObjectSPtr message = utils::MakeShared<SmartObject>(SmartType_Map);
+ SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map);
DCHECK_OR_RETURN_VOID(message);
SmartObject& params = (*message)[strings::params];
@@ -2039,7 +2303,35 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponse(
response_data[strings::msg_params][strings::success] = false;
response_data[strings::params][strings::connection_key] = connection_key;
- return utils::MakeShared<smart_objects::SmartObject>(response_data);
+ return std::make_shared<smart_objects::SmartObject>(response_data);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateOnServiceUpdateNotification(
+ const hmi_apis::Common_ServiceType::eType service_type,
+ const hmi_apis::Common_ServiceEvent::eType service_event,
+ const hmi_apis::Common_ServiceStatusUpdateReason::eType
+ service_update_reason,
+ const uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto notification = MessageHelper::CreateHMINotification(
+ hmi_apis::FunctionID::BasicCommunication_OnServiceUpdate);
+
+ (*notification)[strings::msg_params][hmi_notification::service_type] =
+ service_type;
+ (*notification)[strings::msg_params][hmi_notification::service_event] =
+ service_event;
+
+ if (0 != app_id) {
+ (*notification)[strings::msg_params][strings::app_id] = app_id;
+ }
+
+ if (hmi_apis::Common_ServiceStatusUpdateReason::INVALID_ENUM !=
+ service_update_reason) {
+ (*notification)[strings::msg_params][hmi_notification::reason] =
+ service_update_reason;
+ }
+
+ return notification;
}
void MessageHelper::SendNaviSetVideoConfig(
@@ -2189,7 +2481,7 @@ void MessageHelper::SendOnDataStreaming(
}
smart_objects::SmartObjectSPtr notification =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
(*notification)[strings::params][strings::function_id] =
@@ -2238,6 +2530,14 @@ void MessageHelper::SendPolicySnapshotNotification(
const std::string& url,
ApplicationManager& app_mngr) {
smart_objects::SmartObject content(smart_objects::SmartType_Map);
+ const auto request_type =
+#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE)
+ mobile_apis::RequestType::PROPRIETARY;
+#else
+ mobile_apis::RequestType::HTTP;
+#endif // PROPRIETARY || EXTERNAL_PROPRIETARY_MODE
+
+ content[strings::msg_params][strings::request_type] = request_type;
if (!url.empty()) {
content[strings::msg_params][strings::url] =
@@ -2248,13 +2548,6 @@ void MessageHelper::SendPolicySnapshotNotification(
content[strings::params][strings::binary_data] =
smart_objects::SmartObject(policy_data);
-#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE)
- content[strings::msg_params][strings::request_type] =
- mobile_apis::RequestType::PROPRIETARY;
-#else
- content[strings::msg_params][strings::request_type] =
- mobile_apis::RequestType::HTTP;
-#endif // PROPRIETARY || EXTERNAL_PROPRIETARY_MODE
SendSystemRequestNotification(connection_key, content, app_mngr);
}
@@ -2273,13 +2566,9 @@ void MessageHelper::SendSystemRequestNotification(
commands::CommandImpl::protocol_version_;
content[strings::params][strings::connection_key] = connection_key;
-
-#ifdef DEBUG
PrintSmartObject(content);
-#endif
-
DCHECK(app_mngr.GetRPCService().ManageMobileCommand(
- utils::MakeShared<smart_objects::SmartObject>(content),
+ std::make_shared<smart_objects::SmartObject>(content),
commands::Command::SOURCE_SDL));
}
@@ -2340,7 +2629,8 @@ void MessageHelper::SendQueryApps(const uint32_t connection_key,
void MessageHelper::SendOnPermissionsChangeNotification(
uint32_t connection_key,
const policy::Permissions& permissions,
- ApplicationManager& app_mngr) {
+ ApplicationManager& app_mngr,
+ const policy::EncryptionRequired encryprion_required) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject content(smart_objects::SmartType_Map);
@@ -2357,8 +2647,10 @@ void MessageHelper::SendOnPermissionsChangeNotification(
content[strings::msg_params] =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- // content[strings::msg_params][strings::app_id] = connection_key;
-
+ if (encryprion_required.is_initialized()) {
+ content[strings::msg_params][strings::require_encryption] =
+ static_cast<bool>(*encryprion_required);
+ }
content[strings::msg_params]["permissionItem"] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
@@ -2368,6 +2660,41 @@ void MessageHelper::SendOnPermissionsChangeNotification(
policy::Permissions::const_iterator it_permissions = permissions.begin();
policy::Permissions::const_iterator it_permissions_end = permissions.end();
+ using policy::EncryptionRequired;
+ auto permission_item_encryption_flag_state =
+ [](const EncryptionRequired& app_flag,
+ const EncryptionRequired& groups_flag) -> EncryptionRequired {
+ enum EncryptionFlagState { TRUE, FALSE, MISSING };
+ auto enum_from_optional_bool = [](const EncryptionRequired& flag) {
+ if (!flag.is_initialized()) {
+ return MISSING;
+ }
+ return *flag ? TRUE : FALSE;
+ };
+
+ typedef std::pair<EncryptionFlagState, EncryptionFlagState>
+ EnctyptionStatePair;
+ typedef std::map<EnctyptionStatePair, EncryptionRequired>
+ PermissionItemEncryptionTable;
+ static PermissionItemEncryptionTable encryption_state_table = {
+ {{TRUE, TRUE}, EncryptionRequired(true)},
+ {{TRUE, FALSE}, EncryptionRequired()},
+ {{TRUE, MISSING}, EncryptionRequired()},
+ {{FALSE, TRUE}, EncryptionRequired()},
+ {{FALSE, FALSE}, EncryptionRequired()},
+ {{FALSE, MISSING}, EncryptionRequired()},
+ {{MISSING, TRUE}, EncryptionRequired(true)},
+ {{MISSING, FALSE}, EncryptionRequired()},
+ {{MISSING, MISSING}, EncryptionRequired()},
+ };
+ const auto app_flag_state = enum_from_optional_bool(app_flag);
+ const auto groups_flag_state = enum_from_optional_bool(groups_flag);
+ auto it = encryption_state_table.find(
+ EnctyptionStatePair(app_flag_state, groups_flag_state));
+ DCHECK_OR_RETURN(it != encryption_state_table.end(), EncryptionRequired());
+ return it->second;
+ };
+
for (size_t index_pi = 0; it_permissions != it_permissions_end;
++it_permissions, ++index_pi) {
permissions_item_array[index_pi] =
@@ -2376,9 +2703,14 @@ void MessageHelper::SendOnPermissionsChangeNotification(
smart_objects::SmartObject& permission_item =
permissions_item_array[index_pi];
- // Filling the rpcName of PermissionItem
permission_item["rpcName"] = (*it_permissions).first;
const policy::RpcPermissions& rpc_permissions = (*it_permissions).second;
+ auto item_require_encryption = permission_item_encryption_flag_state(
+ encryprion_required, rpc_permissions.require_encryption);
+ if (item_require_encryption.is_initialized()) {
+ const bool require_encryption = *item_require_encryption;
+ permission_item[strings::require_encryption] = require_encryption;
+ }
// Creating SO for hmiPermissions
permission_item["hmiPermissions"] =
@@ -2447,7 +2779,7 @@ void MessageHelper::SendOnPermissionsChangeNotification(
}
app_mngr.GetRPCService().ManageMobileCommand(
- utils::MakeShared<smart_objects::SmartObject>(content),
+ std::make_shared<smart_objects::SmartObject>(content),
commands::Command::SOURCE_SDL);
}
@@ -2532,14 +2864,14 @@ void MessageHelper::SendOnAppPermissionsChangedNotification(
}
app_mngr.GetRPCService().ManageHMICommand(
- utils::MakeShared<smart_objects::SmartObject>(message));
+ std::make_shared<smart_objects::SmartObject>(message));
}
void MessageHelper::SendGetStatusUpdateResponse(const std::string& status,
const uint32_t correlation_id,
ApplicationManager& app_mngr) {
smart_objects::SmartObjectSPtr message =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
if (!message) {
return;
@@ -2560,7 +2892,7 @@ void MessageHelper::SendUpdateSDLResponse(const std::string& result,
const uint32_t correlation_id,
ApplicationManager& app_mngr) {
smart_objects::SmartObjectSPtr message =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
DCHECK(message);
@@ -2577,8 +2909,9 @@ void MessageHelper::SendUpdateSDLResponse(const std::string& result,
void MessageHelper::SendOnStatusUpdate(const std::string& status,
ApplicationManager& app_mngr) {
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr message =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
if (!message) {
return;
@@ -2589,6 +2922,7 @@ void MessageHelper::SendOnStatusUpdate(const std::string& status,
(*message)[strings::params][strings::message_type] =
MessageType::kNotification;
+ LOG4CXX_DEBUG(logger_, "Sending new status:" << status);
(*message)[strings::msg_params]["status"] = status;
app_mngr.GetRPCService().ManageHMICommand(message);
@@ -2611,7 +2945,8 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
smart_objects::SmartObject& message,
ApplicationConstSharedPtr app,
ApplicationManager& app_mngr) {
- if (NsSmartDeviceLink::NsSmartObjects::SmartType_Array == message.getType()) {
+ if (ns_smart_device_link::ns_smart_objects::SmartType_Array ==
+ message.getType()) {
for (uint32_t i = 0; i < message.length(); ++i) {
mobile_apis::Result::eType res =
VerifyImageFiles(message[i], app, app_mngr);
@@ -2620,7 +2955,7 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
return res;
}
}
- } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Map ==
+ } else if (ns_smart_device_link::ns_smart_objects::SmartType_Map ==
message.getType()) {
if (message.keyExists(strings::image_type)) {
mobile_apis::Result::eType verification_result =
@@ -2652,27 +2987,15 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
return mobile_apis::Result::SUCCESS;
}
-mobile_apis::Result::eType MessageHelper::VerifyImageApplyPath(
- smart_objects::SmartObject& image,
- ApplicationConstSharedPtr app,
- ApplicationManager& app_mngr) {
- // Checking image type first: if STATIC - skip existence check, since it is
- // HMI related file and it should know it location
- const uint32_t image_type = image[strings::image_type].asUInt();
- mobile_apis::ImageType::eType type =
- static_cast<mobile_apis::ImageType::eType>(image_type);
- if (mobile_apis::ImageType::STATIC == type) {
- return mobile_apis::Result::SUCCESS;
- }
-
+void MessageHelper::ApplyImagePath(smart_objects::SmartObject& image,
+ ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr) {
const std::string& file_name = image[strings::value].asString();
const std::string& full_file_path = GetAppFilePath(file_name, app, app_mngr);
image[strings::value] = full_file_path;
- if (file_system::FileExists(full_file_path)) {
- return mobile_apis::Result::SUCCESS;
- }
- return mobile_apis::Result::INVALID_DATA;
+
+ return;
}
std::string MessageHelper::GetAppFilePath(std::string file_name,
@@ -2733,19 +3056,61 @@ mobile_apis::Result::eType MessageHelper::VerifyImage(
smart_objects::SmartObject& image,
ApplicationConstSharedPtr app,
ApplicationManager& app_mngr) {
- smart_objects::SmartObject temp_image = image;
const uint32_t image_type = image[strings::image_type].asUInt();
- const mobile_apis::ImageType::eType type =
+ mobile_apis::ImageType::eType type =
static_cast<mobile_apis::ImageType::eType>(image_type);
+ const std::string& file_name = image[strings::value].asString();
- const mobile_apis::Result::eType result =
- VerifyImageApplyPath(temp_image, app, app_mngr);
- if ((mobile_apis::Result::SUCCESS == result) &&
- (mobile_apis::ImageType::DYNAMIC == type)) {
- image[strings::value] = temp_image[strings::value];
+ if (!VerifyString(file_name)) {
+ return mobile_apis::Result::INVALID_DATA;
}
- return result;
+ if (mobile_apis::ImageType::STATIC == type) {
+ return mobile_apis::Result::SUCCESS;
+ }
+
+ ApplyImagePath(image, app, app_mngr);
+
+ const std::string& imagePath = image[strings::value].asString();
+
+ if (file_system::FileExists(imagePath)) {
+ return mobile_apis::Result::SUCCESS;
+ }
+ return mobile_apis::Result::WARNINGS;
+}
+
+MessageHelper::ChoiceSetVRCommandsStatus
+MessageHelper::CheckChoiceSetVRCommands(
+ const smart_objects::SmartObject& choice_set) {
+ // if this is false, someone doesn't have vrCommands
+ bool all_have = true;
+ // if this is false, someone has vrCommands
+ bool none_have = true;
+ smart_objects::SmartArray::const_iterator current_choice_set_it =
+ choice_set.asArray()->begin();
+ // Iterate through choices
+ for (; choice_set.asArray()->end() != current_choice_set_it;
+ ++current_choice_set_it) {
+ // if the vrCommands is present
+ if (current_choice_set_it->keyExists(
+ application_manager::strings::vr_commands)) {
+ // this one has the parameter
+ none_have = false;
+ } else {
+ // this one doesn't
+ all_have = false;
+ }
+ }
+ // everyone has it
+ if (all_have) {
+ return MessageHelper::ChoiceSetVRCommandsStatus::ALL;
+ }
+ // No one has it
+ if (none_have) {
+ return MessageHelper::ChoiceSetVRCommandsStatus::NONE;
+ }
+ // mix-and-match
+ return MessageHelper::ChoiceSetVRCommandsStatus::MIXED;
}
mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems(
@@ -2758,21 +3123,21 @@ mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems(
if (message[i].keyExists(strings::image)) {
verification_result_image =
VerifyImage(message[i][strings::image], app, app_mngr);
- if (mobile_apis::Result::SUCCESS != verification_result_image) {
- return verification_result_image;
+ if (mobile_apis::Result::INVALID_DATA == verification_result_image) {
+ break;
}
}
}
- return mobile_apis::Result::SUCCESS;
+ return verification_result_image;
}
-bool MessageHelper::VerifySoftButtonString(const std::string& str) {
+bool MessageHelper::VerifyString(const std::string& str) {
if ((std::string::npos != str.find_first_of("\t\n")) ||
(std::string::npos != str.find("\\n")) ||
(std::string::npos != str.find("\\t")) ||
(std::string::npos == str.find_first_not_of(' '))) {
LOG4CXX_ERROR(logger_,
- "MessageHelper::VerifySoftButtonString"
+ "MessageHelper::VerifyString"
"string contains incorrect character");
return false;
}
@@ -2831,7 +3196,7 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
}
if ((!request_soft_buttons[i].keyExists(strings::image) ||
- (Result::SUCCESS !=
+ (Result::INVALID_DATA ==
VerifyImage(
request_soft_buttons[i][strings::image], app, app_mngr)))) {
return Result::INVALID_DATA;
@@ -2843,8 +3208,8 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
request_soft_buttons[i].erase(strings::image);
}
if ((!request_soft_buttons[i].keyExists(strings::text)) ||
- (!VerifySoftButtonString(
- request_soft_buttons[i][strings::text].asString()))) {
+ (!VerifyString(
+ request_soft_buttons[i][strings::text].asString()))) {
return Result::INVALID_DATA;
}
break;
@@ -2852,13 +3217,13 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
case SoftButtonType::SBT_BOTH: {
if ((!request_soft_buttons[i].keyExists(strings::text)) ||
((request_soft_buttons[i][strings::text].length()) &&
- (!VerifySoftButtonString(
- request_soft_buttons[i][strings::text].asString())))) {
+ (!VerifyString(
+ request_soft_buttons[i][strings::text].asString())))) {
return Result::INVALID_DATA;
}
if ((!request_soft_buttons[i].keyExists(strings::image) ||
- (Result::SUCCESS !=
+ (Result::INVALID_DATA ==
VerifyImage(
request_soft_buttons[i][strings::image], app, app_mngr)))) {
return Result::INVALID_DATA;
@@ -2885,89 +3250,50 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
void MessageHelper::SubscribeApplicationToSoftButton(
smart_objects::SmartObject& message_params,
ApplicationSharedPtr app,
- int32_t function_id) {
+ int32_t function_id,
+ const WindowID window_id) {
SoftButtonID softbuttons_id;
smart_objects::SmartObject& soft_buttons =
message_params[strings::soft_buttons];
unsigned int length = soft_buttons.length();
for (unsigned int i = 0; i < length; ++i) {
- softbuttons_id.insert(soft_buttons[i][strings::soft_button_id].asUInt());
+ const auto button_id = std::make_pair(
+ soft_buttons[i][strings::soft_button_id].asUInt(), window_id);
+ softbuttons_id.insert(button_id);
}
app->SubscribeToSoftButtons(function_id, softbuttons_id);
}
-// TODO(AK): change printf to logger
+void MessageHelper::SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SubscribeApplicationToSoftButton(
+ message_params,
+ app,
+ function_id,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+}
+
bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
+#ifdef DEBUG
+ Json::Value tmp;
+ namespace Formatters = ns_smart_device_link::ns_json_handler::formatters;
+ Formatters::CFormatterJsonBase::objToJsonValue(object, tmp);
+ LOG4CXX_DEBUG(logger_, "SMART OBJECT: " << tmp.toStyledString());
+#endif
return true;
-#ifdef ENABLE_LOG
- static uint32_t tab = 0;
- std::string tab_buffer;
-
- if (tab == 0) {
- printf("\n-------------------------------------------------------------");
- }
-
- for (uint32_t i = 0; i < tab; ++i) {
- tab_buffer += "\t";
- }
-
- switch (object.getType()) {
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Array: {
- for (size_t i = 0; i < object.length(); i++) {
- ++tab;
-
- printf("\n%s%zu: ", tab_buffer.c_str(), i);
- if (!PrintSmartObject(object.getElement(i))) {
- printf("\n");
- return false;
- }
- }
- break;
- }
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Map: {
- std::set<std::string> keys = object.enumerate();
-
- for (std::set<std::string>::const_iterator key = keys.begin();
- key != keys.end();
- key++) {
- ++tab;
+}
- printf("\n%s%s: ", tab_buffer.c_str(), (*key).c_str());
- if (!PrintSmartObject(object[(*key).c_str()])) {
- printf("\n");
- return false;
- }
- }
- break;
+WindowID MessageHelper::ExtractWindowIdFromSmartObject(
+ const smart_objects::SmartObject& s_map) {
+ if (smart_objects::SmartType_Map == s_map.getType()) {
+ if (s_map.keyExists(strings::window_id)) {
+ return s_map[strings::window_id].asInt();
}
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Boolean:
- object.asBool() ? printf("true\n") : printf("false\n");
- break;
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Double: {
- printf("%f", object.asDouble());
- break;
- }
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Integer:
- printf("%lld", static_cast<long long int>(object.asInt()));
- break;
- case NsSmartDeviceLink::NsSmartObjects::SmartType_String:
- printf("%s", object.asString().c_str());
- break;
- case NsSmartDeviceLink::NsSmartObjects::SmartType_Character:
- printf("%c", object.asChar());
- break;
- default:
- printf("PrintSmartObject - default case\n");
- break;
- }
-
- if (0 != tab) {
- --tab;
- } else {
- printf("\n-------------------------------------------------------------\n");
}
-#endif
- return true;
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
}
} // namespace application_manager
diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc
index 8e64bc952b..d3e7c782f7 100644
--- a/src/components/application_manager/src/mobile_message_handler.cc
+++ b/src/components/application_manager/src/mobile_message_handler.cc
@@ -32,12 +32,12 @@
#include <string.h>
-#include "utils/macro.h"
#include "application_manager/mobile_message_handler.h"
-#include "protocol_handler/protocol_payload.h"
#include "protocol_handler/protocol_packet.h"
+#include "protocol_handler/protocol_payload.h"
#include "utils/bitstream.h"
#include "utils/logger.h"
+#include "utils/macro.h"
#include <stdint.h>
#include <memory>
@@ -48,7 +48,7 @@ const uint8_t kRequest = 0x0;
const uint8_t kResponse = 0x1;
const uint8_t kNotification = 0x2;
const uint8_t kUnknown = 0xF;
-}
+} // namespace
namespace application_manager {
using protocol_handler::Extract;
@@ -58,7 +58,7 @@ typedef std::map<MessageType, std::string> MessageTypeMap;
MessageTypeMap message_types = {std::make_pair(kRequest, "Request"),
std::make_pair(kResponse, "Response"),
std::make_pair(kNotification, "Notification")};
-}
+} // namespace
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
application_manager::Message*
@@ -179,7 +179,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2(
return NULL;
}
- std::auto_ptr<application_manager::Message> outgoing_message(
+ std::unique_ptr<application_manager::Message> outgoing_message(
new application_manager::Message(
protocol_handler::MessagePriority::FromServiceType(
message->service_type())));
@@ -195,6 +195,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2(
message->protocol_version()));
outgoing_message->set_data_size(message->data_size());
outgoing_message->set_payload_size(message->payload_size());
+ outgoing_message->set_message_encryption(message->protection_flag());
if (!payload.data.empty()) {
const BinaryData binary_payload_data(payload.data);
@@ -220,7 +221,8 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV1(
new protocol_handler::RawMessage(message->connection_key(),
1,
&raw_message[0],
- message_string.length() + 1);
+ message_string.length() + 1,
+ false);
return result;
}
@@ -298,6 +300,7 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV2(
message->protocol_version(),
&data_for_sending[0],
data_for_sending_size,
+ false,
type);
return msg_to_protocol_handler;
diff --git a/src/components/application_manager/src/plugin_manager/plugin_keys.cc b/src/components/application_manager/src/plugin_manager/plugin_keys.cc
new file mode 100644
index 0000000000..80be2d1389
--- /dev/null
+++ b/src/components/application_manager/src/plugin_manager/plugin_keys.cc
@@ -0,0 +1,14 @@
+#include "application_manager/plugin_manager/plugin_keys.h"
+
+namespace application_manager {
+namespace plugin_manager {
+
+namespace plugin_names {
+const char* vehicle_info_rpc_plugin = "Vehicle Info RPC Plugin";
+const char* app_service_rpc_plugin = "App Service RPC Plugin";
+const char* rc_rpc_plugin = "RC RPC Plugin";
+const char* sdl_rpc_plugin = "SDL RPC Plugin";
+} // namespace plugin_names
+
+} // namespace plugin_manager
+} // namespace application_manager \ No newline at end of file
diff --git a/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc
index bbd0011298..9214a30513 100644
--- a/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc
+++ b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc
@@ -1,6 +1,6 @@
-#include "application_manager/plugin_manager/rpc_plugin_manager_impl.h"
#include <dlfcn.h>
+#include "application_manager/plugin_manager/rpc_plugin_manager_impl.h"
#include "utils/file_system.h"
namespace application_manager {
@@ -12,11 +12,13 @@ RPCPluginManagerImpl::RPCPluginManagerImpl(
ApplicationManager& app_manager,
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state)
: app_manager_(app_manager)
, rpc_service_(rpc_service)
, hmi_capabilities_(hmi_capabilities)
- , policy_handler_(policy_handler) {}
+ , policy_handler_(policy_handler)
+ , last_state_(last_state) {}
bool IsLibraryFile(const std::string& file_path) {
size_t pos = file_path.find_last_of(".");
@@ -29,32 +31,57 @@ bool IsLibraryFile(const std::string& file_path) {
return true;
}
-RPCPluginPtr LoadPlugin(const std::string& full_plugin_path) {
+template <typename T>
+T GetFuncFromLib(void* dl_handle, const std::string& function_name) {
+ T exported_func =
+ reinterpret_cast<T>(dlsym(dl_handle, function_name.c_str()));
+ char* error_string = dlerror();
+ if (nullptr != error_string) {
+ LOG4CXX_ERROR(logger_, "Failed to export symbols : " << error_string);
+ return nullptr;
+ }
+ return exported_func;
+}
+
+RPCPluginManagerImpl::RPCPluginPtr RPCPluginManagerImpl::LoadPlugin(
+ const std::string& full_plugin_path) const {
if (!IsLibraryFile(full_plugin_path)) {
LOG4CXX_DEBUG(logger_, "Skip loading " << full_plugin_path);
- return RPCPluginPtr();
+ return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
}
void* plugin_dll = dlopen(full_plugin_path.c_str(), RTLD_LAZY);
if (nullptr == plugin_dll) {
- LOG4CXX_ERROR(logger_,
- "Failed to open dll " << full_plugin_path << " : "
- << dlerror());
- return RPCPluginPtr();
+ LOG4CXX_ERROR(
+ logger_,
+ "Failed to open dll " << full_plugin_path << " : " << dlerror());
+ return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
}
typedef RPCPlugin* (*Create)();
- Create create_plugin = reinterpret_cast<Create>(dlsym(plugin_dll, "Create"));
- char* error_string = dlerror();
- if (nullptr != error_string) {
- LOG4CXX_ERROR(logger_,
- "Failed to export dll's " << full_plugin_path
- << " symbols : " << error_string);
+ Create create_plugin = GetFuncFromLib<Create>(plugin_dll, "Create");
+ if (!create_plugin) {
+ LOG4CXX_ERROR(logger_, "No Create function in " << full_plugin_path);
+ dlclose(plugin_dll);
+ return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
+ }
+
+ typedef void (*Delete)(RPCPlugin*);
+ Delete delete_plugin = GetFuncFromLib<Delete>(plugin_dll, "Delete");
+ if (!delete_plugin) {
+ LOG4CXX_ERROR(logger_, "No Delete function in " << full_plugin_path);
dlclose(plugin_dll);
- return RPCPluginPtr();
+ return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
}
+
+ auto plugin_destroyer = [delete_plugin, plugin_dll](RPCPlugin* plugin) {
+ LOG4CXX_DEBUG(logger_, "Delete plugin " << plugin->PluginName());
+ delete_plugin(plugin);
+ dlclose(plugin_dll);
+ return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
+ };
RPCPlugin* plugin = create_plugin();
- return RPCPluginPtr(plugin);
+ return RPCPluginPtr(plugin, plugin_destroyer);
}
uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) {
@@ -66,11 +93,14 @@ uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) {
if (!plugin) {
continue;
}
- LOG4CXX_DEBUG(logger_,
- "Loaded " << plugin->PluginName() << " plugin from "
- << full_name);
- if (plugin->Init(
- app_manager_, rpc_service_, hmi_capabilities_, policy_handler_)) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Loaded " << plugin->PluginName() << " plugin from " << full_name);
+ if (plugin->Init(app_manager_,
+ rpc_service_,
+ hmi_capabilities_,
+ policy_handler_,
+ last_state_)) {
loaded_plugins_.push_back(std::move(plugin));
} else {
LOG4CXX_ERROR(logger_,
@@ -82,10 +112,6 @@ uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) {
return loaded_plugins_.size();
}
-std::vector<RPCPluginPtr>& RPCPluginManagerImpl::GetPlugins() {
- return loaded_plugins_;
-}
-
utils::Optional<RPCPlugin> RPCPluginManagerImpl::FindPluginToProcess(
const int32_t function_id,
const commands::Command::CommandSource message_source) {
diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc
index 828f2d923a..7ca4d7b5b8 100644
--- a/src/components/application_manager/src/policies/policy_event_observer.cc
+++ b/src/components/application_manager/src/policies/policy_event_observer.cc
@@ -31,10 +31,10 @@
*/
#include "application_manager/policies/policy_event_observer.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/policies/policy_handler.h"
-#include "utils/date_time.h"
+#include "application_manager/smart_object_keys.h"
#include "smart_objects/smart_object.h"
+#include "utils/date_time.h"
namespace policy {
using namespace application_manager;
@@ -55,6 +55,8 @@ void PolicyEventObserver::set_policy_handler(
policy_handler_ = policy_handler;
}
+void PolicyEventObserver::on_event(const event_engine::MobileEvent& event) {}
+
void PolicyEventObserver::on_event(const event_engine::Event& event) {
sync_primitives::AutoLock auto_lock(policy_handler_lock_);
if (!policy_handler_) {
@@ -63,26 +65,12 @@ void PolicyEventObserver::on_event(const event_engine::Event& event) {
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
-#ifdef HMI_DBUS_API
- case hmi_apis::FunctionID::VehicleInfo_GetOdometer: {
- ProcessOdometerEvent(message);
- break;
- }
- default: { break; }
- unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_GetOdometer);
-#else
case hmi_apis::FunctionID::VehicleInfo_GetVehicleData: {
ProcessOdometerEvent(message);
unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
break;
}
- case hmi_apis::FunctionID::BasicCommunication_OnReady: {
- policy_handler_->OnSystemReady();
- unsubscribe_from_event(hmi_apis::FunctionID::BasicCommunication_OnReady);
- break;
- }
default: { break; }
-#endif
}
}
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 1cff7b7c96..678916f7eb 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -30,33 +30,37 @@
POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/policies/policy_handler.h"
-#include <unistd.h>
#include <dlfcn.h>
+#include <unistd.h>
#include <algorithm>
-#include <vector>
#include <functional>
#include <utility>
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/policies/delegates/app_permission_delegate.h"
-#include "policy/status.h"
+#include <vector>
#include "application_manager/application_manager.h"
-#include "application_manager/state_controller.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/delegates/app_permission_delegate.h"
#include "application_manager/rpc_service.h"
-#include "policy/policy_manager_impl.h"
+#include "application_manager/smart_object_keys.h"
+#include "application_manager/state_controller.h"
+#include "application_manager/usage_statistics.h"
#include "connection_handler/connection_handler.h"
-#include "utils/macro.h"
-#include "utils/date_time.h"
+#include "interfaces/MOBILE_API.h"
#include "json/value.h"
#include "json/writer.h"
-#include "application_manager/usage_statistics.h"
+#include "policy/policy_manager_impl.h"
#include "policy/policy_types.h"
-#include "interfaces/MOBILE_API.h"
+#include "policy/status.h"
+#include "smart_objects/enum_schema_item.h"
+#include "utils/date_time.h"
#include "utils/file_system.h"
+#include "utils/macro.h"
#include "utils/scope_guard.h"
-#include "utils/make_shared.h"
-#include "utils/helpers.h"
+
#include "policy/policy_manager.h"
+#include "utils/helpers.h"
+#ifdef EXTERNAL_PROPRIETARY_MODE
+#include "policy/ptu_retry_handler.h"
+#endif // EXTERNAL_PROPRIETARY_MODE
namespace policy {
@@ -90,7 +94,8 @@ RequestTypeMap TypeToString = {
{mobile_apis::RequestType::EMERGENCY, "EMERGENCY"},
{mobile_apis::RequestType::MEDIA, "MEDIA"},
{mobile_apis::RequestType::FOTA, "FOTA"},
- {mobile_apis::RequestType::OEM_SPECIFIC, "OEM_SPECIFIC"}};
+ {mobile_apis::RequestType::OEM_SPECIFIC, "OEM_SPECIFIC"},
+ {mobile_apis::RequestType::ICON_URL, "ICON_URL"}};
const std::string RequestTypeToString(mobile_apis::RequestType::eType type) {
RequestTypeMap::const_iterator it = TypeToString.find(type);
@@ -105,13 +110,12 @@ const policy::DeviceParams GetDeviceParams(
const protocol_handler::SessionObserver& session_observer) {
CREATE_LOGGERPTR_LOCAL(logger_, "PolicyHandler");
policy::DeviceParams device_params;
- if (-1 ==
- session_observer.GetDataOnDeviceID(
- device_handle,
- &device_params.device_name,
- NULL,
- &device_params.device_mac_address,
- &device_params.device_connection_type)) {
+ if (-1 == session_observer.GetDataOnDeviceID(
+ device_handle,
+ &device_params.device_name,
+ NULL,
+ &device_params.device_mac_address,
+ &device_params.device_connection_type)) {
LOG4CXX_ERROR(logger_,
"Failed to extract information for device " << device_handle);
}
@@ -125,7 +129,10 @@ struct HMILevelPredicate
: level_(level) {}
bool operator()(const ApplicationSharedPtr app) const {
- return level_ == app->hmi_level() ? true : false;
+ return level_ == app->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW)
+ ? true
+ : false;
}
private:
@@ -134,7 +141,7 @@ struct HMILevelPredicate
} // namespace
-#define POLICY_LIB_CHECK(return_value) \
+#define POLICY_LIB_CHECK_OR_RETURN(return_value) \
{ \
sync_primitives::AutoReadLock lock(policy_manager_lock_); \
if (!policy_manager_) { \
@@ -164,6 +171,7 @@ struct DeactivateApplication {
if (device_id_ == app->device()) {
state_ctrl_.SetRegularState(
app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
@@ -176,41 +184,6 @@ struct DeactivateApplication {
StateController& state_ctrl_;
};
-struct SDLAllowedNotification {
- SDLAllowedNotification(const connection_handler::DeviceHandle& device_id,
- PolicyManager* policy_manager,
- StateController& state_controller)
- : device_id_(device_id)
- , policy_manager_(policy_manager)
- , state_controller_(state_controller) {}
-
- void operator()(const ApplicationSharedPtr& app) {
- DCHECK_OR_RETURN_VOID(policy_manager_);
- if (device_id_ == app->device()) {
- std::string hmi_level = "NONE";
- mobile_apis::HMILevel::eType default_mobile_hmi;
- policy_manager_->GetDefaultHmi(app->policy_app_id(), &hmi_level);
- if ("BACKGROUND" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
- } else if ("FULL" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_FULL;
- } else if ("LIMITED" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_LIMITED;
- } else if ("NONE" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_NONE;
- } else {
- return;
- }
- state_controller_.SetRegularState(app, default_mobile_hmi, true);
- }
- }
-
- private:
- connection_handler::DeviceHandle device_id_;
- PolicyManager* policy_manager_;
- StateController& state_controller_;
-};
-
/**
* @brief Gets from system list of currently registered applications and
* create collection of links device-to-application
@@ -224,7 +197,7 @@ struct LinksCollector {
}
void operator()(const ApplicationSharedPtr& app) {
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_WARN(logger_,
"Invalid pointer to application was passed."
"Skip current application.");
@@ -258,7 +231,7 @@ struct LinkAppToDevice {
}
void operator()(const ApplicationSharedPtr& app) {
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_WARN(logger_,
"Invalid pointer to application was passed."
"Skip current application.");
@@ -325,15 +298,23 @@ const std::string PolicyHandler::kLibrary = "libPolicy.so";
PolicyHandler::PolicyHandler(const PolicySettings& settings,
ApplicationManager& application_manager)
: AsyncRunner("PolicyHandler async runner thread")
- , dl_handle_(0)
, last_activated_app_id_(0)
- , app_to_device_link_lock_(true)
- , statistic_manager_impl_(utils::MakeShared<StatisticManagerImpl>(this))
+#ifndef EXTERNAL_PROPRIETARY_MODE
+ , last_ptu_app_id_(0)
+#endif // EXTERNAL_PROPRIETARY_MODE
+ , statistic_manager_impl_(std::make_shared<StatisticManagerImpl>(this))
, settings_(settings)
- , application_manager_(application_manager) {}
+ , application_manager_(application_manager)
+ , last_registered_policy_app_id_(std::string()) {
+}
PolicyHandler::~PolicyHandler() {}
+PolicyEncryptionFlagGetterInterfaceSPtr
+PolicyHandler::PolicyEncryptionFlagGetter() const {
+ return policy_manager_;
+}
+
bool PolicyHandler::PolicyEnabled() const {
return get_settings().enable_policy();
}
@@ -348,38 +329,48 @@ bool PolicyHandler::LoadPolicyLibrary() {
policy_manager_.reset();
return false;
}
- dl_handle_ = dlopen(kLibrary.c_str(), RTLD_LAZY);
- const char* error = dlerror();
- if (!error) {
- if (CreateManager()) {
- policy_manager_->set_listener(this);
- event_observer_ =
- utils::SharedPtr<PolicyEventObserver>(new PolicyEventObserver(
- this, application_manager_.event_dispatcher()));
- }
- } else {
- LOG4CXX_ERROR(logger_, error);
+ if (CreateManager()) {
+ policy_manager_->set_listener(this);
+ event_observer_ = std::shared_ptr<PolicyEventObserver>(
+ new PolicyEventObserver(this, application_manager_.event_dispatcher()));
}
- return policy_manager_.valid();
+ return (policy_manager_.use_count() != 0);
}
bool PolicyHandler::CreateManager() {
+ void* policy_handle = dlopen(kLibrary.c_str(), RTLD_LAZY);
+ const char* error = dlerror();
+ if (!policy_handle) {
+ LOG4CXX_ERROR(
+ logger_,
+ (error == NULL ? "Unknown error in dlopen while loading policy table"
+ : error));
+ return false;
+ }
+
typedef PolicyManager* (*CreateManager)();
typedef void (*DeleteManager)(PolicyManager*);
CreateManager create_manager =
- reinterpret_cast<CreateManager>(dlsym(dl_handle_, "CreateManager"));
+ reinterpret_cast<CreateManager>(dlsym(policy_handle, "CreateManager"));
DeleteManager delete_manager =
- reinterpret_cast<DeleteManager>(dlsym(dl_handle_, "DeleteManager"));
+ reinterpret_cast<DeleteManager>(dlsym(policy_handle, "DeleteManager"));
+ auto policy_destroyer = [delete_manager,
+ policy_handle](PolicyManager* policy_manager) {
+ LOG4CXX_DEBUG(logger_, "Delete Policy Manager");
+ delete_manager(policy_manager);
+ dlclose(policy_handle);
+ };
char* error_string = dlerror();
if (NULL == error_string) {
policy_manager_ =
- utils::SharedPtr<PolicyManager>(create_manager(), delete_manager);
+ std::shared_ptr<PolicyManager>(create_manager(), policy_destroyer);
} else {
LOG4CXX_WARN(logger_, error_string);
+ dlclose(policy_handle);
}
- return policy_manager_.valid();
+ return (policy_manager_.use_count() != 0);
}
const PolicySettings& PolicyHandler::get_settings() const {
@@ -388,22 +379,41 @@ const PolicySettings& PolicyHandler::get_settings() const {
bool PolicyHandler::InitPolicyTable() {
LOG4CXX_AUTO_TRACE(logger_);
- POLICY_LIB_CHECK(false);
- // Subscribing to notification for system readiness to be able to get system
- // info necessary for policy table
- event_observer_->subscribe_on_event(
- hmi_apis::FunctionID::BasicCommunication_OnReady);
+ POLICY_LIB_CHECK_OR_RETURN(false);
std::string preloaded_file = get_settings().preloaded_pt_file();
if (file_system::FileExists(preloaded_file)) {
- return policy_manager_->InitPT(preloaded_file, &get_settings());
+ const bool pt_inited =
+ policy_manager_->InitPT(preloaded_file, &get_settings());
+ OnPTInited();
+ return pt_inited;
}
LOG4CXX_FATAL(logger_, "The file which contains preloaded PT is not exist");
return false;
}
+void PolicyHandler::OnPTInited() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ sync_primitives::AutoLock lock(listeners_lock_);
+
+ std::for_each(listeners_.begin(),
+ listeners_.end(),
+ std::mem_fun(&PolicyHandlerObserver::OnPTInited));
+}
+
+void PolicyHandler::StopRetrySequence() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ POLICY_LIB_CHECK_VOID();
+#ifndef EXTERNAL_PROPRIETARY_MODE
+ // Clear cached PTU app
+ last_ptu_app_id_ = 0;
+#endif // EXTERNAL_PROPRIETARY_MODE
+ policy_manager_->StopRetrySequence();
+}
+
bool PolicyHandler::ResetPolicyTable() {
LOG4CXX_TRACE(logger_, "Reset policy table.");
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
std::string preloaded_file = get_settings().preloaded_pt_file();
if (file_system::FileExists(preloaded_file)) {
return policy_manager_->ResetPT(preloaded_file);
@@ -414,15 +424,43 @@ bool PolicyHandler::ResetPolicyTable() {
bool PolicyHandler::ClearUserConsent() {
LOG4CXX_AUTO_TRACE(logger_);
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->ResetUserConsent();
}
+#ifndef EXTERNAL_PROPRIETARY_MODE
+uint32_t PolicyHandler::ChoosePTUApplication(
+ const PTUIterationType iteration_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // Return the previous app chosen if this is a retry for a PTU in progress
+ if (iteration_type == PTUIterationType::RetryIteration &&
+ last_ptu_app_id_ != 0) {
+ ApplicationSharedPtr app =
+ application_manager_.application(last_ptu_app_id_);
+ if (app && app->IsRegistered()) {
+ LOG4CXX_INFO(logger_, "Previously chosen application exists, returning");
+ return last_ptu_app_id_;
+ }
+ }
+
+ last_ptu_app_id_ = GetAppIdForSending();
+ return last_ptu_app_id_;
+}
+
+void PolicyHandler::CacheRetryInfo(const uint32_t app_id,
+ const std::string url) {
+ last_ptu_app_id_ = app_id;
+ retry_update_url_ = url;
+}
+#endif // EXTERNAL_PROPRIETARY_MODE
+
uint32_t PolicyHandler::GetAppIdForSending() const {
LOG4CXX_AUTO_TRACE(logger_);
- POLICY_LIB_CHECK(0);
- const ApplicationSet& accessor =
- application_manager_.applications().GetData();
+ POLICY_LIB_CHECK_OR_RETURN(0);
+
+ // fix ApplicationSet access crash
+ const ApplicationSet accessor = application_manager_.applications().GetData();
HMILevelPredicate has_none_level(mobile_api::HMILevel::HMI_NONE);
Applications apps_without_none_level;
@@ -435,11 +473,10 @@ uint32_t PolicyHandler::GetAppIdForSending() const {
"Number of apps with different from NONE level: "
<< apps_without_none_level.size());
- uint32_t choosen_app_id =
- ChooseRandomAppForPolicyUpdate(apps_without_none_level);
+ uint32_t app_id = ChooseRandomAppForPolicyUpdate(apps_without_none_level);
- if (choosen_app_id) {
- return choosen_app_id;
+ if (app_id) {
+ return app_id;
}
Applications apps_with_none_level;
@@ -452,10 +489,40 @@ uint32_t PolicyHandler::GetAppIdForSending() const {
logger_,
"Number of apps with NONE level: " << apps_with_none_level.size());
+ if (apps_with_none_level.empty()) {
+ LOG4CXX_WARN(logger_, "There is no registered application");
+ return 0;
+ }
+
return ChooseRandomAppForPolicyUpdate(apps_with_none_level);
}
+void PolicyHandler::PushAppIdToPTUQueue(const uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ POLICY_LIB_CHECK_VOID();
+ sync_primitives::AutoLock lock(app_id_queue_lock_);
+ const auto result = applications_ptu_queue_.insert(app_id);
+ if (result.second) {
+ policy_manager_->UpdatePTUReadyAppsCount(applications_ptu_queue_.size());
+ }
+}
+
+void PolicyHandler::PopAppIdFromPTUQueue() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ POLICY_LIB_CHECK_VOID();
+ sync_primitives::AutoLock lock(app_id_queue_lock_);
+ if (applications_ptu_queue_.size() > 0) {
+ applications_ptu_queue_.erase(applications_ptu_queue_.begin());
+ policy_manager_->UpdatePTUReadyAppsCount(applications_ptu_queue_.size());
+ }
+}
+
#ifdef EXTERNAL_PROPRIETARY_MODE
+PTURetryHandler& PolicyHandler::ptu_retry_handler() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return *policy_manager_;
+}
+
void PolicyHandler::OnAppPermissionConsent(
const uint32_t connection_key,
const PermissionConsent& permissions,
@@ -475,6 +542,7 @@ void PolicyHandler::OnAppPermissionConsent(
void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
const bool is_allowed) {
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
connection_handler::DeviceHandle device_handle;
if (!application_manager_.connection_handler().GetDeviceID(device_id,
@@ -505,22 +573,26 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
continue;
}
- policy_manager_->ReactOnUserDevConsentForApp(policy_app_id, is_allowed);
+ policy_manager_->ReactOnUserDevConsentForApp(
+ device_handle, policy_app_id, is_allowed);
- policy_manager_->SendNotificationOnPermissionsUpdated(policy_app_id);
+ policy_manager_->SendNotificationOnPermissionsUpdated(device_id,
+ policy_app_id);
}
}
}
void PolicyHandler::SendOnAppPermissionsChanged(
- const AppPermissions& permissions, const std::string& policy_app_id) const {
+ const AppPermissions& permissions,
+ const std::string& device_id,
+ const std::string& policy_app_id) const {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "PolicyHandler::SendOnAppPermissionsChanged for "
- << policy_app_id);
+ LOG4CXX_DEBUG(
+ logger_,
+ "PolicyHandler::SendOnAppPermissionsChanged for " << policy_app_id);
ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(policy_app_id);
- if (!app.valid()) {
+ application_manager_.application(device_id, policy_app_id);
+ if (app.use_count() == 0) {
LOG4CXX_WARN(logger_, "No app found for policy app id = " << policy_app_id);
return;
}
@@ -528,6 +600,15 @@ void PolicyHandler::SendOnAppPermissionsChanged(
app->app_id(), permissions, application_manager_);
}
+void PolicyHandler::SendOnAppPropertiesChangeNotification(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto notification =
+ MessageHelper::CreateOnAppPropertiesChangeNotification(
+ policy_app_id, application_manager_);
+ application_manager_.GetRPCService().ManageHMICommand(notification);
+}
+
void PolicyHandler::OnPTExchangeNeeded() {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
@@ -553,10 +634,11 @@ struct SmartObjectToInt {
};
StatusNotifier PolicyHandler::AddApplication(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) {
- POLICY_LIB_CHECK(utils::MakeShared<utils::CallNothing>());
- return policy_manager_->AddApplication(application_id, hmi_types);
+ POLICY_LIB_CHECK_OR_RETURN(std::make_shared<utils::CallNothing>());
+ return policy_manager_->AddApplication(device_id, application_id, hmi_types);
}
void PolicyHandler::AddDevice(const std::string& device_id,
@@ -591,7 +673,7 @@ void PolicyHandler::OnAppPermissionConsentInternal(
if (connection_key) {
ApplicationSharedPtr app = application_manager_.application(connection_key);
- if (app.valid()) {
+ if (app.use_count() != 0) {
out_permissions.policy_app_id = app->policy_app_id();
DeviceParams device_params = GetDeviceParams(
app->device(),
@@ -608,36 +690,39 @@ void PolicyHandler::OnAppPermissionConsentInternal(
#endif
}
} else if (!app_to_device_link_.empty()) {
- sync_primitives::AutoLock lock(app_to_device_link_lock_);
- std::map<std::string, std::string>::const_iterator it =
- app_to_device_link_.begin();
- for (; app_to_device_link_.end() != it; ++it) {
- ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(it->second);
-
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
+ for (const auto& app : accessor) {
// If list of apps sent to HMI for user consents is not the same as
// current,
// permissions should be set only for coincident to registered apps
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_WARN(logger_,
"Invalid pointer to application was passed."
"Permissions setting skipped.");
continue;
}
+ if (!app->IsRegistered()) {
+ LOG4CXX_DEBUG(logger_,
+ "Application " << app->policy_app_id()
+ << " is not marked as registered.");
+ continue;
+ }
+
DeviceParams device_params = GetDeviceParams(
app->device(),
application_manager_.connection_handler().get_session_observer());
- if (device_params.device_mac_address != it->first) {
+ if (device_params.device_mac_address != app->mac_address()) {
LOG4CXX_WARN(logger_,
"Device_id of application is changed."
"Permissions setting skipped.");
continue;
}
- out_permissions.policy_app_id = it->second;
- out_permissions.device_id = it->first;
+ out_permissions.policy_app_id = app->policy_app_id();
+ out_permissions.device_id = app->mac_address();
#ifdef EXTERNAL_PROPRIETARY_MODE
policy_manager_->SetUserConsentForApp(out_permissions, mode);
#else
@@ -659,15 +744,15 @@ void PolicyHandler::OnAppPermissionConsentInternal(
void policy::PolicyHandler::SetDaysAfterEpoch() {
POLICY_LIB_CHECK_VOID();
- TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ date_time::TimeDuration current_time = date_time::getCurrentTime();
const int kSecondsInDay = 60 * 60 * 24;
- int days_after_epoch = current_time.tv_sec / kSecondsInDay;
+ int days_after_epoch = date_time::getSecs(current_time) / kSecondsInDay;
PTUpdatedAt(Counters::DAYS_AFTER_EPOCH, days_after_epoch);
}
#ifdef ENABLE_SECURITY
std::string PolicyHandler::RetrieveCertificate() const {
- POLICY_LIB_CHECK(std::string(""));
+ POLICY_LIB_CHECK_OR_RETURN(std::string(""));
return policy_manager_->RetrieveCertificate();
}
#endif // ENABLE_SECURITY
@@ -695,6 +780,19 @@ void PolicyHandler::OnGetUserFriendlyMessage(
result, correlation_id, application_manager_);
}
+void PolicyHandler::OnSystemRequestReceived() const {
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ ptu_retry_handler().OnSystemRequestReceived();
+#endif
+ policy_manager_->ResetTimeout();
+}
+
+void PolicyHandler::TriggerPTUOnStartupIfRequired() {
+#ifndef EXTERNAL_PROPRIETARY_MODE
+ policy_manager_->TriggerPTUOnStartupIfRequired();
+#endif
+}
+
void PolicyHandler::GetRegisteredLinks(
std::map<std::string, std::string>& out_links) const {
DataAccessor<ApplicationSet> accessor = application_manager_.applications();
@@ -708,7 +806,7 @@ void PolicyHandler::GetRegisteredLinks(
std::vector<policy::FunctionalGroupPermission>
PolicyHandler::CollectRegisteredAppsPermissions() {
LOG4CXX_AUTO_TRACE(logger_);
- POLICY_LIB_CHECK(std::vector<policy::FunctionalGroupPermission>());
+ POLICY_LIB_CHECK_OR_RETURN(std::vector<policy::FunctionalGroupPermission>());
// If no specific app was passed, get permissions for all currently registered
// applications
sync_primitives::AutoLock lock(app_to_device_link_lock_);
@@ -729,11 +827,13 @@ PolicyHandler::CollectRegisteredAppsPermissions() {
std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions(
const uint32_t connection_key) {
+ std::vector<FunctionalGroupPermission> group_permissions;
+ POLICY_LIB_CHECK_OR_RETURN(group_permissions);
+
// Single app only
ApplicationSharedPtr app = application_manager_.application(connection_key);
- std::vector<FunctionalGroupPermission> group_permissions;
- if (NULL == app.get() || !app.valid()) {
+ if (NULL == app.get() || app.use_count() == 0) {
LOG4CXX_WARN(logger_,
"Connection key '"
<< connection_key
@@ -809,11 +909,12 @@ void PolicyHandler::LinkAppsToDevice() {
bool PolicyHandler::IsAppSuitableForPolicyUpdate(
const Applications::value_type value) const {
LOG4CXX_AUTO_TRACE(logger_);
+ POLICY_LIB_CHECK_OR_RETURN(false);
if (!value->IsRegistered()) {
- LOG4CXX_DEBUG(logger_,
- "Application " << value->app_id()
- << " is not marked as registered.");
+ LOG4CXX_DEBUG(
+ logger_,
+ "Application " << value->app_id() << " is not marked as registered.");
return false;
}
@@ -826,9 +927,9 @@ bool PolicyHandler::IsAppSuitableForPolicyUpdate(
value->device(),
application_manager_.connection_handler().get_session_observer());
- const bool is_device_allowed = (kDeviceAllowed ==
- policy_manager_->GetUserConsentForDevice(
- device_params.device_mac_address));
+ const bool is_device_allowed =
+ (kDeviceAllowed == policy_manager_->GetUserConsentForDevice(
+ device_params.device_mac_address));
LOG4CXX_DEBUG(logger_,
"Is device " << device_params.device_mac_address << " allowed "
@@ -861,6 +962,15 @@ void PolicyHandler::OnDeviceSwitching(const std::string& device_id_from,
policy_manager_->OnDeviceSwitching(device_id_from, device_id_to);
}
+void PolicyHandler::OnLockScreenDismissalStateChanged() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto accessor = application_manager_.applications();
+ const auto apps = accessor.GetData();
+ for (auto& app : apps) {
+ application_manager_.SendDriverDistractionState(app);
+ }
+}
+
void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
@@ -878,22 +988,24 @@ void PolicyHandler::OnUpdateStatusChanged(const std::string& status) {
}
std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(policy_app_id);
+ DeviceParams device_params = GetDeviceParams(
+ device_handle,
+ application_manager_.connection_handler().get_session_observer());
- if (!app.valid()) {
+ ApplicationSharedPtr app = application_manager_.application(
+ device_params.device_mac_address, policy_app_id);
+
+ if (app.use_count() == 0) {
LOG4CXX_WARN(logger_,
"Application with id '"
<< policy_app_id
<< "' "
"not found within registered applications.");
- return "";
+ return std::string();
}
- DeviceParams device_params = GetDeviceParams(
- app->device(),
- application_manager_.connection_handler().get_session_observer());
return device_params.device_mac_address;
}
@@ -912,12 +1024,6 @@ void PolicyHandler::OnGetSystemInfo(const std::string& ccpu_version,
policy_manager_->SetSystemInfo(ccpu_version, wers_country_code, language);
}
-void PolicyHandler::OnSystemInfoUpdateRequired() {
- LOG4CXX_AUTO_TRACE(logger_);
- POLICY_LIB_CHECK_VOID();
- MessageHelper::SendGetSystemInfoRequest(application_manager_);
-}
-
void PolicyHandler::OnVIIsReady() {
LOG4CXX_AUTO_TRACE(logger_);
const uint32_t correlation_id =
@@ -935,9 +1041,9 @@ void PolicyHandler::OnVehicleDataUpdated(
POLICY_LIB_CHECK_VOID();
#ifdef EXTERNAL_PROPRIETARY_MODE
if (!message.keyExists(strings::msg_params)) {
- LOG4CXX_ERROR(logger_,
- "Message does not contains mandatory section "
- << strings::msg_params);
+ LOG4CXX_ERROR(
+ logger_,
+ "Message does not contains mandatory section " << strings::msg_params);
return;
}
if (message[strings::msg_params].keyExists(strings::vin)) {
@@ -951,21 +1057,22 @@ void PolicyHandler::OnVehicleDataUpdated(
}
void PolicyHandler::OnPendingPermissionChange(
- const std::string& policy_app_id) {
- LOG4CXX_DEBUG(logger_,
- "PolicyHandler::OnPendingPermissionChange for "
- << policy_app_id);
+ const std::string& device_id, const std::string& policy_app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(
+ logger_,
+ "PolicyHandler::OnPendingPermissionChange for " << policy_app_id);
POLICY_LIB_CHECK_VOID();
ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(policy_app_id);
- if (!app.valid()) {
+ application_manager_.application(device_id, policy_app_id);
+ if (app.use_count() == 0) {
LOG4CXX_WARN(logger_,
"No app found for " << policy_app_id << " policy app id.");
return;
}
AppPermissions permissions =
- policy_manager_->GetAppPermissionsChanges(policy_app_id);
+ policy_manager_->GetAppPermissionsChanges(device_id, policy_app_id);
const uint32_t app_id = app->app_id();
@@ -974,6 +1081,7 @@ void PolicyHandler::OnPendingPermissionChange(
app_id, permissions, application_manager_);
application_manager_.state_controller().SetRegularState(
app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
@@ -982,7 +1090,8 @@ void PolicyHandler::OnPendingPermissionChange(
return;
}
- mobile_apis::HMILevel::eType app_hmi_level = app->hmi_level();
+ mobile_apis::HMILevel::eType app_hmi_level =
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
switch (app_hmi_level) {
case mobile_apis::HMILevel::eType::HMI_FULL:
@@ -990,8 +1099,6 @@ void PolicyHandler::OnPendingPermissionChange(
if (permissions.appPermissionsConsentNeeded) {
MessageHelper::SendOnAppPermissionsChangedNotification(
app->app_id(), permissions, application_manager_);
-
- policy_manager_->RemovePendingPermissionChanges(policy_app_id);
// "Break" statement has to be here to continue processing in case of
// there is another "true" flag in permissions struct
break;
@@ -1001,8 +1108,6 @@ void PolicyHandler::OnPendingPermissionChange(
if (permissions.isAppPermissionsRevoked) {
MessageHelper::SendOnAppPermissionsChangedNotification(
app->app_id(), permissions, application_manager_);
-
- policy_manager_->RemovePendingPermissionChanges(policy_app_id);
}
break;
}
@@ -1023,23 +1128,28 @@ void PolicyHandler::OnPendingPermissionChange(
commands::Command::SOURCE_SDL);
application_manager_.OnAppUnauthorized(app->app_id());
-
- policy_manager_->RemovePendingPermissionChanges(policy_app_id);
}
if (permissions.requestTypeChanged || permissions.requestSubTypeChanged) {
MessageHelper::SendOnAppPermissionsChangedNotification(
app->app_id(), permissions, application_manager_);
- policy_manager_->RemovePendingPermissionChanges(policy_app_id);
}
+
+ policy_manager_->RemovePendingPermissionChanges(policy_app_id);
}
bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
const std::string& url) {
+ const uint32_t app_id = GetAppIdForSending();
+ return SendMessageToSDK(pt_string, url, app_id);
+}
+
+bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
+ const std::string& url,
+ const uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
- const uint32_t app_id = GetAppIdForSending();
ApplicationSharedPtr app = application_manager_.application(app_id);
if (!app) {
@@ -1054,14 +1164,17 @@ bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
if (mobile_app_id.empty()) {
LOG4CXX_WARN(logger_,
"Application with connection key '"
- << app_id << "'"
- " has no application id.");
+ << app_id
+ << "'"
+ " has no application id.");
return false;
}
LOG4CXX_DEBUG(logger_,
- "Update url is " << url << " for application "
- "with connection key " << app_id);
+ "Update url is " << url
+ << " for application "
+ "with connection key "
+ << app_id);
MessageHelper::SendPolicySnapshotNotification(
app_id, pt_string, url, application_manager_);
@@ -1071,33 +1184,39 @@ bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file,
const BinaryMessage& pt_string) {
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
+
+ const auto load_pt_result = policy_manager_->LoadPT(file, pt_string);
- bool ret = policy_manager_->LoadPT(file, pt_string);
- LOG4CXX_INFO(logger_, "Policy table is saved: " << std::boolalpha << ret);
- if (ret) {
+ LOG4CXX_INFO(logger_, "Load policy table result code: " << load_pt_result);
+
+ const bool is_ptu_successful =
+ load_pt_result == PolicyManager::PtProcessingResult::kSuccess;
+ OnPTUFinished(is_ptu_successful);
+
+ if (is_ptu_successful) {
LOG4CXX_INFO(logger_, "PTU was successful.");
policy_manager_->CleanupUnpairedDevices();
- int32_t correlation_id = application_manager_.GetNextHMICorrelationID();
-
SetDaysAfterEpoch();
+ policy_manager_->OnPTUFinished(load_pt_result);
+#ifndef EXTERNAL_PROPRIETARY_MODE
+ // Clean up retry information
+ last_ptu_app_id_ = 0;
+#endif // EXTERNAL_PROPRIETARY_MODE
+ uint32_t correlation_id = application_manager_.GetNextHMICorrelationID();
event_observer_->subscribe_on_event(
-#ifdef HMI_DBUS_API
- hmi_apis::FunctionID::VehicleInfo_GetOdometer, correlation_id
-#else
- hmi_apis::FunctionID::VehicleInfo_GetVehicleData, correlation_id
-#endif
- );
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleData, correlation_id);
std::vector<std::string> vehicle_data_args;
vehicle_data_args.push_back(strings::odometer);
MessageHelper::CreateGetVehicleDataRequest(
correlation_id, vehicle_data_args, application_manager_);
} else {
LOG4CXX_WARN(logger_, "Exchange wasn't successful");
+ policy_manager_->OnPTUFinished(load_pt_result);
}
- OnPTUFinished(ret);
- return ret;
+
+ return is_ptu_successful;
}
bool PolicyHandler::UnloadPolicyLibrary() {
@@ -1109,10 +1228,6 @@ bool PolicyHandler::UnloadPolicyLibrary() {
if (policy_manager_) {
policy_manager_.reset();
}
- if (dl_handle_) {
- ret = (dlclose(dl_handle_) == 0);
- dl_handle_ = 0;
- }
LOG4CXX_TRACE(logger_, "exit");
return ret;
}
@@ -1131,7 +1246,8 @@ struct SDLAlowedNotification {
if (app->device() == device_id_) {
std::string hmi_level;
mobile_apis::HMILevel::eType default_mobile_hmi;
- policy_manager_->GetDefaultHmi(app->policy_app_id(), &hmi_level);
+ policy_manager_->GetDefaultHmi(
+ app->mac_address(), app->policy_app_id(), &hmi_level);
if ("BACKGROUND" == hmi_level) {
default_mobile_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
} else if ("FULL" == hmi_level) {
@@ -1143,7 +1259,11 @@ struct SDLAlowedNotification {
} else {
return;
}
- state_controller_.SetRegularState(app, default_mobile_hmi, true);
+ state_controller_.SetRegularState(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ default_mobile_hmi,
+ true);
}
}
@@ -1181,9 +1301,9 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(
policy_manager_->SetUserConsentForDevice(device_id, is_allowed);
connection_handler::DeviceHandle device_handle = 0;
if (!connection_handler.GetDeviceID(device_id, &device_handle)) {
- LOG4CXX_WARN(logger_,
- "Device handle with mac " << device_id
- << " wasn't found.");
+ LOG4CXX_WARN(
+ logger_,
+ "Device handle with mac " << device_id << " wasn't found.");
}
#ifdef EXTERNAL_PROPRIETARY_MODE
@@ -1252,7 +1372,12 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(
: VideoStreamingState::NOT_STREAMABLE;
application_manager_.state_controller().SetRegularState(
- app, mobile_apis::HMILevel::HMI_FULL, audio_state, video_state, true);
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_FULL,
+ audio_state,
+ video_state,
+ true);
last_activated_app_id_ = 0;
} else {
DeactivateApplication deactivate_notification(
@@ -1272,9 +1397,8 @@ void PolicyHandler::OnIgnitionCycleOver() {
void PolicyHandler::OnActivateApp(uint32_t connection_key,
uint32_t correlation_id) {
LOG4CXX_AUTO_TRACE(logger_);
- POLICY_LIB_CHECK_VOID();
ApplicationSharedPtr app = application_manager_.application(connection_key);
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_WARN(logger_, "Activated App failed: no app found.");
return;
}
@@ -1289,7 +1413,8 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key,
permissions.isSDLAllowed = true;
}
} else {
- permissions = policy_manager_->GetAppPermissionsChanges(policy_app_id);
+ permissions = policy_manager_->GetAppPermissionsChanges(app->mac_address(),
+ policy_app_id);
#ifdef EXTERNAL_PROPRIETARY_MODE
UsageStatistics& usage = app->usage_report();
@@ -1360,31 +1485,33 @@ void PolicyHandler::PTExchangeAtUserRequest(uint32_t correlation_id) {
update_status, correlation_id, application_manager_);
}
-void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
+void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions,
const HMILevel& default_hmi) {
LOG4CXX_AUTO_TRACE(logger_);
- OnPermissionsUpdated(policy_app_id, permissions);
+ OnPermissionsUpdated(device_id, policy_app_id, permissions);
ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(policy_app_id);
- if (!app.valid()) {
+ application_manager_.application(device_id, policy_app_id);
+ if (app.use_count() == 0) {
LOG4CXX_WARN(
logger_,
- "Connection_key not found for application_id:" << policy_app_id);
+ "Connection_key not found for application_id: " << policy_app_id);
return;
}
// The application currently not running (i.e. in NONE) should change HMI
// level to default
- mobile_apis::HMILevel::eType current_hmi_level = app->hmi_level();
+ mobile_apis::HMILevel::eType current_hmi_level =
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
mobile_apis::HMILevel::eType hmi_level =
MessageHelper::StringToHMILevel(default_hmi);
if (mobile_apis::HMILevel::INVALID_ENUM == hmi_level) {
- LOG4CXX_WARN(logger_,
- "Couldn't convert default hmi level " << default_hmi
- << " to enum.");
+ LOG4CXX_WARN(
+ logger_,
+ "Couldn't convert default hmi level " << default_hmi << " to enum.");
return;
}
if (current_hmi_level == hmi_level) {
@@ -1400,10 +1527,16 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
if (hmi_level == mobile_apis::HMILevel::HMI_FULL) {
application_manager_.state_controller().SetRegularState(
- app, hmi_level, true);
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ hmi_level,
+ true);
} else {
application_manager_.state_controller().SetRegularState(
- app, hmi_level, false);
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ hmi_level,
+ false);
}
break;
}
@@ -1416,27 +1549,40 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
}
}
-void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
+void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions) {
LOG4CXX_AUTO_TRACE(logger_);
+ POLICY_LIB_CHECK_VOID();
+
ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(policy_app_id);
- if (!app.valid()) {
+ application_manager_.application(device_id, policy_app_id);
+ if (app.use_count() == 0) {
LOG4CXX_WARN(
logger_,
- "Connection_key not found for application_id:" << policy_app_id);
+ "Connection_key not found for application_id: " << policy_app_id);
return;
}
+ const auto require_encryption =
+ policy_manager_->GetAppEncryptionRequired(policy_app_id);
+
MessageHelper::SendOnPermissionsChangeNotification(
- app->app_id(), permissions, application_manager_);
+ app->app_id(), permissions, application_manager_, require_encryption);
LOG4CXX_DEBUG(logger_,
- "Notification sent for application_id:"
+ "Notification sent for application_id: "
<< policy_app_id << " and connection_key "
<< app->app_id());
}
+void PolicyHandler::OnPTUTimeOut() {
+ PopAppIdFromPTUQueue();
+#ifndef EXTERNAL_PROPRIETARY_MODE
+ application_manager_.protocol_handler().ProcessFailedPTU();
+#endif
+}
+
bool PolicyHandler::SaveSnapshot(const BinaryMessage& pt_string,
std::string& snap_path) {
const std::string& policy_snapshot_file_name =
@@ -1464,7 +1610,7 @@ void PolicyHandler::OnSnapshotCreated(
std::string policy_snapshot_full_path;
if (SaveSnapshot(pt_string, policy_snapshot_full_path)) {
const uint32_t timeout_exchange_s =
- timeout_exchange_ms / date_time::DateTime::MILLISECONDS_IN_SECOND;
+ timeout_exchange_ms / date_time::MILLISECONDS_IN_SECOND;
MessageHelper::SendPolicyUpdate(policy_snapshot_full_path,
timeout_exchange_s,
retry_delay_seconds,
@@ -1472,55 +1618,115 @@ void PolicyHandler::OnSnapshotCreated(
}
}
#else // EXTERNAL_PROPRIETARY_MODE
-void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string) {
+void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string,
+ const PTUIterationType iteration_type) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
#ifdef PROPRIETARY_MODE
- std::string policy_snapshot_full_path;
- if (!SaveSnapshot(pt_string, policy_snapshot_full_path)) {
- LOG4CXX_ERROR(logger_, "Snapshot processing skipped.");
- return;
+ if (PTUIterationType::RetryIteration == iteration_type) {
+ uint32_t app_id_for_sending = 0;
+ const std::string& url =
+ GetNextUpdateUrl(PTUIterationType::RetryIteration, app_id_for_sending);
+ if (0 != url.length()) {
+ MessageHelper::SendPolicySnapshotNotification(
+ app_id_for_sending, pt_string, url, application_manager_);
+ }
+
+ } else {
+ std::string policy_snapshot_full_path;
+ if (!SaveSnapshot(pt_string, policy_snapshot_full_path)) {
+ LOG4CXX_ERROR(logger_, "Snapshot processing skipped.");
+ return;
+ }
+
+ MessageHelper::SendPolicyUpdate(
+ policy_snapshot_full_path,
+ TimeoutExchangeSec(),
+ policy_manager_->RetrySequenceDelaysSeconds(),
+ application_manager_);
}
- MessageHelper::SendPolicyUpdate(policy_snapshot_full_path,
- TimeoutExchangeSec(),
- policy_manager_->RetrySequenceDelaysSeconds(),
- application_manager_);
#else // PROPRIETARY_MODE
- LOG4CXX_ERROR(logger_, "HTTP policy");
- EndpointUrls urls;
- policy_manager_->GetUpdateUrls("0x07", urls);
+ LOG4CXX_INFO(logger_, "HTTP policy");
- if (urls.empty()) {
- LOG4CXX_ERROR(logger_, "Service URLs are empty! NOT sending PT to mobile!");
- return;
+ uint32_t app_id_for_sending = 0;
+ const std::string& url = GetNextUpdateUrl(iteration_type, app_id_for_sending);
+ if (0 != url.length()) {
+ SendMessageToSDK(pt_string, url, app_id_for_sending);
}
+#endif // PROPRIETARY_MODE
+}
- AppIdURL app_url = policy_manager_->GetNextUpdateUrl(urls);
- while (!IsUrlAppIdValid(app_url.first, urls)) {
- app_url = policy_manager_->GetNextUpdateUrl(urls);
+std::string PolicyHandler::GetNextUpdateUrl(
+ const PTUIterationType iteration_type, uint32_t& app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ POLICY_LIB_CHECK_OR_RETURN(std::string());
+ app_id = ChoosePTUApplication(iteration_type);
+
+ if (0 == app_id) {
+ return std::string();
}
- const std::string& url = urls[app_url.first].url[app_url.second];
- SendMessageToSDK(pt_string, url);
-#endif // PROPRIETARY_MODE
- // reset update required false
- OnUpdateRequestSentToMobile();
+
+ // Use cached URL for retries if it was provided by the HMI
+ if (PTUIterationType::RetryIteration == iteration_type &&
+ !retry_update_url_.empty()) {
+ return retry_update_url_;
+ }
+
+ EndpointUrls endpoint_urls;
+ policy_manager_->GetUpdateUrls("0x07", endpoint_urls);
+
+ if (endpoint_urls.empty()) {
+ LOG4CXX_ERROR(logger_, "Service URLs are empty!");
+ return std::string();
+ }
+
+ auto get_ptu_app = [this](AppIdURL app_url, uint32_t& app_id) {
+ if (app_url.first == 0 && app_url.second == 0) {
+ // We've looped past the end of the list, choose new application
+ app_id = ChoosePTUApplication(PTUIterationType::DefaultIteration);
+ if (0 == app_id) {
+ return ApplicationSharedPtr();
+ }
+ }
+ return application_manager_.application(app_id);
+ };
+
+ AppIdURL app_url = policy_manager_->GetNextUpdateUrl(endpoint_urls);
+ ApplicationSharedPtr app = get_ptu_app(app_url, app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "No available applications for PTU!");
+ return std::string();
+ }
+ EndpointData& data = endpoint_urls[app_url.first];
+ while (!IsUrlAppIdValid(app->policy_app_id(), data)) {
+ app_url = policy_manager_->GetNextUpdateUrl(endpoint_urls);
+ app = get_ptu_app(app_url, app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "No available applications for PTU!");
+ return std::string();
+ }
+ data = endpoint_urls[app_url.first];
+ }
+ const std::string& url = data.url[app_url.second];
+ return url;
}
#endif // EXTERNAL_PROPRIETARY_MODE
bool PolicyHandler::GetPriority(const std::string& policy_app_id,
std::string* priority) const {
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->GetPriority(policy_app_id, priority);
}
void PolicyHandler::CheckPermissions(
const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const PTString& rpc,
const RPCParams& rpc_params,
CheckPermissionResult& result) {
POLICY_LIB_CHECK_VOID();
const std::string hmi_level =
- MessageHelper::StringifiedHMILevel(app->hmi_level());
+ MessageHelper::StringifiedHMILevel(app->hmi_level(window_id));
if (hmi_level.empty()) {
LOG4CXX_WARN(logger_,
"HMI level for " << app->policy_app_id() << " is invalid, rpc "
@@ -1534,81 +1740,131 @@ void PolicyHandler::CheckPermissions(
"Checking permissions for " << app->policy_app_id() << " in "
<< hmi_level << " on device "
<< device_id << " rpc " << rpc);
-#ifdef EXTERNAL_PROPRIETARY_MODE
- policy_manager_->CheckPermissions(
- app->policy_app_id(), hmi_level, rpc, rpc_params, result);
-#else // EXTERNAL_PROPRIETARY_MODE
policy_manager_->CheckPermissions(
device_id, app->policy_app_id(), hmi_level, rpc, rpc_params, result);
-#endif // EXTERNAL_PROPRIETARY_MODE
}
uint32_t PolicyHandler::GetNotificationsNumber(
const std::string& priority) const {
- POLICY_LIB_CHECK(0);
+ POLICY_LIB_CHECK_OR_RETURN(0);
return policy_manager_->GetNotificationsNumber(priority);
}
DeviceConsent PolicyHandler::GetUserConsentForDevice(
const std::string& device_id) const {
- POLICY_LIB_CHECK(kDeviceDisallowed);
+ POLICY_LIB_CHECK_OR_RETURN(kDeviceDisallowed);
return policy_manager_->GetUserConsentForDevice(device_id);
}
-bool PolicyHandler::GetDefaultHmi(const std::string& policy_app_id,
+Json::Value PolicyHandler::GetPolicyTableData() const {
+ POLICY_LIB_CHECK_OR_RETURN(Json::Value());
+ return policy_manager_->GetPolicyTableData();
+}
+
+bool PolicyHandler::GetDefaultHmi(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi) const {
- POLICY_LIB_CHECK(false);
- return policy_manager_->GetDefaultHmi(policy_app_id, default_hmi);
+ POLICY_LIB_CHECK_OR_RETURN(false);
+ return policy_manager_->GetDefaultHmi(device_id, policy_app_id, default_hmi);
}
bool PolicyHandler::GetInitialAppData(const std::string& application_id,
StringArray* nicknames,
StringArray* app_hmi_types) {
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->GetInitialAppData(
application_id, nicknames, app_hmi_types);
}
void PolicyHandler::GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
POLICY_LIB_CHECK_VOID();
policy_manager_->GetUpdateUrls(service_type, out_end_points);
}
void PolicyHandler::GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
POLICY_LIB_CHECK_VOID();
policy_manager_->GetUpdateUrls(service_type, out_end_points);
}
-std::string PolicyHandler::GetLockScreenIconUrl() const {
- POLICY_LIB_CHECK(std::string(""));
- return policy_manager_->GetLockScreenIconUrl();
+std::string PolicyHandler::GetLockScreenIconUrl(
+ const std::string& policy_app_id) const {
+ const std::string default_url;
+ POLICY_LIB_CHECK_OR_RETURN(default_url);
+
+ EndpointUrls endpoints;
+ policy_manager_->GetUpdateUrls("lock_screen_icon_url", endpoints);
+
+ auto it_specific =
+ std::find_if(endpoints.begin(),
+ endpoints.end(),
+ [&policy_app_id](const EndpointData& endpoint) {
+ return endpoint.app_id == policy_app_id;
+ });
+
+ if (endpoints.end() != it_specific && !it_specific->url.empty()) {
+ LOG4CXX_DEBUG(logger_,
+ "Specific app URL will be used for " << policy_app_id);
+ return it_specific->url.front();
+ }
+
+ auto it_default = std::find_if(
+ endpoints.begin(), endpoints.end(), [](const EndpointData& endpoint) {
+ return endpoint.app_id == kDefaultId;
+ });
+
+ if (endpoints.end() != it_default && !it_default->url.empty()) {
+ LOG4CXX_DEBUG(logger_, "Default URL will be used for " << policy_app_id);
+ return it_default->url.front();
+ }
+
+ LOG4CXX_ERROR(logger_, "Can't find URL for " << policy_app_id);
+ return std::string();
+}
+
+std::string PolicyHandler::GetIconUrl(const std::string& policy_app_id) const {
+ POLICY_LIB_CHECK_OR_RETURN(std::string(""));
+ return policy_manager_->GetIconUrl(policy_app_id);
}
uint32_t PolicyHandler::NextRetryTimeout() {
- POLICY_LIB_CHECK(0);
+ POLICY_LIB_CHECK_OR_RETURN(0);
LOG4CXX_AUTO_TRACE(logger_);
return policy_manager_->NextRetryTimeout();
}
uint32_t PolicyHandler::TimeoutExchangeSec() const {
- return TimeoutExchangeMSec() / date_time::DateTime::MILLISECONDS_IN_SECOND;
+ return TimeoutExchangeMSec() / date_time::MILLISECONDS_IN_SECOND;
}
uint32_t PolicyHandler::TimeoutExchangeMSec() const {
- POLICY_LIB_CHECK(0);
+ POLICY_LIB_CHECK_OR_RETURN(0);
return policy_manager_->TimeoutExchangeMSec();
}
void PolicyHandler::OnExceededTimeout() {
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
+
+ std::for_each(listeners_.begin(),
+ listeners_.end(),
+ std::mem_fn(&PolicyHandlerObserver::OnPTUTimeoutExceeded));
+
policy_manager_->OnExceededTimeout();
}
-void PolicyHandler::OnSystemReady() {
- POLICY_LIB_CHECK_VOID();
- policy_manager_->OnSystemReady();
+const boost::optional<bool> PolicyHandler::LockScreenDismissalEnabledState()
+ const {
+ POLICY_LIB_CHECK_OR_RETURN(boost::optional<bool>());
+ return policy_manager_->LockScreenDismissalEnabledState();
+}
+
+const boost::optional<std::string>
+PolicyHandler::LockScreenDismissalWarningMessage(
+ const std::string& language) const {
+ POLICY_LIB_CHECK_OR_RETURN(boost::optional<std::string>());
+ return policy_manager_->LockScreenDismissalWarningMessage(language);
}
void PolicyHandler::PTUpdatedAt(Counters counter, int value) {
@@ -1632,7 +1888,7 @@ void PolicyHandler::remove_listener(PolicyHandlerObserver* listener) {
listeners_.remove(listener);
}
-utils::SharedPtr<usage_statistics::StatisticsManager>
+std::shared_ptr<usage_statistics::StatisticsManager>
PolicyHandler::GetStatisticManager() const {
return statistic_manager_impl_;
}
@@ -1674,10 +1930,10 @@ custom_str::CustomString PolicyHandler::GetAppName(
ApplicationSharedPtr app =
application_manager_.application_by_policy_id(policy_app_id);
- if (!app.valid()) {
+ if (app.use_count() == 0) {
LOG4CXX_WARN(
logger_,
- "Connection_key not found for application_id:" << policy_app_id);
+ "Connection_key not found for application_id: " << policy_app_id);
return custom_str::CustomString("");
}
return app->name();
@@ -1707,9 +1963,9 @@ void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) {
const bool is_written = file_system::Write(
file_name,
std::vector<uint8_t>(certificate_data.begin(), certificate_data.end()));
- LOG4CXX_DEBUG(logger_,
- "Saving encrypted certificate data: \"" << certificate_data
- << '"');
+ LOG4CXX_DEBUG(
+ logger_,
+ "Saving encrypted certificate data: \"" << certificate_data << '"');
if (!is_written) {
LOG4CXX_ERROR(logger_,
"Unable to save encrypted certificate to file " << file_name);
@@ -1747,6 +2003,7 @@ void PolicyHandler::OnCertificateDecrypted(bool is_succeeded) {
if (!is_succeeded) {
LOG4CXX_ERROR(logger_, "Couldn't delete file " << file_name);
+ ProcessCertDecryptFailed();
return;
}
@@ -1756,9 +2013,9 @@ void PolicyHandler::OnCertificateDecrypted(bool is_succeeded) {
"Unable to read certificate from file " << file_name);
return;
}
- LOG4CXX_DEBUG(logger_,
- "Loaded decrypted certificate data: \"" << certificate_data
- << '"');
+ LOG4CXX_DEBUG(
+ logger_,
+ "Loaded decrypted certificate data: \"" << certificate_data << '"');
policy_manager_->SetDecryptedCertificate(certificate_data);
@@ -1769,6 +2026,18 @@ void PolicyHandler::OnCertificateDecrypted(bool is_succeeded) {
std::bind2nd(std::mem_fun(&PolicyHandlerObserver::OnCertificateUpdated),
certificate_data));
}
+
+void PolicyHandler::ProcessCertDecryptFailed() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(listeners_lock_);
+
+ std::for_each(
+ listeners_.begin(),
+ listeners_.end(),
+ std::bind2nd(std::mem_fn(&PolicyHandlerObserver::OnCertDecryptFinished),
+ false));
+}
+
#else // EXTERNAL_PROPRIETARY_MODE
void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1781,10 +2050,23 @@ void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) {
}
#endif // EXTERNAL_PROPRIETARY_MODE
+void PolicyHandler::OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(listeners_lock_);
+ HandlersCollection::const_iterator it = listeners_.begin();
+ for (; it != listeners_.end(); ++it) {
+ PolicyHandlerObserver* observer = *it;
+ observer->OnAuthTokenUpdated(policy_app_id, auth_token);
+ }
+}
+
void PolicyHandler::OnPTUFinished(const bool ptu_result) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(listeners_lock_);
+ PopAppIdFromPTUQueue();
+
std::for_each(
listeners_.begin(),
listeners_.end(),
@@ -1816,7 +2098,7 @@ void PolicyHandler::RemoveDevice(const std::string& device_id) {
bool PolicyHandler::IsApplicationRevoked(const std::string& app_id) {
LOG4CXX_AUTO_TRACE(logger_);
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->IsApplicationRevoked(app_id);
}
@@ -1828,12 +2110,12 @@ void PolicyHandler::OnUpdateRequestSentToMobile() {
}
bool PolicyHandler::CheckKeepContext(const std::string& policy_app_id) const {
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->CanAppKeepContext(policy_app_id);
}
bool PolicyHandler::CheckStealFocus(const std::string& policy_app_id) const {
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->CanAppStealFocus(policy_app_id);
}
@@ -1856,14 +2138,370 @@ bool PolicyHandler::CheckSystemAction(
return false;
}
+std::vector<std::string> PolicyHandler::GetApplicationPolicyIDs() const {
+ POLICY_LIB_CHECK_OR_RETURN(std::vector<std::string>());
+ const auto all_policy_ids = policy_manager_->GetApplicationPolicyIDs();
+ std::vector<std::string> policy_app_ids;
+
+ std::copy_if(
+ all_policy_ids.begin(),
+ all_policy_ids.end(),
+ std::back_inserter(policy_app_ids),
+ [](std::string id) {
+ return helpers::Compare<std::string, helpers::NEQ, helpers::ALL>(
+ id, kDefaultId, kPreDataConsentId, kDeviceId);
+ });
+
+ return policy_app_ids;
+}
+
+void PolicyHandler::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->GetEnabledCloudApps(enabled_apps);
+}
+
+bool PolicyHandler::GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const {
+ POLICY_LIB_CHECK_OR_RETURN(false);
+ return policy_manager_->GetAppProperties(policy_app_id, out_app_properties);
+}
+
+std::vector<std::string> PolicyHandler::GetEnabledLocalApps() const {
+ POLICY_LIB_CHECK_OR_RETURN(std::vector<std::string>());
+ return policy_manager_->GetEnabledLocalApps();
+}
+
+const bool PolicyHandler::CheckCloudAppEnabled(
+ const std::string& policy_app_id) const {
+ POLICY_LIB_CHECK_OR_RETURN(false);
+ AppProperties out_app_properties;
+ policy_manager_->GetAppProperties(policy_app_id, out_app_properties);
+ return out_app_properties.enabled;
+}
+
+PolicyHandler::AppPropertiesState PolicyHandler::GetAppPropertiesStatus(
+ const smart_objects::SmartObject& properties,
+ const std::string& app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ POLICY_LIB_CHECK_OR_RETURN(AppPropertiesState::NO_CHANGES);
+
+ AppProperties app_properties;
+ policy_manager_->GetAppProperties(app_id, app_properties);
+
+ policy::StringArray nicknames;
+ policy::StringArray app_hmi_types;
+ policy_manager_->GetInitialAppData(app_id, &nicknames, &app_hmi_types);
+
+ if (properties.keyExists(strings::enabled) &&
+ app_properties.enabled != properties[strings::enabled].asBool()) {
+ LOG4CXX_DEBUG(logger_,
+ "\"enabled\" was changed from: "
+ << app_properties.enabled
+ << " to: " << properties[strings::enabled].asBool());
+ return AppPropertiesState::ENABLED_FLAG_SWITCH;
+ }
+ if (properties.keyExists(strings::auth_token) &&
+ app_properties.auth_token != properties[strings::auth_token].asString()) {
+ LOG4CXX_DEBUG(logger_,
+ "\"auth_token\" was changed from: "
+ << app_properties.auth_token
+ << " to: " << properties[strings::auth_token].asString());
+ return AppPropertiesState::AUTH_TOKEN_CHANGED;
+ }
+ if (properties.keyExists(strings::transport_type) &&
+ app_properties.transport_type !=
+ properties[strings::transport_type].asString()) {
+ LOG4CXX_DEBUG(logger_,
+ "\"transport_type\" was changed from: "
+ << app_properties.transport_type << " to: "
+ << properties[strings::transport_type].asString());
+ return AppPropertiesState::TRANSPORT_TYPE_CHANGED;
+ }
+
+ if (properties.keyExists(strings::cloud_transport_type) &&
+ app_properties.transport_type !=
+ properties[strings::cloud_transport_type].asString()) {
+ LOG4CXX_DEBUG(logger_,
+ "\"transport_type\" was changed from: "
+ << app_properties.transport_type << " to: "
+ << properties[strings::cloud_transport_type].asString());
+ return AppPropertiesState::TRANSPORT_TYPE_CHANGED;
+ }
+
+ if (properties.keyExists(strings::endpoint) &&
+ app_properties.endpoint != properties[strings::endpoint].asString()) {
+ LOG4CXX_DEBUG(logger_,
+ "\"endpoint\" was changed from: "
+ << app_properties.endpoint
+ << " to: " << properties[strings::endpoint].asString());
+ return AppPropertiesState::ENDPOINT_CHANGED;
+ }
+ if (properties.keyExists(strings::nicknames)) {
+ const smart_objects::SmartArray* nicknames_array =
+ properties[strings::nicknames].asArray();
+
+ if (nicknames_array->size() != nicknames.size()) {
+ return AppPropertiesState::NICKNAMES_CHANGED;
+ }
+
+ smart_objects::SmartArray::const_iterator it_begin =
+ nicknames_array->begin();
+ smart_objects::SmartArray::const_iterator it_end = nicknames_array->end();
+ for (; it_begin != it_end; ++it_begin) {
+ const auto result =
+ std::find(nicknames.begin(), nicknames.end(), (*it_begin).asString());
+ if (nicknames.end() == result) {
+ LOG4CXX_DEBUG(logger_,
+ "\"nicknames\" were changed, new value: "
+ << (*it_begin).asString());
+ return AppPropertiesState::NICKNAMES_CHANGED;
+ }
+ }
+ }
+ if (properties.keyExists(strings::hybrid_app_preference)) {
+ auto value = static_cast<mobile_apis::HybridAppPreference::eType>(
+ properties[strings::hybrid_app_preference].asUInt());
+ std::string hybrid_app_preference_str;
+ smart_objects::EnumConversionHelper<
+ mobile_apis::HybridAppPreference::eType>::
+ EnumToString(value, &hybrid_app_preference_str);
+ if (app_properties.hybrid_app_preference != hybrid_app_preference_str) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "\"hybrid_app_preference\" was changed from: "
+ << app_properties.hybrid_app_preference << " to: "
+ << properties[strings::hybrid_app_preference].asString());
+ return AppPropertiesState::HYBRYD_APP_PROPERTIES_CHANGED;
+ }
+ }
+ return AppPropertiesState::NO_CHANGES;
+}
+
+bool PolicyHandler::IsNewApplication(const std::string& policy_app_id) const {
+ POLICY_LIB_CHECK_OR_RETURN(false);
+ return policy_manager_->IsNewApplication(policy_app_id);
+}
+
+void PolicyHandler::OnSetAppProperties(
+ const smart_objects::SmartObject& properties) {
+ POLICY_LIB_CHECK_VOID();
+
+ const auto policy_app_id(properties[strings::policy_app_id].asString());
+ policy_manager_->InitCloudApp(policy_app_id);
+
+ bool auth_token_update = false;
+ if (properties.keyExists(strings::enabled)) {
+ const bool enabled = properties[strings::enabled].asBool();
+ policy_manager_->SetCloudAppEnabled(policy_app_id, enabled);
+ }
+ if (properties.keyExists(strings::auth_token)) {
+ const std::string auth_token = properties[strings::auth_token].asString();
+ policy_manager_->SetAppAuthToken(policy_app_id, auth_token);
+ auth_token_update = true;
+ }
+ if (properties.keyExists(strings::transport_type)) {
+ policy_manager_->SetAppCloudTransportType(
+ policy_app_id, properties[strings::transport_type].asString());
+ }
+ if (properties.keyExists(strings::endpoint)) {
+ policy_manager_->SetAppEndpoint(policy_app_id,
+ properties[strings::endpoint].asString());
+ }
+ if (properties.keyExists(strings::nicknames)) {
+ StringArray nicknames;
+ const smart_objects::SmartObject& nicknames_array =
+ properties[strings::nicknames];
+ for (size_t i = 0; i < nicknames_array.length(); ++i) {
+ nicknames.push_back(nicknames_array[i].asString());
+ }
+ policy_manager_->SetAppNicknames(policy_app_id, nicknames);
+ }
+ if (properties.keyExists(strings::hybrid_app_preference)) {
+ std::string hybrid_app_preference;
+
+ auto value = static_cast<mobile_apis::HybridAppPreference::eType>(
+ properties[strings::hybrid_app_preference].asUInt());
+ smart_objects::EnumConversionHelper<
+ mobile_apis::HybridAppPreference::eType>::
+ EnumToString(value, &hybrid_app_preference);
+ policy_manager_->SetHybridAppPreference(policy_app_id,
+ hybrid_app_preference);
+ }
+
+ if (auth_token_update) {
+ AppProperties app_properties;
+ if (policy_manager_->GetAppProperties(policy_app_id, app_properties)) {
+ OnAuthTokenUpdated(policy_app_id, app_properties.auth_token);
+ }
+ }
+}
+
+void PolicyHandler::OnLocalAppAdded() {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->OnLocalAppAdded();
+}
+
+void PolicyHandler::OnSetCloudAppProperties(
+ const smart_objects::SmartObject& message) {
+ POLICY_LIB_CHECK_VOID();
+ if (!message.keyExists(strings::msg_params)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Message does not contain mandatory section " << strings::msg_params);
+ return;
+ }
+ if (!message[strings::msg_params].keyExists(strings::properties)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Message does not contain app properties " << strings::msg_params);
+ return;
+ }
+
+ const smart_objects::SmartObject& properties =
+ message[strings::msg_params][strings::properties];
+ if (!properties.keyExists(strings::app_id)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Message does not contain mandatory parameter " << strings::app_id);
+ return;
+ }
+ std::string policy_app_id(properties[strings::app_id].asString());
+
+ policy_manager_->InitCloudApp(policy_app_id);
+
+ bool auth_token_update = false;
+ if (properties.keyExists(strings::enabled)) {
+ bool enabled = properties[strings::enabled].asBool();
+ policy_manager_->SetCloudAppEnabled(policy_app_id, enabled);
+ auth_token_update = enabled;
+ application_manager_.RefreshCloudAppInformation();
+ }
+ if (properties.keyExists(strings::auth_token)) {
+ std::string auth_token = properties[strings::auth_token].asString();
+ policy_manager_->SetAppAuthToken(policy_app_id, auth_token);
+ auth_token_update = true;
+ }
+ if (properties.keyExists(strings::cloud_transport_type)) {
+ policy_manager_->SetAppCloudTransportType(
+ policy_app_id, properties[strings::cloud_transport_type].asString());
+ }
+ if (properties.keyExists(strings::endpoint)) {
+ policy_manager_->SetAppEndpoint(policy_app_id,
+ properties[strings::endpoint].asString());
+ }
+ if (properties.keyExists(strings::nicknames)) {
+ StringArray nicknames;
+ const smart_objects::SmartObject& nicknames_array =
+ properties[strings::nicknames];
+ for (size_t i = 0; i < nicknames_array.length(); ++i) {
+ nicknames.push_back(nicknames_array[i].asString());
+ }
+ policy_manager_->SetAppNicknames(policy_app_id, nicknames);
+ }
+ if (properties.keyExists(strings::hybrid_app_preference)) {
+ std::string hybrid_app_preference;
+
+ auto value = static_cast<mobile_apis::HybridAppPreference::eType>(
+ properties[strings::hybrid_app_preference].asUInt());
+ smart_objects::EnumConversionHelper<
+ mobile_apis::HybridAppPreference::eType>::
+ EnumToString(value, &hybrid_app_preference);
+ policy_manager_->SetHybridAppPreference(policy_app_id,
+ hybrid_app_preference);
+ }
+
+ if (auth_token_update) {
+ AppProperties app_properties;
+
+ policy_manager_->GetAppProperties(policy_app_id, app_properties);
+ OnAuthTokenUpdated(policy_app_id, app_properties.auth_token);
+ }
+}
+
+void PolicyHandler::GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->GetAppServiceParameters(policy_app_id,
+ app_service_parameters);
+}
+
+bool PolicyHandler::CheckAppServiceParameters(
+ const std::string& policy_app_id,
+ const std::string& requested_service_name,
+ const std::string& requested_service_type,
+ smart_objects::SmartArray* requested_handled_rpcs) const {
+ std::string service_name = std::string();
+ std::string service_type = std::string();
+ std::vector<int32_t> handled_rpcs = {};
+
+ policy_table::AppServiceParameters app_service_parameters =
+ policy_table::AppServiceParameters();
+ this->GetAppServiceParameters(policy_app_id, &app_service_parameters);
+
+ if (app_service_parameters.find(requested_service_type) ==
+ app_service_parameters.end()) {
+ LOG4CXX_DEBUG(logger_,
+ "Disallowed service type: " << requested_service_type);
+ return false;
+ }
+
+ auto service_names =
+ *(app_service_parameters[requested_service_type].service_names);
+ if (!service_names.is_initialized()) {
+ LOG4CXX_DEBUG(logger_,
+ "Pt Service Name is Null, All service names accepted");
+ } else if (!requested_service_name.empty()) {
+ auto find_name_result =
+ std::find(service_names.begin(),
+ service_names.end(),
+ rpc::String<0, 255>(requested_service_name));
+ if (find_name_result == service_names.end()) {
+ LOG4CXX_DEBUG(logger_,
+ "Disallowed service name: " << requested_service_name);
+ return false;
+ }
+ }
+
+ if (requested_handled_rpcs) {
+ auto temp_rpcs =
+ app_service_parameters[requested_service_type].handled_rpcs;
+ for (auto handled_it = temp_rpcs.begin(); handled_it != temp_rpcs.end();
+ ++handled_it) {
+ handled_rpcs.push_back(handled_it->function_id);
+ }
+
+ for (auto requested_it = requested_handled_rpcs->begin();
+ requested_it != requested_handled_rpcs->end();
+ ++requested_it) {
+ auto find_result = std::find(
+ handled_rpcs.begin(), handled_rpcs.end(), requested_it->asInt());
+ if (find_result == handled_rpcs.end()) {
+ LOG4CXX_DEBUG(logger_,
+ "Disallowed by handled rpc: " << requested_it->asInt());
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+bool PolicyHandler::UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ POLICY_LIB_CHECK_OR_RETURN(false);
+ return policy_manager_->UnknownRPCPassthroughAllowed(policy_app_id);
+}
+
uint32_t PolicyHandler::HeartBeatTimeout(const std::string& app_id) const {
- POLICY_LIB_CHECK(0);
+ POLICY_LIB_CHECK_OR_RETURN(0);
return policy_manager_->HeartBeatTimeout(app_id);
}
const std::string PolicyHandler::RemoteAppsUrl() const {
const std::string default_url;
- POLICY_LIB_CHECK(default_url);
+ POLICY_LIB_CHECK_OR_RETURN(default_url);
EndpointUrls endpoints;
policy_manager_->GetUpdateUrls("queryAppsUrl", endpoints);
if (endpoints.empty() || endpoints[0].url.empty()) {
@@ -1874,39 +2512,51 @@ const std::string PolicyHandler::RemoteAppsUrl() const {
}
void PolicyHandler::OnAppsSearchStarted() {
- POLICY_LIB_CHECK();
+ POLICY_LIB_CHECK_VOID();
policy_manager_->OnAppsSearchStarted();
}
void PolicyHandler::OnAppsSearchCompleted(const bool trigger_ptu) {
- POLICY_LIB_CHECK();
+ POLICY_LIB_CHECK_VOID();
policy_manager_->OnAppsSearchCompleted(trigger_ptu);
}
-void PolicyHandler::OnAppRegisteredOnMobile(const std::string& application_id) {
+void PolicyHandler::OnAddedNewApplicationToAppList(
+ const uint32_t new_app_id, const std::string& policy_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (policy_id == last_registered_policy_app_id_) {
+ return;
+ }
+ last_registered_policy_app_id_ = policy_id;
+ PushAppIdToPTUQueue(new_app_id);
+}
+
+void PolicyHandler::OnAppRegisteredOnMobile(const std::string& device_id,
+ const std::string& application_id) {
POLICY_LIB_CHECK_VOID();
- policy_manager_->OnAppRegisteredOnMobile(application_id);
+ policy_manager_->OnAppRegisteredOnMobile(device_id, application_id);
}
RequestType::State PolicyHandler::GetAppRequestTypeState(
const std::string& policy_app_id) const {
- POLICY_LIB_CHECK(RequestType::State::UNAVAILABLE);
+ POLICY_LIB_CHECK_OR_RETURN(RequestType::State::UNAVAILABLE);
return policy_manager_->GetAppRequestTypesState(policy_app_id);
}
RequestSubType::State PolicyHandler::GetAppRequestSubTypeState(
const std::string& policy_app_id) const {
- POLICY_LIB_CHECK(RequestSubType::State::UNAVAILABLE);
+ POLICY_LIB_CHECK_OR_RETURN(RequestSubType::State::UNAVAILABLE);
return policy_manager_->GetAppRequestSubTypesState(policy_app_id);
}
bool PolicyHandler::IsRequestTypeAllowed(
+ const transport_manager::DeviceHandle& device_id,
const std::string& policy_app_id,
mobile_apis::RequestType::eType type) const {
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
using namespace mobile_apis;
- std::string stringified_type = RequestTypeToString(type);
+ const std::string stringified_type = RequestTypeToString(type);
if (stringified_type.empty()) {
LOG4CXX_ERROR(logger_, "Unknown request type.");
return false;
@@ -1929,7 +2579,11 @@ bool PolicyHandler::IsRequestTypeAllowed(
case RequestType::State::AVAILABLE: {
// If any of request types is available for current application - get them
const auto request_types =
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ policy_manager_->GetAppRequestTypes(device_id, policy_app_id);
+#else
policy_manager_->GetAppRequestTypes(policy_app_id);
+#endif
return helpers::in_range(request_types, stringified_type);
}
default:
@@ -1940,7 +2594,7 @@ bool PolicyHandler::IsRequestTypeAllowed(
bool PolicyHandler::IsRequestSubTypeAllowed(
const std::string& policy_app_id,
const std::string& request_subtype) const {
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
using namespace mobile_apis;
if (request_subtype.empty()) {
@@ -1975,70 +2629,94 @@ bool PolicyHandler::IsRequestSubTypeAllowed(
}
const std::vector<std::string> PolicyHandler::GetAppRequestTypes(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) const {
- POLICY_LIB_CHECK(std::vector<std::string>());
+ POLICY_LIB_CHECK_OR_RETURN(std::vector<std::string>());
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ return policy_manager_->GetAppRequestTypes(device_handle, policy_app_id);
+#else
return policy_manager_->GetAppRequestTypes(policy_app_id);
+#endif
}
const std::vector<std::string> PolicyHandler::GetAppRequestSubTypes(
const std::string& policy_app_id) const {
- POLICY_LIB_CHECK(std::vector<std::string>());
+ POLICY_LIB_CHECK_OR_RETURN(std::vector<std::string>());
return policy_manager_->GetAppRequestSubTypes(policy_app_id);
}
-const VehicleInfo policy::PolicyHandler::GetVehicleInfo() const {
- POLICY_LIB_CHECK(VehicleInfo());
- return policy_manager_->GetVehicleInfo();
+const std::vector<policy_table::VehicleDataItem>
+policy::PolicyHandler::GetVehicleDataItems() const {
+ POLICY_LIB_CHECK_OR_RETURN(std::vector<policy_table::VehicleDataItem>());
+ return policy_manager_->GetVehicleDataItems();
+}
+
+std::vector<rpc::policy_table_interface_base::VehicleDataItem>
+policy::PolicyHandler::GetRemovedVehicleDataItems() const {
+ POLICY_LIB_CHECK_OR_RETURN(std::vector<policy_table::VehicleDataItem>());
+ return policy_manager_->GetRemovedVehicleDataItems();
}
#ifdef EXTERNAL_PROPRIETARY_MODE
const MetaInfo PolicyHandler::GetMetaInfo() const {
- POLICY_LIB_CHECK(MetaInfo());
+ POLICY_LIB_CHECK_OR_RETURN(MetaInfo());
return policy_manager_->GetMetaInfo();
}
#endif // EXTERNAL_PROPRIETARY_MODE
void PolicyHandler::Increment(usage_statistics::GlobalCounterId type) {
- POLICY_LIB_CHECK();
+ POLICY_LIB_CHECK_VOID();
policy_manager_->Increment(type);
}
void PolicyHandler::Increment(const std::string& app_id,
usage_statistics::AppCounterId type) {
- POLICY_LIB_CHECK();
+ POLICY_LIB_CHECK_VOID();
policy_manager_->Increment(app_id, type);
}
void PolicyHandler::Set(const std::string& app_id,
usage_statistics::AppInfoId type,
const std::string& value) {
- POLICY_LIB_CHECK();
+ POLICY_LIB_CHECK_VOID();
policy_manager_->Set(app_id, type, value);
}
void PolicyHandler::Add(const std::string& app_id,
usage_statistics::AppStopwatchId type,
int32_t timespan_seconds) {
- POLICY_LIB_CHECK();
+ POLICY_LIB_CHECK_VOID();
policy_manager_->Add(app_id, type, timespan_seconds);
}
-bool PolicyHandler::IsUrlAppIdValid(const uint32_t app_idx,
- const EndpointUrls& urls) const {
- const EndpointData& app_data = urls[app_idx];
+bool PolicyHandler::IsUrlAppIdValid(const std::string app_id,
+ const EndpointData& app_data) const {
+ if (policy::kDefaultId == app_data.app_id) {
+ return true;
+ }
+
const std::vector<std::string> app_urls = app_data.url;
- const ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(app_data.app_id);
+ if (app_urls.empty() || app_id != app_data.app_id) {
+ return false;
+ }
- const bool is_registered = (app && (app->IsRegistered()));
- const bool is_default = (app_data.app_id == policy::kDefaultId);
- const bool is_empty_urls = app_urls.empty();
+ const auto devices_ids = GetDevicesIds(app_id);
+ LOG4CXX_TRACE(
+ logger_,
+ "Count devices: " << devices_ids.size() << " for app_id: " << app_id);
+ for (const auto& device_id : devices_ids) {
+ const ApplicationSharedPtr app =
+ application_manager_.application(device_id, app_id);
+ if (app && (app->IsRegistered())) {
+ return true;
+ }
+ }
- return ((is_registered && !is_empty_urls) || is_default);
+ return false;
}
std::vector<std::string> PolicyHandler::GetDevicesIds(
- const std::string& policy_app_id) {
+ const std::string& policy_app_id) const {
return application_manager_.devices(policy_app_id);
}
@@ -2046,7 +2724,8 @@ void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app,
mobile_apis::HMILevel::eType level) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- if (app->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
+ if (app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_apis::HMILevel::HMI_NONE) {
// If default is FULL, send request to HMI. Notification to mobile will be
// sent on response receiving.
if (mobile_apis::HMILevel::HMI_FULL == level) {
@@ -2058,14 +2737,17 @@ void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app,
// Set application hmi level
application_manager_.ChangeAppsHMILevel(app->app_id(), level);
// If hmi Level is full, it will be seted after ActivateApp response
- MessageHelper::SendHMIStatusNotification(*app, application_manager_);
+ MessageHelper::SendHMIStatusNotification(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ application_manager_);
}
}
}
bool PolicyHandler::CheckModule(const PTString& app_id,
const PTString& module) {
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->CheckModule(app_id, module);
}
@@ -2082,17 +2764,17 @@ void PolicyHandler::OnUpdateHMIStatus(const std::string& device_id,
ApplicationSharedPtr app =
application_manager_.application(device_id, policy_app_id);
if (!app) {
- LOG4CXX_WARN(logger_,
- "Could not find application: " << device_id << " - "
- << policy_app_id);
+ LOG4CXX_WARN(
+ logger_,
+ "Could not find application: " << device_id << " - " << policy_app_id);
return;
}
mobile_apis::HMILevel::eType level =
MessageHelper::StringToHMILevel(hmi_level);
if (mobile_apis::HMILevel::INVALID_ENUM == level) {
- LOG4CXX_WARN(logger_,
- "Couldn't convert default hmi level " << hmi_level
- << " to enum.");
+ LOG4CXX_WARN(
+ logger_,
+ "Couldn't convert default hmi level " << hmi_level << " to enum.");
return;
}
@@ -2101,17 +2783,21 @@ void PolicyHandler::OnUpdateHMIStatus(const std::string& device_id,
<< app->app_id() << " to default hmi level " << level);
// Set application hmi level
application_manager_.ChangeAppsHMILevel(app->app_id(), level);
- MessageHelper::SendHMIStatusNotification(*app, application_manager_);
+ MessageHelper::SendHMIStatusNotification(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ application_manager_);
}
bool PolicyHandler::GetModuleTypes(const std::string& policy_app_id,
std::vector<std::string>* modules) const {
LOG4CXX_AUTO_TRACE(logger_);
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
return policy_manager_->GetModuleTypes(policy_app_id, modules);
}
void PolicyHandler::SetDefaultHmiTypes(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& application_id,
const smart_objects::SmartObject* app_types) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -2124,14 +2810,14 @@ void PolicyHandler::SetDefaultHmiTypes(
std::back_inserter(hmi_types),
SmartObjectToInt());
}
- policy_manager_->SetDefaultHmiTypes(application_id, hmi_types);
+ policy_manager_->SetDefaultHmiTypes(device_handle, application_id, hmi_types);
}
bool PolicyHandler::CheckHMIType(const std::string& application_id,
mobile_apis::AppHMIType::eType hmi,
const smart_objects::SmartObject* app_types) {
LOG4CXX_AUTO_TRACE(logger_);
- POLICY_LIB_CHECK(false);
+ POLICY_LIB_CHECK_OR_RETURN(false);
std::vector<int> policy_hmi_types;
bool ret = policy_manager_->GetHMITypes(application_id, &policy_hmi_types);
@@ -2155,17 +2841,17 @@ void PolicyHandler::OnUpdateHMILevel(const std::string& device_id,
ApplicationSharedPtr app =
application_manager_.application(device_id, policy_app_id);
if (!app) {
- LOG4CXX_WARN(logger_,
- "Could not find application: " << device_id << " - "
- << policy_app_id);
+ LOG4CXX_WARN(
+ logger_,
+ "Could not find application: " << device_id << " - " << policy_app_id);
return;
}
mobile_apis::HMILevel::eType level =
MessageHelper::StringToHMILevel(hmi_level);
if (mobile_apis::HMILevel::INVALID_ENUM == level) {
- LOG4CXX_WARN(logger_,
- "Couldn't convert default hmi level " << hmi_level
- << " to enum.");
+ LOG4CXX_WARN(
+ logger_,
+ "Couldn't convert default hmi level " << hmi_level << " to enum.");
return;
}
UpdateHMILevel(app, level);
diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc
index e052e347f0..eaebaf4861 100644
--- a/src/components/application_manager/src/request_controller.cc
+++ b/src/components/application_manager/src/request_controller.cc
@@ -32,10 +32,10 @@
#include "utils/logger.h"
-#include "application_manager/request_controller.h"
#include "application_manager/commands/command_request_impl.h"
#include "application_manager/commands/request_to_hmi.h"
-#include "utils/make_shared.h"
+#include "application_manager/request_controller.h"
+
#include "utils/timer_task_impl.h"
namespace application_manager {
@@ -126,6 +126,12 @@ RequestController::TResult RequestController::CheckPosibilitytoAdd(
return RequestController::TOO_MANY_REQUESTS;
}
+ if (IsLowVoltage()) {
+ LOG4CXX_ERROR(logger_,
+ "Impossible to add request due to Low Voltage is active");
+ return RequestController::INVALID_DATA;
+ }
+
return SUCCESS;
}
@@ -176,7 +182,7 @@ RequestController::TResult RequestController::addHMIRequest(
const RequestPtr request) {
LOG4CXX_AUTO_TRACE(logger_);
- if (!request.valid()) {
+ if (request.use_count() == 0) {
LOG4CXX_ERROR(logger_, "HMI request pointer is invalid");
return RequestController::INVALID_DATA;
}
@@ -185,13 +191,20 @@ RequestController::TResult RequestController::addHMIRequest(
const uint64_t timeout_in_mseconds =
static_cast<uint64_t>(request->default_timeout());
RequestInfoPtr request_info_ptr =
- utils::MakeShared<HMIRequestInfo>(request, timeout_in_mseconds);
+ std::make_shared<HMIRequestInfo>(request, timeout_in_mseconds);
if (0 == timeout_in_mseconds) {
LOG4CXX_DEBUG(logger_,
"Default timeout was set to 0."
"RequestController will not track timeout of this request.");
}
+
+ if (IsLowVoltage()) {
+ LOG4CXX_ERROR(logger_,
+ "Impossible to add request due to Low Voltage is active");
+ return RequestController::INVALID_DATA;
+ }
+
waiting_for_response_.Add(request_info_ptr);
LOG4CXX_DEBUG(logger_,
"Waiting for response count:" << waiting_for_response_.Size());
@@ -202,6 +215,11 @@ RequestController::TResult RequestController::addHMIRequest(
void RequestController::addNotification(const RequestPtr ptr) {
LOG4CXX_AUTO_TRACE(logger_);
+ if (IsLowVoltage()) {
+ LOG4CXX_ERROR(
+ logger_, "Impossible to add notification due to Low Voltage is active");
+ return;
+ }
notification_list_.push_back(ptr);
}
@@ -274,7 +292,7 @@ void RequestController::OnMobileResponse(const uint32_t mobile_correlation_id,
void RequestController::OnHMIResponse(const uint32_t correlation_id,
const int32_t function_id) {
LOG4CXX_AUTO_TRACE(logger_);
- TerminateRequest(correlation_id, RequestInfo::HmiConnectoinKey, function_id);
+ TerminateRequest(correlation_id, RequestInfo::HmiConnectionKey, function_id);
}
void RequestController::terminateWaitingForExecutionAppRequests(
@@ -287,7 +305,7 @@ void RequestController::terminateWaitingForExecutionAppRequests(
std::list<RequestPtr>::iterator request_it = mobile_request_list_.begin();
while (mobile_request_list_.end() != request_it) {
RequestPtr request = (*request_it);
- if ((request.valid()) && (request->connection_key() == app_id)) {
+ if ((request.use_count() != 0) && (request->connection_key() == app_id)) {
mobile_request_list_.erase(request_it++);
} else {
++request_it;
@@ -321,7 +339,7 @@ void RequestController::terminateAppRequests(const uint32_t& app_id) {
void RequestController::terminateAllHMIRequests() {
LOG4CXX_AUTO_TRACE(logger_);
- terminateWaitingForResponseAppRequests(RequestInfo::HmiConnectoinKey);
+ terminateWaitingForResponseAppRequests(RequestInfo::HmiConnectionKey);
}
void RequestController::terminateAllMobileRequests() {
@@ -401,17 +419,17 @@ void RequestController::TimeoutThread() {
LOG4CXX_DEBUG(logger_,
"Timeout for "
<< (RequestInfo::HMIRequest ==
- probably_expired->requst_type()
+ probably_expired->request_type()
? "HMI"
: "Mobile")
<< " request id: " << probably_expired->requestId()
<< " connection_key: " << probably_expired->app_id()
<< " NOT expired");
- const TimevalStruct current_time = date_time::DateTime::getCurrentTime();
- const TimevalStruct end_time = probably_expired->end_time();
+ const date_time::TimeDuration current_time = date_time::getCurrentTime();
+ const date_time::TimeDuration end_time = probably_expired->end_time();
if (current_time < end_time) {
- const uint32_t msecs = static_cast<uint32_t>(
- date_time::DateTime::getmSecs(end_time - current_time));
+ const uint32_t msecs =
+ static_cast<uint32_t>(date_time::getmSecs(end_time - current_time));
LOG4CXX_DEBUG(logger_, "Sleep for " << msecs << " millisecs");
timer_condition_.WaitFor(auto_lock, msecs);
}
@@ -420,7 +438,7 @@ void RequestController::TimeoutThread() {
LOG4CXX_INFO(logger_,
"Timeout for "
<< (RequestInfo::HMIRequest ==
- probably_expired->requst_type()
+ probably_expired->request_type()
? "HMI"
: "Mobile")
<< " request id: " << probably_expired->requestId()
@@ -430,7 +448,7 @@ void RequestController::TimeoutThread() {
const uint32_t experied_app_id = probably_expired->app_id();
probably_expired->request()->onTimeOut();
- if (RequestInfo::HmiConnectoinKey == probably_expired->app_id()) {
+ if (RequestInfo::HmiConnectionKey == probably_expired->app_id()) {
LOG4CXX_DEBUG(logger_,
"Erase HMI request: " << probably_expired->requestId());
waiting_for_response_.RemoveRequest(probably_expired);
@@ -488,7 +506,7 @@ void RequestController::Worker::threadMain() {
const uint32_t timeout_in_mseconds = request_ptr->default_timeout();
RequestInfoPtr request_info_ptr =
- utils::MakeShared<MobileRequestInfo>(request_ptr, timeout_in_mseconds);
+ std::make_shared<MobileRequestInfo>(request_ptr, timeout_in_mseconds);
if (!request_controller_->waiting_for_response_.Add(request_info_ptr)) {
commands::CommandRequestImpl* cmd_request =
diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc
index 9a5828d939..4f1e0a8f07 100644
--- a/src/components/application_manager/src/request_info.cc
+++ b/src/components/application_manager/src/request_info.cc
@@ -42,20 +42,20 @@ namespace request_controller {
CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController")
-uint32_t RequestInfo::HmiConnectoinKey = 0;
+uint32_t RequestInfo::HmiConnectionKey = 0;
HMIRequestInfo::HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec)
: RequestInfo(request, HMIRequest, timeout_msec) {
correlation_id_ = request_->correlation_id();
- app_id_ = RequestInfo::HmiConnectoinKey;
+ app_id_ = RequestInfo::HmiConnectionKey;
}
HMIRequestInfo::HMIRequestInfo(RequestPtr request,
- const TimevalStruct& start_time,
+ const date_time::TimeDuration& start_time,
const uint64_t timeout_msec)
: RequestInfo(request, HMIRequest, start_time, timeout_msec) {
correlation_id_ = request_->correlation_id();
- app_id_ = RequestInfo::HmiConnectoinKey;
+ app_id_ = RequestInfo::HmiConnectionKey;
}
MobileRequestInfo::MobileRequestInfo(RequestPtr request,
@@ -66,7 +66,7 @@ MobileRequestInfo::MobileRequestInfo(RequestPtr request,
}
MobileRequestInfo::MobileRequestInfo(RequestPtr request,
- const TimevalStruct& start_time,
+ const date_time::TimeDuration& start_time,
const uint64_t timeout_msec)
: RequestInfo(request, MobileRequest, start_time, timeout_msec) {
correlation_id_ = request_.get()->correlation_id();
@@ -74,19 +74,19 @@ MobileRequestInfo::MobileRequestInfo(RequestPtr request,
}
RequestInfo::RequestInfo(RequestPtr request,
- const RequestInfo::RequestType requst_type,
- const TimevalStruct& start_time,
+ const RequestInfo::RequestType request_type,
+ const date_time::TimeDuration& start_time,
const uint64_t timeout_msec)
: request_(request), start_time_(start_time), timeout_msec_(timeout_msec) {
updateEndTime();
- requst_type_ = requst_type;
+ request_type_ = request_type;
correlation_id_ = request_->correlation_id();
app_id_ = request_->connection_key();
}
void application_manager::request_controller::RequestInfo::updateEndTime() {
- end_time_ = date_time::DateTime::getCurrentTime();
- date_time::DateTime::AddMilliseconds(end_time_, timeout_msec_);
+ end_time_ = date_time::getCurrentTime();
+ date_time::AddMilliseconds(end_time_, timeout_msec_);
}
void RequestInfo::updateTimeOut(const uint64_t& timeout_msec) {
@@ -95,9 +95,8 @@ void RequestInfo::updateTimeOut(const uint64_t& timeout_msec) {
}
bool RequestInfo::isExpired() {
- TimevalStruct curr_time = date_time::DateTime::getCurrentTime();
- return date_time::DateTime::getmSecs(end_time_) <=
- date_time::DateTime::getmSecs(curr_time);
+ date_time::TimeDuration curr_time = date_time::getCurrentTime();
+ return date_time::getmSecs(end_time_) <= date_time::getmSecs(curr_time);
}
uint64_t RequestInfo::hash() {
@@ -123,7 +122,7 @@ bool RequestInfoSet::Add(RequestInfoPtr request_info) {
logger_,
"Add request app_id = " << request_info->app_id()
<< "; corr_id = " << request_info->requestId());
- sync_primitives::AutoLock lock(this_lock_);
+ sync_primitives::AutoLock lock(pending_requests_lock_);
CheckSetSizes();
const std::pair<HashSortedRequestInfoSet::iterator, bool>& insert_resilt =
hash_sorted_pending_requests_.insert(request_info);
@@ -151,10 +150,10 @@ RequestInfoPtr RequestInfoSet::Find(const uint32_t connection_key,
RequestInfoPtr result;
// Request info for searching in request info set by log_n time
- utils::SharedPtr<FakeRequestInfo> request_info_for_search(
+ std::shared_ptr<FakeRequestInfo> request_info_for_search(
new FakeRequestInfo(connection_key, correlation_id));
- sync_primitives::AutoLock lock(this_lock_);
+ sync_primitives::AutoLock lock(pending_requests_lock_);
HashSortedRequestInfoSet::iterator it =
hash_sorted_pending_requests_.find(request_info_for_search);
if (it != hash_sorted_pending_requests_.end()) {
@@ -166,7 +165,7 @@ RequestInfoPtr RequestInfoSet::Find(const uint32_t connection_key,
RequestInfoPtr RequestInfoSet::Front() {
RequestInfoPtr result;
- sync_primitives::AutoLock lock(this_lock_);
+ sync_primitives::AutoLock lock(pending_requests_lock_);
TimeSortedRequestInfoSet::iterator it = time_sorted_pending_requests_.begin();
if (it != time_sorted_pending_requests_.end()) {
result = *it;
@@ -176,7 +175,7 @@ RequestInfoPtr RequestInfoSet::Front() {
RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock lock(this_lock_);
+ sync_primitives::AutoLock lock(pending_requests_lock_);
RequestInfoPtr result;
TimeSortedRequestInfoSet::iterator it = time_sorted_pending_requests_.begin();
while (it != time_sorted_pending_requests_.end()) {
@@ -220,7 +219,7 @@ bool RequestInfoSet::Erase(const RequestInfoPtr request_info) {
}
bool RequestInfoSet::RemoveRequest(const RequestInfoPtr request_info) {
- sync_primitives::AutoLock lock(this_lock_);
+ sync_primitives::AutoLock lock(pending_requests_lock_);
return Erase(request_info);
}
@@ -229,7 +228,7 @@ uint32_t RequestInfoSet::RemoveRequests(
LOG4CXX_AUTO_TRACE(logger_);
uint32_t erased = 0;
- sync_primitives::AutoLock lock(this_lock_);
+ sync_primitives::AutoLock lock(pending_requests_lock_);
HashSortedRequestInfoSet::iterator it =
std::find_if(hash_sorted_pending_requests_.begin(),
hash_sorted_pending_requests_.end(),
@@ -253,10 +252,11 @@ uint32_t RequestInfoSet::RemoveByConnectionKey(uint32_t connection_key) {
uint32_t RequestInfoSet::RemoveMobileRequests() {
LOG4CXX_AUTO_TRACE(logger_);
return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual,
- RequestInfo::HmiConnectoinKey));
+ RequestInfo::HmiConnectionKey));
}
const size_t RequestInfoSet::Size() {
+ sync_primitives::AutoLock lock(pending_requests_lock_);
CheckSetSizes();
return time_sorted_pending_requests_.size();
}
@@ -283,7 +283,7 @@ bool RequestInfoSet::AppIdCompararator::operator()(
bool RequestInfoTimeComparator::operator()(const RequestInfoPtr lhs,
const RequestInfoPtr rhs) const {
date_time::TimeCompare compare_result =
- date_time::DateTime::compareTime(lhs->end_time(), rhs->end_time());
+ date_time::compareTime(lhs->end_time(), rhs->end_time());
if (compare_result == date_time::LESS) {
return true;
} else if (compare_result == date_time::GREATER) {
diff --git a/src/components/application_manager/src/request_tracker.cc b/src/components/application_manager/src/request_tracker.cc
index 13b3d4d873..052667dc3f 100644
--- a/src/components/application_manager/src/request_tracker.cc
+++ b/src/components/application_manager/src/request_tracker.cc
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "utils/logger.h"
-#include "utils/macro.h"
#include "application_manager/request_tracker.h"
#include "application_manager/message_helper.h"
+#include "utils/logger.h"
+#include "utils/macro.h"
namespace application_manager {
@@ -77,7 +77,7 @@ bool RequestTracker::Track(const ApplicationID& app_id,
const uint32_t max_requests,
ApplicationsRequestsTracker& tracker) {
LOG4CXX_AUTO_TRACE(logger_);
- using date_time::DateTime;
+ using namespace date_time;
if (!time_scale || !max_requests) {
LOG4CXX_INFO(logger_, "Time scale request tracking is disabled.");
@@ -93,7 +93,7 @@ bool RequestTracker::Track(const ApplicationID& app_id,
if (tracker.end() == it_app) {
LOG4CXX_DEBUG(logger_, "Adding new application into tracking.");
- tracker[app_id].push_back(DateTime::getCurrentTime());
+ tracker[app_id].push_back(getCurrentTime());
return true;
}
@@ -102,25 +102,24 @@ bool RequestTracker::Track(const ApplicationID& app_id,
if (it_app->second.size() < max_requests) {
LOG4CXX_DEBUG(logger_, "Adding new request into tracking.");
- tracker[app_id].push_back(DateTime::getCurrentTime());
+ tracker[app_id].push_back(getCurrentTime());
return true;
}
LOG4CXX_DEBUG(logger_,
"Oldest request is added at: "
- << DateTime::getmSecs(it_app->second.front())
- << ". Current time is: "
- << DateTime::getmSecs(DateTime::getCurrentTime())
+ << getmSecs(it_app->second.front())
+ << ". Current time is: " << getmSecs(getCurrentTime())
<< ". Time scale is: " << time_scale);
- if (DateTime::calculateTimeSpan(it_app->second.front()) > time_scale) {
+ if (calculateTimeSpan(it_app->second.front()) > time_scale) {
LOG4CXX_DEBUG(logger_, "Dropping oldest request, adding new one.");
ApplicationsRequestsTracker::mapped_type& times = tracker[app_id];
DCHECK_OR_RETURN(!times.empty(), false);
times.erase(times.begin());
- times.push_back(DateTime::getCurrentTime());
+ times.push_back(getCurrentTime());
return true;
}
diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
index b7fc9f0b70..4930f47d21 100644
--- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
+++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
@@ -30,35 +30,41 @@
POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/resumption/resume_ctrl_impl.h"
+#include "application_manager/display_capabilities_builder.h"
-#include <fstream>
#include <algorithm>
+#include <fstream>
#include "application_manager/application_manager.h"
#include "application_manager/rpc_service.h"
-#include "utils/file_system.h"
-#include "connection_handler/connection_handler_impl.h"
-#include "application_manager/message_helper.h"
-#include "connection_handler/connection.h"
#include "application_manager/commands/command_impl.h"
-#include "policy/policy_manager_impl.h"
+#include "application_manager/message_helper.h"
#include "application_manager/policies/policy_handler.h"
-#include "application_manager/state_controller.h"
-#include "utils/helpers.h"
#include "application_manager/resumption/resumption_data_db.h"
#include "application_manager/resumption/resumption_data_json.h"
-#include "utils/make_shared.h"
+#include "application_manager/state_controller.h"
+#include "connection_handler/connection.h"
+#include "connection_handler/connection_handler_impl.h"
+#include "policy/policy_manager_impl.h"
+#include "utils/file_system.h"
+#include "utils/helpers.h"
+
#include "utils/timer_task_impl.h"
namespace resumption {
using namespace application_manager;
+static mobile_api::HMILevel::eType PickHigherHmiLevel(
+ mobile_api::HMILevel::eType val1, mobile_api::HMILevel::eType val2);
+static mobile_api::HMILevel::eType PickLowerHmiLevel(
+ mobile_api::HMILevel::eType val1, mobile_api::HMILevel::eType val2);
+static mobile_api::HMILevel::eType ConvertHmiLevelString(const std::string str);
+
CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager)
: event_engine::EventObserver(application_manager.event_dispatcher())
- , queue_lock_(false)
, restore_hmi_level_timer_(
"RsmCtrlRstore",
new timer::TimerTaskImpl<ResumeCtrlImpl>(
@@ -69,16 +75,23 @@ ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager)
, is_resumption_active_(false)
, is_data_saved_(false)
, is_suspended_(false)
- , launch_time_(time(NULL))
+ , launch_time_(time(nullptr))
+ , low_voltage_time_(0)
+ , wake_up_time_(0)
, application_manager_(application_manager) {}
#ifdef BUILD_TESTS
void ResumeCtrlImpl::set_resumption_storage(
- utils::SharedPtr<ResumptionData> mock_storage) {
+ std::shared_ptr<ResumptionData> mock_storage) {
resumption_storage_ = mock_storage;
}
+
+bool ResumeCtrlImpl::get_resumption_active() const {
+ sync_primitives::AutoLock auto_lock(queue_lock_);
+ return is_resumption_active_;
+}
#endif // BUILD_TESTS
-bool ResumeCtrlImpl::Init(resumption::LastState& last_state) {
+bool ResumeCtrlImpl::Init(resumption::LastStateWrapperPtr last_state_wrapper) {
bool use_db = application_manager_.get_settings().use_db_for_resumption();
if (use_db) {
resumption_storage_.reset(
@@ -107,7 +120,7 @@ bool ResumeCtrlImpl::Init(resumption::LastState& last_state) {
}
} else {
resumption_storage_.reset(
- new ResumptionDataJson(last_state, application_manager_));
+ new ResumptionDataJson(last_state_wrapper, application_manager_));
if (!resumption_storage_->Init()) {
LOG4CXX_DEBUG(logger_, "Resumption storage initialisation failed");
return false;
@@ -118,6 +131,8 @@ bool ResumeCtrlImpl::Init(resumption::LastState& last_state) {
application_manager_.get_settings()
.app_resumption_save_persistent_data_timeout(),
timer::kPeriodic);
+
+ resumption_storage_->IncrementGlobalIgnOnCounter();
return true;
}
@@ -134,14 +149,24 @@ void ResumeCtrlImpl::SaveAllApplications() {
void ResumeCtrlImpl::SaveApplication(ApplicationSharedPtr application) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(application);
- LOG4CXX_INFO(logger_,
- "application with appID " << application->app_id()
- << " will be saved");
+ if (application_manager_.IsLowVoltage()) {
+ LOG4CXX_DEBUG(logger_, "Low Voltage state is active");
+ return;
+ }
+ LOG4CXX_DEBUG(
+ logger_,
+ "application with appID " << application->app_id() << " will be saved");
resumption_storage_->SaveApplication(application);
}
void ResumeCtrlImpl::on_event(const event_engine::Event& event) {
- LOG4CXX_DEBUG(logger_, "Event received" << event.id());
+ LOG4CXX_DEBUG(logger_, "Event received: " << event.id());
+
+ if (hmi_apis::FunctionID::UI_CreateWindow == event.id()) {
+ LOG4CXX_INFO(logger_, "Received UI_CreateWindow event");
+ const auto& response_message = event.smart_object();
+ RestoreWidgetsHMIState(response_message);
+ }
}
bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
@@ -158,11 +183,51 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
if (result) {
DCHECK_OR_RETURN(application, false);
if (saved_app.keyExists(strings::hmi_level)) {
- const HMILevel::eType saved_hmi_level =
- static_cast<mobile_apis::HMILevel::eType>(
- saved_app[strings::hmi_level].asInt());
- LOG4CXX_DEBUG(logger_, "Saved HMI Level is : " << saved_hmi_level);
- return SetAppHMIState(application, saved_hmi_level, true);
+ HMILevel::eType saved_hmi_level;
+ if (HMILevel::eType::INVALID_ENUM !=
+ application->deferred_resumption_hmi_level()) {
+ saved_hmi_level = application->deferred_resumption_hmi_level();
+ LOG4CXX_INFO(logger_,
+ "Retry resuming into HMI level : " << saved_hmi_level);
+ application->set_deferred_resumption_hmi_level(
+ HMILevel::eType::INVALID_ENUM);
+ } else {
+ saved_hmi_level = static_cast<mobile_apis::HMILevel::eType>(
+ saved_app[strings::hmi_level].asInt());
+ LOG4CXX_DEBUG(logger_, "Saved HMI Level is : " << saved_hmi_level);
+ }
+
+ // Check one of the high-bandwidth transports (configured through
+ // smartDeviceLink.ini file) is available. If not, then the HMI level to
+ // resume into will be modified.
+ if (!application_manager_.CheckResumptionRequiredTransportAvailable(
+ application)) {
+ mobile_apis::HMILevel::eType low_bandwidth_level =
+ GetHmiLevelOnLowBandwidthTransport(application);
+
+ application->set_deferred_resumption_hmi_level(saved_hmi_level);
+
+ saved_hmi_level =
+ PickLowerHmiLevel(saved_hmi_level, low_bandwidth_level);
+ LOG4CXX_DEBUG(
+ logger_,
+ "High-bandwidth transport not available, app will resume into : "
+ << saved_hmi_level);
+ }
+ const bool app_exists_in_full_or_limited =
+ application_manager_.get_full_or_limited_application().use_count() !=
+ 0;
+ const bool app_hmi_state_is_set =
+ SetAppHMIState(application, saved_hmi_level, true);
+ size_t restored_widgets = 0;
+ if (app_hmi_state_is_set &&
+ application->is_app_data_resumption_allowed()) {
+ restored_widgets = RestoreAppWidgets(application, saved_app);
+ }
+ if (0 == restored_widgets && app_exists_in_full_or_limited) {
+ LOG4CXX_DEBUG(logger_, "App exists in full or limited. Do not resume");
+ return false;
+ }
} else {
result = false;
LOG4CXX_ERROR(logger_, "saved app data corrupted");
@@ -173,12 +238,109 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
return result;
}
+void ResumeCtrlImpl::RestoreWidgetsHMIState(
+ const smart_objects::SmartObject& response_message) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto correlation_id =
+ response_message[strings::params][strings::correlation_id].asInt();
+ const auto& request = requests_msg_.find(correlation_id);
+ if (requests_msg_.end() == request) {
+ LOG4CXX_ERROR(logger_,
+ "Request UI_CreateWindow for correlation id: "
+ << correlation_id << " not found");
+ return;
+ }
+
+ const auto& msg_params = (*request->second)[strings::msg_params];
+ const auto hmi_app_id = msg_params[strings::app_id].asInt();
+ auto application = application_manager_.application_by_hmi_app(hmi_app_id);
+ if (!application) {
+ LOG4CXX_ERROR(logger_,
+ "Application is not registered by hmi id: " << hmi_app_id);
+ requests_msg_.erase(request);
+ return;
+ }
+ const WindowID window_id = msg_params[strings::window_id].asInt();
+
+ const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ response_message[strings::params][hmi_response::code].asInt());
+ if (hmi_apis::Common_Result::SUCCESS != result_code) {
+ LOG4CXX_ERROR(logger_,
+ "UI_CreateWindow for correlation id: "
+ << correlation_id
+ << " failed with code: " << result_code);
+ requests_msg_.erase(request);
+ auto& builder = application->display_capabilities_builder();
+ builder.StopWaitingForWindow(window_id);
+ return;
+ }
+
+ smart_objects::SmartObject window_info(smart_objects::SmartType_Map);
+ auto fill_optional_param = [&window_info,
+ &msg_params](const std::string& key) {
+ if (msg_params.keyExists(key)) {
+ window_info[key] = msg_params[key].asString();
+ }
+ };
+ fill_optional_param(strings::associated_service_type);
+ fill_optional_param(strings::duplicate_updates_from_window_id);
+
+ const auto window_name = msg_params[strings::window_name].asString();
+ window_info[strings::window_name] = window_name;
+ application->SetWindowInfo(window_id, window_info);
+
+ const auto window_type = static_cast<mobile_apis::WindowType::eType>(
+ msg_params[strings::window_type].asInt());
+ // State should be initialized with INVALID_ENUM value to let state controller
+ // trigger OnHmiStatus notifiation sending
+ auto initial_state = application_manager_.CreateRegularState(
+ application,
+ window_type,
+ mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_api::SystemContext::INVALID_ENUM);
+ application->SetInitialState(window_id, window_name, initial_state);
+
+ // Default HMI level for all windows except the main one is always NONE
+ application_manager_.state_controller().OnAppWindowAdded(
+ application, window_id, window_type, mobile_apis::HMILevel::HMI_NONE);
+
+ requests_msg_.erase(request);
+}
+
+void ResumeCtrlImpl::ProcessSystemCapabilityUpdated(
+ Application& app, const smart_objects::SmartObject& display_capabilities) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto notification = MessageHelper::CreateDisplayCapabilityUpdateToMobile(
+ display_capabilities, app);
+
+ application_manager_.GetRPCService().ManageMobileCommand(
+ notification, commands::Command::SOURCE_SDL);
+ app.set_is_resuming(false);
+}
+
bool ResumeCtrlImpl::SetupDefaultHMILevel(ApplicationSharedPtr application) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN(application, false);
- mobile_apis::HMILevel::eType default_hmi =
+ mobile_apis::HMILevel::eType hmi_level =
application_manager_.GetDefaultHmiLevel(application);
- return SetAppHMIState(application, default_hmi, false);
+
+ // Check one of the high-bandwidth transports (configured through
+ // smartDeviceLink.ini file) is available. If not, then the HMI level to
+ // resume into will be modified.
+ if (!application_manager_.CheckResumptionRequiredTransportAvailable(
+ application)) {
+ mobile_apis::HMILevel::eType low_bandwidth_level =
+ GetHmiLevelOnLowBandwidthTransport(application);
+ hmi_level = PickLowerHmiLevel(hmi_level, low_bandwidth_level);
+ LOG4CXX_DEBUG(
+ logger_,
+ "High-bandwidth transport not available, default HMI level is set to : "
+ << hmi_level);
+ }
+ return SetAppHMIState(application, hmi_level, false);
}
void ResumeCtrlImpl::ApplicationResumptiOnTimer() {
@@ -192,7 +354,9 @@ void ResumeCtrlImpl::ApplicationResumptiOnTimer() {
LOG4CXX_ERROR(logger_, "Invalid app_id = " << *it);
continue;
}
- StartAppHmiStateResumption(app);
+ if (!StartAppHmiStateResumption(app)) {
+ app->set_is_resuming(false);
+ }
}
is_resumption_active_ = false;
waiting_for_timer_.clear();
@@ -202,6 +366,7 @@ void ResumeCtrlImpl::ApplicationResumptiOnTimer() {
void ResumeCtrlImpl::OnAppActivated(ApplicationSharedPtr application) {
if (is_resumption_active_) {
RemoveFromResumption(application->app_id());
+ application->set_is_resuming(false);
}
}
@@ -212,6 +377,10 @@ void ResumeCtrlImpl::RemoveFromResumption(uint32_t app_id) {
queue_lock_.Release();
}
+bool ResumeCtrlImpl::Init(LastState&) {
+ return false;
+}
+
bool ResumeCtrlImpl::SetAppHMIState(
ApplicationSharedPtr application,
const mobile_apis::HMILevel::eType hmi_level,
@@ -231,15 +400,39 @@ bool ResumeCtrlImpl::SetAppHMIState(
SetupDefaultHMILevel(application);
return false;
}
- application->set_is_resuming(true);
- application_manager_.state_controller().SetRegularState(application,
- hmi_level);
+
+ application_manager_.state_controller().SetRegularState(
+ application, mobile_apis::PredefinedWindows::DEFAULT_WINDOW, hmi_level);
LOG4CXX_INFO(logger_,
"Application with policy id " << application->policy_app_id()
<< " got HMI level " << hmi_level);
+
return true;
}
+size_t ResumeCtrlImpl::RestoreAppWidgets(
+ application_manager::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ using namespace mobile_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(application);
+ if (!saved_app.keyExists(strings::windows_info)) {
+ LOG4CXX_ERROR(logger_, "windows_info section does not exist");
+ return 0;
+ }
+ const auto& windows_info = saved_app[strings::windows_info];
+ auto request_list = MessageHelper::CreateUICreateWindowRequestsToHMI(
+ application, application_manager_, windows_info);
+
+ requests_msg_.clear();
+ for (auto& request : request_list) {
+ requests_msg_.insert(std::make_pair(
+ (*request)[strings::params][strings::correlation_id].asInt(), request));
+ }
+ ProcessHMIRequests(request_list);
+ return request_list.size();
+}
+
bool ResumeCtrlImpl::IsHMIApplicationIdExist(uint32_t hmi_app_id) {
LOG4CXX_DEBUG(logger_, "hmi_app_id :" << hmi_app_id);
return resumption_storage_->IsHMIApplicationIdExist(hmi_app_id);
@@ -258,6 +451,10 @@ uint32_t ResumeCtrlImpl::GetHMIApplicationID(
bool ResumeCtrlImpl::RemoveApplicationFromSaved(
ApplicationConstSharedPtr application) {
+ if (application_manager_.IsLowVoltage()) {
+ LOG4CXX_DEBUG(logger_, "Low Voltage state is active");
+ return false;
+ }
const std::string& device_mac = application->mac_address();
return resumption_storage_->RemoveApplicationFromSaved(
application->policy_app_id(), device_mac);
@@ -271,8 +468,12 @@ void ResumeCtrlImpl::OnSuspend() {
void ResumeCtrlImpl::OnIgnitionOff() {
LOG4CXX_AUTO_TRACE(logger_);
- resumption_storage_->IncrementIgnOffCount();
- FinalPersistData();
+ DCHECK_OR_RETURN_VOID(resumption_storage_);
+ if (!application_manager_.IsLowVoltage()) {
+ resumption_storage_->IncrementIgnOffCount();
+ resumption_storage_->ResetGlobalIgnOnCount();
+ FinalPersistData();
+ }
}
void ResumeCtrlImpl::OnAwake() {
@@ -282,6 +483,25 @@ void ResumeCtrlImpl::OnAwake() {
StartSavePersistentDataTimer();
}
+void ResumeCtrlImpl::SaveLowVoltageTime() {
+ low_voltage_time_ = time(nullptr);
+ LOG4CXX_DEBUG(logger_,
+ "Low Voltage timestamp : " << low_voltage_time_ << " saved");
+}
+
+void ResumeCtrlImpl::SaveWakeUpTime() {
+ wake_up_time_ = std::time(nullptr);
+ LOG4CXX_DEBUG(logger_, "Wake Up timestamp : " << wake_up_time_ << " saved");
+}
+
+time_t ResumeCtrlImpl::LowVoltageTime() const {
+ return low_voltage_time_;
+}
+
+time_t ResumeCtrlImpl::WakeUpTime() const {
+ return wake_up_time_;
+}
+
bool ResumeCtrlImpl::is_suspended() const {
return is_suspended_;
}
@@ -313,7 +533,15 @@ bool ResumeCtrlImpl::StartResumption(ApplicationSharedPtr application,
<< " hmi_app_id = " << application->hmi_app_id()
<< " policy_id = " << application->policy_app_id()
<< " received hash = " << hash);
- SetupDefaultHMILevel(application);
+ application->set_is_resuming(true);
+
+ if (!application->is_cloud_app()) {
+ // Default HMI Level is already set before resumption in
+ // ApplicationManager::OnApplicationRegistered, and handling low bandwidth
+ // transports doesn't apply to cloud apps, so this step can be skipped for
+ // such apps
+ SetupDefaultHMILevel(application);
+ }
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
bool result = resumption_storage_->GetSavedApplication(
@@ -329,58 +557,106 @@ bool ResumeCtrlImpl::StartResumption(ApplicationSharedPtr application,
bool ResumeCtrlImpl::StartResumptionOnlyHMILevel(
ApplicationSharedPtr application) {
- // sync_primitives::AutoLock lock(resumtion_lock_);
LOG4CXX_AUTO_TRACE(logger_);
if (!application) {
LOG4CXX_WARN(logger_, "Application does not exist.");
return false;
}
+
+ application->set_is_resuming(true);
LOG4CXX_DEBUG(logger_,
- "HMI level resumption requested for application id "
- << application->app_id() << "with hmi_app_id "
- << application->hmi_app_id() << ", policy_app_id "
- << application->policy_app_id());
- SetupDefaultHMILevel(application);
+ "HMI level resumption requested for application id: "
+ << application->app_id()
+ << " with hmi_app_id: " << application->hmi_app_id()
+ << ", policy_app_id " << application->policy_app_id());
+ if (!application->is_cloud_app()) {
+ // Default HMI Level is already set before resumption in
+ // ApplicationManager::OnApplicationRegistered, and handling low bandwidth
+ // transports doesn't apply to cloud apps, so this step can be skipped for
+ // such apps
+ SetupDefaultHMILevel(application);
+ }
const std::string& device_mac = application->mac_address();
smart_objects::SmartObject saved_app;
bool result = resumption_storage_->GetSavedApplication(
application->policy_app_id(), device_mac, saved_app);
if (result) {
- // sync_primitives::AutoUnlock unlock(lock);
AddToResumptionTimerQueue(application->app_id());
}
LOG4CXX_INFO(logger_, "StartResumptionOnlyHMILevel::Result = " << result);
return result;
}
-void ResumeCtrlImpl::StartAppHmiStateResumption(
+void ResumeCtrlImpl::RetryResumption(const uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app = application_manager_.application(app_id);
+ if (!app) {
+ LOG4CXX_WARN(logger_, "Invalid app_id = " << app_id);
+ return;
+ }
+
+ {
+ sync_primitives::AutoLock auto_lock(queue_lock_);
+ // check and update resumption deferred flag in queue_lock_
+ if (mobile_api::HMILevel::eType::INVALID_ENUM ==
+ app->deferred_resumption_hmi_level()) {
+ LOG4CXX_DEBUG(logger_, "No need to retry resumption for app: " << app_id);
+ return;
+ }
+ }
+
+ AddToResumptionTimerQueue(app_id);
+}
+
+bool ResumeCtrlImpl::StartAppHmiStateResumption(
ApplicationSharedPtr application) {
using namespace date_time;
LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(application);
+ DCHECK_OR_RETURN(application, false);
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
- const bool result = resumption_storage_->GetSavedApplication(
+ const bool get_saved_app_result = resumption_storage_->GetSavedApplication(
application->policy_app_id(), device_mac, saved_app);
- if (!result) {
+ if (!get_saved_app_result) {
LOG4CXX_ERROR(logger_, "Application was not saved");
- return;
+ return false;
+ }
+
+ const bool is_hmi_level_applicable_to_resume =
+ CheckAppRestrictions(application, saved_app);
+
+ if (!is_hmi_level_applicable_to_resume) {
+ LOG4CXX_DEBUG(logger_, "No applicable HMI level found for resuming");
+ return false;
}
- const uint32_t ign_off_count = saved_app[strings::ign_off_count].asUInt();
- bool restore_data_allowed = false;
- restore_data_allowed =
- CheckAppRestrictions(application, saved_app) &&
- ((0 == ign_off_count) || CheckIgnCycleRestrictions(saved_app));
- if (restore_data_allowed) {
+
+ const bool is_resume_allowed_by_low_voltage =
+ CheckLowVoltageRestrictions(saved_app);
+
+ const bool is_hmi_level_allowed_by_ign_cycle =
+ CheckIgnCycleRestrictions(saved_app);
+
+ const bool restore_hmi_level_allowed =
+ is_resume_allowed_by_low_voltage && is_hmi_level_allowed_by_ign_cycle;
+
+ if (restore_hmi_level_allowed) {
LOG4CXX_INFO(logger_,
"Resume application " << application->policy_app_id());
- RestoreAppHMIState(application);
+ const bool hmi_state_restore_result = RestoreAppHMIState(application);
+ if (mobile_apis::HMILevel::eType::INVALID_ENUM !=
+ application->deferred_resumption_hmi_level()) {
+ // the application has not been fully resumed
+ return false;
+ }
RemoveApplicationFromSaved(application);
+ return hmi_state_restore_result;
} else {
- LOG4CXX_INFO(logger_,
- "Do not need to resume application "
- << application->policy_app_id());
+ LOG4CXX_INFO(
+ logger_,
+ "Do not need to resume application " << application->policy_app_id());
}
+ return true;
}
void ResumeCtrlImpl::ResetLaunchTime() {
@@ -423,9 +699,14 @@ bool ResumeCtrlImpl::CheckApplicationHash(ApplicationSharedPtr application,
"app_id : " << application->app_id() << " hash : " << hash);
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
- bool result = resumption_storage_->GetSavedApplication(
+ const bool get_app_result = resumption_storage_->GetSavedApplication(
application->policy_app_id(), device_mac, saved_app);
- return result ? saved_app[strings::hash_id].asString() == hash : false;
+ const bool check_result =
+ get_app_result ? saved_app[strings::hash_id].asString() == hash : false;
+ if (check_result) {
+ application->set_app_data_resumption_allowance(true);
+ }
+ return check_result;
}
void ResumeCtrlImpl::SaveDataOnTimer() {
@@ -446,6 +727,7 @@ void ResumeCtrlImpl::SaveDataOnTimer() {
void ResumeCtrlImpl::FinalPersistData() {
LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(resumption_storage_);
StopSavePersistentDataTimer();
SaveAllApplications();
resumption_storage_->Persist();
@@ -490,6 +772,27 @@ bool ResumeCtrlImpl::RestoreApplicationData(ApplicationSharedPtr application) {
return result;
}
+void ResumeCtrlImpl::StartWaitingForDisplayCapabilitiesUpdate(
+ app_mngr::ApplicationSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject saved_app(smart_objects::SmartType_Map);
+ resumption_storage_->GetSavedApplication(
+ application->policy_app_id(), application->mac_address(), saved_app);
+ auto resume_callback =
+ [this](Application& app,
+ const smart_objects::SmartObject& display_capabilities) -> void {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ProcessSystemCapabilityUpdated(app, display_capabilities);
+ };
+ auto& builder = application->display_capabilities_builder();
+
+ smart_objects::SmartObject windows_info(smart_objects::SmartType_Null);
+ if (saved_app.keyExists(strings::windows_info)) {
+ windows_info = saved_app[strings::windows_info];
+ }
+ builder.InitBuilder(resume_callback, windows_info);
+}
+
void ResumeCtrlImpl::AddFiles(ApplicationSharedPtr application,
const smart_objects::SmartObject& saved_app) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -543,11 +846,19 @@ void ResumeCtrlImpl::AddCommands(ApplicationSharedPtr application,
if (saved_app.keyExists(strings::application_commands)) {
const smart_objects::SmartObject& app_commands =
saved_app[strings::application_commands];
- for (size_t i = 0; i < app_commands.length(); ++i) {
- const smart_objects::SmartObject& command = app_commands[i];
- application->AddCommand(command[strings::cmd_id].asUInt(), command);
+ for (size_t cmd_num = 0; cmd_num < app_commands.length(); ++cmd_num) {
+ const smart_objects::SmartObject& command = app_commands[cmd_num];
+ const uint32_t cmd_id = command[strings::cmd_id].asUInt();
+ const bool is_resumption = true;
+ application->AddCommand(
+ commands::CommandImpl::CalcCommandInternalConsecutiveNumber(
+ application),
+ command);
+ application->help_prompt_manager().OnVrCommandAdded(
+ cmd_id, command, is_resumption);
}
+
ProcessHMIRequests(MessageHelper::CreateAddCommandRequestToHMI(
application, application_manager_));
} else {
@@ -633,30 +944,62 @@ void ResumeCtrlImpl::AddSubscriptions(
bool ResumeCtrlImpl::CheckIgnCycleRestrictions(
const smart_objects::SmartObject& saved_app) {
LOG4CXX_AUTO_TRACE(logger_);
- bool result = true;
if (!CheckDelayAfterIgnOn()) {
- LOG4CXX_INFO(logger_, "Application was connected long after ign on");
- result = false;
+ LOG4CXX_DEBUG(logger_, "Application was connected long after ign on");
+ return false;
}
- if (!DisconnectedJustBeforeIgnOff(saved_app)) {
- LOG4CXX_INFO(logger_, "Application was dissconnected long before ign off");
- result = false;
+ if (!CheckDelayBeforeIgnOff(saved_app)) {
+ LOG4CXX_DEBUG(logger_, "Application was disconnected long before ign off");
+ return false;
}
- return result;
+ return true;
}
-bool ResumeCtrlImpl::DisconnectedJustBeforeIgnOff(
+bool ResumeCtrlImpl::CheckLowVoltageRestrictions(
const smart_objects::SmartObject& saved_app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!CheckDelayBeforeLowVoltage(saved_app)) {
+ LOG4CXX_DEBUG(logger_,
+ "Application was disconnected long before low voltage");
+ return false;
+ }
+
+ if (!CheckDelayAfterWakeUp()) {
+ LOG4CXX_DEBUG(logger_, "Application was connected long after wake up");
+ return false;
+ }
+
+ LOG4CXX_DEBUG(logger_, "HMI Level resuming in not restricted by Low Voltage");
+ return true;
+}
+
+bool ResumeCtrlImpl::CheckDelayBeforeIgnOff(
+ const smart_objects::SmartObject& saved_app) const {
using namespace date_time;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false);
const time_t time_stamp =
static_cast<time_t>(saved_app[strings::time_stamp].asInt());
- time_t ign_off_time =
+ const time_t ign_off_time =
static_cast<time_t>(resumption_storage_->GetIgnOffTime());
+
+ if (CheckIgnCyclesData() && 0 == ign_off_time) {
+ LOG4CXX_DEBUG(
+ logger_, "No IGNITION OFF records found: This is first Ignition cycle");
+ return true;
+ }
+
+ // This means that ignition off timestamp was not saved
+ // Possible reasons: Low Voltage event, core crash etc.
+ if (ign_off_time < time_stamp) {
+ LOG4CXX_DEBUG(logger_, "Last IGNITION OFF record missed");
+ return true;
+ }
+
const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp);
LOG4CXX_DEBUG(
logger_,
@@ -669,6 +1012,71 @@ bool ResumeCtrlImpl::DisconnectedJustBeforeIgnOff(
application_manager_.get_settings().resumption_delay_before_ign();
}
+bool ResumeCtrlImpl::CheckDelayBeforeLowVoltage(
+ const smart_objects::SmartObject& saved_app) const {
+ using namespace date_time;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false);
+
+ if (0 == LowVoltageTime()) {
+ LOG4CXX_DEBUG(logger_, "No Low Voltage signal timestamp saved");
+ return true;
+ }
+
+ const time_t unregistration_time_stamp =
+ static_cast<time_t>(saved_app[strings::time_stamp].asInt());
+ const time_t low_voltage_timestamp = static_cast<time_t>(LowVoltageTime());
+ const int32_t sec_spent_before_low_voltage =
+ (low_voltage_timestamp - unregistration_time_stamp);
+ if (0 > sec_spent_before_low_voltage) {
+ LOG4CXX_DEBUG(logger_,
+ "Low Voltage time: "
+ << low_voltage_timestamp
+ << "; App disconnect time: " << unregistration_time_stamp
+ << "; Secs between app disconnect and low voltage event "
+ << sec_spent_before_low_voltage);
+ return true;
+ }
+
+ const uint32_t secs_between_app_disconnect_and_low_voltage =
+ static_cast<uint32_t>(sec_spent_before_low_voltage);
+ const uint32_t wait_time =
+ application_manager_.get_settings().resumption_delay_before_ign();
+ LOG4CXX_DEBUG(logger_,
+ "Low Voltage time: "
+ << low_voltage_timestamp
+ << "; App disconnect time: " << unregistration_time_stamp
+ << "; Secs between app disconnect and low voltage event "
+ << secs_between_app_disconnect_and_low_voltage
+ << "; Timeout for HMI level resuming: " << wait_time);
+ return secs_between_app_disconnect_and_low_voltage <= wait_time;
+}
+
+bool ResumeCtrlImpl::CheckDelayAfterWakeUp() const {
+ using namespace date_time;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (0 == WakeUpTime()) {
+ LOG4CXX_DEBUG(logger_, "No WakeUp signal timestamp saved");
+ return true;
+ }
+
+ const time_t current_time = time(nullptr);
+ const time_t wake_up_timestamp = static_cast<time_t>(WakeUpTime());
+
+ const uint32_t seconds_from_wake_up_signal =
+ labs(current_time - wake_up_timestamp);
+ const uint32_t wait_time =
+ application_manager_.get_settings().resumption_delay_after_ign();
+ LOG4CXX_DEBUG(
+ logger_,
+ "Current time: " << current_time << "; WakeUp Signal time: "
+ << wake_up_timestamp << "; Seconds passed from wake up: "
+ << seconds_from_wake_up_signal
+ << "; Timeout for HMI level resuming: " << wait_time);
+ return seconds_from_wake_up_signal <= wait_time;
+}
+
bool ResumeCtrlImpl::CheckAppRestrictions(
ApplicationConstSharedPtr application,
const smart_objects::SmartObject& saved_app) {
@@ -677,16 +1085,23 @@ bool ResumeCtrlImpl::CheckAppRestrictions(
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN(saved_app.keyExists(strings::hmi_level), false);
- const HMILevel::eType hmi_level =
- static_cast<HMILevel::eType>(saved_app[strings::hmi_level].asInt());
+ HMILevel::eType hmi_level;
+ if (mobile_api::HMILevel::eType::INVALID_ENUM !=
+ application->deferred_resumption_hmi_level()) {
+ hmi_level = application->deferred_resumption_hmi_level();
+ } else {
+ hmi_level =
+ static_cast<HMILevel::eType>(saved_app[strings::hmi_level].asInt());
+ }
const bool result = Compare<HMILevel::eType, EQ, ONE>(
hmi_level, HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)
? true
: false;
LOG4CXX_DEBUG(logger_,
- "is_media_app " << application->is_media_application()
- << "; hmi_level " << hmi_level << " result "
- << result);
+ "is_media_app: " << application->is_media_application()
+ << "; hmi_level: " << hmi_level << "; result: "
+ << (result ? "Applicable for resume"
+ : "Non-applicable for resume"));
return result;
}
@@ -699,11 +1114,36 @@ bool ResumeCtrlImpl::CheckIcons(ApplicationSharedPtr application,
return mobile_apis::Result::INVALID_DATA != verify_images;
}
-bool ResumeCtrlImpl::CheckDelayAfterIgnOn() {
+bool ResumeCtrlImpl::CheckIgnCyclesData() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const uint32_t global_ign_on_count =
+ resumption_storage_->GetGlobalIgnOnCounter();
+ const uint32_t the_first_ignition = 1;
+ const bool is_emergency_ign_off_occurred =
+ global_ign_on_count > the_first_ignition;
+ // global_ign_on_count is reseting to 0 at ignition off
+ // global_ign_on_count is incrementing at ignition on
+ // global_ign_on_count > 1 means that correct ignition off was not present.
+ if (is_emergency_ign_off_occurred) {
+ LOG4CXX_WARN(logger_,
+ "Emergency IGN OFF occurred. Possibly after Low Voltage");
+ return false;
+ }
+ return true;
+}
+
+bool ResumeCtrlImpl::CheckDelayAfterIgnOn() const {
using namespace date_time;
LOG4CXX_AUTO_TRACE(logger_);
- const time_t curr_time = time(NULL);
+ const time_t ign_off_time = GetIgnOffTime();
+
+ if (CheckIgnCyclesData() && 0 == ign_off_time) {
+ LOG4CXX_DEBUG(logger_, "This is first Ignition cycle");
+ return true;
+ }
+ const time_t curr_time = time(nullptr);
const time_t sdl_launch_time = LaunchTime();
+
const uint32_t seconds_from_sdl_start = labs(curr_time - sdl_launch_time);
const uint32_t wait_time =
application_manager_.get_settings().resumption_delay_after_ign();
@@ -719,7 +1159,7 @@ time_t ResumeCtrlImpl::LaunchTime() const {
return launch_time_;
}
-time_t ResumeCtrlImpl::GetIgnOffTime() {
+time_t ResumeCtrlImpl::GetIgnOffTime() const {
return resumption_storage_->GetIgnOffTime();
}
@@ -735,7 +1175,8 @@ bool ResumeCtrlImpl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request,
(*request)[strings::correlation_id].asInt();
subscribe_on_event(function_id, hmi_correlation_id);
}
- if (!application_manager_.GetRPCService().ManageHMICommand(request)) {
+ if (!application_manager_.GetRPCService().ManageHMICommand(
+ request, commands::Command::SOURCE_SDL_TO_HMI)) {
LOG4CXX_ERROR(logger_, "Unable to send request");
return false;
}
@@ -754,14 +1195,22 @@ void ResumeCtrlImpl::ProcessHMIRequests(
void ResumeCtrlImpl::AddToResumptionTimerQueue(const uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
+ bool run_resumption = false;
queue_lock_.Acquire();
waiting_for_timer_.push_back(app_id);
- queue_lock_.Release();
- LOG4CXX_DEBUG(logger_,
- "Application ID " << app_id << " have been added"
- " to resumption queue.");
+
if (!is_resumption_active_) {
is_resumption_active_ = true;
+ run_resumption = true;
+ }
+ queue_lock_.Release();
+ LOG4CXX_DEBUG(logger_,
+ "Application ID " << app_id
+ << " have been added"
+ " to resumption queue.");
+ if (run_resumption) {
+ LOG4CXX_DEBUG(logger_,
+ "Application ID " << app_id << " will be restored by timer");
restore_hmi_level_timer_.Start(
application_manager_.get_settings().app_resuming_timeout(),
timer::kSingleShot);
@@ -826,4 +1275,97 @@ bool ResumeCtrlImpl::IsAppDataResumptionExpired(
return max_ign_off_count <= application[strings::ign_off_count].asInt();
}
-} // namespce resumption
+mobile_apis::HMILevel::eType ResumeCtrlImpl::GetHmiLevelOnLowBandwidthTransport(
+ ApplicationConstSharedPtr application) const {
+ using namespace mobile_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const ApplicationManagerSettings& settings =
+ application_manager_.get_settings();
+ const std::string& level_for_navi_app =
+ settings.navigation_lowbandwidth_resumption_level();
+ const std::string& level_for_projection_app =
+ settings.projection_lowbandwidth_resumption_level();
+ const std::string& level_for_media_app =
+ settings.media_lowbandwidth_resumption_level();
+
+ HMILevel::eType result_level = HMILevel::HMI_NONE;
+ HMILevel::eType level;
+
+ // NAVIGATION, PROJECTION and media apps have special exceptions. Their HMI
+ // level can be configured through .ini file. when the app has multiple
+ // AppHMIType, then the highest level will be applied.
+ if (application->is_navi()) {
+ level = ConvertHmiLevelString(level_for_navi_app);
+ LOG4CXX_DEBUG(logger_,
+ "NAVIGATION apps may have level "
+ << level
+ << " while high-bandwidth transport is not available.");
+ result_level = PickHigherHmiLevel(level, result_level);
+ }
+ if (application->mobile_projection_enabled()) {
+ level = ConvertHmiLevelString(level_for_projection_app);
+ LOG4CXX_DEBUG(logger_,
+ "PROJECTION apps may have level "
+ << level
+ << " while high-bandwidth transport is not available.");
+ result_level = PickHigherHmiLevel(level, result_level);
+ }
+ if (application->is_media_application()) {
+ level = ConvertHmiLevelString(level_for_media_app);
+ LOG4CXX_DEBUG(logger_,
+ "media apps may have level "
+ << level
+ << " while high-bandwidth transport is not available.");
+ result_level = PickHigherHmiLevel(level, result_level);
+ }
+
+ return result_level;
+}
+
+static mobile_api::HMILevel::eType PickHigherHmiLevel(
+ mobile_api::HMILevel::eType val1, mobile_api::HMILevel::eType val2) {
+ using namespace mobile_apis;
+
+ if (val1 == HMILevel::INVALID_ENUM) {
+ return val2;
+ } else if (val2 == HMILevel::INVALID_ENUM) {
+ return val1;
+ }
+
+ // smaller enum value has higher level
+ return val1 < val2 ? val1 : val2;
+}
+
+static mobile_api::HMILevel::eType PickLowerHmiLevel(
+ mobile_api::HMILevel::eType val1, mobile_api::HMILevel::eType val2) {
+ using namespace mobile_apis;
+
+ if (val1 == HMILevel::INVALID_ENUM) {
+ return val2;
+ } else if (val2 == HMILevel::INVALID_ENUM) {
+ return val1;
+ }
+
+ // bigger enum value has lower level
+ return val1 > val2 ? val1 : val2;
+}
+
+static mobile_api::HMILevel::eType ConvertHmiLevelString(
+ const std::string str) {
+ using namespace mobile_apis;
+
+ if ("BACKGROUND" == str) {
+ return HMILevel::HMI_BACKGROUND;
+ } else if ("FULL" == str) {
+ return HMILevel::HMI_FULL;
+ } else if ("LIMITED" == str) {
+ return HMILevel::HMI_LIMITED;
+ } else if ("NONE" == str) {
+ return HMILevel::HMI_NONE;
+ } else {
+ return HMILevel::HMI_NONE;
+ }
+}
+
+} // namespace resumption
diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc
index 72215dcf97..9046fe35ad 100644
--- a/src/components/application_manager/src/resumption/resumption_data.cc
+++ b/src/components/application_manager/src/resumption/resumption_data.cc
@@ -31,9 +31,9 @@
*/
#include "application_manager/resumption/resumption_data.h"
-#include "utils/logger.h"
-#include "application_manager/smart_object_keys.h"
#include "application_manager/application_manager_settings.h"
+#include "application_manager/smart_object_keys.h"
+#include "utils/logger.h"
namespace resumption {
@@ -41,7 +41,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
ResumptionData::ResumptionData(
const application_manager::ApplicationManager& application_manager)
- : resumption_lock_(true), application_manager_(application_manager) {}
+ : application_manager_(application_manager) {}
smart_objects::SmartObject ResumptionData::GetApplicationCommands(
app_mngr::ApplicationConstSharedPtr application) const {
@@ -198,6 +198,52 @@ smart_objects::SmartObject ResumptionData::GetApplicationFiles(
return files;
}
+smart_objects::SmartObject ResumptionData::GetApplicationWidgetsInfo(
+ app_mngr::ApplicationConstSharedPtr application) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject windows_info =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ DCHECK_OR_RETURN(application, windows_info);
+ const auto window_ids = application->GetWindowIds();
+ const auto& window_optional_params_map =
+ application->window_optional_params_map().GetData();
+ for (const auto& window_id : window_ids) {
+ const HmiStatePtr hmi_state = application->CurrentHmiState(window_id);
+ if (mobile_apis::WindowType::WIDGET != hmi_state->window_type()) {
+ continue;
+ }
+ auto info = CreateWindowInfoSO(
+ window_id, hmi_state->window_type(), window_optional_params_map);
+
+ windows_info[windows_info.length()] = info;
+ }
+ return windows_info;
+}
+
+smart_objects::SmartObject ResumptionData::CreateWindowInfoSO(
+ const app_mngr::WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const app_mngr::WindowParamsMap& window_optional_params_map) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto window_info = smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ window_info[strings::window_id] = window_id;
+ window_info[strings::window_type] = window_type;
+
+ const auto& it_info = window_optional_params_map.find(window_id);
+ if (window_optional_params_map.end() != it_info) {
+ const auto keys = it_info->second->enumerate();
+
+ for (const auto& key : keys) {
+ window_info[key] = (*it_info->second)[key];
+ }
+ }
+
+ return window_info;
+}
+
smart_objects::SmartObject ResumptionData::PointerToSmartObj(
const smart_objects::SmartObject* ptr) const {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc
index 2fe7330a9c..9188a47bf9 100644
--- a/src/components/application_manager/src/resumption/resumption_data_db.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -29,18 +29,18 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include <unistd.h>
+#include <string>
#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager_settings.h"
+#include "application_manager/message_helper.h"
#include "application_manager/resumption/resumption_data_db.h"
#include "application_manager/resumption/resumption_sql_queries.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/message_helper.h"
-#include "utils/helpers.h"
#include "utils/gen_hash.h"
+#include "utils/helpers.h"
#include "utils/scope_guard.h"
-#include "application_manager/application_manager_settings.h"
namespace {
const std::string kDatabaseName = "resumption";
@@ -163,11 +163,10 @@ void ResumptionDataDB::SaveApplication(
}
if (application->is_application_data_changed()) {
- if (application_exist) {
- if (!DeleteSavedApplication(policy_app_id, device_mac)) {
- LOG4CXX_ERROR(logger_, "Deleting of application data is not finished");
- return;
- }
+ if (application_exist &&
+ !DeleteSavedApplication(policy_app_id, device_mac)) {
+ LOG4CXX_ERROR(logger_, "Deleting of application data is not finished");
+ return;
}
if (!SaveApplicationToDB(application, policy_app_id, device_mac)) {
@@ -176,23 +175,15 @@ void ResumptionDataDB::SaveApplication(
}
LOG4CXX_INFO(logger_, "All data from application were saved successfully");
application->set_is_application_data_changed(false);
- } else {
- if (application_exist) {
- if (!UpdateApplicationData(application, policy_app_id, device_mac)) {
- LOG4CXX_ERROR(logger_, "Updating application data is failed");
- return;
- }
- LOG4CXX_INFO(logger_, "Application data were updated successfully");
- } else {
- if (Compare<HMILevel::eType, EQ, ONE>(application->hmi_level(),
- HMILevel::HMI_FULL,
- HMILevel::HMI_LIMITED)) {
- if (!InsertApplicationData(application, policy_app_id, device_mac)) {
- LOG4CXX_ERROR(logger_, "Saving data of application is failed");
- return;
- }
- }
+ } else if (application_exist) {
+ if (!UpdateApplicationData(application, policy_app_id, device_mac)) {
+ LOG4CXX_ERROR(logger_, "Updating application data is failed");
+ return;
}
+ LOG4CXX_INFO(logger_, "Application data were updated successfully");
+ } else if (!InsertApplicationData(application, policy_app_id, device_mac)) {
+ LOG4CXX_ERROR(logger_, "Saving data of application is failed");
+ return;
}
WriteDb();
}
@@ -212,8 +203,6 @@ uint32_t ResumptionDataDB::GetHMIApplicationID(
return hmi_app_id;
}
-DEPRECATED void ResumptionDataDB::OnSuspend() {}
-
void ResumptionDataDB::IncrementIgnOffCount() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -240,7 +229,7 @@ void ResumptionDataDB::IncrementIgnOffCount() {
}
}
- if (query_update_last_ign_off_time.Prepare(KUpdateLastIgnOffTime)) {
+ if (query_update_last_ign_off_time.Prepare(kUpdateLastIgnOffTime)) {
query_update_last_ign_off_time.Bind(0, static_cast<int64_t>(time(NULL)));
if (query_update_last_ign_off_time.Exec()) {
LOG4CXX_INFO(logger_, "Data last_ign_off_time was updated");
@@ -293,8 +282,6 @@ bool ResumptionDataDB::GetHashId(const std::string& policy_app_id,
return SelectHashId(policy_app_id, device_id, hash_id);
}
-DEPRECATED void ResumptionDataDB::OnAwake() {}
-
void ResumptionDataDB::DecrementIgnOffCount() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -376,10 +363,61 @@ bool ResumptionDataDB::RemoveApplicationFromSaved(
uint32_t ResumptionDataDB::GetIgnOffTime() const {
LOG4CXX_AUTO_TRACE(logger_);
-
return SelectIgnOffTime();
}
+uint32_t ResumptionDataDB::GetGlobalIgnOnCounter() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(kSelectGlobalIgnOnCounter)) {
+ LOG4CXX_ERROR(logger_,
+ "Problem with prepare query : " << kSelectGlobalIgnOnCounter);
+ return 1;
+ }
+
+ if (!query.Exec()) {
+ LOG4CXX_ERROR(logger_,
+ "Problem with exec query : " << kSelectGlobalIgnOnCounter);
+ return 1;
+ }
+
+ const auto global_ign_on_counter = query.GetUInteger(0);
+ LOG4CXX_DEBUG(logger_, "Global Ign On Counter = " << global_ign_on_counter);
+ return global_ign_on_counter;
+}
+
+void ResumptionDataDB::IncrementGlobalIgnOnCounter() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+
+ db_->BeginTransaction();
+ utils::dbms::SQLQuery query_update_global_ign_on_count(db());
+ if (query_update_global_ign_on_count.Prepare(kUpdateGlobalIgnOnCount)) {
+ if (query_update_global_ign_on_count.Exec()) {
+ LOG4CXX_DEBUG(logger_,
+ "Data query_update_global_ign_on_count was updated");
+ }
+ }
+ db_->CommitTransaction();
+ WriteDb();
+}
+
+void ResumptionDataDB::ResetGlobalIgnOnCount() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+
+ LOG4CXX_DEBUG(logger_, "Global IGN ON counter resetting");
+
+ utils::dbms::SQLQuery query_update_global_ign_on_count(db());
+ if (query_update_global_ign_on_count.Prepare(kResetGlobalIgnOnCount)) {
+ if (query_update_global_ign_on_count.Exec()) {
+ LOG4CXX_DEBUG(logger_, "Data was updated");
+ }
+ }
+}
+
ssize_t ResumptionDataDB::IsApplicationSaved(
const std::string& policy_app_id, const std::string& device_id) const {
LOG4CXX_AUTO_TRACE(logger_);
@@ -557,7 +595,6 @@ void ResumptionDataDB::SelectDataForLoadResumeData(
using namespace app_mngr;
using namespace smart_objects;
LOG4CXX_AUTO_TRACE(logger_);
-
utils::dbms::SQLQuery select_data(db());
utils::dbms::SQLQuery count_application(db());
if (!select_data.Prepare(kSelectDataForLoadResumeData) ||
@@ -2694,7 +2731,8 @@ bool ResumptionDataDB::UpdateApplicationData(
utils::dbms::SQLQuery query(db());
const int64_t time_stamp = static_cast<int64_t>(time(NULL));
- const mobile_apis::HMILevel::eType hmi_level = application->hmi_level();
+ const mobile_apis::HMILevel::eType hmi_level =
+ application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if (!query.Prepare(kUpdateApplicationData)) {
LOG4CXX_WARN(logger_,
@@ -2806,7 +2844,8 @@ ApplicationParams::ApplicationParams(app_mngr::ApplicationSharedPtr application)
m_grammar_id = application->get_grammar_id();
m_connection_key = application->app_id();
m_hmi_app_id = application->hmi_app_id();
- m_hmi_level = application->hmi_level();
+ m_hmi_level =
+ application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
m_is_media_application = application->IsAudioApplication();
app_ptr = application;
}
diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc
index b6a50fd5de..3623c18b90 100644
--- a/src/components/application_manager/src/resumption/resumption_data_json.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -30,25 +30,26 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/application_manager_impl.h"
#include "application_manager/resumption/resumption_data_json.h"
-#include "smart_objects/smart_object.h"
-#include "json/json.h"
-#include "formatters/CFormatterJsonBase.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/application_manager_settings.h"
#include "application_manager/message_helper.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager/application_manager_settings.h"
+#include "formatters/CFormatterJsonBase.h"
+#include "json/json.h"
+#include "smart_objects/smart_object.h"
namespace resumption {
-namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
+namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
ResumptionDataJson::ResumptionDataJson(
- LastState& last_state,
+ resumption::LastStateWrapperPtr last_state_wrapper,
const application_manager::ApplicationManager& application_manager)
- : ResumptionData(application_manager), last_state_(last_state) {}
+ : ResumptionData(application_manager)
+ , last_state_wrapper_(last_state_wrapper) {}
void ResumptionDataJson::SaveApplication(
app_mngr::ApplicationSharedPtr application) {
@@ -64,13 +65,16 @@ void ResumptionDataJson::SaveApplication(
const uint32_t grammar_id = application->get_grammar_id();
const uint32_t time_stamp = (uint32_t)time(NULL);
const std::string device_mac = application->mac_address();
- const mobile_apis::HMILevel::eType hmi_level = application->hmi_level();
+ const mobile_apis::HMILevel::eType hmi_level =
+ application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
const bool is_subscribed_for_way_points =
application_manager_.IsAppSubscribedForWayPoints(application);
- sync_primitives::AutoLock autolock(resumption_lock_);
Json::Value tmp;
- Json::Value& json_app = GetFromSavedOrAppend(policy_app_id, device_mac);
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& json_app =
+ GetFromSavedOrAppend(policy_app_id, device_mac, dictionary);
json_app[strings::device_id] = device_mac;
json_app[strings::app_id] = policy_app_id;
@@ -81,39 +85,45 @@ void ResumptionDataJson::SaveApplication(
json_app[strings::hmi_level] = static_cast<int32_t>(hmi_level);
json_app[strings::ign_off_count] = 0;
json_app[strings::hash_id] = hash;
- Formatters::CFormatterJsonBase::objToJsonValue(
+ formatters::CFormatterJsonBase::objToJsonValue(
GetApplicationCommands(application), tmp);
json_app[strings::application_commands] = tmp;
- Formatters::CFormatterJsonBase::objToJsonValue(
+ formatters::CFormatterJsonBase::objToJsonValue(
GetApplicationSubMenus(application), tmp);
json_app[strings::application_submenus] = tmp;
- Formatters::CFormatterJsonBase::objToJsonValue(
+ formatters::CFormatterJsonBase::objToJsonValue(
GetApplicationInteractionChoiseSets(application), tmp);
json_app[strings::application_choice_sets] = tmp;
- Formatters::CFormatterJsonBase::objToJsonValue(
+ formatters::CFormatterJsonBase::objToJsonValue(
GetApplicationGlobalProperties(application), tmp);
json_app[strings::application_global_properties] = tmp;
- Formatters::CFormatterJsonBase::objToJsonValue(
+ formatters::CFormatterJsonBase::objToJsonValue(
GetApplicationSubscriptions(application), tmp);
json_app[strings::application_subscriptions] = tmp;
- Formatters::CFormatterJsonBase::objToJsonValue(
+ formatters::CFormatterJsonBase::objToJsonValue(
GetApplicationFiles(application), tmp);
json_app[strings::application_files] = tmp;
+ formatters::CFormatterJsonBase::objToJsonValue(
+ GetApplicationWidgetsInfo(application), tmp);
+ json_app[strings::windows_info] = tmp;
json_app[strings::time_stamp] = time_stamp;
json_app[strings::subscribed_for_way_points] = is_subscribed_for_way_points;
+ accessor.GetMutableData().set_dictionary(dictionary);
LOG4CXX_DEBUG(logger_, "SaveApplication : " << json_app.toStyledString());
}
bool ResumptionDataJson::IsHMIApplicationIdExist(uint32_t hmi_app_id) const {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end();
- ++it) {
- if ((*it).isMember(strings::hmi_app_id)) {
- if ((*it)[strings::hmi_app_id].asUInt() == hmi_app_id) {
+
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ const Json::Value& saved_apps = GetSavedApplications(dictionary);
+
+ for (const auto& saved_app : saved_apps) {
+ if (saved_app.isMember(strings::hmi_app_id)) {
+ if (saved_app[strings::hmi_app_id].asUInt() == hmi_app_id) {
return true;
}
}
@@ -125,7 +135,7 @@ uint32_t ResumptionDataJson::GetHMIApplicationID(
const std::string& policy_app_id, const std::string& device_id) const {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
+
uint32_t hmi_app_id = 0;
const int idx = GetObjectIndex(policy_app_id, device_id);
@@ -133,8 +143,9 @@ uint32_t ResumptionDataJson::GetHMIApplicationID(
LOG4CXX_WARN(logger_, "Application not saved");
return hmi_app_id;
}
-
- const Json::Value& json_app = GetSavedApplications()[idx];
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ const Json::Value& json_app = GetSavedApplications(dictionary)[idx];
if (json_app.isMember(strings::app_id) &&
json_app.isMember(strings::device_id)) {
hmi_app_id = json_app[strings::hmi_app_id].asUInt();
@@ -143,54 +154,54 @@ uint32_t ResumptionDataJson::GetHMIApplicationID(
return hmi_app_id;
}
-DEPRECATED void ResumptionDataJson::OnSuspend() {}
-
void ResumptionDataJson::IncrementIgnOffCount() {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
+
Json::Value to_save = Json::arrayValue;
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end();
- ++it) {
- if ((*it).isMember(strings::ign_off_count)) {
- Json::Value& ign_off_count = (*it)[strings::ign_off_count];
+ Json::Value dictionary;
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ dictionary = accessor.GetData().dictionary();
+ Json::Value& saved_apps = GetSavedApplications(dictionary);
+ for (auto& json_app : saved_apps) {
+ if (json_app.isMember(strings::ign_off_count)) {
+ Json::Value& ign_off_count = json_app[strings::ign_off_count];
const uint32_t counter_value = ign_off_count.asUInt();
ign_off_count = counter_value + 1;
} else {
LOG4CXX_WARN(logger_, "Unknown key among saved applications");
- Json::Value& ign_off_count = (*it)[strings::ign_off_count];
+ Json::Value& ign_off_count = json_app[strings::ign_off_count];
ign_off_count = 1;
}
- to_save.append(*it);
+ to_save.append(json_app);
}
- SetSavedApplication(to_save);
- SetLastIgnOffTime(time(NULL));
- LOG4CXX_DEBUG(logger_, GetResumptionData().toStyledString());
+ SetSavedApplication(to_save, dictionary);
+ SetLastIgnOffTime(time(nullptr), dictionary);
+ accessor.GetMutableData().set_dictionary(dictionary);
+ LOG4CXX_DEBUG(logger_, GetResumptionData(dictionary).toStyledString());
}
-DEPRECATED void ResumptionDataJson::OnAwake() {}
-
void ResumptionDataJson::DecrementIgnOffCount() {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end();
- ++it) {
- if ((*it).isMember(strings::ign_off_count)) {
- const uint32_t ign_off_count = (*it)[strings::ign_off_count].asUInt();
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& saved_apps = GetSavedApplications(dictionary);
+ for (auto& saved_app : saved_apps) {
+ if (saved_app.isMember(strings::ign_off_count)) {
+ const uint32_t ign_off_count = saved_app[strings::ign_off_count].asUInt();
if (0 == ign_off_count) {
LOG4CXX_WARN(logger_, "Application has not been suspended");
} else {
- (*it)[strings::ign_off_count] = ign_off_count - 1;
+ saved_app[strings::ign_off_count] = ign_off_count - 1;
}
} else {
LOG4CXX_WARN(logger_, "Unknown key among saved applications");
- (*it)[strings::ign_off_count] = 0;
+ saved_app[strings::ign_off_count] = 0;
}
}
+ accessor.GetMutableData().set_dictionary(dictionary);
}
bool ResumptionDataJson::GetHashId(const std::string& policy_app_id,
@@ -198,14 +209,16 @@ bool ResumptionDataJson::GetHashId(const std::string& policy_app_id,
std::string& hash_id) const {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
+
const int idx = GetObjectIndex(policy_app_id, device_id);
if (-1 == idx) {
LOG4CXX_WARN(logger_, "Application not saved");
return false;
}
- const Json::Value& json_app = GetSavedApplications()[idx];
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ const Json::Value& json_app = GetSavedApplications(dictionary)[idx];
LOG4CXX_DEBUG(logger_,
"Saved_application_data: " << json_app.toStyledString());
if (json_app.isMember(strings::hash_id) &&
@@ -223,13 +236,15 @@ bool ResumptionDataJson::GetSavedApplication(
smart_objects::SmartObject& saved_app) const {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
+
const int idx = GetObjectIndex(policy_app_id, device_id);
if (-1 == idx) {
return false;
}
- const Json::Value& json_saved_app = GetSavedApplications()[idx];
- Formatters::CFormatterJsonBase::jsonValueToObj(json_saved_app, saved_app);
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ const Json::Value& json_saved_app = GetSavedApplications(dictionary)[idx];
+ formatters::CFormatterJsonBase::jsonValueToObj(json_saved_app, saved_app);
return true;
}
@@ -238,96 +253,156 @@ bool ResumptionDataJson::RemoveApplicationFromSaved(
const std::string& policy_app_id, const std::string& device_id) {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
+
bool result = false;
std::vector<Json::Value> temp;
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end();
- ++it) {
- if ((*it).isMember(strings::app_id) && (*it).isMember(strings::device_id)) {
- const std::string& saved_policy_app_id =
- (*it)[strings::app_id].asString();
- const std::string& saved_device_id = (*it)[strings::device_id].asString();
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& saved_apps = GetSavedApplications(dictionary);
+ for (auto& app : saved_apps) {
+ if (app.isMember(strings::app_id) && app.isMember(strings::device_id)) {
+ const std::string& saved_policy_app_id = app[strings::app_id].asString();
+ const std::string& saved_device_id = app[strings::device_id].asString();
if (saved_policy_app_id == policy_app_id &&
saved_device_id == device_id) {
result = true;
} else {
- temp.push_back((*it));
+ temp.push_back(app);
}
}
}
if (false == result) {
LOG4CXX_TRACE(logger_, "EXIT result: " << (result ? "true" : "false"));
+ accessor.GetMutableData().set_dictionary(dictionary);
return result;
}
- GetSavedApplications().clear();
- for (std::vector<Json::Value>::iterator it = temp.begin(); it != temp.end();
- ++it) {
- GetSavedApplications().append((*it));
+ GetSavedApplications(dictionary).clear();
+ for (auto& app : temp) {
+ GetSavedApplications(dictionary).append(app);
}
LOG4CXX_TRACE(logger_, "EXIT result: " << (result ? "true" : "false"));
+ accessor.GetMutableData().set_dictionary(dictionary);
return result;
}
uint32_t ResumptionDataJson::GetIgnOffTime() const {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
- Json::Value& resumption = GetResumptionData();
+
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& resumption = GetResumptionData(dictionary);
if (!resumption.isMember(strings::last_ign_off_time)) {
resumption[strings::last_ign_off_time] = 0;
+ accessor.GetMutableData().set_dictionary(dictionary);
LOG4CXX_WARN(logger_, "last_save_time section is missed");
}
return resumption[strings::last_ign_off_time].asUInt();
}
+uint32_t ResumptionDataJson::GetGlobalIgnOnCounter() const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& resumption = GetResumptionData(dictionary);
+ if (resumption.isMember(strings::global_ign_on_counter)) {
+ const uint32_t global_ign_on_counter =
+ resumption[strings::global_ign_on_counter].asUInt();
+ LOG4CXX_DEBUG(logger_, "Global Ign On Counter = " << global_ign_on_counter);
+ return global_ign_on_counter;
+ }
+ return 1;
+}
+
+void ResumptionDataJson::IncrementGlobalIgnOnCounter() {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& resumption = GetResumptionData(dictionary);
+ if (resumption.isMember(strings::global_ign_on_counter)) {
+ const uint32_t global_ign_on_counter =
+ resumption[strings::global_ign_on_counter].asUInt();
+ LOG4CXX_DEBUG(
+ logger_,
+ "Global IGN ON counter in resumption data: " << global_ign_on_counter);
+ resumption[strings::global_ign_on_counter] = global_ign_on_counter + 1;
+ LOG4CXX_DEBUG(logger_,
+ "Global IGN ON counter new value: "
+ << resumption[strings::global_ign_on_counter].asUInt());
+ } else {
+ resumption[strings::global_ign_on_counter] = 1;
+ }
+ accessor.GetMutableData().set_dictionary(dictionary);
+ accessor.GetMutableData().SaveToFileSystem();
+}
+
+void ResumptionDataJson::ResetGlobalIgnOnCount() {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& resumption = GetResumptionData(dictionary);
+
+ resumption[strings::global_ign_on_counter] = 0;
+ accessor.GetMutableData().set_dictionary(dictionary);
+ LOG4CXX_DEBUG(logger_, "Global IGN ON counter resetting");
+}
+
ssize_t ResumptionDataJson::IsApplicationSaved(
const std::string& policy_app_id, const std::string& device_id) const {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
+
return GetObjectIndex(policy_app_id, device_id);
}
Json::Value& ResumptionDataJson::GetFromSavedOrAppend(
- const std::string& policy_app_id, const std::string& device_id) const {
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ Json::Value& dictionary) const {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end();
- ++it) {
- if (device_id == (*it)[strings::device_id].asString() &&
- policy_app_id == (*it)[strings::app_id].asString()) {
- return *it;
+
+ Json::Value& saved_apps = GetSavedApplications(dictionary);
+ for (auto& saved_app : saved_apps) {
+ if (device_id == saved_app[strings::device_id].asString() &&
+ policy_app_id == saved_app[strings::app_id].asString()) {
+ return saved_app;
}
}
- return GetSavedApplications().append(Json::Value());
+ return GetSavedApplications(dictionary).append(Json::Value());
}
void ResumptionDataJson::GetDataForLoadResumeData(
smart_objects::SmartObject& saved_data) const {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
+
smart_objects::SmartObject so_array_data(smart_objects::SmartType_Array);
int i = 0;
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end();
- ++it) {
- if (((*it).isMember(strings::hmi_level)) &&
- ((*it).isMember(strings::ign_off_count)) &&
- ((*it).isMember(strings::time_stamp)) &&
- ((*it).isMember(strings::app_id)) &&
- ((*it).isMember(strings::device_id))) {
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& saved_apps = GetSavedApplications(dictionary);
+
+ for (auto& saved_app : saved_apps) {
+ if ((saved_app.isMember(strings::hmi_level)) &&
+ (saved_app.isMember(strings::ign_off_count)) &&
+ (saved_app.isMember(strings::time_stamp)) &&
+ (saved_app.isMember(strings::app_id)) &&
+ (saved_app.isMember(strings::device_id))) {
smart_objects::SmartObject so(smart_objects::SmartType_Map);
- so[strings::hmi_level] = (*it)[strings::hmi_level].asInt();
- so[strings::ign_off_count] = (*it)[strings::ign_off_count].asInt();
- so[strings::time_stamp] = (*it)[strings::time_stamp].asUInt();
- so[strings::app_id] = (*it)[strings::app_id].asString();
- so[strings::device_id] = (*it)[strings::device_id].asString();
+ so[strings::hmi_level] = saved_app[strings::hmi_level].asInt();
+ so[strings::ign_off_count] = saved_app[strings::ign_off_count].asInt();
+ so[strings::time_stamp] = saved_app[strings::time_stamp].asUInt();
+ so[strings::app_id] = saved_app[strings::app_id].asString();
+ so[strings::device_id] = saved_app[strings::device_id].asString();
so_array_data[i++] = so;
}
}
@@ -352,14 +427,18 @@ void ResumptionDataJson::UpdateHmiLevel(
<< policy_app_id << " device_id = " << device_id);
return;
}
- GetSavedApplications()[idx][strings::hmi_level] = hmi_level;
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ GetSavedApplications(dictionary)[idx][strings::hmi_level] = hmi_level;
+ accessor.GetMutableData().set_dictionary(dictionary);
}
-Json::Value& ResumptionDataJson::GetSavedApplications() const {
+Json::Value& ResumptionDataJson::GetSavedApplications(
+ Json::Value& dictionary) const {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
- Json::Value& resumption = GetResumptionData();
+
+ Json::Value& resumption = GetResumptionData(dictionary);
if (!resumption.isMember(strings::resume_app_list)) {
resumption[strings::resume_app_list] = Json::Value(Json::arrayValue);
LOG4CXX_WARN(logger_, "app_list section is missed");
@@ -372,11 +451,11 @@ Json::Value& ResumptionDataJson::GetSavedApplications() const {
return resume_app_list;
}
-Json::Value& ResumptionDataJson::GetResumptionData() const {
+Json::Value& ResumptionDataJson::GetResumptionData(
+ Json::Value& dictionary) const {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
- Json::Value& dictionary = last_state().get_dictionary();
+
if (!dictionary.isMember(strings::resumption)) {
dictionary[strings::resumption] = Json::Value(Json::objectValue);
LOG4CXX_WARN(logger_, "resumption section is missed");
@@ -393,8 +472,10 @@ ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id,
const std::string& device_id) const {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
- const Json::Value& apps = GetSavedApplications();
+
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ const Json::Value& apps = GetSavedApplications(dictionary);
const Json::ArrayIndex size = apps.size();
Json::ArrayIndex idx = 0;
for (; idx != size; ++idx) {
@@ -415,8 +496,10 @@ ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id,
bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
- const Json::Value& json_app = GetSavedApplications()[index];
+
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ const Json::Value& json_app = GetSavedApplications(dictionary)[index];
if (!json_app.isMember(strings::app_id) ||
!json_app.isMember(strings::ign_off_count) ||
!json_app.isMember(strings::hmi_level) ||
@@ -436,19 +519,21 @@ bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const {
return true;
}
-void ResumptionDataJson::SetSavedApplication(Json::Value& apps_json) {
+void ResumptionDataJson::SetSavedApplication(Json::Value& apps_json,
+ Json::Value& dictionary) {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
- Json::Value& app_list = GetSavedApplications();
+
+ Json::Value& app_list = GetSavedApplications(dictionary);
app_list = apps_json;
}
-void ResumptionDataJson::SetLastIgnOffTime(time_t ign_off_time) {
+void ResumptionDataJson::SetLastIgnOffTime(time_t ign_off_time,
+ Json::Value& dictionary) {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(resumption_lock_);
+
LOG4CXX_WARN(logger_, "ign_off_time = " << ign_off_time);
- Json::Value& resumption = GetResumptionData();
+ Json::Value& resumption = GetResumptionData(dictionary);
resumption[strings::last_ign_off_time] = static_cast<uint32_t>(ign_off_time);
}
@@ -461,8 +546,11 @@ bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id,
const std::string& app_id) {
LOG4CXX_AUTO_TRACE(logger_);
using namespace app_mngr;
- sync_primitives::AutoLock autolock(resumption_lock_);
- Json::Value& application = GetFromSavedOrAppend(app_id, device_id);
+
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& application =
+ GetFromSavedOrAppend(app_id, device_id, dictionary);
if (application.isNull()) {
LOG4CXX_DEBUG(logger_,
"Application " << app_id << " with device_id " << device_id
@@ -476,6 +564,7 @@ bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id,
application[strings::application_subscriptions].clear();
application[strings::application_files].clear();
application.removeMember(strings::grammar_id);
+ accessor.GetMutableData().set_dictionary(dictionary);
LOG4CXX_DEBUG(logger_,
"Resumption data for application "
<< app_id << " with device_id " << device_id
@@ -484,10 +573,11 @@ bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id,
}
void ResumptionDataJson::Persist() {
- // We lock the resumption data because SaveStateToFileSystem accesses
- // the same dictionary that we use here in ResumptionDataJson
- sync_primitives::AutoLock autolock(resumption_lock_);
- last_state().SaveStateToFileSystem();
+ last_state_wrapper_->get_accessor().GetMutableData().SaveToFileSystem();
+}
+
+LastState& ResumptionDataJson::last_state() const {
+ return last_state_wrapper_->get_accessor().GetMutableData();
}
-} // resumption
+} // namespace resumption
diff --git a/src/components/application_manager/src/resumption/resumption_sql_queries.cc b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
index 9ca91e859a..4770bafef4 100644
--- a/src/components/application_manager/src/resumption/resumption_sql_queries.cc
+++ b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
@@ -37,6 +37,7 @@ const std::string kCreateSchema =
"BEGIN ; "
"CREATE TABLE IF NOT EXISTS `resumption`( "
" `idresumption` INTEGER PRIMARY KEY, "
+ " `global_ign_on_count` INTEGER, "
" `last_ign_off_time` INTEGER "
" ); "
"CREATE TABLE IF NOT EXISTS `subscribedForWayPoints`( "
@@ -372,7 +373,9 @@ const std::string kDropSchema =
"VACUUM;";
const std::string kInsertInitData =
- "INSERT OR IGNORE INTO `resumption` (`last_ign_off_time`) VALUES (0); "
+ "INSERT OR IGNORE INTO `resumption` "
+ "(`last_ign_off_time`, `global_ign_on_count`) "
+ "VALUES (0, 0); "
"INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); ";
const std::string kChecksResumptionData =
@@ -410,6 +413,17 @@ const std::string kSelectHashId =
const std::string kSelectIgnOffTime =
"SELECT `last_ign_off_time` FROM `resumption`";
+const std::string kSelectGlobalIgnOnCounter =
+ "SELECT `global_ign_on_count` FROM `resumption`";
+
+const std::string kResetGlobalIgnOnCount =
+ "UPDATE `resumption` "
+ "SET `global_ign_on_count` = 0";
+
+const std::string kUpdateGlobalIgnOnCount =
+ "UPDATE `resumption` "
+ "SET `global_ign_on_count` = `global_ign_on_count` + 1 ";
+
const std::string kCheckApplication =
"SELECT COUNT (`deviceID`) FROM `application` "
"WHERE `deviceID` = ? AND `appID` = ?";
@@ -445,7 +459,7 @@ const std::string kUpdateSuspendData =
"UPDATE `application` "
"SET `ign_off_count` = `ign_off_count` + 1";
-const std::string KUpdateLastIgnOffTime =
+const std::string kUpdateLastIgnOffTime =
"UPDATE `resumption` "
"SET `last_ign_off_time` = ?";
diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc
index 5cf5500709..0a62bc8498 100644
--- a/src/components/application_manager/src/rpc_handler_impl.cc
+++ b/src/components/application_manager/src/rpc_handler_impl.cc
@@ -31,20 +31,25 @@
*/
#include "application_manager/rpc_handler_impl.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/plugin_manager/plugin_keys.h"
namespace application_manager {
namespace rpc_handler {
CREATE_LOGGERPTR_LOCAL(logger_, "RPCHandlerImpl")
-namespace formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
-namespace jhs = NsSmartDeviceLink::NsJSONHandler::strings;
+namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
+namespace jhs = ns_smart_device_link::ns_json_handler::strings;
+namespace plugin_names = application_manager::plugin_manager::plugin_names;
-RPCHandlerImpl::RPCHandlerImpl(ApplicationManager& app_manager)
+RPCHandlerImpl::RPCHandlerImpl(ApplicationManager& app_manager,
+ hmi_apis::HMI_API& hmi_so_factory,
+ mobile_apis::MOBILE_API& mobile_so_factory)
: app_manager_(app_manager)
, messages_from_mobile_("AM FromMobile", this)
, messages_from_hmi_("AM FromHMI", this)
- , hmi_so_factory_(hmi_apis::HMI_API())
- , mobile_so_factory_(mobile_apis::MOBILE_API())
+ , hmi_so_factory_(hmi_so_factory)
+ , mobile_so_factory_(mobile_so_factory)
#ifdef TELEMETRY_MONITOR
, metric_observer_(NULL)
#endif // TELEMETRY_MONITOR
@@ -54,26 +59,85 @@ RPCHandlerImpl::RPCHandlerImpl(ApplicationManager& app_manager)
RPCHandlerImpl::~RPCHandlerImpl() {}
void RPCHandlerImpl::ProcessMessageFromMobile(
- const utils::SharedPtr<Message> message) {
+ const std::shared_ptr<Message> message) {
LOG4CXX_AUTO_TRACE(logger_);
#ifdef TELEMETRY_MONITOR
AMTelemetryObserver::MessageMetricSharedPtr metric(
new AMTelemetryObserver::MessageMetric());
- metric->begin = date_time::DateTime::getCurrentTime();
+ metric->begin = date_time::getCurrentTime();
#endif // TELEMETRY_MONITOR
smart_objects::SmartObjectSPtr so_from_mobile =
- utils::MakeShared<smart_objects::SmartObject>();
-
+ std::make_shared<smart_objects::SmartObject>();
+ bool allow_unknown_parameters = false;
DCHECK_OR_RETURN_VOID(so_from_mobile);
if (!so_from_mobile) {
LOG4CXX_ERROR(logger_, "Null pointer");
return;
}
- if (!ConvertMessageToSO(*message, *so_from_mobile)) {
+ if (message->type() == application_manager::MessageType::kRequest &&
+ message->correlation_id() < 0) {
+ LOG4CXX_ERROR(logger_, "Request correlation id < 0. Returning INVALID_ID");
+ std::shared_ptr<smart_objects::SmartObject> response(
+ MessageHelper::CreateNegativeResponse(message->connection_key(),
+ message->function_id(),
+ 0,
+ mobile_apis::Result::INVALID_ID));
+ // CreateNegativeResponse() takes a uint32_t for correlation_id, therefore a
+ // negative number cannot be passed to that function or else it will be
+ // improperly cast. correlation_id is reassigned below to its original
+ // value.
+ (*response)[strings::params][strings::correlation_id] =
+ message->correlation_id();
+ (*response)[strings::msg_params][strings::info] =
+ "Invalid Correlation ID for RPC Request";
+ app_manager_.GetRPCService().ManageMobileCommand(
+ response, commands::Command::SOURCE_SDL);
+ return;
+ }
+
+ bool rpc_passing = app_manager_.GetAppServiceManager()
+ .GetRPCPassingHandler()
+ .CanHandleFunctionID(message->function_id());
+ if (app_manager_.GetRPCService().IsAppServiceRPC(
+ message->function_id(), commands::Command::SOURCE_MOBILE) ||
+ rpc_passing) {
+ LOG4CXX_DEBUG(logger_,
+ "Allowing unknown parameters for request function "
+ << message->function_id());
+ allow_unknown_parameters = true;
+ }
+
+ if (!ConvertMessageToSO(
+ *message, *so_from_mobile, allow_unknown_parameters, !rpc_passing)) {
LOG4CXX_ERROR(logger_, "Cannot create smart object from message");
return;
}
+
+ if (rpc_passing) {
+ uint32_t correlation_id =
+ (*so_from_mobile)[strings::params][strings::correlation_id].asUInt();
+ int32_t message_type =
+ (*so_from_mobile)[strings::params][strings::message_type].asInt();
+ RPCPassingHandler& handler =
+ app_manager_.GetAppServiceManager().GetRPCPassingHandler();
+ // Check permissions for requests, otherwise attempt passthrough
+ if ((application_manager::MessageType::kRequest != message_type ||
+ handler.IsPassthroughAllowed(*so_from_mobile)) &&
+ handler.RPCPassThrough(*so_from_mobile)) {
+ // RPC was forwarded. Skip handling by Core
+ return;
+ } else if (!handler.IsPassThroughMessage(correlation_id,
+ commands::Command::SOURCE_MOBILE,
+ message_type)) {
+ // Since PassThrough failed, refiltering the message
+ if (!ConvertMessageToSO(*message, *so_from_mobile)) {
+ LOG4CXX_ERROR(logger_, "Cannot create smart object from message");
+ return;
+ }
+ }
+ }
+
#ifdef TELEMETRY_MONITOR
metric->message = so_from_mobile;
#endif // TELEMETRY_MONITOR
@@ -83,7 +147,7 @@ void RPCHandlerImpl::ProcessMessageFromMobile(
LOG4CXX_ERROR(logger_, "Received command didn't run successfully");
}
#ifdef TELEMETRY_MONITOR
- metric->end = date_time::DateTime::getCurrentTime();
+ metric->end = date_time::getCurrentTime();
if (metric_observer_) {
metric_observer_->OnMessage(metric);
}
@@ -91,19 +155,28 @@ void RPCHandlerImpl::ProcessMessageFromMobile(
}
void RPCHandlerImpl::ProcessMessageFromHMI(
- const utils::SharedPtr<Message> message) {
+ const std::shared_ptr<Message> message) {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr smart_object(new smart_objects::SmartObject);
-
- if (!smart_object) {
- LOG4CXX_ERROR(logger_, "Null pointer");
- return;
+ smart_objects::SmartObjectSPtr smart_object =
+ std::make_shared<smart_objects::SmartObject>();
+ bool allow_unknown_parameters = false;
+
+ smart_objects::SmartObject converted_result;
+ formatters::FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
+ hmi_apis::messageType::eType>(
+ message->json_message(), converted_result);
+
+ const auto function_id = static_cast<int32_t>(
+ converted_result[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
+ if (app_manager_.GetRPCService().IsAppServiceRPC(
+ function_id, commands::Command::SOURCE_HMI)) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Allowing unknown parameters for request function " << function_id);
+ allow_unknown_parameters = true;
}
-#ifdef HMI_DBUS_API
- *smart_object = message->smart_object();
-#else
- if (!ConvertMessageToSO(*message, *smart_object)) {
+ if (!ConvertMessageToSO(*message, *smart_object, allow_unknown_parameters)) {
if (application_manager::MessageType::kResponse ==
(*smart_object)[strings::params][strings::message_type].asInt()) {
(*smart_object).erase(strings::msg_params);
@@ -116,13 +189,13 @@ void RPCHandlerImpl::ProcessMessageFromHMI(
return;
}
}
-#endif // HMI_DBUS_API
LOG4CXX_DEBUG(logger_, "Converted message, trying to create hmi command");
if (!app_manager_.GetRPCService().ManageHMICommand(smart_object)) {
LOG4CXX_ERROR(logger_, "Received command didn't run successfully");
}
}
+
void RPCHandlerImpl::Handle(const impl::MessageFromMobile message) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -134,6 +207,10 @@ void RPCHandlerImpl::Handle(const impl::MessageFromMobile message) {
LOG4CXX_INFO(logger_, "Application manager is stopping");
return;
}
+ if (app_manager_.IsLowVoltage()) {
+ LOG4CXX_ERROR(logger_, "Low Voltage is active.");
+ return;
+ }
ProcessMessageFromMobile(message);
}
@@ -145,6 +222,11 @@ void RPCHandlerImpl::Handle(const impl::MessageFromHmi message) {
LOG4CXX_ERROR(logger_, "Null-pointer message received.");
return;
}
+ if (app_manager_.IsLowVoltage()) {
+ LOG4CXX_ERROR(logger_, "Low Voltage is active.");
+ return;
+ }
+
ProcessMessageFromHMI(message);
}
@@ -152,13 +234,18 @@ void RPCHandlerImpl::OnMessageReceived(
const protocol_handler::RawMessagePtr message) {
LOG4CXX_AUTO_TRACE(logger_);
+ if (app_manager_.IsLowVoltage()) {
+ LOG4CXX_ERROR(logger_, "Low Voltage is active.");
+ return;
+ }
+
if (!message) {
LOG4CXX_ERROR(logger_, "Null-pointer message received.");
NOTREACHED();
return;
}
- utils::SharedPtr<Message> outgoing_message = ConvertRawMsgToMessage(message);
+ std::shared_ptr<Message> outgoing_message = ConvertRawMsgToMessage(message);
if (outgoing_message) {
LOG4CXX_DEBUG(logger_, "Posting new Message");
@@ -197,9 +284,44 @@ void RPCHandlerImpl::SetTelemetryObserver(AMTelemetryObserver* observer) {
#endif // TELEMETRY_MONITOR
+void RPCHandlerImpl::GetMessageVersion(
+ ns_smart_device_link::ns_smart_objects::SmartObject& output,
+ utils::SemanticVersion& message_version) {
+ if (output.keyExists(
+ ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS) &&
+ output[ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS]
+ .keyExists(strings::sync_msg_version)) {
+ // SyncMsgVersion exists, check if it is valid.
+ auto sync_msg_version =
+ output[ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS]
+ [strings::sync_msg_version];
+ uint16_t major = 0;
+ uint16_t minor = 0;
+ uint16_t patch = 0;
+ if (sync_msg_version.keyExists(strings::major_version)) {
+ major = sync_msg_version[strings::major_version].asUInt();
+ }
+ if (sync_msg_version.keyExists(strings::minor_version)) {
+ minor = sync_msg_version[strings::minor_version].asUInt();
+ }
+ if (sync_msg_version.keyExists(strings::patch_version)) {
+ patch = sync_msg_version[strings::patch_version].asUInt();
+ }
+
+ utils::SemanticVersion temp_version(major, minor, patch);
+ if (temp_version.isValid()) {
+ message_version = (temp_version >= utils::rpc_version_5)
+ ? temp_version
+ : utils::base_rpc_version;
+ }
+ }
+}
+
bool RPCHandlerImpl::ConvertMessageToSO(
const Message& message,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& output) {
+ ns_smart_device_link::ns_smart_objects::SmartObject& output,
+ const bool allow_unknown_parameters,
+ const bool validate_params) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_,
"\t\t\tMessage to convert: protocol "
@@ -218,22 +340,44 @@ bool RPCHandlerImpl::ConvertMessageToSO(
message.function_id(),
message.type(),
message.correlation_id());
+
+ rpc::ValidationReport report("RPC");
+
+ // Attach RPC version to SmartObject if it does not exist yet.
+ auto app_ptr = app_manager_.application(message.connection_key());
+ utils::SemanticVersion msg_version(0, 0, 0);
+ if (app_ptr) {
+ msg_version = app_ptr->msg_version();
+ } else if (mobile_apis::FunctionID::RegisterAppInterfaceID ==
+ static_cast<mobile_apis::FunctionID::eType>(
+ output[strings::params][strings::function_id].asInt())) {
+ GetMessageVersion(output, msg_version);
+ }
+
if (!conversion_result ||
- !mobile_so_factory().attachSchema(output, true) ||
- ((output.validate() != smart_objects::Errors::OK))) {
+ (validate_params &&
+ !ValidateRpcSO(
+ output, msg_version, report, allow_unknown_parameters))) {
LOG4CXX_WARN(logger_,
- "Failed to parse string to smart object :"
+ "Failed to parse string to smart object with API version "
+ << msg_version.toString() << " : "
<< message.json_message());
- utils::SharedPtr<smart_objects::SmartObject> response(
+
+ std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
message.connection_key(),
message.function_id(),
message.correlation_id(),
mobile_apis::Result::INVALID_DATA));
+
+ (*response)[strings::msg_params][strings::info] =
+ rpc::PrettyFormat(report);
app_manager_.GetRPCService().ManageMobileCommand(
response, commands::Command::SOURCE_SDL);
+
return false;
}
+
LOG4CXX_DEBUG(logger_,
"Convertion result for sdl object is true function_id "
<< output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
@@ -249,7 +393,7 @@ bool RPCHandlerImpl::ConvertMessageToSO(
<< " binary size should be " << message.data_size()
<< " payload data size is "
<< message.payload_size());
- utils::SharedPtr<smart_objects::SmartObject> response(
+ std::shared_ptr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
message.connection_key(),
message.function_id(),
@@ -275,26 +419,36 @@ bool RPCHandlerImpl::ConvertMessageToSO(
"Convertion result: "
<< result << " function id "
<< output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
- if (!hmi_so_factory().attachSchema(output, false)) {
+ if (!hmi_so_factory().attachSchema(output, true)) {
LOG4CXX_WARN(logger_, "Failed to attach schema to object.");
return false;
}
- if (output.validate() != smart_objects::Errors::OK) {
- LOG4CXX_ERROR(logger_, "Incorrect parameter from HMI");
- return false;
+
+ rpc::ValidationReport report("RPC");
+
+ utils::SemanticVersion empty_version;
+ if (validate_params &&
+ smart_objects::errors::OK !=
+ output.validate(
+ &report, empty_version, allow_unknown_parameters)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Incorrect parameter from HMI - " << rpc::PrettyFormat(report));
+
+ return HandleWrongMessageType(output, report);
}
break;
}
case protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1: {
- static NsSmartDeviceLinkRPC::V1::v4_protocol_v1_2_no_extra v1_shema;
+ static ns_smart_device_link_rpc::V1::v4_protocol_v1_2_no_extra v1_shema;
if (message.function_id() == 0 || message.type() == kUnknownType) {
LOG4CXX_ERROR(logger_, "Message received: UNSUPPORTED_VERSION");
int32_t conversation_result =
formatters::CFormatterJsonSDLRPCv1::fromString<
- NsSmartDeviceLinkRPC::V1::FunctionID::eType,
- NsSmartDeviceLinkRPC::V1::messageType::eType>(
+ ns_smart_device_link_rpc::V1::FunctionID::eType,
+ ns_smart_device_link_rpc::V1::messageType::eType>(
message.json_message(), output);
if (formatters::CFormatterJsonSDLRPCv1::kSuccess ==
@@ -303,7 +457,7 @@ bool RPCHandlerImpl::ConvertMessageToSO(
smart_objects::SmartType::SmartType_Map);
output[strings::params][strings::message_type] =
- NsSmartDeviceLinkRPC::V1::messageType::response;
+ ns_smart_device_link_rpc::V1::messageType::response;
output[strings::params][strings::connection_key] =
message.connection_key();
@@ -311,10 +465,10 @@ bool RPCHandlerImpl::ConvertMessageToSO(
smart_objects::SmartType::SmartType_Map);
output[strings::msg_params][strings::success] = false;
output[strings::msg_params][strings::result_code] =
- NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION;
+ ns_smart_device_link_rpc::V1::Result::UNSUPPORTED_VERSION;
smart_objects::SmartObjectSPtr msg_to_send =
- new smart_objects::SmartObject(output);
+ std::make_shared<smart_objects::SmartObject>(output);
v1_shema.attachSchema(*msg_to_send, false);
app_manager_.GetRPCService().SendMessageToMobile(msg_to_send);
return false;
@@ -328,16 +482,72 @@ bool RPCHandlerImpl::ConvertMessageToSO(
<< message.protocol_version() << ".");
return false;
}
+ output[strings::params][strings::protection] = message.is_message_encrypted();
LOG4CXX_DEBUG(logger_, "Successfully parsed message into smart object");
return true;
}
-utils::SharedPtr<Message> RPCHandlerImpl::ConvertRawMsgToMessage(
+bool RPCHandlerImpl::HandleWrongMessageType(
+ smart_objects::SmartObject& output, rpc::ValidationReport report) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ switch (output[strings::params][strings::message_type].asInt()) {
+ case application_manager::MessageType::kNotification: {
+ LOG4CXX_ERROR(logger_, "Ignore wrong HMI notification");
+ return false;
+ }
+ case application_manager::MessageType::kRequest: {
+ LOG4CXX_ERROR(logger_, "Received invalid data on HMI request");
+ output.erase(strings::msg_params);
+ output[strings::params].erase(hmi_response::message);
+ output[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::INVALID_DATA;
+ output[strings::params][strings::message_type] =
+ MessageType::kErrorResponse;
+ output[strings::params][strings::error_msg] = rpc::PrettyFormat(report);
+ return true;
+ }
+ case application_manager::MessageType::kResponse: {
+ LOG4CXX_ERROR(logger_, "Received invalid data on HMI response");
+ break;
+ }
+ case application_manager::MessageType::kUnknownType: {
+ LOG4CXX_ERROR(logger_, "Received unknown type data on HMI");
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Received error response on HMI");
+ break;
+ }
+ }
+ output.erase(strings::msg_params);
+ output[strings::params].erase(hmi_response::message);
+ output[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+ output[strings::msg_params][strings::info] =
+ std::string("Invalid message received from vehicle");
+ return true;
+}
+
+bool RPCHandlerImpl::ValidateRpcSO(smart_objects::SmartObject& message,
+ utils::SemanticVersion& msg_version,
+ rpc::ValidationReport& report_out,
+ bool allow_unknown_parameters) {
+ if (!mobile_so_factory().attachSchema(
+ message, !allow_unknown_parameters, msg_version) ||
+ message.validate(&report_out, msg_version, allow_unknown_parameters) !=
+ smart_objects::errors::OK) {
+ LOG4CXX_WARN(logger_, "Failed to parse string to smart object");
+ return false;
+ }
+ return true;
+}
+
+std::shared_ptr<Message> RPCHandlerImpl::ConvertRawMsgToMessage(
const protocol_handler::RawMessagePtr message) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK(message);
- utils::SharedPtr<Message> outgoing_message;
+ std::shared_ptr<Message> outgoing_message;
LOG4CXX_DEBUG(logger_, "Service type." << message->service_type());
if (message->service_type() != protocol_handler::kRpc &&
@@ -351,10 +561,11 @@ utils::SharedPtr<Message> RPCHandlerImpl::ConvertRawMsgToMessage(
MobileMessageHandler::HandleIncomingMessageProtocol(message);
if (convertion_result) {
- outgoing_message = convertion_result;
+ outgoing_message = std::shared_ptr<Message>(convertion_result);
} else {
LOG4CXX_ERROR(logger_, "Received invalid message");
}
+
return outgoing_message;
}
@@ -365,5 +576,5 @@ hmi_apis::HMI_API& RPCHandlerImpl::hmi_so_factory() {
mobile_apis::MOBILE_API& RPCHandlerImpl::mobile_so_factory() {
return mobile_so_factory_;
}
-}
-}
+} // namespace rpc_handler
+} // namespace application_manager
diff --git a/src/components/application_manager/src/rpc_passing_handler.cc b/src/components/application_manager/src/rpc_passing_handler.cc
new file mode 100644
index 0000000000..7f72632bb1
--- /dev/null
+++ b/src/components/application_manager/src/rpc_passing_handler.cc
@@ -0,0 +1,444 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/help_prompt_manager_impl.h"
+
+#include <algorithm>
+#include <iterator>
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/rpc_handler.h"
+#include "application_manager/rpc_passing_handler.h"
+#include "application_manager/smart_object_keys.h"
+#include "encryption/hashing.h"
+#include "resumption/last_state.h"
+#include "smart_objects/enum_schema_item.h"
+#include "utils/logger.h"
+
+#include "smart_objects/enum_schema_item.h"
+#include "utils/timer_task_impl.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "RPCPassingHandler")
+
+namespace application_manager {
+
+RPCPassingHandler::RPCPassingHandler(AppServiceManager& asm_ref,
+ ApplicationManager& am_ref)
+ : app_service_manager_(asm_ref), app_manager_(am_ref) {}
+
+RPCPassingHandler::~RPCPassingHandler() {}
+
+bool RPCPassingHandler::IsPassThroughMessage(
+ uint32_t correlation_id,
+ commands::Command::CommandSource source,
+ int32_t message_type) {
+ sync_primitives::AutoLock lock(rpc_request_queue_lock_);
+
+ if (rpc_request_queue.find(correlation_id) != rpc_request_queue.end()) {
+ if (message_type == MessageType::kResponse &&
+ source == commands::Command::CommandSource::SOURCE_SDL) {
+ // Checks if response is being sent to mobile then removes the correlation
+ // id from the map
+ rpc_request_queue.erase(correlation_id);
+ }
+ return true;
+ }
+ return false;
+}
+
+bool RPCPassingHandler::CanHandleFunctionID(int32_t function_id) {
+ auto services = app_service_manager_.GetActiveServices();
+ for (auto it = services.begin(); it != services.end(); ++it) {
+ auto handled_rpcs =
+ it->record[strings::service_manifest][strings::handled_rpcs];
+ for (size_t i = 0; i < handled_rpcs.length(); i++) {
+ if (handled_rpcs[i].asInt() == function_id) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool RPCPassingHandler::ExtractRPCParams(
+ const smart_objects::SmartObject& s_map,
+ const ApplicationSharedPtr app,
+ const std::string& function_id_str) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ RPCParams params;
+
+ if (smart_objects::SmartType_Map == s_map.getType()) {
+ for (auto iter = s_map.map_begin(); iter != s_map.map_end(); ++iter) {
+ LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first);
+ params.insert(iter->first);
+ }
+ }
+
+ CommandParametersPermissions parameters_permissions;
+ const WindowID window_id =
+ MessageHelper::ExtractWindowIdFromSmartObject(s_map);
+
+ mobile_apis::Result::eType check_result = app_manager_.CheckPolicyPermissions(
+ app, window_id, function_id_str, params, &parameters_permissions);
+
+ // Check if RPC is allowed by policy (since we are allowing unknown params,
+ // check should pass if only undefined parameters exist)
+ if (mobile_apis::Result::DISALLOWED == check_result &&
+ !parameters_permissions.undefined_params.empty() &&
+ parameters_permissions.disallowed_params.empty() &&
+ parameters_permissions.allowed_params.empty()) {
+ return true;
+ } else if (mobile_apis::Result::SUCCESS != check_result) {
+ return false;
+ }
+
+ return true;
+}
+
+bool RPCPassingHandler::IsPassthroughAllowed(
+ smart_objects::SmartObject rpc_message) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ uint32_t connection_key =
+ rpc_message[strings::params][strings::connection_key].asUInt();
+ ApplicationSharedPtr app = app_manager_.application(connection_key);
+ if (!app) {
+ return false;
+ }
+
+ mobile_api::FunctionID::eType function_id =
+ static_cast<mobile_api::FunctionID::eType>(
+ rpc_message[strings::params][strings::function_id].asInt());
+ std::string function_id_str =
+ MessageHelper::StringifiedFunctionID(function_id);
+ auto& policy_handler = app_manager_.GetPolicyHandler();
+
+ if (function_id_str.empty()) {
+ // Unknown RPC, just do basic revoked and user consent checks
+ std::string device_mac;
+ app_manager_.connection_handler().get_session_observer().GetDataOnDeviceID(
+ app->device(), NULL, NULL, &device_mac, NULL);
+ return policy_handler.UnknownRPCPassthroughAllowed(app->policy_app_id()) &&
+ !policy_handler.IsApplicationRevoked(app->policy_app_id()) &&
+ policy::kDeviceAllowed ==
+ app_manager_.GetUserConsentForDevice(device_mac);
+ }
+
+ return ExtractRPCParams(
+ rpc_message[strings::msg_params], app, function_id_str);
+}
+
+bool RPCPassingHandler::RPCPassThrough(smart_objects::SmartObject rpc_message) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ uint32_t correlation_id =
+ rpc_message[strings::params][strings::correlation_id].asUInt();
+ int32_t message_type =
+ rpc_message[strings::params][strings::message_type].asInt();
+
+ LOG4CXX_DEBUG(logger_, "RPC_PASSING: ");
+ MessageHelper::PrintSmartObject(rpc_message);
+
+ // Clear timers for timed out requests
+ ClearCompletedTimers();
+ switch (message_type) {
+ case MessageType::kRequest: {
+ LOG4CXX_DEBUG(logger_, "Handle request");
+ rpc_request_queue_lock_.Acquire();
+ if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) {
+ rpc_request_queue_lock_.Release();
+ LOG4CXX_DEBUG(
+ logger_,
+ "Correlation id DOES NOT exist in map. Constructing request queue");
+ PopulateRPCRequestQueue(rpc_message);
+ } else {
+ rpc_request_queue_lock_.Release();
+ LOG4CXX_DEBUG(logger_, "Correlation id DOES exist in map. Returning");
+ std::shared_ptr<smart_objects::SmartObject> response(
+ MessageHelper::CreateNegativeResponse(
+ rpc_message[strings::params][strings::connection_key].asUInt(),
+ rpc_message[strings::params][strings::function_id].asInt(),
+ correlation_id,
+ mobile_apis::Result::INVALID_ID));
+
+ (*response)[strings::msg_params][strings::info] =
+ "Duplicate correlation_id";
+ app_manager_.GetRPCService().ManageMobileCommand(
+ response, commands::Command::SOURCE_SDL);
+
+ return true;
+ }
+
+ rpc_request_queue_lock_.Acquire();
+ if (rpc_request_queue[correlation_id].second.empty()) {
+ LOG4CXX_DEBUG(logger_,
+ "No services left in map. Using core to handle request");
+ rpc_request_queue.erase(correlation_id);
+ rpc_request_queue_lock_.Release();
+ return false;
+ } else {
+ rpc_request_queue_lock_.Release();
+ ForwardRequestToMobile(correlation_id);
+ return true;
+ }
+
+ break;
+ }
+
+ case MessageType::kResponse: {
+ LOG4CXX_DEBUG(logger_, "Handle response");
+ rpc_request_queue_lock_.Acquire();
+ if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) {
+ rpc_request_queue_lock_.Release();
+ return false;
+ }
+ rpc_request_queue_lock_.Release();
+ RemoveRequestTimer(correlation_id);
+
+ mobile_apis::Result::eType result_code;
+ smart_objects::EnumConversionHelper<mobile_apis::Result::eType>::
+ StringToEnum(
+ rpc_message[strings::msg_params][strings::result_code].asString(),
+ &result_code);
+
+ if (result_code == mobile_apis::Result::UNSUPPORTED_REQUEST) {
+ LOG4CXX_DEBUG(logger_, "Service sent UNSUPPORTED_REQUEST");
+ PerformNextRequest(correlation_id);
+ return true;
+ } else {
+ LOG4CXX_DEBUG(logger_, "Valid RPC passing response");
+ ForwardResponseToMobile(correlation_id, rpc_message);
+ return true;
+ }
+
+ break;
+ }
+ }
+
+ return false;
+}
+
+void RPCPassingHandler::PopulateRPCRequestQueue(
+ smart_objects::SmartObject request_message) {
+ uint32_t origin_connection_key =
+ request_message[strings::params][strings::connection_key].asUInt();
+ uint32_t correlation_id =
+ request_message[strings::params][strings::correlation_id].asUInt();
+ int32_t function_id =
+ request_message[strings::params][strings::function_id].asInt();
+
+ // Construct list of pass through services
+ auto entry = std::make_pair(request_message, std::deque<ServiceInfo>());
+ auto services = app_service_manager_.GetActiveServices();
+
+ for (auto services_it = services.begin(); services_it != services.end();
+ ++services_it) {
+ auto handled_rpcs =
+ services_it->record[strings::service_manifest][strings::handled_rpcs];
+ for (size_t i = 0; i < handled_rpcs.length(); i++) {
+ if (handled_rpcs[i].asInt() == function_id) {
+ // Add requests to queue
+ ServiceInfo service_info{
+ services_it->record[strings::service_id].asString(),
+ services_it->connection_key};
+ entry.second.push_back(service_info);
+ app_manager_.IncreaseForwardedRequestTimeout(origin_connection_key,
+ correlation_id);
+ break;
+ }
+ }
+ }
+
+ sync_primitives::AutoLock lock(rpc_request_queue_lock_);
+ rpc_request_queue[correlation_id] = entry;
+
+ LOG4CXX_DEBUG(logger_,
+ "Added " << rpc_request_queue[correlation_id].second.size()
+ << " requests to the queue");
+}
+void RPCPassingHandler::ForwardRequestToMobile(uint32_t correlation_id) {
+ rpc_request_queue_lock_.Acquire();
+ uint32_t connection_key =
+ rpc_request_queue[correlation_id].second.front().connection_key;
+ LOG4CXX_DEBUG(logger_,
+ "Forwarding request to service with app id " << connection_key);
+
+ smart_objects::SmartObject message(rpc_request_queue[correlation_id].first);
+ message[strings::params][strings::connection_key] = connection_key;
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>(message);
+ rpc_request_queue_lock_.Release();
+ AddRequestTimer(correlation_id);
+ app_manager_.GetRPCService().SendMessageToMobile(result);
+}
+
+void RPCPassingHandler::ForwardRequestToCore(uint32_t correlation_id) {
+ LOG4CXX_DEBUG(logger_,
+ "No services left in map. using core to handle request");
+ rpc_request_queue_lock_.Acquire();
+ smart_objects::SmartObject message(rpc_request_queue[correlation_id].first);
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>(message);
+ rpc_request_queue.erase(correlation_id);
+ rpc_request_queue_lock_.Release();
+
+ // Validate rpc message before forwarding to core
+ rpc::ValidationReport report("RPC");
+ uint32_t connection_key =
+ message[strings::params][strings::connection_key].asUInt();
+ int32_t function_id = message[strings::params][strings::function_id].asInt();
+ auto app_ptr = app_manager_.application(connection_key);
+ utils::SemanticVersion msg_version(0, 0, 0);
+ if (app_ptr) {
+ msg_version = app_ptr->msg_version();
+ }
+
+ if (!app_manager_.GetRPCHandler().ValidateRpcSO(
+ message, msg_version, report, false)) {
+ std::shared_ptr<smart_objects::SmartObject> response(
+ MessageHelper::CreateNegativeResponse(
+ connection_key,
+ function_id,
+ correlation_id,
+ mobile_apis::Result::INVALID_DATA));
+
+ (*response)[strings::msg_params][strings::info] = rpc::PrettyFormat(report);
+ app_manager_.GetRPCService().ManageMobileCommand(
+ response, commands::Command::SOURCE_SDL);
+ return;
+ }
+
+ app_manager_.GetRPCService().ManageMobileCommand(
+ result, commands::Command::SOURCE_MOBILE);
+}
+
+void RPCPassingHandler::ForwardResponseToMobile(
+ uint32_t correlation_id, smart_objects::SmartObject response_message) {
+ rpc_request_queue_lock_.Acquire();
+ uint32_t origin_connection_key =
+ rpc_request_queue[correlation_id]
+ .first[strings::params][strings::connection_key]
+ .asUInt();
+ rpc_request_queue_lock_.Release();
+
+ LOG4CXX_DEBUG(logger_,
+ "Forwarding response to mobile app " << origin_connection_key);
+ smart_objects::SmartObject message(response_message);
+ message[strings::params][strings::connection_key] = origin_connection_key;
+ smart_objects::SmartObjectSPtr result =
+ std::make_shared<smart_objects::SmartObject>(message);
+ app_manager_.GetRPCService().SendMessageToMobile(result);
+}
+
+bool RPCPassingHandler::PerformNextRequest(uint32_t correlation_id) {
+ LOG4CXX_DEBUG(logger_, "Performing next request in queue");
+ rpc_request_queue_lock_.Acquire();
+ if (rpc_request_queue.find(correlation_id) == rpc_request_queue.end()) {
+ LOG4CXX_ERROR(logger_, "Correlation id does NOT exist in map");
+ rpc_request_queue_lock_.Release();
+ return false;
+ }
+ rpc_request_queue[correlation_id].second.pop_front();
+ bool empty = rpc_request_queue[correlation_id].second.empty();
+ rpc_request_queue_lock_.Release();
+
+ if (empty) {
+ ForwardRequestToCore(correlation_id);
+ } else {
+ ForwardRequestToMobile(correlation_id);
+ }
+
+ return true;
+}
+
+void RPCPassingHandler::OnPassThroughRequestTimeout() {
+ timeout_queue_lock_.Acquire();
+ LOG4CXX_DEBUG(logger_, "Request Timed out");
+ auto timeout_entry = timeout_queue_.front();
+ uint32_t correlation_id = timeout_entry.second;
+ timeout_queue_lock_.Release();
+ PerformNextRequest(correlation_id);
+}
+
+void RPCPassingHandler::ClearCompletedTimers() {
+ sync_primitives::AutoLock lock(timeout_queue_lock_);
+
+ LOG4CXX_DEBUG(logger_, "Clearing Completed Timers");
+ for (auto it = timeout_queue_.begin(); it != timeout_queue_.end();) {
+ TimerSPtr timer = it->first;
+ if (timer->is_completed()) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Removing completed timer for correlation id " << it->second);
+ it = timeout_queue_.erase(it);
+ } else {
+ ++it;
+ }
+ }
+}
+
+void RPCPassingHandler::AddRequestTimer(uint32_t correlation_id) {
+ TimerSPtr rpc_passing_timer(std::make_shared<timer::Timer>(
+ "RPCPassingTimeoutTimer_" + std::to_string(correlation_id),
+ new timer::TimerTaskImpl<RPCPassingHandler>(
+ this, &RPCPassingHandler::OnPassThroughRequestTimeout)));
+ const uint32_t timeout_ms =
+ app_manager_.get_settings().rpc_pass_through_timeout();
+ rpc_passing_timer->Start(timeout_ms, timer::kSingleShot);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Adding and starting timer for correlation id " << correlation_id);
+ sync_primitives::AutoLock lock(timeout_queue_lock_);
+ timeout_queue_.push_back(std::make_pair(rpc_passing_timer, correlation_id));
+}
+
+void RPCPassingHandler::RemoveRequestTimer(uint32_t correlation_id) {
+ sync_primitives::AutoLock lock(timeout_queue_lock_);
+
+ for (auto it = timeout_queue_.begin(); it != timeout_queue_.end();) {
+ TimerSPtr timer = it->first;
+ uint32_t cid = it->second;
+ if (cid == correlation_id) {
+ LOG4CXX_DEBUG(logger_,
+ "Removing timer for correlation id " << correlation_id);
+ it = timeout_queue_.erase(it);
+ } else {
+ ++it;
+ }
+ }
+}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/rpc_protection_manager_impl.cc b/src/components/application_manager/src/rpc_protection_manager_impl.cc
new file mode 100644
index 0000000000..4afceb9e5b
--- /dev/null
+++ b/src/components/application_manager/src/rpc_protection_manager_impl.cc
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/rpc_protection_manager_impl.h"
+#include "application_manager/application.h"
+#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
+
+CREATE_LOGGERPTR_LOCAL(logger_, "RPCProtectionManagerImpl");
+
+namespace application_manager {
+
+namespace rpc_encryption_exceptions {
+std::vector<std::string> kExceptionRPCs = {"RegisterAppInterface",
+ "SystemRequest",
+ "OnPermissionsChange",
+ "OnSystemRequest",
+ "PutFile",
+ "OnHMIStatus"};
+}
+
+RPCProtectionManagerImpl::RPCProtectionManagerImpl(
+ policy::PolicyHandlerInterface& policy_handler)
+ : policy_handler_(policy_handler) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+bool RPCProtectionManagerImpl::CheckPolicyEncryptionFlag(
+ const uint32_t function_id,
+ const ApplicationSharedPtr app,
+ const bool is_rpc_service_secure) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto& policy_encryption_flag_getter =
+ policy_handler_.PolicyEncryptionFlagGetter();
+ if (!policy_encryption_flag_getter) {
+ LOG4CXX_ERROR(logger_, "Policy Encryption Flag getter is not inited");
+ return false;
+ }
+ const std::string function_name =
+ policy_encryption_flag_getter->GetPolicyFunctionName(function_id);
+ LOG4CXX_DEBUG(logger_, "Function for check is " << function_name);
+
+ if (!is_rpc_service_secure && IsExceptionRPC(function_id)) {
+ LOG4CXX_WARN(logger_,
+ "Exception RPC can be sent in an non secure service despite "
+ "encryption required flag");
+ return false;
+ }
+
+ if (!app) {
+ LOG4CXX_WARN(logger_, "Received app nullptr");
+ return false;
+ }
+
+ const auto policy_app_id = app->policy_app_id();
+
+ return IsEncryptionRequiredByPolicy(policy_app_id, function_name);
+}
+
+bool RPCProtectionManagerImpl::IsEncryptionRequiredByPolicy(
+ const std::string& policy_app_id, const std::string& function_name) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto it = encrypted_rpcs_.find(policy_app_id);
+
+ if (encrypted_rpcs_.end() == it) {
+ LOG4CXX_WARN(
+ logger_,
+ "App specific policies for app: " << policy_app_id << " not found");
+ it = encrypted_rpcs_.find(policy_table::kDefaultApp);
+ return encrypted_rpcs_.end() != it
+ ? (*it).second.find(function_name) != (*it).second.end()
+ : false;
+ }
+
+ return (*it).second.find(function_name) != (*it).second.end();
+}
+
+bool RPCProtectionManagerImpl::IsInEncryptionNeededCache(
+ const uint32_t app_id, const uint32_t correlation_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "correlation_id is " << correlation_id);
+
+ return encryption_needed_cache_.find(std::make_pair(
+ app_id, correlation_id)) != encryption_needed_cache_.end();
+}
+
+bool RPCProtectionManagerImpl::IsExceptionRPC(
+ const uint32_t function_id) const {
+ using namespace rpc_encryption_exceptions;
+ const std::string policy_fucntion_id = policy_table::EnumToJsonString(
+ static_cast<policy_table::FunctionID>(function_id));
+ return helpers::in_range(kExceptionRPCs, policy_fucntion_id);
+}
+
+void RPCProtectionManagerImpl::AddToEncryptionNeededCache(
+ const uint32_t app_id, const uint32_t correlation_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(message_needed_encryption_lock_);
+
+ LOG4CXX_DEBUG(logger_, "Adding rpc with correlation id: " << correlation_id);
+
+ encryption_needed_cache_.insert(std::make_pair(app_id, correlation_id));
+}
+
+void RPCProtectionManagerImpl::RemoveFromEncryptionNeededCache(
+ const uint32_t app_id, const uint32_t correlation_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(message_needed_encryption_lock_);
+
+ LOG4CXX_DEBUG(logger_,
+ "Removing rpc with correlation id: " << correlation_id);
+
+ encryption_needed_cache_.erase(std::make_pair(app_id, correlation_id));
+}
+
+void RPCProtectionManagerImpl::OnPTUFinished(const bool ptu_result) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(encrypted_rpcs_lock_);
+
+ if (ptu_result) {
+ LOG4CXX_TRACE(logger_,
+ "PTU finished successfully, commencing internal encrypted "
+ "RPC cache update");
+ encrypted_rpcs_.clear();
+ SaveEncryptedRPC();
+ } else {
+ LOG4CXX_WARN(logger_,
+ "PTU was unsuccessful. Keeping internal RPC cache from "
+ "current snapshot");
+ }
+}
+
+void RPCProtectionManagerImpl::SaveEncryptedRPC() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const auto policy_encryption_flag_getter =
+ policy_handler_.PolicyEncryptionFlagGetter();
+
+ const auto policy_policy_app_ids =
+ policy_encryption_flag_getter->GetApplicationPolicyIDs();
+
+ for (const auto& app : policy_policy_app_ids) {
+ LOG4CXX_DEBUG(logger_, "Processing app name: " << app);
+
+ encrypted_rpcs_[app] = GetEncryptedRPCsForApp(app);
+ }
+}
+
+void RPCProtectionManagerImpl::OnPTInited() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ encrypted_rpcs_.clear();
+
+ SaveEncryptedRPC();
+}
+
+RPCProtectionManagerImpl::FunctionNames
+RPCProtectionManagerImpl::GetEncryptedRPCsForApp(
+ const std::string& policy_app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ FunctionNames encrypted_rpcs;
+
+ const auto policy_encryption_flag_getter =
+ policy_handler_.PolicyEncryptionFlagGetter();
+
+ if (!policy_encryption_flag_getter->AppNeedEncryption(policy_app_id)) {
+ return encrypted_rpcs;
+ }
+
+ const auto function_groups =
+ policy_encryption_flag_getter->GetFunctionalGroupsForApp(policy_app_id);
+
+ auto fill_encrypted_rpcs = [&encrypted_rpcs](
+ const std::string& function_name) {
+ LOG4CXX_DEBUG(logger_, "Adding required encryprion rpc: " << function_name);
+ encrypted_rpcs.insert(function_name);
+ };
+
+ for (const auto& function_group : function_groups) {
+ if (policy_encryption_flag_getter->FunctionGroupNeedEncryption(
+ function_group)) {
+ auto rpcs = policy_encryption_flag_getter->GetRPCsForFunctionGroup(
+ function_group);
+
+ std::for_each(rpcs.begin(), rpcs.end(), fill_encrypted_rpcs);
+ }
+ }
+
+ return encrypted_rpcs;
+}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc
index 7d930d1432..0dc48385b2 100644
--- a/src/components/application_manager/src/rpc_service_impl.cc
+++ b/src/components/application_manager/src/rpc_service_impl.cc
@@ -31,32 +31,88 @@
*/
#include "application_manager/rpc_service_impl.h"
+#include "application_manager/rpc_protection_manager_impl.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/command_factory.h"
+#include "application_manager/commands/command.h"
+#include "application_manager/plugin_manager/plugin_keys.h"
namespace application_manager {
namespace rpc_service {
CREATE_LOGGERPTR_LOCAL(logger_, "RPCServiceImpl")
-namespace formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
-namespace jhs = NsSmartDeviceLink::NsJSONHandler::strings;
+namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
+namespace jhs = ns_smart_device_link::ns_json_handler::strings;
+namespace plugin_names = application_manager::plugin_manager::plugin_names;
RPCServiceImpl::RPCServiceImpl(
ApplicationManager& app_manager,
request_controller::RequestController& request_ctrl,
protocol_handler::ProtocolHandler* protocol_handler,
hmi_message_handler::HMIMessageHandler* hmi_handler,
- CommandHolder& commands_holder)
+ CommandHolder& commands_holder,
+ RPCProtectionManagerSPtr rpc_protection_manager,
+ hmi_apis::HMI_API& hmi_so_factory,
+ mobile_apis::MOBILE_API& mobile_so_factory)
: app_manager_(app_manager)
, request_ctrl_(request_ctrl)
, protocol_handler_(protocol_handler)
, hmi_handler_(hmi_handler)
+ , rpc_protection_manager_(rpc_protection_manager)
, commands_holder_(commands_holder)
, messages_to_mobile_("AM ToMobile", this)
, messages_to_hmi_("AM ToHMI", this)
- , hmi_so_factory_(hmi_apis::HMI_API())
- , mobile_so_factory_(mobile_apis::MOBILE_API()) {}
+ , hmi_so_factory_(hmi_so_factory)
+ , mobile_so_factory_(mobile_so_factory) {}
RPCServiceImpl::~RPCServiceImpl() {}
+void RPCServiceImpl::Stop() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ messages_to_mobile_.Shutdown();
+ messages_to_hmi_.Shutdown();
+}
+
+EncryptionFlagCheckResult RPCServiceImpl::IsEncryptionRequired(
+ const smart_objects::SmartObject& message,
+ std::shared_ptr<Application> app,
+ const bool is_rpc_service_secure) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto function_id =
+ message[strings::params][strings::function_id].asUInt();
+ const auto correlation_id =
+ message[strings::params][strings::correlation_id].asUInt();
+
+ const auto message_type =
+ message[strings::params][strings::message_type].asUInt();
+ const bool policy_encryption_flag =
+ rpc_protection_manager_->CheckPolicyEncryptionFlag(
+ function_id, app, is_rpc_service_secure);
+ if (MessageType::kRequest == message_type) {
+ const bool message_protected =
+ message[strings::params][strings::protection].asBool();
+
+ if (!message_protected) {
+ return policy_encryption_flag
+ ? EncryptionFlagCheckResult::kError_EncryptionNeeded
+ : EncryptionFlagCheckResult::kSuccess_NotProtected;
+ }
+
+ // request is encrypted, so we need to encrypt response regardless of
+ // policy flag
+ const auto connection_key =
+ message[strings::params][strings::connection_key].asUInt();
+ rpc_protection_manager_->AddToEncryptionNeededCache(connection_key,
+ correlation_id);
+ return EncryptionFlagCheckResult::kSuccess_Protected;
+ }
+ return policy_encryption_flag
+ ? EncryptionFlagCheckResult::kSuccess_Protected
+ : EncryptionFlagCheckResult::kSuccess_NotProtected;
+}
+
bool RPCServiceImpl::ManageMobileCommand(
const commands::MessageSharedPtr message,
commands::Command::CommandSource source) {
@@ -71,17 +127,17 @@ bool RPCServiceImpl::ManageMobileCommand(
LOG4CXX_WARN(logger_, "Low Voltage is active");
return false;
}
-#ifdef DEBUG
+
MessageHelper::PrintSmartObject(*message);
-#endif
const uint32_t connection_key = static_cast<uint32_t>(
(*message)[strings::params][strings::connection_key].asUInt());
auto app_ptr = app_manager_.application(connection_key);
- if (app_ptr && app_manager_.IsAppInReconnectMode(app_ptr->policy_app_id())) {
+ if (app_ptr && app_manager_.IsAppInReconnectMode(app_ptr->device(),
+ app_ptr->policy_app_id())) {
commands_holder_.Suspend(
- app_ptr, CommandHolder::CommandType::kMobileCommand, message);
+ app_ptr, CommandHolder::CommandType::kMobileCommand, source, message);
return true;
}
mobile_apis::FunctionID::eType function_id =
@@ -115,15 +171,28 @@ bool RPCServiceImpl::ManageMobileCommand(
SendMessageToMobile(response);
return false;
}
-
- // Message for "CheckPermission" must be with attached schema
- mobile_so_factory().attachSchema(*message, false);
+#ifdef ENABLE_SECURITY
+ if (EncryptionFlagCheckResult::kError_EncryptionNeeded ==
+ IsEncryptionRequired(
+ *message,
+ app,
+ protocol_handler_->IsRPCServiceSecure(connection_key))) {
+ const auto response = MessageHelper::CreateNegativeResponse(
+ connection_key,
+ function_id,
+ correlation_id,
+ static_cast<int32_t>(mobile_apis::Result::ENCRYPTION_NEEDED));
+ SendMessageToMobile(response);
+ return false;
+ }
+#endif // ENABLE_SECURITY
}
auto plugin =
app_manager_.GetPluginManager().FindPluginToProcess(function_id, source);
if (!plugin) {
- LOG4CXX_WARN(logger_, "Filed to find plugin : " << plugin.error());
+ LOG4CXX_WARN(logger_, "Failed to find plugin : " << plugin.error());
+ CheckSourceForUnsupportedRequest(message, source);
return false;
}
application_manager::CommandFactory& factory = (*plugin).GetCommandFactory();
@@ -137,7 +206,7 @@ bool RPCServiceImpl::ManageMobileCommand(
int32_t message_type =
(*message)[strings::params][strings::message_type].asInt();
if (message_type == mobile_apis::messageType::response) {
- if (command->Init()) {
+ if (command->Init() && command->CheckPermissions()) {
command->Run();
command->CleanUp();
}
@@ -145,7 +214,7 @@ bool RPCServiceImpl::ManageMobileCommand(
}
if (message_type == mobile_apis::messageType::notification) {
request_ctrl_.addNotification(command);
- if (command->Init()) {
+ if (command->Init() && command->CheckPermissions()) {
command->Run();
if (command->CleanUp()) {
request_ctrl_.removeNotification(command.get());
@@ -155,12 +224,25 @@ bool RPCServiceImpl::ManageMobileCommand(
return true;
}
- if (message_type == mobile_apis::messageType::request) {
+ if (message_type == mobile_apis::messageType::request &&
+ source == commands::Command::CommandSource::SOURCE_SDL) {
+ if (command->Init() && command->CheckPermissions()) {
+ command->Run();
+ command->CleanUp();
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ if (message_type == mobile_apis::messageType::request &&
+ source == commands::Command::CommandSource::SOURCE_MOBILE) {
// commands will be launched from requesr_ctrl
mobile_apis::HMILevel::eType app_hmi_level =
mobile_apis::HMILevel::INVALID_ENUM;
if (app) {
- app_hmi_level = app->hmi_level();
+ app_hmi_level =
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
}
// commands will be launched from request_ctrl
@@ -242,8 +324,8 @@ bool RPCServiceImpl::ManageMobileCommand(
return false;
}
-bool RPCServiceImpl::ManageHMICommand(
- const commands::MessageSharedPtr message) {
+bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message,
+ commands::Command::CommandSource source) {
LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
@@ -259,15 +341,15 @@ bool RPCServiceImpl::ManageHMICommand(
MessageHelper::PrintSmartObject(*message);
const int32_t function_id =
(*(message.get()))[strings::params][strings::function_id].asInt();
- auto plugin = app_manager_.GetPluginManager().FindPluginToProcess(
- function_id, commands::Command::SOURCE_HMI);
+ auto plugin =
+ app_manager_.GetPluginManager().FindPluginToProcess(function_id, source);
if (!plugin) {
LOG4CXX_WARN(logger_, "Filed to find plugin : " << plugin.error());
return false;
}
application_manager::CommandFactory& factory = (*plugin).GetCommandFactory();
- auto command = factory.CreateCommand(message, commands::Command::SOURCE_HMI);
+ auto command = factory.CreateCommand(message, source);
if (!command) {
LOG4CXX_WARN(logger_, "Failed to create command from smart object");
@@ -280,9 +362,10 @@ bool RPCServiceImpl::ManageHMICommand(
(*message)[strings::msg_params][strings::app_id].asUInt();
auto app = app_manager_.application(static_cast<uint32_t>(connection_key));
- if (app && app_manager_.IsAppInReconnectMode(app->policy_app_id())) {
+ if (app && app_manager_.IsAppInReconnectMode(app->device(),
+ app->policy_app_id())) {
commands_holder_.Suspend(
- app, CommandHolder::CommandType::kHmiCommand, message);
+ app, CommandHolder::CommandType::kHmiCommand, source, message);
return true;
}
}
@@ -321,14 +404,15 @@ void RPCServiceImpl::Handle(const impl::MessageToHmi message) {
}
void RPCServiceImpl::Handle(const impl::MessageToMobile message) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!protocol_handler_) {
LOG4CXX_WARN(logger_,
"Protocol Handler is not set; cannot send message to mobile.");
return;
}
- utils::SharedPtr<protocol_handler::RawMessage> rawMessage =
- MobileMessageHandler::HandleOutgoingMessageProtocol(message);
+ std::shared_ptr<protocol_handler::RawMessage> rawMessage(
+ MobileMessageHandler::HandleOutgoingMessageProtocol(message));
if (!rawMessage) {
LOG4CXX_ERROR(logger_, "Failed to create raw message.");
@@ -345,7 +429,32 @@ void RPCServiceImpl::Handle(const impl::MessageToMobile message) {
}
}
- protocol_handler_->SendMessageToMobileApp(rawMessage, is_final);
+ const auto correlation_id = message->correlation_id();
+ const auto app_id = message->connection_key();
+
+ const bool is_service_secure =
+ protocol_handler_->IsRPCServiceSecure(message->connection_key());
+
+ const bool needs_encryption =
+ MessageType::kNotification == message->type()
+ ? rpc_protection_manager_->CheckPolicyEncryptionFlag(
+ message->function_id(),
+ app_manager_.application(app_id),
+ is_service_secure)
+ : rpc_protection_manager_->IsInEncryptionNeededCache(app_id,
+ correlation_id);
+
+ if (needs_encryption && !is_service_secure) {
+ LOG4CXX_WARN(logger_,
+ "Unable to send rpc that requires encryption without secure "
+ "rpc service");
+ return;
+ };
+
+ protocol_handler_->SendMessageToMobileApp(
+ rawMessage, needs_encryption, is_final);
+ rpc_protection_manager_->RemoveFromEncryptionNeededCache(app_id,
+ correlation_id);
LOG4CXX_INFO(logger_, "Message for mobile given away");
if (close_session) {
@@ -375,12 +484,13 @@ void RPCServiceImpl::SendMessageToMobile(
const bool is_result_code_exists =
(*message)[strings::msg_params].keyExists(strings::result_code);
+ bool allow_unknown_parameters = false;
if (!app) {
LOG4CXX_ERROR(logger_, "No application associated with connection key");
if (is_result_code_exists &&
((*message)[strings::msg_params][strings::result_code] ==
- NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION)) {
+ ns_smart_device_link_rpc::V1::Result::UNSUPPORTED_VERSION)) {
(*message)[strings::params][strings::protocol_version] =
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1;
} else {
@@ -398,15 +508,43 @@ void RPCServiceImpl::SendMessageToMobile(
app->usage_report().RecordRejectionsSyncOutOfMemory();
}
+ // Messages to mobile are not yet prioritized so use default priority value
+ std::shared_ptr<Message> message_to_send(
+ new Message(protocol_handler::MessagePriority::kDefault));
+
+ int32_t function_id = (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt();
+ bool rpc_passing = app_manager_.GetAppServiceManager()
+ .GetRPCPassingHandler()
+ .CanHandleFunctionID(function_id);
+ if (IsAppServiceRPC(function_id,
+ commands::Command::CommandSource::SOURCE_SDL) ||
+ rpc_passing) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Allowing unknown parameters for response function " << function_id);
+ allow_unknown_parameters = true;
+ }
+
+ if (rpc_passing &&
+ !app_manager_.GetAppServiceManager()
+ .GetRPCPassingHandler()
+ .IsPassThroughMessage(
+ (*message)[jhs::S_PARAMS][jhs::S_CORRELATION_ID].asUInt(),
+ commands::Command::CommandSource::SOURCE_SDL,
+ (*message)[jhs::S_PARAMS][jhs::S_MESSAGE_TYPE].asInt())) {
+ allow_unknown_parameters = false;
+ }
+
+ const auto api_function_id = static_cast<mobile_apis::FunctionID::eType>(
+ (*message)[strings::params][strings::function_id].asUInt());
+
mobile_so_factory().attachSchema(*message, false);
LOG4CXX_DEBUG(
logger_,
"Attached schema to message, result if valid: " << message->isValid());
- // Messages to mobile are not yet prioritized so use default priority value
- utils::SharedPtr<Message> message_to_send(
- new Message(protocol_handler::MessagePriority::kDefault));
- if (!ConvertSOtoMessage((*message), (*message_to_send))) {
+ if (!ConvertSOtoMessage(
+ (*message), (*message_to_send), allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Can't send msg to Mobile: failed to create string");
return;
}
@@ -420,12 +558,11 @@ void RPCServiceImpl::SendMessageToMobile(
msg_to_mobile[strings::params][strings::connection_key].asUInt(),
msg_to_mobile[strings::params][strings::function_id].asInt());
} else if (app) {
- mobile_apis::FunctionID::eType function_id =
- static_cast<mobile_apis::FunctionID::eType>(
- (*message)[strings::params][strings::function_id].asUInt());
RPCParams params;
const smart_objects::SmartObject& s_map = (*message)[strings::msg_params];
+ const WindowID window_id =
+ MessageHelper::ExtractWindowIdFromSmartObject(s_map);
if (smart_objects::SmartType_Map == s_map.getType()) {
smart_objects::SmartMap::iterator iter = s_map.map_begin();
smart_objects::SmartMap::iterator iter_end = s_map.map_end();
@@ -438,18 +575,19 @@ void RPCServiceImpl::SendMessageToMobile(
}
}
const std::string string_functionID =
- MessageHelper::StringifiedFunctionID(function_id);
+ MessageHelper::StringifiedFunctionID(api_function_id);
const mobile_apis::Result::eType check_result =
- app_manager_.CheckPolicyPermissions(app, string_functionID, params);
+ app_manager_.CheckPolicyPermissions(
+ app, window_id, string_functionID, params);
if (mobile_apis::Result::SUCCESS != check_result) {
LOG4CXX_WARN(logger_,
- "Function \"" << string_functionID << "\" (#" << function_id
+ "Function \"" << string_functionID << "\" (#"
+ << api_function_id
<< ") not allowed by policy");
return;
}
-#ifdef EXTERNAL_PROPRIETARY_MODE
- if (function_id == mobile_apis::FunctionID::OnSystemRequestID) {
+ if (api_function_id == mobile_apis::FunctionID::OnSystemRequestID) {
mobile_apis::RequestType::eType request_type =
static_cast<mobile_apis::RequestType::eType>(
(*message)[strings::msg_params][strings::request_type].asUInt());
@@ -458,7 +596,6 @@ void RPCServiceImpl::SendMessageToMobile(
app_manager_.GetPolicyHandler().OnUpdateRequestSentToMobile();
}
}
-#endif // EXTERNAL_PROPRIETARY_MODE
}
if (message_to_send->binary_data()) {
@@ -473,7 +610,6 @@ void RPCServiceImpl::SendMessageToMobile(
void RPCServiceImpl::SendMessageToHMI(
const commands::MessageSharedPtr message) {
LOG4CXX_AUTO_TRACE(logger_);
-
if (!message) {
LOG4CXX_WARN(logger_, "Null-pointer message received.");
NOTREACHED();
@@ -485,8 +621,9 @@ void RPCServiceImpl::SendMessageToHMI(
return;
}
+ bool allow_unknown_parameters = false;
// SmartObject |message| has no way to declare priority for now
- utils::SharedPtr<Message> message_to_send(
+ std::shared_ptr<Message> message_to_send(
new Message(protocol_handler::MessagePriority::kDefault));
if (!message_to_send) {
LOG4CXX_ERROR(logger_, "Null pointer");
@@ -498,19 +635,60 @@ void RPCServiceImpl::SendMessageToHMI(
logger_,
"Attached schema to message, result if valid: " << message->isValid());
-#ifdef HMI_DBUS_API
- message_to_send->set_smart_object(*message);
-#else
- if (!ConvertSOtoMessage(*message, *message_to_send)) {
+ if (IsAppServiceRPC((*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt(),
+ commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) {
+ LOG4CXX_DEBUG(logger_,
+ "Allowing unknown parameters for response function "
+ << (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
+
+ allow_unknown_parameters = true;
+ }
+
+ if (!ConvertSOtoMessage(
+ *message, *message_to_send, allow_unknown_parameters)) {
LOG4CXX_WARN(logger_,
"Cannot send message to HMI: failed to create string");
return;
}
-#endif // HMI_DBUS_API
-
messages_to_hmi_.PostMessage(impl::MessageToHmi(message_to_send));
}
+bool RPCServiceImpl::IsAppServiceRPC(int32_t function_id,
+ commands::Command::CommandSource source) {
+ // General RPCs related to App Services
+ if ((source == commands::Command::CommandSource::SOURCE_MOBILE) ||
+ (source ==
+ commands::Command::CommandSource::SOURCE_SDL)) { // MOBILE COMMANDS
+ switch (function_id) {
+ case mobile_apis::FunctionID::GetSystemCapabilityID:
+ case mobile_apis::FunctionID::OnSystemCapabilityUpdatedID:
+ return true;
+ break;
+ }
+ } else if ((source == commands::Command::CommandSource::SOURCE_HMI) ||
+ (source == commands::Command::CommandSource::
+ SOURCE_SDL_TO_HMI)) { // HMI COMMANDS
+ switch (function_id) {
+ case hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated:
+ return true;
+ break;
+ }
+ }
+
+ // RPCs handled by app services plugin
+ auto plugin =
+ app_manager_.GetPluginManager().FindPluginToProcess(function_id, source);
+ if (!plugin) {
+ return false;
+ }
+ if ((*plugin).PluginName() != plugin_names::app_service_rpc_plugin) {
+ return false;
+ }
+ application_manager::CommandFactory& factory = (*plugin).GetCommandFactory();
+
+ return factory.IsAbleToProcess(function_id, source);
+}
+
void RPCServiceImpl::set_protocol_handler(
protocol_handler::ProtocolHandler* handler) {
protocol_handler_ = handler;
@@ -522,8 +700,9 @@ void RPCServiceImpl::set_hmi_message_handler(
}
bool RPCServiceImpl::ConvertSOtoMessage(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& message,
- Message& output) {
+ const ns_smart_device_link::ns_smart_objects::SmartObject& message,
+ Message& output,
+ const bool allow_unknown_parameters) {
LOG4CXX_AUTO_TRACE(logger_);
if (smart_objects::SmartType_Null == message.getType() ||
@@ -548,16 +727,16 @@ bool RPCServiceImpl::ConvertSOtoMessage(
switch (protocol_type) {
case 0: {
if (protocol_version == 1) {
- if (!formatters::CFormatterJsonSDLRPCv1::toString(message,
- output_string)) {
+ if (!formatters::CFormatterJsonSDLRPCv1::toString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
output.set_protocol_version(
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1);
} else {
- if (!formatters::CFormatterJsonSDLRPCv2::toString(message,
- output_string)) {
+ if (!formatters::CFormatterJsonSDLRPCv2::toString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
@@ -569,7 +748,8 @@ bool RPCServiceImpl::ConvertSOtoMessage(
break;
}
case 1: {
- if (!formatters::FormatterJsonRpc::ToString(message, output_string)) {
+ if (!formatters::FormatterJsonRpc::ToString(
+ message, output_string, !allow_unknown_parameters)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
@@ -582,7 +762,7 @@ bool RPCServiceImpl::ConvertSOtoMessage(
return false;
}
- LOG4CXX_DEBUG(logger_, "Convertion result: " << output_string);
+ LOG4CXX_DEBUG(logger_, "Conversion result: " << output_string);
output.set_connection_key(message.getElement(jhs::S_PARAMS)
.getElement(strings::connection_key)
@@ -621,6 +801,28 @@ bool RPCServiceImpl::ConvertSOtoMessage(
return true;
}
+void RPCServiceImpl::UpdateMobileRPCParams(
+ const mobile_apis::FunctionID::eType& function_id,
+ const mobile_apis::messageType::eType& message_type,
+ const std::map<std::string, SMember>& members) {
+ mobile_so_factory().ResetFunctionSchema(function_id, message_type);
+ for (const auto& item : members) {
+ mobile_so_factory().AddCustomMember(
+ function_id, message_type, item.first, item.second);
+ }
+}
+
+void RPCServiceImpl::UpdateHMIRPCParams(
+ const hmi_apis::FunctionID::eType& function_id,
+ const hmi_apis::messageType::eType& message_type,
+ const std::map<std::string, SMember>& members) {
+ hmi_so_factory().ResetFunctionSchema(function_id, message_type);
+ for (const auto& item : members) {
+ hmi_so_factory().AddCustomMember(
+ function_id, message_type, item.first, item.second);
+ }
+}
+
hmi_apis::HMI_API& RPCServiceImpl::hmi_so_factory() {
return hmi_so_factory_;
}
@@ -629,6 +831,43 @@ mobile_apis::MOBILE_API& RPCServiceImpl::mobile_so_factory() {
return mobile_so_factory_;
}
+void RPCServiceImpl::CheckSourceForUnsupportedRequest(
+ const commands::MessageSharedPtr message,
+ commands::Command::CommandSource source) {
+ int32_t message_type =
+ (*(message.get()))[strings::params][strings::message_type].asInt();
+ uint32_t correlation_id =
+ (*message)[strings::params].keyExists(strings::correlation_id)
+ ? (*message)[strings::params][strings::correlation_id].asUInt()
+ : 0;
+ const uint32_t connection_key = static_cast<uint32_t>(
+ (*message)[strings::params][strings::connection_key].asUInt());
+ mobile_apis::FunctionID::eType function_id =
+ static_cast<mobile_apis::FunctionID::eType>(
+ (*message)[strings::params][strings::function_id].asInt());
+ if ((source == commands::Command::CommandSource::SOURCE_MOBILE &&
+ kRequest == message_type) ||
+ (source == commands::Command::CommandSource::SOURCE_SDL &&
+ kResponse == message_type)) {
+ smart_objects::SmartObjectSPtr response =
+ MessageHelper::CreateNegativeResponse(connection_key,
+ static_cast<int32_t>(function_id),
+ correlation_id,
+ 0);
+
+ // Since we are dealing with an unknown RPC, there is no schema attached
+ // to the message, so we have to convert the result to string directly
+ std::string result_code;
+ smart_objects::EnumConversionHelper<mobile_apis::Result::eType>::
+ EnumToString(mobile_apis::Result::UNSUPPORTED_REQUEST, &result_code);
+ (*response)[strings::msg_params][strings::result_code] = result_code;
+ (*response)[strings::msg_params][strings::info] =
+ "Module does not recognize this function id";
+
+ SendMessageToMobile(response);
+ }
+}
+
} // namespace rpc_service
} // namespace application_manager
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index 5514ad688a..fe0f878e6c 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -5,6 +5,8 @@ namespace application_manager {
namespace strings {
const char* params = "params";
+const char* require_encryption = "requireEncryption";
+const char* protection = "protection";
const char* message_type = "message_type";
const char* correlation_id = "correlation_id";
const char* function_id = "function_id";
@@ -18,7 +20,9 @@ const char* msg_params = "msg_params";
const char* method_name = "methodName";
const char* info = "info";
const char* app_id = "appID";
+const char* full_app_id = "fullAppID";
const char* bundle_id = "appBundleID";
+const char* window_id = "windowID";
const char* app_info = "appInfo";
const char* app_launch = "app_launch";
const char* app_launch_list = "app_launch_list";
@@ -26,6 +30,7 @@ const char* app_launch_last_session = "app_launch_last_session";
const char* policy_app_id = "policyAppID";
const char* hmi_app_id = "hmiAppID";
const char* device_id = "deviceID";
+const char* subscribe = "subscribe";
const char* subscribed_for_way_points = "subscribed_for_way_points";
const char* url = "url";
const char* urlScheme = "urlScheme";
@@ -42,7 +47,7 @@ const char* ngn_media_screen_app_name = "ngnMediaScreenAppName";
const char* vr_synonyms = "vrSynonyms";
const char* uses_vehicle_data = "usesVehicleData";
const char* is_media_application = "isMediaApplication";
-const char* greyOut = "greyOut";
+const char* grey_out = "greyOut";
const char* language_desired = "languageDesired";
const char* auto_activated_id = "autoActivateID";
const char* app_type = "appType";
@@ -57,6 +62,7 @@ const char* main_field_1 = "mainField1";
const char* main_field_2 = "mainField2";
const char* main_field_3 = "mainField3";
const char* main_field_4 = "mainField4";
+const char* template_title = "templateTitle";
const char* metadata_tags = "metadataTags";
const char* eta = "eta";
const char* time_to_destination = "timeToDestination";
@@ -75,10 +81,13 @@ const char* menu_icon = "menuIcon";
const char* keyboard_properties = "keyboardProperties";
const char* vr_commands = "vrCommands";
const char* position = "position";
+const char* user_location = "userLocation";
const char* num_ticks = "numTicks";
const char* slider_footer = "sliderFooter";
const char* menu_id = "menuID";
const char* menu_name = "menuName";
+const char* menu_layout = "menuLayout";
+const char* menu_layouts_available = "menuLayoutsAvailable";
const char* interaction_choice_set_id = "interactionChoiceSetID";
const char* interaction_choice_set_id_list = "interactionChoiceSetIDList";
const char* choice_set = "choiceSet";
@@ -94,7 +103,10 @@ const char* initial_prompt = "initialPrompt";
const char* initial_text = "initialText";
const char* duration = "duration";
const char* progress_indicator = "progressIndicator";
+const char* func_id = "functionID";
+const char* cancel_id = "cancelID";
const char* alert_type = "alertType";
+const char* alert_icon = "alertIcon";
const char* play_tone = "playTone";
const char* soft_buttons = "softButtons";
const char* soft_button_id = "softButtonID";
@@ -124,15 +136,24 @@ const char* hours = "hours";
const char* minutes = "minutes";
const char* seconds = "seconds";
const char* update_mode = "updateMode";
+const char* audioStreamingIndicator = "audioStreamingIndicator";
const char* trigger_source = "triggerSource";
const char* hmi_level = "hmiLevel";
const char* activate_app_hmi_level = "level";
const char* audio_streaming_state = "audioStreamingState";
const char* video_streaming_state = "videoStreamingState";
const char* system_context = "systemContext";
+const char* window_name = "windowName";
+const char* window_type = "type";
+const char* window_type_supported = "windowTypeSupported";
+const char* maximum_number_of_windows = "maximumNumberOfWindows";
+const char* window_capabilities = "windowCapabilities";
+const char* associated_service_type = "associatedServiceType";
+const char* duplicate_updates_from_window_id = "duplicateUpdatesFromWindowID";
const char* speech_capabilities = "speechCapabilities";
const char* vr_capabilities = "vrCapabilities";
const char* audio_pass_thru_capabilities = "audioPassThruCapabilities";
+const char* audio_pass_thru_capabilities_list = "audioPassThruCapabilitiesList";
const char* pcm_stream_capabilities = "pcmStreamCapabilities";
const char* audio_pass_thru_icon = "audioPassThruIcon";
const char* way_points = "wayPoints";
@@ -143,6 +164,8 @@ const char* navigation_capability = "navigationCapability";
const char* phone_capability = "phoneCapability";
const char* video_streaming_capability = "videoStreamingCapability";
const char* rc_capability = "remoteControlCapability";
+const char* seat_location_capability = "seatLocationCapability";
+const char* app_services_capabilities = "appServicesCapabilities";
const char* day_color_scheme = "dayColorScheme";
const char* night_color_scheme = "nightColorScheme";
const char* primary_color = "primaryColor";
@@ -152,11 +175,27 @@ const char* red = "red";
const char* green = "green";
const char* blue = "blue";
const char* display_layout = "displayLayout";
+const char* template_configuration = "templateConfiguration";
+const char* template_layout = "template";
const char* icon_resumed = "iconResumed";
+const char* nicknames = "nicknames";
+const char* enabled = "enabled";
+const char* auth_token = "authToken";
+const char* cloud_transport_type = "cloudTransportType";
+const char* hybrid_app_preference = "hybridAppPreference";
+const char* is_cloud_application = "isCloudApplication";
+const char* cloud_connection_status = "cloudConnectionStatus";
+const char* endpoint = "endpoint";
+const char* display_capabilities = "displayCapabilities";
+const char* policy_type = "policyType";
+const char* property = "property";
+const char* displays = "displays";
+const char* seat_location = "seatLocation";
// PutFile
const char* sync_file_name = "syncFileName";
const char* file_name = "fileName";
+const char* file_path = "filePath";
const char* file_type = "fileType";
const char* file_size = "fileSize";
const char* crc32_check_sum = "crc";
@@ -170,6 +209,7 @@ const char* is_template = "isTemplate";
const char* image = "image";
const char* type = "type";
const char* system_file = "systemFile";
+const char* is_system_file = "isSystemFile";
const char* offset = "offset";
const char* length = "length";
const char* secondary_image = "secondaryImage";
@@ -182,6 +222,7 @@ const char* did_location = "didLocation";
const char* app_list = "appList";
const char* device_list = "deviceList";
const char* device_info = "deviceInfo";
+const char* secondary_device_info = "secondaryDeviceInfo";
const char* name = "name";
const char* id = "id";
const char* isSDLAllowed = "isSDLAllowed";
@@ -207,6 +248,7 @@ const char* key_press_mode = "keypressMode";
// duplicate names from hmi_request
const char* limited_character_list = "limitedCharacterList";
const char* auto_complete_text = "autoCompleteText";
+const char* auto_complete_list = "autoCompleteList";
const char* navigation_text = "navigationText";
// vehicle info
@@ -217,6 +259,7 @@ const char* fuel_level = "fuelLevel";
const char* fuel_level_state = "fuelLevel_State";
const char* instant_fuel_consumption = "instantFuelConsumption";
const char* fuel_range = "fuelRange";
+const char* cloud_app_vehicle_id = "cloudAppVehicleID";
const char* external_temp = "externalTemperature";
const char* turn_signal = "turnSignal";
const char* vin = "vin";
@@ -224,6 +267,7 @@ const char* prndl = "prndl";
const char* tire_pressure = "tirePressure";
const char* odometer = "odometer";
const char* belt_status = "beltStatus";
+const char* electronic_park_brake_status = "electronicParkBrakeStatus";
const char* body_information = "bodyInformation";
const char* device_status = "deviceStatus";
const char* driver_braking = "driverBraking";
@@ -236,6 +280,7 @@ const char* e_call_info = "eCallInfo";
const char* airbag_status = "airbagStatus";
const char* emergency_event = "emergencyEvent";
const char* cluster_mode_status = "clusterModeStatus";
+const char* cluster_modes = "clusterModes";
const char* my_key = "myKey";
const char* help_prompt = "helpPrompt";
const char* scroll_message_body = "scrollableMessageBody";
@@ -255,6 +300,50 @@ const char* sdl_version = "sdlVersion";
const char* system_software_version = "systemSoftwareVersion";
const char* priority = "priority";
const char* engine_oil_life = "engineOilLife";
+const char* oem_custom_data_type = "oemCustomDataType";
+
+// app services
+const char* app_service_manifest = "appServiceManifest";
+const char* service_name = "serviceName";
+const char* service_type = "serviceType";
+const char* service_icon = "serviceIcon";
+const char* allow_app_consumers = "allowAppConsumers";
+const char* rpc_spec_version = "rpcSpecVersion";
+const char* handled_rpcs = "handledRPCs";
+const char* media_service_manifest = "mediaServiceManifest";
+const char* app_service_record = "appServiceRecord";
+const char* service_id = "serviceID";
+const char* service_manifest = "serviceManifest";
+const char* service_published = "servicePublished";
+const char* service_active = "serviceActive";
+const char* app_service_id = "appServiceId";
+const char* service_data = "serviceData";
+const char* media_service_data = "mediaServiceData";
+const char* media_image = "mediaImage";
+const char* weather_service_data = "weatherServiceData";
+const char* location = "location";
+const char* current_forecast = "currentForecast";
+const char* minute_forecast = "minuteForecast";
+const char* hourly_forecast = "hourlyForecast";
+const char* multiday_forecast = "multidayForecast";
+const char* weather_icon = "weatherIcon";
+const char* navigation_service_data = "navigationServiceData";
+const char* origin = "origin";
+const char* destination = "destination";
+const char* instructions = "instructions";
+const char* location_details = "locationDetails";
+const char* request_service_active = "requestServiceActive";
+const char* app_services = "appServices";
+const char* update_reason = "updateReason";
+const char* updated_app_service_record = "updatedAppServiceRecord";
+const char* service_records = "serviceRecords";
+const char* activate = "activate";
+const char* set_as_default = "setAsDefault";
+const char* origin_app = "originApp";
+
+// sis data
+const char* station_short_name = "stationShortName";
+const char* station_location = "stationLocation";
// resuming
const char* application_commands = "applicationCommands";
@@ -273,6 +362,7 @@ 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* suspend_count = "suspend_count";
const char* connection_info = "connection_info";
@@ -283,8 +373,12 @@ const char* time_stamp = "timeStamp";
const char* manual_text_entry = "manualTextEntry";
const char* image_type_supported = "imageTypeSupported";
const char* unexpected_disconnect = "unexpectedDisconnect";
+
+const char* shifted = "shifted";
+const char* altitude = "altitude";
const char* longitude_degrees = "longitudeDegrees";
const char* latitude_degrees = "latitudeDegrees";
+
const char* address = "address";
const char* country_name = "countryName";
const char* country_code = "countryCode";
@@ -307,13 +401,16 @@ const char* delivery_mode = "deliveryMode";
const char* audio_streaming_indicator = "audioStreamingIndicator";
+const char* windows_info = "windowsInfo";
+
const char* const keyboard_properties_supported = "keyboardPropertiesSupported";
const char* const language_supported = "languageSupported";
const char* const keyboard_layout_supported = "keyboardLayoutSupported";
const char* const keypress_mode_supported = "keypressModeSupported";
const char* const limited_characters_list_supported =
"limitedCharactersListSupported";
-const char* const auto_complete_text_supported = "autoCompleteTextSupported";
+const char* const send_location_enabled = "sendLocationEnabled";
+const char* const get_way_points_enabled = "getWayPointsEnabled";
const char* const entity_type = "entityType";
const char* const entity_id = "entityID";
const char* const status = "status";
@@ -332,6 +429,9 @@ const char* const resolution_height = "resolutionHeight";
const char* const max_bitrate = "maxBitrate";
const char* const supported_formats = "supportedFormats";
const char* const haptic_spatial_data_supported = "hapticSpatialDataSupported";
+const char* const diagonal_screen_size = "diagonalScreenSize";
+const char* const pixel_per_inch = "pixelPerInch";
+const char* const scale = "scale";
const char* const haptic_rect_data = "hapticRectData";
const char* const rect = "rect";
const char* const x = "x";
@@ -374,6 +474,8 @@ namespace mobile_notification {
const char* state = "state";
const char* syncp_timeout = "Timeout";
const char* syncp_url = "URL";
+const char* lock_screen_dismissal_enabled = "lockScreenDismissalEnabled";
+const char* lock_screen_dismissal_warning = "lockScreenDismissalWarning";
} // namespace mobile_notification
namespace hmi_levels {
@@ -418,7 +520,7 @@ const char* keyboard_properties = "keyboardProperties";
const char* method_name = "methodName";
const char* keyboard_layout = "keyboardLayout";
const char* limited_character_list = "limitedCharacterList";
-const char* auto_complete_text = "autoCompleteText";
+const char* auto_complete_list = "autoCompleteList";
const char* file = "file";
const char* file_name = "fileName";
const char* retry = "retry";
@@ -479,6 +581,9 @@ const char* policyfile = "policyfile";
const char* is_active = "isActive";
const char* is_deactivated = "isDeactivated";
const char* event_name = "eventName";
+const char* service_type = "serviceType";
+const char* service_event = "serviceEvent";
+const char* reason = "reason";
} // namespace hmi_notification
} // namespace application_manager
diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc
index 1a1e5543df..b07a5bcc13 100644
--- a/src/components/application_manager/src/state_controller_impl.cc
+++ b/src/components/application_manager/src/state_controller_impl.cc
@@ -32,10 +32,10 @@
#include "application_manager/state_controller_impl.h"
#include <tuple>
-#include "application_manager/usage_statistics.h"
#include "application_manager/rpc_service.h"
+#include "application_manager/usage_statistics.h"
#include "utils/helpers.h"
-#include "utils/make_shared.h"
+
#include "connection_handler/connection_handler.h"
namespace application_manager {
@@ -67,14 +67,16 @@ StateControllerImpl::StateControllerImpl(ApplicationManager& app_mngr)
}
void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(HmiState::STATE_ID_REGULAR == state->state_id());
- LOG4CXX_DEBUG(logger_, "Set regular state " << *state);
+ LOG4CXX_DEBUG(logger_,
+ "Set window #" << window_id << " regular state " << *state);
if (state->hmi_level() == mobile_apis::HMILevel::INVALID_ENUM ||
state->audio_streaming_state() ==
@@ -93,37 +95,44 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
HmiStatePtr resolved_state = ResolveHmiState(app, state);
if (!resolved_state) {
state->set_state_id(HmiState::STATE_ID_POSTPONED);
- app->SetPostponedState(state);
+ app->SetPostponedState(window_id, state);
return;
}
+
LOG4CXX_DEBUG(logger_, "Resolved state: " << *resolved_state);
const hmi_apis::Common_HMILevel::eType hmi_level =
static_cast<hmi_apis::Common_HMILevel::eType>(
resolved_state->hmi_level());
- if (send_activate_app) {
- const int64_t corr_id = SendBCActivateApp(app, hmi_level, true);
- if (-1 != corr_id) {
- subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_ActivateApp,
- corr_id);
- waiting_for_activate_[app->app_id()] = resolved_state;
+ if (request_hmi_state_change) {
+ const int64_t result = RequestHMIStateChange(app, hmi_level, true);
+ if (-1 != result) {
+ const uint32_t corr_id = static_cast<uint32_t>(result);
+ subscribe_on_event(
+ hmi_apis::Common_HMILevel::NONE == hmi_level
+ ? hmi_apis::FunctionID::BasicCommunication_CloseApplication
+ : hmi_apis::FunctionID::BasicCommunication_ActivateApp,
+ corr_id);
+ waiting_for_response_[app->app_id()] = resolved_state;
+ app_mngr_.set_application_id(corr_id, app->hmi_app_id());
return;
}
LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateApp");
return;
}
- ApplyRegularState(app, resolved_state);
+ ApplyRegularState(app, window_id, resolved_state);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_regular = app->RegularHmiState();
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_regular);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -132,16 +141,22 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(audio_state);
hmi_state->set_video_streaming_state(video_state);
hmi_state->set_system_context(prev_regular->system_context());
- SetRegularState(app, hmi_state, send_activate_app);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
+
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
+ DCHECK_OR_RETURN_VOID(prev_regular);
+
const HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -150,33 +165,43 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(CalcAudioState(app, hmi_level));
hmi_state->set_video_streaming_state(CalcVideoState(app, hmi_level));
hmi_state->set_system_context(SystemContext::SYSCTXT_MAIN);
- SetRegularState(app, hmi_state, send_activate_app);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
+
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
+ DCHECK_OR_RETURN_VOID(prev_regular);
+
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN_VOID(hmi_state);
+
hmi_state->set_hmi_level(hmi_level);
hmi_state->set_audio_streaming_state(audio_state);
hmi_state->set_video_streaming_state(video_state);
hmi_state->set_system_context(system_context);
- SetRegularState(app, hmi_state, send_activate_app);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
- ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level) {
+ ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::HMILevel::eType hmi_level) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_state = app->RegularHmiState();
+ HmiStatePtr prev_state = app->RegularHmiState(window_id);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN_VOID(hmi_state);
@@ -186,15 +211,16 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_system_context(prev_state
? prev_state->system_context()
: mobile_apis::SystemContext::SYSCTXT_MAIN);
- SetRegularState(app, hmi_state);
+ SetRegularState(app, window_id, hmi_state);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::SystemContext::eType system_context) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_regular = app->RegularHmiState();
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_regular);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -205,16 +231,18 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_video_streaming_state(
CalcVideoState(app, prev_regular->hmi_level()));
hmi_state->set_system_context(system_context);
- SetRegularState(app, hmi_state, false);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, false);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_state = app->RegularHmiState();
+ HmiStatePtr prev_state = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_state);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -223,18 +251,23 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(audio_state);
hmi_state->set_video_streaming_state(video_state);
hmi_state->set_system_context(prev_state->system_context());
- SetRegularState(app, hmi_state, false);
+ hmi_state->set_window_type(prev_state->window_type());
+ SetRegularState(app, window_id, hmi_state, false);
}
void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
- if (mobile_apis::HMILevel::HMI_FULL == state->hmi_level()) {
- SetRegularState(app, state, true);
+
+ // SDL should send BC.ActivateApp for main window during resumption
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id &&
+ mobile_apis::HMILevel::HMI_FULL == state->hmi_level()) {
+ SetRegularState(app, window_id, state, true);
} else {
- SetRegularState(app, state, false);
+ SetRegularState(app, window_id, state, false);
}
}
@@ -295,7 +328,8 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()(
return;
}
- const HmiStatePtr state_to_resolve = app_to_resolve->RegularHmiState();
+ const HmiStatePtr state_to_resolve =
+ app_to_resolve->RegularHmiState(window_id_);
DCHECK_OR_RETURN_VOID(state_to_resolve);
// If applied HMI state is FULL:
@@ -379,22 +413,23 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()(
std::make_tuple(
result_hmi_level, result_audio_state, result_video_state)) {
LOG4CXX_DEBUG(logger_,
- "Application "
- << app_to_resolve->app_id() << " will change state to: "
- << "HMI level " << to_resolve_hmi_level << " --> "
- << result_hmi_level << ", audio "
- << state_to_resolve->audio_streaming_state() << " --> "
- << result_audio_state << ", video "
- << state_to_resolve->video_streaming_state() << " --> "
- << result_video_state);
+ "Application " << app_to_resolve->app_id() << " window "
+ << window_id_ << " will change state to: "
+ << "HMI level " << to_resolve_hmi_level
+ << " --> " << result_hmi_level << ", audio "
+ << state_to_resolve->audio_streaming_state()
+ << " --> " << result_audio_state << ", video "
+ << state_to_resolve->video_streaming_state()
+ << " --> " << result_video_state);
state_ctrl_->SetupRegularHmiState(app_to_resolve,
+ window_id_,
result_hmi_level,
result_audio_state,
result_video_state);
} else {
LOG4CXX_DEBUG(logger_,
- "Application " << app_to_resolve->app_id()
- << " will NOT change HMI level");
+ "Application " << app_to_resolve->app_id() << " window "
+ << window_id_ << " will NOT change HMI level");
}
}
@@ -408,6 +443,7 @@ HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app,
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN(available_state, HmiStatePtr());
available_state->set_hmi_level(state->hmi_level());
+ available_state->set_window_type(state->window_type());
available_state->set_audio_streaming_state(state->audio_streaming_state());
available_state->set_video_streaming_state(state->video_streaming_state());
available_state->set_system_context(state->system_context());
@@ -458,6 +494,8 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel(
LOG4CXX_AUTO_TRACE(logger_);
mobile_apis::HMILevel::eType result = hmi_level;
+ LOG4CXX_DEBUG(logger_, "HMI Level: " << hmi_level);
+
if (!IsStreamableHMILevel(hmi_level)) {
return result;
}
@@ -465,6 +503,7 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel(
const bool is_audio_app = app->IsAudioApplication();
const bool does_audio_app_with_same_type_exist =
app_mngr_.IsAppTypeExistsInFullOrLimited(app);
+
if (mobile_apis::HMILevel::HMI_LIMITED == hmi_level) {
if (!is_audio_app || does_audio_app_with_same_type_exist) {
result = app_mngr_.GetDefaultHmiLevel(app);
@@ -472,7 +511,9 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel(
return result;
}
- const bool is_active_app_exist = app_mngr_.active_application();
+ ApplicationConstSharedPtr active_app = app_mngr_.active_application();
+ const bool is_active_app_exist =
+ (active_app.use_count() != 0) && active_app->app_id() != app->app_id();
if (is_audio_app) {
if (does_audio_app_with_same_type_exist) {
result = app_mngr_.GetDefaultHmiLevel(app);
@@ -560,12 +601,14 @@ bool StateControllerImpl::IsStateAvailableForResumption(
}
void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state) {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
- LOG4CXX_DEBUG(logger_, "Setup regular state: " << *state);
- HmiStatePtr curr_state = app->CurrentHmiState();
+ LOG4CXX_DEBUG(logger_,
+ "Setup window #" << window_id << " regular state: " << *state);
+ HmiStatePtr curr_state = app->CurrentHmiState(window_id);
HmiStatePtr old_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN_VOID(old_state);
@@ -573,28 +616,30 @@ void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app,
old_state->set_audio_streaming_state(curr_state->audio_streaming_state());
old_state->set_video_streaming_state(curr_state->video_streaming_state());
old_state->set_system_context(curr_state->system_context());
- app->SetRegularState(state);
+ old_state->set_window_type(curr_state->window_type());
+ app->SetRegularState(window_id, state);
- if (HMILevel::HMI_LIMITED == state->hmi_level() && app->is_resuming()) {
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id &&
+ HMILevel::HMI_LIMITED == state->hmi_level() && app->is_resuming()) {
LOG4CXX_DEBUG(logger_,
"Resuming to LIMITED level. "
<< "Send OnResumeAudioSource notification");
MessageHelper::SendOnResumeAudioSourceToHMI(app->app_id(), app_mngr_);
}
- app->set_is_resuming(false);
- HmiStatePtr new_state = app->CurrentHmiState();
- OnStateChanged(app, old_state, new_state);
+ HmiStatePtr new_state = app->CurrentHmiState(window_id);
+ OnStateChanged(app, window_id, old_state, new_state);
}
void StateControllerImpl::SetupRegularHmiState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_state = app->RegularHmiState();
+ HmiStatePtr prev_state = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_state);
HmiStatePtr new_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -603,26 +648,69 @@ void StateControllerImpl::SetupRegularHmiState(
new_state->set_audio_streaming_state(audio_state);
new_state->set_video_streaming_state(video_state);
new_state->set_system_context(prev_state->system_context());
- SetupRegularHmiState(app, new_state);
+ new_state->set_window_type(prev_state->window_type());
+ SetupRegularHmiState(app, window_id, new_state);
}
void StateControllerImpl::ApplyRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR);
LOG4CXX_DEBUG(logger_,
- "Applying to app " << app->app_id() << " state " << *state);
- SetupRegularHmiState(app, state);
+ "Applying to app " << app->app_id() << " window #" << window_id
+ << " state " << *state);
+ SetupRegularHmiState(app, window_id, state);
+
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ LOG4CXX_DEBUG(logger_, "No need to resolve conflicts for a widget");
+ return;
+ }
+
LOG4CXX_DEBUG(logger_,
"Resolving HMI level conflicts for app " << app->app_id());
- ForEachApplication(HmiLevelConflictResolver(app, state, this));
+ ForEachApplication(HmiLevelConflictResolver(app, window_id, state, this));
}
+void StateControllerImpl::UpdateAppWindowsStreamingState(
+ ApplicationSharedPtr app, HmiStatePtr state) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto window_ids = app->GetWindowIds();
+ for (auto window_id : window_ids) {
+ HmiStatePtr window_hmi_state = app->RegularHmiState(window_id);
+ LOG4CXX_DEBUG(
+ logger_, "State: " << *state << " window state: " << *window_hmi_state);
+ if (window_hmi_state->audio_streaming_state() !=
+ state->audio_streaming_state() ||
+ window_hmi_state->video_streaming_state() !=
+ state->video_streaming_state()) {
+ LOG4CXX_DEBUG(logger_,
+ "Updating streaming state for window #" << window_id);
+
+ HmiStatePtr new_window_state =
+ CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(new_window_state);
+ new_window_state->set_hmi_level(window_hmi_state->hmi_level());
+ new_window_state->set_audio_streaming_state(
+ state->audio_streaming_state());
+ new_window_state->set_video_streaming_state(
+ state->video_streaming_state());
+ new_window_state->set_system_context(window_hmi_state->system_context());
+ new_window_state->set_window_type(window_hmi_state->window_type());
+ app->SetRegularState(window_id, new_window_state);
+
+ MessageHelper::SendHMIStatusNotification(app, window_id, app_mngr_);
+ }
+ }
+}
+
+void StateControllerImpl::on_event(const event_engine::MobileEvent& event) {}
+
void StateControllerImpl::on_event(const event_engine::Event& event) {
- using smart_objects::SmartObject;
using event_engine::Event;
+ using smart_objects::SmartObject;
using namespace hmi_apis;
namespace FunctionID = hmi_apis::FunctionID;
@@ -630,8 +718,9 @@ void StateControllerImpl::on_event(const event_engine::Event& event) {
const SmartObject& message = event.smart_object();
const FunctionID::eType id = static_cast<FunctionID::eType>(event.id());
switch (id) {
- case FunctionID::BasicCommunication_ActivateApp: {
- OnActivateAppResponse(message);
+ case FunctionID::BasicCommunication_ActivateApp:
+ case FunctionID::BasicCommunication_CloseApplication: {
+ OnHMIResponse(message);
break;
}
case FunctionID::BasicCommunication_OnAppActivated: {
@@ -719,26 +808,81 @@ void StateControllerImpl::on_event(const event_engine::Event& event) {
}
}
+void StateControllerImpl::ActivateDefaultWindow(ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+
+ const WindowID window_id = PredefinedWindows::DEFAULT_WINDOW;
+ const HMILevel::eType hmi_level = HMILevel::HMI_FULL;
+ const AudioStreamingState::eType audio_state =
+ app->IsAudioApplication() ? AudioStreamingState::AUDIBLE
+ : AudioStreamingState::NOT_AUDIBLE;
+ const VideoStreamingState::eType video_state =
+ app->IsVideoApplication() ? VideoStreamingState::STREAMABLE
+ : VideoStreamingState::NOT_STREAMABLE;
+
+ SetRegularState(app, window_id, hmi_level, audio_state, video_state, false);
+
+ // After main window activation, streaming state should be updated for another
+ // windows of the app
+ HmiStatePtr new_state =
+ app->RegularHmiState(PredefinedWindows::DEFAULT_WINDOW);
+ UpdateAppWindowsStreamingState(app, new_state);
+}
+
+void StateControllerImpl::ExitDefaultWindow(ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+
+ const WindowID window_id = PredefinedWindows::DEFAULT_WINDOW;
+ const HMILevel::eType hmi_level = HMILevel::HMI_NONE;
+ const AudioStreamingState::eType audio_state =
+ AudioStreamingState::NOT_AUDIBLE;
+ const VideoStreamingState::eType video_state =
+ VideoStreamingState::NOT_STREAMABLE;
+
+ SetRegularState(app, window_id, hmi_level, audio_state, video_state, false);
+
+ // After main window exiting, streaming state should be updated for another
+ // windows of the app
+ HmiStatePtr new_state =
+ app->RegularHmiState(PredefinedWindows::DEFAULT_WINDOW);
+ UpdateAppWindowsStreamingState(app, new_state);
+}
+
void StateControllerImpl::OnStateChanged(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr old_state,
HmiStatePtr new_state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(old_state);
DCHECK_OR_RETURN_VOID(new_state);
- LOG4CXX_DEBUG(logger_, "Old state: " << *old_state);
- LOG4CXX_DEBUG(logger_, "New state: " << *new_state);
- if (IsStateChanged(*old_state, *new_state)) {
- app_mngr_.SendHMIStatusNotification(app);
- if (new_state->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
- app->ResetDataInNone();
- }
- app_mngr_.OnHMILevelChanged(
- app->app_id(), old_state->hmi_level(), new_state->hmi_level());
- app->usage_report().RecordHmiStateChanged(new_state->hmi_level());
- } else {
- LOG4CXX_ERROR(logger_, "State has NOT been changed.");
+ LOG4CXX_DEBUG(logger_,
+ "Window #" << window_id << " old state: " << *old_state);
+ LOG4CXX_DEBUG(logger_,
+ "Window #" << window_id << " new state: " << *new_state);
+
+ if (!IsStateChanged(*old_state, *new_state)) {
+ LOG4CXX_DEBUG(logger_, "State has NOT been changed.");
+ return;
+ }
+
+ MessageHelper::SendHMIStatusNotification(app, window_id, app_mngr_);
+
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ LOG4CXX_DEBUG(logger_,
+ "State was changed not for a main application window. No "
+ "additional actions required");
+ return;
+ }
+
+ if (new_state->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
+ app->ResetDataInNone();
}
+
+ app_mngr_.OnHMIStateChanged(app->app_id(), old_state, new_state);
+ app->usage_report().RecordHmiStateChanged(new_state->hmi_level());
}
bool StateControllerImpl::IsTempStateActive(HmiState::StateID id) const {
@@ -749,6 +893,20 @@ bool StateControllerImpl::IsTempStateActive(HmiState::StateID id) const {
void StateControllerImpl::OnApplicationRegistered(
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType default_level) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // After app registration HMI level should be set for DEFAUL_WINDOW only
+ OnAppWindowAdded(app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::WindowType::MAIN,
+ default_level);
+}
+
+void StateControllerImpl::OnAppWindowAdded(
+ ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType default_level) {
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
@@ -762,9 +920,10 @@ void StateControllerImpl::OnApplicationRegistered(
DCHECK_OR_RETURN_VOID(new_state);
DCHECK_OR_RETURN_VOID(new_state->state_id() !=
HmiState::STATE_ID_REGULAR);
- HmiStatePtr old_hmi_state = app->CurrentHmiState();
+ HmiStatePtr old_hmi_state = app->CurrentHmiState(window_id);
new_state->set_parent(old_hmi_state);
- app->AddHMIState(new_state);
+ new_state->set_window_type(old_hmi_state->window_type());
+ app->AddHMIState(window_id, new_state);
}
}
@@ -775,50 +934,58 @@ void StateControllerImpl::OnApplicationRegistered(
default_state->set_audio_streaming_state(CalcAudioState(app, default_level));
default_state->set_video_streaming_state(CalcVideoState(app, default_level));
default_state->set_system_context(SystemContext::SYSCTXT_MAIN);
+ default_state->set_window_type(window_type);
- HmiStatePtr initial_state = app->RegularHmiState();
+ HmiStatePtr initial_state = app->RegularHmiState(window_id);
- app->SetRegularState(default_state);
+ app->SetRegularState(window_id, default_state);
- HmiStatePtr new_state = app->CurrentHmiState();
+ HmiStatePtr new_state = app->CurrentHmiState(window_id);
- OnStateChanged(app, initial_state, new_state);
+ OnStateChanged(app, window_id, initial_state, new_state);
}
-int64_t StateControllerImpl::SendBCActivateApp(
+int64_t StateControllerImpl::RequestHMIStateChange(
ApplicationConstSharedPtr app,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority) {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr bc_activate_app_request =
- MessageHelper::GetBCActivateAppRequestToHMI(
- app,
- app_mngr_.connection_handler().get_session_observer(),
- app_mngr_.GetPolicyHandler(),
- level,
- send_policy_priority,
- app_mngr_);
- if (!bc_activate_app_request) {
- LOG4CXX_ERROR(logger_, "Unable to create BC.ActivateAppRequest");
+ smart_objects::SmartObjectSPtr request = NULL;
+ if (hmi_apis::Common_HMILevel::NONE == level) {
+ request = MessageHelper::GetBCCloseApplicationRequestToHMI(app, app_mngr_);
+ } else {
+ request = MessageHelper::GetBCActivateAppRequestToHMI(
+ app,
+ app_mngr_.GetPolicyHandler(),
+ level,
+ send_policy_priority,
+ app_mngr_);
+ }
+ if (!request) {
+ LOG4CXX_ERROR(logger_, "Unable to create request");
return -1;
}
- if (!app_mngr_.GetRPCService().ManageHMICommand(bc_activate_app_request)) {
- LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateAppRequest");
+ if (!app_mngr_.GetRPCService().ManageHMICommand(request)) {
+ LOG4CXX_ERROR(logger_, "Unable to send request");
return -1;
}
- const int64_t corr_id =
- (*bc_activate_app_request)[strings::params][strings::correlation_id]
- .asInt();
- return corr_id;
+ const uint32_t corr_id =
+ (*request)[strings::params][strings::correlation_id].asUInt();
+ return static_cast<int64_t>(corr_id);
}
void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
- HmiStatePtr state = app->PostponedHmiState();
- if (state) {
- app->RemovePostponedState();
- state->set_state_id(HmiState::STATE_ID_REGULAR);
- SetRegularState(app, state);
+ DCHECK_OR_RETURN_VOID(app);
+ const WindowIds window_ids = app->GetWindowIds();
+
+ for (const auto& window_id : window_ids) {
+ HmiStatePtr state = app->PostponedHmiState(window_id);
+ if (state) {
+ app->RemovePostponedState(window_id);
+ state->set_state_id(HmiState::STATE_ID_REGULAR);
+ SetRegularState(app, window_id, state);
+ }
}
}
@@ -846,16 +1013,19 @@ void StateControllerImpl::TempStateStopped(HmiState::StateID ID) {
std::mem_fun(&StateControllerImpl::ApplyPostponedStateForApp), this));
}
-void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app) {
+void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app,
+ const WindowID window_id) {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- const HmiStatePtr regular = app->RegularHmiState();
+ const HmiStatePtr regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(regular);
- HmiStatePtr new_regular = utils::MakeShared<HmiState>(*regular);
+ HmiStatePtr new_regular = std::make_shared<HmiState>(*regular);
- LOG4CXX_DEBUG(logger_, "Current HMI level: '" << app->hmi_level() << "'");
+ LOG4CXX_DEBUG(logger_,
+ "Window #" << window_id << " current HMI level: '"
+ << app->hmi_level(window_id) << "'");
const bool is_audio_app = app->IsAudioApplication();
const bool is_video_app = app->IsVideoApplication();
@@ -881,23 +1051,25 @@ void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app) {
new_regular->set_video_streaming_state(VideoStreamingState::NOT_STREAMABLE);
}
- SetRegularState(app, new_regular, false);
+ SetRegularState(app, window_id, new_regular, false);
}
-void StateControllerImpl::OnActivateAppResponse(
+void StateControllerImpl::OnHMIResponse(
const smart_objects::SmartObject& message) {
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- const int32_t correlation_id =
- message[strings::params][strings::correlation_id].asInt();
+ const uint32_t correlation_id =
+ message[strings::params][strings::correlation_id].asUInt();
const uint32_t hmi_app_id = app_mngr_.application_id(correlation_id);
ApplicationSharedPtr application =
app_mngr_.application_by_hmi_app(hmi_app_id);
if (application && hmi_apis::Common_Result::SUCCESS == code) {
- HmiStatePtr pending_state = waiting_for_activate_[application->app_id()];
+ HmiStatePtr pending_state = waiting_for_response_[application->app_id()];
DCHECK_OR_RETURN_VOID(pending_state);
- ApplyRegularState(application, pending_state);
+ ApplyRegularState(application,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ pending_state);
}
}
@@ -913,7 +1085,33 @@ void StateControllerImpl::OnAppActivated(
return;
}
- SetRegularState(app, HMILevel::HMI_FULL, true);
+ WindowID window_id = mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+ if (message[strings::msg_params].keyExists(strings::window_id)) {
+ window_id = message[strings::msg_params][strings::window_id].asInt();
+ }
+
+ const auto window_ids = app->GetWindowIds();
+ if (!helpers::in_range(window_ids, window_id)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Application " << app_id << " does not contain window #" << window_id);
+ return;
+ }
+
+ if (PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ const auto window_hmi_level = app->hmi_level(window_id);
+ const HMILevel::eType new_hmi_level = HMILevel::HMI_NONE == window_hmi_level
+ ? HMILevel::HMI_BACKGROUND
+ : HMILevel::HMI_FULL;
+ const AudioStreamingState::eType audio_state = app->audio_streaming_state();
+ const VideoStreamingState::eType video_state = app->video_streaming_state();
+
+ SetRegularState(
+ app, window_id, new_hmi_level, audio_state, video_state, false);
+ return;
+ }
+
+ SetRegularState(app, window_id, HMILevel::HMI_FULL, true);
}
void StateControllerImpl::OnAppDeactivated(
@@ -928,13 +1126,39 @@ void StateControllerImpl::OnAppDeactivated(
return;
}
- if (HMILevel::HMI_FULL != app->hmi_level()) {
+ WindowID window_id = mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+ if (message[strings::msg_params].keyExists(strings::window_id)) {
+ window_id = message[strings::msg_params][strings::window_id].asInt();
+ }
+
+ const auto window_ids = app->GetWindowIds();
+ if (!helpers::in_range(window_ids, window_id)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Application " << app_id << " does not contain window #" << window_id);
+ return;
+ }
+
+ const auto window_hmi_level = app->hmi_level(window_id);
+ if (PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ const HMILevel::eType new_hmi_level = HMILevel::HMI_FULL == window_hmi_level
+ ? HMILevel::HMI_BACKGROUND
+ : HMILevel::HMI_NONE;
+ const AudioStreamingState::eType audio_state = app->audio_streaming_state();
+ const VideoStreamingState::eType video_state = app->video_streaming_state();
+
+ SetRegularState(
+ app, window_id, new_hmi_level, audio_state, video_state, false);
+ return;
+ }
+
+ if (HMILevel::HMI_FULL != window_hmi_level) {
return;
}
// TODO(AOleynik): Need to delete DeactivateReason and modify OnAppDeactivated
// when HMI will support that, otherwise won't be testable
- DeactivateApp(app);
+ DeactivateApp(app, window_id);
}
void StateControllerImpl::OnVideoStreamingStarted(
@@ -968,53 +1192,53 @@ bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const {
}
HmiStatePtr StateControllerImpl::CreateHmiState(
- utils::SharedPtr<Application> app, HmiState::StateID state_id) const {
+ std::shared_ptr<Application> app, HmiState::StateID state_id) const {
using namespace utils;
LOG4CXX_AUTO_TRACE(logger_);
HmiStatePtr new_state;
switch (state_id) {
case HmiState::STATE_ID_PHONE_CALL: {
- new_state = MakeShared<PhoneCallHmiState>(app, app_mngr_);
+ new_state = std::make_shared<PhoneCallHmiState>(app, app_mngr_);
break;
}
case HmiState::STATE_ID_SAFETY_MODE: {
- new_state = MakeShared<SafetyModeHmiState>(app, app_mngr_);
+ new_state = std::make_shared<SafetyModeHmiState>(app, app_mngr_);
break;
}
case HmiState::STATE_ID_VR_SESSION: {
- new_state = MakeShared<VRHmiState>(app, app_mngr_);
+ new_state = std::make_shared<VRHmiState>(app, app_mngr_);
break;
}
case HmiState::STATE_ID_TTS_SESSION: {
- new_state = MakeShared<TTSHmiState>(app, app_mngr_);
+ new_state = std::make_shared<TTSHmiState>(app, app_mngr_);
break;
}
case HmiState::STATE_ID_VIDEO_STREAMING: {
- new_state = MakeShared<VideoStreamingHmiState>(app, app_mngr_);
+ new_state = std::make_shared<VideoStreamingHmiState>(app, app_mngr_);
break;
}
case HmiState::STATE_ID_NAVI_STREAMING: {
- new_state = MakeShared<NaviStreamingHmiState>(app, app_mngr_);
+ new_state = std::make_shared<NaviStreamingHmiState>(app, app_mngr_);
break;
}
case HmiState::STATE_ID_REGULAR: {
- new_state = MakeShared<HmiState>(app, app_mngr_);
+ new_state = std::make_shared<HmiState>(app, app_mngr_);
break;
}
case HmiState::STATE_ID_POSTPONED: {
- new_state = MakeShared<HmiState>(app, app_mngr_, state_id);
+ new_state = std::make_shared<HmiState>(app, app_mngr_, state_id);
break;
}
case HmiState::STATE_ID_DEACTIVATE_HMI: {
- new_state = MakeShared<DeactivateHMI>(app, app_mngr_);
+ new_state = std::make_shared<DeactivateHMI>(app, app_mngr_);
break;
}
case HmiState::STATE_ID_AUDIO_SOURCE: {
- new_state = MakeShared<AudioSource>(app, app_mngr_);
+ new_state = std::make_shared<AudioSource>(app, app_mngr_);
break;
}
case HmiState::STATE_ID_EMBEDDED_NAVI: {
- new_state = MakeShared<EmbeddedNavi>(app, app_mngr_);
+ new_state = std::make_shared<EmbeddedNavi>(app, app_mngr_);
break;
}
default:
diff --git a/src/components/application_manager/src/system_time/system_time_handler_impl.cc b/src/components/application_manager/src/system_time/system_time_handler_impl.cc
index 6ae6d3e901..deb92d5d81 100644
--- a/src/components/application_manager/src/system_time/system_time_handler_impl.cc
+++ b/src/components/application_manager/src/system_time/system_time_handler_impl.cc
@@ -41,11 +41,14 @@
namespace application_manager {
+CREATE_LOGGERPTR_GLOBAL(logger_, "SystemTimeHandler")
+
SystemTimeHandlerImpl::SystemTimeHandlerImpl(
ApplicationManager& application_manager)
: event_engine::EventObserver(application_manager.event_dispatcher())
, utc_time_can_be_received_(false)
, awaiting_get_system_time_(false)
+ , last_time_(0)
, system_time_listener_(NULL)
, app_manager_(application_manager) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -55,7 +58,7 @@ SystemTimeHandlerImpl::SystemTimeHandlerImpl(
SystemTimeHandlerImpl::~SystemTimeHandlerImpl() {
LOG4CXX_AUTO_TRACE(logger_);
- unsubscribe_from_all_events();
+ unsubscribe_from_all_hmi_events();
}
void SystemTimeHandlerImpl::DoSystemTimeQuery() {
@@ -79,6 +82,13 @@ void SystemTimeHandlerImpl::DoSubscribe(utils::SystemTimeListener* listener) {
system_time_listener_ = listener;
}
+void SystemTimeHandlerImpl::ResetPendingSystemTimeRequests() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ unsubscribe_from_event(
+ hmi_apis::FunctionID::BasicCommunication_GetSystemTime);
+ awaiting_get_system_time_ = false;
+}
+
void SystemTimeHandlerImpl::DoUnsubscribe(utils::SystemTimeListener* listener) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(system_time_listener_lock_);
@@ -142,6 +152,14 @@ void SystemTimeHandlerImpl::ProcessSystemTimeResponse(
const application_manager::event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
+
+ const auto result = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ if (hmi_apis::Common_Result::SUCCESS != result) {
+ system_time_listener_->OnSystemTimeFailed();
+ }
+
const smart_objects::SmartObject& system_time_so =
message[strings::msg_params][hmi_response::system_time];
diff --git a/src/components/application_manager/src/usage_statistics.cc b/src/components/application_manager/src/usage_statistics.cc
index 80755b6509..3f1831f449 100644
--- a/src/components/application_manager/src/usage_statistics.cc
+++ b/src/components/application_manager/src/usage_statistics.cc
@@ -31,14 +31,13 @@
*/
#include "application_manager/usage_statistics.h"
-#include "smart_objects/smart_object.h"
-#include "smart_objects/enum_schema_item.h"
#include "policy/usage_statistics/statistics_manager.h"
+#include "smart_objects/enum_schema_item.h"
+#include "smart_objects/smart_object.h"
#include "utils/macro.h"
-#include "utils/make_shared.h"
using namespace mobile_apis;
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
using namespace usage_statistics;
namespace application_manager {
@@ -56,7 +55,7 @@ std::string LanguageIdToString(Language::eType lang_id) {
UsageStatistics::UsageStatistics(
const std::string& app_id,
- utils::SharedPtr<StatisticsManager> statistics_manager)
+ std::shared_ptr<StatisticsManager> statistics_manager)
: time_in_hmi_state_sptr_(
new usage_statistics::AppStopwatchImpl(statistics_manager, app_id))
, app_registration_language_gui_(statistics_manager, app_id, LANGUAGE_GUI)
@@ -78,7 +77,7 @@ UsageStatistics::UsageStatistics(
UsageStatistics::UsageStatistics(
const std::string& app_id,
- utils::SharedPtr<StatisticsManager> statistics_manager,
+ std::shared_ptr<StatisticsManager> statistics_manager,
AppStopwatch* time_in_hmi_state_ptr)
: time_in_hmi_state_sptr_(time_in_hmi_state_ptr)
, app_registration_language_gui_(statistics_manager, app_id, LANGUAGE_GUI)
diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt
index 579ffe8c1b..afc39b9fdd 100644..100755
--- a/src/components/application_manager/test/CMakeLists.txt
+++ b/src/components/application_manager/test/CMakeLists.txt
@@ -45,6 +45,8 @@ include_directories(
${COMPONENTS_DIR}/media_manager/include/
${COMPONENTS_DIR}/security_manager/include/
${COMPONENTS_DIR}/application_manager/test/include/
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/sdl_rpc_plugin/include/
+ ${COMPONENTS_DIR}/application_manager/rpc_plugins/vehicle_info_plugin/include/
${BSON_INCLUDE_DIRECTORY}
)
@@ -55,6 +57,7 @@ set(testSources
${AM_TEST_DIR}/request_info_test.cc
${AM_TEST_DIR}/resumption_sql_queries_test.cc
${AM_TEST_DIR}/event_engine_test.cc
+ ${AM_TEST_DIR}/mobile_event_engine_test.cc
${AM_TEST_DIR}/policy_event_observer_test.cc
${AM_TEST_DIR}/application_impl_test.cc
${AM_TEST_DIR}/hmi_capabilities_test.cc
@@ -62,8 +65,11 @@ set(testSources
${AM_TEST_DIR}/application_state_test.cc
${AM_TEST_DIR}/usage_statistics_test.cc
${AM_TEST_DIR}/policy_handler_test.cc
+ ${AM_TEST_DIR}/app_service_manager_test.cc
+ ${AM_TEST_DIR}/rpc_passing_handler_test.cc
${AM_TEST_DIR}/application_manager_impl_test.cc
${AM_TEST_DIR}/application_helper_test.cc
+ ${AM_TEST_DIR}/rpc_service_impl_test.cc
${AM_TEST_DIR}/command_holder_test.cc
)
@@ -72,14 +78,22 @@ set(testSourcesMockHmi
${AM_TEST_DIR}/application_manager_impl_mock_hmi_test.cc
)
+set(testSourcesHelpPromptManager
+ ${AM_TEST_DIR}/help_prompt_manager_test.cc
+ ${AM_TEST_DIR}/mock_message_helper.cc
+)
set (RequestController_SOURCES
${AM_TEST_DIR}/request_controller/request_controller_test.cc
${AM_TEST_DIR}/mock_message_helper.cc
)
+set (RPCHandlerImplTest_SOURCES ${AM_TEST_DIR}/rpc_handler_impl_test.cc
+ ${AM_TEST_DIR}/mock_message_helper.cc)
+
set(LIBRARIES
Utils
ApplicationManager
+ sdl_rpc_plugin_static
jsoncpp
Policy
connectionHandler
@@ -129,10 +143,13 @@ set(CMAKE_EXE_LINKER_FLAGS
)
create_test("application_manager_test" "${testSources}" "${LIBRARIES}")
create_test("application_manager_mock_hmi_test" "${testSourcesMockHmi}" "${LIBRARIES}")
-#add_dependencies("application_manager_test" libbson)
+
+create_test("help_prompt_manager_test" "${testSourcesHelpPromptManager}" "${LIBRARIES}")
create_test("request_controller_test" "${RequestController_SOURCES}" "${LIBRARIES}")
+create_test("rpc_handler_impl_test" "${RPCHandlerImplTest_SOURCES}" "${LIBRARIES}")
+
set(ResumptionData_SOURCES
${AM_TEST_DIR}/resumption/resumption_data_test.cc
${AM_TEST_DIR}/resumption/resumption_data_db_test.cc
@@ -144,6 +161,7 @@ set(ResumptionData_SOURCES
file(COPY hmi_capabilities.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY hmi_capabilities_sc1.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY hmi_capabilities_sc2.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY hmi_capabilities_old_apt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY smartDeviceLink_test.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resumption)
diff --git a/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc b/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc
index 1b90f29647..b3bb8dd705 100644
--- a/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc
+++ b/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc
@@ -30,42 +30,42 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include <sstream>
-#include "utils/macro.h"
#include "application_manager/app_launch/app_launch_ctrl_impl.h"
#include "application_manager/mock_app_launch_data.h"
#include "application_manager/mock_app_launch_settings.h"
-#include "application_manager/mock_resume_ctrl.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_resume_ctrl.h"
#include "connection_handler/mock_connection_handler.h"
-#include "utils/make_shared.h"
+#include "gtest/gtest.h"
+#include "utils/macro.h"
+
#include "utils/test_async_waiter.h"
namespace test {
namespace components {
namespace app_launch_test {
+using ::testing::AtLeast;
+using ::testing::DoAll;
+using ::testing::InSequence;
+using ::testing::Invoke;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::Truly;
-using ::testing::NiceMock;
-using ::testing::Invoke;
-using ::testing::AtLeast;
-using ::testing::InSequence;
-using ::testing::DoAll;
namespace ch_test = test::components::connection_handler_test;
namespace am_test = test::components::application_manager_test;
const uint32_t MAX_TEST_DURATION = 1000; // 1 second
-typedef utils::SharedPtr<am_test::MockApplication> MockAppPtr;
+typedef std::shared_ptr<am_test::MockApplication> MockAppPtr;
class AppLaunchCtrlTest : public ::testing::Test {
public:
MockAppPtr AppFromAppData(const app_launch::ApplicationData& app_data) {
- utils::SharedPtr<NiceMock<am_test::MockApplication> > app =
- utils::MakeShared<NiceMock<am_test::MockApplication> >();
+ std::shared_ptr<NiceMock<am_test::MockApplication> > app =
+ std::make_shared<NiceMock<am_test::MockApplication> >();
ON_CALL(*app, mac_address()).WillByDefault(ReturnRef(app_data.device_mac_));
ON_CALL(*app, bundle_id()).WillByDefault(ReturnRef(app_data.bundle_id_));
@@ -77,7 +77,7 @@ class AppLaunchCtrlTest : public ::testing::Test {
app_launch::ApplicationDataPtr AppDataFromApp(
const am_test::MockApplication& app) {
app_launch::ApplicationDataPtr app_data =
- utils::MakeShared<NiceMock<app_launch::ApplicationData> >(
+ std::make_shared<NiceMock<app_launch::ApplicationData> >(
app.policy_app_id(), app.bundle_id(), app.mac_address());
return app_data;
}
@@ -137,7 +137,7 @@ class AppLaunchCtrlTest : public ::testing::Test {
using app_launch::ApplicationData;
AppAndAppData app;
app.second =
- utils::MakeShared<ApplicationData>(app_id, bundle_id, device_mac);
+ std::make_shared<ApplicationData>(app_id, bundle_id, device_mac);
app.first = AppFromAppData(*app.second);
return app;
}
@@ -164,7 +164,7 @@ class AppLaunchCtrlTest : public ::testing::Test {
NiceMock<ch_test::MockConnectionHandler> connection_handler_mock_;
NiceMock<resumprion_test::MockResumeCtrl> resume_ctrl_mock_;
NiceMock<app_launch_test::MockAppLaunchSettings> settings_;
- std::auto_ptr<app_launch::AppLaunchCtrlImpl> app_launch_ctrl_;
+ std::unique_ptr<app_launch::AppLaunchCtrlImpl> app_launch_ctrl_;
};
app_launch::ApplicationData AppDataFromApp(
diff --git a/src/components/application_manager/test/app_launch/app_launch_data_db_test.cc b/src/components/application_manager/test/app_launch/app_launch_data_db_test.cc
index e095f0682e..d0f2e21f4c 100644
--- a/src/components/application_manager/test/app_launch/app_launch_data_db_test.cc
+++ b/src/components/application_manager/test/app_launch/app_launch_data_db_test.cc
@@ -31,18 +31,18 @@
*/
#include <algorithm>
+#include <memory>
#include <sstream>
#include <string>
-#include <memory>
#include "gtest/gtest.h"
-#include "utils/macro.h"
#include "sql_database.h"
#include "sql_query.h"
-#include "utils/make_shared.h"
-#include "utils/file_system.h"
-#include "application_manager/mock_app_launch_settings.h"
+#include "utils/macro.h"
+
#include "application_manager/app_launch/app_launch_data_db.h"
#include "application_manager/app_launch/app_launch_sql_queries.h"
+#include "application_manager/mock_app_launch_settings.h"
+#include "utils/file_system.h"
namespace test {
namespace components {
@@ -51,9 +51,9 @@ namespace app_launch_test {
using namespace file_system;
using namespace app_launch;
-using ::testing::ReturnRef;
-using ::testing::Return;
using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
namespace {
const std::string kEmptyString = "";
@@ -113,7 +113,7 @@ class AppLaunchDataDBTest : public ::testing::Test {
return test_db_;
}
- static std::auto_ptr<AppLaunchDataDB> res_db_;
+ static std::unique_ptr<AppLaunchDataDB> res_db_;
AppLaunchDataDB* res_db() {
return res_db_.get();
@@ -145,7 +145,7 @@ class AppLaunchDataDBTest : public ::testing::Test {
};
utils::dbms::SQLDatabase* AppLaunchDataDBTest::test_db_ = NULL;
-std::auto_ptr<AppLaunchDataDB> AppLaunchDataDBTest::res_db_;
+std::unique_ptr<AppLaunchDataDB> AppLaunchDataDBTest::res_db_;
void AppLaunchDataDBTest::AddApplicationDataWithIncreaseTable(
const ApplicationData& data) {
@@ -284,7 +284,7 @@ TEST_F(AppLaunchDataDBTest, SelectMultipleData) {
const std::string mobile_app_id = AddCounter("d1_mobile_app_id", i);
const std::string bundle_id = AddCounter("d1_bundle_id", i);
- ApplicationDataPtr app_data = utils::MakeShared<ApplicationData>(
+ ApplicationDataPtr app_data = std::make_shared<ApplicationData>(
mobile_app_id, bundle_id, device_mac_1);
AddApplicationDataWithIncreaseTable(*app_data);
input_data1.push_back(app_data);
@@ -294,7 +294,7 @@ TEST_F(AppLaunchDataDBTest, SelectMultipleData) {
const std::string mobile_app_id = AddCounter("d2_mobile_app_id", i);
const std::string bundle_id = AddCounter("d2_bundle_id", i);
- ApplicationDataPtr app_data = utils::MakeShared<ApplicationData>(
+ ApplicationDataPtr app_data = std::make_shared<ApplicationData>(
mobile_app_id, bundle_id, device_mac_2);
AddApplicationDataWithIncreaseTable(*app_data);
input_data2.push_back(app_data);
diff --git a/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc b/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc
index cc7d3f5814..f7bd636a66 100644
--- a/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc
+++ b/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc
@@ -30,28 +30,28 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "application_manager/app_launch/app_launch_data_json.h"
#include <algorithm>
-#include <sstream>
#include <memory>
-#include "json/json.h"
+#include <sstream>
+#include "application_manager/mock_app_launch_settings.h"
+#include "application_manager/smart_object_keys.h"
#include "gtest/gtest.h"
-#include "utils/macro.h"
-#include "utils/make_shared.h"
-#include "utils/file_system.h"
-#include "utils/date_time.h"
+#include "json/json.h"
#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/mock_app_launch_settings.h"
-#include "application_manager/app_launch/app_launch_data_json.h"
+#include "utils/date_time.h"
+#include "utils/file_system.h"
+#include "utils/macro.h"
namespace test {
namespace components {
namespace test_app_launch {
using ::testing::_;
-using ::testing::Return;
using ::testing::NiceMock;
+using ::testing::Return;
namespace am = application_manager;
using namespace Json;
@@ -67,8 +67,9 @@ class AppLaunchDataJsonTest : public ::testing::Test {
private:
virtual void SetUp() {
::file_system::DeleteFile(kAppStorageFile);
- test_last_state_ = std::auto_ptr<resumption::LastState>(
- new resumption::LastStateImpl(kAppStorageFolder, kAppInfoStorage));
+ last_state_wrapper_ = std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>(kAppStorageFolder,
+ kAppInfoStorage));
ASSERT_TRUE(::file_system::CreateFile(kAppStorageFile));
NiceMock<app_launch_test::MockAppLaunchSettings> mock_app_launch_settings_;
@@ -76,7 +77,7 @@ class AppLaunchDataJsonTest : public ::testing::Test {
.WillByDefault(Return(15u));
res_json_.reset(
- new AppLaunchDataJson(mock_app_launch_settings_, *test_last_state_));
+ new AppLaunchDataJson(mock_app_launch_settings_, last_state_wrapper_));
}
public:
@@ -97,14 +98,15 @@ class AppLaunchDataJsonTest : public ::testing::Test {
void AddApplicationDataWithIncreaseTable(const ApplicationData& data);
void AddApplicationDataWithoutIncreaseTable(const ApplicationData& data);
- TimevalStruct GetApplicationData_EXPECT_TRUE(const ApplicationData& in_data,
- ApplicationData& out_data);
+ date_time::TimeDuration GetApplicationData_EXPECT_TRUE(
+ const ApplicationData& in_data, ApplicationData& out_data);
void GetApplicationData_EXPECT_FALSE(const ApplicationData& in_data);
std::string AddCounter(const std::string& inp, int32_t val);
- std::auto_ptr<resumption::LastState> test_last_state_;
- std::auto_ptr<AppLaunchDataJson> res_json_;
- void SetTimestamp(const ApplicationData& in_data, TimevalStruct& timestamp);
+ resumption::LastStateWrapperPtr last_state_wrapper_;
+ std::unique_ptr<AppLaunchDataJson> res_json_;
+ void SetTimestamp(const ApplicationData& in_data,
+ date_time::TimeDuration& timestamp);
};
void AppLaunchDataJsonTest::AddApplicationDataWithIncreaseTable(
@@ -129,13 +131,15 @@ void AppLaunchDataJsonTest::AddApplicationDataWithoutIncreaseTable(
EXPECT_EQ(sizeBeforeAdding, sizeAfterAdding);
}
-TimevalStruct AppLaunchDataJsonTest::GetApplicationData_EXPECT_TRUE(
+date_time::TimeDuration AppLaunchDataJsonTest::GetApplicationData_EXPECT_TRUE(
const ApplicationData& in_data, ApplicationData& out_data) {
uint32_t sizeBeforeGetting = res_json()->GetCurentNumberOfAppData();
+ Json::Value dictionary =
+ last_state_wrapper_->get_accessor().GetData().dictionary();
int32_t index = NotFound;
Json::Value& json_data_list =
- res_json()->GetApplicationListAndIndex(in_data, index);
+ res_json()->GetApplicationListAndIndex(in_data, index, dictionary);
EXPECT_FALSE(index == NotFound);
uint32_t sizeAfterGetting = res_json()->GetCurentNumberOfAppData();
@@ -148,9 +152,10 @@ TimevalStruct AppLaunchDataJsonTest::GetApplicationData_EXPECT_TRUE(
out_data.bundle_id_ =
json_data_list[index][am::strings::bundle_id].asString();
// time stamp
- TimevalStruct tmVal = {0};
- tmVal.tv_sec =
- json_data_list[index][am::strings::app_launch_last_session].asUInt64();
+ date_time::TimeDuration tmVal = date_time::seconds(
+ json_data_list[index][am::strings::app_launch_last_session].asUInt64());
+ last_state_wrapper_->get_accessor().GetMutableData().set_dictionary(
+ dictionary);
return tmVal;
}
@@ -158,22 +163,27 @@ void AppLaunchDataJsonTest::GetApplicationData_EXPECT_FALSE(
const ApplicationData& in_data) {
uint32_t sizeBeforeGetting = res_json()->GetCurentNumberOfAppData();
+ Json::Value dictionary =
+ last_state_wrapper_->get_accessor().GetData().dictionary();
int32_t index = NotFound;
- res_json()->GetApplicationListAndIndex(in_data, index);
+ res_json()->GetApplicationListAndIndex(in_data, index, dictionary);
EXPECT_TRUE(index == NotFound);
uint32_t sizeAfterGetting = res_json()->GetCurentNumberOfAppData();
-
+ last_state_wrapper_->get_accessor().GetMutableData().set_dictionary(
+ dictionary);
EXPECT_EQ(sizeBeforeGetting, sizeAfterGetting);
}
void AppLaunchDataJsonTest::SetTimestamp(const ApplicationData& in_data,
- TimevalStruct& timestamp) {
+ date_time::TimeDuration& timestamp) {
uint32_t sizeBeforeGetting = res_json()->GetCurentNumberOfAppData();
int32_t index = NotFound;
+ Json::Value dictionary =
+ last_state_wrapper_->get_accessor().GetData().dictionary();
Json::Value& json_data_list =
- res_json()->GetApplicationListAndIndex(in_data, index);
+ res_json()->GetApplicationListAndIndex(in_data, index, dictionary);
EXPECT_FALSE(index == NotFound);
uint32_t sizeAfterGetting = res_json()->GetCurentNumberOfAppData();
@@ -183,7 +193,9 @@ void AppLaunchDataJsonTest::SetTimestamp(const ApplicationData& in_data,
EXPECT_EQ(sizeBeforeGetting, sizeAfterGetting);
// time stamp
json_data_list[index][am::strings::app_launch_last_session] =
- static_cast<Json::Value::UInt64>(timestamp.tv_sec);
+ static_cast<Json::Value::UInt64>(date_time::getSecs(timestamp));
+ last_state_wrapper_->get_accessor().GetMutableData().set_dictionary(
+ dictionary);
}
std::string AppLaunchDataJsonTest::AddCounter(const std::string& inp,
@@ -225,18 +237,18 @@ TEST_F(AppLaunchDataJsonTest, RefreshTimestamp) {
ApplicationData data("mobile_app_id", "bundle_id", "device_mac");
AddApplicationDataWithIncreaseTable(data);
ApplicationData recoveredData("", "", "");
- TimevalStruct timestamp1 =
+ date_time::TimeDuration timestamp1 =
GetApplicationData_EXPECT_TRUE(data, recoveredData);
- TimevalStruct tm = {0, 0};
+ date_time::TimeDuration tm = date_time::TimeDurationZero();
SetTimestamp(data, tm);
- TimevalStruct timestamp2 =
+ date_time::TimeDuration timestamp2 =
GetApplicationData_EXPECT_TRUE(data, recoveredData);
- EXPECT_NE(timestamp1.tv_sec, timestamp2.tv_sec);
+ EXPECT_NE(date_time::getSecs(timestamp1), date_time::getSecs(timestamp2));
AddApplicationDataWithoutIncreaseTable(data); // again insert the same
- TimevalStruct timestamp3 =
+ date_time::TimeDuration timestamp3 =
GetApplicationData_EXPECT_TRUE(data, recoveredData);
EXPECT_TRUE(data == recoveredData);
- EXPECT_NE(timestamp2.tv_sec, timestamp3.tv_sec);
+ EXPECT_NE(date_time::getSecs(timestamp2), date_time::getSecs(timestamp3));
}
TEST_F(AppLaunchDataJsonTest, MaxCount) {
@@ -250,7 +262,7 @@ TEST_F(AppLaunchDataJsonTest, MaxCount) {
// insert new time stamp
ApplicationData changedRecord("mobile_app_id_0", "bundle_id_0", "device_mac");
- TimevalStruct tm = {0, 0};
+ date_time::TimeDuration tm = date_time::TimeDurationZero();
SetTimestamp(changedRecord, tm);
uint32_t size_max = res_json()->GetCurentNumberOfAppData();
@@ -301,7 +313,7 @@ TEST_F(AppLaunchDataJsonTest, SelectMultipleData) {
const std::string mobile_app_id = AddCounter("d1_mobile_app_id_", i);
const std::string bundle_id = AddCounter("d1_bundle_id_", i);
- ApplicationDataPtr app_data = utils::MakeShared<ApplicationData>(
+ ApplicationDataPtr app_data = std::make_shared<ApplicationData>(
mobile_app_id, bundle_id, device_mac_1);
AddApplicationDataWithIncreaseTable(*app_data);
input_data1.push_back(app_data);
@@ -311,7 +323,7 @@ TEST_F(AppLaunchDataJsonTest, SelectMultipleData) {
const std::string mobile_app_id = AddCounter("d2_mobile_app_id_", i);
const std::string bundle_id = AddCounter("d2_bundle_id_", i);
- ApplicationDataPtr app_data = utils::MakeShared<ApplicationData>(
+ ApplicationDataPtr app_data = std::make_shared<ApplicationData>(
mobile_app_id, bundle_id, device_mac_2);
AddApplicationDataWithIncreaseTable(*app_data);
input_data2.push_back(app_data);
@@ -339,6 +351,6 @@ TEST_F(AppLaunchDataJsonTest, SelectMultipleData) {
}
}
-} // namespace app_launch
+} // namespace test_app_launch
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/app_service_manager_test.cc b/src/components/application_manager/test/app_service_manager_test.cc
new file mode 100644
index 0000000000..c2e48c3eda
--- /dev/null
+++ b/src/components/application_manager/test/app_service_manager_test.cc
@@ -0,0 +1,462 @@
+/*
+ * Copyright (c) 2017, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <gmock/gmock.h>
+
+#include "application_manager/commands/command.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "resumption/mock_last_state.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+using testing::_;
+using ::testing::DoAll;
+using ::testing::Mock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::SaveArg;
+
+namespace am = application_manager;
+
+const char* kAppServiceSection = "AppServices";
+const char* kDefaults = "defaults";
+const std::string kServiceType = "MEDIA";
+const std::string kServiceName = "service_name";
+const std::string kServiceId = "service_id";
+const std::string kPolicyAppId = "p_app_id";
+const std::string kPolicyAppId2 = "p_app_id2";
+const uint32_t kConnectionKey = 43629;
+const uint32_t kHMIConnectionKey = 0;
+
+MATCHER_P(CapabilityUpdateMatcher, reason, "") {
+ smart_objects::SmartObject& services_updated =
+ arg[am::strings::system_capability]
+ [am::strings::app_services_capabilities][am::strings::app_services];
+ if (smart_objects::SmartType_Array != services_updated.getType()) {
+ return false;
+ }
+ for (size_t i = 0; i < services_updated.length(); i++) {
+ smart_objects::SmartObject& service_cap = services_updated[i];
+ if (reason == service_cap[am::strings::update_reason].asInt()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+class AppServiceManagerTest : public testing::Test {
+ public:
+ AppServiceManagerTest()
+ : mock_app_ptr_(new MockApplication)
+ , mock_app_ptr2_(new MockApplication)
+ , mock_last_state_(std::make_shared<resumption_test::MockLastState>())
+ , last_state_wrapper_(std::make_shared<resumption::LastStateWrapperImpl>(
+ mock_last_state_))
+ , app_service_manager_(mock_app_manager_, last_state_wrapper_)
+ , mock_message_helper_(
+ application_manager::MockMessageHelper::message_helper_mock()) {
+ Mock::VerifyAndClearExpectations(mock_message_helper_);
+ }
+ ~AppServiceManagerTest() {
+ Mock::VerifyAndClearExpectations(mock_message_helper_);
+ }
+
+ void SetUp() OVERRIDE {
+ ON_CALL(*mock_message_helper_, BroadcastCapabilityUpdate(_, _))
+ .WillByDefault(Return());
+ ON_CALL(mock_settings_, embedded_services())
+ .WillByDefault(ReturnRef(embedded_services_));
+ ON_CALL(mock_app_manager_, get_settings())
+ .WillByDefault(ReturnRef(mock_settings_));
+ ON_CALL(*mock_app_ptr_, policy_app_id())
+ .WillByDefault(Return(kPolicyAppId));
+ ON_CALL(*mock_app_ptr2_, policy_app_id())
+ .WillByDefault(Return(kPolicyAppId2));
+ ON_CALL(*mock_last_state_, dictionary()).WillByDefault(Return(dict_));
+ auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
+ auto app_ptr2 = std::static_pointer_cast<am::Application>(mock_app_ptr2_);
+ ON_CALL(mock_app_manager_, application(kConnectionKey))
+ .WillByDefault(Return(app_ptr));
+ ON_CALL(mock_app_manager_, application(kConnectionKey + 1))
+ .WillByDefault(Return(app_ptr2));
+ }
+
+ protected:
+ smart_objects::SmartObject GenerateMediaManifest(
+ bool allow_app_consumers, std::string app_service_name = kServiceName) {
+ smart_objects::SmartObject manifest(smart_objects::SmartType_Map);
+ manifest[am::strings::service_type] = "MEDIA";
+ manifest[am::strings::service_name] = app_service_name;
+ manifest[am::strings::allow_app_consumers] = allow_app_consumers;
+ manifest[am::strings::media_service_manifest] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ return manifest;
+ }
+
+ smart_objects::SmartObject PublishService(
+ uint32_t connection_key = kConnectionKey,
+ std::string service_name = kServiceName,
+ bool first_run = true) {
+ smart_objects::SmartObject manifest =
+ GenerateMediaManifest(true, service_name);
+
+ Json::Value empty_json;
+ EXPECT_CALL(*mock_last_state_, dictionary()).WillOnce(Return(empty_json));
+
+ EXPECT_CALL(*mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(
+ mobile_apis::ServiceUpdateReason::PUBLISHED),
+ _))
+ .WillOnce(Return());
+ if (first_run) {
+ EXPECT_CALL(*mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(
+ mobile_apis::ServiceUpdateReason::ACTIVATED),
+ _))
+ .WillOnce(Return());
+ }
+ bool mobile_service = connection_key != kHMIConnectionKey;
+ return app_service_manager_.PublishAppService(
+ manifest, mobile_service, connection_key);
+ }
+
+ void CheckCapabilityUpdate(smart_objects::SmartObject& msg_params,
+ size_t length,
+ std::string service_id,
+ mobile_apis::ServiceUpdateReason::eType reason,
+ bool published,
+ bool active) {
+ smart_objects::SmartObject& services_updated =
+ msg_params[am::strings::system_capability]
+ [am::strings::app_services_capabilities]
+ [am::strings::app_services];
+ ASSERT_EQ(smart_objects::SmartType_Array, services_updated.getType());
+ EXPECT_EQ(length, services_updated.length());
+ for (size_t i = 0; i < services_updated.length(); i++) {
+ smart_objects::SmartObject& service_cap = services_updated[i];
+ if (service_id == service_cap[am::strings::updated_app_service_record]
+ [am::strings::service_id]
+ .asString()) {
+ CheckCapability(service_cap, service_id, reason, published, active);
+ return;
+ }
+ }
+ FAIL() << "Unable to find service in capability update with service_id: "
+ << service_id;
+ }
+
+ void CheckCapability(smart_objects::SmartObject& app_service_capability,
+ std::string service_id,
+ mobile_apis::ServiceUpdateReason::eType reason,
+ bool published,
+ bool active) {
+ EXPECT_EQ(reason,
+ app_service_capability[am::strings::update_reason].asInt());
+ smart_objects::SmartObject& updated_record =
+ app_service_capability[am::strings::updated_app_service_record];
+ EXPECT_EQ(service_id, updated_record[am::strings::service_id].asString());
+ EXPECT_EQ(published,
+ updated_record[am::strings::service_published].asBool());
+ EXPECT_EQ(active, updated_record[am::strings::service_active].asBool());
+ }
+
+ Json::Value dict_;
+ std::vector<std::string> embedded_services_;
+ std::shared_ptr<MockApplication> mock_app_ptr_;
+ std::shared_ptr<MockApplication> mock_app_ptr2_;
+ MockApplicationManager mock_app_manager_;
+ std::shared_ptr<resumption_test::MockLastState> mock_last_state_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
+ MockApplicationManagerSettings mock_settings_;
+ application_manager::AppServiceManager app_service_manager_;
+ application_manager::MockMessageHelper* mock_message_helper_;
+};
+
+TEST_F(AppServiceManagerTest, PublishAppService_Mobile_SUCCESS) {
+ smart_objects::SmartObject manifest = GenerateMediaManifest(true);
+
+ Json::Value empty_json;
+ EXPECT_CALL(*mock_last_state_, dictionary()).WillOnce(Return(empty_json));
+
+ smart_objects::SmartObject syscap_update_published;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::PUBLISHED),
+ _))
+ .WillOnce(DoAll(SaveArg<0>(&syscap_update_published), Return()));
+
+ smart_objects::SmartObject syscap_update_activated;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::ACTIVATED),
+ _))
+ .WillOnce(DoAll(SaveArg<0>(&syscap_update_activated), Return()));
+
+ auto record =
+ app_service_manager_.PublishAppService(manifest, true, kConnectionKey);
+
+ // Check final record
+ std::string service_id = record[am::strings::service_id].asString();
+ EXPECT_EQ(manifest, record[am::strings::service_manifest]);
+ EXPECT_TRUE(record[am::strings::service_published].asBool());
+ EXPECT_TRUE(record[am::strings::service_active].asBool());
+
+ // Check first capability update
+ CheckCapabilityUpdate(syscap_update_published,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::PUBLISHED,
+ true,
+ false);
+
+ // Check second capability update
+ CheckCapabilityUpdate(syscap_update_activated,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::ACTIVATED,
+ true,
+ true);
+}
+
+TEST_F(AppServiceManagerTest, PublishAppService_HMI_SUCCESS) {
+ smart_objects::SmartObject manifest = GenerateMediaManifest(true);
+
+ Json::Value empty_json;
+ EXPECT_CALL(*mock_last_state_, dictionary()).WillOnce(Return(empty_json));
+
+ smart_objects::SmartObject syscap_update_published;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::PUBLISHED),
+ _))
+ .WillOnce(DoAll(SaveArg<0>(&syscap_update_published), Return()));
+
+ smart_objects::SmartObject syscap_update_activated;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::ACTIVATED),
+ _))
+ .WillOnce(DoAll(SaveArg<0>(&syscap_update_activated), Return()));
+
+ auto record = app_service_manager_.PublishAppService(manifest, false);
+
+ // Check final record
+ std::string service_id = record[am::strings::service_id].asString();
+ EXPECT_EQ(manifest, record[am::strings::service_manifest]);
+ EXPECT_TRUE(record[am::strings::service_published].asBool());
+ EXPECT_TRUE(record[am::strings::service_active].asBool());
+
+ // Check first capability update
+ CheckCapabilityUpdate(syscap_update_published,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::PUBLISHED,
+ true,
+ false);
+
+ // Check second capability update
+ CheckCapabilityUpdate(syscap_update_activated,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::ACTIVATED,
+ true,
+ true);
+}
+
+TEST_F(AppServiceManagerTest, UnpublishAppService_SUCCESS) {
+ auto record = PublishService();
+
+ smart_objects::SmartObject syscap_update_unpublished;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::REMOVED),
+ _))
+ .WillOnce(DoAll(SaveArg<0>(&syscap_update_unpublished), Return()));
+ std::string service_id = record[am::strings::service_id].asString();
+
+ EXPECT_TRUE(app_service_manager_.UnpublishAppService(service_id));
+
+ // Check removed capability update
+ CheckCapabilityUpdate(syscap_update_unpublished,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::REMOVED,
+ false,
+ false);
+}
+
+TEST_F(AppServiceManagerTest, ActivateAppService_AlreadyActivated) {
+ auto record = PublishService();
+
+ // No capability update
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::ACTIVATED),
+ _))
+ .Times(0);
+ std::string service_id = record[am::strings::service_id].asString();
+
+ EXPECT_TRUE(app_service_manager_.ActivateAppService(service_id));
+}
+
+TEST_F(AppServiceManagerTest, ActivateAppService_TwoApps_SUCCESS) {
+ // Register two services with the same service type, the first is activated
+ // automatically
+ auto record = PublishService();
+ auto record2 = PublishService(kConnectionKey + 1, kServiceName + "2", false);
+
+ // No capability update
+ smart_objects::SmartObject syscap_update_activated;
+ EXPECT_CALL(
+ *mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(mobile_apis::ServiceUpdateReason::ACTIVATED),
+ _))
+ .WillOnce(DoAll(SaveArg<0>(&syscap_update_activated), Return()));
+ std::string service_id = record[am::strings::service_id].asString();
+ std::string service_id2 = record2[am::strings::service_id].asString();
+
+ // Activate the second service
+ EXPECT_TRUE(app_service_manager_.ActivateAppService(service_id2));
+
+ // Check that the first service is deactivated
+ CheckCapabilityUpdate(syscap_update_activated,
+ 2,
+ service_id,
+ mobile_apis::ServiceUpdateReason::DEACTIVATED,
+ true,
+ false);
+
+ // Check that the second service is activated
+ CheckCapabilityUpdate(syscap_update_activated,
+ 2,
+ service_id2,
+ mobile_apis::ServiceUpdateReason::ACTIVATED,
+ true,
+ true);
+}
+
+TEST_F(AppServiceManagerTest, DeactivateAppService_SUCCESS) {
+ auto record = PublishService();
+
+ smart_objects::SmartObject syscap_update_deactivated;
+ EXPECT_CALL(*mock_message_helper_,
+ BroadcastCapabilityUpdate(
+ CapabilityUpdateMatcher(
+ mobile_apis::ServiceUpdateReason::DEACTIVATED),
+ _))
+ .WillOnce(DoAll(SaveArg<0>(&syscap_update_deactivated), Return()));
+ std::string service_id = record[am::strings::service_id].asString();
+
+ EXPECT_TRUE(app_service_manager_.DeactivateAppService(service_id));
+
+ // Check deactivated capability update
+ CheckCapabilityUpdate(syscap_update_deactivated,
+ 1,
+ service_id,
+ mobile_apis::ServiceUpdateReason::DEACTIVATED,
+ true,
+ false);
+}
+
+TEST_F(AppServiceManagerTest, ActiveServiceForType_SUCCESS) {
+ auto record = PublishService();
+
+ auto service = app_service_manager_.ActiveServiceForType(kServiceType);
+
+ ASSERT_FALSE(service == NULL);
+ EXPECT_EQ(record, service->record);
+ EXPECT_EQ(kConnectionKey, service->connection_key);
+ EXPECT_TRUE(service->mobile_service);
+}
+
+TEST_F(AppServiceManagerTest, EmbeddedServiceForType_SUCCESS) {
+ auto record = PublishService(kHMIConnectionKey);
+
+ auto service = app_service_manager_.EmbeddedServiceForType(kServiceType);
+
+ ASSERT_FALSE(service == NULL);
+ EXPECT_EQ(record, service->record);
+ EXPECT_FALSE(service->mobile_service);
+}
+
+TEST_F(AppServiceManagerTest, FindServiceByID_SUCCESS) {
+ auto record = PublishService();
+
+ std::string service_id = record[am::strings::service_id].asString();
+ auto service = app_service_manager_.FindServiceByID(service_id);
+
+ ASSERT_FALSE(service == NULL);
+ EXPECT_EQ(record, service->record);
+ EXPECT_EQ(kConnectionKey, service->connection_key);
+ EXPECT_TRUE(service->mobile_service);
+}
+
+TEST_F(AppServiceManagerTest, GetAllServiceRecords_OneService_SUCCESS) {
+ auto record = PublishService();
+
+ auto records = app_service_manager_.GetAllServiceRecords();
+
+ ASSERT_EQ(1u, records.size());
+ EXPECT_EQ(record, records[0]);
+}
+
+TEST_F(AppServiceManagerTest, GetActiveServices_OneService_SUCCESS) {
+ auto record = PublishService();
+
+ auto services = app_service_manager_.GetActiveServices();
+
+ ASSERT_EQ(1u, services.size());
+ EXPECT_EQ(record, services[0].record);
+ EXPECT_EQ(kConnectionKey, services[0].connection_key);
+ EXPECT_TRUE(services[0].mobile_service);
+}
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/application_helper_test.cc b/src/components/application_manager/test/application_helper_test.cc
index c9a8fd2da4..ec84acc697 100644
--- a/src/components/application_manager/test/application_helper_test.cc
+++ b/src/components/application_manager/test/application_helper_test.cc
@@ -36,43 +36,43 @@
#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_message_helper.h"
-#include "policy/usage_statistics/mock_statistics_manager.h"
#include "policy/mock_policy_settings.h"
+#include "policy/usage_statistics/mock_statistics_manager.h"
#include "application_manager/application.h"
#include "application_manager/application_impl.h"
#include "application_manager/application_manager_impl.h"
-#include "application_manager/usage_statistics.h"
#include "application_manager/helpers/application_helper.h"
#include "application_manager/smart_object_keys.h"
-#include "interfaces/MOBILE_API.h"
+#include "application_manager/usage_statistics.h"
#include "connection_handler/device.h"
+#include "interfaces/MOBILE_API.h"
#include "smart_objects/smart_object.h"
#include "utils/custom_string.h"
#include "utils/macro.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-#include "test/resumption/mock_last_state.h"
+
#include "media_manager/mock_media_manager.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "test/resumption/mock_last_state.h"
namespace {
const uint8_t expected_tread_pool_size = 2u;
const uint8_t stop_streaming_timeout = 1u;
const std::string kDirectoryName = "./test_storage";
const std::vector<std::string> kTimeoutPrompt{"timeoutPrompt"};
-}
+} // namespace
namespace test {
namespace components {
namespace application_manager_test {
+using resumption_test::MockLastState;
+using test::components::media_manager_test::MockMediaManager;
using testing::_;
using ::testing::Mock;
using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using resumption_test::MockLastState;
-using test::components::media_manager_test::MockMediaManager;
using namespace application_manager;
using namespace policy_handler_test;
@@ -119,15 +119,18 @@ class ApplicationHelperTest : public testing::Test {
const std::string path_to_plagin = "";
EXPECT_CALL(mock_application_manager_settings_, plugins_folder())
.WillOnce(ReturnRef(path_to_plagin));
- app_manager_impl_.Init(mock_last_state_, &mock_media_manager_);
+ mock_last_state_ = std::make_shared<MockLastState>();
+ last_state_wrapper_ =
+ std::make_shared<resumption::LastStateWrapperImpl>(mock_last_state_);
+ app_manager_impl_.Init(last_state_wrapper_, &mock_media_manager_);
- app_impl_ = new ApplicationImpl(
+ app_impl_ = std::make_shared<ApplicationImpl>(
application_id,
policy_app_id,
mac_address,
device_id,
app_name,
- utils::MakeShared<usage_statistics_test::MockStatisticsManager>(),
+ std::make_shared<usage_statistics_test::MockStatisticsManager>(),
app_manager_impl_);
}
@@ -137,7 +140,8 @@ class ApplicationHelperTest : public testing::Test {
ApplicationManagerImpl app_manager_impl_;
MockMediaManager mock_media_manager_;
- MockLastState mock_last_state_;
+ std::shared_ptr<MockLastState> mock_last_state_;
+ std::shared_ptr<resumption::LastStateWrapperImpl> last_state_wrapper_;
ApplicationSharedPtr app_impl_;
};
@@ -256,6 +260,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectHMICleanupRequests) {
application_manager::DeleteApplicationData(app_impl_, app_manager_impl_);
}
-} // application_manager_test
-} // components
-} // test
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc
index d88dbfaf79..b6ec150523 100644
--- a/src/components/application_manager/test/application_impl_test.cc
+++ b/src/components/application_manager/test/application_impl_test.cc
@@ -33,27 +33,27 @@
#include "application_manager/application_impl.h"
#include <stdint.h>
+
#include <iostream>
-#include "gtest/gtest.h"
+#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/hmi_state.h"
-#include "utils/file_system.h"
-
-#include "utils/make_shared.h"
-#include "application_manager/mock_message_helper.h"
-#include "utils/custom_string.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_request_controller_settings.h"
-#include "application_manager/event_engine/event_dispatcher.h"
-#include "application_manager/state_controller.h"
-#include "resumption/last_state.h"
-#include "application_manager/resumption/resume_ctrl.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
#include "application_manager/mock_resume_ctrl.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/state_controller.h"
+#include "gtest/gtest.h"
#include "policy/usage_statistics/mock_statistics_manager.h"
+#include "resumption/last_state.h"
#include "smart_objects/smart_object.h"
+#include "utils/custom_string.h"
+#include "utils/file_system.h"
#include "utils/test_async_waiter.h"
+#include "utils/threads/async_runner.h"
namespace test {
namespace components {
@@ -65,12 +65,20 @@ using namespace mobile_apis;
namespace custom_str = utils::custom_string;
using ::testing::_;
+using ::testing::AtLeast;
+using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::AtLeast;
using usage_statistics_test::MockStatisticsManager;
-typedef void (ApplicationImpl::*AddSet)(HmiStatePtr args);
+typedef void (ApplicationImpl::*AddSet)(const WindowID window_id,
+ HmiStatePtr args);
+
+namespace {
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const std::string kDefaultWindowName = "DefaultName";
+} // namespace
class ApplicationImplTest : public ::testing::Test {
protected:
@@ -92,21 +100,29 @@ class ApplicationImplTest : public ::testing::Test {
EXPECT_CALL(mock_application_manager_settings_, app_storage_folder())
.WillRepeatedly(ReturnRef(directory_name));
EXPECT_CALL(mock_application_manager_settings_,
- audio_data_stopped_timeout()).WillOnce(Return(0));
+ audio_data_stopped_timeout())
+ .WillOnce(Return(0));
EXPECT_CALL(mock_application_manager_settings_,
- video_data_stopped_timeout()).WillOnce(Return(0));
+ video_data_stopped_timeout())
+ .WillOnce(Return(0));
app_impl.reset(
new ApplicationImpl(app_id,
policy_app_id,
mac_address,
device_handle,
app_name,
- utils::MakeShared<MockStatisticsManager>(),
+ std::make_shared<MockStatisticsManager>(),
mock_application_manager_));
HmiStatePtr initial_state = CreateTestHmiState();
- app_impl->SetInitialState(initial_state);
+ app_impl->SetInitialState(
+ kDefaultWindowId, kDefaultWindowName, initial_state);
+ }
+
+ virtual void TearDown() OVERRIDE {
+ Mock::VerifyAndClearExpectations(MockMessageHelper::message_helper_mock());
}
+
HmiStatePtr CreateTestHmiState();
HmiStatePtr TestAddHmiState(HMILevel::eType hmi_lvl,
@@ -114,15 +130,21 @@ class ApplicationImplTest : public ::testing::Test {
AddSet hmi_action);
void CheckCurrentHMIState();
+ // 'directory_name' has to be declared prior to 'app_impl' so that when
+ // deleting ApplicationImplTest class, 'directory_name' will be removed
+ // after 'app_impl' runs its destructor.
+ // (ApplicationImpl's destructor calls CleanupFiles(), which will call
+ // application_manager_.get_settings().app_storage_folder() and will
+ // access 'directory_name'.)
+ const std::string directory_name = "./test_storage";
MockApplicationManagerSettings mock_application_manager_settings_;
MockApplicationManager mock_application_manager_;
- utils::SharedPtr<ApplicationImpl> app_impl;
+ std::shared_ptr<ApplicationImpl> app_impl;
uint32_t app_id;
std::string policy_app_id;
std::string mac_address;
connection_handler::DeviceHandle device_handle;
custom_str::CustomString app_name;
- const std::string directory_name = "./test_storage";
HmiState::StateID state_id;
HmiStatePtr testHmiState;
HMILevel::eType test_lvl;
@@ -131,8 +153,8 @@ class ApplicationImplTest : public ::testing::Test {
};
HmiStatePtr ApplicationImplTest::CreateTestHmiState() {
- HmiStatePtr testState = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(app_impl),
+ HmiStatePtr testState = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(app_impl),
mock_application_manager_,
state_id);
testState->set_hmi_level(test_lvl);
@@ -147,12 +169,12 @@ HmiStatePtr ApplicationImplTest::TestAddHmiState(HMILevel::eType hmi_lvl,
test_lvl = hmi_lvl;
state_id = id_state;
HmiStatePtr state = CreateTestHmiState();
- ((app_impl.get())->*hmi_action)(state);
+ ((app_impl.get())->*hmi_action)(kDefaultWindowId, state);
return state;
}
void ApplicationImplTest::CheckCurrentHMIState() {
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(test_lvl, current_state->hmi_level());
EXPECT_EQ(state_id, current_state->state_id());
}
@@ -195,7 +217,7 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetRegularState) {
HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
- HmiStatePtr current_state = app_impl->RegularHmiState();
+ HmiStatePtr current_state = app_impl->RegularHmiState(kDefaultWindowId);
EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
EXPECT_EQ(HmiState::STATE_ID_REGULAR, current_state->state_id());
EXPECT_EQ(app_id, app_impl->app_id());
@@ -216,8 +238,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveLastState) {
CheckCurrentHMIState();
// Remove last state
- app_impl->RemoveHMIState(state3->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state3->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state2, current_state);
EXPECT_EQ(HMILevel::HMI_NONE, current_state->hmi_level());
EXPECT_EQ(HmiState::STATE_ID_VIDEO_STREAMING, current_state->state_id());
@@ -237,8 +259,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveNotLastNotFirstState) {
CheckCurrentHMIState();
// Remove not last state
- app_impl->RemoveHMIState(state2->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state2->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state3, current_state);
// HMI level is equal to parent hmi_level
EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
@@ -260,13 +282,13 @@ TEST_F(ApplicationImplTest, AddStates_RemoveFirstState) {
CheckCurrentHMIState();
// Remove first added state
- app_impl->RemoveHMIState(state1->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state1->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state3, current_state);
// Last state does not have a parent
EXPECT_EQ(HMILevel::HMI_LIMITED, current_state->hmi_level());
EXPECT_EQ(HmiState::STATE_ID_TTS_SESSION, current_state->state_id());
- EXPECT_EQ(NULL, current_state->parent());
+ EXPECT_EQ(nullptr, current_state->parent());
}
TEST_F(ApplicationImplTest, SetRegularState_RemoveFirstState) {
@@ -283,8 +305,8 @@ TEST_F(ApplicationImplTest, SetRegularState_RemoveFirstState) {
CheckCurrentHMIState();
// Remove first state
- app_impl->RemoveHMIState(state1->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state1->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state3, current_state);
// Last state has a parent
EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
@@ -299,13 +321,13 @@ TEST_F(ApplicationImplTest, SetPostponedState_RemovePostponedState) {
&ApplicationImpl::SetPostponedState);
// Check that state was setted correctly
- HmiStatePtr state2 = app_impl->PostponedHmiState();
+ HmiStatePtr state2 = app_impl->PostponedHmiState(kDefaultWindowId);
EXPECT_EQ(state1, state2);
// Check that state was correctly removed
- app_impl->RemovePostponedState();
- state2 = app_impl->PostponedHmiState();
- EXPECT_EQ(NULL, state2);
+ app_impl->RemovePostponedState(kDefaultWindowId);
+ state2 = app_impl->PostponedHmiState(kDefaultWindowId);
+ EXPECT_EQ(nullptr, state2);
}
TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) {
@@ -315,9 +337,9 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) {
HmiState::STATE_ID_REGULAR,
&ApplicationImpl::SetRegularState);
- EXPECT_EQ(test_lvl, app_impl->hmi_level());
+ EXPECT_EQ(test_lvl, app_impl->hmi_level(kDefaultWindowId));
EXPECT_EQ(audiostate, app_impl->audio_streaming_state());
- EXPECT_EQ(syst_context, app_impl->system_context());
+ EXPECT_EQ(syst_context, app_impl->system_context(kDefaultWindowId));
audiostate = AudioStreamingState::AUDIBLE;
syst_context = SystemContext::SYSCTXT_MENU;
@@ -325,9 +347,9 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) {
HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
- EXPECT_EQ(test_lvl, app_impl->hmi_level());
+ EXPECT_EQ(test_lvl, app_impl->hmi_level(kDefaultWindowId));
EXPECT_EQ(audiostate, app_impl->audio_streaming_state());
- EXPECT_EQ(syst_context, app_impl->system_context());
+ EXPECT_EQ(syst_context, app_impl->system_context(kDefaultWindowId));
}
TEST_F(ApplicationImplTest, IsAudioApplication) {
@@ -401,7 +423,7 @@ TEST_F(ApplicationImplTest, GetFile) {
test_file.file_type = FileType::GRAPHIC_JPEG;
test_file.file_name = "test_file 1";
- EXPECT_EQ(NULL, app_impl->GetFile(test_file.file_name));
+ EXPECT_EQ(nullptr, app_impl->GetFile(test_file.file_name));
EXPECT_TRUE(app_impl->AddFile(test_file));
const AppFile* app_file = app_impl->GetFile(test_file.file_name);
EXPECT_EQ(test_file.is_persistent, app_file->is_persistent);
@@ -553,7 +575,9 @@ TEST_F(ApplicationImplTest, SubscribeToSoftButton_UnsubscribeFromSoftButton) {
SoftButtonID test_button;
for (uint i = 0; i < btn_count; i++) {
- test_button.insert(i);
+ test_button.insert(std::make_pair(
+ i,
+ static_cast<WindowID>(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
}
app_impl->SubscribeToSoftButtons(FunctionID::ScrollableMessageID,
test_button);
@@ -656,7 +680,8 @@ TEST_F(ApplicationImplTest,
TEST_F(ApplicationImplTest, UpdateHash_AppMngrNotSuspended) {
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
- SendHashUpdateNotification(app_id, _)).Times(1);
+ SendHashUpdateNotification(app_id, _))
+ .Times(1);
resumprion_test::MockResumeCtrl mock_resume_ctrl;
EXPECT_CALL(mock_application_manager_, resume_controller())
.WillOnce(ReturnRef(mock_resume_ctrl));
@@ -668,7 +693,8 @@ TEST_F(ApplicationImplTest, UpdateHash_AppMngrNotSuspended) {
TEST_F(ApplicationImplTest, UpdateHash_AppMngrSuspended) {
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
- SendHashUpdateNotification(app_id, _)).Times(0);
+ SendHashUpdateNotification(app_id, _))
+ .Times(0);
resumprion_test::MockResumeCtrl mock_resume_ctrl;
EXPECT_CALL(mock_application_manager_, resume_controller())
.WillOnce(ReturnRef(mock_resume_ctrl));
@@ -689,7 +715,8 @@ TEST_F(ApplicationImplTest, SetVideoConfig_MobileNavi_StreamingNotApproved) {
TEST_F(ApplicationImplTest, SetVideoConfig_MobileNavi_StreamingApproved) {
app_impl->set_video_streaming_approved(true);
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
- SendNaviSetVideoConfig(app_id, _, _)).Times(0);
+ SendNaviSetVideoConfig(app_id, _, _))
+ .Times(0);
smart_objects::SmartObject params;
app_impl->SetVideoConfig(protocol_handler::ServiceType::kMobileNav, params);
@@ -697,7 +724,8 @@ TEST_F(ApplicationImplTest, SetVideoConfig_MobileNavi_StreamingApproved) {
TEST_F(ApplicationImplTest, SetVideoConfig_NotMobileNavi) {
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
- SendNaviSetVideoConfig(app_id, _, _)).Times(0);
+ SendNaviSetVideoConfig(app_id, _, _))
+ .Times(0);
smart_objects::SmartObject params;
app_impl->SetVideoConfig(protocol_handler::ServiceType::kAudio, params);
@@ -722,13 +750,15 @@ TEST_F(ApplicationImplTest, StartStreaming_Audio_StreamingNotApproved) {
TEST_F(ApplicationImplTest, StartStreaming_StreamingApproved) {
app_impl->set_video_streaming_approved(true);
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
- SendNaviStartStream(app_id, _)).Times(0);
+ SendNaviStartStream(app_id, _))
+ .Times(0);
app_impl->StartStreaming(protocol_handler::ServiceType::kMobileNav);
app_impl->set_audio_streaming_approved(true);
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
- SendAudioStartStream(app_id, _)).Times(0);
+ SendAudioStartStream(app_id, _))
+ .Times(0);
app_impl->StartStreaming(protocol_handler::ServiceType::kAudio);
}
@@ -736,16 +766,16 @@ TEST_F(ApplicationImplTest, SuspendNaviStreaming) {
protocol_handler::ServiceType type =
protocol_handler::ServiceType::kMobileNav;
EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
- EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
- SendOnDataStreaming(type, false, _));
+ EXPECT_CALL(mock_application_manager_,
+ ProcessOnDataStreamingNotification(type, app_id, false));
app_impl->SuspendStreaming(type);
}
TEST_F(ApplicationImplTest, SuspendAudioStreaming) {
protocol_handler::ServiceType type = protocol_handler::ServiceType::kAudio;
EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
- EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
- SendOnDataStreaming(type, false, _));
+ EXPECT_CALL(mock_application_manager_,
+ ProcessOnDataStreamingNotification(type, app_id, false));
app_impl->SuspendStreaming(type);
}
@@ -784,8 +814,8 @@ TEST_F(ApplicationImplTest, StopStreaming_StreamingApproved) {
app_impl->set_video_streaming_approved(true);
EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
- EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
- SendOnDataStreaming(type, false, _));
+ EXPECT_CALL(mock_application_manager_,
+ ProcessOnDataStreamingNotification(type, app_id, false));
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
SendNaviStopStream(app_id, _));
@@ -796,8 +826,8 @@ TEST_F(ApplicationImplTest, StopStreaming_StreamingApproved) {
app_impl->set_audio_streaming_approved(true);
type = protocol_handler::ServiceType::kAudio;
EXPECT_CALL(mock_application_manager_, OnAppStreaming(app_id, type, false));
- EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
- SendOnDataStreaming(type, false, _));
+ EXPECT_CALL(mock_application_manager_,
+ ProcessOnDataStreamingNotification(type, app_id, false));
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
SendAudioStopStream(app_id, _));
@@ -807,7 +837,7 @@ TEST_F(ApplicationImplTest, StopStreaming_StreamingApproved) {
TEST_F(ApplicationImplTest, PushPopMobileMessage) {
smart_objects::SmartObjectSPtr on_driver_distraction =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
const hmi_apis::Common_DriverDistractionState::eType state =
hmi_apis::Common_DriverDistractionState::DD_ON;
(*on_driver_distraction)[strings::params][strings::function_id] =
@@ -828,6 +858,29 @@ TEST_F(ApplicationImplTest, PushPopMobileMessage) {
EXPECT_TRUE(messages.empty());
}
+TEST_F(ApplicationImplTest, SetSecondaryDeviceTest) {
+ connection_handler::DeviceHandle initial_device =
+ app_impl->secondary_device();
+ EXPECT_EQ(0u, initial_device);
+
+ connection_handler::DeviceHandle device = 123;
+ app_impl->set_secondary_device(device);
+
+ EXPECT_EQ(device, app_impl->secondary_device());
+}
+
+TEST_F(ApplicationImplTest, SetDeferredResumptionHMILevelTest) {
+ using namespace mobile_api::HMILevel;
+ HMILevel::eType initial_deferred_level =
+ app_impl->deferred_resumption_hmi_level();
+ EXPECT_EQ(HMILevel::eType::INVALID_ENUM, initial_deferred_level);
+
+ HMILevel::eType deferred_level = HMILevel::eType::HMI_FULL;
+ app_impl->set_deferred_resumption_hmi_level(deferred_level);
+
+ EXPECT_EQ(deferred_level, app_impl->deferred_resumption_hmi_level());
+}
+
TEST_F(ApplicationImplTest, WaitForSetupDone_SetupNotInProgress) {
// test should succeed without blocking on WaitForSetupDone()
app_impl->WaitForSetupDone();
@@ -836,8 +889,8 @@ TEST_F(ApplicationImplTest, WaitForSetupDone_SetupNotInProgress) {
TEST_F(ApplicationImplTest, WaitForSetupDone_SetupInProgress) {
class Delegate : public threads::ThreadDelegate {
public:
- Delegate(utils::SharedPtr<ApplicationImpl> app,
- ::utils::SharedPtr<TestAsyncWaiter> waiter,
+ Delegate(std::shared_ptr<ApplicationImpl> app,
+ std::shared_ptr<TestAsyncWaiter> waiter,
unsigned int waitSeconds)
: app_(app), waiter_(waiter), seconds_(waitSeconds) {}
virtual ~Delegate() {}
@@ -849,13 +902,13 @@ TEST_F(ApplicationImplTest, WaitForSetupDone_SetupInProgress) {
virtual void exitThreadMain() {}
private:
- utils::SharedPtr<ApplicationImpl> app_;
- ::utils::SharedPtr<TestAsyncWaiter> waiter_;
+ std::shared_ptr<ApplicationImpl> app_;
+ std::shared_ptr<TestAsyncWaiter> waiter_;
unsigned int seconds_;
};
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter =
+ std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
unsigned int waitSeconds = 3;
diff --git a/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc b/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc
index 9ae388c809..f8dddcfe27 100644
--- a/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc
@@ -33,25 +33,25 @@
#include <memory>
#include <string>
-#include "gtest/gtest.h"
#include "application_manager/application.h"
#include "application_manager/application_impl.h"
#include "application_manager/application_manager_impl.h"
+#include "gtest/gtest.h"
#include "utils/custom_string.h"
-#include "utils/make_shared.h"
+
#include "encryption/hashing.h"
#include "application_manager/mock_application_manager_settings.h"
-#include "application_manager/mock_resumption_data.h"
#include "application_manager/mock_command_factory.h"
#include "application_manager/mock_request.h"
+#include "application_manager/mock_resumption_data.h"
+#include "application_manager/mock_rpc_plugin.h"
+#include "application_manager/mock_rpc_plugin_manager.h"
#include "connection_handler/mock_connection_handler.h"
#include "policy/mock_policy_settings.h"
#include "policy/usage_statistics/mock_statistics_manager.h"
-#include "protocol_handler/mock_session_observer.h"
#include "protocol_handler/mock_protocol_handler.h"
-#include "application_manager/mock_rpc_plugin_manager.h"
-#include "application_manager/mock_rpc_plugin.h"
+#include "protocol_handler/mock_session_observer.h"
#include "utils/optional.h"
namespace test {
@@ -63,9 +63,9 @@ namespace am = application_manager;
using testing::_;
using ::testing::DoAll;
using ::testing::Mock;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
using ::testing::SetArgPointee;
using namespace application_manager;
@@ -87,7 +87,7 @@ class ApplicationManagerImplMockHmiTest : public ::testing::Test {
public:
ApplicationManagerImplMockHmiTest()
: mock_storage_(
- ::utils::MakeShared<NiceMock<resumption_test::MockResumptionData> >(
+ std::make_shared<NiceMock<resumption_test::MockResumptionData> >(
mock_app_mngr_)) {}
protected:
@@ -146,8 +146,7 @@ class ApplicationManagerImplMockHmiTest : public ::testing::Test {
Return(0)));
}
- utils::SharedPtr<NiceMock<resumption_test::MockResumptionData> >
- mock_storage_;
+ std::shared_ptr<NiceMock<resumption_test::MockResumptionData> > mock_storage_;
application_manager_test::MockApplicationManager mock_app_mngr_;
NiceMock<policy_handler_test::MockPolicySettings> mock_policy_settings_;
NiceMock<connection_handler_test::MockConnectionHandler>
@@ -168,13 +167,13 @@ TEST_F(ApplicationManagerImplMockHmiTest,
plugin_manager::MockRPCPluginManager* mock_rpc_plugin_manager =
new plugin_manager::MockRPCPluginManager;
- utils::SharedPtr<ApplicationImpl> app_impl = new ApplicationImpl(
+ std::shared_ptr<ApplicationImpl> app_impl = std::make_shared<ApplicationImpl>(
application_id,
policy_app_id,
encryption::MakeHash(mac_address),
device_id,
app_name,
- utils::SharedPtr<usage_statistics::StatisticsManager>(
+ std::shared_ptr<usage_statistics::StatisticsManager>(
new usage_statistics_test::MockStatisticsManager()),
*app_manager_impl_);
std::unique_ptr<plugin_manager::RPCPluginManager> mock_rpc_plugin_manager_ptr(
@@ -192,11 +191,6 @@ TEST_F(ApplicationManagerImplMockHmiTest,
MockCommandFactory mock_command_factory;
- // // Skip sending notification on device switching as it is not the goal
- // here
- EXPECT_CALL(mock_command_factory, CreateCommand(_, _))
- .WillOnce(Return(utils::SharedPtr<commands::Command>()));
-
plugin_manager::MockRPCPlugin mock_rpc_plugin;
utils::Optional<plugin_manager::RPCPlugin> mock_rpc_plugin_opt =
mock_rpc_plugin;
@@ -212,15 +206,15 @@ TEST_F(ApplicationManagerImplMockHmiTest,
const uint32_t correlation_id_1 = 1u;
const uint32_t correlation_id_2 = 2u;
const uint32_t correlation_id_3 = 3u;
- utils::SharedPtr<NiceMock<MockRequest> > cmd_1 =
- utils::MakeShared<NiceMock<MockRequest> >(connection_key,
- correlation_id_1);
- utils::SharedPtr<NiceMock<MockRequest> > cmd_2 =
- utils::MakeShared<NiceMock<MockRequest> >(connection_key,
- correlation_id_2);
- utils::SharedPtr<NiceMock<MockRequest> > cmd_3 =
- utils::MakeShared<NiceMock<MockRequest> >(connection_key,
- correlation_id_3);
+ std::shared_ptr<NiceMock<MockRequest> > cmd_1 =
+ std::make_shared<NiceMock<MockRequest> >(connection_key,
+ correlation_id_1);
+ std::shared_ptr<NiceMock<MockRequest> > cmd_2 =
+ std::make_shared<NiceMock<MockRequest> >(connection_key,
+ correlation_id_2);
+ std::shared_ptr<NiceMock<MockRequest> > cmd_3 =
+ std::make_shared<NiceMock<MockRequest> >(connection_key,
+ correlation_id_3);
EXPECT_CALL(mock_command_factory, CreateCommand(_, _))
.WillOnce(Return(cmd_1))
@@ -228,11 +222,11 @@ TEST_F(ApplicationManagerImplMockHmiTest,
.WillOnce(Return(cmd_3));
commands::MessageSharedPtr hmi_msg_1 =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
commands::MessageSharedPtr hmi_msg_2 =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
commands::MessageSharedPtr hmi_msg_3 =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*hmi_msg_1)[strings::msg_params][strings::app_id] =
(*hmi_msg_2)[strings::msg_params][strings::app_id] =
@@ -270,6 +264,6 @@ TEST_F(ApplicationManagerImplMockHmiTest,
Mock::VerifyAndClearExpectations(&mock_command_factory);
}
-} // application_manager_test
+} // namespace application_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc
index c13a47aae5..2c16048e97 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -29,38 +29,46 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <bson_object.h>
#include <stdint.h>
#include <memory>
#include <set>
#include <string>
#include <vector>
-#include <bson_object.h>
-#include "gtest/gtest.h"
#include "application_manager/application.h"
#include "application_manager/application_impl.h"
#include "application_manager/application_manager_impl.h"
+#include "application_manager/hmi_state.h"
+#include "application_manager/mock_app_service_manager.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_resumption_data.h"
-#include "application_manager/mock_rpc_service.h"
#include "application_manager/mock_rpc_plugin_manager.h"
+#include "application_manager/mock_rpc_service.h"
+#include "application_manager/mock_state_controller.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
#include "application_manager/resumption/resume_ctrl_impl.h"
#include "application_manager/test/include/application_manager/mock_message_helper.h"
#include "connection_handler/mock_connection_handler.h"
+#include "gtest/gtest.h"
#include "hmi_message_handler/mock_hmi_message_handler.h"
#include "media_manager/mock_media_manager.h"
#include "policy/mock_policy_settings.h"
#include "policy/usage_statistics/mock_statistics_manager.h"
#include "protocol/bson_object_keys.h"
-#include "protocol_handler/mock_session_observer.h"
#include "protocol_handler/mock_protocol_handler.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "resumption/mock_last_state.h"
#include "utils/custom_string.h"
#include "utils/file_system.h"
#include "utils/lock.h"
-#include "utils/make_shared.h"
-#include "utils/push_log.h"
+
#include "encryption/hashing.h"
+#ifdef ENABLE_LOG
+#include "utils/push_log.h"
+#endif
namespace test {
namespace components {
@@ -71,15 +79,21 @@ namespace policy_test = test::components::policy_handler_test;
namespace con_test = connection_handler_test;
using testing::_;
-using ::testing::Matcher;
+using ::testing::An;
using ::testing::ByRef;
using ::testing::DoAll;
+using ::testing::Matcher;
using ::testing::Mock;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
using ::testing::SaveArg;
using ::testing::SetArgPointee;
+using ::testing::SetArgReferee;
+
+using application_manager::plugin_manager::MockRPCPluginManager;
+using test::components::application_manager_test::MockStateController;
+using test::components::policy_test::MockPolicyHandlerInterface;
using namespace application_manager;
@@ -89,44 +103,140 @@ ACTION_P6(InvokeMemberFuncWithArg4, ptr, memberFunc, a, b, c, d) {
}
namespace {
+const uint32_t kCorrelationID = 54321u;
const std::string kDirectoryName = "./test_storage";
const uint32_t kTimeout = 10000u;
connection_handler::DeviceHandle kDeviceId = 12345u;
const std::string kAppId = "someID";
const uint32_t kConnectionKey = 1232u;
const std::string kAppName = "appName";
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const std::vector<std::string> kEnabledLocalApps = {"localAppId"};
+
+typedef hmi_apis::Common_ServiceStatusUpdateReason::eType
+ ServiceStatusUpdateReason;
+typedef hmi_apis::Common_ServiceType::eType ServiceType;
+typedef hmi_apis::Common_ServiceEvent::eType ServiceEvent;
+typedef utils::Optional<ServiceStatusUpdateReason> UpdateReasonOptional;
+
+const std::string kPolicyAppID = "test policy id";
+transport_manager::DeviceInfo kDeviceInfo(1,
+ "mac",
+ "name",
+ "WEB_ENGINE_DEVICE");
+
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+// Cloud application params
+const std::string kEndpoint = "endpoint";
+const std::string kEndpoint2 = "https://fakesdlcloudapptesting.com:8080";
+const std::string kAuthToken = "auth_token";
+const std::string kCertificate = "cert";
+const std::string kTransportType = "WS";
+const mobile_api::HybridAppPreference::eType kHybridAppPreference =
+ mobile_api::HybridAppPreference::CLOUD;
+const std::string kHybridAppPreferenceStr = "CLOUD";
+const bool kEnabled = true;
+const policy::AppProperties app_properties(kEndpoint2,
+ kCertificate,
+ kEnabled,
+ kAuthToken,
+ kTransportType,
+ kHybridAppPreferenceStr);
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
} // namespace
-class ApplicationManagerImplTest : public ::testing::Test {
+struct ServiceStatus {
+ ServiceType service_type_;
+ ServiceEvent service_event_;
+ UpdateReasonOptional reason_;
+
+ ServiceStatus(ServiceType type,
+ ServiceEvent event,
+ UpdateReasonOptional reason)
+ : service_type_(type), service_event_(event), reason_(reason) {}
+};
+
+class ApplicationManagerImplTest
+ : public ::testing::Test,
+ public ::testing::WithParamInterface<ServiceStatus> {
public:
ApplicationManagerImplTest()
: app_id_(0u)
, mock_storage_(
- ::utils::MakeShared<NiceMock<resumption_test::MockResumptionData> >(
+ std::make_shared<NiceMock<resumption_test::MockResumptionData> >(
mock_app_mngr_))
, mock_rpc_service_(new MockRPCService)
+ , mock_last_state_(std::make_shared<resumption_test::MockLastState>())
+ , mock_policy_handler_(new NiceMock<MockPolicyHandlerInterface>)
+ , mock_app_service_manager_(new MockAppServiceManager(
+ mock_app_mngr_,
+ std::make_shared<resumption::LastStateWrapperImpl>(
+ mock_last_state_)))
, mock_message_helper_(
application_manager::MockMessageHelper::message_helper_mock())
+ , mock_statistics_manager_(
+ std::make_shared<
+ NiceMock<usage_statistics_test::MockStatisticsManager> >())
{
+#ifdef ENABLE_LOG
logger::create_log_message_loop_thread();
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
+#endif
+ Mock::VerifyAndClearExpectations(mock_message_helper_);
}
- ~ApplicationManagerImplTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
+ ~ApplicationManagerImplTest() OVERRIDE {
+ Mock::VerifyAndClearExpectations(mock_message_helper_);
}
protected:
void SetUp() OVERRIDE {
CreateAppManager();
+ ON_CALL(mock_state_ctrl_,
+ SetRegularState(_,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_NONE,
+ true));
+ ON_CALL(*mock_app_ptr_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_ptr_, device()).WillByDefault(Return(kDeviceId));
+
+ HmiStatePtr hmi_state(std::make_shared<HmiState>(
+ mock_app_ptr_, mock_app_mngr_, HmiState::STATE_ID_REGULAR));
+
+ ON_CALL(*mock_app_ptr_,
+ RegularHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(hmi_state));
+
+ ON_CALL(mock_session_observer_, GetDataOnSessionKey(_, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3u>(kDeviceId), Return(0)));
ON_CALL(mock_connection_handler_, GetDataOnSessionKey(_, _, _, &kDeviceId))
.WillByDefault(DoAll(SetArgPointee<3u>(app_id_), Return(0)));
ON_CALL(mock_connection_handler_, get_session_observer())
.WillByDefault(ReturnRef(mock_session_observer_));
- app_manager_impl_->SetRPCService(mock_rpc_service_);
+
+ app_manager_impl_->SetMockRPCService(mock_rpc_service_);
app_manager_impl_->resume_controller().set_resumption_storage(
mock_storage_);
app_manager_impl_->set_connection_handler(&mock_connection_handler_);
+ ON_CALL(*mock_app_service_manager_, UnpublishServices(_))
+ .WillByDefault(Return());
+ ON_CALL(*mock_app_service_manager_, OnAppActivated(_))
+ .WillByDefault(Return());
+ app_manager_impl_->SetAppServiceManager(mock_app_service_manager_);
+ Json::Value empty;
+ ON_CALL(*mock_last_state_, dictionary()).WillByDefault(Return(empty));
+
+ auto request = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ ON_CALL(*mock_message_helper_, CreateModuleInfoSO(_, _))
+ .WillByDefault(Return(request));
+ ON_CALL(*mock_message_helper_, GetBCCloseApplicationRequestToHMI(_, _))
+ .WillByDefault(Return(std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map)));
+ ON_CALL(*mock_policy_handler_, GetStatisticManager())
+ .WillByDefault(Return(mock_statistics_manager_));
+ ON_CALL(*mock_policy_handler_, GetEnabledLocalApps())
+ .WillByDefault(Return(kEnabledLocalApps));
}
void CreateAppManager() {
@@ -146,16 +256,35 @@ class ApplicationManagerImplTest : public ::testing::Test {
ON_CALL(mock_application_manager_settings_, default_timeout())
.WillByDefault(ReturnRef(kTimeout));
ON_CALL(mock_application_manager_settings_,
- application_list_update_timeout()).WillByDefault(Return(kTimeout));
+ application_list_update_timeout())
+ .WillByDefault(Return(kTimeout));
app_manager_impl_.reset(new am::ApplicationManagerImpl(
mock_application_manager_settings_, mock_policy_settings_));
- mock_app_ptr_ = utils::SharedPtr<MockApplication>(new MockApplication());
+ mock_app_ptr_ = std::shared_ptr<NiceMock<MockApplication> >(
+ new NiceMock<MockApplication>());
app_manager_impl_->set_protocol_handler(&mock_protocol_handler_);
+ app_manager_impl_->SetMockPolicyHandler(mock_policy_handler_);
ASSERT_TRUE(app_manager_impl_.get());
ASSERT_TRUE(mock_app_ptr_.get());
}
+ application_manager::commands::MessageSharedPtr CreateCloseAppMessage() {
+ using namespace application_manager;
+
+ smart_objects::SmartObjectSPtr message =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::function_id] =
+ hmi_apis::FunctionID::BasicCommunication_CloseApplication;
+ (*message)[strings::params][strings::message_type] = MessageType::kRequest;
+ (*message)[strings::params][strings::correlation_id] = kCorrelationID;
+ (*message)[strings::msg_params][strings::app_id] = kAppId;
+
+ return message;
+ }
+
void AddMockApplication() {
app_manager_impl_->AddMockApplication(mock_app_ptr_);
}
@@ -185,25 +314,116 @@ class ApplicationManagerImplTest : public ::testing::Test {
SetArgPointee<4u>(connection_type),
Return(0)));
}
+
+ bool CheckResumptionRequiredTransportAvailableTest(
+ smart_objects::SmartObject* app_types_array,
+ connection_handler::DeviceHandle primary_device_handle,
+ std::string primary_transport_device_string,
+ connection_handler::DeviceHandle secondary_device_handle,
+ std::string secondary_transport_device_string);
+
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ void AddCloudAppToPendingDeviceMap();
+ void CreatePendingApplication();
+#endif
+
+ void CreatePendingLocalApplication(const std::string& policy_app_id);
+
uint32_t app_id_;
NiceMock<policy_test::MockPolicySettings> mock_policy_settings_;
- utils::SharedPtr<NiceMock<resumption_test::MockResumptionData> >
- mock_storage_;
+ std::shared_ptr<NiceMock<resumption_test::MockResumptionData> > mock_storage_;
- std::unique_ptr<rpc_service::RPCService> mock_rpc_service_;
+ MockStateController mock_state_ctrl_;
+ MockRPCService* mock_rpc_service_;
+ std::shared_ptr<resumption_test::MockLastState> mock_last_state_;
NiceMock<con_test::MockConnectionHandler> mock_connection_handler_;
NiceMock<protocol_handler_test::MockSessionObserver> mock_session_observer_;
NiceMock<MockApplicationManagerSettings> mock_application_manager_settings_;
+ NiceMock<MockPolicyHandlerInterface>* mock_policy_handler_;
application_manager_test::MockApplicationManager mock_app_mngr_;
- std::auto_ptr<am::ApplicationManagerImpl> app_manager_impl_;
+ std::unique_ptr<am::ApplicationManagerImpl> app_manager_impl_;
+ MockAppServiceManager* mock_app_service_manager_;
application_manager::MockMessageHelper* mock_message_helper_;
- utils::SharedPtr<MockApplication> mock_app_ptr_;
+ std::shared_ptr<NiceMock<MockApplication> > mock_app_ptr_;
NiceMock<protocol_handler_test::MockProtocolHandler> mock_protocol_handler_;
+ std::shared_ptr<NiceMock<usage_statistics_test::MockStatisticsManager> >
+ mock_statistics_manager_;
};
+INSTANTIATE_TEST_CASE_P(
+ ProcessServiceStatusUpdate_REQUEST_ACCEPTED,
+ ApplicationManagerImplTest,
+ ::testing::Values(ServiceStatus(ServiceType::AUDIO,
+ ServiceEvent::REQUEST_ACCEPTED,
+ UpdateReasonOptional::EMPTY),
+ ServiceStatus(ServiceType::VIDEO,
+ ServiceEvent::REQUEST_ACCEPTED,
+ UpdateReasonOptional::EMPTY),
+ ServiceStatus(ServiceType::RPC,
+ ServiceEvent::REQUEST_ACCEPTED,
+ UpdateReasonOptional::EMPTY)));
+
+INSTANTIATE_TEST_CASE_P(
+ ProcessServiceStatusUpdate_REQUEST_RECEIVED,
+ ApplicationManagerImplTest,
+ ::testing::Values(ServiceStatus(ServiceType::AUDIO,
+ ServiceEvent::REQUEST_RECEIVED,
+ UpdateReasonOptional::EMPTY),
+ ServiceStatus(ServiceType::VIDEO,
+ ServiceEvent::REQUEST_RECEIVED,
+ UpdateReasonOptional::EMPTY),
+ ServiceStatus(ServiceType::RPC,
+ ServiceEvent::REQUEST_RECEIVED,
+ UpdateReasonOptional::EMPTY)));
+
+INSTANTIATE_TEST_CASE_P(
+ ProcessServiceStatusUpdate_REQUEST_REJECTED,
+ ApplicationManagerImplTest,
+ ::testing::Values(ServiceStatus(ServiceType::AUDIO,
+ ServiceEvent::REQUEST_REJECTED,
+ UpdateReasonOptional::EMPTY),
+ ServiceStatus(ServiceType::VIDEO,
+ ServiceEvent::REQUEST_REJECTED,
+ UpdateReasonOptional::EMPTY),
+ ServiceStatus(ServiceType::RPC,
+ ServiceEvent::REQUEST_REJECTED,
+ UpdateReasonOptional::EMPTY)));
+
+TEST_P(ApplicationManagerImplTest,
+ ProcessServiceStatusUpdate_SendMessageToHMI) {
+ smart_objects::SmartObjectSPtr notification_ =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ (*notification_)[strings::msg_params][hmi_notification::service_type] =
+ GetParam().service_type_;
+ (*notification_)[strings::msg_params][hmi_notification::service_event] =
+ GetParam().service_event_;
+ (*notification_)[strings::msg_params][strings::app_id] = kConnectionKey;
+
+ AddMockApplication();
+
+ ON_CALL(*mock_app_ptr_, app_id()).WillByDefault(Return(kConnectionKey));
+
+ auto close_message = CreateCloseAppMessage();
+ ON_CALL(*mock_message_helper_, GetBCCloseApplicationRequestToHMI(_, _))
+ .WillByDefault(Return(close_message));
+ ON_CALL(*mock_message_helper_, CreateOnServiceUpdateNotification(_, _, _, _))
+ .WillByDefault(Return(notification_));
+
+ ON_CALL(*mock_rpc_service_, ManageHMICommand(notification_, _))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_rpc_service_, ManageHMICommand(close_message, _))
+ .WillByDefault(Return(true));
+
+ app_manager_impl_->ProcessServiceStatusUpdate(kConnectionKey,
+ GetParam().service_type_,
+ GetParam().service_event_,
+ GetParam().reason_);
+}
+
TEST_F(ApplicationManagerImplTest, ProcessQueryApp_ExpectSuccess) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject app_data;
const uint32_t connection_key = 65537u;
app_data[am::json::name] = "application_manager_test";
@@ -212,7 +432,7 @@ TEST_F(ApplicationManagerImplTest, ProcessQueryApp_ExpectSuccess) {
app_data[am::json::android][am::json::packageName] = "com.android.test";
smart_objects::SmartObject sm_object(SmartType_Map);
sm_object[am::json::response][0] = app_data;
- SmartObjectSPtr sptr = MakeShared<SmartObject>(sm_object);
+ SmartObjectSPtr sptr = std::make_shared<SmartObject>(sm_object);
ON_CALL(*mock_message_helper_, CreateModuleInfoSO(_, _))
.WillByDefault(Return(sptr));
@@ -223,21 +443,19 @@ TEST_F(ApplicationManagerImplTest, ProcessQueryApp_ExpectSuccess) {
TEST_F(ApplicationManagerImplTest,
SubscribeAppForWayPoints_ExpectSubscriptionApp) {
- auto app_ptr =
- ApplicationSharedPtr::static_pointer_cast<am::Application>(mock_app_ptr_);
+ auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(app_ptr));
}
TEST_F(ApplicationManagerImplTest,
UnsubscribeAppForWayPoints_ExpectUnsubscriptionApp) {
- auto app_ptr =
- ApplicationSharedPtr::static_pointer_cast<am::Application>(mock_app_ptr_);
+ auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(app_ptr));
app_manager_impl_->UnsubscribeAppFromWayPoints(app_ptr);
EXPECT_FALSE(app_manager_impl_->IsAppSubscribedForWayPoints(app_ptr));
- const std::set<int32_t> result =
+ const std::set<uint32_t> result =
app_manager_impl_->GetAppsSubscribedForWayPoints();
EXPECT_TRUE(result.empty());
}
@@ -246,19 +464,20 @@ TEST_F(
ApplicationManagerImplTest,
IsAnyAppSubscribedForWayPoints_SubcribeAppForWayPoints_ExpectCorrectResult) {
EXPECT_FALSE(app_manager_impl_->IsAnyAppSubscribedForWayPoints());
- app_manager_impl_->SubscribeAppForWayPoints(app_id_);
+ auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
+ app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
EXPECT_TRUE(app_manager_impl_->IsAnyAppSubscribedForWayPoints());
}
TEST_F(
ApplicationManagerImplTest,
GetAppsSubscribedForWayPoints_SubcribeAppForWayPoints_ExpectCorrectResult) {
- auto app_ptr =
- ApplicationSharedPtr::static_pointer_cast<am::Application>(mock_app_ptr_);
+ auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
app_manager_impl_->SubscribeAppForWayPoints(app_ptr);
- std::set<int32_t> result = app_manager_impl_->GetAppsSubscribedForWayPoints();
+ std::set<uint32_t> result =
+ app_manager_impl_->GetAppsSubscribedForWayPoints();
EXPECT_EQ(1u, result.size());
- EXPECT_TRUE(result.find(app_ptr) != result.end());
+ EXPECT_TRUE(result.find(app_ptr->app_id()) != result.end());
}
TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_RpcService) {
@@ -334,10 +553,16 @@ TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_VideoServiceStart) {
const protocol_handler::ServiceType service_type =
protocol_handler::ServiceType::kMobileNav;
const int32_t session_key = 123;
+ HmiStatePtr hmi_state(std::make_shared<HmiState>(
+ mock_app_ptr_, mock_app_mngr_, HmiState::STATE_ID_REGULAR));
+ hmi_state->set_video_streaming_state(
+ mobile_apis::VideoStreamingState::eType::STREAMABLE);
+ hmi_state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
+
+ EXPECT_CALL(*mock_app_ptr_, CurrentHmiState(_))
+ .WillRepeatedly(Return(hmi_state));
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
std::vector<std::string> rejected_params;
@@ -367,7 +592,7 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
// is_navi() is false
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(false));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -398,8 +623,14 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
// HMI level is not FULL nor LIMITED
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
+ HmiStatePtr hmi_state(std::make_shared<HmiState>(
+ mock_app_ptr_, mock_app_mngr_, HmiState::STATE_ID_REGULAR));
+ hmi_state->set_video_streaming_state(
+ mobile_apis::VideoStreamingState::eType::STREAMABLE);
+ hmi_state->set_hmi_level(mobile_apis::HMILevel::HMI_BACKGROUND);
+
+ EXPECT_CALL(*mock_app_ptr_, CurrentHmiState(_))
+ .WillRepeatedly(Return(hmi_state));
bool result = false;
std::vector<std::string> rejected_params;
@@ -428,8 +659,14 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED));
+ HmiStatePtr hmi_state(std::make_shared<HmiState>(
+ mock_app_ptr_, mock_app_mngr_, HmiState::STATE_ID_REGULAR));
+ hmi_state->set_video_streaming_state(
+ mobile_apis::VideoStreamingState::eType::STREAMABLE);
+ hmi_state->set_hmi_level(mobile_apis::HMILevel::HMI_LIMITED);
+
+ EXPECT_CALL(*mock_app_ptr_, CurrentHmiState(_))
+ .WillRepeatedly(Return(hmi_state));
bool result = false;
std::vector<std::string> rejected_params;
@@ -512,8 +749,13 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
+ HmiStatePtr hmi_state(std::make_shared<HmiState>(
+ mock_app_ptr_, mock_app_mngr_, HmiState::STATE_ID_REGULAR));
+ hmi_state->set_video_streaming_state(
+ mobile_apis::VideoStreamingState::eType::STREAMABLE);
+ hmi_state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
+ EXPECT_CALL(*mock_app_ptr_, CurrentHmiState(_))
+ .WillRepeatedly(Return(hmi_state));
bool result = false;
std::vector<std::string> rejected_params;
@@ -586,8 +828,13 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
+ HmiStatePtr hmi_state(std::make_shared<HmiState>(
+ mock_app_ptr_, mock_app_mngr_, HmiState::STATE_ID_REGULAR));
+ hmi_state->set_video_streaming_state(
+ mobile_apis::VideoStreamingState::eType::STREAMABLE);
+ hmi_state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
+ EXPECT_CALL(*mock_app_ptr_, CurrentHmiState(_))
+ .WillRepeatedly(Return(hmi_state));
bool result = false;
std::vector<std::string> rejected_params;
@@ -621,8 +868,13 @@ TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_AudioServiceStart) {
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
+ HmiStatePtr hmi_state(std::make_shared<HmiState>(
+ mock_app_ptr_, mock_app_mngr_, HmiState::STATE_ID_REGULAR));
+ hmi_state->set_video_streaming_state(
+ mobile_apis::VideoStreamingState::eType::STREAMABLE);
+ hmi_state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
+ EXPECT_CALL(*mock_app_ptr_, CurrentHmiState(_))
+ .WillRepeatedly(Return(hmi_state));
bool result = false;
std::vector<std::string> rejected_params;
@@ -651,8 +903,13 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
+ HmiStatePtr hmi_state(std::make_shared<HmiState>(
+ mock_app_ptr_, mock_app_mngr_, HmiState::STATE_ID_REGULAR));
+ hmi_state->set_video_streaming_state(
+ mobile_apis::VideoStreamingState::eType::STREAMABLE);
+ hmi_state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
+ EXPECT_CALL(*mock_app_ptr_, CurrentHmiState(_))
+ .WillRepeatedly(Return(hmi_state));
bool result = false;
std::vector<std::string> rejected_params;
@@ -688,9 +945,92 @@ TEST_F(ApplicationManagerImplTest,
}
TEST_F(ApplicationManagerImplTest,
+ OnSecondaryTransportStartedCallback_BeforeAppRegistration) {
+ const connection_handler::DeviceHandle device_handle = 1;
+ const int32_t session_key = 123;
+
+ // make sure that BC.UpdateAppList is not invoked
+ EXPECT_CALL(*mock_message_helper_,
+ CreateModuleInfoSO(
+ hmi_apis::FunctionID::BasicCommunication_UpdateAppList, _))
+ .Times(0);
+
+ app_manager_impl_->OnSecondaryTransportStartedCallback(device_handle,
+ session_key);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ OnSecondaryTransportStartedCallback_AfterAppRegistration) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ AddMockApplication();
+ EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(app_id_));
+
+ const connection_handler::DeviceHandle device_handle = 1;
+ const int32_t session_key = app_id_;
+
+ EXPECT_CALL(*mock_app_ptr_, set_secondary_device(device_handle)).Times(1);
+ // called by ResumeCtrlImpl::RetryResumption()
+ EXPECT_CALL(*mock_app_ptr_, deferred_resumption_hmi_level())
+ .WillOnce(Return(mobile_api::HMILevel::eType::INVALID_ENUM));
+
+ smart_objects::SmartObject dummy_object(SmartType_Map);
+ SmartObjectSPtr sptr = std::make_shared<SmartObject>(dummy_object);
+
+ EXPECT_CALL(*mock_message_helper_,
+ CreateModuleInfoSO(
+ hmi_apis::FunctionID::BasicCommunication_UpdateAppList, _))
+ .WillOnce(Return(sptr));
+
+ app_manager_impl_->OnSecondaryTransportStartedCallback(device_handle,
+ session_key);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ OnSecondaryTransportEndedCallback_AfterAppRegistration) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ const connection_handler::DeviceHandle device_handle = 1;
+ const int32_t session_key = app_id_;
+
+ AddMockApplication();
+ EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(app_id_));
+ EXPECT_CALL(*mock_app_ptr_, secondary_device())
+ .WillRepeatedly(Return(device_handle));
+
+ EXPECT_CALL(*mock_app_ptr_, set_secondary_device(0)).Times(1);
+
+ smart_objects::SmartObject dummy_object(SmartType_Map);
+ SmartObjectSPtr sptr = std::make_shared<SmartObject>(dummy_object);
+
+ EXPECT_CALL(*mock_message_helper_,
+ CreateModuleInfoSO(
+ hmi_apis::FunctionID::BasicCommunication_UpdateAppList, _))
+ .WillOnce(Return(sptr));
+
+ app_manager_impl_->OnSecondaryTransportEndedCallback(session_key);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ OnSecondaryTransportEndedCallback_BeforeAppRegistration) {
+ const int32_t session_key = app_id_;
+
+ // make sure that BC.UpdateAppList is not invoked
+ EXPECT_CALL(*mock_message_helper_,
+ CreateModuleInfoSO(
+ hmi_apis::FunctionID::BasicCommunication_UpdateAppList, _))
+ .Times(0);
+
+ app_manager_impl_->OnSecondaryTransportEndedCallback(session_key);
+}
+
+TEST_F(ApplicationManagerImplTest,
OnDeviceSwitchingStart_ExpectPutAppsInWaitList) {
- utils::SharedPtr<MockApplication> switching_app_ptr =
- utils::MakeShared<MockApplication>();
+ std::shared_ptr<MockApplication> switching_app_ptr =
+ std::make_shared<MockApplication>();
+
+ ON_CALL(*switching_app_ptr, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*switching_app_ptr, device()).WillByDefault(Return(kDeviceId));
const std::string switching_device_id = "switching";
const std::string switching_device_id_hash =
@@ -704,11 +1044,11 @@ TEST_F(ApplicationManagerImplTest,
.WillRepeatedly(Return(policy_app_id_switch));
const auto hmi_level_switching_app = mobile_apis::HMILevel::HMI_FULL;
- EXPECT_CALL(*switching_app_ptr, hmi_level())
+ EXPECT_CALL(*switching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_switching_app));
- utils::SharedPtr<MockApplication> nonswitching_app_ptr =
- utils::MakeShared<MockApplication>();
+ std::shared_ptr<MockApplication> nonswitching_app_ptr =
+ std::make_shared<MockApplication>();
const std::string nonswitching_device_id = "nonswitching";
const std::string nonswitching_device_id_hash =
@@ -722,7 +1062,7 @@ TEST_F(ApplicationManagerImplTest,
.WillRepeatedly(Return(policy_app_id_nonswitch));
const auto hmi_level_nonswitching_app = mobile_apis::HMILevel::HMI_LIMITED;
- EXPECT_CALL(*nonswitching_app_ptr, hmi_level())
+ EXPECT_CALL(*nonswitching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_nonswitching_app));
// Act
@@ -736,19 +1076,20 @@ TEST_F(ApplicationManagerImplTest,
nonswitching_device_id,
"USB");
- EXPECT_CALL(*mock_message_helper_, CreateDeviceListSO(_, _, _))
- .WillOnce(Return(smart_objects::SmartObjectSPtr()));
app_manager_impl_->OnDeviceSwitchingStart(switching_device,
non_switching_device);
- EXPECT_TRUE(app_manager_impl_->IsAppInReconnectMode(policy_app_id_switch));
- EXPECT_FALSE(
- app_manager_impl_->IsAppInReconnectMode(policy_app_id_nonswitch));
+ EXPECT_TRUE(
+ app_manager_impl_->IsAppInReconnectMode(kDeviceId, policy_app_id_switch));
+ EXPECT_FALSE(app_manager_impl_->IsAppInReconnectMode(
+ kDeviceId, policy_app_id_nonswitch));
}
TEST_F(ApplicationManagerImplTest,
OnDeviceSwitchingFinish_ExpectUnregisterAppsInWaitList) {
- utils::SharedPtr<MockApplication> switching_app_ptr =
- utils::MakeShared<MockApplication>();
+ std::shared_ptr<MockApplication> switching_app_ptr =
+ std::make_shared<MockApplication>();
+ ON_CALL(*switching_app_ptr, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*switching_app_ptr, device()).WillByDefault(Return(kDeviceId));
plugin_manager::MockRPCPluginManager* mock_rpc_plugin_manager =
new plugin_manager::MockRPCPluginManager;
@@ -768,11 +1109,11 @@ TEST_F(ApplicationManagerImplTest,
.WillRepeatedly(Return(policy_app_id_switch));
const auto hmi_level_switching_app = mobile_apis::HMILevel::HMI_FULL;
- EXPECT_CALL(*switching_app_ptr, hmi_level())
+ EXPECT_CALL(*switching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_switching_app));
- utils::SharedPtr<MockApplication> nonswitching_app_ptr =
- utils::MakeShared<MockApplication>();
+ std::shared_ptr<MockApplication> nonswitching_app_ptr =
+ std::make_shared<MockApplication>();
const std::string nonswitching_device_id = "nonswitching";
const std::string nonswitching_device_id_hash =
@@ -785,8 +1126,12 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_CALL(*nonswitching_app_ptr, policy_app_id())
.WillRepeatedly(Return(policy_app_id_nonswitch));
+ ON_CALL(*nonswitching_app_ptr, protocol_version())
+ .WillByDefault(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4));
+
const auto hmi_level_nonswitching_app = mobile_apis::HMILevel::HMI_LIMITED;
- EXPECT_CALL(*nonswitching_app_ptr, hmi_level())
+ EXPECT_CALL(*nonswitching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_nonswitching_app));
// Act
@@ -800,12 +1145,11 @@ TEST_F(ApplicationManagerImplTest,
nonswitching_device_id,
"USB");
- EXPECT_CALL(*mock_message_helper_, CreateDeviceListSO(_, _, _))
- .WillOnce(Return(smart_objects::SmartObjectSPtr()));
app_manager_impl_->OnDeviceSwitchingStart(switching_device,
non_switching_device);
- EXPECT_TRUE(app_manager_impl_->IsAppInReconnectMode(policy_app_id_switch));
+ EXPECT_TRUE(
+ app_manager_impl_->IsAppInReconnectMode(kDeviceId, policy_app_id_switch));
app_manager_impl_->OnDeviceSwitchingFinish(switching_device_id);
EXPECT_FALSE(
@@ -820,13 +1164,13 @@ TEST_F(ApplicationManagerImplTest,
const connection_handler::DeviceHandle device_id = 1;
const custom_str::CustomString app_name("");
- utils::SharedPtr<ApplicationImpl> app_impl = new ApplicationImpl(
+ std::shared_ptr<ApplicationImpl> app_impl = std::make_shared<ApplicationImpl>(
application_id,
policy_app_id,
mac_address,
device_id,
app_name,
- utils::SharedPtr<usage_statistics::StatisticsManager>(
+ std::shared_ptr<usage_statistics::StatisticsManager>(
new usage_statistics_test::MockStatisticsManager()),
*app_manager_impl_);
@@ -884,6 +1228,15 @@ TEST_F(ApplicationManagerImplTest, StartStopAudioPassThru) {
}
}
+TEST_F(ApplicationManagerImplTest,
+ StopApplicationManager_ExpectStopRPCService) {
+ EXPECT_CALL(*mock_policy_handler_, UnloadPolicyLibrary());
+
+ EXPECT_CALL(*mock_rpc_service_, Stop());
+
+ app_manager_impl_->Stop();
+}
+
TEST_F(ApplicationManagerImplTest, UnregisterAnotherAppDuringAudioPassThru) {
std::string dummy_file_name;
ON_CALL(mock_application_manager_settings_, recording_file_name())
@@ -897,8 +1250,8 @@ TEST_F(ApplicationManagerImplTest, UnregisterAnotherAppDuringAudioPassThru) {
const uint32_t app_id_2 = 65538;
std::string dummy_mac_address;
- utils::SharedPtr<MockApplication> mock_app_1 =
- utils::SharedPtr<MockApplication>(new MockApplication());
+ std::shared_ptr<MockApplication> mock_app_1 =
+ std::shared_ptr<MockApplication>(new MockApplication());
EXPECT_CALL(*mock_app_1, app_id()).WillRepeatedly(Return(app_id_1));
EXPECT_CALL(*mock_app_1, device()).WillRepeatedly(Return(0));
EXPECT_CALL(*mock_app_1, mac_address())
@@ -908,13 +1261,15 @@ TEST_F(ApplicationManagerImplTest, UnregisterAnotherAppDuringAudioPassThru) {
.WillRepeatedly(
Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4));
- utils::SharedPtr<MockApplication> mock_app_2 =
- utils::SharedPtr<MockApplication>(new MockApplication());
+ std::shared_ptr<MockApplication> mock_app_2 =
+ std::shared_ptr<MockApplication>(new MockApplication());
EXPECT_CALL(*mock_app_2, app_id()).WillRepeatedly(Return(app_id_2));
EXPECT_CALL(*mock_app_2, device()).WillRepeatedly(Return(0));
EXPECT_CALL(*mock_app_2, mac_address())
.WillRepeatedly(ReturnRef(dummy_mac_address));
- EXPECT_CALL(*mock_app_2, policy_app_id()).WillRepeatedly(Return(""));
+ const std::string app2_policy_id = "app2_policy_id";
+ EXPECT_CALL(*mock_app_2, policy_app_id())
+ .WillRepeatedly(Return(app2_policy_id));
EXPECT_CALL(*mock_app_2, protocol_version())
.WillRepeatedly(
Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4));
@@ -951,6 +1306,9 @@ TEST_F(ApplicationManagerImplTest, UnregisterAnotherAppDuringAudioPassThru) {
audio_type);
}
+ std::vector<std::string> enabled_apps = {app2_policy_id};
+ EXPECT_CALL(*mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
+
// while running APT, app 1 is unregistered
app_manager_impl_->UnregisterApplication(
app_id_1, mobile_apis::Result::SUCCESS, false, true);
@@ -963,6 +1321,325 @@ TEST_F(ApplicationManagerImplTest, UnregisterAnotherAppDuringAudioPassThru) {
}
}
+static std::map<std::string, std::vector<std::string> > CreateTransportMap() {
+ /*
+ * DefaultTransportRequiredForResumption = TCP_WIFI, IAP_USB, SPP_BLUETOOTH
+ * MediaTransportRequiredForResumption = TCP_WIFI, AOA_USB
+ * NavigationTransportRequiredForResumption = AOA_USB, SPP_BLUETOOTH
+ * TestingTransportRequiredForResumption =
+ * EmptyAppTransportRequiredForResumption = TCP_WIFI
+ */
+ std::string TCP_WIFI("TCP_WIFI");
+ std::string IAP_USB("IAP_USB");
+ std::string SPP_BLUETOOTH("SPP_BLUETOOTH");
+ std::string AOA_USB("AOA_USB");
+
+ std::vector<std::string> default_transports;
+ default_transports.push_back(TCP_WIFI);
+ default_transports.push_back(IAP_USB);
+ default_transports.push_back(SPP_BLUETOOTH);
+ std::vector<std::string> media_transports;
+ media_transports.push_back(TCP_WIFI);
+ media_transports.push_back(AOA_USB);
+ std::vector<std::string> navi_transports;
+ navi_transports.push_back(AOA_USB);
+ navi_transports.push_back(SPP_BLUETOOTH);
+ std::vector<std::string> testing_transports;
+ std::vector<std::string> empty_transports;
+ empty_transports.push_back(TCP_WIFI);
+
+ std::map<std::string, std::vector<std::string> > transport_map;
+ transport_map[std::string("DEFAULT")] = default_transports;
+ transport_map[std::string("MEDIA")] = media_transports;
+ transport_map[std::string("NAVIGATION")] = navi_transports;
+ transport_map[std::string("TESTING")] = testing_transports;
+ transport_map[std::string("EMPTY_APP")] = empty_transports;
+
+ return transport_map;
+}
+
+bool ApplicationManagerImplTest::CheckResumptionRequiredTransportAvailableTest(
+ smart_objects::SmartObject* app_types_array,
+ connection_handler::DeviceHandle primary_device_handle,
+ std::string primary_transport_device_string,
+ connection_handler::DeviceHandle secondary_device_handle,
+ std::string secondary_transport_device_string) {
+ EXPECT_CALL(*mock_app_ptr_, app_types())
+ .WillRepeatedly(Return(app_types_array));
+
+ std::map<std::string, std::vector<std::string> > transport_map =
+ CreateTransportMap();
+
+ EXPECT_CALL(mock_application_manager_settings_,
+ transport_required_for_resumption_map())
+ .WillRepeatedly(ReturnRef(transport_map));
+
+ EXPECT_CALL(*mock_app_ptr_, device())
+ .WillRepeatedly(Return(primary_device_handle));
+ EXPECT_CALL(*mock_app_ptr_, secondary_device())
+ .WillRepeatedly(Return(secondary_device_handle));
+
+ EXPECT_CALL(mock_session_observer_,
+ TransportTypeProfileStringFromDeviceHandle(primary_device_handle))
+ .WillOnce(Return(primary_transport_device_string));
+
+ if (secondary_device_handle != 0) {
+ EXPECT_CALL(
+ mock_session_observer_,
+ TransportTypeProfileStringFromDeviceHandle(secondary_device_handle))
+ .WillOnce(Return(secondary_transport_device_string));
+ } else {
+ EXPECT_CALL(
+ mock_session_observer_,
+ TransportTypeProfileStringFromDeviceHandle(secondary_device_handle))
+ .WillOnce(Return(std::string("")));
+ }
+
+ return app_manager_impl_->CheckResumptionRequiredTransportAvailable(
+ mock_app_ptr_);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ CheckResumptionRequiredTransportAvailableTest_PrimaryOnly_Success) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ smart_objects::SmartObject app_types_array(SmartType_Array);
+ app_types_array[0] = mobile_apis::AppHMIType::eType::DEFAULT;
+
+ const connection_handler::DeviceHandle primary_device_handle = 1;
+ const connection_handler::DeviceHandle secondary_device_handle = 0;
+
+ // refer to transport_adapter_impl.cc
+ std::string primary_transport_device_string("SPP_BLUETOOTH");
+ std::string secondary_transport_device_string("");
+
+ // - The app is DEFAULT.
+ // - A DEFAULT app is allowed for resumption if either primary or secondary
+ // transport is TCP_WIFI, IAP_USB or SPP_BLUETOOTH.
+ // - We have SPP_BLUETOOTH for primary transport.
+ // -> Conclusion: the app has required transport.
+ bool result = CheckResumptionRequiredTransportAvailableTest(
+ &app_types_array,
+ primary_device_handle,
+ primary_transport_device_string,
+ secondary_device_handle,
+ secondary_transport_device_string);
+ EXPECT_TRUE(result);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ CheckResumptionRequiredTransportAvailableTest_PrimaryOnly_NotListed) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ smart_objects::SmartObject app_types_array(SmartType_Array);
+ app_types_array[0] = mobile_apis::AppHMIType::eType::SOCIAL;
+
+ const connection_handler::DeviceHandle primary_device_handle = 1;
+ const connection_handler::DeviceHandle secondary_device_handle = 0;
+
+ std::string primary_transport_device_string("SPP_BLUETOOTH");
+ std::string secondary_transport_device_string("");
+
+ // - The app is SOCIAL.
+ // - We do not have an entry in .ini file for SOCIAL apps.
+ // -> In this case, resumption is always enabled for backward compatibility.
+ bool result = CheckResumptionRequiredTransportAvailableTest(
+ &app_types_array,
+ primary_device_handle,
+ primary_transport_device_string,
+ secondary_device_handle,
+ secondary_transport_device_string);
+ EXPECT_TRUE(result);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ CheckResumptionRequiredTransportAvailableTest_PrimaryOnly_Disabled) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ smart_objects::SmartObject app_types_array(SmartType_Array);
+ app_types_array[0] = mobile_apis::AppHMIType::eType::TESTING;
+
+ const connection_handler::DeviceHandle primary_device_handle = 1;
+ const connection_handler::DeviceHandle secondary_device_handle = 0;
+
+ std::string primary_transport_device_string("SPP_BLUETOOTH");
+ std::string secondary_transport_device_string("");
+
+ // - The app is TESTING.
+ // - We do not have any transports allowed for TESTING apps.
+ // -> In this case, resumption is always disabled.
+ bool result = CheckResumptionRequiredTransportAvailableTest(
+ &app_types_array,
+ primary_device_handle,
+ primary_transport_device_string,
+ secondary_device_handle,
+ secondary_transport_device_string);
+ EXPECT_FALSE(result);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ CheckResumptionRequiredTransportAvailableTest_PrimaryOnly_NoAppTypes) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ smart_objects::SmartObject app_types_array(SmartType_Array);
+ // we don't specify any app type
+
+ const connection_handler::DeviceHandle primary_device_handle = 1;
+ const connection_handler::DeviceHandle secondary_device_handle = 0;
+
+ std::string primary_transport_device_string("SPP_BLUETOOTH");
+ std::string secondary_transport_device_string("");
+
+ // - The app doesn't specify AppHMIType.
+ // - .ini file specifies TCP_WIFI for EMPTY_APP entry.
+ // -> The app does not have required transport.
+ bool result = CheckResumptionRequiredTransportAvailableTest(
+ &app_types_array,
+ primary_device_handle,
+ primary_transport_device_string,
+ secondary_device_handle,
+ secondary_transport_device_string);
+ EXPECT_FALSE(result);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ CheckResumptionRequiredTransportAvailableTest_PrimaryOnly_NoAppTypes2) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ const connection_handler::DeviceHandle primary_device_handle = 1;
+ const connection_handler::DeviceHandle secondary_device_handle = 0;
+
+ std::string primary_transport_device_string("SPP_BLUETOOTH");
+ std::string secondary_transport_device_string("");
+
+ // - The app doesn't specify AppHMIType.
+ // - .ini file specifies TCP_WIFI for EMPTY_APP entry.
+ // -> The app does not have required transport.
+ bool result = CheckResumptionRequiredTransportAvailableTest(
+ NULL,
+ primary_device_handle,
+ primary_transport_device_string,
+ secondary_device_handle,
+ secondary_transport_device_string);
+ EXPECT_FALSE(result);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ CheckResumptionRequiredTransportAvailableTest_TwoTransports_Success) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ smart_objects::SmartObject app_types_array(SmartType_Array);
+ app_types_array[0] = mobile_apis::AppHMIType::eType::MEDIA;
+
+ const connection_handler::DeviceHandle primary_device_handle = 1;
+ const connection_handler::DeviceHandle secondary_device_handle = 2;
+
+ // refer to transport_adapter_impl.cc
+ std::string primary_transport_device_string("SPP_BLUETOOTH");
+ std::string secondary_transport_device_string("TCP_WIFI");
+
+ // - The app is MEDIA.
+ // - A MEDIA app is allowed for resumption if either primary or secondary
+ // transport is TCP_WIFI or AOA_USB.
+ // - We have TCP_WIFI for secondary transport.
+ // -> Conclusion: the app has required transport.
+ bool result = CheckResumptionRequiredTransportAvailableTest(
+ &app_types_array,
+ primary_device_handle,
+ primary_transport_device_string,
+ secondary_device_handle,
+ secondary_transport_device_string);
+ EXPECT_TRUE(result);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ CheckResumptionRequiredTransportAvailableTest_TwoTransports_Failure) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ smart_objects::SmartObject app_types_array(SmartType_Array);
+ app_types_array[0] = mobile_apis::AppHMIType::eType::NAVIGATION;
+
+ const connection_handler::DeviceHandle primary_device_handle = 1;
+ const connection_handler::DeviceHandle secondary_device_handle = 2;
+
+ // refer to transport_adapter_impl.cc
+ std::string primary_transport_device_string("IAP_USB");
+ std::string secondary_transport_device_string("TCP_WIFI");
+
+ // - The app is NAVIGATION.
+ // - A NAVIGATION app is allowed for resumption if either primary or secondary
+ // transport is AOA_USB or SPP_BLUETOOTH.
+ // - We have IAP_USB for primary and TCP_WIFI for secondary transport.
+ // -> Conclusion: the app does not have required transport.
+ bool result = CheckResumptionRequiredTransportAvailableTest(
+ &app_types_array,
+ primary_device_handle,
+ primary_transport_device_string,
+ secondary_device_handle,
+ secondary_transport_device_string);
+ EXPECT_FALSE(result);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ CheckResumptionRequiredTransportAvailableTest_MultipleAppTypes_Failure) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ smart_objects::SmartObject app_types_array(SmartType_Array);
+ app_types_array[0] = mobile_apis::AppHMIType::eType::MEDIA;
+ app_types_array[1] = mobile_apis::AppHMIType::eType::NAVIGATION;
+
+ const connection_handler::DeviceHandle primary_device_handle = 1;
+ const connection_handler::DeviceHandle secondary_device_handle = 2;
+
+ std::string primary_transport_device_string("IAP_USB");
+ std::string secondary_transport_device_string("TCP_WIFI");
+
+ // - The app is MEDIA and NAVIGATION.
+ // - A MEDIA app is allowed for resumption if either primary or secondary
+ // transport is TCP_WIFI or AOA_USB.
+ // - A NAVIGATION app is allowed for resumption if either primary or secondary
+ // transport is AOA_USB or SPP_BLUETOOTH.
+ // - We have IAP_USB for primary and TCP_WIFI is secondary
+ // -> Conclusion: the app does NOT have required transport.
+ bool result = CheckResumptionRequiredTransportAvailableTest(
+ &app_types_array,
+ primary_device_handle,
+ primary_transport_device_string,
+ secondary_device_handle,
+ secondary_transport_device_string);
+ EXPECT_FALSE(result);
+}
+
+TEST_F(ApplicationManagerImplTest,
+ CheckResumptionRequiredTransportAvailableTest_MultipleAppTypes_Empty) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ smart_objects::SmartObject app_types_array(SmartType_Array);
+ app_types_array[0] = mobile_apis::AppHMIType::eType::NAVIGATION;
+ app_types_array[1] = mobile_apis::AppHMIType::eType::SYSTEM;
+
+ const connection_handler::DeviceHandle primary_device_handle = 1;
+ const connection_handler::DeviceHandle secondary_device_handle = 2;
+
+ std::string primary_transport_device_string("IAP_USB");
+ std::string secondary_transport_device_string("TCP_WIFI");
+
+ // - The app is NAVIGATION and SYSTEM.
+ // - A NAVIGATION app is allowed for resumption if either primary or secondary
+ // transport is AOA_USB or SPP_BLUETOOTH.
+ // - .ini file does not have an entry for SYSTEM apps. So any transport is
+ // allowed.
+ // - We have SPP_BLUETOOTH for primary and TCP_WIFI is secondary
+ // -> Conclusion: the app does NOT have required transport.
+ bool result = CheckResumptionRequiredTransportAvailableTest(
+ &app_types_array,
+ primary_device_handle,
+ primary_transport_device_string,
+ secondary_device_handle,
+ secondary_transport_device_string);
+ EXPECT_FALSE(result);
+}
+
TEST_F(ApplicationManagerImplTest,
RegisterApplication_PathToTheIconExists_IconWasSet) {
file_system::CreateDirectory(kDirectoryName);
@@ -990,8 +1667,11 @@ TEST_F(ApplicationManagerImplTest,
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2;
smart_objects::SmartObjectSPtr request_for_registration_ptr =
- MakeShared<smart_objects::SmartObject>(request_for_registration);
+ std::make_shared<smart_objects::SmartObject>(request_for_registration);
+ std::unique_ptr<plugin_manager::RPCPluginManager> rpc_plugin_manager(
+ new MockRPCPluginManager());
+ app_manager_impl_->SetPluginManager(rpc_plugin_manager);
ApplicationSharedPtr application =
app_manager_impl_->RegisterApplication(request_for_registration_ptr);
EXPECT_STREQ(kAppName.c_str(), application->name().c_str());
@@ -1006,6 +1686,348 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_TRUE(file_system::RemoveDirectory(kDirectoryName, true));
}
-} // application_manager_test
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+void ApplicationManagerImplTest::AddCloudAppToPendingDeviceMap() {
+ std::vector<std::string> enabled_apps{"1234"};
+ EXPECT_CALL(*mock_policy_handler_, GetEnabledCloudApps(_))
+ .WillOnce(SetArgReferee<0>(enabled_apps));
+ EXPECT_CALL(*mock_policy_handler_, GetAppProperties(_, _))
+ .WillOnce(DoAll(SetArgReferee<1>(app_properties), Return(true)));
+
+ std::vector<std::string> nicknames{"CloudApp"};
+ EXPECT_CALL(*mock_policy_handler_, GetInitialAppData(_, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(nicknames), Return(true)));
+
+ EXPECT_CALL(*mock_policy_handler_, GetIconUrl(_)).WillOnce(Return(""));
+
+ app_manager_impl_->RefreshCloudAppInformation();
+}
+
+void ApplicationManagerImplTest::CreatePendingApplication() {
+ AddCloudAppToPendingDeviceMap();
+
+ // CreatePendingApplication
+ transport_manager::DeviceInfo device_info(
+ 1, "mac", kEndpoint2, "CLOUD_WEBSOCKET");
+ std::vector<std::string> nicknames{"CloudApp"};
+ EXPECT_CALL(*mock_policy_handler_, GetInitialAppData(_, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(nicknames), Return(true)));
+ std::vector<std::string> enabled_apps{"1234"};
+
+ EXPECT_CALL(*mock_policy_handler_, GetStatisticManager())
+ .WillOnce(Return(std::shared_ptr<usage_statistics::StatisticsManager>(
+ new usage_statistics_test::MockStatisticsManager())));
+ EXPECT_CALL(*mock_policy_handler_, GetAppProperties(_, _))
+ .WillOnce(DoAll(SetArgReferee<1>(app_properties), Return(true)));
+ // Expect Update app list
+ EXPECT_CALL(*mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
+ app_manager_impl_->CreatePendingApplication(1, device_info, 1);
+ AppsWaitRegistrationSet app_list =
+ app_manager_impl_->AppsWaitingForRegistration().GetData();
+ EXPECT_EQ(1u, app_list.size());
+}
+
+TEST_F(ApplicationManagerImplTest, CreatePendingApplication) {
+ CreatePendingApplication();
+}
+
+TEST_F(ApplicationManagerImplTest, SetPendingState) {
+ AddCloudAppToPendingDeviceMap();
+ AddMockApplication();
+ AppsWaitRegistrationSet app_list =
+ app_manager_impl_->AppsWaitingForRegistration().GetData();
+ EXPECT_EQ(0u, app_list.size());
+ EXPECT_CALL(*mock_app_ptr_, policy_app_id()).WillRepeatedly(Return("1234"));
+ EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(123));
+ std::string mac = "MAC_ADDRESS";
+ EXPECT_CALL(*mock_app_ptr_, mac_address()).WillRepeatedly(ReturnRef(mac));
+ transport_manager::DeviceInfo device_info(
+ 1, "mac", kEndpoint2, "CLOUD_WEBSOCKET");
+
+ std::vector<std::string> enabled_apps{"1234"};
+
+ EXPECT_CALL(*mock_policy_handler_, GetEnabledCloudApps(_))
+ .WillOnce(SetArgReferee<0>(enabled_apps));
+ EXPECT_CALL(*mock_policy_handler_, GetAppProperties(_, _))
+ .WillOnce(DoAll(SetArgReferee<1>(app_properties), Return(true)));
+
+ std::vector<std::string> nicknames{"CloudApp"};
+ EXPECT_CALL(*mock_policy_handler_, GetInitialAppData(_, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(nicknames), Return(true)));
+
+ EXPECT_CALL(*mock_policy_handler_, GetIconUrl(_)).WillOnce(Return(""));
+
+ plugin_manager::MockRPCPluginManager* mock_rpc_plugin_manager =
+ new plugin_manager::MockRPCPluginManager;
+ std::unique_ptr<plugin_manager::RPCPluginManager> mock_rpc_plugin_manager_ptr(
+ mock_rpc_plugin_manager);
+ app_manager_impl_->SetPluginManager(mock_rpc_plugin_manager_ptr);
+
+ EXPECT_CALL(mock_connection_handler_, GetDeviceID(_, _))
+ .WillOnce(DoAll(SetArgPointee<1>(0), Return(true)));
+ app_manager_impl_->SetPendingApplicationState(1, device_info);
+ app_list = app_manager_impl_->AppsWaitingForRegistration().GetData();
+ EXPECT_EQ(1u, app_list.size());
+}
+
+TEST_F(ApplicationManagerImplTest,
+ RegisterApplication_CloudAppRegisterSuccess) {
+ std::shared_ptr<MockApplication> waiting_app =
+ std::make_shared<MockApplication>();
+ ON_CALL(*waiting_app, device()).WillByDefault(Return(kDeviceId));
+ EXPECT_CALL(*waiting_app, cloud_app_endpoint())
+ .WillOnce(ReturnRef(kEndpoint));
+ EXPECT_CALL(*waiting_app, auth_token()).WillOnce(ReturnRef(kAuthToken));
+ EXPECT_CALL(*waiting_app, cloud_app_certificate())
+ .WillOnce(ReturnRef(kCertificate));
+ EXPECT_CALL(*waiting_app, cloud_app_transport_type())
+ .WillOnce(ReturnRef(kTransportType));
+ EXPECT_CALL(*waiting_app, hybrid_app_preference())
+ .WillOnce(ReturnRef(kHybridAppPreference));
+ ON_CALL(*waiting_app, is_cloud_app()).WillByDefault(Return(true));
+ EXPECT_CALL(*waiting_app, policy_app_id()).WillRepeatedly(Return(kAppId));
+ app_manager_impl_->AddMockPendingApplication(waiting_app);
+
+ EXPECT_CALL(
+ mock_session_observer_,
+ GetDataOnSessionKey(kConnectionKey,
+ _,
+ _,
+ testing::An<connection_handler::DeviceHandle*>()))
+ .WillOnce(DoAll(SetArgPointee<3u>(kDeviceId), Return(0)));
+ EXPECT_CALL(*mock_rpc_service_,
+ ManageMobileCommand(_, commands::Command::SOURCE_SDL))
+ .Times(0);
+ smart_objects::SmartObject request_for_registration(
+ smart_objects::SmartType_Map);
+
+ smart_objects::SmartObject& params =
+ request_for_registration[strings::msg_params];
+ params[strings::app_id] = kAppId;
+ params[strings::language_desired] = mobile_api::Language::EN_US;
+ params[strings::hmi_display_language_desired] = mobile_api::Language::EN_US;
+
+ request_for_registration[strings::params][strings::connection_key] =
+ kConnectionKey;
+ request_for_registration[strings::msg_params][strings::app_name] = kAppName;
+ request_for_registration[strings::msg_params][strings::sync_msg_version]
+ [strings::minor_version] = APIVersion::kAPIV2;
+ request_for_registration[strings::msg_params][strings::sync_msg_version]
+ [strings::major_version] = APIVersion::kAPIV3;
+
+ request_for_registration[strings::params][strings::protocol_version] =
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2;
+
+ smart_objects::SmartObjectSPtr request_for_registration_ptr =
+ std::make_shared<smart_objects::SmartObject>(request_for_registration);
+
+ std::unique_ptr<plugin_manager::RPCPluginManager> rpc_plugin_manager(
+ new MockRPCPluginManager());
+ app_manager_impl_->SetPluginManager(rpc_plugin_manager);
+ ApplicationSharedPtr application =
+ app_manager_impl_->RegisterApplication(request_for_registration_ptr);
+
+ EXPECT_EQ(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2,
+ application->protocol_version());
+ EXPECT_EQ(APIVersion::kAPIV2,
+ application->version().min_supported_api_version);
+ EXPECT_EQ(APIVersion::kAPIV3,
+ application->version().max_supported_api_version);
+ EXPECT_EQ(kEndpoint, application->cloud_app_endpoint());
+ EXPECT_EQ(kAuthToken, application->auth_token());
+ EXPECT_EQ(kCertificate, application->cloud_app_certificate());
+ EXPECT_EQ(kTransportType, application->cloud_app_transport_type());
+ EXPECT_EQ(kHybridAppPreference, application->hybrid_app_preference());
+}
+
+TEST_F(ApplicationManagerImplTest,
+ RegisterApplication_CloudAppRegisterFailed_DISALLOWED) {
+ std::shared_ptr<MockApplication> waiting_app =
+ std::make_shared<MockApplication>();
+ EXPECT_CALL(*waiting_app, device()).WillRepeatedly(Return(kDeviceId));
+ EXPECT_CALL(*waiting_app, is_cloud_app()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*waiting_app, policy_app_id())
+ .WillRepeatedly(Return("Fake" + kAppId));
+ app_manager_impl_->AddMockPendingApplication(waiting_app);
+
+ EXPECT_CALL(
+ mock_session_observer_,
+ GetDataOnSessionKey(kConnectionKey,
+ _,
+ _,
+ testing::An<connection_handler::DeviceHandle*>()))
+ .WillOnce(DoAll(SetArgPointee<3u>(kDeviceId), Return(0)));
+ EXPECT_CALL(*mock_rpc_service_,
+ ManageMobileCommand(_, commands::Command::SOURCE_SDL))
+ .WillOnce(Return(true));
+ smart_objects::SmartObject request_for_registration(
+ smart_objects::SmartType_Map);
+
+ smart_objects::SmartObject& params =
+ request_for_registration[strings::msg_params];
+ params[strings::app_id] = kAppId;
+ params[strings::language_desired] = mobile_api::Language::EN_US;
+ params[strings::hmi_display_language_desired] = mobile_api::Language::EN_US;
+
+ request_for_registration[strings::params][strings::connection_key] =
+ kConnectionKey;
+ request_for_registration[strings::msg_params][strings::app_name] = kAppName;
+ request_for_registration[strings::msg_params][strings::sync_msg_version]
+ [strings::minor_version] = APIVersion::kAPIV2;
+ request_for_registration[strings::msg_params][strings::sync_msg_version]
+ [strings::major_version] = APIVersion::kAPIV3;
+
+ request_for_registration[strings::params][strings::protocol_version] =
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2;
+
+ smart_objects::SmartObjectSPtr request_for_registration_ptr =
+ std::make_shared<smart_objects::SmartObject>(request_for_registration);
+
+ ApplicationSharedPtr application =
+ app_manager_impl_->RegisterApplication(request_for_registration_ptr);
+ EXPECT_EQ(0, application.use_count());
+}
+
+TEST_F(ApplicationManagerImplTest, PolicyIDByIconUrl_Success) {
+ std::vector<std::string> enabled_apps{"1234"};
+ EXPECT_CALL(*mock_policy_handler_, GetEnabledCloudApps(_))
+ .WillOnce(SetArgReferee<0>(enabled_apps));
+ EXPECT_CALL(*mock_policy_handler_, GetAppProperties(_, _))
+ .WillOnce(DoAll(SetArgReferee<1>(app_properties), Return(true)));
+
+ std::vector<std::string> nicknames{"CloudApp"};
+ EXPECT_CALL(*mock_policy_handler_, GetInitialAppData(_, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(nicknames), Return(true)));
+
+ const std::string url = "https://www.fakeiconurl.com/icon.png";
+ EXPECT_CALL(*mock_policy_handler_, GetIconUrl("1234"))
+ .WillRepeatedly(Return(url));
+
+ app_manager_impl_->RefreshCloudAppInformation();
+
+ std::string result = app_manager_impl_->PolicyIDByIconUrl(url);
+ EXPECT_EQ(result, "1234");
+}
+
+TEST_F(ApplicationManagerImplTest, SetIconFileFromSystemRequest_Success) {
+ CreatePendingApplication();
+ Mock::VerifyAndClearExpectations(mock_message_helper_);
+
+ file_system::CreateDirectory(kDirectoryName);
+ const std::string full_icon_path = kDirectoryName + "/1234";
+ ASSERT_TRUE(file_system::CreateFile(full_icon_path));
+
+ const std::string url = "https://www.fakeiconurl.com/icon.png";
+ EXPECT_CALL(*mock_policy_handler_, GetIconUrl("1234"))
+ .WillRepeatedly(Return(url));
+
+ smart_objects::SmartObject dummy_object(smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr sptr =
+ std::make_shared<smart_objects::SmartObject>(dummy_object);
+
+ EXPECT_CALL(*mock_message_helper_,
+ CreateModuleInfoSO(
+ hmi_apis::FunctionID::BasicCommunication_UpdateAppList, _))
+ .WillOnce(Return(sptr));
+ EXPECT_CALL(*mock_rpc_service_, ManageHMICommand(sptr, _)).Times(1);
+ EXPECT_CALL(mock_application_manager_settings_, app_icons_folder())
+ .WillOnce(ReturnRef(kDirectoryName));
+ app_manager_impl_->SetIconFileFromSystemRequest("1234");
+ EXPECT_TRUE(file_system::RemoveDirectory(kDirectoryName, true));
+}
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+
+void ApplicationManagerImplTest::CreatePendingLocalApplication(
+ const std::string& policy_app_id) {
+ // CreatePendingApplication
+ std::vector<std::string> nicknames{"PendingApplication"};
+ EXPECT_CALL(*mock_policy_handler_, GetInitialAppData(policy_app_id, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(nicknames), Return(true)));
+ EXPECT_CALL(mock_connection_handler_, GetWebEngineDeviceInfo())
+ .WillOnce(ReturnRef(kDeviceInfo));
+ EXPECT_CALL(*mock_policy_handler_, GetStatisticManager())
+ .WillOnce(Return(std::shared_ptr<usage_statistics::StatisticsManager>(
+ new usage_statistics_test::MockStatisticsManager())));
+ EXPECT_CALL(*mock_policy_handler_, GetAppProperties(_, _))
+ .WillOnce(DoAll(SetArgReferee<1>(app_properties), Return(true)));
+ // Expect NO Update app list
+ EXPECT_CALL(*mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+ app_manager_impl_->CreatePendingLocalApplication(policy_app_id);
+ AppsWaitRegistrationSet app_list =
+ app_manager_impl_->AppsWaitingForRegistration().GetData();
+ EXPECT_EQ(1u, app_list.size());
+}
+
+TEST_F(ApplicationManagerImplTest, CreatePendingApplicationByPolicyAppID) {
+ CreatePendingLocalApplication(kPolicyAppID);
+}
+
+TEST_F(ApplicationManagerImplTest, RemoveExistingPendingApplication_SUCCESS) {
+ CreatePendingLocalApplication(kPolicyAppID);
+ auto app_list = app_manager_impl_->AppsWaitingForRegistration().GetData();
+ ASSERT_EQ(1u, app_list.size());
+
+ app_manager_impl_->RemovePendingApplication(kPolicyAppID);
+ app_list = app_manager_impl_->AppsWaitingForRegistration().GetData();
+ EXPECT_TRUE(app_list.empty());
+}
+
+TEST_F(ApplicationManagerImplTest,
+ RemovePendingApplicationFromEmptyList_NoAppRemoved_SUCCESS) {
+ auto app_list = app_manager_impl_->AppsWaitingForRegistration().GetData();
+ ASSERT_TRUE(app_list.empty());
+
+ app_manager_impl_->RemovePendingApplication(kPolicyAppID);
+ app_list = app_manager_impl_->AppsWaitingForRegistration().GetData();
+ EXPECT_TRUE(app_list.empty());
+}
+
+TEST_F(
+ ApplicationManagerImplTest,
+ OnWebEngineDeviceCreated_NoEnabledLocalApps_PendingApplicationNotCreatedAndNoUpdateAppList) {
+ std::vector<std::string> enabled_apps;
+ EXPECT_CALL(*mock_policy_handler_, GetEnabledLocalApps())
+ .WillOnce(Return(enabled_apps));
+ EXPECT_CALL(*mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+
+ app_manager_impl_->OnWebEngineDeviceCreated();
+
+ auto app_list = app_manager_impl_->AppsWaitingForRegistration().GetData();
+ EXPECT_TRUE(app_list.empty());
+}
+
+TEST_F(
+ ApplicationManagerImplTest,
+ OnWebEngineDeviceCreated_PendingApplicationCreatedAndUpdateAppListSentToHMI) {
+ std::vector<std::string> enabled_apps = {"app1"};
+ std::vector<std::string> nicknames{"PendingApplication"};
+
+ EXPECT_CALL(*mock_policy_handler_, GetEnabledLocalApps())
+ .WillOnce(Return(enabled_apps));
+ EXPECT_CALL(*mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
+ EXPECT_CALL(*mock_policy_handler_, GetAppProperties(_, _))
+ .WillOnce(DoAll(SetArgReferee<1>(app_properties), Return(true)));
+ EXPECT_CALL(*mock_policy_handler_, GetInitialAppData(_, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(nicknames), Return(true)));
+ EXPECT_CALL(mock_connection_handler_, GetWebEngineDeviceInfo())
+ .WillOnce(ReturnRef(kDeviceInfo));
+
+ app_manager_impl_->OnWebEngineDeviceCreated();
+
+ auto app_list = app_manager_impl_->AppsWaitingForRegistration().GetData();
+ EXPECT_EQ(1u, app_list.size());
+}
+
+TEST_F(ApplicationManagerImplTest, AddAndRemoveQueryAppDevice_SUCCESS) {
+ const connection_handler::DeviceHandle device_handle = 1u;
+ ASSERT_FALSE(app_manager_impl_->IsAppsQueriedFrom(device_handle));
+
+ app_manager_impl_->OnQueryAppsRequest(device_handle);
+ EXPECT_TRUE(app_manager_impl_->IsAppsQueriedFrom(device_handle));
+ app_manager_impl_->RemoveDevice(device_handle);
+ EXPECT_FALSE(app_manager_impl_->IsAppsQueriedFrom(device_handle));
+}
+
+} // namespace application_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/application_state_test.cc b/src/components/application_manager/test/application_state_test.cc
index 6f732b6adc..22d111f926 100644
--- a/src/components/application_manager/test/application_state_test.cc
+++ b/src/components/application_manager/test/application_state_test.cc
@@ -31,17 +31,15 @@
*/
#include "application_manager/application_state.h"
-#include "gtest/gtest.h"
+#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/hmi_state.h"
-#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_application.h"
-#include "application_manager/event_engine/event_dispatcher.h"
-#include "resumption/last_state.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/policies/policy_handler.h"
-#include "application_manager/state_controller.h"
#include "application_manager/resumption/resume_ctrl.h"
-
-#include "utils/make_shared.h"
+#include "application_manager/state_controller.h"
+#include "gtest/gtest.h"
+#include "resumption/last_state.h"
namespace test {
namespace components {
@@ -52,6 +50,11 @@ using namespace mobile_apis;
typedef HmiState::StateID StateID;
namespace {
+
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const std::string kDefaultWindowName = "DefaultName";
+
std::vector<StateID> GenerateCurrentStates() {
std::vector<StateID> states;
states.push_back(StateID::STATE_ID_PHONE_CALL);
@@ -62,7 +65,7 @@ std::vector<StateID> GenerateCurrentStates() {
states.push_back(StateID::STATE_ID_DEACTIVATE_HMI);
return states;
}
-}
+} // namespace
class ApplicationStateTest : public ::testing::Test {
public:
@@ -75,7 +78,7 @@ class ApplicationStateTest : public ::testing::Test {
ApplicationState app_state;
const StateID current_id = StateID::STATE_ID_CURRENT;
const StateID postponed_id = StateID::STATE_ID_POSTPONED;
- utils::SharedPtr<MockApplication> mock_app_;
+ std::shared_ptr<MockApplication> mock_app_;
MockApplicationManager app_mngr_;
};
@@ -85,32 +88,32 @@ std::vector<StateID> ApplicationStateTest::added_states_ =
TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) {
std::vector<StateID>::iterator new_state = added_states_.begin();
for (; new_state != added_states_.end(); ++new_state) {
- HmiStatePtr state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ HmiStatePtr state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
- EXPECT_EQ(state, app_state.GetState(current_id));
+ app_state.AddState(kDefaultWindowId, state);
+ EXPECT_EQ(state, app_state.GetState(kDefaultWindowId, current_id));
}
}
TEST_F(ApplicationStateTest, AddStates_RemoveStates_GetCurrentState) {
std::vector<StateID>::iterator new_state = added_states_.begin();
for (; new_state != added_states_.end(); ++new_state) {
- HmiStatePtr state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ HmiStatePtr state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
- HmiStatePtr curr_state = app_state.GetState(current_id);
+ HmiStatePtr curr_state = app_state.GetState(kDefaultWindowId, current_id);
ASSERT_EQ(*new_state, curr_state->state_id());
}
new_state = added_states_.end() - 1;
while (new_state != added_states_.begin()) {
- app_state.RemoveState(*new_state);
- HmiStatePtr curr_state = app_state.GetState(current_id);
+ app_state.RemoveState(kDefaultWindowId, *new_state);
+ HmiStatePtr curr_state = app_state.GetState(kDefaultWindowId, current_id);
--new_state;
EXPECT_EQ(*new_state, curr_state->state_id());
}
@@ -120,193 +123,200 @@ TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) {
// Added some states
std::vector<StateID>::iterator new_state = added_states_.begin();
for (; new_state != added_states_.end(); ++new_state) {
- HmiStatePtr state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ HmiStatePtr state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
}
// Postponed state wasn't added
- HmiStatePtr get_postponed_id = app_state.GetState(postponed_id);
- EXPECT_EQ(NULL, get_postponed_id);
+ HmiStatePtr get_postponed_id =
+ app_state.GetState(kDefaultWindowId, postponed_id);
+ EXPECT_EQ(nullptr, get_postponed_id);
// Add posponed state
- HmiStatePtr state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ HmiStatePtr state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Postponed state exists
- get_postponed_id = app_state.GetState(postponed_id);
+ get_postponed_id = app_state.GetState(kDefaultWindowId, postponed_id);
EXPECT_EQ(state, get_postponed_id);
}
TEST_F(ApplicationStateTest, AddStates_GetRegularState) {
// Add state
std::vector<StateID>::iterator new_state = added_states_.begin();
- HmiStatePtr state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ HmiStatePtr state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
state->set_hmi_level(HMILevel::HMI_FULL);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
++new_state;
// Add some other
for (; new_state != added_states_.end(); ++new_state) {
- state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
state->set_hmi_level(HMILevel::HMI_LIMITED);
}
// Regular state will be the first added state
new_state = added_states_.begin();
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(*new_state, reg_state->state_id());
EXPECT_EQ(HMILevel::HMI_FULL, reg_state->hmi_level());
}
TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) {
std::vector<StateID>::iterator new_state = added_states_.begin();
- HmiStatePtr state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ HmiStatePtr state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
++new_state;
// Add postponed state
- state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Make sure that the state was added
- HmiStatePtr post_state = app_state.GetState(postponed_id);
+ HmiStatePtr post_state = app_state.GetState(kDefaultWindowId, postponed_id);
ASSERT_EQ(state, post_state);
for (; new_state != added_states_.end(); ++new_state) {
- state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
}
// Regular state will be the first added state
new_state = added_states_.begin();
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
ASSERT_EQ(*new_state, reg_state->state_id());
- app_state.RemoveState(*new_state);
+ app_state.RemoveState(kDefaultWindowId, *new_state);
++new_state;
// Now regular state is the next state except postponed
- reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ reg_state = app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(*new_state, reg_state->state_id());
}
TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) {
// Add some state
StateID first_state = StateID::STATE_ID_PHONE_CALL;
- HmiStatePtr state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ HmiStatePtr state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
first_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Add postponed state
- state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Add new postponed state
- utils::SharedPtr<MockApplication> mock_app_2(new MockApplication);
- state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ std::shared_ptr<MockApplication> mock_app_2(new MockApplication);
+ state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Add regular state
- state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
StateID::STATE_ID_REGULAR);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Postponed state is the first
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_POSTPONED);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_POSTPONED);
ASSERT_EQ(postponed_id, reg_state->state_id());
// Regular state is the second one
- reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ reg_state = app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(StateID::STATE_ID_REGULAR, reg_state->state_id());
}
TEST_F(ApplicationStateTest, InitState_GetRegularState) {
StateID init_state = StateID::STATE_ID_REGULAR;
- HmiStatePtr state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ HmiStatePtr state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
init_state);
- app_state.InitState(state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(state, reg_state);
- HmiStatePtr curr_state = app_state.GetState(StateID::STATE_ID_CURRENT);
+ HmiStatePtr curr_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_CURRENT);
EXPECT_EQ(state, curr_state);
}
TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) {
// Precondition
StateID init_state = StateID::STATE_ID_REGULAR;
- HmiStatePtr state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ HmiStatePtr state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
init_state);
state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
- app_state.InitState(state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
// Add postponed state
- state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Make sure that state was added
- HmiStatePtr get_postponed_state = app_state.GetState(postponed_id);
+ HmiStatePtr get_postponed_state =
+ app_state.GetState(kDefaultWindowId, postponed_id);
ASSERT_EQ(state, get_postponed_state);
// Remove postponed state
- app_state.RemoveState(postponed_id);
+ app_state.RemoveState(kDefaultWindowId, postponed_id);
- get_postponed_state = app_state.GetState(postponed_id);
- EXPECT_EQ(NULL, get_postponed_state);
+ get_postponed_state = app_state.GetState(kDefaultWindowId, postponed_id);
+ EXPECT_EQ(nullptr, get_postponed_state);
}
TEST_F(ApplicationStateTest,
AddRegularState_RemoveRegularState_RegularStateNotDeleted) {
StateID reg_state = StateID::STATE_ID_REGULAR;
- HmiStatePtr state = utils::MakeShared<HmiState>(
- static_cast<utils::SharedPtr<Application> >(mock_app_),
+ HmiStatePtr state = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
reg_state);
- app_state.InitState(state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
// Try deleting regular state
- app_state.RemoveState(reg_state);
+ app_state.RemoveState(kDefaultWindowId, reg_state);
// Get regular state
- HmiStatePtr get_reg_state = app_state.GetState(reg_state);
+ HmiStatePtr get_reg_state = app_state.GetState(kDefaultWindowId, reg_state);
EXPECT_EQ(state, get_reg_state);
}
diff --git a/src/components/application_manager/test/command_holder_test.cc b/src/components/application_manager/test/command_holder_test.cc
index 9227fd8fcb..acde0bfd86 100644
--- a/src/components/application_manager/test/command_holder_test.cc
+++ b/src/components/application_manager/test/command_holder_test.cc
@@ -35,11 +35,9 @@
#include "application_manager/command_holder_impl.h"
#include "application_manager/commands/command.h"
#include "smart_objects/smart_object.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
-#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_rpc_service.h"
namespace test {
@@ -75,18 +73,20 @@ class CommandHolderImplTest : public testing::Test {
const std::string kPolicyAppId_;
const uint32_t kHmiApplicationId_;
const uint32_t kConnectionKey_;
- utils::SharedPtr<smart_objects::SmartObject> cmd_ptr_;
- utils::SharedPtr<MockApplication> mock_app_ptr_;
+ std::shared_ptr<smart_objects::SmartObject> cmd_ptr_;
+ std::shared_ptr<MockApplication> mock_app_ptr_;
application_manager_test::MockRPCService mock_rpc_service_;
};
TEST_F(CommandHolderImplTest, HoldOne_ExpectReleaseOne) {
am::CommandHolderImpl cmd_holder(mock_app_manager_);
- cmd_holder.Suspend(
- mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_);
+ cmd_holder.Suspend(mock_app_ptr_,
+ am::CommandHolder::CommandType::kHmiCommand,
+ am::commands::Command::CommandSource::SOURCE_HMI,
+ cmd_ptr_);
// Act
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _));
cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand);
}
@@ -95,41 +95,52 @@ TEST_F(CommandHolderImplTest, HoldMany_ExpectReleaseSame) {
int32_t iterations = 0;
do {
- cmd_holder.Suspend(
- mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_);
+ cmd_holder.Suspend(mock_app_ptr_,
+ am::CommandHolder::CommandType::kHmiCommand,
+ am::commands::Command::CommandSource::SOURCE_HMI,
+ cmd_ptr_);
++iterations;
} while (iterations < 5);
// Act
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_)).Times(iterations);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _))
+ .Times(iterations);
cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand);
}
TEST_F(CommandHolderImplTest, Hold_Drop_ExpectNoReleased) {
am::CommandHolderImpl cmd_holder(mock_app_manager_);
- cmd_holder.Suspend(
- mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_);
- cmd_holder.Suspend(
- mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_);
+ cmd_holder.Suspend(mock_app_ptr_,
+ am::CommandHolder::CommandType::kHmiCommand,
+ am::commands::Command::CommandSource::SOURCE_HMI,
+ cmd_ptr_);
+ cmd_holder.Suspend(mock_app_ptr_,
+ am::CommandHolder::CommandType::kHmiCommand,
+ am::commands::Command::CommandSource::SOURCE_HMI,
+ cmd_ptr_);
// Act
cmd_holder.Clear(mock_app_ptr_);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _)).Times(0);
cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand);
}
TEST_F(CommandHolderImplTest, Hold_ReleaseAnotherId_ExpectNoReleased) {
am::CommandHolderImpl cmd_holder(mock_app_manager_);
- cmd_holder.Suspend(
- mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_);
- cmd_holder.Suspend(
- mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_);
+ cmd_holder.Suspend(mock_app_ptr_,
+ am::CommandHolder::CommandType::kHmiCommand,
+ am::commands::Command::CommandSource::SOURCE_HMI,
+ cmd_ptr_);
+ cmd_holder.Suspend(mock_app_ptr_,
+ am::CommandHolder::CommandType::kHmiCommand,
+ am::commands::Command::CommandSource::SOURCE_HMI,
+ cmd_ptr_);
// Act
- utils::SharedPtr<MockApplication> another_app =
- utils::MakeShared<MockApplication>();
+ std::shared_ptr<MockApplication> another_app =
+ std::make_shared<MockApplication>();
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _)).Times(0);
cmd_holder.Resume(another_app, am::CommandHolder::CommandType::kHmiCommand);
}
@@ -138,31 +149,38 @@ TEST_F(CommandHolderImplTest, Hold_DropAnotherId_ExpectReleased) {
int32_t iterations = 0;
do {
- cmd_holder.Suspend(
- mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_);
+ cmd_holder.Suspend(mock_app_ptr_,
+ am::CommandHolder::CommandType::kHmiCommand,
+ am::commands::Command::CommandSource::SOURCE_HMI,
+ cmd_ptr_);
++iterations;
} while (iterations < 3);
// Act
- utils::SharedPtr<MockApplication> another_app =
- utils::MakeShared<MockApplication>();
+ std::shared_ptr<MockApplication> another_app =
+ std::make_shared<MockApplication>();
cmd_holder.Clear(another_app);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_)).Times(iterations);
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _))
+ .Times(iterations);
cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand);
}
TEST_F(CommandHolderImplTest, Hold_Mobile_and_HMI_commands_ExpectReleased) {
am::CommandHolderImpl cmd_holder(mock_app_manager_);
- cmd_holder.Suspend(
- mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_);
+ cmd_holder.Suspend(mock_app_ptr_,
+ am::CommandHolder::CommandType::kHmiCommand,
+ am::commands::Command::CommandSource::SOURCE_HMI,
+ cmd_ptr_);
- cmd_holder.Suspend(
- mock_app_ptr_, am::CommandHolder::CommandType::kMobileCommand, cmd_ptr_);
+ cmd_holder.Suspend(mock_app_ptr_,
+ am::CommandHolder::CommandType::kMobileCommand,
+ am::commands::Command::CommandSource::SOURCE_MOBILE,
+ cmd_ptr_);
// Act
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_, _));
cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand);
EXPECT_CALL(
@@ -173,6 +191,6 @@ TEST_F(CommandHolderImplTest, Hold_Mobile_and_HMI_commands_ExpectReleased) {
am::CommandHolder::CommandType::kMobileCommand);
}
-} // application_manager_test
-} // components
-} // test
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/CMakeLists.txt b/src/components/application_manager/test/commands/CMakeLists.txt
index ab412c7e4e..ec7f454c47 100644
--- a/src/components/application_manager/test/commands/CMakeLists.txt
+++ b/src/components/application_manager/test/commands/CMakeLists.txt
@@ -35,10 +35,8 @@ include_directories(
${COMPONENTS_DIR}/application_manager/include/
${COMPONENTS_DIR}/application_manager/include/application_manager/
${COMPONENTS_DIR}/application_manager/include/application_manager/commands/
+ ${CMAKE_SOURCE_DIR}/src
)
-#${COMPONENTS_DIR}/application_manager/test/include/
-#${COMPONENTS_DIR}/application_manager/test/include/application_manager/
-#${COMPONENTS_DIR}/application_manager/src/commands/
set(COMMANDS_TEST_DIR ${AM_TEST_DIR}/commands)
@@ -51,8 +49,6 @@ file(GLOB SOURCES
${COMPONENTS_DIR}/application_manager/test/commands/command_response_impl_test.cc
)
-#${COMPONENTS_DIR}/application_manager/src/smart_object_keys.cc
-#${COMPONENTS_DIR}/application_manager/src/message.cc
set(LIBRARIES
gmock
Utils
@@ -62,13 +58,8 @@ set(LIBRARIES
connectionHandler
ApplicationManager
jsoncpp
- Policy
+ PolicyStatic
+ Resumption
)
create_test("commands_test" "${SOURCES}" "${LIBRARIES}")
-#${COMMANDS_TEST_DIR}/hmi/*
-#${COMMANDS_TEST_DIR}/hmi/hmi_notifications/*
-#${COMMANDS_TEST_DIR}/mobile/*
-#ApplicationManager
-#AMHMICommandsLibrary
-#AMMobileCommandsLibrary
diff --git a/src/components/application_manager/test/commands/command_impl_test.cc b/src/components/application_manager/test/commands/command_impl_test.cc
index b50d94f824..734a7d91b8 100644
--- a/src/components/application_manager/test/commands/command_impl_test.cc
+++ b/src/components/application_manager/test/commands/command_impl_test.cc
@@ -31,39 +31,38 @@
*/
#include <stdint.h>
-#include <string>
#include <algorithm>
#include <functional>
#include <set>
+#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
+
+#include "application_manager/application_manager.h"
#include "application_manager/commands/command.h"
#include "application_manager/commands/command_impl.h"
-#include "application_manager/application_manager.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace commands_test {
namespace command_impl {
-using ::testing::Return;
-using ::testing::AtLeast;
using ::testing::_;
+using ::testing::AtLeast;
+using ::testing::Return;
-using ::utils::SharedPtr;
namespace strings = ::application_manager::strings;
-using ::application_manager::commands::CommandImpl;
using ::application_manager::ApplicationManager;
-using ::application_manager::commands::MessageSharedPtr;
using ::application_manager::ApplicationSharedPtr;
+using ::application_manager::commands::CommandImpl;
+using ::application_manager::commands::MessageSharedPtr;
using ::test::components::application_manager_test::MockApplication;
-typedef SharedPtr<MockApplication> MockAppPtr;
+typedef std::shared_ptr<MockApplication> MockAppPtr;
namespace {
const uint32_t kDefaultMsgCount = 5u;
@@ -83,14 +82,15 @@ class CommandImplTest : public CommandsTest<CommandsTestMocks::kIsNice> {
public:
class UnwrappedCommandImpl : CommandImpl {
public:
- using CommandImpl::ReplaceMobileWithHMIAppId;
using CommandImpl::ReplaceHMIWithMobileAppId;
+ using CommandImpl::ReplaceMobileWithHMIAppId;
- UnwrappedCommandImpl(const MessageSharedPtr& message,
- ApplicationManager& application_manager,
- app_mngr::rpc_service::RPCService& rpc_service,
- app_mngr::HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler)
+ UnwrappedCommandImpl(
+ const MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ application_manager::rpc_service::RPCService& rpc_service,
+ application_manager::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
: CommandImpl(message,
application_manager,
rpc_service,
@@ -125,11 +125,11 @@ class CommandImplTest : public CommandsTest<CommandsTestMocks::kIsNice> {
};
typedef CommandImplTest::UnwrappedCommandImpl UCommandImpl;
-typedef SharedPtr<UCommandImpl> UCommandImplPtr;
+typedef std::shared_ptr<UCommandImpl> UCommandImplPtr;
TEST_F(CommandImplTest, GetMethods_SUCCESS) {
MessageSharedPtr msg;
- SharedPtr<CommandImpl> command =
+ std::shared_ptr<CommandImpl> command =
CreateCommand<CommandImpl>(kDefaultTimeout_, msg);
// Current implementation always return `true`
diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc
index c5a3459673..83b5d7eeb4 100644
--- a/src/components/application_manager/test/commands/command_request_impl_test.cc
+++ b/src/components/application_manager/test/commands/command_request_impl_test.cc
@@ -31,25 +31,29 @@
*/
#include <stdint.h>
-#include <string>
#include <algorithm>
+#include <string>
-#include "gtest/gtest.h"
#include "application_manager/commands/command_impl.h"
#include "application_manager/commands/command_request_impl.h"
-#include "application_manager/commands/commands_test.h"
#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
#include "utils/lock.h"
-#include "utils/shared_ptr.h"
-#include "utils/data_accessor.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
+
#include "application_manager/application_manager.h"
-#include "application_manager/mock_application.h"
#include "application_manager/event_engine/event.h"
-#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_application.h"
#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/smart_object_keys.h"
#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+#include "utils/data_accessor.h"
+
+#include "application_manager/mock_app_service_manager.h"
+#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
namespace test {
namespace components {
@@ -61,20 +65,21 @@ namespace strings = am::strings;
namespace hmi_response = am::hmi_response;
using ::testing::_;
+using ::testing::DoAll;
using ::testing::Return;
using ::testing::SaveArg;
-using ::testing::DoAll;
+using ::testing::SetArgReferee;
-using ::utils::SharedPtr;
-using am::commands::MessageSharedPtr;
-using am::CommandParametersPermissions;
-using am::event_engine::EventObserver;
-using am::commands::CommandImpl;
-using am::commands::CommandRequestImpl;
using am::ApplicationManager;
using am::ApplicationSet;
-using am::RPCParams;
+using am::CommandParametersPermissions;
using am::MockHmiInterfaces;
+using am::RPCParams;
+using am::commands::CommandImpl;
+using am::commands::CommandRequestImpl;
+using am::commands::MessageSharedPtr;
+using am::event_engine::EventObserver;
+using test::components::application_manager_test::MockAppServiceManager;
typedef am::commands::CommandRequestImpl::RequestState RequestState;
@@ -91,6 +96,9 @@ const std::string kDisallowedParam2 = "disallowed_param2";
const std::string kAllowedParam = "allowed_param";
const std::string kUndefinedParam = "undefined_params";
const std::string kMissedParam = "missed_param";
+const std::string kAppStorageFolder = "app_storage_folder";
+const std::string kAppStorageFile = "./app_info.dat";
+const std::string kAppInfoStorage = "app_info_storage";
} // namespace
class CommandRequestImplTest
@@ -101,10 +109,10 @@ class CommandRequestImplTest
class UnwrappedCommandRequestImpl : public CommandRequestImpl {
public:
- using CommandRequestImpl::CheckAllowedParameters;
- using CommandRequestImpl::RemoveDisallowedParameters;
using CommandRequestImpl::AddDisallowedParameters;
+ using CommandRequestImpl::CheckAllowedParameters;
using CommandRequestImpl::HasDisallowedParams;
+ using CommandRequestImpl::RemoveDisallowedParameters;
UnwrappedCommandRequestImpl(const MessageSharedPtr& message,
ApplicationManager& am,
@@ -134,8 +142,8 @@ class CommandRequestImplTest
}
};
- MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) {
- app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set);
+ MockAppPtr InitAppSetDataAccessor(std::shared_ptr<ApplicationSet>& app_set) {
+ app_set = (!app_set ? std::make_shared<ApplicationSet>() : app_set);
MockAppPtr app(CreateMockApp());
app_set->insert(app);
EXPECT_CALL(app_mngr_, applications())
@@ -148,7 +156,14 @@ class CommandRequestImplTest
};
typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl;
-typedef SharedPtr<UCommandRequestImpl> CommandPtr;
+typedef std::shared_ptr<UCommandRequestImpl> CommandPtr;
+
+TEST_F(CommandRequestImplTest, WindowID_ExpectDefaultWindowID) {
+ auto msg = CreateMessage();
+ const auto command = CreateCommand<UCommandRequestImpl>(msg);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ command->window_id());
+}
TEST_F(CommandRequestImplTest, OnTimeOut_StateCompleted_UNSUCCESS) {
CommandPtr command = CreateCommand<UCommandRequestImpl>();
@@ -259,7 +274,7 @@ TEST_F(CommandRequestImplTest, CreateHMINotification_SUCCESS) {
MessageSharedPtr result;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
command->CreateHMINotification(kInvalidFunctionId, *msg_params);
@@ -281,7 +296,7 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_NoUseEvent_SUCCESS) {
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
// Return `true` prevents call of `SendResponse` method;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
EXPECT_EQ(kCorrelationId,
command->SendHMIRequest(kInvalidFunctionId, NULL, false));
@@ -299,7 +314,7 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) {
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
// Return `true` prevents call of `SendResponse` method;
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
EXPECT_CALL(event_dispatcher_, add_observer(_, _, _));
EXPECT_EQ(kCorrelationId,
@@ -307,13 +322,6 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) {
}
TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) {
- am::VehicleData vehicle_data;
- vehicle_data.insert(am::VehicleData::value_type(
- kMissedParam, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY));
-
- EXPECT_CALL(mock_message_helper_, vehicle_data())
- .WillOnce(ReturnRef(vehicle_data));
-
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::msg_params][kDisallowedParam1] = 0u;
(*msg)[strings::msg_params][kDisallowedParam2] = 0u;
@@ -322,7 +330,6 @@ TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) {
(*msg)[strings::msg_params][kMissedParam] = 0u;
CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
-
CommandParametersPermissions& permission = command->parameters_permissions();
permission.disallowed_params.insert(kDisallowedParam1);
permission.disallowed_params.insert(kDisallowedParam2);
@@ -362,6 +369,12 @@ TEST_F(CommandRequestImplTest,
TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) {
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, GetWindowIds())
+ .WillByDefault(Return(
+ am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
+ ON_CALL(*mock_app,
+ WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(true));
MessageSharedPtr message = CreateMessage();
(*message)[strings::msg_params] =
@@ -369,7 +382,7 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) {
CommandPtr command = CreateCommand<UCommandRequestImpl>(message);
- EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _))
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
.WillOnce(Return(kMobResultSuccess));
EXPECT_TRUE(command->CheckPermissions());
@@ -379,10 +392,18 @@ TEST_F(CommandRequestImplTest,
CheckAllowedParameters_WrongPolicyPermissions_UNSUCCESS) {
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, GetWindowIds())
+ .WillByDefault(Return(
+ am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
+ ON_CALL(*mock_app,
+ WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(true));
MessageSharedPtr message = CreateMessage();
(*message)[strings::msg_params] =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+ (*message)[strings::params][strings::message_type] =
+ mobile_apis::messageType::request;
CommandPtr command = CreateCommand<UCommandRequestImpl>(message);
@@ -390,7 +411,7 @@ TEST_F(CommandRequestImplTest,
.Times(1)
.WillRepeatedly(Return(kConnectionKey));
- EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _))
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
.WillOnce(Return(mobile_apis::Result::INVALID_ENUM));
EXPECT_CALL(mock_message_helper_, CreateBlockedByPoliciesResponse(_, _, _, _))
@@ -401,7 +422,7 @@ TEST_F(CommandRequestImplTest,
}
ACTION_P(GetArg3, output) {
- *output = arg2;
+ *output = arg3;
}
TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) {
@@ -413,9 +434,14 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) {
MockAppPtr app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, GetWindowIds())
+ .WillByDefault(Return(
+ am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
+ ON_CALL(*app, WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(true));
RPCParams params;
- EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _))
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
.WillOnce(DoAll(GetArg3(&params), Return(kMobResultSuccess)));
EXPECT_TRUE(command->CheckPermissions());
@@ -428,13 +454,13 @@ TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) {
vehicle_data.insert(am::VehicleData::value_type(
kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY));
- EXPECT_CALL(mock_message_helper_, vehicle_data())
- .WillOnce(ReturnRef(vehicle_data));
-
MessageSharedPtr msg;
CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(vehicle_data));
+
command->removed_parameters_permissions().disallowed_params.insert(
kDisallowedParam1);
@@ -481,9 +507,6 @@ TEST_F(CommandRequestImplTest,
vehicle_data.insert(am::VehicleData::value_type(
kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY));
- EXPECT_CALL(mock_message_helper_, vehicle_data())
- .WillOnce(ReturnRef(vehicle_data));
-
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::function_id] =
mobile_apis::FunctionID::SubscribeVehicleDataID;
@@ -495,6 +518,9 @@ TEST_F(CommandRequestImplTest,
MessageSharedPtr result;
+ ON_CALL(mock_message_helper_, vehicle_data())
+ .WillByDefault(ReturnRef(vehicle_data));
+
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
@@ -586,6 +612,93 @@ TEST_F(CommandRequestImplTest, AppNotFound_HashUpdateNotExpected) {
command.reset();
}
+TEST_F(CommandRequestImplTest, SendProviderRequest_ByServiceType) {
+ auto last_state = std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>(kAppStorageFolder,
+ kAppInfoStorage));
+
+ MockAppServiceManager app_service_manager(app_mngr_, last_state);
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager));
+ EXPECT_CALL(app_service_manager, GetProviderByType("MEDIA", _, _, _))
+ .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(false)));
+
+ MessageSharedPtr result;
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::GetAppServiceDataID;
+ (*msg)[strings::msg_params][strings::service_type] = "MEDIA";
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ command->SendProviderRequest(
+ mobile_apis::FunctionID::GetAppServiceDataID,
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ &(*msg),
+ true);
+}
+
+TEST_F(CommandRequestImplTest, SendProviderRequest_ByProviderID) {
+ auto last_state = std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>(kAppStorageFolder,
+ kAppInfoStorage));
+
+ MockAppServiceManager app_service_manager(app_mngr_, last_state);
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager));
+ EXPECT_CALL(app_service_manager, GetProviderByID("serviceid12345", _, _, _))
+ .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(false)));
+
+ MessageSharedPtr result;
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::GetAppServiceDataID;
+ (*msg)[strings::msg_params][strings::service_id] = "serviceid12345";
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ command->SendProviderRequest(
+ mobile_apis::FunctionID::GetAppServiceDataID,
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ &(*msg),
+ true);
+}
+
+TEST_F(CommandRequestImplTest, SendProviderRequestToHMI_ByProviderID) {
+ auto last_state = std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>(kAppStorageFolder,
+ kAppInfoStorage));
+
+ MockAppServiceManager app_service_manager(app_mngr_, last_state);
+ MockAppPtr mock_app = CreateMockApp();
+ EXPECT_CALL(app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(app_service_manager));
+ EXPECT_CALL(app_service_manager, GetProviderByID("serviceid12345", _, _, _))
+ .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(true)));
+
+ MessageSharedPtr result;
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
+
+ MessageSharedPtr msg = CreateMessage();
+ (*msg)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::GetAppServiceDataID;
+ (*msg)[strings::msg_params][strings::service_id] = "serviceid12345";
+
+ CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);
+ command->SendProviderRequest(
+ mobile_apis::FunctionID::GetAppServiceDataID,
+ hmi_apis::FunctionID::AppService_GetAppServiceData,
+ &(*msg),
+ true);
+}
+
} // namespace command_request_impl
} // namespace commands_test
} // namespace components
diff --git a/src/components/application_manager/test/commands/command_response_impl_test.cc b/src/components/application_manager/test/commands/command_response_impl_test.cc
index bd7499ce8f..6362ea702e 100644
--- a/src/components/application_manager/test/commands/command_response_impl_test.cc
+++ b/src/components/application_manager/test/commands/command_response_impl_test.cc
@@ -34,13 +34,13 @@
#include <string>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/commands/commands_test.h"
+
#include "application_manager/commands/command.h"
#include "application_manager/commands/command_response_impl.h"
+#include "application_manager/commands/commands_test.h"
#include "application_manager/mock_application.h"
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -49,15 +49,16 @@ namespace command_response_impl {
namespace strings = ::application_manager::strings;
namespace hmi_response = ::application_manager::hmi_response;
-using ::utils::SharedPtr;
-using ::application_manager::commands::MessageSharedPtr;
+
using ::application_manager::commands::CommandResponseImpl;
+using ::application_manager::commands::MessageSharedPtr;
class CommandResponseImplTest
: public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(CommandResponseImplTest, BasicMethodsOverloads_SUCCESS) {
- SharedPtr<CommandResponseImpl> command = CreateCommand<CommandResponseImpl>();
+ std::shared_ptr<CommandResponseImpl> command =
+ CreateCommand<CommandResponseImpl>();
// Current implementation always return `true`
EXPECT_TRUE(command->Init());
EXPECT_TRUE(command->CleanUp());
@@ -66,7 +67,7 @@ TEST_F(CommandResponseImplTest, BasicMethodsOverloads_SUCCESS) {
TEST_F(CommandResponseImplTest, SendResponse_MessageWithResultCode_SUCCESS) {
MessageSharedPtr msg;
- SharedPtr<CommandResponseImpl> command =
+ std::shared_ptr<CommandResponseImpl> command =
CreateCommand<CommandResponseImpl>(msg);
// Do not have a weight in this case
const bool kSuccess = true;
@@ -86,7 +87,7 @@ TEST_F(CommandResponseImplTest, SendResponse_MessageWithResultCode_SUCCESS) {
TEST_F(CommandResponseImplTest,
SendResponse_EmptyMessageValidResultCode_SUCCESS) {
MessageSharedPtr msg;
- SharedPtr<CommandResponseImpl> command =
+ std::shared_ptr<CommandResponseImpl> command =
CreateCommand<CommandResponseImpl>(msg);
const bool kSuccess = true;
@@ -108,7 +109,7 @@ TEST_F(CommandResponseImplTest,
TEST_F(CommandResponseImplTest,
SendResponse_EmptyMessageInvalidResultCode_SUCCESS) {
MessageSharedPtr msg;
- SharedPtr<CommandResponseImpl> command =
+ std::shared_ptr<CommandResponseImpl> command =
CreateCommand<CommandResponseImpl>(msg);
const bool kSuccess = true;
@@ -133,7 +134,7 @@ TEST_F(CommandResponseImplTest,
TEST_F(CommandResponseImplTest,
SendResponse_EmptyMessageInvalidResultCodeNoHmiResponse_SUCCESS) {
MessageSharedPtr msg;
- SharedPtr<CommandResponseImpl> command =
+ std::shared_ptr<CommandResponseImpl> command =
CreateCommand<CommandResponseImpl>(msg);
const mobile_apis::Result::eType kResultCode =
@@ -158,7 +159,7 @@ TEST_F(CommandResponseImplTest,
TEST_F(CommandResponseImplTest,
SendResponse_EmptyMessageInvalidResultCodeNoHmiResponse_INVALID_ENUM) {
MessageSharedPtr msg;
- SharedPtr<CommandResponseImpl> command =
+ std::shared_ptr<CommandResponseImpl> command =
CreateCommand<CommandResponseImpl>(msg);
const mobile_apis::Result::eType kResultCode =
diff --git a/src/components/application_manager/test/event_engine_test.cc b/src/components/application_manager/test/event_engine_test.cc
index 440763d4c3..6746e0d5ec 100644
--- a/src/components/application_manager/test/event_engine_test.cc
+++ b/src/components/application_manager/test/event_engine_test.cc
@@ -32,23 +32,25 @@
#include "gtest/gtest.h"
-#include "application_manager/event_engine/event_observer.h"
#include "application_manager/event_engine/event.h"
#include "application_manager/event_engine/event_dispatcher_impl.h"
-#include "application_manager/mock_event_observer.h"
+#include "application_manager/event_engine/event_observer.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_event_observer.h"
#include "smart_objects/smart_object.h"
-#include "utils/make_shared.h"
+
#include "interfaces/HMI_API.h"
namespace test {
namespace components {
namespace event_engine_test {
-using application_manager::event_engine::EventDispatcherImpl;
using application_manager::event_engine::Event;
+using application_manager::event_engine::EventDispatcherImpl;
using application_manager::event_engine::EventObserver;
using testing::_;
+using ::testing::An;
+using ::testing::Matcher;
class EventEngineTest : public testing::Test {
public:
@@ -122,7 +124,9 @@ class EventEngineTest : public testing::Test {
event_dispatcher_instance_->add_observer(
event_id, correlation_id, event_observer_mock_);
event_->set_smart_object(so);
- EXPECT_CALL(event_observer_mock_, on_event(_)).Times(calls_number);
+
+ EXPECT_CALL(event_observer_mock_, on_event(An<const Event&>()))
+ .Times(calls_number);
event_dispatcher_instance_->raise_event(*event_);
}
};
diff --git a/src/components/application_manager/test/help_prompt_manager_test.cc b/src/components/application_manager/test/help_prompt_manager_test.cc
new file mode 100644
index 0000000000..caff56f675
--- /dev/null
+++ b/src/components/application_manager/test/help_prompt_manager_test.cc
@@ -0,0 +1,372 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/application_impl.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/hmi_state.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_help_prompt_manager.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_resumption_data.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "gtest/gtest.h"
+#include "policy/usage_statistics/mock_statistics_manager.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "sdl_rpc_plugin/commands/mobile/set_global_properties_request.h"
+#include "utils/file_system.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+namespace {
+const uint32_t kConnectionKey = 1u;
+const uint32_t kCorrelationKey = 2u;
+const uint32_t kAppId = 10u;
+const uint32_t kCmdId = 1u;
+const std::string kPolicyAppId = "fake_app_id";
+const uint32_t kTimeout = 10000u;
+const std::string kText = "one";
+const uint32_t kPosition = 1u;
+const std::string kFirstVrCommand = "first";
+const int32_t kGrammarId = 12;
+const std::string kDirectoryName = "./test_storage";
+const uint8_t expected_tread_pool_size = 2u;
+const uint8_t stop_streaming_timeout = 1u;
+const std::vector<std::string> kTimeoutPrompt{"timeoutPrompt"};
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const std::string kDefaultWindowName = "DefaultName";
+} // namespace
+
+using namespace application_manager;
+using namespace policy;
+using namespace test::components::commands_test;
+using namespace mobile_apis;
+
+using am::HmiStatePtr;
+using sdl_rpc_plugin::commands::SetGlobalPropertiesRequest;
+using testing::_;
+using testing::Mock;
+using testing::NiceMock;
+using testing::Return;
+using testing::ReturnRef;
+using usage_statistics_test::MockStatisticsManager;
+
+class ApplicationImplTest : public ApplicationImpl {
+ public:
+ ApplicationImplTest(
+ uint32_t application_id,
+ const std::string& policy_app_id,
+ const std::string& mac_address,
+ const connection_handler::DeviceHandle device_id,
+ const custom_str::CustomString& app_name,
+ std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager,
+ ApplicationManager& application_manager,
+ MockHelpPromptManager& mock_help_prompt_manager)
+ : ApplicationImpl(application_id,
+ policy_app_id,
+ mac_address,
+ device_id,
+ app_name,
+ statistics_manager,
+ application_manager)
+ , mock_help_prompt_manager_(mock_help_prompt_manager) {}
+
+ HelpPromptManager& help_prompt_manager() OVERRIDE {
+ return mock_help_prompt_manager_;
+ }
+
+ private:
+ MockHelpPromptManager& mock_help_prompt_manager_;
+};
+
+class HelpPromptManagerTest : public ::testing::Test {
+ public:
+ HelpPromptManagerTest()
+ : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
+ void SetUp() OVERRIDE;
+ void TearDown() OVERRIDE;
+ MessageSharedPtr CreateMsgParams();
+ void VRArraySetupHelper(MessageSharedPtr msg,
+ SmartObject& vr_help_title,
+ SmartObject& vr_help_array);
+ void CreateBasicParamsVRRequest(MessageSharedPtr msg);
+ void CreateApplication(MockHelpPromptManager& mock_help_prompt_manager);
+ HmiStatePtr CreateTestHmiState();
+
+ template <class Command>
+ std::shared_ptr<Command> CreateCommand(MessageSharedPtr& msg) {
+ return std::make_shared<Command>(msg,
+ app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_);
+ }
+
+ protected:
+ typedef CommandsTest<CommandsTestMocks::kIsNice>::MockAppManager
+ MockAppManager;
+ MockAppManager app_mngr_;
+ // put this before ApplicationImplTest instance, so that app_mngr_settings_
+ // will still exist during app_impl_'s destructor.
+ NiceMock<MockApplicationManagerSettings> app_mngr_settings_;
+ std::shared_ptr<ApplicationImplTest> app_impl_;
+ MockHmiInterfaces mock_hmi_interfaces_;
+ NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
+ std::shared_ptr<application_manager_test::MockApplication> mock_app_;
+ sync_primitives::Lock app_lock_;
+ MockRPCService mock_rpc_service_;
+ application_manager_test::MockHMICapabilities mock_hmi_capabilities_;
+ policy_test::MockPolicyHandlerInterface mock_policy_handler_;
+ MockMessageHelper& mock_message_helper_;
+ std::shared_ptr<MockHelpPromptManager> mock_help_prompt_manager_;
+};
+
+void HelpPromptManagerTest::SetUp() {
+ ON_CALL(app_mngr_, hmi_interfaces())
+ .WillByDefault(ReturnRef(mock_hmi_interfaces_));
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
+ .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_SDL));
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ ON_CALL(app_mngr_, get_settings())
+ .WillByDefault(ReturnRef(app_mngr_settings_));
+ ON_CALL(app_mngr_, event_dispatcher())
+ .WillByDefault(ReturnRef(mock_event_dispatcher_));
+ ON_CALL(app_mngr_settings_, default_timeout())
+ .WillByDefault(ReturnRef(kTimeout));
+ ON_CALL(app_mngr_settings_, app_icons_folder())
+ .WillByDefault(ReturnRef(kDirectoryName));
+ ON_CALL(app_mngr_settings_, app_storage_folder())
+ .WillByDefault(ReturnRef(kDirectoryName));
+ ON_CALL(app_mngr_settings_, audio_data_stopped_timeout())
+ .WillByDefault(Return(0));
+ ON_CALL(app_mngr_settings_, video_data_stopped_timeout())
+ .WillByDefault(Return(0));
+
+ mock_help_prompt_manager_ =
+ std::shared_ptr<MockHelpPromptManager>(new MockHelpPromptManager());
+
+ const std::string path("storage");
+ if (file_system::CreateDirectory(path)) {
+ file_system::CreateFile(path + "/" + "certificate");
+ }
+
+ mock_app_ = std::make_shared<application_manager_test::MockApplication>();
+}
+
+void HelpPromptManagerTest::TearDown() {
+ Mock::VerifyAndClearExpectations(&mock_message_helper_);
+}
+
+MessageSharedPtr HelpPromptManagerTest::CreateMsgParams() {
+ MessageSharedPtr msg =
+ std::make_shared<SmartObject>(smart_objects::SmartType_Map);
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*msg)[am::strings::msg_params][am::strings::app_id] = kAppId;
+ return msg;
+}
+
+void HelpPromptManagerTest::VRArraySetupHelper(MessageSharedPtr msg,
+ SmartObject& vr_help_title,
+ SmartObject& vr_help_array) {
+ (*msg)[am::strings::msg_params][am::strings::vr_help_title] = vr_help_title;
+ vr_help_array[0] = SmartObject(smart_objects::SmartType_Map);
+ vr_help_array[0][am::strings::text] = kText;
+ vr_help_array[0][am::strings::position] = kPosition;
+ (*msg)[am::strings::msg_params][am::strings::vr_help] = vr_help_array;
+}
+
+void HelpPromptManagerTest::CreateBasicParamsVRRequest(MessageSharedPtr msg) {
+ SmartObject& msg_params = (*msg)[strings::msg_params];
+ msg_params[strings::cmd_id] = kCmdId;
+ msg_params[strings::vr_commands] =
+ SmartObject(smart_objects::SmartType_Array);
+ msg_params[strings::vr_commands][0] = kFirstVrCommand;
+ msg_params[strings::type] = kPosition;
+ msg_params[strings::grammar_id] = kGrammarId;
+ msg_params[strings::info] = "VR info";
+}
+
+HmiStatePtr HelpPromptManagerTest::CreateTestHmiState() {
+ HmiStatePtr testState = std::make_shared<HmiState>(
+ static_cast<std::shared_ptr<Application> >(app_impl_),
+ app_mngr_,
+ HmiState::STATE_ID_REGULAR);
+ testState->set_hmi_level(HMILevel::INVALID_ENUM);
+ testState->set_audio_streaming_state(AudioStreamingState::NOT_AUDIBLE);
+ testState->set_system_context(SystemContext::SYSCTXT_MAIN);
+ return testState;
+}
+
+void HelpPromptManagerTest::CreateApplication(
+ MockHelpPromptManager& mock_help_prompt_manager) {
+ const std::string policy_app_id = "p_app_id";
+ const std::string mac_address = "MA:CA:DD:RE:SS";
+ const connection_handler::DeviceHandle device_id = 1;
+ const custom_str::CustomString app_name("");
+
+ app_impl_.reset(
+ new ApplicationImplTest(kAppId,
+ policy_app_id,
+ mac_address,
+ device_id,
+ app_name,
+ std::make_shared<MockStatisticsManager>(),
+ app_mngr_,
+ mock_help_prompt_manager));
+ HmiStatePtr initial_state = CreateTestHmiState();
+ app_impl_->SetInitialState(
+ kDefaultWindowId, kDefaultWindowName, initial_state);
+}
+
+TEST_F(HelpPromptManagerTest, AddCommand_OnVrCommandAdded) {
+ CreateApplication(*mock_help_prompt_manager_.get());
+ MessageSharedPtr msg =
+ std::make_shared<SmartObject>(smart_objects::SmartType_Map);
+ CreateBasicParamsVRRequest(msg);
+ (*msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[strings::msg_params][strings::cmd_id] = kCmdId;
+
+ app_impl_->AddCommand(kCmdId, (*msg)[strings::msg_params]);
+}
+
+TEST_F(HelpPromptManagerTest, RemoveCommand_OnVrCommandDeleted) {
+ CreateApplication(*mock_help_prompt_manager_.get());
+ MessageSharedPtr msg =
+ std::make_shared<SmartObject>(smart_objects::SmartType_Map);
+ CreateBasicParamsVRRequest(msg);
+ (*msg)[strings::params][hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[strings::msg_params][strings::cmd_id] = kCmdId;
+
+ app_impl_->AddCommand(kCmdId, (*msg)[strings::msg_params]);
+ app_impl_->RemoveCommand(kCmdId);
+}
+
+TEST_F(HelpPromptManagerTest,
+ Request_OnSetGlobalPropertiesReceived_TTS_SUCCESS) {
+ MessageSharedPtr msg = CreateMsgParams();
+ SmartObject help_prompt(smart_objects::SmartType_Array);
+ help_prompt[0][am::strings::text] = "Help_Prompt_One";
+ (*msg)[am::strings::msg_params][am::strings::help_prompt] = help_prompt;
+ SmartObject timeout_prompt(smart_objects::SmartType_Array);
+ timeout_prompt[0][am::strings::text] = "Timeout_Prompt_One";
+ (*msg)[am::strings::msg_params][am::strings::timeout_prompt] = timeout_prompt;
+
+ EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
+ EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(help_prompt, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(timeout_prompt, _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
+
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+ EXPECT_CALL(*mock_app_, set_help_prompt(help_prompt));
+ EXPECT_CALL(*mock_app_, help_prompt()).WillOnce(Return(&help_prompt));
+ EXPECT_CALL(*mock_app_, set_timeout_prompt(timeout_prompt));
+ EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(&timeout_prompt));
+ EXPECT_CALL(
+ mock_hmi_interfaces_,
+ GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties))
+ .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
+
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ command->Run();
+}
+
+TEST_F(HelpPromptManagerTest,
+ Request_OnSetGlobalPropertiesReceived_UI_SUCCESS) {
+ MessageSharedPtr msg = CreateMsgParams();
+ SmartObject vr_help_title("yes");
+ SmartObject vr_help_array(smart_objects::SmartType_Array);
+ VRArraySetupHelper(msg, vr_help_title, vr_help_array);
+ (*msg)[am::strings::msg_params][am::strings::vr_help] = vr_help_array;
+ SmartObject menu_title("Menu_Title");
+ (*msg)[am::strings::msg_params][am::hmi_request::menu_title] = menu_title;
+ SmartObject menu_icon(smart_objects::SmartType_Map);
+ menu_icon[am::strings::value] = "1";
+ (*msg)[am::strings::msg_params][am::hmi_request::menu_icon] = menu_icon;
+ SmartObject keyboard_properties(smart_objects::SmartType_Map);
+ (*msg)[am::strings::msg_params][am::hmi_request::keyboard_properties] =
+ keyboard_properties;
+
+ EXPECT_CALL(mock_message_helper_, VerifyImage(menu_icon, _, _))
+ .WillOnce((Return(mobile_apis::Result::SUCCESS)));
+ EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(vr_help_array, _, _))
+ .WillOnce((Return(mobile_apis::Result::SUCCESS)));
+ EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(mock_app_));
+
+ EXPECT_CALL(*mock_app_, set_vr_help_title(vr_help_title));
+ EXPECT_CALL(*mock_app_, set_vr_help(vr_help_array));
+ EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
+ EXPECT_CALL(*mock_app_, vr_help()).WillOnce(Return(&vr_help_array));
+ EXPECT_CALL(*mock_app_, set_menu_title(menu_title));
+ EXPECT_CALL(*mock_app_, set_menu_icon(menu_icon));
+ EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+ EXPECT_CALL(
+ mock_hmi_interfaces_,
+ GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
+ .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
+
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
+
+ command->Run();
+}
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/hmi_capabilities.json b/src/components/application_manager/test/hmi_capabilities.json
index 1c024f2669..afa5fa6056 100644
--- a/src/components/application_manager/test/hmi_capabilities.json
+++ b/src/components/application_manager/test/hmi_capabilities.json
@@ -355,11 +355,11 @@
"STATIC"
]
},
- "audioPassThruCapabilities": {
+ "audioPassThruCapabilities": [{
"samplingRate": "44KHZ",
"bitsPerSample": "RATE_8_BIT",
"audioType": "PCM"
- },
+ }],
"pcmStreamCapabilities": {
"samplingRate": "16KHZ",
"bitsPerSample": "RATE_16_BIT",
@@ -684,6 +684,12 @@
"upDownAvailable": true
},
{
+ "name": "PLAY_PAUSE",
+ "shortPressAvailable": true,
+ "longPressAvailable": true,
+ "upDownAvailable": true
+ },
+ {
"name": "SEEKLEFT",
"shortPressAvailable": true,
"longPressAvailable": true,
diff --git a/src/components/application_manager/test/hmi_capabilities_old_apt.json b/src/components/application_manager/test/hmi_capabilities_old_apt.json
new file mode 100644
index 0000000000..5a5af37e2f
--- /dev/null
+++ b/src/components/application_manager/test/hmi_capabilities_old_apt.json
@@ -0,0 +1,9 @@
+{
+ "UI": {
+ "audioPassThruCapabilities": {
+ "samplingRate": "22KHZ",
+ "bitsPerSample": "RATE_16_BIT",
+ "audioType": "PCM"
+ }
+ }
+}
diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc
index e1d2eeb402..6234830f50 100644
--- a/src/components/application_manager/test/hmi_capabilities_test.cc
+++ b/src/components/application_manager/test/hmi_capabilities_test.cc
@@ -36,39 +36,42 @@
#include <string>
#include "application_manager/hmi_capabilities.h"
-#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/mock_message_helper.h"
-#include "smart_objects/enum_schema_item.h"
+#include "gtest/gtest.h"
#include "interfaces/HMI_API.h"
-#include "utils/make_shared.h"
+#include "smart_objects/enum_schema_item.h"
+#include "smart_objects/smart_object.h"
+
#include "application_manager/hmi_capabilities_for_testing.h"
-#include "utils/file_system.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_rpc_service.h"
+#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/state_controller.h"
#include "resumption/last_state_impl.h"
-#include "application_manager/resumption/resume_ctrl.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "utils/file_system.h"
namespace test {
namespace components {
namespace application_manager_test {
using ::testing::_;
-using ::testing::Return;
-using ::testing::ReturnRef;
using ::testing::AtLeast;
-using ::testing::Invoke;
using ::testing::InSequence;
+using ::testing::Invoke;
+using ::testing::Return;
+using ::testing::ReturnRef;
using namespace application_manager;
class HMICapabilitiesTest : public ::testing::Test {
protected:
HMICapabilitiesTest()
- : last_state_("app_storage_folder", "app_info_data")
+ : last_state_wrapper_(std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>("app_storage_folder",
+ "app_info_storage")))
, file_name_("hmi_capabilities.json") {}
virtual void SetUp() OVERRIDE {
EXPECT_CALL(app_mngr_, event_dispatcher())
@@ -76,14 +79,15 @@ class HMICapabilitiesTest : public ::testing::Test {
EXPECT_CALL(app_mngr_, get_settings())
.WillRepeatedly(ReturnRef(mock_application_manager_settings_));
EXPECT_CALL(mock_application_manager_settings_,
- hmi_capabilities_file_name()).WillOnce(ReturnRef(file_name_));
+ hmi_capabilities_file_name())
+ .WillOnce(ReturnRef(file_name_));
EXPECT_CALL(mock_event_dispatcher, add_observer(_, _, _)).Times(1);
EXPECT_CALL(mock_event_dispatcher, remove_observer(_)).Times(1);
EXPECT_CALL(mock_application_manager_settings_, launch_hmi())
.WillOnce(Return(false));
hmi_capabilities_test =
- utils::MakeShared<HMICapabilitiesForTesting>(app_mngr_);
- hmi_capabilities_test->Init(&last_state_);
+ std::make_shared<HMICapabilitiesForTesting>(app_mngr_);
+ hmi_capabilities_test->Init(last_state_wrapper_);
}
void TearDown() OVERRIDE {
@@ -98,9 +102,9 @@ class HMICapabilitiesTest : public ::testing::Test {
void SetCooperating();
MockApplicationManager app_mngr_;
event_engine_test::MockEventDispatcher mock_event_dispatcher;
- resumption::LastStateImpl last_state_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
MockApplicationManagerSettings mock_application_manager_settings_;
- utils::SharedPtr<HMICapabilitiesForTesting> hmi_capabilities_test;
+ std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities_test;
const std::string file_name_;
application_manager_test::MockRPCService mock_rpc_service_;
};
@@ -140,9 +144,9 @@ struct CStringComparator {
}
};
-typedef std::map<const char*,
- hmi_apis::Common_Language::eType,
- CStringComparator> CStringToEnumMap;
+typedef std::
+ map<const char*, hmi_apis::Common_Language::eType, CStringComparator>
+ CStringToEnumMap;
CStringToEnumMap InitCStringToEnumMap() {
size_t value = sizeof(cstring_values_) / sizeof(cstring_values_[0]);
@@ -255,7 +259,7 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
// Count of buttons in json file
const uint32_t btn_length = buttons_capabilities_so.length();
- EXPECT_EQ(15u, btn_length);
+ EXPECT_EQ(16u, btn_length);
for (uint32_t i = 0; i < btn_length; ++i) {
EXPECT_TRUE((buttons_capabilities_so[i]).keyExists(strings::name));
EXPECT_TRUE((buttons_capabilities_so[i]).keyExists("shortPressAvailable"));
@@ -335,15 +339,18 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
// Check audio pass thru
const smart_objects::SmartObject audio_pass_thru_capabilities_so =
*(hmi_capabilities_test->audio_pass_thru_capabilities());
+ EXPECT_EQ(smart_objects::SmartType_Array,
+ audio_pass_thru_capabilities_so.getType());
+ EXPECT_EQ(1u, audio_pass_thru_capabilities_so.length());
EXPECT_EQ(hmi_apis::Common_SamplingRate::RATE_44KHZ,
static_cast<hmi_apis::Common_SamplingRate::eType>(
- audio_pass_thru_capabilities_so["samplingRate"].asInt()));
+ audio_pass_thru_capabilities_so[0]["samplingRate"].asInt()));
EXPECT_EQ(hmi_apis::Common_BitsPerSample::RATE_8_BIT,
static_cast<hmi_apis::Common_BitsPerSample::eType>(
- audio_pass_thru_capabilities_so["bitsPerSample"].asInt()));
+ audio_pass_thru_capabilities_so[0]["bitsPerSample"].asInt()));
EXPECT_EQ(hmi_apis::Common_AudioType::PCM,
static_cast<hmi_apis::Common_AudioType::eType>(
- audio_pass_thru_capabilities_so["audioType"].asInt()));
+ audio_pass_thru_capabilities_so[0]["audioType"].asInt()));
// Check hmi zone capabilities
const smart_objects::SmartObject hmi_zone_capabilities_so =
@@ -407,7 +414,8 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
.asInt());
EXPECT_EQ(350,
vs_capability_so[strings::preferred_resolution]
- [strings::resolution_height].asInt());
+ [strings::resolution_height]
+ .asInt());
EXPECT_TRUE(vs_capability_so.keyExists(strings::max_bitrate));
EXPECT_EQ(10000, vs_capability_so[strings::max_bitrate].asInt());
EXPECT_TRUE(vs_capability_so.keyExists(strings::supported_formats));
@@ -454,7 +462,8 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
rc_capability_so["climateControlCapabilities"][0]["fanSpeedAvailable"]
.asBool());
EXPECT_TRUE(rc_capability_so["climateControlCapabilities"][0]
- ["desiredTemperatureAvailable"].asBool());
+ ["desiredTemperatureAvailable"]
+ .asBool());
EXPECT_TRUE(
rc_capability_so["climateControlCapabilities"][0]["acEnableAvailable"]
.asBool());
@@ -506,9 +515,9 @@ TEST_F(HMICapabilitiesTest,
EXPECT_TRUE(::file_system::DeleteFile("./app_info_data"));
}
- utils::SharedPtr<HMICapabilitiesForTesting> hmi_capabilities =
- utils::MakeShared<HMICapabilitiesForTesting>(mock_app_mngr);
- hmi_capabilities->Init(&last_state_);
+ std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities =
+ std::make_shared<HMICapabilitiesForTesting>(mock_app_mngr);
+ hmi_capabilities->Init(last_state_wrapper_);
// Check system capabilities; only phone capability is available
EXPECT_FALSE(hmi_capabilities->navigation_supported());
@@ -546,9 +555,9 @@ TEST_F(HMICapabilitiesTest,
EXPECT_TRUE(::file_system::DeleteFile("./app_info_data"));
}
- utils::SharedPtr<HMICapabilitiesForTesting> hmi_capabilities =
- utils::MakeShared<HMICapabilitiesForTesting>(mock_app_mngr);
- hmi_capabilities->Init(&last_state_);
+ std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities =
+ std::make_shared<HMICapabilitiesForTesting>(mock_app_mngr);
+ hmi_capabilities->Init(last_state_wrapper_);
// Check system capabilities; only navigation capability is valid, the other
// two are empty
@@ -566,6 +575,59 @@ TEST_F(HMICapabilitiesTest,
EXPECT_FALSE(navigation_capability_so["getWayPointsEnabled"].asBool());
}
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFileAndVerifyOldAudioPassThruCapabilities) {
+ MockApplicationManager mock_app_mngr;
+ event_engine_test::MockEventDispatcher mock_dispatcher;
+ MockApplicationManagerSettings mock_application_manager_settings;
+
+ const std::string hmi_capabilities_file = "hmi_capabilities_old_apt.json";
+
+ EXPECT_CALL(mock_app_mngr, event_dispatcher())
+ .WillOnce(ReturnRef(mock_dispatcher));
+ EXPECT_CALL(mock_app_mngr, get_settings())
+ .WillRepeatedly(ReturnRef(mock_application_manager_settings));
+ EXPECT_CALL(mock_application_manager_settings, hmi_capabilities_file_name())
+ .WillOnce(ReturnRef(hmi_capabilities_file));
+ EXPECT_CALL(mock_dispatcher, add_observer(_, _, _)).Times(1);
+ EXPECT_CALL(mock_dispatcher, remove_observer(_)).Times(1);
+ EXPECT_CALL(mock_application_manager_settings, launch_hmi())
+ .WillOnce(Return(false));
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CommonLanguageFromString(_))
+ .WillRepeatedly(Invoke(TestCommonLanguageFromString));
+
+ if (file_system::FileExists("./app_info_data")) {
+ EXPECT_TRUE(::file_system::DeleteFile("./app_info_data"));
+ }
+
+ std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities =
+ std::make_shared<HMICapabilitiesForTesting>(mock_app_mngr);
+ hmi_capabilities->Init(last_state_wrapper_);
+
+ // with old audio pass thru format, the object is an array containing a single
+ // object
+ smart_objects::SmartObjectSPtr audio_pass_thru_capabilities_so =
+ hmi_capabilities->audio_pass_thru_capabilities();
+ EXPECT_EQ(smart_objects::SmartType_Array,
+ audio_pass_thru_capabilities_so->getType());
+ EXPECT_EQ(1u, audio_pass_thru_capabilities_so->length());
+ smart_objects::SmartObject& first_element =
+ (*audio_pass_thru_capabilities_so)[0];
+ EXPECT_TRUE(first_element.keyExists("samplingRate"));
+ EXPECT_EQ(hmi_apis::Common_SamplingRate::RATE_22KHZ,
+ static_cast<hmi_apis::Common_SamplingRate::eType>(
+ first_element["samplingRate"].asInt()));
+ EXPECT_TRUE(first_element.keyExists("bitsPerSample"));
+ EXPECT_EQ(hmi_apis::Common_BitsPerSample::RATE_16_BIT,
+ static_cast<hmi_apis::Common_BitsPerSample::eType>(
+ first_element["bitsPerSample"].asInt()));
+ EXPECT_TRUE(first_element.keyExists("audioType"));
+ EXPECT_EQ(hmi_apis::Common_AudioType::PCM,
+ static_cast<hmi_apis::Common_AudioType::eType>(
+ first_element["audioType"].asInt()));
+}
+
TEST_F(HMICapabilitiesTest, VerifyImageType) {
const int32_t image_type = 1;
smart_objects::SmartObject sm_obj;
@@ -582,8 +644,9 @@ TEST_F(HMICapabilitiesTest, VerifyImageType) {
void HMICapabilitiesTest::SetCooperating() {
smart_objects::SmartObjectSPtr test_so;
EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
- CreateModuleInfoSO(_, _)).WillRepeatedly(Return(test_so));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ CreateModuleInfoSO(_, _))
+ .WillRepeatedly(Return(test_so));
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillRepeatedly(Return(true));
}
diff --git a/src/components/application_manager/test/hmi_language_handler_test.cc b/src/components/application_manager/test/hmi_language_handler_test.cc
index 9b8bddc6bc..59913b19be 100644
--- a/src/components/application_manager/test/hmi_language_handler_test.cc
+++ b/src/components/application_manager/test/hmi_language_handler_test.cc
@@ -32,21 +32,21 @@
#include <stdint.h>
-#include "gtest/gtest.h"
#include "application_manager/application_manager.h"
#include "application_manager/hmi_language_handler.h"
-#include "application_manager/state_controller.h"
+#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/mock_message_helper.h"
-#include "application_manager/resumption/resume_ctrl_impl.h"
#include "application_manager/mock_hmi_capabilities.h"
-#include "application_manager/mock_application.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_rpc_service.h"
+#include "application_manager/resumption/resume_ctrl_impl.h"
#include "application_manager/smart_object_keys.h"
+#include "application_manager/state_controller.h"
+#include "gtest/gtest.h"
+#include "resumption/last_state_wrapper_impl.h"
#include "test/resumption/mock_last_state.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
+
#include "utils/lock.h"
namespace test {
@@ -55,14 +55,13 @@ namespace hmi_language_handler {
namespace am = ::application_manager;
-using am::event_engine::Event;
using am::ApplicationSet;
-using ::utils::SharedPtr;
+using am::event_engine::Event;
+using ::testing::_;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
-using ::testing::_;
typedef NiceMock<
::test::components::application_manager_test::MockApplicationManager>
@@ -75,7 +74,7 @@ typedef NiceMock< ::test::components::event_engine_test::MockEventDispatcher>
typedef NiceMock<application_manager_test::MockApplication> MockApp;
typedef NiceMock<application_manager_test::MockRPCService> MockRPCService;
-typedef SharedPtr<MockApp> ApplicationSharedPtr;
+typedef std::shared_ptr<MockApp> ApplicationSharedPtr;
typedef am::HMILanguageHandler::Apps Apps;
namespace {
@@ -89,7 +88,7 @@ class HmiLanguageHandlerTest : public ::testing::Test {
EXPECT_CALL(app_manager_, event_dispatcher())
.WillOnce(ReturnRef(event_dispatcher_));
hmi_language_handler_ =
- ::utils::MakeShared<am::HMILanguageHandler>(app_manager_);
+ std::make_shared<am::HMILanguageHandler>(app_manager_);
}
void InitHMIActiveLanguages(hmi_apis::Common_Language::eType ui_language,
@@ -114,7 +113,7 @@ class HmiLanguageHandlerTest : public ::testing::Test {
ApplicationSharedPtr CreateMockApp(const uint32_t app_id,
bool expect_call = false) const {
- ApplicationSharedPtr app = ::utils::MakeShared<MockApp>();
+ ApplicationSharedPtr app = std::make_shared<MockApp>();
if (expect_call) {
EXPECT_CALL(*app, app_id()).WillRepeatedly(Return(app_id));
} else {
@@ -135,9 +134,8 @@ class HmiLanguageHandlerTest : public ::testing::Test {
MockApplicationManager app_manager_;
MockHMICapabilities hmi_capabilities_;
MockEventDispatcher event_dispatcher_;
- SharedPtr<am::HMILanguageHandler> hmi_language_handler_;
+ std::shared_ptr<am::HMILanguageHandler> hmi_language_handler_;
std::shared_ptr<sync_primitives::Lock> app_set_lock_;
- resumption_test::MockLastState last_state_;
MockRPCService mock_rpc_service_;
};
@@ -157,9 +155,12 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllLanguageIsReceivedAndSame_SUCCESS) {
// Set up `active_*_language` and
//`persisted_ui_language_` to be the same
+ auto mock_last_state = std::make_shared<resumption_test::MockLastState>();
+ std::shared_ptr<resumption::LastStateWrapperImpl> last_state_wrapper =
+ std::make_shared<resumption::LastStateWrapperImpl>(mock_last_state);
Json::Value dictionary = Json::Value();
- ON_CALL(last_state_, get_dictionary()).WillByDefault(ReturnRef(dictionary));
- hmi_language_handler_->Init(&last_state_);
+ ON_CALL(*mock_last_state, dictionary()).WillByDefault(Return(dictionary));
+ hmi_language_handler_->Init(last_state_wrapper);
InitHMICapabilitiesLanguages(hmi_apis::Common_Language::eType::EN_US,
hmi_apis::Common_Language::eType::EN_US,
hmi_apis::Common_Language::eType::EN_US);
@@ -317,7 +318,7 @@ TEST_F(HmiLanguageHandlerTest,
// Needed to call of `ManageMobileCommand` method
ON_CALL(*am::MockMessageHelper::message_helper_mock(),
GetOnAppInterfaceUnregisteredNotificationToMobile(_, _))
- .WillByDefault(Return(::utils::MakeShared<smart_objects::SmartObject>()));
+ .WillByDefault(Return(std::make_shared<smart_objects::SmartObject>()));
// Wait for `ManageMobileCommand` call twice.
// First time in `SendOnLanguageChangeToMobile`
diff --git a/src/components/application_manager/test/include/application_manager/commands/command_request_test.h b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h
index 05cb80c989..3a44d7b3ff 100644
--- a/src/components/application_manager/test/include/application_manager/commands/command_request_test.h
+++ b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h
@@ -36,12 +36,12 @@
#include <stdint.h>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
+
+#include "application_manager/commands/command_request_impl.h"
#include "application_manager/smart_object_keys.h"
#include "application_manager/test/include/application_manager/commands/commands_test.h"
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/test/include/application_manager/mock_event_dispatcher.h"
+#include "smart_objects/smart_object.h"
#include "application_manager/event_engine/event.h"
@@ -49,12 +49,12 @@ namespace test {
namespace components {
namespace commands_test {
+using ::test::components::event_engine_test::MockEventDispatcher;
using ::testing::_;
-using ::testing::Return;
-using ::testing::SaveArg;
using ::testing::DoAll;
using ::testing::NiceMock;
-using ::test::components::event_engine_test::MockEventDispatcher;
+using ::testing::Return;
+using ::testing::SaveArg;
namespace am = ::application_manager;
using am::commands::Command;
using am::commands::CommandRequestImpl;
@@ -105,7 +105,7 @@ class CommandRequestTest : public CommandsTest<kIsNice> {
MessageSharedPtr CatchHMICommandResult(CallableT delegate,
bool call_return = true) {
MessageSharedPtr result_msg;
- EXPECT_CALL(this->mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(this->mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result_msg), Return(call_return)));
delegate();
return result_msg;
diff --git a/src/components/application_manager/test/include/application_manager/commands/commands_test.h b/src/components/application_manager/test/include/application_manager/commands/commands_test.h
index ab392c5ba0..fdaef2c716 100644
--- a/src/components/application_manager/test/include/application_manager/commands/commands_test.h
+++ b/src/components/application_manager/test/include/application_manager/commands/commands_test.h
@@ -30,45 +30,44 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMANDS_TEST_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMANDS_TEST_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMANDS_TEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMANDS_TEST_H_
#include <stdint.h>
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
#include "application_manager/commands/command.h"
-#include "utils/make_shared.h"
+#include "smart_objects/smart_object.h"
+
#include "application_manager/mock_application_manager.h"
-#include "test/application_manager/mock_application_manager_settings.h"
-#include "application_manager/test/include/application_manager/mock_hmi_interface.h"
-#include "application_manager/test/include/application_manager/mock_application.h"
-#include "application_manager/test/include/application_manager/mock_message_helper.h"
-#include "application_manager/mock_rpc_service.h"
+#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_hmi_capabilities.h"
+#include "application_manager/mock_rpc_service.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/test/include/application_manager/mock_application.h"
+#include "application_manager/test/include/application_manager/mock_hmi_interface.h"
+#include "application_manager/test/include/application_manager/mock_message_helper.h"
+#include "test/application_manager/mock_application_manager_settings.h"
namespace test {
namespace components {
namespace commands_test {
namespace am = ::application_manager;
-using ::testing::ReturnRef;
-using ::testing::Return;
-using ::testing::NiceMock;
-using ::testing::Mock;
using ::testing::_;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
-using ::utils::SharedPtr;
-using ::smart_objects::SmartObject;
+using am::ApplicationSharedPtr;
+using am::MockMessageHelper;
using am::commands::MessageSharedPtr;
+using ::smart_objects::SmartObject;
+using ::test::components::application_manager_test::MockApplication;
using ::test::components::application_manager_test::MockApplicationManager;
using ::test::components::application_manager_test::
MockApplicationManagerSettings;
-using am::ApplicationSharedPtr;
-using am::MockMessageHelper;
-using ::test::components::application_manager_test::MockApplication;
// Depending on the value type will be selected
template <const bool kIf, class ThenT, class ElseT>
@@ -101,10 +100,9 @@ class CommandsTest : public ::testing::Test {
typedef typename TypeIf<kIsNice,
NiceMock<MockApplicationManager>,
MockApplicationManager>::Result MockAppManager;
- typedef typename TypeIf<kIsNice,
- NiceMock<MockApplication>,
- MockApplication>::Result MockApp;
- typedef SharedPtr<MockApp> MockAppPtr;
+ typedef typename TypeIf<kIsNice, NiceMock<MockApplication>, MockApplication>::
+ Result MockApp;
+ typedef std::shared_ptr<MockApp> MockAppPtr;
virtual ~CommandsTest() {
Mock::VerifyAndClearExpectations(&mock_message_helper_);
@@ -112,60 +110,65 @@ class CommandsTest : public ::testing::Test {
static MessageSharedPtr CreateMessage(
const smart_objects::SmartType type = smart_objects::SmartType_Null) {
- return ::utils::MakeShared<SmartObject>(type);
+ return std::make_shared<SmartObject>(type);
}
static MockAppPtr CreateMockApp() {
- return ::utils::MakeShared<MockApp>();
+ return std::make_shared<MockApp>();
}
template <class Command>
- SharedPtr<Command> CreateCommand(const uint32_t timeout,
- MessageSharedPtr& msg) {
+ std::shared_ptr<Command> CreateCommand(const uint32_t timeout,
+ MessageSharedPtr& msg) {
InitCommand(timeout);
- return ::utils::MakeShared<Command>((msg ? msg : msg = CreateMessage()),
- app_mngr_,
- mock_rpc_service_,
- mock_hmi_capabilities_,
- mock_policy_handler_);
+ return std::make_shared<Command>((msg ? msg : msg = CreateMessage()),
+ app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_);
}
template <class Command>
- SharedPtr<Command> CreateCommand(MessageSharedPtr& msg) {
+ std::shared_ptr<Command> CreateCommand(MessageSharedPtr& msg) {
return CreateCommand<Command>(kDefaultTimeout_, msg);
}
template <class Command>
- SharedPtr<Command> CreateCommand(const uint32_t timeout = kDefaultTimeout_) {
+ std::shared_ptr<Command> CreateCommand(
+ const uint32_t timeout = kDefaultTimeout_) {
InitCommand(timeout);
MessageSharedPtr msg = CreateMessage();
- return ::utils::MakeShared<Command>(msg,
- app_mngr_,
- mock_rpc_service_,
- mock_hmi_capabilities_,
- mock_policy_handler_);
+ return std::make_shared<Command>(msg,
+ app_mngr_,
+ mock_rpc_service_,
+ mock_hmi_capabilities_,
+ mock_policy_handler_);
}
enum { kDefaultTimeout_ = 100 };
MockAppManager app_mngr_;
MockRPCService mock_rpc_service_;
- application_manager_test::MockHMICapabilities mock_hmi_capabilities_;
- policy_test::MockPolicyHandlerInterface mock_policy_handler_;
+ testing::NiceMock<application_manager_test::MockHMICapabilities>
+ mock_hmi_capabilities_;
+ testing::NiceMock<policy_test::MockPolicyHandlerInterface>
+ mock_policy_handler_;
MockAppManagerSettings app_mngr_settings_;
MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_;
am::MockMessageHelper& mock_message_helper_;
protected:
virtual void InitCommand(const uint32_t& timeout) {
+ timeout_ = timeout;
ON_CALL(app_mngr_, get_settings())
.WillByDefault(ReturnRef(app_mngr_settings_));
ON_CALL(app_mngr_settings_, default_timeout())
- .WillByDefault(ReturnRef(timeout));
+ .WillByDefault(ReturnRef(timeout_));
}
CommandsTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
+ : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
+ , timeout_(0) {
ON_CALL(app_mngr_, hmi_interfaces())
.WillByDefault(ReturnRef(mock_hmi_interfaces_));
ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
@@ -179,11 +182,11 @@ class CommandsTest : public ::testing::Test {
void InitHMIToMobileResultConverter() {
namespace MobileResult = mobile_apis::Result;
namespace HMIResult = hmi_apis::Common_Result;
- auto link_hmi_to_mob_result =
- [this](HMIResult::eType hmi_result, MobileResult::eType mobile_result) {
- ON_CALL(mock_message_helper_, HMIToMobileResult(hmi_result))
- .WillByDefault(Return(mobile_result));
- };
+ auto link_hmi_to_mob_result = [this](HMIResult::eType hmi_result,
+ MobileResult::eType mobile_result) {
+ ON_CALL(mock_message_helper_, HMIToMobileResult(hmi_result))
+ .WillByDefault(Return(mobile_result));
+ };
link_hmi_to_mob_result(HMIResult::INVALID_ENUM, MobileResult::INVALID_ENUM);
link_hmi_to_mob_result(HMIResult::SUCCESS, MobileResult::SUCCESS);
link_hmi_to_mob_result(HMIResult::UNSUPPORTED_REQUEST,
@@ -223,20 +226,38 @@ class CommandsTest : public ::testing::Test {
MobileResult::DATA_NOT_AVAILABLE);
link_hmi_to_mob_result(HMIResult::READ_ONLY, MobileResult::READ_ONLY);
}
+
+ private:
+ uint32_t timeout_;
};
MATCHER_P(MobileResultCodeIs, result_code, "") {
- return result_code ==
- static_cast<mobile_apis::Result::eType>(
- (*arg)[application_manager::strings::msg_params]
- [application_manager::strings::result_code].asInt());
+ return result_code == static_cast<mobile_apis::Result::eType>(
+ (*arg)[application_manager::strings::msg_params]
+ [application_manager::strings::result_code]
+ .asInt());
}
MATCHER_P(HMIResultCodeIs, result_code, "") {
- return result_code ==
- static_cast<hmi_apis::FunctionID::eType>(
- (*arg)[application_manager::strings::params]
- [application_manager::strings::function_id].asInt());
+ return result_code == static_cast<hmi_apis::FunctionID::eType>(
+ (*arg)[application_manager::strings::params]
+ [application_manager::strings::function_id]
+ .asInt());
+}
+
+MATCHER_P3(
+ HMIMessageParametersAre, correlation_id, function_id, result_code, "") {
+ using namespace application_manager;
+
+ const bool corr_ids_eq =
+ correlation_id ==
+ (*arg)[strings::params][strings::correlation_id].asInt();
+ const bool func_ids_eq =
+ (*arg)[strings::params][strings::function_id].asInt() == function_id;
+ const bool res_codes_eq =
+ (*arg)[strings::params][hmi_response::code].asInt() == result_code;
+
+ return corr_ids_eq && func_ids_eq && res_codes_eq;
}
MATCHER_P3(MobileResponseIs, result_code, result_info, result_success, "") {
@@ -253,4 +274,4 @@ MATCHER_P3(MobileResponseIs, result_code, result_info, result_success, "") {
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMANDS_TEST_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMANDS_TEST_H_
diff --git a/src/components/application_manager/test/include/application_manager/mock_app_launch_data.h b/src/components/application_manager/test/include/application_manager/mock_app_launch_data.h
index 881ebb2575..9f50a73075 100644
--- a/src/components/application_manager/test/include/application_manager/mock_app_launch_data.h
+++ b/src/components/application_manager/test/include/application_manager/mock_app_launch_data.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APP_LAUNCH_DATA_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APP_LAUNCH_DATA_H_
-#include "gmock/gmock.h"
#include "application_manager/app_launch/app_launch_data.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
diff --git a/src/components/application_manager/test/include/application_manager/mock_app_service_manager.h b/src/components/application_manager/test/include/application_manager/mock_app_service_manager.h
new file mode 100644
index 0000000000..60d2f90297
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/mock_app_service_manager.h
@@ -0,0 +1,97 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the the copyright holders nor the names of their
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APP_SERVICE_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APP_SERVICE_MANAGER_H_
+
+#include <gmock/gmock.h>
+#include "application_manager/app_service_manager.h"
+#include "application_manager/commands/command.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/rpc_passing_handler.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+class MockAppServiceManager : public application_manager::AppServiceManager {
+ public:
+ MockAppServiceManager(application_manager::ApplicationManager& app_manager,
+ resumption::LastStateWrapperPtr last_state)
+ : application_manager::AppServiceManager(app_manager, last_state) {}
+ MOCK_METHOD3(
+ PublishAppService,
+ smart_objects::SmartObject(const smart_objects::SmartObject& manifest,
+ const bool mobile_service,
+ const uint32_t connection_key));
+ MOCK_METHOD1(UnpublishAppService, bool(const std::string service_id));
+ MOCK_METHOD1(UnpublishServices, void(const uint32_t connection_key));
+ MOCK_METHOD1(OnAppActivated,
+ void(application_manager::ApplicationConstSharedPtr app));
+ MOCK_METHOD1(SetDefaultService, bool(const std::string service_id));
+ MOCK_METHOD1(RemoveDefaultService, bool(const std::string service_id));
+ MOCK_METHOD1(ActivateAppService, bool(const std::string service_id));
+ MOCK_METHOD1(DeactivateAppService, bool(const std::string service_id));
+ MOCK_METHOD0(GetAllServiceRecords, std::vector<smart_objects::SmartObject>());
+ MOCK_METHOD0(GetActiveServices,
+ std::vector<application_manager::AppService>());
+ MOCK_METHOD4(GetProviderByType,
+ void(const std::string& service_type,
+ const bool mobile_consumer,
+ application_manager::ApplicationSharedPtr& app,
+ bool& hmi_service));
+ MOCK_METHOD4(GetProviderByID,
+ void(const std::string& service_id,
+ const bool mobile_consumer,
+ application_manager::ApplicationSharedPtr& app,
+ bool& hmi_service));
+ MOCK_METHOD1(
+ ActiveServiceForType,
+ application_manager::AppService*(const std::string service_type));
+ MOCK_METHOD1(
+ EmbeddedServiceForType,
+ application_manager::AppService*(const std::string service_type));
+ MOCK_METHOD1(FindServiceByID,
+ application_manager::AppService*(const std::string service_id));
+ MOCK_METHOD2(SetServicePublished,
+ void(const std::string service_id,
+ const bool service_published));
+ MOCK_METHOD1(UpdateNavigationCapabilities,
+ bool(smart_objects::SmartObject& out_params));
+ MOCK_METHOD0(GetRPCPassingHandler, application_manager::RPCPassingHandler&());
+};
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APP_SERVICE_MANAGER_H_
diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index c3dd58a114..7694c8b719 100644
--- a/src/components/application_manager/test/include/application_manager/mock_application.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application.h
@@ -1,43 +1,46 @@
/*
* Copyright (c) 2016, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APPLICATION_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APPLICATION_H_
#include <string>
-#include "gmock/gmock.h"
-#include "application_manager/application.h"
#include "application_manager/app_extension.h"
+#include "application_manager/application.h"
+#include "application_manager/display_capabilities_builder.h"
+#include "application_manager/hmi_state.h"
+#include "application_manager/usage_statistics.h"
+#include "gmock/gmock.h"
#include "smart_objects/smart_object.h"
#include "utils/custom_string.h"
-#include "application_manager/usage_statistics.h"
+#include "utils/semantic_version.h"
namespace test {
namespace components {
@@ -50,14 +53,13 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(curHash, const std::string&());
MOCK_METHOD0(UpdateHash, void());
- DEPRECATED MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool());
- DEPRECATED MOCK_METHOD1(set_flag_sending_hash_change_after_awake,
- void(bool flag));
MOCK_CONST_METHOD0(IsHashChangedDuringSuspend, bool());
MOCK_METHOD1(SetHashChangedDuringSuspend, void(const bool flag));
MOCK_CONST_METHOD0(is_application_data_changed, bool());
MOCK_METHOD1(set_is_application_data_changed,
void(bool state_application_data));
+ MOCK_CONST_METHOD0(is_app_data_resumption_allowed, bool());
+ MOCK_METHOD1(set_app_data_resumption_allowance, void(bool allowed));
MOCK_METHOD0(CloseActiveMessage, void());
MOCK_CONST_METHOD0(IsFullscreen, bool());
MOCK_METHOD0(ChangeSupportingAppHMIType, void());
@@ -84,8 +86,9 @@ class MockApplication : public ::application_manager::Application {
void(protocol_handler::ServiceType service_type));
MOCK_METHOD1(SuspendStreaming,
void(protocol_handler::ServiceType service_type));
- MOCK_METHOD1(WakeUpStreaming,
- void(protocol_handler::ServiceType service_type));
+ MOCK_METHOD2(WakeUpStreaming,
+ void(protocol_handler::ServiceType service_type,
+ uint32_t timer_len));
MOCK_CONST_METHOD0(is_voice_communication_supported, bool());
MOCK_METHOD1(set_voice_communication_supported,
void(bool is_voice_communication_supported));
@@ -99,25 +102,42 @@ class MockApplication : public ::application_manager::Application {
MOCK_METHOD1(set_folder_name, void(const std::string& folder_name));
MOCK_CONST_METHOD0(folder_name, const std::string());
MOCK_CONST_METHOD0(is_media_application, bool());
- MOCK_CONST_METHOD0(hmi_level, const mobile_apis::HMILevel::eType());
+ MOCK_CONST_METHOD1(hmi_level,
+ const mobile_apis::HMILevel::eType(
+ const application_manager::WindowID window_id));
MOCK_CONST_METHOD0(put_file_in_none_count, const uint32_t());
MOCK_CONST_METHOD0(delete_file_in_none_count, const uint32_t());
MOCK_CONST_METHOD0(list_files_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(system_context, const mobile_apis::SystemContext::eType());
+ MOCK_CONST_METHOD1(system_context,
+ const mobile_apis::SystemContext::eType(
+ const application_manager::WindowID window_id));
MOCK_CONST_METHOD0(audio_streaming_state,
const mobile_apis::AudioStreamingState::eType());
MOCK_CONST_METHOD0(video_streaming_state,
const mobile_apis::VideoStreamingState::eType());
MOCK_CONST_METHOD0(app_icon_path, const std::string&());
MOCK_CONST_METHOD0(device, connection_handler::DeviceHandle());
- MOCK_CONST_METHOD0(CurrentHmiState, const application_manager::HmiStatePtr());
- MOCK_CONST_METHOD0(RegularHmiState, const application_manager::HmiStatePtr());
- MOCK_CONST_METHOD0(PostponedHmiState,
- const application_manager::HmiStatePtr());
+ MOCK_CONST_METHOD0(secondary_device, connection_handler::DeviceHandle());
+ MOCK_CONST_METHOD1(CurrentHmiState,
+ const application_manager::HmiStatePtr(
+ const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD1(RegularHmiState,
+ const application_manager::HmiStatePtr(
+ const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD0(GetWindowIds, application_manager::WindowIds());
+ MOCK_CONST_METHOD0(GetWindowNames, application_manager::WindowNames());
+ MOCK_CONST_METHOD1(WindowIdExists,
+ bool(const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD0(IsAllowedToChangeAudioSource, bool());
+ MOCK_CONST_METHOD1(PostponedHmiState,
+ const application_manager::HmiStatePtr(
+ const application_manager::WindowID window_id));
MOCK_METHOD1(set_tts_properties_in_none, void(bool active));
MOCK_METHOD0(tts_properties_in_none, bool());
MOCK_METHOD1(set_tts_properties_in_full, void(bool active));
MOCK_METHOD0(tts_properties_in_full, bool());
+ MOCK_METHOD1(set_keep_context, void(bool keep_context));
+ MOCK_METHOD0(keep_context, bool());
MOCK_METHOD1(set_version,
void(const ::application_manager::Version& version));
MOCK_METHOD1(set_name, void(const custom_str::CustomString& name));
@@ -128,6 +148,8 @@ class MockApplication : public ::application_manager::Application {
MOCK_METHOD1(set_app_icon_path, bool(const std::string& file_name));
MOCK_METHOD1(set_app_allowed, void(const bool allowed));
MOCK_METHOD1(set_device, void(connection_handler::DeviceHandle device));
+ MOCK_METHOD1(set_secondary_device,
+ void(connection_handler::DeviceHandle secondary_device));
MOCK_CONST_METHOD0(get_grammar_id, uint32_t());
MOCK_METHOD1(set_grammar_id, void(uint32_t value));
MOCK_METHOD1(
@@ -137,6 +159,10 @@ class MockApplication : public ::application_manager::Application {
::protocol_handler::MajorProtocolVersion());
MOCK_METHOD1(set_is_resuming, void(bool));
MOCK_CONST_METHOD0(is_resuming, bool());
+ MOCK_METHOD1(set_deferred_resumption_hmi_level,
+ void(application_manager::mobile_api::HMILevel::eType level));
+ MOCK_CONST_METHOD0(deferred_resumption_hmi_level,
+ application_manager::mobile_api::HMILevel::eType());
MOCK_METHOD1(AddFile, bool(const ::application_manager::AppFile& file));
MOCK_CONST_METHOD0(getAppFiles, const ::application_manager::AppFilesMap&());
MOCK_METHOD1(UpdateFile, bool(const ::application_manager::AppFile& file));
@@ -155,14 +181,28 @@ class MockApplication : public ::application_manager::Application {
bool(mobile_apis::FunctionID::eType cmd_id,
::application_manager::TLimitSource source));
MOCK_METHOD0(usage_report, ::application_manager::UsageStatistics&());
- MOCK_METHOD1(SetInitialState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(SetRegularState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(SetPostponedState,
- void(::application_manager::HmiStatePtr state));
- MOCK_METHOD0(RemovePostponedState, void());
- MOCK_METHOD1(AddHMIState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(RemoveHMIState,
- void(::application_manager::HmiState::StateID state_id));
+ MOCK_METHOD0(help_prompt_manager,
+ ::application_manager::HelpPromptManager&());
+ MOCK_CONST_METHOD0(help_prompt_manager,
+ const ::application_manager::HelpPromptManager&());
+ MOCK_METHOD3(SetInitialState,
+ void(const application_manager::WindowID window_id,
+ const std::string& window_name,
+ application_manager::HmiStatePtr state));
+ MOCK_METHOD2(SetRegularState,
+ void(const application_manager::WindowID window_id,
+ application_manager::HmiStatePtr state));
+ MOCK_METHOD2(SetPostponedState,
+ void(const application_manager::WindowID window_id,
+ ::application_manager::HmiStatePtr state));
+ MOCK_METHOD1(RemovePostponedState,
+ void(const application_manager::WindowID window_id));
+ MOCK_METHOD2(AddHMIState,
+ void(const application_manager::WindowID window_id,
+ application_manager::HmiStatePtr state));
+ MOCK_METHOD2(RemoveHMIState,
+ void(const application_manager::WindowID window_id,
+ ::application_manager::HmiState::StateID state_id));
MOCK_METHOD2(SubscribeToSoftButtons,
void(int32_t cmd_id,
const ::application_manager::SoftButtonID& softbuttons_id));
@@ -180,6 +220,7 @@ class MockApplication : public ::application_manager::Application {
const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(language, const mobile_apis::Language::eType&());
MOCK_CONST_METHOD0(ui_language, const mobile_apis::Language::eType&());
+ MOCK_CONST_METHOD0(msg_version, const utils::SemanticVersion&());
MOCK_METHOD1(set_app_types,
void(const smart_objects::SmartObject& app_types));
MOCK_METHOD1(set_vr_synonyms,
@@ -192,6 +233,7 @@ class MockApplication : public ::application_manager::Application {
void(const mobile_apis::Language::eType& language));
MOCK_METHOD1(set_ui_language,
void(const mobile_apis::Language::eType& ui_language));
+ MOCK_METHOD1(set_msg_version, void(const utils::SemanticVersion& version));
// DynamicApplicationData methods
MOCK_CONST_METHOD0(help_prompt, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(timeout_prompt, const smart_objects::SmartObject*());
@@ -206,9 +248,35 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(day_color_scheme, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(night_color_scheme, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(display_layout, const std::string&());
+ MOCK_CONST_METHOD0(day_color_scheme, smart_objects::SmartObject());
+ MOCK_CONST_METHOD0(night_color_scheme, smart_objects::SmartObject());
+ MOCK_CONST_METHOD0(display_layout, std::string());
+ MOCK_CONST_METHOD0(display_capabilities, smart_objects::SmartObjectSPtr());
+ MOCK_CONST_METHOD1(display_capabilities,
+ smart_objects::SmartObjectSPtr(
+ const application_manager::WindowID window_id));
+
+ MOCK_METHOD2(set_window_layout,
+ void(const application_manager::WindowID window_id,
+ const std::string& layout));
+ MOCK_METHOD2(set_day_color_scheme,
+ void(const application_manager::WindowID window_id,
+ const smart_objects::SmartObject& color_scheme));
+ MOCK_METHOD2(set_night_color_scheme,
+ void(const application_manager::WindowID window_id,
+ const smart_objects::SmartObject& color_scheme));
+ MOCK_CONST_METHOD1(
+ window_layout,
+ std::string(const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD1(day_color_scheme,
+ smart_objects::SmartObject(
+ const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD1(night_color_scheme,
+ smart_objects::SmartObject(
+ const application_manager::WindowID window_id));
+ MOCK_METHOD1(set_display_capabilities,
+ void(const smart_objects::SmartObject& display_capabilities));
+
MOCK_METHOD1(load_global_properties,
void(const smart_objects::SmartObject& so));
MOCK_METHOD1(set_help_prompt,
@@ -302,9 +370,10 @@ class MockApplication : public ::application_manager::Application {
SwapMobileMessageQueue,
void(::application_manager::MobileMessageQueue& mobile_messages));
- MOCK_METHOD1(
+ MOCK_METHOD2(
set_system_context,
- void(const application_manager::mobile_api::SystemContext::eType&));
+ void(const application_manager::WindowID window_id,
+ const application_manager::mobile_api::SystemContext::eType&));
MOCK_METHOD1(
set_audio_streaming_state,
void(const application_manager::mobile_api::AudioStreamingState::eType&
@@ -315,9 +384,10 @@ class MockApplication : public ::application_manager::Application {
bool(smart_objects::SmartObject module));
MOCK_METHOD1(UnsubscribeFromInteriorVehicleData,
bool(smart_objects::SmartObject module));
- MOCK_METHOD1(
+ MOCK_METHOD2(
set_hmi_level,
- void(const application_manager::mobile_api::HMILevel::eType& hmi_level));
+ void(const application_manager::WindowID window_id,
+ const application_manager::mobile_api::HMILevel::eType& hmi_level));
MOCK_METHOD1(QueryInterface,
application_manager::AppExtensionPtr(
application_manager::AppExtensionUID uid));
@@ -328,6 +398,39 @@ class MockApplication : public ::application_manager::Application {
const std::list<application_manager::AppExtensionPtr>&());
MOCK_CONST_METHOD0(is_remote_control_supported, bool());
MOCK_METHOD1(set_remote_control_supported, void(const bool allow));
+ MOCK_CONST_METHOD0(cloud_app_endpoint, const std::string&());
+ MOCK_CONST_METHOD0(auth_token, const std::string&());
+ MOCK_CONST_METHOD0(cloud_app_transport_type, const std::string&());
+ MOCK_CONST_METHOD0(hybrid_app_preference,
+ const mobile_apis::HybridAppPreference::eType&());
+ MOCK_CONST_METHOD0(cloud_app_certificate, const std::string&());
+ MOCK_CONST_METHOD0(is_cloud_app, bool());
+ MOCK_METHOD1(set_cloud_app_endpoint, void(const std::string& endpoint));
+ MOCK_METHOD1(set_auth_token, void(const std::string& auth_token));
+ MOCK_METHOD1(set_cloud_app_transport_type,
+ void(const std::string& transport_type));
+ MOCK_METHOD1(set_hybrid_app_preference,
+ void(const mobile_apis::HybridAppPreference::eType&
+ hybrid_app_preference));
+ MOCK_METHOD1(set_cloud_app_certificate, void(const std::string& certificate));
+ MOCK_METHOD2(SetWindowInfo,
+ void(const ::application_manager::WindowID windowID,
+ const smart_objects::SmartObject& window_info));
+ MOCK_METHOD1(RemoveWindowInfo,
+ void((const ::application_manager::WindowID window_id)));
+ MOCK_CONST_METHOD0(window_optional_params_map,
+ DataAccessor< ::application_manager::WindowParamsMap>());
+ MOCK_METHOD0(display_capabilities_builder,
+ application_manager::DisplayCapabilitiesBuilder&());
+ MOCK_METHOD1(GetSoftButtonWindowID,
+ application_manager::WindowID(const uint32_t button_id));
+ MOCK_METHOD1(remove_window_capability,
+ void(const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD1(menu_layout_supported,
+ bool(const mobile_apis::MenuLayout::eType layout));
+ MOCK_METHOD1(set_user_location,
+ void(const smart_objects::SmartObject& user_location));
+ MOCK_CONST_METHOD0(get_user_location, const smart_objects::SmartObject&());
MOCK_METHOD1(SetSetupInProgress, void(bool in_progress));
MOCK_METHOD0(WaitForSetupDone, void());
diff --git a/src/components/application_manager/test/include/application_manager/mock_command_factory.h b/src/components/application_manager/test/include/application_manager/mock_command_factory.h
index a55183e341..c49b5e7ce2 100644
--- a/src/components/application_manager/test/include/application_manager/mock_command_factory.h
+++ b/src/components/application_manager/test/include/application_manager/mock_command_factory.h
@@ -37,7 +37,6 @@
#include "application_manager/command_factory.h"
#include "application_manager/commands/command.h"
#include "smart_objects/smart_object.h"
-#include "utils/shared_ptr.h"
namespace test {
namespace components {
@@ -53,9 +52,6 @@ class MockCommandFactory : public application_manager::CommandFactory {
IsAbleToProcess,
bool(const int32_t,
const application_manager::commands::Command::CommandSource));
-
- // const commands::MessageSharedPtr& message,
- // application_manager::commands::Command::CommandSource));
};
} // namespace application_manager_test
diff --git a/src/components/dbus/include/dbus/message_descriptions.h b/src/components/application_manager/test/include/application_manager/mock_command_holder.h
index a9e7a5e141..0391808126 100644
--- a/src/components/dbus/include/dbus/message_descriptions.h
+++ b/src/components/application_manager/test/include/application_manager/mock_command_holder.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2020, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,45 +29,32 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_DBUS_INCLUDE_DBUS_MESSAGE_DESCRIPTIONS_H_
-#define SRC_COMPONENTS_DBUS_INCLUDE_DBUS_MESSAGE_DESCRIPTIONS_H_
-
-#include <stdint.h>
-#include <stdlib.h>
-#include "interfaces/HMI_API.h"
-
-namespace ford_message_descriptions {
-
-enum ParameterType { Integer, Boolean, Float, String, Struct, Enum, Array };
-
-struct ParameterDescription {
- const char* name;
- const ParameterType type;
- const bool obligatory; // TODO (dchmerev@luxoft.com): rename to 'mandatory'
- // as in HMI API description
-};
-
-struct ArrayDescription {
- const ParameterDescription base;
- const ParameterDescription* element;
- const char* element_dbus_signature;
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_COMMAND_HOLDER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_COMMAND_HOLDER_H_
+#include "application_manager/command_holder.h"
+#include "gmock/gmock.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+class MockCommandHolder : public application_manager::CommandHolder {
+ public:
+ MOCK_METHOD4(
+ Suspend,
+ void(application_manager::ApplicationSharedPtr application,
+ application_manager::CommandHolder::CommandType type,
+ application_manager::commands::Command::CommandSource source,
+ smart_objects::SmartObjectSPtr command));
+ MOCK_METHOD2(Resume,
+ void(application_manager::ApplicationSharedPtr application,
+ application_manager::CommandHolder::CommandType type));
+ MOCK_METHOD1(Clear,
+ void(application_manager::ApplicationSharedPtr application));
};
-struct StructDescription {
- const ParameterDescription base;
- const ParameterDescription** parameters;
-};
-
-struct MessageDescription {
- const char* interface;
- const char* name;
- const hmi_apis::messageType::eType message_type;
- const hmi_apis::FunctionID::eType function_id;
- const ParameterDescription** parameters;
-};
-
-extern const MessageDescription* message_descriptions[];
-
-} // namespace ford_message_descriptions
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
-#endif // SRC_COMPONENTS_DBUS_INCLUDE_DBUS_MESSAGE_DESCRIPTIONS_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_COMMAND_HOLDER_H_
diff --git a/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h b/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h
index 916f4a69f0..b345f53c1c 100644
--- a/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h
+++ b/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h
@@ -37,6 +37,7 @@
#include "application_manager/event_engine/event.h"
#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/event_engine/event_observer.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
@@ -59,6 +60,26 @@ class MockEventDispatcher
MOCK_METHOD1(
remove_observer,
void(::application_manager::event_engine::EventObserver& observer));
+
+ MOCK_METHOD1(
+ raise_mobile_event,
+ void(const ::application_manager::event_engine::MobileEvent& event));
+ MOCK_METHOD3(
+ add_mobile_observer,
+ void(
+ const ::application_manager::event_engine::MobileEvent::MobileEventID&
+ event_id,
+ int32_t mobile_correlation_id,
+ ::application_manager::event_engine::EventObserver& observer));
+ MOCK_METHOD2(
+ remove_mobile_observer,
+ void(
+ const ::application_manager::event_engine::MobileEvent::MobileEventID&
+ event_id,
+ ::application_manager::event_engine::EventObserver& observer));
+ MOCK_METHOD1(
+ remove_mobile_observer,
+ void(::application_manager::event_engine::EventObserver& observer));
};
} // namespace event_engine_test
diff --git a/src/components/application_manager/test/include/application_manager/mock_event_observer.h b/src/components/application_manager/test/include/application_manager/mock_event_observer.h
index 8af31c1998..1357d67a65 100644
--- a/src/components/application_manager/test/include/application_manager/mock_event_observer.h
+++ b/src/components/application_manager/test/include/application_manager/mock_event_observer.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_EVENT_OBSERVER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_EVENT_OBSERVER_H_
-#include "application_manager/event_engine/event_observer.h"
#include "application_manager/event_engine/event.h"
+#include "application_manager/event_engine/event_observer.h"
#include "gmock/gmock.h"
namespace test {
@@ -49,6 +49,9 @@ class MockEventObserver
: application_manager::event_engine::EventObserver(event_dispatcher) {}
MOCK_METHOD1(on_event,
void(const application_manager::event_engine::Event& event));
+ MOCK_METHOD1(
+ on_event,
+ void(const application_manager::event_engine::MobileEvent& event));
};
} // namespace event_engine_test
diff --git a/src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h b/src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h
new file mode 100644
index 0000000000..b44345deff
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HELP_PROMPT_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HELP_PROMPT_MANAGER_H_
+#include "gmock/gmock.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+using namespace application_manager;
+
+class MockHelpPromptManager : public ::application_manager::HelpPromptManager {
+ public:
+ MockHelpPromptManager() {}
+ MOCK_METHOD3(OnVrCommandAdded,
+ void(uint32_t cmd_id,
+ const smart_objects::SmartObject& command,
+ const bool should_send_requests));
+ MOCK_METHOD2(OnVrCommandDeleted,
+ void(uint32_t cmd_id, const bool should_send_requests));
+ MOCK_METHOD2(OnSetGlobalPropertiesReceived,
+ void(const smart_objects::SmartObject& msg, bool is_response));
+ MOCK_CONST_METHOD0(GetSendingType, SendingType());
+};
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HELP_PROMPT_MANAGER_H_
diff --git a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
index 468bdbe5eb..7c163d78ad 100644
--- a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
+++ b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
@@ -99,55 +99,64 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
MOCK_METHOD1(set_tts_supported_languages,
void(const smart_objects::SmartObject& supported_languages));
- MOCK_CONST_METHOD0(display_capabilities, const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(display_capabilities,
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_display_capabilities,
void(const smart_objects::SmartObject& display_capabilities));
+ MOCK_CONST_METHOD0(system_display_capabilities,
+ const smart_objects::SmartObjectSPtr());
+ MOCK_METHOD1(set_system_display_capabilities,
+ void(const smart_objects::SmartObject& display_capabilities));
+
MOCK_CONST_METHOD0(hmi_zone_capabilities,
- const smart_objects::SmartObject*());
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_hmi_zone_capabilities,
void(const smart_objects::SmartObject& hmi_zone_capabilities));
MOCK_CONST_METHOD0(soft_button_capabilities,
- const smart_objects::SmartObject*());
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(
set_soft_button_capabilities,
void(const smart_objects::SmartObject& soft_button_capabilities));
- MOCK_CONST_METHOD0(button_capabilities, const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(button_capabilities,
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_button_capabilities,
void(const smart_objects::SmartObject& button_capabilities));
- MOCK_CONST_METHOD0(speech_capabilities, const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(speech_capabilities,
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_speech_capabilities,
void(const smart_objects::SmartObject& speech_capabilities));
- MOCK_CONST_METHOD0(vr_capabilities, const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(vr_capabilities, const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_vr_capabilities,
void(const smart_objects::SmartObject& vr_capabilities));
MOCK_CONST_METHOD0(audio_pass_thru_capabilities,
- const smart_objects::SmartObject*());
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(
set_audio_pass_thru_capabilities,
void(const smart_objects::SmartObject& audio_pass_thru_capabilities));
MOCK_CONST_METHOD0(pcm_stream_capabilities,
- const smart_objects::SmartObject*());
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_pcm_stream_capabilities,
void(const smart_objects::SmartObject& pcm_stream_capabilities));
MOCK_CONST_METHOD0(preset_bank_capabilities,
- const smart_objects::SmartObject*());
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(
set_preset_bank_capabilities,
void(const smart_objects::SmartObject& preset_bank_capabilities));
- MOCK_CONST_METHOD0(vehicle_type, const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(vehicle_type, const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_vehicle_type,
void(const smart_objects::SmartObject& vehicle_type));
- MOCK_CONST_METHOD0(prerecorded_speech, const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(prerecorded_speech,
+ const smart_objects::SmartObjectSPtr());
MOCK_METHOD1(set_prerecorded_speech,
void(const smart_objects::SmartObject& prerecorded_speech));
@@ -181,8 +190,17 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
MOCK_METHOD1(set_rc_capability,
void(const smart_objects::SmartObject& rc_capability));
+ MOCK_CONST_METHOD0(seat_location_capability,
+ const smart_objects::SmartObject*());
+ MOCK_METHOD1(
+ set_seat_location_capability,
+ void(const smart_objects::SmartObject& seat_location_capability));
+
+ DEPRECATED
MOCK_METHOD1(Init, void(resumption::LastState* last_state));
+ MOCK_METHOD1(Init, void(resumption::LastStateWrapperPtr last_state_wrapper));
+
MOCK_CONST_METHOD0(ccpu_version, const std::string&());
MOCK_METHOD1(set_ccpu_version, void(const std::string& ccpu_version));
MOCK_METHOD0(get_hmi_language_handler,
@@ -198,6 +216,9 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
MOCK_CONST_METHOD2(convert_json_languages_to_obj,
void(const Json::Value& json_languages,
smart_objects::SmartObject& languages));
+ MOCK_CONST_METHOD2(convert_audio_capability_to_obj,
+ void(const Json::Value& capability,
+ smart_objects::SmartObject& output_so));
};
} // namespace application_manager_test
diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
index fe17eb6788..eb3c97bfff 100644
--- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h
+++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
@@ -32,13 +32,14 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_MESSAGE_HELPER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_MESSAGE_HELPER_H_
-#include "gmock/gmock.h"
#include "application_manager/application.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/hmi_capabilities.h"
#include "application_manager/message_helper.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "gmock/gmock.h"
#include "interfaces/HMI_API.h"
#include "policy/policy_types.h"
-#include "application_manager/policies/policy_handler_interface.h"
-#include "application_manager/application_manager.h"
#include "smart_objects/smart_object.h"
#include "transport_manager/common.h"
@@ -46,6 +47,12 @@ namespace application_manager {
class MockMessageHelper {
public:
+ MOCK_METHOD2(CreateNotification,
+ smart_objects::SmartObjectSPtr(mobile_apis::FunctionID::eType,
+ uint32_t));
+ MOCK_METHOD1(CreateHMINotification,
+ smart_objects::SmartObjectSPtr(hmi_apis::FunctionID::eType));
+
MOCK_METHOD1(GetHashUpdateNotification,
smart_objects::SmartObjectSPtr(const uint32_t app_id));
MOCK_METHOD2(SendHashUpdateNotification,
@@ -122,8 +129,9 @@ class MockMessageHelper {
MOCK_METHOD2(CreateMessageForHMI,
smart_objects::SmartObjectSPtr(hmi_apis::messageType::eType,
const uint32_t));
- MOCK_METHOD2(SendHMIStatusNotification,
- void(const Application& application_impl,
+ MOCK_METHOD3(SendHMIStatusNotification,
+ void(ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager));
MOCK_METHOD4(SendPolicyUpdate,
void(const std::string& file_path,
@@ -147,10 +155,11 @@ class MockMessageHelper {
uint32_t correlation_id,
ApplicationManager& app_mngr));
#endif // #ifdef EXTERNAL_PROPRIETARY_MODE
- MOCK_METHOD3(SendOnPermissionsChangeNotification,
+ MOCK_METHOD4(SendOnPermissionsChangeNotification,
void(uint32_t connection_key,
const policy::Permissions& permissions,
- ApplicationManager& app_mngr));
+ ApplicationManager& app_mngr,
+ const bool require_encryption));
MOCK_METHOD4(SendPolicySnapshotNotification,
void(uint32_t connection_key,
const std::vector<uint8_t>& policy_data,
@@ -158,8 +167,12 @@ class MockMessageHelper {
ApplicationManager& app_mngr));
MOCK_METHOD1(CommonLanguageFromString,
hmi_apis::Common_Language::eType(const std::string& language));
+ MOCK_METHOD1(CommonLightNameFromString,
+ hmi_apis::Common_LightName::eType(const std::string& lightName));
MOCK_METHOD1(CommonLanguageToString,
std::string(hmi_apis::Common_Language::eType));
+ MOCK_METHOD1(MobileLanguageToString,
+ std::string(mobile_apis::Language::eType));
MOCK_METHOD2(CreateModuleInfoSO,
smart_objects::SmartObjectSPtr(uint32_t function_id,
ApplicationManager& app_mngr));
@@ -189,17 +202,22 @@ class MockMessageHelper {
mobile_apis::Result::eType(smart_objects::SmartObject& message,
ApplicationConstSharedPtr app,
ApplicationManager& app_mngr));
+ MOCK_METHOD1(CheckChoiceSetVRCommands,
+ MessageHelper::ChoiceSetVRCommandsStatus(
+ const smart_objects::SmartObject&));
- MOCK_METHOD6(GetBCActivateAppRequestToHMI,
+ MOCK_METHOD5(GetBCActivateAppRequestToHMI,
smart_objects::SmartObjectSPtr(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr));
+ MOCK_METHOD2(GetBCCloseApplicationRequestToHMI,
+ smart_objects::SmartObjectSPtr(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
MOCK_METHOD2(GetOnAppInterfaceUnregisteredNotificationToMobile,
- NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr(
+ ns_smart_device_link::ns_smart_objects::SmartObjectSPtr(
int32_t connection_key,
mobile_apis::AppInterfaceUnregisteredReason::eType reason));
MOCK_METHOD4(ProcessSoftButtons,
@@ -208,6 +226,11 @@ class MockMessageHelper {
ApplicationConstSharedPtr app,
const policy::PolicyHandlerInterface& policy_handler,
ApplicationManager& app_mngr));
+ MOCK_METHOD4(SubscribeApplicationToSoftButton,
+ void(smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id,
+ const application_manager::WindowID window_id));
MOCK_METHOD3(SubscribeApplicationToSoftButton,
void(smart_objects::SmartObject& message_params,
ApplicationSharedPtr app,
@@ -230,6 +253,12 @@ class MockMessageHelper {
MOCK_METHOD2(SendUIChangeRegistrationRequestToHMI,
void(ApplicationConstSharedPtr app,
ApplicationManager& app_mngr));
+ MOCK_METHOD5(CreateDeviceInfo,
+ bool(connection_handler::DeviceHandle device_handle,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ ApplicationManager& app_mngr,
+ smart_objects::SmartObject* output));
MOCK_METHOD5(CreateHMIApplicationStruct,
bool(ApplicationConstSharedPtr app,
const protocol_handler::SessionObserver& session_observer,
@@ -240,6 +269,9 @@ class MockMessageHelper {
void(ApplicationConstSharedPtr app,
const bool is_unexpected_disconnect,
ApplicationManager& app_mngr));
+ MOCK_METHOD2(CreateOnAppPropertiesChangeNotification,
+ smart_objects::SmartObjectSPtr(const std::string& policy_app_id,
+ ApplicationManager& app_mngr));
MOCK_METHOD4(SendLaunchApp,
void(const uint32_t connection_key,
const std::string& urlSchema,
@@ -261,6 +293,10 @@ class MockMessageHelper {
MOCK_METHOD1(PrintSmartObject,
bool(const smart_objects::SmartObject& object));
+
+ MOCK_METHOD1(ExtractWindowIdFromSmartObject,
+ WindowID(const smart_objects::SmartObject& s_map));
+
MOCK_METHOD3(SendTTSGlobalProperties,
void(ApplicationSharedPtr app,
const bool default_help_prompt,
@@ -293,6 +329,28 @@ class MockMessageHelper {
void(mobile_apis::ButtonName::eType button,
ApplicationSharedPtr application,
ApplicationManager& app_mngr));
+ MOCK_METHOD1(CreateAppServiceCapabilities,
+ smart_objects::SmartObject(
+ std::vector<smart_objects::SmartObject>& all_services));
+ MOCK_METHOD2(BroadcastCapabilityUpdate,
+ void(smart_objects::SmartObject& msg_params,
+ ApplicationManager& app_mngr));
+ MOCK_METHOD3(CreateUICreateWindowRequestsToHMI,
+ smart_objects::SmartObjectList(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_manager,
+ const smart_objects::SmartObject& windows_info));
+ MOCK_METHOD2(
+ CreateDisplayCapabilityUpdateToMobile,
+ smart_objects::SmartObjectSPtr(const smart_objects::SmartObject&,
+ application_manager::Application&));
+ MOCK_METHOD4(CreateOnServiceUpdateNotification,
+ smart_objects::SmartObjectSPtr(
+ const hmi_apis::Common_ServiceType::eType service_type,
+ const hmi_apis::Common_ServiceEvent::eType service_event,
+ const hmi_apis::Common_ServiceStatusUpdateReason::eType
+ service_update_reason,
+ const uint32_t app_id));
static MockMessageHelper* message_helper_mock();
};
diff --git a/src/components/application_manager/test/include/application_manager/mock_request.h b/src/components/application_manager/test/include/application_manager/mock_request.h
index e4cfa84841..77b5bb7c38 100644
--- a/src/components/application_manager/test/include/application_manager/mock_request.h
+++ b/src/components/application_manager/test/include/application_manager/mock_request.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_REQUEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_REQUEST_H_
-#include "gmock/gmock.h"
#include "application_manager/commands/command.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
@@ -55,6 +55,7 @@ class MockRequest : public application_manager::commands::Command {
MOCK_METHOD0(CleanUp, bool());
MOCK_CONST_METHOD0(default_timeout, uint32_t());
MOCK_CONST_METHOD0(function_id, int32_t());
+ MOCK_CONST_METHOD0(window_id, application_manager::WindowID());
MOCK_METHOD0(onTimeOut, void());
MOCK_METHOD0(AllowedToTerminate, bool());
MOCK_METHOD1(SetAllowedToTerminate, void(bool is_allowed));
diff --git a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
index fb264b7d82..3935ab7924 100644
--- a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
+++ b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
@@ -31,10 +31,10 @@
*/
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RESUME_CTRL_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RESUME_CTRL_H_
-#include "gmock/gmock.h"
-#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/application.h"
-#include "resumption/last_state.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "gmock/gmock.h"
+#include "resumption/last_state_wrapper.h"
namespace test {
namespace components {
@@ -50,13 +50,21 @@ class MockResumeCtrl : public resumption::ResumeCtrl {
MOCK_METHOD0(OnSuspend, void());
MOCK_METHOD0(OnIgnitionOff, void());
MOCK_METHOD0(OnAwake, void());
+ MOCK_CONST_METHOD0(LowVoltageTime, time_t());
+ MOCK_CONST_METHOD0(WakeUpTime, time_t());
+ MOCK_METHOD0(SaveLowVoltageTime, void());
+ MOCK_METHOD0(SaveWakeUpTime, void());
+ MOCK_METHOD0(ResetLowVoltageTime, void());
+ MOCK_METHOD0(ResetWakeUpTime, void());
MOCK_CONST_METHOD0(is_suspended, bool());
MOCK_METHOD0(StopSavePersistentDataTimer, void());
+ MOCK_METHOD0(StartSavePersistentDataTimer, void());
MOCK_METHOD2(StartResumption,
bool(app_mngr::ApplicationSharedPtr application,
const std::string& hash));
MOCK_METHOD1(StartResumptionOnlyHMILevel,
bool(app_mngr::ApplicationSharedPtr application));
+ MOCK_METHOD1(RetryResumption, void(const uint32_t app_id));
MOCK_METHOD1(CheckPersistenceFilesForResumption,
bool(app_mngr::ApplicationSharedPtr application));
MOCK_METHOD2(CheckApplicationHash,
@@ -74,7 +82,9 @@ class MockResumeCtrl : public resumption::ResumeCtrl {
MOCK_METHOD1(OnAppActivated,
void(app_mngr::ApplicationSharedPtr application));
MOCK_METHOD1(RemoveFromResumption, void(uint32_t app_id));
+ DEPRECATED
MOCK_METHOD1(Init, bool(resumption::LastState& last_state));
+ MOCK_METHOD1(Init, bool(resumption::LastStateWrapperPtr last_state));
MOCK_METHOD2(OnAppRegistrationStart,
void(const std::string& policy_app_id,
const std::string& device_id));
@@ -86,16 +96,27 @@ class MockResumeCtrl : public resumption::ResumeCtrl {
MOCK_METHOD1(SetupDefaultHMILevel,
bool(application_manager::ApplicationSharedPtr application));
MOCK_METHOD1(StartAppHmiStateResumption,
- void(application_manager::ApplicationSharedPtr application));
+ bool(application_manager::ApplicationSharedPtr application));
MOCK_METHOD3(SetAppHMIState,
bool(application_manager::ApplicationSharedPtr application,
const mobile_apis::HMILevel::eType hmi_level,
bool check_policy));
MOCK_CONST_METHOD0(LaunchTime, time_t());
+ MOCK_METHOD2(RestoreAppWidgets,
+ size_t(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app));
+
+ MOCK_METHOD1(RestoreWidgetsHMIState,
+ void(const smart_objects::SmartObject& response_message));
+
+ MOCK_METHOD1(StartWaitingForDisplayCapabilitiesUpdate,
+ void(application_manager::ApplicationSharedPtr application));
+
#ifdef BUILD_TESTS
MOCK_METHOD1(set_resumption_storage,
- void(utils::SharedPtr<resumption::ResumptionData> mock_storage));
+ void(std::shared_ptr<resumption::ResumptionData> mock_storage));
+ MOCK_CONST_METHOD0(get_resumption_active, bool());
#endif // BUILD_TESTS
};
diff --git a/src/components/application_manager/test/include/application_manager/mock_resumption_data.h b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
index cfec034653..7cabc12086 100644
--- a/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
+++ b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
@@ -1,42 +1,42 @@
/*
-* Copyright (c) 2016, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RESUMPTION_DATA_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RESUMPTION_DATA_H_
#include <string>
-#include "gmock/gmock.h"
-#include "application_manager/resumption/resumption_data.h"
#include "application_manager/application.h"
-#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/resumption/resumption_data.h"
+#include "gmock/gmock.h"
#include "smart_objects/smart_object.h"
namespace test {
@@ -66,6 +66,10 @@ class MockResumptionData : public ::resumption::ResumptionData {
const std::string& device_id,
std::string& hash_id));
MOCK_METHOD0(OnAwake, void());
+ MOCK_METHOD0(IncrementGlobalIgnOnCounter, void());
+ MOCK_CONST_METHOD0(GetGlobalIgnOnCounter, uint32_t());
+ MOCK_METHOD0(ResetGlobalIgnOnCount, void());
+
MOCK_METHOD0(DecrementIgnOffCount, void());
MOCK_CONST_METHOD3(GetSavedApplication,
bool(const std::string& policy_app_id,
diff --git a/src/components/application_manager/test/include/application_manager/mock_rpc_protection_manager.h b/src/components/application_manager/test/include/application_manager/mock_rpc_protection_manager.h
new file mode 100644
index 0000000000..112de0fea5
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/mock_rpc_protection_manager.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RPC_PROTECTION_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RPC_PROTECTION_MANAGER_H_
+
+#include "application_manager/rpc_protection_manager.h"
+#include "gmock/gmock.h"
+
+namespace application_manager {
+class MockRPCProtectionManager : public RPCProtectionManager {
+ public:
+ MOCK_CONST_METHOD3(CheckPolicyEncryptionFlag,
+ bool(const uint32_t function_id,
+ const ApplicationSharedPtr app,
+ const bool is_rpc_service_secure));
+
+ MOCK_METHOD3(CreateEncryptionNeededResponse,
+ std::shared_ptr<smart_objects::SmartObject>(
+ const uint32_t connection_key,
+ const uint32_t function_id,
+ const uint32_t conrrelation_id));
+
+ MOCK_CONST_METHOD2(IsInEncryptionNeededCache,
+ bool(const uint32_t app_id,
+ const uint32_t conrrelation_id));
+
+ MOCK_METHOD2(AddToEncryptionNeededCache,
+ void(const uint32_t app_id, const uint32_t correlation_id));
+
+ MOCK_METHOD2(RemoveFromEncryptionNeededCache,
+ void(const uint32_t app_id, const uint32_t correlation_id));
+};
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_RPC_PROTECTION_MANAGER_H_
diff --git a/src/components/application_manager/test/include/application_manager/mock_rpc_protection_mediator.h b/src/components/application_manager/test/include/application_manager/mock_rpc_protection_mediator.h
new file mode 100644
index 0000000000..858673e3b3
--- /dev/null
+++ b/src/components/application_manager/test/include/application_manager/mock_rpc_protection_mediator.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "application_manager/rpc_protection_mediator.h"
+#include "gmock/gmock.h"
+
+namespace application_manager {
+class MockRPCProtectionMediator : public RPCProtectionMediator {
+ public:
+ MOCK_METHOD4(DoesRPCNeedEncryption,
+ bool(const uint32_t function_id,
+ std::shared_ptr<Application> app,
+ const uint32_t conrrelation_id,
+ const bool is_rpc_service_secure));
+ MOCK_METHOD1(DoesRPCNeedEncryption, bool(const uint32_t conrrelation_id));
+ MOCK_METHOD1(EncryptResponseByForce, void(const uint32_t conrrelation_id));
+ MOCK_METHOD3(CreateNegativeResponse,
+ std::shared_ptr<smart_objects::SmartObject>(
+ const uint32_t connection_key,
+ const uint32_t function_id,
+ const uint32_t conrrelation_id));
+};
+} // namespace application_manager
diff --git a/src/components/application_manager/test/include/application_manager/mock_telemetry_observer.h b/src/components/application_manager/test/include/application_manager/mock_telemetry_observer.h
index cd4632965c..c79a31817e 100644
--- a/src/components/application_manager/test/include/application_manager/mock_telemetry_observer.h
+++ b/src/components/application_manager/test/include/application_manager/mock_telemetry_observer.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_TELEMETRY_OBSERVER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_TELEMETRY_OBSERVER_H_
-#include "gmock/gmock.h"
#include "application_manager/telemetry_observer.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
diff --git a/src/components/application_manager/test/include/application_manager/resumption_data_test.h b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
index 0d34c113b2..e313427547 100644
--- a/src/components/application_manager/test/include/application_manager/resumption_data_test.h
+++ b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
@@ -33,20 +33,20 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_RESUMPTION_DATA_TEST_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_RESUMPTION_DATA_TEST_H_
-#include <string>
#include <algorithm>
-#include "gtest/gtest.h"
-#include "application_manager/usage_statistics.h"
+#include <string>
+#include "application_manager/event_engine/event_dispatcher.h"
+#include "application_manager/mock_app_extension.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_app_extension.h"
-#include "utils/data_accessor.h"
-#include "config_profile/profile.h"
+#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/policies/policy_handler.h"
-#include "application_manager/state_controller.h"
#include "application_manager/resumption/resume_ctrl.h"
-#include "application_manager/event_engine/event_dispatcher.h"
-#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/state_controller.h"
+#include "application_manager/usage_statistics.h"
+#include "config_profile/profile.h"
+#include "gtest/gtest.h"
+#include "utils/data_accessor.h"
namespace test {
namespace components {
@@ -74,12 +74,14 @@ class ResumptionDataTest : public ::testing::Test {
, comlock_ptr_(std::make_shared<sync_primitives::Lock>())
, setlock_ptr_(std::make_shared<sync_primitives::Lock>())
, btnlock_ptr_(std::make_shared<sync_primitives::Lock>())
- , ivilock_ptr_(std::make_shared<sync_primitives::Lock>()) {}
+ , ivilock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , window_params_map_lock_ptr_(std::make_shared<sync_primitives::Lock>()) {
+ }
// Check structure in saved application
void CheckSavedApp(sm::SmartObject& saved_data);
// Set data for resumption
virtual void PrepareData();
- utils::SharedPtr<NiceMock<application_manager_test::MockApplication> >
+ std::shared_ptr<NiceMock<application_manager_test::MockApplication> >
app_mock;
profile::Profile profile_;
@@ -114,6 +116,9 @@ class ResumptionDataTest : public ::testing::Test {
void SetHelpAndTimeoutPrompt();
void SetVRHelpTitle();
void SetSubscriptions();
+ void SetWindowsInfo();
+ void SetDefaultCurrentHmiState();
+ void SetDefaultWindowIds();
void CheckCommands(sm::SmartObject& res_list);
void CheckGlobalProporties(sm::SmartObject& res_list);
@@ -125,9 +130,11 @@ class ResumptionDataTest : public ::testing::Test {
void CheckMenuIcon(sm::SmartObject& res_list);
void CheckHelpPrompt(sm::SmartObject& res_list);
void CheckTimeoutPrompt(sm::SmartObject& res_list);
- void CheckVRHelp(NsSmartDeviceLink::NsSmartObjects::SmartObject& res_list);
+ void CheckVRHelp(
+ ns_smart_device_link::ns_smart_objects::SmartObject& res_list);
void CheckVRTitle(sm::SmartObject& res_list);
void CheckSubscriptions(sm::SmartObject& res_list);
+ void CheckWindowsInfo(sm::SmartObject& res_list);
const size_t kCountOfCommands_;
const size_t kCountOfChoice_;
@@ -144,15 +151,18 @@ class ResumptionDataTest : public ::testing::Test {
am::ButtonSubscriptions btn_subscr;
+ am::WindowParamsMap test_window_params_map_;
+
std::shared_ptr<sync_primitives::Lock> sublock_ptr_;
std::shared_ptr<sync_primitives::Lock> comlock_ptr_;
std::shared_ptr<sync_primitives::Lock> setlock_ptr_;
std::shared_ptr<sync_primitives::Lock> btnlock_ptr_;
std::shared_ptr<sync_primitives::Lock> ivilock_ptr_;
+ std::shared_ptr<sync_primitives::Lock> window_params_map_lock_ptr_;
application_manager_test::MockApplicationManagerSettings
mock_application_manager_settings_;
application_manager_test::MockApplicationManager mock_application_manager_;
- utils::SharedPtr<NiceMock<application_manager_test::MockAppExtension> >
+ std::shared_ptr<NiceMock<application_manager_test::MockAppExtension> >
mock_app_extension_;
std::list<application_manager::AppExtensionPtr> extensions_;
};
diff --git a/src/components/application_manager/test/include/application_manager/test_resumption_data_db.h b/src/components/application_manager/test/include/application_manager/test_resumption_data_db.h
index e10f60afac..3f5802cb5a 100644
--- a/src/components/application_manager/test/include/application_manager/test_resumption_data_db.h
+++ b/src/components/application_manager/test/include/application_manager/test_resumption_data_db.h
@@ -33,10 +33,10 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_TEST_RESUMPTION_DATA_DB_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_TEST_RESUMPTION_DATA_DB_H_
-#include "utils/sqlite_wrapper/sql_database.h"
-#include "application_manager/resumption/resumption_data_db.h"
-#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/resumption/resumption_data_db.h"
+#include "utils/sqlite_wrapper/sql_database.h"
using ::resumption::ResumptionDataDB;
diff --git a/src/components/application_manager/test/message_helper/CMakeLists.txt b/src/components/application_manager/test/message_helper/CMakeLists.txt
index d115ad8b40..31b175cbf0 100755
--- a/src/components/application_manager/test/message_helper/CMakeLists.txt
+++ b/src/components/application_manager/test/message_helper/CMakeLists.txt
@@ -40,6 +40,7 @@ set(LIBRARIES
ApplicationManager
MessageHelper
jsoncpp
+ PolicyStatic
connectionHandler
MediaManager
Resumption
diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc
index e43348cc80..f85c569bdb 100644
--- a/src/components/application_manager/test/message_helper/message_helper_test.cc
+++ b/src/components/application_manager/test/message_helper/message_helper_test.cc
@@ -35,18 +35,22 @@
#include "gmock/gmock.h"
#include "utils/macro.h"
-#include "utils/make_shared.h"
-#include "application_manager/policies/policy_handler.h"
+
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/mock_application.h"
-#include "utils/custom_string.h"
-#include "utils/lock.h"
-#include "policy/mock_policy_settings.h"
-#include "application_manager/policies/policy_handler.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_rpc_service.h"
-#include "application_manager/event_engine/event_dispatcher.h"
-#include "application_manager/state_controller.h"
+#include "application_manager/policies/policy_handler.h"
#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/state_controller.h"
+#include "policy/mock_policy_settings.h"
+#include "utils/custom_string.h"
+#include "utils/lock.h"
+
+#include "policy/policy_table/types.h"
+#include "rpc_base/rpc_base_json_inl.h"
#ifdef EXTERNAL_PROPRIETARY_MODE
#include "policy/policy_external/include/policy/policy_types.h"
@@ -62,16 +66,16 @@ namespace MobileResults = mobile_apis::Result;
using namespace application_manager;
-typedef utils::SharedPtr<MockApplication> MockApplicationSharedPtr;
+typedef std::shared_ptr<MockApplication> MockApplicationSharedPtr;
typedef std::vector<std::string> StringArray;
-typedef utils::SharedPtr<application_manager::Application> ApplicationSharedPtr;
+typedef std::shared_ptr<application_manager::Application> ApplicationSharedPtr;
+using testing::_;
using testing::AtLeast;
-using testing::ReturnRefOfCopy;
-using testing::ReturnRef;
using testing::Return;
+using testing::ReturnRef;
+using testing::ReturnRefOfCopy;
using testing::SaveArg;
-using testing::_;
TEST(MessageHelperTestCreate,
CreateBlockedByPoliciesResponse_SmartObject_Equal) {
@@ -86,7 +90,7 @@ TEST(MessageHelperTestCreate,
application_manager::MessageHelper::CreateBlockedByPoliciesResponse(
function_id, result, correlation_id, connection_key);
- EXPECT_TRUE(ptr);
+ EXPECT_TRUE((bool)ptr);
smart_objects::SmartObject& obj = *ptr;
@@ -108,7 +112,7 @@ TEST(MessageHelperTestCreate, CreateSetAppIcon_SendNullPathImagetype_Equal) {
smart_objects::SmartObjectSPtr ptr =
MessageHelper::CreateSetAppIcon(path_to_icon, app_id);
- EXPECT_TRUE(ptr);
+ EXPECT_TRUE((bool)ptr);
smart_objects::SmartObject& obj = *ptr;
@@ -127,7 +131,7 @@ TEST(MessageHelperTestCreate, CreateSetAppIcon_SendPathImagetype_Equal) {
smart_objects::SmartObjectSPtr ptr =
MessageHelper::CreateSetAppIcon(path_to_icon, app_id);
- EXPECT_TRUE(ptr);
+ EXPECT_TRUE((bool)ptr);
smart_objects::SmartObject& obj = *ptr;
@@ -142,12 +146,19 @@ TEST(MessageHelperTestCreate, CreateSetAppIcon_SendPathImagetype_Equal) {
TEST(MessageHelperTestCreate,
CreateGlobalPropertiesRequestsToHMI_SmartObject_EmptyList) {
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
EXPECT_CALL(*appSharedMock, vr_help_title()).Times(AtLeast(1));
EXPECT_CALL(*appSharedMock, vr_help()).Times(AtLeast(1));
EXPECT_CALL(*appSharedMock, help_prompt()).Times(AtLeast(1));
EXPECT_CALL(*appSharedMock, timeout_prompt()).Times(AtLeast(1));
+ std::shared_ptr<MockHelpPromptManager> mock_help_prompt_manager =
+ std::make_shared<MockHelpPromptManager>();
+ EXPECT_CALL(*appSharedMock, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager));
+ EXPECT_CALL(*mock_help_prompt_manager, GetSendingType())
+ .WillRepeatedly(Return(HelpPromptManager::SendingType::kSendBoth));
+
smart_objects::SmartObjectList ptr =
MessageHelper::CreateGlobalPropertiesRequestsToHMI(appSharedMock, 0u);
@@ -156,9 +167,9 @@ TEST(MessageHelperTestCreate,
TEST(MessageHelperTestCreate,
CreateGlobalPropertiesRequestsToHMI_SmartObject_NotEmpty) {
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
smart_objects::SmartObjectSPtr objPtr =
- MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*objPtr)[0][strings::vr_help_title] = "111";
(*objPtr)[1][strings::vr_help] = "222";
@@ -191,6 +202,13 @@ TEST(MessageHelperTestCreate,
.WillRepeatedly(Return(&(*objPtr)[4]));
EXPECT_CALL(*appSharedMock, app_id()).WillRepeatedly(Return(0));
+ std::shared_ptr<MockHelpPromptManager> mock_help_prompt_manager =
+ std::make_shared<MockHelpPromptManager>();
+ EXPECT_CALL(*appSharedMock, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager));
+ EXPECT_CALL(*mock_help_prompt_manager, GetSendingType())
+ .WillRepeatedly(Return(HelpPromptManager::SendingType::kSendBoth));
+
smart_objects::SmartObjectList ptr =
MessageHelper::CreateGlobalPropertiesRequestsToHMI(appSharedMock, 0u);
@@ -210,10 +228,10 @@ TEST(MessageHelperTestCreate,
}
TEST(MessageHelperTestCreate, CreateShowRequestToHMI_SendSmartObject_Equal) {
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
smart_objects::SmartObjectSPtr smartObjectPtr =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
const smart_objects::SmartObject& object = *smartObjectPtr;
@@ -236,10 +254,10 @@ TEST(MessageHelperTestCreate, CreateShowRequestToHMI_SendSmartObject_Equal) {
TEST(MessageHelperTestCreate,
CreateAddCommandRequestToHMI_SendSmartObject_Empty) {
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
::application_manager::CommandsMap vis;
DataAccessor<application_manager::CommandsMap> data_accessor(
- vis, std::make_shared<sync_primitives::Lock>(true));
+ vis, std::make_shared<sync_primitives::RecursiveLock>());
EXPECT_CALL(*appSharedMock, commands_map()).WillOnce(Return(data_accessor));
application_manager_test::MockApplicationManager mock_application_manager;
@@ -252,23 +270,30 @@ TEST(MessageHelperTestCreate,
TEST(MessageHelperTestCreate,
CreateAddCommandRequestToHMI_SendSmartObject_Equal) {
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
CommandsMap vis;
DataAccessor<CommandsMap> data_accessor(
- vis, std::make_shared<sync_primitives::Lock>(true));
+ vis, std::make_shared<sync_primitives::RecursiveLock>());
smart_objects::SmartObjectSPtr smartObjectPtr =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
smart_objects::SmartObject& object = *smartObjectPtr;
+ const uint32_t app_id = 1u;
+ const std::string cmd_icon_value = "10";
+ const uint32_t cmd_id = 5u;
+ const uint32_t internal_id = 1u;
+
object[strings::menu_params] = 1;
object[strings::cmd_icon] = 1;
- object[strings::cmd_icon][strings::value] = "10";
+ object[strings::cmd_icon][strings::value] = cmd_icon_value;
+ object[strings::cmd_id] = cmd_id;
- vis.insert(std::pair<uint32_t, smart_objects::SmartObject*>(5, &object));
+ vis.insert(
+ std::pair<uint32_t, smart_objects::SmartObject*>(internal_id, &object));
EXPECT_CALL(*appSharedMock, commands_map()).WillOnce(Return(data_accessor));
- EXPECT_CALL(*appSharedMock, app_id()).WillOnce(Return(1u));
+ EXPECT_CALL(*appSharedMock, app_id()).WillOnce(Return(app_id));
application_manager_test::MockApplicationManager mock_application_manager;
smart_objects::SmartObjectList ptr =
MessageHelper::CreateAddCommandRequestToHMI(appSharedMock,
@@ -281,23 +306,23 @@ TEST(MessageHelperTestCreate,
int function_id = static_cast<int>(hmi_apis::FunctionID::UI_AddCommand);
EXPECT_EQ(function_id, obj[strings::params][strings::function_id].asInt());
- EXPECT_EQ(1u, obj[strings::msg_params][strings::app_id].asUInt());
- EXPECT_EQ(5, obj[strings::msg_params][strings::cmd_id].asInt());
+ EXPECT_EQ(app_id, obj[strings::msg_params][strings::app_id].asUInt());
+ EXPECT_EQ(cmd_id, obj[strings::msg_params][strings::cmd_id].asUInt());
EXPECT_EQ(object[strings::menu_params],
obj[strings::msg_params][strings::menu_params]);
EXPECT_EQ(object[strings::cmd_icon],
obj[strings::msg_params][strings::cmd_icon]);
EXPECT_EQ(
- "10",
+ cmd_icon_value,
obj[strings::msg_params][strings::cmd_icon][strings::value].asString());
}
TEST(MessageHelperTestCreate,
CreateAddVRCommandRequestFromChoiceToHMI_SendEmptyData_EmptyList) {
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
application_manager::ChoiceSetMap vis;
DataAccessor< ::application_manager::ChoiceSetMap> data_accessor(
- vis, std::make_shared<sync_primitives::Lock>(true));
+ vis, std::make_shared<sync_primitives::RecursiveLock>());
EXPECT_CALL(*appSharedMock, choice_set_map()).WillOnce(Return(data_accessor));
application_manager_test::MockApplicationManager mock_application_manager;
@@ -310,12 +335,12 @@ TEST(MessageHelperTestCreate,
TEST(MessageHelperTestCreate,
CreateAddVRCommandRequestFromChoiceToHMI_SendObject_EqualList) {
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
application_manager::ChoiceSetMap vis;
DataAccessor< ::application_manager::ChoiceSetMap> data_accessor(
- vis, std::make_shared<sync_primitives::Lock>(true));
+ vis, std::make_shared<sync_primitives::RecursiveLock>());
smart_objects::SmartObjectSPtr smartObjectPtr =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
smart_objects::SmartObject& object = *smartObjectPtr;
@@ -357,12 +382,12 @@ TEST(MessageHelperTestCreate,
}
TEST(MessageHelperTestCreate, CreateAddSubMenuRequestToHMI_SendObject_Equal) {
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
application_manager::SubMenuMap vis;
DataAccessor< ::application_manager::SubMenuMap> data_accessor(
- vis, std::make_shared<sync_primitives::Lock>(true));
+ vis, std::make_shared<sync_primitives::RecursiveLock>());
smart_objects::SmartObjectSPtr smartObjectPtr =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
smart_objects::SmartObject& object = *smartObjectPtr;
@@ -397,10 +422,10 @@ TEST(MessageHelperTestCreate, CreateAddSubMenuRequestToHMI_SendObject_Equal) {
TEST(MessageHelperTestCreate,
CreateAddSubMenuRequestToHMI_SendEmptyMap_EmptySmartObjectList) {
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
application_manager::SubMenuMap vis;
DataAccessor< ::application_manager::SubMenuMap> data_accessor(
- vis, std::make_shared<sync_primitives::Lock>(true));
+ vis, std::make_shared<sync_primitives::RecursiveLock>());
EXPECT_CALL(*appSharedMock, sub_menu_map()).WillOnce(Return(data_accessor));
@@ -420,7 +445,7 @@ TEST(MessageHelperTestCreate, CreateNegativeResponse_SendSmartObject_Equal) {
smart_objects::SmartObjectSPtr ptr = MessageHelper::CreateNegativeResponse(
connection_key, function_id, correlation_id, result_code);
- EXPECT_TRUE(ptr);
+ EXPECT_TRUE((bool)ptr);
smart_objects::SmartObject& obj = *ptr;
@@ -700,7 +725,7 @@ TEST_F(MessageHelperTest, VerifySoftButtonString_WrongStrings_False) {
"soft_button1\\n",
"soft_button1\\t"};
for (size_t i = 0; i < wrong_strings.size(); ++i) {
- EXPECT_FALSE(MessageHelper::VerifySoftButtonString(wrong_strings[i]));
+ EXPECT_FALSE(MessageHelper::VerifyString(wrong_strings[i]));
}
}
@@ -711,14 +736,14 @@ TEST_F(MessageHelperTest, VerifySoftButtonString_CorrectStrings_True) {
"soft_button1??....asd",
"soft_button12313fcvzxc./.,"};
for (size_t i = 0; i < wrong_strings.size(); ++i) {
- EXPECT_TRUE(MessageHelper::VerifySoftButtonString(wrong_strings[i]));
+ EXPECT_TRUE(MessageHelper::VerifyString(wrong_strings[i]));
}
}
TEST_F(MessageHelperTest,
ProcessSoftButtons_SmartObjectWithoutButtonsKey_Success) {
- // Creating sharedPtr to MockApplication
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ // Creating std::shared_ptr to MockApplication
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
// Creating input data for method
smart_objects::SmartObject object;
policy_handler_test::MockPolicySettings policy_settings_;
@@ -733,8 +758,8 @@ TEST_F(MessageHelperTest,
TEST_F(MessageHelperTest,
ProcessSoftButtons_IncorectSoftButonValue_InvalidData) {
- // Creating sharedPtr to MockApplication
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ // Creating std::shared_ptr to MockApplication
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
// Creating input data for method
smart_objects::SmartObject object;
smart_objects::SmartObject& buttons = object[strings::soft_buttons];
@@ -751,11 +776,12 @@ TEST_F(MessageHelperTest,
}
TEST_F(MessageHelperTest, VerifyImage_ImageTypeIsStatic_Success) {
- // Creating sharedPtr to MockApplication
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ // Creating std::shared_ptr to MockApplication
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
// Creating input data for method
smart_objects::SmartObject image;
image[strings::image_type] = mobile_apis::ImageType::STATIC;
+ image[strings::value] = "static_icon";
// Method call
mobile_apis::Result::eType result = MessageHelper::VerifyImage(
image, appSharedMock, mock_application_manager);
@@ -764,8 +790,8 @@ TEST_F(MessageHelperTest, VerifyImage_ImageTypeIsStatic_Success) {
}
TEST_F(MessageHelperTest, VerifyImage_ImageValueNotValid_InvalidData) {
- // Creating sharedPtr to MockApplication
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ // Creating std::shared_ptr to MockApplication
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
// Creating input data for method
smart_objects::SmartObject image;
image[strings::image_type] = mobile_apis::ImageType::DYNAMIC;
@@ -779,42 +805,44 @@ TEST_F(MessageHelperTest, VerifyImage_ImageValueNotValid_InvalidData) {
}
TEST_F(MessageHelperTest, VerifyImageApplyPath_ImageTypeIsStatic_Success) {
- // Creating sharedPtr to MockApplication
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ // Creating std::shared_ptr to MockApplication
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
// Creating input data for method
smart_objects::SmartObject image;
image[strings::image_type] = mobile_apis::ImageType::STATIC;
image[strings::value] = "icon.png";
// Method call
- mobile_apis::Result::eType result = MessageHelper::VerifyImageApplyPath(
+ mobile_apis::Result::eType result = MessageHelper::VerifyImage(
image, appSharedMock, mock_application_manager);
- // EXPECT
EXPECT_EQ(mobile_apis::Result::SUCCESS, result);
+ // EXPECT
EXPECT_EQ("icon.png", image[strings::value].asString());
}
TEST_F(MessageHelperTest, VerifyImageApplyPath_ImageValueNotValid_InvalidData) {
- // Creating sharedPtr to MockApplication
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ // Creating std::shared_ptr to MockApplication
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
// Creating input data for method
smart_objects::SmartObject image;
image[strings::image_type] = mobile_apis::ImageType::DYNAMIC;
// Invalid value
image[strings::value] = " ";
// Method call
- mobile_apis::Result::eType result = MessageHelper::VerifyImageApplyPath(
+ mobile_apis::Result::eType result = MessageHelper::VerifyImage(
image, appSharedMock, mock_application_manager);
// EXPECT
EXPECT_EQ(mobile_apis::Result::INVALID_DATA, result);
}
TEST_F(MessageHelperTest, VerifyImageFiles_SmartObjectWithValidData_Success) {
- // Creating sharedPtr to MockApplication
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ // Creating std::shared_ptr to MockApplication
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
// Creating input data for method
smart_objects::SmartObject images;
images[0][strings::image_type] = mobile_apis::ImageType::STATIC;
images[1][strings::image_type] = mobile_apis::ImageType::STATIC;
+ images[0][strings::value] = "static_icon";
+ images[1][strings::value] = "static_icon";
// Method call
mobile_apis::Result::eType result = MessageHelper::VerifyImageFiles(
images, appSharedMock, mock_application_manager);
@@ -824,8 +852,8 @@ TEST_F(MessageHelperTest, VerifyImageFiles_SmartObjectWithValidData_Success) {
TEST_F(MessageHelperTest,
VerifyImageFiles_SmartObjectWithInvalidData_NotSuccsess) {
- // Creating sharedPtr to MockApplication
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ // Creating std::shared_ptr to MockApplication
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
// Creating input data for method
smart_objects::SmartObject images;
images[0][strings::image_type] = mobile_apis::ImageType::DYNAMIC;
@@ -842,14 +870,17 @@ TEST_F(MessageHelperTest,
TEST_F(MessageHelperTest,
VerifyImageVrHelpItems_SmartObjectWithSeveralValidImages_Succsess) {
- // Creating sharedPtr to MockApplication
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ // Creating std::shared_ptr to MockApplication
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
// Creating input data for method
smart_objects::SmartObject message;
message[0][strings::image][strings::image_type] =
mobile_apis::ImageType::STATIC;
message[1][strings::image][strings::image_type] =
mobile_apis::ImageType::STATIC;
+
+ message[0][strings::image][strings::value] = "static_icon";
+ message[1][strings::image][strings::value] = "static_icon";
// Method call
mobile_apis::Result::eType result = MessageHelper::VerifyImageVrHelpItems(
message, appSharedMock, mock_application_manager);
@@ -859,8 +890,8 @@ TEST_F(MessageHelperTest,
TEST_F(MessageHelperTest,
VerifyImageVrHelpItems_SmartObjWithSeveralInvalidImages_NotSuccsess) {
- // Creating sharedPtr to MockApplication
- MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>();
+ // Creating std::shared_ptr to MockApplication
+ MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>();
// Creating input data for method
smart_objects::SmartObject message;
message[0][strings::image][strings::image_type] =
@@ -921,13 +952,14 @@ TEST_F(MessageHelperTest, StringToHmiLevel_LevelString_EqEType) {
TEST_F(MessageHelperTest, SubscribeApplicationToSoftButton_CallFromApp) {
// Create application mock
- MockApplicationSharedPtr appSharedPtr = utils::MakeShared<MockApplication>();
+ MockApplicationSharedPtr appSharedPtr = std::make_shared<MockApplication>();
// Prepare data for method
smart_objects::SmartObject message_params;
size_t function_id = 1;
//
EXPECT_CALL(*appSharedPtr,
- SubscribeToSoftButtons(function_id, SoftButtonID())).Times(1);
+ SubscribeToSoftButtons(function_id, SoftButtonID()))
+ .Times(1);
MessageHelper::SubscribeApplicationToSoftButton(
message_params, appSharedPtr, function_id);
}
@@ -943,7 +975,7 @@ TEST_F(MessageHelperTest, SendGetListOfPermissionsResponse_SUCCESS) {
ON_CALL(mock_application_manager, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
const uint32_t correlation_id = 0u;
@@ -952,7 +984,7 @@ TEST_F(MessageHelperTest, SendGetListOfPermissionsResponse_SUCCESS) {
correlation_id,
mock_application_manager);
- ASSERT_TRUE(result);
+ ASSERT_TRUE(result.get());
EXPECT_EQ(hmi_apis::FunctionID::SDL_GetListOfPermissions,
(*result)[strings::params][strings::function_id].asInt());
@@ -983,7 +1015,7 @@ TEST_F(MessageHelperTest,
ON_CALL(mock_application_manager, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
const uint32_t correlation_id = 0u;
@@ -992,7 +1024,7 @@ TEST_F(MessageHelperTest,
correlation_id,
mock_application_manager);
- ASSERT_TRUE(result);
+ ASSERT_TRUE(result.get());
smart_objects::SmartObject& msg_params = (*result)[strings::msg_params];
const std::string external_consent_status_key = "externalConsentStatus";
@@ -1029,7 +1061,7 @@ TEST_F(MessageHelperTest, SendNaviSetVideoConfigRequest) {
smart_objects::SmartObjectSPtr result;
ON_CALL(mock_application_manager, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&result), Return(true)));
int32_t app_id = 123;
@@ -1059,6 +1091,27 @@ TEST_F(MessageHelperTest, SendNaviSetVideoConfigRequest) {
EXPECT_EQ(480, msg_params[strings::config][strings::height].asInt());
}
+TEST_F(MessageHelperTest, ExtractWindowIdFromSmartObject_SUCCESS) {
+ const WindowID window_id = 145;
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+ message[strings::msg_params][strings::window_id] = window_id;
+ EXPECT_EQ(window_id,
+ MessageHelper::ExtractWindowIdFromSmartObject(
+ message[strings::msg_params]));
+}
+
+TEST_F(MessageHelperTest, ExtractWindowIdFromSmartObject_FromEmptyMessage) {
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ MessageHelper::ExtractWindowIdFromSmartObject(message));
+}
+
+TEST_F(MessageHelperTest, ExtractWindowIdFromSmartObject_FromWrongType) {
+ smart_objects::SmartObject message(smart_objects::SmartType_Array);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ MessageHelper::ExtractWindowIdFromSmartObject(message));
+}
+
} // namespace application_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/mobile_event_engine_test.cc b/src/components/application_manager/test/mobile_event_engine_test.cc
new file mode 100644
index 0000000000..cad1ff14ff
--- /dev/null
+++ b/src/components/application_manager/test/mobile_event_engine_test.cc
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+
+#include "application_manager/event_engine/event.h"
+#include "application_manager/event_engine/event_dispatcher_impl.h"
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/message.h"
+#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_event_observer.h"
+#include "smart_objects/smart_object.h"
+
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace event_engine_test {
+
+using application_manager::event_engine::Event;
+using application_manager::event_engine::EventDispatcherImpl;
+using application_manager::event_engine::EventObserver;
+using application_manager::event_engine::MobileEvent;
+using testing::_;
+using ::testing::An;
+using ::testing::Matcher;
+
+class MobileEventEngineTest : public testing::Test {
+ public:
+ MobileEventEngineTest()
+ : event_id(MobileEvent::MobileEventID::GetAppServiceDataID)
+ , event_observer_mock_(mock_event_dispatcher_) {}
+
+ protected:
+ EventDispatcherImpl* event_dispatcher_instance_;
+ MobileEvent* event_;
+ const MobileEvent::MobileEventID event_id;
+ MockEventDispatcher mock_event_dispatcher_;
+ MockEventObserver event_observer_mock_;
+ const int32_t correlation_id = 1121;
+ smart_objects::SmartObject smart_object_with_type_notification;
+ smart_objects::SmartObject smart_object_with_type_response;
+ smart_objects::SmartObject smart_object_with_type_error_response;
+ smart_objects::SmartObject smart_object_with_type_request;
+ smart_objects::SmartObject smart_object_with_invalid_type;
+
+ virtual void SetUp() OVERRIDE {
+ event_dispatcher_instance_ = new EventDispatcherImpl();
+ event_ =
+ new MobileEvent(mobile_apis::FunctionID::eType::GetAppServiceDataID);
+ smart_object_with_type_notification["params"]["message_type"] =
+ application_manager::MessageType::kNotification;
+ smart_object_with_type_notification["params"]["correlation_id"] =
+ correlation_id;
+ smart_object_with_type_notification["params"]["function_id"] =
+ mobile_apis::FunctionID::eType::GetAppServiceDataID;
+
+ smart_object_with_type_response["params"]["message_type"] =
+ application_manager::MessageType::kResponse;
+ smart_object_with_type_response["params"]["correlation_id"] =
+ correlation_id;
+ smart_object_with_type_response["params"]["function_id"] =
+ mobile_apis::FunctionID::eType::GetAppServiceDataID;
+
+ smart_object_with_type_request["params"]["message_type"] =
+ application_manager::MessageType::kRequest;
+ smart_object_with_type_request["params"]["correlation_id"] = correlation_id;
+ smart_object_with_type_request["params"]["function_id"] =
+ mobile_apis::FunctionID::eType::GetAppServiceDataID;
+
+ smart_object_with_invalid_type["params"]["message_type"] =
+ application_manager::MessageType::kUnknownType;
+ smart_object_with_invalid_type["params"]["correlation_id"] = correlation_id;
+ smart_object_with_invalid_type["params"]["function_id"] =
+ mobile_apis::FunctionID::eType::GetAppServiceDataID;
+ }
+
+ void TearDown() OVERRIDE {
+ delete event_dispatcher_instance_;
+ delete event_;
+ }
+
+ void CheckRaiseMobileEvent(const MobileEvent::MobileEventID& event_id,
+ const uint32_t calls_number,
+ const smart_objects::SmartObject& so) {
+ // Arrange
+ event_dispatcher_instance_->add_mobile_observer(
+ event_id, correlation_id, event_observer_mock_);
+ event_->set_smart_object(so);
+ EXPECT_CALL(event_observer_mock_, on_event(An<const MobileEvent&>()))
+ .Times(calls_number);
+ event_dispatcher_instance_->raise_mobile_event(*event_);
+ }
+};
+
+TEST_F(MobileEventEngineTest, EventObserverTest_ExpectObserversEmpty) {
+ // Arrange
+ EventObserver* event_observer_ptr =
+ static_cast<EventObserver*>(&event_observer_mock_);
+ // Check
+ EXPECT_EQ(reinterpret_cast<unsigned long>(event_observer_ptr),
+ event_observer_mock_.id());
+}
+
+TEST_F(MobileEventEngineTest,
+ EventDispatcherImpl_RaiseEvent_EventSOTypeResponse_ExpectEventRaised) {
+ CheckRaiseMobileEvent(event_id, 1u, smart_object_with_type_response);
+}
+
+TEST_F(MobileEventEngineTest,
+ EventDispatcherImpl_RaiseEvent_EventSOTypeInvalid_ExpectEventNotRaised) {
+ CheckRaiseMobileEvent(event_id, 0u, smart_object_with_invalid_type);
+}
+
+TEST_F(MobileEventEngineTest,
+ EventDispatcherImpl_RaiseEvent_EventSOTypeRequest_ExpectEventNotRaised) {
+ CheckRaiseMobileEvent(event_id, 0u, smart_object_with_type_request);
+}
+
+TEST_F(
+ MobileEventEngineTest,
+ EventDispatcherImpl_RaiseEvent_EventSOTypeNotification_ExpectEventNotRaised) {
+ CheckRaiseMobileEvent(event_id, 0u, smart_object_with_type_notification);
+}
+
+TEST_F(MobileEventEngineTest, Event_set_smart_object_ExpectObjectSet) {
+ // Act
+ event_->set_smart_object(smart_object_with_type_response);
+ const int32_t obj_type =
+ static_cast<int32_t>(application_manager::MessageType::kResponse);
+ const int32_t function_id =
+ static_cast<int32_t>(mobile_apis::FunctionID::eType::GetAppServiceDataID);
+ // Checks
+ EXPECT_EQ(obj_type, event_->smart_object_type());
+ EXPECT_EQ(function_id, event_->smart_object_function_id());
+ EXPECT_EQ(correlation_id, event_->smart_object_correlation_id());
+ EXPECT_EQ(smart_object_with_type_response, event_->smart_object());
+}
+
+} // namespace event_engine_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/mobile_message_handler_test.cc b/src/components/application_manager/test/mobile_message_handler_test.cc
index 2fe28d8249..3ae79ce8ce 100644
--- a/src/components/application_manager/test/mobile_message_handler_test.cc
+++ b/src/components/application_manager/test/mobile_message_handler_test.cc
@@ -32,31 +32,30 @@
#include "application_manager/mobile_message_handler.h"
-#include <string>
-#include <ctime>
#include <algorithm>
+#include <ctime>
#include <iterator>
+#include <string>
#include <vector>
-#include "gmock/gmock.h"
#include "application_manager/message.h"
+#include "gmock/gmock.h"
#include "protocol/raw_message.h"
-#include "utils/make_shared.h"
namespace test {
namespace components {
namespace application_manager_test {
+using ::application_manager::Message;
+using ::application_manager::MobileMessage;
+using application_manager::MobileMessageHandler;
+using protocol_handler::MajorProtocolVersion;
+using protocol_handler::MessagePriority;
+using protocol_handler::PROTOCOL_HEADER_V2_SIZE;
using protocol_handler::RawMessage;
using protocol_handler::RawMessagePtr;
using protocol_handler::ServiceType;
-using protocol_handler::MessagePriority;
-using protocol_handler::PROTOCOL_HEADER_V2_SIZE;
-using application_manager::MobileMessageHandler;
-using protocol_handler::MajorProtocolVersion;
using ::testing::_;
-using ::application_manager::Message;
-using ::application_manager::MobileMessage;
using testing::Return;
@@ -106,12 +105,13 @@ class MobileMessageHandlerTest : public testing::Test {
size_t full_size = sizeof(uint8_t) * full_data.size();
- message_ptr_ = utils::MakeShared<RawMessage>(connection_key_,
- protocol_version,
- &full_data[0],
- full_size,
- ServiceType::kRpc,
- payload_size);
+ message_ptr_ = std::make_shared<RawMessage>(connection_key_,
+ protocol_version,
+ &full_data[0],
+ full_size,
+ false,
+ ServiceType::kRpc,
+ payload_size);
return MobileMessageHandler::HandleIncomingMessageProtocol(message_ptr_);
}
@@ -170,7 +170,7 @@ class MobileMessageHandlerTest : public testing::Test {
uint32_t connection_key,
const std::string& json_msg,
const application_manager::BinaryData* data = NULL) {
- MobileMessage message = utils::MakeShared<Message>(
+ MobileMessage message = std::make_shared<Message>(
MessagePriority::FromServiceType(ServiceType::kRpc));
message->set_function_id(function_id);
message->set_correlation_id(correlation_id);
@@ -254,7 +254,7 @@ class MobileMessageHandlerTest : public testing::Test {
TEST(mobile_message_test, basic_test) {
// Example message
MobileMessage message =
- utils::MakeShared<Message>(protocol_handler::MessagePriority::kDefault);
+ std::make_shared<Message>(protocol_handler::MessagePriority::kDefault);
EXPECT_FALSE(message->has_binary_data());
application_manager::BinaryData binary_data;
binary_data.push_back('X');
diff --git a/src/components/application_manager/test/mobile_message_handler_v1_test.cc b/src/components/application_manager/test/mobile_message_handler_v1_test.cc
index a19ea991b9..ab37694c28 100644
--- a/src/components/application_manager/test/mobile_message_handler_v1_test.cc
+++ b/src/components/application_manager/test/mobile_message_handler_v1_test.cc
@@ -32,20 +32,19 @@
#include "application_manager/mobile_message_handler.h"
-#include <string>
-#include <vector>
#include <algorithm>
#include <iterator>
+#include <string>
+#include <vector>
-#include "gmock/gmock.h"
#include "application_manager/message.h"
+#include "gmock/gmock.h"
#include "protocol/raw_message.h"
-#include "utils/make_shared.h"
+using application_manager::MobileMessageHandler;
+using protocol_handler::PROTOCOL_HEADER_V1_SIZE;
using protocol_handler::RawMessage;
using protocol_handler::RawMessagePtr;
-using protocol_handler::PROTOCOL_HEADER_V1_SIZE;
-using application_manager::MobileMessageHandler;
namespace test {
namespace components {
@@ -70,8 +69,11 @@ const unsigned char* data_v1 =
TEST(MobileMessageHandlerTestV1Test,
HandleIncomingMessageProtocolV1_SendJSONData_ExpectEqual) {
- RawMessagePtr message = utils::MakeShared<RawMessage>(
- connection_key_p1, protocol_version_1, data_v1, data_json.length());
+ RawMessagePtr message = std::make_shared<RawMessage>(connection_key_p1,
+ protocol_version_1,
+ data_v1,
+ data_json.length(),
+ false);
application_manager::Message* ptr =
MobileMessageHandler::HandleIncomingMessageProtocol(message);
@@ -90,8 +92,11 @@ TEST(MobileMessageHandlerTestV1Test,
const unsigned char* data_v1 =
reinterpret_cast<const unsigned char*>(full_data.c_str());
- RawMessagePtr message = utils::MakeShared<RawMessage>(
- connection_key_p1, protocol_version_1, data_v1, full_data.length());
+ RawMessagePtr message = std::make_shared<RawMessage>(connection_key_p1,
+ protocol_version_1,
+ data_v1,
+ full_data.length(),
+ false);
application_manager::Message* ptr =
MobileMessageHandler::HandleIncomingMessageProtocol(message);
@@ -108,7 +113,7 @@ TEST(MobileMessageHandlerTestV1Test,
uint32_t connection_key = 1;
application_manager::MobileMessage message =
- utils::MakeShared<application_manager::Message>(
+ std::make_shared<application_manager::Message>(
protocol_handler::MessagePriority::kDefault);
message->set_protocol_version(
diff --git a/src/components/application_manager/test/mock_application_helper.cc b/src/components/application_manager/test/mock_application_helper.cc
index c64a56e53e..ea57709a73 100644
--- a/src/components/application_manager/test/mock_application_helper.cc
+++ b/src/components/application_manager/test/mock_application_helper.cc
@@ -41,15 +41,16 @@ MockApplicationHelper& MockApplicationHelper::application_helper_mock() {
return application_helper_mock;
}
-} // application_manager_test
-} // components
-} // test
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
namespace application_manager {
void DeleteApplicationData(ApplicationSharedPtr app,
ApplicationManager& app_manager) {
test::components::application_manager_test::MockApplicationHelper::
- application_helper_mock().RecallApplicationData(app, app_manager);
+ application_helper_mock()
+ .RecallApplicationData(app, app_manager);
}
-} // application_managers
+} // namespace application_manager
diff --git a/src/components/application_manager/test/mock_hmi_command_factory.cc b/src/components/application_manager/test/mock_hmi_command_factory.cc
index 375da26067..5f76a9300b 100644
--- a/src/components/application_manager/test/mock_hmi_command_factory.cc
+++ b/src/components/application_manager/test/mock_hmi_command_factory.cc
@@ -30,9 +30,9 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "application_manager/mock_hmi_command_factory.h"
#include <gmock/gmock.h>
#include "application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/hmi_command_factory.h"
-#include "application_manager/mock_hmi_command_factory.h"
namespace test {
namespace components {
@@ -43,9 +43,9 @@ MockHMICommandFactory* MockHMICommandFactory::mock_hmi_command_factory() {
return &mock_hmi_command_factory;
}
-} // application_manager_test
-} // components
-} // test
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
namespace sdl_rpc_plugin {
namespace app_mngr = application_manager;
@@ -53,6 +53,7 @@ app_mngr::CommandSharedPtr HMICommandFactory::CreateCommand(
const app_mngr::commands::MessageSharedPtr& message,
app_mngr::ApplicationManager& application_manager) {
return test::components::application_manager_test::MockHMICommandFactory::
- mock_hmi_command_factory()->CreateCommand(message, application_manager);
+ mock_hmi_command_factory()
+ ->CreateCommand(message, application_manager);
}
-} // application_manager
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index fc2136cdd8..959bbf5bd0 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -30,15 +30,27 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/message_helper.h"
#include "application_manager/mock_message_helper.h"
+#include "application_manager/message_helper.h"
#include "application_manager/policies/policy_handler_interface.h"
-#include "transport_manager/common.h"
-#include "gtest/gtest.h"
#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "transport_manager/common.h"
namespace application_manager {
+smart_objects::SmartObjectSPtr MessageHelper::CreateNotification(
+ mobile_apis::FunctionID::eType function_id, uint32_t app_id) {
+ return MockMessageHelper::message_helper_mock()->CreateNotification(
+ function_id, app_id);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateHMINotification(
+ hmi_apis::FunctionID::eType function_id) {
+ return MockMessageHelper::message_helper_mock()->CreateHMINotification(
+ function_id);
+}
+
void MessageHelper::SendHashUpdateNotification(uint32_t const app_id,
ApplicationManager& app_mngr) {
MockMessageHelper::message_helper_mock()->SendHashUpdateNotification(
@@ -200,9 +212,10 @@ void MessageHelper::SendGetListOfPermissionsResponse(
void MessageHelper::SendOnPermissionsChangeNotification(
uint32_t connection_key,
const policy::Permissions& permissions,
- ApplicationManager& app_mngr) {
+ ApplicationManager& app_mngr,
+ const policy::EncryptionRequired require_encryption) {
MockMessageHelper::message_helper_mock()->SendOnPermissionsChangeNotification(
- connection_key, permissions, app_mngr);
+ connection_key, permissions, app_mngr, require_encryption);
}
void MessageHelper::SendPolicySnapshotNotification(
@@ -246,10 +259,11 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
}
void MessageHelper::SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager) {
MockMessageHelper::message_helper_mock()->SendHMIStatusNotification(
- application_impl, application_manager);
+ application, window_id, application_manager);
}
void MessageHelper::SendUpdateSDLResponse(const std::string& result,
@@ -265,6 +279,12 @@ hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString(
language);
}
+hmi_apis::Common_LightName::eType MessageHelper::CommonLightNameFromString(
+ const std::string& lightName) {
+ return MockMessageHelper::message_helper_mock()->CommonLightNameFromString(
+ lightName);
+}
+
smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO(
uint32_t function_id, ApplicationManager& app_mngr) {
return MockMessageHelper::message_helper_mock()->CreateModuleInfoSO(
@@ -328,6 +348,13 @@ mobile_apis::Result::eType MessageHelper::VerifyImage(
message, app, app_mngr);
}
+MessageHelper::ChoiceSetVRCommandsStatus
+MessageHelper::CheckChoiceSetVRCommands(
+ const smart_objects::SmartObject& choice_set) {
+ return MockMessageHelper::message_helper_mock()->CheckChoiceSetVRCommands(
+ choice_set);
+}
+
mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
smart_objects::SmartObject& message,
ApplicationConstSharedPtr app,
@@ -341,23 +368,28 @@ std::string MessageHelper::CommonLanguageToString(
return MockMessageHelper::message_helper_mock()->CommonLanguageToString(lang);
}
+std::string MessageHelper::MobileLanguageToString(
+ mobile_apis::Language::eType lang) {
+ return MockMessageHelper::message_helper_mock()->MobileLanguageToString(lang);
+}
+
smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr) {
return MockMessageHelper::message_helper_mock()->GetBCActivateAppRequestToHMI(
- app,
- session_observer,
- policy_handler,
- level,
- send_policy_priority,
- app_mngr);
+ app, policy_handler, level, send_policy_priority, app_mngr);
}
-NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr
+smart_objects::SmartObjectSPtr MessageHelper::GetBCCloseApplicationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()
+ ->GetBCCloseApplicationRequestToHMI(app, app_mngr);
+}
+
+ns_smart_device_link::ns_smart_objects::SmartObjectSPtr
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
int32_t connection_key,
mobile_apis::AppInterfaceUnregisteredReason::eType reason) {
@@ -378,6 +410,16 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
void MessageHelper::SubscribeApplicationToSoftButton(
smart_objects::SmartObject& message_params,
ApplicationSharedPtr app,
+ int32_t function_id,
+ const WindowID window_id) {
+ return MockMessageHelper::message_helper_mock()
+ ->SubscribeApplicationToSoftButton(
+ message_params, app, function_id, window_id);
+}
+
+void MessageHelper::SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
int32_t function_id) {
return MockMessageHelper::message_helper_mock()
->SubscribeApplicationToSoftButton(message_params, app, function_id);
@@ -423,6 +465,16 @@ void MessageHelper::SendUIChangeRegistrationRequestToHMI(
->SendUIChangeRegistrationRequestToHMI(app, app_mngr);
}
+bool MessageHelper::CreateDeviceInfo(
+ connection_handler::DeviceHandle device_handle,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ ApplicationManager& app_mngr,
+ smart_objects::SmartObject* output) {
+ return MockMessageHelper::message_helper_mock()->CreateDeviceInfo(
+ device_handle, session_observer, policy_handler, app_mngr, output);
+}
+
bool MessageHelper::CreateHMIApplicationStruct(
ApplicationConstSharedPtr app,
const protocol_handler::SessionObserver& session_observer,
@@ -433,6 +485,13 @@ bool MessageHelper::CreateHMIApplicationStruct(
app, session_observer, policy_handler, output, app_mngr);
}
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateOnAppPropertiesChangeNotification(
+ const std::string& policy_app_id, ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateOnAppPropertiesChangeNotification(policy_app_id, app_mngr);
+}
+
void MessageHelper::SendOnAppUnregNotificationToHMI(
ApplicationConstSharedPtr app,
const bool is_unexpected_disconnect,
@@ -488,6 +547,12 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
return MockMessageHelper::message_helper_mock()->PrintSmartObject(object);
}
+WindowID MessageHelper::ExtractWindowIdFromSmartObject(
+ const smart_objects::SmartObject& s_map) {
+ return MockMessageHelper::message_helper_mock()
+ ->ExtractWindowIdFromSmartObject(s_map);
+}
+
void MessageHelper::SendSetAppIcon(const uint32_t app_id,
const std::string& icon_path,
ApplicationManager& application_manager) {
@@ -543,4 +608,41 @@ void MessageHelper::SendUnsubscribeButtonNotification(
->SendUnsubscribeButtonNotification(button, application, app_mngr);
}
+smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities(
+ std::vector<smart_objects::SmartObject>& all_services) {
+ return MockMessageHelper::message_helper_mock()->CreateAppServiceCapabilities(
+ all_services);
+}
+
+void MessageHelper::BroadcastCapabilityUpdate(
+ smart_objects::SmartObject& msg_params, ApplicationManager& app_mngr) {
+ MockMessageHelper::message_helper_mock()->BroadcastCapabilityUpdate(
+ msg_params, app_mngr);
+}
+
+smart_objects::SmartObjectList MessageHelper::CreateUICreateWindowRequestsToHMI(
+ application_manager::ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& windows_info) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateUICreateWindowRequestsToHMI(application, app_mngr, windows_info);
+}
+
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateDisplayCapabilityUpdateToMobile(
+ const smart_objects::SmartObject& system_capabilities, Application& app) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateDisplayCapabilityUpdateToMobile(system_capabilities, app);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateOnServiceUpdateNotification(
+ const hmi_apis::Common_ServiceType::eType service_type,
+ const hmi_apis::Common_ServiceEvent::eType service_event,
+ const hmi_apis::Common_ServiceStatusUpdateReason::eType
+ service_update_reason,
+ const uint32_t app_id) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateOnServiceUpdateNotification(
+ service_type, service_event, service_update_reason, app_id);
+}
} // namespace application_manager
diff --git a/src/components/application_manager/test/policy_event_observer_test.cc b/src/components/application_manager/test/policy_event_observer_test.cc
index 9b97f054b3..22d7a8cfa0 100644
--- a/src/components/application_manager/test/policy_event_observer_test.cc
+++ b/src/components/application_manager/test/policy_event_observer_test.cc
@@ -33,10 +33,10 @@
#include "application_manager/policies/policy_event_observer.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "gmock/gmock.h"
#include "policy/policy_types.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/mock_event_dispatcher.h"
namespace test {
namespace components {
@@ -89,8 +89,6 @@ class PolicyEventObserverTest : public ::testing::Test {
EXPECT_CALL(policy_handler_mock_,
PTUpdatedAt(Counters::KILOMETERS, field_value))
.Times(pt_updated_calls_number);
- EXPECT_CALL(policy_handler_mock_, OnSystemReady())
- .Times(on_system_ready_calls_number);
policy_event_observer_->on_event(*event_);
}
@@ -125,15 +123,6 @@ TEST_F(PolicyEventObserverTest,
CheckResultsOnEvent(1u, 0u);
}
-TEST_F(PolicyEventObserverTest,
- OnEvent_EventBasicCommunication_OnReady_ExpectOnSystemReady) {
- // Arrange
- CreateEvent(Event::EventID::BasicCommunication_OnReady);
- CookSmartObject(hmi_apis::Common_Result::SUCCESS, field_name, field_value);
- // Check
- CheckResultsOnEvent(0u, 1u);
-}
-
} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc
index 57fa67bf0a..cfaa771fa0 100644
--- a/src/components/application_manager/test/policy_handler_test.cc
+++ b/src/components/application_manager/test/policy_handler_test.cc
@@ -30,48 +30,50 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <fstream>
+#include <memory>
#include <string>
#include <vector>
-#include <fstream>
#include "gmock/gmock.h"
-#include "application_manager/policies/policy_handler.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/application_manager_impl.h"
#include "application_manager/policies/delegates/app_permission_delegate.h"
+#include "application_manager/policies/policy_handler.h"
#include "connection_handler/connection_handler_impl.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/application_impl.h"
#ifdef ENABLE_SECURITY
-#include "security_manager/mock_security_manager.h"
#include "security_manager/mock_crypto_manager.h"
+#include "security_manager/mock_security_manager.h"
#endif // ENABLE_SECURITY
#include "application_manager/mock_message_helper.h"
#include "connection_handler/mock_connection_handler_settings.h"
-#include "transport_manager/mock_transport_manager.h"
-#include "policy/policy_types.h"
#include "json/reader.h"
-#include "json/writer.h"
#include "json/value.h"
+#include "json/writer.h"
+#include "policy/policy_types.h"
#include "smart_objects/smart_object.h"
+#include "transport_manager/mock_transport_manager.h"
#include "utils/file_system.h"
-#include "utils/make_shared.h"
-#include "utils/custom_string.h"
-#include "policy/usage_statistics/counter.h"
-#include "policy/usage_statistics/statistics_manager.h"
+
#include "interfaces/MOBILE_API.h"
#include "policy/mock_policy_settings.h"
-#include "utils/make_shared.h"
+#include "policy/usage_statistics/counter.h"
+#include "policy/usage_statistics/statistics_manager.h"
+#include "utils/custom_string.h"
+
#include "application_manager/mock_application.h"
-#include "policy/usage_statistics/mock_statistics_manager.h"
-#include "protocol_handler/mock_session_observer.h"
-#include "connection_handler/mock_connection_handler.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/policies/mock_policy_handler_observer.h"
#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/mock_state_controller.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_rpc_service.h"
+#include "application_manager/mock_state_controller.h"
+#include "application_manager/policies/mock_policy_handler_observer.h"
+#include "connection_handler/mock_connection_handler.h"
#include "policy/mock_policy_manager.h"
#include "policy/usage_statistics/mock_statistics_manager.h"
+#include "protocol_handler/mock_session_observer.h"
+
+#include "smart_objects/enum_schema_item.h"
namespace test {
namespace components {
@@ -81,19 +83,22 @@ using namespace application_manager;
using namespace policy;
using namespace utils::custom_string;
using testing::_;
+using ::testing::DoAll;
using ::testing::Mock;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
-using ::testing::SetArgReferee;
using ::testing::SetArgPointee;
-using ::testing::DoAll;
using ::testing::SetArgReferee;
-using ::testing::Mock;
typedef NiceMock<application_manager_test::MockRPCService> MockRPCService;
+namespace {
+const std::string kFakeNickname = "fake_nickname";
const std::string kDummyData = "some_data";
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+} // namespace
class PolicyHandlerTest : public ::testing::Test {
public:
@@ -134,14 +139,14 @@ class PolicyHandlerTest : public ::testing::Test {
protected:
NiceMock<MockPolicySettings> policy_settings_;
NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
- utils::SharedPtr<application_manager_test::MockApplication> mock_app_;
+ std::shared_ptr<application_manager_test::MockApplication> mock_app_;
connection_handler_test::MockConnectionHandler conn_handler;
protocol_handler_test::MockSessionObserver mock_session_observer;
application_manager_test::MockStateController mock_state_controller;
components::usage_statistics_test::MockStatisticsManager
mock_statistics_manager_;
PolicyHandler policy_handler_;
- utils::SharedPtr<policy_manager_test::MockPolicyManager> mock_policy_manager_;
+ std::shared_ptr<policy_manager_test::MockPolicyManager> mock_policy_manager_;
application_manager_test::MockApplicationManager app_manager_;
const std::string kPolicyAppId_;
const std::string kMacAddr_;
@@ -176,18 +181,19 @@ class PolicyHandlerTest : public ::testing::Test {
ON_CALL(policy_settings_, enable_policy()).WillByDefault(Return(true));
ON_CALL(app_manager_, event_dispatcher())
.WillByDefault(ReturnRef(mock_event_dispatcher_));
- std::string path = file_system::CreateDirectory("storage");
- file_system::CreateFile(path + "/" + "certificate");
+ const std::string path("storage");
+ if (file_system::CreateDirectory(path))
+ file_system::CreateFile(path + "/" + "certificate");
mock_policy_manager_ =
- utils::MakeShared<policy_manager_test::MockPolicyManager>();
- ASSERT_TRUE(mock_policy_manager_.valid());
+ std::make_shared<policy_manager_test::MockPolicyManager>();
+ ASSERT_TRUE(mock_policy_manager_.use_count() != 0);
ON_CALL(app_manager_, connection_handler())
.WillByDefault(ReturnRef(conn_handler));
ON_CALL(conn_handler, get_session_observer())
.WillByDefault(ReturnRef(mock_session_observer));
- mock_app_ = utils::MakeShared<application_manager_test::MockApplication>();
+ mock_app_ = std::make_shared<application_manager_test::MockApplication>();
}
virtual void TearDown() OVERRIDE {
@@ -236,21 +242,25 @@ class PolicyHandlerTest : public ::testing::Test {
void TestOnPermissionsUpdated(const std::string& default_hmi_level,
const mobile_apis::HMILevel::eType hmi_level) {
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(mock_message_helper_, StringToHMILevel(default_hmi_level))
.WillOnce(Return(hmi_level));
+ ChangePolicyManagerToMock();
+ const policy::EncryptionRequired require_encryption;
+ EXPECT_CALL(*mock_policy_manager_, GetAppEncryptionRequired(kPolicyAppId_))
+ .WillOnce(Return(require_encryption));
EXPECT_CALL(mock_message_helper_,
- SendOnPermissionsChangeNotification(kAppId1_, _, _));
+ SendOnPermissionsChangeNotification(kAppId1_, _, _, _));
EXPECT_CALL(app_manager_, state_controller()).Times(0);
Permissions permissions;
policy_handler_.OnPermissionsUpdated(
- kPolicyAppId_, permissions, default_hmi_level);
+ kDeviceId, kPolicyAppId_, permissions, default_hmi_level);
}
void CreateFunctionalGroupPermission(
@@ -268,6 +278,19 @@ class PolicyHandlerTest : public ::testing::Test {
hmi_types.push_back(hmi_type);
return hmi_types;
}
+
+ void SetExpectationsAndCheckCloudAppPropertiesStatus(
+ const policy::AppProperties& app_properties,
+ const smart_objects::SmartObject& properties,
+ const policy::PolicyHandlerInterface::AppPropertiesState&
+ app_properties_state) {
+ EXPECT_CALL(*mock_policy_manager_, GetAppProperties(kPolicyAppId_, _))
+ .WillOnce(DoAll(SetArgReferee<1>(app_properties), Return(true)));
+ EXPECT_CALL(*mock_policy_manager_, GetInitialAppData(kPolicyAppId_, _, _));
+ EXPECT_EQ(
+ app_properties_state,
+ policy_handler_.GetAppPropertiesStatus(properties, kPolicyAppId_));
+ }
};
namespace {
@@ -380,6 +403,74 @@ TEST_F(PolicyHandlerTest, ClearUserConsent) {
policy_handler_.ClearUserConsent();
}
+TEST_F(PolicyHandlerTest, AppServiceUpdate_CheckAppService) {
+ // Arrange
+ EnablePolicy();
+ EXPECT_TRUE(policy_handler_.LoadPolicyLibrary());
+ // Check
+ EXPECT_TRUE(policy_handler_.InitPolicyTable());
+ ChangePolicyManagerToMock();
+ std::string file_name("sdl_pt_update.json");
+ std::ifstream ifile(file_name);
+ Json::CharReaderBuilder reader_builder;
+ std::string json;
+ Json::Value root(Json::objectValue);
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
+ json = root.toStyledString();
+ }
+ ifile.close();
+ BinaryMessage msg(json.begin(), json.end());
+ // Checks
+ EXPECT_CALL(*mock_policy_manager_, LoadPT("", msg))
+ .WillOnce(Return(PolicyManager::PtProcessingResult::kSuccess));
+ EXPECT_CALL(*mock_policy_manager_,
+ OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess));
+ policy_handler_.ReceiveMessageFromSDK("", msg);
+
+ policy_table::AppServiceParameters app_service_params =
+ policy_table::AppServiceParameters();
+ std::string kServiceType = "MEDIA";
+ std::string as_app_id = "1010101010";
+ std::string service_name1 = "SDL Music";
+ std::string service_name2 = "SDL App";
+ (app_service_params)[kServiceType] = policy_table::AppServiceInfo();
+ (app_service_params)[kServiceType].service_names->push_back(service_name2);
+ (app_service_params)[kServiceType].service_names->push_back(service_name1);
+ (app_service_params)[kServiceType].service_names->mark_initialized();
+ policy_table::AppServiceHandledRpc handled_rpc;
+ handled_rpc.function_id = 41;
+ (app_service_params)[kServiceType].handled_rpcs.push_back(handled_rpc);
+ EXPECT_CALL(*mock_policy_manager_, GetAppServiceParameters(_, _))
+ .WillRepeatedly(SetArgPointee<1>(app_service_params));
+
+ ns_smart_device_link::ns_smart_objects::SmartArray requested_handled_rpcs;
+ ns_smart_device_link::ns_smart_objects::SmartObject rpc_id(41);
+ requested_handled_rpcs.push_back(rpc_id);
+
+ ns_smart_device_link::ns_smart_objects::SmartArray fake_handled_rpcs;
+ ns_smart_device_link::ns_smart_objects::SmartObject fake_rpc_id(40);
+ fake_handled_rpcs.push_back(fake_rpc_id);
+
+ EXPECT_TRUE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, service_name1, kServiceType, &requested_handled_rpcs));
+ EXPECT_TRUE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, service_name2, kServiceType, &requested_handled_rpcs));
+ EXPECT_TRUE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, service_name2, kServiceType, NULL));
+ EXPECT_TRUE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, "", kServiceType, NULL));
+
+ EXPECT_FALSE(
+ policy_handler_.CheckAppServiceParameters(as_app_id, "", "", NULL));
+ EXPECT_FALSE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, service_name2, "NAVIGATION", &requested_handled_rpcs));
+ EXPECT_FALSE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, "MUSIC", kServiceType, &requested_handled_rpcs));
+ EXPECT_FALSE(policy_handler_.CheckAppServiceParameters(
+ as_app_id, service_name2, kServiceType, &fake_handled_rpcs));
+}
+
TEST_F(PolicyHandlerTest, ReceiveMessageFromSDK) {
// Arrange
EnablePolicy();
@@ -389,10 +480,12 @@ TEST_F(PolicyHandlerTest, ReceiveMessageFromSDK) {
ChangePolicyManagerToMock();
std::string file_name("sdl_pt_update.json");
std::ifstream ifile(file_name);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
+
std::string json;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
json = root.toStyledString();
}
ifile.close();
@@ -401,7 +494,10 @@ TEST_F(PolicyHandlerTest, ReceiveMessageFromSDK) {
EXPECT_CALL(app_manager_, GetNextHMICorrelationID());
EXPECT_CALL(mock_message_helper_, CreateGetVehicleDataRequest(_, _, _));
EXPECT_CALL(*mock_policy_manager_, PTUpdatedAt(_, _));
- EXPECT_CALL(*mock_policy_manager_, LoadPT("", msg)).WillOnce(Return(true));
+ EXPECT_CALL(*mock_policy_manager_, LoadPT("", msg))
+ .WillOnce(Return(PolicyManager::PtProcessingResult::kSuccess));
+ EXPECT_CALL(*mock_policy_manager_,
+ OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess));
EXPECT_CALL(*mock_policy_manager_, CleanupUnpairedDevices());
policy_handler_.ReceiveMessageFromSDK("", msg);
}
@@ -412,7 +508,11 @@ TEST_F(PolicyHandlerTest, ReceiveMessageFromSDK_PTNotLoaded) {
BinaryMessage msg;
// Checks
- EXPECT_CALL(*mock_policy_manager_, LoadPT("", msg)).WillOnce(Return(false));
+ EXPECT_CALL(*mock_policy_manager_, LoadPT("", msg))
+ .WillOnce(Return(PolicyManager::PtProcessingResult::kWrongPtReceived));
+ EXPECT_CALL(
+ *mock_policy_manager_,
+ OnPTUFinished(PolicyManager::PtProcessingResult::kWrongPtReceived));
EXPECT_CALL(app_manager_, GetNextHMICorrelationID()).Times(0);
EXPECT_CALL(mock_message_helper_, CreateGetVehicleDataRequest(_, _, _))
.Times(0);
@@ -433,38 +533,52 @@ TEST_F(PolicyHandlerTest, UnloadPolicyLibrary_method_ExpectLibraryUnloaded) {
TEST_F(PolicyHandlerTest, OnPermissionsUpdated_method_With2Parameters) {
// Check expectations
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ ChangePolicyManagerToMock();
+ const policy::EncryptionRequired require_encryption;
+ EXPECT_CALL(*mock_policy_manager_, GetAppEncryptionRequired(kPolicyAppId_))
+ .WillOnce(Return(require_encryption));
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.WillOnce(Return(mock_app_));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId1_));
EXPECT_CALL(mock_message_helper_,
- SendOnPermissionsChangeNotification(kAppId1_, _, _));
+ SendOnPermissionsChangeNotification(kAppId1_, _, _, _));
// Act
Permissions perms;
- policy_handler_.OnPermissionsUpdated(kPolicyAppId_, perms);
+ policy_handler_.OnPermissionsUpdated(kDeviceId, kPolicyAppId_, perms);
}
TEST_F(PolicyHandlerTest, OnPermissionsUpdated_TwoParams_InvalidApp_UNSUCCESS) {
- utils::SharedPtr<application_manager_test::MockApplication> invalid_app;
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ std::shared_ptr<application_manager_test::MockApplication> invalid_app;
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.WillOnce(Return(invalid_app));
+ ChangePolicyManagerToMock();
+ const policy::EncryptionRequired require_encryption;
+ EXPECT_CALL(*mock_policy_manager_, GetAppEncryptionRequired(kPolicyAppId_))
+ .Times(0);
EXPECT_CALL(mock_message_helper_,
- SendOnPermissionsChangeNotification(_, _, _)).Times(0);
+ SendOnPermissionsChangeNotification(_, _, _, _))
+ .Times(0);
Permissions permissions;
- policy_handler_.OnPermissionsUpdated(kPolicyAppId_, permissions);
+ policy_handler_.OnPermissionsUpdated(kDeviceId, kPolicyAppId_, permissions);
}
TEST_F(PolicyHandlerTest, OnPermissionsUpdated_InvalidApp_UNSUCCESS) {
- utils::SharedPtr<application_manager_test::MockApplication> invalid_app;
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ std::shared_ptr<application_manager_test::MockApplication> invalid_app;
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.WillOnce(Return(mock_app_))
.WillOnce(Return(invalid_app));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId1_));
+ ChangePolicyManagerToMock();
+ const policy::EncryptionRequired require_encryption;
+ EXPECT_CALL(*mock_policy_manager_, GetAppEncryptionRequired(kPolicyAppId_))
+ .WillOnce(Return(require_encryption));
EXPECT_CALL(mock_message_helper_,
- SendOnPermissionsChangeNotification(kAppId1_, _, _));
+ SendOnPermissionsChangeNotification(kAppId1_, _, _, _));
Permissions permissions;
- policy_handler_.OnPermissionsUpdated(kPolicyAppId_, permissions, "HMI_FULL");
+ policy_handler_.OnPermissionsUpdated(
+ kDeviceId, kPolicyAppId_, permissions, "HMI_FULL");
}
TEST_F(PolicyHandlerTest, OnPermissionsUpdated_HmiLevelInvalidEnum_UNSUCCESS) {
@@ -482,25 +596,30 @@ TEST_F(PolicyHandlerTest,
const std::string new_kHmiLevel_string = "HMI_FULL";
mobile_apis::HMILevel::eType new_hmi_level = mobile_apis::HMILevel::HMI_FULL;
// Check expectations
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.Times(2)
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId1_));
EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string))
.WillOnce(Return(new_hmi_level));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
+ ChangePolicyManagerToMock();
+ const policy::EncryptionRequired require_encryption;
+ EXPECT_CALL(*mock_policy_manager_, GetAppEncryptionRequired(kPolicyAppId_))
+ .WillOnce(Return(require_encryption));
EXPECT_CALL(mock_message_helper_,
- SendOnPermissionsChangeNotification(kAppId1_, _, _));
+ SendOnPermissionsChangeNotification(kAppId1_, _, _, _));
EXPECT_CALL(app_manager_, state_controller())
.WillRepeatedly(ReturnRef(mock_state_controller));
- EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, true));
+ EXPECT_CALL(mock_state_controller,
+ SetRegularState(_, kDefaultWindowId, new_hmi_level, true));
// Act
Permissions perms;
policy_handler_.OnPermissionsUpdated(
- kPolicyAppId_, perms, new_kHmiLevel_string);
+ kDeviceId, kPolicyAppId_, perms, new_kHmiLevel_string);
}
TEST_F(PolicyHandlerTest,
@@ -510,25 +629,30 @@ TEST_F(PolicyHandlerTest,
mobile_apis::HMILevel::eType new_hmi_level =
mobile_apis::HMILevel::HMI_LIMITED;
// Check expectations
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.Times(2)
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId1_));
EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string))
.WillOnce(Return(new_hmi_level));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
+ ChangePolicyManagerToMock();
+ const policy::EncryptionRequired require_encryption;
+ EXPECT_CALL(*mock_policy_manager_, GetAppEncryptionRequired(kPolicyAppId_))
+ .WillOnce(Return(require_encryption));
EXPECT_CALL(mock_message_helper_,
- SendOnPermissionsChangeNotification(kAppId1_, _, _));
+ SendOnPermissionsChangeNotification(kAppId1_, _, _, _));
EXPECT_CALL(app_manager_, state_controller())
.WillRepeatedly(ReturnRef(mock_state_controller));
- EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, false));
+ EXPECT_CALL(mock_state_controller,
+ SetRegularState(_, kDefaultWindowId, new_hmi_level, false));
// Act
Permissions perms;
policy_handler_.OnPermissionsUpdated(
- kPolicyAppId_, perms, new_kHmiLevel_string);
+ kDeviceId, kPolicyAppId_, perms, new_kHmiLevel_string);
}
TEST_F(PolicyHandlerTest,
@@ -537,23 +661,27 @@ TEST_F(PolicyHandlerTest,
std::string new_kHmiLevel_string = "HMI_FULL";
mobile_apis::HMILevel::eType new_hmi_level = mobile_apis::HMILevel::HMI_FULL;
// Check expectations
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.Times(2)
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId1_));
EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string))
.WillOnce(Return(new_hmi_level));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_LIMITED));
+ ChangePolicyManagerToMock();
+ const policy::EncryptionRequired require_encryption;
+ EXPECT_CALL(*mock_policy_manager_, GetAppEncryptionRequired(kPolicyAppId_))
+ .WillOnce(Return(require_encryption));
EXPECT_CALL(mock_message_helper_,
- SendOnPermissionsChangeNotification(kAppId1_, _, _));
+ SendOnPermissionsChangeNotification(kAppId1_, _, _, _));
EXPECT_CALL(app_manager_, state_controller()).Times(0);
// Act
Permissions perms;
policy_handler_.OnPermissionsUpdated(
- kPolicyAppId_, perms, new_kHmiLevel_string);
+ kDeviceId, kPolicyAppId_, perms, new_kHmiLevel_string);
}
TEST_F(PolicyHandlerTest, GetPriority) {
@@ -574,13 +702,14 @@ TEST_F(PolicyHandlerTest, CheckPermissions) {
const uint32_t device = 3;
const mobile_apis::HMILevel::eType hmi_level =
mobile_apis::HMILevel::HMI_NONE;
- EXPECT_CALL(*mock_app_, hmi_level()).WillOnce(Return(hmi_level));
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
+ .WillOnce(Return(hmi_level));
EXPECT_CALL(*mock_app_, device()).WillOnce(Return(device));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
#ifdef EXTERNAL_PROPRIETARY_MODE
- EXPECT_CALL(
- *mock_policy_manager_,
- CheckPermissions(kPolicyAppId_, kHmiLevel_, kRpc_, kRpc_params, _));
+ EXPECT_CALL(*mock_policy_manager_,
+ CheckPermissions(
+ kDeviceId, kPolicyAppId_, kHmiLevel_, kRpc_, kRpc_params, _));
#else // EXTERNAL_PROPRIETARY_MODE
EXPECT_CALL(*mock_policy_manager_,
@@ -592,7 +721,8 @@ TEST_F(PolicyHandlerTest, CheckPermissions) {
EXPECT_CALL(mock_message_helper_, GetDeviceMacAddressForHandle(device, _))
.WillOnce(Return(kDeviceId));
// Act
- policy_handler_.CheckPermissions(mock_app_, kRpc_, kRpc_params, result);
+ policy_handler_.CheckPermissions(
+ mock_app_, kDefaultWindowId, kRpc_, kRpc_params, result);
}
TEST_F(PolicyHandlerTest, GetNotificationsNumber) {
@@ -619,9 +749,9 @@ TEST_F(PolicyHandlerTest, GetDefaultHmi) {
EnablePolicyAndPolicyManagerMock();
// Check expectations
EXPECT_CALL(*mock_policy_manager_,
- GetDefaultHmi(kPolicyAppId_, &default_hmi_));
+ GetDefaultHmi(kDeviceId_, kPolicyAppId_, &default_hmi_));
// Act
- policy_handler_.GetDefaultHmi(kPolicyAppId_, &default_hmi_);
+ policy_handler_.GetDefaultHmi(kDeviceId_, kPolicyAppId_, &default_hmi_);
}
TEST_F(PolicyHandlerTest, GetInitialAppData) {
@@ -685,15 +815,6 @@ TEST_F(PolicyHandlerTest, OnExceededTimeout) {
policy_handler_.OnExceededTimeout();
}
-TEST_F(PolicyHandlerTest, OnSystemReady) {
- // Arrange
- EnablePolicyAndPolicyManagerMock();
- // Check expectations
- EXPECT_CALL(*mock_policy_manager_, OnSystemReady());
- // Act
- policy_handler_.OnSystemReady();
-}
-
TEST_F(PolicyHandlerTest, PTUpdatedAt_method_UseCounter_KILOMETERS) {
// Arrange
EnablePolicyAndPolicyManagerMock();
@@ -774,8 +895,8 @@ TEST_F(PolicyHandlerTest, KmsChanged) {
void PolicyHandlerTest::TestActivateApp(const uint32_t connection_key,
const uint32_t correlation_id) {
- utils::SharedPtr<application_manager_test::MockApplication> application1 =
- utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager_test::MockApplication> application1 =
+ std::make_shared<application_manager_test::MockApplication>();
EXPECT_CALL(app_manager_, ActivateApplication(_))
.WillRepeatedly(Return(true));
EXPECT_CALL(app_manager_, application(connection_key))
@@ -791,12 +912,12 @@ void PolicyHandlerTest::TestActivateApp(const uint32_t connection_key,
.WillRepeatedly(ReturnRef(conn_handler));
EXPECT_CALL(conn_handler, get_session_observer())
.WillOnce(ReturnRef(mock_session_observer));
- utils::SharedPtr<usage_statistics_test::MockStatisticsManager>
+ std::shared_ptr<usage_statistics_test::MockStatisticsManager>
mock_statistics_manager =
- utils::MakeShared<usage_statistics_test::MockStatisticsManager>();
+ std::make_shared<usage_statistics_test::MockStatisticsManager>();
UsageStatistics usage_stats(
"0",
- utils::SharedPtr<usage_statistics::StatisticsManager>(
+ std::shared_ptr<usage_statistics::StatisticsManager>(
mock_statistics_manager));
EXPECT_CALL(*application1, usage_report()).WillOnce(ReturnRef(usage_stats));
EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_))
@@ -820,12 +941,14 @@ void PolicyHandlerTest::TestActivateApp(const uint32_t connection_key,
#endif // EXTERNAL_PROPRIETARY_MODE
EXPECT_CALL(*application1, policy_app_id()).WillOnce(Return(kPolicyAppId_));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kMacAddr_, kPolicyAppId_))
.WillOnce(Return(permissions));
ON_CALL(*mock_policy_manager_, Increment(_, _)).WillByDefault(Return());
EXPECT_CALL(*mock_policy_manager_, RemovePendingPermissionChanges(_));
EXPECT_CALL(mock_message_helper_, SendSDLActivateAppResponse(_, _, _));
ON_CALL(*application1, app_id()).WillByDefault(Return(kAppId1_));
+ ON_CALL(*application1, mac_address()).WillByDefault(ReturnRef(kMacAddr_));
// Act
policy_handler_.OnActivateApp(connection_key, correlation_id);
}
@@ -839,7 +962,7 @@ TEST_F(PolicyHandlerTest, OnActivateApp) {
TEST_F(PolicyHandlerTest, OnActivateApp_InvalidApp_UNSUCCESS) {
// Arrange
EnablePolicyAndPolicyManagerMock();
- utils::SharedPtr<application_manager_test::MockApplication> invalid_app;
+ std::shared_ptr<application_manager_test::MockApplication> invalid_app;
EXPECT_CALL(app_manager_, application(kConnectionKey_))
.WillOnce(Return(invalid_app));
@@ -859,12 +982,12 @@ TEST_F(PolicyHandlerTest, OnActivateApp_AppIsRevoked_AppNotActivated) {
permissions.appRevoked = true;
#ifdef EXTERNAL_PROPRIETARY_MODE
- utils::SharedPtr<usage_statistics_test::MockStatisticsManager>
+ std::shared_ptr<usage_statistics_test::MockStatisticsManager>
mock_statistics_manager =
- utils::MakeShared<usage_statistics_test::MockStatisticsManager>();
+ std::make_shared<usage_statistics_test::MockStatisticsManager>();
UsageStatistics usage_stats(
"0",
- utils::SharedPtr<usage_statistics::StatisticsManager>(
+ std::shared_ptr<usage_statistics::StatisticsManager>(
mock_statistics_manager));
EXPECT_CALL(*mock_app_, usage_report()).WillOnce(ReturnRef(usage_stats));
const std::string default_mac = "00:00:00:00:00:00";
@@ -874,12 +997,14 @@ TEST_F(PolicyHandlerTest, OnActivateApp_AppIsRevoked_AppNotActivated) {
// Check expectations
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDefaultId, kPolicyAppId_))
.WillOnce(Return(permissions));
ON_CALL(*mock_policy_manager_, Increment(_, _)).WillByDefault(Return());
EXPECT_CALL(*mock_policy_manager_, RemovePendingPermissionChanges(_));
EXPECT_CALL(mock_message_helper_, SendSDLActivateAppResponse(_, _, _));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId1_));
+ ON_CALL(*mock_app_, mac_address()).WillByDefault(ReturnRef(kDefaultId));
// Act
policy_handler_.OnActivateApp(kConnectionKey_, kCorrelationKey_);
}
@@ -898,13 +1023,13 @@ void PolicyHandlerTest::OnPendingPermissionChangePrecondition(
// Arrange
EnablePolicyAndPolicyManagerMock();
- utils::SharedPtr<application_manager_test::MockApplication> application =
- utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager_test::MockApplication> application =
+ std::make_shared<application_manager_test::MockApplication>();
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
- .WillOnce(Return(application));
+ EXPECT_CALL(app_manager_, application(_, _)).WillOnce(Return(application));
EXPECT_CALL(*application, app_id()).WillRepeatedly(Return(kAppId1_));
- EXPECT_CALL(*application, hmi_level()).WillRepeatedly(Return(hmi_level));
+ EXPECT_CALL(*application, hmi_level(kDefaultWindowId))
+ .WillRepeatedly(Return(hmi_level));
}
TEST_F(PolicyHandlerTest,
@@ -916,14 +1041,15 @@ TEST_F(PolicyHandlerTest,
AppPermissions permissions(kPolicyAppId_);
permissions.appPermissionsConsentNeeded = false;
EXPECT_CALL(mock_message_helper_,
- SendOnAppPermissionsChangedNotification(kAppId1_, _, _)).Times(0);
-
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ SendOnAppPermissionsChangedNotification(kAppId1_, _, _))
+ .Times(0);
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(*mock_policy_manager_,
- RemovePendingPermissionChanges(kPolicyAppId_)).Times(0);
+ RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppInLimitedConsentNeeded) {
@@ -935,12 +1061,13 @@ TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppInLimitedConsentNeeded) {
// Check expectations
EXPECT_CALL(mock_message_helper_,
SendOnAppPermissionsChangedNotification(kAppId1_, _, _));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(*mock_policy_manager_,
RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppLimitedAndRevoked) {
@@ -957,17 +1084,19 @@ TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppLimitedAndRevoked) {
SendOnAppPermissionsChangedNotification(kAppId1_, _, _));
EXPECT_CALL(mock_state_controller,
SetRegularState(_,
+ kDefaultWindowId,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
true));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(*mock_policy_manager_,
RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppInBackgroundAndRevoked) {
@@ -981,12 +1110,13 @@ TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppInBackgroundAndRevoked) {
EXPECT_CALL(mock_message_helper_,
SendOnAppPermissionsChangedNotification(kAppId1_, _, _));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(*mock_policy_manager_,
RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest,
@@ -997,13 +1127,14 @@ TEST_F(PolicyHandlerTest,
AppPermissions permissions(kPolicyAppId_);
permissions.appUnauthorized = true;
- NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr message =
- utils::MakeShared<NsSmartDeviceLink::NsSmartObjects::SmartObject>();
+ ns_smart_device_link::ns_smart_objects::SmartObjectSPtr message =
+ std::make_shared<ns_smart_device_link::ns_smart_objects::SmartObject>();
// Check expectations
EXPECT_CALL(mock_message_helper_,
SendOnAppPermissionsChangedNotification(kAppId1_, _, _));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(mock_message_helper_,
@@ -1020,7 +1151,7 @@ TEST_F(PolicyHandlerTest,
RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest,
@@ -1033,13 +1164,14 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(mock_message_helper_,
SendOnAppPermissionsChangedNotification(kAppId1_, _, _));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(*mock_policy_manager_,
RemovePendingPermissionChanges(kPolicyAppId_));
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest,
@@ -1050,14 +1182,16 @@ TEST_F(PolicyHandlerTest,
AppPermissions permissions(kPolicyAppId_);
permissions.appUnauthorized = true;
- NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr message =
- utils::MakeShared<NsSmartDeviceLink::NsSmartObjects::SmartObject>();
+ ns_smart_device_link::ns_smart_objects::SmartObjectSPtr message =
+ std::make_shared<ns_smart_device_link::ns_smart_objects::SmartObject>();
// Check expectations
// Notification won't be sent
EXPECT_CALL(mock_message_helper_,
- SendOnAppPermissionsChangedNotification(kAppId1_, _, _)).Times(0);
+ SendOnAppPermissionsChangedNotification(kAppId1_, _, _))
+ .Times(0);
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(mock_message_helper_,
@@ -1074,7 +1208,7 @@ TEST_F(PolicyHandlerTest,
RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, PTExchangeAtUserRequest) {
@@ -1168,9 +1302,9 @@ TEST_F(PolicyHandlerTest, OnCurrentDeviceIdUpdateRequired) {
// Arrange
EnablePolicyAndPolicyManagerMock();
// Check expectations
- utils::SharedPtr<application_manager_test::MockApplication> application =
- utils::MakeShared<application_manager_test::MockApplication>();
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ std::shared_ptr<application_manager_test::MockApplication> application =
+ std::make_shared<application_manager_test::MockApplication>();
+ EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(application));
EXPECT_CALL(app_manager_, connection_handler())
.WillOnce(ReturnRef(conn_handler));
@@ -1187,10 +1321,11 @@ TEST_F(PolicyHandlerTest, OnCurrentDeviceIdUpdateRequired) {
_,
_,
_,
- _));
+ _))
+ .WillOnce(DoAll(SetArgPointee<3>(kDeviceId_), Return(0)));
// Act
- policy_handler_.OnCurrentDeviceIdUpdateRequired(kPolicyAppId_);
+ policy_handler_.OnCurrentDeviceIdUpdateRequired(handle, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnSystemInfoChanged) {
@@ -1226,24 +1361,21 @@ TEST_F(PolicyHandlerTest, IsApplicationRevoked) {
policy_handler_.IsApplicationRevoked(kPolicyAppId_);
}
-TEST_F(PolicyHandlerTest, OnSystemInfoUpdateRequired) {
- // Arrange
- ChangePolicyManagerToMock();
- // Check expectations
- EXPECT_CALL(mock_message_helper_, SendGetSystemInfoRequest(_));
- // Act
- policy_handler_.OnSystemInfoUpdateRequired();
-}
-
TEST_F(PolicyHandlerTest, GetAppRequestTypes) {
// Arrange
EnablePolicy();
ChangePolicyManagerToMock();
- // Check expectations
+ const transport_manager::DeviceHandle handle = 0u;
+// Check expectations
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypes(handle, kPolicyAppId_))
+ .WillOnce(Return(std::vector<std::string>()));
+#else
EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypes(kPolicyAppId_))
.WillOnce(Return(std::vector<std::string>()));
+#endif
// Act
- policy_handler_.GetAppRequestTypes(kPolicyAppId_);
+ policy_handler_.GetAppRequestTypes(handle, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnVIIsReady) {
@@ -1271,8 +1403,8 @@ TEST_F(PolicyHandlerTest, GetAppName) {
// Check expectations
const CustomString app_name("my_mobile_app");
- utils::SharedPtr<application_manager_test::MockApplication> application =
- utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager_test::MockApplication> application =
+ std::make_shared<application_manager_test::MockApplication>();
EXPECT_CALL(*application, name()).WillOnce(ReturnRef(app_name));
EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
@@ -1309,16 +1441,17 @@ TEST_F(PolicyHandlerTest, SendOnAppPermissionsChanged) {
// Arrange
EnablePolicyAndPolicyManagerMock();
- utils::SharedPtr<application_manager_test::MockApplication> application =
- utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager_test::MockApplication> application =
+ std::make_shared<application_manager_test::MockApplication>();
// Check expectations
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(application));
EXPECT_CALL(mock_message_helper_,
SendOnAppPermissionsChangedNotification(_, _, _));
AppPermissions permissions(kPolicyAppId_);
// Act
- policy_handler_.SendOnAppPermissionsChanged(permissions, kPolicyAppId_);
+ policy_handler_.SendOnAppPermissionsChanged(
+ permissions, kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnPTExchangeNeeded) {
@@ -1336,11 +1469,12 @@ TEST_F(PolicyHandlerTest, AddApplication) {
// Check expectations
EXPECT_CALL(
*mock_policy_manager_,
- AddApplication(kPolicyAppId_, HmiTypes(policy_table::AHT_DEFAULT)))
- .WillOnce(Return(utils::MakeShared<utils::CallNothing>()));
+ AddApplication(
+ kMacAddr_, kPolicyAppId_, HmiTypes(policy_table::AHT_DEFAULT)))
+ .WillOnce(Return(std::make_shared<utils::CallNothing>()));
// Act
- policy_handler_.AddApplication(kPolicyAppId_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_handler_.AddApplication(
+ kMacAddr_, kPolicyAppId_, HmiTypes(policy_table::AHT_DEFAULT));
}
TEST_F(PolicyHandlerTest, HeartBeatTimeout) {
@@ -1375,9 +1509,10 @@ TEST_F(PolicyHandlerTest, OnAppRegisteredOnMobile) {
EnablePolicyAndPolicyManagerMock();
// Check expectations
- EXPECT_CALL(*mock_policy_manager_, OnAppRegisteredOnMobile(kPolicyAppId_));
+ EXPECT_CALL(*mock_policy_manager_,
+ OnAppRegisteredOnMobile(kDeviceId, kPolicyAppId_));
// Act
- policy_handler_.OnAppRegisteredOnMobile(kPolicyAppId_);
+ policy_handler_.OnAppRegisteredOnMobile(kDeviceId, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, IsRequestTypeAllowed) {
@@ -1388,13 +1523,20 @@ TEST_F(PolicyHandlerTest, IsRequestTypeAllowed) {
mobile_apis::RequestType::eType type =
mobile_apis::RequestType::eType::EMERGENCY;
+ const transport_manager::DeviceHandle handle = 0u;
+
EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypesState(kPolicyAppId_))
.WillOnce(Return(policy::RequestType::State::AVAILABLE));
-
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypes(handle, kPolicyAppId_))
+ .WillOnce(Return(std::vector<std::string>({"HTTP"})));
+#else
EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypes(kPolicyAppId_))
.WillOnce(Return(std::vector<std::string>({"HTTP"})));
+#endif
// Act
- EXPECT_FALSE(policy_handler_.IsRequestTypeAllowed(kPolicyAppId_, type));
+ EXPECT_FALSE(
+ policy_handler_.IsRequestTypeAllowed(handle, kPolicyAppId_, type));
}
TEST_F(PolicyHandlerTest, IsRequestSubTypeAllowed) {
@@ -1413,16 +1555,6 @@ TEST_F(PolicyHandlerTest, IsRequestSubTypeAllowed) {
EXPECT_TRUE(policy_handler_.IsRequestSubTypeAllowed(kPolicyAppId_, subtype));
}
-TEST_F(PolicyHandlerTest, GetVehicleInfo) {
- // Arrange
- EnablePolicyAndPolicyManagerMock();
- // Check expectations
- EXPECT_CALL(*mock_policy_manager_, GetVehicleInfo())
- .WillOnce(Return(VehicleInfo()));
- // Act
- policy_handler_.GetVehicleInfo();
-}
-
TEST_F(PolicyHandlerTest, Increment_method_WithOneParameter) {
// Arrange
EnablePolicyAndPolicyManagerMock();
@@ -1658,7 +1790,8 @@ TEST_F(PolicyHandlerTest, OnSnapshotCreated_UrlNotAdded) {
.WillRepeatedly(SetArgReferee<1>(test_data));
policy_handler_.OnSnapshotCreated(msg, retry_delay_seconds, timeout_exchange);
#else // EXTERNAL_PROPRIETARY_MODE
- policy_handler_.OnSnapshotCreated(msg);
+ policy_handler_.OnSnapshotCreated(msg,
+ policy::PTUIterationType::DefaultIteration);
#endif // EXTERNAL_PROPRIETARY_MODE
}
@@ -1736,7 +1869,8 @@ TEST_F(PolicyHandlerTest, DISABLED_OnSnapshotCreated_UrlAdded) {
#endif // PROPRIETARY_MODE
EXPECT_CALL(*mock_policy_manager_, OnUpdateStarted());
- policy_handler_.OnSnapshotCreated(msg);
+ policy_handler_.OnSnapshotCreated(msg,
+ policy::PTUIterationType::DefaultIteration);
}
#endif // EXTERNAL_PROPRIETARY_MODE
@@ -1784,8 +1918,9 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentAllowed) {
connection_handler::DeviceHandle test_device_id = 100u;
EXPECT_CALL(app_manager_, connection_handler())
.WillOnce(ReturnRef(conn_handler));
+ EXPECT_CALL(app_manager_, applications()).WillRepeatedly(Return(app_set));
- EXPECT_CALL(conn_handler, GetDeviceID(kPolicyAppId_, _))
+ EXPECT_CALL(conn_handler, GetDeviceID(kDeviceId, _))
.WillOnce(DoAll(SetArgPointee<1>(test_device_id), Return(true)));
test_app.insert(mock_app_);
@@ -1795,12 +1930,13 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentAllowed) {
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
.WillOnce(Return(true));
+ EXPECT_CALL(
+ *mock_policy_manager_,
+ ReactOnUserDevConsentForApp(test_device_id, kPolicyAppId_, is_allowed));
EXPECT_CALL(*mock_policy_manager_,
- ReactOnUserDevConsentForApp(kPolicyAppId_, is_allowed));
- EXPECT_CALL(*mock_policy_manager_,
- SendNotificationOnPermissionsUpdated(kPolicyAppId_));
+ SendNotificationOnPermissionsUpdated(kDeviceId, kPolicyAppId_));
- policy_handler_.OnDeviceConsentChanged(kPolicyAppId_, is_allowed);
+ policy_handler_.OnDeviceConsentChanged(kDeviceId, is_allowed);
}
TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentNotAllowed) {
@@ -1808,27 +1944,29 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentNotAllowed) {
// Arrange
EnablePolicyAndPolicyManagerMock();
- connection_handler::DeviceHandle test_device_id = 100u;
+ connection_handler::DeviceHandle handle = 100u;
EXPECT_CALL(app_manager_, connection_handler())
.WillOnce(ReturnRef(conn_handler));
// Check expectations
- EXPECT_CALL(conn_handler, GetDeviceID(kPolicyAppId_, _))
- .WillOnce(DoAll(SetArgPointee<1>(test_device_id), Return(true)));
+ EXPECT_CALL(conn_handler, GetDeviceID(kMacAddr_, _))
+ .WillOnce(DoAll(SetArgPointee<1>(handle), Return(true)));
test_app.insert(mock_app_);
- EXPECT_CALL(*mock_app_, device()).WillOnce(Return(test_device_id));
+ EXPECT_CALL(*mock_app_, device()).WillOnce(Return(handle));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
.WillOnce(Return(true));
- EXPECT_CALL(*mock_policy_manager_, ReactOnUserDevConsentForApp(_, _))
+ EXPECT_CALL(*mock_policy_manager_,
+ ReactOnUserDevConsentForApp(handle, kPolicyAppId_, is_allowed))
.Times(0);
- EXPECT_CALL(*mock_policy_manager_, SendNotificationOnPermissionsUpdated(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ SendNotificationOnPermissionsUpdated(kMacAddr_, kPolicyAppId_))
.Times(0);
- policy_handler_.OnDeviceConsentChanged(kPolicyAppId_, is_allowed);
+ policy_handler_.OnDeviceConsentChanged(kMacAddr_, is_allowed);
}
TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_PredatePolicyNotAllowed) {
@@ -1839,8 +1977,9 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_PredatePolicyNotAllowed) {
connection_handler::DeviceHandle test_device_id = 100u;
EXPECT_CALL(app_manager_, connection_handler())
.WillOnce(ReturnRef(conn_handler));
+ EXPECT_CALL(app_manager_, applications()).WillRepeatedly(Return(app_set));
- EXPECT_CALL(conn_handler, GetDeviceID(kPolicyAppId_, _))
+ EXPECT_CALL(conn_handler, GetDeviceID(kMacAddr_, _))
.WillOnce(DoAll(SetArgPointee<1>(test_device_id), Return(true)));
test_app.insert(mock_app_);
@@ -1852,12 +1991,13 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_PredatePolicyNotAllowed) {
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
.WillOnce(Return(false));
+ EXPECT_CALL(
+ *mock_policy_manager_,
+ ReactOnUserDevConsentForApp(test_device_id, kPolicyAppId_, is_allowed));
EXPECT_CALL(*mock_policy_manager_,
- ReactOnUserDevConsentForApp(kPolicyAppId_, is_allowed));
- EXPECT_CALL(*mock_policy_manager_,
- SendNotificationOnPermissionsUpdated(kPolicyAppId_));
+ SendNotificationOnPermissionsUpdated(kMacAddr_, kPolicyAppId_));
- policy_handler_.OnDeviceConsentChanged(kPolicyAppId_, is_allowed);
+ policy_handler_.OnDeviceConsentChanged(kMacAddr_, is_allowed);
}
#ifdef ENABLE_SECURITY
#ifdef EXTERNAL_PROPRIETARY_MODE
@@ -1908,7 +2048,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_GetDefaultMacAddress) {
test_app.insert(mock_app_);
EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true));
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(app_manager_, connection_handler())
.WillOnce(ReturnRef(conn_handler));
@@ -1931,7 +2071,7 @@ void PolicyHandlerTest::GetAppIDForSending() {
// Check expectations
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(mock_session_observer,
GetDataOnDeviceID(
@@ -1953,47 +2093,47 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) {
// Arrange
EnablePolicyAndPolicyManagerMock();
- utils::SharedPtr<application_manager_test::MockApplication> mock_app_in_full =
- utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager_test::MockApplication> mock_app_in_full =
+ std::make_shared<application_manager_test::MockApplication>();
const uint32_t app_in_full_id = 1;
EXPECT_CALL(*mock_app_in_full, app_id())
.WillRepeatedly(Return(app_in_full_id));
- EXPECT_CALL(*mock_app_in_full, hmi_level())
+ EXPECT_CALL(*mock_app_in_full, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
ON_CALL(*mock_app_in_full, IsRegistered()).WillByDefault(Return(true));
test_app.insert(mock_app_in_full);
- utils::SharedPtr<application_manager_test::MockApplication>
+ std::shared_ptr<application_manager_test::MockApplication>
mock_app_in_limited =
- utils::MakeShared<application_manager_test::MockApplication>();
+ std::make_shared<application_manager_test::MockApplication>();
const uint32_t app_in_limited_id = 2;
EXPECT_CALL(*mock_app_in_limited, app_id())
.WillRepeatedly(Return(app_in_limited_id));
- EXPECT_CALL(*mock_app_in_limited, hmi_level())
+ EXPECT_CALL(*mock_app_in_limited, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_LIMITED));
ON_CALL(*mock_app_in_limited, IsRegistered()).WillByDefault(Return(true));
test_app.insert(mock_app_in_limited);
- utils::SharedPtr<application_manager_test::MockApplication>
+ std::shared_ptr<application_manager_test::MockApplication>
mock_app_in_background =
- utils::MakeShared<application_manager_test::MockApplication>();
+ std::make_shared<application_manager_test::MockApplication>();
const uint32_t app_in_background_id = 3;
EXPECT_CALL(*mock_app_in_background, app_id())
.WillRepeatedly(Return(app_in_background_id));
- EXPECT_CALL(*mock_app_in_background, hmi_level())
+ EXPECT_CALL(*mock_app_in_background, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_BACKGROUND));
ON_CALL(*mock_app_in_background, IsRegistered()).WillByDefault(Return(true));
test_app.insert(mock_app_in_background);
- utils::SharedPtr<application_manager_test::MockApplication> mock_app_in_none =
- utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager_test::MockApplication> mock_app_in_none =
+ std::make_shared<application_manager_test::MockApplication>();
const uint32_t app_in_none_id = 4;
EXPECT_CALL(*mock_app_in_none, app_id())
.WillRepeatedly(Return(app_in_none_id));
- EXPECT_CALL(*mock_app_in_none, hmi_level())
+ EXPECT_CALL(*mock_app_in_none, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_NONE));
EXPECT_CALL(*mock_app_in_none, IsRegistered()).Times(0);
@@ -2017,25 +2157,25 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) {
// Arrange
EnablePolicyAndPolicyManagerMock();
- utils::SharedPtr<application_manager_test::MockApplication>
+ std::shared_ptr<application_manager_test::MockApplication>
mock_app_in_none_1 =
- utils::MakeShared<application_manager_test::MockApplication>();
+ std::make_shared<application_manager_test::MockApplication>();
const uint32_t app_in_none_id_1 = 1;
EXPECT_CALL(*mock_app_in_none_1, app_id())
.WillRepeatedly(Return(app_in_none_id_1));
- EXPECT_CALL(*mock_app_in_none_1, hmi_level())
+ EXPECT_CALL(*mock_app_in_none_1, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
ON_CALL(*mock_app_in_none_1, IsRegistered()).WillByDefault(Return(true));
test_app.insert(mock_app_in_none_1);
- utils::SharedPtr<application_manager_test::MockApplication>
+ std::shared_ptr<application_manager_test::MockApplication>
mock_app_in_none_2 =
- utils::MakeShared<application_manager_test::MockApplication>();
+ std::make_shared<application_manager_test::MockApplication>();
const uint32_t app_in_none_id_2 = 2;
EXPECT_CALL(*mock_app_in_none_2, app_id())
.WillRepeatedly(Return(app_in_none_id_2));
- EXPECT_CALL(*mock_app_in_none_2, hmi_level())
+ EXPECT_CALL(*mock_app_in_none_2, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_NONE));
ON_CALL(*mock_app_in_none_2, IsRegistered()).WillByDefault(Return(true));
@@ -2058,63 +2198,6 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) {
EXPECT_EQ(app_in_none_id_1 || app_in_none_id_2, app_id);
}
-TEST_F(PolicyHandlerTest,
- SendMessageToSDK_SuitableAppPresent_ExpectedNotificationSending) {
- BinaryMessage msg;
- const std::string url = "test_url";
- EnablePolicyAndPolicyManagerMock();
- test_app.insert(mock_app_);
-
- EXPECT_CALL(app_manager_, application(kAppId1_))
- .WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
- EXPECT_CALL(*mock_app_, policy_app_id())
- .WillRepeatedly(Return(kPolicyAppId_));
- EXPECT_CALL(*mock_app_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_CALL(*mock_app_, IsRegistered()).WillRepeatedly(Return(true));
-
- const connection_handler::DeviceHandle test_device_id = 1u;
- EXPECT_CALL(*mock_app_, device()).WillRepeatedly(Return(test_device_id));
- EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_))
- .WillOnce(Return(kDeviceAllowed));
-
- // Act
- EXPECT_CALL(mock_message_helper_,
- SendPolicySnapshotNotification(kAppId1_, msg, url, _));
- EXPECT_TRUE(policy_handler_.SendMessageToSDK(msg, url));
-}
-
-TEST_F(PolicyHandlerTest,
- SendMessageToSDK_NoSuitableApp_ExpectedNotificationNotSent) {
- BinaryMessage msg;
- const std::string url = "test_url";
- EnablePolicyAndPolicyManagerMock();
- test_app.insert(mock_app_);
-
- EXPECT_CALL(app_manager_, application(kAppId1_))
- .WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
- EXPECT_CALL(*mock_app_, policy_app_id())
- .WillRepeatedly(Return(kPolicyAppId_));
- EXPECT_CALL(*mock_app_, hmi_level())
- .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
- EXPECT_CALL(*mock_app_, IsRegistered()).WillRepeatedly(Return(true));
-
- const connection_handler::DeviceHandle test_device_id = 1u;
- EXPECT_CALL(*mock_app_, device()).WillRepeatedly(Return(test_device_id));
- EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_))
- .WillOnce(Return(kDeviceDisallowed));
-
- // Expected to get 0 as application id so SDL does not have valid application
- // with such id
- EXPECT_CALL(app_manager_, application(0))
- .WillOnce(Return(
- utils::SharedPtr<application_manager_test::MockApplication>()));
-
- EXPECT_FALSE(policy_handler_.SendMessageToSDK(msg, url));
-}
-
TEST_F(PolicyHandlerTest, CanUpdate) {
GetAppIDForSending();
EXPECT_TRUE(policy_handler_.CanUpdate());
@@ -2122,12 +2205,12 @@ TEST_F(PolicyHandlerTest, CanUpdate) {
TEST_F(PolicyHandlerTest, CanUpdate_TwoApplicationForSending_SUCCESS) {
EnablePolicyAndPolicyManagerMock();
- utils::SharedPtr<application_manager_test::MockApplication> second_mock_app =
- utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager_test::MockApplication> second_mock_app =
+ std::make_shared<application_manager_test::MockApplication>();
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_CALL(*second_mock_app, hmi_level())
+ EXPECT_CALL(*second_mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED));
EXPECT_CALL(*second_mock_app, app_id()).WillRepeatedly(Return(kAppId2_));
@@ -2180,7 +2263,8 @@ TEST_F(PolicyHandlerTest,
_,
NULL,
_,
- _)).WillOnce(Return(1u));
+ _))
+ .WillOnce(Return(1u));
EXPECT_CALL(app_manager_, application(kConnectionKey_))
.WillOnce(Return(mock_app_));
@@ -2435,11 +2519,24 @@ TEST_F(PolicyHandlerTest,
#endif
}
+ACTION_P(SetEndpoint, endpoint) {
+ arg1 = endpoint;
+}
+
TEST_F(PolicyHandlerTest, GetLockScreenIconUrl_SUCCESS) {
EnablePolicyAndPolicyManagerMock();
- EXPECT_CALL(*mock_policy_manager_, GetLockScreenIconUrl());
- policy_handler_.GetLockScreenIconUrl();
+ const std::string url_str = "test_icon_url";
+ EndpointData data(url_str);
+
+ EndpointUrls endpoints;
+ endpoints.push_back(data);
+
+ const std::string service_type = "lock_screen_icon_url";
+ EXPECT_CALL(*mock_policy_manager_, GetUpdateUrls(service_type, _))
+ .WillOnce(SetEndpoint(endpoints));
+
+ EXPECT_EQ(url_str, policy_handler_.GetLockScreenIconUrl(kPolicyAppId_));
}
TEST_F(PolicyHandlerTest, RemoveListener_SUCCESS) {
@@ -2502,10 +2599,6 @@ TEST_F(PolicyHandlerTest, OnSystemError_SUCCESS) {
EXPECT_TRUE(waiter1.Wait(auto_lock));
}
-ACTION_P(SetEndpoint, endpoint) {
- arg1 = endpoint;
-}
-
TEST_F(PolicyHandlerTest, RemoteAppsUrl_EndpointsEmpty_UNSUCCESS) {
EnablePolicyAndPolicyManagerMock();
@@ -2536,6 +2629,666 @@ TEST_F(PolicyHandlerTest, RemoteAppsUrl_SUCCESS) {
EXPECT_EQ(url, policy_handler_.RemoteAppsUrl());
}
+TEST_F(PolicyHandlerTest, OnSetCloudAppProperties_AllProperties_SUCCESS) {
+ EnablePolicyAndPolicyManagerMock();
+
+ bool enabled = true;
+ std::string app_name = "anAppName";
+ std::string auth_token = "anAuthToken";
+ std::string cloud_transport_type = "aTransportType";
+ mobile_apis::HybridAppPreference::eType hybrid_app_preference =
+ mobile_apis::HybridAppPreference::CLOUD;
+ std::string hybrid_app_preference_str = "CLOUD";
+ std::string endpoint = "anEndpoint";
+ const policy::AppProperties app_properties(endpoint,
+ " ",
+ enabled,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference_str);
+
+ StringArray nicknames_vec;
+ nicknames_vec.push_back(app_name);
+
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+ smart_objects::SmartObject properties(smart_objects::SmartType_Map);
+ smart_objects::SmartObject nicknames(smart_objects::SmartType_Array);
+
+ properties[strings::app_id] = kPolicyAppId_;
+ nicknames[0] = app_name;
+ properties[strings::nicknames] = nicknames;
+ properties[strings::enabled] = enabled;
+ properties[strings::auth_token] = auth_token;
+ properties[strings::cloud_transport_type] = cloud_transport_type;
+ properties[strings::hybrid_app_preference] = hybrid_app_preference;
+ properties[strings::endpoint] = endpoint;
+ message[strings::msg_params][strings::properties] = properties;
+
+ application_manager_test::MockPolicyHandlerObserver policy_handler_observer;
+ policy_handler_.add_listener(&policy_handler_observer);
+
+ EXPECT_CALL(*mock_policy_manager_, InitCloudApp(kPolicyAppId_));
+ EXPECT_CALL(*mock_policy_manager_,
+ SetCloudAppEnabled(kPolicyAppId_, enabled));
+ EXPECT_CALL(*mock_policy_manager_,
+ SetAppNicknames(kPolicyAppId_, nicknames_vec));
+ EXPECT_CALL(*mock_policy_manager_,
+ SetAppAuthToken(kPolicyAppId_, auth_token));
+ EXPECT_CALL(*mock_policy_manager_,
+ SetAppCloudTransportType(kPolicyAppId_, cloud_transport_type));
+ EXPECT_CALL(*mock_policy_manager_,
+ SetHybridAppPreference(kPolicyAppId_, hybrid_app_preference_str));
+ EXPECT_CALL(*mock_policy_manager_, SetAppEndpoint(kPolicyAppId_, endpoint));
+ EXPECT_CALL(*mock_policy_manager_, GetAppProperties(kPolicyAppId_, _))
+ .WillOnce(DoAll(SetArgReferee<1>(app_properties), Return(true)));
+ EXPECT_CALL(app_manager_, RefreshCloudAppInformation());
+ EXPECT_CALL(policy_handler_observer,
+ OnAuthTokenUpdated(kPolicyAppId_, auth_token));
+
+ policy_handler_.OnSetCloudAppProperties(message);
+}
+
+TEST_F(PolicyHandlerTest, GetCloudAppParameters_AllProperties_SUCCESS) {
+ EnablePolicyAndPolicyManagerMock();
+
+ bool enabled = true;
+ std::string certificate = "aCertificate";
+ std::string auth_token = "anAuthToken";
+ std::string cloud_transport_type = "aTransportType";
+ std::string hybrid_app_preference_str = "CLOUD";
+ std::string endpoint = "anEndpoint";
+
+ const policy::AppProperties app_properties(endpoint,
+ certificate,
+ enabled,
+ auth_token,
+ cloud_transport_type,
+ hybrid_app_preference_str);
+
+ application_manager_test::MockPolicyHandlerObserver policy_handler_observer;
+ policy_handler_.add_listener(&policy_handler_observer);
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppProperties(kPolicyAppId_, _))
+ .WillOnce(DoAll(SetArgReferee<1>(app_properties), Return(true)));
+
+ policy::AppProperties out_app_properties;
+ EXPECT_TRUE(
+ policy_handler_.GetAppProperties(kPolicyAppId_, out_app_properties));
+ EXPECT_EQ(app_properties.enabled, out_app_properties.enabled);
+ EXPECT_EQ(app_properties.endpoint, out_app_properties.endpoint);
+ EXPECT_EQ(app_properties.certificate, out_app_properties.certificate);
+ EXPECT_EQ(app_properties.auth_token, out_app_properties.auth_token);
+ EXPECT_EQ(app_properties.transport_type, out_app_properties.transport_type);
+ EXPECT_EQ(app_properties.hybrid_app_preference,
+ out_app_properties.hybrid_app_preference);
+}
+
+TEST_F(PolicyHandlerTest, SendOnAppPropertiesChangeNotification_SUCCESS) {
+ using namespace smart_objects;
+ auto notification = std::make_shared<SmartObject>(SmartType_Null);
+
+ ON_CALL(app_manager_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+
+ EXPECT_CALL(mock_message_helper_,
+ CreateOnAppPropertiesChangeNotification(kPolicyAppId_, _))
+ .WillOnce(Return(notification));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(notification, commands::Command::SOURCE_HMI));
+
+ policy_handler_.SendOnAppPropertiesChangeNotification(kPolicyAppId_);
+}
+
+TEST_F(PolicyHandlerTest, GetApplicationPolicyIDs_GetEmptyIDsVector_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ std::vector<std::string> app_ids_vector;
+ ON_CALL(*mock_policy_manager_, GetApplicationPolicyIDs())
+ .WillByDefault(Return(app_ids_vector));
+
+ EXPECT_CALL(*mock_policy_manager_, GetApplicationPolicyIDs());
+ EXPECT_EQ(app_ids_vector, policy_handler_.GetApplicationPolicyIDs());
+}
+
+TEST_F(PolicyHandlerTest,
+ GetApplicationPolicyIDs_GetIDFromAppIDsVectorWithWrongIDs_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ std::vector<std::string> app_ids_vector = {policy::kDefaultId,
+ policy::kPreDataConsentId,
+ policy::kDeviceId,
+ kPolicyAppId_};
+ ON_CALL(*mock_policy_manager_, GetApplicationPolicyIDs())
+ .WillByDefault(Return(app_ids_vector));
+
+ EXPECT_CALL(*mock_policy_manager_, GetApplicationPolicyIDs());
+
+ auto policy_ids = policy_handler_.GetApplicationPolicyIDs();
+ EXPECT_NE(app_ids_vector, policy_ids);
+ EXPECT_EQ(1u, policy_ids.size());
+ EXPECT_EQ(kPolicyAppId_, policy_ids[0]);
+}
+
+TEST_F(PolicyHandlerTest, CheckCloudAppEnabled_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ policy::AppProperties out_app_properties;
+ out_app_properties.enabled = true;
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppProperties(kPolicyAppId_, _))
+ .WillOnce(DoAll(SetArgReferee<1>(out_app_properties), Return(true)));
+ EXPECT_TRUE(policy_handler_.CheckCloudAppEnabled(kPolicyAppId_));
+}
+
+TEST_F(PolicyHandlerTest, CheckCloudAppNotEnabled_SUCCESS) {
+ ChangePolicyManagerToMock();
+ EXPECT_CALL(*mock_policy_manager_, GetAppProperties(kPolicyAppId_, _));
+ EXPECT_FALSE(policy_handler_.CheckCloudAppEnabled(kPolicyAppId_));
+}
+
+TEST_F(PolicyHandlerTest, OnLocalAppAdded_SUCCESS) {
+ ChangePolicyManagerToMock();
+ EXPECT_CALL(*mock_policy_manager_, OnLocalAppAdded());
+ policy_handler_.OnLocalAppAdded();
+}
+
+TEST_F(PolicyHandlerTest, GetAppPropertiesStatus_NoPropertiesChanged) {
+ ChangePolicyManagerToMock();
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppProperties(kPolicyAppId_, _))
+ .WillOnce(Return(false));
+ EXPECT_CALL(*mock_policy_manager_, GetInitialAppData(kPolicyAppId_, _, _))
+ .WillOnce(Return(false));
+ EXPECT_EQ(policy::PolicyHandlerInterface::AppPropertiesState::NO_CHANGES,
+ policy_handler_.GetAppPropertiesStatus(properties, kPolicyAppId_));
+}
+
+TEST_F(PolicyHandlerTest,
+ GetAppPropertiesStatus_EnableFlagSwitchChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ policy::AppProperties app_properties;
+ app_properties.enabled = false;
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::enabled] = !app_properties.enabled;
+
+ SetExpectationsAndCheckCloudAppPropertiesStatus(
+ app_properties,
+ properties,
+ policy::PolicyHandlerInterface::AppPropertiesState::ENABLED_FLAG_SWITCH);
+}
+
+TEST_F(PolicyHandlerTest,
+ GetAppPropertiesStatus_EnableFlagSwitchNotChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ policy::AppProperties app_properties;
+ app_properties.enabled = false;
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::enabled] = app_properties.enabled;
+
+ SetExpectationsAndCheckCloudAppPropertiesStatus(
+ app_properties,
+ properties,
+ policy::PolicyHandlerInterface::AppPropertiesState::NO_CHANGES);
+}
+
+TEST_F(PolicyHandlerTest, GetAppPropertiesStatus_AuthTokenChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ const std::string kCurrentToken = "kCurrentToken";
+ const std::string kNewToken = "kNewToken";
+
+ policy::AppProperties app_properties;
+ app_properties.auth_token = kCurrentToken;
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::auth_token] = kNewToken;
+
+ SetExpectationsAndCheckCloudAppPropertiesStatus(
+ app_properties,
+ properties,
+ policy::PolicyHandlerInterface::AppPropertiesState::AUTH_TOKEN_CHANGED);
+}
+
+TEST_F(PolicyHandlerTest, GetAppPropertiesStatus_AuthTokenNotChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ const std::string kCurrentToken = "kCurrentToken";
+
+ policy::AppProperties app_properties;
+ app_properties.auth_token = kCurrentToken;
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::auth_token] = app_properties.auth_token;
+
+ SetExpectationsAndCheckCloudAppPropertiesStatus(
+ app_properties,
+ properties,
+ policy::PolicyHandlerInterface::AppPropertiesState::NO_CHANGES);
+}
+
+TEST_F(PolicyHandlerTest, GetAppPropertiesStatus_TransportTypeChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ const std::string kCurrentTransportType = "kCurrentTransportType";
+ const std::string kNewTransportType = "kNewTransportType";
+
+ policy::AppProperties app_properties;
+ app_properties.transport_type = kCurrentTransportType;
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::cloud_transport_type] = kNewTransportType;
+
+ SetExpectationsAndCheckCloudAppPropertiesStatus(
+ app_properties,
+ properties,
+ policy::PolicyHandlerInterface::AppPropertiesState::
+ TRANSPORT_TYPE_CHANGED);
+}
+
+TEST_F(PolicyHandlerTest,
+ GetAppPropertiesStatus_TransportTypeNotChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ const std::string kCurrentTransportType = "kCurrentTransportType";
+
+ policy::AppProperties app_properties;
+ app_properties.transport_type = kCurrentTransportType;
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::cloud_transport_type] = app_properties.transport_type;
+ SetExpectationsAndCheckCloudAppPropertiesStatus(
+ app_properties,
+ properties,
+ policy::PolicyHandlerInterface::AppPropertiesState::NO_CHANGES);
+}
+
+TEST_F(PolicyHandlerTest, GetAppPropertiesStatus_EndPointChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ const std::string kCurrentEndPoint = "kCurrentEndPoint";
+ const std::string kNewEndPoint = "kNewEndPoint";
+
+ policy::AppProperties app_properties;
+ app_properties.endpoint = kCurrentEndPoint;
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::endpoint] = kNewEndPoint;
+
+ SetExpectationsAndCheckCloudAppPropertiesStatus(
+ app_properties,
+ properties,
+ policy::PolicyHandlerInterface::AppPropertiesState::ENDPOINT_CHANGED);
+}
+
+TEST_F(PolicyHandlerTest, GetAppPropertiesStatus_EndPointNotChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ const std::string kCurrentEndPoint = "kCurrentEndPoint";
+
+ policy::AppProperties app_properties;
+ app_properties.endpoint = kCurrentEndPoint;
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::endpoint] = app_properties.endpoint;
+
+ SetExpectationsAndCheckCloudAppPropertiesStatus(
+ app_properties,
+ properties,
+ policy::PolicyHandlerInterface::AppPropertiesState::NO_CHANGES);
+}
+
+TEST_F(PolicyHandlerTest, GetAppPropertiesStatus_NicknameChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::nicknames] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ properties[strings::nicknames].asArray()->push_back(
+ smart_objects::SmartObject(kFakeNickname));
+
+ std::shared_ptr<policy::StringArray> nicknames =
+ std::make_shared<policy::StringArray>();
+
+ const auto expected_app_properties_state =
+ policy::PolicyHandlerInterface::AppPropertiesState::NICKNAMES_CHANGED;
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppProperties(kPolicyAppId_, _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_policy_manager_, GetInitialAppData(kPolicyAppId_, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(*nicknames), Return(true)));
+ EXPECT_EQ(expected_app_properties_state,
+ policy_handler_.GetAppPropertiesStatus(properties, kPolicyAppId_));
+}
+
+TEST_F(PolicyHandlerTest,
+ GetAppPropertiesStatus_RemoveNickname_NicknamesChanged) {
+ ChangePolicyManagerToMock();
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::nicknames] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ properties[strings::nicknames].asArray()->push_back(
+ smart_objects::SmartObject(kFakeNickname));
+
+ auto nicknames = std::make_shared<policy::StringArray>(2, kFakeNickname);
+
+ const auto expected_app_properties_state =
+ policy::PolicyHandlerInterface::AppPropertiesState::NICKNAMES_CHANGED;
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppProperties(kPolicyAppId_, _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_policy_manager_, GetInitialAppData(kPolicyAppId_, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(*nicknames), Return(true)));
+ EXPECT_EQ(expected_app_properties_state,
+ policy_handler_.GetAppPropertiesStatus(properties, kPolicyAppId_));
+}
+
+TEST_F(PolicyHandlerTest, GetAppPropertiesStatus_NicknameNotChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::nicknames] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ properties[strings::nicknames].asArray()->push_back(
+ smart_objects::SmartObject(kFakeNickname));
+
+ std::shared_ptr<policy::StringArray> nicknames =
+ std::make_shared<policy::StringArray>();
+ nicknames->push_back(kFakeNickname);
+
+ const auto expected_app_properties_state =
+ policy::PolicyHandlerInterface::AppPropertiesState::NO_CHANGES;
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppProperties(kPolicyAppId_, _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_policy_manager_, GetInitialAppData(kPolicyAppId_, _, _))
+ .WillOnce(DoAll(SetArgPointee<1>(*nicknames), Return(true)));
+ EXPECT_EQ(expected_app_properties_state,
+ policy_handler_.GetAppPropertiesStatus(properties, kPolicyAppId_));
+}
+
+TEST_F(PolicyHandlerTest, GetAppPropertiesStatus_HybridAppChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ const auto kCurrentHybridAppProperties =
+ mobile_apis::HybridAppPreference::eType::CLOUD;
+ const auto kNewHybridAppProperties =
+ mobile_apis::HybridAppPreference::eType::MOBILE;
+
+ policy::AppProperties app_properties;
+ smart_objects::EnumConversionHelper<mobile_apis::HybridAppPreference::eType>::
+ EnumToString(kCurrentHybridAppProperties,
+ &app_properties.hybrid_app_preference);
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::hybrid_app_preference] = kNewHybridAppProperties;
+
+ SetExpectationsAndCheckCloudAppPropertiesStatus(
+ app_properties,
+ properties,
+ policy::PolicyHandlerInterface::AppPropertiesState::
+ HYBRYD_APP_PROPERTIES_CHANGED);
+}
+
+TEST_F(PolicyHandlerTest, GetAppPropertiesStatus_HybridAppNotChanged_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ const auto kCurrentHybridAppProperties =
+ mobile_apis::HybridAppPreference::eType::CLOUD;
+
+ policy::AppProperties app_properties;
+ smart_objects::EnumConversionHelper<mobile_apis::HybridAppPreference::eType>::
+ EnumToString(kCurrentHybridAppProperties,
+ &app_properties.hybrid_app_preference);
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+ properties[strings::hybrid_app_preference] = kCurrentHybridAppProperties;
+
+ SetExpectationsAndCheckCloudAppPropertiesStatus(
+ app_properties,
+ properties,
+ policy::PolicyHandlerInterface::AppPropertiesState::NO_CHANGES);
+}
+
+TEST_F(PolicyHandlerTest, GetAppPropertiesStatus_PolicyDisabled_FAIL) {
+ ChangePolicyManagerToMock();
+
+ EXPECT_CALL(policy_settings_, enable_policy()).WillOnce(Return(false));
+ policy_handler_.LoadPolicyLibrary();
+
+ smart_objects::SmartObject properties;
+ properties[strings::app_id] = kPolicyAppId_;
+
+ EXPECT_CALL(*mock_policy_manager_, GetAppProperties(_, _)).Times(0);
+ EXPECT_CALL(*mock_policy_manager_, GetInitialAppData(_, _, _)).Times(0);
+ const auto expected_app_properties_state =
+ policy::PolicyHandlerInterface::AppPropertiesState::NO_CHANGES;
+ EXPECT_EQ(expected_app_properties_state,
+ policy_handler_.GetAppPropertiesStatus(properties, kPolicyAppId_));
+}
+
+TEST_F(PolicyHandlerTest, GetEnabledLocalApps_SUCCESS) {
+ ChangePolicyManagerToMock();
+ std::vector<std::string> enabled_local_apps;
+
+ EXPECT_CALL(*mock_policy_manager_, GetEnabledLocalApps())
+ .WillOnce(Return(enabled_local_apps));
+ EXPECT_EQ(enabled_local_apps, policy_handler_.GetEnabledLocalApps());
+
+ enabled_local_apps.push_back("local_app");
+ EXPECT_CALL(*mock_policy_manager_, GetEnabledLocalApps())
+ .WillOnce(Return(enabled_local_apps));
+ EXPECT_EQ(enabled_local_apps, policy_handler_.GetEnabledLocalApps());
+}
+
+TEST_F(PolicyHandlerTest, PushAppIdToPTUQueue_PolicyEnabled_SUCCESS) {
+ ChangePolicyManagerToMock();
+ const uint32_t expected_apps_count = 1u;
+ EXPECT_CALL(*mock_policy_manager_,
+ UpdatePTUReadyAppsCount(expected_apps_count));
+ policy_handler_.PushAppIdToPTUQueue(kAppId1_);
+ EXPECT_EQ(expected_apps_count,
+ policy_handler_.applications_ptu_queue_.size());
+}
+
+TEST_F(PolicyHandlerTest, PushAppIdToPTUQueue_PolicyDisabled_FAIL) {
+ ChangePolicyManagerToMock();
+
+ const uint32_t expected_apps_count = 0u;
+ EXPECT_CALL(policy_settings_, enable_policy()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_policy_manager_,
+ UpdatePTUReadyAppsCount(expected_apps_count))
+ .Times(0);
+
+ policy_handler_.LoadPolicyLibrary();
+ policy_handler_.PushAppIdToPTUQueue(kAppId1_);
+ EXPECT_EQ(expected_apps_count,
+ policy_handler_.applications_ptu_queue_.size());
+}
+
+TEST_F(PolicyHandlerTest, StopRetrySequence_PolicyEnabled_SUCCESS) {
+ ChangePolicyManagerToMock();
+ EXPECT_CALL(*mock_policy_manager_, StopRetrySequence());
+ policy_handler_.StopRetrySequence();
+}
+
+TEST_F(PolicyHandlerTest, StopRetrySequence_PolicyDisabled_FAIL) {
+ ChangePolicyManagerToMock();
+
+ EXPECT_CALL(policy_settings_, enable_policy()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_policy_manager_, StopRetrySequence()).Times(0);
+
+ policy_handler_.LoadPolicyLibrary();
+ policy_handler_.StopRetrySequence();
+}
+
+TEST_F(PolicyHandlerTest, GetPolicyTableData_PolicyEnabled_SUCCESS) {
+ ChangePolicyManagerToMock();
+ Json::Value expected_table_data(Json::objectValue);
+ expected_table_data["test_key"] = "test_value";
+ EXPECT_CALL(*mock_policy_manager_, GetPolicyTableData())
+ .WillOnce(Return(expected_table_data));
+ EXPECT_EQ(expected_table_data, policy_handler_.GetPolicyTableData());
+}
+
+TEST_F(PolicyHandlerTest, GetPolicyTableData_PolicyDisabled_FAIL) {
+ ChangePolicyManagerToMock();
+
+ EXPECT_CALL(policy_settings_, enable_policy()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_policy_manager_, GetPolicyTableData()).Times(0);
+
+ policy_handler_.LoadPolicyLibrary();
+
+ Json::Value expected_table_data;
+ EXPECT_EQ(expected_table_data, policy_handler_.GetPolicyTableData());
+}
+
+TEST_F(PolicyHandlerTest, GetRemovedVehicleDataItems_PolicyEnabled_SUCCESS) {
+ using rpc::policy_table_interface_base::VehicleDataItem;
+
+ ChangePolicyManagerToMock();
+
+ std::vector<VehicleDataItem> expected_removed_items;
+ expected_removed_items.push_back(VehicleDataItem());
+
+ EXPECT_CALL(*mock_policy_manager_, GetRemovedVehicleDataItems())
+ .WillOnce(Return(expected_removed_items));
+
+ const auto& actually_removed_items =
+ policy_handler_.GetRemovedVehicleDataItems();
+ ASSERT_EQ(expected_removed_items.size(), actually_removed_items.size());
+ EXPECT_TRUE(expected_removed_items[0] == actually_removed_items[0]);
+}
+
+TEST_F(PolicyHandlerTest, GetRemovedVehicleDataItems_PolicyDisabled_FAIL) {
+ using rpc::policy_table_interface_base::VehicleDataItem;
+
+ ChangePolicyManagerToMock();
+
+ EXPECT_CALL(policy_settings_, enable_policy()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_policy_manager_, GetRemovedVehicleDataItems()).Times(0);
+
+ policy_handler_.LoadPolicyLibrary();
+
+ EXPECT_TRUE(policy_handler_.GetRemovedVehicleDataItems().empty());
+}
+
+TEST_F(PolicyHandlerTest, PopAppIdFromPTUQueue_PolicyEnabled_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ policy_handler_.PushAppIdToPTUQueue(kAppId1_);
+ ASSERT_EQ(1u, policy_handler_.applications_ptu_queue_.size());
+
+ policy_handler_.PopAppIdFromPTUQueue();
+ EXPECT_EQ(0u, policy_handler_.applications_ptu_queue_.size());
+}
+
+TEST_F(PolicyHandlerTest, PopAppIdFromPTUQueue_PolicyDisabled_FAIL) {
+ ChangePolicyManagerToMock();
+
+ const uint32_t expected_apps_count = 0u;
+ EXPECT_CALL(policy_settings_, enable_policy()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_policy_manager_,
+ UpdatePTUReadyAppsCount(expected_apps_count))
+ .Times(0);
+
+ policy_handler_.LoadPolicyLibrary();
+ policy_handler_.PopAppIdFromPTUQueue();
+ EXPECT_EQ(expected_apps_count,
+ policy_handler_.applications_ptu_queue_.size());
+}
+
+TEST_F(PolicyHandlerTest, OnLocalAppAdded_PolicyEnabled_SUCCESS) {
+ ChangePolicyManagerToMock();
+ EXPECT_CALL(*mock_policy_manager_, OnLocalAppAdded());
+ policy_handler_.OnLocalAppAdded();
+}
+
+TEST_F(PolicyHandlerTest, OnLocalAppAdded_PolicyDisabled_FAIL) {
+ ChangePolicyManagerToMock();
+
+ EXPECT_CALL(policy_settings_, enable_policy()).WillOnce(Return(false));
+ EXPECT_CALL(*mock_policy_manager_, OnLocalAppAdded()).Times(0);
+
+ policy_handler_.LoadPolicyLibrary();
+ policy_handler_.OnLocalAppAdded();
+}
+
+TEST_F(PolicyHandlerTest, OnPermissionsUpdated_PolicyEnabled_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_))
+ .WillOnce(Return(mock_app_));
+
+ const rpc::Optional<rpc::Boolean> encryption_requiered;
+ EXPECT_CALL(*mock_policy_manager_, GetAppEncryptionRequired(kPolicyAppId_))
+ .WillOnce(Return(encryption_requiered));
+ EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
+
+ Permissions app_permissions;
+ EXPECT_CALL(mock_message_helper_,
+ SendOnPermissionsChangeNotification(kAppId1_, _, _, _));
+ policy_handler_.OnPermissionsUpdated(
+ kDeviceId_, kPolicyAppId_, app_permissions);
+}
+
+TEST_F(PolicyHandlerTest, OnPermissionsUpdated_PolicyDisabled_FAIL) {
+ ChangePolicyManagerToMock();
+
+ EXPECT_CALL(policy_settings_, enable_policy()).WillOnce(Return(false));
+ policy_handler_.LoadPolicyLibrary();
+
+ EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_)).Times(0);
+ EXPECT_CALL(*mock_policy_manager_, GetAppEncryptionRequired(kPolicyAppId_))
+ .Times(0);
+ EXPECT_CALL(*mock_app_, app_id()).Times(0);
+
+ Permissions app_permissions;
+ EXPECT_CALL(mock_message_helper_,
+ SendOnPermissionsChangeNotification(_, _, _, _))
+ .Times(0);
+ policy_handler_.OnPermissionsUpdated(
+ kDeviceId_, kPolicyAppId_, app_permissions);
+}
+
+TEST_F(PolicyHandlerTest, IsNewApplication_PolicyEnabled_SUCCESS) {
+ ChangePolicyManagerToMock();
+
+ EXPECT_CALL(*mock_policy_manager_, IsNewApplication(kPolicyAppId_))
+ .WillOnce(Return(true));
+ EXPECT_TRUE(policy_handler_.IsNewApplication(kPolicyAppId_));
+}
+
+TEST_F(PolicyHandlerTest, IsNewApplication_PolicyDisabled_FAIL) {
+ ChangePolicyManagerToMock();
+
+ EXPECT_CALL(policy_settings_, enable_policy()).WillOnce(Return(false));
+ policy_handler_.LoadPolicyLibrary();
+
+ EXPECT_CALL(*mock_policy_manager_, IsNewApplication(kPolicyAppId_)).Times(0);
+ EXPECT_FALSE(policy_handler_.IsNewApplication(kPolicyAppId_));
+}
+
} // namespace policy_handler_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/rc_policy_handler_test.cc b/src/components/application_manager/test/rc_policy_handler_test.cc
index 0d9cbfe6aa..cc9f741d28 100644
--- a/src/components/application_manager/test/rc_policy_handler_test.cc
+++ b/src/components/application_manager/test/rc_policy_handler_test.cc
@@ -30,34 +30,34 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <fstream>
#include <string>
#include <vector>
-#include <fstream>
#include "gmock/gmock.h"
-#include "application_manager/policies/policy_handler.h"
-#include "application_manager/policies/delegates/app_permission_delegate.h"
-#include "policy/mock_cache_manager.h"
#include "application_manager/mock_message_helper.h"
+#include "application_manager/policies/delegates/app_permission_delegate.h"
+#include "application_manager/policies/policy_handler.h"
#include "connection_handler/mock_connection_handler_settings.h"
-#include "policy/policy_types.h"
-#include "policy/access_remote.h"
#include "json/reader.h"
-#include "json/writer.h"
#include "json/value.h"
+#include "json/writer.h"
+#include "policy/access_remote.h"
+#include "policy/mock_cache_manager.h"
+#include "policy/policy_types.h"
#include "smart_objects/smart_object.h"
-#include "utils/make_shared.h"
-#include "utils/custom_string.h"
-#include "interfaces/MOBILE_API.h"
-#include "policy/mock_policy_settings.h"
+
#include "application_manager/mock_application.h"
-#include "policy/usage_statistics/mock_statistics_manager.h"
-#include "protocol_handler/mock_session_observer.h"
-#include "connection_handler/mock_connection_handler.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/policies/mock_policy_handler_observer.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/policies/mock_policy_handler_observer.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "interfaces/MOBILE_API.h"
#include "policy/mock_policy_manager.h"
+#include "policy/mock_policy_settings.h"
+#include "policy/usage_statistics/mock_statistics_manager.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "utils/custom_string.h"
namespace test {
namespace components {
@@ -94,13 +94,13 @@ class RCPolicyHandlerTest : public ::testing::Test {
protected:
NiceMock<policy_handler_test::MockPolicySettings> policy_settings_;
- utils::SharedPtr<application_manager_test::MockApplication> mock_app_;
+ std::shared_ptr<application_manager_test::MockApplication> mock_app_;
connection_handler_test::MockConnectionHandler conn_handler;
protocol_handler_test::MockSessionObserver mock_session_observer;
components::usage_statistics_test::MockStatisticsManager
mock_statistics_manager_;
PolicyHandler policy_handler_;
- utils::SharedPtr<policy_manager_test::MockPolicyManager> mock_policy_manager_;
+ std::shared_ptr<policy_manager_test::MockPolicyManager> mock_policy_manager_;
application_manager_test::MockApplicationManager app_manager_;
const std::string kPolicyAppId_;
const std::string kMacAddr_;
@@ -122,15 +122,15 @@ class RCPolicyHandlerTest : public ::testing::Test {
ON_CALL(app_manager_, applications()).WillByDefault(Return(app_set));
ON_CALL(policy_settings_, enable_policy()).WillByDefault(Return(true));
mock_policy_manager_ =
- utils::MakeShared<policy_manager_test::MockPolicyManager>();
- ASSERT_TRUE(mock_policy_manager_.valid());
+ std::make_shared<policy_manager_test::MockPolicyManager>();
+ ASSERT_TRUE(mock_policy_manager_.use_count() != 0);
ON_CALL(app_manager_, connection_handler())
.WillByDefault(ReturnRef(conn_handler));
ON_CALL(conn_handler, get_session_observer())
.WillByDefault(ReturnRef(mock_session_observer));
- mock_app_ = utils::MakeShared<application_manager_test::MockApplication>();
+ mock_app_ = std::make_shared<application_manager_test::MockApplication>();
}
virtual void TearDown() OVERRIDE {
@@ -151,62 +151,10 @@ class RCPolicyHandlerTest : public ::testing::Test {
}
};
-TEST_F(RCPolicyHandlerTest,
- SendMessageToSDK_RemoteControlInvalidMobileAppId_UNSUCCESS) {
- // Precondition
- BinaryMessage msg;
- EnablePolicyAndPolicyManagerMock();
-
- EXPECT_CALL(app_manager_, applications()).WillOnce(Return(app_set));
- test_app.insert(mock_app_);
-
- ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId1_));
- ON_CALL(*mock_app_, hmi_level())
- .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true));
-
- EXPECT_CALL(app_manager_, application(kAppId1_))
- .WillRepeatedly(Return(mock_app_));
- const std::string empty_mobile_app_id("");
- EXPECT_CALL(*mock_app_, policy_app_id())
- .WillOnce(Return(empty_mobile_app_id));
-
- EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_))
- .WillOnce(Return(kDeviceAllowed));
-
- EXPECT_CALL(mock_message_helper_, SendPolicySnapshotNotification(_, _, _, _))
- .Times(0);
- EXPECT_FALSE(policy_handler_.SendMessageToSDK(msg, kUrl_));
-}
-
-TEST_F(RCPolicyHandlerTest, SendMessageToSDK_RemoteControl_SUCCESS) {
- BinaryMessage msg;
- EnablePolicyAndPolicyManagerMock();
- EXPECT_CALL(app_manager_, applications()).WillOnce(Return(app_set));
- test_app.insert(mock_app_);
-
- ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId1_));
- ON_CALL(*mock_app_, hmi_level())
- .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true));
-
- EXPECT_CALL(app_manager_, application(kAppId1_))
- .WillRepeatedly(Return(mock_app_));
-
- EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
-
- EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_))
- .WillOnce(Return(kDeviceAllowed));
-
- EXPECT_CALL(mock_message_helper_,
- SendPolicySnapshotNotification(kAppId1_, _, kUrl_, _));
- EXPECT_TRUE(policy_handler_.SendMessageToSDK(msg, kUrl_));
-}
-
TEST_F(RCPolicyHandlerTest, OnUpdateHMILevel_InvalidApp_UNSUCCESS) {
EnablePolicyAndPolicyManagerMock();
- utils::SharedPtr<application_manager_test::MockApplication> invalid_app;
+ std::shared_ptr<application_manager_test::MockApplication> invalid_app;
EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(invalid_app));
EXPECT_CALL(mock_message_helper_, StringToHMILevel(_)).Times(0);
@@ -293,7 +241,7 @@ TEST_F(RCPolicyHandlerTest,
TEST_F(RCPolicyHandlerTest, OnUpdateHMIStatus_InvalidApp_UNSUCCESS) {
EnablePolicyAndPolicyManagerMock();
- utils::SharedPtr<application_manager_test::MockApplication> invalid_app;
+ std::shared_ptr<application_manager_test::MockApplication> invalid_app;
EXPECT_CALL(app_manager_, application(_, _)).WillOnce(Return(invalid_app));
EXPECT_CALL(app_manager_, ChangeAppsHMILevel(_, _)).Times(0);
@@ -379,7 +327,7 @@ TEST_F(RCPolicyHandlerTest, CheckHMIType_ValidTypes_SUCCESS) {
mobile_apis::AppHMIType::eType hmi = mobile_apis::AppHMIType::MEDIA;
const smart_objects::SmartObjectSPtr app_types =
- utils::MakeShared<smart_objects::SmartObject>(
+ std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Array);
(*app_types)[strings::app_hmi_type][0] = mobile_apis::AppHMIType::MEDIA;
(*app_types)[strings::app_hmi_type][1] =
diff --git a/src/components/application_manager/test/request_controller/request_controller_test.cc b/src/components/application_manager/test/request_controller/request_controller_test.cc
index c2912fdc0b..71e12b2825 100644
--- a/src/components/application_manager/test/request_controller/request_controller_test.cc
+++ b/src/components/application_manager/test/request_controller/request_controller_test.cc
@@ -32,24 +32,23 @@
#include <stdint.h>
-#include "gtest/gtest.h"
+#include "application_manager/mock_request.h"
#include "application_manager/request_controller.h"
#include "application_manager/request_info.h"
-#include "application_manager/mock_request.h"
-#include "utils/shared_ptr.h"
-#include "smart_objects/smart_object.h"
+#include "gtest/gtest.h"
+
+#include "application_manager/application_impl.h"
#include "application_manager/commands/command_request_impl.h"
#include "application_manager/message_helper.h"
-#include "application_manager/application_impl.h"
-#include "utils/make_shared.h"
-#include "application_manager/mock_application_manager.h"
+#include "smart_objects/smart_object.h"
+
#include "application_manager/event_engine/event_dispatcher.h"
-#include "resumption/last_state.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_request_controller_settings.h"
#include "application_manager/policies/policy_handler.h"
-#include "application_manager/state_controller.h"
#include "application_manager/resumption/resume_ctrl.h"
-#include "application_manager/mock_request_controller_settings.h"
-#include "application_manager/mock_application_manager.h"
+#include "application_manager/state_controller.h"
+#include "resumption/last_state.h"
#include "utils/test_async_waiter.h"
namespace test {
@@ -59,14 +58,14 @@ namespace request_controller_test {
using ::application_manager::request_controller::RequestController;
using ::application_manager::request_controller::RequestInfo;
+using ::testing::_;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
-using ::testing::_;
typedef NiceMock<application_manager_test::MockRequest> MRequest;
-typedef utils::SharedPtr<MRequest> RequestPtr;
-typedef utils::SharedPtr<RequestController> RequestControllerSPtr;
+typedef std::shared_ptr<MRequest> RequestPtr;
+typedef std::shared_ptr<RequestController> RequestControllerSPtr;
namespace {
const size_t kNumberOfRequests = 10u;
@@ -105,7 +104,7 @@ class RequestControllerTestClass : public ::testing::Test {
ON_CALL(mock_request_controller_settings_, thread_pool_size())
.WillByDefault(Return(kThreadPoolSize));
request_ctrl_ =
- utils::MakeShared<RequestController>(mock_request_controller_settings_);
+ std::make_shared<RequestController>(mock_request_controller_settings_);
}
RequestPtr GetMockRequest(
@@ -113,7 +112,7 @@ class RequestControllerTestClass : public ::testing::Test {
const uint32_t connection_key = kDefaultConnectionKey,
const uint32_t default_timeout = kDefaultTimeout) {
RequestPtr output =
- utils::MakeShared<MRequest>(connection_key, correlation_id);
+ std::make_shared<MRequest>(connection_key, correlation_id);
ON_CALL(*output, default_timeout()).WillByDefault(Return(default_timeout));
ON_CALL(*output, CheckPermissions()).WillByDefault(Return(true));
return output;
diff --git a/src/components/application_manager/test/request_info_test.cc b/src/components/application_manager/test/request_info_test.cc
index 11b2d2f259..a0b1793cf5 100644
--- a/src/components/application_manager/test/request_info_test.cc
+++ b/src/components/application_manager/test/request_info_test.cc
@@ -31,13 +31,11 @@
*/
#include "application_manager/request_info.h"
-#include "application_manager/mock_request.h"
#include <iostream>
-#include <vector>
#include <limits>
+#include <vector>
+#include "application_manager/mock_request.h"
#include "gmock/gmock.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
namespace request_info = application_manager::request_controller;
@@ -48,11 +46,11 @@ namespace application_manager_test {
class TestRequestInfo : public request_info::RequestInfo {
public:
TestRequestInfo(request_info::RequestPtr request,
- const RequestType requst_type,
- const TimevalStruct& start_time,
+ const RequestType request_type,
+ const date_time::TimeDuration& start_time,
const uint64_t timeout_msec)
- : RequestInfo(request, requst_type, start_time, timeout_msec) {}
- void SetEndTime(const TimevalStruct& end_time) {
+ : RequestInfo(request, request_type, start_time, timeout_msec) {}
+ void SetEndTime(const date_time::TimeDuration& end_time) {
end_time_ = end_time;
}
};
@@ -76,26 +74,26 @@ class RequestInfoTest : public ::testing::Test {
uint32_t default_timeout_;
uint32_t mobile_correlation_id;
- utils::SharedPtr<TestRequestInfo> CreateTestInfo(
+ std::shared_ptr<TestRequestInfo> CreateTestInfo(
uint32_t connection_key,
uint32_t correlation_id,
- request_info::RequestInfo::RequestType requst_type,
- const TimevalStruct& start_time,
+ request_info::RequestInfo::RequestType request_type,
+ const date_time::TimeDuration& start_time,
uint64_t timeout_msec) {
- utils::SharedPtr<MockRequest> mock_request =
- utils::MakeShared<MockRequest>(connection_key, correlation_id);
- utils::SharedPtr<TestRequestInfo> request =
- utils::MakeShared<TestRequestInfo>(
- mock_request, requst_type, start_time, timeout_msec);
+ std::shared_ptr<MockRequest> mock_request =
+ std::make_shared<MockRequest>(connection_key, correlation_id);
+ std::shared_ptr<TestRequestInfo> request =
+ std::make_shared<TestRequestInfo>(
+ mock_request, request_type, start_time, timeout_msec);
return request;
}
};
TEST_F(RequestInfoTest, RequestInfoEqualEndTime) {
- std::vector<utils::SharedPtr<TestRequestInfo> > requests;
- const TimevalStruct& time = date_time::DateTime::getCurrentTime();
+ std::vector<std::shared_ptr<TestRequestInfo> > requests;
+ const date_time::TimeDuration& time = date_time::getCurrentTime();
for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) {
- utils::SharedPtr<TestRequestInfo> request = CreateTestInfo(
+ std::shared_ptr<TestRequestInfo> request = CreateTestInfo(
i, i, request_info::RequestInfo::MobileRequest, time, default_timeout_);
request->SetEndTime(time);
EXPECT_TRUE(request_info_set_.Add(request));
@@ -105,11 +103,11 @@ TEST_F(RequestInfoTest, RequestInfoEqualEndTime) {
TEST_F(RequestInfoTest, AddRemoveHMIRequests) {
for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) {
- utils::SharedPtr<TestRequestInfo> request =
+ std::shared_ptr<TestRequestInfo> request =
CreateTestInfo(hmi_connection_key_,
i,
request_info::RequestInfo::HMIRequest,
- date_time::DateTime::getCurrentTime(),
+ date_time::getCurrentTime(),
default_timeout_);
EXPECT_TRUE(request_info_set_.Add(request));
EXPECT_TRUE(request_info_set_.RemoveRequest(request));
@@ -119,15 +117,15 @@ TEST_F(RequestInfoTest, AddRemoveHMIRequests) {
}
TEST_F(RequestInfoTest, AddHMIRequests_RemoveAllRequests) {
- std::vector<utils::SharedPtr<TestRequestInfo> > requests;
+ std::vector<std::shared_ptr<TestRequestInfo> > requests;
// Add hmi requests
for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) {
- utils::SharedPtr<TestRequestInfo> request =
+ std::shared_ptr<TestRequestInfo> request =
CreateTestInfo(hmi_connection_key_,
i,
request_info::RequestInfo::HMIRequest,
- date_time::DateTime::getCurrentTime(),
+ date_time::getCurrentTime(),
default_timeout_);
requests.push_back(request);
EXPECT_TRUE(request_info_set_.Add(request));
@@ -135,7 +133,7 @@ TEST_F(RequestInfoTest, AddHMIRequests_RemoveAllRequests) {
EXPECT_EQ(count_of_requests_for_test_, request_info_set_.Size());
// Delete every request
- std::vector<utils::SharedPtr<TestRequestInfo> >::iterator req_it =
+ std::vector<std::shared_ptr<TestRequestInfo> >::iterator req_it =
requests.begin();
for (; req_it != requests.end(); ++req_it) {
@@ -155,18 +153,18 @@ TEST_F(RequestInfoTest, AddHMIRequests_RemoveAllRequests) {
}
TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequests) {
- utils::SharedPtr<TestRequestInfo> mobile_request1 =
+ std::shared_ptr<TestRequestInfo> mobile_request1 =
CreateTestInfo(mobile_connection_key1_,
12345,
request_info::RequestInfo::MobileRequest,
- date_time::DateTime::getCurrentTime(),
+ date_time::getCurrentTime(),
default_timeout_);
EXPECT_TRUE(request_info_set_.Add(mobile_request1));
- utils::SharedPtr<TestRequestInfo> mobile_request2 =
+ std::shared_ptr<TestRequestInfo> mobile_request2 =
CreateTestInfo(mobile_connection_key2_,
54321,
request_info::RequestInfo::MobileRequest,
- date_time::DateTime::getCurrentTime(),
+ date_time::getCurrentTime(),
default_timeout_);
EXPECT_TRUE(request_info_set_.Add(mobile_request2));
EXPECT_EQ(2u, request_info_set_.Size());
@@ -175,15 +173,15 @@ TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequests) {
}
TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequestsByConnectionKey) {
- std::vector<utils::SharedPtr<TestRequestInfo> > requests;
+ std::vector<std::shared_ptr<TestRequestInfo> > requests;
const uint32_t count_of_mobile_request1 = 200;
const uint32_t count_of_mobile_request2 = 100;
for (uint32_t i = 0; i < count_of_mobile_request1; ++i) {
- utils::SharedPtr<TestRequestInfo> mobile_request1 =
+ std::shared_ptr<TestRequestInfo> mobile_request1 =
CreateTestInfo(mobile_connection_key1_,
i,
request_info::RequestInfo::MobileRequest,
- date_time::DateTime::getCurrentTime(),
+ date_time::getCurrentTime(),
default_timeout_);
requests.push_back(mobile_request1);
@@ -192,11 +190,11 @@ TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequestsByConnectionKey) {
EXPECT_EQ(count_of_mobile_request1, request_info_set_.Size());
for (uint32_t i = 0; i < count_of_mobile_request2; ++i) {
- utils::SharedPtr<TestRequestInfo> mobile_request2 =
+ std::shared_ptr<TestRequestInfo> mobile_request2 =
CreateTestInfo(mobile_connection_key2_,
i,
request_info::RequestInfo::MobileRequest,
- date_time::DateTime::getCurrentTime(),
+ date_time::getCurrentTime(),
default_timeout_);
requests.push_back(mobile_request2);
@@ -214,20 +212,20 @@ TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequestsByConnectionKey) {
TEST_F(RequestInfoTest, RequestInfoSetFront) {
for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) {
- utils::SharedPtr<TestRequestInfo> request =
+ std::shared_ptr<TestRequestInfo> request =
CreateTestInfo(mobile_connection_key1_,
i,
request_info::RequestInfo::HMIRequest,
- date_time::DateTime::getCurrentTime(),
+ date_time::getCurrentTime(),
i);
request_info_set_.Add(request);
}
for (uint32_t i = 1; i < count_of_requests_for_test_; ++i) {
request_info::RequestInfoPtr request_info = request_info_set_.Front();
- EXPECT_TRUE(request_info.valid());
+ EXPECT_TRUE(request_info.use_count() != 0);
request_info = request_info_set_.FrontWithNotNullTimeout();
- EXPECT_TRUE(request_info.valid());
+ EXPECT_TRUE(request_info.use_count() != 0);
EXPECT_TRUE(request_info_set_.RemoveRequest(request_info));
}
EXPECT_EQ(1u, request_info_set_.Size());
@@ -248,27 +246,27 @@ TEST_F(RequestInfoTest, RequestInfoSetFind) {
appid_connection_id.end();
for (; req_it != end; ++req_it) {
- utils::SharedPtr<TestRequestInfo> request =
+ std::shared_ptr<TestRequestInfo> request =
CreateTestInfo(req_it->first,
req_it->second,
request_info::RequestInfo::HMIRequest,
- date_time::DateTime::getCurrentTime(),
+ date_time::getCurrentTime(),
10);
EXPECT_TRUE(request_info_set_.Add(request));
}
request_info::RequestInfoPtr request = request_info_set_.Find(
count_of_requests_for_test_, count_of_requests_for_test_);
- EXPECT_FALSE(request.valid());
+ EXPECT_FALSE(request.use_count() != 0);
req_it = appid_connection_id.begin();
for (; req_it != end; ++req_it) {
request_info::RequestInfoPtr request =
request_info_set_.Find(req_it->first, req_it->second);
- EXPECT_TRUE(request.valid());
+ EXPECT_TRUE(request.use_count() != 0);
EXPECT_TRUE(request_info_set_.RemoveRequest(request));
request = request_info_set_.Find(req_it->first, req_it->second);
- EXPECT_FALSE(request.valid());
+ EXPECT_FALSE(request.use_count() != 0);
}
EXPECT_EQ(0u, request_info_set_.Size());
}
@@ -277,11 +275,11 @@ TEST_F(RequestInfoTest, RequestInfoSetEqualHash) {
request_info::RequestInfoSet request_info_set;
const uint32_t connection_key = 65483;
const uint32_t corr_id = 65483;
- utils::SharedPtr<TestRequestInfo> request =
+ std::shared_ptr<TestRequestInfo> request =
CreateTestInfo(connection_key,
corr_id,
request_info::RequestInfo::HMIRequest,
- date_time::DateTime::getCurrentTime(),
+ date_time::getCurrentTime(),
10);
EXPECT_TRUE(request_info_set.Add(request));
EXPECT_FALSE(request_info_set.Add(request));
@@ -289,31 +287,33 @@ TEST_F(RequestInfoTest, RequestInfoSetEqualHash) {
EXPECT_EQ(1u, request_info_set.Size());
request_info::RequestInfoPtr found =
request_info_set.Find(connection_key, corr_id);
- EXPECT_TRUE(found.valid());
+ EXPECT_TRUE(found.use_count() != 0);
EXPECT_TRUE(request_info_set.RemoveRequest(found));
EXPECT_EQ(0u, request_info_set.Size());
EXPECT_TRUE(request_info_set.Add(request));
EXPECT_FALSE(request_info_set.Add(request));
found = request_info_set.FrontWithNotNullTimeout();
- EXPECT_TRUE(found.valid());
+ EXPECT_TRUE(found.use_count() != 0);
EXPECT_TRUE(request_info_set.RemoveRequest(found));
found = request_info_set.FrontWithNotNullTimeout();
- EXPECT_FALSE(found.valid());
+ EXPECT_FALSE(found.use_count() != 0);
found = request_info_set.Front();
- EXPECT_FALSE(found.valid());
+ EXPECT_FALSE(found.use_count() != 0);
EXPECT_EQ(0u, request_info_set.Size());
}
TEST_F(RequestInfoTest, EndTimeisExpired) {
- TimevalStruct time = date_time::DateTime::getCurrentTime();
-
- TimevalStruct not_expired = date_time::DateTime::getCurrentTime();
- not_expired.tv_usec = std::numeric_limits<time_t>::min();
+ date_time::TimeDuration time = date_time::getCurrentTime();
+ // get just the seconds part of the current time
+ date_time::TimeDuration not_expired =
+ date_time::seconds(date_time::getSecs(date_time::getCurrentTime()));
+ not_expired += date_time::microseconds(std::numeric_limits<time_t>::min());
- TimevalStruct expired = date_time::DateTime::getCurrentTime();
- expired.tv_usec = std::numeric_limits<time_t>::max();
+ date_time::TimeDuration expired =
+ date_time::seconds(date_time::getSecs(date_time::getCurrentTime()));
+ expired += date_time::microseconds(std::numeric_limits<time_t>::max());
- utils::SharedPtr<TestRequestInfo> request =
+ std::shared_ptr<TestRequestInfo> request =
CreateTestInfo(mobile_connection_key1_,
mobile_correlation_id,
request_info::RequestInfo::MobileRequest,
@@ -328,8 +328,8 @@ TEST_F(RequestInfoTest, EndTimeisExpired) {
}
TEST_F(RequestInfoTest, UpdateEndTime) {
- TimevalStruct time = date_time::DateTime::getCurrentTime();
- utils::SharedPtr<TestRequestInfo> request =
+ date_time::TimeDuration time = date_time::getCurrentTime();
+ std::shared_ptr<TestRequestInfo> request =
CreateTestInfo(mobile_connection_key1_,
mobile_correlation_id,
request_info::RequestInfo::MobileRequest,
@@ -337,13 +337,13 @@ TEST_F(RequestInfoTest, UpdateEndTime) {
default_timeout_);
request->SetEndTime(time);
request->updateEndTime();
- TimevalStruct last_time = request->end_time();
- EXPECT_LE(time.tv_sec, last_time.tv_sec);
+ date_time::TimeDuration last_time = request->end_time();
+ EXPECT_LE(date_time::getSecs(time), date_time::getSecs(last_time));
}
TEST_F(RequestInfoTest, UpdateTimeOut) {
- TimevalStruct time = date_time::DateTime::getCurrentTime();
- utils::SharedPtr<TestRequestInfo> request =
+ date_time::TimeDuration time = date_time::getCurrentTime();
+ std::shared_ptr<TestRequestInfo> request =
CreateTestInfo(mobile_connection_key1_,
mobile_correlation_id,
request_info::RequestInfo::MobileRequest,
@@ -353,9 +353,10 @@ TEST_F(RequestInfoTest, UpdateTimeOut) {
request->updateEndTime();
request->updateTimeOut(100);
- time = date_time::DateTime::getCurrentTime();
- TimevalStruct last_time = request->end_time();
- EXPECT_NEAR(time.tv_sec + 100, last_time.tv_sec, 500);
+ time = date_time::getCurrentTime();
+ date_time::TimeDuration last_time = request->end_time();
+ EXPECT_NEAR(
+ date_time::getSecs(time) + 100, date_time::getSecs(last_time), 500);
}
} // namespace application_manager_test
diff --git a/src/components/application_manager/test/request_tracker_test.cc b/src/components/application_manager/test/request_tracker_test.cc
index ee09e0a3e0..9175652da6 100644
--- a/src/components/application_manager/test/request_tracker_test.cc
+++ b/src/components/application_manager/test/request_tracker_test.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "utils/macro.h"
#include "application_manager/request_tracker.h"
#include "application_manager/mock_request_controller_settings.h"
+#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
-#include "utils/lock.h"
#include "utils/conditional_variable.h"
+#include "utils/lock.h"
+#include "utils/macro.h"
namespace test {
namespace components {
@@ -246,6 +246,6 @@ TEST_F(RequestTrackerTestClass,
tracker_.Track(app_id, none_level));
}
-} // namespace request_controller
+} // namespace request_controller_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
index 1a5d070941..da3cd934e4 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
@@ -30,24 +30,28 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include <algorithm>
+#include <string>
-#include "gtest/gtest.h"
-#include "application_manager/resumption/resume_ctrl_impl.h"
-#include "application_manager/usage_statistics.h"
-#include "application_manager/mock_application.h"
+#include "application_manager/application.h"
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/display_capabilities_builder.h"
#include "application_manager/mock_app_extension.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_resumption_data.h"
+#include "application_manager/mock_rpc_service.h"
+#include "application_manager/resumption/resume_ctrl_impl.h"
+#include "application_manager/usage_statistics.h"
+#include "config_profile/profile.h"
+#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/application.h"
#include "utils/data_accessor.h"
-#include "utils/make_shared.h"
-#include "application_manager/mock_message_helper.h"
+
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_application_manager_settings.h"
#include "application_manager/mock_event_dispatcher.h"
+#include "application_manager/mock_message_helper.h"
#include "application_manager/mock_state_controller.h"
namespace test {
@@ -62,13 +66,21 @@ using ::testing::Eq;
using ::testing::Mock;
using ::testing::NiceMock;
using ::testing::Return;
+using ::testing::ReturnPointee;
using ::testing::ReturnRef;
+using ::testing::SaveArg;
using ::testing::SetArgReferee;
using namespace application_manager_test;
using namespace resumption;
using namespace mobile_apis::HMILevel;
+namespace {
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const int32_t kDefaultHmiAppId = 111;
+} // namespace
+
class ResumeCtrlTest : public ::testing::Test {
protected:
ResumeCtrlTest()
@@ -82,32 +94,65 @@ class ResumeCtrlTest : public ::testing::Test {
, kHash_("saved_hash")
, kAppResumingTimeout_(30000u) // miliseconds
, kTestTimeStamp_(1452074434u)
- , app_set_lock_ptr_(std::make_shared<sync_primitives::Lock>()) {}
+ , app_set_lock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , kDefaultDeferredTestLevel_(eType::INVALID_ENUM)
+ , kNaviLowbandwidthLevel_("LIMITED")
+ , kProjectionLowbandwidthLevel_("NONE")
+ , kMediaLowbandwidthLevel_("NONE") {
+ profile::Profile profile_;
+ profile_.set_config_file_name("smartDeviceLink.ini");
+ resumption_delay_before_ign_ = profile_.resumption_delay_before_ign();
+ }
virtual void SetUp() OVERRIDE {
Mock::VerifyAndClearExpectations(&mock_app_mngr_);
ON_CALL(mock_app_mngr_, event_dispatcher())
.WillByDefault(ReturnRef(mock_event_dispatcher_));
mock_storage_ =
- ::utils::MakeShared<NiceMock<resumption_test::MockResumptionData> >(
+ std::make_shared<NiceMock<resumption_test::MockResumptionData> >(
mock_app_mngr_);
- mock_app_ = utils::MakeShared<NiceMock<MockApplication> >();
- mock_app_extension_ = utils::MakeShared<
+ mock_app_ = std::make_shared<NiceMock<MockApplication> >();
+ mock_help_prompt_manager_ =
+ std::shared_ptr<MockHelpPromptManager>(new MockHelpPromptManager());
+ mock_app_extension_ = std::make_shared<
NiceMock<application_manager_test::MockAppExtension> >();
const_app_ =
static_cast<application_manager::ApplicationConstSharedPtr>(mock_app_);
- res_ctrl_ = utils::MakeShared<ResumeCtrlImpl>(mock_app_mngr_);
+ res_ctrl_ = std::make_shared<ResumeCtrlImpl>(mock_app_mngr_);
res_ctrl_->set_resumption_storage(mock_storage_);
ON_CALL(mock_app_mngr_, state_controller())
.WillByDefault(ReturnRef(mock_state_controller_));
ON_CALL(mock_app_mngr_, get_settings())
.WillByDefault(ReturnRef(mock_application_manager_settings_));
+ EXPECT_CALL(mock_app_mngr_, CheckResumptionRequiredTransportAvailable(_))
+ .Times(AtLeast(0))
+ .WillRepeatedly(Return(true));
+ ON_CALL(mock_app_mngr_, get_full_or_limited_application())
+ .WillByDefault(Return(ApplicationSharedPtr()));
ON_CALL(mock_application_manager_settings_, use_db_for_resumption())
.WillByDefault(Return(false));
ON_CALL(mock_application_manager_settings_, app_resuming_timeout())
.WillByDefault(ReturnRef(kAppResumingTimeout_));
+ // use EXPECTED_CALL().Times(AtLeast(0)) instead of ON_CALL to remove
+ // warning messages
+ EXPECT_CALL(mock_application_manager_settings_,
+ navigation_lowbandwidth_resumption_level())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(kNaviLowbandwidthLevel_));
+ EXPECT_CALL(mock_application_manager_settings_,
+ projection_lowbandwidth_resumption_level())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(kProjectionLowbandwidthLevel_));
+ EXPECT_CALL(mock_application_manager_settings_,
+ media_lowbandwidth_resumption_level())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(kMediaLowbandwidthLevel_));
+
+ EXPECT_CALL(*mock_app_, deferred_resumption_hmi_level())
+ .Times(AtLeast(0))
+ .WillRepeatedly(Return(kDefaultDeferredTestLevel_));
}
void TearDown() OVERRIDE {
Mock::VerifyAndClearExpectations(&mock_app_mngr_);
@@ -118,19 +163,57 @@ class ResumeCtrlTest : public ::testing::Test {
ON_CALL(*mock_app_, mac_address()).WillByDefault(ReturnRef(kMacAddress_));
ON_CALL(*mock_app_, device()).WillByDefault(Return(kTestDevId_));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kTestAppId_));
+ ON_CALL(*mock_app_, is_cloud_app()).WillByDefault(Return(false));
+ }
+
+ smart_objects::SmartObjectSPtr CreateStubCreateWindowRequest(
+ const std::string window_name,
+ const WindowID window_id,
+ const mobile_apis::WindowType::eType window_type) const {
+ auto request = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
+ smart_objects::SmartObject params(smart_objects::SmartType_Map);
+
+ params[strings::correlation_id] = window_id;
+
+ msg_params[strings::window_name] = window_name;
+ msg_params[strings::window_id] = window_id;
+ msg_params[strings::window_type] = window_type;
+ msg_params[strings::app_id] = kDefaultHmiAppId;
+
+ (*request)[strings::msg_params] = msg_params;
+ (*request)[strings::params] = params;
+
+ return request;
+ }
+
+ smart_objects::SmartObjectSPtr CreateStubCreateWindowResponse(
+ const int32_t correlation_id,
+ const hmi_apis::Common_Result::eType result_code) const {
+ auto response = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ smart_objects::SmartObject params(smart_objects::SmartType_Map);
+
+ params[strings::correlation_id] = correlation_id;
+ params[hmi_response::code] = result_code;
+
+ (*response)[strings::params] = params;
+
+ return response;
}
NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
application_manager_test::MockApplicationManagerSettings
mock_application_manager_settings_;
- application_manager_test::MockApplicationManager mock_app_mngr_;
- utils::SharedPtr<NiceMock<application_manager_test::MockAppExtension> >
+ NiceMock<application_manager_test::MockApplicationManager> mock_app_mngr_;
+ std::shared_ptr<NiceMock<application_manager_test::MockAppExtension> >
mock_app_extension_;
MockStateController mock_state_controller_;
- utils::SharedPtr<ResumeCtrl> res_ctrl_;
- utils::SharedPtr<NiceMock<resumption_test::MockResumptionData> >
- mock_storage_;
- utils::SharedPtr<NiceMock<MockApplication> > mock_app_;
+ std::shared_ptr<ResumeCtrl> res_ctrl_;
+ std::shared_ptr<NiceMock<resumption_test::MockResumptionData> > mock_storage_;
+ std::shared_ptr<NiceMock<MockApplication> > mock_app_;
+ std::shared_ptr<MockHelpPromptManager> mock_help_prompt_manager_;
application_manager::ApplicationConstSharedPtr const_app_;
const uint32_t kTestAppId_;
const std::string kTestPolicyAppId_;
@@ -142,7 +225,14 @@ class ResumeCtrlTest : public ::testing::Test {
const std::string kHash_;
const uint32_t kAppResumingTimeout_;
const uint32_t kTestTimeStamp_;
+ uint32_t resumption_delay_before_ign_;
std::shared_ptr<sync_primitives::Lock> app_set_lock_ptr_;
+ sync_primitives::Lock app_set_lock_;
+ const mobile_apis::HMILevel::eType kDefaultDeferredTestLevel_;
+ const std::string kNaviLowbandwidthLevel_;
+ const std::string kProjectionLowbandwidthLevel_;
+ const std::string kMediaLowbandwidthLevel_;
+ NiceMock<application_manager_test::MockRPCService> mock_rpc_service_;
};
/**
@@ -295,9 +385,9 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithCommands) {
GetInfoFromApp();
smart_objects::SmartObject test_application_commands;
smart_objects::SmartObject test_commands;
- const uint32_t count_of_commands = 20;
+ const uint32_t count_of_commands = 20u;
- for (uint32_t i = 0; i < count_of_commands; ++i) {
+ for (uint32_t i = 0u; i < count_of_commands; ++i) {
test_commands[application_manager::strings::cmd_id] = i;
test_application_commands[i] = test_commands;
}
@@ -316,9 +406,36 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithCommands) {
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
EXPECT_CALL(*mock_app_, UpdateHash());
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
+ ON_CALL(*mock_app_, help_prompt_manager())
+ .WillByDefault(ReturnRef(*mock_help_prompt_manager_));
+
+ std::vector<application_manager::CommandsMap> command_vec(count_of_commands);
+ for (uint32_t count = 0u; count < count_of_commands; ++count) {
+ for (uint32_t i = 0u; i < count; ++i) {
+ command_vec[count].insert(
+ std::pair<uint32_t, smart_objects::SmartObject*>(
+ i + 1, &test_application_commands[i]));
+ };
+ }
- for (uint32_t i = 0; i < count_of_commands; ++i) {
- EXPECT_CALL(*mock_app_, AddCommand(i, test_application_commands[i]));
+ uint32_t comm_n = 0u;
+ ON_CALL(*mock_app_, commands_map())
+ .WillByDefault(testing::Invoke(
+ [&]() -> DataAccessor<application_manager::CommandsMap> {
+ DataAccessor<application_manager::CommandsMap> data_accessor(
+ command_vec[comm_n], app_set_lock_ptr_);
+ ++comm_n;
+ return data_accessor;
+ }));
+
+ for (uint32_t cmd_id = 0u, internal_id = 1u; cmd_id < count_of_commands;
+ ++cmd_id, ++internal_id) {
+ EXPECT_CALL(*mock_app_,
+ AddCommand(internal_id, test_application_commands[cmd_id]));
+
+ EXPECT_CALL(
+ *mock_help_prompt_manager_,
+ OnVrCommandAdded(cmd_id, test_application_commands[cmd_id], true));
}
smart_objects::SmartObjectList requests;
@@ -455,7 +572,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) {
EXPECT_CALL(*mock_app_extension_, ProcessResumption(test_subscriptions));
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- SendAllOnButtonSubscriptionNotificationsForApp(_, _)).Times(2);
+ SendAllOnButtonSubscriptionNotificationsForApp(_, _))
+ .Times(2);
const bool res = res_ctrl_->StartResumption(mock_app_, kHash_);
EXPECT_TRUE(res);
@@ -525,12 +643,231 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToWayPoints) {
mobile_apis::HMILevel::HMI_FULL;
ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
.WillByDefault(Return(hmi_test_level));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, hmi_test_level));
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, hmi_test_level));
const bool result = res_ctrl_->StartResumption(mock_app_, kHash_);
EXPECT_TRUE(result);
}
+TEST_F(ResumeCtrlTest,
+ RestoreAppWidgets_AppWithWidgets_SendCreateWindowRequests) {
+ using namespace smart_objects;
+ using namespace application_manager;
+ GetInfoFromApp();
+ const uint32_t count_of_widgets = 10u;
+
+ auto create_window_info_so = []() -> SmartObject {
+ SmartObject widgets_info(SmartType_Array);
+ for (uint32_t i = 0; i < count_of_widgets; ++i) {
+ SmartObject widget_info(SmartType_Map);
+ widget_info[strings::associated_service_type] = "ServiceType";
+ widget_info[strings::duplicate_updates_from_window_id] = 0;
+ widget_info[strings::window_name] =
+ std::string("Widget ") + std::to_string(i + 1);
+ widget_info[strings::window_type] =
+ static_cast<int32_t>(mobile_apis::WindowType::WIDGET);
+ widget_info[strings::window_id] = i + 1;
+ widgets_info[widgets_info.length()] = widget_info;
+ }
+ return widgets_info;
+ };
+
+ auto create_saved_app_so = [&create_window_info_so, this]() -> SmartObject {
+ smart_objects::SmartObject saved_app;
+ const auto test_app_widgets = create_window_info_so();
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = test_app_widgets;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+ return saved_app;
+ };
+
+ const auto saved_app = create_saved_app_so();
+
+ const auto hmi_request = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ const auto hmi_requests =
+ smart_objects::SmartObjectList(count_of_widgets, hmi_request);
+
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+ EXPECT_CALL(
+ *application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, saved_app[strings::windows_info]))
+ .WillOnce(Return(hmi_requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .Times(count_of_widgets)
+ .WillRepeatedly(Return(true));
+
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+}
+
+TEST_F(ResumeCtrlTest,
+ RestoreWidgetsHMIState_AppWithWidgets_AddWidgetsInternally) {
+ const uint32_t count_of_widgets = 10u;
+
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = smart_objects::SmartObject();
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
+ .WillByDefault(Return(mock_app_));
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ smart_objects::SmartObjectList requests;
+ smart_objects::SmartObjectList responses;
+ for (uint32_t i = 0; i < count_of_widgets; ++i) {
+ const auto window_type = mobile_apis::WindowType::WIDGET;
+ const WindowID window_id = i + 1;
+ const auto window_name = std::string("Widget ") + std::to_string(window_id);
+ requests.push_back(
+ CreateStubCreateWindowRequest(window_name, window_id, window_type));
+ responses.push_back(CreateStubCreateWindowResponse(
+ window_id, hmi_apis::Common_Result::SUCCESS));
+ EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
+ .WillRepeatedly(Return(nullptr));
+ EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _));
+ EXPECT_CALL(mock_state_controller_,
+ OnAppWindowAdded(_, window_id, window_type, _));
+ }
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .WillOnce(Return(requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .Times(count_of_widgets)
+ .WillRepeatedly(Return(true));
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+ for (const auto& response : responses) {
+ res_ctrl_->RestoreWidgetsHMIState(*response);
+ }
+}
+
+TEST_F(ResumeCtrlTest,
+ RestoreAppWidgets_AppWithoutWidgets_NoCreateWindowRqSent) {
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .Times(0);
+
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+}
+
+TEST_F(ResumeCtrlTest, RestoreWidgetsHMIState_HMIResponseWith_InvalidCorrId) {
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = smart_objects::SmartObject();
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ const int32_t invalid_corr_id = -1;
+ auto response = CreateStubCreateWindowResponse(
+ invalid_corr_id, hmi_apis::Common_Result::SUCCESS);
+
+ ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
+ .WillByDefault(Return(mock_app_));
+
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ smart_objects::SmartObjectList requests;
+
+ const auto window_type = mobile_apis::WindowType::WIDGET;
+ const WindowID window_id = 1;
+ const auto window_name = std::string("Widget ") + std::to_string(window_id);
+ requests.push_back(
+ CreateStubCreateWindowRequest(window_name, window_id, window_type));
+
+ EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
+ .Times(0);
+ EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _)).Times(0);
+ EXPECT_CALL(mock_state_controller_,
+ OnAppWindowAdded(_, window_id, window_type, _))
+ .Times(0);
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .WillOnce(Return(requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .WillRepeatedly(Return(true));
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+ res_ctrl_->RestoreWidgetsHMIState(*response);
+}
+
+TEST_F(ResumeCtrlTest, RestoreWidgetsHMIState_HMIResponseWith_Unsuccess) {
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = smart_objects::SmartObject();
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ const int32_t correlation_id = 1;
+ auto response = CreateStubCreateWindowResponse(
+ correlation_id, hmi_apis::Common_Result::GENERIC_ERROR);
+
+ ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
+ .WillByDefault(Return(mock_app_));
+
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ smart_objects::SmartObject stub_window_info(smart_objects::SmartType_Null);
+ auto stub_resume_cb = [](Application&, const smart_objects::SmartObject&) {};
+ builder.InitBuilder(stub_resume_cb, stub_window_info);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ smart_objects::SmartObjectList requests;
+ smart_objects::SmartObjectList responses;
+
+ const auto window_type = mobile_apis::WindowType::WIDGET;
+ const WindowID window_id = 1;
+ const auto window_name = std::string("Widget ") + std::to_string(window_id);
+ requests.push_back(
+ CreateStubCreateWindowRequest(window_name, window_id, window_type));
+
+ EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
+ .Times(0);
+ EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _)).Times(0);
+ EXPECT_CALL(mock_state_controller_,
+ OnAppWindowAdded(_, window_id, window_type, _))
+ .Times(0);
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .WillOnce(Return(requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .WillRepeatedly(Return(true));
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+ res_ctrl_->RestoreWidgetsHMIState(*response);
+}
+
TEST_F(ResumeCtrlTest, StartResumptionOnlyHMILevel) {
smart_objects::SmartObject saved_app;
@@ -544,16 +881,54 @@ TEST_F(ResumeCtrlTest, StartResumptionOnlyHMILevel) {
EXPECT_TRUE(res);
}
+TEST_F(ResumeCtrlTest, RetryResumption) {
+ const uint32_t app_id = 1;
+
+ EXPECT_CALL(mock_app_mngr_, application(app_id)).WillOnce(Return(mock_app_));
+ EXPECT_CALL(*mock_app_, deferred_resumption_hmi_level())
+ .WillOnce(Return(eType::HMI_FULL));
+
+ res_ctrl_->RetryResumption(app_id);
+
+ bool is_resumption_active = res_ctrl_->get_resumption_active();
+ EXPECT_TRUE(is_resumption_active);
+}
+
+TEST_F(ResumeCtrlTest, RetryResumption_NotDeferred) {
+ const uint32_t app_id = 1;
+
+ EXPECT_CALL(mock_app_mngr_, application(app_id)).WillOnce(Return(mock_app_));
+ EXPECT_CALL(*mock_app_, deferred_resumption_hmi_level())
+ .WillOnce(Return(eType::INVALID_ENUM));
+
+ res_ctrl_->RetryResumption(app_id);
+
+ bool is_resumption_active = res_ctrl_->get_resumption_active();
+ EXPECT_FALSE(is_resumption_active);
+}
+
TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppInFull) {
mobile_apis::HMILevel::eType restored_test_type = eType::HMI_FULL;
uint32_t ign_off_count = 0;
smart_objects::SmartObject saved_app;
+ const uint32_t time_offset = 5;
+ const uint32_t time_stamp =
+ time(nullptr) - resumption_delay_before_ign_ + time_offset;
saved_app[application_manager::strings::ign_off_count] = ign_off_count;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
+ saved_app[application_manager::strings::time_stamp] = time_stamp;
+
+ application_manager::CommandsMap command;
+ DataAccessor<application_manager::CommandsMap> data_accessor(
+ command, app_set_lock_ptr_);
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
+ EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ EXPECT_CALL(*mock_app_, commands_map()).WillRepeatedly(Return(data_accessor));
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
@@ -584,6 +959,141 @@ TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppInBackground) {
res_ctrl_->StartAppHmiStateResumption(mock_app_);
}
+TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppHasDeferredResumption) {
+ mobile_apis::HMILevel::eType restored_test_type = eType::HMI_NONE;
+ mobile_apis::HMILevel::eType deferred_level = eType::HMI_FULL;
+ uint32_t ign_off_count = 0;
+ smart_objects::SmartObject saved_app;
+ const uint32_t time_offset = 5;
+ const uint32_t time_stamp =
+ time(nullptr) - resumption_delay_before_ign_ + time_offset;
+ saved_app[application_manager::strings::ign_off_count] = ign_off_count;
+ saved_app[application_manager::strings::hmi_level] = restored_test_type;
+ saved_app[application_manager::strings::time_stamp] = time_stamp;
+
+ // resume into deferred level instead of restored level
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, deferred_level))
+ .Times(AtLeast(1));
+ GetInfoFromApp();
+ ON_CALL(*mock_storage_,
+ GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
+ .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+
+ mobile_apis::HMILevel::eType app_deferred_level = deferred_level;
+ EXPECT_CALL(*mock_app_, deferred_resumption_hmi_level())
+ .WillRepeatedly(ReturnPointee(&app_deferred_level));
+ EXPECT_CALL(*mock_app_,
+ set_deferred_resumption_hmi_level(eType::INVALID_ENUM))
+ .WillOnce(SaveArg<0>(&app_deferred_level));
+
+ EXPECT_CALL(*mock_storage_,
+ RemoveApplicationFromSaved(kTestPolicyAppId_, kMacAddress_))
+ .WillOnce(Return(true));
+
+ ON_CALL(mock_app_mngr_, GetUserConsentForDevice("12345"))
+ .WillByDefault(Return(policy::kDeviceAllowed));
+ res_ctrl_->StartAppHmiStateResumption(mock_app_);
+}
+
+TEST_F(ResumeCtrlTest,
+ StartAppHmiStateResumption_HighBandwidthTransportNotAvailable) {
+ mobile_apis::HMILevel::eType restored_test_type = eType::HMI_FULL;
+ uint32_t ign_off_count = 0;
+ smart_objects::SmartObject saved_app;
+ const uint32_t time_offset = 5;
+ const uint32_t time_stamp =
+ time(nullptr) - resumption_delay_before_ign_ + time_offset;
+ saved_app[application_manager::strings::ign_off_count] = ign_off_count;
+ saved_app[application_manager::strings::hmi_level] = restored_test_type;
+ saved_app[application_manager::strings::time_stamp] = time_stamp;
+
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, eType::HMI_LIMITED))
+ .Times(AtLeast(1));
+ GetInfoFromApp();
+ ON_CALL(*mock_storage_,
+ GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
+ .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+
+ EXPECT_CALL(mock_app_mngr_, CheckResumptionRequiredTransportAvailable(_))
+ .WillOnce(Return(false));
+
+ EXPECT_CALL(*mock_app_, is_navi()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*mock_app_, mobile_projection_enabled())
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(*mock_app_, is_media_application()).WillRepeatedly(Return(false));
+
+ // if resumption is deferred ...
+ EXPECT_CALL(*mock_app_, deferred_resumption_hmi_level())
+ .WillRepeatedly(Return(restored_test_type));
+
+ // ... then RemoveApplicationFromSaved() will not be called
+ EXPECT_CALL(*mock_storage_,
+ RemoveApplicationFromSaved(kTestPolicyAppId_, kMacAddress_))
+ .Times(0);
+
+ ON_CALL(mock_app_mngr_, GetUserConsentForDevice("12345"))
+ .WillByDefault(Return(policy::kDeviceAllowed));
+ res_ctrl_->StartAppHmiStateResumption(mock_app_);
+}
+
+TEST_F(
+ ResumeCtrlTest,
+ StartAppHmiStateResumption_HighBandwidthTransportNotAvailable_NaviAndMedia) {
+ mobile_apis::HMILevel::eType restored_test_type = eType::HMI_LIMITED;
+ uint32_t ign_off_count = 0;
+ smart_objects::SmartObject saved_app;
+ const uint32_t time_offset = 5;
+ const uint32_t time_stamp =
+ time(nullptr) - resumption_delay_before_ign_ + time_offset;
+ saved_app[application_manager::strings::ign_off_count] = ign_off_count;
+ saved_app[application_manager::strings::hmi_level] = restored_test_type;
+ saved_app[application_manager::strings::time_stamp] = time_stamp;
+
+ // in this test, it is expected that the app will resume into LIMITED, which
+ // is the higher level among NONE and LIMITED
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, eType::HMI_LIMITED))
+ .Times(AtLeast(1));
+ GetInfoFromApp();
+ ON_CALL(*mock_storage_,
+ GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
+ .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+
+ EXPECT_CALL(mock_app_mngr_, CheckResumptionRequiredTransportAvailable(_))
+ .WillOnce(Return(false));
+
+ EXPECT_CALL(*mock_app_, is_navi()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*mock_app_, mobile_projection_enabled())
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(*mock_app_, is_media_application()).WillRepeatedly(Return(true));
+
+ std::string navi_lowbandwidth_level("NONE");
+ std::string projection_lowbandwidth_level("BACKGROUND");
+ std::string media_lowbandwidth_level("LIMITED");
+ EXPECT_CALL(mock_application_manager_settings_,
+ navigation_lowbandwidth_resumption_level())
+ .WillRepeatedly(ReturnRef(navi_lowbandwidth_level));
+ EXPECT_CALL(mock_application_manager_settings_,
+ projection_lowbandwidth_resumption_level())
+ .WillRepeatedly(ReturnRef(projection_lowbandwidth_level));
+ EXPECT_CALL(mock_application_manager_settings_,
+ media_lowbandwidth_resumption_level())
+ .WillRepeatedly(ReturnRef(media_lowbandwidth_level));
+
+ EXPECT_CALL(*mock_app_, deferred_resumption_hmi_level())
+ .WillRepeatedly(Return(restored_test_type));
+
+ EXPECT_CALL(*mock_storage_,
+ RemoveApplicationFromSaved(kTestPolicyAppId_, kMacAddress_))
+ .Times(0);
+
+ ON_CALL(mock_app_mngr_, GetUserConsentForDevice("12345"))
+ .WillByDefault(Return(policy::kDeviceAllowed));
+ res_ctrl_->StartAppHmiStateResumption(mock_app_);
+}
+
/**
* @brief Group of tests which check restoring resumption with different data
*/
@@ -591,21 +1101,28 @@ TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppInBackground) {
TEST_F(ResumeCtrlTest, RestoreAppHMIState_RestoreHMILevelFull) {
mobile_apis::HMILevel::eType restored_test_type = eType::HMI_FULL;
+ ::application_manager::CommandsMap command;
+ DataAccessor<application_manager::CommandsMap> data_accessor(
+ command, app_set_lock_ptr_);
+
smart_objects::SmartObject saved_app;
saved_app[application_manager::strings::hash_id] = kHash_;
saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
+ EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ EXPECT_CALL(*mock_app_, commands_map()).WillRepeatedly(Return(data_accessor));
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
ON_CALL(mock_app_mngr_, GetUserConsentForDevice("12345"))
.WillByDefault(Return(policy::kDeviceAllowed));
- EXPECT_CALL(*mock_app_, set_is_resuming(true));
const bool res = res_ctrl_->RestoreAppHMIState(mock_app_);
EXPECT_TRUE(res);
@@ -624,7 +1141,38 @@ TEST_F(ResumeCtrlTest, SetupDefaultHMILevel) {
ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
.WillByDefault(Return(kDefaultTestLevel_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, kDefaultTestLevel_))
+ .Times(AtLeast(1));
+
+ res_ctrl_->SetupDefaultHMILevel(mock_app_);
+}
+
+TEST_F(ResumeCtrlTest,
+ SetupDefaultHMILevel_HighBandwidthTransportNotAvailable) {
+ smart_objects::SmartObject saved_app;
+
+ saved_app[application_manager::strings::hmi_level] = kDefaultTestLevel_;
+
+ ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
+ .WillByDefault(Return(kDefaultTestLevel_));
+ GetInfoFromApp();
+ EXPECT_CALL(mock_app_mngr_, GetUserConsentForDevice("12345")).Times(0);
+
+ ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
+ .WillByDefault(Return(kDefaultTestLevel_));
+
+ EXPECT_CALL(mock_app_mngr_, CheckResumptionRequiredTransportAvailable(_))
+ .WillRepeatedly(Return(false));
+
+ EXPECT_CALL(*mock_app_, is_navi()).WillRepeatedly(Return(false));
+ EXPECT_CALL(*mock_app_, mobile_projection_enabled())
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(*mock_app_, is_media_application()).WillRepeatedly(Return(false));
+
+ // SetRegularState() should be called with kProjectionLowbandwidthLevel_
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, eType::HMI_NONE))
.Times(AtLeast(1));
res_ctrl_->SetupDefaultHMILevel(mock_app_);
@@ -634,18 +1182,30 @@ TEST_F(ResumeCtrlTest, ApplicationResumptiOnTimer_AppInFull) {
ON_CALL(mock_app_mngr_, application(kTestAppId_))
.WillByDefault(Return(mock_app_));
+ ::application_manager::CommandsMap command;
+ DataAccessor<application_manager::CommandsMap> data_accessor(
+ command, app_set_lock_ptr_);
+
mobile_apis::HMILevel::eType restored_test_type = eType::HMI_FULL;
const uint32_t ign_off_count = 0u;
smart_objects::SmartObject saved_app;
+ const uint32_t time_offset = 5;
+ const uint32_t time_stamp =
+ time(nullptr) - resumption_delay_before_ign_ + time_offset;
saved_app[application_manager::strings::ign_off_count] = ign_off_count;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
+ saved_app[application_manager::strings::time_stamp] = time_stamp;
MockStateController state_controller;
EXPECT_CALL(mock_app_mngr_, state_controller())
.WillOnce(ReturnRef(state_controller));
- EXPECT_CALL(state_controller, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(state_controller,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
+ EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ EXPECT_CALL(*mock_app_, commands_map()).WillRepeatedly(Return(data_accessor));
ON_CALL(*mock_storage_,
GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
.WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
@@ -668,8 +1228,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMINone_WithoutCheckPolicy) {
EXPECT_CALL(mock_app_mngr_, GetUserConsentForDevice("12345")).Times(0);
- EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, kDefaultTestLevel_))
.Times(AtLeast(1));
const bool res =
res_ctrl_->SetAppHMIState(mock_app_, kDefaultTestLevel_, false);
@@ -681,8 +1241,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMILimited_WithoutCheckPolicy) {
GetInfoFromApp();
EXPECT_CALL(mock_app_mngr_, GetUserConsentForDevice("12345")).Times(0);
- EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, test_type))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, false);
EXPECT_TRUE(res);
@@ -695,8 +1255,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithoutCheckPolicy) {
EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_)).Times(0);
EXPECT_CALL(mock_app_mngr_, GetUserConsentForDevice("12345")).Times(0);
- EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, test_type))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, false);
@@ -710,8 +1270,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithPolicy_DevAllowed) {
ON_CALL(mock_app_mngr_, GetUserConsentForDevice("12345"))
.WillByDefault(Return(policy::kDeviceAllowed));
- EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, test_type))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, true);
@@ -725,18 +1285,18 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithPolicy_DevDisallowed) {
ON_CALL(mock_app_mngr_, GetUserConsentForDevice("12345"))
.WillByDefault(Return(policy::kDeviceDisallowed));
- EXPECT_CALL(*mock_app_, set_is_resuming(true));
ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
.WillByDefault(Return(kDefaultTestLevel_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, kDefaultTestLevel_))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, true);
EXPECT_FALSE(res);
}
TEST_F(ResumeCtrlTest, SaveAllApplications) {
- utils::SharedPtr<application_manager_test::MockApplication> test_app =
- ::utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager_test::MockApplication> test_app =
+ std::make_shared<application_manager_test::MockApplication>();
EXPECT_CALL(*test_app, app_id()).WillRepeatedly(Return(kTestAppId_));
application_manager::ApplicationSet app_set;
@@ -751,8 +1311,8 @@ TEST_F(ResumeCtrlTest, SaveAllApplications) {
}
TEST_F(ResumeCtrlTest, SaveAllApplications_EmptyApplicationlist) {
- utils::SharedPtr<application_manager::Application> mock_app =
- ::utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager::Application> mock_app =
+ std::make_shared<application_manager_test::MockApplication>();
application_manager::ApplicationSet app_set;
@@ -765,8 +1325,8 @@ TEST_F(ResumeCtrlTest, SaveAllApplications_EmptyApplicationlist) {
}
TEST_F(ResumeCtrlTest, SaveApplication) {
- utils::SharedPtr<application_manager::Application> app_sh_mock =
- ::utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager::Application> app_sh_mock =
+ std::make_shared<application_manager_test::MockApplication>();
EXPECT_CALL(*mock_storage_, SaveApplication(app_sh_mock));
res_ctrl_->SaveApplication(app_sh_mock);
@@ -786,16 +1346,16 @@ TEST_F(ResumeCtrlTest, OnAppActivated_ResumptionHasStarted) {
const bool res = res_ctrl_->StartResumptionOnlyHMILevel(mock_app_);
EXPECT_TRUE(res);
- utils::SharedPtr<application_manager_test::MockApplication> app_sh_mock =
- ::utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager_test::MockApplication> app_sh_mock =
+ std::make_shared<application_manager_test::MockApplication>();
EXPECT_CALL(*app_sh_mock, app_id()).WillOnce(Return(kTestAppId_));
res_ctrl_->OnAppActivated(app_sh_mock);
}
TEST_F(ResumeCtrlTest, OnAppActivated_ResumptionNotActive) {
- utils::SharedPtr<application_manager_test::MockApplication> app_sh_mock =
- ::utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager_test::MockApplication> app_sh_mock =
+ std::make_shared<application_manager_test::MockApplication>();
EXPECT_CALL(*app_sh_mock, app_id()).Times(0);
res_ctrl_->OnAppActivated(app_sh_mock);
}
@@ -901,8 +1461,8 @@ TEST_F(ResumeCtrlTest, DISABLED_OnSuspend) {
}
TEST_F(ResumeCtrlTest, OnSuspend_EmptyApplicationlist) {
- utils::SharedPtr<application_manager::Application> mock_app =
- ::utils::MakeShared<application_manager_test::MockApplication>();
+ std::shared_ptr<application_manager::Application> mock_app =
+ std::make_shared<application_manager_test::MockApplication>();
application_manager::ApplicationSet app_set;
@@ -968,6 +1528,196 @@ TEST_F(ResumeCtrlTest, GetSavedAppHmiLevel_AskedAppFound_INVALID_ENUM) {
res_ctrl_->GetSavedAppHmiLevel(kTestPolicyAppId_, kMacAddress_));
}
+TEST_F(
+ ResumeCtrlTest,
+ ResumptionLowVoltage_AppInFullUnregisteredWithinTimeFrame_HMILevelRestored) {
+ 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;
+ smart_objects::SmartObject saved_app;
+ saved_app[application_manager::strings::hmi_level] = restored_test_type;
+ saved_app[application_manager::strings::time_stamp] = time_stamp;
+
+ application_manager::CommandsMap command;
+ DataAccessor<application_manager::CommandsMap> data_accessor(
+ command, app_set_lock_ptr_);
+
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
+ .Times(AtLeast(1));
+ GetInfoFromApp();
+ EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ EXPECT_CALL(*mock_app_, commands_map()).WillRepeatedly(Return(data_accessor));
+ ON_CALL(*mock_storage_,
+ GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
+ .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+
+ EXPECT_CALL(*mock_storage_,
+ RemoveApplicationFromSaved(kTestPolicyAppId_, kMacAddress_))
+ .WillOnce(Return(true));
+
+ ON_CALL(mock_app_mngr_, GetUserConsentForDevice("12345"))
+ .WillByDefault(Return(policy::kDeviceAllowed));
+
+ NiceMock<MockApplicationManagerSettings> app_mngr_settings_;
+ EXPECT_CALL(mock_app_mngr_, get_settings())
+ .WillOnce(ReturnRef(app_mngr_settings_));
+
+ EXPECT_CALL(app_mngr_settings_, resumption_delay_before_ign())
+ .WillOnce(Return(resumption_delay_before_ign_));
+
+ res_ctrl_->SaveLowVoltageTime();
+ res_ctrl_->StartAppHmiStateResumption(mock_app_);
+}
+
+TEST_F(
+ ResumeCtrlTest,
+ ResumptionLowVoltage_AppInFullUnregisteredBeyondTimeFrame_HMILevelNotRestored) {
+ 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;
+ smart_objects::SmartObject saved_app;
+ saved_app[application_manager::strings::hmi_level] = restored_test_type;
+ saved_app[application_manager::strings::time_stamp] = time_stamp;
+
+ application_manager::CommandsMap command;
+ DataAccessor<application_manager::CommandsMap> data_accessor(
+ command, app_set_lock_ptr_);
+
+ EXPECT_CALL(mock_app_mngr_, state_controller()).Times(0);
+ GetInfoFromApp();
+ EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ EXPECT_CALL(*mock_app_, commands_map()).WillRepeatedly(Return(data_accessor));
+ ON_CALL(*mock_storage_,
+ GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
+ .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+
+ ON_CALL(mock_app_mngr_, GetUserConsentForDevice("12345"))
+ .WillByDefault(Return(policy::kDeviceAllowed));
+
+ NiceMock<MockApplicationManagerSettings> app_mngr_settings_;
+ EXPECT_CALL(mock_app_mngr_, get_settings())
+ .WillOnce(ReturnRef(app_mngr_settings_));
+
+ EXPECT_CALL(app_mngr_settings_, resumption_delay_before_ign())
+ .WillOnce(Return(resumption_delay_before_ign_));
+
+ res_ctrl_->SaveLowVoltageTime();
+ res_ctrl_->StartAppHmiStateResumption(mock_app_);
+}
+
+TEST_F(ResumeCtrlTest, ResumptionLowVoltage_AppInBackground_NotRestored) {
+ const mobile_apis::HMILevel::eType restored_test_type = eType::HMI_BACKGROUND;
+ const uint32_t time_offset = 5;
+ const uint32_t time_stamp =
+ time(nullptr) - resumption_delay_before_ign_ - time_offset;
+ smart_objects::SmartObject saved_app;
+ saved_app[application_manager::strings::hmi_level] = restored_test_type;
+ saved_app[application_manager::strings::time_stamp] = time_stamp;
+
+ application_manager::CommandsMap command;
+ DataAccessor<application_manager::CommandsMap> data_accessor(
+ command, app_set_lock_ptr_);
+
+ EXPECT_CALL(mock_app_mngr_, state_controller()).Times(0);
+ GetInfoFromApp();
+ EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ EXPECT_CALL(*mock_app_, commands_map()).WillRepeatedly(Return(data_accessor));
+ ON_CALL(*mock_storage_,
+ GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
+ .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+
+ res_ctrl_->SaveLowVoltageTime();
+ res_ctrl_->StartAppHmiStateResumption(mock_app_);
+}
+
+TEST_F(
+ ResumeCtrlTest,
+ ResumptionLowVoltage_AppInLimitedlUnregisteredWithinTimeFrame_HMILevelRestored) {
+ const mobile_apis::HMILevel::eType restored_test_type = eType::HMI_LIMITED;
+ const uint32_t time_offset = 5;
+ const uint32_t time_stamp =
+ time(nullptr) - resumption_delay_before_ign_ + time_offset;
+ smart_objects::SmartObject saved_app;
+ saved_app[application_manager::strings::hmi_level] = restored_test_type;
+ saved_app[application_manager::strings::time_stamp] = time_stamp;
+
+ application_manager::CommandsMap command;
+ DataAccessor<application_manager::CommandsMap> data_accessor(
+ command, app_set_lock_ptr_);
+
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
+ .Times(AtLeast(1));
+ GetInfoFromApp();
+ EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ EXPECT_CALL(*mock_app_, commands_map()).WillRepeatedly(Return(data_accessor));
+ ON_CALL(*mock_storage_,
+ GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
+ .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+
+ EXPECT_CALL(*mock_storage_,
+ RemoveApplicationFromSaved(kTestPolicyAppId_, kMacAddress_))
+ .WillOnce(Return(true));
+
+ ON_CALL(mock_app_mngr_, GetUserConsentForDevice("12345"))
+ .WillByDefault(Return(policy::kDeviceAllowed));
+
+ NiceMock<MockApplicationManagerSettings> app_mngr_settings_;
+ EXPECT_CALL(mock_app_mngr_, get_settings())
+ .WillOnce(ReturnRef(app_mngr_settings_));
+
+ EXPECT_CALL(app_mngr_settings_, resumption_delay_before_ign())
+ .WillOnce(Return(resumption_delay_before_ign_ + time_offset));
+
+ res_ctrl_->SaveLowVoltageTime();
+ res_ctrl_->StartAppHmiStateResumption(mock_app_);
+}
+
+TEST_F(
+ ResumeCtrlTest,
+ ResumptionLowVoltage_AppInLimitedlUnregisteredBeyondTimeFrame_HMILevelNotRestored) {
+ const mobile_apis::HMILevel::eType restored_test_type = eType::HMI_LIMITED;
+ const uint32_t time_offset = 5;
+ const uint32_t time_stamp =
+ time(nullptr) - resumption_delay_before_ign_ - time_offset;
+ smart_objects::SmartObject saved_app;
+ saved_app[application_manager::strings::hmi_level] = restored_test_type;
+ saved_app[application_manager::strings::time_stamp] = time_stamp;
+
+ application_manager::CommandsMap command;
+ DataAccessor<application_manager::CommandsMap> data_accessor(
+ command, app_set_lock_ptr_);
+
+ EXPECT_CALL(mock_app_mngr_, state_controller()).Times(0);
+ GetInfoFromApp();
+ EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
+ .WillRepeatedly(Return(kDefaultTestLevel_));
+ EXPECT_CALL(*mock_app_, commands_map()).WillRepeatedly(Return(data_accessor));
+ ON_CALL(*mock_storage_,
+ GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _))
+ .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true)));
+
+ ON_CALL(mock_app_mngr_, GetUserConsentForDevice("12345"))
+ .WillByDefault(Return(policy::kDeviceAllowed));
+
+ NiceMock<MockApplicationManagerSettings> app_mngr_settings_;
+ EXPECT_CALL(mock_app_mngr_, get_settings())
+ .WillOnce(ReturnRef(app_mngr_settings_));
+
+ EXPECT_CALL(app_mngr_settings_, resumption_delay_before_ign())
+ .WillOnce(Return(resumption_delay_before_ign_));
+
+ res_ctrl_->SaveLowVoltageTime();
+ res_ctrl_->StartAppHmiStateResumption(mock_app_);
+}
+
} // namespace resumption_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/resumption/resumption_data_db_test.cc b/src/components/application_manager/test/resumption/resumption_data_db_test.cc
index a75ba23bfb..d67c229cc3 100644
--- a/src/components/application_manager/test/resumption/resumption_data_db_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_db_test.cc
@@ -30,30 +30,30 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include <algorithm>
-#include "gtest/gtest.h"
+#include <string>
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager_settings.h"
+#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
#include "utils/sqlite_wrapper/sql_database.h"
#include "utils/sqlite_wrapper/sql_query.h"
-#include "utils/make_shared.h"
-#include "utils/file_system.h"
+
#include "application_manager/resumption_data_test.h"
#include "application_manager/test_resumption_data_db.h"
+#include "utils/file_system.h"
-#include "application_manager/resumption/resumption_sql_queries.h"
#include "application_manager/resumption/resumption_data_db.h"
+#include "application_manager/resumption/resumption_sql_queries.h"
namespace test {
namespace components {
namespace resumption_test {
+using application_manager_test::MockApplication;
+using ::testing::_;
using ::testing::NiceMock;
using ::testing::ReturnRef;
-using ::testing::_;
-using application_manager_test::MockApplication;
namespace am = application_manager;
using namespace file_system;
@@ -68,7 +68,7 @@ const std::string kPath =
class ResumptionDataDBTest : public ResumptionDataTest {
protected:
void SetUp() OVERRIDE {
- app_mock = utils::MakeShared<NiceMock<MockApplication> >();
+ app_mock = std::make_shared<NiceMock<MockApplication> >();
policy_app_id_ = "test_policy_app_id";
app_id_ = 10;
is_audio_ = true;
@@ -123,7 +123,7 @@ class ResumptionDataDBTest : public ResumptionDataTest {
void SetZeroIgnOffTime() {
utils::dbms::SQLQuery query(test_db());
- EXPECT_TRUE(query.Prepare(KUpdateLastIgnOffTime));
+ EXPECT_TRUE(query.Prepare(kUpdateLastIgnOffTime));
query.Bind(0, 0);
EXPECT_TRUE(query.Exec());
}
@@ -344,7 +344,8 @@ void ResumptionDataDBTest::CheckCharacters(int64_t global_properties_key) {
while (select_characters.Next()) {
std::string character =
(*keyboard_props_)[am::strings::limited_character_list]
- [characters_idx++].asString();
+ [characters_idx++]
+ .asString();
EXPECT_EQ(character, select_characters.GetString(0));
}
}
@@ -392,16 +393,17 @@ void ResumptionDataDBTest::CheckCommandsData() {
++i;
uint cmd = (*test_commands_map[i])[am::strings::cmd_id].asUInt();
EXPECT_EQ(cmd, select_commands.GetUInteger(1));
- std::string name =
- (*test_commands_map[i])[am::strings::menu_params]
- [am::strings::menu_name].asString();
+ std::string name = (*test_commands_map[i])[am::strings::menu_params]
+ [am::strings::menu_name]
+ .asString();
EXPECT_EQ(name, select_commands.GetString(2));
int position = (*test_commands_map[i])[am::strings::menu_params]
- [am::strings::position].asInt();
+ [am::strings::position]
+ .asInt();
EXPECT_EQ(position, select_commands.GetInteger(4));
- int parent_id =
- (*test_commands_map[i])[am::strings::menu_params]
- [am::hmi_request::parent_id].asInt();
+ int parent_id = (*test_commands_map[i])[am::strings::menu_params]
+ [am::hmi_request::parent_id]
+ .asInt();
EXPECT_EQ(parent_id, select_commands.GetInteger(3));
std::string icon_name =
(*test_commands_map[i])[am::strings::cmd_icon][am::strings::value]
@@ -409,7 +411,8 @@ void ResumptionDataDBTest::CheckCommandsData() {
EXPECT_EQ(icon_name, select_commands.GetString(5));
int icon_type = (*test_commands_map[i])[am::strings::cmd_icon]
- [am::strings::image_type].asInt();
+ [am::strings::image_type]
+ .asInt();
EXPECT_EQ(icon_type, select_commands.GetInteger(6));
j = 0;
@@ -461,12 +464,12 @@ void ResumptionDataDBTest::CheckChoiceSetData() {
std::string menu_name =
command[am::strings::choice_set][choice_idx][am::strings::menu_name]
.asString();
- std::string secondary_text =
- command[am::strings::choice_set][choice_idx]
- [am::strings::secondary_text].asString();
- std::string tertiary_text =
- command[am::strings::choice_set][choice_idx]
- [am::strings::tertiary_text].asString();
+ std::string secondary_text = command[am::strings::choice_set][choice_idx]
+ [am::strings::secondary_text]
+ .asString();
+ std::string tertiary_text = command[am::strings::choice_set][choice_idx]
+ [am::strings::tertiary_text]
+ .asString();
EXPECT_EQ(choice_id, select_choice_set.GetInteger(4));
EXPECT_EQ(menu_name, select_choice_set.GetString(5));
@@ -478,12 +481,12 @@ void ResumptionDataDBTest::CheckChoiceSetData() {
EXPECT_TRUE(select_image.Prepare(kSelectImage));
select_image.Bind(0, select_choice_set.GetLongInt(8));
EXPECT_TRUE(select_image.Exec());
- std::string image_value =
- command[am::strings::choice_set][choice_idx][am::strings::image]
- [am::strings::value].asString();
- int image_type =
- command[am::strings::choice_set][choice_idx][am::strings::image]
- [am::strings::image_type].asInt();
+ std::string image_value = command[am::strings::choice_set][choice_idx]
+ [am::strings::image][am::strings::value]
+ .asString();
+ int image_type = command[am::strings::choice_set][choice_idx]
+ [am::strings::image][am::strings::image_type]
+ .asInt();
EXPECT_EQ(image_value, select_image.GetString(1));
EXPECT_EQ(image_type, select_image.GetInteger(0));
@@ -491,9 +494,9 @@ void ResumptionDataDBTest::CheckChoiceSetData() {
EXPECT_TRUE(select_image.Prepare(kSelectImage));
select_image.Bind(0, select_choice_set.GetLongInt(9));
EXPECT_TRUE(select_image.Exec());
- image_value =
- command[am::strings::choice_set][choice_idx]
- [am::strings::secondary_image][am::strings::value].asString();
+ image_value = command[am::strings::choice_set][choice_idx]
+ [am::strings::secondary_image][am::strings::value]
+ .asString();
image_type =
command[am::strings::choice_set][choice_idx]
[am::strings::secondary_image][am::strings::image_type]
@@ -503,9 +506,9 @@ void ResumptionDataDBTest::CheckChoiceSetData() {
vr_cmd_idx = 0;
}
- std::string vr_comm =
- command[am::strings::choice_set][choice_idx][am::strings::vr_commands]
- [vr_cmd_idx++].asString();
+ std::string vr_comm = command[am::strings::choice_set][choice_idx]
+ [am::strings::vr_commands][vr_cmd_idx++]
+ .asString();
EXPECT_EQ(vr_comm, select_choice_set.GetString(10));
}
}
diff --git a/src/components/application_manager/test/resumption/resumption_data_json_test.cc b/src/components/application_manager/test/resumption/resumption_data_json_test.cc
index ea257b902c..9d348ecbb7 100644
--- a/src/components/application_manager/test/resumption/resumption_data_json_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_json_test.cc
@@ -30,15 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include <algorithm>
+#include <string>
#include "gtest/gtest.h"
-#include "application_manager/usage_statistics.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_resumption_data.h"
+#include "application_manager/usage_statistics.h"
#include "interfaces/MOBILE_API.h"
#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
#include "application_manager/resumption_data_test.h"
#include "formatters/CFormatterJsonBase.h"
@@ -51,9 +52,9 @@ namespace components {
namespace resumption_test {
using ::testing::_;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
namespace am = application_manager;
using namespace Json;
@@ -61,15 +62,18 @@ using namespace file_system;
using namespace resumption;
using namespace mobile_apis;
-namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
+namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
class ResumptionDataJsonTest : public ResumptionDataTest {
protected:
ResumptionDataJsonTest()
- : last_state_("app_storage_folder", "app_info_storage")
- , res_json(last_state_, mock_application_manager_) {}
+ : last_state_wrapper_(std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>("app_storage_folder",
+ "app_info_storage")))
+ , res_json(last_state_wrapper_, mock_application_manager_) {}
virtual void SetUp() {
- app_mock = new NiceMock<application_manager_test::MockApplication>();
+ app_mock = std::make_shared<
+ NiceMock<application_manager_test::MockApplication> >();
policy_app_id_ = "test_policy_app_id";
app_id_ = 10;
@@ -82,29 +86,34 @@ class ResumptionDataJsonTest : public ResumptionDataTest {
}
void CheckSavedJson() {
- Value& dictionary = last_state_.get_dictionary();
+ resumption::LastStateAccessor accessor =
+ last_state_wrapper_->get_accessor();
+ Value dictionary = accessor.GetData().dictionary();
ASSERT_TRUE(dictionary[am::strings::resumption].isObject());
ASSERT_TRUE(
dictionary[am::strings::resumption][am::strings::resume_app_list]
.isArray());
- Value& resume_app_list =
+ const Value& resume_app_list =
dictionary[am::strings::resumption][am::strings::resume_app_list];
sm::SmartObject res_app_list;
for (uint32_t i = 0; i < resume_app_list.size(); i++) {
- Formatters::CFormatterJsonBase::jsonValueToObj(resume_app_list[i],
+ formatters::CFormatterJsonBase::jsonValueToObj(resume_app_list[i],
res_app_list);
CheckSavedApp(res_app_list);
}
}
void SetZeroIgnOff() {
- Value& dictionary = last_state_.get_dictionary();
+ resumption::LastStateAccessor accessor =
+ last_state_wrapper_->get_accessor();
+ Value dictionary = accessor.GetData().dictionary();
Value& res = dictionary[am::strings::resumption];
res[am::strings::last_ign_off_time] = 0;
- last_state_.SaveStateToFileSystem();
+ accessor.GetMutableData().set_dictionary(dictionary);
+ accessor.GetMutableData().SaveToFileSystem();
}
- resumption::LastStateImpl last_state_;
+ std::shared_ptr<resumption::LastStateWrapperImpl> last_state_wrapper_;
ResumptionDataJson res_json;
};
diff --git a/src/components/application_manager/test/resumption/resumption_data_test.cc b/src/components/application_manager/test/resumption/resumption_data_test.cc
index e80349dd47..e362064a78 100644
--- a/src/components/application_manager/test/resumption/resumption_data_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_test.cc
@@ -30,17 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include <algorithm>
+#include <string>
#include "gtest/gtest.h"
-#include "application_manager/usage_statistics.h"
+#include "application_manager/application.h"
+#include "application_manager/message_helper.h"
#include "application_manager/mock_resumption_data.h"
+#include "application_manager/usage_statistics.h"
#include "utils/custom_string.h"
-#include "application_manager/application.h"
#include "utils/data_accessor.h"
-#include "application_manager/message_helper.h"
-#include "utils/make_shared.h"
#include "application_manager/resumption_data_test.h"
@@ -48,10 +47,10 @@ namespace test {
namespace components {
namespace resumption_test {
namespace custom_str = utils::custom_string;
+using ::testing::_;
using ::testing::Return;
-using ::testing::ReturnRef;
using ::testing::ReturnPointee;
-using ::testing::_;
+using ::testing::ReturnRef;
void ResumptionDataTest::CheckSavedApp(sm::SmartObject& resume_app_list) {
EXPECT_EQ(policy_app_id_, resume_app_list[am::strings::app_id].asString());
@@ -75,14 +74,15 @@ void ResumptionDataTest::CheckSavedApp(sm::SmartObject& resume_app_list) {
CheckGlobalProporties(
resume_app_list[am::strings::application_global_properties]);
CheckSubscriptions(resume_app_list[am::strings::application_subscriptions]);
+ CheckWindowsInfo(resume_app_list[am::strings::windows_info]);
}
void ResumptionDataTest::CheckCommands(sm::SmartObject& res_list) {
for (uint32_t i = 0; i < kCountOfCommands_; ++i) {
EXPECT_EQ(i, res_list[i][am::strings::cmd_id].asUInt());
- std::string name =
- (*test_commands_map[i])[am::strings::menu_params]
- [am::strings::menu_name].asString();
+ std::string name = (*test_commands_map[i])[am::strings::menu_params]
+ [am::strings::menu_name]
+ .asString();
EXPECT_EQ(name,
res_list[i][am::strings::menu_params][am::strings::menu_name]
.asString());
@@ -94,7 +94,8 @@ void ResumptionDataTest::CheckCommands(sm::SmartObject& res_list) {
res_list[i][am::strings::menu_params][am::strings::position].asInt());
int parent_id = (*test_commands_map[i])[am::strings::menu_params]
- [am::hmi_request::parent_id].asInt();
+ [am::hmi_request::parent_id]
+ .asInt();
EXPECT_EQ(parent_id,
res_list[i][am::strings::menu_params][am::hmi_request::parent_id]
.asInt());
@@ -151,20 +152,24 @@ void ResumptionDataTest::CheckChoiceSet(sm::SmartObject& res_list) {
std::snprintf(numb, 12, "%d", i + j);
std::string test_choice =
(*test_choiceset_map[i])[am::strings::choice_set][j]
- [am::strings::vr_commands][0].asString();
+ [am::strings::vr_commands][0]
+ .asString();
EXPECT_EQ(test_choice, command[am::strings::vr_commands][0].asString());
std::string menu_name =
(*test_choiceset_map[i])[am::strings::choice_set][j]
- [am::strings::menu_name].asString();
+ [am::strings::menu_name]
+ .asString();
EXPECT_EQ(menu_name, command[am::strings::menu_name].asString());
std::string secondary_text =
(*test_choiceset_map[i])[am::strings::choice_set][j]
- [am::strings::secondary_text].asString();
+ [am::strings::secondary_text]
+ .asString();
EXPECT_EQ(secondary_text,
command[am::strings::secondary_text].asString());
std::string tertiary_text =
(*test_choiceset_map[i])[am::strings::choice_set][j]
- [am::strings::tertiary_text].asString();
+ [am::strings::tertiary_text]
+ .asString();
EXPECT_EQ(tertiary_text, command[am::strings::tertiary_text].asString());
std::string image_value =
@@ -182,13 +187,15 @@ void ResumptionDataTest::CheckChoiceSet(sm::SmartObject& res_list) {
image_value = (*test_choiceset_map[i])[am::strings::choice_set][j]
[am::strings::secondary_image]
- [am::strings::value].asString();
+ [am::strings::value]
+ .asString();
EXPECT_EQ(
image_value,
command[am::strings::secondary_image][am::strings::value].asString());
image_type = (*test_choiceset_map[i])[am::strings::choice_set][j]
[am::strings::secondary_image]
- [am::strings::image_type].asInt();
+ [am::strings::image_type]
+ .asInt();
EXPECT_EQ(image_type,
command[am::strings::secondary_image][am::strings::image_type]
.asInt());
@@ -292,7 +299,7 @@ void ResumptionDataTest::CheckHelpPrompt(sm::SmartObject& res_list) {
}
void ResumptionDataTest::CheckTimeoutPrompt(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& res_list) {
+ ns_smart_device_link::ns_smart_objects::SmartObject& res_list) {
for (uint i = 0; i < tts_chunks_count; ++i) {
std::string text = (*timeout_prompt_)[i][am::strings::text].asString();
SpeechCapabilities::eType speech = static_cast<SpeechCapabilities::eType>(
@@ -316,14 +323,41 @@ void ResumptionDataTest::CheckVRHelp(sm::SmartObject& res_list) {
}
void ResumptionDataTest::CheckVRTitle(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& res_list) {
+ ns_smart_device_link::ns_smart_objects::SmartObject& res_list) {
std::string vtitle = (*vr_help_title_)[am::strings::vr_help_title].asString();
EXPECT_EQ(vtitle, res_list[am::strings::vr_help_title].asString());
}
+void ResumptionDataTest::CheckWindowsInfo(sm::SmartObject& res_list) {
+ using namespace application_manager;
+ auto check_window_info = [this](
+ const smart_objects::SmartObject& window_info) {
+ using namespace application_manager;
+ const WindowID saved_window_id = window_info[strings::window_id].asInt();
+ const auto test_window_info = test_window_params_map_[saved_window_id];
+ const auto& saved_window_name =
+ window_info[strings::window_name].asString();
+ ASSERT_TRUE(0 != test_window_info.use_count());
+ const auto& window_name =
+ (*test_window_info)[strings::window_name].asString();
+ const auto& saved_duplicate_window_id =
+ window_info[strings::duplicate_updates_from_window_id].asInt();
+ const auto& saved_associated_service_type =
+ window_info[strings::associated_service_type].asString();
+ EXPECT_EQ(saved_window_name, window_name);
+ EXPECT_EQ("ServiceType", saved_associated_service_type);
+ EXPECT_EQ(0, saved_duplicate_window_id);
+ };
+
+ for (size_t i = 0; i < res_list.length(); ++i) {
+ const auto& saved_window_info = res_list[i];
+ check_window_info(saved_window_info);
+ }
+}
+
void ResumptionDataTest::PrepareData() {
- mock_app_extension_ = utils::MakeShared<
- NiceMock<application_manager_test::MockAppExtension> >();
+ mock_app_extension_ =
+ std::make_shared<NiceMock<application_manager_test::MockAppExtension> >();
extensions_.insert(extensions_.begin(), mock_app_extension_);
ON_CALL(*app_mock, Extensions()).WillByDefault(ReturnRef(extensions_));
SetGlobalProporties();
@@ -335,9 +369,14 @@ void ResumptionDataTest::PrepareData() {
DataAccessor<am::SubMenuMap> sub_menu_m(test_submenu_map, sublock_ptr_);
DataAccessor<am::CommandsMap> commands_m(test_commands_map, comlock_ptr_);
DataAccessor<am::ChoiceSetMap> choice_set_m(test_choiceset_map, setlock_ptr_);
+ DataAccessor<am::WindowParamsMap> window_params_map(
+ test_window_params_map_, window_params_map_lock_ptr_);
SetSubscriptions();
DataAccessor<am::ButtonSubscriptions> btn_sub(btn_subscr, btnlock_ptr_);
+ SetWindowsInfo();
+ SetDefaultCurrentHmiState();
+ SetDefaultWindowIds();
ON_CALL(*app_mock, is_application_data_changed()).WillByDefault(Return(true));
@@ -346,7 +385,8 @@ void ResumptionDataTest::PrepareData() {
ON_CALL(*app_mock, curHash()).WillByDefault(ReturnRef(hash_));
ON_CALL(*app_mock, get_grammar_id()).WillByDefault(Return(grammar_id_));
ON_CALL(*app_mock, device()).WillByDefault(Return(device_handle_));
- ON_CALL(*app_mock, hmi_level()).WillByDefault(Return(hmi_level_));
+ ON_CALL(*app_mock, hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(hmi_level_));
ON_CALL(*app_mock, app_id()).WillByDefault(Return(app_id_));
ON_CALL(*app_mock, hmi_app_id()).WillByDefault(Return(hmi_app_id_));
ON_CALL(*app_mock, IsAudioApplication()).WillByDefault(Return(is_audio_));
@@ -369,6 +409,21 @@ void ResumptionDataTest::PrepareData() {
ON_CALL(*app_mock, SubscribedButtons()).WillByDefault(Return(btn_sub));
ON_CALL(*app_mock, getAppFiles()).WillByDefault(ReturnRef(app_files_map_));
+ ON_CALL(*app_mock, window_optional_params_map())
+ .WillByDefault(Return(window_params_map));
+}
+
+void ResumptionDataTest::SetDefaultCurrentHmiState() {
+ am::HmiStatePtr hmi_state =
+ std::make_shared<am::HmiState>(app_mock, mock_application_manager_);
+ hmi_state->set_window_type(mobile_apis::WindowType::WIDGET);
+
+ ON_CALL(*app_mock, CurrentHmiState(_)).WillByDefault(Return(hmi_state));
+}
+
+void ResumptionDataTest::SetDefaultWindowIds() {
+ const am::WindowIds window_ids{1, 2, 3, 4, 5};
+ ON_CALL(*app_mock, GetWindowIds()).WillByDefault(Return(window_ids));
}
void ResumptionDataTest::SetGlobalProporties() {
@@ -544,6 +599,21 @@ void ResumptionDataTest::SetSubscriptions() {
btn_subscr.insert(ButtonName::eType::OK);
}
+void ResumptionDataTest::SetWindowsInfo() {
+ using namespace application_manager;
+ const uint32_t number_of_widgets = 5;
+ for (uint32_t i = 0; i < number_of_widgets; ++i) {
+ auto window_info = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ const WindowID window_id = i + 1;
+ (*window_info)[strings::window_name] =
+ std::string("Widget ") + std::to_string(window_id);
+ (*window_info)[strings::associated_service_type] = "ServiceType";
+ (*window_info)[strings::duplicate_updates_from_window_id] = 0;
+ test_window_params_map_[window_id] = window_info;
+ }
+}
+
} // namespace resumption_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/resumption_sql_queries_test.cc b/src/components/application_manager/test/resumption_sql_queries_test.cc
index 0ec902085f..61490ae4af 100644
--- a/src/components/application_manager/test/resumption_sql_queries_test.cc
+++ b/src/components/application_manager/test/resumption_sql_queries_test.cc
@@ -31,17 +31,17 @@
*/
#include <algorithm>
-#include <vector>
-#include <string>
#include <sstream>
+#include <string>
#include <utility>
+#include <vector>
#include "gtest/gtest.h"
-#include "utils/sqlite_wrapper/sql_database.h"
-#include "utils/sqlite_wrapper/sql_query.h"
-#include "utils/file_system.h"
#include "application_manager/resumption/resumption_sql_queries.h"
#include "policy/sql_pt_queries.h"
+#include "utils/file_system.h"
+#include "utils/sqlite_wrapper/sql_database.h"
+#include "utils/sqlite_wrapper/sql_query.h"
namespace test {
namespace components {
@@ -49,8 +49,8 @@ namespace resumption_test {
using namespace ::resumption;
-using std::string;
using std::pair;
+using std::string;
using utils::dbms::SQLDatabase;
using utils::dbms::SQLQuery;
@@ -808,7 +808,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectCountHMILevel_ExpectDataCorrect) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -838,7 +839,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectHMILevel_ExpectDataCorrect) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -866,7 +868,8 @@ TEST_F(ResumptionSqlQueriesTest, kCheckHMIId_ExpectDataCorrect) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -894,7 +897,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectHMIId_ExpectDataCorrect) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -922,7 +926,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectCountHMIId_ExpectDataCorrect) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -951,7 +956,8 @@ TEST_F(ResumptionSqlQueriesTest, kCountHashId_ExpectDataCorrect) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -980,7 +986,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectHashId_ExpectDataCorrect) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -1017,7 +1024,8 @@ TEST_F(ResumptionSqlQueriesTest, kCheckApplication_ExpectDataCorrect) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -1045,7 +1053,8 @@ TEST_F(ResumptionSqlQueriesTest, kCountApplications_ExpectDataCorrect) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -1091,7 +1100,8 @@ TEST_F(ResumptionSqlQueriesTest,
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -1122,7 +1132,8 @@ TEST_F(ResumptionSqlQueriesTest, kUpdateHMILevel_ExpectDataUpdated) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -1158,7 +1169,8 @@ TEST_F(ResumptionSqlQueriesTest, kUpdateIgnOffCount_ExpectDataUpdated) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -1192,7 +1204,8 @@ TEST_F(ResumptionSqlQueriesTest, kCountApplicationsIgnOff_ExpectDataCorrect) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -1236,7 +1249,8 @@ TEST_F(ResumptionSqlQueriesTest,
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -1279,7 +1293,8 @@ TEST_F(ResumptionSqlQueriesTest, kUpdateSuspendData_ExpectDataUpdated) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -1311,7 +1326,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteFile_ExpectDataDeleted) {
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key1 = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key1)
.LastInsertId();
@@ -1326,7 +1342,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteFile_ExpectDataDeleted) {
false,
app_id2,
device_id,
- key1).LastInsertId();
+ key1)
+ .LastInsertId();
int64_t key2 =
FillFileTable(temp_query, 1, true, true, "tst_name").LastInsertId();
FillApplicationFilesArrayTable(temp_query, key1, key2);
@@ -1344,7 +1361,8 @@ TEST_F(ResumptionSqlQueriesTest,
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key1 = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key1)
.LastInsertId();
@@ -1359,7 +1377,8 @@ TEST_F(ResumptionSqlQueriesTest,
false,
app_id2,
device_id,
- key1).LastInsertId();
+ key1)
+ .LastInsertId();
int64_t key2 =
FillFileTable(temp_query, 1, true, true, "tst_name").LastInsertId();
FillApplicationFilesArrayTable(temp_query, key1, key2);
@@ -1383,7 +1402,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteSubMenu_ExpectDataDeleted) {
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -1398,7 +1418,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteSubMenu_ExpectDataDeleted) {
false,
app_id2,
device_id,
- key).LastInsertId();
+ key)
+ .LastInsertId();
int64_t submenu_key =
FillSubMenuTable(temp_query, 1, "tst_menuName", 2).LastInsertId();
@@ -1417,7 +1438,8 @@ TEST_F(ResumptionSqlQueriesTest,
int64_t key = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key)
.LastInsertId();
@@ -1432,7 +1454,8 @@ TEST_F(ResumptionSqlQueriesTest,
false,
app_id2,
device_id,
- key).LastInsertId();
+ key)
+ .LastInsertId();
int64_t submenu_key =
FillSubMenuTable(temp_query, 1, "tst_menuName", 2).LastInsertId();
@@ -1454,7 +1477,8 @@ TEST_F(ResumptionSqlQueriesTest,
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
key1 = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key1)
.LastInsertId();
@@ -1469,7 +1493,8 @@ TEST_F(ResumptionSqlQueriesTest,
false,
app_id2,
device_id,
- key1).LastInsertId();
+ key1)
+ .LastInsertId();
int64_t key2 =
FillFileTable(temp_query, 1, true, true, "tst_name").LastInsertId();
key1 = FillApplicationFilesArrayTable(temp_query, key1, key2).LastInsertId();
@@ -1494,7 +1519,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteImageFromCommands_ExpectDataDeleted) {
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t key2 = FillCommandTable(temp_query, 1, "tst_menu_name", 1, 2, key1)
.LastInsertId();
key1 = FillGlobalPropertiesTable(
@@ -1511,7 +1537,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteImageFromCommands_ExpectDataDeleted) {
false,
app_id2,
device_id,
- key1).LastInsertId();
+ key1)
+ .LastInsertId();
FillApplicationCommandsArrayTable(temp_query, key1, key2);
// Check before action
const std::string select_count_image = "SELECT COUNT(*) FROM image;";
@@ -1527,7 +1554,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteVrCommands_ExpectDataDeleted) {
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t key2 = FillCommandTable(temp_query, 1, "tst_menu_name", 1, 2, key1)
.LastInsertId();
key1 = FillGlobalPropertiesTable(
@@ -1544,7 +1572,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteVrCommands_ExpectDataDeleted) {
false,
app_id2,
device_id,
- key1).LastInsertId();
+ key1)
+ .LastInsertId();
FillVRCommandsArrayTable(
temp_query, "tst_vr_command", kVRCommandFromCommand, key2);
@@ -1564,7 +1593,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteCommands_ExpectDataDeleted) {
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t key2 = FillCommandTable(temp_query, 1, "tst_menu_name", 1, 2, key1)
.LastInsertId();
@@ -1582,7 +1612,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteCommands_ExpectDataDeleted) {
false,
app_id2,
device_id,
- key1).LastInsertId();
+ key1)
+ .LastInsertId();
FillApplicationCommandsArrayTable(temp_query, key1, key2);
// Check
@@ -1599,7 +1630,8 @@ TEST_F(ResumptionSqlQueriesTest,
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t key2 = FillCommandTable(temp_query, 1, "tst_menu_name", 1, 2, key1)
.LastInsertId();
@@ -1617,7 +1649,8 @@ TEST_F(ResumptionSqlQueriesTest,
false,
app_id2,
device_id,
- key1).LastInsertId();
+ key1)
+ .LastInsertId();
FillApplicationCommandsArrayTable(temp_query, key1, key2);
// Check
@@ -1640,13 +1673,15 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteImageFromChoiceSet_ExpectDataDeleted) {
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t key2 = FillChoiceTable(temp_query,
2,
"tst_menu_name",
"secondary_txt",
"tst_tert_text",
- key1).LastInsertId();
+ key1)
+ .LastInsertId();
int64_t key3 = FillApplicationTable(temp_query,
connection_key,
grammarID,
@@ -1658,7 +1693,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteImageFromChoiceSet_ExpectDataDeleted) {
false,
app_id2,
device_id,
- key1).LastInsertId();
+ key1)
+ .LastInsertId();
int64_t key4 = FillApplicationChoiceSetTable(temp_query, 1, 2).LastInsertId();
FillChoiceArrayTable(temp_query, key4, key2);
FillApplicationChoiceSetArrayTable(temp_query, key4, key3);
@@ -1678,7 +1714,8 @@ TEST_F(ResumptionSqlQueriesTest,
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t key2 =
FillChoiceTable(
temp_query, 1, "tst_menu_name", "second_text", "tert_txt", key1)
@@ -1694,7 +1731,8 @@ TEST_F(ResumptionSqlQueriesTest,
false,
app_id2,
device_id,
- key1).LastInsertId();
+ key1)
+ .LastInsertId();
FillVRCommandsArrayTable(
temp_query, "tst_vr_command", kVRCommandFromChoice, key2);
@@ -1724,7 +1762,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteChoice_ExpectDataDeleted) {
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t key2 =
FillChoiceTable(
temp_query, 1, "tst_menu_name", "second_text", "tert_txt", key1)
@@ -1740,7 +1779,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteChoice_ExpectDataDeleted) {
false,
app_id2,
device_id,
- key1).LastInsertId();
+ key1)
+ .LastInsertId();
int64_t key3 = FillApplicationChoiceSetTable(temp_query, 1, 2).LastInsertId();
FillChoiceArrayTable(temp_query, key3, key2);
FillApplicationChoiceSetArrayTable(temp_query, key3, key1);
@@ -1773,7 +1813,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteChoiceArray_ExpectDataDeleted) {
false,
app_id2,
device_id,
- 1).LastInsertId();
+ 1)
+ .LastInsertId();
FillApplicationChoiceSetArrayTable(
temp_query, application_choiceset_table_key, application_table_key);
FillChoiceArrayTable(
@@ -1803,7 +1844,8 @@ TEST_F(ResumptionSqlQueriesTest,
false,
app_id2,
device_id,
- 1).LastInsertId();
+ 1)
+ .LastInsertId();
int64_t key2 = FillApplicationChoiceSetTable(temp_query, 1, 2).LastInsertId();
FillApplicationChoiceSetArrayTable(temp_query, key2, key1);
@@ -1838,7 +1880,8 @@ TEST_F(ResumptionSqlQueriesTest,
false,
app_id2,
device_id,
- 1).LastInsertId();
+ 1)
+ .LastInsertId();
int64_t key2 = FillApplicationChoiceSetTable(temp_query, 1, 2).LastInsertId();
FillApplicationChoiceSetArrayTable(temp_query, key2, key1);
@@ -1864,7 +1907,8 @@ TEST_F(ResumptionSqlQueriesTest,
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t key2 = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key1)
.LastInsertId();
@@ -1896,7 +1940,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeletevrHelpItem_ExpectDataDeleted) {
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t key2 = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key1)
.LastInsertId();
@@ -1929,7 +1974,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeletevrHelpItemArray_ExpectDataDeleted) {
int64_t key1 = FillImageTable(temp_query,
/*image_type=*/1,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t key2 = FillGlobalPropertiesTable(
temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", key1)
.LastInsertId();
@@ -1963,9 +2009,9 @@ TEST_F(ResumptionSqlQueriesTest,
string character_list = "abcdefghij";
int64_t key1 = FillTableLimitedCharacterListTable(temp_query, character_list)
.LastInsertId();
- int64_t key2 =
- FillGlobalPropertiesTable(
- temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", 0).LastInsertId();
+ int64_t key2 = FillGlobalPropertiesTable(
+ temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", 0)
+ .LastInsertId();
FillApplicationTable(temp_query,
connection_key,
grammarID,
@@ -1999,9 +2045,9 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteCharacterArray_ExpectDataDeleted) {
string character_list = "abcdefghij";
int64_t key1 = FillTableLimitedCharacterListTable(temp_query, character_list)
.LastInsertId();
- int64_t key2 =
- FillGlobalPropertiesTable(
- temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", 0).LastInsertId();
+ int64_t key2 = FillGlobalPropertiesTable(
+ temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", 0)
+ .LastInsertId();
FillApplicationTable(temp_query,
connection_key,
grammarID,
@@ -2031,7 +2077,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteTTSChunk_ExpectDataDeleted) {
FillTTSChunkTable(temp_query, 1, "tst_text").LastInsertId();
int64_t glob_prop_key =
FillGlobalPropertiesTable(
- temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", 0).LastInsertId();
+ temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", 0)
+ .LastInsertId();
FillApplicationTable(temp_query,
connection_key,
@@ -2087,7 +2134,8 @@ TEST_F(ResumptionSqlQueriesTest,
FillTTSChunkTable(temp_query, 1, "tst_text").LastInsertId();
int64_t glob_prop_key =
FillGlobalPropertiesTable(
- temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", 0).LastInsertId();
+ temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", 0)
+ .LastInsertId();
FillApplicationTable(temp_query,
connection_key,
grammarID,
@@ -2121,7 +2169,8 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteGlobalProperties_ExpectDataDeleted) {
SQLQuery temp_query(db());
int64_t glob_prop_key =
FillGlobalPropertiesTable(
- temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", 0).LastInsertId();
+ temp_query, "vrHelp", "menuTitle", 1, 1, 2, "auto", 0)
+ .LastInsertId();
FillApplicationTable(temp_query,
connection_key,
grammarID,
@@ -2160,7 +2209,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectPrimaryKeyImage_ExpectDataCorrect) {
int64_t image_key = FillImageTable(temp_query,
/*image_type=*/2,
"tst_image",
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
ValToPosPair p1(0, "tst_image");
ValToPosPair p2(1, "");
// Check
@@ -2588,7 +2638,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectCountFiles_ExpectDataCorrect) {
false,
app_id1,
device_id,
- 9).LastInsertId();
+ 9)
+ .LastInsertId();
int64_t file_key =
FillFileTable(temp_query, 1, true, true, "tst_name").LastInsertId();
FillApplicationFilesArrayTable(temp_query, app_key, file_key);
@@ -2613,7 +2664,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectFiles_ExpectDataCorrect) {
false,
app_id1,
device_id,
- 9).LastInsertId();
+ 9)
+ .LastInsertId();
int64_t file_key =
FillFileTable(temp_query, 1, true, true, "tst_name").LastInsertId();
FillApplicationFilesArrayTable(temp_query, app_key, file_key);
@@ -2640,7 +2692,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectCountSubMenu_ExpectDataCorrect) {
false,
app_id1,
device_id,
- 9).LastInsertId();
+ 9)
+ .LastInsertId();
int64_t submenu_key =
FillSubMenuTable(temp_query, 1, "menu_name", 1).LastInsertId();
FillApplicationSubMenuArrayTable(temp_query, app_key, submenu_key);
@@ -2664,7 +2717,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectSubMenu_ExpectDataCorrect) {
false,
app_id1,
device_id,
- 9).LastInsertId();
+ 9)
+ .LastInsertId();
int64_t submenu_key =
FillSubMenuTable(temp_query, 1, "menu_name", 1).LastInsertId();
@@ -2691,7 +2745,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectCountCommands_ExpectDataCorrect) {
false,
app_id1,
device_id,
- 9).LastInsertId();
+ 9)
+ .LastInsertId();
int64_t command_key =
FillCommandTable(temp_query, 1, "menu_name", 1, 2, 5).LastInsertId();
FillApplicationCommandsArrayTable(temp_query, app_key, command_key);
@@ -2715,11 +2770,13 @@ TEST_F(ResumptionSqlQueriesTest, kSelectCommandsFromCommand_ExpectDataCorrect) {
false,
app_id1,
device_id,
- 9).LastInsertId();
+ 9)
+ .LastInsertId();
int64_t image_key = FillImageTable(temp_query,
/*image_type=*/2,
"tst_image",
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
FillChoiceTable(
temp_query, 1, "menu_name", "sec_text", "tert_text", image_key)
@@ -2758,11 +2815,13 @@ TEST_F(ResumptionSqlQueriesTest, kSelectCommandsFromChoice_ExpectDataCorrect) {
false,
app_id1,
device_id,
- 9).LastInsertId();
+ 9)
+ .LastInsertId();
int64_t image_key = FillImageTable(temp_query,
/*image_type=*/2,
"tst_image",
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t choice_key =
FillChoiceTable(
@@ -2814,7 +2873,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectCountSubscriptions_ExpectDataCorrect) {
false,
app_id1,
device_id,
- 9).LastInsertId();
+ 9)
+ .LastInsertId();
FillAppSubscriptionsArrayTable(temp_query, 2, 3, app_key);
ValToPosPair p1(0, app_id1);
ValToPosPair p2(1, device_id);
@@ -2836,7 +2896,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectSubscriptions_ExpectDataCorrect) {
false,
app_id1,
device_id,
- 9).LastInsertId();
+ 9)
+ .LastInsertId();
FillAppSubscriptionsArrayTable(temp_query, 2, 3, app_key);
ValToPosPair p1(0, app_id1);
ValToPosPair p2(1, device_id);
@@ -2859,7 +2920,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectCountChoiceSet_ExpectDataCorrect) {
false,
app_id1,
device_id,
- 9).LastInsertId();
+ 9)
+ .LastInsertId();
FillApplicationChoiceSetArrayTable(temp_query, 2, app_key);
ValToPosPair p1(0, app_id1);
ValToPosPair p2(1, device_id);
@@ -2881,11 +2943,13 @@ TEST_F(ResumptionSqlQueriesTest, kSelectChoiceSets_ExpectDataCorrect) {
false,
app_id1,
device_id,
- 9).LastInsertId();
+ 9)
+ .LastInsertId();
int64_t image_key = FillImageTable(temp_query,
/*image_type=*/2,
"tst_image",
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t choice_key =
FillChoiceTable(
temp_query, 1, "menu_name", "sec_text", "tert_text", image_key)
@@ -2920,7 +2984,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectImage_ExpectDataCorrect) {
int64_t image_key = FillImageTable(temp_query,
/*image_type=*/2,
"tst_image",
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
// Check
ValToPosPair p1(0, IntToString(image_key));
ValToPosPair p2(1, "");
@@ -2947,7 +3012,8 @@ TEST_F(ResumptionSqlQueriesTest,
false,
app_id1,
device_id,
- glob_prop_key).LastInsertId();
+ glob_prop_key)
+ .LastInsertId();
// Check
ValToPosPair p1(0, app_id1);
@@ -2961,7 +3027,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectGlobalProperties_ExpectDataCorrect) {
int64_t image_key = FillImageTable(temp_query,
/*image_type=*/2,
test_image,
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t glob_prop_key =
FillGlobalPropertiesTable(
temp_query, "tst_vr_title", "tst_menu", 2, 3, 3, "auto", image_key)
@@ -2977,7 +3044,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectGlobalProperties_ExpectDataCorrect) {
false,
app_id1,
device_id,
- glob_prop_key).LastInsertId();
+ glob_prop_key)
+ .LastInsertId();
FillHelpTimeoutPromptArrayTable(temp_query, glob_prop_key, 3, 7);
// Check
@@ -3001,7 +3069,8 @@ TEST_F(ResumptionSqlQueriesTest, kChecksVrHelpItem_ExpectDataCorrect) {
int64_t image_key = FillImageTable(temp_query,
/*image_type=*/2,
"tst_image",
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t glob_prop_key =
FillGlobalPropertiesTable(
temp_query, "tst_vr_title", "tst_menu", 2, 3, 3, "auto", image_key)
@@ -3021,7 +3090,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectVrHelpItem_ExpectDataCorrect) {
int64_t image_key = FillImageTable(temp_query,
/*image_type=*/2,
"tst_image",
- /*is_template=*/true).LastInsertId();
+ /*is_template=*/true)
+ .LastInsertId();
int64_t glob_prop_key =
FillGlobalPropertiesTable(
temp_query, "tst_vr_title", "tst_menu", 2, 3, 3, "auto", image_key)
@@ -3046,8 +3116,9 @@ TEST_F(ResumptionSqlQueriesTest, kChecksCharacter_ExpectDataCorrect) {
temp_query, "tst_vr_title", "tst_menu", 2, 3, 3, "auto", 2)
.LastInsertId();
string character_list = "abcdefghijkl";
- int64_t lim_char_list_key = FillTableLimitedCharacterListTable(
- temp_query, character_list).LastInsertId();
+ int64_t lim_char_list_key =
+ FillTableLimitedCharacterListTable(temp_query, character_list)
+ .LastInsertId();
FillCharacterArrayTable(temp_query, glob_prop_key, lim_char_list_key);
// Check
ValToPosPair p1(0, IntToString(glob_prop_key));
@@ -3063,8 +3134,9 @@ TEST_F(ResumptionSqlQueriesTest, kSelectCharacter_ExpectDataCorrect) {
temp_query, "tst_vr_title", "tst_menu", 2, 3, 3, "auto", 2)
.LastInsertId();
string character_list = "abcdefghijkl";
- int64_t lim_char_list_key = FillTableLimitedCharacterListTable(
- temp_query, character_list).LastInsertId();
+ int64_t lim_char_list_key =
+ FillTableLimitedCharacterListTable(temp_query, character_list)
+ .LastInsertId();
FillCharacterArrayTable(temp_query, glob_prop_key, lim_char_list_key);
// Check
ValToPosPair p1(0, IntToString(glob_prop_key));
diff --git a/src/components/application_manager/test/rpc_handler_impl_test.cc b/src/components/application_manager/test/rpc_handler_impl_test.cc
new file mode 100644
index 0000000000..47c6cd73be
--- /dev/null
+++ b/src/components/application_manager/test/rpc_handler_impl_test.cc
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/rpc_handler_impl.h"
+#include <memory>
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/smart_object_keys.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+using ::test::components::application_manager_test::MockApplicationManager;
+using ::testing::_;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using namespace ::smart_objects;
+using namespace application_manager::rpc_handler;
+
+class RPCHandlerImplTest : public ::testing::Test {
+ public:
+ RPCHandlerImplTest()
+ : rpc_handler_(new RPCHandlerImpl(
+ mock_app_mngr_, hmi_so_factory_, mobile_so_factory_)) {}
+
+ protected:
+ std::unique_ptr<RPCHandlerImpl> rpc_handler_;
+ hmi_apis::HMI_API hmi_so_factory_;
+ mobile_apis::MOBILE_API mobile_so_factory_;
+ NiceMock<MockApplicationManager> mock_app_mngr_;
+};
+
+TEST_F(RPCHandlerImplTest, GetMessageVersion_SUCCESS) {
+ namespace json_str = ns_smart_device_link::ns_json_handler::strings;
+ namespace app_str = application_manager::strings;
+
+ std::vector<utils::SemanticVersion> test_versions = {
+ utils::SemanticVersion("2.5.0"),
+ utils::SemanticVersion("3.0.0"),
+ utils::SemanticVersion("5.0.0"),
+ utils::SemanticVersion("6.1.0")};
+
+ std::vector<utils::SemanticVersion> expected_versions = {
+ utils::base_rpc_version,
+ utils::base_rpc_version,
+ utils::SemanticVersion("5.0.0"),
+ utils::SemanticVersion("6.1.0")};
+
+ SmartObject message;
+ message[json_str::S_MSG_PARAMS] = SmartObject(SmartType_Map);
+ message[json_str::S_MSG_PARAMS][app_str::sync_msg_version] =
+ SmartObject(SmartType_Map);
+
+ for (size_t i = 0; i < test_versions.size(); ++i) {
+ message[json_str::S_MSG_PARAMS][app_str::sync_msg_version]
+ [app_str::major_version] = test_versions[i].major_version_;
+ message[json_str::S_MSG_PARAMS][app_str::sync_msg_version]
+ [app_str::minor_version] = test_versions[i].minor_version_;
+ message[json_str::S_MSG_PARAMS][app_str::sync_msg_version]
+ [app_str::patch_version] = test_versions[i].patch_version_;
+
+ utils::SemanticVersion result_message_version;
+ rpc_handler_->GetMessageVersion(message, result_message_version);
+ EXPECT_EQ(expected_versions[i], result_message_version);
+ }
+}
+
+TEST_F(RPCHandlerImplTest, GetMessageVersion_InvalidVersion) {
+ namespace json_str = ns_smart_device_link::ns_json_handler::strings;
+ namespace app_str = application_manager::strings;
+
+ SmartObject message;
+ message[json_str::S_MSG_PARAMS] = SmartObject(SmartType_Map);
+ message[json_str::S_MSG_PARAMS][app_str::sync_msg_version] =
+ SmartObject(SmartType_Map);
+ message[json_str::S_MSG_PARAMS][app_str::sync_msg_version]
+ [app_str::major_version] = 0;
+ message[json_str::S_MSG_PARAMS][app_str::sync_msg_version]
+ [app_str::minor_version] = 0;
+ message[json_str::S_MSG_PARAMS][app_str::sync_msg_version]
+ [app_str::patch_version] = 0;
+
+ utils::SemanticVersion expected_version("0.0.0");
+
+ utils::SemanticVersion result_message_version;
+ rpc_handler_->GetMessageVersion(message, result_message_version);
+ EXPECT_EQ(expected_version, result_message_version);
+}
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/rpc_passing_handler_test.cc b/src/components/application_manager/test/rpc_passing_handler_test.cc
new file mode 100644
index 0000000000..6eac6ca0b1
--- /dev/null
+++ b/src/components/application_manager/test/rpc_passing_handler_test.cc
@@ -0,0 +1,445 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <gmock/gmock.h>
+#include "gtest/gtest.h"
+
+#include "application_manager/rpc_passing_handler.h"
+
+#include "application_manager/mock_app_service_manager.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_application_manager_settings.h"
+#include "application_manager/mock_rpc_handler.h"
+#include "application_manager/mock_rpc_service.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "resumption/mock_last_state.h"
+
+#include <vector>
+#include "application_manager/smart_object_keys.h"
+#include "smart_objects/smart_object.h"
+#include "utils/semantic_version.h"
+#include "utils/test_async_waiter.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+namespace am = application_manager;
+using ::testing::_;
+using ::testing::DoAll;
+using ::testing::InSequence;
+using ::testing::Mock;
+using ::testing::NiceMock;
+using ::testing::Pointee;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+struct PassthroughParams {
+ const uint32_t connection_key;
+ const int32_t correlation_id;
+ smart_objects::SmartObject message;
+ smart_objects::SmartObject forwarded_message;
+};
+
+class RPCPassingHandlerTest : public ::testing::Test {
+ public:
+ RPCPassingHandlerTest()
+ : mock_last_state_(std::make_shared<resumption_test::MockLastState>())
+ , last_state_wrapper_(std::make_shared<resumption::LastStateWrapperImpl>(
+ mock_last_state_))
+ , mock_app_service_manager_(mock_app_manager_, last_state_wrapper_)
+ , mock_app_ptr_(std::make_shared<NiceMock<MockApplication> >())
+ , version_(utils::SemanticVersion(5, 1, 0)) {}
+
+ ~RPCPassingHandlerTest() {}
+
+ void SetUp() OVERRIDE {
+ rpc_passing_handler_ =
+ new am::RPCPassingHandler(mock_app_service_manager_, mock_app_manager_);
+ app_services_.clear();
+
+ ON_CALL(mock_app_manager_, IncreaseForwardedRequestTimeout(_, _))
+ .WillByDefault(Return());
+ ON_CALL(mock_app_manager_, get_settings())
+ .WillByDefault(ReturnRef(mock_app_manager_settings_));
+
+ ON_CALL(mock_app_manager_settings_, rpc_pass_through_timeout())
+ .WillByDefault(Return(kRPCPassthroughTimeout));
+
+ ON_CALL(mock_app_manager_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ ON_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_rpc_service_, SendMessageToMobile(_, _))
+ .WillByDefault(Return());
+
+ ON_CALL(mock_app_manager_, GetAppServiceManager())
+ .WillByDefault(ReturnRef(mock_app_service_manager_));
+ ON_CALL(mock_app_service_manager_, GetActiveServices())
+ .WillByDefault(Return(app_services_));
+
+ ON_CALL(mock_app_manager_, GetRPCHandler())
+ .WillByDefault(ReturnRef(mock_rpc_handler_));
+ ON_CALL(mock_rpc_handler_, ValidateRpcSO(_, _, _, _))
+ .WillByDefault(Return(true));
+
+ ON_CALL(mock_app_manager_, application(_))
+ .WillByDefault(Return(mock_app_ptr_));
+ ON_CALL(*mock_app_ptr_, msg_version()).WillByDefault(ReturnRef(version_));
+ }
+
+ void TearDown() OVERRIDE {
+ delete rpc_passing_handler_;
+ rpc_passing_handler_ = NULL;
+ }
+
+ protected:
+ am::AppService CreateAppService(uint32_t connection_key,
+ const std::string& service_id,
+ const std::string& service_type) {
+ am::AppService app_service;
+
+ app_service.connection_key = connection_key;
+ app_service.mobile_service = true;
+ app_service.default_service = false;
+
+ smart_objects::SmartObject record(smart_objects::SmartType::SmartType_Map);
+ record[am::strings::service_id] = service_id;
+ record[am::strings::service_manifest][am::strings::service_type] =
+ service_type;
+ record[am::strings::service_manifest][am::strings::allow_app_consumers] =
+ true;
+ record[am::strings::service_manifest][am::strings::handled_rpcs] =
+ smart_objects::SmartObject(smart_objects::SmartType::SmartType_Array);
+ record[am::strings::service_manifest][am::strings::handled_rpcs][0] =
+ mobile_apis::FunctionID::SendLocationID;
+ record[am::strings::service_published] = true;
+ record[am::strings::service_active] = true;
+ app_service.record = record;
+
+ return app_service;
+ }
+
+ smart_objects::SmartObject CreatePassThroughRequest(uint32_t connection_key,
+ int32_t correlation_id) {
+ smart_objects::SmartObject record(smart_objects::SmartType::SmartType_Map);
+ record[am::strings::params][am::strings::connection_key] = connection_key;
+ record[am::strings::params][am::strings::correlation_id] = correlation_id;
+ record[am::strings::params][am::strings::function_id] =
+ mobile_apis::FunctionID::SendLocationID;
+ record[am::strings::params][am::strings::message_type] =
+ am::MessageType::kRequest;
+ record[am::strings::msg_params][am::strings::latitude_degrees] = 50;
+ record[am::strings::msg_params][am::strings::longitude_degrees] = 50;
+ record[am::strings::msg_params][am::strings::location_name] =
+ "TestLocation";
+
+ return record;
+ }
+
+ smart_objects::SmartObject CreatePassThroughResponse(
+ uint32_t connection_key,
+ int32_t correlation_id,
+ const std::string& result_code,
+ bool success,
+ std::string info = std::string()) {
+ smart_objects::SmartObject record(smart_objects::SmartType::SmartType_Map);
+ record[am::strings::params][am::strings::connection_key] = connection_key;
+ record[am::strings::params][am::strings::correlation_id] = correlation_id;
+ record[am::strings::params][am::strings::function_id] =
+ mobile_apis::FunctionID::SendLocationID;
+ record[am::strings::params][am::strings::message_type] =
+ am::MessageType::kResponse;
+ record[am::strings::msg_params][am::strings::result_code] = result_code;
+ record[am::strings::msg_params][am::strings::success] = success;
+ record[am::strings::msg_params][am::strings::info] = info;
+
+ return record;
+ }
+
+ void SendRequestToASP(const PassthroughParams& params, uint32_t timeout = 0) {
+ if (timeout == 0) {
+ // If timeout argument is not sepcified
+ timeout = kRPCPassthroughTimeout;
+ }
+
+ // Call RPCPassThrough with request smart object
+
+ // Will call PopulateRPCRequestQueue
+ EXPECT_CALL(mock_app_service_manager_, GetActiveServices())
+ .WillOnce(Return(app_services_));
+
+ // Will call ForwardRequesttoMobile
+ EXPECT_CALL(mock_app_manager_settings_, rpc_pass_through_timeout())
+ .WillOnce(Return(timeout));
+ EXPECT_CALL(mock_app_manager_, GetRPCService());
+ EXPECT_CALL(mock_rpc_service_,
+ SendMessageToMobile(Pointee(params.forwarded_message), false));
+
+ bool mobile_result = rpc_passing_handler_->RPCPassThrough(params.message);
+ EXPECT_EQ(mobile_result, true);
+ }
+
+ NiceMock<MockApplicationManager> mock_app_manager_;
+ NiceMock<MockApplicationManagerSettings> mock_app_manager_settings_;
+ MockRPCService mock_rpc_service_;
+ MockRPCHandler mock_rpc_handler_;
+ std::shared_ptr<resumption_test::MockLastState> mock_last_state_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
+ MockAppServiceManager mock_app_service_manager_;
+ std::shared_ptr<NiceMock<MockApplication> > mock_app_ptr_;
+ const utils::SemanticVersion version_;
+ am::RPCPassingHandler* rpc_passing_handler_;
+ std::vector<am::AppService> app_services_;
+
+ uint32_t kRPCPassthroughTimeout = 10000;
+ uint32_t kConnectionKey_ASC = 1;
+ uint32_t kConnectionKey_NAV_ASP = 2;
+ uint32_t kConnectionKey_MEDIA_ASP = 3;
+ int32_t kCorrelationId = 1;
+ const uint32_t MAX_TEST_DURATION = 1000; // 1 second
+};
+
+TEST_F(RPCPassingHandlerTest, RPCPassingTest_REQUEST_ForwardToMobile) {
+ app_services_.push_back(CreateAppService(
+ kConnectionKey_NAV_ASP, "Navigation service", "NAVIGATION"));
+
+ PassthroughParams request_params{
+ .connection_key = kConnectionKey_ASC,
+ .correlation_id = kCorrelationId,
+ .message = CreatePassThroughRequest(kConnectionKey_ASC, kCorrelationId),
+ .forwarded_message =
+ CreatePassThroughRequest(kConnectionKey_NAV_ASP, kCorrelationId),
+ };
+
+ SendRequestToASP(request_params);
+}
+
+TEST_F(RPCPassingHandlerTest, RPCPassingTest_REQUEST_NoPassthrough) {
+ smart_objects::SmartObject request =
+ CreatePassThroughRequest(kConnectionKey_ASC, kCorrelationId);
+
+ // Call RPCPassThrough with request smart object
+
+ // Will call PopulateRPCRequestQueue
+ EXPECT_CALL(mock_app_service_manager_, GetActiveServices())
+ .WillOnce(Return(app_services_));
+ EXPECT_CALL(
+ mock_app_manager_,
+ IncreaseForwardedRequestTimeout(kConnectionKey_ASC, kCorrelationId))
+ .Times(0);
+ // Will return false since there are no active services to handle the rpc
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)).Times(0);
+
+ bool result = rpc_passing_handler_->RPCPassThrough(request);
+ EXPECT_EQ(result, false);
+}
+
+TEST_F(RPCPassingHandlerTest, RPCPassingTest_RESPONSE_UnknownCorrelationID) {
+ smart_objects::SmartObject invalid_response = CreatePassThroughResponse(
+ kConnectionKey_NAV_ASP, kCorrelationId + 1, "SUCCESS", true);
+
+ app_services_.push_back(CreateAppService(
+ kConnectionKey_NAV_ASP, "Navigation service", "NAVIGATION"));
+
+ PassthroughParams request_params{
+ .connection_key = kConnectionKey_ASC,
+ .correlation_id = kCorrelationId,
+ .message = CreatePassThroughRequest(kConnectionKey_ASC, kCorrelationId),
+ .forwarded_message =
+ CreatePassThroughRequest(kConnectionKey_NAV_ASP, kCorrelationId),
+ };
+
+ SendRequestToASP(request_params);
+
+ // Call RPCPassThrough with response smart object
+ // Will return false since the correlation id does not exist in the map
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)).Times(0);
+
+ bool result = rpc_passing_handler_->RPCPassThrough(invalid_response);
+ EXPECT_EQ(result, false);
+}
+
+TEST_F(RPCPassingHandlerTest, RPCPassingTest_SUCCESS) {
+ smart_objects::SmartObject response = CreatePassThroughResponse(
+ kConnectionKey_NAV_ASP, kCorrelationId, "SUCCESS", true);
+ smart_objects::SmartObject forwarded_response = CreatePassThroughResponse(
+ kConnectionKey_ASC, kCorrelationId, "SUCCESS", true);
+
+ app_services_.push_back(CreateAppService(
+ kConnectionKey_NAV_ASP, "Navigation service", "NAVIGATION"));
+
+ PassthroughParams request_params{
+ .connection_key = kConnectionKey_ASC,
+ .correlation_id = kCorrelationId,
+ .message = CreatePassThroughRequest(kConnectionKey_ASC, kCorrelationId),
+ .forwarded_message =
+ CreatePassThroughRequest(kConnectionKey_NAV_ASP, kCorrelationId),
+ };
+
+ SendRequestToASP(request_params);
+
+ // Call RPCPassThrough with response smart object
+ // Will ForwardResponseToMobile
+ EXPECT_CALL(mock_app_manager_, GetRPCService());
+ EXPECT_CALL(mock_rpc_service_,
+ SendMessageToMobile(Pointee(forwarded_response), false));
+
+ bool result = rpc_passing_handler_->RPCPassThrough(response);
+ EXPECT_EQ(result, true);
+}
+
+TEST_F(RPCPassingHandlerTest,
+ RPCPassingTest_UNSUPPORTED_REQUEST_ForwardToCore) {
+ smart_objects::SmartObject unsupported_response = CreatePassThroughResponse(
+ kConnectionKey_NAV_ASP, kCorrelationId, "UNSUPPORTED_REQUEST", false);
+ smart_objects::SmartObject forwarded_request =
+ CreatePassThroughRequest(kConnectionKey_ASC, kCorrelationId);
+
+ app_services_.push_back(CreateAppService(
+ kConnectionKey_NAV_ASP, "Navigation service", "NAVIGATION"));
+
+ PassthroughParams request_params{
+ .connection_key = kConnectionKey_ASC,
+ .correlation_id = kCorrelationId,
+ .message = CreatePassThroughRequest(kConnectionKey_ASC, kCorrelationId),
+ .forwarded_message =
+ CreatePassThroughRequest(kConnectionKey_NAV_ASP, kCorrelationId),
+ };
+
+ SendRequestToASP(request_params);
+
+ // Call RPCPassThrough with response smart object
+ // Will cycle to core (no other app services in list)
+ EXPECT_CALL(mock_app_manager_, GetRPCHandler());
+ EXPECT_CALL(mock_rpc_handler_, ValidateRpcSO(forwarded_request, _, _, false))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_app_manager_, GetRPCService());
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(Pointee(forwarded_request),
+ am::commands::Command::SOURCE_MOBILE));
+
+ bool result = rpc_passing_handler_->RPCPassThrough(unsupported_response);
+ EXPECT_EQ(result, true);
+}
+
+TEST_F(RPCPassingHandlerTest,
+ RPCPassingTest_UNSUPPORTED_REQUEST_ForwardToMobile) {
+ smart_objects::SmartObject unsupported_response = CreatePassThroughResponse(
+ kConnectionKey_NAV_ASP, kCorrelationId, "UNSUPPORTED_REQUEST", false);
+ smart_objects::SmartObject forwarded_request =
+ CreatePassThroughRequest(kConnectionKey_MEDIA_ASP, kCorrelationId);
+
+ app_services_.push_back(CreateAppService(
+ kConnectionKey_NAV_ASP, "Navigation service", "NAVIGATION"));
+ app_services_.push_back(
+ CreateAppService(kConnectionKey_MEDIA_ASP, "Media service", "MEDIA"));
+
+ PassthroughParams request_params{
+ .connection_key = kConnectionKey_ASC,
+ .correlation_id = kCorrelationId,
+ .message = CreatePassThroughRequest(kConnectionKey_ASC, kCorrelationId),
+ .forwarded_message =
+ CreatePassThroughRequest(kConnectionKey_NAV_ASP, kCorrelationId),
+ };
+
+ SendRequestToASP(request_params);
+
+ // Call RPCPassThrough with response smart object
+ // Will cycle to next compatible active app service
+ EXPECT_CALL(mock_app_manager_settings_, rpc_pass_through_timeout());
+ EXPECT_CALL(mock_app_manager_, GetRPCService());
+ EXPECT_CALL(mock_rpc_service_,
+ SendMessageToMobile(Pointee(forwarded_request), false));
+
+ bool result = rpc_passing_handler_->RPCPassThrough(unsupported_response);
+ EXPECT_EQ(result, true);
+}
+
+TEST_F(RPCPassingHandlerTest, RPCPassingTest_REQUEST_Timeout) {
+ uint32_t timeout_in_ms = 4;
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
+
+ app_services_.push_back(CreateAppService(
+ kConnectionKey_NAV_ASP, "Navigation service", "NAVIGATION"));
+
+ PassthroughParams request_params{
+ .connection_key = kConnectionKey_ASC,
+ .correlation_id = kCorrelationId,
+ .message = CreatePassThroughRequest(kConnectionKey_ASC, kCorrelationId),
+ .forwarded_message =
+ CreatePassThroughRequest(kConnectionKey_NAV_ASP, kCorrelationId),
+ };
+
+ // Call RPCPassThrough with request smart object
+
+ // Will call PopulateRPCRequestQueue
+ EXPECT_CALL(mock_app_service_manager_, GetActiveServices())
+ .WillOnce(Return(app_services_));
+
+ // Will call ForwardRequesttoMobile
+ EXPECT_CALL(mock_app_manager_settings_, rpc_pass_through_timeout())
+ .WillOnce(Return(timeout_in_ms));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ SendMessageToMobile(Pointee(request_params.forwarded_message), false));
+
+ // Request timeout will trigger perform next request
+ // Will cycle to core (no other app services in list)
+ EXPECT_CALL(mock_app_manager_, GetRPCHandler());
+ EXPECT_CALL(mock_rpc_handler_,
+ ValidateRpcSO(request_params.message, _, _, false))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_app_manager_, GetRPCService()).Times(2);
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(Pointee(request_params.message),
+ am::commands::Command::SOURCE_MOBILE))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), Return(true)));
+
+ bool mobile_result =
+ rpc_passing_handler_->RPCPassThrough(request_params.message);
+ EXPECT_EQ(mobile_result, true);
+
+ const uint32_t wait_time = MAX_TEST_DURATION + timeout_in_ms;
+ EXPECT_TRUE(waiter->WaitFor(1, wait_time));
+
+ // This sleep prevents a SEGFAULT which occurs after the
+ // RPCPassingHandlerTests are completed and the next test set runs
+ usleep(6000); // sleep 6 ms
+}
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/rpc_service_impl_test.cc b/src/components/application_manager/test/rpc_service_impl_test.cc
new file mode 100644
index 0000000000..0a7cff031d
--- /dev/null
+++ b/src/components/application_manager/test/rpc_service_impl_test.cc
@@ -0,0 +1,837 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <gmock/gmock.h>
+#include "gtest/gtest.h"
+
+#include <string>
+#include "application_manager/rpc_service_impl.h"
+
+#include "application_manager/commands/command.h"
+#include "application_manager/commands/command_impl.h"
+#include "application_manager/mock_app_service_manager.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_command_factory.h"
+#include "application_manager/mock_command_holder.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_request.h"
+#include "application_manager/mock_request_controller_settings.h"
+#include "application_manager/mock_rpc_plugin.h"
+#include "application_manager/mock_rpc_plugin_manager.h"
+#include "application_manager/mock_rpc_protection_manager.h"
+#include "application_manager/plugin_manager/plugin_keys.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "hmi_message_handler/mock_hmi_message_handler.h"
+#include "include/test/protocol_handler/mock_protocol_handler.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+namespace rpc_service = application_manager::rpc_service;
+namespace am = application_manager;
+using test::components::hmi_message_handler_test::MockHMIMessageHandler;
+using test::components::protocol_handler_test::MockProtocolHandler;
+typedef smart_objects::SmartObjectSPtr MessageSharedPtr;
+typedef utils::Optional<am::plugin_manager::RPCPlugin> PluginOpt;
+using test::components::application_manager_test::MockAppServiceManager;
+using ::testing::_;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+namespace {
+const uint32_t kConnectionKey = 1u;
+const connection_handler::DeviceHandle kDeviceHandle = 1u;
+const std::string kPolicyAppId = "policy_app_id";
+const uint32_t kCorrelationId = 1u;
+const uint32_t kFunctionId = 1u;
+const uint32_t kAppId = 1u;
+const int32_t kMobileProtocolType = 0;
+const int32_t kProtocolVersion = 1;
+const int32_t kConnectionSessionsCount = 2;
+} // namespace
+
+class RPCServiceImplTest : public ::testing::Test {
+ public:
+ RPCServiceImplTest()
+ : request_controller_(mock_request_controler_)
+ , mock_rpc_protection_manager_(
+ std::make_shared<
+ testing::NiceMock<am::MockRPCProtectionManager> >())
+ , mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
+ , mock_app_service_nmgr_(mock_app_mngr_, nullptr) {
+ rpc_service_ = std::make_shared<rpc_service::RPCServiceImpl>(
+ mock_app_mngr_,
+ request_controller_,
+ &mock_protocol_handler_,
+ &mock_hmi_handler_,
+ mock_command_holder_,
+ mock_rpc_protection_manager_,
+ hmi_so_factory_,
+ mobile_so_factory_);
+ }
+
+ MessageSharedPtr CreateMessage(
+ const smart_objects::SmartType type = smart_objects::SmartType_Null) {
+ return std::make_shared<smart_objects::SmartObject>(type);
+ }
+ void PrepareBasicMessage(MessageSharedPtr& message) {
+ (*message)[am::strings::params][am::strings::function_id] =
+ static_cast<mobile_apis::FunctionID::eType>(
+ mobile_apis::FunctionID::RESERVED);
+ (*message)[am::strings::params][am::strings::correlation_id] =
+ kCorrelationId;
+ (*message)[am::strings::params][am::strings::protocol_type] =
+ kMobileProtocolType;
+ (*message)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ }
+
+ // This class is created to allow access to protected method
+ // InitFunctionSchema from MOBILE_API
+ class MobileAPIWithPublicSchemaSetting : public mobile_apis::MOBILE_API {
+ public:
+ void SetSchema(mobile_apis::FunctionID::eType function_id,
+ mobile_apis::messageType::eType message_type) {
+ InitFunctionSchema(function_id, message_type);
+ }
+ };
+
+ // This class is created to allow access to protected method
+ // InitFunctionSchema from HMI_API
+ class HMIAPIWithPublicSchemaSetting : public hmi_apis::HMI_API {
+ public:
+ void SetSchema(hmi_apis::FunctionID::eType function_id,
+ hmi_apis::messageType::eType message_type) {
+ InitFunctionSchema(function_id, message_type);
+ }
+ };
+
+ protected:
+ hmi_apis::HMI_API hmi_so_factory_;
+ mobile_apis::MOBILE_API mobile_so_factory_;
+ testing::NiceMock<MockApplicationManager> mock_app_mngr_;
+ testing::NiceMock<MockRequestControlerSettings> mock_request_controler_;
+ testing::NiceMock<MockProtocolHandler> mock_protocol_handler_;
+ am::request_controller::RequestController request_controller_;
+ testing::NiceMock<MockHMIMessageHandler> mock_hmi_handler_;
+ testing::NiceMock<MockCommandHolder> mock_command_holder_;
+ std::shared_ptr<am::MockRPCProtectionManager> mock_rpc_protection_manager_;
+ std::shared_ptr<rpc_service::RPCService> rpc_service_;
+ std::shared_ptr<MockApplication> mock_app_ptr_;
+ am::MockMessageHelper& mock_message_helper_;
+ MockAppServiceManager mock_app_service_nmgr_;
+ testing::NiceMock<am::plugin_manager::MockRPCPluginManager>
+ mock_rpc_plugin_manager_;
+ testing::NiceMock<am::plugin_manager::MockRPCPlugin> mock_rpc_plugin_;
+ testing::NiceMock<MockCommandFactory> mock_command_factory_;
+};
+
+TEST_F(RPCServiceImplTest, ManageMobileCommand_MessageIsNullPtr_False) {
+ MessageSharedPtr message;
+ EXPECT_FALSE(rpc_service_->ManageMobileCommand(
+ message, am::commands::Command::CommandSource::SOURCE_MOBILE));
+}
+
+TEST_F(RPCServiceImplTest, ManageMobileCommand_IsLowVoltage_False) {
+ auto message = CreateMessage();
+ ON_CALL(mock_app_mngr_, IsLowVoltage()).WillByDefault(Return(true));
+ EXPECT_FALSE(rpc_service_->ManageMobileCommand(
+ message, am::commands::Command::CommandSource::SOURCE_MOBILE));
+}
+
+TEST_F(RPCServiceImplTest, ManageMobileCommand_AppInReconnectMode) {
+ auto message = CreateMessage(smart_objects::SmartType_Map);
+ auto source = am::commands::Command::CommandSource::SOURCE_MOBILE;
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+
+ mock_app_ptr_ = std::make_shared<NiceMock<MockApplication> >();
+ ON_CALL(mock_app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_ptr_));
+ ON_CALL(*mock_app_ptr_, device()).WillByDefault(Return(kDeviceHandle));
+ ON_CALL(*mock_app_ptr_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
+ ON_CALL(mock_app_mngr_, IsAppInReconnectMode(kDeviceHandle, kPolicyAppId))
+ .WillByDefault(Return(true));
+ EXPECT_CALL(mock_command_holder_,
+ Suspend(static_cast<am::ApplicationSharedPtr>(mock_app_ptr_),
+ am::CommandHolder::CommandType::kMobileCommand,
+ source,
+ message))
+ .WillOnce(Return());
+
+ EXPECT_TRUE(rpc_service_->ManageMobileCommand(message, source));
+}
+
+TEST_F(RPCServiceImplTest,
+ ManageMobileCommand_SourceIsCheckedForUnsupportedRequest) {
+ typedef am::plugin_manager::RPCPlugin RPCPlugin;
+
+ auto message = CreateMessage(smart_objects::SmartType_Map);
+ auto source = am::commands::Command::CommandSource::SOURCE_MOBILE;
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*message)[am::strings::params][am::strings::function_id] = kFunctionId;
+ (*message)[am::strings::params][am::strings::protocol_type] =
+ kMobileProtocolType;
+
+ ON_CALL(mock_app_mngr_, IsLowVoltage()).WillByDefault(Return(false));
+ mock_app_ptr_ = std::make_shared<NiceMock<MockApplication> >();
+ ON_CALL(mock_app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_ptr_));
+ ON_CALL(*mock_app_ptr_, device()).WillByDefault(Return(kDeviceHandle));
+ ON_CALL(*mock_app_ptr_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
+ ON_CALL(mock_app_mngr_, IsAppInReconnectMode(kDeviceHandle, kPolicyAppId))
+ .WillByDefault(Return(false));
+ ON_CALL(mock_app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(mock_rpc_plugin_manager_));
+ auto empty_plugin(utils::Optional<RPCPlugin>::OptionalEmpty::EMPTY);
+ ON_CALL(mock_rpc_plugin_manager_, FindPluginToProcess(kFunctionId, source))
+ .WillByDefault(Return(empty_plugin));
+
+ EXPECT_FALSE(rpc_service_->ManageMobileCommand(message, source));
+}
+
+TEST_F(RPCServiceImplTest, ManageHMICommand_MessageIsNullPtr_False) {
+ MessageSharedPtr message;
+ EXPECT_FALSE(rpc_service_->ManageHMICommand(
+ message, am::commands::Command::CommandSource::SOURCE_HMI));
+}
+
+TEST_F(RPCServiceImplTest, ManageHMICommand_IsLowVoltage_ReturnFalse) {
+ auto message = CreateMessage();
+ ON_CALL(mock_app_mngr_, IsLowVoltage()).WillByDefault(Return(true));
+ EXPECT_FALSE(rpc_service_->ManageHMICommand(
+ message, am::commands::Command::CommandSource::SOURCE_HMI));
+}
+
+TEST_F(RPCServiceImplTest, ManageHMICommand_PluginIsEmpty_False) {
+ auto message = CreateMessage();
+ auto source = am::commands::Command::CommandSource::SOURCE_HMI;
+ (*message)[am::strings::params][am::strings::function_id] = kFunctionId;
+
+ ON_CALL(mock_app_mngr_, IsLowVoltage()).WillByDefault(Return(false));
+ ON_CALL(mock_app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(mock_rpc_plugin_manager_));
+ typedef am::plugin_manager::RPCPlugin RPCPlugin;
+ utils::Optional<RPCPlugin> mock_rpc_plugin_opt(
+ utils::Optional<RPCPlugin>::OptionalEmpty::EMPTY);
+ ON_CALL(mock_rpc_plugin_manager_, FindPluginToProcess(kFunctionId, source))
+ .WillByDefault(Return(mock_rpc_plugin_opt));
+
+ EXPECT_FALSE(rpc_service_->ManageHMICommand(message, source));
+}
+
+TEST_F(RPCServiceImplTest, ManageHMICommand_FailedCreateCommand_False) {
+ typedef am::plugin_manager::RPCPlugin RPCPlugin;
+
+ auto message = CreateMessage();
+ auto source = am::commands::Command::CommandSource::SOURCE_HMI;
+ (*message)[am::strings::params][am::strings::function_id] = kFunctionId;
+
+ ON_CALL(mock_app_mngr_, IsLowVoltage()).WillByDefault(Return(false));
+ ON_CALL(mock_app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(mock_rpc_plugin_manager_));
+ utils::Optional<RPCPlugin> mock_rpc_plugin_opt = mock_rpc_plugin_;
+ ON_CALL(mock_rpc_plugin_manager_, FindPluginToProcess(kFunctionId, source))
+ .WillByDefault(Return(mock_rpc_plugin_opt));
+ ON_CALL(mock_rpc_plugin_, GetCommandFactory())
+ .WillByDefault(ReturnRef(mock_command_factory_));
+ std::shared_ptr<MockRequest> cmd;
+ ON_CALL(mock_command_factory_, CreateCommand(message, source))
+ .WillByDefault(Return(cmd));
+
+ EXPECT_FALSE(rpc_service_->ManageHMICommand(message, source));
+}
+
+TEST_F(RPCServiceImplTest, ManageHMICommand_IsAppInReconnectMode_True) {
+ typedef am::plugin_manager::RPCPlugin RPCPlugin;
+
+ auto message = CreateMessage();
+ auto source = am::commands::Command::CommandSource::SOURCE_HMI;
+ (*message)[am::strings::params][am::strings::function_id] = kFunctionId;
+ (*message)[am::strings::msg_params][am::strings::app_id] = kAppId;
+
+ ON_CALL(mock_app_mngr_, IsLowVoltage()).WillByDefault(Return(false));
+ ON_CALL(mock_app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(mock_rpc_plugin_manager_));
+ utils::Optional<RPCPlugin> mock_rpc_plugin_opt = mock_rpc_plugin_;
+ ON_CALL(mock_rpc_plugin_manager_, FindPluginToProcess(kFunctionId, source))
+ .WillByDefault(Return(mock_rpc_plugin_opt));
+ ON_CALL(mock_rpc_plugin_, GetCommandFactory())
+ .WillByDefault(ReturnRef(mock_command_factory_));
+ std::shared_ptr<MockRequest> cmd =
+ std::make_shared<MockRequest>(kConnectionKey, kCorrelationId);
+ ON_CALL(mock_command_factory_, CreateCommand(message, source))
+ .WillByDefault(Return(cmd));
+
+ auto mock_app = std::make_shared<NiceMock<MockApplication> >();
+ ON_CALL(mock_app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app));
+ const connection_handler::DeviceHandle device_id1 = 1u;
+ ON_CALL(*mock_app, device()).WillByDefault(Return(device_id1));
+ ON_CALL(*mock_app, policy_app_id()).WillByDefault(Return(kPolicyAppId));
+ ON_CALL(mock_app_mngr_, IsAppInReconnectMode(device_id1, kPolicyAppId))
+ .WillByDefault(Return(true));
+
+ EXPECT_CALL(mock_command_holder_,
+ Suspend(static_cast<am::ApplicationSharedPtr>(mock_app),
+ am::CommandHolder::CommandType::kHmiCommand,
+ source,
+ message))
+ .WillOnce(Return());
+ EXPECT_TRUE(rpc_service_->ManageHMICommand(message, source));
+}
+
+TEST_F(RPCServiceImplTest,
+ ManageHMICommand_MessageTypeUnknownTypeCommandNotInit_ReturnFalse) {
+ typedef am::plugin_manager::RPCPlugin RPCPlugin;
+
+ auto message = CreateMessage();
+ auto source = am::commands::Command::CommandSource::SOURCE_HMI;
+ (*message)[am::strings::params][am::strings::function_id] = kFunctionId;
+ (*message)[am::strings::params][am::strings::message_type] = am::kUnknownType;
+
+ ON_CALL(mock_app_mngr_, IsLowVoltage()).WillByDefault(Return(false));
+ ON_CALL(mock_app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(mock_rpc_plugin_manager_));
+ utils::Optional<RPCPlugin> mock_rpc_plugin_opt = mock_rpc_plugin_;
+ ON_CALL(mock_rpc_plugin_manager_, FindPluginToProcess(kFunctionId, source))
+ .WillByDefault(Return(mock_rpc_plugin_opt));
+ ON_CALL(mock_rpc_plugin_, GetCommandFactory())
+ .WillByDefault(ReturnRef(mock_command_factory_));
+ std::shared_ptr<MockRequest> cmd =
+ std::make_shared<MockRequest>(kConnectionKey, kCorrelationId);
+ ON_CALL(mock_command_factory_, CreateCommand(message, source))
+ .WillByDefault(Return(cmd));
+
+ EXPECT_CALL(*cmd, Init()).WillOnce(Return(false));
+ EXPECT_FALSE(rpc_service_->ManageHMICommand(message, source));
+}
+
+TEST_F(RPCServiceImplTest,
+ IsAppServiceRPC_SourceMobileWithValidFuncId_ReturnTrue) {
+ auto source_mobile = am::commands::Command::CommandSource::SOURCE_MOBILE;
+ auto source_sdl = am::commands::Command::CommandSource::SOURCE_SDL;
+
+ EXPECT_TRUE(rpc_service_->IsAppServiceRPC(
+ mobile_apis::FunctionID::GetSystemCapabilityID, source_mobile));
+ EXPECT_TRUE(rpc_service_->IsAppServiceRPC(
+ mobile_apis::FunctionID::OnSystemCapabilityUpdatedID, source_sdl));
+ EXPECT_TRUE(rpc_service_->IsAppServiceRPC(
+ mobile_apis::FunctionID::GetSystemCapabilityID, source_sdl));
+ EXPECT_TRUE(rpc_service_->IsAppServiceRPC(
+ mobile_apis::FunctionID::OnSystemCapabilityUpdatedID, source_sdl));
+}
+
+TEST_F(RPCServiceImplTest,
+ IsAppServiceRPC_SourceHMIWithValidFuncId_ReturnTrue) {
+ auto source_hmi = am::commands::Command::CommandSource::SOURCE_HMI;
+ auto source_sdl_to_hmi =
+ am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI;
+ int32_t function_id =
+ hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated;
+
+ EXPECT_TRUE(rpc_service_->IsAppServiceRPC(function_id, source_hmi));
+ EXPECT_TRUE(rpc_service_->IsAppServiceRPC(function_id, source_sdl_to_hmi));
+}
+
+TEST_F(RPCServiceImplTest, IsAppServiceRPC_EmptyPlugin_ReturnFalse) {
+ auto source = am::commands::Command::CommandSource::SOURCE_HMI;
+
+ ON_CALL(mock_app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(mock_rpc_plugin_manager_));
+ typedef am::plugin_manager::RPCPlugin RPCPlugin;
+ utils::Optional<RPCPlugin> mock_rpc_plugin_opt(
+ utils::Optional<RPCPlugin>::OptionalEmpty::EMPTY);
+ ON_CALL(mock_rpc_plugin_manager_, FindPluginToProcess(kFunctionId, source))
+ .WillByDefault(Return(mock_rpc_plugin_opt));
+
+ EXPECT_FALSE(rpc_service_->IsAppServiceRPC(kFunctionId, source));
+}
+
+TEST_F(RPCServiceImplTest, IsAppServiceRPC_PluginWithWrongName_ReturnFalse) {
+ auto source = am::commands::Command::CommandSource::SOURCE_HMI;
+
+ ON_CALL(mock_app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(mock_rpc_plugin_manager_));
+ PluginOpt mock_rpc_plugin_opt(mock_rpc_plugin_);
+ ON_CALL(mock_rpc_plugin_manager_, FindPluginToProcess(kFunctionId, source))
+ .WillByDefault(Return(mock_rpc_plugin_opt));
+ ON_CALL(mock_rpc_plugin_, PluginName()).WillByDefault(Return(""));
+
+ EXPECT_FALSE(rpc_service_->IsAppServiceRPC(kFunctionId, source));
+}
+
+TEST_F(RPCServiceImplTest,
+ IsAppServiceRPC_CommandFactoryIsAbleToProcess_ReturnTrue) {
+ auto source = am::commands::Command::CommandSource::SOURCE_HMI;
+ using namespace application_manager::plugin_manager::plugin_names;
+
+ ON_CALL(mock_app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(mock_rpc_plugin_manager_));
+ PluginOpt mock_rpc_plugin_opt(mock_rpc_plugin_);
+ ON_CALL(mock_rpc_plugin_manager_, FindPluginToProcess(kFunctionId, source))
+ .WillByDefault(Return(mock_rpc_plugin_opt));
+ ON_CALL(mock_rpc_plugin_, PluginName())
+ .WillByDefault(Return(app_service_rpc_plugin));
+ ON_CALL(mock_rpc_plugin_, GetCommandFactory())
+ .WillByDefault(ReturnRef(mock_command_factory_));
+ ON_CALL(mock_command_factory_, IsAbleToProcess(kFunctionId, source))
+ .WillByDefault(Return(true));
+
+ EXPECT_TRUE(rpc_service_->IsAppServiceRPC(kFunctionId, source));
+}
+
+TEST_F(RPCServiceImplTest,
+ UpdateMobileRPCParams_FunctionSchemaIsResettedAndAddedCustomMember) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ // Get initial state of schema
+ auto function_id = mobile_apis::FunctionID::OnHMIStatusID;
+ auto message_type = mobile_apis::messageType::notification;
+ MobileAPIWithPublicSchemaSetting extended_mobile_api;
+ extended_mobile_api.SetSchema(function_id, message_type);
+
+ auto rpc_service_with_extended_api =
+ std::make_shared<rpc_service::RPCServiceImpl>(
+ mock_app_mngr_,
+ request_controller_,
+ &mock_protocol_handler_,
+ &mock_hmi_handler_,
+ mock_command_holder_,
+ mock_rpc_protection_manager_,
+ hmi_so_factory_,
+ extended_mobile_api);
+
+ CSmartSchema initial_schema;
+ extended_mobile_api.GetSchema(function_id, message_type, initial_schema);
+ auto initial_schema_item = initial_schema.getSchemaItem();
+
+ // Change state of schema and add custom parameter
+ auto new_function_id = mobile_apis::FunctionID::OnButtonEventID;
+ std::map<std::string, SMember> members;
+ members["custom member"] = SMember();
+ rpc_service_with_extended_api->UpdateMobileRPCParams(
+ new_function_id, message_type, members);
+ CSmartSchema updated_schema;
+ extended_mobile_api.GetSchema(new_function_id, message_type, updated_schema);
+
+ // Check that schema is changed
+ EXPECT_NE(initial_schema_item, updated_schema.getSchemaItem());
+}
+
+TEST_F(RPCServiceImplTest,
+ UpdateHMIRPCParams_FunctionSchemaIsResettedAndAddedCustomMember) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+
+ // Get initial state of schema
+ auto function_id = hmi_apis::FunctionID::Buttons_OnButtonEvent;
+ auto message_type = hmi_apis::messageType::notification;
+ HMIAPIWithPublicSchemaSetting extended_hmi_api;
+ extended_hmi_api.SetSchema(function_id, message_type);
+
+ auto rpc_service_with_extended_api =
+ std::make_shared<rpc_service::RPCServiceImpl>(
+ mock_app_mngr_,
+ request_controller_,
+ &mock_protocol_handler_,
+ &mock_hmi_handler_,
+ mock_command_holder_,
+ mock_rpc_protection_manager_,
+ extended_hmi_api,
+ mobile_so_factory_);
+
+ CSmartSchema initial_schema;
+ extended_hmi_api.GetSchema(function_id, message_type, initial_schema);
+ auto initial_schema_item = initial_schema.getSchemaItem();
+
+ // Change state of schema and add custom parameter
+ auto new_function_id = hmi_apis::FunctionID::Buttons_OnButtonPress;
+ std::map<std::string, SMember> members;
+ members["custom member"] = SMember();
+ rpc_service_with_extended_api->UpdateHMIRPCParams(
+ function_id, message_type, members);
+ CSmartSchema updated_schema;
+ extended_hmi_api.GetSchema(new_function_id, message_type, updated_schema);
+
+ // Check that schema is changed
+ EXPECT_NE(initial_schema_item, updated_schema.getSchemaItem());
+}
+
+TEST_F(RPCServiceImplTest, SendMessageToHMI_HappyPath) {
+ using namespace application_manager::plugin_manager::plugin_names;
+ auto source = am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI;
+ auto func_id = mobile_apis::FunctionID::RESERVED;
+ auto message = CreateMessage(smart_objects::SmartType_Map);
+ PrepareBasicMessage(message);
+
+ ON_CALL(mock_app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(mock_rpc_plugin_manager_));
+ PluginOpt mock_rpc_plugin_opt(mock_rpc_plugin_);
+ ON_CALL(mock_rpc_plugin_manager_, FindPluginToProcess(func_id, source))
+ .WillByDefault(Return(mock_rpc_plugin_opt));
+ ON_CALL(mock_rpc_plugin_, PluginName())
+ .WillByDefault(Return(app_service_rpc_plugin));
+ ON_CALL(mock_rpc_plugin_, GetCommandFactory())
+ .WillByDefault(ReturnRef(mock_command_factory_));
+
+ EXPECT_CALL(mock_command_factory_, IsAbleToProcess(func_id, source))
+ .WillOnce(Return(true));
+ rpc_service_->SendMessageToHMI(message);
+}
+
+TEST_F(RPCServiceImplTest, SendMessageToHMI_NoHMIHandler_ExecutionAborted) {
+ auto message = CreateMessage(smart_objects::SmartType_Map);
+ PrepareBasicMessage(message);
+
+ rpc_service_->set_hmi_message_handler(nullptr);
+ EXPECT_CALL(mock_app_mngr_, GetPluginManager()).Times(0);
+ rpc_service_->SendMessageToHMI(message);
+}
+
+TEST_F(RPCServiceImplTest, Handle_NoHMIHandler_ExecutionAborted) {
+ auto message_handler = std::make_shared<rpc_service::RPCServiceImpl>(
+ mock_app_mngr_,
+ request_controller_,
+ &mock_protocol_handler_,
+ &mock_hmi_handler_,
+ mock_command_holder_,
+ mock_rpc_protection_manager_,
+ hmi_so_factory_,
+ mobile_so_factory_);
+ message_handler->set_hmi_message_handler(nullptr);
+
+ auto msg = std::shared_ptr<am::Message>();
+ auto msg_to_hmi = am::rpc_service::impl::MessageToHmi(msg);
+
+ EXPECT_CALL(mock_hmi_handler_, SendMessageToHMI(msg_to_hmi)).Times(0);
+ message_handler->Handle(msg_to_hmi);
+}
+
+TEST_F(RPCServiceImplTest, Handle_ValidHMIHandler) {
+ auto message_handler = std::make_shared<rpc_service::RPCServiceImpl>(
+ mock_app_mngr_,
+ request_controller_,
+ &mock_protocol_handler_,
+ &mock_hmi_handler_,
+ mock_command_holder_,
+ mock_rpc_protection_manager_,
+ hmi_so_factory_,
+ mobile_so_factory_);
+ auto msg = std::shared_ptr<am::Message>();
+ auto msg_to_hmi = am::rpc_service::impl::MessageToHmi(msg);
+
+ EXPECT_CALL(mock_hmi_handler_, SendMessageToHMI(msg_to_hmi));
+ message_handler->Handle(msg_to_hmi);
+}
+
+TEST_F(RPCServiceImplTest, Handle_NoMobileProtocolHandler_ExecutionAborted) {
+ auto message_handler = std::make_shared<rpc_service::RPCServiceImpl>(
+ mock_app_mngr_,
+ request_controller_,
+ &mock_protocol_handler_,
+ &mock_hmi_handler_,
+ mock_command_holder_,
+ mock_rpc_protection_manager_,
+ hmi_so_factory_,
+ mobile_so_factory_);
+
+ message_handler->set_protocol_handler(nullptr);
+ auto message_to_send = std::make_shared<am::Message>(
+ protocol_handler::MessagePriority::kDefault);
+
+ EXPECT_CALL(mock_protocol_handler_, IsRPCServiceSecure(_)).Times(0);
+ message_handler->Handle(
+ am::rpc_service::impl::MessageToMobile(message_to_send, false));
+}
+
+TEST_F(RPCServiceImplTest, Handle_NoRawMessage_ExecutionAborted) {
+ auto message_handler = std::make_shared<rpc_service::RPCServiceImpl>(
+ mock_app_mngr_,
+ request_controller_,
+ &mock_protocol_handler_,
+ &mock_hmi_handler_,
+ mock_command_holder_,
+ mock_rpc_protection_manager_,
+ hmi_so_factory_,
+ mobile_so_factory_);
+ auto message_to_send = std::make_shared<am::Message>(
+ protocol_handler::MessagePriority::kDefault);
+
+ EXPECT_CALL(mock_protocol_handler_, IsRPCServiceSecure(_)).Times(0);
+ message_handler->Handle(
+ am::rpc_service::impl::MessageToMobile(message_to_send, false));
+}
+
+TEST_F(RPCServiceImplTest,
+ Handle_NeedsEncryptionAndServiceNotSecure_ExecutionAborted) {
+ auto message_handler = std::make_shared<rpc_service::RPCServiceImpl>(
+ mock_app_mngr_,
+ request_controller_,
+ &mock_protocol_handler_,
+ &mock_hmi_handler_,
+ mock_command_holder_,
+ mock_rpc_protection_manager_,
+ hmi_so_factory_,
+ mobile_so_factory_);
+ auto message_to_send = std::make_shared<am::Message>(
+ protocol_handler::MessagePriority::kDefault);
+ message_to_send->set_protocol_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1);
+ message_to_send->set_connection_key(kConnectionKey);
+ message_to_send->set_correlation_id(kCorrelationId);
+ message_to_send->set_function_id(kFunctionId);
+ message_to_send->set_message_type(static_cast<am::MessageType>(0));
+ message_to_send->set_json_message(std::string("message"));
+
+ EXPECT_CALL(mock_protocol_handler_, IsRPCServiceSecure(kConnectionKey))
+ .WillOnce(Return(false));
+ EXPECT_CALL(*mock_rpc_protection_manager_, IsInEncryptionNeededCache(_, _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_protocol_handler_, SendMessageToMobileApp(_, _, _)).Times(0);
+ message_handler->Handle(
+ am::rpc_service::impl::MessageToMobile(message_to_send, false));
+}
+
+TEST_F(RPCServiceImplTest, Handle_HappyPathWithoutClosingSession) {
+ auto message_handler = std::make_shared<rpc_service::RPCServiceImpl>(
+ mock_app_mngr_,
+ request_controller_,
+ &mock_protocol_handler_,
+ &mock_hmi_handler_,
+ mock_command_holder_,
+ mock_rpc_protection_manager_,
+ hmi_so_factory_,
+ mobile_so_factory_);
+ auto message_to_send = std::make_shared<am::Message>(
+ protocol_handler::MessagePriority::kDefault);
+ message_to_send->set_protocol_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1);
+ message_to_send->set_connection_key(kConnectionKey);
+ message_to_send->set_correlation_id(kCorrelationId);
+ message_to_send->set_function_id(kFunctionId);
+ message_to_send->set_message_type(am::MessageType::kNotification);
+ message_to_send->set_json_message(std::string("message"));
+
+ EXPECT_CALL(mock_protocol_handler_, IsRPCServiceSecure(kConnectionKey))
+ .WillOnce(Return(true));
+ ON_CALL(mock_app_mngr_, application(_)).WillByDefault(Return(nullptr));
+ EXPECT_CALL(*mock_rpc_protection_manager_, CheckPolicyEncryptionFlag(_, _, _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_protocol_handler_, SendMessageToMobileApp(_, _, _))
+ .WillOnce(Return());
+ EXPECT_CALL(*mock_rpc_protection_manager_,
+ RemoveFromEncryptionNeededCache(_, _))
+ .WillOnce(Return());
+ message_handler->Handle(
+ am::rpc_service::impl::MessageToMobile(message_to_send, false));
+}
+
+TEST_F(RPCServiceImplTest, Handle_HappyPathWithClosedSession) {
+ auto message_handler = std::make_shared<rpc_service::RPCServiceImpl>(
+ mock_app_mngr_,
+ request_controller_,
+ &mock_protocol_handler_,
+ &mock_hmi_handler_,
+ mock_command_holder_,
+ mock_rpc_protection_manager_,
+ hmi_so_factory_,
+ mobile_so_factory_);
+ auto message_to_send = std::make_shared<am::Message>(
+ protocol_handler::MessagePriority::kDefault);
+ message_to_send->set_protocol_version(
+ protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1);
+ message_to_send->set_connection_key(kConnectionKey);
+ message_to_send->set_correlation_id(kCorrelationId);
+ message_to_send->set_function_id(kFunctionId);
+ message_to_send->set_message_type(am::MessageType::kNotification);
+ message_to_send->set_json_message(std::string("message"));
+
+ NiceMock<test::components::connection_handler_test::MockConnectionHandler>
+ mock_conn_handler;
+ EXPECT_CALL(mock_app_mngr_, connection_handler())
+ .WillRepeatedly(ReturnRef(mock_conn_handler));
+ ON_CALL(mock_conn_handler, GetConnectionSessionsCount(_))
+ .WillByDefault(Return(kConnectionSessionsCount));
+ ON_CALL(mock_protocol_handler_, IsRPCServiceSecure(_))
+ .WillByDefault(Return(true));
+ ON_CALL(mock_app_mngr_, application(_)).WillByDefault(Return(nullptr));
+ EXPECT_CALL(*mock_rpc_protection_manager_, CheckPolicyEncryptionFlag(_, _, _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_protocol_handler_, SendMessageToMobileApp(_, _, _))
+ .WillOnce(Return());
+ EXPECT_CALL(*mock_rpc_protection_manager_,
+ RemoveFromEncryptionNeededCache(_, _))
+ .WillOnce(Return());
+ EXPECT_CALL(mock_conn_handler, CloseSession(_, _)).WillOnce(Return());
+
+ message_handler->Handle(
+ am::rpc_service::impl::MessageToMobile(message_to_send, true));
+}
+
+TEST_F(RPCServiceImplTest, SendMessageToMobile_HappyPath) {
+ using namespace application_manager::plugin_manager::plugin_names;
+ namespace jhs = ns_smart_device_link::ns_json_handler::strings;
+ auto func_id = mobile_apis::FunctionID::OnSystemRequestID;
+ auto source = am::commands::Command::CommandSource::SOURCE_SDL;
+
+ auto message = CreateMessage(smart_objects::SmartType_Map);
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*message)[am::strings::params][am::strings::function_id] = func_id;
+ (*message)[am::strings::msg_params][am::strings::request_type] =
+ mobile_apis::RequestType::PROPRIETARY;
+ (*message)[am::strings::msg_params][am::strings::result_code] =
+ mobile_apis::Result::SUCCESS;
+
+ (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = func_id;
+ (*message)[jhs::S_PARAMS][jhs::S_MESSAGE_TYPE] =
+ mobile_apis::messageType::request;
+ (*message)[jhs::S_PARAMS][jhs::S_PROTOCOL_TYPE] = kMobileProtocolType;
+ (*message)[jhs::S_PARAMS][jhs::S_PROTOCOL_VERSION] = kProtocolVersion;
+
+ mock_app_ptr_ = std::make_shared<NiceMock<MockApplication> >();
+ ON_CALL(mock_app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_ptr_));
+ ON_CALL(*mock_app_ptr_, protocol_version())
+ .WillByDefault(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1));
+
+ EXPECT_CALL(mock_app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(mock_app_service_nmgr_));
+ auto rpc_pass_handler = std::make_shared<am::RPCPassingHandler>(
+ mock_app_service_nmgr_, mock_app_mngr_);
+ EXPECT_CALL(mock_app_service_nmgr_, GetRPCPassingHandler())
+ .WillRepeatedly(ReturnRef(*rpc_pass_handler));
+ EXPECT_CALL(mock_app_service_nmgr_, GetActiveServices())
+ .WillRepeatedly(Return(std::vector<am::AppService>()));
+
+ ON_CALL(mock_app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(mock_rpc_plugin_manager_));
+ PluginOpt mock_rpc_plugin_opt(mock_rpc_plugin_);
+ ON_CALL(mock_rpc_plugin_manager_, FindPluginToProcess(func_id, source))
+ .WillByDefault(Return(mock_rpc_plugin_opt));
+ ON_CALL(mock_rpc_plugin_, PluginName())
+ .WillByDefault(Return(app_service_rpc_plugin));
+ ON_CALL(mock_rpc_plugin_, GetCommandFactory())
+ .WillByDefault(ReturnRef(mock_command_factory_));
+ ON_CALL(mock_command_factory_, IsAbleToProcess(func_id, source))
+ .WillByDefault(Return(true));
+
+ auto window_id = 0;
+ ON_CALL(mock_message_helper_, ExtractWindowIdFromSmartObject(_))
+ .WillByDefault(Return(window_id));
+ ON_CALL(mock_message_helper_, StringifiedFunctionID(func_id))
+ .WillByDefault(Return("OnSystemRequest"));
+ EXPECT_CALL(mock_app_mngr_,
+ CheckPolicyPermissions(_, window_id, "OnSystemRequest", _, _))
+ .WillOnce(Return(mobile_apis::Result::SUCCESS));
+
+ policy_test::MockPolicyHandlerInterface mock_policy_handler;
+ EXPECT_CALL(mock_app_mngr_, GetPolicyHandler())
+ .WillOnce(ReturnRef(mock_policy_handler));
+ EXPECT_CALL(mock_policy_handler, OnUpdateRequestSentToMobile());
+
+ rpc_service_->SendMessageToMobile(message);
+}
+
+TEST_F(RPCServiceImplTest,
+ SendMessageToMobile_PolicyPermissionsFailed_ExecutionAborted) {
+ using namespace application_manager::plugin_manager::plugin_names;
+
+ namespace jhs = ns_smart_device_link::ns_json_handler::strings;
+ auto func_id = mobile_apis::FunctionID::OnSystemRequestID;
+ auto source = am::commands::Command::CommandSource::SOURCE_SDL;
+
+ auto message = CreateMessage(smart_objects::SmartType_Map);
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*message)[am::strings::params][am::strings::function_id] = func_id;
+ (*message)[am::strings::msg_params][am::strings::request_type] =
+ mobile_apis::RequestType::PROPRIETARY;
+ (*message)[am::strings::msg_params][am::strings::result_code] =
+ mobile_apis::Result::SUCCESS;
+
+ (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = func_id;
+ (*message)[jhs::S_PARAMS][jhs::S_MESSAGE_TYPE] =
+ mobile_apis::messageType::request;
+ (*message)[jhs::S_PARAMS][jhs::S_PROTOCOL_TYPE] = kMobileProtocolType;
+ (*message)[jhs::S_PARAMS][jhs::S_PROTOCOL_VERSION] = kProtocolVersion;
+
+ mock_app_ptr_ = std::make_shared<NiceMock<MockApplication> >();
+ ON_CALL(mock_app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_ptr_));
+ ON_CALL(*mock_app_ptr_, protocol_version())
+ .WillByDefault(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_1));
+
+ EXPECT_CALL(mock_app_mngr_, GetAppServiceManager())
+ .WillRepeatedly(ReturnRef(mock_app_service_nmgr_));
+ auto rpc_pass_handler = std::make_shared<am::RPCPassingHandler>(
+ mock_app_service_nmgr_, mock_app_mngr_);
+ EXPECT_CALL(mock_app_service_nmgr_, GetRPCPassingHandler())
+ .WillRepeatedly(ReturnRef(*rpc_pass_handler));
+ EXPECT_CALL(mock_app_service_nmgr_, GetActiveServices())
+ .WillRepeatedly(Return(std::vector<am::AppService>()));
+
+ ON_CALL(mock_app_mngr_, GetPluginManager())
+ .WillByDefault(ReturnRef(mock_rpc_plugin_manager_));
+ PluginOpt mock_rpc_plugin_opt(mock_rpc_plugin_);
+ ON_CALL(mock_rpc_plugin_manager_, FindPluginToProcess(func_id, source))
+ .WillByDefault(Return(mock_rpc_plugin_opt));
+ ON_CALL(mock_rpc_plugin_, PluginName())
+ .WillByDefault(Return(app_service_rpc_plugin));
+ ON_CALL(mock_rpc_plugin_, GetCommandFactory())
+ .WillByDefault(ReturnRef(mock_command_factory_));
+ ON_CALL(mock_command_factory_, IsAbleToProcess(func_id, source))
+ .WillByDefault(Return(true));
+
+ auto window_id = -1; // Assume that this ID is invalid;
+ ON_CALL(mock_message_helper_, ExtractWindowIdFromSmartObject(_))
+ .WillByDefault(Return(window_id));
+ ON_CALL(mock_message_helper_, StringifiedFunctionID(func_id))
+ .WillByDefault(Return("OnSystemRequest"));
+ EXPECT_CALL(mock_app_mngr_,
+ CheckPolicyPermissions(_, window_id, "OnSystemRequest", _, _))
+ .WillOnce(Return(mobile_apis::Result::INVALID_ENUM));
+
+ policy_test::MockPolicyHandlerInterface mock_policy_handler;
+ EXPECT_CALL(mock_app_mngr_, GetPolicyHandler()).Times(0);
+ EXPECT_CALL(mock_policy_handler, OnUpdateRequestSentToMobile()).Times(0);
+
+ rpc_service_->SendMessageToMobile(message);
+}
+} // namespace application_manager_test
+
+} // namespace components
+
+} // namespace test
diff --git a/src/components/application_manager/test/sdl_preloaded_pt.json b/src/components/application_manager/test/sdl_preloaded_pt.json
index 7f5436b5b6..ad264c8518 100644
--- a/src/components/application_manager/test/sdl_preloaded_pt.json
+++ b/src/components/application_manager/test/sdl_preloaded_pt.json
@@ -297,6 +297,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -309,6 +310,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -321,6 +323,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -333,6 +336,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -359,6 +363,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -379,6 +384,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -399,6 +405,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -418,6 +425,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/application_manager/test/sdl_pt_update.json b/src/components/application_manager/test/sdl_pt_update.json
index e5fdb33a93..aea3f7700b 100644
--- a/src/components/application_manager/test/sdl_pt_update.json
+++ b/src/components/application_manager/test/sdl_pt_update.json
@@ -20,7 +20,13 @@
"nicknames" : [ "SyncProxyTester" ],
"priority" : "EMERGENCY",
"steal_focus" : true,
- "watchdog_timer_ms" : 20000
+ "watchdog_timer_ms" : 20000,
+ "app_services": {
+ "MEDIA": {
+ "service_names" : ["SDL App", "SDL Music"],
+ "handled_rpcs" : [{"function_id": 41}]
+ }
+ }
},
"default" : {
"default_hmi" : "NONE",
@@ -1433,6 +1439,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1445,6 +1452,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1457,6 +1465,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1469,6 +1478,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1596,6 +1606,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1614,6 +1625,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1632,6 +1644,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1649,6 +1662,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc
index bbd7220bc9..93565b8719 100644
--- a/src/components/application_manager/test/state_controller/state_controller_test.cc
+++ b/src/components/application_manager/test/state_controller/state_controller_test.cc
@@ -30,54 +30,60 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
+#include "application_manager/application_manager_impl.h"
#include "application_manager/hmi_state.h"
+#include "application_manager/mock_application.h"
#include "application_manager/state_controller_impl.h"
#include "application_manager/usage_statistics.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/mock_application.h"
-#include "connection_handler/mock_connection_handler_settings.h"
#include "connection_handler/connection_handler_impl.h"
+#include "connection_handler/mock_connection_handler_settings.h"
+#include "gtest/gtest.h"
#include "transport_manager/mock_transport_manager.h"
-#include "utils/lock.h"
#include "utils/data_accessor.h"
-#include "utils/make_shared.h"
-#include "application_manager/message_helper.h"
+#include "utils/lock.h"
+
#include "application_manager/event_engine/event.h"
-#include "application_manager/smart_object_keys.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_event_dispatcher.h"
#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_rpc_service.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/smart_object_keys.h"
+#include "connection_handler/mock_connection_handler.h"
#include "policy/mock_policy_settings.h"
#include "policy/usage_statistics/mock_statistics_manager.h"
#include "protocol_handler/mock_session_observer.h"
-#include "connection_handler/mock_connection_handler.h"
-#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "application_manager/mock_event_dispatcher.h"
-#include "application_manager/resumption/resume_ctrl.h"
-#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_rpc_service.h"
namespace am = application_manager;
using am::HmiState;
using am::HmiStatePtr;
using am::UsageStatistics;
using ::testing::_;
-using ::testing::Return;
-using ::testing::ReturnRef;
-using ::testing::ReturnPointee;
+using ::testing::AtLeast;
+using ::testing::InSequence;
using ::testing::Mock;
using ::testing::NiceMock;
-using ::testing::InSequence;
+using ::testing::Return;
+using ::testing::ReturnPointee;
+using ::testing::ReturnRef;
+using ::testing::SaveArg;
using ::testing::Truly;
-using ::testing::AtLeast;
+
+using application_manager::MockMessageHelper;
namespace test {
namespace components {
namespace state_controller_test {
-namespace constants {
+namespace {
const uint32_t kCorrID = 314u;
const uint32_t kHMIAppID = 2718u;
-} // namespace constants
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const am::WindowID kCustomWindowId = 2;
+} // namespace
struct HmiStatesComparator {
mobile_apis::HMILevel::eType hmi_level_;
@@ -138,7 +144,7 @@ class StateControllerImplTest : public ::testing::Test {
StateControllerImplTest()
: ::testing::Test()
, usage_stat("0",
- utils::SharedPtr<usage_statistics::StatisticsManager>(
+ std::shared_ptr<usage_statistics::StatisticsManager>(
new usage_statistics_test::MockStatisticsManager))
, applications_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, applications_(application_set_, applications_lock_ptr_)
@@ -150,7 +156,6 @@ class StateControllerImplTest : public ::testing::Test {
~StateControllerImplTest() {
Mock::VerifyAndClearExpectations(&message_helper_mock_);
}
-
NiceMock<application_manager_test::MockApplicationManager> app_manager_mock_;
NiceMock<application_manager_test::MockRPCService> mock_rpc_service_;
NiceMock<policy_test::MockPolicyHandlerInterface> policy_interface_;
@@ -164,39 +169,47 @@ class StateControllerImplTest : public ::testing::Test {
am::ApplicationSet application_set_;
mutable std::shared_ptr<sync_primitives::Lock> applications_lock_ptr_;
DataAccessor<am::ApplicationSet> applications_;
- utils::SharedPtr<am::StateControllerImpl> state_ctrl_;
+ std::shared_ptr<am::StateControllerImpl> state_ctrl_;
am::ApplicationSharedPtr simple_app_;
NiceMock<application_manager_test::MockApplication>* simple_app_ptr_;
uint32_t simple_app_id_ = 1721;
+ uint32_t simple_hmi_app_id_ = 22770; // random number
am::ApplicationSharedPtr navi_app_;
NiceMock<application_manager_test::MockApplication>* navi_app_ptr_;
uint32_t navi_app_id_ = 1762;
+ uint32_t navi_hmi_app_id_ = 17559;
am::ApplicationSharedPtr media_app_;
NiceMock<application_manager_test::MockApplication>* media_app_ptr_;
uint32_t media_app_id_ = 1801;
+ uint32_t media_hmi_app_id_ = 12751;
am::ApplicationSharedPtr vc_app_;
NiceMock<application_manager_test::MockApplication>* vc_app_ptr_;
uint32_t vc_app_id_ = 1825;
+ uint32_t vc_hmi_app_id_ = 14986;
am::ApplicationSharedPtr media_navi_app_;
NiceMock<application_manager_test::MockApplication>* media_navi_app_ptr_;
uint32_t media_navi_app_id_ = 1855;
+ uint32_t media_navi_hmi_app_id_ = 16194;
am::ApplicationSharedPtr media_vc_app_;
NiceMock<application_manager_test::MockApplication>* media_vc_app_ptr_;
uint32_t media_vc_app_id_ = 1881;
+ uint32_t media_vc_hmi_app_id_ = 12798;
am::ApplicationSharedPtr navi_vc_app_;
NiceMock<application_manager_test::MockApplication>* navi_vc_app_ptr_;
uint32_t navi_vc_app_id_ = 1894;
+ uint32_t navi_vc_hmi_app_id_ = 10807;
am::ApplicationSharedPtr media_navi_vc_app_;
NiceMock<application_manager_test::MockApplication>* media_navi_vc_app_ptr_;
uint32_t media_navi_vc_app_id_ = 1922;
+ uint32_t media_navi_vc_hmi_app_id_ = 21419;
std::vector<am::HmiStatePtr> valid_states_for_audio_app_;
std::vector<am::HmiStatePtr> valid_states_for_not_audio_app_;
@@ -204,7 +217,11 @@ class StateControllerImplTest : public ::testing::Test {
std::vector<am::HmiStatePtr> invalid_states_for_not_audio_app;
std::vector<am::HmiStatePtr> invalid_states_for_audio_app;
std::vector<am::HmiState::StateID> valid_state_ids_;
- std::vector<am::ApplicationSharedPtr> applications_list_;
+
+ typedef std::map<am::ApplicationSharedPtr,
+ NiceMock<application_manager_test::MockApplication>*>
+ AppPtrMockMapping;
+ AppPtrMockMapping applications_list_;
connection_handler_test::MockConnectionHandlerSettings
mock_connection_handler__settings;
@@ -222,7 +239,7 @@ class StateControllerImplTest : public ::testing::Test {
namespace SystemContext = mobile_apis::SystemContext;
am::HmiStatePtr state =
- utils::MakeShared<am::HmiState>(simple_app_, app_manager_mock_);
+ std::make_shared<am::HmiState>(simple_app_, app_manager_mock_);
state->set_hmi_level(hmi_level);
state->set_audio_streaming_state(audio_ss);
state->set_video_streaming_state(video_ss);
@@ -242,7 +259,7 @@ class StateControllerImplTest : public ::testing::Test {
const mobile_apis::SystemContext::eType system_context,
const am::ApplicationSharedPtr app) {
am::HmiStatePtr new_state =
- utils::MakeShared<HmiStateType>(app, app_manager_mock_);
+ std::make_shared<HmiStateType>(app, app_manager_mock_);
new_state->set_hmi_level(hmi_level);
new_state->set_audio_streaming_state(audio_ss);
@@ -545,21 +562,26 @@ class StateControllerImplTest : public ::testing::Test {
// application properties, i.e. is_media_application flag from RAI and
// AppHmiTypes (NAVIGATION, etc.). Most likely logic should be changed
// after conclusion on APPLINK-20231
- std::vector<am::ApplicationSharedPtr>::iterator app = std::find_if(
- applications_list_.begin(),
- applications_list_.end(),
- [app_id](am::ApplicationSharedPtr a) { return app_id == a->app_id(); });
-
- if (app == applications_list_.end()) {
+ AppPtrMockMapping::iterator it =
+ std::find_if(applications_list_.begin(),
+ applications_list_.end(),
+ [app_id](AppPtrMockMapping::value_type& item) {
+ return app_id == item.first->app_id();
+ });
+
+ if (applications_list_.end() == it) {
return APP_TYPE_NON_MEDIA;
}
- if ((*app)->is_navi()) {
+ auto app = it->first;
+ if (app->is_navi()) {
return APP_TYPE_NAVI;
}
- if ((*app)->is_media_application()) {
+
+ if (app->is_media_application()) {
return APP_TYPE_MEDIA;
}
+
return APP_TYPE_NON_MEDIA;
}
@@ -635,21 +657,19 @@ class StateControllerImplTest : public ::testing::Test {
template <typename T, typename Q>
void TestMixState(void (StateControllerImplTest::*call_back_result)(
std::vector<am::HmiStatePtr>&, ApplicationType)) {
- std::vector<am::ApplicationSharedPtr>::iterator it_begin =
- applications_list_.begin();
- std::vector<am::ApplicationSharedPtr>::iterator it_end =
- applications_list_.end();
+ AppPtrMockMapping::iterator it_begin = applications_list_.begin();
+ AppPtrMockMapping::iterator it_end = applications_list_.end();
ApplicationType app_type;
uint32_t app_id;
am::ApplicationSharedPtr app;
+
for (; it_begin != it_end; ++it_begin) {
- app_id = (*it_begin)->app_id();
+ app_id = it_begin->first->app_id();
app_type = AppType(app_id);
- app = (*it_begin);
- am::HmiStatePtr state_first =
- utils::MakeShared<T>(app, app_manager_mock_);
+ app = it_begin->first;
+ am::HmiStatePtr state_first = std::make_shared<T>(app, app_manager_mock_);
am::HmiStatePtr state_second =
- utils::MakeShared<Q>(app, app_manager_mock_);
+ std::make_shared<Q>(app, app_manager_mock_);
TestSetSeveralState(
app, state_first, state_second, app_type, call_back_result);
TestSetSeveralState(
@@ -661,6 +681,7 @@ class StateControllerImplTest : public ::testing::Test {
am::ApplicationSharedPtr ConfigureApp(
NiceMock<application_manager_test::MockApplication>** app_mock,
uint32_t app_id,
+ uint32_t hmi_app_id,
bool media,
bool navi,
bool vc) {
@@ -670,6 +691,7 @@ class StateControllerImplTest : public ::testing::Test {
am::ApplicationSharedPtr app(*app_mock);
ON_CALL(**app_mock, app_id()).WillByDefault(Return(app_id));
+ ON_CALL(**app_mock, hmi_app_id()).WillByDefault(Return(hmi_app_id));
ON_CALL(**app_mock, is_media_application()).WillByDefault(Return(media));
ON_CALL(**app_mock, is_navi()).WillByDefault(Return(navi));
ON_CALL(**app_mock, is_voice_communication_supported())
@@ -871,29 +893,58 @@ class StateControllerImplTest : public ::testing::Test {
}
void ConfigureApps() {
- simple_app_ = ConfigureApp(
- &simple_app_ptr_, simple_app_id_, NOT_MEDIA, NOT_NAVI, NOT_VC);
- media_app_ =
- ConfigureApp(&media_app_ptr_, media_app_id_, MEDIA, NOT_NAVI, NOT_VC);
- navi_app_ =
- ConfigureApp(&navi_app_ptr_, navi_app_id_, NOT_MEDIA, NAVI, NOT_VC);
- vc_app_ = ConfigureApp(&vc_app_ptr_, vc_app_id_, NOT_MEDIA, NOT_NAVI, VC);
- media_navi_app_ = ConfigureApp(
- &media_navi_app_ptr_, media_navi_app_id_, MEDIA, NAVI, NOT_VC);
- media_vc_app_ =
- ConfigureApp(&media_vc_app_ptr_, media_vc_app_id_, MEDIA, NOT_NAVI, VC);
- navi_vc_app_ =
- ConfigureApp(&navi_vc_app_ptr_, navi_vc_app_id_, NOT_MEDIA, NAVI, VC);
- media_navi_vc_app_ = ConfigureApp(
- &media_navi_vc_app_ptr_, media_navi_vc_app_id_, MEDIA, NAVI, VC);
- applications_list_.push_back(simple_app_);
- applications_list_.push_back(media_app_);
- applications_list_.push_back(navi_app_);
- applications_list_.push_back(vc_app_);
- applications_list_.push_back(media_navi_app_);
- applications_list_.push_back(media_vc_app_);
- applications_list_.push_back(navi_vc_app_);
- applications_list_.push_back(media_navi_vc_app_);
+ simple_app_ = ConfigureApp(&simple_app_ptr_,
+ simple_app_id_,
+ simple_hmi_app_id_,
+ NOT_MEDIA,
+ NOT_NAVI,
+ NOT_VC);
+ media_app_ = ConfigureApp(&media_app_ptr_,
+ media_app_id_,
+ media_hmi_app_id_,
+ MEDIA,
+ NOT_NAVI,
+ NOT_VC);
+ navi_app_ = ConfigureApp(&navi_app_ptr_,
+ navi_app_id_,
+ navi_hmi_app_id_,
+ NOT_MEDIA,
+ NAVI,
+ NOT_VC);
+ vc_app_ = ConfigureApp(
+ &vc_app_ptr_, vc_app_id_, vc_hmi_app_id_, NOT_MEDIA, NOT_NAVI, VC);
+ media_navi_app_ = ConfigureApp(&media_navi_app_ptr_,
+ media_navi_app_id_,
+ media_navi_hmi_app_id_,
+ MEDIA,
+ NAVI,
+ NOT_VC);
+ media_vc_app_ = ConfigureApp(&media_vc_app_ptr_,
+ media_vc_app_id_,
+ media_vc_hmi_app_id_,
+ MEDIA,
+ NOT_NAVI,
+ VC);
+ navi_vc_app_ = ConfigureApp(&navi_vc_app_ptr_,
+ navi_vc_app_id_,
+ navi_vc_hmi_app_id_,
+ NOT_MEDIA,
+ NAVI,
+ VC);
+ media_navi_vc_app_ = ConfigureApp(&media_navi_vc_app_ptr_,
+ media_navi_vc_app_id_,
+ media_navi_vc_hmi_app_id_,
+ MEDIA,
+ NAVI,
+ VC);
+ applications_list_[simple_app_] = simple_app_ptr_;
+ applications_list_[media_app_] = media_app_ptr_;
+ applications_list_[navi_app_] = navi_app_ptr_;
+ applications_list_[vc_app_] = vc_app_ptr_;
+ applications_list_[media_navi_app_] = media_navi_app_ptr_;
+ applications_list_[media_vc_app_] = media_vc_app_ptr_;
+ applications_list_[navi_vc_app_] = navi_vc_app_ptr_;
+ applications_list_[media_navi_vc_app_] = media_navi_vc_app_ptr_;
}
void CheckAppConfiguration() {
ASSERT_EQ(simple_app_.get(), simple_app_ptr_);
@@ -914,6 +965,15 @@ class StateControllerImplTest : public ::testing::Test {
ASSERT_EQ(navi_vc_app_->app_id(), navi_vc_app_id_);
ASSERT_EQ(media_navi_vc_app_->app_id(), media_navi_vc_app_id_);
+ ASSERT_EQ(simple_app_->hmi_app_id(), simple_hmi_app_id_);
+ ASSERT_EQ(media_app_->hmi_app_id(), media_hmi_app_id_);
+ ASSERT_EQ(navi_app_->hmi_app_id(), navi_hmi_app_id_);
+ ASSERT_EQ(vc_app_->hmi_app_id(), vc_hmi_app_id_);
+ ASSERT_EQ(media_navi_app_->hmi_app_id(), media_navi_hmi_app_id_);
+ ASSERT_EQ(media_vc_app_->hmi_app_id(), media_vc_hmi_app_id_);
+ ASSERT_EQ(navi_vc_app_->hmi_app_id(), navi_vc_hmi_app_id_);
+ ASSERT_EQ(media_navi_vc_app_->hmi_app_id(), media_navi_vc_hmi_app_id_);
+
ASSERT_FALSE(simple_app_->IsAudioApplication());
ASSERT_TRUE(media_app_->IsAudioApplication());
ASSERT_TRUE(navi_app_->IsAudioApplication());
@@ -954,8 +1014,7 @@ class StateControllerImplTest : public ::testing::Test {
virtual void SetUp() OVERRIDE {
ON_CALL(app_manager_mock_, event_dispatcher())
.WillByDefault(ReturnRef(mock_event_dispatcher_));
- state_ctrl_ = utils::MakeShared<am::StateControllerImpl>(app_manager_mock_);
-
+ state_ctrl_ = std::make_shared<am::StateControllerImpl>(app_manager_mock_);
ON_CALL(app_manager_mock_, applications())
.WillByDefault(Return(applications_));
ConfigureApps();
@@ -968,6 +1027,22 @@ class StateControllerImplTest : public ::testing::Test {
delete conn_handler;
}
+ application_manager::commands::MessageSharedPtr CreateCloseAppMessage() {
+ using namespace application_manager;
+
+ smart_objects::SmartObjectSPtr message =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ (*message)[application_manager::strings::params]
+ [application_manager::strings::function_id] =
+ hmi_apis::FunctionID::BasicCommunication_CloseApplication;
+ (*message)[strings::params][strings::message_type] = MessageType::kRequest;
+ (*message)[strings::params][strings::correlation_id] = kCorrID;
+ (*message)[strings::msg_params][strings::app_id] = kHMIAppID;
+
+ return message;
+ }
+
void SetConnection() {
conn_handler = new connection_handler::ConnectionHandlerImpl(
mock_connection_handler__settings, mock_transport_manager);
@@ -984,34 +1059,46 @@ class StateControllerImplTest : public ::testing::Test {
ON_CALL(app_manager_mock_, GetPolicyHandler())
.WillByDefault(ReturnRef(policy_interface_));
smart_objects::SmartObjectSPtr bc_activate_app_request =
- new smart_objects::SmartObject();
+ std::make_shared<smart_objects::SmartObject>();
(*bc_activate_app_request)[am::strings::params]
[am::strings::correlation_id] = corr_id;
ON_CALL(message_helper_mock_,
- GetBCActivateAppRequestToHMI(_, _, _, hmi_lvl, _, _))
+ GetBCActivateAppRequestToHMI(_, _, hmi_lvl, _, _))
.WillByDefault(Return(bc_activate_app_request));
ON_CALL(app_manager_mock_, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
- ON_CALL(mock_rpc_service_, ManageHMICommand(bc_activate_app_request))
+ ON_CALL(mock_rpc_service_, ManageHMICommand(bc_activate_app_request, _))
.WillByDefault(Return(true));
}
- void ExpectSuccesfullSetHmiState(
+ void ExpectSuccessfulSetHmiState(
+ am::ApplicationSharedPtr app,
+ NiceMock<application_manager_test::MockApplication>* app_mock,
+ am::HmiStatePtr old_state,
+ am::HmiStatePtr new_state) {
+ ExpectSuccessfulSetHmiState(
+ app, app_mock, kDefaultWindowId, old_state, new_state);
+ }
+
+ void ExpectSuccessfulSetHmiState(
am::ApplicationSharedPtr app,
NiceMock<application_manager_test::MockApplication>* app_mock,
+ am::WindowID window_id,
am::HmiStatePtr old_state,
am::HmiStatePtr new_state) {
- EXPECT_CALL(*app_mock, CurrentHmiState())
+ EXPECT_CALL(*app_mock, CurrentHmiState(window_id))
.WillOnce(Return(old_state))
.WillOnce(Return(new_state));
- EXPECT_CALL(*app_mock,
- SetRegularState(Truly(HmiStatesComparator(new_state))));
+ EXPECT_CALL(
+ *app_mock,
+ SetRegularState(window_id, Truly(HmiStatesComparator(new_state))));
if (!HmiStatesComparator(old_state)(new_state)) {
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(app));
- EXPECT_CALL(
- app_manager_mock_,
- OnHMILevelChanged(
- app->app_id(), old_state->hmi_level(), new_state->hmi_level()));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(app, window_id, _));
+ if (kDefaultWindowId == window_id) {
+ EXPECT_CALL(app_manager_mock_,
+ OnHMIStateChanged(app->app_id(), _, new_state));
+ }
}
}
@@ -1020,26 +1107,39 @@ class StateControllerImplTest : public ::testing::Test {
NiceMock<application_manager_test::MockApplication>* app_mock,
am::HmiStatePtr old_state,
am::HmiStatePtr new_state) {
- EXPECT_CALL(*app_mock, RegularHmiState())
+ EXPECT_CALL(*app_mock, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(old_state))
.WillOnce(Return(old_state));
- ExpectSuccesfullSetHmiState(app, app_mock, old_state, new_state);
+ ExpectSuccessfulSetHmiState(app, app_mock, old_state, new_state);
}
void ExpectAppWontChangeHmiStateDueToConflictResolving(
am::ApplicationSharedPtr app,
NiceMock<application_manager_test::MockApplication>* app_mock,
+ const am::WindowID window_id,
am::HmiStatePtr state) {
- ON_CALL(*app_mock, RegularHmiState()).WillByDefault(Return(state));
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(app)).Times(0);
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(app->app_id(), _, _))
+ ON_CALL(*app_mock, RegularHmiState(window_id)).WillByDefault(Return(state));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(app, window_id, _))
+ .Times(0);
+ EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(app->app_id(), _, _))
.Times(0);
}
+ void ExpectAppWontChangeHmiStateDueToConflictResolving(
+ am::ApplicationSharedPtr app,
+ NiceMock<application_manager_test::MockApplication>* app_mock,
+ am::HmiStatePtr state) {
+ ExpectAppWontChangeHmiStateDueToConflictResolving(
+ app, app_mock, kDefaultWindowId, state);
+ }
+
void InsertApplication(am::ApplicationSharedPtr app) {
application_set_.insert(app);
ON_CALL(app_manager_mock_, application(app->app_id()))
.WillByDefault(Return(app));
+ ON_CALL(app_manager_mock_, application_by_hmi_app(app->hmi_app_id()))
+ .WillByDefault(Return(app));
}
am::HmiStatePtr NoneNotAudibleState() {
@@ -1085,13 +1185,14 @@ class StateControllerImplTest : public ::testing::Test {
using smart_objects::SmartObject;
namespace FunctionID = hmi_apis::FunctionID;
- EXPECT_CALL(app_mock, CurrentHmiState())
+ EXPECT_CALL(app_mock, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(NoneNotAudibleState()));
for (size_t i = 0; i < state_ids.size(); ++i) {
am::HmiState::StateID state_id = state_ids[i];
EXPECT_CALL(app_mock,
- AddHMIState(Truly(HmiStatesIDComparator(state_id))));
+ AddHMIState(kDefaultWindowId,
+ Truly(HmiStatesIDComparator(state_id))));
switch (state_id) {
case am::HmiState::StateID::STATE_ID_VR_SESSION: {
Event vr_start_event(FunctionID::VR_Started);
@@ -1132,7 +1233,7 @@ class StateControllerImplTest : public ::testing::Test {
default:
break;
}
- EXPECT_CALL(app_mock, AddHMIState(_)).Times(0);
+ EXPECT_CALL(app_mock, AddHMIState(kDefaultWindowId, _)).Times(0);
}
}
@@ -1144,12 +1245,23 @@ class StateControllerImplTest : public ::testing::Test {
using smart_objects::SmartObject;
namespace FunctionID = hmi_apis::FunctionID;
- EXPECT_CALL(app_mock, CurrentHmiState())
+ ON_CALL(message_helper_mock_, GetBCCloseApplicationRequestToHMI(_, _))
+ .WillByDefault(Return(CreateCloseAppMessage()));
+ ON_CALL(app_manager_mock_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ ON_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillByDefault(Return(true));
+ EXPECT_CALL(app_mock, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(NoneNotAudibleState()));
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(app_mock, GetWindowIds()).WillRepeatedly(Return(window_ids));
+
for (uint32_t i = 0; i < state_ids.size(); ++i) {
am::HmiState::StateID state_id = state_ids[i];
- EXPECT_CALL(app_mock, AddHMIState(Truly(HmiStatesIDComparator(state_id))))
+ EXPECT_CALL(
+ app_mock,
+ AddHMIState(kDefaultWindowId, Truly(HmiStatesIDComparator(state_id))))
.Times(1);
switch (state_id) {
@@ -1193,16 +1305,17 @@ class StateControllerImplTest : public ::testing::Test {
break;
}
- EXPECT_CALL(app_mock, AddHMIState(_)).Times(0);
+ EXPECT_CALL(app_mock, AddHMIState(kDefaultWindowId, _)).Times(0);
}
for (uint32_t i = 0; i < state_ids.size(); ++i) {
am::HmiState::StateID state_id = state_ids[i];
- EXPECT_CALL(app_mock, RemoveHMIState(state_id)).Times(1);
+ EXPECT_CALL(app_mock, RemoveHMIState(kDefaultWindowId, state_id))
+ .Times(1);
- EXPECT_CALL(app_mock, PostponedHmiState())
+ EXPECT_CALL(app_mock, PostponedHmiState(kDefaultWindowId))
.WillOnce(Return(NoneNotAudibleState()));
- EXPECT_CALL(app_mock, RemovePostponedState());
+ EXPECT_CALL(app_mock, RemovePostponedState(kDefaultWindowId));
switch (state_id) {
case am::HmiState::StateID::STATE_ID_VR_SESSION: {
@@ -1245,18 +1358,19 @@ class StateControllerImplTest : public ::testing::Test {
break;
}
- EXPECT_CALL(app_mock, RemoveHMIState(_)).Times(0);
+ EXPECT_CALL(app_mock, RemoveHMIState(kDefaultWindowId, _)).Times(0);
}
}
};
TEST_F(StateControllerImplTest, OnStateChangedWithEqualStates) {
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_)).Times(0);
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
+ EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _)).Times(0);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
for (uint32_t i = 0; i < valid_states_for_not_audio_app_.size(); ++i) {
state_ctrl_->OnStateChanged(simple_app_,
+ kDefaultWindowId,
valid_states_for_not_audio_app_[i],
valid_states_for_not_audio_app_[i]);
}
@@ -1267,24 +1381,26 @@ TEST_F(StateControllerImplTest, OnStateChangedWithDifferentStates) {
for (uint32_t j = 0; j < valid_states_for_not_audio_app_.size(); ++j) {
HmiStatesComparator comp(valid_states_for_not_audio_app_[i]);
if (!comp(valid_states_for_not_audio_app_[j])) {
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
- .Times(1);
EXPECT_CALL(
- app_manager_mock_,
- OnHMILevelChanged(simple_app_id_,
- valid_states_for_not_audio_app_[i]->hmi_level(),
- valid_states_for_not_audio_app_[j]->hmi_level()))
+ message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
+ EXPECT_CALL(app_manager_mock_,
+ OnHMIStateChanged(simple_app_id_,
+ valid_states_for_not_audio_app_[i],
+ valid_states_for_not_audio_app_[j]))
.Times(1);
if (mobile_apis::HMILevel::HMI_NONE ==
valid_states_for_not_audio_app_[j]->hmi_level()) {
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(1);
}
state_ctrl_->OnStateChanged(simple_app_,
+ kDefaultWindowId,
valid_states_for_not_audio_app_[i],
valid_states_for_not_audio_app_[j]);
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_)).Times(0);
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
+ EXPECT_CALL(message_helper_mock_, SendHMIStatusNotification(_, _, _))
+ .Times(0);
+ EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _)).Times(0);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
}
}
@@ -1306,10 +1422,12 @@ TEST_F(StateControllerImplTest, OnStateChangedToNone) {
SystemContext::SYSCTXT_MAIN);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
- state_ctrl_->OnStateChanged(simple_app_, none_state, not_none_state);
+ state_ctrl_->OnStateChanged(
+ simple_app_, kDefaultWindowId, none_state, not_none_state);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(1);
- state_ctrl_->OnStateChanged(simple_app_, not_none_state, none_state);
+ state_ctrl_->OnStateChanged(
+ simple_app_, kDefaultWindowId, not_none_state, none_state);
}
TEST_F(StateControllerImplTest, MoveSimpleAppToValidStates) {
@@ -1327,18 +1445,21 @@ TEST_F(StateControllerImplTest, MoveSimpleAppToValidStates) {
it != valid_states_for_not_audio_app_.end();
++it) {
HmiStatePtr state_to_setup = *it;
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
EXPECT_CALL(app_manager_mock_,
- OnHMILevelChanged(simple_app_id_,
- initial_state->hmi_level(),
- state_to_setup->hmi_level()));
+ OnHMIStateChanged(simple_app_id_,
+ Truly(HmiStatesComparator(initial_state)),
+ state_to_setup));
EXPECT_CALL(*simple_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(state_to_setup))));
- state_ctrl_->SetRegularState(simple_app_, state_to_setup, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(state_to_setup))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, state_to_setup, false);
initial_state = state_to_setup;
}
}
@@ -1363,18 +1484,19 @@ TEST_F(StateControllerImplTest, MoveAudioNotResumeAppToValidStates) {
it != valid_states_for_audio_app_.end();
++it) {
HmiStatePtr state_to_setup = *it;
- EXPECT_CALL(*audio_app_mock, CurrentHmiState())
+ EXPECT_CALL(*audio_app_mock, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(audio_app));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(audio_app, kDefaultWindowId, _));
EXPECT_CALL(app_manager_mock_,
- OnHMILevelChanged(audio_app->app_id(),
- initial_state->hmi_level(),
- state_to_setup->hmi_level()));
+ OnHMIStateChanged(audio_app->app_id(), _, state_to_setup));
EXPECT_CALL(*audio_app_mock,
- SetRegularState(Truly(HmiStatesComparator(state_to_setup))));
- state_ctrl_->SetRegularState(media_navi_vc_app_, state_to_setup, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(state_to_setup))));
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, state_to_setup, false);
initial_state = state_to_setup;
}
}
@@ -1402,7 +1524,7 @@ TEST_F(StateControllerImplTest, MoveAudioResumeAppToValidStates) {
HmiStatePtr state_to_setup = *it;
HmiStatePtr state_to_check = state_to_setup;
// First time current state is initial, then it changes to setup state
- EXPECT_CALL(*audio_app_mock, CurrentHmiState())
+ EXPECT_CALL(*audio_app_mock, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
// Audio resume app when HMI level is LIMITED or FULL gets audible state
@@ -1423,15 +1545,15 @@ TEST_F(StateControllerImplTest, MoveAudioResumeAppToValidStates) {
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(audio_app))
.Times(AtLeast(0));
EXPECT_CALL(app_manager_mock_,
- OnHMILevelChanged(audio_app->app_id(),
- initial_state->hmi_level(),
- state_to_setup->hmi_level()))
+ OnHMIStateChanged(audio_app->app_id(), _, state_to_setup))
.Times(AtLeast(0));
// Check that we set correct state
EXPECT_CALL(*audio_app_mock,
- SetRegularState(Truly(HmiStatesComparator(state_to_check))));
- state_ctrl_->SetRegularState(media_navi_vc_app_, state_to_setup, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(state_to_check))));
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, state_to_setup, false);
initial_state = state_to_setup;
}
}
@@ -1444,11 +1566,13 @@ TEST_F(StateControllerImplTest, MoveAppFromValidStateToInvalid) {
invalid_state_it != common_invalid_states_.end();
++invalid_state_it) {
HmiStatePtr invalid_state = *invalid_state_it;
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
EXPECT_CALL(*simple_app_ptr_, is_resuming()).Times(0);
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
- state_ctrl_->SetRegularState(simple_app_, invalid_state, false);
+ EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _))
+ .Times(0);
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, invalid_state, false);
}
for (std::vector<HmiStatePtr>::iterator invalid_state_it =
@@ -1456,11 +1580,14 @@ TEST_F(StateControllerImplTest, MoveAppFromValidStateToInvalid) {
invalid_state_it != common_invalid_states_.end();
++invalid_state_it) {
HmiStatePtr invalid_state = *invalid_state_it;
- EXPECT_CALL(*media_navi_vc_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*media_navi_vc_app_ptr_, CurrentHmiState(kDefaultWindowId))
+ .Times(0);
EXPECT_CALL(*media_navi_vc_app_ptr_, is_resuming()).Times(0);
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
- EXPECT_CALL(*media_navi_vc_app_ptr_, SetRegularState(_)).Times(0);
- state_ctrl_->SetRegularState(media_navi_vc_app_, invalid_state, false);
+ EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _)).Times(0);
+ EXPECT_CALL(*media_navi_vc_app_ptr_, SetRegularState(kDefaultWindowId, _))
+ .Times(0);
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, invalid_state, false);
}
}
@@ -1475,14 +1602,14 @@ TEST_F(StateControllerImplTest,
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
app_in_full =
- ConfigureApp(&app_in_full_mock, 1761, NOT_MEDIA, NOT_NAVI, NOT_VC);
- app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1796, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&app_in_full_mock, 1761, 15685, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ app_moved_to_full = ConfigureApp(
+ &app_moved_to_full_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, NOT_VC);
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1490,7 +1617,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullNotAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest, SetFullToSimpleAppWhileAudioAppAppIsInFull) {
@@ -1507,14 +1635,15 @@ TEST_F(StateControllerImplTest, SetFullToSimpleAppWhileAudioAppAppIsInFull) {
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1533,14 +1662,15 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1549,15 +1679,15 @@ TEST_F(StateControllerImplTest,
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_in_full_mock;
am::ApplicationSharedPtr app_in_full =
- ConfigureApp(&app_in_full_mock, 1761, MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&app_in_full_mock, 1761, 15685, MEDIA, NOT_NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1796, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
+ &app_moved_to_full_mock, 1796, 30093, MEDIA, NOT_NAVI, NOT_VC);
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1565,7 +1695,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1575,15 +1706,15 @@ TEST_F(StateControllerImplTest,
NiceMock<application_manager_test::MockApplication>* app_in_limited_mock;
am::ApplicationSharedPtr app_in_limited =
- ConfigureApp(&app_in_limited_mock, 1761, NOT_MEDIA, NAVI, NOT_VC);
+ ConfigureApp(&app_in_limited_mock, 1761, 15685, NOT_MEDIA, NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1796, NOT_MEDIA, NAVI, VC);
+ ConfigureApp(&app_moved_to_full_mock, 1796, 30093, NOT_MEDIA, NAVI, VC);
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1591,7 +1722,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1600,17 +1732,17 @@ TEST_F(StateControllerImplTest,
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_in_limited_mock;
am::ApplicationSharedPtr app_in_limited =
- ConfigureApp(&app_in_limited_mock, 1761, NOT_MEDIA, NOT_NAVI, VC);
+ ConfigureApp(&app_in_limited_mock, 1761, 15685, NOT_MEDIA, NOT_NAVI, VC);
NiceMock<application_manager_test::MockApplication>*
app_moved_to_limited_mock;
- am::ApplicationSharedPtr app_moved_to_limited =
- ConfigureApp(&app_moved_to_limited_mock, 1796, NOT_MEDIA, NOT_NAVI, VC);
+ am::ApplicationSharedPtr app_moved_to_limited = ConfigureApp(
+ &app_moved_to_limited_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, VC);
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ ExpectSuccessfulSetHmiState(app_moved_to_limited,
app_moved_to_limited_mock,
BackgroundState(),
LimitedState());
@@ -1618,7 +1750,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_limited, kDefaultWindowId, LimitedState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1636,14 +1769,15 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ ExpectSuccessfulSetHmiState(app_moved_to_limited,
app_moved_to_limited_mock,
BackgroundState(),
LimitedState());
ExpectAppWontChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_limited, kDefaultWindowId, LimitedState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1662,14 +1796,15 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_full);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ ExpectSuccessfulSetHmiState(app_moved_to_limited,
app_moved_to_limited_mock,
BackgroundState(),
LimitedState());
ExpectAppWontChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState());
- state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_limited, kDefaultWindowId, LimitedState(), false);
}
TEST_F(StateControllerImplTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
@@ -1693,7 +1828,7 @@ TEST_F(StateControllerImplTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
InsertApplication(limited_app1);
InsertApplication(limited_app2);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1703,7 +1838,8 @@ TEST_F(StateControllerImplTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
ExpectAppWontChangeHmiStateDueToConflictResolving(
limited_app2, limited_app2_mock, LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1728,7 +1864,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1739,7 +1875,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1749,8 +1886,8 @@ TEST_F(StateControllerImplTest,
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1761, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
+ &app_moved_to_full_mock, 1761, 15685, NOT_MEDIA, NOT_NAVI, NOT_VC);
am::ApplicationSharedPtr limited_app = media_app_;
NiceMock<application_manager_test::MockApplication>* limited_app_mock =
@@ -1758,13 +1895,13 @@ TEST_F(StateControllerImplTest,
NiceMock<application_manager_test::MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
- ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&full_app_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, NOT_VC);
InsertApplication(app_moved_to_full);
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1775,7 +1912,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullNotAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(
@@ -1786,22 +1924,22 @@ TEST_F(
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1761, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
+ &app_moved_to_full_mock, 1761, 15685, MEDIA, NOT_NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* limited_app_mock;
am::ApplicationSharedPtr limited_app =
- ConfigureApp(&limited_app_mock, 1762, MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&limited_app_mock, 1762, 17559, MEDIA, NOT_NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
- ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&full_app_mock, 1796, 30093, NOT_MEDIA, NOT_NAVI, NOT_VC);
InsertApplication(app_moved_to_full);
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1812,7 +1950,8 @@ TEST_F(
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullNotAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(
@@ -1823,22 +1962,22 @@ TEST_F(
namespace SystemContext = mobile_apis::SystemContext;
NiceMock<application_manager_test::MockApplication>* app_moved_to_full_mock;
- am::ApplicationSharedPtr app_moved_to_full =
- ConfigureApp(&app_moved_to_full_mock, 1761, MEDIA, NOT_NAVI, NOT_VC);
+ am::ApplicationSharedPtr app_moved_to_full = ConfigureApp(
+ &app_moved_to_full_mock, 1761, 15685, MEDIA, NOT_NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* limited_app_mock;
am::ApplicationSharedPtr limited_app =
- ConfigureApp(&limited_app_mock, 1762, MEDIA, NOT_NAVI, NOT_VC);
+ ConfigureApp(&limited_app_mock, 1762, 17559, MEDIA, NOT_NAVI, NOT_VC);
NiceMock<application_manager_test::MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
- ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NAVI, NOT_VC);
+ ConfigureApp(&full_app_mock, 1796, 30093, NOT_MEDIA, NAVI, NOT_VC);
InsertApplication(app_moved_to_full);
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1849,7 +1988,8 @@ TEST_F(
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1862,19 +2002,20 @@ TEST_F(StateControllerImplTest,
InsertApplication(media_app_);
InsertApplication(navi_app_);
InsertApplication(vc_app_);
- ExpectSuccesfullSetHmiState(media_navi_vc_app_,
+ ExpectSuccessfulSetHmiState(media_navi_vc_app_,
media_navi_vc_app_ptr_,
BackgroundState(),
FullAudibleState());
- EXPECT_CALL(*media_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(LimitedState()));
ExpectAppChangeHmiStateDueToConflictResolving(
navi_app_, navi_app_ptr_, LimitedState(), BackgroundState());
ExpectAppChangeHmiStateDueToConflictResolving(
vc_app_, vc_app_ptr_, LimitedState(), BackgroundState());
- state_ctrl_->SetRegularState(media_navi_vc_app_, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1887,19 +2028,20 @@ TEST_F(StateControllerImplTest,
InsertApplication(media_app_);
InsertApplication(navi_app_);
InsertApplication(vc_app_);
- ExpectSuccesfullSetHmiState(media_navi_vc_app_,
+ ExpectSuccessfulSetHmiState(media_navi_vc_app_,
media_navi_vc_app_ptr_,
BackgroundState(),
FullAudibleState());
- EXPECT_CALL(*media_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(LimitedState()));
ExpectAppChangeHmiStateDueToConflictResolving(
navi_app_, navi_app_ptr_, LimitedState(), BackgroundState());
ExpectAppChangeHmiStateDueToConflictResolving(
vc_app_, vc_app_ptr_, FullAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(media_navi_vc_app_, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, FullAudibleState(), false);
}
// TODO {AKozoriz} Changed logic in state_controller
@@ -1919,17 +2061,11 @@ TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) {
StateLevelPair(LimitedState(), Common_HMILevel::LIMITED));
hmi_states.push_back(
StateLevelPair(BackgroundState(), Common_HMILevel::BACKGROUND));
- hmi_states.push_back(
- StateLevelPair(createHmiState(HMILevel::HMI_NONE,
- AudioStreamingState::NOT_AUDIBLE,
- VideoStreamingState::NOT_STREAMABLE,
- SystemContext::SYSCTXT_MAIN),
- Common_HMILevel::NONE));
std::vector<StateLevelPair> initial_hmi_states = hmi_states;
std::vector<StateLevelPair>::iterator it = hmi_states.begin();
std::vector<StateLevelPair>::iterator it2 = initial_hmi_states.begin();
smart_objects::SmartObjectSPtr bc_activate_app_request =
- new smart_objects::SmartObject();
+ std::make_shared<smart_objects::SmartObject>();
(*bc_activate_app_request)[am::strings::params][am::strings::correlation_id] =
corr_id;
@@ -1941,16 +2077,16 @@ TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) {
SetBCActivateAppRequestToHMI(hmi_level, corr_id);
ON_CALL(app_manager_mock_, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
- ON_CALL(mock_rpc_service_, ManageHMICommand(bc_activate_app_request))
+ ON_CALL(mock_rpc_service_, ManageHMICommand(bc_activate_app_request, _))
.WillByDefault(Return(true));
EXPECT_CALL(app_manager_mock_, application_id(corr_id))
.WillOnce(Return(hmi_app_id));
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
.WillOnce(Return(media_app_));
- ExpectSuccesfullSetHmiState(
+ ExpectSuccessfulSetHmiState(
media_app_, media_app_ptr_, initial_hmi_state, hmi_state);
- state_ctrl_->SetRegularState(media_app_, hmi_state, true);
+ state_ctrl_->SetRegularState(media_app_, kDefaultWindowId, hmi_state, true);
smart_objects::SmartObject message;
message[am::strings::params][am::hmi_response::code] =
Common_Result::SUCCESS;
@@ -2006,14 +2142,16 @@ TEST_F(StateControllerImplTest, SendEventBCActivateApp_HMIReceivesError) {
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
.WillOnce(Return(simple_app_));
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _))
+ .Times(0);
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
.Times(0);
EXPECT_CALL(app_manager_mock_,
- OnHMILevelChanged(simple_app_->app_id(), _, _)).Times(0);
+ OnHMIStateChanged(simple_app_->app_id(), _, _))
+ .Times(0);
smart_objects::SmartObject message;
message[am::strings::params][am::hmi_response::code] = *it;
@@ -2033,13 +2171,14 @@ TEST_F(StateControllerImplTest, ActivateAppInvalidCorrelationId) {
.WillOnce(Return(hmi_app_id));
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
.WillOnce(Return(am::ApplicationSharedPtr()));
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
.Times(0);
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(simple_app_->app_id(), _, _))
+ EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(simple_app_->app_id(), _, _))
.Times(0);
SetBCActivateAppRequestToHMI(Common_HMILevel::FULL, corr_id);
- state_ctrl_->SetRegularState(simple_app_, FullNotAudibleState(), true);
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, FullNotAudibleState(), true);
smart_objects::SmartObject message;
message[am::strings::params][am::hmi_response::code] = Common_Result::SUCCESS;
message[am::strings::params][am::strings::correlation_id] = corr_id;
@@ -2096,7 +2235,7 @@ TEST_F(StateControllerImplTest, ApplyTempStatesForMediaNaviVCApp) {
TEST_F(StateControllerImplTest, SetStatePhoneCallForNonMediaApplication) {
am::HmiStatePtr state_phone_call =
- utils::MakeShared<am::PhoneCallHmiState>(simple_app_, app_manager_mock_);
+ std::make_shared<am::PhoneCallHmiState>(simple_app_, app_manager_mock_);
TestSetState(simple_app_,
state_phone_call,
APP_TYPE_NON_MEDIA,
@@ -2105,7 +2244,7 @@ TEST_F(StateControllerImplTest, SetStatePhoneCallForNonMediaApplication) {
TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaApplication) {
am::HmiStatePtr state_phone_call =
- utils::MakeShared<am::PhoneCallHmiState>(media_app_, app_manager_mock_);
+ std::make_shared<am::PhoneCallHmiState>(media_app_, app_manager_mock_);
TestSetState(media_app_,
state_phone_call,
APP_TYPE_MEDIA,
@@ -2113,7 +2252,7 @@ TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaApplication) {
}
TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaNaviApplication) {
- am::HmiStatePtr state_phone_call = utils::MakeShared<am::PhoneCallHmiState>(
+ am::HmiStatePtr state_phone_call = std::make_shared<am::PhoneCallHmiState>(
media_navi_app_, app_manager_mock_);
TestSetState(media_navi_app_,
state_phone_call,
@@ -2123,7 +2262,7 @@ TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaNaviApplication) {
TEST_F(StateControllerImplTest, SetVRStateForNonMediaApplication) {
am::HmiStatePtr state_vr =
- utils::MakeShared<am::VRHmiState>(simple_app_, app_manager_mock_);
+ std::make_shared<am::VRHmiState>(simple_app_, app_manager_mock_);
TestSetState(simple_app_,
state_vr,
APP_TYPE_NON_MEDIA,
@@ -2132,7 +2271,7 @@ TEST_F(StateControllerImplTest, SetVRStateForNonMediaApplication) {
TEST_F(StateControllerImplTest, SetVRStateForMediaApplication) {
am::HmiStatePtr state_vr =
- utils::MakeShared<am::VRHmiState>(media_app_, app_manager_mock_);
+ std::make_shared<am::VRHmiState>(media_app_, app_manager_mock_);
TestSetState(media_app_,
state_vr,
APP_TYPE_MEDIA,
@@ -2141,7 +2280,7 @@ TEST_F(StateControllerImplTest, SetVRStateForMediaApplication) {
TEST_F(StateControllerImplTest, SetVRStateForMediaNaviVoiceApplication) {
am::HmiStatePtr state_vr =
- utils::MakeShared<am::VRHmiState>(media_navi_vc_app_, app_manager_mock_);
+ std::make_shared<am::VRHmiState>(media_navi_vc_app_, app_manager_mock_);
TestSetState(media_navi_vc_app_,
state_vr,
APP_TYPE_MEDIA,
@@ -2151,7 +2290,7 @@ TEST_F(StateControllerImplTest, SetVRStateForMediaNaviVoiceApplication) {
TEST_F(StateControllerImplTest,
SetTTSStateForNonMediaApplicationAttenuatedNotSupported) {
am::HmiStatePtr state_tts =
- utils::MakeShared<am::TTSHmiState>(simple_app_, app_manager_mock_);
+ std::make_shared<am::TTSHmiState>(simple_app_, app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(false));
TestSetState(simple_app_,
@@ -2163,7 +2302,7 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest,
SetTTSStateForNonMediaApplicationAttenuatedSupported) {
am::HmiStatePtr state_tts =
- utils::MakeShared<am::TTSHmiState>(simple_app_, app_manager_mock_);
+ std::make_shared<am::TTSHmiState>(simple_app_, app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(true));
TestSetState(simple_app_,
@@ -2175,7 +2314,7 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest,
SetTTSStateForMediaApplicationAttenuatedNotSupported) {
am::HmiStatePtr state_tts =
- utils::MakeShared<am::TTSHmiState>(media_app_, app_manager_mock_);
+ std::make_shared<am::TTSHmiState>(media_app_, app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(false));
TestSetState(media_app_,
@@ -2187,7 +2326,7 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest,
SetTTSStateForMediaApplicationAttenuatedSupported) {
am::HmiStatePtr state_tts =
- utils::MakeShared<am::TTSHmiState>(media_app_, app_manager_mock_);
+ std::make_shared<am::TTSHmiState>(media_app_, app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(true));
TestSetState(media_app_,
@@ -2199,7 +2338,7 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest,
SetTTSStateForMediaNaviVCApplicationAttenuatedNotSupported) {
am::HmiStatePtr state_tts =
- utils::MakeShared<am::TTSHmiState>(media_navi_vc_app_, app_manager_mock_);
+ std::make_shared<am::TTSHmiState>(media_navi_vc_app_, app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(false));
TestSetState(media_navi_vc_app_,
@@ -2211,7 +2350,7 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest,
SetTTSStateForMediaNaviVCApplicationAttenuatedSupported) {
am::HmiStatePtr state_tts =
- utils::MakeShared<am::TTSHmiState>(media_navi_vc_app_, app_manager_mock_);
+ std::make_shared<am::TTSHmiState>(media_navi_vc_app_, app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(true));
TestSetState(media_navi_vc_app_,
@@ -2222,8 +2361,8 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest, SetNaviStreamingStateForNonMediaApplication) {
am::HmiStatePtr state_navi_streming =
- utils::MakeShared<am::VideoStreamingHmiState>(simple_app_,
- app_manager_mock_);
+ std::make_shared<am::VideoStreamingHmiState>(simple_app_,
+ app_manager_mock_);
TestSetState(simple_app_,
state_navi_streming,
APP_TYPE_NON_MEDIA,
@@ -2233,8 +2372,8 @@ TEST_F(StateControllerImplTest, SetNaviStreamingStateForNonMediaApplication) {
TEST_F(StateControllerImplTest,
DISABLED_SetNaviStreamingStateMediaApplicationAttenuatedNotSupported) {
am::HmiStatePtr state_navi_streming =
- utils::MakeShared<am::VideoStreamingHmiState>(media_app_,
- app_manager_mock_);
+ std::make_shared<am::VideoStreamingHmiState>(media_app_,
+ app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(false));
TestSetState(media_app_,
@@ -2246,8 +2385,8 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest,
DISABLED_SetNaviStreamingStateMediaApplicationAttenuatedSupported) {
am::HmiStatePtr state_navi_streming =
- utils::MakeShared<am::VideoStreamingHmiState>(media_app_,
- app_manager_mock_);
+ std::make_shared<am::VideoStreamingHmiState>(media_app_,
+ app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(true));
TestSetState(media_app_,
@@ -2259,7 +2398,7 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest,
DISABLED_SetNaviStreamingStateVCApplicationAttenuatedNotSupported) {
am::HmiStatePtr state_navi_streming =
- utils::MakeShared<am::VideoStreamingHmiState>(vc_app_, app_manager_mock_);
+ std::make_shared<am::VideoStreamingHmiState>(vc_app_, app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(false));
TestSetState(vc_app_,
@@ -2271,7 +2410,7 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest,
DISABLED_SetNaviStreamingStateVCApplicationAttenuatedSupported) {
am::HmiStatePtr state_navi_streming =
- utils::MakeShared<am::VideoStreamingHmiState>(vc_app_, app_manager_mock_);
+ std::make_shared<am::VideoStreamingHmiState>(vc_app_, app_manager_mock_);
EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
.WillRepeatedly(Return(true));
TestSetState(vc_app_,
@@ -2282,8 +2421,8 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest, DISABLED_SetNaviStreamingStateNaviApplication) {
am::HmiStatePtr state_navi_streming =
- utils::MakeShared<am::VideoStreamingHmiState>(navi_app_,
- app_manager_mock_);
+ std::make_shared<am::VideoStreamingHmiState>(navi_app_,
+ app_manager_mock_);
TestSetState(navi_app_,
state_navi_streming,
APP_TYPE_NAVI,
@@ -2293,8 +2432,8 @@ TEST_F(StateControllerImplTest, DISABLED_SetNaviStreamingStateNaviApplication) {
TEST_F(StateControllerImplTest,
DISABLED_SetNaviStreamingStateMediaNaviApplication) {
am::HmiStatePtr state_navi_streming =
- utils::MakeShared<am::VideoStreamingHmiState>(media_navi_app_,
- app_manager_mock_);
+ std::make_shared<am::VideoStreamingHmiState>(media_navi_app_,
+ app_manager_mock_);
TestSetState(media_navi_app_,
state_navi_streming,
APP_TYPE_NAVI,
@@ -2303,7 +2442,7 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest, SetSafetyModeStateForNonMediaApplication) {
am::HmiStatePtr state_safety_mode =
- utils::MakeShared<am::SafetyModeHmiState>(simple_app_, app_manager_mock_);
+ std::make_shared<am::SafetyModeHmiState>(simple_app_, app_manager_mock_);
TestSetState(simple_app_,
state_safety_mode,
APP_TYPE_NON_MEDIA,
@@ -2312,7 +2451,7 @@ TEST_F(StateControllerImplTest, SetSafetyModeStateForNonMediaApplication) {
TEST_F(StateControllerImplTest, SetSafetyModeStateForMediaApplication) {
am::HmiStatePtr state_safety_mode =
- utils::MakeShared<am::VRHmiState>(media_app_, app_manager_mock_);
+ std::make_shared<am::VRHmiState>(media_app_, app_manager_mock_);
TestSetState(media_app_,
state_safety_mode,
APP_TYPE_MEDIA,
@@ -2322,7 +2461,7 @@ TEST_F(StateControllerImplTest, SetSafetyModeStateForMediaApplication) {
TEST_F(StateControllerImplTest,
SetSafetyModeStateForMediaNaviVoiceApplication) {
am::HmiStatePtr state_safety_mode =
- utils::MakeShared<am::VRHmiState>(media_navi_vc_app_, app_manager_mock_);
+ std::make_shared<am::VRHmiState>(media_navi_vc_app_, app_manager_mock_);
TestSetState(media_navi_vc_app_,
state_safety_mode,
APP_TYPE_MEDIA,
@@ -2463,45 +2602,52 @@ TEST_F(StateControllerImplTest,
TEST_F(StateControllerImplTest, SetRegularStateWithNewHmiLvl) {
using namespace mobile_apis;
+ auto message = CreateCloseAppMessage();
+ ON_CALL(message_helper_mock_, GetBCCloseApplicationRequestToHMI(_, _))
+ .WillByDefault(Return(message));
+ ON_CALL(app_manager_mock_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ ON_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillByDefault(Return(true));
+
+ ON_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillByDefault(Return(NoneNotAudibleState()));
+ ON_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
+ .WillByDefault(Return(NoneNotAudibleState()));
HMILevel::eType set_lvl = HMILevel::HMI_NONE;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
- .WillOnce(Return(BackgroundState()));
-
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
- .WillOnce(Return(BackgroundState()))
- .WillOnce(Return(BackgroundState()));
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
set_lvl = HMILevel::HMI_LIMITED;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
set_lvl = HMILevel::HMI_FULL;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()));
const uint32_t corr_id = 314;
SetBCActivateAppRequestToHMI(
static_cast<hmi_apis::Common_HMILevel::eType>(set_lvl), corr_id);
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
set_lvl = HMILevel::HMI_BACKGROUND;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
}
TEST_F(StateControllerImplTest, SetRegularStateWithAudioStateAudible) {
@@ -2511,16 +2657,18 @@ TEST_F(StateControllerImplTest, SetRegularStateWithAudioStateAudible) {
AudioStreamingState::AUDIBLE,
VideoStreamingState::STREAMABLE,
SystemContext::SYSCTXT_MAIN);
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillRepeatedly(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(check_state))
.WillOnce(Return(check_state));
EXPECT_CALL(*simple_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(check_state))));
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
state_ctrl_->SetRegularState(simple_app_,
+ kDefaultWindowId,
AudioStreamingState::AUDIBLE,
VideoStreamingState::STREAMABLE);
}
@@ -2537,23 +2685,27 @@ TEST_F(StateControllerImplTest,
// Non-media app can't have LIMITED-AUDIO state
EXPECT_CALL(*simple_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(app_manager_mock_, GetDefaultHmiLevel(_))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
EXPECT_CALL(*simple_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(simple_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, check_state, false);
check_state = LimitedState();
EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*media_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*media_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
@@ -2570,25 +2722,29 @@ TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
HmiStatePtr check_state = FullNotAudibleState();
// Non-media app can't have LIMITED-AUDIO state
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(check_state))
.WillOnce(Return(check_state));
EXPECT_CALL(*simple_app_ptr_, is_resuming()).WillRepeatedly(Return(false));
EXPECT_CALL(message_helper_mock_,
- SendOnResumeAudioSourceToHMI(simple_app_id_, _)).Times(0);
+ SendOnResumeAudioSourceToHMI(simple_app_id_, _))
+ .Times(0);
EXPECT_CALL(*simple_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))))
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))))
.Times(0);
EXPECT_CALL(*simple_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(simple_app_, check_state, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, check_state, false);
// Set state of media app after vr has stopped
check_state = LimitedState();
- EXPECT_CALL(*media_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(check_state))
.WillOnce(Return(check_state));
@@ -2597,11 +2753,14 @@ TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
EXPECT_CALL(message_helper_mock_,
SendOnResumeAudioSourceToHMI(media_app_id_, _));
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))))
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))))
.Times(0);
EXPECT_CALL(*media_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2624,28 +2783,32 @@ TEST_F(StateControllerImplTest,
HmiStatePtr check_state = FullNotAudibleState();
EXPECT_CALL(*simple_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(app_manager_mock_, GetDefaultHmiLevel(_))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
EXPECT_CALL(*simple_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(simple_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, check_state, false);
// Set media app
check_state = LimitedState();
EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*media_app_ptr_, RegularHmiState()).Times(0);
- EXPECT_CALL(*media_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*media_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2678,8 +2841,10 @@ TEST_F(StateControllerImplTest,
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2707,13 +2872,13 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- state_ctrl_->SetRegularState(navi_app_, hmi_state, false);
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2741,15 +2906,15 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- EXPECT_CALL(*navi_app_ptr_, SetPostponedState(_)).Times(0);
+ EXPECT_CALL(*navi_app_ptr_, SetPostponedState(kDefaultWindowId, _)).Times(0);
- state_ctrl_->SetRegularState(navi_app_, hmi_state, false);
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2757,7 +2922,6 @@ TEST_F(StateControllerImplTest,
using namespace hmi_apis;
using namespace smart_objects;
using namespace am::event_engine;
- using namespace constants;
const uint32_t app_id = navi_app_->app_id();
// Precondition
@@ -2781,13 +2945,13 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- state_ctrl_->SetRegularState(navi_app_, hmi_state, true);
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, true);
}
TEST_F(StateControllerImplTest,
@@ -2795,7 +2959,6 @@ TEST_F(StateControllerImplTest,
using namespace hmi_apis;
using namespace smart_objects;
using namespace am::event_engine;
- using namespace constants;
const uint32_t app_id = navi_app_->app_id();
// Precondition
@@ -2819,15 +2982,84 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- EXPECT_CALL(*navi_app_ptr_, SetPostponedState(_)).Times(0);
+ EXPECT_CALL(*navi_app_ptr_, SetPostponedState(kDefaultWindowId, _)).Times(0);
+
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, true);
+}
+
+TEST_F(StateControllerImplTest,
+ OnEventChangedAudioSource_KeepContext_AppRemainInFull) {
+ const uint32_t app_id = simple_app_->app_id();
+ InsertApplication(simple_app_);
+ smart_objects::SmartObject msg;
+ msg[am::strings::msg_params][am::strings::app_id] = app_id;
+ msg[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ msg[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::AUDIO_SOURCE;
+
+ const hmi_apis::FunctionID::eType event_id =
+ hmi_apis::FunctionID::BasicCommunication_OnEventChanged;
+ am::event_engine::Event event(event_id);
+ event.set_smart_object(msg);
+
+ EXPECT_CALL(*simple_app_ptr_, keep_context()).WillOnce(Return(true));
+ EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
+ .WillOnce(Return(FullAudibleState()));
+ EXPECT_CALL(*simple_app_ptr_, set_keep_context(false));
+
+ HmiStatePtr new_state;
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _))
+ .WillOnce(SaveArg<1>(&new_state));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
+ state_ctrl_->on_event(event);
+
+ EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_FULL);
+ EXPECT_EQ(new_state->audio_streaming_state(),
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE);
+}
+
+TEST_F(StateControllerImplTest, OnEventChangedAudioSourceAppToBackground) {
+ const uint32_t app_id = simple_app_->app_id();
+ InsertApplication(simple_app_);
+ smart_objects::SmartObject msg;
+ msg[am::strings::msg_params][am::strings::app_id] = app_id;
+ msg[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ msg[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::AUDIO_SOURCE;
+
+ const hmi_apis::FunctionID::eType event_id =
+ hmi_apis::FunctionID::BasicCommunication_OnEventChanged;
+ am::event_engine::Event event(event_id);
+ event.set_smart_object(msg);
+
+ EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
+ .WillOnce(Return(LimitedState()));
+
+ HmiStatePtr new_state;
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _))
+ .WillOnce(SaveArg<1>(&new_state));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
+ state_ctrl_->on_event(event);
- state_ctrl_->SetRegularState(navi_app_, hmi_state, true);
+ EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_BACKGROUND);
+ EXPECT_EQ(new_state->audio_streaming_state(),
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE);
}
TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectHmiLevel) {
@@ -2840,9 +3072,13 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectHmiLevel) {
event.set_smart_object(msg);
EXPECT_CALL(app_manager_mock_, application(app_id))
.WillOnce(Return(simple_app_));
- EXPECT_CALL(*simple_app_ptr_, hmi_level())
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
state_ctrl_->on_event(event);
}
@@ -2856,7 +3092,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectApp) {
const am::ApplicationSharedPtr incorrect_app;
EXPECT_CALL(app_manager_mock_, application(_))
.WillOnce(Return(incorrect_app));
- EXPECT_CALL(*simple_app_ptr_, hmi_level()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId)).Times(0);
state_ctrl_->on_event(event);
}
@@ -2877,15 +3113,20 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedAudioApplication) {
EXPECT_CALL(app_manager_mock_, application(app_id))
.WillOnce(Return(simple_app_));
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, hmi_level())
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
// DeactivateApp
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(state));
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(state));
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
state_ctrl_->on_event(event);
}
@@ -2906,16 +3147,21 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedNotAudioApplication) {
EXPECT_CALL(app_manager_mock_, application(app_id))
.WillOnce(Return(simple_app_));
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, hmi_level())
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
// DeactivateApp
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(state));
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(state));
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(false));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
state_ctrl_->on_event(event);
}
@@ -2935,28 +3181,38 @@ TEST_F(StateControllerImplTest, OnEventOnAppActivatedIncorrectApp) {
}
TEST_F(StateControllerImplTest, OnEventOnAppActivated) {
- using namespace constants;
-
smart_objects::SmartObject msg;
- for (std::vector<am::ApplicationSharedPtr>::const_iterator it =
- applications_list_.begin();
+ am::WindowIds window_ids = {kDefaultWindowId};
+
+ for (AppPtrMockMapping::const_iterator it = applications_list_.begin();
it != applications_list_.end();
++it) {
- uint32_t app_id = (*it)->app_id();
+ uint32_t app_id = it->first->app_id();
msg[am::strings::msg_params][am::strings::app_id] = app_id;
const hmi_apis::FunctionID::eType event_id =
hmi_apis::FunctionID::BasicCommunication_OnAppActivated;
am::event_engine::Event event(event_id);
event.set_smart_object(msg);
- EXPECT_CALL(app_manager_mock_, application(app_id)).WillOnce(Return(*it));
+ EXPECT_CALL(app_manager_mock_, application(app_id))
+ .WillOnce(Return(it->first));
// SetRegularState
- EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
- .WillRepeatedly(Return(true));
+ EXPECT_CALL(*it->second, app_id()).WillRepeatedly(Return(app_id));
+ EXPECT_CALL(*it->second, IsAudioApplication()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*it->second, GetWindowIds()).WillOnce(Return(window_ids));
+
+ const am::HmiStatePtr old_state =
+ CreateHmiStateByHmiStateType<am::HmiState>(
+ mobile_apis::HMILevel::HMI_NONE,
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE,
+ mobile_apis::VideoStreamingState::NOT_STREAMABLE,
+ mobile_apis::SystemContext::SYSCTXT_MAIN,
+ simple_app_);
+ EXPECT_CALL(*it->second, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
smart_objects::SmartObjectSPtr activate_app =
- utils::MakeShared<smart_objects::SmartObject>();
+ std::make_shared<smart_objects::SmartObject>();
(*activate_app)[am::strings::params][am::strings::correlation_id] = kCorrID;
SetBCActivateAppRequestToHMI(hmi_apis::Common_HMILevel::FULL, kCorrID);
state_ctrl_->on_event(event);
@@ -3034,9 +3290,9 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) {
simple_app_);
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(old_state));
- EXPECT_CALL(*simple_app_ptr_, AddHMIState(_)).Times(4);
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _)).Times(4);
const am::HmiStatePtr default_state =
CreateHmiStateByHmiStateType<am::HmiState>(
@@ -3046,13 +3302,15 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) {
mobile_apis::SystemContext::SYSCTXT_MAIN,
simple_app_);
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(old_state));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(default_state));
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_));
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
+ EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _));
state_ctrl_->OnApplicationRegistered(simple_app_,
mobile_apis::HMILevel::HMI_BACKGROUND);
@@ -3085,9 +3343,9 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) {
simple_app_);
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(old_state));
- EXPECT_CALL(*simple_app_ptr_, AddHMIState(_)).Times(2);
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _)).Times(2);
const am::HmiStatePtr default_state =
CreateHmiStateByHmiStateType<am::HmiState>(
@@ -3096,19 +3354,341 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) {
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
mobile_apis::SystemContext::SYSCTXT_MAIN,
simple_app_);
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(default_state));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(default_state));
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_)).Times(0);
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
+ EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _)).Times(0);
state_ctrl_->OnApplicationRegistered(simple_app_,
mobile_apis::HMILevel::HMI_BACKGROUND);
}
+TEST_F(
+ StateControllerImplTest,
+ SetRegularState_AppIsResumingAndAudioSourceIsActive_HmiStateIsNotChanged) {
+ am::event_engine::Event audio_source_event(
+ hmi_apis::FunctionID::BasicCommunication_OnEventChanged);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::AUDIO_SOURCE;
+ audio_source_event.set_smart_object(message);
+ state_ctrl_->on_event(audio_source_event);
+
+ EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*media_app_ptr_, SetRegularState(_, _)).Times(0);
+
+ const am::HmiStatePtr new_state = FullAudibleState();
+ const bool send_activate_app = true;
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, new_state, send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_BcActivateAppSendFailed_HmiLevelIsNotChanged) {
+ const am::HmiStatePtr new_state = FullAudibleState();
+ SetBCActivateAppRequestToHMI(
+ static_cast<hmi_apis::Common_HMILevel::eType>(new_state->hmi_level()),
+ kCorrID);
+
+ smart_objects::SmartObjectSPtr bc_activate_app_request;
+ EXPECT_CALL(message_helper_mock_, GetBCActivateAppRequestToHMI(_, _, _, _, _))
+ .WillOnce(Return(bc_activate_app_request));
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(_, _)).Times(0);
+
+ const bool send_activate_app = true;
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, new_state, send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_SetLevelAudioAndVideoState_HmiStateIsChanged) {
+ HmiStatePtr old_state = NoneNotAudibleState();
+ HmiStatePtr new_state = BackgroundState();
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, old_state, new_state);
+
+ const bool send_activate_app = false;
+ state_ctrl_->SetRegularState(simple_app_,
+ kDefaultWindowId,
+ new_state->hmi_level(),
+ new_state->audio_streaming_state(),
+ new_state->video_streaming_state(),
+ send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_SetLevelAudioVideoStatesAndContext_HmiStateIsChanged) {
+ HmiStatePtr old_state = NoneNotAudibleState();
+ HmiStatePtr new_state = BackgroundState();
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, old_state, new_state);
+
+ const bool send_activate_app = false;
+ state_ctrl_->SetRegularState(simple_app_,
+ kDefaultWindowId,
+ new_state->hmi_level(),
+ new_state->audio_streaming_state(),
+ new_state->video_streaming_state(),
+ new_state->system_context(),
+ send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_SetSystemContextOnly_HmiStateIsChanged) {
+ HmiStatePtr old_state = FullAudibleState();
+ HmiStatePtr new_state = FullNotAudibleState();
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, old_state, new_state);
+
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, new_state->system_context());
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppActivated_ActivateNotExistingWindow_HmiLevelIsNotChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppActivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ ExpectAppWontChangeHmiStateDueToConflictResolving(
+ simple_app_, simple_app_ptr_, kCustomWindowId, NoneNotAudibleState());
+
+ state_ctrl_->on_event(activate_widget_event);
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppActivated_ActivateCustomWindow_HmiStateIsChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppActivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ std::vector<std::pair<HmiStatePtr, HmiStatePtr> > states_transition = {
+ std::make_pair(NoneNotAudibleState(), BackgroundState()),
+ std::make_pair(BackgroundState(), FullNotAudibleState())};
+
+ for (auto& states_pair : states_transition) {
+ HmiStatePtr old_state = states_pair.first;
+ HmiStatePtr new_state = states_pair.second;
+
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kCustomWindowId))
+ .WillOnce(Return(old_state->hmi_level()));
+ EXPECT_CALL(*simple_app_ptr_, audio_streaming_state())
+ .WillOnce(Return(old_state->audio_streaming_state()));
+ EXPECT_CALL(*simple_app_ptr_, video_streaming_state())
+ .WillOnce(Return(old_state->video_streaming_state()));
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, kCustomWindowId, old_state, new_state);
+
+ EXPECT_CALL(message_helper_mock_,
+ GetBCActivateAppRequestToHMI(_, _, _, _, _))
+ .Times(0);
+
+ state_ctrl_->on_event(activate_widget_event);
+ }
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppDeactivated_DeactivateNotExistingWindow_HmiStateIsNotChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ ExpectAppWontChangeHmiStateDueToConflictResolving(
+ simple_app_, simple_app_ptr_, kCustomWindowId, FullNotAudibleState());
+
+ state_ctrl_->on_event(activate_widget_event);
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppDeactivated_DeactivateCustomWindow_HmiStateIsChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ std::vector<std::pair<HmiStatePtr, HmiStatePtr> > states_transition = {
+ std::make_pair(FullNotAudibleState(), BackgroundState()),
+ std::make_pair(BackgroundState(), NoneNotAudibleState())};
+
+ for (auto& states_pair : states_transition) {
+ HmiStatePtr old_state = states_pair.first;
+ HmiStatePtr new_state = states_pair.second;
+
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kCustomWindowId))
+ .WillOnce(Return(old_state->hmi_level()));
+ EXPECT_CALL(*simple_app_ptr_, audio_streaming_state())
+ .WillOnce(Return(old_state->audio_streaming_state()));
+ EXPECT_CALL(*simple_app_ptr_, video_streaming_state())
+ .WillOnce(Return(old_state->video_streaming_state()));
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, kCustomWindowId, old_state, new_state);
+
+ EXPECT_CALL(message_helper_mock_,
+ GetBCActivateAppRequestToHMI(_, _, _, _, _))
+ .Times(0);
+
+ state_ctrl_->on_event(activate_widget_event);
+ }
+}
+
+TEST_F(
+ StateControllerImplTest,
+ ActivateDefaultWindow_AppWithWindowWasActivated_WindowStreamingStateIsUpdated) {
+ HmiStatePtr old_state = NoneNotAudibleState();
+ HmiStatePtr new_state = FullAudibleState();
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state))
+ .WillRepeatedly(Return(new_state));
+ ExpectSuccessfulSetHmiState(
+ media_app_, media_app_ptr_, kDefaultWindowId, old_state, new_state);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*media_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+
+ HmiStatePtr expected_window_state = NoneNotAudibleState();
+ expected_window_state->set_audio_streaming_state(
+ new_state->audio_streaming_state());
+ expected_window_state->set_video_streaming_state(
+ new_state->video_streaming_state());
+
+ EXPECT_CALL(
+ *media_app_ptr_,
+ SetRegularState(kCustomWindowId,
+ Truly(HmiStatesComparator(expected_window_state))));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(media_app_, kCustomWindowId, _));
+
+ state_ctrl_->ActivateDefaultWindow(media_app_);
+}
+
+TEST_F(StateControllerImplTest,
+ ExitDefaultWindow_AppWithWindowWasExited_WindowStreamingStateIsUpdated) {
+ HmiStatePtr old_state = FullAudibleState();
+ HmiStatePtr new_state = NoneNotAudibleState();
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state))
+ .WillRepeatedly(Return(new_state));
+ ExpectSuccessfulSetHmiState(
+ media_app_, media_app_ptr_, kDefaultWindowId, old_state, new_state);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*media_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+
+ HmiStatePtr expected_window_state = FullAudibleState();
+ expected_window_state->set_audio_streaming_state(
+ new_state->audio_streaming_state());
+ expected_window_state->set_video_streaming_state(
+ new_state->video_streaming_state());
+
+ EXPECT_CALL(
+ *media_app_ptr_,
+ SetRegularState(kCustomWindowId,
+ Truly(HmiStatesComparator(expected_window_state))));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(media_app_, kCustomWindowId, _));
+
+ state_ctrl_->ExitDefaultWindow(media_app_);
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppWindowAdded_NewAppWindowWasAdded_HmiNotificationIsSent) {
+ am::event_engine::Event audio_source_event(
+ hmi_apis::FunctionID::BasicCommunication_OnEventChanged);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::AUDIO_SOURCE;
+ audio_source_event.set_smart_object(message);
+ state_ctrl_->on_event(audio_source_event);
+
+ HmiStatePtr initial_state =
+ createHmiState(mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_apis::SystemContext::INVALID_ENUM);
+ HmiStatePtr expected_state = NoneNotAudibleState();
+
+ EXPECT_CALL(*simple_app_ptr_,
+ AddHMIState(kCustomWindowId,
+ Truly(HmiStatesIDComparator(
+ HmiState::StateID::STATE_ID_AUDIO_SOURCE))));
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(initial_state));
+ EXPECT_CALL(*simple_app_ptr_,
+ SetRegularState(kCustomWindowId,
+ Truly(HmiStatesComparator(expected_state))));
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kCustomWindowId))
+ .WillOnce(Return(initial_state))
+ .WillOnce(Return(expected_state));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kCustomWindowId, _));
+ EXPECT_CALL(app_manager_mock_, OnHMIStateChanged(_, _, _)).Times(0);
+
+ state_ctrl_->OnAppWindowAdded(simple_app_,
+ kCustomWindowId,
+ mobile_apis::WindowType::WIDGET,
+ mobile_apis::HMILevel::HMI_NONE);
+}
+
} // namespace state_controller_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/usage_statistics_test.cc b/src/components/application_manager/test/usage_statistics_test.cc
index 6efef83052..b494afb68e 100644
--- a/src/components/application_manager/test/usage_statistics_test.cc
+++ b/src/components/application_manager/test/usage_statistics_test.cc
@@ -33,19 +33,17 @@
#include "application_manager/usage_statistics.h"
#include <memory>
#include "gmock/gmock.h"
-#include "smart_objects/enum_schema_item.h"
-#include "policy/usage_statistics/mock_statistics_manager.h"
#include "policy/usage_statistics/mock_app_stopwatch.h"
-#include "utils/make_shared.h"
-#include "utils/shared_ptr.h"
+#include "policy/usage_statistics/mock_statistics_manager.h"
+#include "smart_objects/enum_schema_item.h"
namespace test {
namespace components {
namespace usage_statistics_test {
-using namespace mobile_apis; // For Language enums
-using namespace NsSmartDeviceLink::NsSmartObjects; // For EnumToCString &
- // EnumConversionHelper
+using namespace mobile_apis; // For Language enums
+using namespace ns_smart_device_link::ns_smart_objects; // For EnumToCString &
+ // EnumConversionHelper
using namespace usage_statistics;
using testing::_;
@@ -69,23 +67,22 @@ const std::string kAppId = "SPT";
class UsageStatisticsTest : public testing::Test {
public:
UsageStatisticsTest()
- : mock_statistics_manager_sptr_(
- utils::MakeShared<MockStatisticsManager>())
+ : mock_statistics_manager_sptr_(std::make_shared<MockStatisticsManager>())
, usage_statistics_test_object1_sptr_(
new application_manager::UsageStatistics(
kAppId, mock_statistics_manager_sptr_))
, language_(LanguageIdToString(kTestLanguageId)) {}
protected:
- utils::SharedPtr<MockStatisticsManager> mock_statistics_manager_sptr_;
- std::auto_ptr<application_manager::UsageStatistics>
+ std::shared_ptr<MockStatisticsManager> mock_statistics_manager_sptr_;
+ std::unique_ptr<application_manager::UsageStatistics>
usage_statistics_test_object1_sptr_;
const std::string language_;
};
TEST_F(UsageStatisticsTest, RecordHmiStateChanged_CallMethod_ExpectMethodCall) {
// Arrange
- std::auto_ptr<MockAppStopwatch> mock_app_stopwatch_object(
+ std::unique_ptr<MockAppStopwatch> mock_app_stopwatch_object(
new MockAppStopwatch);
// Checks
@@ -93,7 +90,7 @@ TEST_F(UsageStatisticsTest, RecordHmiStateChanged_CallMethod_ExpectMethodCall) {
EXPECT_CALL(*mock_app_stopwatch_object, Switch(kTestAppStopwatchId));
// Act
- std::auto_ptr<application_manager::UsageStatistics>
+ std::unique_ptr<application_manager::UsageStatistics>
usage_statistics_test_object2_sptr_(
new application_manager::UsageStatistics(
kAppId,
diff --git a/src/components/application_manager/test/zero_request_amount_test.cc b/src/components/application_manager/test/zero_request_amount_test.cc
index cce0b2abf2..0166c036c1 100644
--- a/src/components/application_manager/test/zero_request_amount_test.cc
+++ b/src/components/application_manager/test/zero_request_amount_test.cc
@@ -30,19 +30,19 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include <algorithm>
+#include <string>
#include "gtest/gtest.h"
-#include "application_manager/request_controller.h"
-#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application_manager_impl.h"
-#include "application_manager/message_helper.h"
+#include "application_manager/commands/command_request_impl.h"
#include "application_manager/commands/mobile/put_file_request.h"
#include "application_manager/commands/mobile/register_app_interface_request.h"
#include "application_manager/commands/mobile/unregister_app_interface_request.h"
-#include "smart_objects/smart_object.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/request_controller.h"
#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -51,7 +51,7 @@ using namespace ::profile;
using namespace application_manager::request_controller;
using namespace application_manager;
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
commands::Command* RegisterApplication() {
SmartObjectSPtr resultsmart =
diff --git a/src/components/config_profile/CMakeLists.txt b/src/components/config_profile/CMakeLists.txt
index 4ed382039a..4b545c65ae 100644
--- a/src/components/config_profile/CMakeLists.txt
+++ b/src/components/config_profile/CMakeLists.txt
@@ -35,6 +35,7 @@ include_directories (
${COMPONENTS_DIR}/utils/include/
${POLICY_GLOBAL_INCLUDE_PATH}/
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
diff --git a/src/components/config_profile/include/config_profile/ini_file.h b/src/components/config_profile/include/config_profile/ini_file.h
index 3f3ddddf48..204fb6c7bf 100644
--- a/src/components/config_profile/include/config_profile/ini_file.h
+++ b/src/components/config_profile/include/config_profile/ini_file.h
@@ -56,7 +56,7 @@ namespace profile {
/*
* @brief Global defines
*/
-#define INI_LINE_LEN 512
+#define INI_LINE_LEN 1024
#define INI_FILE_TEMP_NAME "ini.tmp"
#define INI_FLAG_UPDATE 0x00
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h
index 61dddf55b0..76c66c7c7b 100644
--- a/src/components/config_profile/include/config_profile/profile.h
+++ b/src/components/config_profile/include/config_profile/profile.h
@@ -34,17 +34,18 @@
#define SRC_COMPONENTS_CONFIG_PROFILE_INCLUDE_CONFIG_PROFILE_PROFILE_H_
#include <stdint.h>
+#include <list>
+#include <map>
#include <string>
#include <vector>
-#include <list>
-#include "utils/macro.h"
-#include "protocol_handler/protocol_handler_settings.h"
+#include "application_manager/application_manager_settings.h"
#include "connection_handler/connection_handler_settings.h"
#include "hmi_message_handler/hmi_message_handler_settings.h"
#include "media_manager/media_manager_settings.h"
-#include "transport_manager/transport_manager_settings.h"
-#include "application_manager/application_manager_settings.h"
#include "policy/policy_settings.h"
+#include "protocol_handler/protocol_handler_settings.h"
+#include "transport_manager/transport_manager_settings.h"
+#include "utils/macro.h"
namespace profile {
@@ -84,23 +85,23 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const std::string& sdl_version() const OVERRIDE;
/**
- * @brief Returns true if HMI should be started, otherwise false
- */
+ * @brief Returns true if HMI should be started, otherwise false
+ */
bool launch_hmi() const OVERRIDE;
#ifdef WEB_HMI
/**
- * @brief Returns link to web hmi
- */
+ * @brief Returns link to web hmi
+ */
std::string link_to_web_hmi() const;
#endif // WEB_HMI
/**
- * @brief Returns application configuration path
- */
+ * @brief Returns application configuration path
+ */
const std::string& app_config_folder() const;
/**
- * @brief Returns application storage path
- */
+ * @brief Returns application storage path
+ */
const std::string& app_storage_folder() const;
/**
@@ -109,10 +110,25 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const std::string& app_resource_folder() const;
/**
- * @brief Returns true, if SDL 4.0 is enabled
- * @deprecated use max_supported_protocol_version instead
+ * @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
*/
- DEPRECATED bool enable_protocol_4() const OVERRIDE;
+ 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 application icons folder path
@@ -186,8 +202,8 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
uint32_t stop_streaming_timeout() const;
/**
- * @brief Returns port for time reports
- */
+ * @brief Returns port for time reports
+ */
const uint16_t& time_testing_port() const;
/**
@@ -212,8 +228,8 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const std::vector<std::string>& vr_commands() const;
/**
- * @brief Returns folder containing all plugins
- */
+ * @brief Returns folder containing all plugins
+ */
const std::string& plugins_folder() const OVERRIDE;
/**
@@ -238,38 +254,38 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const uint64_t thread_min_stack_size() const;
/**
- * @brief Returns true if audio mixing is supported
- */
+ * @brief Returns true if audio mixing is supported
+ */
bool is_mixing_audio_supported() const;
/**
- * @brief Returns true if video re-decoding enabled
- */
+ * @brief Returns true if video re-decoding enabled
+ */
bool is_redecoding_enabled() const;
/**
- * @brief Returns title for Vr Help
- */
+ * @brief Returns title for Vr Help
+ */
const std::string& vr_help_title() const;
/**
- * @brief Returns application directory quota size
- */
+ * @brief Returns application directory quota size
+ */
const uint32_t& app_dir_quota() const;
/**
- * @brief Returns the video server type
- */
+ * @brief Returns the video server type
+ */
const std::string& video_server_type() const;
/**
- * @brief Returns the audio server type
- */
+ * @brief Returns the audio server type
+ */
const std::string& audio_server_type() const;
/**
- * @brief Returns the video pipe path
- */
+ * @brief Returns the video pipe path
+ */
const std::string& named_video_pipe_path() const;
/**
@@ -284,13 +300,13 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const uint32_t& app_hmi_level_none_time_scale() const;
/**
- * @brief Returns path to testing file to which redirects video stream
- */
+ * @brief Returns path to testing file to which redirects video stream
+ */
const std::string& video_stream_file() const;
/**
- * @brief Returns path to testing file to which redirects audio stream
- */
+ * @brief Returns path to testing file to which redirects audio stream
+ */
const std::string& audio_stream_file() const;
/**
@@ -368,6 +384,12 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
*/
bool enable_policy() const;
+ /**
+ * @brief Should core use fullAppID internally instead of appID (Default true)
+ * @return Flag
+ */
+ bool use_full_app_id() const;
+
// TransportManageSettings interface
/*
@@ -385,6 +407,65 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
*/
uint16_t transport_manager_tcp_adapter_port() const OVERRIDE;
+ /**
+ * @brief Returns the network interface name for TCP transport adapter
+ */
+ const std::string& transport_manager_tcp_adapter_network_interface()
+ const OVERRIDE;
+
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+ /**
+ * @brief Returns websocket server address
+ */
+ const std::string& websocket_server_address() const OVERRIDE;
+
+ /**
+ * @brief Returns port for websocket server
+ */
+ uint16_t websocket_server_port() const OVERRIDE;
+#ifdef ENABLE_SECURITY
+ /**
+ * @brief Returns ws server certificate path to pem file
+ */
+ const std::string& ws_server_cert_path() const OVERRIDE;
+
+ /**
+ * @brief Returns ws server CA certificate path to pem file
+ */
+ const std::string& ws_server_ca_cert_path() const OVERRIDE;
+
+ /**
+ * @brief Returns ws server key path to pem file
+ */
+ const std::string& ws_server_key_path() const OVERRIDE;
+
+ /**
+ * @brief Returns bool flag indicating whether WSS settings were setup
+ * correctly
+ */
+ const bool wss_server_supported() const OVERRIDE;
+#endif // ENABLE_SECURITY
+#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+
+ /**
+ * @brief Returns retry timeout for cloud app connections
+ */
+ uint32_t cloud_app_retry_timeout() const OVERRIDE;
+
+ /**
+ * @brief Returns maximum retry attempts for cloud app connections
+ */
+ uint16_t cloud_app_max_retry_attempts() const OVERRIDE;
+
+ const uint8_t* bluetooth_uuid() const OVERRIDE;
+
+ const std::string& aoa_filter_manufacturer() const OVERRIDE;
+ const std::string& aoa_filter_model_name() const OVERRIDE;
+ const std::string& aoa_filter_description() const OVERRIDE;
+ const std::string& aoa_filter_version() const OVERRIDE;
+ const std::string& aoa_filter_uri() const OVERRIDE;
+ const std::string& aoa_filter_serial_number() const OVERRIDE;
+
// TransportManageMMESettings interface
const std::string& event_mq_name() const OVERRIDE;
@@ -414,8 +495,8 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const std::vector<uint32_t>& supported_diag_modes() const OVERRIDE;
/**
- * @brief Returns system files folder path
- */
+ * @brief Returns system files folder path
+ */
const std::string& system_files_path() const OVERRIDE;
/**
@@ -466,17 +547,47 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
size_t update_before_hours() const;
#endif // ENABLE_SECURITY
- /**
- * @brief Reads a string value from the profile
- *
- * @param value Result value
- * @param default_value Value to use key wasn't found
- * @param pSection The section to read the value in
- * @param pKey The key whose value needs to be read out
- *
- * @return FALSE if could not read the value out of the profile
- * (then the value is equal \c default_value)
- */
+
+ /**
+ * @brief Returns true multiple transports is enabled
+ */
+ const bool multiple_transports_enabled() const OVERRIDE;
+
+ /**
+ * @brief Returns list of secondary transports available
+ * for the named primary transport
+ */
+ const std::vector<std::string>& secondary_transports_for_bluetooth()
+ const OVERRIDE;
+ const std::vector<std::string>& secondary_transports_for_usb() const OVERRIDE;
+ const std::vector<std::string>& secondary_transports_for_wifi()
+ const OVERRIDE;
+
+ /**
+ * @brief Returns list of allowed transports for the named service
+ */
+ const std::vector<std::string>& audio_service_transports() const OVERRIDE;
+ const std::vector<std::string>& video_service_transports() const OVERRIDE;
+
+ uint32_t rpc_pass_through_timeout() const OVERRIDE;
+
+ // RcConsentManager
+ uint16_t period_for_consent_expiration() const OVERRIDE;
+ // RcConsentManager end
+
+ const std::vector<std::string>& embedded_services() const OVERRIDE;
+ const std::string hmi_origin_id() const OVERRIDE;
+ /**
+ * @brief Reads a string value from the profile
+ *
+ * @param value Result value
+ * @param default_value Value to use key wasn't found
+ * @param pSection The section to read the value in
+ * @param pKey The key whose value needs to be read out
+ *
+ * @return FALSE if could not read the value out of the profile
+ * (then the value is equal \c default_value)
+ */
bool ReadStringValue(std::string* value,
const char* default_value,
const char* const pSection,
@@ -520,13 +631,17 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
* @param pKey The key whose value needs to be read out
* @param out_result Pointer to bool value for result reading Section
* (could be NULL)
+ * @param allow_empty If true, then out_result will be true when the value
+ * contains an empty string.
+ * If false, then out_result will be false in such case.
*
* @return container of values or empty continer
* if could not read the value out of the profile
*/
std::vector<std::string> ReadStringContainer(const char* const pSection,
const char* const pKey,
- bool* out_result) const;
+ bool* out_result,
+ bool allow_empty = false) const;
/**
* @brief Reads an container of hex int values from the profile,
* which handle as "0x01, 0xA0, 0XFF"
@@ -543,6 +658,10 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const char* const pKey,
bool* out_result) const;
+ std::vector<uint8_t> ReadUint8Container(const char* const pSection,
+ const char* const pKey,
+ bool* out_result) const;
+
/**
* @brief Returns delimiter for SDL-generated TTS chunks
* @return TTS delimiter
@@ -618,6 +737,33 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
uint16_t open_attempt_timeout_ms_resumption_db() const;
/**
+ * @brief Returns "transport required for resumption" map
+ *
+ * Keys of the map are AppHMIType strings, i.e. "DEFAULT", "COMMUNICATION",
+ * "MEDIA", and so on. The map may contain a special key "EMPTY_APP" for apps
+ * that does not specify any AppHMIType.
+ */
+ const std::map<std::string, std::vector<std::string> >&
+ transport_required_for_resumption_map() const OVERRIDE;
+
+ /**
+ * @brief Returns HMI level for resumption of a NAVIGATION app
+ */
+ const std::string& navigation_lowbandwidth_resumption_level() const OVERRIDE;
+
+ /**
+ * @brief Returns HMI level for resumption of a PROJECTION app
+ */
+ const std::string& projection_lowbandwidth_resumption_level() const OVERRIDE;
+
+ /**
+ * @brief Returns HMI level for resumption of a media app
+ *
+ * Note: this is *not* for AppHMIType = MEDIA.
+ */
+ const std::string& media_lowbandwidth_resumption_level() const OVERRIDE;
+
+ /**
* @brief Returns wait time after device connection
* before app launch request
*/
@@ -656,9 +802,9 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const bool enable_app_launch_ios() const OVERRIDE;
/**
- * @brief Returns the millisecond count before timeout
- * for transport change feature occures.
- */
+ * @brief Returns the millisecond count before timeout
+ * for transport change feature occures.
+ */
uint32_t app_transport_change_timer() const OVERRIDE;
/**
@@ -687,6 +833,8 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
const std::pair<uint32_t, int32_t>& get_vehicle_data_frequency()
const OVERRIDE;
+ const std::pair<uint32_t, int32_t>& get_interior_vehicle_data_frequency()
+ const OVERRIDE;
const std::pair<uint32_t, int32_t>& start_stream_retry_amount()
const OVERRIDE;
@@ -714,13 +862,29 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
* @param pKey The key whose value needs to be read out
*
* @return FALSE if could not read the value out of the profile
- * (then the value is not changed)
+ * (then the value is not changed) or the value was empty
*/
bool ReadValue(std::string* value,
const char* const pSection,
const char* const pKey) const;
/**
+ * @brief Reads a string value from the profile
+ *
+ * This is same as ReadValue(), except that this method will accept an empty
+ * string.
+ *
+ * @param value The value to return
+ * @param pSection The section to read the value in
+ * @param pKey The key whose value needs to be read out
+ *
+ * @return TRUE if the value is read, FALSE if the value is not found
+ */
+ bool ReadValueEmpty(std::string* value,
+ const char* const pSection,
+ const char* const pKey) const;
+
+ /**
* @brief Reads a boolean value from the profile
*
* @param value The value to return
@@ -854,11 +1018,32 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
std::string preloaded_pt_file_;
std::string policy_snapshot_file_name_;
bool enable_policy_;
+ bool use_full_app_id_;
uint32_t transport_manager_disconnect_timeout_;
bool use_last_state_;
std::vector<uint32_t> supported_diag_modes_;
std::string system_files_path_;
uint16_t transport_manager_tcp_adapter_port_;
+ std::string transport_manager_tcp_adapter_network_interface_;
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+ std::string websocket_server_address_;
+ uint16_t websocket_server_port_;
+#ifdef ENABLE_SECURITY
+ std::string ws_server_cert_path_;
+ std::string ws_server_ca_cert_path_;
+ std::string ws_server_key_path_;
+ bool is_wss_settings_setup_;
+#endif // ENABLE_SECURITY
+#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+ uint32_t cloud_app_retry_timeout_;
+ uint16_t cloud_app_max_retry_attempts_;
+ std::vector<uint8_t> bluetooth_uuid_;
+ std::string aoa_filter_manufacturer_;
+ std::string aoa_filter_model_name_;
+ std::string aoa_filter_description_;
+ std::string aoa_filter_version_;
+ std::string aoa_filter_uri_;
+ std::string aoa_filter_serial_number_;
std::string tts_delimiter_;
uint32_t audio_data_stopped_timeout_;
uint32_t video_data_stopped_timeout_;
@@ -895,6 +1080,12 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
*/
std::pair<uint32_t, int32_t> get_vehicle_data_frequency_;
+ /*
+ * first value is count of request
+ * second is time scale
+ */
+ std::pair<uint32_t, int32_t> get_interior_vehicle_data_frequency_;
+
/**
* first value is count of retries for start stream
* second for timer
@@ -919,6 +1110,11 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
bool use_db_for_resumption_;
uint16_t attempts_to_open_resumption_db_;
uint16_t open_attempt_timeout_ms_resumption_db_;
+ std::map<std::string, std::vector<std::string> >
+ transport_required_for_resumption_map_;
+ std::string navigation_lowbandwidth_resumption_level_;
+ std::string projection_lowbandwidth_resumption_level_;
+ std::string media_lowbandwidth_resumption_level_;
uint16_t app_launch_wait_time_;
uint16_t app_launch_max_retry_attempt_;
uint16_t app_launch_retry_wait_time_;
@@ -928,8 +1124,23 @@ class Profile : public protocol_handler::ProtocolHandlerSettings,
bool enable_app_launch_ios_;
uint32_t app_tranport_change_timer_;
uint32_t app_tranport_change_timer_addition_;
+ bool multiple_transports_enabled_;
+ std::vector<std::string> secondary_transports_for_bluetooth_;
+ std::vector<std::string> secondary_transports_for_usb_;
+ std::vector<std::string> secondary_transports_for_wifi_;
+ std::vector<std::string> audio_service_transports_;
+ 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_;
+ uint32_t rpc_pass_through_timeout_;
+ uint16_t period_for_consent_expiration_;
+
+ std::vector<std::string> embedded_services_;
+
+ std::string hmi_origin_id_;
DISALLOW_COPY_AND_ASSIGN(Profile);
};
diff --git a/src/components/config_profile/src/ini_file.cc b/src/components/config_profile/src/ini_file.cc
index 3245b096cb..024c75de3e 100644
--- a/src/components/config_profile/src/ini_file.cc
+++ b/src/components/config_profile/src/ini_file.cc
@@ -31,13 +31,13 @@
*/
#include "config_profile/ini_file.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
#include <ctype.h>
+#include <errno.h>
#include <limits.h>
#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include "utils/logger.h"
@@ -157,7 +157,7 @@ char ini_write_value(const char* fname,
const char* item,
const char* value,
uint8_t flag) {
- FILE* rd_fp, * wr_fp = 0;
+ FILE *rd_fp, *wr_fp = 0;
uint16_t i, cr_count;
int32_t wr_result;
bool chapter_found = false;
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 4137476d63..3037b66fdd 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -33,17 +33,18 @@
#include "config_profile/profile.h"
#include <errno.h>
-#include <string.h>
#include <stdlib.h>
-#include <sstream>
+#include <string.h>
#include <algorithm>
+#include <numeric>
+#include <sstream>
#include <string>
#include "config_profile/ini_file.h"
+#include "utils/file_system.h"
#include "utils/logger.h"
#include "utils/threads/thread.h"
-#include "utils/file_system.h"
#ifdef ENABLE_SECURITY
#include <openssl/ssl.h>
@@ -80,6 +81,7 @@ const char* kMediaManagerSection = "MEDIA MANAGER";
const char* kGlobalPropertiesSection = "GLOBAL PROPERTIES";
const char* kVrCommandsSection = "VR COMMANDS";
const char* kTransportManagerSection = "TransportManager";
+const char* kCloudAppTransportSection = "CloudAppConnections";
const char* kApplicationManagerSection = "ApplicationManager";
const char* kFilesystemRestrictionsSection = "FILESYSTEM RESTRICTIONS";
const char* kIAPSection = "IAP";
@@ -88,6 +90,14 @@ const char* kSDL4Section = "SDL4";
const char* kSDL5Section = "SDL5";
const char* kResumptionSection = "Resumption";
const char* kAppLaunchSection = "AppLaunch";
+const char* kMultipleTransportsSection = "MultipleTransports";
+const char* kServicesMapSection = "ServicesMap";
+const char* kTransportRequiredForResumptionSection =
+ "TransportRequiredForResumption";
+const char* kLowBandwidthTransportResumptionLevelSection =
+ "LowBandwidthTransportResumptionLevel";
+const char* kAppServicesSection = "AppServices";
+const char* kRCModuleConsentSection = "RCModuleConsent";
const char* kSDLVersionKey = "SDLVersion";
const char* kHmiCapabilitiesKey = "HMICapabilities";
@@ -146,6 +156,18 @@ const char* kHeartBeatTimeoutKey = "HeartBeatTimeout";
const char* kMaxSupportedProtocolVersionKey = "MaxSupportedProtocolVersion";
const char* kUseLastStateKey = "UseLastState";
const char* kTCPAdapterPortKey = "TCPAdapterPort";
+const char* kTCPAdapterNetworkInterfaceKey = "TCPAdapterNetworkInterface";
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+const char* kWebSocketServerAddressKey = "WebSocketServerAddress";
+const char* kWebSocketServerPortKey = "WebSocketServerPort";
+#ifdef ENABLE_SECURITY
+const char* kWSServerCertificatePathKey = "WSServerCertificatePath";
+const char* kWSServerCACertificaePathKey = "WSServerCACertificatePath";
+const char* kWSServerKeyPathKey = "WSServerKeyPath";
+#endif // ENABLE_SECURITY
+#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+const char* kCloudAppRetryTimeoutKey = "CloudAppRetryTimeout";
+const char* kCloudAppMaxRetryAttemptsKey = "CloudAppMaxRetryAttempts";
const char* kServerPortKey = "ServerPort";
const char* kVideoStreamingPortKey = "VideoStreamingPort";
const char* kAudioStreamingPortKey = "AudioStreamingPort";
@@ -172,15 +194,25 @@ const char* kAppHmiLevelNoneRequestsTimeScaleKey =
const char* kPendingRequestsAmoundKey = "PendingRequestsAmount";
const char* kSupportedDiagModesKey = "SupportedDiagModes";
const char* kTransportManagerDisconnectTimeoutKey = "DisconnectTimeout";
+const char* kBluetoothUUIDKey = "BluetoothUUID";
+const char* kAOAFilterManufacturerKey = "AOAFilterManufacturer";
+const char* kAOAFilterModelNameKey = "AOAFilterModelName";
+const char* kAOAFilterDescriptionKey = "AOAFilterDescription";
+const char* kAOAFilterVersionKey = "AOAFilterVersion";
+const char* kAOAFilterURIKey = "AOAFilterURI";
+const char* kAOAFilterSerialNumber = "AOAFilterSerialNumber";
const char* kTTSDelimiterKey = "TTSDelimiter";
const char* kRecordingFileNameKey = "RecordingFileName";
const char* kRecordingFileSourceKey = "RecordingFileSource";
const char* kEnablePolicy = "EnablePolicy";
+const char* kUseFullAppID = "UseFullAppID";
const char* kEventMQKey = "EventMQ";
const char* kAckMQKey = "AckMQ";
const char* kApplicationListUpdateTimeoutKey = "ApplicationListUpdateTimeout";
const char* kReadDIDFrequencykey = "ReadDIDRequest";
const char* kGetVehicleDataFrequencyKey = "GetVehicleDataRequest";
+const char* kGetInteriorVehicleDataFrequencyKey =
+ "GetInteriorVehicleDataRequest";
const char* kLegacyProtocolMaskKey = "LegacyProtocol";
const char* kHubProtocolMaskKey = "HubProtocol";
const char* kPoolProtocolMaskKey = "PoolProtocol";
@@ -214,6 +246,67 @@ 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";
+const char* kSecondaryTransportForUSBKey = "SecondaryTransportForUSB";
+const char* kSecondaryTransportForWiFiKey = "SecondaryTransportForWiFi";
+const char* kAudioServiceTransportsKey = "AudioServiceTransports";
+const char* kVideoServiceTransportsKey = "VideoServiceTransports";
+const char* kRpcPassThroughTimeoutKey = "RpcPassThroughTimeout";
+const char* kPeriodForConsentExpirationKey = "PeriodForConsentExpiration";
+
+const char* kDefaultTransportRequiredForResumptionKey =
+ "DefaultTransportRequiredForResumption";
+const char* kAppHMITypeDefault = "DEFAULT";
+const char* kCommunicationTransportRequiredForResumptionKey =
+ "CommunicationTransportRequiredForResumption";
+const char* kAppHMITypeCommunication = "COMMUNICATION";
+const char* kMediaTransportRequiredForResumptionKey =
+ "MediaTransportRequiredForResumption";
+const char* kAppHMITypeMedia = "MEDIA";
+const char* kMessagingTransportRequiredForResumptionKey =
+ "MessagingTransportRequiredForResumption";
+const char* kAppHMITypeMessaging = "MESSAGING";
+const char* kNavigationTransportRequiredForResumptionKey =
+ "NavigationTransportRequiredForResumption";
+const char* kAppHMITypeNavigation = "NAVIGATION";
+const char* kInformationTransportRequiredForResumptionKey =
+ "InformationTransportRequiredForResumption";
+const char* kAppHMITypeInformation = "INFORMATION";
+const char* kSocialTransportRequiredForResumptionKey =
+ "SocialTransportRequiredForResumption";
+const char* kAppHMITypeSocial = "SOCIAL";
+const char* kBackgroundProcessTransportRequiredForResumptionKey =
+ "BackgroundProcessTransportRequiredForResumption";
+const char* kAppHMITypeBackgroundProcess = "BACKGROUND_PROCESS";
+const char* kTestingTransportRequiredForResumptionKey =
+ "TestingTransportRequiredForResumption";
+const char* kAppHMITypeTesting = "TESTING";
+const char* kSystemTransportRequiredForResumptionKey =
+ "SystemTransportRequiredForResumption";
+const char* kAppHMITypeSystem = "SYSTEM";
+const char* kProjectionTransportRequiredForResumptionKey =
+ "ProjectionTransportRequiredForResumption";
+const char* kAppHMITypeProjection = "PROJECTION";
+const char* kRemoteControlTransportRequiredForResumptionKey =
+ "RemoteControlTransportRequiredForResumption";
+const char* kAppHMITypeRemoteControl = "REMOTE_CONTROL";
+const char* kEmptyAppTransportRequiredForResumptionKey =
+ "EmptyAppTransportRequiredForResumption";
+const char* kAppHMITypeEmptyApp = "EMPTY_APP";
+const char* kNavigationLowBandwidthResumptionLevelKey =
+ "NavigationLowBandwidthResumptionLevel";
+const char* kProjectionLowBandwidthResumptionLevelKey =
+ "ProjectionLowBandwidthResumptionLevel";
+const char* kMediaLowBandwidthResumptionLevelKey =
+ "MediaLowBandwidthResumptionLevel";
+const char* kHMIOriginIDKey = "HMIOriginID";
+const char* kEmbeddedServicesKey = "EmbeddedServices";
+
#ifdef WEB_HMI
const char* kDefaultLinkToWebHMI = "HMI/index.html";
#endif // WEB_HMI
@@ -221,6 +314,7 @@ const char* kDefaultPoliciesSnapshotFileName = "sdl_snapshot.json";
const char* kDefaultHmiCapabilitiesFileName = "hmi_capabilities.json";
const char* kDefaultPreloadedPTFileName = "sdl_preloaded_pt.json";
const char* kDefaultServerAddress = "127.0.0.1";
+const char* kDefaultWebsocketServerAddress = "0.0.0.0";
const char* kDefaultAppInfoFileName = "app_info.dat";
const char* kDefaultSystemFilesPath = "/tmp/fs/mp/images/ivsu_cache";
const char* kDefaultPluginsPath = "plugins";
@@ -237,6 +331,7 @@ const char* kDefaultHubProtocolMask = "com.smartdevicelink.prot";
const char* kDefaultPoolProtocolMask = "com.smartdevicelink.prot";
const char* kDefaultIAPSystemConfig = "/fs/mp/etc/mm/ipod.cfg";
const char* kDefaultIAP2SystemConfig = "/fs/mp/etc/mm/iap2.cfg";
+const char* kDefaultTransportManagerTCPAdapterNetworkInterface = "";
#ifdef ENABLE_SECURITY
const char* kDefaultSecurityProtocol = "TLSv1.2";
@@ -249,6 +344,9 @@ const uint32_t kDefaultHubProtocolIndex = 0;
const uint32_t kDefaultHeartBeatTimeout = 0;
const uint16_t kDefaultMaxSupportedProtocolVersion = 5;
const uint16_t kDefautTransportManagerTCPPort = 12345;
+const uint16_t kDefaultWebSocketServerPort = 2020;
+const uint16_t kDefaultCloudAppRetryTimeout = 1000;
+const uint16_t kDefaultCloudAppMaxRetryAttempts = 5;
const uint16_t kDefaultServerPort = 8087;
const uint16_t kDefaultVideoStreamingPort = 5050;
const uint16_t kDefaultAudioStreamingPort = 5080;
@@ -276,6 +374,7 @@ const uint32_t kDefaultTransportManagerDisconnectTimeout = 0;
const uint32_t kDefaultApplicationListUpdateTimeout = 1;
const std::pair<uint32_t, uint32_t> kReadDIDFrequency = {5, 1};
const std::pair<uint32_t, uint32_t> kGetVehicleDataFrequency = {5, 1};
+const std::pair<uint32_t, uint32_t> kGetInteriorVehicleDataFrequency = {20, 1};
const std::pair<uint32_t, uint32_t> kStartStreamRetryAmount = {3, 1};
const uint32_t kDefaultMaxThreadPoolSize = 2;
const int kDefaultIAP2HubConnectAttempts = 0;
@@ -309,8 +408,38 @@ 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;
+const char* kDefaultLowBandwidthResumptionLevel = "NONE";
+const uint32_t kDefaultRpcPassThroughTimeout = 10000;
+const uint16_t kDefaultPeriodForConsentExpiration = 30;
+const char* kDefaultHMIOriginId = "HMI_ID";
+const std::vector<uint8_t> kDefaultBluetoothUUID = {0x93,
+ 0x6D,
+ 0xA0,
+ 0x1F,
+ 0x9A,
+ 0xBD,
+ 0x4D,
+ 0x9D,
+ 0x80,
+ 0xC7,
+ 0x02,
+ 0xAF,
+ 0x85,
+ 0xC8,
+ 0x22,
+ 0xA8};
+const char* kDefaultAOAFilterManufacturer = "SDL";
+const char* kDefaultAOAFilterModelName = "Core";
+const char* kDefaultAOAFilterDescription = "SmartDeviceLink Core Component USB";
+const char* kDefaultAOAFilterVersion = "1.0";
+const char* kDefaultAOAFilterURI = "http://www.smartdevicelink.org";
+const char* kDefaultAOAFilterSerialNumber = "N000000";
} // namespace
namespace profile {
@@ -370,12 +499,19 @@ Profile::Profile()
, max_supported_protocol_version_(kDefaultMaxSupportedProtocolVersion)
, policy_snapshot_file_name_(kDefaultPoliciesSnapshotFileName)
, enable_policy_(false)
+ , use_full_app_id_(true)
, transport_manager_disconnect_timeout_(
kDefaultTransportManagerDisconnectTimeout)
, use_last_state_(false)
, supported_diag_modes_()
, system_files_path_(kDefaultSystemFilesPath)
, transport_manager_tcp_adapter_port_(kDefautTransportManagerTCPPort)
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+ , websocket_server_address_(kDefaultWebsocketServerAddress)
+ , websocket_server_port_(kDefaultWebSocketServerPort)
+#endif
+ , cloud_app_retry_timeout_(kDefaultCloudAppRetryTimeout)
+ , cloud_app_max_retry_attempts_(kDefaultCloudAppMaxRetryAttempts)
, tts_delimiter_(kDefaultTtsDelimiter)
, audio_data_stopped_timeout_(kDefaultAudioDataStoppedTimeout)
, video_data_stopped_timeout_(kDefaultVideoDataStoppedTimeout)
@@ -403,6 +539,11 @@ Profile::Profile()
, attempts_to_open_resumption_db_(kDefaultAttemptsToOpenResumptionDB)
, open_attempt_timeout_ms_resumption_db_(
kDefaultOpenAttemptTimeoutMsResumptionDB)
+ , navigation_lowbandwidth_resumption_level_(
+ kDefaultLowBandwidthResumptionLevel)
+ , projection_lowbandwidth_resumption_level_(
+ kDefaultLowBandwidthResumptionLevel)
+ , media_lowbandwidth_resumption_level_(kDefaultLowBandwidthResumptionLevel)
, app_launch_wait_time_(kDefaultAppLaunchWaitTime)
, app_launch_max_retry_attempt_(kDefaultAppLaunchMaxRetryAttempt)
, app_launch_retry_wait_time_(kDefaultAppLaunchRetryWaitTime)
@@ -413,8 +554,14 @@ Profile::Profile()
, app_tranport_change_timer_(kDefaultAppTransportChangeTimer)
, app_tranport_change_timer_addition_(
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)
+ , rpc_pass_through_timeout_(kDefaultRpcPassThroughTimeout)
+ , period_for_consent_expiration_(kDefaultPeriodForConsentExpiration) {
// SDL version
ReadStringValue(
&sdl_version_, kDefaultSDLVersion, kMainSection, kSDLVersionKey);
@@ -459,8 +606,16 @@ const std::string& Profile::app_resource_folder() const {
return app_resource_folder_;
}
-bool Profile::enable_protocol_4() const {
- return max_supported_protocol_version_ >= 4;
+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_;
}
const std::string& Profile::app_icons_folder() const {
@@ -659,6 +814,10 @@ bool Profile::enable_policy() const {
return enable_policy_;
}
+bool Profile::use_full_app_id() const {
+ return use_full_app_id_;
+}
+
uint32_t Profile::transport_manager_disconnect_timeout() const {
return transport_manager_disconnect_timeout_;
}
@@ -682,6 +841,74 @@ uint16_t Profile::transport_manager_tcp_adapter_port() const {
return transport_manager_tcp_adapter_port_;
}
+const std::string& Profile::transport_manager_tcp_adapter_network_interface()
+ const {
+ return transport_manager_tcp_adapter_network_interface_;
+}
+
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+const std::string& Profile::websocket_server_address() const {
+ return websocket_server_address_;
+}
+
+uint16_t Profile::websocket_server_port() const {
+ return websocket_server_port_;
+}
+#ifdef ENABLE_SECURITY
+const std::string& Profile::ws_server_cert_path() const {
+ return ws_server_cert_path_;
+}
+
+const std::string& Profile::ws_server_key_path() const {
+ return ws_server_key_path_;
+}
+
+const std::string& Profile::ws_server_ca_cert_path() const {
+ return ws_server_ca_cert_path_;
+}
+
+const bool Profile::wss_server_supported() const {
+ return is_wss_settings_setup_;
+}
+#endif // ENABLE_SECURITY
+#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+
+uint32_t Profile::cloud_app_retry_timeout() const {
+ return cloud_app_retry_timeout_;
+}
+
+uint16_t Profile::cloud_app_max_retry_attempts() const {
+ return cloud_app_max_retry_attempts_;
+}
+
+const uint8_t* Profile::bluetooth_uuid() const {
+ return bluetooth_uuid_.data();
+}
+
+const std::string& Profile::aoa_filter_manufacturer() const {
+ return aoa_filter_manufacturer_;
+}
+
+const std::string& Profile::aoa_filter_model_name() const {
+ return aoa_filter_model_name_;
+}
+
+const std::string& Profile::aoa_filter_description() const {
+ return aoa_filter_description_;
+}
+
+const std::string& Profile::aoa_filter_version() const {
+ return aoa_filter_version_;
+}
+
+const std::string& Profile::aoa_filter_uri() const {
+ return aoa_filter_uri_;
+}
+
+const std::string& Profile::aoa_filter_serial_number() const {
+ return aoa_filter_serial_number_;
+}
+
const std::string& Profile::tts_delimiter() const {
return tts_delimiter_;
}
@@ -714,6 +941,11 @@ const std::pair<uint32_t, int32_t>& Profile::get_vehicle_data_frequency()
return get_vehicle_data_frequency_;
}
+const std::pair<uint32_t, int32_t>&
+Profile::get_interior_vehicle_data_frequency() const {
+ return get_interior_vehicle_data_frequency_;
+}
+
const std::pair<uint32_t, int32_t>& Profile::start_stream_retry_amount() const {
return start_stream_retry_amount_;
}
@@ -899,6 +1131,23 @@ uint16_t Profile::open_attempt_timeout_ms_resumption_db() const {
return open_attempt_timeout_ms_resumption_db_;
}
+const std::map<std::string, std::vector<std::string> >&
+Profile::transport_required_for_resumption_map() const {
+ return transport_required_for_resumption_map_;
+}
+
+const std::string& Profile::navigation_lowbandwidth_resumption_level() const {
+ return navigation_lowbandwidth_resumption_level_;
+}
+
+const std::string& Profile::projection_lowbandwidth_resumption_level() const {
+ return projection_lowbandwidth_resumption_level_;
+}
+
+const std::string& Profile::media_lowbandwidth_resumption_level() const {
+ return media_lowbandwidth_resumption_level_;
+}
+
const uint16_t Profile::app_launch_max_retry_attempt() const {
return app_launch_max_retry_attempt_;
}
@@ -935,6 +1184,39 @@ const uint16_t Profile::wait_time_between_apps() const {
return wait_time_between_apps_;
}
+const bool Profile::multiple_transports_enabled() const {
+ return multiple_transports_enabled_;
+}
+
+uint32_t Profile::rpc_pass_through_timeout() const {
+ return rpc_pass_through_timeout_;
+}
+
+uint16_t Profile::period_for_consent_expiration() const {
+ return period_for_consent_expiration_;
+}
+
+const std::vector<std::string>& Profile::secondary_transports_for_bluetooth()
+ const {
+ return secondary_transports_for_bluetooth_;
+}
+
+const std::vector<std::string>& Profile::secondary_transports_for_usb() const {
+ return secondary_transports_for_usb_;
+}
+
+const std::vector<std::string>& Profile::secondary_transports_for_wifi() const {
+ return secondary_transports_for_wifi_;
+}
+
+const std::vector<std::string>& Profile::audio_service_transports() const {
+ return audio_service_transports_;
+}
+
+const std::vector<std::string>& Profile::video_service_transports() const {
+ return video_service_transports_;
+}
+
const bool Profile::ErrorOccured() const {
return error_occured_;
}
@@ -950,6 +1232,14 @@ bool Profile::IsFileNamePortable(const std::string& file_name) const {
return true;
}
+const std::vector<std::string>& Profile::embedded_services() const {
+ return embedded_services_;
+}
+
+const std::string Profile::hmi_origin_id() const {
+ return hmi_origin_id_;
+}
+
void Profile::UpdateValues() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -992,6 +1282,7 @@ void Profile::UpdateValues() {
ReadStringValue(
&cert_path_, "", kSecuritySection, kSecurityCertificatePathKey);
+
ReadStringValue(
&ca_cert_path_, "", kSecuritySection, kSecurityCACertificatePathKey);
@@ -1610,6 +1901,144 @@ void Profile::UpdateValues() {
kTCPAdapterPortKey,
kTransportManagerSection);
+ // Transport manager TCP network interface
+ ReadStringValue(&transport_manager_tcp_adapter_network_interface_,
+ kDefaultTransportManagerTCPAdapterNetworkInterface,
+ kTransportManagerSection,
+ kTCPAdapterNetworkInterfaceKey);
+
+ LOG_UPDATED_VALUE(transport_manager_tcp_adapter_network_interface_,
+ kTCPAdapterNetworkInterfaceKey,
+ kTransportManagerSection);
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+ // Websocket server address
+ ReadStringValue(&websocket_server_address_,
+ kDefaultWebsocketServerAddress,
+ kTransportManagerSection,
+ kWebSocketServerAddressKey);
+
+ LOG_UPDATED_VALUE(websocket_server_address_,
+ kWebSocketServerAddressKey,
+ kTransportManagerSection);
+
+ // Websocket non-secured server port
+ ReadUIntValue(&websocket_server_port_,
+ kDefaultWebSocketServerPort,
+ kTransportManagerSection,
+ kWebSocketServerPortKey);
+
+ LOG_UPDATED_VALUE(websocket_server_port_,
+ kWebSocketServerPortKey,
+ kTransportManagerSection);
+
+#ifdef ENABLE_SECURITY
+ const bool is_ws_server_cert_setup =
+ ReadStringValue(&ws_server_cert_path_,
+ "",
+ kTransportManagerSection,
+ kWSServerCertificatePathKey);
+
+ LOG_UPDATED_VALUE(ws_server_cert_path_,
+ kWSServerCertificatePathKey,
+ kTransportManagerSection);
+
+ const bool is_ws_server_key_setup = ReadStringValue(
+ &ws_server_key_path_, "", kTransportManagerSection, kWSServerKeyPathKey);
+
+ LOG_UPDATED_VALUE(
+ ws_server_key_path_, kWSServerKeyPathKey, kTransportManagerSection);
+
+ const bool is_ws_ca_cert_setup =
+ ReadStringValue(&ws_server_ca_cert_path_,
+ "",
+ kTransportManagerSection,
+ kWSServerCACertificaePathKey);
+
+ LOG_UPDATED_VALUE(ws_server_ca_cert_path_,
+ kWSServerCACertificaePathKey,
+ kTransportManagerSection);
+
+ is_wss_settings_setup_ =
+ is_ws_server_cert_setup && is_ws_server_key_setup && is_ws_ca_cert_setup;
+#endif // ENABLE_SECURITY
+#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+
+ ReadUIntValue(&cloud_app_retry_timeout_,
+ kDefaultCloudAppRetryTimeout,
+ kCloudAppTransportSection,
+ kCloudAppRetryTimeoutKey);
+
+ LOG_UPDATED_VALUE(cloud_app_retry_timeout_,
+ kCloudAppRetryTimeoutKey,
+ kCloudAppTransportSection);
+
+ ReadUIntValue(&cloud_app_max_retry_attempts_,
+ kDefaultCloudAppMaxRetryAttempts,
+ kCloudAppTransportSection,
+ kCloudAppMaxRetryAttemptsKey);
+
+ LOG_UPDATED_VALUE(cloud_app_max_retry_attempts_,
+ kCloudAppMaxRetryAttemptsKey,
+ kCloudAppTransportSection);
+
+ bool read_result = true;
+ bluetooth_uuid_ = ReadUint8Container(
+ kTransportManagerSection, kBluetoothUUIDKey, &read_result);
+ if (!read_result || bluetooth_uuid_.size() != 16) {
+ bluetooth_uuid_ = kDefaultBluetoothUUID;
+ }
+
+ ReadStringValue(&aoa_filter_manufacturer_,
+ kDefaultAOAFilterManufacturer,
+ kTransportManagerSection,
+ kAOAFilterManufacturerKey);
+
+ LOG_UPDATED_VALUE(aoa_filter_manufacturer_,
+ kAOAFilterManufacturerKey,
+ kTransportManagerSection);
+
+ ReadStringValue(&aoa_filter_model_name_,
+ kDefaultAOAFilterModelName,
+ kTransportManagerSection,
+ kAOAFilterModelNameKey);
+
+ LOG_UPDATED_VALUE(
+ aoa_filter_model_name_, kAOAFilterModelNameKey, kTransportManagerSection);
+
+ ReadStringValue(&aoa_filter_description_,
+ kDefaultAOAFilterDescription,
+ kTransportManagerSection,
+ kAOAFilterDescriptionKey);
+
+ LOG_UPDATED_VALUE(aoa_filter_description_,
+ kAOAFilterDescriptionKey,
+ kTransportManagerSection);
+
+ ReadStringValue(&aoa_filter_version_,
+ kDefaultAOAFilterVersion,
+ kTransportManagerSection,
+ kAOAFilterVersionKey);
+
+ LOG_UPDATED_VALUE(
+ aoa_filter_version_, kAOAFilterVersionKey, kTransportManagerSection);
+
+ ReadStringValue(&aoa_filter_uri_,
+ kDefaultAOAFilterURI,
+ kTransportManagerSection,
+ kAOAFilterURIKey);
+
+ LOG_UPDATED_VALUE(
+ aoa_filter_uri_, kAOAFilterURIKey, kTransportManagerSection);
+
+ ReadStringValue(&aoa_filter_serial_number_,
+ kDefaultAOAFilterSerialNumber,
+ kTransportManagerSection,
+ kAOAFilterSerialNumber);
+
+ LOG_UPDATED_VALUE(aoa_filter_serial_number_,
+ kAOAFilterSerialNumber,
+ kTransportManagerSection);
+
// Event MQ
ReadStringValue(
&event_mq_name_, kDefaultEventMQ, kTransportManagerSection, kEventMQKey);
@@ -1701,6 +2130,15 @@ void Profile::UpdateValues() {
enable_policy_ = false;
}
+ // Use full app ID internally?
+ std::string use_full_id_string;
+ if (ReadValue(&use_full_id_string, kPolicySection, kUseFullAppID) &&
+ 0 == strcmp("true", use_full_id_string.c_str())) {
+ use_full_app_id_ = true;
+ } else {
+ use_full_app_id_ = false;
+ }
+
// Max protocol version
ReadUIntValue(&max_supported_protocol_version_,
kDefaultMaxSupportedProtocolVersion,
@@ -1735,6 +2173,11 @@ void Profile::UpdateValues() {
kMainSection,
kGetVehicleDataFrequencyKey);
+ ReadUintIntPairValue(&get_interior_vehicle_data_frequency_,
+ kGetInteriorVehicleDataFrequency,
+ kMainSection,
+ kGetInteriorVehicleDataFrequencyKey);
+
ReadUIntValue(&max_thread_pool_size_,
kDefaultMaxThreadPoolSize,
kApplicationManagerSection,
@@ -1841,6 +2284,84 @@ void Profile::UpdateValues() {
kOpenAttemptTimeoutMsResumptionDBKey,
kResumptionSection);
+ { // read parameters from TransportRequiredForResumption section
+ struct KeyPair {
+ const char* ini_key_name;
+ const char* map_key_name;
+ } keys[] = {
+ {kDefaultTransportRequiredForResumptionKey, kAppHMITypeDefault},
+ {kCommunicationTransportRequiredForResumptionKey,
+ kAppHMITypeCommunication},
+ {kMediaTransportRequiredForResumptionKey, kAppHMITypeMedia},
+ {kMessagingTransportRequiredForResumptionKey, kAppHMITypeMessaging},
+ {kNavigationTransportRequiredForResumptionKey, kAppHMITypeNavigation},
+ {kInformationTransportRequiredForResumptionKey, kAppHMITypeInformation},
+ {kSocialTransportRequiredForResumptionKey, kAppHMITypeSocial},
+ {kBackgroundProcessTransportRequiredForResumptionKey,
+ kAppHMITypeBackgroundProcess},
+ {kTestingTransportRequiredForResumptionKey, kAppHMITypeTesting},
+ {kSystemTransportRequiredForResumptionKey, kAppHMITypeSystem},
+ {kProjectionTransportRequiredForResumptionKey, kAppHMITypeProjection},
+ {kRemoteControlTransportRequiredForResumptionKey,
+ kAppHMITypeRemoteControl},
+ {kEmptyAppTransportRequiredForResumptionKey, kAppHMITypeEmptyApp},
+ {NULL, NULL}};
+ struct KeyPair* entry = keys;
+
+ while (entry->ini_key_name != NULL) {
+ bool exist = false;
+ std::vector<std::string> transport_list =
+ ReadStringContainer(kTransportRequiredForResumptionSection,
+ entry->ini_key_name,
+ &exist,
+ true);
+ if (exist) {
+ transport_required_for_resumption_map_[entry->map_key_name] =
+ transport_list;
+
+ const std::string list_with_comma = std::accumulate(
+ transport_list.begin(),
+ transport_list.end(),
+ std::string(""),
+ [](std::string& first, std::string& second) {
+ return first.empty() ? second : first + ", " + second;
+ });
+ LOG_UPDATED_VALUE(list_with_comma,
+ entry->ini_key_name,
+ kTransportRequiredForResumptionSection);
+ }
+ entry++;
+ }
+ }
+
+ // Read parameters from LowBandwidthTransportResumptionLevel section
+ ReadStringValue(&navigation_lowbandwidth_resumption_level_,
+ kDefaultLowBandwidthResumptionLevel,
+ kLowBandwidthTransportResumptionLevelSection,
+ kNavigationLowBandwidthResumptionLevelKey);
+
+ LOG_UPDATED_VALUE(navigation_lowbandwidth_resumption_level_,
+ kNavigationLowBandwidthResumptionLevelKey,
+ kLowBandwidthTransportResumptionLevelSection);
+
+ ReadStringValue(&projection_lowbandwidth_resumption_level_,
+ kDefaultLowBandwidthResumptionLevel,
+ kLowBandwidthTransportResumptionLevelSection,
+ kProjectionLowBandwidthResumptionLevelKey);
+
+ LOG_UPDATED_VALUE(projection_lowbandwidth_resumption_level_,
+ kProjectionLowBandwidthResumptionLevelKey,
+ kLowBandwidthTransportResumptionLevelSection);
+
+ ReadStringValue(&media_lowbandwidth_resumption_level_,
+ kDefaultLowBandwidthResumptionLevel,
+ kLowBandwidthTransportResumptionLevelSection,
+ kMediaLowBandwidthResumptionLevelKey);
+
+ LOG_UPDATED_VALUE(media_lowbandwidth_resumption_level_,
+ kMediaLowBandwidthResumptionLevelKey,
+ kLowBandwidthTransportResumptionLevelSection);
+
// Read parameters from App Launch section
ReadUIntValue(&app_launch_wait_time_,
kDefaultAppLaunchWaitTime,
@@ -1917,6 +2438,139 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(app_tranport_change_timer_addition_,
kAppTransportChangeTimerAdditionKey,
kMainSection);
+
+ 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);
+
+ LOG_UPDATED_BOOL_VALUE(multiple_transports_enabled_,
+ kMultipleTransportsEnabledKey,
+ kMultipleTransportsSection);
+
+ ReadUIntValue(&rpc_pass_through_timeout_,
+ kDefaultRpcPassThroughTimeout,
+ kAppServicesSection,
+ kRpcPassThroughTimeoutKey);
+
+ LOG_UPDATED_VALUE(rpc_pass_through_timeout_,
+ kRpcPassThroughTimeoutKey,
+ kAppServicesSection);
+
+ ReadUIntValue(&period_for_consent_expiration_,
+ kDefaultPeriodForConsentExpiration,
+ kRCModuleConsentSection,
+ kPeriodForConsentExpirationKey);
+
+ LOG_UPDATED_VALUE(period_for_consent_expiration_,
+ kPeriodForConsentExpirationKey,
+ kRCModuleConsentSection);
+
+ { // Secondary Transports and ServicesMap
+ struct KeyPair {
+ std::vector<std::string>* ini_vector;
+ const char* ini_section_name;
+ const char* ini_key_name;
+ } keys[] = {{&secondary_transports_for_bluetooth_,
+ kMultipleTransportsSection,
+ kSecondaryTransportForBluetoothKey},
+ {&secondary_transports_for_usb_,
+ kMultipleTransportsSection,
+ kSecondaryTransportForUSBKey},
+ {&secondary_transports_for_wifi_,
+ kMultipleTransportsSection,
+ kSecondaryTransportForWiFiKey},
+ {&audio_service_transports_,
+ kServicesMapSection,
+ kAudioServiceTransportsKey},
+ {&video_service_transports_,
+ kServicesMapSection,
+ kVideoServiceTransportsKey},
+ {NULL, NULL, NULL}};
+ struct KeyPair* entry = keys;
+
+ while (entry->ini_vector != NULL) {
+ bool exist = false;
+ std::vector<std::string> profile_entry = ReadStringContainer(
+ entry->ini_section_name, entry->ini_key_name, &exist, true);
+ if (exist) {
+ *entry->ini_vector = profile_entry;
+
+ const std::string list_with_comma = std::accumulate(
+ profile_entry.begin(),
+ profile_entry.end(),
+ std::string(""),
+ [](std::string& first, std::string& second) {
+ return first.empty() ? second : first + ", " + second;
+ });
+ LOG_UPDATED_VALUE(
+ list_with_comma, entry->ini_key_name, entry->ini_section_name);
+ }
+ entry++;
+ }
+ }
+
+ ReadStringValue(&hmi_origin_id_,
+ kDefaultHMIOriginId,
+ kAppServicesSection,
+ kHMIOriginIDKey);
+
+ LOG_UPDATED_VALUE(hmi_origin_id_, kHMIOriginIDKey, kAppServicesSection);
+
+ { // App Services map
+ struct KeyPair {
+ std::vector<std::string>* ini_vector;
+ const char* ini_section_name;
+ const char* ini_key_name;
+ } keys[] = {
+ {&embedded_services_, kAppServicesSection, kEmbeddedServicesKey},
+ {NULL, NULL, NULL}};
+ struct KeyPair* entry = keys;
+
+ while (entry->ini_vector != NULL) {
+ bool exist = false;
+ std::vector<std::string> profile_entry = ReadStringContainer(
+ entry->ini_section_name, entry->ini_key_name, &exist, true);
+ if (exist) {
+ *entry->ini_vector = profile_entry;
+
+ const std::string list_with_comma = std::accumulate(
+ profile_entry.begin(),
+ profile_entry.end(),
+ std::string(""),
+ [](std::string& first, std::string& second) {
+ return first.empty() ? second : first + ", " + second;
+ });
+ LOG_UPDATED_VALUE(
+ list_with_comma, entry->ini_key_name, entry->ini_section_name);
+ }
+ entry++;
+ }
+ }
}
bool Profile::ReadValue(bool* value,
@@ -1944,15 +2598,22 @@ bool Profile::ReadValue(std::string* value,
const char* const pSection,
const char* const pKey) const {
DCHECK(value);
+ return ReadValueEmpty(value, pSection, pKey) && "\0" != *value;
+}
+
+bool Profile::ReadValueEmpty(std::string* value,
+ const char* const pSection,
+ const char* const pKey) const {
+ DCHECK(value);
bool ret = false;
char buf[INI_LINE_LEN + 1];
*buf = '\0';
- if ((0 != ini_read_value(config_file_name_.c_str(), pSection, pKey, buf)) &&
- ('\0' != *buf)) {
+ if (0 != ini_read_value(config_file_name_.c_str(), pSection, pKey, buf)) {
*value = buf;
ret = true;
}
+
return ret;
}
@@ -2014,7 +2675,23 @@ namespace {
int32_t hex_to_int(const std::string& value) {
return static_cast<int32_t>(strtol(value.c_str(), NULL, 16));
}
+
+uint8_t hex_to_uint8(const std::string& value) {
+ return static_cast<uint8_t>(strtol(value.c_str(), NULL, 16));
+}
+
+std::string trim_string(const std::string& str) {
+ const char* delims = " \t";
+
+ size_t start = str.find_first_not_of(delims);
+ if (std::string::npos == start) {
+ return std::string();
+ }
+ size_t end = str.find_last_not_of(delims);
+
+ return str.substr(start, end - start + 1);
}
+} // namespace
std::vector<int> Profile::ReadIntContainer(const char* const pSection,
const char* const pKey,
@@ -2028,12 +2705,30 @@ std::vector<int> Profile::ReadIntContainer(const char* const pSection,
return value_list;
}
+std::vector<uint8_t> Profile::ReadUint8Container(const char* const pSection,
+ const char* const pKey,
+ bool* out_result) const {
+ const std::vector<std::string> string_list =
+ ReadStringContainer(pSection, pKey, out_result);
+ std::vector<uint8_t> value_list;
+ value_list.resize(string_list.size());
+ std::transform(
+ string_list.begin(), string_list.end(), value_list.begin(), hex_to_uint8);
+ return value_list;
+}
+
std::vector<std::string> Profile::ReadStringContainer(
const char* const pSection,
const char* const pKey,
- bool* out_result) const {
+ bool* out_result,
+ bool allow_empty) const {
std::string string;
- const bool result = ReadValue(&string, pSection, pKey);
+ bool result;
+ if (allow_empty) {
+ result = ReadValueEmpty(&string, pSection, pKey);
+ } else {
+ result = ReadValue(&string, pSection, pKey);
+ }
if (out_result)
*out_result = result;
std::vector<std::string> value_container;
@@ -2043,7 +2738,7 @@ std::vector<std::string> Profile::ReadStringContainer(
while (iss) {
if (!getline(iss, temp_str, ','))
break;
- value_container.push_back(temp_str);
+ value_container.push_back(trim_string(temp_str));
}
}
return value_container;
diff --git a/src/components/config_profile/test/ini_file_test.cc b/src/components/config_profile/test/ini_file_test.cc
index 0443f061a2..ca4f2fc849 100644
--- a/src/components/config_profile/test/ini_file_test.cc
+++ b/src/components/config_profile/test/ini_file_test.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "config_profile/ini_file.h"
+#include "gtest/gtest.h"
#include "utils/file_system.h"
namespace test {
diff --git a/src/components/config_profile/test/profile_test.cc b/src/components/config_profile/test/profile_test.cc
index e7d62f4740..7b9bb374b9 100644
--- a/src/components/config_profile/test/profile_test.cc
+++ b/src/components/config_profile/test/profile_test.cc
@@ -33,8 +33,8 @@
#include <algorithm>
#include <vector>
-#include "gtest/gtest.h"
#include "config_profile/profile.h"
+#include "gtest/gtest.h"
#include "utils/file_system.h"
#include "utils/threads/thread.h"
@@ -511,28 +511,58 @@ TEST_F(ProfileTest, StringUpperBoundValue) {
profile_.set_config_file_name("smartDeviceLink_invalid_string.ini");
EXPECT_EQ("smartDeviceLink_invalid_string.ini", profile_.config_file_name());
- // Total count of elements in ini file's string will be less 512
+ // Total count of elements in ini file's string will be less 1024
vr_help_title =
"0/0/0/1/"
"2345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~"
- "STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:"
- "yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!"
- "def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,"
- "01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_"
- "GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$"
- "mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890abc!"
- "def@ghi";
+ "STU{}WXY"
+ "[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-"
+ "DEF_GHIJKL+MNO|P"
+ "QR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*"
+ "vwx:yz()ABC-DEF_G"
+ "HIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%"
+ "pqr^stu*vwx:yz()"
+ "ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@"
+ "ghi#jkl$mno%pqr^stu*"
+ "vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890abc!def@ghi0/0/0/"
+ "1/2345678"
+ "'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]"
+ "Z,012345"
+ "67890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+"
+ "MNO|PQR~STU{}WX"
+ "Y[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-"
+ "DEF_GHIJKL+MNO|PQ"
+ "R~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:"
+ "yz()ABC-DEF_GHIJK"
+ "L+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^"
+ "stu*vwx:yz()ABC-";
EXPECT_EQ(vr_help_title, profile_.vr_help_title());
EXPECT_NE(vr_help_title, profile_.recording_file_name());
recording_file_name =
"0/0/0/1/"
"2345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~"
- "STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:"
- "yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!"
- "def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,"
- "01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_"
- "GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$"
- "mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890abc";
+ "STU{}WXY"
+ "[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-"
+ "DEF_GHIJKL+MNO|P"
+ "QR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*"
+ "vwx:yz()ABC-DEF_G"
+ "HIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%"
+ "pqr^stu*vwx:yz()"
+ "ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@"
+ "ghi#jkl$mno%pqr^stu*"
+ "vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890abc!def@ghi0/0/0/"
+ "1/2345678"
+ "'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]"
+ "Z,012345"
+ "67890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+"
+ "MNO|PQR~STU{}WX"
+ "Y[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-"
+ "DEF_GHIJKL+MNO|PQ"
+ "R~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:"
+ "yz()ABC-DEF_GHIJK"
+ "L+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^"
+ "stu*vwx:yz()ABC-"
+ "DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890abc!def@ghi01234";
EXPECT_EQ(recording_file_name, profile_.recording_file_name());
// Update config file
profile_.UpdateValues();
@@ -690,10 +720,34 @@ TEST_F(ProfileTest, CheckStringContainer) {
std::vector<std::string>::iterator element_mode = diagmodes_list.begin();
element_mode++;
element_mode++;
- diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), " 0x03");
+ diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), "0x03");
EXPECT_EQ(diag_mode, element_mode);
}
+TEST_F(ProfileTest, CheckStringContainerEmpty) {
+ // Set new config file
+ profile_.set_config_file_name("smartDeviceLink_test.ini");
+ EXPECT_EQ("smartDeviceLink_test.ini", profile_.config_file_name());
+
+ bool isread = false;
+ std::vector<std::string> output_list =
+ profile_.ReadStringContainer("MAIN", "AppConfigFolder", &isread);
+ EXPECT_FALSE(isread);
+ EXPECT_TRUE(output_list.empty());
+
+ isread = false;
+ std::vector<std::string> output_list2 =
+ profile_.ReadStringContainer("MAIN", "AppConfigFolder", &isread, true);
+ EXPECT_TRUE(isread);
+ EXPECT_TRUE(output_list2.empty());
+
+ isread = false;
+ std::vector<std::string> output_list3 =
+ profile_.ReadStringContainer("MAIN", "DoesNotExistKey", &isread, true);
+ EXPECT_FALSE(isread);
+ EXPECT_TRUE(output_list2.empty());
+}
+
#ifdef ENABLE_SECURITY
TEST_F(ProfileTest, CheckIntContainerInSecurityData) {
// Set new config file
diff --git a/src/components/config_profile/test/smartDeviceLink_invalid_string.ini b/src/components/config_profile/test/smartDeviceLink_invalid_string.ini
index f18b43cb41..430cc31f84 100644
--- a/src/components/config_profile/test/smartDeviceLink_invalid_string.ini
+++ b/src/components/config_profile/test/smartDeviceLink_invalid_string.ini
@@ -82,7 +82,7 @@ AudioStreamFile = audio_stream_file
; Recording file source (used for audio pass thru emulation only)
RecordingFileSource = 00012\\345/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012\\345/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012\\345/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012\\345/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012\\345/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a
; Recording file for audio pass thru
-RecordingFileName = 0/0/0/1/2345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890abc!def@ghi
+RecordingFileName = 0/0/0/1/2345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890abc!def@ghi0/0/0/1/2345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890abc!def@ghi01234
; HelpPromt and TimeOutPrompt is a vector of strings separated by comma
[GLOBAL PROPERTIES]
@@ -94,7 +94,7 @@ TTSDelimiter = coma and point
HelpPromt = Please speak one of the following commands,Please say a command
; Default prompt items, separated by comma
TimeOutPromt = Please speak one of the following commands,Please say a command
-HelpTitle = 0/0/0/1/2345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890abc!def@ghi
+HelpTitle = 0/0/0/1/2345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890abc!def@ghi0/0/0/1/2345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHIJKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012345678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-
; In case mobile app didn't send global properties default global properties will be sent after this timeout
; max value TTSGlobalPropertiesTimeout 64K
TTSGlobalPropertiesTimeout = 20
diff --git a/src/components/connection_handler/CMakeLists.txt b/src/components/connection_handler/CMakeLists.txt
index fd2aa876cd..30199b2014 100644
--- a/src/components/connection_handler/CMakeLists.txt
+++ b/src/components/connection_handler/CMakeLists.txt
@@ -36,6 +36,8 @@ include_directories (
${COMPONENTS_DIR}/utils/include/
${ENCRYPTION_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
+ ${JSONCPP_INCLUDE_DIRECTORY}
)
set(PATHS
diff --git a/src/components/connection_handler/include/connection_handler/connection.h b/src/components/connection_handler/include/connection_handler/connection.h
index 9b72d60776..7e4ab6a24e 100644
--- a/src/components/connection_handler/include/connection_handler/connection.h
+++ b/src/components/connection_handler/include/connection_handler/connection.h
@@ -36,12 +36,12 @@
#include <map>
#include <vector>
-#include "utils/lock.h"
-#include "utils/threads/thread.h"
#include "connection_handler/device.h"
#include "connection_handler/heartbeat_monitor.h"
#include "protocol/service_type.h"
#include "protocol_handler/protocol_packet.h"
+#include "utils/lock.h"
+#include "utils/threads/thread.h"
#ifdef ENABLE_SECURITY
namespace security_manager {
@@ -72,13 +72,18 @@ typedef std::map<int32_t, Connection*> ConnectionList;
*/
struct Service {
protocol_handler::ServiceType service_type;
+ transport_manager::ConnectionUID connection_id;
bool is_protected_;
Service()
: service_type(protocol_handler::kInvalidServiceType)
+ , connection_id(0)
, is_protected_(false) {}
- explicit Service(protocol_handler::ServiceType service_type)
- : service_type(service_type), is_protected_(false) {}
+ explicit Service(protocol_handler::ServiceType service_type,
+ transport_manager::ConnectionUID connection_id)
+ : service_type(service_type)
+ , connection_id(connection_id)
+ , is_protected_(false) {}
bool operator==(const protocol_handler::ServiceType service_type) const {
return this->service_type == service_type;
@@ -154,9 +159,11 @@ class Connection {
/**
* @brief Adds session to connection
+ * @param connection_handle Connection Handle for the session
* @return new session id or 0 in case of issues
*/
- uint32_t AddNewSession();
+ uint32_t AddNewSession(
+ const transport_manager::ConnectionUID connection_handle);
/**
* @brief Removes session from connection
@@ -171,11 +178,13 @@ class Connection {
* @param session_id session ID
* @param service_type Type of service
* @param is_protected protection state
+ * @param connection_id Connection ID associated with the service
* @return TRUE on success, otherwise FALSE
*/
bool AddNewService(uint8_t session_id,
protocol_handler::ServiceType service_type,
- const bool is_protected);
+ const bool is_protected,
+ transport_manager::ConnectionUID connection_id);
/**
* @brief Removes service from session
* @param session_id session ID
@@ -184,6 +193,18 @@ class Connection {
*/
bool RemoveService(uint8_t session_id,
protocol_handler::ServiceType service_type);
+
+ /**
+ * @brief Removes secondary service from session
+ * @param secondary_connection_handle connection identifying services to be
+ * removed
+ * @param removed_services_list Returned: List of service types removed
+ * @return the session ID associated with the services removed
+ */
+ uint8_t RemoveSecondaryServices(
+ transport_manager::ConnectionUID secondary_connection_handle,
+ std::list<protocol_handler::ServiceType>& removed_services_list);
+
#ifdef ENABLE_SECURITY
/**
* @brief Sets crypto context of service
@@ -213,10 +234,11 @@ class Connection {
const protocol_handler::ServiceType& service_type);
#endif // ENABLE_SECURITY
- /**
- * @brief Returns map of sessions which have been opened in
- * current connection.
- */
+
+ /**
+ * @brief Returns map of sessions which have been opened in
+ * current connection.
+ */
const SessionMap session_map() const;
/**
@@ -283,6 +305,20 @@ class Connection {
*/
bool ProtocolVersion(uint8_t session_id, uint8_t& protocol_version);
+ /**
+ * @brief Returns the primary connection handle associated with this
+ * connection
+ * @return ConnectionHandle
+ */
+ ConnectionHandle primary_connection_handle() const;
+
+ /**
+ * @brief Sets the primary connection handle
+ * @param primary_connection_handle the primary connection handle to
+ * associate with this connection
+ */
+ void SetPrimaryConnectionHandle(ConnectionHandle primary_connection_handle);
+
private:
/**
* @brief Current connection handler.
@@ -304,7 +340,12 @@ class Connection {
*/
SessionMap session_map_;
- mutable sync_primitives::Lock session_map_lock_;
+ mutable sync_primitives::RecursiveLock session_map_lock_;
+
+ /**
+ * @brief primary connection handle for secondary connections
+ */
+ ConnectionHandle primary_connection_handle_;
/**
* @brief monitor that closes connection if there is no traffic over it
diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
index e270d9faeb..b2b4c5a970 100644
--- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
+++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h
@@ -33,32 +33,35 @@
#ifndef SRC_COMPONENTS_CONNECTION_HANDLER_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_IMPL_H_
#define SRC_COMPONENTS_CONNECTION_HANDLER_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_IMPL_H_
-#include <map>
#include <list>
+#include <map>
#include <string>
#include <vector>
-#include "transport_manager/transport_manager_listener_empty.h"
-#include "protocol_handler/session_observer.h"
-#include "protocol_handler/protocol_handler.h"
+#include "connection_handler/connection.h"
+#include "connection_handler/connection_handler.h"
#include "connection_handler/connection_handler_observer.h"
#include "connection_handler/device.h"
-#include "connection_handler/connection.h"
#include "connection_handler/devices_discovery_starter.h"
-#include "connection_handler/connection_handler.h"
+#include "protocol_handler/protocol_handler.h"
+#include "protocol_handler/session_observer.h"
+#include "transport_manager/transport_manager_listener_empty.h"
+#include "utils/lock.h"
#include "utils/logger.h"
#include "utils/macro.h"
#include "utils/message_queue.h"
-#include "utils/lock.h"
-#include "utils/stl_utils.h"
#include "utils/rwlock.h"
+#include "utils/stl_utils.h"
+
+const transport_manager::ConnectionUID kDisabledSecondary = 0xFFFFFFFF;
/**
* \namespace connection_handler
* \brief SmartDeviceLink connection_handler namespace.
*/
namespace connection_handler {
+
/**
* \class ConnectionHandlerImpl
* \brief SmartDeviceLink connection_handler main class
@@ -78,7 +81,7 @@ class ConnectionHandlerImpl
ConnectionHandlerImpl(const ConnectionHandlerSettings& settings,
transport_manager::TransportManager& tm);
/**
- * \brief Destructor
+ * @brief Destructor
*/
~ConnectionHandlerImpl();
@@ -99,11 +102,21 @@ class ConnectionHandlerImpl
/**
* \brief Connects to all services of device
- * \param deviceHandle Handle of device to connect to
+ * \param device_handle Handle of device to connect to
*/
void ConnectToDevice(connection_handler::DeviceHandle device_handle) OVERRIDE;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ transport_manager::ConnectionStatus GetConnectionStatus(
+ const DeviceHandle& device_handle) const OVERRIDE;
+
+ /**
* @brief RunAppOnDevice allows to run specific application on the certain
*device.
*
@@ -117,6 +130,13 @@ class ConnectionHandlerImpl
void ConnectToAllDevices() OVERRIDE;
+ void AddCloudAppDevice(
+ const std::string& policy_app_id,
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) OVERRIDE;
+
+ void RemoveCloudAppDevice(const DeviceHandle device_id) OVERRIDE;
+
void StartTransportManager() OVERRIDE;
void OnDeviceListUpdated(
@@ -159,6 +179,16 @@ class ConnectionHandlerImpl
void OnScanDevicesFailed(
const transport_manager::SearchDeviceError& error) OVERRIDE;
+ void OnConnectionStatusUpdated() OVERRIDE;
+
+ /**
+ * \brief Notifies about pending connection.
+ *
+ * \param connection_id ID of new connection.
+ **/
+ void OnConnectionPending(
+ const transport_manager::DeviceInfo& device_info,
+ const transport_manager::ConnectionUID connection_id) OVERRIDE;
/**
* \brief Notifies about established connection.
*
@@ -193,25 +223,6 @@ class ConnectionHandlerImpl
/**
* \brief Callback function used by ProtocolHandler
* when Mobile Application initiates start of new session.
- * \param connection_handle Connection identifier within which session has to
- * be started.
- * \param session_id Identifier of the session to be started
- * \param service_type Type of service
- * \param is_protected would be service protected
- * \param hash_id pointer for session hash identifier
- * \return uint32_t Id (number) of new session if successful, otherwise 0.
- * \deprecated
- */
- virtual uint32_t OnSessionStartedCallback(
- const transport_manager::ConnectionUID connection_handle,
- const uint8_t session_id,
- const protocol_handler::ServiceType& service_type,
- const bool is_protected,
- uint32_t* hash_id);
-
- /**
- * \brief Callback function used by ProtocolHandler
- * when Mobile Application initiates start of new session.
* Result must be notified through NotifySessionStartedContext().
* \param connection_handle Connection identifier within which session
* has to be started.
@@ -227,22 +238,7 @@ class ConnectionHandlerImpl
const protocol_handler::ServiceType& service_type,
const bool is_protected,
const BsonObject* params);
- /**
- * \brief Callback function used by ProtocolHandler
- * when Mobile Application initiates session ending.
- * \param connection_handle Connection identifier within which session exists
- * \param sessionId Identifier of the session to be ended
- * \param hashCode Hash used only in second version of SmartDeviceLink
- * protocol.
- * If not equal to hash assigned to session on start then operation fails.
- * \return uint32_t 0 if operation fails, session key otherwise
- * \deprecated
- */
- uint32_t OnSessionEndedCallback(
- const transport_manager::ConnectionUID connection_handle,
- const uint8_t session_id,
- const uint32_t& hashCode,
- const protocol_handler::ServiceType& service_type) OVERRIDE;
+
/**
* \brief Callback function used by ProtocolHandler
* when Mobile Application initiates session ending.
@@ -274,6 +270,24 @@ class ConnectionHandlerImpl
void OnMalformedMessageCallback(const uint32_t& connection_key) OVERRIDE;
/**
+ * @brief Converts connection handle to transport type string used in
+ * smartDeviceLink.ini file, e.g. "TCP_WIFI"
+ * @param connection_handle A connection identifier
+ * @return string representation of the transport of the device
+ */
+ const std::string TransportTypeProfileStringFromConnHandle(
+ transport_manager::ConnectionUID connection_handle) const;
+
+ /**
+ * @brief Converts device handle to transport type string used in
+ * smartDeviceLink.ini file, e.g. "TCP_WIFI"
+ * @param device_handle A device handle
+ * @return string representation of the transport of the device
+ */
+ const std::string TransportTypeProfileStringFromDeviceHandle(
+ DeviceHandle device_handle) const;
+
+ /**
* \brief Creates unique identifier of session (can be used as hash)
* from given connection identifier
* within which session exists and session number.
@@ -365,6 +379,15 @@ class ConnectionHandlerImpl
const protocol_handler::ServiceType& service_type) const OVERRIDE;
/**
+ * @brief Get cloud app id by connection id
+ * @param connection_id unique connection id
+ * @return the policy app id of the cloud app if the connection is tied to a
+ * cloud app, an empty string otherwise.
+ */
+ std::string GetCloudAppID(
+ const transport_manager::ConnectionUID connection_id) const OVERRIDE;
+
+ /**
* \brief Get device handle by mac address
* \param mac_address uniq address
* \param device_handle
@@ -509,6 +532,43 @@ class ConnectionHandlerImpl
DevicesDiscoveryStarter& get_device_discovery_starter();
/**
+ * \brief Add a session. This is meant to be called from Connection class.
+ * \param primary_transport_id the primary connection ID to associate with the
+ * newly created session
+ * \return new session id, or 0 if failed
+ **/
+ uint32_t AddSession(
+ const transport_manager::ConnectionUID primary_transport_id) OVERRIDE;
+
+ /**
+ * \brief Remove a session. This is meant to be called from Connection class.
+ * \param session_id ID of the session to remove
+ * \return true if successful, false otherwise
+ **/
+ bool RemoveSession(uint8_t session_id) OVERRIDE;
+
+ DataAccessor<SessionConnectionMap> session_connection_map() OVERRIDE;
+
+ /**
+ * \brief Associate a secondary transport ID with a session
+ * \param session_id the session ID
+ * \param connection_id the new secondary connection ID to associate with the
+ * session
+ * \return the SessionTransports (newly) associated with the session
+ **/
+ SessionTransports SetSecondaryTransportID(
+ uint8_t session_id,
+ transport_manager::ConnectionUID secondary_transport_id) OVERRIDE;
+
+ /**
+ * \brief Retrieve the session transports associated with a session
+ * \param session_id the session ID
+ * \return the SessionTransports associated with the session
+ **/
+ const SessionTransports GetSessionTransports(
+ uint8_t session_id) const OVERRIDE;
+
+ /**
* \brief Invoked when observer's OnServiceStartedCallback is completed
* \param session_key the key of started session passed to
* OnServiceStartedCallback().
@@ -524,6 +584,32 @@ class ConnectionHandlerImpl
bool result,
std::vector<std::string>& rejected_params);
+ /**
+ * \brief Called when secondary transport with given session ID is established
+ * \param primary_connection_handle Set to identifier of primary connection
+ * \param secondary_connection_handle Identifier of secondary connection
+ * \param sessionid session ID taken from Register Secondary Transport frame
+ **/
+ bool OnSecondaryTransportStarted(
+ transport_manager::ConnectionUID& primary_connection_handle,
+ const transport_manager::ConnectionUID secondary_connection_handle,
+ const uint8_t session_id) OVERRIDE;
+
+ /**
+ * \brief Called when secondary transport shuts down
+ * \param primary_connection_handle Identifier of primary connection
+ * \param secondary_connection_handle Identifier of secondary connection
+ * transport
+ **/
+ void OnSecondaryTransportEnded(
+ const transport_manager::ConnectionUID primary_connection_handle,
+ const transport_manager::ConnectionUID secondary_connection_handle)
+ OVERRIDE;
+
+ const transport_manager::DeviceInfo& GetWebEngineDeviceInfo() const OVERRIDE;
+
+ void CreateWebEngineDevice() OVERRIDE;
+
private:
/**
* \brief Disconnect application.
@@ -535,6 +621,18 @@ class ConnectionHandlerImpl
void OnConnectionEnded(const transport_manager::ConnectionUID connection_id);
+ const uint8_t GetSessionIdFromSecondaryTransport(
+ transport_manager::ConnectionUID secondary_transport_id) const;
+
+ /**
+ * @brief Get pointer to the primary connection by connection handle
+ * @param connection_handle handle of the current connection
+ * @return pointer to the primary connection if current one is secondary
+ * otherwise returns pointer to the same connection
+ */
+ Connection* GetPrimaryConnection(
+ const ConnectionHandle connection_handle) const;
+
const ConnectionHandlerSettings& settings_;
/**
* \brief Pointer to observer
@@ -552,6 +650,13 @@ class ConnectionHandlerImpl
* \brief List of devices
*/
DeviceMap device_list_;
+ mutable sync_primitives::RWLock device_list_lock_;
+ /**
+ * @brief session/connection map
+ */
+ SessionConnectionMap session_connection_map_;
+ mutable std::shared_ptr<sync_primitives::RecursiveLock>
+ session_connection_map_lock_ptr_;
/**
* \brief List of connections
@@ -573,6 +678,17 @@ class ConnectionHandlerImpl
std::map<uint32_t, protocol_handler::SessionContext>
start_service_context_map_;
+ // Map app id -> (cloud_app_endpoint, connection_uid)
+ mutable sync_primitives::Lock cloud_app_id_map_lock_;
+ std::map<std::string,
+ std::pair<std::string, transport_manager::ConnectionUID> >
+ cloud_app_id_map_;
+
+ /**
+ * @brief connection object as it's being closed
+ */
+ Connection* ending_connection_;
+
#ifdef BUILD_TESTS
// Methods for test usage
public:
@@ -581,6 +697,9 @@ class ConnectionHandlerImpl
void addDeviceConnection(
const transport_manager::DeviceInfo& device_info,
const transport_manager::ConnectionUID connection_id);
+ SessionConnectionMap& getSessionConnectionMap() {
+ return session_connection_map_;
+ }
#endif
private:
DISALLOW_COPY_AND_ASSIGN(ConnectionHandlerImpl);
diff --git a/src/components/connection_handler/include/connection_handler/device.h b/src/components/connection_handler/include/connection_handler/device.h
index 26376c1d8d..1cad7a72c5 100644
--- a/src/components/connection_handler/include/connection_handler/device.h
+++ b/src/components/connection_handler/include/connection_handler/device.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_CONNECTION_HANDLER_INCLUDE_CONNECTION_HANDLER_DEVICE_H_
#define SRC_COMPONENTS_CONNECTION_HANDLER_INCLUDE_CONNECTION_HANDLER_DEVICE_H_
-#include <string>
#include <map>
+#include <string>
#include <vector>
#include "transport_manager/common.h"
@@ -77,9 +77,9 @@ class Device {
std::string user_friendly_name() const;
/**
- *\brief Also should be used for iOS USB connections
- *(better not know why this same method)
- */
+ *\brief Also should be used for iOS USB connections
+ *(better not know why this same method)
+ */
std::string mac_address() const;
/**
diff --git a/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h b/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
index 4d1d07112c..9e04929f79 100644
--- a/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
+++ b/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
@@ -35,11 +35,11 @@
#include <stdint.h>
#include <map>
-#include "utils/threads/thread.h"
-#include "utils/threads/thread_delegate.h"
#include "utils/date_time.h"
-#include "utils/macro.h"
#include "utils/lock.h"
+#include "utils/macro.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/thread_delegate.h"
namespace connection_handler {
@@ -64,7 +64,7 @@ class HeartBeatMonitor : public threads::ThreadDelegate {
void RemoveSession(uint8_t session_id);
/**
- * \brief Resets timer preventing session from being killed
+ * \brief Resets timer preventing session from being killed
*/
void KeepAlive(uint8_t session_id);
@@ -102,7 +102,7 @@ class HeartBeatMonitor : public threads::ThreadDelegate {
void RefreshExpiration();
uint32_t heartbeat_timeout_mseconds_;
- TimevalStruct heartbeat_expiration_;
+ date_time::TimeDuration heartbeat_expiration_;
bool is_heartbeat_sent_;
};
@@ -111,7 +111,7 @@ class HeartBeatMonitor : public threads::ThreadDelegate {
typedef std::map<uint8_t, SessionState> SessionMap;
SessionMap sessions_;
- sync_primitives::Lock sessions_list_lock_; // recurcive
+ sync_primitives::RecursiveLock sessions_list_lock_; // recurcive
sync_primitives::Lock main_thread_lock_;
mutable sync_primitives::Lock heartbeat_timeout_seconds_lock_;
sync_primitives::ConditionalVariable heartbeat_monitor_;
diff --git a/src/components/connection_handler/src/connection.cc b/src/components/connection_handler/src/connection.cc
index 614120312a..304be9ddb0 100644
--- a/src/components/connection_handler/src/connection.cc
+++ b/src/components/connection_handler/src/connection.cc
@@ -37,13 +37,13 @@
#include "connection_handler/connection.h"
#include "connection_handler/connection_handler.h"
#include "protocol_handler/protocol_packet.h"
+#include "utils/helpers.h"
#include "utils/logger.h"
#include "utils/macro.h"
-#include "utils/helpers.h"
#ifdef ENABLE_SECURITY
-#include "security_manager/ssl_context.h"
#include "security_manager/security_manager.h"
+#include "security_manager/ssl_context.h"
#endif // ENABLE_SECURITY
/**
@@ -81,7 +81,7 @@ Connection::Connection(ConnectionHandle connection_handle,
: connection_handler_(connection_handler)
, connection_handle_(connection_handle)
, connection_device_handle_(connection_device_handle)
- , session_map_lock_(true)
+ , primary_connection_handle_(0)
, heartbeat_timeout_(heartbeat_timeout) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK(connection_handler_);
@@ -97,39 +97,62 @@ Connection::~Connection() {
heart_beat_monitor_thread_->join();
delete heartbeat_monitor_;
threads::DeleteThread(heart_beat_monitor_thread_);
- sync_primitives::AutoLock lock(session_map_lock_);
- session_map_.clear();
-}
-// Finds a key not presented in std::map<unsigned char, T>
-// Returns 0 if that key not found
-namespace {
-template <class T>
-uint32_t findGap(const std::map<unsigned char, T>& map) {
- for (uint32_t i = 1; i <= UCHAR_MAX; ++i) {
- if (map.find(i) == map.end()) {
- return i;
- }
+ // Before clearing out the session_map_, we must remove all sessions
+ // associated with this Connection from the SessionConnectionMap.
+
+ // NESTED LOCK: make sure to lock session_map_lock_ then ConnectionHandler's
+ // session_connection_map_lock_ptr_ (which will be taken in RemoveSession).
+ sync_primitives::AutoLock lock(session_map_lock_);
+ SessionMap::iterator session_it = session_map_.begin();
+ while (session_it != session_map_.end()) {
+ LOG4CXX_INFO(
+ logger_,
+ "Removed Session ID "
+ << static_cast<int>(session_it->first)
+ << " from Session/Connection Map in Connection Destructor");
+ connection_handler_->RemoveSession(session_it->first);
+ session_it++;
}
- return 0;
+
+ session_map_.clear();
}
-} // namespace
-uint32_t Connection::AddNewSession() {
+uint32_t Connection::AddNewSession(
+ const transport_manager::ConnectionUID connection_handle) {
LOG4CXX_AUTO_TRACE(logger_);
+
+ // NESTED LOCK: make sure to lock session_map_lock_ then ConnectionHandler's
+ // session_connection_map_lock_ptr_ (which will be taken in AddSession)
sync_primitives::AutoLock lock(session_map_lock_);
- const uint32_t session_id = findGap(session_map_);
+
+ // Even though we have our own SessionMap, we use the Connection Handler's
+ // SessionConnectionMap to generate a session ID. We want to make sure that
+ // session IDs are globally unique, and not only unique within a Connection.
+ const uint32_t session_id =
+ connection_handler_->AddSession(connection_handle);
if (session_id > 0) {
Session& new_session = session_map_[session_id];
new_session.protocol_version = ::protocol_handler::PROTOCOL_VERSION_2;
- new_session.service_list.push_back(Service(protocol_handler::kRpc));
- new_session.service_list.push_back(Service(protocol_handler::kBulk));
+ new_session.service_list.push_back(
+ Service(protocol_handler::kRpc, connection_handle));
+ new_session.service_list.push_back(
+ Service(protocol_handler::kBulk, connection_handle));
}
+
return session_id;
}
uint32_t Connection::RemoveSession(uint8_t session_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // Again, a NESTED lock, but it follows the rules.
sync_primitives::AutoLock lock(session_map_lock_);
+
+ if (!connection_handler_->RemoveSession(session_id)) {
+ return 0;
+ }
+
SessionMap::iterator it = session_map_.find(session_id);
if (session_map_.end() == it) {
LOG4CXX_WARN(logger_, "Session not found in this connection!");
@@ -137,12 +160,14 @@ uint32_t Connection::RemoveSession(uint8_t session_id) {
}
heartbeat_monitor_->RemoveSession(session_id);
session_map_.erase(session_id);
+
return session_id;
}
bool Connection::AddNewService(uint8_t session_id,
protocol_handler::ServiceType service_type,
- const bool request_protection) {
+ const bool request_protection,
+ transport_manager::ConnectionUID connection_id) {
// Ignore wrong services
if (protocol_handler::kControl == service_type ||
protocol_handler::kInvalidServiceType == service_type) {
@@ -152,7 +177,9 @@ bool Connection::AddNewService(uint8_t session_id,
LOG4CXX_DEBUG(logger_,
"Add service " << service_type << " for session "
- << static_cast<uint32_t>(session_id));
+ << static_cast<uint32_t>(session_id)
+ << " using connection ID "
+ << static_cast<uint32_t>(connection_id));
sync_primitives::AutoLock lock(session_map_lock_);
SessionMap::iterator session_it = session_map_.find(session_id);
@@ -163,12 +190,11 @@ bool Connection::AddNewService(uint8_t session_id,
Session& session = session_it->second;
if (session.protocol_version <= protocol_handler::PROTOCOL_VERSION_2 &&
- helpers::Compare<protocol_handler::ServiceType,
- helpers::EQ,
- helpers::ONE>(
- service_type,
- protocol_handler::ServiceType::kAudio,
- protocol_handler::ServiceType::kMobileNav)) {
+ helpers::
+ Compare<protocol_handler::ServiceType, helpers::EQ, helpers::ONE>(
+ service_type,
+ protocol_handler::ServiceType::kAudio,
+ protocol_handler::ServiceType::kMobileNav)) {
LOG4CXX_WARN(logger_,
"Audio and video services are disallowed for protocol version "
"2 or lower");
@@ -201,7 +227,7 @@ bool Connection::AddNewService(uint8_t session_id,
#endif // ENABLE_SECURITY
}
// id service is not exists
- session.service_list.push_back(Service(service_type));
+ session.service_list.push_back(Service(service_type, connection_id));
return true;
}
@@ -238,14 +264,73 @@ bool Connection::RemoveService(uint8_t session_id,
find(service_list.begin(), service_list.end(), service_type);
if (service_list.end() == service_it) {
LOG4CXX_WARN(logger_,
- "Session " << session_id << " didn't established"
- " service " << service_type);
+ "Session " << session_id
+ << " didn't established"
+ " service "
+ << service_type);
return false;
}
service_list.erase(service_it);
return true;
}
+uint8_t Connection::RemoveSecondaryServices(
+ transport_manager::ConnectionUID secondary_connection_handle,
+ std::list<protocol_handler::ServiceType>& removed_services_list) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ uint8_t found_session_id = 0;
+ sync_primitives::AutoLock lock(session_map_lock_);
+
+ LOG4CXX_INFO(logger_,
+ "RemoveSecondaryServices looking for services on Connection ID "
+ << static_cast<int>(secondary_connection_handle));
+
+ // Walk the SessionMap in the primary connection, and for each
+ // Session, we walk its ServiceList, looking for all the services
+ // that were running on the now-closed Secondary Connection.
+ for (SessionMap::iterator session_it = session_map_.begin();
+ session_map_.end() != session_it;
+ ++session_it) {
+ LOG4CXX_INFO(logger_,
+ "RemoveSecondaryServices found session ID "
+ << static_cast<int>(session_it->first));
+
+ // Now, for each session, walk the its ServiceList, looking for services
+ // that were using secondary)_connection_handle. If we find such a service,
+ // set session_found and break out of the outer loop.
+ ServiceList& service_list = session_it->second.service_list;
+ ServiceList::iterator service_it = service_list.begin();
+ for (; service_it != service_list.end();) {
+ LOG4CXX_INFO(logger_,
+ "RemoveSecondaryServices found service ID "
+ << static_cast<int>(service_it->service_type));
+ if (service_it->connection_id == secondary_connection_handle) {
+ found_session_id = session_it->first;
+
+ LOG4CXX_INFO(logger_,
+ "RemoveSecondaryServices removing Service "
+ << static_cast<int>(service_it->service_type)
+ << " in session "
+ << static_cast<int>(found_session_id));
+
+ removed_services_list.push_back(service_it->service_type);
+ service_it = service_list.erase(service_it);
+ } else {
+ service_it++;
+ }
+ }
+
+ // If we found a session that had services running on the secondary
+ // connection, we're done.
+ if (found_session_id != 0) {
+ break;
+ }
+ }
+
+ return found_session_id;
+}
+
#ifdef ENABLE_SECURITY
int Connection::SetSSLContext(uint8_t session_id,
security_manager::SSLContext* context) {
@@ -346,7 +431,6 @@ const SessionMap Connection::session_map() const {
}
void Connection::CloseSession(uint8_t session_id) {
- size_t size;
{
sync_primitives::AutoLock lock(session_map_lock_);
@@ -354,16 +438,10 @@ void Connection::CloseSession(uint8_t session_id) {
if (session_it == session_map_.end()) {
return;
}
- size = session_map_.size();
}
connection_handler_->CloseSession(
connection_handle_, session_id, connection_handler::kCommon);
-
- // Close connection if it is last session
- if (1 == size) {
- connection_handler_->CloseConnection(connection_handle_);
- }
}
void Connection::UpdateProtocolVersionSession(uint8_t session_id,
@@ -405,6 +483,15 @@ bool Connection::ProtocolVersion(uint8_t session_id,
return true;
}
+ConnectionHandle Connection::primary_connection_handle() const {
+ return primary_connection_handle_;
+}
+
+void Connection::SetPrimaryConnectionHandle(
+ ConnectionHandle primary_connection_handle) {
+ primary_connection_handle_ = primary_connection_handle;
+}
+
void Connection::StartHeartBeat(uint8_t session_id) {
heartbeat_monitor_->AddSession(session_id);
}
diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc
index 83d80d9696..1ad938332a 100644
--- a/src/components/connection_handler/src/connection_handler_impl.cc
+++ b/src/components/connection_handler/src/connection_handler_impl.cc
@@ -31,14 +31,14 @@
*/
#include <strings.h>
-#include <string>
-#include <list>
#include <algorithm>
+#include <list>
#include <memory>
+#include <string>
#include "connection_handler/connection_handler_impl.h"
-#include "transport_manager/info.h"
#include "encryption/hashing.h"
+#include "transport_manager/info.h"
#ifdef ENABLE_SECURITY
#include "security_manager/security_manager.h"
@@ -68,11 +68,14 @@ ConnectionHandlerImpl::ConnectionHandlerImpl(
, connection_handler_observer_(NULL)
, transport_manager_(tm)
, protocol_handler_(NULL)
+ , session_connection_map_lock_ptr_(
+ std::make_shared<sync_primitives::RecursiveLock>())
, connection_list_lock_()
, connection_handler_observer_lock_()
, connection_list_deleter_(&connection_list_)
, start_service_context_map_lock_()
- , start_service_context_map_() {}
+ , start_service_context_map_()
+ , ending_connection_(NULL) {}
ConnectionHandlerImpl::~ConnectionHandlerImpl() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -92,9 +95,9 @@ void ConnectionHandlerImpl::Stop() {
void ConnectionHandlerImpl::set_connection_handler_observer(
ConnectionHandlerObserver* observer) {
- LOG4CXX_DEBUG(logger_,
- "ConnectionHandlerImpl::set_connection_handler_observer() "
- << observer);
+ LOG4CXX_DEBUG(
+ logger_,
+ "ConnectionHandlerImpl::set_connection_handler_observer() " << observer);
sync_primitives::AutoWriteLock write_lock(connection_handler_observer_lock_);
if (!observer) {
LOG4CXX_WARN(logger_, "Set Null pointer to observer.");
@@ -104,9 +107,9 @@ void ConnectionHandlerImpl::set_connection_handler_observer(
void ConnectionHandlerImpl::set_protocol_handler(
protocol_handler::ProtocolHandler* protocol_handler) {
- LOG4CXX_DEBUG(logger_,
- "ConnectionHandlerImpl::set_protocol_handler()"
- << protocol_handler);
+ LOG4CXX_DEBUG(
+ logger_,
+ "ConnectionHandlerImpl::set_protocol_handler()" << protocol_handler);
if (!protocol_handler) {
LOG4CXX_WARN(logger_, "Set Null pointer to protocol handler.");
}
@@ -117,6 +120,7 @@ void ConnectionHandlerImpl::OnDeviceListUpdated(
const std::vector<transport_manager::DeviceInfo>&) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
+ sync_primitives::AutoReadLock lock(device_list_lock_);
if (connection_handler_observer_) {
connection_handler_observer_->OnDeviceListUpdated(device_list_);
}
@@ -139,19 +143,31 @@ void ConnectionHandlerImpl::OnDeviceAdded(
LOG4CXX_AUTO_TRACE(logger_);
auto handle = device_info.device_handle();
+ LOG4CXX_DEBUG(logger_,
+ "OnDeviceAdded!!!: " << handle << " " << device_info.name()
+ << " " << device_info.mac_address() << " "
+ << device_info.connection_type());
+
Device device(handle,
device_info.name(),
device_info.mac_address(),
device_info.connection_type());
- auto result = device_list_.insert(std::make_pair(handle, device));
+ {
+ sync_primitives::AutoWriteLock write_lock(device_list_lock_);
+ auto result = device_list_.insert(std::make_pair(handle, device));
- if (!result.second) {
- LOG4CXX_ERROR(logger_,
- "Device with handle " << handle
- << " is known already. "
- "Information won't be updated.");
- return;
+ if (!result.second) {
+ LOG4CXX_ERROR(logger_,
+ "Device with handle " << handle
+ << " is known already. "
+ "Information won't be updated.");
+ return;
+ }
+ }
+ if (device_info.name() ==
+ transport_manager::webengine_constants::kWebEngineDeviceName) {
+ connection_handler_observer_->OnWebEngineDeviceCreated();
}
}
@@ -161,7 +177,6 @@ void ConnectionHandlerImpl::OnDeviceRemoved(
// Device has been removed. Perform all needed actions.
// 1. Delete all the connections and sessions of this device
// 2. Delete device from a list
- // 3. Let observer know that device has been deleted.
std::vector<ConnectionHandle> connections_to_remove;
{
@@ -182,11 +197,13 @@ void ConnectionHandlerImpl::OnDeviceRemoved(
}
sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
+ {
+ sync_primitives::AutoWriteLock lock(device_list_lock_);
+ device_list_.erase(device_info.device_handle());
+ }
if (connection_handler_observer_) {
connection_handler_observer_->RemoveDevice(device_info.device_handle());
- connection_handler_observer_->OnDeviceListUpdated(device_list_);
}
- device_list_.erase(device_info.device_handle());
}
void ConnectionHandlerImpl::OnDeviceSwitchingFinish(
@@ -213,6 +230,8 @@ struct DeviceFinder {
void ConnectionHandlerImpl::OnDeviceSwitchingStart(
const std::string& device_uid_from, const std::string& device_uid_to) {
+ sync_primitives::AutoReadLock lock(device_list_lock_);
+
auto device_from =
std::find_if(device_list_.begin(),
device_list_.end(),
@@ -241,25 +260,93 @@ void ConnectionHandlerImpl::OnScanDevicesFailed(
LOG4CXX_WARN(logger_, "Scan devices failed. " << error.text());
}
-void ConnectionHandlerImpl::OnConnectionEstablished(
+void ConnectionHandlerImpl::OnConnectionStatusUpdated() {
+ connection_handler_observer_->OnConnectionStatusUpdated();
+}
+
+void ConnectionHandlerImpl::OnConnectionPending(
const transport_manager::DeviceInfo& device_info,
const transport_manager::ConnectionUID connection_id) {
LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "OnConnectionPending!!!: " << device_info.device_handle() << " "
+ << device_info.name() << " "
+ << device_info.mac_address() << " "
+ << device_info.connection_type());
+ {
+ sync_primitives::AutoReadLock lock(device_list_lock_);
+ auto it = device_list_.find(device_info.device_handle());
- DeviceMap::iterator it = device_list_.find(device_info.device_handle());
- if (device_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown device!");
- return;
+ if (device_list_.end() == it) {
+ LOG4CXX_ERROR(logger_, "Unknown device!");
+ return;
+ }
+ }
+ LOG4CXX_DEBUG(logger_,
+ "Add Pending Connection #" << connection_id << " to the list.");
+
+ std::string endpoint = device_info.mac_address();
+ cloud_app_id_map_lock_.Acquire();
+ for (auto it = cloud_app_id_map_.begin(); it != cloud_app_id_map_.end();
+ ++it) {
+ if (endpoint == it->second.first) {
+ it->second.second = connection_id;
+ break;
+ }
+ }
+ cloud_app_id_map_lock_.Release();
+
+ sync_primitives::AutoWriteLock lock(connection_list_lock_);
+ if (connection_list_.find(connection_id) == connection_list_.end()) {
+ Connection* connection =
+ new Connection(connection_id,
+ device_info.device_handle(),
+ this,
+ get_settings().heart_beat_timeout());
+
+ connection_list_.insert(
+ ConnectionList::value_type(connection_id, connection));
+
+ connection_handler::DeviceHandle device_id =
+ connection->connection_device_handle();
+
+ connection_handler_observer_->CreatePendingApplication(
+ connection_id, device_info, device_id);
+ } else {
+ connection_handler_observer_->SetPendingApplicationState(connection_id,
+ device_info);
+ }
+}
+
+void ConnectionHandlerImpl::OnConnectionEstablished(
+ const transport_manager::DeviceInfo& device_info,
+ const transport_manager::ConnectionUID connection_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "OnConnectionEstablished!!!: "
+ << device_info.device_handle() << " " << device_info.name()
+ << " " << device_info.mac_address() << " "
+ << device_info.connection_type());
+ {
+ sync_primitives::AutoReadLock lock(device_list_lock_);
+ auto it = device_list_.find(device_info.device_handle());
+ if (device_list_.end() == it) {
+ LOG4CXX_ERROR(logger_, "Unknown device!");
+ return;
+ }
}
+
LOG4CXX_DEBUG(logger_,
"Add Connection #" << connection_id << " to the list.");
sync_primitives::AutoWriteLock lock(connection_list_lock_);
- connection_list_.insert(ConnectionList::value_type(
- connection_id,
- new Connection(connection_id,
- device_info.device_handle(),
- this,
- get_settings().heart_beat_timeout())));
+ if (connection_list_.find(connection_id) == connection_list_.end()) {
+ connection_list_.insert(ConnectionList::value_type(
+ connection_id,
+ new Connection(connection_id,
+ device_info.device_handle(),
+ this,
+ get_settings().heart_beat_timeout())));
+ }
}
void ConnectionHandlerImpl::OnConnectionFailed(
@@ -324,9 +411,9 @@ bool AllowProtection(const ConnectionHandlerSettings& settings,
if (std::find(force_unprotected_list.begin(),
force_unprotected_list.end(),
service_type) != force_unprotected_list.end()) {
- LOG4CXX_ERROR(logger_,
- "Service " << static_cast<int>(service_type)
- << " shall be protected");
+ LOG4CXX_ERROR(
+ logger_,
+ "Service " << static_cast<int>(service_type) << " shall be protected");
return false;
}
LOG4CXX_DEBUG(logger_,
@@ -335,86 +422,43 @@ bool AllowProtection(const ConnectionHandlerSettings& settings,
}
#endif // ENABLE_SECURITY
-uint32_t ConnectionHandlerImpl::OnSessionStartedCallback(
+void ConnectionHandlerImpl::OnSessionStartedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t session_id,
const protocol_handler::ServiceType& service_type,
const bool is_protected,
- uint32_t* hash_id) {
+ const BsonObject* params) {
LOG4CXX_AUTO_TRACE(logger_);
- if (hash_id) {
- *hash_id = protocol_handler::HASH_ID_WRONG;
- }
-
-#ifdef ENABLE_SECURITY
- if (!AllowProtection(get_settings(), service_type, is_protected)) {
- return 0;
- }
-#endif // ENABLE_SECURITY
- sync_primitives::AutoReadLock lock(connection_list_lock_);
- ConnectionList::iterator it = connection_list_.find(connection_handle);
- if (connection_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown connection!");
- return 0;
- }
- uint32_t new_session_id = 0;
+ std::vector<std::string> rejected_params;
- Connection* connection = it->second;
- if ((0 == session_id) && (protocol_handler::kRpc == service_type)) {
- new_session_id = connection->AddNewSession();
- if (0 == new_session_id) {
- LOG4CXX_ERROR(logger_, "Couldn't start new session!");
- return 0;
- }
- if (hash_id) {
- *hash_id = KeyFromPair(connection_handle, new_session_id);
- }
- } else { // Could be create new service or protected exists one
- if (!connection->AddNewService(session_id, service_type, is_protected)) {
- LOG4CXX_ERROR(logger_,
- "Couldn't establish "
-#ifdef ENABLE_SECURITY
- << (is_protected ? "protected" : "non-protected")
-#endif // ENABLE_SECURITY
- << " service " << static_cast<int>(service_type)
- << " for session " << static_cast<int>(session_id));
- return 0;
- }
- new_session_id = session_id;
- if (hash_id) {
- *hash_id = protocol_handler::HASH_ID_NOT_SUPPORTED;
- }
- }
- sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
- if (connection_handler_observer_) {
- const uint32_t session_key = KeyFromPair(connection_handle, new_session_id);
- const bool success = connection_handler_observer_->OnServiceStartedCallback(
- connection->connection_device_handle(), session_key, service_type);
- if (!success) {
+ // In case this is a Session running on a Secondary Transport, we need to
+ // find the Sessions's primary transport. In this case, "connection_handle"
+ // reflects the secondary transport, which we need for the various
+ // callbacks, so they can send appropriate Ack or NAK messages on the
+ // correct transport.
+ transport_manager::ConnectionUID primary_connection_handle =
+ connection_handle;
+ SessionTransports st = GetSessionTransports(session_id);
+ if (session_id != 0) {
+ if (st.primary_transport == 0) {
LOG4CXX_WARN(logger_,
- "Service starting forbidden by connection_handler_observer");
- if (protocol_handler::kRpc == service_type) {
- connection->RemoveSession(new_session_id);
- } else {
- connection->RemoveService(session_id, service_type);
- }
- return 0;
+ "OnSessionStartedCallback could not find Session in the "
+ "Session/Connection Map!");
+ } else {
+ LOG4CXX_INFO(logger_,
+ "OnSessionStartedCallback found session "
+ << static_cast<int>(session_id)
+ << " with primary connection "
+ << static_cast<int>(st.primary_transport)
+ << " and secondary connection "
+ << static_cast<int>(st.secondary_transport));
+ primary_connection_handle = st.primary_transport;
}
}
- return new_session_id;
-}
-
-void ConnectionHandlerImpl::OnSessionStartedCallback(
- const transport_manager::ConnectionUID connection_handle,
- const uint8_t session_id,
- const protocol_handler::ServiceType& service_type,
- const bool is_protected,
- const BsonObject* params) {
- LOG4CXX_AUTO_TRACE(logger_);
- std::vector<std::string> rejected_params;
- protocol_handler::SessionContext context(connection_handle,
+ protocol_handler::SessionContext context(primary_connection_handle,
+ connection_handle,
session_id,
0,
service_type,
@@ -428,7 +472,8 @@ void ConnectionHandlerImpl::OnSessionStartedCallback(
}
#endif // ENABLE_SECURITY
sync_primitives::AutoReadLock lock(connection_list_lock_);
- ConnectionList::iterator it = connection_list_.find(connection_handle);
+ ConnectionList::iterator it =
+ connection_list_.find(primary_connection_handle);
if (connection_list_.end() == it) {
LOG4CXX_ERROR(logger_, "Unknown connection!");
protocol_handler_->NotifySessionStarted(context, rejected_params);
@@ -440,15 +485,18 @@ void ConnectionHandlerImpl::OnSessionStartedCallback(
!connection->SessionServiceExists(session_id, service_type);
if ((0 == session_id) && (protocol_handler::kRpc == service_type)) {
- context.new_session_id_ = connection->AddNewSession();
+ context.new_session_id_ =
+ connection->AddNewSession(primary_connection_handle);
if (0 == context.new_session_id_) {
LOG4CXX_ERROR(logger_, "Couldn't start new session!");
protocol_handler_->NotifySessionStarted(context, rejected_params);
return;
}
- context.hash_id_ = KeyFromPair(connection_handle, context.new_session_id_);
+ context.hash_id_ =
+ KeyFromPair(primary_connection_handle, context.new_session_id_);
} else { // Could be create new service or protected exists one
- if (!connection->AddNewService(session_id, service_type, is_protected)) {
+ if (!connection->AddNewService(
+ session_id, service_type, is_protected, connection_handle)) {
LOG4CXX_ERROR(logger_,
"Couldn't establish "
#ifdef ENABLE_SECURITY
@@ -461,11 +509,16 @@ void ConnectionHandlerImpl::OnSessionStartedCallback(
}
context.new_session_id_ = session_id;
context.hash_id_ = protocol_handler::HASH_ID_NOT_SUPPORTED;
+
+ if (st.secondary_transport == connection_handle) {
+ sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_);
+ st.secondary_transport_services.push_back(service_type);
+ }
}
sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
if (connection_handler_observer_) {
const uint32_t session_key =
- KeyFromPair(connection_handle, context.new_session_id_);
+ KeyFromPair(primary_connection_handle, context.new_session_id_);
{
sync_primitives::AutoLock auto_lock(start_service_context_map_lock_);
@@ -502,10 +555,13 @@ void ConnectionHandlerImpl::NotifyServiceStartedResult(
start_service_context_map_.erase(it);
}
+ // We need the context's primary connection so we can manage its services
+ // list
Connection* connection = NULL;
{
sync_primitives::AutoReadLock lock(connection_list_lock_);
- ConnectionList::iterator it = connection_list_.find(context.connection_id_);
+ ConnectionList::iterator it =
+ connection_list_.find(context.primary_connection_id_);
if (connection_list_.end() == it) {
LOG4CXX_ERROR(logger_, "connection not found");
return;
@@ -538,6 +594,28 @@ void ConnectionHandlerImpl::OnApplicationFloodCallBack(
uint8_t session_id = 0;
PairFromKey(connection_key, &connection_handle, &session_id);
+ // In case this is a Session running on a Secondary Transport,
+ // "connection_handle" will reflect the active (secondary) transport.
+ // To close the conneciton and its sessions properly, we need to find
+ // the Sessions's primary transport/connection.
+ if (session_id != 0) {
+ SessionTransports st = GetSessionTransports(session_id);
+ if (st.primary_transport == 0) {
+ LOG4CXX_WARN(logger_,
+ "OnApplicationFloodCallBack could not find Session in the "
+ "Session/Connection Map!");
+ } else {
+ LOG4CXX_INFO(logger_,
+ "OnApplicationFloodCallBack found session "
+ << static_cast<int>(session_id)
+ << " with primary connection "
+ << static_cast<int>(st.primary_transport)
+ << " and secondary connection "
+ << static_cast<int>(st.secondary_transport));
+ connection_handle = st.primary_transport;
+ }
+ }
+
LOG4CXX_INFO(logger_, "Disconnect flooding application");
if (session_id != 0) {
CloseSession(connection_handle, session_id, kFlood);
@@ -555,6 +633,28 @@ void ConnectionHandlerImpl::OnMalformedMessageCallback(
uint8_t session_id = 0;
PairFromKey(connection_key, &connection_handle, &session_id);
+ // In case this is a Session running on a Secondary Transport,
+ // "connection_handle" will reflect the active (secondary) transport.
+ // To close the conneciton and its sessions properly, we need to find
+ // the Sessions's primary transport/connection.
+ if (session_id != 0) {
+ SessionTransports st = GetSessionTransports(session_id);
+ if (st.primary_transport == 0) {
+ LOG4CXX_WARN(logger_,
+ "OnMalformedMessageCallback could not find Session in the "
+ "Session/Connection Map!");
+ } else {
+ LOG4CXX_INFO(logger_,
+ "OnMalformedMessageCallback found session "
+ << static_cast<int>(session_id)
+ << " with primary connection "
+ << static_cast<int>(st.primary_transport)
+ << " and secondary connection "
+ << static_cast<int>(st.secondary_transport));
+ connection_handle = st.primary_transport;
+ }
+ }
+
LOG4CXX_INFO(logger_, "Disconnect malformed messaging application");
CloseConnectionSessions(connection_handle, kMalformed);
CloseConnection(connection_handle);
@@ -563,22 +663,38 @@ void ConnectionHandlerImpl::OnMalformedMessageCallback(
uint32_t ConnectionHandlerImpl::OnSessionEndedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t session_id,
- const uint32_t& hashCode,
- const protocol_handler::ServiceType& service_type) {
- uint32_t hashValue = hashCode;
- return OnSessionEndedCallback(
- connection_handle, session_id, &hashValue, service_type);
-}
-
-uint32_t ConnectionHandlerImpl::OnSessionEndedCallback(
- const transport_manager::ConnectionUID connection_handle,
- const uint8_t session_id,
uint32_t* hashCode,
const protocol_handler::ServiceType& service_type) {
LOG4CXX_AUTO_TRACE(logger_);
+ // In case this is a Session running on a Secondary Transport, we need to
+ // find the Sessions's primary transport. In this case, "connection_handle"
+ // reflects the secondary transport, which we need for the various
+ // callbacks, so they can send appropriate Ack or NAK messages on the
+ // correct transport.
+ transport_manager::ConnectionUID primary_connection_handle =
+ connection_handle;
+ if (session_id != 0) {
+ SessionTransports st = GetSessionTransports(session_id);
+ if (st.primary_transport == 0) {
+ LOG4CXX_WARN(logger_,
+ "OnSessionEndedCallback could not find Session in the "
+ "Session/Connection Map!");
+ } else {
+ LOG4CXX_INFO(logger_,
+ "OnSessionEndedCallback found session "
+ << static_cast<int>(session_id)
+ << " with primary connection "
+ << static_cast<int>(st.primary_transport)
+ << " and secondary connection "
+ << static_cast<int>(st.secondary_transport));
+ primary_connection_handle = st.primary_transport;
+ }
+ }
+
connection_list_lock_.AcquireForReading();
- ConnectionList::iterator it = connection_list_.find(connection_handle);
+ ConnectionList::iterator it =
+ connection_list_.find(primary_connection_handle);
if (connection_list_.end() == it) {
LOG4CXX_WARN(logger_, "Unknown connection!");
connection_list_lock_.Release();
@@ -588,37 +704,38 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback(
connection_list_lock_.Release();
Connection* connection = connection_item.second;
- const uint32_t session_key = KeyFromPair(connection_handle, session_id);
+ const uint32_t session_key =
+ KeyFromPair(primary_connection_handle, session_id);
if (protocol_handler::kRpc == service_type) {
- LOG4CXX_INFO(logger_,
- "Session " << static_cast<uint32_t>(session_id)
- << " to be removed");
+ LOG4CXX_INFO(
+ logger_,
+ "Session " << static_cast<uint32_t>(session_id) << " to be removed");
// old version of protocol doesn't support hash
if (protocol_handler::HASH_ID_NOT_SUPPORTED != *hashCode) {
if (protocol_handler::HASH_ID_WRONG == *hashCode ||
session_key != *hashCode) {
- LOG4CXX_WARN(logger_,
- "Wrong hash_id for session "
- << static_cast<uint32_t>(session_id));
+ LOG4CXX_WARN(
+ logger_,
+ "Wrong hash_id for session " << static_cast<uint32_t>(session_id));
*hashCode = protocol_handler::HASH_ID_WRONG;
return 0;
}
}
if (!connection->RemoveSession(session_id)) {
- LOG4CXX_WARN(logger_,
- "Couldn't remove session "
- << static_cast<uint32_t>(session_id));
+ LOG4CXX_WARN(
+ logger_,
+ "Couldn't remove session " << static_cast<uint32_t>(session_id));
return 0;
}
} else {
- LOG4CXX_INFO(logger_,
- "Service " << static_cast<uint32_t>(service_type)
- << " to be removed");
+ LOG4CXX_INFO(
+ logger_,
+ "Service " << static_cast<uint32_t>(service_type) << " to be removed");
if (!connection->RemoveService(session_id, service_type)) {
- LOG4CXX_WARN(logger_,
- "Couldn't remove service "
- << static_cast<uint32_t>(service_type));
+ LOG4CXX_WARN(
+ logger_,
+ "Couldn't remove service " << static_cast<uint32_t>(service_type));
return 0;
}
}
@@ -631,6 +748,192 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback(
return session_key;
}
+bool ConnectionHandlerImpl::OnSecondaryTransportStarted(
+ transport_manager::ConnectionUID& primary_connection_handle,
+ const transport_manager::ConnectionUID secondary_connection_handle,
+ const uint8_t session_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (session_id == 0) {
+ LOG4CXX_WARN(logger_, "Session id for secondary transport is invalid");
+ return false;
+ }
+
+ DeviceHandle device_handle;
+ Connection* connection;
+ {
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
+ ConnectionList::iterator it =
+ connection_list_.find(secondary_connection_handle);
+ if (connection_list_.end() == it) {
+ LOG4CXX_WARN(logger_,
+ "Unknown connection " << secondary_connection_handle);
+ return false;
+ }
+
+ connection = it->second;
+ device_handle = connection->connection_device_handle();
+ }
+
+ // Add the secondary transport connection ID to the SessionConnectionMap
+ SessionTransports st =
+ SetSecondaryTransportID(session_id, secondary_connection_handle);
+ primary_connection_handle = st.primary_transport;
+ if (st.secondary_transport != secondary_connection_handle) {
+ LOG4CXX_WARN(logger_,
+ "Failed setting the session's secondary transport ID");
+ return false;
+ }
+
+ connection->SetPrimaryConnectionHandle(primary_connection_handle);
+
+ const uint32_t session_key =
+ KeyFromPair(primary_connection_handle, session_id);
+
+ sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
+ if (connection_handler_observer_) {
+ LOG4CXX_TRACE(logger_,
+ "Calling Connection Handler Observer's "
+ "OnSecondaryTransportStartedCallback");
+ connection_handler_observer_->OnSecondaryTransportStartedCallback(
+ device_handle, session_key);
+ }
+
+ return true;
+}
+
+void ConnectionHandlerImpl::OnSecondaryTransportEnded(
+ const transport_manager::ConnectionUID primary_connection_handle,
+ const transport_manager::ConnectionUID secondary_connection_handle) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ LOG4CXX_INFO(logger_,
+ "Secondary Transport: "
+ << static_cast<int32_t>(secondary_connection_handle)
+ << " ended. Cleaning up services from primary connection ID "
+ << static_cast<int32_t>(primary_connection_handle));
+ connection_list_lock_.AcquireForReading();
+ ConnectionList::iterator itr =
+ connection_list_.find(primary_connection_handle);
+ if (connection_list_.end() == itr) {
+ LOG4CXX_ERROR(logger_, "Primary Connection not found!");
+ connection_list_lock_.Release();
+ return;
+ }
+ Connection* connection = itr->second;
+ connection_list_lock_.Release();
+
+ if (connection != NULL) {
+ std::list<protocol_handler::ServiceType> removed_services_list;
+ uint8_t session_id = connection->RemoveSecondaryServices(
+ secondary_connection_handle, removed_services_list);
+
+ if (session_id == 0) {
+ // The secondary services have already been removed from the primary
+ // connection, so we find the session associated with this secondary
+ // transport in the SessionConnectionMap
+ session_id =
+ GetSessionIdFromSecondaryTransport(secondary_connection_handle);
+ }
+
+ if (session_id != 0) {
+ {
+ sync_primitives::AutoReadLock read_lock(
+ connection_handler_observer_lock_);
+ if (connection_handler_observer_) {
+ const uint32_t session_key =
+ KeyFromPair(primary_connection_handle, session_id);
+
+ // Walk the returned list of services and call the ServiceEnded
+ // callback for each
+ std::list<protocol_handler::ServiceType>::const_iterator it =
+ removed_services_list.begin();
+ for (; removed_services_list.end() != it; ++it) {
+ connection_handler_observer_->OnServiceEndedCallback(
+ session_key, *it, CloseSessionReason::kCommon);
+ }
+
+ connection_handler_observer_->OnSecondaryTransportEndedCallback(
+ session_key);
+ }
+ }
+
+ // Clear the secondary connection from the Session/Connection map entry
+ // associated with this session
+ SetSecondaryTransportID(session_id, 0);
+ }
+ }
+}
+
+const transport_manager::DeviceInfo&
+ConnectionHandlerImpl::GetWebEngineDeviceInfo() const {
+ return transport_manager_.GetWebEngineDeviceInfo();
+}
+
+void ConnectionHandlerImpl::CreateWebEngineDevice() {
+ transport_manager_.CreateWebEngineDevice();
+}
+
+const std::string
+ConnectionHandlerImpl::TransportTypeProfileStringFromConnHandle(
+ transport_manager::ConnectionUID connection_handle) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
+ ConnectionList::const_iterator it = connection_list_.find(connection_handle);
+ if (connection_list_.end() == it) {
+ LOG4CXX_WARN(logger_, "Unknown connection " << connection_handle);
+ return std::string();
+ } else {
+ DeviceHandle device_handle = it->second->connection_device_handle();
+ return TransportTypeProfileStringFromDeviceHandle(device_handle);
+ }
+}
+
+const std::string
+ConnectionHandlerImpl::TransportTypeProfileStringFromDeviceHandle(
+ DeviceHandle device_handle) const {
+ std::string connection_type;
+ {
+ sync_primitives::AutoReadLock lock(device_list_lock_);
+ auto it = device_list_.find(device_handle);
+ if (device_list_.end() == it) {
+ LOG4CXX_ERROR(logger_, "Device not found!");
+ } else {
+ connection_type = it->second.connection_type();
+ }
+ }
+
+ // Caution: this should be in sync with devicesType map in
+ // transport_adapter_impl.cc
+ if (connection_type == "USB_AOA") {
+ return std::string("AOA_USB");
+ } else if (connection_type == "BLUETOOTH") {
+ return std::string("SPP_BLUETOOTH");
+ } else if (connection_type == "USB_IOS") {
+ return std::string("IAP_USB");
+ } else if (connection_type == "BLUETOOTH_IOS") {
+ return std::string("IAP_BLUETOOTH");
+ } else if (connection_type == "WIFI") {
+ return std::string("TCP_WIFI");
+ } else if (connection_type == "USB_IOS_HOST_MODE") {
+ return std::string("IAP_USB_HOST_MODE");
+ } else if (connection_type == "USB_IOS_DEVICE_MODE") {
+ return std::string("IAP_USB_DEVICE_MODE");
+ } else if (connection_type == "CARPLAY_WIRELESS_IOS") {
+ return std::string("IAP_CARPLAY");
+ } else if (connection_type == "CLOUD_WEBSOCKET") {
+ return std::string("WEBSOCKET");
+#ifdef BUILD_TESTS
+ } else if (connection_type == "BTMAC") {
+ return std::string("BTMAC");
+#endif
+ } else {
+ LOG4CXX_WARN(logger_, "Unknown transport type string: " << connection_type);
+ return std::string();
+ }
+}
+
uint32_t ConnectionHandlerImpl::KeyFromPair(
transport_manager::ConnectionUID connection_handle,
uint8_t session_id) const {
@@ -639,7 +942,7 @@ uint32_t ConnectionHandlerImpl::KeyFromPair(
"Key for ConnectionHandle:"
<< static_cast<uint32_t>(connection_handle)
<< " Session:" << static_cast<uint32_t>(session_id)
- << " is: " << static_cast<uint32_t>(key));
+ << " is: 0x" << std::hex << static_cast<uint32_t>(key));
if (protocol_handler::HASH_ID_WRONG == key) {
LOG4CXX_ERROR(logger_,
"Connection key is WRONG_HASH_ID "
@@ -722,6 +1025,172 @@ DevicesDiscoveryStarter& ConnectionHandlerImpl::get_device_discovery_starter() {
return *this;
}
+// Finds a key not presented in std::map<unsigned char, T>
+// Returns 0 if that key not found
+namespace {
+template <class T>
+uint32_t findGap(const std::map<unsigned char, T>& map) {
+ for (uint32_t i = 1; i <= UCHAR_MAX; ++i) {
+ if (map.find(i) == map.end()) {
+ return i;
+ }
+ }
+ return 0;
+}
+} // namespace
+
+uint32_t ConnectionHandlerImpl::AddSession(
+ const transport_manager::ConnectionUID primary_transport_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_);
+ const uint32_t session_id = findGap(session_connection_map_);
+ if (session_id > 0) {
+ LOG4CXX_INFO(logger_,
+ "New session ID " << session_id << " and Connection Id "
+ << static_cast<int>(primary_transport_id)
+ << " added to Session/Connection Map");
+ SessionTransports st;
+ st.primary_transport = primary_transport_id;
+ st.secondary_transport = 0;
+ session_connection_map_[session_id] = st;
+ } else {
+ LOG4CXX_WARN(logger_,
+ "Session/Connection Map could not create a new session ID!!!");
+ }
+
+ return session_id;
+}
+
+bool ConnectionHandlerImpl::RemoveSession(uint8_t session_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_);
+ SessionConnectionMap::iterator itr = session_connection_map_.find(session_id);
+ if (session_connection_map_.end() == itr) {
+ LOG4CXX_WARN(logger_, "Session not found in Session/Connection Map!");
+ return false;
+ }
+
+ LOG4CXX_INFO(logger_,
+ "Removed Session ID " << static_cast<int>(session_id)
+ << " from Session/Connection Map");
+ session_connection_map_.erase(session_id);
+ return true;
+}
+
+DataAccessor<SessionConnectionMap>
+ConnectionHandlerImpl::session_connection_map() {
+ return DataAccessor<SessionConnectionMap>(session_connection_map_,
+ session_connection_map_lock_ptr_);
+}
+
+SessionTransports ConnectionHandlerImpl::SetSecondaryTransportID(
+ uint8_t session_id,
+ transport_manager::ConnectionUID secondary_transport_id) {
+ SessionTransports st;
+
+ sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_);
+ SessionConnectionMap::iterator it = session_connection_map_.find(session_id);
+ if (session_connection_map_.end() == it) {
+ LOG4CXX_WARN(logger_,
+ "SetSecondaryTransportID: session ID "
+ << static_cast<int>(session_id)
+ << " not found in Session/Connection map");
+ st.primary_transport = 0;
+ st.secondary_transport = 0;
+ } else {
+ st = it->second;
+
+ // The only time we overwrite an existing entry in the map is if the new
+ // secondary transport ID is kDisabledSecondary, which effectively
+ // DISABLES the secondary transport feature for the session, or if the new
+ // secondary transport ID is 0, which means a secondary transport has shut
+ // down
+ if (st.secondary_transport != 0 &&
+ secondary_transport_id != kDisabledSecondary &&
+ secondary_transport_id != 0) {
+ LOG4CXX_WARN(logger_,
+ "SetSecondaryTransportID: session ID "
+ << static_cast<int>(session_id)
+ << " already has a secondary connection "
+ << static_cast<int>(st.secondary_transport)
+ << " in the Session/Connection map");
+ } else {
+ st.secondary_transport = secondary_transport_id;
+ session_connection_map_[session_id] = st;
+ }
+ }
+
+ return st;
+}
+
+const SessionTransports ConnectionHandlerImpl::GetSessionTransports(
+ uint8_t session_id) const {
+ SessionTransports st;
+ sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_);
+ SessionConnectionMap::const_iterator it =
+ session_connection_map_.find(session_id);
+ if (session_connection_map_.end() == it) {
+ st.primary_transport = 0;
+ st.secondary_transport = 0;
+ } else {
+ st = it->second;
+ }
+
+ return st;
+}
+
+const uint8_t ConnectionHandlerImpl::GetSessionIdFromSecondaryTransport(
+ transport_manager::ConnectionUID secondary_transport_id) const {
+ sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_);
+ SessionConnectionMap::const_iterator it = session_connection_map_.begin();
+ for (; session_connection_map_.end() != it; it++) {
+ SessionTransports st = it->second;
+ if (st.secondary_transport == secondary_transport_id) {
+ return it->first;
+ }
+ }
+
+ LOG4CXX_ERROR(logger_,
+ "Could not find secondary transport ID "
+ << static_cast<int>(secondary_transport_id)
+ << " in the Session/Connection map");
+ return 0;
+}
+
+Connection* ConnectionHandlerImpl::GetPrimaryConnection(
+ const ConnectionHandle connection_handle) const {
+ LOG4CXX_DEBUG(logger_,
+ "Getting primary connection for ID " << connection_handle);
+ ConnectionList::const_iterator it = connection_list_.find(connection_handle);
+ if (connection_list_.end() == it) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Connection with ID " << connection_handle << " was not found");
+ return nullptr;
+ }
+
+ auto connection_ptr = it->second;
+ if (connection_ptr->primary_connection_handle() != 0) {
+ return GetPrimaryConnection(connection_ptr->primary_connection_handle());
+ }
+
+ return connection_ptr;
+}
+
+std::string ConnectionHandlerImpl::GetCloudAppID(
+ const transport_manager::ConnectionUID connection_id) const {
+ sync_primitives::AutoLock auto_lock(cloud_app_id_map_lock_);
+ for (auto it = cloud_app_id_map_.begin(); it != cloud_app_id_map_.end();
+ ++it) {
+ if (connection_id == it->second.second) {
+ return it->first;
+ }
+ }
+ return std::string();
+}
+
struct CompareMAC {
explicit CompareMAC(const std::string& mac) : mac_(mac) {}
bool operator()(const DeviceMap::value_type& device) {
@@ -735,6 +1204,7 @@ struct CompareMAC {
bool ConnectionHandlerImpl::GetDeviceID(const std::string& mac_address,
DeviceHandle* device_handle) {
DCHECK_OR_RETURN(device_handle, false);
+ sync_primitives::AutoReadLock lock(device_list_lock_);
DeviceMap::const_iterator it = std::find_if(
device_list_.begin(), device_list_.end(), CompareMAC(mac_address));
if (it != device_list_.end()) {
@@ -753,7 +1223,10 @@ int32_t ConnectionHandlerImpl::GetDataOnDeviceID(
LOG4CXX_AUTO_TRACE(logger_);
int32_t result = -1;
- DeviceMap::const_iterator it = device_list_.find(device_handle);
+
+ sync_primitives::AutoReadLock lock(device_list_lock_);
+ auto it = device_list_.find(device_handle);
+
if (device_list_.end() == it) {
LOG4CXX_ERROR(logger_, "Device not found for handle " << device_handle);
return result;
@@ -799,6 +1272,7 @@ void ConnectionHandlerImpl::GetConnectedDevicesMAC(
std::vector<std::string>& device_macs) const {
DeviceMap::const_iterator first = device_list_.begin();
DeviceMap::const_iterator last = device_list_.end();
+ sync_primitives::AutoReadLock lock(device_list_lock_);
while (first != last) {
device_macs.push_back((*first).second.mac_address());
@@ -815,13 +1289,12 @@ int ConnectionHandlerImpl::SetSSLContext(
PairFromKey(key, &connection_handle, &session_id);
sync_primitives::AutoReadLock lock(connection_list_lock_);
- ConnectionList::iterator it = connection_list_.find(connection_handle);
- if (connection_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown connection!");
+ auto connection = GetPrimaryConnection(connection_handle);
+ if (!connection) {
return security_manager::SecurityManager::ERROR_INTERNAL;
}
- Connection& connection = *it->second;
- return connection.SetSSLContext(session_id, context);
+
+ return connection->SetSSLContext(session_id, context);
}
security_manager::SSLContext* ConnectionHandlerImpl::GetSSLContext(
@@ -832,13 +1305,12 @@ security_manager::SSLContext* ConnectionHandlerImpl::GetSSLContext(
PairFromKey(key, &connection_handle, &session_id);
sync_primitives::AutoReadLock lock(connection_list_lock_);
- ConnectionList::iterator it = connection_list_.find(connection_handle);
- if (connection_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown connection!");
- return NULL;
+ auto connection = GetPrimaryConnection(connection_handle);
+ if (!connection) {
+ return nullptr;
}
- Connection& connection = *it->second;
- return connection.GetSSLContext(session_id, service_type);
+
+ return connection->GetSSLContext(session_id, service_type);
}
void ConnectionHandlerImpl::SetProtectionFlag(
@@ -849,18 +1321,28 @@ void ConnectionHandlerImpl::SetProtectionFlag(
PairFromKey(key, &connection_handle, &session_id);
sync_primitives::AutoReadLock lock(connection_list_lock_);
- ConnectionList::iterator it = connection_list_.find(connection_handle);
- if (connection_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown connection!");
+ auto connection = GetPrimaryConnection(connection_handle);
+ if (!connection) {
return;
}
- Connection& connection = *it->second;
- connection.SetProtectionFlag(session_id, service_type);
+
+ connection->SetProtectionFlag(session_id, service_type);
}
security_manager::SSLContext::HandshakeContext
ConnectionHandlerImpl::GetHandshakeContext(uint32_t key) const {
- return connection_handler_observer_->GetHandshakeContext(key);
+ transport_manager::ConnectionUID connection_handle = 0;
+ uint8_t session_id = 0;
+ PairFromKey(key, &connection_handle, &session_id);
+
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
+ auto connection = GetPrimaryConnection(connection_handle);
+ if (!connection) {
+ return security_manager::SSLContext::HandshakeContext();
+ }
+
+ auto primary_key = KeyFromPair(connection->connection_handle(), session_id);
+ return connection_handler_observer_->GetHandshakeContext(primary_key);
}
#endif // ENABLE_SECURITY
@@ -888,6 +1370,7 @@ void ConnectionHandlerImpl::StartDevicesDiscovery() {
transport_manager_.SearchDevices();
sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
+ sync_primitives::AutoReadLock lock(device_list_lock_);
if (connection_handler_observer_) {
connection_handler_observer_->OnDeviceListUpdated(device_list_);
}
@@ -896,6 +1379,7 @@ void ConnectionHandlerImpl::StartDevicesDiscovery() {
void ConnectionHandlerImpl::ConnectToDevice(
connection_handler::DeviceHandle device_handle) {
connection_handler::DeviceMap::const_iterator it_in;
+ sync_primitives::AutoReadLock lock(device_list_lock_);
it_in = device_list_.find(device_handle);
if (device_list_.end() != it_in) {
LOG4CXX_INFO(logger_, "Connecting to device with handle " << device_handle);
@@ -910,8 +1394,14 @@ void ConnectionHandlerImpl::ConnectToDevice(
}
}
+transport_manager::ConnectionStatus ConnectionHandlerImpl::GetConnectionStatus(
+ const DeviceHandle& device_handle) const {
+ return transport_manager_.GetConnectionStatus(device_handle);
+}
+
void ConnectionHandlerImpl::RunAppOnDevice(const std::string& device_mac,
const std::string& bundle_id) const {
+ sync_primitives::AutoReadLock lock(device_list_lock_);
for (DeviceMap::const_iterator i = device_list_.begin();
i != device_list_.end();
++i) {
@@ -925,16 +1415,37 @@ void ConnectionHandlerImpl::RunAppOnDevice(const std::string& device_mac,
}
void ConnectionHandlerImpl::ConnectToAllDevices() {
+ sync_primitives::AutoReadLock lock(device_list_lock_);
for (DeviceMap::iterator i = device_list_.begin(); i != device_list_.end();
++i) {
- connection_handler::DeviceHandle device_handle = i->first;
- ConnectToDevice(device_handle);
+ if (transport_manager::webengine_constants::kWebEngineDeviceName ==
+ i->second.user_friendly_name()) {
+ LOG4CXX_DEBUG(logger_, "No need to connect to web engine device");
+ continue;
+ }
+ ConnectToDevice(i->first);
}
}
+void ConnectionHandlerImpl::AddCloudAppDevice(
+ const std::string& policy_app_id,
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) {
+ cloud_app_id_map_lock_.Acquire();
+ cloud_app_id_map_[policy_app_id] =
+ std::make_pair(cloud_properties.endpoint, 0);
+ cloud_app_id_map_lock_.Release();
+ transport_manager_.AddCloudDevice(cloud_properties);
+}
+
+void ConnectionHandlerImpl::RemoveCloudAppDevice(const DeviceHandle device_id) {
+ transport_manager_.RemoveCloudDevice(device_id);
+}
+
void ConnectionHandlerImpl::StartTransportManager() {
LOG4CXX_AUTO_TRACE(logger_);
- transport_manager_.Visibility(true);
+ transport_manager_.PerformActionOnClients(
+ transport_manager::TransportAction::kVisibilityOn);
}
void ConnectionHandlerImpl::CloseRevokedConnection(uint32_t connection_key) {
@@ -1046,9 +1557,9 @@ void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle,
return;
}
- LOG4CXX_DEBUG(logger_,
- "Session with id: " << session_id
- << " has been closed successfully");
+ LOG4CXX_DEBUG(
+ logger_,
+ "Session with id: " << session_id << " has been closed successfully");
}
void ConnectionHandlerImpl::CloseConnectionSessions(
@@ -1098,8 +1609,33 @@ void ConnectionHandlerImpl::SendEndService(uint32_t key, uint8_t service_type) {
uint32_t connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(key, &connection_handle, &session_id);
- protocol_handler_->SendEndService(
- connection_handle, session_id, service_type);
+
+ // If the service is running on a secondary transport, we need to retrieve
+ // that transport from the SessionConnection Map
+ SessionTransports st = GetSessionTransports(session_id);
+ if (st.primary_transport == 0) {
+ LOG4CXX_WARN(logger_,
+ "SendEndService could not find Session in the "
+ "Session/Connection Map!");
+ } else {
+ LOG4CXX_INFO(logger_,
+ "SendEndService found session "
+ << static_cast<int>(session_id)
+ << " with primary connection "
+ << static_cast<int>(st.primary_transport)
+ << " and secondary connection "
+ << static_cast<int>(st.secondary_transport));
+ sync_primitives::AutoLock auto_lock(session_connection_map_lock_ptr_);
+ auto it = std::find(st.secondary_transport_services.begin(),
+ st.secondary_transport_services.end(),
+ service_type);
+ if (it != st.secondary_transport_services.end()) {
+ connection_handle = st.secondary_transport;
+ st.secondary_transport_services.erase(it);
+ }
+ protocol_handler_->SendEndService(
+ st.primary_transport, connection_handle, session_id, service_type);
+ }
}
}
@@ -1160,12 +1696,16 @@ void ConnectionHandlerImpl::OnConnectionEnded(
connection_list_lock_.Release();
return;
}
- std::auto_ptr<Connection> connection(itr->second);
+ std::unique_ptr<Connection> connection(itr->second);
connection_list_.erase(itr);
connection_list_lock_.Release();
sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
if (connection_handler_observer_ && connection.get() != NULL) {
+ // We have to remember the Connection object we just removed from
+ // connection_list_, because we will need to retrieve the protocol
+ // version from it inside of OnServiceEndedCallback
+ ending_connection_ = connection.get();
const SessionMap session_map = connection->session_map();
for (SessionMap::const_iterator session_it = session_map.begin();
@@ -1174,14 +1714,27 @@ void ConnectionHandlerImpl::OnConnectionEnded(
const uint32_t session_key =
KeyFromPair(connection_id, session_it->first);
const ServiceList& service_list = session_it->second.service_list;
- for (ServiceList::const_iterator service_it = service_list.begin(),
- end = service_list.end();
- service_it != end;
- ++service_it) {
+
+ // Fix:
+ // Endcallback(service_type) by Disconnected,
+ // It should ended in order by 10|11 -> 7.
+ // Refer to service_list.rend() of CloseSession()
+ ServiceList::const_reverse_iterator service_list_itr =
+ service_list.rbegin();
+ for (; service_list_itr != service_list.rend(); ++service_list_itr) {
connection_handler_observer_->OnServiceEndedCallback(
- session_key, service_it->service_type, CloseSessionReason::kCommon);
+ session_key,
+ service_list_itr->service_type,
+ CloseSessionReason::kCommon);
}
}
+ ending_connection_ = NULL;
+ }
+
+ ConnectionHandle primary_connection_handle =
+ connection->primary_connection_handle();
+ if (primary_connection_handle != 0) {
+ OnSecondaryTransportEnded(primary_connection_handle, connection_id);
}
}
@@ -1193,9 +1746,9 @@ void ConnectionHandlerImpl::BindProtocolVersionWithSession(
PairFromKey(connection_key, &connection_handle, &session_id);
sync_primitives::AutoReadLock lock(connection_list_lock_);
- ConnectionList::iterator it = connection_list_.find(connection_handle);
- if (connection_list_.end() != it) {
- it->second->UpdateProtocolVersionSession(session_id, protocol_version);
+ auto connection = GetPrimaryConnection(connection_handle);
+ if (connection) {
+ connection->UpdateProtocolVersionSession(session_id, protocol_version);
}
}
@@ -1204,13 +1757,14 @@ bool ConnectionHandlerImpl::IsHeartBeatSupported(
uint8_t session_id) const {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoReadLock lock(connection_list_lock_);
- uint32_t connection = static_cast<uint32_t>(connection_handle);
- ConnectionList::const_iterator it = connection_list_.find(connection);
- if (connection_list_.end() == it) {
- LOG4CXX_WARN(logger_, "Connection not found !");
+ const uint32_t connection_id = static_cast<uint32_t>(connection_handle);
+ auto connection = GetPrimaryConnection(connection_id);
+
+ if (!connection) {
return false;
}
- return it->second->SupportHeartBeat(session_id);
+
+ return connection->SupportHeartBeat(session_id);
}
bool ConnectionHandlerImpl::ProtocolVersionUsed(
@@ -1219,11 +1773,15 @@ bool ConnectionHandlerImpl::ProtocolVersionUsed(
uint8_t& protocol_version) const {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoReadLock lock(connection_list_lock_);
- ConnectionList::const_iterator it = connection_list_.find(connection_id);
- if (connection_list_.end() != it) {
- return it->second->ProtocolVersion(session_id, protocol_version);
+ auto connection = GetPrimaryConnection(connection_id);
+
+ if (connection) {
+ return connection->ProtocolVersion(session_id, protocol_version);
+ } else if (ending_connection_ &&
+ static_cast<uint32_t>(ending_connection_->connection_handle()) ==
+ connection_id) {
+ return ending_connection_->ProtocolVersion(session_id, protocol_version);
}
- LOG4CXX_WARN(logger_, "Connection not found !");
return false;
}
diff --git a/src/components/connection_handler/src/device.cc b/src/components/connection_handler/src/device.cc
index 0ecb439172..515304778b 100644
--- a/src/components/connection_handler/src/device.cc
+++ b/src/components/connection_handler/src/device.cc
@@ -54,9 +54,9 @@ Device::Device(DeviceHandle device_handle,
, mac_address_(mac_address)
, connection_type_(connection_type) {
mac_address_ = encryption::MakeHash(mac_address);
- LOG4CXX_DEBUG(logger_,
- "Device: MAC address - " << mac_address << ", hash - "
- << mac_address_);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Device: MAC address - " << mac_address << ", hash - " << mac_address_);
}
DeviceHandle Device::device_handle() const {
diff --git a/src/components/connection_handler/src/heartbeat_monitor.cc b/src/components/connection_handler/src/heartbeat_monitor.cc
index f3a2322810..2b50f1ce1b 100644
--- a/src/components/connection_handler/src/heartbeat_monitor.cc
+++ b/src/components/connection_handler/src/heartbeat_monitor.cc
@@ -34,8 +34,8 @@
#include <unistd.h>
#include <utility>
-#include "utils/logger.h"
#include "connection_handler/connection.h"
+#include "utils/logger.h"
namespace connection_handler {
@@ -47,7 +47,6 @@ HeartBeatMonitor::HeartBeatMonitor(uint32_t heartbeat_timeout_mseconds,
Connection* connection)
: default_heartbeat_timeout_(heartbeat_timeout_mseconds)
, connection_(connection)
- , sessions_list_lock_(true)
, run_(true) {}
void HeartBeatMonitor::Process() {
@@ -80,9 +79,9 @@ void HeartBeatMonitor::Process() {
void HeartBeatMonitor::threadMain() {
AutoLock main_lock(main_thread_lock_);
- LOG4CXX_DEBUG(logger_,
- "Start heart beat monitor. Timeout is "
- << default_heartbeat_timeout_);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Start heart beat monitor. Timeout is " << default_heartbeat_timeout_);
while (run_) {
heartbeat_monitor_.WaitFor(main_lock, kDefaultCycleTimeout);
Process();
@@ -90,18 +89,20 @@ void HeartBeatMonitor::threadMain() {
}
void HeartBeatMonitor::AddSession(uint8_t session_id) {
- LOG4CXX_DEBUG(logger_,
- "Add session with id " << static_cast<int32_t>(session_id));
+ const uint32_t converted_session_id = static_cast<int32_t>(session_id);
+ UNUSED(converted_session_id);
+ LOG4CXX_DEBUG(logger_, "Add session with id " << converted_session_id);
AutoLock auto_lock(sessions_list_lock_);
if (sessions_.end() != sessions_.find(session_id)) {
- LOG4CXX_WARN(logger_,
- "Session with id " << static_cast<int32_t>(session_id)
- << " already exists");
+ LOG4CXX_WARN(
+ logger_,
+ "Session with id: " << converted_session_id << " already exists");
return;
}
sessions_.insert(
std::make_pair(session_id, SessionState(default_heartbeat_timeout_)));
- LOG4CXX_INFO(logger_, "Start heartbeat for session " << session_id);
+ LOG4CXX_INFO(logger_,
+ "Start heartbeat for session: " << converted_session_id);
}
void HeartBeatMonitor::RemoveSession(uint8_t session_id) {
@@ -164,8 +165,8 @@ HeartBeatMonitor::SessionState::SessionState(
void HeartBeatMonitor::SessionState::RefreshExpiration() {
LOG4CXX_DEBUG(logger_, "Refresh expiration: " << heartbeat_timeout_mseconds_);
using namespace date_time;
- TimevalStruct time = DateTime::getCurrentTime();
- DateTime::AddMilliseconds(time, heartbeat_timeout_mseconds_);
+ date_time::TimeDuration time = getCurrentTime();
+ AddMilliseconds(time, heartbeat_timeout_mseconds_);
heartbeat_expiration_ = time;
}
@@ -194,8 +195,8 @@ void HeartBeatMonitor::SessionState::KeepAlive() {
}
bool HeartBeatMonitor::SessionState::HasTimeoutElapsed() {
- TimevalStruct now = date_time::DateTime::getCurrentTime();
- return date_time::DateTime::Greater(now, heartbeat_expiration_);
+ date_time::TimeDuration now = date_time::getCurrentTime();
+ return date_time::Greater(now, heartbeat_expiration_);
}
} // namespace connection_handler
diff --git a/src/components/connection_handler/test/connection_handler_impl_test.cc b/src/components/connection_handler/test/connection_handler_impl_test.cc
index 56dbf6b9de..855225c460 100644
--- a/src/components/connection_handler/test/connection_handler_impl_test.cc
+++ b/src/components/connection_handler/test/connection_handler_impl_test.cc
@@ -30,22 +30,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include <fstream>
+#include "connection_handler/connection_handler_impl.h"
#include <stdint.h>
+#include <fstream>
#include <vector>
-#include "connection_handler/connection_handler_impl.h"
+#include "gtest/gtest.h"
#include "protocol/common.h"
// TODO(EZamakhov): move security test
#ifdef ENABLE_SECURITY
#include "security_manager/mock_security_manager.h"
#include "security_manager/mock_ssl_context.h"
#endif // ENABLE_SECURITY
-#include "protocol_handler/mock_protocol_handler.h"
#include "connection_handler/mock_connection_handler_observer.h"
#include "connection_handler/mock_connection_handler_settings.h"
-#include "transport_manager/mock_transport_manager.h"
#include "encryption/hashing.h"
+#include "protocol_handler/mock_protocol_handler.h"
+#include "transport_manager/mock_transport_manager.h"
#include "utils/test_async_waiter.h"
namespace test {
@@ -88,7 +88,7 @@ class ConnectionHandlerTest : public ::testing::Test {
mac_address_ = "test_address";
connection_handler_ = new ConnectionHandlerImpl(
- mock_connection_handler_settings, mock_transport_manager_);
+ mock_connection_handler_settings_, mock_transport_manager_);
uid_ = 1u;
connection_key_ = connection_handler_->KeyFromPair(0, 0u);
protected_services_.clear();
@@ -101,23 +101,29 @@ class ConnectionHandlerTest : public ::testing::Test {
void SetSpecificServices() {
#ifdef ENABLE_SECURITY
- ON_CALL(mock_connection_handler_settings, force_protected_service())
+ ON_CALL(mock_connection_handler_settings_, force_protected_service())
.WillByDefault(ReturnRefOfCopy(protected_services_));
- ON_CALL(mock_connection_handler_settings, force_unprotected_service())
+ ON_CALL(mock_connection_handler_settings_, force_unprotected_service())
.WillByDefault(ReturnRefOfCopy(unprotected_services_));
#endif // ENABLE_SECURITY
}
+
// Additional SetUp
void AddTestDeviceConnection() {
const transport_manager::DeviceInfo device_info(
device_handle_, mac_address_, device_name_, connection_type_);
// Add Device and connection
- ON_CALL(mock_connection_handler_settings, heart_beat_timeout())
+ ON_CALL(mock_connection_handler_settings_, heart_beat_timeout())
.WillByDefault(Return(1000u));
connection_handler_->addDeviceConnection(device_info, uid_);
connection_key_ = connection_handler_->KeyFromPair(uid_, 0u);
// Remove all specific services
}
+
+ /**
+ * @brief Adds test session
+ * @return session_id
+ */
void AddTestSession() {
protocol_handler_test::MockProtocolHandler temp_protocol_handler;
connection_handler_->set_protocol_handler(&temp_protocol_handler);
@@ -134,9 +140,11 @@ class ConnectionHandlerTest : public ::testing::Test {
connection_handler_->KeyFromPair(uid_, out_context_.new_session_id_);
CheckSessionExists(uid_, out_context_.new_session_id_);
}
+
uint32_t SessionHash(const uint32_t connection, const uint32_t session) {
return connection_handler_->KeyFromPair(connection, session);
}
+
void AddTestService(ServiceType service_type) {
EXPECT_NE(0u, out_context_.new_session_id_);
EXPECT_EQ(SessionHash(uid_, out_context_.new_session_id_),
@@ -198,10 +206,12 @@ class ConnectionHandlerTest : public ::testing::Test {
}
// Check Service Wrapper
- void CheckServiceExists(const int connectionId,
- const int session_id,
- const ::protocol_handler::ServiceType serviceId,
- const bool exists) {
+ void CheckServiceExists(
+ const int connectionId,
+ const int session_id,
+ const ::protocol_handler::ServiceType serviceId,
+ const ::transport_manager::ConnectionUID serviceConnectionId,
+ const bool exists) {
// Check all trees to find Service and check own protected value
const ConnectionList& connection_list =
connection_handler_->getConnectionList();
@@ -221,6 +231,7 @@ class ConnectionHandlerTest : public ::testing::Test {
std::find(service_list.begin(), service_list.end(), serviceId);
if (exists) {
ASSERT_NE(serv_it, service_list.end());
+ ASSERT_EQ(serv_it->connection_id, serviceConnectionId);
} else {
ASSERT_EQ(serv_it, service_list.end());
}
@@ -306,12 +317,38 @@ class ConnectionHandlerTest : public ::testing::Test {
connection->ProtocolVersion(session_id, check_protocol_version));
EXPECT_EQ(check_protocol_version, protocol_version);
}
+ void AddSecondaryTestService(ServiceType service_type) {
+ EXPECT_NE(0u, out_context_.new_session_id_);
+ EXPECT_EQ(SessionHash(uid_, out_context_.new_session_id_),
+ out_context_.hash_id_);
+ CheckSessionExists(uid_, out_context_.new_session_id_);
+
+ // Set protocol version to 5
+ ChangeProtocol(uid_,
+ out_context_.new_session_id_,
+ protocol_handler::PROTOCOL_VERSION_5);
+
+ connection_handler_test::MockConnectionHandlerObserver
+ temp_connection_handler_observer;
+ connection_handler_->set_connection_handler_observer(
+ &temp_connection_handler_observer);
+ EXPECT_CALL(temp_connection_handler_observer,
+ OnServiceStartedCallback(_, _, service_type, _))
+ .Times(1);
+
+ connection_handler_->OnSessionStartedCallback(2u,
+ out_context_.new_session_id_,
+ service_type,
+ PROTECTION_OFF,
+ static_cast<BsonObject*>(0));
+ connection_handler_->set_connection_handler_observer(NULL);
+ }
ConnectionHandlerImpl* connection_handler_;
testing::NiceMock<transport_manager_test::MockTransportManager>
mock_transport_manager_;
testing::NiceMock<MockConnectionHandlerSettings>
- mock_connection_handler_settings;
+ mock_connection_handler_settings_;
protocol_handler_test::MockProtocolHandler mock_protocol_handler_;
transport_manager::DeviceHandle device_handle_;
transport_manager::ConnectionUID uid_;
@@ -376,23 +413,23 @@ TEST_F(ConnectionHandlerTest, GetAppIdOnSessionKey) {
AddTestSession();
uint32_t app_id = 0;
- const uint32_t testid = SessionHash(uid_, out_context_.new_session_id_);
+ const uint32_t test_id = SessionHash(uid_, out_context_.new_session_id_);
- connection_handler::DeviceHandle null_handle = 0;
+ connection_handler::DeviceHandle* device_id = NULL;
EXPECT_EQ(0,
connection_handler_->GetDataOnSessionKey(
- connection_key_, &app_id, NULL, &null_handle));
- EXPECT_EQ(testid, app_id);
+ connection_key_, &app_id, NULL, device_id));
+ EXPECT_EQ(test_id, app_id);
}
TEST_F(ConnectionHandlerTest, GetAppIdOnSessionKey_SessionNotStarted) {
AddTestDeviceConnection();
uint32_t app_id = 0;
- connection_handler::DeviceHandle null_handle = 0;
+ connection_handler::DeviceHandle* device_id = NULL;
EXPECT_EQ(-1,
connection_handler_->GetDataOnSessionKey(
- connection_key_, &app_id, NULL, &null_handle));
+ connection_key_, &app_id, NULL, device_id));
}
TEST_F(ConnectionHandlerTest, GetDeviceID) {
@@ -500,6 +537,13 @@ TEST_F(ConnectionHandlerTest, GetPairFromKey) {
EXPECT_EQ(out_context_.new_session_id_, session_id);
}
+MATCHER_P(SameDevice, device, "") {
+ return arg.device_handle() == device.device_handle() &&
+ arg.user_friendly_name() == device.user_friendly_name() &&
+ arg.mac_address() == device.mac_address() &&
+ arg.connection_type() == device.connection_type();
+}
+
TEST_F(ConnectionHandlerTest, IsHeartBeatSupported) {
AddTestDeviceConnection();
AddTestSession();
@@ -508,17 +552,10 @@ TEST_F(ConnectionHandlerTest, IsHeartBeatSupported) {
uid_, out_context_.new_session_id_));
}
-MATCHER_P(SameDevice, device, "") {
- return arg.device_handle() == device.device_handle() &&
- arg.user_friendly_name() == device.user_friendly_name() &&
- arg.mac_address() == device.mac_address() &&
- arg.connection_type() == device.connection_type();
-}
-
TEST_F(ConnectionHandlerTest, SendEndServiceWithoutSetProtocolHandler) {
AddTestDeviceConnection();
AddTestSession();
- EXPECT_CALL(mock_protocol_handler_, SendEndService(_, _, kRpc)).Times(0);
+ EXPECT_CALL(mock_protocol_handler_, SendEndService(_, _, _, kRpc)).Times(0);
connection_handler_->SendEndService(connection_key_, kRpc);
}
@@ -526,7 +563,7 @@ TEST_F(ConnectionHandlerTest, SendEndService) {
AddTestDeviceConnection();
AddTestSession();
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, SendEndService(_, _, kRpc));
+ EXPECT_CALL(mock_protocol_handler_, SendEndService(_, _, _, kRpc));
connection_handler_->SendEndService(connection_key_, kRpc);
}
@@ -599,7 +636,8 @@ TEST_F(ConnectionHandlerTest, OnApplicationFloodCallBack) {
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
EXPECT_CALL(mock_protocol_handler_,
- SendEndSession(uid_, out_context_.new_session_id_)).Times(1);
+ SendEndSession(uid_, out_context_.new_session_id_))
+ .Times(1);
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_, kMobileNav, kCommon));
@@ -717,7 +755,8 @@ TEST_F(ConnectionHandlerTest, UpdateDeviceList) {
// New value that sets in OnDeviceListUpdated does not add
EXPECT_CALL(mock_connection_handler_observer,
- OnDeviceListUpdated(CheckDevList(map_with_unused_var))).Times(0);
+ OnDeviceListUpdated(CheckDevList(map_with_unused_var)))
+ .Times(0);
connection_handler_->OnDeviceListUpdated(unused_info);
}
@@ -748,7 +787,9 @@ TEST_F(ConnectionHandlerTest, StartTransportManager) {
AddTestDeviceConnection();
AddTestSession();
- EXPECT_CALL(mock_transport_manager_, Visibility(true));
+ EXPECT_CALL(mock_transport_manager_,
+ PerformActionOnClients(
+ transport_manager::TransportAction::kVisibilityOn));
connection_handler_->StartTransportManager();
}
@@ -985,7 +1026,8 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithMalformedMessage) {
TestAsyncWaiter waiter;
uint32_t times = 0;
EXPECT_CALL(mock_protocol_handler_,
- SendEndSession(uid_, out_context_.new_session_id_)).Times(0);
+ SendEndSession(uid_, out_context_.new_session_id_))
+ .Times(0);
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
@@ -1025,7 +1067,8 @@ TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithMalformedMessage) {
TestAsyncWaiter waiter;
uint32_t times = 0;
EXPECT_CALL(mock_protocol_handler_,
- SendEndSession(uid_, out_context_.new_session_id_)).Times(0);
+ SendEndSession(uid_, out_context_.new_session_id_))
+ .Times(0);
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
@@ -1112,7 +1155,7 @@ TEST_F(ConnectionHandlerTest, StartService_withServices) {
PROTECTION_OFF,
static_cast<BsonObject*>(NULL));
EXPECT_NE(0u, audio_context.new_session_id_);
- CheckServiceExists(uid_, audio_context.new_session_id_, kAudio, true);
+ CheckServiceExists(uid_, audio_context.new_session_id_, kAudio, uid_, true);
EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, audio_context.hash_id_);
// Start Audio service
@@ -1122,7 +1165,8 @@ TEST_F(ConnectionHandlerTest, StartService_withServices) {
PROTECTION_OFF,
static_cast<BsonObject*>(NULL));
EXPECT_NE(0u, video_context.new_session_id_);
- CheckServiceExists(uid_, video_context.new_session_id_, kMobileNav, true);
+ CheckServiceExists(
+ uid_, video_context.new_session_id_, kMobileNav, uid_, true);
EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, video_context.hash_id_);
connection_handler_->set_protocol_handler(NULL);
@@ -1150,7 +1194,8 @@ TEST_F(ConnectionHandlerTest, StartService_withServices_withParams) {
PROTECTION_OFF,
dummy_param);
EXPECT_EQ(out_context_.new_session_id_, video_context.new_session_id_);
- CheckServiceExists(uid_, out_context_.new_session_id_, kMobileNav, true);
+ CheckServiceExists(
+ uid_, out_context_.new_session_id_, kMobileNav, uid_, true);
EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, video_context.hash_id_);
connection_handler_->set_protocol_handler(NULL);
@@ -1174,7 +1219,7 @@ TEST_F(ConnectionHandlerTest, ServiceStop_UnExistService) {
connection_handler_->OnSessionEndedCallback(
uid_, out_context_.new_session_id_, &dummy_hash, kAudio);
EXPECT_EQ(0u, end_session_result);
- CheckServiceExists(uid_, out_context_.new_session_id_, kAudio, false);
+ CheckServiceExists(uid_, out_context_.new_session_id_, kAudio, uid_, false);
}
TEST_F(ConnectionHandlerTest, ServiceStop) {
@@ -1204,7 +1249,7 @@ TEST_F(ConnectionHandlerTest, ServiceStop) {
connection_handler_->OnSessionEndedCallback(
uid_, out_context_.new_session_id_, &some_hash_id, kAudio);
EXPECT_EQ(connection_key_, end_session_result);
- CheckServiceExists(uid_, out_context_.new_session_id_, kAudio, false);
+ CheckServiceExists(uid_, out_context_.new_session_id_, kAudio, uid_, false);
}
}
@@ -1235,8 +1280,8 @@ TEST_F(ConnectionHandlerTest, SessionStop_CheckSpecificHash) {
for (uint32_t session = 0; session < 0xFF; ++session) {
AddTestSession();
- uint32_t wrong_hash = protocol_handler::HASH_ID_WRONG;
- uint32_t hash = protocol_handler::HASH_ID_NOT_SUPPORTED;
+ uint32_t hash = connection_key_;
+ uint32_t wrong_hash = hash + 1;
const uint32_t end_audio_wrong_hash =
connection_handler_->OnSessionEndedCallback(
@@ -1464,7 +1509,7 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_Multiple) {
TEST_F(ConnectionHandlerTest,
SessionStarted_StartSession_SecureSpecific_Unprotect) {
- EXPECT_CALL(mock_connection_handler_settings, heart_beat_timeout())
+ EXPECT_CALL(mock_connection_handler_settings_, heart_beat_timeout())
.WillOnce(Return(heartbeat_timeout));
// Add virtual device and connection
AddTestDeviceConnection();
@@ -2003,6 +2048,198 @@ TEST_F(ConnectionHandlerTest, OnDeviceConnectionSwitching) {
connection_handler_->OnDeviceSwitchingStart(mac_address_, second_mac_address);
}
+TEST_F(ConnectionHandlerTest, StartStopSecondarySession) {
+ // Add virtual device and connection
+ AddTestDeviceConnection();
+ // Start new session with RPC service
+ AddTestSession();
+
+ connection_handler_test::MockConnectionHandlerObserver
+ mock_connection_handler_observer;
+ connection_handler_->set_connection_handler_observer(
+ &mock_connection_handler_observer);
+
+ // Start a session on a secondary transport
+ const transport_manager::DeviceInfo secondary_device_info(
+ device_handle_, mac_address_, device_name_, std::string("WIFI"));
+ const transport_manager::ConnectionUID secondary_uid = 2u;
+ // Add Device and connection
+ ON_CALL(mock_connection_handler_settings_, heart_beat_timeout())
+ .WillByDefault(Return(1000u));
+ connection_handler_->addDeviceConnection(secondary_device_info,
+ secondary_uid);
+
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnSecondaryTransportStartedCallback(device_handle_, _))
+ .Times(1);
+
+ connection_handler_->OnSecondaryTransportStarted(
+ uid_, secondary_uid, out_context_.new_session_id_);
+
+ SessionTransports st =
+ connection_handler_->GetSessionTransports(out_context_.new_session_id_);
+ EXPECT_EQ(st.primary_transport, uid_);
+ EXPECT_EQ(st.secondary_transport, secondary_uid);
+
+ AddSecondaryTestService(kAudio);
+ AddSecondaryTestService(kMobileNav);
+
+ CheckServiceExists(
+ uid_, out_context_.new_session_id_, kAudio, secondary_uid, true);
+ CheckServiceExists(
+ uid_, out_context_.new_session_id_, kMobileNav, secondary_uid, true);
+
+ connection_handler_->set_connection_handler_observer(
+ &mock_connection_handler_observer);
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnSecondaryTransportEndedCallback(_))
+ .Times(1);
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(_, kAudio, _))
+ .Times(1);
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(_, kMobileNav, _))
+ .Times(1);
+
+ connection_handler_->OnSecondaryTransportEnded(uid_, secondary_uid);
+
+ st = connection_handler_->GetSessionTransports(out_context_.new_session_id_);
+ EXPECT_EQ(st.primary_transport, uid_);
+ EXPECT_EQ(st.secondary_transport, 0u);
+
+ CheckServiceExists(
+ uid_, out_context_.new_session_id_, kAudio, secondary_uid, false);
+ CheckServiceExists(
+ uid_, out_context_.new_session_id_, kMobileNav, secondary_uid, false);
+}
+
+TEST_F(ConnectionHandlerTest, StopSecondarySession_NoService) {
+ AddTestDeviceConnection();
+ AddTestSession();
+
+ connection_handler_test::MockConnectionHandlerObserver
+ mock_connection_handler_observer;
+ connection_handler_->set_connection_handler_observer(
+ &mock_connection_handler_observer);
+
+ const transport_manager::DeviceInfo secondary_device_info(
+ device_handle_, mac_address_, device_name_, std::string("WIFI"));
+ const transport_manager::ConnectionUID secondary_uid = 123u;
+ ON_CALL(mock_connection_handler_settings_, heart_beat_timeout())
+ .WillByDefault(Return(1000u));
+ connection_handler_->addDeviceConnection(secondary_device_info,
+ secondary_uid);
+
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnSecondaryTransportStartedCallback(device_handle_, _))
+ .Times(1);
+ connection_handler_->OnSecondaryTransportStarted(
+ uid_, secondary_uid, out_context_.new_session_id_);
+
+ // check if OnSecondaryTransportEndedCallback is triggered with correct
+ // session ID even if we don't have any services
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnSecondaryTransportEndedCallback(_));
+ EXPECT_CALL(mock_connection_handler_observer, OnServiceEndedCallback(_, _, _))
+ .Times(0);
+
+ connection_handler_->OnSecondaryTransportEnded(uid_, secondary_uid);
+
+ SessionTransports st =
+ connection_handler_->GetSessionTransports(out_context_.new_session_id_);
+ EXPECT_EQ(st.primary_transport, uid_);
+ EXPECT_EQ(st.secondary_transport, 0u);
+}
+
+TEST_F(ConnectionHandlerTest, ConnectionType_valid) {
+ AddTestDeviceConnection();
+ AddTestSession();
+
+ std::string ret =
+ connection_handler_->TransportTypeProfileStringFromConnHandle(uid_);
+ EXPECT_EQ(connection_type_, ret);
+}
+
+TEST_F(ConnectionHandlerTest, ConnectionType_invalid) {
+ AddTestDeviceConnection();
+
+ transport_manager::ConnectionUID invalid_uid = 12345;
+ ASSERT_TRUE(invalid_uid != uid_);
+ std::string ret =
+ connection_handler_->TransportTypeProfileStringFromConnHandle(
+ invalid_uid);
+ EXPECT_EQ(std::string(), ret);
+}
+
+TEST_F(ConnectionHandlerTest, SetSecondaryTransportID_UpdateSuccess) {
+ uint8_t session_id = 123;
+ transport_manager::ConnectionUID primary_uid = 100;
+ transport_manager::ConnectionUID secondary_uid = 0;
+
+ SessionConnectionMap& session_connection_map =
+ connection_handler_->getSessionConnectionMap();
+ // secondary transport's ID is 0
+ SessionTransports st = {primary_uid, secondary_uid};
+ session_connection_map[session_id] = st;
+
+ secondary_uid = 200;
+ st = connection_handler_->SetSecondaryTransportID(session_id, secondary_uid);
+ EXPECT_EQ(primary_uid, st.primary_transport);
+ EXPECT_EQ(secondary_uid, st.secondary_transport);
+}
+
+TEST_F(ConnectionHandlerTest, SetSecondaryTransportID_UpdateFailure) {
+ uint8_t session_id = 123;
+ transport_manager::ConnectionUID primary_uid = 100;
+ transport_manager::ConnectionUID secondary_uid = 300;
+
+ SessionConnectionMap& session_connection_map =
+ connection_handler_->getSessionConnectionMap();
+ // secondary transport's ID is already assigned
+ SessionTransports st = {primary_uid, secondary_uid};
+ session_connection_map[session_id] = st;
+
+ st = connection_handler_->SetSecondaryTransportID(session_id, 500);
+ EXPECT_EQ(primary_uid, st.primary_transport);
+ // secondary transport's ID is NOT updated
+ EXPECT_EQ(secondary_uid, st.secondary_transport);
+}
+
+TEST_F(ConnectionHandlerTest, SetSecondaryTransportID_OverwirteSecondaryUID) {
+ uint8_t session_id = 123;
+ transport_manager::ConnectionUID primary_uid = 200;
+ transport_manager::ConnectionUID secondary_uid = 500;
+
+ SessionConnectionMap& session_connection_map =
+ connection_handler_->getSessionConnectionMap();
+ SessionTransports st = {primary_uid, secondary_uid};
+ session_connection_map[session_id] = st;
+
+ secondary_uid = kDisabledSecondary;
+ st = connection_handler_->SetSecondaryTransportID(session_id, secondary_uid);
+ EXPECT_EQ(primary_uid, st.primary_transport);
+ // secondary transport's ID is updated
+ EXPECT_EQ(secondary_uid, st.secondary_transport);
+}
+
+TEST_F(ConnectionHandlerTest, SetSecondaryTransportID_Failure) {
+ uint8_t session_id = 123;
+ transport_manager::ConnectionUID primary_uid = 100;
+ transport_manager::ConnectionUID secondary_uid = 0;
+
+ SessionConnectionMap& session_connection_map =
+ connection_handler_->getSessionConnectionMap();
+ SessionTransports st = {primary_uid, secondary_uid};
+ session_connection_map[session_id] = st;
+
+ uint8_t invalid_session_id = 10;
+ secondary_uid = 300;
+ st = connection_handler_->SetSecondaryTransportID(invalid_session_id,
+ secondary_uid);
+ EXPECT_EQ(0u, st.primary_transport);
+ EXPECT_EQ(0u, st.secondary_transport);
+}
+
} // namespace connection_handler_test
} // namespace components
} // namespace test
diff --git a/src/components/connection_handler/test/connection_test.cc b/src/components/connection_handler/test/connection_test.cc
index de21dd1e97..dd86831225 100644
--- a/src/components/connection_handler/test/connection_test.cc
+++ b/src/components/connection_handler/test/connection_test.cc
@@ -34,11 +34,12 @@
#include "gtest/gtest.h"
-#include "protocol/common.h"
#include "connection_handler/connection.h"
#include "connection_handler/connection_handler_impl.h"
-#include "protocol/service_type.h"
+#include "connection_handler/mock_connection_handler.h"
#include "connection_handler/mock_connection_handler_settings.h"
+#include "protocol/common.h"
+#include "protocol/service_type.h"
#include "transport_manager/mock_transport_manager.h"
#ifdef ENABLE_SECURITY
#include "security_manager/mock_security_manager.h"
@@ -56,6 +57,8 @@ namespace connection_handler_test {
using namespace ::connection_handler;
using namespace ::protocol_handler;
+using ::testing::Return;
+
class ConnectionTest : public ::testing::Test {
protected:
void SetUp() OVERRIDE {
@@ -78,7 +81,7 @@ class ConnectionTest : public ::testing::Test {
session_id, protocol_handler::PROTOCOL_VERSION_3);
}
void StartDefaultSession() {
- session_id = connection_->AddNewSession();
+ session_id = connection_->AddNewSession(kDefaultConnectionHandle);
EXPECT_NE(session_id, 0u);
const SessionMap sessionMap = connection_->session_map();
EXPECT_FALSE(sessionMap.empty());
@@ -88,13 +91,14 @@ class ConnectionTest : public ::testing::Test {
std::find(serviceList.begin(), serviceList.end(), kRpc);
const bool found_result = (it != serviceList.end());
EXPECT_TRUE(found_result);
+ EXPECT_EQ(connection_->primary_connection_handle(), 0);
}
void AddNewService(const ServiceType service_type,
const bool protection,
const bool expect_add_new_service_call_result,
const bool expect_exist_service) {
- const bool result =
- connection_->AddNewService(session_id, service_type, protection);
+ const bool result = connection_->AddNewService(
+ session_id, service_type, protection, kDefaultConnectionHandle);
EXPECT_EQ(result, expect_add_new_service_call_result);
#ifdef ENABLE_SECURITY
@@ -110,12 +114,35 @@ class ConnectionTest : public ::testing::Test {
std::find(newServiceList.begin(), newServiceList.end(), service_type);
const bool found_result = it != newServiceList.end();
EXPECT_EQ(expect_exist_service, found_result);
-#ifdef ENABLE_SECURITY
if (found_result) {
const Service& service = *it;
+ transport_manager::ConnectionUID expected_connection_handle =
+ kDefaultConnectionHandle;
+ EXPECT_EQ(service.connection_id, expected_connection_handle);
+#ifdef ENABLE_SECURITY
EXPECT_EQ(service.is_protected_, protection);
- }
#endif // ENABLE_SECURITY
+ }
+ }
+ void AddNewSecondaryService(const ServiceType service_type) {
+ const bool result = connection_->AddNewService(
+ session_id, service_type, false, kSecondaryConnectionHandle);
+ EXPECT_EQ(result, true);
+
+ const SessionMap session_map = connection_->session_map();
+ EXPECT_FALSE(session_map.empty());
+ const ServiceList newServiceList = session_map.begin()->second.service_list;
+ EXPECT_FALSE(newServiceList.empty());
+ const ServiceList::const_iterator it =
+ std::find(newServiceList.begin(), newServiceList.end(), service_type);
+ const bool found_result = it != newServiceList.end();
+ EXPECT_TRUE(found_result);
+ if (found_result) {
+ const Service& service = *it;
+ transport_manager::ConnectionUID expected_secondary_connection_handle =
+ kSecondaryConnectionHandle;
+ EXPECT_EQ(service.connection_id, expected_secondary_connection_handle);
+ }
}
void RemoveService(const ServiceType service_type,
@@ -141,6 +168,8 @@ class ConnectionTest : public ::testing::Test {
transport_manager_mock;
ConnectionHandlerImpl* connection_handler_;
uint32_t session_id;
+ static const transport_manager::ConnectionUID kDefaultConnectionHandle = 1;
+ static const transport_manager::ConnectionUID kSecondaryConnectionHandle = 2;
};
TEST_F(ConnectionTest, Session_TryGetProtocolVersionWithoutSession) {
@@ -236,13 +265,17 @@ TEST_F(ConnectionTest, HeartBeat_Protocol5_ZeroHeartBeat_NotSupported) {
// Try to add service without session
TEST_F(ConnectionTest, Session_AddNewServiceWithoutSession) {
- EXPECT_EQ(connection_->AddNewService(session_id, kAudio, true),
+ EXPECT_EQ(connection_->AddNewService(
+ session_id, kAudio, true, kDefaultConnectionHandle),
EXPECT_RETURN_FALSE);
- EXPECT_EQ(connection_->AddNewService(session_id, kAudio, false),
+ EXPECT_EQ(connection_->AddNewService(
+ session_id, kAudio, false, kDefaultConnectionHandle),
EXPECT_RETURN_FALSE);
- EXPECT_EQ(connection_->AddNewService(session_id, kMobileNav, true),
+ EXPECT_EQ(connection_->AddNewService(
+ session_id, kMobileNav, true, kDefaultConnectionHandle),
EXPECT_RETURN_FALSE);
- EXPECT_EQ(connection_->AddNewService(session_id, kMobileNav, false),
+ EXPECT_EQ(connection_->AddNewService(
+ session_id, kMobileNav, false, kDefaultConnectionHandle),
EXPECT_RETURN_FALSE);
}
@@ -409,6 +442,133 @@ TEST_F(ConnectionTest, RemoveSession) {
EXPECT_EQ(0u, connection_->RemoveSession(session_id));
}
+TEST_F(ConnectionTest, AddNewSession_VerifyAddSessionCalled) {
+ MockConnectionHandler mock_connection_handler;
+
+ ConnectionHandle connection_handle = 123;
+ DeviceHandle device_handle = 0u;
+ uint32_t heart_beat = 10000u;
+ Connection* connection = new Connection(
+ connection_handle, device_handle, &mock_connection_handler, heart_beat);
+
+ transport_manager::ConnectionUID connection_handle_uid = 1;
+ uint32_t mock_session_id = 2;
+ EXPECT_CALL(mock_connection_handler, AddSession(connection_handle_uid))
+ .WillOnce(Return(mock_session_id));
+
+ uint32_t sid = connection->AddNewSession(connection_handle_uid);
+ EXPECT_EQ(mock_session_id, sid);
+
+ EXPECT_CALL(mock_connection_handler, RemoveSession(mock_session_id))
+ .WillOnce(Return(true)); // invoked by destructor of connection
+ delete connection;
+}
+
+TEST_F(ConnectionTest, RemoveSession_VerifyRemoveSessionCalled) {
+ MockConnectionHandler mock_connection_handler;
+
+ ConnectionHandle connection_handle = 123;
+ DeviceHandle device_handle = 0u;
+ uint32_t heart_beat = 10000u;
+ Connection* connection = new Connection(
+ connection_handle, device_handle, &mock_connection_handler, heart_beat);
+
+ transport_manager::ConnectionUID connection_handle_uid = 1;
+ uint32_t mock_session_id = 10;
+ EXPECT_CALL(mock_connection_handler, AddSession(connection_handle_uid))
+ .WillOnce(Return(mock_session_id));
+ EXPECT_CALL(mock_connection_handler,
+ RemoveSession(static_cast<uint8_t>(mock_session_id)))
+ .WillOnce(Return(true));
+
+ uint32_t sid = connection->AddNewSession(connection_handle_uid);
+
+ uint32_t ret = connection->RemoveSession(sid);
+ EXPECT_EQ(sid, ret);
+
+ delete connection;
+}
+
+TEST_F(ConnectionTest, SecondarySessionTest) {
+ StartSession();
+ AddNewService(
+ kRpc, PROTECTION_OFF, EXPECT_RETURN_FALSE, EXPECT_SERVICE_EXISTS);
+
+ const ConnectionHandle connectionHandle = 0;
+ const DeviceHandle device_handle = 0u;
+ const uint32_t heart_beat = 0u;
+ Connection* secondary_connection = new Connection(
+ connectionHandle, device_handle, connection_handler_, heart_beat);
+
+ secondary_connection->SetPrimaryConnectionHandle(kDefaultConnectionHandle);
+ connection_handler::ConnectionHandle expected_primary_connection_handle =
+ kDefaultConnectionHandle;
+ EXPECT_EQ(secondary_connection->primary_connection_handle(),
+ expected_primary_connection_handle);
+
+ AddNewSecondaryService(kAudio);
+ AddNewSecondaryService(kMobileNav);
+
+ delete secondary_connection;
+}
+
+TEST_F(ConnectionTest, RemoveSecondaryServices_SUCCESS) {
+ StartSession();
+
+ ServiceType services[2] = {kMobileNav, kAudio};
+ AddNewSecondaryService(services[0]);
+ AddNewSecondaryService(services[1]);
+ size_t services_count = sizeof(services) / sizeof(services[0]);
+
+ std::list<ServiceType> removed_services;
+ uint8_t ret_session_id = connection_->RemoveSecondaryServices(
+ kSecondaryConnectionHandle, removed_services);
+
+ // check return value
+ EXPECT_EQ(session_id, ret_session_id);
+ // check returned list
+ EXPECT_EQ(services_count, removed_services.size());
+ std::list<protocol_handler::ServiceType>::iterator it;
+ it = std::find(removed_services.begin(), removed_services.end(), services[0]);
+ EXPECT_TRUE(it != removed_services.end());
+ it = std::find(removed_services.begin(), removed_services.end(), services[1]);
+ EXPECT_TRUE(it != removed_services.end());
+}
+
+TEST_F(ConnectionTest, RemoveSecondaryServices_NoService) {
+ StartSession();
+ /* do not call AddNewSecondaryService() */
+
+ std::list<ServiceType> removed_services;
+ uint8_t ret_session_id = connection_->RemoveSecondaryServices(
+ kSecondaryConnectionHandle, removed_services);
+
+ // check return value
+ EXPECT_EQ(0, ret_session_id);
+ // check returned list
+ EXPECT_EQ(0u, removed_services.size());
+}
+
+TEST_F(ConnectionTest, RemoveSecondaryServices_InvalidConnectionHandle) {
+ StartSession();
+
+ ServiceType services[2] = {kMobileNav, kAudio};
+ AddNewSecondaryService(services[0]);
+ AddNewSecondaryService(services[1]);
+
+ transport_manager::ConnectionUID invalid_connection_handle = 123;
+ ASSERT_TRUE(kSecondaryConnectionHandle != invalid_connection_handle);
+
+ std::list<ServiceType> removed_services;
+ uint8_t ret_session_id = connection_->RemoveSecondaryServices(
+ invalid_connection_handle, removed_services);
+
+ // check return value
+ EXPECT_EQ(0, ret_session_id);
+ // check returned list
+ EXPECT_EQ(0u, removed_services.size());
+}
+
#ifdef ENABLE_SECURITY
TEST_F(ConnectionTest, SetSSLContextWithoutSession) {
diff --git a/src/components/connection_handler/test/device_test.cc b/src/components/connection_handler/test/device_test.cc
index 8c6d0af57a..555bd8ed2a 100644
--- a/src/components/connection_handler/test/device_test.cc
+++ b/src/components/connection_handler/test/device_test.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "connection_handler/device.h"
#include <gtest/gtest.h>
#include "encryption/hashing.h"
-#include "connection_handler/device.h"
namespace test {
namespace components {
@@ -75,6 +75,6 @@ TEST(ConnectionDevice, MacAddressHash) {
EXPECT_EQ(hashed_mac_address, test_device.mac_address());
}
-} // namespace connection_handlet_test
+} // namespace connection_handler_test
} // namespace components
} // namespace test
diff --git a/src/components/connection_handler/test/heart_beat_monitor_test.cc b/src/components/connection_handler/test/heart_beat_monitor_test.cc
index 4c67c97191..d736255134 100644
--- a/src/components/connection_handler/test/heart_beat_monitor_test.cc
+++ b/src/components/connection_handler/test/heart_beat_monitor_test.cc
@@ -30,48 +30,56 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include <iostream>
-#include "gtest/gtest.h"
-#include "connection_handler/heartbeat_monitor.h"
+#include <string>
#include "connection_handler/connection.h"
#include "connection_handler/connection_handler.h"
+#include "connection_handler/heartbeat_monitor.h"
#include "connection_handler/mock_connection_handler.h"
+#include "gtest/gtest.h"
#include "utils/test_async_waiter.h"
namespace {
const int32_t MILLISECONDS_IN_SECOND = 1000;
const int32_t MICROSECONDS_IN_MILLISECONDS = 1000;
const int32_t MICROSECONDS_IN_SECOND = 1000 * 1000;
-}
+const uint32_t kTime_offset = 20u;
+} // namespace
namespace test {
namespace components {
namespace connection_handler_test {
-using ::testing::DoAll;
using ::testing::_;
+using ::testing::DoAll;
+using ::testing::Return;
class HeartBeatMonitorTest : public testing::Test {
public:
- HeartBeatMonitorTest() : conn(NULL) {
- kTimeout = 5000u;
- }
+ HeartBeatMonitorTest()
+ : connection_(NULL)
+ , timeout_(100u)
+ , time_allowance_multiplier_(1.5)
+ , expiration_timeout_(timeout_ * 2u) {}
protected:
- testing::NiceMock<MockConnectionHandler> connection_handler_mock;
- connection_handler::Connection* conn;
- uint32_t kTimeout;
- static const connection_handler::ConnectionHandle kConnectionHandle =
+ testing::NiceMock<MockConnectionHandler> connection_handler_mock_;
+ connection_handler::Connection* connection_;
+ const uint32_t timeout_;
+ const float_t time_allowance_multiplier_;
+ const uint32_t expiration_timeout_;
+ static const connection_handler::ConnectionHandle connection_handle_ =
0xABCDEF;
+ static const transport_manager::ConnectionUID kDefaultConnectionHandle = 1;
+ static const uint32_t kDefaultSessionId = 1;
- virtual void SetUp() {
- conn = new connection_handler::Connection(
- kConnectionHandle, 0, &connection_handler_mock, kTimeout);
+ void SetUp() OVERRIDE {
+ connection_ = new connection_handler::Connection(
+ connection_handle_, 0, &connection_handler_mock_, timeout_);
}
void TearDown() OVERRIDE {
- delete conn;
+ delete connection_;
}
};
@@ -80,159 +88,191 @@ ACTION_P2(RemoveSession, conn, session_id) {
}
TEST_F(HeartBeatMonitorTest, TimerNotStarted) {
+ EXPECT_CALL(connection_handler_mock_, AddSession(_))
+ .WillOnce(Return(kDefaultSessionId));
+ EXPECT_CALL(connection_handler_mock_, RemoveSession(kDefaultSessionId))
+ .WillOnce(Return(true)); // called by destructor of Connection
+
// Whithout StartHeartBeat nothing to be call
- EXPECT_CALL(connection_handler_mock, CloseSession(_, _)).Times(0);
- EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
- EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
+ EXPECT_CALL(connection_handler_mock_, CloseSession(_, _)).Times(0);
+ EXPECT_CALL(connection_handler_mock_, CloseConnection(_)).Times(0);
+ EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, _)).Times(0);
- conn->AddNewSession();
+ connection_->AddNewSession(kDefaultConnectionHandle);
}
TEST_F(HeartBeatMonitorTest, TimerNotElapsed) {
- EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
- EXPECT_CALL(connection_handler_mock, CloseSession(_, _)).Times(0);
- EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
+ EXPECT_CALL(connection_handler_mock_, AddSession(_))
+ .WillOnce(Return(kDefaultSessionId));
+ EXPECT_CALL(connection_handler_mock_, RemoveSession(kDefaultSessionId))
+ .WillOnce(Return(true));
- const uint32_t session = conn->AddNewSession();
- conn->StartHeartBeat(session);
+ EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, _)).Times(0);
+ EXPECT_CALL(connection_handler_mock_, CloseSession(_, _)).Times(0);
+ EXPECT_CALL(connection_handler_mock_, CloseConnection(_)).Times(0);
+
+ const uint32_t session = connection_->AddNewSession(kDefaultConnectionHandle);
+ connection_->StartHeartBeat(session);
}
TEST_F(HeartBeatMonitorTest, TimerElapsed) {
- const uint32_t session = conn->AddNewSession();
+ EXPECT_CALL(connection_handler_mock_, AddSession(_))
+ .WillOnce(Return(kDefaultSessionId));
+ EXPECT_CALL(connection_handler_mock_, RemoveSession(kDefaultSessionId))
+ .WillOnce(Return(true)); // invoked by RemoveSession action
+
+ const uint32_t session = connection_->AddNewSession(kDefaultConnectionHandle);
TestAsyncWaiter waiter;
uint32_t times = 0;
- EXPECT_CALL(connection_handler_mock, CloseSession(_, session, _))
- .WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter), RemoveSession(conn, session)));
- times++;
- EXPECT_CALL(connection_handler_mock, CloseConnection(_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ EXPECT_CALL(connection_handler_mock_, CloseSession(_, session, _))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter),
+ RemoveSession(connection_, session)));
times++;
- EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, session))
+ EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, session))
.WillOnce(NotifyTestAsyncWaiter(&waiter));
times++;
- conn->StartHeartBeat(session);
+ connection_->StartHeartBeat(session);
EXPECT_TRUE(waiter.WaitFor(
times,
- 2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
+ 2 * timeout_ * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
}
TEST_F(HeartBeatMonitorTest, KeptAlive) {
- EXPECT_CALL(connection_handler_mock, CloseSession(_, _)).Times(0);
- EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
- EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
-
- const uint32_t session = conn->AddNewSession();
- conn->StartHeartBeat(session);
- usleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
- conn->KeepAlive(session);
- usleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
- conn->KeepAlive(session);
- usleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
- conn->KeepAlive(session);
- usleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
+ EXPECT_CALL(connection_handler_mock_, AddSession(_))
+ .WillOnce(Return(kDefaultSessionId));
+ EXPECT_CALL(connection_handler_mock_, RemoveSession(kDefaultSessionId))
+ .WillOnce(Return(true));
+
+ EXPECT_CALL(connection_handler_mock_, CloseSession(_, _)).Times(0);
+ EXPECT_CALL(connection_handler_mock_, CloseConnection(_)).Times(0);
+ EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, _)).Times(0);
+
+ const uint32_t session = connection_->AddNewSession(kDefaultConnectionHandle);
+ connection_->StartHeartBeat(session);
+ usleep(timeout_);
+ connection_->KeepAlive(session);
+ usleep(timeout_);
+ connection_->KeepAlive(session);
}
TEST_F(HeartBeatMonitorTest, NotKeptAlive) {
- const uint32_t session = conn->AddNewSession();
+ EXPECT_CALL(connection_handler_mock_, AddSession(_))
+ .WillOnce(Return(kDefaultSessionId));
+ EXPECT_CALL(connection_handler_mock_, RemoveSession(kDefaultSessionId))
+ .WillOnce(Return(true));
+
+ const uint32_t session = connection_->AddNewSession(kDefaultConnectionHandle);
TestAsyncWaiter waiter;
uint32_t times = 0;
- EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, session))
+ EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, session))
.WillOnce(NotifyTestAsyncWaiter(&waiter));
times++;
- EXPECT_CALL(connection_handler_mock, CloseSession(_, session, _))
- .WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter), RemoveSession(conn, session)));
- times++;
- EXPECT_CALL(connection_handler_mock, CloseConnection(_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ EXPECT_CALL(connection_handler_mock_, CloseSession(_, session, _))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter),
+ RemoveSession(connection_, session)));
times++;
- conn->StartHeartBeat(session);
- usleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
- conn->KeepAlive(session);
- usleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
- conn->KeepAlive(session);
- usleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
- conn->KeepAlive(session);
- usleep(2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND);
+ connection_->StartHeartBeat(session);
+ usleep(timeout_);
+ connection_->KeepAlive(session);
EXPECT_TRUE(waiter.WaitFor(
times,
- 2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
+ 2 * timeout_ * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
}
TEST_F(HeartBeatMonitorTest, TwoSessionsElapsed) {
- const uint32_t kSession1 = conn->AddNewSession();
- const uint32_t kSession2 = conn->AddNewSession();
+ const uint32_t kMockSessionId1 = 1;
+ const uint32_t kMockSessionId2 = 2;
+ EXPECT_CALL(connection_handler_mock_, AddSession(_))
+ .WillOnce(Return(kMockSessionId1))
+ .WillOnce(Return(kMockSessionId2));
+ EXPECT_CALL(connection_handler_mock_, RemoveSession(kMockSessionId1))
+ .WillOnce(Return(true));
+ EXPECT_CALL(connection_handler_mock_, RemoveSession(kMockSessionId2))
+ .WillOnce(Return(true));
+
+ const uint32_t kSession1 =
+ connection_->AddNewSession(kDefaultConnectionHandle);
+
+ const transport_manager::ConnectionUID kAnotherConnectionHandle = 2;
+ const uint32_t kSession2 =
+ connection_->AddNewSession(kAnotherConnectionHandle);
TestAsyncWaiter waiter;
uint32_t times = 0;
- EXPECT_CALL(connection_handler_mock, CloseSession(_, kSession1, _))
+ EXPECT_CALL(connection_handler_mock_, CloseSession(_, kSession1, _))
.WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter),
- RemoveSession(conn, kSession1)));
+ RemoveSession(connection_, kSession1)));
times++;
- EXPECT_CALL(connection_handler_mock, CloseSession(_, kSession2, _))
+ EXPECT_CALL(connection_handler_mock_, CloseSession(_, kSession2, _))
.WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter),
- RemoveSession(conn, kSession2)));
- times++;
- EXPECT_CALL(connection_handler_mock, CloseConnection(_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ RemoveSession(connection_, kSession2)));
times++;
- EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, kSession1))
+
+ EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, kSession1))
.WillOnce(NotifyTestAsyncWaiter(&waiter));
times++;
- EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, kSession2))
+ EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, kSession2))
.WillOnce(NotifyTestAsyncWaiter(&waiter));
times++;
- conn->StartHeartBeat(kSession1);
- conn->StartHeartBeat(kSession2);
+ connection_->StartHeartBeat(kSession1);
+ connection_->StartHeartBeat(kSession2);
EXPECT_TRUE(waiter.WaitFor(
times,
- 2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
+ 2 * timeout_ * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
}
TEST_F(HeartBeatMonitorTest, IncreaseHeartBeatTimeout) {
- const uint32_t kSession = conn->AddNewSession();
+ EXPECT_CALL(connection_handler_mock_, AddSession(_))
+ .WillOnce(Return(kDefaultSessionId));
+ EXPECT_CALL(connection_handler_mock_, RemoveSession(kDefaultSessionId))
+ .WillOnce(Return(true));
- EXPECT_CALL(connection_handler_mock, CloseSession(_, _)).Times(0);
- EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
- EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
+ const uint32_t kSession =
+ connection_->AddNewSession(kDefaultConnectionHandle);
- const uint32_t kNewTimeout = kTimeout + MICROSECONDS_IN_MILLISECONDS;
- conn->StartHeartBeat(kSession);
- conn->SetHeartBeatTimeout(kNewTimeout, kSession);
+ EXPECT_CALL(connection_handler_mock_, CloseSession(_, _)).Times(0);
+ EXPECT_CALL(connection_handler_mock_, CloseConnection(_)).Times(0);
+ EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, _)).Times(0);
+
+ const uint32_t kNewTimeout = timeout_ + MICROSECONDS_IN_MILLISECONDS;
+ connection_->StartHeartBeat(kSession);
+ connection_->SetHeartBeatTimeout(kNewTimeout, kSession);
}
TEST_F(HeartBeatMonitorTest, DecreaseHeartBeatTimeout) {
- const uint32_t kSession = conn->AddNewSession();
+ EXPECT_CALL(connection_handler_mock_, AddSession(_))
+ .WillOnce(Return(kDefaultSessionId));
+ EXPECT_CALL(connection_handler_mock_, RemoveSession(kDefaultSessionId))
+ .WillOnce(Return(true));
+
+ const uint32_t kSession =
+ connection_->AddNewSession(kDefaultConnectionHandle);
TestAsyncWaiter waiter;
uint32_t times = 0;
- EXPECT_CALL(connection_handler_mock, CloseSession(_, kSession, _))
- .WillOnce(
- DoAll(NotifyTestAsyncWaiter(&waiter), RemoveSession(conn, kSession)));
- times++;
- EXPECT_CALL(connection_handler_mock, CloseConnection(_))
- .WillOnce(NotifyTestAsyncWaiter(&waiter));
+ EXPECT_CALL(connection_handler_mock_, CloseSession(_, kSession, _))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter),
+ RemoveSession(connection_, kSession)));
times++;
- EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, kSession))
+ EXPECT_CALL(connection_handler_mock_, SendHeartBeat(_, kSession))
.WillOnce(NotifyTestAsyncWaiter(&waiter));
times++;
- const uint32_t kNewTimeout = kTimeout - MICROSECONDS_IN_MILLISECONDS;
- conn->StartHeartBeat(kSession);
- conn->SetHeartBeatTimeout(kNewTimeout, kSession);
+ const uint32_t new_timeout = timeout_ - kTime_offset;
+ connection_->StartHeartBeat(kSession);
+ connection_->SetHeartBeatTimeout(new_timeout, kSession);
EXPECT_TRUE(waiter.WaitFor(
times,
- 2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
+ 2 * timeout_ * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND));
}
} // namespace connection_handler_test
diff --git a/src/components/dbus/CMakeLists.txt b/src/components/dbus/CMakeLists.txt
deleted file mode 100644
index 26ff9373bf..0000000000
--- a/src/components/dbus/CMakeLists.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright (c) 2016, Ford Motor Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided with the
-# distribution.
-#
-# Neither the name of the Ford Motor Company nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
-
-include_directories (
- ${DBUS_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR}/include/
- ${CMAKE_SOURCE_DIR}/
- ${COMPONENTS_DIR}
- ${COMPONENTS_DIR}/formatters/include/
- ${COMPONENTS_DIR}/smart_objects/include/
- ${COMPONENTS_DIR}/utils/include/
- ${CMAKE_BINARY_DIR}/src/components/
-)
-
-set(PATHS
- ${CMAKE_CURRENT_SOURCE_DIR}/include
- ${CMAKE_CURRENT_SOURCE_DIR}/src
- ${CMAKE_CURRENT_SOURCE_DIR}/src/introspection_xml.cc
- ${CMAKE_CURRENT_BINARY_DIR}/message_descriptions.cc
-)
-collect_sources(SOURCES "${PATHS}")
-
-set(LIBRARIES
- HMI_API
- Utils
- dbus-1
-)
-
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/message_descriptions.cc
- COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/codegen/make_message_descriptions.py
- --infile ${CMAKE_CURRENT_SOURCE_DIR}/../interfaces/QT_HMI_API.xml
- --outdir ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../interfaces/QT_HMI_API.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/codegen/make_message_descriptions.py
-)
-
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/introspection_xml.cc
- COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/codegen/make_introspection_c.py
- --infile ${CMAKE_CURRENT_SOURCE_DIR}/../interfaces/QT_HMI_API.xml
- --outdir ${CMAKE_CURRENT_BINARY_DIR}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../interfaces/QT_HMI_API.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/codegen/make_introspection_c.py
-)
-
-add_library("DBus" ${SOURCES})
-
-target_link_libraries("DBus" "${LIBRARIES}")
-
-if(BUILD_TESTS)
- add_subdirectory(test)
-endif()
diff --git a/src/components/dbus/codegen/code_formatter.py b/src/components/dbus/codegen/code_formatter.py
deleted file mode 100644
index c3eb1b7815..0000000000
--- a/src/components/dbus/codegen/code_formatter.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# @file code_formatter.py
-# @brief Utility that helps to manage indents in generated code
-#
-# This file is a part of HMI D-Bus layer.
-#
-# Copyright (c) 2013, Ford Motor Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided with the
-# distribution.
-#
-# Neither the name of the Ford Motor Company nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-class CodeBlock:
- indent = 0
- def __init__(self, out):
- self.out = out
- if type(out) == file:
- self.indent = 0
- elif type(out) == CodeBlock:
- self.indent = out.indent
- def __enter__(self):
- self.indent += 1
- return self
- def __exit__(self, exc_type, exc_value, traceback):
- if self.indent >= 1:
- self.indent -= 1
- def write(self, s):
- for string in s.splitlines(True):
- self.out.write(' ' * self.indent + string)
-
-# vim: set ts=4 sw=4 et:
-
diff --git a/src/components/dbus/codegen/ford_xml_parser.py b/src/components/dbus/codegen/ford_xml_parser.py
deleted file mode 100644
index 4f9f222d24..0000000000
--- a/src/components/dbus/codegen/ford_xml_parser.py
+++ /dev/null
@@ -1,231 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# @file ford_xml_parser.py
-# @brief Parser for HMI_API.xml
-#
-# This file is a part of HMI D-Bus layer.
-#
-# Copyright (c) 2013, Ford Motor Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided with the
-# distribution.
-#
-# Neither the name of the Ford Motor Company nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-from xml.etree import ElementTree
-from collections import OrderedDict
-
-node_name = '/com/ford/hmi'
-
-class ParamDesc:
- pass
-
-class FordXmlParser:
- def __init__(self, in_el_tree, interface_path=None):
- self.interface_path = interface_path
- self.el_tree = in_el_tree
- self.find_enums()
- self.find_structs()
-
- def find_enums(self):
- self.enums = dict()
- for interface_el in self.el_tree.findall('interface'):
- interface_name = interface_el.get('name')
- for enum_el in interface_el.findall('enum'):
- enum_name = enum_el.get('name')
- self.enums[(interface_name,enum_name)] = enum_el
-
-
- def make_param_desc(self, param_el, iface=None):
- param_desc = ParamDesc()
- param_desc.name = param_el.get('name')
- param_desc.type = param_el.get('type')
- param_desc.enum = False
- param_desc.struct = False
- param_desc.fulltype = param_desc.type
- if param_el.get('mandatory') == 'false':
- param_desc.mandatory = False
- else:
- param_desc.mandatory = True
- if param_el.get('array') == 'true':
- param_desc.array = True
- else:
- param_desc.array = False
- param_desc.minValue = param_el.get('minvalue') if param_el.get('minvalue') else 0
- param_desc.maxValue = param_el.get('maxvalue')
- param_desc.minLength = param_el.get('minlength') if param_el.get('minlength') else 0
- param_desc.maxLength = param_el.get('maxlength')
- param_desc.minSize = param_el.get('minsize')
- param_desc.maxSize = param_el.get('maxsize')
-
- param_desc.restricted = param_desc.minValue != None or \
- param_desc.maxValue != None or \
- param_desc.minLength > 0 or \
- param_desc.maxLength > 0
- param_desc.restrictedArray = param_desc.array and (param_desc.minSize > 0 or param_desc.maxSize > 0)
- if iface is None:
- return param_desc
- if param_desc.type not in ['Integer', 'String', 'Boolean', 'Float']:
- param_type = param_desc.type.split('.')
- if len(param_type) > 1:
- param_type = (param_type[0], param_type[1])
- else:
- param_type = (iface, param_type[0])
- param_desc.fulltype = param_type
- if param_type in self.enums: param_desc.enum = True
- elif param_type in self.structs: param_desc.struct = True
- return param_desc
-
-
- def find_structs(self):
- self.structs = OrderedDict()
- for interface_el in self.el_tree.findall('interface'):
- interface_name = interface_el.get('name')
- for struct_el in interface_el.findall('struct'):
- struct_name = struct_el.get('name')
- self.structs[(interface_name, struct_name)] = []
-
- for interface_el in self.el_tree.findall('interface'):
- interface_name = interface_el.get('name')
- for struct_el in interface_el.findall('struct'):
- struct_name = struct_el.get('name')
- for param_el in struct_el.findall('param'):
- param_desc = self.make_param_desc(param_el, interface_name)
- self.structs[(interface_name, struct_name)].append(param_desc)
-
-
- def convert_struct_to_dbus(self, param_type):
- ret = '('
- struct = self.structs[param_type]
- for param in struct:
- ret = ret + self.convert_to_dbus_type(param)
- ret = ret + ')'
- return ret
-
-
- def convert_to_dbus_type(self, param):
- if param.type == 'Integer': restype = 'i'
- elif param.type == 'String': restype = 's'
- elif param.type == 'Boolean': restype = 'b'
- elif param.type == 'Float': restype = 'd' # D-Bus double
- elif param.enum: restype = 'i' # D-Bus 32-bit signed int
- elif param.struct: restype = self.convert_struct_to_dbus(param.fulltype)
- else: raise RuntimeError('Unknown type: ' + param.type)
- if param.array: restype = 'a' + restype
- if not param.mandatory: restype = '(b' + restype + ')'
- return restype
-
-
- def find_notifications(self, interface_el):
- notifications = list()
- for function_el in interface_el.findall('function[@messagetype="notification"]'):
- notifications.append(function_el)
- return notifications
-
-
- def find_notifications_by_provider(self, interface_el, provider):
- notifications = list()
- condition = 'function[@messagetype="notification"][@provider="%s"]' % provider
- for function_el in interface_el.findall(condition):
- notifications.append(function_el)
- return notifications
-
-
- def find_request_response_pairs(self, interface_el):
- result = list()
- request_els = interface_el.findall('function[@messagetype="request"]')
- response_els = interface_el.findall('function[@messagetype="response"]')
- for request_el in request_els:
- name = request_el.get('name')
- response_el = next(r for r in response_els if r.get('name') == name)
- result.append((request_el, response_el))
- return result
-
-
- def find_request_response_pairs_by_provider(self, interface_el, provider):
- result = list()
- condition = 'function[@messagetype="request"][@provider="%s"]' % provider
- request_els = interface_el.findall(condition)
- response_els = interface_el.findall('function[@messagetype="response"]')
- for request_el in request_els:
- name = request_el.get('name')
- response_el = next(r for r in response_els if r.get('name') == name)
- result.append((request_el, response_el))
- return result
-
-
- def convert_to_signal(self, notification_el, interface):
- result = ElementTree.Element('signal')
- result.set('name', notification_el.get('name'))
- for param_el in notification_el.findall('param'):
- self.create_arg_element(result, param_el, interface)
- return result
-
-
- def convert_to_method(self, (request_el, response_el), interface):
- result = ElementTree.Element('method')
- result.set('name', request_el.get('name'))
- for param_el in request_el.findall('param'):
- arg_el = self.create_arg_element(result, param_el, interface)
- arg_el.set('direction', 'in')
-
- arg_el = ElementTree.SubElement(result, 'arg')
- arg_el.set('name', 'retCode')
- arg_el.set('type', 'i')
- arg_el.set('direction', 'out')
-
- for param_el in response_el.findall('param'):
- arg_el = self.create_arg_element(result, param_el, interface)
- arg_el.set('direction', 'out')
- return result
-
-
- def create_arg_element(self, parent, param_el, interface):
- arg_el = ElementTree.SubElement(parent, 'arg')
- arg_el.set('name', param_el.get('name'))
- arg_el.set('type', self.convert_to_dbus_type(self.make_param_desc(param_el, interface)))
- return arg_el
-
-
- def create_introspection_iface_el(self, interface_el, provider):
- interface = interface_el.get('name')
- interface_name = self.interface_path + '.' + interface
-
- notifications = self.find_notifications_by_provider(interface_el, provider)
- signals = [self.convert_to_signal(n, interface) for n in notifications]
-
- request_responses = self.find_request_response_pairs_by_provider(interface_el, provider)
- methods = [self.convert_to_method(r, interface) for r in request_responses]
-
- if signals or methods:
- el = ElementTree.Element('interface', attrib={'name':interface_name})
- for m in methods: el.append(m)
- for s in signals: el.append(s)
- return el
-
-
-
diff --git a/src/components/dbus/codegen/introspection_xml.cc b/src/components/dbus/codegen/introspection_xml.cc
deleted file mode 100644
index 210c232a4d..0000000000
--- a/src/components/dbus/codegen/introspection_xml.cc
+++ /dev/null
@@ -1,327 +0,0 @@
-// Warning! This file is generated by 'make_introspection_c.py'. Edit at your
-// own risk.
-/**
- * @file instrospections_xml.cc
- * @brief D-Bus introspection XML as C-string
- *
- * This file is a part of HMI D-Bus layer.
- */
-// Copyright (c) 2013, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-char introspection_xml[] = {
- 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, 0x6e, 0x6f,
- 0x64, 0x65, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x22, 0x2d,
- 0x2f, 0x2f, 0x66, 0x72, 0x65, 0x65, 0x64, 0x65, 0x73, 0x6b, 0x74, 0x6f,
- 0x70, 0x2f, 0x2f, 0x44, 0x54, 0x44, 0x20, 0x44, 0x2d, 0x42, 0x55, 0x53,
- 0x20, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x49, 0x6e, 0x74, 0x72,
- 0x6f, 0x73, 0x70, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x2e,
- 0x30, 0x2f, 0x2f, 0x45, 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70,
- 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x64,
- 0x65, 0x73, 0x6b, 0x74, 0x6f, 0x70, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x73,
- 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x73, 0x2f, 0x64, 0x62, 0x75,
- 0x73, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x73,
- 0x70, 0x65, 0x63, 0x74, 0x2e, 0x64, 0x74, 0x64, 0x22, 0x3e, 0x0a, 0x3c,
- 0x6e, 0x6f, 0x64, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x2f,
- 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6f, 0x72, 0x64, 0x2f, 0x68, 0x6d, 0x69,
- 0x22, 0x3e, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x66,
- 0x6f, 0x72, 0x64, 0x2e, 0x68, 0x6d, 0x69, 0x2e, 0x73, 0x64, 0x6c, 0x2e,
- 0x42, 0x61, 0x73, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69,
- 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3e, 0x3c, 0x73, 0x69, 0x67,
- 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e,
- 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x53,
- 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70, 0x49, 0x44, 0x22,
- 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e,
- 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69,
- 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f,
- 0x6e, 0x53, 0x44, 0x4c, 0x50, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65,
- 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x46, 0x69, 0x6c, 0x65, 0x52,
- 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x4e,
- 0x61, 0x6d, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x73,
- 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d,
- 0x65, 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22,
- 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e,
- 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61,
- 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61,
- 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x67,
- 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x22, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70, 0x6c,
- 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x20, 0x74, 0x79, 0x70,
- 0x65, 0x3d, 0x22, 0x28, 0x73, 0x28, 0x62, 0x73, 0x29, 0x28, 0x62, 0x73,
- 0x29, 0x28, 0x73, 0x73, 0x28, 0x62, 0x69, 0x29, 0x28, 0x62, 0x62, 0x29,
- 0x29, 0x73, 0x28, 0x62, 0x61, 0x28, 0x73, 0x69, 0x29, 0x29, 0x28, 0x62,
- 0x61, 0x73, 0x29, 0x69, 0x69, 0x62, 0x28, 0x62, 0x61, 0x69, 0x29, 0x28,
- 0x62, 0x62, 0x29, 0x28, 0x62, 0x61, 0x69, 0x29, 0x29, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x74, 0x74, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70,
- 0x65, 0x3d, 0x22, 0x28, 0x62, 0x61, 0x28, 0x73, 0x69, 0x29, 0x29, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x76, 0x72, 0x53, 0x79, 0x6e, 0x6f, 0x6e, 0x79, 0x6d, 0x73,
- 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x61, 0x73,
- 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x56, 0x72,
- 0x47, 0x72, 0x61, 0x6d, 0x6d, 0x61, 0x72, 0x73, 0x22, 0x20, 0x74, 0x79,
- 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x62, 0x29, 0x22, 0x20, 0x2f, 0x3e,
- 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x70,
- 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x20, 0x74, 0x79, 0x70,
- 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c,
- 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67,
- 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e,
- 0x41, 0x70, 0x70, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
- 0x72, 0x65, 0x64, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x75, 0x6e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74,
- 0x65, 0x64, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74,
- 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x61, 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d,
- 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e,
- 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x6f, 0x6e,
- 0x65, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x61, 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70,
- 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x6d, 0x65, 0x74, 0x68, 0x6f,
- 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d,
- 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e,
- 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x53, 0x44, 0x4c, 0x43, 0x6c,
- 0x6f, 0x73, 0x65, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e,
- 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x50,
- 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x6f, 0x66, 0x66, 0x73, 0x65,
- 0x74, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69,
- 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x20,
- 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22, 0x20,
- 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
- 0x22, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x20, 0x74,
- 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x74, 0x79,
- 0x70, 0x65, 0x3d, 0x22, 0x73, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x73, 0x79, 0x6e, 0x63,
- 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x74, 0x79,
- 0x70, 0x65, 0x3d, 0x22, 0x73, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65,
- 0x54, 0x79, 0x70, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65,
- 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x28, 0x62, 0x62, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f,
- 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x3e, 0x3c, 0x2f, 0x69, 0x6e, 0x74,
- 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x3e, 0x3c, 0x69, 0x6e, 0x74, 0x65,
- 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x6f, 0x72, 0x64, 0x2e, 0x68, 0x6d, 0x69,
- 0x2e, 0x73, 0x64, 0x6c, 0x2e, 0x55, 0x49, 0x22, 0x3e, 0x3c, 0x73, 0x69,
- 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f,
- 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x61, 0x72, 0x74,
- 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
- 0x22, 0x61, 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67,
- 0x6e, 0x61, 0x6c, 0x3e, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66,
- 0x61, 0x63, 0x65, 0x3e, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61,
- 0x63, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x63, 0x6f, 0x6d,
- 0x2e, 0x66, 0x6f, 0x72, 0x64, 0x2e, 0x68, 0x6d, 0x69, 0x2e, 0x73, 0x64,
- 0x6c, 0x2e, 0x53, 0x44, 0x4c, 0x22, 0x3e, 0x3c, 0x6d, 0x65, 0x74, 0x68,
- 0x6f, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x41, 0x63, 0x74,
- 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x70, 0x70, 0x22, 0x3e, 0x3c, 0x61,
- 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x3d, 0x22, 0x69, 0x6e, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x61, 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d,
- 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64,
- 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75,
- 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x74,
- 0x43, 0x6f, 0x64, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69,
- 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74,
- 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x73, 0x53, 0x44,
- 0x4c, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x22, 0x20, 0x74, 0x79,
- 0x70, 0x65, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d,
- 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x28, 0x62, 0x28, 0x73, 0x73, 0x28, 0x62, 0x69, 0x29, 0x28,
- 0x62, 0x62, 0x29, 0x29, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d,
- 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x69, 0x73, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e,
- 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x4e, 0x65, 0x65, 0x64,
- 0x65, 0x64, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x62, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x73, 0x41, 0x70, 0x70, 0x50,
- 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65,
- 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d,
- 0x22, 0x62, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64,
- 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75,
- 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70,
- 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x50, 0x65, 0x72, 0x6d, 0x69,
- 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x28, 0x62, 0x61, 0x28, 0x73, 0x69, 0x28, 0x62, 0x62, 0x29,
- 0x29, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64,
- 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75,
- 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x73, 0x41,
- 0x70, 0x70, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x22, 0x20, 0x74,
- 0x79, 0x70, 0x65, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61,
- 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
- 0x22, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x20, 0x74,
- 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3e, 0x3c, 0x6d,
- 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x46, 0x72, 0x69, 0x65, 0x6e,
- 0x64, 0x6c, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x3e,
- 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69,
- 0x6f, 0x6e, 0x3d, 0x22, 0x69, 0x6e, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x64,
- 0x65, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x61, 0x73,
- 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72,
- 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x69, 0x6e, 0x22, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61,
- 0x67, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62,
- 0x69, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64,
- 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75,
- 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x74,
- 0x43, 0x6f, 0x64, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69,
- 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74,
- 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x6d, 0x65, 0x73, 0x73,
- 0x61, 0x67, 0x65, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x28, 0x62, 0x61, 0x28, 0x73, 0x28, 0x62, 0x73, 0x29, 0x28, 0x62, 0x73,
- 0x29, 0x28, 0x62, 0x73, 0x29, 0x28, 0x62, 0x73, 0x29, 0x28, 0x62, 0x73,
- 0x29, 0x29, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74,
- 0x68, 0x6f, 0x64, 0x3e, 0x3c, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73,
- 0x74, 0x4f, 0x66, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
- 0x6e, 0x73, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72,
- 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x69, 0x6e, 0x22, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70, 0x49, 0x44, 0x22,
- 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x74, 0x43, 0x6f, 0x64,
- 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20,
- 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63,
- 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64,
- 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x20, 0x74,
- 0x79, 0x70, 0x65, 0x3d, 0x22, 0x61, 0x28, 0x73, 0x69, 0x28, 0x62, 0x62,
- 0x29, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74, 0x68,
- 0x6f, 0x64, 0x3e, 0x3c, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53,
- 0x44, 0x4c, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72,
- 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x74, 0x43, 0x6f,
- 0x64, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74,
- 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3e, 0x3c, 0x6d,
- 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x55, 0x70, 0x64,
- 0x61, 0x74, 0x65, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69,
- 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74,
- 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x74, 0x43,
- 0x6f, 0x64, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69,
- 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72,
- 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x75,
- 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20,
- 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3e, 0x3c,
- 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
- 0x22, 0x47, 0x65, 0x74, 0x55, 0x52, 0x4c, 0x53, 0x22, 0x3e, 0x3c, 0x61,
- 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x3d, 0x22, 0x69, 0x6e, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70,
- 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67,
- 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22,
- 0x6f, 0x75, 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72,
- 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20,
- 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f,
- 0x75, 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x75, 0x72,
- 0x6c, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62,
- 0x61, 0x28, 0x73, 0x28, 0x62, 0x73, 0x29, 0x29, 0x29, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3e, 0x3c, 0x73,
- 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x4f, 0x6e, 0x41, 0x70, 0x70, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73,
- 0x69, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x22, 0x3e,
- 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61,
- 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x73, 0x41, 0x70, 0x70, 0x50, 0x65, 0x72,
- 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x76, 0x6f,
- 0x6b, 0x65, 0x64, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28,
- 0x62, 0x62, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70, 0x52, 0x65, 0x76,
- 0x6f, 0x6b, 0x65, 0x64, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69,
- 0x6f, 0x6e, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28,
- 0x62, 0x61, 0x28, 0x73, 0x69, 0x28, 0x62, 0x62, 0x29, 0x29, 0x29, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x61, 0x70, 0x70, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64,
- 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x62, 0x29,
- 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d,
- 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73,
- 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x74,
- 0x4e, 0x65, 0x65, 0x64, 0x65, 0x64, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x28, 0x62, 0x62, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61,
- 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70,
- 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64,
- 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x62, 0x29,
- 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d,
- 0x65, 0x3d, 0x22, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22,
- 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70,
- 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x61,
- 0x69, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e,
- 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x53, 0x44, 0x4c, 0x43, 0x6f,
- 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x4e, 0x65, 0x65, 0x64, 0x65, 0x64, 0x22,
- 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x28, 0x73, 0x73, 0x28, 0x62, 0x69, 0x29, 0x28, 0x62, 0x62,
- 0x29, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e,
- 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75,
- 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74,
- 0x75, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x3e,
- 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x3e,
- 0x3c, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x3e, 0x00}; \ No newline at end of file
diff --git a/src/components/dbus/codegen/make_hmi_requests.py b/src/components/dbus/codegen/make_hmi_requests.py
deleted file mode 100755
index 4716d40439..0000000000
--- a/src/components/dbus/codegen/make_hmi_requests.py
+++ /dev/null
@@ -1,343 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# @file make_qml_dbus_cpp.py
-# @brief Generator of QML to QDbus C++ part
-#
-# This file is a part of HMI D-Bus layer.
-#
-# Copyright (c) 2014, Ford Motor Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided with the
-# distribution.
-#
-# Neither the name of the Ford Motor Company nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-from argparse import ArgumentParser
-import os.path
-from sys import argv
-from xml.etree import ElementTree
-from copy import copy
-from ford_xml_parser import FordXmlParser, ParamDesc
-from code_formatter import CodeBlock
-
-prefix_class_item = 'Declarative'
-invoke_type_connection = 'Direct'
-
-def defaultValue(param):
- if param.type == "Integer":
- return "0"
- elif param.type == "Float":
- return "0.0"
- elif param.type == "Boolean":
- return "false"
- elif param.enum:
- return "0"
-
-class Impl(FordXmlParser):
- def make_requests_classes_header(self, out):
- for interface_el in self.el_tree.findall('interface'):
- request_responses = self.find_request_response_pairs_by_provider(interface_el, "sdl")
- for (request, response) in request_responses:
- request_full_name = interface_el.get('name') + '_' +request.get('name')
- out.write('class ' + request_full_name + ': public HMIRequest {\n')
- with CodeBlock(out) as output:
- output.write('Q_OBJECT\n')
- out.write(' public:\n')
- with CodeBlock(out) as output:
- output.write(request_full_name + '(QJSValue hmi_callback, QDBusInterface *interface, QList<QVariant> args, QString name):\n')
- output.write(' HMIRequest(hmi_callback, interface, args, name) {}\n')
- out.write(' private:\n')
- with CodeBlock(out) as output:
- output.write('QJSValueList fillArgsList();\n};\n\n')
-
-
- def make_header_file(self, out):
- out.write("namespace requests {\n")
- out.write("class HMIRequest: public QObject {\n")
- with CodeBlock(out) as output:
- output.write('Q_OBJECT\n')
- out.write('public:\n')
- with CodeBlock(out) as output:
- output.write('HMIRequest(QJSValue hmi_callback, QDBusInterface *interface, QList<QVariant> args, QString name );\n')
- out.write('protected:\n')
- with CodeBlock(out) as output:
- output.write('virtual QJSValueList fillArgsList() = 0;\n')
- output.write('QDBusPendingCallWatcher *watcher_;\n')
- output.write('QJSValue hmi_callback_;\n\n')
- output.write('template<typename T>\n')
- output.write('QJSValue CreateQJSValue(T value) {\n')
- output.write(' return QJSValue(value);\n')
- output.write('}\n\n')
- output.write('template<typename T>\n')
- output.write('QJSValue CreateQJSValue(QList<T> value) {\n')
- with CodeBlock(output) as output:
- output.write('QJSValue array = hmi_callback_.engine()->newArray();\n')
- output.write('int i = 0;\n')
- output.write('foreach (T item, value) {\n')
- output.write(' QJSValue value = CreateQJSValue(item);\n')
- output.write(' array.setProperty(i, value);\n')
- output.write(' ++i;\n')
- output.write('}\n')
- output.write('return array;\n')
- output.write('}\n')
- out.write('private:\n')
- with CodeBlock(out) as output:
- output.write('QDBusInterface *interface_;\n')
- output.write('QList<QVariant> args_;\n')
- out.write('public slots:\n')
- with CodeBlock(out) as output:
- output.write('void invokeCallback();\n')
- out.write('};\n\n')
- output.write('template<>\n')
- output.write('QJSValue HMIRequest::CreateQJSValue(QStringList value);\n')
- for (interface_name, struct_name) in self.structs:
- out.write('template<>\n')
- out.write('QJSValue HMIRequest::CreateQJSValue(Common_' + struct_name + ' value);\n\n')
- impl.make_requests_classes_header(out)
- out.write("} // namespace requests\n")
-
-
- def qt_param_type(self, param):
- if not param.mandatory:
- param_copy = copy(param)
- param_copy.mandatory = True
- return "OptionalArgument< " + self.qt_param_type(param_copy) + " >"
- if param.array:
- param_copy = copy(param)
- param_copy.array = False
- if param.type == 'String':
- return "QStringList"
- return "QList< " + self.qt_param_type(param_copy) + " >"
- if param.type == 'Integer' or param.enum:
- return 'int'
- elif param.type == 'String':
- return 'QString'
- elif param.type == 'Boolean':
- return 'bool'
- elif param.type == 'Float':
- return 'double'
- elif param.struct:
- return "_".join(param.fulltype)
- return "xxx"
-
-
- def make_requests_methods_source(self, out):
- for interface_el in self.el_tree.findall('interface'):
- request_responses = self.find_request_response_pairs_by_provider(interface_el, "sdl")
- for (request, response) in request_responses:
- iface_name = interface_el.get('name')
- request_full_name = iface_name + '_' +request.get('name')
- out.write('QJSValueList ' + request_full_name + '::fillArgsList() {\n')
- out.write(' QDBusPendingReply< ')
- count = 0
- for param_el in response.findall('param'):
- param = self.make_param_desc(param_el, iface_name)
- out.write(self.qt_param_type(param))
- count += 1
- if count < len(response.findall('param')):
- out.write(',')
- out.write(' > reply = *watcher_;\n')
-
- with CodeBlock(out) as out:
- out.write('QJSValueList qjsValueList;\n\n')
- out.write('QJSValue param;\n\n')
- count = 0
- for param_el in response.findall('param'):
- if param_el.get('mandatory') == 'false':
- out.write('if (reply.argumentAt<' + str(count) + '>().presence) {\n')
- out.write(' param = CreateQJSValue(reply.argumentAt<' + str(count) + '>().val);\n')
- out.write('} else {\n')
- out.write(' param = QJSValue();\n')
- out.write('}\n')
- out.write('qjsValueList.append(param);\n')
- else:
- out.write('param = CreateQJSValue(reply.argumentAt<' + str(count) + '>());\n')
- out.write('qjsValueList.append(param);\n')
- count += 1
- out.write('return qjsValueList;\n')
- out.write('}\n\n')
-
-
- def make_source_file(self, out):
- out.write("namespace requests {\n")
- for interface_el in self.el_tree.findall('interface'):
- for struct_el in interface_el.findall('struct'):
- out.write('template<>\n')
- out.write('QJSValue HMIRequest::CreateQJSValue(Common_' + struct_el.get('name') + ' value){\n')
- with CodeBlock(out) as output:
- output.write('QJSValue object = hmi_callback_.engine()->newObject();\n')
- for param_el in struct_el.findall('param'):
- param_name = param_el.get('name')
- if param_el.get('mandatory') == 'true':
- with CodeBlock(out) as output:
- output.write('object.setProperty("' + param_name + '", CreateQJSValue(value.' + param_name + '));\n')
- elif param_el.get('mandatory') == 'false':
- with CodeBlock(out) as output:
- output.write('object.setProperty("' + param_name + '", value.' + param_name + '.presence ? CreateQJSValue(value.' + param_name + '.val) : QJSValue());\n')
- out.write('return object;\n')
- out.write('}\n\n')
-
-
- out.write('HMIRequest::HMIRequest(QJSValue hmi_callback, QDBusInterface *interface, QList<QVariant> args, QString name) :\n')
- out.write(' hmi_callback_(hmi_callback), interface_(interface), args_(args) {\n')
- with CodeBlock(out) as output:
- output.write('QDBusPendingCall pcall = interface->asyncCallWithArgumentList(name, args);\n')
- output.write('watcher_ = new QDBusPendingCallWatcher(pcall);\n')
- output.write('QObject::connect(watcher_, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(invokeCallback()));\n}\n\n')
- out.write('void HMIRequest::invokeCallback() {\n')
- with CodeBlock(out) as output:
- output.write('if (!hmi_callback_.isUndefined()) {\n')
- with CodeBlock(output) as output:
- output.write('QJSValueList qjsValueList;\n')
- output.write('qjsValueList = this->fillArgsList();\n')
- output.write('hmi_callback_.call(qjsValueList);\n')
- output.write('}\n')
- output.write('watcher_->deleteLater();\n')
- output.write('this->deleteLater();\n}\n\n')
- impl.make_requests_methods_source(out)
- out.write("} // namespace requests\n")
-
-
-arg_parser = ArgumentParser(description="Generator of Qt to QDbus C++ part")
-arg_parser.add_argument('--infile', required=True, help="full name of input file, e.g. applink/src/components/interfaces/QT_HMI_API.xml")
-arg_parser.add_argument('--version', required=False, help="Qt version 4.8.5 (default) or 5.1.0")
-arg_parser.add_argument('--outdir', required=True, help="path to directory where output files request_to_sdl.h, request_to_sdl.cc will be saved")
-args = arg_parser.parse_args()
-
-if args.version == "4.8.5":
- prefix_class_item = 'Declarative'
- invoke_type_connection = 'Direct'
-elif args.version == "5.1.0":
- prefix_class_item = 'Quick'
- invoke_type_connection = 'BlockingQueued'
-
-header_name = 'hmi_requests.h'
-source_name = 'hmi_requests.cc'
-
-in_tree = ElementTree.parse(args.infile)
-in_tree_root = in_tree.getroot()
-
-impl = Impl(in_tree_root, 'com.ford.sdl.hmi')
-
-header_out = open(args.outdir + '/' + header_name, "w")
-source_out = open(args.outdir + '/' + source_name, "w")
-
-header_out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-header_out.write("""/**
- * @file hmi_requests.h
- * @brief Generated class that process requests from qtHMI
- *
- * This file is a part of HMI D-Bus layer.
- */
-// Copyright (c) 2014, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-""")
-header_out.write("#ifndef SRC_COMPONENTS_QTHMI_QMLMODELQT5_HMIREQUESTS_\n");
-header_out.write("#define SRC_COMPONENTS_QTHMI_QMLMODELQT5_HMIREQUESTS_\n\n");
-header_out.write("#include <QObject>\n");
-header_out.write("#include <QJSValue>\n");
-header_out.write("#include <QDBusPendingCall>\n");
-header_out.write("#include <QDBusPendingCallWatcher>\n");
-header_out.write('#include <QDBusPendingReply>\n');
-header_out.write("#include <QDBusAbstractInterface>\n");
-header_out.write("#include <QDBusInterface>\n");
-header_out.write("#include <QJSEngine>\n");
-
-header_out.write('#include "qml_dbus.h"\n\n');
-
-impl.make_header_file(header_out)
-
-header_out.write("#endif // SRC_COMPONENTS_QTHMI_QMLMODELQT5_HMIREQUESTS_\n");
-
-source_out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-source_out.write("""/**
- * @file hmi_requests.cc
- * @brief Generated class that process requests from qtHMI
- *
- * This file is a part of HMI D-Bus layer.
- */
-// Copyright (c) 2014, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-""")
-source_out.write('#include "hmi_requests.h"\n\n')
-impl.make_source_file(source_out)
diff --git a/src/components/dbus/codegen/make_introspection_c.py b/src/components/dbus/codegen/make_introspection_c.py
deleted file mode 100755
index 22a53f308d..0000000000
--- a/src/components/dbus/codegen/make_introspection_c.py
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# @file make_introspection_c.py
-# @brief Converts introspection.xml to C-string
-#
-# This file is a part of HMI D-Bus layer.
-#
-# Copyright (c) 2013, Ford Motor Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided with the
-# distribution.
-#
-# Neither the name of the Ford Motor Company nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-from argparse import ArgumentParser
-from ford_xml_parser import FordXmlParser
-from ford_xml_parser import node_name
-from xml.etree import ElementTree
-from os import path
-from sys import argv
-
-class Impl(FordXmlParser):
- def convert_to_introspection(self, out_el_tree):
- for interface_el in self.el_tree.findall('interface'):
- el = self.create_introspection_iface_el(interface_el, 'sdl')
- if el is not None:
- out_el_tree.append(el)
-
-arg_parser = ArgumentParser(description='Converts introspection.xml to C-string')
-arg_parser.add_argument('--infile', required=True, help="Full name of input file, e.g. applink/src/components/interfaces/QT_HMI_API.xml")
-arg_parser.add_argument('--outdir', required=True, help="Path to directory where output file introspection_xml.cc will be saved")
-args = arg_parser.parse_args()
-
-if not path.isdir(args.outdir):
- makedirs(args.outdir)
-
-out_file = open(args.outdir + '/' + 'introspection_xml.cc', "w")
-
-in_tree = ElementTree.parse(args.infile)
-in_tree_root = in_tree.getroot()
-out_tree_root = ElementTree.Element('node', attrib={'name':node_name})
-
-impl = Impl(in_tree_root, 'com.ford.hmi.sdl')
-impl.convert_to_introspection(out_tree_root)
-
-introspection_string = '<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">'
-introspection_string += "\n"
-introspection_string += ElementTree.tostring(out_tree_root)
-
-out_file.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-out_file.write("""/**
- * @file instrospections_xml.cc
- * @brief D-Bus introspection XML as C-string
- *
- * This file is a part of HMI D-Bus layer.
- */
-// Copyright (c) 2013, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-""")
-
-out_file.write("char introspection_xml[] = {")
-
-cnt = 0
-for char in introspection_string:
- if cnt % 12 == 0:
- out_file.write("\n ")
- else:
- out_file.write(" ")
- out_file.write("0x%02x," % ord(char))
- cnt = cnt + 1
-
-out_file.write(" 0x00\n")
-out_file.write("};")
-
diff --git a/src/components/dbus/codegen/make_message_descriptions.py b/src/components/dbus/codegen/make_message_descriptions.py
deleted file mode 100755
index 0079666392..0000000000
--- a/src/components/dbus/codegen/make_message_descriptions.py
+++ /dev/null
@@ -1,273 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# @file make_message_descriptions.py
-# @brief Generates HMI API message descriptions for D-Bus
-#
-# This file is a part of HMI D-Bus layer.
-#
-# Copyright (c) 2013, Ford Motor Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided with the
-# distribution.
-#
-# Neither the name of the Ford Motor Company nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-from argparse import ArgumentParser
-from xml.etree import ElementTree
-from copy import copy
-from ford_xml_parser import FordXmlParser
-from os import path
-from sys import argv
-
-namespace_name = 'ford_message_descriptions'
-namespace = namespace_name + '::'
-
-
-class Impl(FordXmlParser):
- def write_param_definition(self, param_var_name, param, out):
- if param.array:
- tmp_param = copy(param)
- tmp_param.array = False
- tmp_param.mandatory = True
- dbus_sig = self.convert_to_dbus_type(tmp_param)
- self.write_param_definition(param_var_name + '_array', tmp_param, out)
-
- if param.array: out.write('const ' + namespace + 'ArrayDescription ')
- elif param.struct: out.write('const ' + namespace + 'StructDescription ')
- else: out.write('const ' + namespace + 'ParameterDescription ')
-
- out.write(param_var_name + " = {\n")
-
- if param.struct or param.array:
- out.write(" {\n")
- shift = ' ' * 4
- else:
- shift = ' ' * 2
-
- out.write(shift + "\"" + param.name + "\",\n")
-
- if param.array:
- out.write(shift + namespace + "Array,\n")
- elif param.struct:
- out.write(shift + namespace + "Struct,\n")
- elif param.enum:
- out.write(shift + namespace + "Enum,\n")
- else:
- out.write(shift + namespace + param.type + ",\n")
-
- if param.mandatory:
- out.write(shift + "true\n")
- else:
- out.write(shift + "false\n")
-
- if param.struct or param.array:
- out.write(" },\n")
- if param.array:
- out.write(" (const " + namespace + "ParameterDescription*)&" + param_var_name + "_array,\n")
- out.write(" \"" + dbus_sig + "\"\n")
- elif param.struct:
- out.write(" Structs::" + param.fulltype[0] + "__" + param.fulltype[1] + "__parameters\n")
- out.write("};\n")
-
-
- def write_struct_params_declarations(self, out):
- out.write("struct Structs {\n");
- for (interface, name), params in self.structs.iteritems():
- params_var_name = interface + '__' + name + '__parameters'
- out.write(" static const " + namespace + "ParameterDescription* " + params_var_name + "[];\n")
- out.write("};\n\n")
-
-
- def write_enum_entries_declarations(self, out):
- out.write("struct Enums {\n");
- for interface, name in self.enums:
- entries_var_name = interface + '__' + name + '__entries'
- out.write(" static const " + namespace + "EnumDescription::Entry* " + entries_var_name + "[];\n")
- out.write("};\n\n")
-
-
- def write_parameters(self, params, out, name):
- n = 1
- for param in params:
- param_var_name = name + str(n)
- n = n + 1
- self.write_param_definition(param_var_name, param, out)
-
-
- def write_struct_params_definitions(self, out):
- for (interface, name), params in self.structs.iteritems():
- param_var_name = interface + '__' + name + '__parameter'
- self.write_parameters(params, out, param_var_name)
- params_var_name = 'Structs::' + interface + '__' + name + '__parameters'
- out.write("const " + namespace + "ParameterDescription* " + params_var_name + "[] = {\n")
- for n in range(1, len(params) + 1):
- name = param_var_name + str(n)
- out.write(" (const " + namespace + "ParameterDescription*)&" + name + ",\n")
- out.write( " NULL };\n\n")
-
-
- def write_enum_entries_definitions(self, out):
- for (interface, name), enum_el in self.enums.iteritems():
- n = 1
- for element_el in enum_el.findall('element'):
- entry_var_name = interface + '__' + name + '__entry' + str(n)
- value = element_el.get("value")
- if value is None:
- value = str(n)
- out.write(namespace + "EnumDescription::Entry " + entry_var_name + " = {\"" + element_el.get("name") + "\", " + value + "};\n")
- n = n + 1
-
- entries_var_name = "Enums::" + interface + '__' + name + '__entries'
- out.write("const " + namespace + "EnumDescription::Entry* " + entries_var_name + "[] = {\n")
- for n in range(1, len(enum_el.findall('element')) + 1):
- entry_var_name = interface + '__' + name + '__entry' + str(n)
- out.write(" &" + entry_var_name + ",\n")
- out.write(" NULL };\n\n")
-
-
- def write_message_definition(self, message_el, interface, out):
- name = message_el.get('name')
- messagetype = message_el.get('messagetype')
- params = list()
- for param_el in message_el.findall('param'):
- param_desc = self.make_param_desc(param_el, interface)
- params.append(param_desc)
- param_var_name = interface + '__' + name + '__' + messagetype + '__parameter'
- self.write_parameters(params, out, param_var_name)
-
- params_var_name = param_var_name + 's'
- out.write("const " + namespace + "ParameterDescription* " + params_var_name + "[] = {\n")
- for n in range(1, len(params) + 1):
- param_name = param_var_name + str(n)
- out.write(" (const " + namespace + "ParameterDescription*)&" + param_name + ",\n")
- out.write(" NULL };\n")
-
- message_desc_name = interface + '__' + name + '__' + messagetype
- out.write("const " + namespace + "MessageDescription " + message_desc_name + " = {\n")
- out.write(" \"" + interface + "\",\n")
- out.write(" \"" + name + "\",\n")
- out.write(" hmi_apis::messageType::" + messagetype + ",\n")
- out.write(" hmi_apis::FunctionID::" + interface + "_" + name + ",\n")
- out.write(" " + params_var_name + "\n")
- out.write("};\n\n")
-
-
- def write_message_definitions(self, out):
- for interface_el in self.el_tree.findall('interface'):
- interface = interface_el.get('name')
- message_els = interface_el.findall('function')
- for message_el in message_els:
- self.write_message_definition(message_el, interface, out)
-
-
- def make_message_descriptions(self, out):
- self.write_struct_params_declarations(out)
- #self.write_enum_entries_declarations(out)
- self.write_struct_params_definitions(out)
- #self.write_enum_entries_definitions(out)
- self.write_message_definitions(out)
-
-
- def make_message_array(self, out):
- out.write("const MessageDescription* message_descriptions[] = {\n")
- for interface_el in self.el_tree.findall('interface'):
- interface = interface_el.get('name')
- message_els = interface_el.findall('function')
- for message_el in message_els:
- name = message_el.get('name')
- messagetype = message_el.get('messagetype')
- message_desc_name = interface + '__' + name + '__' + messagetype
- out.write(" &" + message_desc_name + ",\n")
- out.write(" NULL\n")
- out.write("};\n")
-
-
-arg_parser = ArgumentParser(description="Generates HMI API message descriptions for D-Bus on SDL core side")
-arg_parser.add_argument('--infile', required=True, help="full name of input file, e.g. applink/src/components/interfaces/QT_HMI_API.xml")
-arg_parser.add_argument('--outdir', required=True, help="path to directory where output file message_descriptions.cc will be saved")
-args = arg_parser.parse_args()
-
-if not path.isdir(args.outdir):
- makedirs(args.outdir)
-
-outfile = 'message_descriptions.cc'
-
-in_tree = ElementTree.parse(args.infile)
-in_tree_root = in_tree.getroot()
-
-impl = Impl(in_tree_root)
-
-out = open(args.outdir + "/" + outfile, "w")
-
-out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-out.write("""/**
- * @file message_descriptions.cc
- * @brief Generated HMI API message descriptions for D-Bus
- *
- * This file is a part of HMI D-Bus layer.
- */
-// Copyright (c) 2013, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-""")
-
-out.write("#include \"dbus/message_descriptions.h\"\n\n");
-out.write("namespace {\n\n");
-impl.make_message_descriptions(out)
-out.write("}\n\n");
-
-out.write("namespace " + namespace_name + " {\n\n");
-impl.make_message_array(out)
-out.write("}\n\n");
-
diff --git a/src/components/dbus/codegen/make_notifications_qml.py b/src/components/dbus/codegen/make_notifications_qml.py
deleted file mode 100755
index 3c173e8b4f..0000000000
--- a/src/components/dbus/codegen/make_notifications_qml.py
+++ /dev/null
@@ -1,387 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# @file make_qml_dbus_cpp.py
-# @brief Generator of QML to QDbus C++ part
-#
-# This file is a part of HMI D-Bus layer.
-#
-# Copyright (c) 2014, Ford Motor Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided with the
-# distribution.
-#
-# Neither the name of the Ford Motor Company nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-from argparse import ArgumentParser
-import os.path
-from sys import argv
-from xml.etree import ElementTree
-from copy import copy
-from ford_xml_parser import FordXmlParser, ParamDesc
-from code_formatter import CodeBlock
-
-class Notifications_qml(FordXmlParser):
- #Used for qt signal names, because qt signals cannot begin with a capital letter
- def first_letter_to_lower_case(self, s):
- if len(s) == 0:
- return s
- else:
- return s[0].lower() + s[1:]
-
- def make_header(self, out):
- out.write("class SdlProxy: public Item {\n")
- with CodeBlock(out) as out:
- out.write("Q_OBJECT\n")
- out.write("Q_DISABLE_COPY(SdlProxy)\n")
- out.write("public:\n")
- out.write("explicit SdlProxy(Item* parent = 0);\n")
- out.write("private:\n")
- out.write("QDBusInterface *sdlBasicCommunicationInterface;\n")
- out.write("signals:\n")
- for interface_el in self.el_tree.findall('interface'):
- iface_name = interface_el.get('name')
- notifications = self.find_notifications_by_provider(interface_el, "sdl")
- for notification_el in notifications:
- with CodeBlock(out) as out:
- out.write("void %s(" % self.first_letter_to_lower_case( notification_el.get("name")) )
- param_el_count = 1
- list_of_params = notification_el.findall("param")
- list_of_params_len = len(list_of_params)
- for param_el in list_of_params:
- param = self.make_param_desc(param_el, iface_name)
- out.write("QVariant %s" % param_el.get("name"))
- if param_el_count < list_of_params_len:
- out.write(", ")
- param_el_count += 1
- out.write(");\n")
- with CodeBlock(out) as out:
- out.write("private slots:\n")
- for interface_el in self.el_tree.findall('interface'):
- iface_name = interface_el.get('name')
- notifications = self.find_notifications_by_provider(interface_el, "sdl")
- for notification_el in notifications:
- with CodeBlock(out) as out:
- out.write("void slot_%s(" % notification_el.get("name"))
- param_el_count = 1
- list_of_params = notification_el.findall("param")
- list_of_params_len = len(list_of_params)
- for param_el in list_of_params:
- param = self.make_param_desc(param_el, iface_name)
- out.write("%s %s" % (self.qt_param_type(param), param_el.get("name")))
- if param_el_count < list_of_params_len:
- out.write(", ")
- param_el_count += 1
- out.write(");\n")
- out.write("};\n")
-
-
- def qt_param_type(self, param):
- if not param.mandatory:
- param_copy = copy(param)
- param_copy.mandatory = True
- return "OptionalArgument< " + self.qt_param_type(param_copy) + " >"
- if param.array:
- param_copy = copy(param)
- param_copy.array = False
- if param.type == 'String':
- return "QStringList"
- return "QList< " + self.qt_param_type(param_copy) + " >"
- if param.type == 'Integer' or param.enum:
- return 'int'
- elif param.type == 'String':
- return 'QString'
- elif param.type == 'Boolean':
- return 'bool'
- elif param.type == 'Float':
- return 'double'
- elif param.struct:
- return "_".join(param.fulltype)
- else:
- raise RuntimeError('Unknown type: ' + param.type)
-
-
- def qml_param_type(self, param):
- if not param.mandatory:
- return "QVariant"
- if param.array:
- return "QVariant"
- if param.type == 'Integer' or param.enum:
- return 'int'
- elif param.type == 'String':
- return 'QString'
- elif param.type == 'Boolean':
- return 'bool'
- elif param.type == 'Float':
- return 'double'
- elif param.struct:
- return "QVariant"
- else:
- raise RuntimeError('Unknown type: ' + param.type)
-
-
- def make_source(self, out):
- def qml_args(variable_name_needed):
- param_el_count = 1
- list_of_params = notification_el.findall("param")
- list_of_params_len = len(list_of_params)
- for param_el in list_of_params:
- param = self.make_param_desc(param_el, iface_name)
- if variable_name_needed:
- out.write("%s %s" % (self.qt_param_type(param), param_el.get("name")))
- else:
- out.write("%s" % self.qt_param_type(param))
- if param_el_count < list_of_params_len:
- out.write(", ")
- param_el_count += 1
- out.write("SdlProxy::SdlProxy(Item *parent): Item(parent) {\n")
- for interface_el in self.el_tree.findall('interface'):
- iface_name = interface_el.get('name')
- notifications = self.find_notifications_by_provider(interface_el, "sdl")
- for notification_el in notifications:
- notification_name = notification_el.get('name')
- with CodeBlock(out) as out:
- out.write("QDBusConnection::sessionBus().connect(\n")
- with CodeBlock(out) as out:
- out.write("\"com.ford.sdl.core\", \"/\", \"com.ford.sdl.core.%s\",\n" % iface_name)
- out.write("\"%s\", this, SLOT(slot_%s(" % (notification_name, notification_el.get("name")))
- qml_args(variable_name_needed = False)
- out.write(")));\n")
- out.write("}\n\n")
- for interface_el in self.el_tree.findall('interface'):
- iface_name = interface_el.get('name')
- notifications = self.find_notifications_by_provider(interface_el, "sdl")
- for notification_el in notifications:
- notific_full_name = interface_el.get("name") + "_" + notification_el.get("name")
- out.write("void SdlProxy::slot_%s(" % notification_el.get("name"))
- qml_args(variable_name_needed = True)
- out.write(") {\n")
- with CodeBlock(out) as out:
- out.write("LOG4CXX_TRACE(logger_, \"ENTER\");\n\n")
- for param_el in notification_el.findall("param"):
- param = self.make_param_desc(param_el, iface_name)
- tmp_param_name = param.name + "_qvariant"
- out.write("QVariant %s;\n" % tmp_param_name)
- out.write("%s = ValueToVariant(%s);\n" % (tmp_param_name, param.name))
- self.write_param_validation(param, param.name, "\nLOG4CXX_ERROR(logger_, \"%s in %s out of bounds\")" % (param.name, notific_full_name), out)
- out.write("\n")
- out.write("emit %s(" % self.first_letter_to_lower_case( notification_el.get("name")) )
- param_el_count = 1
- list_of_params = notification_el.findall("param")
- list_of_params_len = len(list_of_params)
- for param_el in list_of_params:
- param = self.make_param_desc(param_el, iface_name)
- out.write("%s" % param.name + "_qvariant")
- if param_el_count < list_of_params_len:
- out.write(", ")
- param_el_count += 1
- out.write(");\n")
- with CodeBlock(out) as out:
- out.write("LOG4CXX_TRACE(logger_, \"EXIT\");\n")
- out.write("}\n\n")
-
-
-
- def write_param_validation(self, param, param_name, fail_statement, out, level=0):
- if not param.mandatory and (param.restricted or param.restrictedArray or (param.struct and any(map(lambda x: x.restricted, self.structs[param.fulltype])))):
- out.write("if (%s.presence) {\n" % param_name)
- param_copy = copy(param)
- param_copy.mandatory = True
- with CodeBlock(out) as out:
- self.write_param_validation(param_copy, param_name + ".val", fail_statement, out, level+1)
- out.write("}\n")
- elif param.array:
- if param.minSize > 0:
- out.write("if ({0}.count() < {1}) {{".format(param_name, param.minSize))
- with CodeBlock(out) as out:
- out.write("{0};\n".format(fail_statement))
- out.write("}\n")
- if param.maxSize != None:
- out.write("if ({0}.count() > {1}) {{".format(param_name, param.maxSize))
- with CodeBlock(out) as out:
- out.write("{0};\n".format(fail_statement))
- out.write("}\n")
- if param.restricted:
- out.write('for ({0}::const_iterator it_{2} = {1}.begin(); it_{2} != {1}.end(); ++it_{2}) {{\n'.format(self.qt_param_type(param), param_name, level))
- with CodeBlock(out) as out:
- param_copy = copy(param)
- param_copy.array = False
- self.write_param_validation(param_copy, "(*it_{0})".format(level), fail_statement, out, level+1)
- out.write("}\n")
- elif param.struct:
- for p in self.structs[param.fulltype]:
- self.write_param_validation(p, "{0}.{1}".format(param_name, p.name), fail_statement, out, level+1)
- elif param.type == "Integer" or param.type == "Float":
- conditions = []
- if (param.minValue != None):
- conditions.append("(%s < %s)" % (param_name, param.minValue))
- if (param.maxValue != None):
- conditions.append("(%s > %s)" % (param_name, param.maxValue))
- if conditions:
- out.write('if (%s) {' % ' || '.join(conditions))
- with CodeBlock(out) as out:
- out.write('%s;\n' % fail_statement)
- out.write("}\n")
- elif param.type == "String":
- conditions = []
- if (param.minLength > 0):
- conditions.append("(%s.size() < %s)" % (param_name, param.minLength))
- if (param.maxLength > 0):
- conditions.append("(%s.size() > %s)" % (param_name, param.maxLength))
- if conditions:
- out.write('if (%s) {' % ' || '.join(conditions))
- with CodeBlock(out) as out:
- out.write('%s;\n' % (fail_statement))
- out.write("}\n")
-
-
-#QVarian name;
-#if (ttsName.presence) {
-
-
-
-arg_parser = ArgumentParser(description="Generator of classes which Qt to QDbus C++ part")
-arg_parser.add_argument('--infile', required=True, help="full name of input file, e.g. applink/src/components/interfaces/QT_HMI_API.xml")
-arg_parser.add_argument('--version', required=False, help="Qt version 4.8.5 (default) or 5.1.0")
-arg_parser.add_argument('--outdir', required=True, help="path to directory where output files request_to_sdl.h, request_to_sdl.cc will be saved")
-args = arg_parser.parse_args()
-
-
-if args.version == "4.8.5":
- prefix_class_item = 'Script'
- invoke_type_connection = 'Direct'
-elif args.version == "5.1.0":
- prefix_class_item = 'JS'
- invoke_type_connection = 'BlockingQueued'
-else:
- prefix_class_item = 'JS'
- invoke_type_connection = 'BlockingQueued'
-
-header_name = 'sdl_proxy.h'
-source_name = 'sdl_proxy.cc'
-
-in_tree = ElementTree.parse(args.infile)
-in_tree_root = in_tree.getroot()
-
-impl = Notifications_qml(in_tree_root, 'com.ford.sdl.hmi')
-
-header_out = open(args.outdir + '/' + header_name, "w")
-source_out = open(args.outdir + '/' + source_name, "w")
-
-header_out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-header_out.write("""
-/*
- Copyright (c) 2014, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-""")
-header_out.write("#ifndef SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_SDL_PROXY_H_\n")
-header_out.write("#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_SDL_PROXY_H_\n\n")
-header_out.write("#include \"qml_dbus.h\"\n")
-header_out.write("#include \"qt_version.h\"\n\n")
-header_out.write("#include <QtCore/QVariant>\n")
-header_out.write("#include <QtDBus/QDBusInterface>\n")
-header_out.write("#if QT_4\n")
-header_out.write("#include <QtDeclarative/QDeclarativeItem>\n")
-header_out.write("typedef QDeclarativeItem Item;\n")
-header_out.write("#elif QT_5\n")
-header_out.write("#include <QtQuick/QQuickItem>\n")
-header_out.write("typedef QQuickItem Item;\n")
-header_out.write("#endif // QT_VERSION\n")
-
-impl.make_header(header_out)
-
-header_out.write("#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_REQUEST_TO_SDL_H_")
-
-
-source_out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-source_out.write("""
-/*
- Copyright (c) 2014, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-""")
-
-source_out.write("#include \"sdl_proxy.h\"\n")
-source_out.write("#include \"utils/logger.h\"\n")
-source_out.write("CREATE_LOGGERPTR_GLOBAL(logger_, \"DBusPlugin\")\n\n")
-
-impl.make_source(source_out)
diff --git a/src/components/dbus/codegen/make_qml_dbus_cpp.py b/src/components/dbus/codegen/make_qml_dbus_cpp.py
deleted file mode 100755
index f40bc74df8..0000000000
--- a/src/components/dbus/codegen/make_qml_dbus_cpp.py
+++ /dev/null
@@ -1,736 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# @file make_qml_dbus_cpp.py
-# @brief Generator of QML to QDbus C++ part
-#
-# This file is a part of HMI D-Bus layer.
-#
-# Copyright (c) 2013, Ford Motor Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided with the
-# distribution.
-#
-# Neither the name of the Ford Motor Company nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-from argparse import ArgumentParser
-import os.path
-from sys import argv
-from xml.etree import ElementTree
-from copy import copy
-from ford_xml_parser import FordXmlParser, ParamDesc
-from code_formatter import CodeBlock
-
-prefix_class_item = 'Declarative'
-invoke_type_connection = 'Direct'
-
-def defaultValue(param):
- if param.type == "Integer":
- return "0"
- elif param.type == "Float":
- return "0.0"
- elif param.type == "Boolean":
- return "false"
- elif param.enum:
- return "0"
-
-class Impl(FordXmlParser):
- def make_dbus_type_declarations(self, out):
- for struct in self.structs.items():
- self.write_struct_declaration(struct, out)
-
- def make_dbus_metatype_declarations(self, out):
- for struct in self.structs.items():
- self.write_struct_metatype_declaration(struct, out)
-
-
- def write_struct_declaration(self, ((iface, name), params), out):
- struct_name = "{0}_{1}".format(iface, name)
- out.write("struct {0} {{\n".format(struct_name))
- with CodeBlock(out) as out:
- for param in params:
- out.write("{0} {1};\n".format(self.qt_param_type(param), param.name))
- out.write("{0}()\n".format(struct_name))
- initializersList = map(lambda x: "{0}({1})".format(x.name, defaultValue(x)), [p for p in params if p.type != "String" and not p.struct and not p.array])
- if initializersList:
- out.write(": " + ",\n ".join(initializersList))
-
- out.write("{ }\n")
-
- out.write("};\n")
- out.write('QDBusArgument& operator << (QDBusArgument&, const ' + struct_name + "&);\n")
- out.write('const QDBusArgument& operator >> (const QDBusArgument&, ' + struct_name + "&);\n")
- out.write('void PutArgToMap(QVariantMap& map, const char* name, const ' + struct_name + "& v);\n")
- out.write('QVariant ValueToVariant(const ' + struct_name + "& v);\n")
- out.write('QVariant ValueToVariant(const QList<' + struct_name + " >& v);\n")
- out.write('bool GetArgFromMap(const QVariantMap& map, const char* name, ' + struct_name + "& v);\n")
- out.write('bool VariantToValue(const QVariant& variant, ' + struct_name + "& v);\n")
- out.write('bool VariantToValue(const QVariant& variant, QList<' + struct_name + " >& v);\n")
-
-
- def write_struct_metatype_declaration(self, ((iface, name), params), out):
- struct_name = iface + '_' + name
- out.write('Q_DECLARE_METATYPE(' + struct_name + ")\n")
- out.write('Q_DECLARE_METATYPE(OptionalArgument<' + struct_name + ">)\n")
- out.write('Q_DECLARE_METATYPE(QList<' + struct_name + ">)\n")
- out.write('Q_DECLARE_METATYPE(OptionalArgument<QList<' + struct_name + "> >)\n\n")
-
-
- def make_dbus_type_definitions(self, out):
- for struct in self.structs.items():
- self.write_struct_definition(struct, out)
-
- def write_struct_definition(self, ((iface, name), params), out):
- struct_name = iface + '_' + name
-
- out.write('QDBusArgument& operator << (QDBusArgument& arg, const ' + struct_name + "& v) {\n")
- with CodeBlock(out) as out:
- out.write("arg.beginStructure();\n")
- for param in params:
- out.write("arg << v.{0};\n".format(param.name))
- out.write("arg.endStructure();\n")
- out.write("return arg;\n")
- out.write("}\n\n")
-
- out.write('const QDBusArgument& operator >> (const QDBusArgument& arg, ' + struct_name + "& v) {\n")
- with CodeBlock(out) as out:
- out.write("arg.beginStructure();\n")
- for param in params:
- out.write("arg >> v.{0};\n".format(param.name))
- out.write("arg.endStructure();\n")
- out.write("return arg;\n")
- out.write("}\n\n")
-
- out.write('QVariant ValueToVariant(const ' + struct_name + "& v) {\n")
- with CodeBlock(out) as out:
- out.write("QVariantMap map;\n")
- for param in params:
- out.write("""PutArgToMap(map, "{0}", v.{0});\n""".format(param.name))
- out.write("return QVariant::fromValue(map);\n")
- out.write("}\n\n")
-
- out.write('QVariant ValueToVariant(const QList<' + struct_name + ">& v) {\n")
- with CodeBlock(out) as out:
- out.write("QList<QVariant> ret;\n")
- out.write("for (QList<{0}>::const_iterator i = v.begin(); i != v.end(); ++i)\n".format(struct_name))
- with CodeBlock(out) as out:
- out.write("ret.append(ValueToVariant(*i));\n")
- out.write("return QVariant::fromValue(ret);\n")
- out.write("}\n\n")
-
- out.write('void PutArgToMap(QVariantMap& map, const char* name, const ' + struct_name + "& v) {\n")
- with CodeBlock(out) as out:
- out.write("map.insert(name, ValueToVariant(v));\n")
- out.write("}\n\n")
-
- out.write('bool VariantToValue(const QVariant& variant, ' + struct_name + "& v) {\n")
- with CodeBlock(out) as out:
- out.write("if (variant.type() != QVariant::Map) {\n")
- with CodeBlock(out) as out:
- out.write("""LOG4CXX_ERROR(logger_, "Input argument isn't a map");\n""")
- out.write("return false;\n")
- out.write("}\n")
- out.write("QVariantMap map = variant.toMap();\n")
- for param in params:
- out.write("if (!GetArgFromMap(map, \"" + param.name + "\", v." + param.name + ")) return false;\n")
- out.write("return true;\n")
- out.write("}\n\n")
-
- out.write('bool VariantToValue(const QVariant& variant, QList<' + struct_name + ">& v) {\n")
- with CodeBlock(out) as out:
- out.write("if (variant.type() != QVariant::List) {\n")
- with CodeBlock(out) as out:
- out.write("""LOG4CXX_ERROR(logger_, "Input argument isn't a list");\n""")
- out.write("return false;\n")
- out.write("}\n")
- out.write("QList<QVariant> list = variant.toList();\n")
- out.write("for (QList<QVariant>::const_iterator i = list.begin(); i != list.end(); ++i) {\n");
- with CodeBlock(out) as out:
- out.write(struct_name + " s;\n");
- out.write("if (!VariantToValue(*i, s)) return false;\n");
- out.write("v.append(s);\n");
- out.write("}\n")
- out.write("return true;\n")
- out.write("}\n\n")
-
- out.write('bool GetArgFromMap(const QVariantMap& map, const char* name, ' + struct_name + "& v) {\n")
- with CodeBlock(out) as out:
- out.write("QVariantMap::const_iterator it = map.find(name);\n")
- out.write("if (map.end() == it) {\n")
- with CodeBlock(out) as out:
- out.write("""LOG4CXX_WARN(logger_, "Argument '" << name << "' not found");\n""")
- out.write("return false;\n")
- out.write("}\n")
- out.write("if (it->type() != QVariant::Map) {\n")
- with CodeBlock(out) as out:
- out.write("""LOG4CXX_ERROR(logger_, "Argument '" << name << "' isn't a map");\n""")
- out.write("return false;\n")
- out.write("}\n")
- out.write("const QVariantMap& inmap = it->toMap();\n")
- for param in params:
- out.write("if (!GetArgFromMap(inmap, \"" + param.name + "\", v." + param.name + ")) return false;\n")
- out.write("return true;\n")
- out.write("}\n\n")
-
- def write_param_validation(self, param, param_name, fail_statement, out, level=0):
- if not param.mandatory and (param.restricted or param.restrictedArray or (param.struct and any(map(lambda x: x.restricted, self.structs[param.fulltype])))):
- out.write("if (%s.presence) {\n" % param_name)
- param_copy = copy(param)
- param_copy.mandatory = True
- with CodeBlock(out) as out:
- self.write_param_validation(param_copy, param_name + ".val", fail_statement, out, level+1)
- out.write("}\n")
- elif param.array:
- if param.minSize > 0:
- out.write("if ({0}.count() < {1}) {{ {2}; }}\n".format(param_name, param.minSize, fail_statement))
- if param.maxSize != None:
- out.write("if ({0}.count() > {1}) {{ {2}; }}\n".format(param_name, param.maxSize, fail_statement))
- if param.restricted:
- out.write('for ({0}::const_iterator it_{2} = {1}.begin(); it_{2} != {1}.end(); ++it_{2}) {{\n'.format(self.qt_param_type(param), param_name, level))
- with CodeBlock(out) as out:
- param_copy = copy(param)
- param_copy.array = False
- self.write_param_validation(param_copy, "(*it_{0})".format(level), fail_statement, out, level+1)
- out.write("}\n")
- elif param.struct:
- for p in self.structs[param.fulltype]:
- self.write_param_validation(p, "{0}.{1}".format(param_name, p.name), fail_statement, out, level+1)
- elif param.type == "Integer" or param.type == "Float":
- conditions = []
- if (param.minValue != None):
- conditions.append("(%s < %s)" % (param_name, param.minValue))
- if (param.maxValue != None):
- conditions.append("(%s > %s)" % (param_name, param.maxValue))
- if conditions:
- out.write('if (%s) { %s; }\n' % (' || '.join(conditions), fail_statement))
- elif param.type == "String":
- conditions = []
- if (param.minLength > 0):
- conditions.append("(%s.size() < %s)" % (param_name, param.minLength))
- if (param.maxLength > 0):
- conditions.append("(%s.size() > %s)" % (param_name, param.maxLength))
- if conditions:
- with CodeBlock(out) as out:
- out.write('if (%s) { %s;\n }\n' % (' || '.join(conditions), fail_statement))
-
- def qt_param_type(self, param):
- if not param.mandatory:
- param_copy = copy(param)
- param_copy.mandatory = True
- return "OptionalArgument< " + self.qt_param_type(param_copy) + " >"
- if param.array:
- param_copy = copy(param)
- param_copy.array = False
- if param.type == 'String':
- return "QStringList"
- return "QList< " + self.qt_param_type(param_copy) + " >"
- if param.type == 'Integer' or param.enum:
- return 'int'
- elif param.type == 'String':
- return 'QString'
- elif param.type == 'Boolean':
- return 'bool'
- elif param.type == 'Float':
- return 'double'
- elif param.struct:
- return "_".join(param.fulltype)
- return "xxx"
-
-
- def from_variant_func_name(self, param, interface):
- prefix = ''
- if not param.mandatory:
- param_copy = copy(param)
- param_copy.mandatory = True
- return 'opt_' + self.from_variant_func_name(param_copy, interface)
- if param.array:
- param_copy = copy(param)
- param_copy.array = False
- return 'arr_' + self.from_variant_func_name(param_copy, interface)
-
- if param.type in ['Integer', 'String', 'Boolean', 'Float']:
- param_type = param.type
- else:
- param_type = param.type.split('.')
- if len(param_type) > 1:
- param_type = (param_type[0], param_type[1])
- else:
- param_type = (interface, param_type[0])
- if param_type in self.structs:
- param_type = param_type[0] + '_' + param_type[1]
- elif param_type in self.enums:
- param_type = 'Integer'
- return param_type + '_from_variant'
-
-
- def make_method_signature(self, request, response, interface, add_classname):
- in_params = [self.make_param_desc(x, interface) for x in request.findall('param')]
- out_params = [self.make_param_desc(x, interface) for x in response.findall('param')]
-
- signature_len = len(''.join(map(lambda x: self.convert_to_dbus_type(x), in_params + out_params)))
- if signature_len > 255:
- raise RuntimeError("Too long signature of {0} method. Maximum valid length is 255, actual is {1}", request.get('name'), signature_len)
-
- return "int {0}{1} ({2}{3}const QDBusMessage& message, QString& userMessage_out{4}{5})".format(
- interface + "Adaptor::" if add_classname else "",
- request.get('name'),
- ", ".join(map(lambda x: "const {0}& {1}_in".format(self.qt_param_type(x), x.name), in_params)),
- ", " if in_params else "",
- ", " if out_params else "",
- ", ".join(map(lambda x: "{0}& {1}_out".format(self.qt_param_type(x), x.name), out_params)))
-
-
- def make_signal_signature(self, signal, interface, add_void):
- params = signal.findall('param')
- if add_void:
- retstr = 'void '
- else:
- retstr = ''
- retstr = retstr + signal.get('name') + '('
- params_num = len(params)
- for i in range(0, params_num):
- param_desc = self.make_param_desc(params[i], interface)
- param_type = self.qt_param_type(param_desc)
- retstr = retstr + param_type + ' ' + param_desc.name
- if i <> params_num - 1: retstr = retstr + ", "
- retstr = retstr + ')'
- return retstr
-
-
- def make_qml_signal_signature(self, signal, interface, name, short=False, add_classname=False):
- params = signal.findall('param')
- if short:
- retstr = ''
- else:
- retstr = 'void '
- if add_classname:
- retstr = retstr + interface + 'Adaptor::'
- retstr = retstr + name + '('
- params_num = len(params)
- for i in range(0, params_num):
- param_desc = self.make_param_desc(params[i], interface)
- if param_desc.struct or param_desc.array or not param_desc.mandatory: typ = 'QVariant'
- elif param_desc.type == 'Integer' or param_desc.enum: typ = 'int'
- elif param_desc.type == 'Boolean': typ = 'bool'
- elif param_desc.type == 'Float': typ = 'double'
- elif param_desc.type == 'String': typ = 'QString'
- else: typ = 'QVariant'
- retstr = retstr + typ
- if not short: retstr = retstr + ' ' + param_desc.name
- if i <> params_num - 1: retstr = retstr + ", "
- retstr = retstr + ')'
- return retstr
-
-
- def write_adaptor_declaration(self, interface_el, notifications, request_responses, out):
- global prefix_class_item
- def glue_strings(strings):
- ret = list()
- curstr = ''
- for str in strings:
- curstr = curstr + str
- if(str[-1] == '>'):
- ret.append(curstr)
- curstr = ''
- return ret
- ifacename = interface_el.get('name')
- out.write("class " + ifacename + "Adaptor : public QDBusAbstractAdaptor {\n");
- out.write(" Q_OBJECT\n");
- out.write(" Q_CLASSINFO(\"D-Bus Interface\", \"" + self.interface_path + '.' + ifacename + "\")\n");
- out.write(" Q_CLASSINFO(\"D-Bus Introspection\",\n");
- introspection_el = self.create_introspection_iface_el(interface_el, 'hmi')
- introspection = glue_strings(ElementTree.tostringlist(introspection_el))
- for str in introspection:
- str = str.replace('"', '\\"')
- out.write('"' + str + '"' + "\n")
- out.write(" )\n")
- out.write(" public:\n")
- out.write(" explicit " + ifacename + "Adaptor(QObject *parent = 0);\n")
- out.write(" void SetApi(Q%sItem*);\n" % prefix_class_item)
- out.write(" DBusController *dbusController;\n")
- out.write(" public slots:\n")
- for (request, response) in request_responses:
- signature = self.make_method_signature(request, response, ifacename, False)
- out.write(" " + signature + ";\n")
- out.write(" signals:\n")
- for n in notifications:
- signature = self.make_signal_signature(n, ifacename, True)
- out.write(" " + signature + ";\n")
- out.write(" private slots:\n")
- for n in notifications:
- signature = self.make_qml_signal_signature(n, ifacename, n.get('name') + '_qml', False)
- out.write(" " + signature + ";\n")
- out.write(" private:\n")
- out.write(" Q%sItem* api_;\n" % prefix_class_item)
- out.write("};\n\n");
-
- def write_adaptor_definition(self, interface_el, notifications, request_responses, out):
- global prefix_class_item
- iface_name = interface_el.get('name')
- classname = iface_name + 'Adaptor'
- out.write("{0}::{0}(QObject* parent) : QDBusAbstractAdaptor(parent) {{}}\n".format(classname))
-
- out.write("void {0}::SetApi(Q{1}Item* api) {{\n".format(classname, prefix_class_item))
- with CodeBlock(out) as out:
- out.write("api_ = api;\n")
- for n in notifications:
- signame = n.get('name')
- signame = signame[:1].lower() + signame[1:]
- slotname = n.get('name') + '_qml'
- sig_signature = self.make_qml_signal_signature(n, iface_name, signame, True)
- slot_signature = self.make_qml_signal_signature(n, iface_name, slotname, True)
- out.write("connect(api_, SIGNAL(" + sig_signature + "), this, SLOT(" + slot_signature + "));\n")
- out.write("LOG4CXX_TRACE(logger_, \"CONNECT SIGNALS: \" << __PRETTY_FUNCTION__ );\n")
- out.write("}\n\n")
-
- for (request,response) in request_responses:
- in_params = [ self.make_param_desc(x, iface_name) for x in request.findall('param') ]
- out_params = [ self.make_param_desc(x, iface_name) for x in response.findall('param') ]
-
- out.write("bool fill{0}{1}Reply(QDBusMessage& message, const QVariantMap& map) {{\n".format(classname, request.get('name')))
- with CodeBlock(out) as out:
- out.write("int retCode_out = 0;\n")
- out.write("GetArgFromMap(map, \"__retCode\", retCode_out);\n")
- out.write("QVariant retCode_arg = QVariant::fromValue(retCode_out);\n")
- out.write("message << retCode_arg;\n")
- out.write("QString userMessage_out;\n")
- out.write("GetArgFromMap(map, \"__message\", userMessage_out);\n")
- out.write("QVariant userMessage_arg = QVariant::fromValue(userMessage_out);\n")
- out.write("message << userMessage_arg;\n")
- for p in out_params:
- param_name = p.name
- param_type = self.qt_param_type(p)
- out.write("%s %s_out;\n" % (param_type, p.name))
- out.write("if (!GetArgFromMap(map, \"{0}\", {0}_out)) {{ return false; }}\n".format(p.name))
- self.write_param_validation(p, p.name + "_out", "return false", out)
- out.write("QVariant {0}_arg;\n".format(p.name))
- out.write("{0}_arg.setValue({0}_out);\n".format(p.name))
- out.write("message << {0}_arg;\n".format(p.name))
- out.write("LOG4CXX_DEBUG(logger_, \"Output arguments:\\n\" << QVariant(map));\n")
- out.write("LOG4CXX_TRACE(logger_, \"REPLY ASYNC: \" << __PRETTY_FUNCTION__ );\n")
- out.write("return true;\n")
- out.write("}\n\n")
-
- out.write("{0} {{\n".format(self.make_method_signature(request, response, iface_name, True)))
- with CodeBlock(out) as out:
- out.write("LOG4CXX_TRACE(logger_, \"ENTER: \" << __PRETTY_FUNCTION__ );\n")
- out.write("int ret = 0;\n")
- return_statement = "return ret;\n"
- out.write("QVariantMap in_arg;\n");
- out.write("QVariant out_arg_v;\n");
- for param in in_params:
- self.write_param_validation(param, param.name + "_in", "RaiseDbusError(this, InvalidData); return ret", out)
- out.write("PutArgToMap(in_arg, \"" + param.name + "\", " + param.name + "_in);\n")
- out.write("LOG4CXX_DEBUG(logger_, \"Input arguments:\\n\" << in_arg);\n")
- method_name = request.get('name')[:1].lower() + request.get('name')[1:]
-
- out.write("dbusController->message = &message;\n")
- out.write("dbusController->fill = &fill{0}{1}Reply;\n".format(classname, request.get("name")))
-
- out.write("""if (!QMetaObject::invokeMethod(api_, "{0}", Qt::{1}Connection, Q_RETURN_ARG(QVariant, out_arg_v), Q_ARG(QVariant, QVariant(in_arg)))) {{\n""".format(method_name, invoke_type_connection))
- with CodeBlock(out) as out:
- out.write("RaiseDbusError(this, InvalidData);\n")
- out.write("LOG4CXX_ERROR(logger_, \"Can't invoke method " + method_name +"\");\n ")
- out.write("return ret;\n")
- out.write("}\n")
-
- out.write("dbusController->message = NULL;\n")
- out.write("dbusController->fill = NULL;\n")
- out.write("if (message.isDelayedReply()) {\n")
- with CodeBlock(out) as out:
- out.write("return ret;\n")
- out.write("}\n")
-
- out.write("QVariantMap out_arg;\n")
- out.write("if (out_arg_v.type() == QVariant::Map) {\n")
- with CodeBlock(out) as out:
- out.write("out_arg = out_arg_v.toMap();\n")
- out.write("};\n")
-
- out.write("int err;\n")
- out.write("""if (GetArgFromMap(out_arg, "__errno", err)) { RaiseDbusError(this, err); return ret; }\n""")
-
- out.write("int async_uid;\n")
- out.write("if (GetArgFromMap(out_arg, \"__async_uid\", async_uid)) {\n")
- with CodeBlock(out) as out:
- out.write("message.setDelayedReply(true);\n")
- out.write("dbusController->addMessage(message, &fill%s%sReply, async_uid);\n" % (classname, request.get('name')))
- out.write("LOG4CXX_TRACE(logger_, \"EXIT ASYNC: \" << __PRETTY_FUNCTION__ );\n")
- out.write("return ret;\n");
- out.write("}\n\n")
-
- for param in out_params:
- out.write("if (!GetArgFromMap(out_arg, \"{0}\", {0}_out)) {{ RaiseDbusError(this, InvalidData); return ret; }}\n".format(param.name))
- self.write_param_validation(param, param.name + "_out", "RaiseDbusError(this, InvalidData); return ret", out)
-
- out.write("GetArgFromMap(out_arg, \"__retCode\", ret);\n")
- out.write("GetArgFromMap(out_arg, \"__message\", userMessage_out);\n")
- out.write("LOG4CXX_DEBUG(logger_, \"Output arguments:\\n\" << QVariant(out_arg));\n")
- out.write("LOG4CXX_TRACE(logger_, \"EXIT: \" << __PRETTY_FUNCTION__ );\n")
- out.write("return ret;\n")
- out.write("}\n\n")
-
- for n in notifications:
- slotname = n.get('name') + '_qml'
- slot_signature = self.make_qml_signal_signature(n, iface_name, slotname, False, True)
- out.write(slot_signature + " {\n")
- params = n.findall('param')
- out.write(" LOG4CXX_TRACE(logger_, \"EMIT SIGNAL: \" << __PRETTY_FUNCTION__ );\n")
- out.write(" LOG4CXX_DEBUG(logger_, \"Arguments:\\n{\"")
- for p in params[0:-1]:
- param = self.make_param_desc(p, iface_name)
- out.write(" << \" " + param.name + ":\" << " + param.name + " << \",\"")
- for p in params[-1:]: # last param without comma in end line
- p = params[-1]
- param = self.make_param_desc(p, iface_name)
- out.write(" << \" " + param.name + ":\" << " + param.name)
- out.write(" << \" }\");\n")
- for p in params:
- param = self.make_param_desc(p, iface_name)
- param_type = self.qt_param_type(param)
- param_name = 'p_' + param.name
- if param.mandatory:
- if param.array or (param.type not in ['Integer', 'String', 'Float', 'Boolean'] and not param.enum):
- out.write(' ' + param_type + ' ' + param_name + ";\n")
- out.write(' if (!VariantToValue(' + param.name + ', ' + param_name + ")) {\n")
- out.write(" LOG4CXX_ERROR(logger_, \"Can't convert variant to value\");\n")
- out.write(" return;}\n")
- else:
- out.write(' ' + param_type + ' ' + param_name + ";\n")
- out.write(' ' + param_name + '.presence = !' + param.name + ".isNull();\n")
- out.write(' if (' + param_name + ".presence) {\n")
- out.write(' if (!VariantToValue(' + param.name + ', ' + param_name + ".val)) {\n")
- out.write(" LOG4CXX_ERROR(logger_, \"Can't convert variant to value\");\n")
- out.write(" return;\n }\n")
- out.write(" }\n")
- out.write(' emit ' + n.get('name') + '(')
- for i in range(len(params)):
- param = self.make_param_desc(params[i], iface_name)
- basic_type = (param.type in ['Integer', 'String', 'Float', 'Boolean']) or param.enum
- if param.array or (not param.mandatory) or (not basic_type):
- param_name = 'p_' + param.name
- else:
- param_name = param.name
- out.write(param_name)
- if i != len(params) - 1: out.write(', ')
- out.write(");\n")
- out.write("}\n\n")
-
-
- def make_dbus_adaptor_declarations(self, out):
- for interface_el in self.el_tree.findall('interface'):
- notifications = self.find_notifications_by_provider(interface_el, "hmi")
- request_responses = self.find_request_response_pairs_by_provider(interface_el, "hmi")
- if len(notifications) > 0 or len(request_responses) > 0:
- self.write_adaptor_declaration(interface_el, notifications, request_responses, out)
-
-
- def make_dbus_adaptor_definitions(self, out):
- for interface_el in self.el_tree.findall('interface'):
- notifications = self.find_notifications_by_provider(interface_el, "hmi")
- request_responses = self.find_request_response_pairs_by_provider(interface_el, "hmi")
- if len(notifications) > 0 or len(request_responses) > 0:
- self.write_adaptor_definition(interface_el, notifications, request_responses, out)
-
-
- def make_dbus_register_metatypes_declaraion(self, out):
- out.write("void RegisterDbusMetatypes();\n")
-
-
- def make_dbus_register_metatypes_definition(self, out):
- out.write("void RegisterDbusMetatypes() {\n")
- for (iface, name) in self.structs:
- struct_name = iface + '_' + name
- out.write('qDBusRegisterMetaType<' + struct_name + ">();\n")
- out.write('qDBusRegisterMetaType<OptionalArgument<' + struct_name + "> >();\n")
- out.write('qDBusRegisterMetaType<QList<' + struct_name + "> >();\n")
- out.write('qDBusRegisterMetaType<OptionalArgument<QList<' + struct_name + "> > >();\n")
- out.write("}\n")
-
-
- def make_api_adaptors_class(self, out):
- global prefix_class_item
- out.write("struct ApiAdaptors {\n")
- interfaces = self.el_tree.findall('interface')
- def filt(iface):
- return self.find_notifications_by_provider(iface, "hmi") or self.find_request_response_pairs_by_provider(iface, "hmi")
- interfaces = filter(filt, interfaces)
- for interface_el in interfaces:
- name = interface_el.get('name') + 'Adaptor'
- out.write(" " + name + "* " + name + "_;\n")
- out.write(" ApiAdaptors() :\n")
- for i in range(len(interfaces)):
- name = interfaces[i].get('name') + 'Adaptor'
- out.write(" " + name + "_(NULL)")
- if i <> len(interfaces) - 1: out.write(',')
- out.write("\n")
- out.write(" {}\n")
- out.write(" void Init(QObject* p) {\n")
- for interface_el in interfaces:
- name = interface_el.get('name') + 'Adaptor'
- out.write(" " + name + "_ = new " + name + "(p);\n")
- out.write(" }\n")
- out.write(" void SetApi(QObject* p) {\n")
- for interface_el in interfaces:
- name = interface_el.get('name') + 'Adaptor'
- chname = interface_el.get('name')
- out.write(" " + name + ("_->SetApi(p->findChild<Q%sItem*>(\"" % prefix_class_item) + chname + "\"));\n")
- out.write(" }\n")
- out.write(" void SetDBusController(DBusController* dc) {\n")
- for interface_el in interfaces:
- name = interface_el.get('name') + 'Adaptor'
- chname = interface_el.get('name')
- out.write(" " + name + "_->dbusController = dc;\n")
- out.write(" }\n")
- out.write("};\n\n")
-
-
-
-arg_parser = ArgumentParser(description="Generator of Qt to QDbus C++ part")
-arg_parser.add_argument('--infile', required=True, help="full name of input file, e.g. applink/src/components/interfaces/QT_HMI_API.xml")
-arg_parser.add_argument('--version', required=False, help="Qt version 4.8.5 (default) or 5.1.0")
-arg_parser.add_argument('--outdir', required=True, help="path to directory where output files qml_dbus.cc, qml_dbus.h will be saved")
-args = arg_parser.parse_args()
-
-if args.version == "4.8.5":
- prefix_class_item = 'Declarative'
- invoke_type_connection = 'Direct'
-elif args.version == "5.1.0":
- prefix_class_item = 'Quick'
- invoke_type_connection = 'BlockingQueued'
-
-header_name = 'qml_dbus.h'
-source_name = 'qml_dbus.cc'
-
-in_tree = ElementTree.parse(args.infile)
-in_tree_root = in_tree.getroot()
-
-impl = Impl(in_tree_root, 'com.ford.sdl.hmi')
-
-header_out = open(args.outdir + '/' + header_name, "w")
-source_out = open(args.outdir + '/' + source_name, "w")
-
-header_out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-header_out.write("""/**
- * @file qml_dbus.h
- * @brief Generated QDbus adaptors header file
- *
- * This file is a part of HMI D-Bus layer.
- */
-// Copyright (c) 2013, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-""")
-header_out.write("#ifndef SRC_COMPONENTS_DBUS_QML_DBUS_H_\n");
-header_out.write("#define SRC_COMPONENTS_DBUS_QML_DBUS_H_\n\n");
-header_out.write("#include <QtDBus/QDBusArgument>\n");
-header_out.write("#include <QtDBus/QDBusMessage>\n");
-header_out.write("#include <QtDBus/QDBusConnection>\n");
-header_out.write("#include <QtDBus/QDBusAbstractAdaptor>\n");
-header_out.write("#include <QtDBus/QDBusMetaType>\n");
-header_out.write("#include <Qt%s/Q%sItem>\n" % (prefix_class_item, prefix_class_item));
-header_out.write("#include \"qml_dbus_common.h\"\n\n");
-header_out.write("#include \"dbus_controller.h\"\n\n");
-impl.make_dbus_type_declarations(header_out)
-impl.make_dbus_adaptor_declarations(header_out)
-impl.make_dbus_register_metatypes_declaraion(header_out)
-impl.make_api_adaptors_class(header_out)
-impl.make_dbus_metatype_declarations(header_out)
-header_out.write("#endif // #ifndef SRC_COMPONENTS_DBUS_QML_DBUS_H_\n");
-
-source_out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-source_out.write("""/**
- * @file qml_dbus.cc
- * @brief Generated QDbus adaptors source file
- *
- * This file is a part of HMI D-Bus layer.
- */
-// Copyright (c) 2013, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-""")
-source_out.write("#include \"" + header_name + "\"\n\n");
-source_out.write("#include \"utils/logger.h\"\n")
-source_out.write("#ifdef ENABLE_LOG\n")
-source_out.write("extern log4cxx::LoggerPtr logger_;\n")
-source_out.write("#endif // ENABLE_LOG\n\n")
-impl.make_dbus_type_definitions(source_out)
-impl.make_dbus_adaptor_definitions(source_out)
-impl.make_dbus_register_metatypes_definition(source_out)
diff --git a/src/components/dbus/codegen/make_qml_dbus_qml.py b/src/components/dbus/codegen/make_qml_dbus_qml.py
deleted file mode 100755
index 8d057dcda1..0000000000
--- a/src/components/dbus/codegen/make_qml_dbus_qml.py
+++ /dev/null
@@ -1,217 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# @file make_qml_dbus_qml.py
-# @brief Generator of QML to QDbus QML part
-#
-# This file is a part of HMI D-Bus layer.
-#
-# Copyright (c) 2013, Ford Motor Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided with the
-# distribution.
-#
-# Neither the name of the Ford Motor Company nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-from os import path
-from os import makedirs
-from sys import argv
-from argparse import ArgumentParser
-from xml.etree import ElementTree
-from copy import copy
-from ford_xml_parser import FordXmlParser
-
-namespace = 'dbus_qml'
-qt_quick_version = '1.1'
-type_variant_name = 'variant'
-
-class Impl(FordXmlParser):
- def write_function(self, ifacename, request, response, out):
- name = request.get('name')
- name = name[:1].lower() + name[1:]
- out.write(" function " + name + "(params) {\n")
- out.write(""" console.debug("{0}Proxy::{1}")\n""".format(ifacename, name))
- out.write(" try {\n")
- out.write(" if(\"{0}\" in sdl{1})\n".format(name, ifacename))
- out.write(" return sdl{0}.{1}(" .format(ifacename, name))
- params = request.findall('param')
- for i in range(len(params)):
- out.write('params.' + params[i].get('name'))
- if i <> len(params) - 1:
- out.write(', ')
- out.write(")\n")
- out.write(" else\n")
- out.write(""" return { "__errno": Common.Result.UNSUPPORTED_REQUEST }\n""")
- out.write(" } catch(err) {\n")
- out.write(""" return { "__errno": err }\n""")
- out.write(" }\n")
- out.write(" }\n\n")
-
-
- def write_signal_param(self, param, out):
- if param.array or param.struct or not param.mandatory: typ = type_variant_name
- elif param.type == 'Integer' or param.enum: typ = 'int'
- elif param.type == 'String': typ = 'string'
- elif param.type == 'Boolean': typ = 'bool'
- elif param.type == 'Float': typ = 'double'
- else: typ = type_variant_name
- out.write(typ + ' ' + param.name)
-
-
- def write_signal(self, ifacename, notification, out):
- name = notification.get('name')
- name = name[:1].lower() + name[1:]
- out.write(" signal " + name + "(")
- params = notification.findall('param')
- for i in range(len(params)):
- self.write_signal_param(self.make_param_desc(params[i], ifacename), out)
- if i <> len(params) - 1:
- out.write(', ')
- out.write(")\n")
- name = notification.get('name')
- out.write(""" on{1}: console.debug("emitted {0}:{1}")\n""".format(ifacename, name))
-
-
- def write_qml(self, iface, out):
- global qt_quick_version
- name = iface.get('name')
- out.write("import QtQuick %s\n" % qt_quick_version)
- out.write("""import "Common.js" as Common\n""")
- out.write("import \"..\"\n\n")
- out.write("Item {\n")
- out.write(" " + name + " {\n")
- out.write(" id: sdl" + name + "\n")
- out.write(" }\n")
-
- notifications = impl.find_notifications_by_provider(interface_el, "hmi")
- request_responses = impl.find_request_response_pairs_by_provider(interface_el, "hmi")
- for request, response in request_responses:
- self.write_function(name, request, response, out)
- for n in notifications:
- self.write_signal(name, n, out)
- out.write("}\n")
-
-
- def write_js_enum(self, enum, out):
- out.write("var " + enum.get('name') + " = {\n")
- lastval = -1
- elements = enum.findall('element')
- for i in range(len(elements)):
- element = elements[i]
- value = element.get('value')
- if value is None:
- value = lastval + 1
- else:
- value = int(value)
- lastval = value
- name = element.get('internal_name')
- if name is None:
- name = element.get('name')
- out.write(" " + name + ': ' + str(value))
- if len(elements) - 1 != i: out.write(',')
- out.write("\n")
- out.write("}\n\n")
-
-
-def write_header(out):
- out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
- out.write("""/**
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-""")
-
-arg_parser = ArgumentParser(description="Generator of Qt to QDbus QML part")
-arg_parser.add_argument('--infile', required=True, help="full name of input file, e.g. applink/src/components/interfaces/QT_HMI_API.xml")
-arg_parser.add_argument('--version', required=False, help="Qt version 4.8.5 (default) or 5.1.0")
-arg_parser.add_argument('--outdir', required=True, help="path to directory where output files with pattern name <intarface name>Proxy.qml will be saved, e.g. BasicCommunicationProxy.qml, ButtonsProxy.qml VRProxy.qml")
-args = arg_parser.parse_args()
-
-if args.version == "4.8.5":
- qt_quick_version = "1.1"
- type_variant_name = "variant"
-elif args.version == "5.1.0":
- qt_quick_version = "2.0"
- type_variant_name = "var"
-
-if not path.isdir(args.outdir):
- makedirs(args.outdir)
-
-in_tree = ElementTree.parse(args.infile)
-in_tree_root = in_tree.getroot()
-
-impl = Impl(in_tree_root)
-
-for interface_el in in_tree_root.findall('interface'):
- notifications = impl.find_notifications_by_provider(interface_el, "hmi")
- request_responses = impl.find_request_response_pairs_by_provider(interface_el, "hmi")
- if notifications or request_responses:
- filename = interface_el.get('name')+'Proxy.qml'
- outfile = open(args.outdir + '/' + filename, 'w')
- write_header(outfile)
- impl.write_qml(interface_el, outfile)
-
-enum_files = dict()
-for (iface, name), enum in impl.enums.items():
- if iface in enum_files:
- outfile = enum_files[iface]
- else:
- filename = iface+'.js'
- outfile = open(args.outdir + '/' + filename, 'w')
- write_header(outfile)
- outfile.write(".pragma library\n")
- enum_files[iface] = outfile
- impl.write_js_enum(enum, outfile)
-
-
diff --git a/src/components/dbus/codegen/make_qml_requests_cpp.py b/src/components/dbus/codegen/make_qml_requests_cpp.py
deleted file mode 100644
index 6674b8f5e2..0000000000
--- a/src/components/dbus/codegen/make_qml_requests_cpp.py
+++ /dev/null
@@ -1,253 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# @file make_qml_dbus_cpp.py
-# @brief Generator of QML to QDbus C++ part
-#
-# This file is a part of HMI D-Bus layer.
-#
-# Copyright (c) 2014, Ford Motor Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided with the
-# distribution.
-#
-# Neither the name of the Ford Motor Company nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-from argparse import ArgumentParser
-import os.path
-from sys import argv
-from xml.etree import ElementTree
-from copy import copy
-from ford_xml_parser import FordXmlParser, ParamDesc
-from code_formatter import CodeBlock
-
-prefix_class_item = 'Declarative'
-invoke_type_connection = 'Direct'
-
-def defaultValue(param):
- if param.type == "Integer":
- return "0"
- elif param.type == "Float":
- return "0.0"
- elif param.type == "Boolean":
- return "false"
- elif param.enum:
- return "0"
-
-class Impl(FordXmlParser):
-
-
- def args_for_function_definition(self, params, out):
- if len(params) == 0:
- out.write('QJSValue hmi_callback')
- return
- for param in params:
- out.write('QVariant ' + param.get('name') + ', ')
- out.write('QJSValue hmi_callback')
-
-
- def make_requests_for_header(self, out):
- for interface_el in self.el_tree.findall('interface'):
- request_responses = self.find_request_response_pairs_by_provider(interface_el, "sdl")
- for (request, response) in request_responses:
- all_params = list()
- for param_el in request.findall('param'):
- all_params.append(param_el)
- with CodeBlock(out) as output:
- output.write("Q_INVOLABKE void " + interface_el.get('name') + "_" +request.get('name') + "(")
- impl.args_for_function_definition(all_params, out)
- output.write(");\n")
-
-
- def make_header_file(self, out):
- out.write("class RequestToSDL : public QObject\n")
- out.write("{\n")
- out.write(" public:\n")
- with CodeBlock(out) as output:
- output.write("explicit RequestToSDL(QObject *parent = 0);\n")
- output.write("~RequestToSDL();\n")
- impl.make_requests_for_header(out)
- out.write(" private:\n")
- with CodeBlock(out) as output:
- for interface_el in self.el_tree.findall('interface'):
- output.write('QDBusInterface *' + interface_el.get('name') + ';\n')
- out.write("};\n")
-
-
- def make_requests_for_source(self, out):
- for interface_el in self.el_tree.findall('interface'):
- request_responses = self.find_request_response_pairs_by_provider(interface_el, "sdl")
- for (request, response) in request_responses:
- out.write('void RequestToSDL::' + request.get('name') + '(QString name, ')
- for param_el in request.findall('param'):
- out.write('QVariant ' + param_el.get('name') + ', ')
- out.write('QJSValue hmi_callback) {\n')
- with CodeBlock(out) as output:
- output.write('QList<QVariant> args;\n')
- for param_el in request.findall('param'):
- output.write('args << ' + param_el.get('name') + ';\n')
- output.write('new ' + interface_el.get('name') + '_' + request.get('name') + '(' + interface_el.get('name') + ', name, args, hmi_callback);\n}\n')
-
-
-
- def make_source_file(self, out):
- out.write('#include "request_to_sdl.h"\n')
- out.write('\n')
- out.write('RequestToSDL::RequestToSDL(QObject *parent) {\n')
- with CodeBlock(out) as output:
- output.write('QDBusConnection bus = QDBusConnection::sessionBus();\n')
- for interface_el in self.el_tree.findall('interface'):
- iface_name = interface_el.get('name')
- output.write(iface_name + ' = new QDBusInterface("com.ford.sdl.core", "/", "com.ford.sdl.core.' + iface_name + '", bus, this);\n')
- out.write('}\n\n')
- out.write('RequestToSDL::~RequestToSDL() {\n')
- with CodeBlock(out) as output:
- for interface_el in self.el_tree.findall('interface'):
- iface_name = interface_el.get('name')
- output.write(iface_name + '->deleteLater();\n')
- output.write('this->deleteLater();\n')
- out.write('}\n\n')
- impl.make_requests_for_source(out)
-
-
-
-
-
-arg_parser = ArgumentParser(description="Generator of Qt to QDbus C++ part")
-arg_parser.add_argument('--infile', required=True, help="full name of input file, e.g. applink/src/components/interfaces/QT_HMI_API.xml")
-arg_parser.add_argument('--version', required=False, help="Qt version 4.8.5 (default) or 5.1.0")
-arg_parser.add_argument('--outdir', required=True, help="path to directory where output files request_to_sdl.h, request_to_sdl.cc will be saved")
-args = arg_parser.parse_args()
-
-if args.version == "4.8.5":
- prefix_class_item = 'Declarative'
- invoke_type_connection = 'Direct'
-elif args.version == "5.1.0":
- prefix_class_item = 'Quick'
- invoke_type_connection = 'BlockingQueued'
-
-header_name = 'request_to_sdl.h'
-source_name = 'request_to_sdl.cc'
-
-in_tree = ElementTree.parse(args.infile)
-in_tree_root = in_tree.getroot()
-
-impl = Impl(in_tree_root, 'com.ford.sdl.hmi')
-
-header_out = open(args.outdir + '/' + header_name, "w")
-source_out = open(args.outdir + '/' + source_name, "w")
-
-header_out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-header_out.write("""/**
- * @file request_to_sdl.h
- * @brief Generated class that process requests from qtHMI
- *
- * This file is a part of HMI D-Bus layer.
- */
-// Copyright (c) 2013, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-""")
-header_out.write("#ifndef SRC_COMPONENTS_QTHMI_QMLMODELQT5_REQUESTTOSDL_\n");
-header_out.write("#define SRC_COMPONENTS_QTHMI_QMLMODELQT5_REQUESTTOSDL_\n\n");
-header_out.write("#include <QDBusConnection>\n");
-header_out.write("#include <QJSValue>\n");
-header_out.write("#include <QObject>\n");
-header_out.write("#include <QDBusInterface>\n");
-header_out.write('#include "hmi_requests.h"\n');
-
-impl.make_header_file(header_out)
-
-header_out.write("#endif SRC_COMPONENTS_QTHMI_QMLMODELQT5_REQUESTTOSDL_\n");
-
-
-source_out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-source_out.write("""/**
- * @file request_to_sdl.cc
- * @brief Generated class that process requests from qtHMI
- *
- * This file is a part of HMI D-Bus layer.
- */
-// Copyright (c) 2014, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-""")
-
-impl.make_source_file(source_out)
diff --git a/src/components/dbus/codegen/make_request_to_sdl.py b/src/components/dbus/codegen/make_request_to_sdl.py
deleted file mode 100755
index c8940f3eb7..0000000000
--- a/src/components/dbus/codegen/make_request_to_sdl.py
+++ /dev/null
@@ -1,335 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# @file make_qml_dbus_cpp.py
-# @brief Generator of QML to QDbus C++ part
-#
-# This file is a part of HMI D-Bus layer.
-#
-# Copyright (c) 2014, Ford Motor Company
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following
-# disclaimer in the documentation and/or other materials provided with the
-# distribution.
-#
-# Neither the name of the Ford Motor Company nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-from argparse import ArgumentParser
-import os.path
-from sys import argv
-from xml.etree import ElementTree
-from copy import copy
-from ford_xml_parser import FordXmlParser, ParamDesc
-from code_formatter import CodeBlock
-
-class Impl(FordXmlParser):
-
- def args_for_function_definition(self, params, iface_name, out):
- for param_el in params:
- param = self.make_param_desc(param_el, iface_name)
- out.write('QVariant %s,' % (param.name))
- out.write('Q%sValue hmi_callback' % prefix_class_item)
-
- def make_requests_for_header(self, out):
- for interface_el in self.el_tree.findall('interface'):
- request_responses = self.find_request_response_pairs_by_provider(interface_el, "sdl")
- for (request, response) in request_responses:
- all_params = list()
- for param_el in request.findall('param'):
- all_params.append(param_el)
- with CodeBlock(out) as output:
- output.write("Q_INVOKABLE bool %s_%s(" % (interface_el.get('name'), request.get('name')))
- impl.args_for_function_definition(all_params, interface_el.get('name'), out)
- output.write(");\n")
-
-
- def make_header_file(self, out):
- out.write("class QDBusInterface;\n")
- out.write("class RequestToSDL : public QObject\n")
- out.write("{\n")
- out.write(' Q_OBJECT\n')
- out.write(" public:\n")
- with CodeBlock(out) as output:
- output.write("explicit RequestToSDL(QObject *parent = 0);\n")
- output.write("~RequestToSDL();\n")
- impl.make_requests_for_header(out)
- out.write(" private:\n")
- with CodeBlock(out) as output:
- for interface_el in self.el_tree.findall('interface'):
- output.write('QDBusInterface *%s;\n' % interface_el.get('name'))
- out.write("};\n")
-
-
- def qt_param_type(self, param):
- if not param.mandatory:
- param_copy = copy(param)
- param_copy.mandatory = True
- return "OptionalArgument< " + self.qt_param_type(param_copy) + " >"
- if param.array:
- param_copy = copy(param)
- param_copy.array = False
- if param.type == 'String':
- return "QStringList"
- return "QList< " + self.qt_param_type(param_copy) + " >"
- if param.type == 'Integer' or param.enum:
- return 'int'
- elif param.type == 'String':
- return 'QString'
- elif param.type == 'Boolean':
- return 'bool'
- elif param.type == 'Float':
- return 'double'
- elif param.struct:
- return "_".join(param.fulltype)
- else:
- raise RuntimeError('Unknown type: ' + param.type)
-
-
- def make_requests_for_source(self, out):
- for interface_el in self.el_tree.findall('interface'):
- request_responses = self.find_request_response_pairs_by_provider(interface_el, "sdl")
- for (request, response) in request_responses:
- request_name = request.get('name')
- iface_name = interface_el.get('name')
- request_full_name = iface_name + '_' + request_name
- out.write('bool RequestToSDL::' + request_full_name + '(')
- for param_el in request.findall('param'):
- out.write('QVariant %s, ' % (param_el.get('name')))
- out.write('Q%sValue hmi_callback) {\n' % prefix_class_item)
- with CodeBlock(out) as output:
- output.write('LOG4CXX_TRACE(logger_, "ENTER");\n')
- output.write('QList<QVariant> args;\n')
- for param_el in request.findall('param'):
- param = self.make_param_desc(param_el, iface_name)
- output.write('%s %s;\n' % (impl.qt_param_type(param), param.name + "_tmp"))
- output.write('if (VariantToValue(%s, %s)) {\n' % (param.name, param.name + '_tmp'))
- with CodeBlock(output) as out:
- self.write_param_validation(param, param.name + "_tmp",
- "\nLOG4CXX_ERROR(logger_, \"%s in %s out of bounds\");\nreturn false" % (param.name, request_full_name),
- out)
- out.write('args << QVariant::fromValue(%s);\n' % (param.name + '_tmp'))
- output.write('} else {\n')
- with CodeBlock(output) as out:
- out.write('LOG4CXX_ERROR(logger_, "%s in %s is NOT valid");\n' % (param.name, request_full_name))
- out.write('return false;\n')
- out.write('}\n')
- output.write('new requests::' + request_full_name + '(hmi_callback, ' + interface_el.get('name') + ' , args, '
- + '"' + request_name + '");\n')
- output.write('LOG4CXX_TRACE(logger_, "EXIT");\n')
- output.write('return true;\n')
- out.write('}\n\n')
-
-
- def write_param_validation(self, param, param_name, fail_statement, out, level=0):
- if not param.mandatory and (param.restricted or param.restrictedArray or (param.struct and any(map(lambda x: x.restricted, self.structs[param.fulltype])))):
- out.write("if (%s.presence) {\n" % param_name)
- param_copy = copy(param)
- param_copy.mandatory = True
- with CodeBlock(out) as out:
- self.write_param_validation(param_copy, param_name + ".val", fail_statement, out, level+1)
- out.write("}\n")
- elif param.array:
- if param.minSize > 0:
- out.write("if ({0}.count() < {1}) {{".format(param_name, param.minSize))
- with CodeBlock(out) as out:
- out.write("{0};\n".format(fail_statement))
- out.write("}\n")
- if param.maxSize != None:
- out.write("if ({0}.count() > {1}) {{".format(param_name, param.maxSize))
- with CodeBlock(out) as out:
- out.write("{0};\n".format(fail_statement))
- out.write("}\n")
- if param.restricted:
- out.write('for ({0}::const_iterator it_{2} = {1}.begin(); it_{2} != {1}.end(); ++it_{2}) {{\n'.format(self.qt_param_type(param), param_name, level))
- with CodeBlock(out) as out:
- param_copy = copy(param)
- param_copy.array = False
- self.write_param_validation(param_copy, "(*it_{0})".format(level), fail_statement, out, level+1)
- out.write("}\n")
- elif param.struct:
- for p in self.structs[param.fulltype]:
- self.write_param_validation(p, "{0}.{1}".format(param_name, p.name), fail_statement, out, level+1)
- elif param.type == "Integer" or param.type == "Float":
- conditions = []
- if (param.minValue != None):
- conditions.append("(%s < %s)" % (param_name, param.minValue))
- if (param.maxValue != None):
- conditions.append("(%s > %s)" % (param_name, param.maxValue))
- if conditions:
- out.write('if (%s) {' % ' || '.join(conditions))
- with CodeBlock(out) as out:
- out.write('%s;\n' % fail_statement)
- out.write("}\n")
- elif param.type == "String":
- conditions = []
- if (param.minLength > 0):
- conditions.append("(%s.size() < %s)" % (param_name, param.minLength))
- if (param.maxLength > 0):
- conditions.append("(%s.size() > %s)" % (param_name, param.maxLength))
- if conditions:
- out.write('if (%s) {' % ' || '.join(conditions))
- with CodeBlock(out) as out:
- out.write('%s;\n' % (fail_statement))
- out.write("}\n")
-
- def make_source_file(self, out):
- out.write('RequestToSDL::RequestToSDL(QObject *parent) {\n')
- with CodeBlock(out) as output:
- output.write('QDBusConnection bus = QDBusConnection::sessionBus();\n')
- for interface_el in self.el_tree.findall('interface'):
- iface_name = interface_el.get('name')
- output.write(iface_name + ' = new QDBusInterface("com.ford.sdl.core", "/", "com.ford.sdl.core.' + iface_name + '", bus, this);\n')
- out.write('}\n\n')
- out.write('RequestToSDL::~RequestToSDL() {\n')
- with CodeBlock(out) as output:
- for interface_el in self.el_tree.findall('interface'):
- iface_name = interface_el.get('name')
- output.write(iface_name + '->deleteLater();\n')
- output.write('this->deleteLater();\n')
- out.write('}\n\n')
- impl.make_requests_for_source(out)
-
-arg_parser = ArgumentParser(description="Generator of Qt to QDbus C++ part")
-arg_parser.add_argument('--infile', required=True, help="full name of input file, e.g. applink/src/components/interfaces/QT_HMI_API.xml")
-arg_parser.add_argument('--version', required=False, help="Qt version 4.8.5 (default) or 5.1.0")
-arg_parser.add_argument('--outdir', required=True, help="path to directory where output files request_to_sdl.h, request_to_sdl.cc will be saved")
-args = arg_parser.parse_args()
-
-
-if args.version == "4.8.5":
- prefix_class_item = 'Script'
- invoke_type_connection = 'Direct'
-elif args.version == "5.1.0":
- prefix_class_item = 'JS'
- invoke_type_connection = 'BlockingQueued'
-else:
- prefix_class_item = 'JS'
- invoke_type_connection = 'BlockingQueued'
-
-header_name = 'request_to_sdl.h'
-source_name = 'request_to_sdl.cc'
-
-in_tree = ElementTree.parse(args.infile)
-in_tree_root = in_tree.getroot()
-
-impl = Impl(in_tree_root, 'com.ford.sdl.hmi')
-
-header_out = open(args.outdir + '/' + header_name, "w")
-source_out = open(args.outdir + '/' + source_name, "w")
-
-header_out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-header_out.write("""
-/*
- Copyright (c) 2014, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-""")
-header_out.write("#ifndef SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_REQUEST_TO_SDL_H_\n")
-header_out.write("#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_REQUEST_TO_SDL_H_\n\n")
-
-header_out.write("#include <QtCore/QObject>\n")
-header_out.write("#include <QtCore/QVariant>\n")
-header_out.write("#include <QtCore/QStringList>\n\n")
-header_out.write('#include "qml_dbus.h"\n\n')
-if args.version == "4.8.5":
- header_out.write("#include <QtScript/QScriptValue>\n")
-elif args.version == "5.1.0":
- header_out.write("#include <QtQml/QJSValue>\n")
-
-impl.make_header_file(header_out)
-header_out.write("#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_REQUEST_TO_SDL_H_")
-
-
-source_out.write("// Warning! This file is generated by '%s'. Edit at your own risk.\n" % argv[0])
-source_out.write("""
-/*
- Copyright (c) 2014, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-*/
-
-""")
-
-source_out.write('#include "request_to_sdl.h"\n')
-source_out.write("#include <QtDBus/QDBusConnection>\n")
-source_out.write("#include <QtDBus/QDBusInterface>\n")
-source_out.write('#include "hmi_requests.h"\n')
-source_out.write('#include "utils/logger.h"\n\n')
-source_out.write('CREATE_LOGGERPTR_GLOBAL(logger_, "DBusPlugin")\n\n')
-
-impl.make_source_file(source_out)
diff --git a/src/components/dbus/include/dbus/dbus_adapter.h b/src/components/dbus/include/dbus/dbus_adapter.h
deleted file mode 100644
index 42a2ac1140..0000000000
--- a/src/components/dbus/include/dbus/dbus_adapter.h
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- * Copyright (c) 2013-2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_ADAPTER_H_
-#define SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_ADAPTER_H_
-
-#include <string>
-#include "smart_objects/smart_object.h"
-#include "dbus/schema.h"
-#include "dbus/message_descriptions.h"
-
-struct DBusConnection;
-struct DBusMessage;
-struct DBusMessageIter;
-
-namespace dbus {
-
-/**
- * \brief class for work with DBus
- */
-class DBusAdapter {
- public:
- /**
- * \brief constructs DBus adapter
- * \param sdlServiceName core service name
- * \param sdlObjectPath core object path
- * \param hmiServiceName hmi service name
- */
- DBusAdapter(const std::string& sdlServiceName,
- const std::string& sdlObjectPath,
- const std::string& hmiServiceName,
- const std::string& hmiObjectPath);
-
- /**
- * \brief destructs DBus adapter
- */
- virtual ~DBusAdapter();
-
- /**
- * \brief inits service
- * \return true if success
- */
- bool Init();
-
- /**
- * \brief return schema messages for DBus
- * \return schema
- */
- const DBusSchema& get_schema() const;
-
- protected:
- /**
- * \brief calls method on HMI
- * \param id id message
- * \param func_id id function in Ford protocol
- * \param name pair interface and name of method for call
- * \param obj params for call
- */
- void MethodCall(uint id,
- const MessageId func_id,
- const MessageName& name,
- const smart_objects::SmartObject& obj);
-
- /**
- * \brief sends signal
- * \param id id message
- * \param func_id id function in Ford protocol
- * \param name pair interface and name of signal for call
- * \param obj params for signal
- */
- void Signal(const MessageId func_id,
- const MessageName& name,
- const smart_objects::SmartObject& obj);
-
- /**
- * \brief returns result of call method to HMI
- * \param id id message
- * \param obj params for return
- */
- void MethodReturn(uint id,
- const MessageId func_id,
- const MessageName& name,
- const smart_objects::SmartObject& obj);
-
- /**
- * \brief sends error on message from HMI
- * \param id id message
- * \param msg message from HMI
- * \param name name of error
- * \param description description of error
- */
- void Error(uint id, const std::string& name, const std::string& description);
-
- /**
- * \brief adds a match rule
- * \param rule string rule in the DBus specification
- */
- void AddMatch(const std::string& rule);
-
- /**
- * \brief processes incoming message from DBus if queue isn't empty
- * and fill obj
- * \param obj object for send to core
- * \return true if message processed
- */
- bool Process(smart_objects::SmartObject& obj);
-
- /**
- * \brief saves link D-Bus serial to Ford message id
- * \param serial D-Bus message serial
- * \param ids pair correlation id and Ford message id
- */
- inline void SaveRequestToHMI(uint32_t serial,
- const std::pair<uint, MessageId>& ids);
-
- /**
- * \brief gets Ford message id by serial
- * \param serial D-Bus message serial
- * \return pair correlation id and Ford message id
- */
- inline std::pair<uint, MessageId> GetRequestToHMI(uint32_t serial);
-
- /**
- * \brief saves link D-Bus serial to Ford message id
- * \param serial D-Bus message serial
- * \param request D-Bus message from HMI
- */
- inline void SaveRequestFromHMI(uint32_t serial, DBusMessage* request);
-
- /**
- * \brief gets D-Bus message id by serial
- * \param serial DBus message serial
- * \return D-Bus message from HMI
- */
- inline DBusMessage* GetRequestFromHMI(uint32_t serial);
-
- std::string sdl_service_name_;
- std::string sdl_object_path_;
- std::string hmi_service_name_;
- std::string hmi_object_path_;
- DBusConnection* conn_;
-
- private:
- /**
- * \brief schema messages and arguments for DBus
- */
- const DBusSchema* schema_;
-
- /**
- * \brief mapping serial message DBus on message id Ford protocol
- */
- std::map<uint32_t, std::pair<uint, MessageId> > requests_to_hmi_;
-
- /**
- * \brief mapping message id Ford protocol on message DBus
- */
- std::map<uint32_t, DBusMessage*> requests_from_hmi_;
-
- /**
- * \brief processes incoming call of method and fill obj
- * \param msg message from DBus
- * \param obj object for send to core
- * \return true if success
- */
- bool ProcessMethodCall(DBusMessage* msg, smart_objects::SmartObject& obj);
-
- /**
- * \brief processes incoming return of method and fill obj
- * \param msg message from DBus
- * \param obj object for send to core
- * \return true if success
- */
- bool ProcessMethodReturn(DBusMessage* msg, smart_objects::SmartObject& obj);
-
- /**
- * \brief processes incoming error and fill obj
- * \param msg message from DBus
- * \param obj object for send to core
- * \return true if success
- */
- bool ProcessError(DBusMessage* msg, smart_objects::SmartObject& obj);
-
- /**
- * \brief processes incoming signal and fill obj
- * \param msg message from DBus
- * \param obj object for send to core
- * \return true if success
- */
- bool ProcessSignal(DBusMessage* msg, smart_objects::SmartObject& obj);
-
- /**
- * \brief sets arguments to message
- * \param msg DBus message
- * \param rules list of rules for arguments
- * \param args map of arguments
- * \return true if success
- */
- bool SetArguments(DBusMessage* msg,
- const ListArgs& rules,
- const smart_objects::SmartObject& args);
-
- /**
- * \brief Sets one argument to message
- * \param iter DBus message iterator
- * \param rules description for argument
- * \param param value of argument
- * \return true if success
- */
- bool SetOneArgument(
- DBusMessageIter* iter,
- const ford_message_descriptions::ParameterDescription* rules,
- const smart_objects::SmartObject& param);
-
- /**
- * \brief sets value for argument
- * \param iter DBus message iterator
- * \param rules description for argument
- * \param param value of argument
- * \return true if success
- */
- bool SetValue(DBusMessageIter* iter,
- const ford_message_descriptions::ParameterDescription* rules,
- const smart_objects::SmartObject& param);
-
- /**
- * \brief sets value for every element of argument
- * \param iter DBus message iterator
- * \param rules description for argument
- * \param param array values of argument
- * \return true if success
- */
- bool SetArrayValue(DBusMessageIter* iter,
- const ford_message_descriptions::ArrayDescription* rules,
- const smart_objects::SmartObject& param);
-
- /**
- * \brief sets struct value for argument
- * \param iter DBus message iter
- * \param rules description for argument
- * \param param structure
- * \return true if success
- */
- bool SetStructValue(DBusMessageIter* iter,
- const ford_message_descriptions::StructDescription* rules,
- const smart_objects::SmartObject& param);
-
- /**
- * \brief sets optional value for argument.
- * Optional param is struct bool, value
- * \param iter DBus message iterator
- * \param rules description for argument
- * \param param value of optional argument
- * \return true if success
- */
- bool SetOptionalValue(
- DBusMessageIter* iter,
- const ford_message_descriptions::ParameterDescription* rules,
- const smart_objects::SmartObject& param);
-
- /**
- * \brief gets arguments from message
- * \param iter DBus message iterator
- * \param code response code (output)
- * \param message response message (output)
- * \return true if success
- */
- bool GetHeader(DBusMessageIter* iter, int* code, std::string* message);
-
- /**
- * \brief gets arguments from message with header
- * \param iter DBus message iterator
- * \param rules list of rules for arguments
- * \param args map of arguments
- * \return true if success
- */
- bool GetArguments(DBusMessageIter* iter,
- const ListArgs& rules,
- smart_objects::SmartObject& args);
-
- /**
- * \brief gets one argument from message
- * \param iter DBus message iterator
- * \param rules description for argument
- * \param args map of arguments
- * \return true if success
- */
- bool GetOneArgument(
- DBusMessageIter* iter,
- const ford_message_descriptions::ParameterDescription* rules,
- smart_objects::SmartObject& args);
-
- /**
- * \brief gets value for argument
- * \param iter DBus message iterator
- * \param rules description for argument
- * \param param value of argument
- * \return true if success
- */
- bool GetValue(DBusMessageIter* iter,
- const ford_message_descriptions::ParameterDescription* rules,
- smart_objects::SmartObject& param);
-
- /**
- * \brief gets value for every element of argument
- * \param iter DBus message iterator
- * \param rules description for argument
- * \param param array values of argument
- * \return true if success
- */
- bool GetArrayValue(DBusMessageIter* iter,
- const ford_message_descriptions::ArrayDescription* rules,
- smart_objects::SmartObject& param);
-
- /**
- * \brief gets struct value for argument
- * \param iter DBus message iterator
- * \param rules description for argument
- * \param param structure
- * \return true if success
- */
- bool GetStructValue(DBusMessageIter* iter,
- const ford_message_descriptions::StructDescription* rules,
- smart_objects::SmartObject& param);
-
- /**
- * \brief gets optional value for argument.
- * Optional param is struct bool, value
- * \param iter DBus message iterator
- * \param rules description for argument
- * \param param value of optional argument
- * \return true if success
- */
- bool GetOptionalValue(
- DBusMessageIter* iter,
- const ford_message_descriptions::ParameterDescription* rules,
- smart_objects::SmartObject& param);
-
- /**
- * \brief processes request on introspect
- * \param msg DBus message
- */
- void Introspect(DBusMessage* msg);
-};
-
-} // namespace dbus
-
-#endif // SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_ADAPTER_H_
diff --git a/src/components/dbus/include/dbus/dbus_message.h b/src/components/dbus/include/dbus/dbus_message.h
deleted file mode 100644
index 23e672d0fc..0000000000
--- a/src/components/dbus/include/dbus/dbus_message.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_MESSAGE_H_
-#define SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_MESSAGE_H_
-
-#include <stdint.h>
-#include <string>
-
-#include <dbus/dbus.h>
-
-namespace dbus {
-
-enum ContainerType {
- kArray = DBUS_TYPE_ARRAY,
- kStruct = DBUS_TYPE_STRUCT,
- kDictEntry = DBUS_TYPE_DICT_ENTRY
-};
-
-class MessageRefKeeper {
- public:
- MessageRefKeeper();
- MessageRefKeeper(DBusMessage* message);
- ~MessageRefKeeper();
- MessageRefKeeper(const MessageRefKeeper& other);
- MessageRefKeeper& operator=(MessageRefKeeper other);
- DBusMessage* get() const;
- DBusMessage* Pass();
- void swap(MessageRefKeeper& other);
-
- private:
- DBusMessage* raw_message_;
-};
-
-class MessageRef {
- public:
- MessageRef(DBusMessage* message);
- ~MessageRef();
- std::string GetInterface() const;
- std::string GetMember() const;
-
- protected:
- MessageRefKeeper raw_message_ref_;
- friend class MessageReader;
- friend class MessageWriter;
-};
-
-class MessageReader {
- public:
- // Main constructor
- MessageReader(const MessageRef& message);
- bool has_failed() const;
- bool IsAtLastElement() const;
- bool HasNext() const;
-
- // Type checkers
- bool NextIsInvalid() const;
- bool NextIsBool() const;
- bool NextIsByte() const;
- bool NextIsInt16() const;
- bool NextIsUint16() const;
- bool NextIsInt32() const;
- bool NextIsUint32() const;
- bool NextIsInt64() const;
- bool NextIsUint64() const;
- bool NextIsDouble() const;
- bool NextIsString() const;
- bool NextIsArray() const;
- bool NextIsStruct() const;
- bool NextIsDictEntry() const;
-
- // Readers
- bool TakeBool();
- uint8_t TakeByte();
- int16_t TakeInt16();
- uint16_t TakeUint16();
- int32_t TakeInt32();
- uint32_t TakeUint32();
- int64_t TakeInt64();
- uint64_t TakeUint64();
- double TakeDouble();
- std::string TakeString();
-
- MessageReader TakeArrayReader();
- MessageReader TakeStructReader();
- MessageReader TakeDictEntryReader();
-
- private:
- typedef int DataType;
- // Container reader constructor
- MessageReader(MessageReader* reader, DataType container_data_type);
- void MoveToNext();
- void MarkFailed();
- DataType NextValueType() const;
- void ReadNextValue(DataType type, void* value);
-
- private:
- // Fields
- MessageReader* parent_reader_;
- bool failed_;
- DBusMessageIter iterator_;
-};
-
-class MessageWriter {
- public:
- // Methods
- // Main appending constructor
- MessageWriter(const MessageRef& message);
- // Container writer constructor
- MessageWriter(MessageWriter* parent,
- ContainerType type,
- const char* array_signature);
- ~MessageWriter();
- void PutBool(bool value);
- void PutByte(uint8_t value);
- void PutInt16(int16_t value);
- void PutUint16(uint16_t value);
- void PutInt32(int32_t value);
- void PutUint32(uint32_t value);
- void PutInt64(int64_t value);
- void PutUint64(uint64_t value);
- void PutDouble(double value);
- void PutString(const std::string& value);
-
- private:
- typedef int DataType;
- // Main constructor
- void WriteAndCheck(DataType value_type, const void* value);
- void CloseWriter();
-
- private:
- // Fields
- bool has_opened_subcontainer_;
- MessageWriter* parent_writer_;
- DBusMessageIter iterator_;
-
- // Disallow copy and assign
- MessageWriter(const MessageWriter& other);
- MessageWriter& operator=(const MessageWriter& other);
-};
-
-MessageRef MethodCall(const char* bus_name,
- const char* path,
- const char* interface,
- const char* method);
-MessageRef Signal(const char* path, const char* interface, const char* name);
-} // namespace dbus
-
-#include "dbus/dbus_message_inl.h"
-
-#endif // SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_MESSAGE_H_
diff --git a/src/components/dbus/include/dbus/dbus_message_controller.h b/src/components/dbus/include/dbus/dbus_message_controller.h
deleted file mode 100644
index a4a3718ce3..0000000000
--- a/src/components/dbus/include/dbus/dbus_message_controller.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_MESSAGE_CONTROLLER_H_
-#define SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_MESSAGE_CONTROLLER_H_
-
-#include <string>
-#include <map>
-#include "dbus/dbus_adapter.h"
-#include "smart_objects/smart_object.h"
-
-namespace dbus {
-
-class DBusMessageController : public DBusAdapter {
- public:
- /**
- * @brief constructs DBus message controller
- * @param sdlServiceName name of service SDL
- * @param sdlObjectPath path of object SDL
- * @param hmiServiceName name of service HMI
- * @param hmiObjectPath path of object HMI
- */
- DBusMessageController(const std::string& sdlServiceName,
- const std::string& sdlObjectPath,
- const std::string& hmiServiceName,
- const std::string& hmiObjectPath);
-
- /**
- * @brief destructs DBus message controller
- */
- virtual ~DBusMessageController();
-
- /**
- * @brief subscribes to the DBus signal.
- * @param interface name of interface in HMI
- * @param signal name of signal
- */
- void SubscribeTo(const std::string& interface, const std::string& signal);
-
- /**
- * @brief Method for receiving thread.
- */
- void* MethodForReceiverThread(void*);
-
- /**
- * @brief Main thread loop.
- */
- bool Run();
-
- /**
- * @brief Signal shutdown for thread loop.
- */
- void Shutdown();
-
- protected:
- /**
- * @brief sends message to core
- * @param obj
- */
- virtual void SendMessageToCore(const smart_objects::SmartObject& obj) = 0;
-
- private:
- bool shutdown_;
-};
-
-} // namespace dbus
-
-#endif // SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_MESSAGE_CONTROLLER_H_
diff --git a/src/components/dbus/include/dbus/dbus_message_inl.h b/src/components/dbus/include/dbus/dbus_message_inl.h
deleted file mode 100644
index ba9bfaa78d..0000000000
--- a/src/components/dbus/include/dbus/dbus_message_inl.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/* Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_MESSAGE_INL_H_
-#define SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_MESSAGE_INL_H_
-
-#include "dbus/dbus_message.h"
-
-namespace dbus {
-// MessageReader
-inline bool MessageReader::has_failed() const {
- return failed_;
-}
-
-inline bool MessageReader::IsAtLastElement() const {
- DBusMessageIter* iter = const_cast<DBusMessageIter*>(&iterator_);
- return dbus_message_iter_has_next(iter) == 0;
-}
-
-inline bool MessageReader::HasNext() const {
- return !failed_ && NextValueType() != DBUS_TYPE_INVALID;
-}
-
-inline bool MessageReader::NextIsInvalid() const {
- return NextValueType() == DBUS_TYPE_INVALID;
-}
-
-inline bool MessageReader::NextIsBool() const {
- return NextValueType() == DBUS_TYPE_BOOLEAN;
-}
-
-inline bool MessageReader::NextIsByte() const {
- return NextValueType() == DBUS_TYPE_BYTE;
-}
-
-inline bool MessageReader::NextIsInt16() const {
- return NextValueType() == DBUS_TYPE_INT16;
-}
-
-inline bool MessageReader::NextIsUint16() const {
- return NextValueType() == DBUS_TYPE_UINT16;
-}
-
-inline bool MessageReader::NextIsInt32() const {
- return NextValueType() == DBUS_TYPE_INT32;
-}
-
-inline bool MessageReader::NextIsUint32() const {
- return NextValueType() == DBUS_TYPE_UINT32;
-}
-
-inline bool MessageReader::NextIsInt64() const {
- return NextValueType() == DBUS_TYPE_INT64;
-}
-
-inline bool MessageReader::NextIsUint64() const {
- return NextValueType() == DBUS_TYPE_UINT64;
-}
-
-inline bool MessageReader::NextIsDouble() const {
- return NextValueType() == DBUS_TYPE_DOUBLE;
-}
-
-inline bool MessageReader::NextIsString() const {
- return NextValueType() == DBUS_TYPE_STRING;
-}
-
-inline bool MessageReader::NextIsArray() const {
- return NextValueType() == DBUS_TYPE_ARRAY;
-}
-
-inline bool MessageReader::NextIsStruct() const {
- return NextValueType() == DBUS_TYPE_STRUCT;
-}
-
-inline bool MessageReader::TakeBool() {
- dbus_bool_t value = 0;
- ReadNextValue(DBUS_TYPE_BOOLEAN, &value);
- return value != 0;
-}
-
-inline uint8_t MessageReader::TakeByte() {
- uint8_t value = 0;
- ReadNextValue(DBUS_TYPE_BYTE, &value);
- return value;
-}
-
-inline int16_t MessageReader::TakeInt16() {
- int16_t value = 0;
- ReadNextValue(DBUS_TYPE_INT16, &value);
- return value;
-}
-
-inline uint16_t MessageReader::TakeUint16() {
- uint16_t value = 0;
- ReadNextValue(DBUS_TYPE_UINT16, &value);
- return value;
-}
-
-inline int32_t MessageReader::TakeInt32() {
- int32_t value = 0;
- ReadNextValue(DBUS_TYPE_INT32, &value);
- return value;
-}
-
-inline uint32_t MessageReader::TakeUint32() {
- uint32_t value = 0;
- ReadNextValue(DBUS_TYPE_UINT32, &value);
- return value;
-}
-
-inline int64_t MessageReader::TakeInt64() {
- int64_t value = 0;
- ReadNextValue(DBUS_TYPE_INT64, &value);
- return value;
-}
-
-inline uint64_t MessageReader::TakeUint64() {
- uint64_t value = 0;
- ReadNextValue(DBUS_TYPE_UINT64, &value);
- return value;
-}
-
-inline double MessageReader::TakeDouble() {
- double value = 0.;
- ReadNextValue(DBUS_TYPE_DOUBLE, &value);
- return value;
-}
-
-inline std::string MessageReader::TakeString() {
- const char* value = "";
- ReadNextValue(DBUS_TYPE_STRING, &value);
- return value;
-}
-
-inline MessageReader::DataType MessageReader::NextValueType() const {
- DBusMessageIter* iter = const_cast<DBusMessageIter*>(&iterator_);
- return failed_ ? DBUS_TYPE_INVALID : dbus_message_iter_get_arg_type(iter);
-}
-
-// Message writer methods
-inline void MessageWriter::PutBool(bool value) {
- dbus_bool_t dbus_value = value;
- WriteAndCheck(DBUS_TYPE_BOOLEAN, &dbus_value);
-}
-
-inline void MessageWriter::PutByte(uint8_t value) {
- WriteAndCheck(DBUS_TYPE_BYTE, &value);
-}
-
-inline void MessageWriter::PutInt16(int16_t value) {
- WriteAndCheck(DBUS_TYPE_INT16, &value);
-}
-
-inline void MessageWriter::PutUint16(uint16_t value) {
- WriteAndCheck(DBUS_TYPE_UINT16, &value);
-}
-
-inline void MessageWriter::PutInt32(int32_t value) {
- WriteAndCheck(DBUS_TYPE_INT32, &value);
-}
-
-inline void MessageWriter::PutUint32(uint32_t value) {
- WriteAndCheck(DBUS_TYPE_UINT32, &value);
-}
-
-inline void MessageWriter::PutInt64(int64_t value) {
- WriteAndCheck(DBUS_TYPE_INT64, &value);
-}
-
-inline void MessageWriter::PutUint64(uint64_t value) {
- WriteAndCheck(DBUS_TYPE_UINT64, &value);
-}
-
-inline void MessageWriter::PutDouble(double value) {
- WriteAndCheck(DBUS_TYPE_DOUBLE, &value);
-}
-
-inline void MessageWriter::PutString(const std::string& value) {
- const char* pointer = value.c_str();
- WriteAndCheck(DBUS_TYPE_STRING, &pointer);
-}
-
-} // namespace dbus
-
-#endif // SRC_COMPONENTS_DBUS_INCLUDE_DBUS_DBUS_MESSAGE_INL_H_
diff --git a/src/components/dbus/include/dbus/schema.h b/src/components/dbus/include/dbus/schema.h
deleted file mode 100644
index 3dfe49cc95..0000000000
--- a/src/components/dbus/include/dbus/schema.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SRC_COMPONENTS_DBUS_INCLUDE_DBUS_SCHEMA_H_
-#define SRC_COMPONENTS_DBUS_INCLUDE_DBUS_SCHEMA_H_
-
-#include <string>
-#include <vector>
-#include <utility>
-
-#include "dbus/message_descriptions.h"
-#include "interfaces/HMI_API.h"
-
-namespace dbus {
-
-using ford_message_descriptions::ParameterDescription;
-using ford_message_descriptions::MessageDescription;
-
-struct Description;
-
-typedef hmi_apis::FunctionID::eType MessageId;
-typedef hmi_apis::messageType::eType MessageType;
-typedef std::pair<std::string, std::string> MessageName; // interface, message
-typedef std::vector<const ParameterDescription*> ListArgs;
-typedef std::vector<const Description*> Messages;
-
-/**
- * \brief Wrapper class for message description
- */
-class DBusSchema {
- public:
- explicit DBusSchema(const MessageDescription** array);
-
- /**
- * \brief gets message name by message id
- * \param id id message
- * \return name message
- */
- MessageName getMessageName(MessageId id) const;
-
- /**
- * \brief gets message id by message name
- * \param name name message
- * \return id message
- */
- MessageId getMessageId(const MessageName& name) const;
-
- /**
- * \brief gets list rules for arguments
- * \param id id message
- * \param type type message
- * \return list rules
- */
- ListArgs getListArgs(MessageId id, MessageType type) const;
-
- /**
- * \brief gets list rules for arguments
- * @param name name message
- * @param type type message
- * @return list rules
- */
- ListArgs getListArgs(const MessageName& name, MessageType type) const;
-
- private:
- Messages msgs_;
-};
-
-} // namespace dbus
-
-#endif // SRC_COMPONENTS_DBUS_INCLUDE_DBUS_SCHEMA_H_
diff --git a/src/components/dbus/src/dbus_adapter.cc b/src/components/dbus/src/dbus_adapter.cc
deleted file mode 100644
index 33d05a728b..0000000000
--- a/src/components/dbus/src/dbus_adapter.cc
+++ /dev/null
@@ -1,937 +0,0 @@
-/*
- * Copyright (c) 2013-2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "dbus/dbus_adapter.h"
-#include <dbus/dbus.h>
-#include <sstream>
-#include "formatters/CSmartFactory.h"
-#include "utils/logger.h"
-#include "smart_objects/smart_object.h"
-#include "introspection_xml.cc"
-#include "message_descriptions.cc"
-
-using ford_message_descriptions::ParameterDescription;
-namespace sos = NsSmartDeviceLink::NsJSONHandler::strings;
-
-extern char introspection_xml[];
-
-namespace dbus {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler")
-
-std::vector<std::string>& split(const std::string& s,
- char delim,
- std::vector<std::string>& elems) {
- std::stringstream ss(s);
- std::string item;
- while (std::getline(ss, item, delim)) {
- elems.push_back(item);
- }
- return elems;
-}
-
-DBusAdapter::DBusAdapter(const std::string& sdlServiceName,
- const std::string& sdlObjectPath,
- const std::string& hmiServiceName,
- const std::string& hmiObjectPath)
- : sdl_service_name_(sdlServiceName)
- , sdl_object_path_(sdlObjectPath)
- , hmi_service_name_(hmiServiceName)
- , hmi_object_path_(hmiObjectPath)
- , conn_(NULL)
- , schema_(new DBusSchema(ford_message_descriptions::message_descriptions)) {
-}
-
-DBusAdapter::~DBusAdapter() {
- dbus_shutdown();
- delete schema_;
-}
-
-bool DBusAdapter::Init() {
- DBusError err;
- int ret;
- dbus_error_init(&err);
- if (!dbus_threads_init_default()) {
- LOG4CXX_ERROR(logger_, "DBus: Can't initializes threads");
- return false;
- }
- conn_ = dbus_bus_get(DBUS_BUS_SESSION, &err);
- if (dbus_error_is_set(&err)) {
- LOG4CXX_ERROR(logger_, "DBus: Connection Error " << err.message);
- dbus_error_free(&err);
- return false;
- }
- ret = dbus_bus_request_name(
- conn_, sdl_service_name_.c_str(), DBUS_NAME_FLAG_DO_NOT_QUEUE, &err);
- if (ret == -1 || dbus_error_is_set(&err)) {
- LOG4CXX_ERROR(logger_, "DBus: Can't request name " << err.name);
- dbus_error_free(&err);
- return false;
- }
- if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
- LOG4CXX_ERROR(logger_,
- "DBus: Service '" << sdl_service_name_
- << "' is already running");
- return false;
- }
-
- LOG4CXX_INFO(logger_, "DBus: Success init dbus adaptor");
- return true;
-}
-
-bool DBusAdapter::Process(smart_objects::SmartObject& obj) {
- if (conn_ == NULL) {
- LOG4CXX_ERROR(logger_, "DBus: DBusAdaptor isn't initialized");
- return false;
- }
- DBusMessage* msg = dbus_connection_pop_message(conn_);
- if (msg != NULL) {
- switch (dbus_message_get_type(msg)) {
- case DBUS_MESSAGE_TYPE_METHOD_CALL:
- return ProcessMethodCall(msg, obj);
- case DBUS_MESSAGE_TYPE_METHOD_RETURN:
- return ProcessMethodReturn(msg, obj);
- case DBUS_MESSAGE_TYPE_ERROR:
- return ProcessError(msg, obj);
- case DBUS_MESSAGE_TYPE_SIGNAL:
- return ProcessSignal(msg, obj);
- default:
- return false;
- }
- } else {
- dbus_connection_read_write(conn_, 50);
- }
- return false;
-}
-
-void DBusAdapter::MethodReturn(uint id,
- const MessageId func_id,
- const MessageName& name,
- const smart_objects::SmartObject& obj) {
- LOG4CXX_DEBUG(logger_, "Method return " << name.first << "." << name.second);
- if (conn_ == NULL) {
- LOG4CXX_ERROR(logger_, "DBus: DBusAdaptor isn't init");
- return;
- }
-
- if (func_id == hmi_apis::FunctionID::INVALID_ENUM) {
- LOG4CXX_ERROR(logger_, "DBus: Invalid name method");
- return;
- }
-
- DBusMessage* msg = GetRequestFromHMI(id);
- if (!msg) {
- LOG4CXX_WARN(logger_, "DBus: request from HMI is not found");
- return;
- }
-
- DBusMessage* reply;
- reply = dbus_message_new_method_return(msg);
- if (NULL == reply) {
- LOG4CXX_WARN(logger_, "DBus: Failed call method (Message Null)");
- return;
- }
-
- const ListArgs& args =
- schema_->getListArgs(func_id, hmi_apis::messageType::response);
- if (!SetArguments(reply, args, obj)) {
- LOG4CXX_ERROR(logger_, "DBus: Failed call method (Signature is wrong)");
- dbus_message_unref(reply);
- dbus_message_unref(msg);
- return;
- }
-
- dbus_uint32_t serial;
- if (!dbus_connection_send(conn_, reply, &serial)) {
- LOG4CXX_ERROR(logger_, "DBus: Failed call method (Can't send message)");
- dbus_message_unref(reply);
- dbus_message_unref(msg);
- return;
- }
- dbus_connection_flush(conn_);
- dbus_message_unref(reply);
- dbus_message_unref(msg);
- LOG4CXX_INFO(logger_, "DBus: Success return method");
-}
-
-void DBusAdapter::Error(uint id,
- const std::string& name,
- const std::string& description) {
- LOG4CXX_DEBUG(logger_, "Error " << name << ": " << description);
- if (conn_ == NULL) {
- LOG4CXX_ERROR(logger_, "DBus: DBusAdaptor isn't init");
- return;
- }
-
- DBusMessage* msg = GetRequestFromHMI(id);
- if (!msg) {
- LOG4CXX_WARN(logger_, "DBus: request from HMI is not found");
- return;
- }
-
- DBusMessage* error;
- error = dbus_message_new_error(msg, name.c_str(), description.c_str());
- if (NULL == error) {
- LOG4CXX_WARN(logger_, "DBus: Failed call method (Message Null)");
- return;
- }
-
- dbus_uint32_t serial;
- if (!dbus_connection_send(conn_, error, &serial)) {
- LOG4CXX_ERROR(logger_, "DBus: Failed call method (Can't send message)");
- dbus_message_unref(error);
- dbus_message_unref(msg);
- return;
- }
- dbus_connection_flush(conn_);
- dbus_message_unref(error);
- dbus_message_unref(msg);
- LOG4CXX_INFO(logger_, "DBus: Success error");
-}
-
-void DBusAdapter::MethodCall(uint id,
- const MessageId func_id,
- const MessageName& name,
- const smart_objects::SmartObject& obj) {
- LOG4CXX_DEBUG(logger_, "Method call " << name.first << "." << name.second);
- if (conn_ == NULL) {
- LOG4CXX_ERROR(logger_, "DBus: DBusAdaptor isn't init");
- return;
- }
-
- if (func_id == hmi_apis::FunctionID::INVALID_ENUM) {
- LOG4CXX_ERROR(logger_, "DBus: Invalid name method");
- return;
- }
-
- DBusMessage* msg;
- msg = dbus_message_new_method_call(
- hmi_service_name_.c_str(),
- hmi_object_path_.c_str(),
- (hmi_service_name_ + "." + name.first).c_str(),
- name.second.c_str());
- if (NULL == msg) {
- LOG4CXX_WARN(logger_, "DBus: Failed call method (Message Null)");
- return;
- }
-
- const ListArgs& args =
- schema_->getListArgs(func_id, hmi_apis::messageType::request);
- if (!SetArguments(msg, args, obj)) {
- LOG4CXX_ERROR(logger_, "DBus: Failed call method (Signature is wrong)");
- dbus_message_unref(msg);
- return;
- }
-
- dbus_uint32_t serial;
- if (!dbus_connection_send(conn_, msg, &serial)) {
- LOG4CXX_ERROR(logger_, "DBus: Failed call method (Can't send message)");
- dbus_message_unref(msg);
- return;
- }
- SaveRequestToHMI(serial, std::make_pair(id, func_id));
- dbus_message_unref(msg);
- LOG4CXX_INFO(logger_, "DBus: Success call method");
-}
-
-void DBusAdapter::Signal(const MessageId func_id,
- const MessageName& name,
- const smart_objects::SmartObject& obj) {
- LOG4CXX_DEBUG(logger_, "Signal " << name.first << "." << name.second);
- if (conn_ == NULL) {
- LOG4CXX_ERROR(logger_, "DBus: DBusAdaptor isn't init");
- return;
- }
-
- if (func_id == hmi_apis::FunctionID::INVALID_ENUM) {
- LOG4CXX_ERROR(logger_, "DBus: Invalid name method");
- return;
- }
-
- DBusMessage* msg;
- msg = dbus_message_new_signal(sdl_object_path_.c_str(),
- (sdl_service_name_ + "." + name.first).c_str(),
- name.second.c_str());
- if (NULL == msg) {
- LOG4CXX_WARN(logger_, "DBus: Failed emit signal (Message Null)");
- return;
- }
-
- const ListArgs& args =
- schema_->getListArgs(func_id, hmi_apis::messageType::notification);
- if (!SetArguments(msg, args, obj)) {
- LOG4CXX_ERROR(logger_, "DBus: Failed call method (Signature is wrong)");
- dbus_message_unref(msg);
- return;
- }
-
- if (!dbus_connection_send(conn_, msg, NULL)) { // serial isn't required
- LOG4CXX_WARN(logger_, "DBus: Failed emit signal (Out Of Memory)");
- dbus_message_unref(msg);
- return;
- }
- dbus_message_unref(msg);
- LOG4CXX_INFO(logger_, "DBus: Success emit signal");
-}
-
-void DBusAdapter::AddMatch(const std::string& rule) {
- LOG4CXX_INFO(logger_, "Subscription: " << rule);
- dbus_bus_add_match(conn_, rule.c_str(), NULL);
-}
-
-bool DBusAdapter::ProcessMethodCall(DBusMessage* msg,
- smart_objects::SmartObject& obj) {
- std::string method = dbus_message_get_member(msg);
- std::string interface = dbus_message_get_interface(msg);
- LOG4CXX_INFO(logger_, "DBus: name of method " << interface << " " << method);
-
- if (interface == "org.freedesktop.DBus.Introspectable" &&
- method == "Introspect") {
- LOG4CXX_INFO(logger_, "DBus: INTROSPECT");
- Introspect(msg);
- return false;
- }
-
- std::vector<std::string> elems;
- split(interface, '.', elems);
- MessageName name(elems.back(), method);
- MessageId m_id = schema_->getMessageId(name);
- if (m_id == hmi_apis::FunctionID::INVALID_ENUM) {
- LOG4CXX_ERROR(logger_, "DBus: Invalid name method call from hmi");
- return false;
- }
-
- uint32_t serial = dbus_message_get_serial(msg);
- if (!serial) {
- LOG4CXX_ERROR(logger_, "DBus: Serial of request from HMI isn't defined");
- return false;
- }
-
- obj[sos::S_PARAMS][sos::S_CORRELATION_ID] = serial;
- obj[sos::S_PARAMS][sos::S_FUNCTION_ID] = m_id;
- obj[sos::S_PARAMS][sos::S_MESSAGE_TYPE] = hmi_apis::messageType::request;
- obj[sos::S_MSG_PARAMS] =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- const ListArgs args =
- schema_->getListArgs(name, hmi_apis::messageType::request);
-
- DBusMessageIter iter;
- dbus_message_iter_init(msg, &iter);
- if (GetArguments(&iter, args, obj[sos::S_MSG_PARAMS])) {
- SaveRequestFromHMI(serial, msg);
- return true;
- }
- return false;
-}
-
-bool DBusAdapter::ProcessMethodReturn(DBusMessage* msg,
- smart_objects::SmartObject& obj) {
- LOG4CXX_AUTO_TRACE(logger_);
- dbus_uint32_t reply_serial = dbus_message_get_reply_serial(msg);
- std::pair<uint, MessageId> ids = GetRequestToHMI(reply_serial);
- if (ids.second == hmi_apis::FunctionID::INVALID_ENUM) {
- LOG4CXX_ERROR(logger_, "DBus: Invalid name method");
- return false;
- }
-
- obj[sos::S_MSG_PARAMS] =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- ListArgs args =
- schema_->getListArgs(ids.second, hmi_apis::messageType::response);
- DBusMessageIter iter;
- dbus_message_iter_init(msg, &iter);
- int code = 0;
- std::string message;
- smart_objects::SmartObject description(smart_objects::SmartType_Map);
- bool ret = GetHeader(&iter, &code, &message) &&
- GetArguments(&iter, args, description);
-
- if (ret) {
- obj[sos::S_PARAMS][sos::S_CORRELATION_ID] = ids.first;
- obj[sos::S_PARAMS][sos::S_FUNCTION_ID] = ids.second;
- obj[sos::S_PARAMS][sos::S_MESSAGE_TYPE] = hmi_apis::messageType::response;
- obj[sos::S_PARAMS][sos::kCode] = code;
- obj[sos::S_PARAMS][sos::kMessage] = message;
- if (code != hmi_apis::Common_Result::SUCCESS) {
- MessageName name = schema_->getMessageName(ids.second);
- description["method"] = name.first + "." + name.second;
- obj[sos::S_PARAMS]["data"] = description;
- } else {
- obj[sos::S_MSG_PARAMS] = description;
- }
- }
-
- dbus_message_unref(msg);
- return ret;
-}
-
-bool DBusAdapter::ProcessError(DBusMessage* msg,
- smart_objects::SmartObject& obj) {
- dbus_uint32_t reply_serial = dbus_message_get_reply_serial(msg);
- std::pair<uint, MessageId> ids = GetRequestToHMI(reply_serial);
- if (ids.second == hmi_apis::FunctionID::INVALID_ENUM) {
- LOG4CXX_ERROR(logger_, "DBus: Invalid name method");
- return false;
- }
-
- const char* error_name;
- bool ret = false;
- if ((error_name = dbus_message_get_error_name(msg)) != NULL) {
- smart_objects::SmartObject name(smart_objects::SmartType_String);
- name = error_name;
- ford_message_descriptions::ParameterDescription rule = {
- "description", ford_message_descriptions::String, true};
- ListArgs args;
- args.push_back(&rule);
- smart_objects::SmartObject description(smart_objects::SmartType_Map);
- description[rule.name] =
- smart_objects::SmartObject(smart_objects::SmartType_String);
-
- DBusMessageIter iter;
- dbus_message_iter_init(msg, &iter);
- ret = GetArguments(&iter, args, description);
- MessageName method = schema_->getMessageName(ids.second);
-
- obj[sos::S_PARAMS][sos::S_CORRELATION_ID] = ids.first;
- obj[sos::S_PARAMS][sos::S_FUNCTION_ID] = ids.second;
- obj[sos::S_PARAMS][sos::S_MESSAGE_TYPE] =
- hmi_apis::messageType::error_response;
- obj[sos::S_PARAMS][sos::kCode] = name.asInt();
- obj[sos::S_PARAMS][sos::kMessage] = description[rule.name].asString();
- obj[sos::S_MSG_PARAMS] =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- obj[sos::S_PARAMS]["data"]["method"] = method.first + "." + method.second;
-
- LOG4CXX_WARN(logger_,
- "DBus: Call of method " << method.first << "." << method.second
- << " returned error " << name.asInt()
- << ": "
- << description[rule.name].asString());
- } else {
- LOG4CXX_ERROR(logger_, "DBus: Type message isn't error");
- }
-
- dbus_message_unref(msg);
- return ret;
-}
-
-bool DBusAdapter::ProcessSignal(DBusMessage* msg,
- smart_objects::SmartObject& obj) {
- std::string method = dbus_message_get_member(msg);
- std::string interface = dbus_message_get_interface(msg);
- LOG4CXX_INFO(logger_, "DBus: name of signal " << method);
-
- std::vector<std::string> elems;
- split(interface, '.', elems);
- MessageName name(elems.back(), method);
- MessageId m_id = schema_->getMessageId(name);
- if (m_id == hmi_apis::FunctionID::INVALID_ENUM) {
- LOG4CXX_ERROR(logger_, "DBus: Invalid name signal");
- return false;
- }
-
- obj[sos::S_PARAMS][sos::S_FUNCTION_ID] = m_id;
- obj[sos::S_PARAMS][sos::S_MESSAGE_TYPE] = hmi_apis::messageType::notification;
- obj[sos::S_MSG_PARAMS] =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- const ListArgs args =
- schema_->getListArgs(name, hmi_apis::messageType::notification);
-
- DBusMessageIter iter;
- dbus_message_iter_init(msg, &iter);
- bool ret = GetArguments(&iter, args, obj[sos::S_MSG_PARAMS]);
- dbus_message_unref(msg);
- return ret;
-}
-
-bool DBusAdapter::SetArguments(DBusMessage* msg,
- const ListArgs& rules,
- const smart_objects::SmartObject& args) {
- DBusMessageIter iter;
- dbus_message_iter_init_append(msg, &iter);
- size_t size = rules.size();
- for (size_t i = 0; i < size; ++i) {
- const smart_objects::SmartObject& param = args.getElement(rules[i]->name);
- if (!SetOneArgument(&iter, rules[i], param)) {
- return false;
- }
- }
- return true;
-}
-
-bool DBusAdapter::SetOneArgument(DBusMessageIter* iter,
- const ParameterDescription* rules,
- const smart_objects::SmartObject& param) {
- if (rules->obligatory) {
- if (param.isValid()) {
- return SetValue(iter, rules, param);
- } else {
- LOG4CXX_WARN(logger_,
- "DBus: Argument '" << rules->name << "' is obligatory!");
- return false;
- }
- } else {
- return SetOptionalValue(iter, rules, param);
- }
-}
-
-bool DBusAdapter::SetValue(
- DBusMessageIter* iter,
- const ford_message_descriptions::ParameterDescription* rules,
- const smart_objects::SmartObject& param) {
- // LOG4CXX_DEBUG(logger_, "DBus: Set param " << rules->name << " = " <<
- // param.asString());
- int type = 0;
- void* value = 0;
- dbus_int32_t integerValue = 0;
- double floatValue = 0;
- dbus_bool_t booleanValue = false;
- std::string stringValue;
- const char* cStringValue;
- switch (rules->type) {
- case ford_message_descriptions::ParameterType::Array:
- return SetArrayValue(
- iter,
- reinterpret_cast<const ford_message_descriptions::ArrayDescription*>(
- rules),
- param);
- break;
- case ford_message_descriptions::ParameterType::Struct:
- return SetStructValue(
- iter,
- reinterpret_cast<const ford_message_descriptions::StructDescription*>(
- rules),
- param);
- break;
- case ford_message_descriptions::ParameterType::Enum:
- case ford_message_descriptions::ParameterType::Integer:
- type = DBUS_TYPE_INT32;
- integerValue = param.asInt();
- value = &integerValue;
- break;
- case ford_message_descriptions::ParameterType::Float:
- type = DBUS_TYPE_DOUBLE;
- floatValue = param.asDouble();
- value = &floatValue;
- break;
- case ford_message_descriptions::ParameterType::Boolean:
- type = DBUS_TYPE_BOOLEAN;
- booleanValue = param.asBool();
- value = &booleanValue;
- break;
- case ford_message_descriptions::ParameterType::String:
- type = DBUS_TYPE_STRING;
- stringValue = param.asString();
- cStringValue = stringValue.c_str();
- value = &cStringValue;
- break;
- default:
- LOG4CXX_ERROR(logger_, "DBus: Unknown type of argument");
- return false;
- }
- return dbus_message_iter_append_basic(iter, type, value);
-}
-
-bool DBusAdapter::SetOptionalValue(
- DBusMessageIter* iter,
- const ford_message_descriptions::ParameterDescription* rules,
- const smart_objects::SmartObject& param) {
- DBusMessageIter sub_iter;
- if (!dbus_message_iter_open_container(
- iter, DBUS_TYPE_STRUCT, NULL, &sub_iter)) {
- LOG4CXX_ERROR(
- logger_,
- "DBus: Can't open container type (STRUCT) for optional parameter");
- return false;
- }
-
- ford_message_descriptions::ParameterDescription flagRules = {
- "flag", ford_message_descriptions::Boolean, true};
- smart_objects::SmartObject flag(param.getType() !=
- smart_objects::SmartType_Invalid);
- if (!SetValue(&sub_iter, &flagRules, flag) ||
- !SetValue(&sub_iter, rules, param)) {
- return false;
- }
-
- if (!dbus_message_iter_close_container(iter, &sub_iter)) {
- LOG4CXX_ERROR(
- logger_,
- "DBus: Can't close container type (STRUCT) for optional parameter");
- return false;
- }
- return true;
-}
-
-bool DBusAdapter::SetArrayValue(
- DBusMessageIter* iter,
- const ford_message_descriptions::ArrayDescription* rules,
- const smart_objects::SmartObject& param) {
- smart_objects::SmartType type = param.getType();
- if (type != smart_objects::SmartType_Array &&
- type != smart_objects::SmartType_Invalid) {
- LOG4CXX_ERROR(logger_, "DBus: SmartObject is not a map");
- return false;
- }
- DBusMessageIter sub_iter;
- if (!dbus_message_iter_open_container(
- iter, DBUS_TYPE_ARRAY, rules->element_dbus_signature, &sub_iter)) {
- LOG4CXX_ERROR(logger_, "DBus: Can't open container type (ARRAY)");
- return false;
- }
- size_t size = param.length();
- for (size_t i = 0; i < size; ++i) {
- if (!SetValue(&sub_iter, rules->element, param[i])) {
- return false;
- }
- }
- if (!dbus_message_iter_close_container(iter, &sub_iter)) {
- LOG4CXX_ERROR(logger_, "DBus: Can't close container type (ARRAY)");
- return false;
- }
- return true;
-}
-
-bool DBusAdapter::SetStructValue(
- DBusMessageIter* iter,
- const ford_message_descriptions::StructDescription* rules,
- const smart_objects::SmartObject& structure) {
- smart_objects::SmartType type = structure.getType();
- if (type != smart_objects::SmartType_Map &&
- type != smart_objects::SmartType_Invalid) {
- LOG4CXX_ERROR(logger_, "DBus: SmartObject is not a map");
- return false;
- }
- DBusMessageIter sub_iter;
- if (!dbus_message_iter_open_container(
- iter, DBUS_TYPE_STRUCT, NULL, &sub_iter)) {
- LOG4CXX_ERROR(logger_, "DBus: Can't open container type (STRUCT)");
- return false;
- }
- const ParameterDescription** entry;
- entry = rules->parameters;
- while (*entry != NULL) {
- const smart_objects::SmartObject& param =
- structure.getElement((*entry)->name);
- if (!SetOneArgument(&sub_iter, *entry, param)) {
- return false;
- }
- entry++;
- }
- if (!dbus_message_iter_close_container(iter, &sub_iter)) {
- LOG4CXX_ERROR(logger_, "DBus: Can't close container type (STRUCT)");
- return false;
- }
- return true;
-}
-
-bool DBusAdapter::GetHeader(DBusMessageIter* iter,
- int* code,
- std::string* message) {
- // Get code of response
- dbus_int32_t intValue;
- int type = dbus_message_iter_get_arg_type(iter);
- if (type != DBUS_TYPE_INT32) {
- LOG4CXX_ERROR(logger_, "DBus: Unknown format of header");
- return false;
- }
- dbus_message_iter_get_basic(iter, &intValue);
- *code = intValue;
- LOG4CXX_DEBUG(logger_, "DBus: Code of response " << *code);
-
- dbus_message_iter_next(iter);
-
- // Get message of response
- type = dbus_message_iter_get_arg_type(iter);
- if (type != DBUS_TYPE_STRING) {
- LOG4CXX_ERROR(logger_, "DBus: Unknown format of header");
- return false;
- }
- const char* stringValue;
- dbus_message_iter_get_basic(iter, &stringValue);
- *message = stringValue;
- LOG4CXX_DEBUG(logger_, "DBus: message of response " << *message);
-
- dbus_message_iter_next(iter);
- return true;
-}
-
-bool DBusAdapter::GetArguments(DBusMessageIter* iter,
- const ListArgs& rules,
- smart_objects::SmartObject& args) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- size_t size = rules.size();
- for (size_t i = 0; i < size; ++i) {
- if (!GetOneArgument(iter, rules[i], args)) {
- return false;
- }
- dbus_message_iter_next(iter);
- }
- return true;
-}
-
-const DBusSchema& DBusAdapter::get_schema() const {
- return *schema_;
-}
-
-bool DBusAdapter::GetOneArgument(
- DBusMessageIter* iter,
- const ford_message_descriptions::ParameterDescription* rules,
- smart_objects::SmartObject& args) {
- if (rules->obligatory) {
- return GetValue(iter, rules, args[rules->name]);
- } else {
- return GetOptionalValue(iter, rules, args);
- }
-}
-
-bool DBusAdapter::GetValue(
- DBusMessageIter* iter,
- const ford_message_descriptions::ParameterDescription* rules,
- smart_objects::SmartObject& param) {
- LOG4CXX_DEBUG(logger_, "DBus: Get param " << rules->name);
- int type = dbus_message_iter_get_arg_type(iter);
- switch (rules->type) {
- case ford_message_descriptions::ParameterType::Array:
- if (type == DBUS_TYPE_ARRAY) {
- return GetArrayValue(
- iter,
- // FIXME (dchmerev@luxoft.com): not portable, danger cast.
- reinterpret_cast<
- const ford_message_descriptions::ArrayDescription*>(rules),
- param);
- } else {
- LOG4CXX_ERROR(logger_, "DBus: Not expected type of argument");
- return false;
- }
- break;
- case ford_message_descriptions::ParameterType::Struct:
- if (type == DBUS_TYPE_STRUCT) {
- return GetStructValue(
- iter,
- reinterpret_cast<
- const ford_message_descriptions::StructDescription*>(rules),
- param);
- } else {
- LOG4CXX_ERROR(logger_, "DBus: Not expected type of argument");
- return false;
- }
- break;
- case ford_message_descriptions::ParameterType::Enum:
- case ford_message_descriptions::ParameterType::Integer:
- if (type == DBUS_TYPE_INT32) {
- dbus_int32_t integerValue;
- dbus_message_iter_get_basic(iter, &integerValue);
- smart_objects::SmartObject value(integerValue);
- param = value;
- LOG4CXX_DEBUG(logger_,
- "DBus: " << rules->name << " = " << integerValue);
- } else {
- LOG4CXX_ERROR(logger_, "DBus: Not expected type of argument");
- return false;
- }
- break;
- case ford_message_descriptions::ParameterType::Float:
- if (type == DBUS_TYPE_DOUBLE) {
- double floatValue;
- dbus_message_iter_get_basic(iter, &floatValue);
- smart_objects::SmartObject value(floatValue);
- param = value;
- LOG4CXX_DEBUG(logger_, "DBus: " << rules->name << " = " << floatValue);
- } else {
- LOG4CXX_ERROR(logger_, "DBus: Not expected type of argument");
- return false;
- }
- break;
- case ford_message_descriptions::ParameterType::Boolean:
- if (type == DBUS_TYPE_BOOLEAN) {
- dbus_bool_t booleanValue;
- dbus_message_iter_get_basic(iter, &booleanValue);
- smart_objects::SmartObject value(static_cast<bool>(booleanValue));
- param = value;
- LOG4CXX_DEBUG(logger_,
- "DBus: " << rules->name << " = " << std::boolalpha
- << booleanValue);
- } else {
- LOG4CXX_ERROR(logger_, "DBus: Not expected type of argument");
- return false;
- }
- break;
- case ford_message_descriptions::ParameterType::String:
- if (type == DBUS_TYPE_STRING) {
- const char* stringValue;
- dbus_message_iter_get_basic(iter, &stringValue);
- std::string strValue = stringValue;
- smart_objects::SmartObject value(strValue);
- param = value;
- LOG4CXX_DEBUG(logger_,
- "DBus: " << rules->name << " = \"" << strValue << "\"");
- } else {
- LOG4CXX_ERROR(logger_, "DBus: Not expected type of argument");
- return false;
- }
- break;
- default:
- LOG4CXX_ERROR(logger_, "DBus: Unknown type of argument");
- return false;
- }
- return true;
-}
-
-bool DBusAdapter::GetArrayValue(
- DBusMessageIter* iter,
- const ford_message_descriptions::ArrayDescription* rules,
- smart_objects::SmartObject& param) {
- smart_objects::SmartObject array(smart_objects::SmartType_Array);
-
- int i = 0;
- DBusMessageIter sub_iter;
- dbus_message_iter_recurse(iter, &sub_iter);
- while (dbus_message_iter_get_arg_type(&sub_iter) != DBUS_TYPE_INVALID) {
- if (!GetValue(&sub_iter, rules->element, array[i])) {
- return false;
- }
- dbus_message_iter_next(&sub_iter);
- i++;
- }
- param = array;
- return true;
-}
-
-bool DBusAdapter::GetStructValue(
- DBusMessageIter* iter,
- const ford_message_descriptions::StructDescription* rules,
- smart_objects::SmartObject& param) {
- DBusMessageIter sub_iter;
- dbus_message_iter_recurse(iter, &sub_iter);
- const ParameterDescription** entry;
- entry = rules->parameters;
- smart_objects::SmartObject structure(smart_objects::SmartType_Map);
- while (*entry != NULL) {
- if (!GetOneArgument(&sub_iter, *entry, structure)) {
- return false;
- }
- dbus_message_iter_next(&sub_iter);
- entry++;
- }
- param = structure;
- return true;
-}
-
-bool DBusAdapter::GetOptionalValue(
- DBusMessageIter* iter,
- const ford_message_descriptions::ParameterDescription* rules,
- smart_objects::SmartObject& param) {
- int type = dbus_message_iter_get_arg_type(iter);
- if (type != DBUS_TYPE_STRUCT) {
- LOG4CXX_WARN(
- logger_,
- "DBus: Not expected type of argument. It is not optional parameter.");
- return false;
- }
-
- DBusMessageIter sub_iter;
- dbus_message_iter_recurse(iter, &sub_iter);
- ford_message_descriptions::ParameterDescription flagRules = {
- "flag", ford_message_descriptions::Boolean, true};
- smart_objects::SmartObject flag;
- if (!GetValue(&sub_iter, &flagRules, flag)) {
- return false;
- }
- if (flag.asBool()) {
- dbus_message_iter_next(&sub_iter);
- return GetValue(&sub_iter, rules, param[rules->name]);
- } else {
- return true;
- }
-}
-
-std::pair<uint, MessageId> DBusAdapter::GetRequestToHMI(uint32_t serial) {
- std::map<uint32_t, std::pair<uint, MessageId> >::iterator it;
- it = requests_to_hmi_.find(serial);
- if (it != requests_to_hmi_.end()) {
- std::pair<uint, MessageId> ids = it->second;
- requests_to_hmi_.erase(it);
- return ids;
- }
- return std::make_pair(0, hmi_apis::FunctionID::INVALID_ENUM);
-}
-
-void DBusAdapter::SaveRequestToHMI(uint32_t serial,
- const std::pair<uint, MessageId>& ids) {
- requests_to_hmi_.insert(std::make_pair(serial, ids));
-}
-
-void DBusAdapter::Introspect(DBusMessage* msg) {
- DBusMessage* reply;
-
- dbus_uint32_t serial = dbus_message_get_serial(msg);
- reply = dbus_message_new_method_return(msg);
- if (!reply) {
- LOG4CXX_WARN(logger_, "DBus: Failed return method for introspection");
- return;
- }
-
- DBusMessageIter iter;
- dbus_message_iter_init_append(reply, &iter);
- char* value = introspection_xml;
- dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &value);
- dbus_connection_send(conn_, reply, &serial);
- dbus_connection_flush(conn_);
- dbus_message_unref(reply);
- dbus_message_unref(msg);
-}
-
-void DBusAdapter::SaveRequestFromHMI(uint32_t serial, DBusMessage* request) {
- LOG4CXX_DEBUG(logger_, "Save correlation id (serial id) : " << serial);
- LOG4CXX_DEBUG(logger_, "D-Bus message: " << request);
- requests_from_hmi_.insert(std::make_pair(serial, request));
-}
-
-DBusMessage* DBusAdapter::GetRequestFromHMI(uint32_t serial) {
- LOG4CXX_DEBUG(logger_, "Get correlation id (serial id) : " << serial);
- std::map<uint32_t, DBusMessage*>::iterator it;
- it = requests_from_hmi_.find(serial);
- if (it != requests_from_hmi_.end()) {
- DBusMessage* msg = it->second;
- requests_from_hmi_.erase(it);
- LOG4CXX_DEBUG(logger_, "D-Bus message: " << msg);
- return msg;
- }
- return 0;
-}
-
-} // namespace dbus
diff --git a/src/components/dbus/src/dbus_message.cc b/src/components/dbus/src/dbus_message.cc
deleted file mode 100644
index b8a55896ce..0000000000
--- a/src/components/dbus/src/dbus_message.cc
+++ /dev/null
@@ -1,217 +0,0 @@
-/* Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "dbus/dbus_message.h"
-
-#include <algorithm>
-#include <cassert>
-
-#include <dbus/dbus.h>
-
-namespace dbus {
-
-MessageRefKeeper::MessageRefKeeper() : raw_message_(NULL) {}
-
-MessageRefKeeper::MessageRefKeeper(DBusMessage* message)
- : raw_message_(message) {
- assert(raw_message_);
- dbus_message_ref(raw_message_);
-}
-
-MessageRefKeeper::~MessageRefKeeper() {
- if (raw_message_) {
- dbus_message_unref(raw_message_);
- }
-}
-
-MessageRefKeeper::MessageRefKeeper(const MessageRefKeeper& other)
- : raw_message_(other.raw_message_) {
- assert(raw_message_);
- dbus_message_ref(raw_message_);
-}
-
-MessageRefKeeper& MessageRefKeeper::operator=(MessageRefKeeper other) {
- other.swap(*this);
- return *this;
-}
-
-DBusMessage* MessageRefKeeper::get() const {
- return raw_message_;
-}
-
-DBusMessage* MessageRefKeeper::Pass() {
- DBusMessage* message = raw_message_;
- raw_message_ = NULL;
- return message;
-}
-
-void MessageRefKeeper::swap(MessageRefKeeper& other) {
- std::swap(raw_message_, other.raw_message_);
-}
-
-MessageRef::MessageRef(DBusMessage* message) : raw_message_ref_(message) {}
-
-MessageRef::~MessageRef() {}
-
-std::string MessageRef::GetInterface() const {
- return dbus_message_get_interface(raw_message_ref_.get());
-}
-
-std::string MessageRef::GetMember() const {
- return dbus_message_get_member(raw_message_ref_.get());
-}
-
-// Message writer
-MessageReader::MessageReader(const MessageRef& message)
- : parent_reader_(NULL), failed_(false) {
- dbus_bool_t success =
- dbus_message_iter_init(message.raw_message_ref_.get(), &iterator_);
- if (!success) {
- MarkFailed();
- }
-}
-
-MessageReader::MessageReader(MessageReader* reader,
- DataType container_data_type)
- : parent_reader_(reader), failed_(reader->has_failed()) {
- assert(parent_reader_);
- if (!failed_) {
- if (reader->NextValueType() != container_data_type) {
- MarkFailed();
- } else {
- dbus_message_iter_recurse(&reader->iterator_, &iterator_);
- reader->MoveToNext();
- }
- }
-}
-
-bool MessageReader::NextIsDictEntry() const {
- return NextValueType() == DBUS_TYPE_DICT_ENTRY;
-}
-
-MessageReader MessageReader::TakeArrayReader() {
- return MessageReader(this, DBUS_TYPE_ARRAY);
-}
-
-MessageReader MessageReader::TakeStructReader() {
- return MessageReader(this, DBUS_TYPE_STRUCT);
-}
-
-MessageReader MessageReader::TakeDictEntryReader() {
- return MessageReader(this, DBUS_TYPE_DICT_ENTRY);
-}
-
-void MessageReader::MoveToNext() {
- if (!HasNext()) {
- MarkFailed();
- }
- dbus_message_iter_next(&iterator_);
-}
-
-void MessageReader::MarkFailed() {
- if (!failed_) {
- failed_ = true;
- if (parent_reader_) {
- parent_reader_->MarkFailed();
- }
- }
-}
-
-void MessageReader::ReadNextValue(MessageReader::DataType type, void* value) {
- assert(value);
- if (NextValueType() != type) {
- MarkFailed();
- } else if (!failed_) {
- dbus_message_iter_get_basic(&iterator_, value);
- MoveToNext();
- }
-}
-
-// DbusMessageWriter
-MessageWriter::MessageWriter(const MessageRef& message)
- : has_opened_subcontainer_(false), parent_writer_(NULL) {
- dbus_message_iter_init_append(message.raw_message_ref_.get(), &iterator_);
-}
-
-MessageWriter::MessageWriter(MessageWriter* parent,
- ContainerType container_type,
- const char* array_signature)
- : has_opened_subcontainer_(false), parent_writer_(parent) {
- assert(parent_writer_);
- // Only array writers require array_signature
- assert((container_type == kArray && array_signature != NULL) ||
- (container_type != kArray && array_signature == NULL));
- assert(!parent_writer_->has_opened_subcontainer_);
- bool enough_memory = dbus_message_iter_open_container(
- &parent_writer_->iterator_, container_type, array_signature, &iterator_);
- assert(enough_memory);
- parent_writer_->has_opened_subcontainer_ = true;
-}
-
-MessageWriter::~MessageWriter() {
- assert(!has_opened_subcontainer_);
- if (parent_writer_ != NULL) {
- CloseWriter();
- }
-}
-
-void MessageWriter::WriteAndCheck(MessageWriter::DataType value_type,
- const void* value) {
- assert(!has_opened_subcontainer_);
- dbus_bool_t enough_memory =
- dbus_message_iter_append_basic(&iterator_, value_type, value);
- assert(enough_memory);
-}
-
-void MessageWriter::CloseWriter() {
- assert(parent_writer_);
- assert(parent_writer_->has_opened_subcontainer_);
- dbus_bool_t enough_memory =
- dbus_message_iter_close_container(&parent_writer_->iterator_, &iterator_);
- assert(enough_memory);
- parent_writer_->has_opened_subcontainer_ = false;
-}
-
-// Construction functions
-
-MessageRef MethodCall(const char* bus_name,
- const char* path,
- const char* interface,
- const char* method) {
- return MessageRef(
- dbus_message_new_method_call(bus_name, path, interface, method));
-}
-
-MessageRef Signal(const char* path, const char* interface, const char* name) {
- return MessageRef(dbus_message_new_signal(path, interface, name));
-}
-
-} // namespace dbus
diff --git a/src/components/dbus/src/dbus_message_controller.cc b/src/components/dbus/src/dbus_message_controller.cc
deleted file mode 100644
index 59f08d6695..0000000000
--- a/src/components/dbus/src/dbus_message_controller.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "dbus/dbus_message_controller.h"
-#include "formatters/CSmartFactory.h"
-
-namespace sos = NsSmartDeviceLink::NsJSONHandler::strings;
-
-namespace dbus {
-
-DBusMessageController::DBusMessageController(const std::string& sdlServiceName,
- const std::string& sdlObjectPath,
- const std::string& hmiServiceName,
- const std::string& hmiObjectPath)
- : DBusAdapter(sdlServiceName, sdlObjectPath, hmiServiceName, hmiObjectPath)
- , shutdown_(false) {}
-
-void DBusMessageController::SubscribeTo(const std::string& interface,
- const std::string& signal) {
- std::string rule = "type='signal'";
- rule.append(", sender='")
- .append(hmi_service_name_)
- .append("'")
- .append(", path='")
- .append(hmi_object_path_)
- .append("'")
- .append(", interface='")
- .append(hmi_service_name_)
- .append(".")
- .append(interface)
- .append("'")
- .append(", member='")
- .append(signal)
- .append("'");
- DBusAdapter::AddMatch(rule);
-}
-
-DBusMessageController::~DBusMessageController() {}
-
-void* DBusMessageController::MethodForReceiverThread(void*) {
- Run();
- return NULL;
-}
-
-bool DBusMessageController::Run() {
- while (!shutdown_) {
- smart_objects::SmartObject obj(smart_objects::SmartType_Map);
- obj[sos::S_PARAMS][sos::S_PROTOCOL_VERSION] = 2;
- obj[sos::S_PARAMS][sos::S_PROTOCOL_TYPE] = 1;
- if (DBusAdapter::Process(obj)) {
- SendMessageToCore(obj);
- }
- }
- return true;
-}
-
-void DBusMessageController::Shutdown() {
- shutdown_ = true;
-}
-
-} // namespace dbus
diff --git a/src/components/dbus/src/introspection_xml.cc b/src/components/dbus/src/introspection_xml.cc
deleted file mode 100644
index 210c232a4d..0000000000
--- a/src/components/dbus/src/introspection_xml.cc
+++ /dev/null
@@ -1,327 +0,0 @@
-// Warning! This file is generated by 'make_introspection_c.py'. Edit at your
-// own risk.
-/**
- * @file instrospections_xml.cc
- * @brief D-Bus introspection XML as C-string
- *
- * This file is a part of HMI D-Bus layer.
- */
-// Copyright (c) 2013, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-char introspection_xml[] = {
- 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, 0x6e, 0x6f,
- 0x64, 0x65, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x22, 0x2d,
- 0x2f, 0x2f, 0x66, 0x72, 0x65, 0x65, 0x64, 0x65, 0x73, 0x6b, 0x74, 0x6f,
- 0x70, 0x2f, 0x2f, 0x44, 0x54, 0x44, 0x20, 0x44, 0x2d, 0x42, 0x55, 0x53,
- 0x20, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x49, 0x6e, 0x74, 0x72,
- 0x6f, 0x73, 0x70, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x2e,
- 0x30, 0x2f, 0x2f, 0x45, 0x4e, 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70,
- 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x66, 0x72, 0x65, 0x65, 0x64,
- 0x65, 0x73, 0x6b, 0x74, 0x6f, 0x70, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x73,
- 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x73, 0x2f, 0x64, 0x62, 0x75,
- 0x73, 0x2f, 0x31, 0x2e, 0x30, 0x2f, 0x69, 0x6e, 0x74, 0x72, 0x6f, 0x73,
- 0x70, 0x65, 0x63, 0x74, 0x2e, 0x64, 0x74, 0x64, 0x22, 0x3e, 0x0a, 0x3c,
- 0x6e, 0x6f, 0x64, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x2f,
- 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6f, 0x72, 0x64, 0x2f, 0x68, 0x6d, 0x69,
- 0x22, 0x3e, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x66,
- 0x6f, 0x72, 0x64, 0x2e, 0x68, 0x6d, 0x69, 0x2e, 0x73, 0x64, 0x6c, 0x2e,
- 0x42, 0x61, 0x73, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69,
- 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3e, 0x3c, 0x73, 0x69, 0x67,
- 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e,
- 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x53,
- 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70, 0x49, 0x44, 0x22,
- 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e,
- 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69,
- 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f,
- 0x6e, 0x53, 0x44, 0x4c, 0x50, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65,
- 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x46, 0x69, 0x6c, 0x65, 0x52,
- 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x4e,
- 0x61, 0x6d, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x73,
- 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d,
- 0x65, 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22,
- 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e,
- 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61,
- 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61,
- 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x41, 0x70, 0x70, 0x52, 0x65, 0x67,
- 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x22, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70, 0x6c,
- 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x20, 0x74, 0x79, 0x70,
- 0x65, 0x3d, 0x22, 0x28, 0x73, 0x28, 0x62, 0x73, 0x29, 0x28, 0x62, 0x73,
- 0x29, 0x28, 0x73, 0x73, 0x28, 0x62, 0x69, 0x29, 0x28, 0x62, 0x62, 0x29,
- 0x29, 0x73, 0x28, 0x62, 0x61, 0x28, 0x73, 0x69, 0x29, 0x29, 0x28, 0x62,
- 0x61, 0x73, 0x29, 0x69, 0x69, 0x62, 0x28, 0x62, 0x61, 0x69, 0x29, 0x28,
- 0x62, 0x62, 0x29, 0x28, 0x62, 0x61, 0x69, 0x29, 0x29, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x74, 0x74, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70,
- 0x65, 0x3d, 0x22, 0x28, 0x62, 0x61, 0x28, 0x73, 0x69, 0x29, 0x29, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x76, 0x72, 0x53, 0x79, 0x6e, 0x6f, 0x6e, 0x79, 0x6d, 0x73,
- 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x61, 0x73,
- 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x56, 0x72,
- 0x47, 0x72, 0x61, 0x6d, 0x6d, 0x61, 0x72, 0x73, 0x22, 0x20, 0x74, 0x79,
- 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x62, 0x29, 0x22, 0x20, 0x2f, 0x3e,
- 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x70,
- 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x20, 0x74, 0x79, 0x70,
- 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c,
- 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67,
- 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e,
- 0x41, 0x70, 0x70, 0x55, 0x6e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65,
- 0x72, 0x65, 0x64, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x75, 0x6e, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74,
- 0x65, 0x64, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74,
- 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x61, 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d,
- 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e,
- 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x6f, 0x6e,
- 0x65, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x61, 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70,
- 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x6d, 0x65, 0x74, 0x68, 0x6f,
- 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d,
- 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e,
- 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x53, 0x44, 0x4c, 0x43, 0x6c,
- 0x6f, 0x73, 0x65, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e,
- 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x50,
- 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x6f, 0x66, 0x66, 0x73, 0x65,
- 0x74, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69,
- 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x20,
- 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22, 0x20,
- 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
- 0x22, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x20, 0x74,
- 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x74, 0x79,
- 0x70, 0x65, 0x3d, 0x22, 0x73, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x73, 0x79, 0x6e, 0x63,
- 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x20, 0x74, 0x79,
- 0x70, 0x65, 0x3d, 0x22, 0x73, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x66, 0x69, 0x6c, 0x65,
- 0x54, 0x79, 0x70, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65,
- 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x28, 0x62, 0x62, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f,
- 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x3e, 0x3c, 0x2f, 0x69, 0x6e, 0x74,
- 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x3e, 0x3c, 0x69, 0x6e, 0x74, 0x65,
- 0x72, 0x66, 0x61, 0x63, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x6f, 0x72, 0x64, 0x2e, 0x68, 0x6d, 0x69,
- 0x2e, 0x73, 0x64, 0x6c, 0x2e, 0x55, 0x49, 0x22, 0x3e, 0x3c, 0x73, 0x69,
- 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f,
- 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x61, 0x72, 0x74,
- 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
- 0x22, 0x61, 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67,
- 0x6e, 0x61, 0x6c, 0x3e, 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66,
- 0x61, 0x63, 0x65, 0x3e, 0x3c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61,
- 0x63, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x63, 0x6f, 0x6d,
- 0x2e, 0x66, 0x6f, 0x72, 0x64, 0x2e, 0x68, 0x6d, 0x69, 0x2e, 0x73, 0x64,
- 0x6c, 0x2e, 0x53, 0x44, 0x4c, 0x22, 0x3e, 0x3c, 0x6d, 0x65, 0x74, 0x68,
- 0x6f, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x41, 0x63, 0x74,
- 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x70, 0x70, 0x22, 0x3e, 0x3c, 0x61,
- 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x3d, 0x22, 0x69, 0x6e, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x61, 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d,
- 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64,
- 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75,
- 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x74,
- 0x43, 0x6f, 0x64, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69,
- 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74,
- 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x73, 0x53, 0x44,
- 0x4c, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x22, 0x20, 0x74, 0x79,
- 0x70, 0x65, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d,
- 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x28, 0x62, 0x28, 0x73, 0x73, 0x28, 0x62, 0x69, 0x29, 0x28,
- 0x62, 0x62, 0x29, 0x29, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d,
- 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x69, 0x73, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e,
- 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x4e, 0x65, 0x65, 0x64,
- 0x65, 0x64, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x62, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x73, 0x41, 0x70, 0x70, 0x50,
- 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65,
- 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d,
- 0x22, 0x62, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64,
- 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75,
- 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70,
- 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x50, 0x65, 0x72, 0x6d, 0x69,
- 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x28, 0x62, 0x61, 0x28, 0x73, 0x69, 0x28, 0x62, 0x62, 0x29,
- 0x29, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64,
- 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75,
- 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x73, 0x41,
- 0x70, 0x70, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64, 0x22, 0x20, 0x74,
- 0x79, 0x70, 0x65, 0x3d, 0x22, 0x62, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61,
- 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
- 0x22, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x20, 0x74,
- 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3e, 0x3c, 0x6d,
- 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x46, 0x72, 0x69, 0x65, 0x6e,
- 0x64, 0x6c, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x3e,
- 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69,
- 0x6f, 0x6e, 0x3d, 0x22, 0x69, 0x6e, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x64,
- 0x65, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x61, 0x73,
- 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72,
- 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x69, 0x6e, 0x22, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61,
- 0x67, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62,
- 0x69, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64,
- 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75,
- 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x74,
- 0x43, 0x6f, 0x64, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69,
- 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74,
- 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x6d, 0x65, 0x73, 0x73,
- 0x61, 0x67, 0x65, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x28, 0x62, 0x61, 0x28, 0x73, 0x28, 0x62, 0x73, 0x29, 0x28, 0x62, 0x73,
- 0x29, 0x28, 0x62, 0x73, 0x29, 0x28, 0x62, 0x73, 0x29, 0x28, 0x62, 0x73,
- 0x29, 0x29, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74,
- 0x68, 0x6f, 0x64, 0x3e, 0x3c, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73,
- 0x74, 0x4f, 0x66, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
- 0x6e, 0x73, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72,
- 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x69, 0x6e, 0x22, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70, 0x49, 0x44, 0x22,
- 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x74, 0x43, 0x6f, 0x64,
- 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20,
- 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63,
- 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64,
- 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x20, 0x74,
- 0x79, 0x70, 0x65, 0x3d, 0x22, 0x61, 0x28, 0x73, 0x69, 0x28, 0x62, 0x62,
- 0x29, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74, 0x68,
- 0x6f, 0x64, 0x3e, 0x3c, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53,
- 0x44, 0x4c, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72,
- 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x74, 0x43, 0x6f,
- 0x64, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74,
- 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3e, 0x3c, 0x6d,
- 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x55, 0x70, 0x64,
- 0x61, 0x74, 0x65, 0x22, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69,
- 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74,
- 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72, 0x65, 0x74, 0x43,
- 0x6f, 0x64, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69,
- 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x64, 0x69, 0x72,
- 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f, 0x75, 0x74, 0x22,
- 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74, 0x75,
- 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20,
- 0x2f, 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3e, 0x3c,
- 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
- 0x22, 0x47, 0x65, 0x74, 0x55, 0x52, 0x4c, 0x53, 0x22, 0x3e, 0x3c, 0x61,
- 0x72, 0x67, 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
- 0x3d, 0x22, 0x69, 0x6e, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70,
- 0x65, 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67,
- 0x20, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22,
- 0x6f, 0x75, 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x72,
- 0x65, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20,
- 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x6f,
- 0x75, 0x74, 0x22, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x75, 0x72,
- 0x6c, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62,
- 0x61, 0x28, 0x73, 0x28, 0x62, 0x73, 0x29, 0x29, 0x29, 0x22, 0x20, 0x2f,
- 0x3e, 0x3c, 0x2f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x3e, 0x3c, 0x73,
- 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x4f, 0x6e, 0x41, 0x70, 0x70, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73,
- 0x69, 0x6f, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x22, 0x3e,
- 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61,
- 0x70, 0x70, 0x49, 0x44, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22,
- 0x69, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61,
- 0x6d, 0x65, 0x3d, 0x22, 0x69, 0x73, 0x41, 0x70, 0x70, 0x50, 0x65, 0x72,
- 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x76, 0x6f,
- 0x6b, 0x65, 0x64, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28,
- 0x62, 0x62, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20,
- 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70, 0x52, 0x65, 0x76,
- 0x6f, 0x6b, 0x65, 0x64, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69,
- 0x6f, 0x6e, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28,
- 0x62, 0x61, 0x28, 0x73, 0x69, 0x28, 0x62, 0x62, 0x29, 0x29, 0x29, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x61, 0x70, 0x70, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x64,
- 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x62, 0x29,
- 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d,
- 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73,
- 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x6f, 0x6e, 0x73, 0x65, 0x6e, 0x74,
- 0x4e, 0x65, 0x65, 0x64, 0x65, 0x64, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x28, 0x62, 0x62, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61,
- 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x61, 0x70, 0x70,
- 0x55, 0x6e, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64,
- 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x62, 0x29,
- 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d,
- 0x65, 0x3d, 0x22, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22,
- 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x69, 0x29, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65,
- 0x3d, 0x22, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x54, 0x79, 0x70,
- 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x28, 0x62, 0x61,
- 0x69, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e,
- 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x53, 0x44, 0x4c, 0x43, 0x6f,
- 0x6e, 0x73, 0x65, 0x6e, 0x74, 0x4e, 0x65, 0x65, 0x64, 0x65, 0x64, 0x22,
- 0x3e, 0x3c, 0x61, 0x72, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22,
- 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65,
- 0x3d, 0x22, 0x28, 0x73, 0x73, 0x28, 0x62, 0x69, 0x29, 0x28, 0x62, 0x62,
- 0x29, 0x29, 0x22, 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e,
- 0x61, 0x6c, 0x3e, 0x3c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x20, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x4f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75,
- 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x3e, 0x3c, 0x61, 0x72,
- 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x22, 0x73, 0x74, 0x61, 0x74,
- 0x75, 0x73, 0x22, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d, 0x22, 0x69, 0x22,
- 0x20, 0x2f, 0x3e, 0x3c, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x3e,
- 0x3c, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x3e,
- 0x3c, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x3e, 0x00}; \ No newline at end of file
diff --git a/src/components/dbus/src/message_descriptions.cc b/src/components/dbus/src/message_descriptions.cc
deleted file mode 100644
index 1a5e499a7f..0000000000
--- a/src/components/dbus/src/message_descriptions.cc
+++ /dev/null
@@ -1,10424 +0,0 @@
-// Warning! This file is generated by 'make_message_descriptions.py'. Edit at
-// your own risk.
-/**
- * @file message_descriptions.cc
- * @brief Generated HMI API message descriptions for D-Bus
- *
- * This file is a part of HMI D-Bus layer.
- */
-// Copyright (c) 2013, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-
-#include "dbus/message_descriptions.h"
-
-namespace {
-
-struct Structs {
- static const ford_message_descriptions::ParameterDescription*
- Common__Coordinate__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__DeviceInfo__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__UserFriendlyMessage__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__PermissionItem__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__ServiceInfo__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__TextField__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__ButtonCapabilities__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__VehicleDataResult__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__TouchCoord__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__TouchEvent__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__PresetBankCapabilities__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__Image__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__SoftButton__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__TTSChunk__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__HMIApplication__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__MenuParams__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__Choice__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__VrHelpItem__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__TimeFormat__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__TouchEventCapabilities__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__ImageResolution__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__ScreenParams__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__ImageField__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__VideoStreamingFormat__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__VideoConfig__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__DisplayCapabilities__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__SoftButtonCapabilities__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__HMICapabilities__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__AudioPassThruCapabilities__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__TextFieldStruct__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__KeyboardProperties__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__Turn__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__VehicleType__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__GPSData__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__SingleTireStatus__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__DIDResult__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__HeadLampStatus__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__TireStatus__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__BeltStatus__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__BodyInformation__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__DeviceStatus__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__ECallInfo__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__AirbagStatus__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__EmergencyEvent__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__ClusterModeStatus__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__MyKey__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__RdsData__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__RadioControlData__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__RadioControlCapabilities__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__Temperature__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__ClimateControlData__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__ClimateControlCapabilities__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__ModuleData__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__DateTime__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__OASISAddress__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__LocationDetails__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__NavigationCapability__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__PhoneCapability__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__VideoStreamingCapability__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__SystemCapabilities__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__RemoteControlCapabilities__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__Rectangle__parameters[];
- static const ford_message_descriptions::ParameterDescription*
- Common__HapticRect__parameters[];
-};
-
-const ford_message_descriptions::ParameterDescription
- Common__Coordinate__parameter1 = {
- "latitudeDegrees", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription
- Common__Coordinate__parameter2 = {
- "longitudeDegrees", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__Coordinate__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Coordinate__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Coordinate__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__DeviceInfo__parameter1 = {
- "name", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceInfo__parameter2 = {
- "id", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceInfo__parameter3 = {
- "transportType", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceInfo__parameter4 = {
- "isSDLAllowed", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__DeviceInfo__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceInfo__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceInfo__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceInfo__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceInfo__parameter4,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__UserFriendlyMessage__parameter1 = {
- "messageCode", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Common__UserFriendlyMessage__parameter2 = {
- "ttsString", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__UserFriendlyMessage__parameter3 = {
- "label", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__UserFriendlyMessage__parameter4 = {
- "line1", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__UserFriendlyMessage__parameter5 = {
- "line2", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__UserFriendlyMessage__parameter6 = {
- "textBody", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__UserFriendlyMessage__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__UserFriendlyMessage__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__UserFriendlyMessage__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__UserFriendlyMessage__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__UserFriendlyMessage__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__UserFriendlyMessage__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__UserFriendlyMessage__parameter6,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__PermissionItem__parameter1 = {
- "name", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Common__PermissionItem__parameter2 = {
- "id", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Common__PermissionItem__parameter3 = {
- "allowed", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__PermissionItem__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__PermissionItem__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__PermissionItem__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__PermissionItem__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__ServiceInfo__parameter1 = {
- "url", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Common__ServiceInfo__parameter2 = {
- "policyAppId", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__ServiceInfo__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ServiceInfo__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ServiceInfo__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__TextField__parameter1 = {
- "name", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__TextField__parameter2 = {
- "characterSet", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__TextField__parameter3 = {
- "width", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Common__TextField__parameter4 = {
- "rows", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__TextField__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TextField__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TextField__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TextField__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TextField__parameter4,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__ButtonCapabilities__parameter1 = {
- "name", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__ButtonCapabilities__parameter2 = {
- "shortPressAvailable", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__ButtonCapabilities__parameter3 = {
- "longPressAvailable", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__ButtonCapabilities__parameter4 = {
- "upDownAvailable", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__ButtonCapabilities__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ButtonCapabilities__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ButtonCapabilities__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ButtonCapabilities__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ButtonCapabilities__parameter4,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__VehicleDataResult__parameter1 = {
- "dataType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__VehicleDataResult__parameter2 = {
- "resultCode", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__VehicleDataResult__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VehicleDataResult__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VehicleDataResult__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__TouchCoord__parameter1 = {
- "x", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Common__TouchCoord__parameter2 = {
- "y", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__TouchCoord__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TouchCoord__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TouchCoord__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__TouchEvent__parameter1 = {
- "id", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Common__TouchEvent__parameter2_array = {
- "ts", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ArrayDescription
- Common__TouchEvent__parameter2 = {
- {"ts", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TouchEvent__parameter2_array,
- "i"};
-const ford_message_descriptions::StructDescription
- Common__TouchEvent__parameter3_array = {
- {"c", ford_message_descriptions::Struct, true},
- Structs::Common__TouchCoord__parameters};
-const ford_message_descriptions::ArrayDescription
- Common__TouchEvent__parameter3 = {
- {"c", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TouchEvent__parameter3_array,
- "(ii)"};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__TouchEvent__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TouchEvent__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TouchEvent__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TouchEvent__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__PresetBankCapabilities__parameter1 = {
- "onScreenPresetsAvailable", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__PresetBankCapabilities__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__PresetBankCapabilities__parameter1,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__Image__parameter1 = {
- "value", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Common__Image__parameter2 = {
- "imageType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__Image__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Image__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Image__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__SoftButton__parameter1 = {
- "type", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__SoftButton__parameter2 = {
- "text", ford_message_descriptions::String, false};
-const ford_message_descriptions::StructDescription
- Common__SoftButton__parameter3 = {
- {"image", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::ParameterDescription
- Common__SoftButton__parameter4 = {
- "isHighlighted", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__SoftButton__parameter5 = {
- "softButtonID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Common__SoftButton__parameter6 = {
- "systemAction", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__SoftButton__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__SoftButton__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__SoftButton__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__SoftButton__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__SoftButton__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__SoftButton__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__SoftButton__parameter6,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__TTSChunk__parameter1 = {
- "text", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Common__TTSChunk__parameter2 = {
- "type", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__TTSChunk__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TTSChunk__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TTSChunk__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__HMIApplication__parameter1 = {
- "appName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Common__HMIApplication__parameter2 = {
- "ngnMediaScreenAppName", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__HMIApplication__parameter3 = {
- "icon", ford_message_descriptions::String, false};
-const ford_message_descriptions::StructDescription
- Common__HMIApplication__parameter4 = {
- {"deviceInfo", ford_message_descriptions::Struct, true},
- Structs::Common__DeviceInfo__parameters};
-const ford_message_descriptions::ParameterDescription
- Common__HMIApplication__parameter5 = {
- "policyAppID", ford_message_descriptions::String, true};
-const ford_message_descriptions::StructDescription
- Common__HMIApplication__parameter6_array = {
- {"ttsName", ford_message_descriptions::Struct, true},
- Structs::Common__TTSChunk__parameters};
-const ford_message_descriptions::ArrayDescription
- Common__HMIApplication__parameter6 = {
- {"ttsName", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter6_array,
- "(si)"};
-const ford_message_descriptions::ParameterDescription
- Common__HMIApplication__parameter7_array = {
- "vrSynonyms", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- Common__HMIApplication__parameter7 = {
- {"vrSynonyms", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter7_array,
- "s"};
-const ford_message_descriptions::ParameterDescription
- Common__HMIApplication__parameter8 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Common__HMIApplication__parameter9 = {
- "hmiDisplayLanguageDesired", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__HMIApplication__parameter10 = {
- "isMediaApplication", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__HMIApplication__parameter11_array = {
- "appType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- Common__HMIApplication__parameter11 = {
- {"appType", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter11_array,
- "i"};
-const ford_message_descriptions::ParameterDescription
- Common__HMIApplication__parameter12 = {
- "greyOut", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__HMIApplication__parameter13_array = {
- "requestType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- Common__HMIApplication__parameter13 = {
- {"requestType", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter13_array,
- "i"};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__HMIApplication__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter11,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter12,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMIApplication__parameter13,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__MenuParams__parameter1 = {
- "parentID", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__MenuParams__parameter2 = {
- "position", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__MenuParams__parameter3 = {
- "menuName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__MenuParams__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__MenuParams__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__MenuParams__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__MenuParams__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__Choice__parameter1 = {
- "choiceID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Common__Choice__parameter2 = {
- "menuName", ford_message_descriptions::String, false};
-const ford_message_descriptions::StructDescription Common__Choice__parameter3 =
- {{"image", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::ParameterDescription
- Common__Choice__parameter4 = {
- "secondaryText", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__Choice__parameter5 = {
- "tertiaryText", ford_message_descriptions::String, false};
-const ford_message_descriptions::StructDescription Common__Choice__parameter6 =
- {{"secondaryImage", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__Choice__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Choice__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Choice__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Choice__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Choice__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Choice__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Choice__parameter6,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__VrHelpItem__parameter1 = {
- "text", ford_message_descriptions::String, true};
-const ford_message_descriptions::StructDescription
- Common__VrHelpItem__parameter2 = {
- {"image", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::ParameterDescription
- Common__VrHelpItem__parameter3 = {
- "position", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__VrHelpItem__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VrHelpItem__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VrHelpItem__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VrHelpItem__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__TimeFormat__parameter1 = {
- "hours", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Common__TimeFormat__parameter2 = {
- "minutes", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Common__TimeFormat__parameter3 = {
- "seconds", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__TimeFormat__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TimeFormat__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TimeFormat__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TimeFormat__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__TouchEventCapabilities__parameter1 = {
- "pressAvailable", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__TouchEventCapabilities__parameter2 = {
- "multiTouchAvailable", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__TouchEventCapabilities__parameter3 = {
- "doublePressAvailable", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__TouchEventCapabilities__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TouchEventCapabilities__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TouchEventCapabilities__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TouchEventCapabilities__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__ImageResolution__parameter1 = {
- "resolutionWidth", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Common__ImageResolution__parameter2 = {
- "resolutionHeight", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__ImageResolution__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ImageResolution__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ImageResolution__parameter2,
- NULL};
-
-const ford_message_descriptions::StructDescription
- Common__ScreenParams__parameter1 = {
- {"resolution", ford_message_descriptions::Struct, true},
- Structs::Common__ImageResolution__parameters};
-const ford_message_descriptions::StructDescription
- Common__ScreenParams__parameter2 = {
- {"touchEventAvailable", ford_message_descriptions::Struct, false},
- Structs::Common__TouchEventCapabilities__parameters};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__ScreenParams__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ScreenParams__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ScreenParams__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__ImageField__parameter1 = {
- "name", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__ImageField__parameter2_array = {
- "imageTypeSupported", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- Common__ImageField__parameter2 = {
- {"imageTypeSupported", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ImageField__parameter2_array,
- "i"};
-const ford_message_descriptions::StructDescription
- Common__ImageField__parameter3 = {
- {"imageResolution", ford_message_descriptions::Struct, false},
- Structs::Common__ImageResolution__parameters};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__ImageField__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ImageField__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ImageField__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ImageField__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__VideoStreamingFormat__parameter1 = {
- "protocol", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__VideoStreamingFormat__parameter2 = {
- "codec", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__VideoStreamingFormat__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VideoStreamingFormat__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VideoStreamingFormat__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__VideoConfig__parameter1 = {
- "protocol", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__VideoConfig__parameter2 = {
- "codec", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__VideoConfig__parameter3 = {
- "width", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__VideoConfig__parameter4 = {
- "height", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__VideoConfig__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VideoConfig__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VideoConfig__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VideoConfig__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VideoConfig__parameter4,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__DisplayCapabilities__parameter1 = {
- "displayType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::StructDescription
- Common__DisplayCapabilities__parameter2_array = {
- {"textFields", ford_message_descriptions::Struct, true},
- Structs::Common__TextField__parameters};
-const ford_message_descriptions::ArrayDescription
- Common__DisplayCapabilities__parameter2 = {
- {"textFields", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter2_array,
- "(iiii)"};
-const ford_message_descriptions::StructDescription
- Common__DisplayCapabilities__parameter3_array = {
- {"imageFields", ford_message_descriptions::Struct, true},
- Structs::Common__ImageField__parameters};
-const ford_message_descriptions::ArrayDescription
- Common__DisplayCapabilities__parameter3 = {
- {"imageFields", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter3_array,
- "(i(bai)(b(ii)))"};
-const ford_message_descriptions::ParameterDescription
- Common__DisplayCapabilities__parameter4_array = {
- "mediaClockFormats", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- Common__DisplayCapabilities__parameter4 = {
- {"mediaClockFormats", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter4_array,
- "i"};
-const ford_message_descriptions::ParameterDescription
- Common__DisplayCapabilities__parameter5_array = {
- "imageCapabilities", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- Common__DisplayCapabilities__parameter5 = {
- {"imageCapabilities", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter5_array,
- "i"};
-const ford_message_descriptions::ParameterDescription
- Common__DisplayCapabilities__parameter6 = {
- "graphicSupported", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__DisplayCapabilities__parameter7_array = {
- "templatesAvailable", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- Common__DisplayCapabilities__parameter7 = {
- {"templatesAvailable", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter7_array,
- "s"};
-const ford_message_descriptions::StructDescription
- Common__DisplayCapabilities__parameter8 = {
- {"screenParams", ford_message_descriptions::Struct, false},
- Structs::Common__ScreenParams__parameters};
-const ford_message_descriptions::ParameterDescription
- Common__DisplayCapabilities__parameter9 = {
- "numCustomPresetsAvailable", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__DisplayCapabilities__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DisplayCapabilities__parameter9,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__SoftButtonCapabilities__parameter1 = {
- "shortPressAvailable", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__SoftButtonCapabilities__parameter2 = {
- "longPressAvailable", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__SoftButtonCapabilities__parameter3 = {
- "upDownAvailable", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__SoftButtonCapabilities__parameter4 = {
- "imageSupported", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__SoftButtonCapabilities__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__SoftButtonCapabilities__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__SoftButtonCapabilities__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__SoftButtonCapabilities__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__SoftButtonCapabilities__parameter4,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__HMICapabilities__parameter1 = {
- "navigation", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__HMICapabilities__parameter2 = {
- "phoneCall", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__HMICapabilities__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMICapabilities__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HMICapabilities__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__AudioPassThruCapabilities__parameter1 = {
- "samplingRate", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__AudioPassThruCapabilities__parameter2 = {
- "bitsPerSample", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__AudioPassThruCapabilities__parameter3 = {
- "audioType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__AudioPassThruCapabilities__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__AudioPassThruCapabilities__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__AudioPassThruCapabilities__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__AudioPassThruCapabilities__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__TextFieldStruct__parameter1 = {
- "fieldName", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__TextFieldStruct__parameter2 = {
- "fieldText", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__TextFieldStruct__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TextFieldStruct__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TextFieldStruct__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__KeyboardProperties__parameter1 = {
- "language", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__KeyboardProperties__parameter2 = {
- "keyboardLayout", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__KeyboardProperties__parameter3 = {
- "keypressMode", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__KeyboardProperties__parameter4_array = {
- "limitedCharacterList", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- Common__KeyboardProperties__parameter4 = {
- {"limitedCharacterList", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__KeyboardProperties__parameter4_array,
- "s"};
-const ford_message_descriptions::ParameterDescription
- Common__KeyboardProperties__parameter5 = {
- "autoCompleteText", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__KeyboardProperties__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__KeyboardProperties__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__KeyboardProperties__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__KeyboardProperties__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__KeyboardProperties__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__KeyboardProperties__parameter5,
- NULL};
-
-const ford_message_descriptions::StructDescription Common__Turn__parameter1 = {
- {"navigationText", ford_message_descriptions::Struct, false},
- Structs::Common__TextFieldStruct__parameters};
-const ford_message_descriptions::StructDescription Common__Turn__parameter2 = {
- {"turnIcon", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__Turn__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Turn__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Turn__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__VehicleType__parameter1 = {
- "make", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__VehicleType__parameter2 = {
- "model", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__VehicleType__parameter3 = {
- "modelYear", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__VehicleType__parameter4 = {
- "trim", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__VehicleType__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VehicleType__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VehicleType__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VehicleType__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VehicleType__parameter4,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter1 = {
- "longitudeDegrees", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter2 = {
- "latitudeDegrees", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter3 = {
- "utcYear", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter4 = {
- "utcMonth", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter5 = {
- "utcDay", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter6 = {
- "utcHours", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter7 = {
- "utcMinutes", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter8 = {
- "utcSeconds", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter9 = {
- "compassDirection", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter10 = {
- "pdop", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter11 = {
- "hdop", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter12 = {
- "vdop", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter13 = {
- "actual", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter14 = {
- "satellites", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter15 = {
- "dimension", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter16 = {
- "altitude", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter17 = {
- "heading", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- Common__GPSData__parameter18 = {
- "speed", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__GPSData__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter11,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter12,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter13,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter14,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter15,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter16,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter17,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__GPSData__parameter18,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__SingleTireStatus__parameter1 = {
- "status", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__SingleTireStatus__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__SingleTireStatus__parameter1,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__DIDResult__parameter1 = {
- "resultCode", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__DIDResult__parameter2 = {
- "didLocation", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Common__DIDResult__parameter3 = {
- "data", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__DIDResult__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DIDResult__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DIDResult__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DIDResult__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__HeadLampStatus__parameter1 = {
- "lowBeamsOn", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__HeadLampStatus__parameter2 = {
- "highBeamsOn", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__HeadLampStatus__parameter3 = {
- "ambientLightSensorStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__HeadLampStatus__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HeadLampStatus__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HeadLampStatus__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HeadLampStatus__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__TireStatus__parameter1 = {
- "pressureTelltale", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::StructDescription
- Common__TireStatus__parameter2 = {
- {"leftFront", ford_message_descriptions::Struct, false},
- Structs::Common__SingleTireStatus__parameters};
-const ford_message_descriptions::StructDescription
- Common__TireStatus__parameter3 = {
- {"rightFront", ford_message_descriptions::Struct, false},
- Structs::Common__SingleTireStatus__parameters};
-const ford_message_descriptions::StructDescription
- Common__TireStatus__parameter4 = {
- {"leftRear", ford_message_descriptions::Struct, false},
- Structs::Common__SingleTireStatus__parameters};
-const ford_message_descriptions::StructDescription
- Common__TireStatus__parameter5 = {
- {"rightRear", ford_message_descriptions::Struct, false},
- Structs::Common__SingleTireStatus__parameters};
-const ford_message_descriptions::StructDescription
- Common__TireStatus__parameter6 = {
- {"innerLeftRear", ford_message_descriptions::Struct, false},
- Structs::Common__SingleTireStatus__parameters};
-const ford_message_descriptions::StructDescription
- Common__TireStatus__parameter7 = {
- {"innerRightRear", ford_message_descriptions::Struct, false},
- Structs::Common__SingleTireStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__TireStatus__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TireStatus__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TireStatus__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TireStatus__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TireStatus__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TireStatus__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TireStatus__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__TireStatus__parameter7,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter1 = {
- "driverBeltDeployed", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter2 = {
- "passengerBeltDeployed", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter3 = {
- "passengerBuckleBelted", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter4 = {
- "driverBuckleBelted", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter5 = {
- "leftRow2BuckleBelted", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter6 = {
- "passengerChildDetected", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter7 = {
- "rightRow2BuckleBelted", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter8 = {
- "middleRow2BuckleBelted", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter9 = {
- "middleRow3BuckleBelted", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter10 = {
- "leftRow3BuckleBelted", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter11 = {
- "rightRow3BuckleBelted", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter12 = {
- "leftRearInflatableBelted", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter13 = {
- "rightRearInflatableBelted", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter14 = {
- "middleRow1BeltDeployed", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__BeltStatus__parameter15 = {
- "middleRow1BuckleBelted", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__BeltStatus__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter11,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter12,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter13,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter14,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BeltStatus__parameter15,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__BodyInformation__parameter1 = {
- "parkBrakeActive", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__BodyInformation__parameter2 = {
- "ignitionStableStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__BodyInformation__parameter3 = {
- "ignitionStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__BodyInformation__parameter4 = {
- "driverDoorAjar", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__BodyInformation__parameter5 = {
- "passengerDoorAjar", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__BodyInformation__parameter6 = {
- "rearLeftDoorAjar", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__BodyInformation__parameter7 = {
- "rearRightDoorAjar", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__BodyInformation__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BodyInformation__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BodyInformation__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BodyInformation__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BodyInformation__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BodyInformation__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BodyInformation__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__BodyInformation__parameter7,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__DeviceStatus__parameter1 = {
- "voiceRecOn", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceStatus__parameter2 = {
- "btIconOn", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceStatus__parameter3 = {
- "callActive", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceStatus__parameter4 = {
- "phoneRoaming", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceStatus__parameter5 = {
- "textMsgAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceStatus__parameter6 = {
- "battLevelStatus", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceStatus__parameter7 = {
- "stereoAudioOutputMuted", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceStatus__parameter8 = {
- "monoAudioOutputMuted", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceStatus__parameter9 = {
- "signalLevelStatus", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceStatus__parameter10 = {
- "primaryAudioSource", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__DeviceStatus__parameter11 = {
- "eCallEventActive", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__DeviceStatus__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceStatus__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceStatus__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceStatus__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceStatus__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceStatus__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceStatus__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceStatus__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceStatus__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceStatus__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceStatus__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__DeviceStatus__parameter11,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__ECallInfo__parameter1 = {
- "eCallNotificationStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__ECallInfo__parameter2 = {
- "auxECallNotificationStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__ECallInfo__parameter3 = {
- "eCallConfirmationStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__ECallInfo__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ECallInfo__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ECallInfo__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ECallInfo__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__AirbagStatus__parameter1 = {
- "driverAirbagDeployed", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__AirbagStatus__parameter2 = {
- "driverSideAirbagDeployed", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__AirbagStatus__parameter3 = {
- "driverCurtainAirbagDeployed", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__AirbagStatus__parameter4 = {
- "passengerAirbagDeployed", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__AirbagStatus__parameter5 = {"passengerCurtainAirbagDeployed",
- ford_message_descriptions::Enum,
- true};
-const ford_message_descriptions::ParameterDescription
- Common__AirbagStatus__parameter6 = {
- "driverKneeAirbagDeployed", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__AirbagStatus__parameter7 = {
- "passengerSideAirbagDeployed", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__AirbagStatus__parameter8 = {
- "passengerKneeAirbagDeployed", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__AirbagStatus__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__AirbagStatus__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__AirbagStatus__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__AirbagStatus__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__AirbagStatus__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__AirbagStatus__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__AirbagStatus__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__AirbagStatus__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__AirbagStatus__parameter8,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__EmergencyEvent__parameter1 = {
- "emergencyEventType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__EmergencyEvent__parameter2 = {
- "fuelCutoffStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__EmergencyEvent__parameter3 = {
- "rolloverEvent", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__EmergencyEvent__parameter4 = {
- "maximumChangeVelocity", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__EmergencyEvent__parameter5 = {
- "multipleEvents", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__EmergencyEvent__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__EmergencyEvent__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__EmergencyEvent__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__EmergencyEvent__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__EmergencyEvent__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__EmergencyEvent__parameter5,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__ClusterModeStatus__parameter1 = {
- "powerModeActive", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Common__ClusterModeStatus__parameter2 = {
- "powerModeQualificationStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__ClusterModeStatus__parameter3 = {
- "carModeStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__ClusterModeStatus__parameter4 = {
- "powerModeStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__ClusterModeStatus__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClusterModeStatus__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClusterModeStatus__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClusterModeStatus__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClusterModeStatus__parameter4,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__MyKey__parameter1 = {
- "e911Override", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__MyKey__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__MyKey__parameter1,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__RdsData__parameter1 = {
- "PS", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__RdsData__parameter2 = {
- "RT", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__RdsData__parameter3 = {
- "CT", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__RdsData__parameter4 = {
- "PI", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__RdsData__parameter5 = {
- "PTY", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__RdsData__parameter6 = {
- "TP", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__RdsData__parameter7 = {
- "TA", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__RdsData__parameter8 = {
- "REG", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__RdsData__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RdsData__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RdsData__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RdsData__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RdsData__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RdsData__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RdsData__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RdsData__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RdsData__parameter8,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlData__parameter1 = {
- "frequencyInteger", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlData__parameter2 = {
- "frequencyFraction", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlData__parameter3 = {
- "band", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::StructDescription
- Common__RadioControlData__parameter4 = {
- {"rdsData", ford_message_descriptions::Struct, false},
- Structs::Common__RdsData__parameters};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlData__parameter5 = {
- "availableHDs", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlData__parameter6 = {
- "hdChannel", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlData__parameter7 = {
- "signalStrength", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlData__parameter8 = {
- "signalChangeThreshold", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlData__parameter9 = {
- "radioEnable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlData__parameter10 = {
- "state", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__RadioControlData__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlData__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlData__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlData__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlData__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlData__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlData__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlData__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlData__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlData__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlData__parameter10,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlCapabilities__parameter1 = {
- "moduleName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlCapabilities__parameter2 = {
- "radioEnableAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlCapabilities__parameter3 = {
- "radioBandAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlCapabilities__parameter4 = {
- "radioFrequencyAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlCapabilities__parameter5 = {
- "hdChannelAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlCapabilities__parameter6 = {
- "rdsDataAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlCapabilities__parameter7 = {
- "availableHDsAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlCapabilities__parameter8 = {
- "stateAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlCapabilities__parameter9 = {
- "signalStrengthAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__RadioControlCapabilities__parameter10 = {
- "signalChangeThresholdAvailable",
- ford_message_descriptions::Boolean,
- false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__RadioControlCapabilities__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlCapabilities__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlCapabilities__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlCapabilities__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlCapabilities__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlCapabilities__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlCapabilities__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlCapabilities__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlCapabilities__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlCapabilities__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RadioControlCapabilities__parameter10,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__Temperature__parameter1 = {
- "unit", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Common__Temperature__parameter2 = {
- "value", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__Temperature__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Temperature__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Temperature__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlData__parameter1 = {
- "fanSpeed", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::StructDescription
- Common__ClimateControlData__parameter2 = {
- {"currentTemperature", ford_message_descriptions::Struct, false},
- Structs::Common__Temperature__parameters};
-const ford_message_descriptions::StructDescription
- Common__ClimateControlData__parameter3 = {
- {"desiredTemperature", ford_message_descriptions::Struct, false},
- Structs::Common__Temperature__parameters};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlData__parameter4 = {
- "acEnable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlData__parameter5 = {
- "circulateAirEnable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlData__parameter6 = {
- "autoModeEnable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlData__parameter7 = {
- "defrostZone", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlData__parameter8 = {
- "dualModeEnable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlData__parameter9 = {
- "acMaxEnable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlData__parameter10 = {
- "ventilationMode", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__ClimateControlData__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlData__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlData__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlData__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlData__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlData__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlData__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlData__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlData__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlData__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlData__parameter10,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter1 = {
- "moduleName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter2 = {
- "currentTemperatureAvailable",
- ford_message_descriptions::Boolean,
- false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter3 = {
- "fanSpeedAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter4 = {
- "desiredTemperatureAvailable",
- ford_message_descriptions::Boolean,
- false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter5 = {
- "acEnableAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter6 = {
- "acMaxEnableAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter7 = {
- "circulateAirEnableAvailable",
- ford_message_descriptions::Boolean,
- false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter8 = {
- "autoModeEnableAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter9 = {
- "dualModeEnableAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter10 = {
- "defrostZoneAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter11_array = {
- "defrostZone", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- Common__ClimateControlCapabilities__parameter11 = {
- {"defrostZone", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter11_array,
- "i"};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter12 = {
- "ventilationModeAvailable", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__ClimateControlCapabilities__parameter13_array = {
- "ventilationMode", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- Common__ClimateControlCapabilities__parameter13 = {
- {"ventilationMode", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter13_array,
- "i"};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__ClimateControlCapabilities__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter11,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter12,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ClimateControlCapabilities__parameter13,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__ModuleData__parameter1 = {
- "moduleType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::StructDescription
- Common__ModuleData__parameter2 = {
- {"radioControlData", ford_message_descriptions::Struct, false},
- Structs::Common__RadioControlData__parameters};
-const ford_message_descriptions::StructDescription
- Common__ModuleData__parameter3 = {
- {"climateControlData", ford_message_descriptions::Struct, false},
- Structs::Common__ClimateControlData__parameters};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__ModuleData__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ModuleData__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ModuleData__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__ModuleData__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__DateTime__parameter1 = {
- "millisecond", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__DateTime__parameter2 = {
- "second", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__DateTime__parameter3 = {
- "minute", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__DateTime__parameter4 = {
- "hour", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__DateTime__parameter5 = {
- "day", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__DateTime__parameter6 = {
- "month", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__DateTime__parameter7 = {
- "year", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__DateTime__parameter8 = {
- "tz_hour", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Common__DateTime__parameter9 = {
- "tz_minute", ford_message_descriptions::Integer, false};
-/*const ford_message_descriptions::ParameterDescription*
- Structs::Common__DateTime__parameters[] = {
- (const
- ford_message_descriptions::ParameterDescription*)&Common__DateTime__parameter1,
- (const
- ford_message_descriptions::ParameterDescription*)&Common__DateTime__parameter2,
- (const
- ford_message_descriptions::ParameterDescription*)&Common__DateTime__parameter3,
- (const
- ford_message_descriptions::ParameterDescription*)&Common__DateTime__parameter4,
- (const
- ford_message_descriptions::ParameterDescription*)&Common__DateTime__parameter5,
- (const
- ford_message_descriptions::ParameterDescription*)&Common__DateTime__parameter6,
- (const
- ford_message_descriptions::ParameterDescription*)&Common__DateTime__parameter7,
- (const
- ford_message_descriptions::ParameterDescription*)&Common__DateTime__parameter8,
- (const
- ford_message_descriptions::ParameterDescription*)&Common__DateTime__parameter9,
- NULL };*/
-
-const ford_message_descriptions::ParameterDescription
- Common__OASISAddress__parameter1 = {
- "countryName", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__OASISAddress__parameter2 = {
- "countryCode", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__OASISAddress__parameter3 = {
- "postalCode", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__OASISAddress__parameter4 = {
- "administrativeArea", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__OASISAddress__parameter5 = {
- "subAdministrativeArea", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__OASISAddress__parameter6 = {
- "locality", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__OASISAddress__parameter7 = {
- "subLocality", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__OASISAddress__parameter8 = {
- "thoroughfare", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__OASISAddress__parameter9 = {
- "subThoroughfare", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__OASISAddress__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__OASISAddress__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__OASISAddress__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__OASISAddress__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__OASISAddress__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__OASISAddress__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__OASISAddress__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__OASISAddress__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__OASISAddress__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__OASISAddress__parameter9,
- NULL};
-
-const ford_message_descriptions::StructDescription
- Common__LocationDetails__parameter1 = {
- {"coordinate", ford_message_descriptions::Struct, false},
- Structs::Common__Coordinate__parameters};
-const ford_message_descriptions::ParameterDescription
- Common__LocationDetails__parameter2 = {
- "locationName", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__LocationDetails__parameter3_array = {
- "addressLines", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- Common__LocationDetails__parameter3 = {
- {"addressLines", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__LocationDetails__parameter3_array,
- "s"};
-const ford_message_descriptions::ParameterDescription
- Common__LocationDetails__parameter4 = {
- "locationDescription", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Common__LocationDetails__parameter5 = {
- "phoneNumber", ford_message_descriptions::String, false};
-const ford_message_descriptions::StructDescription
- Common__LocationDetails__parameter6 = {
- {"locationImage", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::StructDescription
- Common__LocationDetails__parameter7 = {
- {"searchAddress", ford_message_descriptions::Struct, false},
- Structs::Common__OASISAddress__parameters};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__LocationDetails__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__LocationDetails__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__LocationDetails__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__LocationDetails__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__LocationDetails__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__LocationDetails__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__LocationDetails__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__LocationDetails__parameter7,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__NavigationCapability__parameter1 = {
- "sendLocationEnabled", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- Common__NavigationCapability__parameter2 = {
- "getWayPointsEnabled", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__NavigationCapability__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__NavigationCapability__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__NavigationCapability__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__PhoneCapability__parameter1 = {
- "dialNumberEnabled", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__PhoneCapability__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__PhoneCapability__parameter1,
- NULL};
-
-const ford_message_descriptions::StructDescription
- Common__VideoStreamingCapability__parameter1 = {
- {"preferredResolution", ford_message_descriptions::Struct, false},
- Structs::Common__ImageResolution__parameters};
-const ford_message_descriptions::ParameterDescription
- Common__VideoStreamingCapability__parameter2 = {
- "maxBitrate", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::StructDescription
- Common__VideoStreamingCapability__parameter3_array = {
- {"supportedFormats", ford_message_descriptions::Struct, true},
- Structs::Common__VideoStreamingFormat__parameters};
-const ford_message_descriptions::ArrayDescription
- Common__VideoStreamingCapability__parameter3 = {
- {"supportedFormats", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VideoStreamingCapability__parameter3_array,
- "(ii)"};
-const ford_message_descriptions::ParameterDescription
- Common__VideoStreamingCapability__parameter4 = {
- "hapticSpatialDataSupported",
- ford_message_descriptions::Boolean,
- false};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__VideoStreamingCapability__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VideoStreamingCapability__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VideoStreamingCapability__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VideoStreamingCapability__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__VideoStreamingCapability__parameter4,
- NULL};
-
-const ford_message_descriptions::StructDescription
- Common__SystemCapabilities__parameter1 = {
- {"navigationCapability", ford_message_descriptions::Struct, false},
- Structs::Common__NavigationCapability__parameters};
-const ford_message_descriptions::StructDescription
- Common__SystemCapabilities__parameter2 = {
- {"phoneCapability", ford_message_descriptions::Struct, false},
- Structs::Common__PhoneCapability__parameters};
-const ford_message_descriptions::StructDescription
- Common__SystemCapabilities__parameter3 = {
- {"videoStreamingCapability", ford_message_descriptions::Struct, false},
- Structs::Common__VideoStreamingCapability__parameters};
-/*const ford_message_descriptions::ParameterDescription*
- Structs::Common__SystemCapabilities__parameters[] = {
- (const
- ford_message_descriptions::ParameterDescription*)&Common__SystemCapabilities__parameter1,
- (const
- ford_message_descriptions::ParameterDescription*)&Common__SystemCapabilities__parameter2,
- (const
- ford_message_descriptions::ParameterDescription*)&Common__SystemCapabilities__parameter3,
- NULL };*/
-
-const ford_message_descriptions::StructDescription
- Common__RemoteControlCapabilities__parameter1_array = {
- {"climateControlCapabilities", ford_message_descriptions::Struct, true},
- Structs::Common__ClimateControlCapabilities__parameters};
-const ford_message_descriptions::ArrayDescription
- Common__RemoteControlCapabilities__parameter1 = {
- {"climateControlCapabilities", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RemoteControlCapabilities__parameter1_array,
- "(s(bb)(bb)(bb)(bb)(bb)(bb)(bb)(bb)(bb)(bai)(bb)(bai))"};
-const ford_message_descriptions::StructDescription
- Common__RemoteControlCapabilities__parameter2_array = {
- {"radioControlCapabilities", ford_message_descriptions::Struct, true},
- Structs::Common__RadioControlCapabilities__parameters};
-const ford_message_descriptions::ArrayDescription
- Common__RemoteControlCapabilities__parameter2 = {
- {"radioControlCapabilities", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RemoteControlCapabilities__parameter2_array,
- "(s(bb)(bb)(bb)(bb)(bb)(bb)(bb)(bb)(bb))"};
-const ford_message_descriptions::StructDescription
- Common__RemoteControlCapabilities__parameter3_array = {
- {"buttonCapabilities", ford_message_descriptions::Struct, true},
- Structs::Common__ButtonCapabilities__parameters};
-const ford_message_descriptions::ArrayDescription
- Common__RemoteControlCapabilities__parameter3 = {
- {"buttonCapabilities", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RemoteControlCapabilities__parameter3_array,
- "(ibbb)"};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__RemoteControlCapabilities__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RemoteControlCapabilities__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RemoteControlCapabilities__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__RemoteControlCapabilities__parameter3,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__Rectangle__parameter1 = {
- "x", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription
- Common__Rectangle__parameter2 = {
- "y", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription
- Common__Rectangle__parameter3 = {
- "width", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription
- Common__Rectangle__parameter4 = {
- "height", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__Rectangle__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Rectangle__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Rectangle__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Rectangle__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__Rectangle__parameter4,
- NULL};
-
-const ford_message_descriptions::ParameterDescription
- Common__HapticRect__parameter1 = {
- "id", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::StructDescription
- Common__HapticRect__parameter2 = {
- {"rect", ford_message_descriptions::Struct, true},
- Structs::Common__Rectangle__parameters};
-const ford_message_descriptions::ParameterDescription*
- Structs::Common__HapticRect__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HapticRect__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Common__HapticRect__parameter2,
- NULL};
-
-const ford_message_descriptions::ParameterDescription*
- Buttons__GetCapabilities__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Buttons__GetCapabilities__request = {
- "Buttons",
- "GetCapabilities",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Buttons_GetCapabilities,
- Buttons__GetCapabilities__request__parameters};
-
-const ford_message_descriptions::StructDescription
- Buttons__GetCapabilities__response__parameter1_array = {
- {"capabilities", ford_message_descriptions::Struct, true},
- Structs::Common__ButtonCapabilities__parameters};
-const ford_message_descriptions::ArrayDescription
- Buttons__GetCapabilities__response__parameter1 = {
- {"capabilities", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__GetCapabilities__response__parameter1_array,
- "(ibbb)"};
-const ford_message_descriptions::StructDescription
- Buttons__GetCapabilities__response__parameter2 = {
- {"presetBankCapabilities", ford_message_descriptions::Struct, false},
- Structs::Common__PresetBankCapabilities__parameters};
-const ford_message_descriptions::ParameterDescription*
- Buttons__GetCapabilities__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__GetCapabilities__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__GetCapabilities__response__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- Buttons__GetCapabilities__response = {
- "Buttons",
- "GetCapabilities",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Buttons_GetCapabilities,
- Buttons__GetCapabilities__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Buttons__OnButtonEvent__notification__parameter1 = {
- "name", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Buttons__OnButtonEvent__notification__parameter2 = {
- "mode", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Buttons__OnButtonEvent__notification__parameter3 = {
- "customButtonID", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Buttons__OnButtonEvent__notification__parameter4 = {
- "appID", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription*
- Buttons__OnButtonEvent__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__OnButtonEvent__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__OnButtonEvent__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__OnButtonEvent__notification__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__OnButtonEvent__notification__parameter4,
- NULL};
-const ford_message_descriptions::MessageDescription
- Buttons__OnButtonEvent__notification = {
- "Buttons",
- "OnButtonEvent",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::Buttons_OnButtonEvent,
- Buttons__OnButtonEvent__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Buttons__OnButtonPress__notification__parameter1 = {
- "name", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Buttons__OnButtonPress__notification__parameter2 = {
- "mode", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Buttons__OnButtonPress__notification__parameter3 = {
- "customButtonID", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- Buttons__OnButtonPress__notification__parameter4 = {
- "appID", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription*
- Buttons__OnButtonPress__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__OnButtonPress__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__OnButtonPress__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__OnButtonPress__notification__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__OnButtonPress__notification__parameter4,
- NULL};
-const ford_message_descriptions::MessageDescription
- Buttons__OnButtonPress__notification = {
- "Buttons",
- "OnButtonPress",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::Buttons_OnButtonPress,
- Buttons__OnButtonPress__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Buttons__OnButtonSubscription__notification__parameter1 = {
- "name", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Buttons__OnButtonSubscription__notification__parameter2 = {
- "isSubscribed", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- Buttons__OnButtonSubscription__notification__parameter3 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Buttons__OnButtonSubscription__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__OnButtonSubscription__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__OnButtonSubscription__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Buttons__OnButtonSubscription__notification__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- Buttons__OnButtonSubscription__notification = {
- "Buttons",
- "OnButtonSubscription",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::Buttons_OnButtonSubscription,
- Buttons__OnButtonSubscription__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnReady__notification__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnReady__notification = {
- "BasicCommunication",
- "OnReady",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnReady,
- BasicCommunication__OnReady__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnStartDeviceDiscovery__notification__parameters[] = {
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnStartDeviceDiscovery__notification = {
- "BasicCommunication",
- "OnStartDeviceDiscovery",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnStartDeviceDiscovery,
- BasicCommunication__OnStartDeviceDiscovery__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnUpdateDeviceList__notification__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnUpdateDeviceList__notification = {
- "BasicCommunication",
- "OnUpdateDeviceList",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnUpdateDeviceList,
- BasicCommunication__OnUpdateDeviceList__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnPhoneCall__notification__parameter1 = {
- "isActive", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnPhoneCall__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnPhoneCall__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnPhoneCall__notification = {
- "BasicCommunication",
- "OnPhoneCall",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnPhoneCall,
- BasicCommunication__OnPhoneCall__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnEmergencyEvent__notification__parameter1 = {
- "enabled", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnEmergencyEvent__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnEmergencyEvent__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnEmergencyEvent__notification = {
- "BasicCommunication",
- "OnEmergencyEvent",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnEmergencyEvent,
- BasicCommunication__OnEmergencyEvent__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnResumeAudioSource__notification__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnResumeAudioSource__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnResumeAudioSource__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnResumeAudioSource__notification = {
- "BasicCommunication",
- "OnResumeAudioSource",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnResumeAudioSource,
- BasicCommunication__OnResumeAudioSource__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnSDLPersistenceComplete__notification__parameters[] = {
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnSDLPersistenceComplete__notification = {
- "BasicCommunication",
- "OnSDLPersistenceComplete",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnSDLPersistenceComplete,
- BasicCommunication__OnSDLPersistenceComplete__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- BasicCommunication__UpdateAppList__request__parameter1_array = {
- {"applications", ford_message_descriptions::Struct, true},
- Structs::Common__HMIApplication__parameters};
-const ford_message_descriptions::ArrayDescription
- BasicCommunication__UpdateAppList__request__parameter1 = {
- {"applications", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__UpdateAppList__request__parameter1_array,
- "(s(bs)(bs)(ss(bi)(bb))s(ba(si))(bas)iib(bai)(bb)(bai))"};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__UpdateAppList__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__UpdateAppList__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__UpdateAppList__request = {
- "BasicCommunication",
- "UpdateAppList",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::BasicCommunication_UpdateAppList,
- BasicCommunication__UpdateAppList__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__UpdateAppList__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__UpdateAppList__response = {
- "BasicCommunication",
- "UpdateAppList",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::BasicCommunication_UpdateAppList,
- BasicCommunication__UpdateAppList__response__parameters};
-
-const ford_message_descriptions::StructDescription
- BasicCommunication__UpdateDeviceList__request__parameter1_array = {
- {"deviceList", ford_message_descriptions::Struct, true},
- Structs::Common__DeviceInfo__parameters};
-const ford_message_descriptions::ArrayDescription
- BasicCommunication__UpdateDeviceList__request__parameter1 = {
- {"deviceList", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__UpdateDeviceList__request__parameter1_array,
- "(ss(bi)(bb))"};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__UpdateDeviceList__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__UpdateDeviceList__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__UpdateDeviceList__request = {
- "BasicCommunication",
- "UpdateDeviceList",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList,
- BasicCommunication__UpdateDeviceList__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__UpdateDeviceList__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__UpdateDeviceList__response = {
- "BasicCommunication",
- "UpdateDeviceList",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList,
- BasicCommunication__UpdateDeviceList__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnFileRemoved__notification__parameter1 = {
- "fileName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnFileRemoved__notification__parameter2 = {
- "fileType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnFileRemoved__notification__parameter3 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnFileRemoved__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnFileRemoved__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnFileRemoved__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnFileRemoved__notification__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnFileRemoved__notification = {
- "BasicCommunication",
- "OnFileRemoved",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnFileRemoved,
- BasicCommunication__OnFileRemoved__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- BasicCommunication__AllowDeviceToConnect__request__parameter1 = {
- {"device", ford_message_descriptions::Struct, true},
- Structs::Common__DeviceInfo__parameters};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__AllowDeviceToConnect__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__AllowDeviceToConnect__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__AllowDeviceToConnect__request = {
- "BasicCommunication",
- "AllowDeviceToConnect",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::BasicCommunication_AllowDeviceToConnect,
- BasicCommunication__AllowDeviceToConnect__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__AllowDeviceToConnect__response__parameter1 = {
- "allow", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__AllowDeviceToConnect__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__AllowDeviceToConnect__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__AllowDeviceToConnect__response = {
- "BasicCommunication",
- "AllowDeviceToConnect",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::BasicCommunication_AllowDeviceToConnect,
- BasicCommunication__AllowDeviceToConnect__response__parameters};
-
-const ford_message_descriptions::StructDescription
- BasicCommunication__OnDeviceChosen__notification__parameter1 = {
- {"deviceInfo", ford_message_descriptions::Struct, true},
- Structs::Common__DeviceInfo__parameters};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnDeviceChosen__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnDeviceChosen__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnDeviceChosen__notification = {
- "BasicCommunication",
- "OnDeviceChosen",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnDeviceChosen,
- BasicCommunication__OnDeviceChosen__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- BasicCommunication__OnFindApplications__notification__parameter1 = {
- {"deviceInfo", ford_message_descriptions::Struct, false},
- Structs::Common__DeviceInfo__parameters};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnFindApplications__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnFindApplications__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnFindApplications__notification = {
- "BasicCommunication",
- "OnFindApplications",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnFindApplications,
- BasicCommunication__OnFindApplications__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__ActivateApp__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__ActivateApp__request__parameter2 = {
- "priority", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__ActivateApp__request__parameter3 = {
- "level", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__ActivateApp__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__ActivateApp__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__ActivateApp__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__ActivateApp__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__ActivateApp__request = {
- "BasicCommunication",
- "ActivateApp",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::BasicCommunication_ActivateApp,
- BasicCommunication__ActivateApp__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__ActivateApp__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__ActivateApp__response = {
- "BasicCommunication",
- "ActivateApp",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::BasicCommunication_ActivateApp,
- BasicCommunication__ActivateApp__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnAppActivated__notification__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnAppActivated__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppActivated__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnAppActivated__notification = {
- "BasicCommunication",
- "OnAppActivated",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnAppActivated,
- BasicCommunication__OnAppActivated__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnAppDeactivated__notification__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnAppDeactivated__notification__parameter2 = {
- "reason", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnAppDeactivated__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppDeactivated__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppDeactivated__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnAppDeactivated__notification = {
- "BasicCommunication",
- "OnAppDeactivated",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated,
- BasicCommunication__OnAppDeactivated__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- BasicCommunication__OnAppRegistered__notification__parameter1 = {
- {"application", ford_message_descriptions::Struct, true},
- Structs::Common__HMIApplication__parameters};
-const ford_message_descriptions::StructDescription
- BasicCommunication__OnAppRegistered__notification__parameter2_array = {
- {"ttsName", ford_message_descriptions::Struct, true},
- Structs::Common__TTSChunk__parameters};
-const ford_message_descriptions::ArrayDescription
- BasicCommunication__OnAppRegistered__notification__parameter2 = {
- {"ttsName", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppRegistered__notification__parameter2_array,
- "(si)"};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnAppRegistered__notification__parameter3_array = {
- "vrSynonyms", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- BasicCommunication__OnAppRegistered__notification__parameter3 = {
- {"vrSynonyms", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppRegistered__notification__parameter3_array,
- "s"};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnAppRegistered__notification__parameter4 = {
- "resumeVrGrammars", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnAppRegistered__notification__parameter5 = {
- "priority", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnAppRegistered__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppRegistered__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppRegistered__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppRegistered__notification__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppRegistered__notification__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppRegistered__notification__parameter5,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnAppRegistered__notification = {
- "BasicCommunication",
- "OnAppRegistered",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnAppRegistered,
- BasicCommunication__OnAppRegistered__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnAppUnregistered__notification__parameter1 = {
- "unexpectedDisconnect", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnAppUnregistered__notification__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnAppUnregistered__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppUnregistered__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnAppUnregistered__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnAppUnregistered__notification = {
- "BasicCommunication",
- "OnAppUnregistered",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnAppUnregistered,
- BasicCommunication__OnAppUnregistered__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnExitApplication__notification__parameter1 = {
- "reason", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnExitApplication__notification__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnExitApplication__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnExitApplication__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnExitApplication__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnExitApplication__notification = {
- "BasicCommunication",
- "OnExitApplication",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnExitApplication,
- BasicCommunication__OnExitApplication__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnExitAllApplications__notification__parameter1 = {
- "reason", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnExitAllApplications__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnExitAllApplications__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnExitAllApplications__notification = {
- "BasicCommunication",
- "OnExitAllApplications",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnExitAllApplications,
- BasicCommunication__OnExitAllApplications__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnAwakeSDL__notification__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnAwakeSDL__notification = {
- "BasicCommunication",
- "OnAwakeSDL",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnAwakeSDL,
- BasicCommunication__OnAwakeSDL__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__MixingAudioSupported__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__MixingAudioSupported__request = {
- "BasicCommunication",
- "MixingAudioSupported",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported,
- BasicCommunication__MixingAudioSupported__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__MixingAudioSupported__response__parameter1 = {
- "attenuatedSupported", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__MixingAudioSupported__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__MixingAudioSupported__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__MixingAudioSupported__response = {
- "BasicCommunication",
- "MixingAudioSupported",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported,
- BasicCommunication__MixingAudioSupported__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__PlayTone__notification__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__PlayTone__notification__parameter2 = {
- "methodName", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__PlayTone__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__PlayTone__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__PlayTone__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__PlayTone__notification = {
- "BasicCommunication",
- "PlayTone",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_PlayTone,
- BasicCommunication__PlayTone__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__DialNumber__request__parameter1 = {
- "number", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__DialNumber__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__DialNumber__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__DialNumber__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__DialNumber__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__DialNumber__request = {
- "BasicCommunication",
- "DialNumber",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::BasicCommunication_DialNumber,
- BasicCommunication__DialNumber__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__DialNumber__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__DialNumber__response = {
- "BasicCommunication",
- "DialNumber",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::BasicCommunication_DialNumber,
- BasicCommunication__DialNumber__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnSystemRequest__notification__parameter1 = {
- "requestType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnSystemRequest__notification__parameter2 = {
- "url", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnSystemRequest__notification__parameter3 = {
- "fileType", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnSystemRequest__notification__parameter4 = {
- "offset", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnSystemRequest__notification__parameter5 = {
- "length", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnSystemRequest__notification__parameter6 = {
- "timeout", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnSystemRequest__notification__parameter7 = {
- "fileName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnSystemRequest__notification__parameter8 = {
- "appID", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnSystemRequest__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnSystemRequest__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnSystemRequest__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnSystemRequest__notification__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnSystemRequest__notification__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnSystemRequest__notification__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnSystemRequest__notification__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnSystemRequest__notification__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnSystemRequest__notification__parameter8,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnSystemRequest__notification = {
- "BasicCommunication",
- "OnSystemRequest",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnSystemRequest,
- BasicCommunication__OnSystemRequest__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__SystemRequest__request__parameter1 = {
- "requestType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__SystemRequest__request__parameter2 = {
- "fileName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__SystemRequest__request__parameter3 = {
- "appID", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__SystemRequest__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__SystemRequest__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__SystemRequest__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__SystemRequest__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__SystemRequest__request = {
- "BasicCommunication",
- "SystemRequest",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::BasicCommunication_SystemRequest,
- BasicCommunication__SystemRequest__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__SystemRequest__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__SystemRequest__response = {
- "BasicCommunication",
- "SystemRequest",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::BasicCommunication_SystemRequest,
- BasicCommunication__SystemRequest__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__PolicyUpdate__request__parameter1 = {
- "file", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__PolicyUpdate__request__parameter2 = {
- "timeout", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__PolicyUpdate__request__parameter3_array = {
- "retry", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ArrayDescription
- BasicCommunication__PolicyUpdate__request__parameter3 = {
- {"retry", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__PolicyUpdate__request__parameter3_array,
- "i"};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__PolicyUpdate__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__PolicyUpdate__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__PolicyUpdate__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__PolicyUpdate__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__PolicyUpdate__request = {
- "BasicCommunication",
- "PolicyUpdate",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::BasicCommunication_PolicyUpdate,
- BasicCommunication__PolicyUpdate__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__PolicyUpdate__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__PolicyUpdate__response = {
- "BasicCommunication",
- "PolicyUpdate",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::BasicCommunication_PolicyUpdate,
- BasicCommunication__PolicyUpdate__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnSDLClose__notification__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnSDLClose__notification = {
- "BasicCommunication",
- "OnSDLClose",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnSDLClose,
- BasicCommunication__OnSDLClose__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnPutFile__notification__parameter1 = {
- "offset", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnPutFile__notification__parameter2 = {
- "length", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnPutFile__notification__parameter3 = {
- "fileSize", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnPutFile__notification__parameter4 = {
- "FileName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnPutFile__notification__parameter5 = {
- "syncFileName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnPutFile__notification__parameter6 = {
- "fileType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnPutFile__notification__parameter7 = {
- "persistentFile", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnPutFile__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnPutFile__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnPutFile__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnPutFile__notification__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnPutFile__notification__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnPutFile__notification__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnPutFile__notification__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnPutFile__notification__parameter7,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnPutFile__notification = {
- "BasicCommunication",
- "OnPutFile",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnPutFile,
- BasicCommunication__OnPutFile__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__GetSystemInfo__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__GetSystemInfo__request = {
- "BasicCommunication",
- "GetSystemInfo",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::BasicCommunication_GetSystemInfo,
- BasicCommunication__GetSystemInfo__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__GetSystemInfo__response__parameter1 = {
- "ccpu_version", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__GetSystemInfo__response__parameter2 = {
- "language", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__GetSystemInfo__response__parameter3 = {
- "wersCountryCode", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__GetSystemInfo__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__GetSystemInfo__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__GetSystemInfo__response__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__GetSystemInfo__response__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__GetSystemInfo__response = {
- "BasicCommunication",
- "GetSystemInfo",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::BasicCommunication_GetSystemInfo,
- BasicCommunication__GetSystemInfo__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnSystemInfoChanged__notification__parameter1 = {
- "language", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnSystemInfoChanged__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnSystemInfoChanged__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnSystemInfoChanged__notification = {
- "BasicCommunication",
- "OnSystemInfoChanged",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnSystemInfoChanged,
- BasicCommunication__OnSystemInfoChanged__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnIgnitionCycleOver__notification__parameters[] = {
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnIgnitionCycleOver__notification = {
- "BasicCommunication",
- "OnIgnitionCycleOver",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnIgnitionCycleOver,
- BasicCommunication__OnIgnitionCycleOver__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__DecryptCertificate__request__parameter1 = {
- "fileName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__DecryptCertificate__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__DecryptCertificate__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__DecryptCertificate__request = {
- "BasicCommunication",
- "DecryptCertificate",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::BasicCommunication_DecryptCertificate,
- BasicCommunication__DecryptCertificate__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__DecryptCertificate__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__DecryptCertificate__response = {
- "BasicCommunication",
- "DecryptCertificate",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::BasicCommunication_DecryptCertificate,
- BasicCommunication__DecryptCertificate__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnEventChanged__notification__parameter1 = {
- "eventName", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- BasicCommunication__OnEventChanged__notification__parameter2 = {
- "isActive", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- BasicCommunication__OnEventChanged__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnEventChanged__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&BasicCommunication__OnEventChanged__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- BasicCommunication__OnEventChanged__notification = {
- "BasicCommunication",
- "OnEventChanged",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::BasicCommunication_OnEventChanged,
- BasicCommunication__OnEventChanged__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VR__IsReady__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription VR__IsReady__request = {
- "VR",
- "IsReady",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VR_IsReady,
- VR__IsReady__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VR__IsReady__response__parameter1 = {
- "available", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- VR__IsReady__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VR__IsReady__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription VR__IsReady__response = {
- "VR",
- "IsReady",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VR_IsReady,
- VR__IsReady__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VR__Started__notification__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription VR__Started__notification =
- {"VR",
- "Started",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VR_Started,
- VR__Started__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VR__Stopped__notification__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription VR__Stopped__notification =
- {"VR",
- "Stopped",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VR_Stopped,
- VR__Stopped__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VR__AddCommand__request__parameter1 = {
- "cmdID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VR__AddCommand__request__parameter2_array = {
- "vrCommands", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- VR__AddCommand__request__parameter2 = {
- {"vrCommands", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&VR__AddCommand__request__parameter2_array,
- "s"};
-const ford_message_descriptions::ParameterDescription
- VR__AddCommand__request__parameter3 = {
- "type", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- VR__AddCommand__request__parameter4 = {
- "grammarID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VR__AddCommand__request__parameter5 = {
- "appID", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription*
- VR__AddCommand__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VR__AddCommand__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__AddCommand__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__AddCommand__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__AddCommand__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__AddCommand__request__parameter5,
- NULL};
-const ford_message_descriptions::MessageDescription VR__AddCommand__request = {
- "VR",
- "AddCommand",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VR_AddCommand,
- VR__AddCommand__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VR__AddCommand__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription VR__AddCommand__response = {
- "VR",
- "AddCommand",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VR_AddCommand,
- VR__AddCommand__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VR__DeleteCommand__request__parameter1 = {
- "cmdID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VR__DeleteCommand__request__parameter2 = {
- "type", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- VR__DeleteCommand__request__parameter3 = {
- "grammarID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VR__DeleteCommand__request__parameter4 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VR__DeleteCommand__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VR__DeleteCommand__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__DeleteCommand__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__DeleteCommand__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__DeleteCommand__request__parameter4,
- NULL};
-const ford_message_descriptions::MessageDescription VR__DeleteCommand__request =
- {"VR",
- "DeleteCommand",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VR_DeleteCommand,
- VR__DeleteCommand__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VR__DeleteCommand__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VR__DeleteCommand__response = {"VR",
- "DeleteCommand",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VR_DeleteCommand,
- VR__DeleteCommand__response__parameters};
-
-const ford_message_descriptions::StructDescription
- VR__PerformInteraction__request__parameter1_array = {
- {"helpPrompt", ford_message_descriptions::Struct, true},
- Structs::Common__TTSChunk__parameters};
-const ford_message_descriptions::ArrayDescription
- VR__PerformInteraction__request__parameter1 = {
- {"helpPrompt", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&VR__PerformInteraction__request__parameter1_array,
- "(si)"};
-const ford_message_descriptions::StructDescription
- VR__PerformInteraction__request__parameter2_array = {
- {"initialPrompt", ford_message_descriptions::Struct, true},
- Structs::Common__TTSChunk__parameters};
-const ford_message_descriptions::ArrayDescription
- VR__PerformInteraction__request__parameter2 = {
- {"initialPrompt", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&VR__PerformInteraction__request__parameter2_array,
- "(si)"};
-const ford_message_descriptions::StructDescription
- VR__PerformInteraction__request__parameter3_array = {
- {"timeoutPrompt", ford_message_descriptions::Struct, true},
- Structs::Common__TTSChunk__parameters};
-const ford_message_descriptions::ArrayDescription
- VR__PerformInteraction__request__parameter3 = {
- {"timeoutPrompt", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&VR__PerformInteraction__request__parameter3_array,
- "(si)"};
-const ford_message_descriptions::ParameterDescription
- VR__PerformInteraction__request__parameter4 = {
- "timeout", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VR__PerformInteraction__request__parameter5_array = {
- "grammarID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ArrayDescription
- VR__PerformInteraction__request__parameter5 = {
- {"grammarID", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&VR__PerformInteraction__request__parameter5_array,
- "i"};
-const ford_message_descriptions::ParameterDescription*
- VR__PerformInteraction__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VR__PerformInteraction__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__PerformInteraction__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__PerformInteraction__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__PerformInteraction__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__PerformInteraction__request__parameter5,
- NULL};
-const ford_message_descriptions::MessageDescription
- VR__PerformInteraction__request = {
- "VR",
- "PerformInteraction",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VR_PerformInteraction,
- VR__PerformInteraction__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VR__PerformInteraction__response__parameter1 = {
- "choiceID", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription*
- VR__PerformInteraction__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VR__PerformInteraction__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VR__PerformInteraction__response = {
- "VR",
- "PerformInteraction",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VR_PerformInteraction,
- VR__PerformInteraction__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VR__OnCommand__notification__parameter1 = {
- "cmdID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VR__OnCommand__notification__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VR__OnCommand__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VR__OnCommand__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__OnCommand__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- VR__OnCommand__notification = {"VR",
- "OnCommand",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VR_OnCommand,
- VR__OnCommand__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VR__ChangeRegistration__request__parameter1_array = {
- "vrSynonyms", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- VR__ChangeRegistration__request__parameter1 = {
- {"vrSynonyms", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&VR__ChangeRegistration__request__parameter1_array,
- "s"};
-const ford_message_descriptions::ParameterDescription
- VR__ChangeRegistration__request__parameter2 = {
- "language", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- VR__ChangeRegistration__request__parameter3 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VR__ChangeRegistration__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VR__ChangeRegistration__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__ChangeRegistration__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VR__ChangeRegistration__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- VR__ChangeRegistration__request = {
- "VR",
- "ChangeRegistration",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VR_ChangeRegistration,
- VR__ChangeRegistration__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VR__ChangeRegistration__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VR__ChangeRegistration__response = {
- "VR",
- "ChangeRegistration",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VR_ChangeRegistration,
- VR__ChangeRegistration__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VR__OnLanguageChange__notification__parameter1 = {
- "language", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- VR__OnLanguageChange__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VR__OnLanguageChange__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VR__OnLanguageChange__notification = {
- "VR",
- "OnLanguageChange",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VR_OnLanguageChange,
- VR__OnLanguageChange__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VR__GetSupportedLanguages__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VR__GetSupportedLanguages__request = {
- "VR",
- "GetSupportedLanguages",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VR_GetSupportedLanguages,
- VR__GetSupportedLanguages__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VR__GetSupportedLanguages__response__parameter1_array = {
- "languages", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- VR__GetSupportedLanguages__response__parameter1 = {
- {"languages", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&VR__GetSupportedLanguages__response__parameter1_array,
- "i"};
-const ford_message_descriptions::ParameterDescription*
- VR__GetSupportedLanguages__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VR__GetSupportedLanguages__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VR__GetSupportedLanguages__response = {
- "VR",
- "GetSupportedLanguages",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VR_GetSupportedLanguages,
- VR__GetSupportedLanguages__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VR__GetLanguage__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription VR__GetLanguage__request = {
- "VR",
- "GetLanguage",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VR_GetLanguage,
- VR__GetLanguage__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VR__GetLanguage__response__parameter1 = {
- "language", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- VR__GetLanguage__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VR__GetLanguage__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription VR__GetLanguage__response =
- {"VR",
- "GetLanguage",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VR_GetLanguage,
- VR__GetLanguage__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VR__GetCapabilities__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VR__GetCapabilities__request = {"VR",
- "GetCapabilities",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VR_GetCapabilities,
- VR__GetCapabilities__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VR__GetCapabilities__response__parameter1_array = {
- "vrCapabilities", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- VR__GetCapabilities__response__parameter1 = {
- {"vrCapabilities", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&VR__GetCapabilities__response__parameter1_array,
- "i"};
-const ford_message_descriptions::ParameterDescription*
- VR__GetCapabilities__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VR__GetCapabilities__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VR__GetCapabilities__response = {"VR",
- "GetCapabilities",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VR_GetCapabilities,
- VR__GetCapabilities__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- TTS__GetCapabilities__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- TTS__GetCapabilities__request = {"TTS",
- "GetCapabilities",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::TTS_GetCapabilities,
- TTS__GetCapabilities__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- TTS__GetCapabilities__response__parameter1_array = {
- "speechCapabilities", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- TTS__GetCapabilities__response__parameter1 = {
- {"speechCapabilities", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__GetCapabilities__response__parameter1_array,
- "i"};
-const ford_message_descriptions::ParameterDescription
- TTS__GetCapabilities__response__parameter2_array = {
- "prerecordedSpeechCapabilities", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- TTS__GetCapabilities__response__parameter2 = {
- {"prerecordedSpeechCapabilities",
- ford_message_descriptions::Array,
- true},
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__GetCapabilities__response__parameter2_array,
- "i"};
-const ford_message_descriptions::ParameterDescription*
- TTS__GetCapabilities__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__GetCapabilities__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__GetCapabilities__response__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- TTS__GetCapabilities__response = {
- "TTS",
- "GetCapabilities",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::TTS_GetCapabilities,
- TTS__GetCapabilities__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- TTS__Started__notification__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription TTS__Started__notification =
- {"TTS",
- "Started",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::TTS_Started,
- TTS__Started__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- TTS__Stopped__notification__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription TTS__Stopped__notification =
- {"TTS",
- "Stopped",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::TTS_Stopped,
- TTS__Stopped__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- TTS__IsReady__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription TTS__IsReady__request = {
- "TTS",
- "IsReady",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::TTS_IsReady,
- TTS__IsReady__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- TTS__IsReady__response__parameter1 = {
- "available", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- TTS__IsReady__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__IsReady__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription TTS__IsReady__response = {
- "TTS",
- "IsReady",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::TTS_IsReady,
- TTS__IsReady__response__parameters};
-
-const ford_message_descriptions::StructDescription
- TTS__Speak__request__parameter1_array = {
- {"ttsChunks", ford_message_descriptions::Struct, true},
- Structs::Common__TTSChunk__parameters};
-const ford_message_descriptions::ArrayDescription
- TTS__Speak__request__parameter1 = {
- {"ttsChunks", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__Speak__request__parameter1_array,
- "(si)"};
-const ford_message_descriptions::ParameterDescription
- TTS__Speak__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- TTS__Speak__request__parameter3 = {
- "speakType", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription*
- TTS__Speak__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__Speak__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__Speak__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__Speak__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription TTS__Speak__request = {
- "TTS",
- "Speak",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::TTS_Speak,
- TTS__Speak__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- TTS__Speak__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription TTS__Speak__response = {
- "TTS",
- "Speak",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::TTS_Speak,
- TTS__Speak__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- TTS__StopSpeaking__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription TTS__StopSpeaking__request =
- {"TTS",
- "StopSpeaking",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::TTS_StopSpeaking,
- TTS__StopSpeaking__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- TTS__StopSpeaking__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- TTS__StopSpeaking__response = {"TTS",
- "StopSpeaking",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::TTS_StopSpeaking,
- TTS__StopSpeaking__response__parameters};
-
-const ford_message_descriptions::StructDescription
- TTS__ChangeRegistration__request__parameter1_array = {
- {"ttsName", ford_message_descriptions::Struct, true},
- Structs::Common__TTSChunk__parameters};
-const ford_message_descriptions::ArrayDescription
- TTS__ChangeRegistration__request__parameter1 = {
- {"ttsName", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__ChangeRegistration__request__parameter1_array,
- "(si)"};
-const ford_message_descriptions::ParameterDescription
- TTS__ChangeRegistration__request__parameter2 = {
- "language", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- TTS__ChangeRegistration__request__parameter3 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- TTS__ChangeRegistration__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__ChangeRegistration__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__ChangeRegistration__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__ChangeRegistration__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- TTS__ChangeRegistration__request = {
- "TTS",
- "ChangeRegistration",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::TTS_ChangeRegistration,
- TTS__ChangeRegistration__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- TTS__ChangeRegistration__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- TTS__ChangeRegistration__response = {
- "TTS",
- "ChangeRegistration",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::TTS_ChangeRegistration,
- TTS__ChangeRegistration__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- TTS__OnLanguageChange__notification__parameter1 = {
- "language", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- TTS__OnLanguageChange__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__OnLanguageChange__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- TTS__OnLanguageChange__notification = {
- "TTS",
- "OnLanguageChange",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::TTS_OnLanguageChange,
- TTS__OnLanguageChange__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- TTS__GetSupportedLanguages__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- TTS__GetSupportedLanguages__request = {
- "TTS",
- "GetSupportedLanguages",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::TTS_GetSupportedLanguages,
- TTS__GetSupportedLanguages__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- TTS__GetSupportedLanguages__response__parameter1_array = {
- "languages", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- TTS__GetSupportedLanguages__response__parameter1 = {
- {"languages", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__GetSupportedLanguages__response__parameter1_array,
- "i"};
-const ford_message_descriptions::ParameterDescription*
- TTS__GetSupportedLanguages__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__GetSupportedLanguages__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- TTS__GetSupportedLanguages__response = {
- "TTS",
- "GetSupportedLanguages",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::TTS_GetSupportedLanguages,
- TTS__GetSupportedLanguages__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- TTS__GetLanguage__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription TTS__GetLanguage__request =
- {"TTS",
- "GetLanguage",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::TTS_GetLanguage,
- TTS__GetLanguage__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- TTS__GetLanguage__response__parameter1 = {
- "language", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- TTS__GetLanguage__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__GetLanguage__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription TTS__GetLanguage__response =
- {"TTS",
- "GetLanguage",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::TTS_GetLanguage,
- TTS__GetLanguage__response__parameters};
-
-const ford_message_descriptions::StructDescription
- TTS__SetGlobalProperties__request__parameter1_array = {
- {"helpPrompt", ford_message_descriptions::Struct, true},
- Structs::Common__TTSChunk__parameters};
-const ford_message_descriptions::ArrayDescription
- TTS__SetGlobalProperties__request__parameter1 = {
- {"helpPrompt", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__SetGlobalProperties__request__parameter1_array,
- "(si)"};
-const ford_message_descriptions::StructDescription
- TTS__SetGlobalProperties__request__parameter2_array = {
- {"timeoutPrompt", ford_message_descriptions::Struct, true},
- Structs::Common__TTSChunk__parameters};
-const ford_message_descriptions::ArrayDescription
- TTS__SetGlobalProperties__request__parameter2 = {
- {"timeoutPrompt", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__SetGlobalProperties__request__parameter2_array,
- "(si)"};
-const ford_message_descriptions::ParameterDescription
- TTS__SetGlobalProperties__request__parameter3 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- TTS__SetGlobalProperties__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__SetGlobalProperties__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__SetGlobalProperties__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__SetGlobalProperties__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- TTS__SetGlobalProperties__request = {
- "TTS",
- "SetGlobalProperties",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::TTS_SetGlobalProperties,
- TTS__SetGlobalProperties__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- TTS__SetGlobalProperties__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- TTS__SetGlobalProperties__response = {
- "TTS",
- "SetGlobalProperties",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::TTS_SetGlobalProperties,
- TTS__SetGlobalProperties__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- TTS__OnResetTimeout__notification__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- TTS__OnResetTimeout__notification__parameter2 = {
- "methodName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- TTS__OnResetTimeout__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__OnResetTimeout__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&TTS__OnResetTimeout__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- TTS__OnResetTimeout__notification = {
- "TTS",
- "OnResetTimeout",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::TTS_OnResetTimeout,
- TTS__OnResetTimeout__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- UI__Alert__request__parameter1_array = {
- {"alertStrings", ford_message_descriptions::Struct, true},
- Structs::Common__TextFieldStruct__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__Alert__request__parameter1 = {
- {"alertStrings", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Alert__request__parameter1_array,
- "(is)"};
-const ford_message_descriptions::ParameterDescription
- UI__Alert__request__parameter2 = {
- "duration", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::StructDescription
- UI__Alert__request__parameter3_array = {
- {"softButtons", ford_message_descriptions::Struct, true},
- Structs::Common__SoftButton__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__Alert__request__parameter3 = {
- {"softButtons", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Alert__request__parameter3_array,
- "(i(bs)(b(si))(bb)ii)"};
-const ford_message_descriptions::ParameterDescription
- UI__Alert__request__parameter4 = {
- "progressIndicator", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- UI__Alert__request__parameter5 = {
- "alertType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- UI__Alert__request__parameter6 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__Alert__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Alert__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Alert__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Alert__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Alert__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Alert__request__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Alert__request__parameter6,
- NULL};
-const ford_message_descriptions::MessageDescription UI__Alert__request = {
- "UI",
- "Alert",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_Alert,
- UI__Alert__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__Alert__response__parameter1 = {
- "tryAgainTime", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription*
- UI__Alert__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Alert__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription UI__Alert__response = {
- "UI",
- "Alert",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_Alert,
- UI__Alert__response__parameters};
-
-const ford_message_descriptions::StructDescription
- UI__Show__request__parameter1_array = {
- {"showStrings", ford_message_descriptions::Struct, true},
- Structs::Common__TextFieldStruct__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__Show__request__parameter1 = {
- {"showStrings", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Show__request__parameter1_array,
- "(is)"};
-const ford_message_descriptions::ParameterDescription
- UI__Show__request__parameter2 = {
- "alignment", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::StructDescription
- UI__Show__request__parameter3 = {
- {"graphic", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::StructDescription
- UI__Show__request__parameter4 = {
- {"secondaryGraphic", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::StructDescription
- UI__Show__request__parameter5_array = {
- {"softButtons", ford_message_descriptions::Struct, true},
- Structs::Common__SoftButton__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__Show__request__parameter5 = {
- {"softButtons", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Show__request__parameter5_array,
- "(i(bs)(b(si))(bb)ii)"};
-const ford_message_descriptions::ParameterDescription
- UI__Show__request__parameter6_array = {
- "customPresets", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- UI__Show__request__parameter6 = {
- {"customPresets", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Show__request__parameter6_array,
- "s"};
-const ford_message_descriptions::ParameterDescription
- UI__Show__request__parameter7 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__Show__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Show__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Show__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Show__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Show__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Show__request__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Show__request__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Show__request__parameter7,
- NULL};
-const ford_message_descriptions::MessageDescription UI__Show__request = {
- "UI",
- "Show",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_Show,
- UI__Show__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__Show__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription UI__Show__response = {
- "UI",
- "Show",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_Show,
- UI__Show__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__AddCommand__request__parameter1 = {
- "cmdID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::StructDescription
- UI__AddCommand__request__parameter2 = {
- {"menuParams", ford_message_descriptions::Struct, false},
- Structs::Common__MenuParams__parameters};
-const ford_message_descriptions::StructDescription
- UI__AddCommand__request__parameter3 = {
- {"cmdIcon", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::ParameterDescription
- UI__AddCommand__request__parameter4 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__AddCommand__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__AddCommand__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__AddCommand__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__AddCommand__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__AddCommand__request__parameter4,
- NULL};
-const ford_message_descriptions::MessageDescription UI__AddCommand__request = {
- "UI",
- "AddCommand",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_AddCommand,
- UI__AddCommand__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__AddCommand__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription UI__AddCommand__response = {
- "UI",
- "AddCommand",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_AddCommand,
- UI__AddCommand__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__DeleteCommand__request__parameter1 = {
- "cmdID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- UI__DeleteCommand__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__DeleteCommand__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__DeleteCommand__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__DeleteCommand__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription UI__DeleteCommand__request =
- {"UI",
- "DeleteCommand",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_DeleteCommand,
- UI__DeleteCommand__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__DeleteCommand__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__DeleteCommand__response = {"UI",
- "DeleteCommand",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_DeleteCommand,
- UI__DeleteCommand__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__AddSubMenu__request__parameter1 = {
- "menuID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::StructDescription
- UI__AddSubMenu__request__parameter2 = {
- {"menuParams", ford_message_descriptions::Struct, true},
- Structs::Common__MenuParams__parameters};
-const ford_message_descriptions::ParameterDescription
- UI__AddSubMenu__request__parameter3 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__AddSubMenu__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__AddSubMenu__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__AddSubMenu__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__AddSubMenu__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription UI__AddSubMenu__request = {
- "UI",
- "AddSubMenu",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_AddSubMenu,
- UI__AddSubMenu__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__AddSubMenu__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription UI__AddSubMenu__response = {
- "UI",
- "AddSubMenu",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_AddSubMenu,
- UI__AddSubMenu__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__DeleteSubMenu__request__parameter1 = {
- "menuID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- UI__DeleteSubMenu__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__DeleteSubMenu__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__DeleteSubMenu__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__DeleteSubMenu__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription UI__DeleteSubMenu__request =
- {"UI",
- "DeleteSubMenu",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_DeleteSubMenu,
- UI__DeleteSubMenu__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__DeleteSubMenu__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__DeleteSubMenu__response = {"UI",
- "DeleteSubMenu",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_DeleteSubMenu,
- UI__DeleteSubMenu__response__parameters};
-
-const ford_message_descriptions::StructDescription
- UI__PerformInteraction__request__parameter1 = {
- {"initialText", ford_message_descriptions::Struct, false},
- Structs::Common__TextFieldStruct__parameters};
-const ford_message_descriptions::StructDescription
- UI__PerformInteraction__request__parameter2_array = {
- {"choiceSet", ford_message_descriptions::Struct, true},
- Structs::Common__Choice__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__PerformInteraction__request__parameter2 = {
- {"choiceSet", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformInteraction__request__parameter2_array,
- "(i(bs)(b(si))(bs)(bs)(b(si)))"};
-const ford_message_descriptions::ParameterDescription
- UI__PerformInteraction__request__parameter3 = {
- "vrHelpTitle", ford_message_descriptions::String, false};
-const ford_message_descriptions::StructDescription
- UI__PerformInteraction__request__parameter4_array = {
- {"vrHelp", ford_message_descriptions::Struct, true},
- Structs::Common__VrHelpItem__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__PerformInteraction__request__parameter4 = {
- {"vrHelp", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformInteraction__request__parameter4_array,
- "(s(b(si))i)"};
-const ford_message_descriptions::ParameterDescription
- UI__PerformInteraction__request__parameter5 = {
- "timeout", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- UI__PerformInteraction__request__parameter6 = {
- "interactionLayout", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- UI__PerformInteraction__request__parameter7 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__PerformInteraction__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformInteraction__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformInteraction__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformInteraction__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformInteraction__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformInteraction__request__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformInteraction__request__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformInteraction__request__parameter7,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__PerformInteraction__request = {
- "UI",
- "PerformInteraction",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_PerformInteraction,
- UI__PerformInteraction__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__PerformInteraction__response__parameter1 = {
- "choiceID", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- UI__PerformInteraction__response__parameter2 = {
- "manualTextEntry", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- UI__PerformInteraction__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformInteraction__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformInteraction__response__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__PerformInteraction__response = {
- "UI",
- "PerformInteraction",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_PerformInteraction,
- UI__PerformInteraction__response__parameters};
-
-const ford_message_descriptions::StructDescription
- UI__SetMediaClockTimer__request__parameter1 = {
- {"startTime", ford_message_descriptions::Struct, false},
- Structs::Common__TimeFormat__parameters};
-const ford_message_descriptions::StructDescription
- UI__SetMediaClockTimer__request__parameter2 = {
- {"endTime", ford_message_descriptions::Struct, false},
- Structs::Common__TimeFormat__parameters};
-const ford_message_descriptions::ParameterDescription
- UI__SetMediaClockTimer__request__parameter3 = {
- "updateMode", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- UI__SetMediaClockTimer__request__parameter4 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__SetMediaClockTimer__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetMediaClockTimer__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetMediaClockTimer__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetMediaClockTimer__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetMediaClockTimer__request__parameter4,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__SetMediaClockTimer__request = {
- "UI",
- "SetMediaClockTimer",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_SetMediaClockTimer,
- UI__SetMediaClockTimer__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__SetMediaClockTimer__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__SetMediaClockTimer__response = {
- "UI",
- "SetMediaClockTimer",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_SetMediaClockTimer,
- UI__SetMediaClockTimer__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__SetGlobalProperties__request__parameter1 = {
- "vrHelpTitle", ford_message_descriptions::String, false};
-const ford_message_descriptions::StructDescription
- UI__SetGlobalProperties__request__parameter2_array = {
- {"vrHelp", ford_message_descriptions::Struct, true},
- Structs::Common__VrHelpItem__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__SetGlobalProperties__request__parameter2 = {
- {"vrHelp", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetGlobalProperties__request__parameter2_array,
- "(s(b(si))i)"};
-const ford_message_descriptions::ParameterDescription
- UI__SetGlobalProperties__request__parameter3 = {
- "menuTitle", ford_message_descriptions::String, false};
-const ford_message_descriptions::StructDescription
- UI__SetGlobalProperties__request__parameter4 = {
- {"menuIcon", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::StructDescription
- UI__SetGlobalProperties__request__parameter5 = {
- {"keyboardProperties", ford_message_descriptions::Struct, false},
- Structs::Common__KeyboardProperties__parameters};
-const ford_message_descriptions::ParameterDescription
- UI__SetGlobalProperties__request__parameter6 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__SetGlobalProperties__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetGlobalProperties__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetGlobalProperties__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetGlobalProperties__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetGlobalProperties__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetGlobalProperties__request__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetGlobalProperties__request__parameter6,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__SetGlobalProperties__request = {
- "UI",
- "SetGlobalProperties",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_SetGlobalProperties,
- UI__SetGlobalProperties__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__SetGlobalProperties__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__SetGlobalProperties__response = {
- "UI",
- "SetGlobalProperties",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_SetGlobalProperties,
- UI__SetGlobalProperties__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__OnCommand__notification__parameter1 = {
- "cmdID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- UI__OnCommand__notification__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__OnCommand__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnCommand__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnCommand__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__OnCommand__notification = {"UI",
- "OnCommand",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::UI_OnCommand,
- UI__OnCommand__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__OnSystemContext__notification__parameter1 = {
- "systemContext", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- UI__OnSystemContext__notification__parameter2 = {
- "appID", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription*
- UI__OnSystemContext__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnSystemContext__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnSystemContext__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__OnSystemContext__notification = {
- "UI",
- "OnSystemContext",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::UI_OnSystemContext,
- UI__OnSystemContext__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__GetCapabilities__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__GetCapabilities__request = {"UI",
- "GetCapabilities",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_GetCapabilities,
- UI__GetCapabilities__request__parameters};
-
-const ford_message_descriptions::StructDescription
- UI__GetCapabilities__response__parameter1 = {
- {"displayCapabilities", ford_message_descriptions::Struct, true},
- Structs::Common__DisplayCapabilities__parameters};
-const ford_message_descriptions::StructDescription
- UI__GetCapabilities__response__parameter2 = {
- {"audioPassThruCapabilities", ford_message_descriptions::Struct, true},
- Structs::Common__AudioPassThruCapabilities__parameters};
-const ford_message_descriptions::ParameterDescription
- UI__GetCapabilities__response__parameter3 = {
- "hmiZoneCapabilities", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::StructDescription
- UI__GetCapabilities__response__parameter4_array = {
- {"softButtonCapabilities", ford_message_descriptions::Struct, true},
- Structs::Common__SoftButtonCapabilities__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__GetCapabilities__response__parameter4 = {
- {"softButtonCapabilities", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__GetCapabilities__response__parameter4_array,
- "(bbbb)"};
-const ford_message_descriptions::StructDescription
- UI__GetCapabilities__response__parameter5 = {
- {"hmiCapabilities", ford_message_descriptions::Struct, false},
- Structs::Common__HMICapabilities__parameters};
-const ford_message_descriptions::ParameterDescription*
- UI__GetCapabilities__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__GetCapabilities__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__GetCapabilities__response__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__GetCapabilities__response__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__GetCapabilities__response__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__GetCapabilities__response__parameter5,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__GetCapabilities__response = {"UI",
- "GetCapabilities",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_GetCapabilities,
- UI__GetCapabilities__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__ChangeRegistration__request__parameter1 = {
- "appName", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- UI__ChangeRegistration__request__parameter2 = {
- "ngnMediaScreenAppName", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- UI__ChangeRegistration__request__parameter3 = {
- "language", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- UI__ChangeRegistration__request__parameter4_array = {
- "appHMIType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- UI__ChangeRegistration__request__parameter4 = {
- {"appHMIType", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ChangeRegistration__request__parameter4_array,
- "i"};
-const ford_message_descriptions::ParameterDescription
- UI__ChangeRegistration__request__parameter5 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__ChangeRegistration__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ChangeRegistration__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ChangeRegistration__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ChangeRegistration__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ChangeRegistration__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ChangeRegistration__request__parameter5,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__ChangeRegistration__request = {
- "UI",
- "ChangeRegistration",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_ChangeRegistration,
- UI__ChangeRegistration__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__ChangeRegistration__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__ChangeRegistration__response = {
- "UI",
- "ChangeRegistration",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_ChangeRegistration,
- UI__ChangeRegistration__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__OnLanguageChange__notification__parameter1 = {
- "language", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- UI__OnLanguageChange__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnLanguageChange__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__OnLanguageChange__notification = {
- "UI",
- "OnLanguageChange",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::UI_OnLanguageChange,
- UI__OnLanguageChange__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__GetSupportedLanguages__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__GetSupportedLanguages__request = {
- "UI",
- "GetSupportedLanguages",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_GetSupportedLanguages,
- UI__GetSupportedLanguages__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__GetSupportedLanguages__response__parameter1_array = {
- "languages", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- UI__GetSupportedLanguages__response__parameter1 = {
- {"languages", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__GetSupportedLanguages__response__parameter1_array,
- "i"};
-const ford_message_descriptions::ParameterDescription*
- UI__GetSupportedLanguages__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__GetSupportedLanguages__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__GetSupportedLanguages__response = {
- "UI",
- "GetSupportedLanguages",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_GetSupportedLanguages,
- UI__GetSupportedLanguages__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__GetLanguage__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription UI__GetLanguage__request = {
- "UI",
- "GetLanguage",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_GetLanguage,
- UI__GetLanguage__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__GetLanguage__response__parameter1 = {
- "language", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- UI__GetLanguage__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__GetLanguage__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription UI__GetLanguage__response =
- {"UI",
- "GetLanguage",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_GetLanguage,
- UI__GetLanguage__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__OnDriverDistraction__notification__parameter1 = {
- "state", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- UI__OnDriverDistraction__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnDriverDistraction__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__OnDriverDistraction__notification = {
- "UI",
- "OnDriverDistraction",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::UI_OnDriverDistraction,
- UI__OnDriverDistraction__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- UI__SetAppIcon__request__parameter1 = {
- {"syncFileName", ford_message_descriptions::Struct, true},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::ParameterDescription
- UI__SetAppIcon__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__SetAppIcon__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetAppIcon__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetAppIcon__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription UI__SetAppIcon__request = {
- "UI",
- "SetAppIcon",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_SetAppIcon,
- UI__SetAppIcon__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__SetAppIcon__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription UI__SetAppIcon__response = {
- "UI",
- "SetAppIcon",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_SetAppIcon,
- UI__SetAppIcon__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__SetDisplayLayout__request__parameter1 = {
- "displayLayout", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- UI__SetDisplayLayout__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__SetDisplayLayout__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetDisplayLayout__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetDisplayLayout__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__SetDisplayLayout__request = {"UI",
- "SetDisplayLayout",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_SetDisplayLayout,
- UI__SetDisplayLayout__request__parameters};
-
-const ford_message_descriptions::StructDescription
- UI__SetDisplayLayout__response__parameter1 = {
- {"displayCapabilities", ford_message_descriptions::Struct, false},
- Structs::Common__DisplayCapabilities__parameters};
-const ford_message_descriptions::StructDescription
- UI__SetDisplayLayout__response__parameter2_array = {
- {"buttonCapabilities", ford_message_descriptions::Struct, true},
- Structs::Common__ButtonCapabilities__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__SetDisplayLayout__response__parameter2 = {
- {"buttonCapabilities", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetDisplayLayout__response__parameter2_array,
- "(ibbb)"};
-const ford_message_descriptions::StructDescription
- UI__SetDisplayLayout__response__parameter3_array = {
- {"softButtonCapabilities", ford_message_descriptions::Struct, true},
- Structs::Common__SoftButtonCapabilities__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__SetDisplayLayout__response__parameter3 = {
- {"softButtonCapabilities", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetDisplayLayout__response__parameter3_array,
- "(bbbb)"};
-const ford_message_descriptions::StructDescription
- UI__SetDisplayLayout__response__parameter4 = {
- {"presetBankCapabilities", ford_message_descriptions::Struct, false},
- Structs::Common__PresetBankCapabilities__parameters};
-const ford_message_descriptions::ParameterDescription*
- UI__SetDisplayLayout__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetDisplayLayout__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetDisplayLayout__response__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetDisplayLayout__response__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SetDisplayLayout__response__parameter4,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__SetDisplayLayout__response = {
- "UI",
- "SetDisplayLayout",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_SetDisplayLayout,
- UI__SetDisplayLayout__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__ShowCustomForm__request__parameter1 = {
- "customFormID", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- UI__ShowCustomForm__request__parameter2 = {
- "parentFormID", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- UI__ShowCustomForm__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ShowCustomForm__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ShowCustomForm__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__ShowCustomForm__request = {"UI",
- "ShowCustomForm",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_ShowCustomForm,
- UI__ShowCustomForm__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__ShowCustomForm__response__parameter1 = {
- "info", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- UI__ShowCustomForm__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ShowCustomForm__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__ShowCustomForm__response = {"UI",
- "ShowCustomForm",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_ShowCustomForm,
- UI__ShowCustomForm__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__OnKeyboardInput__notification__parameter1 = {
- "event", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- UI__OnKeyboardInput__notification__parameter2 = {
- "data", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- UI__OnKeyboardInput__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnKeyboardInput__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnKeyboardInput__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__OnKeyboardInput__notification = {
- "UI",
- "OnKeyboardInput",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::UI_OnKeyboardInput,
- UI__OnKeyboardInput__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__OnTouchEvent__notification__parameter1 = {
- "type", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::StructDescription
- UI__OnTouchEvent__notification__parameter2_array = {
- {"event", ford_message_descriptions::Struct, true},
- Structs::Common__TouchEvent__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__OnTouchEvent__notification__parameter2 = {
- {"event", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnTouchEvent__notification__parameter2_array,
- "(iaia(ii))"};
-const ford_message_descriptions::ParameterDescription*
- UI__OnTouchEvent__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnTouchEvent__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnTouchEvent__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__OnTouchEvent__notification = {
- "UI",
- "OnTouchEvent",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::UI_OnTouchEvent,
- UI__OnTouchEvent__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__Slider__request__parameter1 = {
- "numTicks", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- UI__Slider__request__parameter2 = {
- "position", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- UI__Slider__request__parameter3 = {
- "sliderHeader", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- UI__Slider__request__parameter4_array = {
- "sliderFooter", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- UI__Slider__request__parameter4 = {
- {"sliderFooter", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Slider__request__parameter4_array,
- "s"};
-const ford_message_descriptions::ParameterDescription
- UI__Slider__request__parameter5 = {
- "timeout", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- UI__Slider__request__parameter6 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__Slider__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Slider__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Slider__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Slider__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Slider__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Slider__request__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Slider__request__parameter6,
- NULL};
-const ford_message_descriptions::MessageDescription UI__Slider__request = {
- "UI",
- "Slider",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_Slider,
- UI__Slider__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__Slider__response__parameter1 = {
- "sliderPosition", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription*
- UI__Slider__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__Slider__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription UI__Slider__response = {
- "UI",
- "Slider",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_Slider,
- UI__Slider__response__parameters};
-
-const ford_message_descriptions::StructDescription
- UI__ScrollableMessage__request__parameter1 = {
- {"messageText", ford_message_descriptions::Struct, true},
- Structs::Common__TextFieldStruct__parameters};
-const ford_message_descriptions::ParameterDescription
- UI__ScrollableMessage__request__parameter2 = {
- "timeout", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::StructDescription
- UI__ScrollableMessage__request__parameter3_array = {
- {"softButtons", ford_message_descriptions::Struct, true},
- Structs::Common__SoftButton__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__ScrollableMessage__request__parameter3 = {
- {"softButtons", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ScrollableMessage__request__parameter3_array,
- "(i(bs)(b(si))(bb)ii)"};
-const ford_message_descriptions::ParameterDescription
- UI__ScrollableMessage__request__parameter4 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__ScrollableMessage__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ScrollableMessage__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ScrollableMessage__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ScrollableMessage__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ScrollableMessage__request__parameter4,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__ScrollableMessage__request = {
- "UI",
- "ScrollableMessage",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_ScrollableMessage,
- UI__ScrollableMessage__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__ScrollableMessage__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__ScrollableMessage__response = {
- "UI",
- "ScrollableMessage",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_ScrollableMessage,
- UI__ScrollableMessage__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__PerformAudioPassThru__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::StructDescription
- UI__PerformAudioPassThru__request__parameter2_array = {
- {"audioPassThruDisplayTexts", ford_message_descriptions::Struct, true},
- Structs::Common__TextFieldStruct__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__PerformAudioPassThru__request__parameter2 = {
- {"audioPassThruDisplayTexts", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformAudioPassThru__request__parameter2_array,
- "(is)"};
-const ford_message_descriptions::ParameterDescription
- UI__PerformAudioPassThru__request__parameter3 = {
- "maxDuration", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- UI__PerformAudioPassThru__request__parameter4 = {
- "muteAudio", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- UI__PerformAudioPassThru__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformAudioPassThru__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformAudioPassThru__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformAudioPassThru__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__PerformAudioPassThru__request__parameter4,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__PerformAudioPassThru__request = {
- "UI",
- "PerformAudioPassThru",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_PerformAudioPassThru,
- UI__PerformAudioPassThru__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__PerformAudioPassThru__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__PerformAudioPassThru__response = {
- "UI",
- "PerformAudioPassThru",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_PerformAudioPassThru,
- UI__PerformAudioPassThru__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__EndAudioPassThru__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__EndAudioPassThru__request = {"UI",
- "EndAudioPassThru",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_EndAudioPassThru,
- UI__EndAudioPassThru__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__EndAudioPassThru__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__EndAudioPassThru__response = {
- "UI",
- "EndAudioPassThru",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_EndAudioPassThru,
- UI__EndAudioPassThru__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__IsReady__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription UI__IsReady__request = {
- "UI",
- "IsReady",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_IsReady,
- UI__IsReady__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__IsReady__response__parameter1 = {
- "available", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- UI__IsReady__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__IsReady__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription UI__IsReady__response = {
- "UI",
- "IsReady",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_IsReady,
- UI__IsReady__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__ClosePopUp__request__parameter1 = {
- "methodName", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription*
- UI__ClosePopUp__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__ClosePopUp__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription UI__ClosePopUp__request = {
- "UI",
- "ClosePopUp",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_ClosePopUp,
- UI__ClosePopUp__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__ClosePopUp__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription UI__ClosePopUp__response = {
- "UI",
- "ClosePopUp",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_ClosePopUp,
- UI__ClosePopUp__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__OnResetTimeout__notification__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- UI__OnResetTimeout__notification__parameter2 = {
- "methodName", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- UI__OnResetTimeout__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnResetTimeout__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnResetTimeout__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__OnResetTimeout__notification = {
- "UI",
- "OnResetTimeout",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::UI_OnResetTimeout,
- UI__OnResetTimeout__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__OnRecordStart__notification__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- UI__OnRecordStart__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__OnRecordStart__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__OnRecordStart__notification = {
- "UI",
- "OnRecordStart",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::UI_OnRecordStart,
- UI__OnRecordStart__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- UI__SendHapticData__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::StructDescription
- UI__SendHapticData__request__parameter2_array = {
- {"hapticRectData", ford_message_descriptions::Struct, true},
- Structs::Common__HapticRect__parameters};
-const ford_message_descriptions::ArrayDescription
- UI__SendHapticData__request__parameter2 = {
- {"hapticRectData", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SendHapticData__request__parameter2_array,
- "(i(dddd))"};
-const ford_message_descriptions::ParameterDescription*
- UI__SendHapticData__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SendHapticData__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&UI__SendHapticData__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- UI__SendHapticData__request = {"UI",
- "SendHapticData",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::UI_SendHapticData,
- UI__SendHapticData__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- UI__SendHapticData__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- UI__SendHapticData__response = {"UI",
- "SendHapticData",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::UI_SendHapticData,
- UI__SendHapticData__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__IsReady__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__IsReady__request = {"Navigation",
- "IsReady",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_IsReady,
- Navigation__IsReady__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__IsReady__response__parameter1 = {
- "available", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__IsReady__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__IsReady__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__IsReady__response = {"Navigation",
- "IsReady",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_IsReady,
- Navigation__IsReady__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__SendLocation__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- Navigation__SendLocation__request__parameter2 = {
- "longitudeDegrees", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription
- Navigation__SendLocation__request__parameter3 = {
- "latitudeDegrees", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription
- Navigation__SendLocation__request__parameter4 = {
- "locationName", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Navigation__SendLocation__request__parameter5 = {
- "locationDescription", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- Navigation__SendLocation__request__parameter6_array = {
- "addressLines", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- Navigation__SendLocation__request__parameter6 = {
- {"addressLines", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SendLocation__request__parameter6_array,
- "s"};
-const ford_message_descriptions::ParameterDescription
- Navigation__SendLocation__request__parameter7 = {
- "phoneNumber", ford_message_descriptions::String, false};
-const ford_message_descriptions::StructDescription
- Navigation__SendLocation__request__parameter8 = {
- {"locationImage", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::ParameterDescription*
- Navigation__SendLocation__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SendLocation__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SendLocation__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SendLocation__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SendLocation__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SendLocation__request__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SendLocation__request__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SendLocation__request__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SendLocation__request__parameter8,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__SendLocation__request = {
- "Navigation",
- "SendLocation",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_SendLocation,
- Navigation__SendLocation__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__SendLocation__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__SendLocation__response = {
- "Navigation",
- "SendLocation",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_SendLocation,
- Navigation__SendLocation__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__DialNumber__request__parameter1 = {
- "number", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__DialNumber__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__DialNumber__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__DialNumber__request = {
- "Navigation",
- "DialNumber",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_DialNumber,
- Navigation__DialNumber__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__DialNumber__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__DialNumber__response = {
- "Navigation",
- "DialNumber",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_DialNumber,
- Navigation__DialNumber__response__parameters};
-
-const ford_message_descriptions::StructDescription
- Navigation__ShowConstantTBT__request__parameter1_array = {
- {"navigationTexts", ford_message_descriptions::Struct, true},
- Structs::Common__TextFieldStruct__parameters};
-const ford_message_descriptions::ArrayDescription
- Navigation__ShowConstantTBT__request__parameter1 = {
- {"navigationTexts", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__ShowConstantTBT__request__parameter1_array,
- "(is)"};
-const ford_message_descriptions::StructDescription
- Navigation__ShowConstantTBT__request__parameter2 = {
- {"turnIcon", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::StructDescription
- Navigation__ShowConstantTBT__request__parameter3 = {
- {"nextTurnIcon", ford_message_descriptions::Struct, false},
- Structs::Common__Image__parameters};
-const ford_message_descriptions::ParameterDescription
- Navigation__ShowConstantTBT__request__parameter4 = {
- "distanceToManeuver", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription
- Navigation__ShowConstantTBT__request__parameter5 = {
- "distanceToManeuverScale", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription
- Navigation__ShowConstantTBT__request__parameter6 = {
- "maneuverComplete", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::StructDescription
- Navigation__ShowConstantTBT__request__parameter7_array = {
- {"softButtons", ford_message_descriptions::Struct, true},
- Structs::Common__SoftButton__parameters};
-const ford_message_descriptions::ArrayDescription
- Navigation__ShowConstantTBT__request__parameter7 = {
- {"softButtons", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__ShowConstantTBT__request__parameter7_array,
- "(i(bs)(b(si))(bb)ii)"};
-const ford_message_descriptions::ParameterDescription
- Navigation__ShowConstantTBT__request__parameter8 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__ShowConstantTBT__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__ShowConstantTBT__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__ShowConstantTBT__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__ShowConstantTBT__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__ShowConstantTBT__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__ShowConstantTBT__request__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__ShowConstantTBT__request__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__ShowConstantTBT__request__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__ShowConstantTBT__request__parameter8,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__ShowConstantTBT__request = {
- "Navigation",
- "ShowConstantTBT",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_ShowConstantTBT,
- Navigation__ShowConstantTBT__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__ShowConstantTBT__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__ShowConstantTBT__response = {
- "Navigation",
- "ShowConstantTBT",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_ShowConstantTBT,
- Navigation__ShowConstantTBT__response__parameters};
-
-const ford_message_descriptions::StructDescription
- Navigation__AlertManeuver__request__parameter1_array = {
- {"softButtons", ford_message_descriptions::Struct, true},
- Structs::Common__SoftButton__parameters};
-const ford_message_descriptions::ArrayDescription
- Navigation__AlertManeuver__request__parameter1 = {
- {"softButtons", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__AlertManeuver__request__parameter1_array,
- "(i(bs)(b(si))(bb)ii)"};
-const ford_message_descriptions::ParameterDescription
- Navigation__AlertManeuver__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__AlertManeuver__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__AlertManeuver__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__AlertManeuver__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__AlertManeuver__request = {
- "Navigation",
- "AlertManeuver",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_AlertManeuver,
- Navigation__AlertManeuver__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__AlertManeuver__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__AlertManeuver__response = {
- "Navigation",
- "AlertManeuver",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_AlertManeuver,
- Navigation__AlertManeuver__response__parameters};
-
-const ford_message_descriptions::StructDescription
- Navigation__UpdateTurnList__request__parameter1_array = {
- {"turnList", ford_message_descriptions::Struct, true},
- Structs::Common__Turn__parameters};
-const ford_message_descriptions::ArrayDescription
- Navigation__UpdateTurnList__request__parameter1 = {
- {"turnList", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__UpdateTurnList__request__parameter1_array,
- "((b(is))(b(si)))"};
-const ford_message_descriptions::StructDescription
- Navigation__UpdateTurnList__request__parameter2_array = {
- {"softButtons", ford_message_descriptions::Struct, true},
- Structs::Common__SoftButton__parameters};
-const ford_message_descriptions::ArrayDescription
- Navigation__UpdateTurnList__request__parameter2 = {
- {"softButtons", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__UpdateTurnList__request__parameter2_array,
- "(i(bs)(b(si))(bb)ii)"};
-const ford_message_descriptions::ParameterDescription
- Navigation__UpdateTurnList__request__parameter3 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__UpdateTurnList__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__UpdateTurnList__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__UpdateTurnList__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__UpdateTurnList__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__UpdateTurnList__request = {
- "Navigation",
- "UpdateTurnList",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_UpdateTurnList,
- Navigation__UpdateTurnList__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__UpdateTurnList__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__UpdateTurnList__response = {
- "Navigation",
- "UpdateTurnList",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_UpdateTurnList,
- Navigation__UpdateTurnList__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__OnTBTClientState__notification__parameter1 = {
- "state", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__OnTBTClientState__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__OnTBTClientState__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__OnTBTClientState__notification = {
- "Navigation",
- "OnTBTClientState",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::Navigation_OnTBTClientState,
- Navigation__OnTBTClientState__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- Navigation__SetVideoConfig__request__parameter1 = {
- {"config", ford_message_descriptions::Struct, true},
- Structs::Common__VideoConfig__parameters};
-const ford_message_descriptions::ParameterDescription
- Navigation__SetVideoConfig__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__SetVideoConfig__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SetVideoConfig__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SetVideoConfig__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__SetVideoConfig__request = {
- "Navigation",
- "SetVideoConfig",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_SetVideoConfig,
- Navigation__SetVideoConfig__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__SetVideoConfig__response__parameter1_array = {
- "rejectedParams", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- Navigation__SetVideoConfig__response__parameter1 = {
- {"rejectedParams", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SetVideoConfig__response__parameter1_array,
- "s"};
-const ford_message_descriptions::ParameterDescription*
- Navigation__SetVideoConfig__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__SetVideoConfig__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__SetVideoConfig__response = {
- "Navigation",
- "SetVideoConfig",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_SetVideoConfig,
- Navigation__SetVideoConfig__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__StartStream__request__parameter1 = {
- "url", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Navigation__StartStream__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__StartStream__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__StartStream__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__StartStream__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__StartStream__request = {
- "Navigation",
- "StartStream",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_StartStream,
- Navigation__StartStream__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__StartStream__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__StartStream__response = {
- "Navigation",
- "StartStream",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_StartStream,
- Navigation__StartStream__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__StopStream__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__StopStream__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__StopStream__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__StopStream__request = {
- "Navigation",
- "StopStream",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_StopStream,
- Navigation__StopStream__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__StopStream__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__StopStream__response = {
- "Navigation",
- "StopStream",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_StopStream,
- Navigation__StopStream__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__StartAudioStream__request__parameter1 = {
- "url", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription
- Navigation__StartAudioStream__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__StartAudioStream__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__StartAudioStream__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__StartAudioStream__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__StartAudioStream__request = {
- "Navigation",
- "StartAudioStream",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_StartAudioStream,
- Navigation__StartAudioStream__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__StartAudioStream__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__StartAudioStream__response = {
- "Navigation",
- "StartAudioStream",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_StartAudioStream,
- Navigation__StartAudioStream__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__StopAudioStream__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__StopAudioStream__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__StopAudioStream__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__StopAudioStream__request = {
- "Navigation",
- "StopAudioStream",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_StopAudioStream,
- Navigation__StopAudioStream__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__StopAudioStream__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__StopAudioStream__response = {
- "Navigation",
- "StopAudioStream",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_StopAudioStream,
- Navigation__StopAudioStream__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__OnAudioDataStreaming__notification__parameter1 = {
- "available", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__OnAudioDataStreaming__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__OnAudioDataStreaming__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__OnAudioDataStreaming__notification = {
- "Navigation",
- "OnAudioDataStreaming",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::Navigation_OnAudioDataStreaming,
- Navigation__OnAudioDataStreaming__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__OnVideoDataStreaming__notification__parameter1 = {
- "available", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__OnVideoDataStreaming__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__OnVideoDataStreaming__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__OnVideoDataStreaming__notification = {
- "Navigation",
- "OnVideoDataStreaming",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::Navigation_OnVideoDataStreaming,
- Navigation__OnVideoDataStreaming__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__GetWayPoints__request__parameter1 = {
- "wayPointType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- Navigation__GetWayPoints__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- Navigation__GetWayPoints__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__GetWayPoints__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__GetWayPoints__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__GetWayPoints__request = {
- "Navigation",
- "GetWayPoints",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_GetWayPoints,
- Navigation__GetWayPoints__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- Navigation__GetWayPoints__response__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::StructDescription
- Navigation__GetWayPoints__response__parameter2_array = {
- {"wayPoints", ford_message_descriptions::Struct, true},
- Structs::Common__LocationDetails__parameters};
-const ford_message_descriptions::ArrayDescription
- Navigation__GetWayPoints__response__parameter2 = {
- {"wayPoints", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__GetWayPoints__response__parameter2_array,
- "((b(dd))(bs)(bas)(bs)(bs)(b(si))(b((bs)(bs)(bs)(bs)(bs)(bs)(bs)(bs)("
- "bs))))"};
-const ford_message_descriptions::ParameterDescription*
- Navigation__GetWayPoints__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__GetWayPoints__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__GetWayPoints__response__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__GetWayPoints__response = {
- "Navigation",
- "GetWayPoints",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_GetWayPoints,
- Navigation__GetWayPoints__response__parameters};
-
-const ford_message_descriptions::StructDescription
- Navigation__OnWayPointChange__notification__parameter1_array = {
- {"wayPoints", ford_message_descriptions::Struct, true},
- Structs::Common__LocationDetails__parameters};
-const ford_message_descriptions::ArrayDescription
- Navigation__OnWayPointChange__notification__parameter1 = {
- {"wayPoints", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__OnWayPointChange__notification__parameter1_array,
- "((b(dd))(bs)(bas)(bs)(bs)(b(si))(b((bs)(bs)(bs)(bs)(bs)(bs)(bs)(bs)("
- "bs))))"};
-const ford_message_descriptions::ParameterDescription*
- Navigation__OnWayPointChange__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&Navigation__OnWayPointChange__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__OnWayPointChange__notification = {
- "Navigation",
- "OnWayPointChange",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::Navigation_OnWayPointChange,
- Navigation__OnWayPointChange__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__SubscribeWayPoints__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__SubscribeWayPoints__request = {
- "Navigation",
- "SubscribeWayPoints",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_SubscribeWayPoints,
- Navigation__SubscribeWayPoints__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__SubscribeWayPoints__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__SubscribeWayPoints__response = {
- "Navigation",
- "SubscribeWayPoints",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_SubscribeWayPoints,
- Navigation__SubscribeWayPoints__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__UnsubscribeWayPoints__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__UnsubscribeWayPoints__request = {
- "Navigation",
- "UnsubscribeWayPoints",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints,
- Navigation__UnsubscribeWayPoints__request__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- Navigation__UnsubscribeWayPoints__response__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- Navigation__UnsubscribeWayPoints__response = {
- "Navigation",
- "UnsubscribeWayPoints",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints,
- Navigation__UnsubscribeWayPoints__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__IsReady__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__IsReady__request = {"VehicleInfo",
- "IsReady",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_IsReady,
- VehicleInfo__IsReady__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__IsReady__response__parameter1 = {
- "available", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__IsReady__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__IsReady__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__IsReady__response = {
- "VehicleInfo",
- "IsReady",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_IsReady,
- VehicleInfo__IsReady__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetVehicleType__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetVehicleType__request = {
- "VehicleInfo",
- "GetVehicleType",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetVehicleType,
- VehicleInfo__GetVehicleType__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleType__response__parameter1 = {
- {"vehicleType", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleType__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetVehicleType__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleType__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetVehicleType__response = {
- "VehicleInfo",
- "GetVehicleType",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetVehicleType,
- VehicleInfo__GetVehicleType__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__ReadDID__request__parameter1 = {
- "ecuName", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__ReadDID__request__parameter2_array = {
- "didLocation", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ArrayDescription
- VehicleInfo__ReadDID__request__parameter2 = {
- {"didLocation", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__ReadDID__request__parameter2_array,
- "i"};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__ReadDID__request__parameter3 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__ReadDID__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__ReadDID__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__ReadDID__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__ReadDID__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__ReadDID__request = {"VehicleInfo",
- "ReadDID",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_ReadDID,
- VehicleInfo__ReadDID__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__ReadDID__response__parameter1_array = {
- {"didResult", ford_message_descriptions::Struct, true},
- Structs::Common__DIDResult__parameters};
-const ford_message_descriptions::ArrayDescription
- VehicleInfo__ReadDID__response__parameter1 = {
- {"didResult", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__ReadDID__response__parameter1_array,
- "(ii(bs))"};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__ReadDID__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__ReadDID__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__ReadDID__response = {
- "VehicleInfo",
- "ReadDID",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_ReadDID,
- VehicleInfo__ReadDID__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetDTCs__request__parameter1 = {
- "ecuName", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetDTCs__request__parameter2 = {
- "dtcMask", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetDTCs__request__parameter3 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetDTCs__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetDTCs__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetDTCs__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetDTCs__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetDTCs__request = {"VehicleInfo",
- "GetDTCs",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetDTCs,
- VehicleInfo__GetDTCs__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetDTCs__response__parameter1 = {
- "ecuHeader", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetDTCs__response__parameter2_array = {
- "dtc", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- VehicleInfo__GetDTCs__response__parameter2 = {
- {"dtc", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetDTCs__response__parameter2_array,
- "s"};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetDTCs__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetDTCs__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetDTCs__response__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetDTCs__response = {
- "VehicleInfo",
- "GetDTCs",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetDTCs,
- VehicleInfo__GetDTCs__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__DiagnosticMessage__request__parameter1 = {
- "targetID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__DiagnosticMessage__request__parameter2 = {
- "messageLength", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__DiagnosticMessage__request__parameter3_array = {
- "messageData", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ArrayDescription
- VehicleInfo__DiagnosticMessage__request__parameter3 = {
- {"messageData", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__DiagnosticMessage__request__parameter3_array,
- "i"};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__DiagnosticMessage__request__parameter4 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__DiagnosticMessage__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__DiagnosticMessage__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__DiagnosticMessage__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__DiagnosticMessage__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__DiagnosticMessage__request__parameter4,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__DiagnosticMessage__request = {
- "VehicleInfo",
- "DiagnosticMessage",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage,
- VehicleInfo__DiagnosticMessage__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__DiagnosticMessage__response__parameter1_array = {
- "messageDataResult", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ArrayDescription
- VehicleInfo__DiagnosticMessage__response__parameter1 = {
- {"messageDataResult", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__DiagnosticMessage__response__parameter1_array,
- "i"};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__DiagnosticMessage__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__DiagnosticMessage__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__DiagnosticMessage__response = {
- "VehicleInfo",
- "DiagnosticMessage",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage,
- VehicleInfo__DiagnosticMessage__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter1 = {
- "gps", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter2 = {
- "speed", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter3 = {
- "rpm", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter4 = {
- "fuelLevel", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter5 = {
- "fuelLevel_State", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter6 = {
- "instantFuelConsumption", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter7 = {
- "externalTemperature", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter8 = {
- "prndl", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter9 = {
- "tirePressure", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter10 = {
- "odometer", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter11 = {
- "beltStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter12 = {
- "bodyInformation", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter13 = {
- "deviceStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter14 = {
- "driverBraking", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter15 = {
- "wiperStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter16 = {
- "headLampStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter17 = {
- "engineTorque", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter18 = {
- "accPedalPosition", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter19 = {
- "steeringWheelAngle", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter20 = {
- "eCallInfo", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter21 = {
- "airbagStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter22 = {
- "emergencyEvent", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter23 = {
- "clusterModeStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVehicleData__request__parameter24 = {
- "myKey", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription* VehicleInfo__SubscribeVehicleData__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter11,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter12,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter13,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter14,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter15,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter16,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter17,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter18,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter19,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter20,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter21,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter22,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter23,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__request__parameter24,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeVehicleData__request = {
- "VehicleInfo",
- "SubscribeVehicleData",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData,
- VehicleInfo__SubscribeVehicleData__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter1 = {
- {"gps", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter2 = {
- {"speed", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter3 = {
- {"rpm", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter4 = {
- {"fuelLevel", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter5 = {
- {"fuelLevel_State", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter6 = {
- {"instantFuelConsumption", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter7 = {
- {"externalTemperature", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter8 = {
- {"prndl", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter9 = {
- {"tirePressure", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter10 = {
- {"odometer", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter11 = {
- {"beltStatus", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter12 = {
- {"bodyInformation", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter13 = {
- {"deviceStatus", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter14 = {
- {"driverBraking", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter15 = {
- {"wiperStatus", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter16 = {
- {"headLampStatus", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter17 = {
- {"engineTorque", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter18 = {
- {"accPedalPosition", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter19 = {
- {"steeringWheelAngle", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter20 = {
- {"eCallInfo", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter21 = {
- {"airbagStatus", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter22 = {
- {"emergencyEvent", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter23 = {
- {"clusterModes", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeVehicleData__response__parameter24 = {
- {"myKey", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription* VehicleInfo__SubscribeVehicleData__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter11,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter12,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter13,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter14,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter15,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter16,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter17,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter18,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter19,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter20,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter21,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter22,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter23,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVehicleData__response__parameter24,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeVehicleData__response = {
- "VehicleInfo",
- "SubscribeVehicleData",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData,
- VehicleInfo__SubscribeVehicleData__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter2 = {
- "gps", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter3 = {
- "speed", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter4 = {
- "rpm", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter5 = {
- "fuelLevel", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter6 = {
- "fuelLevel_State", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter7 = {
- "instantFuelConsumption", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter8 = {
- "externalTemperature", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter9 = {
- "prndl", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter10 = {
- "tirePressure", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter11 = {
- "odometer", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter12 = {
- "beltStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter13 = {
- "bodyInformation", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter14 = {
- "deviceStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter15 = {
- "driverBraking", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter16 = {
- "wiperStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter17 = {
- "headLampStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter18 = {
- "engineTorque", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter19 = {
- "accPedalPosition", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter20 = {
- "steeringWheelAngle", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter21 = {
- "eCallInfo", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter22 = {
- "airbagStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter23 = {
- "emergencyEvent", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter24 = {
- "clusterModeStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVehicleData__request__parameter25 = {
- "myKey", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription* VehicleInfo__UnsubscribeVehicleData__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter11,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter12,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter13,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter14,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter15,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter16,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter17,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter18,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter19,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter20,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter21,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter22,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter23,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter24,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__request__parameter25,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeVehicleData__request = {
- "VehicleInfo",
- "UnsubscribeVehicleData",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData,
- VehicleInfo__UnsubscribeVehicleData__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter1 = {
- {"gps", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter2 = {
- {"speed", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter3 = {
- {"rpm", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter4 = {
- {"fuelLevel", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter5 = {
- {"fuelLevel_State", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter6 = {
- {"instantFuelConsumption", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter7 = {
- {"externalTemperature", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter8 = {
- {"prndl", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter9 = {
- {"tirePressure", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter10 = {
- {"odometer", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter11 = {
- {"beltStatus", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter12 = {
- {"bodyInformation", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter13 = {
- {"deviceStatus", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter14 = {
- {"driverBraking", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter15 = {
- {"wiperStatus", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter16 = {
- {"headLampStatus", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter17 = {
- {"engineTorque", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter18 = {
- {"accPedalPosition", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter19 = {
- {"steeringWheelAngle", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter20 = {
- {"eCallInfo", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter21 = {
- {"airbagStatus", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter22 = {
- {"emergencyEvent", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter23 = {
- {"clusterModes", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeVehicleData__response__parameter24 = {
- {"myKey", ford_message_descriptions::Struct, false},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription* VehicleInfo__UnsubscribeVehicleData__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter11,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter12,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter13,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter14,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter15,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter16,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter17,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter18,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter19,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter20,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter21,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter22,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter23,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVehicleData__response__parameter24,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeVehicleData__response = {
- "VehicleInfo",
- "UnsubscribeVehicleData",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData,
- VehicleInfo__UnsubscribeVehicleData__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter1 = {
- "gps", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter2 = {
- "speed", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter3 = {
- "rpm", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter4 = {
- "fuelLevel", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter5 = {
- "fuelLevel_State", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter6 = {
- "instantFuelConsumption", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter7 = {
- "externalTemperature", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter8 = {
- "vin", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter9 = {
- "prndl", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter10 = {
- "tirePressure", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter11 = {
- "odometer", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter12 = {
- "beltStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter13 = {
- "bodyInformation", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter14 = {
- "deviceStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter15 = {
- "driverBraking", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter16 = {
- "wiperStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter17 = {
- "headLampStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter18 = {
- "engineTorque", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter19 = {
- "accPedalPosition", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter20 = {
- "steeringWheelAngle", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter21 = {
- "eCallInfo", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter22 = {
- "airbagStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter23 = {
- "emergencyEvent", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter24 = {
- "clusterModeStatus", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__request__parameter25 = {
- "myKey", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription* VehicleInfo__GetVehicleData__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter11,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter12,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter13,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter14,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter15,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter16,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter17,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter18,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter19,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter20,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter21,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter22,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter23,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter24,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__request__parameter25,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetVehicleData__request = {
- "VehicleInfo",
- "GetVehicleData",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetVehicleData,
- VehicleInfo__GetVehicleData__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleData__response__parameter1 = {
- {"gps", ford_message_descriptions::Struct, false},
- Structs::Common__GPSData__parameters};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter2 = {
- "speed", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter3 = {
- "rpm", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter4 = {
- "fuelLevel", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter5 = {
- "fuelLevel_State", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter6 = {
- "instantFuelConsumption", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter7 = {
- "externalTemperature", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter8 = {
- "vin", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter9 = {
- "prndl", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleData__response__parameter10 = {
- {"tirePressure", ford_message_descriptions::Struct, false},
- Structs::Common__TireStatus__parameters};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter11 = {
- "odometer", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleData__response__parameter12 = {
- {"beltStatus", ford_message_descriptions::Struct, false},
- Structs::Common__BeltStatus__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleData__response__parameter13 = {
- {"bodyInformation", ford_message_descriptions::Struct, false},
- Structs::Common__BodyInformation__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleData__response__parameter14 = {
- {"deviceStatus", ford_message_descriptions::Struct, false},
- Structs::Common__DeviceStatus__parameters};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter15 = {
- "driverBraking", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter16 = {
- "wiperStatus", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleData__response__parameter17 = {
- {"headLampStatus", ford_message_descriptions::Struct, false},
- Structs::Common__HeadLampStatus__parameters};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter18 = {
- "engineTorque", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter19 = {
- "accPedalPosition", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVehicleData__response__parameter20 = {
- "steeringWheelAngle", ford_message_descriptions::Float, false};
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleData__response__parameter21 = {
- {"eCallInfo", ford_message_descriptions::Struct, false},
- Structs::Common__ECallInfo__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleData__response__parameter22 = {
- {"airbagStatus", ford_message_descriptions::Struct, false},
- Structs::Common__AirbagStatus__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleData__response__parameter23 = {
- {"emergencyEvent", ford_message_descriptions::Struct, false},
- Structs::Common__EmergencyEvent__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleData__response__parameter24 = {
- {"clusterModeStatus", ford_message_descriptions::Struct, false},
- Structs::Common__ClusterModeStatus__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetVehicleData__response__parameter25 = {
- {"myKey", ford_message_descriptions::Struct, false},
- Structs::Common__MyKey__parameters};
-const ford_message_descriptions::ParameterDescription* VehicleInfo__GetVehicleData__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter11,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter12,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter13,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter14,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter15,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter16,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter17,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter18,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter19,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter20,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter21,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter22,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter23,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter24,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVehicleData__response__parameter25,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetVehicleData__response = {
- "VehicleInfo",
- "GetVehicleData",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetVehicleData,
- VehicleInfo__GetVehicleData__response__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnVehicleData__notification__parameter1 = {
- {"gps", ford_message_descriptions::Struct, false},
- Structs::Common__GPSData__parameters};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter2 = {
- "speed", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter3 = {
- "rpm", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter4 = {
- "fuelLevel", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter5 = {
- "fuelLevel_State", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter6 = {
- "instantFuelConsumption", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter7 = {
- "externalTemperature", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter8 = {
- "vin", ford_message_descriptions::String, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter9 = {
- "prndl", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnVehicleData__notification__parameter10 = {
- {"tirePressure", ford_message_descriptions::Struct, false},
- Structs::Common__TireStatus__parameters};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter11 = {
- "odometer", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnVehicleData__notification__parameter12 = {
- {"beltStatus", ford_message_descriptions::Struct, false},
- Structs::Common__BeltStatus__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnVehicleData__notification__parameter13 = {
- {"bodyInformation", ford_message_descriptions::Struct, false},
- Structs::Common__BodyInformation__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnVehicleData__notification__parameter14 = {
- {"deviceStatus", ford_message_descriptions::Struct, false},
- Structs::Common__DeviceStatus__parameters};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter15 = {
- "driverBraking", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter16 = {
- "wiperStatus", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnVehicleData__notification__parameter17 = {
- {"headLampStatus", ford_message_descriptions::Struct, false},
- Structs::Common__HeadLampStatus__parameters};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter18 = {
- "engineTorque", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter19 = {
- "accPedalPosition", ford_message_descriptions::Float, false};
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVehicleData__notification__parameter20 = {
- "steeringWheelAngle", ford_message_descriptions::Float, false};
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnVehicleData__notification__parameter21 = {
- {"eCallInfo", ford_message_descriptions::Struct, false},
- Structs::Common__ECallInfo__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnVehicleData__notification__parameter22 = {
- {"airbagStatus", ford_message_descriptions::Struct, false},
- Structs::Common__AirbagStatus__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnVehicleData__notification__parameter23 = {
- {"emergencyEvent", ford_message_descriptions::Struct, false},
- Structs::Common__EmergencyEvent__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnVehicleData__notification__parameter24 = {
- {"clusterModeStatus", ford_message_descriptions::Struct, false},
- Structs::Common__ClusterModeStatus__parameters};
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnVehicleData__notification__parameter25 = {
- {"myKey", ford_message_descriptions::Struct, false},
- Structs::Common__MyKey__parameters};
-const ford_message_descriptions::ParameterDescription* VehicleInfo__OnVehicleData__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter8,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter9,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter10,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter11,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter12,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter13,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter14,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter15,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter16,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter17,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter18,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter19,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter20,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter21,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter22,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter23,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter24,
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVehicleData__notification__parameter25,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnVehicleData__notification = {
- "VehicleInfo",
- "OnVehicleData",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnVehicleData,
- VehicleInfo__OnVehicleData__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetGpsData__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetGpsData__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetGpsData__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetGpsData__request = {
- "VehicleInfo",
- "GetGpsData",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetGpsData,
- VehicleInfo__GetGpsData__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetGpsData__response__parameter1 = {
- {"gps", ford_message_descriptions::Struct, true},
- Structs::Common__GPSData__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetGpsData__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetGpsData__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetGpsData__response = {
- "VehicleInfo",
- "GetGpsData",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetGpsData,
- VehicleInfo__GetGpsData__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetSpeed__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetSpeed__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetSpeed__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetSpeed__request = {
- "VehicleInfo",
- "GetSpeed",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetSpeed,
- VehicleInfo__GetSpeed__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetSpeed__response__parameter1 = {
- "speed", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetSpeed__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetSpeed__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetSpeed__response = {
- "VehicleInfo",
- "GetSpeed",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetSpeed,
- VehicleInfo__GetSpeed__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetRpm__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetRpm__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetRpm__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetRpm__request = {"VehicleInfo",
- "GetRpm",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetRpm,
- VehicleInfo__GetRpm__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetRpm__response__parameter1 = {
- "rpm", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetRpm__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetRpm__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetRpm__response = {"VehicleInfo",
- "GetRpm",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetRpm,
- VehicleInfo__GetRpm__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetFuelLevel__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetFuelLevel__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetFuelLevel__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetFuelLevel__request = {
- "VehicleInfo",
- "GetFuelLevel",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevel,
- VehicleInfo__GetFuelLevel__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetFuelLevel__response__parameter1 = {
- "fuelLevel", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetFuelLevel__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetFuelLevel__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetFuelLevel__response = {
- "VehicleInfo",
- "GetFuelLevel",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevel,
- VehicleInfo__GetFuelLevel__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetFuelLevelState__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetFuelLevelState__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetFuelLevelState__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetFuelLevelState__request = {
- "VehicleInfo",
- "GetFuelLevelState",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState,
- VehicleInfo__GetFuelLevelState__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetFuelLevelState__response__parameter1 = {
- "fuelLevel_State", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetFuelLevelState__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetFuelLevelState__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetFuelLevelState__response = {
- "VehicleInfo",
- "GetFuelLevelState",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState,
- VehicleInfo__GetFuelLevelState__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetInstantFuelConsumption__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetInstantFuelConsumption__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetInstantFuelConsumption__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetInstantFuelConsumption__request = {
- "VehicleInfo",
- "GetInstantFuelConsumption",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption,
- VehicleInfo__GetInstantFuelConsumption__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetInstantFuelConsumption__response__parameter1 = {
- "instantFuelConsumption", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetInstantFuelConsumption__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetInstantFuelConsumption__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetInstantFuelConsumption__response = {
- "VehicleInfo",
- "GetInstantFuelConsumption",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption,
- VehicleInfo__GetInstantFuelConsumption__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetExternalTemperature__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetExternalTemperature__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetExternalTemperature__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetExternalTemperature__request = {
- "VehicleInfo",
- "GetExternalTemperature",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature,
- VehicleInfo__GetExternalTemperature__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetExternalTemperature__response__parameter1 = {
- "externalTemperature", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetExternalTemperature__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetExternalTemperature__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetExternalTemperature__response = {
- "VehicleInfo",
- "GetExternalTemperature",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature,
- VehicleInfo__GetExternalTemperature__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVin__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetVin__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVin__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetVin__request = {"VehicleInfo",
- "GetVin",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetVin,
- VehicleInfo__GetVin__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetVin__response__parameter1 = {
- "vin", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetVin__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetVin__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetVin__response = {"VehicleInfo",
- "GetVin",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetVin,
- VehicleInfo__GetVin__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetPrndl__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetPrndl__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetPrndl__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetPrndl__request = {
- "VehicleInfo",
- "GetPrndl",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetPrndl,
- VehicleInfo__GetPrndl__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetPrndl__response__parameter1 = {
- "prndl", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetPrndl__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetPrndl__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetPrndl__response = {
- "VehicleInfo",
- "GetPrndl",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetPrndl,
- VehicleInfo__GetPrndl__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetTirePressure__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetTirePressure__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetTirePressure__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetTirePressure__request = {
- "VehicleInfo",
- "GetTirePressure",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetTirePressure,
- VehicleInfo__GetTirePressure__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetTirePressure__response__parameter1 = {
- {"tirePressure", ford_message_descriptions::Struct, true},
- Structs::Common__TireStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetTirePressure__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetTirePressure__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetTirePressure__response = {
- "VehicleInfo",
- "GetTirePressure",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetTirePressure,
- VehicleInfo__GetTirePressure__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetOdometer__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetOdometer__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetOdometer__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetOdometer__request = {
- "VehicleInfo",
- "GetOdometer",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetOdometer,
- VehicleInfo__GetOdometer__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetOdometer__response__parameter1 = {
- "odometer", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetOdometer__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetOdometer__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetOdometer__response = {
- "VehicleInfo",
- "GetOdometer",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetOdometer,
- VehicleInfo__GetOdometer__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetBeltStatus__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetBeltStatus__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetBeltStatus__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetBeltStatus__request = {
- "VehicleInfo",
- "GetBeltStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetBeltStatus,
- VehicleInfo__GetBeltStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetBeltStatus__response__parameter1 = {
- {"beltStatus", ford_message_descriptions::Struct, true},
- Structs::Common__BeltStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetBeltStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetBeltStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetBeltStatus__response = {
- "VehicleInfo",
- "GetBeltStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetBeltStatus,
- VehicleInfo__GetBeltStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetBodyInformation__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetBodyInformation__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetBodyInformation__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetBodyInformation__request = {
- "VehicleInfo",
- "GetBodyInformation",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetBodyInformation,
- VehicleInfo__GetBodyInformation__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetBodyInformation__response__parameter1 = {
- {"bodyInformation", ford_message_descriptions::Struct, true},
- Structs::Common__BodyInformation__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetBodyInformation__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetBodyInformation__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetBodyInformation__response = {
- "VehicleInfo",
- "GetBodyInformation",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetBodyInformation,
- VehicleInfo__GetBodyInformation__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetDeviceStatus__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetDeviceStatus__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetDeviceStatus__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetDeviceStatus__request = {
- "VehicleInfo",
- "GetDeviceStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus,
- VehicleInfo__GetDeviceStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetDeviceStatus__response__parameter1 = {
- {"deviceStatus", ford_message_descriptions::Struct, true},
- Structs::Common__DeviceStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetDeviceStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetDeviceStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetDeviceStatus__response = {
- "VehicleInfo",
- "GetDeviceStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus,
- VehicleInfo__GetDeviceStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetDriverBraking__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetDriverBraking__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetDriverBraking__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetDriverBraking__request = {
- "VehicleInfo",
- "GetDriverBraking",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetDriverBraking,
- VehicleInfo__GetDriverBraking__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetDriverBraking__response__parameter1 = {
- "driverBraking", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetDriverBraking__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetDriverBraking__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetDriverBraking__response = {
- "VehicleInfo",
- "GetDriverBraking",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetDriverBraking,
- VehicleInfo__GetDriverBraking__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetWiperStatus__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetWiperStatus__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetWiperStatus__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetWiperStatus__request = {
- "VehicleInfo",
- "GetWiperStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetWiperStatus,
- VehicleInfo__GetWiperStatus__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetWiperStatus__response__parameter1 = {
- "wiperStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetWiperStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetWiperStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetWiperStatus__response = {
- "VehicleInfo",
- "GetWiperStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetWiperStatus,
- VehicleInfo__GetWiperStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetHeadLampStatus__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetHeadLampStatus__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetHeadLampStatus__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetHeadLampStatus__request = {
- "VehicleInfo",
- "GetHeadLampStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus,
- VehicleInfo__GetHeadLampStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetHeadLampStatus__response__parameter1 = {
- {"headLampStatus", ford_message_descriptions::Struct, true},
- Structs::Common__HeadLampStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetHeadLampStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetHeadLampStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetHeadLampStatus__response = {
- "VehicleInfo",
- "GetHeadLampStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus,
- VehicleInfo__GetHeadLampStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetEngineTorque__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetEngineTorque__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetEngineTorque__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetEngineTorque__request = {
- "VehicleInfo",
- "GetEngineTorque",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetEngineTorque,
- VehicleInfo__GetEngineTorque__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetEngineTorque__response__parameter1 = {
- "engineTorque", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetEngineTorque__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetEngineTorque__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetEngineTorque__response = {
- "VehicleInfo",
- "GetEngineTorque",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetEngineTorque,
- VehicleInfo__GetEngineTorque__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetAccPedalPosition__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetAccPedalPosition__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetAccPedalPosition__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetAccPedalPosition__request = {
- "VehicleInfo",
- "GetAccPedalPosition",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition,
- VehicleInfo__GetAccPedalPosition__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetAccPedalPosition__response__parameter1 = {
- "accPedalPosition", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetAccPedalPosition__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetAccPedalPosition__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetAccPedalPosition__response = {
- "VehicleInfo",
- "GetAccPedalPosition",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition,
- VehicleInfo__GetAccPedalPosition__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetSteeringWheelAngle__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetSteeringWheelAngle__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetSteeringWheelAngle__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetSteeringWheelAngle__request = {
- "VehicleInfo",
- "GetSteeringWheelAngle",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle,
- VehicleInfo__GetSteeringWheelAngle__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetSteeringWheelAngle__response__parameter1 = {
- "steeringWheelAngle", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetSteeringWheelAngle__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetSteeringWheelAngle__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetSteeringWheelAngle__response = {
- "VehicleInfo",
- "GetSteeringWheelAngle",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle,
- VehicleInfo__GetSteeringWheelAngle__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetECallInfo__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetECallInfo__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetECallInfo__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetECallInfo__request = {
- "VehicleInfo",
- "GetECallInfo",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetECallInfo,
- VehicleInfo__GetECallInfo__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetECallInfo__response__parameter1 = {
- {"eCallInfo", ford_message_descriptions::Struct, true},
- Structs::Common__ECallInfo__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetECallInfo__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetECallInfo__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetECallInfo__response = {
- "VehicleInfo",
- "GetECallInfo",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetECallInfo,
- VehicleInfo__GetECallInfo__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetAirbagStatus__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetAirbagStatus__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetAirbagStatus__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetAirbagStatus__request = {
- "VehicleInfo",
- "GetAirbagStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus,
- VehicleInfo__GetAirbagStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetAirbagStatus__response__parameter1 = {
- {"airbagStatus", ford_message_descriptions::Struct, true},
- Structs::Common__AirbagStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetAirbagStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetAirbagStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetAirbagStatus__response = {
- "VehicleInfo",
- "GetAirbagStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus,
- VehicleInfo__GetAirbagStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetEmergencyEvent__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetEmergencyEvent__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetEmergencyEvent__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetEmergencyEvent__request = {
- "VehicleInfo",
- "GetEmergencyEvent",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent,
- VehicleInfo__GetEmergencyEvent__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetEmergencyEvent__response__parameter1 = {
- {"emergencyEvent", ford_message_descriptions::Struct, true},
- Structs::Common__EmergencyEvent__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetEmergencyEvent__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetEmergencyEvent__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetEmergencyEvent__response = {
- "VehicleInfo",
- "GetEmergencyEvent",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent,
- VehicleInfo__GetEmergencyEvent__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetClusterModeStatus__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetClusterModeStatus__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetClusterModeStatus__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetClusterModeStatus__request = {
- "VehicleInfo",
- "GetClusterModeStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus,
- VehicleInfo__GetClusterModeStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetClusterModeStatus__response__parameter1 = {
- {"clusterModeStatus", ford_message_descriptions::Struct, true},
- Structs::Common__ClusterModeStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetClusterModeStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetClusterModeStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetClusterModeStatus__response = {
- "VehicleInfo",
- "GetClusterModeStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus,
- VehicleInfo__GetClusterModeStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__GetMyKey__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetMyKey__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetMyKey__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetMyKey__request = {
- "VehicleInfo",
- "GetMyKey",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_GetMyKey,
- VehicleInfo__GetMyKey__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__GetMyKey__response__parameter1 = {
- {"myKey", ford_message_descriptions::Struct, true},
- Structs::Common__MyKey__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__GetMyKey__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__GetMyKey__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__GetMyKey__response = {
- "VehicleInfo",
- "GetMyKey",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_GetMyKey,
- VehicleInfo__GetMyKey__response__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnGpsData__notification__parameter1 = {
- {"gps", ford_message_descriptions::Struct, true},
- Structs::Common__GPSData__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnGpsData__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnGpsData__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnGpsData__notification = {
- "VehicleInfo",
- "OnGpsData",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnGpsData,
- VehicleInfo__OnGpsData__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnSpeed__notification__parameter1 = {
- "speed", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnSpeed__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnSpeed__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnSpeed__notification = {
- "VehicleInfo",
- "OnSpeed",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnSpeed,
- VehicleInfo__OnSpeed__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnRpm__notification__parameter1 = {
- "rpm", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnRpm__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnRpm__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnRpm__notification = {
- "VehicleInfo",
- "OnRpm",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnRpm,
- VehicleInfo__OnRpm__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnFuelLevel__notification__parameter1 = {
- "fuelLevel", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnFuelLevel__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnFuelLevel__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnFuelLevel__notification = {
- "VehicleInfo",
- "OnFuelLevel",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnFuelLevel,
- VehicleInfo__OnFuelLevel__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnFuelLevelState__notification__parameter1 = {
- "fuelLevel_State", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnFuelLevelState__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnFuelLevelState__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnFuelLevelState__notification = {
- "VehicleInfo",
- "OnFuelLevelState",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnFuelLevelState,
- VehicleInfo__OnFuelLevelState__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnInstantFuelConsumption__notification__parameter1 = {
- "instantFuelConsumption", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnInstantFuelConsumption__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnInstantFuelConsumption__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnInstantFuelConsumption__notification = {
- "VehicleInfo",
- "OnInstantFuelConsumption",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnInstantFuelConsumption,
- VehicleInfo__OnInstantFuelConsumption__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnExternalTemperature__notification__parameter1 = {
- "externalTemperature", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnExternalTemperature__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnExternalTemperature__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnExternalTemperature__notification = {
- "VehicleInfo",
- "OnExternalTemperature",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnExternalTemperature,
- VehicleInfo__OnExternalTemperature__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnVin__notification__parameter1 = {
- "vin", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnVin__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnVin__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnVin__notification = {
- "VehicleInfo",
- "OnVin",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnVin,
- VehicleInfo__OnVin__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnPrndl__notification__parameter1 = {
- "prndl", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnPrndl__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnPrndl__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnPrndl__notification = {
- "VehicleInfo",
- "OnPrndl",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnPrndl,
- VehicleInfo__OnPrndl__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnTirePressure__notification__parameter1 = {
- {"tirePressure", ford_message_descriptions::Struct, true},
- Structs::Common__TireStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnTirePressure__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnTirePressure__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnTirePressure__notification = {
- "VehicleInfo",
- "OnTirePressure",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnTirePressure,
- VehicleInfo__OnTirePressure__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnOdometer__notification__parameter1 = {
- "odometer", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnOdometer__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnOdometer__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnOdometer__notification = {
- "VehicleInfo",
- "OnOdometer",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnOdometer,
- VehicleInfo__OnOdometer__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnBeltStatus__notification__parameter1 = {
- {"beltStatus", ford_message_descriptions::Struct, true},
- Structs::Common__BeltStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnBeltStatus__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnBeltStatus__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnBeltStatus__notification = {
- "VehicleInfo",
- "OnBeltStatus",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnBeltStatus,
- VehicleInfo__OnBeltStatus__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnBodyInformation__notification__parameter1 = {
- {"bodyInformation", ford_message_descriptions::Struct, true},
- Structs::Common__BodyInformation__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnBodyInformation__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnBodyInformation__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnBodyInformation__notification = {
- "VehicleInfo",
- "OnBodyInformation",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnBodyInformation,
- VehicleInfo__OnBodyInformation__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnDeviceStatus__notification__parameter1 = {
- {"deviceStatus", ford_message_descriptions::Struct, true},
- Structs::Common__DeviceStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnDeviceStatus__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnDeviceStatus__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnDeviceStatus__notification = {
- "VehicleInfo",
- "OnDeviceStatus",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnDeviceStatus,
- VehicleInfo__OnDeviceStatus__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnDriverBraking__notification__parameter1 = {
- "driverBraking", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnDriverBraking__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnDriverBraking__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnDriverBraking__notification = {
- "VehicleInfo",
- "OnDriverBraking",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnDriverBraking,
- VehicleInfo__OnDriverBraking__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnWiperStatus__notification__parameter1 = {
- "wiperStatus", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnWiperStatus__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnWiperStatus__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnWiperStatus__notification = {
- "VehicleInfo",
- "OnWiperStatus",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnWiperStatus,
- VehicleInfo__OnWiperStatus__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnHeadLampStatus__notification__parameter1 = {
- {"headLampStatus", ford_message_descriptions::Struct, true},
- Structs::Common__HeadLampStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnHeadLampStatus__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnHeadLampStatus__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnHeadLampStatus__notification = {
- "VehicleInfo",
- "OnHeadLampStatus",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnHeadLampStatus,
- VehicleInfo__OnHeadLampStatus__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnEngineTorque__notification__parameter1 = {
- "engineTorque", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnEngineTorque__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnEngineTorque__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnEngineTorque__notification = {
- "VehicleInfo",
- "OnEngineTorque",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnEngineTorque,
- VehicleInfo__OnEngineTorque__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnAccPedalPosition__notification__parameter1 = {
- "accPedalPosition", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnAccPedalPosition__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnAccPedalPosition__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnAccPedalPosition__notification = {
- "VehicleInfo",
- "OnAccPedalPosition",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnAccPedalPosition,
- VehicleInfo__OnAccPedalPosition__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__OnSteeringWheelAngle__notification__parameter1 = {
- "steeringWheelAngle", ford_message_descriptions::Float, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnSteeringWheelAngle__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnSteeringWheelAngle__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnSteeringWheelAngle__notification = {
- "VehicleInfo",
- "OnSteeringWheelAngle",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnSteeringWheelAngle,
- VehicleInfo__OnSteeringWheelAngle__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnECallInfo__notification__parameter1 = {
- {"eCallInfo", ford_message_descriptions::Struct, true},
- Structs::Common__ECallInfo__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnECallInfo__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnECallInfo__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnECallInfo__notification = {
- "VehicleInfo",
- "OnECallInfo",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnECallInfo,
- VehicleInfo__OnECallInfo__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnAirbagStatus__notification__parameter1 = {
- {"airbagStatus", ford_message_descriptions::Struct, true},
- Structs::Common__AirbagStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnAirbagStatus__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnAirbagStatus__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnAirbagStatus__notification = {
- "VehicleInfo",
- "OnAirbagStatus",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnAirbagStatus,
- VehicleInfo__OnAirbagStatus__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnEmergencyEvent__notification__parameter1 = {
- {"emergencyEvent", ford_message_descriptions::Struct, true},
- Structs::Common__EmergencyEvent__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnEmergencyEvent__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnEmergencyEvent__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnEmergencyEvent__notification = {
- "VehicleInfo",
- "OnEmergencyEvent",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnEmergencyEvent,
- VehicleInfo__OnEmergencyEvent__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnClusterModeStatus__notification__parameter1 = {
- {"clusterModeStatus", ford_message_descriptions::Struct, true},
- Structs::Common__ClusterModeStatus__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnClusterModeStatus__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnClusterModeStatus__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnClusterModeStatus__notification = {
- "VehicleInfo",
- "OnClusterModeStatus",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnClusterModeStatus,
- VehicleInfo__OnClusterModeStatus__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__OnMyKey__notification__parameter1 = {
- {"myKey", ford_message_descriptions::Struct, true},
- Structs::Common__MyKey__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__OnMyKey__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__OnMyKey__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__OnMyKey__notification = {
- "VehicleInfo",
- "OnMyKey",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::VehicleInfo_OnMyKey,
- VehicleInfo__OnMyKey__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeGps__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeGps__request = {
- "VehicleInfo",
- "SubscribeGps",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeGps,
- VehicleInfo__SubscribeGps__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeGps__response__parameter1 = {
- {"gps", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeGps__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeGps__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeGps__response = {
- "VehicleInfo",
- "SubscribeGps",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeGps,
- VehicleInfo__SubscribeGps__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeGps__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeGps__request = {
- "VehicleInfo",
- "UnsubscribeGps",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps,
- VehicleInfo__UnsubscribeGps__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeGps__response__parameter1 = {
- {"gps", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeGps__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeGps__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeGps__response = {
- "VehicleInfo",
- "UnsubscribeGps",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeGps,
- VehicleInfo__UnsubscribeGps__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeSpeed__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeSpeed__request = {
- "VehicleInfo",
- "SubscribeSpeed",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed,
- VehicleInfo__SubscribeSpeed__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeSpeed__response__parameter1 = {
- {"speed", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeSpeed__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeSpeed__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeSpeed__response = {
- "VehicleInfo",
- "SubscribeSpeed",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed,
- VehicleInfo__SubscribeSpeed__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeSpeed__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeSpeed__request = {
- "VehicleInfo",
- "UnsubscribeSpeed",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed,
- VehicleInfo__UnsubscribeSpeed__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeSpeed__response__parameter1 = {
- {"speed", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeSpeed__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeSpeed__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeSpeed__response = {
- "VehicleInfo",
- "UnsubscribeSpeed",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeSpeed,
- VehicleInfo__UnsubscribeSpeed__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeRpm__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeRpm__request = {
- "VehicleInfo",
- "SubscribeRpm",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeRpm,
- VehicleInfo__SubscribeRpm__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeRpm__response__parameter1 = {
- {"rpm", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeRpm__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeRpm__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeRpm__response = {
- "VehicleInfo",
- "SubscribeRpm",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeRpm,
- VehicleInfo__SubscribeRpm__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeRpm__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeRpm__request = {
- "VehicleInfo",
- "UnsubscribeRpm",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm,
- VehicleInfo__UnsubscribeRpm__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeRpm__response__parameter1 = {
- {"rpm", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeRpm__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeRpm__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeRpm__response = {
- "VehicleInfo",
- "UnsubscribeRpm",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeRpm,
- VehicleInfo__UnsubscribeRpm__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeFuelLevel__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeFuelLevel__request = {
- "VehicleInfo",
- "SubscribeFuelLevel",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel,
- VehicleInfo__SubscribeFuelLevel__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeFuelLevel__response__parameter1 = {
- {"fuelLevel", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeFuelLevel__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeFuelLevel__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeFuelLevel__response = {
- "VehicleInfo",
- "SubscribeFuelLevel",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel,
- VehicleInfo__SubscribeFuelLevel__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeFuelLevel__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeFuelLevel__request = {
- "VehicleInfo",
- "UnsubscribeFuelLevel",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel,
- VehicleInfo__UnsubscribeFuelLevel__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeFuelLevel__response__parameter1 = {
- {"fuelLevel", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeFuelLevel__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeFuelLevel__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeFuelLevel__response = {
- "VehicleInfo",
- "UnsubscribeFuelLevel",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel,
- VehicleInfo__UnsubscribeFuelLevel__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeFuelLevel_State__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeFuelLevel_State__request = {
- "VehicleInfo",
- "SubscribeFuelLevel_State",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State,
- VehicleInfo__SubscribeFuelLevel_State__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeFuelLevel_State__response__parameter1 = {
- {"fuelLevel_State", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeFuelLevel_State__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeFuelLevel_State__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeFuelLevel_State__response = {
- "VehicleInfo",
- "SubscribeFuelLevel_State",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State,
- VehicleInfo__SubscribeFuelLevel_State__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeFuelLevel_State__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeFuelLevel_State__request = {
- "VehicleInfo",
- "UnsubscribeFuelLevel_State",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State,
- VehicleInfo__UnsubscribeFuelLevel_State__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeFuelLevel_State__response__parameter1 = {
- {"fuelLevel_State", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeFuelLevel_State__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeFuelLevel_State__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeFuelLevel_State__response = {
- "VehicleInfo",
- "UnsubscribeFuelLevel_State",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeFuelLevel_State,
- VehicleInfo__UnsubscribeFuelLevel_State__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeInstantFuelConsumption__request__parameters[] = {
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeInstantFuelConsumption__request = {
- "VehicleInfo",
- "SubscribeInstantFuelConsumption",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption,
- VehicleInfo__SubscribeInstantFuelConsumption__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeInstantFuelConsumption__response__parameter1 = {
- {"instantFuelConsumption", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeInstantFuelConsumption__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeInstantFuelConsumption__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeInstantFuelConsumption__response = {
- "VehicleInfo",
- "SubscribeInstantFuelConsumption",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption,
- VehicleInfo__SubscribeInstantFuelConsumption__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeInstantFuelConsumption__request__parameters[] = {
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeInstantFuelConsumption__request = {
- "VehicleInfo",
- "UnsubscribeInstantFuelConsumption",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption,
- VehicleInfo__UnsubscribeInstantFuelConsumption__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeInstantFuelConsumption__response__parameter1 = {
- {"instantFuelConsumption", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeInstantFuelConsumption__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeInstantFuelConsumption__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeInstantFuelConsumption__response = {
- "VehicleInfo",
- "UnsubscribeInstantFuelConsumption",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeInstantFuelConsumption,
- VehicleInfo__UnsubscribeInstantFuelConsumption__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeExternalTemperature__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeExternalTemperature__request = {
- "VehicleInfo",
- "SubscribeExternalTemperature",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature,
- VehicleInfo__SubscribeExternalTemperature__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeExternalTemperature__response__parameter1 = {
- {"externalTemperature", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeExternalTemperature__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeExternalTemperature__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeExternalTemperature__response = {
- "VehicleInfo",
- "SubscribeExternalTemperature",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature,
- VehicleInfo__SubscribeExternalTemperature__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeExternalTemperature__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeExternalTemperature__request = {
- "VehicleInfo",
- "UnsubscribeExternalTemperature",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature,
- VehicleInfo__UnsubscribeExternalTemperature__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeExternalTemperature__response__parameter1 = {
- {"externalTemperature", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeExternalTemperature__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeExternalTemperature__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeExternalTemperature__response = {
- "VehicleInfo",
- "UnsubscribeExternalTemperature",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeExternalTemperature,
- VehicleInfo__UnsubscribeExternalTemperature__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribePrndl__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribePrndl__request = {
- "VehicleInfo",
- "SubscribePrndl",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribePrndl,
- VehicleInfo__SubscribePrndl__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribePrndl__response__parameter1 = {
- {"prndl", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribePrndl__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribePrndl__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribePrndl__response = {
- "VehicleInfo",
- "SubscribePrndl",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribePrndl,
- VehicleInfo__SubscribePrndl__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribePrndl__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribePrndl__request = {
- "VehicleInfo",
- "UnsubscribePrndl",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl,
- VehicleInfo__UnsubscribePrndl__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribePrndl__response__parameter1 = {
- {"prndl", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribePrndl__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribePrndl__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribePrndl__response = {
- "VehicleInfo",
- "UnsubscribePrndl",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribePrndl,
- VehicleInfo__UnsubscribePrndl__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeVin__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeVin__request = {
- "VehicleInfo",
- "SubscribeVin",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeVin,
- VehicleInfo__SubscribeVin__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__SubscribeVin__response__parameter1 = {
- "vin", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeVin__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeVin__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeVin__response = {
- "VehicleInfo",
- "SubscribeVin",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeVin,
- VehicleInfo__SubscribeVin__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeVin__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeVin__request = {
- "VehicleInfo",
- "UnsubscribeVin",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin,
- VehicleInfo__UnsubscribeVin__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- VehicleInfo__UnsubscribeVin__response__parameter1 = {
- "vin", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeVin__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeVin__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeVin__response = {
- "VehicleInfo",
- "UnsubscribeVin",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeVin,
- VehicleInfo__UnsubscribeVin__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeTirePressure__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeTirePressure__request = {
- "VehicleInfo",
- "SubscribeTirePressure",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure,
- VehicleInfo__SubscribeTirePressure__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeTirePressure__response__parameter1 = {
- {"tirePressure", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeTirePressure__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeTirePressure__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeTirePressure__response = {
- "VehicleInfo",
- "SubscribeTirePressure",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure,
- VehicleInfo__SubscribeTirePressure__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeTirePressure__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeTirePressure__request = {
- "VehicleInfo",
- "UnsubscribeTirePressure",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure,
- VehicleInfo__UnsubscribeTirePressure__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeTirePressure__response__parameter1 = {
- {"tirePressure", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeTirePressure__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeTirePressure__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeTirePressure__response = {
- "VehicleInfo",
- "UnsubscribeTirePressure",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeTirePressure,
- VehicleInfo__UnsubscribeTirePressure__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeOdometer__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeOdometer__request = {
- "VehicleInfo",
- "SubscribeOdometer",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer,
- VehicleInfo__SubscribeOdometer__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeOdometer__response__parameter1 = {
- {"odometer", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeOdometer__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeOdometer__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeOdometer__response = {
- "VehicleInfo",
- "SubscribeOdometer",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer,
- VehicleInfo__SubscribeOdometer__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeOdometer__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeOdometer__request = {
- "VehicleInfo",
- "UnsubscribeOdometer",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer,
- VehicleInfo__UnsubscribeOdometer__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeOdometer__response__parameter1 = {
- {"odometer", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeOdometer__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeOdometer__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeOdometer__response = {
- "VehicleInfo",
- "UnsubscribeOdometer",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeOdometer,
- VehicleInfo__UnsubscribeOdometer__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeBeltStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeBeltStatus__request = {
- "VehicleInfo",
- "SubscribeBeltStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus,
- VehicleInfo__SubscribeBeltStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeBeltStatus__response__parameter1 = {
- {"beltStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeBeltStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeBeltStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeBeltStatus__response = {
- "VehicleInfo",
- "SubscribeBeltStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus,
- VehicleInfo__SubscribeBeltStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeBeltStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeBeltStatus__request = {
- "VehicleInfo",
- "UnsubscribeBeltStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus,
- VehicleInfo__UnsubscribeBeltStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeBeltStatus__response__parameter1 = {
- {"beltStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeBeltStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeBeltStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeBeltStatus__response = {
- "VehicleInfo",
- "UnsubscribeBeltStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeBeltStatus,
- VehicleInfo__UnsubscribeBeltStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeBodyInformation__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeBodyInformation__request = {
- "VehicleInfo",
- "SubscribeBodyInformation",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation,
- VehicleInfo__SubscribeBodyInformation__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeBodyInformation__response__parameter1 = {
- {"bodyInformation", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeBodyInformation__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeBodyInformation__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeBodyInformation__response = {
- "VehicleInfo",
- "SubscribeBodyInformation",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation,
- VehicleInfo__SubscribeBodyInformation__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeBodyInformation__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeBodyInformation__request = {
- "VehicleInfo",
- "UnsubscribeBodyInformation",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation,
- VehicleInfo__UnsubscribeBodyInformation__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeBodyInformation__response__parameter1 = {
- {"bodyInformation", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeBodyInformation__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeBodyInformation__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeBodyInformation__response = {
- "VehicleInfo",
- "UnsubscribeBodyInformation",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeBodyInformation,
- VehicleInfo__UnsubscribeBodyInformation__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeDeviceStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeDeviceStatus__request = {
- "VehicleInfo",
- "SubscribeDeviceStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus,
- VehicleInfo__SubscribeDeviceStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeDeviceStatus__response__parameter1 = {
- {"deviceStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeDeviceStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeDeviceStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeDeviceStatus__response = {
- "VehicleInfo",
- "SubscribeDeviceStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus,
- VehicleInfo__SubscribeDeviceStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeDeviceStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeDeviceStatus__request = {
- "VehicleInfo",
- "UnsubscribeDeviceStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus,
- VehicleInfo__UnsubscribeDeviceStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeDeviceStatus__response__parameter1 = {
- {"deviceStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeDeviceStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeDeviceStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeDeviceStatus__response = {
- "VehicleInfo",
- "UnsubscribeDeviceStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeDeviceStatus,
- VehicleInfo__UnsubscribeDeviceStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeDriverBraking__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeDriverBraking__request = {
- "VehicleInfo",
- "SubscribeDriverBraking",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking,
- VehicleInfo__SubscribeDriverBraking__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeDriverBraking__response__parameter1 = {
- {"driverBraking", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeDriverBraking__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeDriverBraking__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeDriverBraking__response = {
- "VehicleInfo",
- "SubscribeDriverBraking",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking,
- VehicleInfo__SubscribeDriverBraking__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeDriverBraking__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeDriverBraking__request = {
- "VehicleInfo",
- "UnsubscribeDriverBraking",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking,
- VehicleInfo__UnsubscribeDriverBraking__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeDriverBraking__response__parameter1 = {
- {"driverBraking", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeDriverBraking__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeDriverBraking__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeDriverBraking__response = {
- "VehicleInfo",
- "UnsubscribeDriverBraking",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeDriverBraking,
- VehicleInfo__UnsubscribeDriverBraking__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeWiperStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeWiperStatus__request = {
- "VehicleInfo",
- "SubscribeWiperStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus,
- VehicleInfo__SubscribeWiperStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeWiperStatus__response__parameter1 = {
- {"wiperStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeWiperStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeWiperStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeWiperStatus__response = {
- "VehicleInfo",
- "SubscribeWiperStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus,
- VehicleInfo__SubscribeWiperStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeWiperStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeWiperStatus__request = {
- "VehicleInfo",
- "UnsubscribeWiperStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus,
- VehicleInfo__UnsubscribeWiperStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeWiperStatus__response__parameter1 = {
- {"wiperStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeWiperStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeWiperStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeWiperStatus__response = {
- "VehicleInfo",
- "UnsubscribeWiperStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeWiperStatus,
- VehicleInfo__UnsubscribeWiperStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeHeadLampStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeHeadLampStatus__request = {
- "VehicleInfo",
- "SubscribeHeadLampStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus,
- VehicleInfo__SubscribeHeadLampStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeHeadLampStatus__response__parameter1 = {
- {"headLampStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeHeadLampStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeHeadLampStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeHeadLampStatus__response = {
- "VehicleInfo",
- "SubscribeHeadLampStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus,
- VehicleInfo__SubscribeHeadLampStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeHeadLampStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeHeadLampStatus__request = {
- "VehicleInfo",
- "UnsubscribeHeadLampStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus,
- VehicleInfo__UnsubscribeHeadLampStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeHeadLampStatus__response__parameter1 = {
- {"headLampStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeHeadLampStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeHeadLampStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeHeadLampStatus__response = {
- "VehicleInfo",
- "UnsubscribeHeadLampStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeHeadLampStatus,
- VehicleInfo__UnsubscribeHeadLampStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeEngineTorque__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeEngineTorque__request = {
- "VehicleInfo",
- "SubscribeEngineTorque",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque,
- VehicleInfo__SubscribeEngineTorque__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeEngineTorque__response__parameter1 = {
- {"engineTorque", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeEngineTorque__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeEngineTorque__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeEngineTorque__response = {
- "VehicleInfo",
- "SubscribeEngineTorque",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque,
- VehicleInfo__SubscribeEngineTorque__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeEngineTorque__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeEngineTorque__request = {
- "VehicleInfo",
- "UnsubscribeEngineTorque",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque,
- VehicleInfo__UnsubscribeEngineTorque__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeEngineTorque__response__parameter1 = {
- {"engineTorque", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeEngineTorque__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeEngineTorque__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeEngineTorque__response = {
- "VehicleInfo",
- "UnsubscribeEngineTorque",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeEngineTorque,
- VehicleInfo__UnsubscribeEngineTorque__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeAccPedalPosition__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeAccPedalPosition__request = {
- "VehicleInfo",
- "SubscribeAccPedalPosition",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition,
- VehicleInfo__SubscribeAccPedalPosition__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeAccPedalPosition__response__parameter1 = {
- {"accPedalPosition", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeAccPedalPosition__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeAccPedalPosition__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeAccPedalPosition__response = {
- "VehicleInfo",
- "SubscribeAccPedalPosition",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition,
- VehicleInfo__SubscribeAccPedalPosition__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeAccPedalPosition__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeAccPedalPosition__request = {
- "VehicleInfo",
- "UnsubscribeAccPedalPosition",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition,
- VehicleInfo__UnsubscribeAccPedalPosition__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeAccPedalPosition__response__parameter1 = {
- {"accPedalPosition", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeAccPedalPosition__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeAccPedalPosition__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeAccPedalPosition__response = {
- "VehicleInfo",
- "UnsubscribeAccPedalPosition",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeAccPedalPosition,
- VehicleInfo__UnsubscribeAccPedalPosition__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeSteeringWheelAngle__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeSteeringWheelAngle__request = {
- "VehicleInfo",
- "SubscribeSteeringWheelAngle",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle,
- VehicleInfo__SubscribeSteeringWheelAngle__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeSteeringWheelAngle__response__parameter1 = {
- {"steeringWheelAngle", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeSteeringWheelAngle__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeSteeringWheelAngle__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeSteeringWheelAngle__response = {
- "VehicleInfo",
- "SubscribeSteeringWheelAngle",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle,
- VehicleInfo__SubscribeSteeringWheelAngle__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeSteeringWheelAngle__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeSteeringWheelAngle__request = {
- "VehicleInfo",
- "UnsubscribeSteeringWheelAngle",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle,
- VehicleInfo__UnsubscribeSteeringWheelAngle__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeSteeringWheelAngle__response__parameter1 = {
- {"steeringWheelAngle", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeSteeringWheelAngle__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeSteeringWheelAngle__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeSteeringWheelAngle__response = {
- "VehicleInfo",
- "UnsubscribeSteeringWheelAngle",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeSteeringWheelAngle,
- VehicleInfo__UnsubscribeSteeringWheelAngle__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeECallInfo__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeECallInfo__request = {
- "VehicleInfo",
- "SubscribeECallInfo",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo,
- VehicleInfo__SubscribeECallInfo__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeECallInfo__response__parameter1 = {
- {"eCallInfo", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeECallInfo__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeECallInfo__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeECallInfo__response = {
- "VehicleInfo",
- "SubscribeECallInfo",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo,
- VehicleInfo__SubscribeECallInfo__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeECallInfo__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeECallInfo__request = {
- "VehicleInfo",
- "UnsubscribeECallInfo",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo,
- VehicleInfo__UnsubscribeECallInfo__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeECallInfo__response__parameter1 = {
- {"eCallInfo", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeECallInfo__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeECallInfo__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeECallInfo__response = {
- "VehicleInfo",
- "UnsubscribeECallInfo",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeECallInfo,
- VehicleInfo__UnsubscribeECallInfo__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeAirbagStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeAirbagStatus__request = {
- "VehicleInfo",
- "SubscribeAirbagStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus,
- VehicleInfo__SubscribeAirbagStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeAirbagStatus__response__parameter1 = {
- {"airbagStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeAirbagStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeAirbagStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeAirbagStatus__response = {
- "VehicleInfo",
- "SubscribeAirbagStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus,
- VehicleInfo__SubscribeAirbagStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeAirbagStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeAirbagStatus__request = {
- "VehicleInfo",
- "UnsubscribeAirbagStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus,
- VehicleInfo__UnsubscribeAirbagStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeAirbagStatus__response__parameter1 = {
- {"airbagStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeAirbagStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeAirbagStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeAirbagStatus__response = {
- "VehicleInfo",
- "UnsubscribeAirbagStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeAirbagStatus,
- VehicleInfo__UnsubscribeAirbagStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeEmergencyEvent__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeEmergencyEvent__request = {
- "VehicleInfo",
- "SubscribeEmergencyEvent",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent,
- VehicleInfo__SubscribeEmergencyEvent__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeEmergencyEvent__response__parameter1 = {
- {"emergencyEvent", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeEmergencyEvent__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeEmergencyEvent__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeEmergencyEvent__response = {
- "VehicleInfo",
- "SubscribeEmergencyEvent",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent,
- VehicleInfo__SubscribeEmergencyEvent__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeEmergencyEvent__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeEmergencyEvent__request = {
- "VehicleInfo",
- "UnsubscribeEmergencyEvent",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent,
- VehicleInfo__UnsubscribeEmergencyEvent__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeEmergencyEvent__response__parameter1 = {
- {"emergencyEvent", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeEmergencyEvent__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeEmergencyEvent__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeEmergencyEvent__response = {
- "VehicleInfo",
- "UnsubscribeEmergencyEvent",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeEmergencyEvent,
- VehicleInfo__UnsubscribeEmergencyEvent__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeClusterModeStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeClusterModeStatus__request = {
- "VehicleInfo",
- "SubscribeClusterModeStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus,
- VehicleInfo__SubscribeClusterModeStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeClusterModeStatus__response__parameter1 = {
- {"clusterModeStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeClusterModeStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeClusterModeStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeClusterModeStatus__response = {
- "VehicleInfo",
- "SubscribeClusterModeStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus,
- VehicleInfo__SubscribeClusterModeStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeClusterModeStatus__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeClusterModeStatus__request = {
- "VehicleInfo",
- "UnsubscribeClusterModeStatus",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus,
- VehicleInfo__UnsubscribeClusterModeStatus__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeClusterModeStatus__response__parameter1 = {
- {"clusterModeStatus", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeClusterModeStatus__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeClusterModeStatus__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeClusterModeStatus__response = {
- "VehicleInfo",
- "UnsubscribeClusterModeStatus",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeClusterModeStatus,
- VehicleInfo__UnsubscribeClusterModeStatus__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeMyKey__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeMyKey__request = {
- "VehicleInfo",
- "SubscribeMyKey",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey,
- VehicleInfo__SubscribeMyKey__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__SubscribeMyKey__response__parameter1 = {
- {"myKey", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__SubscribeMyKey__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__SubscribeMyKey__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__SubscribeMyKey__response = {
- "VehicleInfo",
- "SubscribeMyKey",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey,
- VehicleInfo__SubscribeMyKey__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeMyKey__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeMyKey__request = {
- "VehicleInfo",
- "UnsubscribeMyKey",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey,
- VehicleInfo__UnsubscribeMyKey__request__parameters};
-
-const ford_message_descriptions::StructDescription
- VehicleInfo__UnsubscribeMyKey__response__parameter1 = {
- {"myKey", ford_message_descriptions::Struct, true},
- Structs::Common__VehicleDataResult__parameters};
-const ford_message_descriptions::ParameterDescription*
- VehicleInfo__UnsubscribeMyKey__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&VehicleInfo__UnsubscribeMyKey__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- VehicleInfo__UnsubscribeMyKey__response = {
- "VehicleInfo",
- "UnsubscribeMyKey",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::VehicleInfo_UnsubscribeMyKey,
- VehicleInfo__UnsubscribeMyKey__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__ActivateApp__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- SDL__ActivateApp__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__ActivateApp__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription SDL__ActivateApp__request =
- {"SDL",
- "ActivateApp",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::SDL_ActivateApp,
- SDL__ActivateApp__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__ActivateApp__response__parameter1 = {
- "isSDLAllowed", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::StructDescription
- SDL__ActivateApp__response__parameter2 = {
- {"device", ford_message_descriptions::Struct, false},
- Structs::Common__DeviceInfo__parameters};
-const ford_message_descriptions::ParameterDescription
- SDL__ActivateApp__response__parameter3 = {
- "isPermissionsConsentNeeded", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- SDL__ActivateApp__response__parameter4 = {
- "isAppPermissionsRevoked", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::StructDescription
- SDL__ActivateApp__response__parameter5_array = {
- {"appRevokedPermissions", ford_message_descriptions::Struct, true},
- Structs::Common__PermissionItem__parameters};
-const ford_message_descriptions::ArrayDescription
- SDL__ActivateApp__response__parameter5 = {
- {"appRevokedPermissions", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__ActivateApp__response__parameter5_array,
- "(si(bb))"};
-const ford_message_descriptions::ParameterDescription
- SDL__ActivateApp__response__parameter6 = {
- "isAppRevoked", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- SDL__ActivateApp__response__parameter7 = {
- "priority", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription*
- SDL__ActivateApp__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__ActivateApp__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__ActivateApp__response__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__ActivateApp__response__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__ActivateApp__response__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__ActivateApp__response__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__ActivateApp__response__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__ActivateApp__response__parameter7,
- NULL};
-const ford_message_descriptions::MessageDescription SDL__ActivateApp__response =
- {"SDL",
- "ActivateApp",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::SDL_ActivateApp,
- SDL__ActivateApp__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__GetUserFriendlyMessage__request__parameter1_array = {
- "messageCodes", ford_message_descriptions::String, true};
-const ford_message_descriptions::ArrayDescription
- SDL__GetUserFriendlyMessage__request__parameter1 = {
- {"messageCodes", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetUserFriendlyMessage__request__parameter1_array,
- "s"};
-const ford_message_descriptions::ParameterDescription
- SDL__GetUserFriendlyMessage__request__parameter2 = {
- "language", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription*
- SDL__GetUserFriendlyMessage__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetUserFriendlyMessage__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetUserFriendlyMessage__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__GetUserFriendlyMessage__request = {
- "SDL",
- "GetUserFriendlyMessage",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::SDL_GetUserFriendlyMessage,
- SDL__GetUserFriendlyMessage__request__parameters};
-
-const ford_message_descriptions::StructDescription
- SDL__GetUserFriendlyMessage__response__parameter1_array = {
- {"messages", ford_message_descriptions::Struct, true},
- Structs::Common__UserFriendlyMessage__parameters};
-const ford_message_descriptions::ArrayDescription
- SDL__GetUserFriendlyMessage__response__parameter1 = {
- {"messages", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetUserFriendlyMessage__response__parameter1_array,
- "(s(bs)(bs)(bs)(bs)(bs))"};
-const ford_message_descriptions::ParameterDescription*
- SDL__GetUserFriendlyMessage__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetUserFriendlyMessage__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__GetUserFriendlyMessage__response = {
- "SDL",
- "GetUserFriendlyMessage",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::SDL_GetUserFriendlyMessage,
- SDL__GetUserFriendlyMessage__response__parameters};
-
-const ford_message_descriptions::StructDescription
- SDL__OnAllowSDLFunctionality__notification__parameter1 = {
- {"device", ford_message_descriptions::Struct, false},
- Structs::Common__DeviceInfo__parameters};
-const ford_message_descriptions::ParameterDescription
- SDL__OnAllowSDLFunctionality__notification__parameter2 = {
- "allowed", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription
- SDL__OnAllowSDLFunctionality__notification__parameter3 = {
- "source", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- SDL__OnAllowSDLFunctionality__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAllowSDLFunctionality__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAllowSDLFunctionality__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAllowSDLFunctionality__notification__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__OnAllowSDLFunctionality__notification = {
- "SDL",
- "OnAllowSDLFunctionality",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::SDL_OnAllowSDLFunctionality,
- SDL__OnAllowSDLFunctionality__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__OnReceivedPolicyUpdate__notification__parameter1 = {
- "policyfile", ford_message_descriptions::String, true};
-const ford_message_descriptions::ParameterDescription*
- SDL__OnReceivedPolicyUpdate__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnReceivedPolicyUpdate__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__OnReceivedPolicyUpdate__notification = {
- "SDL",
- "OnReceivedPolicyUpdate",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::SDL_OnReceivedPolicyUpdate,
- SDL__OnReceivedPolicyUpdate__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- SDL__OnPolicyUpdate__notification__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- SDL__OnPolicyUpdate__notification = {
- "SDL",
- "OnPolicyUpdate",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::SDL_OnPolicyUpdate,
- SDL__OnPolicyUpdate__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__GetListOfPermissions__request__parameter1 = {
- "appID", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::ParameterDescription*
- SDL__GetListOfPermissions__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetListOfPermissions__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__GetListOfPermissions__request = {
- "SDL",
- "GetListOfPermissions",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::SDL_GetListOfPermissions,
- SDL__GetListOfPermissions__request__parameters};
-
-const ford_message_descriptions::StructDescription
- SDL__GetListOfPermissions__response__parameter1_array = {
- {"allowedFunctions", ford_message_descriptions::Struct, true},
- Structs::Common__PermissionItem__parameters};
-const ford_message_descriptions::ArrayDescription
- SDL__GetListOfPermissions__response__parameter1 = {
- {"allowedFunctions", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetListOfPermissions__response__parameter1_array,
- "(si(bb))"};
-const ford_message_descriptions::ParameterDescription*
- SDL__GetListOfPermissions__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetListOfPermissions__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__GetListOfPermissions__response = {
- "SDL",
- "GetListOfPermissions",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::SDL_GetListOfPermissions,
- SDL__GetListOfPermissions__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__OnAppPermissionConsent__notification__parameter1 = {
- "appID", ford_message_descriptions::Integer, false};
-const ford_message_descriptions::StructDescription
- SDL__OnAppPermissionConsent__notification__parameter2_array = {
- {"consentedFunctions", ford_message_descriptions::Struct, true},
- Structs::Common__PermissionItem__parameters};
-const ford_message_descriptions::ArrayDescription
- SDL__OnAppPermissionConsent__notification__parameter2 = {
- {"consentedFunctions", ford_message_descriptions::Array, true},
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionConsent__notification__parameter2_array,
- "(si(bb))"};
-const ford_message_descriptions::ParameterDescription
- SDL__OnAppPermissionConsent__notification__parameter3 = {
- "source", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- SDL__OnAppPermissionConsent__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionConsent__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionConsent__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionConsent__notification__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__OnAppPermissionConsent__notification = {
- "SDL",
- "OnAppPermissionConsent",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::SDL_OnAppPermissionConsent,
- SDL__OnAppPermissionConsent__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__OnAppPermissionChanged__notification__parameter1 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription
- SDL__OnAppPermissionChanged__notification__parameter2 = {
- "isAppPermissionsRevoked", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::StructDescription
- SDL__OnAppPermissionChanged__notification__parameter3_array = {
- {"appRevokedPermissions", ford_message_descriptions::Struct, true},
- Structs::Common__PermissionItem__parameters};
-const ford_message_descriptions::ArrayDescription
- SDL__OnAppPermissionChanged__notification__parameter3 = {
- {"appRevokedPermissions", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionChanged__notification__parameter3_array,
- "(si(bb))"};
-const ford_message_descriptions::ParameterDescription
- SDL__OnAppPermissionChanged__notification__parameter4 = {
- "appRevoked", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- SDL__OnAppPermissionChanged__notification__parameter5 = {
- "appPermissionsConsentNeeded",
- ford_message_descriptions::Boolean,
- false};
-const ford_message_descriptions::ParameterDescription
- SDL__OnAppPermissionChanged__notification__parameter6 = {
- "appUnauthorized", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- SDL__OnAppPermissionChanged__notification__parameter7 = {
- "priority", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription
- SDL__OnAppPermissionChanged__notification__parameter8_array = {
- "requestType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ArrayDescription
- SDL__OnAppPermissionChanged__notification__parameter8 = {
- {"requestType", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionChanged__notification__parameter8_array,
- "i"};
-const ford_message_descriptions::ParameterDescription*
- SDL__OnAppPermissionChanged__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionChanged__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionChanged__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionChanged__notification__parameter3,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionChanged__notification__parameter4,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionChanged__notification__parameter5,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionChanged__notification__parameter6,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionChanged__notification__parameter7,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnAppPermissionChanged__notification__parameter8,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__OnAppPermissionChanged__notification = {
- "SDL",
- "OnAppPermissionChanged",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::SDL_OnAppPermissionChanged,
- SDL__OnAppPermissionChanged__notification__parameters};
-
-const ford_message_descriptions::StructDescription
- SDL__OnSDLConsentNeeded__notification__parameter1 = {
- {"device", ford_message_descriptions::Struct, true},
- Structs::Common__DeviceInfo__parameters};
-const ford_message_descriptions::ParameterDescription*
- SDL__OnSDLConsentNeeded__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnSDLConsentNeeded__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__OnSDLConsentNeeded__notification = {
- "SDL",
- "OnSDLConsentNeeded",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::SDL_OnSDLConsentNeeded,
- SDL__OnSDLConsentNeeded__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- SDL__UpdateSDL__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription SDL__UpdateSDL__request = {
- "SDL",
- "UpdateSDL",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::SDL_UpdateSDL,
- SDL__UpdateSDL__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__UpdateSDL__response__parameter1 = {
- "result", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- SDL__UpdateSDL__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__UpdateSDL__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription SDL__UpdateSDL__response = {
- "SDL",
- "UpdateSDL",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::SDL_UpdateSDL,
- SDL__UpdateSDL__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- SDL__GetStatusUpdate__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- SDL__GetStatusUpdate__request = {"SDL",
- "GetStatusUpdate",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::SDL_GetStatusUpdate,
- SDL__GetStatusUpdate__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__GetStatusUpdate__response__parameter1 = {
- "status", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- SDL__GetStatusUpdate__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetStatusUpdate__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__GetStatusUpdate__response = {
- "SDL",
- "GetStatusUpdate",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::SDL_GetStatusUpdate,
- SDL__GetStatusUpdate__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__OnStatusUpdate__notification__parameter1 = {
- "status", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- SDL__OnStatusUpdate__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnStatusUpdate__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__OnStatusUpdate__notification = {
- "SDL",
- "OnStatusUpdate",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::SDL_OnStatusUpdate,
- SDL__OnStatusUpdate__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__OnSystemError__notification__parameter1 = {
- "error", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- SDL__OnSystemError__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnSystemError__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__OnSystemError__notification = {
- "SDL",
- "OnSystemError",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::SDL_OnSystemError,
- SDL__OnSystemError__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__AddStatisticsInfo__notification__parameter1 = {
- "statisticType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription*
- SDL__AddStatisticsInfo__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__AddStatisticsInfo__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__AddStatisticsInfo__notification = {
- "SDL",
- "AddStatisticsInfo",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::SDL_AddStatisticsInfo,
- SDL__AddStatisticsInfo__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__GetURLS__request__parameter1 = {
- "service", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- SDL__GetURLS__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetURLS__request__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription SDL__GetURLS__request = {
- "SDL",
- "GetURLS",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::SDL_GetURLS,
- SDL__GetURLS__request__parameters};
-
-const ford_message_descriptions::StructDescription
- SDL__GetURLS__response__parameter1_array = {
- {"urls", ford_message_descriptions::Struct, true},
- Structs::Common__ServiceInfo__parameters};
-const ford_message_descriptions::ArrayDescription
- SDL__GetURLS__response__parameter1 = {
- {"urls", ford_message_descriptions::Array, false},
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetURLS__response__parameter1_array,
- "(s(bs))"};
-const ford_message_descriptions::ParameterDescription*
- SDL__GetURLS__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__GetURLS__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription SDL__GetURLS__response = {
- "SDL",
- "GetURLS",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::SDL_GetURLS,
- SDL__GetURLS__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- SDL__OnDeviceStateChanged__notification__parameter1 = {
- "deviceState", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- SDL__OnDeviceStateChanged__notification__parameter2 = {
- "deviceInternalId", ford_message_descriptions::String, true};
-const ford_message_descriptions::StructDescription
- SDL__OnDeviceStateChanged__notification__parameter3 = {
- {"deviceId", ford_message_descriptions::Struct, false},
- Structs::Common__DeviceInfo__parameters};
-const ford_message_descriptions::ParameterDescription*
- SDL__OnDeviceStateChanged__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnDeviceStateChanged__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnDeviceStateChanged__notification__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&SDL__OnDeviceStateChanged__notification__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- SDL__OnDeviceStateChanged__notification = {
- "SDL",
- "OnDeviceStateChanged",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::SDL_OnDeviceStateChanged,
- SDL__OnDeviceStateChanged__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- RC__IsReady__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription RC__IsReady__request = {
- "RC",
- "IsReady",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::RC_IsReady,
- RC__IsReady__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- RC__IsReady__response__parameter1 = {
- "available", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- RC__IsReady__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&RC__IsReady__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription RC__IsReady__response = {
- "RC",
- "IsReady",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::RC_IsReady,
- RC__IsReady__response__parameters};
-
-const ford_message_descriptions::ParameterDescription*
- RC__GetCapabilities__request__parameters[] = {NULL};
-const ford_message_descriptions::MessageDescription
- RC__GetCapabilities__request = {"RC",
- "GetCapabilities",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::RC_GetCapabilities,
- RC__GetCapabilities__request__parameters};
-
-const ford_message_descriptions::StructDescription
- RC__GetCapabilities__response__parameter1 = {
- {"remoteControlCapability", ford_message_descriptions::Struct, false},
- Structs::Common__RemoteControlCapabilities__parameters};
-const ford_message_descriptions::ParameterDescription*
- RC__GetCapabilities__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&RC__GetCapabilities__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- RC__GetCapabilities__response = {"RC",
- "GetCapabilities",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::RC_GetCapabilities,
- RC__GetCapabilities__response__parameters};
-
-const ford_message_descriptions::StructDescription
- RC__SetInteriorVehicleData__request__parameter1 = {
- {"moduleData", ford_message_descriptions::Struct, true},
- Structs::Common__ModuleData__parameters};
-const ford_message_descriptions::ParameterDescription
- RC__SetInteriorVehicleData__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- RC__SetInteriorVehicleData__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&RC__SetInteriorVehicleData__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&RC__SetInteriorVehicleData__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- RC__SetInteriorVehicleData__request = {
- "RC",
- "SetInteriorVehicleData",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::RC_SetInteriorVehicleData,
- RC__SetInteriorVehicleData__request__parameters};
-
-const ford_message_descriptions::StructDescription
- RC__SetInteriorVehicleData__response__parameter1 = {
- {"moduleData", ford_message_descriptions::Struct, true},
- Structs::Common__ModuleData__parameters};
-const ford_message_descriptions::ParameterDescription*
- RC__SetInteriorVehicleData__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&RC__SetInteriorVehicleData__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- RC__SetInteriorVehicleData__response = {
- "RC",
- "SetInteriorVehicleData",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::RC_SetInteriorVehicleData,
- RC__SetInteriorVehicleData__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- RC__GetInteriorVehicleData__request__parameter1 = {
- "moduleType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- RC__GetInteriorVehicleData__request__parameter2 = {
- "subscribe", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- RC__GetInteriorVehicleData__request__parameter3 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- RC__GetInteriorVehicleData__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&RC__GetInteriorVehicleData__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&RC__GetInteriorVehicleData__request__parameter2,
- (const ford_message_descriptions::
- ParameterDescription*)&RC__GetInteriorVehicleData__request__parameter3,
- NULL};
-const ford_message_descriptions::MessageDescription
- RC__GetInteriorVehicleData__request = {
- "RC",
- "GetInteriorVehicleData",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::RC_GetInteriorVehicleData,
- RC__GetInteriorVehicleData__request__parameters};
-
-const ford_message_descriptions::StructDescription
- RC__GetInteriorVehicleData__response__parameter1 = {
- {"moduleData", ford_message_descriptions::Struct, true},
- Structs::Common__ModuleData__parameters};
-const ford_message_descriptions::ParameterDescription
- RC__GetInteriorVehicleData__response__parameter2 = {
- "isSubscribed", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription*
- RC__GetInteriorVehicleData__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&RC__GetInteriorVehicleData__response__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&RC__GetInteriorVehicleData__response__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- RC__GetInteriorVehicleData__response = {
- "RC",
- "GetInteriorVehicleData",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::RC_GetInteriorVehicleData,
- RC__GetInteriorVehicleData__response__parameters};
-
-const ford_message_descriptions::ParameterDescription
- RC__GetInteriorVehicleDataConsent__request__parameter1 = {
- "moduleType", ford_message_descriptions::Enum, true};
-const ford_message_descriptions::ParameterDescription
- RC__GetInteriorVehicleDataConsent__request__parameter2 = {
- "appID", ford_message_descriptions::Integer, true};
-const ford_message_descriptions::ParameterDescription*
- RC__GetInteriorVehicleDataConsent__request__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&RC__GetInteriorVehicleDataConsent__request__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&RC__GetInteriorVehicleDataConsent__request__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- RC__GetInteriorVehicleDataConsent__request = {
- "RC",
- "GetInteriorVehicleDataConsent",
- hmi_apis::messageType::request,
- hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent,
- RC__GetInteriorVehicleDataConsent__request__parameters};
-
-const ford_message_descriptions::ParameterDescription
- RC__GetInteriorVehicleDataConsent__response__parameter1 = {
- "allowed", ford_message_descriptions::Boolean, true};
-const ford_message_descriptions::ParameterDescription*
- RC__GetInteriorVehicleDataConsent__response__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&RC__GetInteriorVehicleDataConsent__response__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- RC__GetInteriorVehicleDataConsent__response = {
- "RC",
- "GetInteriorVehicleDataConsent",
- hmi_apis::messageType::response,
- hmi_apis::FunctionID::RC_GetInteriorVehicleDataConsent,
- RC__GetInteriorVehicleDataConsent__response__parameters};
-
-const ford_message_descriptions::StructDescription
- RC__OnInteriorVehicleData__notification__parameter1 = {
- {"moduleData", ford_message_descriptions::Struct, true},
- Structs::Common__ModuleData__parameters};
-const ford_message_descriptions::ParameterDescription*
- RC__OnInteriorVehicleData__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&RC__OnInteriorVehicleData__notification__parameter1,
- NULL};
-const ford_message_descriptions::MessageDescription
- RC__OnInteriorVehicleData__notification = {
- "RC",
- "OnInteriorVehicleData",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::RC_OnInteriorVehicleData,
- RC__OnInteriorVehicleData__notification__parameters};
-
-const ford_message_descriptions::ParameterDescription
- RC__OnRemoteControlSettings__notification__parameter1 = {
- "allowed", ford_message_descriptions::Boolean, false};
-const ford_message_descriptions::ParameterDescription
- RC__OnRemoteControlSettings__notification__parameter2 = {
- "accessMode", ford_message_descriptions::Enum, false};
-const ford_message_descriptions::ParameterDescription*
- RC__OnRemoteControlSettings__notification__parameters[] = {
- (const ford_message_descriptions::
- ParameterDescription*)&RC__OnRemoteControlSettings__notification__parameter1,
- (const ford_message_descriptions::
- ParameterDescription*)&RC__OnRemoteControlSettings__notification__parameter2,
- NULL};
-const ford_message_descriptions::MessageDescription
- RC__OnRemoteControlSettings__notification = {
- "RC",
- "OnRemoteControlSettings",
- hmi_apis::messageType::notification,
- hmi_apis::FunctionID::RC_OnRemoteControlSettings,
- RC__OnRemoteControlSettings__notification__parameters};
-}
-
-namespace ford_message_descriptions {
-
-const MessageDescription* message_descriptions[] = {
- &Buttons__GetCapabilities__request,
- &Buttons__GetCapabilities__response,
- &Buttons__OnButtonEvent__notification,
- &Buttons__OnButtonPress__notification,
- &Buttons__OnButtonSubscription__notification,
- &BasicCommunication__OnReady__notification,
- &BasicCommunication__OnStartDeviceDiscovery__notification,
- &BasicCommunication__OnUpdateDeviceList__notification,
- &BasicCommunication__OnPhoneCall__notification,
- &BasicCommunication__OnEmergencyEvent__notification,
- &BasicCommunication__OnResumeAudioSource__notification,
- &BasicCommunication__OnSDLPersistenceComplete__notification,
- &BasicCommunication__UpdateAppList__request,
- &BasicCommunication__UpdateAppList__response,
- &BasicCommunication__UpdateDeviceList__request,
- &BasicCommunication__UpdateDeviceList__response,
- &BasicCommunication__OnFileRemoved__notification,
- &BasicCommunication__AllowDeviceToConnect__request,
- &BasicCommunication__AllowDeviceToConnect__response,
- &BasicCommunication__OnDeviceChosen__notification,
- &BasicCommunication__OnFindApplications__notification,
- &BasicCommunication__ActivateApp__request,
- &BasicCommunication__ActivateApp__response,
- &BasicCommunication__OnAppActivated__notification,
- &BasicCommunication__OnAppDeactivated__notification,
- &BasicCommunication__OnAppRegistered__notification,
- &BasicCommunication__OnAppUnregistered__notification,
- &BasicCommunication__OnExitApplication__notification,
- &BasicCommunication__OnExitAllApplications__notification,
- &BasicCommunication__OnAwakeSDL__notification,
- &BasicCommunication__MixingAudioSupported__request,
- &BasicCommunication__MixingAudioSupported__response,
- &BasicCommunication__PlayTone__notification,
- &BasicCommunication__DialNumber__request,
- &BasicCommunication__DialNumber__response,
- &BasicCommunication__OnSystemRequest__notification,
- &BasicCommunication__SystemRequest__request,
- &BasicCommunication__SystemRequest__response,
- &BasicCommunication__PolicyUpdate__request,
- &BasicCommunication__PolicyUpdate__response,
- &BasicCommunication__OnSDLClose__notification,
- &BasicCommunication__OnPutFile__notification,
- &BasicCommunication__GetSystemInfo__request,
- &BasicCommunication__GetSystemInfo__response,
- &BasicCommunication__OnSystemInfoChanged__notification,
- &BasicCommunication__OnIgnitionCycleOver__notification,
- &BasicCommunication__DecryptCertificate__request,
- &BasicCommunication__DecryptCertificate__response,
- &BasicCommunication__OnEventChanged__notification,
- &VR__IsReady__request,
- &VR__IsReady__response,
- &VR__Started__notification,
- &VR__Stopped__notification,
- &VR__AddCommand__request,
- &VR__AddCommand__response,
- &VR__DeleteCommand__request,
- &VR__DeleteCommand__response,
- &VR__PerformInteraction__request,
- &VR__PerformInteraction__response,
- &VR__OnCommand__notification,
- &VR__ChangeRegistration__request,
- &VR__ChangeRegistration__response,
- &VR__OnLanguageChange__notification,
- &VR__GetSupportedLanguages__request,
- &VR__GetSupportedLanguages__response,
- &VR__GetLanguage__request,
- &VR__GetLanguage__response,
- &VR__GetCapabilities__request,
- &VR__GetCapabilities__response,
- &TTS__GetCapabilities__request,
- &TTS__GetCapabilities__response,
- &TTS__Started__notification,
- &TTS__Stopped__notification,
- &TTS__IsReady__request,
- &TTS__IsReady__response,
- &TTS__Speak__request,
- &TTS__Speak__response,
- &TTS__StopSpeaking__request,
- &TTS__StopSpeaking__response,
- &TTS__ChangeRegistration__request,
- &TTS__ChangeRegistration__response,
- &TTS__OnLanguageChange__notification,
- &TTS__GetSupportedLanguages__request,
- &TTS__GetSupportedLanguages__response,
- &TTS__GetLanguage__request,
- &TTS__GetLanguage__response,
- &TTS__SetGlobalProperties__request,
- &TTS__SetGlobalProperties__response,
- &TTS__OnResetTimeout__notification,
- &UI__Alert__request,
- &UI__Alert__response,
- &UI__Show__request,
- &UI__Show__response,
- &UI__AddCommand__request,
- &UI__AddCommand__response,
- &UI__DeleteCommand__request,
- &UI__DeleteCommand__response,
- &UI__AddSubMenu__request,
- &UI__AddSubMenu__response,
- &UI__DeleteSubMenu__request,
- &UI__DeleteSubMenu__response,
- &UI__PerformInteraction__request,
- &UI__PerformInteraction__response,
- &UI__SetMediaClockTimer__request,
- &UI__SetMediaClockTimer__response,
- &UI__SetGlobalProperties__request,
- &UI__SetGlobalProperties__response,
- &UI__OnCommand__notification,
- &UI__OnSystemContext__notification,
- &UI__GetCapabilities__request,
- &UI__GetCapabilities__response,
- &UI__ChangeRegistration__request,
- &UI__ChangeRegistration__response,
- &UI__OnLanguageChange__notification,
- &UI__GetSupportedLanguages__request,
- &UI__GetSupportedLanguages__response,
- &UI__GetLanguage__request,
- &UI__GetLanguage__response,
- &UI__OnDriverDistraction__notification,
- &UI__SetAppIcon__request,
- &UI__SetAppIcon__response,
- &UI__SetDisplayLayout__request,
- &UI__SetDisplayLayout__response,
- &UI__ShowCustomForm__request,
- &UI__ShowCustomForm__response,
- &UI__OnKeyboardInput__notification,
- &UI__OnTouchEvent__notification,
- &UI__Slider__request,
- &UI__Slider__response,
- &UI__ScrollableMessage__request,
- &UI__ScrollableMessage__response,
- &UI__PerformAudioPassThru__request,
- &UI__PerformAudioPassThru__response,
- &UI__EndAudioPassThru__request,
- &UI__EndAudioPassThru__response,
- &UI__IsReady__request,
- &UI__IsReady__response,
- &UI__ClosePopUp__request,
- &UI__ClosePopUp__response,
- &UI__OnResetTimeout__notification,
- &UI__OnRecordStart__notification,
- &UI__SendHapticData__request,
- &UI__SendHapticData__response,
- &Navigation__IsReady__request,
- &Navigation__IsReady__response,
- &Navigation__SendLocation__request,
- &Navigation__SendLocation__response,
- &Navigation__DialNumber__request,
- &Navigation__DialNumber__response,
- &Navigation__ShowConstantTBT__request,
- &Navigation__ShowConstantTBT__response,
- &Navigation__AlertManeuver__request,
- &Navigation__AlertManeuver__response,
- &Navigation__UpdateTurnList__request,
- &Navigation__UpdateTurnList__response,
- &Navigation__OnTBTClientState__notification,
- &Navigation__SetVideoConfig__request,
- &Navigation__SetVideoConfig__response,
- &Navigation__StartStream__request,
- &Navigation__StartStream__response,
- &Navigation__StopStream__request,
- &Navigation__StopStream__response,
- &Navigation__StartAudioStream__request,
- &Navigation__StartAudioStream__response,
- &Navigation__StopAudioStream__request,
- &Navigation__StopAudioStream__response,
- &Navigation__OnAudioDataStreaming__notification,
- &Navigation__OnVideoDataStreaming__notification,
- &Navigation__GetWayPoints__request,
- &Navigation__GetWayPoints__response,
- &Navigation__OnWayPointChange__notification,
- &Navigation__SubscribeWayPoints__request,
- &Navigation__SubscribeWayPoints__response,
- &Navigation__UnsubscribeWayPoints__request,
- &Navigation__UnsubscribeWayPoints__response,
- &VehicleInfo__IsReady__request,
- &VehicleInfo__IsReady__response,
- &VehicleInfo__GetVehicleType__request,
- &VehicleInfo__GetVehicleType__response,
- &VehicleInfo__ReadDID__request,
- &VehicleInfo__ReadDID__response,
- &VehicleInfo__GetDTCs__request,
- &VehicleInfo__GetDTCs__response,
- &VehicleInfo__DiagnosticMessage__request,
- &VehicleInfo__DiagnosticMessage__response,
- &VehicleInfo__SubscribeVehicleData__request,
- &VehicleInfo__SubscribeVehicleData__response,
- &VehicleInfo__UnsubscribeVehicleData__request,
- &VehicleInfo__UnsubscribeVehicleData__response,
- &VehicleInfo__GetVehicleData__request,
- &VehicleInfo__GetVehicleData__response,
- &VehicleInfo__OnVehicleData__notification,
- &VehicleInfo__GetGpsData__request,
- &VehicleInfo__GetGpsData__response,
- &VehicleInfo__GetSpeed__request,
- &VehicleInfo__GetSpeed__response,
- &VehicleInfo__GetRpm__request,
- &VehicleInfo__GetRpm__response,
- &VehicleInfo__GetFuelLevel__request,
- &VehicleInfo__GetFuelLevel__response,
- &VehicleInfo__GetFuelLevelState__request,
- &VehicleInfo__GetFuelLevelState__response,
- &VehicleInfo__GetInstantFuelConsumption__request,
- &VehicleInfo__GetInstantFuelConsumption__response,
- &VehicleInfo__GetExternalTemperature__request,
- &VehicleInfo__GetExternalTemperature__response,
- &VehicleInfo__GetVin__request,
- &VehicleInfo__GetVin__response,
- &VehicleInfo__GetPrndl__request,
- &VehicleInfo__GetPrndl__response,
- &VehicleInfo__GetTirePressure__request,
- &VehicleInfo__GetTirePressure__response,
- &VehicleInfo__GetOdometer__request,
- &VehicleInfo__GetOdometer__response,
- &VehicleInfo__GetBeltStatus__request,
- &VehicleInfo__GetBeltStatus__response,
- &VehicleInfo__GetBodyInformation__request,
- &VehicleInfo__GetBodyInformation__response,
- &VehicleInfo__GetDeviceStatus__request,
- &VehicleInfo__GetDeviceStatus__response,
- &VehicleInfo__GetDriverBraking__request,
- &VehicleInfo__GetDriverBraking__response,
- &VehicleInfo__GetWiperStatus__request,
- &VehicleInfo__GetWiperStatus__response,
- &VehicleInfo__GetHeadLampStatus__request,
- &VehicleInfo__GetHeadLampStatus__response,
- &VehicleInfo__GetEngineTorque__request,
- &VehicleInfo__GetEngineTorque__response,
- &VehicleInfo__GetAccPedalPosition__request,
- &VehicleInfo__GetAccPedalPosition__response,
- &VehicleInfo__GetSteeringWheelAngle__request,
- &VehicleInfo__GetSteeringWheelAngle__response,
- &VehicleInfo__GetECallInfo__request,
- &VehicleInfo__GetECallInfo__response,
- &VehicleInfo__GetAirbagStatus__request,
- &VehicleInfo__GetAirbagStatus__response,
- &VehicleInfo__GetEmergencyEvent__request,
- &VehicleInfo__GetEmergencyEvent__response,
- &VehicleInfo__GetClusterModeStatus__request,
- &VehicleInfo__GetClusterModeStatus__response,
- &VehicleInfo__GetMyKey__request,
- &VehicleInfo__GetMyKey__response,
- &VehicleInfo__OnGpsData__notification,
- &VehicleInfo__OnSpeed__notification,
- &VehicleInfo__OnRpm__notification,
- &VehicleInfo__OnFuelLevel__notification,
- &VehicleInfo__OnFuelLevelState__notification,
- &VehicleInfo__OnInstantFuelConsumption__notification,
- &VehicleInfo__OnExternalTemperature__notification,
- &VehicleInfo__OnVin__notification,
- &VehicleInfo__OnPrndl__notification,
- &VehicleInfo__OnTirePressure__notification,
- &VehicleInfo__OnOdometer__notification,
- &VehicleInfo__OnBeltStatus__notification,
- &VehicleInfo__OnBodyInformation__notification,
- &VehicleInfo__OnDeviceStatus__notification,
- &VehicleInfo__OnDriverBraking__notification,
- &VehicleInfo__OnWiperStatus__notification,
- &VehicleInfo__OnHeadLampStatus__notification,
- &VehicleInfo__OnEngineTorque__notification,
- &VehicleInfo__OnAccPedalPosition__notification,
- &VehicleInfo__OnSteeringWheelAngle__notification,
- &VehicleInfo__OnECallInfo__notification,
- &VehicleInfo__OnAirbagStatus__notification,
- &VehicleInfo__OnEmergencyEvent__notification,
- &VehicleInfo__OnClusterModeStatus__notification,
- &VehicleInfo__OnMyKey__notification,
- &VehicleInfo__SubscribeGps__request,
- &VehicleInfo__SubscribeGps__response,
- &VehicleInfo__UnsubscribeGps__request,
- &VehicleInfo__UnsubscribeGps__response,
- &VehicleInfo__SubscribeSpeed__request,
- &VehicleInfo__SubscribeSpeed__response,
- &VehicleInfo__UnsubscribeSpeed__request,
- &VehicleInfo__UnsubscribeSpeed__response,
- &VehicleInfo__SubscribeRpm__request,
- &VehicleInfo__SubscribeRpm__response,
- &VehicleInfo__UnsubscribeRpm__request,
- &VehicleInfo__UnsubscribeRpm__response,
- &VehicleInfo__SubscribeFuelLevel__request,
- &VehicleInfo__SubscribeFuelLevel__response,
- &VehicleInfo__UnsubscribeFuelLevel__request,
- &VehicleInfo__UnsubscribeFuelLevel__response,
- &VehicleInfo__SubscribeFuelLevel_State__request,
- &VehicleInfo__SubscribeFuelLevel_State__response,
- &VehicleInfo__UnsubscribeFuelLevel_State__request,
- &VehicleInfo__UnsubscribeFuelLevel_State__response,
- &VehicleInfo__SubscribeInstantFuelConsumption__request,
- &VehicleInfo__SubscribeInstantFuelConsumption__response,
- &VehicleInfo__UnsubscribeInstantFuelConsumption__request,
- &VehicleInfo__UnsubscribeInstantFuelConsumption__response,
- &VehicleInfo__SubscribeExternalTemperature__request,
- &VehicleInfo__SubscribeExternalTemperature__response,
- &VehicleInfo__UnsubscribeExternalTemperature__request,
- &VehicleInfo__UnsubscribeExternalTemperature__response,
- &VehicleInfo__SubscribePrndl__request,
- &VehicleInfo__SubscribePrndl__response,
- &VehicleInfo__UnsubscribePrndl__request,
- &VehicleInfo__UnsubscribePrndl__response,
- &VehicleInfo__SubscribeVin__request,
- &VehicleInfo__SubscribeVin__response,
- &VehicleInfo__UnsubscribeVin__request,
- &VehicleInfo__UnsubscribeVin__response,
- &VehicleInfo__SubscribeTirePressure__request,
- &VehicleInfo__SubscribeTirePressure__response,
- &VehicleInfo__UnsubscribeTirePressure__request,
- &VehicleInfo__UnsubscribeTirePressure__response,
- &VehicleInfo__SubscribeOdometer__request,
- &VehicleInfo__SubscribeOdometer__response,
- &VehicleInfo__UnsubscribeOdometer__request,
- &VehicleInfo__UnsubscribeOdometer__response,
- &VehicleInfo__SubscribeBeltStatus__request,
- &VehicleInfo__SubscribeBeltStatus__response,
- &VehicleInfo__UnsubscribeBeltStatus__request,
- &VehicleInfo__UnsubscribeBeltStatus__response,
- &VehicleInfo__SubscribeBodyInformation__request,
- &VehicleInfo__SubscribeBodyInformation__response,
- &VehicleInfo__UnsubscribeBodyInformation__request,
- &VehicleInfo__UnsubscribeBodyInformation__response,
- &VehicleInfo__SubscribeDeviceStatus__request,
- &VehicleInfo__SubscribeDeviceStatus__response,
- &VehicleInfo__UnsubscribeDeviceStatus__request,
- &VehicleInfo__UnsubscribeDeviceStatus__response,
- &VehicleInfo__SubscribeDriverBraking__request,
- &VehicleInfo__SubscribeDriverBraking__response,
- &VehicleInfo__UnsubscribeDriverBraking__request,
- &VehicleInfo__UnsubscribeDriverBraking__response,
- &VehicleInfo__SubscribeWiperStatus__request,
- &VehicleInfo__SubscribeWiperStatus__response,
- &VehicleInfo__UnsubscribeWiperStatus__request,
- &VehicleInfo__UnsubscribeWiperStatus__response,
- &VehicleInfo__SubscribeHeadLampStatus__request,
- &VehicleInfo__SubscribeHeadLampStatus__response,
- &VehicleInfo__UnsubscribeHeadLampStatus__request,
- &VehicleInfo__UnsubscribeHeadLampStatus__response,
- &VehicleInfo__SubscribeEngineTorque__request,
- &VehicleInfo__SubscribeEngineTorque__response,
- &VehicleInfo__UnsubscribeEngineTorque__request,
- &VehicleInfo__UnsubscribeEngineTorque__response,
- &VehicleInfo__SubscribeAccPedalPosition__request,
- &VehicleInfo__SubscribeAccPedalPosition__response,
- &VehicleInfo__UnsubscribeAccPedalPosition__request,
- &VehicleInfo__UnsubscribeAccPedalPosition__response,
- &VehicleInfo__SubscribeSteeringWheelAngle__request,
- &VehicleInfo__SubscribeSteeringWheelAngle__response,
- &VehicleInfo__UnsubscribeSteeringWheelAngle__request,
- &VehicleInfo__UnsubscribeSteeringWheelAngle__response,
- &VehicleInfo__SubscribeECallInfo__request,
- &VehicleInfo__SubscribeECallInfo__response,
- &VehicleInfo__UnsubscribeECallInfo__request,
- &VehicleInfo__UnsubscribeECallInfo__response,
- &VehicleInfo__SubscribeAirbagStatus__request,
- &VehicleInfo__SubscribeAirbagStatus__response,
- &VehicleInfo__UnsubscribeAirbagStatus__request,
- &VehicleInfo__UnsubscribeAirbagStatus__response,
- &VehicleInfo__SubscribeEmergencyEvent__request,
- &VehicleInfo__SubscribeEmergencyEvent__response,
- &VehicleInfo__UnsubscribeEmergencyEvent__request,
- &VehicleInfo__UnsubscribeEmergencyEvent__response,
- &VehicleInfo__SubscribeClusterModeStatus__request,
- &VehicleInfo__SubscribeClusterModeStatus__response,
- &VehicleInfo__UnsubscribeClusterModeStatus__request,
- &VehicleInfo__UnsubscribeClusterModeStatus__response,
- &VehicleInfo__SubscribeMyKey__request,
- &VehicleInfo__SubscribeMyKey__response,
- &VehicleInfo__UnsubscribeMyKey__request,
- &VehicleInfo__UnsubscribeMyKey__response,
- &SDL__ActivateApp__request,
- &SDL__ActivateApp__response,
- &SDL__GetUserFriendlyMessage__request,
- &SDL__GetUserFriendlyMessage__response,
- &SDL__OnAllowSDLFunctionality__notification,
- &SDL__OnReceivedPolicyUpdate__notification,
- &SDL__OnPolicyUpdate__notification,
- &SDL__GetListOfPermissions__request,
- &SDL__GetListOfPermissions__response,
- &SDL__OnAppPermissionConsent__notification,
- &SDL__OnAppPermissionChanged__notification,
- &SDL__OnSDLConsentNeeded__notification,
- &SDL__UpdateSDL__request,
- &SDL__UpdateSDL__response,
- &SDL__GetStatusUpdate__request,
- &SDL__GetStatusUpdate__response,
- &SDL__OnStatusUpdate__notification,
- &SDL__OnSystemError__notification,
- &SDL__AddStatisticsInfo__notification,
- &SDL__GetURLS__request,
- &SDL__GetURLS__response,
- &SDL__OnDeviceStateChanged__notification,
- &RC__IsReady__request,
- &RC__IsReady__response,
- &RC__GetCapabilities__request,
- &RC__GetCapabilities__response,
- &RC__SetInteriorVehicleData__request,
- &RC__SetInteriorVehicleData__response,
- &RC__GetInteriorVehicleData__request,
- &RC__GetInteriorVehicleData__response,
- &RC__GetInteriorVehicleDataConsent__request,
- &RC__GetInteriorVehicleDataConsent__response,
- &RC__OnInteriorVehicleData__notification,
- &RC__OnRemoteControlSettings__notification,
- NULL};
-}
diff --git a/src/components/dbus/src/schema.cc b/src/components/dbus/src/schema.cc
deleted file mode 100644
index 3107d9ce6c..0000000000
--- a/src/components/dbus/src/schema.cc
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#include "dbus/schema.h"
-
-#include <algorithm>
-#include <functional>
-
-namespace dbus {
-
-struct Description {
- MessageId id;
- MessageName name;
- MessageType type;
- ListArgs args;
-};
-
-struct IsId : public std::unary_function<const Description*, bool> {
- explicit IsId(MessageId id) : id_(id) {}
- bool operator()(const Description* desc) {
- return desc->id == id_;
- }
-
- private:
- MessageId id_;
-};
-
-struct IsName : public std::unary_function<const Description*, bool> {
- explicit IsName(const MessageName& name) : name_(name) {}
- bool operator()(const Description* desc) {
- return desc->name == name_;
- }
-
- private:
- MessageName name_;
-};
-
-struct IsIdType : public std::unary_function<const Description*, bool> {
- explicit IsIdType(const MessageId& id, const MessageType& type)
- : id_(id), type_(type) {}
- bool operator()(const Description* desc) {
- return desc->id == id_ && desc->type == type_;
- }
-
- private:
- MessageId id_;
- MessageType type_;
-};
-
-struct IsNameType : public std::unary_function<const Description*, bool> {
- explicit IsNameType(const MessageName& name, const MessageType& type)
- : name_(name), type_(type) {}
- bool operator()(const Description* desc) {
- return desc->name == name_ && desc->type == type_;
- }
-
- private:
- MessageName name_;
- MessageType type_;
-};
-
-DBusSchema::DBusSchema(const MessageDescription** array) {
- const MessageDescription** msg = array;
- while (*msg != NULL) {
- Description* desc = new Description();
- desc->id = (*msg)->function_id;
- desc->name = std::make_pair((*msg)->interface, (*msg)->name);
- desc->type = (*msg)->message_type;
- const ParameterDescription** param;
- param = (*msg)->parameters;
- while (*param != NULL) {
- desc->args.push_back(*param);
- param++;
- }
- msgs_.push_back(desc);
- msg++;
- }
-}
-
-MessageName DBusSchema::getMessageName(MessageId id) const {
- Messages::const_iterator it =
- std::find_if(msgs_.begin(), msgs_.end(), IsId(id));
- if (msgs_.end() != it) {
- return (*it)->name;
- }
- return MessageName();
-}
-
-MessageId DBusSchema::getMessageId(const MessageName& name) const {
- Messages::const_iterator it =
- std::find_if(msgs_.begin(), msgs_.end(), IsName(name));
- if (msgs_.end() != it) {
- return (*it)->id;
- }
- return hmi_apis::FunctionID::eType::INVALID_ENUM;
-}
-
-ListArgs DBusSchema::getListArgs(MessageId id, MessageType type) const {
- Messages::const_iterator it =
- std::find_if(msgs_.begin(), msgs_.end(), IsIdType(id, type));
- if (msgs_.end() != it) {
- return (*it)->args;
- }
- return ListArgs();
-}
-
-ListArgs DBusSchema::getListArgs(const MessageName& name,
- MessageType type) const {
- Messages::const_iterator it =
- std::find_if(msgs_.begin(), msgs_.end(), IsNameType(name, type));
- if (msgs_.end() != it) {
- return (*it)->args;
- }
- return ListArgs();
-}
-
-} // namespace dbus_schema
diff --git a/src/components/dbus/test/dbus_message_controller_test.cc b/src/components/dbus/test/dbus_message_controller_test.cc
deleted file mode 100644
index c06e144f9b..0000000000
--- a/src/components/dbus/test/dbus_message_controller_test.cc
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * \file test_dbus_adapter.cc
- * \brief
- *
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pthread.h>
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-#include "dbus/mock_dbus_message_controller.h"
-#include "dbus/mock_subscriber.h"
-
-using ::testing::_;
-
-namespace test {
-namespace components {
-namespace dbus {
-
-ACTION_P(SignalTest, test) {
- if (test->thread_id != pthread_self()) {
- pthread_mutex_lock(&test->test_mutex);
- pthread_cond_signal(&test->test_cond);
- pthread_mutex_unlock(&test->test_mutex);
- } else {
- test->one_thread = true;
- }
-}
-
-class DBusMessageControllerTest : public ::testing::Test {
- public:
- volatile bool one_thread;
- pthread_t thread_id;
- static pthread_mutex_t test_mutex;
- static pthread_cond_t test_cond;
-
- protected:
- MockDBusMessageController* controller_;
- MockSubscriber* subscriber_;
-
- static void SetUpTestCase() {}
-
- static void TearDownTestCase() {}
-
- virtual void SetUp() {
- const std::string kService = "sdl.core.test_api";
- const std::string kPath = "/dbus_test";
- controller_ = new MockDBusMessageController(kService, kPath);
- subscriber_ = new MockSubscriber(kService, kPath);
- ASSERT_TRUE(controller_->Init());
- ASSERT_TRUE(subscriber_->Start());
- }
-
- void TearDown() OVERRIDE {
- delete controller_;
- delete subscriber_;
- }
-
- bool waitCond(int seconds) {
- if (one_thread)
- return true;
- timespec elapsed;
- clock_gettime(CLOCK_REALTIME, &elapsed);
- elapsed.tv_sec += seconds;
- return pthread_cond_timedwait(&test_cond, &test_mutex, &elapsed) !=
- ETIMEDOUT;
- }
-};
-
-pthread_mutex_t DBusMessageControllerTest::test_mutex;
-pthread_cond_t DBusMessageControllerTest::test_cond;
-
-TEST_F(DBusMessageControllerTest, Receive) {
- std::string text = "Test message for call method DBus";
- EXPECT_CALL(*controller_, Recv(text)).Times(1).WillOnce(SignalTest(this));
- subscriber_->Send(text);
- EXPECT_TRUE(waitCond(1));
-}
-
-TEST_F(DBusMessageControllerTest, DISABLED_Send) {
- const std::string kText = "Test message for signal DBus";
- // EXPECT_CALL(*subscriber_, Receive(kText)).Times(1);
- controller_->Send(kText);
-}
-
-} // namespace dbus
-} // namespace components
-} // namespace test
diff --git a/src/components/dbus/test/include/dbus/mock_dbus_message_controller.h b/src/components/dbus/test/include/dbus/mock_dbus_message_controller.h
deleted file mode 100644
index 30410a6c7e..0000000000
--- a/src/components/dbus/test/include/dbus/mock_dbus_message_controller.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-* Copyright (c) 2014, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_DBUS_MESSAGE_CONTROLLER_H_
-#define SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_DBUS_MESSAGE_CONTROLLER_H_
-
-#include <pthread.h>
-#include "dbus/dbus_message_controller.h"
-
-namespace test {
-namespace components {
-namespace dbus_test {
-
-class MockDBusMessageController : public ::dbus::DBusMessageController {
- public:
- MOCK_METHOD1(Recv, void(std::string&));
-
- MockDBusMessageController(const std::string& serviceName,
- const std::string& path)
- : DBusMessageController(serviceName, path), thread_() {}
-
- virtual void processResponse(std::string method, Json::Value& root) {}
- virtual void processRequest(Json::Value& root) {}
- virtual void processNotification(Json::Value& root) {}
-
- bool Init() {
- return ::hmi_message_handler::DBusMessageController::Init() &&
- pthread_create(&thread_, 0, &Run, this) == 0;
- }
-
- private:
- pthread_t thread_;
- static void* Run(void* data) {
- if (NULL != data) {
- static_cast<MockDBusMessageController*>(data)
- ->MethodForReceiverThread(nullptr);
- }
- return 0;
- }
-};
-
-} // namespace dbus_test
-} // namespace components
-} // namespace test
-
-#endif // SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_DBUS_MESSAGE_CONTROLLER_H_
diff --git a/src/components/dbus/test/include/dbus/mock_subscriber.h b/src/components/dbus/test/include/dbus/mock_subscriber.h
deleted file mode 100644
index b2a369e371..0000000000
--- a/src/components/dbus/test/include/dbus/mock_subscriber.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* Copyright (c) 2014, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_SUBSCRIBER_H_
-#define SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_SUBSCRIBER_H_
-
-#include <string>
-
-struct DBusConnection;
-
-namespace test {
-namespace components {
-namespace dbus {
-
-class MockSubscriber {
- public:
- MockSubscriber(const std::string nameService, const std::string path);
- virtual ~MockSubscriber();
- virtual void Receive();
- bool Start();
- void Send(const std::string& message);
-
- private:
- std::string nameService_;
- std::string path_;
- DBusConnection* conn_;
-};
-
-} // namespace dbus
-} // namespace components
-} // namespace test
-
-#endif // SRC_COMPONENTS_DBUS_TEST_INCLUDE_DBUS_MOCK_SUBSCRIBER_H_
diff --git a/src/components/dbus/test/mock_subscriber.cc b/src/components/dbus/test/mock_subscriber.cc
deleted file mode 100644
index 2c5dccaa50..0000000000
--- a/src/components/dbus/test/mock_subscriber.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
-* Copyright (c) 2014, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "dbus/dbus.h"
-#include "dbus/mock_subscriber.h"
-
-namespace test {
-namespace components {
-namespace dbus {
-
-MockSubscriber::MockSubscriber(const std::string nameService,
- const std::string path)
- : nameService_(nameService), path_(path), conn_(NULL) {}
-
-MockSubscriber::~MockSubscriber() {}
-
-void MockSubscriber::Receive() {}
-
-bool MockSubscriber::Start() {
- DBusError err;
- dbus_error_init(&err);
- conn_ = dbus_bus_get(DBUS_BUS_SESSION, &err);
- if (dbus_error_is_set(&err)) {
- dbus_error_free(&err);
- return false;
- }
-
- std::string rule = "type='signal',interface='" + nameService_ + "'";
- dbus_bus_add_match(conn_, rule.c_str(), &err);
- dbus_connection_flush(conn_);
- if (dbus_error_is_set(&err)) {
- dbus_error_free(&err);
- return false;
- }
- return true;
-}
-
-void MockSubscriber::Send(const std::string& message) {}
-
-} // namespace dbus
-} // namespace components
-} // namespace test
diff --git a/src/components/dbus/test/schema_test.cc b/src/components/dbus/test/schema_test.cc
deleted file mode 100644
index 37831279b9..0000000000
--- a/src/components/dbus/test/schema_test.cc
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * \file test_schema.cc
- * \brief
- *
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <gtest/gtest.h>
-#include "dbus/schema.h"
-
-using dbus::DBusSchema;
-using dbus::MessageId;
-using dbus::MessageName;
-using dbus::MessageType;
-using dbus::ListArgs;
-using ford_message_descriptions::ParameterDescription;
-
-namespace test {
-namespace components {
-namespace dbus {
-
-class DBusSchemaTest : public ::testing::Test {
- protected:
- static void SetUpTestCase() {
- schema_ = new DBusSchema(ford_message_descriptions::message_descriptions);
- }
-
- static void TearDownTestCase() {
- delete schema_;
- }
-
- static const DBusSchema* schema_;
- static const int test_negative_value = -3;
-};
-
-const DBusSchema* DBusSchemaTest::schema_ = 0;
-
-TEST_F(DBusSchemaTest, GetName) {
- const MessageId kId = hmi_apis::FunctionID::Buttons_GetCapabilities;
- const MessageName kExpName("Buttons", "GetCapabilities");
- MessageName name = schema_->getMessageName(kId);
- EXPECT_EQ(kExpName, name);
-
- const MessageId kIdWrong = static_cast<const MessageId>(test_negative_value);
- const MessageName kExpNameWrong("", "");
- name = schema_->getMessageName(kIdWrong);
- EXPECT_EQ(kExpNameWrong, name);
-}
-
-TEST_F(DBusSchemaTest, GetId) {
- const MessageName kName("Buttons", "GetCapabilities");
- const MessageId kExpId = hmi_apis::FunctionID::Buttons_GetCapabilities;
- MessageId id = schema_->getMessageId(kName);
- EXPECT_EQ(kExpId, id);
-
- const MessageName kNameWrong("TestInterface", "TestMessage");
- const MessageId kExpIdWrong = hmi_apis::FunctionID::INVALID_ENUM;
- id = schema_->getMessageId(kNameWrong);
- EXPECT_EQ(kExpIdWrong, id);
-}
-
-TEST_F(DBusSchemaTest, GetListArg) {
- const MessageName kName("Buttons", "GetCapabilities");
- const MessageType kType = hmi_apis::messageType::response;
- const MessageId kId = hmi_apis::FunctionID::Buttons_GetCapabilities;
- ListArgs argsName = schema_->getListArgs(kName, kType);
- const ParameterDescription** params =
- ford_message_descriptions::message_descriptions[1]->parameters;
- EXPECT_EQ(params[0], argsName[0]);
- EXPECT_EQ(params[1], argsName[1]);
-
- ListArgs argsId = schema_->getListArgs(kId, kType);
- EXPECT_EQ(params[0], argsId[0]);
- EXPECT_EQ(params[1], argsId[1]);
-
- const MessageId kIdWrong = static_cast<const MessageId>(test_negative_value);
- const MessageName kNameWrong("TestInterface", "TestMessage");
- const MessageType kTypeWrong =
- static_cast<const MessageType>(test_negative_value);
- const ListArgs kExpListWrong;
- argsName = schema_->getListArgs(kNameWrong, kTypeWrong);
- EXPECT_EQ(kExpListWrong, argsName);
-
- argsId = schema_->getListArgs(kIdWrong, kTypeWrong);
- EXPECT_EQ(kExpListWrong, argsId);
-}
-
-} // namespace dbus
-} // namespace components
-} // namespace test
diff --git a/src/components/formatters/CMakeLists.txt b/src/components/formatters/CMakeLists.txt
index ffd6f333e5..86483929e9 100644
--- a/src/components/formatters/CMakeLists.txt
+++ b/src/components/formatters/CMakeLists.txt
@@ -38,6 +38,7 @@ include_directories (
${MESSAGE_BROKER_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}/smart_objects/include
${COMPONENTS_DIR}/utils/include
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
diff --git a/src/components/formatters/include/formatters/CFormatterJsonBase.h b/src/components/formatters/include/formatters/CFormatterJsonBase.h
index 1df706839f..01c84bfba3 100644
--- a/src/components/formatters/include/formatters/CFormatterJsonBase.h
+++ b/src/components/formatters/include/formatters/CFormatterJsonBase.h
@@ -35,42 +35,42 @@
#ifndef SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_CFORMATTERJSONBASE_H_
#define SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_CFORMATTERJSONBASE_H_
-#include "smart_objects/smart_object.h"
#include "json/json.h"
+#include "smart_objects/smart_object.h"
-namespace NsSmartDeviceLink {
-namespace NsJSONHandler {
-namespace Formatters {
+namespace ns_smart_device_link {
+namespace ns_json_handler {
+namespace formatters {
namespace meta_formatter_error_code {
/**
- * @brief Error codes of MetaFormatter represented as bitmask
- **/
+ * @brief Error codes of MetaFormatter represented as bitmask
+ **/
typedef long tMetaFormatterErrorCode;
/**
- * @brief OK, no error
- */
+ * @brief OK, no error
+ */
static const tMetaFormatterErrorCode kErrorOk = 0x0;
/**
- * @brief origin smart object is not function
- */
+ * @brief origin smart object is not function
+ */
static const tMetaFormatterErrorCode kErrorObjectIsNotFunction = 0x01;
/**
- * @brief smart shema describes object which is not function
- */
+ * @brief smart schema describes object which is not function
+ */
static const tMetaFormatterErrorCode kErrorSchemaIsNotFunction = 0x02;
/**
- * @brief result smart object has invalid type (SmartType_Invalid)
- * before passing to MetaFormatter, i.e. result object can not
- * be changed, i.e. result object can not be built
- *
- */
+ * @brief result smart object has invalid type (SmartType_Invalid)
+ * before passing to MetaFormatter, i.e. result object can not
+ * be changed, i.e. result object can not be built
+ *
+ */
static const tMetaFormatterErrorCode kErrorFailedCreateObjectBySchema = 0x04;
-}
+} // namespace meta_formatter_error_code
/**
* @brief The base class for all JSON based formatters.
@@ -99,21 +99,21 @@ class CFormatterJsonBase {
*/
static void jsonValueToObj(
const Json::Value& value,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& obj);
+ ns_smart_device_link::ns_smart_objects::SmartObject& obj);
/**
- * @brief The method constructs a JSON object from the input SmartObject
- *
- * @param obj Input SmartObject. Can contain a complex structure of objects.
- * @param value The resulting JSON object. It has the same structure as the
- *input SmartObject.
- */
+ * @brief The method constructs a JSON object from the input SmartObject
+ *
+ * @param obj Input SmartObject. Can contain a complex structure of objects.
+ * @param value The resulting JSON object. It has the same structure as the
+ *input SmartObject.
+ */
static void objToJsonValue(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj,
+ const ns_smart_device_link::ns_smart_objects::SmartObject& obj,
Json::Value& value);
};
-}
-}
-} // namespace NsSmartDeviceLink::NsJSONHandler::Formatters
+} // namespace formatters
+} // namespace ns_json_handler
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_CFORMATTERJSONBASE_H_
diff --git a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h
index f22b1216ab..ef1bfa1acd 100644
--- a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h
+++ b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h
@@ -32,17 +32,17 @@
#include "json/json.h"
-#include "smart_objects/smart_object.h"
#include "smart_objects/enum_schema_item.h"
+#include "smart_objects/smart_object.h"
#include "CFormatterJsonBase.h"
#include "formatters/CSmartFactory.h"
#include "formatters/meta_formatter.h"
-namespace NsSmartDeviceLink {
-namespace NsJSONHandler {
-namespace Formatters {
+namespace ns_smart_device_link {
+namespace ns_json_handler {
+namespace formatters {
/**
* @brief Class is used to convert SmartObjects to JSON string and vice versa.
@@ -69,7 +69,7 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase {
* @brief Extracts a message type from the SmartObject
*/
static const std::string getMessageType(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj);
+ const ns_smart_device_link::ns_smart_objects::SmartObject& obj);
/**
* @brief Extracts a message type from the root JSON object.
@@ -117,7 +117,7 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase {
static const int32_t kMessageTypeNotFound;
static const int32_t kCorrelationIdNotFound;
- typedef NsSmartDeviceLink::NsJSONHandler::Formatters::
+ typedef ns_smart_device_link::ns_json_handler::formatters::
meta_formatter_error_code::tMetaFormatterErrorCode
tMetaFormatterErrorCode;
@@ -126,11 +126,14 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase {
*
* @param obj input SmartObject
* @param outStr resulting JSON string
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* @return true if success, false otherwise
*/
static bool toString(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj,
- std::string& outStr);
+ const ns_smart_device_link::ns_smart_objects::SmartObject& obj,
+ std::string& outStr,
+ const bool remove_unknown_parameters = true);
/**
* @brief Creates a SmartObject from a JSON string.
@@ -142,7 +145,7 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase {
template <typename FunctionId, typename MessageType>
static int32_t fromString(
const std::string& str,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& out);
+ ns_smart_device_link::ns_smart_objects::SmartObject& out);
/**
* @brief Converts to string the smart object against the given schema
@@ -151,28 +154,34 @@ class CFormatterJsonSDLRPCv1 : public CFormatterJsonBase {
* @param schema Smart schema which describes 'fake' smart object to be
*formatted
* @param outStr Resulting JSON string
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* @return formatting error code
*/
static tMetaFormatterErrorCode MetaFormatToString(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& object,
- const NsSmartDeviceLink::NsSmartObjects::CSmartSchema& schema,
- std::string& outStr);
+ const ns_smart_device_link::ns_smart_objects::SmartObject& object,
+ const ns_smart_device_link::ns_smart_objects::CSmartSchema& schema,
+ std::string& outStr,
+ const bool remove_unknown_parameters = true);
};
// ----------------------------------------------------------------------------
template <typename FunctionId, typename MessageType>
-int32_t Formatters::CFormatterJsonSDLRPCv1::fromString(
+int32_t formatters::CFormatterJsonSDLRPCv1::fromString(
const std::string& str,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& out) {
+ ns_smart_device_link::ns_smart_objects::SmartObject& out) {
int32_t result = kSuccess;
try {
+ Json::CharReaderBuilder reader_builder;
+ const std::unique_ptr<Json::CharReader> reader(
+ reader_builder.newCharReader());
Json::Value root;
- Json::Reader reader;
+ const size_t json_len = str.length();
std::string type;
- if (false == reader.parse(str, root)) {
+ if (!reader->parse(str.c_str(), str.c_str() + json_len, &root, nullptr)) {
result = kParsingError | kMessageTypeNotFound | kFunctionIdNotFound |
kCorrelationIdNotFound;
}
@@ -189,7 +198,7 @@ int32_t Formatters::CFormatterJsonSDLRPCv1::fromString(
MessageType messageType = MessageType::INVALID_ENUM;
if (kSuccess == result) {
- if (!NsSmartObjects::EnumConversionHelper<MessageType>::StringToEnum(
+ if (!ns_smart_objects::EnumConversionHelper<MessageType>::StringToEnum(
type, &messageType)) {
// If MessageType is not found than FunctionId and CorrelationId can not
// be found either
@@ -199,14 +208,14 @@ int32_t Formatters::CFormatterJsonSDLRPCv1::fromString(
}
if (kSuccess == result) {
- if (!NsSmartObjects::EnumConversionHelper<FunctionId>::StringToEnum(
+ if (!ns_smart_objects::EnumConversionHelper<FunctionId>::StringToEnum(
root[type][S_NAME].asString(), &functionId)) {
result = kFunctionIdNotFound;
functionId = FunctionId::INVALID_ENUM;
}
}
- namespace S = NsSmartDeviceLink::NsJSONHandler::strings;
+ namespace S = ns_smart_device_link::ns_json_handler::strings;
if (!(result & kMessageTypeNotFound)) {
jsonValueToObj(root[type][S_PARAMETERS], out[S::S_MSG_PARAMS]);
@@ -232,8 +241,8 @@ int32_t Formatters::CFormatterJsonSDLRPCv1::fromString(
return result;
}
-}
-}
-} // namespace NsSmartDeviceLink::NsJSONHandler::Formatters
+} // namespace formatters
+} // namespace ns_json_handler
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_CFORMATTERJSONSDLRPCV1_H_
diff --git a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h
index 8260a35959..416aabe777 100644
--- a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h
+++ b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h
@@ -38,9 +38,9 @@
#include "CFormatterJsonBase.h"
#include "formatters/CSmartFactory.h"
-namespace NsSmartDeviceLink {
-namespace NsJSONHandler {
-namespace Formatters {
+namespace ns_smart_device_link {
+namespace ns_json_handler {
+namespace formatters {
/**
* @brief Class is used to convert SmartObjects to JSON string and vice versa.
@@ -64,7 +64,7 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase {
CFormatterJsonSDLRPCv2(const CFormatterJsonSDLRPCv2&);
public:
- typedef NsSmartDeviceLink::NsJSONHandler::Formatters::
+ typedef ns_smart_device_link::ns_json_handler::formatters::
meta_formatter_error_code::tMetaFormatterErrorCode
tMetaFormatterErrorCode;
@@ -73,11 +73,14 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase {
*
* @param obj input SmartObject
* @param outStr resulting JSON string
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* @return true if success, false otherwise
*/
static bool toString(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj,
- std::string& outStr);
+ const ns_smart_device_link::ns_smart_objects::SmartObject& obj,
+ std::string& outStr,
+ const bool remove_unknown_parameters = true);
/**
* @brief Creates a SmartObject from a JSON string.
@@ -91,10 +94,11 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase {
* @return true if success, otherwise - false
*/
template <typename FunctionId, typename MessageType>
- static bool fromString(const std::string& str,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& out,
- FunctionId functionId,
- MessageType messageType);
+ static bool fromString(
+ const std::string& str,
+ ns_smart_device_link::ns_smart_objects::SmartObject& out,
+ FunctionId functionId,
+ MessageType messageType);
/**
* @brief Creates a SmartObject from a JSON string.
@@ -113,11 +117,12 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase {
* @return true if success, otherwise - false
*/
template <typename FunctionId, typename MessageType>
- static bool fromString(const std::string& str,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& out,
- FunctionId functionId,
- MessageType messageType,
- int32_t correlationId);
+ static bool fromString(
+ const std::string& str,
+ ns_smart_device_link::ns_smart_objects::SmartObject& out,
+ FunctionId functionId,
+ MessageType messageType,
+ int32_t correlationId);
/**
* @brief Converts to string the smart object against the given schema
@@ -126,30 +131,36 @@ class CFormatterJsonSDLRPCv2 : public CFormatterJsonBase {
* @param schema Smart schema which describes 'fake' smart object to be
*formatted
* @param outStr Resulting JSON string
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* @return formatting error code
*/
static tMetaFormatterErrorCode MetaFormatToString(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& object,
- const NsSmartDeviceLink::NsSmartObjects::CSmartSchema& schema,
- std::string& outStr);
+ const ns_smart_device_link::ns_smart_objects::SmartObject& object,
+ const ns_smart_device_link::ns_smart_objects::CSmartSchema& schema,
+ std::string& outStr,
+ const bool remove_unknown_parameters = true);
};
template <typename FunctionId, typename MessageType>
inline bool CFormatterJsonSDLRPCv2::fromString(
const std::string& str,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& out,
+ ns_smart_device_link::ns_smart_objects::SmartObject& out,
FunctionId functionId,
MessageType messageType) {
bool result = true;
try {
+ Json::CharReaderBuilder reader_builder;
+ const std::unique_ptr<Json::CharReader> reader(
+ reader_builder.newCharReader());
Json::Value root;
- Json::Reader reader;
+ const size_t json_len = str.length();
+ namespace strings = ns_smart_device_link::ns_json_handler::strings;
+ const bool result =
+ reader->parse(str.c_str(), str.c_str() + json_len, &root, nullptr);
- namespace strings = NsSmartDeviceLink::NsJSONHandler::strings;
- bool result = reader.parse(str, root);
-
- if (true == result) {
+ if (result) {
out[strings::S_PARAMS][strings::S_MESSAGE_TYPE] = messageType;
out[strings::S_PARAMS][strings::S_FUNCTION_ID] = functionId;
out[strings::S_PARAMS][strings::S_PROTOCOL_TYPE] = 0;
@@ -167,12 +178,12 @@ inline bool CFormatterJsonSDLRPCv2::fromString(
template <typename FunctionId, typename MessageType>
inline bool CFormatterJsonSDLRPCv2::fromString(
const std::string& str,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& out,
+ ns_smart_device_link::ns_smart_objects::SmartObject& out,
FunctionId functionId,
MessageType messageType,
int32_t correlationId) {
bool result = fromString(str, out, functionId, messageType);
- namespace strings = NsSmartDeviceLink::NsJSONHandler::strings;
+ namespace strings = ns_smart_device_link::ns_json_handler::strings;
if (true == result) {
out[strings::S_PARAMS][strings::S_CORRELATION_ID] = correlationId;
@@ -180,8 +191,8 @@ inline bool CFormatterJsonSDLRPCv2::fromString(
return result;
}
-}
-}
-} // namespace NsSmartDeviceLink::NsJSONHandler::Formatters
+} // namespace formatters
+} // namespace ns_json_handler
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_CFORMATTERJSONSDLRPCV2_H_
diff --git a/src/components/formatters/include/formatters/CSmartFactory.h b/src/components/formatters/include/formatters/CSmartFactory.h
index 9fed89253b..c384dbf01d 100644
--- a/src/components/formatters/include/formatters/CSmartFactory.h
+++ b/src/components/formatters/include/formatters/CSmartFactory.h
@@ -35,13 +35,13 @@
#ifndef SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_CSMARTFACTORY_H_
#define SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_CSMARTFACTORY_H_
-#include "smart_objects/smart_object.h"
-#include "smart_objects/smart_schema.h"
#include <map>
#include <string>
+#include "smart_objects/smart_object.h"
+#include "smart_objects/smart_schema.h"
-namespace NsSmartDeviceLink {
-namespace NsJSONHandler {
+namespace ns_smart_device_link {
+namespace ns_json_handler {
/**
* @brief String constants used by SmartFactory.
*/
@@ -82,6 +82,10 @@ extern const std::string S_PROTOCOL_TYPE;
extern const std::string S_CORRELATION_ID;
/**
+ * @brief String constant for RPC_MSG_VERSION.
+ */
+extern const std::string S_RPC_MSG_VERSION;
+/**
* @brief String constant for "code" param name.
*/
extern const std::string kCode;
@@ -90,7 +94,7 @@ extern const std::string kCode;
* @brief String constant for "message" param name.
*/
extern const std::string kMessage;
-}
+} // namespace strings
/**
* @brief Smart Schema key.
@@ -144,13 +148,15 @@ class CSmartFactory {
*
* @param object SmartObject to attach schema for.
*
- * @param RemoveFakeParameters contains true if need
+ * @param remove_unknown_parameters contains true if need
* to remove fake parameters from smart object otherwise contains false.
*
* @return True if operation was successful or false otherwise.
*/
- bool attachSchema(NsSmartDeviceLink::NsSmartObjects::SmartObject& object,
- const bool RemoveFakeParameters);
+ bool attachSchema(
+ ns_smart_device_link::ns_smart_objects::SmartObject& object,
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion());
/**
* @brief Attach schema to the struct SmartObject.
@@ -160,8 +166,9 @@ class CSmartFactory {
*
* @return True if operation was successful of false otherwise.
*/
- bool AttachSchema(const StructIdEnum struct_id,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& object);
+ bool AttachSchema(
+ const StructIdEnum struct_id,
+ ns_smart_device_link::ns_smart_objects::SmartObject& object);
/**
* @brief Create new SmartObject with attached function SmartSchema.
@@ -176,7 +183,7 @@ class CSmartFactory {
* SmartObject) function returns empty SmartObject with
* null type.
*/
- NsSmartDeviceLink::NsSmartObjects::SmartObject CreateSmartObject(
+ ns_smart_device_link::ns_smart_objects::SmartObject CreateSmartObject(
const FunctionIdEnum function_id, const MessageTypeEnum message_type);
/**
@@ -191,7 +198,7 @@ class CSmartFactory {
* SmartObject) function returns empty SmartObject with
* null type.
*/
- NsSmartDeviceLink::NsSmartObjects::SmartObject CreateSmartObject(
+ ns_smart_device_link::ns_smart_objects::SmartObject CreateSmartObject(
const StructIdEnum struct_id);
/**
@@ -210,7 +217,7 @@ class CSmartFactory {
*/
bool GetSchema(const FunctionIdEnum function_id,
const MessageTypeEnum message_type,
- NsSmartDeviceLink::NsSmartObjects::CSmartSchema& result);
+ ns_smart_device_link::ns_smart_objects::CSmartSchema& result);
/**
* @brief Get SmartSchema for specific struct.
@@ -227,7 +234,7 @@ class CSmartFactory {
* found or false otherwise.
*/
bool GetSchema(const StructIdEnum struct_id,
- NsSmartDeviceLink::NsSmartObjects::CSmartSchema& result);
+ ns_smart_device_link::ns_smart_objects::CSmartSchema& result);
protected:
/**
@@ -237,7 +244,7 @@ class CSmartFactory {
* functions.
*/
typedef std::map<SmartSchemaKey<FunctionIdEnum, MessageTypeEnum>,
- NsSmartDeviceLink::NsSmartObjects::CSmartSchema>
+ ns_smart_device_link::ns_smart_objects::CSmartSchema>
FuncionsSchemesMap;
/**
@@ -247,7 +254,7 @@ class CSmartFactory {
* structs.
*/
typedef std::map<StructIdEnum,
- NsSmartDeviceLink::NsSmartObjects::CSmartSchema>
+ ns_smart_device_link::ns_smart_objects::CSmartSchema>
StructsSchemesMap;
/**
@@ -268,8 +275,9 @@ CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::CSmartFactory(
template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum>
bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::attachSchema(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& object,
- const bool RemoveFakeParameters) {
+ ns_smart_device_link::ns_smart_objects::SmartObject& object,
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion) {
if (false == object.keyExists(strings::S_PARAMS))
return false;
if (false == object[strings::S_PARAMS].keyExists(strings::S_MESSAGE_TYPE))
@@ -278,11 +286,11 @@ bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::attachSchema(
return false;
MessageTypeEnum msgtype(
- (MessageTypeEnum)
- object[strings::S_PARAMS][strings::S_MESSAGE_TYPE].asInt());
+ (MessageTypeEnum)object[strings::S_PARAMS][strings::S_MESSAGE_TYPE]
+ .asInt());
FunctionIdEnum fid(
- (FunctionIdEnum)
- object[strings::S_PARAMS][strings::S_FUNCTION_ID].asInt());
+ (FunctionIdEnum)object[strings::S_PARAMS][strings::S_FUNCTION_ID]
+ .asInt());
SmartSchemaKey<FunctionIdEnum, MessageTypeEnum> key(fid, msgtype);
@@ -295,7 +303,9 @@ bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::attachSchema(
}
object.setSchema(schemaIterator->second);
- schemaIterator->second.applySchema(object, RemoveFakeParameters);
+
+ schemaIterator->second.applySchema(
+ object, remove_unknown_parameters, MessageVersion);
return true;
}
@@ -303,7 +313,7 @@ bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::attachSchema(
template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum>
bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::AttachSchema(
const StructIdEnum struct_id,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& object) {
+ ns_smart_device_link::ns_smart_objects::SmartObject& object) {
typename StructsSchemesMap::iterator structs_iterator =
structs_schemes_.find(struct_id);
@@ -318,7 +328,7 @@ bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::AttachSchema(
}
template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum>
-NsSmartDeviceLink::NsSmartObjects::SmartObject
+ns_smart_device_link::ns_smart_objects::SmartObject
CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::CreateSmartObject(
const FunctionIdEnum function_id, const MessageTypeEnum message_type) {
SmartSchemaKey<FunctionIdEnum, MessageTypeEnum> key(function_id,
@@ -328,34 +338,34 @@ CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::CreateSmartObject(
functions_schemes_.find(key);
if (schema_iterator != functions_schemes_.end()) {
- NsSmartDeviceLink::NsSmartObjects::SmartObject function_object(
- NsSmartDeviceLink::NsSmartObjects::SmartType_Map);
+ ns_smart_device_link::ns_smart_objects::SmartObject function_object(
+ ns_smart_device_link::ns_smart_objects::SmartType_Map);
function_object.setSchema(schema_iterator->second);
schema_iterator->second.applySchema(function_object, false);
return function_object;
}
- return NsSmartDeviceLink::NsSmartObjects::SmartObject();
+ return ns_smart_device_link::ns_smart_objects::SmartObject();
}
template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum>
-NsSmartDeviceLink::NsSmartObjects::SmartObject
+ns_smart_device_link::ns_smart_objects::SmartObject
CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::CreateSmartObject(
const StructIdEnum struct_id) {
- NsSmartDeviceLink::NsSmartObjects::SmartObject struct_object(
- NsSmartDeviceLink::NsSmartObjects::SmartType_Map);
+ ns_smart_device_link::ns_smart_objects::SmartObject struct_object(
+ ns_smart_device_link::ns_smart_objects::SmartType_Map);
if (AttachSchema(struct_id, struct_object)) {
return struct_object;
}
- return NsSmartDeviceLink::NsSmartObjects::SmartObject();
+ return ns_smart_device_link::ns_smart_objects::SmartObject();
}
template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum>
bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::GetSchema(
const FunctionIdEnum function_id,
const MessageTypeEnum message_type,
- NsSmartDeviceLink::NsSmartObjects::CSmartSchema& result) {
+ ns_smart_device_link::ns_smart_objects::CSmartSchema& result) {
SmartSchemaKey<FunctionIdEnum, MessageTypeEnum> key(function_id,
message_type);
@@ -373,7 +383,7 @@ bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::GetSchema(
template <class FunctionIdEnum, class MessageTypeEnum, class StructIdEnum>
bool CSmartFactory<FunctionIdEnum, MessageTypeEnum, StructIdEnum>::GetSchema(
const StructIdEnum struct_id,
- NsSmartDeviceLink::NsSmartObjects::CSmartSchema& result) {
+ ns_smart_device_link::ns_smart_objects::CSmartSchema& result) {
typename StructsSchemesMap::iterator structs_iterator =
structs_schemes_.find(struct_id);
@@ -405,6 +415,6 @@ bool operator<(const SmartSchemaKey<FunctionIdEnum, MessageTypeEnum>& l,
return false;
}
-}
-}
+} // namespace ns_json_handler
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_CSMARTFACTORY_H_
diff --git a/src/components/formatters/include/formatters/formatter_json_rpc.h b/src/components/formatters/include/formatters/formatter_json_rpc.h
index 3d921ea901..d1c87fe587 100644
--- a/src/components/formatters/include/formatters/formatter_json_rpc.h
+++ b/src/components/formatters/include/formatters/formatter_json_rpc.h
@@ -35,19 +35,19 @@
#ifndef SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_FORMATTER_JSON_RPC_H_
#define SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_FORMATTER_JSON_RPC_H_
-#include <string>
#include <sys/stat.h>
+#include <string>
-#include "smart_objects/smart_object.h"
-#include "smart_objects/enum_schema_item.h"
#include "json/json.h"
+#include "smart_objects/enum_schema_item.h"
+#include "smart_objects/smart_object.h"
#include "CFormatterJsonBase.h"
#include "formatters/CSmartFactory.h"
-namespace NsSmartDeviceLink {
-namespace NsJSONHandler {
-namespace Formatters {
+namespace ns_smart_device_link {
+namespace ns_json_handler {
+namespace formatters {
/**
* @brief Formatter for JSON RPC format.
@@ -105,11 +105,13 @@ class FormatterJsonRpc : public CFormatterJsonBase {
*
* @param obj Input SmartObject.
* @param out_str Resulting JSON string.
- *
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* @return true if success, false otherwise.
*/
- static bool ToString(const NsSmartObjects::SmartObject& obj,
- std::string& out_str);
+ static bool ToString(const ns_smart_objects::SmartObject& obj,
+ std::string& out_str,
+ const bool remove_unknown_parameters = true);
/**
* @brief Creates a SmartObject from a JSON string.
@@ -125,7 +127,7 @@ class FormatterJsonRpc : public CFormatterJsonBase {
*/
template <typename FunctionId, typename MessageType>
static int32_t FromString(const std::string& str,
- NsSmartObjects::SmartObject& out);
+ ns_smart_objects::SmartObject& out);
private:
/**
@@ -223,7 +225,7 @@ class FormatterJsonRpc : public CFormatterJsonBase {
*/
template <typename FunctionId>
static int32_t ParseFunctionId(const Json::Value& method_value,
- NsSmartObjects::SmartObject& out);
+ ns_smart_objects::SmartObject& out);
/**
* @brief Set method.
@@ -237,7 +239,7 @@ class FormatterJsonRpc : public CFormatterJsonBase {
* @return true if function id was extracted successfully and set as a
* value of "method" field.
*/
- static bool SetMethod(const NsSmartObjects::SmartObject& params,
+ static bool SetMethod(const ns_smart_objects::SmartObject& params,
Json::Value& method_container);
/**
@@ -252,7 +254,7 @@ class FormatterJsonRpc : public CFormatterJsonBase {
* @return true if request/response id was extracted successfully and set
* as a value of "id" field.
*/
- static bool SetId(const NsSmartObjects::SmartObject& params,
+ static bool SetId(const ns_smart_objects::SmartObject& params,
Json::Value& id_container);
/**
@@ -267,20 +269,23 @@ class FormatterJsonRpc : public CFormatterJsonBase {
* @return true if message string was extracted successfully and set
* as a value of "message" field.
*/
- static bool SetMessage(const NsSmartObjects::SmartObject& params,
+ static bool SetMessage(const ns_smart_objects::SmartObject& params,
Json::Value& id_container);
};
template <typename FunctionId, typename MessageType>
int32_t FormatterJsonRpc::FromString(const std::string& str,
- NsSmartObjects::SmartObject& out) {
+ ns_smart_objects::SmartObject& out) {
int32_t result = kSuccess;
try {
+ namespace strings = ns_smart_device_link::ns_json_handler::strings;
+ Json::CharReaderBuilder reader_builder;
+ const std::unique_ptr<Json::CharReader> reader(
+ reader_builder.newCharReader());
Json::Value root;
- Json::Reader reader;
- namespace strings = NsSmartDeviceLink::NsJSONHandler::strings;
+ const size_t json_len = str.length();
- if (false == reader.parse(str, root)) {
+ if (!reader->parse(str.c_str(), str.c_str() + json_len, &root, nullptr)) {
result = kParsingError | kMethodNotSpecified | kUnknownMethod |
kUnknownMessageType;
} else {
@@ -309,7 +314,7 @@ int32_t FormatterJsonRpc::FromString(const std::string& str,
result |= ParseFunctionId<FunctionId>(root[kMethod], out);
}
out[strings::S_MSG_PARAMS] =
- NsSmartObjects::SmartObject(NsSmartObjects::SmartType_Map);
+ ns_smart_objects::SmartObject(ns_smart_objects::SmartType_Map);
} else {
const Json::Value& id_value = root[kId];
@@ -323,7 +328,7 @@ int32_t FormatterJsonRpc::FromString(const std::string& str,
id_value.asDouble();
} else if (true == id_value.isNull()) {
out[strings::S_PARAMS][strings::S_CORRELATION_ID] =
- NsSmartObjects::SmartObject(NsSmartObjects::SmartType_Null);
+ ns_smart_objects::SmartObject(ns_smart_objects::SmartType_Null);
} else {
result |= kInvalidFormat | kInvalidId;
}
@@ -332,14 +337,14 @@ int32_t FormatterJsonRpc::FromString(const std::string& str,
message_type_string = kRequest;
result |= ParseFunctionId<FunctionId>(root[kMethod], out);
out[strings::S_MSG_PARAMS] =
- NsSmartObjects::SmartObject(NsSmartObjects::SmartType_Map);
+ ns_smart_objects::SmartObject(ns_smart_objects::SmartType_Map);
} else {
Json::Value method_container;
bool method_container_found = false;
if (true == root.isMember(kResult)) {
out[strings::S_MSG_PARAMS] =
- NsSmartObjects::SmartObject(NsSmartObjects::SmartType_Map);
+ ns_smart_objects::SmartObject(ns_smart_objects::SmartType_Map);
message_type_string = kResponse;
response_value = root[kResult];
@@ -348,7 +353,7 @@ int32_t FormatterJsonRpc::FromString(const std::string& str,
method_container_found = true;
} else if (true == root.isMember(kError)) {
out[strings::S_MSG_PARAMS] =
- NsSmartObjects::SmartObject(NsSmartObjects::SmartType_Map);
+ ns_smart_objects::SmartObject(ns_smart_objects::SmartType_Map);
message_type_string = kErrorResponse;
response_value = root[kError];
response_value_found = true;
@@ -382,7 +387,7 @@ int32_t FormatterJsonRpc::FromString(const std::string& str,
if (0 == (result & kUnknownMessageType)) {
MessageType message_type;
- if (!NsSmartObjects::EnumConversionHelper<MessageType>::StringToEnum(
+ if (!ns_smart_objects::EnumConversionHelper<MessageType>::StringToEnum(
message_type_string, &message_type)) {
result |= kUnknownMessageType;
} else {
@@ -469,7 +474,7 @@ int32_t FormatterJsonRpc::FromString(const std::string& str,
template <typename FunctionId>
int32_t FormatterJsonRpc::ParseFunctionId(const Json::Value& method_value,
- NsSmartObjects::SmartObject& out) {
+ ns_smart_objects::SmartObject& out) {
int32_t result = kSuccess;
if (false == method_value.isString()) {
@@ -477,11 +482,11 @@ int32_t FormatterJsonRpc::ParseFunctionId(const Json::Value& method_value,
} else {
FunctionId function_id;
- if (!NsSmartObjects::EnumConversionHelper<FunctionId>::CStringToEnum(
+ if (!ns_smart_objects::EnumConversionHelper<FunctionId>::CStringToEnum(
method_value.asCString(), &function_id)) {
result |= kUnknownMethod;
} else {
- namespace strings = NsSmartDeviceLink::NsJSONHandler::strings;
+ namespace strings = ns_smart_device_link::ns_json_handler::strings;
out[strings::S_PARAMS][strings::S_FUNCTION_ID] = function_id;
}
@@ -490,8 +495,8 @@ int32_t FormatterJsonRpc::ParseFunctionId(const Json::Value& method_value,
return result;
}
-} // namespace Formatters
-} // namespace NsJSONHandler
-} // namespace NsSmartDeviceLink
+} // namespace formatters
+} // namespace ns_json_handler
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_FORMATTER_JSON_RPC_H_
diff --git a/src/components/formatters/include/formatters/generic_json_formatter.h b/src/components/formatters/include/formatters/generic_json_formatter.h
index 2b5d95fd4a..c9b9431ee5 100644
--- a/src/components/formatters/include/formatters/generic_json_formatter.h
+++ b/src/components/formatters/include/formatters/generic_json_formatter.h
@@ -37,9 +37,9 @@
#include "CFormatterJsonBase.h"
-namespace NsSmartDeviceLink {
-namespace NsJSONHandler {
-namespace Formatters {
+namespace ns_smart_device_link {
+namespace ns_json_handler {
+namespace formatters {
class GenericJsonFormatter : public CFormatterJsonBase {
public:
@@ -49,7 +49,7 @@ class GenericJsonFormatter : public CFormatterJsonBase {
* @param obj Input SmartObject.
* @param out_str Resulting JSON string.
*/
- static void ToString(const NsSmartObjects::SmartObject& obj,
+ static void ToString(const ns_smart_objects::SmartObject& obj,
std::string& out_str);
/**
@@ -61,11 +61,11 @@ class GenericJsonFormatter : public CFormatterJsonBase {
* @return true if success, false otherwise.
*/
static bool FromString(const std::string& str,
- NsSmartObjects::SmartObject& out);
+ ns_smart_objects::SmartObject& out);
};
-} // namespace Formatters
-} // namespace NsJSONHandler
-} // namespace NsSmartDeviceLink
+} // namespace formatters
+} // namespace ns_json_handler
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_GENERIC_JSON_FORMATTER_H_
diff --git a/src/components/formatters/include/formatters/meta_formatter.h b/src/components/formatters/include/formatters/meta_formatter.h
index 20abb3b848..b2ff546bfc 100644
--- a/src/components/formatters/include/formatters/meta_formatter.h
+++ b/src/components/formatters/include/formatters/meta_formatter.h
@@ -39,40 +39,40 @@
#include "smart_objects/smart_object.h"
#include "smart_objects/smart_schema.h"
-namespace NsSmartDeviceLink {
-namespace NsJSONHandler {
-namespace Formatters {
+namespace ns_smart_device_link {
+namespace ns_json_handler {
+namespace formatters {
/**
- * @brief Formats to string the smart object against given schema for given
- *formatter
- *
- * Sample usage:
- * CSmartFactory factory;
- * SmartObject object;
- * CSmartSchmema schema;
- *
- */
+ * @brief Formats to string the smart object against given schema for given
+ *formatter
+ *
+ * Sample usage:
+ * CSmartFactory factory;
+ * SmartObject object;
+ * CSmartSchmema schema;
+ *
+ */
class CMetaFormatter {
public:
/**
- * @brief Creates smart object by the given schema having copied
- * matched tree elements from original object.
- *
- * @param object Original smart object which macthed tree elements
- * will be copied from
- * @param schema Smart schema which describes result smart object
- * @param result_object createdsmart object
- * @return true if successful, false - otherwise
- */
+ * @brief Creates smart object by the given schema having copied
+ * matched tree elements from original object.
+ *
+ * @param object Original smart object which macthed tree elements
+ * will be copied from
+ * @param schema Smart schema which describes result smart object
+ * @param result_object createdsmart object
+ * @return true if successful, false - otherwise
+ */
static bool CreateObjectByPattern(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& object,
- const NsSmartDeviceLink::NsSmartObjects::CSmartSchema& schema,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& result_object);
+ const ns_smart_device_link::ns_smart_objects::SmartObject& object,
+ const ns_smart_device_link::ns_smart_objects::CSmartSchema& schema,
+ ns_smart_device_link::ns_smart_objects::SmartObject& result_object);
};
-} // namespace NsSmartDeviceLink
-} // namespace NsSmartDeviceLink::NsJSONHandler
-} // namespace NsSmartDeviceLink::NsJSONHandler::Formatters
+} // namespace formatters
+} // namespace ns_json_handler
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_META_FORMATTER_H_
diff --git a/src/components/formatters/src/CFormatterJsonBase.cc b/src/components/formatters/src/CFormatterJsonBase.cc
index 0a85a93d21..e5354d5326 100644
--- a/src/components/formatters/src/CFormatterJsonBase.cc
+++ b/src/components/formatters/src/CFormatterJsonBase.cc
@@ -31,17 +31,17 @@
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-#include "json/json.h"
#include "formatters/CFormatterJsonBase.h"
+#include "json/json.h"
#include "utils/convert_utils.h"
-void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::
+void ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase::
jsonValueToObj(const Json::Value& value,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& obj) {
+ ns_smart_device_link::ns_smart_objects::SmartObject& obj) {
try {
if (value.type() == Json::objectValue) {
- obj = NsSmartDeviceLink::NsSmartObjects::SmartObject(
- NsSmartDeviceLink::NsSmartObjects::SmartType_Map);
+ obj = ns_smart_device_link::ns_smart_objects::SmartObject(
+ ns_smart_device_link::ns_smart_objects::SmartType_Map);
Json::Value::Members members = value.getMemberNames();
@@ -49,8 +49,8 @@ void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::
jsonValueToObj(value[members[i]], obj[members[i]]);
}
} else if (value.type() == Json::arrayValue) {
- obj = NsSmartDeviceLink::NsSmartObjects::SmartObject(
- NsSmartDeviceLink::NsSmartObjects::SmartType_Array);
+ obj = ns_smart_device_link::ns_smart_objects::SmartObject(
+ ns_smart_device_link::ns_smart_objects::SmartType_Array);
for (uint32_t i = 0; i < value.size(); i++) {
jsonValueToObj(value[i], obj[i]);
@@ -72,11 +72,13 @@ void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::
// ----------------------------------------------------------------------------
-void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::
- objToJsonValue(const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj,
- Json::Value& item) {
+void ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase::
+ objToJsonValue(
+ const ns_smart_device_link::ns_smart_objects::SmartObject& obj,
+ Json::Value& item) {
try {
- if (NsSmartDeviceLink::NsSmartObjects::SmartType_Array == obj.getType()) {
+ if (ns_smart_device_link::ns_smart_objects::SmartType_Array ==
+ obj.getType()) {
item = Json::arrayValue;
for (uint32_t i = 0; i < obj.length(); i++) {
@@ -86,7 +88,7 @@ void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::
item.append(value);
}
- } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Map ==
+ } else if (ns_smart_device_link::ns_smart_objects::SmartType_Map ==
obj.getType()) {
item = Json::objectValue;
std::set<std::string> keys = obj.enumerate();
@@ -100,19 +102,19 @@ void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::
item[*key] = value;
}
- } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Boolean ==
+ } else if (ns_smart_device_link::ns_smart_objects::SmartType_Boolean ==
obj.getType()) {
item = obj.asBool();
- } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Integer ==
+ } else if (ns_smart_device_link::ns_smart_objects::SmartType_Integer ==
obj.getType()) {
- item = utils::ConvertInt64ToLongLongInt(obj.asInt());
- } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_UInteger ==
+ item = obj.asInt();
+ } else if (ns_smart_device_link::ns_smart_objects::SmartType_UInteger ==
obj.getType()) {
- item = utils::ConvertUInt64ToLongLongUInt(obj.asUInt());
- } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Double ==
+ item = obj.asUInt();
+ } else if (ns_smart_device_link::ns_smart_objects::SmartType_Double ==
obj.getType()) {
item = obj.asDouble();
- } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Null ==
+ } else if (ns_smart_device_link::ns_smart_objects::SmartType_Null ==
obj.getType()) {
item = Json::nullValue;
} else {
diff --git a/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc b/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc
index b776b9abd8..e0ef7a72dd 100644
--- a/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc
+++ b/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc
@@ -34,12 +34,12 @@
#include "formatters/meta_formatter.h"
#include "utils/convert_utils.h"
-namespace strings = NsSmartDeviceLink::NsJSONHandler::strings;
-namespace smart_objects_ns = NsSmartDeviceLink::NsSmartObjects;
+namespace strings = ns_smart_device_link::ns_json_handler::strings;
+namespace smart_objects_ns = ns_smart_device_link::ns_smart_objects;
-namespace NsSmartDeviceLink {
-namespace NsJSONHandler {
-namespace Formatters {
+namespace ns_smart_device_link {
+namespace ns_json_handler {
+namespace formatters {
// ----------------------------------------------------------------------------
@@ -85,7 +85,8 @@ const std::string CFormatterJsonSDLRPCv1::getMessageType(
// ----------------------------------------------------------------------------
bool CFormatterJsonSDLRPCv1::toString(const smart_objects_ns::SmartObject& obj,
- std::string& outStr) {
+ std::string& outStr,
+ const bool remove_unknown_parameters) {
bool result = false;
try {
Json::Value root(Json::objectValue);
@@ -93,7 +94,8 @@ bool CFormatterJsonSDLRPCv1::toString(const smart_objects_ns::SmartObject& obj,
smart_objects_ns::SmartObject formattedObj(obj);
formattedObj.getSchema().unapplySchema(
- formattedObj); // converts enums(as int32_t) to strings
+ formattedObj,
+ remove_unknown_parameters); // converts enums(as int32_t) to strings
objToJsonValue(formattedObj.getElement(strings::S_MSG_PARAMS), params);
@@ -102,8 +104,8 @@ bool CFormatterJsonSDLRPCv1::toString(const smart_objects_ns::SmartObject& obj,
root[type][S_PARAMETERS] = params;
if (formattedObj[strings::S_PARAMS].keyExists(strings::S_CORRELATION_ID)) {
- root[type][S_CORRELATION_ID] = utils::ConvertInt64ToLongLongInt(
- formattedObj[strings::S_PARAMS][strings::S_CORRELATION_ID].asInt());
+ root[type][S_CORRELATION_ID] =
+ formattedObj[strings::S_PARAMS][strings::S_CORRELATION_ID].asInt();
}
root[type][S_NAME] =
@@ -125,7 +127,8 @@ CFormatterJsonSDLRPCv1::tMetaFormatterErrorCode
CFormatterJsonSDLRPCv1::MetaFormatToString(
const smart_objects_ns::SmartObject& object,
const smart_objects_ns::CSmartSchema& schema,
- std::string& outStr) {
+ std::string& outStr,
+ const bool remove_unknown_parameters) {
meta_formatter_error_code::tMetaFormatterErrorCode result_code =
meta_formatter_error_code::kErrorOk;
@@ -156,10 +159,11 @@ CFormatterJsonSDLRPCv1::MetaFormatToString(
result_code |= meta_formatter_error_code::kErrorSchemaIsNotFunction;
}
- CFormatterJsonSDLRPCv1::toString(tmp_object, outStr);
+ CFormatterJsonSDLRPCv1::toString(
+ tmp_object, outStr, remove_unknown_parameters);
return result_code;
}
-}
-}
-}
+} // namespace formatters
+} // namespace ns_json_handler
+} // namespace ns_smart_device_link
diff --git a/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc b/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc
index 9e177ea4a8..bee92fbbee 100644
--- a/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc
+++ b/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc
@@ -31,24 +31,26 @@
#include "formatters/CFormatterJsonSDLRPCv2.h"
#include "formatters/meta_formatter.h"
-namespace smart_objects_ns = NsSmartDeviceLink::NsSmartObjects;
-namespace strings = NsSmartDeviceLink::NsJSONHandler::strings;
+namespace smart_objects_ns = ns_smart_device_link::ns_smart_objects;
+namespace strings = ns_smart_device_link::ns_json_handler::strings;
-namespace NsSmartDeviceLink {
-namespace NsJSONHandler {
-namespace Formatters {
+namespace ns_smart_device_link {
+namespace ns_json_handler {
+namespace formatters {
// ----------------------------------------------------------------------------
bool CFormatterJsonSDLRPCv2::toString(const smart_objects_ns::SmartObject& obj,
- std::string& outStr) {
+ std::string& outStr,
+ const bool remove_unknown_parameters) {
bool result = true;
try {
Json::Value root(Json::objectValue);
smart_objects_ns::SmartObject formattedObj(obj);
formattedObj.getSchema().unapplySchema(
- formattedObj); // converts enums(as int32_t) to strings
+ formattedObj,
+ remove_unknown_parameters); // converts enums(as int32_t) to strings
objToJsonValue(formattedObj.getElement(strings::S_MSG_PARAMS), root);
@@ -68,7 +70,8 @@ CFormatterJsonSDLRPCv2::tMetaFormatterErrorCode
CFormatterJsonSDLRPCv2::MetaFormatToString(
const smart_objects_ns::SmartObject& object,
const smart_objects_ns::CSmartSchema& schema,
- std::string& outStr) {
+ std::string& outStr,
+ const bool remove_unknown_parameters) {
meta_formatter_error_code::tMetaFormatterErrorCode result_code =
meta_formatter_error_code::kErrorOk;
@@ -99,10 +102,11 @@ CFormatterJsonSDLRPCv2::MetaFormatToString(
result_code |= meta_formatter_error_code::kErrorSchemaIsNotFunction;
}
- CFormatterJsonSDLRPCv2::toString(tmp_object, outStr);
+ CFormatterJsonSDLRPCv2::toString(
+ tmp_object, outStr, remove_unknown_parameters);
return result_code;
}
-}
-}
-}
+} // namespace formatters
+} // namespace ns_json_handler
+} // namespace ns_smart_device_link
diff --git a/src/components/formatters/src/CSmartFactory.cc b/src/components/formatters/src/CSmartFactory.cc
index 6b0808fbfa..c1ee9133ca 100644
--- a/src/components/formatters/src/CSmartFactory.cc
+++ b/src/components/formatters/src/CSmartFactory.cc
@@ -34,19 +34,27 @@
#include "formatters/CSmartFactory.h"
-const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_MSG_PARAMS(
+const std::string ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS(
"msg_params");
-const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS("params");
-const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID(
+const std::string ns_smart_device_link::ns_json_handler::strings::S_PARAMS(
+ "params");
+const std::string ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID(
"function_id");
-const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE(
- "message_type");
-const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_VERSION(
- "protocol_version");
-const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_TYPE(
- "protocol_type");
-const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_CORRELATION_ID(
- "correlation_id");
-const std::string NsSmartDeviceLink::NsJSONHandler::strings::kCode("code");
-const std::string NsSmartDeviceLink::NsJSONHandler::strings::kMessage(
+const std::string
+ ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE(
+ "message_type");
+const std::string
+ ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_VERSION(
+ "protocol_version");
+const std::string
+ ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_TYPE(
+ "protocol_type");
+const std::string
+ ns_smart_device_link::ns_json_handler::strings::S_CORRELATION_ID(
+ "correlation_id");
+const std::string
+ ns_smart_device_link::ns_json_handler::strings::S_RPC_MSG_VERSION(
+ "rpc_msg_version");
+const std::string ns_smart_device_link::ns_json_handler::strings::kCode("code");
+const std::string ns_smart_device_link::ns_json_handler::strings::kMessage(
"message");
diff --git a/src/components/formatters/src/formatter_json_rpc.cc b/src/components/formatters/src/formatter_json_rpc.cc
index e349ced4d6..134520bdb6 100644
--- a/src/components/formatters/src/formatter_json_rpc.cc
+++ b/src/components/formatters/src/formatter_json_rpc.cc
@@ -35,11 +35,11 @@
#include "formatters/formatter_json_rpc.h"
#include "utils/convert_utils.h"
-namespace NsSmartDeviceLink {
-namespace NsJSONHandler {
-namespace Formatters {
+namespace ns_smart_device_link {
+namespace ns_json_handler {
+namespace formatters {
-namespace strings = NsJSONHandler::strings;
+namespace strings = ns_json_handler::strings;
const char* FormatterJsonRpc::kRequest = "request";
const char* FormatterJsonRpc::kResponse = "response";
@@ -56,25 +56,27 @@ const char* FormatterJsonRpc::kCode = "code";
const char* FormatterJsonRpc::kData = "data";
const char* FormatterJsonRpc::kMessage = "message";
-bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj,
- std::string& out_str) {
+bool FormatterJsonRpc::ToString(const ns_smart_objects::SmartObject& obj,
+ std::string& out_str,
+ const bool remove_unknown_parameters) {
bool result = true;
try {
Json::Value root(Json::objectValue);
root[kJsonRpc] = kJsonRpcExpectedValue;
- NsSmartObjects::SmartObject formatted_object(obj);
+ ns_smart_objects::SmartObject formatted_object(obj);
Json::Value msg_params_json(Json::objectValue);
- formatted_object.getSchema().unapplySchema(formatted_object);
+ formatted_object.getSchema().unapplySchema(formatted_object,
+ remove_unknown_parameters);
bool is_message_params = formatted_object.keyExists(strings::S_MSG_PARAMS);
bool empty_message_params = true;
if (true == is_message_params) {
- const NsSmartObjects::SmartObject& msg_params =
+ const ns_smart_objects::SmartObject& msg_params =
formatted_object.getElement(strings::S_MSG_PARAMS);
- result = (NsSmartObjects::SmartType_Map == msg_params.getType());
+ result = (ns_smart_objects::SmartType_Map == msg_params.getType());
if (true == result) {
objToJsonValue(msg_params, msg_params_json);
}
@@ -86,15 +88,16 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj,
if (false == formatted_object.keyExists(strings::S_PARAMS)) {
result = false;
} else {
- const NsSmartObjects::SmartObject& params =
+ const ns_smart_objects::SmartObject& params =
formatted_object.getElement(strings::S_PARAMS);
- if (NsSmartObjects::SmartType_Map != params.getType()) {
+ if (ns_smart_objects::SmartType_Map != params.getType()) {
result = false;
} else {
- const NsSmartObjects::SmartObject& message_type_object =
+ const ns_smart_objects::SmartObject& message_type_object =
params.getElement(strings::S_MESSAGE_TYPE);
- if (NsSmartObjects::SmartType_String != message_type_object.getType()) {
+ if (ns_smart_objects::SmartType_String !=
+ message_type_object.getType()) {
result = false;
} else {
const std::string message_type = message_type_object.asString();
@@ -113,14 +116,13 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj,
if (false == params.keyExists(strings::kCode)) {
result = false;
} else {
- const NsSmartObjects::SmartObject& code =
+ const ns_smart_objects::SmartObject& code =
params.getElement(strings::kCode);
- if (NsSmartObjects::SmartType_Integer != code.getType()) {
+ if (ns_smart_objects::SmartType_Integer != code.getType()) {
result = false;
} else {
- root[kResult][kCode] =
- utils::ConvertInt64ToLongLongInt(code.asInt());
+ root[kResult][kCode] = code.asInt();
}
}
} else if (kNotification == message_type) {
@@ -131,13 +133,12 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj,
result = result && SetMethod(params, root[kError][kData]);
result = result && SetMessage(params, root[kError]);
- const NsSmartObjects::SmartObject& code =
+ const ns_smart_objects::SmartObject& code =
params.getElement(strings::kCode);
- if (NsSmartObjects::SmartType_Integer != code.getType()) {
+ if (ns_smart_objects::SmartType_Integer != code.getType()) {
result = false;
} else {
- root[kError][kCode] =
- utils::ConvertInt64ToLongLongInt(code.asInt());
+ root[kError][kCode] = code.asInt();
}
}
}
@@ -151,15 +152,15 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj,
return result;
}
-bool FormatterJsonRpc::SetMethod(const NsSmartObjects::SmartObject& params,
+bool FormatterJsonRpc::SetMethod(const ns_smart_objects::SmartObject& params,
Json::Value& method_container) {
bool result = false;
if (true == params.keyExists(strings::S_FUNCTION_ID)) {
- const NsSmartObjects::SmartObject& function_id =
+ const ns_smart_objects::SmartObject& function_id =
params.getElement(strings::S_FUNCTION_ID);
- if (NsSmartObjects::SmartType_String == function_id.getType()) {
+ if (ns_smart_objects::SmartType_String == function_id.getType()) {
method_container[kMethod] = function_id.asString();
result = true;
}
@@ -168,16 +169,16 @@ bool FormatterJsonRpc::SetMethod(const NsSmartObjects::SmartObject& params,
return result;
}
-bool FormatterJsonRpc::SetId(const NsSmartObjects::SmartObject& params,
+bool FormatterJsonRpc::SetId(const ns_smart_objects::SmartObject& params,
Json::Value& id_container) {
bool result = false;
if (true == params.keyExists(strings::S_CORRELATION_ID)) {
- const NsSmartObjects::SmartObject& id =
+ const ns_smart_objects::SmartObject& id =
params.getElement(strings::S_CORRELATION_ID);
- if (NsSmartObjects::SmartType_Integer == id.getType()) {
- id_container[kId] = utils::ConvertUInt64ToLongLongUInt(id.asUInt());
+ if (ns_smart_objects::SmartType_Integer == id.getType()) {
+ id_container[kId] = id.asUInt();
result = true;
}
}
@@ -185,15 +186,15 @@ bool FormatterJsonRpc::SetId(const NsSmartObjects::SmartObject& params,
return result;
}
-bool FormatterJsonRpc::SetMessage(const NsSmartObjects::SmartObject& params,
+bool FormatterJsonRpc::SetMessage(const ns_smart_objects::SmartObject& params,
Json::Value& message_container) {
bool result = false;
if (true == params.keyExists(strings::kMessage)) {
- const NsSmartObjects::SmartObject& message =
+ const ns_smart_objects::SmartObject& message =
params.getElement(strings::kMessage);
- if (NsSmartObjects::SmartType_String == message.getType()) {
+ if (ns_smart_objects::SmartType_String == message.getType()) {
message_container[kMessage] = message.asString();
result = true;
}
@@ -202,6 +203,6 @@ bool FormatterJsonRpc::SetMessage(const NsSmartObjects::SmartObject& params,
return result;
}
-} // namespace Formatters
-} // namespace NsJSONHandler
-} // namespace NsSmartDeviceLink
+} // namespace formatters
+} // namespace ns_json_handler
+} // namespace ns_smart_device_link
diff --git a/src/components/formatters/src/generic_json_formatter.cc b/src/components/formatters/src/generic_json_formatter.cc
index 7789a915c2..a0096a0983 100644
--- a/src/components/formatters/src/generic_json_formatter.cc
+++ b/src/components/formatters/src/generic_json_formatter.cc
@@ -33,12 +33,13 @@
// POSSIBILITY OF SUCH DAMAGE.
#include "formatters/generic_json_formatter.h"
+#include "utils/jsoncpp_reader_wrapper.h"
-namespace NsSmartDeviceLink {
-namespace NsJSONHandler {
-namespace Formatters {
+namespace ns_smart_device_link {
+namespace ns_json_handler {
+namespace formatters {
-void GenericJsonFormatter::ToString(const NsSmartObjects::SmartObject& obj,
+void GenericJsonFormatter::ToString(const ns_smart_objects::SmartObject& obj,
std::string& out_str) {
Json::Value json_root;
objToJsonValue(obj, json_root);
@@ -46,18 +47,18 @@ void GenericJsonFormatter::ToString(const NsSmartObjects::SmartObject& obj,
}
bool GenericJsonFormatter::FromString(const std::string& str,
- NsSmartObjects::SmartObject& out) {
+ ns_smart_objects::SmartObject& out) {
Json::Value json_root;
- Json::Reader reader;
- bool result = reader.parse(str, json_root);
+ utils::JsonReader reader;
+ const bool result = reader.parse(str, &json_root);
- if (true == result) {
+ if (result) {
jsonValueToObj(json_root, out);
}
return result;
}
-} // namespace Formatters
-} // namespace NsJSONHandler
-} // namespace NsSmartDeviceLink
+} // namespace formatters
+} // namespace ns_json_handler
+} // namespace ns_smart_device_link
diff --git a/src/components/formatters/src/meta_formatter.cc b/src/components/formatters/src/meta_formatter.cc
index fafb84e938..82dd611498 100644
--- a/src/components/formatters/src/meta_formatter.cc
+++ b/src/components/formatters/src/meta_formatter.cc
@@ -38,15 +38,15 @@
#include "formatters/meta_formatter.h"
-namespace formatter_ns = NsSmartDeviceLink::NsJSONHandler::Formatters;
-namespace smart_objects_ns = NsSmartDeviceLink::NsSmartObjects;
+namespace formatter_ns = ns_smart_device_link::ns_json_handler::formatters;
+namespace smart_objects_ns = ns_smart_device_link::ns_smart_objects;
//---------------------------------------------------------------
bool formatter_ns::CMetaFormatter::CreateObjectByPattern(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& object,
- const NsSmartDeviceLink::NsSmartObjects::CSmartSchema& schema,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& result_object) {
+ const ns_smart_device_link::ns_smart_objects::SmartObject& object,
+ const ns_smart_device_link::ns_smart_objects::CSmartSchema& schema,
+ ns_smart_device_link::ns_smart_objects::SmartObject& result_object) {
if (smart_objects_ns::SmartType_Invalid == result_object.getType()) {
return false;
}
diff --git a/src/components/formatters/test/CFormatterJsonBase_test.cc b/src/components/formatters/test/CFormatterJsonBase_test.cc
index ff1f60b8df..3daf2ca284 100644
--- a/src/components/formatters/test/CFormatterJsonBase_test.cc
+++ b/src/components/formatters/test/CFormatterJsonBase_test.cc
@@ -30,20 +30,20 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
-#include <algorithm>
-#include "json/value.h"
-#include "gtest/gtest.h"
-#include "json/reader.h"
#include "formatters/CFormatterJsonBase.h"
+#include <algorithm>
+#include <string>
#include "formatters/generic_json_formatter.h"
+#include "gtest/gtest.h"
+#include "json/value.h"
+#include "utils/jsoncpp_reader_wrapper.h"
namespace test {
namespace components {
namespace formatters {
-using namespace NsSmartDeviceLink::NsSmartObjects;
-using namespace NsSmartDeviceLink::NsJSONHandler::Formatters;
+using namespace ns_smart_device_link::ns_smart_objects;
+using namespace ns_smart_device_link::ns_json_handler::formatters;
TEST(CFormatterJsonBaseTest, JSonStringValueToSmartObj_ExpectSuccessful) {
// Arrange value
@@ -168,9 +168,12 @@ TEST(CFormatterJsonBaseTest, JSonArrayValueToSmartObj_ExpectSuccessful) {
"[\"test1\", \"test2\", \"test3\"]"; // Array in json format
Json::Value json_value; // Json value from array. Will be initialized later
SmartObject object;
- Json::Reader reader; // Json reader - Needed for correct parsing
+ Json::CharReaderBuilder reader_builder;
+ const std::unique_ptr<Json::CharReader> reader(
+ reader_builder.newCharReader());
// Parse array to json value
- ASSERT_TRUE(reader.parse(json_array, json_value));
+ ASSERT_TRUE(reader->parse(
+ json_array, json_array + strlen(json_array), &json_value, nullptr));
// Convert json array to SmartObject
CFormatterJsonBase::jsonValueToObj(json_value, object);
// Check conversion was successful
@@ -187,10 +190,15 @@ TEST(CFormatterJsonBaseTest, JSonObjectValueToSmartObj_ExpectSuccessful) {
"\"json_test_object2\": [\"test11\", \"test12\", \"test13\" ]}";
Json::Value json_value; // Json value from object. Will be initialized later
SmartObject object;
- Json::Reader reader; // Json reader - Needed for correct parsing
- ASSERT_TRUE(reader.parse(
+ Json::CharReaderBuilder reader_builder;
+ const std::unique_ptr<Json::CharReader> reader(
+ reader_builder
+ .newCharReader()); // Json reader - Needed for correct parsing
+ ASSERT_TRUE(reader->parse(
json_object,
- json_value)); // If parsing not successful - no sense to continue
+ json_object + strlen(json_object),
+ &json_value,
+ nullptr)); // If parsing not successful - no sense to continue
CFormatterJsonBase::jsonValueToObj(json_value, object);
// Check conversion was successful
EXPECT_TRUE(json_value.isObject());
@@ -302,10 +310,15 @@ TEST(CFormatterJsonBaseTest, ArraySmartObjectToJSon_ExpectSuccessful) {
Json::Value json_value; // Json value from array. Will be initialized later
Json::Value result; // Json value from array. Will be initialized later
SmartObject object;
- Json::Reader reader; // Json reader - Needed for correct parsing
+ Json::CharReaderBuilder reader_builder;
+ const std::unique_ptr<Json::CharReader> reader(
+ reader_builder
+ .newCharReader()); // Json reader - Needed for correct parsing
// Parse array to json value
- ASSERT_TRUE(reader.parse(json_array,
- json_value)); // Convert json array to SmartObject
+ ASSERT_TRUE(reader->parse(json_array,
+ json_array + strlen(json_array),
+ &json_value,
+ nullptr)); // Convert json array to SmartObject
// Convert json array to SmartObject
CFormatterJsonBase::jsonValueToObj(json_value, object);
// Convert SmartObject to JSon
@@ -325,11 +338,16 @@ TEST(CFormatterJsonBaseTest, JSonObjectValueToObj_ExpectSuccessful) {
Json::Value
result; // Json value from Smart object. Will keep conversion result
SmartObject object;
- Json::Reader reader; // Json reader - Needed for correct parsing
+ Json::CharReaderBuilder reader_builder;
+ const std::unique_ptr<Json::CharReader> reader(
+ reader_builder
+ .newCharReader()); // Json reader - Needed for correct parsing
// Parse json object to correct json value
- ASSERT_TRUE(reader.parse(
+ ASSERT_TRUE(reader->parse(
json_object,
- json_value)); // If parsing not successful - no sense to continue
+ json_object + strlen(json_object),
+ &json_value,
+ nullptr)); // If parsing not successful - no sense to continue
// Convert json array to SmartObject
CFormatterJsonBase::jsonValueToObj(json_value, object);
// Convert SmartObject to JSon
diff --git a/src/components/formatters/test/CSmartFactory_test.cc b/src/components/formatters/test/CSmartFactory_test.cc
index 3713d076e2..5bd212f431 100644
--- a/src/components/formatters/test/CSmartFactory_test.cc
+++ b/src/components/formatters/test/CSmartFactory_test.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "formatters/SmartFactoryTestHelper.h"
#include "formatters/CSmartFactory.h"
+#include "formatters/SmartFactoryTestHelper.h"
#include "gtest/gtest.h"
namespace test {
@@ -68,7 +68,7 @@ TEST(CSmartFactoryTest,
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(2u, keys.size());
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_TRUE(obj.isValid());
}
@@ -82,7 +82,7 @@ TEST(CSmartFactoryTest,
EXPECT_FALSE(SmartType::SmartType_Map == obj.getType());
EXPECT_TRUE(SmartType::SmartType_Null == obj.getType());
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_TRUE(obj.isValid());
}
@@ -104,7 +104,7 @@ TEST(
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(2u, keys.size());
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
+ EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
EXPECT_FALSE(obj.isValid());
}
@@ -127,7 +127,7 @@ TEST(
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(2u, keys.size());
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OUT_OF_RANGE, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OUT_OF_RANGE, obj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
EXPECT_FALSE(obj.isValid());
}
@@ -150,7 +150,7 @@ TEST(
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(2u, keys.size());
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate(&report));
+ EXPECT_EQ(errors::eType::INVALID_VALUE, obj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
EXPECT_FALSE(obj.isValid());
}
@@ -174,7 +174,7 @@ TEST(CSmartFactoryTest,
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(2u, keys.size());
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_TRUE(obj.isValid());
}
@@ -198,7 +198,7 @@ TEST(
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(2u, keys.size());
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
+ EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
EXPECT_FALSE(obj.isValid());
}
@@ -236,7 +236,7 @@ TEST(
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(2u, keys.size());
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate(&report));
+ EXPECT_EQ(errors::eType::INVALID_VALUE, obj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
EXPECT_FALSE(obj.isValid());
}
@@ -253,7 +253,7 @@ TEST(CSmartFactoryTest,
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(2u, keys.size());
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_TRUE(obj.isValid());
}
@@ -270,7 +270,7 @@ TEST(
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(1u, keys.size());
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
+ EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
EXPECT_FALSE(obj.isValid());
}
@@ -287,7 +287,7 @@ TEST(CSmartFactoryTest,
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(2u, keys.size());
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_TRUE(obj.isValid());
}
@@ -304,12 +304,12 @@ TEST(CSmartFactoryTest,
obj["image"]["text"] = "test2";
obj["image"]["position"] = 100;
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj["image"].validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(3u, keys.size());
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_TRUE(obj.isValid());
}
@@ -328,13 +328,13 @@ TEST(
obj["image"]["position"] = 100;
// Check object "image"
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj["image"].validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(3u, keys.size());
// Check global object
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_TRUE(obj.isValid());
}
@@ -352,13 +352,13 @@ TEST(
obj["image"]["position"] = 100;
// Check object "image"
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj["image"].validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(2u, keys.size());
// Check global object
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
+ EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
EXPECT_FALSE(obj.isValid());
}
@@ -377,13 +377,13 @@ TEST(
obj["image"]["position"] = 100;
// Check object "image"
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj["image"].validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
std::set<std::string> keys = obj.enumerate();
EXPECT_EQ(3u, keys.size());
// Check global object
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_TRUE(obj.isValid());
}
@@ -402,7 +402,7 @@ TEST(
EXPECT_EQ(2u, keys.size());
// Check global object
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
+ EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
EXPECT_FALSE(obj.isValid());
}
@@ -422,7 +422,7 @@ TEST(
EXPECT_EQ(3u, keys.size());
// Check global object
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate(&report));
+ EXPECT_EQ(errors::eType::INVALID_VALUE, obj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
EXPECT_FALSE(obj.isValid());
}
diff --git a/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc b/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc
index a4d40b4478..fe9d2ec0e1 100644
--- a/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc
+++ b/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc
@@ -43,7 +43,7 @@ TEST(CFormatterJsonSDLRPCv1Test, EmptySmartObjectToString) {
SmartObject srcObj;
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, srcObj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
std::string jsonString;
@@ -74,7 +74,7 @@ TEST(CFormatterJsonSDLRPCv1Test, SmObjWithRequestWithoutMsgNotValid_ToString) {
srcObj[S_PARAMS][S_PROTOCOL_VERSION] = 1;
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER,
+ EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER,
srcObj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
@@ -108,7 +108,7 @@ TEST(CFormatterJsonSDLRPCv1Test,
srcObj[S_MSG_PARAMS][""] = "";
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, srcObj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
std::string jsonString;
@@ -341,7 +341,7 @@ TEST(CFormatterJsonSDLRPCv1Test, StringRequestToSmObj) {
EXPECT_EQ(CFormatterJsonSDLRPCv1::kSuccess, result);
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::request);
EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::RegisterAppInterface);
@@ -487,7 +487,7 @@ TEST(CFormatterJsonSDLRPCv1Test, StringNotificationToSmartObject) {
inputJsonString, obj);
EXPECT_EQ(CFormatterJsonSDLRPCv1::kSuccess, result);
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::notification);
EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::SetGlobalProperties);
diff --git a/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc b/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc
index c7e6f61674..34cde397aa 100644
--- a/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc
+++ b/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "formatters/create_smartSchema.h"
#include "formatters/CFormatterJsonSDLRPCv2.h"
+#include "formatters/create_smartSchema.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -42,7 +42,7 @@ TEST(CFormatterJsonSDLRPCv2Test, EmptySmartObjectToString) {
SmartObject srcObj;
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, srcObj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
std::string jsonString;
@@ -67,7 +67,7 @@ TEST(CFormatterJsonSDLRPCv2Test, SmObjWithRequestWithoutMsgNotValid_ToString) {
srcObj[S_PARAMS][S_PROTOCOL_VERSION] = 2;
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER,
+ EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER,
srcObj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
@@ -94,7 +94,7 @@ TEST(CFormatterJsonSDLRPCv2Test,
srcObj[S_MSG_PARAMS][""] = "";
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, srcObj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
std::string jsonString;
@@ -270,7 +270,7 @@ TEST(CFormatterJsonSDLRPCv2Test, StringRequestWithoutCorIdToSmObj) {
EXPECT_EQ(true, result);
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
+ EXPECT_EQ(errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::request);
EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::RegisterAppInterface);
@@ -317,7 +317,7 @@ TEST(CFormatterJsonSDLRPCv2Test, StringRequestWithCorIdToSmObj) {
EXPECT_EQ(true, result);
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::request);
EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::RegisterAppInterface);
@@ -384,7 +384,7 @@ TEST(CFormatterJsonSDLRPCv2Test, StringNotificationToSmartObject) {
corId);
EXPECT_EQ(true, result);
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::eType::OK, obj.validate(&report));
+ EXPECT_EQ(errors::eType::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::notification);
EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::SetGlobalProperties);
diff --git a/src/components/formatters/test/formatter_json_rpc_test.cc b/src/components/formatters/test/formatter_json_rpc_test.cc
index e882bed618..00ba9ef55a 100644
--- a/src/components/formatters/test/formatter_json_rpc_test.cc
+++ b/src/components/formatters/test/formatter_json_rpc_test.cc
@@ -30,35 +30,33 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <algorithm>
#include "formatters/formatter_json_rpc.h"
-#include <string>
-#include <set>
-#include <algorithm>
#include <json/writer.h>
-#include "gtest/gtest.h"
-#include "formatters/formatter_json_rpc.h"
-#include <string>
+#include <algorithm>
#include <set>
-#include "gtest/gtest.h"
+#include <string>
#include "formatters/CSmartFactory.h"
+#include "formatters/formatter_json_rpc.h"
+#include "gtest/gtest.h"
#include "interfaces/HMI_API_schema.h"
#include "interfaces/MOBILE_API_schema.h"
+#include "utils/jsoncpp_reader_wrapper.h"
namespace test {
namespace components {
namespace formatters_test {
-using namespace NsSmartDeviceLink::NsSmartObjects;
-using namespace NsSmartDeviceLink::NsJSONHandler::Formatters;
-using namespace NsSmartDeviceLink::NsJSONHandler::strings;
+using namespace ns_smart_device_link::ns_smart_objects;
+using namespace ns_smart_device_link::ns_json_handler::formatters;
+using namespace ns_smart_device_link::ns_json_handler::strings;
void CompactJson(std::string& str) {
+ utils::JsonReader reader;
Json::Value root;
- Json::Reader reader;
- reader.parse(str, root);
- Json::FastWriter writer;
- str = writer.write(root);
+
+ reader.parse(str, &root);
+ Json::StreamWriterBuilder writer_builder;
+ str = Json::writeString(writer_builder, root);
if (str[str.size() - 1] == '\n') {
str.erase(str.size() - 1, 1);
}
@@ -150,7 +148,7 @@ TEST(FormatterJsonRPCTest, UpperBoundValuesInSystemRequest_ToString_Success) {
hmi_apis::HMI_API factory;
EXPECT_TRUE(factory.attachSchema(obj, false));
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::OK, obj.validate(&report));
+ EXPECT_EQ(errors::OK, obj.validate(&report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
std::string result;
// Convert SmartObject to Json string
diff --git a/src/components/formatters/test/generic_json_formatter_test.cc b/src/components/formatters/test/generic_json_formatter_test.cc
index 41ecfd9ee3..39f0fd6e7e 100644
--- a/src/components/formatters/test/generic_json_formatter_test.cc
+++ b/src/components/formatters/test/generic_json_formatter_test.cc
@@ -30,16 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "formatters/generic_json_formatter.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
namespace formatters {
TEST(GenericJsonFormatter, ToString) {
- namespace smartobj = NsSmartDeviceLink::NsSmartObjects;
- namespace formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
+ namespace smartobj = ns_smart_device_link::ns_smart_objects;
+ namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
smartobj::SmartObject obj;
std::string result;
@@ -93,8 +93,8 @@ TEST(GenericJsonFormatter, ToString) {
}
TEST(GenericJsonFormatter, FromString) {
- namespace smartobj = NsSmartDeviceLink::NsSmartObjects;
- namespace formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
+ namespace smartobj = ns_smart_device_link::ns_smart_objects;
+ namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
smartobj::SmartObject result;
@@ -169,6 +169,6 @@ TEST(GenericJsonFormatter, FromString) {
result.getElement("subobject").getElement("strField").asString().c_str());
}
-} // formatters
-} // components
-} // test
+} // namespace formatters
+} // namespace components
+} // namespace test
diff --git a/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h b/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h
index 8f5ee96ce5..08962db120 100644
--- a/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h
+++ b/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h
@@ -38,23 +38,23 @@
#include "formatters/CSmartFactory.h"
#include "interfaces/HMI_API_schema.h"
-#include "smart_objects/always_true_schema_item.h"
#include "smart_objects/always_false_schema_item.h"
+#include "smart_objects/always_true_schema_item.h"
#include "smart_objects/array_schema_item.h"
#include "smart_objects/bool_schema_item.h"
-#include "smart_objects/object_schema_item.h"
-#include "smart_objects/string_schema_item.h"
#include "smart_objects/enum_schema_item.h"
#include "smart_objects/number_schema_item.h"
+#include "smart_objects/object_schema_item.h"
#include "smart_objects/schema_item_parameter.h"
+#include "smart_objects/string_schema_item.h"
namespace test {
namespace components {
namespace formatters {
-using namespace NsSmartDeviceLink::NsSmartObjects;
-using namespace NsSmartDeviceLink::NsJSONHandler;
-using namespace NsSmartDeviceLink::NsJSONHandler::strings;
+using namespace ns_smart_device_link::ns_smart_objects;
+using namespace ns_smart_device_link::ns_json_handler;
+using namespace ns_smart_device_link::ns_json_handler::strings;
using namespace hmi_apis;
namespace TestType {
@@ -107,9 +107,10 @@ class CSmartFactoryTest : public CSmartFactory<FunctionIdTest::eType,
protected:
typedef std::map<const StructIdentifiersTest::eType,
- utils::SharedPtr<ISchemaItem> > TStructsSchemaItems;
+ std::shared_ptr<ISchemaItem> >
+ TStructsSchemaItems;
- static utils::SharedPtr<ISchemaItem> ProvideObjectSchemaItemForStruct(
+ static std::shared_ptr<ISchemaItem> ProvideObjectSchemaItemForStruct(
TStructsSchemaItems& struct_schema_items,
const StructIdentifiersTest::eType struct_id);
@@ -147,10 +148,10 @@ class CSmartFactoryTest : public CSmartFactory<FunctionIdTest::eType,
const std::set<FunctionIdTest::eType>& function_id_items,
const std::set<MessageTypeTest::eType>& message_type_items);
- static utils::SharedPtr<ISchemaItem> InitStructSchemaItem_Common_1(
+ static std::shared_ptr<ISchemaItem> InitStructSchemaItem_Common_1(
TStructsSchemaItems& struct_schema_items);
- static utils::SharedPtr<ISchemaItem> InitStructSchemaItem_Common_2();
+ static std::shared_ptr<ISchemaItem> InitStructSchemaItem_Common_2();
};
} // namespace formatters
diff --git a/src/components/formatters/test/include/formatters/create_smartSchema.h b/src/components/formatters/test/include/formatters/create_smartSchema.h
index 4d7a217317..4fd0f200d3 100644
--- a/src/components/formatters/test/include/formatters/create_smartSchema.h
+++ b/src/components/formatters/test/include/formatters/create_smartSchema.h
@@ -33,16 +33,16 @@
#ifndef SRC_COMPONENTS_FORMATTERS_TEST_INCLUDE_FORMATTERS_CREATE_SMARTSCHEMA_H_
#define SRC_COMPONENTS_FORMATTERS_TEST_INCLUDE_FORMATTERS_CREATE_SMARTSCHEMA_H_
-#include "formatters/CFormatterJsonSDLRPCv1.h"
#include "SmartFactoryTestHelper.h"
+#include "formatters/CFormatterJsonSDLRPCv1.h"
namespace test {
namespace components {
namespace formatters {
-using namespace NsSmartDeviceLink::NsJSONHandler::strings;
-using namespace NsSmartDeviceLink::NsJSONHandler::Formatters;
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_json_handler::strings;
+using namespace ns_smart_device_link::ns_json_handler::formatters;
+using namespace ns_smart_device_link::ns_smart_objects;
namespace FunctionIDTest {
enum eType {
diff --git a/src/components/formatters/test/include/formatters/meta_formatter_test_helper.h b/src/components/formatters/test/include/formatters/meta_formatter_test_helper.h
index a58f69e386..8a2b5abf0d 100644
--- a/src/components/formatters/test/include/formatters/meta_formatter_test_helper.h
+++ b/src/components/formatters/test/include/formatters/meta_formatter_test_helper.h
@@ -35,10 +35,10 @@
#include "gtest/gtest.h"
-#include "smart_objects/smart_object.h"
+#include "create_smartSchema.h"
#include "formatters/CFormatterJsonSDLRPCv1.h"
#include "formatters/CSmartFactory.h"
-#include "create_smartSchema.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
@@ -51,24 +51,24 @@ class CMetaFormatterTestHelper : public ::testing::Test {
virtual void TearDown();
void AnyObjectToJsonString(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& obj,
+ const ns_smart_device_link::ns_smart_objects::SmartObject& obj,
std::string& result_string);
void FillObjectIdenticalToSchema(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& obj);
+ ns_smart_device_link::ns_smart_objects::SmartObject& obj);
void FillObjectIdenticalToSchemaWithoutNoMandatoriesParams(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& obj);
+ ns_smart_device_link::ns_smart_objects::SmartObject& obj);
void CompareObjects(
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& first,
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& second);
+ const ns_smart_device_link::ns_smart_objects::SmartObject& first,
+ const ns_smart_device_link::ns_smart_objects::SmartObject& second);
void FillObjectWithDefaultValues(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& obj);
+ ns_smart_device_link::ns_smart_objects::SmartObject& obj);
void FillObjectWithoutSomeMandatoryFields(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& obj);
+ ns_smart_device_link::ns_smart_objects::SmartObject& obj);
// Members
std::set<FunctionIDTest::eType> function_id_items_;
diff --git a/src/components/formatters/test/meta_formatter_test.cc b/src/components/formatters/test/meta_formatter_test.cc
index 87f05ab50e..8b1164b95a 100644
--- a/src/components/formatters/test/meta_formatter_test.cc
+++ b/src/components/formatters/test/meta_formatter_test.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "formatters/meta_formatter.h"
#include "formatters/meta_formatter_test_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -41,10 +41,10 @@ namespace formatters {
TEST_F(CMetaFormatterTestHelper,
inputObjectIdenticalToSchemaWithAndWithoutMandatoryParams) {
Json::Value value;
- Json::Reader reader;
CSmartFactory<FunctionIDTest::eType,
MessageTypeTest::eType,
- StructIdentifiers::eType> factory_;
+ StructIdentifiers::eType>
+ factory_;
SmartObject object1 = factory_.CreateSmartObject(
FunctionIDTest::RegisterAppInterface, MessageTypeTest::request);
@@ -122,7 +122,7 @@ TEST_F(CMetaFormatterTestHelper,
}
TEST_F(CMetaFormatterTestHelper, ObjectWithEmptyMap) {
- std::map<std::string, CObjectSchemaItem::SMember> schemaMembersMap;
+ std::map<std::string, SMember> schemaMembersMap;
CSmartSchema map_schema =
CSmartSchema(CObjectSchemaItem::create(schemaMembersMap));
@@ -210,67 +210,63 @@ TEST_F(CMetaFormatterTestHelper,
SmartObject result_object;
SmartObject object;
- std::map<std::string, CObjectSchemaItem::SMember> paramsMembersMap;
+ std::map<std::string, SMember> paramsMembersMap;
- paramsMembersMap[S_FUNCTION_ID] = CObjectSchemaItem::SMember(
+ paramsMembersMap[S_FUNCTION_ID] = SMember(
TEnumSchemaItem<FunctionIDTest::eType>::create(function_id_items_), true);
- paramsMembersMap[S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(
+ paramsMembersMap[S_MESSAGE_TYPE] = SMember(
TEnumSchemaItem<MessageTypeTest::eType>::create(message_type_items_),
true);
- paramsMembersMap[S_CORRELATION_ID] = CObjectSchemaItem::SMember(
- TNumberSchemaItem<int>::create(TSchemaItemParameter<int>(0),
- TSchemaItemParameter<int>(100),
- TSchemaItemParameter<int>(55)),
- true);
+ paramsMembersMap[S_CORRELATION_ID] =
+ SMember(TNumberSchemaItem<int>::create(TSchemaItemParameter<int>(0),
+ TSchemaItemParameter<int>(100),
+ TSchemaItemParameter<int>(55)),
+ true);
- paramsMembersMap[S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(
- TNumberSchemaItem<int>::create(TSchemaItemParameter<int>(1),
- TSchemaItemParameter<int>(2)),
- false);
+ paramsMembersMap[S_PROTOCOL_VERSION] =
+ SMember(TNumberSchemaItem<int>::create(TSchemaItemParameter<int>(1),
+ TSchemaItemParameter<int>(2)),
+ false);
paramsMembersMap[S_PROTOCOL_TYPE] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), false);
+ SMember(TNumberSchemaItem<int>::create(), false);
- std::map<std::string, CObjectSchemaItem::SMember> schemaMembersMap;
+ std::map<std::string, SMember> schemaMembersMap;
- schemaMembersMap["mandatory_emptyMap1"] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(
- std::map<std::string, CObjectSchemaItem::SMember>()),
- true);
+ schemaMembersMap["mandatory_emptyMap1"] = SMember(
+ CObjectSchemaItem::create(std::map<std::string, SMember>()), true);
- schemaMembersMap["mandatory_emptyMap2"] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(
- std::map<std::string, CObjectSchemaItem::SMember>()),
- true);
+ schemaMembersMap["mandatory_emptyMap2"] = SMember(
+ CObjectSchemaItem::create(std::map<std::string, SMember>()), true);
- schemaMembersMap["mandatory_emptyAray"] = CObjectSchemaItem::SMember(
- CArraySchemaItem::create(TNumberSchemaItem<int>::create()), true);
+ schemaMembersMap["mandatory_emptyAray"] =
+ SMember(CArraySchemaItem::create(TNumberSchemaItem<int>::create()), true);
- schemaMembersMap["non_mandatory_Array"] = CObjectSchemaItem::SMember(
- CArraySchemaItem::create(TNumberSchemaItem<int>::create(),
- TSchemaItemParameter<size_t>(1),
- TSchemaItemParameter<size_t>(2)),
- false);
+ schemaMembersMap["non_mandatory_Array"] =
+ SMember(CArraySchemaItem::create(TNumberSchemaItem<int>::create(),
+ TSchemaItemParameter<size_t>(1),
+ TSchemaItemParameter<size_t>(2)),
+ false);
- schemaMembersMap["mandatory_string"] = CObjectSchemaItem::SMember(
+ schemaMembersMap["mandatory_string"] = SMember(
CStringSchemaItem::create(TSchemaItemParameter<size_t>(0),
TSchemaItemParameter<size_t>(500),
TSchemaItemParameter<std::string>("defValue")),
true);
- schemaMembersMap["non_mandatory_string"] = CObjectSchemaItem::SMember(
- CStringSchemaItem::create(
- TSchemaItemParameter<size_t>(0),
- TSchemaItemParameter<size_t>(500),
- TSchemaItemParameter<std::string>("ignoredDefValue")),
- false);
-
- std::map<std::string, CObjectSchemaItem::SMember> rootMembersMap;
- rootMembersMap[S_MSG_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schemaMembersMap), true);
- rootMembersMap[S_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(paramsMembersMap), true);
+ schemaMembersMap["non_mandatory_string"] =
+ SMember(CStringSchemaItem::create(
+ TSchemaItemParameter<size_t>(0),
+ TSchemaItemParameter<size_t>(500),
+ TSchemaItemParameter<std::string>("ignoredDefValue")),
+ false);
+
+ std::map<std::string, SMember> rootMembersMap;
+ rootMembersMap[S_MSG_PARAMS] =
+ SMember(CObjectSchemaItem::create(schemaMembersMap), true);
+ rootMembersMap[S_PARAMS] =
+ SMember(CObjectSchemaItem::create(paramsMembersMap), true);
CSmartSchema schema = CSmartSchema(CObjectSchemaItem::create(rootMembersMap));
diff --git a/src/components/formatters/test/src/SmartFactoryTestHelper.cc b/src/components/formatters/test/src/SmartFactoryTestHelper.cc
index 2dd76f85f8..4d089ff9b1 100644
--- a/src/components/formatters/test/src/SmartFactoryTestHelper.cc
+++ b/src/components/formatters/test/src/SmartFactoryTestHelper.cc
@@ -148,7 +148,7 @@ CSmartFactoryTest::CSmartFactoryTest()
void CSmartFactoryTest::InitStructSchemes(
TStructsSchemaItems& struct_schema_items) {
- utils::SharedPtr<ISchemaItem> struct_schema_item_Common_1 =
+ std::shared_ptr<ISchemaItem> struct_schema_item_Common_1 =
InitStructSchemaItem_Common_1(struct_schema_items);
struct_schema_items.insert(std::make_pair(StructIdentifiersTest::Common_1,
struct_schema_item_Common_1));
@@ -156,7 +156,7 @@ void CSmartFactoryTest::InitStructSchemes(
std::make_pair(StructIdentifiersTest::Common_1,
CSmartSchema(struct_schema_item_Common_1)));
- utils::SharedPtr<ISchemaItem> struct_schema_item_Common_2 =
+ std::shared_ptr<ISchemaItem> struct_schema_item_Common_2 =
InitStructSchemaItem_Common_2();
struct_schema_items.insert(std::make_pair(StructIdentifiersTest::Common_2,
struct_schema_item_Common_2));
@@ -169,27 +169,24 @@ void CSmartFactoryTest::InitFunctionSchemes(
const TStructsSchemaItems& struct_schema_items,
const std::set<FunctionIdTest::eType>& function_id_items,
const std::set<MessageTypeTest::eType>& message_type_items) {
- CObjectSchemaItem::Members params_members;
- params_members[S_FUNCTION_ID] = CObjectSchemaItem::SMember(
+ Members params_members;
+ params_members[S_FUNCTION_ID] = SMember(
TEnumSchemaItem<FunctionIdTest::eType>::create(function_id_items), true);
- params_members[S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(
+ params_members[S_MESSAGE_TYPE] = SMember(
TEnumSchemaItem<MessageTypeTest::eType>::create(message_type_items),
true);
params_members[S_PROTOCOL_VERSION] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_PROTOCOL_TYPE] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[kCode] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[kMessage] =
- CObjectSchemaItem::SMember(CStringSchemaItem::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[kCode] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[kMessage] = SMember(CStringSchemaItem::create(), true);
- CObjectSchemaItem::Members root_members_map;
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] =
- CObjectSchemaItem::SMember(CObjectSchemaItem::create(params_members),
- true);
+ Members root_members_map;
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] =
+ SMember(CObjectSchemaItem::create(params_members), true);
CSmartSchema error_response_schema(
CObjectSchemaItem::create(root_members_map));
@@ -240,26 +237,26 @@ void CSmartFactoryTest::InitFunctionSchemes(
CSmartSchema CSmartFactoryTest::InitFunction_Function1_request(
const std::set<FunctionIdTest::eType>& function_id_items,
const std::set<MessageTypeTest::eType>& message_type_items) {
- CObjectSchemaItem::Members schema_members;
- CObjectSchemaItem::Members params_members;
+ Members schema_members;
+ Members params_members;
- params_members[S_FUNCTION_ID] = CObjectSchemaItem::SMember(
+ params_members[S_FUNCTION_ID] = SMember(
TEnumSchemaItem<FunctionIdTest::eType>::create(function_id_items), true);
- params_members[S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(
+ params_members[S_MESSAGE_TYPE] = SMember(
TEnumSchemaItem<MessageTypeTest::eType>::create(message_type_items),
true);
params_members[S_PROTOCOL_VERSION] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_PROTOCOL_TYPE] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
- CObjectSchemaItem::Members root_members_map;
- root_members_map[S_MSG_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schema_members), true);
- root_members_map[S_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(params_members), true);
+ Members root_members_map;
+ root_members_map[S_MSG_PARAMS] =
+ SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[S_PARAMS] =
+ SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
@@ -269,34 +266,32 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function1_response(
const std::set<FunctionIdTest::eType>& function_id_items,
const std::set<MessageTypeTest::eType>& message_type_items) {
// Function parameter available.
- utils::SharedPtr<ISchemaItem> available_SchemaItem =
+ std::shared_ptr<ISchemaItem> available_SchemaItem =
CBoolSchemaItem::create(TSchemaItemParameter<bool>());
- CObjectSchemaItem::Members schema_members;
+ Members schema_members;
- schema_members["available"] =
- CObjectSchemaItem::SMember(available_SchemaItem, true);
+ schema_members["available"] = SMember(available_SchemaItem, true);
- CObjectSchemaItem::Members params_members;
- params_members[S_FUNCTION_ID] = CObjectSchemaItem::SMember(
+ Members params_members;
+ params_members[S_FUNCTION_ID] = SMember(
TEnumSchemaItem<FunctionIdTest::eType>::create(function_id_items), true);
- params_members[S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(
+ params_members[S_MESSAGE_TYPE] = SMember(
TEnumSchemaItem<MessageTypeTest::eType>::create(message_type_items),
true);
params_members[S_PROTOCOL_VERSION] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_PROTOCOL_TYPE] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[kCode] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[kCode] = SMember(TNumberSchemaItem<int>::create(), true);
- CObjectSchemaItem::Members root_members_map;
- root_members_map[S_MSG_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schema_members), true);
- root_members_map[S_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(params_members), true);
+ Members root_members_map;
+ root_members_map[S_MSG_PARAMS] =
+ SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[S_PARAMS] =
+ SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
@@ -304,26 +299,26 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function1_response(
CSmartSchema CSmartFactoryTest::InitFunction_Function2_request(
const std::set<FunctionIdTest::eType>& function_id_items,
const std::set<MessageTypeTest::eType>& message_type_items) {
- CObjectSchemaItem::Members schema_members;
+ Members schema_members;
- CObjectSchemaItem::Members params_members;
- params_members[S_FUNCTION_ID] = CObjectSchemaItem::SMember(
+ Members params_members;
+ params_members[S_FUNCTION_ID] = SMember(
TEnumSchemaItem<FunctionIdTest::eType>::create(function_id_items), true);
- params_members[S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(
+ params_members[S_MESSAGE_TYPE] = SMember(
TEnumSchemaItem<MessageTypeTest::eType>::create(message_type_items),
true);
params_members[S_PROTOCOL_VERSION] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_PROTOCOL_TYPE] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
- CObjectSchemaItem::Members root_members_map;
- root_members_map[S_MSG_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schema_members), true);
- root_members_map[S_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(params_members), true);
+ Members root_members_map;
+ root_members_map[S_MSG_PARAMS] =
+ SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[S_PARAMS] =
+ SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
@@ -333,34 +328,32 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function2_response(
const std::set<FunctionIdTest::eType>& function_id_items,
const std::set<MessageTypeTest::eType>& message_type_items) {
// Function parameter available.
- utils::SharedPtr<ISchemaItem> available_SchemaItem =
+ std::shared_ptr<ISchemaItem> available_SchemaItem =
CBoolSchemaItem::create(TSchemaItemParameter<bool>());
- CObjectSchemaItem::Members schema_members;
+ Members schema_members;
- schema_members["available"] =
- CObjectSchemaItem::SMember(available_SchemaItem, true);
+ schema_members["available"] = SMember(available_SchemaItem, true);
- CObjectSchemaItem::Members params_members;
- params_members[S_FUNCTION_ID] = CObjectSchemaItem::SMember(
+ Members params_members;
+ params_members[S_FUNCTION_ID] = SMember(
TEnumSchemaItem<FunctionIdTest::eType>::create(function_id_items), true);
- params_members[S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(
+ params_members[S_MESSAGE_TYPE] = SMember(
TEnumSchemaItem<MessageTypeTest::eType>::create(message_type_items),
true);
params_members[S_PROTOCOL_VERSION] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_PROTOCOL_TYPE] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[kCode] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[kCode] = SMember(TNumberSchemaItem<int>::create(), true);
- CObjectSchemaItem::Members root_members_map;
- root_members_map[S_MSG_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schema_members), true);
- root_members_map[S_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(params_members), true);
+ Members root_members_map;
+ root_members_map[S_MSG_PARAMS] =
+ SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[S_PARAMS] =
+ SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
@@ -368,26 +361,26 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function2_response(
CSmartSchema CSmartFactoryTest::InitFunction_Function3_request(
const std::set<FunctionIdTest::eType>& function_id_items,
const std::set<MessageTypeTest::eType>& message_type_items) {
- CObjectSchemaItem::Members schema_members;
+ Members schema_members;
- CObjectSchemaItem::Members params_members;
- params_members[S_FUNCTION_ID] = CObjectSchemaItem::SMember(
+ Members params_members;
+ params_members[S_FUNCTION_ID] = SMember(
TEnumSchemaItem<FunctionIdTest::eType>::create(function_id_items), true);
- params_members[S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(
+ params_members[S_MESSAGE_TYPE] = SMember(
TEnumSchemaItem<MessageTypeTest::eType>::create(message_type_items),
true);
params_members[S_PROTOCOL_VERSION] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_PROTOCOL_TYPE] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
- CObjectSchemaItem::Members root_members_map;
- root_members_map[S_MSG_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schema_members), true);
- root_members_map[S_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(params_members), true);
+ Members root_members_map;
+ root_members_map[S_MSG_PARAMS] =
+ SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[S_PARAMS] =
+ SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
@@ -399,44 +392,42 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function3_response(
// Function parameter available.
//
// Must be true if VR is present and ready to communicate with SDL.
- utils::SharedPtr<ISchemaItem> available_SchemaItem =
+ std::shared_ptr<ISchemaItem> available_SchemaItem =
CBoolSchemaItem::create(TSchemaItemParameter<bool>());
- CObjectSchemaItem::Members schema_members;
+ Members schema_members;
- schema_members["available"] =
- CObjectSchemaItem::SMember(available_SchemaItem, true);
+ schema_members["available"] = SMember(available_SchemaItem, true);
- CObjectSchemaItem::Members params_members;
- params_members[S_FUNCTION_ID] = CObjectSchemaItem::SMember(
+ Members params_members;
+ params_members[S_FUNCTION_ID] = SMember(
TEnumSchemaItem<FunctionIdTest::eType>::create(function_id_items), true);
- params_members[S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(
+ params_members[S_MESSAGE_TYPE] = SMember(
TEnumSchemaItem<MessageTypeTest::eType>::create(message_type_items),
true);
params_members[S_PROTOCOL_VERSION] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_PROTOCOL_TYPE] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
params_members[S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[kCode] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[kCode] = SMember(TNumberSchemaItem<int>::create(), true);
- CObjectSchemaItem::Members root_members_map;
- root_members_map[S_MSG_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schema_members), true);
- root_members_map[S_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(params_members), true);
+ Members root_members_map;
+ root_members_map[S_MSG_PARAMS] =
+ SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[S_PARAMS] =
+ SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
-utils::SharedPtr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_1(
+std::shared_ptr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_1(
TStructsSchemaItems& struct_schema_items) {
// Struct member text.
//
// Text to display
- utils::SharedPtr<ISchemaItem> text_SchemaItem =
+ std::shared_ptr<ISchemaItem> text_SchemaItem =
CStringSchemaItem::create(TSchemaItemParameter<size_t>(1),
TSchemaItemParameter<size_t>(500),
TSchemaItemParameter<std::string>());
@@ -444,60 +435,58 @@ utils::SharedPtr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_1(
// Struct member image.
//
// Image struct
- utils::SharedPtr<ISchemaItem> image_SchemaItem =
+ std::shared_ptr<ISchemaItem> image_SchemaItem =
ProvideObjectSchemaItemForStruct(struct_schema_items,
StructIdentifiersTest::Common_2);
// Struct member position.
//
// Position to display item
- utils::SharedPtr<ISchemaItem> position_SchemaItem =
+ std::shared_ptr<ISchemaItem> position_SchemaItem =
TNumberSchemaItem<int32_t>::create(TSchemaItemParameter<int32_t>(1),
TSchemaItemParameter<int32_t>(500),
TSchemaItemParameter<int32_t>());
- CObjectSchemaItem::Members struct_members;
- struct_members["image"] = CObjectSchemaItem::SMember(image_SchemaItem, false);
+ Members struct_members;
+ struct_members["image"] = SMember(image_SchemaItem, false);
- CObjectSchemaItem::Members schema_members;
+ Members schema_members;
- schema_members["text"] = CObjectSchemaItem::SMember(text_SchemaItem, true);
- schema_members["position"] =
- CObjectSchemaItem::SMember(position_SchemaItem, true);
+ schema_members["text"] = SMember(text_SchemaItem, true);
+ schema_members["position"] = SMember(position_SchemaItem, true);
- CObjectSchemaItem::Members root_members_map;
- root_members_map[""] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(struct_members), true);
- root_members_map[""] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schema_members), true);
+ Members root_members_map;
+ root_members_map[""] =
+ SMember(CObjectSchemaItem::create(struct_members), true);
+ root_members_map[""] =
+ SMember(CObjectSchemaItem::create(schema_members), true);
return CObjectSchemaItem::create(schema_members);
}
-utils::SharedPtr<ISchemaItem>
+std::shared_ptr<ISchemaItem>
CSmartFactoryTest::InitStructSchemaItem_Common_2() {
// Struct member text.
//
// Text to display
- utils::SharedPtr<ISchemaItem> text_SchemaItem =
+ std::shared_ptr<ISchemaItem> text_SchemaItem =
CStringSchemaItem::create(TSchemaItemParameter<size_t>(1),
TSchemaItemParameter<size_t>(500),
TSchemaItemParameter<std::string>());
// Struct member position.
//
// Position to display item
- utils::SharedPtr<ISchemaItem> position_SchemaItem =
+ std::shared_ptr<ISchemaItem> position_SchemaItem =
TNumberSchemaItem<int32_t>::create(TSchemaItemParameter<int32_t>(1),
TSchemaItemParameter<int32_t>(500),
TSchemaItemParameter<int32_t>());
- CObjectSchemaItem::Members schema_members;
- schema_members["text"] = CObjectSchemaItem::SMember(text_SchemaItem, true);
- schema_members["position"] =
- CObjectSchemaItem::SMember(position_SchemaItem, true);
+ Members schema_members;
+ schema_members["text"] = SMember(text_SchemaItem, true);
+ schema_members["position"] = SMember(position_SchemaItem, true);
return CObjectSchemaItem::create(schema_members);
}
-utils::SharedPtr<ISchemaItem>
+std::shared_ptr<ISchemaItem>
CSmartFactoryTest::ProvideObjectSchemaItemForStruct(
TStructsSchemaItems& struct_schema_items,
const StructIdentifiersTest::eType struct_id) {
@@ -506,5 +495,6 @@ CSmartFactoryTest::ProvideObjectSchemaItemForStruct(
if (it != struct_schema_items.end()) {
return it->second;
}
- return NsSmartDeviceLink::NsSmartObjects::CAlwaysFalseSchemaItem::create();
+ return ns_smart_device_link::ns_smart_objects::CAlwaysFalseSchemaItem::
+ create();
}
diff --git a/src/components/formatters/test/src/create_smartSchema.cc b/src/components/formatters/test/src/create_smartSchema.cc
index 1497fbf281..c852c65ea1 100644
--- a/src/components/formatters/test/src/create_smartSchema.cc
+++ b/src/components/formatters/test/src/create_smartSchema.cc
@@ -35,9 +35,9 @@ namespace test {
namespace components {
namespace formatters {
-using namespace NsSmartDeviceLink::NsJSONHandler::strings;
-using namespace NsSmartDeviceLink::NsJSONHandler::Formatters;
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_json_handler::strings;
+using namespace ns_smart_device_link::ns_json_handler::formatters;
+using namespace ns_smart_device_link::ns_smart_objects;
template <>
const EnumConversionHelper<FunctionIDTest::eType>::EnumToCStringMap
@@ -189,39 +189,36 @@ CSmartSchema initObjectSchema() {
TSchemaItemParameter<int>());
// Map of parameters
- std::map<std::string, CObjectSchemaItem::SMember> schemaMembersMap;
+ std::map<std::string, SMember> schemaMembersMap;
- schemaMembersMap["success"] =
- CObjectSchemaItem::SMember(success_SchemaItem, false);
- schemaMembersMap["resultCode"] =
- CObjectSchemaItem::SMember(resultCode_SchemaItem, false);
- schemaMembersMap["info"] = CObjectSchemaItem::SMember(info_SchemaItem, false);
- schemaMembersMap["tryAgainTime"] =
- CObjectSchemaItem::SMember(tryAgainTime_SchemaItem, false);
+ schemaMembersMap["success"] = SMember(success_SchemaItem, false);
+ schemaMembersMap["resultCode"] = SMember(resultCode_SchemaItem, false);
+ schemaMembersMap["info"] = SMember(info_SchemaItem, false);
+ schemaMembersMap["tryAgainTime"] = SMember(tryAgainTime_SchemaItem, false);
- std::map<std::string, CObjectSchemaItem::SMember> paramsMembersMap;
+ std::map<std::string, SMember> paramsMembersMap;
paramsMembersMap[S_FUNCTION_ID] =
- CObjectSchemaItem::SMember(TEnumSchemaItem<FunctionIDTest::eType>::create(
- functionId_allowedEnumSubsetValues),
- true);
- paramsMembersMap[S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(
- TEnumSchemaItem<MessageTypeTest::eType>::create(
- messageType_allowedEnumSubsetValues),
- true);
+ SMember(TEnumSchemaItem<FunctionIDTest::eType>::create(
+ functionId_allowedEnumSubsetValues),
+ true);
+ paramsMembersMap[S_MESSAGE_TYPE] =
+ SMember(TEnumSchemaItem<MessageTypeTest::eType>::create(
+ messageType_allowedEnumSubsetValues),
+ true);
paramsMembersMap[S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- paramsMembersMap[S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(
- TNumberSchemaItem<int>::create(TSchemaItemParameter<int>(1),
- TSchemaItemParameter<int>(2)),
- true);
+ SMember(TNumberSchemaItem<int>::create(), true);
+ paramsMembersMap[S_PROTOCOL_VERSION] =
+ SMember(TNumberSchemaItem<int>::create(TSchemaItemParameter<int>(1),
+ TSchemaItemParameter<int>(2)),
+ true);
paramsMembersMap[S_PROTOCOL_TYPE] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
- std::map<std::string, CObjectSchemaItem::SMember> rootMembersMap;
- rootMembersMap[S_MSG_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schemaMembersMap), true);
- rootMembersMap[S_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(paramsMembersMap), true);
+ std::map<std::string, SMember> rootMembersMap;
+ rootMembersMap[S_MSG_PARAMS] =
+ SMember(CObjectSchemaItem::create(schemaMembersMap), true);
+ rootMembersMap[S_PARAMS] =
+ SMember(CObjectSchemaItem::create(paramsMembersMap), true);
return CSmartSchema(CObjectSchemaItem::create(rootMembersMap));
};
@@ -294,9 +291,9 @@ CSmartSchema initSchemaForMetaFormatter() {
speechCapabilities_allowedEnumSubsetValues,
TSchemaItemParameter<SpeechCapabilities::eType>());
- std::map<std::string, CObjectSchemaItem::SMember> ttsMap;
- ttsMap["text"] = CObjectSchemaItem::SMember(ttsNameItem_SchemaItem, false);
- ttsMap["type"] = CObjectSchemaItem::SMember(ttstype_SchemaItem, false);
+ std::map<std::string, SMember> ttsMap;
+ ttsMap["text"] = SMember(ttsNameItem_SchemaItem, false);
+ ttsMap["type"] = SMember(ttstype_SchemaItem, false);
;
ISchemaItemPtr hmiDisplayLanguageDesired_SchemaItem =
@@ -350,62 +347,57 @@ CSmartSchema initSchemaForMetaFormatter() {
TSchemaItemParameter<size_t>(1000));
// Creation map for syncMsgVersion
- std::map<std::string, CObjectSchemaItem::SMember> schemaSyncMsgVersionMap;
+ std::map<std::string, SMember> schemaSyncMsgVersionMap;
schemaSyncMsgVersionMap["majorVersion"] =
- CObjectSchemaItem::SMember(majorVersion_SchemaItem, false);
+ SMember(majorVersion_SchemaItem, false);
schemaSyncMsgVersionMap["minorVersion"] =
- CObjectSchemaItem::SMember(minorVersion_SchemaItem, false);
+ SMember(minorVersion_SchemaItem, false);
schemaSyncMsgVersionMap["patchVersion"] =
- CObjectSchemaItem::SMember(patchVersion_SchemaItem, false);
+ SMember(patchVersion_SchemaItem, false);
;
// Map of parameters
- std::map<std::string, CObjectSchemaItem::SMember> schemaMembersMap;
-
- schemaMembersMap["appID"] =
- CObjectSchemaItem::SMember(appID_SchemaItem, false);
- schemaMembersMap["appName"] =
- CObjectSchemaItem::SMember(appName_SchemaItem, false);
- schemaMembersMap["appType"] =
- CObjectSchemaItem::SMember(appType_SchemaItem, false);
+ std::map<std::string, SMember> schemaMembersMap;
+
+ schemaMembersMap["appID"] = SMember(appID_SchemaItem, false);
+ schemaMembersMap["appName"] = SMember(appName_SchemaItem, false);
+ schemaMembersMap["appType"] = SMember(appType_SchemaItem, false);
schemaMembersMap["hmiDisplayLanguageDesired"] =
- CObjectSchemaItem::SMember(hmiDisplayLanguageDesired_SchemaItem, false);
+ SMember(hmiDisplayLanguageDesired_SchemaItem, false);
schemaMembersMap["isMediaApplication"] =
- CObjectSchemaItem::SMember(isMediaApplication_SchemaItem, false);
+ SMember(isMediaApplication_SchemaItem, false);
schemaMembersMap["languageDesired"] =
- CObjectSchemaItem::SMember(languageDesired_SchemaItem, false);
+ SMember(languageDesired_SchemaItem, false);
schemaMembersMap["ngnMediaScreenAppName"] =
- CObjectSchemaItem::SMember(ngnMediaScreenAppName_SchemaItem, false);
- schemaMembersMap["syncMsgVersion"] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schemaSyncMsgVersionMap), false);
- schemaMembersMap["ttsName"] =
- CObjectSchemaItem::SMember(ttsName_SchemaItem, false);
- schemaMembersMap["vrSynonyms"] =
- CObjectSchemaItem::SMember(vrSynonyms_SchemaItem, false);
-
- std::map<std::string, CObjectSchemaItem::SMember> paramsMembersMap;
+ SMember(ngnMediaScreenAppName_SchemaItem, false);
+ schemaMembersMap["syncMsgVersion"] =
+ SMember(CObjectSchemaItem::create(schemaSyncMsgVersionMap), false);
+ schemaMembersMap["ttsName"] = SMember(ttsName_SchemaItem, false);
+ schemaMembersMap["vrSynonyms"] = SMember(vrSynonyms_SchemaItem, false);
+
+ std::map<std::string, SMember> paramsMembersMap;
paramsMembersMap[S_FUNCTION_ID] =
- CObjectSchemaItem::SMember(TEnumSchemaItem<FunctionIDTest::eType>::create(
- functionId_allowedEnumSubsetValues),
- true);
- paramsMembersMap[S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(
- TEnumSchemaItem<MessageTypeTest::eType>::create(
- messageType_allowedEnumSubsetValues),
- true);
+ SMember(TEnumSchemaItem<FunctionIDTest::eType>::create(
+ functionId_allowedEnumSubsetValues),
+ true);
+ paramsMembersMap[S_MESSAGE_TYPE] =
+ SMember(TEnumSchemaItem<MessageTypeTest::eType>::create(
+ messageType_allowedEnumSubsetValues),
+ true);
paramsMembersMap[S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- paramsMembersMap[S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(
- TNumberSchemaItem<int>::create(TSchemaItemParameter<int>(1),
- TSchemaItemParameter<int>(2)),
- true);
+ SMember(TNumberSchemaItem<int>::create(), true);
+ paramsMembersMap[S_PROTOCOL_VERSION] =
+ SMember(TNumberSchemaItem<int>::create(TSchemaItemParameter<int>(1),
+ TSchemaItemParameter<int>(2)),
+ true);
paramsMembersMap[S_PROTOCOL_TYPE] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ SMember(TNumberSchemaItem<int>::create(), true);
- std::map<std::string, CObjectSchemaItem::SMember> rootMembersMap;
- rootMembersMap[S_MSG_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schemaMembersMap), true);
- rootMembersMap[S_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(paramsMembersMap), true);
+ std::map<std::string, SMember> rootMembersMap;
+ rootMembersMap[S_MSG_PARAMS] =
+ SMember(CObjectSchemaItem::create(schemaMembersMap), true);
+ rootMembersMap[S_PARAMS] =
+ SMember(CObjectSchemaItem::create(paramsMembersMap), true);
return CSmartSchema(CObjectSchemaItem::create(rootMembersMap));
};
diff --git a/src/components/formatters/test/src/meta_formatter_test_helper.cc b/src/components/formatters/test/src/meta_formatter_test_helper.cc
index 897c8d364d..4f8975fe53 100644
--- a/src/components/formatters/test/src/meta_formatter_test_helper.cc
+++ b/src/components/formatters/test/src/meta_formatter_test_helper.cc
@@ -29,15 +29,15 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "formatters/meta_formatter_test_helper.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
namespace formatters {
-using namespace NsSmartDeviceLink::NsJSONHandler::strings;
-using namespace NsSmartDeviceLink::NsJSONHandler::Formatters;
+using namespace ns_smart_device_link::ns_json_handler::strings;
+using namespace ns_smart_device_link::ns_json_handler::formatters;
void CMetaFormatterTestHelper::SetUp() {
function_id_items_.insert(FunctionIDTest::RegisterAppInterface);
diff --git a/src/components/hmi_message_handler/CMakeLists.txt b/src/components/hmi_message_handler/CMakeLists.txt
index 9fb233b446..8fafee1ac5 100644
--- a/src/components/hmi_message_handler/CMakeLists.txt
+++ b/src/components/hmi_message_handler/CMakeLists.txt
@@ -43,7 +43,6 @@ include_directories (
${MESSAGE_BROKER_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}
${CMAKE_BINARY_DIR}/src/components/
- ${COMPONENTS_DIR}/dbus/include/
${CMAKE_SOURCE_DIR}/
${LOG4CXX_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}/hmi_message_handler/include
@@ -56,14 +55,6 @@ set(PATHS
${CMAKE_CURRENT_SOURCE_DIR}/src
)
-if (HMIADAPTER STREQUAL "dbus")
- set(EXCLUDE_PATHS messagebroker_adapter.cc)
- set(DBUS_ADAPTER DBus)
-else()
- set(EXCLUDE_PATHS dbus_message_adapter.cc)
- set(DBUS_ADAPTER)
-endif ()
-
list(APPEND EXCLUDE_PATHS
mqueue_adapter.cc
)
@@ -72,7 +63,6 @@ collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}")
set(LIBRARIES
Utils
- ${DBUS_ADAPTER}
${RTLIB}
)
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/dbus_message_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/dbus_message_adapter.h
deleted file mode 100644
index beb7a9ad1d..0000000000
--- a/src/components/hmi_message_handler/include/hmi_message_handler/dbus_message_adapter.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_DBUS_MESSAGE_ADAPTER_H_
-#define SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_DBUS_MESSAGE_ADAPTER_H_
-
-#include <string>
-#include "hmi_message_handler/hmi_message_adapter_impl.h"
-#include "dbus/dbus_message_controller.h"
-#include "smart_objects/smart_object.h"
-
-namespace hmi_message_handler {
-
-/**
- * \brief adapter for DBus
- */
-class DBusMessageAdapter : public HMIMessageAdapterImpl,
- public dbus::DBusMessageController {
- public:
- typedef utils::SharedPtr<application_manager::Message> MessageSharedPointer;
- explicit DBusMessageAdapter(HMIMessageHandler* hmi_msg_handler);
- ~DBusMessageAdapter();
- void SendMessageToHMI(MessageSharedPointer message);
-
- /**
- * \brief subscribes to signals
- */
- void SubscribeTo();
-
- private:
- static const std::string SDL_SERVICE_NAME;
- static const std::string SDL_OBJECT_PATH;
- static const std::string HMI_SERVICE_NAME;
- static const std::string HMI_OBJECT_PATH;
-
- /**
- * \brief sends request to HMI
- * \param obj request
- */
- void Request(const smart_objects::SmartObject& obj);
-
- /**
- * \brief sends notification to HMI
- * \param obj notification
- */
- void Notification(const smart_objects::SmartObject& obj);
-
- /**
- * \brief sends response to HMI
- * \param obj response
- */
- void Response(const smart_objects::SmartObject& obj);
-
- /**
- * \brief sends error response to HMI
- * \param obj error
- */
- void ErrorResponse(const smart_objects::SmartObject& obj);
-
- /**
- * \brief sends message to core
- * \param obj
- */
- void SendMessageToCore(const smart_objects::SmartObject& obj);
-};
-
-} // namespace hmi_message_handler
-
-#endif // SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_DBUS_MESSAGE_ADAPTER_H_
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h
index 0d85c30fc2..167e2f84e6 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h
@@ -47,12 +47,12 @@ namespace hmi_message_handler {
namespace impl {
/*
-* These dummy classes are here to locally impose strong typing on different
-* kinds of messages
-* Currently there is no type difference between incoming and outgoing messages
-* TODO(ik): replace these with globally defined message types
-* when we have them.
-*/
+ * These dummy classes are here to locally impose strong typing on different
+ * kinds of messages
+ * Currently there is no type difference between incoming and outgoing messages
+ * TODO(ik): replace these with globally defined message types
+ * when we have them.
+ */
struct MessageFromHmi : public MessageSharedPointer {
MessageFromHmi() {}
explicit MessageFromHmi(const MessageSharedPointer& message)
@@ -77,7 +77,7 @@ typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromHmi> >
FromHmiQueue;
typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToHmi> >
ToHmiQueue;
-}
+} // namespace impl
class ToHMIThreadImpl;
class FromHMIThreadImpl;
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h b/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h
index 60dc50ad7a..544a3ca275 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/mb_controller.h
@@ -31,28 +31,27 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef MB_CONTROLLER_H
#define MB_CONTROLLER_H
-#include <iostream>
-#include <boost/beast/core.hpp>
-#include <boost/beast/websocket.hpp>
+#include <algorithm>
+#include <atomic>
#include <boost/asio/bind_executor.hpp>
-#include <boost/asio/strand.hpp>
-#include <boost/asio/placeholders.hpp>
#include <boost/asio/ip/tcp.hpp>
+#include <boost/asio/placeholders.hpp>
+#include <boost/asio/strand.hpp>
+#include <boost/beast/core.hpp>
+#include <boost/beast/websocket.hpp>
#include <boost/make_shared.hpp>
#include <boost/thread/thread.hpp>
-#include <algorithm>
#include <cstdlib>
#include <functional>
#include <iostream>
+#include <map>
#include <memory>
#include <string>
#include <thread>
#include <vector>
-#include <map>
#include "json/json.h"
-#include "utils/macro.h"
#include "utils/lock.h"
-#include "utils/atomic_object.h"
+#include "utils/macro.h"
#include "websocket_session.h"
using namespace boost::beast::websocket;
@@ -181,6 +180,6 @@ class CMessageBrokerController
std::atomic_bool shutdown_;
};
-} // hmi_message_handler
+} // namespace hmi_message_handler
#endif /* MB_CONTROLLER_H */ \ No newline at end of file
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h
index 423f331297..41bb7efa5d 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h
@@ -35,8 +35,8 @@
#include <string>
-#include "hmi_message_handler/mb_controller.h"
#include "hmi_message_handler/hmi_message_adapter_impl.h"
+#include "hmi_message_handler/mb_controller.h"
#include "utils/threads/thread_validator.h"
namespace hmi_message_handler {
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h b/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h
index 9692c4aef4..08d1b55aaf 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/websocket_session.h
@@ -31,43 +31,42 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef WEBSOCKET_SESSION_H
#define WEBSOCKET_SESSION_H
-#include <iostream>
-#include <boost/beast/core.hpp>
-#include <boost/beast/websocket.hpp>
+#include <algorithm>
+#include <atomic>
#include <boost/asio/bind_executor.hpp>
-#include <boost/asio/strand.hpp>
-#include <boost/asio/placeholders.hpp>
#include <boost/asio/ip/tcp.hpp>
+#include <boost/asio/placeholders.hpp>
+#include <boost/asio/strand.hpp>
+#include <boost/beast/core.hpp>
+#include <boost/beast/websocket.hpp>
#include <boost/make_shared.hpp>
#include <boost/thread/thread.hpp>
-#include <algorithm>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <memory>
+#include <mutex>
+#include <queue>
#include <string>
#include <thread>
#include <vector>
-#include <mutex>
-#include <queue>
#include "json/json.h"
-#include "utils/macro.h"
#include "utils/lock.h"
-#include "utils/atomic_object.h"
-#include "utils/threads/thread.h"
-#include "utils/threads/message_loop_thread.h"
+#include "utils/macro.h"
#include "utils/message_queue.h"
+#include "utils/threads/message_loop_thread.h"
+#include "utils/threads/thread.h"
using namespace boost::beast::websocket;
using ::utils::MessageQueue;
#ifdef DEBUG_ON
/**
-* \def DBG_MSG
-* \brief Debug message output with file name and line number.
-* \param x formatted debug message.
-* \return printf construction.
-*/
+ * \def DBG_MSG
+ * \brief Debug message output with file name and line number.
+ * \param x formatted debug message.
+ * \return printf construction.
+ */
#define DBG_MSG(x) \
printf("%s:%d ", __FILE__, __LINE__); \
printf x
@@ -109,7 +108,7 @@ class WebsocketSession : public std::enable_shared_from_this<WebsocketSession> {
void Recv(boost::system::error_code ec);
- void Send(std::string& message, Json::Value& json_message);
+ void Send(const std::string& message, Json::Value& json_message);
void SendFromQueue();
@@ -152,7 +151,7 @@ class WebsocketSession : public std::enable_shared_from_this<WebsocketSession> {
std::string GetComponentName(std::string& method);
protected:
- sync_primitives::atomic_bool stop;
+ std::atomic_bool stop;
private:
void onMessageReceived(Json::Value message);
@@ -165,9 +164,8 @@ class WebsocketSession : public std::enable_shared_from_this<WebsocketSession> {
int mControllersIdCurrent;
- Json::Reader m_reader;
- Json::FastWriter m_writer;
- Json::FastWriter m_receiverWriter;
+ Json::StreamWriterBuilder m_writer;
+ Json::StreamWriterBuilder m_receiver_writer;
sync_primitives::Lock queue_lock_;
sync_primitives::Lock message_queue_lock_;
@@ -203,6 +201,6 @@ class WebsocketSession : public std::enable_shared_from_this<WebsocketSession> {
threads::Thread* thread_;
};
-} // hmi_message_handler
+} // namespace hmi_message_handler
#endif /* WEBSOCKET_SESSION_H */ \ No newline at end of file
diff --git a/src/components/hmi_message_handler/mock_hmi_message_handler.h b/src/components/hmi_message_handler/mock_hmi_message_handler.h
index d9060088ff..f4ed601bed 100644
--- a/src/components/hmi_message_handler/mock_hmi_message_handler.h
+++ b/src/components/hmi_message_handler/mock_hmi_message_handler.h
@@ -50,9 +50,9 @@ class MockHMIMessageHandler : public ::hmi_message_handler::HMIMessageHandler {
MOCK_METHOD1(RemoveHMIMessageAdapter, void(HMIMessageAdapter* adapter));
MOCK_CONST_METHOD0(get_settings, const HMIMessageHandlerSettings&());
MOCK_METHOD1(OnMessageReceived,
- void(utils::SharedPtr<application_manager::Message> message));
+ void(std::shared_ptr<application_manager::Message> message));
MOCK_METHOD1(OnErrorSending,
- void(utils::SharedPtr<application_manager::Message> message));
+ void(std::shared_ptr<application_manager::Message> message));
MOCK_METHOD1(SendMessageToHMI, void(MessageSharedPointer message));
};
} // namespace hmi_message_handler_test
diff --git a/src/components/hmi_message_handler/src/dbus_message_adapter.cc b/src/components/hmi_message_handler/src/dbus_message_adapter.cc
deleted file mode 100644
index 5b0b11e557..0000000000
--- a/src/components/hmi_message_handler/src/dbus_message_adapter.cc
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "hmi_message_handler/dbus_message_adapter.h"
-#include <sstream>
-#include "utils/logger.h"
-#include "formatters/CSmartFactory.h"
-#include "smart_objects/smart_object.h"
-
-namespace sos = NsSmartDeviceLink::NsJSONHandler::strings;
-
-namespace hmi_message_handler {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler")
-
-const std::string DBusMessageAdapter::SDL_SERVICE_NAME = "com.ford.sdl.core";
-const std::string DBusMessageAdapter::SDL_OBJECT_PATH = "/";
-const std::string DBusMessageAdapter::HMI_SERVICE_NAME = "com.ford.sdl.hmi";
-const std::string DBusMessageAdapter::HMI_OBJECT_PATH = "/";
-
-std::vector<std::string>& split(const std::string& s,
- char delim,
- std::vector<std::string>& elems) {
- std::stringstream ss(s);
- std::string item;
- while (std::getline(ss, item, delim)) {
- elems.push_back(item);
- }
- return elems;
-}
-
-DBusMessageAdapter::DBusMessageAdapter(HMIMessageHandler* hmi_msg_handler)
- : HMIMessageAdapterImpl(hmi_msg_handler)
- , DBusMessageController(SDL_SERVICE_NAME,
- SDL_OBJECT_PATH,
- HMI_SERVICE_NAME,
- HMI_OBJECT_PATH) {
- LOG4CXX_INFO(logger_, "Created DBusMessageAdapter");
-}
-
-DBusMessageAdapter::~DBusMessageAdapter() {}
-
-void DBusMessageAdapter::SendMessageToHMI(MessageSharedPointer message) {
- LOG4CXX_INFO(logger_, "DBusMessageAdapter::sendMessageToHMI");
-
- const smart_objects::SmartObject& smart = message->smart_object();
- switch (smart[sos::S_PARAMS][sos::S_MESSAGE_TYPE].asInt()) {
- case hmi_apis::messageType::request:
- Request(smart);
- break;
- case hmi_apis::messageType::notification:
- Notification(smart);
- break;
- case hmi_apis::messageType::response:
- Response(smart);
- break;
- case hmi_apis::messageType::error_response:
- ErrorResponse(smart);
- break;
- case hmi_apis::messageType::INVALID_ENUM:
- default:
- LOG4CXX_WARN(logger_, "Message type is invalid");
- }
-}
-
-void DBusMessageAdapter::SubscribeTo() {
- LOG4CXX_INFO(logger_, "DBusMessageAdapter::subscribeTo");
- DBusMessageController::SubscribeTo("Buttons", "OnButtonEvent");
- DBusMessageController::SubscribeTo("Buttons", "OnButtonPress");
- DBusMessageController::SubscribeTo("UI", "OnCommand");
- DBusMessageController::SubscribeTo("UI", "OnDriverDistraction");
- DBusMessageController::SubscribeTo("UI", "OnSystemContext");
- DBusMessageController::SubscribeTo("UI", "OnLanguageChange");
- DBusMessageController::SubscribeTo("UI", "OnKeyboardInput");
- DBusMessageController::SubscribeTo("UI", "OnTouchEvent");
- DBusMessageController::SubscribeTo("UI", "OnResetTimeout");
- DBusMessageController::SubscribeTo("TTS", "OnResetTimeout");
- DBusMessageController::SubscribeTo("VR", "Started");
- DBusMessageController::SubscribeTo("VR", "Stopped");
- DBusMessageController::SubscribeTo("VR", "OnCommand");
- DBusMessageController::SubscribeTo("VR", "OnLanguageChange");
- DBusMessageController::SubscribeTo("BasicCommunication", "OnReady");
- DBusMessageController::SubscribeTo("BasicCommunication", "OnAppDeactivated");
- DBusMessageController::SubscribeTo("BasicCommunication",
- "OnStartDeviceDiscovery");
- DBusMessageController::SubscribeTo("BasicCommunication",
- "OnUpdateDeviceList");
- DBusMessageController::SubscribeTo("BasicCommunication",
- "OnFindApplications");
- DBusMessageController::SubscribeTo("BasicCommunication", "OnAppActivated");
- DBusMessageController::SubscribeTo("BasicCommunication", "OnExitApplication");
- DBusMessageController::SubscribeTo("BasicCommunication",
- "OnExitAllApplications");
- DBusMessageController::SubscribeTo("BasicCommunication", "OnDeviceChosen");
- DBusMessageController::SubscribeTo("BasicCommunication",
- "OnIgnitionCycleOver");
- DBusMessageController::SubscribeTo("BasicCommunication", "OnSystemRequest");
- DBusMessageController::SubscribeTo("BasicCommunication",
- "OnSystemInfoChanged");
- DBusMessageController::SubscribeTo("TTS", "Started");
- DBusMessageController::SubscribeTo("TTS", "Stopped");
- DBusMessageController::SubscribeTo("TTS", "OnLanguageChange");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnGpsData");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnSpeed");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnRpm");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnFuelLevel");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnFuelLevelState");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnInstantFuelConsumption");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnExternalTemperature");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnVin");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnPrndl");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnTirePressure");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnOdometer");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnBeltStatus");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnBodyInformation");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnDeviceStatus");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnDriverBraking");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnWiperStatus");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnHeadLampStatus");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnEngineTorque");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnAccPedalPosition");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnSteeringWheelAngle");
- DBusMessageController::SubscribeTo("VehicleInfo", "OnMyKey");
- DBusMessageController::SubscribeTo("Navigation", "OnTBTClientState");
- DBusMessageController::SubscribeTo("Navigation", "OnWayPointChange");
- DBusMessageController::SubscribeTo("SDL", "OnAllowSDLFunctionality");
- DBusMessageController::SubscribeTo("SDL", "OnReceivedPolicyUpdate");
- DBusMessageController::SubscribeTo("SDL", "OnPolicyUpdate");
- DBusMessageController::SubscribeTo("SDL", "OnAppPermissionConsent");
- DBusMessageController::SubscribeTo("SDL", "OnSystemError");
- DBusMessageController::SubscribeTo("SDL", "AddStatisticsInfo");
- DBusMessageController::SubscribeTo("SDL", "OnDeviceStateChanged");
-
- LOG4CXX_INFO(logger_, "Subscribed to notifications.");
-}
-
-void DBusMessageAdapter::SendMessageToCore(
- const smart_objects::SmartObject& obj) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (!handler()) {
- LOG4CXX_WARN(logger_, "DBusMessageAdapter hasn't handler");
- return;
- }
-
- MessageSharedPointer message = new application_manager::Message(
- protocol_handler::MessagePriority::kDefault); // todo: ykazakov constant
- // is a temp solution to
- // finish
- // merge
- // MessagePriority::FromServiceType(message.servicetype)
- // shall be used instead
- message->set_protocol_version(
- protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_HMI);
- message->set_smart_object(obj);
- handler()->OnMessageReceived(message);
- LOG4CXX_INFO(logger_, "Successfully sent to observer");
-}
-
-void DBusMessageAdapter::Request(const smart_objects::SmartObject& obj) {
- LOG4CXX_AUTO_TRACE(logger_);
- dbus::MessageId func_id = static_cast<dbus::MessageId>(
- obj[sos::S_PARAMS][sos::S_FUNCTION_ID].asInt());
- dbus::MessageName name = get_schema().getMessageName(func_id);
- uint id = obj[sos::S_PARAMS][sos::S_CORRELATION_ID].asInt();
- MethodCall(id, func_id, name, obj[sos::S_MSG_PARAMS]);
-}
-
-void DBusMessageAdapter::Notification(const smart_objects::SmartObject& obj) {
- LOG4CXX_AUTO_TRACE(logger_);
- dbus::MessageId func_id = static_cast<dbus::MessageId>(
- obj[sos::S_PARAMS][sos::S_FUNCTION_ID].asInt());
- dbus::MessageName name = get_schema().getMessageName(func_id);
- Signal(func_id, name, obj[sos::S_MSG_PARAMS]);
-}
-
-void DBusMessageAdapter::Response(const smart_objects::SmartObject& obj) {
- LOG4CXX_AUTO_TRACE(logger_);
- dbus::MessageId func_id = static_cast<dbus::MessageId>(
- obj[sos::S_PARAMS][sos::S_FUNCTION_ID].asInt());
- dbus::MessageName name = get_schema().getMessageName(func_id);
- uint id = obj[sos::S_PARAMS][sos::S_CORRELATION_ID].asInt();
- MethodReturn(id, func_id, name, obj[sos::S_MSG_PARAMS]);
-}
-
-void DBusMessageAdapter::ErrorResponse(const smart_objects::SmartObject& obj) {
- LOG4CXX_DEBUG(logger_, "Error");
- std::string error = obj[sos::S_PARAMS][sos::kCode].asString();
- std::string description = obj[sos::S_PARAMS][sos::kMessage].asString();
- uint id = obj[sos::S_PARAMS][sos::S_CORRELATION_ID].asInt();
- Error(id, error, description);
-}
-
-} // namespace hmi_message_handler
diff --git a/src/components/hmi_message_handler/src/mb_controller.cc b/src/components/hmi_message_handler/src/mb_controller.cc
index 8d3b11add5..ffc6ef23a3 100644
--- a/src/components/hmi_message_handler/src/mb_controller.cc
+++ b/src/components/hmi_message_handler/src/mb_controller.cc
@@ -222,7 +222,7 @@ void CMessageBrokerController::exitReceivingThread() {
it;
for (it = mConnectionList.begin(); it != mConnectionList.end();) {
(*it)->Shutdown();
- mConnectionList.erase(it++);
+ it = mConnectionList.erase(it);
}
mConnectionListLock.Release();
@@ -337,8 +337,8 @@ bool CMessageBrokerController::addSubscriber(WebsocketSession* ws_session,
bool result = true;
sync_primitives::AutoLock lock(mSubscribersListLock);
std::pair<std::multimap<std::string, WebsocketSession*>::iterator,
- std::multimap<std::string, WebsocketSession*>::iterator> p =
- mSubscribersList.equal_range(name);
+ std::multimap<std::string, WebsocketSession*>::iterator>
+ p = mSubscribersList.equal_range(name);
if (p.first != p.second) {
std::multimap<std::string, WebsocketSession*>::iterator itr;
for (itr = p.first; itr != p.second; itr++) {
@@ -359,8 +359,8 @@ void CMessageBrokerController::deleteSubscriber(WebsocketSession* ws,
std::string name) {
sync_primitives::AutoLock lock(mSubscribersListLock);
std::pair<std::multimap<std::string, WebsocketSession*>::iterator,
- std::multimap<std::string, WebsocketSession*>::iterator> p =
- mSubscribersList.equal_range(name);
+ std::multimap<std::string, WebsocketSession*>::iterator>
+ p = mSubscribersList.equal_range(name);
if (p.first != p.second) {
std::multimap<std::string, WebsocketSession*>::iterator itr;
for (itr = p.first; itr != p.second;) {
@@ -380,8 +380,8 @@ int CMessageBrokerController::getSubscribersFd(
sync_primitives::AutoLock lock(mSubscribersListLock);
std::pair<std::multimap<std::string, WebsocketSession*>::iterator,
- std::multimap<std::string, WebsocketSession*>::iterator> p =
- mSubscribersList.equal_range(name);
+ std::multimap<std::string, WebsocketSession*>::iterator>
+ p = mSubscribersList.equal_range(name);
if (p.first != p.second) {
std::multimap<std::string, WebsocketSession*>::iterator itr;
for (itr = p.first; itr != p.second; itr++) {
@@ -501,4 +501,4 @@ void CMessageBrokerController::processInternalRequest(
int CMessageBrokerController::getNextControllerId() {
return 1000 * mControllersIdCounter++;
}
-}
+} // namespace hmi_message_handler
diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
index 53a0d84362..b5e2defd58 100644
--- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc
+++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
@@ -33,6 +33,7 @@
#include <string>
#include "hmi_message_handler/messagebroker_adapter.h"
+#include "utils/jsoncpp_reader_wrapper.h"
#include "utils/logger.h"
namespace hmi_message_handler {
@@ -55,15 +56,17 @@ void MessageBrokerAdapter::SendMessageToHMI(
hmi_message_handler::MessageSharedPointer message) {
LOG4CXX_AUTO_TRACE(logger_);
- if (!message.valid()) {
+ if (message.use_count() == 0) {
LOG4CXX_ERROR(logger_, "Can`t send not valid message");
return;
}
- Json::Reader reader;
+ utils::JsonReader reader;
Json::Value json_value;
- if (!reader.parse(message->json_message(), json_value, false)) {
- LOG4CXX_ERROR(logger_, "Received invalid json string.");
+ const std::string str = message->json_message();
+
+ if (!reader.parse(str, &json_value)) {
+ LOG4CXX_ERROR(logger_, "Received invalid json string. ");
return;
}
@@ -138,6 +141,8 @@ void MessageBrokerAdapter::SubscribeTo() {
MessageBrokerController::subscribeTo("BasicCommunication.OnEventChanged");
MessageBrokerController::subscribeTo("RC.OnInteriorVehicleData");
MessageBrokerController::subscribeTo("RC.OnRemoteControlSettings");
+ MessageBrokerController::subscribeTo(
+ "BasicCommunication.OnSystemCapabilityUpdated");
LOG4CXX_INFO(logger_, "Subscribed to notifications.");
}
@@ -159,8 +164,8 @@ void MessageBrokerAdapter::ProcessRecievedFromMB(Json::Value& root) {
return;
}
- Json::FastWriter writer;
- std::string message_string = writer.write(root);
+ Json::StreamWriterBuilder writer_builder;
+ const std::string message_string = Json::writeString(writer_builder, root);
if (message_string.empty()) {
// LOG
diff --git a/src/components/hmi_message_handler/src/websocket_session.cc b/src/components/hmi_message_handler/src/websocket_session.cc
index a148f48661..7ffb35aba6 100644
--- a/src/components/hmi_message_handler/src/websocket_session.cc
+++ b/src/components/hmi_message_handler/src/websocket_session.cc
@@ -29,8 +29,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "hmi_message_handler/websocket_session.h"
-#include "hmi_message_handler/mb_controller.h"
#include <unistd.h>
+#include "hmi_message_handler/mb_controller.h"
+#include "utils/jsoncpp_reader_wrapper.h"
+
using namespace boost::beast::websocket;
namespace hmi_message_handler {
@@ -46,6 +48,7 @@ WebsocketSession::WebsocketSession(boost::asio::ip::tcp::socket socket,
, shutdown_(false)
, thread_delegate_(new LoopThreadDelegate(&message_queue_, this))
, thread_(threads::CreateThread("WS Async Send", thread_delegate_)) {
+ m_writer["indentation"] = "";
thread_->start(threads::ThreadOptions());
}
@@ -92,7 +95,8 @@ void WebsocketSession::Recv(boost::system::error_code ec) {
std::placeholders::_2)));
}
-void WebsocketSession::Send(std::string& message, Json::Value& json_message) {
+void WebsocketSession::Send(const std::string& message,
+ Json::Value& json_message) {
if (shutdown_) {
return;
}
@@ -102,7 +106,7 @@ void WebsocketSession::Send(std::string& message, Json::Value& json_message) {
}
void WebsocketSession::sendJsonMessage(Json::Value& message) {
- std::string str_msg = m_writer.write(message);
+ const std::string str_msg = Json::writeString(m_writer, message) + '\n';
sync_primitives::AutoLock auto_lock(queue_lock_);
if (!isNotification(message) && !isResponse(message)) {
mWaitResponseQueue.insert(std::map<std::string, std::string>::value_type(
@@ -128,14 +132,15 @@ void WebsocketSession::Read(boost::system::error_code ec,
std::string data = boost::beast::buffers_to_string(buffer_.data());
m_receivingBuffer += data;
+ utils::JsonReader reader;
Json::Value root;
- if (!m_reader.parse(m_receivingBuffer, root)) {
- std::string str_err = "Invalid JSON Message: " + data;
- LOG4CXX_ERROR(ws_logger_, str_err);
+
+ if (!reader.parse(data, &root)) {
+ LOG4CXX_ERROR(ws_logger_, "Invalid JSON Message.");
return;
}
- std::string wmes = m_receiverWriter.write(root);
+ const std::string wmes = Json::writeString(m_receiver_writer, root);
ssize_t beginpos = m_receivingBuffer.find(wmes);
if (-1 != beginpos) {
m_receivingBuffer.erase(0, beginpos + wmes.length());
@@ -304,12 +309,14 @@ void WebsocketSession::LoopThreadDelegate::exitThreadMain() {
}
void WebsocketSession::LoopThreadDelegate::DrainQueue() {
- while (!message_queue_.empty()) {
- Message message_ptr;
- message_queue_.pop(message_ptr);
- if (!shutdown_) {
- handler_.ws_.write(boost::asio::buffer(*message_ptr));
- };
+ Message message_ptr;
+ while (!shutdown_ && message_queue_.pop(message_ptr)) {
+ boost::system::error_code ec;
+ handler_.ws_.write(boost::asio::buffer(*message_ptr), ec);
+ if (ec) {
+ LOG4CXX_ERROR(ws_logger_,
+ "A system error has occurred: " << ec.message());
+ }
}
}
@@ -319,4 +326,4 @@ void WebsocketSession::LoopThreadDelegate::SetShutdown() {
message_queue_.Shutdown();
}
}
-}
+} // namespace hmi_message_handler
diff --git a/src/components/hmi_message_handler/test/CMakeLists.txt b/src/components/hmi_message_handler/test/CMakeLists.txt
index 9e855c563e..6d30d6ee51 100644
--- a/src/components/hmi_message_handler/test/CMakeLists.txt
+++ b/src/components/hmi_message_handler/test/CMakeLists.txt
@@ -56,7 +56,7 @@ collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}" "${EXCLUDE_PATHS}")
if (HMIADAPTER STREQUAL "messagebroker")
GET_PROPERTY(BOOST_LIBS_DIRECTORY GLOBAL PROPERTY GLOBAL_BOOST_LIBS)
- list(APPEND LIBRARIES ${BOOST_LIBS_DIRECTORY}/libboost_system.so)
+ list(APPEND LIBRARIES boost_system -L${BOOST_LIBS_DIRECTORY})
endif()
create_test(hmi_message_handler_test "${SOURCES}" "${LIBRARIES}")
diff --git a/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc b/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc
index eead7106c6..5762566b96 100644
--- a/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc
+++ b/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc
@@ -31,8 +31,6 @@
*/
#include "gtest/gtest.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
#include "hmi_message_handler/hmi_message_handler_impl.h"
#include "hmi_message_handler/mock_hmi_message_adapter_impl.h"
@@ -42,10 +40,10 @@ namespace test {
namespace components {
namespace hmi_message_handler_test {
-using ::testing::Return;
using hmi_message_handler::HMIMessageHandlerImpl;
+using ::testing::Return;
-typedef utils::SharedPtr<MockHMIMessageAdapterImpl>
+typedef std::shared_ptr<MockHMIMessageAdapterImpl>
MockHMIMessageAdapterImplSPtr;
TEST(HMIMessageAdapterImplTest, Handler_CorrectPointer_CorrectReturnedPointer) {
@@ -60,7 +58,7 @@ TEST(HMIMessageAdapterImplTest, Handler_CorrectPointer_CorrectReturnedPointer) {
;
MockHMIMessageAdapterImplSPtr message_adapter_impl =
- utils::MakeShared<MockHMIMessageAdapterImpl>(message_handler);
+ std::make_shared<MockHMIMessageAdapterImpl>(message_handler);
EXPECT_EQ(message_handler, message_adapter_impl->get_handler());
@@ -71,11 +69,11 @@ TEST(HMIMessageAdapterImplTest, Handler_CorrectPointer_CorrectReturnedPointer) {
TEST(HMIMessageAdapterImplTest, Handler_NULLPointer_CorrectReturnedPointer) {
HMIMessageHandler* message_handler = NULL;
MockHMIMessageAdapterImplSPtr message_adapter_impl =
- utils::MakeShared<MockHMIMessageAdapterImpl>(message_handler);
+ std::make_shared<MockHMIMessageAdapterImpl>(message_handler);
EXPECT_EQ(NULL, message_adapter_impl->get_handler());
}
-} // namespace hmi_message_helper_test
+} // namespace hmi_message_handler_test
} // namespace components
} // namespace test
diff --git a/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc b/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc
index fd459ea094..84ca5883ab 100644
--- a/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc
+++ b/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc
@@ -30,21 +30,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "application_manager/message.h"
#include "hmi_message_handler/hmi_message_handler_impl.h"
+#include "application_manager/message.h"
+#include "gtest/gtest.h"
#include "hmi_message_handler/messagebroker_adapter.h"
-#include "hmi_message_handler/mock_hmi_message_observer.h"
-#include "hmi_message_handler/mock_hmi_message_handler_settings.h"
#include "hmi_message_handler/mock_hmi_message_adapter_impl.h"
+#include "hmi_message_handler/mock_hmi_message_handler_settings.h"
+#include "hmi_message_handler/mock_hmi_message_observer.h"
+#include "utils/jsoncpp_reader_wrapper.h"
#include "utils/test_async_waiter.h"
namespace test {
namespace components {
namespace hmi_message_handler_test {
-using ::testing::Return;
using ::testing::_;
+using ::testing::Return;
class HMIMessageHandlerImplTest : public ::testing::Test {
public:
@@ -86,7 +87,7 @@ class HMIMessageHandlerImplTest : public ::testing::Test {
hmi_message_handler::MessageSharedPointer CreateMessage() {
// The ServiceType doesn't really matter
- return new application_manager::Message(
+ return std::make_shared<application_manager::Message>(
protocol_handler::MessagePriority::FromServiceType(
protocol_handler::ServiceType::kInvalidServiceType));
}
@@ -104,7 +105,7 @@ TEST_F(HMIMessageHandlerImplTest,
TEST_F(HMIMessageHandlerImplTest,
OnErrorSending_NotEmptyMessage_ExpectOnErrorSendingProceeded) {
// Arrange
- utils::SharedPtr<application_manager::Message> message = CreateMessage();
+ std::shared_ptr<application_manager::Message> message = CreateMessage();
EXPECT_CALL(*mock_hmi_message_observer_, OnErrorSending(message));
// Act
@@ -113,7 +114,7 @@ TEST_F(HMIMessageHandlerImplTest,
TEST_F(HMIMessageHandlerImplTest, OnErrorSending_InvalidObserver_Cancelled) {
// Arrange
- utils::SharedPtr<application_manager::Message> message = CreateMessage();
+ std::shared_ptr<application_manager::Message> message = CreateMessage();
hmi_handler_->set_message_observer(NULL);
EXPECT_CALL(*mock_hmi_message_observer_, OnErrorSending(_)).Times(0);
@@ -189,6 +190,46 @@ TEST_F(HMIMessageHandlerImplTest, SendMessageToHMI_Success) {
EXPECT_TRUE(waiter.WaitFor(1, 100));
}
+TEST(WebsocketSessionTest, SendMessage_UnpreparedConnection_WithoutFall) {
+ ::testing::FLAGS_gtest_death_test_style = "threadsafe";
+
+ auto send_message = []() {
+ auto message =
+ "{\"id\" : 1,\"jsonrpc\" : \"2.0\",\"method\" : "
+ "\"BasicCommunication.GetSystemInfo\"}";
+
+ utils::JsonReader reader;
+ Json::Value json_value;
+
+ ASSERT_TRUE(reader.parse(message, &json_value));
+
+ // Make unprepared connection
+ boost::asio::io_context ioc{1};
+ boost::asio::ip::tcp::acceptor acceptor{
+ ioc, {boost::asio::ip::make_address("127.0.0.1"), 8087}};
+ boost::asio::ip::tcp::socket socket{ioc};
+
+ std::unique_ptr<hmi_message_handler::WebsocketSession> session(
+ new hmi_message_handler::WebsocketSession(std::move(socket), nullptr));
+
+ // Send message to unprepared connection
+ session->sendJsonMessage(json_value);
+
+ // Wait for the message to be processed
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
+
+ // Stopping connection thread
+ session->Shutdown();
+ session = nullptr;
+
+ exit(0);
+ };
+
+ // Expected exit code 0, if test terminate by other signal(SIGABRT or
+ // SIGSEGV), we will get failed test
+ EXPECT_EXIT(send_message(), ::testing::ExitedWithCode(0), "");
+}
+
} // namespace hmi_message_handler_test
} // namespace components
} // namespace test
diff --git a/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_adapter_impl.h b/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_adapter_impl.h
index 0ec82b7862..4984fce23d 100644
--- a/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_adapter_impl.h
+++ b/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_adapter_impl.h
@@ -1,34 +1,34 @@
/*
-* Copyright (c) 2015, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
#include "gmock/gmock.h"
#include "hmi_message_handler/hmi_message_adapter_impl.h"
diff --git a/src/components/include/application_manager/app_launch_settings.h b/src/components/include/application_manager/app_launch_settings.h
index 47daf2f87c..fb65997c69 100644
--- a/src/components/include/application_manager/app_launch_settings.h
+++ b/src/components/include/application_manager/app_launch_settings.h
@@ -17,6 +17,6 @@ class AppLaunchSettings {
virtual const std::string& app_storage_folder() const = 0;
};
-} // namespace application_manager
+} // namespace app_launch
#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_SETTINGS_H_
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index 0888e1fc90..a3aace0f3f 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -33,26 +33,20 @@
#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
+#include <ctime>
+#include <set>
#include <string>
#include <vector>
-#include <set>
#include "application_manager/application.h"
-#include "application_manager/hmi_capabilities.h"
#include "application_manager/commands/command.h"
-#include "application_manager/command_factory.h"
#include "connection_handler/connection_handler.h"
#include "utils/data_accessor.h"
-#include "utils/shared_ptr.h"
-#include "telemetry_monitor/telemetry_observable.h"
-#include "application_manager/policies/policy_handler_interface.h"
+
#include "application_manager/application_manager_settings.h"
-#include "application_manager/state_controller.h"
#include "application_manager/hmi_interfaces.h"
-#include "policy/policy_types.h"
#include "application_manager/plugin_manager/rpc_plugin_manager.h"
-namespace resumption {
-class LastState;
-}
+#include "application_manager/state_controller.h"
+#include "policy/policy_types.h"
namespace app_launch {
class AppLaunchCtrl;
@@ -75,6 +69,10 @@ namespace resumption {
class ResumeCtrl;
}
+namespace policy {
+class PolicyHandlerInterface;
+}
+
namespace application_manager {
namespace event_engine {
@@ -88,13 +86,17 @@ class RPCHandler;
}
class Application;
+class AppServiceManager;
class StateControllerImpl;
struct CommandParametersPermissions;
using policy::RPCParams;
typedef std::vector<ApplicationSharedPtr> AppSharedPtrs;
-struct ApplicationsAppIdSorter {
+struct ApplicationsSorter {
bool operator()(const ApplicationSharedPtr lhs,
const ApplicationSharedPtr rhs) const {
+ if (lhs->app_id() == rhs->app_id()) {
+ return lhs->device() < rhs->device();
+ }
return lhs->app_id() < rhs->app_id();
}
};
@@ -108,11 +110,17 @@ struct ApplicationsPolicyAppIdSorter {
}
};
-typedef std::set<ApplicationSharedPtr, ApplicationsAppIdSorter> ApplicationSet;
+typedef std::set<ApplicationSharedPtr, ApplicationsSorter> ApplicationSet;
typedef std::set<ApplicationSharedPtr, ApplicationsPolicyAppIdSorter>
AppsWaitRegistrationSet;
+/**
+ * @brief ReregisterWaitList is list of applications expected to be
+ * re-registered after transport switching is complete
+ */
+typedef std::vector<ApplicationSharedPtr> ReregisterWaitList;
+
// typedef for Applications list iterator
typedef ApplicationSet::iterator ApplicationSetIt;
@@ -123,10 +131,14 @@ class ApplicationManager {
public:
virtual ~ApplicationManager() {}
+ DEPRECATED
+ virtual bool Init(resumption::LastState&,
+ media_manager::MediaManager* media_manager) = 0;
+
/**
* Inits application manager
*/
- virtual bool Init(resumption::LastState& last_state,
+ virtual bool Init(resumption::LastStateWrapperPtr last_state_wrapper,
media_manager::MediaManager* media_manager) = 0;
/**
@@ -151,9 +163,37 @@ class ApplicationManager {
connection_handler::ConnectionHandler* handler) = 0;
virtual DataAccessor<ApplicationSet> applications() const = 0;
+ virtual DataAccessor<AppsWaitRegistrationSet> pending_applications()
+ const = 0;
+
+ /**
+ * @brief CreatePendingApplication Add applicaiton to pending state
+ * All info mandatory for application will be fetched from policy database.
+ * Application will be stored to internal pending applicaitons list.
+ * UpdateAppList will not be trigerred
+ * Application will be created if app exists in policy database and
+ * nicknames are not empty
+ * @param policy_app_id app id to store
+ */
+ virtual void CreatePendingLocalApplication(
+ const std::string& policy_app_id) = 0;
+
+ /**
+ * @brief RemovePendingApplication Remove applicaiton from pending state
+ * Application will be removed from the internal pending applicaitons list.
+ * UpdateAppList will not be trigerred
+ * @param policy_app_id app id to remove
+ */
+ virtual void RemovePendingApplication(const std::string& policy_app_id) = 0;
+
+ virtual DataAccessor<ReregisterWaitList> reregister_applications() const = 0;
virtual ApplicationSharedPtr application(uint32_t app_id) const = 0;
virtual ApplicationSharedPtr active_application() const = 0;
+ virtual void OnQueryAppsRequest(
+ const connection_handler::DeviceHandle device) = 0;
+
+ virtual ApplicationSharedPtr get_full_or_limited_application() const = 0;
/**
* Function used only by HMI request/response/notification base classes
@@ -166,16 +206,27 @@ class ApplicationManager {
virtual ApplicationSharedPtr application_by_policy_id(
const std::string& policy_app_id) const = 0;
+ DEPRECATED virtual ApplicationSharedPtr application_by_name(
+ const std::string& app_name) const = 0;
+
+ virtual ApplicationSharedPtr pending_application_by_policy_id(
+ const std::string& policy_app_id) const = 0;
+
+ virtual ApplicationSharedPtr reregister_application_by_policy_id(
+ const std::string& policy_app_id) const = 0;
+
+ virtual AppSharedPtrs applications_by_name(
+ const std::string& app_name) const = 0;
virtual AppSharedPtrs applications_by_button(uint32_t button) = 0;
virtual AppSharedPtrs applications_with_navi() = 0;
/**
- * @brief application find application by device and policy identifier
- * @param device_id device id
- * @param policy_app_id poilcy identifier
- * @return pointer to application in case if application exist, in other case
- * return empty shared pointer
- */
+ * @brief application find application by device and policy identifier
+ * @param device_id device id
+ * @param policy_app_id poilcy identifier
+ * @return pointer to application in case if application exist, in other case
+ * return empty shared pointer
+ */
virtual ApplicationSharedPtr application(
const std::string& device_id, const std::string& policy_app_id) const = 0;
@@ -187,6 +238,8 @@ class ApplicationManager {
virtual plugin_manager::RPCPluginManager& GetPluginManager() = 0;
+ virtual AppServiceManager& GetAppServiceManager() = 0;
+
#ifdef BUILD_TESTS
virtual void SetPluginManager(
std::unique_ptr<plugin_manager::RPCPluginManager>& plugin_manager) = 0;
@@ -239,51 +292,55 @@ class ApplicationManager {
*/
virtual void set_application_id(const int32_t correlation_id,
const uint32_t app_id) = 0;
+ /**
+ * @brief get_current_audio_source
+ * @return current audio source
+ */
+ virtual uint32_t get_current_audio_source() const = 0;
/**
- * @brief OnHMILevelChanged the callback that allows SDL to react when
- * application's HMI level has been changed.
- *
- * @param app_id application identifier for which HMILevel has been chaned.
- *
- * @param from previous HMILevel.
- * @param to current HMILevel.
+ * @brief set_current_audio_source
+ * @param source
+ * set current audio source
*/
- virtual void OnHMILevelChanged(uint32_t app_id,
- mobile_apis::HMILevel::eType from,
- mobile_apis::HMILevel::eType to) = 0;
+ virtual void set_current_audio_source(const uint32_t source) = 0;
/**
- * @brief Sends HMI status notification to mobile
+ * @brief OnHMIStateChanged the callback that allows SDL to react when
+ * application's HMI level has been changed.
*
- * @param application_impl application with changed HMI status
+ * @param app_id application identifier for which HMIState has been chaned.
*
- **/
- virtual void SendHMIStatusNotification(
- const utils::SharedPtr<Application> app) = 0;
-
- /**
- * DEPRECATED
- * @brief Checks if Application is subscribed for way points
- * @param Application AppID
- * @return true if Application is subscribed for way points
- * otherwise false
+ * @param from previous HMIState.
+ * @param to current HMIState.
*/
- virtual bool IsAppSubscribedForWayPoints(const uint32_t app_id) const = 0;
+ virtual void OnHMIStateChanged(const uint32_t app_id,
+ const HmiStatePtr from,
+ const HmiStatePtr to) = 0;
/**
- * DEPRECATED
- * @brief Subscribe Application for way points
- * @param Application AppID
+ * @brief Updates streaming service status for specified session and notifies
+ * HMI via notification if required
+ * @param service_type Id of service which status should be updated
+ * @param app_id Id of session which status should be updated
+ * @param streaming_data_available Availability of streaming data for
+ * specified session
*/
- virtual void SubscribeAppForWayPoints(const uint32_t app_id) = 0;
+ virtual void ProcessOnDataStreamingNotification(
+ const protocol_handler::ServiceType service_type,
+ const uint32_t app_id,
+ const bool streaming_data_available) = 0;
/**
- * DEPRECATED
- * @brief Unsubscribe Application for way points
- * @param Application AppID
+ * @brief Checks if driver distraction state is valid, creates message
+ * which is sent to the application if allowed, otherwise it is added
+ * to a list of postponed messages.
+ * @param application contains registered application.
*/
- virtual void UnsubscribeAppFromWayPoints(const uint32_t app_id) = 0;
+ virtual void SendDriverDistractionState(ApplicationSharedPtr application) = 0;
+
+ virtual void SendGetIconUrlNotifications(
+ const uint32_t connection_key, ApplicationSharedPtr application) = 0;
/**
* @brief Checks if Application is subscribed for way points
@@ -315,13 +372,27 @@ class ApplicationManager {
* @brief Get subscribed for way points
* @return reference to set of subscribed apps for way points
*/
- virtual const std::set<int32_t> GetAppsSubscribedForWayPoints() const = 0;
+ virtual const std::set<uint32_t> GetAppsSubscribedForWayPoints() const = 0;
virtual void RemoveHMIFakeParameters(
- application_manager::commands::MessageSharedPtr& message) = 0;
+ application_manager::commands::MessageSharedPtr& message,
+ const hmi_apis::FunctionID::eType& function_id) = 0;
virtual mobile_api::HMILevel::eType GetDefaultHmiLevel(
ApplicationConstSharedPtr application) const = 0;
+
+ /**
+ * @brief Checks if required transport for resumption is available
+ *
+ * The required transport can be configured through smartDeviceLink.ini file.
+ *
+ * @param application an instance of the app to check
+ * @return true if the app is connected through one of the required
+ * transports, false otherwise
+ */
+ virtual bool CheckResumptionRequiredTransportAvailable(
+ ApplicationConstSharedPtr application) const = 0;
+
/**
* @brief hmi_capabilities return capabilities of hmi
* @return capabilities of hmi
@@ -382,6 +453,7 @@ class ApplicationManager {
virtual bool is_stopping() const = 0;
virtual bool is_audio_pass_thru_active() const = 0;
+ virtual uint32_t GetNextMobileCorrelationID() = 0;
virtual uint32_t GetNextHMICorrelationID() = 0;
virtual uint32_t GenerateNewHMIAppID() = 0;
@@ -391,12 +463,10 @@ class ApplicationManager {
*/
virtual void EndNaviServices(uint32_t app_id) = 0;
- /* @brief Starts audio passthru process
- * @deprecated Use BeginAudioPassThru(uint32_t app_id) instead
- *
- * @return true on success, false if passthru is already in process
+ /**
+ * @brief returns true if low voltage state is active
*/
- DEPRECATED virtual bool BeginAudioPassThrough() = 0;
+ virtual bool IsLowVoltage() const = 0;
/**
* @brief Starts AudioPassThru process by given application
@@ -405,14 +475,6 @@ class ApplicationManager {
*/
virtual bool BeginAudioPassThru(uint32_t app_id) = 0;
- /*
- * @brief Finishes already started audio passthru process
- * @deprecated Use EndAudioPassThru(uint32_t app_id) instead
- *
- * @return true on success, false if passthru is not active
- */
- DEPRECATED virtual bool EndAudioPassThrough() = 0;
-
/**
* @brief Finishes already started AudioPassThru process by given application
* @param app_id ID of the application which started the process
@@ -425,6 +487,22 @@ class ApplicationManager {
virtual void OnHMIStartedCooperation() = 0;
+ virtual void DisconnectCloudApp(ApplicationSharedPtr app) = 0;
+
+ virtual void RefreshCloudAppInformation() = 0;
+
+ virtual std::string PolicyIDByIconUrl(const std::string url) = 0;
+
+ virtual void SetIconFileFromSystemRequest(const std::string policy_id) = 0;
+
+ /**
+ * @brief Retrieve the current connection status of a cloud app
+ * @param app A cloud application
+ * @return The current CloudConnectionStatus of app
+ */
+ virtual hmi_apis::Common_CloudConnectionStatus::eType
+ GetCloudAppConnectionStatus(ApplicationConstSharedPtr app) const = 0;
+
virtual bool IsHMICooperating() const = 0;
/**
* @brief Notifies all components interested in Vehicle Data update
@@ -433,11 +511,11 @@ class ApplicationManager {
* @param vehicle_info Enum value of type of vehicle data
* @param new value (for integer values currently) of vehicle data
*/
- virtual void IviInfoUpdated(mobile_apis::VehicleDataType::eType vehicle_info,
- int value) = 0;
+ virtual void IviInfoUpdated(const std::string& vehicle_info, int value) = 0;
- virtual ApplicationSharedPtr RegisterApplication(const utils::SharedPtr<
- smart_objects::SmartObject>& request_for_registration) = 0;
+ virtual ApplicationSharedPtr RegisterApplication(
+ const std::shared_ptr<smart_objects::SmartObject>&
+ request_for_registration) = 0;
virtual void SendUpdateAppList() = 0;
@@ -465,15 +543,13 @@ class ApplicationManager {
virtual bool IsStopping() const = 0;
- virtual bool IsLowVoltage() = 0;
-
virtual void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) = 0;
virtual mobile_apis::Result::eType SaveBinary(
const std::vector<uint8_t>& binary_data,
const std::string& file_path,
const std::string& file_name,
- const int64_t offset) = 0;
+ const uint64_t offset) = 0;
/*
* @brief Sets SDL access to all mobile apps
*
@@ -546,6 +622,9 @@ class ApplicationManager {
uint32_t mobile_correlation_id,
uint32_t new_timeout_value) = 0;
+ virtual void IncreaseForwardedRequestTimeout(
+ uint32_t connection_key, uint32_t mobile_correlation_id) = 0;
+
virtual StateController& state_controller() = 0;
virtual void SetUnregisterAllApplicationsReason(
@@ -560,19 +639,20 @@ class ApplicationManager {
mobile_api::AppInterfaceUnregisteredReason::eType reason) = 0;
/**
- * @brief Checks HMI level and returns true if streaming is allowed
+ * @brief Checks application HMI state and returns true if streaming is
+ * allowed
* @param app_id Application id
* @param service_type Service type to check
* @return True if streaming is allowed, false in other case
*/
- virtual bool HMILevelAllowsStreaming(
+ virtual bool HMIStateAllowsStreaming(
uint32_t app_id, protocol_handler::ServiceType service_type) const = 0;
/**
* @brief Checks, if given RPC is allowed at current HMI level for specific
* application in policy table
- * @param policy_app_id Application id
- * @param hmi_level Current HMI level of application
+ * @param app Application
+ * @param window_id id of application's window
* @param function_id FunctionID of RPC
* @param params_permissions Permissions for RPC parameters (e.g.
* SubscribeVehicleData) defined in policy table
@@ -580,6 +660,7 @@ class ApplicationManager {
*/
virtual mobile_apis::Result::eType CheckPolicyPermissions(
const ApplicationSharedPtr app,
+ const WindowID window_id,
const std::string& function_id,
const RPCParams& rpc_params,
CommandParametersPermissions* params_permissions = NULL) = 0;
@@ -600,19 +681,22 @@ class ApplicationManager {
/**
* @brief IsAppInReconnectMode check if application belongs to session
* affected by transport switching at the moment
+ * @param device_id device indentifier
* @param policy_app_id Application id
* @return True if application is registered within session being switched,
* otherwise - false
*/
- virtual bool IsAppInReconnectMode(const std::string& policy_app_id) const = 0;
+ virtual bool IsAppInReconnectMode(
+ const connection_handler::DeviceHandle& device_id,
+ const std::string& policy_app_id) const = 0;
virtual resumption::ResumeCtrl& resume_controller() = 0;
/**
- * @brief hmi_interfaces getter for hmi_interfaces component, that handle
- * hmi_instrfaces state
- * @return reference to hmi_interfaces component
- */
+ * @brief hmi_interfaces getter for hmi_interfaces component, that handle
+ * hmi_instrfaces state
+ * @return reference to hmi_interfaces component
+ */
virtual HmiInterfaces& hmi_interfaces() = 0;
virtual app_launch::AppLaunchCtrl& app_launch_ctrl() = 0;
@@ -620,6 +704,13 @@ class ApplicationManager {
virtual protocol_handler::MajorProtocolVersion SupportedSDLVersion()
const = 0;
+ /**
+ * @brief Applies functor for each plugin
+ * @param functor Functor that will be applied to each plugin
+ */
+ virtual void ApplyFunctorForEachPlugin(
+ std::function<void(plugin_manager::RPCPlugin&)> functor) = 0;
+
/*
* @brief Converts connection string transport type representation
* to HMI Common_TransportType
@@ -640,19 +731,19 @@ class ApplicationManager {
virtual void AddAppToTTSGlobalPropertiesList(const uint32_t app_id) = 0;
/**
- * Generate grammar ID
- *
- * @return New grammar ID
- */
+ * Generate grammar ID
+ *
+ * @return New grammar ID
+ */
virtual uint32_t GenerateGrammarID() = 0;
virtual policy::DeviceConsent GetUserConsentForDevice(
const std::string& device_id) const = 0;
/**
- * @brief Handle sequence for unauthorized application
- * @param app_id Application id
- */
+ * @brief Handle sequence for unauthorized application
+ * @param app_id Application id
+ */
virtual void OnAppUnauthorized(const uint32_t& app_id) = 0;
virtual bool ActivateApplication(ApplicationSharedPtr app) = 0;
@@ -670,32 +761,19 @@ class ApplicationManager {
/**
* @brief CreateRegularState create regular HMI state for application
* @param app Application
+ * @param window_type type of window
* @param hmi_level of returned state
* @param audio_state of returned state
* @param system_context of returned state
* @return new regular HMI state
*/
virtual HmiStatePtr CreateRegularState(
- utils::SharedPtr<Application> app,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::VideoStreamingState::eType video_state,
- mobile_apis::SystemContext::eType system_context) const = 0;
-
- /**
- * DEPRECATED
- * @brief CreateRegularState create regular HMI state for application
- * @param app_id Application id
- * @param hmi_level of returned state
- * @param audio_state of returned state
- * @param system_context of returned state
- * @return new regular HMI state
- */
- virtual HmiStatePtr CreateRegularState(
- uint32_t app_id,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::SystemContext::eType system_context) const = 0;
+ std::shared_ptr<Application> app,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::VideoStreamingState::eType video_state,
+ const mobile_apis::SystemContext::eType system_context) const = 0;
/**
* @brief Checks if application can stream (streaming service is started and
@@ -707,11 +785,16 @@ class ApplicationManager {
virtual bool CanAppStream(
uint32_t app_id, protocol_handler::ServiceType service_type) const = 0;
+ DEPRECATED
+ virtual void ForbidStreaming(uint32_t app_id) = 0;
+
/**
* @brief ForbidStreaming forbid the stream over the certain application.
* @param app_id the application's id which should stop streaming.
+ * @param service_type Service type to check
*/
- virtual void ForbidStreaming(uint32_t app_id) = 0;
+ virtual void ForbidStreaming(uint32_t app_id,
+ protocol_handler::ServiceType service_type) = 0;
/**
* @brief Called when application completes streaming configuration
@@ -728,6 +811,9 @@ class ApplicationManager {
std::vector<std::string>& rejected_params) = 0;
virtual const ApplicationManagerSettings& get_settings() const = 0;
+ // Extract the app ID to use internally based on the UseFullAppID .ini setting
+ virtual std::string GetCorrectMobileIDFromMessage(
+ const commands::MessageSharedPtr& message) const = 0;
virtual event_engine::EventDispatcher& event_dispatcher() = 0;
diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h
index e745a831c6..5b3dfc26df 100644
--- a/src/components/include/application_manager/application_manager_settings.h
+++ b/src/components/include/application_manager/application_manager_settings.h
@@ -33,11 +33,13 @@
#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_SETTINGS_H_
#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_SETTINGS_H_
-#include "application_manager/request_controller_settings.h"
#include "application_manager/app_launch_settings.h"
+#include "application_manager/request_controller_settings.h"
#include <stdint.h>
+#include <map>
#include <string>
+#include <vector>
namespace application_manager {
class ApplicationManagerSettings : public RequestControlerSettings,
@@ -48,6 +50,8 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const std::pair<uint32_t, int32_t>& read_did_frequency() const = 0;
virtual const std::pair<uint32_t, int32_t>& get_vehicle_data_frequency()
const = 0;
+ virtual const std::pair<uint32_t, int32_t>&
+ get_interior_vehicle_data_frequency() const = 0;
virtual uint32_t hash_string_size() const = 0;
virtual const uint32_t& app_dir_quota() const = 0;
virtual uint32_t stop_streaming_timeout() const = 0;
@@ -68,7 +72,9 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const std::string& tts_delimiter() const = 0;
virtual const uint32_t& put_file_in_none() const = 0;
virtual const std::string& sdl_version() const = 0;
+ virtual const std::string& vr_help_title() const = 0;
virtual const std::vector<std::string>& time_out_promt() const = 0;
+ virtual const std::vector<std::string>& help_prompt() const = 0;
virtual const std::string& hmi_capabilities_file_name() const = 0;
virtual const std::string& video_server_type() const = 0;
virtual const std::string& audio_server_type() const = 0;
@@ -79,7 +85,12 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const std::string& named_audio_pipe_path() const = 0;
virtual const std::string& video_stream_file() const = 0;
virtual const std::string& audio_stream_file() const = 0;
+ virtual uint16_t period_for_consent_expiration() const = 0;
+ virtual bool use_full_app_id() const = 0;
+ virtual uint32_t rpc_pass_through_timeout() const = 0;
+ virtual uint32_t cloud_app_retry_timeout() const = 0;
+ virtual uint16_t cloud_app_max_retry_attempts() const = 0;
virtual bool use_db_for_resumption() const = 0;
virtual const uint32_t& app_resumption_save_persistent_data_timeout()
const = 0;
@@ -87,6 +98,13 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const uint32_t& app_resuming_timeout() const = 0;
virtual uint16_t attempts_to_open_resumption_db() const = 0;
virtual uint16_t open_attempt_timeout_ms_resumption_db() const = 0;
+ virtual const std::map<std::string, std::vector<std::string> >&
+ transport_required_for_resumption_map() const = 0;
+ virtual const std::string& navigation_lowbandwidth_resumption_level()
+ const = 0;
+ virtual const std::string& projection_lowbandwidth_resumption_level()
+ const = 0;
+ virtual const std::string& media_lowbandwidth_resumption_level() const = 0;
virtual void set_config_file_name(const std::string& fileName) = 0;
virtual const std::pair<uint32_t, int32_t>& start_stream_retry_amount()
const = 0;
@@ -95,6 +113,8 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const uint32_t& app_icons_amount_to_remove() const = 0;
virtual const uint32_t& list_files_response_size() const = 0;
virtual const std::string& plugins_folder() const = 0;
+ virtual const std::vector<std::string>& embedded_services() const = 0;
+ virtual const std::string hmi_origin_id() const = 0;
};
} // namespace application_manager
diff --git a/src/components/include/application_manager/hmi_capabilities.h b/src/components/include/application_manager/hmi_capabilities.h
index 1283584ef8..e10295b56f 100644
--- a/src/components/include/application_manager/hmi_capabilities.h
+++ b/src/components/include/application_manager/hmi_capabilities.h
@@ -28,21 +28,18 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
-*/
+ */
#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_
#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_
+#include "application_manager/hmi_language_handler.h"
#include "interfaces/HMI_API.h"
#include "interfaces/MOBILE_API.h"
#include "json/json.h"
-#include "utils/macro.h"
-#include "application_manager/hmi_language_handler.h"
+#include "resumption/last_state_wrapper.h"
#include "smart_objects/smart_object.h"
-
-namespace resumption {
-class LastState;
-}
+#include "utils/macro.h"
namespace application_manager {
class ApplicationManager;
@@ -56,16 +53,16 @@ class HMICapabilities {
virtual ~HMICapabilities() {}
/**
- * @brief return component which follows for correctness of
- * languages
- * @return HMI language handler
- */
+ * @brief return component which follows for correctness of
+ * languages
+ * @return HMI language handler
+ */
virtual HMILanguageHandler& get_hmi_language_handler() = 0;
/*
- * @brief Checks is image type(Static/Dynamic) requested by
+ * @brief Checks if image type(Static/Dynamic) requested by
* Mobile Device is supported on current HMI.
- * @param image_type recieved type of image from Enum.
+ * @param image_type received type of image from Enum.
* @return Bool true if supported
*/
virtual bool VerifyImageType(const int32_t image_type) const = 0;
@@ -219,7 +216,7 @@ class HMICapabilities {
*
* @return Currently supported display capabilities
*/
- virtual const smart_objects::SmartObject* display_capabilities() const = 0;
+ virtual const smart_objects::SmartObjectSPtr display_capabilities() const = 0;
/*
* @brief Sets supported display capabilities
@@ -230,11 +227,26 @@ class HMICapabilities {
const smart_objects::SmartObject& display_capabilities) = 0;
/*
+ * @brief Retrieves information about the display capability
+ * @return Currently supported display capability
+ */
+ virtual const smart_objects::SmartObjectSPtr system_display_capabilities()
+ const = 0;
+
+ /*
+ * @brief Sets supported display capability
+ * @param display_capabilities supported display capability
+ */
+ virtual void set_system_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) = 0;
+
+ /*
* @brief Retrieves information about the HMI zone capabilities
*
* @return Currently supported HMI zone capabilities
*/
- virtual const smart_objects::SmartObject* hmi_zone_capabilities() const = 0;
+ virtual const smart_objects::SmartObjectSPtr hmi_zone_capabilities()
+ const = 0;
/*
* @brief Sets supported HMI zone capabilities
@@ -249,7 +261,7 @@ class HMICapabilities {
*
* @return Currently supported SoftButton's capabilities
*/
- virtual const smart_objects::SmartObject* soft_button_capabilities()
+ virtual const smart_objects::SmartObjectSPtr soft_button_capabilities()
const = 0;
/*
@@ -265,7 +277,7 @@ class HMICapabilities {
*
* @return Currently supported Button's capabilities
*/
- virtual const smart_objects::SmartObject* button_capabilities() const = 0;
+ virtual const smart_objects::SmartObjectSPtr button_capabilities() const = 0;
/*
* @brief Sets supported Button's capabilities
@@ -288,7 +300,7 @@ class HMICapabilities {
*
* @return Currently supported speech capabilities
*/
- virtual const smart_objects::SmartObject* speech_capabilities() const = 0;
+ virtual const smart_objects::SmartObjectSPtr speech_capabilities() const = 0;
/*
* @brief Sets supported VR capabilities
@@ -303,7 +315,7 @@ class HMICapabilities {
*
* @return Currently supported VR capabilities
*/
- virtual const smart_objects::SmartObject* vr_capabilities() const = 0;
+ virtual const smart_objects::SmartObjectSPtr vr_capabilities() const = 0;
/*
* @brief Sets supported audio_pass_thru capabilities
@@ -318,7 +330,7 @@ class HMICapabilities {
*
* @return Currently supported audio_pass_thru capabilities
*/
- virtual const smart_objects::SmartObject* audio_pass_thru_capabilities()
+ virtual const smart_objects::SmartObjectSPtr audio_pass_thru_capabilities()
const = 0;
/*
@@ -334,14 +346,15 @@ class HMICapabilities {
*
* @return Currently supported pcm_streaming capabilities
*/
- virtual const smart_objects::SmartObject* pcm_stream_capabilities() const = 0;
+ virtual const smart_objects::SmartObjectSPtr pcm_stream_capabilities()
+ const = 0;
/*
* @brief Retrieves information about the preset bank capabilities
*
* @return Currently supported preset bank capabilities
*/
- virtual const smart_objects::SmartObject* preset_bank_capabilities()
+ virtual const smart_objects::SmartObjectSPtr preset_bank_capabilities()
const = 0;
/*
@@ -365,14 +378,14 @@ class HMICapabilities {
*
* @param vehicle_type Cuurent vehicle information
*/
- virtual const smart_objects::SmartObject* vehicle_type() const = 0;
+ virtual const smart_objects::SmartObjectSPtr vehicle_type() const = 0;
/*
* @brief Retrieves information about the prerecorded speech
*
* @return Currently supported prerecorded speech
*/
- virtual const smart_objects::SmartObject* prerecorded_speech() const = 0;
+ virtual const smart_objects::SmartObjectSPtr prerecorded_speech() const = 0;
/*
* @brief Sets supported prerecorded speech
@@ -499,8 +512,27 @@ class HMICapabilities {
virtual const smart_objects::SmartObject* rc_capability() const = 0;
+ /**
+ * @brief Sets available SeatLocation capabilities for further usage by
+ * RC functionality
+ * @param seat_location_capability capabilities to set
+ */
+ virtual void set_seat_location_capability(
+ const smart_objects::SmartObject& seat_location_capability) = 0;
+
+ /**
+ * @brief seat_location_capability Retrieves information regarding the
+ * seat location capability
+ * @return smart object of seat location capability
+ */
+ virtual const smart_objects::SmartObject* seat_location_capability()
+ const = 0;
+
+ DEPRECATED
virtual void Init(resumption::LastState* last_state) = 0;
+ virtual void Init(resumption::LastStateWrapperPtr last_state_wrapper) = 0;
+
/**
* @brief Trigger waiting for response
* @param request Request object
@@ -525,6 +557,18 @@ class HMICapabilities {
virtual void convert_json_languages_to_obj(
const Json::Value& json_languages,
smart_objects::SmartObject& languages) const = 0;
+
+ /*
+ * @brief function that converts a single entry of audio pass thru capability
+ * to smart object
+ *
+ * @param capability json object that represents a single entry of audio pass
+ * thru capability
+ * @param output_so the converted object
+ */
+ virtual void convert_audio_capability_to_obj(
+ const Json::Value& capability,
+ smart_objects::SmartObject& output_so) const = 0;
};
} // namespace application_manager
diff --git a/src/components/include/application_manager/policies/policy_encryption_flag_getter.h b/src/components/include/application_manager/policies/policy_encryption_flag_getter.h
new file mode 100644
index 0000000000..1a004fb926
--- /dev/null
+++ b/src/components/include/application_manager/policies/policy_encryption_flag_getter.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_ENCRYPTION_FLAG_GETTER
+#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_ENCRYPTION_FLAG_GETTER
+
+#include <string>
+#include "policy/policy_table/types.h"
+
+using rpc::policy_table_interface_base::Strings;
+
+namespace policy {
+/*
+ * @brief PolicyEncryptionFlagGetterInterface interface
+ */
+class PolicyEncryptionFlagGetterInterface {
+ public:
+ /*!
+ * @brief virtual destructor PolicyEncryptionFlagGetterInterface
+ */
+ virtual ~PolicyEncryptionFlagGetterInterface() {}
+
+ /*
+ * @brief retreives flag whether given application needs encryption
+ * @param policy_app_id policy app id
+ * @return true if the app need encryption
+ */
+ virtual bool AppNeedEncryption(const std::string& policy_app_id) const = 0;
+
+ /*
+ * @brief Retrieves encryption required flag on the application level
+ * @param policy_app_id policy app id
+ * @return true if the app need encryption
+ */
+ virtual const rpc::Optional<rpc::Boolean> GetAppEncryptionRequired(
+ const std::string& policy_app_id) const = 0;
+
+ /*
+ * @brief retreives function group for app
+ * @param policy_app_id policy app id
+ * @return groups that exist for app
+ */
+ virtual const std::vector<std::string> GetFunctionalGroupsForApp(
+ const std::string& policy_app_id) const = 0;
+
+ /*
+ * @brief retreives flag indicating whether function group needs encryption
+ * @param policy_group group
+ * @return true if the group need encryption
+ */
+ virtual bool FunctionGroupNeedEncryption(
+ const std::string& policy_group) const = 0;
+
+ /*
+ * @brief retreives rpcs for given function group
+ * @param policy_group group
+ * @return RPCs that exists in group
+ */
+ virtual const std::vector<std::string> GetRPCsForFunctionGroup(
+ const std::string& group) const = 0;
+
+ /*
+ * @brief retreives policy function name
+ * @param function_id function id
+ * @return policy function name
+ */
+ virtual const std::string GetPolicyFunctionName(
+ const uint32_t function_id) const = 0;
+ /*
+ * @brief retrieves application names from policy table
+ * @return container with policy application names
+ */
+ virtual const std::vector<std::string> GetApplicationPolicyIDs() const = 0;
+};
+
+} // namespace policy
+#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_ENCRYPTION_FLAG_GETTER
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index b8946a63f4..735f44a314 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -33,60 +33,92 @@
#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_HANDLER_INTERFACE_H_
#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_HANDLER_INTERFACE_H_
-#include <string>
#include <map>
+#include <queue>
#include <set>
+#include <string>
#include <vector>
-#include <queue>
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/policies/policy_handler_observer.h"
+#include "boost/optional.hpp"
+
#include "application_manager/application.h"
-#include "policy/usage_statistics/statistics_manager.h"
-#include "utils/custom_string.h"
-#include "utils/callable.h"
+#include "application_manager/policies/custom_vehicle_data_provider.h"
+#include "application_manager/policies/policy_encryption_flag_getter.h"
+#include "application_manager/policies/policy_handler_observer.h"
+#include "interfaces/MOBILE_API.h"
+#include "policy/cache_manager_interface.h"
#include "policy/policy_settings.h"
-#include "smart_objects/smart_object.h"
-#include "policy/policy_types.h"
#include "policy/policy_table/types.h"
-#include "policy/cache_manager_interface.h"
+#include "policy/policy_types.h"
+#include "policy/usage_statistics/statistics_manager.h"
+#include "smart_objects/smart_object.h"
+#include "utils/callable.h"
+#include "utils/custom_string.h"
+#include "utils/optional.h"
+#ifdef EXTERNAL_PROPRIETARY_MODE
+#include "policy/ptu_retry_handler.h"
+#endif // EXTERNAL_PROPRIETARY_MODE
using namespace ::rpc::policy_table_interface_base;
namespace policy {
-typedef utils::SharedPtr<utils::Callable> StatusNotifier;
+typedef std::shared_ptr<utils::Callable> StatusNotifier;
+typedef std::shared_ptr<PolicyEncryptionFlagGetterInterface>
+ PolicyEncryptionFlagGetterInterfaceSPtr;
+
+class PTURetryHandler;
-class PolicyHandlerInterface {
+class PolicyHandlerInterface : public VehicleDataItemProvider {
public:
virtual ~PolicyHandlerInterface() {}
virtual bool LoadPolicyLibrary() = 0;
+ virtual PolicyEncryptionFlagGetterInterfaceSPtr PolicyEncryptionFlagGetter()
+ const = 0;
virtual bool PolicyEnabled() const = 0;
virtual bool InitPolicyTable() = 0;
virtual bool ResetPolicyTable() = 0;
virtual bool ClearUserConsent() = 0;
- virtual bool SendMessageToSDK(const BinaryMessage& pt_string,
- const std::string& url) = 0;
+ // Deprecated in favor of private variant
+ DEPRECATED virtual bool SendMessageToSDK(const BinaryMessage& pt_string,
+ const std::string& url) = 0;
virtual bool ReceiveMessageFromSDK(const std::string& file,
const BinaryMessage& pt_string) = 0;
virtual bool UnloadPolicyLibrary() = 0;
- virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ virtual void OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions,
const HMILevel& default_hmi) = 0;
-
- virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ virtual void OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions) = 0;
#ifdef EXTERNAL_PROPRIETARY_MODE
virtual void OnSnapshotCreated(const BinaryMessage& pt_string,
const std::vector<int>& retry_delay_seconds,
uint32_t timeout_exchange) = 0;
+
+ virtual PTURetryHandler& ptu_retry_handler() const = 0;
#else // EXTERNAL_PROPRIETARY_MODE
- virtual void OnSnapshotCreated(const BinaryMessage& pt_string) = 0;
+ virtual void OnSnapshotCreated(const BinaryMessage& pt_string,
+ const PTUIterationType iteration_type) = 0;
+
+ /**
+ * @brief Get the next available PTU URL and the associated application for
+ * performing the PTU
+ * @param iteration_type The iteration type of the PTU.
+ * If this is a retry and a retry URL was cached, that URL will be returned
+ * @param app_id Filled with the ID of application used to perform the PTU on
+ * success
+ * @return The next available PTU URL on success, empty string on failure
+ */
+ virtual std::string GetNextUpdateUrl(const PTUIterationType iteration_type,
+ uint32_t& app_id) = 0;
#endif // EXTERNAL_PROPRIETARY_MODE
virtual bool GetPriority(const std::string& policy_app_id,
std::string* priority) const = 0;
virtual void CheckPermissions(
const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const PTString& rpc,
const RPCParams& rpc_params,
CheckPermissionResult& result) = 0;
@@ -95,16 +127,27 @@ class PolicyHandlerInterface {
const std::string& priority) const = 0;
virtual DeviceConsent GetUserConsentForDevice(
const std::string& device_id) const = 0;
- virtual bool GetDefaultHmi(const std::string& policy_app_id,
+ virtual bool GetDefaultHmi(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi) const = 0;
virtual bool GetInitialAppData(const std::string& application_id,
StringArray* nicknames = NULL,
StringArray* app_hmi_types = NULL) = 0;
virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) = 0;
- virtual std::string GetLockScreenIconUrl() const = 0;
+ EndpointUrls& out_end_points) const = 0;
+ virtual Json::Value GetPolicyTableData() const = 0;
+
+ /**
+ * @brief Gets lock screen icon URL for a requested application
+ * @param policy_app_id policy application id
+ * @return URL for a requested application
+ */
+ virtual std::string GetLockScreenIconUrl(
+ const std::string& policy_app_id = kDefaultId) const = 0;
+
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
virtual uint32_t NextRetryTimeout() = 0;
/**
@@ -119,16 +162,27 @@ class PolicyHandlerInterface {
*/
virtual uint32_t TimeoutExchangeMSec() const = 0;
virtual void OnExceededTimeout() = 0;
- virtual void OnSystemReady() = 0;
+ virtual const boost::optional<bool> LockScreenDismissalEnabledState()
+ const = 0;
+ virtual const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const = 0;
virtual void PTUpdatedAt(Counters counter, int value) = 0;
virtual void add_listener(PolicyHandlerObserver* listener) = 0;
virtual void remove_listener(PolicyHandlerObserver* listener) = 0;
- virtual utils::SharedPtr<usage_statistics::StatisticsManager>
+ virtual std::shared_ptr<usage_statistics::StatisticsManager>
GetStatisticManager() const = 0;
virtual void SendOnAppPermissionsChanged(
const AppPermissions& permissions,
+ const std::string& device_id,
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Send OnAppPropertiesChangeNotification to the HMI
+ * @param policy_app_id policy app id
+ */
+ virtual void SendOnAppPropertiesChangeNotification(
const std::string& policy_app_id) const = 0;
/**
@@ -168,7 +222,8 @@ class PolicyHandlerInterface {
*/
virtual void OnIgnitionCycleOver() = 0;
- virtual void OnPendingPermissionChange(const std::string& policy_app_id) = 0;
+ virtual void OnPendingPermissionChange(const std::string& device_id,
+ const std::string& policy_app_id) = 0;
/**
* Initializes PT exchange at user request
@@ -193,13 +248,13 @@ class PolicyHandlerInterface {
const DeviceInfo& device_info) = 0;
/**
-*@brief Processes data from OnAppPermissionConsent notification with
-*permissions changes and ExternalConsent status changes done by user
-*@param connection_key Connection key of application, 0 if no key has been
-*provided
-*@param permissions Groups permissions changes
-*@param external_consent_status Customer connectivity settings status changes
-*/
+ *@brief Processes data from OnAppPermissionConsent notification with
+ *permissions changes and ExternalConsent status changes done by user
+ *@param connection_key Connection key of application, 0 if no key has been
+ *provided
+ *@param permissions Groups permissions changes
+ *@param external_consent_status Customer connectivity settings status changes
+ */
#ifdef EXTERNAL_PROPRIETARY_MODE
virtual void OnAppPermissionConsent(
const uint32_t connection_key,
@@ -247,9 +302,11 @@ class PolicyHandlerInterface {
/**
* @brief Update currently used device id in policies manager for given
* application
+ * @param device_handle device identifier
* @param policy_app_id Application id
*/
virtual std::string OnCurrentDeviceIdUpdateRequired(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) = 0;
/**
@@ -269,11 +326,6 @@ class PolicyHandlerInterface {
const std::string& language) = 0;
/**
- * @brief Send request to HMI to get update on system parameters
- */
- virtual void OnSystemInfoUpdateRequired() = 0;
-
- /**
* @brief Sends GetVehicleData request in case when Vechicle info is ready.
*/
virtual void OnVIIsReady() = 0;
@@ -303,9 +355,33 @@ class PolicyHandlerInterface {
*/
virtual void OnSystemError(int code) = 0;
+#ifndef EXTERNAL_PROPRIETARY_MODE
+ /**
+ * @brief Chooses and stores random application id to be used for snapshot
+ * sending considering HMI level
+ * @param iteration_type The iteration type of the request. If RetryIteration,
+ * the previously chosen app ID (via ChoosePTUApplication or CacheRetryInfo)
+ * will be returned if available
+ * @return Application id or 0, if there are no suitable applications
+ */
+ virtual uint32_t ChoosePTUApplication(
+ const PTUIterationType iteration_type =
+ PTUIterationType::DefaultIteration) = 0;
+
/**
- * @brief Choose application id to be used for snapshot sending
- * @return Application id or 0, if there are no applications registered
+ * @brief Update the cached URL and app ID used for policy retries
+ * @param app_id The ID of the application to be used for performing PTUs.
+ * If 0, the existing cached application will be cleared
+ * @param url The URL provided by the HMI to be used for performing PTU
+ * retries. If empty, the existing cached URL will be cleared and Core will
+ * choose which URLs to use on retry
+ */
+ virtual void CacheRetryInfo(const uint32_t app_id, const std::string url) = 0;
+#endif // EXTERNAL_PROPRIETARY_MODE
+
+ /**
+ * @brief Retrieve potential application id to be used for snapshot sending
+ * @return Application id or 0, if there are no suitable applications
*/
virtual uint32_t GetAppIdForSending() const = 0;
@@ -319,6 +395,13 @@ class PolicyHandlerInterface {
virtual void OnPTUFinished(const bool ptu_result) = 0;
+ virtual void OnPTInited() = 0;
+
+ /**
+ * @brief Force stops retry sequence timer and resets retry sequence
+ */
+ virtual void StopRetrySequence() = 0;
+
#ifdef EXTERNAL_PROPRIETARY_MODE
virtual void OnCertificateDecrypted(bool is_succeeded) = 0;
#endif // EXTERNAL_PROPRIETARY_MODE
@@ -334,10 +417,12 @@ class PolicyHandlerInterface {
/**
* @brief Allows to add new or update existed application during
* registration process
+ * @param device_id device identifier
* @param application_id The policy aplication id.
* @return function that will notify update manager about new application
*/
virtual StatusNotifier AddApplication(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) = 0;
@@ -372,21 +457,33 @@ class PolicyHandlerInterface {
virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0;
/**
+ * @brief Notify that new application was added to application list
+ * @param new_app_id app_id for this application
+ * @param policy_id policy_id for this application
+ */
+ virtual void OnAddedNewApplicationToAppList(const uint32_t new_app_id,
+ const std::string& policy_id) = 0;
+
+ /**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
* succesfully registered on mobile device.
* It will send OnAppPermissionSend notification and will try to start PTU.
*
+ * @param device_id device identifier
* @param application_id registered application.
*/
- virtual void OnAppRegisteredOnMobile(const std::string& application_id) = 0;
+ virtual void OnAppRegisteredOnMobile(const std::string& device_id,
+ const std::string& application_id) = 0;
/**
* @brief Checks if certain request type is allowed for application
+ * @param device_handle device identifier
* @param policy_app_id Unique applicaion id
* @param type Request type
* @return true, if allowed, otherwise - false
*/
virtual bool IsRequestTypeAllowed(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id,
mobile_apis::RequestType::eType type) const = 0;
@@ -418,10 +515,12 @@ class PolicyHandlerInterface {
/**
* @brief Gets application request types
+ * @param device_handle device identifier
* @param policy_app_id Unique application id
* @return request types
*/
virtual const std::vector<std::string> GetAppRequestTypes(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) const = 0;
/**
@@ -433,10 +532,130 @@ class PolicyHandlerInterface {
const std::string& policy_app_id) const = 0;
/**
- * @brief Gets vehicle information
- * @return Structure with vehicle information
+ * @brief Get a list of policy app ids
+ * @return apps list filled with the policy app ids of each
+ * application
+ */
+ virtual std::vector<std::string> GetApplicationPolicyIDs() const = 0;
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
+ * @brief Checks if a given application is an enabled cloud application
+ * @param policy_app_id Unique application id
+ * @return true if the application is an enabled cloud application,
+ * false otherwise
+ */
+ virtual const bool CheckCloudAppEnabled(
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Get a list of enabled local applications
+ * @return enabled_apps List filled with the policy app id of each enabled
+ * local application
*/
- virtual const VehicleInfo GetVehicleInfo() const = 0;
+ virtual std::vector<std::string> GetEnabledLocalApps() const = 0;
+
+ /**
+ * @brief Get app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id policy app id
+ * @param out_app_properties application properties
+ * @return true if application presents in database, otherwise - false
+ */
+ virtual bool GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const = 0;
+
+ /**
+ * @brief Callback for when a BC.SetAppProperties message is
+ * received from the HMI
+ * @param message The BC.SetAppProperties message
+ */
+ virtual void OnSetAppProperties(
+ const smart_objects::SmartObject& properties) = 0;
+
+ enum class AppPropertiesState {
+ NO_CHANGES,
+ ENABLED_FLAG_SWITCH,
+ AUTH_TOKEN_CHANGED,
+ TRANSPORT_TYPE_CHANGED,
+ ENDPOINT_CHANGED,
+ NICKNAMES_CHANGED,
+ HYBRYD_APP_PROPERTIES_CHANGED
+ };
+
+ /**
+ * @brief Checks if the application properties were changed. Compares the
+ * properties received from the HMI with the stored properties in the database
+ * @param properties new app properties
+ * @param app_id application id
+ * @return AppPropertiesState enum value that indicates which property has
+ * been changed
+ */
+ virtual AppPropertiesState GetAppPropertiesStatus(
+ const smart_objects::SmartObject& properties,
+ const std::string& app_id) const = 0;
+
+ /**
+ * @brief Check if certain application already in policy db.
+ * @param policy application id.
+ * @return true if application presents false otherwise.
+ */
+ virtual bool IsNewApplication(const std::string& application_id) const = 0;
+
+ /**
+ * @brief OnLocalAppAdded triggers PTU
+ */
+ virtual void OnLocalAppAdded() = 0;
+
+ /**
+ * @brief Callback for when a SetCloudAppProperties message is received from a
+ * mobile app
+ * @param message The SetCloudAppProperties message
+ */
+ virtual void OnSetCloudAppProperties(
+ const smart_objects::SmartObject& message) = 0;
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const = 0;
+
+ /**
+ * @brief Check app service parameters from an app against policies
+ * @param policy_app_id Unique application id
+ * @param requested_service_name Service name published by app service
+ * provider
+ * @param requested_service_type Service type published by app service
+ * provider
+ * @param requested_handled_rpcs Vector of requested function ids an app
+ * service wants to handle from consumers
+ */
+ virtual bool CheckAppServiceParameters(
+ const std::string& policy_app_id,
+ const std::string& requested_service_name,
+ const std::string& requested_service_type,
+ smart_objects::SmartArray* requested_handled_rpcs) const = 0;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const = 0;
+
#ifdef EXTERNAL_PROPRIETARY_MODE
/**
* @brief Gets meta information
@@ -472,10 +691,12 @@ class PolicyHandlerInterface {
/**
* @brief Sets HMI default type for specified application
+ * @param device_handle device identifier
* @param application_id ID application
* @param app_types list of HMI types
*/
virtual void SetDefaultHmiTypes(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& application_id,
const smart_objects::SmartObject* app_types) = 0;
@@ -527,6 +748,12 @@ class PolicyHandlerInterface {
const std::string& hmi_level) = 0;
/**
+ * @brief OnPTUTimeOut the callback which is performed when PTU timeout
+ * occurred
+ */
+ virtual void OnPTUTimeOut() = 0;
+
+ /**
* Gets all allowed module types
* @param app_id unique identifier of application
* @param list of allowed module types
@@ -535,19 +762,34 @@ class PolicyHandlerInterface {
virtual bool GetModuleTypes(const std::string& policy_app_id,
std::vector<std::string>* modules) const = 0;
+ /**
+ * @brief Notifies policy manager about OnSystemRequest
+ * notification receiving
+ */
+ virtual void OnSystemRequestReceived() const = 0;
+
+ /**
+ * @brief Triggers a PolicyTableUpdate on startup (only if an update is
+ * required)
+ *
+ * Currently, this function is only implemented for regular policies
+ * since the device consent is not enabled by default for external policies.
+ */
+ virtual void TriggerPTUOnStartupIfRequired() = 0;
+
private:
/**
* @brief Processes data received via OnAppPermissionChanged notification
* from. Being started asyncronously from AppPermissionDelegate class.
* Sets updated permissions and ExternalConsent for registered applications
-*and
+ *and
* applications which already have appropriate group assigned which related to
* devices already known by policy
* @param connection_key Connection key of application, 0 if no key has been
* provided within notification
* @param external_consent_status Customer connectivity settings changes to
-*process
-*@param permissions Permissions changes to process
+ *process
+ *@param permissions Permissions changes to process
*/
#ifdef EXTERNAL_PROPRIETARY_MODE
virtual void OnAppPermissionConsentInternal(
diff --git a/src/components/include/application_manager/policies/policy_handler_observer.h b/src/components/include/application_manager/policies/policy_handler_observer.h
index 1c32102184..fc22d196df 100644
--- a/src/components/include/application_manager/policies/policy_handler_observer.h
+++ b/src/components/include/application_manager/policies/policy_handler_observer.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_HANDLER_OBSERVER_H_
#include <map>
-#include <vector>
#include <string>
+#include <vector>
namespace policy {
@@ -48,8 +48,25 @@ class PolicyHandlerObserver {
return false;
}
+ virtual void OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) {}
+
virtual void OnPTUFinished(const bool ptu_result) {}
+ virtual void OnPTInited() {}
+
+ virtual void OnPTUTimeoutExceeded() {}
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ /**
+ * @brief OnCertDecryptFinished is called when certificate decryption is
+ * finished in the external flow
+ * @param decrypt_result bool value indicating whether decryption was
+ * successful
+ */
+ virtual void OnCertDecryptFinished(const bool decrypt_result) {}
+#endif
+
virtual ~PolicyHandlerObserver() {}
};
} // namespace policy
diff --git a/src/components/include/application_manager/rpc_handler.h b/src/components/include/application_manager/rpc_handler.h
index 9b6428f32d..aafb81b853 100644
--- a/src/components/include/application_manager/rpc_handler.h
+++ b/src/components/include/application_manager/rpc_handler.h
@@ -33,25 +33,33 @@
#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_RPC_HANDLER_H
#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_RPC_HANDLER_H
-#include "protocol_handler/protocol_observer.h"
#include "hmi_message_handler/hmi_message_handler.h"
+#include "protocol_handler/protocol_observer.h"
#ifdef TELEMETRY_MONITOR
#include "application_manager/telemetry_observer.h"
+#include "telemetry_monitor/telemetry_observable.h"
#endif // TELEMETRY_MONITOR
namespace application_manager {
namespace rpc_handler {
+using ns_smart_device_link::ns_smart_objects::SMember;
+
class RPCHandler
: public hmi_message_handler::HMIMessageObserver,
public protocol_handler::ProtocolObserver
#ifdef TELEMETRY_MONITOR
- ,
+ ,
public telemetry_monitor::TelemetryObservable<AMTelemetryObserver>
#endif // TELEMETRY_MONITOR
- {
+{
public:
+ virtual bool ValidateRpcSO(smart_objects::SmartObject& message,
+ utils::SemanticVersion& msg_version,
+ rpc::ValidationReport& report_out,
+ bool allow_unknown_parameters) = 0;
+
virtual ~RPCHandler() {}
};
diff --git a/src/components/include/application_manager/rpc_service.h b/src/components/include/application_manager/rpc_service.h
index 79b4007f71..4a80733ee7 100644
--- a/src/components/include/application_manager/rpc_service.h
+++ b/src/components/include/application_manager/rpc_service.h
@@ -35,12 +35,17 @@
#include "application_manager/commands/command.h"
#include "application_manager/message.h"
-#include "protocol_handler/protocol_handler.h"
#include "hmi_message_handler/hmi_message_handler.h"
+#include "interfaces/HMI_API_schema.h"
+#include "interfaces/MOBILE_API_schema.h"
+#include "protocol_handler/protocol_handler.h"
+#include "smart_objects/object_schema_item.h"
namespace application_manager {
namespace rpc_service {
+using ns_smart_device_link::ns_smart_objects::SMember;
+
class RPCService {
public:
virtual ~RPCService() {}
@@ -58,7 +63,9 @@ class RPCService {
* @param message pointer to received message
* @return true if command is executed, otherwise return false
*/
- virtual bool ManageHMICommand(const commands::MessageSharedPtr message) = 0;
+ virtual bool ManageHMICommand(const commands::MessageSharedPtr message,
+ commands::Command::CommandSource source =
+ commands::Command::SOURCE_HMI) = 0;
/**
* @brief SendMessageToMobile Put message to the queue to be sent to mobile.
@@ -75,6 +82,31 @@ class RPCService {
virtual void SendMessageToHMI(const commands::MessageSharedPtr message) = 0;
/**
+ * @brief Check if RPC with function_id can be handled by app services(related
+ * to app services or handled by app services plugin)
+ * @param function_id RPC function id
+ * @param source RPC command source
+ * @return true if App Services can handle RPC
+ */
+ virtual bool IsAppServiceRPC(int32_t function_id,
+ commands::Command::CommandSource source) = 0;
+
+ virtual void UpdateMobileRPCParams(
+ const mobile_apis::FunctionID::eType& function_id,
+ const mobile_apis::messageType::eType& message_type,
+ const std::map<std::string, SMember>& members) = 0;
+
+ virtual void UpdateHMIRPCParams(
+ const hmi_apis::FunctionID::eType& function_id,
+ const hmi_apis::messageType::eType& message_type,
+ const std::map<std::string, SMember>& members) = 0;
+
+ /**
+ * @brief Stop RPC service by shutting down hmi and mobile message queues
+ */
+ virtual void Stop() = 0;
+
+ /**
* @brief set_protocol_handler
* @param handler
* set protocol handler
diff --git a/src/components/include/application_manager/state_controller.h b/src/components/include/application_manager/state_controller.h
index 8f608488e9..2fa4b0c218 100644
--- a/src/components/include/application_manager/state_controller.h
+++ b/src/components/include/application_manager/state_controller.h
@@ -33,58 +33,152 @@
#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_H_
#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_H_
-#include "stdint.h"
-#include "application_manager/request_controller_settings.h"
-#include "application_manager/application_manager.h"
#include "application_manager/application.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/request_controller_settings.h"
+#include "stdint.h"
namespace application_manager {
class StateController {
public:
+ /**
+ * @brief SetRegularState setup regular hmi state, that will appear if
+ * no specific events are active
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param state state of new regular state
+ * @param request_hmi_state_change: if true, ActivateAppRequest or
+ * CloseApplication will be sent to HMI dependent on hmi level of resolved hmi
+ * state
+ */
virtual void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state,
- const bool SendActivateApp) = 0;
+ const bool request_hmi_state_change) = 0;
+ /**
+ * @brief SetRegularState Change regular hmi level and audio state
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param hmi_level of new regular state
+ * @param audio_state of new regular state
+ * @paran video_state of new regular state
+ * @param request_hmi_state_change: if true, ActivateAppRequest or
+ * CloseApplication will be sent to HMI dependent on hmi level of resolved hmi
+ * state
+ */
virtual void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
- const bool SendActivateApp) = 0;
+ const bool request_hmi_state_change) = 0;
+ /**
+ * @brief SetRegularState Change regular hmi level
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param hmi_level of new regular state
+ * @param request_hmi_state_change: if true, ActivateAppRequest or
+ * CloseApplication will be sent to HMI dependent on hmi level of resolved hmi
+ * state
+ */
virtual void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
- const bool SendActivateApp) = 0;
+ const bool request_hmi_state_change) = 0;
+ /**
+ * @brief SetRegularState Change regular hmi level, audio state and system
+ * context
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param hmi_level of new regular state
+ * @param audio_state of new regular state
+ * @param video_state of new regular state
+ * @param system_context of new regular state
+ * @param request_hmi_state_change: if true, ActivateAppRequest or
+ * CloseApplication will be sent to HMI dependent on hmi level of resolved hmi
+ * state
+ */
virtual void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
- const bool SendActivateApp) = 0;
+ const bool request_hmi_state_change) = 0;
+ /**
+ * @brief SetRegularState Sets regular state with new hmi level
+ * to application
+ * @param app appication to setup regular state
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param hmi_level new hmi level for application
+ */
virtual void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level) = 0;
+ /**
+ * @brief SetRegularState Change regular audio state
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param audio_state of new regular state
+ * @param video_state of new regular state
+ */
virtual void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state) = 0;
+ /**
+ * @brief SetRegularState Change regular system context
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param system_context of new regular state
+ */
virtual void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::SystemContext::eType system_context) = 0;
- virtual void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state) = 0;
+ /**
+ * @brief SetRegularState Sets new regular state to application
+ * @param app appication to setup regular state
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param state new hmi state for application
+ */
+ virtual void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state) = 0;
+ /**
+ * @brief Sets default application state and apply currently active HMI states
+ * on application registration
+ * @param app application to apply states
+ * @param default_level default HMI level
+ */
virtual void OnApplicationRegistered(
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType default_level) = 0;
- virtual int64_t SendBCActivateApp(ApplicationConstSharedPtr app,
- hmi_apis::Common_HMILevel::eType level,
- bool send_policy_priority) = 0;
+ /**
+ * @brief OnAppWidgetAdded Sets default state for widget and apply currently
+ * active HMI states
+ * @param app application to apply states
+ * @param window_id id of window to add
+ * @param default_level default HMI level
+ */
+ virtual void OnAppWindowAdded(
+ ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType default_level) = 0;
+
/**
* @brief OnVideoStreamingStarted process video streaming started
* @param app projection or navigation application starting streaming
@@ -96,12 +190,41 @@ class StateController {
* @param app projection or navigation application stopping streaming
*/
virtual void OnVideoStreamingStopped(ApplicationConstSharedPtr app) = 0;
+
+ /**
+ * @brief OnStateChanged send HMIStatusNotification if needed
+ * @param app application
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param old_state state before change
+ * @param new_state state after change
+ */
virtual void OnStateChanged(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr old_state,
HmiStatePtr new_state) = 0;
+ /**
+ * @brief Checks activity of Deactivate HMI state.
+ * @return Returns TRUE if deactivate HMI state is active, otherwise returns
+ * FALSE.
+ */
virtual bool IsStateActive(HmiState::StateID state_id) const = 0;
+
+ /**
+ * @brief ActivateDefaultWindow performs set of actions required for a proper
+ * application activation (i.e. main window activation)
+ * @param app pointer to application to be activated
+ */
+ virtual void ActivateDefaultWindow(ApplicationSharedPtr app) = 0;
+
+ /**
+ * @brief ExitDefaultWindow performs set of action required for a proper
+ * application exiting (i.e. main window exit)
+ * @param app pointer to application to be exited
+ */
+ virtual void ExitDefaultWindow(ApplicationSharedPtr app) = 0;
};
+
} // namespace application_manager
#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_H_
diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h
index 352f886aed..e98a78f377 100644
--- a/src/components/include/connection_handler/connection_handler.h
+++ b/src/components/include/connection_handler/connection_handler.h
@@ -33,12 +33,13 @@
#ifndef SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_H_
#define SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_H_
+#include "connection_handler/connection.h"
#include "connection_handler/connection_handler_settings.h"
-#include "transport_manager/transport_manager_listener.h"
-#include "protocol_handler/session_observer.h"
#include "connection_handler/device.h"
-#include "connection_handler/connection.h"
#include "connection_handler/devices_discovery_starter.h"
+#include "protocol_handler/session_observer.h"
+#include "transport_manager/transport_manager_listener.h"
+#include "utils/data_accessor.h"
#include "utils/macro.h"
/**
@@ -51,6 +52,15 @@ enum CloseSessionReason { kCommon = 0, kFlood, kMalformed, kUnauthorizedApp };
class ConnectionHandlerObserver;
+// The SessionConnectionMap keeps track of the primary and secondary transports
+// associated with a session ID
+typedef struct {
+ transport_manager::ConnectionUID primary_transport;
+ transport_manager::ConnectionUID secondary_transport;
+ std::vector<protocol_handler::ServiceType> secondary_transport_services;
+} SessionTransports;
+typedef std::map<uint8_t, SessionTransports> SessionConnectionMap;
+
/**
* \class ConnectionHandler
* \brief SmartDeviceLink ConnectionHandler interface class
@@ -70,6 +80,16 @@ class ConnectionHandler {
connection_handler::DeviceHandle device_handle) = 0;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ virtual transport_manager::ConnectionStatus GetConnectionStatus(
+ const DeviceHandle& device_handle) const = 0;
+
+ /**
* @brief RunAppOnDevice allows to run specific application on the certain
*device.
*
@@ -83,6 +103,13 @@ class ConnectionHandler {
virtual void ConnectToAllDevices() = 0;
+ virtual void AddCloudAppDevice(
+ const std::string& policy_app_id,
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) = 0;
+
+ virtual void RemoveCloudAppDevice(const DeviceHandle device_id) = 0;
+
/**
* @brief Close the connection revoked by Policy
* @param connection_key pair of connection and session id
@@ -102,6 +129,15 @@ class ConnectionHandler {
virtual uint32_t GetConnectionSessionsCount(uint32_t connection_key) = 0;
/**
+ * @brief Get cloud app id by connection id
+ * @param connection_id unique connection id
+ * @return the policy app id of the cloud app if the connection is tied to a
+ * cloud app, an empty string otherwise.
+ */
+ virtual std::string GetCloudAppID(
+ const transport_manager::ConnectionUID connection_id) const = 0;
+
+ /**
* Gets device id by mac address
* @param mac_address
* @return true if successfully
@@ -122,12 +158,12 @@ class ConnectionHandler {
CloseSessionReason close_reason) = 0;
/**
- * @brief SendEndService allows to end up specific service.
- *
- * @param key application identifier whose service should be closed.
- *
- * @param service_type the service that should be closed.
- */
+ * @brief SendEndService allows to end up specific service.
+ *
+ * @param key application identifier whose service should be closed.
+ *
+ * @param service_type the service that should be closed.
+ */
virtual void SendEndService(uint32_t key, uint8_t service_type) = 0;
/**
@@ -152,9 +188,9 @@ class ConnectionHandler {
uint32_t timeout) = 0;
/**
- * \brief Keep connection associated with the key from being closed by
- * heartbeat monitor
- */
+ * \brief Keep connection associated with the key from being closed by
+ * heartbeat monitor
+ */
virtual void KeepConnectionAlive(uint32_t connection_key,
uint8_t session_id) = 0;
@@ -202,6 +238,43 @@ class ConnectionHandler {
virtual DevicesDiscoveryStarter& get_device_discovery_starter() = 0;
/**
+ * \brief Add a session. This is meant to be called from Connection class.
+ * \param primary_transport_id the primary connection ID to associate with the
+ * newly created session
+ * \return new session id, or 0 if failed
+ **/
+ virtual uint32_t AddSession(
+ const transport_manager::ConnectionUID primary_transport_id) = 0;
+
+ /**
+ * \brief Remove a session. This is meant to be called from Connection class.
+ * \param session_id ID of the session to remove
+ * \return true if successful, false otherwise
+ **/
+ virtual bool RemoveSession(uint8_t session_id) = 0;
+
+ virtual DataAccessor<SessionConnectionMap> session_connection_map() = 0;
+
+ /**
+ * \brief Associate a secondary transport ID with a session
+ * \param session_id the session ID
+ * \param connection_id the new secondary connection ID to associate with the
+ * session
+ * \return the SessionTransports (newly) associated with the session
+ **/
+ virtual SessionTransports SetSecondaryTransportID(
+ uint8_t session_id,
+ transport_manager::ConnectionUID secondary_transport_id) = 0;
+
+ /**
+ * \brief Retrieve the session transports associated with a session
+ * \param session_id the session ID
+ * \return the SessionTransports associated with the session
+ **/
+ virtual const SessionTransports GetSessionTransports(
+ uint8_t session_id) const = 0;
+
+ /**
* \brief Invoked when observer's OnServiceStartedCallback is completed
* \param session_key the key of started session passed to
* OnServiceStartedCallback().
@@ -217,6 +290,41 @@ class ConnectionHandler {
bool result,
std::vector<std::string>& rejected_params) = 0;
+ /**
+ * \brief Called when secondary transport with given session ID is established
+ * \param primary_connection_handle Set to identifier of primary connection
+ * \param secondary_connection_handle Identifier of secondary connection
+ * \param session_id session ID taken from Register Secondary Transport frame
+ * \return true if successful
+ **/
+ virtual bool OnSecondaryTransportStarted(
+ transport_manager::ConnectionUID& primary_connection_handle,
+ const transport_manager::ConnectionUID secondary_connection_handle,
+ const uint8_t session_id) = 0;
+
+ /**
+ * \brief Called when secondary transport shuts down
+ * \param primary_connection_handle Identifier of primary connection
+ * \param secondary_connection_handle Identifier of secondary connection
+ * transport
+ **/
+ virtual void OnSecondaryTransportEnded(
+ const transport_manager::ConnectionUID primary_connection_handle,
+ const transport_manager::ConnectionUID secondary_connection_handle) = 0;
+
+ /**
+ * @brief GetWebEngineDeviceInfo
+ * @return device info for WebEngine device
+ */
+ virtual const transport_manager::DeviceInfo& GetWebEngineDeviceInfo()
+ const = 0;
+
+ /**
+ * @brief Called when HMI cooperation is started,
+ * creates WebSocketDevice for WebEngine
+ */
+ virtual void CreateWebEngineDevice() = 0;
+
protected:
/**
* \brief Destructor
diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h
index b4c04c17c9..7d6664a009 100644
--- a/src/components/include/connection_handler/connection_handler_observer.h
+++ b/src/components/include/connection_handler/connection_handler_observer.h
@@ -34,9 +34,9 @@
#define SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_OBSERVER_H_
#include <string>
-#include "connection_handler/device.h"
#include "connection_handler/connection.h"
#include "connection_handler/connection_handler.h"
+#include "connection_handler/device.h"
#include "protocol/service_type.h"
#ifdef ENABLE_SECURITY
@@ -86,19 +86,6 @@ class ConnectionHandlerObserver {
/**
* \brief Callback function used by connection_handler
* when Mobile Application initiates start of new service.
- * \param deviceHandle Device identifier within which session has to be
- * started.
- * \param sessionKey Key of started session.
- * \param type Established service type
- */
- virtual bool OnServiceStartedCallback(
- const connection_handler::DeviceHandle& device_handle,
- const int32_t& session_key,
- const protocol_handler::ServiceType& type) = 0;
-
- /**
- * \brief Callback function used by connection_handler
- * when Mobile Application initiates start of new service.
* Result must be notified through NotifyServiceStartedResult().
* \param deviceHandle Device identifier within which session has to be
* started.
@@ -157,6 +144,39 @@ class ConnectionHandlerObserver {
virtual security_manager::SSLContext::HandshakeContext GetHandshakeContext(
uint32_t key) const = 0;
#endif // ENABLE_SECURITY
+
+ /**
+ * \brief Called when secondary transport for a particular app is started.
+ * \param device_handle Device identifier on which the secondary transport is
+ * started.
+ * \param session_key session ID representing the app
+ */
+ virtual void OnSecondaryTransportStartedCallback(
+ const connection_handler::DeviceHandle device_handle,
+ const int32_t session_key) = 0;
+
+ /**
+ * \brief Called when secondary transport for a particular app is terminated.
+ * \param session_key session ID representing the app
+ */
+ virtual void OnSecondaryTransportEndedCallback(const int32_t session_key) = 0;
+
+ virtual void OnConnectionStatusUpdated() = 0;
+
+ virtual void CreatePendingApplication(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info,
+ connection_handler::DeviceHandle device_id) = 0;
+
+ virtual void SetPendingApplicationState(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info) = 0;
+
+ /**
+ *@brief Called when webengine device added
+ */
+ virtual void OnWebEngineDeviceCreated() = 0;
+
protected:
/**
* \brief Destructor
diff --git a/src/components/include/hmi_message_handler/hmi_message_adapter.h b/src/components/include/hmi_message_handler/hmi_message_adapter.h
index 704cc619be..af8cddcf32 100644
--- a/src/components/include/hmi_message_handler/hmi_message_adapter.h
+++ b/src/components/include/hmi_message_handler/hmi_message_adapter.h
@@ -53,7 +53,7 @@ class HMIMessageAdapter : public HMIMessageSender {
/**
* \brief Interface for subscriptions.
* Each class implementing interface should use it according to
- * standarts of transport for which it is to be an adapter.
+ * standards of transport for which it is to be an adapter.
* For example, Adapter for MessageBroker will use it to subscribe to
* notifications
* from HMI.
diff --git a/src/components/include/hmi_message_handler/hmi_message_handler.h b/src/components/include/hmi_message_handler/hmi_message_handler.h
index 411d19fb75..0bcc38d380 100644
--- a/src/components/include/hmi_message_handler/hmi_message_handler.h
+++ b/src/components/include/hmi_message_handler/hmi_message_handler.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_HANDLER_H_
#define SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_HANDLER_H_
-#include "hmi_message_handler/hmi_message_sender.h"
-#include "hmi_message_handler/hmi_message_observer.h"
#include "hmi_message_handler/hmi_message_handler_settings.h"
+#include "hmi_message_handler/hmi_message_observer.h"
+#include "hmi_message_handler/hmi_message_sender.h"
namespace hmi_message_handler {
diff --git a/src/components/include/hmi_message_handler/hmi_message_observer.h b/src/components/include/hmi_message_handler/hmi_message_observer.h
index 0676615b53..5c104312f7 100644
--- a/src/components/include/hmi_message_handler/hmi_message_observer.h
+++ b/src/components/include/hmi_message_handler/hmi_message_observer.h
@@ -33,8 +33,6 @@
#ifndef SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_OBSERVER_H_
#define SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_OBSERVER_H_
-#include "utils/shared_ptr.h"
-
namespace application_manager {
class Message;
}
@@ -45,10 +43,10 @@ class HMIMessageObserver {
public:
virtual ~HMIMessageObserver() {}
virtual void OnMessageReceived(
- utils::SharedPtr<application_manager::Message> message) = 0;
+ std::shared_ptr<application_manager::Message> message) = 0;
virtual void OnErrorSending(
- utils::SharedPtr<application_manager::Message> message) = 0;
+ std::shared_ptr<application_manager::Message> message) = 0;
};
-}
+} // namespace hmi_message_handler
#endif // SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_OBSERVER_H_
diff --git a/src/components/include/hmi_message_handler/hmi_message_sender.h b/src/components/include/hmi_message_handler/hmi_message_sender.h
index 91c20a1986..c4183f0838 100644
--- a/src/components/include/hmi_message_handler/hmi_message_sender.h
+++ b/src/components/include/hmi_message_handler/hmi_message_sender.h
@@ -36,13 +36,13 @@
#include "application_manager/message.h"
namespace hmi_message_handler {
-typedef utils::SharedPtr<application_manager::Message> MessageSharedPointer;
+typedef std::shared_ptr<application_manager::Message> MessageSharedPointer;
class HMIMessageSender {
public:
virtual ~HMIMessageSender() {}
virtual void SendMessageToHMI(MessageSharedPointer message) = 0;
};
-}
+} // namespace hmi_message_handler
#endif // SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_SENDER_H_
diff --git a/src/components/include/media_manager/media_manager.h b/src/components/include/media_manager/media_manager.h
index 64acbcbc0b..123e11f2f0 100644
--- a/src/components/include/media_manager/media_manager.h
+++ b/src/components/include/media_manager/media_manager.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_INCLUDE_MEDIA_MANAGER_MEDIA_MANAGER_H_
#include <string>
-#include "protocol/service_type.h"
#include "media_manager/media_manager_settings.h"
+#include "protocol/service_type.h"
namespace media_manager {
class MediaManager {
@@ -60,6 +60,14 @@ class MediaManager {
*/
virtual const MediaManagerSettings& settings() const = 0;
+ /**
+ * \brief Convert an amount of audio bytes to an estimated time in ms
+ * \param data_size number of bytes to be played
+ * \return milliseconds required to play <data_size> many bytes with
+ * the current pcm stream capabilities
+ */
+ virtual uint32_t DataSizeToMilliseconds(uint64_t data_size) const = 0;
+
virtual ~MediaManager() {}
};
diff --git a/src/components/include/media_manager/media_manager_settings.h b/src/components/include/media_manager/media_manager_settings.h
index e48a74b08d..183a7e6f5b 100644
--- a/src/components/include/media_manager/media_manager_settings.h
+++ b/src/components/include/media_manager/media_manager_settings.h
@@ -32,8 +32,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_MEDIA_MANAGER_MEDIA_MANAGER_SETTINGS_H_
#define SRC_COMPONENTS_INCLUDE_MEDIA_MANAGER_MEDIA_MANAGER_SETTINGS_H_
-#include <string>
#include <stdint.h>
+#include <string>
namespace media_manager {
diff --git a/src/components/include/policy/policy_external/policy/policy_listener.h b/src/components/include/policy/policy_external/policy/policy_listener.h
index c023f3c7fc..0ad695f2c0 100644
--- a/src/components/include/policy/policy_external/policy/policy_listener.h
+++ b/src/components/include/policy/policy_external/policy/policy_listener.h
@@ -42,26 +42,24 @@ namespace policy {
namespace custom_str = utils::custom_string;
+class PTURetryHandler;
+
class PolicyListener {
public:
virtual ~PolicyListener() {}
- virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ virtual void OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions,
const policy::HMILevel& default_hmi) = 0;
- virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ virtual void OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions) = 0;
- virtual void OnPendingPermissionChange(const std::string& policy_app_id) = 0;
+ virtual void OnPendingPermissionChange(const std::string& device_id,
+ const std::string& policy_app_id) = 0;
virtual void OnUpdateStatusChanged(const std::string&) = 0;
-
- /**
- * Gets device ID
- * @param policy_app_id
- * @return device ID
- * @deprecated see std::vector<std::string> GetDevicesIds(const std::string&)
- */
virtual std::string OnCurrentDeviceIdUpdateRequired(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) = 0;
- virtual void OnSystemInfoUpdateRequired() = 0;
virtual custom_str::CustomString GetAppName(
const std::string& policy_app_id) = 0;
virtual void OnUpdateHMIAppType(
@@ -102,10 +100,20 @@ class PolicyListener {
/**
* @brief Sends OnAppPermissionsChanged notification to HMI
* @param permissions contains parameter for OnAppPermisionChanged
+ * @param device_id device identifier
* @param policy_app_id contains policy application id
*/
virtual void SendOnAppPermissionsChanged(
const AppPermissions& permissions,
+ const std::string& device_id,
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Send OnAppPropertiesChangeNotification to the HMI
+ * @param policy_app_id policy app id
+ */
+
+ virtual void SendOnAppPropertiesChangeNotification(
const std::string& policy_app_id) const = 0;
/**
@@ -122,6 +130,16 @@ class PolicyListener {
virtual void OnCertificateUpdated(const std::string& certificate_data) = 0;
/**
+ * @brief OnAuthTokenUpdated the callback which signals if an app's auth token
+ * field has been updated during a PTU
+ *
+ * @param policy_app_id the policy app id tied to the updated field.
+ * @param auth_token the value of the updated field.
+ */
+ virtual void OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
* @brief OnPTUFinishedd the callback which signals PTU has finished
*
* @param ptu_result the result from the PTU - true if successful,
@@ -143,7 +161,7 @@ class PolicyListener {
* @return list devices ids
*/
virtual std::vector<std::string> GetDevicesIds(
- const std::string& policy_app_id) = 0;
+ const std::string& policy_app_id) const = 0;
/**
* Notifies about changing HMI level
@@ -172,6 +190,14 @@ class PolicyListener {
virtual void OnUpdateHMIStatus(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level) = 0;
+
+ /**
+ * @brief Notify Connected mobile apps about changing state of
+ * LockScreenDismissal
+ */
+ virtual void OnLockScreenDismissalStateChanged() = 0;
+
+ virtual PTURetryHandler& ptu_retry_handler() const = 0;
};
} // namespace policy
#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_LISTENER_H_
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
index 83038472cd..02810038c3 100644
--- a/src/components/include/policy/policy_external/policy/policy_manager.h
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -36,25 +36,33 @@
#include <vector>
#include "utils/callable.h"
+#include "utils/optional.h"
-#include "policy/policy_types.h"
-#include "policy/policy_table/types.h"
+#include "application_manager/policies/policy_encryption_flag_getter.h"
+#include "policy/access_remote.h"
+#include "policy/cache_manager_interface.h"
#include "policy/policy_listener.h"
+#include "policy/policy_table/types.h"
+#include "policy/policy_types.h"
+#include "policy/ptu_retry_handler.h"
#include "policy/usage_statistics/statistics_manager.h"
-#include "policy/cache_manager_interface.h"
-#include "policy/access_remote.h"
namespace policy {
class PolicySettings;
-typedef utils::SharedPtr<utils::Callable> StatusNotifier;
+typedef std::shared_ptr<utils::Callable> StatusNotifier;
-class PolicyManager : public usage_statistics::StatisticsManager {
+class PolicyManager : public usage_statistics::StatisticsManager,
+ public PolicyEncryptionFlagGetterInterface,
+ public PTURetryHandler {
public:
/**
* @brief The NotificationMode enum defines whether application will be
* notified about changes done (e.g. after consents were changed) or not
*/
enum NotificationMode { kSilentMode, kNotifyApplicationMode };
+
+ enum PtProcessingResult { kSuccess, kWrongPtReceived, kNewPtRequired };
+
virtual ~PolicyManager() {}
/**
@@ -78,10 +86,16 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* sent in snapshot and received Policy Table.
* @param file name of file with update policy table
* @param pt_content PTU as binary string
- * @return true if successfully
+ * @return result of PT processing
*/
- virtual bool LoadPT(const std::string& file,
- const BinaryMessage& pt_content) = 0;
+ virtual PtProcessingResult LoadPT(const std::string& file,
+ const BinaryMessage& pt_content) = 0;
+
+ /**
+ * @brief Performs finalizing actions after PT update was processed
+ * @param ptu_result result of last PT processing
+ */
+ virtual void OnPTUFinished(const PtProcessingResult ptu_result) = 0;
/**
* @brief Resets Policy Table
@@ -103,16 +117,18 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @return vector of urls
*/
virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- * @return url which point to the resourse where lock screen icon could be
+ * @brief Get Icon Url used for showing a cloud apps icon before the initial
+ *registration
+ *
+ * @return url which point to the resource where icon could be
*obtained.
*/
- virtual std::string GetLockScreenIconUrl() const = 0;
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
/**
* @brief PTU is needed, for this PTS has to be formed and sent.
@@ -123,6 +139,7 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @brief Check if specified RPC for specified application
* has permission to be executed in specified HMI Level
* and also its permitted params.
+ * @param device_id device identifier
* @param app_id Id of application provided during registration
* @param hmi_level Current HMI Level of application
* @param rpc Name of RPC
@@ -130,7 +147,8 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @param CheckPermissionResult containing flag if HMI Level is allowed
* and list of allowed params.
*/
- virtual void CheckPermissions(const PTString& app_id,
+ virtual void CheckPermissions(const PTString& device_id,
+ const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
const RPCParams& rpc_params,
@@ -156,6 +174,24 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual void KmsChanged(int kilometers) = 0;
/**
+ * @brief Returns state of the lock screen that could be able to be dismissed
+ * while connected to SDL, allowing users the ability to interact with the
+ * app.
+ * @return bool True if lock screen can be dismissed.
+ */
+ virtual const boost::optional<bool> LockScreenDismissalEnabledState()
+ const = 0;
+
+ /**
+ * @brief Returns lock screen warning message. In case when specified language
+ * is absent in policy table will be returned message on default language
+ * ("en-us"). Otherwise returns uninitialized boost::optional<std::string>
+ * @return std::string Lock screen warning message
+ */
+ virtual const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const = 0;
+
+ /**
* @brief Increments counter of ignition cycles
*/
virtual void IncrementIgnitionCycles() = 0;
@@ -167,6 +203,11 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual std::string ForcePTExchange() = 0;
/**
+ * @brief Stops retry sequence timer and resets retry sequence
+ */
+ virtual void StopRetrySequence() = 0;
+
+ /**
* @brief Exchange by user request
* @return Current status of policy table
*/
@@ -174,8 +215,9 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Resets retry sequence
+ * @param reset_type - reset retry count with sending OnStatusUpdate or not
*/
- virtual void ResetRetrySequence() = 0;
+ virtual void ResetRetrySequence(const ResetRetryCountType reset_type) = 0;
/**
* @brief Gets timeout to wait before next retry updating PT
@@ -237,12 +279,15 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Update Application Policies as reaction
* on User allowing/disallowing device this app is running on.
+ * @param device_handle device identifier
* @param app_id Unique application id
* @param is_device_allowed true if user allowing device otherwise false
* @return true if operation was successful
*/
- virtual bool ReactOnUserDevConsentForApp(const std::string& app_id,
- const bool is_device_allowed) = 0;
+ virtual bool ReactOnUserDevConsentForApp(
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string& app_id,
+ const bool is_device_allowed) = 0;
/**
* @brief Sets counter value that passed for receiving PT UPdate.
@@ -290,12 +335,14 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Get default HMI level for application
+ * @param device_id device identifier
* @param policy_app_id Unique application id
* @param default_hmi Default HMI level for application or empty, if value
* was not set
* @return true, if succedeed, otherwise - false
*/
- virtual bool GetDefaultHmi(const std::string& policy_app_id,
+ virtual bool GetDefaultHmi(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi) const = 0;
/**
@@ -341,11 +388,12 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Gets specific application permissions changes since last policy
* table update
+ * @param device_id device identifier
* @param policy_app_id Unique application id
* @return Permissions changes
*/
virtual AppPermissions GetAppPermissionsChanges(
- const std::string& policy_app_id) = 0;
+ const std::string& device_id, const std::string& policy_app_id) = 0;
/**
* @brief Removes specific application permissions changes
@@ -355,9 +403,11 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Return device id, which hosts specific application
+ * @param device_handle device identifier
* @param policy_app_id Application id, which is required to update device id
*/
virtual std::string& GetCurrentDeviceId(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) const = 0;
/**
@@ -378,10 +428,11 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Send OnPermissionsUpdated for choosen application
+ * @param device_id device identifier
* @param application_id Unique application id
*/
virtual void SendNotificationOnPermissionsUpdated(
- const std::string& application_id) = 0;
+ const std::string& device_id, const std::string& application_id) = 0;
/**
* @brief Marks device as upaired
@@ -392,11 +443,13 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Adds, application to the db or update existed one
* run PTU if policy update is necessary for application.
+ * @param device_id device identifier
* @param application_id Unique application id
* @param hmi_types application HMI types
* @return function that will notify update manager about new application
*/
virtual StatusNotifier AddApplication(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) = 0;
@@ -421,13 +474,6 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual bool CanAppStealFocus(const std::string& app_id) const = 0;
/**
- * @brief Runs necessary operations, which is depends on external system
- * state, e.g. getting system-specific parameters which are need to be
- * filled into policy table
- */
- virtual void OnSystemReady() = 0;
-
- /**
* @brief Get number of notification by priority
* @param priority Specified priority
* @return notification number
@@ -474,12 +520,21 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0;
/**
+ * @brief Change applications count ready for PTU
+ * @param new_app_count new applications count for PTU
+ */
+ virtual void UpdatePTUReadyAppsCount(const uint32_t new_app_count) = 0;
+
+ /**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
* succesfully registered on mobile device.
- * It will send OnAppPermissionSend notification and will try to start PTU. *
+ * It will send OnAppPermissionSend notification and will try to start PTU.
+ *
+ * @param device_id device identifier
* @param application_id registered application.
*/
- virtual void OnAppRegisteredOnMobile(const std::string& application_id) = 0;
+ virtual void OnAppRegisteredOnMobile(const std::string& device_id,
+ const std::string& application_id) = 0;
virtual void OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) = 0;
@@ -502,25 +557,142 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Gets request types for application
+ * @param device_handle device identifier
* @param policy_app_id Unique application id
* @return request types of application
*/
virtual const std::vector<std::string> GetAppRequestTypes(
+ const transport_manager::DeviceHandle& device_handle,
const std::string policy_app_id) const = 0;
/**
- * @brief Gets request subtypes for application
- * @param policy_app_id Unique application id
- * @return request subtypes of application
- */
+ * @brief Gets request subtypes for application
+ * @param policy_app_id Unique application id
+ * @return request subtypes of application
+ */
virtual const std::vector<std::string> GetAppRequestSubTypes(
const std::string& policy_app_id) const = 0;
/**
- * @brief Get information about vehicle
- * @return vehicle information
+ * @brief Gets vehicle data items
+ * @return Structure with vehicle data items
+ */
+ virtual const std::vector<policy_table::VehicleDataItem> GetVehicleDataItems()
+ const = 0;
+
+ /**
+ * @brief Gets vehicle data items removed by policies
+ * @return Structure with vehicle data items
+ */
+ virtual std::vector<rpc::policy_table_interface_base::VehicleDataItem>
+ GetRemovedVehicleDataItems() const = 0;
+
+ /**
+ * @brief Gets copy of current policy table data
+ * @return policy_table as json object
+ */
+ virtual Json::Value GetPolicyTableData() const = 0;
+
+ /**
+ * @brief Get a list of policy app ids
+ * @return apps list filled with the policy app ids of each
+ * application
+ */
+ virtual const std::vector<std::string> GetApplicationPolicyIDs() const = 0;
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
+ * @brief Get app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id policy app id
+ * @param out_app_properties application properties
+ * @return true if application presents in database, otherwise - false
*/
- virtual const VehicleInfo GetVehicleInfo() const = 0;
+ virtual bool GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const = 0;
+
+ /**
+ * @brief Get a list of enabled local applications
+ * @return enabled_apps List filled with the policy app id of each enabled
+ * local application
+ */
+ virtual std::vector<std::string> GetEnabledLocalApps() const = 0;
+
+ /**
+ * @ brief Initialize new cloud app in the policy table
+ * @ param policy_app_id Application ID
+ */
+ virtual void InitCloudApp(const std::string& policy_app_id) = 0;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) = 0;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) = 0;
+
+ /**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 0;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const = 0;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const = 0;
/**
* @brief Gets meta information
@@ -555,20 +727,24 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual const PolicySettings& get_settings() const = 0;
/**
+ * @deprecated Unused in EXTERNAL_PROPRIETARY policies
* @brief Finds the next URL that must be sent on OnSystemRequest retry
* @param urls vector of vectors that contain urls for each application
* @return Pair of policy application id and application url id from the
* urls vector
*/
- virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0;
+ DEPRECATED virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0;
/**
* @brief Assigns new HMI types for specified application
+ * @param device_handle device identifier
* @param application_id Unique application id
* @param hmi_types new HMI types list
*/
- virtual void SetDefaultHmiTypes(const std::string& application_id,
- const std::vector<int>& hmi_types) = 0;
+ virtual void SetDefaultHmiTypes(
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string& application_id,
+ const std::vector<int>& hmi_types) = 0;
/**
* @brief Gets HMI types
* @param application_id ID application
@@ -594,13 +770,19 @@ class PolicyManager : public usage_statistics::StatisticsManager {
*/
virtual void SendAppPermissionsChanged(const std::string& device_id,
const std::string& application_id) = 0;
+ /**
+ * @brief Send OnAppPropertiesChangeNotification to the HMI
+ * @param policy_app_id policy app id
+ */
+ virtual void SendOnAppPropertiesChangeNotification(
+ const std::string& policy_app_id) const = 0;
/**
- * @brief Gets all allowed module types
- * @param policy_app_id unique identifier of application
- * @param modules list of allowed module types
- * @return true if application has allowed modules
- */
+ * @brief Gets all allowed module types
+ * @param policy_app_id unique identifier of application
+ * @param modules list of allowed module types
+ * @return true if application has allowed modules
+ */
virtual bool GetModuleTypes(const std::string& policy_app_id,
std::vector<std::string>* modules) const = 0;
@@ -609,7 +791,7 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @param access_remote pointer to new access_remote instance
*/
virtual void set_access_remote(
- utils::SharedPtr<AccessRemote> access_remote) = 0;
+ std::shared_ptr<AccessRemote> access_remote) = 0;
/**
* @brief Checks if there is existing URL in the EndpointUrls vector with
@@ -646,6 +828,23 @@ class PolicyManager : public usage_statistics::StatisticsManager {
*/
virtual ExternalConsentStatus GetExternalConsentStatus() = 0;
+ /**
+ * @brief OnLocalAppAdded triggers PTU
+ */
+ virtual void OnLocalAppAdded() = 0;
+
+ /**
+ * @brief Check if certain application already in policy db.
+ * @param policy application id.
+ * @return true if application presents false otherwise.
+ */
+ virtual bool IsNewApplication(const std::string& application_id) const = 0;
+
+ /**
+ * @brief Restart PTU timeout if PTU in UPDATING state
+ */
+ virtual void ResetTimeout() = 0;
+
protected:
/**
* @brief Checks is PT exceeded IgnitionCycles
diff --git a/src/components/include/policy/policy_external/policy/policy_settings.h b/src/components/include/policy/policy_external/policy/policy_settings.h
index def9fca05a..d9d2493d10 100644
--- a/src/components/include/policy/policy_external/policy/policy_settings.h
+++ b/src/components/include/policy/policy_external/policy/policy_settings.h
@@ -1,7 +1,7 @@
#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_SETTINGS_H_
#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_SETTINGS_H_
-#include <string>
#include <stdint.h>
+#include <string>
namespace policy {
class PolicySettings {
@@ -17,8 +17,8 @@ class PolicySettings {
virtual const std::string& preloaded_pt_file() const = 0;
/**
- * @brief Returns application storage path
- */
+ * @brief Returns application storage path
+ */
virtual const std::string& app_storage_folder() const = 0;
virtual uint16_t attempts_to_open_policy_db() const = 0;
@@ -31,9 +31,11 @@ class PolicySettings {
*/
virtual const std::string& policies_snapshot_file_name() const = 0;
+ virtual bool use_full_app_id() const = 0;
+
/**
- * @brief Returns system files folder path
- */
+ * @brief Returns system files folder path
+ */
virtual const std::string& system_files_path() const = 0;
virtual ~PolicySettings() {}
diff --git a/src/components/include/policy/policy_regular/policy/policy_listener.h b/src/components/include/policy/policy_regular/policy/policy_listener.h
index 3f6f555bcc..729eda0a95 100644
--- a/src/components/include/policy/policy_regular/policy/policy_listener.h
+++ b/src/components/include/policy/policy_regular/policy/policy_listener.h
@@ -45,28 +45,31 @@ namespace custom_str = utils::custom_string;
class PolicyListener {
public:
virtual ~PolicyListener() {}
- virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ virtual void OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions,
const policy::HMILevel& default_hmi) = 0;
- virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ virtual void OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions) = 0;
- virtual void OnPendingPermissionChange(const std::string& policy_app_id) = 0;
+ virtual void OnPendingPermissionChange(const std::string& device_id,
+ const std::string& policy_app_id) = 0;
virtual void OnUpdateStatusChanged(const std::string&) = 0;
virtual std::string OnCurrentDeviceIdUpdateRequired(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) = 0;
- virtual void OnSystemInfoUpdateRequired() = 0;
virtual custom_str::CustomString GetAppName(
const std::string& policy_app_id) = 0;
virtual void OnUpdateHMIAppType(
std::map<std::string, StringArray> app_hmi_types) = 0;
/**
- * @brief CanUpdate allows to find active application
- * and check whether related device consented.
- *
- * @return true if there are at least one application has been registered
- * with consented device.
- */
+ * @brief CanUpdate allows to find active application
+ * and check whether related device consented.
+ *
+ * @return true if there are at least one application has been registered
+ * with consented device.
+ */
virtual bool CanUpdate() = 0;
/**
@@ -75,11 +78,13 @@ class PolicyListener {
*
* @param pt_string the snapshot
*
- * @param retry_seconds retry sequence timeouts.
+ * @param iteration_type flag indicating whether PTU was caused by retry
+ * sequence.
*
* @param timeout_exceed timeout.
*/
- virtual void OnSnapshotCreated(const BinaryMessage& pt_string) = 0;
+ virtual void OnSnapshotCreated(const BinaryMessage& pt_string,
+ const PTUIterationType iteration_type) = 0;
/**
* @brief Make appropriate changes for related applications permissions and
@@ -93,10 +98,19 @@ class PolicyListener {
/**
* @brief Sends OnAppPermissionsChanged notification to HMI
* @param permissions contains parameter for OnAppPermisionChanged
+ * @param device_id device identifier
* @param policy_app_id contains policy application id
*/
virtual void SendOnAppPermissionsChanged(
const AppPermissions& permissions,
+ const std::string& device_id,
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Send OnAppPropertiesChangeNotification to the HMI
+ * @param policy_app_id policy app id
+ */
+ virtual void SendOnAppPropertiesChangeNotification(
const std::string& policy_app_id) const = 0;
/**
@@ -113,12 +127,28 @@ class PolicyListener {
virtual void OnCertificateUpdated(const std::string& certificate_data) = 0;
/**
+ * @brief OnPTUTimeOut the callback which is performed when PTU timeout
+ * occurred
+ */
+ virtual void OnPTUTimeOut() = 0;
+
+ /**
+ * @brief OnAuthTokenUpdated the callback which signals if an app's auth token
+ * field has been updated during a PTU
+ *
+ * @param policy_app_id the policy app id tied to the updated field.
+ * @param auth_token the value of the updated field.
+ */
+ virtual void OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
* Gets devices ids by policy application id
* @param policy_app_id
* @return list devices ids
*/
virtual std::vector<std::string> GetDevicesIds(
- const std::string& policy_app_id) = 0;
+ const std::string& policy_app_id) const = 0;
/**
* Notifies about changing HMI level
@@ -147,6 +177,12 @@ class PolicyListener {
virtual void OnUpdateHMIStatus(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level) = 0;
+
+ /**
+ * @brief Notify Connected mobile apps about changing state
+ * LockScreenDismissal
+ */
+ virtual void OnLockScreenDismissalStateChanged() = 0;
};
} // namespace policy
#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_LISTENER_H_
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
index bd29b2942e..99f38673ef 100644
--- a/src/components/include/policy/policy_regular/policy/policy_manager.h
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -33,23 +33,28 @@
#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_
#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_
-#include <vector>
#include <cstdint>
+#include <vector>
+#include "boost/optional.hpp"
-#include "utils/callable.h"
-#include "policy/policy_types.h"
-#include "policy/policy_table/types.h"
+#include "policy/access_remote.h"
+#include "policy/cache_manager_interface.h"
#include "policy/policy_listener.h"
+#include "policy/policy_table/types.h"
+#include "policy/policy_types.h"
#include "policy/usage_statistics/statistics_manager.h"
-#include "policy/cache_manager_interface.h"
-#include "policy/access_remote.h"
+#include "utils/callable.h"
+#include "utils/optional.h"
namespace policy {
class PolicySettings;
-typedef utils::SharedPtr<utils::Callable> StatusNotifier;
+typedef std::shared_ptr<utils::Callable> StatusNotifier;
-class PolicyManager : public usage_statistics::StatisticsManager {
+class PolicyManager : public usage_statistics::StatisticsManager,
+ public PolicyEncryptionFlagGetterInterface {
public:
+ enum PtProcessingResult { kSuccess, kWrongPtReceived, kNewPtRequired };
+
virtual ~PolicyManager() {}
/**
@@ -73,10 +78,16 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* sent in snapshot and received Policy Table.
* @param file name of file with update policy table
* @param pt_content PTU as binary string
- * @return true if successfully
+ * @return result of PT processing
*/
- virtual bool LoadPT(const std::string& file,
- const BinaryMessage& pt_content) = 0;
+ virtual PtProcessingResult LoadPT(const std::string& file,
+ const BinaryMessage& pt_content) = 0;
+
+ /**
+ * @brief Performs finalizing actions after PT update was processed
+ * @param ptu_result result of last PT processing
+ */
+ virtual void OnPTUFinished(const PtProcessingResult ptu_result) = 0;
/**
* @brief Resets Policy Table
@@ -86,11 +97,13 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual bool ResetPT(const std::string& file_name) = 0;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- * @return url which point to the resourse where lock screen icon could be
+ * @brief Get Icon Url used for showing a cloud apps icon before the initial
+ *registration
+ *
+ * @return url which point to the resource where icon could be
*obtained.
*/
- virtual std::string GetLockScreenIconUrl() const = 0;
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
/**
* @brief Gets all URLs for sending PTS to from PT itself.
@@ -98,14 +111,14 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @param out_end_points output vector of urls
*/
virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
/**
* @brief PTU is needed, for this PTS has to be formed and sent.
*/
- virtual bool RequestPTUpdate() = 0;
+ virtual bool RequestPTUpdate(const PTUIterationType iteration_type) = 0;
/**
* @brief Check if specified RPC for specified application
@@ -156,6 +169,23 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual void KmsChanged(int kilometers) = 0;
/**
+ * @brief Returns state of the lock screen that could be able to be dismissed
+ * while connected to SDL, allowing users the ability to interact with the
+ * app.
+ * @return bool True if lock screen can be dismissed.
+ */
+ virtual const boost::optional<bool> LockScreenDismissalEnabledState()
+ const = 0;
+
+ /**
+ * @brief Returns lock screen warning message
+ * @param language_code Specific language for which need message
+ * @return std::string Lock screen warning message
+ */
+ virtual const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const = 0;
+
+ /**
* @brief Increments counter of ignition cycles
*/
virtual void IncrementIgnitionCycles() = 0;
@@ -173,6 +203,18 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual std::string ForcePTExchangeAtUserRequest() = 0;
/**
+ * @brief Stops retry sequence timer and resets retry sequence
+ */
+ virtual void StopRetrySequence() = 0;
+
+ /**
+ * @brief Resets retry sequence
+ * @param send_event - if true corresponding event is sent to
+ * UpdateStatusManager
+ */
+ virtual void ResetRetrySequence(const ResetRetryCountType reset_type) = 0;
+
+ /**
* @brief Gets timeout to wait before next retry updating PT
* If timeout is less or equal to zero then the retry sequence is not need.
* @return timeout in seconds
@@ -232,12 +274,15 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Update Application Policies as reaction
* on User allowing/disallowing device this app is running on.
+ * @param device_handle device identifier
* @param app_id Unique application id
* @param is_device_allowed true if user allowing device otherwise false
* @return true if operation was successful
*/
- virtual bool ReactOnUserDevConsentForApp(const std::string app_id,
- bool is_device_allowed) = 0;
+ virtual bool ReactOnUserDevConsentForApp(
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string app_id,
+ bool is_device_allowed) = 0;
/**
* @brief Sets counter value that passed for receiving PT UPdate.
@@ -283,12 +328,14 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Get default HMI level for application
+ * @param device_id device identifier
* @param policy_app_id Unique application id
* @param default_hmi Default HMI level for application or empty, if value
* was not set
* @return true, if succedeed, otherwise - false
*/
- virtual bool GetDefaultHmi(const std::string& policy_app_id,
+ virtual bool GetDefaultHmi(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi) const = 0;
/**
@@ -332,11 +379,12 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Gets specific application permissions changes since last policy
* table update
+ * @param device_id device identifier
* @param policy_app_id Unique application id
* @return Permissions changes
*/
virtual AppPermissions GetAppPermissionsChanges(
- const std::string& policy_app_id) = 0;
+ const std::string& device_id, const std::string& policy_app_id) = 0;
/**
* @brief Removes specific application permissions changes
@@ -346,9 +394,11 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Return device id, which hosts specific application
+ * @param device_handle device identifier
* @param policy_app_id Application id, which is required to update device id
*/
virtual std::string& GetCurrentDeviceId(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) const = 0;
/**
@@ -369,10 +419,11 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Send OnPermissionsUpdated for choosen application
+ * @param device_id device identifier
* @param application_id Unique application id
*/
virtual void SendNotificationOnPermissionsUpdated(
- const std::string& application_id) = 0;
+ const std::string& device_id, const std::string& application_id) = 0;
/**
* @brief Marks device as upaired
@@ -383,11 +434,13 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Adds, application to the db or update existed one
* run PTU if policy update is necessary for application.
+ * @param device_id device identifier
* @param application_id Unique application id
* @param hmi_types application HMI types
* @return function that will notify update manager about new application
*/
virtual StatusNotifier AddApplication(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) = 0;
@@ -412,13 +465,6 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual bool CanAppStealFocus(const std::string& app_id) const = 0;
/**
- * @brief Runs necessary operations, which is depends on external system
- * state, e.g. getting system-specific parameters which are need to be
- * filled into policy table
- */
- virtual void OnSystemReady() = 0;
-
- /**
* @brief Get number of notification by priority
* @param priority Specified priority
* @return notification number
@@ -465,6 +511,12 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0;
/**
+ * @brief Change applications count ready for PTU
+ * @param new_app_count new applications count for PTU
+ */
+ virtual void UpdatePTUReadyAppsCount(const uint32_t new_app_count) = 0;
+
+ /**
* @brief Get state of request types for given application
* @param policy_app_id Unique application id
* @return request type state
@@ -497,18 +549,137 @@ class PolicyManager : public usage_statistics::StatisticsManager {
const std::string& policy_app_id) const = 0;
/**
- * @brief Get information about vehicle
- * @return vehicle information
+ * @brief Gets vehicle data items
+ * @return Structure with vehicle data items
+ */
+ virtual const std::vector<policy_table::VehicleDataItem> GetVehicleDataItems()
+ const = 0;
+
+ /**
+ * @brief Gets removed vehicle data items
+ * @return Structure with vehicle data items
+ */
+ virtual std::vector<policy_table::VehicleDataItem>
+ GetRemovedVehicleDataItems() const = 0;
+
+ /**
+ * @brief Gets copy of current policy table data
+ * @return policy_table as json object
+ */
+ virtual Json::Value GetPolicyTableData() const = 0;
+
+ /**
+ * @brief Get a list of policy app ids
+ * @return apps list filled with the policy app ids of each
+ * application
+ */
+ virtual const std::vector<std::string> GetApplicationPolicyIDs() const = 0;
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
+ * @brief Get a list of enabled local applications
+ * @return enabled_apps List filled with the policy app id of each enabled
+ * local application
+ */
+ virtual std::vector<std::string> GetEnabledLocalApps() const = 0;
+
+ /**
+ * @brief Get app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id policy app id
+ * @param out_app_properties application properties
+ * @return true if application presents in database, otherwise - false
+ */
+ virtual bool GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const = 0;
+
+ /**
+ * @ brief Initialize new cloud app in the policy table
+ * @ param policy_app_id Application ID
+ */
+
+ virtual void InitCloudApp(const std::string& policy_app_id) = 0;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) = 0;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
*/
- virtual const VehicleInfo GetVehicleInfo() const = 0;
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) = 0;
+
+ /**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 0;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const = 0;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const = 0;
/**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
* succesfully registered on mobile device.
- * It will send OnAppPermissionSend notification and will try to start PTU. *
+ * It will send OnAppPermissionSend notification and will try to start PTU.
+ *
+ * @param device_id device identifier
* @param application_id registered application.
*/
- virtual void OnAppRegisteredOnMobile(const std::string& application_id) = 0;
+ virtual void OnAppRegisteredOnMobile(const std::string& device_id,
+ const std::string& application_id) = 0;
virtual void OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) = 0;
@@ -543,11 +714,14 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief Assigns new HMI types for specified application
+ * @param device_handle device identifier
* @param application_id Unique application id
* @param hmi_types new HMI types list
*/
- virtual void SetDefaultHmiTypes(const std::string& application_id,
- const std::vector<int>& hmi_types) = 0;
+ virtual void SetDefaultHmiTypes(
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string& application_id,
+ const std::vector<int>& hmi_types) = 0;
/**
* @brief Gets HMI types
@@ -576,11 +750,18 @@ class PolicyManager : public usage_statistics::StatisticsManager {
const std::string& application_id) = 0;
/**
- * @brief Gets all allowed module types
- * @param policy_app_id unique identifier of application
- * @param modules list of allowed module types
- * @return true if application has allowed modules
- */
+ * @brief Send OnAppPropertiesChangeNotification to the HMI
+ * @param policy_app_id policy app id
+ */
+ virtual void SendOnAppPropertiesChangeNotification(
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Gets all allowed module types
+ * @param policy_app_id unique identifier of application
+ * @param modules list of allowed module types
+ * @return true if application has allowed modules
+ */
virtual bool GetModuleTypes(const std::string& policy_app_id,
std::vector<std::string>* modules) const = 0;
@@ -589,7 +770,7 @@ class PolicyManager : public usage_statistics::StatisticsManager {
* @param access_remote pointer to new access_remote instance
*/
virtual void set_access_remote(
- utils::SharedPtr<AccessRemote> access_remote) = 0;
+ std::shared_ptr<AccessRemote> access_remote) = 0;
/**
* @brief Checks if there is existing URL in the EndpointUrls vector with
@@ -603,6 +784,28 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual AppIdURL RetrySequenceUrl(const struct RetrySequenceURL& rs,
const EndpointUrls& urls) const = 0;
+ /**
+ * @brief OnLocalAppAdded triggers PTU
+ */
+ virtual void OnLocalAppAdded() = 0;
+
+ /**
+ * @brief Check if certain application already in policy db.
+ * @param policy application id.
+ * @return true if application presents false otherwise.
+ */
+ virtual bool IsNewApplication(const std::string& application_id) const = 0;
+
+ /**
+ * @brief Restart PTU timeout if PTU in UPDATING state
+ */
+ virtual void ResetTimeout() = 0;
+
+ /**
+ * @brief Trigger a PTU once on startup if it is required
+ */
+ virtual void TriggerPTUOnStartupIfRequired() = 0;
+
protected:
/**
* @brief Checks is PT exceeded IgnitionCycles
diff --git a/src/components/include/policy/policy_regular/policy/policy_settings.h b/src/components/include/policy/policy_regular/policy/policy_settings.h
index def9fca05a..3529a32717 100644
--- a/src/components/include/policy/policy_regular/policy/policy_settings.h
+++ b/src/components/include/policy/policy_regular/policy/policy_settings.h
@@ -1,7 +1,7 @@
#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_SETTINGS_H_
#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_SETTINGS_H_
-#include <string>
#include <stdint.h>
+#include <string>
namespace policy {
class PolicySettings {
@@ -17,8 +17,8 @@ class PolicySettings {
virtual const std::string& preloaded_pt_file() const = 0;
/**
- * @brief Returns application storage path
- */
+ * @brief Returns application storage path
+ */
virtual const std::string& app_storage_folder() const = 0;
virtual uint16_t attempts_to_open_policy_db() const = 0;
@@ -32,10 +32,12 @@ class PolicySettings {
virtual const std::string& policies_snapshot_file_name() const = 0;
/**
- * @brief Returns system files folder path
- */
+ * @brief Returns system files folder path
+ */
virtual const std::string& system_files_path() const = 0;
+ virtual bool use_full_app_id() const = 0;
+
virtual ~PolicySettings() {}
};
} // namespace policy
diff --git a/src/components/include/protocol/bson_object_keys.h b/src/components/include/protocol/bson_object_keys.h
index 6f80aeec2b..f81de4cc81 100644
--- a/src/components/include/protocol/bson_object_keys.h
+++ b/src/components/include/protocol/bson_object_keys.h
@@ -42,6 +42,13 @@ extern const char* height;
extern const char* width;
extern const char* video_protocol;
extern const char* video_codec;
+extern const char* secondary_transports;
+extern const char* audio_service_transports;
+extern const char* video_service_transports;
+extern const char* tcp_ip_address;
+extern const char* tcp_port;
+extern const char* reason;
+extern const char* auth_token;
} // namespace strings
diff --git a/src/components/include/protocol/common.h b/src/components/include/protocol/common.h
index 00d57a9bf5..4b227eeff1 100644
--- a/src/components/include/protocol/common.h
+++ b/src/components/include/protocol/common.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_PROTOCOL_COMMON_H_
#define SRC_COMPONENTS_INCLUDE_PROTOCOL_COMMON_H_
-#include "utils/macro.h"
#include "protocol/raw_message.h"
+#include "utils/macro.h"
/**
*\namespace protocol_handlerHandler
@@ -111,20 +111,20 @@ const bool PROTECTION_OFF = false;
*/
enum {
/**
- *\brief Constant: Control type of frame
- */
+ *\brief Constant: Control type of frame
+ */
FRAME_TYPE_CONTROL = 0x00,
/**
- *\brief Constant: Single type of frame.
- */
+ *\brief Constant: Single type of frame.
+ */
FRAME_TYPE_SINGLE = 0x01,
/**
- *\brief Constant: First frame for multiple frames
- */
+ *\brief Constant: First frame for multiple frames
+ */
FRAME_TYPE_FIRST = 0x02,
/**
- *\brief Constant: Consecutive type of frame for multiple frames
- */
+ *\brief Constant: Consecutive type of frame for multiple frames
+ */
FRAME_TYPE_CONSECUTIVE = 0x03,
/**
*\brief Maximum value of frame type field (size 3-bit)
@@ -167,6 +167,22 @@ enum {
*/
FRAME_DATA_END_SERVICE_NACK = 0x06,
/**
+ *\brief Register Secondary Transport frame
+ */
+ FRAME_DATA_REGISTER_SECONDARY_TRANSPORT = 0x07,
+ /**
+ *\brief Register Secondary Transport acknowledgement frame
+ */
+ FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_ACK = 0x08,
+ /**
+ *\brief Register Secondary Transport not acknowledgement frame
+ */
+ FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_NACK = 0x09,
+ /**
+ *\brief Transport Event Update frame
+ */
+ FRAME_DATA_TRANSPORT_EVENT_UPDATE = 0xFD,
+ /**
*\brief Service data ACK frame
*/
FRAME_DATA_SERVICE_DATA_ACK = 0xFE,
diff --git a/src/components/include/protocol/raw_message.h b/src/components/include/protocol/raw_message.h
index 99cb73ce67..3de0d783cb 100644
--- a/src/components/include/protocol/raw_message.h
+++ b/src/components/include/protocol/raw_message.h
@@ -32,10 +32,10 @@
#ifndef SRC_COMPONENTS_INCLUDE_PROTOCOL_RAW_MESSAGE_H_
#define SRC_COMPONENTS_INCLUDE_PROTOCOL_RAW_MESSAGE_H_
-#include "utils/macro.h"
-#include "utils/shared_ptr.h"
-#include "protocol/service_type.h"
+#include <memory>
#include "protocol/message_priority.h"
+#include "protocol/service_type.h"
+#include "utils/macro.h"
namespace protocol_handler {
/**
@@ -58,6 +58,7 @@ class RawMessage {
uint32_t protocol_version,
const uint8_t* const data_param,
uint32_t data_size,
+ bool protection,
uint8_t type = ServiceType::kRpc,
uint32_t payload_size = 0);
/**
@@ -96,6 +97,8 @@ class RawMessage {
ServiceType service_type() const {
return service_type_;
}
+
+ bool protection_flag() const;
/**
* \brief Specifies current state of message in queue.
* if false message is "ready to be processed"
@@ -109,11 +112,12 @@ class RawMessage {
uint8_t* data_;
size_t data_size_;
uint32_t protocol_version_;
+ bool protection_;
ServiceType service_type_;
size_t payload_size_;
bool waiting_;
DISALLOW_COPY_AND_ASSIGN(RawMessage);
};
-typedef utils::SharedPtr<RawMessage> RawMessagePtr;
+typedef std::shared_ptr<RawMessage> RawMessagePtr;
} // namespace protocol_handler
#endif // SRC_COMPONENTS_INCLUDE_PROTOCOL_RAW_MESSAGE_H_
diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h
index 1da8d61e52..aacb31c260 100644
--- a/src/components/include/protocol_handler/protocol_handler.h
+++ b/src/components/include/protocol_handler/protocol_handler.h
@@ -39,6 +39,7 @@
*\namespace protocol_handlerHandler
*\brief Namespace for SmartDeviceLink ProtocolHandler related functionality.
*/
+
namespace protocol_handler {
class ProtocolObserver;
@@ -69,10 +70,12 @@ class ProtocolHandler {
/**
* \brief Method for sending message to Mobile Application.
* \param message RawMessage with params to be sent to Mobile App.
+ * \param needs_encryption whether message needs to be encrypted by policy
* \param final_message tells whether message's
* connection must be closed when message is processed
*/
virtual void SendMessageToMobileApp(const RawMessagePtr message,
+ bool needs_encryption,
bool final_message) = 0;
/**
@@ -86,28 +89,36 @@ class ProtocolHandler {
/**
* \brief Prepare and send heartbeat message to mobile app
- * \param connection_id Identifier of connection within which
- * session exists
- * \param session_id ID of session to be ended
+ * \param connection_id Identifier of connection within which
+ * session exists
+ * \param session_id ID of session to be ended
*/
virtual void SendHeartBeat(int32_t connection_id, uint8_t session_id) = 0;
/**
- * \brief Sends ending session to mobile application
- * \param connection_id Identifier of connection within which
- * session exists
- * \param session_id ID of session to be ended
- */
+ * \brief Sends ending session to mobile application
+ * \param connection_id Identifier of connection within which
+ * session exists
+ * \param session_id ID of session to be ended
+ */
virtual void SendEndSession(int32_t connection_id, uint8_t session_id) = 0;
- virtual void SendEndService(int32_t connection_id,
+ /**
+ * \brief Sends ending session to mobile application
+ * \param primary_connection_id Identifier of connection within which
+ * service exists
+ * \param connection_id Identifier of the actual transport for the service
+ * \param session_id ID of session to be ended
+ */
+ virtual void SendEndService(int32_t primary_connection_id,
+ int32_t connection_id,
uint8_t session_id,
uint8_t service_type) = 0;
/**
* \brief Called to notify all handsheke handlers about handshake failure.
*/
- virtual void NotifyOnFailedHandshake() = 0;
+ virtual void NotifyOnGetSystemTimeFailed() = 0;
/**
* \brief Protocol handler settings getter
@@ -117,27 +128,6 @@ class ProtocolHandler {
virtual SessionObserver& get_session_observer() = 0;
/**
- * \brief Called by connection handler to notify the result of
- * OnSessionStartedCallback().
- * \param connection_id Identifier of connection within which session exists
- * \param session_id session ID passed to OnSessionStartedCallback()
- * \param generated_session_id Generated session ID, will be 0 if session is
- * not started
- * \param hash_id Generated Hash ID
- * \param protection whether the service will be protected
- * \param rejected_params list of parameters' name that are rejected.
- * Only valid when generated_session_id is 0. Note, even if
- * generated_session_id is 0, the list may be empty.
- */
- DEPRECATED virtual void NotifySessionStartedResult(
- int32_t connection_id,
- uint8_t session_id,
- uint8_t generated_session_id,
- uint32_t hash_id,
- bool protection,
- std::vector<std::string>& rejected_params) = 0;
-
- /**
* @brief Called by connection handler to notify the context of
* OnSessionStartedCallback().
* @param context reference to structure with started session data
@@ -149,6 +139,18 @@ class ProtocolHandler {
const SessionContext& context,
std::vector<std::string>& rejected_params) = 0;
+ virtual bool IsRPCServiceSecure(const uint32_t connection_key) const = 0;
+
+ virtual void ProcessFailedPTU() = 0;
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ /**
+ * @brief ProcessFailedCertDecrypt is called to notify security manager that
+ * certificate decryption failed in the external flow
+ */
+ virtual void ProcessFailedCertDecrypt() = 0;
+#endif
+
protected:
/**
* \brief Destructor
diff --git a/src/components/include/protocol_handler/protocol_handler_settings.h b/src/components/include/protocol_handler/protocol_handler_settings.h
index e1107cb2a9..62a24df32c 100644
--- a/src/components/include/protocol_handler/protocol_handler_settings.h
+++ b/src/components/include/protocol_handler/protocol_handler_settings.h
@@ -34,12 +34,6 @@ class ProtocolHandlerSettings {
*/
virtual uint16_t max_supported_protocol_version() const = 0;
- /*
- * @brief Returns true, if SDL 4.0 is enabled
- * @deprecated Use max_supported_protocol_version instead
- */
- DEPRECATED virtual bool enable_protocol_4() const = 0;
-
virtual uint32_t multiframe_waiting_timeout() const = 0;
#ifdef ENABLE_SECURITY
/**
@@ -51,6 +45,28 @@ class ProtocolHandlerSettings {
*/
virtual const std::vector<int>& force_unprotected_service() const = 0;
#endif // ENABLE_SECURITY
+
+ /**
+ * @brief Returns true multiple transports is enabled
+ */
+ virtual const bool multiple_transports_enabled() const = 0;
+
+ /**
+ * @brief Returns list of secondary transports available
+ * for the named primary transport
+ */
+ virtual const std::vector<std::string>& secondary_transports_for_bluetooth()
+ const = 0;
+ virtual const std::vector<std::string>& secondary_transports_for_usb()
+ const = 0;
+ virtual const std::vector<std::string>& secondary_transports_for_wifi()
+ const = 0;
+
+ /**
+ * @brief Returns list of allowed transports for the named service
+ */
+ virtual const std::vector<std::string>& audio_service_transports() const = 0;
+ virtual const std::vector<std::string>& video_service_transports() const = 0;
};
} // namespace protocol_handler
#endif // SRC_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_HANDLER_SETTINGS_H_
diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h
index 7a5dcf287c..e71557fecf 100644
--- a/src/components/include/protocol_handler/session_observer.h
+++ b/src/components/include/protocol_handler/session_observer.h
@@ -59,6 +59,7 @@ enum { HASH_ID_NOT_SUPPORTED = 0, HASH_ID_WRONG = 0xFFFF0000 };
* @brief Struct with data containing attributes of starting session
**/
struct SessionContext {
+ transport_manager::ConnectionUID primary_connection_id_;
transport_manager::ConnectionUID connection_id_;
uint8_t initial_session_id_;
uint8_t new_session_id_;
@@ -71,7 +72,8 @@ struct SessionContext {
* @brief Constructor
*/
SessionContext()
- : connection_id_(0)
+ : primary_connection_id_(0)
+ , connection_id_(0)
, initial_session_id_(0)
, new_session_id_(0)
, service_type_(protocol_handler::kInvalidServiceType)
@@ -81,6 +83,8 @@ struct SessionContext {
/**
* @brief Constructor
+ * @param primary_connection_id Connection identifier of the primary
+ * connection in which the session is started
* @param connection_id_ Connection identifier within which session is
* started.
* @param session_id Session ID specified to OnSessionStartedCallback()
@@ -91,13 +95,15 @@ struct SessionContext {
* @param is_protected Whether service will be protected
* @param is_new_service Whether service was already established
**/
- SessionContext(transport_manager::ConnectionUID connection_id,
+ SessionContext(transport_manager::ConnectionUID primary_connection_id,
+ transport_manager::ConnectionUID connection_id,
uint8_t session_id,
uint8_t new_session_id,
protocol_handler::ServiceType service_type,
uint32_t hash_id,
const bool is_protected)
- : connection_id_(connection_id)
+ : primary_connection_id_(primary_connection_id)
+ , connection_id_(connection_id)
, initial_session_id_(session_id)
, new_session_id_(new_session_id)
, service_type_(service_type)
@@ -119,26 +125,6 @@ class SessionObserver {
/**
* \brief Callback function used by ProtocolHandler
* when Mobile Application initiates start of new session.
- * \param connection_handle Connection identifier within which session
- * has to be started.
- * \param sessionId Identifier of the session to be start
- * \param service_type Type of service
- * \param protocol_version Version of protocol
- * \param is_protected would be service protected
- * \param hash_id pointer for session hash identifier, uint32_t* hash_id
- * \return uint32_t Id (number) of new session if successful, otherwise 0.
- * \deprecated
- */
- DEPRECATED virtual uint32_t OnSessionStartedCallback(
- const transport_manager::ConnectionUID connection_handle,
- const uint8_t sessionId,
- const protocol_handler::ServiceType& service_type,
- const bool is_protected,
- uint32_t* hash_id) = 0;
-
- /**
- * \brief Callback function used by ProtocolHandler
- * when Mobile Application initiates start of new session.
* Result must be notified through NotifySessionStartedContext().
* \param connection_handle Connection identifier within which session
* has to be started.
@@ -161,24 +147,6 @@ class SessionObserver {
* \param connection_handle Connection identifier within which session exists
* \param sessionId Identifier of the session to be ended
* \param hashCode Hash used only in second version of SmartDeviceLink
- * protocol.
- * If not equal to hash assigned to session on start then operation fails.
- * \param service_type Type of service
- * \return uint32_t 0 if operation fails, session key otherwise
- * \deprecated
- */
- DEPRECATED virtual uint32_t OnSessionEndedCallback(
- const transport_manager::ConnectionUID connection_handle,
- const uint8_t sessionId,
- const uint32_t& hashCode,
- const protocol_handler::ServiceType& service_type) = 0;
-
- /**
- * \brief Callback function used by ProtocolHandler
- * when Mobile Application initiates session ending.
- * \param connection_handle Connection identifier within which session exists
- * \param sessionId Identifier of the session to be ended
- * \param hashCode Hash used only in second version of SmartDeviceLink
* protocol. (Set to HASH_ID_WRONG if the hash is incorrect)
* If not equal to hash assigned to session on start then operation fails.
* \param service_type Type of service
@@ -205,6 +173,24 @@ class SessionObserver {
virtual void OnMalformedMessageCallback(const uint32_t& connection_key) = 0;
/**
+ * @brief Converts connection handle to transport type string used in
+ * smartDeviceLink.ini file, e.g. "TCP_WIFI"
+ * @param connection_handle A connection identifier
+ * @return string representation of the transport of the device
+ */
+ virtual const std::string TransportTypeProfileStringFromConnHandle(
+ transport_manager::ConnectionUID connection_handle) const = 0;
+
+ /**
+ * @brief Converts device handle to transport type string used in
+ * smartDeviceLink.ini file, e.g. "TCP_WIFI"
+ * @param device_handle A device handle
+ * @return string representation of the transport of the device
+ */
+ virtual const std::string TransportTypeProfileStringFromDeviceHandle(
+ transport_manager::DeviceHandle device_handle) const = 0;
+
+ /**
* \brief Creates unique identifier of session (can be used as hash)
* from given connection identifier
* within which session exists and session number.
diff --git a/src/components/include/protocol_handler/telemetry_observer.h b/src/components/include/protocol_handler/telemetry_observer.h
index a76fbce717..0fdbd07aff 100644
--- a/src/components/include/protocol_handler/telemetry_observer.h
+++ b/src/components/include/protocol_handler/telemetry_observer.h
@@ -45,13 +45,13 @@ class PHTelemetryObserver {
RawMessagePtr raw_msg;
uint32_t message_id;
uint8_t connection_key;
- TimevalStruct begin;
- TimevalStruct end;
+ date_time::TimeDuration begin;
+ date_time::TimeDuration end;
};
- virtual void StartMessageProcess(uint32_t message_id,
- const TimevalStruct& start_time) = 0;
- virtual void EndMessageProcess(utils::SharedPtr<MessageMetric> m) = 0;
+ virtual void StartMessageProcess(
+ uint32_t message_id, const date_time::TimeDuration& start_time) = 0;
+ virtual void EndMessageProcess(std::shared_ptr<MessageMetric> m) = 0;
virtual ~PHTelemetryObserver() {}
};
-} // protocol_handler
+} // namespace protocol_handler
#endif // SRC_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_TELEMETRY_OBSERVER_H_
diff --git a/src/components/include/resumption/last_state.h b/src/components/include/resumption/last_state.h
new file mode 100644
index 0000000000..b28e5611b7
--- /dev/null
+++ b/src/components/include/resumption/last_state.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_RESUMPTION_LAST_STATE_H_
+#define SRC_COMPONENTS_INCLUDE_RESUMPTION_LAST_STATE_H_
+
+#include "json/json.h"
+#include "utils/macro.h"
+
+namespace resumption {
+
+class LastState {
+ public:
+ /**
+ * @brief Destructor
+ */
+ virtual ~LastState() {}
+
+ /**
+ * @brief Saves dictionary to filesystem
+ */
+ DEPRECATED
+ virtual void SaveStateToFileSystem() = 0;
+
+ /**
+ * @brief SaveToFileSystem
+ * Saving dictionary to filesystem
+ */
+ virtual void SaveToFileSystem() = 0;
+
+ /**
+ * @brief RemoveFromFileSystem
+ * Remove dictionary from filesystem
+ */
+ virtual void RemoveFromFileSystem() = 0;
+
+ /**
+ * @brief dictionary Gets internal dictionary
+ * @return Reference to internal dictionary json value
+ */
+ virtual Json::Value& get_dictionary() = 0;
+
+ /**
+ * @brief dictionary Gets internal dictionary
+ * @return Copy of internal dictionary json value
+ */
+ virtual Json::Value dictionary() const = 0;
+
+ /**
+ * @brief set_dictionary sets internal dictionary
+ * @param dictionary New dictionary json value to be set
+ */
+ virtual void set_dictionary(const Json::Value& dictionary) = 0;
+};
+
+} // namespace resumption
+
+#endif // SRC_COMPONENTS_INCLUDE_RESUMPTION_LAST_STATE_H_
diff --git a/src/components/include/resumption/last_state_wrapper.h b/src/components/include/resumption/last_state_wrapper.h
new file mode 100644
index 0000000000..d5af2e958e
--- /dev/null
+++ b/src/components/include/resumption/last_state_wrapper.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_RESUMPTION_LAST_STATE_WRAPPER_H_
+#define SRC_COMPONENTS_INCLUDE_RESUMPTION_LAST_STATE_WRAPPER_H_
+
+#include <memory>
+
+#include "resumption/last_state.h"
+#include "utils/mutable_data_accessor.h"
+
+namespace resumption {
+class LastStateWrapper;
+typedef std::shared_ptr<LastStateWrapper> LastStateWrapperPtr;
+typedef MutableDataAccessor<LastState> LastStateAccessor;
+
+class LastStateWrapper {
+ public:
+ /**
+ * @brief Getter for providing exclusive access to LastState instance
+ * @return accessor with ability to access to LastState instance
+ */
+ virtual LastStateAccessor get_accessor() const = 0;
+};
+
+} // namespace resumption
+
+#endif // SRC_COMPONENTS_INCLUDE_RESUMPTION_LAST_STATE_WRAPPER_H_
diff --git a/src/components/include/rpc_base/validation_report.h b/src/components/include/rpc_base/validation_report.h
index 82f265e594..c138ac143f 100644
--- a/src/components/include/rpc_base/validation_report.h
+++ b/src/components/include/rpc_base/validation_report.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_RPC_BASE_INCLUDE_RPC_BASE_VALIDATION_REPORT_H_
#define SRC_COMPONENTS_RPC_BASE_INCLUDE_RPC_BASE_VALIDATION_REPORT_H_
-#include <string>
#include <list>
+#include <string>
namespace rpc {
diff --git a/src/components/include/security_manager/crypto_manager.h b/src/components/include/security_manager/crypto_manager.h
index 486b6da64f..ba50820a81 100644
--- a/src/components/include/security_manager/crypto_manager.h
+++ b/src/components/include/security_manager/crypto_manager.h
@@ -45,7 +45,7 @@
**security_manager::CryptoManager::CreateSSLContext()
* \brief Creates an instance of \ref SSLContext class
*
- * \fn void
+ * \fn void
*security_manager::CryptoManager::ReleaseSSLContext(security_manager::SSLContext
**context)
* \brief Frees \ref SSLContext instance
@@ -67,19 +67,19 @@ class CryptoManager : public policy::PolicyHandlerObserver {
virtual void ReleaseSSLContext(SSLContext* context) = 0;
virtual std::string LastError() const = 0;
/**
- * @brief IsCertificateUpdateRequired checks if certificate update is needed
- * @param system_time - time with which certificate expiration time
- * should be compared
- * @param certificates_time - certificate expiration time
- * @return True if certificate expired and need to be updated
- * otherwise False
- */
+ * @brief IsCertificateUpdateRequired checks if certificate update is needed
+ * @param system_time - time with which certificate expiration time
+ * should be compared
+ * @param certificates_time - certificate expiration time
+ * @return True if certificate expired and need to be updated
+ * otherwise False
+ */
virtual bool IsCertificateUpdateRequired(
const time_t system_time, const time_t certificates_time) const = 0;
/**
- * \brief Crypto manager settings getter
- * \return pointer to crypto manager settings class
- */
+ * \brief Crypto manager settings getter
+ * \return pointer to crypto manager settings class
+ */
virtual const CryptoManagerSettings& get_settings() const = 0;
virtual ~CryptoManager() {}
};
diff --git a/src/components/include/security_manager/security_manager.h b/src/components/include/security_manager/security_manager.h
index 61ba43c74f..358c4e5268 100644
--- a/src/components/include/security_manager/security_manager.h
+++ b/src/components/include/security_manager/security_manager.h
@@ -40,8 +40,8 @@
#include "protocol_handler/protocol_observer.h"
#include "protocol_handler/session_observer.h"
-#include "security_manager/security_manager_listener.h"
#include "application_manager/policies/policy_handler_observer.h"
+#include "security_manager/security_manager_listener.h"
namespace security_manager {
@@ -166,7 +166,17 @@ class SecurityManager : public protocol_handler::ProtocolObserver,
/**
* @brief Notify all listeners that handshake was failed
*/
- virtual void NotifyListenersOnHandshakeFailed() = 0;
+ virtual void NotifyListenersOnGetSystemTimeFailed() = 0;
+
+ virtual void ProcessFailedPTU() = 0;
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ /**
+ * @brief ProcessFailedCertDecrypt is called to notify listeners that
+ * certificate decryption failed in the external flow
+ */
+ virtual void ProcessFailedCertDecrypt() = 0;
+#endif
/**
* @brief Check if policy certificate data is empty
@@ -175,6 +185,12 @@ class SecurityManager : public protocol_handler::ProtocolObserver,
virtual bool IsPolicyCertificateDataEmpty() = 0;
/**
+ * @brief ResetPendingSystemTimeRequests resets waiting for system time
+ * requests flag
+ */
+ virtual void ResetPendingSystemTimeRequests() = 0;
+
+ /**
* \brief Add/Remove for SecurityManagerListener
*/
virtual void AddListener(SecurityManagerListener* const listener) = 0;
diff --git a/src/components/include/security_manager/security_manager_listener.h b/src/components/include/security_manager/security_manager_listener.h
index 00a4c68134..0f3a126410 100644
--- a/src/components/include/security_manager/security_manager_listener.h
+++ b/src/components/include/security_manager/security_manager_listener.h
@@ -33,6 +33,7 @@
#define SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_MANAGER_LISTENER_H_
#include <string>
+#include "security_manager/ssl_context.h"
namespace security_manager {
@@ -52,13 +53,28 @@ class SecurityManagerListener {
* @brief Notification about handshake failure
* @return true on success notification handling or false otherwise
*/
- virtual bool OnHandshakeFailed() = 0;
+ virtual bool OnGetSystemTimeFailed() = 0;
/**
* @brief Notify listeners that certificate update is required.
*/
virtual void OnCertificateUpdateRequired() = 0;
+ virtual bool OnPTUFailed() = 0;
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ /**
+ * @brief OnCertDecryptFailed is called when certificate decryption fails in
+ * external flow
+ * @return since this callback is a part of SecurityManagerListener, bool
+ * return value is used to indicate whether listener instance can be deleted
+ * by calling entity. if true - listener can be deleted and removed from
+ * listeners by SecurityManager, false - listener retains its place within
+ * SecurityManager.
+ */
+ virtual bool OnCertDecryptFailed() = 0;
+#endif
+
/**
* @brief Get certificate data from policy
* @param reference to string where to save certificate data
diff --git a/src/components/include/security_manager/security_query.h b/src/components/include/security_manager/security_query.h
index cdad1c746c..5e66466663 100644
--- a/src/components/include/security_manager/security_query.h
+++ b/src/components/include/security_manager/security_query.h
@@ -35,9 +35,9 @@
#include <stdint.h>
#include <cstddef>
-#include <vector>
+#include <memory>
#include <string>
-#include "utils/shared_ptr.h"
+#include <vector>
namespace security_manager {
/**
@@ -187,8 +187,8 @@ class SecurityQuery {
std::string json_message_;
};
/**
-*\brief SmartPointer wrapper
-*/
-typedef utils::SharedPtr<SecurityQuery> SecurityQueryPtr;
+ *\brief SmartPointer wrapper
+ */
+typedef std::shared_ptr<SecurityQuery> SecurityQueryPtr;
} // namespace security_manager
#endif // SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_QUERY_H_
diff --git a/src/components/include/security_manager/ssl_context.h b/src/components/include/security_manager/ssl_context.h
index 9d66e1af2f..397cf89347 100644
--- a/src/components/include/security_manager/ssl_context.h
+++ b/src/components/include/security_manager/ssl_context.h
@@ -33,10 +33,10 @@
#ifndef SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SSL_CONTEXT_H_
#define SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SSL_CONTEXT_H_
-#include <cstddef> // for size_t typedef
-#include <string>
#include <ctype.h>
#include <algorithm>
+#include <cstddef> // for size_t typedef
+#include <string>
#include "utils/custom_string.h"
// TODO(EZamakhov): update brief info
@@ -77,7 +77,8 @@ class SSLContext {
};
struct HandshakeContext {
- HandshakeContext() : expected_sn(""), expected_cn("") {}
+ HandshakeContext()
+ : expected_sn(""), expected_cn(""), system_time(time(NULL)) {}
HandshakeContext(const custom_str::CustomString& exp_sn,
const custom_str::CustomString& exp_cn)
@@ -105,11 +106,11 @@ class SSLContext {
virtual bool IsInitCompleted() const = 0;
virtual bool IsHandshakePending() const = 0;
/**
- * @brief GetCertificateDueDate gets certificate expiration date
- * @param due_date - certificate expiration time to be received
- * @return True if certificate expiration date received
- * otherwise False
- */
+ * @brief GetCertificateDueDate gets certificate expiration date
+ * @param due_date - certificate expiration time to be received
+ * @return True if certificate expiration date received
+ * otherwise False
+ */
virtual bool GetCertificateDueDate(time_t& due_date) const = 0;
virtual bool HasCertificate() const = 0;
virtual size_t get_max_block_size(size_t mtu) const = 0;
diff --git a/src/components/include/test/application_manager/mock_app_extension.h b/src/components/include/test/application_manager/mock_app_extension.h
index eb8fcd51cf..10a911e799 100644
--- a/src/components/include/test/application_manager/mock_app_extension.h
+++ b/src/components/include/test/application_manager/mock_app_extension.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APP_EXTENSION_H_
#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APP_EXTENSION_H_
-#include "gmock/gmock.h"
#include "application_manager/app_extension.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
@@ -47,11 +47,11 @@ static unsigned MockAppExtensionUID = 123;
class MockAppExtension : public application_manager::AppExtension {
public:
MockAppExtension() : AppExtension(MockAppExtensionUID) {}
- MOCK_METHOD1(
- SaveResumptionData,
- void(NsSmartDeviceLink::NsSmartObjects::SmartObject& resumption_data));
+ MOCK_METHOD1(SaveResumptionData,
+ void(ns_smart_device_link::ns_smart_objects::SmartObject&
+ resumption_data));
MOCK_METHOD1(ProcessResumption,
- void(const NsSmartDeviceLink::NsSmartObjects::SmartObject&
+ void(const ns_smart_device_link::ns_smart_objects::SmartObject&
resumption_data));
};
diff --git a/src/components/include/test/application_manager/mock_app_launch_settings.h b/src/components/include/test/application_manager/mock_app_launch_settings.h
index c59eb276ce..57bd708d62 100644
--- a/src/components/include/test/application_manager/mock_app_launch_settings.h
+++ b/src/components/include/test/application_manager/mock_app_launch_settings.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APP_LAUNCH_SETTINGS_H_
#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APP_LAUNCH_SETTINGS_H_
-#include "gmock/gmock.h"
#include "application_manager/app_launch_settings.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h
index 09957dbde0..3bd3b9b7d6 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -33,27 +33,30 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APPLICATION_MANAGER_H_
#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APPLICATION_MANAGER_H_
+#include <memory>
#include <string>
#include <vector>
-#include <memory>
#include "gmock/gmock.h"
-#include "application_manager/application_manager.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/app_launch/app_launch_ctrl.h"
+#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager_settings.h"
+#include "application_manager/command_factory.h"
#include "application_manager/commands/command.h"
+#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/hmi_capabilities.h"
-#include "application_manager/state_controller.h"
#include "application_manager/message.h"
-#include "resumption/last_state.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/app_launch/app_launch_ctrl.h"
-#include "application_manager/event_engine/event_dispatcher.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/plugin_manager/rpc_plugin_manager.h"
+#include "application_manager/resumption/resume_ctrl.h"
+#include "application_manager/rpc_handler.h"
+#include "application_manager/rpc_service.h"
#include "application_manager/state_controller.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+#include "resumption/last_state_wrapper.h"
#include "smart_objects/smart_object.h"
-#include "application_manager/plugin_manager/rpc_plugin_manager.h"
-#include "application_manager/command_factory.h"
namespace test {
namespace components {
@@ -63,6 +66,10 @@ using application_manager::plugin_manager::RPCPluginManager;
class MockApplicationManager : public application_manager::ApplicationManager {
public:
MOCK_METHOD2(Init,
+ bool(resumption::LastStateWrapperPtr last_state,
+ media_manager::MediaManager* media_manager));
+ DEPRECATED
+ MOCK_METHOD2(Init,
bool(resumption::LastState& last_state,
media_manager::MediaManager* media_manager));
MOCK_METHOD0(Stop, bool());
@@ -74,10 +81,21 @@ class MockApplicationManager : public application_manager::ApplicationManager {
void(connection_handler::ConnectionHandler* handler));
MOCK_CONST_METHOD0(applications,
DataAccessor<application_manager::ApplicationSet>());
+ MOCK_CONST_METHOD0(
+ pending_applications,
+ DataAccessor<application_manager::AppsWaitRegistrationSet>());
+ MOCK_CONST_METHOD0(reregister_applications,
+ DataAccessor<application_manager::ReregisterWaitList>());
+ MOCK_METHOD1(CreatePendingLocalApplication,
+ void(const std::string& policy_app_id));
+ MOCK_METHOD1(RemovePendingApplication,
+ void(const std::string& policy_app_id));
MOCK_CONST_METHOD1(
application, application_manager::ApplicationSharedPtr(uint32_t app_id));
MOCK_CONST_METHOD0(active_application,
application_manager::ApplicationSharedPtr());
+ MOCK_CONST_METHOD0(get_full_or_limited_application,
+ application_manager::ApplicationSharedPtr());
MOCK_CONST_METHOD2(application,
application_manager::ApplicationSharedPtr(
const std::string& device_id,
@@ -91,12 +109,26 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD1(SetPluginManager,
void(std::unique_ptr<RPCPluginManager>& plugin_manager));
+ MOCK_METHOD0(GetAppServiceManager, application_manager::AppServiceManager&());
+
MOCK_CONST_METHOD1(
application_by_hmi_app,
application_manager::ApplicationSharedPtr(uint32_t hmi_app_id));
MOCK_CONST_METHOD1(application_by_policy_id,
application_manager::ApplicationSharedPtr(
const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(
+ application_by_name,
+ application_manager::ApplicationSharedPtr(const std::string& app_name));
+ MOCK_CONST_METHOD1(pending_application_by_policy_id,
+ application_manager::ApplicationSharedPtr(
+ const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(reregister_application_by_policy_id,
+ application_manager::ApplicationSharedPtr(
+ const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(applications_by_name,
+ std::vector<application_manager::ApplicationSharedPtr>(
+ const std::string& app_name));
MOCK_METHOD1(
applications_by_button,
std::vector<application_manager::ApplicationSharedPtr>(uint32_t button));
@@ -115,15 +147,25 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD1(application_id, uint32_t(const int32_t correlation_id));
MOCK_METHOD2(set_application_id,
void(const int32_t correlation_id, const uint32_t app_id));
- MOCK_METHOD3(OnHMILevelChanged,
- void(uint32_t app_id,
- mobile_apis::HMILevel::eType from,
- mobile_apis::HMILevel::eType to));
+ MOCK_METHOD3(OnHMIStateChanged,
+ void(const uint32_t app_id,
+ const application_manager::HmiStatePtr from,
+ const application_manager::HmiStatePtr to));
+ MOCK_METHOD3(ProcessOnDataStreamingNotification,
+ void(const protocol_handler::ServiceType service_type,
+ const uint32_t app_id,
+ const bool streaming_data_available));
MOCK_METHOD1(
SendHMIStatusNotification,
- void(const utils::SharedPtr<application_manager::Application> app));
- MOCK_METHOD1(RemoveHMIFakeParameters,
- void(application_manager::commands::MessageSharedPtr& message));
+ void(const std::shared_ptr<application_manager::Application> app));
+ MOCK_METHOD1(SendDriverDistractionState,
+ void(application_manager::ApplicationSharedPtr app));
+ MOCK_METHOD2(SendGetIconUrlNotifications,
+ void(const uint32_t connection_key,
+ application_manager::ApplicationSharedPtr application));
+ MOCK_METHOD2(RemoveHMIFakeParameters,
+ void(application_manager::commands::MessageSharedPtr& message,
+ const hmi_apis::FunctionID::eType& function_id));
MOCK_CONST_METHOD1(
GetDefaultHmiLevel,
mobile_apis::HMILevel::eType(
@@ -131,10 +173,14 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD0(hmi_capabilities, application_manager::HMICapabilities&());
MOCK_CONST_METHOD0(hmi_capabilities,
const application_manager::HMICapabilities&());
+ MOCK_CONST_METHOD1(
+ CheckResumptionRequiredTransportAvailable,
+ bool(application_manager::ApplicationConstSharedPtr application));
MOCK_METHOD2(ProcessQueryApp,
void(const smart_objects::SmartObject& sm_object,
const uint32_t connection_key));
MOCK_CONST_METHOD0(is_attenuated_supported, bool());
+ MOCK_CONST_METHOD0(IsLowVoltage, bool());
MOCK_CONST_METHOD1(IsAppTypeExistsInFullOrLimited,
bool(application_manager::ApplicationConstSharedPtr app));
MOCK_METHOD1(OnApplicationRegistered,
@@ -153,21 +199,28 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD0(is_stopping, bool());
MOCK_CONST_METHOD0(is_audio_pass_thru_active, bool());
MOCK_METHOD0(GetNextHMICorrelationID, uint32_t());
+ MOCK_METHOD0(GetNextMobileCorrelationID, uint32_t());
MOCK_METHOD0(GenerateNewHMIAppID, uint32_t());
MOCK_METHOD1(EndNaviServices, void(uint32_t app_id));
- DEPRECATED MOCK_METHOD0(BeginAudioPassThrough, bool());
MOCK_METHOD1(BeginAudioPassThru, bool(uint32_t app_id));
- DEPRECATED MOCK_METHOD0(EndAudioPassThrough, bool());
MOCK_METHOD1(EndAudioPassThru, bool(uint32_t app_id));
MOCK_METHOD1(ConnectToDevice, void(const std::string& device_mac));
MOCK_METHOD0(OnHMIStartedCooperation, void());
+ MOCK_METHOD1(DisconnectCloudApp,
+ void(application_manager::ApplicationSharedPtr app));
+ MOCK_METHOD0(RefreshCloudAppInformation, void());
+ MOCK_CONST_METHOD1(GetCloudAppConnectionStatus,
+ hmi_apis::Common_CloudConnectionStatus::eType(
+ application_manager::ApplicationConstSharedPtr app));
+ MOCK_METHOD1(PolicyIDByIconUrl, std::string(const std::string url));
+ MOCK_METHOD1(SetIconFileFromSystemRequest, void(const std::string policy_id));
MOCK_CONST_METHOD0(IsHMICooperating, bool());
MOCK_METHOD2(IviInfoUpdated,
- void(mobile_apis::VehicleDataType::eType vehicle_info,
- int value));
+ void(const std::string& vehicle_info, int value));
MOCK_METHOD1(RegisterApplication,
- application_manager::ApplicationSharedPtr(const utils::SharedPtr<
- smart_objects::SmartObject>& request_for_registration));
+ application_manager::ApplicationSharedPtr(
+ const std::shared_ptr<smart_objects::SmartObject>&
+ request_for_registration));
MOCK_METHOD0(SendUpdateAppList, void());
MOCK_METHOD2(MarkAppsGreyOut,
void(const connection_handler::DeviceHandle handle,
@@ -175,7 +228,6 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD1(IsAppsQueriedFrom,
bool(const connection_handler::DeviceHandle handle));
MOCK_CONST_METHOD0(IsStopping, bool());
- MOCK_METHOD0(IsLowVoltage, bool());
MOCK_METHOD1(RemoveAppFromTTSGlobalPropertiesList,
void(const uint32_t app_id));
MOCK_METHOD4(
@@ -183,7 +235,7 @@ class MockApplicationManager : public application_manager::ApplicationManager {
mobile_apis::Result::eType(const std::vector<uint8_t>& binary_data,
const std::string& file_path,
const std::string& file_name,
- const int64_t offset));
+ const uint64_t offset));
MOCK_METHOD1(SetAllAppsAllowed, void(const bool allowed));
MOCK_METHOD1(
set_driver_distraction_state,
@@ -201,23 +253,28 @@ class MockApplicationManager : public application_manager::ApplicationManager {
void(const uint32_t connection_key,
const uint32_t corr_id,
const int32_t function_id));
+ MOCK_METHOD1(OnQueryAppsRequest,
+ void(const connection_handler::DeviceHandle));
MOCK_METHOD4(UnregisterApplication,
void(const uint32_t&, mobile_apis::Result::eType, bool, bool));
MOCK_METHOD3(updateRequestTimeout,
void(uint32_t connection_key,
uint32_t mobile_correlation_id,
uint32_t new_timeout_value));
+ MOCK_METHOD2(IncreaseForwardedRequestTimeout,
+ void(uint32_t connection_key, uint32_t mobile_correlation_id));
MOCK_METHOD0(state_controller, application_manager::StateController&());
MOCK_METHOD1(SetUnregisterAllApplicationsReason,
void(mobile_apis::AppInterfaceUnregisteredReason::eType reason));
MOCK_METHOD1(HeadUnitReset,
void(mobile_apis::AppInterfaceUnregisteredReason::eType reason));
- MOCK_CONST_METHOD2(HMILevelAllowsStreaming,
+ MOCK_CONST_METHOD2(HMIStateAllowsStreaming,
bool(uint32_t app_id,
protocol_handler::ServiceType service_type));
- MOCK_METHOD4(CheckPolicyPermissions,
+ MOCK_METHOD5(CheckPolicyPermissions,
mobile_apis::Result::eType(
const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const std::string& function_id,
const application_manager::RPCParams& rpc_params,
application_manager::CommandParametersPermissions*
@@ -231,6 +288,12 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD0(SupportedSDLVersion,
protocol_handler::MajorProtocolVersion());
MOCK_METHOD1(
+ ApplyFunctorForEachPlugin,
+ void(std::function<void(application_manager::plugin_manager::RPCPlugin&)>
+ functor));
+ MOCK_METHOD1(SetVINCode, void(const std::string& vin_code));
+ MOCK_CONST_METHOD0(GetVINCode, const std::string());
+ MOCK_METHOD1(
GetDeviceTransportType,
hmi_apis::Common_TransportType::eType(const std::string& transport_type));
MOCK_METHOD1(AddAppToTTSGlobalPropertiesList, void(const uint32_t app_id));
@@ -244,40 +307,37 @@ class MockApplicationManager : public application_manager::ApplicationManager {
void(uint32_t app_id,
protocol_handler::ServiceType service_type,
bool state));
- MOCK_CONST_METHOD5(CreateRegularState,
+ MOCK_CONST_METHOD6(CreateRegularState,
application_manager::HmiStatePtr(
application_manager::ApplicationSharedPtr app,
+ const mobile_apis::WindowType::eType window_type,
mobile_apis::HMILevel::eType hmi_level,
mobile_apis::AudioStreamingState::eType audio_state,
mobile_apis::VideoStreamingState::eType video_state,
mobile_apis::SystemContext::eType system_context));
- DEPRECATED MOCK_CONST_METHOD4(
- CreateRegularState,
- application_manager::HmiStatePtr(
- uint32_t app_id,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::SystemContext::eType system_context));
MOCK_METHOD2(SendAudioPassThroughNotification,
void(uint32_t session_key, std::vector<uint8_t>& binary_data));
MOCK_CONST_METHOD2(CanAppStream,
bool(uint32_t app_id,
protocol_handler::ServiceType service_type));
+ DEPRECATED
MOCK_METHOD1(ForbidStreaming, void(uint32_t app_id));
+ MOCK_METHOD2(ForbidStreaming,
+ void(uint32_t app_id,
+ protocol_handler::ServiceType service_type));
MOCK_CONST_METHOD0(get_settings,
const application_manager::ApplicationManagerSettings&());
+ MOCK_CONST_METHOD1(
+ GetCorrectMobileIDFromMessage,
+ std::string(
+ const application_manager::commands::MessageSharedPtr& message));
MOCK_METHOD0(event_dispatcher,
application_manager::event_engine::EventDispatcher&());
MOCK_METHOD2(IsSOStructValid,
bool(const hmi_apis::StructIdentifiers::eType struct_id,
const smart_objects::SmartObject& display_capabilities));
-
- DEPRECATED MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints,
- bool(const uint32_t));
- DEPRECATED MOCK_METHOD1(SubscribeAppForWayPoints, void(const uint32_t));
- DEPRECATED MOCK_METHOD1(UnsubscribeAppFromWayPoints, void(const uint32_t));
MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints,
bool(application_manager::ApplicationSharedPtr));
MOCK_METHOD1(SubscribeAppForWayPoints,
@@ -285,7 +345,7 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD1(UnsubscribeAppFromWayPoints,
void(application_manager::ApplicationSharedPtr));
MOCK_CONST_METHOD0(IsAnyAppSubscribedForWayPoints, bool());
- MOCK_CONST_METHOD0(GetAppsSubscribedForWayPoints, const std::set<int32_t>());
+ MOCK_CONST_METHOD0(GetAppsSubscribedForWayPoints, const std::set<uint32_t>());
MOCK_CONST_METHOD1(
WaitingApplicationByID,
application_manager::ApplicationConstSharedPtr(const uint32_t));
@@ -310,9 +370,12 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD2(ProcessReconnection,
void(application_manager::ApplicationSharedPtr application,
const uint32_t connection_key));
- MOCK_CONST_METHOD1(IsAppInReconnectMode,
- bool(const std::string& policy_app_id));
+ MOCK_CONST_METHOD2(IsAppInReconnectMode,
+ bool(const connection_handler::DeviceHandle& device_id,
+ const std::string& policy_app_id));
MOCK_CONST_METHOD0(GetCommandFactory, application_manager::CommandFactory&());
+ MOCK_CONST_METHOD0(get_current_audio_source, uint32_t());
+ MOCK_METHOD1(set_current_audio_source, void(const uint32_t));
};
} // namespace application_manager_test
diff --git a/src/components/include/test/application_manager/mock_application_manager_settings.h b/src/components/include/test/application_manager/mock_application_manager_settings.h
index 25cf994566..1a68d663fe 100644
--- a/src/components/include/test/application_manager/mock_application_manager_settings.h
+++ b/src/components/include/test/application_manager/mock_application_manager_settings.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APPLICATION_MANAGER_SETTINGS_H_
#include <string>
-#include "gmock/gmock.h"
#include "application_manager/application_manager_settings.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
@@ -55,6 +55,8 @@ class MockApplicationManagerSettings
// typedef for the return type.
MOCK_CONST_METHOD0(get_vehicle_data_frequency,
const std::pair<uint32_t, int32_t>&());
+ MOCK_CONST_METHOD0(get_interior_vehicle_data_frequency,
+ const std::pair<uint32_t, int32_t>&());
MOCK_CONST_METHOD0(hash_string_size, uint32_t());
MOCK_CONST_METHOD0(app_storage_folder, const std::string&());
MOCK_CONST_METHOD0(app_info_storage, const std::string&());
@@ -76,6 +78,8 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(tts_delimiter, const std::string&());
MOCK_CONST_METHOD0(put_file_in_none, const uint32_t&());
MOCK_CONST_METHOD0(sdl_version, const std::string&());
+ MOCK_CONST_METHOD0(vr_help_title, const std::string&());
+ MOCK_CONST_METHOD0(help_prompt, const std::vector<std::string>&());
MOCK_CONST_METHOD0(time_out_promt, const std::vector<std::string>&());
MOCK_CONST_METHOD0(hmi_capabilities_file_name, const std::string&());
MOCK_CONST_METHOD0(video_server_type, const std::string&());
@@ -87,6 +91,10 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(named_audio_pipe_path, const std::string&());
MOCK_CONST_METHOD0(video_stream_file, const std::string&());
MOCK_CONST_METHOD0(audio_stream_file, const std::string&());
+ MOCK_CONST_METHOD0(period_for_consent_expiration, uint16_t());
+ MOCK_CONST_METHOD0(use_full_app_id, bool());
+ MOCK_CONST_METHOD0(cloud_app_retry_timeout, uint32_t());
+ MOCK_CONST_METHOD0(cloud_app_max_retry_attempts, uint16_t());
MOCK_CONST_METHOD0(use_db_for_resumption, bool());
MOCK_CONST_METHOD0(app_resumption_save_persistent_data_timeout,
const uint32_t&());
@@ -95,6 +103,13 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(app_resuming_timeout, const uint32_t&());
MOCK_CONST_METHOD0(attempts_to_open_resumption_db, uint16_t());
MOCK_CONST_METHOD0(open_attempt_timeout_ms_resumption_db, uint16_t());
+ MOCK_CONST_METHOD0(transport_required_for_resumption_map,
+ std::map<std::string, std::vector<std::string> >&());
+ MOCK_CONST_METHOD0(navigation_lowbandwidth_resumption_level,
+ const std::string&());
+ MOCK_CONST_METHOD0(projection_lowbandwidth_resumption_level,
+ const std::string&());
+ MOCK_CONST_METHOD0(media_lowbandwidth_resumption_level, const std::string&());
MOCK_METHOD1(set_config_file_name, void(const std::string& fileName));
// The following line won't really compile, as the return
// type has multiple template arguments. To fix it, use a
@@ -115,6 +130,7 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(app_time_scale, const uint32_t&());
MOCK_CONST_METHOD0(app_time_scale_max_requests, const uint32_t&());
MOCK_CONST_METHOD0(pending_requests_amount, const uint32_t&());
+ MOCK_CONST_METHOD0(rpc_pass_through_timeout, uint32_t());
// app_launch::AppLaunchSettings
MOCK_CONST_METHOD0(app_launch_wait_time, const uint16_t());
@@ -124,6 +140,10 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(max_number_of_ios_device, const uint16_t());
MOCK_CONST_METHOD0(wait_time_between_apps, const uint16_t());
MOCK_CONST_METHOD0(enable_app_launch_ios, const bool());
+
+ // AppServices
+ MOCK_CONST_METHOD0(embedded_services, const std::vector<std::string>&());
+ MOCK_CONST_METHOD0(hmi_origin_id, const std::string());
};
} // namespace application_manager_test
diff --git a/src/components/include/test/application_manager/mock_request_controller_settings.h b/src/components/include/test/application_manager/mock_request_controller_settings.h
index fe848f4a75..d4d4e29a61 100644
--- a/src/components/include/test/application_manager/mock_request_controller_settings.h
+++ b/src/components/include/test/application_manager/mock_request_controller_settings.h
@@ -37,8 +37,8 @@
#include <string>
#include <vector>
-#include "gmock/gmock.h"
#include "application_manager/request_controller_settings.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
diff --git a/src/components/include/test/application_manager/mock_rpc_handler.h b/src/components/include/test/application_manager/mock_rpc_handler.h
new file mode 100644
index 0000000000..cc7fe988a0
--- /dev/null
+++ b/src/components/include/test/application_manager/mock_rpc_handler.h
@@ -0,0 +1,43 @@
+#ifndef MOCK_RPC_HANDLER_H
+#define MOCK_RPC_HANDLER_H
+
+#include "application_manager/rpc_handler.h"
+#include "telemetry_monitor/telemetry_observable.h"
+
+#include "gmock/gmock.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+class MockRPCHandler : public application_manager::rpc_handler::RPCHandler {
+ public:
+ MOCK_METHOD4(ValidateRpcSO,
+ bool(smart_objects::SmartObject& message,
+ utils::SemanticVersion& msg_version,
+ rpc::ValidationReport& report_out,
+ bool allow_unknown_parameters));
+
+ MOCK_METHOD1(OnMessageReceived,
+ void(protocol_handler::RawMessagePtr message));
+
+ MOCK_METHOD1(OnMobileMessageSent,
+ void(protocol_handler::RawMessagePtr message));
+
+ MOCK_METHOD1(OnMessageReceived,
+ void(std::shared_ptr<application_manager::Message> message));
+
+ MOCK_METHOD1(OnErrorSending,
+ void(std::shared_ptr<application_manager::Message> message));
+
+#ifdef TELEMETRY_MONITOR
+ MOCK_METHOD1(SetTelemetryObserver,
+ void(application_manager::AMTelemetryObserver* observer));
+#endif // TELEMETRY_MONITOR
+};
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
+
+#endif // MOCK_RPC_HANDLER_H
diff --git a/src/components/include/test/application_manager/mock_rpc_plugin.h b/src/components/include/test/application_manager/mock_rpc_plugin.h
index 1f7dd8951b..2633825428 100644
--- a/src/components/include/test/application_manager/mock_rpc_plugin.h
+++ b/src/components/include/test/application_manager/mock_rpc_plugin.h
@@ -1,8 +1,8 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_MOCK_RPC_PLUGIN_H
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_PLUGIN_MANAGER_MOCK_RPC_PLUGIN_H
-#include "gmock/gmock.h"
#include "application_manager/plugin_manager/rpc_plugin.h"
+#include "gmock/gmock.h"
namespace application_manager {
class CommandFactory;
@@ -10,11 +10,19 @@ namespace plugin_manager {
class MockRPCPlugin : public RPCPlugin {
public:
- MOCK_METHOD4(Init,
+ MOCK_METHOD5(Init,
+ bool(ApplicationManager& app_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastStateWrapperPtr last_state));
+ DEPRECATED
+ MOCK_METHOD5(Init,
bool(ApplicationManager& app_manager,
rpc_service::RPCService& rpc_service,
HMICapabilities& hmi_capabilities,
- policy::PolicyHandlerInterface& policy_handler));
+ policy::PolicyHandlerInterface& policy_handler,
+ resumption::LastState& last_state));
MOCK_METHOD2(IsAbleToProcess,
bool(const int32_t function_id,
const commands::Command::CommandSource message_source));
diff --git a/src/components/include/test/application_manager/mock_rpc_plugin_manager.h b/src/components/include/test/application_manager/mock_rpc_plugin_manager.h
index 74763f00d6..db0c04624b 100644
--- a/src/components/include/test/application_manager/mock_rpc_plugin_manager.h
+++ b/src/components/include/test/application_manager/mock_rpc_plugin_manager.h
@@ -2,8 +2,8 @@
#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_RPC_PLUGIN_MANAGER_H_
#include <string>
-#include "gmock/gmock.h"
#include "application_manager/plugin_manager/rpc_plugin_manager.h"
+#include "gmock/gmock.h"
namespace application_manager {
namespace plugin_manager {
diff --git a/src/components/include/test/application_manager/mock_rpc_service.h b/src/components/include/test/application_manager/mock_rpc_service.h
index 4eddbbe257..ed06b930d8 100644
--- a/src/components/include/test/application_manager/mock_rpc_service.h
+++ b/src/components/include/test/application_manager/mock_rpc_service.h
@@ -1,18 +1,22 @@
#ifndef MOCK_RPC_SERVICE_H
#define MOCK_RPC_SERVICE_H
-#include "gmock/gmock.h"
#include "application_manager/rpc_service.h"
+#include "gmock/gmock.h"
+#include "smart_objects/object_schema_item.h"
namespace test {
namespace components {
namespace application_manager_test {
+using ns_smart_device_link::ns_smart_objects::SMember;
+
class MockRPCService : public application_manager::rpc_service::RPCService {
public:
- MOCK_METHOD1(
+ MOCK_METHOD2(
ManageHMICommand,
- bool(const application_manager::commands::MessageSharedPtr message));
+ bool(const application_manager::commands::MessageSharedPtr message,
+ application_manager::commands::Command::CommandSource source));
MOCK_METHOD2(
ManageMobileCommand,
bool(const application_manager::commands::MessageSharedPtr message,
@@ -26,9 +30,24 @@ class MockRPCService : public application_manager::rpc_service::RPCService {
void(protocol_handler::ProtocolHandler* handler));
MOCK_METHOD1(set_hmi_message_handler,
void(hmi_message_handler::HMIMessageHandler* handler));
+ MOCK_METHOD2(
+ IsAppServiceRPC,
+ bool(int32_t function_id,
+ application_manager::commands::Command::CommandSource source));
+ MOCK_METHOD3(UpdateMobileRPCParams,
+ void(const mobile_apis::FunctionID::eType& function_id,
+ const mobile_apis::messageType::eType& message_type,
+ const std::map<std::string, SMember>& members));
+
+ MOCK_METHOD3(UpdateHMIRPCParams,
+ void(const hmi_apis::FunctionID::eType& function_id,
+ const hmi_apis::messageType::eType& message_type,
+ const std::map<std::string, SMember>& members));
+
+ MOCK_METHOD0(Stop, void());
};
-}
-}
-}
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
#endif // MOCK_RPC_SERVICE_H
diff --git a/src/components/include/test/application_manager/mock_state_controller.h b/src/components/include/test/application_manager/mock_state_controller.h
index 0165180a0a..545090bf30 100644
--- a/src/components/include/test/application_manager/mock_state_controller.h
+++ b/src/components/include/test/application_manager/mock_state_controller.h
@@ -33,12 +33,11 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_STATE_CONTROLLER_H_
#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_STATE_CONTROLLER_H_
-#include "gmock/gmock.h"
#include "application_manager/application.h"
#include "application_manager/hmi_state.h"
#include "application_manager/state_controller.h"
+#include "gmock/gmock.h"
#include "interfaces/MOBILE_API.h"
-#include "application_manager/application.h"
namespace test {
namespace components {
@@ -47,55 +46,68 @@ namespace am = application_manager;
class MockStateController : public am::StateController {
public:
- MOCK_METHOD3(SetRegularState,
+ MOCK_METHOD4(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
am::HmiStatePtr state,
- const bool SendActivateApp));
- MOCK_METHOD5(SetRegularState,
+ const bool request_hmi_state_change));
+ MOCK_METHOD6(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
- const bool SendActivateApp));
- MOCK_METHOD3(SetRegularState,
+ const bool request_hmi_state_change));
+ MOCK_METHOD4(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
- const bool SendActivateApp));
- MOCK_METHOD6(SetRegularState,
+ const bool request_hmi_state_change));
+ MOCK_METHOD7(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
- const bool SendActivateApp));
- MOCK_METHOD2(SetRegularState,
+ const bool request_hmi_state_change));
+ MOCK_METHOD3(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level));
- MOCK_METHOD3(SetRegularState,
+ MOCK_METHOD4(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state));
- MOCK_METHOD2(SetRegularState,
+ MOCK_METHOD3(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::SystemContext::eType system_context));
- MOCK_METHOD2(SetRegularState,
- void(am::ApplicationSharedPtr app, am::HmiStatePtr state));
+ MOCK_METHOD3(SetRegularState,
+ void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
+ am::HmiStatePtr state));
MOCK_METHOD2(OnApplicationRegistered,
void(am::ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType default_level));
- MOCK_METHOD3(SendBCActivateApp,
- int64_t(am::ApplicationConstSharedPtr app,
- hmi_apis::Common_HMILevel::eType level,
- bool send_policy_priority));
+ MOCK_METHOD4(OnAppWindowAdded,
+ void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType default_level));
MOCK_METHOD1(OnVideoStreamingStarted,
void(am::ApplicationConstSharedPtr app));
MOCK_METHOD1(OnVideoStreamingStopped,
void(am::ApplicationConstSharedPtr app));
- MOCK_METHOD3(OnStateChanged,
+ MOCK_METHOD4(OnStateChanged,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
am::HmiStatePtr old_state,
am::HmiStatePtr new_state));
MOCK_CONST_METHOD1(IsStateActive, bool(am::HmiState::StateID state_id));
+ MOCK_METHOD1(ActivateDefaultWindow, void(am::ApplicationSharedPtr app));
+ MOCK_METHOD1(ExitDefaultWindow, void(am::ApplicationSharedPtr app));
};
} // namespace application_manager_test
diff --git a/src/components/include/test/application_manager/policies/mock_custom_vehicle_data_provider.h b/src/components/include/test/application_manager/policies/mock_custom_vehicle_data_provider.h
new file mode 100644
index 0000000000..ba077122ce
--- /dev/null
+++ b/src/components/include/test/application_manager/policies/mock_custom_vehicle_data_provider.h
@@ -0,0 +1,24 @@
+#ifndef MOCK_CUSTOM_VEHICLE_DATA_MANAGER_H
+#define MOCK_CUSTOM_VEHICLE_DATA_MANAGER_H
+
+#include "application_manager/policies/custom_vehicle_data_provider.h"
+#include "gmock/gmock.h"
+
+namespace test {
+namespace components {
+namespace policy_test {
+
+class MockCustomVehicleDataProvider : public policy::VehicleDataItemProvider {
+ public:
+ MOCK_CONST_METHOD0(
+ GetVehicleDataItems,
+ const std::vector<rpc::policy_table_interface_base::VehicleDataItem>());
+ MOCK_CONST_METHOD0(
+ GetRemovedVehicleDataItems,
+ std::vector<rpc::policy_table_interface_base::VehicleDataItem>());
+};
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+#endif // MOCK_CUSTOM_VEHICLE_DATA_MANAGER_H
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
index ffa9222c8e..0dde38bc79 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
@@ -33,8 +33,9 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_POLICIES_MOCK_POLICY_HANDLER_INTERFACE_H_
#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_POLICIES_MOCK_POLICY_HANDLER_INTERFACE_H_
-#include "application_manager/policies/policy_handler_interface.h"
#include "application_manager/application_manager.h"
+#include "application_manager/policies/policy_encryption_flag_getter.h"
+#include "application_manager/policies/policy_handler_interface.h"
#include "gmock/gmock.h"
#include "policy/policy_types.h"
#include "smart_objects/smart_object.h"
@@ -46,6 +47,8 @@ namespace policy_test {
class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
public:
MOCK_METHOD0(LoadPolicyLibrary, bool());
+ MOCK_CONST_METHOD0(PolicyEncryptionFlagGetter,
+ policy::PolicyEncryptionFlagGetterInterfaceSPtr());
MOCK_CONST_METHOD0(PolicyEnabled, bool());
MOCK_METHOD0(InitPolicyTable, bool());
MOCK_METHOD0(ResetPolicyTable, bool());
@@ -57,13 +60,22 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
bool(const std::string& file,
const policy::BinaryMessage& pt_string));
MOCK_METHOD0(UnloadPolicyLibrary, bool());
- MOCK_METHOD3(OnPermissionsUpdated,
- void(const std::string& policy_app_id,
+ MOCK_METHOD4(OnPermissionsUpdated,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
const policy::Permissions& permissions,
const policy::HMILevel& default_hmi));
- MOCK_METHOD2(OnPermissionsUpdated,
- void(const std::string& policy_app_id,
+ MOCK_METHOD3(OnPermissionsUpdated,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
const policy::Permissions& permissions));
+ MOCK_CONST_METHOD0(GetPolicyTableData, Json::Value());
+ MOCK_CONST_METHOD0(
+ GetVehicleDataItems,
+ const std::vector<rpc::policy_table_interface_base::VehicleDataItem>());
+ MOCK_CONST_METHOD0(
+ GetRemovedVehicleDataItems,
+ std::vector<rpc::policy_table_interface_base::VehicleDataItem>());
#ifdef EXTERNAL_PROPRIETARY_MODE
MOCK_METHOD3(OnSnapshotCreated,
@@ -71,14 +83,20 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
const std::vector<int>& retry_delay_seconds,
uint32_t timeout_exchange));
#else // EXTERNAL_PROPRIETARY_MODE
- MOCK_METHOD1(OnSnapshotCreated, void(const policy::BinaryMessage& pt_string));
+ MOCK_METHOD2(OnSnapshotCreated,
+ void(const policy::BinaryMessage& pt_string,
+ const policy::PTUIterationType iteration_type));
+ MOCK_METHOD2(GetNextUpdateUrl,
+ std::string(const policy::PTUIterationType iteration_type,
+ uint32_t& app_id));
#endif // EXTERNAL_PROPRIETARY_MODE
MOCK_CONST_METHOD2(GetPriority,
bool(const std::string& policy_app_id,
std::string* priority));
- MOCK_METHOD4(CheckPermissions,
+ MOCK_METHOD5(CheckPermissions,
void(const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const policy::PTString& rpc,
const application_manager::RPCParams& rpc_params,
policy::CheckPermissionResult& result));
@@ -86,8 +104,9 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
uint32_t(const std::string& priority));
MOCK_CONST_METHOD1(GetUserConsentForDevice,
policy::DeviceConsent(const std::string& device_id));
- MOCK_CONST_METHOD2(GetDefaultHmi,
- bool(const std::string& policy_app_id,
+ MOCK_CONST_METHOD3(GetDefaultHmi,
+ bool(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi));
MOCK_METHOD3(GetInitialAppData,
@@ -98,21 +117,26 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
bool(const std::string& application_id,
policy::StringArray* nicknames));
MOCK_METHOD1(GetInitialAppData, bool(const std::string& application_id));
- MOCK_METHOD2(GetUpdateUrls,
- void(const uint32_t service_type,
- policy::EndpointUrls& end_points));
- MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type,
+ policy::EndpointUrls& end_points));
+ MOCK_CONST_METHOD1(GetLockScreenIconUrl,
+ std::string(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD0(ResetRetrySequence, void());
MOCK_METHOD0(NextRetryTimeout, uint32_t());
MOCK_CONST_METHOD0(TimeoutExchangeSec, uint32_t());
MOCK_CONST_METHOD0(TimeoutExchangeMSec, uint32_t());
MOCK_METHOD0(OnExceededTimeout, void());
- MOCK_METHOD0(OnSystemReady, void());
+ MOCK_CONST_METHOD0(LockScreenDismissalEnabledState,
+ const boost::optional<bool>());
+ MOCK_CONST_METHOD1(LockScreenDismissalWarningMessage,
+ const boost::optional<std::string>(const std::string&));
MOCK_METHOD2(PTUpdatedAt, void(policy::Counters counter, int value));
MOCK_METHOD1(add_listener, void(policy::PolicyHandlerObserver* listener));
MOCK_METHOD1(remove_listener, void(policy::PolicyHandlerObserver* listener));
MOCK_CONST_METHOD0(GetStatisticManager,
- utils::SharedPtr<usage_statistics::StatisticsManager>());
+ std::shared_ptr<usage_statistics::StatisticsManager>());
MOCK_CONST_METHOD2(CheckSystemAction,
bool(mobile_apis::SystemAction::eType system_action,
const std::string& policy_app_id));
@@ -122,8 +146,9 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_METHOD2(OnAllowSDLFunctionalityNotification,
void(bool is_allowed, const std::string& device_id));
MOCK_METHOD0(OnIgnitionCycleOver, void());
- MOCK_METHOD1(OnPendingPermissionChange,
- void(const std::string& policy_app_id));
+ MOCK_METHOD2(OnPendingPermissionChange,
+ void(const std::string& device_id,
+ const std::string& policy_app_id));
MOCK_METHOD1(PTExchangeAtUserRequest, void(uint32_t correlation_id));
MOCK_METHOD2(AddDevice,
void(const std::string& device_id,
@@ -151,20 +176,26 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
const uint32_t correlation_id));
MOCK_METHOD1(OnGetStatusUpdate, void(const uint32_t correlation_id));
MOCK_METHOD1(OnUpdateStatusChanged, void(const std::string& status));
- MOCK_METHOD1(OnCurrentDeviceIdUpdateRequired,
- std::string(const std::string& policy_app_id));
+ MOCK_METHOD2(OnCurrentDeviceIdUpdateRequired,
+ std::string(const transport_manager::DeviceHandle& device_handle,
+ const std::string& policy_app_id));
MOCK_METHOD1(OnSystemInfoChanged, void(const std::string& language));
MOCK_METHOD3(OnGetSystemInfo,
void(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
- MOCK_METHOD0(OnSystemInfoUpdateRequired, void());
MOCK_METHOD0(OnVIIsReady, void());
MOCK_METHOD1(OnVehicleDataUpdated,
void(const smart_objects::SmartObject& message));
MOCK_METHOD1(RemoveDevice, void(const std::string& device_id));
MOCK_METHOD1(AddStatisticsInfo, void(int type));
MOCK_METHOD1(OnSystemError, void(int code));
+#ifndef EXTERNAL_PROPRIETARY_MODE
+ MOCK_METHOD1(ChoosePTUApplication,
+ uint32_t(const policy::PTUIterationType iteration_type));
+ MOCK_METHOD2(CacheRetryInfo,
+ void(const uint32_t app_id, const std::string url));
+#endif
MOCK_CONST_METHOD0(GetAppIdForSending, uint32_t());
MOCK_METHOD1(
GetAppName,
@@ -173,18 +204,25 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
void(std::map<std::string, policy::StringArray> app_hmi_types));
MOCK_METHOD1(OnCertificateUpdated, void(const std::string& certificate_data));
MOCK_METHOD1(OnPTUFinished, void(const bool ptu_result));
+ MOCK_METHOD0(OnPTInited, void());
+ MOCK_METHOD0(StopRetrySequence, void());
MOCK_METHOD1(OnCertificateDecrypted, void(bool is_succeeded));
MOCK_METHOD0(CanUpdate, bool());
MOCK_METHOD2(OnDeviceConsentChanged,
void(const std::string& device_id, bool is_allowed));
- MOCK_CONST_METHOD2(SendOnAppPermissionsChanged,
+ MOCK_CONST_METHOD3(SendOnAppPermissionsChanged,
void(const policy::AppPermissions& permissions,
+ const std::string& device_id,
const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(SendOnAppPropertiesChangeNotification,
+ void(const std::string& policy_app_id));
MOCK_METHOD0(OnPTExchangeNeeded, void());
+ MOCK_METHOD0(TriggerPTUOnStartupIfRequired, void());
MOCK_METHOD1(GetAvailableApps, void(std::queue<std::string>& apps));
- MOCK_METHOD2(
+ MOCK_METHOD3(
AddApplication,
policy::StatusNotifier(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types));
MOCK_METHOD1(IsApplicationRevoked, bool(const std::string& app_id));
@@ -192,10 +230,14 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_CONST_METHOD1(HeartBeatTimeout, uint32_t(const std::string& app_id));
MOCK_METHOD0(OnAppsSearchStarted, void());
MOCK_METHOD1(OnAppsSearchCompleted, void(const bool trigger_ptu));
- MOCK_METHOD1(OnAppRegisteredOnMobile,
- void(const std::string& application_id));
- MOCK_CONST_METHOD2(IsRequestTypeAllowed,
- bool(const std::string& policy_app_id,
+ MOCK_METHOD2(OnAddedNewApplicationToAppList,
+ void(const uint32_t new_app_id, const std::string& policy_id));
+ MOCK_METHOD2(OnAppRegisteredOnMobile,
+ void(const std::string& device_id,
+ const std::string& application_id));
+ MOCK_CONST_METHOD3(IsRequestTypeAllowed,
+ bool(const transport_manager::DeviceHandle& device_handle,
+ const std::string& policy_app_id,
mobile_apis::RequestType::eType type));
MOCK_CONST_METHOD2(IsRequestSubTypeAllowed,
bool(const std::string& policy_app_id,
@@ -209,13 +251,46 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_CONST_METHOD1(
GetAppRequestSubTypes,
const std::vector<std::string>(const std::string& policy_app_id));
- MOCK_CONST_METHOD1(
- GetAppRequestTypes,
- const std::vector<std::string>(const std::string& policy_app_id));
- MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ MOCK_CONST_METHOD2(GetAppRequestTypes,
+ const std::vector<std::string>(
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string& policy_app_id));
+ MOCK_CONST_METHOD0(GetApplicationPolicyIDs, std::vector<std::string>());
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD1(CheckCloudAppEnabled,
+ const bool(const std::string& policy_app_id));
+ MOCK_CONST_METHOD0(GetEnabledLocalApps, std::vector<std::string>());
+ MOCK_CONST_METHOD2(GetAppProperties,
+ bool(const std::string& policy_app_id,
+ policy::AppProperties& out_app_properties));
+
+ MOCK_METHOD1(OnSetAppProperties,
+ void(const smart_objects::SmartObject& message));
+ MOCK_CONST_METHOD2(
+ GetAppPropertiesStatus,
+ AppPropertiesState(const smart_objects::SmartObject& properties,
+ const std::string& app_id));
+ MOCK_CONST_METHOD1(IsNewApplication, bool(const std::string& application_id));
+ MOCK_METHOD0(OnLocalAppAdded, void());
+ MOCK_METHOD1(OnSetCloudAppProperties,
+ void(const smart_objects::SmartObject& message));
+ MOCK_CONST_METHOD2(
+ GetAppServiceParameters,
+ void(const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters));
+ MOCK_CONST_METHOD4(CheckAppServiceParameters,
+ bool(const std::string& policy_app_id,
+ const std::string& requested_service_name,
+ const std::string& requested_service_type,
+ smart_objects::SmartArray* requested_handled_rpcs));
+ MOCK_CONST_METHOD1(UnknownRPCPassthroughAllowed,
+ bool(const std::string& policy_app_id));
#ifdef EXTERNAL_PROPRIETARY_MODE
MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
+ MOCK_METHOD0(IncrementRetryIndex, void());
+ MOCK_CONST_METHOD0(ptu_retry_handler, policy::PTURetryHandler&());
#endif // EXTERNAL_PROPRIETARY_MODE
MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
@@ -235,9 +310,9 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
#endif // ENABLE_SECURITY
MOCK_CONST_METHOD0(get_settings, const policy::PolicySettings&());
MOCK_CONST_METHOD0(RemoteAppsUrl, const std::string());
- MOCK_METHOD2(GetUpdateUrls,
- void(const std::string& service_type,
- policy::EndpointUrls& end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ policy::EndpointUrls& end_points));
MOCK_METHOD3(OnUpdateHMILevel,
void(const std::string& device_id,
@@ -260,16 +335,20 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
void(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level));
+ MOCK_METHOD0(OnPTUTimeOut, void());
MOCK_CONST_METHOD2(GetModuleTypes,
bool(const std::string& policy_app_id,
std::vector<std::string>* modules));
- MOCK_METHOD2(SetDefaultHmiTypes,
- void(const std::string& application_id,
+ MOCK_METHOD3(SetDefaultHmiTypes,
+ void(const transport_manager::DeviceHandle& device_handle,
+ const std::string& application_id,
const smart_objects::SmartObject* app_types));
MOCK_METHOD2(OnDeviceSwitching,
void(const std::string& device_id_from,
const std::string& device_id_to));
+ MOCK_CONST_METHOD0(OnSystemRequestReceived, void());
+
private:
#ifdef EXTERNAL_PROPRIETARY_MODE
MOCK_METHOD3(OnAppPermissionConsentInternal,
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h b/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
index e8ed0e90e2..43e4983368 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
@@ -37,8 +37,8 @@
#include <string>
#include <vector>
-#include "gmock/gmock.h"
#include "application_manager/policies/policy_handler_observer.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
@@ -49,6 +49,9 @@ class MockPolicyHandlerObserver : public ::policy::PolicyHandlerObserver {
MOCK_METHOD1(OnUpdateHMIAppType,
void(std::map<std::string, std::vector<std::string> >));
MOCK_METHOD1(OnCertificateUpdated, bool(const std::string&));
+ MOCK_METHOD2(OnAuthTokenUpdated,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
MOCK_METHOD1(OnPTUFinished, void(const bool ptu_result));
};
} // namespace application_manager_test
diff --git a/src/components/include/test/connection_handler/mock_connection_handler.h b/src/components/include/test/connection_handler/mock_connection_handler.h
index f1416c999e..6acffea0ed 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler.h
@@ -33,24 +33,25 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_H_
#define SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_H_
-#include <string>
#include <list>
+#include <string>
#include <vector>
-#include "gmock/gmock.h"
#include "connection_handler/connection_handler.h"
#include "connection_handler/connection_handler_observer.h"
-#include "connection_handler/devices_discovery_starter.h"
#include "connection_handler/connection_handler_settings.h"
+#include "connection_handler/devices_discovery_starter.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
namespace connection_handler_test {
+using connection_handler::CloseSessionReason;
using connection_handler::ConnectionHandle;
using connection_handler::DeviceHandle;
-using connection_handler::CloseSessionReason;
using connection_handler::DevicesDiscoveryStarter;
+using connection_handler::SessionTransports;
class MockConnectionHandler : public connection_handler::ConnectionHandler {
public:
@@ -59,12 +60,23 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler {
MOCK_METHOD0(StartTransportManager, void());
MOCK_METHOD1(ConnectToDevice,
void(connection_handler::DeviceHandle device_handle));
+ MOCK_CONST_METHOD1(
+ GetConnectionStatus,
+ transport_manager::ConnectionStatus(const DeviceHandle& device_handle));
MOCK_CONST_METHOD2(RunAppOnDevice,
void(const std::string&, const std::string&));
MOCK_METHOD0(ConnectToAllDevices, void());
+ MOCK_METHOD2(
+ AddCloudAppDevice,
+ void(const std::string& policy_app_id,
+ const transport_manager::transport_adapter::CloudAppProperties&));
+ MOCK_METHOD1(RemoveCloudAppDevice, void(const DeviceHandle device_id));
MOCK_METHOD1(CloseRevokedConnection, void(uint32_t connection_key));
MOCK_METHOD1(CloseConnection, void(ConnectionHandle connection_handle));
MOCK_METHOD1(GetConnectionSessionsCount, uint32_t(uint32_t connection_key));
+ MOCK_CONST_METHOD1(
+ GetCloudAppID,
+ std::string(const transport_manager::ConnectionUID connection_id));
MOCK_METHOD2(GetDeviceID,
bool(const std::string& mac_address,
DeviceHandle* device_handle));
@@ -84,13 +96,6 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler {
void(uint32_t connection_key, uint8_t session_id));
MOCK_METHOD2(BindProtocolVersionWithSession,
void(uint32_t connection_key, uint8_t protocol_version));
-
- // DEPRECATED
- MOCK_CONST_METHOD4(GetDataOnSessionKey,
- int32_t(uint32_t key,
- uint32_t* app_id,
- std::list<int32_t>* sessions_list,
- uint32_t* device_id));
MOCK_CONST_METHOD4(GetDataOnSessionKey,
int32_t(uint32_t key,
uint32_t* app_id,
@@ -103,10 +108,33 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler {
MOCK_METHOD0(get_device_discovery_starter, DevicesDiscoveryStarter&());
MOCK_CONST_METHOD1(GetConnectedDevicesMAC,
void(std::vector<std::string>& macs));
+ MOCK_METHOD1(
+ AddSession,
+ uint32_t(const transport_manager::ConnectionUID primary_transport_id));
+ MOCK_METHOD1(RemoveSession, bool(uint8_t session_id));
+ MOCK_METHOD0(session_connection_map,
+ DataAccessor<connection_handler::SessionConnectionMap>());
+ MOCK_METHOD2(SetSecondaryTransportID,
+ SessionTransports(
+ uint8_t session_id,
+ transport_manager::ConnectionUID secondary_transport_id));
+ MOCK_CONST_METHOD1(GetSessionTransports,
+ const SessionTransports(uint8_t session_id));
MOCK_METHOD3(NotifyServiceStartedResult,
void(uint32_t session_key,
bool result,
std::vector<std::string>& rejected_params));
+ MOCK_METHOD3(
+ OnSecondaryTransportStarted,
+ bool(transport_manager::ConnectionUID& primary_connection_handle,
+ const transport_manager::ConnectionUID secondary_connection_handle,
+ const uint8_t session_id));
+ MOCK_METHOD2(
+ OnSecondaryTransportEnded,
+ void(const transport_manager::ConnectionUID primary_connection_handle,
+ const transport_manager::ConnectionUID secondary_connection_handle));
+ MOCK_METHOD0(CreateWebEngineDevice, void());
+ MOCK_CONST_METHOD0(GetWebEngineDeviceInfo, transport_manager::DeviceInfo&());
};
} // namespace connection_handler_test
diff --git a/src/components/include/test/connection_handler/mock_connection_handler_observer.h b/src/components/include/test/connection_handler/mock_connection_handler_observer.h
index a96498028d..61877daa23 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler_observer.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler_observer.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_OBSERVER_H_
#define SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_OBSERVER_H_
-#include "gmock/gmock.h"
#include "connection_handler/connection_handler_observer.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
@@ -46,13 +46,9 @@ class MockConnectionHandlerObserver
MOCK_METHOD1(OnDeviceListUpdated,
void(const connection_handler::DeviceMap& device_list));
MOCK_METHOD0(OnFindNewApplicationsRequest, void());
+ MOCK_METHOD0(OnWebEngineDeviceCreated, void());
MOCK_METHOD1(RemoveDevice,
void(const connection_handler::DeviceHandle& device_handle));
- DEPRECATED MOCK_METHOD3(
- OnServiceStartedCallback,
- bool(const connection_handler::DeviceHandle& device_handle,
- const int32_t& session_key,
- const protocol_handler::ServiceType& type));
MOCK_METHOD4(OnServiceStartedCallback,
void(const connection_handler::DeviceHandle& device_handle,
const int32_t& session_key,
@@ -74,6 +70,19 @@ class MockConnectionHandlerObserver
const connection_handler::Device& device_to));
MOCK_METHOD1(OnDeviceSwitchingFinish, void(const std::string& device_uid));
MOCK_CONST_METHOD1(CheckAppIsNavi, bool(const uint32_t app_id));
+ MOCK_METHOD2(OnSecondaryTransportStartedCallback,
+ void(const connection_handler::DeviceHandle device_handle,
+ const int32_t session_key));
+ MOCK_METHOD1(OnSecondaryTransportEndedCallback,
+ void(const int32_t session_key));
+ MOCK_METHOD0(OnConnectionStatusUpdated, void());
+ MOCK_METHOD3(CreatePendingApplication,
+ void(const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info,
+ connection_handler::DeviceHandle device_id));
+ MOCK_METHOD2(SetPendingApplicationState,
+ void(const transport_manager::ConnectionUID connection_id,
+ const transport_manager::DeviceInfo& device_info));
};
} // namespace connection_handler_test
diff --git a/src/components/include/test/connection_handler/mock_connection_handler_settings.h b/src/components/include/test/connection_handler/mock_connection_handler_settings.h
index c813455698..38bd41e431 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler_settings.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler_settings.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_SETTINGS_H_
#include <vector>
-#include "gmock/gmock.h"
#include "connection_handler/connection_handler_settings.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
diff --git a/src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h b/src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h
index 859d164231..221b353a51 100644
--- a/src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h
+++ b/src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_OBSERVER_H_
#include "gmock/gmock.h"
-#include "utils/singleton.h"
#include "hmi_message_handler/hmi_message_observer.h"
+#include "utils/singleton.h"
namespace test {
namespace components {
@@ -45,9 +45,9 @@ class MockHMIMessageObserver : public hmi_message_handler::HMIMessageObserver,
public utils::Singleton<MockHMIMessageObserver> {
public:
MOCK_METHOD1(OnMessageReceived,
- void(utils::SharedPtr<application_manager::Message> message));
+ void(std::shared_ptr<application_manager::Message> message));
MOCK_METHOD1(OnErrorSending,
- void(utils::SharedPtr<application_manager::Message> message));
+ void(std::shared_ptr<application_manager::Message> message));
virtual ~MockHMIMessageObserver() {}
};
diff --git a/src/components/include/test/media_manager/mock_media_manager.h b/src/components/include/test/media_manager/mock_media_manager.h
index b58cfab5d7..aa0baa5682 100644
--- a/src/components/include/test/media_manager/mock_media_manager.h
+++ b/src/components/include/test/media_manager/mock_media_manager.h
@@ -57,6 +57,7 @@ class MockMediaManager : public media_manager::MediaManager {
MOCK_METHOD2(FramesProcessed,
void(int32_t application_key, int32_t frame_number));
MOCK_CONST_METHOD0(settings, const media_manager::MediaManagerSettings&());
+ MOCK_CONST_METHOD1(DataSizeToMilliseconds, uint32_t(uint64_t data_size));
};
} // namespace media_manager_test
diff --git a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
index 02931114f0..c7a6e3d50a 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
@@ -57,9 +57,11 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
const PTString& hmi_level,
const PTString& rpc,
CheckPermissionResult& result));
+ MOCK_CONST_METHOD0(pt, std::shared_ptr<policy_table::Table>());
MOCK_METHOD0(IsPTPreloaded, bool());
MOCK_METHOD0(IgnitionCyclesBeforeExchange, int());
MOCK_METHOD1(KilometersBeforeExchange, int(int current));
+ MOCK_CONST_METHOD0(GetEnabledLocalApps, std::vector<std::string>());
MOCK_CONST_METHOD1(GetPermissionsList, bool(StringArray& perm_list));
MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate,
bool(Counters counter, int value));
@@ -75,7 +77,44 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_METHOD0(TimeoutResponse, int());
MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>& seconds));
MOCK_CONST_METHOD1(IsDeviceConsentCached, bool(const std::string& device_id));
- MOCK_CONST_METHOD0(GetVehicleInfo, const VehicleInfo());
+ MOCK_CONST_METHOD0(GetPolicyTableData, Json::Value());
+ MOCK_CONST_METHOD0(GetVehicleDataItems,
+ const std::vector<policy_table::VehicleDataItem>());
+ MOCK_CONST_METHOD0(GetRemovedVehicleDataItems,
+ std::vector<policy_table::VehicleDataItem>());
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD2(GetAppProperties,
+ bool(const std::string& policy_app_id,
+ AppProperties& out_app_properties));
+ MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id));
+ MOCK_METHOD2(SetCloudAppEnabled,
+ void(const std::string& policy_app_id, const bool enabled));
+ MOCK_METHOD2(SetAppAuthToken,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
+ MOCK_METHOD2(SetAppCloudTransportType,
+ void(const std::string& policy_app_id,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
+ MOCK_CONST_METHOD2(
+ GetAppServiceParameters,
+ void(const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters));
+ MOCK_CONST_METHOD1(UnknownRPCPassthroughAllowed,
+ bool(const std::string& policy_app_id));
+ MOCK_CONST_METHOD0(LockScreenDismissalEnabledState,
+ const boost::optional<bool>());
+ MOCK_CONST_METHOD1(LockScreenDismissalWarningMessage,
+ const boost::optional<std::string>(const std::string&));
MOCK_CONST_METHOD1(GetDeviceConsent,
DeviceConsent(const std::string& device_id));
MOCK_METHOD2(SetDeviceConsent,
@@ -86,17 +125,18 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_CONST_METHOD1(GetCachedDeviceConsent,
DeviceConsent(const std::string& device_id));
MOCK_METHOD1(SetVINValue, bool(const std::string& value));
- MOCK_METHOD3(GetUserFriendlyMsg,
- std::vector<UserFriendlyMessage>(
- const std::vector<std::string>& msg_codes,
- const std::string& language,
- const std::string& active_hmi_language));
- MOCK_METHOD2(GetUpdateUrls,
- void(const std::string& service_type,
- EndpointUrls& out_end_points));
- MOCK_METHOD2(GetUpdateUrls,
- void(const uint32_t service_type, EndpointUrls& out_end_points));
- MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD3(GetUserFriendlyMsg,
+ std::vector<UserFriendlyMessage>(
+ const std::vector<std::string>& msg_codes,
+ const std::string& language,
+ const std::string& active_hmi_language));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type,
+ EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD1(
GetNotificationsNumber,
policy_table::NumberOfNotificationsType(const std::string& priority));
@@ -106,7 +146,7 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
MOCK_METHOD2(Init,
bool(const std::string& file_name,
const PolicySettings* settings));
- MOCK_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>());
+ MOCK_METHOD0(GenerateSnapshot, std::shared_ptr<policy_table::Table>());
MOCK_METHOD1(ApplyUpdate, bool(const policy_table::Table& update_pt));
MOCK_METHOD1(Save, bool(const policy_table::Table& table));
MOCK_CONST_METHOD0(UpdateRequired, bool());
@@ -231,7 +271,7 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
bool(const std::string& device_id,
const std::string& policy_app_id,
policy::Permissions& permission));
- MOCK_CONST_METHOD0(GetPT, utils::SharedPtr<policy_table::Table>());
+ MOCK_CONST_METHOD0(GetPT, std::shared_ptr<policy_table::Table>());
MOCK_CONST_METHOD0(GetMetaInfo, const MetaInfo());
MOCK_CONST_METHOD0(GetCertificate, std::string());
MOCK_METHOD1(SetDecryptedCertificate, void(const std::string&));
@@ -257,6 +297,19 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
RequestType::State(const std::string& policy_app_id));
MOCK_CONST_METHOD1(GetAppRequestSubTypesState,
RequestSubType::State(const std::string& policy_app_id));
+
+ MOCK_CONST_METHOD1(
+ GetAppEncryptionRequiredFlag,
+ rpc::Optional<rpc::Boolean>(const std::string& application_policy_name));
+
+ MOCK_CONST_METHOD1(
+ GetFunctionalGroupingEncryptionRequiredFlag,
+ rpc::Optional<rpc::Boolean>(const std::string& functional_group));
+
+ MOCK_CONST_METHOD2(GetApplicationParams,
+ void(const std::string& application_name,
+ policy_table::ApplicationParams& application_params));
+ MOCK_CONST_METHOD0(GetPolicyAppIDs, const policy_table::Strings());
};
} // namespace policy_test
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
index 1f570d8699..62dfdf4058 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
@@ -32,16 +32,17 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_LISTENER_H_
#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_LISTENER_H_
-#include <string>
#include <map>
#include <queue>
+#include <string>
#include <vector>
#include "gmock/gmock.h"
+#include "utils/macro.h"
#include "policy/policy_listener.h"
-#include "rpc_base/rpc_base.h"
#include "policy/policy_table/types.h"
+#include "rpc_base/rpc_base.h"
#include "utils/custom_string.h"
namespace policy_table = ::rpc::policy_table_interface_base;
@@ -54,19 +55,22 @@ namespace custom_str = utils::custom_string;
class MockPolicyListener : public ::policy::PolicyListener {
public:
- MOCK_METHOD3(OnPermissionsUpdated,
- void(const std::string& policy_app_id,
+ MOCK_METHOD4(OnPermissionsUpdated,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
const policy::Permissions& permissions,
const policy::HMILevel& default_hmi));
- MOCK_METHOD2(OnPermissionsUpdated,
- void(const std::string& policy_app_id,
+ MOCK_METHOD3(OnPermissionsUpdated,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
const policy::Permissions& permissions));
- MOCK_METHOD1(OnPendingPermissionChange,
- void(const std::string& policy_app_id));
+ MOCK_METHOD2(OnPendingPermissionChange,
+ void(const std::string& device_id,
+ const std::string& policy_app_id));
MOCK_METHOD1(OnUpdateStatusChanged, void(const std::string& status));
- MOCK_METHOD1(OnCurrentDeviceIdUpdateRequired,
- std::string(const std::string& policy_app_id));
- MOCK_METHOD0(OnSystemInfoUpdateRequired, void());
+ MOCK_METHOD2(OnCurrentDeviceIdUpdateRequired,
+ std::string(const transport_manager::DeviceHandle& device_handle,
+ const std::string& policy_app_id));
MOCK_METHOD1(GetAppName,
custom_str::CustomString(const std::string& policy_app_id));
MOCK_METHOD0(OnUserRequestedUpdateCheckRequired, void());
@@ -81,11 +85,19 @@ class MockPolicyListener : public ::policy::PolicyListener {
uint32_t timeout_exceed));
MOCK_METHOD0(CanUpdate, bool());
MOCK_METHOD1(OnCertificateUpdated, void(const std::string&));
+ MOCK_METHOD2(OnAuthTokenUpdated,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
MOCK_METHOD1(OnPTUFinished, void(const bool ptu_result));
- MOCK_CONST_METHOD2(SendOnAppPermissionsChanged,
- void(const policy::AppPermissions&, const std::string&));
- MOCK_METHOD1(GetDevicesIds,
- std::vector<std::string>(const std::string& policy_app_id));
+ MOCK_CONST_METHOD3(SendOnAppPermissionsChanged,
+ void(const policy::AppPermissions& permissions,
+ const std::string& device_id,
+ const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(SendOnAppPropertiesChangeNotification,
+ void(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(
+ GetDevicesIds,
+ std::vector<std::string>(const std::string& policy_app_id));
MOCK_METHOD3(OnUpdateHMILevel,
void(const std::string& device_id,
const std::string& policy_app_id,
@@ -100,6 +112,10 @@ class MockPolicyListener : public ::policy::PolicyListener {
void(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level));
+ MOCK_METHOD0(OnLockScreenDismissalStateChanged, void());
+ MOCK_METHOD1(OnCertDecryptFinished, void(bool));
+ MOCK_METHOD0(IncrementRetryIndex, void());
+ MOCK_CONST_METHOD0(ptu_retry_handler, policy::PTURetryHandler&());
};
} // namespace policy_test
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
index ea259fc916..bf092d38e8 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
@@ -40,9 +40,9 @@
#include "policy/policy_types.h"
#include "policy/usage_statistics/statistics_manager.h"
-#include "rpc_base/rpc_base.h"
-#include "policy/policy_table/types.h"
#include "policy/policy_manager.h"
+#include "policy/policy_table/types.h"
+#include "rpc_base/rpc_base.h"
namespace policy_table = ::rpc::policy_table_interface_base;
@@ -54,22 +54,43 @@ namespace policy_manager_test {
class MockPolicyManager : public PolicyManager {
public:
+ MOCK_CONST_METHOD1(AppNeedEncryption, bool(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(
+ GetFunctionalGroupsForApp,
+ const std::vector<std::string>(const std::string& policy_app_id));
+ MOCK_CONST_METHOD0(GetApplicationPolicyIDs, const std::vector<std::string>());
+ MOCK_CONST_METHOD2(FunctionNeedEncryption,
+ bool(const std::string& policy_group,
+ const std::string& policy_function_id));
+ MOCK_CONST_METHOD1(FunctionGroupNeedEncryption,
+ bool(const std::string& policy_group));
+ MOCK_CONST_METHOD1(
+ GetAppEncryptionRequired,
+ const rpc::Optional<rpc::Boolean>(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(GetRPCsForFunctionGroup,
+ const std::vector<std::string>(const std::string& group));
+ MOCK_CONST_METHOD1(GetPolicyFunctionName,
+ const std::string(const uint32_t function_id));
MOCK_METHOD1(set_listener, void(PolicyListener* listener));
MOCK_METHOD2(InitPT,
bool(const std::string& file_name,
const PolicySettings* settings));
MOCK_METHOD2(LoadPT,
- bool(const std::string& file, const BinaryMessage& pt_content));
+ PtProcessingResult(const std::string& file,
+ const BinaryMessage& pt_content));
+ MOCK_METHOD1(OnPTUFinished, void(const PtProcessingResult ptu_result));
MOCK_METHOD1(ResetPT, bool(const std::string& file_name));
MOCK_METHOD1(GetUpdateUrl, std::string(int service_type));
- MOCK_METHOD2(GetUpdateUrls,
- void(const uint32_t service_type, EndpointUrls& out_end_points));
- MOCK_METHOD2(GetUpdateUrls,
- void(const std::string& service_type,
- EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type,
+ EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
MOCK_METHOD0(RequestPTUpdate, void());
- MOCK_METHOD5(CheckPermissions,
- void(const PTString& app_id,
+ MOCK_METHOD6(CheckPermissions,
+ void(const PTString& device_id,
+ const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
const RPCParams& rpc_params,
@@ -77,10 +98,16 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD0(ResetUserConsent, bool());
MOCK_CONST_METHOD0(GetPolicyTableStatus, std::string());
MOCK_METHOD1(KmsChanged, void(int kilometers));
+ MOCK_CONST_METHOD0(LockScreenDismissalEnabledState,
+ const boost::optional<bool>());
+ MOCK_CONST_METHOD1(LockScreenDismissalWarningMessage,
+ const boost::optional<std::string>(const std::string&));
MOCK_METHOD0(IncrementIgnitionCycles, void());
MOCK_METHOD0(ForcePTExchange, std::string());
MOCK_METHOD0(ForcePTExchangeAtUserRequest, std::string());
- MOCK_METHOD0(ResetRetrySequence, void());
+ MOCK_METHOD0(StopRetrySequence, void());
+ MOCK_METHOD1(ResetRetrySequence,
+ void(const policy::ResetRetryCountType send_event));
MOCK_METHOD0(NextRetryTimeout, int());
MOCK_METHOD0(TimeoutExchangeMSec, uint32_t());
MOCK_METHOD0(RetrySequenceDelaysSeconds, const std::vector<int>());
@@ -95,8 +122,10 @@ class MockPolicyManager : public PolicyManager {
std::vector<policy::FunctionalGroupPermission>& permissions));
MOCK_METHOD2(SetUserConsentForDevice,
void(const std::string& device_id, const bool is_allowed));
- MOCK_METHOD2(ReactOnUserDevConsentForApp,
- bool(const std::string& app_id, bool is_device_allowed));
+ MOCK_METHOD3(ReactOnUserDevConsentForApp,
+ bool(const transport_manager::DeviceHandle& device_handle,
+ const std::string& app_id,
+ bool is_device_allowed));
MOCK_METHOD2(PTUpdatedAt, void(policy::Counters counter, int value));
MOCK_METHOD3(GetInitialAppData,
@@ -113,8 +142,9 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD2(SetUserConsentForApp,
void(const policy::PermissionConsent& permissions,
const policy::PolicyManager::NotificationMode mode));
- MOCK_CONST_METHOD2(GetDefaultHmi,
- bool(const std::string& policy_app_id,
+ MOCK_CONST_METHOD3(GetDefaultHmi,
+ bool(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi));
MOCK_CONST_METHOD2(GetPriority,
bool(const std::string& policy_app_id,
@@ -130,26 +160,32 @@ class MockPolicyManager : public PolicyManager {
void(const std::string& device_id,
const std::string& policy_app_id,
std::vector<policy::FunctionalGroupPermission>& permissions));
- MOCK_METHOD1(GetAppPermissionsChanges,
- policy::AppPermissions(const std::string& policy_app_id));
+ MOCK_METHOD2(GetAppPermissionsChanges,
+ policy::AppPermissions(const std::string& device_id,
+ const std::string& policy_app_id));
MOCK_METHOD1(RemovePendingPermissionChanges, void(const std::string& app_id));
- MOCK_CONST_METHOD1(GetCurrentDeviceId,
- std::string&(const std::string& policy_app_id));
+ MOCK_CONST_METHOD2(
+ GetCurrentDeviceId,
+ std::string&(const transport_manager::DeviceHandle& device_handle,
+ const std::string& policy_app_id));
MOCK_METHOD1(SetSystemLanguage, void(const std::string& language));
MOCK_METHOD3(SetSystemInfo,
void(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
- MOCK_METHOD1(SendNotificationOnPermissionsUpdated,
- void(const std::string& application_id));
+ MOCK_METHOD2(SendNotificationOnPermissionsUpdated,
+ void(const std::string& device_id,
+ const std::string& application_id));
MOCK_METHOD1(MarkUnpairedDevice, void(const std::string& device_id));
- MOCK_METHOD2(
+ MOCK_METHOD3(
AddApplication,
StatusNotifier(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types));
- MOCK_METHOD2(SetDefaultHmiTypes,
- void(const std::string& application_id,
+ MOCK_METHOD3(SetDefaultHmiTypes,
+ void(const transport_manager::DeviceHandle& device_handle,
+ const std::string& application_id,
const std::vector<int>& hmi_types));
MOCK_METHOD2(GetHMITypes,
bool(const std::string& application_id,
@@ -159,16 +195,17 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD2(SendAppPermissionsChanged,
void(const std::string& device_id,
const std::string& application_id));
+ MOCK_CONST_METHOD1(SendOnAppPropertiesChangeNotification,
+ void(const std::string& application_id));
MOCK_CONST_METHOD2(GetModuleTypes,
bool(const std::string& policy_app_id,
std::vector<std::string>* modules));
MOCK_METHOD1(set_access_remote,
- void(utils::SharedPtr<AccessRemote> access_remote));
+ void(std::shared_ptr<AccessRemote> access_remote));
MOCK_METHOD0(CleanupUnpairedDevices, bool());
MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
- MOCK_METHOD0(OnSystemReady, void());
MOCK_CONST_METHOD1(GetNotificationsNumber,
uint32_t(const std::string& priority));
MOCK_METHOD1(SetVINValue, void(const std::string& value));
@@ -177,13 +214,52 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD1(SaveUpdateStatusRequired, void(bool is_update_needed));
MOCK_METHOD0(OnAppsSearchStarted, void());
MOCK_METHOD1(OnAppsSearchCompleted, void(const bool trigger_ptu));
- MOCK_METHOD1(OnAppRegisteredOnMobile,
- void(const std::string& application_id));
- MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
- MOCK_CONST_METHOD1(
- GetAppRequestTypes,
- const std::vector<std::string>(const std::string policy_app_id));
- MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ MOCK_METHOD1(UpdatePTUReadyAppsCount, void(const uint32_t new_app_count));
+ MOCK_METHOD2(OnAppRegisteredOnMobile,
+ void(const std::string& device_id,
+ const std::string& application_id));
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
+ MOCK_CONST_METHOD2(GetAppRequestTypes,
+ const std::vector<std::string>(
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string policy_app_id));
+ MOCK_CONST_METHOD0(GetPolicyTableData, Json::Value());
+ MOCK_CONST_METHOD0(GetVehicleDataItems,
+ const std::vector<policy_table::VehicleDataItem>());
+ MOCK_CONST_METHOD0(GetRemovedVehicleDataItems,
+ std::vector<policy_table::VehicleDataItem>());
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD2(GetAppProperties,
+ bool(const std::string& policy_app_id,
+ AppProperties& out_app_properties));
+ MOCK_CONST_METHOD0(GetEnabledLocalApps, std::vector<std::string>());
+ MOCK_CONST_METHOD1(IsNewApplication, bool(const std::string& application_id));
+ MOCK_METHOD0(OnLocalAppAdded, void());
+ MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id));
+ MOCK_METHOD2(SetCloudAppEnabled,
+ void(const std::string& policy_app_id, const bool enabled));
+ MOCK_METHOD2(SetAppAuthToken,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
+ MOCK_METHOD2(SetAppCloudTransportType,
+ void(const std::string& policy_app_id,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
+ MOCK_CONST_METHOD2(
+ GetAppServiceParameters,
+ void(const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters));
+ MOCK_CONST_METHOD1(UnknownRPCPassthroughAllowed,
+ bool(const std::string& policy_app_id));
MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
MOCK_CONST_METHOD0(RetrieveCertificate, std::string());
MOCK_CONST_METHOD0(HasCertificate, bool());
@@ -223,6 +299,12 @@ class MockPolicyManager : public PolicyManager {
RequestType::State(const std::string& policy_app_id));
MOCK_CONST_METHOD1(GetAppRequestSubTypesState,
RequestSubType::State(const std::string& policy_app_id));
+ MOCK_METHOD0(IncrementPTURetryIndex, void());
+ MOCK_CONST_METHOD0(IsAllowedPTURetryCountExceeded, bool());
+ MOCK_CONST_METHOD0(IsAllowedRetryCountExceeded, bool());
+ MOCK_METHOD0(OnSystemRequestReceived, void());
+ MOCK_METHOD0(RetrySequenceFailed, void());
+ MOCK_METHOD0(ResetTimeout, void());
};
} // namespace policy_manager_test
} // namespace components
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_settings.h b/src/components/include/test/policy/policy_external/policy/mock_policy_settings.h
index eafc1df4fe..16239bfb76 100644
--- a/src/components/include/test/policy/policy_external/policy/mock_policy_settings.h
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_settings.h
@@ -32,8 +32,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_SETTINGS_H_
#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_SETTINGS_H_
-#include "gmock/gmock.h"
#include <string>
+#include "gmock/gmock.h"
#include "policy/policy_settings.h"
namespace test {
@@ -49,9 +49,10 @@ class MockPolicySettings : public ::policy::PolicySettings {
MOCK_CONST_METHOD0(open_attempt_timeout_ms, uint16_t());
MOCK_CONST_METHOD0(policies_snapshot_file_name, const std::string&());
MOCK_CONST_METHOD0(system_files_path, const std::string&());
+ MOCK_CONST_METHOD0(use_full_app_id, bool());
};
-} // namespace policy_test
+} // namespace policy_handler_test
} // namespace components
} // namespace test
diff --git a/src/components/include/test/policy/policy_external/policy/mock_ptu_retry_handler.h b/src/components/include/test/policy/policy_external/policy/mock_ptu_retry_handler.h
new file mode 100644
index 0000000000..d76c791b85
--- /dev/null
+++ b/src/components/include/test/policy/policy_external/policy/mock_ptu_retry_handler.h
@@ -0,0 +1,48 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_MOCK_PTU_RETRY_HANDLER_H_
+#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_MOCK_PTU_RETRY_HANDLER_H_
+
+#include "policy/ptu_retry_handler.h"
+
+namespace policy {
+
+class MockPTURetryHandler : public PTURetryHandler {
+ public:
+ MOCK_CONST_METHOD0(IsAllowedRetryCountExceeded, bool());
+ MOCK_METHOD0(OnSystemRequestReceived, void());
+ MOCK_METHOD0(RetrySequenceFailed, void());
+};
+} // namespace policy
+
+#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_MOCK_PTU_RETRY_HANDLER_H_ \ No newline at end of file
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
index d216957eb0..d8e13b4b2e 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
@@ -55,6 +55,7 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_METHOD0(IsPTPreloaded, bool());
MOCK_METHOD0(IgnitionCyclesBeforeExchange, int());
MOCK_METHOD1(KilometersBeforeExchange, int(int current));
+ MOCK_CONST_METHOD0(GetEnabledLocalApps, std::vector<std::string>());
MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate,
bool(Counters counter, int value));
MOCK_METHOD1(DaysBeforeExchange, int(int current));
@@ -62,29 +63,66 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_METHOD0(ResetIgnitionCycles, void());
MOCK_METHOD0(TimeoutResponse, int());
MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>& seconds));
- MOCK_CONST_METHOD0(GetVehicleInfo, const VehicleInfo());
+ MOCK_CONST_METHOD0(GetPolicyTableData, Json::Value());
+ MOCK_CONST_METHOD0(GetVehicleDataItems,
+ const std::vector<policy_table::VehicleDataItem>());
+ MOCK_CONST_METHOD0(GetRemovedVehicleDataItems,
+ std::vector<policy_table::VehicleDataItem>());
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD2(GetAppProperties,
+ bool(const std::string& policy_app_id,
+ AppProperties& out_app_properties));
+ MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id));
+ MOCK_METHOD2(SetCloudAppEnabled,
+ void(const std::string& policy_app_id, const bool enabled));
+ MOCK_METHOD2(SetAppAuthToken,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
+ MOCK_METHOD2(SetAppCloudTransportType,
+ void(const std::string& policy_app_id,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
+ MOCK_CONST_METHOD0(LockScreenDismissalEnabledState,
+ const boost::optional<bool>());
+ MOCK_CONST_METHOD1(LockScreenDismissalWarningMessage,
+ const boost::optional<std::string>(const std::string&));
MOCK_METHOD1(SetVINValue, bool(const std::string& value));
- MOCK_METHOD2(GetUserFriendlyMsg,
- std::vector<UserFriendlyMessage>(
- const std::vector<std::string>& msg_codes,
- const std::string& language));
-
+ MOCK_CONST_METHOD2(GetUserFriendlyMsg,
+ std::vector<UserFriendlyMessage>(
+ const std::vector<std::string>& msg_codes,
+ const std::string& language));
+ MOCK_CONST_METHOD2(
+ GetAppServiceParameters,
+ void(const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters));
+ MOCK_CONST_METHOD1(UnknownRPCPassthroughAllowed,
+ bool(const std::string& policy_app_id));
MOCK_METHOD1(
GetNotificationsNumber,
policy_table::NumberOfNotificationsType(const std::string& priority));
MOCK_CONST_METHOD2(GetPriority,
bool(const std::string& policy_app_id,
std::string& priority));
- MOCK_METHOD2(GetUpdateUrls,
- void(const std::string& service_type,
- EndpointUrls& out_end_points));
- MOCK_METHOD2(GetUpdateUrls,
- void(const uint32_t service_type, EndpointUrls& out_end_points));
- MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type,
+ EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD2(Init,
bool(const std::string& file_name,
const PolicySettings* settings));
- MOCK_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>());
+ MOCK_METHOD0(GenerateSnapshot, std::shared_ptr<policy_table::Table>());
MOCK_METHOD1(ApplyUpdate, bool(const policy_table::Table& update_pt));
MOCK_METHOD1(Save, bool(const policy_table::Table& table));
MOCK_CONST_METHOD0(UpdateRequired, bool());
@@ -202,7 +240,7 @@ class MockCacheManagerInterface : public CacheManagerInterface {
bool(const std::string& device_id,
const std::string& policy_app_id,
policy::Permissions& permission));
- MOCK_CONST_METHOD0(pt, utils::SharedPtr<policy_table::Table>());
+ MOCK_CONST_METHOD0(pt, std::shared_ptr<policy_table::Table>());
MOCK_METHOD1(GetHMITypes,
const policy_table::AppHMITypes*(const std::string& app_id));
MOCK_CONST_METHOD0(GetCertificate, std::string());
@@ -220,6 +258,19 @@ class MockCacheManagerInterface : public CacheManagerInterface {
RequestType::State(const std::string& policy_app_id));
MOCK_CONST_METHOD1(GetAppRequestSubTypesState,
RequestSubType::State(const std::string& policy_app_id));
+
+ MOCK_CONST_METHOD1(
+ GetAppEncryptionRequiredFlag,
+ rpc::Optional<rpc::Boolean>(const std::string& application_policy_name));
+
+ MOCK_CONST_METHOD1(
+ GetFunctionalGroupingEncryptionRequiredFlag,
+ rpc::Optional<rpc::Boolean>(const std::string& functional_group));
+
+ MOCK_CONST_METHOD2(GetApplicationParams,
+ void(const std::string& application_name,
+ policy_table::ApplicationParams& application_params));
+ MOCK_CONST_METHOD0(GetPolicyAppIDs, const policy_table::Strings());
};
} // namespace policy_test
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
index 3b0c1a925e..f12358396b 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
@@ -35,10 +35,11 @@
#include <string>
#include "gmock/gmock.h"
+#include "utils/macro.h"
#include "policy/policy_listener.h"
-#include "rpc_base/rpc_base.h"
#include "policy/policy_table/types.h"
+#include "rpc_base/rpc_base.h"
#include "utils/custom_string.h"
namespace policy_table = ::rpc::policy_table_interface_base;
@@ -52,18 +53,21 @@ namespace custom_str = utils::custom_string;
class MockPolicyListener : public ::policy::PolicyListener {
public:
MOCK_METHOD3(OnPermissionsUpdated,
- void(const std::string& policy_app_id,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ const policy::Permissions& permissions));
+ MOCK_METHOD4(OnPermissionsUpdated,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
const policy::Permissions& permissions,
const policy::HMILevel& default_hmi));
- MOCK_METHOD2(OnPermissionsUpdated,
- void(const std::string& policy_app_id,
- const policy::Permissions& permissions));
- MOCK_METHOD1(OnPendingPermissionChange,
- void(const std::string& policy_app_id));
+ MOCK_METHOD2(OnPendingPermissionChange,
+ void(const std::string& device_id,
+ const std::string& policy_app_id));
MOCK_METHOD1(OnUpdateStatusChanged, void(const std::string& status));
- MOCK_METHOD1(OnCurrentDeviceIdUpdateRequired,
- std::string(const std::string& policy_app_id));
- MOCK_METHOD0(OnSystemInfoUpdateRequired, void());
+ MOCK_METHOD2(OnCurrentDeviceIdUpdateRequired,
+ std::string(const transport_manager::DeviceHandle& device_handle,
+ const std::string& policy_app_id));
MOCK_METHOD1(GetAppName,
custom_str::CustomString(const std::string& policy_app_id));
MOCK_METHOD0(OnUserRequestedUpdateCheckRequired, void());
@@ -72,17 +76,27 @@ class MockPolicyListener : public ::policy::PolicyListener {
MOCK_METHOD1(OnUpdateHMIAppType,
void(std::map<std::string, policy::StringArray>));
MOCK_METHOD1(GetAvailableApps, void(std::queue<std::string>&));
- MOCK_METHOD1(OnSnapshotCreated, void(const policy::BinaryMessage& pt_string));
+ MOCK_METHOD2(OnSnapshotCreated,
+ void(const policy::BinaryMessage& pt_string,
+ const policy::PTUIterationType iteration_type));
MOCK_METHOD0(CanUpdate, bool());
MOCK_METHOD1(OnCertificateUpdated, void(const std::string&));
- MOCK_CONST_METHOD2(SendOnAppPermissionsChanged,
- void(const policy::AppPermissions&, const std::string&));
+ MOCK_METHOD2(OnAuthTokenUpdated,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
+ MOCK_CONST_METHOD3(SendOnAppPermissionsChanged,
+ void(const policy::AppPermissions& permissions,
+ const std::string& device_id,
+ const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(SendOnAppPropertiesChangeNotification,
+ void(const std::string& policy_app_id));
MOCK_METHOD3(OnUpdateHMILevel,
void(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level));
- MOCK_METHOD1(GetDevicesIds,
- std::vector<std::string>(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(
+ GetDevicesIds,
+ std::vector<std::string>(const std::string& policy_app_id));
MOCK_CONST_METHOD1(GetRegisteredLinks,
void(std::map<std::string, std::string>&));
MOCK_METHOD1(OnRemoteAllowedChanged, void(bool new_consent));
@@ -93,6 +107,8 @@ class MockPolicyListener : public ::policy::PolicyListener {
void(const std::string& device_id,
const std::string& policy_app_id,
const std::string& hmi_level));
+ MOCK_METHOD0(OnLockScreenDismissalStateChanged, void());
+ MOCK_METHOD0(OnPTUTimeOut, void());
};
} // namespace policy_test
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
index 952b264caf..ac0fab4328 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
@@ -40,8 +40,8 @@
#include "policy/policy_types.h"
#include "policy/usage_statistics/statistics_manager.h"
-#include "rpc_base/rpc_base.h"
#include "policy/policy_manager.h"
+#include "rpc_base/rpc_base.h"
namespace policy_table = ::rpc::policy_table_interface_base;
@@ -55,20 +55,41 @@ using namespace policy;
class MockPolicyManager : public PolicyManager {
public:
+ MOCK_CONST_METHOD1(AppNeedEncryption, bool(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(
+ GetFunctionalGroupsForApp,
+ const std::vector<std::string>(const std::string& policy_app_id));
+ MOCK_CONST_METHOD0(GetApplicationPolicyIDs, const std::vector<std::string>());
+ MOCK_CONST_METHOD2(FunctionNeedEncryption,
+ bool(const std::string& policy_group,
+ const std::string& policy_function_id));
+ MOCK_CONST_METHOD1(FunctionGroupNeedEncryption,
+ bool(const std::string& policy_group));
+ MOCK_CONST_METHOD1(
+ GetAppEncryptionRequired,
+ const rpc::Optional<rpc::Boolean>(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(GetRPCsForFunctionGroup,
+ const std::vector<std::string>(const std::string& group));
+ MOCK_CONST_METHOD1(GetPolicyFunctionName,
+ const std::string(const uint32_t function_id));
MOCK_METHOD1(set_listener, void(PolicyListener* listener));
MOCK_METHOD2(InitPT,
bool(const std::string& file_name,
const PolicySettings* settings));
MOCK_METHOD2(LoadPT,
- bool(const std::string& file, const BinaryMessage& pt_content));
+ PtProcessingResult(const std::string& file,
+ const BinaryMessage& pt_content));
+ MOCK_METHOD1(OnPTUFinished, void(const PtProcessingResult ptu_result));
MOCK_METHOD1(ResetPT, bool(const std::string& file_name));
- MOCK_METHOD2(GetUpdateUrls,
- void(const uint32_t service_type, EndpointUrls& out_end_points));
- MOCK_METHOD2(GetUpdateUrls,
- void(const std::string& service_type,
- EndpointUrls& out_end_points));
- MOCK_METHOD0(RequestPTUpdate, bool());
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type,
+ EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
+ MOCK_METHOD1(RequestPTUpdate,
+ bool(const policy::PTUIterationType iteration_type));
MOCK_METHOD5(CheckPermissions,
void(const PTString& app_id,
const PTString& hmi_level,
@@ -78,10 +99,16 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD0(ResetUserConsent, bool());
MOCK_CONST_METHOD0(GetPolicyTableStatus, std::string());
MOCK_METHOD1(KmsChanged, void(int kilometers));
+ MOCK_CONST_METHOD0(LockScreenDismissalEnabledState,
+ const boost::optional<bool>());
+ MOCK_CONST_METHOD1(LockScreenDismissalWarningMessage,
+ const boost::optional<std::string>(const std::string&));
MOCK_METHOD0(IncrementIgnitionCycles, void());
MOCK_METHOD0(ForcePTExchange, std::string());
MOCK_METHOD0(ForcePTExchangeAtUserRequest, std::string());
- MOCK_METHOD0(ResetRetrySequence, void());
+ MOCK_METHOD0(StopRetrySequence, void());
+ MOCK_METHOD1(ResetRetrySequence,
+ void(const policy::ResetRetryCountType send_event));
MOCK_METHOD0(NextRetryTimeout, uint32_t());
MOCK_METHOD0(TimeoutExchangeMSec, uint32_t());
MOCK_METHOD0(RetrySequenceDelaysSeconds, const std::vector<int>());
@@ -96,8 +123,10 @@ class MockPolicyManager : public PolicyManager {
std::vector<policy::FunctionalGroupPermission>& permissions));
MOCK_METHOD2(SetUserConsentForDevice,
void(const std::string& device_id, const bool is_allowed));
- MOCK_METHOD2(ReactOnUserDevConsentForApp,
- bool(const std::string app_id, bool is_device_allowed));
+ MOCK_METHOD3(ReactOnUserDevConsentForApp,
+ bool(const transport_manager::DeviceHandle& device_handle,
+ const std::string app_id,
+ bool is_device_allowed));
MOCK_METHOD2(PTUpdatedAt, void(policy::Counters counter, int value));
MOCK_METHOD3(GetInitialAppData,
@@ -113,8 +142,9 @@ class MockPolicyManager : public PolicyManager {
const policy::DeviceInfo& device_info));
MOCK_METHOD1(SetUserConsentForApp,
void(const policy::PermissionConsent& permissions));
- MOCK_CONST_METHOD2(GetDefaultHmi,
- bool(const std::string& policy_app_id,
+ MOCK_CONST_METHOD3(GetDefaultHmi,
+ bool(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi));
MOCK_CONST_METHOD2(GetPriority,
bool(const std::string& policy_app_id,
@@ -129,26 +159,32 @@ class MockPolicyManager : public PolicyManager {
void(const std::string& device_id,
const std::string& policy_app_id,
std::vector<policy::FunctionalGroupPermission>& permissions));
- MOCK_METHOD1(GetAppPermissionsChanges,
- policy::AppPermissions(const std::string& policy_app_id));
+ MOCK_METHOD2(GetAppPermissionsChanges,
+ policy::AppPermissions(const std::string& device_id,
+ const std::string& policy_app_id));
MOCK_METHOD1(RemovePendingPermissionChanges, void(const std::string& app_id));
- MOCK_CONST_METHOD1(GetCurrentDeviceId,
- std::string&(const std::string& policy_app_id));
+ MOCK_CONST_METHOD2(
+ GetCurrentDeviceId,
+ std::string&(const transport_manager::DeviceHandle& device_handle,
+ const std::string& policy_app_id));
MOCK_METHOD1(SetSystemLanguage, void(const std::string& language));
MOCK_METHOD3(SetSystemInfo,
void(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language));
- MOCK_METHOD1(SendNotificationOnPermissionsUpdated,
- void(const std::string& application_id));
+ MOCK_METHOD2(SendNotificationOnPermissionsUpdated,
+ void(const std::string& device_id,
+ const std::string& application_id));
MOCK_METHOD1(MarkUnpairedDevice, void(const std::string& device_id));
- MOCK_METHOD2(
+ MOCK_METHOD3(
AddApplication,
StatusNotifier(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types));
- MOCK_METHOD2(SetDefaultHmiTypes,
- void(const std::string& application_id,
+ MOCK_METHOD3(SetDefaultHmiTypes,
+ void(const transport_manager::DeviceHandle& device_handle,
+ const std::string& application_id,
const std::vector<int>& hmi_types));
MOCK_METHOD2(GetHMITypes,
bool(const std::string& application_id,
@@ -158,15 +194,16 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD2(SendAppPermissionsChanged,
void(const std::string& device_id,
const std::string& application_id));
+ MOCK_CONST_METHOD1(SendOnAppPropertiesChangeNotification,
+ void(const std::string& application_id));
MOCK_CONST_METHOD2(GetModuleTypes,
bool(const std::string& policy_app_id,
std::vector<std::string>* modules));
MOCK_METHOD1(set_access_remote,
- void(utils::SharedPtr<AccessRemote> access_remote));
+ void(std::shared_ptr<AccessRemote> access_remote));
MOCK_METHOD0(CleanupUnpairedDevices, bool());
MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
- MOCK_METHOD0(OnSystemReady, void());
MOCK_CONST_METHOD1(GetNotificationsNumber,
uint32_t(const std::string& priority));
MOCK_METHOD1(SetVINValue, void(const std::string& value));
@@ -175,18 +212,57 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD1(SaveUpdateStatusRequired, void(bool is_update_needed));
MOCK_METHOD0(OnAppsSearchStarted, void());
MOCK_METHOD1(OnAppsSearchCompleted, void(const bool trigger_ptu));
- MOCK_METHOD1(OnAppRegisteredOnMobile,
- void(const std::string& application_id));
+ MOCK_METHOD1(UpdatePTUReadyAppsCount, void(const uint32_t new_app_count));
+ MOCK_METHOD2(OnAppRegisteredOnMobile,
+ void(const std::string& device_id,
+ const std::string& application_id));
MOCK_CONST_METHOD1(
GetAppRequestTypes,
const std::vector<std::string>(const std::string policy_app_id));
- MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ MOCK_CONST_METHOD0(GetPolicyTableData, Json::Value());
+ MOCK_CONST_METHOD0(GetVehicleDataItems,
+ const std::vector<policy_table::VehicleDataItem>());
+ MOCK_CONST_METHOD0(GetRemovedVehicleDataItems,
+ std::vector<policy_table::VehicleDataItem>());
+ MOCK_CONST_METHOD1(GetEnabledCloudApps,
+ void(std::vector<std::string>& enabled_apps));
+ MOCK_CONST_METHOD2(GetAppProperties,
+ bool(const std::string& policy_app_id,
+ AppProperties& out_app_properties));
+ MOCK_CONST_METHOD0(GetEnabledLocalApps, std::vector<std::string>());
+ MOCK_CONST_METHOD1(IsNewApplication, bool(const std::string& application_id));
+ MOCK_METHOD0(OnLocalAppAdded, void());
+ MOCK_METHOD1(InitCloudApp, void(const std::string& policy_app_id));
+ MOCK_METHOD2(SetCloudAppEnabled,
+ void(const std::string& policy_app_id, const bool enabled));
+ MOCK_METHOD2(SetAppAuthToken,
+ void(const std::string& policy_app_id,
+ const std::string& auth_token));
+ MOCK_METHOD2(SetAppCloudTransportType,
+ void(const std::string& policy_app_id,
+ const std::string& cloud_transport_type));
+ MOCK_METHOD2(SetAppEndpoint,
+ void(const std::string& policy_app_id,
+ const std::string& endpoint));
+ MOCK_METHOD2(SetAppNicknames,
+ void(const std::string& policy_app_id,
+ const StringArray& nicknames));
+ MOCK_METHOD2(SetHybridAppPreference,
+ void(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference));
+ MOCK_CONST_METHOD2(
+ GetAppServiceParameters,
+ void(const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters));
+ MOCK_CONST_METHOD1(UnknownRPCPassthroughAllowed,
+ bool(const std::string& policy_app_id));
MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
MOCK_CONST_METHOD0(RetrieveCertificate, std::string());
MOCK_CONST_METHOD0(HasCertificate, bool());
MOCK_METHOD0(ExceededIgnitionCycles, bool());
MOCK_METHOD0(ExceededDays, bool());
MOCK_METHOD0(StartPTExchange, void());
+ MOCK_METHOD0(TriggerPTUOnStartupIfRequired, void());
// --- Statistics Manager section
MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
@@ -203,7 +279,7 @@ class MockPolicyManager : public PolicyManager {
int32_t timespan_seconds));
MOCK_CONST_METHOD0(get_settings, const PolicySettings&());
MOCK_METHOD1(set_settings, void(const PolicySettings* get_settings));
- MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(GetIconUrl, std::string(const std::string& policy_app_id));
MOCK_METHOD1(GetNextUpdateUrl, AppIdURL(const EndpointUrls& urls));
MOCK_CONST_METHOD2(RetrySequenceUrl,
AppIdURL(const struct RetrySequenceURL&,
@@ -231,6 +307,7 @@ class MockPolicyManager : public PolicyManager {
RequestType::State(const std::string& policy_app_id));
MOCK_CONST_METHOD1(GetAppRequestSubTypesState,
RequestSubType::State(const std::string& policy_app_id));
+ MOCK_METHOD0(ResetTimeout, void());
};
} // namespace policy_manager_test
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h
index 438e697c51..26c5572d99 100644
--- a/src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h
@@ -32,8 +32,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_SETTINGS_H_
#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_SETTINGS_H_
-#include "gmock/gmock.h"
#include <string>
+#include "gmock/gmock.h"
#include "policy/policy_settings.h"
namespace test {
@@ -49,9 +49,10 @@ class MockPolicySettings : public ::policy::PolicySettings {
MOCK_CONST_METHOD0(open_attempt_timeout_ms, uint16_t());
MOCK_CONST_METHOD0(policies_snapshot_file_name, const std::string&());
MOCK_CONST_METHOD0(system_files_path, const std::string&());
+ MOCK_CONST_METHOD0(use_full_app_id, bool());
};
-} // namespace policy_test
+} // namespace policy_handler_test
} // namespace components
} // namespace test
diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler.h b/src/components/include/test/protocol_handler/mock_protocol_handler.h
index e667911944..354c797c24 100644
--- a/src/components/include/test/protocol_handler/mock_protocol_handler.h
+++ b/src/components/include/test/protocol_handler/mock_protocol_handler.h
@@ -33,9 +33,9 @@
#define SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_HANDLER_H_
#include "gmock/gmock.h"
-#include "protocol_handler/protocol_packet.h"
#include "protocol_handler/protocol_handler.h"
#include "protocol_handler/protocol_handler_settings.h"
+#include "protocol_handler/protocol_packet.h"
#include "protocol_handler/session_observer.h"
namespace test {
@@ -44,8 +44,9 @@ namespace protocol_handler_test {
class MockProtocolHandler : public ::protocol_handler::ProtocolHandler {
public:
- MOCK_METHOD2(SendMessageToMobileApp,
+ MOCK_METHOD3(SendMessageToMobileApp,
void(const ::protocol_handler::RawMessagePtr message,
+ bool needs_encryption,
bool final_message));
MOCK_METHOD1(AddProtocolObserver,
void(::protocol_handler::ProtocolObserver* observer));
@@ -55,24 +56,23 @@ class MockProtocolHandler : public ::protocol_handler::ProtocolHandler {
void(uint32_t connection_key, int32_t number_of_frames));
MOCK_METHOD2(SendHeartBeat, void(int32_t connection_id, uint8_t session_id));
MOCK_METHOD2(SendEndSession, void(int32_t connection_id, uint8_t session_id));
- MOCK_METHOD3(SendEndService,
- void(int32_t connection_id,
+ MOCK_METHOD4(SendEndService,
+ void(int32_t primary_connection_id,
+ int32_t connection_id,
uint8_t session_id,
uint8_t service_type));
MOCK_CONST_METHOD0(get_settings,
const ::protocol_handler::ProtocolHandlerSettings&());
MOCK_METHOD0(get_session_observer, protocol_handler::SessionObserver&());
- DEPRECATED MOCK_METHOD6(NotifySessionStartedResult,
- void(int32_t connection_id,
- uint8_t session_id,
- uint8_t generated_session_id,
- uint32_t hash_id,
- bool protection,
- std::vector<std::string>& rejected_params));
MOCK_METHOD2(NotifySessionStarted,
void(const ::protocol_handler::SessionContext& context,
std::vector<std::string>& rejected_params));
- MOCK_METHOD0(NotifyOnFailedHandshake, void());
+ MOCK_METHOD0(NotifyOnGetSystemTimeFailed, void());
+ MOCK_CONST_METHOD1(IsRPCServiceSecure, bool(const uint32_t connection_key));
+ MOCK_METHOD0(ProcessFailedPTU, void());
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ MOCK_METHOD0(ProcessFailedCertDecrypt, void());
+#endif
};
} // namespace protocol_handler_test
} // namespace components
diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h
index 8ddeded889..2ed9c47e9d 100644
--- a/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h
+++ b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h
@@ -60,6 +60,17 @@ class MockProtocolHandlerSettings
MOCK_CONST_METHOD0(force_protected_service, const std::vector<int>&());
MOCK_CONST_METHOD0(force_unprotected_service, const std::vector<int>&());
#endif
+ MOCK_CONST_METHOD0(multiple_transports_enabled, const bool());
+ MOCK_CONST_METHOD0(secondary_transports_for_bluetooth,
+ const std::vector<std::string>&());
+ MOCK_CONST_METHOD0(secondary_transports_for_usb,
+ const std::vector<std::string>&());
+ MOCK_CONST_METHOD0(secondary_transports_for_wifi,
+ const std::vector<std::string>&());
+ MOCK_CONST_METHOD0(audio_service_transports,
+ const std::vector<std::string>&());
+ MOCK_CONST_METHOD0(video_service_transports,
+ const std::vector<std::string>&());
};
} // namespace protocol_handler_test
diff --git a/src/components/include/test/protocol_handler/mock_protocol_observer.h b/src/components/include/test/protocol_handler/mock_protocol_observer.h
index 257ea5ad9f..ef28d80d0b 100644
--- a/src/components/include/test/protocol_handler/mock_protocol_observer.h
+++ b/src/components/include/test/protocol_handler/mock_protocol_observer.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_OBSERVER_H_
#define SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_OBSERVER_H_
-#include "gmock/gmock.h"
#include <string>
+#include "gmock/gmock.h"
#include "protocol_handler/protocol_observer.h"
namespace test {
diff --git a/src/components/include/test/protocol_handler/mock_session_observer.h b/src/components/include/test/protocol_handler/mock_session_observer.h
index ae32f35948..01bb41a96e 100644
--- a/src/components/include/test/protocol_handler/mock_session_observer.h
+++ b/src/components/include/test/protocol_handler/mock_session_observer.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_SESSION_OBSERVER_H_
#include <gmock/gmock.h>
-#include <string>
#include <list>
+#include <string>
#include "protocol_handler/session_observer.h"
#include "transport_manager/common.h"
@@ -47,13 +47,6 @@ namespace protocol_handler_test {
*/
class MockSessionObserver : public ::protocol_handler::SessionObserver {
public:
- DEPRECATED MOCK_METHOD5(
- OnSessionStartedCallback,
- uint32_t(const transport_manager::ConnectionUID connection_handle,
- const uint8_t sessionId,
- const protocol_handler::ServiceType& service_type,
- const bool is_protected,
- uint32_t* hash_id));
MOCK_METHOD5(OnSessionStartedCallback,
void(const transport_manager::ConnectionUID connection_handle,
const uint8_t sessionId,
@@ -76,6 +69,12 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver {
void(const uint32_t& connection_key));
MOCK_METHOD1(OnMalformedMessageCallback,
void(const uint32_t& connection_key));
+ MOCK_CONST_METHOD1(
+ TransportTypeProfileStringFromConnHandle,
+ const std::string(transport_manager::ConnectionUID connection_handle));
+ MOCK_CONST_METHOD1(
+ TransportTypeProfileStringFromDeviceHandle,
+ const std::string(transport_manager::DeviceHandle device_handle));
MOCK_CONST_METHOD2(
KeyFromPair,
uint32_t(transport_manager::ConnectionUID connection_handle,
@@ -89,11 +88,6 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver {
uint32_t* app_id,
std::list<int32_t>* sessions_list,
transport_manager::DeviceHandle* device_id));
- DEPRECATED MOCK_CONST_METHOD4(GetDataOnSessionKey,
- int32_t(uint32_t key,
- uint32_t* app_id,
- std::list<int32_t>* sessions_list,
- uint32_t* device_id));
MOCK_CONST_METHOD5(GetDataOnDeviceID,
int32_t(transport_manager::DeviceHandle device_handle,
diff --git a/src/components/include/test/protocol_handler/mock_telemetry_observer.h b/src/components/include/test/protocol_handler/mock_telemetry_observer.h
index 1c87de4d5a..82c42775fa 100644
--- a/src/components/include/test/protocol_handler/mock_telemetry_observer.h
+++ b/src/components/include/test/protocol_handler/mock_telemetry_observer.h
@@ -44,8 +44,9 @@ namespace protocol_handler_test {
class MockPHTelemetryObserver : public PHTelemetryObserver {
public:
MOCK_METHOD2(StartMessageProcess,
- void(uint32_t message_id, const TimevalStruct& start_time));
- MOCK_METHOD1(EndMessageProcess, void(utils::SharedPtr<MessageMetric> m));
+ void(uint32_t message_id,
+ const date_time::TimeDuration& start_time));
+ MOCK_METHOD1(EndMessageProcess, void(std::shared_ptr<MessageMetric> m));
};
} // namespace protocol_handler_test
diff --git a/src/components/include/test/resumption/mock_last_state.h b/src/components/include/test/resumption/mock_last_state.h
index 9f4b11cbbf..99c3799a95 100644
--- a/src/components/include/test/resumption/mock_last_state.h
+++ b/src/components/include/test/resumption/mock_last_state.h
@@ -35,6 +35,7 @@
#include "gmock/gmock.h"
#include "resumption/last_state.h"
+#include "utils/macro.h"
namespace test {
namespace components {
@@ -42,8 +43,14 @@ namespace resumption_test {
class MockLastState : public resumption::LastState {
public:
+ DEPRECATED
MOCK_METHOD0(SaveStateToFileSystem, void());
+ DEPRECATED
MOCK_METHOD0(get_dictionary, Json::Value&());
+ MOCK_METHOD0(SaveToFileSystem, void());
+ MOCK_METHOD0(RemoveFromFileSystem, void());
+ MOCK_CONST_METHOD0(dictionary, Json::Value());
+ MOCK_METHOD1(set_dictionary, void(const Json::Value&));
};
} // namespace resumption_test
diff --git a/src/components/include/test/security_manager/mock_security_manager.h b/src/components/include/test/security_manager/mock_security_manager.h
index b2c2e3bf17..e44d6207c1 100644
--- a/src/components/include/test/security_manager/mock_security_manager.h
+++ b/src/components/include/test/security_manager/mock_security_manager.h
@@ -33,12 +33,12 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SECURITY_MANAGER_H_
#define SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SECURITY_MANAGER_H_
-#include <string>
#include <list>
+#include <string>
#include "gmock/gmock.h"
-#include "utils/byte_order.h"
#include "security_manager/security_manager.h"
#include "security_manager/security_query.h"
+#include "utils/byte_order.h"
namespace test {
namespace components {
@@ -68,11 +68,16 @@ class MockSecurityManager : public ::security_manager::SecurityManager {
void(const ::protocol_handler::RawMessagePtr));
MOCK_METHOD1(IsCertificateUpdateRequired, bool(const uint32_t));
MOCK_METHOD0(NotifyOnCertificateUpdateRequired, void());
- MOCK_METHOD0(NotifyListenersOnHandshakeFailed, void());
+ MOCK_METHOD0(NotifyListenersOnGetSystemTimeFailed, void());
MOCK_METHOD0(IsPolicyCertificateDataEmpty, bool());
+ MOCK_METHOD0(ProcessFailedPTU, void());
MOCK_METHOD1(OnCertificateUpdated, bool(const std::string&));
MOCK_METHOD1(PostponeHandshake, void(const uint32_t));
MOCK_CONST_METHOD0(IsSystemTimeProviderReady, bool());
+ MOCK_METHOD0(ResetPendingSystemTimeRequests, void());
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ MOCK_METHOD0(ProcessFailedCertDecrypt, void());
+#endif
};
/*
diff --git a/src/components/include/test/security_manager/mock_security_manager_listener.h b/src/components/include/test/security_manager/mock_security_manager_listener.h
index 7a7714d299..81790d1830 100644
--- a/src/components/include/test/security_manager/mock_security_manager_listener.h
+++ b/src/components/include/test/security_manager/mock_security_manager_listener.h
@@ -49,7 +49,11 @@ class MockSecurityManagerListener
::security_manager::SSLContext::HandshakeResult result));
MOCK_METHOD0(OnCertificateUpdateRequired, void());
MOCK_CONST_METHOD1(GetPolicyCertificateData, bool(std::string& data));
- MOCK_METHOD0(OnHandshakeFailed, bool());
+ MOCK_METHOD0(OnGetSystemTimeFailed, bool());
+ MOCK_METHOD0(OnPTUFailed, bool());
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ MOCK_METHOD0(OnCertDecryptFailed, bool());
+#endif
};
} // namespace security_manager_test
} // namespace components
diff --git a/src/components/include/test/telemetry_monitor/mock_telemetry_observable.h b/src/components/include/test/telemetry_monitor/mock_telemetry_observable.h
index dd07f1d3c8..eb106db9a2 100644
--- a/src/components/include/test/telemetry_monitor/mock_telemetry_observable.h
+++ b/src/components/include/test/telemetry_monitor/mock_telemetry_observable.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_TELEMETRY_MONITOR_MOCK_TELEMETRY_OBSERVABLE_H_
#define SRC_COMPONENTS_INCLUDE_TEST_TELEMETRY_MONITOR_MOCK_TELEMETRY_OBSERVABLE_H_
+#include "application_manager/telemetry_observer.h"
#include "gmock/gmock.h"
#include "telemetry_monitor/telemetry_observable.h"
-#include "application_manager/telemetry_observer.h"
namespace test {
namespace components {
diff --git a/src/components/include/test/transport_manager/mock_transport_manager.h b/src/components/include/test/transport_manager/mock_transport_manager.h
index cc8bd5ab85..1920af18a3 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager.h
@@ -33,22 +33,22 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_H_
#define SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_H_
-#include "gmock/gmock.h"
#include <string>
-#include "transport_manager/transport_manager.h"
-#include "transport_manager/transport_adapter/transport_adapter_event.h"
+#include "gmock/gmock.h"
+#include "resumption/last_state_wrapper.h"
#include "telemetry_monitor/telemetry_observable.h"
-#include "resumption/last_state.h"
+#include "transport_manager/transport_adapter/transport_adapter_event.h"
+#include "transport_manager/transport_manager.h"
namespace test {
namespace components {
namespace transport_manager_test {
-using ::transport_manager::DeviceHandle;
using ::transport_manager::ConnectionUID;
-using ::transport_manager::transport_adapter::TransportAdapter;
+using ::transport_manager::DeviceHandle;
using ::transport_manager::TransportAdapterEvent;
using ::transport_manager::TransportManagerListener;
+using ::transport_manager::transport_adapter::TransportAdapter;
/*
* MOCK implementation of ::transport_manager::TransportManager interface
*/
@@ -56,10 +56,22 @@ class MockTransportManager : public ::transport_manager::TransportManager,
public ::telemetry_monitor::TelemetryObservable<
transport_manager::TMTelemetryObserver> {
public:
+ MOCK_METHOD1(Init, int(resumption::LastStateWrapperPtr last_state));
+ DEPRECATED
MOCK_METHOD1(Init, int(resumption::LastState& last_state));
MOCK_METHOD0(Reinit, int());
+ MOCK_METHOD0(Deinit, void());
+ MOCK_METHOD0(StopEventsProcessing, void());
+ MOCK_METHOD0(StartEventsProcessing, void());
MOCK_METHOD0(SearchDevices, int());
+ MOCK_METHOD1(
+ AddCloudDevice,
+ void(const transport_manager::transport_adapter::CloudAppProperties&));
+ MOCK_METHOD1(RemoveCloudDevice, void(const DeviceHandle device_id));
MOCK_METHOD1(ConnectDevice, int(const DeviceHandle));
+ MOCK_CONST_METHOD1(
+ GetConnectionStatus,
+ transport_manager::ConnectionStatus(const DeviceHandle& device_handle));
MOCK_METHOD1(DisconnectDevice, int(const DeviceHandle));
MOCK_METHOD1(Disconnect, int(const ConnectionUID));
MOCK_METHOD1(DisconnectForce, int(const ConnectionUID));
@@ -71,9 +83,13 @@ class MockTransportManager : public ::transport_manager::TransportManager,
MOCK_METHOD1(AddEventListener, int(TransportManagerListener* listener));
MOCK_METHOD0(Stop, int());
MOCK_METHOD1(RemoveDevice, int(const DeviceHandle));
- MOCK_CONST_METHOD1(Visibility, int(const bool&));
+ MOCK_CONST_METHOD1(PerformActionOnClients,
+ int(transport_manager::TransportAction required_action));
+
MOCK_METHOD1(SetTelemetryObserver,
void(transport_manager::TMTelemetryObserver* observer));
+ MOCK_METHOD0(CreateWebEngineDevice, void());
+ MOCK_CONST_METHOD0(GetWebEngineDeviceInfo, transport_manager::DeviceInfo&());
};
} // namespace transport_manager_test
diff --git a/src/components/include/test/transport_manager/mock_transport_manager_listener.h b/src/components/include/test/transport_manager/mock_transport_manager_listener.h
index f4c4fdcf68..04408f945b 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager_listener.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager_listener.h
@@ -55,6 +55,10 @@ class MockTransportManagerListener : public TransportManagerListener {
MOCK_METHOD1(OnDeviceRemoved, void(const DeviceInfo& device_info));
MOCK_METHOD0(OnScanDevicesFinished, void());
MOCK_METHOD1(OnScanDevicesFailed, void(const SearchDeviceError& error));
+ MOCK_METHOD0(OnConnectionStatusUpdated, void());
+ MOCK_METHOD2(OnConnectionPending,
+ void(const DeviceInfo& device_info,
+ const ConnectionUID connection_id));
MOCK_METHOD2(OnConnectionEstablished,
void(const DeviceInfo& device_info,
const ConnectionUID connection_id));
@@ -85,6 +89,8 @@ class MockTransportManagerListener : public TransportManagerListener {
void(const DeviceUID& device_uid_from,
const DeviceUID& device_uid_to));
MOCK_METHOD1(OnDeviceSwitchingFinish, void(const DeviceUID& device_uid));
+ MOCK_METHOD1(OnTransportConfigUpdated,
+ void(const std::map<std::string, std::string>& configs));
};
} // namespace transport_manager_test
diff --git a/src/components/include/test/transport_manager/mock_transport_manager_settings.h b/src/components/include/test/transport_manager/mock_transport_manager_settings.h
index 88112df003..10320d51ab 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager_settings.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager_settings.h
@@ -33,9 +33,9 @@
#define SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_SETTINGS_H_
#include "gmock/gmock.h"
+#include "mock_transport_manager_mme_settings.h"
#include "protocol_handler/protocol_handler.h"
#include "transport_manager/transport_manager_settings.h"
-#include "mock_transport_manager_mme_settings.h"
namespace test {
namespace components {
@@ -61,6 +61,23 @@ class MockTransportManagerSettings
MOCK_CONST_METHOD0(iap_hub_connection_wait_timeout, uint32_t());
MOCK_CONST_METHOD0(app_transport_change_timer, uint32_t());
MOCK_CONST_METHOD0(app_transport_change_timer_addition, uint32_t());
+ MOCK_CONST_METHOD0(transport_manager_tcp_adapter_network_interface,
+ std::string&());
+ MOCK_CONST_METHOD0(websocket_server_address, const std::string&());
+ MOCK_CONST_METHOD0(websocket_server_port, uint16_t());
+ MOCK_CONST_METHOD0(cloud_app_retry_timeout, uint32_t());
+ MOCK_CONST_METHOD0(cloud_app_max_retry_attempts, uint16_t());
+ MOCK_CONST_METHOD0(bluetooth_uuid, const uint8_t*());
+ MOCK_CONST_METHOD0(aoa_filter_manufacturer, const std::string&());
+ MOCK_CONST_METHOD0(aoa_filter_model_name, const std::string&());
+ MOCK_CONST_METHOD0(aoa_filter_description, const std::string&());
+ MOCK_CONST_METHOD0(aoa_filter_version, const std::string&());
+ MOCK_CONST_METHOD0(aoa_filter_uri, const std::string&());
+ MOCK_CONST_METHOD0(aoa_filter_serial_number, const std::string&());
+ MOCK_CONST_METHOD0(ws_server_cert_path, const std::string&());
+ MOCK_CONST_METHOD0(ws_server_key_path, const std::string&());
+ MOCK_CONST_METHOD0(ws_server_ca_cert_path, const std::string&());
+ MOCK_CONST_METHOD0(wss_server_supported, const bool());
};
} // namespace transport_manager_test
diff --git a/src/components/include/test/transport_manager/transport_adapter/mock_device.h b/src/components/include/test/transport_manager/transport_adapter/mock_device.h
index 6829e98d1d..c1e0153a76 100644
--- a/src/components/include/test/transport_manager/transport_adapter/mock_device.h
+++ b/src/components/include/test/transport_manager/transport_adapter/mock_device.h
@@ -34,9 +34,9 @@
#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_DEVICE_H_
#include "gmock/gmock.h"
-#include "transport_manager/transport_adapter/device.h"
#include "transport_manager/common.h"
#include "transport_manager/tcp/tcp_device.h"
+#include "transport_manager/transport_adapter/device.h"
namespace test {
namespace components {
diff --git a/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h
index c37c41d4f8..d4ce0a39c8 100644
--- a/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h
+++ b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_MOCK_TRANSPORT_ADAPTER_H_
#include "gmock/gmock.h"
+#include "transport_manager/transport_adapter/device.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
namespace test {
@@ -66,14 +67,14 @@ class MockTransportAdapter
MOCK_METHOD1(ConnectDevice,
::transport_manager::transport_adapter::TransportAdapter::Error(
const ::transport_manager::DeviceUID& device_handle));
+ MOCK_CONST_METHOD1(GetConnectionStatus,
+ ::transport_manager::ConnectionStatus(
+ const ::transport_manager::DeviceUID& device_handle));
MOCK_METHOD2(RunAppOnDevice, void(const std::string&, const std::string&));
MOCK_CONST_METHOD0(IsClientOriginatedConnectSupported, bool());
- MOCK_METHOD0(
- StartClientListening,
- ::transport_manager::transport_adapter::TransportAdapter::Error());
- MOCK_METHOD0(
- StopClientListening,
- ::transport_manager::transport_adapter::TransportAdapter::Error());
+ MOCK_METHOD1(ChangeClientListening,
+ ::transport_manager::transport_adapter::TransportAdapter::Error(
+ ::transport_manager::TransportAction required_change));
MOCK_METHOD2(RemoveFinalizedConnection,
void(const ::transport_manager::DeviceUID& device_handle,
const ::transport_manager::ApplicationHandle& app_handle));
@@ -103,9 +104,20 @@ class MockTransportAdapter
void(const ::transport_manager::DeviceUID& device_handle));
MOCK_CONST_METHOD0(GetSwitchableDevices,
transport_manager::SwitchableDevices());
+ MOCK_CONST_METHOD0(GetTransportConfiguration,
+ transport_manager::transport_adapter::TransportConfig());
+ MOCK_METHOD1(CreateDevice, void(const std::string& uid));
+
+ MOCK_METHOD1(AddDevice,
+ transport_manager::transport_adapter::DeviceSptr(
+ transport_manager::transport_adapter::DeviceSptr device));
+
#ifdef TELEMETRY_MONITOR
MOCK_METHOD0(GetTelemetryObserver,
::transport_manager::TMTelemetryObserver*());
+ MOCK_METHOD1(SetTelemetryObserver,
+ void(::transport_manager::TMTelemetryObserver* observer));
+
#endif // TELEMETRY_MONITOR
};
diff --git a/src/components/include/test/utils/mock_system_time_handler.h b/src/components/include/test/utils/mock_system_time_handler.h
index 7bb2a7f0a5..5d82c0a8c7 100644
--- a/src/components/include/test/utils/mock_system_time_handler.h
+++ b/src/components/include/test/utils/mock_system_time_handler.h
@@ -50,6 +50,7 @@ class MockSystemTimeHandler : public ::utils::SystemTimeHandler {
void(utils::SystemTimeListener* listener));
MOCK_METHOD0(GetUTCTime, time_t());
MOCK_CONST_METHOD0(system_time_can_be_received, bool());
+ MOCK_METHOD0(ResetPendingSystemTimeRequests, void());
~MockSystemTimeHandler() {}
private:
diff --git a/src/components/include/test/utils/test_async_waiter.h b/src/components/include/test/utils/test_async_waiter.h
index fee7672e93..12d6cd04b7 100644
--- a/src/components/include/test/utils/test_async_waiter.h
+++ b/src/components/include/test/utils/test_async_waiter.h
@@ -35,8 +35,8 @@
#include <stdint.h>
-#include "utils/lock.h"
#include "utils/conditional_variable.h"
+#include "utils/lock.h"
namespace test {
diff --git a/src/components/include/transport_manager/common.h b/src/components/include/transport_manager/common.h
index 58bcf6bb17..f8b0cabe2e 100644
--- a/src/components/include/transport_manager/common.h
+++ b/src/components/include/transport_manager/common.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_COMMON_H_
#define SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_COMMON_H_
-#include <vector>
-#include <string>
#include <map>
+#include <string>
+#include <vector>
/**
* @brief - transport_manager namespace
@@ -43,6 +43,17 @@
namespace transport_manager {
/**
+ * @enum Actions that could
+ * be performed on connected clients.
+ */
+enum class TransportAction {
+ kVisibilityOn,
+ kVisibilityOff,
+ kListeningOn,
+ kListeningOff
+};
+
+/**
* @enum Transport manager states.
*/
enum {
@@ -56,6 +67,13 @@ enum {
E_INTERNAL_ERROR
};
+enum ConnectionStatus { INVALID = -1, PENDING, RETRY, CONNECTED, CLOSING };
+
+namespace webengine_constants {
+const std::string kWebEngineConnectionType("WEBENGINE_WEBSOCKET");
+const std::string kWebEngineDeviceName("Web Engine");
+} // namespace webengine_constants
+
/**
* @brief Type definition for variable that hold handle of device.
*/
diff --git a/src/components/include/transport_manager/error.h b/src/components/include/transport_manager/error.h
index 022ddf0e38..eb0f702717 100644
--- a/src/components/include/transport_manager/error.h
+++ b/src/components/include/transport_manager/error.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_ERROR_H_
#define SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_ERROR_H_
+#include <memory>
#include <string>
-#include <utils/shared_ptr.h>
namespace transport_manager {
@@ -79,7 +79,7 @@ class BaseError {
private:
std::string description_;
};
-typedef utils::SharedPtr<BaseError> BaseErrorPtr;
+typedef std::shared_ptr<BaseError> BaseErrorPtr;
/**
* @brief Error that originates during device search.
diff --git a/src/components/include/transport_manager/transport_adapter/device.h b/src/components/include/transport_manager/transport_adapter/device.h
index 148e715050..184616d714 100644
--- a/src/components/include/transport_manager/transport_adapter/device.h
+++ b/src/components/include/transport_manager/transport_adapter/device.h
@@ -33,11 +33,12 @@
#ifndef SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_DEVICE_H_
#define SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_DEVICE_H_
+#include <memory>
#include <string>
#include <vector>
#include "transport_manager/common.h"
-#include "utils/shared_ptr.h"
+
#include "utils/macro.h"
namespace transport_manager {
@@ -57,7 +58,9 @@ class Device {
Device(const std::string& name, const DeviceUID& unique_device_id)
: name_(name)
, unique_device_id_(unique_device_id)
- , keep_on_disconnect_(false) {}
+ , keep_on_disconnect_(false)
+ , status_(ConnectionStatus::PENDING)
+ , retry_count_(0) {}
/**
* Constructor for creating device supporting transport switch
@@ -72,7 +75,9 @@ class Device {
: name_(name)
, unique_device_id_(unique_device_id)
, transport_switch_id_(transport_switch_id)
- , keep_on_disconnect_(false) {}
+ , keep_on_disconnect_(false)
+ , status_(ConnectionStatus::PENDING)
+ , retry_count_(0) {}
/**
* @brief Destructor.
@@ -131,6 +136,44 @@ class Device {
}
/**
+ * @brief Get @link status_ @endlink value
+ * @return current value
+ */
+ inline ConnectionStatus connection_status() const {
+ return status_;
+ }
+
+ /**
+ * @brief Set @link status_ @endlink value
+ * @param status new value
+ */
+ inline void set_connection_status(ConnectionStatus status) {
+ status_ = status;
+ }
+
+ /**
+ * @brief Get @link retry_count_ @endlink value
+ * @return current value
+ */
+ inline uint16_t retry_count() const {
+ return retry_count_;
+ }
+
+ /**
+ * @brief Increment @link retry_count_ @endlink value
+ */
+ inline void next_retry() {
+ retry_count_++;
+ }
+
+ /**
+ * @brief Reset @link retry_count_ @endlink value to 0
+ */
+ inline void reset_retry_count() {
+ retry_count_ = 0;
+ }
+
+ /**
* @brief transport_switch_id Returns id used for transport switching
* flow of device. Filled if applicable, otherwise - empty.
*/
@@ -159,8 +202,12 @@ class Device {
*finished.
**/
bool keep_on_disconnect_;
+
+ ConnectionStatus status_;
+
+ uint16_t retry_count_;
};
-typedef utils::SharedPtr<Device> DeviceSptr;
+typedef std::shared_ptr<Device> DeviceSptr;
typedef std::vector<DeviceSptr> DeviceVector;
} // namespace transport_adapter
} // namespace transport_manager
diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter.h b/src/components/include/transport_manager/transport_adapter/transport_adapter.h
index 7f6d347535..e9494b4ced 100644
--- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h
+++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h
@@ -36,17 +36,15 @@
#ifndef SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_H_
#define SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_H_
-#include <string>
-#include <vector>
#include <list>
#include <map>
+#include <string>
+#include <vector>
-#include "utils/shared_ptr.h"
-
-#include "transport_manager/transport_adapter/device.h"
+#include "protocol/common.h"
#include "transport_manager/common.h"
#include "transport_manager/error.h"
-#include "protocol/common.h"
+#include "transport_manager/transport_adapter/device.h"
namespace transport_manager {
@@ -59,20 +57,30 @@ class TransportAdapterListener;
/**
* @brief The DeviceType enum defines types based on available transport
* adapters
- * @deprecated PASA_AOA, PASA_BLUETOOTH, MME
*/
enum DeviceType {
AOA,
- PASA_AOA,
BLUETOOTH,
- PASA_BLUETOOTH,
- MME,
IOS_BT,
IOS_USB,
TCP,
+ CLOUD_WEBSOCKET,
+ IOS_USB_HOST_MODE,
+ IOS_USB_DEVICE_MODE,
+ IOS_CARPLAY_WIRELESS, // running on iAP over Carplay wireless transport
+ WEBENGINE_WEBSOCKET,
UNKNOWN
};
+struct CloudAppProperties {
+ std::string endpoint;
+ std::string certificate;
+ bool enabled;
+ std::string auth_token;
+ std::string cloud_transport_type;
+ std::string hybrid_app_preference;
+};
+
typedef std::map<DeviceType, std::string> DeviceTypes;
/**
@@ -86,12 +94,33 @@ typedef std::map<DeviceUID, DeviceSptr> DeviceMap;
*/
typedef std::list<TransportAdapterListener*> TransportAdapterListenerList;
+/**
+ * @brief Type definition for transport's configuration information
+ */
+typedef std::map<std::string, std::string> TransportConfig;
+
+typedef std::map<std::string, CloudAppProperties> CloudAppTransportConfig;
+/**
+ * @brief TransportConfig keys
+ */
+extern const char* tc_enabled;
+extern const char* tc_tcp_port;
+extern const char* tc_tcp_ip_address;
+
class TransportAdapter {
public:
/**
* @enum Available types of errors.
*/
- enum Error { OK, FAIL, NOT_SUPPORTED, ALREADY_EXISTS, BAD_STATE, BAD_PARAM };
+ enum Error {
+ UNKNOWN = -1,
+ OK,
+ FAIL,
+ NOT_SUPPORTED,
+ ALREADY_EXISTS,
+ BAD_STATE,
+ BAD_PARAM
+ };
public:
/**
@@ -187,6 +216,26 @@ class TransportAdapter {
virtual Error ConnectDevice(const DeviceUID& device_handle) = 0;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ virtual ConnectionStatus GetConnectionStatus(
+ const DeviceUID& device_handle) const = 0;
+
+ /**
+ * @brief Add device to the container(map), if container doesn't hold it yet.
+ * in TransportAdapter is used only to add a WebEngine device
+ *
+ * @param device Smart pointer to the device.
+ *
+ * @return Smart pointer to the device.
+ */
+ virtual DeviceSptr AddDevice(DeviceSptr device) = 0;
+
+ /**
* @brief RunAppOnDevice allows to run specific application on the certain
*device.
*
@@ -206,18 +255,10 @@ class TransportAdapter {
virtual bool IsClientOriginatedConnectSupported() const = 0;
/**
- * @brief Start client listener.
- *
- * @return Error information about possible reason of failure.
- */
- virtual Error StartClientListening() = 0;
-
- /**
- * @brief Stop client listener.
- *
+ * @brief Changes client listening state of current adapter
* @return Error information about possible reason of failure.
*/
- virtual Error StopClientListening() = 0;
+ virtual Error ChangeClientListening(TransportAction required_change) = 0;
/**
* @brief Remove marked as FINALISING connection from accounting.
@@ -312,6 +353,14 @@ class TransportAdapter {
virtual void DeviceSwitched(const DeviceUID& device_handle) = 0;
virtual SwitchableDevices GetSwitchableDevices() const = 0;
+
+ /**
+ * @brief Returns the transport's configuration information
+ */
+ virtual TransportConfig GetTransportConfiguration() const = 0;
+
+ virtual void CreateDevice(const std::string& uid) = 0;
+
#ifdef TELEMETRY_MONITOR
/**
* @brief Return Time metric observer
@@ -319,6 +368,14 @@ class TransportAdapter {
* @param return pointer to Time metric observer
*/
virtual TMTelemetryObserver* GetTelemetryObserver() = 0;
+
+ /**
+ * @brief Setup observer for time metric.
+ *
+ * @param observer - pointer to observer
+ */
+ virtual void SetTelemetryObserver(TMTelemetryObserver* observer) = 0;
+
#endif // TELEMETRY_MONITOR
};
} // namespace transport_adapter
diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
index 18f4ccb2d1..79daa51c36 100644
--- a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
+++ b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_EVENT_H_
#define SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_EVENT_H_
+#include "protocol/common.h"
#include "transport_manager/common.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
-#include "protocol/common.h"
namespace transport_manager {
@@ -57,7 +57,10 @@ enum class EventTypeEnum {
ON_RECEIVED_FAIL,
ON_COMMUNICATION_ERROR,
ON_UNEXPECTED_DISCONNECT,
- ON_TRANSPORT_SWITCH_REQUESTED
+ ON_TRANSPORT_SWITCH_REQUESTED,
+ ON_TRANSPORT_CONFIG_UPDATED,
+ ON_CONNECT_PENDING,
+ ON_CONNECTION_STATUS_UPDATED
};
class TransportAdapterEvent {
@@ -87,30 +90,6 @@ class TransportAdapterEvent {
, event_error(error) {}
/**
- * DEPRECATED
- * @brief Constructor.
- *
- * @param type Event type.
- * @param transport_adapter Transport adapter
- * @param device_handle Handle of device.
- * @param application_id Handle of application.
- * @param data Smart pointer to the raw message.
- * @param error Error class that contains details of this error situation.
- */
- TransportAdapterEvent(int type,
- transport_adapter::TransportAdapter* adapter,
- const DeviceUID& device_handle,
- const ApplicationHandle& application_id,
- ::protocol_handler::RawMessagePtr data,
- BaseErrorPtr error)
- : event_type(static_cast<EventTypeEnum>(type))
- , application_id(application_id)
- , device_uid(device_handle)
- , transport_adapter(adapter)
- , event_data(data)
- , event_error(error) {}
-
- /**
* @brief Value that describe event type.
*/
EventTypeEnum event_type;
diff --git a/src/components/include/transport_manager/transport_manager.h b/src/components/include/transport_manager/transport_manager.h
index 0847886c46..4697bf9982 100644
--- a/src/components/include/transport_manager/transport_manager.h
+++ b/src/components/include/transport_manager/transport_manager.h
@@ -33,14 +33,11 @@
#ifndef SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_H_
#define SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_H_
+#include "protocol/common.h"
+#include "resumption/last_state_wrapper.h"
#include "transport_manager/common.h"
-#include "transport_manager/transport_manager_listener.h"
#include "transport_manager/transport_adapter/transport_adapter_event.h"
-#include "protocol/common.h"
-
-namespace resumption {
-class LastState;
-}
+#include "transport_manager/transport_manager_listener.h"
namespace transport_manager {
@@ -56,11 +53,14 @@ class TransportManager {
**/
virtual ~TransportManager() {}
+ DEPRECATED
+ virtual int Init(resumption::LastState& last_state) = 0;
+
/**
* @brief Initialize transport manager.
* @return Error code.
*/
- virtual int Init(resumption::LastState& last_state) = 0;
+ virtual int Init(resumption::LastStateWrapperPtr last_state_wrapper) = 0;
/**
* @brief Reinitializes transport manager
@@ -69,12 +69,33 @@ class TransportManager {
virtual int Reinit() = 0;
/**
- * @brief Start scanning for new devices.
- *
- * @return Code error.
- **/
+ * @brief Deinitializes all transport adapters and device instances
+ */
+ virtual void Deinit() = 0;
+
+ /**
+ * @brief Stops transport events processing handler threads
+ */
+ virtual void StopEventsProcessing() = 0;
+
+ /**
+ * @brief Resumes transport events processing handler threads
+ */
+ virtual void StartEventsProcessing() = 0;
+
+ /**
+ * @brief Start scanning for new devices.
+ *
+ * @return Code error.
+ **/
virtual int SearchDevices() = 0;
+ virtual void AddCloudDevice(
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) = 0;
+
+ virtual void RemoveCloudDevice(const DeviceHandle device_id) = 0;
+
/**
* @brief Connect to all applications discovered on device.
*
@@ -85,6 +106,16 @@ class TransportManager {
virtual int ConnectDevice(const DeviceHandle device_id) = 0;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ virtual ConnectionStatus GetConnectionStatus(
+ const DeviceHandle& device_handle) const = 0;
+
+ /**
* @brief Disconnect from all applications connected on device.
*
* @param device_id Handle of device to Disconnect from.
@@ -177,13 +208,25 @@ class TransportManager {
virtual int RemoveDevice(const DeviceHandle device_handle) = 0;
/**
- * @brief Turns on or off visibility of SDL to mobile devices
- * when visibility is ON (on_off = true) mobile devices are able to connect
- * otherwise ((on_off = false)) SDL is not visible from outside
- *
- * @return Code error.
+ * @brief Performs specified action on connected clients
+ * @param required_action is the action which should be performed for the
+ * connected clients
+ * @return error code
+ */
+ virtual int PerformActionOnClients(
+ const TransportAction required_action) const = 0;
+
+ /**
+ * @brief Called when websocket server transport adapter is available.
+ * Creates WebSocketDevice for WebEngine and add it to the device list
+ */
+ virtual void CreateWebEngineDevice() = 0;
+
+ /**
+ * @brief GetWebEngineDeviceInfo
+ * @return device info for WebEngine device
*/
- virtual int Visibility(const bool& on_off) const = 0;
+ virtual const DeviceInfo& GetWebEngineDeviceInfo() const = 0;
};
} // namespace transport_manager
#endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_H_
diff --git a/src/components/include/transport_manager/transport_manager_listener.h b/src/components/include/transport_manager/transport_manager_listener.h
index d336eade45..a733dc7d1c 100644
--- a/src/components/include/transport_manager/transport_manager_listener.h
+++ b/src/components/include/transport_manager/transport_manager_listener.h
@@ -33,11 +33,12 @@
#ifndef SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER_H_
#define SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER_H_
+#include <map>
#include <vector>
+#include "protocol/common.h"
#include "transport_manager/common.h"
-#include "transport_manager/info.h"
#include "transport_manager/error.h"
-#include "protocol/common.h"
+#include "transport_manager/info.h"
namespace transport_manager {
@@ -56,8 +57,8 @@ class TransportManagerListener {
virtual void OnDeviceListUpdated(const std::vector<DeviceInfo>&) = 0;
/**
- * @brief Reaction to "Find new applications" request
- */
+ * @brief Reaction to "Find new applications" request
+ */
virtual void OnFindNewApplicationsRequest() = 0;
/**
@@ -100,6 +101,19 @@ class TransportManagerListener {
virtual void OnScanDevicesFailed(const SearchDeviceError& error) = 0;
/**
+ * @brief Reaction to the event, when the cloud connection status is updated.
+ */
+ virtual void OnConnectionStatusUpdated() = 0;
+
+ /**
+ * @brief Reaction to the event, when connection is pending.
+ *
+ * @param devcie_info Variable that hold information about device.
+ * @param connection_id connection unique identifier.
+ */
+ virtual void OnConnectionPending(const DeviceInfo& device_info,
+ const ConnectionUID connection_id) = 0;
+ /**
* @brief Reaction to the event, when connection is established.
*
* @param devcie_info Variable that hold information about device.
@@ -193,6 +207,14 @@ class TransportManagerListener {
virtual void OnTMMessageSendFailed(
const DataSendError& error,
const ::protocol_handler::RawMessagePtr message) = 0;
+
+ /**
+ * @brief Notifies that configuration of a transport has been updated.
+ *
+ * @param configs pairs of key and value that represent configuration.
+ */
+ virtual void OnTransportConfigUpdated(
+ const std::map<std::string, std::string>& configs) = 0;
};
} // namespace transport_manager
#endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER_H_
diff --git a/src/components/include/transport_manager/transport_manager_listener_empty.h b/src/components/include/transport_manager/transport_manager_listener_empty.h
index ca6c573a06..6754540b4c 100644
--- a/src/components/include/transport_manager/transport_manager_listener_empty.h
+++ b/src/components/include/transport_manager/transport_manager_listener_empty.h
@@ -35,8 +35,8 @@
#include <vector>
-#include "transport_manager/transport_manager_listener.h"
#include "protocol/common.h"
+#include "transport_manager/transport_manager_listener.h"
namespace transport_manager {
@@ -59,6 +59,8 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
void OnFindNewApplicationsRequest() OVERRIDE {}
+ void OnConnectionStatusUpdated() OVERRIDE {}
+
/**
* @brief Reaction to the event, when the device is found.
*
@@ -99,6 +101,15 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
void OnScanDevicesFailed(const SearchDeviceError& error) OVERRIDE {}
/**
+ * @brief Reaction to the event, when connection is pending.
+ *
+ * @param devcie_info Variable that hold information about device.
+ * @param connection_id connection unique identifier.
+ */
+ void OnConnectionPending(const DeviceInfo& device_info,
+ const ConnectionUID connection_id) OVERRIDE {}
+
+ /**
* @brief Reaction to the event, when connection is established.
*
* @param devcie_info Variable that hold information about device.
@@ -187,6 +198,14 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
void OnTMMessageSendFailed(
const DataSendError& error,
const ::protocol_handler::RawMessagePtr message) OVERRIDE {}
+
+ /**
+ * @brief Notifies that configuration of a transport has been updated.
+ *
+ * @param configs pairs of key and value that represent configuration.
+ */
+ void OnTransportConfigUpdated(
+ const std::map<std::string, std::string>& configs) OVERRIDE {}
};
} // namespace transport_manager
#endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_LISTENER_EMPTY_H_
diff --git a/src/components/include/transport_manager/transport_manager_mme_settings.h b/src/components/include/transport_manager/transport_manager_mme_settings.h
index efe26468ab..721df03d34 100644
--- a/src/components/include/transport_manager/transport_manager_mme_settings.h
+++ b/src/components/include/transport_manager/transport_manager_mme_settings.h
@@ -60,6 +60,6 @@ class TransportManagerMMESettings {
virtual uint32_t iap_hub_connection_wait_timeout() const = 0;
};
-}
+} // namespace transport_manager
#endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_MME_SETTINGS_H_
diff --git a/src/components/include/transport_manager/transport_manager_settings.h b/src/components/include/transport_manager/transport_manager_settings.h
index feb3fa2c02..fee5b031ed 100644
--- a/src/components/include/transport_manager/transport_manager_settings.h
+++ b/src/components/include/transport_manager/transport_manager_settings.h
@@ -63,6 +63,48 @@ class TransportManagerSettings : public TransportManagerMMESettings {
* the transport change timeout value.
*/
virtual uint32_t app_transport_change_timer_addition() const = 0;
+
+ /**
+ * @brief Returns the network interface name for TCP transport adapter
+ */
+ virtual const std::string& transport_manager_tcp_adapter_network_interface()
+ const = 0;
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+ /**
+ *@brief Returns websocket server address
+ */
+ virtual const std::string& websocket_server_address() const = 0;
+
+ /**
+ * @brief Returns port for websocket server
+ */
+ virtual uint16_t websocket_server_port() const = 0;
+
+#ifdef ENABLE_SECURITY
+ virtual const std::string& ws_server_cert_path() const = 0;
+ virtual const std::string& ws_server_key_path() const = 0;
+ virtual const std::string& ws_server_ca_cert_path() const = 0;
+ virtual const bool wss_server_supported() const = 0;
+#endif // ENABLE_SECURITY
+#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+ /**
+ * @brief Returns retry timeout for cloud app connections
+ */
+ virtual uint32_t cloud_app_retry_timeout() const = 0;
+
+ /**
+ * @brief Returns maximum retry attempts for cloud app connections
+ */
+ virtual uint16_t cloud_app_max_retry_attempts() const = 0;
+
+ virtual const uint8_t* bluetooth_uuid() const = 0;
+
+ virtual const std::string& aoa_filter_manufacturer() const = 0;
+ virtual const std::string& aoa_filter_model_name() const = 0;
+ virtual const std::string& aoa_filter_description() const = 0;
+ virtual const std::string& aoa_filter_version() const = 0;
+ virtual const std::string& aoa_filter_uri() const = 0;
+ virtual const std::string& aoa_filter_serial_number() const = 0;
};
} // namespace transport_manager
#endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_SETTINGS_H_
diff --git a/src/components/include/utils/atomic_object.h b/src/components/include/utils/atomic_object.h
deleted file mode 100644
index 257fcfbe3a..0000000000
--- a/src/components/include/utils/atomic_object.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_INCLUDE_UTILS_ATOMIC_OBJECT_H_
-#define SRC_COMPONENTS_INCLUDE_UTILS_ATOMIC_OBJECT_H_
-
-#include "utils/rwlock.h"
-#include "utils/conditional_variable.h"
-#include "utils/macro.h"
-
-namespace sync_primitives {
-
-/**
- * @brief Allows to safely change stored value from different threads.
- *
- * The usage example:
- *
- * threads::Atomic<int> i;
- *
- * i = 5; // here SDL is able to guarantee that this value will be safely
- * // assigned even in multi threaded environment.
- */
-template <typename T>
-class Atomic {
- public:
- /**
- * @brief Atomic allows to construct atomic object.
- * The operation is not atomic.
- *
- * @param value the value to initialize object with.
- */
- Atomic(const T& value) : value_(value) {}
-
- /**
- * @brief operator = thread safe setter for stored value.
- *
- * @param val value to assign.
- *
- * @return mofified value.
- */
- T& operator=(const T& val) {
- sync_primitives::AutoWriteLock lock(rw_lock_);
- value_ = val;
- return value_;
- }
-
- /**
- * @brief operator T thread safe getter
- *
- * return stored value.
- */
- operator T() const {
- sync_primitives::AutoReadLock lock(rw_lock_);
- return value_;
- }
-
- /**
- * @brief operator T thread safe getter
- *
- * return stored value.
- */
- template <typename U>
- operator U() const {
- sync_primitives::AutoReadLock lock(rw_lock_);
- return static_cast<U>(value_);
- }
-
- private:
- T value_;
- mutable sync_primitives::RWLock rw_lock_;
-};
-
-typedef Atomic<int> atomic_int;
-typedef Atomic<int32_t> atomic_int32;
-typedef Atomic<uint32_t> atomic_uint32;
-typedef Atomic<int64_t> atomic_int64;
-typedef Atomic<uint64_t> atomic_uint64;
-typedef Atomic<size_t> atomic_size_t;
-typedef Atomic<bool> atomic_bool;
-
-} // namespace sync_primitives
-
-#endif // SRC_COMPONENTS_INCLUDE_UTILS_ATOMIC_OBJECT_H_
diff --git a/src/components/include/utils/conditional_variable.h b/src/components/include/utils/conditional_variable.h
index f54a22e993..a29f255dbf 100644
--- a/src/components/include/utils/conditional_variable.h
+++ b/src/components/include/utils/conditional_variable.h
@@ -32,24 +32,13 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_CONDITIONAL_VARIABLE_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_CONDITIONAL_VARIABLE_H_
-#if defined(OS_POSIX)
-#include <pthread.h>
-#else
-#error Please implement conditional variable for your OS
-#endif
#include <stdint.h>
+#include <boost/thread/condition_variable.hpp>
+#include "utils/lock.h"
#include "utils/macro.h"
namespace sync_primitives {
-class AutoLock;
-class Lock;
-
-namespace impl {
-#if defined(OS_POSIX)
-typedef pthread_cond_t PlatformConditionalVariable;
-#endif
-} // namespace impl
/*
* Conditional variable wrapper
@@ -82,11 +71,11 @@ class ConditionalVariable {
// Wait forever or up to milliseconds time limit
bool Wait(AutoLock& auto_lock);
- bool Wait(Lock& lock);
+ bool Wait(BaseLock& lock);
WaitStatus WaitFor(AutoLock& auto_lock, uint32_t milliseconds);
private:
- impl::PlatformConditionalVariable cond_var_;
+ boost::condition_variable_any cond_var_;
private:
DISALLOW_COPY_AND_ASSIGN(ConditionalVariable);
diff --git a/src/components/include/utils/custom_string.h b/src/components/include/utils/custom_string.h
index 7b21e7a64d..0e5ef244f0 100644
--- a/src/components/include/utils/custom_string.h
+++ b/src/components/include/utils/custom_string.h
@@ -81,8 +81,8 @@ class CustomString {
CustomString(size_t n, char c);
/**
- * @brief Returns the length of the string, in terms of characters.
- */
+ * @brief Returns the length of the string, in terms of characters.
+ */
size_t size() const;
/**
diff --git a/src/components/include/utils/data_accessor.h b/src/components/include/utils/data_accessor.h
index 645886592c..99820237c8 100644
--- a/src/components/include/utils/data_accessor.h
+++ b/src/components/include/utils/data_accessor.h
@@ -32,16 +32,14 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_DATA_ACCESSOR_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_DATA_ACCESSOR_H_
-#include <iostream>
#include "utils/lock.h"
-#include "utils/shared_ptr.h"
-// This class is for thread-safe access to data
+// This class is for thread-safe const access to data
template <class T>
class DataAccessor {
public:
DataAccessor(const T& data,
- const std::shared_ptr<sync_primitives::Lock>& lock)
+ const std::shared_ptr<sync_primitives::BaseLock>& lock)
: data_(data), lock_(lock), counter_(new uint32_t(0)) {
lock_->Acquire();
}
@@ -58,6 +56,7 @@ class DataAccessor {
--(*counter_);
}
}
+
const T& GetData() const {
return data_;
}
@@ -66,8 +65,8 @@ class DataAccessor {
void* operator new(size_t size);
const T& data_;
// Require that the lock lives at least as long as the DataAccessor
- const std::shared_ptr<sync_primitives::Lock> lock_;
- utils::SharedPtr<uint32_t> counter_;
+ const std::shared_ptr<sync_primitives::BaseLock> lock_;
+ std::shared_ptr<uint32_t> counter_;
};
#endif // SRC_COMPONENTS_INCLUDE_UTILS_DATA_ACCESSOR_H_
diff --git a/src/components/include/utils/date_time.h b/src/components/include/utils/date_time.h
index f8f8e3d6ce..747cb0ea69 100644
--- a/src/components/include/utils/date_time.h
+++ b/src/components/include/utils/date_time.h
@@ -32,69 +32,74 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_DATE_TIME_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_DATE_TIME_H_
-#if defined(OS_POSIX)
-#include <sys/time.h>
-typedef struct timeval TimevalStruct;
-#endif
#include <stdint.h>
+#include "boost/date_time/posix_time/posix_time_duration.hpp"
namespace date_time {
+// skip boost namespacing for all this
+// NOTE that it's called posix_time for its functionality, not for any
+// platform-dependence
+typedef boost::posix_time::time_duration TimeDuration;
+// Capture from boost's namespaces
+using boost::posix_time::microseconds;
+using boost::posix_time::milliseconds;
+using boost::posix_time::seconds;
+
enum TimeCompare { LESS, EQUAL, GREATER };
-class DateTime {
- public:
- static const int32_t MILLISECONDS_IN_SECOND = 1000;
- static const int32_t MICROSECONDS_IN_MILLISECOND = 1000;
- static const int32_t NANOSECONDS_IN_MICROSECOND = 1000;
- static const int32_t SECONDS_IN_HOUR = 3600;
- static const int32_t MICROSECONDS_IN_SECOND =
- MILLISECONDS_IN_SECOND * MICROSECONDS_IN_MILLISECOND;
- static const int32_t NANOSECONDS_IN_MILLISECOND =
- MICROSECONDS_IN_MILLISECOND * NANOSECONDS_IN_MICROSECOND;
+// public defines for external usage
+const int32_t MILLISECONDS_IN_SECOND = 1000;
+const int32_t MICROSECONDS_IN_MILLISECOND = 1000;
+const int32_t NANOSECONDS_IN_MICROSECOND = 1000;
+const int32_t SECONDS_IN_HOUR = 3600;
+const int32_t SECONDS_IN_DAY = 86400;
+const int32_t MICROSECONDS_IN_SECOND =
+ MILLISECONDS_IN_SECOND * MICROSECONDS_IN_MILLISECOND;
+const int32_t NANOSECONDS_IN_MILLISECOND =
+ MICROSECONDS_IN_MILLISECOND * NANOSECONDS_IN_MICROSECOND;
+
+TimeDuration getCurrentTime();
+
+// empty duration
+TimeDuration TimeDurationZero();
- static TimevalStruct getCurrentTime();
+// return SECONDS count
+int64_t getSecs(const TimeDuration& t);
- // return SECONDS count
- static int64_t getSecs(const TimevalStruct& time);
+// return MILLISECONDS count
+int64_t getmSecs(const TimeDuration& t);
+// return MICROSECONDS count
+int64_t getuSecs(const TimeDuration& t);
- // return MILLISECONDS count
- static int64_t getmSecs(const TimevalStruct& time);
- // return MICROSECONDS count
- static int64_t getuSecs(const TimevalStruct& time);
+// get just the MILLISECONDS count (< 1000)
+int64_t get_just_mSecs(const TimeDuration& t);
- // return MILLISECONDS count between sinceTime value and current time
- static int64_t calculateTimeSpan(const TimevalStruct& sinceTime);
+// get just the MICROSECONDS count (< 1000)
+int64_t get_just_uSecs(const TimeDuration& t);
- // return MILLISECONDS count between time1 and time2
- static int64_t calculateTimeDiff(const TimevalStruct& time1,
- const TimevalStruct& time2);
+// return MILLISECONDS count between sinceTime value and current time
+int64_t calculateTimeSpan(const TimeDuration& sinceTime);
- /**
- * @brief Adds milliseconds to time struct
- * @param time contains time struct
- * @param milliseconds contains value which need to
- * add to time struct
- **/
- static void AddMilliseconds(TimevalStruct& time, uint32_t milliseconds);
+// return MILLISECONDS count between time1 and time2
+int64_t calculateTimeDiff(const TimeDuration& time1, const TimeDuration& time2);
- static TimevalStruct Sub(const TimevalStruct& time1,
- const TimevalStruct& time2);
+// returns difference between specific date and current date
+int64_t calculateAmountDaysFromDate(const std::time_t& start_date);
- static TimeCompare compareTime(const TimevalStruct& time1,
- const TimevalStruct& time2);
+/**
+ * @brief Adds milliseconds to time struct
+ * @param time contains time struct
+ * @param milliseconds contains value which need to
+ * add to time struct
+ **/
+void AddMilliseconds(TimeDuration& time, uint32_t milliseconds);
- static bool Greater(const TimevalStruct& time1, const TimevalStruct& time2);
- static bool Less(const TimevalStruct& time1, const TimevalStruct& time2);
- static bool Equal(const TimevalStruct& time1, const TimevalStruct& time2);
+TimeCompare compareTime(const TimeDuration& time1, const TimeDuration& time2);
- private:
- static TimevalStruct ConvertionUsecs(const TimevalStruct& time);
-};
+bool Greater(const TimeDuration& time1, const TimeDuration& time2);
+bool Less(const TimeDuration& time1, const TimeDuration& time2);
+bool Equal(const TimeDuration& time1, const TimeDuration& time2);
} // namespace date_time
-bool operator<(const TimevalStruct& time1, const TimevalStruct& time2);
-bool operator==(const TimevalStruct& time1, const TimevalStruct& time2);
-const TimevalStruct operator-(const TimevalStruct& time1,
- const TimevalStruct& time2);
#endif // SRC_COMPONENTS_INCLUDE_UTILS_DATE_TIME_H_
diff --git a/src/components/include/utils/lock.h b/src/components/include/utils/lock.h
index 081e651b13..bfa1ef1770 100644
--- a/src/components/include/utils/lock.h
+++ b/src/components/include/utils/lock.h
Binary files differ
diff --git a/src/components/include/utils/logger.h b/src/components/include/utils/logger.h
index 75daa552a2..d492cfcb1b 100644
--- a/src/components/include/utils/logger.h
+++ b/src/components/include/utils/logger.h
@@ -35,13 +35,13 @@
#ifdef ENABLE_LOG
#include <errno.h>
-#include <string.h>
-#include <sstream>
#include <log4cxx/propertyconfigurator.h>
#include <log4cxx/spi/loggingevent.h>
-#include "utils/push_log.h"
-#include "utils/logger_status.h"
+#include <string.h>
+#include <sstream>
#include "utils/auto_trace.h"
+#include "utils/logger_status.h"
+#include "utils/push_log.h"
#endif // ENABLE_LOG
#ifdef ENABLE_LOG
@@ -65,6 +65,11 @@
void deinit_logger();
#define DEINIT_LOGGER() deinit_logger()
+// Logger thread deinitilization macro that need to stop the thread of handling
+// messages for the log4cxx
+#define DELETE_THREAD_LOGGER(logger_var) \
+ logger::delete_log_message_loop_thread(logger_var)
+
// special macros to dump logs from queue
// it's need, for example, when crash happend
#define FLUSH_LOGGER() logger::flush_logger()
@@ -121,15 +126,15 @@ log4cxx_time_t time_now();
#define LOG4CXX_FATAL(loggerPtr, logEvent) \
LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getFatal(), logEvent)
-#define LOG4CXX_ERROR_WITH_ERRNO(loggerPtr, message) \
- LOG4CXX_ERROR(loggerPtr, \
- message << ", error code " << errno << " (" << strerror(errno) \
- << ")")
+#define LOG4CXX_ERROR_WITH_ERRNO(loggerPtr, message) \
+ LOG4CXX_ERROR( \
+ loggerPtr, \
+ message << ", error code " << errno << " (" << strerror(errno) << ")")
-#define LOG4CXX_WARN_WITH_ERRNO(loggerPtr, message) \
- LOG4CXX_WARN(loggerPtr, \
- message << ", error code " << errno << " (" << strerror(errno) \
- << ")")
+#define LOG4CXX_WARN_WITH_ERRNO(loggerPtr, message) \
+ LOG4CXX_WARN( \
+ loggerPtr, \
+ message << ", error code " << errno << " (" << strerror(errno) << ")")
#else // ENABLE_LOG is OFF
@@ -141,6 +146,8 @@ log4cxx_time_t time_now();
#define DEINIT_LOGGER()
+#define DELETE_THREAD_LOGGER(logger_var)
+
#define FLUSH_LOGGER()
#define LOG4CXX_IS_TRACE_ENABLED(logger) false
diff --git a/src/components/include/utils/macro.h b/src/components/include/utils/macro.h
index e6f3b6b3ca..00298f690e 100644
--- a/src/components/include/utils/macro.h
+++ b/src/components/include/utils/macro.h
@@ -40,7 +40,7 @@
#include "logger.h"
// A macro to set some action for variable to avoid "unused variable" warning
-#define UNUSED(x) (void) x;
+#define UNUSED(x) (void)x;
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
@@ -133,9 +133,9 @@
#endif
/*
-* @brief Calculate size of na array
-* @param arr array, which size need to calculate
-*/
+ * @brief Calculate size of na array
+ * @param arr array, which size need to calculate
+ */
#define ARRAYSIZE(arr) sizeof(arr) / sizeof(*arr)
#ifdef BUILD_TESTS
@@ -146,9 +146,9 @@
#endif // BUILD_TESTS
/*
-* @brief deprecate a method declaration, a warning will be thrown by your
-* compiler if a method with this macro is used
-*/
+ * @brief deprecate a method declaration, a warning will be thrown by your
+ * compiler if a method with this macro is used
+ */
#if __cplusplus > 201103L
#define DEPRECATED [[deprecated]]
#else
diff --git a/src/components/include/utils/make_shared.h b/src/components/include/utils/make_shared.h
deleted file mode 100644
index 9d40d646a6..0000000000
--- a/src/components/include/utils/make_shared.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_INCLUDE_UTILS_MAKE_SHARED_H_
-#define SRC_COMPONENTS_INCLUDE_UTILS_MAKE_SHARED_H_
-
-#include <new>
-/**
- * @brief The functions set below allows to create shared pointer in a safe way.
- * There are up to 5 parameters could be passed as the constructor parameters.
- *
- * @example
- * struct A {
- * A(int){}
- * A(int, double) {}
- * A(int, double, std::string) {}
- * }
- * SharedPtr<A> shared1(MakeShared<A>(5);
- * SharedPtr<A> shared2(MakeShared<A>(5, 5.5);
- * SharedPtr<A> shared3(MakeShared<A>(5, 5.5, std::string("MyStr"));
- *
- * The profit in using MakeShared instead of simple allocation with operator new
- *is evident.
- * Firstly it allows us to centralize allocation place, secondly it allows us to
- *use
- * safe operator new overloading (no throwable one).
- */
-namespace utils {
-template <typename T>
-class SharedPtr;
-
-namespace {
-template <typename T>
-SharedPtr<T> Initialize(T* object) {
- return object == NULL ? SharedPtr<T>() : SharedPtr<T>(object);
-}
-}
-
-template <typename T>
-SharedPtr<T> MakeShared() {
- T* t = new (std::nothrow) T;
- return Initialize(t);
-}
-
-template <typename T, typename Arg1>
-SharedPtr<T> MakeShared(Arg1& arg1) {
- T* t = new (std::nothrow) T(arg1);
- return Initialize(t);
-}
-
-template <typename T, typename Arg1, typename Arg2>
-SharedPtr<T> MakeShared(Arg1& arg1, Arg2& arg2) {
- T* t = new (std::nothrow) T(arg1, arg2);
- return Initialize(t);
-}
-
-template <typename T, typename Arg1, typename Arg2, typename Arg3>
-SharedPtr<T> MakeShared(Arg1& arg1, Arg2& arg2, Arg3& arg3) {
- T* t = new (std::nothrow) T(arg1, arg2, arg3);
- return Initialize(t);
-}
-
-template <typename T,
- typename Arg1,
- typename Arg2,
- typename Arg3,
- typename Arg4>
-SharedPtr<T> MakeShared(Arg1& arg1, Arg2& arg2, Arg3& arg3, Arg4& arg4) {
- T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4);
- return Initialize(t);
-}
-
-template <typename T,
- typename Arg1,
- typename Arg2,
- typename Arg3,
- typename Arg4,
- typename Arg5>
-SharedPtr<T> MakeShared(
- Arg1& arg1, Arg2& arg2, Arg3& arg3, Arg4& arg4, Arg5& arg5) {
- T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4, arg5);
- return Initialize(t);
-}
-
-template <typename T,
- typename Arg1,
- typename Arg2,
- typename Arg3,
- typename Arg4,
- typename Arg5,
- typename Arg6>
-SharedPtr<T> MakeShared(
- Arg1& arg1, Arg2& arg2, Arg3& arg3, Arg4& arg4, Arg5& arg5, Arg6& arg6) {
- T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4, arg5, arg6);
- return Initialize(t);
-}
-
-template <typename T, typename Arg1>
-SharedPtr<T> MakeShared(const Arg1& arg1) {
- T* t = new (std::nothrow) T(arg1);
- return Initialize(t);
-}
-
-template <typename T, typename Arg1, typename Arg2>
-SharedPtr<T> MakeShared(const Arg1& arg1, const Arg2& arg2) {
- T* t = new (std::nothrow) T(arg1, arg2);
- return Initialize(t);
-}
-
-template <typename T, typename Arg1, typename Arg2, typename Arg3>
-SharedPtr<T> MakeShared(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) {
- T* t = new (std::nothrow) T(arg1, arg2, arg3);
- return Initialize(t);
-}
-
-template <typename T,
- typename Arg1,
- typename Arg2,
- typename Arg3,
- typename Arg4>
-SharedPtr<T> MakeShared(const Arg1& arg1,
- const Arg2& arg2,
- const Arg3& arg3,
- const Arg4& arg4) {
- T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4);
- return Initialize(t);
-}
-
-template <typename T,
- typename Arg1,
- typename Arg2,
- typename Arg3,
- typename Arg4,
- typename Arg5>
-SharedPtr<T> MakeShared(const Arg1& arg1,
- const Arg2& arg2,
- const Arg3& arg3,
- const Arg4& arg4,
- const Arg5& arg5) {
- T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4, arg5);
- return Initialize(t);
-}
-
-template <typename T,
- typename Arg1,
- typename Arg2,
- typename Arg3,
- typename Arg4,
- typename Arg5,
- typename Arg6>
-SharedPtr<T> MakeShared(const Arg1& arg1,
- const Arg2& arg2,
- const Arg3& arg3,
- const Arg4& arg4,
- const Arg5& arg5,
- const Arg6& arg6) {
- T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4, arg5, arg6);
- return Initialize(t);
-}
-
-} // namespace utils;
-#endif // SRC_COMPONENTS_INCLUDE_UTILS_MAKE_SHARED_H_
diff --git a/src/components/include/utils/message_queue.h b/src/components/include/utils/message_queue.h
index 093aa4cac2..8dfe7afa52 100644
--- a/src/components/include/utils/message_queue.h
+++ b/src/components/include/utils/message_queue.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_MESSAGE_QUEUE_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_MESSAGE_QUEUE_H_
-#include <queue>
#include <algorithm>
+#include <queue>
#include "utils/conditional_variable.h"
#include "utils/lock.h"
@@ -97,9 +97,9 @@ class MessageQueue {
void wait();
/**
- * \brief waitUntilEmpty message queue
- * Wait until message queue is empty
- */
+ * \brief waitUntilEmpty message queue
+ * Wait until message queue is empty
+ */
void WaitUntilEmpty();
/**
@@ -112,8 +112,8 @@ class MessageQueue {
void Shutdown();
/**
- * \brief Clears queue.
- */
+ * \brief Clears queue.
+ */
void Reset();
private:
@@ -131,8 +131,7 @@ class MessageQueue {
};
template <typename T, class Q>
-MessageQueue<T, Q>::MessageQueue()
- : shutting_down_(false) {}
+MessageQueue<T, Q>::MessageQueue() : shutting_down_(false) {}
template <typename T, class Q>
MessageQueue<T, Q>::~MessageQueue() {}
diff --git a/src/components/include/utils/messagemeter.h b/src/components/include/utils/messagemeter.h
index 42b658ad6b..1148a65b57 100644
--- a/src/components/include/utils/messagemeter.h
+++ b/src/components/include/utils/messagemeter.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_INCLUDE_UTILS_MESSAGEMETER_H_
#include <cstddef>
-#include <set>
#include <map>
+#include <set>
#include "utils/date_time.h"
namespace utils {
@@ -82,20 +82,19 @@ class MessageMeter {
void ClearIdentifiers();
void set_time_range(const size_t time_range_msecs);
- void set_time_range(const TimevalStruct& time_range);
- TimevalStruct time_range() const;
+ void set_time_range(const date_time::TimeDuration& time_range);
+ date_time::TimeDuration time_range() const;
private:
- TimevalStruct time_range_;
- typedef std::multiset<TimevalStruct> Timings;
+ date_time::TimeDuration time_range_;
+ typedef std::multiset<date_time::TimeDuration> Timings;
typedef std::map<Id, Timings> TimingMap;
TimingMap timing_map_;
};
template <class Id>
-MessageMeter<Id>::MessageMeter()
- : time_range_(TimevalStruct{0, 0}) {
- time_range_.tv_sec = 1;
+MessageMeter<Id>::MessageMeter() {
+ time_range_ = date_time::seconds(1);
}
template <class Id>
@@ -106,7 +105,7 @@ size_t MessageMeter<Id>::TrackMessage(const Id& id) {
template <class Id>
size_t MessageMeter<Id>::TrackMessages(const Id& id, const size_t count) {
Timings& timings = timing_map_[id];
- const TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ const date_time::TimeDuration current_time = date_time::getCurrentTime();
for (size_t i = 0; i < count; ++i) {
// Adding to the end is amortized constant
timings.insert(timings.end(), current_time);
@@ -124,8 +123,8 @@ size_t MessageMeter<Id>::Frequency(const Id& id) {
if (timings.empty()) {
return 0u;
}
- const TimevalStruct actual_begin_time = date_time::DateTime::Sub(
- date_time::DateTime::getCurrentTime(), time_range_);
+ const date_time::TimeDuration actual_begin_time =
+ (date_time::getCurrentTime() - time_range_);
timings.erase(timings.begin(), timings.upper_bound(actual_begin_time));
return timings.size();
}
@@ -142,21 +141,15 @@ void MessageMeter<Id>::ClearIdentifiers() {
template <class Id>
void MessageMeter<Id>::set_time_range(const size_t time_range_msecs) {
- // TODO(EZamakhov): move to date_time::DateTime
- const size_t secs =
- time_range_msecs / date_time::DateTime::MILLISECONDS_IN_SECOND;
- time_range_.tv_sec = secs;
- const size_t mSecs =
- time_range_msecs % date_time::DateTime::MILLISECONDS_IN_SECOND;
- time_range_.tv_usec =
- mSecs * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
+ time_range_ = date_time::milliseconds(time_range_msecs);
}
template <class Id>
-void MessageMeter<Id>::set_time_range(const TimevalStruct& time_range) {
+void MessageMeter<Id>::set_time_range(
+ const date_time::TimeDuration& time_range) {
time_range_ = time_range;
}
template <class Id>
-TimevalStruct MessageMeter<Id>::time_range() const {
+date_time::TimeDuration MessageMeter<Id>::time_range() const {
return time_range_;
}
} // namespace utils
diff --git a/src/components/include/utils/mutable_data_accessor.h b/src/components/include/utils/mutable_data_accessor.h
new file mode 100644
index 0000000000..0e03345a45
--- /dev/null
+++ b/src/components/include/utils/mutable_data_accessor.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_MUTABLE_DATA_ACCESSOR_H
+#define SRC_COMPONENTS_INCLUDE_UTILS_MUTABLE_DATA_ACCESSOR_H
+
+#include "utils/lock.h"
+
+// This class is for thread-safe mutable access to data
+
+template <class T>
+class MutableDataAccessor {
+ public:
+ MutableDataAccessor(T& data,
+ const std::shared_ptr<sync_primitives::BaseLock>& lock)
+ : data_(data), lock_(lock), counter_(new uint32_t(0)) {
+ lock_->Acquire();
+ }
+
+ MutableDataAccessor(const MutableDataAccessor<T>& other)
+ : data_(other.data_), lock_(other.lock_), counter_(other.counter_) {
+ ++(*counter_);
+ }
+
+ ~MutableDataAccessor() {
+ if (0 == *counter_) {
+ lock_->Release();
+ } else {
+ --(*counter_);
+ }
+ }
+
+ const T& GetData() const {
+ return data_;
+ }
+
+ T& GetMutableData() {
+ return data_;
+ }
+
+ private:
+ void* operator new(size_t size);
+ T& data_;
+ // Require that the lock lives at least as long as the DataAccessor
+ const std::shared_ptr<sync_primitives::BaseLock> lock_;
+ std::shared_ptr<uint32_t> counter_;
+};
+
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_MUTABLE_DATA_ACCESSOR_H
diff --git a/src/components/include/utils/prioritized_queue.h b/src/components/include/utils/prioritized_queue.h
index eb4ba6a6c3..a2eb200012 100644
--- a/src/components/include/utils/prioritized_queue.h
+++ b/src/components/include/utils/prioritized_queue.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_PRIORITIZED_QUEUE_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_PRIORITIZED_QUEUE_H_
-#include <queue>
-#include <map>
#include <algorithm>
+#include <map>
+#include <queue>
#include "utils/macro.h"
diff --git a/src/components/include/utils/push_log.h b/src/components/include/utils/push_log.h
index aaeaa83bae..f6c396ae71 100644
--- a/src/components/include/utils/push_log.h
+++ b/src/components/include/utils/push_log.h
@@ -51,7 +51,7 @@ bool logs_enabled();
void set_logs_enabled(bool state);
void create_log_message_loop_thread();
-void delete_log_message_loop_thread();
+void delete_log_message_loop_thread(log4cxx::LoggerPtr& logger);
} // namespace logger
#endif // SRC_COMPONENTS_INCLUDE_UTILS_PUSH_LOG_H_
diff --git a/src/components/include/utils/rwlock.h b/src/components/include/utils/rwlock.h
index b7e7484b48..5c7735713e 100644
--- a/src/components/include/utils/rwlock.h
+++ b/src/components/include/utils/rwlock.h
@@ -98,15 +98,15 @@ class RWLock {
bool TryAcquireForReading();
/**
- * @brief Try to Acqure read-write lock for writing.
- * Applies a write lock like AcquireForWriting(), with the exception that
+ * @brief Try to Acqure read-write lock for writing.
+ * Applies a write lock like AcquireForWriting(), with the exception that
* the
- * function fails if any thread currently holds rwlock (for reading or
+ * function fails if any thread currently holds rwlock (for reading or
* writing)
- * Invoke of TryAcquireForWriting will not block calling thread and returns
+ * Invoke of TryAcquireForWriting will not block calling thread and returns
* "false"
- * @returns true if lock was acquired and false if was not
- */
+ * @returns true if lock was acquired and false if was not
+ */
bool TryAcquireForWriting();
/**
@@ -126,12 +126,12 @@ class RWLock {
bool AcquireForWriting();
/**
- * @brief Release read-write lock.
- * Releases a lock held on the read-write lock object.
- * Results are undefined if the read-write lock rwlock
- * is not held by the calling thread.
- * @returns true if lock was released and false if was not
- */
+ * @brief Release read-write lock.
+ * Releases a lock held on the read-write lock object.
+ * Results are undefined if the read-write lock rwlock
+ * is not held by the calling thread.
+ * @returns true if lock was released and false if was not
+ */
bool Release();
private:
diff --git a/src/components/include/utils/scope_guard.h b/src/components/include/utils/scope_guard.h
index a425356c0e..a05be6dc11 100644
--- a/src/components/include/utils/scope_guard.h
+++ b/src/components/include/utils/scope_guard.h
@@ -322,5 +322,5 @@ ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj,
const P1& p1) {
return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
}
-}
+} // namespace utils
#endif // SRC_COMPONENTS_INCLUDE_UTILS_SCOPE_GUARD_H_
diff --git a/src/components/include/utils/semantic_version.h b/src/components/include/utils/semantic_version.h
new file mode 100644
index 0000000000..01b04495ad
--- /dev/null
+++ b/src/components/include/utils/semantic_version.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2018, Livio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_SEMANTIC_VERSION_H_
+#define SRC_COMPONENTS_INCLUDE_UTILS_SEMANTIC_VERSION_H_
+
+#include <string>
+namespace utils {
+
+struct SemanticVersion {
+ SemanticVersion(uint16_t major = 0, uint16_t minor = 0, uint16_t patch = 0) {
+ major_version_ = major;
+ minor_version_ = minor;
+ patch_version_ = patch;
+ }
+
+ SemanticVersion(const SemanticVersion& other) {
+ major_version_ = other.major_version_;
+ minor_version_ = other.minor_version_;
+ patch_version_ = other.patch_version_;
+ }
+
+ SemanticVersion(const std::string& versionString)
+ : major_version_(0), minor_version_(0), patch_version_(0) {
+ int readElements = sscanf(versionString.c_str(),
+ "%hu.%hu.%hu",
+ &major_version_,
+ &minor_version_,
+ &patch_version_);
+
+ if (readElements < 2) {
+ major_version_ = 0;
+ minor_version_ = 0;
+ patch_version_ = 0;
+ }
+ }
+
+ static inline int16_t cmp(const SemanticVersion& version1,
+ const SemanticVersion& version2) {
+ int16_t diff =
+ static_cast<int16_t>(version1.major_version_ - version2.major_version_);
+ if (diff == 0) {
+ diff = static_cast<int16_t>(version1.minor_version_ -
+ version2.minor_version_);
+ if (diff == 0) {
+ diff = static_cast<int16_t>(version1.patch_version_ -
+ version2.patch_version_);
+ }
+ }
+ return diff;
+ }
+
+ bool operator==(const SemanticVersion& other) const {
+ return SemanticVersion::cmp(*this, other) == 0;
+ }
+ bool operator<(const SemanticVersion& other) const {
+ return SemanticVersion::cmp(*this, other) < 0;
+ }
+ bool operator>(const SemanticVersion& other) const {
+ return SemanticVersion::cmp(*this, other) > 0;
+ }
+ bool operator<=(const SemanticVersion& other) const {
+ return SemanticVersion::cmp(*this, other) <= 0;
+ }
+ bool operator>=(const SemanticVersion& other) const {
+ return SemanticVersion::cmp(*this, other) >= 0;
+ }
+ static inline SemanticVersion* min(SemanticVersion& version1,
+ SemanticVersion& version2) {
+ return (version1 < version2) ? &version1 : &version2;
+ }
+
+ const std::string toString() const {
+ std::string result = "";
+ result += std::to_string(major_version_);
+ result += ".";
+ result += std::to_string(minor_version_);
+ result += ".";
+ result += std::to_string(patch_version_);
+ return result;
+ }
+
+ bool isValid() const {
+ return major_version_ > 0 || minor_version_ > 0 || patch_version_ > 0;
+ }
+
+ uint16_t major_version_ = 0;
+ uint16_t minor_version_ = 0;
+ uint16_t patch_version_ = 0;
+};
+
+extern const SemanticVersion base_rpc_version;
+extern const SemanticVersion rpc_version_5;
+} // namespace utils
+
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_CALLABLE_H
diff --git a/src/components/include/utils/shared_ptr.h b/src/components/include/utils/shared_ptr.h
deleted file mode 100644
index 064bb36b4a..0000000000
--- a/src/components/include/utils/shared_ptr.h
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_INCLUDE_UTILS_SHARED_PTR_H_
-#define SRC_COMPONENTS_INCLUDE_UTILS_SHARED_PTR_H_
-
-#include <assert.h>
-#include <stddef.h>
-#include <stdint.h>
-
-#include "utils/macro.h"
-#include "utils/atomic.h"
-
-namespace utils {
-
-/**
- * @brief Shared pointer.
- *
- * Pointer to an object with reference counting.
- * Object will be automatically deallocated when last shared
- * pointer is destroyed.
- *
- * @tparam ObjectType Type of wrapped object.
- **/
-template <typename ObjectType>
-class SharedPtr {
- static void DummyDeleter(ObjectType* object_to_delete) {
- delete object_to_delete;
- }
-
- public:
- // std smart pointer compatibility
- typedef ObjectType element_type;
- typedef void (*Deleter)(ObjectType*);
- /**
- * @brief Constructor.
- *
- * Initialize shared pointer with wrapped object.
- * Reference counter will be initialized to 1.
- *
- * @param Object Wrapped object.
- **/
- SharedPtr(ObjectType* Object);
-
- SharedPtr(ObjectType* Object, Deleter deleter)
- : mObject(Object)
- , mReferenceCounter(new uint32_t(1))
- , deleter_(deleter) {}
-
- SharedPtr();
-
- /**
- * @brief Copy constructor.
- *
- * Initialize shared pointer with another shared pointer.
- * Reference counter will be incremented.
- *
- * @param Other Other shared pointer.
- **/
- SharedPtr(const SharedPtr<ObjectType>& Other);
-
- /**
- * @brief Copy constructor.
- *
- * Initialize shared pointer with another shared pointer.
- * Reference counter will be incremented.
- *
- * @tparam OtherObjectType Type of other object pointer. This
- * allows creating a shared pointer to an
- * intstance of a base class from a shared
- * pointer to an instance of a class
- * inherited from this base class.
- * If OtherObjectType is not implicitly
- * convertible to ObjectType it will
- * cause a compile error.
- *
- * @param Other Other shared pointer.
- **/
- template <typename OtherObjectType>
- SharedPtr(const SharedPtr<OtherObjectType>& Other);
-
- /**
- * @brief Destructor.
- *
- * Decrement reference counter and destroy wrapped object
- * if reference counter reaches zero.
- **/
- ~SharedPtr();
-
- /**
- * @brief Assignment operator.
- *
- * Drop reference to currently referenced object and add
- * reference to assigned object.
- *
- * @param Other Shared pointer to an object
- * that must be referenced.
- *
- * @return Reference to this shared pointer.
- **/
- SharedPtr<ObjectType>& operator=(const SharedPtr<ObjectType>& Other);
-
- bool operator==(const SharedPtr<ObjectType>& Other) const;
-
- bool operator<(const SharedPtr<ObjectType>& other) const;
-
- /**
- * @brief Assignment operator.
- *
- * Drop reference to currently referenced object and add
- * reference to assigned object.
- *
- * @tparam OtherObjectType Type of other object pointer. This
- * allows creating a shared pointer to an
- * intstance of a base class from a shared
- * pointer to an instance of a class
- * inherited from this base class.
- * If OtherObjectType is not implicitly
- * convertible to ObjectType it will
- * cause a compile error.
- *
- * @param Other Shared pointer to an object
- * that must be referenced.
- *
- * @return Reference to this shared pointer.
- **/
- template <typename OtherObjectType>
- SharedPtr<ObjectType>& operator=(const SharedPtr<OtherObjectType>& Other);
-
- template <typename OtherObjectType>
- static SharedPtr<OtherObjectType> static_pointer_cast(
- const SharedPtr<ObjectType>& pointer);
-
- template <typename OtherObjectType>
- static SharedPtr<OtherObjectType> dynamic_pointer_cast(
- const SharedPtr<ObjectType>& pointer);
-
- /**
- * @brief Member access operator.
- *
- * @return Wrapped object.
- **/
- ObjectType* operator->() const;
-
- ObjectType& operator*() const;
- operator bool() const;
- void reset();
- void reset(ObjectType* other);
- ObjectType* get() const;
-
-#ifdef BUILD_TESTS
- inline const uint32_t* get_ReferenceCounter() const {
- return mReferenceCounter;
- }
-#endif // BUILD_TESTS
-
- /**
- * @return true if mObject not NULL
- */
- bool valid() const;
-
- private:
- void reset_impl(ObjectType* other);
-
- // TSharedPtr needs access to other TSharedPtr private members
- // for shared pointers type casts.
- template <typename OtherObjectType>
- friend class SharedPtr;
-
- /**
- * @brief Drop reference to wrapped object.
- *
- * If reference counter reaches zero object and its reference
- * counter will be deallocated.
- **/
- void dropReference();
-
- /**
- * @brief Wrapped object.
- **/
- ObjectType* mObject;
-
- /**
- * @brief Pointer to reference counter.
- **/
- uint32_t* mReferenceCounter;
-
- Deleter deleter_;
- void release();
-};
-
-template <typename ObjectType>
-inline utils::SharedPtr<ObjectType>::SharedPtr(ObjectType* Object)
- : mObject(NULL)
- , mReferenceCounter(new uint32_t(1))
- , deleter_(DummyDeleter) {
- DCHECK(Object != NULL);
- mObject = Object;
-}
-
-template <typename ObjectType>
-inline utils::SharedPtr<ObjectType>::SharedPtr()
- : mObject(0), mReferenceCounter(0), deleter_(DummyDeleter) {}
-
-template <typename ObjectType>
-inline utils::SharedPtr<ObjectType>::SharedPtr(
- const SharedPtr<ObjectType>& Other)
- : mObject(0), mReferenceCounter(0), deleter_(DummyDeleter) {
- *this = Other;
-}
-
-template <typename ObjectType>
-template <typename OtherObjectType>
-inline utils::SharedPtr<ObjectType>::SharedPtr(
- const SharedPtr<OtherObjectType>& Other)
- : mObject(0), mReferenceCounter(0), deleter_(DummyDeleter) {
- *this = Other;
-}
-
-template <typename ObjectType>
-inline utils::SharedPtr<ObjectType>::~SharedPtr() {
- dropReference();
-}
-
-template <typename ObjectType>
-inline utils::SharedPtr<ObjectType>& utils::SharedPtr<ObjectType>::operator=(
- const SharedPtr<ObjectType>& Other) {
- return operator=<ObjectType>(Other);
-}
-
-template <typename ObjectType>
-inline bool utils::SharedPtr<ObjectType>::operator==(
- const SharedPtr<ObjectType>& Other) const {
- return (mObject == Other.mObject);
-}
-
-template <typename ObjectType>
-inline bool utils::SharedPtr<ObjectType>::operator<(
- const SharedPtr<ObjectType>& other) const {
- return (mObject < other.mObject);
-}
-
-template <typename ObjectType>
-template <typename OtherObjectType>
-inline utils::SharedPtr<ObjectType>& utils::SharedPtr<ObjectType>::operator=(
- const SharedPtr<OtherObjectType>& Other) {
- dropReference();
-
- mObject = Other.mObject;
- mReferenceCounter = Other.mReferenceCounter;
-
- if (0 != mReferenceCounter) {
- atomic_post_inc(mReferenceCounter);
- }
-
- return *this;
-}
-
-template <typename ObjectType>
-template <typename OtherObjectType>
-utils::SharedPtr<OtherObjectType> utils::SharedPtr<
- ObjectType>::static_pointer_cast(const SharedPtr<ObjectType>& pointer) {
- SharedPtr<OtherObjectType> casted_pointer;
- casted_pointer.mObject = static_cast<OtherObjectType*>(pointer.mObject);
- casted_pointer.mReferenceCounter = pointer.mReferenceCounter;
-
- if (0 != casted_pointer.mReferenceCounter) {
- atomic_post_inc(casted_pointer.mReferenceCounter);
- }
-
- return casted_pointer;
-}
-
-template <typename ObjectType>
-template <typename OtherObjectType>
-utils::SharedPtr<OtherObjectType> utils::SharedPtr<
- ObjectType>::dynamic_pointer_cast(const SharedPtr<ObjectType>& pointer) {
- SharedPtr<OtherObjectType> casted_pointer;
- casted_pointer.mObject = dynamic_cast<OtherObjectType*>(pointer.mObject);
- if (NULL != casted_pointer.mObject) {
- casted_pointer.mReferenceCounter = pointer.mReferenceCounter;
-
- if (0 != casted_pointer.mReferenceCounter) {
- atomic_post_inc(casted_pointer.mReferenceCounter);
- }
- }
-
- return casted_pointer;
-}
-
-template <typename ObjectType>
-ObjectType* utils::SharedPtr<ObjectType>::operator->() const {
- DCHECK(mObject);
- return mObject;
-}
-
-template <typename ObjectType>
-ObjectType& utils::SharedPtr<ObjectType>::operator*() const {
- DCHECK(mObject);
- return *mObject;
-}
-
-template <typename ObjectType>
-utils::SharedPtr<ObjectType>::operator bool() const {
- return valid();
-}
-
-template <typename ObjectType>
-void utils::SharedPtr<ObjectType>::reset() {
- reset_impl(0);
-}
-
-template <typename ObjectType>
-void utils::SharedPtr<ObjectType>::reset(ObjectType* other) {
- DCHECK(other != NULL);
- reset_impl(other);
-}
-
-template <typename ObjectType>
-void SharedPtr<ObjectType>::release() {
- deleter_(mObject);
- mObject = 0;
-
- delete mReferenceCounter;
- mReferenceCounter = 0;
-}
-
-template <typename ObjectType>
-void utils::SharedPtr<ObjectType>::reset_impl(ObjectType* other) {
- dropReference();
- mObject = other;
- mReferenceCounter = new uint32_t(1);
-}
-
-template <typename ObjectType>
-inline void SharedPtr<ObjectType>::dropReference() {
- if (0 != mReferenceCounter) {
- if (1 == atomic_post_dec(mReferenceCounter)) {
- release();
- }
- }
-}
-
-template <typename ObjectType>
-ObjectType* SharedPtr<ObjectType>::get() const {
- return mObject;
-}
-
-template <typename ObjectType>
-inline bool SharedPtr<ObjectType>::valid() const {
- if (mReferenceCounter && (0 < *mReferenceCounter)) {
- return (mObject != NULL);
- }
- return false;
-}
-
-} // namespace utils
-
-#endif // SRC_COMPONENTS_INCLUDE_UTILS_SHARED_PTR_H_
-
-// vim: set ts=2 sw=2 et:
diff --git a/src/components/include/utils/threads/async_runner.h b/src/components/include/utils/threads/async_runner.h
index 64c9d09939..5c88112267 100644
--- a/src/components/include/utils/threads/async_runner.h
+++ b/src/components/include/utils/threads/async_runner.h
@@ -33,14 +33,14 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_THREADS_ASYNC_RUNNER_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_THREADS_ASYNC_RUNNER_H_
-#include <string>
#include <queue>
+#include <string>
-#include "thread_delegate.h"
#include "thread.h"
+#include "thread_delegate.h"
-#include "utils/lock.h"
#include "utils/conditional_variable.h"
+#include "utils/lock.h"
namespace threads {
diff --git a/src/components/include/utils/threads/message_loop_thread.h b/src/components/include/utils/threads/message_loop_thread.h
index 15023f02dd..26ae127b69 100644
--- a/src/components/include/utils/threads/message_loop_thread.h
+++ b/src/components/include/utils/threads/message_loop_thread.h
@@ -33,14 +33,14 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_THREADS_MESSAGE_LOOP_THREAD_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_THREADS_MESSAGE_LOOP_THREAD_H_
-#include <string>
#include <queue>
+#include <string>
#include "utils/logger.h"
#include "utils/macro.h"
#include "utils/message_queue.h"
#include "utils/threads/thread.h"
-#include "utils/shared_ptr.h"
+
#include "utils/lock.h"
namespace threads {
diff --git a/src/components/include/utils/threads/thread.h b/src/components/include/utils/threads/thread.h
index cba79b20bd..6f72679d63 100644
--- a/src/components/include/utils/threads/thread.h
+++ b/src/components/include/utils/threads/thread.h
@@ -40,11 +40,11 @@
#include <ostream>
#include <string>
+#include "utils/conditional_variable.h"
+#include "utils/lock.h"
#include "utils/macro.h"
#include "utils/threads/thread_delegate.h"
#include "utils/threads/thread_options.h"
-#include "utils/conditional_variable.h"
-#include "utils/lock.h"
namespace threads {
diff --git a/src/components/dbus/test/dbus_adapter_test.cc b/src/components/include/utils/typed_enum_print.h
index 74a6de1aa9..0f3cc41bf8 100644
--- a/src/components/dbus/test/dbus_adapter_test.cc
+++ b/src/components/include/utils/typed_enum_print.h
@@ -1,8 +1,5 @@
/*
- * \file test_dbus_adapter.cc
- * \brief
- *
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2018, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,27 +30,23 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <gtest/gtest.h>
-#include "dbus/dbus_adapter.h"
-
-using ::dbus::DBusAdapter;
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_TYPED_ENUM_PRINT_H_
+#define SRC_COMPONENTS_INCLUDE_UTILS_TYPED_ENUM_PRINT_H_
-namespace test {
-namespace components {
-namespace dbus {
+#include <ostream>
+#include <type_traits>
-class DBusAdapterTest : public ::testing::Test {};
+namespace utils {
-TEST_F(DBusAdapterTest, Initialization) {
- const std::string kSdlServiceName = "test.ford.sdl.core";
- const std::string kSdlObjectPath = "/";
- const std::string kHmiServiceName = "test.ford.sdl.hmi";
- const std::string kHmiObjectPath = "/";
- ::dbus::DBusAdapter adapter(
- kSdlServiceName, kSdlObjectPath, kHmiServiceName, kHmiObjectPath);
- EXPECT_TRUE(adapter.Init());
+// Generic overloaded operator "<<" to be able to send enum class values to
+// std::ostream
+template <typename T>
+std::ostream& operator<<(
+ typename std::enable_if<std::is_enum<T>::value, std::ostream>::type& stream,
+ const T& e) {
+ return stream << static_cast<int>(e);
}
-} // namespace dbus
-} // namespace components
-} // namespace test
+} // namespace utils
+
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_TYPED_ENUM_PRINT_H_
diff --git a/src/components/interfaces/CMakeLists.txt b/src/components/interfaces/CMakeLists.txt
index 1ea481f11a..7f1a65277d 100644
--- a/src/components/interfaces/CMakeLists.txt
+++ b/src/components/interfaces/CMakeLists.txt
@@ -28,6 +28,19 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+# Copy RPC spec submodule files to interfaces directory
+if(EXISTS ${CMAKE_SOURCE_DIR}/tools/rpc_spec/)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${CMAKE_SOURCE_DIR}/tools/rpc_spec/MOBILE_API.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/MOBILE_API.xml)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ ${CMAKE_SOURCE_DIR}/tools/rpc_spec/MOBILE_API.xsd
+ ${CMAKE_CURRENT_SOURCE_DIR}/MOBILE_API.xsd)
+else ()
+ message( FATAL_ERROR "Missing the RPC Spec submodule" )
+ message( FATAL_ERROR "Please run `git submodule update --init` in the SDL Core source directory" )
+endif ()
+
include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/generators.cmake)
include_directories (
@@ -35,42 +48,23 @@ include_directories (
${COMPONENTS_DIR}/utils/include
${COMPONENTS_DIR}/formatters/include
${COMPONENTS_DIR}/smart_objects/include
+ ${BOOST_INCLUDE_DIR}
${CMAKE_BINARY_DIR}
)
-generate_interface("v4_protocol_v1_2_no_extra.xml" "NsSmartDeviceLinkRPC::V1" "sdlrpcv1")
+execute_process(COMMAND /usr/bin/env python3 -m pip install --upgrade --user pip setuptools wheel)
+set(GENERATOR_REQUIREMENTS "${CMAKE_SOURCE_DIR}/tools/InterfaceGenerator/requirements.txt")
+execute_process(COMMAND /usr/bin/env python3 -m pip install --user --requirement ${GENERATOR_REQUIREMENTS})
+
+generate_interface("v4_protocol_v1_2_no_extra.xml" "ns_smart_device_link_rpc::V1" "sdlrpcv1")
add_library(v4_protocol_v1_2_no_extra ${CMAKE_CURRENT_BINARY_DIR}/v4_protocol_v1_2_no_extra_schema.cc)
generate_interface("MOBILE_API.xml" "mobile_apis" "sdlrpcv2")
add_library(MOBILE_API ${CMAKE_CURRENT_BINARY_DIR}/MOBILE_API_schema.cc)
-if(HMI_JSON_API)
- generate_interface("HMI_API.xml" "hmi_apis" "jsonrpc")
- add_library(HMI_API ${CMAKE_CURRENT_BINARY_DIR}/HMI_API_schema.cc)
-endif()
-
-if(HMI_DBUS_API)
- generate_interface("QT_HMI_API.xml" "hmi_apis" "jsonrpc")
-
- add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/HMI_API.h"
- COMMAND sed "-e" "s/QT_HMI_API/HMI_API/g" "${CMAKE_CURRENT_BINARY_DIR}/QT_HMI_API.h" > "${CMAKE_CURRENT_BINARY_DIR}/HMI_API.h"
- DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/QT_HMI_API.h"
- )
- add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/HMI_API_schema.h"
- COMMAND sed "-e" "s/QT_HMI_API/HMI_API/g" "${CMAKE_CURRENT_BINARY_DIR}/QT_HMI_API_schema.h" > "${CMAKE_CURRENT_BINARY_DIR}/HMI_API_schema.h"
- DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/QT_HMI_API_schema.h"
- )
- add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/HMI_API_schema.cc"
- COMMAND sed "-e" "s/QT_HMI_API/HMI_API/g" "${CMAKE_CURRENT_BINARY_DIR}/QT_HMI_API_schema.cc" > "${CMAKE_CURRENT_BINARY_DIR}/HMI_API_schema.cc"
- DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/QT_HMI_API_schema.cc" "${CMAKE_CURRENT_BINARY_DIR}/HMI_API_schema.h" "${CMAKE_CURRENT_BINARY_DIR}/HMI_API.h")
-
- add_library(HMI_API ${CMAKE_CURRENT_BINARY_DIR}/HMI_API_schema.cc)
-endif()
+generate_interface("HMI_API.xml" "hmi_apis" "jsonrpc")
+add_library(HMI_API ${CMAKE_CURRENT_BINARY_DIR}/HMI_API_schema.cc)
target_link_libraries(v4_protocol_v1_2_no_extra Utils)
target_link_libraries(MOBILE_API Utils)
target_link_libraries(HMI_API Utils)
-
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index f08709bb2b..5096305b14 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -4,9 +4,6 @@
* Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
- * Copyright (c) 2017 Xevo Inc.
- * All rights reserved.
- *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
@@ -37,7 +34,7 @@
<interfaces name="SmartDeviceLink HMI API">
-<interface name="Common" version="1.7.0" date="2017-10-20">
+<interface name="Common" version="2.1.0" date="2019-03-18">
<enum name="Result">
<element name="SUCCESS" value="0"/>
@@ -69,17 +66,42 @@
<element name="READ_ONLY" value="26"/>
</enum>
+<enum name="WindowType">
+ <element name="MAIN">
+ <description>
+ This window type describes the main screen on a display.
+ </description>
+ </element>
+ <element name="WIDGET">
+ <description>
+ A widget is a small window that the app can create to provide information and softbuttons for a quick app control.
+ </description>
+ </element>
+</enum>
+
+<enum name="PredefinedWindows">
+ <element name="DEFAULT_WINDOW" value="0">
+ <description>The default window is a main window pre-created on behalf of the app.</description>
+ </element>
+ <element name="PRIMARY_WIDGET" value="1">
+ <description>The primary widget of the app.</description>
+ </element>
+</enum>
+
<enum name="TransportType">
<description>Lists of the transport types used for device connection to HU.</description>
<element name="BLUETOOTH"/>
<element name="USB_IOS"/>
<element name="USB_AOA"/>
<element name="WIFI"/>
+ <element name="CLOUD_WEBSOCKET"/>
+ <element name="WEBENGINE_WEBSOCKET"/>
</enum>
<enum name="ButtonName">
<description>Defines the hard (physical) and soft (touchscreen) buttons available from SYNC</description>
<element name="OK"/>
+ <element name="PLAY_PAUSE"/>
<element name="SEEKLEFT"/>
<element name="SEEKRIGHT"/>
<element name="TUNEUP"/>
@@ -117,6 +139,27 @@
<element name="SOURCE" />
<element name="SHUFFLE" />
<element name="REPEAT" />
+
+ <!-- Navigation Subscription Buttons -->
+ <element name="NAV_CENTER_LOCATION" />
+ <element name="NAV_ZOOM_IN" />
+ <element name="NAV_ZOOM_OUT" />
+ <element name="NAV_PAN_UP" />
+ <element name="NAV_PAN_UP_RIGHT" />
+ <element name="NAV_PAN_RIGHT" />
+ <element name="NAV_PAN_DOWN_RIGHT" />
+ <element name="NAV_PAN_DOWN" />
+ <element name="NAV_PAN_DOWN_LEFT" />
+ <element name="NAV_PAN_LEFT" />
+ <element name="NAV_PAN_UP_LEFT" />
+ <element name="NAV_TILT_TOGGLE">
+ <description>If supported, this toggles between a top-down view and an angled/3D view. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
+ <element name="NAV_ROTATE_CLOCKWISE" />
+ <element name="NAV_ROTATE_COUNTERCLOCKWISE" />
+ <element name="NAV_HEADING_TOGGLE">
+ <description>If supported, this toggles between locking the orientation to north or to the vehicle's heading. If your app supports different, but substantially similar options, then you may implement those. If you don't implement these or similar options, do not subscribe to this button.</description>
+ </element>
</enum>
<enum name="ButtonEventMode">
@@ -293,6 +336,18 @@
<element name="REMOTE_CONTROL" />
</enum>
+<enum name="CloudConnectionStatus">
+ <element name="NOT_CONNECTED">
+ <description>No active websocket session or ongoing connection attempts</description>
+ </element>
+ <element name="CONNECTED">
+ <description>Websocket is active</description>
+ </element>
+ <element name="RETRY">
+ <description>Websocket connection failed and retry attempts are ongoing</description>
+ </element>
+</enum>
+
<enum name="WayPointType">
<description>Describes what kind of waypoint is requested/provided.</description>
<element name="ALL" />
@@ -335,6 +390,20 @@
<element name="CLEAR" />
<description>Clears the media clock timer (previously done through Show->mediaClock)</description>
</enum>
+<enum name="AudioStreamingIndicator">
+ <element name="PLAY_PAUSE">
+ <description>Default playback indicator.</description>
+ </element>
+ <element name="PLAY">
+ <description>Indicates that a button press of the Play/Pause button would start the playback.</description>
+ </element>
+ <element name="PAUSE">
+ <description>Indicates that a button press of the Play/Pause button would pause the current playback.</description>
+ </element>
+ <element name="STOP">
+ <description>Indicates that a button press of the Play/Pause button would stop the current playback.</description>
+ </element>
+</enum>
<enum name="SystemContext">
<description>Enumeration that describes possible contexts the application might be in on HU.</description>
@@ -462,6 +531,9 @@
<element name="UNSUPPORTED_HMI_RESOURCE">
<description>By getting this value, SDL unregisters the named application</description>
</element>
+ <element name="CLOSE_CLOUD_CONNECTION">
+ <description>By getting this value, SDL puts the named app to NONE HMILevel. Used by the HMI to close a cloud app connection.</description>
+ </element>
</enum>
<enum name="TextFieldName">
@@ -486,6 +558,9 @@
<element name="mediaTrack">
<description>The track field of NGN and GEN1.1 MFD displays. This field is only available for media applications; applies to "Show"</description>
</element>
+ <element name="templateTitle">
+ <description>The title of the new template that will be displayed; applies to "Show"</description>
+ </element>
<element name="alertText1">
<description>The first line of the alert text field; applies to "Alert"</description>
</element>
@@ -537,12 +612,6 @@
<element name="menuTitle">
<description> Optional text to label an app menu button (for certain touchscreen platforms).</description>
</element>
- <element name="navigationText">
- <description>Navigation text for UpdateTurnList.</description>
- </element>
- <element name="notificationText">
- <description>Text of notification to be displayed on screen.</description>
- </element>
<element name="locationName">
<description> Optional name / title of intended location for SendLocation.</description>
</element>
@@ -553,11 +622,17 @@
<description> Optional location address (if applicable) for SendLocation.</description>
</element>
<element name="phoneNumber">
- <description> Optional hone number of intended location / establishment (if applicable) for SendLocation.</description>
+ <description> Optional phone number of intended location / establishment (if applicable) for SendLocation.</description>
</element>
<element name="timeToDestination"/>
<!-- TO DO to be removed -->
- <element name="turnText"/>
+ <element name="turnText"/>
+ <element name="navigationText">
+ <description>Navigation text for UpdateTurnList.</description>
+ </element>
+ <element name="notificationText">
+ <description>Text of notification to be displayed on screen.</description>
+ </element>
</enum>
<enum name="MetadataType">
@@ -639,6 +714,9 @@
<element name="locationImage">
<description>The optional image of a destination / location</description>
</element>
+ <element name="alertIcon">
+ <description>The image field for Alert</description>
+ </element>
</enum>
<enum name="TextAlignment">
@@ -730,6 +808,33 @@
</enum>
<!--IVI part-->
+<enum name="ElectronicParkBrakeStatus">
+ <element name="CLOSED">
+ <description>
+ Park brake actuators have been fully applied.
+ </description>
+ </element>
+ <element name="TRANSITION">
+ <description>
+ Park brake actuators are transitioning to either Apply/Closed or Release/Open state.
+ </description>
+ </element>
+ <element name="OPEN">
+ <description>
+ Park brake actuators are released.
+ </description>
+ </element>
+ <element name="DRIVE_ACTIVE">
+ <description>
+ When driver pulls the Electronic Park Brake switch while driving "at speed".
+ </description>
+ </element>
+ <element name="FAULT">
+ <description>
+ When system has a fault or is under maintenance.
+ </description>
+ </element>
+</enum>
<enum name="FuelType">
<element name="GASOLINE" />
<element name="DIESEL" />
@@ -844,6 +949,8 @@
</element>
<element name="EIGHTH">
</element>
+ <element name="UNKNOWN">
+ </element>
<element name="FAULT">
</element>
</enum>
@@ -930,6 +1037,8 @@
<description>Reflects the current primary audio source (if selected).</description>
<element name="NO_SOURCE_SELECTED">
</element>
+ <element name="CD">
+ </element>
<element name="USB">
</element>
<element name="USB2">
@@ -942,6 +1051,14 @@
</element>
<element name="MOBILE_APP">
</element>
+ <element name="AM">
+ </element>
+ <element name="FM">
+ </element>
+ <element name="XM">
+ </element>
+ <element name="DAB">
+ </element>
</enum>
<enum name="CompassDirection">
@@ -1020,7 +1137,6 @@
<element name="VEHICLEDATA_FUELLEVEL_STATE" />
<element name="VEHICLEDATA_FUELCONSUMPTION" />
<element name="VEHICLEDATA_EXTERNTEMP" />
- <element name="VEHICLEDATA_TURNSIGNAL" />
<element name="VEHICLEDATA_VIN" />
<element name="VEHICLEDATA_PRNDL" />
<element name="VEHICLEDATA_TIREPRESSURE" />
@@ -1040,8 +1156,12 @@
<element name="VEHICLEDATA_ENGINETORQUE" />
<element name="VEHICLEDATA_ACCPEDAL" />
<element name="VEHICLEDATA_STEERINGWHEEL" />
+ <element name="VEHICLEDATA_TURNSIGNAL" />
<element name="VEHICLEDATA_FUELRANGE" />
<element name="VEHICLEDATA_ENGINEOILLIFE" />
+ <element name="VEHICLEDATA_ELECTRONICPARKBRAKESTATUS" />
+ <element name="VEHICLEDATA_CLOUDAPPVEHICLEID" />
+ <element name="VEHICLEDATA_OEM_CUSTOM_DATA" />
</enum>
<enum name="WiperStatus">
@@ -1095,21 +1215,35 @@
<enum name="SamplingRate">
<description>Describes different sampling options for PerformAudioPassThru.</description>
- <element name="8KHZ" internal_name="RATE_8KHZ"/>
- <element name="16KHZ" internal_name="RATE_16KHZ"/>
- <element name="22KHZ" internal_name="RATE_22KHZ"/>
- <element name="44KHZ" internal_name="RATE_44KHZ"/>
+ <element name="8KHZ" internal_name="RATE_8KHZ">
+ <description>Sampling rate of 8000 Hz.</description>
+ </element>
+ <element name="16KHZ" internal_name="RATE_16KHZ">
+ <description>Sampling rate of 16000 Hz.</description>
+ </element>
+ <element name="22KHZ" internal_name="RATE_22KHZ">
+ <description>Sampling rate of 22050 Hz.</description>
+ </element>
+ <element name="44KHZ" internal_name="RATE_44KHZ">
+ <description>Sampling rate of 44100 Hz.</description>
+ </element>
</enum>
<enum name="BitsPerSample">
<description>Describes different quality options for PerformAudioPassThru.</description>
- <element name="8_BIT" internal_name="RATE_8_BIT"/>
- <element name="16_BIT" internal_name="RATE_16_BIT"/>
+ <element name="8_BIT" internal_name="RATE_8_BIT">
+ <description>Audio sample is 8 bits wide, unsigned.</description>
+ </element>
+ <element name="16_BIT" internal_name="RATE_16_BIT">
+ <description>Audio sample is 16 bits wide, signed, and in little endian.</description>
+ </element>
</enum>
<enum name="AudioType">
<description>Describes different audio type options for PerformAudioPassThru.</description>
- <element name="PCM" />
+ <element name="PCM">
+ <description>Linear PCM.</description>
+ </element>
</enum>
<enum name="KeyboardLayout">
@@ -1188,6 +1322,7 @@
<element name="MEDIA" />
<element name="FOTA" />
<element name="OEM_SPECIFIC"/>
+ <element name="ICON_URL"/>
</enum>
<enum name="ECallConfirmationStatus">
@@ -1454,21 +1589,21 @@
<element name="UPDATING" />
<element name="UPDATE_NEEDED"/>
</enum>
-
+
<enum name="SystemError">
<element name="SYNC_REBOOTED"/>
<element name="SYNC_OUT_OF_MEMMORY" />
</enum>
-
+
<enum name="StatisticsType">
<element name="iAPP_BUFFER_FULL"/>
</enum>
-
+
<enum name="ConsentSource">
<element name="GUI"/>
<element name="VUI" />
</enum>
-
+
<enum name="DeviceState">
<element name="UNKNOWN"/>
<element name="UNPAIRED"/>
@@ -1481,7 +1616,7 @@
<param name="line2" type="String" mandatory="false"/>
<param name="textBody" type="String" mandatory="false"/>
</struct>
-
+
<struct name="PermissionItem">
<param name="name" type="String" mandatory="true">
<description>Code of message of user-friendly text about functional group to be allowed/disallowed</description>
@@ -1492,7 +1627,7 @@
<param name="allowed" type="Boolean" mandatory="false">
<description>Specifies whether functionality was allowed/disallowed. If ommited - no information about User Consent is yet found for app.</description>
</param>
- </struct>
+ </struct>
<struct name="ServiceInfo">
<param name="url" type="String" mandatory="true">
<description>Get URL based on service type.</description>
@@ -1521,10 +1656,191 @@
<!-- End of Policies -->
<!-- Remote Control -->
+
+<struct name="Grid">
+ <description>Describes a location (origin coordinates and span) of a vehicle component.</description>
+ <param name="col" type="Integer" mandatory="true" minvalue="-1" maxvalue="100">
+ </param>
+ <param name="row" type="Integer" mandatory="true" minvalue="-1" maxvalue="100">
+ </param>
+ <param name="level" type="Integer" mandatory="false" defvalue="0" minvalue="-1" maxvalue="100" >
+ </param>
+ <param name="colspan" type="Integer" mandatory="false" defvalue="1" minvalue="1" maxvalue="100">
+ </param>
+ <param name="rowspan" type="Integer" mandatory="false" defvalue="1" minvalue="1" maxvalue="100">
+ </param>
+ <param name="levelspan" type="Integer" mandatory="false" defvalue="1" minvalue="1" maxvalue="100">
+ </param>
+</struct>
+
+<struct name="ModuleInfo">
+ <description>Information about a RC module</description>
+ <param name="moduleId" type="String" maxlength="100" mandatory="true">
+ <description> uuid of a module. "moduleId + moduleType" uniquely identify a module.</description>
+ </param>
+ <param name="location" type="Grid" mandatory="false">
+ <description>Location of a module.</description>
+ </param>
+ <param name="serviceArea" type="Grid" mandatory="false">
+ <description>Service area of a module. </description>
+ </param>
+ <param name="allowMultipleAccess" type="Boolean" mandatory="false" defvalue="true">
+ <description>allow multiple users/apps to access the module or not </description>
+ </param>
+</struct>
+
+<struct name="SeatLocation">
+ <description>Describes the location of a seat.</description>
+ <param name="grid" type="Grid" mandatory="false">
+ </param>
+</struct>
+
+<struct name="SeatLocationCapability">
+ <description>Contains information about the locations of each seat</description>
+ <param name="rows" type="Integer" minvalue="1" maxvalue="100" mandatory="false"></param>
+ <param name="columns" type="Integer" minvalue="1" maxvalue="100" mandatory="false"></param>
+ <param name="levels" type="Integer" minvalue="1" maxvalue="100" defvalue="1" mandatory="false">
+ </param>
+ <param name="seats" type="SeatLocation" array="true" mandatory="false">
+ <description>Contains a list of SeatLocation in the vehicle</description>
+ </param>
+</struct>
+
<enum name="ModuleType">
<element name="CLIMATE"/>
<element name="RADIO"/>
- </enum>
+ <element name="SEAT"/>
+ <element name="AUDIO"/>
+ <element name="LIGHT"/>
+ <element name="HMI_SETTINGS"/>
+</enum>
+
+ <enum name="MassageZone">
+ <description>List possible zones of a multi-contour massage seat.</description>
+ <element name="LUMBAR">
+ <description>The back of a multi-contour massage seat. or SEAT_BACK</description>
+ </element>
+ <element name="SEAT_CUSHION">
+ <description>The bottom a multi-contour massage seat. or SEAT_BOTTOM </description>
+ </element>
+ </enum>
+
+ <enum name="MassageMode">
+ <description>List possible modes of a massage zone.</description>
+ <element name="OFF"/>
+ <element name="LOW"/>
+ <element name="HIGH"/>
+ </enum>
+
+ <struct name="MassageModeData">
+ <description>Specify the mode of a massage zone.</description>
+ <param name="massageZone" type="MassageZone" mandatory="true"></param>
+ <param name="massageMode" type="MassageMode" mandatory="true"></param>
+ </struct>
+
+ <enum name="MassageCushion">
+ <description>List possible cushions of a multi-contour massage seat.</description>
+ <element name="TOP_LUMBAR"/>
+ <element name="MIDDLE_LUMBAR"/>
+ <element name="BOTTOM_LUMBAR"/>
+ <element name="BACK_BOLSTERS"/>
+ <element name="SEAT_BOLSTERS"/>
+ </enum>
+
+ <struct name="MassageCushionFirmness">
+ <description>The intensity or firmness of a cushion.</description>
+ <param name="cushion" type="MassageCushion" mandatory="true"></param>
+ <param name="firmness" type="Integer" minvalue="0" maxvalue="100" mandatory="true"></param>
+ </struct>
+
+ <enum name="SeatMemoryActionType">
+ <element name="SAVE">
+ <description>Save current seat postions and settings to seat memory.</description>
+ </element>
+ <element name="RESTORE">
+ <description>Restore / apply the seat memory settings to the current seat. </description>
+ </element>
+ <element name="NONE">
+ <description>No action to be performed.</description>
+ </element>
+ </enum>
+
+ <struct name="SeatMemoryAction">
+ <param name="id" type="Integer" minvalue="1" maxvalue="10" mandatory="true"/>
+ <param name="label" type="String" maxlength="100" mandatory="false"/>
+ <param name="action" type="SeatMemoryActionType" mandatory="true"/>
+ </struct>
+
+ <enum name="SupportedSeat">
+ <description>List possible seats that is a remote controllable seat.</description>
+ <element name="DRIVER"/>
+ <element name="FRONT_PASSENGER"/>
+ </enum>
+
+ <struct name="SeatControlData">
+ <description>Seat control data corresponds to "SEAT" ModuleType. </description>
+ <param name="id" type="SupportedSeat" mandatory="false"></param>
+ <param name="heatingEnabled" type="Boolean" mandatory="false"></param>
+ <param name="coolingEnabled" type="Boolean" mandatory="false"></param>
+ <param name="heatingLevel" type="Integer" minvalue="0" maxvalue="100" mandatory="false"></param>
+ <param name="coolingLevel" type="Integer" minvalue="0" maxvalue="100" mandatory="false"></param>
+
+ <param name="horizontalPosition" type="Integer" minvalue="0" maxvalue="100" mandatory="false"></param>
+ <param name="verticalPosition" type="Integer" minvalue="0" maxvalue="100" mandatory="false"></param>
+ <param name="frontVerticalPosition" type="Integer" minvalue="0" maxvalue="100" mandatory="false"></param>
+ <param name="backVerticalPosition" type="Integer" minvalue="0" maxvalue="100" mandatory="false"></param>
+ <param name="backTiltAngle" type="Integer" minvalue="0" maxvalue="100" mandatory="false"></param>
+
+ <param name="headSupportHorizontalPosition" type="Integer" minvalue="0" maxvalue="100" mandatory="false"></param>
+ <param name="headSupportVerticalPosition" type="Integer" minvalue="0" maxvalue="100" mandatory="false"></param>
+
+ <param name="massageEnabled" type="Boolean" mandatory="false"></param>
+ <param name="massageMode" type="MassageModeData" minsize="1" maxsize="2" array="true" mandatory="false"></param>
+ <param name="massageCushionFirmness" type="MassageCushionFirmness" minsize="1" maxsize="5" array="true" mandatory="false"></param>
+ <param name="memory" type="SeatMemoryAction" mandatory="false"></param>
+ </struct>
+
+ <struct name="SeatControlCapabilities">
+ <param name="moduleName" type="String" maxlength="100" mandatory="true">
+ <description>
+ The short friendly name of the light control module.
+ It should not be used to identify a module by mobile application.
+ </description>
+ </param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <description>Information about a RC module, including its id. </description>
+ </param>
+ <param name="heatingEnabledAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="coolingEnabledAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="heatingLevelAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="coolingLevelAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="horizontalPositionAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="verticalPositionAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="frontVerticalPositionAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="backVerticalPositionAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="backTiltAngleAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="headSupportHorizontalPositionAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="headSupportVerticalPositionAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="massageEnabledAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="massageModeAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="massageCushionFirmnessAvailable" type="Boolean" mandatory="false">
+ </param>
+ <param name="memoryAvailable" type="Boolean" mandatory="false">
+ </param>
+ </struct>
<enum name="RadioBand">
<element name="AM"/>
@@ -1566,6 +1882,99 @@
<element name="NOT_FOUND"/>
</enum>
+ <struct name="StationIDNumber">
+ <param name="countryCode" type="Integer" minvalue="0" maxvalue="999" mandatory="false">
+ <description>Binary Representation of ITU Country Code. USA Code is 001.</description>
+ </param>
+ <param name="fccFacilityId" type="Integer" minvalue="0" maxvalue="999999" mandatory="false">
+ <description>Binary representation of unique facility ID assigned by the FCC; FCC controlled for U.S. territory</description>
+ </param>
+ </struct>
+
+ <struct name="GPSData">
+ <description>Struct with the GPS data.</description>
+ <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="true">
+ </param>
+ <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="true">
+ </param>
+ <param name="utcYear" type="Integer" minvalue="2010" maxvalue="2100" mandatory="false">
+ <description>The current UTC year.</description>
+ </param>
+ <param name="utcMonth" type="Integer" minvalue="1" maxvalue="12" mandatory="false">
+ <description>The current UTC month.</description>
+ </param>
+ <param name="utcDay" type="Integer" minvalue="1" maxvalue="31" mandatory="false">
+ <description>The current UTC day.</description>
+ </param>
+ <param name="utcHours" type="Integer" minvalue="0" maxvalue="23" mandatory="false">
+ <description>The current UTC hour.</description>
+ </param>
+ <param name="utcMinutes" type="Integer" minvalue="0" maxvalue="59" mandatory="false">
+ <description>The current UTC minute.</description>
+ </param>
+ <param name="utcSeconds" type="Integer" minvalue="0" maxvalue="59" mandatory="false">
+ <description>The current UTC second.</description>
+ </param>
+ <param name="compassDirection" type="Common.CompassDirection" mandatory="false">
+ <description>See CompassDirection.</description>
+ </param>
+ <param name="pdop" type="Float" minvalue="0" maxvalue="1000" mandatory="false">
+ <description>PDOP.</description>
+ </param>
+ <param name="hdop" type="Float" minvalue="0" maxvalue="1000" mandatory="false">
+ <description>HDOP.</description>
+ </param>
+ <param name="vdop" type="Float" minvalue="0" maxvalue="1000" mandatory="false">
+ <description>VDOP.</description>
+ </param>
+ <param name="actual" type="Boolean" mandatory="false">
+ <description>
+ True, if actual.
+ False, if infered.
+ </description>
+ </param>
+ <param name="satellites" type="Integer" minvalue="0" maxvalue="31" mandatory="false">
+ <description>Number of satellites in view</description>
+ </param>
+ <param name="dimension" type="Common.Dimension" mandatory="false">
+ <description>See Dimension</description>
+ </param>
+ <param name="altitude" type="Float" minvalue="-10000" maxvalue="10000" mandatory="false">
+ <description>Altitude in meters</description>
+ </param>
+ <param name="heading" type="Float" minvalue="0" maxvalue="359.99" mandatory="false">
+ <description>The heading. North is 0. Resolution is 0.01</description>
+ </param>
+ <param name="speed" type="Float" minvalue="0" maxvalue="500" mandatory="false">
+ <description>The speed in KPH</description>
+ </param>
+ <param name="shifted" type="Boolean" mandatory="false">
+ <description>
+ True, if GPS lat/long, time, and altitude have been purposefully shifted (requires a proprietary algorithm to unshift).
+ False, if the GPS data is raw and un-shifted.
+ If not provided, then value is assumed False.
+ </description>
+ </param>
+ </struct>
+
+ <struct name="SisData">
+ <param name="stationShortName" type="String" minlength="4" maxlength="7" mandatory="false">
+ <description>Identifies the 4-alpha-character station call sign plus an optional (-FM) extension</description>
+ </param>
+ <param name="stationIDNumber" type="StationIDNumber" mandatory="false">
+ <description>Used for network Application. Consists of Country Code and FCC Facility ID.</description>
+ </param>
+ <param name="stationLongName" type="String" minlength="0" maxlength="56" mandatory="false">
+ <description>Identifies the station call sign or other identifying information in the long format.</description>
+ </param>
+ <param name="stationLocation" type="GPSData" mandatory="false">
+ <description>Provides the 3-dimensional geographic station location.</description>
+ </param>
+ <param name="stationMessage" type="String" minlength="0" maxlength="56" mandatory="false">
+ <description>May be used to convey textual information of general interest to the consumer such as weather forecasts or public service announcements. Includes a high priority delivery feature to convey emergencies that may be in the listening area.</description>
+ </param>
+ </struct>
+
<struct name="RadioControlData">
<param name="frequencyInteger" type="Integer" minvalue="0" maxvalue="1710" mandatory="false">
<description>The integer part of the frequency ie for 101.7 this value should be 101</description>
@@ -1577,10 +1986,19 @@
</param>
<param name="rdsData" type="Common.RdsData" mandatory="false">
</param>
- <param name="availableHDs" type="Integer" minvalue="1" maxvalue="3" mandatory="false">
- <description>number of HD sub-channels if available</description>
+ <param name="hdRadioEnable" type="Boolean" mandatory="false">
+ <description> True if the hd radio is on, false is the radio is off</description>
</param>
- <param name="hdChannel" type="Integer" minvalue="1" maxvalue="3" mandatory="false">
+ <param name="availableHDs" type="Integer" minvalue="1" maxvalue="7" mandatory="false">
+ <description>
+ Number of HD sub-channels if available.
+ Note that this parameter is deprecated in MOBILE API.
+ </description>
+ </param>
+ <param name="availableHdChannels" type="Integer" minvalue="0" maxvalue="7" array="true" minsize="0" maxsize="8" mandatory="false">
+ <description>The list of available hd sub-channel indexes. Empty list means no Hd channel is available. Read-only.</description>
+ </param>
+ <param name="hdChannel" type="Integer" minvalue="0" maxvalue="7" mandatory="false">
<description>Current HD sub-channel if available</description>
</param>
<param name="signalStrength" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
@@ -1593,6 +2011,9 @@
</param>
<param name="state" type="Common.RadioState" mandatory="false">
</param>
+ <param name="sisData" type="SisData" mandatory="false">
+ <description>Read-only Station Information Service (SIS) data provides basic information about the station such as call sign, as well as information not displayable to the consumer such as the station identification number</description>
+ </param>
</struct>
<struct name="RadioControlCapabilities">
@@ -1600,6 +2021,9 @@
<param name="moduleName" type="String" maxlength="100" mandatory="true" >
<description>The short name or a short description of the radio control module.</description>
</param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <description>Information about a RC module, including its id. </description>
+ </param>
<param name="radioEnableAvailable" type="Boolean" mandatory="false">
<description>
Availability of the control of enable/disable radio.
@@ -1631,9 +2055,17 @@
</description>
</param>
<param name="availableHDsAvailable" type="Boolean" mandatory="false" >
- <description>
+ <description>
Availability of the getting the number of available HD channels.
True: Available, False: Not Available, Not present: Not Available.
+ Note that this parameter is deprecated in MOBILE API
+ </description>
+ </param>
+
+ <param name="availableHdChannelsAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the list of available HD sub-channel indexes.
+ True: Available, False: Not Available, Not present: Not Available.
</description>
</param>
<param name="stateAvailable" type="Boolean" mandatory="false" >
@@ -1654,6 +2086,24 @@
True: Available, False: Not Available, Not present: Not Available.
</description>
</param>
+ <param name="sisDataAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the getting HD radio Station Information Service (SIS) data.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="hdRadioEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable HD radio.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="siriusxmRadioAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of sirius XM radio.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
</struct>
<enum name="DefrostZone">
@@ -1705,6 +2155,20 @@
</param>
<param name="ventilationMode" type="Common.VentilationMode" mandatory="false">
</param>
+ <param name="heatedSteeringWheelEnable" type="Boolean" mandatory="false">
+ <description>value false means disabled/turn off, value true means enabled/turn on.</description>
+ </param>
+ <param name="heatedWindshieldEnable" type="Boolean" mandatory="false">
+ <description>value false means disabled, value true means enabled.</description>
+ </param>
+ <param name="heatedRearWindowEnable" type="Boolean" mandatory="false">
+ <description>value false means disabled, value true means enabled.</description>
+ </param>
+ <param name="heatedMirrorsEnable" type="Boolean" mandatory="false">
+ <description>value false means disabled, value true means enabled.</description>
+ </param>
+ <param name="climateEnable" type="Boolean" mandatory="false">
+ </param>
</struct>
<struct name="ClimateControlCapabilities">
@@ -1712,6 +2176,9 @@
<param name="moduleName" type="String" maxlength="100" mandatory="true" >
<description>The short name or a short description of the climate control module.</description>
</param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <description>Information about a RC module, including its id. </description>
+ </param>
<param name="currentTemperatureAvailable" type="Boolean" mandatory="false">
<description>
Availability of the reading of current temperature.
@@ -1782,23 +2249,328 @@
A set of all ventilation modes that are controllable.
</description>
</param>
+ <param name="heatedSteeringWheelAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control (enable/disable) of heated Steering Wheel.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="heatedWindshieldAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control (enable/disable) of heated Windshield.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="heatedRearWindowAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control (enable/disable) of heated Rear Window.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="heatedMirrorsAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control (enable/disable) of heated Mirrors.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ <param name="climateEnableAvailable" type="Boolean" mandatory="false">
+ <description>
+ Availability of the control of enable/disable climate control.
+ True: Available, False: Not Available, Not present: Not Available.
+ </description>
+ </param>
+ </struct>
+
+ <struct name="EqualizerSettings">
+ <description>Defines the each Equalizer channel settings.</description>
+ <param name="channelId" type="Integer" minvalue="1" maxvalue="100" mandatory="true"></param>
+ <param name="channelName" type="String" mandatory="false" maxlength="50">
+ <description>read-only channel / frequency name (e.i. "Treble, Midrange, Bass" or "125 Hz")</description>
+ </param>
+ <param name="channelSetting" type="Integer" minvalue="0" maxvalue="100" mandatory="true"></param>
+ </struct>
+
+ <struct name="AudioControlData">
+ <param name="source" type="PrimaryAudioSource" mandatory="false">
+ <description>
+ In a getter response or a notification, it is the current primary audio source of the system.
+ In a setter request, it is the target audio source that the system shall switch to.
+ If the value is MOBILE_APP, the system shall switch to the mobile media app that issues the setter RPC.
+ </description>
+ </param>
+ <param name="keepContext" type="Boolean" mandatory="false">
+ <description>
+ This parameter shall not be present in any getter responses or notifications.
+ This parameter is optional in a setter request. The default value is false.
+ If it is false, the system not only changes the audio source but also brings the default application
+ or system UI associated with the audio source to foreground.
+ If it is true, the system changes the audio source, but still keeps the current application in foreground.
+ </description>
+ </param>
+ <param name="volume" type="Integer" mandatory="false" minvalue="0" maxvalue="100">
+ <description>Reflects the volume of audio, from 0%-100%.</description>
+ </param>
+ <param name="equalizerSettings" type="EqualizerSettings" minsize="1" maxsize="100" mandatory="false" array="true">
+ <description>Defines the list of supported channels (band) and their current/desired settings on HMI</description>
+ </param>
+ </struct>
+
+ <struct name="AudioControlCapabilities">
+ <param name="moduleName" type="String" maxlength="100" mandatory="true">
+ <description>
+ The short friendly name of the light control module.
+ It should not be used to identify a module by mobile application.
+ </description>
+ </param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <description>Information about a RC module, including its id. </description>
+ </param>
+ <param name="sourceAvailable" type="Boolean" mandatory="false">
+ <description>Availability of the control of audio source. </description>
+ </param>
+ <param name="keepContextAvailable" type="Boolean" mandatory="false">
+ <description>Availability of the keepContext paramter. </description>
+ </param>
+ <param name="volumeAvailable" type="Boolean" mandatory="false">
+ <description>Availability of the control of audio volume.</description>
+ </param>
+ <param name="equalizerAvailable" type="Boolean" mandatory="false">
+ <description>Availability of the control of Equalizer Settings.</description>
+ </param>
+ <param name="equalizerMaxChannelId" type="Integer" minvalue="1" maxvalue="100" mandatory="false">
+ <description>Must be included if equalizerAvailable=true, and assume all IDs starting from 1 to this value are valid</description>
+ </param>
+ </struct>
+
+
+ <struct name="RGBColor">
+ <param name="red" type="Integer" minvalue="0" maxvalue="255" mandatory="true" />
+ <param name="green" type="Integer" minvalue="0" maxvalue="255" mandatory="true" />
+ <param name="blue" type="Integer" minvalue="0" maxvalue="255" mandatory="true" />
+ </struct>
+
+ <enum name="LightName">
+ <!-- Common Single Light 0~500 -->
+ <element name="FRONT_LEFT_HIGH_BEAM" value="0"/>
+ <element name="FRONT_RIGHT_HIGH_BEAM" value="1"/>
+ <element name="FRONT_LEFT_LOW_BEAM" value="2"/>
+ <element name="FRONT_RIGHT_LOW_BEAM" value="3"/>
+ <element name="FRONT_LEFT_PARKING_LIGHT" value="4"/>
+ <element name="FRONT_RIGHT_PARKING_LIGHT" value="5"/>
+ <element name="FRONT_LEFT_FOG_LIGHT" value="6"/>
+ <element name="FRONT_RIGHT_FOG_LIGHT" value="7"/>
+ <element name="FRONT_LEFT_DAYTIME_RUNNING_LIGHT" value="8"/>
+ <element name="FRONT_RIGHT_DAYTIME_RUNNING_LIGHT" value="9"/>
+ <element name="FRONT_LEFT_TURN_LIGHT" value="10"/>
+ <element name="FRONT_RIGHT_TURN_LIGHT" value="11"/>
+ <element name="REAR_LEFT_FOG_LIGHT" value="12"/>
+ <element name="REAR_RIGHT_FOG_LIGHT" value="13"/>
+ <element name="REAR_LEFT_TAIL_LIGHT" value="14"/>
+ <element name="REAR_RIGHT_TAIL_LIGHT" value="15"/>
+ <element name="REAR_LEFT_BRAKE_LIGHT" value="16"/>
+ <element name="REAR_RIGHT_BRAKE_LIGHT" value="17"/>
+ <element name="REAR_LEFT_TURN_LIGHT" value="18"/>
+ <element name="REAR_RIGHT_TURN_LIGHT" value="19"/>
+ <element name="REAR_REGISTRATION_PLATE_LIGHT" value="20"/>
+
+ <!-- Exterior Lights by common function groups 501~800 -->
+ <element name="HIGH_BEAMS" value="501">
+ <description>Include all high beam lights: front_left and front_right.</description>
+ </element>
+ <element name="LOW_BEAMS" value="502">
+ <description>Include all low beam lights: front_left and front_right.</description>
+ </element>
+ <element name="FOG_LIGHTS" value="503">
+ <description>Include all fog lights: front_left, front_right, rear_left and rear_right.</description>
+ </element>
+ <element name="RUNNING_LIGHTS" value="504">
+ <description>Include all daytime running lights: front, left and right.</description>
+ </element>
+ <element name="PARKING_LIGHTS" value="505">
+ <description>Include all parking lights: front_left and front_right.</description>
+ </element>
+ <element name="BRAKE_LIGHTS" value="506">
+ <description>Include all brake lights: rear_left and rear_right.</description>
+ </element>
+ <element name="REAR_REVERSING_LIGHTS" value="507"/>
+ <element name="SIDE_MARKER_LIGHTS" value="508"/>
+ <element name="LEFT_TURN_LIGHTS" value="509">
+ <description>Include all left turn signal lights: front_left, rear_left, left_side and mirror_mounted.</description>
+ </element>
+ <element name="RIGHT_TURN_LIGHTS" value="510">
+ <description>Include all right turn signal lights: front_right, rear_right, right_side and mirror_mounted.</description>
+ </element>
+ <element name="HAZARD_LIGHTS" value="511">
+ <description>Include all hazard lights: front_left, front_right, rear_left and rear_right.</description>
+ </element>
+ <element name="REAR_CARGO_LIGHTS" value="512">
+ <description>Cargo lamps illuminate the cargo area.</description>
+ </element>
+ <element name="REAR_TRUCK_BED_LIGHTS" value="513">
+ <description>Truck bed lamps light up the bed of the truck.</description>
+ </element>
+ <element name="REAR_TRAILER_LIGHTS" value="514">
+ <description>Trailer lights are lamps mounted on a trailer hitch.</description>
+ </element>
+ <element name="LEFT_SPOT_LIGHTS" value="515">
+ <description>It is the spotlights mounted on the left side of a vehicle.</description>
+ </element>
+ <element name="RIGHT_SPOT_LIGHTS" value="516">
+ <description>It is the spotlights mounted on the right side of a vehicle.</description>
+ </element>
+ <element name="LEFT_PUDDLE_LIGHTS" value="517">
+ <description>Puddle lamps illuminate the ground beside the door as the customer is opening or approaching the door.</description>
+ </element>
+ <element name="RIGHT_PUDDLE_LIGHTS" value="518">
+ <description>Puddle lamps illuminate the ground beside the door as the customer is opening or approaching the door.</description>
+ </element>
+
+ <!-- Interior Lights by common function groups 801~900 -->
+ <element name="AMBIENT_LIGHTS" value="801"/>
+ <element name="OVERHEAD_LIGHTS" value="802"/>
+ <element name="READING_LIGHTS" value="803"/>
+ <element name="TRUNK_LIGHTS" value="804"/>
+
+ <!-- Lights by location 901~1000-->
+ <element name="EXTERIOR_FRONT_LIGHTS" value="901">
+ <description>Include exterior lights located in front of the vehicle. For example, fog lights and low beams.</description>
+ </element>
+ <element name="EXTERIOR_REAR_LIGHTS" value="902">
+ <description>Include exterior lights located at the back of the vehicle. For example, license plate lights, reverse lights, cargo lights, bed lights an trailer assist lights.</description>
+ </element>
+ <element name="EXTERIOR_LEFT_LIGHTS" value="903">
+ <description>Include exterior lights located at the left side of the vehicle. For example, left puddle lights and spot lights.</description>
+ </element>
+ <element name="EXTERIOR_RIGHT_LIGHTS" value="904">
+ <description>Include exterior lights located at the right side of the vehicle. For example, right puddle lights and spot lights.</description>
+ </element>
+ <element name="EXTERIOR_ALL_LIGHTS" value="905">
+ <description> Include all exterior lights around the vehicle.</description>
+ </element>
+ </enum>
+
+ <enum name="LightStatus">
+ <element name="ON"/>
+ <element name="OFF"/>
+ <element name="RAMP_UP"/>
+ <element name="RAMP_DOWN"/>
+ <element name="UNKNOWN"/>
+ <element name="INVALID"/>
+ </enum>
+
+ <struct name="LightCapabilities">
+ <param name="name" type="LightName" mandatory="true" />
+ <param name="statusAvailable" type="Boolean" mandatory="false">
+ <description>
+ Indicates if the status (ON/OFF) can be set remotely. App shall not use read-only values (RAMP_UP/RAMP_DOWN/UNKNOWN/INVALID) in a setInteriorVehicleData request.
+ </description>
+ </param>
+ <param name="densityAvailable" type="Boolean" mandatory="false">
+ <description>
+ Indicates if the light's density can be set remotely (similar to a dimmer).
+ </description>
+ </param>
+ <param name="rgbColorSpaceAvailable" type="Boolean" mandatory="false">
+ <description>
+ Indicates if the light's color can be set remotely by using the RGB color space.
+ </description>
+ </param>
+ </struct>
+
+ <struct name="LightControlCapabilities">
+ <param name="moduleName" type="String" maxlength="100" mandatory="true">
+ <description>
+ The short friendly name of the light control module.
+ It should not be used to identify a module by mobile application.
+ </description>
+ </param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <description>Information about a RC module, including its id. </description>
+ </param>
+ <param name="supportedLights" type="LightCapabilities" minsize="1" maxsize="100" array="true" mandatory="true">
+ <description> An array of available light names that are controllable. </description>
+ </param>
+ </struct>
+
+ <struct name="LightState">
+ <param name="id" type="LightName" mandatory="true">
+ <description>The name of a light or a group of lights. </description>
+ </param>
+ <param name="status" type="LightStatus" mandatory="true"/>
+ <param name="density" type="Float" minvalue="0" maxvalue="1" mandatory="false" />
+ <param name="color" type="RGBColor" mandatory="false" />
+ </struct>
+
+ <struct name="LightControlData">
+ <param name="lightState" type="LightState" mandatory="true" minsize="1" maxsize="100" array="true">
+ <description>An array of LightNames and their current or desired status. No change to the status of the LightNames that are not listed in the array.</description>
+ </param>
+ </struct>
+
+ <enum name="DisplayMode">
+ <element name="DAY"/>
+ <element name="NIGHT"/>
+ <element name="AUTO"/>
+ </enum>
+ <enum name="DistanceUnit">
+ <element name="MILES"/>
+ <element name="KILOMETERS"/>
+ </enum>
+
+ <struct name="HMISettingsControlData">
+ <description>Corresponds to "HMI_SETTINGS" ModuleType</description>
+ <param name="displayMode" type="DisplayMode" mandatory="false"></param>
+ <param name="temperatureUnit" type="TemperatureUnit" mandatory="false"></param>
+ <param name="distanceUnit" type="DistanceUnit" mandatory="false"></param>
+ </struct>
+
+ <struct name="HMISettingsControlCapabilities">
+ <param name="moduleName" type="String" maxlength="100" mandatory="true">
+ <description>
+ The short friendly name of the hmi setting module.
+ It should not be used to identify a module by mobile application.
+ </description>
+ </param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <description>Information about a RC module, including its id. </description>
+ </param>
+ <param name="distanceUnitAvailable" type="Boolean" mandatory="false">
+ <description>Availability of the control of distance unit. </description>
+ </param>
+ <param name="temperatureUnitAvailable" type="Boolean" mandatory="false">
+ <description>Availability of the control of temperature unit. </description>
+ </param>
+ <param name="displayModeUnitAvailable" type="Boolean" mandatory="false">
+ <description>Availability of the control of HMI display mode. </description>
+ </param>
</struct>
<struct name="ModuleData">
<description>The moduleType indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the moduleType is CLIMATE then a "climateControlData" should exist</description>
<param name="moduleType" type="Common.ModuleType" mandatory="true" >
</param>
+ <param name="moduleId" type="String" maxlength="100" mandatory="false">
+ <description>Id of a module, published by System Capability. </description>
+ </param>
<param name="radioControlData" type="Common.RadioControlData" mandatory="false">
</param>
<param name="climateControlData" type="Common.ClimateControlData" mandatory="false">
</param>
+ <param name="seatControlData" type="SeatControlData" mandatory="false">
+ </param>
+ <param name="audioControlData" type="AudioControlData" mandatory="false">
+ </param>
+ <param name="lightControlData" type="LightControlData" mandatory="false">
+ </param>
+ <param name="hmiSettingsControlData" type="HMISettingsControlData" mandatory="false">
+ </param>
</struct>
<enum name="RCAccessMode">
- <description>Enumeration that describes possible remote control access mode the application might be in on HU.</description>
- <element name="AUTO_ALLOW"/>
- <element name="AUTO_DENY"/>
- <element name="ASK_DRIVER"/>
+ <description>Enumeration that describes possible remote control access mode the application might be in on HU.</description>
+ <element name="AUTO_ALLOW"/>
+ <element name="AUTO_DENY"/>
+ <element name="ASK_DRIVER"/>
</enum>
<!-- End Remote Control -->
@@ -1822,6 +2594,9 @@
<param name="name" type="Common.ButtonName" mandatory="true">
<description>The name of the Button from the ButtonName enum</description>
</param>
+ <param name="moduleInfo" type="ModuleInfo" mandatory="false">
+ <description>Information about a RC module, including its id. </description>
+ </param>
<param name="shortPressAvailable" type="Boolean" mandatory="true">
<description>The button supports a short press. Whenever the button is pressed short, onButtonPressed(SHORT) should be invoked.</description>
</param>
@@ -1938,11 +2713,6 @@
</param>
</struct>
-<struct name="RGBColor">
- <param name="red" type="Integer" minvalue="0" maxvalue="255" mandatory="true" />
- <param name="green" type="Integer" minvalue="0" maxvalue="255" mandatory="true" />
- <param name="blue" type="Integer" minvalue="0" maxvalue="255" mandatory="true" />
-</struct>
<struct name="TemplateColorScheme">
<description>
@@ -1959,6 +2729,17 @@
</param>
</struct>
+<struct name="TemplateConfiguration">
+ <param name="template" type="String" maxlength="500" mandatory="true">
+ <description>
+ Predefined or dynamically created window template.
+ Currently only predefined window template layouts are defined.
+ </description>
+ </param>
+ <param name="dayColorScheme" type="TemplateColorScheme" mandatory="false" />
+ <param name="nightColorScheme" type="TemplateColorScheme" mandatory="false" />
+</struct>
+
<struct name="HMIApplication">
<description>Data type containing information about application needed by HMI.</description>
<param name="appName" type="String" maxlength="100" mandatory="true">
@@ -1974,6 +2755,9 @@
<param name="deviceInfo" type="Common.DeviceInfo" mandatory="true">
<description>The ID, serial number, transport type the named-app's-device is connected over to HU.</description>
</param>
+ <param name="secondaryDeviceInfo" type="Common.DeviceInfo" mandatory="false">
+ <description>The ID, serial number, transport type that are acquired through Secondary Transport.</description>
+ </param>
<param name="policyAppID" type="String" maxlength="50" minlength="1" mandatory="true">
<description>Policy ID(=the appID the application registers with) of registered application.</description>
</param>
@@ -1989,7 +2773,7 @@
<param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false">
<description>
Defines an additional voice recognition command.
- Must not interfere with any name of previously registered applications(SDL makes check).
+ Must not interfere with any name of previously registered applications from the same device.
</description>
</param>
<param name="appID" type="Integer" mandatory="true">
@@ -2016,16 +2800,18 @@
<description>If SDL omits this parameter - none RequestType is allowed for this app</description>
<description>(either this is a pre-registered app or such is dictated by policies).</description>
</param>
- <param name="requestSubType" type="String" maxlength="100" minsize="0" maxsize="100" array="true" mandatory="false">
- <description>
- The list of SystemRequest's requestSubTypes allowed by policies for the named application.
- If the app sends a requestSubType which is not specified in this list, then that request should be rejected.
- An empty array signifies that any value of requestSubType is allowed for this app.
- If this parameter is omitted, then a request with any value of requestSubType is now allowed for this app
- </description>
+ <param name="requestSubType" type="String" maxlength="100" minsize="0" maxsize="100" array="true" mandatory="false">
+ <description>
+ The list of SystemRequest's requestSubTypes allowed by policies for the named application.
+ If the app sends a requestSubType which is not specified in this list, then that request should be rejected.
+ An empty array signifies that any value of requestSubType is allowed for this app.
+ If this parameter is omitted, then a request with any value of requestSubType is now allowed for this app
+ </description>
</param>
<param name="dayColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
- <param name="nightColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
+ <param name="nightColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
+ <param name="isCloudApplication" type="Boolean" mandatory="false"></param>
+ <param name="cloudConnectionStatus" type="Common.CloudConnectionStatus" mandatory="false"></param>
</struct>
<struct name="MenuParams">
@@ -2045,6 +2831,12 @@
</param>
</struct>
+<enum name="MenuLayout">
+ <description>How the main menu or submenu is laid out on screen</description>
+ <element name="LIST" />
+ <element name="TILES" />
+</enum>
+
<struct name="Choice">
<description>A choice is an option given to the user which can be selected either by menu, or through voice recognition system.</description>
<param name="choiceID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
@@ -2205,6 +2997,12 @@
<param name="imageSupported" type="Boolean" mandatory="true">
<description>Must be true if the button supports referencing a static or dynamic image.</description>
</param>
+ <param name="textSupported" type="Boolean" mandatory="false" >
+ <description>
+ The button supports the use of text.
+ If not included, the default value should be considered true that the button will support text.
+ </description>
+ </param>
</struct>
<struct name="HMICapabilities">
@@ -2223,6 +3021,7 @@
<description>
Describes different audio type configurations for PerformAudioPassThru.
e.g. 8kHz,8-bit,PCM
+ The audio is recorded in monaural.
</description>
<param name="samplingRate" type="Common.SamplingRate" mandatory="true"/>
<param name="bitsPerSample" type="Common.BitsPerSample" mandatory="true"/>
@@ -2260,8 +3059,11 @@
<description>All omitted characters will be greyed out (disabled) on the keyboard.</description>
<description>If omitted, the entire keyboard will be enabled.</description>
</param>
- <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false">
- <description>Allows an app to prepopulate the text field with a suggested or completed entry as the user types</description>
+ <param name="autoCompleteList" type="String" maxlength="1000" minsize="0" maxsize="100" array="true" mandatory="false">
+ <description>
+ Allows an app to prepopulate the text field with a list of suggested or completed entries as the user types.
+ If empty, the auto-complete list will be removed from the screen.
+ </description>
</param>
</struct>
@@ -2309,65 +3111,6 @@
</element>
</enum>
-<struct name="GPSData">
- <description>Struct with the GPS data.</description>
- <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="false">
- </param>
- <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="false">
- </param>
- <param name="utcYear" type="Integer" minvalue="2010" maxvalue="2100" mandatory="false">
- <description>The current UTC year.</description>
- </param>
- <param name="utcMonth" type="Integer" minvalue="1" maxvalue="12" mandatory="false">
- <description>The current UTC month.</description>
- </param>
- <param name="utcDay" type="Integer" minvalue="1" maxvalue="31" mandatory="false">
- <description>The current UTC day.</description>
- </param>
- <param name="utcHours" type="Integer" minvalue="0" maxvalue="23" mandatory="false">
- <description>The current UTC hour.</description>
- </param>
- <param name="utcMinutes" type="Integer" minvalue="0" maxvalue="59" mandatory="false">
- <description>The current UTC minute.</description>
- </param>
- <param name="utcSeconds" type="Integer" minvalue="0" maxvalue="59" mandatory="false">
- <description>The current UTC second.</description>
- </param>
- <param name="compassDirection" type="Common.CompassDirection" mandatory="false">
- <description>See CompassDirection.</description>
- </param>
- <param name="pdop" type="Float" minvalue="0" maxvalue="10" mandatory="false">
- <description>PDOP.</description>
- </param>
- <param name="hdop" type="Float" minvalue="0" maxvalue="10" mandatory="false">
- <description>HDOP.</description>
- </param>
- <param name="vdop" type="Float" minvalue="0" maxvalue="10" mandatory="false">
- <description>VDOP.</description>
- </param>
- <param name="actual" type="Boolean" mandatory="false">
- <description>
- True, if actual.
- False, if infered.
- </description>
- </param>
- <param name="satellites" type="Integer" minvalue="0" maxvalue="31" mandatory="false">
- <description>Number of satellites in view</description>
- </param>
- <param name="dimension" type="Common.Dimension" mandatory="false">
- <description>See Dimension</description>
- </param>
- <param name="altitude" type="Float" minvalue="-10000" maxvalue="10000" mandatory="false">
- <description>Altitude in meters</description>
- </param>
- <param name="heading" type="Float" minvalue="0" maxvalue="359.99" mandatory="false">
- <description>The heading. North is 0. Resolution is 0.01</description>
- </param>
- <param name="speed" type="Float" minvalue="0" maxvalue="500" mandatory="false">
- <description>The speed in KPH</description>
- </param>
-</struct>
-
<struct name="SingleTireStatus">
<param name="status" type="Common.ComponentVolumeStatus" mandatory="true">
<description>The status of component volume. See ComponentVolumeStatus.</description>
@@ -2587,8 +3330,13 @@
<param name="rolloverEvent" type="Common.VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsEvntRoll_D_Ltchd". See VehicleDataEventStatus.</description>
</param>
- <param name="maximumChangeVelocity" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsMaxDeltaV_D_Ltchd". See VehicleDataEventStatus.</description>
+ <param name="maximumChangeVelocity" type="Integer" minvalue="0" maxvalue="255" mandatory="true">
+ <description>
+ References signal "VedsMaxDeltaV_D_Ltchd". Change in velocity in KPH. Additional reserved values:
+ 0x00 No event
+ 0xFE Not supported
+ 0xFF Fault
+ </description>
</param>
<param name="multipleEvents" type="Common.VehicleDataEventStatus" mandatory="true">
<description>References signal "VedsMultiEvnt_D_Ltchd". See VehicleDataEventStatus.</description>
@@ -2619,7 +3367,7 @@
<struct name="DateTime">
<param name="millisecond" type="Integer" minvalue="0" maxvalue="999" mandatory="false">
- <description>Milliseconds </description>
+ <description>Milliseconds </description>
</param>
<param name="second" type="Integer" minvalue="0" maxvalue="60" mandatory="false">
<description>Seconds part of time</description>
@@ -2736,6 +3484,77 @@
<param name="hapticSpatialDataSupported" type="Boolean" mandatory="false">
<description>True if the system can utilize the haptic spatial data from the source being streamed. </description>
</param>
+ <param name="diagonalScreenSize" type="Float" minvalue="0" mandatory="false">
+ <description>The diagonal screen size in inches.</description>
+ </param>
+ <param name="pixelPerInch" type="Float" minvalue="0" mandatory="false">
+ <description>PPI is the diagonal resolution in pixels divided by the diagonal screen size in inches.</description>
+ </param>
+ <param name="scale" type="Float" minvalue="1" maxvalue="10" mandatory="false">
+ <description>The scaling factor the app should use to change the size of the projecting view.</description>
+ </param>
+ </struct>
+
+
+ <struct name="WindowTypeCapabilities">
+ <param name="type" type="Common.WindowType" mandatory="true" />
+ <param name="maximumNumberOfWindows" type="Integer" mandatory="true" />
+ </struct>
+
+ <struct name="WindowCapability">
+ <param name="windowID" type="Integer" mandatory="false">
+ <description>
+ The specified ID of the window. Can be set to a predefined window,
+ or omitted for the main window on the main display.
+ </description>
+ </param>
+ <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>A set of all fields that support text data. See TextField</description>
+ </param>
+ <param name="imageFields" type="ImageField" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>A set of all fields that support images. See ImageField</description>
+ </param>
+ <param name="imageTypeSupported" type="ImageType" array="true" minsize="0" maxsize="1000" mandatory="false">
+ <description>Provides information about image types supported by the system.</description>
+ </param>
+ <param name="templatesAvailable" type="String" minsize="0" maxsize="100" maxlength="100" array="true" mandatory="false">
+ <description>A set of all window templates available on the head unit.</description>
+ </param>
+ <param name="numCustomPresetsAvailable" type="Integer" minvalue="1" maxvalue="100" mandatory="false">
+ <description>The number of on-window custom presets available (if any); otherwise omitted.</description>
+ </param>
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>The number of buttons and the capabilities of each on-window button.</description>
+ </param>
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>The number of soft buttons available on-window and the capabilities for each button.</description>
+ </param>
+ <param name="menuLayoutsAvailable" type="Common.MenuLayout" array="true" minsize="1" maxsize="1000" mandatory="false">
+ <description>An array of available menu layouts. If this parameter is not provided, only the `LIST` layout is assumed to be available</description>
+ </param>
+ </struct>
+
+ <struct name="DisplayCapability">
+ <description>Contains information about the display capabilities.</description>
+ <param name="displayName" type="String" mandatory="false" />
+ <param name="windowTypeSupported" type="WindowTypeCapabilities" array="true" minsize="1" mandatory="false">
+ <description>
+ Informs the application how many windows the app is allowed to create per type.
+ </description>
+ </param>
+ <param name="windowCapabilities" type="WindowCapability" array="true" minsize="1" maxsize="1000" mandatory="false">
+ <description>
+ Contains a list of capabilities of all windows related to the app.
+ Once the app has registered the capabilities of all windows are provided.
+ GetSystemCapability still allows requesting window capabilities of all windows.
+ After registration, only windows with capabilities changed will be included.
+ Following cases will cause only affected windows to be included:
+ 1. App creates a new window. After the window is created, a system capability notification will be sent
+ related only to the created window.
+ 2. App sets a new layout to the window. The new layout changes window capabilties.
+ The notification will reflect those changes to the single window.
+ </description>
+ </param>
</struct>
<struct name="SystemCapabilities">
@@ -2757,6 +3576,20 @@
<param name="buttonCapabilities" type="ButtonCapabilities" mandatory="false" minsize="1" maxsize="100" array="true" >
<description>If included, the platform supports RC button controls with the included button names.</description >
</param>
+ <param name="seatControlCapabilities" type="SeatControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
+ <description>
+ If included, the platform supports seat controls.
+ </description >
+ </param>
+ <param name="audioControlCapabilities" type="AudioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
+ <description> If included, the platform supports audio controls. </description >
+ </param>
+ <param name="hmiSettingsControlCapabilities" type="HMISettingsControlCapabilities" mandatory="false">
+ <description> If included, the platform supports hmi setting controls. </description >
+ </param>
+ <param name="lightControlCapabilities" type="LightControlCapabilities" mandatory="false">
+ <description> If included, the platform supports light controls. </description >
+ </param>
</struct>
<struct name="Rectangle">
@@ -2784,6 +3617,548 @@
</param>
</struct>
+ <struct name="SyncMsgVersion">
+ <description>Specifies the version number of the SmartDeviceLink protocol that is supported by the mobile application or app service</description>
+
+ <param name="majorVersion" type="Integer" minvalue="1" maxvalue="10" mandatory="true">
+ <description>The major version indicates versions that is not-compatible to previous versions.</description>
+ </param>
+ <param name="minorVersion" type="Integer" minvalue="0" maxvalue="1000" mandatory="true">
+ <description>The minor version indicates a change to a previous version that should still allow to be run on an older version (with limited functionality)</description>
+ </param>
+ <param name="patchVersion" type="Integer" minvalue="0" maxvalue="1000" mandatory="false">
+ <description>The patch version indicates a fix to existing functionality in a previous version that should still be able to be run on an older version </description>
+ </param>
+ </struct>
+
+ <enum name="ServiceType">
+ <element name="VIDEO" >
+ <description>Refers to the Video service.</description>
+ </element>
+ <element name="AUDIO" >
+ <description>Refers to the Audio service.</description>
+ </element>
+ <element name="RPC" >
+ <description>Refers to the RPC service.</description>
+ </element>
+ </enum>
+
+ <enum name="ServiceEvent">
+ <element name="REQUEST_RECEIVED" >
+ <description>When a request for a Service is received.</description>
+ </element>
+ <element name="REQUEST_ACCEPTED" >
+ <description>When a request for a Service is Accepted.</description>
+ </element>
+ <element name="REQUEST_REJECTED" >
+ <description>When a request for a Service is Rejected.</description>
+ </element>
+ </enum>
+
+ <enum name="ServiceStatusUpdateReason">
+ <element name="PTU_FAILED" >
+ <description>When a Service is rejected because the system was unable to get a required Policy Table Update.</description>
+ </element>
+ <element name="INVALID_CERT" >
+ <description>When a Service is rejected because the security certificate is invalid/expired.</description>
+ </element>
+ <element name="INVALID_TIME" >
+ <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>
+ </element>
+ <element name="PROTECTION_ENFORCED" >
+ <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>
+ </element>
+ <element name="PROTECTION_DISABLED" >
+ <description>When a mobile app requests a protected service, but the system starts an unprotected service instead.</description>
+ </element>
+ </enum>
+
+ <!-- App Services -->
+
+ <enum name="AppServiceType">
+ <element name="MEDIA"/>
+ <element name="WEATHER"/>
+ <element name="NAVIGATION"/>
+ </enum>
+
+ <struct name="MediaServiceManifest">
+ </struct>
+
+ <enum name="MediaType">
+ <element name="MUSIC"/>
+ <element name="PODCAST"/>
+ <element name="AUDIOBOOK"/>
+ <element name="OTHER"/>
+ </enum>
+
+ <struct name="MediaServiceData">
+ <description>This data is related to what a media service should provide</description>
+
+ <param name="mediaType" type="Common.MediaType" mandatory="false">
+ <description>The type of the currently playing or paused track.</description>
+ </param>
+
+ <param name="mediaTitle" type="String" mandatory="false">
+ <description>
+ Music: The name of the current track
+ Podcast: The name of the current episode
+ Audiobook: The name of the current chapter
+ </description>
+ </param>
+
+ <param name="mediaArtist" type="String" mandatory="false">
+ <description>
+ Music: The name of the current album artist
+ Podcast: The provider of the podcast (hosts, network, company)
+ Audiobook: The book author's name
+ </description>
+ </param>
+
+ <param name="mediaAlbum" type="String" mandatory="false">
+ <description>
+ Music: The name of the current album
+ Podcast: The name of the current podcast show
+ Audiobook: The name of the current book
+ </description>
+ </param>
+
+ <param name="playlistName" type="String" mandatory="false">
+ <description>
+ Music: The name of the playlist or radio station, if the user is playing from a playlist, otherwise, Null
+ Podcast: The name of the playlist, if the user is playing from a playlist, otherwise, Null
+ Audiobook: Likely not applicable, possibly a collection or "playlist" of books
+ </description>
+ </param>
+
+ <param name="isExplicit" type="Boolean" mandatory="false">
+ <description> Whether or not the content currently playing (e.g. the track, episode, or book) contains explicit content</description>
+ </param>
+
+ <param name="trackPlaybackProgress" type="Integer" mandatory="false">
+ <description>
+ Music: The current progress of the track in seconds
+ Podcast: The current progress of the episode in seconds
+ Audiobook: The current progress of the current segment (e.g. the chapter) in seconds
+ </description>
+ </param>
+
+ <param name="trackPlaybackDuration" type="Integer" mandatory="false">
+ <description>
+ Music: The total duration of the track in seconds
+ Podcast: The total duration of the episode in seconds
+ Audiobook: The total duration of the current segment (e.g. the chapter) in seconds
+ </description>
+ </param>
+
+ <param name="queuePlaybackProgress" type="Integer" mandatory="false">
+ <description>
+ Music: The current progress of the playback queue in seconds
+ Podcast: The current progress of the playback queue in seconds
+ Audiobook: The current progress of the playback queue (e.g. the book) in seconds
+ </description>
+ </param>
+
+ <param name="queuePlaybackDuration" type="Integer" mandatory="false">
+ <description>
+ Music: The total duration of the playback queue in seconds
+ Podcast: The total duration of the playback queue in seconds
+ Audiobook: The total duration of the playback queue (e.g. the book) in seconds
+ </description>
+ </param>
+
+ <param name="queueCurrentTrackNumber" type="Integer" mandatory="false">
+ <description>
+ Music: The current number (1 based) of the track in the playback queue
+ Podcast: The current number (1 based) of the episode in the playback queue
+ Audiobook: The current number (1 based) of the episode in the playback queue (e.g. the chapter number in the book)
+ </description>
+ </param>
+
+ <param name="queueTotalTrackCount" type="Integer" mandatory="false">
+ <description>
+ Music: The total number of tracks in the playback queue
+ Podcast: The total number of episodes in the playback queue
+ Audiobook: The total number of sections in the playback queue (e.g. the number of chapters in the book)
+ </description>
+ </param>
+
+ <param name="mediaImage" type="Common.Image" mandatory="false">
+ <description>
+ Music: The album art of the current track
+ Podcast: The podcast or chapter artwork of the current podcast episode
+ Audiobook: The book or chapter artwork of the current audiobook
+ </description>
+ </param>
+ </struct>
+
+ <struct name="WeatherServiceManifest">
+ <param name="currentForecastSupported" type="Boolean" mandatory="false"/>
+ <param name="maxMultidayForecastAmount" type="Integer" mandatory="false"/>
+ <param name="maxHourlyForecastAmount" type="Integer" mandatory="false"/>
+ <param name="maxMinutelyForecastAmount" type="Integer" mandatory="false"/>
+ <param name="weatherForLocationSupported" type="Boolean" mandatory="false"/>
+ </struct>
+
+ <struct name="WeatherAlert">
+ <param name="title" type="String" mandatory="false"/>
+ <param name="summary" type="String" mandatory="false"/>
+ <param name="expires" type="Common.DateTime" mandatory="false"/>
+ <param name="regions" type="String" array="true" minsize="1" maxsize="99" mandatory="false"/>
+ <param name="severity" type="String" mandatory="false"/>
+ <param name="timeIssued" type="Common.DateTime" mandatory="false"/>
+ </struct>
+
+ <struct name="WeatherData">
+ <param name="currentTemperature" type="Common.Temperature" mandatory="false"/>
+ <param name="temperatureHigh" type="Common.Temperature" mandatory="false"/>
+ <param name="temperatureLow" type="Common.Temperature" mandatory="false"/>
+ <param name="apparentTemperature" type="Common.Temperature" mandatory="false"/>
+ <param name="apparentTemperatureHigh" type="Common.Temperature" mandatory="false"/>
+ <param name="apparentTemperatureLow" type="Common.Temperature" mandatory="false"/>
+
+ <param name="weatherSummary" type="String" mandatory="false"/>
+ <param name="time" type="Common.DateTime" mandatory="false"/>
+ <param name="humidity" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage humidity </description>
+ </param>
+ <param name="cloudCover" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage cloud cover </description>
+ </param>
+ <param name="moonPhase" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage of the moon seen, e.g. 0 = no moon, 0.25 = quarter moon </description>
+ </param>
+
+ <param name="windBearing" type="Integer" mandatory="false">
+ <description> In degrees, true north at 0 degrees </description>
+ </param>
+ <param name="windGust" type="Float" mandatory="false">
+ <description> km/hr </description>
+ </param>
+ <param name="windSpeed" type="Float" mandatory="false">
+ <description> km/hr </description>
+ </param>
+
+ <param name="nearestStormBearing" type="Integer" mandatory="false">
+ <description> In degrees, true north at 0 degrees </description>
+ </param>
+ <param name="nearestStormDistance" type="Integer" mandatory="false">
+ <description> In km </description>
+ </param>
+ <param name="precipAccumulation" type="Float" mandatory="false">
+ <description> cm </description>
+ </param>
+ <param name="precipIntensity" type="Float" mandatory="false">
+ <description> cm of water per hour </description>
+ </param>
+ <param name="precipProbability" type="Float" minvalue="0" maxvalue="1" mandatory="false">
+ <description> 0 to 1, percentage chance </description>
+ </param>
+ <param name="precipType" type="String" mandatory="false">
+ <description> e.g. "rain", "snow", "sleet", "hail" </description>
+ </param>
+ <param name="visibility" type="Float" mandatory="false">
+ <description> In km </description>
+ </param>
+
+ <param name="weatherIcon" type="Common.Image" mandatory="false"/>
+ </struct>
+
+ <struct name="WeatherServiceData">
+ <description> This data is related to what a weather service would provide</description>
+ <param name="location" type="Common.LocationDetails" mandatory="true"/>
+ <param name="currentForecast" type="Common.WeatherData" mandatory="false"/>
+ <param name="minuteForecast" type="Common.WeatherData" array="true" minsize="15" maxsize="60" mandatory="false"/>
+ <param name="hourlyForecast" type="Common.WeatherData" array="true" minsize="1" maxsize="96" mandatory="false"/>
+ <param name="multidayForecast" type="Common.WeatherData" array="true" minsize="1" maxsize="30" mandatory="false"/>
+ <param name="alerts" type="Common.WeatherAlert" array="true" minsize="1" maxsize="10" mandatory="false">
+ <description> This array should be ordered with the first object being the current day</description>
+ </param>
+ </struct>
+
+ <struct name="NavigationServiceManifest">
+ <param name="acceptsWayPoints" type="Boolean" mandatory="false">
+ <description> Informs the subscriber if this service can actually accept way points. </description>
+ </param>
+ </struct>
+
+ <enum name="NavigationAction">
+ <element name="TURN">
+ <description> Using this action plus a supplied direction can give the type of turn. </description>
+ </element>
+ <element name="EXIT"/>
+ <element name="STAY"/>
+ <element name="MERGE"/>
+ <element name="FERRY"/>
+ <element name="CAR_SHUTTLE_TRAIN"/>
+ <element name="WAYPOINT"/>
+ </enum>
+
+ <enum name="NavigationJunction">
+ <element name="REGULAR">
+ <description> A junction that represents a standard intersection with a single road crossing another. </description>
+ </element>
+ <element name="BIFURCATION">
+ <description> A junction where the road splits off into two paths; a fork in the road. </description>
+ </element>
+ <element name="MULTI_CARRIAGEWAY">
+ <description> A junction that has multiple intersections and paths. </description>
+ </element>
+ <element name="ROUNDABOUT">
+ <description> A junction where traffic moves in a single direction around a central, non-traversable point to reach one of the connecting roads. </description>
+ </element>
+ <element name="TRAVERSABLE_ROUNDABOUT">
+ <description> Similar to a roundabout, however the center of the roundabout is fully traversable. Also known as a mini-roundabout. </description>
+ </element>
+ <element name="JUGHANDLE">
+ <description> A junction where lefts diverge to the right, then curve to the left, converting a left turn to a crossing maneuver. </description>
+ </element>
+ <element name="ALL_WAY_YIELD">
+ <description> Multiple way intersection that allows traffic to flow based on priority; most commonly right of way and first in, first out. </description>
+ </element>
+ <element name="TURN_AROUND">
+ <description> A junction designated for traffic turn arounds. </description>
+ </element>
+ </enum>
+
+ <enum name="Direction">
+ <element name="LEFT"/>
+ <element name="RIGHT"/>
+ </enum>
+
+ <struct name="NavigationInstruction">
+ <param name="locationDetails" type="Common.LocationDetails" mandatory="true"/>
+
+ <param name="action" type="Common.NavigationAction" mandatory="true"/>
+
+ <param name="eta" type="Common.DateTime" mandatory="false"/>
+
+ <param name="bearing" type="Integer" minvalue="0" maxvalue="359" mandatory="false">
+ <description> The angle at which this instruction takes place. For example, 0 would mean straight, less than 45 is bearing right, greater than 135 is sharp right, between 45 and 135 is a regular right, and 180 is a U-Turn, etc. </description>
+ </param>
+
+ <param name="junctionType" type="Common.NavigationJunction" mandatory="false"/>
+
+ <param name="drivingSide" type="Common.Direction" mandatory="false">
+ <description> Used to infer which side of the road this instruction takes place. For a U-Turn (action=TURN, bearing=180) this will determine which direction the turn should take place. </description>
+ </param>
+
+ <param name="details" type="String" mandatory="false">
+ <description> This is a string representation of this instruction, used to display instructions to the users. This is not intended to be read aloud to the users, see the param prompt in NavigationServiceData for that. </description>
+ </param>
+
+ <param name="image" type="Common.Image" mandatory="false">
+ <description> An image representation of this instruction. </description>
+ </param>
+ </struct>
+
+ <struct name="NavigationServiceData">
+ <description> This data is related to what a navigation service would provide.</description>
+
+ <param name="timeStamp" type="Common.DateTime" mandatory="true">
+ <description> This is the timestamp of when the data was generated. This is to ensure any time or distance given in the data can accurately be adjusted if necessary. </description>
+ </param>
+
+ <param name="origin" type="Common.LocationDetails" mandatory="false"/>
+ <param name="destination" type="Common.LocationDetails" mandatory="false"/>
+ <param name="destinationETA" type="Common.DateTime" mandatory="false"/>
+
+ <param name="instructions" type="Common.NavigationInstruction" array="true" mandatory="false">
+ <description> This array should be ordered with all remaining instructions. The start of this array should always contain the next instruction.</description>
+ </param>
+
+ <param name="nextInstructionETA" type="Common.DateTime" mandatory="false"/>
+ <param name="nextInstructionDistance" type="Float" mandatory="false">
+ <description>The distance to this instruction from current location. This should only be updated ever .1 unit of distance. For more accuracy the consumer can use the GPS location of itself and the next instruction. </description>
+ </param>
+ <param name="nextInstructionDistanceScale" type="Float" mandatory="false">
+ <description>Distance till next maneuver (starting from) from previous maneuver.</description>
+ </param>
+
+ <param name="prompt" type="String" mandatory="false">
+ <description>This is a prompt message that should be conveyed to the user through either display or voice (TTS). This param will change often as it should represent the following: approaching instruction, post instruction, alerts that affect the current navigation session, etc.</description>
+ </param>
+ </struct>
+
+ <struct name="AppServiceManifest">
+ <description> This manifest contains all the information necessary for the service to be published, activated, and consumers able to interact with it </description>
+
+ <param name="serviceName" type="String" mandatory="false">
+ <description> Unique name of this service </description>
+ </param>
+
+ <param name="serviceType" type="String" mandatory="true">
+ <description> The type of service that is to be offered by this app. See AppServiceType for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core. </description>
+ </param>
+
+ <param name="serviceIcon" type="Common.Image" mandatory="false">
+ <description> The icon to be associated with this service. Most likely the same as the appIcon.</description>
+ </param>
+
+ <param name="allowAppConsumers" type="Boolean" mandatory="false" defvalue="false">
+ <description> If true, app service consumers beyond the IVI system will be able to access this service. If false, only the IVI system will be able consume the service. If not provided, it is assumed to be false. </description>
+ </param>
+
+ <param name="rpcSpecVersion" type="Common.SyncMsgVersion" mandatory="false">
+ <description> This is the max RPC Spec version the app service understands. This is important during the RPC passthrough functionality. If not included, it is assumed the max version of the module is acceptable. </description>
+ </param>
+
+ <param name="handledRPCs" type="Integer" array="true" mandatory="false">
+ <description> This field contains the Function IDs for the RPCs that this service intends to handle correctly. This means the service will provide meaningful responses. </description>
+ </param>
+
+ <param name="mediaServiceManifest" type="Common.MediaServiceManifest" mandatory="false"/>
+ <param name="weatherServiceManifest" type="Common.WeatherServiceManifest" mandatory="false"/>
+ <param name="navigationServiceManifest" type="Common.NavigationServiceManifest" mandatory="false"/>
+ </struct>
+
+ <struct name="AppServiceRecord">
+ <description> This is the record of an app service publisher that the module has. It should contain the most up to date information including the service's active state</description>
+
+ <param name="serviceID" type="String" mandatory="true">
+ <description> A unique ID tied to this specific service record. The ID is supplied by the module that services publish themselves. </description>
+ </param>
+
+ <param name="serviceManifest" type="Common.AppServiceManifest" mandatory="true">
+ <description> Manifest for the service that this record is for.</description>
+ </param>
+
+ <param name="servicePublished" type="Boolean" mandatory="true">
+ <description> If true, the service is published and available. If false, the service has likely just been unpublished, and should be considered unavailable.</description>
+ </param>
+
+ <param name="serviceActive" type="Boolean" mandatory="true">
+ <description> If true, the service is the active primary service of the supplied service type. It will receive all potential RPCs that are passed through to that service type. If false, it is not the primary service of the supplied type. See servicePublished for its availability. </description>
+ </param>
+ </struct>
+
+ <struct name="AppServiceData">
+ <description> Contains all the current data of the app service. The serviceType will link to which of the service data objects are included in this object (e.g. if the service type is MEDIA, the mediaServiceData param should be included).</description>
+
+ <param name="serviceType" type="String" mandatory="true">
+ <description>The type of service that is to be offered by this app. See AppServiceType for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core.</description>
+ </param>
+ <param name="serviceID" type="String" mandatory="true"/>
+
+ <param name="mediaServiceData" type="Common.MediaServiceData" mandatory="false"/>
+ <param name="weatherServiceData" type="Common.WeatherServiceData" mandatory="false"/>
+ <param name="navigationServiceData" type="Common.NavigationServiceData" mandatory="false"/>
+ </struct>
+
+ <enum name="ServiceUpdateReason">
+ <element name="PUBLISHED">
+ <description> The service has just been published with the module and once activated to the primary service of its type, it will be ready for possible consumption.</description>
+ </element>
+ <element name="REMOVED">
+ <description> The service has just been unpublished with the module and is no longer accessible</description>
+ </element>
+ <element name="ACTIVATED">
+ <description> The service is activated as the primary service of this type. All requests dealing with this service type will be handled by this service.</description>
+ </element>
+ <element name="DEACTIVATED">
+ <description> The service has been deactivated as the primary service of its type</description>
+ </element>
+ <element name="MANIFEST_UPDATE">
+ <description> The service has updated its manifest. This could imply updated capabilities. Note: Currently unimplemented </description>
+ </element>
+ </enum>
+
+ <struct name="AppServiceCapability">
+ <param name="updateReason" type="Common.ServiceUpdateReason" mandatory="false">
+ <description> Only included in OnSystemCapabilityUpdated. Update reason for service record.</description>
+ </param>
+ <param name="updatedAppServiceRecord" type="Common.AppServiceRecord" mandatory="true">
+ <description>Service record for a specific app service provider</description>
+ </param>
+ </struct>
+
+ <struct name="AppServicesCapabilities">
+ <description>Capabilities of app services including what service types are supported and the current state of services.</description>
+ <param name="appServices" type="Common.AppServiceCapability" array="true" mandatory="false">
+ <description>An array of currently available services. If this is an update to the capability the affected services will include an update reason in that item</description>
+ </param>
+ </struct>
+
+ <!-- End App Services -->
+
+ <enum name="SystemCapabilityType">
+ <description>Enumerations of all available system capability types</description>
+ <element name="NAVIGATION"/>
+ <element name="PHONE_CALL"/>
+ <element name="VIDEO_STREAMING"/>
+ <element name="REMOTE_CONTROL"/>
+ <element name="APP_SERVICES" />
+ <element name="SEAT_LOCATION"/>
+ <element name="DISPLAYS"/>
+ </enum>
+
+ <struct name="SystemCapability">
+ <description>
+ The systemCapabilityType identifies which data object exists in this struct. For example,
+ if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist
+ </description>
+ <param name="systemCapabilityType" type="Common.SystemCapabilityType" mandatory="true">
+ <description>Used as a descriptor of what data to expect in this struct. The corresponding param to this enum should be included and the only other param included.</description>
+ </param>
+ <param name="navigationCapability" type="Common.NavigationCapability" mandatory="false">
+ <description>Describes extended capabilities for onboard navigation system </description>
+ </param>
+ <param name="phoneCapability" type="Common.PhoneCapability" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ <param name="videoStreamingCapability" type="Common.VideoStreamingCapability" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ <param name="remoteControlCapability" type="Common.RemoteControlCapabilities" mandatory="false">
+ <description>Describes extended capabilities of the module's phone feature</description>
+ </param>
+ <param name="appServicesCapabilities" type="Common.AppServicesCapabilities" mandatory="false">
+ <description>
+ An array of currently available services.
+ If this is an update to the capability the affected services will include
+ an update reason in that item
+ </description>
+ </param>
+ <param name="displayCapabilities" type="Common.DisplayCapability" array="true" minsize="1" maxsize="1000" mandatory="false"/>
+ <param name="seatLocationCapability" type="SeatLocationCapability" mandatory="false">
+ <description>Contains information about the locations of each seat</description>
+ </param>
+ </struct>
+
+ <enum name="HybridAppPreference">
+ <description>Enumeration for the user's preference of which app type to use when both are available</description>
+ <element name="MOBILE" />
+ <element name="CLOUD" />
+ <element name="BOTH"/>
+ </enum>
+
+ <struct name="AppProperties">
+ <param name="nicknames" type="String" minlength="0" maxlength="100" array="true" minsize="0" maxsize="100" mandatory="false">
+ <description>An array of app names an app is allowed to register with. If included in a SetAppProperties request, this value will overwrite the existing "nicknames" field in the app policies section of the policy table.</description>
+ </param>
+ <param name="policyAppID" type="String" maxlength="100" minlength="1" mandatory="true" />
+ <param name="enabled" type="Boolean" mandatory="false">
+ <description>If true, the app will be marked as "available" or "installed" and will be included in HMI RPC UpdateAppList.</description>
+ </param>
+ <param name="authToken" type="String" maxlength="65535" mandatory="false">
+ <description>Used to authenticate connection on app activation</description>
+ </param>
+ <param name="transportType" type="String" maxlength="100" mandatory="false">
+ <description>
+ Specifies the connection type Core should use. The Core role (server or client) is dependent of "endpoint" being specified.
+ See "endpoint" for details.
+ </description>
+ </param>
+ <param name="hybridAppPreference" type="Common.HybridAppPreference" mandatory="false">
+ <description>Specifies the user preference to use one specific app type or all available types</description>
+ </param>
+ <param name="endpoint" type="String" maxlength="65535" mandatory="false">
+ <description>
+ If specified, which Core uses a client implementation of the connection type and attempts to connect to the endpoint when this app is selected (activated).
+ If omitted, Core won't attempt to connect as the app selection (activation) is managed outside of Core. Instead it uses a server implementation of the connection type and expects the app to connect.
+ </description>
+ </param>
+ </struct>
+
</interface>
<interface name="Buttons" version="1.3.0" date="2017-07-18">
@@ -2804,6 +4179,9 @@
<param name="moduleType" type="Common.ModuleType" mandatory="true" >
<description>The module where the button should be pressed</description>
</param>
+ <param name="moduleId" type="String" maxlength="100" mandatory="false">
+ <description>Id of a module, published by System Capability. </description>
+ </param>
<param name="buttonName" type="Common.ButtonName" mandatory="true" />
<param name="buttonPressMode" type="Common.ButtonPressMode" mandatory="true" >
<description>Indicates whether this is a LONG or SHORT button press event.</description>
@@ -2870,7 +4248,27 @@
</function>
</interface>
-<interface name="BasicCommunication" version="1.2.1" date="2017-08-02">
+<interface name="BasicCommunication" version="2.1.0" date="2019-03-18">
+<function name="OnServiceUpdate" messagetype="notification">
+ <description>
+ Must be sent by SDL to HMI when there is an update on status of certain services.
+ Services supported with current version: Video
+ </description>
+ <param name="serviceType" type="Common.ServiceType" mandatory="true">
+ <description>Specifies the service which has been updated.</description>
+ </param>
+ <param name="serviceEvent" type="Common.ServiceEvent" mandatory="false">
+ <description>Specifies service update event.</description>
+ </param>
+ <param name="reason" type="Common.ServiceStatusUpdateReason" mandatory="false">
+ <description>
+ The reason for a service event. Certain events may not have a reason, such as when a service is ACCEPTED (which is the normal expected behavior).
+ </description>
+ </param>
+ <param name="appID" type="Integer" mandatory="false">
+ <description>ID of the application which triggered the update.</description>
+ </param>
+</function>
<function name="GetSystemTime" messagetype="request">
<description>Request from SDL to HMI to obtain current UTC time.</description>
</function>
@@ -2925,13 +4323,6 @@
<description>ID of the application.</description>
</param>
</function>
- <function name="AllowDeviceToConnect" messagetype="request">
- <description>Request from SmartDeviceLink to HMI to get the permissions of new device connection.</description>
- <param name="device" type="Common.DeviceInfo" mandatory="true"/>
- </function>
- <function name="AllowDeviceToConnect" messagetype="response">
- <param name="allow" type="Boolean" mandatory="true"/>
- </function>
<function name="OnDeviceChosen" messagetype="notification">
<description>Notification must be initiated by HMI on user selecting device in the list of devices.</description>
<param name="deviceInfo" type="Common.DeviceInfo" mandatory="true">
@@ -2958,17 +4349,35 @@
</function>
<function name="ActivateApp" messagetype="response">
</function>
+ <function name="CloseApplication" messagetype="request">
+ <description>Request from the application to exit the foreground.</description>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of selected application.</description>
+ </param>
+ </function>
+ <function name="CloseApplication" messagetype="response">
+ </function>
<function name="OnAppActivated" messagetype="notification">
<description>Must be sent by HU system when the user clicks on app in the list of registered apps or on soft button with 'STEAL_FOCUS' action.</description>
<param name="appID" type="Integer" mandatory="true">
<description>ID of selected application.</description>
</param>
+ <param name="windowID" type="Integer" mandatory="false">
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended. If this param is not included, it will be assumed that this request is specifically for the main window on the main display. See PredefinedWindows enum.
+ </description>
+ </param>
</function>
<function name="OnAppDeactivated" messagetype="notification">
<description>Must be sent by HU system when the user switches to any functionality which is not other mobile application.</description>
<param name="appID" type="Integer" mandatory="true">
<description>ID of deactivated application.</description>
</param>
+ <param name="windowID" type="Integer" mandatory="false">
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended. If this param is not included, it will be assumed that this request is specifically for the main window on the main display. See PredefinedWindows enum.
+ </description>
+ </param>
</function>
<function name="OnAppRegistered" messagetype="notification">
<description>Issued by SDL to notify HMI about new application registered.</description>
@@ -2987,7 +4396,7 @@
<param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false">
<description>
Defines an additional voice recognition command.
- Must not interfere with any name of previously registered applications(SDL makes check).
+ Must not interfere with any name of previously registered applications from the same device.
</description>
</param>
<param name="resumeVrGrammars" type="Boolean" mandatory="false">
@@ -3044,7 +4453,10 @@
<function name="DialNumber" messagetype="request">
<description>Request from SDL to call a specific number.</description>
<param name="number" type="String" maxlength="40" mandatory="true">
- <description>The number to dial. Only the character + and numbers are allowed.</description>
+ <description>
+ Phone number is a string, which can be up to 40 chars.
+ All characters shall be stripped from string except digits 0-9 and * # , ; +
+ </description>
</param>
<param name="appID" type="Integer" mandatory="true">
<description>ID of application that concerns this RPC.</description>
@@ -3139,43 +4551,75 @@
</function>
<function name="OnPutFile" messagetype="notification" >
- <description>
- Notification, that comes to HMI when mobile sents file with systemFile flag
- </description>
+ <description>
+ Notification that is sent to HMI when a mobile application uploads a file
+ </description>
- <param name="offset" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
- <description>Optional offset in bytes for resuming partial data chunks</description>
- </param>
- <param name="length" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
- <description>Optional length in bytes for resuming partial data chunks</description>
- </param>
+ <param name="offset" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
+ <description>Optional offset in bytes for resuming partial data chunks</description>
+ </param>
+ <param name="length" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
+ <description>Optional length in bytes for resuming partial data chunks</description>
+ </param>
- <param name="fileSize" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
- <description>Full Size of file. sends in first OnPutFile notification if file is splited
- into many PutFiles
- </description>
- </param>
+ <param name="fileSize" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
+ <description>Full Size of file. sends in first OnPutFile notification if file is splited
+ into many PutFiles
+ </description>
+ </param>
- <param name="FileName" type="String" maxlength="255" mandatory="true">
- <description>File reference name.</description>
- </param>
+ <param name="FileName" type="String" maxlength="255" mandatory="true">
+ <description>File reference name.</description>
+ </param>
- <param name="syncFileName" type="String" maxlength="255" mandatory="true">
- <description>File reference name.</description>
- </param>
+ <param name="syncFileName" type="String" maxlength="255" mandatory="true">
+ <description>File reference name.</description>
+ </param>
+
+ <param name="fileType" type="Common.FileType" mandatory="true">
+ <description>Selected file type.</description>
+ </param>
- <param name="fileType" type="Common.FileType" mandatory="true">
- <description>Selected file type.</description>
+ <param name="persistentFile" type="Boolean" defvalue="false" mandatory="false">
+ <description>
+ Indicates if the file is meant to persist between sessions / ignition cycles.
+ If set to TRUE, then the system will aim to persist this file through session / cycles.
+ While files with this designation will have priority over others, they are subject to deletion by the system at any time.
+ In the event of automatic deletion by the system, the app will receive a rejection and have to resend the file.
+ If omitted, the value will be set to false.
+ </description>
+ </param>
+ <param name="isSystemFile" type="Boolean" defvalue="false" mandatory="false">
+ <description>
+ Indicates if the file is meant to be passed thru core to elsewhere on the system.
+ If true the system will pass the data thru as it arrives to a predetermined area outside of core.
+ </description>
+ </param>
+ <param name="appID" type="Integer" mandatory="false">
+ <description> ID of application that uploaded this file. </description>
+ </param>
+ </function>
+
+ <function name="GetFilePath" messagetype="request">
+ <description>This request is sent to retrieve a file path from the HMI.</description>
+ <param name="fileName" type="String" maxlength="255" mandatory="true">
+ <description>File name that should be retrieved.</description>
</param>
+ <param name="fileType" type="Common.FileType" mandatory="false">
+ <description>Selected file type.</description>
+ </param>
+ <param name="appServiceId" type="String" mandatory="false">
+ <description> ID of the service that should have uploaded the requested file.</description>
+ </param>
+ </function>
- <param name="persistentFile" type="Boolean" defvalue="false" mandatory="false">
- <description>
- Indicates if the file is meant to persist between sessions / ignition cycles.
- If set to TRUE, then the system will aim to persist this file through session / cycles.
- While files with this designation will have priority over others, they are subject to deletion by the system at any time.
- In the event of automatic deletion by the system, the app will receive a rejection and have to resend the file.
- If omitted, the value will be set to false.
- </description>
+ <function name="GetFilePath" messagetype="response">
+ <description> HMI handles the request internally and returns the file path with the response.</description>
+ <param name="filePath" type="String" mandatory="false">
+ <description>Path to file in hmi</description>
+ </param>
+ <param name="fileType" type="Common.FileType" mandatory="false">
+ <description>Selected file type.</description>
</param>
</function>
@@ -3220,6 +4664,60 @@
<description>Must be 'true' - when the event is started on HMI. Must be 'false' when the event is ended on HMI</description>
</param>
</function>
+ <function name="OnSystemCapabilityUpdated" messagetype="notification">
+ <description>
+ A notification between HMI and SDL that a specific system capability has been changed.
+ It can be sent in both directions SDL to HMI and HMI to SDL. Direction is dependent on
+ the point where capabilities have been changed
+ </description>
+ <param name="systemCapability" type="Common.SystemCapability" mandatory="true">
+ <description>The system capability that has been updated</description>
+ </param>
+ <param name="appID" type="Integer" mandatory="false">
+ <description>ID of application that is related to this RPC.</description>
+ </param>
+ </function>
+
+ <function name="SetAppProperties" messagetype="request">
+ <description>
+ HMI >SDL. RPC used to enable/disable an application and set authentication data
+ </description>
+ <param name="properties" type="Common.AppProperties" mandatory="true">
+ <description>The new application properties</description>
+ </param>
+ </function>
+
+ <function name="SetAppProperties" messagetype="response">
+ <description>The response to SetAppProperties</description>
+ </function>
+
+ <function name="GetAppProperties" messagetype="request">
+ <description>
+ HMI >SDL. RPC used to get the current properties of an application
+ </description>
+ <param name="policyAppID" type="String" maxlength="100" mandatory="false">
+ <description>
+ If specified the response will contain the properties of the specified app ID.
+ Otherwise if omitted all app properties will be returned at once.
+ </description>
+ </param>
+ </function>
+
+ <function name="GetAppProperties" messagetype="response">
+ <description>The response to GetAppProperties</description>
+ <param name="properties" type="Common.AppProperties" array="true" minsize="1" mandatory="false">
+ <description>The requested application properties</description>
+ </param>
+ </function>
+
+ <function name="OnAppPropertiesChange" messagetype="notification">
+ <description>
+ SDL >HMI. RPC used to inform HMI about app properties change (such as auth token).
+ </description>
+ <param name="properties" type="Common.AppProperties" mandatory="true">
+ <description>The new application properties</description>
+ </param>
+ </function>
</interface>
<interface name="VR" version="1.1.0" date="2017-04-27">
@@ -3306,6 +4804,11 @@
<param name="appID" type="Integer" mandatory="true">
<description>ID of application related to this RPC.</description>
</param>
+ <param name="cancelID" type="Integer" mandatory="false">
+ <description>
+ An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ </description>
+ </param>
</function>
<function name="PerformInteraction" messagetype="response">
<param name="choiceID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
@@ -3329,7 +4832,7 @@
<description>
Request new VR synonyms registration
Defines an additional voice recognition command.
- Must not interfere with any name of previously registered applications(SDL makes check).
+ Must not interfere with any name of previously registered applications from the same device.
</description>
</param>
<param name="language" type="Common.Language" mandatory="true">
@@ -3371,7 +4874,7 @@
</function>
</interface>
-<interface name="TTS" version="1.1.0" date="2017-04-27">
+<interface name="TTS" version="2.0.0" date="2018-09-05">
<description>RPCs for communication between TTS and SDL.</description>
<function name="GetCapabilities" messagetype="request">
<description>Method is invoked at system start-up. SDL requests the information about all supported hardware and their capabilities</description>
@@ -3497,7 +5000,7 @@
</function>
</interface>
-<interface name="UI" version="1.2.0" date="2017-09-05">
+<interface name="UI" version="1.4.0" date="2019-07-24">
<function name="Alert" messagetype="request">
<description>Request from SDL to show an alert message on the display.</description>
<param name="alertStrings" type="Common.TextFieldStruct" mandatory="true" array="true" minsize="0" maxsize="3">
@@ -3518,19 +5021,64 @@
<param name="appID" type="Integer" mandatory="true">
<description>ID of application requested this RPC.</description>
</param>
+ <param name="cancelID" type="Integer" mandatory="false">
+ <description>
+ An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ </description>
+ </param>
+ <param name="alertIcon" type="Common.Image" mandatory="false" >
+ <description>
+ Image to be displayed for the corresponding alert. See Image.
+ If omitted, no (or the default if applicable) icon should be displayed.
+ </description>
+ </param>
</function>
+
<function name="Alert" messagetype="response">
<param name="tryAgainTime" type="Integer" mandatory="false" minvalue="0" maxvalue="2000000000">
<description>Amount of time (in milliseconds) that SDL must wait before resending an alert. Must be provided if another system event or overlay currently has a higher priority than this alert.</description>
</param>
</function>
+
+ <function name="SetDisplayLayout" messagetype="request">
+ <description>This RPC is deprecated. Use Show RPC to change layout.</description>
+ <param name="displayLayout" type="String" maxlength="500" mandatory="true">
+ <description>
+ Predefined or dynamically created screen layout.
+ Currently only predefined screen layouts are defined.
+ </description>
+ </param>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application related to this RPC.</description>
+ </param>
+ <param name="dayColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
+ <param name="nightColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
+ </function>
+
+ <function name="SetDisplayLayout" messagetype="response">
+ <description>This RPC is deprecated. Use Show RPC to change layout.</description>
+ <param name="displayCapabilities" type="Common.DisplayCapabilities" mandatory="false">
+ <description>See DisplayCapabilities</description>
+ </param>
+ <param name="buttonCapabilities" type="Common.ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See ButtonCapabilities</description >
+ </param>
+ <param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
+ </param>
+ <param name="presetBankCapabilities" type="Common.PresetBankCapabilities" mandatory="false">
+ <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
+ </param>
+ </function>
+
<function name="Show" messagetype="request">
- <param name="showStrings" type="Common.TextFieldStruct" mandatory="true" array="true" minsize="0" maxsize="7">
- <description>Array of lines of show text fields. See TextFieldStruct. Uses mainField1, mainField2, mainField3, mainField4. If some field is not set, the corresponding text should stay unchanged. If field's text is empty "", the field must be cleared.
+ <param name="showStrings" type="Common.TextFieldStruct" mandatory="true" array="true" minsize="0" maxsize="8">
+ <description>Array of lines of show text fields. See TextFieldStruct. If some field is not set, the corresponding text should stay unchanged. If field's text is empty "", the field must be cleared.
mainField1: The text that should be displayed in a single or upper display line.
mainField2: The text that should be displayed on the second display line.
mainField3: The text that should be displayed on the second "page" first display line.
mainField4: The text that should be displayed on the second "page" second display line.
+ templateTitle: The title of the new template that will be displayed.
statusBar: statusBar.
mediaClock: Text value for MediaClock field.
mediaTrack: The text that should be displayed in the track field. This field is only valid for media applications on NGN type ACMs.
@@ -3560,16 +5108,105 @@
<param name="appID" type="Integer" mandatory="true">
<description>Id of application related to this RPC.</description>
</param>
+ <param name="windowID" type="Integer" mandatory="false" >
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended.
+ If this param is not included,
+ it will be assumed that this request is specifically for the main window
+ on the main display.
+ See PredefinedWindows enum.
+ </description>
+ </param>
+
+ <param name="templateConfiguration" type="Common.TemplateConfiguration" mandatory="false">
+ <description>
+ Used to set an alternate template layout to a window.
+ </description>
+ </param>
</function>
+
<function name="Show" messagetype="response">
</function>
+
+ <function name="CreateWindow" messagetype="request">
+ <description>
+ Create a new window on the display with the specified window type.
+ </description>
+ <param name="windowID" type="Integer" mandatory="true">
+ <description>
+ A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ </description>
+ </param>
+
+ <param name="windowName" type="String" maxlength="100" mandatory="true">
+ <description>
+ The window name to be used by the HMI. The name of the pre-created default window will match the app name.
+ Multiple apps can share the same window name except for the default main window.
+ Creating a window with a name which is already in use by the app will result in `DUPLICATE_NAME`.
+ </description>
+ </param>
+
+ <param name="type" type="Common.WindowType" mandatory="true">
+ <description>The type of the window to be created. Main window or widget.</description>
+ </param>
+
+ <param name="associatedServiceType" type="String" mandatory="false">
+ <description>
+ Allows an app to create a widget related to a specific service type.
+ As an example if a `MEDIA` app becomes active, this app becomes audible and is allowed to play audio.
+ Actions such as skip or play/pause will be directed to this active media app.
+ In case of widgets, the system can provide a single "media" widget which will act as a placeholder for the active media app.
+ It is only allowed to have one window per service type. This means that a media app can only have a single MEDIA widget.
+ Still the app can create widgets omitting this parameter.
+ Those widgets would be available as app specific widgets that are permanently included in the HMI.
+ This parameter is related to widgets only. The default main window, which is pre-created during app registration,
+ will be created based on the HMI types specified in the app registration request.
+ </description>
+ </param>
+
+ <param name="duplicateUpdatesFromWindowID" type="Integer" mandatory="false">
+ <description>
+ Optional parameter. Specify whether the content sent to an existing window
+ should be duplicated to the created window.
+ If there isn't a window with the ID, the request will be rejected with `INVALID_DATA`.
+ </description>
+ </param>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application that concerns this RPC.</description>
+ </param>
+ </function>
+
+ <function name="CreateWindow" messagetype="response">
+ </function>
+
+ <function name="DeleteWindow" messagetype="request">
+ <description>
+ Deletes previously created window of the SDL application.
+ </description>
+ <param name="windowID" type="Integer" mandatory="true">
+ <description>
+ A unique ID to identify the window. The value of '0' will always be the default main window
+ on the main display and cannot be deleted.
+ See PredefinedWindows enum.
+ </description>
+ </param>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application that concerns this RPC.</description>
+ </param>
+ </function>
+
+ <function name="DeleteWindow" messagetype="response">
+ </function>
+
<function name="AddCommand" messagetype="request">
<description>Request from SDL to add a command to the application menu.</description>
<param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>ID of the command to be added.</description>
</param>
<param name="menuParams" type="Common.MenuParams" mandatory="false">
- <description>Optional sub value containing parameters of the command (position, name, etc.). See MenuParams. If omitted the command should be added to the end of the list of commands.</description>
+ <description>
+ Optional sub value containing parameters of the command (position, name, etc.). See MenuParams.
+ If omitted the command should be added to the end of the list of commands.</description>
</param>
<param name="cmdIcon" type="Common.Image" mandatory="false">
<description>Image to be displayed for representing the command. See Image.</description>
@@ -3579,8 +5216,10 @@
<description>ID of application that concerns this RPC.</description>
</param>
</function>
+
<function name="AddCommand" messagetype="response">
- </function>
+ </function>
+
<function name="DeleteCommand" messagetype="request">
<description>Request from SDL to delete a command from the in-application menu with the specified command id.</description>
<param name="cmdID" type="Integer" mandatory="true" minvalue="0" maxvalue="2000000000">
@@ -3590,8 +5229,10 @@
<description>ID of application that concerns this RPC.</description>
</param>
</function>
+
<function name="DeleteCommand" messagetype="response">
</function>
+
<function name="AddSubMenu" messagetype="request">
<description>Request from SDL to add a sub menu to the in-application menu.</description>
<param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="true">
@@ -3606,6 +5247,9 @@
<param name="appID" type="Integer" mandatory="true">
<description>ID of application that requested this RPC.</description>
</param>
+ <param name="menuLayout" type="Common.MenuLayout" mandatory="false">
+ <description>Sets the layout of the submenu screen.</description>
+ </param>
</function>
<function name="AddSubMenu" messagetype="response">
</function>
@@ -3620,6 +5264,20 @@
</function>
<function name="DeleteSubMenu" messagetype="response">
</function>
+ <function name="ShowAppMenu" messagetype="request">
+ <description>Request from SDL to show an app's menu or a corresponding sub-menu.</description>
+ <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="false">
+ <description>
+ If ommited the HMI opens the app's menu.
+ If set to a sub-menu ID the HMI opens the corresponding sub-menu previously added using `AddSubMenu`.
+ </description>
+ </param>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application that concerns this RPC.</description>
+ </param>
+ </function>
+ <function name="ShowAppMenu" messagetype="response">
+ </function>
<function name="PerformInteraction" messagetype="request">
<description>Request from SDL for triggering an interaction (e.g. "Permit GPS?" - Yes, no, Always Allow).</description>
<param name="initialText" type="Common.TextFieldStruct" mandatory="false">
@@ -3644,6 +5302,11 @@
<param name="appID" type="Integer" mandatory="true">
<description>ID of application that concerns this RPC.</description>
</param>
+ <param name="cancelID" type="Integer" mandatory="false">
+ <description>
+ An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ </description>
+ </param>
</function>
<function name="PerformInteraction" messagetype="response">
<param name="choiceID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
@@ -3656,6 +5319,23 @@
</description>
</param>
</function>
+ <function name="CancelInteraction" messagetype="request">
+ <param name="cancelID" type="Integer" mandatory="false">
+ <description>
+ The ID of the specific interaction you want to dismiss. If not set, the most recent of the RPC type set in functionID will be dismissed.
+ </description>
+ </param>
+ <param name="functionID" type="Integer" mandatory="true">
+ <description>
+ The ID of the type of interaction the developer wants to dismiss. Only values 10, (PerformInteractionID), 12 (AlertID), 25 (ScrollableMessageID), and 26 (SliderID) are permitted.
+ </description>
+ </param>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application requested this RPC.</description>
+ </param>
+ </function>
+ <function name="CancelInteraction" messagetype="response">
+ </function>
<function name="SetMediaClockTimer" messagetype="request">
<description>Sets the initial media clock value and automatic update method.</description>
<param name="startTime" type="Common.TimeFormat" mandatory="false">
@@ -3673,6 +5353,9 @@
<description>The update method of the media clock.</description>
<description>In case of pause, resume, or clear, the start time value is ignored and shall be left out. For resume, the time continues with the same value as it was when paused.</description>
</param>
+ <param name="audioStreamingIndicator" type="Common.AudioStreamingIndicator" mandatory="false">
+ <description>Indicates that a button press of the Play/Pause button would play, pause or Stop the current playback.</description>
+ </param>
<param name="appID" type="Integer" mandatory="true">
<description>ID of application that requested this RPC.</description>
</param>
@@ -3700,6 +5383,9 @@
<param name="appID" type="Integer" mandatory="true">
<description>ID of application that concerns this RPC.</description>
</param>
+ <param name="menuLayout" type="Common.MenuLayout" mandatory="false">
+ <description>Sets the layout of the main menu screen. If this is sent while a menu is already on-screen, the head unit will change the display to the new layout type.</description>
+ </param>
</function>
<function name="SetGlobalProperties" messagetype="response">
</function>
@@ -3723,6 +5409,11 @@
<param name="appID" type="Integer" mandatory="false">
<description>ID of application that is related to this RPC.</description>
</param>
+ <param name="windowID" type="Integer" mandatory="false">
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended. If this param is not included, it will be assumed that this request is specifically for the main window on the main display. See PredefinedWindows enum.
+ </description>
+ </param>
</function>
<function name="GetCapabilities" messagetype="request">
<description>Method is invoked at system startup by SDL to request information about UI capabilities of HMI.</description>
@@ -3731,7 +5422,17 @@
<param name="displayCapabilities" type="Common.DisplayCapabilities" mandatory="true">
<description>Information about the capabilities of the display: its type, text field supported, etc. See DisplayCapabilities. </description>
</param>
- <param name="audioPassThruCapabilities" type="Common.AudioPassThruCapabilities" mandatory="true"/>
+ <param name="audioPassThruCapabilities" type="Common.AudioPassThruCapabilities" mandatory="true">
+ <description>
+ Describes an audio configuration that the system supports for PerformAudioPassThru.
+ Note: please fill out both audioPassThruCapabilities and audioPassThruCapabilitiesList parameters, as:
+ - Newer SDL Core uses audioPassThruCapabilitiesList instead of audioPassThruCapabilities, and
+ - audioPassThruCapabilities is a mandatory field and cannot be omitted.
+ </description>
+ </param>
+ <param name="audioPassThruCapabilitiesList" type="Common.AudioPassThruCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>Describes the audio configurations that the system supports for PerformAudioPassThru.</description>
+ </param>
<param name="hmiZoneCapabilities" type="Common.HmiZoneCapabilities" mandatory="true"/>
<param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
<description>Must be returned if the platform supports on-screen SoftButtons.</description>
@@ -3748,10 +5449,10 @@
<param name="appName" type="String" maxlength="100" mandatory="false">
<description>
Request new app name registration
- Needs to be unique over all applications.
+ Needs to be unique over all applications from the same device.
May not be empty. May not start with a new line character.
- May not interfere with any name or synonym of any registered applications.
- Applications with the same name will be rejected. (SDL makes all the checks)
+ May not interfere with any name or synonym of any registered applications from the same device.
+ Additional applications with the same name from the same device will be rejected.
</description>
</param>
<param name="ngnMediaScreenAppName" type="String" maxlength="100" mandatory="false">
@@ -3808,66 +5509,6 @@
</function>
<function name="SetAppIcon" messagetype="response">
</function>
- <function name="SetDisplayLayout" messagetype="request">
- <param name="displayLayout" type="String" maxlength="500" mandatory="true">
- <description>
- Predefined or dynamically created screen layout.
- Currently only predefined screen layouts are defined.
- </description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- <param name="dayColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
- <param name="nightColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
- </function>
- <function name="SetDisplayLayout" messagetype="response">
- <param name="displayCapabilities" type="Common.DisplayCapabilities" mandatory="false">
- <description>See DisplayCapabilities</description>
- </param>
- <param name="buttonCapabilities" type="Common.ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See ButtonCapabilities</description >
- </param>
- <param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
- </param>
- <param name="presetBankCapabilities" type="Common.PresetBankCapabilities" mandatory="false">
- <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
- </param>
- </function>
- <function name="ShowCustomForm" messagetype="request">
- <description>Used to show a custom form; it can be a parent or child screen. If no parent screen is designated, it is set as a parent screen.</description>
- <param name="customFormID" type="String" maxlength="500" mandatory="true">
- <description>
- Predefined or dynamically created screen layout.
- Currently only predefined forms are defined.
- Predefined layouts include:
- "DEFAULT" - Default media / non-media screen
- "ONSCREEN_PRESETS" - Custom root media screen containing app-defined onscreen presets.
- "KEYBOARD_SEARCH" - Custom template containing app-configured on-screen keyboard with active search updating; user also can trigger voice search.
- "NAV_FULLSCREEN_MAP" - Custom root template screen containing full screen map with navigation controls.
- "NAV_POI_MENU" - Custom template containing app-defined POI options.
- "NAV_SEARCH_RESULTS" - Custom template containing a list of app-defined search results
- "NAV_POI_INFO" - Custom template containing app-defined POI information (and potentially map data).
- </description>
- </param>
- <param name="parentFormID" type="String" maxlength="500" defvalue="DEFAULT" mandatory="false">
- <description>
- Parent screen of predefined form to display.
- Currently only predefined forms are defined.
- If not provided, then set to "DEFAULT".
- Predefined layouts include:
- "DEFAULT" - Default media / non-media screen
- "ONSCREEN_PRESETS" - Custom root media screen containing app-defined onscreen presets.
- "NAV_FULLSCREEN_MAP" - Custom template containing full screen map with navigation controls.
- </description>
- </param>
- </function>
- <function name="ShowCustomForm" messagetype="response">
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
<function name="OnKeyboardInput" messagetype="notification">
<description>On-screen keyboard event.</description>
<description>Can be full string or individual keypresses depending on keyboard mode.</description>
@@ -3914,6 +5555,11 @@
<param name="appID" type="Integer" mandatory="true">
<description>ID of application that concerns this RPC.</description>
</param>
+ <param name="cancelID" type="Integer" mandatory="false">
+ <description>
+ An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ </description>
+ </param>
</function>
<function name="Slider" messagetype="response">
<param name="sliderPosition" type="Integer" minvalue="1" maxvalue="26" mandatory="false">
@@ -3935,6 +5581,11 @@
<param name="appID" type="Integer" mandatory="true">
<description>ID of application related to this RPC.</description>
</param>
+ <param name="cancelID" type="Integer" mandatory="false">
+ <description>
+ An ID for this specific alert to allow cancellation through the `CancelInteraction` RPC.
+ </description>
+ </param>
</function>
<function name="ScrollableMessage" messagetype="response">
</function>
@@ -4014,7 +5665,7 @@
</function>
</interface>
-<interface name="Navigation" version="1.5.0" date="2017-08-15">
+<interface name="Navigation" version="1.5.0" date="2017-08-15">
<function name="IsReady" messagetype="request">
<description>Method is invoked at system startup. Response must provide the information about presence of UI Navigation module and its readiness to cooperate with SDL.</description>
@@ -4240,7 +5891,7 @@
</interface>
-<interface name="VehicleInfo" version="1.1.0" date="2017-04-27">
+<interface name="VehicleInfo" version="2.1.0" date="2019-03-18">
<function name="IsReady" messagetype="request">
<description>Method is invoked at system startup. Response should provide information about presence of any of vehicle information modules (ECU, GPS, etc) and their readiness to cooperate with SDL.</description>
</function>
@@ -4393,6 +6044,13 @@
<param name="engineOilLife" type="Boolean" mandatory="false">
<description>The estimated percentage of remaining oil life of the engine.</description>
</param>
+ <param name="electronicParkBrakeStatus" type="Boolean" mandatory="false">
+ <description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
+ </param>
+ <param name="cloudAppVehicleID" type="Boolean" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
@@ -4410,6 +6068,7 @@
<description>Information related to the MyKey feature</description>
</param>
<!-- / Ford Specific Data Items -->
+
</function>
<function name="SubscribeVehicleData" messagetype="response">
<param name="gps" type="Common.VehicleDataResult" mandatory="false">
@@ -4478,6 +6137,13 @@
<param name="engineOilLife" type="Common.VehicleDataResult" mandatory="false">
<description>The estimated percentage of remaining oil life of the engine.</description>
</param>
+ <param name="electronicParkBrakeStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
+ </param>
+ <param name="cloudAppVehicleID" type="Common.VehicleDataResult" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
@@ -4495,6 +6161,7 @@
<description>Information related to the MyKey feature</description>
</param>
<!-- / Ford Specific Data Items -->
+
</function>
<function name="UnsubscribeVehicleData" messagetype="request">
<description>
@@ -4569,6 +6236,13 @@
<param name="engineOilLife" type="Boolean" mandatory="false">
<description>The estimated percentage of remaining oil life of the engine.</description>
</param>
+ <param name="electronicParkBrakeStatus" type="Boolean" mandatory="false">
+ <description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
+ </param>
+ <param name="cloudAppVehicleID" type="Boolean" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
@@ -4586,6 +6260,7 @@
<description>Information related to the MyKey feature</description>
</param>
<!-- / Ford Specific Data Items -->
+
</function>
<function name="UnsubscribeVehicleData" messagetype="response">
<param name="gps" type="Common.VehicleDataResult" mandatory="false">
@@ -4654,6 +6329,13 @@
<param name="engineOilLife" type="Common.VehicleDataResult" mandatory="false">
<description>The estimated percentage of remaining oil life of the engine.</description>
</param>
+ <param name="electronicParkBrakeStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
+ </param>
+ <param name="cloudAppVehicleID" type="Common.VehicleDataResult" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
<!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
@@ -4671,6 +6353,7 @@
<description>Information related to the MyKey feature</description>
</param>
<!-- / Ford Specific Data Items -->
+
</function>
<function name="GetVehicleData" messagetype="request">
<description>Non periodic vehicle data read request.</description>
@@ -4743,6 +6426,14 @@
<param name="engineOilLife" type="Boolean" mandatory="false">
<description>The estimated percentage of remaining oil life of the engine.</description>
</param>
+ <param name="electronicParkBrakeStatus" type="Boolean" mandatory="false">
+ <description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
+ </param>
+ <param name="cloudAppVehicleID" type="Boolean" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Boolean" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -4758,6 +6449,8 @@
<param name="myKey" type="Boolean" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
+ <!-- / Ford Specific Data Items -->
+
</function>
<function name="GetVehicleData" messagetype="response">
<param name="gps" type="Common.GPSData" mandatory="false">
@@ -4829,6 +6522,14 @@
<param name="engineOilLife" type="Float" minvalue="0" maxvalue="100" mandatory="false">
<description>The estimated percentage of remaining oil life of the engine.</description>
</param>
+ <param name="electronicParkBrakeStatus" type="Common.ElectronicParkBrakeStatus" mandatory="false">
+ <description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
+ </param>
+ <param name="cloudAppVehicleID" type="String" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -4844,6 +6545,8 @@
<param name="myKey" type="Common.MyKey" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
+ <!-- / Ford Specific Data Items -->
+
</function>
<function name="OnVehicleData" messagetype="notification">
<description>Callback for the periodic and non periodic vehicle data read function.</description>
@@ -4866,7 +6569,7 @@
<description>The instantaneous fuel consumption in microlitres</description>
</param>
<param name="fuelRange" type="Common.FuelRange" minsize="0" maxsize="100" array="true" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
+ <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
</param>
<param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
<description>The external temperature in degrees celsius</description>
@@ -4889,6 +6592,9 @@
<param name="beltStatus" type="Common.BeltStatus" mandatory="false">
<description>The status of the seat belts</description>
</param>
+ <param name="electronicParkBrakeStatus" type="Common.ElectronicParkBrakeStatus" mandatory="false">
+ <description>The status of the park brake as provided by Electric Park Brake (EPB) system.</description>
+ </param>
<param name="bodyInformation" type="Common.BodyInformation" mandatory="false">
<description>The body information including power modes</description>
</param>
@@ -4913,6 +6619,14 @@
<param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
<description>Current angle of the steering wheel (in deg)</description>
</param>
+ <param name="cloudAppVehicleID" type="String" mandatory="false">
+ <description>Parameter used by cloud apps to identify a head unit</description>
+ </param>
+ <param name="engineOilLife" type="Float" minvalue="0" maxvalue="100" mandatory="false">
+ <description>The estimated percentage of remaining oil life of the engine.</description>
+ </param>
+
+ <!-- Ford Specific Data Items -->
<param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
@@ -4928,11 +6642,13 @@
<param name="myKey" type="Common.MyKey" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
+ <!-- / Ford Specific Data Items -->
+
</function>
</interface>
<!-- Policies -->
-<interface name="SDL" version="1.1.0" date="2017-04-27">
+<interface name="SDL" version="1.2.0" date="2018-09-05">
<function name="ActivateApp" messagetype="request">
<param name="appID" type="Integer" mandatory="true">
</param>
@@ -5091,21 +6807,29 @@
<param name="statisticType" type="Common.StatisticsType" mandatory="true"/>
</function>
- <function name="GetURLS" messagetype="request" scope="internal">
- <description>Sent by system to SDL to get list of URL for specified service type and optionally policy's application id.</description>
- <param name="service" type="Integer" minvalue="0" maxvalue="100" mandatory="true"/>
- </function>
- <function name="GetURLS" messagetype="response" scope="internal">
- <param name="urls" type="Common.ServiceInfo" array="true" mandatory="false" minsize="1" maxsize="100"/>
- </function>
<function name="OnDeviceStateChanged" messagetype="notification" scope="internal">
<param name="deviceState" type="Common.DeviceState" mandatory="true" />
<param name="deviceInternalId" type="String" mandatory="true" minlength="0" maxlength="500" />
<param name="deviceId" type="Common.DeviceInfo" mandatory="false"/>
</function>
+
+ <function name="GetPolicyConfigurationData" messagetype="request" scope="internal">
+ <description>Request from HMI to SDL core to get policy configuration data (i.e. OEM Network Mapping table file version etc.) from Policy Table.</description>
+ <param name="policyType" type="String" minlength="1" maxlength="1000" mandatory="true">
+ <description>Name of the Struct where configuration data is located in Policy Table, i.e. module_config etc.</description>
+ </param>
+ <param name="property" type="String" minlength="1" maxlength="1000" mandatory="true">
+ <description>Name of the property located within the policyType Struct, i.e. vehicle_year etc.</description>
+ </param>
+ </function>
+ <function name="GetPolicyConfigurationData" messagetype="response">
+ <param name="value" type="String" array="true" maxlength="1000" minsize="1" maxsize="100" mandatory="false">
+ <description>Value of requested property from policyType in PT. If no value is found in PT for specified policyType and property, this parameter will be omitted.</description>
+ </param>
+ </function>
</interface>
-<interface name="RC" version="1.1.0" date="2017-07-18">
+<interface name="RC" version="2.0.0" date="2018-09-05">
<function name="IsReady" messagetype="request">
<description>Method is invoked at system startup. Response should provide information about presence of any of remote controllable module and its readiness to cooperate with SDL.</description>
</function>
@@ -5122,7 +6846,23 @@
<param name="remoteControlCapability" type="Common.RemoteControlCapabilities" mandatory="false">
<description>See RemoteControlCapabilities, all available RC modules and buttons shall be returned.</description>
</param>
+ <param name="seatLocationCapability" type="Common.SeatLocationCapability" mandatory="false">
+ <description>See SeatLocationCapability, all available seat locations shall be returned.</description>
+ </param>
</function>
+
+<function name="SetGlobalProperties" messagetype="request">
+ <description>Sets some properties for the application initiated request.</description>
+ <param name="userLocation" type="Common.SeatLocation" mandatory="false">
+ <description>Location of the user's seat. Default is driver's seat location if it is not set yet.</description>
+ </param>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application related to this RPC.</description>
+ </param>
+</function>
+
+<function name="SetGlobalProperties" messagetype="response">
+</function>
<function name="SetInteriorVehicleData" functionID="SetInteriorVehicleDataID" messagetype="request">
<param name="moduleData" type="Common.ModuleData" mandatory="true" >
@@ -5143,11 +6883,11 @@
<param name="moduleType" type="Common.ModuleType" mandatory="true" >
<description>The module data to retrieve from the vehicle for that type</description>
</param>
- <param name="subscribe" type="Boolean" mandatory="false">
- <description>If subscribe is true, the head unit will send onInteriorVehicleData notifications for the module type</description>
+ <param name="moduleId" type="String" maxlength="100" mandatory="false">
+ <description>Id of a module, published by System Capability. </description>
</param>
- <param name="appID" type="Integer" mandatory="true">
- <description>Internal SDL-assigned ID of the related application</description>
+ <param name="subscribe" type="Boolean" mandatory="false">
+ <description>If subscribe is true, the head unit will send OnInteriorVehicleData notifications for the requested module (moduleId and moduleType)</description>
</param>
</function>
@@ -5156,26 +6896,29 @@
</param>
<param name="isSubscribed" type="Boolean" mandatory="false" >
<description>Is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request.
- if "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleDescription.
+ if "true" - the "moduleType" from request is successfully subscribed and the head unit will send OnInteriorVehicleData notifications for the moduleDescription.
if "false" - the "moduleType" from request is either unsubscribed or failed to subscribe.</description>
</param>
</function>
<function name="GetInteriorVehicleDataConsent" messagetype="request">
- <description>Sender: SDL->HMI. </description>
<description>HMI is expected to display a permission prompt to the driver showing the RC module and app details (for example, app's name).
The driver is expected to have an ability to grant or deny the permission.</description>
<param name="moduleType" type="Common.ModuleType" mandatory="true">
<description>The module type that the app requests to control.</description>
</param>
+ <param name="moduleIds" type="String" maxlength="100" array="true" mandatory="false">
+ <description>Ids of a module, published by System Capability. </description>
+ </param>
<param name="appID" type="Integer" mandatory="true">
<description>ID of the application that triggers the permission prompt.</description>
</param>
</function>
<function name="GetInteriorVehicleDataConsent" messagetype="response">
- <param name="allowed" type="Boolean" mandatory="true">
- <description>"true" - if the driver grants the permission for controlling to the named app;
- "false" - in case the driver denies the permission for controlling to the named app.</description>
+ <param name="allowed" type="Boolean" array="true" mandatory="true">
+ <description>This array has the same size as "moduleIds" in the request; each element corresponding to one moduleId
+ "true" - if the driver grants the permission for controlling the named app;
+ "false" - in case the driver denies the permission for controlling the named app.</description>
</param>
</function>
@@ -5193,5 +6936,154 @@
<description>The remote control access mode specified by the driver via HMI.</description>
</param>
</function>
+
+<function name="OnRCStatus" messagetype="notification">
+ <description>Issued by SDL to notify HMI about remote control status change on SDL</description>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of selected application.</description>
+ </param>
+ <param name="allocatedModules" type="Common.ModuleData" minsize="0" maxsize="100" array="true" mandatory="true">
+ <description>Contains a list (zero or more) of module types that are allocated to the application.</description>
+ </param>
+ <param name="freeModules" type="Common.ModuleData" minsize="0" maxsize="100" array="true" mandatory="true">
+ <description>Contains a list (zero or more) of module types that are free to access for the application.</description>
+ </param>
+</function>
+
+</interface>
+
+<interface name="AppService" version="1.0.0" date="2019-03-18">
+ <description>Interface used for interacting with app services as a producer or consumer</description>
+ <function name="PublishAppService" messagetype="request">
+ <description>
+ Registers a service offered by this app on the module.
+ Subsequent calls with the same service type will update the manifest for that service.
+ </description>
+
+ <param name="appServiceManifest" type="Common.AppServiceManifest" mandatory="true">
+ <description> The manifest of the service that wishes to be published.</description>
+ </param>
+ </function>
+
+ <function name="PublishAppService" messagetype="response">
+ <description>Response to the request to register a service offered by this app on the module</description>
+
+ <param name="appServiceRecord" type="Common.AppServiceRecord" mandatory="false">
+ <description> If the request was successful, this object will be the current status of the service record for the published service. This will include the Core supplied service ID.</description>
+ </param>
+ </function>
+
+ <function name="UnpublishAppService" messagetype="request">
+ <description>Unpublish an existing service published by the HMI.</description>
+
+ <param name="serviceID" type="String" mandatory="true">
+ <description> The ID of the service to be unpublished. </description>
+ </param>
+ </function>
+
+ <function name="UnpublishAppService" messagetype="response">
+ <description>The response to UnpublishAppService</description>
+ </function>
+
+ <function name="OnAppServiceData" messagetype="notification">
+ <description>This notification includes the data that is updated from the specific service. HMI->SDL if the HMI is a producer, SDL->HMI if the HMI is a consumer</description>
+
+ <param name="serviceData" type="Common.AppServiceData" mandatory="true"/>
+ </function>
+
+ <function name="GetAppServiceData" messagetype="request">
+ <description> This request asks the module for current data related to the specific service. It also includes an option to subscribe to that service for future updates</description>
+
+ <param name="serviceType" type="String" mandatory="true">
+ <description>The type of service that is to be offered by this app. See AppServiceType for known enum equivalent types. Parameter is a string to allow for new service types to be used by apps on older versions of SDL Core.</description>
+ </param>
+
+ <param name="subscribe" type="Boolean" mandatory="false">
+ <description> If true, the consumer is requesting to subscribe to all future updates from the service publisher. If false, the consumer doesn't wish to subscribe and should be unsubscribed if it was previously subscribed.</description>
+ </param>
+ </function>
+
+ <function name="GetAppServiceData" messagetype="response">
+ <description> This response includes the data that was requested from the specific service</description>
+ <param name="serviceData" type="Common.AppServiceData" mandatory="false"/>
+ </function>
+
+ <function name="PerformAppServiceInteraction" messagetype="request">
+ <param name="serviceUri" type="String" mandatory="true">
+ <description>Fully qualified URI based on a predetermined scheme provided by the app service. SDL makes no guarantee that this URI is correct.</description>
+ </param>
+
+ <param name="serviceID" type="String" mandatory="true">
+ <description>The service ID that the app consumer wishes to send this URI.</description>
+ </param>
+
+ <param name="originApp" type="String" mandatory="false">
+ <description>This string is the appID of the app requesting the app service provider take the specific action. This will automatically be set by SDL Core in requests originating from the HMI</description>
+ </param>
+
+ <param name="requestServiceActive" type="Boolean" mandatory="false">
+ <description>This flag signals the requesting consumer would like this service to become the active primary service of the destination's type.</description>
+ </param>
+ </function>
+
+ <function name="PerformAppServiceInteraction" messagetype="response">
+ <param name="serviceSpecificResult" type="String" mandatory="false">
+ <description>The service can provide specific result strings to the consumer through this param.</description>
+ </param>
+ </function>
+
+ <function name="GetAppServiceRecords" messagetype="request">
+ <param name="serviceType" type="String" mandatory="false">
+ <description>If included, only service records of supplied type will be returned in response. If not included, all service records for all types will be returned. See Common.AppServiceType.</description>
+ </param>
+ </function>
+
+ <function name="GetAppServiceRecords" messagetype="response">
+ <param name="serviceRecords" type="Common.AppServiceRecord" array="true" mandatory="false">
+ <description>All app service records of requested type.</description>
+ </param>
+ </function>
+
+ <function name="AppServiceActivation" messagetype="request">
+ <param name="serviceID" type="String" mandatory="true">
+ <description>The ID of the service that should have an activation event take place on</description>
+ </param>
+ <param name="activate" type="Boolean" mandatory="true">
+ <description>True if the service is to be activated. False if the app is to be deactivated</description>
+ </param>
+ <param name="setAsDefault" type="Boolean" mandatory="false">
+ <description>True if the service is to be the default service of this type. False if the app is not to be the default</description>
+ </param>
+ </function>
+
+ <function name="AppServiceActivation" messagetype="response">
+ <param name="serviceID" type="String" mandatory="true">
+ <description>The ID of the service that was requested to have an activation event take place</description>
+ </param>
+ <param name="activate" type="Boolean" mandatory="true">
+ <description>True if the service was activated. False if the app was deactivated or unable to be activated</description>
+ </param>
+ <param name="setAsDefault" type="Boolean" mandatory="false">
+ <description>True if the service was set to the default service of this type. False if the app was not to be the default</description>
+ </param>
+ </function>
+
+ <function name="GetActiveServiceConsent" messagetype="request">
+ <description>
+ SDL->HMI. HMI is expected to prompt the user for permission for the app service to take over as the active service.
+ </description>
+ <param name="serviceID" type="String" mandatory="true">
+ <description>The ID of the service to be activated</description>
+ </param>
+ </function>
+
+ <function name="GetActiveServiceConsent" messagetype="response">
+ <param name="activate" type="Boolean" mandatory="true">
+ <description>
+ "true" - If the driver grants permission for the app service to take over as the active service.
+ "false" - If the driver denies permission for the app service to take over as the active service.
+ </description>
+ </param>
+ </function>
</interface>
</interfaces>
diff --git a/src/components/interfaces/HMI_API.xsd b/src/components/interfaces/HMI_API.xsd
new file mode 100644
index 0000000000..7324995dbf
--- /dev/null
+++ b/src/components/interfaces/HMI_API.xsd
@@ -0,0 +1,125 @@
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="interfaces" type="interfacesType">
+ <xs:annotation>
+ <xs:documentation>* Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:complexType name="elementType" mixed="true">
+ <xs:sequence>
+ <xs:element type="xs:string" name="description" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:short" name="value" use="optional"/>
+ <xs:attribute type="xs:string" name="internal_name" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="enumType" mixed="true">
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element type="xs:string" name="description"/>
+ <xs:element type="elementType" name="element">
+ <xs:annotation>
+ <xs:documentation>Climate Buttons Radio Buttons Navigation Subscription Buttons TO DO to be removed Common Single Light 0~500 Exterior Lights by common function groups 501~800 Interior Lights by common function groups 801~900 Lights by location 901~1000</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="paramType" name="param"/>
+ </xs:choice>
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:string" name="scope" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="paramType" mixed="true">
+ <xs:sequence>
+ <xs:element type="xs:string" name="description" maxOccurs="unbounded" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:short" name="minvalue" use="optional"/>
+ <xs:attribute type="xs:float" name="maxvalue" use="optional"/>
+ <xs:attribute type="xs:string" name="type" use="optional"/>
+ <xs:attribute type="xs:string" name="mandatory" use="optional"/>
+ <xs:attribute type="xs:string" name="defvalue" use="optional"/>
+ <xs:attribute type="xs:int" name="maxlength" use="optional"/>
+ <xs:attribute type="xs:string" name="array" use="optional"/>
+ <xs:attribute type="xs:byte" name="minsize" use="optional"/>
+ <xs:attribute type="xs:int" name="maxsize" use="optional"/>
+ <xs:attribute type="xs:byte" name="minlength" use="optional"/>
+ <xs:attribute type="xs:string" name="scope" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="structType" mixed="true">
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element type="xs:string" name="description" minOccurs="0"/>
+ <xs:element type="paramType" name="param"/>
+ <xs:element type="elementType" name="element">
+ <xs:annotation>
+ <xs:documentation>Climate Buttons Radio Buttons Navigation Subscription Buttons TO DO to be removed Common Single Light 0~500 Exterior Lights by common function groups 501~800 Interior Lights by common function groups 801~900 Lights by location 901~1000</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:choice>
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:string" name="scope" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="interfaceType">
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element type="enumType" name="enum"/>
+ <xs:element type="structType" name="struct"/>
+ <xs:element type="functionType" name="function">
+ <xs:annotation>
+ <xs:documentation>Policies SyncP RPC End of SyncP RPC Policies End of Policies / Ford Specific Data Items / Ford Specific Data Items / Ford Specific Data Items / Ford Specific Data Items / Ford Specific Data Items / Ford Specific Data Items / Ford Specific Data Items SyncP RPC End of SyncP RPC</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element type="xs:string" name="description"/>
+ </xs:choice>
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:string" name="version" use="optional"/>
+ <xs:attribute type="xs:date" name="date" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="functionType" mixed="true">
+ <xs:sequence>
+ <xs:element type="xs:string" name="description" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="paramType" name="param" maxOccurs="unbounded" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Ford Specific Data Items Ford Specific Data Items Ford Specific Data Items Ford Specific Data Items Ford Specific Data Items Ford Specific Data Items Ford Specific Data Items</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:string" name="messagetype" use="optional"/>
+ <xs:attribute type="xs:string" name="functionID" use="optional"/>
+ <xs:attribute type="xs:string" name="scope" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="interfacesType">
+ <xs:sequence>
+ <xs:element type="interfaceType" name="interface" maxOccurs="unbounded" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Policies</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name"/>
+ </xs:complexType>
+</xs:schema> \ No newline at end of file
diff --git a/src/components/interfaces/Json_HMI_message_specification.txt b/src/components/interfaces/Json_HMI_message_specification.txt
index 9f5b20a3c4..f464f42351 100644
--- a/src/components/interfaces/Json_HMI_message_specification.txt
+++ b/src/components/interfaces/Json_HMI_message_specification.txt
@@ -267,6 +267,13 @@ Notifications:
{
"longPressAvailable" : true,
+ "name" : "PLAY_PAUSE",
+ "shortPressAvailable" : true,
+ "upDownAvailable" : true
+ },
+
+ {
+ "longPressAvailable" : true,
"name" : "SEEKLEFT",
"shortPressAvailable" : true,
"upDownAvailable" : true
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
deleted file mode 100644
index 4e4b096c1d..0000000000
--- a/src/components/interfaces/MOBILE_API.xml
+++ /dev/null
@@ -1,6270 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<?xml-stylesheet type="text/xml" href="protocol2html.xsl"?>
-
-<interface name="SmartDeviceLink RAPI" version="4.5.0" date="2017-09-22">
- <enum name="Result" internal_scope="base">
- <element name="SUCCESS">
- <description>The request succeeded</description>
- </element>
- <element name="UNSUPPORTED_REQUEST">
- <description>The request is not supported by the headunit</description>
- </element>
- <element name="UNSUPPORTED_RESOURCE">
- <description>
- A button that was requested for subscription is not supported under the current system.
- </description>
- </element>
- <element name="DISALLOWED">
- <description>RPC is not authorized in local policy table.</description>
- </element>
- <element name="REJECTED">
- <description>
- The requested command was rejected, e.g. because mobile app is in background and cannot perform any HMI commands.
- Or an HMI command (e.g. Speak) is rejected because a higher priority HMI command (e.g. Alert) is playing.
- </description>
- </element>
- <element name="ABORTED">
- <description>
- A command was aborted, for example due to user interaction (e.g. user pressed button).
- Or an HMI command (e.g. Speak) is aborted because a higher priority HMI command (e.g. Alert) was requested.
- </description>
- </element>
- <element name="IGNORED">
- <description>
- A command was ignored, because the intended result is already in effect.
- For example, SetMediaClockTimer was used to pause the media clock although the clock is paused already.
- NOTE: potentially replaces SUBSCRIBED_ALREADY
- </description>
- </element>
- <element name="RETRY">
- <description>The user interrupted the RPC (e.g. PerformAudioPassThru) and indicated to start over. Note, the app must issue the new RPC.</description>
- </element>
- <element name="IN_USE">
- <description>
- The data may not be changed, because it is currently in use.
- For example when trying to delete a command set that is currently involved in an interaction.
- </description>
- </element>
- <element name="VEHICLE_DATA_NOT_AVAILABLE">
- <description>The requested vehicle data is not available on this vehicle or is not published.</description>
- </element>
- <element name="TIMED_OUT">
- <description>Overlay reached the maximum timeout and closed.</description>
- </element>
- <element name="INVALID_DATA">
- <description>
- The data sent is invalid. For example:
- Invalid Json syntax
- Parameters out of bounds (number or enum range)
- Mandatory parameters not provided
- Parameter provided with wrong type
- Invalid characters
- Empty string
- </description>
- </element>
- <element name="CHAR_LIMIT_EXCEEDED"></element>
- <element name="INVALID_ID">
- <description>
- One of the provided IDs is not valid. For example
- This applies to CorrelationID, SubscriptionID, CommandID, MenuID, etc.
- </description>
- </element>
- <element name="DUPLICATE_NAME">
- <description>There was a conflict with an registered name (application or menu item) or vr command</description>
- </element>
- <element name="APPLICATION_NOT_REGISTERED">
- <description>An command can not be executed because no application has been registered with RegisterApplication.</description>
- </element>
- <element name="WRONG_LANGUAGE">
- <description>
- The requested language is currently not supported.
- Might be because of a mismatch of the currently active language on the headunit and the requested language
- </description>
- </element>
- <element name="OUT_OF_MEMORY">
- <description>The system could not process the request because the necessary memory couldn't be allocated</description>
- </element>
- <element name="TOO_MANY_PENDING_REQUESTS">
- <description>There are too many requests pending (means, that the response has not been delivered, yet).There may be a maximum of 1000 pending requests at a time.</description>
- </element>
- <element name="TOO_MANY_APPLICATIONS">
- <description>There are already too many registered applications</description>
- </element>
- <element name="APPLICATION_REGISTERED_ALREADY">
- <description>RegisterApplication has been called again, after a RegisterApplication was successful before.</description>
- </element>
- <element name="WARNINGS">
- <description>The RPC (e.g. SubscribeVehicleData) executed successfully but one or more items have a warning or failure.</description>
- </element>
- <element name="GENERIC_ERROR">
- <description>Provided data is valid but something went wrong in the lower layers.</description>
- </element>
- <element name="USER_DISALLOWED">
- <description>RPC is included in a functional group explicitly blocked by the user.</description>
- </element>
- <element name="TRUNCATED_DATA">
- <description>The RPC (e.g. ReadDID) executed successfully but the data exceeded the platform maximum threshold and thus, only part of the data is available.</description>
- </element>
- <element name="UNSUPPORTED_VERSION">
- <description>Sync doesn't support the protocol that is requested by the mobile application</description>
- </element>
- <element name="VEHICLE_DATA_NOT_ALLOWED">
- <description>The user has turned off access to vehicle data, and it is globally unavailable to mobile applications.</description>
- </element>
- <element name="FILE_NOT_FOUND">
- <description>A specified file could not be found on the headunit.</description>
- </element>
- <element name="CANCEL_ROUTE">
- <description>User selected to Cancel Route.</description>
- </element>
- <element name="SAVED">
- <description>The RPC (e.g. Slider) executed successfully and the user elected to save the current position / value.</description>
- </element>
- <element name="INVALID_CERT">
- <description>The certificate provided during authentication is invalid.</description>
- </element>
- <element name="EXPIRED_CERT">
- <description>The certificate provided during authentication is expired.</description>
- </element>
- <element name="RESUME_FAILED">
- <description>The provided hash ID does not match the hash of the current set of registered data or the core could not resume the previous data.</description>
- </element>
- <element name="DATA_NOT_AVAILABLE">
- <description>The requested information is currently not available. This is different than UNSUPPORTED_RESOURCE because it implies the data is at some point available. </description>
- </element>
- <element name="READ_ONLY">
- <description>The value being set is read only</description>
- </element>
- <element name="CORRUPTED_DATA">
- <description>The data sent failed to pass CRC check in receiver end</description>
- </element>
- </enum>
-
- <enum name="ButtonPressMode">
- <element name="LONG">
- <description>
- A button was released, after it was pressed for a long time
- Actual timing is defined by the headunit and may vary
- </description>
- </element>
- <element name="SHORT">
- <description>
- A button was released, after it was pressed for a short time
- Actual timing is defined by the headunit and may vary
- </description>
- </element>
- </enum>
-
- <enum name="ButtonEventMode">
- <element name="BUTTONUP">
- <description>A button has been released up</description>
- </element>
- <element name="BUTTONDOWN">
- <description>A button has been pressed down</description>
- </element>
- </enum>
-
- <enum name="Language">
- <element name="EN-US" internal_name="EN_US">
- <description>English - US</description>
- </element>
- <element name="ES-MX" internal_name="ES_MX">
- <description>Spanish - Mexico</description>
- </element>
- <element name="FR-CA" internal_name="FR_CA">
- <description>French - Canada</description>
- </element>
- <element name="DE-DE" internal_name="DE_DE">
- <description>German - Germany</description>
- </element>
- <element name="ES-ES" internal_name="ES_ES">
- <description>Spanish - Spain</description>
- </element>
- <element name="EN-GB" internal_name="EN_GB">
- <description>English - GB</description>
- </element>
- <element name="RU-RU" internal_name="RU_RU">
- <description>Russian - Russia</description>
- </element>
- <element name="TR-TR" internal_name="TR_TR">
- <description>Turkish - Turkey</description>
- </element>
- <element name="PL-PL" internal_name="PL_PL">
- <description>Polish - Poland</description>
- </element>
- <element name="FR-FR" internal_name="FR_FR">
- <description>French - France</description>
- </element>
- <element name="IT-IT" internal_name="IT_IT">
- <description>Italian - Italy</description>
- </element>
- <element name="SV-SE" internal_name="SV_SE">
- <description>Swedish - Sweden</description>
- </element>
- <element name="PT-PT" internal_name="PT_PT">
- <description>Portuguese - Portugal</description>
- </element>
- <element name="NL-NL" internal_name="NL_NL">
- <description>Dutch (Standard) - Netherlands</description>
- </element>
- <element name="EN-AU" internal_name="EN_AU">
- <description>English - Australia</description>
- </element>
- <element name="ZH-CN" internal_name="ZH_CN">
- <description>Mandarin - China</description>
- </element>
- <element name="ZH-TW" internal_name="ZH_TW">
- <description>Mandarin - Taiwan</description>
- </element>
- <element name="JA-JP" internal_name="JA_JP">
- <description>Japanese - Japan</description>
- </element>
- <element name="AR-SA" internal_name="AR_SA">
- <description>Arabic - Saudi Arabia</description>
- </element>
- <element name="KO-KR" internal_name="KO_KR">
- <description>Korean - South Korea</description>
- </element>
- <element name="PT-BR" internal_name="PT_BR">
- <description>Portuguese - Brazil</description>
- </element>
- <element name="CS-CZ" internal_name="CS_CZ">
- <description>Czech - Czech Republic</description>
- </element>
- <element name="DA-DK" internal_name="DA_DK">
- <description>Danish - Denmark</description>
- </element>
- <element name="NO-NO" internal_name="NO_NO">
- <description>Norwegian - Norway</description>
- </element>
- <element name="NL-BE" internal_name="NL_BE">
- <description>Dutch (Flemish) - Belgium</description>
- </element>
- <element name="EL-GR" internal_name="EL_GR">
- <description>Greek - Greece</description>
- </element>
- <element name="HU-HU" internal_name="HU_HU">
- <description>Hungarian - Hungary</description>
- </element>
- <element name="FI-FI" internal_name="FI_FI">
- <description>Finnish - Finland</description>
- </element>
- <element name="SK-SK" internal_name="SK_SK">
- <description>Slovak - Slovakia</description>
- </element>
- <element name="EN-IN" internal_name="EN_IN">
- <description>English - India</description>
- </element>
- <element name="TH-TH" internal_name="TH_TH">
- <description>Thai - Thailand</description>
- </element>
- <element name="EN-SA" internal_name="EN_SA">
- <description>English - Middle East</description>
- </element>
- <element name="HE-IL" internal_name="HE_IL">
- <description>Hebrew - Israel</description>
- </element>
- <element name="RO-RO" internal_name="RO_RO">
- <description>Romanian - Romania</description>
- </element>
- <element name="UK-UA" internal_name="UK_UA">
- <description>Ukrainian - Ukraine</description>
- </element>
- <element name="ID-ID" internal_name="ID_ID">
- <description>Indonesian - Indonesia</description>
- </element>
- <element name="VI-VN" internal_name="VI_VN">
- <description>Vietnamese - Vietnam</description>
- </element>
- <element name="MS-MY" internal_name="MS_MY">
- <description>Malay - Malaysia</description>
- </element>
- <element name="HI-IN" internal_name="HI_IN">
- <description>Hindi - India</description>
- </element>
- </enum>
-
- <enum name="UpdateMode">
- <description>Describes how the media clock timer should behave on the platform</description>
- <element name="COUNTUP" >
- <description>Starts the media clock timer counting upwards, as in time elapsed.</description>
- </element>
- <element name="COUNTDOWN" >
- <description>Starts the media clock timer counting downwards, as in time remaining.</description>
- </element>
- <element name="PAUSE" >
- <description>Pauses the media clock timer</description>
- </element>
- <element name="RESUME" >
- <description>Resume the media clock timer</description>
- </element>
- <element name="CLEAR" >
- <description>Clears the media clock timer (previously done through Show->mediaClock)</description>
- </element>
- </enum>
-
- <enum name="TimerMode">
- <element name="UP" >
- <description>Causes the media clock timer to update from 0:00 to a specified time</description>
- </element>
- <element name="DOWN" >
- <description>Causes the media clock timer to update from a specified time to 0:00</description>
- </element>
- <element name="NONE" >
- <description>Indicates to not use the media clock timer</description>
- </element>
- </enum>
-
- <enum name="InteractionMode">
- <description>For application-requested interactions, this mode indicates the method in which the user is notified and uses the interaction.</description>
- <element name="MANUAL_ONLY" >
- <description>This mode causes the interaction to only occur on the display, meaning the choices are provided only via the display. No Voice Interaction.</description>
- </element>
- <element name="VR_ONLY" >
- <description>This mode causes the interaction to only occur using the headunits VR system. Selections are made by saying the command.</description>
- </element>
- <element name="BOTH" >
- <description>This mode causes both a VR and display selection option for an interaction. The user will first be asked via Voice Interaction (if available). If this is unsuccessful, the system will switch to manual input.</description>
- </element>
- </enum>
-
- <enum name="LayoutMode">
- <description>For touchscreen interactions, the mode of how the choices are presented.</description>
- <element name="ICON_ONLY" >
- <description>This mode causes the interaction to display the previous set of choices as icons.</description>
- </element>
- <element name="ICON_WITH_SEARCH" >
- <description>This mode causes the interaction to display the previous set of choices as icons along with a search field in the HMI.</description>
- </element>
- <element name="LIST_ONLY" >
- <description>This mode causes the interaction to display the previous set of choices as a list.</description>
- </element>
- <element name="LIST_WITH_SEARCH" >
- <description>This mode causes the interaction to display the previous set of choices as a list along with a search field in the HMI.</description>
- </element>
- <element name="KEYBOARD" >
- <description>This mode causes the interaction to immediately display a keyboard entry through the HMI.</description>
- </element>
- </enum>
-
- <enum name="HMILevel">
- <description>Enumeration that describes current levels of HMI.</description>
- <element name="FULL" internal_name="HMI_FULL" />
- <element name="LIMITED" internal_name="HMI_LIMITED" />
- <element name="BACKGROUND" internal_name="HMI_BACKGROUND" />
- <element name="NONE" internal_name="HMI_NONE" />
- </enum>
-
- <enum name="AudioStreamingState">
- <description>Enumeration that describes possible states of audio streaming.</description>
- <element name="AUDIBLE" />
- <element name="ATTENUATED" />
- <element name="NOT_AUDIBLE" />
- </enum>
-
- <enum name="VideoStreamingState">
- <description>Enumeration that describes possible states of video streaming. </description>
- <element name="STREAMABLE" />
- <element name="NOT_STREAMABLE" />
- </enum>
-
- <enum name="SystemAction">
- <description>Enumeration that describes system actions that can be triggered.</description>
- <element name="DEFAULT_ACTION">
- <description>Default action occurs. Standard behavior (e.g. SoftButton clears overlay).</description>
- </element>
- <element name="STEAL_FOCUS">
- <description>App is brought into HMI_FULL.</description>
- </element>
- <element name="KEEP_CONTEXT">
- <description>Current system context is maintained. An overlay is persisted even though a SoftButton has been pressed and the notification sent.</description>
- </element>
- </enum>
-
- <enum name="SystemContext">
- <description>Enumeration that describes possible contexts an app's HMI might be in. Communicated to whichever app is in HMI FULL, except Alert.</description>
- <element name="MAIN" internal_name="SYSCTXT_MAIN">
- <description>The app's persistent display (whether media/non-media/navigation) is fully visible onscreen.</description>
- </element>
- <element name="VRSESSION" internal_name="SYSCTXT_VRSESSION">
- <description>The system is currently in a VR session (with whatever dedicated VR screen being overlaid onscreen).</description>
- </element>
- <element name="MENU" internal_name="SYSCTXT_MENU">
- <description>The system is currently displaying an in-App menu onscreen.</description>
- </element>
- <element name="HMI_OBSCURED" internal_name="SYSCTXT_HMI_OBSCURED">
- <description>The app's display HMI is currently being obscured by either a system or other app's overlay.</description>
- </element>
- <element name="ALERT" internal_name="SYSCTXT_ALERT">
- <description>Broadcast only to whichever app has an alert currently being displayed.</description>
- </element>
- </enum>
-
- <enum name="SoftButtonType">
- <description>Contains information about the SoftButton capabilities.</description>
- <element name="TEXT" internal_name="SBT_TEXT"/>
- <element name="IMAGE" internal_name="SBT_IMAGE"/>
- <element name="BOTH" internal_name="SBT_BOTH"/>
- </enum>
-
- <enum name="AppInterfaceUnregisteredReason">
- <description>Error code, which comes from the module side.</description>
- <!-- Deprecate
- <element name="USER_EXIT" />
- -->
- <element name="IGNITION_OFF" />
- <element name="BLUETOOTH_OFF" />
- <element name="USB_DISCONNECTED" />
- <element name="REQUEST_WHILE_IN_NONE_HMI_LEVEL" />
- <element name="TOO_MANY_REQUESTS" />
- <element name="DRIVER_DISTRACTION_VIOLATION" />
- <element name="LANGUAGE_CHANGE" />
- <element name="MASTER_RESET" />
- <element name="FACTORY_DEFAULTS" />
- <element name="APP_UNAUTHORIZED" />
- <element name="PROTOCOL_VIOLATION" />
- <element name="UNSUPPORTED_HMI_RESOURCE" />
- </enum>
-
- <enum name="TriggerSource">
- <description>Indicates the source from where the command was triggered.</description>
- <element name="MENU" internal_name="TS_MENU" />
- <element name="VR" internal_name="TS_VR" />
- <element name="KEYBOARD" internal_name="TS_KEYBOARD" />
- </enum>
-
- <enum name="HmiZoneCapabilities">
- <description>Contains information about the HMI zone capabilities.</description>
- <description>For future use.</description>
- <element name="FRONT" />
- <element name="BACK" />
- </enum>
-
- <enum name="SpeechCapabilities">
- <description>Contains information about the TTS capabilities.</description>
- <element name="TEXT" internal_name="SC_TEXT"/>
- <element name="SAPI_PHONEMES" />
- <element name="LHPLUS_PHONEMES" />
- <element name="PRE_RECORDED" />
- <element name="SILENCE" />
- <element name="FILE" />
- </enum>
-
- <enum name="VrCapabilities">
- <description>Contains information about the VR capabilities.</description>
- <element name="TEXT" internal_name="VR_TEXT"/>
- </enum>
-
- <enum name="PrerecordedSpeech">
- <description>Contains a list of prerecorded speech items present on the platform.</description>
- <element name="HELP_JINGLE" />
- <element name="INITIAL_JINGLE" />
- <element name="LISTEN_JINGLE" />
- <element name="POSITIVE_JINGLE" />
- <element name="NEGATIVE_JINGLE" />
- </enum>
-
- <enum name="SamplingRate">
- <description>Describes different sampling options for PerformAudioPassThru.</description>
- <element name="8KHZ" internal_name="SamplingRate_8KHZ"/>
- <element name="16KHZ" internal_name="SamplingRate_16KHZ"/>
- <element name="22KHZ" internal_name="SamplingRate_22KHZ"/>
- <element name="44KHZ" internal_name="SamplingRate_44KHZ"/>
- </enum>
-
- <enum name="BitsPerSample">
- <description>Describes different quality options for PerformAudioPassThru.</description>
- <element name="8_BIT" internal_name="BitsPerSample_8_BIT"/>
- <element name="16_BIT" internal_name="BitsPerSample_16_BIT"/>
- </enum>
-
- <enum name="AudioType">
- <description>Describes different audio type options for PerformAudioPassThru.</description>
- <element name="PCM" />
- </enum>
-
- <struct name="AudioPassThruCapabilities">
- <description>
- Describes different audio type configurations for PerformAudioPassThru.
- e.g. {8kHz,8-bit,PCM}
- </description>
- <param name="samplingRate" type="SamplingRate" mandatory="true"/>
- <param name="bitsPerSample" type="BitsPerSample" mandatory="true"/>
- <param name="audioType" type="AudioType" mandatory="true"/>
- </struct>
-
- <enum name="VehicleDataType">
- <description>Defines the data types that can be published and subscribed to.</description>
- <element name="VEHICLEDATA_GPS">
- <description>Notifies GPSData may be subscribed</description>
- </element>
- <element name="VEHICLEDATA_SPEED" />
- <element name="VEHICLEDATA_RPM" />
- <element name="VEHICLEDATA_FUELLEVEL" />
- <element name="VEHICLEDATA_FUELLEVEL_STATE" />
- <element name="VEHICLEDATA_FUELCONSUMPTION" />
- <element name="VEHICLEDATA_EXTERNTEMP" />
- <element name="VEHICLEDATA_TURNSIGNAL" />
- <element name="VEHICLEDATA_VIN" />
- <element name="VEHICLEDATA_PRNDL" />
- <element name="VEHICLEDATA_TIREPRESSURE" />
- <element name="VEHICLEDATA_ODOMETER" />
- <element name="VEHICLEDATA_BELTSTATUS" />
- <element name="VEHICLEDATA_BODYINFO" />
- <element name="VEHICLEDATA_DEVICESTATUS" />
- <element name="VEHICLEDATA_ECALLINFO" />
- <element name="VEHICLEDATA_AIRBAGSTATUS" />
- <element name="VEHICLEDATA_EMERGENCYEVENT" />
- <element name="VEHICLEDATA_CLUSTERMODESTATUS" />
- <element name="VEHICLEDATA_MYKEY" />
- <element name="VEHICLEDATA_BRAKING" />
- <element name="VEHICLEDATA_WIPERSTATUS" />
- <element name="VEHICLEDATA_HEADLAMPSTATUS" />
- <element name="VEHICLEDATA_BATTVOLTAGE" />
- <element name="VEHICLEDATA_ENGINETORQUE" />
- <element name="VEHICLEDATA_ACCPEDAL" />
- <element name="VEHICLEDATA_STEERINGWHEEL" />
- <element name="VEHICLEDATA_FUELRANGE" />
- <element name="VEHICLEDATA_ENGINEOILLIFE" />
- </enum>
-
- <enum name="ButtonName">
- <description>Defines the hard (physical) and soft (touchscreen) buttons available from the module</description>
- <element name="OK" />
- <element name="SEEKLEFT" />
- <element name="SEEKRIGHT" />
- <element name="TUNEUP" />
- <element name="TUNEDOWN" />
- <element name="PRESET_0" />
- <element name="PRESET_1" />
- <element name="PRESET_2" />
- <element name="PRESET_3" />
- <element name="PRESET_4" />
- <element name="PRESET_5" />
- <element name="PRESET_6" />
- <element name="PRESET_7" />
- <element name="PRESET_8" />
- <element name="PRESET_9" />
- <element name="CUSTOM_BUTTON" />
- <element name="SEARCH" />
- <!-- Climate Buttons -->
- <element name="AC_MAX" />
- <element name="AC" />
- <element name="RECIRCULATE" />
- <element name="FAN_UP" />
- <element name="FAN_DOWN" />
- <element name="TEMP_UP" />
- <element name="TEMP_DOWN" />
- <element name="DEFROST_MAX" />
- <element name="DEFROST" />
- <element name="DEFROST_REAR" />
- <element name="UPPER_VENT" />
- <element name="LOWER_VENT" />
- <!-- Radio Buttons -->
- <element name="VOLUME_UP" />
- <element name="VOLUME_DOWN" />
- <element name="EJECT" />
- <element name="SOURCE" />
- <element name="SHUFFLE" />
- <element name="REPEAT" />
- </enum>
-
- <enum name="MediaClockFormat">
- <element name="CLOCK1">
- <description>
- minutesFieldWidth = 2;minutesFieldMax = 19;secondsFieldWidth = 2;secondsFieldMax = 99;maxHours = 19;maxMinutes = 59;maxSeconds = 59;
- used for Type II and CID headunits
- </description>
- </element>
- <element name="CLOCK2">
- <description>
- minutesFieldWidth = 3;minutesFieldMax = 199;secondsFieldWidth = 2;secondsFieldMax = 99;maxHours = 59;maxMinutes = 59;maxSeconds = 59;
- used for Type V headunit
- </description>
- </element>
- <element name="CLOCK3">
- <description>
- minutesFieldWidth = 2;minutesFieldMax = 59;secondsFieldWidth = 2;secondsFieldMax = 59;maxHours = 9;maxMinutes = 59;maxSeconds = 59;
- used for GEN1.1 MFD3/4/5 headunits
- </description>
- </element>
- <element name="CLOCKTEXT1">
- <description>
- 5 characters possible
- Format: 1|sp c :|sp c c
- 1|sp : digit "1" or space
- c : character out of following character set: sp|0-9|[letters, see TypeII column in XLS. See [@TODO: create file ref]]
- :|sp : colon or space
- used for Type II headunit
- </description>
- </element>
- <element name="CLOCKTEXT2">
- <description>
- 5 chars possible
- Format: 1|sp c :|sp c c
- 1|sp : digit "1" or space
- c : character out of following character set: sp|0-9|[letters, see CID column in XLS. See [@TODO: create file ref]]
- :|sp : colon or space
- used for CID headunit
- NOTE: difference between CLOCKTEXT1 and CLOCKTEXT2 is the supported character set
- </description>
- </element>
- <element name="CLOCKTEXT3">
- <description>
- 6 chars possible
- Format: 1|sp c c :|sp c c
- 1|sp : digit "1" or space
- c : character out of following character set: sp|0-9|[letters, see Type 5 column in XLS]. See [@TODO: create file ref]
- :|sp : colon or space
- used for Type V headunit
- </description>
- </element>
- <element name="CLOCKTEXT4">
- <description>
- 6 chars possible
- Format: c :|sp c c : c c
- :|sp : colon or space
- c : character out of following character set: sp|0-9|[letters].
- used for GEN1.1 MFD3/4/5 headunits
- </description>
- </element>
- </enum>
-
- <enum name="DisplayType">
- <description>See DAES for further infos regarding the displays</description>
- <element name="CID"/>
- <element name="TYPE2" />
- <element name="TYPE5" />
- <element name="NGN" />
- <element name="GEN2_8_DMA" />
- <element name="GEN2_6_DMA" />
- <element name="MFD3" />
- <element name="MFD4" />
- <element name="MFD5" />
- <element name="GEN3_8-INCH" internal_name="GEN3_8_INCH" />
- <element name="SDL_GENERIC" />
- </enum>
-
- <enum name="TextFieldName">
- <element name="mainField1">
- <description>The first line of first set of main fields of the persistent display; applies to "Show"</description>
- </element>
-
- <element name="mainField2">
- <description>The second line of first set of main fields of the persistent display; applies to "Show"</description>
- </element>
-
- <element name="mainField3">
- <description>The first line of second set of main fields of persistent display; applies to "Show"</description>
- </element>
-
- <element name="mainField4">
- <description>The second line of second set of main fields of the persistent display; applies to "Show"</description>
- </element>
-
- <element name="statusBar">
- <description>The status bar on NGN; applies to "Show"</description>
- </element>
-
- <element name="mediaClock">
- <description>Text value for MediaClock field; applies to "Show"</description>
- </element>
-
- <element name="mediaTrack">
- <description>The track field of NGN and GEN1.1 MFD displays. This field is only available for media applications; applies to "Show"</description>
- </element>
-
- <element name="alertText1">
- <description>The first line of the alert text field; applies to "Alert"</description>
- </element>
-
- <element name="alertText2">
- <description>The second line of the alert text field; applies to "Alert"</description>
- </element>
-
- <element name="alertText3">
- <description>The third line of the alert text field; applies to "Alert"</description>
- </element>
-
- <element name="scrollableMessageBody">
- <description>Long form body of text that can include newlines and tabs; applies to "ScrollableMessage"</description>
- </element>
-
- <element name="initialInteractionText">
- <description> First line suggestion for a user response (in the case of VR enabled interaction)</description>
- </element>
-
- <element name="navigationText1">
- <description> First line of navigation text</description>
- </element>
-
- <element name="navigationText2">
- <description> Second line of navigation text</description>
- </element>
-
- <element name="ETA">
- <description> Estimated Time of Arrival time for navigation</description>
- </element>
-
- <element name="totalDistance">
- <description> Total distance to destination for navigation</description>
- </element>
-
- <element name="audioPassThruDisplayText1">
- <description> First line of text for audio pass thru</description>
- </element>
-
- <element name="audioPassThruDisplayText2">
- <description> Second line of text for audio pass thru</description>
- </element>
-
- <element name="sliderHeader">
- <description> Header text for slider</description>
- </element>
-
- <element name="sliderFooter">
- <description> Footer text for slider</description>
- </element>
-
- <element name="menuName">
- <description> Primary text for Choice</description>
- </element>
-
- <element name="secondaryText">
- <description> Secondary text for Choice</description>
- </element>
-
- <element name="tertiaryText">
- <description> Tertiary text for Choice</description>
- </element>
-
- <element name="menuTitle">
- <description> Optional text to label an app menu button (for certain touchscreen platforms).</description>
- </element>
-
- <element name="locationName">
- <description> Optional name / title of intended location for SendLocation.</description>
- </element>
-
- <element name="locationDescription">
- <description> Optional description of intended location / establishment (if applicable) for SendLocation.</description>
- </element>
-
- <element name="addressLines">
- <description> Optional location address (if applicable) for SendLocation.</description>
- </element>
-
- <element name="phoneNumber">
- <description> Optional hone number of intended location / establishment (if applicable) for SendLocation.</description>
- </element>
-
- </enum>
-
- <enum name="ImageFieldName">
- <element name="softButtonImage">
- <description>The image field for SoftButton</description>
- </element>
-
- <element name="choiceImage">
- <description>The first image field for Choice</description>
- </element>
-
- <element name="choiceSecondaryImage">
- <description>The secondary image field for Choice</description>
- </element>
-
- <element name="vrHelpItem">
- <description>The image field for vrHelpItem</description>
- </element>
-
- <element name="turnIcon">
- <description>The image field for Turn</description>
- </element>
-
- <element name="menuIcon">
- <description>The image field for the menu icon in SetGlobalProperties</description>
- </element>
-
- <element name="cmdIcon">
- <description>The image field for AddCommand</description>
- </element>
-
- <element name="appIcon">
- <description>The image field for the app icon (set by setAppIcon)</description>
- </element>
-
- <element name="graphic">
- <description>The primary image field for Show</description>
- </element>
-
- <element name="secondaryGraphic">
- <description>The secondary image field for Show</description>
- </element>
-
- <element name="showConstantTBTIcon">
- <description>The primary image field for ShowConstantTBT</description>
- </element>
-
- <element name="showConstantTBTNextTurnIcon">
- <description>The secondary image field for ShowConstantTBT</description>
- </element>
-
- <element name="locationImage">
- <description>The optional image of a destination / location</description>
- </element>
-
- </enum>
-
- <enum name="CharacterSet">
- <description>The list of potential character sets</description>
- <element name="TYPE2SET">
- <description>See [@TODO: create file ref]</description>
- </element>
- <element name="TYPE5SET">
- <description>See [@TODO: create file ref]</description>
- </element>
- <element name="CID1SET">
- <description>See [@TODO: create file ref]</description>
- </element>
- <element name="CID2SET">
- <description>See [@TODO: create file ref]</description>
- </element>
- </enum>
-
- <enum name="TextAlignment">
- <description>The list of possible alignments, left, right, or centered</description>
- <element name="LEFT_ALIGNED" />
- <element name="RIGHT_ALIGNED" />
- <element name="CENTERED" />
- </enum>
-
- <enum name="TBTState">
- <description>Enumeration that describes possible states of turn-by-turn client or AppLink app.</description>
- <element name="ROUTE_UPDATE_REQUEST" />
- <element name="ROUTE_ACCEPTED" />
- <element name="ROUTE_REFUSED" />
- <element name="ROUTE_CANCELLED" />
- <element name="ETA_REQUEST" />
- <element name="NEXT_TURN_REQUEST" />
- <element name="ROUTE_STATUS_REQUEST" />
- <element name="ROUTE_SUMMARY_REQUEST" />
- <element name="TRIP_STATUS_REQUEST" />
- <element name="ROUTE_UPDATE_REQUEST_TIMEOUT" />
- </enum>
-
- <enum name="DriverDistractionState">
- <description>Enumeration that describes possible states of driver distraction.</description>
- <element name="DD_ON" />
- <element name="DD_OFF" />
- </enum>
-
- <enum name="ImageType">
- <description>Contains information about the type of image.</description>
- <element name="STATIC" />
- <element name="DYNAMIC" />
- </enum>
-
- <enum name="DeliveryMode">
- <description>The mode in which the SendLocation request is sent</description>
- <element name="PROMPT" />
- <element name="DESTINATION" />
- <element name="QUEUE" />
- </enum>
-
- <enum name="VideoStreamingProtocol">
- <description>Enum for each type of video streaming protocol type.</description>
- <element name="RAW">
- <description>Raw stream bytes that contains no timestamp data and is the lowest supported video streaming</description>
- </element>
- <element name="RTP">
- <description>RTP facilitates the transfer of real-time data. Information provided by this protocol include timestamps (for synchronization), sequence numbers (for packet loss and reordering detection) and the payload format which indicates the encoded format of the data.</description>
- </element>
- <element name="RTSP">
- <description>The transmission of streaming data itself is not a task of RTSP. Most RTSP servers use the Real-time Transport Protocol (RTP) in conjunction with Real-time Control Protocol (RTCP) for media stream delivery. However, some vendors implement proprietary transport protocols. </description>
- </element>
- <element name="RTMP">
- <description> Real-Time Messaging Protocol (RTMP) was initially a proprietary protocol developed by Macromedia for streaming audio, video and data over the Internet, between a Flash player and a server. Macromedia is now owned by Adobe, which has released an incomplete version of the specification of the protocol for public use.</description>
- </element>
- <element name="WEBM">
- <description>The WebM container is based on a profile of Matroska. WebM initially supported VP8 video and Vorbis audio streams. In 2013 it was updated to accommodate VP9 video and Opus audio.</description>
- </element>
- </enum>
-
- <enum name="VideoStreamingCodec">
- <description>Enum for each type of video streaming codec.</description>
- <element name="H264">
- <description>A block-oriented motion-compensation-based video compression standard. As of 2014 it is one of the most commonly used formats for the recording, compression, and distribution of video content.</description>
- </element>
- <element name="H265">
- <description>High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2, is a video compression standard, one of several potential successors to the widely used AVC (H.264 or MPEG-4 Part 10). In comparison to AVC, HEVC offers about double the data compression ratio at the same level of video quality, or substantially improved video quality at the same bit rate. It supports resolutions up to 8192x4320, including 8K UHD.</description>
- </element>
- <element name="Theora">
- <description>Theora is derived from the formerly proprietary VP3 codec, released into the public domain by On2 Technologies. It is broadly comparable in design and bitrate efficiency to MPEG-4 Part 2, early versions of Windows Media Video, and RealVideo while lacking some of the features present in some of these other codecs. It is comparable in open standards philosophy to the BBC's Dirac codec.</description>
- </element>
- <element name="VP8">
- <description>VP8 can be multiplexed into the Matroska-based container format WebM along with Vorbis and Opus audio. The image format WebP is based on VP8's intra-frame coding. VP8's direct successor, VP9, and the emerging royalty-free internet video format AV1 from the Alliance for Open Media (AOMedia) are based on VP8.</description>
- </element>
- <element name="VP9">
- <description>Similar to VP8, but VP9 is customized for video resolutions beyond high-definition video (UHD) and also enables lossless compression.</description>
- </element>
- </enum>
-
- <struct name="Image">
- <param name="value" minlength="0" maxlength="65535" type="String" mandatory="true">
- <description>Either the static hex icon value or the binary image file name identifier (sent by PutFile).</description>
- </param>
- <param name="imageType" type="ImageType" mandatory="true">
- <description>Describes, whether it is a static or dynamic image.</description>
- </param>
- <param name="isTemplate" type="Boolean" mandatory="false">
- <description>Optional value to specify whether it's a template image. A template image can be (re)colored by the HMI as needed by using an image pattern</description>
- </param>
- </struct>
-
- <struct name="SoftButton">
- <param name="type" type="SoftButtonType" mandatory="true">
- <description>Describes, whether it is text, highlighted text, icon, or dynamic image. See softButtonType</description>
- </param>
- <param name="text" minlength="0" maxlength="500" type="String" mandatory="false">
- <description>Optional text to display (if defined as TEXT or BOTH)</description>
- </param>
- <param name="image" type="Image" mandatory="false">
- <description>Optional image struct for SoftButton (if defined as IMAGE or BOTH)</description>
- </param>
- <param name="isHighlighted" type="Boolean" defvalue="false" mandatory="false">
- <description>
- True, if highlighted
- False, if not highlighted
- </description>
- </param>
- <param name="softButtonID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Value which is returned via OnButtonPress / OnButtonEvent</description>
- </param>
- <param name="systemAction" type="SystemAction" defvalue="DEFAULT_ACTION" mandatory="false">
- <description>Parameter indicating whether selecting a SoftButton shall call a specific system action. This is intended to allow Notifications to bring the callee into full / focus; or in the case of persistent overlays, the overlay can persist when a SoftButton is pressed.</description>
- </param>
- </struct>
-
- <struct name="Choice">
- <description>A choice is an option given to the user, which can be selected either by menu, or through voice recognition system.</description>
- <param name="choiceID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true"/>
- <param name="menuName" type="String" maxlength="500" mandatory="true"/>
- <param name="vrCommands" type="String" minsize="1" maxsize="100" maxlength="99" array="true" mandatory="true"/>
- <param name="image" type="Image" mandatory="false"/>
- <param name="secondaryText" maxlength="500" type="String" mandatory="false">
- <description>Optional secondary text to display; e.g. address of POI in a search result entry</description>
- </param>
- <param name="tertiaryText" maxlength="500" type="String" mandatory="false">
- <description>Optional tertiary text to display; e.g. distance to POI for a search result entry</description>
- </param>
- <param name="secondaryImage" type="Image" mandatory="false">
- <description>Optional secondary image struct for choice</description>
- </param>
- </struct>
-
- <struct name="VrHelpItem">
- <param name="text" maxlength="500" type="String" mandatory="true">
- <description>Text to display for VR Help item</description>
- </param>
- <param name="image" type="Image" mandatory="false">
- <description>Image struct for VR Help item</description>
- </param>
- <param name="position" type="Integer" minvalue="1" maxvalue="100" mandatory="true">
- <description>Position to display item in VR Help list</description>
- </param>
- </struct>
-
- <struct name="SyncMsgVersion">
- <description>Specifies the version number of the SmartDeviceLink protocol that is supported by the mobile application</description>
-
- <param name="majorVersion" type="Integer" minvalue="1" maxvalue="10" mandatory="true">
- <description>The major version indicates versions that is not-compatible to previous versions.</description>
- </param>
- <param name="minorVersion" type="Integer" minvalue="0" maxvalue="1000" mandatory="true">
- <description>The minor version indicates a change to a previous version that should still allow to be run on an older version (with limited functionality)</description>
- </param>
- <param name="patchVersion" type="Integer" minvalue="0" maxvalue="1000" mandatory="false">
- <description>The patch version indicates a fix to existing functionality in a previous version that should still be able to be run on an older version </description>
- </param>
- </struct>
-
- <enum name="GlobalProperty">
- <description>The different global properties.</description>
- <element name="HELPPROMPT">
- <description>The property helpPrompt of setGlobalProperties</description>
- </element>
- <element name="TIMEOUTPROMPT">
- <description>The property timeoutPrompt of setGlobalProperties</description>
- </element>
- <element name="VRHELPTITLE">
- <description>The property vrHelpTitle of setGlobalProperties</description>
- </element>
- <element name="VRHELPITEMS">
- <description>The property array of vrHelp of setGlobalProperties</description>
- </element>
- <element name="MENUNAME">
- <description>The property in-app menu name of setGlobalProperties</description>
- </element>
- <element name="MENUICON">
- <description>The property in-app menu icon of setGlobalProperties</description>
- </element>
- <element name="KEYBOARDPROPERTIES">
- <description>The on-screen keyboard configuration of setGlobalProperties</description>
- </element>
- </enum>
-
- <enum name="CompassDirection">
- <description>The list of potential compass directions</description>
- <element name="NORTH">
- </element>
- <element name="NORTHWEST">
- </element>
- <element name="WEST">
- </element>
- <element name="SOUTHWEST">
- </element>
- <element name="SOUTH">
- </element>
- <element name="SOUTHEAST">
- </element>
- <element name="EAST">
- </element>
- <element name="NORTHEAST">
- </element>
- </enum>
-
- <enum name="Dimension">
- <description>The supported dimensions of the GPS</description>
- <element name="NO_FIX" internal_name="Dimension_NO_FIX">
- <description>No GPS at all</description>
- </element>
- <element name="2D" internal_name="Dimension_2D">
- <description>Longitude and latitude</description>
- </element>
- <element name="3D" internal_name="Dimension_3D">
- <description>Longitude and latitude and altitude</description>
- </element>
- </enum>
-
- <enum name="PRNDL">
- <description>The selected gear.</description>
- <element name="PARK">
- <description>Parking</description>
- </element>
- <element name="REVERSE">
- <description>Reverse gear</description>
- </element>
- <element name="NEUTRAL">
- <description>No gear</description>
- </element>
- <element name="DRIVE">
- </element>
- <element name="SPORT">
- <description>Drive Sport mode</description>
- </element>
- <element name="LOWGEAR">
- <description>1st gear hold</description>
- </element>
- <element name="FIRST">
- </element>
- <element name="SECOND">
- </element>
- <element name="THIRD">
- </element>
- <element name="FOURTH">
- </element>
- <element name="FIFTH">
- </element>
- <element name="SIXTH">
- </element>
- <element name="SEVENTH">
- </element>
- <element name="EIGHTH">
- </element>
- <element name="UNKNOWN">
- </element>
- <element name="FAULT">
- </element>
- </enum>
-
- <enum name="ComponentVolumeStatus">
- <description>The volume status of a vehicle component.</description>
- <element name="UNKNOWN" internal_name="CVS_UNKNOWN">
- </element>
- <element name="NORMAL" internal_name="CVS_NORMAL">
- </element>
- <element name="LOW" internal_name="CVS_LOW">
- </element>
- <element name="FAULT" internal_name="CVS_FAULT">
- </element>
- <element name="ALERT" internal_name="CVS_ALERT">
- </element>
- <element name="NOT_SUPPORTED" internal_name="CVS_NOT_SUPPORTED">
- </element>
- </enum>
-
- <enum name="TPMS">
- <element name="UNKNOWN">
- <description>If set the status of the tire is not known.</description>
- </element>
- <element name="SYSTEM_FAULT">
- <description>TPMS does not function.</description>
- </element>
- <element name="SENSOR_FAULT">
- <description>The sensor of the tire does not function.</description>
- </element>
- <element name="LOW">
- <description>TPMS is reporting a low tire pressure for the tire.</description>
- </element>
- <element name="SYSTEM_ACTIVE">
- <description>TPMS is active and the tire pressure is monitored.</description>
- </element>
- <element name="TRAIN">
- <description>TPMS is reporting that the tire must be trained.</description>
- </element>
- <element name="TRAINING_COMPLETE">
- <description>TPMS reports the training for the tire is completed.</description>
- </element>
- <element name="NOT_TRAINED">
- <description>TPMS reports the tire is not trained.</description>
- </element>
- </enum>
-
- <enum name="FuelType">
- <element name="GASOLINE" />
- <element name="DIESEL" />
- <element name="CNG">
- <description>
- For vehicles using compressed natural gas.
- </description>
- </element>
- <element name="LPG">
- <description>
- For vehicles using liquefied petroleum gas.
- </description>
- </element>
- <element name="HYDROGEN">
- <description>For FCEV (fuel cell electric vehicle).</description>
- </element>
- <element name="BATTERY">
- <description>For BEV (Battery Electric Vehicle), PHEV (Plug-in Hybrid Electric Vehicle), solar vehicles and other vehicles which run on a battery.</description>
- </element>
- </enum>
-
- <struct name="FuelRange">
- <param name="type" type="FuelType" mandatory="false"/>
- <param name="range" type="Float" minvalue="0" maxvalue="10000" mandatory="false">
- <description>
- The estimate range in KM the vehicle can travel based on fuel level and consumption.
- </description>
- </param>
- </struct>
-
- <struct name="SingleTireStatus">
- <param name="status" type="ComponentVolumeStatus" mandatory="true">
- <description>See ComponentVolumeStatus.</description>
- </param>
- <param name="tpms" type="TPMS" mandatory="false">
- <description>The status of TPMS according to the particular tire.</description>
- </param>
- <param name="pressure" type="Float" mandatory="false" minvalue="0" maxvalue="2000">
- <description>The pressure value of the particular tire in kilo pascal.</description>
- </param>
- </struct>
-
- <enum name="WarningLightStatus">
- <description>Reflects the status of a cluster instrument warning light.</description>
- <element name="OFF" internal_name="WLS_OFF">
- </element>
- <element name="ON" internal_name="WLS_ON">
- </element>
- <element name="FLASH" internal_name="WLS_FLASH">
- </element>
- <element name="NOT_USED" internal_name="WLS_NOT_USED">
- </element>
- </enum>
-
- <enum name="VehicleDataNotificationStatus">
- <description>Reflects the status of a vehicle data notification.</description>
- <element name="NOT_SUPPORTED" internal_name="VDNS_NOT_SUPPORTED">
- </element>
- <element name="NORMAL" internal_name="VDNS_NORMAL">
- </element>
- <element name="ACTIVE" internal_name="VDNS_ACTIVE">
- </element>
- <element name="NOT_USED" internal_name="VDNS_NOT_USED">
- </element>
- </enum>
-
- <enum name="IgnitionStableStatus">
- <description>Reflects the ignition switch stability.</description>
- <element name="IGNITION_SWITCH_NOT_STABLE">
- </element>
- <element name="IGNITION_SWITCH_STABLE">
- </element>
- <element name="MISSING_FROM_TRANSMITTER">
- </element>
- </enum>
-
- <enum name="IgnitionStatus">
- <description>Reflects the status of ignition.</description>
- <element name="UNKNOWN" internal_name="IS_UNKNOWN">
- </element>
- <element name="OFF" internal_name="IS_OFF">
- </element>
- <element name="ACCESSORY" internal_name="IS_ACCESSORY">
- </element>
- <element name="RUN" internal_name="IS_RUN">
- </element>
- <element name="START" internal_name="IS_START">
- </element>
- <element name="INVALID" internal_name="IS_INVALID">
- </element>
- </enum>
-
- <enum name="VehicleDataEventStatus">
- <description>Reflects the status of a vehicle data event; e.g. a seat belt event status.</description>
- <element name="NO_EVENT" internal_name="VDES_NO_EVENT">
- </element>
- <element name="NO" internal_name="VDES_NO">
- </element>
- <element name="YES" internal_name="VDES_YES">
- </element>
- <element name="NOT_SUPPORTED" internal_name="VDES_NOT_SUPPORTED">
- </element>
- <element name="FAULT" internal_name="VDES_FAULT">
- </element>
- </enum>
-
- <enum name="DeviceLevelStatus">
- <description>Reflects the reported battery status of the connected device, if reported.</description>
- <element name="ZERO_LEVEL_BARS">
- </element>
- <element name="ONE_LEVEL_BARS">
- </element>
- <element name="TWO_LEVEL_BARS">
- </element>
- <element name="THREE_LEVEL_BARS">
- </element>
- <element name="FOUR_LEVEL_BARS">
- </element>
- <element name="NOT_PROVIDED">
- </element>
- </enum>
-
- <enum name="PrimaryAudioSource">
- <description>Reflects the current primary audio source (if selected).</description>
- <element name="NO_SOURCE_SELECTED">
- </element>
- <element name="USB">
- </element>
- <element name="USB2">
- </element>
- <element name="BLUETOOTH_STEREO_BTST">
- </element>
- <element name="LINE_IN">
- </element>
- <element name="IPOD">
- </element>
- <element name="MOBILE_APP">
- </element>
- </enum>
-
- <enum name="WiperStatus">
- <description>Reflects the status of the wipers.</description>
- <element name="OFF" />
- <element name="AUTO_OFF" />
- <element name="OFF_MOVING" />
- <element name="MAN_INT_OFF" />
- <element name="MAN_INT_ON" />
- <element name="MAN_LOW" />
- <element name="MAN_HIGH" />
- <element name="MAN_FLICK" />
- <element name="WASH" />
- <element name="AUTO_LOW" />
- <element name="AUTO_HIGH" />
- <element name="COURTESYWIPE" />
- <element name="AUTO_ADJUST" />
- <element name="STALLED" />
- <element name="NO_DATA_EXISTS" />
- </enum>
-
- <enum name="VehicleDataStatus">
- <description>Reflects the status of a binary vehicle data item.</description>
- <element name="NO_DATA_EXISTS" internal_name="VDS_NO_DATA_EXISTS">
- </element>
- <element name="OFF" internal_name="VDS_OFF">
- </element>
- <element name="ON" internal_name="VDS_ON">
- </element>
- </enum>
-
- <enum name="MaintenanceModeStatus">
- <description>Reflects the status of a vehicle maintenance mode.</description>
- <element name="NORMAL" internal_name="MMS_NORMAL">
- </element>
- <element name="NEAR" internal_name="MMS_NEAR">
- </element>
- <element name="ACTIVE" internal_name="MMS_ACTIVE">
- </element>
- <element name="FEATURE_NOT_PRESENT" internal_name="MMS_FEATURE_NOT_PRESENT">
- </element>
- </enum>
-
- <enum name="VehicleDataActiveStatus">
- <description>Reflects the status of given vehicle component.</description>
- <element name="INACTIVE_NOT_CONFIRMED" internal_name="VDAS_INACTIVE_NOT_CONFIRMED">
- </element>
- <element name="INACTIVE_CONFIRMED" internal_name="VDAS_INACTIVE_CONFIRMED">
- </element>
- <element name="ACTIVE_NOT_CONFIRMED" internal_name="VDAS_ACTIVE_NOT_CONFIRMED">
- </element>
- <element name="ACTIVE_CONFIRMED" internal_name="VDAS_ACTIVE_CONFIRMED">
- </element>
- <element name="FAULT" internal_name="VDAS_FAULT">
- </element>
- </enum>
-
- <enum name="AmbientLightStatus">
- <description>Reflects the status of the ambient light sensor.</description>
- <element name="NIGHT" />
- <element name="TWILIGHT_1" />
- <element name="TWILIGHT_2" />
- <element name="TWILIGHT_3" />
- <element name="TWILIGHT_4" />
- <element name="DAY" />
- <element name="UNKNOWN" internal_name="ALS_UNKNOWN" />
- <element name="INVALID" />
- </enum>
-
- <enum name="ModuleType">
- <element name="CLIMATE"/>
- <element name="RADIO"/>
- </enum>
-
- <enum name="DefrostZone">
- <element name="FRONT"/>
- <element name="REAR"/>
- <element name="ALL"/>
- <element name="NONE"/>
- </enum>
-
- <enum name="VentilationMode">
- <element name="UPPER"/>
- <element name="LOWER"/>
- <element name="BOTH"/>
- <element name="NONE"/>
- </enum>
-
- <enum name="RadioBand">
- <element name="AM"/>
- <element name="FM"/>
- <element name="XM"/>
- </enum>
-
- <enum name="RadioState">
- <element name="ACQUIRING"/>
- <element name="ACQUIRED"/>
- <element name="MULTICAST"/>
- <element name="NOT_FOUND"/>
- </enum>
-
- <enum name="TemperatureUnit">
- <element name="FAHRENHEIT"/>
- <element name="CELSIUS"/>
- </enum>
-
- <struct name="BeltStatus">
- <param name="driverBeltDeployed" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsDrvBelt_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerBeltDeployed" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsPasBelt_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerBuckleBelted" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw1PasBckl_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="driverBuckleBelted" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw1DrvBckl_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="leftRow2BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw2lBckl_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerChildDetected" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw1PasChld_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="rightRow2BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw2rBckl_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="middleRow2BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw2mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="middleRow3BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw3mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="leftRow3BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw3lBckl_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="rightRow3BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw3rBckl_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="leftRearInflatableBelted" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw2lRib_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="rightRearInflatableBelted" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw2rRib_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="middleRow1BeltDeployed" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw1mBelt_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="middleRow1BuckleBelted" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsRw1mBckl_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- </struct>
-
- <struct name="BodyInformation">
- <param name="parkBrakeActive" type="Boolean" mandatory="true">
- <description>References signal "PrkBrkActv_B_Actl".</description>
- </param>
- <param name="ignitionStableStatus" type="IgnitionStableStatus" mandatory="true">
- <description>References signal "Ignition_Switch_Stable". See IgnitionStableStatus.</description>
- </param>
- <param name="ignitionStatus" type="IgnitionStatus" mandatory="true">
- <description>References signal "Ignition_status". See IgnitionStatus.</description>
- </param>
- <param name="driverDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatDrv_B_Actl".</description>
- </param>
- <param name="passengerDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatPsngr_B_Actl".</description>
- </param>
- <param name="rearLeftDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatRl_B_Actl".</description>
- </param>
- <param name="rearRightDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatRr_B_Actl".</description>
- </param>
- </struct>
-
- <struct name="DeviceStatus">
- <param name="voiceRecOn" type="Boolean" mandatory="true">
- <description>References signal "CPM_VoiceRec_STAT".</description>
- </param>
- <param name="btIconOn" type="Boolean" mandatory="true">
- <description>References signal "BT_ICON".</description>
- </param>
- <param name="callActive" type="Boolean" mandatory="true">
- <description>References signal "CPM_Call_Active_STAT".</description>
- </param>
- <param name="phoneRoaming" type="Boolean" mandatory="true">
- <description>References signal "CPM_Phone_Roaming_STAT".</description>
- </param>
- <param name="textMsgAvailable" type="Boolean" mandatory="true">
- <description>References signal "CPM_TextMsg_AVAL".</description>
- </param>
- <param name="battLevelStatus" type="DeviceLevelStatus" mandatory="true">
- <description>Device battery level status. References signal "CPM_Batt_Level_STAT". See DeviceLevelStatus.</description>
- </param>
- <param name="stereoAudioOutputMuted" type="Boolean" mandatory="true">
- <description>References signal "CPM_Stereo_Audio_Output".</description>
- </param>
- <param name="monoAudioOutputMuted" type="Boolean" mandatory="true">
- <description>References signal "CPM_Mono_Audio_Output".</description>
- </param>
- <param name="signalLevelStatus" type="DeviceLevelStatus" mandatory="true">
- <description>Device signal level status. References signal "CPM_Signal_Strength_STAT". See DeviceLevelStatus.</description>
- </param>
- <param name="primaryAudioSource" type="PrimaryAudioSource" mandatory="true">
- <description>References signal "CPM_Stereo_PAS_Source". See PrimaryAudioSource.</description>
- </param>
- <param name="eCallEventActive" type="Boolean" mandatory="true">
- <description>References signal "eCall_Event".</description>
- </param>
- </struct>
-
- <struct name="HeadLampStatus">
- <param name="lowBeamsOn" type="Boolean" mandatory="true">
- <description>Status of the low beam lamps. References signal "HeadLampLoActv_B_Stat".</description>
- </param>
- <param name="highBeamsOn" type="Boolean" mandatory="true">
- <description>Status of the high beam lamps. References signal "HeadLghtHiOn_B_Stat".</description>
- </param>
- <param name="ambientLightSensorStatus" type="AmbientLightStatus" mandatory="false">
- <description>Status of the ambient light sensor.</description>
- </param>
- </struct>
-
- <struct name="AppInfo">
- <description>Contains detailed information about the registered application.</description>
-
- <param name="appDisplayName" type="String" maxlength="100" mandatory="true">
- <description>The name displayed for the mobile application on the mobile device (can differ from the app name set in the initial RAI request).</description>
- </param>
-
- <param name="appBundleID" type="String" maxlength="256" mandatory="true">
- <description>The AppBundleID of an iOS application or package name of the Android application. This supports App Launch strategies for each platform.</description>
- </param>
-
- <param name="appVersion" type="String" maxlength="256" mandatory="true">
- <description>Represents the build version number of this particular mobile app.</description>
- </param>
-
- <param name="appIcon" type="String" maxlength="500" mandatory="false">
- <description>A file reference to the icon utilized by this app (simplifies the process of setting an app icon during app registration).</description>
- </param>
- </struct>
-
- <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <!-- Ford Specific Data Items -->
- <!-- ~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <enum name="FileType">
- <description>Enumeration listing possible file types.</description>
- <element name="GRAPHIC_BMP" />
- <element name="GRAPHIC_JPEG" />
- <element name="GRAPHIC_PNG" />
- <element name="AUDIO_WAVE" />
- <element name="AUDIO_MP3" />
- <element name="AUDIO_AAC" />
- <element name="BINARY" />
- <element name="JSON" />
- </enum>
-
- <enum name="FuelCutoffStatus" >
- <description>Reflects the status of the RCM fuel cutoff.</description>
- <element name="TERMINATE_FUEL" internal_name="FCS_TERMINATE_FUEL">
- </element>
- <element name="NORMAL_OPERATION" internal_name="FCS_NORMAL_OPERATION">
- </element>
- <element name="FAULT" internal_name="FCS_FAULT">
- </element>
- </enum>
-
- <enum name="EmergencyEventType">
- <description>Reflects the emergency event status of the vehicle.</description>
- <element name="NO_EVENT" internal_name="EET_NO_EVENT">
- </element>
- <element name="FRONTAL" internal_name="EET_FRONTAL">
- </element>
- <element name="SIDE" internal_name="EET_SIDE">
- </element>
- <element name="REAR" internal_name="EET_REAR">
- </element>
- <element name="ROLLOVER" internal_name="EET_ROLLOVER">
- </element>
- <element name="NOT_SUPPORTED" internal_name="EET_NOT_SUPPORTED">
- </element>
- <element name="FAULT" internal_name="EET_FAULT">
- </element>
- </enum>
-
- <enum name="ECallConfirmationStatus">
- <description>Reflects the status of the eCall Notification.</description>
- <element name="NORMAL" internal_name="ECCS_NORMAL">
- </element>
- <element name="CALL_IN_PROGRESS" internal_name="ECCS_CALL_IN_PROGRESS">
- </element>
- <element name="CALL_CANCELLED" internal_name="ECCS_CALL_CANCELLED">
- </element>
- <element name="CALL_COMPLETED">
- </element>
- <element name="CALL_UNSUCCESSFUL" internal_name="ECCS_CALL_UNSUCCESSFUL">
- </element>
- <element name="ECALL_CONFIGURED_OFF" internal_name="ECCS_ECALL_CONFIGURED_OFF">
- </element>
- <element name="CALL_COMPLETE_DTMF_TIMEOUT" internal_name="ECCS_CALL_COMPLETE_DTMF_TIMEOUT">
- </element>
- </enum>
-
- <enum name="PowerModeQualificationStatus" >
- <description>Reflects the status of the current power mode qualification.</description>
- <element name="POWER_MODE_UNDEFINED">
- </element>
- <element name="POWER_MODE_EVALUATION_IN_PROGRESS">
- </element>
- <element name="NOT_DEFINED">
- </element>
- <element name="POWER_MODE_OK">
- </element>
- </enum>
-
- <enum name="PowerModeStatus">
- <description>Reflects the status of the current power mode.</description>
- <element name="KEY_OUT">
- </element>
- <element name="KEY_RECENTLY_OUT">
- </element>
- <element name="KEY_APPROVED_0">
- </element>
- <element name="POST_ACCESORY_0">
- </element>
- <element name="ACCESORY_1">
- </element>
- <element name="POST_IGNITION_1">
- </element>
- <element name="IGNITION_ON_2">
- </element>
- <element name="RUNNING_2">
- </element>
- <element name="CRANK_3">
- </element>
- </enum>
-
- <enum name="CarModeStatus">
- <description>Reflects the status of the current car mode.</description>
- <element name="NORMAL" internal_name="CMS_NORMAL">
- </element>
- <element name="FACTORY" internal_name="CMS_FACTORY">
- </element>
- <element name="TRANSPORT" internal_name="CMS_TRANSPORT">
- </element>
- <element name="CRASH" internal_name="CMS_CRASH">
- </element>
- </enum>
-
- <struct name="ECallInfo">
- <param name="eCallNotificationStatus" type="VehicleDataNotificationStatus" mandatory="true">
- <description>References signal "eCallNotification_4A". See VehicleDataNotificationStatus.</description>
- </param>
- <param name="auxECallNotificationStatus" type="VehicleDataNotificationStatus" mandatory="true">
- <description>References signal "eCallNotification". See VehicleDataNotificationStatus.</description>
- </param>
- <param name="eCallConfirmationStatus" type="ECallConfirmationStatus" mandatory="true">
- <description>References signal "eCallConfirmation". See ECallConfirmationStatus.</description>
- </param>
- </struct>
-
- <struct name="AirbagStatus">
- <param name="driverAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsDrvBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="driverSideAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsDrvSideBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="driverCurtainAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsDrvCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsPasBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerCurtainAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsPasCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="driverKneeAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsKneeDrvBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerSideAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsPasSideBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerKneeAirbagDeployed" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsKneePasBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- </struct>
-
- <struct name="EmergencyEvent">
- <param name="emergencyEventType" type="EmergencyEventType" mandatory="true">
- <description>References signal "VedsEvntType_D_Ltchd". See EmergencyEventType.</description>
- </param>
- <param name="fuelCutoffStatus" type="FuelCutoffStatus" mandatory="true">
- <description>References signal "RCM_FuelCutoff". See FuelCutoffStatus.</description>
- </param>
- <param name="rolloverEvent" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsEvntRoll_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
-
- <param name="maximumChangeVelocity" type="Integer" minvalue="0" maxvalue="255" mandatory="true">
- <description>References signal "VedsMaxDeltaV_D_Ltchd". Change in velocity in KPH. Additional reserved values:
- 0x00 No event
- 0xFE Not supported
- 0xFF Fault
- </description>
- </param>
- <param name="multipleEvents" type="VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsMultiEvnt_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- </struct>
-
- <struct name="ClusterModeStatus">
- <param name="powerModeActive" type="Boolean" mandatory="true">
- <description>References signal "PowerMode_UB".</description>
- </param>
- <param name="powerModeQualificationStatus" type="PowerModeQualificationStatus" mandatory="true">
- <description>References signal "PowerModeQF". See PowerModeQualificationStatus.</description>
- </param>
- <param name="carModeStatus" type="CarModeStatus" mandatory="true">
- <description>References signal "CarMode". See CarMode.</description>
- </param>
- <param name="powerModeStatus" type="PowerModeStatus" mandatory="true">
- <description>References signal "PowerMode". See PowerMode.</description>
- </param>
- </struct>
-
- <struct name="MyKey">
- <param name="e911Override" type="VehicleDataStatus" mandatory="true">
- <description>Indicates whether e911 override is on. References signal "MyKey_e911Override_St". See VehicleDataStatus.</description>
- </param>
- </struct>
-
- <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
- <!-- / Ford Specific Data Items -->
- <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
-
- <enum name="VehicleDataResultCode">
- <description>Enumeration that describes possible result codes of a vehicle data entry request.</description>
- <element name="SUCCESS" internal_name="VDRC_SUCCESS">
- <description>Individual vehicle data item / DTC / DID request or subscription successful</description>
- </element>
- <element name="TRUNCATED_DATA" internal_name="VDRC_TRUNCATED_DATA">
- <description>DTC / DID request successful, however, not all active DTCs or full contents of DID location available</description>
- </element>
- <element name="DISALLOWED" internal_name="VDRC_DISALLOWED">
- <description>This vehicle data item is not allowed for this app by Ford.</description>
- </element>
- <element name="USER_DISALLOWED" internal_name="VDRC_USER_DISALLOWED">
- <description>The user has not granted access to this type of vehicle data item at this time.</description>
- </element>
- <element name="INVALID_ID" internal_name="VDRC_INVALID_ID">
- <description>The ECU ID referenced is not a valid ID on the bus / system.</description>
- </element>
- <element name="VEHICLE_DATA_NOT_AVAILABLE" internal_name="VDRC_DATA_NOT_AVAILABLE">
- <description>The requested vehicle data item / DTC / DID is not currently available or responding on the bus / system.</description>
- </element>
- <element name="DATA_ALREADY_SUBSCRIBED" internal_name="VDRC_DATA_ALREADY_SUBSCRIBED">
- <description>The vehicle data item is already subscribed.</description>
- </element>
- <element name="DATA_NOT_SUBSCRIBED" internal_name="VDRC_DATA_NOT_SUBSCRIBED">
- <description>The vehicle data item cannot be unsubscribed because it is not currently subscribed.</description>
- </element>
- <element name="IGNORED" internal_name="VDRC_IGNORED">
- <description>The request for this item is ignored because it is already in progress.</description>
- </element>
- </enum>
-
- <struct name="TireStatus">
- <description>The status and pressure of the tires.</description>
-
- <param name="pressureTelltale" type="WarningLightStatus" mandatory="true">
- <description>Status of the Tire Pressure Telltale. See WarningLightStatus.</description>
- </param>
- <param name="leftFront" type="SingleTireStatus" mandatory="true">
- <description>The status of the left front tire.</description>
- </param>
- <param name="rightFront" type="SingleTireStatus" mandatory="true">
- <description>The status of the right front tire.</description>
- </param>
- <param name="leftRear" type="SingleTireStatus" mandatory="true">
- <description>The status of the left rear tire.</description>
- </param>
- <param name="rightRear" type="SingleTireStatus" mandatory="true">
- <description>The status of the right rear tire.</description>
- </param>
- <param name="innerLeftRear" type="SingleTireStatus" mandatory="true">
- <description>The status of the inner left rear.</description>
- </param>
- <param name="innerRightRear" type="SingleTireStatus" mandatory="true">
- <description>The status of the inner right rear.</description>
- </param>
- </struct>
-
-
- <enum name="TurnSignal">
- <description>Enumeration that describes the status of the turn light indicator.</description>
- <element name="OFF">
- <description>Turn signal is OFF</description>
- </element>
- <element name="LEFT">
- <description>Left turn signal is on</description>
- </element>
- <element name="RIGHT">
- <description>Right turn signal is on</description>
- </element>
- <element name="BOTH">
- <description>Both signals (left and right) are on.</description>
- </element>
- </enum>
-
- <struct name="GPSData">
- <description>Struct with the GPS data.</description>
- <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="true">
- </param>
- <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="true">
- </param>
- <param name="utcYear" type="Integer" minvalue="2010" maxvalue="2100" mandatory="true">
- <description>The current UTC year.</description>
- </param>
- <param name="utcMonth" type="Integer" minvalue="1" maxvalue="12" mandatory="true">
- <description>The current UTC month.</description>
- </param>
- <param name="utcDay" type="Integer" minvalue="1" maxvalue="31" mandatory="true">
- <description>The current UTC day.</description>
- </param>
- <param name="utcHours" type="Integer" minvalue="0" maxvalue="23" mandatory="true">
- <description>The current UTC hour.</description>
- </param>
- <param name="utcMinutes" type="Integer" minvalue="0" maxvalue="59" mandatory="true">
- <description>The current UTC minute.</description>
- </param>
- <param name="utcSeconds" type="Integer" minvalue="0" maxvalue="59" mandatory="true">
- <description>The current UTC second.</description>
- </param>
- <param name="compassDirection" type="CompassDirection" mandatory="true">
- <description>See CompassDirection.</description>
- </param>
- <param name="pdop" type="Float" minvalue="0" maxvalue="10" defvalue="0" mandatory="true">
- <description>PDOP. If undefined or unavailable, then value shall be set to 0.</description>
- </param>
- <param name="hdop" type="Float" minvalue="0" maxvalue="10" defvalue="0" mandatory="true">
- <description>HDOP. If value is unknown, value shall be set to 0.</description>
- </param>
- <param name="vdop" type="Float" minvalue="0" maxvalue="10" defvalue="0" mandatory="true">
- <description>VDOP. If value is unknown, value shall be set to 0.</description>
- </param>
- <param name="actual" type="Boolean" mandatory="true">
- <description>
- True, if actual.
- False, if inferred.
- </description>
- </param>
- <param name="satellites" type="Integer" minvalue="0" maxvalue="31" mandatory="true">
- <description>Number of satellites in view</description>
- </param>
- <param name="dimension" type="Dimension" mandatory="true">
- <description>See Dimension</description>
- </param>
- <param name="altitude" type="Float" minvalue="-10000" maxvalue="10000" mandatory="true">
- <description>Altitude in meters</description>
- </param>
- <param name="heading" type="Float" minvalue="0" maxvalue="359.99" mandatory="true">
- <description>The heading. North is 0. Resolution is 0.01</description>
- </param>
- <param name="speed" type="Float" minvalue="0" maxvalue="500" mandatory="true">
- <description>The speed in KPH</description>
- </param>
- </struct>
-
- <struct name="VehicleDataResult">
- <description>Individual published data request result</description>
- <param name="dataType" type="VehicleDataType" mandatory="true">
- <description>Defined published data element type.</description>
- </param>
- <param name="resultCode" type="VehicleDataResultCode" mandatory="true">
- <description>Published data result code.</description>
- </param>
- </struct>
-
- <struct name="DIDResult">
- <description>Individual requested DID result and data</description>
- <param name="resultCode" type="VehicleDataResultCode" mandatory="true">
- <description>Individual DID result code.</description>
- </param>
- <param name="didLocation" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Location of raw data from vehicle data DID</description>
- </param>
- <param name="data" type="String" maxlength="5000" mandatory="false">
- <description>Raw DID-based data returned for requested element.</description>
- </param>
- </struct>
-
- <struct name="StartTime">
- <param name="hours" type="Integer" minvalue="0" maxvalue="59" mandatory="true">
- <description>
- The hour of the media clock.
- Some radios only support a max of 19 hours. If out of range, it will be rejected.
- </description>
- </param>
- <param name="minutes" type="Integer" minvalue="0" maxvalue="59" mandatory="true"/>
- <param name="seconds" type="Integer" minvalue="0" maxvalue="59" mandatory="true"/>
- </struct>
-
- <struct name="TextField">
- <param name="name" type="TextFieldName" mandatory="true">
- <description>The name that identifies the field. See TextFieldName.</description>
- </param>
- <param name="characterSet" type="CharacterSet" mandatory="true">
- <description>The character set that is supported in this field. See CharacterSet.</description>
- </param>
- <param name="width" type="Integer" minvalue="1" maxvalue="500" mandatory="true">
- <description>The number of characters in one row of this field.</description>
- </param>
- <param name="rows" type="Integer" minvalue="1" maxvalue="8" mandatory="true">
- <description>The number of rows of this field.</description>
- </param>
- </struct>
-
- <struct name="ImageResolution">
- <param name="resolutionWidth" type="Integer" minvalue="1" maxvalue="10000" mandatory="true">
- <description>The image resolution width.</description>
- </param>
- <param name="resolutionHeight" type="Integer" minvalue="1" maxvalue="10000" mandatory="true">
- <description>The image resolution height.</description>
- </param>
- </struct>
-
- <struct name="ImageField">
- <param name="name" type="ImageFieldName" mandatory="true">
- <description>The name that identifies the field. See ImageFieldName.</description>
- </param>
- <param name="imageTypeSupported" type="FileType" minsize="1" maxsize="100" array="true" mandatory="true">
- <description>The image types that are supported in this field. See FileType.</description>
- </param>
- <param name="imageResolution" type="ImageResolution" mandatory="false">
- <description>The image resolution of this field.</description>
- </param>
- </struct>
-
- <struct name="TouchCoord">
- <param name="x" type="Integer" mandatory="true" minvalue="0" maxvalue="10000">
- <description>The x coordinate of the touch.</description>
- </param>
- <param name="y" type="Integer" mandatory="true" minvalue="0" maxvalue="10000">
- <description>The y coordinate of the touch.</description>
- </param>
- </struct>
-
- <enum name="TouchType">
- <element name="BEGIN"/>
- <element name="MOVE"/>
- <element name="END"/>
- <element name="CANCEL"/>
- </enum>
-
- <struct name="TouchEvent">
- <param name="id" type="Integer" mandatory="true" minvalue="0" maxvalue="9">
- <description>
- A touch's unique identifier. The application can track the current touch events by id.
- If a touch event has type begin, the id should be added to the set of touches.
- If a touch event has type end, the id should be removed from the set of touches.
- </description>
- </param>
- <param name="ts" type="Integer" mandatory="true" array="true" minvalue="0" maxvalue="2000000000" minsize="1" maxsize="1000">
- <description>
- The time that the touch was recorded. This number can the time since the beginning of the session or something else as long as the units are in milliseconds.
- The timestamp is used to determined the rate of change of position of a touch.
- The application also uses the time to verify whether two touches, with different ids, are part of a single action by the user.
- If there is only a single timestamp in this array, it is the same for every coordinate in the coordinates array.
- </description>
- </param>
- <param name="c" type="TouchCoord" mandatory="true" array="true" minsize="1" maxsize="1000">
- </param>
- </struct>
-
- <struct name="TouchEventCapabilities">
- <param name="pressAvailable" type="Boolean" mandatory="true">
- </param>
- <param name="multiTouchAvailable" type="Boolean" mandatory="true">
- </param>
- <param name="doublePressAvailable" type="Boolean" mandatory="true">
- </param>
- </struct>
-
- <struct name="ScreenParams">
- <param name="resolution" type="ImageResolution" mandatory="true">
- <description>The resolution of the prescribed screen area.</description>
- </param>
- <param name="touchEventAvailable" type="TouchEventCapabilities" mandatory="false">
- <description>Types of screen touch events available in screen area.</description>
- </param>
- </struct>
-
- <enum name="PermissionStatus">
- <description>Enumeration that describes possible permission states of a policy table entry.</description>
- <element name="ALLOWED" internal_name="PS_ALLOWED"/>
- <element name="DISALLOWED" internal_name="PS_DISALLOWED"/>
- <element name="USER_DISALLOWED" internal_name="PS_USER_DISALLOWED"/>
- <element name="USER_CONSENT_PENDING" internal_name="PS_USER_CONSENT_PENDING"/>
- </enum>
-
- <struct name="HMIPermissions">
- <param name="allowed" type="HMILevel" minsize="0" maxsize="100" array="true" mandatory="true">
- <description>A set of all HMI levels that are permitted for this given RPC.</description>
- </param>
- <param name="userDisallowed" type="HMILevel" minsize="0" maxsize="100" array="true" mandatory="true">
- <description>A set of all HMI levels that are prohibited for this given RPC.</description>
- </param>
- </struct>
-
- <struct name="ParameterPermissions">
- <param name="allowed" type="String" minsize="0" maxsize="100" maxlength = "100" array="true" mandatory="true">
- <description>A set of all parameters that are permitted for this given RPC.</description>
- </param>
- <param name="userDisallowed" type="String" minsize="0" maxsize="100" maxlength = "100" array="true" mandatory="true">
- <description>A set of all parameters that are prohibited for this given RPC.</description>
- </param>
- </struct>
-
- <struct name="PermissionItem">
- <param name="rpcName" type="String" maxlength="100" mandatory="true">
- <description>Name of the individual RPC in the policy table.</description>
- </param>
- <param name="hmiPermissions" type="HMIPermissions" mandatory="true"/>
- <param name="parameterPermissions" type="ParameterPermissions" mandatory="true"/>
- </struct>
-
- <struct name="DisplayCapabilities">
- <description>Contains information about the display capabilities.</description>
- <param name="displayType" type="DisplayType" mandatory="true">
- <description>The type of the display. See DisplayType</description>
- </param>
- <param name="displayName" type="String" mandatory="false">
- <description>The name of the display the app is connected to.</description>
- </param>
- <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true" mandatory="true">
- <description>A set of all fields that support text data. See TextField</description>
- </param>
- <param name="imageFields" type="ImageField" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>A set of all fields that support images. See ImageField</description>
- </param>
- <param name="mediaClockFormats" type="MediaClockFormat" minsize="0" maxsize="100" array="true" mandatory="true">
- <description>A set of all supported formats of the media clock. See MediaClockFormat</description>
- </param>
- <param name="graphicSupported" type="Boolean" mandatory="true">
- <description>The display's persistent screen supports referencing a static or dynamic image.</description>
- </param>
- <param name="templatesAvailable" type="String" minsize="0" maxsize="100" maxlength="100" array="true" mandatory="false">
- <description>A set of all predefined persistent display templates available on headunit. To be referenced in SetDisplayLayout.</description>
- </param>
- <param name="screenParams" type="ScreenParams" mandatory="false">
- <description>A set of all parameters related to a prescribed screen area (e.g. for video / touch input).</description>
- </param>
- <param name="numCustomPresetsAvailable" type="Integer" minvalue="1" maxvalue="100" mandatory="false">
- <description>The number of on-screen custom presets available (if any); otherwise omitted.</description>
- </param>
-
- <!-- TODO: Add pixel density? -->
- </struct>
- <struct name="ButtonCapabilities">
- <description>Contains information about a button's capabilities.</description>
- <param name="name" type="ButtonName" mandatory="true">
- <description>The name of the button. See ButtonName.</description>
- </param>
- <param name="shortPressAvailable" type="Boolean" mandatory="true">
- <description>
- The button supports a short press.
- Whenever the button is pressed short, onButtonPressed( SHORT) will be invoked.
- </description>
- </param>
- <param name="longPressAvailable" type="Boolean" mandatory="true">
- <description>
- The button supports a LONG press.
- Whenever the button is pressed long, onButtonPressed( LONG) will be invoked.
- </description>
- </param>
- <param name="upDownAvailable" type="Boolean" mandatory="true">
- <description>
- The button supports "button down" and "button up".
- Whenever the button is pressed, onButtonEvent( DOWN) will be invoked.
- Whenever the button is released, onButtonEvent( UP) will be invoked.
- </description>
- </param>
- </struct>
- <struct name="SoftButtonCapabilities">
- <description>Contains information about a SoftButton's capabilities.</description>
- <param name="shortPressAvailable" type="Boolean" mandatory="true">
- <description>
- The button supports a short press.
- Whenever the button is pressed short, onButtonPressed( SHORT) will be invoked.
- </description>
- </param>
- <param name="longPressAvailable" type="Boolean" mandatory="true">
- <description>
- The button supports a LONG press.
- Whenever the button is pressed long, onButtonPressed( LONG) will be invoked.
- </description>
- </param>
- <param name="upDownAvailable" type="Boolean" mandatory="true">
- <description>
- The button supports "button down" and "button up".
- Whenever the button is pressed, onButtonEvent( DOWN) will be invoked.
- Whenever the button is released, onButtonEvent( UP) will be invoked.
- </description>
- </param>
- <param name="imageSupported" type="Boolean" mandatory="true">
- <description>The button supports referencing a static or dynamic image.</description>
- </param>
- </struct>
- <struct name="PresetBankCapabilities">
- <description>Contains information about on-screen preset capabilities.</description>
- <param name="onScreenPresetsAvailable" type="Boolean" mandatory="true">
- <description>Onscreen custom presets are available.</description>
- </param>
- </struct>
- <struct name="HMICapabilities">
- <param name="navigation" type="Boolean" mandatory="false">
- <description>Availability of build in Nav. True: Available, False: Not Available</description>
- </param>
- <param name="phoneCall" type="Boolean" mandatory="false">
- <description>Availability of build in phone. True: Available, False: Not Available </description>
- </param>
- <param name="videoStreaming" type="Boolean" mandatory="false">
- <description>Availability of video streaming. </description>
- </param>
- <param name="remoteControl" type="Boolean" mandatory="false">
- <description>Availability of remote control feature. True: Available, False: Not Available</description>
- </param>
- </struct>
- <struct name="MenuParams">
- <param name="parentID" type="Integer" minvalue="0" maxvalue="2000000000" defvalue="0" mandatory="false">
- <description>
- unique ID of the sub menu, the command will be added to.
- If not provided, it will be provided to the top level of the in application menu.
- </description>
- </param>
- <param name="position" type="Integer" minvalue="0" maxvalue="1000" mandatory="false">
- <description>
- Position within the items that are are at top level of the in application menu.
- 0 will insert at the front.
- 1 will insert at the second position.
- if position is greater or equal than the number of items on top level, the sub menu will be appended to the end.
- If this param was omitted the entry will be added at the end.
- </description>
- </param>
- <param name="menuName" type="String" maxlength="500" mandatory="true">
- <description>Text to show in the menu for this sub menu.</description>
- </param>
- </struct>
- <struct name="TTSChunk">
- <description>A TTS chunk, that consists of text/phonemes to speak or the name of a file to play, and a TTS type (like text or SAPI)</description>
- <param name="text" minlength="0" maxlength="500" type="String" mandatory="true">
- <description>
- The text or phonemes to speak, or the name of the audio file to play.
- May not be empty.
- </description>
- </param>
- <param name="type" type="SpeechCapabilities" mandatory="true">
- <description>Describes whether the TTS chunk is plain text, a specific phoneme set, or an audio file. See SpeechCapabilities</description>
- </param>
- </struct>
- <struct name="Turn">
- <param name="navigationText" type="String" maxlength="500" mandatory="false">
- <description>Individual turn text. Must provide at least text or icon for a given turn.</description>
- </param>
- <param name="turnIcon" type="Image" mandatory="false">
- <description>Individual turn icon. Must provide at least text or icon for a given turn.</description>
- </param>
- </struct>
- <struct name="VehicleType">
- <param name="make" type="String" maxlength="500" mandatory="false">
- <description>Make of the vehicle, e.g. Ford</description>
- </param>
- <param name="model" type="String" maxlength="500" mandatory="false">
- <description>Model of the vehicle, e.g. Fiesta</description>
- </param>
- <param name="modelYear" type="String" maxlength="500" mandatory="false">
- <description>Model Year of the vehicle, e.g. 2013</description>
- </param>
- <param name="trim" type="String" maxlength="500" mandatory="false">
- <description>Trim of the vehicle, e.g. SE</description>
- </param>
- </struct>
- <enum name="KeyboardLayout">
- <description>Enumeration listing possible keyboard layouts.</description>
- <element name="QWERTY" />
- <element name="QWERTZ" />
- <element name="AZERTY" />
- </enum>
- <enum name="KeyboardEvent" >
- <description>Enumeration listing possible keyboard events.</description>
- <element name="KEYPRESS" />
- <element name="ENTRY_SUBMITTED" />
- <element name="ENTRY_VOICE" />
- <element name="ENTRY_CANCELLED" />
- <element name="ENTRY_ABORTED" />
- </enum>
- <enum name="KeypressMode">
- <description>Enumeration listing possible keyboard events.</description>
- <element name="SINGLE_KEYPRESS">
- <description>Each keypress is individually sent as the user presses the keyboard keys.</description>
- </element>
- <element name="QUEUE_KEYPRESSES">
- <description>The keypresses are queued and a string is eventually sent once the user chooses to submit their entry.</description>
- </element>
- <element name="RESEND_CURRENT_ENTRY">
- <description>The keypresses are queue and a string is sent each time the user presses a keyboard key; the string contains the entire current entry.</description>
- </element>
- </enum>
- <struct name="KeyboardProperties">
- <description>Configuration of on-screen keyboard (if available).</description>
- <param name="language" type="Language" mandatory="false">
- <description>The keyboard language.</description>
- </param>
- <param name="keyboardLayout" type="KeyboardLayout" mandatory="false" >
- <description>Desired keyboard layout.</description>
- </param>
- <param name="keypressMode" type="KeypressMode" mandatory="false" >
- <description>
- Desired keypress mode.
- If omitted, this value will be set to RESEND_CURRENT_ENTRY.
- </description>
- </param>
- <param name="limitedCharacterList" type="String" maxlength="1" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>Array of keyboard characters to enable.</description>
- <description>All omitted characters will be greyed out (disabled) on the keyboard.</description>
- <description>If omitted, the entire keyboard will be enabled.</description>
- </param>
- <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false">
- <description>Allows an app to prepopulate the text field with a suggested or completed entry as the user types</description>
- </param>
- </struct>
- <struct name="DeviceInfo">
- <description>Various information about connecting device.</description>
- <param name="hardware" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>Device model</description>
- </param>
- <param name="firmwareRev" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>Device firmware revision</description>
- </param>
- <param name="os" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>Device OS</description>
- </param>
- <param name="osVersion" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>Device OS version</description>
- </param>
- <param name="carrier" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>Device mobile carrier (if applicable)</description>
- </param>
- <param name="maxNumberRFCOMMPorts" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
- <description>Omitted if connected not via BT.</description>
- </param>
- </struct>
- <enum name="RequestType">
- <description>Enumeration listing possible asynchronous requests.</description>
- <element name="HTTP" />
- <element name="FILE_RESUME" />
- <element name="AUTH_REQUEST" />
- <element name="AUTH_CHALLENGE" />
- <element name="AUTH_ACK" />
- <element name="PROPRIETARY" />
- <element name="QUERY_APPS" />
- <element name="LAUNCH_APP" />
- <element name="LOCK_SCREEN_ICON_URL" />
- <element name="TRAFFIC_MESSAGE_CHANNEL" />
- <element name="DRIVER_PROFILE" />
- <element name="VOICE_SEARCH" />
- <element name="NAVIGATION" />
- <element name="PHONE" />
- <element name="CLIMATE" />
- <element name="SETTINGS" />
- <element name="VEHICLE_DIAGNOSTICS" />
- <element name="EMERGENCY" />
- <element name="MEDIA" />
- <element name="FOTA" />
- <element name="OEM_SPECIFIC" />
- </enum>
- <enum name="AppHMIType">
- <description>Enumeration listing possible app types.</description>
- <element name="DEFAULT" />
- <element name="COMMUNICATION" />
- <element name="MEDIA" />
- <element name="MESSAGING" />
- <element name="NAVIGATION" />
- <element name="INFORMATION" />
- <element name="SOCIAL" />
- <element name="BACKGROUND_PROCESS" />
- <element name="TESTING" />
- <element name="SYSTEM" />
- <element name="PROJECTION" />
- <element name="REMOTE_CONTROL" />
- </enum>
- <enum name="PredefinedLayout" platform="documentation">
- <description>Predefined screen layout.</description>
- <element name="DEFAULT" rootscreen="true">
- <description>
- Default media / non-media screen.
- Can be set as a root screen.
- </description>
- </element>
- <element name="MEDIA" rootscreen="true">
- <description>
- Default Media screen.
- Can be set as a root screen.
- </description>
- </element>
- <element name="NON-MEDIA" internal_name="NON_MEDIA" rootscreen="true">
- <description>
- Default Non-media screen.
- Can be set as a root screen.
- </description>
- </element>
- <element name="ONSCREEN_PRESETS" rootscreen="true">
- <description>
- Custom root media screen containing app-defined onscreen presets.
- Can be set as a root screen.
- </description>
- </element>
- <element name="NAV_FULLSCREEN_MAP" rootscreen="true" >
- <description>
- Custom root template screen containing full screen map with navigation controls.
- Can be set as a root screen.
- </description>
- </element>
- <element name="NAV_LIST" rootscreen="true" >
- <description>
- Custom root template screen containing video represented list.
- Can be set as a root screen.
- </description>
- </element>
- <element name="NAV_KEYBOARD" rootscreen="true" >
- <description>
- Custom root template screen containing video represented keyboard.
- Can be set as a root screen.
- </description>
- </element>
- <element name="GRAPHIC_WITH_TEXT" rootscreen="true">
- <description>
- Custom root template screen containing half-screen graphic with lines of text.
- Can be set as a root screen.
- </description>
- </element>
- <element name="TEXT_WITH_GRAPHIC" rootscreen="true">
- <description>
- Custom root template screen containing lines of text with half-screen graphic.
- Can be set as a root screen.
- </description>
- </element>
- <element name="TILES_ONLY" rootscreen="true">
- <description>
- Custom root template screen containing only tiled SoftButtons.
- Can be set as a root screen.
- </description>
- </element>
- <element name="TEXTBUTTONS_ONLY" rootscreen="true">
- <description>
- Custom root template screen containing only text SoftButtons.
- Can be set as a root screen.
- </description>
- </element>
- <element name="GRAPHIC_WITH_TILES" rootscreen="true">
- <description>
- Custom root template screen containing half-screen graphic with tiled SoftButtons.
- Can be set as a root screen.
- </description>
- </element>
- <element name="TILES_WITH_GRAPHIC" rootscreen="true">
- <description>
- Custom root template screen containing tiled SoftButtons with half-screen graphic.
- Can be set as a root screen.
- </description>
- </element>
- <element name="GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS" rootscreen="true">
- <description>
- Custom root template screen containing half-screen graphic with text and SoftButtons.
- Can be set as a root screen.
- </description>
- </element>
- <element name="TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC" rootscreen="true">
- <description>
- Custom root template screen containing text and SoftButtons with half-screen graphic.
- Can be set as a root screen.
- </description>
- </element>
- <element name="GRAPHIC_WITH_TEXTBUTTONS" rootscreen="true">
- <description>
- Custom root template screen containing half-screen graphic with text only SoftButtons.
- Can be set as a root screen.
- </description>
- </element>
- <element name="TEXTBUTTONS_WITH_GRAPHIC" rootscreen="true">
- <description>
- Custom root template screen containing text only SoftButtons with half-screen graphic.
- Can be set as a root screen.
- </description>
- </element>
- <element name="LARGE_GRAPHIC_WITH_SOFTBUTTONS" rootscreen="true">
- <description>
- Custom root template screen containing a large graphic and SoftButtons.
- Can be set as a root screen.
- </description>
- </element>
- <element name="DOUBLE_GRAPHIC_WITH_SOFTBUTTONS" rootscreen="true">
- <description>
- Custom root template screen containing two graphics and SoftButtons.
- Can be set as a root screen.
- </description>
- </element>
- <element name="LARGE_GRAPHIC_ONLY" rootscreen="true">
- <description>
- Custom root template screen containing only a large graphic.
- Can be set as a root screen.
- </description>
- </element>
- </enum>
- <enum name="FunctionID" internal_scope="base">
- <description>Enumeration linking function names with function IDs in AppLink protocol. Assumes enumeration starts at value 0.</description>
- <element name="RESERVED" value="0" />
- <!--
- Base Request / Response RPCs
- Range = 0x 0000 0001 - 0x 0000 7FFF
- -->
- <element name="RegisterAppInterfaceID" value="1" hexvalue="1" />
- <element name="UnregisterAppInterfaceID" value="2" hexvalue="2" />
- <element name="SetGlobalPropertiesID" value="3" hexvalue="3" />
- <element name="ResetGlobalPropertiesID" value="4" hexvalue="4" />
- <element name="AddCommandID" value="5" hexvalue="5" />
- <element name="DeleteCommandID" value="6" hexvalue="6" />
- <element name="AddSubMenuID" value="7" hexvalue="7" />
- <element name="DeleteSubMenuID" value="8" hexvalue="8" />
- <element name="CreateInteractionChoiceSetID" value="9" hexvalue="9" />
- <element name="PerformInteractionID" value="10" hexvalue="A" />
- <element name="DeleteInteractionChoiceSetID" value="11" hexvalue="B" />
- <element name="AlertID" value="12" hexvalue="C" />
- <element name="ShowID" value="13" hexvalue="D" />
- <element name="SpeakID" value="14" hexvalue="E" />
- <element name="SetMediaClockTimerID" value="15" hexvalue="F" />
- <element name="PerformAudioPassThruID" value="16" hexvalue="10" />
- <element name="EndAudioPassThruID" value="17" hexvalue="11" />
- <element name="SubscribeButtonID" value="18" hexvalue="12" />
- <element name="UnsubscribeButtonID" value="19" hexvalue="13" />
- <element name="SubscribeVehicleDataID" value="20" hexvalue="14" />
- <element name="UnsubscribeVehicleDataID" value="21" hexvalue="15" />
- <element name="GetVehicleDataID" value="22" hexvalue="16" />
- <element name="ReadDIDID" value="23" hexvalue="17" />
- <element name="GetDTCsID" value="24" hexvalue="18" />
- <element name="ScrollableMessageID" value="25" hexvalue="19" />
- <element name="SliderID" value="26" hexvalue="1A" />
- <element name="ShowConstantTBTID" value="27" hexvalue="1B" />
- <element name="AlertManeuverID" value="28" hexvalue="1C" />
- <element name="UpdateTurnListID" value="29" hexvalue="1D" />
- <element name="ChangeRegistrationID" value="30" hexvalue="1E" />
- <element name="GenericResponseID" value="31" hexvalue="1F" />
- <element name="PutFileID" value="32" hexvalue="20" />
- <element name="DeleteFileID" value="33" hexvalue="21" />
- <element name="ListFilesID" value="34" hexvalue="22" />
- <element name="SetAppIconID" value="35" hexvalue="23" />
- <element name="SetDisplayLayoutID" value="36" hexvalue="24" />
- <element name="DiagnosticMessageID" value="37" hexvalue="25" />
- <element name="SystemRequestID" value="38" hexvalue="26" />
- <element name="SendLocationID" value="39" hexvalue="27" />
- <element name="DialNumberID" value="40" hexvalue="28" />
- <element name="ButtonPressID" value="41" hexvalue="29" />
- <element name="GetInteriorVehicleDataID" value="43" hexvalue="2B" />
- <element name="SetInteriorVehicleDataID" value="44" hexvalue="2C" />
- <element name="GetWayPointsID" value="45" hexvalue="2D" />
- <element name="SubscribeWayPointsID" value="46" hexvalue="2E" />
- <element name="UnsubscribeWayPointsID" value="47" hexvalue="2F" />
- <element name="GetSystemCapabilityID" value="48" hexvalue="30" />
- <element name="SendHapticDataID" value="49" hexvalue="31" />
-
- <!--
- Base Notifications
- Range = 0x 0000 8000 - 0x 0000 FFFF
- -->
-
- <element name="OnHMIStatusID" value="32768" hexvalue="8000" />
- <element name="OnAppInterfaceUnregisteredID" value="32769" hexvalue="8001" />
- <element name="OnButtonEventID" value="32770" hexvalue="8002" />
- <element name="OnButtonPressID" value="32771" hexvalue="8003" />
- <element name="OnVehicleDataID" value="32772" hexvalue="8004" />
- <element name="OnCommandID" value="32773" hexvalue="8005" />
- <element name="OnTBTClientStateID" value="32774" hexvalue="8006" />
- <element name="OnDriverDistractionID" value="32775" hexvalue="8007" />
- <element name="OnPermissionsChangeID" value="32776" hexvalue="8008" />
- <element name="OnAudioPassThruID" value="32777" hexvalue="8009" />
- <element name="OnLanguageChangeID" value="32778" hexvalue="800A" />
- <element name="OnKeyboardInputID" value="32779" hexvalue="800B" />
- <element name="OnTouchEventID" value="32780" hexvalue="800C" />
- <element name="OnSystemRequestID" value="32781" hexvalue="800D" />
- <element name="OnHashChangeID" value="32782" hexvalue="800E" />
- <element name="OnInteriorVehicleDataID" value="32783" hexvalue="800F" />
- <element name="OnWayPointChangeID" value="32784" hexvalue="8010" />
-
- <!--
- Ford Specific Request / Response RPCs
- Range = 0x 0001 0000 - 0x 0001 7FFF
- -->
-
- <element name="EncodedSyncPDataID" value="65536" hexvalue="10000" />
- <element name="SyncPDataID" value="65537" hexvalue="10001" />
-
- <!--
- Ford Specific Notifications
- Range = 0x 0001 8000 - 0x 0001 FFFF
- -->
-
- <element name="OnEncodedSyncPDataID" value="98304" hexvalue="18000" />
- <element name="OnSyncPDataID" value="98305" hexvalue="18001" />
- </enum>
-
- <enum name="messageType">
- <description>
- Enumeration linking message types with function types in WiPro protocol.
- Assumes enumeration starts at value 0.
- </description>
- <element name="request" value="0" />
- <element name="response" value="1" />
- <element name="notification" value="2" />
- </enum>
-
- <struct name="DateTime">
- <param name="millisecond" type="Integer" minvalue="0" maxvalue="999" mandatory="false">
- <description>Milliseconds </description>
- </param>
- <param name="second" type="Integer" minvalue="0" maxvalue="60" mandatory="false">
- <description>Seconds part of time</description>
- </param>
- <param name="minute" type="Integer" minvalue="0" maxvalue="59" mandatory="false">
- <description>Minutes part of time</description>
- </param>
- <param name="hour" type="Integer" minvalue="0" maxvalue="23" mandatory="false">
- <description>Hours part of time. Note that this structure accepts time only in 24 Hr format</description>
- </param>
- <param name="day" type="Integer" minvalue="1" maxvalue="31" mandatory="false">
- <description>Day of the month</description>
- </param>
- <param name="month" type="Integer" minvalue="1" maxvalue="12" mandatory="false">
- <description>Month of the year</description>
- </param>
- <param name="year" type="Integer" maxvalue="4095" mandatory="false">
- <description>The year in YYYY format</description>
- </param>
- <param name="tz_hour" type="Integer" minvalue="-12" maxvalue="14" defvalue="0" mandatory="false">
- <description>Time zone offset in Hours wrt UTC.</description>
- </param>
- <param name="tz_minute" type="Integer" minvalue="0" maxvalue="59" defvalue="0" mandatory="false">
- <description>Time zone offset in Min wrt UTC.</description>
- </param>
- </struct>
-
- <enum name="WayPointType">
- <description>Describes what kind of waypoint is requested/provided.</description>
- <element name="ALL" />
- <element name="DESTINATION" />
- </enum>
-
- <struct name="Coordinate">
- <param name="latitudeDegrees" minvalue="-90" maxvalue="90" type="Float" mandatory="true">
- <description>Latitude of the location.</description>
- </param>
- <param name="longitudeDegrees" minvalue="-180" maxvalue="180" type="Float" mandatory="true">
- <description>Longitude of the location.</description>
- </param>
- </struct>
-
- <struct name="OASISAddress">
- <param name="countryName" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Name of the country (localized)</description>
- </param>
- <param name="countryCode" minlength="0" maxlength="50" type="String" mandatory="false">
- <description>Name of country (ISO 3166-2)</description>
- </param>
- <param name="postalCode" minlength="0" maxlength="16" type="String" mandatory="false">
- <description>(PLZ, ZIP, PIN, CAP etc.)</description>
- </param>
- <param name="administrativeArea" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Portion of country (e.g. state)</description>
- </param>
- <param name="subAdministrativeArea" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Portion of e.g. state (e.g. county)</description>
- </param>
- <param name="locality" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Hypernym for e.g. city/village</description>
- </param>
- <param name="subLocality" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Hypernym for e.g. district</description>
- </param>
- <param name="thoroughfare" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Hypernym for street, road etc.</description>
- </param>
- <param name="subThoroughfare" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Portion of thoroughfare e.g. house number</description>
- </param>
- </struct>
-
- <struct name="LocationDetails">
- <param name="coordinate" type="Coordinate" mandatory="false">
- <description>Latitude/Longitude of the location.</description>
- </param>
- <param name="locationName" type="String" maxlength="500" mandatory="false">
- <description>Name of location.</description>
- </param>
- <param name="addressLines" type="String" maxlength="500" minsize="0" maxsize="4" array="true" mandatory="false">
- <description>Location address for display purposes only</description>
- </param>
- <param name="locationDescription" type="String" maxlength="500" mandatory="false">
- <description>Description intended location / establishment (if applicable)</description>
- </param>
- <param name="phoneNumber" type="String" maxlength="500" mandatory="false">
- <description>Phone number of location / establishment.</description>
- </param>
- <param name="locationImage" type="Image" mandatory="false">
- <description>Image / icon of intended location.</description>
- </param>
- <param name="searchAddress" type="OASISAddress" mandatory="false">
- <description>Address to be used by navigation engines for search</description>
- </param>
- </struct>
-
- <enum name="SystemCapabilityType">
- <description>Enumerations of all available system capability types</description>
- <element name="NAVIGATION"/>
- <element name="PHONE_CALL"/>
- <element name="VIDEO_STREAMING"/>
- <element name="REMOTE_CONTROL"/>
- </enum>
-
- <struct name="NavigationCapability">
- <description>Extended capabilities for an onboard navigation system</description>
- <param name="sendLocationEnabled" type="Boolean" mandatory="false">
- <description>If the module has the ability to add locations to the onboard nav</description>
- </param>
- <param name="getWayPointsEnabled" type="Boolean" mandatory="false">
- <description>If the module has the ability to return way points from onboard nav</description>
- </param>
- </struct>
-
- <struct name="PhoneCapability">
- <description>Extended capabilities of the module's phone feature</description>
- <param name="dialNumberEnabled" type="Boolean" mandatory="false">
- <description>If the module has the ability to perform dial number</description>
- </param>
- </struct>
-
- <struct name="VideoStreamingFormat">
- <description>Video streaming formats and their specifications.</description>
- <param name="protocol" type="VideoStreamingProtocol" mandatory="true">
- <description>Protocol type, see VideoStreamingProtocol</description>
- </param>
- <param name="codec" type="VideoStreamingCodec" mandatory="true">
- <description>Codec type, see VideoStreamingCodec</description>
- </param>
- </struct>
-
- <struct name="VideoStreamingCapability">
- <description>Contains information about this system's video streaming capabilities.</description>
- <param name="preferredResolution" type="ImageResolution" mandatory="false">
- <description>The preferred resolution of a video stream for decoding and rendering on HMI.</description>
- </param>
- <param name="maxBitrate" type="Integer" minvalue="0" maxvalue="2147483647" mandatory="false">
- <description>The maximum bitrate of video stream that is supported, in kbps.</description>
- </param>
- <param name="supportedFormats" type="VideoStreamingFormat" array="true" mandatory="false">
- <description>Detailed information on each format supported by this system, in its preferred order (i.e. the first element in the array is most preferable to the system). Each object will contain a VideoStreamingFormat that describes what can be expected.</description>
- </param>
- <param name="hapticSpatialDataSupported" type="Boolean" mandatory="false">
- <description>True if the system can utilize the haptic spatial data from the source being streamed. If not included, it can be assumed the module doesn't support haptic spatial data'. </description>
- </param>
- </struct>
-
- <!---Remote control -->
-
- <struct name="Temperature">
- <param name="unit" type="TemperatureUnit" mandatory="true">
- <description>Temperature Unit</description>
- </param>
- <param name="value" type="Float" mandatory="true">
- <description>Temperature Value in TemperatureUnit specified unit. Range depends on OEM and is not checked by SDL.</description>
- </param>
- </struct>
-
- <struct name="RdsData">
- <param name="PS" type="String" minlength="0" maxlength="8" mandatory="false">
- <description>Program Service Name</description>
- </param>
- <param name="RT" type="String" minlength="0" maxlength="64" mandatory="false">
- <description>Radio Text</description>
- </param>
- <param name="CT" type="String" minlength="24" maxlength="24" mandatory="false">
- <description>The clock text in UTC format as YYYY-MM-DDThh:mm:ss.sTZD</description>
- </param>
- <param name="PI" type="String" minlength="0" maxlength="6" mandatory="false">
- <description>Program Identification - the call sign for the radio station</description>
- </param>
- <param name="PTY" type="Integer" minvalue="0" maxvalue="31" mandatory="false">
- <description>The program type - The region should be used to differentiate between EU and North America program types</description>
- </param>
- <param name="TP" type="Boolean" mandatory="false">
- <description>Traffic Program Identification - Identifies a station that offers traffic</description>
- </param>
- <param name="TA" type="Boolean" mandatory="false">
- <description>Traffic Announcement Identification - Indicates an ongoing traffic announcement</description>
- </param>
- <param name="REG" type="String" mandatory="false">
- <description>Region</description>
- </param>
- </struct>
-
- <struct name="RadioControlData">
- <param name="frequencyInteger" type="Integer" minvalue="0" maxvalue="1710" mandatory="false">
- <description>The integer part of the frequency ie for 101.7 this value should be 101</description>
- </param>
- <param name="frequencyFraction" type="Integer" minvalue="0" maxvalue="9" mandatory="false">
- <description>The fractional part of the frequency for 101.7 is 7</description>
- </param>
- <param name="band" type="RadioBand" mandatory="false">
- </param>
- <param name="rdsData" type="RdsData" mandatory="false">
- </param>
- <param name="availableHDs" type="Integer" minvalue="1" maxvalue="3" mandatory="false">
- <description>number of HD sub-channels if available</description>
- </param>
- <param name="hdChannel" type="Integer" minvalue="1" maxvalue="3" mandatory="false">
- <description>Current HD sub-channel if available</description>
- </param>
- <param name="signalStrength" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
- </param>
- <param name="signalChangeThreshold" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
- <description>If the signal strength falls below the set value for this parameter, the radio will tune to an alternative frequency</description>
- </param>
- <param name="radioEnable" type="Boolean" mandatory="false">
- <description> True if the radio is on, false is the radio is off</description>
- </param>
- <param name="state" type="RadioState" mandatory="false">
- </param>
- </struct>
-
- <struct name="ClimateControlData">
- <param name="fanSpeed" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
- </param>
- <param name="currentTemperature" type="Temperature" mandatory="false">
- </param>
- <param name="desiredTemperature" type="Temperature" mandatory="false">
- </param>
- <param name="acEnable" type="Boolean" mandatory="false">
- </param>
- <param name="circulateAirEnable" type="Boolean" mandatory="false">
- </param>
- <param name="autoModeEnable" type="Boolean" mandatory="false">
- </param>
- <param name="defrostZone" type="DefrostZone" mandatory="false">
- </param>
- <param name="dualModeEnable" type="Boolean" mandatory="false">
- </param>
- <param name="acMaxEnable" type="Boolean" mandatory="false">
- </param>
- <param name="ventilationMode" type="VentilationMode" mandatory="false">
- </param>
- </struct>
-
- <struct name="ModuleData">
- <description>The moduleType indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the moduleType is CLIMATE then a "climateControlData" should exist</description>
- <param name="moduleType" type="ModuleType" mandatory="true">
- </param>
- <param name="radioControlData" type="RadioControlData" mandatory="false">
- </param>
- <param name="climateControlData" type="ClimateControlData" mandatory="false">
- </param>
- </struct>
-
- <struct name="RadioControlCapabilities">
- <description>Contains information about a radio control module's capabilities.</description>
- <!-- need an ID in the future -->
- <param name="moduleName" type="String" maxlength="100" mandatory="true">
- <description>
- The short friendly name of the climate control module.
- It should not be used to identify a module by mobile application.
- </description>
- </param>
- <param name="radioEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of enable/disable radio.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="radioBandAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of radio band.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="radioFrequencyAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of radio frequency.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="hdChannelAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of HD radio channel.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="rdsDataAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the getting Radio Data System (RDS) data.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="availableHDsAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the getting the number of available HD channels.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="stateAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the getting the Radio state.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="signalStrengthAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the getting the signal strength.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="signalChangeThresholdAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the getting the signal Change Threshold.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- </struct>
-
- <struct name="ClimateControlCapabilities">
- <description>Contains information about a climate control module's capabilities.</description>
- <!-- need an ID in the future -->
- <param name="moduleName" type="String" maxlength="100" mandatory="true">
- <description>The short friendly name of the climate control module.
- It should not be used to identify a module by mobile application.</description>
- </param>
- <param name="fanSpeedAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of fan speed.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="desiredTemperatureAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of desired temperature.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="acEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of turn on/off AC.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="acMaxEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of enable/disable air conditioning is ON on the maximum level.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="circulateAirEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of enable/disable circulate Air mode.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="autoModeEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of enable/disable auto mode.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="dualModeEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of enable/disable dual mode.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="defrostZoneAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of defrost zones.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="defrostZone" type="DefrostZone" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- A set of all defrost zones that are controllable.
- </description>
- </param>
- <param name="ventilationModeAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of air ventilation mode.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="ventilationMode" type="VentilationMode" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- A set of all ventilation modes that are controllable.
- </description>
- </param>
- </struct>
-
- <struct name="RemoteControlCapabilities">
- <param name="climateControlCapabilities" type="ClimateControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
- <description>If included, the platform supports RC climate controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description >
- </param>
- <param name="radioControlCapabilities" type="RadioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
- <description>If included, the platform supports RC radio controls.For this baseline version, maxsize=1. i.e. only one radio control module is supported.</description >
- </param>
- <param name="buttonCapabilities" type="ButtonCapabilities" mandatory="false" minsize="1" maxsize="100" array="true" >
- <description>If included, the platform supports RC button controls with the included button names.</description >
- </param>
- </struct>
-
- <!-- End of RC -->
- <struct name="SystemCapability">
- <description>The systemCapabilityType indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist</description>
- <param name="systemCapabilityType" type="SystemCapabilityType" mandatory="true">
- <description>Used as a descriptor of what data to expect in this struct. The corresponding param to this enum should be included and the only other para included.</description>
- </param>
- <param name="navigationCapability" type="NavigationCapability" mandatory="false">
- <description>Describes extended capabilities for onboard navigation system </description>
- </param>
- <param name="phoneCapability" type="PhoneCapability" mandatory="false">
- <description>Describes extended capabilities of the module's phone feature</description>
- </param>
- <param name="videoStreamingCapability" type="VideoStreamingCapability" mandatory="false">
- <description>Describes extended capabilities of the module's phone feature</description>
- </param>
- <param name="remoteControlCapability" type="RemoteControlCapabilities" mandatory="false">
- <description>Describes extended capabilities of the module's phone feature</description>
- </param>
- </struct>
-
- <enum name="MetadataType">
- <element name="mediaTitle">
- <description>The data in this field contains the title of the currently playing audio track.</description>
- </element>
- <element name="mediaArtist">
- <description>The data in this field contains the artist or creator of the currently playing audio track.</description>
- </element>
- <element name="mediaAlbum">
- <description>The data in this field contains the album title of the currently playing audio track.</description>
- </element>
- <element name="mediaYear">
- <description>The data in this field contains the creation year of the currently playing audio track.</description>
- </element>
- <element name="mediaGenre">
- <description>The data in this field contains the genre of the currently playing audio track.</description>
- </element>
- <element name="mediaStation">
- <description>The data in this field contains the name of the current source for the media.</description>
- </element>
- <element name="rating">
- <description>The data in this field is a rating.</description>
- </element>
- <element name="currentTemperature">
- <description>The data in this field is the current temperature.</description>
- </element>
- <element name="maximumTemperature">
- <description>The data in this field is the maximum temperature for the day.</description>
- </element>
- <element name="minimumTemperature">
- <description>The data in this field is the minimum temperature for the day.</description>
- </element>
- <element name="weatherTerm">
- <description>The data in this field describes the current weather (ex. cloudy, clear, etc.).</description>
- </element>
- <element name="humidity">
- <description>The data in this field describes the current humidity value.</description>
- </element>
- </enum>
-
- <struct name="MetadataTags">
- <param name="mainField1" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
- <description>The type of data contained in the "mainField1" text field.</description>
- </param>
- <param name="mainField2" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
- <description>The type of data contained in the "mainField2" text field.</description>
- </param>
- <param name="mainField3" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
- <description>The type of data contained in the "mainField3" text field.</description>
- </param>
- <param name="mainField4" type="MetadataType" minsize="0" maxsize="5" array="true" mandatory="false">
- <description>The type of data contained in the "mainField4" text field.</description>
- </param>
- </struct>
-
- <struct name="Rectangle">
- <param name="x" type="Float" mandatory="true">
- <description>The upper left X-coordinate of the rectangle</description>
- </param>
- <param name="y" type="Float" mandatory="true">
- <description>The upper left Y-coordinate of the rectangle</description>
- </param>
- <param name="width" type="Float" mandatory="true">
- <description>The width of the rectangle</description>
- </param>
- <param name="height" type="Float" mandatory="true">
- <description>The height of the rectangle</description>
- </param>
- </struct>
-
- <struct name="HapticRect">
- <description>Defines haptic data for each user control object for video streaming application</description>
- <param name="id" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>A user control spatial identifier</description>
- </param>
- <param name="rect" type="Rectangle" mandatory="true">
- <description>The position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.</description>
- </param>
- </struct>
-
- <struct name="RGBColor">
- <param name="red" type="Integer" minvalue="0" maxvalue="255" mandatory="true" />
- <param name="green" type="Integer" minvalue="0" maxvalue="255" mandatory="true" />
- <param name="blue" type="Integer" minvalue="0" maxvalue="255" mandatory="true" />
- </struct>
-
- <struct name="TemplateColorScheme">
- <description>
- A color scheme for all display layout templates.
- </description>
- <param name="primaryColor" type="RGBColor" mandatory="false">
- <description>The primary "accent" color</description>
- </param>
- <param name="secondaryColor" type="RGBColor" mandatory="false">
- <description>The secondary "accent" color</description>
- </param>
- <param name="backgroundColor" type="RGBColor" mandatory="false">
- <description>The color of the background</description>
- </param>
- </struct>
- <!-- Requests/Responses -->
-
- <function name="RegisterAppInterface" functionID="RegisterAppInterfaceID" messagetype="request">
- <description>
- Establishes an interface with a mobile application.
- Before registerAppInterface no other commands will be accepted/executed.
- </description>
-
- <param name="syncMsgVersion" type="SyncMsgVersion" mandatory="true">
- <description>See SyncMsgVersion</description>
- </param>
-
- <param name="appName" type="String" maxlength="100" mandatory="true">
- <description>
- The mobile application name, e.g. "Ford Drive Green".
- Needs to be unique over all applications.
- May not be empty.
- May not start with a new line character.
- May not interfere with any name or synonym of previously registered applications and any predefined blacklist of words (global commands)
- Needs to be unique over all applications. Applications with the same name will be rejected.
- Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
- </description>
- </param>
-
- <param name="ttsName" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
- <description>
- TTS string for VR recognition of the mobile application name, e.g. "Ford Drive Green".
- Meant to overcome any failing on speech engine in properly pronouncing / understanding app name.
- Needs to be unique over all applications.
- May not be empty.
- May not start with a new line character.
- Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
- </description>
- </param>
-
- <param name="ngnMediaScreenAppName" type="String" maxlength="100" mandatory="false">
- <description>
- Provides an abbreviated version of the app name (if needed), that will be displayed on the NGN media screen.
- If not provided, the appName is used instead (and will be truncated if too long)
- Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
- </description>
- </param>
-
- <param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- Defines an additional voice recognition command.
- May not interfere with any app name of previously registered applications and any predefined blacklist of words (global commands)
- Only characters from char set [@TODO: Create char set (character/hex value) for each ACM and refer to] are supported.
- </description>
- </param>
-
- <param name="isMediaApplication" type="Boolean" mandatory="true">
- <description>
- Indicates if the application is a media or a non-media application.
- Only media applications will be able to stream audio to the module that is audible outside of the BT media source.
- </description>
- </param>
- <param name="languageDesired" type="Language" mandatory="true">
- <description>
- See Language
- Current app's expected VR+TTS language
- If there is a mismatch with the module, the app will be able to change this registration with changeRegistration prior to app being brought into focus.
- </description>
- </param>
- <param name="hmiDisplayLanguageDesired" type="Language" mandatory="true">
- <description>
- See Language
- Current app's expected display language
- If there is a mismatch with the module, the app will be able to change this registration with changeRegistration prior to app being brought into focus.
- </description>
- </param>
-
- <param name="appHMIType" type="AppHMIType" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- See AppHMIType
- List of all applicable app HMI types stating which HMI classifications to be given to the app.
- </description>
- </param>
-
- <param name="hashID" type="String" maxlength="100" mandatory="false">
- <description>
- ID used to uniquely identify current state of all app data that can persist through connection cycles (e.g. ignition cycles).
- This registered data (commands, submenus, choice sets, etc.) can be reestablished without needing to explicitly reregister each piece.
- If omitted, then the previous state of an app's commands, etc. will not be restored.
- When sending hashID, all RegisterAppInterface parameters should still be provided (e.g. ttsName, etc.).
- </description>
- </param>
- <param name="deviceInfo" type="DeviceInfo" mandatory="false">
- <description>
- See DeviceInfo.
- </description>
- </param>
- <param name="appID" type="String" maxlength="100" mandatory="true">
- <description>ID used to validate app with policy table entries</description>
- </param>
- <param name="appInfo" type="AppInfo" mandatory="false">
- <description>
- See AppInfo.
- </description>
- </param>
-
- <param name="dayColorScheme" type="TemplateColorScheme" mandatory="false"/>
-
- <param name="nightColorScheme" type="TemplateColorScheme" mandatory="false"/>
- </function>
-
- <function name="RegisterAppInterface" functionID="RegisterAppInterfaceID" messagetype="response">
- <description>The response to registerAppInterface</description>
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="GENERIC_ERROR"/>
- <element name="DUPLICATE_NAME"/>
- <element name="TOO_MANY_APPLICATIONS"/>
- <element name="APPLICATION_REGISTERED_ALREADY"/>
- <element name="UNSUPPORTED_VERSION"/>
- <element name="WRONG_LANGUAGE"/>
- <element name="DISALLOWED"/>
- <element name="WARNINGS"/>
- <element name="RESUME_FAILED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- <param name="syncMsgVersion" type="SyncMsgVersion" mandatory="false">
- <description>See SyncMsgVersion</description>
- </param>
-
- <param name="language" type="Language" mandatory="false">
- <description>The currently active VR+TTS language on the module. See "Language" for options.</description>
- </param>
-
- <param name="hmiDisplayLanguage" type="Language" mandatory="false">
- <description>The currently active display language on the module. See "Language" for options.</description>
- </param>
-
- <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false">
- <description>See DisplayCapabilities</description>
- </param>
-
- <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See ButtonCapabilities</description >
- </param>
-
- <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
- </param>
-
- <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false">
- <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
- </param>
- <param name="hmiZoneCapabilities" type="HmiZoneCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See HmiZoneCapabilities</description>
- </param>
- <param name="speechCapabilities" type="SpeechCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See SpeechCapabilities</description>
- </param>
-
- <param name="prerecordedSpeech" type="PrerecordedSpeech" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See PrerecordedSpeech</description>
- </param>
-
- <param name="vrCapabilities" type="VrCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See VrCapabilities</description>
- </param>
-
- <param name="audioPassThruCapabilities" type="AudioPassThruCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See AudioPassThruCapability</description>
- </param>
-
- <param name="pcmStreamCapabilities" type="AudioPassThruCapabilities" array="false" mandatory="false">
- <description>See AudioPassThruCapability</description>
- </param>
-
- <param name="vehicleType" type="VehicleType" mandatory="false">
- <description>Specifies the vehicle's type. See VehicleType.</description>
- </param>
-
- <param name="supportedDiagModes" type="Integer" minvalue="0" maxvalue="255" array="true" minsize="1" maxsize="100" mandatory="false" >
- <description>
- Specifies the white-list of supported diagnostic modes (0x00-0xFF) capable for DiagnosticMessage requests.
- If a mode outside this list is requested, it will be rejected.
- </description>
- </param>
-
- <param name="hmiCapabilities" type="HMICapabilities" mandatory="false">
- <description>Specifies the HMI’s capabilities. See HMICapabilities.</description>
- </param>
-
- <param name="sdlVersion" type="String" maxlength="100" mandatory="false" platform="documentation">
- <description>The SmartDeviceLink version.</description>
- </param>
-
- <param name="systemSoftwareVersion" type="String" maxlength="100" mandatory="false" platform="documentation">
- <description>The software version of the system that implements the SmartDeviceLink core.</description>
- </param>
- <param name="iconResumed" type="Boolean" mandatory="true">
- <description>Existence of apps icon at system. If true, apps icon
- was resumed at system. If false, apps icon is not resumed at system</description>
- </param>
- </function>
-
- <function name="UnregisterAppInterface" functionID="UnregisterAppInterfaceID" messagetype="request">
- <description>
- Closes an interface from a mobile application.
- After unregisterAppInterface, no commands other than registerAppInterface will be accepted/executed.
- Will fail, if no registerAppInterface was completed successfully before.
- </description>
- </function>
-
- <function name="UnregisterAppInterface" functionID="UnregisterAppInterfaceID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- </function>
-
- <function name="SetGlobalProperties" functionID="SetGlobalPropertiesID" messagetype="request">
- <description>Allows setting global properties.</description>
-
- <param name="helpPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
- <description>
- The help prompt.
- An array of text chunks of type TTSChunk. See TTSChunk.
- The array must have at least one item.
- </description>
- </param>
-
- <param name="timeoutPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
- <description>
- Help text for a wait timeout.
- An array of text chunks of type TTSChunk. See TTSChunk.
- The array must have at least one item.
- </description>
- </param>
-
- <param name="vrHelpTitle" type="String" maxlength="500" mandatory="false">
- <description>
- VR Help Title text.
- If omitted on supported displays, the default module help title shall be used.
- If omitted and one or more vrHelp items are provided, the request will be rejected.
- </description>
- </param>
-
- <param name="vrHelp" type="VrHelpItem" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- VR Help Items.
- If omitted on supported displays, the default AppLink VR help / What Can I Say? screen shall be used.
- If the list of VR Help Items contains nonsequential positions (e.g. [1,2,4]), the RPC shall be rejected.
- If omitted and a vrHelpTitle is provided, the request will be rejected.
- </description>
- </param>
- <param name="menuTitle" maxlength="500" type="String" mandatory="false">
- <description>Optional text to label an app menu button (for certain touchscreen platforms).</description>
- </param>
-
- <param name="menuIcon" type="Image" mandatory="false">
- <description>>Optional icon to draw on an app menu button (for certain touchscreen platforms).</description>
- </param>
-
- <param name="keyboardProperties" type="KeyboardProperties" mandatory="false">
- <description>On-screen keyboard configuration (if available).</description>
- </param>
- </function>
-
- <function name="SetGlobalProperties" functionID="SetGlobalPropertiesID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="WARNINGS"/>
- <element name="DISALLOWED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- </function>
-
- <function name="ResetGlobalProperties" functionID="ResetGlobalPropertiesID" messagetype="request">
- <description>Allows resetting global properties.</description>
-
- <param name="properties" type="GlobalProperty" minsize="1" maxsize="100" array="true" mandatory="true">
- <description>Contains the names of all global properties (like timeoutPrompt) that should be unset. Resetting means, that they have the same value as at start up (default)</description>
- </param>
- </function>
-
- <function name="ResetGlobalProperties" functionID="ResetGlobalPropertiesID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="DISALLOWED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="AddCommand" functionID="AddCommandID" messagetype="request">
- <description>
- Adds a command to the in application menu.
- Either menuParams or vrCommands must be provided.
- </description>
-
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>unique ID of the command to add.</description>
- </param>
-
- <param name="menuParams" type="MenuParams" mandatory="false">
- <description>Optional sub value containing menu parameters</description>
- </param>
-
- <param name="vrCommands" type="String" minsize="1" maxsize="100" maxlength="99" array="true" mandatory="false">
- <description>
- An array of strings to be used as VR synonyms for this command.
- If this array is provided, it may not be empty.
- </description>
- </param>
-
- <param name="cmdIcon" type="Image" mandatory="false">
- <description>
- Image struct determining whether static or dynamic icon.
- If omitted on supported displays, no (or the default if applicable) icon shall be displayed.
- </description>
- </param>
-
- </function>
-
- <function name="AddCommand" functionID="AddCommandID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="INVALID_ID"/>
- <element name="DUPLICATE_NAME"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="DISALLOWED"/>
- <element name="WARNINGS"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- </function>
-
- <function name="DeleteCommand" functionID="DeleteCommandID" messagetype="request">
- <description>Deletes all commands from the in-application menu with the specified command id.</description>
-
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>ID of the command(s) to delete.</description>
- </param>
-
- </function>
-
- <function name="DeleteCommand" functionID="DeleteCommandID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="INVALID_ID"/>
- <element name="IN_USE"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- </function>
-
- <function name="AddSubMenu" functionID="AddSubMenuID" messagetype="request">
- <description>Adds a sub menu to the in-application menu.</description>
-
- <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="true">
- <description>unique ID of the sub menu to add.</description>
- </param>
-
- <param name="position" type="Integer" minvalue="0" maxvalue="1000" defvalue="1000" mandatory="false">
- <description>
- Position within the items that are are at top level of the in application menu.
- 0 will insert at the front.
- 1 will insert at the second position.
- If position is greater or equal than the number of items on top level, the sub menu will be appended to the end.
- Position of any submenu will always be located before the return and exit options
- If this param was omitted the entry will be added at the end.
- </description>
- </param>
-
- <param name="menuName" maxlength="500" type="String" mandatory="true">
- <description>Text to show in the menu for this sub menu.</description>
- </param>
- <param name="menuIcon" type="Image" mandatory="false">
- <description>The image field for AddSubMenu</description>
- </param>
- </function>
-
- <function name="AddSubMenu" functionID="AddSubMenuID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="INVALID_ID"/>
- <element name="DUPLICATE_NAME"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="DeleteSubMenu" functionID="DeleteSubMenuID" messagetype="request">
- <description>Deletes a submenu from the in-application menu.</description>
-
- <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="true">
- <description>The "menuID" of the submenu to delete. (See addSubMenu.menuID)</description>
- </param>
-
- </function>
-
- <function name="DeleteSubMenu" functionID="DeleteSubMenuID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="INVALID_ID"/>
- <element name="IN_USE"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- </function>
-
- <function name="CreateInteractionChoiceSet" functionID="CreateInteractionChoiceSetID" messagetype="request">
- <description>creates interaction choice set to be used later by performInteraction</description>
-
- <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>Unique ID used for this interaction choice set.</description>
- </param>
-
- <param name="choiceSet" type="Choice" minsize="1" maxsize="100" array="true" mandatory="true"/>
- </function>
-
- <function name="CreateInteractionChoiceSet" functionID="CreateInteractionChoiceSetID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="INVALID_ID"/>
- <element name="DUPLICATE_NAME"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="PerformInteraction" functionID="PerformInteractionID" messagetype="request">
- <description>Triggers an interaction (e.g. "Permit GPS?" - Yes, no, Always Allow).</description>
-
- <param name="initialText" type="String" maxlength="500" mandatory="true">
- <description>
- Text to be displayed first.
- </description>
- </param>
-
- <param name="initialPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- This is the initial prompt spoken to the user at the start of an interaction.
- An array of text chunks of type TTSChunk. See TTSChunk.
- The array must have at least one item.
- </description>
- </param>
-
- <param name="interactionMode" type="InteractionMode" mandatory="true">
- <description>See InteractionMode.</description>
- </param>
-
- <param name="interactionChoiceSetIDList" type="Integer" minsize="0" maxsize="100" minvalue="0" maxvalue="2000000000" array="true" mandatory="true">
- <description>List of interaction choice set IDs to use with an interaction.</description>
- </param>
-
- <param name="helpPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- Help text. This is the spoken string when a user speaks "help" when the interaction is occurring.
- An array of text chunks of type TTSChunk. See TTSChunk.
- The array must have at least one item.
- </description>
- </param>
-
- <param name="timeoutPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- Timeout text. This text is spoken when a VR interaction times out.
- An array of text chunks of type TTSChunk. See TTSChunk.
- The array must have at least one item.
- </description>
- </param>
-
- <param name="timeout" type="Integer" minvalue="5000" maxvalue="100000" defvalue="10000" mandatory="false">
- <description>
- Timeout in milliseconds.
- If omitted a standard value of 10000 milliseconds is used.
- Applies only to the menu portion of the interaction. The VR timeout will be handled by the platform.
- </description>
- </param>
-
- <param name="vrHelp" type="VrHelpItem" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- Ability to send suggested VR Help Items to display on-screen during Perform Interaction.
- If omitted on supported displays, the default generated list of suggested choices shall be displayed.
- </description>
- </param>
-
- <param name="interactionLayout" type="LayoutMode" mandatory="false">
- <description>See LayoutMode.</description>
- </param>
-
- </function>
-
- <function name="PerformInteraction" functionID="PerformInteractionID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="INVALID_ID"/>
- <element name="DUPLICATE_NAME"/>
- <element name="TIMED_OUT"/>
- <element name="ABORTED"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="WARNINGS"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- <param name="choiceID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
- <description>
- ID of the choice that was selected in response to PerformInteraction.
- Only is valid if general result is "success:true".
- </description>
- </param>
-
- <param name="manualTextEntry" type="String" maxlength="500" mandatory="false">
- <description>
- Manually entered text selection, e.g. through keyboard
- Can be returned in lieu of choiceID, depending on trigger source
- </description>
- </param>
-
- <param name="triggerSource" type="TriggerSource" mandatory="false">
- <description>
- See TriggerSource
- Only is valid if resultCode is SUCCESS.
- </description>
- </param>
-
- </function>
-
- <function name="DeleteInteractionChoiceSet" functionID="DeleteInteractionChoiceSetID" messagetype="request">
- <description>Deletes interaction choice set that has been created with "CreateInteractionChoiceSet".</description>
- <description>The interaction may only be deleted when not currently in use by a "performInteraction".</description>
-
- <param name="interactionChoiceSetID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>ID of the interaction choice set to delete.</description>
- </param>
- </function>
-
- <function name="DeleteInteractionChoiceSet" functionID="DeleteInteractionChoiceSetID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="INVALID_ID"/>
- <element name="IN_USE"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="Alert" functionID="AlertID" messagetype="request">
- <description>Shows an alert which typically consists of text-to-speech message and text on the display. At least either alertText1, alertText2 or TTSChunks need to be provided.</description>
-
- <param name="alertText1" type="String" maxlength="500" mandatory="false">
- <description>The first line of the alert text field</description>
- </param>
-
- <param name="alertText2" type="String" maxlength="500" mandatory="false">
- <description>The second line of the alert text field</description>
- </param>
-
- <param name="alertText3" type="String" maxlength="500" mandatory="false">
- <description>The optional third line of the alert text field</description>
- </param>
-
- <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- An array of text chunks of type TTSChunk. See TTSChunk.
- The array must have at least one item.
- </description>
- </param>
-
- <param name="duration" type="Integer" minvalue="3000" maxvalue="10000" defvalue="5000" mandatory="false">
- <description>
- Timeout in milliseconds.
- Typical timeouts are 3-5 seconds.
- If omitted, timeout is set to 5s.
- </description>
- </param>
-
- <param name="playTone" type="Boolean" mandatory="false">
- <description>
- Defines if tone should be played. Tone is played before TTS.
- If omitted, no tone is played.
- </description>
- </param>
-
- <param name="progressIndicator" type="Boolean" mandatory="false">
- <description>
- If supported on the given platform, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.
- </description>
- </param>
-
- <param name="softButtons" type="SoftButton" minsize="0" maxsize="4" array="true" mandatory="false">
- <description>
- App defined SoftButtons.
- If omitted on supported displays, the displayed alert shall not have any SoftButtons.
- </description>
- </param>
-
- </function>
-
- <function name="Alert" functionID="AlertID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="ABORTED"/>
- <element name="DISALLOWED"/>
- <element name="USER_DISALLOWED"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="WARNINGS"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- <param name="tryAgainTime" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
- <description>
- Amount of time (in seconds) that an app must wait before resending an alert.
- If provided, another system event or overlay currently has a higher priority than this alert.
- An app must not send an alert without waiting at least the amount of time dictated.
- </description>
- </param>
-
- </function>
-
- <function name="Show" functionID="ShowID" messagetype="request">
- <description>Updates the persistent display. Supported fields depend on display capabilities.</description>
-
- <param name="mainField1" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>
- The text that should be displayed in a single or upper display line.
- If this text is not set, the text of mainField1 stays unchanged.
- If this text is empty "", the field will be cleared.
- </description>
- </param>
-
- <param name="mainField2" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>
- The text that should be displayed on the second display line.
- If this text is not set, the text of mainField2 stays unchanged.
- If this text is empty "", the field will be cleared.
- </description>
- </param>
-
- <param name="mainField3" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>
- The text that should be displayed on the second "page" first display line.
- If this text is not set, the text of mainField3 stays unchanged.
- If this text is empty "", the field will be cleared.
- </description>
- </param>
-
- <param name="mainField4" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>
- The text that should be displayed on the second "page" second display line.
- If this text is not set, the text of mainField4 stays unchanged.
- If this text is empty "", the field will be cleared.
- </description>
- </param>
-
- <param name="alignment" type="TextAlignment" mandatory="false">
- <description>
- Specifies how mainField1 and mainField2 texts should be aligned on display.
- If omitted, texts will be centered.
- </description>
- </param>
-
- <param name="statusBar" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>Requires investigation regarding the nav display capabilities. Potentially lower lowerStatusBar, upperStatusBar, titleBar, etc.</description>
- </param>
-
- <param name="mediaClock" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>
- Text value for MediaClock field. Has to be properly formatted by Mobile App according to the module's capabilities.
- If this text is set, any automatic media clock updates previously set with SetMediaClockTimer will be stopped.
- </description>
- </param>
-
- <param name="mediaTrack" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>
- The text that should be displayed in the track field.
- If this text is not set, the text of mediaTrack stays unchanged.
- If this text is empty "", the field will be cleared.
- </description>
- </param>
-
- <param name="graphic" type="Image" mandatory="false">
- <description>
- Image struct determining whether static or dynamic image to display in app.
- If omitted on supported displays, the displayed graphic shall not change.
- </description>
- </param>
-
- <param name="secondaryGraphic" type="Image" mandatory="false">
- <description>
- Image struct determining whether static or dynamic secondary image to display in app.
- If omitted on supported displays, the displayed secondary graphic shall not change.
- </description>
- </param>
-
-
- <param name="softButtons" type="SoftButton" minsize="0" maxsize="8" array="true" mandatory="false">
- <description>
- App defined SoftButtons.
- If omitted on supported displays, the currently displayed SoftButton values will not change.
- </description>
- </param>
-
- <param name="customPresets" type="String" maxlength="500" minsize="0" maxsize="10" array="true" mandatory="false">
- <description>
- App labeled on-screen presets (i.e. on-screen media presets or dynamic search suggestions).
- If omitted on supported displays, the presets will be shown as not defined.
- </description>
- </param>
-
- <param name="metadataTags" type="MetadataTags" mandatory="false">
- <description>App defined metadata information. See MetadataStruct. Uses mainField1, mainField2, mainField3, mainField4.
- If omitted on supported displays, the currently set metadata tags will not change.
- If any text field contains no tags or the none tag, the metadata tag for that textfield should be removed.</description>
- </param>
- </function>
-
- <function name="Show" functionID="ShowID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="DISALLOWED"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="WARNINGS"/>
- <element name="ABORTED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="Speak" functionID="SpeakID" messagetype="request">
- <description>Speaks a text.</description>
-
- <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="true">
- <description>
- An array of text chunks of type TTSChunk. See TTSChunk.
- The array must have at least one item.
- </description>
- </param>
-
- </function>
-
- <function name="Speak" functionID="SpeakID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="DISALLOWED"/>
- <element name="ABORTED"/>
- <element name="WARNINGS"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- </function>
-
- <function name="SetMediaClockTimer" functionID="SetMediaClockTimerID" messagetype="request">
- <description>Sets the initial media clock value and automatic update method.</description>
-
- <param name="startTime" type="StartTime" mandatory="false">
- <description>
- See StartTime.
- startTime must be provided for "COUNTUP" and "COUNTDOWN".
- startTime will be ignored for "RESUME", and "CLEAR"
- startTime can be sent for "PAUSE", in which case it will update the paused startTime
- </description>
- </param>
-
- <param name="endTime" type="StartTime" mandatory="false">
- <description>
- See StartTime.
- endTime can be provided for "COUNTUP" and "COUNTDOWN"; to be used to calculate any visual progress bar (if not provided, this feature is ignored)
- If endTime is greater then startTime for COUNTDOWN or less than startTime for COUNTUP, then the request will return an INVALID_DATA.
- endTime will be ignored for "RESUME", and "CLEAR"
- endTime can be sent for "PAUSE", in which case it will update the paused endTime
- </description>
- </param>
-
- <param name="updateMode" type="UpdateMode" mandatory="true">
- <description>
- Enumeration to control the media clock.
- In case of pause, resume, or clear, the start time value is ignored and shall be left out. For resume, the time continues with the same value as it was when paused.
- </description>
- </param>
- </function>
-
- <function name="SetMediaClockTimer" functionID="SetMediaClockTimerID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="IGNORED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="PerformAudioPassThru" functionID="PerformAudioPassThruID" messagetype="request">
- <description>Starts audio pass thru session </description>
- <param name="initialPrompt" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- The module will speak this prompt before opening the audio pass thru session.
- An array of text chunks of type TTSChunk. See TTSChunk.
- The array must have at least one item.
- If omitted, then no initial prompt is spoken.
- </description>
- </param>
- <param name="audioPassThruDisplayText1" type="String" mandatory="false" maxlength="500">
- <description>First line of text displayed during audio capture.</description>
- </param>
- <param name="audioPassThruDisplayText2" type="String" mandatory="false" maxlength="500">
- <description>Second line of text displayed during audio capture.</description>
- </param>
- <param name="samplingRate" type="SamplingRate" mandatory="true">
- <description> This value shall be allowed at 8 kHz or 16 or 22 or 44 kHz.</description>
- </param>
- <param name="maxDuration" type="Integer" minvalue="1" maxvalue="1000000" mandatory="true">
- <description>The maximum duration of audio recording in milliseconds. </description>
- </param>
- <param name="bitsPerSample" type="BitsPerSample" mandatory="true">
- <description>Specifies the quality the audio is recorded. Currently 8 bit or 16 bit.</description>
- </param>
- <param name="audioType" type="AudioType" mandatory="true">
- <description>Specifies the type of audio data being requested.</description>
- </param>
- <param name="muteAudio" type="Boolean" mandatory="false">
- <description>
- Defines if the current audio source should be muted during the APT session. If not, the audio source will play without interruption.
- If omitted, the value is set to true.
- </description>
- </param>
- </function>
-
- <function name="PerformAudioPassThru" functionID="PerformAudioPassThruID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="DISALLOWED"/>
- <element name="REJECTED"/>
- <element name="ABORTED"/>
- <element name="RETRY"/>
- <element name="WARNINGS"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="EndAudioPassThru" functionID="EndAudioPassThruID" messagetype="request">
- <description>When this request is invoked, the audio capture stops.</description>
- </function>
-
- <function name="EndAudioPassThru" functionID="EndAudioPassThruID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="DISALLOWED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="SubscribeButton" functionID="SubscribeButtonID" messagetype="request">
- <description>
- Subscribes to built-in HMI buttons.
- The application will be notified by the OnButtonEvent and OnButtonPress.
- To unsubscribe the notifications, use unsubscribeButton.
- </description>
-
- <param name="buttonName" type="ButtonName" mandatory="true">
- <description>Name of the button to subscribe.</description>
- </param>
- </function>
-
- <function name="SubscribeButton" functionID="SubscribeButtonID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="UNSUPPORTED_RESOURCE" />
- <element name="IGNORED" />
- <element name="REJECTED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="UnsubscribeButton" functionID="UnsubscribeButtonID" messagetype="request">
- <description>Unsubscribes from built-in HMI buttons.</description>
-
- <param name="buttonName" type="ButtonName" mandatory="true">
- <description>Name of the button to unsubscribe.</description>
- </param>
- </function>
-
- <function name="UnsubscribeButton" functionID="UnsubscribeButtonID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="UNSUPPORTED_RESOURCE" />
- <element name="IGNORED" />
- <element name="REJECTED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="SubscribeVehicleData" functionID="SubscribeVehicleDataID" messagetype="request">
- <description>
- Subscribes for specific published data items.
- The data will be only sent if it has changed.
- The application will be notified by the onVehicleData notification whenever new data is available.
- To unsubscribe the notifications, use unsubscribe with the same subscriptionType.
- </description>
-
- <param name="gps" type="Boolean" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Boolean" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Boolean" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Boolean" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="Boolean" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Boolean" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="fuelRange" type="Boolean" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
- </param>
- <param name="externalTemperature" type="Boolean" mandatory="false">
- <description>The external temperature in degrees celsius</description>
- </param>
- <param name="turnSignal" type="Boolean" mandatory="false">
- <description>See TurnSignal</description>
- </param>
- <param name="prndl" type="Boolean" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="Boolean" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Boolean" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="Boolean" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="Boolean" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="Boolean" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="Boolean" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="Boolean" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="Boolean" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Boolean" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Boolean" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Boolean" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <param name="engineOilLife" type="Boolean" mandatory="false">
- <description>The estimated percentage of remaining oil life of the engine.</description>
- </param>
-
- <!-- Ford Specific Data Items -->
- <param name="eCallInfo" type="Boolean" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="Boolean" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="Boolean" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModeStatus" type="Boolean" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="Boolean" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
-
- <!-- / Ford Specific Data Items -->
-
- </function>
-
- <function name="SubscribeVehicleData" functionID="SubscribeVehicleDataID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="WARNINGS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED" />
- <element name="IGNORED" />
- <element name="DISALLOWED"/>
- <element name="USER_DISALLOWED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- <param name="gps" type="VehicleDataResult" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="VehicleDataResult" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="VehicleDataResult" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="VehicleDataResult" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="VehicleDataResult" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="VehicleDataResult" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="fuelRange" type="VehicleDataResult" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
- </param>
- <param name="externalTemperature" type="VehicleDataResult" mandatory="false">
- <description>The external temperature in degrees celsius.</description>
- </param>
- <param name="turnSignal" type="VehicleDataResult" mandatory="false">
- <description>See TurnSignal</description>
- </param>
- <param name="prndl" type="VehicleDataResult" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="VehicleDataResult" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="VehicleDataResult" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="VehicleDataResult" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="VehicleDataResult" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="VehicleDataResult" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="VehicleDataResult" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="VehicleDataResult" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="VehicleDataResult" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="VehicleDataResult" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="VehicleDataResult" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="VehicleDataResult" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <param name="engineOilLife" type="VehicleDataResult" mandatory="false">
- <description>The estimated percentage of remaining oil life of the engine.</description>
- </param>
-
- <!-- Ford Specific Data Items -->
- <param name="eCallInfo" type="VehicleDataResult" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="VehicleDataResult" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="VehicleDataResult" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModes" type="VehicleDataResult" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="VehicleDataResult" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- <!-- / Ford Specific Data Items -->
-
- </function>
-
- <function name="UnsubscribeVehicleData" functionID="UnsubscribeVehicleDataID" messagetype="request">
- <description>This function is used to unsubscribe the notifications from the subscribeVehicleData function.</description>
-
- <param name="gps" type="Boolean" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Boolean" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Boolean" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Boolean" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="Boolean" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Boolean" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="fuelRange" type="Boolean" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
- </param>
- <param name="externalTemperature" type="Boolean" mandatory="false">
- <description>The external temperature in degrees celsius.</description>
- </param>
- <param name="turnSignal" type="Boolean" mandatory="false">
- <description>See TurnSignal</description>
- </param>
- <param name="prndl" type="Boolean" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="Boolean" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Boolean" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="Boolean" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="Boolean" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="Boolean" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="Boolean" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="Boolean" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="Boolean" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Boolean" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Boolean" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Boolean" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <param name="engineOilLife" type="Boolean" mandatory="false">
- <description>The estimated percentage of remaining oil life of the engine.</description>
- </param>
-
- <!-- Ford Specific Data Items -->
- <param name="eCallInfo" type="Boolean" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="Boolean" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="Boolean" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModeStatus" type="Boolean" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="Boolean" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- <!-- / Ford Specific Data Items -->
-
- </function>
-
- <function name="UnsubscribeVehicleData" functionID="UnsubscribeVehicleDataID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="WARNINGS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED" />
- <element name="IGNORED" />
- <element name="DISALLOWED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- <param name="gps" type="VehicleDataResult" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="VehicleDataResult" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="VehicleDataResult" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="VehicleDataResult" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="VehicleDataResult" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="VehicleDataResult" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="fuelRange" type="VehicleDataResult" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
- </param>
- <param name="externalTemperature" type="VehicleDataResult" mandatory="false">
- <description>The external temperature in degrees celsius</description>
- </param>
- <param name="turnSignal" type="VehicleDataResult" mandatory="false">
- <description>See TurnSignal</description>
- </param>
- <param name="prndl" type="VehicleDataResult" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="VehicleDataResult" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="VehicleDataResult" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="VehicleDataResult" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="VehicleDataResult" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="VehicleDataResult" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="VehicleDataResult" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="VehicleDataResult" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="VehicleDataResult" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="VehicleDataResult" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="VehicleDataResult" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="VehicleDataResult" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <param name="engineOilLife" type="VehicleDataResult" mandatory="false">
- <description>The estimated percentage of remaining oil life of the engine.</description>
- </param>
-
- <!-- Ford Specific Data Items -->
- <param name="eCallInfo" type="VehicleDataResult" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="VehicleDataResult" mandatory="false" >
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="VehicleDataResult" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModes" type="VehicleDataResult" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="VehicleDataResult" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- <!-- / Ford Specific Data Items -->
-
- </function>
-
- <function name="GetVehicleData" functionID="GetVehicleDataID" messagetype="request">
- <description>Non periodic vehicle data read request.</description>
-
- <param name="gps" type="Boolean" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Boolean" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Boolean" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Boolean" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="Boolean" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Boolean" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="fuelRange" type="Boolean" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
- </param>
- <param name="externalTemperature" type="Boolean" mandatory="false">
- <description>The external temperature in degrees celsius</description>
- </param>
- <param name="turnSignal" type="Boolean" mandatory="false">
- <description>See TurnSignal</description>
- </param>
- <param name="vin" type="Boolean" mandatory="false">
- <description>Vehicle identification number</description>
- </param>
- <param name="prndl" type="Boolean" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="Boolean" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Boolean" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="Boolean" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="Boolean" mandatory="false">
- <description>The body information including ignition status and internal temp</description>
- </param>
- <param name="deviceStatus" type="Boolean" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="Boolean" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="Boolean" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="Boolean" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Boolean" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Boolean" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Boolean" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <param name="engineOilLife" type="Boolean" mandatory="false">
- <description>The estimated percentage of remaining oil life of the engine.</description>
- </param>
-
- <!-- Ford Specific Data Items -->
- <param name="eCallInfo" type="Boolean" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="Boolean" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="Boolean" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModeStatus" type="Boolean" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="Boolean" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- <!-- / Ford Specific Data Items -->
-
- </function>
-
- <function name="GetVehicleData" functionID="GetVehicleDataID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="VEHICLE_DATA_NOT_ALLOWED"/>
- <element name="VEHICLE_DATA_NOT_AVAILABLE"/>
- <element name="USER_DISALLOWED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- <param name="gps" type="GPSData" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="ComponentVolumeStatus" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="fuelRange" type="FuelRange" minsize="0" maxsize="100" array="true" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
- </param>
- <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
- <description>The external temperature in degrees celsius</description>
- </param>
- <param name="turnSignal" type="TurnSignal" mandatory="false">
- <description>See TurnSignal</description>
- </param>
- <param name="vin" type="String" maxlength="17" mandatory="false">
- <description>Vehicle identification number</description>
- </param>
- <param name="prndl" type="PRNDL" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="TireStatus" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="BeltStatus" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="BodyInformation" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="DeviceStatus" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="VehicleDataEventStatus" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="WiperStatus" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="HeadLampStatus" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <param name="engineOilLife" type="Float" minvalue="0" maxvalue="100" mandatory="false">
- <description>The estimated percentage of remaining oil life of the engine.</description>
- </param>
-
- <!-- Ford Specific Data Items -->
- <param name="eCallInfo" type="ECallInfo" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="AirbagStatus" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="EmergencyEvent" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModeStatus" type="ClusterModeStatus" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="MyKey" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- <!-- / Ford Specific Data Items -->
-
- </function>
-
- <function name="ReadDID" functionID="ReadDIDID" messagetype="request">
- <description>Non periodic vehicle data read request</description>
-
- <param name="ecuName" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Name of ECU.</description>
- </param>
- <param name="didLocation" type="Integer" minvalue="0" maxvalue="65535" minsize="1" maxsize="1000" array="true" mandatory="true">
- <description>Get raw data from vehicle data DID location(s)</description>
- </param>
- </function>
-
- <function name="ReadDID" functionID="ReadDIDID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="DISALLOWED"/>
- <element name="USER_DISALLOWED"/>
- <element name="TRUNCATED_DATA"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- <param name="didResult" type="DIDResult" minsize="0" maxsize="1000" array="true" mandatory="false">
- <description>Array of requested DID results (with data if available).</description>
- </param>
-
- </function>
-
- <function name="GetDTCs" functionID="GetDTCsID" messagetype="request">
- <description>Vehicle module diagnostic trouble code request.</description>
-
- <param name="ecuName" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Name of ECU.</description>
- </param>
-
- <param name="dtcMask" type="Integer" minvalue="0" maxvalue="255" mandatory="false">
- <description>DTC Mask Byte to be sent in diagnostic request to module .</description>
- </param>
-
- </function>
-
- <function name="GetDTCs" functionID="GetDTCsID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="DISALLOWED"/>
- <element name="USER_DISALLOWED"/>
- <element name="TRUNCATED_DATA"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- <param name="ecuHeader" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>2 byte ECU Header for DTC response (as defined in VHR_Layout_Specification_DTCs.pdf)</description>
- </param>
-
- <param name="dtc" type="String" mandatory="false" minsize="1" maxsize="15" maxlength="10" array="true">
- <description>
- Array of all reported DTCs on module (ecuHeader contains information if list is truncated).
- Each DTC is represented by 4 bytes (3 bytes of data and 1 byte status as defined in VHR_Layout_Specification_DTCs.pdf).
- </description>
- </param>
-
- </function>
-
- <function name="DiagnosticMessage" functionID="DiagnosticMessageID" messagetype="request">
- <description>Non periodic vehicle diagnostic request</description>
-
- <param name="targetID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Name of target ECU.</description>
- </param>
-
- <param name="messageLength" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Length of message (in bytes).</description>
- </param>
-
- <param name="messageData" type="Integer" minvalue="0" maxvalue="255" minsize="1" maxsize="65535" array="true" mandatory="true">
- <description>
- Array of bytes comprising CAN message.
- </description>
- </param>
- </function>
-
- <function name="DiagnosticMessage" functionID="DiagnosticMessageID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="DISALLOWED"/>
- <element name="USER_DISALLOWED"/>
- <element name="TRUNCATED_DATA"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- <param name="messageDataResult" type="Integer" minvalue="0" maxvalue="255" minsize="1" maxsize="65535" array="true" mandatory="true">
- <description>
- Array of bytes comprising CAN message result.
- </description>
- </param>
-
- </function>
-
- <function name="ScrollableMessage" functionID="ScrollableMessageID" messagetype="request">
- <description>Creates a full screen overlay containing a large block of formatted text that can be scrolled with up to 8 SoftButtons defined</description>
- <param name="scrollableMessageBody" type="String" maxlength="500" mandatory="true">
- <description>Body of text that can include newlines and tabs.</description>
- </param>
- <param name="timeout" type="Integer" minvalue="1000" maxvalue="65535" defvalue="30000" mandatory="false">
- <description>App defined timeout. Indicates how long of a timeout from the last action (i.e. scrolling message resets timeout).</description>
- </param>
- <param name="softButtons" type="SoftButton" minsize="0" maxsize="8" array="true" mandatory="false">
- <description>
- App defined SoftButtons.
- If omitted on supported displays, only the system defined "Close" SoftButton will be displayed.
- </description>
- </param>
- </function>
-
- <function name="ScrollableMessage" functionID="ScrollableMessageID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="CHAR_LIMIT_EXCEEDED"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="DISALLOWED"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="REJECTED"/>
- <element name="ABORTED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- </function>
-
- <function name="Slider" functionID="SliderID" messagetype="request">
- <description>Creates a full screen or pop-up overlay (depending on platform) with a single user controlled slider.</description>
- <param name="numTicks" type="Integer" minvalue="2" maxvalue="26" mandatory="true">
- <description>Number of selectable items on a horizontal axis</description>
- </param>
- <param name="position" type="Integer" minvalue="1" maxvalue="26" mandatory="true">
- <description>Initial position of slider control (cannot exceed numTicks)</description>
- </param>
- <param name="sliderHeader" type="String" maxlength="500" mandatory="true">
- <description>Text header to display</description>
- </param>
- <param name="sliderFooter" type="String" maxlength="500" minsize="1" maxsize="26" array="true" mandatory="false">
- <description>
- Text footer to display (meant to display min/max threshold descriptors).
- For a static text footer, only one footer string shall be provided in the array.
- For a dynamic text footer, the number of footer text string in the array must match the numTicks value.
- For a dynamic text footer, text array string should correlate with potential slider position index.
- If omitted on supported displays, no footer text shall be displayed.
- </description>
- </param>
- <param name="timeout" type="Integer" minvalue="1000" maxvalue="65535" defvalue="10000" mandatory="false">
- <description>
- App defined timeout. Indicates how long of a timeout from the last action (i.e. sliding control resets timeout).
- If omitted, the value is set to 10000.
- </description>
- </param>
- </function>
-
- <function name="Slider" functionID="SliderID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="SAVED"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="DISALLOWED"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="REJECTED"/>
- <element name="ABORTED"/>
- <element name="TIMED_OUT"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- <param name="sliderPosition" type="Integer" minvalue="1" maxvalue="26" mandatory="false">
- <description>
- Current slider value returned when saved or canceled (aborted)
- This value is only returned for resultCodes "SAVED" or "ABORTED"
- </description>
- </param>
- </function>
-
- <function name="ShowConstantTBT" functionID="ShowConstantTBTID" messagetype="request">
- <param name="navigationText1" type="String" minlength="0" maxlength="500" mandatory="false">
- </param>
- <param name="navigationText2" type="String" minlength="0" maxlength="500" mandatory="false">
- </param>
- <param name="eta" type="String" minlength="0" maxlength="500" mandatory="false">
- </param>
- <param name="timeToDestination" type="String" minlength="0" maxlength="500" mandatory="false">
- </param>
- <param name="totalDistance" type="String" minlength="0" maxlength="500" mandatory="false">
- </param>
- <param name="turnIcon" type="Image" mandatory="false">
- </param>
- <param name="nextTurnIcon" type="Image" mandatory="false">
- </param>
- <param name="distanceToManeuver" type="Float" minvalue="0" maxvalue="1000000000" mandatory="false">
- <description>
- Fraction of distance till next maneuver (starting from when AlertManeuver is triggered).
- Used to calculate progress bar.
- </description>
- </param>
- <param name="distanceToManeuverScale" type="Float" minvalue="0" maxvalue="1000000000" mandatory="false">
- <description>
- Distance till next maneuver (starting from) from previous maneuver.
- Used to calculate progress bar.
- </description>
- </param>
- <param name="maneuverComplete" type="Boolean" mandatory="false">
- <description>
- If and when a maneuver has completed while an AlertManeuver is active, the app must send this value set to TRUE in order to clear the AlertManeuver overlay.
- If omitted the value will be assumed as FALSE.
- </description>
- </param>
- <param name="softButtons" type="SoftButton" minsize="0" maxsize="3" array="true" mandatory="false">
- <description>
- Three dynamic SoftButtons available (first SoftButton is fixed to "Turns").
- If omitted on supported displays, the currently displayed SoftButton values will not change.
- </description>
- </param>
- </function>
-
- <function name="ShowConstantTBT" functionID="ShowConstantTBTID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="DISALLOWED"/>
- <element name="UNSUPPORTED_REQUEST"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- </param>
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="AlertManeuver" functionID="AlertManeuverID" messagetype="request">
- <param name="ttsChunks" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>An array of text chunks of type TTSChunk. See TTSChunk</description>
- </param>
- <param name="softButtons" type="SoftButton" minsize="0" maxsize="3" array="true" mandatory="false">
- <description>If omitted on supported displays, only the system defined "Close" SoftButton shall be displayed.</description>
- </param>
- </function>
-
- <function name="AlertManeuver" functionID="AlertManeuverID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="IGNORED"/>
- <element name="DISALLOWED"/>
- <element name="UNSUPPORTED_REQUEST"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="ABORTED"/>
- <element name="WARNINGS"/>
- </param>
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="UpdateTurnList" functionID="UpdateTurnListID" messagetype="request">
- <param name="turnList" type="Turn" minsize="1" maxsize="100" array="true" mandatory="false">
- </param>
- <param name="softButtons" type="SoftButton" minsize="0" maxsize="1" array="true" mandatory="false">
- <description>If omitted on supported displays, app-defined SoftButton will be left blank.</description>
- </param>
- </function>
-
- <function name="UpdateTurnList" functionID="UpdateTurnListID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="DISALLOWED"/>
- <element name="UNSUPPORTED_REQUEST"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- </param>
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="ChangeRegistration" functionID="ChangeRegistrationID" messagetype="request">
- <param name="language" type="Language" mandatory="true">
- <description>Requested voice engine (VR+TTS) language registration</description>
- </param>
- <param name="hmiDisplayLanguage" type="Language" mandatory="true">
- <description>Request display language registration</description>
- </param>
- <param name="appName" type="String" maxlength="100" mandatory="false">
- <description>Request new app name registration</description>
- </param>
- <param name="ttsName" type="TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false" >
- <description>Request new ttsName registration</description>
- </param>
- <param name="ngnMediaScreenAppName" type="String" maxlength="100" mandatory="false">
- <description>Request new app short name registration</description>
- </param>
- <param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>Request new VR synonyms registration</description>
- </param>
-
- </function>
-
-
-
- <function name="ChangeRegistration" functionID="ChangeRegistrationID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description>
- true, if successful
- false, if failed
- </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="DISALLOWED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- </function>
-
- <function name="GenericResponse" functionID="GenericResponseID" messagetype="response">
- <description>
- Generic Response is sent, when the name of a received msg cannot be retrieved. Only used in case of an error.
- Currently, only resultCode INVALID_DATA is used.
- </description>
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="INVALID_DATA"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="PutFile" functionID="PutFileID" messagetype="request">
- <description>
- Used to push a binary data onto the module from a mobile device, such as icons and album art
- Not supported on first generation of SDL enabled modules.
- Binary data is in binary part of hybrid msg.
- </description>
-
- <param name="syncFileName" type="String" maxlength="255" mandatory="true">
- <description>File reference name.</description>
- </param>
-
- <param name="fileType" type="FileType" mandatory="true">
- <description>Selected file type.</description>
- </param>
-
- <param name="persistentFile" type="Boolean" defvalue="false" mandatory="false">
- <description>
- Indicates if the file is meant to persist between sessions / ignition cycles.
- If set to TRUE, then the system will aim to persist this file through session / cycles.
- While files with this designation will have priority over others, they are subject to deletion by the system at any time.
- In the event of automatic deletion by the system, the app will receive a rejection and have to resend the file.
- If omitted, the value will be set to false.
- </description>
- </param>
-
- <param name="systemFile" type="Boolean" defvalue="false" mandatory="false" >
- <description>
- Indicates if the file is meant to be passed thru core to elsewhere on the system.
- If set to TRUE, then the system will instead pass the data thru as it arrives to a predetermined area outside of core.
- If omitted, the value will be set to false.
- </description>
- </param>
-
- <param name="offset" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
- <description>Optional offset in bytes for resuming partial data chunks</description>
- </param>
- <param name="length" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
- <description>
- Optional length in bytes for resuming partial data chunks
- If offset is set to 0, then length is the total length of the file to be downloaded
- </description>
- </param>
- <param name="crc" type="Integer" minvalue="0" maxvalue="4294967295" mandatory="false">
- <description> Additional CRC32 checksum to protect data integrity up to 512 Mbits . </description>
- </param>
- </function>
-
- <function name="PutFile" functionID="PutFileID" messagetype="response">
- <description>Response is sent, when the file data was copied (success case). Or when an error occurred.</description>
- <description>Not supported on first generation SDL enabled vehicles. </description>
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="UNSUPPORTED_REQUEST"/>
- <element name="CORRUPTED_DATA"/>
- </param>
-
- <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>
- Provides the total local space available in SDL Core for the registered app.
- If the transfer has systemFile enabled, then the value will be set to 0 automatically.
- </description>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="DeleteFile" functionID="DeleteFileID" messagetype="request">
- <description>
- Used to delete a file resident on the module in the app's local cache.
- Not supported on first generation SDL enabled vehicles.
- </description>
-
- <param name="syncFileName" type="String" maxlength="500" mandatory="true">
- <description>File reference name.</description>
- </param>
-
- </function>
-
- <function name="DeleteFile" functionID="DeleteFileID" messagetype="response">
- <description>
- Response is sent, when the file data was deleted (success case). Or when an error occurred.
- Not supported on First generation SDL enabled vehicles.
- </description>
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="UNSUPPORTED_REQUEST"/>
- </param>
-
- <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>Provides the total local space available on the module for the registered app.</description>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="ListFiles" functionID="ListFilesID" messagetype="request">
- <description>
- Requests the current list of resident filenames for the registered app.
- Not supported on first generation SDL enabled vehicles.
- </description>
- </function>
-
- <function name="ListFiles" functionID="ListFilesID" messagetype="response">
- <description>
- Returns the current list of resident filenames for the registered app along with the current space available
- Not supported on First generation SDL enabled vehicles.
- </description>
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="UNSUPPORTED_REQUEST"/>
- </param>
-
- <param name="filenames" type="String" maxlength="500" minsize="0" maxsize="1000" array="true" mandatory="false">
- <description>
- An array of all filenames resident on the module for the given registered app.
- If omitted, then no files currently reside on the system.
- </description>
- </param>
-
- <param name="spaceAvailable" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>Provides the total local space available on the module for the registered app.</description>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="SetAppIcon" functionID="SetAppIconID" messagetype="request">
- <description>
- Used to set existing local file on the module as the app's icon
- Not supported on first generation SDL enabled vehicles.
- </description>
-
- <param name="syncFileName" type="String" maxlength="500" mandatory="true">
- <description>File reference name.</description>
- </param>
-
- </function>
-
- <function name="SetAppIcon" functionID="SetAppIconID" messagetype="response">
- <description>
- Response is sent, when the file data was copied (success case). Or when an error occurred.
- Not supported on First generation SDL enabled vehicles.
- </description>
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="UNSUPPORTED_REQUEST"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- </function>
-
- <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="request">
- <description>
- Used to set an alternate display layout.
- If not sent, default screen for given platform will be shown
- </description>
-
- <param name="displayLayout" type="String" maxlength="500" mandatory="true">
- <description>
- Predefined or dynamically created screen layout.
- Currently only predefined screen layouts are defined.
- </description>
- </param>
-
- <param name="dayColorScheme" type="TemplateColorScheme" mandatory="false"/>
-
- <param name="nightColorScheme" type="TemplateColorScheme" mandatory="false"/>
- </function>
-
- <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="response">
-
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="UNSUPPORTED_REQUEST"/>
- </param>
-
- <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false">
- <description>See DisplayCapabilities</description>
- </param>
-
- <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See ButtonCapabilities</description >
- </param>
-
- <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
- </param>
-
- <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false">
- <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
-
- </function>
-
- <function name="SystemRequest" functionID="SystemRequestID" messagetype="request" >
- <description>An asynchronous request from the device; binary data can be included in hybrid part of message for some requests (such as HTTP, Proprietary, or Authentication requests)</description>
- <param name="requestType" type="RequestType" mandatory="true">
- <description>
- The type of system request.
- Note that Proprietary requests should forward the binary data to the known proprietary module on the system.
- </description>
- </param>
- <param name="requestSubType" type="String" maxlength="255" mandatory="false">
- <description>
- This parameter is filled for supporting OEM proprietary data exchanges.
- </description>
- </param>
- <param name="fileName" type="String" maxlength="255" mandatory="false">
- <description>
- Filename of HTTP data to store in predefined system staging area.
- Mandatory if requestType is HTTP.
- PROPRIETARY requestType should ignore this parameter.
- </description>
- </param>
- </function>
-
- <function name="SystemRequest" functionID="SystemRequestID" messagetype="response" >
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="INVALID_CERT"/>
- <element name="EXPIRED_CERT"/>
- <element name="UNSUPPORTED_REQUEST"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="DISALLOWED"/>
- <element name="ABORTED"/>
- <element name="WARNINGS"/>
- <element name="TIMED_OUT"/>
- <element name="IGNORED"/>
- </param>
- </function>
-
- <function name="SendLocation" functionID="SendLocationID" messagetype="request">
- <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="false">
- </param>
- <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="false">
- </param>
- <param name="locationName" type="String" maxlength="500" mandatory="false">
- <description>
- Name / title of intended location
- </description>
- </param>
- <param name="locationDescription" type="String" maxlength="500" mandatory="false">
- <description>
- Description intended location / establishment (if applicable)
- </description>
- </param>
- <param name="addressLines" type="String" maxlength="500" minsize="0" maxsize="4" array="true" mandatory="false">
- <description>
- Location address (if applicable)
- </description>
- </param>
- <param name="phoneNumber" type="String" maxlength="500" mandatory="false">
- <description>
- Phone number of intended location / establishment (if applicable)
- </description>
- </param>
- <param name="locationImage" type="Image" mandatory="false">
- <description>
- Image / icon of intended location (if applicable and supported)
- </description>
- </param>
-
- <param name="timeStamp" type="DateTime" mandatory="false">
- <description>
- timestamp in ISO 8601 format
- </description>
- </param>
-
- <param name="address" type="OASISAddress" mandatory="false">
- <description>Address to be used for setting destination</description>
- </param>
- <param name="deliveryMode" type="DeliveryMode" mandatory="false">
- <description>Defines the mode of prompt for user</description>
- </param>
- </function>
-
- <function name="SendLocation" functionID="SendLocationID" messagetype="response" >
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="DISALLOWED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="DialNumber" functionID="DialNumberID" messagetype="request">
- <description>Dials a phone number and switches to phone application.</description>
-
- <param name="number" type="String" maxlength="40" mandatory="true">
- <description>
- Phone number is a string, which can be up to 40 chars.
- All characters shall be stripped from string except digits 0-9 and * # , ; +
- </description>
- </param>
- </function>
-
- <function name="DialNumber" functionID="DialNumberID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description>true, if successful</description>
- <description>false, if failed</description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="ButtonPress" functionID="ButtonPressID" messagetype="request">
- <param name="moduleType" type="ModuleType" mandatory="true">
- <description>The module where the button should be pressed</description>
- </param>
- <param name="buttonName" type="ButtonName" mandatory="true">
- <description>The name of supported RC climate or radio button.</description>
- </param>
- <param name="buttonPressMode" type="ButtonPressMode" mandatory="true">
- <description>Indicates whether this is a LONG or SHORT button press event.</description>
- </param>
- </function>
-
- <function name="ButtonPress" functionID="ButtonPressID" messagetype="response">
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="IGNORED"/>
- <element name="DISALLOWED"/>
- <element name="USER_DISALLOWED"/>
- <element name="IN_USE"/>
- </param>
- <param name="info" type="String" maxlength="1000" mandatory="false">
- </param>
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
- </function>
-
- <function name="GetInteriorVehicleData" functionID="GetInteriorVehicleDataID" messagetype="request">
- <param name="moduleType" type="ModuleType" mandatory="true">
- <description>
- The type of a RC module to retrieve module data from the vehicle.
- In the future, this should be the Identification of a module.
- </description>
- </param>
- <param name="subscribe" type="Boolean" mandatory="false">
- <description>
- If subscribe is true, the head unit will register onInteriorVehicleData notifications for the requested moduelType.
- If subscribe is false, the head unit will unregister onInteriorVehicleData notifications for the requested moduelType.
- </description>
- </param>
- </function>
-
- <function name="GetInteriorVehicleData" functionID="GetInteriorVehicleDataID" messagetype="response">
- <param name="moduleData" type="ModuleData" mandatory="true">
- </param>
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="IGNORED"/>
- <element name="DISALLOWED"/>
- <element name="USER_DISALLOWED"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- </param>
- <param name="info" type="String" maxlength="1000" mandatory="false">
- </param>
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
- <param name="isSubscribed" type="Boolean" mandatory="false" >
- <description>
- It is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request.
- if "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleType.
- if "false" - the "moduleType" from request is either unsubscribed or failed to subscribe.
- </description>
- </param>
- </function>
-
- <function name="SetInteriorVehicleData" functionID="SetInteriorVehicleDataID" messagetype="request">
- <param name="moduleData" type="ModuleData" mandatory="true">
- <description>The module data to set for the requested RC module.</description>
- </param>
- </function>
-
- <function name="SetInteriorVehicleData" functionID="SetInteriorVehicleDataID" messagetype="response">
- <description>Used to set the values of one remote control module </description>
- <param name="moduleData" type="ModuleData" mandatory="true">
- </param>
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="IGNORED"/>
- <element name="DISALLOWED"/>
- <element name="USER_DISALLOWED"/>
- <element name="READ_ONLY"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="IN_USE"/>
- </param>
- <param name="info" type="String" maxlength="1000" mandatory="false">
- </param>
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
- </function>
-
- <function name="SubscribeWayPoints" functionID="SubscribeWayPointsID" messagetype="request">
- <description>To subscribe in getting changes for Waypoints/destinations</description>
- </function>
-
- <function name="SubscribeWayPoints" functionID="SubscribeWayPointsID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="IGNORED"/>
- <element name="DISALLOWED"/>
- </param>
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <function name="GetWayPoints" functionID="GetWayPointsID" messagetype="request">
- <description>Request for getting waypoint/destination data.</description>
- <param name="wayPointType" type="WayPointType" mandatory="true">
- <description>To request for either the destination only or for all waypoints including destination</description>
- </param>
- </function>
-
- <function name="GetWayPoints" functionID="GetWayPointsID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="TIMED_OUT"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="IGNORED"/>
- <element name="IN_USE"/>
- <element name="DISALLOWED"/>
- </param>
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- <param name="wayPoints" type="LocationDetails" mandatory="false" array="true" minsize="1" maxsize="10">
- <description>See LocationDetails</description>
- </param>
- </function>
-
- <function name="UnsubscribeWayPoints" functionID="UnsubscribeWayPointsID" messagetype="request">
- <description>Request to unsubscribe from WayPoints and Destination</description>
- </function>
-
- <function name="UnsubscribeWayPoints" functionID="UnsubscribeWayPointsID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="UNSUPPORTED_RESOURCE"/>
- <element name="IGNORED"/>
- <element name="DISALLOWED"/>
- </param>
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- <param name="wayPoints" type="LocationDetails" mandatory="false" array="true" minsize="1" maxsize="10">
- <description>See LocationDetails</description>
- </param>
- </function>
-
- <function name="GetSystemCapability" functionID="GetSystemCapabilityID" messagetype="request">
- <description>Request for expanded information about a supported system/HMI capability</description>
- <param name="systemCapabilityType" type="SystemCapabilityType" mandatory="true">
- <description>The type of system capability to get more information on</description>
- </param>
- </function>
-
- <function name="GetSystemCapability" functionID="GetSystemCapabilityID" messagetype="response">
- <param name="systemCapability" type="SystemCapability" mandatory="true">
- </param>
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- <element name="IGNORED"/>
- <element name="DISALLOWED"/>
- <element name="USER_DISALLOWED"/>
- <element name="UNSUPPORTED_RESOURCE">
- <description>The capability does not exist on the module</description>
- </element>
- <element name="DATA_NOT_AVAILABLE">
- <description>The capability should exist on the module but there was an error retrieving the data.</description>
- </element>
- </param>
- <param name="info" type="String" maxlength="1000" mandatory="false">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false, if failed </description>
- </param>
- </function>
-
- <function name="SendHapticData" functionID="SendHapticDataID" messagetype="request">
- <description>Send the spatial data gathered from SDLCarWindow or VirtualDisplayEncoder to the HMI. This data will be utilized by the HMI to determine how and when haptic events should occur</description>
- <param name="hapticRectData" type="HapticRect" minsize="0" maxsize="1000" mandatory="false" array="true">
- <description>Array of spatial data structures that represent the locations of all user controls present on the HMI. This data should be updated if/when the application presents a new screen. When a request is sent, if successful, it will replace all spatial data previously sent through RPC. If an empty array is sent, the existing spatial data will be cleared</description>
- </param>
- </function>
-
- <function name="SendHapticData" functionID="SendHapticDataID" messagetype="response">
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true if successful; false if failed </description>
- </param>
- <param name="info" type="String" maxlength="1000" mandatory="false">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="GENERIC_ERROR"/>
- </param>
- </function>
-
- <!-- Notifications -->
-
- <function name="OnHMIStatus" functionID="OnHMIStatusID" messagetype="notification">
- <param name="hmiLevel" type="HMILevel" mandatory="true">
- <description>See HMILevel</description>
- </param>
-
- <param name="audioStreamingState" type="AudioStreamingState" mandatory="true">
- <description>See AudioStreamingState</description>
- </param>
-
- <param name="systemContext" type="SystemContext" mandatory="true">
- <description>See SystemContext</description>
- </param>
- <param name="videoStreamingState" type="VideoStreamingState" mandatory="true">
- <description>See VideoStreamingState. If it is NOT_STREAMABLE, the app must stop streaming video to SDL.</description>
- </param>
- </function>
-
- <function name="OnAppInterfaceUnregistered" functionID="OnAppInterfaceUnregisteredID" messagetype="notification">
- <param name="reason" type="AppInterfaceUnregisteredReason" mandatory="true">
- <description>See AppInterfaceUnregisteredReason</description>
- </param>
- </function>
-
- <function name="OnButtonEvent" functionID="OnButtonEventID" messagetype="notification">
- <description>Notifies application of UP/DOWN events for buttons to which the application is subscribed.</description>
- <param name="buttonName" type="ButtonName" mandatory="true"/>
- <param name="buttonEventMode" type="ButtonEventMode" mandatory="true">
- <description>Indicates whether this is an UP or DOWN event.</description>
- </param>
- <param name="customButtonID" type="Integer" minvalue="0" maxvalue="65536" mandatory="false">
- <description>If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID)</description>
- </param>
- </function>
-
- <function name="OnButtonPress" functionID="OnButtonPressID" messagetype="notification">
- <description>Notifies application of LONG/SHORT press events for buttons to which the application is subscribed.</description>
- <param name="buttonName" type="ButtonName" mandatory="true"/>
- <param name="buttonPressMode" type="ButtonPressMode" mandatory="true">
- <description>Indicates whether this is a LONG or SHORT button press event.</description>
- </param>
- <param name="customButtonID" type="Integer" minvalue="0" maxvalue="65536" mandatory="false">
- <description>If ButtonName is "CUSTOM_BUTTON", this references the integer ID passed by a custom button. (e.g. softButton ID)</description>
- </param>
- </function>
-
- <function name="OnVehicleData" functionID="OnVehicleDataID" messagetype="notification">
- <description>Callback for the periodic and non periodic vehicle data read function.</description>
- <param name="gps" type="GPSData" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="ComponentVolumeStatus" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="fuelRange" type="FuelRange" minsize="0" maxsize="100" array="true" mandatory="false">
- <description>The estimate range in KM the vehicle can travel based on fuel level and consumption</description>
- </param>
- <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
- <description>The external temperature in degrees celsius</description>
- </param>
- <param name="turnSignal" type="TurnSignal" mandatory="false">
- <description>See TurnSignal</description>
- </param>
- <param name="vin" type="String" maxlength="17" mandatory="false">
- <description>Vehicle identification number.</description>
- </param>
- <param name="prndl" type="PRNDL" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="TireStatus" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="BeltStatus" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="BodyInformation" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="DeviceStatus" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="VehicleDataEventStatus" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="WiperStatus" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="HeadLampStatus" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <param name="engineOilLife" type="Float" minvalue="0" maxvalue="100" mandatory="false">
- <description>The estimated percentage of remaining oil life of the engine.</description>
- </param>
-
- <!-- Ford Specific Vehicle Data -->
- <param name="eCallInfo" type="ECallInfo" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="AirbagStatus" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="EmergencyEvent" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModeStatus" type="ClusterModeStatus" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="MyKey" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- <!-- / Ford Specific Vehicle Data -->
-
- </function>
-
- <function name="OnCommand" functionID="OnCommandID" messagetype="notification">
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>Command ID, which is related to a specific menu entry</description>
- </param>
-
- <param name="triggerSource" type="TriggerSource" mandatory="true">
- <description>See TriggerSource</description>
- </param>
- </function>
-
- <function name="OnTBTClientState" functionID="OnTBTClientStateID" messagetype="notification" >
- <description>Provides applications with notifications specific to the current TBT client status on the module</description>
- <param name="state" type="TBTState" mandatory="true">
- <description>Current State of TBT client</description>
- </param>
- </function>
-
- <function name="OnDriverDistraction" functionID="OnDriverDistractionID" messagetype="notification" >
- <description>Provides driver distraction state to mobile applications</description>
- <param name="state" type="DriverDistractionState" mandatory="true">
- <description>Current State of Driver Distraction</description>
- </param>
- </function>
-
- <function name="OnPermissionsChange" functionID="OnPermissionsChangeID" messagetype="notification" >
- <description>Provides update to app of which policy-table-enabled functions are available</description>
- <param name="permissionItem" type="PermissionItem" minsize="0" maxsize="500" array="true" mandatory="true">
- <description>Change in permissions for a given set of RPCs</description>
- </param>
- </function>
-
- <function name="OnAudioPassThru" functionID="OnAudioPassThruID" messagetype="notification">
- <description>Binary data is in binary part of hybrid msg</description>
- </function>
-
- <function name="OnLanguageChange" functionID="OnLanguageChangeID" messagetype="notification">
- <param name="language" type="Language" mandatory="true">
- <description>Current SDL voice engine (VR+TTS) language</description>
- </param>
- <param name="hmiDisplayLanguage" type="Language" mandatory="true">
- <description>Current display language</description>
- </param>
- </function>
-
- <function name="OnKeyboardInput" functionID="OnKeyboardInputID" messagetype="notification" >
-
- <description>On-screen keyboard event.</description>
- <description>Can be full string or individual keypresses depending on keyboard mode.</description>
-
- <param name="event" type="KeyboardEvent" mandatory="true">
- <description>On-screen keyboard input data.</description>
- </param>
-
- <param name="data" type="String" maxlength="500" mandatory="false">
- <description>On-screen keyboard input data.</description>
- <description>For dynamic keypress events, this will be the current compounded string of entry text.</description>
- <description>For entry submission events, this will be the full text entry (this will always return regardless of the mode).</description>
- <description>For entry cancelled and entry aborted events, this data param will be omitted.</description>
- </param>
-
- </function>
-
- <function name="OnTouchEvent" functionID="OnTouchEventID" messagetype="notification" >
- <description>Notifies about touch events on the screen's prescribed area</description>
- <param name="type" type="TouchType" mandatory="true">
- <description>The type of touch event.</description>
- </param>
- <param name="event" type="TouchEvent" mandatory="true" minsize="1" maxsize="10" array="true">
- <description>List of all individual touches involved in this event.</description>
- </param>
- </function>
-
- <function name="OnSystemRequest" functionID="OnSystemRequestID" messagetype="notification" >
- <description>
- An asynchronous request from the system for specific data from the device or the cloud or response to a request from the device or cloud
- Binary data can be included in hybrid part of message for some requests (such as Authentication request responses)
- </description>
- <param name="requestType" type="RequestType" mandatory="true">
- <description>The type of system request.</description>
- </param>
- <param name="requestSubType" type="String" maxlength="255" mandatory="false">
- <description>
- This parameter is filled for supporting OEM proprietary data exchanges.
- </description>
- </param>
- <param name="url" type="String" maxlength="1000" mandatory="false">
- <description>
- Optional URL for HTTP requests.
- If blank, the binary data shall be forwarded to the app.
- If not blank, the binary data shall be forwarded to the url with a provided timeout in seconds.
- </description>
- </param>
- <param name="timeout" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
- <description>
- Optional timeout for HTTP requests
- Required if a URL is provided
- </description>
- </param>
- <param name="fileType" type="FileType" mandatory="false">
- <description>Optional file type (meant for HTTP file requests).</description>
- </param>
- <param name="offset" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
- <description>Optional offset in bytes for resuming partial data chunks</description>
- </param>
- <param name="length" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
- <description>Optional length in bytes for resuming partial data chunks</description>
- </param>
- </function>
-
- <function name="OnHashChange" functionID="OnHashChangeID" messagetype="notification">
- <description>
- Notification containing an updated hashID which can be used over connection cycles (i.e. loss of connection, ignition cycles, etc.).
- Sent after initial registration and subsequently after any change in the calculated hash of all persisted app data.
- </description>
- <param name="hashID" type="String" maxlength="100" mandatory="true">
- <description>Calculated hash ID to be referenced during RegisterAppInterface.</description>
- </param>
- </function>
-
- <function name="OnWayPointChange" functionID="OnWayPointChangeID" messagetype="notification">
- <description>Notification which provides the entire LocationDetails when there is a change to any waypoints or destination.</description>
- <param name="wayPoints" type="LocationDetails" mandatory="true" array="true" minsize="1" maxsize="10">
- <description>See LocationDetails</description>
- </param>
- </function>
-
- <function name="OnInteriorVehicleData" functionID="OnInteriorVehicleDataID" messagetype="notification">
- <param name="moduleData" type="ModuleData" mandatory="true">
- </param>
- </function>
-
- <!-- ~~~~~~~~~~~~~~~~~~ -->
- <!-- Ford Specific APIs -->
- <!-- ~~~~~~~~~~~~~~~~~~ -->
-
- <function name="EncodedSyncPData" functionID="EncodedSyncPDataID" messagetype="request" >
- <description>
- Allows encoded data in the form of SyncP packets to be sent to the SYNC module.
- Legacy / v1 Protocol implementation; use SyncPData instead.
- *** DEPRECATED ***
- </description>
-
- <param name="data" type="String" maxlength="1000000" minsize="1" maxsize="100" array="true" mandatory="true">
- <description>Contains base64 encoded string of SyncP packets.</description>
- <todo>What is the maxlength?</todo>
- </param>
- </function>
-
- <function name="EncodedSyncPData" functionID="EncodedSyncPDataID" messagetype="response" >
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
-
- <!-- Deprecating - covered by SystemRequest
- <function name="SyncPData" functionID="SyncPDataID" messagetype="request" >
- <description>
- Allows binary data in the form of SyncP packets to be sent to the SYNC module.
- Binary data is in binary part of hybrid msg.
- </description>
- </function>
-
- <function name="SyncPData" functionID="SyncPDataID" messagetype="response" >
- <param name="success" type="Boolean" platform="documentation" mandatory="true">
- <description> true, if successful; false, if failed </description>
- </param>
-
- <param name="resultCode" type="Result" platform="documentation" mandatory="true">
- <description>See Result</description>
- <element name="SUCCESS"/>
- <element name="INVALID_DATA"/>
- <element name="OUT_OF_MEMORY"/>
- <element name="TOO_MANY_PENDING_REQUESTS"/>
- <element name="APPLICATION_NOT_REGISTERED"/>
- <element name="GENERIC_ERROR"/>
- <element name="REJECTED"/>
- </param>
-
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
- -->
-
- <function name="OnEncodedSyncPData" functionID="OnEncodedSyncPDataID" messagetype="notification" >
- <description>
- Callback including encoded data of any SyncP packets that SYNC needs to send back to the mobile device.
- Legacy / v1 Protocol implementation; responds to EncodedSyncPData.
- *** DEPRECATED ***
- </description>
- <param name="data" type="String" maxlength="1000000" minsize="1" maxsize="100" mandatory="true" array="true">
- <description>Contains base64 encoded string of SyncP packets.</description>
- </param>
- <param name="URL" type="String" maxlength="1000" mandatory="false">
- <description>
- If blank, the SyncP data shall be forwarded to the app.
- If not blank, the SyncP data shall be forwarded to the provided URL.
- </description>
- </param>
- <param name="Timeout" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
- <description>
- If blank, the SyncP data shall be forwarded to the app.
- If not blank, the SyncP data shall be forwarded with the provided timeout in seconds.
- </description>
- </param>
- </function>
-
-
- <!-- Deprecating - covered by OnSystemRequest
- <function name="OnSyncPData" functionID="OnSyncPDataID" messagetype="notification" >
- <description>
- Callback including binary data of any SyncP packets that SYNC needs to send back to the mobile device.
- Responds to SyncPData.
- Binary data is in binary part of hybrid msg.
- </description>
-
- <param name="URL" type="String" maxlength="1000" mandatory="false">
- <description>
- If blank, the SyncP data shall be forwarded to the app.
- If not blank, the SyncP data shall be forwarded to the provided URL.
- </description>
- </param>
- <param name="Timeout" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
- <description>
- If blank, the SyncP data shall be forwarded to the app.
- If not blank, the SyncP data shall be forwarded with the provided timeout in seconds.
- </description>
- </param>
-
- </function>
- -->
-</interface>
diff --git a/src/components/interfaces/QT_HMI_API.xml b/src/components/interfaces/QT_HMI_API.xml
deleted file mode 100644
index 0c86d4eea3..0000000000
--- a/src/components/interfaces/QT_HMI_API.xml
+++ /dev/null
@@ -1,5517 +0,0 @@
-<!--
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE. -->
-
-<!--
- * DEPRECATED, use HMI_API instead. This API is used with the DBus adapter,
- * which will be removed or refactored to use HMI_API in the next major release
--->
-<interfaces name="SmartDeviceLink HMI API">
- <interface name="Common" version="1.1" date="2013-10-02">
- <enum name="Result">
- <element name="SUCCESS" value="0"/>
- <element name="UNSUPPORTED_REQUEST" value="1"/>
- <element name="UNSUPPORTED_RESOURCE" value="2"/>
- <element name="DISALLOWED" value="3"/>
- <element name="REJECTED" value="4"/>
- <element name="ABORTED" value="5"/>
- <element name="IGNORED" value="6"/>
- <element name="RETRY" value="7"/>
- <element name="IN_USE" value="8"/>
- <element name="DATA_NOT_AVAILABLE" value="9"/>
- <element name="TIMED_OUT" value="10"/>
- <element name="INVALID_DATA" value="11"/>
- <element name="CHAR_LIMIT_EXCEEDED" value="12"/>
- <element name="INVALID_ID" value="13"/>
- <element name="DUPLICATE_NAME" value="14"/>
- <element name="APPLICATION_NOT_REGISTERED" value="15"/>
- <element name="WRONG_LANGUAGE" value="16"/>
- <element name="OUT_OF_MEMORY" value="17"/>
- <element name="TOO_MANY_PENDING_REQUESTS" value="18"/>
- <element name="NO_APPS_REGISTERED" value="19"/>
- <element name="NO_DEVICES_CONNECTED" value="20"/>
- <element name="WARNINGS" value="21"/>
- <element name="GENERIC_ERROR" value="22"/>
- <element name="USER_DISALLOWED" value="23"/>
- <element name="TRUNCATED_DATA" value="24"/>
- <element name="SAVED" value="25"/>
- <element name="READ_ONLY" value="26"/>
- </enum>
- <enum name="TransportType">
- <description>
- Lists of the transport types used for device connection to HU.
- </description>
- <element name="BLUETOOTH"/>
- <element name="USB_IOS"/>
- <element name="USB_AOA"/>
- <element name="WIFI"/>
- </enum>
- <enum name="ButtonName">
- <description>Defines the hard (physical) and soft (touchscreen) buttons available from SYNC</description>
- <element name="OK"/>
- <element name="SEEKLEFT"/>
- <element name="SEEKRIGHT"/>
- <element name="TUNEUP"/>
- <element name="TUNEDOWN"/>
- <element name="PRESET_0"/>
- <element name="PRESET_1"/>
- <element name="PRESET_2"/>
- <element name="PRESET_3"/>
- <element name="PRESET_4"/>
- <element name="PRESET_5"/>
- <element name="PRESET_6"/>
- <element name="PRESET_7"/>
- <element name="PRESET_8"/>
- <element name="PRESET_9"/>
- <element name="CUSTOM_BUTTON"/>
- <element name="SEARCH"/>
- </enum>
- <enum name="ButtonEventMode">
- <element name="BUTTONUP">
- <description>A button has been released up</description>
- </element>
- <element name="BUTTONDOWN">
- <description>A button has been pressed down</description>
- </element>
- </enum>
- <enum name="ButtonPressMode">
- <element name="LONG">
- <description>A button was released, after it was pressed for a long time. Actual timing is defined by head unit and may vary</description>
- </element>
- <element name="SHORT">
- <description>A button was released, after it was pressed for a short time. Actual timing is defined by head unit and may vary</description>
- </element>
- </enum>
- <enum name="Language">
- <element name="EN-US" internal_name="EN_US">
- <description>English - US</description>
- </element>
- <element name="ES-MX" internal_name="ES_MX">
- <description>Spanish - Mexico</description>
- </element>
- <element name="FR-CA" internal_name="FR_CA">
- <description>French - Canada</description>
- </element>
- <element name="DE-DE" internal_name="DE_DE">
- <description>German - Germany</description>
- </element>
- <element name="ES-ES" internal_name="ES_ES">
- <description>Spanish - Spain</description>
- </element>
- <element name="EN-GB" internal_name="EN_GB">
- <description>English - GB</description>
- </element>
- <element name="RU-RU" internal_name="RU_RU">
- <description>Russian - Russia</description>
- </element>
- <element name="TR-TR" internal_name="TR_TR">
- <description>Turkish - Turkey</description>
- </element>
- <element name="PL-PL" internal_name="PL_PL">
- <description>Polish - Poland</description>
- </element>
- <element name="FR-FR" internal_name="FR_FR">
- <description>French - France</description>
- </element>
- <element name="IT-IT" internal_name="IT_IT">
- <description>Italian - Italy</description>
- </element>
- <element name="SV-SE" internal_name="SV_SE">
- <description>Swedish - Sweden</description>
- </element>
- <element name="PT-PT" internal_name="PT_PT">
- <description>Portuguese - Portugal</description>
- </element>
- <element name="NL-NL" internal_name="NL_NL">
- <description>Dutch (Standard) - Netherlands</description>
- </element>
- <element name="EN-AU" internal_name="EN_AU">
- <description>English - Australia</description>
- </element>
- <element name="ZH-CN" internal_name="ZH_CN">
- <description>Mandarin - China</description>
- </element>
- <element name="ZH-TW" internal_name="ZH_TW">
- <description>Mandarin - Taiwan</description>
- </element>
- <element name="JA-JP" internal_name="JA_JP">
- <description>Japanese - Japan</description>
- </element>
- <element name="AR-SA" internal_name="AR_SA">
- <description>Arabic - Saudi Arabia</description>
- </element>
- <element name="KO-KR" internal_name="KO_KR">
- <description>Korean - South Korea</description>
- </element>
- <element name="PT-BR" internal_name="PT_BR">
- <description>Portuguese - Brazil</description>
- </element>
- <element name="CS-CZ" internal_name="CS_CZ">
- <description>Czech - Czech Republic</description>
- </element>
- <element name="DA-DK" internal_name="DA_DK">
- <description>Danish - Denmark</description>
- </element>
- <element name="NO-NO" internal_name="NO_NO">
- <description>Norwegian - Norway</description>
- </element>
- <element name="NL-BE" internal_name="NL_BE">
- <description>Dutch (Flemish) - Belgium</description>
- </element>
- <element name="EL-GR" internal_name="EL_GR">
- <description>Greek - Greece</description>
- </element>
- <element name="HU-HU" internal_name="HU_HU">
- <description>Hungarian - Hungary</description>
- </element>
- <element name="FI-FI" internal_name="FI_FI">
- <description>Finnish - Finland</description>
- </element>
- <element name="SK-SK" internal_name="SK_SK">
- <description>Slovak - Slovakia</description>
- </element>
- <element name="EN-IN" internal_name="EN_IN">
- <description>English - India</description>
- </element>
- <element name="TH-TH" internal_name="TH_TH">
- <description>Thai - Thailand</description>
- </element>
- <element name="EN-SA" internal_name="EN_SA">
- <description>English - Middle East</description>
- </element>
- <element name="HE-IL" internal_name="HE_IL">
- <description>Hebrew - Israel</description>
- </element>
- <element name="RO-RO" internal_name="RO_RO">
- <description>Romanian - Romania</description>
- </element>
- <element name="UK-UA" internal_name="UK_UA">
- <description>Ukrainian - Ukraine</description>
- </element>
- <element name="ID-ID" internal_name="ID_ID">
- <description>Indonesian - Indonesia</description>
- </element>
- <element name="VI-VN" internal_name="VI_VN">
- <description>Vietnamese - Vietnam</description>
- </element>
- <element name="MS-MY" internal_name="MS_MY">
- <description>Malay - Malaysia</description>
- </element>
- <element name="HI-IN" internal_name="HI_IN">
- <description>Hindi - India</description>
- </element>
- </enum>
- <enum name="SoftButtonType">
- <description>Contains information about the SoftButton capabilities.</description>
- <element name="TEXT" internal_name="SBT_TEXT"/>
- <element name="IMAGE" internal_name="SBT_IMAGE"/>
- <element name="BOTH" internal_name="SBT_BOTH"/>
- </enum>
- <enum name="SystemAction">
- <description>Enumeration that describes system actions that can be triggered.</description>
- <element name="DEFAULT_ACTION">
- <description>Default action occurs. Standard behavior (e.g. SoftButton clears overlay).</description>
- </element>
- <element name="STEAL_FOCUS">
- <description>The calling app's dialog or related event should clear and the app should be brought into HMI_FULL.</description>
- </element>
- <element name="KEEP_CONTEXT">
- <description>Current system context is maintained. An overlay is persisted even though a SoftButton has been pressed and the notification sent.</description>
- </element>
- </enum>
- <enum name="AppHMIType">
- <description>Enumeration listing possible app types.</description>
- <element name="DEFAULT"/>
- <element name="COMMUNICATION"/>
- <element name="MEDIA"/>
- <element name="MESSAGING"/>
- <element name="NAVIGATION"/>
- <element name="INFORMATION"/>
- <element name="SOCIAL"/>
- <element name="BACKGROUND_PROCESS"/>
- <element name="TESTING"/>
- <element name="SYSTEM"/>
- </enum>
- <enum name="WayPointType">
- <description>Describes what kind of waypoint is requested/provided.</description>
- <element name="ALL" />
- <element name="DESTINATION" />
- </enum>
-
- <struct name="Coordinate">
- <param name="latitudeDegrees" minvalue="-90" maxvalue="90" type="Float" mandatory="true">
- <description>Latitude of the location.</description>
- </param>
- <param name="longitudeDegrees" minvalue="-180" maxvalue="180" type="Float" mandatory="true">
- <description>Longitude of the location.</description>
- </param>
- </struct>
- <enum name="LayoutMode">
- <description>For touchscreen interactions, the mode of how the choices are presented.</description>
- <element name="ICON_ONLY"/>
- <description>This mode causes the interaction to display the previous set of choices as icons.</description>
- <element name="ICON_WITH_SEARCH"/>
- <description>This mode causes the interaction to display the previous set of choices as icons along with a search field in the HMI.</description>
- <element name="LIST_ONLY"/>
- <description>This mode causes the interaction to display the previous set of choices as a list.</description>
- <element name="LIST_WITH_SEARCH"/>
- <description>This mode causes the interaction to display the previous set of choices as a list along with a search field in the HMI.</description>
- <element name="KEYBOARD"/>
- <description>This mode causes the interaction to immediately display a keyboard entry through the HMI.</description>
- </enum>
- <enum name="DeactivateReason">
- <description>Specifies the functionality the User has switched to.</description>
- <element name="AUDIO">
- <description>Navigated to audio(radio, etc)</description>
- </element>
- <element name="PHONECALL">
- <description>Navigated to make a call.</description>
- </element>
- <element name="NAVIGATIONMAP">
- <description>Navigated to navigation screen.</description>
- </element>
- <element name="PHONEMENU">
- <description>Navigated to phone menu.</description>
- </element>
- <element name="SYNCSETTINGS">
- <description>Navigated to settings menu.</description>
- </element>
- <element name="GENERAL">
- <description>Other screens navigation apart from other mobile app.</description>
- </element>
- </enum>
- <enum name="ClockUpdateMode">
- <description>Describes how the media clock timer should behave on the platform</description>
- <element name="COUNTUP"/>
- <description>Starts the media clock timer counting upwards, as in time elapsed.</description>
- <element name="COUNTDOWN"/>
- <description>Starts the media clock timer counting downwards, as in time remaining.</description>
- <element name="PAUSE"/>
- <description>Pauses the media clock timer</description>
- <element name="RESUME"/>
- <description>Resume the media clock timer</description>
- <element name="CLEAR"/>
- <description>Clears the media clock timer (previously done through Show-&gt;mediaClock)</description>
- </enum>
- <enum name="SystemContext">
- <description>Enumeration that describes possible contexts the application might be in on HU.</description>
- <description>Communicated to whichever app is in HMI FULL, except Alert.</description>
- <element name="MAIN" internal_name="SYSCTXT_MAIN">
- <description>The app's persistent display (whether media/non-media/navigation) is fully visible onscreen.</description>
- <description> There is currently no user interaction (user-initiated or app-initiated) with the head-unit</description>
- </element>
- <element name="VRSESSION" internal_name="SYSCTXT_VRSESSION">
- <description>The system is currently in a VR session (with whatever dedicated VR screen being overlaid onscreen).</description>
- </element>
- <element name="MENU" internal_name="SYSCTXT_MENU">
- <description>The system is currently displaying a system or in-App menu onscreen.</description>
- </element>
- <element name="HMI_OBSCURED" internal_name="SYSCTXT_HMI_OBSCURED">
- <description>The app's display HMI is currently obscuring with either a system or other app's overlay (except of Alert element).</description>
- </element>
- <element name="ALERT" internal_name="SYSCTXT_ALERT">
- <description>Broadcast only to whichever app has an alert currently being displayed.</description>
- </element>
- </enum>
- <enum name="HmiZoneCapabilities">
- <description>Contains information about the HMI zone capabilities.</description>
- <description>For future use.</description>
- <element name="FRONT"/>
- <element name="BACK"/>
- </enum>
- <enum name="SpeechCapabilities">
- <description>Contains information about the TTS capabilities.</description>
- <element name="TEXT" internal_name="SC_TEXT"/>
- <element name="SAPI_PHONEMES"/>
- <element name="LHPLUS_PHONEMES"/>
- <element name="PRE_RECORDED"/>
- <element name="SILENCE"/>
- </enum>
- <enum name="VrCapabilities">
- <description>Contains information about the VR capabilities.</description>
- <element name="TEXT" internal_name="VR_TEXT"/>
- </enum>
- <enum name="PrerecordedSpeech">
- <description>Contains a list of prerecorded speech items present on the platform.</description>
- <element name="HELP_JINGLE"/>
- <element name="INITIAL_JINGLE"/>
- <element name="LISTEN_JINGLE"/>
- <element name="POSITIVE_JINGLE"/>
- <element name="NEGATIVE_JINGLE"/>
- </enum>
- <enum name="TBTState">
- <description>Enumeration that describes possible states of turn-by-turn client or SmartDeviceLink app.</description>
- <element name="ROUTE_UPDATE_REQUEST"/>
- <element name="ROUTE_ACCEPTED"/>
- <element name="ROUTE_REFUSED"/>
- <element name="ROUTE_CANCELLED"/>
- <element name="ETA_REQUEST"/>
- <element name="NEXT_TURN_REQUEST"/>
- <element name="ROUTE_STATUS_REQUEST"/>
- <element name="ROUTE_SUMMARY_REQUEST"/>
- <element name="TRIP_STATUS_REQUEST"/>
- <element name="ROUTE_UPDATE_REQUEST_TIMEOUT"/>
- </enum>
- <enum name="ApplicationsCloseReason">
- <description>Describes the reasons for exiting all of applications.</description>
- <element name="IGNITION_OFF"/>
- <element name="MASTER_RESET"/>
- <element name="FACTORY_DEFAULTS"/>
- <element name="SUSPEND"/>
- </enum>
- <enum name="DisplayType">
- <description>The possible types of HU display.</description>
- <element name="CID">
- <description> A 2-line x 20 character "dot matrix" display </description>
- </element>
- <element name="TYPE2">
- <description> 1 line older radio head unit.</description>
- </element>
- <element name="TYPE5">
- <description> Old radio head unit.</description>
- </element>
- <element name="NGN">
- <description> Next Generation Navigation display.</description>
- </element>
- <element name="GEN2_8_DMA">
- <description> GEN-2, 8 inch display.</description>
- </element>
- <element name="GEN2_6_DMA">
- <description> GEN-2, 6 inch display.</description>
- </element>
- <element name="MFD3">
- <description> 3 inch GEN1.1 display </description>
- </element>
- <element name="MFD4">
- <description> 4 inch GEN1.1 display </description>
- </element>
- <element name="MFD5">
- <description> 5 inch GEN1.1 display </description>
- </element>
- <element name="GEN3_8_INCH"/>
- </enum>
- <enum name="ImageType">
- <description>Contains information about the type of image.</description>
- <element name="STATIC"/>
- <element name="DYNAMIC"/>
- </enum>
- <enum name="ApplicationExitReason">
- <element name="DRIVER_DISTRACTION_VIOLATION">
- <description>By getting this value, SDL puts the named app to NONE HMILevel</description>
- </element>
- <element name="USER_EXIT">
- <description>By getting this value, SDL puts the named app to NONE HMILevel</description>
- </element>
- <element name="UNAUTHORIZED_TRANSPORT_REGISTRATION">
- <description>By getting this value, SDL unregisters the named application</description>
- </element>
- <element name="UNSUPPORTED_HMI_RESOURCE">
- <description>By getting this value, SDL unregisters the named application</description>
- </element>
- </enum>
- <enum name="TextFieldName">
- <element name="mainField1">
- <description>The first line of first set of main fields of the persistent display; applies to "Show"</description>
- </element>
- <element name="mainField2">
- <description>The second line of first set of main fields of the persistent display; applies to "Show"</description>
- </element>
- <element name="mainField3">
- <description>The first line of second set of main fields of persistent display; applies to "Show"</description>
- </element>
- <element name="mainField4">
- <description>The second line of second set of main fields of the persistent display; applies to "Show"</description>
- </element>
- <element name="statusBar">
- <description>The status bar on NGN; applies to "Show"</description>
- </element>
- <element name="mediaClock">
- <description>Text value for MediaClock field; applies to "Show"</description>
- </element>
- <element name="mediaTrack">
- <description>The track field of NGN and GEN1.1 MFD displays. This field is only available for media applications; applies to "Show"</description>
- </element>
- <element name="alertText1">
- <description>The first line of the alert text field; applies to "Alert"</description>
- </element>
- <element name="alertText2">
- <description>The second line of the alert text field; applies to "Alert"</description>
- </element>
- <element name="alertText3">
- <description>The third line of the alert text field; applies to "Alert"</description>
- </element>
- <element name="scrollableMessageBody">
- <description>Long form body of text that can include newlines and tabs; applies to "ScrollableMessage"</description>
- </element>
- <element name="initialInteractionText">
- <description> First line suggestion for a user response (in the case of VR enabled interaction</description>
- </element>
- <element name="navigationText1">
- <description> First line of navigation text</description>
- </element>
- <element name="navigationText2">
- <description> Second line of navigation text</description>
- </element>
- <element name="ETA">
- <description> Estimated Time of Arrival time for navigation</description>
- </element>
- <element name="totalDistance">
- <description> Total distance to destination for navigation</description>
- </element>
- <element name="audioPassThruDisplayText1">
- <description> First line of text for audio pass thru</description>
- </element>
- <element name="audioPassThruDisplayText2">
- <description> Second line of text for audio pass thru</description>
- </element>
- <element name="sliderHeader">
- <description> Header text for slider</description>
- </element>
- <element name="sliderFooter">
- <description> Footer text for slider</description>
- </element>
- <element name="menuName">
- <description> Primary text for Choice</description>
- </element>
- <element name="secondaryText">
- <description> Secondary text for Choice</description>
- </element>
- <element name="tertiaryText">
- <description> Tertiary text for Choice</description>
- </element>
- <element name="menuTitle">
- <description> Optional text to label an app menu button (for certain touchscreen platforms).</description>
- </element>
- <element name="timeToDestination"/>
- <element name="navigationText">
- <description>Navigation text for UpdateTurnList.</description>
- </element>
- <element name="notificationText">
- <description>Text of notification to be displayed on screen.</description>
- </element>
- <element name="locationName">
- <description> Optional name / title of intended location for SendLocation.</description>
- </element>
- <element name="locationDescription">
- <description> Optional description of intended location / establishment (if applicable) for SendLocation.</description>
- </element>
- <element name="addressLines">
- <description> Optional location address (if applicable) for SendLocation.</description>
- </element>
- <element name="phoneNumber">
- <description> Optional hone number of intended location / establishment (if applicable) for SendLocation.</description>
- </element>
- <!-- TO DO to be removed -->
- <element name="turnText"/>
- </enum>
- <enum name="MetadataType">
- <element name="mediaTitle">
- <description>The data in this field contains the title of the currently playing audio track.</description>
- </element>
- <element name="mediaArtist">
- <description>The data in this field contains the artist or creator of the currently playing audio track.</description>
- </element>
- <element name="mediaAlbum">
- <description>The data in this field contains the album title of the currently playing audio track.</description>
- </element>
- <element name="mediaYear">
- <description>The data in this field contains the creation year of the currently playing audio track.</description>
- </element>
- <element name="mediaGenre">
- <description>The data in this field contains the genre of the currently playing audio track.</description>
- </element>
- <element name="mediaStation">
- <description>The data in this field contains the name of the current source for the media.</description>
- </element>
- <element name="rating">
- <description>The data in this field is a rating.</description>
- </element>
- <element name="currentTemperature">
- <description>The data in this field is the current temperature.</description>
- </element>
- <element name="maximumTemperature">
- <description>The data in this field is the maximum temperature for the day.</description>
- </element>
- <element name="minimumTemperature">
- <description>The data in this field is the minimum temperature for the day.</description>
- </element>
- <element name="weatherTerm">
- <description>The data in this field describes the current weather (ex. cloudy, clear, etc.).</description>
- </element>
- <element name="humidity">
- <description>The data in this field describes the current humidity value.</description>
- </element>
- </enum>
- <enum name="ImageFieldName">
- <element name="softButtonImage">
- <description>The image field for SoftButton</description>
- </element>
- <element name="choiceImage">
- <description>The first image field for Choice</description>
- </element>
- <element name="choiceSecondaryImage">
- <description>The secondary image field for Choice</description>
- </element>
- <element name="vrHelpItem">
- <description>The image field for vrHelpItem</description>
- </element>
- <element name="turnIcon">
- <description>The image field for Turn</description>
- </element>
- <element name="menuIcon">
- <description>The image field for the menu icon in SetGlobalProperties</description>
- </element>
- <element name="cmdIcon">
- <description>The image field for AddCommand</description>
- </element>
- <element name="appIcon">
- <description>The image field for the app icon (set by setAppIcon)</description>
- </element>
- <element name="graphic">
- <description>The image field for Show</description>
- </element>
- <element name="showConstantTBTIcon">
- <description>The primary image field for ShowConstantTBT</description>
- </element>
- <element name="showConstantTBTNextTurnIcon">
- <description>The secondary image field for ShowConstantTBT</description>
- </element>
- <element name="locationImage">
- <description>The optional image of a destination / location</description>
- </element>
- </enum>
- <enum name="TextAlignment">
- <description>The list of possible alignments, left, right, or centered</description>
- <element name="LEFT_ALIGNED"/>
- <element name="RIGHT_ALIGNED"/>
- <element name="CENTERED"/>
- </enum>
- <enum name="DriverDistractionState">
- <description>Enumeration that describes possible states of driver distraction.</description>
- <element name="DD_ON"/>
- <element name="DD_OFF"/>
- </enum>
- <enum name="MediaClockFormat">
- <element name="CLOCK1">
- <description>
- minutesFieldWidth = 2;minutesFieldMax = 19;secondsFieldWidth = 2;secondsFieldMax = 99;maxHours = 19;maxMinutes = 59;maxSeconds = 59;
- Is used for Type II, NGN and CID head units.
- </description>
- </element>
- <element name="CLOCK2">
- <description>
- minutesFieldWidth = 3;minutesFieldMax = 199;secondsFieldWidth = 2;secondsFieldMax = 99;maxHours = 59;maxMinutes = 59;maxSeconds = 59;
- Is used for Type V head units.
- </description>
- </element>
- <element name="CLOCK3">
- <description>
- minutesFieldWidth = 2;minutesFieldMax = 59;secondsFieldWidth = 2;secondsFieldMax = 59;maxHours = 9;maxMinutes = 59;maxSeconds = 59;
- Is used for GEN1.1 (i.e. MFD3/4/5) head units.
- </description>
- </element>
- <element name="CLOCKTEXT1">
- <description>
- 5 characters possible
- Format: 1|sp c :|sp c c
- 1|sp : digit "1" or space
- c : character out of following character set: sp|0-9|[letters
- :|sp : colon or space
- Is used for Type II head unit
- </description>
- </element>
- <element name="CLOCKTEXT2">
- <description>
- 5 chars possible
- Format: 1|sp c :|sp c c
- 1|sp : digit "1" or space
- c : character out of following character set: sp|0-9|[letters
- :|sp : colon or space
- Is used for CID and NGN head unit
- </description>
- </element>
- <element name="CLOCKTEXT3">
- <description>
- 6 chars possible
- Format: 1|sp c c :|sp c c
- 1|sp : digit "1" or space
- c : character out of following character set: sp|0-9|[letters
- :|sp : colon or space
- Is used for Type V head unit
- </description>
- </element>
- <element name="CLOCKTEXT4">
- <description>
- 6 chars possible
- Format: c :|sp c c : c c
- :|sp : colon or space
- c : character out of following character set: sp|0-9|[letters].
- Is used for GEN1.1 (i.e. MFD3/4/5) head units
- </description>
- </element>
- </enum>
- <enum name="VRCommandType">
- <element name="Choice">
- <description>Type that expound that current AddCommand should be pocessed as choise for initiated PerformInteraction request for current active on HMI.</description>
- </element>
- <element name="Command">
- <description>Type that expound that current AddCommand should be pocessed as common command for current application on HMI.</description>
- </element>
- </enum>
- <!--IVI part-->
- <enum name="ComponentVolumeStatus">
- <description>The volume status of a vehicle component.</description>
- <element name="UNKNOWN" internal_name="CVS_UNKNOWN">
- <description> The data is unknown.</description>
- </element>
- <element name="NORMAL" internal_name="CVS_NORMAL">
- <description> The volume is normal.</description>
- </element>
- <element name="LOW" internal_name="CVS_LOW">
- <description> The volume is low.</description>
- </element>
- <element name="FAULT" internal_name="CVS_FAULT">
- <description> The module/sensor is currently faulted. </description>
- </element>
- <element name="ALERT" internal_name="CVS_ALERT">
- <description> The component`s volume is in critical level.</description>
- </element>
- <element name="NOT_SUPPORTED" internal_name="CVS_NOT_SUPPORTED">
- <description> The data is not supported.</description>
- </element>
- </enum>
- <enum name="PRNDL">
- <description>The selected gear.</description>
- <element name="PARK">
- <description>Parking</description>
- </element>
- <element name="REVERSE">
- <description>Reverse gear</description>
- </element>
- <element name="NEUTRAL">
- <description>No gear</description>
- </element>
- <element name="DRIVE">
- </element>
- <element name="SPORT">
- <description>Drive Sport mode</description>
- </element>
- <element name="LOWGEAR">
- <description>1st gear hold</description>
- </element>
- <element name="FIRST">
- </element>
- <element name="SECOND">
- </element>
- <element name="THIRD">
- </element>
- <element name="FOURTH">
- </element>
- <element name="FIFTH">
- </element>
- <element name="SIXTH">
- </element>
- <element name="SEVENTH">
- </element>
- <element name="EIGHTH">
- </element>
- <element name="FAULT">
- </element>
- </enum>
- <enum name="VehicleDataEventStatus">
- <description>Reflects the status of a vehicle data event; e.g. a seat belt event status.</description>
- <element name="NO_EVENT" internal_name="VDES_NO_EVENT">
- <description> The system does not have the adequate information to send valid YES or NO states.</description>
- </element>
- <element name="NO" internal_name="VDES_NO">
- <description> The requested event is in NO state.</description>
- </element>
- <element name="YES" internal_name="VDES_YES">
- <description> The requested event is in YES state.</description>
- </element>
- <element name="NOT_SUPPORTED" internal_name="VDES_NOT_SUPPORTED">
- <description> The requested data is not supported </description>
- </element>
- <element name="FAULT" internal_name="VDES_FAULT">
- <description> The module/sensor is currently faulted.</description>
- </element>
- </enum>
- <enum name="VehicleDataStatus">
- <description>Reflects the status of a binary vehicle data item.</description>
- <element name="NO_DATA_EXISTS" internal_name="VDS_NO_DATA_EXISTS">
- </element>
- <element name="OFF" internal_name="VDS_OFF">
- </element>
- <element name="ON" internal_name="VDS_ON">
- </element>
- </enum>
- <enum name="IgnitionStableStatus">
- <description>Reflects the ignition switch stability.</description>
- <element name="IGNITION_SWITCH_NOT_STABLE">
- </element>
- <element name="IGNITION_SWITCH_STABLE">
- </element>
- <element name="MISSING_FROM_TRANSMITTER">
- <description> Either the data is not accessible or the sensor is broken.</description>
- </element>
- </enum>
- <enum name="IgnitionStatus">
- <description>Reflects the status of ignition.</description>
- <element name="UNKNOWN" internal_name="IS_UNKNOWN">
- <description> The information is not acceptable. </description>
- </element>
- <element name="OFF" internal_name="IS_OFF">
- <description> The ignition is off.</description>
- </element>
- <element name="ACCESSORY" internal_name="IS_ACCESSORY">
- <description> The accessories are active (power windows, audio, display, etc.).</description>
- </element>
- <element name="RUN" internal_name="IS_RUN">
- <description> Ignition is active.</description>
- </element>
- <element name="START" internal_name="IS_START">
- <description> Starter is switched.</description>
- </element>
- <element name="INVALID" internal_name="IS_INVALID">
- <description> The data is provided, but there is some sort of fault or problem.</description>
- </element>
- </enum>
- <enum name="DeviceLevelStatus">
- <description>Reflects the reported component status of the connected device, if reported.</description>
- <element name="ZERO_LEVEL_BARS">
- </element>
- <element name="ONE_LEVEL_BARS">
- </element>
- <element name="TWO_LEVEL_BARS">
- </element>
- <element name="THREE_LEVEL_BARS">
- </element>
- <element name="FOUR_LEVEL_BARS">
- </element>
- <element name="NOT_PROVIDED">
- </element>
- </enum>
- <enum name="PrimaryAudioSource">
- <description>Reflects the current primary audio source (if selected).</description>
- <element name="NO_SOURCE_SELECTED">
- </element>
- <element name="USB">
- </element>
- <element name="USB2">
- </element>
- <element name="BLUETOOTH_STEREO_BTST">
- </element>
- <element name="LINE_IN">
- </element>
- <element name="IPOD">
- </element>
- <element name="MOBILE_APP">
- </element>
- </enum>
- <enum name="CompassDirection">
- <description>The list of potential compass directions</description>
- <element name="NORTH">
- </element>
- <element name="NORTHWEST">
- </element>
- <element name="WEST">
- </element>
- <element name="SOUTHWEST">
- </element>
- <element name="SOUTH">
- </element>
- <element name="SOUTHEAST">
- </element>
- <element name="EAST">
- </element>
- <element name="NORTHEAST">
- </element>
- </enum>
- <enum name="Dimension">
- <description>The supported dimensions of the GPS</description>
- <element name="NO_FIX" internal_name="Dimension_NO_FIX">
- <description>No GPS at all</description>
- </element>
- <element name="2D" internal_name="Dimension_2D">
- <description>Longitude and lattitude</description>
- </element>
- <element name="3D" internal_name="Dimension_3D">
- <description>Longitude and lattitude and altitude</description>
- </element>
- </enum>
- <enum name="TouchType">
- <element name="BEGIN"/>
- <element name="MOVE"/>
- <element name="END"/>
- </enum>
- <enum name="WarningLightStatus">
- <description>Reflects the status of a cluster instrument warning light.</description>
- <element name="OFF" internal_name="WLS_OFF">
- </element>
- <element name="ON" internal_name="WLS_ON">
- </element>
- <element name="FLASH" internal_name="WLS_FLASH">
- </element>
- <element name="NOT_USED" internal_name="WLS_NOT_USED">
- </element>
- </enum>
- <enum name="VehicleDataResultCode">
- <description>Enumeration that describes possible result codes of a vehicle data entry request.</description>
- <element name="SUCCESS" internal_name="VDRC_SUCCESS"/>
- <element name="TRUNCATED_DATA" internal_name="VDRC_TRUNCATED_DATA"/>
- <element name="DISALLOWED" internal_name="VDRC_DISALLOWED"/>
- <element name="USER_DISALLOWED" internal_name="VDRC_USER_DISALLOWED"/>
- <element name="INVALID_ID" internal_name="VDRC_INVALID_ID"/>
- <element name="VEHICLE_DATA_NOT_AVAILABLE" internal_name="VDRC_DATA_NOT_AVAILABLE"/>
- <element name="DATA_ALREADY_SUBSCRIBED" internal_name="VDRC_DATA_ALREADY_SUBSCRIBED"/>
- <element name="DATA_NOT_SUBSCRIBED" internal_name="VDRC_DATA_NOT_SUBSCRIBED"/>
- <element name="IGNORED" internal_name="VDRC_IGNORED"/>
- </enum>
- <enum name="VehicleDataType">
- <description>Defines the data types that can be published and subscribed to.</description>
- <element name="VEHICLEDATA_GPS">
- <description>Notifies GPSData may be subscribed</description>
- </element>
- <element name="VEHICLEDATA_SPEED"/>
- <element name="VEHICLEDATA_RPM"/>
- <element name="VEHICLEDATA_FUELLEVEL"/>
- <element name="VEHICLEDATA_FUELLEVEL_STATE"/>
- <element name="VEHICLEDATA_FUELCONSUMPTION"/>
- <element name="VEHICLEDATA_EXTERNTEMP"/>
- <element name="VEHICLEDATA_VIN"/>
- <element name="VEHICLEDATA_PRNDL"/>
- <element name="VEHICLEDATA_TIREPRESSURE"/>
- <element name="VEHICLEDATA_ODOMETER"/>
- <element name="VEHICLEDATA_BELTSTATUS"/>
- <element name="VEHICLEDATA_BODYINFO"/>
- <element name="VEHICLEDATA_DEVICESTATUS"/>
- <element name="VEHICLEDATA_ECALLINFO"/>
- <element name="VEHICLEDATA_AIRBAGSTATUS"/>
- <element name="VEHICLEDATA_EMERGENCYEVENT"/>
- <element name="VEHICLEDATA_CLUSTERMODESTATUS"/>
- <element name="VEHICLEDATA_MYKEY"/>
- <element name="VEHICLEDATA_BRAKING"/>
- <element name="VEHICLEDATA_WIPERSTATUS"/>
- <element name="VEHICLEDATA_HEADLAMPSTATUS"/>
- <element name="VEHICLEDATA_BATTVOLTAGE"/>
- <element name="VEHICLEDATA_ENGINETORQUE"/>
- <element name="VEHICLEDATA_ACCPEDAL"/>
- <element name="VEHICLEDATA_STEERINGWHEEL"/>
- </enum>
- <enum name="WiperStatus">
- <description>Reflects the status of the wipers.</description>
- <element name="OFF">
- <description> The wipers are off.</description>
- </element>
- <element name="AUTO_OFF">
- <description> The wipers are automatically off </description>
- </element>
- <element name="OFF_MOVING">
- <description> Means that though set to off, somehow the wipers have been engaged (physically moved enough to engage a wiping motion).</description>
- </element>
- <element name="MAN_INT_OFF">
- <description> The wipers are manually off after having been working.</description>
- </element>
- <element name="MAN_INT_ON">
- <description> The wipers are manually on.</description>
- </element>
- <element name="MAN_LOW">
- <description> The wipers are manually set to low speed.</description>
- </element>
- <element name="MAN_HIGH">
- <description> The wipers are manually set to high speed.</description>
- </element>
- <element name="MAN_FLICK">
- <description> The wipers are manually set for doing a flick.</description>
- </element>
- <element name="WASH">
- <description> The wipers are set to use the water from vehicle washer bottle for cleaning the windscreen.</description>
- </element>
- <element name="AUTO_LOW">
- <description> The wipers are automatically set to low speed.</description>
- </element>
- <element name="AUTO_HIGH">
- <description> The wipers are automatically set to high speed.</description>
- </element>
- <element name="COURTESYWIPE">
- <description> This is for when a user has just initiated a WASH and several seconds later a secondary wipe is automatically initiated to clear remaining fluid.</description>
- </element>
- <element name="AUTO_ADJUST">
- <description> This is set as the user moves between possible automatic wiper speeds.</description>
- </element>
- <element name="STALLED">
- <description> The wiper is stalled to its place. </description>
- </element>
- <element name="NO_DATA_EXISTS">
- <description> The sensor / module cannot provide any information for wiper.</description>
- </element>
- </enum>
- <enum name="SamplingRate">
- <description>Describes different sampling options for PerformAudioPassThru.</description>
- <element name="8KHZ" internal_name="RATE_8KHZ"/>
- <element name="16KHZ" internal_name="RATE_16KHZ"/>
- <element name="22KHZ" internal_name="RATE_22KHZ"/>
- <element name="44KHZ" internal_name="RATE_44KHZ"/>
- </enum>
- <enum name="BitsPerSample">
- <description>Describes different quality options for PerformAudioPassThru.</description>
- <element name="8_BIT" internal_name="RATE_8_BIT"/>
- <element name="16_BIT" internal_name="RATE_16_BIT"/>
- </enum>
- <enum name="AudioType">
- <description>Describes different audio type options for PerformAudioPassThru.</description>
- <element name="PCM"/>
- </enum>
- <enum name="KeyboardLayout">
- <description>Enumeration listing possible keyboard layouts.</description>
- <element name="QWERTY"/>
- <element name="QWERTZ"/>
- <element name="AZERTY"/>
- </enum>
- <enum name="KeyboardEvent">
- <description>Enumeration listing possible keyboard events.</description>
- <element name="KEYPRESS"/>
- <element name="ENTRY_SUBMITTED"/>
- <element name="ENTRY_VOICE"/>
- <element name="ENTRY_CANCELLED"/>
- <element name="ENTRY_ABORTED"/>
- </enum>
- <enum name="KeypressMode">
- <description>Enumeration listing possible keyboard events.</description>
- <element name="SINGLE_KEYPRESS">
- <description>Each keypress is individually sent as the user presses the keyboard keys.</description>
- </element>
- <element name="QUEUE_KEYPRESSES">
- <description>The keypresses are queued and a string is eventually sent once the user chooses to submit their entry.</description>
- </element>
- <element name="RESEND_CURRENT_ENTRY">
- <description>The keypresses are queue and a string is sent each time the user presses a keyboard key; the string contains the entire current entry.</description>
- </element>
- </enum>
- <enum name="AmbientLightStatus">
- <description>Reflects the status of the ambient light sensor.</description>
- <element name="NIGHT"/>
- <element name="TWILIGHT_1"/>
- <element name="TWILIGHT_2"/>
- <element name="TWILIGHT_3"/>
- <element name="TWILIGHT_4"/>
- <element name="DAY"/>
- <element name="UNKNOWN"/>
- <element name="INVALID"/>
- </enum>
- <enum name="FileType">
- <description>Enumeration listing possible file types.</description>
- <element name="GRAPHIC_BMP"/>
- <element name="GRAPHIC_JPEG"/>
- <element name="GRAPHIC_PNG"/>
- <element name="AUDIO_WAVE"/>
- <element name="AUDIO_MP3"/>
- <element name="AUDIO_AAC"/>
- <element name="BINARY"/>
- <element name="JSON"/>
- </enum>
- <enum name="RequestType">
- <description>Enumeration listing possible asynchronous requests.</description>
- <element name="HTTP"/>
- <element name="FILE_RESUME"/>
- <element name="AUTH_REQUEST"/>
- <element name="AUTH_CHALLENGE"/>
- <element name="AUTH_ACK"/>
- <element name="PROPRIETARY"/>
- <element name="QUERY_APPS"/>
- <element name="LAUNCH_APP"/>
- <element name="LOCK_SCREEN_ICON_URL"/>
- <element name="TRAFFIC_MESSAGE_CHANNEL"/>
- <element name="DRIVER_PROFILE"/>
- <element name="VOICE_SEARCH"/>
- <element name="NAVIGATION"/>
- <element name="PHONE"/>
- <element name="CLIMATE"/>
- <element name="SETTINGS"/>
- <element name="VEHICLE_DIAGNOSTICS"/>
- <element name="EMERGENCY"/>
- <element name="MEDIA"/>
- <element name="FOTA"/>
- </enum>
- <enum name="ECallConfirmationStatus">
- <description>Reflects the status of the eCall Notification.</description>
- <element name="NORMAL" internal_name="ECCS_NORMAL">
- </element>
- <element name="CALL_IN_PROGRESS" internal_name="ECCS_CALL_IN_PROGRESS">
- </element>
- <element name="CALL_CANCELLED" internal_name="ECCS_CALL_CANCELLED">
- </element>
- <element name="CALL_COMPLETED">
- </element>
- <element name="CALL_UNSUCCESSFUL" internal_name="ECCS_CALL_UNSUCCESSFUL">
- </element>
- <element name="ECALL_CONFIGURED_OFF" internal_name="ECCS_ECALL_CONFIGURED_OFF">
- </element>
- <element name="CALL_COMPLETE_DTMF_TIMEOUT" internal_name="ECCS_CALL_COMPLETE_DTMF_TIMEOUT">
- </element>
- </enum>
- <enum name="VehicleDataNotificationStatus">
- <description>Reflects the status of a vehicle data notification.</description>
- <element name="NOT_SUPPORTED" internal_name="VDNS_NOT_SUPPORTED">
- </element>
- <element name="NORMAL" internal_name="VDNS_NORMAL">
- </element>
- <element name="ACTIVE" internal_name="VDNS_ACTIVE">
- </element>
- <element name="NOT_USED" internal_name="VDNS_NOT_USED">
- </element>
- </enum>
- <enum name="EmergencyEventType">
- <description>Reflects the emergency event status of the vehicle.</description>
- <element name="NO_EVENT" internal_name="EET_NO_EVENT">
- </element>
- <element name="FRONTAL" internal_name="EET_FRONTAL">
- </element>
- <element name="SIDE" internal_name="EET_SIDE">
- </element>
- <element name="REAR" internal_name="EET_REAR">
- </element>
- <element name="ROLLOVER" internal_name="EET_ROLLOVER">
- </element>
- <element name="NOT_SUPPORTED" internal_name="EET_NOT_SUPPORTED">
- </element>
- <element name="FAULT" internal_name="EET_FAULT">
- </element>
- </enum>
- <enum name="FuelCutoffStatus">
- <description>Reflects the status of the RCM fuel cutoff.</description>
- <element name="TERMINATE_FUEL" internal_name="FCS_TERMINATE_FUEL">
- </element>
- <element name="NORMAL_OPERATION" internal_name="FCS_NORMAL_OPERATION">
- </element>
- <element name="FAULT" internal_name="FCS_FAULT">
- </element>
- </enum>
- <enum name="PowerModeQualificationStatus">
- <description>Reflects the status of the current power mode qualification.</description>
- <element name="POWER_MODE_UNDEFINED">
- </element>
- <element name="POWER_MODE_EVALUATION_IN_PROGRESS">
- </element>
- <element name="NOT_DEFINED">
- </element>
- <element name="POWER_MODE_OK">
- </element>
- </enum>
- <enum name="CarModeStatus">
- <description>Reflects the status of the current car mode.</description>
- <element name="NORMAL" internal_name="CMS_NORMAL">
- </element>
- <element name="FACTORY" internal_name="CMS_FACTORY">
- </element>
- <element name="TRANSPORT" internal_name="CMS_TRANSPORT">
- </element>
- <element name="CRASH" internal_name="CMS_CRASH">
- </element>
- </enum>
- <enum name="PowerModeStatus">
- <description>Reflects the status of the current power mode.</description>
- <element name="KEY_OUT">
- </element>
- <element name="KEY_RECENTLY_OUT">
- </element>
- <element name="KEY_APPROVED_0">
- </element>
- <element name="POST_ACCESORY_0">
- </element>
- <element name="ACCESORY_1">
- </element>
- <element name="POST_IGNITION_1">
- </element>
- <element name="IGNITION_ON_2">
- </element>
- <element name="RUNNING_2">
- </element>
- <element name="CRANK_3">
- </element>
- </enum>
- <enum name="CharacterSet">
- <description>The list of potential character sets</description>
- <element name="TYPE2SET">
- <description>See [@TODO: create file ref]</description>
- </element>
- <element name="TYPE5SET">
- <description>See [@TODO: create file ref]</description>
- </element>
- <element name="CID1SET">
- <description>See [@TODO: create file ref]</description>
- </element>
- <element name="CID2SET">
- <description>See [@TODO: create file ref]</description>
- </element>
- </enum>
- <!-- End of IVI part-->
- <enum name="AppPriority">
- <element name="EMERGENCY"/>
- <element name="NAVIGATION"/>
- <element name="VOICE_COMMUNICATION"/>
- <element name="COMMUNICATION"/>
- <element name="NORMAL"/>
- <element name="NONE"/>
- </enum>
-<enum name="MethodName">
- <description>Defines the type of the request which causes text-to-speech prompt</description>
- <element name="ALERT"/>
- <element name="SPEAK"/>
- <element name="AUDIO_PASS_THRU"/>
- <element name="ALERT_MANEUVER"/>
-</enum>
-
-<enum name="AlertType">
-<description>Defines the type of the request which causes text-to-speech prompt</description>
-<element name="UI"/>
-<element name="BOTH"/>
-</enum>
-
-<enum name="HMILevel">
- <element name="FULL"/>
- <element name="LIMITED"/>
- <element name="BACKGROUND"/>
- <element name="NONE"/>
-</enum>
-
-<enum name="EventTypes">
- <description>Reflects the current active event</description>
- <element name="AUDIO_SOURCE">
- <description>Navigated to audio(radio, etc)</description>
- </element>
- <element name="EMBEDDED_NAVI">
- <description>Navigated to navigation screen</description>
- </element>
- <element name="PHONE_CALL">
- <description>Phone call is active</description>
- </element>
- <element name="EMERGENCY_EVENT">
- <description>Active emergency event, active parking event</description>
- </element>
- <element name="DEACTIVATE_HMI">
- <description> GAL/DIO is active </description>
- </element>
-</enum>
-
-<enum name="VideoStreamingProtocol">
- <description>Enum for each type of video streaming protocol type.</description>
- <element name="RAW">
- <description>
- Raw stream bytes that contains no timestamp data and is the lowest supported video streaming
- </description>
- </element>
- <element name="RTP">
- <description>
- RTP facilitates the transfer of real-time data. Information provided by this protocol include
- timestamps (for synchronization), sequence numbers (for packet loss and reordering detection)
- and the payload format which indicates the encoded format of the data.
- </description>
- </element>
- <element name="RTSP">
- <description>
- The transmission of streaming data itself is not a task of RTSP. Most RTSP servers use the
- Real-time Transport Protocol (RTP) in conjunction with Real-time Control Protocol (RTCP)
- for media stream delivery. However, some vendors implement proprietary transport protocols.
- </description>
- </element>
- <element name="RTMP">
- <description>
- Real-Time Messaging Protocol (RTMP) was initially a proprietary protocol developed by
- Macromedia for streaming audio, video and data over the Internet, between a Flash player
- and a server. Macromedia is now owned by Adobe, which has released an incomplete version
- of the specification of the protocol for public use.
- </description>
- </element>
- <element name="WEBM">
- <description>
- The WebM container is based on a profile of Matroska. WebM initially supported VP8 video and
- Vorbis audio streams. In 2013 it was updated to accommodate VP9 video and Opus audio.
- </description>
- </element>
-</enum>
-
-<enum name="VideoStreamingCodec">
- <description>Enum for each type of video streaming codec.</description>
- <element name="H264">
- <description>
- A block-oriented motion-compensation-based video compression standard.
- As of 2014 it is one of the most commonly used formats for the recording, compression, and
- distribution of video content.
- </description>
- </element>
- <element name="H265">
- <description>
- High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2, is a video
- compression standard, one of several potential successors to the widely used AVC (H.264 or
- MPEG-4 Part 10). In comparison to AVC, HEVC offers about double the data compression ratio
- at the same level of video quality, or substantially improved video quality at the same
- bit rate. It supports resolutions up to 8192x4320, including 8K UHD.
- </description>
- </element>
- <element name="Theora">
- <description>
- Theora is derived from the formerly proprietary VP3 codec, released into the public domain
- by On2 Technologies. It is broadly comparable in design and bitrate efficiency to
- MPEG-4 Part 2, early versions of Windows Media Video, and RealVideo while lacking some of
- the features present in some of these other codecs. It is comparable in open standards
- philosophy to the BBC's Dirac codec.
- </description>
- </element>
- <element name="VP8">
- <description>
- VP8 can be multiplexed into the Matroska-based container format WebM along with Vorbis and
- Opus audio. The image format WebP is based on VP8's intra-frame coding. VP8's direct
- successor, VP9, and the emerging royalty-free internet video format AV1 from the Alliance for
- Open Media (AOMedia) are based on VP8.
- </description>
- </element>
- <element name="VP9">
- <description>
- Similar to VP8, but VP9 is customized for video resolutions beyond high-definition video (UHD)
- and also enables lossless compression.
- </description>
- </element>
-</enum>
-
- <!-- Policies -->
- <enum name="UpdateResult">
- <element name="UP_TO_DATE"/>
- <element name="UPDATING"/>
- <element name="UPDATE_NEEDED"/>
- </enum>
- <enum name="SystemError">
- <element name="SYNC_REBOOTED"/>
- <element name="SYNC_OUT_OF_MEMMORY"/>
- </enum>
- <enum name="StatisticsType">
- <element name="iAPP_BUFFER_FULL"/>
- </enum>
- <enum name="ConsentSource">
- <element name="GUI"/>
- <element name="VUI"/>
- </enum>
- <enum name="DeviceState">
- <element name="UNKNOWN"/>
- <element name="UNPAIRED"/>
- </enum>
- <struct name="DeviceInfo">
- <param name="name" type="String" mandatory="true">
- <description>The name of the device connected.</description>
- </param>
- <param name="id" type="String" mandatory="true">
- <description>The ID of the device connected</description>
- </param>
- <param name="transportType" type="Common.TransportType" mandatory="false">
- <description>The transport type the named-app's-device is connected over HU(BlueTooth, USB or WiFi). It must be provided in OnAppRegistered and in UpdateDeviceList</description>
- </param>
- <param name="isSDLAllowed" type="Boolean" mandatory="false">
- <description>Sent by SDL in UpdateDeviceList. &#8217;true&#8217; &#8211; if device is allowed for PolicyTable Exchange; &#8216;false&#8217; &#8211; if device is NOT allowed for PolicyTable Exchange </description>
- </param>
- </struct>
- <struct name="UserFriendlyMessage" scope="internal">
- <param name="messageCode" type="String" mandatory="true"/>
- <param name="ttsString" type="String" mandatory="false"/>
- <param name="label" type="String" mandatory="false"/>
- <param name="line1" type="String" mandatory="false"/>
- <param name="line2" type="String" mandatory="false"/>
- <param name="textBody" type="String" mandatory="false"/>
- </struct>
- <struct name="PermissionItem">
- <param name="name" type="String" mandatory="true">
- <description>Code of message of user-friendly text about functional group to be allowed/disallowed</description>
- </param>
- <param name="id" type="Integer" mandatory="true">
- <description>Id of corresponding functional group, needed by SDL.</description>
- </param>
- <param name="allowed" type="Boolean" mandatory="false">
- <description>Specifies whether functionality was allowed/disallowed. If ommited - no information about User Consent is yet found for app.</description>
- </param>
- </struct>
- <struct name="ServiceInfo">
- <param name="url" type="String" mandatory="true">
- <description>Get URL based on service type.</description>
- </param>
- <param name="policyAppId" type="String" mandatory="false">
- <description>Used if URL needed are specific for application.</description>
- </param>
- </struct>
- <!-- End of Policies -->
- <struct name="TextField">
- <param name="name" type="Common.TextFieldName" mandatory="true">
- <description>The name that identifies the field. See TextFieldName.</description>
- </param>
- <param name="characterSet" type="Common.CharacterSet" mandatory="true">
- <description>The character set that is supported in this field. See CharacterSet.</description>
- </param>
- <param name="width" type="Integer" minvalue="1" maxvalue="500" mandatory="true">
- <description>The number of characters in one row of this field.</description>
- </param>
- <param name="rows" type="Integer" minvalue="1" maxvalue="8" mandatory="true">
- <description>The number of rows of this field.</description>
- </param>
- </struct>
- <struct name="ButtonCapabilities">
- <description>Contains the information about capabilities of a button.</description>
- <param name="name" type="Common.ButtonName" mandatory="true">
- <description>The name of the Button from the ButtonName enum</description>
- </param>
- <param name="shortPressAvailable" type="Boolean" mandatory="true">
- <description>The button supports a short press. Whenever the button is pressed short, onButtonPressed(SHORT) should be invoked.</description>
- </param>
- <param name="longPressAvailable" type="Boolean" mandatory="true">
- <description>The button supports a LONG press. Whenever the button is pressed long, onButtonPressed(LONG) should be invoked.</description>
- </param>
- <param name="upDownAvailable" type="Boolean" mandatory="true">
- <description>The button supports "button down" and "button up". Whenever the button is pressed, onButtonEvent(DOWN) should be invoked. Whenever the button is released, onButtonEvent(UP) should be invoked.</description>
- </param>
- </struct>
- <struct name="VehicleDataResult">
- <description>Individual published data request result</description>
- <param name="dataType" type="Common.VehicleDataType" mandatory="true">
- <description>Defined published data element type.</description>
- </param>
- <param name="resultCode" type="Common.VehicleDataResultCode" mandatory="true">
- <description>Published data result code.</description>
- </param>
- </struct>
- <struct name="TouchCoord">
- <param name="x" type="Integer" mandatory="true" minvalue="0" maxvalue="10000">
- <description>The x coordinate of the touch.</description>
- </param>
- <param name="y" type="Integer" mandatory="true" minvalue="0" maxvalue="10000">
- <description>The y coordinate of the touch.</description>
- </param>
- </struct>
- <struct name="TouchEvent">
- <param name="id" type="Integer" mandatory="true" minvalue="0" maxvalue="9">
- <description>
- A touch's unique identifier. The application can track the current touch events by id.
- If a touch event has type begin, the id should be added to the set of touches.
- If a touch event has type end, the id should be removed from the set of touches.
- </description>
- </param>
- <param name="ts" type="Integer" mandatory="true" array="true" minvalue="0" maxvalue="2147483647" minsize="1" maxsize="1000">
- <description>
- The time that the touch was recorded. This number can the time since the beginning of the session or something else as long as the units are in milliseconds.
- The timestamp is used to determined the rate of change of position of a touch.
- The application also uses the time to verify whether two touches, with different ids, are part of a single action by the user.
- If there is only a single timestamp in this array, it is the same for every coordinate in the coordinates array.
- </description>
- </param>
- <param name="c" type="Common.TouchCoord" mandatory="true" array="true" minsize="1" maxsize="1000">
- </param>
- </struct>
- <struct name="PresetBankCapabilities">
- <description>Contains information about on-screen preset capabilities (whether the HW preset buttons could be duplicated with onscreen buttons).</description>
- <param name="onScreenPresetsAvailable" type="Boolean" mandatory="true">
- <description>Must be true if onscreen custom presets are available.</description>
- </param>
- </struct>
- <struct name="Image">
- <param name="value" maxlength="65535" type="String" mandatory="true">
- <description>The path to the dynamic image stored on HU or the static binary image itself.</description>
- </param>
- <param name="imageType" type="Common.ImageType" mandatory="true">
- <description>Describes, whether it is a static or dynamic image.</description>
- </param>
- </struct>
- <struct name="SoftButton">
- <param name="type" type="Common.SoftButtonType" mandatory="true">
- <description>Describes, whether text, icon or both text and image should be displayed on the soft button. See softButtonType</description>
- </param>
- <param name="text" maxlength="500" type="String" mandatory="false">
- <description>Optional text to be displayed (if defined as TEXT or BOTH)</description>
- </param>
- <param name="image" type="Common.Image" mandatory="false">
- <description>Optional image struct for SoftButton (if defined as IMAGE or BOTH)</description>
- </param>
- <param name="isHighlighted" type="Boolean" mandatory="false">
- <description>If true, must be highlighted</description>
- <description>If false, must be not</description>
- </param>
- <param name="softButtonID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Value which must be returned via OnButtonPress / OnButtonEvent</description>
- </param>
- <param name="systemAction" type="Common.SystemAction" mandatory="true">
- <description>Parameter indicates whether clicking a SoftButton must call a specific system action. See SystemAction</description>
- </param>
- </struct>
- <struct name="TTSChunk">
- <description>A TTS chunk, that consists of the text/phonemes to be spoken</description>
- <param name="text" type="String" mandatory="true" maxlength="500">
- <description>The text or phonemes to be spoken.</description>
- </param>
- <param name="type" type="Common.SpeechCapabilities" mandatory="true">
- <description>Describes, whether it is text or a specific phoneme set. See SpeechCapabilities.</description>
- </param>
- </struct>
- <struct name="HMIApplication">
- <description>Data type containing information about application needed by HMI.</description>
- <param name="appName" type="String" maxlength="100" mandatory="true">
- <description>The mobile application name, e.g. "Ford Drive Green".</description>
- </param>
- <param name="ngnMediaScreenAppName" type="String" maxlength="100" mandatory="false">
- <description>Provides an abbreviated version of the app name (if needed), that may be displayed on the NGN media screen.</description>
- <description>If not provided, the appName should be used instead (and may be truncated if too long)</description>
- </param>
- <param name="icon" type="String" mandatory="false">
- <description>Path to application icon stored on HU.</description>
- </param>
- <param name="deviceInfo" type="Common.DeviceInfo" mandatory="true">
- <description>The ID, serial number, transport type the named-app's-device is connected over to HU.</description>
- </param>
- <param name="policyAppID" type="String" maxlength="50" minlength="1" mandatory="true">
- <description>Policy ID(=the appID the application registers with) of registered application.</description>
- </param>
- <param name="ttsName" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- TTS string for VR recognition of the mobile application name, e.g. "Ford Drive Green".
- Meant to overcome any failing on speech engine in properly pronouncing / understanding app name.
- May not be empty.
- May not start with a new line character.
- Not unique value
- </description>
- </param>
- <param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- Defines an additional voice recognition command.
- Must not interfere with any name of previously registered applications(SDL makes check).
- </description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>Unique (during ignition cycle) id of the application. To be used in all RPCs sent by both HU system and SDL</description>
- </param>
- <param name="hmiDisplayLanguageDesired" type="Common.Language" mandatory="true">
- <description>The language the application intends to use on HU </description>
- </param>
- <param name="isMediaApplication" type="Boolean" mandatory="true">
- <description>Indicates whether it is a media or a non-media application.</description>
- </param>
- <param name="appType" type="Common.AppHMIType" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>List of all applicable app types stating which classifications to be given to the app.</description>
- <description>e.g. for platforms like GEN2, this determines which "corner(s)" the app can populate.</description>
- </param>
- <param name="greyOut" type="Boolean" mandatory="false">
- <description>Indicates whether application should be dimmed on the screen.</description>
- <description>Applicable only for apps received through QueryApps and still not registered.</description>
- </param>
- <param name="requestType" type="Common.RequestType" minsize="0" maxsize="100" array="true" mandatory="false">
- <description>The list of SystemRequest's RequestTypes allowed by policies for the named application</description>
- <description>(the app's SystemRequest sent with RequestType out of this list will get 'disallowed' response from SDL).</description>
- <description>If SDL sends an empty array - any RequestType is allowed for this app.</description>
- <description>If SDL omits this parameter - none RequestType is allowed for this app</description>
- <description>(either this is a pre-registered app or such is dictated by policies).</description>
- </param>
- </struct>
- <struct name="MenuParams">
- <param name="parentID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
- <description>unique ID of the sub menu, the command must be added to.</description>
- <description>If not provided, the command must be added to the top level of the in application menu.</description>
- </param>
- <param name="position" type="Integer" minvalue="0" maxvalue="1000" mandatory="false">
- <description>Position within the items that are at the top level of the in application menu.</description>
- <description>0 should insert at the front.</description>
- <description>1 should insert at the second position.</description>
- <description>if position is greater than or equal to the number of items on the top level, the the sub menu/command should be appended to the end.</description>
- <description>If this param is omitted the entry should be added at the end.</description>
- </param>
- <param name="menuName" type="String" maxlength="500" mandatory="true">
- <description>The name of the sub menu/command.</description>
- </param>
- </struct>
- <struct name="Choice">
- <description>A choice is an option given to the user which can be selected either by menu, or through voice recognition system.</description>
- <param name="choiceID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description> The unique within the concerned application identifier for this choice </description>
- </param>
- <param name="menuName" type="String" maxlength="500" mandatory="false">
- <description> The name of the choice </description>
- </param>
- <param name="image" type="Common.Image" mandatory="false">
- <description> The image for representing the choice </description>
- </param>
- <param name="secondaryText" maxlength="500" type="String" mandatory="false">
- <description>Optional secondary text to display; e.g. address of POI in a search result entry</description>
- </param>
- <param name="tertiaryText" maxlength="500" type="String" mandatory="false">
- <description>Optional tertiary text to display; e.g. distance to POI for a search result entry</description>
- </param>
- <param name="secondaryImage" type="Image" mandatory="false">
- <description>Optional secondary image struct for choice</description>
- </param>
- </struct>
- <struct name="VrHelpItem">
- <param name="text" maxlength="500" type="String" mandatory="true">
- <description>Text to display for VR Help item</description>
- </param>
- <param name="image" type="Common.Image" mandatory="false">
- <description>Image struct for VR Help item</description>
- </param>
- <param name="position" type="Integer" minvalue="1" maxvalue="100" mandatory="true">
- <description>Position to display item in VR Help list</description>
- </param>
- </struct>
- <struct name="TimeFormat">
- <param name="hours" type="Integer" minvalue="0" maxvalue="59" mandatory="true">
- <description>The hour of the media clock.</description>
- <description>Some units only support a max of 19 hours. If out of range, it should be rejected.</description>
- </param>
- <param name="minutes" type="Integer" minvalue="0" maxvalue="59" mandatory="true"/>
- <param name="seconds" type="Integer" minvalue="0" maxvalue="59" mandatory="true"/>
- </struct>
- <struct name="TouchEventCapabilities">
- <param name="pressAvailable" type="Boolean" mandatory="true">
- </param>
- <param name="multiTouchAvailable" type="Boolean" mandatory="true">
- </param>
- <param name="doublePressAvailable" type="Boolean" mandatory="true">
- </param>
- </struct>
- <struct name="ImageResolution">
- <param name="resolutionWidth" type="Integer" minvalue="1" maxvalue="10000" mandatory="true">
- <description>The image resolution width.</description>
- </param>
- <param name="resolutionHeight" type="Integer" minvalue="1" maxvalue="10000" mandatory="true">
- <description>The image resolution height.</description>
- </param>
- </struct>
- <struct name="ScreenParams">
- <param name="resolution" type="Common.ImageResolution" mandatory="true">
- <description>The resolution of the prescribed screen area.</description>
- </param>
- <param name="touchEventAvailable" type="Common.TouchEventCapabilities" mandatory="false">
- <description>Types of screen touch events available in screen area.</description>
- </param>
- </struct>
- <struct name="ImageField">
- <param name="name" type="Common.ImageFieldName" mandatory="true">
- <description>The name that identifies the field. See ImageFieldName.</description>
- </param>
- <param name="imageTypeSupported" type="Common.FileType" maxsize="100" array="true" mandatory="false" minsize="1">
- <description>The image types that are supported in this field. See FileType.</description>
- </param>
- <param name="imageResolution" type="Common.ImageResolution" mandatory="false">
- <description>The image resolution of this field.</description>
- </param>
- </struct>
- <struct name="VideoStreamingFormat">
- <description>Video streaming formats and their specifications.</description>
- <param name="protocol" type="Common.VideoStreamingProtocol" mandatory="true">
- <description>Protocol type, see VideoStreamingProtocol</description>
- </param>
- <param name="codec" type="Common.VideoStreamingCodec" mandatory="true">
- <description>Codec type, see VideoStreamingCodec</description>
- </param>
- </struct>
-
- <struct name="VideoConfig">
- <description>Configuration of a video stream.</description>
- <param name="protocol" type="Common.VideoStreamingProtocol" mandatory="false">
- <description>The video protocol configuration</description>
- </param>
- <param name="codec" type="Common.VideoStreamingCodec" mandatory="false">
- <description>The video codec configuration</description>
- </param>
- <param name="width" type="Integer" mandatory="false">
- <description>Width of the video stream, in pixels.</description>
- </param>
- <param name="height" type="Integer" mandatory="false">
- <description>Height of the video stream, in pixels.</description>
- </param>
- </struct>
- <struct name="DisplayCapabilities">
- <description>Contains information about the display capabilities.</description>
- <param name="displayType" type="Common.DisplayType" mandatory="true">
- <description>The type of the display. See DisplayType</description>
- </param>
- <param name="textFields" type="Common.TextField" minsize="0" maxsize="100" array="true" mandatory="true">
- <description>A set of all fields for text displaying supported by HU. See TextFieldName.</description>
- <description>If there are no textfields supported, the empty array must be returned</description>
- </param>
- <param name="imageFields" type="Common.ImageField" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>A set of all fields that support images. See ImageField</description>
- </param>
- <param name="mediaClockFormats" type="Common.MediaClockFormat" minsize="0" maxsize="100" array="true" mandatory="true">
- <description>A set of all supported formats of the media clock. See MediaClockFormat</description>
- </param>
- <param name="imageCapabilities" type="Common.ImageType" array="true" minsize="0" maxsize="2" mandatory="false">
- </param>
- <param name="graphicSupported" type="Boolean" mandatory="true">
- <description>The display's persistent screen supports referencing a static or dynamic image.</description>
- </param>
- <param name="templatesAvailable" type="String" minsize="0" maxsize="100" maxlength="100" array="true" mandatory="true">
- <description>A set of all predefined persistent display templates available on headunit. To be referenced in SetDisplayLayout.</description>
- </param>
- <param name="screenParams" type="Common.ScreenParams" mandatory="false">
- <description>A set of all parameters related to a prescribed screen area (e.g. for video / touch input).</description>
- </param>
- <param name="numCustomPresetsAvailable" type="Integer" minvalue="1" maxvalue="100" mandatory="false">
- <description>The number of on-screen custom presets available (if any); otherwise omitted.</description>
- </param>
- </struct>
- <struct name="SoftButtonCapabilities">
- <description>Contains information about a SoftButton's capabilities.</description>
- <param name="shortPressAvailable" type="Boolean" mandatory="true">
- <description>The button supports a short press.</description>
- <description>Whenever the button is pressed short, onButtonPressed( SHORT) must be invoked.</description>
- </param>
- <param name="longPressAvailable" type="Boolean" mandatory="true">
- <description>The button supports a LONG press.</description>
- <description>Whenever the button is pressed long, onButtonPressed( LONG) must be invoked.</description>
- </param>
- <param name="upDownAvailable" type="Boolean" mandatory="true">
- <description>The button supports "button down" and "button up".</description>
- <description>Whenever the button is pressed, onButtonEvent( DOWN) must be invoked.</description>
- <description>Whenever the button is released, onButtonEvent( UP) must be invoked.</description>
- </param>
- <param name="imageSupported" type="Boolean" mandatory="true">
- <description>Must be true if the button supports referencing a static or dynamic image.</description>
- </param>
- </struct>
- <struct name="HMICapabilities">
- <param name="navigation" type="Boolean" mandatory="false">
- <description>Availability of build in Nav. True: Available, False: Not Available</description>
- </param>
- <param name="phoneCall" type="Boolean" mandatory="false">
- <description>Availability of build in phone. True: Available, False: Not Available</description>
- </param>
- </struct>
- <struct name="AudioPassThruCapabilities">
- <description>
- Describes different audio type configurations for PerformAudioPassThru.
- e.g. 8kHz,8-bit,PCM
- </description>
- <param name="samplingRate" type="Common.SamplingRate" mandatory="true"/>
- <param name="bitsPerSample" type="Common.BitsPerSample" mandatory="true"/>
- <param name="audioType" type="Common.AudioType" mandatory="true"/>
- </struct>
- <struct name="TextFieldStruct">
- <param name="fieldName" type="Common.TextFieldName" mandatory="true">
- <description>The name of the field for displaying the text.</description>
- </param>
- <param name="fieldText" type="String" maxlength="500" mandatory="true">
- <description>The text itself.</description>
- </param>
- </struct>
- <struct name="KeyboardProperties">
- <description>Configuration of on-screen keyboard (if available).</description>
- <param name="language" type="Common.Language" mandatory="false">
- <description>The keyboard language.</description>
- </param>
- <param name="keyboardLayout" type="Common.KeyboardLayout" mandatory="false">
- <description>Desired keyboard layout.</description>
- </param>
- <param name="keypressMode" type="Common.KeypressMode" mandatory="false">
- <description>
- Desired keypress mode.
- If omitted, this value will be set to RESEND_CURRENT_ENTRY.
- </description>
- </param>
- <param name="limitedCharacterList" type="String" maxlength="1" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>Array of keyboard characters to enable.</description>
- <description>All omitted characters will be greyed out (disabled) on the keyboard.</description>
- <description>If omitted, the entire keyboard will be enabled.</description>
- </param>
- <param name="autoCompleteText" type="String" maxlength="1000" mandatory="false">
- <description>Allows an app to prepopulate the text field with a suggested or completed entry as the user types</description>
- </param>
- </struct>
- <struct name="Turn">
- <param name="navigationText" type="Common.TextFieldStruct" mandatory="false">
- <description>Uses navigationText from TextFieldStruct.</description>
- </param>
- <param name="turnIcon" type="Common.Image" mandatory="false">
- </param>
- </struct>
- <struct name="VehicleType">
- <param name="make" type="String" maxlength="500" mandatory="false">
- <description>Make of the vehicle</description>
- <description>e.g. Ford</description>
- </param>
- <param name="model" type="String" maxlength="500" mandatory="false">
- <description>Model of the vehicle</description>
- <description>e.g. Fiesta</description>
- </param>
- <param name="modelYear" type="String" maxlength="500" mandatory="false">
- <description>Model Year of the vehicle</description>
- <description>e.g. 2013</description>
- </param>
- <param name="trim" type="String" maxlength="500" mandatory="false">
- <description>Trim of the vehicle</description>
- <description>e.g. SE</description>
- </param>
- </struct>
- <!--IVI part-->
- <struct name="GPSData">
- <description>Struct with the GPS data.</description>
- <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="false">
- </param>
- <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="false">
- </param>
- <param name="utcYear" type="Integer" minvalue="2010" maxvalue="2100" mandatory="false">
- <description>The current UTC year.</description>
- </param>
- <param name="utcMonth" type="Integer" minvalue="1" maxvalue="12" mandatory="false">
- <description>The current UTC month.</description>
- </param>
- <param name="utcDay" type="Integer" minvalue="1" maxvalue="31" mandatory="false">
- <description>The current UTC day.</description>
- </param>
- <param name="utcHours" type="Integer" minvalue="0" maxvalue="23" mandatory="false">
- <description>The current UTC hour.</description>
- </param>
- <param name="utcMinutes" type="Integer" minvalue="0" maxvalue="59" mandatory="false">
- <description>The current UTC minute.</description>
- </param>
- <param name="utcSeconds" type="Integer" minvalue="0" maxvalue="59" mandatory="false">
- <description>The current UTC second.</description>
- </param>
- <param name="compassDirection" type="Common.CompassDirection" mandatory="false">
- <description>See CompassDirection.</description>
- </param>
- <param name="pdop" type="Float" minvalue="0" maxvalue="10" mandatory="false">
- <description>PDOP.</description>
- </param>
- <param name="hdop" type="Float" minvalue="0" maxvalue="10" mandatory="false">
- <description>HDOP.</description>
- </param>
- <param name="vdop" type="Float" minvalue="0" maxvalue="10" mandatory="false">
- <description>VDOP.</description>
- </param>
- <param name="actual" type="Boolean" mandatory="false">
- <description>
- True, if actual.
- False, if infered.
- </description>
- </param>
- <param name="satellites" type="Integer" minvalue="0" maxvalue="31" mandatory="false">
- <description>Number of satellites in view</description>
- </param>
- <param name="dimension" type="Common.Dimension" mandatory="false">
- <description>See Dimension</description>
- </param>
- <param name="altitude" type="Float" minvalue="-10000" maxvalue="10000" mandatory="false">
- <description>Altitude in meters</description>
- </param>
- <param name="heading" type="Float" minvalue="0" maxvalue="359.99" mandatory="false">
- <description>The heading. North is 0. Resolution is 0.01</description>
- </param>
- <param name="speed" type="Float" minvalue="0" maxvalue="500" mandatory="false">
- <description>The speed in KPH</description>
- </param>
- </struct>
- <struct name="SingleTireStatus">
- <param name="status" type="Common.ComponentVolumeStatus" mandatory="true">
- <description>The status of component volume. See ComponentVolumeStatus.</description>
- </param>
- </struct>
- <struct name="DIDResult">
- <description>Individual requested DID result and data</description>
- <param name="resultCode" type="Common.VehicleDataResultCode" mandatory="true">
- <description>Individual DID result code.</description>
- </param>
- <param name="didLocation" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Location of raw data (the address from ReadDID request)</description>
- </param>
- <param name="data" type="String" maxlength="5000" mandatory="false">
- <description>Raw DID-based data returned for requested element.</description>
- </param>
- </struct>
- <struct name="HeadLampStatus">
- <param name="lowBeamsOn" type="Boolean" mandatory="true">
- <description>Status of the low beam lamps.</description>
- </param>
- <param name="highBeamsOn" type="Boolean" mandatory="true">
- <description>Status of the high beam lamps.</description>
- </param>
- <param name="ambientLightSensorStatus" type="Common.AmbientLightStatus" mandatory="true">
- <description>Status of the ambient light sensor.</description>
- </param>
- </struct>
- <struct name="TireStatus">
- <description>The status and pressure of the tires.</description>
- <param name="pressureTelltale" type="Common.WarningLightStatus" mandatory="false">
- <description>Status of the Tire Pressure Telltale. See WarningLightStatus.</description>
- </param>
- <param name="leftFront" type="Common.SingleTireStatus" mandatory="false">
- <description>The status of the left front tire.</description>
- </param>
- <param name="rightFront" type="Common.SingleTireStatus" mandatory="false">
- <description>The status of the right front tire.</description>
- </param>
- <param name="leftRear" type="Common.SingleTireStatus" mandatory="false">
- <description>The status of the left rear tire.</description>
- </param>
- <param name="rightRear" type="Common.SingleTireStatus" mandatory="false">
- <description>The status of the right rear tire.</description>
- </param>
- <param name="innerLeftRear" type="Common.SingleTireStatus" mandatory="false">
- <description>The status of the inner left rear.</description>
- </param>
- <param name="innerRightRear" type="Common.SingleTireStatus" mandatory="false">
- <description>The status of the inner right rear.</description>
- </param>
- </struct>
- <struct name="BeltStatus">
- <param name="driverBeltDeployed" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerBeltDeployed" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerBuckleBelted" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="driverBuckleBelted" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="leftRow2BuckleBelted" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerChildDetected" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="rightRow2BuckleBelted" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="middleRow2BuckleBelted" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="middleRow3BuckleBelted" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="leftRow3BuckleBelted" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="rightRow3BuckleBelted" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="leftRearInflatableBelted" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="rightRearInflatableBelted" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="middleRow1BeltDeployed" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- <param name="middleRow1BuckleBelted" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>See VehicleDataEventStatus.</description>
- </param>
- </struct>
- <struct name="BodyInformation">
- <param name="parkBrakeActive" type="Boolean" mandatory="true">
- <description>Must be true if the park brake is active</description>
- </param>
- <param name="ignitionStableStatus" type="Common.IgnitionStableStatus" mandatory="true">
- <description>Information about the ignition switch. See IgnitionStableStatus.</description>
- </param>
- <param name="ignitionStatus" type="Common.IgnitionStatus" mandatory="true">
- <description>The status of the ignition. See IgnitionStatus.</description>
- </param>
- <param name="driverDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatDrv_B_Actl".</description>
- </param>
- <param name="passengerDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatPsngr_B_Actl".</description>
- </param>
- <param name="rearLeftDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatRl_B_Actl".</description>
- </param>
- <param name="rearRightDoorAjar" type="Boolean" mandatory="false">
- <description>References signal "DrStatRr_B_Actl".</description>
- </param>
- </struct>
- <struct name="DeviceStatus">
- <param name="voiceRecOn" type="Boolean" mandatory="false">
- <description>Must be true if the voice recording is on.</description>
- </param>
- <param name="btIconOn" type="Boolean" mandatory="false">
- <description>Must be true if Bluetooth icon is displayed.</description>
- </param>
- <param name="callActive" type="Boolean" mandatory="false">
- <description>Must be true if there is an active call..</description>
- </param>
- <param name="phoneRoaming" type="Boolean" mandatory="false">
- <description>Must be true if ther is a phone roaming.</description>
- </param>
- <param name="textMsgAvailable" type="Boolean" mandatory="false">
- <description>Must be true if the text message is available.</description>
- </param>
- <param name="battLevelStatus" type="Common.DeviceLevelStatus" mandatory="false">
- <description>Device battery level status. See DeviceLevelStatus.</description>
- </param>
- <param name="stereoAudioOutputMuted" type="Boolean" mandatory="false">
- <description>Must be true if stereo audio output is muted.</description>
- </param>
- <param name="monoAudioOutputMuted" type="Boolean" mandatory="false">
- <description>Must be true if mono audio output is muted.</description>
- </param>
- <param name="signalLevelStatus" type="Common.DeviceLevelStatus" mandatory="false">
- <description>Device signal level status. See DeviceLevelStatus.</description>
- </param>
- <param name="primaryAudioSource" type="Common.PrimaryAudioSource" mandatory="false">
- <description>See PrimaryAudioSource.</description>
- </param>
- <param name="eCallEventActive" type="Boolean" mandatory="false">
- <description>Must be true if emergency call event is active.</description>
- </param>
- </struct>
- <struct name="ECallInfo">
- <param name="eCallNotificationStatus" type="Common.VehicleDataNotificationStatus" mandatory="true">
- <description>References signal "eCallNotification_4A". See VehicleDataNotificationStatus.</description>
- </param>
- <param name="auxECallNotificationStatus" type="Common.VehicleDataNotificationStatus" mandatory="true">
- <description>References signal "eCallNotification". See VehicleDataNotificationStatus.</description>
- </param>
- <param name="eCallConfirmationStatus" type="Common.ECallConfirmationStatus" mandatory="true">
- <description>References signal "eCallConfirmation". See ECallConfirmationStatus.</description>
- </param>
- </struct>
- <struct name="AirbagStatus">
- <param name="driverAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsDrvBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="driverSideAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsDrvSideBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="driverCurtainAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsDrvCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsPasBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerCurtainAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsPasCrtnBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="driverKneeAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsKneeDrvBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerSideAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsPasSideBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="passengerKneeAirbagDeployed" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsKneePasBag_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- </struct>
- <struct name="EmergencyEvent">
- <param name="emergencyEventType" type="Common.EmergencyEventType" mandatory="true">
- <description>References signal "VedsEvntType_D_Ltchd". See EmergencyEventType.</description>
- </param>
- <param name="fuelCutoffStatus" type="Common.FuelCutoffStatus" mandatory="true">
- <description>References signal "RCM_FuelCutoff". See FuelCutoffStatus.</description>
- </param>
- <param name="rolloverEvent" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsEvntRoll_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="maximumChangeVelocity" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsMaxDeltaV_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- <param name="multipleEvents" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>References signal "VedsMultiEvnt_D_Ltchd". See VehicleDataEventStatus.</description>
- </param>
- </struct>
- <struct name="ClusterModeStatus">
- <param name="powerModeActive" type="Boolean" mandatory="true">
- <description>References signal "PowerMode_UB".</description>
- </param>
- <param name="powerModeQualificationStatus" type="Common.PowerModeQualificationStatus" mandatory="true">
- <description>References signal "PowerModeQF". See PowerModeQualificationStatus.</description>
- </param>
- <param name="carModeStatus" type="Common.CarModeStatus" mandatory="true">
- <description>References signal "CarMode". See CarMode.</description>
- </param>
- <param name="powerModeStatus" type="Common.PowerModeStatus" mandatory="true">
- <description>References signal "PowerMode". See PowerMode.</description>
- </param>
- </struct>
- <struct name="MyKey">
- <param name="e911Override" type="Common.VehicleDataStatus" mandatory="true">
- <description>Indicates whether e911 override is on. See VehicleDataStatus.</description>
- </param>
- </struct>
- <!--end of IVI part-->
- <!-- Remote Control -->
- <enum name="ModuleType">
- <element name="CLIMATE"/>
- <element name="RADIO"/>
- </enum>
-
- <enum name="RadioBand">
- <element name="AM"/>
- <element name="FM"/>
- <element name="XM"/>
- </enum>
-
- <struct name="RdsData">
- <param name="PS" type="String" minlength="0" maxlength="8" mandatory="false">
- <description>Program Service Name</description>
- </param>
- <param name="RT" type="String" minlength="0" maxlength="64" mandatory="false">
- <description>Radio Text</description>
- </param>
- <param name="CT" type="String" minlength="24" maxlength="24" mandatory="false">
- <description>The clock text in UTC format as YYYY-MM-DDThh:mm:ss.sTZD</description>
- </param>
- <param name="PI" type="String" minlength="0" maxlength="6" mandatory="false">
- <description>Program Identification - the call sign for the radio station</description>
- </param>
- <param name="PTY" type="Integer" minvalue="0" maxvalue="31" mandatory="false">
- <description>The program type - The region should be used to differentiate between EU and North America program types</description>
- </param>
- <param name="TP" type="Boolean" mandatory="false">
- <description>Traffic Program Identification - Identifies a station that offers traffic</description>
- </param>
- <param name="TA" type="Boolean" mandatory="false">
- <description>Traffic Announcement Identification - Indicates an ongoing traffic announcement</description>
- </param>
- <param name="REG" type="String" mandatory="false">
- <description>Region</description>
- </param>
- </struct>
-
- <enum name="RadioState">
- <element name="ACQUIRING"/>
- <element name="ACQUIRED"/>
- <element name="MULTICAST"/>
- <element name="NOT_FOUND"/>
- </enum>
-
- <struct name="RadioControlData">
- <param name="frequencyInteger" type="Integer" minvalue="0" maxvalue="1710" mandatory="false">
- <description>The integer part of the frequency ie for 101.7 this value should be 101</description>
- </param>
- <param name="frequencyFraction" type="Integer" minvalue="0" maxvalue="9" mandatory="false">
- <description>The fractional part of the frequency for 101.7 is 7</description>
- </param>
- <param name="band" type="Common.RadioBand" mandatory="false">
- </param>
- <param name="rdsData" type="Common.RdsData" mandatory="false">
- </param>
- <param name="availableHDs" type="Integer" minvalue="1" maxvalue="3" mandatory="false">
- <description>number of HD sub-channels if available</description>
- </param>
- <param name="hdChannel" type="Integer" minvalue="1" maxvalue="3" mandatory="false">
- <description>Current HD sub-channel if available</description>
- </param>
- <param name="signalStrength" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
- </param>
- <param name="signalChangeThreshold" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
- <description>If the signal strength falls below the set value for this parameter, the radio will tune to an alternative frequency</description>
- </param>
- <param name="radioEnable" type="Boolean" mandatory="false">
- <description> True if the radio is on, false is the radio is off</description>
- </param>
- <param name="state" type="Common.RadioState" mandatory="false">
- </param>
- </struct>
-
- <struct name="RadioControlCapabilities">
- <description>Contains information about a radio control module's capabilities.</description>
- <param name="moduleName" type="String" maxlength="100" mandatory="true" >
- <description>The short name or a short description of the radio control module.</description>
- </param>
- <param name="radioEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of enable/disable radio.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="radioBandAvailable" type="Boolean" mandatory="false" >
- <description>
- Availability of the control of radio band.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="radioFrequencyAvailable" type="Boolean" mandatory="false" >
- <description>
- Availability of the control of radio frequency.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="hdChannelAvailable" type="Boolean" mandatory="false" >
- <description>
- Availability of the control of HD radio channel.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="rdsDataAvailable" type="Boolean" mandatory="false" >
- <description>
- Availability of the getting Radio Data System (RDS) data.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="availableHDsAvailable" type="Boolean" mandatory="false" >
- <description>
- Availability of the getting the number of available HD channels.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="stateAvailable" type="Boolean" mandatory="false" >
- <description>
- Availability of the getting the Radio state.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="signalStrengthAvailable" type="Boolean" mandatory="false" >
- <description>
- Availability of the getting the signal strength.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="signalChangeThresholdAvailable" type="Boolean" mandatory="false" >
- <description>
- Availability of the getting the signal Change Threshold.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- </struct>
-
- <enum name="DefrostZone">
- <element name="FRONT"/>
- <element name="REAR"/>
- <element name="ALL"/>
- <element name="NONE"/>
- </enum>
-
- <enum name="VentilationMode">
- <element name="UPPER"/>
- <element name="LOWER"/>
- <element name="BOTH"/>
- <element name="NONE"/>
- </enum>
-
- <enum name="TemperatureUnit">
- <element name="FAHRENHEIT"/>
- <element name="CELSIUS"/>
- </enum>
-
- <struct name="Temperature">
- <param name="unit" type="TemperatureUnit" mandatory="true" >
- <description>Temperature Unit</description>
- </param>
- <param name="value" type="Float" mandatory="true" >
- <description>Temperature Value in TemperatureUnit specified unit. Range depends on OEM and is not checked by SDL.</description>
- </param>
- </struct>
-
- <struct name="ClimateControlData">
- <param name="fanSpeed" type="Integer" minvalue="0" maxvalue="100" mandatory="false">
- </param>
- <param name="currentTemperature" type="Common.Temperature" mandatory="false">
- </param>
- <param name="desiredTemperature" type="Common.Temperature" mandatory="false">
- </param>
- <param name="acEnable" type="Boolean" mandatory="false">
- </param>
- <param name="circulateAirEnable" type="Boolean" mandatory="false">
- </param>
- <param name="autoModeEnable" type="Boolean" mandatory="false">
- </param>
- <param name="defrostZone" type="DefrostZone" mandatory="false">
- </param>
- <param name="dualModeEnable" type="Boolean" mandatory="false">
- </param>
- <param name="acMaxEnable" type="Boolean" mandatory="false">
- </param>
- <param name="ventilationMode" type="Common.VentilationMode" mandatory="false">
- </param>
- </struct>
-
- <struct name="ClimateControlCapabilities">
- <description>Contains information about a climate control module's capabilities.</description>
- <param name="moduleName" type="String" maxlength="100" mandatory="true" >
- <description>The short name or a short description of the climate control module.</description>
- </param>
- <param name="currentTemperatureAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the reading of current temperature.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="fanSpeedAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of fan speed.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="desiredTemperatureAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of desired temperature.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="acEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of turn on/off AC.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="acMaxEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of enable/disable air conditioning is ON on the maximum level.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="circulateAirEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of enable/disable circulate Air mode.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="autoModeEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of enable/disable auto mode.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="dualModeEnableAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of enable/disable dual mode.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="defrostZoneAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of defrost zones.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="defrostZone" type="Common.DefrostZone" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- A set of all defrost zones that are controllable.
- </description>
- </param>
- <param name="ventilationModeAvailable" type="Boolean" mandatory="false">
- <description>
- Availability of the control of air ventilation mode.
- True: Available, False: Not Available, Not present: Not Available.
- </description>
- </param>
- <param name="ventilationMode" type="Common.VentilationMode" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- A set of all ventilation modes that are controllable.
- </description>
- </param>
- </struct>
-
- <struct name="ModuleData">
- <description>The moduleType indicates which type of data should be changed and identifies which data object exists in this struct. For example, if the moduleType is CLIMATE then a "climateControlData" should exist</description>
- <param name="moduleType" type="Common.ModuleType" mandatory="true" >
- </param>
- <param name="radioControlData" type="Common.RadioControlData" mandatory="false">
- </param>
- <param name="climateControlData" type="Common.ClimateControlData" mandatory="false">
- </param>
- </struct>
-
- <enum name="RCAccessMode">
- <description>Enumeration that describes possible remote control access mode the application might be in on HU.</description>
- <element name="AUTO_ALLOW"/>
- <element name="AUTO_DENY"/>
- <element name="ASK_DRIVER"/>
- </enum>
-<struct name="DateTime">
- <param name="millisecond" type="Integer" minvalue="0" maxvalue="999" mandatory="false">
- <description>Milliseconds </description>
- </param>
- <param name="second" type="Integer" minvalue="0" maxvalue="60" mandatory="false">
- <description>Seconds part of time</description>
- </param>
- <param name="minute" type="Integer" minvalue="0" maxvalue="59" mandatory="false">
- <description>Minutes part of time</description>
- </param>
- <param name="hour" type="Integer" minvalue="0" maxvalue="23" mandatory="false">
- <description>Hours part of time. Note that this structure accepts time only in 24 Hr format</description>
- </param>
- <param name="day" type="Integer" minvalue="1" maxvalue="31" mandatory="false">
- <description>Day of the month</description>
- </param>
- <param name="month" type="Integer" minvalue="1" maxvalue="12" mandatory="false">
- <description>Month of the year</description>
- </param>
- <param name="year" type="Integer" maxvalue="4095" mandatory="false">
- <description>The year in YYYY format</description>
- </param>
- <param name="tz_hour" type="Integer" minvalue="-12" maxvalue="14" defvalue="0" mandatory="false">
- <description>Time zone offset in Hours wrt UTC.</description>
- </param>
- <param name="tz_minute" type="Integer" minvalue="0" maxvalue="59" defvalue="0" mandatory="false">
- <description>Time zone offset in Min wrt UTC.</description>
- </param>
-</struct>
-
-<struct name="OASISAddress">
- <param name="countryName" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Name of the country (localized)</description>
- </param>
- <param name="countryCode" minlength="0" maxlength="50" type="String" mandatory="false">
- <description>Name of country (ISO 3166-2)</description>
- </param>
- <param name="postalCode" minlength="0" maxlength="16" type="String" mandatory="false">
- <description>(PLZ, ZIP, PIN, CAP etc.)</description>
- </param>
- <param name="administrativeArea" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Portion of country (e.g. state)</description>
- </param>
- <param name="subAdministrativeArea" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Portion of e.g. state (e.g. county)</description>
- </param>
- <param name="locality" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Hypernym for e.g. city/village</description>
- </param>
- <param name="subLocality" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Hypernym for e.g. district</description>
- </param>
- <param name="thoroughfare" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Hypernym for street, road etc.</description>
- </param>
- <param name="subThoroughfare" minlength="0" maxlength="200" type="String" mandatory="false">
- <description>Portion of thoroughfare e.g. house number</description>
- </param>
-</struct>
-
- <struct name="LocationDetails">
- <param name="coordinate" type="Coordinate" mandatory="false">
- <description>Latitude/Longitude of the location.</description>
- </param>
- <param name="locationName" type="String" maxlength="500" mandatory="false">
- <description>Name of location.</description>
- </param>
- <param name="addressLines" type="String" maxlength="500" minsize="0" maxsize="4" array="true" mandatory="false">
- <description>Location address for display purposes only</description>
- </param>
- <param name="locationDescription" type="String" maxlength="500" mandatory="false">
- <description>Description intended location / establishment (if applicable)</description>
- </param>
- <param name="phoneNumber" type="String" maxlength="500" mandatory="false">
- <description>Phone number of location / establishment.</description>
- </param>
- <param name="locationImage" type="Image" mandatory="false">
- <description>Image / icon of intended location.</description>
- </param>
- <param name="searchAddress" type="OASISAddress" mandatory="false">
- <description>Address to be used by navigation engines for search</description>
- </param>
- </struct>
-
- <struct name="NavigationCapability">
- <description>Extended capabilities for an onboard navigation system</description>
- <param name="sendLocationEnabled" type="Boolean" mandatory="false">
- <description>If the module has the ability to add locations to the onboard nav</description>
- </param>
- <param name="getWayPointsEnabled" type="Boolean" mandatory="false">
- <description>If the module has the ability to return way points from onboard nav</description>
- </param>
- </struct>
-
- <struct name="PhoneCapability">
- <description>Extended capabilities of the module's phone feature</description>
- <param name="dialNumberEnabled" type="Boolean" mandatory="false">
- <description>If the module has the abiulity to perform dial number</description>
- </param>
- </struct>
-
- <struct name="VideoStreamingCapability">
- <description>Contains information about this system's video streaming capabilities.</description>
- <param name="preferredResolution" type="Common.ImageResolution" mandatory="false">
- <description>The preferred resolution of a video stream for decoding and rendering on HMI.</description>
- </param>
- <param name="maxBitrate" type="Integer" minvalue="0" maxvalue="2147483647" mandatory="false">
- <description>The maximum bitrate of video stream that is supported, in kbps.</description>
- </param>
- <param name="supportedFormats" type="Common.VideoStreamingFormat" array="true" mandatory="false">
- <description>
- Detailed information on each format supported by this system, in its preferred order
- (i.e. the first element in the array is most preferable to the system).
- Each object will contain a VideoStreamingFormat that describes what can be expected.
- </description>
- </param>
- <param name="hapticSpatialDataSupported" type="Boolean" mandatory="false">
- <description>True if the system can utilize the haptic spatial data from the source being streamed. </description>
- </param>
- </struct>
-
- <struct name="SystemCapabilities">
- <param name="navigationCapability" type="NavigationCapability" mandatory="false">
- </param>
- <param name="phoneCapability" type="PhoneCapability" mandatory="false">
- </param>
- <param name="videoStreamingCapability" type="VideoStreamingCapability" mandatory="false">
- </param>
- </struct>
-
- <struct name="RemoteControlCapabilities">
- <param name="climateControlCapabilities" type="ClimateControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
- <description>If included, the platform supports RC climate controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description >
- </param>
- <param name="radioControlCapabilities" type="RadioControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
- <description>If included, the platform supports RC radio controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description >
- </param>
- <param name="buttonCapabilities" type="ButtonCapabilities" mandatory="false" minsize="1" maxsize="100" array="true" >
- <description>If included, the platform supports RC button controls with the included button names.</description >
- </param>
- </struct>
-
- <struct name="Rectangle">
- <param name="x" type="Float" mandatory="true">
- <description>The X-coordinate of the user control</description>
- </param>
- <param name="y" type="Float" mandatory="true">
- <description>The Y-coordinate of the user control</description>
- </param>
- <param name="width" type="Float" mandatory="true">
- <description>The width of the user control's bounding rectangle</description>
- </param>
- <param name="height" type="Float" mandatory="true">
- <description>The height of the user control's bounding rectangle</description>
- </param>
- </struct>
-
- <struct name="HapticRect">
- <description>Defines haptic rectangle data for each user control object for video streaming application</description>
- <param name="id" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>A user control spatial identifier</description>
- </param>
- <param name="rect" type="Common.Rectangle" mandatory="true">
- <description>The position of the haptic rectangle to be highlighted. The center of this rectangle will be "touched" when a press occurs.</description>
- </param>
- </struct>
- </interface>
- <interface name="Buttons" version="1.0" date="2013-04-12">
- <function name="GetCapabilities" messagetype="request" provider="hmi">
- <description>Method is invoked at system start-up. SDL requests the information about all supported hardware buttons and their capabilities</description>
- </function>
- <function name="GetCapabilities" messagetype="response">
- <param name="capabilities" type="Common.ButtonCapabilities" array="true" minsize="1" maxsize="100" mandatory="true">
- <description>Response must provide the names of available buttons and their capabilities.See ButtonCapabilities</description>
- </param>
- <param name="presetBankCapabilities" type="Common.PresetBankCapabilities" mandatory="false">
- <description>Must be returned if the platform supports custom on-screen Presets</description>
- </param>
- </function>
- <function name="OnButtonEvent" messagetype="notification" provider="hmi">
- <description>HU system must notify about every UP/DOWN event for buttons</description>
- <param name="name" type="Common.ButtonName" mandatory="true"/>
- <param name="mode" type="Common.ButtonEventMode" mandatory="true">
- <description>Indicates whether this is an UP or DOWN event.</description>
- </param>
- <param name="customButtonID" type="Integer" mandatory="false" minvalue="0" maxvalue="65536">
- <description>Must be provided if ButtonName is CUSTOM_BUTTON, this references the integer ID passed by a custom button. (e.g. softButtonName)</description>
- </param>
- <param name="appID" type="Integer" mandatory="false">
- <description>
- In case the ButtonName is CUSTOM_BUTTON, HMI must include appID parameters to OnButtonPress notification sent to SDL.
- Otherwise, if appID is not sent together with CUSTOM_BUTTON, this notification will be ignored by SDL.
- </description>
- </param>
- </function>
- <function name="OnButtonPress" messagetype="notification" provider="hmi">
- <param name="name" type="Common.ButtonName" mandatory="true"/>
- <param name="mode" type="Common.ButtonPressMode" mandatory="true">
- <description>Indicates whether this is a LONG or SHORT button press event.</description>
- </param>
- <param name="customButtonID" type="Integer" mandatory="false" minvalue="0" maxvalue="65536">
- <description>Must be returned if ButtonName is CUSTOM_BUTTON, this references the string passed by a custom button. (e.g. softButtonName)</description>
- </param>
- <param name="appID" type="Integer" mandatory="false">
- <description>
- In case the ButtonName is CUSTOM_BUTTON, HMI must include appID parameters to OnButtonPress notification sent to SDL.
- Otherwise, if appID is not sent together with CUSTOM_BUTTON, this notification will be ignored by SDL.
- </description>
- </param>
- </function>
- <function name="OnButtonSubscription" messagetype="notification">
- <description>
- Sender: SDL-&gt;HMI. Purpose: to notify about button subscription state is changed for the named application
- </description>
- <param name="name" type="Common.ButtonName" mandatory="true"/>
- <param name="isSubscribed" type="Boolean" mandatory="true">
- <description>
- Defines whether the named button has status of 'subscribed' or 'unsubscribed':
- If "true" - the named button is subscribed.
- If "false" - the named button is unsubscribed.
- </description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>
- The ID of application that relates to this button-subscription status change.
- </description>
- </param>
- </function>
- </interface>
- <interface name="BasicCommunication" version="1.0" date="2013-04-12">
- <function name="OnReady" messagetype="notification" provider="hmi">
- <description>HMI must notify SDL about its readiness to start communication. In fact, this has to be the first message between SDL and HMI.</description>
- </function>
- <function name="OnStartDeviceDiscovery" messagetype="notification" provider="hmi">
- <description>Initiated by HMI user for getting the list of connected devices.</description>
- </function>
- <function name="OnUpdateDeviceList" messagetype="notification" provider="hmi">
- <description>Notification from HMI to SDL sent when HMI requires update of device list (i.e. when user clicks 'Change Device' button)</description>
- </function>
- <function name="OnPhoneCall" messagetype="notification">
- <description>Sender: HMI-&gt;SDL. When: upon phone-call event started or ended</description>
- <param name="isActive" type="Boolean" mandatory="true">
- <description>Must be 'true' - when the phone call is started on HMI. Must be 'false' when the phone call is ended on HMI</description>
- </param>
- </function>
- <function name="OnEmergencyEvent" messagetype="notification">
- <description>
- "Sender: HMI-&gt;SDL. Conditions: when HMI enters the mode of "911 Assist", or other rear view camera,
- or something else in the future. Purpose: for SDL to change the audioStreamingState of the related apps to
- NOT_AUDIBLE when "enabled:true" and back to AUDIBLE when "enabled:false""
- </description>
- <param name="enabled" type="Boolean" mandatory="true">
- </param>
- </function>
- <function name="OnResumeAudioSource" messagetype="notification" provider="sdl">
- <description>This method must be invoked by SDL to update audio state.</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>The ID of app to be resumed audio source.</description>
- </param>
- </function>
- <function name="OnSDLPersistenceComplete" messagetype="notification" provider="sdl">
- </function>
- <function name="UpdateAppList" messagetype="request" provider="hmi">
- <description>Issued by SDL to notify HMI about new applications registered.</description>
- <param name="applications" type="Common.HMIApplication" mandatory="true" array="true" minsize="0" maxsize="100"/>
- </function>
- <function name="UpdateAppList" messagetype="response">
- </function>
- <function name="UpdateDeviceList" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLink to HMI to change device list.</description>
- <param name="deviceList" type="Common.DeviceInfo" mandatory="true" array="true" minsize="0" maxsize="100">
- <description>The array of names/IDs of connected devices</description>
- </param>
- </function>
- <function name="UpdateDeviceList" messagetype="response">
- </function>
- <function name="OnFileRemoved" messagetype="notification" provider="sdl">
- <description>Notifies HMI in case some application file has been removed</description>
- <param name="fileName" type="String" minlength="1" maxlength="30" mandatory="true">
- <description>The name of the removed file</description>
- </param>
- <param name="fileType" type="Common.FileType" mandatory="true">
- <description>The file type. See FileType.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of the application.</description>
- </param>
- </function>
- <function name="AllowDeviceToConnect" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLink to HMI to get the permissions of new device connection.</description>
- <param name="device" type="Common.DeviceInfo" mandatory="true"/>
- </function>
- <function name="AllowDeviceToConnect" messagetype="response">
- <param name="allow" type="Boolean" mandatory="true"/>
- </function>
- <function name="OnDeviceChosen" messagetype="notification" provider="hmi">
- <description>Notification must be initiated by HMI on user selecting device in the list of devices.</description>
- <param name="deviceInfo" type="Common.DeviceInfo" mandatory="true">
- <description>The name and ID of the device chosen</description>
- </param>
- </function>
- <function name="OnFindApplications" messagetype="notification" provider="hmi">
- <description>This method must be invoked by HMI to get list of registered apps.</description>
- <param name="deviceInfo" type="Common.DeviceInfo" mandatory="false">
- <description>The name and ID of the device the list of registered applications is required for.</description>
- </param>
- </function>
- <function name="ActivateApp" messagetype="request" provider="hmi">
- <description>Request from SDL to HMI to bring specified application to front on UI e.g make it HMI status 'FULL'.</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of deactivated application.</description>
- </param>
- <param name="priority" type="Common.AppPriority" mandatory="false">
- <description>Send to HMI so that it can coordinate order of requests/notifications correspondingly.</description>
- </param>
- <param name="level" type="Common.HMILevel" mandatory="false">
- <description>If level for application is to be changed to something else then FULL then this parameter should be used.</description>
- </param>
- </function>
- <function name="ActivateApp" messagetype="response">
- </function>
- <function name="OnAppActivated" messagetype="notification" provider="hmi">
- <description>Must be sent by HU system when the user clicks on app in the list of registered apps or on soft button with 'STEAL_FOCUS' action.</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of selected application.</description>
- </param>
- </function>
- <function name="OnAppDeactivated" messagetype="notification" provider="hmi">
- <description>Must be sent by HU system when the user switches to any functionality which is not other mobile application.</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of deactivated application.</description>
- </param>
- <param name="reason" type="Common.DeactivateReason" mandatory="true">
- <description>Specifies the functionality the user has switched to.</description>
- </param>
- </function>
- <function name="OnAppRegistered" messagetype="notification" provider="sdl">
- <description>Issued by SDL to notify HMI about new application registered.</description>
- <param name="application" type="Common.HMIApplication" mandatory="true">
- <description>The information about application registered. See HMIApplication. </description>
- </param>
- <param name="ttsName" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- TTS string for VR recognition of the mobile application name, e.g. "Ford Drive Green".
- Meant to overcome any failing on speech engine in properly pronouncing / understanding app name.
- May not be empty.
- May not start with a new line character.
- Not unique value
- </description>
- </param>
- <param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- Defines an additional voice recognition command.
- Must not interfere with any name of previously registered applications(SDL makes check).
- </description>
- </param>
- <param name="resumeVrGrammars" type="Boolean" mandatory="false">
- <description>The flag if VR grammars resume is required</description>
- </param>
- <param name="priority" type="Common.AppPriority" mandatory="false">
- <description>Send to HMI so that it can coordinate order of requests/notifications correspondingly.</description>
- </param>
- </function>
- <function name="OnAppUnregistered" messagetype="notification" provider="sdl">
- <description>
- Issued by SDL to notify HMI about application unregistered.
- Application then to be removed from application list; all data connected with application has to be cleared up.
- </description>
- <param name="unexpectedDisconnect" type="Boolean" mandatory="true">
- <description>
- SDL sends 'true' in case the connection is unexpectedly lost.
- SDL sends 'false' in case the mobile app is unregistered gracefully (via appropriate RPC)
- </description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of the application unregistered</description>
- </param>
- </function>
- <function name="OnExitApplication" messagetype="notification" provider="hmi">
- <description>Must be sent by HMI when the User chooses to exit the application..</description>
- <param name="reason" type="Common.ApplicationExitReason" mandatory="true">
- <description>Specifies reason of moving the app to NONE</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of the application to be exited.</description>
- </param>
- </function>
- <function name="OnExitAllApplications" messagetype="notification" provider="hmi">
- <description>Sent by HMI to SDL to close all registered applications.</description>
- <param name="reason" type="Common.ApplicationsCloseReason" mandatory="true">
- <description>Specifies reason for exiting all apllications.</description>
- </param>
- </function>
- <function name="OnAwakeSDL" messagetype="notification">
- <description>
- Sender: HMI-&gt;SDL. Must be sent to return SDL to normal operation after 'Suspend' or 'LowVoltage' events
- </description>
- </function>
- <function name="MixingAudioSupported" messagetype="request" provider="hmi">
- <description>Request from SDL to HMI to find out if the last one supports mixing audio (i.e. recording TTS command and playing audio).</description>
- </function>
- <function name="MixingAudioSupported" messagetype="response">
- <description>If no response received SDL supposes that mixing audio is not supported</description>
- <param name="attenuatedSupported" type="Boolean" mandatory="true">
- <description>Must be true if supported</description>
- </param>
- </function>
- <function name="PlayTone" messagetype="notification" provider="sdl">
- <description>Sent by SDL to HMI to notify that the tone should be played.</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of the application that invoked this notification</description>
- </param>
- <param name="methodName" type="Common.MethodName" mandatory="true">
- <description>Defines the name of app's request that initiates playing a tone</description>
- </param>
- </function>
- <function name="DialNumber" messagetype="request">
- <description>Request from SDL to call a specific number.</description>
- <param name="number" type="String" maxlength="40" mandatory="true">
- <description>The number to dial. Only the character + and numbers are allowed.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that concerns this RPC.</description>
- </param>
- </function>
- <function name="DialNumber" messagetype="response">
- </function>
- <!-- Policies -->
- <!-- SyncP RPC-->
- <function name="OnSystemRequest" messagetype="notification" provider="hmi">
- <description>
- An asynchronous request from the system for specific data from the device or the cloud or response to a request from the device or cloud
- Binary data can be included in hybrid part of message for some requests (such as Authentication request responses)
- </description>
- <param name="requestType" type="Common.RequestType" mandatory="true">
- <description>The type of system request.</description>
- </param>
- <param name="url" type="String" maxlength="1000" minlength="1" mandatory="false">
- <description>Optional array of URL(s) for HTTP requests.</description>
- </param>
- <param name="fileType" type="Common.FileType" mandatory="false">
- <description>Optional file type (meant for HTTP file requests).</description>
- </param>
- <param name="offset" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
- <description>Optional offset in bytes for resuming partial data chunks</description>
- </param>
- <param name="length" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
- <description>Optional length in bytes for resuming partial data chunks</description>
- </param>
- <param name="timeout" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
- </param>
- <param name="fileName" type="String" maxlength="255" minlength="1" mandatory="true">
- <description>File reference name.</description>
- </param>
- <param name="appID" type="String" maxlength="50" minlength="1" mandatory="false">
- <description>ID of application that requested this RPC.</description>
- </param>
- </function>
- <function name="SystemRequest" messagetype="request" provider="hmi">
- <description>An asynchronous request from the device; binary data can be included in hybrid part of message for some requests (such as Authentication requests)</description>
- <param name="requestType" type="Common.RequestType" mandatory="true">
- <description>The type of system request.</description>
- </param>
- <param name="fileName" type="String" maxlength="255" minlength="1" mandatory="true">
- <description>The path to file.</description>
- </param>
- <param name="appID" type="String" maxlength="50" minlength="1" mandatory="false">
- <description>ID of application that requested this RPC.</description>
- </param>
- </function>
- <function name="SystemRequest" messagetype="response">
- </function>
- <function name="PolicyUpdate" messagetype="request" provider="hmi">
- <description>
- From: SDL
- To: SYNCP Manager
- Asks SYNCP Manager to send given Policy Table snapshot to the backend
- </description>
- <param name="file" type="String" minlength="1" maxlength="255" mandatory="true">
- <description>
- Location of policy table snapshot
- </description>
- </param>
- <param name="timeout" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>
- Send attempt timeout in seconds
- </description>
- </param>
- <param name="retry" type="Integer" minvalue="0" maxvalue="65535" array="true" minsize="1" maxsize="5" mandatory="true">
- <description>
- Array of delays to wait after failed atempts
- </description>
- </param>
- </function>
- <function name="PolicyUpdate" messagetype="response">
- </function>
- <!-- End of SyncP RPC-->
- <function name="OnSDLClose" messagetype="notification" provider="sdl">
- <description>SDL must notify HMI about finish working application</description>
- </function>
- <function name="OnPutFile" messagetype="notification" provider="sdl">
- <description>
- Notification, that comes to HMI when mobile sents file with systemFile flag
- </description>
- <param name="offset" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
- <description>Optional offset in bytes for resuming partial data chunks</description>
- </param>
- <param name="length" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
- <description>Optional length in bytes for resuming partial data chunks</description>
- </param>
- <param name="fileSize" type="Integer" minvalue="0" maxvalue="100000000000" mandatory="false">
- <description>Full Size of file. sends in first OnPutFile notification if file is splited
- into many PutFiles
- </description>
- </param>
- <param name="FileName" type="String" maxlength="255" mandatory="true">
- <description>File reference name.</description>
- </param>
- <param name="syncFileName" type="String" maxlength="255" mandatory="true">
- <description>File reference name.</description>
- </param>
- <param name="fileType" type="Common.FileType" mandatory="true">
- <description>Selected file type.</description>
- </param>
- <param name="persistentFile" type="Boolean" defvalue="false" mandatory="false">
- <description>
- Indicates if the file is meant to persist between sessions / ignition cycles.
- If set to TRUE, then the system will aim to persist this file through session / cycles.
- While files with this designation will have priority over others, they are subject to deletion by the system at any time.
- In the event of automatic deletion by the system, the app will receive a rejection and have to resend the file.
- If omitted, the value will be set to false.
- </description>
- </param>
- </function>
- <!-- Policies -->
- <function name="GetSystemInfo" messagetype="request" provider="hmi">
- <description>Request from SDL to HMI to obtain information about head unit system.</description>
- </function>
- <function name="GetSystemInfo" messagetype="response">
- <param name="ccpu_version" type="String" maxlength="500" mandatory="true">
- <description>Software version of the module</description>
- </param>
- <param name="language" type="Common.Language" mandatory="true">
- <description>ISO 639-1 combined with ISO 3166 alpha-2 country code (i.e. en-us)</description>
- </param>
- <param name="wersCountryCode" type="String" maxlength="500" mandatory="true">
- <description>Country code from the Ford system WERS (i.e.WAEGB).</description>
- </param>
- </function>
- <function name="OnSystemInfoChanged" messagetype="notification" provider="hmi">
- <description>Issued by system to SDL to notify that some system param has changed. Currently applied for Sync Language.</description>
- <param name="language" type="Common.Language" mandatory="true"/>
- </function>
- <function name="OnIgnitionCycleOver" messagetype="notification" provider="hmi">
- <description>Notification from system to SDL to let it know that ignition cycle is over.</description>
- </function>
- <function name="DecryptCertificate" messagetype="request">
- <description>Sender: SDL-&gt;HMI. Purpose: to decrypt the certificate received via the Updated Policy Table. </description>
- <param name="fileName" type="String" maxlength="255" minlength="1" mandatory="true">
- <description>The path to the file with the encrypted certificate from the PolicyTable.</description>
- </param>
- </function>
- <function name="DecryptCertificate" messagetype="response">
- <description>SUCCESS - in case the certificate is decrypted and placed to the same file from request.</description>
- </function>
- <function name="OnEventChanged" messagetype="notification">
- <description>Sender: HMI->SDL. When event is become active</description>
- <param name="eventName" type="Common.EventTypes" mandatory="true">
- <description>Specifies the types of active events.</description>
- </param>
- <param name="isActive" type="Boolean" mandatory="true">
- <description>Must be 'true' - when the event is started on HMI. Must be 'false' when the event is ended on HMI</description>
- </param>
- </function>
- <!-- End of Policies -->
- </interface>
- <interface name="VR" version="1.0" date="2013-04-17">
- <function name="IsReady" messagetype="request" provider="hmi">
- <description>Method is invoked at system startup. Response provides information about presence of VR module and its readiness to cooperate with SDL.</description>
- </function>
- <function name="IsReady" messagetype="response">
- <param name="available" type="Boolean" mandatory="true">
- <description>Must be true if VR is present and ready to communicate with SDL.</description>
- </param>
- </function>
- <function name="Started" messagetype="notification" provider="hmi">
- <description>Must be initiated by VR module to let SDL know that VR session has started.</description>
- </function>
- <function name="Stopped" messagetype="notification" provider="hmi">
- <description>Must be initiated by VR module to let SDL know that VR session has stopped.</description>
- </function>
- <function name="AddCommand" messagetype="request" provider="hmi">
- <description>Request from SDL to add a command(string with associated id) to VR.</description>
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>ID of a command (further to be used in OnCommand notification).</description>
- </param>
- <param name="vrCommands" type="String" mandatory="true" maxlength="99" minsize="1" maxsize="100" array="true">
- <description>List of strings to be used as VR commands.</description>
- </param>
- <param name="type" type="Common.VRCommandType" mandatory="true">
- <description>Type of added command. See VRCommandType.</description>
- </param>
- <param name="grammarID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>
- ID of the specific grammar, whether top-level or choice set.
- </description>
- </param>
- <param name="appID" type="Integer" mandatory="false">
- <description>ID of application that requested this RPC.</description>
- </param>
- </function>
- <function name="AddCommand" messagetype="response">
- </function>
- <function name="DeleteCommand" messagetype="request" provider="hmi">
- <description>Request from SDL to delete a command from VR.</description>
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>Id of a command (list of strings), previously sent by AddCommand.</description>
- </param>
- <param name="type" type="Common.VRCommandType" mandatory="true">
- <description>Type of added command. See VRCommandType.</description>
- </param>
- <param name="grammarID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>ID of the specific grammar.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that requested this RPC.</description>
- </param>
- </function>
- <function name="DeleteCommand" messagetype="response">
- </function>
- <function name="PerformInteraction" messagetype="request" provider="hmi">
- <description>
- Sets some properties for the application initiated request.
- </description>
- <param name="helpPrompt" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- The help prompt. An array of text chunks of type TTSChunk. See TTSChunk. The array must have at least one item.
- </description>
- </param>
- <param name="initialPrompt" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- This is the intial prompt spoken to the user at the start of an interaction. An array of text chunks of type TTSChunk. See TTSChunk. The array must have at least one item.
- </description>
- </param>
- <param name="timeoutPrompt" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- Help text for a wait timeout. An array of text chunks of type TTSChunk. See TTSChunk. The array must have at least one item.
- </description>
- </param>
- <param name="timeout" type="Integer" mandatory="true">
- <description>Timeout initiate timeoutPrompt</description>
- </param>
- <param name="grammarID" type="Integer" minvalue="0" maxvalue="2000000000" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- IDs of the specific compiled grammars for this voice interaction.
- </description>
- </param>
- </function>
- <function name="PerformInteraction" messagetype="response">
- <param name="choiceID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
- <description>
- ID of the choice that was selected in response to PerformInteraction.
- </description>
- </param>
- </function>
- <function name="OnCommand" messagetype="notification" provider="hmi">
- <description>Notifies SDL about command trigerred via VR</description>
- <param name="cmdID" type="Integer" mandatory="true" minvalue="0" maxvalue="2000000000">
- <description>ID of of the command (list of strings)</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="ChangeRegistration" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLink to HMI to change language of VR.</description>
- <param name="vrSynonyms" type="String" maxlength="40" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- Request new VR synonyms registration
- Defines an additional voice recognition command.
- Must not interfere with any name of previously registered applications(SDL makes check).
- </description>
- </param>
- <param name="language" type="Common.Language" mandatory="true">
- <description>The language application wants to switch to.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that concerns this RPC.</description>
- </param>
- </function>
- <function name="ChangeRegistration" messagetype="response">
- </function>
- <function name="OnLanguageChange" messagetype="notification" provider="hmi">
- <description>Notification from HMI to SmartDeviceLink about change of language.</description>
- <param name="language" type="Common.Language" mandatory="true">
- <description>Language VR has switched to.</description>
- </param>
- </function>
- <function name="GetSupportedLanguages" messagetype="request" provider="hmi">
- <description>Method is invoked at system start-up. Response must provide the information about VR supported languages.</description>
- </function>
- <function name="GetSupportedLanguages" messagetype="response">
- <param name="languages" type="Common.Language" mandatory="true" array="true" minsize="1" maxsize="100">
- <description>List of languages supported in VR.</description>
- </param>
- </function>
- <function name="GetLanguage" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLink to HMI to get currently active VR language</description>
- </function>
- <function name="GetLanguage" messagetype="response">
- <param name="language" type="Common.Language" mandatory="true"/>
- </function>
- <function name="GetCapabilities" messagetype="request" provider="hmi">
- <description>Method is invoked at system startup by SDL to request information about VR capabilities of HMI.</description>
- </function>
- <function name="GetCapabilities" messagetype="response">
- <param name="vrCapabilities" type="Common.VrCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>Types of input recognized by VR module.</description>
- </param>
- </function>
- </interface>
- <interface name="TTS" version="1.0" date="2013-04-18">
- <description>RPCs for communication between TTS and SDL.</description>
- <function name="GetCapabilities" messagetype="request" provider="hmi">
- <description>Method is invoked at system start-up. SDL requests the information about all supported hardware and their capabilities</description>
- </function>
- <function name="GetCapabilities" messagetype="response">
- <param name="speechCapabilities" type="Common.SpeechCapabilities" minsize="1" maxsize="5" array="true" mandatory="true">
- <description>See SpeechCapabilities</description>
- </param>
- <param name="prerecordedSpeechCapabilities" type="Common.PrerecordedSpeech" minsize="1" maxsize="5" array="true" mandatory="true">
- <description>See PrerecordedSpeech</description>
- </param>
- </function>
- <function name="Started" messagetype="notification" provider="hmi">
- <description>Must be initiated by TTS module to let SDL know that TTS session has started.</description>
- </function>
- <function name="Stopped" messagetype="notification" provider="hmi">
- <description>Must be initiated by TTS module to let SDL know that TTS session has stopped.</description>
- </function>
- <function name="IsReady" messagetype="request" provider="hmi">
- <description>Method is invoked at system start-up. Response must provide the information about presence of TTS module and its readiness to cooperate with SDL.</description>
- </function>
- <function name="IsReady" messagetype="response">
- <param name="available" type="Boolean" mandatory="true">
- <description>Must be true if TTS is present and ready to communicate with SDL.</description>
- </param>
- </function>
- <function name="Speak" messagetype="request" provider="hmi">
- <description>RPC from SDL to TTS for speaking the text.</description>
- <param name="ttsChunks" type="Common.TTSChunk" mandatory="true" array="true" minsize="1" maxsize="100">
- <description>List of strings to be spoken.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that requested this RPC.</description>
- </param>
- <param name="speakType" type="Common.MethodName" mandatory="false">
- <description>Defines the type of the request which causes text-to-speech</description>
- </param>
- </function>
- <function name="Speak" messagetype="response">
- <description>Provides information about success of operation.</description>
- </function>
- <function name="StopSpeaking" messagetype="request" provider="hmi">
- <description>Initiated by SDL to stop speaking the text.</description>
- </function>
- <function name="StopSpeaking" messagetype="response">
- </function>
- <function name="ChangeRegistration" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLink to HMI to change language of TTS.</description>
- <param name="ttsName" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- Request new ttsName registration
- TTS string for VR recognition of the mobile application name, e.g. "Ford Drive Green".
- Meant to overcome any failing on speech engine in properly pronouncing / understanding app name.
- May not be empty.
- May not start with a new line character.
- Not unique value (SDL makes all the checks)
- </description>
- </param>
- <param name="language" type="Common.Language" mandatory="true">
- <description>The language application wants to switch to.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="ChangeRegistration" messagetype="response">
- </function>
- <function name="OnLanguageChange" messagetype="notification" provider="hmi">
- <description>Notification from HMI to SmartDeviceLink about change of language.</description>
- <param name="language" type="Common.Language" mandatory="true">
- <description>Language TTS has switched to.</description>
- </param>
- </function>
- <function name="GetSupportedLanguages" messagetype="request" provider="hmi">
- <description>Method is invoked at system start-up by SDL. Response must provide the information about TTS supported languages.</description>
- </function>
- <function name="GetSupportedLanguages" messagetype="response">
- <param name="languages" type="Common.Language" mandatory="true" array="true" minsize="1" maxsize="100">
- <description>List of languages supported in TTS.</description>
- </param>
- </function>
- <function name="GetLanguage" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLink to HMI to get currently active TTS language</description>
- </function>
- <function name="GetLanguage" messagetype="response">
- <param name="language" type="Common.Language" mandatory="true"/>
- </function>
- <function name="SetGlobalProperties" messagetype="request" provider="hmi">
- <description>Sets some properties for the application initiated request.</description>
- <param name="helpPrompt" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- The help prompt.
- An array of text chunks of type TTSChunk. See TTSChunk.
- The array must have at least one item.
- </description>
- </param>
- <param name="timeoutPrompt" type="Common.TTSChunk" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- Help text for a wait timeout.
- An array of text chunks of type TTSChunk. See TTSChunk.
- The array must have at least one item.
- </description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="SetGlobalProperties" messagetype="response">
- </function>
- <function name="OnResetTimeout" messagetype="notification">
- <description>
- Sender: HMI-&gt;SDL. HMI must send this notification every 10 sec. in case the 'methodName'
- results long processing on HMI
- </description>
- <param name="appID" type="Integer" mandatory="true">
- <description>Id of application that concerns the 'methodName'.</description>
- </param>
- <param name="methodName" type="String" mandatory="true">
- <description>The name of the method, the renew of timeout is required for</description>
- </param>
- </function>
- </interface>
- <interface name="UI" version="1.0" date="2013-04-16">
- <function name="Alert" messagetype="request" provider="hmi">
- <description>Request from SDL to show an alert message on the display.</description>
- <param name="alertStrings" type="Common.TextFieldStruct" mandatory="true" array="true" minsize="0" maxsize="3">
- <description>Array of lines of alert text fields. See TextFieldStruct. Uses alertText1, alertText2, alertText3.</description>
- </param>
- <param name="duration" type="Integer" mandatory="true" minvalue="3000" maxvalue="10000">
- <description>Timeout in milliseconds.</description>
- </param>
- <param name="softButtons" type="Common.SoftButton" mandatory="false" minsize="0" maxsize="4" array="true">
- <description>App defined SoftButtons</description>
- </param>
- <param name="progressIndicator" type="Boolean" mandatory="false">
- <description>If supported on the given platform, the alert GUI will include some sort of animation indicating that loading of a feature is progressing. e.g. a spinning wheel or hourglass, etc.</description>
- </param>
- <param name="alertType" type="Common.AlertType" mandatory="true">
- <description>Defines if only UI or BOTH portions of the Alert request are being sent to HMI Side</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="Alert" messagetype="response">
- <param name="tryAgainTime" type="Integer" mandatory="false" minvalue="0" maxvalue="2000000000">
- <description>Amount of time (in milliseconds) that SDL must wait before resending an alert. Must be provided if another system event or overlay currently has a higher priority than this alert.</description>
- </param>
- </function>
- <function name="Show" messagetype="request" provider="hmi">
- <param name="showStrings" type="Common.TextFieldStruct" mandatory="true" array="true" minsize="0" maxsize="7">
- <description>Array of lines of show text fields. See TextFieldStruct. Uses mainField1, mainField2, mainField3, mainField4. If some field is not set, the corresponding text should stay unchanged. If field's text is empty "", the field must be cleared.
- mainField1: The text that should be displayed in a single or upper display line.
- mainField2: The text that should be displayed on the second display line.
- mainField3: The text that should be displayed on the second "page" first display line.
- mainField4: The text that should be displayed on the second "page" second display line.
- statusBar: statusBar.
- mediaClock: Text value for MediaClock field.
- mediaTrack: The text that should be displayed in the track field. This field is only valid for media applications on NGN type ACMs.
- </description>
- </param>
- <param name="alignment" type="Common.TextAlignment" mandatory="false">
- <description>Specifies how mainField1 and mainField2 texts should be aligned on the display.</description>
- <description>If omitted, texts must be centered</description>
- </param>
- <param name="graphic" type="Common.Image" mandatory="false">
- <description>Path to optional dynamic image or the static binary image itself. See Image. If omitted, the displayed graphic should not change.</description>
- </param>
- <param name="secondaryGraphic" type="Common.Image" mandatory="false">
- <description>
- Image struct determining whether static or dynamic secondary image to display in app.
- If omitted on supported displays, the displayed secondary graphic shall not change.
- </description>
- </param>
- <param name="softButtons" type="Common.SoftButton" minsize="0" maxsize="8" array="true" mandatory="false">
- <description>App defined SoftButtons.</description>
- <description>If omitted, the currently displayed SoftButton values should not change.</description>
- </param>
- <param name="customPresets" type="String" maxlength="500" minsize="0" maxsize="10" array="true" mandatory="false">
- <description>App labeled on-screen presets (i.e. GEN3 media presets or dynamic search suggestions).</description>
- <description>If omitted on supported displays, the presets will be shown as not defined.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>Id of application related to this RPC.</description>
- </param>
- </function>
- <function name="Show" messagetype="response">
- </function>
- <function name="AddCommand" messagetype="request" provider="hmi">
- <description>Request from SDL to add a command to the application menu.</description>
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>ID of the command to be added.</description>
- </param>
- <param name="menuParams" type="Common.MenuParams" mandatory="false">
- <description>Optional sub value containing parameters of the command (position, name, etc.). See MenuParams. If omitted the command should be added to the end of the list of commands.</description>
- </param>
- <param name="cmdIcon" type="Common.Image" mandatory="false">
- <description>Image to be displayed for representing the command. See Image.</description>
- <description>If omitted, no (or the default if applicable) icon should be displayed.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that concerns this RPC.</description>
- </param>
- </function>
- <function name="AddCommand" messagetype="response">
- </function>
- <function name="DeleteCommand" messagetype="request" provider="hmi">
- <description>Request from SDL to delete a command from the in-application menu with the specified command id.</description>
- <param name="cmdID" type="Integer" mandatory="true" minvalue="0" maxvalue="2000000000">
- <description>cmdId previously sent via AddCommand request - id of the command to be deleted.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that concerns this RPC.</description>
- </param>
- </function>
- <function name="DeleteCommand" messagetype="response">
- </function>
- <function name="AddSubMenu" messagetype="request" provider="hmi">
- <description>Request from SDL to add a sub menu to the in-application menu.</description>
- <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="true">
- <description>ID of the sub menu to be added. Unique for the application.</description>
- </param>
- <param name="menuParams" type="Common.MenuParams" mandatory="true">
- <description>Position and name of menu to be added. 'parent' field is omitted for this RPC. </description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that requested this RPC.</description>
- </param>
- </function>
- <function name="AddSubMenu" messagetype="response">
- </function>
- <function name="DeleteSubMenu" messagetype="request" provider="hmi">
- <description>Request from SDL to delete a submenu from the in-application menu.</description>
- <param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="true">
- <description>The "menuID" of the sub-menu to be deleted. (See addSubMenu.menuID)</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that concerns this RPC.</description>
- </param>
- </function>
- <function name="DeleteSubMenu" messagetype="response">
- </function>
- <function name="PerformInteraction" messagetype="request" provider="hmi">
- <description>Request from SDL for triggering an interaction (e.g. "Permit GPS?" - Yes, no, Always Allow).</description>
- <param name="initialText" type="Common.TextFieldStruct" mandatory="false">
- <description>Uses initialInteractionText. See TextFieldStruct.</description>
- </param>
- <param name="choiceSet" type="Common.Choice" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>The list of choices to be used for the interaction with the user</description>
- </param>
- <param name="vrHelpTitle" type="String" maxlength="500" mandatory="false">
- <description>VR Help Title text.</description>
- <description>If omitted on supported displays, the default HU system help title should be used.</description>
- </param>
- <param name="vrHelp" type="Common.VrHelpItem" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>VR Help Items. If omitted on supported displays, the default HU system generated help items should be used.</description>
- </param>
- <param name="timeout" type="Integer" minvalue="5000" maxvalue="100000" defvalue="10000" mandatory="true">
- <description>Timeout in milliseconds.</description>
- </param>
- <param name="interactionLayout" type="Common.LayoutMode" mandatory="false">
- <description>See LayoutMode.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that concerns this RPC.</description>
- </param>
- </function>
- <function name="PerformInteraction" messagetype="response">
- <param name="choiceID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
- <description>ID of the choice that was selected in response to PerformInteraction.</description>
- </param>
- <param name="manualTextEntry" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>
- Manually entered text selection, e.g. through keyboard
- Can be returned in lieu of choiceID, depending on trigger source
- </description>
- </param>
- </function>
- <function name="SetMediaClockTimer" messagetype="request" provider="hmi">
- <description>Sets the initial media clock value and automatic update method.</description>
- <param name="startTime" type="Common.TimeFormat" mandatory="false">
- <description>startTime should be ignored for "PAUSE", "RESUME", and "CLEAR"</description>
- </param>
- <param name="endTime" type="Common.TimeFormat" mandatory="false">
- <description>
- See TimeFormat.
- endTime can be provided for "COUNTUP" and "COUNTDOWN"; to be used to calculate any visual progress bar (if not provided, this feature is ignored)
- If endTime is greater then startTime for COUNTDOWN or less than startTime for COUNTUP, then the request will return an INVALID_DATA.
- endTime will be ignored for "PAUSE", "RESUME", and "CLEAR"
- </description>
- </param>
- <param name="updateMode" type="Common.ClockUpdateMode" mandatory="true">
- <description>The update method of the media clock.</description>
- <description>In case of pause, resume, or clear, the start time value is ignored and shall be left out. For resume, the time continues with the same value as it was when paused.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that requested this RPC.</description>
- </param>
- </function>
- <function name="SetMediaClockTimer" messagetype="response">
- </function>
- <function name="SetGlobalProperties" messagetype="request" provider="hmi">
- <description>Request from SDL to set some properties for VR help.</description>
- <param name="vrHelpTitle" type="String" maxlength="500" mandatory="false">
- <description>VR Help Title text.</description>
- <description>If omitted on supported displays, the default HU system help title should be used.</description>
- </param>
- <param name="vrHelp" type="Common.VrHelpItem" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>VR Help Items. If omitted on supported displays, the default HU system generated help items should be used.</description>
- </param>
- <param name="menuTitle" maxlength="500" type="String" mandatory="false">
- <description>Optional text to label an app menu button (for certain touchscreen platforms).</description>
- </param>
- <param name="menuIcon" type="Common.Image" mandatory="false">
- <description>&gt;Optional icon to draw on an app menu button (for certain touchscreen platforms).</description>
- </param>
- <param name="keyboardProperties" type="Common.KeyboardProperties" mandatory="false">
- <description>On-screen keybaord configuration (if available).</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that concerns this RPC.</description>
- </param>
- </function>
- <function name="SetGlobalProperties" messagetype="response">
- </function>
- <function name="OnCommand" messagetype="notification" provider="hmi">
- <description>Notification must be initiated by HMI on user choosing menu item.</description>
- <param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
- <description>Command ID, which is related to a specific menu entry (previously sent with AddCommand).</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that is related to this RPC.</description>
- </param>
- </function>
- <function name="OnSystemContext" messagetype="notification" provider="hmi">
- <description>
- Notification must be initiated by HMI when the user changes the context of application: goes to menu (in-application menu or system menu);
- switches to VR; pop-up appears on screen etc.
- </description>
- <param name="systemContext" type="Common.SystemContext" mandatory="true">
- <description>The context the application is brought into.</description>
- </param>
- <param name="appID" type="Integer" mandatory="false">
- <description>ID of application that is related to this RPC.</description>
- </param>
- </function>
- <function name="GetCapabilities" messagetype="request" provider="hmi">
- <description>Method is invoked at system startup by SDL to request information about UI capabilities of HMI.</description>
- </function>
- <function name="GetCapabilities" messagetype="response">
- <param name="displayCapabilities" type="Common.DisplayCapabilities" mandatory="true">
- <description>Information about the capabilities of the display: its type, text field supported, etc. See DisplayCapabilities. </description>
- </param>
- <param name="audioPassThruCapabilities" type="Common.AudioPassThruCapabilities" mandatory="true"/>
- <param name="hmiZoneCapabilities" type="Common.HmiZoneCapabilities" mandatory="true"/>
- <param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>Must be returned if the platform supports on-screen SoftButtons.</description>
- </param>
- <param name="hmiCapabilities" type="Common.HMICapabilities" mandatory="false">
- <description>Specifies the HMI&#8217;s capabilities. See HMICapabilities.</description>
- </param>
- </function>
- <function name="ChangeRegistration" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLink to HMI to change language for app.</description>
- <param name="appName" type="String" maxlength="100" mandatory="false">
- <description>
- Request new app name registration
- Needs to be unique over all applications.
- May not be empty. May not start with a new line character.
- May not interfere with any name or synonym of any registered applications.
- Applications with the same name will be rejected. (SDL makes all the checks)
- </description>
- </param>
- <param name="ngnMediaScreenAppName" type="String" maxlength="100" mandatory="false">
- <description>Request new app short name registration</description>
- </param>
- <param name="language" type="Common.Language" mandatory="true">
- <description>The language application wants to switch to.</description>
- </param>
- <param name="appHMIType" type="Common.AppHMIType" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>
- Sent when app's requested-during-registration AppHMIType is changed to different one due to Policies update. Contains the updated list of all allowed app's AppHMITypes.
- </description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that concerns this RPC.</description>
- </param>
- </function>
- <function name="ChangeRegistration" messagetype="response">
- </function>
- <function name="OnLanguageChange" messagetype="notification" provider="hmi">
- <description>Notification from HMI to SmartDeviceLink about change of language.</description>
- <param name="language" type="Common.Language" mandatory="true">
- <description>Language UI has switched to.</description>
- </param>
- </function>
- <function name="GetSupportedLanguages" messagetype="request" provider="hmi">
- <description>Method should be invoked at system startup. Response provides information about UI supported languages.</description>
- </function>
- <function name="GetSupportedLanguages" messagetype="response">
- <param name="languages" type="Common.Language" mandatory="true" array="true" minsize="1" maxsize="100">
- <description>List of languages supported in UI.</description>
- </param>
- </function>
- <function name="GetLanguage" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLink to HMI to get currently active UI language</description>
- </function>
- <function name="GetLanguage" messagetype="response">
- <param name="language" type="Common.Language" mandatory="true"/>
- </function>
- <function name="OnDriverDistraction" messagetype="notification" provider="hmi">
- <description>Notification must be sent from HMI to SDL when driver distraction state is changed. Driver distraction rules are defined by the platform.</description>
- <param name="state" type="Common.DriverDistractionState" mandatory="true">
- <description>See DriverDistractionState. </description>
- </param>
- </function>
- <function name="SetAppIcon" messagetype="request" provider="hmi">
- <description>Used to set existing local file on SYNC as the app's icon.</description>
- <param name="syncFileName" type="Common.Image" mandatory="true">
- <description>Either the path to the dynamic image stored on HY or the static binary image itself. See Image</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="SetAppIcon" messagetype="response">
- </function>
- <function name="SetDisplayLayout" messagetype="request" provider="hmi">
- <param name="displayLayout" type="String" maxlength="500" mandatory="true">
- <description>
- Predefined or dynamically created screen layout.
- Currently only predefined screen layouts are defined.
- </description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="SetDisplayLayout" messagetype="response">
- <param name="displayCapabilities" type="Common.DisplayCapabilities" mandatory="false">
- <description>See DisplayCapabilities</description>
- </param>
- <param name="buttonCapabilities" type="Common.ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See ButtonCapabilities</description>
- </param>
- <param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description>
- </param>
- <param name="presetBankCapabilities" type="Common.PresetBankCapabilities" mandatory="false">
- <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description>
- </param>
- </function>
- <function name="ShowCustomForm" messagetype="request" provider="hmi">
- <description>Used to show a custom form; it can be a parent or child screen. If no parent screen is designated, it is set as a parent screen.</description>
- <param name="customFormID" type="String" maxlength="500" mandatory="true">
- <description>
- Predefined or dynamically created screen layout.
- Currently only predefined forms are defined.
- Predefined layouts include:
- "DEFAULT" - Default media / non-media screen
- "ONSCREEN_PRESETS" - Custom root media screen containing app-defined onscreen presets.
- "KEYBOARD_SEARCH" - Custom template containing app-configured on-screen keyboard with active search updating; user also can trigger voice search.
- "NAV_FULLSCREEN_MAP" - Custom root template screen containing full screen map with navigation controls.
- "NAV_POI_MENU" - Custom template containing app-defined POI options.
- "NAV_SEARCH_RESULTS" - Custom template containing a list of app-defined search results
- "NAV_POI_INFO" - Custom template containing app-defined POI information (and potentially map data).
- </description>
- </param>
- <param name="parentFormID" type="String" maxlength="500" defvalue="DEFAULT" mandatory="false">
- <description>
- Parent screen of predefined form to display.
- Currently only predefined forms are defined.
- If not provided, then set to "DEFAULT".
- Predefined layouts include:
- "DEFAULT" - Default media / non-media screen
- "ONSCREEN_PRESETS" - Custom root media screen containing app-defined onscreen presets.
- "NAV_FULLSCREEN_MAP" - Custom template containing full screen map with navigation controls.
- </description>
- </param>
- </function>
- <function name="ShowCustomForm" messagetype="response">
- <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
- <description>Provides additional human readable info regarding the result.</description>
- </param>
- </function>
- <function name="OnKeyboardInput" messagetype="notification" provider="hmi">
- <description>On-screen keyboard event.</description>
- <description>Can be full string or individual keypresses depending on keyboard mode.</description>
- <param name="event" type="Common.KeyboardEvent" mandatory="true">
- <description>On-screen keyboard input data.</description>
- </param>
- <param name="data" type="String" minlength="0" maxlength="500" mandatory="false">
- <description>On-screen keyboard input data.</description>
- <description>For dynamic keypress events, this will be the current compounded string of entry text.</description>
- <description>For entry submission events, this will be the full text entry (this will always return regardless of the mode).</description>
- <description>For entry cancelled and entry aborted events, this data param will be omitted.</description>
- </param>
- </function>
- <function name="OnTouchEvent" messagetype="notification" provider="hmi">
- <description>Notifies about touch events on the screen's prescribed area</description>
- <param name="type" type="Common.TouchType" mandatory="true">
- <description>The type of touch event.</description>
- </param>
- <param name="event" type="Common.TouchEvent" mandatory="true" minsize="1" maxsize="10" array="true">
- <description>List of all individual touches involved in this event.</description>
- </param>
- </function>
- <function name="Slider" messagetype="request" provider="hmi">
- <description>Creates a full screen or pop-up overlay (depending on platform) with a single user controlled slider.</description>
- <param name="numTicks" type="Integer" minvalue="2" maxvalue="26" mandatory="true">
- <description>Number of selectable items on a horizontal axis</description>
- </param>
- <param name="position" type="Integer" minvalue="1" maxvalue="26" mandatory="true">
- <description>Initial position of slider control (cannot exceed numTicks)</description>
- </param>
- <param name="sliderHeader" type="String" maxlength="500" mandatory="true">
- <description>Text header to be displayed.</description>
- </param>
- <param name="sliderFooter" type="String" maxlength="500" minsize="1" maxsize="26" array="true" mandatory="false">
- <description>Text footer to be displayed (meant to display min/max threshold descriptors).</description>
- <description>For a static text footer, only one footer string shall be provided in the array.</description>
- <description>For a dynamic text footer, the number of footer text string in the array must match the numTicks value.</description>
- <description>For a dynamic text footer, text array string should correlate with potential slider position index.</description>
- <description>If omitted on supported displays, no footer text shall be displayed.</description>
- </param>
- <param name="timeout" type="Integer" minvalue="1000" maxvalue="65535" mandatory="true">
- <description>Timeout. The slider should be displayed until the defined amount of time has elapsed. </description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that concerns this RPC.</description>
- </param>
- </function>
- <function name="Slider" messagetype="response">
- <param name="sliderPosition" type="Integer" minvalue="1" maxvalue="26" mandatory="false">
- <description>Current slider position. Must be returned when the user has clicked the &#8216;Save&#8217; or &#8216;Canceled&#8217; button or by the timeout </description>
- </param>
- </function>
- <function name="ScrollableMessage" messagetype="request" provider="hmi">
- <description>Creates a full screen overlay containing a large block of formatted text that can be scrolled with up to 8 SoftButtons defined</description>
- <param name="messageText" type="Common.TextFieldStruct" mandatory="true">
- <description>Body of text that can include newlines and tabs. Uses scrollableMessageBody.</description>
- </param>
- <param name="timeout" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Timeout in milliseconds. The message should be displayed until the time defined is up.</description>
- </param>
- <param name="softButtons" type="Common.SoftButton" minsize="0" maxsize="8" array="true" mandatory="false">
- <description>App defined SoftButtons.</description>
- <description>If omitted on supported displays, only the system defined "Close" SoftButton should be displayed.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="ScrollableMessage" messagetype="response">
- </function>
- <function name="PerformAudioPassThru" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- <param name="audioPassThruDisplayTexts" type="Common.TextFieldStruct" mandatory="true" minsize="0" maxsize="2" array="true">
- <description>Uses
- audioPassThruDisplayText1: First line of text displayed during audio capture.
- audioPassThruDisplayText2: Second line of text displayed during audio capture.</description>
- </param>
- <param name="maxDuration" type="Integer" minvalue="1" maxvalue="1000000" mandatory="true">
- <description>The maximum duration of audio recording in milliseconds. If not provided, the recording should be performed until EndAudioPassThru arrives.</description>
- </param>
- <param name="muteAudio" type="Boolean" mandatory="true">
- <description>
- Defines if the current audio source should be muted during the APT session. If not, the audio source will play without interruption.
- If omitted, the value is set to true.
- </description>
- </param>
- </function>
- <function name="PerformAudioPassThru" messagetype="response">
- </function>
- <function name="EndAudioPassThru" messagetype="request" provider="hmi">
- <description>Request is sent by SDL to stop the audio capturing.</description>
- </function>
- <function name="EndAudioPassThru" messagetype="response">
- </function>
- <function name="IsReady" messagetype="request" provider="hmi">
- <description>Method is invoked at system startup. Response provides information about presence of UI module and its readiness to cooperate with SDL.</description>
- </function>
- <function name="IsReady" messagetype="response">
- <param name="available" type="Boolean" mandatory="true">
- <description>Must be true if UI is present and ready to communicate with SDL.</description>
- </param>
- </function>
- <function name="ClosePopUp" messagetype="request" provider="hmi">
- <description>Initiated by SDL to close currently active pop-up on HMI.</description>
- <param name="methodName" type="String" mandatory="false">
- <description>Method to be closed</description>
- </param>
- </function>
- <function name="ClosePopUp" messagetype="response">
- <description>Provides the result of operation.</description>
- </function>
- <function name="OnResetTimeout" messagetype="notification" provider="hmi">
- <description>HMI must provide SDL with notifications specific to the current Turn-By-Turn client status on the module</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>Id of application that invoked notifcation.</description>
- </param>
- <param name="methodName" type="String" mandatory="true">
- <description>Currently used method name on which was triggered action</description>
- </param>
- </function>
- <function name="OnRecordStart" messagetype="notification" provider="sdl">
- <description>Issued by SDL to notify HMI about capturing mic data should be started</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="SendHapticData" messagetype="request">
- <description>Send the UI spatial data from MOBILE. This data will be utilized by the HMI to determine how and when haptic events should occur</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>Internal ID of the application that requested this RPC.</description>
- </param>
- <param name="hapticRectData" type="Common.HapticRect" minsize="0" maxsize="1000" mandatory="false" array="true">
- <description>
- Array of rectangle data structures that represent the locations of all user controls present on the HMI.
- This data should be updated if/when the application presents a new screen.
- When a request is sent, if successful, it will replace all rectangle data previously sent through RPC.
- Avoidance of doubt, when an empty hapticRectData, it will be clear all rectangle data previously sent through RPC.
- </description>
- </param>
- </function>
- <function name="SendHapticData" messagetype="response">
- </function>
- </interface>
- <interface name="Navigation" version="1.0" date="2013-05-22">
- <function name="IsReady" messagetype="request" provider="hmi">
- <description>Method is invoked at system startup. Response must provide the information about presence of UI Navigation module and its readiness to cooperate with SDL.</description>
- </function>
- <function name="IsReady" messagetype="response">
- <param name="available" type="Boolean" mandatory="true">
- <description>Must be true if Navigation is present and ready to communicate with SDL.</description>
- </param>
- </function>
- <function name="SendLocation" messagetype="request">
- <description>That allows the app to send a destination to the embedded nav system.</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- <param name="longitudeDegrees" type="Float" minvalue="-180" maxvalue="180" mandatory="true">
- </param>
- <param name="latitudeDegrees" type="Float" minvalue="-90" maxvalue="90" mandatory="true">
- </param>
- <param name="locationName" type="String" maxlength="500" mandatory="false">
- <description> Name / title of intended location </description>
- </param>
- <param name="locationDescription" type="String" maxlength="500" mandatory="false">
- <description> Description intended location / establishment (if applicable) </description>
- </param>
- <param name="addressLines" type="String" maxlength="500" minsize="0" maxsize="4" array="true" mandatory="false">
- <description> Location address (if applicable) </description>
- </param>
- <param name="phoneNumber" type="String" maxlength="500" mandatory="false">
- <description> Phone number of intended location / establishment (if applicable) </description>
- </param>
- <param name="locationImage" type="Common.Image" mandatory="false">
- <description> Image / icon of intended location (if applicable and supported) </description>
- </param>
- </function>
- <function name="SendLocation" messagetype="response">
- </function>
-
- <function name="DialNumber" functionID="DialNumberID" messagetype="request">
- <description>Dials a phone number and switches to phone application.</description>
- <param name="number" type="String" maxlength="40" mandatory="true">
- <description>Phone number is a string, which can be up to 40 chars.</description>
- </param>
- </function>
-
- <function name="DialNumber" functionID="DialNumberID" messagetype="response">
- </function>
-
- <function name="ShowConstantTBT" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLinkCore to HMI to show info about navigation.</description>
- <param name="navigationTexts" type="Common.TextFieldStruct" mandatory="true" array="true" minsize="0" maxsize="5">
- <description>See TextFieldStruct. Uses:
- navigationText1
- navigationText2
- ETA
- totalDistance
- timeToDestination.
- </description>
- </param>
- <param name="turnIcon" type="Common.Image" mandatory="false">
- </param>
- <param name="nextTurnIcon" type="Common.Image" mandatory="false">
- </param>
- <param name="distanceToManeuver" type="Float" minvalue="0" maxvalue="1000000000" mandatory="true">
- <description>Fraction of distance till next maneuver (from previous maneuver).</description>
- <description>May be used to calculate progress bar.</description>
- </param>
- <param name="distanceToManeuverScale" type="Float" minvalue="0" maxvalue="1000000000" mandatory="true">
- <description>Fraction of distance till next maneuver (starting from when AlertManeuver is triggered).</description>
- <description>May be used to calculate progress bar.</description>
- </param>
- <param name="maneuverComplete" type="Boolean" mandatory="false">
- <description>If and when a maneuver has completed while an AlertManeuver is active, SDL will send this value set to TRUE in order to clear the AlertManeuver overlay.</description>
- <description>If omitted the value should be assumed as FALSE.</description>
- </param>
- <param name="softButtons" type="Common.SoftButton" minsize="0" maxsize="3" array="true" mandatory="false">
- <description>Three dynamic SoftButtons available</description>
- <description>If omitted on supported displays, the currently displayed SoftButton values will not change.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="ShowConstantTBT" messagetype="response">
- </function>
- <function name="AlertManeuver" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLinkCore to HMI to announce navigation maneuver</description>
- <param name="softButtons" type="Common.SoftButton" minsize="0" maxsize="3" array="true" mandatory="false">
- <description>If omitted, only the system defined "Close" SoftButton should be displayed.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of the application requested this RPC.</description>
- </param>
- </function>
- <function name="AlertManeuver" messagetype="response">
- </function>
- <function name="UpdateTurnList" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLinkCore to HMI to update turn list.</description>
- <param name="turnList" type="Common.Turn" minsize="1" maxsize="100" array="true" mandatory="false">
- </param>
- <param name="softButtons" type="Common.SoftButton" minsize="0" maxsize="1" array="true" mandatory="false">
- <description>If omitted, app-defined SoftButton should be left blank.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="UpdateTurnList" messagetype="response">
- </function>
- <function name="OnTBTClientState" messagetype="notification" provider="hmi">
- <description>HMI must provide SDL with notifications specific to the current Turn-By-Turn client status on the module</description>
- <param name="state" type="Common.TBTState" mandatory="true">
- <description>Current State of TBT client</description>
- </param>
- </function>
- <function name="SetVideoConfig" messagetype="request">
- <description>Request from SDL to HMI to ask whether HMI accepts a video stream with given configuration.</description>
- <param name="config" type="Common.VideoConfig" mandatory="true">
- <description>Configuration of a video stream.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="SetVideoConfig" messagetype="response">
- <description>
- Response from HMI to SDL whether the configuration is accepted.
- In a negative response, a list of rejected parameters are supplied.
- </description>
- <param name="rejectedParams" type="String" array="true" minsize="1" maxsize="1000" mandatory="false">
- <description>
- List of params of VideoConfig struct which are not accepted by HMI, e.g. "protocol" and "codec".
- This param exists only when the response is negative.
- </description>
- </param>
- </function>
- <function name="StartStream" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLinkCore to HMI to start playing video streaming.</description>
- <param name="url" type="String" minlength="21" maxlength="500" mandatory="true">
- <description>URL that HMI start playing.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="StartStream" messagetype="response">
- </function>
- <function name="StopStream" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLinkCore to HMI to stop playing video streaming.</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="StopStream" messagetype="response">
- </function>
- <function name="StartAudioStream" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLinkCore to HMI to start playing audio streaming.</description>
- <param name="url" type="String" minlength="21" maxlength="500" mandatory="true">
- <description>URL that HMI start playing.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="StartAudioStream" messagetype="response">
- </function>
- <function name="StopAudioStream" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLinkCore to HMI to stop playing audio streaming.</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="StopAudioStream" messagetype="response">
- </function>
- <function name="OnAudioDataStreaming" messagetype="notification">
- <description>Sender: SDL-&gt;HMI. Purpose: notify about raw audio data presence over the URL provided via StartAudioStream SDL's request.</description>
- <param name="available" type="Boolean" mandatory="true">
- <description>If "true" - audio data started. If "false" - audio data stopped.</description>
- </param>
- </function>
- <function name="OnVideoDataStreaming" messagetype="notification">
- <description>Sender: SDL-&gt;HMI. Purpose: notify about raw video data presence over the URL provided via StartStream SDL's request.</description>
- <param name="available" type="Boolean" mandatory="true">
- <description>If "true" - video data started. If "false" - video data stopped.</description>
- </param>
- </function>
- <function name="GetWayPoints" functionID="GetWayPointsID" messagetype="request">
- <description>Request for getting waypoint/destination data.</description>
- <param name="wayPointType" type="Common.WayPointType" mandatory="true">
- <description>To request for either the destination only or for all waypoints including destination</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of the application.</description>
- </param>
- </function>
- <function name="GetWayPoints" functionID="GetWayPointsID" messagetype="response">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of the application.</description>
- </param>
- <param name="wayPoints" type="Common.LocationDetails" mandatory="false" array="true" minsize="1" maxsize="10">
- <description>See LocationDetails</description>
- </param>
- </function>
- <function name="OnWayPointChange" functionID="OnWayPointChangeID" messagetype="notification">
- <description>Notification which provides the entire LocationDetails when there is a change to any waypoints or destination.</description>
- <param name="wayPoints" type="Common.LocationDetails" mandatory="true" array="true" minsize="1" maxsize="10">
- <description>See LocationDetails</description>
- </param>
- </function>
-
- <function name="SubscribeWayPoints" functionID="SubscribeWayPointsID" messagetype="request">
- <description>To subscribe in getting changes for Waypoints/destinations</description>
- </function>
-
- <function name="SubscribeWayPoints" functionID="SubscribeWayPointsID" messagetype="response">
- </function>
-
- <function name="UnsubscribeWayPoints" functionID="UnsubscribeWayPointsID" messagetype="request">
- <description>Request to unsubscribe from WayPoints and Destination</description>
- </function>
-
- <function name="UnsubscribeWayPoints" functionID="UnsubscribeWayPointsID" messagetype="response">
- </function>
- </interface>
-
- <interface name="VehicleInfo" version="1.0" date="2013-04-21">
- <function name="IsReady" messagetype="request" provider="hmi">
- <description>Method is invoked at system startup. Response should provide information about presence of any of vehicle information modules (ECU, GPS, etc) and their readiness to cooperate with SDL.</description>
- </function>
- <function name="IsReady" messagetype="response">
- <param name="available" type="Boolean" mandatory="true">
- <description>Must be true if vehicle data modules are present and ready to communicate with SDL.</description>
- </param>
- </function>
- <function name="GetVehicleType" messagetype="request" provider="hmi">
- <description>Request from SmartDeviceLinkCore to HMI to get info about the vehicle (type, model, etc.).</description>
- </function>
- <function name="GetVehicleType" messagetype="response">
- <param name="vehicleType" type="Common.VehicleType" mandatory="true"/>
- </function>
- <function name="ReadDID" messagetype="request" provider="hmi">
- <description>Request from SDL for vehicle data reading.</description>
- <param name="ecuName" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Name of ECU.</description>
- </param>
- <param name="didLocation" type="Integer" minvalue="0" maxvalue="65535" minsize="1" maxsize="1000" array="true" mandatory="true">
- <description>Get raw data from vehicle data DID location(s).</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- </function>
- <function name="ReadDID" messagetype="response">
- <param name="didResult" type="Common.DIDResult" minsize="0" maxsize="1000" array="true" mandatory="false">
- <description>Array of requested DID results (with data if available).</description>
- </param>
- </function>
- <function name="GetDTCs" messagetype="request" provider="hmi">
- <description>Vehicle module diagnostic trouble code request.</description>
- <param name="ecuName" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Name of ECU.</description>
- </param>
- <param name="dtcMask" type="Integer" minvalue="0" maxvalue="255" mandatory="false">
- <description>DTC Mask Byte to be sent in diagnostic request to module .</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that requested this RPC.</description>
- </param>
- </function>
- <function name="GetDTCs" messagetype="response">
- <param name="ecuHeader" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>2 byte ECU Header for DTC response (as defined in VHR_Layout_Specification_DTCs.pdf)</description>
- </param>
- <param name="dtc" type="String" mandatory="false" minsize="1" maxsize="15" maxlength="10" array="true">
- <description>
- Array of all reported DTCs on module. Each DTC is represented with 4 bytes:
- 3 bytes for data
- 1 byte for status
- </description>
- </param>
- </function>
- <function name="DiagnosticMessage" messagetype="request" provider="hmi">
- <description>Non periodic vehicle diagnostic request</description>
- <param name="targetID" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Name of target ECU.</description>
- </param>
- <param name="messageLength" type="Integer" minvalue="0" maxvalue="65535" mandatory="true">
- <description>Length of message (in bytes).</description>
- </param>
- <param name="messageData" type="Integer" minvalue="0" maxvalue="255" minsize="1" maxsize="65535" array="true" mandatory="true">
- <description>
- Array of bytes comprising CAN message.
- </description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that requested this RPC.</description>
- </param>
- </function>
- <function name="DiagnosticMessage" messagetype="response">
- <param name="messageDataResult" type="Integer" minvalue="0" maxvalue="255" minsize="1" maxsize="65535" array="true" mandatory="true">
- <description>
- Array of bytes comprising CAN message result.
- </description>
- </param>
- </function>
- <function name="SubscribeVehicleData" messagetype="request">
- <description>
- Subscribes for specific published data items.
- The data will be only sent if it has changed.
- The application will be notified by the onVehicleData notification whenever new data is available.
- To unsubscribe the notifications, use unsubscribe with the same subscriptionType.
- </description>
- <param name="gps" type="Boolean" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Boolean" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Boolean" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Boolean" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="Boolean" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Boolean" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="externalTemperature" type="Boolean" mandatory="false">
- <description>The external temperature in degrees celsius</description>
- </param>
- <param name="prndl" type="Boolean" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="Boolean" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Boolean" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="Boolean" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="Boolean" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="Boolean" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="Boolean" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="Boolean" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="Boolean" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Boolean" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Boolean" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Boolean" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <!-- Ford Specific Data Items -->
- <param name="eCallInfo" type="Boolean" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="Boolean" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="Boolean" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModeStatus" type="Boolean" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="Boolean" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- <!-- / Ford Specific Data Items -->
- </function>
- <function name="SubscribeVehicleData" messagetype="response">
- <param name="gps" type="Common.VehicleDataResult" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Common.VehicleDataResult" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Common.VehicleDataResult" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Common.VehicleDataResult" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="externalTemperature" type="Common.VehicleDataResult" mandatory="false">
- <description>The external temperature in degrees celsius.</description>
- </param>
- <param name="prndl" type="Common.VehicleDataResult" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="Common.VehicleDataResult" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Common.VehicleDataResult" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="Common.VehicleDataResult" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="Common.VehicleDataResult" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="Common.VehicleDataResult" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="Common.VehicleDataResult" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="Common.VehicleDataResult" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="Common.VehicleDataResult" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Common.VehicleDataResult" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Common.VehicleDataResult" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Common.VehicleDataResult" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <!-- Ford Specific Data Items -->
- <param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="Common.VehicleDataResult" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="Common.VehicleDataResult" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModes" type="Common.VehicleDataResult" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="Common.VehicleDataResult" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- <!-- / Ford Specific Data Items -->
- </function>
- <function name="UnsubscribeVehicleData" messagetype="request">
- <description>
- This function is used to unsubscribe the notifications from the subscribeVehicleData function.
- </description>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that requested this RPC.</description>
- </param>
- <param name="gps" type="Boolean" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Boolean" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Boolean" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Boolean" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="Boolean" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Boolean" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="externalTemperature" type="Boolean" mandatory="false">
- <description>The external temperature in degrees celsius.</description>
- </param>
- <param name="prndl" type="Boolean" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="Boolean" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Boolean" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="Boolean" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="Boolean" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="Boolean" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="Boolean" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="Boolean" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="Boolean" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Boolean" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Boolean" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Boolean" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <!-- Ford Specific Data Items -->
- <param name="eCallInfo" type="Boolean" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="Boolean" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="Boolean" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModeStatus" type="Boolean" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="Boolean" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- <!-- / Ford Specific Data Items -->
- </function>
- <function name="UnsubscribeVehicleData" messagetype="response">
- <param name="gps" type="Common.VehicleDataResult" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Common.VehicleDataResult" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Common.VehicleDataResult" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Common.VehicleDataResult" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="externalTemperature" type="Common.VehicleDataResult" mandatory="false">
- <description>The external temperature in degrees celsius</description>
- </param>
- <param name="prndl" type="Common.VehicleDataResult" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="Common.VehicleDataResult" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Common.VehicleDataResult" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="Common.VehicleDataResult" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="Common.VehicleDataResult" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="Common.VehicleDataResult" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="Common.VehicleDataResult" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="Common.VehicleDataResult" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="Common.VehicleDataResult" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Common.VehicleDataResult" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Common.VehicleDataResult" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Common.VehicleDataResult" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <!-- Ford Specific Data Items -->
- <param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="Common.VehicleDataResult" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="Common.VehicleDataResult" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModes" type="Common.VehicleDataResult" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="Common.VehicleDataResult" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- <!-- / Ford Specific Data Items -->
- </function>
- <function name="GetVehicleData" messagetype="request">
- <description>Non periodic vehicle data read request.</description>
- <param name="gps" type="Boolean" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Boolean" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Boolean" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Boolean" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="Boolean" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Boolean" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="externalTemperature" type="Boolean" mandatory="false">
- <description>The external temperature in degrees celsius</description>
- </param>
- <param name="vin" type="Boolean" mandatory="false">
- <description>Vehicle identification number</description>
- </param>
- <param name="prndl" type="Boolean" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="Boolean" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Boolean" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="Boolean" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="Boolean" mandatory="false">
- <description>The body information including ignition status and internal temp</description>
- </param>
- <param name="deviceStatus" type="Boolean" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="Boolean" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="Boolean" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="Boolean" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Boolean" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Boolean" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Boolean" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <param name="eCallInfo" type="Boolean" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="Boolean" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="Boolean" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModeStatus" type="Boolean" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="Boolean" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- </function>
- <function name="GetVehicleData" messagetype="response">
- <param name="gps" type="Common.GPSData" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="Common.ComponentVolumeStatus" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
- <description>The external temperature in degrees celsius</description>
- </param>
- <param name="vin" type="String" maxlength="17" mandatory="false">
- <description>Vehicle identification number</description>
- </param>
- <param name="prndl" type="Common.PRNDL" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="Common.TireStatus" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="Common.BeltStatus" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="Common.BodyInformation" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="Common.DeviceStatus" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="Common.WiperStatus" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="Common.HeadLampStatus" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="Common.AirbagStatus" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="Common.EmergencyEvent" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModeStatus" type="Common.ClusterModeStatus" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="Common.MyKey" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- </function>
- <function name="OnVehicleData" messagetype="notification">
- <description>Callback for the periodic and non periodic vehicle data read function.</description>
- <param name="gps" type="Common.GPSData" mandatory="false">
- <description>See GPSData</description>
- </param>
- <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="false">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="false">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- <param name="fuelLevel_State" type="Common.ComponentVolumeStatus" mandatory="false">
- <description>The fuel level state</description>
- </param>
- <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
- <description>The external temperature in degrees celsius</description>
- </param>
- <param name="vin" type="String" maxlength="17" mandatory="false">
- <description>Vehicle identification number.</description>
- </param>
- <param name="prndl" type="Common.PRNDL" mandatory="false">
- <description>See PRNDL</description>
- </param>
- <param name="tirePressure" type="Common.TireStatus" mandatory="false">
- <description>See TireStatus</description>
- </param>
- <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="false">
- <description>Odometer in km</description>
- </param>
- <param name="beltStatus" type="Common.BeltStatus" mandatory="false">
- <description>The status of the seat belts</description>
- </param>
- <param name="bodyInformation" type="Common.BodyInformation" mandatory="false">
- <description>The body information including power modes</description>
- </param>
- <param name="deviceStatus" type="Common.DeviceStatus" mandatory="false">
- <description>The device status including signal and battery strength</description>
- </param>
- <param name="driverBraking" type="Common.VehicleDataEventStatus" mandatory="false">
- <description>The status of the brake pedal</description>
- </param>
- <param name="wiperStatus" type="Common.WiperStatus" mandatory="false">
- <description>The status of the wipers</description>
- </param>
- <param name="headLampStatus" type="Common.HeadLampStatus" mandatory="false">
- <description>Status of the head lamps</description>
- </param>
- <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="false">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="false">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- <param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- <param name="airbagStatus" type="Common.AirbagStatus" mandatory="false">
- <description>The status of the air bags</description>
- </param>
- <param name="emergencyEvent" type="Common.EmergencyEvent" mandatory="false">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- <param name="clusterModeStatus" type="Common.ClusterModeStatus" mandatory="false">
- <description>The status modes of the cluster</description>
- </param>
- <param name="myKey" type="Common.MyKey" mandatory="false">
- <description>Information related to the MyKey feature</description>
- </param>
- </function>
- <!--Qt HMI version of GetVehicleData-->
- <function name="GetGpsData" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetGpsData" messagetype="response">
- <param name="gps" type="Common.GPSData" mandatory="true">
- <description>See GPSData</description>
- </param>
- </function>
- <function name="GetSpeed" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetSpeed" messagetype="response">
- <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="true">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- </function>
- <function name="GetRpm" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetRpm" messagetype="response">
- <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="true">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- </function>
- <function name="GetFuelLevel" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetFuelLevel" messagetype="response">
- <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="true">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- </function>
- <function name="GetFuelLevelState" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetFuelLevelState" messagetype="response">
- <param name="fuelLevel_State" type="Common.ComponentVolumeStatus" mandatory="true">
- <description>The fuel level state</description>
- </param>
- </function>
- <function name="GetInstantFuelConsumption" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetInstantFuelConsumption" messagetype="response">
- <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="true">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- </function>
- <function name="GetExternalTemperature" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetExternalTemperature" messagetype="response">
- <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="true">
- <description>The external temperature in degrees celsius</description>
- </param>
- </function>
- <function name="GetVin" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetVin" messagetype="response">
- <param name="vin" type="String" maxlength="17" mandatory="true">
- <description>Vehicle identification number</description>
- </param>
- </function>
- <function name="GetPrndl" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetPrndl" messagetype="response">
- <param name="prndl" type="Common.PRNDL" mandatory="true">
- <description>See PRNDL</description>
- </param>
- </function>
- <function name="GetTirePressure" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetTirePressure" messagetype="response">
- <param name="tirePressure" type="Common.TireStatus" mandatory="true">
- <description>See TireStatus</description>
- </param>
- </function>
- <function name="GetOdometer" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetOdometer" messagetype="response">
- <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="true">
- <description>Odometer in km</description>
- </param>
- </function>
- <function name="GetBeltStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetBeltStatus" messagetype="response">
- <param name="beltStatus" type="Common.BeltStatus" mandatory="true">
- <description>The status of the seat belts</description>
- </param>
- </function>
- <function name="GetBodyInformation" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetBodyInformation" messagetype="response">
- <param name="bodyInformation" type="Common.BodyInformation" mandatory="true">
- <description>The body information including power modes</description>
- </param>
- </function>
- <function name="GetDeviceStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetDeviceStatus" messagetype="response">
- <param name="deviceStatus" type="Common.DeviceStatus" mandatory="true">
- <description>The device status including signal and battery strength</description>
- </param>
- </function>
- <function name="GetDriverBraking" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetDriverBraking" messagetype="response">
- <param name="driverBraking" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>The status of the brake pedal</description>
- </param>
- </function>
- <function name="GetWiperStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetWiperStatus" messagetype="response">
- <param name="wiperStatus" type="Common.WiperStatus" mandatory="true">
- <description>The status of the wipers</description>
- </param>
- </function>
- <function name="GetHeadLampStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetHeadLampStatus" messagetype="response">
- <param name="headLampStatus" type="Common.HeadLampStatus" mandatory="true">
- <description>Status of the head lamps</description>
- </param>
- </function>
- <function name="GetEngineTorque" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetEngineTorque" messagetype="response">
- <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="true">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- </function>
- <function name="GetAccPedalPosition" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetAccPedalPosition" messagetype="response">
- <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="true">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- </function>
- <function name="GetSteeringWheelAngle" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetSteeringWheelAngle" messagetype="response">
- <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="true">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- </function>
- <function name="GetECallInfo" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetECallInfo" messagetype="response">
- <param name="eCallInfo" type="Common.ECallInfo" mandatory="true">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- </function>
- <function name="GetAirbagStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetAirbagStatus" messagetype="response">
- <param name="airbagStatus" type="Common.AirbagStatus" mandatory="true">
- <description>The status of the air bags</description>
- </param>
- </function>
- <function name="GetEmergencyEvent" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetEmergencyEvent" messagetype="response">
- <param name="emergencyEvent" type="Common.EmergencyEvent" mandatory="true">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- </function>
- <function name="GetClusterModeStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetClusterModeStatus" messagetype="response">
- <param name="clusterModeStatus" type="Common.ClusterModeStatus" mandatory="true">
- <description>The status modes of the cluster</description>
- </param>
- </function>
- <function name="GetMyKey" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetMyKey" messagetype="response">
- <param name="myKey" type="Common.MyKey" mandatory="true">
- <description>Information related to the MyKey feature</description>
- </param>
- </function>
- <!--end Qt HMI version of GetVehicleData-->
- <!--Qt HMI version of OnVehicleData-->
- <function name="OnGpsData" messagetype="notification" provider="hmi">
- <param name="gps" type="Common.GPSData" mandatory="true">
- <description>See GPSData</description>
- </param>
- </function>
- <function name="OnSpeed" messagetype="notification" provider="hmi">
- <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="true">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- </function>
- <function name="OnRpm" messagetype="notification" provider="hmi">
- <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="true">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- </function>
- <function name="OnFuelLevel" messagetype="notification" provider="hmi">
- <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="true">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- </function>
- <function name="OnFuelLevelState" messagetype="notification" provider="hmi">
- <param name="fuelLevel_State" type="Common.ComponentVolumeStatus" mandatory="true">
- <description>The fuel level state</description>
- </param>
- </function>
- <function name="OnInstantFuelConsumption" messagetype="notification" provider="hmi">
- <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="true">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- </function>
- <function name="OnExternalTemperature" messagetype="notification" provider="hmi">
- <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="true">
- <description>The external temperature in degrees celsius</description>
- </param>
- </function>
- <function name="OnVin" messagetype="notification" provider="hmi">
- <param name="vin" type="String" maxlength="17" mandatory="true">
- <description>Vehicle identification number.</description>
- </param>
- </function>
- <function name="OnPrndl" messagetype="notification" provider="hmi">
- <param name="prndl" type="Common.PRNDL" mandatory="true">
- <description>See PRNDL</description>
- </param>
- </function>
- <function name="OnTirePressure" messagetype="notification" provider="hmi">
- <param name="tirePressure" type="Common.TireStatus" mandatory="true">
- <description>See TireStatus</description>
- </param>
- </function>
- <function name="OnOdometer" messagetype="notification" provider="hmi">
- <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="true">
- <description>Odometer in km</description>
- </param>
- </function>
- <function name="OnBeltStatus" messagetype="notification" provider="hmi">
- <param name="beltStatus" type="Common.BeltStatus" mandatory="true">
- <description>The status of the seat belts</description>
- </param>
- </function>
- <function name="OnBodyInformation" messagetype="notification" provider="hmi">
- <param name="bodyInformation" type="Common.BodyInformation" mandatory="true">
- <description>The body information including power modes</description>
- </param>
- </function>
- <function name="OnDeviceStatus" messagetype="notification" provider="hmi">
- <param name="deviceStatus" type="Common.DeviceStatus" mandatory="true">
- <description>The device status including signal and battery strength</description>
- </param>
- </function>
- <function name="OnDriverBraking" messagetype="notification" provider="hmi">
- <param name="driverBraking" type="Common.VehicleDataEventStatus" mandatory="true">
- <description>The status of the brake pedal</description>
- </param>
- </function>
- <function name="OnWiperStatus" messagetype="notification" provider="hmi">
- <param name="wiperStatus" type="Common.WiperStatus" mandatory="true">
- <description>The status of the wipers</description>
- </param>
- </function>
- <function name="OnHeadLampStatus" messagetype="notification" provider="hmi">
- <param name="headLampStatus" type="Common.HeadLampStatus" mandatory="true">
- <description>Status of the head lamps</description>
- </param>
- </function>
- <function name="OnEngineTorque" messagetype="notification" provider="hmi">
- <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="true">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- </function>
- <function name="OnAccPedalPosition" messagetype="notification" provider="hmi">
- <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="true">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- </function>
- <function name="OnSteeringWheelAngle" messagetype="notification" provider="hmi">
- <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="true">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- </function>
- <function name="OnECallInfo" messagetype="notification" provider="hmi">
- <param name="eCallInfo" type="Common.ECallInfo" mandatory="true">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- </function>
- <function name="OnAirbagStatus" messagetype="notification" provider="hmi">
- <param name="airbagStatus" type="Common.AirbagStatus" mandatory="true">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- </function>
- <function name="OnEmergencyEvent" messagetype="notification" provider="hmi">
- <param name="emergencyEvent" type="Common.EmergencyEvent" mandatory="true">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- </function>
- <function name="OnClusterModeStatus" messagetype="notification" provider="hmi">
- <param name="clusterModeStatus" type="Common.ClusterModeStatus" mandatory="true">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- </function>
- <function name="OnMyKey" messagetype="notification" provider="hmi">
- <param name="myKey" type="Common.MyKey" mandatory="true">
- <description>Information related to the MyKey feature</description>
- </param>
- </function>
- <!--end Qt HMI version of OnVehicleData-->
- <!--Qt HMI version of SubscribeVehicleData/UnsubscribeVehicleData-->
- <function name="SubscribeGps" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeGps" messagetype="response">
- <param name="gps" type="Common.VehicleDataResult" mandatory="true">
- <description>See GPSData</description>
- </param>
- </function>
- <function name="UnsubscribeGps" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeGps" messagetype="response">
- <param name="gps" type="Common.VehicleDataResult" mandatory="true">
- <description>See GPSData</description>
- </param>
- </function>
- <function name="SubscribeSpeed" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeSpeed" messagetype="response">
- <param name="speed" type="Common.VehicleDataResult" mandatory="true">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- </function>
- <function name="UnsubscribeSpeed" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeSpeed" messagetype="response">
- <param name="speed" type="Common.VehicleDataResult" mandatory="true">
- <description>The vehicle speed in kilometers per hour</description>
- </param>
- </function>
- <function name="SubscribeRpm" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeRpm" messagetype="response">
- <param name="rpm" type="Common.VehicleDataResult" mandatory="true">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- </function>
- <function name="UnsubscribeRpm" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeRpm" messagetype="response">
- <param name="rpm" type="Common.VehicleDataResult" mandatory="true">
- <description>The number of revolutions per minute of the engine</description>
- </param>
- </function>
- <function name="SubscribeFuelLevel" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeFuelLevel" messagetype="response">
- <param name="fuelLevel" type="Common.VehicleDataResult" mandatory="true">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- </function>
- <function name="UnsubscribeFuelLevel" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeFuelLevel" messagetype="response">
- <param name="fuelLevel" type="Common.VehicleDataResult" mandatory="true">
- <description>The fuel level in the tank (percentage)</description>
- </param>
- </function>
- <function name="SubscribeFuelLevel_State" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeFuelLevel_State" messagetype="response">
- <param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="true">
- <description>The fuel level state</description>
- </param>
- </function>
- <function name="UnsubscribeFuelLevel_State" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeFuelLevel_State" messagetype="response">
- <param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="true">
- <description>The fuel level state</description>
- </param>
- </function>
- <function name="SubscribeInstantFuelConsumption" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeInstantFuelConsumption" messagetype="response">
- <param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="true">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- </function>
- <function name="UnsubscribeInstantFuelConsumption" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeInstantFuelConsumption" messagetype="response">
- <param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="true">
- <description>The instantaneous fuel consumption in microlitres</description>
- </param>
- </function>
- <function name="SubscribeExternalTemperature" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeExternalTemperature" messagetype="response">
- <param name="externalTemperature" type="Common.VehicleDataResult" mandatory="true">
- <description>The external temperature in degrees celsius</description>
- </param>
- </function>
- <function name="UnsubscribeExternalTemperature" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeExternalTemperature" messagetype="response">
- <param name="externalTemperature" type="Common.VehicleDataResult" mandatory="true">
- <description>The external temperature in degrees celsius</description>
- </param>
- </function>
- <function name="SubscribePrndl" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribePrndl" messagetype="response">
- <param name="prndl" type="Common.VehicleDataResult" mandatory="true">
- <description>See PRNDL</description>
- </param>
- </function>
- <function name="UnsubscribePrndl" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribePrndl" messagetype="response">
- <param name="prndl" type="Common.VehicleDataResult" mandatory="true">
- <description>See PRNDL</description>
- </param>
- </function>
- <function name="SubscribeVin" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeVin" messagetype="response">
- <param name="vin" type="String" maxlength="17" mandatory="true">
- <description>Vehicle identification number</description>
- </param>
- </function>
- <function name="UnsubscribeVin" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeVin" messagetype="response">
- <param name="vin" type="String" maxlength="17" mandatory="true">
- <description>Vehicle identification number</description>
- </param>
- </function>
- <function name="SubscribeTirePressure" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeTirePressure" messagetype="response">
- <param name="tirePressure" type="Common.VehicleDataResult" mandatory="true">
- <description>See TireStatus</description>
- </param>
- </function>
- <function name="UnsubscribeTirePressure" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeTirePressure" messagetype="response">
- <param name="tirePressure" type="Common.VehicleDataResult" mandatory="true">
- <description>See TireStatus</description>
- </param>
- </function>
- <function name="SubscribeOdometer" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeOdometer" messagetype="response">
- <param name="odometer" type="Common.VehicleDataResult" mandatory="true">
- <description>Odometer in km</description>
- </param>
- </function>
- <function name="UnsubscribeOdometer" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeOdometer" messagetype="response">
- <param name="odometer" type="Common.VehicleDataResult" mandatory="true">
- <description>Odometer in km</description>
- </param>
- </function>
- <function name="SubscribeBeltStatus" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeBeltStatus" messagetype="response">
- <param name="beltStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the seat belts</description>
- </param>
- </function>
- <function name="UnsubscribeBeltStatus" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeBeltStatus" messagetype="response">
- <param name="beltStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the seat belts</description>
- </param>
- </function>
- <function name="SubscribeBodyInformation" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeBodyInformation" messagetype="response">
- <param name="bodyInformation" type="Common.VehicleDataResult" mandatory="true">
- <description>The body information including power modes</description>
- </param>
- </function>
- <function name="UnsubscribeBodyInformation" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeBodyInformation" messagetype="response">
- <param name="bodyInformation" type="Common.VehicleDataResult" mandatory="true">
- <description>The body information including power modes</description>
- </param>
- </function>
- <function name="SubscribeDeviceStatus" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeDeviceStatus" messagetype="response">
- <param name="deviceStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The device status including signal and battery strength</description>
- </param>
- </function>
- <function name="UnsubscribeDeviceStatus" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeDeviceStatus" messagetype="response">
- <param name="deviceStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The device status including signal and battery strength</description>
- </param>
- </function>
- <function name="SubscribeDriverBraking" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeDriverBraking" messagetype="response">
- <param name="driverBraking" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the brake pedal</description>
- </param>
- </function>
- <function name="UnsubscribeDriverBraking" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeDriverBraking" messagetype="response">
- <param name="driverBraking" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the brake pedal</description>
- </param>
- </function>
- <function name="SubscribeWiperStatus" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeWiperStatus" messagetype="response">
- <param name="wiperStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the wipers</description>
- </param>
- </function>
- <function name="UnsubscribeWiperStatus" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeWiperStatus" messagetype="response">
- <param name="wiperStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the wipers</description>
- </param>
- </function>
- <function name="SubscribeHeadLampStatus" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeHeadLampStatus" messagetype="response">
- <param name="headLampStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>Status of the head lamps</description>
- </param>
- </function>
- <function name="UnsubscribeHeadLampStatus" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeHeadLampStatus" messagetype="response">
- <param name="headLampStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>Status of the head lamps</description>
- </param>
- </function>
- <function name="SubscribeEngineTorque" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeEngineTorque" messagetype="response">
- <param name="engineTorque" type="Common.VehicleDataResult" mandatory="true">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- </function>
- <function name="UnsubscribeEngineTorque" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeEngineTorque" messagetype="response">
- <param name="engineTorque" type="Common.VehicleDataResult" mandatory="true">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
- </param>
- </function>
- <function name="SubscribeAccPedalPosition" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeAccPedalPosition" messagetype="response">
- <param name="accPedalPosition" type="Common.VehicleDataResult" mandatory="true">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- </function>
- <function name="UnsubscribeAccPedalPosition" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeAccPedalPosition" messagetype="response">
- <param name="accPedalPosition" type="Common.VehicleDataResult" mandatory="true">
- <description>Accelerator pedal position (percentage depressed)</description>
- </param>
- </function>
- <function name="SubscribeSteeringWheelAngle" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeSteeringWheelAngle" messagetype="response">
- <param name="steeringWheelAngle" type="Common.VehicleDataResult" mandatory="true">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- </function>
- <function name="UnsubscribeSteeringWheelAngle" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeSteeringWheelAngle" messagetype="response">
- <param name="steeringWheelAngle" type="Common.VehicleDataResult" mandatory="true">
- <description>Current angle of the steering wheel (in deg)</description>
- </param>
- </function>
- <function name="SubscribeECallInfo" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeECallInfo" messagetype="response">
- <param name="eCallInfo" type="Common.VehicleDataResult" mandatory="true">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- </function>
- <function name="UnsubscribeECallInfo" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeECallInfo" messagetype="response">
- <param name="eCallInfo" type="Common.VehicleDataResult" mandatory="true">
- <description>Emergency Call notification and confirmation data</description>
- </param>
- </function>
- <function name="SubscribeAirbagStatus" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeAirbagStatus" messagetype="response">
- <param name="airbagStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the air bags</description>
- </param>
- </function>
- <function name="UnsubscribeAirbagStatus" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeAirbagStatus" messagetype="response">
- <param name="airbagStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the air bags</description>
- </param>
- </function>
- <function name="SubscribeEmergencyEvent" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeEmergencyEvent" messagetype="response">
- <param name="emergencyEvent" type="Common.VehicleDataResult" mandatory="true">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- </function>
- <function name="UnsubscribeEmergencyEvent" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeEmergencyEvent" messagetype="response">
- <param name="emergencyEvent" type="Common.VehicleDataResult" mandatory="true">
- <description>Information related to an emergency event (and if it occurred)</description>
- </param>
- </function>
- <function name="SubscribeClusterModeStatus" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeClusterModeStatus" messagetype="response">
- <param name="clusterModeStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status modes of the cluster</description>
- </param>
- </function>
- <function name="UnsubscribeClusterModeStatus" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeClusterModeStatus" messagetype="response">
- <param name="clusterModeStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status modes of the cluster</description>
- </param>
- </function>
- <function name="SubscribeMyKey" messagetype="request" provider="hmi">
- </function>
- <function name="SubscribeMyKey" messagetype="response">
- <param name="myKey" type="Common.VehicleDataResult" mandatory="true">
- <description>Information related to the MyKey feature</description>
- </param>
- </function>
- <function name="UnsubscribeMyKey" messagetype="request" provider="hmi">
- </function>
- <function name="UnsubscribeMyKey" messagetype="response">
- <param name="myKey" type="Common.VehicleDataResult" mandatory="true">
- <description>Information related to the MyKey feature</description>
- </param>
- </function>
- <!--end Qt HMI version of SubscribeVehicleData/UnsubscribeVehicleData-->
- </interface>
- <!-- Policies -->
- <interface name="SDL" version="1.0" date="2014-03-12">
- <function name="ActivateApp" messagetype="request" provider="sdl">
- <param name="appID" type="Integer" mandatory="true">
- </param>
- </function>
- <function name="ActivateApp" messagetype="response">
- <param name="isSDLAllowed" type="Boolean" mandatory="true" scope="internal"/>
- <param name="device" type="Common.DeviceInfo" mandatory="false" scope="internal">
- <description>If isSDLAllowed is false, consent for sending PT through specified device is required.</description>
- </param>
- <param name="isPermissionsConsentNeeded" type="Boolean" mandatory="true"/>
- <param name="isAppPermissionsRevoked" type="Boolean" mandatory="true"/>
- <param name="appRevokedPermissions" type="Common.PermissionItem" array="true" minsize="1" maxsize="100" mandatory="false">
- <description>If app permissions were reduced (isAppPermissionsRevoked == true), then this array specifies list of removed permissions. </description>
- </param>
- <param name="isAppRevoked" type="Boolean" mandatory="true"/>
- <param name="priority" type="Common.AppPriority" mandatory="false">
- <description>Send to HMI so that it can coordinate order of requests/notifications correspondingly.</description>
- </param>
- </function>
- <function name="GetUserFriendlyMessage" messagetype="request" scope="internal" provider="sdl">
- <description>Request from HMI to SDL to get user friendly messages for UI/TTS info boxes/texts (i.e. for help/dialogs etc) from Policy Table.</description>
- <param name="messageCodes" type="String" array="true" minsize="1" maxsize="100" maxlength="500" mandatory="true">
- <description>Id of message to be received according to Policy Table i.e. StatusNeeded, Notifications, DrivingCharacteristics etc.</description>
- </param>
- <param name="language" type="Common.Language" mandatory="false">
- <description>Optional parameter if HMI wants message in some other language then its current one already known to SDL.</description>
- </param>
- </function>
- <function name="GetUserFriendlyMessage" messagetype="response">
- <param name="messages" type="Common.UserFriendlyMessage" array="true" minsize="1" maxsize="100" mandatory="false">
- <description>If no message was found in PT for specified message code and for HMI current or specified language, this parameter will be omitted.</description>
- </param>
- </function>
- <function name="OnAllowSDLFunctionality" messagetype="notification" provider="hmi">
- <description>Initiated by HMI. Notifies about user/HMI allowing SDL functionality or disallowing access to all mobile apps. Needed if HMI has additional ways of asking user about this (i.e. Settings etc)</description>
- <param name="device" type="Common.DeviceInfo" mandatory="false">
- <description>If no device is specified permission counts for SDL functionality in general.</description>
- </param>
- <param name="allowed" type="Boolean" mandatory="true">
- <description>Must be true if allowed</description>
- </param>
- <param name="source" type="Common.ConsentSource" mandatory="true"/>
- </function>
- <!-- SyncP RPC-->
- <function name="OnReceivedPolicyUpdate" messagetype="notification" provider="hmi">
- <description>
- From: SYNCP Manager
- To: SDL
- Notification sent to SDL when SYNCP Manager receives and decrypts updated policy table
- </description>
- <param name="policyfile" type="String" minlength="1" maxlength="255" mandatory="true">
- <description>Location of decrypted policy table Json file on target</description>
- </param>
- </function>
- <function name="OnPolicyUpdate" messagetype="notification" provider="hmi">
- <description>
- From: SYNCP Manager
- To: SDL
- Notifies SDL to supply a new "PolicyUpdate" request with more recent snapshot data
- </description>
- </function>
- <!-- End of SyncP RPC-->
- <function name="GetListOfPermissions" messagetype="request" provider="sdl">
- <description>Request from HMI to SDL to get list of permissions for app. If no app specified - list of permissions for all apps.</description>
- <param name="appID" type="Integer" mandatory="false"/>
- </function>
- <function name="GetListOfPermissions" messagetype="response">
- <param name="allowedFunctions" type="Common.PermissionItem" mandatory="true" array="true" minsize="0" maxsize="100">
- <description>If no permissions were specified for application the array will come empty.</description>
- </param>
- </function>
- <function name="OnAppPermissionConsent" messagetype="notification" provider="hmi">
- <description>Initiated by HMI for specifying the allowance for the application to perform some functionality. Duplicates functionality of the request, needed if HMI has specific ways to allow/disallow functionality (i.e.Setting Menu)</description>
- <param name="appID" type="Integer" mandatory="false">
- <description>Information about the application. See HMIApplication. If omitted - allow/disallow all applications </description>
- </param>
- <param name="consentedFunctions" type="Common.PermissionItem" mandatory="true" array="true" minsize="1" maxsize="100">
- </param>
- <param name="source" type="Common.ConsentSource" mandatory="true"/>
- </function>
- <function name="OnAppPermissionChanged" messagetype="notification" provider="sdl">
- <description>Notification from SDL to HMI. Occurs when app permissions were reduced. If no permission specified means that app was dissallowed and has to be unregitstered.</description>
- <param name="appID" type="Integer" mandatory="true"/>
- <param name="isAppPermissionsRevoked" type="Boolean" mandatory="false"/>
- <param name="appRevokedPermissions" type="Common.PermissionItem" array="true" minsize="1" maxsize="100" mandatory="false">
- <description>If app permissions were reduced (isAppPermissionsRevoked == true), then this array specifies list of removed permissions. </description>
- </param>
- <param name="appRevoked" type="Boolean" mandatory="false">
- <description>If present then specified application was prohibited to used with Sync.</description>
- </param>
- <param name="appPermissionsConsentNeeded" type="Boolean" mandatory="false">
- <description>If present specifies that permissions were added to application that require User Consent, then HMI can send GetListOfPermissions request to obtain list of permissions.</description>
- </param>
- <param name="appUnauthorized" type="Boolean" mandatory="false">
- <description>When present and set to true (should be if present) then this means that application was not authorized (nickname check failed.)</description>
- </param>
- <param name="priority" type="Common.AppPriority" mandatory="false">
- <description>Send to HMI so that it can coordinate order of requests/notifications correspondingly.</description>
- </param>
- <param name="requestType" type="Common.RequestType" minsize="0" maxsize="100" array="true" mandatory="false">
- <description>The list of SystemRequest's RequestTypes allowed by policies for the named application (the app's SystemRequest sent with RequestType out of this list will get 'disallowed' response from SDL).
- If SDL sends an empty array - any RequestType is allowed for this app.
- If SDL omits this parameter - nothing is changed for RequestType in the policies
- </description>
- </param>
- </function>
- <function name="OnSDLConsentNeeded" messagetype="notification" provider="sdl">
- <description>Send from SDL to HMI to notify that data consent is needed for device either because PT update or Retry strategy.</description>
- <param name="device" type="Common.DeviceInfo" mandatory="true"/>
- </function>
- <function name="UpdateSDL" messagetype="request" provider="sdl">
- <description>Request from HMI to SDL to start update of Policy Table.</description>
- </function>
- <function name="UpdateSDL" messagetype="response">
- <description>Specify result: no update needed, update was successful/unsuccessful etc</description>
- <param name="result" type="Common.UpdateResult" mandatory="true"/>
- </function>
- <function name="GetStatusUpdate" messagetype="request" provider="sdl">
- <description>Request from HMI to SDL to find out current status of PT exchange process.</description>
- </function>
- <function name="GetStatusUpdate" messagetype="response">
- <param name="status" type="Common.UpdateResult" mandatory="true"/>
- </function>
- <function name="OnStatusUpdate" messagetype="notification" provider="sdl">
- <description>Notification from SDL to HMI when current status of PT exchange changed (i.e. it Succeded or Failed etc)</description>
- <param name="status" type="Common.UpdateResult" mandatory="true"/>
- </function>
- <function name="OnSystemError" messagetype="notification" provider="hmi">
- <param name="error" type="Common.SystemError" mandatory="true"/>
- </function>
- <function name="AddStatisticsInfo" messagetype="notification" provider="hmi">
- <description>Sent by system to record statiscs and error counts. Increases statistics specified by statisticType by one.</description>
- <param name="statisticType" type="Common.StatisticsType" mandatory="true"/>
- </function>
- <function name="GetURLS" messagetype="request" scope="internal" provider="sdl">
- <description>Sent by system to SDL to get list of URL for specified service type and optionally policy's application id.</description>
- <param name="service" type="Integer" minvalue="0" maxvalue="100" mandatory="true"/>
- </function>
- <function name="GetURLS" messagetype="response" scope="internal">
- <param name="urls" type="Common.ServiceInfo" array="true" mandatory="false" minsize="1" maxsize="100"/>
- </function>
- <function name="OnDeviceStateChanged" messagetype="notification" scope="internal" provider="hmi">
- <param name="deviceState" type="Common.DeviceState" mandatory="true"/>
- <param name="deviceInternalId" type="String" mandatory="true" minlength="0" maxlength="500"/>
- <param name="deviceId" type="Common.DeviceInfo" mandatory="false"/>
- </function>
- </interface>
-<interface name="RC" version="1.1.0" date="2017-07-18">
- <function name="IsReady" messagetype="request">
- <description>Method is invoked at system startup. Response should provide information about presence of any of remote controllable module and its readiness to cooperate with SDL.</description>
- </function>
- <function name="IsReady" messagetype="response">
- <param name="available" type="Boolean" mandatory="true">
- <description>Must be true if vehicle RC modules are present and ready to communicate with SDL.</description>
- </param>
- </function>
-
- <function name="GetCapabilities" messagetype="request">
- <description>Method is invoked at system startup by SDL to request information about Remote Control capabilities of HMI.</description>
- </function>
- <function name="GetCapabilities" messagetype="response">
- <param name="remoteControlCapability" type="Common.RemoteControlCapabilities" mandatory="false">
- <description>See RemoteControlCapabilities, all available RC modules and buttons shall be returned.</description>
- </param>
- </function>
-
- <function name="SetInteriorVehicleData" functionID="SetInteriorVehicleDataID" messagetype="request">
- <param name="moduleData" type="Common.ModuleData" mandatory="true" >
- <description>The module type and data to set</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>Internal SDL-assigned ID of the related application</description>
- </param>
- </function>
-
- <function name="SetInteriorVehicleData" messagetype="response">
- <description>Used to set the values of one zone and one data type within that zone</description>
- <param name="moduleData" type="Common.ModuleData" mandatory="true" >
- </param>
- </function>
-
-<function name="GetInteriorVehicleData" messagetype="request">
- <param name="moduleType" type="Common.ModuleType" mandatory="true" >
- <description>The module data to retrieve from the vehicle for that type</description>
- </param>
- <param name="subscribe" type="Boolean" mandatory="false" defvalue="false">
- <description>If subscribe is true, the head unit will send onInteriorVehicleData notifications for the module type</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>Internal SDL-assigned ID of the related application</description>
- </param>
-</function>
-
-<function name="GetInteriorVehicleData" messagetype="response">
- <param name="moduleData" type="Common.ModuleData" mandatory="true" >
- </param>
- <param name="isSubscribed" type="Boolean" mandatory="false" >
- <description>Is a conditional-mandatory parameter: must be returned in case "subscribe" parameter was present in the related request.
- if "true" - the "moduleType" from request is successfully subscribed and the head unit will send onInteriorVehicleData notifications for the moduleDescription.
- if "false" - the "moduleType" from request is either unsubscribed or failed to subscribe.</description>
- </param>
-</function>
-
-<function name="GetInteriorVehicleDataConsent" messagetype="request">
- <description>Sender: SDL->HMI. </description>
- <description>HMI is expected to display a permission prompt to the driver showing the RC module and app details (for example, app's name).
- The driver is expected to have an ability to grant or deny the permission.</description>
- <param name="moduleType" type="Common.ModuleType" mandatory="true">
- <description>The module type that the app requests to control.</description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of the application that triggers the permission prompt.</description>
- </param>
- </function>
- <function name="GetInteriorVehicleDataConsent" messagetype="response">
- <param name="allowed" type="Boolean" mandatory="true">
- <description>"true" - if the driver grants the permission for controlling to the named app;
- "false" - in case the driver denies the permission for controlling to the named app.</description>
- </param>
-</function>
-
-<function name="OnInteriorVehicleData" messagetype="notification">
- <param name="moduleData" type="Common.ModuleData" mandatory="true" >
- </param>
-</function>
-
-<function name="OnRemoteControlSettings" messagetype="notification">
- <description>Sender: vehicle -> RSDL. Notification about remote-control settings changed. Sent after User`s choice through HMI.</description>
- <param name="allowed" type="Boolean" mandatory="false" >
- <description>If "true" - RC is allowed; if "false" - RC is disallowed.</description>
- </param>
- <param name="accessMode" type="Common.RCAccessMode" mandatory="false" >
- <description>The remote control access mode specified by the driver via HMI.</description>
- </param>
-</function>
-</interface>
-</interfaces> \ No newline at end of file
diff --git a/src/components/interfaces/v4_protocol_v1_2_no_extra.xsd b/src/components/interfaces/v4_protocol_v1_2_no_extra.xsd
new file mode 100644
index 0000000000..3da28ea238
--- /dev/null
+++ b/src/components/interfaces/v4_protocol_v1_2_no_extra.xsd
@@ -0,0 +1,83 @@
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="interface" type="interfaceType">
+ <xs:annotation>
+ <xs:documentation>edited with XMLSpy v2011 rel. 3 sp1 (x64) (http://www.altova.com) by Olesksandr Leshchenko (HP)</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:complexType name="elementType" mixed="true">
+ <xs:sequence>
+ <xs:element type="xs:string" name="description" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="xs:string" name="designdescription" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:string" name="internal_name" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="enumType">
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element type="xs:string" name="description"/>
+ <xs:element type="elementType" name="element"/>
+ <xs:element type="issueType" name="issue"/>
+ <xs:element type="paramType" name="param"/>
+ </xs:choice>
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:string" name="platform" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="issueType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute type="xs:string" name="creator" use="optional"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+ <xs:complexType name="paramType" mixed="true">
+ <xs:sequence>
+ <xs:element type="issueType" name="issue" minOccurs="0"/>
+ <xs:element type="xs:string" name="description" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="elementType" name="element" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="xs:string" name="todo" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:string" name="type" use="optional"/>
+ <xs:attribute type="xs:short" name="minvalue" use="optional"/>
+ <xs:attribute type="xs:int" name="maxvalue" use="optional"/>
+ <xs:attribute type="xs:string" name="mandatory" use="optional"/>
+ <xs:attribute type="xs:short" name="maxlength" use="optional"/>
+ <xs:attribute type="xs:byte" name="minsize" use="optional"/>
+ <xs:attribute type="xs:byte" name="maxsize" use="optional"/>
+ <xs:attribute type="xs:string" name="array" use="optional"/>
+ <xs:attribute type="xs:string" name="platform" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="structType">
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element type="xs:string" name="description" minOccurs="0"/>
+ <xs:element type="paramType" name="param"/>
+ <xs:element type="elementType" name="element"/>
+ <xs:element type="issueType" name="issue"/>
+ </xs:choice>
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:string" name="platform" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="functionType">
+ <xs:sequence>
+ <xs:element type="xs:string" name="description" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="paramType" name="param" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="issueType" name="issue" minOccurs="0"/>
+ </xs:sequence>
+ <xs:attribute type="xs:string" name="name" use="optional"/>
+ <xs:attribute type="xs:string" name="messagetype" use="optional"/>
+ </xs:complexType>
+ <xs:complexType name="interfaceType">
+ <xs:choice maxOccurs="unbounded" minOccurs="0">
+ <xs:element type="enumType" name="enum" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="structType" name="struct" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:element type="functionType" name="function" maxOccurs="unbounded" minOccurs="0">
+ <xs:annotation>
+ <xs:documentation>Requests/Responses Notifications</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:choice>
+ <xs:attribute type="xs:string" name="name"/>
+ <xs:attribute type="xs:float" name="version"/>
+ <xs:attribute type="xs:date" name="date"/>
+ </xs:complexType>
+</xs:schema> \ No newline at end of file
diff --git a/src/components/media_manager/CMakeLists.txt b/src/components/media_manager/CMakeLists.txt
index 9010d15dc0..50c9fce20a 100644
--- a/src/components/media_manager/CMakeLists.txt
+++ b/src/components/media_manager/CMakeLists.txt
@@ -50,6 +50,7 @@ include_directories(
${POLICY_PATH}/include/
${POLICY_GLOBAL_INCLUDE_PATH}/
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
@@ -64,6 +65,7 @@ set(EXCLUDE_PATHS
set(LIBRARIES
MOBILE_API
ProtocolLibrary
+ PolicyStatic
Utils
)
diff --git a/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h b/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h
index 54d898b7b2..cd594ee8b1 100644
--- a/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h
+++ b/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h
@@ -34,10 +34,10 @@
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_A2DP_SOURCE_PLAYER_ADAPTER_H_
#include <map>
-#include "protocol/common.h"
+#include "connection_handler/connection_handler_impl.h"
#include "media_manager/media_adapter_impl.h"
+#include "protocol/common.h"
#include "utils/threads/thread_delegate.h"
-#include "connection_handler/connection_handler_impl.h"
namespace protocol_handler {
class SessionObserver;
diff --git a/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h b/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h
index a246e468b7..cb0ea8aa11 100644
--- a/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h
+++ b/src/components/media_manager/include/media_manager/audio/audio_stream_sender_thread.h
@@ -34,11 +34,11 @@
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_AUDIO_STREAM_SENDER_THREAD_H_
#include <string>
-#include "utils/macro.h"
-#include "utils/threads/thread_delegate.h"
+#include "smart_objects/smart_object.h"
#include "utils/conditional_variable.h"
#include "utils/lock.h"
-#include "smart_objects/smart_object.h"
+#include "utils/macro.h"
+#include "utils/threads/thread_delegate.h"
namespace application_manager {
class ApplicationManager;
diff --git a/src/components/media_manager/include/media_manager/audio/from_mic_recorder_listener.h b/src/components/media_manager/include/media_manager/audio/from_mic_recorder_listener.h
index c615195f94..643657951b 100644
--- a/src/components/media_manager/include/media_manager/audio/from_mic_recorder_listener.h
+++ b/src/components/media_manager/include/media_manager/audio/from_mic_recorder_listener.h
@@ -35,6 +35,7 @@
#include <string>
#include "media_manager/media_adapter_listener.h"
+#include "utils/macro.h"
namespace application_manager {
class ApplicationManager;
diff --git a/src/components/media_manager/include/media_manager/audio/from_mic_to_file_recorder_thread.h b/src/components/media_manager/include/media_manager/audio/from_mic_to_file_recorder_thread.h
index ded709b1fa..e6b54cc487 100644
--- a/src/components/media_manager/include/media_manager/audio/from_mic_to_file_recorder_thread.h
+++ b/src/components/media_manager/include/media_manager/audio/from_mic_to_file_recorder_thread.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_FROM_MIC_TO_FILE_RECORDER_THREAD_H_
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_FROM_MIC_TO_FILE_RECORDER_THREAD_H_
-#include <net/if.h>
#include <gst/gst.h>
+#include <net/if.h>
#include <string>
#include "utils/lock.h"
diff --git a/src/components/media_manager/include/media_manager/file_streamer_adapter.h b/src/components/media_manager/include/media_manager/file_streamer_adapter.h
index c4c91a98d8..a11b05b2ee 100644
--- a/src/components/media_manager/include/media_manager/file_streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/file_streamer_adapter.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_FILE_STREAMER_ADAPTER_H_
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_FILE_STREAMER_ADAPTER_H_
-#include <string>
#include <fstream>
+#include <string>
#include "media_manager/streamer_adapter.h"
#include "utils/threads/thread_delegate.h"
diff --git a/src/components/media_manager/include/media_manager/media_adapter_impl.h b/src/components/media_manager/include/media_manager/media_adapter_impl.h
index 75c48c98b7..37401f9c2b 100644
--- a/src/components/media_manager/include/media_manager/media_adapter_impl.h
+++ b/src/components/media_manager/include/media_manager/media_adapter_impl.h
@@ -40,7 +40,7 @@
namespace media_manager {
-typedef utils::SharedPtr<MediaAdapterListener> MediaListenerPtr;
+typedef std::shared_ptr<MediaAdapterListener> MediaListenerPtr;
class MediaAdapterImpl : public MediaAdapter {
public:
@@ -57,7 +57,7 @@ class MediaAdapterImpl : public MediaAdapter {
DISALLOW_COPY_AND_ASSIGN(MediaAdapterImpl);
};
-typedef utils::SharedPtr<MediaAdapterImpl> MediaAdapterImplPtr;
+typedef std::shared_ptr<MediaAdapterImpl> MediaAdapterImplPtr;
} // namespace media_manager
diff --git a/src/components/media_manager/include/media_manager/media_manager_impl.h b/src/components/media_manager/include/media_manager/media_manager_impl.h
index 7fbd4f2f6f..408fa12655 100644
--- a/src/components/media_manager/include/media_manager/media_manager_impl.h
+++ b/src/components/media_manager/include/media_manager/media_manager_impl.h
@@ -33,13 +33,14 @@
#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_MANAGER_IMPL_H_
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_MANAGER_IMPL_H_
-#include <string>
+#include <chrono>
#include <map>
-#include "protocol_handler/protocol_observer.h"
-#include "protocol_handler/protocol_handler.h"
-#include "media_manager/media_manager.h"
+#include <string>
#include "media_manager/media_adapter_impl.h"
#include "media_manager/media_adapter_listener.h"
+#include "media_manager/media_manager.h"
+#include "protocol_handler/protocol_handler.h"
+#include "protocol_handler/protocol_observer.h"
namespace application_manager {
class ApplicationManager;
@@ -81,15 +82,17 @@ class MediaManagerImpl : public MediaManager,
virtual const MediaManagerSettings& settings() const OVERRIDE;
+ virtual uint32_t DataSizeToMilliseconds(uint64_t data_size) const OVERRIDE;
+
#ifdef BUILD_TESTS
void set_mock_a2dp_player(MediaAdapter* media_adapter);
void set_mock_mic_listener(MediaListenerPtr media_listener);
void set_mock_mic_recorder(MediaAdapterImpl* media_adapter);
void set_mock_streamer(protocol_handler::ServiceType stype,
- ::utils::SharedPtr<MediaAdapterImpl> mock_stream);
+ std::shared_ptr<MediaAdapterImpl> mock_stream);
void set_mock_streamer_listener(
protocol_handler::ServiceType stype,
- ::utils::SharedPtr<MediaAdapterListener> mock_stream);
+ std::shared_ptr<MediaAdapterListener> mock_stream);
#endif // BUILD_TESTS
protected:
@@ -106,6 +109,12 @@ class MediaManagerImpl : public MediaManager,
std::map<protocol_handler::ServiceType, MediaAdapterImplPtr> streamer_;
std::map<protocol_handler::ServiceType, MediaListenerPtr> streamer_listener_;
+ uint32_t bits_per_sample_;
+ uint32_t sampling_rate_;
+ uint64_t stream_data_size_;
+ std::chrono::time_point<std::chrono::system_clock>
+ socket_audio_stream_start_time_;
+
application_manager::ApplicationManager& application_manager_;
private:
diff --git a/src/components/media_manager/include/media_manager/streamer_adapter.h b/src/components/media_manager/include/media_manager/streamer_adapter.h
index 5ac8e05cac..a35e680b6a 100644
--- a/src/components/media_manager/include/media_manager/streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/streamer_adapter.h
@@ -33,13 +33,12 @@
#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_STREAMER_ADAPTER_H_
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_STREAMER_ADAPTER_H_
+#include <atomic>
#include "media_manager/media_adapter_impl.h"
+#include "protocol/raw_message.h"
#include "utils/message_queue.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
-#include "utils/atomic_object.h"
-#include "utils/shared_ptr.h"
-#include "protocol/raw_message.h"
namespace media_manager {
@@ -61,6 +60,7 @@ class StreamerAdapter : public MediaAdapterImpl {
virtual void SendData(int32_t application_key,
const ::protocol_handler::RawMessagePtr msg);
virtual bool is_app_performing_activity(int32_t application_key) const;
+ virtual size_t GetMsgQueueSize();
protected:
// TODO(AN): APPLINK-15203 Use MessageLoopThread
@@ -80,7 +80,7 @@ class StreamerAdapter : public MediaAdapterImpl {
virtual bool Send(protocol_handler::RawMessagePtr msg) = 0;
private:
- sync_primitives::atomic_bool stop_flag_;
+ std::atomic_bool stop_flag_;
StreamerAdapter* adapter_;
DISALLOW_COPY_AND_ASSIGN(Streamer);
@@ -96,7 +96,7 @@ class StreamerAdapter : public MediaAdapterImpl {
DISALLOW_COPY_AND_ASSIGN(StreamerAdapter);
};
-typedef utils::SharedPtr<StreamerAdapter> StreamerAdapterPtr;
+typedef std::shared_ptr<StreamerAdapter> StreamerAdapterPtr;
} // namespace media_manager
diff --git a/src/components/media_manager/include/media_manager/video/socket_video_streamer_adapter.h b/src/components/media_manager/include/media_manager/video/socket_video_streamer_adapter.h
index ad5739bd5f..d3d5111a60 100644
--- a/src/components/media_manager/include/media_manager/video/socket_video_streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/video/socket_video_streamer_adapter.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_SOCKET_VIDEO_STREAMER_ADAPTER_H_
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_SOCKET_VIDEO_STREAMER_ADAPTER_H_
-#include <string>
#include <stdint.h>
+#include <string>
#include "media_manager/socket_streamer_adapter.h"
diff --git a/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc b/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc
index 5e9d6ab0ba..581997f610 100644
--- a/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc
+++ b/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc
@@ -29,17 +29,17 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "media_manager/audio/a2dp_source_player_adapter.h"
#include <net/if.h>
-#include <pulse/simple.h>
#include <pulse/error.h>
+#include <pulse/simple.h>
#include <string.h>
#include <utility>
-#include "utils/threads/thread.h"
-#include "media_manager/audio/a2dp_source_player_adapter.h"
-#include "utils/lock.h"
-#include "utils/logger.h"
#include "connection_handler/connection_handler_impl.h"
#include "protocol_handler/session_observer.h"
+#include "utils/lock.h"
+#include "utils/logger.h"
+#include "utils/threads/thread.h"
namespace media_manager {
@@ -60,7 +60,7 @@ class A2DPSourcePlayerAdapter::A2DPSourcePlayerThread
// The Sample format to use
static const pa_sample_spec sSampleFormat_;
- pa_simple* s_in, *s_out;
+ pa_simple *s_in, *s_out;
std::string device_;
bool should_be_stopped_;
sync_primitives::Lock should_be_stopped_lock_;
@@ -85,34 +85,34 @@ A2DPSourcePlayerAdapter::~A2DPSourcePlayerAdapter() {
}
void A2DPSourcePlayerAdapter::StartActivity(int32_t application_key) {
- LOG4CXX_INFO(logger_,
- "Starting a2dp playing music for " << application_key
- << " application.");
+ LOG4CXX_INFO(
+ logger_,
+ "Starting a2dp playing music for " << application_key << " application.");
if (application_key != current_application_) {
current_application_ = application_key;
- uint32_t device_id = 0;
+ transport_manager::DeviceHandle device_id = 0;
session_observer_.GetDataOnSessionKey(application_key, 0, NULL, &device_id);
- std::string mac_adddress;
- session_observer_.GetDataOnDeviceID(device_id, NULL, NULL, &mac_adddress);
+ std::string mac_address;
+ session_observer_.GetDataOnDeviceID(device_id, NULL, NULL, &mac_address);
- // TODO(PK): Convert mac_adddress to the
+ // TODO(PK): Convert mac_address to the
// following format : "bluez_source.XX_XX_XX_XX_XX_XX" if needed
// before passing to the A2DPSourcePlayerThread constructor
A2DPSourcePlayerThread* delegate =
- new A2DPSourcePlayerAdapter::A2DPSourcePlayerThread(mac_adddress);
+ new A2DPSourcePlayerAdapter::A2DPSourcePlayerThread(mac_address);
threads::Thread* new_activity =
- threads::CreateThread(mac_adddress.c_str(), delegate);
+ threads::CreateThread(mac_address.c_str(), delegate);
sources_[application_key] = Pair(new_activity, delegate);
new_activity->start();
}
}
void A2DPSourcePlayerAdapter::StopActivity(int32_t application_key) {
- LOG4CXX_INFO(logger_,
- "Stopping 2dp playing for " << application_key
- << " application.");
+ LOG4CXX_INFO(
+ logger_,
+ "Stopping 2dp playing for " << application_key << " application.");
if (application_key != current_application_) {
return;
}
diff --git a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
index 1aacbe4c28..078841f2a4 100644
--- a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
+++ b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
@@ -35,20 +35,20 @@
#include <unistd.h>
#endif
-#include <string>
#include <string.h>
-#include "application_manager/application_manager.h"
+#include <string>
#include "application_manager/application_impl.h"
-#include "application_manager/rpc_service.h"
+#include "application_manager/application_manager.h"
#include "application_manager/commands/command.h"
-#include "smart_objects/smart_object.h"
+#include "application_manager/message.h"
+#include "application_manager/rpc_service.h"
+#include "application_manager/smart_object_keys.h"
#include "interfaces/MOBILE_API.h"
+#include "media_manager/audio/audio_stream_sender_thread.h"
+#include "media_manager/media_manager_settings.h"
+#include "smart_objects/smart_object.h"
#include "utils/file_system.h"
#include "utils/logger.h"
-#include "media_manager/media_manager_settings.h"
-#include "media_manager/audio/audio_stream_sender_thread.h"
-#include "application_manager/smart_object_keys.h"
-#include "application_manager/message.h"
namespace media_manager {
using sync_primitives::AutoLock;
@@ -61,6 +61,15 @@ const int32_t AudioStreamSenderThread::kAudioPassThruTimeout = 1000;
#endif
const uint32_t kMqueueMessageSize = 4095;
+// Size of RIFF header contained in a .wav file: 12 bytes for 'RIFF' chunk
+// descriptor, 24 bytes for 'fmt ' sub-chunk and 8 bytes for 'data' sub-chunk
+// header.
+// The correct format of audio stream for AudioPassThru feature is to include
+// only audio sample data. Since both pre-recorded file (audio.8bit.wav) and
+// GStreamer-generated file contain RIFF header, we will skip it when reading
+// the files.
+static const uint32_t kRIFFHeaderSize = 44;
+
CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
AudioStreamSenderThread::AudioStreamSenderThread(
@@ -69,7 +78,7 @@ AudioStreamSenderThread::AudioStreamSenderThread(
application_manager::ApplicationManager& app_mngr)
: session_key_(session_key)
, fileName_(fileName)
- , offset_(0)
+ , offset_(kRIFFHeaderSize)
, shouldBeStoped_(false)
, shouldBeStoped_lock_()
, shouldBeStoped_cv_()
@@ -82,7 +91,7 @@ AudioStreamSenderThread::~AudioStreamSenderThread() {}
void AudioStreamSenderThread::threadMain() {
LOG4CXX_AUTO_TRACE(logger_);
- offset_ = 0;
+ offset_ = kRIFFHeaderSize;
while (false == getShouldBeStopped()) {
AutoLock auto_lock(shouldBeStoped_lock_);
@@ -125,7 +134,7 @@ void AudioStreamSenderThread::sendAudioChunkToMobile() {
}
#if !defined(EXTENDED_MEDIA_MODE)
// without recording stream restart reading 1-sec file
- offset_ = 0;
+ offset_ = kRIFFHeaderSize;
#endif
}
@@ -145,7 +154,7 @@ void AudioStreamSenderThread::SendAudioPassThroughNotification(
data.binary_data = binary_data;
smart_objects::SmartObjectSPtr on_audio_pass =
- new smart_objects::SmartObject();
+ std::make_shared<smart_objects::SmartObject>();
if (!on_audio_pass) {
LOG4CXX_ERROR(logger_, "OnAudioPassThru NULL pointer");
diff --git a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
index d9735fcbbc..e55efed4ce 100644
--- a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
+++ b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
@@ -30,11 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "media_manager/audio/from_mic_recorder_adapter.h"
#include <string>
-#include "utils/threads/thread.h"
-#include "utils/logger.h"
#include "media_manager/audio/from_mic_to_file_recorder_thread.h"
-#include "media_manager/audio/from_mic_recorder_adapter.h"
+#include "utils/logger.h"
+#include "utils/threads/thread.h"
namespace media_manager {
diff --git a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
index 647db1e1a3..721229b250 100644
--- a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
+++ b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "utils/threads/thread.h"
-#include "utils/logger.h"
#include "media_manager/audio/from_mic_recorder_listener.h"
#include "media_manager/audio/audio_stream_sender_thread.h"
+#include "utils/logger.h"
+#include "utils/threads/thread.h"
namespace media_manager {
@@ -63,9 +63,9 @@ void FromMicRecorderListener::OnErrorReceived(int32_t application_key,
const DataForListener& data) {}
void FromMicRecorderListener::OnActivityStarted(int32_t application_key) {
- LOG4CXX_INFO(logger_,
- "FromMicRecorderListener::OnActivityStarted "
- << application_key);
+ LOG4CXX_INFO(
+ logger_,
+ "FromMicRecorderListener::OnActivityStarted " << application_key);
if (application_key == current_application_) {
return;
}
diff --git a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc
index 99548e71bd..a34bdd3f09 100644
--- a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc
+++ b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc
@@ -42,6 +42,9 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
GMainLoop* FromMicToFileRecorderThread::loop = NULL;
+// As per spec, AudioPassThru recording is in monaural
+static const int kNumAudioChannels = 1;
+
FromMicToFileRecorderThread::FromMicToFileRecorderThread(
const std::string& output_file, int32_t duration)
: threads::ThreadDelegate()
@@ -81,7 +84,7 @@ void FromMicToFileRecorderThread::set_record_duration(int32_t duration) {
void FromMicToFileRecorderThread::initArgs() {
LOG4CXX_AUTO_TRACE(logger_);
- argv_ = new gchar* [argc_];
+ argv_ = new gchar*[argc_];
argv_[0] = new gchar[14];
argv_[1] = new gchar[3];
@@ -119,7 +122,8 @@ void FromMicToFileRecorderThread::threadMain() {
initArgs();
GstElement* pipeline;
- GstElement* alsasrc, *wavenc, *filesink;
+ GstElement *alsasrc, *audioconvert, *capsfilter, *wavenc, *filesink;
+ GstCaps* audiocaps;
GstBus* bus;
const gchar* device = "hw:0,0";
@@ -151,7 +155,7 @@ void FromMicToFileRecorderThread::threadMain() {
{NULL}};
// g_option_context_parse() modifies params, so keep argc_ and argv_
int32_t argc = argc_;
- gchar** argv = new gchar* [argc];
+ gchar** argv = new gchar*[argc];
for (int32_t i = 0; i < argc; i++) {
argv[i] = argv_[i];
}
@@ -196,11 +200,18 @@ void FromMicToFileRecorderThread::threadMain() {
// Create all of the elements to be added to the pipeline
alsasrc = gst_element_factory_make("alsasrc", "alsasrc0");
+ audioconvert = gst_element_factory_make("audioconvert", "audioconvert0");
+ capsfilter = gst_element_factory_make("capsfilter", "filter0");
wavenc = gst_element_factory_make("wavenc", "wavenc0");
filesink = gst_element_factory_make("filesink", "filesink0");
+ // create a capability to downmix the recorded audio to monaural
+ audiocaps = gst_caps_new_simple(
+ "audio/x-raw", "channels", G_TYPE_INT, kNumAudioChannels, NULL);
+
// Assert that all the elements were created
- if (!alsasrc || !wavenc || !filesink) {
+ if (!alsasrc || !audioconvert || !capsfilter || !wavenc || !filesink ||
+ !audiocaps) {
g_error("Failed creating one or more of the pipeline elements.\n");
}
@@ -209,10 +220,21 @@ void FromMicToFileRecorderThread::threadMain() {
g_object_set(G_OBJECT(filesink), "location", outfile, NULL);
// Add the elements to the pipeline
- gst_bin_add_many(GST_BIN(pipeline), alsasrc, wavenc, filesink, NULL);
+ gst_bin_add_many(GST_BIN(pipeline),
+ alsasrc,
+ audioconvert,
+ capsfilter,
+ wavenc,
+ filesink,
+ NULL);
// Link the elements
- gst_element_link_many(alsasrc, wavenc, filesink, NULL);
+ gst_element_link_many(
+ alsasrc, audioconvert, capsfilter, wavenc, filesink, NULL);
+
+ // set the capability
+ g_object_set(G_OBJECT(capsfilter), "caps", audiocaps, NULL);
+ gst_caps_unref(audiocaps);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
diff --git a/src/components/media_manager/src/audio/socket_audio_streamer_adapter.cc b/src/components/media_manager/src/audio/socket_audio_streamer_adapter.cc
index 429fab01b3..373d92cdde 100644
--- a/src/components/media_manager/src/audio/socket_audio_streamer_adapter.cc
+++ b/src/components/media_manager/src/audio/socket_audio_streamer_adapter.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include "media_manager/audio/socket_audio_streamer_adapter.h"
+#include <string>
namespace {
const std::string kHeader =
diff --git a/src/components/media_manager/src/file_streamer_adapter.cc b/src/components/media_manager/src/file_streamer_adapter.cc
index 3418f7d963..7761e13601 100644
--- a/src/components/media_manager/src/file_streamer_adapter.cc
+++ b/src/components/media_manager/src/file_streamer_adapter.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "utils/logger.h"
-#include "utils/file_system.h"
#include "media_manager/file_streamer_adapter.h"
+#include "utils/file_system.h"
+#include "utils/logger.h"
namespace media_manager {
diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc
index 6a9ded9029..b04381605d 100644
--- a/src/components/media_manager/src/media_manager_impl.cc
+++ b/src/components/media_manager/src/media_manager_impl.cc
@@ -31,27 +31,28 @@
*/
#include "media_manager/media_manager_impl.h"
-#include "media_manager/audio/from_mic_recorder_listener.h"
-#include "media_manager/streamer_listener.h"
-#include "application_manager/message_helper.h"
#include "application_manager/application.h"
-#include "application_manager/application_manager.h"
#include "application_manager/application_impl.h"
+#include "application_manager/application_manager.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "media_manager/audio/from_mic_recorder_listener.h"
+#include "media_manager/streamer_listener.h"
#include "protocol_handler/protocol_handler.h"
#include "utils/file_system.h"
-#include "utils/logger.h"
#include "utils/helpers.h"
+#include "utils/logger.h"
#if defined(EXTENDED_MEDIA_MODE)
#include "media_manager/audio/a2dp_source_player_adapter.h"
#include "media_manager/audio/from_mic_recorder_adapter.h"
#endif
-#include "media_manager/video/socket_video_streamer_adapter.h"
-#include "media_manager/audio/socket_audio_streamer_adapter.h"
-#include "media_manager/video/pipe_video_streamer_adapter.h"
-#include "media_manager/audio/pipe_audio_streamer_adapter.h"
-#include "media_manager/video/file_video_streamer_adapter.h"
#include "media_manager/audio/file_audio_streamer_adapter.h"
+#include "media_manager/audio/pipe_audio_streamer_adapter.h"
+#include "media_manager/audio/socket_audio_streamer_adapter.h"
#include "media_manager/media_manager_settings.h"
+#include "media_manager/video/file_video_streamer_adapter.h"
+#include "media_manager/video/pipe_video_streamer_adapter.h"
+#include "media_manager/video/socket_video_streamer_adapter.h"
namespace media_manager {
@@ -64,6 +65,9 @@ MediaManagerImpl::MediaManagerImpl(
, protocol_handler_(NULL)
, a2dp_player_(NULL)
, from_mic_recorder_(NULL)
+ , bits_per_sample_(16)
+ , sampling_rate_(16000)
+ , stream_data_size_(0ull)
, application_manager_(application_manager) {
Init();
}
@@ -98,13 +102,13 @@ void MediaManagerImpl::set_mock_mic_recorder(MediaAdapterImpl* media_adapter) {
void MediaManagerImpl::set_mock_streamer(
protocol_handler::ServiceType stype,
- ::utils::SharedPtr<MediaAdapterImpl> mock_stream) {
+ std::shared_ptr<MediaAdapterImpl> mock_stream) {
streamer_[stype] = mock_stream;
}
void MediaManagerImpl::set_mock_streamer_listener(
protocol_handler::ServiceType stype,
- ::utils::SharedPtr<MediaAdapterListener> mock_stream) {
+ std::shared_ptr<MediaAdapterListener> mock_stream) {
streamer_listener_[stype] = mock_stream;
}
@@ -120,29 +124,36 @@ void MediaManagerImpl::Init() {
#endif
if ("socket" == settings().video_server_type()) {
- streamer_[ServiceType::kMobileNav] = new SocketVideoStreamerAdapter(
- settings().server_address(), settings().video_streaming_port());
+ streamer_[ServiceType::kMobileNav] =
+ std::make_shared<SocketVideoStreamerAdapter>(
+ settings().server_address(), settings().video_streaming_port());
} else if ("pipe" == settings().video_server_type()) {
- streamer_[ServiceType::kMobileNav] = new PipeVideoStreamerAdapter(
- settings().named_video_pipe_path(), settings().app_storage_folder());
+ streamer_[ServiceType::kMobileNav] =
+ std::make_shared<PipeVideoStreamerAdapter>(
+ settings().named_video_pipe_path(),
+ settings().app_storage_folder());
} else if ("file" == settings().video_server_type()) {
- streamer_[ServiceType::kMobileNav] = new FileVideoStreamerAdapter(
- settings().video_stream_file(), settings().app_storage_folder());
+ streamer_[ServiceType::kMobileNav] =
+ std::make_shared<FileVideoStreamerAdapter>(
+ settings().video_stream_file(), settings().app_storage_folder());
}
if ("socket" == settings().audio_server_type()) {
- streamer_[ServiceType::kAudio] = new SocketAudioStreamerAdapter(
- settings().server_address(), settings().audio_streaming_port());
+ streamer_[ServiceType::kAudio] =
+ std::make_shared<SocketAudioStreamerAdapter>(
+ settings().server_address(), settings().audio_streaming_port());
} else if ("pipe" == settings().audio_server_type()) {
- streamer_[ServiceType::kAudio] = new PipeAudioStreamerAdapter(
+ streamer_[ServiceType::kAudio] = std::make_shared<PipeAudioStreamerAdapter>(
settings().named_audio_pipe_path(), settings().app_storage_folder());
} else if ("file" == settings().audio_server_type()) {
- streamer_[ServiceType::kAudio] = new FileAudioStreamerAdapter(
+ streamer_[ServiceType::kAudio] = std::make_shared<FileAudioStreamerAdapter>(
settings().audio_stream_file(), settings().app_storage_folder());
}
- streamer_listener_[ServiceType::kMobileNav] = new StreamerListener(*this);
- streamer_listener_[ServiceType::kAudio] = new StreamerListener(*this);
+ streamer_listener_[ServiceType::kMobileNav] =
+ std::make_shared<StreamerListener>(*this);
+ streamer_listener_[ServiceType::kAudio] =
+ std::make_shared<StreamerListener>(*this);
if (streamer_[ServiceType::kMobileNav]) {
streamer_[ServiceType::kMobileNav]->AddListener(
@@ -153,6 +164,23 @@ void MediaManagerImpl::Init() {
streamer_[ServiceType::kAudio]->AddListener(
streamer_listener_[ServiceType::kAudio]);
}
+
+ if (application_manager_.hmi_capabilities().pcm_stream_capabilities()) {
+ const auto pcm_caps =
+ application_manager_.hmi_capabilities().pcm_stream_capabilities();
+
+ if (pcm_caps->keyExists(application_manager::strings::bits_per_sample)) {
+ bits_per_sample_ =
+ pcm_caps->getElement(application_manager::strings::bits_per_sample)
+ .asUInt();
+ }
+
+ if (pcm_caps->keyExists(application_manager::strings::sampling_rate)) {
+ sampling_rate_ =
+ pcm_caps->getElement(application_manager::strings::sampling_rate)
+ .asUInt();
+ }
+ }
}
void MediaManagerImpl::PlayA2DPSource(int32_t application_key) {
@@ -187,8 +215,8 @@ void MediaManagerImpl::StartMicrophoneRecording(int32_t application_key,
std::string file_path = settings().app_storage_folder();
file_path += "/";
file_path += output_file;
- from_mic_listener_ =
- new FromMicRecorderListener(file_path, application_manager_);
+ from_mic_listener_ = std::make_shared<FromMicRecorderListener>(
+ file_path, application_manager_);
#ifdef EXTENDED_MEDIA_MODE
if (from_mic_recorder_) {
from_mic_recorder_->AddListener(from_mic_listener_);
@@ -213,9 +241,9 @@ void MediaManagerImpl::StartMicrophoneRecording(int32_t application_key,
std::vector<uint8_t> buf;
if (file_system::ReadBinaryFile(record_file_source, buf)) {
if (file_system::Write(file_path, buf)) {
- LOG4CXX_INFO(logger_,
- "File " << record_file_source << " copied to "
- << output_file);
+ LOG4CXX_INFO(
+ logger_,
+ "File " << record_file_source << " copied to " << output_file);
} else {
LOG4CXX_WARN(logger_, "Could not write to file " << output_file);
}
@@ -256,6 +284,8 @@ void MediaManagerImpl::StopStreaming(
int32_t application_key, protocol_handler::ServiceType service_type) {
LOG4CXX_AUTO_TRACE(logger_);
+ stream_data_size_ = 0ull;
+
if (streamer_[service_type]) {
streamer_[service_type]->StopActivity(application_key);
}
@@ -283,15 +313,35 @@ void MediaManagerImpl::OnMessageReceived(
}
if (!application_manager_.CanAppStream(streaming_app_id, service_type)) {
- application_manager_.ForbidStreaming(streaming_app_id);
+ application_manager_.ForbidStreaming(streaming_app_id, service_type);
LOG4CXX_ERROR(logger_,
- "The application trying to stream when it should not.");
+ "The application is trying to stream when it should not."
+ " service type: "
+ << service_type);
return;
}
ApplicationSharedPtr app = application_manager_.application(streaming_app_id);
if (app) {
- app->WakeUpStreaming(service_type);
+ if (ServiceType::kAudio == service_type &&
+ "socket" == settings().audio_server_type()) {
+ if (stream_data_size_ == 0) {
+ socket_audio_stream_start_time_ = std::chrono::system_clock::now();
+ }
+
+ stream_data_size_ += message->data_size();
+ uint32_t ms_for_all_data = DataSizeToMilliseconds(stream_data_size_);
+ uint32_t ms_since_stream_start =
+ std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::system_clock::now() -
+ socket_audio_stream_start_time_)
+ .count();
+ uint32_t ms_stream_remaining = ms_for_all_data - ms_since_stream_start;
+
+ app->WakeUpStreaming(service_type, ms_stream_remaining);
+ } else {
+ app->WakeUpStreaming(service_type);
+ }
streamer_[service_type]->SendData(streaming_app_id, message);
}
}
@@ -304,10 +354,46 @@ void MediaManagerImpl::FramesProcessed(int32_t application_key,
if (protocol_handler_) {
protocol_handler_->SendFramesNumber(application_key, frame_number);
}
+
+ application_manager::ApplicationSharedPtr app =
+ application_manager_.application(application_key);
+
+ if (app) {
+ auto audio_stream = std::dynamic_pointer_cast<StreamerAdapter>(
+ streamer_[protocol_handler::ServiceType::kAudio]);
+ auto video_stream = std::dynamic_pointer_cast<StreamerAdapter>(
+ streamer_[protocol_handler::ServiceType::kMobileNav]);
+
+ if (audio_stream.use_count() != 0 &&
+ "pipe" == settings().audio_server_type()) {
+ size_t audio_queue_size = audio_stream->GetMsgQueueSize();
+ LOG4CXX_DEBUG(logger_,
+ "# Messages in audio queue = " << audio_queue_size);
+ if (audio_queue_size > 0) {
+ app->WakeUpStreaming(protocol_handler::ServiceType::kAudio);
+ }
+ }
+
+ if (video_stream.use_count() != 0 &&
+ "pipe" == settings().video_server_type()) {
+ size_t video_queue_size = video_stream->GetMsgQueueSize();
+ LOG4CXX_DEBUG(logger_,
+ "# Messages in video queue = " << video_queue_size);
+ if (video_queue_size > 0) {
+ app->WakeUpStreaming(protocol_handler::ServiceType::kMobileNav);
+ }
+ }
+ }
}
const MediaManagerSettings& MediaManagerImpl::settings() const {
return settings_;
}
+uint32_t MediaManagerImpl::DataSizeToMilliseconds(uint64_t data_size) const {
+ constexpr uint16_t latency_compensation = 500;
+ return 1000 * data_size / (sampling_rate_ * bits_per_sample_ / 8) +
+ latency_compensation;
+}
+
} // namespace media_manager
diff --git a/src/components/media_manager/src/pipe_streamer_adapter.cc b/src/components/media_manager/src/pipe_streamer_adapter.cc
index 8bf14a546e..bda106721f 100644
--- a/src/components/media_manager/src/pipe_streamer_adapter.cc
+++ b/src/components/media_manager/src/pipe_streamer_adapter.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "media_manager/pipe_streamer_adapter.h"
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
-#include "utils/logger.h"
#include "utils/file_system.h"
-#include "media_manager/pipe_streamer_adapter.h"
+#include "utils/logger.h"
namespace media_manager {
@@ -82,15 +82,15 @@ PipeStreamerAdapter::PipeStreamer::~PipeStreamer() {
bool PipeStreamerAdapter::PipeStreamer::Connect() {
LOG4CXX_AUTO_TRACE(logger_);
- pipe_fd_ = open(named_pipe_path_.c_str(), O_RDWR, 0);
+ pipe_fd_ = open(named_pipe_path_.c_str(), O_RDWR | O_NONBLOCK, 0);
if (-1 == pipe_fd_) {
LOG4CXX_ERROR(logger_, "Cannot open pipe for writing " << named_pipe_path_);
return false;
}
- LOG4CXX_INFO(logger_,
- "Pipe " << named_pipe_path_
- << " was successfuly opened for writing");
+ LOG4CXX_INFO(
+ logger_,
+ "Pipe " << named_pipe_path_ << " was successfuly opened for writing");
return true;
}
@@ -106,16 +106,51 @@ void PipeStreamerAdapter::PipeStreamer::Disconnect() {
bool PipeStreamerAdapter::PipeStreamer::Send(
protocol_handler::RawMessagePtr msg) {
LOG4CXX_AUTO_TRACE(logger_);
- ssize_t ret = write(pipe_fd_, msg->data(), msg->data_size());
- if (-1 == ret) {
- LOG4CXX_ERROR(logger_, "Failed writing data to pipe " << named_pipe_path_);
- return false;
- }
-
- if (static_cast<uint32_t>(ret) != msg->data_size()) {
- LOG4CXX_WARN(logger_,
- "Couldn't write all the data to pipe " << named_pipe_path_);
- }
+ fd_set wfds;
+ FD_ZERO(&wfds);
+ FD_SET(pipe_fd_, &wfds);
+ struct timeval tv;
+ tv.tv_sec = 10;
+ tv.tv_usec = 0;
+ ssize_t write_ret = 0;
+ bool data_remaining = false;
+ do {
+ int select_ret = select(pipe_fd_ + 1, NULL, &wfds, NULL, &tv);
+ // Most likely pipe closed, fail stream
+ if (select_ret == -1) {
+ LOG4CXX_ERROR(logger_,
+ "Failed writing data to pipe "
+ << named_pipe_path_ << ". Errno: " << strerror(errno));
+ return false;
+ // Select success, attempt to write
+ } else if (select_ret) {
+ ssize_t temp_ret = write(
+ pipe_fd_, msg->data() + write_ret, msg->data_size() - write_ret);
+ if (-1 == temp_ret) {
+ LOG4CXX_ERROR(logger_,
+ "Failed writing data to pipe "
+ << named_pipe_path_
+ << ". Errno: " << strerror(errno));
+ return false;
+ }
+ write_ret += temp_ret;
+ // Select timed out, fail stream.
+ } else {
+ LOG4CXX_ERROR(logger_,
+ "Failed writing data to pipe " << named_pipe_path_
+ << ". Error: TIMEOUT");
+ return false;
+ }
+ // Check that all data was written to the pipe.
+ data_remaining = static_cast<uint32_t>(write_ret) != msg->data_size();
+ if (data_remaining) {
+ LOG4CXX_WARN(logger_,
+ "Couldn't write all the data to pipe "
+ << named_pipe_path_ << ". "
+ << msg->data_size() - write_ret << " bytes remaining");
+ }
+ // Loop to send remaining data if there is any.
+ } while (data_remaining);
LOG4CXX_INFO(logger_, "Streamer::sent " << msg->data_size());
return true;
diff --git a/src/components/media_manager/src/socket_streamer_adapter.cc b/src/components/media_manager/src/socket_streamer_adapter.cc
index 60b01c901b..624e388a0c 100644
--- a/src/components/media_manager/src/socket_streamer_adapter.cc
+++ b/src/components/media_manager/src/socket_streamer_adapter.cc
@@ -30,15 +30,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/select.h>
-#include <netinet/in.h>
+#include "media_manager/socket_streamer_adapter.h"
#include <arpa/inet.h>
#include <netdb.h>
+#include <netinet/in.h>
+#include <sys/select.h>
+#include <sys/socket.h>
+#include <sys/types.h>
#include <unistd.h>
#include "utils/logger.h"
-#include "media_manager/socket_streamer_adapter.h"
namespace media_manager {
diff --git a/src/components/media_manager/src/streamer_adapter.cc b/src/components/media_manager/src/streamer_adapter.cc
index 90a40b1add..3ef12e3ed5 100644
--- a/src/components/media_manager/src/streamer_adapter.cc
+++ b/src/components/media_manager/src/streamer_adapter.cc
@@ -48,8 +48,8 @@ StreamerAdapter::~StreamerAdapter() {
streamer_->Close();
}
thread_->join();
- threads::DeleteThread(thread_);
delete streamer_;
+ threads::DeleteThread(thread_);
}
void StreamerAdapter::StartActivity(int32_t application_key) {
@@ -74,6 +74,10 @@ void StreamerAdapter::StartActivity(int32_t application_key) {
current_application_ = application_key;
}
+size_t StreamerAdapter::GetMsgQueueSize() {
+ return messages_.size();
+}
+
void StreamerAdapter::StopActivity(int32_t application_key) {
LOG4CXX_AUTO_TRACE(logger);
if (!is_app_performing_activity(application_key)) {
diff --git a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
index f41954b117..d907211d16 100644
--- a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
+++ b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "utils/logger.h"
-#include "utils/file_system.h"
-#include "config_profile/profile.h"
#include "media_manager/video/video_stream_to_file_adapter.h"
+#include "config_profile/profile.h"
+#include "utils/file_system.h"
+#include "utils/logger.h"
namespace media_manager {
diff --git a/src/components/media_manager/test/CMakeLists.txt b/src/components/media_manager/test/CMakeLists.txt
index f5d596f681..265a62a0d8 100644
--- a/src/components/media_manager/test/CMakeLists.txt
+++ b/src/components/media_manager/test/CMakeLists.txt
@@ -58,7 +58,7 @@ set(LIBRARIES
connectionHandler
encryption
Resumption
- Policy
+ PolicyStatic
${SecurityManagerLibrary}
)
diff --git a/src/components/media_manager/test/include/media_manager/mock_media_adapter.h b/src/components/media_manager/test/include/media_manager/mock_media_adapter.h
index 908b371b26..78d44695e5 100644
--- a/src/components/media_manager/test/include/media_manager/mock_media_adapter.h
+++ b/src/components/media_manager/test/include/media_manager/mock_media_adapter.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_MEDIA_MANAGER_TEST_INCLUDE_MEDIA_MANAGER_MOCK_MEDIA_ADAPTER_H_
#include "gmock/gmock.h"
-#include "media_manager/media_manager.h"
#include "media_manager/media_adapter.h"
+#include "media_manager/media_manager.h"
namespace test {
namespace components {
diff --git a/src/components/media_manager/test/include/media_manager/mock_media_adapter_impl.h b/src/components/media_manager/test/include/media_manager/mock_media_adapter_impl.h
index 80b2ee3377..96499d9358 100644
--- a/src/components/media_manager/test/include/media_manager/mock_media_adapter_impl.h
+++ b/src/components/media_manager/test/include/media_manager/mock_media_adapter_impl.h
@@ -44,10 +44,9 @@ using namespace media_manager;
class MockMediaAdapterImpl : public ::media_manager::MediaAdapterImpl {
public:
- MOCK_METHOD1(AddListener,
- void(const utils::SharedPtr<MediaAdapterListener>&));
+ MOCK_METHOD1(AddListener, void(const std::shared_ptr<MediaAdapterListener>&));
MOCK_METHOD1(RemoveListener,
- void(const utils::SharedPtr<MediaAdapterListener>&));
+ void(const std::shared_ptr<MediaAdapterListener>&));
MOCK_METHOD2(SendData,
void(int32_t application_key,
const ::protocol_handler::RawMessagePtr message));
diff --git a/src/components/media_manager/test/media_manager_impl_test.cc b/src/components/media_manager/test/media_manager_impl_test.cc
index a9dc27d7a3..627e2f57ed 100644
--- a/src/components/media_manager/test/media_manager_impl_test.cc
+++ b/src/components/media_manager/test/media_manager_impl_test.cc
@@ -30,22 +30,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gmock/gmock.h"
#include "media_manager/media_manager_impl.h"
-#include "media_manager/mock_media_adapter.h"
-#include "media_manager/mock_media_adapter_impl.h"
-#include "media_manager/mock_media_adapter_listener.h"
-#include "media_manager/mock_media_manager_settings.h"
#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/message.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/state_controller.h"
-#include "protocol_handler/mock_protocol_handler.h"
+#include "gmock/gmock.h"
+#include "media_manager/mock_media_adapter.h"
+#include "media_manager/mock_media_adapter_impl.h"
+#include "media_manager/mock_media_adapter_listener.h"
+#include "media_manager/mock_media_manager_settings.h"
#include "protocol/common.h"
-#include "utils/make_shared.h"
-#include "utils/shared_ptr.h"
+#include "protocol_handler/mock_protocol_handler.h"
+
#include "utils/file_system.h"
#include "utils/scope_guard.h"
@@ -58,14 +58,14 @@ using namespace ::media_manager;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::utils::SharedPtr;
-using ::utils::ScopeGuard;
-using ::utils::MakeGuard;
-using ::testing::NiceMock;
-using ::protocol_handler::ServiceType;
-using ::protocol_handler::RawMessagePtr;
+
using application_manager::ApplicationSharedPtr;
using application_manager::BinaryData;
+using ::protocol_handler::RawMessagePtr;
+using ::protocol_handler::ServiceType;
+using ::testing::NiceMock;
+using ::utils::MakeGuard;
+using ::utils::ScopeGuard;
namespace {
const uint16_t kVideoStreamingPort = 8901u;
@@ -99,20 +99,22 @@ void dealloc_file(std::ofstream* test_file) {
} // namespace
typedef NiceMock<application_manager_test::MockApplication> MockApp;
-typedef SharedPtr<MockApp> MockAppPtr;
-typedef SharedPtr<MockMediaAdapterImpl> MockMediaAdapterImplPtr;
+typedef std::shared_ptr<MockApp> MockAppPtr;
+typedef std::shared_ptr<MockMediaAdapterImpl> MockMediaAdapterImplPtr;
class MediaManagerImplTest : public ::testing::Test {
public:
- // media_adapter_mock_ will be deleted in media_manager_impl (dtor)
- MediaManagerImplTest() : media_adapter_mock_(new MockMediaAdapter()) {
- media_adapter_listener_mock_ =
- utils::MakeShared<MockMediaAdapterListener>();
+ MediaManagerImplTest() {
+ media_adapter_listener_mock_ = std::make_shared<MockMediaAdapterListener>();
ON_CALL(mock_media_manager_settings_, video_server_type())
.WillByDefault(ReturnRef(kDefaultValue));
ON_CALL(mock_media_manager_settings_, audio_server_type())
.WillByDefault(ReturnRef(kDefaultValue));
- mock_app_ = ::utils::MakeShared<MockApp>();
+ ON_CALL(mock_hmi_capabilities_, pcm_stream_capabilities())
+ .WillByDefault(Return(nullptr));
+ ON_CALL(app_mngr_, hmi_capabilities())
+ .WillByDefault(ReturnRef(mock_hmi_capabilities_));
+ mock_app_ = std::make_shared<MockApp>();
media_manager_impl_.reset(
new MediaManagerImpl(app_mngr_, mock_media_manager_settings_));
}
@@ -179,9 +181,9 @@ class MediaManagerImplTest : public ::testing::Test {
.WillOnce(Return(true));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_app_, WakeUpStreaming(service_type));
+ EXPECT_CALL(*mock_app_, WakeUpStreaming(service_type, 0ull));
MockMediaAdapterImplPtr mock_media_streamer =
- utils::MakeShared<MockMediaAdapterImpl>();
+ std::make_shared<MockMediaAdapterImpl>();
media_manager_impl_->set_mock_streamer(service_type, mock_media_streamer);
media_manager_impl_->set_mock_streamer_listener(
service_type, media_adapter_listener_mock_);
@@ -197,6 +199,7 @@ class MediaManagerImplTest : public ::testing::Test {
kProtocolVersion,
data_sending,
data_sending_size,
+ false,
serviceType));
media_manager_impl_->OnMessageReceived(raw_message_ptr);
media_manager_impl_->OnMobileMessageSent(raw_message_ptr);
@@ -204,11 +207,11 @@ class MediaManagerImplTest : public ::testing::Test {
application_manager_test::MockApplicationManager app_mngr_;
MockAppPtr mock_app_;
- SharedPtr<MockMediaAdapterListener> media_adapter_listener_mock_;
- MockMediaAdapter* media_adapter_mock_;
+ std::shared_ptr<MockMediaAdapterListener> media_adapter_listener_mock_;
const ::testing::NiceMock<MockMediaManagerSettings>
mock_media_manager_settings_;
- SharedPtr<MediaManagerImpl> media_manager_impl_;
+ std::shared_ptr<MediaManagerImpl> media_manager_impl_;
+ application_manager_test::MockHMICapabilities mock_hmi_capabilities_;
};
TEST_F(MediaManagerImplTest,
@@ -243,7 +246,7 @@ TEST_F(MediaManagerImplTest,
const ServiceType audio_type = ServiceType::kAudio;
EXPECT_CALL(app_mngr_, CanAppStream(kConnectionKey, audio_type))
.WillOnce(Return(false));
- EXPECT_CALL(app_mngr_, ForbidStreaming(kConnectionKey));
+ EXPECT_CALL(app_mngr_, ForbidStreaming(kConnectionKey, audio_type));
EmulateMobileMessage(audio_type);
}
@@ -252,7 +255,7 @@ TEST_F(MediaManagerImplTest,
const ServiceType video_type = ServiceType::kMobileNav;
EXPECT_CALL(app_mngr_, CanAppStream(kConnectionKey, video_type))
.WillOnce(Return(false));
- EXPECT_CALL(app_mngr_, ForbidStreaming(kConnectionKey));
+ EXPECT_CALL(app_mngr_, ForbidStreaming(kConnectionKey, video_type));
EmulateMobileMessage(video_type);
}
@@ -277,14 +280,17 @@ TEST_F(MediaManagerImplTest, Init_Settings_ExpectFileValue) {
}
TEST_F(MediaManagerImplTest, PlayA2DPSource_WithCorrectA2DP_SUCCESS) {
- media_manager_impl_->set_mock_a2dp_player(media_adapter_mock_);
- EXPECT_CALL(*media_adapter_mock_, StartActivity(kApplicationKey));
+ // media_adapter_mock_ will be deleted in media_manager_impl (dtor)
+ MockMediaAdapter* media_adapter_mock = new MockMediaAdapter();
+ media_manager_impl_->set_mock_a2dp_player(media_adapter_mock);
+ EXPECT_CALL(*media_adapter_mock, StartActivity(kApplicationKey));
media_manager_impl_->PlayA2DPSource(kApplicationKey);
}
TEST_F(MediaManagerImplTest, StopA2DPSource_WithCorrectA2DP_SUCCESS) {
- media_manager_impl_->set_mock_a2dp_player(media_adapter_mock_);
- EXPECT_CALL(*media_adapter_mock_, StopActivity(kApplicationKey));
+ MockMediaAdapter* media_adapter_mock = new MockMediaAdapter();
+ media_manager_impl_->set_mock_a2dp_player(media_adapter_mock);
+ EXPECT_CALL(*media_adapter_mock, StopActivity(kApplicationKey));
media_manager_impl_->StopA2DPSource(kApplicationKey);
}
@@ -375,11 +381,11 @@ TEST_F(MediaManagerImplTest, StopMicrophoneRecording_SUCCESS) {
TEST_F(MediaManagerImplTest,
StartStopStreaming_AudioAndVideoServiceType_SUCCESS) {
MockMediaAdapterImplPtr mock_audio_media_streamer =
- utils::MakeShared<MockMediaAdapterImpl>();
+ std::make_shared<MockMediaAdapterImpl>();
media_manager_impl_->set_mock_streamer(ServiceType::kAudio,
mock_audio_media_streamer);
MockMediaAdapterImplPtr mock_nav_media_streamer =
- utils::MakeShared<MockMediaAdapterImpl>();
+ std::make_shared<MockMediaAdapterImpl>();
media_manager_impl_->set_mock_streamer(ServiceType::kMobileNav,
mock_nav_media_streamer);
@@ -404,6 +410,8 @@ TEST_F(MediaManagerImplTest,
const int32_t frame_number = 10;
EXPECT_CALL(mock_protocol_handler,
SendFramesNumber(kApplicationKey, frame_number));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
media_manager_impl_->FramesProcessed(kApplicationKey, frame_number);
}
diff --git a/src/components/policy/policy_external/.gitignore b/src/components/policy/policy_external/.gitignore
index d67909069a..d6052d61da 100644
--- a/src/components/policy/policy_external/.gitignore
+++ b/src/components/policy/policy_external/.gitignore
@@ -29,8 +29,6 @@ src/appMain/hmi_link
src/appMain/smartDeviceLinkCore
test/components/application_manager/policies_manager/test_policies_table
test/components/application_manager/test_formatters_commands
-test/components/dbus/test_DBusAdapter
-test/components/dbus/test_DBusSchema
test/components/protocol_handler/test_ProtocolHandler
test/components/request_watchdog/test_RequestWatchdog
test/components/smart_objects/SchemaItem/test_SmartObject_AlwaysFalseSchemaItemTest
diff --git a/src/components/policy/policy_external/CMakeLists.txt b/src/components/policy/policy_external/CMakeLists.txt
index c66313240f..361c48a598 100644
--- a/src/components/policy/policy_external/CMakeLists.txt
+++ b/src/components/policy/policy_external/CMakeLists.txt
@@ -28,20 +28,25 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/generators.cmake)
+
# --- Policy
-set(target Policy)
set(install_destination bin)
set(copy_destination ${CMAKE_BINARY_DIR}/src/appMain)
-set(library_name ${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX})
+set(library_name ${CMAKE_SHARED_LIBRARY_PREFIX}Policy${CMAKE_SHARED_LIBRARY_SUFFIX})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
include_directories (
- include
- ${COMPONENTS_DIR}/rpc_base/include
+ ${POLICY_PATH}/include/
+ ${COMPONENTS_DIR}/
${COMPONENTS_DIR}/utils/include/
${COMPONENTS_DIR}/config_profile/include
+ ${COMPONENTS_DIR}/smart_objects/include/
+ ${COMPONENTS_DIR}/rpc_base/include
+ ${CMAKE_BINARY_DIR}/src/components/
${POLICY_GLOBAL_INCLUDE_PATH}/
+ ${BOOST_INCLUDE_DIR}
${LOG4CXX_INCLUDE_DIRECTORY}
${JSONCPP_INCLUDE_DIRECTORY}
)
@@ -59,12 +64,54 @@ set(SOURCES
${COMPONENTS_DIR}/rpc_base/src/rpc_base/rpc_base.cc
)
+set(GENERATED_MOBILE_POLICY_TYPES_CPP
+ "${CMAKE_CURRENT_BINARY_DIR}/generated_MOBILE_API_policy_types.cc"
+ "${CMAKE_CURRENT_BINARY_DIR}/generated_MOBILE_API_enum_schema_factory.cc")
+
+set(GENERATED_MOBILE_POLICY_TYPES_HPP
+ "${CMAKE_CURRENT_BINARY_DIR}/generated_MOBILE_API_policy_types.h")
+
+set(GENERATED_MOBILE_POLICY_TYPES
+ ${GENERATED_MOBILE_POLICY_TYPES_HPP}
+ ${GENERATED_MOBILE_POLICY_TYPES_CPP})
+
+generate_policy_types("${GENERATED_MOBILE_POLICY_TYPES}"
+ "${COMPONENTS_DIR}/interfaces/MOBILE_API.xml"
+ "rpc::policy_table_interface_base"
+ "mobile-policy-types")
+
+set(GENERATED_HMI_POLICY_TYPES_CPP
+ "${CMAKE_CURRENT_BINARY_DIR}/generated_HMI_API_policy_types.cc")
+
+set(GENERATED_HMI_POLICY_TYPES_HPP
+ "${CMAKE_CURRENT_BINARY_DIR}/generated_HMI_API_policy_types.h")
+
+set(GENERATED_HMI_POLICY_TYPES
+ ${GENERATED_HMI_POLICY_TYPES_HPP}
+ ${GENERATED_HMI_POLICY_TYPES_CPP})
+
+
+generate_policy_types("${GENERATED_HMI_POLICY_TYPES}"
+ "${COMPONENTS_DIR}/interfaces/HMI_API.xml"
+ "rpc::policy_table_interface_base"
+ "hmi-policy-types")
+
+if (REMOTE_CONTROL)
+ list(APPEND SOURCES ${POLICY_PATH}/src/access_remote_impl.cc)
+endif()
+
list(APPEND SOURCES
${POLICY_PATH}/src/sql_pt_ext_queries.cc
${POLICY_PATH}/src/sql_pt_ext_representation.cc
)
-set(LIBRARIES ConfigProfile policy_struct dbms jsoncpp Utils)
+set(LIBRARIES
+ ConfigProfile
+ policy_struct
+ dbms jsoncpp
+ Utils
+)
+
if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
# --- QDB Wrapper
include_directories (${COMPONENTS_DIR}/utils/include/utils)
@@ -74,21 +121,25 @@ else ()
list(APPEND LIBRARIES sqlite3)
endif ()
-add_library(${target} SHARED ${SOURCES})
-target_link_libraries(${target} ${LIBRARIES} )
+add_library(PolicyStatic ${SOURCES})
+target_link_libraries(PolicyStatic ${LIBRARIES})
+
+
+add_library(Policy SHARED "src/policy_manager_impl.cc")
+target_link_libraries(Policy PolicyStatic)
if (ENABLE_LOG)
- target_link_libraries(${target} log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
+ target_link_libraries(Policy log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
-add_custom_target(copy_library_${target} ALL
+add_custom_target(copy_library_Policy ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${library_name}
${copy_destination}
- DEPENDS ${target}
+ DEPENDS Policy
COMMENT "Copying library ${library_name}")
-install(TARGETS ${target}
+install(TARGETS Policy
DESTINATION ${install_destination}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
@@ -99,13 +150,22 @@ install(TARGETS ${target}
set(struct_target policy_struct)
set(TABLE_STRUCT_SOURCES
+ ${GENERATED_MOBILE_POLICY_TYPES_CPP}
+ ${GENERATED_HMI_POLICY_TYPES_CPP}
${POLICY_PATH}/src/policy_table/enums.cc
${POLICY_PATH}/src/policy_table/types.cc
${POLICY_PATH}/src/policy_table/validation.cc
)
add_library(${struct_target} ${TABLE_STRUCT_SOURCES})
-target_link_libraries(${struct_target} Utils)
+target_link_libraries(${struct_target}
+MOBILE_API
+HMI_API
+Utils
+SmartObjects
+formatters
+jsoncpp
+)
# --- Usage statistics
set(USAGE_STATISTICS_SOURCES
diff --git a/src/components/policy/policy_external/doc/doxygen/components/JSONHandler/Formatters/index.txt b/src/components/policy/policy_external/doc/doxygen/components/JSONHandler/Formatters/index.txt
index 9854b88d5f..0144efaf7f 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/JSONHandler/Formatters/index.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/JSONHandler/Formatters/index.txt
@@ -1,9 +1,9 @@
-/*! \page components_jsonhandler_formatters Smart Objects Formatters
+/*! \page components_jsonhandler_formatters Smart Objects formatters
In order to create JSON string representation from Smart Object or create Smart Object data structure from JSON string representation JSON Handler component has special classes called formatters.
-The interface of formatter is quite simple and defined by NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase class. Actually it has two methods - NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::objToJsonValue to convert JSON string to object and NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::jsonValueToObj to create JSON string from object.
+The interface of formatter is quite simple and defined by ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase class. Actually it has two methods - ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase::objToJsonValue to convert JSON string to object and ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase::jsonValueToObj to create JSON string from object.
-Current implementation has two different implementations of NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase class: NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonALRPCv1 for ALRPC.v1 and NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonALRPCv2 for ALRPC.v2. These implementations handle specifics of each format.
+Current implementation has two different implementations of ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase class: ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonALRPCv1 for ALRPC.v1 and ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonALRPCv2 for ALRPC.v2. These implementations handle specifics of each format.
*/
diff --git a/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Types/Value representation.txt b/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Types/Value representation.txt
index 6505ae6f43..2c23555902 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Types/Value representation.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Types/Value representation.txt
@@ -1,11 +1,11 @@
/*! \page components_smartobjects_types_repr Type value representation methods for SmartObjects
-As alternative to the type casts NsSmartDeviceLink::NsSmartObjects::CSmartObject class defines set of usable methods that allow to represent object values as desired type. Use of these methods may change code style and readability but functionally it completely similar to the type casts of Smart Objects.
+As alternative to the type casts ns_smart_device_link::ns_smart_objects::CSmartObject class defines set of usable methods that allow to represent object values as desired type. Use of these methods may change code style and readability but functionally it completely similar to the type casts of Smart Objects.
Example:
<pre>
-NsSmartDeviceLink::NsSmartObjects::CSmartObject obj;
+ns_smart_device_link::ns_smart_objects::CSmartObject obj;
obj[0] = 1;
diff --git a/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Validation/Schema Structure.txt b/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Validation/Schema Structure.txt
index 2e611f74b9..d4be0ce490 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Validation/Schema Structure.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Validation/Schema Structure.txt
@@ -1,25 +1,25 @@
/*! \page components_smartobjects_validation_items Schema structure: Schema Items
-In order to create new Schema (new object of class NsSmartDeviceLink::NsSmartObjects::CSmartSchema) client first must define all required Schema Items. Actually every Schema is a tree of respective Schema Items. Each node and leaf of that tree defines structural rules for some Smart Object data structure.
+In order to create new Schema (new object of class ns_smart_device_link::ns_smart_objects::CSmartSchema) client first must define all required Schema Items. Actually every Schema is a tree of respective Schema Items. Each node and leaf of that tree defines structural rules for some Smart Object data structure.
-Schema Items are represented as class hierarchy. The base class for all schema items is a NsSmartDeviceLink::NsSmartObjects::ISchemaItem class. This base class defines generic validation interface for Schema Items.
+Schema Items are represented as class hierarchy. The base class for all schema items is a ns_smart_device_link::ns_smart_objects::ISchemaItem class. This base class defines generic validation interface for Schema Items.
-To define special elements with always successful or always failing validation there are two special Schema Items: NsSmartDeviceLink::NsSmartObjects::CAlwaysTrueSchemaItem and NsSmartDeviceLink::NsSmartObjects::CAlwaysFalseSchemaItem.
+To define special elements with always successful or always failing validation there are two special Schema Items: ns_smart_device_link::ns_smart_objects::CAlwaysTrueSchemaItem and ns_smart_device_link::ns_smart_objects::CAlwaysFalseSchemaItem.
-NsSmartDeviceLink::NsSmartObjects::CBoolSchemaItem is used for boolean values and has no parameters (only verifies that respective Smart Object is really has boolean value).
+ns_smart_device_link::ns_smart_objects::CBoolSchemaItem is used for boolean values and has no parameters (only verifies that respective Smart Object is really has boolean value).
-NsSmartDeviceLink::NsSmartObjects::TNumberSchemaItem is template Schema Item that can be used for both integer and floating point values. In addition to the regular type verification it is possible to set min and max value range (these values are optional).
+ns_smart_device_link::ns_smart_objects::TNumberSchemaItem is template Schema Item that can be used for both integer and floating point values. In addition to the regular type verification it is possible to set min and max value range (these values are optional).
-NsSmartDeviceLink::NsSmartObjects::TEnumSchemaItem is used to verify any custom client-defined enum.
+ns_smart_device_link::ns_smart_objects::TEnumSchemaItem is used to verify any custom client-defined enum.
-NsSmartDeviceLink::NsSmartObjects::CStringSchemaItem is used to verify a string values. As optional parameter max length of the string could be set.
+ns_smart_device_link::ns_smart_objects::CStringSchemaItem is used to verify a string values. As optional parameter max length of the string could be set.
-NsSmartDeviceLink::NsSmartObjects::CArraySchemaItem provides validation for array. Can be used to verify special type and array size.
+ns_smart_device_link::ns_smart_objects::CArraySchemaItem provides validation for array. Can be used to verify special type and array size.
-NsSmartDeviceLink::NsSmartObjects::CObjectSchemaItem used in case when Schema Item includes another Schema Item. Actually this is only way to create tree node of new Schema. All other Schema Items will be used only to become leafs of validation tree.
+ns_smart_device_link::ns_smart_objects::CObjectSchemaItem used in case when Schema Item includes another Schema Item. Actually this is only way to create tree node of new Schema. All other Schema Items will be used only to become leafs of validation tree.
After creation of all required Schema Items (which is actually bind in the tree) it is possible to create Schema.
-Schema can be initialized not only by raw root Schema Item, but also by special abstraction called Member (defined by NsSmartDeviceLink::NsSmartObjects::CObjectSchemaItem::SMember class). So every root item (NsSmartDeviceLink::NsSmartObjects::CObjectSchemaItem) firstly should be wrapped as Member. This wrapping process also allows to set "is mandatory" status for every Member.
+Schema can be initialized not only by raw root Schema Item, but also by special abstraction called Member (defined by ns_smart_device_link::ns_smart_objects::SMember class). So every root item (ns_smart_device_link::ns_smart_objects::CObjectSchemaItem) firstly should be wrapped as Member. This wrapping process also allows to set "is mandatory" status for every Member.
and pass root Schema Item as initial parameter to the new Schema.
@@ -69,29 +69,29 @@ TSharedPtr<ISchemaItem> resultCode_SchemaItem = TEnumSchemaItem<Result::eType>::
// Provides additional human readable info regarding the result.
TSharedPtr<ISchemaItem> info_SchemaItem = CStringSchemaItem::create(TSchemaItemParameter<size_t>(1000), TSchemaItemParameter<std::string>());
-schemaMembersMap["success"] = CObjectSchemaItem::SMember(success_SchemaItem, true);
+schemaMembersMap["success"] = SMember(success_SchemaItem, true);
-schemaMembersMap["resultCode"] = CObjectSchemaItem::SMember(resultCode_SchemaItem, true);
+schemaMembersMap["resultCode"] = SMember(resultCode_SchemaItem, true);
-schemaMembersMap["info"] = CObjectSchemaItem::SMember(info_SchemaItem, false);
+schemaMembersMap["info"] = SMember(info_SchemaItem, false);
-std::map<std::string, CObjectSchemaItem::SMember> paramsMembersMap;
+std::map<std::string, SMember> paramsMembersMap;
-paramsMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember(TEnumSchemaItem<FunctionID::eType>::create(FunctionIDItems), true);
+paramsMembersMap[ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID] = SMember(TEnumSchemaItem<FunctionID::eType>::create(FunctionIDItems), true);
-paramsMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(TEnumSchemaItem<messageType::eType>::create(MessageTypeItems), true);
+paramsMembersMap[ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE] = SMember(TEnumSchemaItem<messageType::eType>::create(MessageTypeItems), true);
-paramsMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_CORRELATION_ID] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+paramsMembersMap[ns_smart_device_link::ns_json_handler::strings::S_CORRELATION_ID] = SMember(TNumberSchemaItem<int>::create(), true);
-paramsMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(1, 2), true);
+paramsMembersMap[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_VERSION] = SMember(TNumberSchemaItem<int>::create(1, 2), true);
-paramsMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+paramsMembersMap[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_TYPE] = SMember(TNumberSchemaItem<int>::create(), true);
-std::map<std::string, CObjectSchemaItem::SMember> rootMembersMap;
+std::map<std::string, SMember> rootMembersMap;
-rootMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_MSG_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(schemaMembersMap), true);
+rootMembersMap[ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS] = SMember(CObjectSchemaItem::create(schemaMembersMap), true);
-rootMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(paramsMembersMap), true);
+rootMembersMap[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] = SMember(CObjectSchemaItem::create(paramsMembersMap), true);
CSmartSchema(CObjectSchemaItem::create(rootMembersMap));
diff --git a/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Validation/Validation.txt b/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Validation/Validation.txt
index a02f0be4bd..c651af5294 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Validation/Validation.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/SmartObjects/Smart Objects Validation/Validation.txt
@@ -1,9 +1,9 @@
/*! \page components_smartobjects_validation_use Using Schema for validation
-The main purpose of Schema is validation of existing Smart Object. This process includes type and value validation. The client can use results of validation to determine if given Smart Object is valid or not. Validation of specific Smart Object can be triggered by using NsSmartDeviceLink::NsSmartObjects::CSmartSchema::validate method. Internally Schema triggers respective validate method of every Schema Item in order to perform validation.
+The main purpose of Schema is validation of existing Smart Object. This process includes type and value validation. The client can use results of validation to determine if given Smart Object is valid or not. Validation of specific Smart Object can be triggered by using ns_smart_device_link::ns_smart_objects::CSmartSchema::validate method. Internally Schema triggers respective validate method of every Schema Item in order to perform validation.
-Another feature of Schema is capability to be applied to the Smart Object. Applying means that Schema tries to modify object to "normalize" data. Currently this "normalization" effects on string representation of enums. Applying of the Schema can be triggered by using NsSmartDeviceLink::NsSmartObjects::CSmartSchema::applySchema method. Internally Schema triggers respective apply method of every Schema Item and at the moment only enum Schema Items try to covert string representation to enum values.
+Another feature of Schema is capability to be applied to the Smart Object. Applying means that Schema tries to modify object to "normalize" data. Currently this "normalization" effects on string representation of enums. Applying of the Schema can be triggered by using ns_smart_device_link::ns_smart_objects::CSmartSchema::applySchema method. Internally Schema triggers respective apply method of every Schema Item and at the moment only enum Schema Items try to covert string representation to enum values.
-To "unapply" modifications done by apply feature Schema has NsSmartDeviceLink::NsSmartObjects::CSmartSchema::unapplySchema method. It can be used to make string representations of enums.
+To "unapply" modifications done by apply feature Schema has ns_smart_device_link::ns_smart_objects::CSmartSchema::unapplySchema method. It can be used to make string representations of enums.
*/
diff --git a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/ConnectionManagement.txt b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/ConnectionManagement.txt
index 2ba273e9d4..dab3df104d 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/ConnectionManagement.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/ConnectionManagement.txt
@@ -1,11 +1,11 @@
/** @page components_transportmanager_client_connection_management Connection Management
*
- * As all requests to TransportManager are asynchronous, client must implement NsSmartDeviceLink::NsTransportManager::ITransportManagerDeviceListener
- * interface and add itself as a device listener with NsSmartDeviceLink::NsTransportManager::ITransportManager::addDeviceListener()
+ * As all requests to TransportManager are asynchronous, client must implement ns_smart_device_link::ns_transport_manager::ITransportManagerDeviceListener
+ * interface and add itself as a device listener with ns_smart_device_link::ns_transport_manager::ITransportManager::addDeviceListener()
* in order to receive notifications.
- * To connect remote device client must use NsSmartDeviceLink::NsTransportManager::ITransportManager::connectDevice(). It will initiate connections to all
+ * To connect remote device client must use ns_smart_device_link::ns_transport_manager::ITransportManager::connectDevice(). It will initiate connections to all
* applications running on remove device. For TCP device this call has no effect as TCP connections are initiated by remote devices.
- * Client will be notified about each connected application with NsSmartDeviceLink::NsTransportManager::ITransportManagerDeviceListener::onApplicationConnected().
- * To disconnect all applications running on remote device client must use NsSmartDeviceLink::NsTransportManager::ITransportManager::disconnectDevice().
- * Client will be notified about each disconnected application with NsSmartDeviceLink::NsTransportManager::ITransportManagerDeviceListener::onApplicationDisconnected().
+ * Client will be notified about each connected application with ns_smart_device_link::ns_transport_manager::ITransportManagerDeviceListener::onApplicationConnected().
+ * To disconnect all applications running on remote device client must use ns_smart_device_link::ns_transport_manager::ITransportManager::disconnectDevice().
+ * Client will be notified about each disconnected application with ns_smart_device_link::ns_transport_manager::ITransportManagerDeviceListener::onApplicationDisconnected().
*/
diff --git a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/DataTransfer.txt b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/DataTransfer.txt
index 98dd7426be..831a0c7818 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/DataTransfer.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/DataTransfer.txt
@@ -1,11 +1,11 @@
/** @page components_transportmanager_client_data_transfer Data Transfer
*
- * As all requests to TransportManager are asynchronous, client must implement NsSmartDeviceLink::NsTransportManager::ITransportManagerDataListener
- * interface and add itself as a data listener with NsSmartDeviceLink::NsTransportManager::ITransportManager::addDataListener()
+ * As all requests to TransportManager are asynchronous, client must implement ns_smart_device_link::ns_transport_manager::ITransportManagerDataListener
+ * interface and add itself as a data listener with ns_smart_device_link::ns_transport_manager::ITransportManager::addDataListener()
* in order to receive notifications.
- * To send frame to remote device client must use NsSmartDeviceLink::NsTransportManager::ITransportManager::sendFrame() poviding connection handle,
+ * To send frame to remote device client must use ns_smart_device_link::ns_transport_manager::ITransportManager::sendFrame() poviding connection handle,
* frame data, data size and user data. User data is an integer that is assigned to a frame and will be sent back to client when sending of frame
* will be completed. Client may use this data to identify frame when send result will be reported. When sending of frame is completed
- * client is notified via NsSmartDeviceLink::NsTransportManager::ITransportManagerDataListener::onFrameSendCompleted(). When frame is received from a remote
- * device client is notified via NsSmartDeviceLink::NsTransportManager::ITransportManagerDataListener::onFrameReceived().
+ * client is notified via ns_smart_device_link::ns_transport_manager::ITransportManagerDataListener::onFrameSendCompleted(). When frame is received from a remote
+ * device client is notified via ns_smart_device_link::ns_transport_manager::ITransportManagerDataListener::onFrameReceived().
*/
diff --git a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/DeviceManagement.txt b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/DeviceManagement.txt
index eb5f3e477e..4b5b63bf87 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/DeviceManagement.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/DeviceManagement.txt
@@ -1,11 +1,11 @@
/** @page components_transportmanager_client_device_management Device Management
*
- * As all requests to TransportManager are asynchronous, client must implement NsSmartDeviceLink::NsTransportManager::ITransportManagerDeviceListener
- * interface and add itself as a device listener with NsSmartDeviceLink::NsTransportManager::ITransportManager::addDeviceListener()
+ * As all requests to TransportManager are asynchronous, client must implement ns_smart_device_link::ns_transport_manager::ITransportManagerDeviceListener
+ * interface and add itself as a device listener with ns_smart_device_link::ns_transport_manager::ITransportManager::addDeviceListener()
* in order to receive notifications.
- * Client of TransportManager may use NsSmartDeviceLink::NsTransportManager::ITransportManager::scanForNewDevices()
+ * Client of TransportManager may use ns_smart_device_link::ns_transport_manager::ITransportManager::scanForNewDevices()
* to initiate device scan on all device adapters that support this feature. In order to get list of available
- * devices client must override NsSmartDeviceLink::NsTransportManager::ITransportManagerDeviceListener::onDeviceListUpdated().
+ * devices client must override ns_smart_device_link::ns_transport_manager::ITransportManagerDeviceListener::onDeviceListUpdated().
* Each device adapter will perform scan independently from other device adapters and device list might be updated
* several times (after each adapter that supports scanning finishes scanning operation). Device list might also be
* updated without device scan request, e.g. if new client connects via TCP this device will be added to device list
diff --git a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/index.txt b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/index.txt
index 8916dbeb55..d4d0efeb7b 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/index.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Client Specification/index.txt
@@ -3,12 +3,12 @@
This chapter describes details of correct use of Transport Manager on the client side. In other words this chapter can be called "How to create effective and safe client of Transport Manager".
Transport Manager defines set of asynchronous requests (means that operations are non-blocking in the calling thread) and provides two different interfaces to monitor asynchronous responses and notifications about data update.
-Clients of Transport Manager should use NsSmartDeviceLink::NsTransportManager::ITransportManager interface to initiate any request to the component.
+Clients of Transport Manager should use ns_smart_device_link::ns_transport_manager::ITransportManager interface to initiate any request to the component.
Also Transport Manager provides two different interfaces:
-1) NsSmartDeviceLink::NsTransportManager::ITransportManagerDataListener. Client can implement this interface if it needs information about data frame send/receive.
+1) ns_smart_device_link::ns_transport_manager::ITransportManagerDataListener. Client can implement this interface if it needs information about data frame send/receive.
-2) NsSmartDeviceLink::NsTransportManager::ITransportManagerDeviceListener. Client can implement this interface if it needs information about updates of devices available for communication and current client applications status.
+2) ns_smart_device_link::ns_transport_manager::ITransportManagerDeviceListener. Client can implement this interface if it needs information about updates of devices available for communication and current client applications status.
For more information about typical use of Transport Manager please read the following topics:
- \subpage components_transportmanager_client_device_management "Device Management"
diff --git a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/BluetoothAdapter.txt b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/BluetoothAdapter.txt
index 970aeffd83..eb5de23e35 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/BluetoothAdapter.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/BluetoothAdapter.txt
@@ -1,18 +1,18 @@
/** @page components_transportmanager_internal_design_transport_adapters_bluetooth_adapter Bluetooth Adapter
*
* Bluetooth adapter handles communication with external devices via bluetooth. It is implemented in
- * NsSmartDeviceLink::NsTransportManager::CBluetoothAdapter.
+ * ns_smart_device_link::ns_transport_manager::CBluetoothAdapter.
*
* @section components_transportmanager_internal_design_transport_adapters_bluetooth_adapter_discovery Device discovery
*
- * When requested by a call to NsSmartDeviceLink::NsTransportManager::CTransportAdapter::scanForNewDevices() bluetooth adapter
+ * When requested by a call to ns_smart_device_link::ns_transport_manager::CTransportAdapter::scanForNewDevices() bluetooth adapter
* searches for bluetooth devices. For each found device it runs SDP query for service with SmartDeviceLink UUID
* (936DA01F-9ABD-4D9D-80C7-02AF85C822A8). Devices that support this service are added to bluetooth adapter device list.
* Bluetooth device scans are performed only when explicitly requested.
*
* @section components_transportmanager_internal_design_transport_adapters_bluetooth_adapter_connecting_devices Connecting devices
*
- * NsSmartDeviceLink::NsTransportManager::CBluetoothAdapter::createConnectionsListForDevice() runs SDP query for specified device
+ * ns_smart_device_link::ns_transport_manager::CBluetoothAdapter::createConnectionsListForDevice() runs SDP query for specified device
* and fills connection list with connections to all RFCOMM channels on remote device where SmartDeviceLink service has been discovered.
*
* @see @ref components_transportmanager_internal_design_transport_adapters_common_connecting_devices
diff --git a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/TCPAdapter.txt b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/TCPAdapter.txt
index d81b70dfe8..2fbd835ec9 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/TCPAdapter.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/TCPAdapter.txt
@@ -1,11 +1,11 @@
/** @page components_transportmanager_internal_design_transport_adapters_tcp_adapter TCP Adapter
*
* TCP adapter handles communication with remote devices via TCP/IP socket. It is implemented in
- * NsSmartDeviceLink::NsTransportManager::CTCPAdapter.
+ * ns_smart_device_link::ns_transport_manager::CTCPAdapter.
*
* @section components_transportmanager_internal_design_transport_adapters_tcp_adapter_listen Listening for connections
*
- * TCP adapter creates listening TCP socket (TCP port is specified in NsSmartDeviceLink::NsTransportManager::CTCPAdapter::cTCPAdapterPort)
+ * TCP adapter creates listening TCP socket (TCP port is specified in ns_smart_device_link::ns_transport_manager::CTCPAdapter::cTCPAdapterPort)
* and listens for incoming connections. Devices are identified by their IP address.
*
* @section components_transportmanager_internal_design_transport_adapters_tcp_adapter_accept Accepting connection
diff --git a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/index.txt b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/index.txt
index 3a5d0f0e91..015978b773 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/index.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/Device Adapters/index.txt
@@ -4,80 +4,80 @@
*
* @section components_transportmanager_internal_design_transport_adapters_common Common logic
*
- * Logic common to all device adapters is implemented in class NsSmartDeviceLink::NsTransportManager::CTransportAdapter.
+ * Logic common to all device adapters is implemented in class ns_smart_device_link::ns_transport_manager::CTransportAdapter.
*
* @subsection components_transportmanager_internal_design_transport_adapters_common_devices_map Devices map
*
- * Devices map is a map of device handle to internal device structure NsSmartDeviceLink::NsTransportManager::CTransportAdapter::SDevice.
- * Devices map is stored in NsSmartDeviceLink::NsTransportManager::CTransportAdapter::mDevices. Any access to this map must be performed
- * with NsSmartDeviceLink::NsTransportManager::CTransportAdapter::mDevicesMutex locked.
+ * Devices map is a map of device handle to internal device structure ns_smart_device_link::ns_transport_manager::CTransportAdapter::SDevice.
+ * Devices map is stored in ns_smart_device_link::ns_transport_manager::CTransportAdapter::mDevices. Any access to this map must be performed
+ * with ns_smart_device_link::ns_transport_manager::CTransportAdapter::mDevicesMutex locked.
*
* @subsection components_transportmanager_internal_design_transport_adapters_common_connections_map Connections map
*
- * Connections map is a map of connection handle to internal connection structure NsSmartDeviceLink::NsTransportManager::CTransportAdapter::SConnection.
- * Connections map is stored in NsSmartDeviceLink::NsTransportManager::CTransportAdapter::mConnections. Any access to this map must be performed
- * with NsSmartDeviceLink::NsTransportManager::CTransportAdapter::mConnectionsMutex locked.
+ * Connections map is a map of connection handle to internal connection structure ns_smart_device_link::ns_transport_manager::CTransportAdapter::SConnection.
+ * Connections map is stored in ns_smart_device_link::ns_transport_manager::CTransportAdapter::mConnections. Any access to this map must be performed
+ * with ns_smart_device_link::ns_transport_manager::CTransportAdapter::mConnectionsMutex locked.
*
* @subsection components_transportmanager_internal_design_transport_adapters_common_main_thread Device adapter main thread
*
- * Device adapter main thread is started in NsSmartDeviceLink::NsTransportManager::CTransportAdapter::run().
- * Specific device adapter must implement virtual function NsSmartDeviceLink::NsTransportManager::CTransportAdapter::mainThread()
+ * Device adapter main thread is started in ns_smart_device_link::ns_transport_manager::CTransportAdapter::run().
+ * Specific device adapter must implement virtual function ns_smart_device_link::ns_transport_manager::CTransportAdapter::mainThread()
* and implement its specific main thread logic there.
*
* @subsection components_transportmanager_internal_design_transport_adapters_common_connection_thread Device adapter connection thread
*
- * Device adapter connection thread is started in NsSmartDeviceLink::NsTransportManager::CTransportAdapter::startConnection().
- * Specific device adapter must implement virtual function NsSmartDeviceLink::NsTransportManager::CTransportAdapter::connectionThread()
+ * Device adapter connection thread is started in ns_smart_device_link::ns_transport_manager::CTransportAdapter::startConnection().
+ * Specific device adapter must implement virtual function ns_smart_device_link::ns_transport_manager::CTransportAdapter::connectionThread()
* and implement its specific connection thread logic there. When connection is established and socket file descriptor is set
- * in NsSmartDeviceLink::NsTransportManager::CTransportAdapter::SConnection::mConnectionSocket specific device adapter may call
- * NsSmartDeviceLink::NsTransportManager::CTransportAdapter::handleCommunication() to handle all communication through this socket
+ * in ns_smart_device_link::ns_transport_manager::CTransportAdapter::SConnection::mConnectionSocket specific device adapter may call
+ * ns_smart_device_link::ns_transport_manager::CTransportAdapter::handleCommunication() to handle all communication through this socket
* until connection is terminated.
*
* @subsection components_transportmanager_internal_design_transport_adapters_common_threads_termination Termination of device adapter threads
*
- * Specific device adapter implementation must call in its destructor NsSmartDeviceLink::NsTransportManager::CTransportAdapter::waitForThreadsTermination()
+ * Specific device adapter implementation must call in its destructor ns_smart_device_link::ns_transport_manager::CTransportAdapter::waitForThreadsTermination()
* to wait for termination of all threads (main thread and connection threads). Device adapter threads must be terminated before specific
* device adapter class is destructed, so it can't be called in the destructor of base class and must be called explicitly from the inherited
* class's destructor.
*
* @subsection components_transportmanager_internal_design_transport_adapters_common_device_scan Requesting scan for new devices
*
- * Device scan is requested by setting flag NsSmartDeviceLink::NsTransportManager::CTransportAdapter::mDeviceScanRequested
- * and signaling conditional variable NsSmartDeviceLink::NsTransportManager::CTransportAdapter::mDeviceScanRequestedCond, which may be monitored
+ * Device scan is requested by setting flag ns_smart_device_link::ns_transport_manager::CTransportAdapter::mDeviceScanRequested
+ * and signaling conditional variable ns_smart_device_link::ns_transport_manager::CTransportAdapter::mDeviceScanRequestedCond, which may be monitored
* by specific device adapter if it supports device scanning. Specific device adaptere may call for this purpose
- * NsSmartDeviceLink::NsTransportManager::CTransportAdapter::waitForDeviceScanRequest() which will wait on this conditional variable
+ * ns_smart_device_link::ns_transport_manager::CTransportAdapter::waitForDeviceScanRequest() which will wait on this conditional variable
* until it's signaled or specified timeout expires.
*
* @subsection components_transportmanager_internal_design_transport_adapters_common_connecting_devices Connecting devices
*
- * Device connection is initiated with a call to NsSmartDeviceLink::NsTransportManager::CTransportAdapter::connectDevice().
- * This method calls virtual function NsSmartDeviceLink::NsTransportManager::CTransportAdapter::createConnectionsListForDevice()
+ * Device connection is initiated with a call to ns_smart_device_link::ns_transport_manager::CTransportAdapter::connectDevice().
+ * This method calls virtual function ns_smart_device_link::ns_transport_manager::CTransportAdapter::createConnectionsListForDevice()
* which may be implemented by specific device adapter to create a list of connections that must be established for the device.
- * For each connection created by device adapter it calls NsSmartDeviceLink::NsTransportManager::CTransportAdapter::startConnection()
+ * For each connection created by device adapter it calls ns_smart_device_link::ns_transport_manager::CTransportAdapter::startConnection()
* which adds connection to connections map and starts connection thread.
*
* @subsection components_transportmanager_internal_design_transport_adapters_common_disconnecting_devices Disconnecting devices
*
- * Device disconnection is initiated with a call to NsSmartDeviceLink::NsTransportManager::CTransportAdapter::disconnectDevice().
+ * Device disconnection is initiated with a call to ns_smart_device_link::ns_transport_manager::CTransportAdapter::disconnectDevice().
* This method finds all connections in connections map that corresponds to specified device and calls
- * NsSmartDeviceLink::NsTransportManager::CTransportAdapter::stopConnection() for each of them.
+ * ns_smart_device_link::ns_transport_manager::CTransportAdapter::stopConnection() for each of them.
*
* @subsection components_transportmanager_internal_design_transport_adapters_common_handling_communication Handling communication
*
- * All frames requested to be sent via NsSmartDeviceLink::NsTransportManager::CTransportAdapter::sendFrame() are stored in
- * NsSmartDeviceLink::NsTransportManager::CTransportAdapter::SConnection::mFramesToSend. Pipe
- * NsSmartDeviceLink::NsTransportManager::CTransportAdapter::SConnection::mNotificationPipeFds is used by
- * NsSmartDeviceLink::NsTransportManager::CTransportAdapter::sendFrame() to notify connection thread that data is available
- * to be sent. NsSmartDeviceLink::NsTransportManager::CTransportAdapter::sendFrame() writes one byte to the write end of this pipe.
- * NsSmartDeviceLink::NsTransportManager::CTransportAdapter::handleCommunication() uses poll() to wait for
+ * All frames requested to be sent via ns_smart_device_link::ns_transport_manager::CTransportAdapter::sendFrame() are stored in
+ * ns_smart_device_link::ns_transport_manager::CTransportAdapter::SConnection::mFramesToSend. Pipe
+ * ns_smart_device_link::ns_transport_manager::CTransportAdapter::SConnection::mNotificationPipeFds is used by
+ * ns_smart_device_link::ns_transport_manager::CTransportAdapter::sendFrame() to notify connection thread that data is available
+ * to be sent. ns_smart_device_link::ns_transport_manager::CTransportAdapter::sendFrame() writes one byte to the write end of this pipe.
+ * ns_smart_device_link::ns_transport_manager::CTransportAdapter::handleCommunication() uses poll() to wait for
* incoming data using connection socket file descriptor and outgoing data using file descriptor of the read end of this pipe.
* When either of them become available for reading or some error occurs (e.g. socket gets disconnected) connection thread
* wakes up and handles this event. Notification pipe is also used to notify connection thread that connection has to be
- * terminated using NsSmartDeviceLink::NsTransportManager::CTransportAdapter::SConnection::mTerminateFlag.
+ * terminated using ns_smart_device_link::ns_transport_manager::CTransportAdapter::SConnection::mTerminateFlag.
*
* @subsection components_transportmanager_internal_design_transport_adapters_common_update_client_device_list Updating client device list.
*
- * Specific device adapter may call NsSmartDeviceLink::NsTransportManager::CTransportAdapter::updateClientDeviceList() when its internal
+ * Specific device adapter may call ns_smart_device_link::ns_transport_manager::CTransportAdapter::updateClientDeviceList() when its internal
* knowledge about available devices is updated to notify device adapter client (TransportManager) about this update.
*
* @section components_transportmanager_internal_design_transport_adapters_common_specific Specific device adapters
diff --git a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/MultiThreading.txt b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/MultiThreading.txt
index 6c35f0962f..3d2fcb5094 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/MultiThreading.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/MultiThreading.txt
@@ -2,8 +2,8 @@
Internally Transport Manager uses different threads for different operations. This design solution was used to provide efficient asynchronous communication with clients and underlying Device Adapters.
-Transport Manager uses one thread to operate with all device-related callbacks. In other word all callbacks declared in NsSmartDeviceLink::NsTransportManager::ITransportManagerDeviceListener will be called from that thread.
+Transport Manager uses one thread to operate with all device-related callbacks. In other word all callbacks declared in ns_smart_device_link::ns_transport_manager::ITransportManagerDeviceListener will be called from that thread.
-For every active connection one service thread will be created. This thread will be used for all connection-related callbacks. Therefore every implementation of NsSmartDeviceLink::NsTransportManager::ITransportManagerDataListener will be called in separated thread that allows client to support multiple connection simultaneously.
+For every active connection one service thread will be created. This thread will be used for all connection-related callbacks. Therefore every implementation of ns_smart_device_link::ns_transport_manager::ITransportManagerDataListener will be called in separated thread that allows client to support multiple connection simultaneously.
*/
diff --git a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/TrasportManager.txt b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/TrasportManager.txt
index c96fd46a22..164fad9140 100644
--- a/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/TrasportManager.txt
+++ b/src/components/policy/policy_external/doc/doxygen/components/TransportManager/Internal Design/TrasportManager.txt
@@ -2,13 +2,13 @@
Actually Transport Manager component is implemented as classical manager component. It manages connections and abstract devices and provides unified information for the clients.
-Connection-related information encapsulated in structure NsSmartDeviceLink::NsTransportManager::CTransportManager::SConnectionInfo. Transport Manager manages these structures to store information about every active connection.
+Connection-related information encapsulated in structure ns_smart_device_link::ns_transport_manager::CTransportManager::SConnectionInfo. Transport Manager manages these structures to store information about every active connection.
-Frame processing encapsulated in structure NsSmartDeviceLink::NsTransportManager::CTransportManager::SFrameDataForConnection. Transport Manager manages these structures to store information related to data for specific connection.
+Frame processing encapsulated in structure ns_smart_device_link::ns_transport_manager::CTransportManager::SFrameDataForConnection. Transport Manager manages these structures to store information related to data for specific connection.
Callback information between transport manager threads passed in form of special structures:
-NsSmartDeviceLink::NsTransportManager::CTransportManager::SDeviceListenerCallback.
-NsSmartDeviceLink::NsTransportManager::CTransportManager::SDataListenerCallback.
+ns_smart_device_link::ns_transport_manager::CTransportManager::SDeviceListenerCallback.
+ns_smart_device_link::ns_transport_manager::CTransportManager::SDataListenerCallback.
Client calls to TM guarded by separate mutex. This allows use component from different threads without any risk.
diff --git a/src/components/policy/policy_external/doc/doxygen/tools/InterfaceGenerator/How To Use.txt b/src/components/policy/policy_external/doc/doxygen/tools/InterfaceGenerator/How To Use.txt
index 0f9e340bc5..e7b14b0da1 100644
--- a/src/components/policy/policy_external/doc/doxygen/tools/InterfaceGenerator/How To Use.txt
+++ b/src/components/policy/policy_external/doc/doxygen/tools/InterfaceGenerator/How To Use.txt
@@ -1,6 +1,6 @@
/*! \page tools_interfacegenerator_usage How to use InterfaceGenerator
-To run InterfaceGenerator the Python 2.7 interpreter should be installed. As input InterfaceGenerator requires full path to the source XML file, namespace to generate result code in, full path to the output directory where result source code C++ will be created and optionally explicit specification of parser type.
+To run InterfaceGenerator the Python 3.5+ interpreter should be installed. As input InterfaceGenerator requires full path to the source XML file, namespace to generate result code in, full path to the output directory where result source code C++ will be created and optionally explicit specification of parser type.
Example1 (Run Generator.py to display help):
diff --git a/src/components/policy/policy_external/include/policy/access_remote.h b/src/components/policy/policy_external/include/policy/access_remote.h
index fd185af075..eadef088ad 100644
--- a/src/components/policy/policy_external/include/policy/access_remote.h
+++ b/src/components/policy/policy_external/include/policy/access_remote.h
@@ -32,9 +32,9 @@
#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_ACCESS_REMOTE_H_
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_ACCESS_REMOTE_H_
-#include <vector>
#include <ostream>
#include <string>
+#include <vector>
#include "policy/policy_table/types.h"
#include "policy/policy_types.h"
diff --git a/src/components/policy/policy_external/include/policy/access_remote_impl.h b/src/components/policy/policy_external/include/policy/access_remote_impl.h
index 0fa53b0237..cee2a8774f 100644
--- a/src/components/policy/policy_external/include/policy/access_remote_impl.h
+++ b/src/components/policy/policy_external/include/policy/access_remote_impl.h
@@ -35,7 +35,7 @@
#include <map>
#include "policy/policy_table/types.h"
#include "utils/macro.h"
-#include "utils/shared_ptr.h"
+
#include "policy/access_remote.h"
#include "policy/cache_manager.h"
@@ -46,7 +46,7 @@ namespace policy {
class AccessRemoteImpl : public AccessRemote {
public:
AccessRemoteImpl();
- explicit AccessRemoteImpl(utils::SharedPtr<CacheManager> cache);
+ explicit AccessRemoteImpl(std::shared_ptr<CacheManager> cache);
/**
* @brief CheckModuleType check if module type is allowed for application
* @param app_id application id
@@ -144,7 +144,7 @@ class AccessRemoteImpl : public AccessRemote {
/**
* @brief cache_ contains pointer to cache manager instance
*/
- utils::SharedPtr<CacheManager> cache_;
+ std::shared_ptr<CacheManager> cache_;
/**
* @brief hmi_types_ contains list of default HMI types for applications
diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h
index f41ddb14cd..b826f4e5ce 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager.h
@@ -33,18 +33,19 @@
#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_CACHE_MANAGER_H_
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_CACHE_MANAGER_H_
+#include <atomic>
#include <map>
+#include "boost/optional.hpp"
-#include "utils/shared_ptr.h"
-#include "policy/pt_representation.h"
+#include "policy/cache_manager_interface.h"
#include "policy/pt_ext_representation.h"
+#include "policy/pt_representation.h"
#include "policy/usage_statistics/statistics_manager.h"
-#include "policy/cache_manager_interface.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
-#include "utils/lock.h"
#include "utils/conditional_variable.h"
+#include "utils/lock.h"
namespace policy {
class PolicySettings;
@@ -154,10 +155,114 @@ class CacheManager : public CacheManagerInterface {
*/
virtual bool SecondsBetweenRetries(std::vector<int>& seconds);
+ const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
+
+ const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const OVERRIDE;
+
+ /**
+ * @brief Gets vehicle data items
+ * @return Structure with vehicle data items
+ */
+ virtual const std::vector<policy_table::VehicleDataItem> GetVehicleDataItems()
+ const OVERRIDE;
+
+ std::vector<policy_table::VehicleDataItem> GetRemovedVehicleDataItems()
+ const OVERRIDE;
+
+ /**
+ * @brief Gets copy of current policy table data
+ * @return policy_table as json object
+ */
+ virtual Json::Value GetPolicyTableData() const OVERRIDE;
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const OVERRIDE;
+
+ /**
+ * @brief Get a list of enabled local applications
+ * @return enabled_apps List filled with the policy app id
+ * of each enabled local application
+ */
+ std::vector<std::string> GetEnabledLocalApps() const OVERRIDE;
+
+ bool GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const OVERRIDE;
+
+ /**
+ * Initializes a new cloud application with default policies
+ * Then adds cloud specific policies
+ * @param app_id application id
+ * @return true if success
+ */
+ virtual void InitCloudApp(const std::string& policy_app_id);
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled);
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token);
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type);
+
+ /**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint);
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames);
+
/**
- * @brief Gets information about vehicle
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
*/
- virtual const VehicleInfo GetVehicleInfo() const;
+ virtual void SetHybridAppPreference(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference);
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const;
/**
* @brief Allows to update 'vin' field in module_meta table.
@@ -182,26 +287,27 @@ class CacheManager : public CacheManagerInterface {
std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
const std::string& language,
- const std::string& active_hmi_language);
+ const std::string& active_hmi_language) const;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
*
- * @return url which point to the resourse where lock screen icon could be
+ * @return url which point to the resourse where icon could be
*obtained.
*/
- virtual std::string GetLockScreenIconUrl() const;
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const;
/**
* @brief Gets list of URL to send PTS to
* @param service_type If URLs for specific service are preset,
* return them otherwise default URLs.
*/
- virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points);
+ void GetUpdateUrls(const std::string& service_type,
+ EndpointUrls& out_end_points) const OVERRIDE;
- virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points);
+ void GetUpdateUrls(const uint32_t service_type,
+ EndpointUrls& out_end_points) const OVERRIDE;
/**
* @brief Gets allowed number of notifications
@@ -232,7 +338,7 @@ class CacheManager : public CacheManagerInterface {
* device_info, statistics, excluding user messages
* @return Generated structure for obtaining Json string.
*/
- virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot();
+ virtual std::shared_ptr<policy_table::Table> GenerateSnapshot();
/**
* Applies policy table to the current table
@@ -298,6 +404,12 @@ class CacheManager : public CacheManagerInterface {
bool GetFunctionalGroupings(policy_table::FunctionalGroupings& groups);
/**
+ * @brief Get policy app names from PT
+ * @return container of strings representing policy application names
+ */
+ const policy_table::Strings GetPolicyAppIDs() const OVERRIDE;
+
+ /**
* Checks if the application is represented in policy table
* @param app_id application id
* @return true if application is represented in policy table
@@ -688,39 +800,40 @@ class CacheManager : public CacheManagerInterface {
ExternalConsentStatus GetExternalConsentEntities() OVERRIDE;
/**
- * @brief Creates collection of ExternalConsent items known by current
- * functional
- * groupings and appropiate section
- * (disallowed_by_external_consent_entities_on/off) where
- * is item is being holded. If item is not found it's not included into
- * collection
- * @param status Current status containing collection of ExternalConsent items
- * @return Collection of ExternalConsent items mapped to list of groups with
- * section
- * marker where the item is found
- */
+ * @brief Creates collection of ExternalConsent items known by current
+ * functional
+ * groupings and appropiate section
+ * (disallowed_by_external_consent_entities_on/off) where
+ * is item is being holded. If item is not found it's not included into
+ * collection
+ * @param status Current status containing collection of ExternalConsent items
+ * @return Collection of ExternalConsent items mapped to list of groups with
+ * section
+ * marker where the item is found
+ */
GroupsByExternalConsentStatus GetGroupsWithSameEntities(
const ExternalConsentStatus& status) OVERRIDE;
/**
- * @brief Gets collection of links device-to-application from device_data
- * section of policy table if there any application records present, i.e. if
- * any specific user consent is present
- * @return Collection of device-to-application links
- */
+ * @brief Gets collection of links device-to-application from device_data
+ * section of policy table if there any application records present, i.e. if
+ * any specific user consent is present
+ * @return Collection of device-to-application links
+ */
std::map<std::string, std::string> GetKnownLinksFromPT() OVERRIDE;
/**
- * @brief Sets groups permissions affected by customer connectivity settings
- * entities status, i.e. groups assigned to particular application on
- * particular device which have same entities as current ExternalConsent status
- * @param permissions Groups permissions which result current ExternalConsent
- * status
- */
+ * @brief Sets groups permissions affected by customer connectivity settings
+ * entities status, i.e. groups assigned to particular application on
+ * particular device which have same entities as current ExternalConsent
+ * status
+ * @param permissions Groups permissions which result current ExternalConsent
+ * status
+ */
void SetExternalConsentForApp(const PermissionConsent& permissions) OVERRIDE;
#ifdef BUILD_TESTS
- utils::SharedPtr<policy_table::Table> GetPT() const {
+ std::shared_ptr<policy_table::Table> GetPT() const {
return pt_;
}
#endif
@@ -736,6 +849,14 @@ class CacheManager : public CacheManagerInterface {
void OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) OVERRIDE;
+ /**
+ * @brief Method for separate standard vehicle data items from custom
+ * @param full vehicle data items during PTU
+ * @return array with only custom vehicle items
+ */
+ static policy_table::VehicleDataItems CollectCustomVDItems(
+ const policy_table::VehicleDataItems& vd_items);
+
private:
std::string currentDateTime();
struct AppHMITypeToString {
@@ -754,6 +875,24 @@ class CacheManager : public CacheManagerInterface {
*/
void CheckSnapshotInitialization();
+ /**
+ * @brief Calculates difference between two provided custom vehicle data items
+ * @param items_before list of vehicle data items before PTU was applied
+ * @param items_after list of vehicle data items after PTU was applied
+ * @return list with calculated difference or empty list if two input lists
+ * are equal
+ */
+ policy_table::VehicleDataItems CalculateCustomVdItemsDiff(
+ const policy_table::VehicleDataItems& items_before,
+ const policy_table::VehicleDataItems& items_after) const;
+
+ /**
+ * @brief Sets the custom vehicle data items
+ * @param removed_items list of vehicle data items to set
+ */
+ void SetRemovedCustomVdItems(
+ const policy_table::VehicleDataItems& removed_items);
+
void PersistData();
/**
@@ -781,16 +920,27 @@ class CacheManager : public CacheManagerInterface {
const std::string& policy_app_id,
policy::Permissions& permission);
+ EncryptionRequired GetAppEncryptionRequiredFlag(
+ const std::string& application_policy_name) const OVERRIDE;
+
+ EncryptionRequired GetFunctionalGroupingEncryptionRequiredFlag(
+ const std::string& functional_group) const OVERRIDE;
+
+ void GetApplicationParams(
+ const std::string& application_name,
+ policy_table::ApplicationParams& application_policies) const OVERRIDE;
+
private:
- utils::SharedPtr<policy_table::Table> pt_;
- utils::SharedPtr<policy_table::Table> snapshot_;
- utils::SharedPtr<PTRepresentation> backup_;
- utils::SharedPtr<PTExtRepresentation> ex_backup_;
+ std::shared_ptr<policy_table::Table> pt_;
+ std::shared_ptr<policy_table::Table> snapshot_;
+ std::shared_ptr<PTRepresentation> backup_;
+ std::shared_ptr<PTExtRepresentation> ex_backup_;
bool update_required;
typedef std::set<std::string> UnpairedDevices;
UnpairedDevices is_unpaired_;
+ policy_table::VehicleDataItems removed_custom_vd_items_;
- mutable sync_primitives::Lock cache_lock_;
+ mutable sync_primitives::RecursiveLock cache_lock_;
sync_primitives::Lock unpaired_lock_;
typedef std::map<std::string, Permissions> AppCalculatedPermissions;
@@ -910,6 +1060,24 @@ class CacheManager : public CacheManagerInterface {
void MergeCFM(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt);
+ /**
+ * @brief MergeVD allows to merge VehicleDataItems section by
+ *definite rules.
+ *
+ * The rules are:
+ * 1. If vehicle_data_items key is not presented in the updated PolicyTable,
+ * update for VehicleDataItems should be ignored.
+ * 2. If vehicle_data_items presented in updated PolicyTable, the
+ * VehicleDataItems in the database (LocalPT) should be overwritten with
+ * updated data.
+ *
+ * @param new_pt the policy table loaded from updated preload JSON file.
+ *
+ * @param pt the exists database
+ */
+ void MergeVD(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt);
+
void InitBackupThread();
/**
@@ -940,12 +1108,28 @@ class CacheManager : public CacheManagerInterface {
~BackgroundBackuper();
virtual void threadMain();
virtual void exitThreadMain();
+
+ /**
+ * @brief Notifies BackgroundBackuper thread that new data is available and
+ * new backup iteration should be scheduled
+ */
void DoBackup();
+ /**
+ * @brief Waits for BackgroundBackuper thread finish its own backup
+ * iteration. If currently no backup iteration in progress - function just
+ * returns the control back
+ */
+ void WaitForBackupIsDone();
+
private:
void InternalBackup();
CacheManager* cache_manager_;
sync_primitives::ConditionalVariable backup_notifier_;
+ sync_primitives::ConditionalVariable backup_done_;
+ sync_primitives::Lock backup_done_lock_;
+
+ std::atomic_bool backup_is_in_progress_;
volatile bool stop_flag_;
volatile bool new_data_available_;
diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
index 1d74780f19..3e3de694d6 100644
--- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h
@@ -35,13 +35,14 @@
#include <string>
#include <vector>
+#include "boost/optional.hpp"
#include "policy/policy_table/types.h"
#include "policy/pt_representation.h"
-#include "utils/shared_ptr.h"
-#include "policy/usage_statistics/counter.h"
-#include "policy/policy_types.h"
+
#include "policy/policy_settings.h"
+#include "policy/policy_types.h"
+#include "policy/usage_statistics/counter.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -161,9 +162,138 @@ class CacheManagerInterface {
virtual bool SecondsBetweenRetries(std::vector<int>& seconds) = 0;
/**
- * @brief Get information about vehicle
+ * @brief Gets copy of current policy table data
+ * @return policy_table as json object
+ */
+ virtual Json::Value GetPolicyTableData() const = 0;
+
+ /**
+ * @brief Gets vehicle data items
+ * @return Structure with vehicle data items
+ */
+ virtual const std::vector<policy_table::VehicleDataItem> GetVehicleDataItems()
+ const = 0;
+
+ /**
+ * @brief Gets vehicle data items removed after the last PTU
+ * @return List of removed vehicle data items
+ */
+ virtual std::vector<policy_table::VehicleDataItem>
+ GetRemovedVehicleDataItems() const = 0;
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
+ * @brief Get a list of enabled local applications
+ * @return enabled_apps List filled with the policy app id of each enabled
+ * local application
+ */
+ virtual std::vector<std::string> GetEnabledLocalApps() const = 0;
+
+ /**
+ * @brief Get app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id policy app id
+ * @param out_app_properties application properties
+ * @return true if application presents in database, otherwise - false
+ */
+ virtual bool GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const = 0;
+
+ /**
+ * Initializes a new cloud application with default policies
+ * Then adds cloud specific policies
+ * @param app_id application id
+ * @return true if success
+ */
+ virtual void InitCloudApp(const std::string& policy_app_id) = 0;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) = 0;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) = 0;
+
+ /**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 0;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const = 0;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Returns state of the lock screen that could be able to be dismissed
+ * while connected to SDL, allowing users the ability to interact with the
+ * app.
+ * @return bool True if lock screen can be dismissed.
+ */
+ virtual const boost::optional<bool> LockScreenDismissalEnabledState()
+ const = 0;
+
+ /**
+ * @brief Returns lock screen warning message. In case when specified language
+ * is absent in policy table will be returned message on default language
+ * ("en-us"). Otherwise returns uninitialized boost::optional<std::string>
+ * @return std::string Lock screen warning message
*/
- virtual const VehicleInfo GetVehicleInfo() const = 0;
+ virtual const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const = 0;
/**
* @brief Allows to update 'vin' field in module_meta table.
@@ -186,7 +316,7 @@ class CacheManagerInterface {
virtual std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
const std::string& language,
- const std::string& active_hmi_language) = 0;
+ const std::string& active_hmi_language) const = 0;
/**
* @brief Get list of URL to send PTS to
@@ -194,18 +324,19 @@ class CacheManagerInterface {
* return them otherwise default URLs.
*/
virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
*
- * @return url which point to the resourse where lock screen icon could be
+ * @return url which point to the resourse where icon could be
*obtained.
*/
- virtual std::string GetLockScreenIconUrl() const = 0;
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
/**
* @brief Get allowed number of notifications
@@ -237,7 +368,7 @@ class CacheManagerInterface {
* device_info, statistics, excluding user messages
* @return Generated structure for obtaining Json string.
*/
- virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() = 0;
+ virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() = 0;
/**
* Applies policy table to the current table
@@ -304,6 +435,12 @@ class CacheManagerInterface {
policy_table::FunctionalGroupings& groups) = 0;
/**
+ * @brief Get policy app names from PT
+ * @return container of strings representing policy application names
+ */
+ virtual const policy_table::Strings GetPolicyAppIDs() const = 0;
+
+ /**
* Checks if the application is represented in policy table
* @param app_id application id
* @return true if application is represented in policy table
@@ -754,9 +891,9 @@ class CacheManagerInterface {
virtual std::string GetCertificate() const = 0;
/**
- * @brief Sets decrypted certificate in policy table
- * @param certificate content of certificate
- */
+ * @brief Sets decrypted certificate in policy table
+ * @param certificate content of certificate
+ */
virtual void SetDecryptedCertificate(const std::string& certificate) = 0;
/**
@@ -781,34 +918,35 @@ class CacheManagerInterface {
virtual ExternalConsentStatus GetExternalConsentEntities() = 0;
/**
- * @brief Creates collection of ExternalConsent items known by current
- * functional
- * groupings and appropiate section
- * (disallowed_by_external_consent_entities_on/off) where
- * is item is being holded
- * @param status Current status containing collection of ExternalConsent items
- * @return Collection of ExternalConsent items mapped to list of groups with
- * section
- * marker where the item is found
- */
+ * @brief Creates collection of ExternalConsent items known by current
+ * functional
+ * groupings and appropiate section
+ * (disallowed_by_external_consent_entities_on/off) where
+ * is item is being holded
+ * @param status Current status containing collection of ExternalConsent items
+ * @return Collection of ExternalConsent items mapped to list of groups with
+ * section
+ * marker where the item is found
+ */
virtual GroupsByExternalConsentStatus GetGroupsWithSameEntities(
const ExternalConsentStatus& status) = 0;
/**
- * @brief Gets collection of links device-to-application from device_data
- * section of policy table if there any application records present, i.e. if
- * any specific user consent is present
- * @return Collection of device-to-application links
- */
+ * @brief Gets collection of links device-to-application from device_data
+ * section of policy table if there any application records present, i.e. if
+ * any specific user consent is present
+ * @return Collection of device-to-application links
+ */
virtual std::map<std::string, std::string> GetKnownLinksFromPT() = 0;
/**
- * @brief Sets groups permissions affected by customer connectivity settings
- * entities status, i.e. groups assigned to particular application on
- * particular device which have same entities as current ExternalConsent status
- * @param permissions Groups permissions which result current ExternalConsent
- * status
- */
+ * @brief Sets groups permissions affected by customer connectivity settings
+ * entities status, i.e. groups assigned to particular application on
+ * particular device which have same entities as current ExternalConsent
+ * status
+ * @param permissions Groups permissions which result current ExternalConsent
+ * status
+ */
virtual void SetExternalConsentForApp(
const PermissionConsent& permissions) = 0;
@@ -821,18 +959,49 @@ class CacheManagerInterface {
virtual void OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) = 0;
+ /**
+ * @brief GetAppEncryptionRequiredFlag retrieves encryption required flag
+ * for
+ * given application
+ * @param application policy application name
+ * @return optional object containing encryption required flag
+ */
+ virtual rpc::Optional<rpc::Boolean> GetAppEncryptionRequiredFlag(
+ const std::string& application_policy_name) const = 0;
+
+ /**
+ * @brief GetFunctionalGroupingEncryptionRequiredFlag retrieves encryption
+ * required flag
+ * for
+ * given functional grouping
+ * @param functional_group policy functional group name
+ * @return optional object containing encryption required flag
+ */
+ virtual rpc::Optional<rpc::Boolean>
+ GetFunctionalGroupingEncryptionRequiredFlag(
+ const std::string& functional_group) const = 0;
+
+ /**
+ * @brief retreives application params
+ * @param application_name policy applicatoin name
+ * @param application_params application params
+ */
+ virtual void GetApplicationParams(
+ const std::string& application_name,
+ policy_table::ApplicationParams& application_params) const = 0;
+
#ifdef BUILD_TESTS
/**
- * @brief GetPT allows to obtain SharedPtr to PT.
+ * @brief GetPT allows to obtain std::shared_ptr to PT.
* Used ONLY in Unit tests
- * @return SharedPTR to PT
+ * @return std::shared_ptr to PT
*
*/
- virtual utils::SharedPtr<policy_table::Table> GetPT() const = 0;
+ virtual std::shared_ptr<policy_table::Table> GetPT() const = 0;
#endif
};
-typedef utils::SharedPtr<CacheManagerInterface> CacheManagerInterfaceSPtr;
+typedef std::shared_ptr<CacheManagerInterface> CacheManagerInterfaceSPtr;
} // namespace policy
diff --git a/src/components/policy/policy_external/include/policy/policy_helper.h b/src/components/policy/policy_external/include/policy/policy_helper.h
index e399b44719..69ba8806d4 100644
--- a/src/components/policy/policy_external/include/policy/policy_helper.h
+++ b/src/components/policy/policy_external/include/policy/policy_helper.h
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_HELPER_H_
#include "policy/policy_table/functions.h"
-#include "utils/shared_ptr.h"
+
#include "policy/policy_types.h"
namespace policy {
@@ -85,8 +85,8 @@ bool operator!=(const policy_table::ApplicationParams& first,
*/
struct CheckAppPolicy {
CheckAppPolicy(PolicyManagerImpl* pm,
- const utils::SharedPtr<policy_table::Table> update,
- const utils::SharedPtr<policy_table::Table> snapshot,
+ const std::shared_ptr<policy_table::Table> update,
+ const std::shared_ptr<policy_table::Table> snapshot,
CheckAppPolicyResults& out_results);
bool operator()(const AppPoliciesValueType& app_policy);
@@ -100,7 +100,8 @@ struct CheckAppPolicy {
* @param result Result of check of updated policy
*/
void SetPendingPermissions(const AppPoliciesValueType& app_policy,
- PermissionsCheckResult result) const;
+ PermissionsCheckResult result,
+ AppPermissions& permissions_diff) const;
/**
* @brief Analyzes updated application policy whether any changes received. If
* yes - provides appropriate result code
@@ -128,6 +129,15 @@ struct CheckAppPolicy {
bool HasNewGroups(const AppPoliciesValueType& app_policy,
policy_table::Strings* new_groups = NULL) const;
/**
+ * @brief Checks whether updated application policy contains group content
+ * update in compare to current one
+ * @param app_policy Reference to updated application policy
+ * @param updated_groups List of updated groups if any
+ * @return True if updated groups found, otherwise - false
+ */
+ bool HasUpdatedGroups(const policy::AppPoliciesValueType& app_policy,
+ policy_table::Strings* updated_groups = NULL) const;
+ /**
* @brief Checks whether updated policy has groups which require user consent
* @param app_policy Reference to updated application policy
* @return True if has groups requiring user consents, otherwise - false
@@ -200,10 +210,35 @@ struct CheckAppPolicy {
*/
bool IsRequestSubTypeChanged(const AppPoliciesValueType& app_policy) const;
+ /**
+ * @brief IsEncryptionRequiredFlagChanged check if encryption_needed flag was
+ * changed for application or application groups
+ * @param app_policy application policies
+ * @return true if encryption_needed state was changed otherwise - false
+ */
+ bool IsEncryptionRequiredFlagChanged(
+ const AppPoliciesValueType& app_policy) const;
+
+ /**
+ * @brief Helper function that inserts permissions into app_permissions_diff_
+ * map.
+ * udpated
+ * @param app_policy Reference to updated application policy
+ * @param permissions_diff Reference to app permissions to be inserted into
+ * map.
+ * @return void
+ */
+ void InsertPermission(const std::string& app_id,
+ const AppPermissions& permissions_diff);
+
+ bool IsAppPropertiesChanged(const AppPoliciesValueType& app_policy) const;
+
+ bool IsAppPropertiesProvided(const AppPoliciesValueType& app_policy) const;
+
private:
PolicyManagerImpl* pm_;
- const utils::SharedPtr<policy_table::Table> update_;
- const utils::SharedPtr<policy_table::Table> snapshot_;
+ const std::shared_ptr<policy_table::Table> update_;
+ const std::shared_ptr<policy_table::Table> snapshot_;
CheckAppPolicyResults& out_results_;
};
@@ -230,13 +265,13 @@ struct FillActionsForAppPolicies {
*/
struct FillNotificationData {
/**
- * @brief Constructor
- * @param data Output structure with filled data
- * @param group_state Consent of the group processed by instance
- * @param undefined_group_consent Defines how to treat 'undefined' consent
- * @param does_require_user_consent Specifies whether processed group requires
- * user consent
- */
+ * @brief Constructor
+ * @param data Output structure with filled data
+ * @param group_state Consent of the group processed by instance
+ * @param undefined_group_consent Defines how to treat 'undefined' consent
+ * @param does_require_user_consent Specifies whether processed group requires
+ * user consent
+ */
FillNotificationData(Permissions& data,
GroupConsent group_state,
GroupConsent undefined_group_consent,
@@ -255,8 +290,26 @@ struct FillNotificationData {
const std::set<Parameter>& target);
void InitRpcKeys(const std::string& rpc_name);
bool RpcParametersEmpty(RpcPermissions& rpc);
- bool IsSectionEmpty(ParameterPermissions& permissions,
- const std::string& section);
+
+ /**
+ * @brief Checks if specific section in specified permissions is empty
+ * @param permissions reference to the permissions structure
+ * @param section reference to the section name
+ * @return true if specified section in permissions is empty otherwise returns
+ * false
+ */
+ bool IsSectionEmpty(const ParameterPermissions& permissions,
+ const std::string& section) const;
+
+ /**
+ * @brief Checks if at least one parameter is allowed for the specified
+ * permissions
+ * @param permissions reference to the permissions structure
+ * @return true if at least one parameter is allowed for the specified
+ * permissions otherwise returns false
+ */
+ bool IsSomeParameterAllowed(const ParameterPermissions& permissions) const;
+
std::string current_key_;
Permissions& data_;
const bool does_require_user_consent_;
@@ -276,6 +329,14 @@ struct ProcessFunctionalGroup {
private:
GroupConsent GetGroupState(const std::string& group_name);
+ /*
+ * @brief Fills encryption required flags for all rpcs in functional group
+ * @param encryption_required Optional object containing encryption required
+ * flag
+ */
+ void FillEncryptionFlagForRpcs(
+ const policy_table::Rpc& rpcs,
+ const policy::EncryptionRequired encryption_required);
const policy_table::FunctionalGroupings& fg_;
const std::vector<FunctionalGroupPermission>& group_permissions_;
Permissions& data_;
diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
index 67756c053d..5c55be50d1 100644
--- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
@@ -34,16 +34,17 @@
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_MANAGER_IMPL_H_
#include <list>
-#include "utils/shared_ptr.h"
-#include "utils/lock.h"
+
+#include "policy/access_remote.h"
+#include "policy/access_remote_impl.h"
+#include "policy/cache_manager_interface.h"
#include "policy/policy_manager.h"
#include "policy/policy_table.h"
-#include "policy/cache_manager_interface.h"
-#include "policy/update_status_manager.h"
#include "policy/policy_table/functions.h"
+#include "policy/update_status_manager.h"
#include "policy/usage_statistics/statistics_manager.h"
-#include "policy/access_remote.h"
-#include "policy/access_remote_impl.h"
+#include "utils/lock.h"
+#include "utils/timer.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -54,7 +55,47 @@ class PolicyManagerImpl : public PolicyManager {
public:
PolicyManagerImpl();
explicit PolicyManagerImpl(bool in_memory);
+ /*
+ * \param policy_app_id policy app id
+ * \return true if the app need encryption
+ */
+ bool AppNeedEncryption(const std::string& policy_app_id) const OVERRIDE;
+
+ /*
+ * \param policy_app_id policy app id
+ * \return Optional app need encryption
+ */
+ const rpc::Optional<rpc::Boolean> GetAppEncryptionRequired(
+ const std::string& policy_app_id) const OVERRIDE;
+
+ /*
+ * \param policy_app_id policy app id
+ * \return groups that exist for app
+ */
+ const std::vector<std::string> GetFunctionalGroupsForApp(
+ const std::string& policy_app_id) const OVERRIDE;
+ const std::vector<std::string> GetApplicationPolicyIDs() const OVERRIDE;
+
+ /*
+ * \param policy_group group
+ * \return true if the group need encryption
+ */
+ bool FunctionGroupNeedEncryption(
+ const std::string& policy_group) const OVERRIDE;
+
+ /*
+ * \param policy_group group\
+ * \return RPCs that exists in group
+ */
+ const std::vector<std::string> GetRPCsForFunctionGroup(
+ const std::string& group) const OVERRIDE;
+ /*
+ * \param function_id function id
+ * \return policy function name
+ */
+ const std::string GetPolicyFunctionName(
+ const uint32_t function_id) const OVERRIDE;
/**
* @brief set_listener set new policy listener instance
* @param listener new policy listener
@@ -86,8 +127,10 @@ class PolicyManagerImpl : public PolicyManager {
* @param pt_content PTU as binary string
* @return true if successfully
*/
- bool LoadPT(const std::string& file,
- const BinaryMessage& pt_content) OVERRIDE;
+ PtProcessingResult LoadPT(const std::string& file,
+ const BinaryMessage& pt_content) OVERRIDE;
+
+ void OnPTUFinished(const PtProcessingResult ptu_result) OVERRIDE;
/**
* @brief Resets Policy Table
@@ -109,9 +152,9 @@ class PolicyManagerImpl : public PolicyManager {
* @param out_end_points output vector of urls
*/
void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
/**
* @brief PTU is needed, for this PTS has to be formed and sent.
@@ -122,6 +165,7 @@ class PolicyManagerImpl : public PolicyManager {
* @brief Check if specified RPC for specified application
* has permission to be executed in specified HMI Level
* and also its permitted params.
+ * @param device_id device identifier
* @param app_id Id of application provided during registration
* @param hmi_level Current HMI Level of application
* @param rpc Name of RPC
@@ -129,7 +173,8 @@ class PolicyManagerImpl : public PolicyManager {
* @param result containing flag if HMI Level is allowed
* and list of allowed params.
*/
- void CheckPermissions(const PTString& app_id,
+ void CheckPermissions(const PTString& device_id,
+ const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
const RPCParams& rpc_params,
@@ -148,6 +193,11 @@ class PolicyManagerImpl : public PolicyManager {
*/
void KmsChanged(int kilometers) OVERRIDE;
+ const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
+
+ const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const OVERRIDE;
+
/**
* @brief Increments counter of ignition cycles
*/
@@ -159,6 +209,8 @@ class PolicyManagerImpl : public PolicyManager {
*/
std::string ForcePTExchange() OVERRIDE;
+ void StopRetrySequence() OVERRIDE;
+
/**
* @brief Exchange by user request
* @return Current status of policy table
@@ -173,8 +225,10 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Resets retry sequence
+ * @param send_event - if true corresponding event is sent to
+ * UpdateStatusManager
*/
- void ResetRetrySequence() OVERRIDE;
+ void ResetRetrySequence(const ResetRetryCountType reset_type) OVERRIDE;
/**
* @brief Gets timeout to wait before next retry updating PT
@@ -202,11 +256,13 @@ class PolicyManagerImpl : public PolicyManager {
void OnExceededTimeout() OVERRIDE;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- * @return url which point to the resourse where lock screen icon could be
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
+ *
+ * @return url which point to the resourse where icon could be
*obtained.
*/
- std::string GetLockScreenIconUrl() const OVERRIDE;
+ std::string GetIconUrl(const std::string& policy_app_id) const OVERRIDE;
/**
* @brief Handler of PTS sending out
@@ -253,12 +309,15 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Update Application Policies as reaction
* on User allowing/disallowing device this app is running on.
+ * @param device_handle device identifier
* @param app_id Unique application id
* @param is_device_allowed true if user allowing device otherwise false
* @return true if operation was successful
*/
- bool ReactOnUserDevConsentForApp(const std::string& app_id,
- const bool is_device_allowed) OVERRIDE;
+ bool ReactOnUserDevConsentForApp(
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string& app_id,
+ const bool is_device_allowed) OVERRIDE;
/**
* @brief Retrieves data from app_policies about app on its registration:
@@ -301,12 +360,14 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Get default HMI level for application
+ * @param device_id device identifier
* @param policy_app_id Unique application id
* @param default_hmi Default HMI level for application or empty, if value
* was not set
* @return true, if succedeed, otherwise - false
*/
- bool GetDefaultHmi(const std::string& policy_app_id,
+ bool GetDefaultHmi(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi) const OVERRIDE;
/**
@@ -351,9 +412,11 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Return device id, which hosts specific application
+ * @param device_id device identifier
* @param policy_app_id Application id, which is required to update device id
*/
std::string& GetCurrentDeviceId(
+ const transport_manager::DeviceHandle& device_id,
const std::string& policy_app_id) const OVERRIDE;
/**
@@ -373,13 +436,6 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& language) OVERRIDE;
/**
- * @brief Runs necessary operations, which is depends on external system
- * state, e.g. getting system-specific parameters which are need to be
- * filled into policy table
- */
- void OnSystemReady() OVERRIDE;
-
- /**
* @brief Get number of notification by priority
* @param priority Specified priority
* @return notification number
@@ -395,11 +451,12 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Gets specific application permissions changes since last policy
* table update
+ * @param device_id device identifier
* @param policy_app_id Unique application id
* @return Permissions changes
*/
AppPermissions GetAppPermissionsChanges(
- const std::string& policy_app_id) OVERRIDE;
+ const std::string& device_id, const std::string& policy_app_id) OVERRIDE;
/**
* @brief Removes specific application permissions changes
@@ -409,10 +466,11 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Send OnPermissionsUpdated for choosen application
+ * @param device_id device identifier
* @param application_id Unique application id
*/
void SendNotificationOnPermissionsUpdated(
- const std::string& application_id) OVERRIDE;
+ const std::string& device_id, const std::string& application_id) OVERRIDE;
/**
* @brief Removes unpaired device records and related records from DB
@@ -443,20 +501,24 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Adds, application to the db or update existed one
* run PTU if policy update is necessary for application.
+ * @param device_id device identifier
* @param application_id Unique application id
* @param hmi_types application HMI types
* @return function that will notify update manager about new application
*/
StatusNotifier AddApplication(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) OVERRIDE;
/**
* @brief Assigns new HMI types for specified application
+ * @param device_handle device identifier
* @param application_id Unique application id
* @param hmi_types new HMI types list
*/
- void SetDefaultHmiTypes(const std::string& application_id,
+ void SetDefaultHmiTypes(const transport_manager::DeviceHandle& device_handle,
+ const std::string& application_id,
const std::vector<int>& hmi_types) OVERRIDE;
/**
@@ -472,7 +534,7 @@ class PolicyManagerImpl : public PolicyManager {
* @brief Setter for access_remote instance
* @param access_remote pointer to new access_remote instance
*/
- void set_access_remote(utils::SharedPtr<AccessRemote> access_remote) OVERRIDE;
+ void set_access_remote(std::shared_ptr<AccessRemote> access_remote) OVERRIDE;
/**
* @brief Sends notification about application HMI level changed
@@ -532,11 +594,13 @@ class PolicyManagerImpl : public PolicyManager {
*/
void OnAppsSearchCompleted(const bool trigger_ptu) OVERRIDE;
+ void UpdatePTUReadyAppsCount(const uint32_t new_app_count) OVERRIDE;
+
/**
- * @brief Get state of request types for given application
- * @param policy_app_id Unique application id
- * @return request type state
- */
+ * @brief Get state of request types for given application
+ * @param policy_app_id Unique application id
+ * @return request type state
+ */
RequestType::State GetAppRequestTypesState(
const std::string& policy_app_id) const OVERRIDE;
@@ -550,33 +614,136 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Gets request types for application
+ * @param device_handle device identifier
* @param policy_app_id Unique application id
* @return request types of application
*/
const std::vector<std::string> GetAppRequestTypes(
+ const transport_manager::DeviceHandle& device_handle,
const std::string policy_app_id) const OVERRIDE;
/**
- * @brief Gets request subtypes for application
- * @param policy_app_id Unique application id
- * @return request subtypes of application
- */
+ * @brief Gets request subtypes for application
+ * @param policy_app_id Unique application id
+ * @return request subtypes of application
+ */
const std::vector<std::string> GetAppRequestSubTypes(
const std::string& policy_app_id) const OVERRIDE;
/**
- * @brief Get information about vehicle
- * @return vehicle information
+ * @brief Gets copy of current policy table data
+ * @return policy_table as json object
+ */
+ Json::Value GetPolicyTableData() const OVERRIDE;
+
+ /**
+ * @brief Gets vehicle data items
+ * @return Structure with vehicle data items
+ */
+ const std::vector<policy_table::VehicleDataItem> GetVehicleDataItems()
+ const OVERRIDE;
+
+ std::vector<policy_table::VehicleDataItem> GetRemovedVehicleDataItems()
+ const OVERRIDE;
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
*/
- const VehicleInfo GetVehicleInfo() const OVERRIDE;
+ void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const OVERRIDE;
+
+ /**
+ * @brief Get a list of enabled local applications
+ * @return enabled_apps List filled with the policy app id of each enabled
+ * local application
+ */
+ std::vector<std::string> GetEnabledLocalApps() const OVERRIDE;
+
+ bool GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const OVERRIDE;
+
+ /**
+ * @ brief Initialize new cloud app in the policy table
+ * @ param policy_app_id Application ID
+ */
+ void InitCloudApp(const std::string& policy_app_id) OVERRIDE;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) OVERRIDE;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) OVERRIDE;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) OVERRIDE;
+
+ /**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) OVERRIDE;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) OVERRIDE;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) OVERRIDE;
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ void GetAppServiceParameters(const std::string& policy_app_id,
+ policy_table::AppServiceParameters*
+ app_service_parameters) const OVERRIDE;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ * @return bool true if allowed
+ */
+ bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const OVERRIDE;
/**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
* succesfully registered on mobile device.
- * It will send OnAppPermissionSend notification and will try to start PTU. *
+ * It will send OnAppPermissionSend notification and will try to start PTU.
+ *
+ * @param device_id device identifier
* @param application_id registered application.
*/
- void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE;
+ void OnAppRegisteredOnMobile(const std::string& device_id,
+ const std::string& application_id) OVERRIDE;
void OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) OVERRIDE;
@@ -619,7 +786,7 @@ class PolicyManagerImpl : public PolicyManager {
* @return Pair of policy application id and application url id from the
* urls vector
*/
- AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) OVERRIDE;
+ DEPRECATED AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) OVERRIDE;
/**
* @brief Checks if there is existing URL in the EndpointUrls vector with
@@ -665,14 +832,11 @@ class PolicyManagerImpl : public PolicyManager {
}
/**
- * @brief Setter for send_on_update_sent_out and wrong_ptu_update_received
+ * @brief Setter for send_on_update_sent_out
* @param send_on_update_sent_out new value of this flag
- * @param wrong_ptu_update_received new value of this flag
*/
- inline void SetSendOnUpdateFlags(const bool send_on_update_sent_out,
- const bool wrong_ptu_update_received) {
+ inline void SetSendOnUpdateFlags(const bool send_on_update_sent_out) {
send_on_update_sent_out_ = send_on_update_sent_out;
- wrong_ptu_update_received_ = wrong_ptu_update_received;
}
#endif // BUILD_TESTS
@@ -709,19 +873,48 @@ class PolicyManagerImpl : public PolicyManager {
void Add(const std::string& app_id,
usage_statistics::AppStopwatchId type,
int32_t timespan_seconds) OVERRIDE;
+
// Interface StatisticsManager (end)
+ /**
+ * @brief Check whether allowed retry sequence count is exceeded
+ * @return bool value - true is allowed count is exceeded, otherwise - false
+ */
+ bool IsAllowedRetryCountExceeded() const OVERRIDE;
+
+ /**
+ * @brief Finish PTU retry requence
+ */
+ void RetrySequenceFailed() OVERRIDE;
+
+ /**
+ * @brief In EXTERNAL_PROPRIETARY_MODE PTU sequence is driven by HMI and
+ * begins with OnSystemRequest from HMI. Following function is called when
+ * this notification is received to track number of PTU retries and react
+ * accordingly once allowed retry count is exceeded
+ */
+ void OnSystemRequestReceived() OVERRIDE;
+
+ void OnLocalAppAdded() OVERRIDE;
+
+ bool IsNewApplication(const std::string& application_id) const OVERRIDE;
+
protected:
/**
* @brief Parse policy table content and convert to PT object
* @param pt_content binary content of PT
* @return pointer to converted PT
*/
- virtual utils::SharedPtr<policy_table::Table> Parse(
+ virtual std::shared_ptr<policy_table::Table> Parse(
const BinaryMessage& pt_content);
private:
/**
+ * @brief Increments PTU retry index for external flow
+ */
+ void IncrementRetryIndex();
+
+ /**
* @brief Checks if PT update should be started and schedules it if needed
*/
void CheckTriggers();
@@ -736,8 +929,19 @@ class PolicyManagerImpl : public PolicyManager {
* @return Collection per-application results
*/
CheckAppPolicyResults CheckPermissionsChanges(
- const utils::SharedPtr<policy_table::Table> update,
- const utils::SharedPtr<policy_table::Table> snapshot);
+ const std::shared_ptr<policy_table::Table> update,
+ const std::shared_ptr<policy_table::Table> snapshot);
+
+ /**
+ * @brief Compares current policies to the updated one.
+ * Trigger actions in case if certain fields after udate was changes.
+ * This function should be called after PT update.
+ * Actions require already updated policy table
+ * @param update Shared pointer to policy table udpate
+ * @param snapshot Shared pointer to old copy of policy table
+ */
+ void CheckPermissionsChangesAfterUpdate(const policy_table::Table& update,
+ const policy_table::Table& snapshot);
/**
* @brief Processes results from policy table update analysis done by
@@ -791,29 +995,26 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Allows to process case when added application is not present in
* policy db.
+ * @param device_id device identifier
* @param policy application id.
* @param cuuren consent for application's device.
*/
- void AddNewApplication(const std::string& application_id,
+ void AddNewApplication(const std::string& device_id,
+ const std::string& application_id,
DeviceConsent device_consent);
/**
* @brief Allows to process case when added application is already
* in policy db.
+ * @param device_id device identifier
* @param policy application id.
* @param cuuren consent for application's device.
*/
- void PromoteExistedApplication(const std::string& application_id,
+ void PromoteExistedApplication(const std::string& device_id,
+ const std::string& application_id,
DeviceConsent device_consent);
/**
- * @brief Check if certain application already in policy db.
- * @param policy application id.
- * @return true if application presents false otherwise.
- */
- bool IsNewApplication(const std::string& application_id) const;
-
- /**
* Checks existing and permissions of AppStorageFolder
* @return true if AppStorageFolder exists and has permissions read/write
*/
@@ -821,9 +1022,12 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Checks whether need ask the permission of users
+ * @param device_id device identifier
+ * @param appid policy application id
* @return true if user consent is needed
*/
- virtual bool IsConsentNeeded(const std::string& app_id);
+ virtual bool IsConsentNeeded(const std::string& device_id,
+ const std::string& app_id);
/**
* @brief Changes isConsentNeeded for app pending permissions, in case
@@ -860,10 +1064,15 @@ class PolicyManagerImpl : public PolicyManager {
* @param type policy table type
* @return true if policy table valid, otherwise false
*/
- bool IsPTValid(utils::SharedPtr<policy_table::Table> policy_table,
+ bool IsPTValid(std::shared_ptr<policy_table::Table> policy_table,
policy_table::PolicyTableType type) const;
/**
+ * @brief Check that new applications for PTU were registered
+ */
+ bool HasApplicationForPTU() const;
+
+ /**
* @brief Get resulting RPCs permissions for application which started on
* specific device
* @param device_id Device id
@@ -891,23 +1100,36 @@ class PolicyManagerImpl : public PolicyManager {
void SendAppPermissionsChanged(const std::string& device_id,
const std::string& application_id) OVERRIDE;
+ void SendOnAppPropertiesChangeNotification(
+ const std::string& policy_app_id) const OVERRIDE;
+
/**
- * @brief Gets all allowed module types
- * @param policy_app_id unique identifier of application
- * @param modules list of allowed module types
- * @return true if application has allowed modules
- */
+ * @brief notify listener of updated auth token for a given policy id
+ * @param policy_app_id the app id that has an updated auth token
+ */
+ void SendAuthTokenUpdated(const std::string policy_app_id);
+
+ /**
+ * @brief Gets all allowed module types
+ * @param policy_app_id unique identifier of application
+ * @param modules list of allowed module types
+ * @return true if application has allowed modules
+ */
bool GetModuleTypes(const std::string& policy_app_id,
std::vector<std::string>* modules) const OVERRIDE;
+ void ResetTimeout() OVERRIDE;
+
/**
* @brief Notify application about its permissions changes by preparing and
* sending OnPermissionsChanged notification
+ * @param device_id device identifier
* @param policy_app_id Application id to send notification to
* @param app_group_permissons Current permissions for groups assigned to
* application
*/
void NotifyPermissionsChanges(
+ const std::string& device_id,
const std::string& policy_app_id,
const std::vector<FunctionalGroupPermission>& app_group_permissions);
@@ -932,11 +1154,13 @@ class PolicyManagerImpl : public PolicyManager {
* user consents (if any) and ExternalConsent consents (if any) will be
* updated
* appropiately to current ExternalConsent status stored by policy table
+ * @param device_id device identifier
* @param application_id Application id
* @param processing_policy Defines whether consents timestamps must be
* considered or external consents take over
*/
void ProcessExternalConsentStatusForApp(
+ const std::string& device_id,
const std::string& application_id,
const ConsentProcessingPolicy processing_policy);
/**
@@ -964,16 +1188,26 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Notifies system by sending OnAppPermissionChanged notification
+ * @param device_id device identifier
* @param app_policy Reference to application policy
*/
- void NotifySystem(const AppPoliciesValueType& app_policy) const;
+ void NotifySystem(const std::string& device_id,
+ const AppPoliciesValueType& app_policy) const;
/**
* @brief Sends OnPermissionChange notification to application if its
* currently registered
+ * @param device_id device identifier
* @param app_policy Reference to application policy
*/
- void SendPermissionsToApp(const AppPoliciesValueType& app_policy);
+ void SendPermissionsToApp(const std::string& device_id,
+ const AppPoliciesValueType& app_policy);
+
+ /**
+ * @brief Resumes all policy actions for all apps, suspended during
+ * PTU applying
+ */
+ void ResumePendingAppPolicyActions();
/**
* @brief Gets groups names from collection of groups permissions
@@ -1017,7 +1251,7 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief pointer to AccessRemote instance for working with RC applications
*/
- utils::SharedPtr<AccessRemote> access_remote_;
+ std::shared_ptr<AccessRemote> access_remote_;
/**
* @brief lock guard for protecting applications list access
@@ -1053,9 +1287,14 @@ class PolicyManagerImpl : public PolicyManager {
uint32_t retry_sequence_index_;
/**
+ * @brief Applications pending count ready for PTU
+ */
+ uint32_t applications_pending_ptu_count_;
+
+ /**
* @brief Lock for guarding retry sequence
*/
- sync_primitives::Lock retry_sequence_lock_;
+ mutable sync_primitives::Lock retry_sequence_lock_;
/**
* @brief Device id, which is used during PTU handling for specific
@@ -1082,19 +1321,42 @@ class PolicyManagerImpl : public PolicyManager {
friend struct ProccessAppGroups;
/**
- * @brief Flag for notifying that invalid PTU was received
- */
- bool wrong_ptu_update_received_;
-
- /**
* @brief Flag for notifying that PTU was started
*/
bool send_on_update_sent_out_;
+ std::vector<std::string> app_properties_changed_list_;
+
/**
* @brief Flag for notifying that invalid PTU should be triggered
*/
bool trigger_ptu_;
+
+ /**
+ * @brief Flag for notifying that PTU was requested
+ */
+ bool ptu_requested_;
+
+ /**
+ * @brief Flag that indicates whether a PTU sequence (including retries) is in
+ * progress
+ */
+ bool is_ptu_in_progress_;
+
+ typedef std::list<std::pair<std::string, AppPoliciesValueType> >
+ PendingAppPolicyActionsList;
+
+ /**
+ * @brief List containing device_id and pending permissions structure pairs
+ * which can be processed later on demand
+ */
+ PendingAppPolicyActionsList notify_system_list_;
+
+ /**
+ * @brief List containing device_id and pending permissions structure pairs
+ * which can be processed later on demand
+ */
+ PendingAppPolicyActionsList send_permissions_list_;
};
} // namespace policy
diff --git a/src/components/policy/policy_external/include/policy/policy_table.h b/src/components/policy/policy_external/include/policy/policy_table.h
index ecbd56c2e4..8f0d5f7efb 100644
--- a/src/components/policy/policy_external/include/policy/policy_table.h
+++ b/src/components/policy/policy_external/include/policy/policy_table.h
@@ -33,16 +33,15 @@
#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TABLE_H_
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TABLE_H_
-#include "utils/shared_ptr.h"
-#include "policy/pt_representation.h"
#include "policy/pt_ext_representation.h"
+#include "policy/pt_representation.h"
namespace policy {
class PolicyTable {
public:
PolicyTable();
- explicit PolicyTable(utils::SharedPtr<PTRepresentation> pt_data);
+ explicit PolicyTable(std::shared_ptr<PTRepresentation> pt_data);
virtual ~PolicyTable();
/**
@@ -50,12 +49,12 @@ class PolicyTable {
* actual class storing policy table.
* @return PTRepresentation* Policy Table Content Handler
*/
- utils::SharedPtr<PTRepresentation> pt_data() const {
+ std::shared_ptr<PTRepresentation> pt_data() const {
return pt_data_;
}
private:
- utils::SharedPtr<PTRepresentation> pt_data_;
+ std::shared_ptr<PTRepresentation> pt_data_;
};
} // namespace policy
diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h
index 2804166f17..a74eb1f886 100644
--- a/src/components/policy/policy_external/include/policy/policy_table/enums.h
+++ b/src/components/policy/policy_external/include/policy/policy_table/enums.h
@@ -35,129 +35,12 @@
#include <string>
+#include "generated_HMI_API_policy_types.h"
+#include "generated_MOBILE_API_policy_types.h"
+
namespace rpc {
namespace policy_table_interface_base {
-enum Priority {
- P_EMERGENCY,
- P_NAVIGATION,
- P_VOICECOM,
- P_COMMUNICATION,
- P_NORMAL,
- P_NONE,
-};
-
-bool IsValidEnum(Priority val);
-const char* EnumToJsonString(Priority val);
-bool EnumFromJsonString(const std::string& literal, Priority* result);
-
-enum HmiLevel {
- HL_BACKGROUND,
- HL_FULL,
- HL_LIMITED,
- HL_NONE,
-};
-bool IsValidEnum(HmiLevel val);
-const char* EnumToJsonString(HmiLevel val);
-bool EnumFromJsonString(const std::string& literal, HmiLevel* result);
-
-enum Parameter {
- P_GPS,
- P_SPEED,
- P_ENGINETORQUE,
- P_EXTERNALTEMPERATURE,
- P_TURNSIGNAL,
- P_FUELLEVEL,
- P_FUELLEVEL_STATE,
- P_HEADLAMPSTATUS,
- P_INSTANTFUELCONSUMPTION,
- P_FUELRANGE,
- P_ODOMETER,
- P_TIREPRESSURE,
- P_WIPERSTATUS,
- P_VIN,
- P_ACCPEDALPOSITION,
- P_BELTSTATUS,
- P_DRIVERBRAKING,
- P_PRNDL,
- P_RPM,
- P_STEERINGWHEELANGLE,
- P_ENGINEOILLIFE,
- P_MYKEY,
- P_AIRBAGSTATUS,
- P_BODYINFORMATION,
- P_CLUSTERMODESTATUS,
- P_DEVICESTATUS,
- P_EMERGENCYEVENT,
- P_ECALLINFO,
- P_ABS_STATE,
- P_FUEL_RANGE,
- P_TIRE_PRESSURE_VALUE,
- P_TPMS,
- P_LONGTITUDE_DEGREES,
- P_LATITUDE_DEGREES,
- P_LOCATION_NAME,
- P_LOCATION_DESCRIPTION,
- P_ADDRESS_LINES,
- P_PHONE_NUMBER,
- P_LOCATION_IMAGE,
- P_DELIVERY_MODE,
- P_TIMESTAMP,
- P_ADDRESS,
- P_EMPTY // Added to allow empty parameters handling
-};
-
-bool IsValidEnum(Parameter val);
-const char* EnumToJsonString(Parameter val);
-bool EnumFromJsonString(const std::string& literal, Parameter* result);
-
-enum AppHMIType {
- AHT_DEFAULT,
- AHT_COMMUNICATION,
- AHT_MEDIA,
- AHT_MESSAGING,
- AHT_NAVIGATION,
- AHT_INFORMATION,
- AHT_SOCIAL,
- AHT_BACKGROUND_PROCESS,
- AHT_TESTING,
- AHT_SYSTEM,
- AHT_PROJECTION,
- AHT_REMOTE_CONTROL,
-};
-bool IsValidEnum(AppHMIType val);
-const char* EnumToJsonString(AppHMIType val);
-bool EnumFromJsonString(const std::string& literal, AppHMIType* result);
-
-enum RequestType {
- RT_HTTP,
- RT_FILE_RESUME,
- RT_AUTH_REQUEST,
- RT_AUTH_CHALLENGE,
- RT_AUTH_ACK,
- RT_PROPRIETARY,
- RT_QUERY_APPS,
- RT_LAUNCH_APP,
- RT_LOCK_SCREEN_ICON_URL,
- RT_TRAFFIC_MESSAGE_CHANNEL,
- RT_DRIVER_PROFILE,
- RT_VOICE_SEARCH,
- RT_NAVIGATION,
- RT_PHONE,
- RT_CLIMATE,
- RT_SETTINGS,
- RT_VEHICLE_DIAGNOSTICS,
- RT_EMERGENCY,
- RT_MEDIA,
- RT_FOTA,
- RT_OEM_SPECIFIC,
- RT_EMPTY // Added to allow empty Request Types handling
-};
-
-bool IsValidEnum(RequestType val);
-const char* EnumToJsonString(RequestType val);
-bool EnumFromJsonString(const std::string& literal, RequestType* result);
-
enum Input {
I_GUI,
I_VUI,
@@ -166,14 +49,6 @@ bool IsValidEnum(Input val);
const char* EnumToJsonString(Input val);
bool EnumFromJsonString(const std::string& literal, Input* result);
-enum ModuleType {
- MT_CLIMATE,
- MT_RADIO,
-};
-bool IsValidEnum(ModuleType val);
-const char* EnumToJsonString(ModuleType val);
-bool EnumFromJsonString(const std::string& literal, ModuleType* result);
-
extern const std::string kDefaultApp;
extern const std::string kPreDataConsentApp;
extern const std::string kDeviceApp;
diff --git a/src/components/policy/policy_external/include/policy/policy_table/policy_enum_schema_factory.h b/src/components/policy/policy_external/include/policy/policy_table/policy_enum_schema_factory.h
new file mode 100644
index 0000000000..4871179342
--- /dev/null
+++ b/src/components/policy/policy_external/include/policy/policy_table/policy_enum_schema_factory.h
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2017, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TABLE_POLICY_ENUM_SCHEMA_FACTORY_H
+#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TABLE_POLICY_ENUM_SCHEMA_FACTORY_H
+
+#include <memory>
+#include <string>
+
+#include "smart_objects/smart_schema.h"
+
+namespace rpc {
+namespace policy_table_interface_base {
+
+class EnumSchemaItemFactory {
+ public:
+ /**
+ * @brief Get enum schema from enum name
+ * Implementation of this function should be generated from MOBILE_API.xml
+ * @param enum_name enum name to get schema factory for
+ * @return shared pointer to schema factory or empty shared pointer if
+ * enum_name is wrong
+ */
+ static std::shared_ptr<ns_smart_device_link::ns_smart_objects::ISchemaItem>
+ Get(const std::string& enum_name);
+
+ static bool IsRPCSpecVehicleDataType(const std::string& vd_name);
+};
+
+} // namespace policy_table_interface_base
+} // namespace rpc
+
+#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TABLE_POLICY_ENUM_SCHEMA_FACTORY_H
diff --git a/src/components/policy/policy_external/include/policy/policy_table/types.h b/src/components/policy/policy_external/include/policy/policy_table/types.h
index b062fa0966..11c76bdd68 100644
--- a/src/components/policy/policy_external/include/policy/policy_table/types.h
+++ b/src/components/policy/policy_external/include/policy/policy_table/types.h
@@ -37,7 +37,9 @@
#include "utils/macro.h"
#include "policy/policy_table/enums.h"
+#include "policy/policy_table/policy_enum_schema_factory.h"
#include "rpc_base/rpc_message.h"
+#include "utils/helpers.h"
namespace Json {
class Value;
@@ -48,10 +50,13 @@ struct AppLevel;
struct ApplicationParams;
struct ConsentRecords;
struct DeviceParams;
+struct EndpointProperty;
struct MessageLanguages;
struct MessageString;
struct RpcParameters;
struct Rpcs;
+struct AppServiceHandledRpc;
+struct AppServiceInfo;
} // namespace policy_table_interface_base
} // namespace rpc
@@ -67,16 +72,18 @@ typedef Array<Enum<AppHMIType>, 0, 255> AppHMITypes;
typedef Array<Enum<HmiLevel>, 0, 4> HmiLevels;
-typedef Array<Enum<Parameter>, 0, 100> Parameters;
+typedef Array<String<0, 255>, 0, 100> Parameters;
typedef Map<RpcParameters, 0, UINT_MAX> Rpc;
-typedef Array<String<10, 255>, 1, 3> URL;
+typedef Array<String<10, INT_MAX>, 1, 3> URL;
typedef Map<URL, 1, 255> URLList;
typedef Map<URLList, 1, 255> ServiceEndpoints;
+typedef Map<EndpointProperty, 0, 255> ServiceEndpointProperties;
+
typedef uint8_t NumberOfNotificationsType;
typedef Map<Integer<NumberOfNotificationsType, 0, 255>, 0, 7>
NumberOfNotificationsPerMinute;
@@ -104,13 +111,58 @@ typedef Array<Enum<RequestType>, 0, 255> RequestsTypeArray;
typedef Strings RequestSubTypes;
+typedef String<0, 255> AppServiceType;
+typedef String<0, 255> AppServiceName;
+typedef Array<AppServiceName, 0, 255> AppServiceNames;
+typedef Array<AppServiceHandledRpc, 0, 255> AppServiceHandledRpcs;
+typedef Map<AppServiceInfo, 0, 255> AppServiceParameters;
+typedef Integer<int32_t, 0, INT32_MAX> FunctionIDInt;
+
typedef Map<Strings, 0, 255> RemoteRpcs;
typedef Map<RemoteRpcs, 0, 255> AccessModules;
typedef Array<Enum<ModuleType>, 0, 255> ModuleTypes;
-
typedef AppHMIType AppHmiType;
typedef std::vector<AppHMIType> AppHmiTypes;
+struct AppServiceHandledRpc : CompositeType {
+ public:
+ FunctionIDInt function_id;
+
+ public:
+ AppServiceHandledRpc();
+ ~AppServiceHandledRpc();
+ AppServiceHandledRpc(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+ void ReportErrors(rpc::ValidationReport* report__) const;
+
+ private:
+ bool Validate() const;
+};
+
+struct AppServiceInfo : CompositeType {
+ public:
+ Optional<AppServiceNames> service_names;
+ AppServiceHandledRpcs handled_rpcs;
+
+ public:
+ AppServiceInfo();
+ ~AppServiceInfo();
+ AppServiceInfo(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+ void ReportErrors(rpc::ValidationReport* report__) const;
+
+ private:
+ bool Validate() const;
+};
+
struct RequestTypes : public RequestsTypeArray {
RequestTypes();
explicit RequestTypes(Json::Value* value);
@@ -177,6 +229,19 @@ struct ApplicationParams : PolicyBase {
Optional<Integer<uint16_t, 0, 65225> > memory_kb;
Optional<Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms;
mutable Optional<ModuleTypes> moduleType;
+ Optional<String<0, 65535> > certificate;
+ // Cloud application params
+ Optional<Enum<HybridAppPreference> > hybrid_app_preference;
+ Optional<String<0, 255> > endpoint;
+ Optional<Boolean> enabled;
+ Optional<String<0, 65535> > auth_token;
+ Optional<String<0, 255> > cloud_transport_type;
+ Optional<String<0, 65535> > icon_url;
+
+ // App Service Params
+ Optional<AppServiceParameters> app_service_parameters;
+ Optional<Boolean> allow_unknown_rpc_passthrough;
+ Optional<Boolean> encryption_required;
public:
ApplicationParams();
@@ -271,6 +336,7 @@ struct Rpcs : CompositeType {
disallowed_by_external_consent_entities_on;
Optional<DisallowedByExternalConsentEntities>
disallowed_by_external_consent_entities_off;
+ Optional<Boolean> encryption_required;
public:
Rpcs();
@@ -288,6 +354,24 @@ struct Rpcs : CompositeType {
bool Validate() const;
};
+struct EndpointProperty : CompositeType {
+ public:
+ Optional<String<0, 100> > version;
+
+ EndpointProperty();
+ ~EndpointProperty();
+ explicit EndpointProperty(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport* report__) const;
+ void SetPolicyTableType(PolicyTableType pt_type) OVERRIDE;
+
+ private:
+ bool Validate() const;
+};
+
struct ModuleConfig : CompositeType {
public:
Integer<uint8_t, 0, 255> exchange_after_x_ignition_cycles;
@@ -296,6 +380,7 @@ struct ModuleConfig : CompositeType {
Integer<uint16_t, 0, 65535> timeout_after_x_seconds;
SecondsBetweenRetries seconds_between_retries;
ServiceEndpoints endpoints;
+ Optional<ServiceEndpointProperties> endpoint_properties;
NumberOfNotificationsPerMinute notifications_per_minute_by_priority;
Optional<String<0, 100> > vehicle_make;
Optional<String<0, 100> > vehicle_model;
@@ -303,6 +388,10 @@ struct ModuleConfig : CompositeType {
Optional<String<0, 10> > preloaded_date;
Optional<String<0, 65535> > certificate;
Optional<Boolean> preloaded_pt;
+ Optional<Boolean> full_app_id_supported;
+ Optional<Boolean> lock_screen_dismissal_enabled;
+
+ static const std::string kDefaultOemMappingServiceName;
public:
ModuleConfig();
@@ -312,6 +401,7 @@ struct ModuleConfig : CompositeType {
uint16_t timeout_after_x_seconds,
const SecondsBetweenRetries& seconds_between_retries,
const ServiceEndpoints& endpoints,
+ const ServiceEndpointProperties& endpoint_properties,
const NumberOfNotificationsPerMinute&
notifications_per_minute_by_priority);
~ModuleConfig();
@@ -538,6 +628,88 @@ struct DeviceParams : CompositeType {
bool Validate() const;
};
+struct VehicleDataItem : CompositeType {
+ public:
+ static const std::vector<std::string> kPODTypes;
+
+ static const std::string kInteger;
+ static const std::string kStruct;
+ static const std::string kString;
+ static const std::string kFloat;
+ static const std::string kDouble;
+ static const std::string kBoolean;
+ static const std::string kName;
+ static const std::string kParams;
+
+ String<1, 255> name;
+ String<0, 255> type;
+ String<1, 255> key;
+ Boolean mandatory;
+ Optional<Array<VehicleDataItem, 0, 255> > params;
+
+ Optional<Boolean> array;
+ Optional<String<0, 255> > since;
+ Optional<String<0, 255> > until;
+ Optional<Boolean> removed;
+ Optional<Boolean> deprecated;
+ Optional<Float<-INT32_MAX, INT32_MAX> > minvalue;
+ Optional<Float<-INT32_MAX, INT32_MAX> > maxvalue;
+ Optional<Integer<uint32_t, 0, UINT32_MAX> > minsize;
+ Optional<Integer<uint32_t, 0, UINT32_MAX> > maxsize;
+ Optional<Integer<uint32_t, 0, UINT32_MAX> > minlength;
+ Optional<Integer<uint32_t, 0, UINT_MAX> > maxlength;
+
+ VehicleDataItem();
+ VehicleDataItem(const VehicleDataItem& policy_table);
+ explicit VehicleDataItem(const Json::Value* value__);
+
+ bool operator==(const VehicleDataItem& vd);
+
+ ~VehicleDataItem();
+
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_not_empty() const;
+ void ReportErrors(rpc::ValidationReport* report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+ /**
+ * @brief Validates type of vehicle data item according to
+ * POD types and generated from API enums.
+ * @return true if type is valid.
+ */
+ bool ValidateTypes() const;
+ bool IsPrimitiveType() const;
+ bool ValidateNaming(std::string str) const;
+
+ private:
+ bool Validate() const;
+};
+
+typedef Array<VehicleDataItem, 0, 255> VehicleDataItems;
+
+struct VehicleData : CompositeType {
+ public:
+ Optional<String<0, 100> > schema_version;
+ Optional<VehicleDataItems> schema_items;
+
+ VehicleData();
+ VehicleData(const VehicleData& vehicle_data);
+ VehicleData(const Json::Value* value__);
+ ~VehicleData();
+
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport* report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+ private:
+ bool Validate() const;
+};
+
struct PolicyTable : CompositeType {
public:
ApplicationPoliciesSection app_policies_section;
@@ -547,6 +719,7 @@ struct PolicyTable : CompositeType {
Optional<ModuleMeta> module_meta;
Optional<UsageAndErrorCounts> usage_and_error_counts;
Optional<DeviceData> device_data;
+ Optional<VehicleData> vehicle_data;
public:
PolicyTable();
diff --git a/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml
index 401a5dcb9f..af7effd97f 100644
--- a/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml
+++ b/src/components/policy/policy_external/include/policy/policy_table_interface_ext.xml
@@ -38,6 +38,7 @@
<element name="vin" />
<element name="accPedalPosition" />
<element name="beltStatus" />
+ <element name="electronicParkBrakeStatus" />
<element name="driverBraking" />
<element name="prndl" />
<element name="rpm" />
@@ -55,6 +56,7 @@
<element name="fuelRange" />
<element name="tirePressureValue" />
<element name="tpms" />
+ <element name="cloudAppVehicleID" />
</enum>
<enum name="AppHMIType">
@@ -69,6 +71,12 @@
<element name="TESTING" />
<element name="SYSTEM" />
</enum>
+
+ <enum name="HybridAppPreference">
+ <element name="MOBILE" />
+ <element name="CLOUD" />
+ <element name="BOTH" />
+ </enum>
<!-- Common parameters end -->
<!-- app_policies section start -->
@@ -91,14 +99,27 @@
<param name="memory_kb" type="Integer" minvalue="1" maxvalue="65225" mandatory="false"/>
<param name="watchdog_timer_ms" type="Integer" minvalue="1"
maxvalue="65225" mandatory="false"/>
- <param name="certificate" type="String" minlength="0" maxlength="255"
+ <param name="certificate" type="String" minlength="0" maxlength="65535"
+ mandatory="false" />
+ <param name="endpoint" type="String" minlength="0" maxlength="255" mandatory="false" />
+ <param name="enabled" type="Boolean" mandatory="false" />
+ <param name="auth_token" type="String" minlength="0" maxlength="65535"
+ mandatory="false" />
+ <param name="cloud_transport_type" type="String" minlength="0" maxlength="255"
+ mandatory="false" />
+ <param name="hybrid_app_preference" type="HybridAppPreference" mandatory="false" />
+ <param name="icon_url" type="String" minlength="0" maxlength="65535"
mandatory="false" />
+ <param name="service_name" type="String" mandatory="false" />
+ <param name="service_type" type="String" mandatory="false" />
+ <param name="handled_rpcs" array="true" mandatory="false" />
+ <param name="allow_unknown_rpc_passthrough" type="Boolean" mandatory="false" />
+ <param name="encryption_required" type="Boolean" mandatory="false"/>
</struct>
<typedef name="HmiLevels" type="HmiLevel" array="true"
maxsize="4" />
- <typedef name="Parameters" type="Parameter" array="true"
- maxsize="24" />
+ <typedef name="Parameters" type="Parameter" array="true"/>
<struct name="RpcParameters">
<!-- maxsizes are equal to number of currently known elements of
@@ -115,6 +136,7 @@
<param name="user_consent_prompt" type="String" minlegth="1"
maxlength="255" mandatory="false"/>
<param name="rpcs" type="Rpc" null_values_allowed="true"/>
+ <param name="encryption_required" type="Boolean" mandatory="false"/>
</struct>
<!-- app_policies section end -->
@@ -139,6 +161,7 @@
<struct name="ModuleConfig">
<param name="device_certificates" type="String" minlength="1" maxlength="100" mandatory="false" map="true" minsize="1" maxsize="255" />
<param name="preloaded_pt" type="Boolean" mandatory="false" />
+ <param name="full_app_id_supported" type="Boolean" mandatory="false" />
<param name="exchange_after_x_ignition_cycles" type="Integer"
maxvalue="255" />
<param name="exchange_after_x_kilometers" type="Integer"
diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h
index 9682b3d58d..7e8abd5989 100644
--- a/src/components/policy/policy_external/include/policy/policy_types.h
+++ b/src/components/policy/policy_external/include/policy/policy_types.h
@@ -34,14 +34,16 @@
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TYPES_H_
#include <algorithm>
-#include <string>
-#include <vector>
#include <map>
+#include <memory>
#include <set>
+#include <string>
#include <utility>
-#include "utils/shared_ptr.h"
-#include "utils/helpers.h"
+#include <vector>
+
+#include "policy/policy_table/types.h"
#include "transport_manager/common.h"
+#include "utils/helpers.h"
namespace policy {
@@ -73,19 +75,22 @@ enum PolicyTableStatus {
StatusUpToDate = 0,
StatusUpdatePending,
StatusUpdateRequired,
- StatusUnknown
+ StatusUnknown,
+ StatusProcessingSnapshot
};
// Code generator uses String class name, so this typedef was renamed to PTSring
typedef std::string PTString;
typedef std::vector<uint8_t> BinaryMessage;
-typedef utils::SharedPtr<BinaryMessage> BinaryMessageSptr;
+typedef std::shared_ptr<BinaryMessage> BinaryMessageSptr;
typedef std::string HMILevel;
typedef std::string Parameter;
typedef std::string RpcName;
typedef std::set<std::string> RPCParams;
+typedef rpc::Optional<rpc::Boolean> EncryptionRequired;
+
typedef std::map<std::string, std::set<policy::HMILevel> > HMIPermissions;
struct ParameterPermissions
: std::map<std::string, std::set<policy::Parameter> > {
@@ -101,6 +106,7 @@ struct ParameterPermissions
struct RpcPermissions {
HMIPermissions hmi_permissions;
ParameterPermissions parameter_permissions;
+ EncryptionRequired require_encryption;
};
typedef std::map<RpcName, RpcPermissions> Permissions;
@@ -117,11 +123,13 @@ typedef std::vector<std::string> StringArray;
enum PermitResult { kRpcAllowed = 0, kRpcDisallowed, kRpcUserDisallowed };
+enum class ResetRetryCountType { kResetWithStatusUpdate = 0, kResetInternally };
+
/**
- * @struct Stores result of check:
- * if HMI Level was allowed for RPC to work in
- * and list of parameters allowed for RPC if specified in PT.
- */
+ * @struct Stores result of check:
+ * if HMI Level was allowed for RPC to work in
+ * and list of parameters allowed for RPC if specified in PT.
+ */
struct CheckPermissionResult {
CheckPermissionResult() : hmi_level_permitted(kRpcDisallowed) {}
@@ -224,8 +232,11 @@ struct DeviceInfo {
using namespace helpers;
static const std::string bluetooth("BLUETOOTH");
static const std::string wifi("WIFI");
+ static const std::string webengine("WEBENGINE_WEBSOCKET");
if (Compare<std::string, EQ, ONE>(deviceType, bluetooth, wifi)) {
connection_type.assign("BTMAC");
+ } else if (Compare<std::string, EQ, ONE>(deviceType, webengine)) {
+ connection_type.assign("");
}
}
};
@@ -444,11 +455,13 @@ struct ApplicationPolicyActions {
ApplicationPolicyActions()
: is_notify_system(false)
, is_send_permissions_to_app(false)
- , is_consent_needed(false) {}
+ , is_consent_needed(false)
+ , app_properties_changed(false) {}
bool is_notify_system;
bool is_send_permissions_to_app;
bool is_consent_needed;
+ bool app_properties_changed;
};
/**
@@ -504,10 +517,12 @@ enum PermissionsCheckResult {
RESULT_NICKNAME_MISMATCH,
RESULT_PERMISSIONS_REVOKED,
RESULT_CONSENT_NEEDED,
- RESULT_CONSENT_NOT_REQIURED,
+ RESULT_CONSENT_NOT_REQUIRED,
RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED,
RESULT_REQUEST_TYPE_CHANGED,
- RESULT_REQUEST_SUBTYPE_CHANGED
+ RESULT_REQUEST_SUBTYPE_CHANGED,
+ RESULT_ENCRYPTION_REQUIRED_FLAG_CHANGED,
+ RESULT_APP_PROPERTIES_CHANGED
};
/**
@@ -530,6 +545,68 @@ enum ConsentPriorityType { kUserConsentPrio, kExternalConsentPrio };
*/
enum ConsentProcessingPolicy { kTimestampBased, kExternalConsentBased };
+/**
+ * @brief The AppProperties struct contains application properties
+ */
+struct AppProperties {
+ AppProperties()
+ : endpoint()
+ , certificate()
+ , enabled(false)
+ , auth_token()
+ , transport_type()
+ , hybrid_app_preference() {}
+
+ AppProperties(std::string endpoint,
+ std::string certificate,
+ bool enabled,
+ std::string auth_token,
+ std::string transport_type,
+ std::string hybrid_app_preference)
+ : endpoint(endpoint)
+ , certificate(certificate)
+ , enabled(enabled)
+ , auth_token(auth_token)
+ , transport_type(transport_type)
+ , hybrid_app_preference(hybrid_app_preference) {}
+
+ /**
+ * @brief endpoint Filled with the endpoint used to connect to the cloud
+ * application.
+ * @note should be absent for local applications
+ */
+ std::string endpoint;
+
+ /**
+ * @brief certificate Filled with the certificate used for creation
+ * of a secure connection to the cloud application
+ */
+ std::string certificate;
+
+ /**
+ * @brief enabled Whether or not the app is enabled
+ */
+ bool enabled;
+
+ /**
+ * @brief auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ */
+ std::string auth_token;
+
+ /**
+ * @brief transport_type Filled with the transport type used by the
+ * cloud/local application (ex. "WSS")
+ */
+ std::string transport_type;
+
+ /**
+ * @brief hybrid_app_preference Filled with the hybrid app preference for the
+ * application set by the user
+ */
+ std::string hybrid_app_preference;
+};
+
} // namespace policy
#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TYPES_H_
diff --git a/src/components/policy/policy_external/include/policy/pt_ext_representation.h b/src/components/policy/policy_external/include/policy/pt_ext_representation.h
index 0aa284b707..f03947268a 100644
--- a/src/components/policy/policy_external/include/policy/pt_ext_representation.h
+++ b/src/components/policy/policy_external/include/policy/pt_ext_representation.h
@@ -280,10 +280,10 @@ class PTExtRepresentation : public virtual PTRepresentation {
virtual bool GetFunctionalGroupNames(policy::FunctionalGroupNames& names) = 0;
/**
- * @brief Set app policy to pre_DataConsented policy
- * @param app_id Policy ID of application to be changed
- * @return true, if succeeded, otherwise - false
- */
+ * @brief Set app policy to pre_DataConsented policy
+ * @param app_id Policy ID of application to be changed
+ * @return true, if succeeded, otherwise - false
+ */
virtual bool SetPredataPolicy(const std::string& app_id) = 0;
/**
diff --git a/src/components/policy/policy_external/include/policy/pt_representation.h b/src/components/policy/policy_external/include/policy/pt_representation.h
index 66a9218771..459b689393 100644
--- a/src/components/policy/policy_external/include/policy/pt_representation.h
+++ b/src/components/policy/policy_external/include/policy/pt_representation.h
@@ -33,11 +33,11 @@
#ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_PT_REPRESENTATION_H_
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_PT_REPRESENTATION_H_
-#include <vector>
#include <string>
-#include "policy/policy_types.h"
-#include "policy/policy_table/types.h"
+#include <vector>
#include "policy/policy_settings.h"
+#include "policy/policy_table/types.h"
+#include "policy/policy_types.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -71,14 +71,6 @@ class PTRepresentation {
virtual bool IsPTPreloaded() = 0;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- *
- * @return url which point to the resourse where lock screen icon could be
- *obtained.
- */
- virtual std::string GetLockScreenIconUrl() const = 0;
-
- /**
* @brief Re-creates schema in DB, drops all data
* @return true, if succedeed, otherwise - false
*/
@@ -134,11 +126,6 @@ class PTRepresentation {
virtual bool SecondsBetweenRetries(std::vector<int>* seconds) = 0;
/**
- * @brief Get information about vehicle
- */
- virtual const VehicleInfo GetVehicleInfo() const = 0;
-
- /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
@@ -213,7 +200,7 @@ class PTRepresentation {
* device_info, statistics, excluding user messages
* @return Generated structure for obtaining Json string.
*/
- virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const = 0;
+ virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const = 0;
virtual bool Save(const policy_table::Table& table) = 0;
@@ -268,10 +255,10 @@ class PTRepresentation {
virtual bool IsDefaultPolicy(const std::string& app_id) const = 0;
/**
- * Checks if the application has pre_data policy
- * @param app_id application id
- * @return true if application has pre_data policy
- */
+ * Checks if the application has pre_data policy
+ * @param app_id application id
+ * @return true if application has pre_data policy
+ */
virtual bool IsPredataPolicy(const std::string& app_id) const = 0;
/**
diff --git a/src/components/policy/policy_external/include/policy/ptu_retry_handler.h b/src/components/policy/policy_external/include/policy/ptu_retry_handler.h
new file mode 100644
index 0000000000..79623124e3
--- /dev/null
+++ b/src/components/policy/policy_external/include/policy/ptu_retry_handler.h
@@ -0,0 +1,57 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_PTU_RETRY_HANDLER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_PTU_RETRY_HANDLER_H_
+
+namespace policy {
+
+class PTURetryHandler {
+ public:
+ /**
+ * @brief Check whether allowed retry sequence count is exceeded
+ * @return bool value - true is allowed count is exceeded, otherwise - false
+ */
+ virtual bool IsAllowedRetryCountExceeded() const = 0;
+
+ /**
+ * @brief Begins new retry sequence
+ */
+ virtual void OnSystemRequestReceived() = 0;
+
+ /**
+ * @brief Handle OnSystemRequest from HMI timeout
+ */
+ virtual void RetrySequenceFailed() = 0;
+};
+} // namespace policy
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICIES_PTU_RETRY_HANDLER_H_
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_ext_representation.h b/src/components/policy/policy_external/include/policy/sql_pt_ext_representation.h
index bd2097cfe3..889ede9d20 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_ext_representation.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_ext_representation.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_SQL_PT_EXT_REPRESENTATION_H_
#include <string>
-#include "policy/sql_pt_representation.h"
#include "policy/pt_ext_representation.h"
+#include "policy/sql_pt_representation.h"
namespace policy {
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_queries.h b/src/components/policy/policy_external/include/policy/sql_pt_queries.h
index 646cc7663b..8a3ad1f7df 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_queries.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_queries.h
@@ -49,7 +49,6 @@ extern const std::string kSelectPreloaded;
extern const std::string kIsFirstRun;
extern const std::string kSetNotFirstRun;
extern const std::string kSelectEndpoint;
-extern const std::string kSelectLockScreenIcon;
extern const std::string kSelectModuleConfig;
extern const std::string kSelectEndpoints;
extern const std::string kSelectNotificationsPerMin;
@@ -66,6 +65,9 @@ extern const std::string kSelectNicknames;
extern const std::string kSelectAppTypes;
extern const std::string kSelectRequestTypes;
extern const std::string kSelectRequestSubTypes;
+extern const std::string kSelectAppServiceTypes;
+extern const std::string kSelectAppServiceNames;
+extern const std::string kSelectAppServiceHandledRpcs;
extern const std::string kSelectSecondsBetweenRetries;
extern const std::string kSelectIgnitionCycles;
extern const std::string kSelectKilometers;
@@ -79,9 +81,10 @@ extern const std::string kInsertAppGroup;
extern const std::string kInsertNickname;
extern const std::string kInsertAppType;
extern const std::string kInsertRequestType;
-extern const std::string kInsertOmittedRequestType;
-extern const std::string kInsertOmittedRequestSubType;
extern const std::string kInsertRequestSubType;
+extern const std::string kInsertAppServiceTypes;
+extern const std::string kInsertAppServiceNames;
+extern const std::string kInsertAppServiceHandledRpcs;
extern const std::string kInsertMessageType;
extern const std::string kInsertLanguage;
extern const std::string kInsertMessageString;
@@ -103,6 +106,9 @@ extern const std::string kDeleteAppGroup;
extern const std::string kDeleteApplication;
extern const std::string kDeleteRequestType;
extern const std::string kDeleteRequestSubType;
+extern const std::string kDeleteAppServiceTypes;
+extern const std::string kDeleteAppServiceNames;
+extern const std::string kDeleteAppServiceHandledRpcs;
extern const std::string kDeleteDevice;
extern const std::string kIncrementIgnitionCycles;
extern const std::string kResetIgnitionCycles;
@@ -135,6 +141,21 @@ extern const std::string kDeleteModuleTypes;
extern const std::string kDeleteAllDevices;
extern const std::string kSelectDBVersion;
extern const std::string kUpdateDBVersion;
+extern const std::string kSelectVehicleDataItem;
+extern const std::string kInsertVehicleDataItem;
+extern const std::string kDeleteVehicleDataItems;
+extern const std::string kInsertVehicleDataItemParams;
+extern const std::string kSelectVehicleDataItemParams;
+extern const std::string kDeleteVehicleDataItemParams;
+extern const std::string kSelectVehicleDataItemWithVersion;
+extern const std::string kSelectPrimitiveVehicleDataItems;
+extern const std::string kSelectCompositeVehicleDataItemsKey;
+extern const std::string kSelectOEMMappingVersion;
+extern const std::string kSelectVehicleDataSchemaVersion;
+extern const std::string kInsertVehicleDataSchemaVersion;
+extern const std::string kSelectEndpointProperties;
+extern const std::string kInsertEndpointVersion;
+
} // namespace sql_pt
} // namespace policy
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_representation.h b/src/components/policy/policy_external/include/policy/sql_pt_representation.h
index d56f6aeba2..574806b3fb 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_representation.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_representation.h
@@ -35,15 +35,16 @@
#include <string>
#include <vector>
+#include "policy/policy_table/types.h"
#include "policy/pt_representation.h"
#include "rpc_base/rpc_base.h"
-#include "policy/policy_table/types.h"
namespace policy_table = rpc::policy_table_interface_base;
namespace utils {
namespace dbms {
class SQLDatabase;
+class SQLQuery;
} // namespace dbms
} // namespace utils
@@ -70,8 +71,6 @@ class SQLPTRepresentation : public virtual PTRepresentation {
virtual int TimeoutResponse();
virtual bool SecondsBetweenRetries(std::vector<int>* seconds);
virtual bool RefreshDB();
- virtual const VehicleInfo GetVehicleInfo() const;
-
virtual std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes, const std::string& language);
@@ -85,7 +84,7 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool Clear();
bool Drop();
virtual void WriteDb();
- virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const;
+ virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const;
virtual bool Save(const policy_table::Table& table);
bool GetInitialAppData(const std::string& app_id,
StringArray* nicknames = NULL,
@@ -124,6 +123,9 @@ class SQLPTRepresentation : public virtual PTRepresentation {
policy_table::ConsumerFriendlyMessages* messages) const;
virtual bool GatherApplicationPoliciesSection(
policy_table::ApplicationPoliciesSection* policies) const;
+ virtual bool GatherVehicleDataItems(
+ policy_table::VehicleDataItems* vehicle_data_items) const;
+ virtual bool GatherVehicleData(policy_table::VehicleData* vehicle_data) const;
bool GatherAppGroup(const std::string& app_id,
policy_table::Strings* app_groups) const;
@@ -134,6 +136,9 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool GatherRequestSubType(
const std::string& app_id,
policy_table::RequestSubTypes* request_subtypes) const;
+ bool GatherAppServiceParameters(
+ const std::string& app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const;
bool GatherNickName(const std::string& app_id,
policy_table::Strings* nicknames) const;
@@ -156,6 +161,9 @@ class SQLPTRepresentation : public virtual PTRepresentation {
virtual bool SaveSpecificAppPolicy(
const policy_table::ApplicationPolicies::value_type& app);
virtual bool SaveDevicePolicy(const policy_table::DevicePolicy& device);
+ virtual bool SaveVehicleDataItems(
+ const policy_table::VehicleDataItems& vehicle_data_items);
+ virtual bool SaveVehicleData(const policy_table::VehicleData& vehicle_data);
virtual bool SaveMessageString(const std::string& type,
const std::string& lang,
@@ -172,9 +180,11 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool SaveRequestSubType(
const std::string& app_id,
const policy_table::RequestSubTypes& request_subtypes);
+ bool SaveAppServiceParameters(
+ const std::string& app_id,
+ const policy_table::AppServiceParameters& app_service_parameters);
public:
- virtual std::string GetLockScreenIconUrl() const;
bool UpdateRequired() const;
void SaveUpdateRequired(bool value);
@@ -197,6 +207,26 @@ class SQLPTRepresentation : public virtual PTRepresentation {
virtual bool IsDBVersionActual() const OVERRIDE;
virtual bool UpdateDBVersion() const OVERRIDE;
+ policy_table::VehicleDataItems GetVehicleDataItem(
+ const std::string& name, const std::string& key) const;
+ bool InsertVehicleDataItem(
+ const policy_table::VehicleDataItem& vehicle_data_item);
+ bool VehicleDataItemExists(
+ const policy_table::VehicleDataItem& vehicle_data_item) const;
+
+ /**
+ * @brief Retrieves vehicle data items of type Struct (which contains params)
+ * from the database including these parameters.
+ * @return Array of parameterized VehicleDataItems (including params)
+ */
+ policy_table::VehicleDataItems SelectCompositeVehicleDataItems() const;
+
+ /**
+ * @brief Retrieves vehicle data items of non Struct type from the database.
+ * @return Array of primitive VehicleDataItems
+ */
+ policy_table::VehicleDataItems SelectPrimitiveVehicleDataItems() const;
+
private:
utils::dbms::SQLDatabase* db_;
@@ -214,12 +244,17 @@ class SQLPTRepresentation : public virtual PTRepresentation {
const int32_t GetDBVersion() const;
bool SaveRpcs(int64_t group_id, const policy_table::Rpc& rpcs);
bool SaveServiceEndpoints(const policy_table::ServiceEndpoints& endpoints);
+ bool SaveServiceEndpointProperties(
+ const policy_table::ServiceEndpointProperties& endpoint_properties);
bool SaveSecondsBetweenRetries(
const policy_table::SecondsBetweenRetries& seconds);
bool SaveNumberOfNotificationsPerMinute(
const policy_table::NumberOfNotificationsPerMinute& notifications);
bool SaveMessageType(const std::string& type);
bool SaveLanguage(const std::string& code);
+ policy_table::VehicleDataItem PopulateVDIFromQuery(
+ const utils::dbms::SQLQuery& query) const;
+ bool DeleteVehicleDataItems() const;
bool is_in_memory;
bool SaveExternalConsentEntities(
diff --git a/src/components/policy/policy_external/include/policy/status.h b/src/components/policy/policy_external/include/policy/status.h
index 18789ecf99..f51888c853 100644
--- a/src/components/policy/policy_external/include/policy/status.h
+++ b/src/components/policy/policy_external/include/policy/status.h
@@ -52,6 +52,7 @@ enum UpdateEvent {
kOnResetPolicyTableRequireUpdate,
kOnResetPolicyTableNoUpdate,
kScheduleUpdate,
+ kPendingUpdate,
kScheduleManualUpdate,
kOnResetRetrySequence,
kNoEvent
@@ -75,41 +76,41 @@ class Status {
const policy::PolicyTableStatus enum_status);
/**
- * @brief Destructor
- */
+ * @brief Destructor
+ */
virtual ~Status();
/**
- * @brief Process event by setting next status in case event can affect
- * current status or ignores the event
- * @param manager Status manager pointer
- * @param event Event which needs to be processed
- */
+ * @brief Process event by setting next status in case event can affect
+ * current status or ignores the event
+ * @param manager Status manager pointer
+ * @param event Event which needs to be processed
+ */
virtual void ProcessEvent(UpdateStatusManager* manager,
UpdateEvent event) = 0;
/**
- * @brief Return current status as string value
- * @return Status as string
- */
+ * @brief Return current status as string value
+ * @return Status as string
+ */
const std::string get_status_string() const;
/**
- * @brief Return status as enum value
- * @return Status as enum value
- */
+ * @brief Return status as enum value
+ * @return Status as enum value
+ */
PolicyTableStatus get_status() const;
/**
- * @brief Check whether update is required in terms of status
- * @return True if update is required, otherwise - false
- */
+ * @brief Check whether update is required in terms of status
+ * @return True if update is required, otherwise - false
+ */
virtual bool IsUpdateRequired() const;
/**
- * @brief Check whether update is pending in terms of status
- * @return True if update is pending, otherwise - false
- */
+ * @brief Check whether update is pending in terms of status
+ * @return True if update is pending, otherwise - false
+ */
virtual bool IsUpdatePending() const;
private:
@@ -128,11 +129,11 @@ class UpToDateStatus : public Status {
UpToDateStatus();
/**
- * @brief Process event by setting next status in case event can affect
- * current status or ignores the event
- * @param manager Status manager pointer
- * @param event Event which needs to be processed
- */
+ * @brief Process event by setting next status in case event can affect
+ * current status or ignores the event
+ * @param manager Status manager pointer
+ * @param event Event which needs to be processed
+ */
void ProcessEvent(UpdateStatusManager* manager, UpdateEvent event) OVERRIDE;
};
@@ -147,18 +148,50 @@ class UpdateNeededStatus : public Status {
UpdateNeededStatus();
/**
- * @brief Process event by setting next status in case event can affect
- * current status or ignores the event
- * @param manager Status manager pointer
- * @param event Event which needs to be processed
- */
+ * @brief Process event by setting next status in case event can affect
+ * current status or ignores the event
+ * @param manager Status manager pointer
+ * @param event Event which needs to be processed
+ */
void ProcessEvent(UpdateStatusManager* manager, UpdateEvent event) OVERRIDE;
/**
- * @brief Check whether update is required in terms of status
- * @return True if update is required, otherwise - false
+ * @brief Check whether update is required in terms of status
+ * @return True if update is required, otherwise - false
+ */
+ bool IsUpdateRequired() const OVERRIDE;
+};
+
+/**
+ * @brief The UpdatePendingStatus class represents cases when SDL knows that an
+ * update is required and but before the snapshot is sent to the HMI
*/
+class UpdatePendingStatus : public Status {
+ public:
+ /**
+ * @brief Constructor
+ */
+ UpdatePendingStatus();
+
+ /**
+ * @brief Process event by setting next status in case event can affect
+ * current status or ignores the event
+ * @param manager Status manager pointer
+ * @param event Event which needs to be processed
+ */
+ void ProcessEvent(UpdateStatusManager* manager, UpdateEvent event) OVERRIDE;
+
+ /**
+ * @brief Check whether update is required in terms of status
+ * @return True if update is required, otherwise - false
+ */
bool IsUpdateRequired() const OVERRIDE;
+
+ /**
+ * @brief Check whether update is pending in terms of status
+ * @return True if update is pending, otherwise - false
+ */
+ bool IsUpdatePending() const OVERRIDE;
};
/**
@@ -172,25 +205,25 @@ class UpdatingStatus : public Status {
UpdatingStatus();
/**
- * @brief Process event by setting next status in case event can affect
- * current status or ignores the event
- * @param manager Status manager pointer
- * @param event Event which needs to be processed
- */
+ * @brief Process event by setting next status in case event can affect
+ * current status or ignores the event
+ * @param manager Status manager pointer
+ * @param event Event which needs to be processed
+ */
void ProcessEvent(UpdateStatusManager* manager, UpdateEvent event) OVERRIDE;
/**
- * @brief Check whether update is required in terms of status
- * @return True if update is required, otherwise - false
- */
+ * @brief Check whether update is required in terms of status
+ * @return True if update is required, otherwise - false
+ */
bool IsUpdateRequired() const OVERRIDE;
/**
- * @brief Check whether update is pending in terms of status
- * @return True if update is pending, otherwise - false
- */
+ * @brief Check whether update is pending in terms of status
+ * @return True if update is pending, otherwise - false
+ */
bool IsUpdatePending() const OVERRIDE;
};
-}
+} // namespace policy
#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_STATUS_H_
diff --git a/src/components/policy/policy_external/include/policy/update_status_manager.h b/src/components/policy/policy_external/include/policy/update_status_manager.h
index b663610a5b..018bab7f99 100644
--- a/src/components/policy/policy_external/include/policy/update_status_manager.h
+++ b/src/components/policy/policy_external/include/policy/update_status_manager.h
@@ -34,14 +34,13 @@
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_H_
#include "policy/policy_types.h"
-#include "utils/lock.h"
-#include "utils/threads/thread.h"
-#include "utils/threads/thread_delegate.h"
+#include "policy/status.h"
#include "utils/conditional_variable.h"
#include "utils/lock.h"
#include "utils/logger.h"
#include "utils/macro.h"
-#include "policy/status.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/thread_delegate.h"
namespace policy {
@@ -66,14 +65,14 @@ class UpdateStatusManager {
* @brief Set next status during event processing
* @param status Status shared pointer
*/
- void SetNextStatus(utils::SharedPtr<Status> status);
+ void SetNextStatus(std::shared_ptr<Status> status);
/**
* @brief Set postponed status (will be set after next status) during event
* processing
* @param status Status shared pointer
*/
- void SetPostponedStatus(utils::SharedPtr<Status> status);
+ void SetPostponedStatus(std::shared_ptr<Status> status);
/**
* @brief Sets listener pointer
@@ -93,6 +92,12 @@ class UpdateStatusManager {
void OnUpdateTimeoutOccurs();
/**
+ * @brief Update status for next in queue application
+ * after previous update been has finished
+ */
+ void OnUpdateForNextInQueue();
+
+ /**
* @brief Update status handler for valid PTU receiving
*/
void OnValidUpdateReceived();
@@ -114,15 +119,15 @@ class UpdateStatusManager {
void OnResetRetrySequence();
/**
- * @brief Update status handler on new application registering
+ * @brief Update status handler on existed application registering
+ * @param is_update_required Update necessity flag
*/
- void OnNewApplicationAdded(const DeviceConsent consent);
+ void OnExistedApplicationAdded(const bool is_update_required);
/**
- * @brief Update status handler for policy initialization
- * @param is_update_required Update necessity flag
+ * @brief Update status handler on new application registering
*/
- void OnPolicyInit(bool is_update_required);
+ void OnNewApplicationAdded(const DeviceConsent consent);
/**
* @brief In case application from non-consented device has been registered
@@ -151,6 +156,12 @@ class UpdateStatusManager {
void ScheduleUpdate();
/**
+ * @brief PendingUpdate will change state from Update_Needed
+ * to Update_Pending
+ */
+ void PendingUpdate();
+
+ /**
* @brief ScheduleUpdate allows to schedule next update.
* It will change state to Update_Needed, that's is
* and will not send any notifications about updating to HMI
@@ -180,6 +191,8 @@ class UpdateStatusManager {
*/
bool IsAppsSearchInProgress();
+ void ResetTimeout(uint32_t update_timeout);
+
#ifdef BUILD_TESTS
PolicyTableStatus GetLastUpdateStatus() const {
return current_status_->get_status();
@@ -199,22 +212,23 @@ class UpdateStatusManager {
/**
* @brief Current update status
*/
- utils::SharedPtr<Status> current_status_;
+ std::shared_ptr<Status> current_status_;
/**
* @brief Next status after current to be set
*/
- utils::SharedPtr<Status> next_status_;
+ std::shared_ptr<Status> next_status_;
/**
* @brief Status to be set after 'next' status
*/
- utils::SharedPtr<Status> postponed_status_;
+ std::shared_ptr<Status> postponed_status_;
sync_primitives::Lock status_lock_;
UpdateEvent last_processed_event_;
bool apps_search_in_progress_;
bool app_registered_from_non_consented_device_;
+ bool last_update_was_failed_;
sync_primitives::Lock apps_search_in_progress_lock_;
class UpdateThreadDelegate : public threads::ThreadDelegate {
@@ -227,7 +241,7 @@ class UpdateStatusManager {
volatile uint32_t timeout_;
volatile bool stop_flag_;
- sync_primitives::Lock state_lock_;
+ sync_primitives::RecursiveLock state_lock_;
sync_primitives::ConditionalVariable termination_condition_;
UpdateStatusManager* update_status_manager_;
};
@@ -235,6 +249,6 @@ class UpdateStatusManager {
UpdateThreadDelegate* update_status_thread_delegate_;
threads::Thread* thread_;
};
-}
+} // namespace policy
#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_H_
diff --git a/src/components/policy/policy_external/include/policy/usage_statistics/counter.h b/src/components/policy/policy_external/include/policy/usage_statistics/counter.h
index adaef0eb28..047a545150 100644
--- a/src/components/policy/policy_external/include/policy/usage_statistics/counter.h
+++ b/src/components/policy/policy_external/include/policy/usage_statistics/counter.h
@@ -34,11 +34,11 @@
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_USAGE_STATISTICS_COUNTER_H_
#include <ctime>
-#include "policy/usage_statistics/statistics_manager.h"
#include "policy/usage_statistics/app_stopwatch.h"
-#include "utils/shared_ptr.h"
-#include "utils/timer.h"
+#include "policy/usage_statistics/statistics_manager.h"
+
#include "utils/macro.h"
+#include "utils/timer.h"
namespace usage_statistics {
@@ -46,18 +46,18 @@ using timer::Timer;
class GlobalCounter {
public:
- GlobalCounter(utils::SharedPtr<StatisticsManager> statistics_manager,
+ GlobalCounter(std::shared_ptr<StatisticsManager> statistics_manager,
GlobalCounterId counter_type);
void operator++() const;
private:
GlobalCounterId counter_type_;
- utils::SharedPtr<StatisticsManager> statistics_manager_;
+ std::shared_ptr<StatisticsManager> statistics_manager_;
};
class AppCounter {
public:
- AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager,
+ AppCounter(std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id,
AppCounterId counter_type);
void operator++() const;
@@ -65,12 +65,12 @@ class AppCounter {
private:
std::string app_id_;
AppCounterId counter_type_;
- utils::SharedPtr<StatisticsManager> statistics_manager_;
+ std::shared_ptr<StatisticsManager> statistics_manager_;
};
class AppInfo {
public:
- AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager,
+ AppInfo(std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id,
AppInfoId info_type);
void Update(const std::string& new_info) const;
@@ -78,14 +78,14 @@ class AppInfo {
private:
std::string app_id_;
AppInfoId info_type_;
- utils::SharedPtr<StatisticsManager> statistics_manager_;
+ std::shared_ptr<StatisticsManager> statistics_manager_;
};
class AppStopwatchImpl : public AppStopwatch {
public:
- AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager,
+ AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id);
- AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager,
+ AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id,
std::uint32_t timeout);
~AppStopwatchImpl();
@@ -97,7 +97,7 @@ class AppStopwatchImpl : public AppStopwatch {
// Fields
std::string app_id_;
AppStopwatchId stopwatch_type_;
- utils::SharedPtr<StatisticsManager> statistics_manager_;
+ std::shared_ptr<StatisticsManager> statistics_manager_;
timer::Timer timer_;
const std::uint32_t time_out_;
DISALLOW_COPY_AND_ASSIGN(AppStopwatchImpl);
diff --git a/src/components/policy/policy_external/src/access_remote_impl.cc b/src/components/policy/policy_external/src/access_remote_impl.cc
index d042d8c402..26c8c5e38e 100644
--- a/src/components/policy/policy_external/src/access_remote_impl.cc
+++ b/src/components/policy/policy_external/src/access_remote_impl.cc
@@ -89,7 +89,7 @@ struct ToModuleType {
AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()) {}
-AccessRemoteImpl::AccessRemoteImpl(utils::SharedPtr<CacheManager> cache)
+AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache)
: cache_(cache) {}
bool AccessRemoteImpl::CheckModuleType(const PTString& app_id,
diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc
index 00bb1e4a1c..d8819b6bad 100644
--- a/src/components/policy/policy_external/src/cache_manager.cc
+++ b/src/components/policy/policy_external/src/cache_manager.cc
@@ -33,27 +33,27 @@
#include "policy/cache_manager.h"
#include <algorithm>
-#include <functional>
-#include <ctime>
+#include <boost/algorithm/string.hpp>
#include <cmath>
-#include <utility>
+#include <ctime>
+#include <functional>
#include <string>
+#include <utility>
#include <vector>
-#include "utils/file_system.h"
-#include "utils/helpers.h"
-#include "json/reader.h"
-#include "json/features.h"
#include "json/writer.h"
-#include "utils/logger.h"
+#include "policy/policy_helper.h"
+#include "policy/policy_table/enums.h"
+#include "policy/sql_pt_ext_representation.h"
+#include "rpc_base/rpc_base.h"
#include "utils/date_time.h"
+#include "utils/file_system.h"
#include "utils/gen_hash.h"
+#include "utils/helpers.h"
+#include "utils/jsoncpp_reader_wrapper.h"
+#include "utils/logger.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
-#include "rpc_base/rpc_base.h"
-#include "policy/policy_table/enums.h"
-#include "policy/policy_helper.h"
-#include "policy/sql_pt_ext_representation.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -207,6 +207,21 @@ struct ExternalConsentConsentGroupAppender
}
};
+struct DefaultPolicyUpdater {
+ DefaultPolicyUpdater(const policy_table::ApplicationParams& default_params)
+ : default_params_(default_params) {}
+
+ void operator()(policy_table::ApplicationPolicies::value_type& pt_value) {
+ if (policy::kDefaultId == pt_value.second.get_string()) {
+ pt_value.second = default_params_;
+ pt_value.second.set_to_string(policy::kDefaultId);
+ }
+ }
+
+ private:
+ const policy_table::ApplicationParams& default_params_;
+};
+
} // namespace
namespace policy {
@@ -254,7 +269,7 @@ CacheManager::CacheManager()
, pt_(new policy_table::Table)
, backup_(new SQLPTExtRepresentation())
, update_required(false)
- , cache_lock_(true) {
+ , removed_custom_vd_items_() {
InitBackupThread();
}
@@ -262,8 +277,7 @@ CacheManager::CacheManager(bool in_memory)
: CacheManagerInterface()
, pt_(new policy_table::Table)
, backup_(new SQLPTExtRepresentation(in_memory))
- , update_required(false)
- , cache_lock_(true) {
+ , update_required(false) {
InitBackupThread();
}
@@ -312,6 +326,20 @@ const policy_table::Strings& CacheManager::GetGroups(const PTString& app_id) {
return pt_->policy_table.app_policies_section.apps[app_id].groups;
}
+const policy_table::Strings CacheManager::GetPolicyAppIDs() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ const auto apps = pt_->policy_table.app_policies_section.apps;
+
+ policy_table::Strings policy_app_ids;
+ for (const auto& app : apps) {
+ policy_app_ids.push_back(app.first);
+ }
+
+ return policy_app_ids;
+}
+
bool CacheManager::CanAppKeepContext(const std::string& app_id) const {
CACHE_MANAGER_CHECK(false);
sync_primitives::AutoLock auto_lock(cache_lock_);
@@ -683,6 +711,13 @@ void CacheManager::ProcessUpdate(
initial_policy_iter->second;
*(pt_->policy_table.app_policies_section.apps[app_id].RequestType) =
merged_pt_request_types;
+
+ if (app_id == kDefaultId) {
+ std::for_each(pt_->policy_table.app_policies_section.apps.begin(),
+ pt_->policy_table.app_policies_section.apps.end(),
+ DefaultPolicyUpdater(
+ pt_->policy_table.app_policies_section.apps[app_id]));
+ }
}
bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) {
@@ -718,6 +753,38 @@ bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) {
pt_->policy_table.consumer_friendly_messages.assign_if_valid(
update_pt.policy_table.consumer_friendly_messages);
+ pt_->policy_table.module_config.endpoint_properties =
+ update_pt.policy_table.module_config.endpoint_properties;
+
+ // Apply update for vehicle data
+ if (update_pt.policy_table.vehicle_data.is_initialized()) {
+ policy_table::VehicleDataItems custom_items_before_apply;
+ if (pt_->policy_table.vehicle_data->schema_items.is_initialized()) {
+ custom_items_before_apply =
+ CollectCustomVDItems(*pt_->policy_table.vehicle_data->schema_items);
+ }
+
+ if (!update_pt.policy_table.vehicle_data->schema_items.is_initialized() ||
+ update_pt.policy_table.vehicle_data->schema_items->empty()) {
+ pt_->policy_table.vehicle_data->schema_items =
+ rpc::Optional<policy_table::VehicleDataItems>();
+ } else {
+ policy_table::VehicleDataItems custom_items = CollectCustomVDItems(
+ *update_pt.policy_table.vehicle_data->schema_items);
+
+ pt_->policy_table.vehicle_data->schema_version =
+ update_pt.policy_table.vehicle_data->schema_version;
+ pt_->policy_table.vehicle_data->schema_items =
+ rpc::Optional<policy_table::VehicleDataItems>(custom_items);
+ }
+
+ policy_table::VehicleDataItems custom_items_after_apply =
+ *pt_->policy_table.vehicle_data->schema_items;
+ const auto& items_diff = CalculateCustomVdItemsDiff(
+ custom_items_before_apply, custom_items_after_apply);
+ SetRemovedCustomVdItems(items_diff);
+ }
+
ResetCalculatedPermissions();
Backup();
@@ -728,6 +795,21 @@ bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) {
return true;
}
+policy_table::VehicleDataItems CacheManager::CollectCustomVDItems(
+ const policy_table::VehicleDataItems& vd_items) {
+ policy_table::VehicleDataItems result_items;
+ for (auto& item : vd_items) {
+ const std::string i_name = "VEHICLEDATA_" + std::string(item.name);
+ const std::string vd_name = boost::to_upper_copy<std::string>(i_name);
+ const bool is_standard =
+ policy_table::EnumSchemaItemFactory::IsRPCSpecVehicleDataType(vd_name);
+ if (!is_standard) {
+ result_items.push_back(item);
+ }
+ }
+ return result_items;
+}
+
void CacheManager::GetHMIAppTypeAfterUpdate(
std::map<std::string, StringArray>& app_hmi_types) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -884,9 +966,9 @@ bool CacheManager::HasDeviceSpecifiedConsent(const std::string& device_id,
return false;
}
const std::string consent = is_allowed ? "allowed" : "disallowed";
- LOG4CXX_INFO(logger_,
- "DeviceGetDeviceGroupsFromPolicies is already " << consent
- << ".");
+ LOG4CXX_INFO(
+ logger_,
+ "DeviceGetDeviceGroupsFromPolicies is already " << consent << ".");
return true;
}
@@ -1119,8 +1201,8 @@ bool CacheManager::SetUserPermissionsForApp(
it_group->second != is_allowed) {
*out_app_permissions_changed = true;
- const TimevalStruct tm = date_time::DateTime::getCurrentTime();
- int64_t current_time_msec = date_time::DateTime::getmSecs(tm);
+ const date_time::TimeDuration tm = date_time::getCurrentTime();
+ int64_t current_time_msec = date_time::getmSecs(tm);
ucr.consent_last_updated = current_time_msec;
LOG4CXX_DEBUG(logger_, "Updating consents time " << current_time_msec);
}
@@ -1197,14 +1279,8 @@ void CacheManager::CheckPermissions(const PTString& app_id,
if (rpc_param.hmi_levels.end() != hmi_iter) {
result.hmi_level_permitted = PermitResult::kRpcAllowed;
- policy_table::Parameters::const_iterator params_iter =
- rpc_param.parameters->begin();
- policy_table::Parameters::const_iterator params_iter_end =
- rpc_param.parameters->end();
-
- for (; params_iter != params_iter_end; ++params_iter) {
- result.list_of_allowed_params.insert(
- policy_table::EnumToJsonString(*params_iter));
+ for (const auto& param : *rpc_param.parameters) {
+ result.list_of_allowed_params.insert(std::string(param));
}
}
}
@@ -1333,7 +1409,7 @@ int CacheManager::TimeoutResponse() {
CACHE_MANAGER_CHECK(0);
sync_primitives::AutoLock auto_lock(cache_lock_);
return pt_->policy_table.module_config.timeout_after_x_seconds *
- date_time::DateTime::MILLISECONDS_IN_SECOND;
+ date_time::MILLISECONDS_IN_SECOND;
}
bool CacheManager::SecondsBetweenRetries(std::vector<int>& seconds) {
@@ -1353,26 +1429,259 @@ bool CacheManager::SecondsBetweenRetries(std::vector<int>& seconds) {
return true;
}
-const policy::VehicleInfo CacheManager::GetVehicleInfo() const {
- CACHE_MANAGER_CHECK(VehicleInfo());
+const std::vector<policy_table::VehicleDataItem>
+CacheManager::GetVehicleDataItems() const {
+ CACHE_MANAGER_CHECK(std::vector<policy_table::VehicleDataItem>());
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ if (pt_->policy_table.vehicle_data.is_initialized() &&
+ pt_->policy_table.vehicle_data->schema_items.is_initialized()) {
+ return *(pt_->policy_table.vehicle_data->schema_items);
+ }
+
+ return std::vector<policy_table::VehicleDataItem>();
+}
+
+std::vector<policy_table::VehicleDataItem>
+CacheManager::GetRemovedVehicleDataItems() const {
+ CACHE_MANAGER_CHECK(std::vector<policy_table::VehicleDataItem>());
+ return removed_custom_vd_items_;
+}
+
+Json::Value CacheManager::GetPolicyTableData() const {
+ return pt_->policy_table.ToJsonValue();
+}
+
+void CacheManager::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ enabled_apps.clear();
+ return;
+#else
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ for (policy_table::ApplicationPolicies::const_iterator it = policies.begin();
+ it != policies.end();
+ ++it) {
+ auto app_policy = (*it).second;
+ if (app_policy.enabled.is_initialized() && *app_policy.enabled) {
+ enabled_apps.push_back((*it).first);
+ }
+ }
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+}
+
+bool CacheManager::GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const {
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ auto app_policy = (*policy_iter).second;
+ out_app_properties.endpoint = app_policy.endpoint.is_initialized()
+ ? *app_policy.endpoint
+ : std::string();
+ out_app_properties.auth_token = app_policy.auth_token.is_initialized()
+ ? *app_policy.auth_token
+ : std::string();
+ out_app_properties.transport_type =
+ app_policy.cloud_transport_type.is_initialized()
+ ? *app_policy.cloud_transport_type
+ : std::string();
+ out_app_properties.certificate = app_policy.certificate.is_initialized()
+ ? *app_policy.certificate
+ : std::string();
+ out_app_properties.hybrid_app_preference =
+ app_policy.hybrid_app_preference.is_initialized()
+ ? EnumToJsonString(*app_policy.hybrid_app_preference)
+ : std::string();
+ out_app_properties.enabled =
+ app_policy.enabled.is_initialized() && *app_policy.enabled;
+ return true;
+ }
+ return false;
+}
+
+std::vector<std::string> CacheManager::GetEnabledLocalApps() const {
+#if !defined(WEBSOCKET_SERVER_TRANSPORT_SUPPORT)
+ return std::vector<std::string>();
+#else
+ std::vector<std::string> enabled_apps;
+ const policy_table::ApplicationPolicies& app_policies =
+ pt_->policy_table.app_policies_section.apps;
+ for (const auto& app_policies_item : app_policies) {
+ const auto app_policy = app_policies_item.second;
+ // Local (WebEngine) applications
+ // should not have "endpoint" field
+ if (app_policy.endpoint.is_initialized()) {
+ continue;
+ }
+ if (app_policy.enabled.is_initialized() && *app_policy.enabled) {
+ enabled_apps.push_back(app_policies_item.first);
+ }
+ }
+ return enabled_apps;
+#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+}
+
+void CacheManager::InitCloudApp(const std::string& policy_app_id) {
+ CACHE_MANAGER_CHECK_VOID();
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator default_iter =
+ policies.find(kDefaultId);
+ policy_table::ApplicationPolicies::const_iterator app_iter =
+ policies.find(policy_app_id);
+ if (default_iter != policies.end()) {
+ if (app_iter == policies.end()) {
+ policies[policy_app_id] = policies[kDefaultId];
+ }
+ }
+ // Add cloud app specific policies
+ Backup();
+}
+
+void CacheManager::SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.enabled = enabled;
+ }
+}
+
+void CacheManager::SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.auth_token = auth_token;
+ }
+}
+
+void CacheManager::SetAppCloudTransportType(
+ const std::string& policy_app_id, const std::string& cloud_transport_type) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.cloud_transport_type = cloud_transport_type;
+ }
+}
+
+void CacheManager::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.endpoint = endpoint;
+ }
+}
+
+void CacheManager::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ (*(*policy_iter).second.nicknames) = nicknames;
+ }
+}
+
+void CacheManager::SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) {
+ policy_table::HybridAppPreference value;
+ bool valid = EnumFromJsonString(hybrid_app_preference, &value);
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter && valid) {
+ *(*policy_iter).second.hybrid_app_preference = value;
+ }
+}
+
+void CacheManager::GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ auto app_policy = (*policy_iter).second;
+ if (app_policy.app_service_parameters.is_initialized()) {
+ *app_service_parameters = *(app_policy.app_service_parameters);
+ }
+ }
+}
+
+bool CacheManager::UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const {
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ const auto app_policy = (*policy_iter).second;
+ if (app_policy.allow_unknown_rpc_passthrough.is_initialized()) {
+ return *(app_policy.allow_unknown_rpc_passthrough);
+ }
+ }
+ return false;
+}
+
+const boost::optional<bool> CacheManager::LockScreenDismissalEnabledState()
+ const {
+ boost::optional<bool> empty;
+ CACHE_MANAGER_CHECK(empty);
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ModuleConfig& module_config = pt_->policy_table.module_config;
- VehicleInfo vehicle_info;
- vehicle_info.vehicle_make = *module_config.vehicle_make;
- vehicle_info.vehicle_model = *module_config.vehicle_model;
- vehicle_info.vehicle_year = *module_config.vehicle_year;
- LOG4CXX_DEBUG(
- logger_,
- "Vehicle info (make, model, year):" << vehicle_info.vehicle_make << ","
- << vehicle_info.vehicle_model << ","
- << vehicle_info.vehicle_year);
- return vehicle_info;
+ if (module_config.lock_screen_dismissal_enabled.is_initialized()) {
+ return boost::optional<bool>(*module_config.lock_screen_dismissal_enabled);
+ }
+ return empty;
+}
+
+const boost::optional<std::string>
+CacheManager::LockScreenDismissalWarningMessage(
+ const std::string& language) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ boost::optional<std::string> empty;
+ CACHE_MANAGER_CHECK(empty);
+
+ const std::string lock_screen_dismissal_warning_message =
+ "LockScreenDismissalWarning";
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ std::vector<std::string> msg_codes{lock_screen_dismissal_warning_message};
+
+ const auto messages = GetUserFriendlyMsg(msg_codes, language, "en-us");
+
+ if (messages.empty() || messages[0].text_body.empty()) {
+ return empty;
+ }
+
+ return boost::optional<std::string>(messages[0].text_body);
}
std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
const std::string& language,
- const std::string& active_hmi_language) {
+ const std::string& active_hmi_language) const {
LOG4CXX_AUTO_TRACE(logger_);
std::vector<UserFriendlyMessage> result;
CACHE_MANAGER_CHECK(result);
@@ -1428,16 +1737,24 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
}
void CacheManager::GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) {
- std::stringstream service_type_stream;
- service_type_stream << (service_type <= 9 ? "0x0" : "0x") << service_type;
-
- const std::string service_type_str = service_type_stream.str();
- GetUpdateUrls(service_type_str, out_end_points);
+ EndpointUrls& out_end_points) const {
+ auto find_hexademical =
+ [service_type](policy_table::ServiceEndpoints::value_type end_point) {
+ uint32_t decimal;
+ std::istringstream(end_point.first) >> std::hex >> decimal;
+ return end_point.first.compare(0, 2, "0x") == 0 &&
+ decimal == service_type;
+ };
+ auto& end_points = pt_->policy_table.module_config.endpoints;
+ const auto end_point =
+ std::find_if(end_points.begin(), end_points.end(), find_hexademical);
+ if (end_point != end_points.end()) {
+ GetUpdateUrls(end_point->first, out_end_points);
+ }
}
void CacheManager::GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
@@ -1464,11 +1781,19 @@ void CacheManager::GetUpdateUrls(const std::string& service_type,
}
}
-std::string CacheManager::GetLockScreenIconUrl() const {
- if (backup_) {
- return backup_->GetLockScreenIconUrl();
+std::string CacheManager::GetIconUrl(const std::string& policy_app_id) const {
+ CACHE_MANAGER_CHECK(std::string());
+ std::string url;
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ auto app_policy = (*policy_iter).second;
+ url = app_policy.icon_url.is_initialized() ? *app_policy.icon_url
+ : std::string();
}
- return std::string("");
+ return url;
}
rpc::policy_table_interface_base::NumberOfNotificationsType
@@ -1519,6 +1844,9 @@ void CacheManager::CheckSnapshotInitialization() {
*(snapshot_->policy_table.module_config.preloaded_pt) = false;
+ *(snapshot_->policy_table.module_config.full_app_id_supported) =
+ settings_->use_full_app_id();
+
// SDL must not send certificate in snapshot
snapshot_->policy_table.module_config.certificate =
rpc::Optional<rpc::String<0, 65535> >();
@@ -1625,10 +1953,50 @@ void CacheManager::CheckSnapshotInitialization() {
}
}
+policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff(
+ const policy_table::VehicleDataItems& items_before,
+ const policy_table::VehicleDataItems& items_after) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (items_before.empty()) {
+ LOG4CXX_DEBUG(logger_, "No custom VD items found in policy");
+ return policy_table::VehicleDataItems();
+ }
+
+ if (items_after.empty()) {
+ LOG4CXX_DEBUG(logger_,
+ "All custom VD items were removed after policy update");
+ return items_before;
+ }
+
+ policy_table::VehicleDataItems removed_items;
+ for (auto& item_to_search : items_before) {
+ auto item_predicate =
+ [&item_to_search](const policy_table::VehicleDataItem& item_to_check) {
+ return item_to_search.name == item_to_check.name;
+ };
+
+ auto it =
+ std::find_if(items_after.begin(), items_after.end(), item_predicate);
+ if (items_after.end() == it) {
+ removed_items.push_back(item_to_search);
+ }
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Found " << removed_items.size() << " removed VD items");
+ return removed_items;
+}
+
+void CacheManager::SetRemovedCustomVdItems(
+ const policy_table::VehicleDataItems& removed_items) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ removed_custom_vd_items_ = removed_items;
+}
+
void CacheManager::PersistData() {
LOG4CXX_AUTO_TRACE(logger_);
- if (backup_.valid()) {
- if (pt_.valid()) {
+ if (backup_.use_count() != 0) {
+ if (pt_.use_count() != 0) {
// Comma expression is used to hold the lock only during the constructor
// call
policy_table::Table copy_pt(
@@ -1670,7 +2038,7 @@ void CacheManager::PersistData() {
}
// In case of extended policy the meta info should be backuped as well.
- if (ex_backup_.valid()) {
+ if (ex_backup_.use_count() != 0) {
ex_backup_->SetMetaInfo(
*(*copy_pt.policy_table.module_meta).ccpu_version,
*(*copy_pt.policy_table.module_meta).wers_country_code,
@@ -1750,12 +2118,20 @@ bool CacheManager::IsPermissionsCalculated(const std::string& device_id,
return false;
}
-utils::SharedPtr<policy_table::Table> CacheManager::GenerateSnapshot() {
+std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() {
CACHE_MANAGER_CHECK(snapshot_);
- snapshot_ = new policy_table::Table();
+ snapshot_ = std::make_shared<policy_table::Table>();
sync_primitives::AutoLock auto_lock(cache_lock_);
snapshot_->policy_table = pt_->policy_table;
+ if (pt_->policy_table.vehicle_data.is_initialized()) {
+ snapshot_->policy_table.vehicle_data =
+ rpc::Optional<policy_table::VehicleData>();
+ snapshot_->policy_table.vehicle_data->mark_initialized();
+ snapshot_->policy_table.vehicle_data->schema_version =
+ pt_->policy_table.vehicle_data->schema_version;
+ }
+
snapshot_->SetPolicyTableType(policy_table::PT_SNAPSHOT);
CheckSnapshotInitialization();
@@ -1979,9 +2355,9 @@ bool CacheManager::CleanupUnpairedDevices() {
LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size());
device_data.erase(it_device);
- LOG4CXX_INFO(logger_,
- "Device id " << *iter
- << " had been deleted from device_data section.");
+ LOG4CXX_INFO(
+ logger_,
+ "Device id " << *iter << " had been deleted from device_data section.");
LOG4CXX_DEBUG(logger_, "Device_data size is: " << device_data.size());
}
is_unpaired_.clear();
@@ -2237,8 +2613,7 @@ bool CacheManager::Init(const std::string& file_name,
LOG4CXX_AUTO_TRACE(logger_);
settings_ = settings;
InitResult init_result = backup_->Init(settings);
- ex_backup_ = utils::SharedPtr<PTRepresentation>::dynamic_pointer_cast<
- PTExtRepresentation>(backup_);
+ ex_backup_ = std::dynamic_pointer_cast<PTExtRepresentation>(backup_);
bool result = true;
switch (init_result) {
@@ -2261,12 +2636,16 @@ bool CacheManager::Init(const std::string& file_name,
case InitResult::SUCCESS: {
LOG4CXX_INFO(logger_, "Policy Table was inited successfully");
result = LoadFromFile(file_name, *pt_);
- utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot();
+ std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot();
result &= snapshot->is_valid();
LOG4CXX_DEBUG(logger_,
"Check if snapshot valid: " << std::boolalpha << result);
+ if (!UnwrapAppPolicies(pt_->policy_table.app_policies_section.apps)) {
+ LOG4CXX_ERROR(logger_, "Cannot unwrap application policies");
+ }
+
if (result) {
backup_->UpdateDBVersion();
Backup();
@@ -2274,6 +2653,8 @@ bool CacheManager::Init(const std::string& file_name,
} else {
rpc::ValidationReport report("policy_table");
snapshot->ReportErrors(&report);
+ LOG4CXX_DEBUG(logger_,
+ "Validation report: " << rpc::PrettyFormat(report));
ex_backup_->RemoveDB();
}
} break;
@@ -2339,13 +2720,12 @@ bool CacheManager::LoadFromFile(const std::string& file_name,
return false;
}
+ utils::JsonReader reader;
Json::Value value;
- Json::Reader reader(Json::Features::strictMode());
+
std::string json(json_string.begin(), json_string.end());
- if (!reader.parse(json.c_str(), value)) {
- LOG4CXX_FATAL(
- logger_,
- "Preloaded PT is corrupted: " << reader.getFormattedErrorMessages());
+ if (!reader.parse(json, &value)) {
+ LOG4CXX_FATAL(logger_, "Preloaded PT is corrupted.");
return false;
}
@@ -2356,10 +2736,10 @@ bool CacheManager::LoadFromFile(const std::string& file_name,
table = policy_table::Table(&value);
#ifdef ENABLE_LOG
- Json::StyledWriter s_writer;
- LOG4CXX_DEBUG(
- logger_,
- "Policy table content loaded:" << s_writer.write(table.ToJsonValue()));
+ Json::StreamWriterBuilder writer_builder;
+ LOG4CXX_DEBUG(logger_,
+ "Policy table content loaded:" << Json::writeString(
+ writer_builder, table.ToJsonValue()));
#endif // ENABLE_LOG
MakeLowerCaseAppNames(table);
@@ -2377,10 +2757,14 @@ bool CacheManager::LoadFromFile(const std::string& file_name,
bool CacheManager::ResetPT(const std::string& file_name) {
LOG4CXX_AUTO_TRACE(logger_);
is_unpaired_.clear();
+
+ backuper_->WaitForBackupIsDone();
+
if (!backup_->RefreshDB()) {
LOG4CXX_ERROR(logger_, "Can't re-create policy database. Reset failed.");
return false;
}
+
sync_primitives::AutoLock lock(cache_lock_);
pt_.reset(new policy_table::Table());
const bool result = LoadFromFile(file_name, *pt_);
@@ -2559,7 +2943,7 @@ ExternalConsentStatus CacheManager::GetExternalConsentEntities() {
policy_table::DisallowedByExternalConsentEntities::const_iterator it_2 =
(*it->second.disallowed_by_external_consent_entities_off).begin();
for (; it_2 !=
- (*it->second.disallowed_by_external_consent_entities_off).end();
+ (*it->second.disallowed_by_external_consent_entities_off).end();
++it_2) {
items.insert(ExternalConsentStatusItem(
it_2->entity_type, it_2->entity_id, EntityStatus::kStatusOff));
@@ -2651,8 +3035,8 @@ void CacheManager::SetExternalConsentForApp(
(*(*pt_->policy_table.device_data)[permissions.device_id]
.user_consent_records)[permissions.policy_app_id];
- const TimevalStruct tm = date_time::DateTime::getCurrentTime();
- int64_t current_time_msec = date_time::DateTime::getmSecs(tm);
+ const date_time::TimeDuration tm = date_time::getCurrentTime();
+ int64_t current_time_msec = date_time::getmSecs(tm);
app_consent_records.ext_consent_last_updated = current_time_msec;
LOG4CXX_DEBUG(logger_, "Updating consents time " << current_time_msec);
@@ -2677,6 +3061,7 @@ bool CacheManager::MergePreloadPT(const std::string& file_name) {
MergeFG(new_table, current);
MergeAP(new_table, current);
MergeCFM(new_table, current);
+ MergeVD(new_table, current);
Backup();
}
return true;
@@ -2708,8 +3093,9 @@ void CacheManager::MergeFG(const policy_table::PolicyTable& new_pt,
void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
LOG4CXX_AUTO_TRACE(logger_);
- pt.app_policies_section.device = const_cast<policy_table::PolicyTable&>(
- new_pt).app_policies_section.device;
+ pt.app_policies_section.device =
+ const_cast<policy_table::PolicyTable&>(new_pt)
+ .app_policies_section.device;
pt.app_policies_section.apps[kDefaultId] =
const_cast<policy_table::PolicyTable&>(new_pt)
@@ -2743,6 +3129,12 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt,
}
}
+void CacheManager::MergeVD(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ pt.vehicle_data.assign_if_valid(new_pt.vehicle_data);
+}
+
void CacheManager::InitBackupThread() {
LOG4CXX_AUTO_TRACE(logger_);
backuper_ = new BackgroundBackuper(this);
@@ -2784,6 +3176,7 @@ void CacheManager::OnDeviceSwitching(const std::string& device_id_from,
CacheManager::BackgroundBackuper::BackgroundBackuper(
CacheManager* cache_manager)
: cache_manager_(cache_manager)
+ , backup_is_in_progress_(false)
, stop_flag_(false)
, new_data_available_(false) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -2808,13 +3201,23 @@ void CacheManager::BackgroundBackuper::threadMain() {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(need_backup_lock_);
while (!stop_flag_) {
+ backup_is_in_progress_.exchange(true);
{
sync_primitives::AutoUnlock need_backup_lock(need_backup_lock_);
InternalBackup();
}
+
+ {
+ LOG4CXX_DEBUG(logger_, "Backup is done");
+ sync_primitives::AutoLock auto_lock(backup_done_lock_);
+ backup_is_in_progress_.exchange(false);
+ backup_done_.Broadcast();
+ }
+
if (new_data_available_ || stop_flag_) {
continue;
}
+
LOG4CXX_DEBUG(logger_, "Wait for a next backup");
backup_notifier_.Wait(need_backup_lock_);
}
@@ -2834,4 +3237,54 @@ void CacheManager::BackgroundBackuper::DoBackup() {
backup_notifier_.NotifyOne();
}
+void CacheManager::BackgroundBackuper::WaitForBackupIsDone() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(backup_done_lock_);
+ if (backup_is_in_progress_) {
+ backup_done_.Wait(auto_lock);
+ }
+}
+
+EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag(
+ const std::string& application) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ return pt_->policy_table.app_policies_section.apps[application]
+ .encryption_required;
+}
+
+EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag(
+ const std::string& functional_group) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ const auto& functional_groupings = pt_->policy_table.functional_groupings;
+
+ const auto& grouping_itr = functional_groupings.find(functional_group);
+ if (grouping_itr == functional_groupings.end()) {
+ LOG4CXX_WARN(logger_, "Group " << functional_group << " not found");
+ return rpc::Optional<rpc::Boolean>(rpc::Boolean(false));
+ }
+
+ return (*grouping_itr).second.encryption_required;
+}
+
+void CacheManager::GetApplicationParams(
+ const std::string& application_name,
+ policy_table::ApplicationParams& application_params) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ const auto apps = pt_->policy_table.app_policies_section.apps;
+ const auto it = apps.find(application_name);
+ if (apps.end() == it) {
+ LOG4CXX_WARN(logger_,
+ "Application " << application_name << " was not found");
+ return;
+ }
+
+ application_params = (*it).second;
+}
+
} // namespace policy
diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc
index 39b9399c24..b8bbb1682c 100644
--- a/src/components/policy/policy_external/src/policy_helper.cc
+++ b/src/components/policy/policy_external/src/policy_helper.cc
@@ -30,13 +30,13 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "policy/policy_helper.h"
+#include <string.h>
#include <algorithm>
#include <sstream>
-#include <string.h>
-#include "utils/logger.h"
-#include "utils/custom_string.h"
-#include "policy/policy_helper.h"
#include "policy/policy_manager_impl.h"
+#include "utils/custom_string.h"
+#include "utils/logger.h"
namespace policy {
@@ -46,7 +46,8 @@ namespace {
CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
-bool Compare(const StringsValueType& first, const StringsValueType& second) {
+bool CompareStrings(const StringsValueType& first,
+ const StringsValueType& second) {
const std::string& first_str = first;
const std::string& second_str = second;
return (strcasecmp(first_str.c_str(), second_str.c_str()) < 0);
@@ -113,7 +114,7 @@ bool operator!=(const policy_table::ApplicationParams& first,
for (; it_first != it_first_end; ++it_first) {
CompareGroupName gp(*it_first);
StringsConstItr it = std::find_if(it_second, it_second_end, gp);
- if (it_first_end == it) {
+ if (it_second_end == it) {
return true;
}
}
@@ -122,8 +123,8 @@ bool operator!=(const policy_table::ApplicationParams& first,
CheckAppPolicy::CheckAppPolicy(
PolicyManagerImpl* pm,
- const utils::SharedPtr<policy_table::Table> update,
- const utils::SharedPtr<policy_table::Table> snapshot,
+ const std::shared_ptr<policy_table::Table> update,
+ const std::shared_ptr<policy_table::Table> snapshot,
CheckAppPolicyResults& out_results)
: pm_(pm)
, update_(update)
@@ -137,10 +138,10 @@ bool policy::CheckAppPolicy::HasRevokedGroups(
snapshot_->policy_table.app_policies_section.apps.find(app_policy.first);
policy_table::Strings groups_new = app_policy.second.groups;
- std::sort(groups_new.begin(), groups_new.end(), Compare);
+ std::sort(groups_new.begin(), groups_new.end(), CompareStrings);
policy_table::Strings groups_curr = (*it).second.groups;
- std::sort(groups_curr.begin(), groups_curr.end(), Compare);
+ std::sort(groups_curr.begin(), groups_curr.end(), CompareStrings);
StringsConstItr it_groups_new = groups_new.begin();
StringsConstItr it_groups_new_end = groups_new.end();
@@ -154,7 +155,7 @@ bool policy::CheckAppPolicy::HasRevokedGroups(
it_groups_new,
it_groups_new_end,
std::back_inserter(revoked_group_list),
- Compare);
+ CompareStrings);
// Remove groups which are not required user consent
policy_table::Strings::iterator it_revoked = revoked_group_list.begin();
@@ -174,6 +175,76 @@ bool policy::CheckAppPolicy::HasRevokedGroups(
return !revoked_group_list.empty();
}
+bool policy::CheckAppPolicy::HasUpdatedGroups(
+ const policy::AppPoliciesValueType& app_policy,
+ policy_table::Strings* updated_groups) const {
+ AppPoliciesConstItr it =
+ snapshot_->policy_table.app_policies_section.apps.find(app_policy.first);
+
+ policy_table::Strings groups_new = app_policy.second.groups;
+ std::sort(groups_new.begin(), groups_new.end(), CompareStrings);
+
+ policy_table::Strings groups_curr = (*it).second.groups;
+ std::sort(groups_curr.begin(), groups_curr.end(), CompareStrings);
+
+ policy_table::Strings intersection_list;
+ std::set_intersection(groups_new.begin(),
+ groups_new.end(),
+ groups_curr.begin(),
+ groups_curr.end(),
+ std::back_inserter(intersection_list));
+
+ auto IsGroupContentUpdated =
+ [this](const StringsValueType& groupName) -> bool {
+ const auto& func_group_from_update =
+ update_->policy_table.functional_groupings.find(groupName);
+ const auto& func_group_from_snapshot =
+ snapshot_->policy_table.functional_groupings.find(groupName);
+
+ const auto& update_fg_rpcs = func_group_from_update->second.rpcs;
+ const auto& snapshot_fg_rpcs = func_group_from_snapshot->second.rpcs;
+
+ if (update_fg_rpcs.is_null() || snapshot_fg_rpcs.is_null()) {
+ return !(update_fg_rpcs.is_null() && snapshot_fg_rpcs.is_null());
+ }
+
+ if (update_fg_rpcs.size() != snapshot_fg_rpcs.size()) {
+ return true;
+ }
+
+ for (const auto& rpc : update_fg_rpcs) {
+ const auto& old_rpc = snapshot_fg_rpcs.find(rpc.first);
+ if (snapshot_fg_rpcs.end() == old_rpc) {
+ return true;
+ }
+
+ const bool hmi_levels_same =
+ old_rpc->second.hmi_levels == rpc.second.hmi_levels;
+ const bool parameters_same =
+ *(old_rpc->second.parameters) == *(rpc.second.parameters);
+
+ if (!hmi_levels_same || !parameters_same) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+
+ policy_table::Strings updated_group_list;
+ for (const auto& item : intersection_list) {
+ if (IsGroupContentUpdated(item)) {
+ updated_group_list.push_back(item);
+ }
+ }
+
+ if (updated_groups) {
+ *updated_groups = updated_group_list;
+ }
+
+ return !updated_group_list.empty();
+}
+
bool policy::CheckAppPolicy::HasNewGroups(
const policy::AppPoliciesValueType& app_policy,
policy_table::Strings* new_groups) const {
@@ -181,10 +252,10 @@ bool policy::CheckAppPolicy::HasNewGroups(
snapshot_->policy_table.app_policies_section.apps.find(app_policy.first);
policy_table::Strings groups_new = app_policy.second.groups;
- std::sort(groups_new.begin(), groups_new.end(), Compare);
+ std::sort(groups_new.begin(), groups_new.end(), CompareStrings);
policy_table::Strings groups_curr = (*it).second.groups;
- std::sort(groups_curr.begin(), groups_curr.end(), Compare);
+ std::sort(groups_curr.begin(), groups_curr.end(), CompareStrings);
StringsConstItr it_groups_new = groups_new.begin();
StringsConstItr it_groups_new_end = groups_new.end();
@@ -192,13 +263,55 @@ bool policy::CheckAppPolicy::HasNewGroups(
StringsConstItr it_groups_curr = groups_curr.begin();
StringsConstItr it_groups_curr_end = groups_curr.end();
+ auto CompareGroupContent =
+ [this](const StringsValueType& update_group_name,
+ const StringsValueType& snapshot_group_name) -> bool {
+ if (CompareStrings(update_group_name, snapshot_group_name)) {
+ return true;
+ }
+
+ const auto& func_group_from_update =
+ update_->policy_table.functional_groupings.find(update_group_name);
+ const auto& func_group_from_snapshot =
+ snapshot_->policy_table.functional_groupings.find(snapshot_group_name);
+
+ const auto& update_fg_rpcs = func_group_from_update->second.rpcs;
+ const auto& snapshot_fg_rpcs = func_group_from_snapshot->second.rpcs;
+
+ if (update_fg_rpcs.is_null() || snapshot_fg_rpcs.is_null()) {
+ return !(update_fg_rpcs.is_null() && snapshot_fg_rpcs.is_null());
+ }
+
+ if (update_fg_rpcs.size() != snapshot_fg_rpcs.size()) {
+ return true;
+ }
+
+ for (const auto& rpc : update_fg_rpcs) {
+ const auto& old_rpc = snapshot_fg_rpcs.find(rpc.first);
+ if (snapshot_fg_rpcs.end() == old_rpc) {
+ return true;
+ }
+
+ const bool hmi_levels_same =
+ old_rpc->second.hmi_levels == rpc.second.hmi_levels;
+ const bool parameters_same =
+ *(old_rpc->second.parameters) == *(rpc.second.parameters);
+
+ if (!hmi_levels_same || !parameters_same) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+
policy_table::Strings new_group_list;
std::set_difference(it_groups_new,
it_groups_new_end,
it_groups_curr,
it_groups_curr_end,
std::back_inserter(new_group_list),
- Compare);
+ CompareGroupContent);
if (new_groups) {
*new_groups = new_group_list;
@@ -210,14 +323,23 @@ bool policy::CheckAppPolicy::HasNewGroups(
bool policy::CheckAppPolicy::HasConsentNeededGroups(
const policy::AppPoliciesValueType& app_policy) const {
policy_table::Strings new_groups;
- if (!HasNewGroups(app_policy, &new_groups)) {
+ policy_table::Strings updated_groups;
+ if (!HasNewGroups(app_policy, &new_groups) &&
+ !HasUpdatedGroups(app_policy, &updated_groups)) {
return false;
}
- StringsConstItr it_new = new_groups.begin();
- StringsConstItr it_new_end = new_groups.end();
- for (; it_new != it_new_end; ++it_new) {
- if (IsConsentRequired(app_policy.first, *it_new)) {
+ policy_table::Strings groups_to_check_consent;
+ std::set_union(new_groups.begin(),
+ new_groups.end(),
+ updated_groups.begin(),
+ updated_groups.end(),
+ std::back_inserter(groups_to_check_consent));
+
+ StringsConstItr it = groups_to_check_consent.begin();
+ StringsConstItr it_end = groups_to_check_consent.end();
+ for (; it != it_end; ++it) {
+ if (IsConsentRequired(app_policy.first, *it)) {
return true;
}
}
@@ -299,9 +421,27 @@ void CheckAppPolicy::AddResult(const std::string& app_id,
out_results_.insert(std::make_pair(app_id, result));
}
+void CheckAppPolicy::InsertPermission(const std::string& app_id,
+ const AppPermissions& permissions_diff) {
+ pm_->app_permissions_diff_lock_.Acquire();
+ auto result = pm_->app_permissions_diff_.insert(
+ std::make_pair(app_id, permissions_diff));
+ if (!result.second) {
+ LOG4CXX_ERROR(logger_, "App ID: " << app_id << " already exists in map.");
+ }
+ pm_->app_permissions_diff_lock_.Release();
+}
+
bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
const std::string app_id = app_policy.first;
+ const bool app_properties_changed = IsAppPropertiesChanged(app_policy);
+ const bool is_predefined_app = IsPredefinedApp(app_policy);
+ if (!is_predefined_app && app_properties_changed) {
+ AddResult(app_id, RESULT_APP_PROPERTIES_CHANGED);
+ }
+
+ AppPermissions permissions_diff(app_id);
if (!IsKnownAppication(app_id)) {
LOG4CXX_WARN(logger_,
"Application:" << app_id << " is not present in snapshot.");
@@ -309,14 +449,17 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
}
if (!IsPredefinedApp(app_policy) && IsAppRevoked(app_policy)) {
- SetPendingPermissions(app_policy, RESULT_APP_REVOKED);
+ SetPendingPermissions(app_policy, RESULT_APP_REVOKED, permissions_diff);
AddResult(app_id, RESULT_APP_REVOKED);
+ InsertPermission(app_id, permissions_diff);
return true;
}
if (!IsPredefinedApp(app_policy) && !NicknamesMatch(app_policy)) {
- SetPendingPermissions(app_policy, RESULT_NICKNAME_MISMATCH);
+ SetPendingPermissions(
+ app_policy, RESULT_NICKNAME_MISMATCH, permissions_diff);
AddResult(app_id, RESULT_NICKNAME_MISMATCH);
+ InsertPermission(app_id, permissions_diff);
return true;
}
@@ -328,43 +471,50 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
if (is_request_type_changed) {
LOG4CXX_TRACE(logger_,
"Request types were changed for application: " << app_id);
- SetPendingPermissions(app_policy, RESULT_REQUEST_TYPE_CHANGED);
+ SetPendingPermissions(
+ app_policy, RESULT_REQUEST_TYPE_CHANGED, permissions_diff);
AddResult(app_id, RESULT_REQUEST_TYPE_CHANGED);
+ result =
+ (RESULT_NO_CHANGES == result) ? RESULT_REQUEST_TYPE_CHANGED : result;
}
if (is_request_subtype_changed) {
LOG4CXX_TRACE(
logger_, "Request subtypes were changed for application: " << app_id);
- SetPendingPermissions(app_policy, RESULT_REQUEST_SUBTYPE_CHANGED);
+ SetPendingPermissions(
+ app_policy, RESULT_REQUEST_SUBTYPE_CHANGED, permissions_diff);
AddResult(app_id, RESULT_REQUEST_SUBTYPE_CHANGED);
+ result = (RESULT_NO_CHANGES == result) ? RESULT_REQUEST_SUBTYPE_CHANGED
+ : result;
}
}
if (RESULT_NO_CHANGES == result) {
- LOG4CXX_INFO(logger_,
- "Permissions for application:" << app_id
- << " wasn't changed.");
+ LOG4CXX_INFO(
+ logger_,
+ "Permissions for application:" << app_id << " wasn't changed.");
AddResult(app_id, result);
return true;
}
- LOG4CXX_INFO(logger_,
- "Permissions for application:" << app_id
- << " have been changed.");
+ LOG4CXX_INFO(
+ logger_,
+ "Permissions for application:" << app_id << " have been changed.");
if (!IsPredefinedApp(app_policy)) {
- SetPendingPermissions(app_policy, result);
+ SetPendingPermissions(app_policy, result, permissions_diff);
AddResult(app_id, result);
}
+ InsertPermission(app_id, permissions_diff);
return true;
}
void policy::CheckAppPolicy::SetPendingPermissions(
const AppPoliciesValueType& app_policy,
- PermissionsCheckResult result) const {
+ PermissionsCheckResult result,
+ AppPermissions& permissions_diff) const {
using namespace rpc::policy_table_interface_base;
const std::string app_id = app_policy.first;
- AppPermissions permissions_diff(app_id);
const std::string priority =
policy_table::EnumToJsonString(app_policy.second.priority);
@@ -421,10 +571,6 @@ void policy::CheckAppPolicy::SetPendingPermissions(
if (need_send_priority) {
permissions_diff.priority = priority;
}
-
- pm_->app_permissions_diff_lock_.Acquire();
- pm_->app_permissions_diff_.insert(std::make_pair(app_id, permissions_diff));
- pm_->app_permissions_diff_lock_.Release();
}
PermissionsCheckResult CheckAppPolicy::CheckPermissionsChanges(
@@ -435,14 +581,20 @@ PermissionsCheckResult CheckAppPolicy::CheckPermissionsChanges(
bool has_new_groups = HasNewGroups(app_policy);
+ const bool encryption_required_flag_changed =
+ IsEncryptionRequiredFlagChanged(app_policy);
+ bool has_updated_groups = HasUpdatedGroups(app_policy);
+
if (has_revoked_groups && has_consent_needed_groups) {
return RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED;
} else if (has_revoked_groups) {
return RESULT_PERMISSIONS_REVOKED;
} else if (has_consent_needed_groups) {
return RESULT_CONSENT_NEEDED;
- } else if (has_new_groups) {
- return RESULT_CONSENT_NOT_REQIURED;
+ } else if (has_new_groups || has_updated_groups) {
+ return RESULT_CONSENT_NOT_REQUIRED;
+ } else if (encryption_required_flag_changed) {
+ return RESULT_ENCRYPTION_REQUIRED_FLAG_CHANGED;
}
return RESULT_NO_CHANGES;
@@ -523,11 +675,166 @@ bool CheckAppPolicy::IsRequestSubTypeChanged(
return diff.size();
}
+bool CheckAppPolicy::IsAppPropertiesProvided(
+ const AppPoliciesValueType& app_policy) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (app_policy.second.hybrid_app_preference.is_initialized() ||
+ app_policy.second.endpoint.is_initialized() ||
+ app_policy.second.enabled.is_initialized() ||
+ app_policy.second.auth_token.is_initialized() ||
+ app_policy.second.cloud_transport_type.is_initialized() ||
+ app_policy.second.nicknames.is_initialized()) {
+ return true;
+ }
+ return false;
+}
+
+bool CheckAppPolicy::IsAppPropertiesChanged(
+ const AppPoliciesValueType& app_policy) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!IsAppPropertiesProvided(app_policy)) {
+ return false;
+ }
+
+ if (!IsKnownAppication(app_policy.first)) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "AppProperties provided for new application: " << app_policy.first);
+ return true;
+ }
+
+ policy::AppPoliciesConstItr it =
+ snapshot_->policy_table.app_policies_section.apps.find(app_policy.first);
+ const auto snapshot_properties = *it;
+
+ if (app_policy.second.enabled.is_initialized() &&
+ app_policy.second.enabled != snapshot_properties.second.enabled) {
+ LOG4CXX_DEBUG(logger_, "\"enabled\" was changed");
+ return true;
+ }
+
+ if (app_policy.second.endpoint.is_initialized() &&
+ app_policy.second.endpoint != snapshot_properties.second.endpoint) {
+ LOG4CXX_DEBUG(logger_, "\"endpoint\" was changed");
+ return true;
+ }
+
+ if (app_policy.second.hybrid_app_preference.is_initialized() &&
+ app_policy.second.hybrid_app_preference !=
+ snapshot_properties.second.hybrid_app_preference) {
+ LOG4CXX_DEBUG(logger_, "\"hybrid_app_preference\" was changed");
+ return true;
+ }
+
+ if (app_policy.second.auth_token.is_initialized() &&
+ app_policy.second.auth_token != snapshot_properties.second.auth_token) {
+ LOG4CXX_DEBUG(logger_, "\"auth_token\" was changed");
+ return true;
+ }
+
+ if (app_policy.second.cloud_transport_type.is_initialized() &&
+ app_policy.second.cloud_transport_type !=
+ snapshot_properties.second.cloud_transport_type) {
+ LOG4CXX_DEBUG(logger_, "\"cloud_transport_type\" was changed");
+ return true;
+ }
+
+ return false;
+}
+
+bool CheckAppPolicy::IsEncryptionRequiredFlagChanged(
+ const AppPoliciesValueType& app_policy) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto get_app_encryption_needed =
+ [](const std::string& policy_app_id,
+ policy_table::ApplicationPolicies& policies)
+ -> rpc::Optional<rpc::Boolean> {
+ auto it = policies.find(policy_app_id);
+ if (policies.end() == it) {
+ LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id);
+ return rpc::Optional<rpc::Boolean>(false);
+ }
+ return it->second.encryption_required;
+ };
+
+ auto get_app_groups =
+ [](const std::string& policy_app_id,
+ policy_table::ApplicationPolicies& policies) -> policy_table::Strings {
+ policy_table::Strings result;
+ auto it = policies.find(policy_app_id);
+ if (policies.end() == it) {
+ LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id);
+ return result;
+ }
+ auto& groups = it->second.groups;
+ std::copy(groups.begin(), groups.end(), std::back_inserter(result));
+ return result;
+ };
+
+ auto get_app_rpcs = [](const std::string group_name,
+ const FunctionalGroupings& groups)
+ -> rpc::Optional<policy_table::Rpcs> {
+ auto it = groups.find(group_name);
+ if (it == groups.end()) {
+ return rpc::Optional<policy_table::Rpcs>();
+ }
+ return rpc::Optional<policy_table::Rpcs>(it->second);
+ };
+
+ const auto snapshot_groups = get_app_groups(
+ app_policy.first, snapshot_->policy_table.app_policies_section.apps);
+ const auto update_groups = get_app_groups(
+ app_policy.first, update_->policy_table.app_policies_section.apps);
+
+ auto get_resulting_encryption_required_flag_for_app_groups =
+ [this, &get_app_rpcs](
+ const rpc::policy_table_interface_base::Strings& app_groups,
+ const std::shared_ptr<rpc::policy_table_interface_base::Table> pt) {
+ for (const auto& group : app_groups) {
+ const auto rpcs =
+ get_app_rpcs(group, pt->policy_table.functional_groupings);
+ if (*rpcs->encryption_required) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+
+ auto group_res_en_flag_changed =
+ [this, &get_resulting_encryption_required_flag_for_app_groups](
+ const rpc::policy_table_interface_base::Strings& snapshot_groups,
+ const rpc::policy_table_interface_base::Strings& update_groups) {
+ return get_resulting_encryption_required_flag_for_app_groups(
+ snapshot_groups, snapshot_) !=
+ get_resulting_encryption_required_flag_for_app_groups(
+ update_groups, update_);
+ };
+
+ const auto snapshot_app_encryption_needed = get_app_encryption_needed(
+ app_policy.first, snapshot_->policy_table.app_policies_section.apps);
+ const auto update_app_encryption_needed = get_app_encryption_needed(
+ app_policy.first, update_->policy_table.app_policies_section.apps);
+
+ const bool app_encryption_needed_changed =
+ (snapshot_app_encryption_needed.is_initialized() !=
+ update_app_encryption_needed.is_initialized()) ||
+ (*snapshot_app_encryption_needed != *update_app_encryption_needed);
+
+ if ((!update_app_encryption_needed.is_initialized() ||
+ *update_app_encryption_needed) &&
+ group_res_en_flag_changed(snapshot_groups, update_groups)) {
+ return true;
+ }
+
+ return app_encryption_needed_changed;
+}
+
void FillActionsForAppPolicies::operator()(
const policy::CheckAppPolicyResults::value_type& value) {
const std::string app_id = value.first;
- const policy_table::ApplicationPolicies::const_iterator app_policy =
- app_policies_.find(app_id);
+ const auto app_policy = app_policies_.find(app_id);
if (app_policies_.end() == app_policy) {
return;
@@ -546,10 +853,14 @@ void FillActionsForAppPolicies::operator()(
case RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED:
actions_[app_id].is_consent_needed = true;
break;
- case RESULT_CONSENT_NOT_REQIURED:
+ case RESULT_APP_PROPERTIES_CHANGED:
+ actions_[app_id].app_properties_changed = true;
+ break;
+ case RESULT_CONSENT_NOT_REQUIRED:
case RESULT_PERMISSIONS_REVOKED:
case RESULT_REQUEST_TYPE_CHANGED:
case RESULT_REQUEST_SUBTYPE_CHANGED:
+ case RESULT_ENCRYPTION_REQUIRED_FLAG_CHANGED:
break;
case RESULT_NO_CHANGES:
default:
@@ -620,7 +931,18 @@ void FillNotificationData::UpdateParameters(
ParametersConstItr it_parameters = in_parameters.begin();
ParametersConstItr it_parameters_end = in_parameters.end();
- // Due to APPLINK-24201 SDL must consider cases when 'parameters' section is
+ // To determine consent for a particular RPC in a particular HMI level with
+ // particular parameters (if applicable), the system shall find all of the
+ // functional groups the RPC is included in. If user consent is needed as
+ // listed within the functional group in the policy table, the system shall
+ // use a logical AND: backend permissions AND User permissions. If the RPC
+ // is
+ // listed under more than one group, the system shall perform a logical OR
+ // among all of the possible allowed permissions scenarios for the RPC
+ // (and
+ // parameter/or HMI level) defined by each of the functional groups.
+
+ // Due to requirements SDL must consider cases when 'parameters' section is
// not present for RPC or present, but is empty.
// If 'parameters' section is like: 'parameters' : []
@@ -635,17 +957,21 @@ void FillNotificationData::UpdateParameters(
// If 'parameters' section is omitted
if (!in_parameters.is_initialized()) {
- if (!does_require_user_consent_) {
- out_parameter.any_parameter_allowed = true;
- }
- if (does_require_user_consent_ && kAllowedKey == current_key_) {
+ if (!does_require_user_consent_ ||
+ (does_require_user_consent_ && kAllowedKey == current_key_)) {
out_parameter.any_parameter_allowed = true;
}
}
for (; it_parameters != it_parameters_end; ++it_parameters) {
- out_parameter[current_key_].insert(
- policy_table::EnumToJsonString(*it_parameters));
+ out_parameter[current_key_].insert(*it_parameters);
+ }
+
+ // We should reset ALL DISALLOWED flags if at least one parameter is allowed
+ // due to a logical OR permissions check
+ if (IsSomeParameterAllowed(out_parameter)) {
+ out_parameter.any_parameter_disallowed_by_policy = false;
+ out_parameter.any_parameter_disallowed_by_user = false;
}
}
@@ -703,7 +1029,8 @@ void FillNotificationData::ExcludeSame(RpcPermissions& rpc) {
}
}
- // Removing disallowed parameters from allowed and undefined (by user consent)
+ // Removing disallowed parameters from allowed and undefined (by user
+ // consent)
if (rpc.parameter_permissions.end() != it_parameter_user_disallowed) {
if (rpc.parameter_permissions.end() != it_parameter_allowed) {
ExcludeSameParameters(rpc.parameter_permissions[kAllowedKey],
@@ -769,16 +1096,24 @@ bool FillNotificationData::RpcParametersEmpty(RpcPermissions& rpc) {
no_user_disallowed_parameters;
}
-bool FillNotificationData::IsSectionEmpty(ParameterPermissions& permissions,
- const std::string& section) {
+bool FillNotificationData::IsSectionEmpty(
+ const ParameterPermissions& permissions, const std::string& section) const {
ParameterPermissions::const_iterator it_section = permissions.find(section);
ParameterPermissions::const_iterator end = permissions.end();
if (end != it_section) {
- return permissions[section].empty();
+ return it_section->second.empty();
}
return true;
}
+bool FillNotificationData::IsSomeParameterAllowed(
+ const ParameterPermissions& permissions) const {
+ const bool are_any_consented_parameters_allowed =
+ kAllowedKey == current_key_ && !IsSectionEmpty(permissions, current_key_);
+ return permissions.any_parameter_allowed ||
+ are_any_consented_parameters_allowed;
+}
+
ProcessFunctionalGroup::ProcessFunctionalGroup(
const policy_table::FunctionalGroupings& fg,
const std::vector<FunctionalGroupPermission>& group_permissions,
@@ -802,10 +1137,31 @@ bool ProcessFunctionalGroup::operator()(const StringsValueType& group_name) {
undefined_group_consent_,
does_require_user_consent);
std::for_each(rpcs.begin(), rpcs.end(), filler);
+ const auto encryption_required = (*it).second.encryption_required;
+ FillEncryptionFlagForRpcs(rpcs, encryption_required);
}
return true;
}
+void ProcessFunctionalGroup::FillEncryptionFlagForRpcs(
+ const policy_table::Rpc& rpcs,
+ const EncryptionRequired encryption_required) {
+ auto update_encryption_required = [](EncryptionRequired& current,
+ const EncryptionRequired& incoming) {
+ if (!incoming.is_initialized()) {
+ return;
+ }
+ if (current.is_initialized() && *current) {
+ return;
+ }
+ current = incoming;
+ };
+ for (const auto& rpc : rpcs) {
+ auto& item = data_[rpc.first];
+ update_encryption_required(item.require_encryption, encryption_required);
+ }
+}
+
GroupConsent ProcessFunctionalGroup::GetGroupState(
const std::string& group_name) {
std::vector<FunctionalGroupPermission>::const_iterator it =
diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc
index 4ac66c0d53..082d4a37ba 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -32,33 +32,28 @@
#include "policy/policy_manager_impl.h"
#include <algorithm>
-#include <set>
-#include <queue>
+#include <functional>
#include <iterator>
#include <limits>
+#include <queue>
+#include <set>
#include <vector>
-#include <functional>
-#include "json/reader.h"
+#include "config_profile/profile.h"
#include "json/writer.h"
+#include "policy/cache_manager.h"
+#include "policy/policy_helper.h"
#include "policy/policy_table.h"
#include "policy/pt_representation.h"
-#include "policy/policy_helper.h"
+#include "policy/update_status_manager.h"
+#include "utils/date_time.h"
#include "utils/file_system.h"
+#include "utils/jsoncpp_reader_wrapper.h"
#include "utils/logger.h"
-#include "utils/date_time.h"
-#include "policy/cache_manager.h"
-#include "policy/update_status_manager.h"
-#include "config_profile/profile.h"
-#include "utils/make_shared.h"
+
#include "policy/access_remote.h"
#include "policy/access_remote_impl.h"
+#include "utils/timer_task_impl.h"
-policy::PolicyManager* CreateManager() {
- return new policy::PolicyManagerImpl();
-}
-void DeleteManager(policy::PolicyManager* pm) {
- delete pm;
-}
namespace {
/**
@@ -213,41 +208,47 @@ PolicyManagerImpl::PolicyManagerImpl()
: PolicyManager()
, listener_(NULL)
, cache_(new CacheManager)
- , access_remote_(new AccessRemoteImpl(
- CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_)))
+ , access_remote_(
+ new AccessRemoteImpl(std::static_pointer_cast<CacheManager>(cache_)))
, retry_sequence_timeout_(60)
, retry_sequence_index_(0)
+ , applications_pending_ptu_count_(0)
, ignition_check(true)
- , retry_sequence_url_(0, 0, "") {}
+ , retry_sequence_url_(0, 0, "")
+ , ptu_requested_(false)
+ , is_ptu_in_progress_(false) {}
PolicyManagerImpl::PolicyManagerImpl(bool in_memory)
: PolicyManager()
, listener_(NULL)
, cache_(new CacheManager(in_memory))
- , access_remote_(new AccessRemoteImpl(
- CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_)))
+ , access_remote_(
+ new AccessRemoteImpl(std::static_pointer_cast<CacheManager>(cache_)))
, retry_sequence_timeout_(60)
, retry_sequence_index_(0)
+ , applications_pending_ptu_count_(0)
, ignition_check(true)
, retry_sequence_url_(0, 0, "")
- , wrong_ptu_update_received_(false)
, send_on_update_sent_out_(false)
- , trigger_ptu_(false) {}
+ , trigger_ptu_(false)
+ , ptu_requested_(false)
+ , is_ptu_in_progress_(false) {}
void PolicyManagerImpl::set_listener(PolicyListener* listener) {
listener_ = listener;
update_status_manager_.set_listener(listener);
}
-utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse(
+std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse(
const BinaryMessage& pt_content) {
std::string json(pt_content.begin(), pt_content.end());
+ utils::JsonReader reader;
Json::Value value;
- Json::Reader reader;
- if (reader.parse(json.c_str(), value)) {
- return new policy_table::Table(&value);
+
+ if (reader.parse(json, &value)) {
+ return std::make_shared<policy_table::Table>(&value);
} else {
- return utils::SharedPtr<policy_table::Table>();
+ return std::make_shared<policy_table::Table>();
}
}
@@ -267,105 +268,316 @@ void PolicyManagerImpl::CheckTriggers() {
}
}
-std::string PolicyManagerImpl::GetLockScreenIconUrl() const {
- return cache_->GetLockScreenIconUrl();
+std::string PolicyManagerImpl::GetIconUrl(
+ const std::string& policy_app_id) const {
+ return cache_->GetIconUrl(policy_app_id);
}
-bool PolicyManagerImpl::LoadPT(const std::string& file,
- const BinaryMessage& pt_content) {
+/**
+ * @brief FilterInvalidFunctions filter functions that are absent in schema
+ * @param rpcs list of functions to filter
+ */
+void FilterInvalidFunctions(policy_table::Rpc& rpcs) {
+ policy_table::Rpc valid_rpcs;
+ for (const auto& rpc : rpcs) {
+ const std::string& rpc_name = rpc.first;
+ policy_table::FunctionID function_id;
+ if (policy_table::EnumFromJsonString(rpc_name, &function_id)) {
+ valid_rpcs.insert(rpc);
+ }
+ }
+ rpcs.swap(valid_rpcs);
+}
+
+/**
+ * @brief FilterInvalidRPCParameters filter parameters that not present in
+ * schema
+ * @param rpc_parameters parameters to filter
+ */
+void FilterInvalidRPCParameters(
+ policy_table::RpcParameters& rpc_parameters,
+ const std::vector<policy_table::VehicleDataItem>& vehicle_data_items) {
+ policy_table::HmiLevels valid_hmi_levels;
+ for (const auto& hmi_level : rpc_parameters.hmi_levels) {
+ if (hmi_level.is_valid()) {
+ valid_hmi_levels.push_back(hmi_level);
+ }
+ }
+ rpc_parameters.hmi_levels.swap(valid_hmi_levels);
+
+ auto ParamExists =
+ [&vehicle_data_items](const rpc::String<0, 255>& param_name) {
+ policy_table::Parameter parameter_enum;
+ if (policy_table::EnumFromJsonString(param_name, &parameter_enum)) {
+ return true;
+ }
+
+ // In case when this collection is empty that means collection is not
+ // initialized
+ if (vehicle_data_items.empty()) {
+ return false;
+ }
+
+ for (const auto& vdi : vehicle_data_items) {
+ if (param_name == vdi.name) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ policy_table::Parameters valid_params;
+ const policy_table::Parameters& params = *(rpc_parameters.parameters);
+ for (const auto& param : params) {
+ if (param.is_valid() && ParamExists(param)) {
+ valid_params.push_back(param);
+ }
+ }
+ rpc_parameters.parameters->swap(valid_params);
+}
+
+/**
+ * @brief FilterInvalidPriorityValues filter notification priorities that are
+ * not present in schema
+ * @param notifications priorities to filter
+ */
+void FilterInvalidPriorityValues(
+ policy_table::NumberOfNotificationsPerMinute& notifications) {
+ policy_table::NumberOfNotificationsPerMinute valid_notifications;
+ for (const auto& notification : notifications) {
+ policy_table::Priority priority;
+ if (policy_table::EnumFromJsonString(notification.first, &priority)) {
+ valid_notifications.insert(notification);
+ }
+ }
+ notifications.swap(valid_notifications);
+}
+
+/**
+ * @brief FilterInvalidApplicationParameters filter app params that are not
+ * present in schema
+ * @param app_params object of app policy params to filter
+ */
+void FilterInvalidApplicationParameters(
+ policy_table::ApplicationParams& app_params) {
+ // Filter AppHMIType array
+ policy_table::AppHMITypes valid_app_hmi_types;
+ const policy_table::AppHMITypes& app_hmi_types = *(app_params.AppHMIType);
+ for (const auto& app_hmi_type : app_hmi_types) {
+ if (app_hmi_type.is_valid()) {
+ valid_app_hmi_types.push_back(app_hmi_type);
+ }
+ }
+ app_params.AppHMIType->swap(valid_app_hmi_types);
+
+ // Filter RquestTypes array
+ policy_table::RequestTypes valid_request_types;
+ const policy_table::RequestTypes& request_types = *(app_params.RequestType);
+ for (const auto& request_type : request_types) {
+ if (request_type.is_valid()) {
+ valid_request_types.push_back(request_type);
+ }
+ }
+ if (valid_request_types.empty() && !request_types.empty()) {
+ // An empty RequestType array will allow all request types. No valid
+ // parameters are in the filtered array, so assign an uninitialized value to
+ // for array to be "omitted"
+ *(app_params.RequestType) = policy_table::RequestTypes();
+ } else {
+ app_params.RequestType->swap(valid_request_types);
+ }
+
+ // Filter moduleType array
+ policy_table::ModuleTypes valid_module_types;
+ const policy_table::ModuleTypes& module_types = *(app_params.moduleType);
+ for (const auto& module_type : module_types) {
+ if (module_type.is_valid()) {
+ valid_module_types.push_back(module_type);
+ }
+ }
+ if (valid_module_types.empty() && !module_types.empty()) {
+ // An empty moduleType array will allow all request types. No valid
+ // parameters are in the filtered array, so assign an uninitialized value to
+ // for array to be "omitted"
+ *(app_params.moduleType) = policy_table::ModuleTypes();
+ } else {
+ app_params.moduleType->swap(valid_module_types);
+ }
+
+ // Filter default_hmi
+ if (!app_params.default_hmi.is_valid()) {
+ app_params.default_hmi = policy_table::HmiLevel();
+ }
+
+ // Filter priority
+ if (!app_params.priority.is_valid()) {
+ app_params.priority = policy_table::Priority();
+ }
+}
+
+/**
+ * @brief FilterPolicyTable filter values that not present in schema
+ * @param pt policy table to filter
+ */
+void FilterPolicyTable(
+ policy_table::PolicyTable& pt,
+ const std::vector<policy_table::VehicleDataItem>& current_vd_items) {
+ policy_table::ModuleConfig& module_config = pt.module_config;
+ if (module_config.is_initialized() &&
+ module_config.notifications_per_minute_by_priority.is_initialized()) {
+ FilterInvalidPriorityValues(
+ module_config.notifications_per_minute_by_priority);
+ }
+
+ if (pt.app_policies_section.is_initialized()) {
+ policy_table::ApplicationPolicies& apps = pt.app_policies_section.apps;
+ for (auto& app_policy : apps) {
+ FilterInvalidApplicationParameters(app_policy.second);
+ }
+ }
+
+ for (auto& group : pt.functional_groupings) {
+ policy_table::Rpc& rpcs = group.second.rpcs;
+ FilterInvalidFunctions(rpcs);
+
+ policy_table::VehicleDataItems vehicle_data_items;
+
+ if (!pt.vehicle_data->struct_empty()) {
+ vehicle_data_items =
+ pt.vehicle_data.is_initialized() &&
+ pt.vehicle_data->schema_items.is_initialized()
+ ? *pt.vehicle_data->schema_items
+ : current_vd_items;
+ }
+
+ for (auto& func : rpcs) {
+ FilterInvalidRPCParameters(func.second, vehicle_data_items);
+ }
+ }
+}
+
+PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
+ const std::string& file, const BinaryMessage& pt_content) {
LOG4CXX_INFO(logger_, "LoadPT of size " << pt_content.size());
LOG4CXX_DEBUG(
logger_,
"PTU content is: " << std::string(pt_content.begin(), pt_content.end()));
// Parse message into table struct
- utils::SharedPtr<policy_table::Table> pt_update = Parse(pt_content);
+ std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content);
if (!pt_update) {
LOG4CXX_WARN(logger_, "Parsed table pointer is NULL.");
- update_status_manager_.OnWrongUpdateReceived();
- return false;
+ return PtProcessingResult::kWrongPtReceived;
}
file_system::DeleteFile(file);
+ auto current_vd_items = GetVehicleDataItems();
+ FilterPolicyTable(pt_update->policy_table, current_vd_items);
if (!IsPTValid(pt_update, policy_table::PT_UPDATE)) {
- wrong_ptu_update_received_ = true;
- update_status_manager_.OnWrongUpdateReceived();
- return false;
+ LOG4CXX_WARN(logger_, "Received policy table update is not valid");
+ return PtProcessingResult::kWrongPtReceived;
}
- update_status_manager_.OnValidUpdateReceived();
cache_->SaveUpdateRequired(false);
+ sync_primitives::AutoLock lock(apps_registration_lock_);
- {
- sync_primitives::AutoLock lock(apps_registration_lock_);
+ // Get current DB data, since it could be updated during awaiting of PTU
+ auto policy_table_snapshot = cache_->GenerateSnapshot();
+ if (!policy_table_snapshot) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Failed to create snapshot of policy table, trying another exchange");
+ return PtProcessingResult::kNewPtRequired;
+ }
- // Get current DB data, since it could be updated during awaiting of PTU
- utils::SharedPtr<policy_table::Table> policy_table_snapshot =
- cache_->GenerateSnapshot();
- if (!policy_table_snapshot) {
- LOG4CXX_ERROR(
- logger_,
- "Failed to create snapshot of policy table, trying another exchange");
- ForcePTExchange();
- return false;
- }
+ // Checking of difference between PTU and current policy state
+ // Must to be done before PTU applying since it is possible, that functional
+ // groups, which had been present before are absent in PTU and will be
+ // removed after update. So in case of revoked groups system has to know
+ // names and ids of revoked groups before they will be removed.
+ CheckAppPolicyResults results =
+ CheckPermissionsChanges(pt_update, policy_table_snapshot);
- // Checking of difference between PTU and current policy state
- // Must to be done before PTU applying since it is possible, that functional
- // groups, which had been present before are absent in PTU and will be
- // removed after update. So in case of revoked groups system has to know
- // names and ids of revoked groups before they will be removed.
- CheckAppPolicyResults results =
- CheckPermissionsChanges(pt_update, policy_table_snapshot);
-
- // Replace current data with updated
- if (!cache_->ApplyUpdate(*pt_update)) {
- LOG4CXX_WARN(
- logger_,
- "Unsuccessful save of updated policy table, trying another exchange");
- ForcePTExchange();
- return false;
- }
+ // Replace current data with updated
+ if (!cache_->ApplyUpdate(*pt_update)) {
+ LOG4CXX_WARN(
+ logger_,
+ "Unsuccessful save of updated policy table, trying another exchange");
+ return PtProcessingResult::kNewPtRequired;
+ }
- ExternalConsentStatus status = cache_->GetExternalConsentStatus();
- GroupsByExternalConsentStatus groups_by_status =
- cache_->GetGroupsWithSameEntities(status);
+ ExternalConsentStatus status = cache_->GetExternalConsentStatus();
+ GroupsByExternalConsentStatus groups_by_status =
+ cache_->GetGroupsWithSameEntities(status);
- ProcessExternalConsentStatusUpdate(
- groups_by_status, ConsentProcessingPolicy::kExternalConsentBased);
+ ProcessExternalConsentStatusUpdate(
+ groups_by_status, ConsentProcessingPolicy::kExternalConsentBased);
- ProcessAppPolicyCheckResults(
- results, pt_update->policy_table.app_policies_section.apps);
+ ProcessAppPolicyCheckResults(
+ results, pt_update->policy_table.app_policies_section.apps);
- listener_->OnCertificateUpdated(
- *(pt_update->policy_table.module_config.certificate));
+ CheckPermissionsChangesAfterUpdate(*pt_update, *policy_table_snapshot);
- std::map<std::string, StringArray> app_hmi_types;
- cache_->GetHMIAppTypeAfterUpdate(app_hmi_types);
- if (!app_hmi_types.empty()) {
- LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType");
- listener_->OnUpdateHMIAppType(app_hmi_types);
- } else {
- LOG4CXX_INFO(logger_, "app_hmi_types empty");
- }
+ listener_->OnCertificateUpdated(
+ *(pt_update->policy_table.module_config.certificate));
+
+ std::map<std::string, StringArray> app_hmi_types;
+ cache_->GetHMIAppTypeAfterUpdate(app_hmi_types);
+ if (!app_hmi_types.empty()) {
+ LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType");
+ listener_->OnUpdateHMIAppType(app_hmi_types);
+ } else {
+ LOG4CXX_INFO(logger_, "app_hmi_types empty");
+ }
+
+ std::vector<std::string> enabled_apps;
+ cache_->GetEnabledCloudApps(enabled_apps);
+ for (auto it = enabled_apps.begin(); it != enabled_apps.end(); ++it) {
+ SendAuthTokenUpdated(*it);
+ }
+
+ return PtProcessingResult::kSuccess;
+}
+
+void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ptu_requested_ = false;
+ if (PtProcessingResult::kWrongPtReceived == ptu_result) {
+ LOG4CXX_DEBUG(logger_, "Wrong PT was received");
+ update_status_manager_.OnWrongUpdateReceived();
+ return;
}
+ update_status_manager_.OnValidUpdateReceived();
+
+ if (HasApplicationForPTU()) {
+ update_status_manager_.OnExistedApplicationAdded(true);
+ } else if (PtProcessingResult::kNewPtRequired == ptu_result) {
+ LOG4CXX_DEBUG(logger_, "New PTU interation is required");
+ ForcePTExchange();
+ return;
+ }
+
+ ResumePendingAppPolicyActions();
+
// If there was a user request for policy table update, it should be started
// right after current update is finished
if (update_status_manager_.IsUpdateRequired()) {
+ LOG4CXX_DEBUG(logger_,
+ "PTU was successful and new PTU iteration was scheduled");
StartPTExchange();
- return true;
+ return;
}
RefreshRetrySequence();
- return true;
}
CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges(
- const utils::SharedPtr<policy_table::Table> pt_update,
- const utils::SharedPtr<policy_table::Table> snapshot) {
- LOG4CXX_INFO(logger_, "Checking incoming permissions.");
+ const std::shared_ptr<policy_table::Table> pt_update,
+ const std::shared_ptr<policy_table::Table> snapshot) {
+ LOG4CXX_AUTO_TRACE(logger_);
// Replace predefined policies with its actual setting, e.g. "123":"default"
// to actual values of default section
@@ -379,6 +591,17 @@ CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges(
return out_results;
}
+void PolicyManagerImpl::CheckPermissionsChangesAfterUpdate(
+ const policy_table::Table& update, const policy_table::Table& snapshot) {
+ const auto new_lock_screen_dismissal_enabled =
+ update.policy_table.module_config.lock_screen_dismissal_enabled;
+ const auto old_lock_screen_dismissal_enabled =
+ snapshot.policy_table.module_config.lock_screen_dismissal_enabled;
+ if (new_lock_screen_dismissal_enabled != old_lock_screen_dismissal_enabled) {
+ listener()->OnLockScreenDismissalStateChanged();
+ }
+}
+
void PolicyManagerImpl::ProcessAppPolicyCheckResults(
const CheckAppPolicyResults& results,
const policy_table::ApplicationPolicies& app_policies) {
@@ -393,33 +616,43 @@ void PolicyManagerImpl::ProcessAppPolicyCheckResults(
void PolicyManagerImpl::ProcessActionsForAppPolicies(
const ApplicationsPoliciesActions& actions,
const policy_table::ApplicationPolicies& app_policies) {
- ApplicationsPoliciesActions::const_iterator it_actions = actions.begin();
- for (; it_actions != actions.end(); ++it_actions) {
- policy_table::ApplicationPolicies::const_iterator app_policy =
- app_policies.find(it_actions->first);
+ notify_system_list_.clear();
+ send_permissions_list_.clear();
+
+ for (const auto& action : actions) {
+ const auto& app_policy = app_policies.find(action.first);
if (app_policies.end() == app_policy) {
continue;
}
- if (it_actions->second.is_consent_needed) {
- // Post-check after ExternalConsent consent changes
- const std::string& policy_app_id = app_policy->first;
- if (!IsConsentNeeded(policy_app_id)) {
- sync_primitives::AutoLock lock(app_permissions_diff_lock_);
+ if (action.second.app_properties_changed) {
+ app_properties_changed_list_.push_back(app_policy->first);
+ }
+
+ const auto devices_ids = listener()->GetDevicesIds(app_policy->first);
+ for (const auto& device_id : devices_ids) {
+ if (action.second.is_consent_needed) {
+ // Post-check after ExternalConsent consent changes
+ const auto& policy_app_id = app_policy->first;
+ if (!IsConsentNeeded(device_id, policy_app_id)) {
+ sync_primitives::AutoLock lock(app_permissions_diff_lock_);
- PendingPermissions::iterator app_id_diff =
- app_permissions_diff_.find(policy_app_id);
+ const auto& app_id_diff = app_permissions_diff_.find(policy_app_id);
- if (app_permissions_diff_.end() != app_id_diff) {
- app_id_diff->second.appPermissionsConsentNeeded = false;
+ if (app_permissions_diff_.end() != app_id_diff) {
+ app_id_diff->second.appPermissionsConsentNeeded = false;
+ }
}
}
- }
- if (it_actions->second.is_notify_system) {
- NotifySystem(*app_policy);
- }
- if (it_actions->second.is_send_permissions_to_app) {
- SendPermissionsToApp(*app_policy);
+
+ if (action.second.is_notify_system) {
+ notify_system_list_.push_back(std::make_pair(device_id, *app_policy));
+ }
+
+ if (action.second.is_send_permissions_to_app) {
+ send_permissions_list_.push_back(
+ std::make_pair(device_id, *app_policy));
+ }
}
}
}
@@ -456,19 +689,19 @@ std::string PolicyManagerImpl::GetUpdateUrl(int service_type) {
}
void PolicyManagerImpl::GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
cache_->GetUpdateUrls(service_type, out_end_points);
}
void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
cache_->GetUpdateUrls(service_type, out_end_points);
}
void PolicyManagerImpl::RequestPTUpdate() {
LOG4CXX_AUTO_TRACE(logger_);
- utils::SharedPtr<policy_table::Table> policy_table_snapshot =
+ std::shared_ptr<policy_table::Table> policy_table_snapshot =
cache_->GenerateSnapshot();
if (!policy_table_snapshot) {
LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table");
@@ -477,13 +710,14 @@ void PolicyManagerImpl::RequestPTUpdate() {
if (IsPTValid(policy_table_snapshot, policy_table::PT_SNAPSHOT)) {
Json::Value value = policy_table_snapshot->ToJsonValue();
- Json::FastWriter writer;
- std::string message_string = writer.write(value);
+ Json::StreamWriterBuilder writer_builder;
+ writer_builder["indentation"] = "";
+ std::string message_string = Json::writeString(writer_builder, value);
LOG4CXX_DEBUG(logger_, "Snapshot contents is : " << message_string);
BinaryMessage update(message_string.begin(), message_string.end());
-
+ ptu_requested_ = true;
listener_->OnSnapshotCreated(
update, RetrySequenceDelaysSeconds(), TimeoutExchangeMSec());
} else {
@@ -517,9 +751,10 @@ void PolicyManagerImpl::StartPTExchange() {
return;
}
LOG4CXX_INFO(logger_, "Policy want to call RequestPTUpdate");
- if (listener_ && listener_->CanUpdate()) {
+ if (listener_) {
LOG4CXX_INFO(logger_, "Listener CanUpdate");
if (update_status_manager_.IsUpdateRequired()) {
+ update_status_manager_.PendingUpdate();
LOG4CXX_INFO(logger_, "IsUpdateRequired");
RequestPTUpdate();
}
@@ -542,11 +777,16 @@ void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) {
}
}
+void PolicyManagerImpl::UpdatePTUReadyAppsCount(const uint32_t new_app_count) {
+ applications_pending_ptu_count_ = new_app_count;
+}
+
const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes(
+ const transport_manager::DeviceHandle& device_handle,
const std::string policy_app_id) const {
std::vector<std::string> request_types;
- if (kDeviceDisallowed ==
- cache_->GetDeviceConsent(GetCurrentDeviceId(policy_app_id))) {
+ if (kDeviceAllowed != cache_->GetDeviceConsent(
+ GetCurrentDeviceId(device_handle, policy_app_id))) {
cache_->GetAppRequestTypes(kPreDataConsentId, request_types);
} else {
cache_->GetAppRequestTypes(policy_app_id, request_types);
@@ -573,11 +813,83 @@ const std::vector<std::string> PolicyManagerImpl::GetAppRequestSubTypes(
return request_subtypes;
}
-const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const {
- return cache_->GetVehicleInfo();
+const std::vector<policy_table::VehicleDataItem>
+PolicyManagerImpl::GetVehicleDataItems() const {
+ return cache_->GetVehicleDataItems();
+}
+
+std::vector<policy_table::VehicleDataItem>
+PolicyManagerImpl::GetRemovedVehicleDataItems() const {
+ return cache_->GetRemovedVehicleDataItems();
+}
+
+Json::Value PolicyManagerImpl::GetPolicyTableData() const {
+ return cache_->GetPolicyTableData();
+}
+
+void PolicyManagerImpl::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ cache_->GetEnabledCloudApps(enabled_apps);
+}
+
+std::vector<std::string> PolicyManagerImpl::GetEnabledLocalApps() const {
+ return cache_->GetEnabledLocalApps();
+}
+
+bool PolicyManagerImpl::GetAppProperties(
+ const std::string& policy_app_id, AppProperties& out_app_properties) const {
+ return cache_->GetAppProperties(policy_app_id, out_app_properties);
+}
+
+void PolicyManagerImpl::InitCloudApp(const std::string& policy_app_id) {
+ cache_->InitCloudApp(policy_app_id);
+}
+
+void PolicyManagerImpl::SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) {
+ cache_->SetCloudAppEnabled(policy_app_id, enabled);
+}
+
+void PolicyManagerImpl::SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ cache_->SetAppAuthToken(policy_app_id, auth_token);
+}
+
+void PolicyManagerImpl::SetAppCloudTransportType(
+ const std::string& policy_app_id, const std::string& cloud_transport_type) {
+ cache_->SetAppCloudTransportType(policy_app_id, cloud_transport_type);
+}
+
+void PolicyManagerImpl::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ cache_->SetAppEndpoint(policy_app_id, endpoint);
+}
+
+void PolicyManagerImpl::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ cache_->SetAppNicknames(policy_app_id, nicknames);
+}
+
+void PolicyManagerImpl::SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) {
+ cache_->SetHybridAppPreference(policy_app_id, hybrid_app_preference);
+}
+
+void PolicyManagerImpl::GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ cache_->GetAppServiceParameters(policy_app_id, app_service_parameters);
+}
+
+bool PolicyManagerImpl::UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->UnknownRPCPassthroughAllowed(policy_app_id);
}
-void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
+void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
+ const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
const RPCParams& rpc_params,
@@ -586,8 +898,6 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
"CheckPermissions for " << app_id << " and rpc " << rpc
<< " for " << hmi_level << " level.");
- const std::string device_id = GetCurrentDeviceId(app_id);
-
Permissions rpc_permissions;
// Check, if there are calculated permission present in cache
@@ -726,8 +1036,9 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
for (; end != parameter; ++parameter) {
if (!result.HasParameter(*parameter)) {
LOG4CXX_DEBUG(logger_,
- "Parameter " << *parameter << " is unknown."
- " Adding to undefined list.");
+ "Parameter " << *parameter
+ << " is unknown."
+ " Adding to undefined list.");
result.list_of_undefined_params.insert(*parameter);
}
}
@@ -737,7 +1048,12 @@ void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
result.hmi_level_permitted = kRpcUserDisallowed;
} else if (!result.IsAnyAllowed(rpc_params)) {
LOG4CXX_DEBUG(logger_, "There are no parameters allowed.");
- result.hmi_level_permitted = kRpcDisallowed;
+
+ if (!result.list_of_undefined_params.empty()) {
+ result.hmi_level_permitted = kRpcAllowed;
+ } else {
+ result.hmi_level_permitted = kRpcDisallowed;
+ }
}
}
@@ -756,13 +1072,13 @@ policy_table::Strings PolicyManagerImpl::GetGroupsNames(
}
void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
- const std::string& application_id) {
+ const std::string& device_id, const std::string& application_id) {
LOG4CXX_AUTO_TRACE(logger_);
- const std::string device_id = GetCurrentDeviceId(application_id);
if (device_id.empty()) {
LOG4CXX_WARN(logger_,
"Couldn't find device info for application id "
- "'" << application_id << "'");
+ "'" << application_id
+ << "'");
return;
}
@@ -785,15 +1101,16 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
const ApplicationOnDevice who = {device_id, application_id};
if (access_remote_->IsAppRemoteControl(who)) {
- listener()->OnPermissionsUpdated(application_id, notification_data);
+ listener()->OnPermissionsUpdated(
+ device_id, application_id, notification_data);
return;
}
std::string default_hmi;
- GetDefaultHmi(application_id, &default_hmi);
+ GetDefaultHmi(device_id, application_id, &default_hmi);
listener()->OnPermissionsUpdated(
- application_id, notification_data, default_hmi);
+ device_id, application_id, notification_data, default_hmi);
}
bool PolicyManagerImpl::CleanupUnpairedDevices() {
@@ -819,21 +1136,25 @@ void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id,
"Event listener is not initialized. "
"Can't call OnDeviceConsentChanged");
}
- if (is_allowed) {
+ if (is_allowed && listener_->CanUpdate()) {
update_status_manager_.OnDeviceConsented();
}
StartPTExchange();
}
bool PolicyManagerImpl::ReactOnUserDevConsentForApp(
- const std::string& app_id, const bool is_device_allowed) {
- std::vector<std::string> current_request_types = GetAppRequestTypes(app_id);
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string& app_id,
+ const bool is_device_allowed) {
+ std::vector<std::string> current_request_types =
+ GetAppRequestTypes(device_handle, app_id);
std::string current_priority, new_priority;
GetPriority(app_id, &current_priority);
bool result = cache_->ReactOnUserDevConsentForApp(app_id, is_device_allowed);
- std::vector<std::string> new_request_types = GetAppRequestTypes(app_id);
+ std::vector<std::string> new_request_types =
+ GetAppRequestTypes(device_handle, app_id);
GetPriority(app_id, &new_priority);
std::sort(current_request_types.begin(), current_request_types.end());
std::sort(new_request_types.begin(), new_request_types.end());
@@ -858,7 +1179,8 @@ bool PolicyManagerImpl::ReactOnUserDevConsentForApp(
}
if (permissions.requestTypeChanged || (!permissions.priority.empty())) {
- listener_->SendOnAppPermissionsChanged(permissions, app_id);
+ const auto& device_id = GetCurrentDeviceId(device_handle, app_id);
+ listener_->SendOnAppPermissionsChanged(permissions, device_id, app_id);
}
return result;
}
@@ -883,6 +1205,12 @@ void PolicyManagerImpl::AddDevice(const std::string& device_id,
}
}
+void PolicyManagerImpl::OnLocalAppAdded() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ update_status_manager_.ScheduleUpdate();
+ StartPTExchange();
+}
+
void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id,
const DeviceInfo& device_info) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -976,6 +1304,7 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges(
}
void PolicyManagerImpl::NotifyPermissionsChanges(
+ const std::string& device_id,
const std::string& policy_app_id,
const std::vector<FunctionalGroupPermission>& app_group_permissions) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -991,7 +1320,7 @@ void PolicyManagerImpl::NotifyPermissionsChanges(
PrepareNotificationData(
functional_groups, app_groups, app_group_permissions, notification_data);
- listener()->OnPermissionsUpdated(policy_app_id, notification_data);
+ listener()->OnPermissionsUpdated(device_id, policy_app_id, notification_data);
}
void PolicyManagerImpl::SetUserConsentForApp(
@@ -1030,14 +1359,64 @@ void PolicyManagerImpl::SetUserConsentForApp(
CheckPendingPermissionsChanges(verified_permissions.policy_app_id,
updated_app_group_permissons);
- NotifyPermissionsChanges(verified_permissions.policy_app_id,
+ NotifyPermissionsChanges(verified_permissions.device_id,
+ verified_permissions.policy_app_id,
updated_app_group_permissons);
}
-bool PolicyManagerImpl::GetDefaultHmi(const std::string& policy_app_id,
+bool PolicyManagerImpl::IsAllowedRetryCountExceeded() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
+
+ return retry_sequence_index_ > retry_sequence_seconds_.size();
+}
+
+void PolicyManagerImpl::IncrementRetryIndex() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
+
+ if (!is_ptu_in_progress_) {
+ LOG4CXX_TRACE(logger_,
+ "First PTU iteration, skipping incrementing retry index");
+ is_ptu_in_progress_ = true;
+ return;
+ }
+
+ ++retry_sequence_index_;
+ LOG4CXX_DEBUG(logger_,
+ "current retry_sequence_index_ is: " << retry_sequence_index_);
+}
+
+void PolicyManagerImpl::RetrySequenceFailed() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ listener_->OnPTUFinished(false);
+ ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate);
+
+ ptu_requested_ = false;
+ if (HasApplicationForPTU()) {
+ update_status_manager_.OnExistedApplicationAdded(true);
+ StartPTExchange();
+ }
+}
+
+void PolicyManagerImpl::ResetTimeout() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (update_status_manager_.IsUpdatePending()) {
+ uint32_t update_timeout = TimeoutExchangeMSec();
+ update_status_manager_.ResetTimeout(update_timeout);
+ }
+}
+
+void PolicyManagerImpl::OnSystemRequestReceived() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ IncrementRetryIndex();
+}
+
+bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi) const {
LOG4CXX_AUTO_TRACE(logger_);
- const std::string device_id = GetCurrentDeviceId(policy_app_id);
DeviceConsent device_consent = GetUserConsentForDevice(device_id);
const std::string app_id = policy::kDeviceAllowed != device_consent
? kPreDataConsentId
@@ -1098,10 +1477,6 @@ void PolicyManagerImpl::GetUserConsentForApp(
FunctionalGroupIDs preconsented_groups = group_types[kTypePreconsented];
FunctionalGroupIDs consent_allowed_groups = group_types[kTypeAllowed];
FunctionalGroupIDs consent_disallowed_groups = group_types[kTypeDisallowed];
- FunctionalGroupIDs default_groups = group_types[kTypeDefault];
- FunctionalGroupIDs predataconsented_groups =
- group_types[kTypePreDataConsented];
- FunctionalGroupIDs device_groups = group_types[kTypeDevice];
// Sorting groups by consent
FunctionalGroupIDs preconsented_wo_auto =
@@ -1113,15 +1488,8 @@ void PolicyManagerImpl::GetUserConsentForApp(
FunctionalGroupIDs allowed_groups =
Merge(consent_allowed_groups, preconsented_wo_disallowed_auto);
- FunctionalGroupIDs merged_stage_1 =
- Merge(default_groups, predataconsented_groups);
-
- FunctionalGroupIDs merged_stage_2 = Merge(merged_stage_1, device_groups);
-
- FunctionalGroupIDs merged_stage_3 =
- Merge(merged_stage_2, auto_allowed_groups);
-
- FunctionalGroupIDs excluded_stage_1 = ExcludeSame(all_groups, merged_stage_3);
+ FunctionalGroupIDs excluded_stage_1 =
+ ExcludeSame(all_groups, auto_allowed_groups);
FunctionalGroupIDs excluded_stage_2 =
ExcludeSame(excluded_stage_1, consent_disallowed_groups);
@@ -1153,11 +1521,13 @@ void PolicyManagerImpl::GetPermissionsForApp(
}
bool allowed_by_default = false;
- if (cache_->IsDefaultPolicy(policy_app_id)) {
+ const auto device_consent = GetUserConsentForDevice(device_id);
+ if ((policy::kDeviceAllowed == device_consent) &&
+ cache_->IsDefaultPolicy(policy_app_id)) {
app_id_to_check = kDefaultId;
allowed_by_default = true;
} else if (cache_->IsPredataPolicy(policy_app_id) ||
- policy::kDeviceDisallowed == GetUserConsentForDevice(device_id)) {
+ policy::kDeviceAllowed != device_consent) {
app_id_to_check = kPreDataConsentId;
allowed_by_default = true;
}
@@ -1241,9 +1611,11 @@ void PolicyManagerImpl::GetPermissionsForApp(
}
std::string& PolicyManagerImpl::GetCurrentDeviceId(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) const {
LOG4CXX_INFO(logger_, "GetDeviceInfo");
- last_device_id_ = listener()->OnCurrentDeviceIdUpdateRequired(policy_app_id);
+ last_device_id_ =
+ listener()->OnCurrentDeviceIdUpdateRequired(device_handle, policy_app_id);
return last_device_id_;
}
@@ -1258,13 +1630,6 @@ void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
cache_->SetMetaInfo(ccpu_version, wers_country_code, language);
}
-void PolicyManagerImpl::OnSystemReady() {
- // Update policy table for the first time with system information
- if (!cache_->IsMetaInfoPresent()) {
- listener()->OnSystemInfoUpdateRequired();
- }
-}
-
uint32_t PolicyManagerImpl::GetNotificationsNumber(
const std::string& priority) const {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1276,7 +1641,7 @@ bool PolicyManagerImpl::ExceededIgnitionCycles() {
}
bool PolicyManagerImpl::IsPTValid(
- utils::SharedPtr<policy_table::Table> policy_table,
+ std::shared_ptr<policy_table::Table> policy_table,
policy_table::PolicyTableType type) const {
policy_table->SetPolicyTableType(type);
if (!policy_table->is_valid()) {
@@ -1289,6 +1654,10 @@ bool PolicyManagerImpl::IsPTValid(
return true;
}
+bool PolicyManagerImpl::HasApplicationForPTU() const {
+ return applications_pending_ptu_count_ > 0;
+}
+
const PolicySettings& PolicyManagerImpl::get_settings() const {
DCHECK(settings_);
return *settings_;
@@ -1346,16 +1715,42 @@ void PolicyManagerImpl::UpdateAppConsentWithExternalConsent(
cache_->SetExternalConsentForApp(updated_external_consent_permissions);
}
+void PolicyManagerImpl::SendOnAppPropertiesChangeNotification(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ listener_->SendOnAppPropertiesChangeNotification(policy_app_id);
+}
+
+void PolicyManagerImpl::ResumePendingAppPolicyActions() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ for (auto& notify_system_params : notify_system_list_) {
+ NotifySystem(notify_system_params.first, notify_system_params.second);
+ }
+ notify_system_list_.clear();
+
+ for (auto& send_permissions_params : send_permissions_list_) {
+ SendPermissionsToApp(send_permissions_params.first,
+ send_permissions_params.second);
+ }
+
+ for (auto& app : app_properties_changed_list_) {
+ SendOnAppPropertiesChangeNotification(app);
+ }
+ send_permissions_list_.clear();
+}
+
void PolicyManagerImpl::NotifySystem(
+ const std::string& device_id,
const PolicyManagerImpl::AppPoliciesValueType& app_policy) const {
- listener()->OnPendingPermissionChange(app_policy.first);
+ listener()->OnPendingPermissionChange(device_id, app_policy.first);
}
void PolicyManagerImpl::SendPermissionsToApp(
+ const std::string& device_id,
const PolicyManagerImpl::AppPoliciesValueType& app_policy) {
const std::string app_id = app_policy.first;
- const std::string device_id = GetCurrentDeviceId(app_id);
if (device_id.empty()) {
LOG4CXX_WARN(logger_,
"Couldn't find device info for application id: " << app_id);
@@ -1367,7 +1762,7 @@ void PolicyManagerImpl::SendPermissionsToApp(
Permissions notification_data;
// Need to get rid of this call
- utils::SharedPtr<policy_table::Table> policy_table_snapshot =
+ std::shared_ptr<policy_table::Table> policy_table_snapshot =
cache_->GenerateSnapshot();
PrepareNotificationData(
@@ -1378,6 +1773,7 @@ void PolicyManagerImpl::SendPermissionsToApp(
LOG4CXX_INFO(logger_, "Send notification for application_id: " << app_id);
listener()->OnPermissionsUpdated(
+ device_id,
app_id,
notification_data,
policy_table::EnumToJsonString(app_policy.second.default_hmi));
@@ -1496,9 +1892,9 @@ void PolicyManagerImpl::CalculateGroupsConsentFromExternalConsent(
bool PolicyManagerImpl::ExceededDays() {
LOG4CXX_AUTO_TRACE(logger_);
- TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ date_time::TimeDuration current_time = date_time::getCurrentTime();
const int kSecondsInDay = 60 * 60 * 24;
- const int days = current_time.tv_sec / kSecondsInDay;
+ const int days = date_time::getSecs(current_time) / kSecondsInDay;
DCHECK(std::numeric_limits<uint16_t>::max() >= days);
@@ -1519,6 +1915,19 @@ void PolicyManagerImpl::KmsChanged(int kilometers) {
}
}
+const boost::optional<bool> PolicyManagerImpl::LockScreenDismissalEnabledState()
+ const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->LockScreenDismissalEnabledState();
+}
+
+const boost::optional<std::string>
+PolicyManagerImpl::LockScreenDismissalWarningMessage(
+ const std::string& language) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->LockScreenDismissalWarningMessage(language);
+}
+
void PolicyManagerImpl::IncrementIgnitionCycles() {
cache_->IncrementIgnitionCycles();
}
@@ -1529,6 +1938,14 @@ std::string PolicyManagerImpl::ForcePTExchange() {
return update_status_manager_.StringifiedUpdateStatus();
}
+void policy::PolicyManagerImpl::StopRetrySequence() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (cache_->UpdateRequired()) {
+ ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate);
+ }
+}
+
std::string PolicyManagerImpl::ForcePTExchangeAtUserRequest() {
LOG4CXX_AUTO_TRACE(logger_);
update_status_manager_.ScheduleManualUpdate();
@@ -1544,10 +1961,11 @@ int PolicyManagerImpl::NextRetryTimeout() {
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
LOG4CXX_DEBUG(logger_, "Index: " << retry_sequence_index_);
int next = 0;
+
if (!retry_sequence_seconds_.empty() &&
retry_sequence_index_ < retry_sequence_seconds_.size()) {
- next = retry_sequence_seconds_[retry_sequence_index_];
- ++retry_sequence_index_;
+ next = retry_sequence_seconds_[retry_sequence_index_] *
+ date_time::MILLISECONDS_IN_SECOND;
}
return next;
}
@@ -1559,10 +1977,15 @@ void PolicyManagerImpl::RefreshRetrySequence() {
cache_->SecondsBetweenRetries(retry_sequence_seconds_);
}
-void PolicyManagerImpl::ResetRetrySequence() {
+void PolicyManagerImpl::ResetRetrySequence(
+ const ResetRetryCountType reset_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
retry_sequence_index_ = 0;
- update_status_manager_.OnResetRetrySequence();
+ is_ptu_in_progress_ = false;
+ if (ResetRetryCountType::kResetWithStatusUpdate == reset_type) {
+ update_status_manager_.OnResetRetrySequence();
+ }
}
uint32_t PolicyManagerImpl::TimeoutExchangeMSec() {
@@ -1575,6 +1998,8 @@ const std::vector<int> PolicyManagerImpl::RetrySequenceDelaysSeconds() {
}
void PolicyManagerImpl::OnExceededTimeout() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
update_status_manager_.OnUpdateTimeoutOccurs();
}
@@ -1582,7 +2007,8 @@ void PolicyManagerImpl::OnUpdateStarted() {
uint32_t update_timeout = TimeoutExchangeMSec();
LOG4CXX_DEBUG(logger_,
"Update timeout will be set to (milisec): " << update_timeout);
- send_on_update_sent_out_ = !update_status_manager_.IsUpdatePending();
+ send_on_update_sent_out_ =
+ policy::kUpdating != update_status_manager_.StringifiedUpdateStatus();
if (send_on_update_sent_out_) {
update_status_manager_.OnUpdateSentOut(update_timeout);
@@ -1625,10 +2051,10 @@ bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const {
return cache_->IsApplicationRevoked(app_id);
}
-bool PolicyManagerImpl::IsConsentNeeded(const std::string& app_id) {
+bool PolicyManagerImpl::IsConsentNeeded(const std::string& device_id,
+ const std::string& app_id) {
LOG4CXX_AUTO_TRACE(logger_);
- const std::string device_id = GetCurrentDeviceId(app_id);
- int count = cache_->CountUnconsentedGroups(app_id, device_id);
+ const int count = cache_->CountUnconsentedGroups(app_id, device_id);
LOG4CXX_DEBUG(logger_, "There are: " << count << " unconsented groups.");
return count != 0;
}
@@ -1638,7 +2064,7 @@ void PolicyManagerImpl::SetVINValue(const std::string& value) {
}
AppPermissions PolicyManagerImpl::GetAppPermissionsChanges(
- const std::string& policy_app_id) {
+ const std::string& device_id, const std::string& policy_app_id) {
PendingPermissions::iterator app_id_diff =
app_permissions_diff_.find(policy_app_id);
@@ -1647,8 +2073,10 @@ AppPermissions PolicyManagerImpl::GetAppPermissionsChanges(
if (app_permissions_diff_.end() != app_id_diff) {
permissions = app_id_diff->second;
} else {
- permissions.appPermissionsConsentNeeded = IsConsentNeeded(policy_app_id);
+ permissions.appPermissionsConsentNeeded =
+ IsConsentNeeded(device_id, policy_app_id);
permissions.appRevoked = IsApplicationRevoked(policy_app_id);
+ permissions.isSDLAllowed = false;
GetPriority(permissions.application_id, &permissions.priority);
}
return permissions;
@@ -1676,9 +2104,11 @@ void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) {
}
void PolicyManagerImpl::OnAppRegisteredOnMobile(
- const std::string& application_id) {
- StartPTExchange();
- SendNotificationOnPermissionsUpdated(application_id);
+ const std::string& device_id, const std::string& application_id) {
+ if (!is_ptu_in_progress_) {
+ StartPTExchange();
+ }
+ SendNotificationOnPermissionsUpdated(device_id, application_id);
}
void PolicyManagerImpl::OnDeviceSwitching(const std::string& device_id_from,
@@ -1767,20 +2197,27 @@ class CallStatusChange : public utils::Callable {
};
StatusNotifier PolicyManagerImpl::AddApplication(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) {
LOG4CXX_AUTO_TRACE(logger_);
- const std::string device_id = GetCurrentDeviceId(application_id);
- DeviceConsent device_consent = GetUserConsentForDevice(device_id);
+ auto device_consent = GetUserConsentForDevice(device_id);
+ LOG4CXX_DEBUG(logger_,
+ "check_device_id: " << device_id << " check_device_consent: "
+ << device_consent);
sync_primitives::AutoLock lock(apps_registration_lock_);
if (IsNewApplication(application_id)) {
- AddNewApplication(application_id, device_consent);
- return utils::MakeShared<CallStatusChange>(update_status_manager_,
- device_consent);
- } else {
- PromoteExistedApplication(application_id, device_consent);
- return utils::MakeShared<utils::CallNothing>();
+ LOG4CXX_DEBUG(logger_, "Adding new application");
+ AddNewApplication(device_id, application_id, device_consent);
+ return std::make_shared<CallStatusChange>(update_status_manager_,
+ device_consent);
+ }
+ LOG4CXX_DEBUG(logger_, "Promote existed application");
+ PromoteExistedApplication(device_id, application_id, device_consent);
+ if (!ptu_requested_) {
+ update_status_manager_.OnExistedApplicationAdded(cache_->UpdateRequired());
}
+ return std::make_shared<utils::CallNothing>();
}
void PolicyManagerImpl::RemoveAppConsentForGroup(
@@ -1795,6 +2232,7 @@ bool PolicyManagerImpl::IsPredataPolicy(
}
void PolicyManagerImpl::ProcessExternalConsentStatusForApp(
+ const std::string& device_id,
const std::string& application_id,
const ConsentProcessingPolicy processing_policy) {
ExternalConsentStatus status = cache_->GetExternalConsentStatus();
@@ -1806,7 +2244,7 @@ void PolicyManagerImpl::ProcessExternalConsentStatusForApp(
CalculateGroupsConsentFromExternalConsent(
groups_by_status, allowed_groups, disallowed_groups);
- const std::string device_id = GetCurrentDeviceId(application_id);
+ LOG4CXX_DEBUG(logger_, "check device_id: " << device_id);
UpdateAppConsentWithExternalConsent(device_id,
application_id,
allowed_groups,
@@ -1814,7 +2252,8 @@ void PolicyManagerImpl::ProcessExternalConsentStatusForApp(
processing_policy);
}
-void PolicyManagerImpl::AddNewApplication(const std::string& application_id,
+void PolicyManagerImpl::AddNewApplication(const std::string& device_id,
+ const std::string& application_id,
DeviceConsent device_consent) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1834,19 +2273,31 @@ void PolicyManagerImpl::AddNewApplication(const std::string& application_id,
}
ProcessExternalConsentStatusForApp(
- application_id, ConsentProcessingPolicy::kExternalConsentBased);
+ device_id,
+ application_id,
+ ConsentProcessingPolicy::kExternalConsentBased);
}
void PolicyManagerImpl::PromoteExistedApplication(
- const std::string& application_id, DeviceConsent device_consent) {
+ const std::string& device_id,
+ const std::string& application_id,
+ DeviceConsent device_consent) {
// If device consent changed to allowed during application being
// disconnected, app permissions should be changed also
+ LOG4CXX_DEBUG(logger_,
+ "kDeviceAllowed == device_consent: "
+ << (kDeviceAllowed == device_consent)
+ << " device_consent: " << device_consent);
if (kDeviceAllowed == device_consent &&
cache_->IsPredataPolicy(application_id)) {
+ LOG4CXX_INFO(logger_,
+ "Setting "
+ << policy::kDefaultId
+ << " permissions for application id: " << application_id);
cache_->SetDefaultPolicy(application_id);
}
- ProcessExternalConsentStatusForApp(application_id,
- ConsentProcessingPolicy::kTimestampBased);
+ ProcessExternalConsentStatusForApp(
+ device_id, application_id, ConsentProcessingPolicy::kTimestampBased);
}
bool PolicyManagerImpl::IsNewApplication(
@@ -1894,7 +2345,11 @@ bool PolicyManagerImpl::InitPT(const std::string& file_name,
const bool ret = cache_->Init(file_name, settings);
if (ret) {
RefreshRetrySequence();
- update_status_manager_.OnPolicyInit(cache_->UpdateRequired());
+ std::vector<std::string> enabled_cloud_apps;
+ cache_->GetEnabledCloudApps(enabled_cloud_apps);
+ for (auto app : enabled_cloud_apps) {
+ SendAuthTokenUpdated(app);
+ }
}
return ret;
}
@@ -1904,12 +2359,17 @@ uint32_t PolicyManagerImpl::HeartBeatTimeout(const std::string& app_id) const {
}
void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!is_update_needed) {
+ ResetRetrySequence(ResetRetryCountType::kResetInternally);
+ }
cache_->SaveUpdateRequired(is_update_needed);
}
void PolicyManagerImpl::set_cache_manager(
CacheManagerInterface* cache_manager) {
- cache_ = cache_manager;
+ cache_ = std::shared_ptr<CacheManagerInterface>(cache_manager);
}
std::ostream& operator<<(std::ostream& output,
@@ -1922,10 +2382,12 @@ std::ostream& operator<<(std::ostream& output,
return output;
}
-void PolicyManagerImpl::SetDefaultHmiTypes(const std::string& application_id,
- const std::vector<int>& hmi_types) {
+void PolicyManagerImpl::SetDefaultHmiTypes(
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string& application_id,
+ const std::vector<int>& hmi_types) {
LOG4CXX_INFO(logger_, "SetDefaultHmiTypes");
- const std::string device_id = GetCurrentDeviceId(application_id);
+ const auto device_id = GetCurrentDeviceId(device_handle, application_id);
ApplicationOnDevice who = {device_id, application_id};
access_remote_->SetDefaultHmiTypes(who, hmi_types);
}
@@ -1963,12 +2425,12 @@ bool PolicyManagerImpl::CheckModule(const PTString& app_id,
void PolicyManagerImpl::SendHMILevelChanged(const ApplicationOnDevice& who) {
std::string default_hmi("NONE");
- if (GetDefaultHmi(who.app_id, &default_hmi)) {
+ if (GetDefaultHmi(who.dev_id, who.app_id, &default_hmi)) {
listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi);
} else {
- LOG4CXX_WARN(logger_,
- "Couldn't get default HMI level for application "
- << who.app_id);
+ LOG4CXX_WARN(
+ logger_,
+ "Couldn't get default HMI level for application " << who.app_id);
}
}
@@ -2000,7 +2462,14 @@ void PolicyManagerImpl::SendAppPermissionsChanged(
const std::string& device_id, const std::string& application_id) {
Permissions notification_data;
GetPermissions(device_id, application_id, &notification_data);
- listener()->OnPermissionsUpdated(application_id, notification_data);
+ listener()->OnPermissionsUpdated(
+ device_id, application_id, notification_data);
+}
+
+void PolicyManagerImpl::SendAuthTokenUpdated(const std::string policy_app_id) {
+ AppProperties app_properties;
+ cache_->GetAppProperties(policy_app_id, app_properties);
+ listener_->OnAuthTokenUpdated(policy_app_id, app_properties.auth_token);
}
void PolicyManagerImpl::OnPrimaryGroupsChanged(
@@ -2024,8 +2493,108 @@ bool PolicyManagerImpl::GetModuleTypes(
}
void PolicyManagerImpl::set_access_remote(
- utils::SharedPtr<AccessRemote> access_remote) {
+ std::shared_ptr<AccessRemote> access_remote) {
access_remote_ = access_remote;
}
+bool PolicyManagerImpl::AppNeedEncryption(
+ const std::string& policy_app_id) const {
+ const auto encryption_required =
+ cache_->GetAppEncryptionRequiredFlag(policy_app_id);
+
+ return encryption_required.is_initialized() ? *encryption_required : true;
+}
+
+const rpc::Optional<rpc::Boolean> PolicyManagerImpl::GetAppEncryptionRequired(
+ const std::string& policy_app_id) const {
+ return cache_->GetAppEncryptionRequiredFlag(policy_app_id);
+}
+
+const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace rpc::policy_table_interface_base;
+ DCHECK(kDeviceId != policy_app_id);
+
+ std::vector<std::string> function_groups;
+
+ ApplicationParams app_params;
+ cache_->GetApplicationParams(policy_app_id, app_params);
+
+ const auto& policy_function_group = app_params.groups;
+
+ for (const auto& group : policy_function_group) {
+ function_groups.push_back(group);
+ }
+
+ return function_groups;
+}
+
+const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs()
+ const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<std::string> policy_app_ids;
+
+ const auto apps = cache_->GetPolicyAppIDs();
+
+ for (const auto& app : apps) {
+ policy_app_ids.push_back(app);
+ }
+
+ return policy_app_ids;
+}
+
+bool PolicyManagerImpl::FunctionGroupNeedEncryption(
+ const std::string& policy_group) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ FunctionalGroupings functional_groupings;
+ cache_->GetFunctionalGroupings(functional_groupings);
+
+ const auto& grouping_itr = functional_groupings.find(policy_group);
+
+ if (grouping_itr == functional_groupings.end()) {
+ LOG4CXX_WARN(logger_, "Group " << policy_group << " not found");
+ return false;
+ }
+
+ const auto& grouping = (*grouping_itr).second;
+
+ return grouping.encryption_required.is_initialized()
+ ? *grouping.encryption_required
+ : false;
+}
+
+const std::string PolicyManagerImpl::GetPolicyFunctionName(
+ const uint32_t function_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return policy_table::EnumToJsonString(
+ static_cast<policy_table::FunctionID>(function_id));
+}
+
+const std::vector<std::string> PolicyManagerImpl::GetRPCsForFunctionGroup(
+ const std::string& group) const {
+ std::vector<std::string> rpcs_for_group;
+
+ FunctionalGroupings functional_groupings;
+ cache_->GetFunctionalGroupings(functional_groupings);
+
+ const auto& rpcs = functional_groupings[group].rpcs;
+
+ for (const auto& rpc : rpcs) {
+ rpcs_for_group.push_back(rpc.first);
+ }
+
+ return rpcs_for_group;
+}
+
} // namespace policy
+
+__attribute__((visibility("default"))) policy::PolicyManager* CreateManager() {
+ return new policy::PolicyManagerImpl();
+}
+
+__attribute__((visibility("default"))) void DeleteManager(
+ policy::PolicyManager* pm) {
+ delete pm;
+ DELETE_THREAD_LOGGER(policy::logger_);
+}
diff --git a/src/components/policy/policy_external/src/policy_table.cc b/src/components/policy/policy_external/src/policy_table.cc
index 7a63fac50d..8ca6b698d1 100644
--- a/src/components/policy/policy_external/src/policy_table.cc
+++ b/src/components/policy/policy_external/src/policy_table.cc
@@ -42,7 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
PolicyTable::PolicyTable() : pt_data_(new SQLPTExtRepresentation()) {}
-PolicyTable::PolicyTable(utils::SharedPtr<PTRepresentation> pt_data)
+PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data)
: pt_data_(pt_data) {}
PolicyTable::~PolicyTable() {
diff --git a/src/components/policy/policy_external/src/policy_table/enums.cc b/src/components/policy/policy_external/src/policy_table/enums.cc
index cb724e93b1..8f5d58aad2 100644
--- a/src/components/policy/policy_external/src/policy_table/enums.cc
+++ b/src/components/policy/policy_external/src/policy_table/enums.cc
@@ -1,535 +1,8 @@
#include "policy/policy_table/enums.h"
+#include <cstring>
namespace rpc {
namespace policy_table_interface_base {
-bool IsValidEnum(Priority val) {
- switch (val) {
- case P_EMERGENCY:
- return true;
- case P_NAVIGATION:
- return true;
- case P_VOICECOM:
- return true;
- case P_COMMUNICATION:
- return true;
- case P_NORMAL:
- return true;
- case P_NONE:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(Priority val) {
- switch (val) {
- case P_EMERGENCY:
- return "EMERGENCY";
- case P_NAVIGATION:
- return "NAVIGATION";
- case P_VOICECOM:
- return "VOICECOM";
- case P_COMMUNICATION:
- return "COMMUNICATION";
- case P_NORMAL:
- return "NORMAL";
- case P_NONE:
- return "NONE";
- default:
- return "";
- }
-}
-bool EnumFromJsonString(const std::string& literal, Priority* result) {
- if ("EMERGENCY" == literal) {
- *result = P_EMERGENCY;
- return true;
- } else if ("NAVIGATION" == literal) {
- *result = P_NAVIGATION;
- return true;
- } else if ("VOICECOM" == literal) {
- *result = P_VOICECOM;
- return true;
- } else if ("COMMUNICATION" == literal) {
- *result = P_COMMUNICATION;
- return true;
- } else if ("NORMAL" == literal) {
- *result = P_NORMAL;
- return true;
- } else if ("NONE" == literal) {
- *result = P_NONE;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(HmiLevel val) {
- switch (val) {
- case HL_BACKGROUND:
- return true;
- case HL_FULL:
- return true;
- case HL_LIMITED:
- return true;
- case HL_NONE:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(HmiLevel val) {
- switch (val) {
- case HL_BACKGROUND:
- return "BACKGROUND";
- case HL_FULL:
- return "FULL";
- case HL_LIMITED:
- return "LIMITED";
- case HL_NONE:
- return "NONE";
- default:
- return "";
- }
-}
-bool EnumFromJsonString(const std::string& literal, HmiLevel* result) {
- if ("BACKGROUND" == literal) {
- *result = HL_BACKGROUND;
- return true;
- } else if ("FULL" == literal) {
- *result = HL_FULL;
- return true;
- } else if ("LIMITED" == literal) {
- *result = HL_LIMITED;
- return true;
- } else if ("NONE" == literal) {
- *result = HL_NONE;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(Parameter val) {
- switch (val) {
- case P_GPS:
- return true;
- case P_SPEED:
- return true;
- case P_ENGINETORQUE:
- return true;
- case P_EXTERNALTEMPERATURE:
- return true;
- case P_TURNSIGNAL:
- return true;
- case P_FUELLEVEL:
- return true;
- case P_FUELLEVEL_STATE:
- return true;
- case P_HEADLAMPSTATUS:
- return true;
- case P_INSTANTFUELCONSUMPTION:
- return true;
- case P_FUELRANGE:
- return true;
- case P_ODOMETER:
- return true;
- case P_TIREPRESSURE:
- return true;
- case P_WIPERSTATUS:
- return true;
- case P_VIN:
- return true;
- case P_ACCPEDALPOSITION:
- return true;
- case P_BELTSTATUS:
- return true;
- case P_DRIVERBRAKING:
- return true;
- case P_PRNDL:
- return true;
- case P_RPM:
- return true;
- case P_STEERINGWHEELANGLE:
- return true;
- case P_ENGINEOILLIFE:
- return true;
- case P_MYKEY:
- return true;
- case P_AIRBAGSTATUS:
- return true;
- case P_BODYINFORMATION:
- return true;
- case P_CLUSTERMODESTATUS:
- return true;
- case P_DEVICESTATUS:
- return true;
- case P_EMERGENCYEVENT:
- return true;
- case P_ECALLINFO:
- return true;
- case P_ABS_STATE:
- return true;
- case P_FUEL_RANGE:
- return true;
- case P_TIRE_PRESSURE_VALUE:
- return true;
- case P_TPMS:
- return true;
- case P_LONGTITUDE_DEGREES:
- return true;
- case P_LATITUDE_DEGREES:
- return true;
- case P_LOCATION_NAME:
- return true;
- case P_LOCATION_DESCRIPTION:
- return true;
- case P_ADDRESS_LINES:
- return true;
- case P_PHONE_NUMBER:
- return true;
- case P_LOCATION_IMAGE:
- return true;
- case P_DELIVERY_MODE:
- return true;
- case P_TIMESTAMP:
- return true;
- case P_ADDRESS:
- return true;
- case P_EMPTY:
- return true;
- default:
- return false;
- }
-}
-
-const char* EnumToJsonString(Parameter val) {
- switch (val) {
- case P_GPS:
- return "gps";
- case P_SPEED:
- return "speed";
- case P_ENGINETORQUE:
- return "engineTorque";
- case P_EXTERNALTEMPERATURE:
- return "externalTemperature";
- case P_TURNSIGNAL:
- return "turnSignal";
- case P_FUELLEVEL:
- return "fuelLevel";
- case P_FUELLEVEL_STATE:
- return "fuelLevel_State";
- case P_HEADLAMPSTATUS:
- return "headLampStatus";
- case P_INSTANTFUELCONSUMPTION:
- return "instantFuelConsumption";
- case P_FUELRANGE:
- return "fuelRange";
- case P_ODOMETER:
- return "odometer";
- case P_TIREPRESSURE:
- return "tirePressure";
- case P_WIPERSTATUS:
- return "wiperStatus";
- case P_VIN:
- return "vin";
- case P_ACCPEDALPOSITION:
- return "accPedalPosition";
- case P_BELTSTATUS:
- return "beltStatus";
- case P_DRIVERBRAKING:
- return "driverBraking";
- case P_PRNDL:
- return "prndl";
- case P_RPM:
- return "rpm";
- case P_STEERINGWHEELANGLE:
- return "steeringWheelAngle";
- case P_ENGINEOILLIFE:
- return "engineOilLife";
- case P_MYKEY:
- return "myKey";
- case P_AIRBAGSTATUS:
- return "airbagStatus";
- case P_BODYINFORMATION:
- return "bodyInformation";
- case P_CLUSTERMODESTATUS:
- return "clusterModeStatus";
- case P_DEVICESTATUS:
- return "deviceStatus";
- case P_EMERGENCYEVENT:
- return "emergencyEvent";
- case P_ECALLINFO:
- return "eCallInfo";
- case P_ABS_STATE:
- return "abs_State";
- case P_FUEL_RANGE:
- return "fuelRange";
- case P_TIRE_PRESSURE_VALUE:
- return "tirePressureValue";
- case P_TPMS:
- return "tpms";
- case P_LONGTITUDE_DEGREES:
- return "longitudeDegrees";
- case P_LATITUDE_DEGREES:
- return "latitudeDegrees";
- case P_LOCATION_NAME:
- return "locationName";
- case P_LOCATION_DESCRIPTION:
- return "locationDescription";
- case P_ADDRESS_LINES:
- return "addressLines";
- case P_PHONE_NUMBER:
- return "phoneNumber";
- case P_LOCATION_IMAGE:
- return "locationImage";
- case P_DELIVERY_MODE:
- return "deliveryMode";
- case P_TIMESTAMP:
- return "timeStamp";
- case P_ADDRESS:
- return "address";
- case P_EMPTY:
- return "EMPTY";
- default:
- return "";
- }
-}
-
-bool EnumFromJsonString(const std::string& literal, Parameter* result) {
- if ("gps" == literal) {
- *result = P_GPS;
- return true;
- } else if ("speed" == literal) {
- *result = P_SPEED;
- return true;
- } else if ("engineTorque" == literal) {
- *result = P_ENGINETORQUE;
- return true;
- } else if ("externalTemperature" == literal) {
- *result = P_EXTERNALTEMPERATURE;
- return true;
- } else if ("turnSignal" == literal) {
- *result = P_TURNSIGNAL;
- return true;
- } else if ("fuelLevel" == literal) {
- *result = P_FUELLEVEL;
- return true;
- } else if ("fuelLevel_State" == literal) {
- *result = P_FUELLEVEL_STATE;
- return true;
- } else if ("headLampStatus" == literal) {
- *result = P_HEADLAMPSTATUS;
- return true;
- } else if ("instantFuelConsumption" == literal) {
- *result = P_INSTANTFUELCONSUMPTION;
- return true;
- } else if ("fuelRange" == literal) {
- *result = P_FUELRANGE;
- return true;
- } else if ("odometer" == literal) {
- *result = P_ODOMETER;
- return true;
- } else if ("tirePressure" == literal) {
- *result = P_TIREPRESSURE;
- return true;
- } else if ("wiperStatus" == literal) {
- *result = P_WIPERSTATUS;
- return true;
- } else if ("vin" == literal) {
- *result = P_VIN;
- return true;
- } else if ("accPedalPosition" == literal) {
- *result = P_ACCPEDALPOSITION;
- return true;
- } else if ("beltStatus" == literal) {
- *result = P_BELTSTATUS;
- return true;
- } else if ("driverBraking" == literal) {
- *result = P_DRIVERBRAKING;
- return true;
- } else if ("prndl" == literal) {
- *result = P_PRNDL;
- return true;
- } else if ("rpm" == literal) {
- *result = P_RPM;
- return true;
- } else if ("steeringWheelAngle" == literal) {
- *result = P_STEERINGWHEELANGLE;
- return true;
- } else if ("engineOilLife" == literal) {
- *result = P_ENGINEOILLIFE;
- return true;
- } else if ("myKey" == literal) {
- *result = P_MYKEY;
- return true;
- } else if ("airbagStatus" == literal) {
- *result = P_AIRBAGSTATUS;
- return true;
- } else if ("bodyInformation" == literal) {
- *result = P_BODYINFORMATION;
- return true;
- } else if ("clusterModeStatus" == literal) {
- *result = P_CLUSTERMODESTATUS;
- return true;
- } else if ("deviceStatus" == literal) {
- *result = P_DEVICESTATUS;
- return true;
- } else if ("emergencyEvent" == literal) {
- *result = P_EMERGENCYEVENT;
- return true;
- } else if ("eCallInfo" == literal) {
- *result = P_ECALLINFO;
- return true;
- } else if ("abs_State" == literal) {
- *result = P_ABS_STATE;
- return true;
- } else if ("fuelRange" == literal) {
- *result = P_FUEL_RANGE;
- return true;
- } else if ("tirePressureValue" == literal) {
- *result = P_TIRE_PRESSURE_VALUE;
- return true;
- } else if ("tpms" == literal) {
- *result = P_TPMS;
- return true;
- } else if ("longitudeDegrees" == literal) {
- *result = P_LONGTITUDE_DEGREES;
- return true;
- } else if ("latitudeDegrees" == literal) {
- *result = P_LATITUDE_DEGREES;
- return true;
- } else if ("locationName" == literal) {
- *result = P_LOCATION_NAME;
- return true;
- } else if ("locationDescription" == literal) {
- *result = P_LOCATION_DESCRIPTION;
- return true;
- } else if ("addressLines" == literal) {
- *result = P_ADDRESS_LINES;
- return true;
- } else if ("phoneNumber" == literal) {
- *result = P_PHONE_NUMBER;
- return true;
- } else if ("locationImage" == literal) {
- *result = P_LOCATION_IMAGE;
- return true;
- } else if ("deliveryMode" == literal) {
- *result = P_DELIVERY_MODE;
- return true;
- } else if ("timeStamp" == literal) {
- *result = P_TIMESTAMP;
- return true;
- } else if ("address" == literal) {
- *result = P_ADDRESS;
- return true;
- } else if ("EMPTY" == literal) {
- *result = P_EMPTY;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(AppHMIType val) {
- switch (val) {
- case AHT_DEFAULT:
- return true;
- case AHT_COMMUNICATION:
- return true;
- case AHT_MEDIA:
- return true;
- case AHT_MESSAGING:
- return true;
- case AHT_NAVIGATION:
- return true;
- case AHT_INFORMATION:
- return true;
- case AHT_SOCIAL:
- return true;
- case AHT_BACKGROUND_PROCESS:
- return true;
- case AHT_TESTING:
- return true;
- case AHT_SYSTEM:
- return true;
- case AHT_PROJECTION:
- return true;
- case AHT_REMOTE_CONTROL:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(AppHMIType val) {
- switch (val) {
- case AHT_DEFAULT:
- return "DEFAULT";
- case AHT_COMMUNICATION:
- return "COMMUNICATION";
- case AHT_MEDIA:
- return "MEDIA";
- case AHT_MESSAGING:
- return "MESSAGING";
- case AHT_NAVIGATION:
- return "NAVIGATION";
- case AHT_INFORMATION:
- return "INFORMATION";
- case AHT_SOCIAL:
- return "SOCIAL";
- case AHT_BACKGROUND_PROCESS:
- return "BACKGROUND_PROCESS";
- case AHT_TESTING:
- return "TESTING";
- case AHT_SYSTEM:
- return "SYSTEM";
- case AHT_PROJECTION:
- return "PROJECTION";
- case AHT_REMOTE_CONTROL:
- return "REMOTE_CONTROL";
- default:
- return "";
- }
-}
-bool EnumFromJsonString(const std::string& literal, AppHMIType* result) {
- if ("DEFAULT" == literal) {
- *result = AHT_DEFAULT;
- return true;
- } else if ("COMMUNICATION" == literal) {
- *result = AHT_COMMUNICATION;
- return true;
- } else if ("MEDIA" == literal) {
- *result = AHT_MEDIA;
- return true;
- } else if ("MESSAGING" == literal) {
- *result = AHT_MESSAGING;
- return true;
- } else if ("NAVIGATION" == literal) {
- *result = AHT_NAVIGATION;
- return true;
- } else if ("INFORMATION" == literal) {
- *result = AHT_INFORMATION;
- return true;
- } else if ("SOCIAL" == literal) {
- *result = AHT_SOCIAL;
- return true;
- } else if ("BACKGROUND_PROCESS" == literal) {
- *result = AHT_BACKGROUND_PROCESS;
- return true;
- } else if ("TESTING" == literal) {
- *result = AHT_TESTING;
- return true;
- } else if ("SYSTEM" == literal) {
- *result = AHT_SYSTEM;
- return true;
- } else if ("PROJECTION" == literal) {
- *result = AHT_PROJECTION;
- return true;
- } else if ("REMOTE_CONTROL" == literal) {
- *result = AHT_REMOTE_CONTROL;
- return true;
- } else {
- return false;
- }
-}
bool IsValidEnum(Input val) {
switch (val) {
@@ -541,6 +14,7 @@ bool IsValidEnum(Input val) {
return false;
}
}
+
const char* EnumToJsonString(Input val) {
switch (val) {
case I_GUI:
@@ -563,234 +37,6 @@ bool EnumFromJsonString(const std::string& literal, Input* result) {
}
}
-bool IsValidEnum(RequestType val) {
- switch (val) {
- case RT_HTTP:
- return true;
- case RT_FILE_RESUME:
- return true;
- case RT_AUTH_REQUEST:
- return true;
- case RT_AUTH_CHALLENGE:
- return true;
- case RT_AUTH_ACK:
- return true;
- case RT_PROPRIETARY:
- return true;
- case RT_QUERY_APPS:
- return true;
- case RT_LAUNCH_APP:
- return true;
- case RT_LOCK_SCREEN_ICON_URL:
- return true;
- case RT_TRAFFIC_MESSAGE_CHANNEL:
- return true;
- case RT_DRIVER_PROFILE:
- return true;
- case RT_VOICE_SEARCH:
- return true;
- case RT_NAVIGATION:
- return true;
- case RT_PHONE:
- return true;
- case RT_CLIMATE:
- return true;
- case RT_SETTINGS:
- return true;
- case RT_VEHICLE_DIAGNOSTICS:
- return true;
- case RT_EMERGENCY:
- return true;
- case RT_MEDIA:
- return true;
- case RT_FOTA:
- return true;
- case RT_OEM_SPECIFIC:
- return true;
- case RT_EMPTY:
- return true;
- default:
- return false;
- }
-}
-
-const char* EnumToJsonString(RequestType val) {
- switch (val) {
- case RT_HTTP:
- return "HTTP";
- case RT_FILE_RESUME:
- return "FILE_RESUME";
- case RT_AUTH_REQUEST:
- return "AUTH_REQUEST";
- case RT_AUTH_CHALLENGE:
- return "AUTH_CHALLENGE";
- case RT_AUTH_ACK:
- return "AUTH_ACK";
- case RT_PROPRIETARY:
- return "PROPRIETARY";
- case RT_QUERY_APPS:
- return "QUERY_APPS";
- case RT_LAUNCH_APP:
- return "LAUNCH_APP";
- case RT_LOCK_SCREEN_ICON_URL:
- return "LOCK_SCREEN_ICON_URL";
- case RT_TRAFFIC_MESSAGE_CHANNEL:
- return "TRAFFIC_MESSAGE_CHANNEL";
- case RT_DRIVER_PROFILE:
- return "DRIVER_PROFILE";
- case RT_VOICE_SEARCH:
- return "VOICE_SEARCH";
- case RT_NAVIGATION:
- return "NAVIGATION";
- case RT_PHONE:
- return "PHONE";
- case RT_CLIMATE:
- return "CLIMATE";
- case RT_SETTINGS:
- return "SETTINGS";
- case RT_VEHICLE_DIAGNOSTICS:
- return "VEHICLE_DIAGNOSTICS";
- case RT_EMERGENCY:
- return "EMERGENCY";
- case RT_MEDIA:
- return "MEDIA";
- case RT_FOTA:
- return "FOTA";
- case RT_OEM_SPECIFIC:
- return "OEM_SPECIFIC";
- case RT_EMPTY:
- return "EMPTY";
- default:
- return "";
- }
-}
-
-bool EnumFromJsonString(const std::string& literal, RequestType* result) {
- if ("HTTP" == literal) {
- *result = RT_HTTP;
- return true;
- }
- if ("FILE_RESUME" == literal) {
- *result = RT_FILE_RESUME;
- return true;
- }
- if ("AUTH_REQUEST" == literal) {
- *result = RT_AUTH_REQUEST;
- return true;
- }
- if ("AUTH_CHALLENGE" == literal) {
- *result = RT_AUTH_CHALLENGE;
- return true;
- }
- if ("AUTH_ACK" == literal) {
- *result = RT_AUTH_ACK;
- return true;
- }
- if ("PROPRIETARY" == literal) {
- *result = RT_PROPRIETARY;
- return true;
- }
- if ("QUERY_APPS" == literal) {
- *result = RT_QUERY_APPS;
- return true;
- }
- if ("LAUNCH_APP" == literal) {
- *result = RT_LAUNCH_APP;
- return true;
- }
- if ("LOCK_SCREEN_ICON_URL" == literal) {
- *result = RT_LOCK_SCREEN_ICON_URL;
- return true;
- }
- if ("TRAFFIC_MESSAGE_CHANNEL" == literal) {
- *result = RT_TRAFFIC_MESSAGE_CHANNEL;
- return true;
- }
- if ("DRIVER_PROFILE" == literal) {
- *result = RT_DRIVER_PROFILE;
- return true;
- }
- if ("VOICE_SEARCH" == literal) {
- *result = RT_VOICE_SEARCH;
- return true;
- }
- if ("NAVIGATION" == literal) {
- *result = RT_NAVIGATION;
- return true;
- }
- if ("PHONE" == literal) {
- *result = RT_PHONE;
- return true;
- }
- if ("CLIMATE" == literal) {
- *result = RT_CLIMATE;
- return true;
- }
- if ("SETTINGS" == literal) {
- *result = RT_SETTINGS;
- return true;
- }
- if ("VEHICLE_DIAGNOSTICS" == literal) {
- *result = RT_VEHICLE_DIAGNOSTICS;
- return true;
- }
- if ("EMERGENCY" == literal) {
- *result = RT_EMERGENCY;
- return true;
- }
- if ("MEDIA" == literal) {
- *result = RT_MEDIA;
- return true;
- }
- if ("FOTA" == literal) {
- *result = RT_FOTA;
- return true;
- }
- if ("OEM_SPECIFIC" == literal) {
- *result = RT_OEM_SPECIFIC;
- return true;
- }
- if ("EMPTY" == literal) {
- *result = RT_EMPTY;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(ModuleType val) {
- switch (val) {
- case MT_CLIMATE:
- return true;
- case MT_RADIO:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(ModuleType val) {
- switch (val) {
- case MT_CLIMATE:
- return "CLIMATE";
- case MT_RADIO:
- return "RADIO";
- default:
- return "";
- }
-}
-
-bool EnumFromJsonString(const std::string& literal, ModuleType* result) {
- if ("CLIMATE" == literal) {
- *result = MT_CLIMATE;
- return true;
- } else if ("RADIO" == literal) {
- *result = MT_RADIO;
- return true;
- } else {
- return false;
- }
-}
-
const std::string kDefaultApp = "default";
const std::string kPreDataConsentApp = "pre_DataConsent";
const std::string kDeviceApp = "device";
diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc
index 8c4f454dfa..f0ea154f94 100644
--- a/src/components/policy/policy_external/src/policy_table/types.cc
+++ b/src/components/policy/policy_external/src/policy_table/types.cc
@@ -1,5 +1,5 @@
-#include <algorithm>
#include "policy/policy_table/types.h"
+#include <algorithm>
#include "rpc_base/rpc_base_json_inl.h"
namespace rpc {
@@ -45,7 +45,6 @@ PolicyBase::PolicyBase(const Json::Value* value__)
, default_hmi(impl::ValueMember(value__, "default_hmi"))
, keep_context(impl::ValueMember(value__, "keep_context"))
, steal_focus(impl::ValueMember(value__, "steal_focus")) {}
-
Json::Value PolicyBase::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("groups", groups, &result__);
@@ -221,6 +220,110 @@ void ApplicationPoliciesSection::SetPolicyTableType(PolicyTableType pt_type) {
apps.SetPolicyTableType(pt_type);
}
+// Handled RPC Methods
+AppServiceHandledRpc::AppServiceHandledRpc() : CompositeType(kUninitialized) {}
+
+AppServiceHandledRpc::~AppServiceHandledRpc() {}
+
+AppServiceHandledRpc::AppServiceHandledRpc(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , function_id(impl::ValueMember(value__, "function_id")) {}
+
+Json::Value AppServiceHandledRpc::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("function_id", function_id, &result__);
+ return result__;
+}
+
+bool AppServiceHandledRpc::is_valid() const {
+ if (!function_id.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool AppServiceHandledRpc::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool AppServiceHandledRpc::struct_empty() const {
+ if (function_id.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+void AppServiceHandledRpc::SetPolicyTableType(PolicyTableType pt_type) {
+ function_id.SetPolicyTableType(pt_type);
+}
+
+void AppServiceHandledRpc::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!function_id.is_valid()) {
+ function_id.ReportErrors(&report__->ReportSubobject("function_id"));
+ }
+}
+
+// AppServiceInfo methods
+AppServiceInfo::AppServiceInfo() : CompositeType(kUninitialized) {}
+
+AppServiceInfo::~AppServiceInfo() {}
+
+AppServiceInfo::AppServiceInfo(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , service_names(impl::ValueMember(value__, "service_names"))
+ , handled_rpcs(impl::ValueMember(value__, "handled_rpcs")) {}
+
+Json::Value AppServiceInfo::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("service_names", service_names, &result__);
+ impl::WriteJsonField("parameters", handled_rpcs, &result__);
+ return result__;
+}
+
+bool AppServiceInfo::is_valid() const {
+ if (!service_names.is_valid()) {
+ return false;
+ }
+ if (!handled_rpcs.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool AppServiceInfo::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool AppServiceInfo::struct_empty() const {
+ if (service_names.is_initialized()) {
+ return false;
+ }
+ if (handled_rpcs.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+void AppServiceInfo::SetPolicyTableType(PolicyTableType pt_type) {
+ service_names.SetPolicyTableType(pt_type);
+ handled_rpcs.SetPolicyTableType(pt_type);
+}
+
+void AppServiceInfo::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!service_names.is_valid()) {
+ service_names.ReportErrors(&report__->ReportSubobject("service_names"));
+ }
+ if (!handled_rpcs.is_valid()) {
+ handled_rpcs.ReportErrors(&report__->ReportSubobject("handled_rpcs"));
+ }
+}
+
// ApplicationParams methods
ApplicationParams::ApplicationParams() : PolicyBase() {}
@@ -241,7 +344,18 @@ ApplicationParams::ApplicationParams(const Json::Value* value__)
, RequestSubType(impl::ValueMember(value__, "RequestSubType"))
, memory_kb(impl::ValueMember(value__, "memory_kb"), 0)
, heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms"))
- , moduleType(impl::ValueMember(value__, "moduleType")) {}
+ , moduleType(impl::ValueMember(value__, "moduleType"))
+ , certificate(impl::ValueMember(value__, "certificate"))
+ , hybrid_app_preference(impl::ValueMember(value__, "hybrid_app_preference"))
+ , endpoint(impl::ValueMember(value__, "endpoint"))
+ , enabled(impl::ValueMember(value__, "enabled"))
+ , auth_token(impl::ValueMember(value__, "auth_token"))
+ , cloud_transport_type(impl::ValueMember(value__, "cloud_transport_type"))
+ , icon_url(impl::ValueMember(value__, "icon_url"))
+ , app_service_parameters(impl::ValueMember(value__, "app_services"))
+ , allow_unknown_rpc_passthrough(
+ impl::ValueMember(value__, "allow_unknown_rpc_passthrough"))
+ , encryption_required(impl::ValueMember(value__, "encryption_required")) {}
Json::Value ApplicationParams::ToJsonValue() const {
Json::Value result__(PolicyBase::ToJsonValue());
@@ -253,6 +367,19 @@ Json::Value ApplicationParams::ToJsonValue() const {
impl::WriteJsonField(
"heart_beat_timeout_ms", heart_beat_timeout_ms, &result__);
impl::WriteJsonField("moduleType", moduleType, &result__);
+ impl::WriteJsonField("certificate", certificate, &result__);
+ impl::WriteJsonField(
+ "hybrid_app_preference", hybrid_app_preference, &result__);
+ impl::WriteJsonField("endpoint", endpoint, &result__);
+ impl::WriteJsonField("enabled", enabled, &result__);
+ impl::WriteJsonField("auth_token", auth_token, &result__);
+ impl::WriteJsonField("cloud_transport_type", cloud_transport_type, &result__);
+ impl::WriteJsonField("icon_url", auth_token, &result__);
+ impl::WriteJsonField("app_services", app_service_parameters, &result__);
+ impl::WriteJsonField("allow_unknown_rpc_passthrough",
+ allow_unknown_rpc_passthrough,
+ &result__);
+ impl::WriteJsonField("encryption_required", encryption_required, &result__);
return result__;
}
@@ -277,6 +404,36 @@ bool ApplicationParams::is_valid() const {
if (!moduleType.is_valid()) {
return false;
}
+ if (!certificate.is_valid()) {
+ return false;
+ }
+ if (!endpoint.is_valid()) {
+ return false;
+ }
+ if (!enabled.is_valid()) {
+ return false;
+ }
+ if (!auth_token.is_valid()) {
+ return false;
+ }
+ if (!cloud_transport_type.is_valid()) {
+ return false;
+ }
+ if (!hybrid_app_preference.is_valid()) {
+ return false;
+ }
+ if (!icon_url.is_valid()) {
+ return false;
+ }
+ if (!app_service_parameters.is_valid()) {
+ return false;
+ }
+ if (!allow_unknown_rpc_passthrough.is_valid()) {
+ return false;
+ }
+ if (!encryption_required.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -309,6 +466,36 @@ bool ApplicationParams::struct_empty() const {
if (moduleType.is_initialized()) {
return false;
}
+ if (certificate.is_initialized()) {
+ return false;
+ }
+ if (endpoint.is_initialized()) {
+ return false;
+ }
+ if (enabled.is_initialized()) {
+ return false;
+ }
+ if (auth_token.is_initialized()) {
+ return false;
+ }
+ if (cloud_transport_type.is_initialized()) {
+ return false;
+ }
+ if (hybrid_app_preference.is_initialized()) {
+ return false;
+ }
+ if (icon_url.is_initialized()) {
+ return false;
+ }
+ if (app_service_parameters.is_initialized()) {
+ return false;
+ }
+ if (allow_unknown_rpc_passthrough.is_initialized()) {
+ return false;
+ }
+ if (!encryption_required.is_valid()) {
+ return false;
+ }
return true;
}
@@ -357,6 +544,40 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
if (!moduleType.is_valid()) {
moduleType.ReportErrors(&report__->ReportSubobject("moduleType"));
}
+ if (!certificate.is_valid()) {
+ certificate.ReportErrors(&report__->ReportSubobject("certificate"));
+ }
+ if (!endpoint.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("endpoint"));
+ }
+ if (!enabled.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("enabled"));
+ }
+ if (!auth_token.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("auth_token"));
+ }
+ if (!cloud_transport_type.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("cloud_transport_type"));
+ }
+ if (!hybrid_app_preference.is_valid()) {
+ moduleType.ReportErrors(
+ &report__->ReportSubobject("hybrid_app_preference"));
+ }
+ if (!icon_url.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("icon_url"));
+ }
+ if (!app_service_parameters.is_valid()) {
+ app_service_parameters.ReportErrors(
+ &report__->ReportSubobject("app_services"));
+ }
+ if (!allow_unknown_rpc_passthrough.is_valid()) {
+ allow_unknown_rpc_passthrough.ReportErrors(
+ &report__->ReportSubobject("allow_unknown_rpc_passthrough"));
+ }
+ if (!encryption_required.is_valid()) {
+ encryption_required.ReportErrors(
+ &report__->ReportSubobject("encryption_required"));
+ }
}
void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
@@ -367,6 +588,14 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
memory_kb.SetPolicyTableType(pt_type);
heart_beat_timeout_ms.SetPolicyTableType(pt_type);
moduleType.SetPolicyTableType(pt_type);
+ certificate.SetPolicyTableType(pt_type);
+ endpoint.SetPolicyTableType(pt_type);
+ enabled.SetPolicyTableType(pt_type);
+ cloud_transport_type.SetPolicyTableType(pt_type);
+ hybrid_app_preference.SetPolicyTableType(pt_type);
+ icon_url.SetPolicyTableType(pt_type);
+ app_service_parameters.SetPolicyTableType(pt_type);
+ allow_unknown_rpc_passthrough.SetPolicyTableType(pt_type);
}
// RpcParameters methods
@@ -445,7 +674,8 @@ Rpcs::Rpcs(const Json::Value* value__)
, disallowed_by_external_consent_entities_on(impl::ValueMember(
value__, "disallowed_by_external_consent_entities_on"))
, disallowed_by_external_consent_entities_off(impl::ValueMember(
- value__, "disallowed_by_external_consent_entities_off")) {}
+ value__, "disallowed_by_external_consent_entities_off"))
+ , encryption_required(impl::ValueMember(value__, "encryption_required")) {}
Json::Value Rpcs::ToJsonValue() const {
Json::Value result__(Json::objectValue);
@@ -457,6 +687,7 @@ Json::Value Rpcs::ToJsonValue() const {
impl::WriteJsonField("disallowed_by_external_consent_entities_off",
disallowed_by_external_consent_entities_off,
&result__);
+ impl::WriteJsonField("encryption_required", encryption_required, &result__);
return result__;
}
@@ -473,6 +704,9 @@ bool Rpcs::is_valid() const {
if (!disallowed_by_external_consent_entities_off.is_valid()) {
return false;
}
+ if (!encryption_required.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -493,6 +727,9 @@ bool Rpcs::struct_empty() const {
if (disallowed_by_external_consent_entities_off.is_initialized()) {
return false;
}
+ if (encryption_required.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -517,6 +754,10 @@ void Rpcs::ReportErrors(rpc::ValidationReport* report__) const {
&report__->ReportSubobject(
"disallowed_by_external_consent_entities_off"));
}
+ if (!encryption_required.is_valid()) {
+ encryption_required.ReportErrors(
+ &report__->ReportSubobject("encryption_required"));
+ }
}
void Rpcs::SetPolicyTableType(PolicyTableType pt_type) {
@@ -527,9 +768,60 @@ void Rpcs::SetPolicyTableType(PolicyTableType pt_type) {
disallowed_by_external_consent_entities_on.SetPolicyTableType(pt_type);
}
+// EndpointProperties methods
+EndpointProperty::EndpointProperty() : CompositeType(kUninitialized) {}
+
+EndpointProperty::~EndpointProperty() {}
+
+EndpointProperty::EndpointProperty(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , version(impl::ValueMember(value__, "version")) {}
+
+Json::Value EndpointProperty::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("version", version, &result__);
+ return result__;
+}
+
+bool EndpointProperty::is_valid() const {
+ if (!version.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool EndpointProperty::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool EndpointProperty::struct_empty() const {
+ if (version.is_initialized()) {
+ return false;
+ }
+
+ return true;
+}
+
+void EndpointProperty::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!version.is_valid()) {
+ version.ReportErrors(&report__->ReportSubobject("version"));
+ }
+}
+
+void EndpointProperty::SetPolicyTableType(PolicyTableType pt_type) {
+ CompositeType::SetPolicyTableType(pt_type);
+ version.SetPolicyTableType(pt_type);
+}
+
// ModuleConfig methods
ModuleConfig::ModuleConfig() : CompositeType(kUninitialized) {}
+const std::string ModuleConfig::kDefaultOemMappingServiceName =
+ "custom_vehicle_data_mapping_url";
+
ModuleConfig::ModuleConfig(
uint8_t exchange_after_x_ignition_cycles,
int64_t exchange_after_x_kilometers,
@@ -537,6 +829,7 @@ ModuleConfig::ModuleConfig(
uint16_t timeout_after_x_seconds,
const SecondsBetweenRetries& seconds_between_retries,
const ServiceEndpoints& endpoints,
+ const ServiceEndpointProperties& endpoint_properties,
const NumberOfNotificationsPerMinute& notifications_per_minute_by_priority)
: CompositeType(kUninitialized)
, exchange_after_x_ignition_cycles(exchange_after_x_ignition_cycles)
@@ -545,6 +838,7 @@ ModuleConfig::ModuleConfig(
, timeout_after_x_seconds(timeout_after_x_seconds)
, seconds_between_retries(seconds_between_retries)
, endpoints(endpoints)
+ , endpoint_properties(endpoint_properties)
, notifications_per_minute_by_priority(
notifications_per_minute_by_priority) {}
@@ -562,6 +856,7 @@ ModuleConfig::ModuleConfig(const Json::Value* value__)
, seconds_between_retries(
impl::ValueMember(value__, "seconds_between_retries"))
, endpoints(impl::ValueMember(value__, "endpoints"))
+ , endpoint_properties(impl::ValueMember(value__, "endpoint_properties"))
, notifications_per_minute_by_priority(
impl::ValueMember(value__, "notifications_per_minute_by_priority"))
, vehicle_make(impl::ValueMember(value__, "vehicle_make"))
@@ -569,7 +864,10 @@ ModuleConfig::ModuleConfig(const Json::Value* value__)
, vehicle_year(impl::ValueMember(value__, "vehicle_year"))
, preloaded_date(impl::ValueMember(value__, "preloaded_date"))
, certificate(impl::ValueMember(value__, "certificate"))
- , preloaded_pt(impl::ValueMember(value__, "preloaded_pt")) {}
+ , preloaded_pt(impl::ValueMember(value__, "preloaded_pt"))
+ , full_app_id_supported(impl::ValueMember(value__, "full_app_id_supported"))
+ , lock_screen_dismissal_enabled(
+ impl::ValueMember(value__, "lock_screen_dismissal_enabled")) {}
void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
exchange_after_x_days = from.exchange_after_x_days;
@@ -579,8 +877,10 @@ void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
timeout_after_x_seconds = from.timeout_after_x_seconds;
seconds_between_retries = from.seconds_between_retries;
endpoints = from.endpoints;
+ endpoint_properties = from.endpoint_properties;
notifications_per_minute_by_priority =
from.notifications_per_minute_by_priority;
+ lock_screen_dismissal_enabled = from.lock_screen_dismissal_enabled;
certificate.assign_if_valid(from.certificate);
vehicle_make.assign_if_valid(from.vehicle_make);
@@ -592,6 +892,8 @@ Json::Value ModuleConfig::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("certificate", certificate, &result__);
impl::WriteJsonField("preloaded_pt", preloaded_pt, &result__);
+ impl::WriteJsonField(
+ "full_app_id_supported", full_app_id_supported, &result__);
impl::WriteJsonField("exchange_after_x_ignition_cycles",
exchange_after_x_ignition_cycles,
&result__);
@@ -604,6 +906,7 @@ Json::Value ModuleConfig::ToJsonValue() const {
impl::WriteJsonField(
"seconds_between_retries", seconds_between_retries, &result__);
impl::WriteJsonField("endpoints", endpoints, &result__);
+ impl::WriteJsonField("endpoint_properties", endpoint_properties, &result__);
impl::WriteJsonField("notifications_per_minute_by_priority",
notifications_per_minute_by_priority,
&result__);
@@ -612,6 +915,9 @@ Json::Value ModuleConfig::ToJsonValue() const {
impl::WriteJsonField("vehicle_year", vehicle_year, &result__);
impl::WriteJsonField("certificate", certificate, &result__);
impl::WriteJsonField("preloaded_date", preloaded_date, &result__);
+ impl::WriteJsonField("lock_screen_dismissal_enabled",
+ lock_screen_dismissal_enabled,
+ &result__);
return result__;
}
@@ -622,6 +928,9 @@ bool ModuleConfig::is_valid() const {
if (!preloaded_pt.is_valid()) {
return false;
}
+ if (!full_app_id_supported.is_valid()) {
+ return false;
+ }
if (!exchange_after_x_ignition_cycles.is_valid()) {
return false;
}
@@ -640,6 +949,9 @@ bool ModuleConfig::is_valid() const {
if (!endpoints.is_valid()) {
return false;
}
+ if (!endpoint_properties.is_valid()) {
+ return false;
+ }
if (!notifications_per_minute_by_priority.is_valid()) {
return false;
}
@@ -658,6 +970,9 @@ bool ModuleConfig::is_valid() const {
if (!preloaded_date.is_valid()) {
return false;
}
+ if (!lock_screen_dismissal_enabled.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -672,6 +987,9 @@ bool ModuleConfig::struct_empty() const {
if (preloaded_pt.is_initialized()) {
return false;
}
+ if (full_app_id_supported.is_initialized()) {
+ return false;
+ }
if (exchange_after_x_ignition_cycles.is_initialized()) {
return false;
@@ -694,9 +1012,16 @@ bool ModuleConfig::struct_empty() const {
return false;
}
+ if (endpoint_properties.is_initialized()) {
+ return false;
+ }
+
if (notifications_per_minute_by_priority.is_initialized()) {
return false;
}
+ if (lock_screen_dismissal_enabled.is_initialized()) {
+ return false;
+ }
if (vehicle_make.is_initialized()) {
return false;
}
@@ -720,6 +1045,10 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const {
if (!preloaded_pt.is_valid()) {
preloaded_pt.ReportErrors(&report__->ReportSubobject("preloaded_pt"));
}
+ if (!full_app_id_supported.is_valid()) {
+ full_app_id_supported.ReportErrors(
+ &report__->ReportSubobject("full_app_id_supported"));
+ }
if (!exchange_after_x_ignition_cycles.is_valid()) {
exchange_after_x_ignition_cycles.ReportErrors(
&report__->ReportSubobject("exchange_after_x_ignition_cycles"));
@@ -743,10 +1072,18 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const {
if (!endpoints.is_valid()) {
endpoints.ReportErrors(&report__->ReportSubobject("endpoints"));
}
+ if (!endpoint_properties.is_valid()) {
+ endpoint_properties.ReportErrors(
+ &report__->ReportSubobject("endpoint_properties"));
+ }
if (!notifications_per_minute_by_priority.is_valid()) {
notifications_per_minute_by_priority.ReportErrors(
&report__->ReportSubobject("notifications_per_minute_by_priority"));
}
+ if (!lock_screen_dismissal_enabled.is_valid()) {
+ lock_screen_dismissal_enabled.ReportErrors(
+ &report__->ReportSubobject("lock_screen_dismissal_enabled"));
+ }
if (!vehicle_make.is_valid()) {
vehicle_make.ReportErrors(&report__->ReportSubobject("vehicle_make"));
}
@@ -797,13 +1134,16 @@ void ModuleConfig::SetPolicyTableType(PolicyTableType pt_type) {
CompositeType::SetPolicyTableType(pt_type);
certificate.SetPolicyTableType(pt_type);
preloaded_pt.SetPolicyTableType(pt_type);
+ full_app_id_supported.SetPolicyTableType(pt_type);
exchange_after_x_ignition_cycles.SetPolicyTableType(pt_type);
exchange_after_x_kilometers.SetPolicyTableType(pt_type);
exchange_after_x_days.SetPolicyTableType(pt_type);
timeout_after_x_seconds.SetPolicyTableType(pt_type);
seconds_between_retries.SetPolicyTableType(pt_type);
endpoints.SetPolicyTableType(pt_type);
+ endpoint_properties.SetPolicyTableType(pt_type);
notifications_per_minute_by_priority.SetPolicyTableType(pt_type);
+ lock_screen_dismissal_enabled.SetPolicyTableType(pt_type);
vehicle_make.SetPolicyTableType(pt_type);
vehicle_model.SetPolicyTableType(pt_type);
vehicle_year.SetPolicyTableType(pt_type);
@@ -1843,6 +2183,416 @@ void DeviceParams::SetPolicyTableType(PolicyTableType pt_type) {
connection_type.SetPolicyTableType(pt_type);
}
+// VehicleDataItem methods
+VehicleDataItem::VehicleDataItem() : CompositeType(kUninitialized) {}
+
+VehicleDataItem::VehicleDataItem(const VehicleDataItem& vehicle_data)
+ : CompositeType(vehicle_data.initialization_state__)
+ , name(vehicle_data.name)
+ , type(vehicle_data.type)
+ , key(vehicle_data.key)
+ , mandatory(vehicle_data.mandatory)
+ , params(vehicle_data.params)
+ , array(vehicle_data.array)
+ , since(vehicle_data.since)
+ , until(vehicle_data.until)
+ , removed(vehicle_data.removed)
+ , deprecated(vehicle_data.deprecated)
+ , minvalue(vehicle_data.minvalue)
+ , maxvalue(vehicle_data.maxvalue)
+ , minsize(vehicle_data.minsize)
+ , maxsize(vehicle_data.maxsize)
+ , minlength(vehicle_data.minlength)
+ , maxlength(vehicle_data.maxlength) {}
+
+VehicleDataItem::VehicleDataItem(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , name(impl::ValueMember(value__, "name"))
+ , type(impl::ValueMember(value__, "type"))
+ , key(impl::ValueMember(value__, "key"))
+ , mandatory(impl::ValueMember(value__, "mandatory"))
+ , params(impl::ValueMember(value__, "params"))
+ , array(impl::ValueMember(value__, "array"))
+ , since(impl::ValueMember(value__, "since"))
+ , until(impl::ValueMember(value__, "until"))
+ , removed(impl::ValueMember(value__, "removed"))
+ , deprecated(impl::ValueMember(value__, "deprecated"))
+ , minvalue(impl::ValueMember(value__, "minvalue"))
+ , maxvalue(impl::ValueMember(value__, "maxvalue"))
+ , minsize(impl::ValueMember(value__, "minsize"))
+ , maxsize(impl::ValueMember(value__, "maxsize"))
+ , minlength(impl::ValueMember(value__, "minlength"))
+ , maxlength(impl::ValueMember(value__, "maxlength")) {}
+
+VehicleDataItem::~VehicleDataItem() {}
+
+const std::string VehicleDataItem::kInteger = "Integer";
+const std::string VehicleDataItem::kStruct = "Struct";
+const std::string VehicleDataItem::kString = "String";
+const std::string VehicleDataItem::kFloat = "Float";
+const std::string VehicleDataItem::kDouble = "Double";
+const std::string VehicleDataItem::kBoolean = "Boolean";
+
+const std::vector<std::string> VehicleDataItem::kPODTypes = {
+ kInteger, kFloat, kDouble, kString, kBoolean};
+
+Json::Value VehicleDataItem::ToJsonValue() const {
+ Json::Value ret(Json::objectValue);
+ impl::WriteJsonField("name", name, &ret);
+ impl::WriteJsonField("type", type, &ret);
+ impl::WriteJsonField("key", key, &ret);
+ impl::WriteJsonField("array", array, &ret);
+ impl::WriteJsonField("mandatory", mandatory, &ret);
+ impl::WriteJsonField("params", params, &ret);
+ impl::WriteJsonField("since", since, &ret);
+ impl::WriteJsonField("until", until, &ret);
+ impl::WriteJsonField("removed", removed, &ret);
+ impl::WriteJsonField("deprecated", deprecated, &ret);
+ impl::WriteJsonField("minvalue", minvalue, &ret);
+ impl::WriteJsonField("maxvalue", maxvalue, &ret);
+ impl::WriteJsonField("minsize", minsize, &ret);
+ impl::WriteJsonField("maxsize", maxsize, &ret);
+ impl::WriteJsonField("minlength", minlength, &ret);
+ impl::WriteJsonField("maxlength", maxlength, &ret);
+ return ret;
+}
+
+bool VehicleDataItem::operator==(const VehicleDataItem& vd) {
+ return (name == vd.name && type == vd.type && key == vd.key &&
+ mandatory == vd.mandatory && params == vd.params &&
+ array == vd.array && since == vd.since && until == vd.until &&
+ removed == vd.removed && deprecated == vd.deprecated &&
+ minvalue == vd.minvalue && maxvalue == vd.maxvalue &&
+ minsize == vd.minsize && maxsize == vd.maxsize &&
+ minlength == vd.minlength && maxlength == vd.maxlength);
+}
+
+bool VehicleDataItem::is_valid() const {
+ if (!name.is_valid()) {
+ return false;
+ }
+ if (!type.is_valid()) {
+ return false;
+ }
+ if (!key.is_valid()) {
+ return false;
+ }
+ if (!array.is_valid()) {
+ return false;
+ }
+ if (!mandatory.is_valid()) {
+ return false;
+ }
+ if (!params.is_valid()) {
+ return false;
+ }
+ if (!since.is_valid()) {
+ return false;
+ }
+ if (!until.is_valid()) {
+ return false;
+ }
+ if (!removed.is_valid()) {
+ return false;
+ }
+ if (!deprecated.is_valid()) {
+ return false;
+ }
+ if (!minvalue.is_valid()) {
+ return false;
+ }
+ if (!maxvalue.is_valid()) {
+ return false;
+ }
+ if (!minsize.is_valid()) {
+ return false;
+ }
+ if (!maxsize.is_valid()) {
+ return false;
+ }
+ if (!minlength.is_valid()) {
+ return false;
+ }
+ if (!maxlength.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool VehicleDataItem::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (struct_not_empty());
+}
+
+bool VehicleDataItem::struct_not_empty() const {
+ if (!name.is_initialized()) {
+ return false;
+ }
+ if (!type.is_initialized()) {
+ return false;
+ }
+ if (!key.is_initialized()) {
+ return false;
+ }
+ if (!array.is_initialized()) {
+ return false;
+ }
+ if (!mandatory.is_initialized()) {
+ return false;
+ }
+ if (!params.is_initialized()) {
+ return false;
+ }
+ if (!since.is_initialized()) {
+ return false;
+ }
+ if (!until.is_initialized()) {
+ return false;
+ }
+ if (!removed.is_initialized()) {
+ return false;
+ }
+ if (!deprecated.is_initialized()) {
+ return false;
+ }
+ if (!minvalue.is_initialized()) {
+ return false;
+ }
+ if (!maxvalue.is_initialized()) {
+ return false;
+ }
+ if (!minsize.is_initialized()) {
+ return false;
+ }
+ if (!maxsize.is_initialized()) {
+ return false;
+ }
+ if (!minlength.is_initialized()) {
+ return false;
+ }
+ if (!maxlength.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+void VehicleDataItem::ReportErrors(rpc::ValidationReport* report__) const {
+ if (!struct_not_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!name.is_valid()) {
+ name.ReportErrors(&report__->ReportSubobject("name"));
+ }
+
+ if (!ValidateNaming(std::string(name))) {
+ report__->set_validation_info(
+ "Invalid name values [" + std::string(name) +
+ "]. It should not contain spaces or invalid chars.");
+ }
+ if (!type.is_valid()) {
+ type.ReportErrors(&report__->ReportSubobject("type"));
+ }
+ if (type.is_initialized() && !ValidateTypes()) {
+ report__->set_validation_info("Unknown type [" + std::string(name) +
+ "]: '" + std::string(type) + "'.");
+ }
+ if (!key.is_valid()) {
+ key.ReportErrors(&report__->ReportSubobject("key"));
+ }
+ if (!ValidateNaming(std::string(key))) {
+ report__->set_validation_info(
+ "Invalid key values [" + std::string(key) +
+ "]. It should not contain spaces or invalid chars.");
+ }
+ if (!array.is_valid()) {
+ array.ReportErrors(&report__->ReportSubobject("array"));
+ }
+ if (!mandatory.is_valid()) {
+ mandatory.ReportErrors(&report__->ReportSubobject("mandatory"));
+ }
+ if (!params.is_valid()) {
+ params.ReportErrors(&report__->ReportSubobject("params"));
+ }
+ if (!since.is_valid()) {
+ since.ReportErrors(&report__->ReportSubobject("since"));
+ }
+ if (!until.is_valid()) {
+ until.ReportErrors(&report__->ReportSubobject("until"));
+ }
+ if (!removed.is_valid()) {
+ removed.ReportErrors(&report__->ReportSubobject("removed"));
+ }
+ if (!deprecated.is_valid()) {
+ deprecated.ReportErrors(&report__->ReportSubobject("deprecated"));
+ }
+ if (!minvalue.is_valid()) {
+ minvalue.ReportErrors(&report__->ReportSubobject("minvalue"));
+ }
+ if (!maxvalue.is_valid()) {
+ maxvalue.ReportErrors(&report__->ReportSubobject("maxvalue"));
+ }
+ if (!minsize.is_valid()) {
+ minsize.ReportErrors(&report__->ReportSubobject("minsize"));
+ }
+ if (!maxsize.is_valid()) {
+ maxsize.ReportErrors(&report__->ReportSubobject("maxsize"));
+ }
+ if (!minlength.is_valid()) {
+ minlength.ReportErrors(&report__->ReportSubobject("minlength"));
+ }
+ if (!maxlength.is_valid()) {
+ maxlength.ReportErrors(&report__->ReportSubobject("maxlength"));
+ }
+}
+
+void VehicleDataItem::SetPolicyTableType(PolicyTableType pt_type) {
+ CompositeType::SetPolicyTableType(pt_type);
+ name.SetPolicyTableType(pt_type);
+ type.SetPolicyTableType(pt_type);
+ key.SetPolicyTableType(pt_type);
+ array.SetPolicyTableType(pt_type);
+ mandatory.SetPolicyTableType(pt_type);
+ params.SetPolicyTableType(pt_type);
+ since.SetPolicyTableType(pt_type);
+ until.SetPolicyTableType(pt_type);
+ removed.SetPolicyTableType(pt_type);
+ deprecated.SetPolicyTableType(pt_type);
+ minvalue.SetPolicyTableType(pt_type);
+ maxvalue.SetPolicyTableType(pt_type);
+ minsize.SetPolicyTableType(pt_type);
+ maxsize.SetPolicyTableType(pt_type);
+ minlength.SetPolicyTableType(pt_type);
+ maxlength.SetPolicyTableType(pt_type);
+}
+
+bool VehicleDataItem::ValidateNaming(std::string str) const {
+ auto contains_spec_chars = [](std::string str) {
+ const auto invalid_chars = "!@#$%^&*";
+ return str.npos != str.find_first_of(invalid_chars);
+ };
+
+ auto contains_spaces = [](std::string str) {
+ const auto found_space =
+ std::find_if(str.begin(), str.end(), [](unsigned char ch) {
+ return std::isspace(ch);
+ });
+
+ return found_space != str.end();
+ };
+
+ auto empty_string = [](std::string str) {
+ str.erase(std::remove_if(str.begin(),
+ str.end(),
+ [](unsigned char ch) { return std::isspace(ch); }),
+ str.end());
+ return str.length() < 1;
+ };
+
+ return !empty_string(str) && !contains_spaces(str) &&
+ !contains_spec_chars(str);
+}
+
+bool VehicleDataItem::ValidateTypes() const {
+ if (VehicleDataItem::kStruct == std::string(type)) {
+ return params.is_initialized() && !(params->empty()) && params.is_valid();
+ }
+ // params should be empty for POD types and for enum values
+ return (!(params.is_initialized()) || params->empty());
+}
+
+bool VehicleDataItem::IsPrimitiveType() const {
+ return helpers::in_range(kPODTypes, std::string(type));
+}
+
+// VehicleData methods
+VehicleData::VehicleData() : CompositeType(kUninitialized) {}
+
+VehicleData::VehicleData(const VehicleData& vehicle_data)
+ : CompositeType(vehicle_data.initialization_state__)
+ , schema_version(vehicle_data.schema_version)
+ , schema_items(vehicle_data.schema_items) {}
+
+VehicleData::VehicleData(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , schema_version(impl::ValueMember(value__, "schema_version"))
+ , schema_items(impl::ValueMember(value__, "schema_items")) {}
+
+VehicleData::~VehicleData() {}
+
+bool VehicleData::is_valid() const {
+ if (!schema_version.is_valid()) {
+ return false;
+ }
+ if (!schema_items.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool VehicleData::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool VehicleData::struct_empty() const {
+ if (schema_version.is_initialized()) {
+ return false;
+ }
+ if (schema_items.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+Json::Value VehicleData::ToJsonValue() const {
+ Json::Value ret(Json::objectValue);
+ impl::WriteJsonField("schema_version", schema_version, &ret);
+ impl::WriteJsonField("schema_items", schema_items, &ret);
+ return ret;
+}
+
+void VehicleData::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ const auto pt_type = GetPolicyTableType();
+ const auto pt_type_str = PolicyTableTypeToString(pt_type);
+ std::string validation_info = "";
+
+ if (PT_SNAPSHOT == pt_type) {
+ if (schema_items.is_initialized()) {
+ validation_info +=
+ "; schema_items " + omitted_validation_info + pt_type_str;
+ }
+ if (!schema_version.is_initialized()) {
+ validation_info +=
+ "; schema_version " + required_validation_info + pt_type_str;
+ }
+ report__->set_validation_info(validation_info);
+ }
+ if (PT_UPDATE == pt_type || PT_PRELOADED == pt_type) {
+ if ((schema_version.is_initialized() && !schema_items.is_initialized()) ||
+ (!schema_version.is_initialized() && schema_items.is_initialized())) {
+ validation_info +=
+ "; if schema_version exist, schema_items should "
+ "also exist in " +
+ pt_type_str;
+ }
+ report__->set_validation_info(validation_info);
+ }
+
+ if (!schema_version.is_valid()) {
+ schema_version.ReportErrors(&report__->ReportSubobject("schema_version"));
+ }
+ if (!schema_items.is_valid()) {
+ schema_items.ReportErrors(&report__->ReportSubobject("schema_items"));
+ }
+}
+
+void VehicleData::SetPolicyTableType(PolicyTableType pt_type) {
+ CompositeType::SetPolicyTableType(pt_type);
+ schema_version.SetPolicyTableType(pt_type);
+ schema_items.SetPolicyTableType(pt_type);
+}
+
// PolicyTable methods
PolicyTable::PolicyTable() : CompositeType(kUninitialized) {}
@@ -1869,7 +2619,8 @@ PolicyTable::PolicyTable(const Json::Value* value__)
, module_meta(impl::ValueMember(value__, "module_meta"))
, usage_and_error_counts(
impl::ValueMember(value__, "usage_and_error_counts"))
- , device_data(impl::ValueMember(value__, "device_data")) {}
+ , device_data(impl::ValueMember(value__, "device_data"))
+ , vehicle_data(impl::ValueMember(value__, "vehicle_data")) {}
Json::Value PolicyTable::ToJsonValue() const {
Json::Value result__(Json::objectValue);
@@ -1882,6 +2633,7 @@ Json::Value PolicyTable::ToJsonValue() const {
impl::WriteJsonField(
"usage_and_error_counts", usage_and_error_counts, &result__);
impl::WriteJsonField("device_data", device_data, &result__);
+ impl::WriteJsonField("vehicle_data", vehicle_data, &result__);
return result__;
}
@@ -1907,6 +2659,9 @@ bool PolicyTable::is_valid() const {
if (!device_data.is_valid()) {
return false;
}
+ if (!vehicle_data.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -1939,6 +2694,10 @@ bool PolicyTable::struct_empty() const {
if (device_data.is_initialized()) {
return false;
}
+
+ if (vehicle_data.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -1981,6 +2740,9 @@ void PolicyTable::ReportErrors(rpc::ValidationReport* report__) const {
if (!device_data.is_valid()) {
device_data.ReportErrors(&report__->ReportSubobject("device_data"));
}
+ if (!vehicle_data.is_valid()) {
+ vehicle_data.ReportErrors(&report__->ReportSubobject("vehicle_data"));
+ }
}
void PolicyTable::SetPolicyTableType(PolicyTableType pt_type) {
@@ -1992,6 +2754,7 @@ void PolicyTable::SetPolicyTableType(PolicyTableType pt_type) {
module_meta.SetPolicyTableType(pt_type);
usage_and_error_counts.SetPolicyTableType(pt_type);
device_data.SetPolicyTableType(pt_type);
+ vehicle_data.SetPolicyTableType(pt_type);
}
// Table methods
diff --git a/src/components/policy/policy_external/src/policy_table/validation.cc b/src/components/policy/policy_external/src/policy_table/validation.cc
index 9b227615d8..12a79748d7 100644
--- a/src/components/policy/policy_external/src/policy_table/validation.cc
+++ b/src/components/policy/policy_external/src/policy_table/validation.cc
@@ -1,15 +1,15 @@
-#include <iostream>
#include <algorithm>
+#include <iostream>
#include "policy/policy_table/types.h"
-#include "utils/logger.h"
#include "utils/helpers.h"
+#include "utils/logger.h"
namespace {
bool IsPredefinedApplication(const std::string& app_id) {
using namespace rpc::policy_table_interface_base;
return kPreDataConsentApp == app_id || kDefaultApp == app_id;
}
-}
+} // namespace
namespace rpc {
namespace policy_table_interface_base {
@@ -102,9 +102,9 @@ bool ApplicationPoliciesSection::Validate() const {
}
if (!app_request_types.is_valid()) {
- LOG4CXX_WARN(logger_,
- "Invalid RequestTypes for " << app_id
- << " Will be cleaned up.");
+ LOG4CXX_WARN(
+ logger_,
+ "Invalid RequestTypes for " << app_id << " Will be cleaned up.");
app_request_types.CleanUp();
if (app_request_types.is_cleaned_up()) {
if (PT_PRELOADED == pt_type) {
@@ -194,6 +194,14 @@ bool ApplicationParams::ValidateModuleTypes() const {
return true;
}
+bool AppServiceHandledRpc::Validate() const {
+ return true;
+}
+
+bool AppServiceInfo::Validate() const {
+ return true;
+}
+
bool ApplicationParams::Validate() const {
if (is_initialized()) {
if (preconsented_groups.is_initialized()) {
@@ -213,6 +221,15 @@ bool RpcParameters::Validate() const {
bool Rpcs::Validate() const {
return true;
}
+
+bool EndpointProperty::Validate() const {
+ if (!version.is_valid()) {
+ return false;
+ }
+
+ return true;
+}
+
bool ModuleConfig::Validate() const {
switch (GetPolicyTableType()) {
case PT_PRELOADED: {
@@ -250,6 +267,14 @@ bool ModuleConfig::Validate() const {
}
}
+ if (endpoint_properties.is_initialized()) {
+ const auto& endpoint_property =
+ endpoint_properties->find(kDefaultOemMappingServiceName);
+ if (endpoint_properties->end() != endpoint_property) {
+ return (*endpoint_property).second.version.is_initialized();
+ }
+ }
+
return true;
}
@@ -296,6 +321,40 @@ bool ConsentRecords::Validate() const {
bool DeviceParams::Validate() const {
return true;
}
+
+bool VehicleDataItem::Validate() const {
+ if (!ValidateNaming(std::string(name))) {
+ return false;
+ };
+
+ if (!ValidateNaming(std::string(key))) {
+ return false;
+ };
+
+ if (!ValidateTypes()) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Unknown type: " << std::string(type) << " of " << std::string(key));
+ return false;
+ }
+ return true;
+}
+
+bool VehicleData::Validate() const {
+ const PolicyTableType policy_table_type = GetPolicyTableType();
+ bool result = true;
+ if (PT_SNAPSHOT == policy_table_type) {
+ result =
+ (!schema_items.is_initialized()) && schema_version.is_initialized();
+ }
+ if (PT_UPDATE == policy_table_type || PT_PRELOADED == policy_table_type) {
+ result =
+ (schema_version.is_initialized() && schema_items.is_initialized()) ||
+ (!schema_version.is_initialized() && !schema_items.is_initialized());
+ }
+ return result;
+}
+
bool PolicyTable::Validate() const {
PolicyTableType policy_table_type = GetPolicyTableType();
diff --git a/src/components/policy/policy_external/src/sql_pt_ext_queries.cc b/src/components/policy/policy_external/src/sql_pt_ext_queries.cc
index afb1180692..ea323908c0 100644
--- a/src/components/policy/policy_external/src/sql_pt_ext_queries.cc
+++ b/src/components/policy/policy_external/src/sql_pt_ext_queries.cc
@@ -205,7 +205,12 @@ const std::string kUpdateGroupPermissions =
const std::string kInsertApplication =
"INSERT OR IGNORE INTO `application`(`id`, `keep_context`, `steal_focus`, "
" `default_hmi`, `priority_value`, `is_revoked`, `memory_kb`, "
- " `heart_beat_timeout_ms`) VALUES( ?, ?, ?, ?, ?, ?, ?, ?) ";
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `auth_token`, "
+ " `cloud_transport_type`, `icon_url`, `allow_unknown_rpc_passthrough`, "
+ "`encryption_required`) "
+ "VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -232,8 +237,11 @@ const std::string kSelectPreconsentedGroupsId =
const std::string kSelectAppPolicies =
"SELECT `id`, `priority_value`, `default_hmi`, `keep_context`, "
- "`steal_focus`, "
- " `memory_kb`, `heart_beat_timeout_ms` FROM `application`";
+ " `steal_focus`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, "
+ " `hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token`, "
+ " `cloud_transport_type`, `icon_url`, `allow_unknown_rpc_passthrough`, "
+ "`encryption_required`"
+ "FROM `application`";
const std::string kSelectFunctionalGroupNames =
"SELECT `id`, `user_consent_prompt`, `name`"
diff --git a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
index 5bb602244e..c8a1b5d7ea 100644
--- a/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_ext_representation.cc
@@ -29,15 +29,15 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "policy/sql_pt_ext_representation.h"
#include <algorithm>
#include <utility>
-#include "utils/logger.h"
-#include "policy/sql_pt_ext_representation.h"
-#include "policy/sql_wrapper.h"
-#include "policy/sql_pt_queries.h"
-#include "policy/sql_pt_ext_queries.h"
-#include "policy/policy_helper.h"
#include "policy/cache_manager.h"
+#include "policy/policy_helper.h"
+#include "policy/sql_pt_ext_queries.h"
+#include "policy/sql_pt_queries.h"
+#include "policy/sql_wrapper.h"
+#include "utils/logger.h"
namespace policy {
@@ -563,25 +563,23 @@ bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages(
msg.message_code = query.GetString(7);
std::string language = query.GetString(6);
+ policy_table::Languages& languages =
+ (*messages->messages)[msg.message_code].languages;
+ policy_table::MessageString& specific_message = languages[language];
if (!msg.tts.empty()) {
- *(*messages->messages)[msg.message_code].languages[language].tts =
- msg.tts;
+ *(specific_message).tts = msg.tts;
}
if (!msg.label.empty()) {
- *(*messages->messages)[msg.message_code].languages[language].label =
- msg.label;
+ *(specific_message).label = msg.label;
}
if (!msg.line1.empty()) {
- *(*messages->messages)[msg.message_code].languages[language].line1 =
- msg.line1;
+ *(specific_message).line1 = msg.line1;
}
if (!msg.line2.empty()) {
- *(*messages->messages)[msg.message_code].languages[language].line2 =
- msg.line2;
+ *(specific_message).line2 = msg.line2;
}
if (!msg.text_body.empty()) {
- *(*messages->messages)[msg.message_code].languages[language].textBody =
- msg.text_body;
+ *(specific_message).textBody = msg.text_body;
}
}
} else {
@@ -675,6 +673,21 @@ bool SQLPTExtRepresentation::SaveApplicationPoliciesSection(
return false;
}
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from service names.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled service types.");
+ return false;
+ }
+
// First, all predefined apps (e.g. default, pre_DataConsent) should be saved,
// otherwise another app with the predefined permissions can get incorrect
// permissions
@@ -729,6 +742,10 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
if (!SaveRequestSubType(app.first, *app.second.RequestSubType)) {
return false;
}
+ if (!SaveAppServiceParameters(app.first,
+ *app.second.app_service_parameters)) {
+ return false;
+ }
// Stop saving other params, since predefined permissions already set
return true;
}
@@ -752,6 +769,34 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
app_query.Bind(5, app.second.is_null());
app_query.Bind(6, *app.second.memory_kb);
app_query.Bind(7, static_cast<int64_t>(*app.second.heart_beat_timeout_ms));
+ app.second.certificate.is_initialized()
+ ? app_query.Bind(8, *app.second.certificate)
+ : app_query.Bind(8);
+ app.second.hybrid_app_preference.is_initialized()
+ ? app_query.Bind(9,
+ std::string(policy_table::EnumToJsonString(
+ *app.second.hybrid_app_preference)))
+ : app_query.Bind(9);
+ app.second.endpoint.is_initialized()
+ ? app_query.Bind(10, *app.second.endpoint)
+ : app_query.Bind(10);
+ app.second.enabled.is_initialized() ? app_query.Bind(11, *app.second.enabled)
+ : app_query.Bind(11);
+ app.second.auth_token.is_initialized()
+ ? app_query.Bind(12, *app.second.auth_token)
+ : app_query.Bind(12);
+ app.second.cloud_transport_type.is_initialized()
+ ? app_query.Bind(13, *app.second.cloud_transport_type)
+ : app_query.Bind(13);
+ app.second.icon_url.is_initialized()
+ ? app_query.Bind(14, *app.second.icon_url)
+ : app_query.Bind(14);
+ app.second.allow_unknown_rpc_passthrough.is_initialized()
+ ? app_query.Bind(15, *app.second.allow_unknown_rpc_passthrough)
+ : app_query.Bind(15);
+ app.second.encryption_required.is_initialized()
+ ? app_query.Bind(16, *app.second.encryption_required)
+ : app_query.Bind(16);
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
@@ -761,6 +806,13 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
if (!SaveAppGroup(app.first, app.second.groups)) {
return false;
}
+
+ bool denied = !app.second.moduleType->is_initialized();
+ if (!SaveRemoteControlDenied(app.first, denied) ||
+ !SaveModuleType(app.first, *app.second.moduleType)) {
+ return false;
+ }
+
if (!SaveNickname(app.first, *app.second.nicknames)) {
return false;
}
@@ -779,6 +831,11 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
return false;
}
+ if (!SaveAppServiceParameters(app.first,
+ *app.second.app_service_parameters)) {
+ return false;
+ }
+
return true;
}
@@ -866,20 +923,64 @@ bool SQLPTExtRepresentation::GatherApplicationPoliciesSection(
params.steal_focus = query.GetBoolean(4);
*params.memory_kb = query.GetInteger(5);
*params.heart_beat_timeout_ms = query.GetUInteger(6);
+ if (!query.IsNull(7)) {
+ *params.certificate = query.GetString(7);
+ }
+
+ // Read cloud app properties
+ policy_table::HybridAppPreference hap;
+ bool valid = policy_table::EnumFromJsonString(query.GetString(8), &hap);
+ if (valid) {
+ *params.hybrid_app_preference = hap;
+ }
+ *params.endpoint = query.GetString(9);
+ if (!query.IsNull(10)) {
+ *params.enabled = query.GetBoolean(10);
+ }
+ *params.auth_token = query.GetString(11);
+ *params.cloud_transport_type = query.GetString(12);
+ *params.icon_url = query.GetString(13);
+ *params.allow_unknown_rpc_passthrough = query.GetBoolean(14);
+ if (!query.IsNull(15)) {
+ *params.encryption_required = query.GetBoolean(15);
+ }
+ const auto& gather_app_id = ((*policies).apps[app_id].is_string())
+ ? (*policies).apps[app_id].get_string()
+ : app_id;
+ // Data should be gathered from db by "default" key if application has
+ // default policies
- if (!GatherAppGroup(app_id, &params.groups)) {
+ if (!GatherAppGroup(gather_app_id, &params.groups)) {
+ return false;
+ }
+
+ bool denied = false;
+ if (!GatherRemoteControlDenied(gather_app_id, &denied)) {
+ return false;
+ }
+ if (!denied) {
+ if (!GatherModuleType(gather_app_id, &*params.moduleType)) {
+ return false;
+ }
+ }
+
+ if (!GatherNickName(gather_app_id, &*params.nicknames)) {
+ return false;
+ }
+ if (!GatherAppType(gather_app_id, &*params.AppHMIType)) {
return false;
}
- if (!GatherNickName(app_id, &*params.nicknames)) {
+ if (!GatherRequestType(gather_app_id, &*params.RequestType)) {
return false;
}
- if (!GatherAppType(app_id, &*params.AppHMIType)) {
+ if (!GatherRequestSubType(gather_app_id, &*params.RequestSubType)) {
return false;
}
- if (!GatherRequestType(app_id, &*params.RequestType)) {
+ if (!GatherAppServiceParameters(gather_app_id,
+ &*params.app_service_parameters)) {
return false;
}
- GatherPreconsentedGroup(app_id, &*params.preconsented_groups);
+ GatherPreconsentedGroup(gather_app_id, &*params.preconsented_groups);
(*policies).apps[app_id] = params;
}
return true;
diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc
index ee53eb1487..4f858637d7 100644
--- a/src/components/policy/policy_external/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_external/src/sql_pt_queries.cc
@@ -76,12 +76,14 @@ const std::string kCreateSchema =
" `vehicle_model` VARCHAR(45), "
" `vehicle_year` VARCHAR(4), "
" `preloaded_date` VARCHAR (10), "
- " `certificate` VARCHAR (45) "
+ " `certificate` VARCHAR (45), "
+ " `lock_screen_dismissal_enabled` BOOL"
"); "
"CREATE TABLE IF NOT EXISTS `functional_group`( "
" `id` INTEGER PRIMARY KEY NOT NULL, "
" `user_consent_prompt` TEXT, "
- " `name` VARCHAR(100) NOT NULL "
+ " `name` VARCHAR(100) NOT NULL, "
+ " `encryption_required` BOOLEAN "
"); "
"CREATE TABLE IF NOT EXISTS `external_consent_entities`( "
" `group_id` INTEGER NOT NULL, "
@@ -98,6 +100,9 @@ const std::string kCreateSchema =
"CREATE TABLE IF NOT EXISTS `hmi_level`( "
" `value` VARCHAR(45) PRIMARY KEY NOT NULL "
"); "
+ "CREATE TABLE IF NOT EXISTS `hybrid_app_preference`( "
+ " `value` VARCHAR(45) PRIMARY KEY NOT NULL "
+ "); "
"CREATE TABLE IF NOT EXISTS `notifications_by_priority`( "
" `priority_value` VARCHAR(45) PRIMARY KEY NOT NULL, "
" `value` INTEGER NOT NULL, "
@@ -147,18 +152,33 @@ const std::string kCreateSchema =
" `is_predata` BOOLEAN, "
" `memory_kb` INTEGER NOT NULL, "
" `heart_beat_timeout_ms` INTEGER NOT NULL, "
+ " `certificate` VARCHAR(65535), "
+ " `hybrid_app_preference_value` VARCHAR(255), "
+ " `endpoint` VARCHAR(255), "
+ " `enabled` BOOLEAN, "
+ " `auth_token` VARCHAR(65535), "
+ " `cloud_transport_type` VARCHAR(255), "
+ " `icon_url` VARCHAR(65535), "
+ " `allow_unknown_rpc_passthrough` BOOLEAN, "
" `remote_control_denied` BOOLEAN NOT NULL DEFAULT 0, "
+ " `encryption_required` BOOLEAN, "
" CONSTRAINT `fk_application_hmi_level1` "
" FOREIGN KEY(`default_hmi`) "
" REFERENCES `hmi_level`(`value`), "
" CONSTRAINT `fk_application_priorities1` "
" FOREIGN KEY(`priority_value`) "
" REFERENCES `priority`(`value`) "
+ " CONSTRAINT `fk_application_hybrid_app_preference1` "
+ " FOREIGN KEY(`hybrid_app_preference_value`) "
+ " REFERENCES `hybrid_app_preference`(`value`) "
"); "
"CREATE INDEX IF NOT EXISTS `application.fk_application_hmi_level1_idx` "
" ON `application`(`default_hmi`); "
"CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` "
" ON `application`(`priority_value`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`application.fk_application_hybrid_app_preference1` "
+ " ON `application`(`hybrid_app_preference_value`); "
"CREATE TABLE IF NOT EXISTS `app_group`( "
" `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
@@ -286,6 +306,30 @@ const std::string kCreateSchema =
" FOREIGN KEY(`application_id`) "
" REFERENCES `application`(`id`) "
"); "
+ "CREATE TABLE IF NOT EXISTS `app_service_types`( "
+ " `id` INTEGER PRIMARY KEY NOT NULL, "
+ " `service_type` VARCHAR(50), "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
+ " CONSTRAINT `fk_service_type_app_id` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`) "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `app_service_names`( "
+ " `service_type_id` INTEGER NOT NULL, "
+ " `service_name` VARCHAR(45), "
+ " PRIMARY KEY(`service_name`,`service_type_id`), "
+ " CONSTRAINT `fk_service_name_service_type_id` "
+ " FOREIGN KEY(`service_type_id`) "
+ " REFERENCES `app_service_types`(`id`) "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `app_service_handled_rpcs`( "
+ " `service_type_id` INTEGER NOT NULL, "
+ " `function_id` INTEGER, "
+ " PRIMARY KEY(`function_id`,`service_type_id`), "
+ " CONSTRAINT `fk_function_id_service_type_id` "
+ " FOREIGN KEY(`service_type_id`) "
+ " REFERENCES `app_service_types`(`id`) "
+ "); "
"CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` "
" ON `app_type`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `consent_group`( "
@@ -342,6 +386,11 @@ const std::string kCreateSchema =
"); "
"CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx` "
" ON `endpoint`(`application_id` COLLATE NOCASE); "
+ /*endpoint properties*/
+ "CREATE TABLE IF NOT EXISTS `endpoint_properties`( "
+ " `service` VARCHAR(100) NOT NULL, "
+ " `version` VARCHAR(100) NOT NULL "
+ ");"
"CREATE TABLE IF NOT EXISTS `message`( "
" `id` INTEGER PRIMARY KEY NOT NULL, "
" `tts` TEXT, "
@@ -405,6 +454,40 @@ const std::string kCreateSchema =
" `entity_id` INTEGER NOT NULL, "
" `on_off` TEXT NOT NULL "
" ); "
+ /*vehicle data*/
+ "CREATE TABLE IF NOT EXISTS `vehicle_data`( "
+ " `schema_version` VARCHAR(100) NOT NULL "
+ ");"
+ /* vehicle data item definition*/
+ "CREATE TABLE IF NOT EXISTS `vehicle_data_item_definition`( "
+ " `name` VARCHAR(255) NOT NULL, "
+ " `type` VARCHAR(255) NOT NULL, "
+ " `key` VARCHAR(255) NOT NULL, "
+ " `mandatory` BOOL NOT NULL, "
+ " `array` BOOL, "
+ " `since` VARCHAR(45), "
+ " `until` VARCHAR(45), "
+ " `removed` BOOL, "
+ " `deprecated` BOOL, "
+ " `minvalue` INTEGER, "
+ " `maxvalue` INTEGER, "
+ " `minsize` INTEGER, "
+ " `maxsize` INTEGER, "
+ " `minlength` INTEGER, "
+ " `maxlength` INTEGER "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `vehicle_data_item_parameters`( "
+ " `parent_name` VARCHAR(255) NOT NULL, "
+ " `parent_key` VARCHAR(255) NOT NULL, "
+ " `param_name` VARCHAR(255) NOT NULL, "
+ " `param_key` VARCHAR(255) NOT NULL, "
+ " CONSTRAINT `fk_vdi_id` "
+ " FOREIGN KEY(`parent_name`, `parent_key`) "
+ " REFERENCES `vehicle_data_item_definition`(`name`, `key`), "
+ " CONSTRAINT `fk_vdi_param_id` "
+ " FOREIGN KEY(`param_name`, `param_key`) "
+ " REFERENCES `vehicle_data_item_definition`(`name`, `key`) "
+ "); "
"COMMIT;";
const std::string kInsertInitData =
@@ -418,8 +501,10 @@ const std::string kInsertInitData =
" VALUES (0, 0, 0, 0); "
"INSERT OR IGNORE INTO `module_config` (`preloaded_pt`, `is_first_run`,"
" `exchange_after_x_ignition_cycles`, `exchange_after_x_kilometers`, "
- " `exchange_after_x_days`, `timeout_after_x_seconds`) "
+ " `exchange_after_x_days`, `timeout_after_x_seconds`)"
" VALUES(1, 0, 0, 0, 0, 0); "
+ "INSERT OR IGNORE INTO `vehicle_data` ("
+ " `schema_version`) VALUES('0'); "
"INSERT OR IGNORE INTO `priority`(`value`) VALUES ('EMERGENCY'); "
"INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NAVIGATION'); "
"INSERT OR IGNORE INTO `priority`(`value`) VALUES ('VOICECOMMUNICATION'); "
@@ -430,6 +515,9 @@ const std::string kInsertInitData =
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('LIMITED'); "
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND'); "
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('MOBILE'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('CLOUD'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('BOTH'); "
"INSERT OR IGNORE INTO `version` (`number`) VALUES('0'); "
"INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); "
"";
@@ -481,6 +569,7 @@ const std::string kDropSchema =
"DROP TABLE IF EXISTS `message`; "
"DROP INDEX IF EXISTS `endpoint.fk_endpoint_application1_idx`; "
"DROP TABLE IF EXISTS `endpoint`; "
+ "DROP TABLE IF EXISTS `endpoint_properties`; "
"DROP INDEX IF EXISTS `consent_group.fk_consent_group_device1_idx`; "
"DROP INDEX IF EXISTS "
"`consent_group.fk_consent_group_functional_group1_idx`; "
@@ -491,6 +580,9 @@ const std::string kDropSchema =
"DROP TABLE IF EXISTS `app_type`; "
"DROP TABLE IF EXISTS `request_type`; "
"DROP TABLE IF EXISTS `request_subtype`; "
+ "DROP TABLE IF EXISTS `app_service_types`; "
+ "DROP TABLE IF EXISTS `app_service_names`; "
+ "DROP TABLE IF EXISTS `app_service_handled_rpcs`; "
"DROP INDEX IF EXISTS `nickname.fk_nickname_application1_idx`; "
"DROP TABLE IF EXISTS `nickname`; "
"DROP INDEX IF EXISTS `app_level.fk_app_level_language2_idx`; "
@@ -532,6 +624,7 @@ const std::string kDropSchema =
"`notifications_by_priority.fk_notifications_by_priority_priority1_idx`; "
"DROP TABLE IF EXISTS `notifications_by_priority`; "
"DROP TABLE IF EXISTS `hmi_level`; "
+ "DROP TABLE IF EXISTS `hybrid_app_preference`; "
"DROP TABLE IF EXISTS `priority`; "
"DROP TABLE IF EXISTS `functional_group`; "
"DROP TABLE IF EXISTS `module_config`; "
@@ -542,6 +635,9 @@ const std::string kDropSchema =
"DROP TABLE IF EXISTS `device`; "
"DROP TABLE IF EXISTS `_internal_data`; "
"DROP TABLE IF EXISTS `_internal_external_consent_status`; "
+ "DROP TABLE IF EXISTS `vehicle_data`; "
+ "DROP TABLE IF EXISTS `vehicle_data_item_definition`; "
+ "DROP TABLE IF EXISTS `vehicle_data_item_parameters`; "
"COMMIT; "
"VACUUM;";
@@ -550,6 +646,7 @@ const std::string kDeleteData =
"DELETE FROM `message`; "
"DELETE FROM `module_type`; "
"DELETE FROM `endpoint`; "
+ "DELETE FROM `endpoint_properties`; "
"DELETE FROM `consent_group`; "
"DELETE FROM `external_consent_status_group`; "
"DELETE FROM `external_consent_entities`; "
@@ -576,6 +673,9 @@ const std::string kDeleteData =
"DELETE FROM `usage_and_error_count`; "
"DELETE FROM `device`; "
"DELETE FROM `request_type`; "
+ "DELETE FROM `vehicle_data`; "
+ "DELETE FROM `vehicle_data_item_definition`; "
+ "DELETE FROM `vehicle_data_item_parameters`; "
"COMMIT; "
"VACUUM;";
@@ -583,6 +683,82 @@ const std::string kCheckDBIntegrity = "PRAGMA integrity_check";
const std::string kCheckPgNumber = "PRAGMA page_count";
+const std::string kSelectEndpointProperties =
+ "SELECT `service`, `version` FROM `endpoint_properties`";
+
+const std::string kSelectVehicleDataSchemaVersion =
+ "SELECT `schema_version` FROM `vehicle_data` ";
+
+const std::string kSelectVehicleDataItem =
+ "SELECT * FROM `vehicle_data_item_definition` "
+ "WHERE `key` = ? AND `name` = ?";
+
+const std::string kSelectVehicleDataItemWithVersion =
+ "SELECT * FROM `vehicle_data_item_definition` "
+ "WHERE `name` IS ? AND `key` IS ? AND `since` IS ? AND `until` IS ?";
+
+const std::string kSelectVehicleDataItemParams =
+ "SELECT * FROM `vehicle_data_item_parameters` "
+ "WHERE `parent_name` = ? AND `parent_key` = ?";
+
+const std::string kSelectCompositeVehicleDataItemsKey =
+ "SELECT DISTINCT `parent_name`, `parent_key` FROM "
+ "`vehicle_data_item_parameters` "
+ "LEFT JOIN "
+ "(SELECT DISTINCT `param_name`, `param_key` FROM "
+ "`vehicle_data_item_parameters`) `vdi_params` ON "
+ "`vehicle_data_item_parameters`.`parent_name` = `vdi_params`.`param_name` "
+ "AND "
+ "`vehicle_data_item_parameters`.`parent_key` = `vdi_params`.`param_key` "
+ "WHERE `vdi_params`.`param_key` IS NULL";
+
+const std::string kSelectPrimitiveVehicleDataItems =
+ "SELECT * FROM `vehicle_data_item_definition` "
+ "LEFT JOIN ( "
+ "SELECT `parent_name`, `parent_key` FROM `vehicle_data_item_parameters` "
+ "UNION "
+ "SELECT `param_name`, `param_key` FROM `vehicle_data_item_parameters`) "
+ "`vdi_params` ON "
+ "`vehicle_data_item_definition`.`name` = `vdi_params`.`parent_name` "
+ "AND "
+ "`vehicle_data_item_definition`.`key` = `vdi_params`.`parent_key` "
+ "WHERE `vdi_params`.`parent_key` IS NULL";
+
+const std::string kInsertVehicleDataSchemaVersion =
+ "UPDATE `vehicle_data` SET `schema_version` = ?";
+
+const std::string kInsertEndpointVersion =
+ "INSERT OR REPLACE INTO `endpoint_properties`(`service`, "
+ "`version`) "
+ "VALUES(?, ?)";
+
+const std::string kInsertVehicleDataItem =
+ "INSERT INTO `vehicle_data_item_definition` ("
+ " `name`, "
+ " `type`, "
+ " `key`, "
+ " `mandatory`, "
+ " `array`, "
+ " `since`, "
+ " `until`, "
+ " `removed`, "
+ " `deprecated`, "
+ " `minvalue`, "
+ " `maxvalue`, "
+ " `minsize`, "
+ " `maxsize`, "
+ " `minlength`, "
+ " `maxlength`) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
+
+const std::string kInsertVehicleDataItemParams =
+ "INSERT INTO `vehicle_data_item_parameters` ("
+ " `parent_name`, "
+ " `parent_key`, "
+ " `param_name`, "
+ " `param_key`) "
+ "VALUES (?, ?, ?, ?) ";
+
const std::string kSelectRpc =
"SELECT DISTINCT `rpc`.`parameter` FROM `rpc` "
" JOIN `app_group` AS `g` ON (`g`.`functional_group_id` = "
@@ -605,12 +781,10 @@ const std::string kSetNotFirstRun =
const std::string kSelectEndpoint =
"SELECT `url`, `application_id` FROM `endpoint` WHERE `service` = ? ";
-const std::string kSelectLockScreenIcon =
- "SELECT `url` FROM `endpoint` WHERE `service` = ? AND `application_id` = ?";
-
const std::string kInsertFunctionalGroup =
- "INSERT INTO `functional_group` (`id`, `name`, `user_consent_prompt`) "
- " VALUES (?, ?, ?)";
+ "INSERT INTO `functional_group` (`id`, `name`, `user_consent_prompt`, "
+ "`encryption_required`) "
+ " VALUES (?, ?, ?, ?)";
const std::string kInsertRpc =
"INSERT INTO `rpc` (`name`, `hmi_level_value`, `functional_group_id`) "
@@ -628,8 +802,12 @@ const std::string kInsertRpcWithParameter =
const std::string kInsertApplication =
"INSERT OR IGNORE INTO `application` (`id`, `priority_value`, "
- "`is_revoked`, `memory_kb`,"
- " `heart_beat_timeout_ms`) VALUES (?,?,?,?,?)";
+ "`is_revoked`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, "
+ "`hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token`, "
+ "`cloud_transport_type`, `icon_url`, `allow_unknown_rpc_passthrough`, "
+ "`encryption_required`) "
+ "VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kInsertAppGroup =
"INSERT INTO `app_group` (`application_id`, `functional_group_id`)"
@@ -645,18 +823,25 @@ const std::string kInsertRequestType =
"INSERT OR IGNORE INTO `request_type` (`application_id`, `request_type`) "
"VALUES (?, ?)";
-const std::string kInsertOmittedRequestType =
- "INSERT INTO `request_type` (`application_id`) "
- "VALUES (?)";
-
const std::string kInsertRequestSubType =
"INSERT INTO `request_subtype` (`application_id`, "
"`request_subtype`) "
"VALUES (?, ?)";
-const std::string kInsertOmittedRequestSubType =
- "INSERT INTO `request_subtype` (`application_id`) "
- "VALUES (?)";
+const std::string kInsertAppServiceTypes =
+ "INSERT INTO `app_service_types` (`id`, "
+ "`service_type`, `application_id`) "
+ "VALUES (?, ?, ?)";
+
+const std::string kInsertAppServiceNames =
+ "INSERT INTO `app_service_names` (`service_type_id`, "
+ "`service_name`) "
+ "VALUES (?, ?)";
+
+const std::string kInsertAppServiceHandledRpcs =
+ "INSERT INTO `app_service_handled_rpcs` (`service_type_id`, "
+ "`function_id`) "
+ "VALUES (?, ?)";
const std::string kUpdateVersion = "UPDATE `version` SET `number`= ?";
@@ -676,7 +861,7 @@ const std::string kUpdateModuleConfig =
" `exchange_after_x_kilometers` = ?, `exchange_after_x_days` = ?, "
" `timeout_after_x_seconds` = ?, `vehicle_make` = ?, "
" `vehicle_model` = ?, `vehicle_year` = ?, `preloaded_date` = ?, "
- " `certificate` = ? ";
+ " `certificate` = ?, lock_screen_dismissal_enabled = ?";
const std::string kInsertEndpoint =
"INSERT INTO `endpoint` (`service`, `url`, `application_id`) "
@@ -727,7 +912,8 @@ const std::string kSelectModuleConfig =
"SELECT `preloaded_pt`, `exchange_after_x_ignition_cycles`, "
" `exchange_after_x_kilometers`, `exchange_after_x_days`, "
" `timeout_after_x_seconds`, `vehicle_make`,"
- " `vehicle_model`, `vehicle_year`, `preloaded_date`, `certificate` "
+ " `vehicle_model`, `vehicle_year`, `preloaded_date`, `certificate`, "
+ " `lock_screen_dismissal_enabled` "
" FROM `module_config`";
const std::string kSelectEndpoints =
@@ -744,7 +930,7 @@ const std::string kSelectAppLevels = "SELECT `application_id` FROM `app_level`";
const std::string kSelectDeviceData = "SELECT * FROM `device`";
const std::string kSelectFunctionalGroups =
- "SELECT `id`,`name`, `user_consent_prompt` "
+ "SELECT `id`,`name`, `user_consent_prompt`, `encryption_required` "
"FROM `functional_group`";
const std::string kSelectAllRpcs =
@@ -760,7 +946,11 @@ const std::string kSelectUserMsgsVersion =
const std::string kSelectAppPolicies =
"SELECT `id`, `priority_value`, `memory_kb`, "
- " `heart_beat_timeout_ms` FROM `application`";
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, `icon_url`, "
+ " `allow_unknown_rpc_passthrough`, `encryption_required` "
+ "FROM "
+ " `application`";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -787,6 +977,21 @@ const std::string kSelectRequestSubTypes =
"`application_id` "
"= ?";
+const std::string kSelectAppServiceTypes =
+ "SELECT `id`, `service_type` FROM `app_service_types` WHERE "
+ "`application_id` "
+ "= ?";
+
+const std::string kSelectAppServiceNames =
+ "SELECT DISTINCT `service_name` FROM `app_service_names` WHERE "
+ "`service_type_id` "
+ "= ?";
+
+const std::string kSelectAppServiceHandledRpcs =
+ "SELECT DISTINCT `function_id` FROM `app_service_handled_rpcs` WHERE "
+ "`service_type_id` "
+ "= ?";
+
const std::string kSelectSecondsBetweenRetries =
"SELECT `value` FROM `seconds_between_retry` ORDER BY `index`";
@@ -834,6 +1039,19 @@ const std::string kDeleteRequestType = "DELETE FROM `request_type`";
const std::string kDeleteRequestSubType = "DELETE FROM `request_subtype`";
+const std::string kDeleteAppServiceTypes = "DELETE FROM `app_service_types`";
+
+const std::string kDeleteAppServiceNames = "DELETE FROM `app_service_names`";
+
+const std::string kDeleteAppServiceHandledRpcs =
+ "DELETE FROM `app_service_handled_rpcs`";
+
+const std::string kDeleteVehicleDataItems =
+ "DELETE FROM `vehicle_data_item_definition`";
+
+const std::string kDeleteVehicleDataItemParams =
+ "DELETE FROM `vehicle_data_item_parameters`";
+
const std::string kSelectApplicationRevoked =
"SELECT `is_revoked` FROM `application` WHERE `id` = ?";
@@ -857,15 +1075,22 @@ const std::string kDeleteAppGroupByApplicationId =
const std::string kInsertApplicationFull =
"INSERT OR IGNORE INTO `application` (`id`, `keep_context`, `steal_focus`, "
- " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
- "`is_predata`, "
- " `memory_kb`, `heart_beat_timeout_ms`) "
- " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ " `is_predata`, `memory_kb`, `heart_beat_timeout_ms`, "
+ " `certificate`, `hybrid_app_preference_value`, `endpoint`, `enabled`, "
+ " `auth_token`, `cloud_transport_type`, `icon_url`, "
+ "`allow_unknown_rpc_passthrough`, `encryption_required`) "
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
const std::string kSelectApplicationFull =
"SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, "
" `is_revoked`, `is_default`, `is_predata`, `memory_kb`,"
- " `heart_beat_timeout_ms` FROM `application` WHERE `id` = ?";
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, "
+ "`icon_url`, "
+ " `allow_unknown_rpc_passthrough`, `encryption_required` "
+ "FROM `application` "
+ "WHERE `id` = ?";
const std::string kSelectDBVersion =
"SELECT `db_version_hash` from `_internal_data`";
diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc
index 3cd7388672..5e96d0bde0 100644
--- a/src/components/policy/policy_external/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_representation.cc
@@ -30,24 +30,24 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sstream>
-#include <stdlib.h>
-#include <stdint.h>
#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
#include <unistd.h>
+#include <sstream>
-#include "utils/logger.h"
+#include "config_profile/profile.h"
+#include "policy/cache_manager.h"
+#include "policy/policy_helper.h"
+#include "policy/sql_pt_ext_queries.h"
+#include "policy/sql_pt_queries.h"
+#include "policy/sql_pt_representation.h"
+#include "policy/sql_wrapper.h"
#include "utils/date_time.h"
-#include "utils/sqlite_wrapper/sql_database.h"
#include "utils/file_system.h"
#include "utils/gen_hash.h"
-#include "policy/sql_pt_representation.h"
-#include "policy/sql_wrapper.h"
-#include "policy/sql_pt_ext_queries.h"
-#include "policy/sql_pt_queries.h"
-#include "policy/policy_helper.h"
-#include "policy/cache_manager.h"
-#include "config_profile/profile.h"
+#include "utils/logger.h"
+#include "utils/sqlite_wrapper/sql_database.h"
namespace policy {
@@ -101,28 +101,6 @@ SQLPTRepresentation::~SQLPTRepresentation() {
delete db_;
}
-std::string SQLPTRepresentation::GetLockScreenIconUrl() const {
- utils::dbms::SQLQuery query(db());
- std::string ret;
- if (query.Prepare(sql_pt::kSelectLockScreenIcon)) {
- query.Bind(0, std::string("lock_screen_icon_url"));
- query.Bind(1, std::string("default"));
-
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority.");
- return ret;
- }
-
- if (!query.IsNull(0)) {
- ret = query.GetString(0);
- }
-
- } else {
- LOG4CXX_WARN(logger_, "Invalid select endpoints statement.");
- }
- return ret;
-}
-
void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
@@ -130,9 +108,9 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRpc)) {
- LOG4CXX_WARN(logger_,
- "Incorrect select statement from rpcs"
- << query.LastError().text());
+ LOG4CXX_WARN(
+ logger_,
+ "Incorrect select statement from rpcs" << query.LastError().text());
return;
}
query.Bind(0, app_id);
@@ -235,10 +213,10 @@ int SQLPTRepresentation::TimeoutResponse() {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) {
LOG4CXX_INFO(logger_, "Can not select timeout response for retry sequence");
- const int defaultTimeout = 30 * date_time::DateTime::MILLISECONDS_IN_SECOND;
+ const int defaultTimeout = 30 * date_time::MILLISECONDS_IN_SECOND;
return defaultTimeout;
}
- return query.GetInteger(0) * date_time::DateTime::MILLISECONDS_IN_SECOND;
+ return query.GetInteger(0) * date_time::MILLISECONDS_IN_SECOND;
}
bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) {
@@ -408,9 +386,9 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) {
utils::dbms::SQLQuery check_first_run(db());
if (check_first_run.Prepare(sql_pt::kIsFirstRun) &&
check_first_run.Next()) {
- LOG4CXX_INFO(logger_,
- "Selecting is first run "
- << check_first_run.GetBoolean(0));
+ LOG4CXX_INFO(
+ logger_,
+ "Selecting is first run " << check_first_run.GetBoolean(0));
if (check_first_run.GetBoolean(0)) {
utils::dbms::SQLQuery set_not_first_run(db());
set_not_first_run.Exec(sql_pt::kSetNotFirstRun);
@@ -451,16 +429,6 @@ bool SQLPTRepresentation::Close() {
return db_->LastError().number() == utils::dbms::OK;
}
-const VehicleInfo SQLPTRepresentation::GetVehicleInfo() const {
- policy_table::ModuleConfig module_config;
- GatherModuleConfig(&module_config);
- VehicleInfo vehicle_info;
- vehicle_info.vehicle_make = *module_config.vehicle_make;
- vehicle_info.vehicle_model = *module_config.vehicle_model;
- vehicle_info.vehicle_year = *module_config.vehicle_year;
- return vehicle_info;
-}
-
bool SQLPTRepresentation::Drop() {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDropSchema)) {
@@ -513,10 +481,10 @@ bool SQLPTRepresentation::RefreshDB() {
return true;
}
-utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot()
+std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot()
const {
LOG4CXX_AUTO_TRACE(logger_);
- utils::SharedPtr<policy_table::Table> table = new policy_table::Table();
+ auto table = std::make_shared<policy_table::Table>();
GatherModuleMeta(&*table->policy_table.module_meta);
GatherModuleConfig(&table->policy_table.module_config);
GatherUsageAndErrorCounts(&*table->policy_table.usage_and_error_counts);
@@ -525,6 +493,11 @@ utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot()
GatherConsumerFriendlyMessages(
&*table->policy_table.consumer_friendly_messages);
GatherApplicationPoliciesSection(&table->policy_table.app_policies_section);
+ GatherVehicleData(&*table->policy_table.vehicle_data);
+ if (!table->policy_table.vehicle_data.is_initialized()) {
+ rpc::Optional<rpc::String<0, 100> > null_version;
+ table->policy_table.vehicle_data->schema_version = null_version;
+ }
return table;
}
@@ -552,6 +525,9 @@ void SQLPTRepresentation::GatherModuleConfig(
*config->vehicle_year = query.GetString(7);
*config->preloaded_date = query.GetString(8);
*config->certificate = query.GetString(9);
+ if (!query.IsNull(10)) {
+ *config->lock_screen_dismissal_enabled = query.GetBoolean(10);
+ }
}
utils::dbms::SQLQuery endpoints(db());
@@ -566,6 +542,18 @@ void SQLPTRepresentation::GatherModuleConfig(
}
}
+ utils::dbms::SQLQuery endpoint_properties(db());
+ if (!endpoint_properties.Prepare(sql_pt::kSelectEndpointProperties)) {
+ LOG4CXX_ERROR(logger_, "Incorrect statement for Endpoint properties");
+ } else {
+ while (endpoint_properties.Next()) {
+ const std::string& service = endpoint_properties.GetString(0);
+ const std::string& version = endpoint_properties.GetString(1);
+ auto& ep_properties = (*config->endpoint_properties);
+ *ep_properties[service].version = version;
+ }
+ }
+
utils::dbms::SQLQuery notifications(db());
if (!notifications.Prepare(sql_pt::kSelectNotificationsPerMin)) {
LOG4CXX_WARN(logger_, "Incorrect select statement for notifications");
@@ -645,6 +633,10 @@ bool SQLPTRepresentation::GatherFunctionalGroupings(
*rpcs_tbl.user_consent_prompt = func_group.GetString(2);
}
+ if (!func_group.IsNull(3)) {
+ *rpcs_tbl.encryption_required = func_group.GetBoolean(3);
+ }
+
const int group_id = func_group.GetInteger(0);
rpcs.Bind(0, group_id);
@@ -657,16 +649,15 @@ bool SQLPTRepresentation::GatherFunctionalGroupings(
}
}
if (!rpcs.IsNull(2)) {
- policy_table::Parameter param;
- if (policy_table::EnumFromJsonString(rpcs.GetString(2), &param)) {
- // EMPTY is a special mark to specify that 'parameters' section is
- // present, but has no parameters. It is not valid parameter value.
- if (policy_table::P_EMPTY == param) {
- (*rpcs_tbl.rpcs[rpcs.GetString(0)].parameters).mark_initialized();
- continue;
- }
- InsertUnique(param, &(*rpcs_tbl.rpcs[rpcs.GetString(0)].parameters));
+ std::string param = rpcs.GetString(2);
+ // EMPTY is a special mark to specify that 'parameters' section is
+ // present, but has no parameters. It is not valid parameter value.
+ if (policy_table::EnumToJsonString(policy_table::P_EMPTY) == param) {
+ (*rpcs_tbl.rpcs[rpcs.GetString(0)].parameters).mark_initialized();
+ continue;
}
+ InsertUnique(rpcs.GetString(2),
+ &(*rpcs_tbl.rpcs[rpcs.GetString(0)].parameters));
}
}
@@ -712,10 +703,33 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
if (query.Prepare(sql_pt::kCollectFriendlyMsg)) {
while (query.Next()) {
UserFriendlyMessage msg;
+
+ msg.tts = query.GetString(1);
+ msg.label = query.GetString(2);
+ msg.line1 = query.GetString(3);
+ msg.line2 = query.GetString(4);
+ msg.text_body = query.GetString(5);
msg.message_code = query.GetString(7);
- std::string language = query.GetString(6);
- (*messages->messages)[msg.message_code].languages[language];
+ std::string language = query.GetString(6);
+ policy_table::Languages& languages =
+ (*messages->messages)[msg.message_code].languages;
+ policy_table::MessageString& specific_message = languages[language];
+ if (!msg.tts.empty()) {
+ *(specific_message).tts = msg.tts;
+ }
+ if (!msg.label.empty()) {
+ *(specific_message).label = msg.label;
+ }
+ if (!msg.line1.empty()) {
+ *(specific_message).line1 = msg.line1;
+ }
+ if (!msg.line2.empty()) {
+ *(specific_message).line2 = msg.line2;
+ }
+ if (!msg.text_body.empty()) {
+ *(specific_message).textBody = msg.text_body;
+ }
}
} else {
LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages.");
@@ -761,30 +775,62 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
*params.memory_kb = query.GetInteger(2);
*params.heart_beat_timeout_ms = query.GetUInteger(3);
- if (!GatherAppGroup(app_id, &params.groups)) {
+ if (!query.IsNull(4)) {
+ *params.certificate = query.GetString(4);
+ }
+
+ // Read cloud app properties
+ policy_table::HybridAppPreference hap;
+ bool valid = policy_table::EnumFromJsonString(query.GetString(5), &hap);
+ if (valid) {
+ *params.hybrid_app_preference = hap;
+ }
+ *params.endpoint = query.GetString(6);
+ if (!query.IsNull(7)) {
+ *params.enabled = query.GetBoolean(7);
+ }
+ *params.auth_token = query.GetString(8);
+ *params.cloud_transport_type = query.GetString(9);
+ *params.icon_url = query.GetString(10);
+ *params.allow_unknown_rpc_passthrough = query.GetBoolean(11);
+ const auto& gather_app_id = ((*policies).apps[app_id].is_string())
+ ? (*policies).apps[app_id].get_string()
+ : app_id;
+
+ if (!query.IsNull(12)) {
+ *params.encryption_required = query.GetBoolean(12);
+ }
+ // Data should be gathered from db by "default" key if application has
+ // default policies
+
+ if (!GatherAppGroup(gather_app_id, &params.groups)) {
return false;
}
bool denied = false;
- if (!GatherRemoteControlDenied(app_id, &denied)) {
+ if (!GatherRemoteControlDenied(gather_app_id, &denied)) {
return false;
}
if (!denied) {
- if (!GatherModuleType(app_id, &*params.moduleType)) {
+ if (!GatherModuleType(gather_app_id, &*params.moduleType)) {
return false;
}
}
- if (!GatherNickName(app_id, &*params.nicknames)) {
+ if (!GatherNickName(gather_app_id, &*params.nicknames)) {
return false;
}
- if (!GatherAppType(app_id, &*params.AppHMIType)) {
+ if (!GatherAppType(gather_app_id, &*params.AppHMIType)) {
return false;
}
- if (!GatherRequestType(app_id, &*params.RequestType)) {
+ if (!GatherRequestType(gather_app_id, &*params.RequestType)) {
return false;
}
- if (!GatherRequestSubType(app_id, &*params.RequestSubType)) {
+ if (!GatherRequestSubType(gather_app_id, &*params.RequestSubType)) {
+ return false;
+ }
+ if (!GatherAppServiceParameters(gather_app_id,
+ &*params.app_service_parameters)) {
return false;
}
@@ -793,6 +839,43 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
return true;
}
+bool SQLPTRepresentation::GatherVehicleData(
+ policy_table::VehicleData* vehicle_data) const {
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kSelectVehicleDataSchemaVersion) ||
+ !query.Next()) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrect statement for vehicle data schema version");
+ return false;
+ }
+ *vehicle_data->schema_version = query.GetString(0);
+
+ vehicle_data->mark_initialized();
+ return GatherVehicleDataItems(&*vehicle_data->schema_items);
+}
+
+bool SQLPTRepresentation::GatherVehicleDataItems(
+ policy_table::VehicleDataItems* vehicle_data_items) const {
+ auto parameterized_vdi = SelectCompositeVehicleDataItems();
+ if (!parameterized_vdi.is_initialized()) {
+ return false;
+ }
+
+ auto non_parameterized_vdi = SelectPrimitiveVehicleDataItems();
+ if (!non_parameterized_vdi.is_initialized()) {
+ return false;
+ }
+
+ vehicle_data_items->insert(vehicle_data_items->end(),
+ parameterized_vdi.begin(),
+ parameterized_vdi.end());
+ vehicle_data_items->insert(vehicle_data_items->end(),
+ non_parameterized_vdi.begin(),
+ non_parameterized_vdi.end());
+
+ return true;
+}
+
bool SQLPTRepresentation::Save(const policy_table::Table& table) {
LOG4CXX_AUTO_TRACE(logger_);
db_->BeginTransaction();
@@ -827,6 +910,10 @@ bool SQLPTRepresentation::Save(const policy_table::Table& table) {
db_->RollbackTransaction();
return false;
}
+ if (!SaveVehicleData(*table.policy_table.vehicle_data)) {
+ db_->RollbackTransaction();
+ return false;
+ }
db_->CommitTransaction();
return true;
}
@@ -872,7 +959,9 @@ bool SQLPTRepresentation::SaveFunctionalGroupings(
groups_it->second.user_consent_prompt.is_initialized()
? query.Bind(2, *(groups_it->second.user_consent_prompt))
: query.Bind(2);
-
+ groups_it->second.encryption_required.is_initialized()
+ ? query.Bind(3, *(groups_it->second.encryption_required))
+ : query.Bind(3);
if (!query.Exec() || !query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into functional groups");
return false;
@@ -925,8 +1014,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
query_parameter.Bind(0, it->first);
query_parameter.Bind(
1, std::string(policy_table::EnumToJsonString(*hmi_it)));
- query_parameter.Bind(
- 2, std::string(policy_table::EnumToJsonString(*ps_it)));
+ query_parameter.Bind(2, std::string(*ps_it));
query_parameter.Bind(3, group_id);
if (!query_parameter.Exec() || !query_parameter.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter");
@@ -978,6 +1066,21 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection(
return false;
}
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from service names.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled service types.");
+ return false;
+ }
+
// All predefined apps (e.g. default, pre_DataConsent) should be saved first,
// otherwise another app with the predefined permissions can get incorrect
// permissions
@@ -1029,6 +1132,34 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
app_query.Bind(2, app.second.is_null());
app_query.Bind(3, *app.second.memory_kb);
app_query.Bind(4, static_cast<int64_t>(*app.second.heart_beat_timeout_ms));
+ app.second.certificate.is_initialized()
+ ? app_query.Bind(5, *app.second.certificate)
+ : app_query.Bind(5);
+ app.second.hybrid_app_preference.is_initialized()
+ ? app_query.Bind(6,
+ std::string(policy_table::EnumToJsonString(
+ *app.second.hybrid_app_preference)))
+ : app_query.Bind(6);
+ app.second.endpoint.is_initialized() ? app_query.Bind(7, *app.second.endpoint)
+ : app_query.Bind(7);
+ app.second.enabled.is_initialized() ? app_query.Bind(8, *app.second.enabled)
+ : app_query.Bind(8);
+ app.second.auth_token.is_initialized()
+ ? app_query.Bind(9, *app.second.auth_token)
+ : app_query.Bind(9);
+ app.second.cloud_transport_type.is_initialized()
+ ? app_query.Bind(10, *app.second.cloud_transport_type)
+ : app_query.Bind(10);
+ app.second.icon_url.is_initialized()
+ ? app_query.Bind(11, *app.second.icon_url)
+ : app_query.Bind(11);
+ app.second.allow_unknown_rpc_passthrough.is_initialized()
+ ? app_query.Bind(12, *app.second.allow_unknown_rpc_passthrough)
+ : app_query.Bind(12);
+
+ app.second.encryption_required.is_initialized()
+ ? app_query.Bind(13, *app.second.encryption_required)
+ : app_query.Bind(13);
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
@@ -1065,6 +1196,10 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
if (!SaveRequestType(app.first, *app.second.RequestType)) {
return false;
}
+ if (!SaveAppServiceParameters(app.first,
+ *app.second.app_service_parameters)) {
+ return false;
+ }
return true;
}
@@ -1097,6 +1232,44 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy(
return true;
}
+bool SQLPTRepresentation::SaveVehicleDataItems(
+ const policy_table::VehicleDataItems& vehicle_data_items) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DeleteVehicleDataItems();
+ for (const auto& item : vehicle_data_items) {
+ if (!InsertVehicleDataItem(item)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool SQLPTRepresentation::SaveVehicleData(
+ const policy_table::VehicleData& vehicle_data) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (vehicle_data.is_initialized() &&
+ vehicle_data.schema_version.is_initialized()) {
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kInsertVehicleDataSchemaVersion)) {
+ LOG4CXX_WARN(logger_,
+ "Incorrect insert of schema_version to vehicle_data.");
+ return false;
+ }
+ query.Bind(0, *vehicle_data.schema_version);
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_WARN(logger_, "Failed to insert schema_version to vehicle_data.");
+ return false;
+ }
+ }
+
+ auto vehicle_data_items = vehicle_data.is_initialized() &&
+ vehicle_data.schema_items.is_initialized()
+ ? *(vehicle_data.schema_items)
+ : policy_table::VehicleDataItems();
+
+ return SaveVehicleDataItems(vehicle_data_items);
+}
+
bool SQLPTRepresentation::SaveAppGroup(
const std::string& app_id, const policy_table::Strings& app_groups) {
utils::dbms::SQLQuery query(db());
@@ -1112,9 +1285,9 @@ bool SQLPTRepresentation::SaveAppGroup(
query.Bind(0, app_id);
query.Bind(1, *it);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert into app group."
- << query.LastError().text());
+ LOG4CXX_WARN(
+ logger_,
+ "Incorrect insert into app group." << query.LastError().text());
return false;
}
}
@@ -1193,18 +1366,6 @@ bool SQLPTRepresentation::SaveRequestType(
LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
return false;
}
- } else {
- utils::dbms::SQLQuery query_omitted(db());
- if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request types.");
- return false;
- }
- LOG4CXX_WARN(logger_, "Request types omitted.");
- query_omitted.Bind(0, app_id);
- if (!query_omitted.Exec() || !query_omitted.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
- return false;
- }
}
return true;
}
@@ -1232,23 +1393,92 @@ bool SQLPTRepresentation::SaveRequestSubType(
} else if (request_subtypes.is_initialized()) {
LOG4CXX_WARN(logger_, "Request subtypes empty.");
query.Bind(0, app_id);
- query.Bind(1, std::string("EMPTY"));
+ query.Bind(1,
+ std::string(policy_table::EnumToJsonString(
+ policy_table::RequestType::RT_EMPTY)));
if (!query.Exec() || !query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
return false;
}
- } else {
- utils::dbms::SQLQuery query_omitted(db());
- if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestSubType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes.");
+ }
+ return true;
+}
+
+bool SQLPTRepresentation::SaveAppServiceParameters(
+ const std::string& app_id,
+ const policy_table::AppServiceParameters& app_service_parameters) {
+ LOG4CXX_INFO(logger_, "Save app service parameters");
+ utils::dbms::SQLQuery query(db());
+
+ if (!query.Prepare(sql_pt::kInsertAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert statement for app service types");
+ return false;
+ }
+ policy_table::AppServiceParameters::const_iterator it;
+ for (it = app_service_parameters.begin(); it != app_service_parameters.end();
+ ++it) {
+ // Create service type id from hashing app_id and service_type
+ std::string str_to_hash = std::string(app_id + it->first);
+ const long int id = abs(CacheManager::GenerateHash(str_to_hash));
+ query.Bind(0, static_cast<int64_t>(id));
+ query.Bind(1, it->first);
+ query.Bind(2, app_id);
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_WARN(logger_, "Insert execute failed for into app service types");
return false;
}
- LOG4CXX_WARN(logger_, "Request subtypes omitted.");
- query_omitted.Bind(0, app_id);
- if (!query_omitted.Exec() || !query_omitted.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
+
+ // Insert app names array into db
+ utils::dbms::SQLQuery service_name_query(db());
+ if (!service_name_query.Prepare(sql_pt::kInsertAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert statement for app service names");
return false;
}
+
+ auto app_service_names = it->second.service_names;
+
+ if (app_service_names.is_initialized() && app_service_names->empty()) {
+ // App service names is an empty array
+ LOG4CXX_DEBUG(logger_, "App Service Names is Empty Array");
+ service_name_query.Bind(0, static_cast<int64_t>(id));
+ service_name_query.Bind(1);
+ if (!service_name_query.Exec() || !service_name_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into empty app service names");
+ return false;
+ }
+ } else {
+ policy_table::AppServiceNames::const_iterator names_it;
+ for (names_it = app_service_names->begin();
+ names_it != app_service_names->end();
+ ++names_it) {
+ service_name_query.Bind(0, static_cast<int64_t>(id));
+ service_name_query.Bind(1, *names_it);
+ if (!service_name_query.Exec() || !service_name_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into app service names");
+ return false;
+ }
+ }
+ }
+
+ // Insert handled rpcs array into db
+ utils::dbms::SQLQuery handled_rpcs_query(db());
+ if (!handled_rpcs_query.Prepare(sql_pt::kInsertAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_,
+ "Incorrect insert statement for app service handled rpcs");
+ return false;
+ }
+
+ auto handled_rpcs = it->second.handled_rpcs;
+ policy_table::AppServiceHandledRpcs::const_iterator rpc_it;
+ for (rpc_it = handled_rpcs.begin(); rpc_it != handled_rpcs.end();
+ ++rpc_it) {
+ handled_rpcs_query.Bind(0, static_cast<int64_t>(id));
+ handled_rpcs_query.Bind(1, static_cast<int32_t>(rpc_it->function_id));
+ if (!handled_rpcs_query.Exec() || !handled_rpcs_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into app service handled rpcs");
+ return false;
+ }
+ }
}
return true;
}
@@ -1286,6 +1516,10 @@ bool SQLPTRepresentation::SaveModuleConfig(
config.certificate.is_initialized() ? query.Bind(9, *(config.certificate))
: query.Bind(9);
+ config.lock_screen_dismissal_enabled.is_initialized()
+ ? query.Bind(10, *(config.lock_screen_dismissal_enabled))
+ : query.Bind(10);
+
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Incorrect update module config");
return false;
@@ -1304,6 +1538,10 @@ bool SQLPTRepresentation::SaveModuleConfig(
return false;
}
+ if (!SaveServiceEndpointProperties(*config.endpoint_properties)) {
+ return false;
+ }
+
return true;
}
@@ -1342,6 +1580,31 @@ bool SQLPTRepresentation::SaveServiceEndpoints(
return true;
}
+bool SQLPTRepresentation::SaveServiceEndpointProperties(
+ const policy_table::ServiceEndpointProperties& endpoint_properties) {
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kInsertEndpointVersion)) {
+ LOG4CXX_WARN(
+ logger_,
+ "Incorrect insert of endpoint property to endpoint_properties.");
+ return false;
+ }
+
+ for (auto& endpoint_property : endpoint_properties) {
+ query.Bind(0, endpoint_property.first);
+ query.Bind(1, endpoint_property.second.version);
+
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_WARN(
+ logger_,
+ "Failed to insert endpoint property into endpoint_properties.");
+ return false;
+ }
+ }
+
+ return true;
+}
+
bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
const policy_table::ConsumerFriendlyMessages& messages) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1428,6 +1691,120 @@ bool SQLPTRepresentation::SaveLanguage(const std::string& code) {
return true;
}
+policy_table::VehicleDataItem SQLPTRepresentation::PopulateVDIFromQuery(
+ const utils::dbms::SQLQuery& query) const {
+ policy_table::VehicleDataItem result;
+
+ result.name = query.GetString(0);
+ result.type = query.GetString(1);
+ result.key = query.GetString(2);
+ result.mandatory = query.GetBoolean(3);
+
+ if (!query.IsNull(4)) {
+ *result.array = query.GetBoolean(4);
+ }
+ if (!query.IsNull(5)) {
+ *result.since = query.GetString(5);
+ }
+ if (!query.IsNull(6)) {
+ *result.until = query.GetString(6);
+ }
+ if (!query.IsNull(7)) {
+ *result.removed = query.GetBoolean(7);
+ }
+ if (!query.IsNull(8)) {
+ *result.deprecated = query.GetBoolean(8);
+ }
+ if (!query.IsNull(9)) {
+ *result.minvalue = query.GetInteger(9);
+ }
+ if (!query.IsNull(10)) {
+ *result.maxvalue = query.GetInteger(10);
+ }
+ if (!query.IsNull(11)) {
+ *result.minsize = query.GetUInteger(11);
+ }
+ if (!query.IsNull(12)) {
+ *result.maxsize = query.GetUInteger(12);
+ }
+ if (!query.IsNull(13)) {
+ *result.minlength = query.GetUInteger(13);
+ }
+ if (!query.IsNull(14)) {
+ *result.maxlength = query.GetUInteger(14);
+ }
+ result.params->mark_initialized();
+
+ result.mark_initialized();
+ return result;
+}
+
+policy_table::VehicleDataItems
+SQLPTRepresentation::SelectCompositeVehicleDataItems() const {
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kSelectCompositeVehicleDataItemsKey)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrect statement for parameterized vehicle data items");
+ return policy_table::VehicleDataItems();
+ }
+
+ policy_table::VehicleDataItems result;
+ result.mark_initialized();
+
+ while (query.Next()) {
+ const auto vdi = GetVehicleDataItem(query.GetString(0), query.GetString(1));
+ if (!vdi.is_initialized()) {
+ return policy_table::VehicleDataItems();
+ }
+ for (const auto& item : vdi) {
+ result.push_back(item);
+ }
+ }
+
+ return result;
+}
+
+policy_table::VehicleDataItems
+SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const {
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kSelectPrimitiveVehicleDataItems)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Incorrect statement for non parameterized vehicle data items");
+ return policy_table::VehicleDataItems();
+ }
+
+ auto result = policy_table::VehicleDataItems();
+ result.mark_initialized();
+
+ while (query.Next()) {
+ const auto vdi = PopulateVDIFromQuery(query);
+ if (!vdi.is_initialized()) {
+ return policy_table::VehicleDataItems();
+ }
+ result.push_back(vdi);
+ }
+ return result;
+}
+
+bool SQLPTRepresentation::DeleteVehicleDataItems() const {
+ utils::dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!query.Exec(sql_pt::kDeleteVehicleDataItems)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed clearing database: " << query.LastError().text());
+ return false;
+ }
+
+ if (!query.Exec(sql_pt::kDeleteVehicleDataItemParams)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed clearing database: " << query.LastError().text());
+ return false;
+ }
+ return true;
+}
+
bool SQLPTRepresentation::SaveMessageString(
const std::string& type,
const std::string& lang,
@@ -1670,7 +2047,8 @@ bool SQLPTRepresentation::GatherRequestSubType(
query.Bind(0, app_id);
while (query.Next()) {
const std::string request_subtype = query.GetString(0);
- if ("EMPTY" == request_subtype) {
+ if (policy_table::EnumToJsonString(policy_table::RequestType::RT_EMPTY) ==
+ request_subtype) {
request_subtypes->mark_initialized();
continue;
}
@@ -1679,6 +2057,63 @@ bool SQLPTRepresentation::GatherRequestSubType(
return true;
}
+bool SQLPTRepresentation::GatherAppServiceParameters(
+ const std::string& app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ LOG4CXX_INFO(logger_, "Gather app service info");
+ utils::dbms::SQLQuery service_type_query(db());
+ if (!service_type_query.Prepare(sql_pt::kSelectAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect select from service_types");
+ return false;
+ }
+
+ utils::dbms::SQLQuery service_name_query(db());
+ if (!service_name_query.Prepare(sql_pt::kSelectAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect select all from app_service_names");
+ return false;
+ }
+
+ utils::dbms::SQLQuery handled_rpcs_query(db());
+ if (!handled_rpcs_query.Prepare(sql_pt::kSelectAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_, "Incorrect select all from app_service_handled_rpcs");
+ return false;
+ }
+
+ service_type_query.Bind(0, app_id);
+ while (service_type_query.Next()) {
+ const int service_type_id = service_type_query.GetInteger(0);
+ std::string service_type = service_type_query.GetString(1);
+ (*app_service_parameters)[service_type] = policy_table::AppServiceInfo();
+
+ service_name_query.Bind(0, service_type_id);
+ while (service_name_query.Next()) {
+ LOG4CXX_DEBUG(logger_, "Loading service name");
+ (*app_service_parameters)[service_type].service_names->push_back(
+ service_name_query.GetString(0));
+ (*app_service_parameters)[service_type].service_names->mark_initialized();
+ }
+
+ handled_rpcs_query.Bind(0, service_type_id);
+ while (handled_rpcs_query.Next()) {
+ policy_table::AppServiceHandledRpc handled_rpc;
+ handled_rpc.function_id = handled_rpcs_query.GetInteger(0);
+ (*app_service_parameters)[service_type].handled_rpcs.push_back(
+ handled_rpc);
+ }
+
+ if (!service_name_query.Reset()) {
+ LOG4CXX_ERROR(logger_, "Could not reset service_name query");
+ return false;
+ }
+ if (!handled_rpcs_query.Reset()) {
+ LOG4CXX_ERROR(logger_, "Could not reset handled_rpcs query");
+ return false;
+ }
+ }
+
+ return true;
+}
+
bool SQLPTRepresentation::GatherNickName(
const std::string& app_id, policy_table::Strings* nicknames) const {
utils::dbms::SQLQuery query(db());
@@ -1740,6 +2175,10 @@ bool SQLPTRepresentation::GatherModuleType(
if (!policy_table::EnumFromJsonString(query.GetString(0), &type)) {
return false;
}
+ if (policy_table::ModuleType::MT_EMPTY == type) {
+ app_types->mark_initialized();
+ continue;
+ }
app_types->push_back(type);
}
return true;
@@ -1772,18 +2211,30 @@ bool SQLPTRepresentation::SaveModuleType(
}
policy_table::ModuleTypes::const_iterator it;
- for (it = types.begin(); it != types.end(); ++it) {
+ if (!types.empty()) {
+ for (it = types.begin(); it != types.end(); ++it) {
+ query.Bind(0, app_id);
+ std::string module(policy_table::EnumToJsonString(*it));
+ query.Bind(1, module);
+ LOG4CXX_DEBUG(logger_,
+ "Module(app: " << app_id << ", type: " << module << ")");
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into module type.");
+ return false;
+ }
+ }
+ } else if (types.is_initialized()) {
query.Bind(0, app_id);
- std::string module(policy_table::EnumToJsonString(*it));
- query.Bind(1, module);
- LOG4CXX_DEBUG(logger_,
- "Module(app: " << app_id << ", type: " << module << ")");
+ query.Bind(1,
+ std::string(policy_table::EnumToJsonString(
+ policy_table::ModuleType::MT_EMPTY)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into module type.");
+ LOG4CXX_WARN(logger_, "Incorrect insert into module types.");
return false;
}
+ } else {
+ LOG4CXX_WARN(logger_, "Module Type omitted.");
}
-
return true;
}
@@ -2008,6 +2459,12 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
return false;
}
+ policy_table::AppServiceParameters app_service_parameters;
+ if (!GatherAppServiceParameters(kDefaultId, &app_service_parameters) ||
+ !SaveAppServiceParameters(app_id, app_service_parameters)) {
+ return false;
+ }
+
policy_table::Strings default_groups;
bool ret = (GatherAppGroup(kDefaultId, &default_groups) &&
SaveAppGroup(app_id, default_groups));
@@ -2080,6 +2537,198 @@ bool SQLPTRepresentation::UpdateDBVersion() const {
return true;
}
+policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem(
+ const std::string& name, const std::string& key) const {
+ policy_table::VehicleDataItems result;
+ utils::dbms::SQLQuery query(db());
+
+ if (!query.Prepare(sql_pt::kSelectVehicleDataItem)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
+ return result;
+ }
+
+ query.Bind(0, key);
+ query.Bind(1, name);
+
+ while (query.Next()) {
+ auto vdi = PopulateVDIFromQuery(query);
+ if (!vdi.is_initialized()) {
+ return policy_table::VehicleDataItems();
+ }
+
+ utils::dbms::SQLQuery param_query(db());
+ if (policy_table::VehicleDataItem::kStruct ==
+ static_cast<std::string>(vdi.type)) {
+ if (!param_query.Prepare(sql_pt::kSelectVehicleDataItemParams)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrent select statement of vehicle data item. "
+ << param_query.LastError().text());
+ return policy_table::VehicleDataItems();
+ }
+
+ param_query.Bind(0, name);
+ param_query.Bind(1, key);
+
+ while (param_query.Next()) {
+ const auto param_with_diff_versions = GetVehicleDataItem(
+ param_query.GetString(2), param_query.GetString(3));
+ if (!param_with_diff_versions.is_initialized()) {
+ return policy_table::VehicleDataItems();
+ }
+ for (const auto& param : param_with_diff_versions) {
+ vdi.params->push_back(param);
+ }
+ }
+ }
+ result.push_back(vdi);
+ }
+ if (!result.empty()) {
+ result.mark_initialized();
+ }
+
+ return result;
+}
+
+bool SQLPTRepresentation::InsertVehicleDataItem(
+ const policy_table::VehicleDataItem& vehicle_data_item) {
+ utils::dbms::SQLQuery query(db());
+
+ if (!vehicle_data_item.is_initialized() || !vehicle_data_item.is_valid()) {
+ LOG4CXX_ERROR(logger_, "Vehicle data item is not initialized.");
+ return false;
+ }
+
+ if (VehicleDataItemExists(vehicle_data_item)) {
+ LOG4CXX_INFO(logger_,
+ static_cast<std::string>(vehicle_data_item.key)
+ << " is already stored.");
+ return true;
+ }
+
+ if (!query.Prepare(sql_pt::kInsertVehicleDataItem)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
+ return false;
+ }
+
+ query.Bind(0, vehicle_data_item.name);
+ query.Bind(1, vehicle_data_item.type);
+ query.Bind(2, vehicle_data_item.key);
+ query.Bind(3, vehicle_data_item.mandatory);
+ vehicle_data_item.array.is_initialized()
+ ? query.Bind(4, *vehicle_data_item.array)
+ : query.Bind(4);
+ vehicle_data_item.since.is_initialized()
+ ? query.Bind(5, *vehicle_data_item.since)
+ : query.Bind(5);
+ vehicle_data_item.until.is_initialized()
+ ? query.Bind(6, *vehicle_data_item.until)
+ : query.Bind(6);
+ vehicle_data_item.removed.is_initialized()
+ ? query.Bind(7, *vehicle_data_item.removed)
+ : query.Bind(7);
+ vehicle_data_item.deprecated.is_initialized()
+ ? query.Bind(8, *vehicle_data_item.deprecated)
+ : query.Bind(8);
+ vehicle_data_item.minvalue.is_initialized()
+ ? query.Bind(9, *vehicle_data_item.minvalue)
+ : query.Bind(9);
+ vehicle_data_item.maxvalue.is_initialized()
+ ? query.Bind(10, *vehicle_data_item.maxvalue)
+ : query.Bind(10);
+ vehicle_data_item.minsize.is_initialized()
+ ? query.Bind(11, static_cast<int64_t>(*vehicle_data_item.minsize))
+ : query.Bind(11);
+ vehicle_data_item.maxsize.is_initialized()
+ ? query.Bind(12, static_cast<int64_t>(*vehicle_data_item.maxsize))
+ : query.Bind(12);
+ vehicle_data_item.minlength.is_initialized()
+ ? query.Bind(13, static_cast<int64_t>(*vehicle_data_item.minlength))
+ : query.Bind(13);
+ vehicle_data_item.maxlength.is_initialized()
+ ? query.Bind(14, static_cast<int64_t>(*vehicle_data_item.maxlength))
+ : query.Bind(14);
+
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to insert vehicle data item: "
+ << static_cast<std::string>(vehicle_data_item.key)
+ << ". Error: " << query.LastError().text());
+ return false;
+ }
+
+ if (vehicle_data_item.params->is_initialized()) {
+ std::map<std::string, std::string> stored_vehicle_data_item_params;
+ for (const auto& param : *(vehicle_data_item.params)) {
+ if (!InsertVehicleDataItem(param)) {
+ return false;
+ }
+
+ if (stored_vehicle_data_item_params.end() !=
+ stored_vehicle_data_item_params.find(param.name)) {
+ LOG4CXX_DEBUG(logger_, "Parameter already stored.");
+ continue;
+ }
+
+ if (!query.Prepare(sql_pt::kInsertVehicleDataItemParams)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
+ return false;
+ }
+
+ query.Bind(0, vehicle_data_item.name);
+ query.Bind(1, vehicle_data_item.key);
+ query.Bind(2, param.name);
+ query.Bind(3, param.key);
+
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Failed to insert to vehicle data item relations helper table: "
+ << static_cast<std::string>(param.key)
+ << ". Error: " << query.LastError().text());
+ return false;
+ }
+ stored_vehicle_data_item_params[param.name] = param.key;
+ }
+ }
+
+ return true;
+}
+
+bool SQLPTRepresentation::VehicleDataItemExists(
+ const policy_table::VehicleDataItem& vehicle_data_item) const {
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kSelectVehicleDataItemWithVersion)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrent select statement for vehicle data item. "
+ << query.LastError().text());
+ return false;
+ }
+
+ query.Bind(0, vehicle_data_item.name);
+ query.Bind(1, vehicle_data_item.key);
+ vehicle_data_item.since.is_initialized()
+ ? query.Bind(2, std::string(*vehicle_data_item.since))
+ : query.Bind(2);
+ vehicle_data_item.until.is_initialized()
+ ? query.Bind(3, std::string(*vehicle_data_item.until))
+ : query.Bind(3);
+
+ if (!query.Exec()) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to retrieve vehicle data item: "
+ << std::string(vehicle_data_item.key)
+ << ". Error: " << query.LastError().text());
+ return false;
+ }
+ return !query.IsNull(0);
+}
+
const int32_t SQLPTRepresentation::GetDBVersion() const {
return utils::Djb2HashFromString(sql_pt::kCreateSchema);
}
@@ -2109,7 +2758,7 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertApplicationFull)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement into application.");
+ LOG4CXX_WARN(logger_, "Incorrect insert statement into application full.");
return false;
}
query.Bind(0, destination);
@@ -2127,6 +2776,24 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
: query.Bind(7, source_app.GetBoolean(6));
query.Bind(8, source_app.GetInteger(7));
query.Bind(9, source_app.GetInteger(8));
+ source_app.IsNull(9) ? query.Bind(10)
+ : query.Bind(10, source_app.GetString(9));
+ source_app.IsNull(10) ? query.Bind(11)
+ : query.Bind(11, source_app.GetString(10));
+ source_app.IsNull(11) ? query.Bind(12)
+ : query.Bind(12, source_app.GetString(11));
+ source_app.IsNull(12) ? query.Bind(13)
+ : query.Bind(13, source_app.GetBoolean(12));
+ source_app.IsNull(13) ? query.Bind(14)
+ : query.Bind(14, source_app.GetString(13));
+ source_app.IsNull(14) ? query.Bind(15)
+ : query.Bind(15, source_app.GetString(14));
+ source_app.IsNull(15) ? query.Bind(16)
+ : query.Bind(16, source_app.GetString(15));
+ source_app.IsNull(16) ? query.Bind(17)
+ : query.Bind(17, source_app.GetBoolean(16));
+ source_app.IsNull(17) ? query.Bind(18)
+ : query.Bind(18, source_app.GetBoolean(17));
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Failed inserting into application.");
diff --git a/src/components/policy/policy_external/src/status.cc b/src/components/policy/policy_external/src/status.cc
index 31fc7f110b..826cca5a2e 100644
--- a/src/components/policy/policy_external/src/status.cc
+++ b/src/components/policy/policy_external/src/status.cc
@@ -32,7 +32,6 @@
#include "policy/status.h"
#include "policy/update_status_manager.h"
-#include "utils/make_shared.h"
policy::UpToDateStatus::UpToDateStatus()
: Status(kUpToDate, policy::PolicyTableStatus::StatusUpToDate) {}
@@ -45,7 +44,7 @@ void policy::UpToDateStatus::ProcessEvent(UpdateStatusManager* manager,
case kScheduleUpdate:
case kScheduleManualUpdate:
case kOnResetRetrySequence:
- manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetNextStatus(std::make_shared<UpdateNeededStatus>());
break;
default:
break;
@@ -59,14 +58,17 @@ void policy::UpdateNeededStatus::ProcessEvent(
policy::UpdateStatusManager* manager, policy::UpdateEvent event) {
switch (event) {
case kOnUpdateSentOut:
- manager->SetNextStatus(utils::MakeShared<UpdatingStatus>());
+ manager->SetNextStatus(std::make_shared<UpdatingStatus>());
break;
case kOnResetPolicyTableRequireUpdate:
- manager->SetNextStatus(utils::MakeShared<UpToDateStatus>());
- manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
+ manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>());
break;
case kOnResetPolicyTableNoUpdate:
- manager->SetNextStatus(utils::MakeShared<UpToDateStatus>());
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
+ break;
+ case kPendingUpdate:
+ manager->SetNextStatus(std::make_shared<UpdatePendingStatus>());
break;
default:
break;
@@ -77,6 +79,36 @@ bool policy::UpdateNeededStatus::IsUpdateRequired() const {
return true;
}
+policy::UpdatePendingStatus::UpdatePendingStatus()
+ : Status(kUpdateNeeded,
+ policy::PolicyTableStatus::StatusProcessingSnapshot) {}
+
+void policy::UpdatePendingStatus::ProcessEvent(
+ policy::UpdateStatusManager* manager, policy::UpdateEvent event) {
+ switch (event) {
+ case kOnUpdateSentOut:
+ manager->SetNextStatus(std::make_shared<UpdatingStatus>());
+ break;
+ case kOnResetPolicyTableRequireUpdate:
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
+ manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>());
+ break;
+ case kOnResetPolicyTableNoUpdate:
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
+ break;
+ default:
+ break;
+ }
+}
+
+bool policy::UpdatePendingStatus::IsUpdatePending() const {
+ return true;
+}
+
+bool policy::UpdatePendingStatus::IsUpdateRequired() const {
+ return true;
+}
+
policy::UpdatingStatus::UpdatingStatus()
: Status(kUpdating, policy::PolicyTableStatus::StatusUpdatePending) {}
@@ -85,23 +117,22 @@ void policy::UpdatingStatus::ProcessEvent(policy::UpdateStatusManager* manager,
switch (event) {
case kOnValidUpdateReceived:
case kOnResetPolicyTableNoUpdate:
- manager->SetNextStatus(utils::MakeShared<UpToDateStatus>());
- break;
- case kOnNewAppRegistered:
- manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
break;
case kOnWrongUpdateReceived:
case kOnUpdateTimeout:
- manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetNextStatus(std::make_shared<UpdateNeededStatus>());
break;
case kOnResetPolicyTableRequireUpdate:
- manager->SetNextStatus(utils::MakeShared<UpToDateStatus>());
- manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
+ manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>());
break;
case kScheduleUpdate:
case kScheduleManualUpdate:
+ manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>());
+ break;
case kOnResetRetrySequence:
- manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetNextStatus(std::make_shared<UpdateNeededStatus>());
break;
default:
break;
diff --git a/src/components/policy/policy_external/src/update_status_manager.cc b/src/components/policy/policy_external/src/update_status_manager.cc
index 087db1149b..d34d1b7817 100644
--- a/src/components/policy/policy_external/src/update_status_manager.cc
+++ b/src/components/policy/policy_external/src/update_status_manager.cc
@@ -32,8 +32,8 @@
#include "policy/update_status_manager.h"
#include "policy/policy_listener.h"
+#include "policy/ptu_retry_handler.h"
#include "utils/logger.h"
-#include "utils/make_shared.h"
namespace policy {
@@ -41,7 +41,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
UpdateStatusManager::UpdateStatusManager()
: listener_(NULL)
- , current_status_(utils::MakeShared<UpToDateStatus>())
+ , current_status_(std::make_shared<UpToDateStatus>())
, last_processed_event_(kNoEvent)
, apps_search_in_progress_(false)
, app_registered_from_non_consented_device_(true) {
@@ -61,17 +61,18 @@ UpdateStatusManager::~UpdateStatusManager() {
}
void UpdateStatusManager::ProcessEvent(UpdateEvent event) {
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(status_lock_);
current_status_->ProcessEvent(this, event);
last_processed_event_ = event;
DoTransition();
}
-void UpdateStatusManager::SetNextStatus(utils::SharedPtr<Status> status) {
+void UpdateStatusManager::SetNextStatus(std::shared_ptr<Status> status) {
next_status_ = status;
}
-void UpdateStatusManager::SetPostponedStatus(utils::SharedPtr<Status> status) {
+void UpdateStatusManager::SetPostponedStatus(std::shared_ptr<Status> status) {
postponed_status_ = status;
}
@@ -88,6 +89,14 @@ void UpdateStatusManager::OnUpdateSentOut(uint32_t update_timeout) {
void UpdateStatusManager::OnUpdateTimeoutOccurs() {
LOG4CXX_AUTO_TRACE(logger_);
+
+ auto& ptu_retry_handler = listener_->ptu_retry_handler();
+
+ if (ptu_retry_handler.IsAllowedRetryCountExceeded()) {
+ ptu_retry_handler.RetrySequenceFailed();
+ return;
+ }
+
ProcessEvent(kOnUpdateTimeout);
DCHECK(update_status_thread_delegate_);
update_status_thread_delegate_->updateTimeOut(0); // Stop Timer
@@ -99,6 +108,12 @@ void UpdateStatusManager::OnValidUpdateReceived() {
ProcessEvent(kOnValidUpdateReceived);
}
+void UpdateStatusManager::ResetTimeout(uint32_t update_timeout) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ update_status_thread_delegate_->updateTimeOut(
+ update_timeout); // Restart Timer
+}
+
void UpdateStatusManager::OnWrongUpdateReceived() {
LOG4CXX_AUTO_TRACE(logger_);
update_status_thread_delegate_->updateTimeOut(0); // Stop Timer
@@ -119,21 +134,29 @@ void UpdateStatusManager::OnResetRetrySequence() {
ProcessEvent(kOnResetRetrySequence);
}
+void UpdateStatusManager::OnExistedApplicationAdded(
+ const bool is_update_required) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (is_update_required) {
+ current_status_.reset(new UpToDateStatus());
+ ProcessEvent(kScheduleUpdate);
+ }
+}
+
void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) {
LOG4CXX_AUTO_TRACE(logger_);
if (kDeviceAllowed != consent) {
+ LOG4CXX_DEBUG(logger_, "Application registered from non-consented device");
app_registered_from_non_consented_device_ = true;
return;
}
+ LOG4CXX_DEBUG(logger_, "Application registered from consented device");
app_registered_from_non_consented_device_ = false;
- ProcessEvent(kOnNewAppRegistered);
-}
-
-void UpdateStatusManager::OnPolicyInit(bool is_update_required) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (is_update_required) {
+ if (kOnResetRetrySequence == last_processed_event_) {
current_status_.reset(new UpToDateStatus());
ProcessEvent(kScheduleUpdate);
+ } else {
+ ProcessEvent(kOnNewAppRegistered);
}
}
@@ -153,10 +176,17 @@ bool UpdateStatusManager::IsUpdatePending() const {
}
void UpdateStatusManager::ScheduleUpdate() {
+ LOG4CXX_AUTO_TRACE(logger_);
ProcessEvent(kScheduleUpdate);
}
+void UpdateStatusManager::PendingUpdate() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ProcessEvent(kPendingUpdate);
+}
+
void UpdateStatusManager::ScheduleManualUpdate() {
+ LOG4CXX_AUTO_TRACE(logger_);
ProcessEvent(kScheduleManualUpdate);
}
@@ -191,7 +221,10 @@ void UpdateStatusManager::DoTransition() {
current_status_ = next_status_;
next_status_.reset();
- if (last_processed_event_ != kScheduleManualUpdate) {
+ const bool is_update_pending =
+ policy::StatusProcessingSnapshot == current_status_->get_status();
+
+ if (last_processed_event_ != kScheduleManualUpdate && !is_update_pending) {
listener_->OnUpdateStatusChanged(current_status_->get_status_string());
}
@@ -210,7 +243,6 @@ UpdateStatusManager::UpdateThreadDelegate::UpdateThreadDelegate(
UpdateStatusManager* update_status_manager)
: timeout_(0)
, stop_flag_(false)
- , state_lock_(true)
, update_status_manager_(update_status_manager) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Create UpdateThreadDelegate");
diff --git a/src/components/policy/policy_external/src/usage_statistics/counter.cc b/src/components/policy/policy_external/src/usage_statistics/counter.cc
index 661ea29704..5165c46edb 100644
--- a/src/components/policy/policy_external/src/usage_statistics/counter.cc
+++ b/src/components/policy/policy_external/src/usage_statistics/counter.cc
@@ -33,16 +33,16 @@
#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_STATISTICS_MANAGER_H_
#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_STATISTICS_MANAGER_H_
-#include <cassert>
#include "policy/usage_statistics/counter.h"
+#include <cassert>
#include "utils/date_time.h"
-#include "utils/make_shared.h"
+
#include "utils/timer_task_impl.h"
namespace usage_statistics {
GlobalCounter::GlobalCounter(
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager,
GlobalCounterId counter_type)
: counter_type_(counter_type), statistics_manager_(statistics_manager) {}
@@ -53,7 +53,7 @@ void GlobalCounter::operator++() const {
}
AppCounter::AppCounter(
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager,
const std::string& app_id,
AppCounterId counter_type)
: app_id_(app_id)
@@ -67,7 +67,7 @@ void AppCounter::operator++() const {
}
AppInfo::AppInfo(
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager,
const std::string& app_id,
AppInfoId info_type)
: app_id_(app_id)
@@ -81,7 +81,7 @@ void AppInfo::Update(const std::string& new_info) const {
}
AppStopwatchImpl::AppStopwatchImpl(
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager,
const std::string& app_id)
: app_id_(app_id)
, stopwatch_type_(SECONDS_HMI_NONE)
@@ -92,7 +92,7 @@ AppStopwatchImpl::AppStopwatchImpl(
, time_out_(60) {}
AppStopwatchImpl::AppStopwatchImpl(
- utils::SharedPtr<StatisticsManager> statistics_manager,
+ std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id,
uint32_t timeout)
: app_id_(app_id)
@@ -107,8 +107,7 @@ AppStopwatchImpl::~AppStopwatchImpl() {}
void AppStopwatchImpl::Start(AppStopwatchId stopwatch_type) {
stopwatch_type_ = stopwatch_type;
- timer_.Start(time_out_ * date_time::DateTime::MILLISECONDS_IN_SECOND,
- timer::kPeriodic);
+ timer_.Start(time_out_ * date_time::MILLISECONDS_IN_SECOND, timer::kPeriodic);
}
void AppStopwatchImpl::Switch(AppStopwatchId stopwatch_type) {
diff --git a/src/components/policy/policy_external/test/CMakeLists.txt b/src/components/policy/policy_external/test/CMakeLists.txt
index 8b77c90dd2..77b1b35973 100644
--- a/src/components/policy/policy_external/test/CMakeLists.txt
+++ b/src/components/policy/policy_external/test/CMakeLists.txt
@@ -42,7 +42,7 @@ include_directories(
set(testLibraries
gmock
Utils
- Policy
+ PolicyStatic
UsageStatistics
ConfigProfile
)
diff --git a/src/components/policy/policy_external/test/counter_test.cc b/src/components/policy/policy_external/test/counter_test.cc
index 90f247de31..af166f96ad 100644
--- a/src/components/policy/policy_external/test/counter_test.cc
+++ b/src/components/policy/policy_external/test/counter_test.cc
@@ -28,12 +28,13 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+
+#include "policy/usage_statistics/counter.h"
#include "gtest/gtest.h"
#include "policy/usage_statistics/mock_statistics_manager.h"
-#include "policy/usage_statistics/counter.h"
-using ::testing::StrictMock;
using ::testing::InSequence;
+using ::testing::StrictMock;
namespace test {
namespace components {
@@ -45,7 +46,7 @@ TEST(
StatisticsManagerIncrementMethod1Arg,
GlobalCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
GlobalCounter reboots_counter(msm, SYNC_REBOOTS);
// Assert
@@ -59,7 +60,7 @@ TEST(
StatisticsManagerIncrementMethod1Arg,
GlobalCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
GlobalCounter reboots_counter(msm, SYNC_REBOOTS);
// Assert
@@ -74,7 +75,7 @@ TEST(
StatisticsManagerIncrementMethod2Args,
AppCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS);
// Assert
@@ -88,7 +89,7 @@ TEST(
StatisticsManagerIncrementMethod2Args,
AppCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS);
// Assert
@@ -102,7 +103,7 @@ TEST(
TEST(StatisticsManagerSetMethod,
AppInfoUpdateMethod_CallONCE_StatisticsManagerSetMethodCalledONCE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI);
// Assert
@@ -115,7 +116,7 @@ TEST(StatisticsManagerSetMethod,
TEST(StatisticsManagerSetMethod,
AppInfoUpdateMethod_CallTWICE_StatisticsManagerSetMethodCalledTWICE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI);
// Assert
@@ -130,7 +131,7 @@ TEST(StatisticsManagerSetMethod,
TEST(StatisticsManagerAddMethod,
AppStopwatchStartMethod_CallONCE_StatisticsManagerAddMethodCalledONCE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
const std::uint32_t time_out = 1;
AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out);
@@ -145,7 +146,7 @@ TEST(StatisticsManagerAddMethod,
TEST(StatisticsManagerAddMethod,
AppStopwatchSwitchMethod_Call_StatisticsManagerAddMethodCalled) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp");
hmi_full_stopwatch.Start(SECONDS_HMI_FULL);
@@ -161,7 +162,7 @@ TEST(
StatisticsManagerAddMethod,
AppStopwatchSwitchMethod_CallAnd1SecSleepAfter_StatisticsManagerAddMethodCalledWith1SecTimespan) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
const std::uint32_t time_out = 1;
AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out);
@@ -178,6 +179,6 @@ TEST(
// Act
hmi_full_stopwatch.WriteTime();
}
-} // namespace usage_statistics
-} // components
+} // namespace usage_statistics_test
+} // namespace components
} // namespace test
diff --git a/src/components/policy/policy_external/test/generated_code_test.cc b/src/components/policy/policy_external/test/generated_code_test.cc
index 15d14e3e3b..03cfae511b 100644
--- a/src/components/policy/policy_external/test/generated_code_test.cc
+++ b/src/components/policy/policy_external/test/generated_code_test.cc
@@ -51,8 +51,9 @@ TEST(PolicyGeneratedCodeTest, TestValidPTPreloadJsonIsValid) {
std::ifstream json_file("json/sdl_preloaded_pt.json");
ASSERT_TRUE(json_file.is_open());
Json::Value valid_table;
- Json::Reader reader;
- ASSERT_TRUE(reader.parse(json_file, valid_table));
+ Json::CharReaderBuilder reader_builder;
+ ASSERT_TRUE(
+ Json::parseFromStream(reader_builder, json_file, &valid_table, nullptr));
Table table(&valid_table);
table.SetPolicyTableType(rpc::policy_table_interface_base::PT_PRELOADED);
ASSERT_RPCTYPE_VALID(table);
@@ -62,8 +63,9 @@ TEST(PolicyGeneratedCodeTest, TestValidPTUpdateJsonIsValid) {
std::ifstream json_file("json/valid_sdl_pt_update.json");
ASSERT_TRUE(json_file.is_open());
Json::Value valid_table;
- Json::Reader reader;
- ASSERT_TRUE(reader.parse(json_file, valid_table));
+ Json::CharReaderBuilder reader_builder;
+ ASSERT_TRUE(
+ Json::parseFromStream(reader_builder, json_file, &valid_table, nullptr));
Table table(&valid_table);
table.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
ASSERT_RPCTYPE_VALID(table);
diff --git a/src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h b/src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h
index 3225e79e01..b307270b10 100644
--- a/src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h
+++ b/src/components/policy/policy_external/test/include/policy/mock_pt_ext_representation.h
@@ -37,10 +37,10 @@
#include "gmock/gmock.h"
+#include "mock_pt_representation.h"
+#include "policy/policy_table/types.h"
#include "policy/pt_ext_representation.h"
#include "rpc_base/rpc_base.h"
-#include "policy/policy_table/types.h"
-#include "mock_pt_representation.h"
namespace policy_table = ::rpc::policy_table_interface_base;
diff --git a/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h b/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h
index 995c63ed20..0b3fe7aef7 100644
--- a/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h
+++ b/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h
@@ -37,9 +37,9 @@
#include "gmock/gmock.h"
+#include "policy/policy_table/types.h"
#include "policy/pt_representation.h"
#include "rpc_base/rpc_base.h"
-#include "policy/policy_table/types.h"
namespace policy_table = ::rpc::policy_table_interface_base;
@@ -66,7 +66,6 @@ class MockPTRepresentation : virtual public ::policy::PTRepresentation {
MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>* seconds));
MOCK_METHOD2(GetPriority,
bool(const std::string& app_id, std::string* priority));
- MOCK_CONST_METHOD0(GetVehicleInfo, const ::policy::VehicleInfo());
MOCK_METHOD1(SetVINValue, bool(const std::string& value));
MOCK_METHOD2(GetUserFriendlyMsg,
std::vector< ::policy::UserFriendlyMessage>(
@@ -78,7 +77,7 @@ class MockPTRepresentation : virtual public ::policy::PTRepresentation {
MOCK_METHOD0(Close, bool());
MOCK_METHOD0(Clear, bool());
MOCK_METHOD0(Drop, bool());
- MOCK_CONST_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>());
+ MOCK_CONST_METHOD0(GenerateSnapshot, std::shared_ptr<policy_table::Table>());
MOCK_METHOD1(Save, bool(const policy_table::Table& table));
MOCK_CONST_METHOD0(UpdateRequired, bool());
MOCK_METHOD1(SaveUpdateRequired, void(bool value));
diff --git a/src/components/policy/policy_external/test/include/policy/mock_update_status_manager.h b/src/components/policy/policy_external/test/include/policy/mock_update_status_manager.h
index a1c808d23a..662632fc59 100644
--- a/src/components/policy/policy_external/test/include/policy/mock_update_status_manager.h
+++ b/src/components/policy/policy_external/test/include/policy/mock_update_status_manager.h
@@ -33,7 +33,6 @@
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_TEST_INCLUDE_POLICY_MOCK_UPDATE_STATUS_MANAGER_H_
#include "gmock/gmock.h"
-
#include "policy/update_status_manager.h"
namespace test {
@@ -49,8 +48,8 @@ class MockUpdateStatusManager : public ::policy::UpdateStatusManager {
MOCK_METHOD0(OnWrongUpdateReceived, void());
MOCK_METHOD1(OnResetDefaultPT, void(bool is_update_required));
MOCK_METHOD0(OnResetRetrySequence, void());
+ MOCK_METHOD1(OnExistedApplicationAdded, void(const bool is_update_required));
MOCK_METHOD1(OnNewApplicationAdded, void(const DeviceConsent));
- MOCK_METHOD1(OnPolicyInit, void(bool is_update_required));
MOCK_METHOD0(GetUpdateStatus, PolicyTableStatus());
};
diff --git a/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h b/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h
index e753751308..40b57f9ed3 100644
--- a/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h
+++ b/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h
@@ -40,21 +40,22 @@
#include "policy/policy_manager_impl.h"
#include "policy/mock_cache_manager.h"
-#include "policy/mock_update_status_manager.h"
#include "policy/mock_policy_listener.h"
#include "policy/mock_policy_settings.h"
+#include "policy/mock_ptu_retry_handler.h"
+#include "policy/mock_update_status_manager.h"
namespace test {
namespace components {
namespace policy_test {
-using ::testing::NiceMock;
using ::policy::PolicyManagerImpl;
+using ::testing::NiceMock;
typedef std::multimap<std::string, policy_table::Rpcs&>
UserConsentPromptToRpcsConnections;
-typedef utils::SharedPtr<policy_table::Table> PolicyTableSPtr;
+typedef std::shared_ptr<policy_table::Table> PolicyTableSPtr;
namespace {
const std::string kSdlPreloadedPtJson = "json/sdl_preloaded_pt.json";
@@ -112,9 +113,11 @@ class PolicyManagerImplTest : public ::testing::Test {
const std::string unpaired_device_id_;
PolicyManagerImpl* policy_manager_;
- MockCacheManagerInterface* cache_manager_;
+ NiceMock<MockCacheManagerInterface>* cache_manager_;
MockUpdateStatusManager update_manager_;
NiceMock<MockPolicyListener> listener_;
+ NiceMock<MockPTURetryHandler> ptu_retry_handler_;
+ PolicyTableSPtr default_pt_snapshot_;
void SetUp() OVERRIDE;
@@ -140,6 +143,7 @@ class PolicyManagerImplTest2 : public ::testing::Test {
PolicyManagerImpl* policy_manager_;
NiceMock<MockPolicyListener> listener_;
+ NiceMock<MockPTURetryHandler> ptu_retry_handler_;
::policy::StringArray hmi_level_;
::policy::StringArray pt_request_types_;
size_t ptu_request_types_size_;
@@ -203,7 +207,7 @@ class PolicyManagerImplTest2 : public ::testing::Test {
void EmulatePTAppRevoked(const std::string& ptu_name);
- utils::SharedPtr<policy_table::Table> PreconditionForBasicValidateSnapshot();
+ std::shared_ptr<policy_table::Table> PreconditionForBasicValidateSnapshot();
template <typename ParentType, typename Value>
bool IsKeyExisted(const ParentType& parent, const Value& value) const {
@@ -236,7 +240,7 @@ class PolicyManagerImplTest_RequestTypes : public ::testing::Test {
const std::string app_storage_folder_;
const std::string preloaded_pt_filename_;
- utils::SharedPtr<PolicyManagerImpl> policy_manager_impl_sptr_;
+ std::shared_ptr<PolicyManagerImpl> policy_manager_impl_sptr_;
NiceMock<MockPolicyListener> listener_;
NiceMock<policy_handler_test::MockPolicySettings> policy_settings_;
diff --git a/src/components/policy/policy_external/test/json/PTU.json b/src/components/policy/policy_external/test/json/PTU.json
index 5209030eec..c5f4b90120 100644
--- a/src/components/policy/policy_external/test/json/PTU.json
+++ b/src/components/policy/policy_external/test/json/PTU.json
@@ -403,6 +403,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -419,6 +420,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -435,6 +437,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -451,6 +454,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -481,6 +485,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -505,6 +510,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -529,6 +535,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -552,6 +559,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU2.json b/src/components/policy/policy_external/test/json/PTU2.json
index 30746123d4..01cca4a6fd 100644
--- a/src/components/policy/policy_external/test/json/PTU2.json
+++ b/src/components/policy/policy_external/test/json/PTU2.json
@@ -403,6 +403,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -419,6 +420,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -435,6 +437,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -451,6 +454,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -481,6 +485,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -505,6 +510,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -529,6 +535,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -552,6 +559,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU3.json b/src/components/policy/policy_external/test/json/PTU3.json
index f3bd615c73..f48f246114 100644
--- a/src/components/policy/policy_external/test/json/PTU3.json
+++ b/src/components/policy/policy_external/test/json/PTU3.json
@@ -403,6 +403,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -419,6 +420,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -435,6 +437,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -451,6 +454,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -481,6 +485,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -505,6 +510,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -529,6 +535,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -552,6 +559,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json b/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json
index 6db3836e4a..1e99e7442c 100644
--- a/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json
+++ b/src/components/policy/policy_external/test/json/PTU_with_empty_requestType_array.json
@@ -1438,6 +1438,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1450,6 +1451,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1462,6 +1464,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1474,6 +1477,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1601,6 +1605,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1619,6 +1624,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1637,6 +1643,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1654,6 +1661,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json b/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json
index 22f7bd2930..dc40c3a182 100644
--- a/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json
+++ b/src/components/policy/policy_external/test/json/PTU_with_invalid_requestType_between_correct.json
@@ -1441,6 +1441,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1453,6 +1454,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1465,6 +1467,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1477,6 +1480,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1604,6 +1608,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1622,6 +1627,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1640,6 +1646,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1657,6 +1664,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json b/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json
index 83a2b308bb..3fcc71ca72 100644
--- a/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json
+++ b/src/components/policy/policy_external/test/json/PTU_with_one_invalid_requestType.json
@@ -1438,6 +1438,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1450,6 +1451,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1462,6 +1464,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1474,6 +1477,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1601,6 +1605,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1619,6 +1624,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1637,6 +1643,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1654,6 +1661,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json b/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json
index 8509935752..03a5e8d203 100644
--- a/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json
+++ b/src/components/policy/policy_external/test/json/PTU_without_requestType_field.json
@@ -1437,6 +1437,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1449,6 +1450,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1461,6 +1463,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1473,6 +1476,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1600,6 +1604,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1618,6 +1623,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1636,6 +1642,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1653,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json
index 4d99dfbc35..b5dd0bfff5 100644
--- a/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json
+++ b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_reqestType_between_valid.json
@@ -296,6 +296,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -308,6 +309,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -320,6 +322,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -332,6 +335,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -358,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -378,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -398,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -417,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json
index aeed9655e1..8fa8e6f3d0 100644
--- a/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json
+++ b/src/components/policy/policy_external/test/json/preloadedPT_with_invalid_default_requestType.json
@@ -296,6 +296,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -308,6 +309,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -320,6 +322,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -332,6 +335,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -358,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -378,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -398,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -417,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json b/src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json
index 2e99c6c8ee..589cdc7a81 100644
--- a/src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json
+++ b/src/components/policy/policy_external/test/json/preloadedPT_with_several_invalid_default_requestTypes.json
@@ -296,6 +296,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -308,6 +309,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -320,6 +322,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -332,6 +335,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -358,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -378,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -398,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -417,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_external/test/json/ptu2_requestType.json b/src/components/policy/policy_external/test/json/ptu2_requestType.json
index 9a6ad3720d..9b580b2a08 100644
--- a/src/components/policy/policy_external/test/json/ptu2_requestType.json
+++ b/src/components/policy/policy_external/test/json/ptu2_requestType.json
@@ -415,6 +415,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -431,6 +432,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -447,6 +449,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -463,6 +466,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -493,6 +497,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -517,6 +522,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -541,6 +547,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -564,6 +571,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/ptu_requestType.json b/src/components/policy/policy_external/test/json/ptu_requestType.json
index 87fcf17aee..8d18a9e336 100644
--- a/src/components/policy/policy_external/test/json/ptu_requestType.json
+++ b/src/components/policy/policy_external/test/json/ptu_requestType.json
@@ -414,6 +414,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -430,6 +431,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -446,6 +448,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -462,6 +465,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -492,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -516,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -540,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -563,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json
index 7f5436b5b6..ad264c8518 100644
--- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json
+++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt.json
@@ -297,6 +297,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -309,6 +310,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -321,6 +323,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -333,6 +336,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -359,6 +363,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -379,6 +384,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -399,6 +405,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -418,6 +425,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json
index 37e0476683..909fd2cb2f 100644
--- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json
+++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt1.json
@@ -2051,6 +2051,7 @@
[
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -2065,6 +2066,7 @@
[
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -2079,6 +2081,7 @@
[
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -2093,6 +2096,7 @@
[
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -2317,6 +2321,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -2339,6 +2344,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -2361,6 +2367,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -2382,6 +2389,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json
index 2a503ab4a1..87fac7c76c 100644
--- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json
+++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_send_location.json
@@ -415,6 +415,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -431,6 +432,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -447,6 +449,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -463,6 +466,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -493,6 +497,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -517,6 +522,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -541,6 +547,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -564,6 +571,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_pt_first_update.json b/src/components/policy/policy_external/test/json/sdl_pt_first_update.json
index d28f70379c..440963ba48 100644
--- a/src/components/policy/policy_external/test/json/sdl_pt_first_update.json
+++ b/src/components/policy/policy_external/test/json/sdl_pt_first_update.json
@@ -1431,6 +1431,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1443,6 +1444,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1455,6 +1457,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1467,6 +1470,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1618,6 +1622,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1636,6 +1641,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1654,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1671,6 +1678,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_pt_second_update.json b/src/components/policy/policy_external/test/json/sdl_pt_second_update.json
index 7bf287671e..5900acbcfb 100644
--- a/src/components/policy/policy_external/test/json/sdl_pt_second_update.json
+++ b/src/components/policy/policy_external/test/json/sdl_pt_second_update.json
@@ -1431,6 +1431,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1443,6 +1444,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1455,6 +1457,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1467,6 +1470,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1618,6 +1622,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1636,6 +1641,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1654,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1671,6 +1678,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_pt_update.json b/src/components/policy/policy_external/test/json/sdl_pt_update.json
index 6b130c8f60..b3affeb91d 100644
--- a/src/components/policy/policy_external/test/json/sdl_pt_update.json
+++ b/src/components/policy/policy_external/test/json/sdl_pt_update.json
@@ -1431,6 +1431,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1443,6 +1444,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1455,6 +1457,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1467,6 +1470,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1602,6 +1606,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1620,6 +1625,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1638,6 +1644,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1655,6 +1662,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json
index be177335fe..639d0143c8 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_have_params.json
@@ -414,6 +414,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -430,6 +431,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -446,6 +448,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -462,6 +465,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -492,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -516,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -540,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -563,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json
index 58e3f2fad3..53216cab3d 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1.json
@@ -414,6 +414,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -430,6 +431,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -446,6 +448,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -462,6 +465,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -492,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -516,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -540,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -563,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json
index 4b10f8c80b..a529dc9a3b 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json
@@ -414,6 +414,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -430,6 +431,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -446,6 +448,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -462,6 +465,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -492,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -516,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -540,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -563,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json
index 7728b69a0b..a57791e248 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location.json
@@ -414,6 +414,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -430,6 +431,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -446,6 +448,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -462,6 +465,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -492,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -516,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -540,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -563,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json
index aaa7664d06..5a633e7c95 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_all_params.json
@@ -414,6 +414,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -430,6 +431,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -446,6 +448,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -462,6 +465,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -492,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -516,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -540,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -563,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json
index 079892677d..86c121491b 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_no_params.json
@@ -414,6 +414,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -430,6 +431,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -446,6 +448,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -462,6 +465,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -492,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -516,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -540,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -563,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json
index 82048d21e6..2b57912016 100644
--- a/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json
+++ b/src/components/policy/policy_external/test/json/sdl_update_pt_send_location_some_params.json
@@ -414,6 +414,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -430,6 +431,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -446,6 +448,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -462,6 +465,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -492,6 +496,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -516,6 +521,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -540,6 +546,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -563,6 +570,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/json/valid_sdl_pt_update.json b/src/components/policy/policy_external/test/json/valid_sdl_pt_update.json
index 81521a2e0b..acf18c5706 100644
--- a/src/components/policy/policy_external/test/json/valid_sdl_pt_update.json
+++ b/src/components/policy/policy_external/test/json/valid_sdl_pt_update.json
@@ -20,7 +20,13 @@
"nicknames" : [ "SyncProxyTester" ],
"priority" : "EMERGENCY",
"steal_focus" : true,
- "heart_beat_timeout_ms": 5000
+ "heart_beat_timeout_ms": 5000,
+ "app_services": {
+ "MEDIA": {
+ "service_names" : ["SDL App", "SDL Music"],
+ "handled_rpcs" : [{"function_id": 41}]
+ }
+ }
},
"default" : {
"default_hmi" : "NONE",
@@ -1431,6 +1437,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1443,6 +1450,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1455,6 +1463,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1467,6 +1476,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1594,6 +1604,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1612,6 +1623,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1630,6 +1642,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1647,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc
index 947bb5d3ad..d5be757139 100644
--- a/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc
+++ b/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc
@@ -30,19 +30,19 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <stdint.h>
#include <fstream>
#include <string>
#include <vector>
-#include <stdint.h>
#include "gtest/gtest.h"
#include "policy/policy_manager_impl_test_base.h"
#include "policy/policy_table/types.h"
+#include "json/reader.h"
#include "utils/date_time.h"
#include "utils/gen_hash.h"
-#include "json/reader.h"
namespace test {
namespace components {
@@ -92,7 +92,8 @@ TEST_F(PolicyManagerImplTest,
EXPECT_CALL(*cache_manager_, IsApplicationRepresented(_))
.WillOnce(Return(true));
EXPECT_EQ(policy_manager_->GetPolicyTableStatus(), "UP_TO_DATE");
- policy_manager_->AddApplication(kDefaultId,
+ policy_manager_->AddApplication(kDefaultDeviceMacAddress,
+ kDefaultId,
HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_EQ(policy_manager_->GetPolicyTableStatus(), "UP_TO_DATE");
}
@@ -109,31 +110,34 @@ TEST_F(PolicyManagerImplTest2, GetNotificationsNumberAfterPTUpdate) {
// Act
std::string json = table.toStyledString();
::policy::BinaryMessage msg(json.begin(), json.end());
- EXPECT_CALL(listener_, OnUpdateStatusChanged(_));
- EXPECT_TRUE(policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT(kFilePtUpdateJson, msg));
EXPECT_FALSE(policy_manager_->GetCache()->IsPTPreloaded());
- std::string priority = "emergency";
+ EXPECT_CALL(listener_, OnUpdateStatusChanged(_));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+
+ std::string priority = "EMERGENCY";
uint32_t notif_number = policy_manager_->GetNotificationsNumber(priority);
EXPECT_EQ(1u, notif_number);
- priority = "navigation";
+ priority = "NAVIGATION";
notif_number = policy_manager_->GetNotificationsNumber(priority);
EXPECT_EQ(2u, notif_number);
- priority = "emergency";
+ priority = "EMERGENCY";
notif_number = policy_manager_->GetNotificationsNumber(priority);
EXPECT_EQ(1u, notif_number);
- priority = "VOICECOMM";
+ priority = "VOICECOM";
notif_number = policy_manager_->GetNotificationsNumber(priority);
EXPECT_EQ(3u, notif_number);
- priority = "normal";
+ priority = "NORMAL";
notif_number = policy_manager_->GetNotificationsNumber(priority);
EXPECT_EQ(5u, notif_number);
- priority = "none";
+ priority = "NONE";
notif_number = policy_manager_->GetNotificationsNumber(priority);
EXPECT_EQ(6u, notif_number);
}
@@ -142,15 +146,15 @@ TEST_F(PolicyManagerImplTest2, IsAppRevoked_SetRevokedAppID_ExpectAppRevoked) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
std::ifstream ifile(kValidSdlPtUpdateJson);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
if (ifile.is_open()) {
- if (reader.parse(ifile, root, true)) {
+ if (Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
root["policy_table"]["app_policies"][app_id_1_] = Json::nullValue;
json = root.toStyledString();
}
@@ -158,7 +162,10 @@ TEST_F(PolicyManagerImplTest2, IsAppRevoked_SetRevokedAppID_ExpectAppRevoked) {
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
- ASSERT_TRUE(policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+
EXPECT_FALSE(policy_manager_->GetCache()->IsPTPreloaded());
CheckRpcPermissions(
app_id_1_, "UnregisterAppInterface", ::policy::kRpcDisallowed);
@@ -174,8 +181,8 @@ TEST_F(PolicyManagerImplTest2, AppRevokedOne_AppRegistered) {
EXPECT_FALSE(policy_manager_->GetCache()->IsPTPreloaded());
ASSERT_TRUE(
(policy_manager_->GetCache())->AddDevice(device_id_2_, "Bluetooth"));
- policy_manager_->AddApplication(application_id_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_2_, application_id_, HmiTypes(policy_table::AHT_DEFAULT));
// Registration is allowed
CheckRpcPermissions("RegisterAppInterface", ::policy::kRpcAllowed);
}
@@ -187,12 +194,13 @@ TEST_F(PolicyManagerImplTest2, AppRevokedOne_AppRegistered_HMIDefault) {
EmulatePTAppRevoked(kPtu2Json);
EXPECT_FALSE(policy_manager_->GetCache()->IsPTPreloaded());
- policy_manager_->AddApplication(application_id_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, application_id_, HmiTypes(policy_table::AHT_DEFAULT));
std::string default_hmi;
// Default HMI level is NONE
- EXPECT_TRUE(policy_manager_->GetDefaultHmi(application_id_, &default_hmi));
+ EXPECT_TRUE(policy_manager_->GetDefaultHmi(
+ device_id_1_, application_id_, &default_hmi));
EXPECT_EQ("NONE", default_hmi);
}
@@ -210,12 +218,18 @@ TEST_F(PolicyManagerImplTest2,
"Life",
2,
"Bluetooth");
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_1_))
- .WillRepeatedly(Return(device_id_1_));
+
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(_, app_id_1_))
+ .Times(0);
+ ON_CALL(listener_, GetDevicesIds(_))
+ .WillByDefault(Return(transport_manager::DeviceList()));
+ ON_CALL(listener_, GetDevicesIds(app_id_1_))
+ .WillByDefault(Return(transport_manager::DeviceList(1, device_id_1_)));
+
policy_manager_->SetUserConsentForDevice(device_id_1_, true);
// Add app from consented device. App will be assigned with default policies
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
// Check before action
policy_table::RpcParameters rpc_parameters;
rpc_parameters.hmi_levels.push_back(policy_table::HL_FULL);
@@ -227,28 +241,31 @@ TEST_F(PolicyManagerImplTest2,
::policy::CheckPermissionResult output;
policy_manager_->CheckPermissions(
- app_id_1_, kHmiLevelFull, "Alert", input_params, output);
+ device_id_1_, app_id_1_, kHmiLevelFull, "Alert", input_params, output);
// Check RPC is allowed
EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
ASSERT_TRUE(output.list_of_allowed_params.empty());
// Act
std::ifstream ifile(kValidSdlPtUpdateJson);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
EXPECT_TRUE(ifile.is_open());
- EXPECT_TRUE(reader.parse(ifile, root, true));
+ EXPECT_TRUE(Json::parseFromStream(reader_builder, ifile, &root, nullptr));
root["policy_table"]["app_policies"][app_id_1_] = Json::nullValue;
json = root.toStyledString();
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
- ASSERT_TRUE(policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+
EXPECT_FALSE(cache->IsPTPreloaded());
policy_manager_->CheckPermissions(
- app_id_1_, kHmiLevelFull, "Alert", input_params, output);
+ device_id_1_, app_id_1_, kHmiLevelFull, "Alert", input_params, output);
// Check RPC is disallowed
EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
ASSERT_TRUE(output.list_of_allowed_params.empty());
@@ -269,18 +286,25 @@ TEST_F(PolicyManagerImplTest2,
"Life",
2,
"Bluetooth"));
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(application_id_))
- .WillRepeatedly(Return(device_id_1_));
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(_, application_id_))
+ .Times(0);
+
+ ON_CALL(listener_, GetDevicesIds(_))
+ .WillByDefault(Return(transport_manager::DeviceList()));
+ ON_CALL(listener_, GetDevicesIds(app_id_1_))
+ .WillByDefault(Return(transport_manager::DeviceList(1, device_id_1_)));
+
policy_manager_->SetUserConsentForDevice(device_id_1_, true);
// Add app from consented device. App will be assigned with default policies
- policy_manager_->AddApplication(application_id_,
- HmiTypes(policy_table::AHT_MEDIA));
+ policy_manager_->AddApplication(
+ device_id_1_, application_id_, HmiTypes(policy_table::AHT_MEDIA));
// Emulate PTU with new policies for app added above
std::ifstream ifile(kValidSdlPtUpdateJson);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
// Add AppID with policies
root["policy_table"]["app_policies"][application_id_] =
Json::Value(Json::objectValue);
@@ -312,7 +336,10 @@ TEST_F(PolicyManagerImplTest2,
::policy::BinaryMessage msg(json.begin(), json.end());
// Load Json to cache
- EXPECT_TRUE(policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+
EXPECT_FALSE(cache->IsPTPreloaded());
policy_table::RpcParameters rpc_parameters;
@@ -323,8 +350,6 @@ TEST_F(PolicyManagerImplTest2,
::policy::RPCParams input_params;
::policy::CheckPermissionResult output;
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(application_id_))
- .WillOnce(Return(device_id_1_));
cache->AddDevice(device_id_1_, "Bluetooth");
cache->SetDeviceData(device_id_1_,
"hardware IPX",
@@ -334,8 +359,12 @@ TEST_F(PolicyManagerImplTest2,
"Life",
2,
"Bluetooth");
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelFull, "Alert", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelFull,
+ "Alert",
+ input_params,
+ output);
// Check RPC is allowed
EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
// Check list of parameters empty
@@ -344,21 +373,22 @@ TEST_F(PolicyManagerImplTest2,
TEST_F(PolicyManagerImplTest2,
CheckPermissions_NoParametersInPT_CheckRpcsInDifferentLevels) {
+ EXPECT_CALL(listener_, GetDevicesIds(application_id_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
// Arrange
AddSetDeviceData();
LoadPTUFromJsonFile("json/sdl_update_pt_send_location.json");
- // Will be called each time permissions are checked
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(application_id_))
- .Times(4)
- .WillRepeatedly(Return(device_id_1_));
-
// Check RPC in each level
::policy::RPCParams input_params;
::policy::CheckPermissionResult output;
// Rpc in FULL level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelFull, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelFull,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is allowed
EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
ASSERT_TRUE(output.list_of_allowed_params.empty());
@@ -367,8 +397,12 @@ TEST_F(PolicyManagerImplTest2,
ResetOutputList(output);
// Rpc in LIMITED level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelLimited, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelLimited,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is allowed
EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
ASSERT_TRUE(output.list_of_allowed_params.empty());
@@ -376,7 +410,8 @@ TEST_F(PolicyManagerImplTest2,
ResetOutputList(output);
// Rpc in BACKGROUND level
- policy_manager_->CheckPermissions(application_id_,
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
kHmiLevelBackground,
"SendLocation",
input_params,
@@ -388,8 +423,12 @@ TEST_F(PolicyManagerImplTest2,
ResetOutputList(output);
// Rpc in NONE level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelNone, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelNone,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is disallowed
EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
// Check list of parameters is empty
@@ -399,24 +438,25 @@ TEST_F(PolicyManagerImplTest2,
TEST_F(
PolicyManagerImplTest2,
CheckPermissions_ParamsNotAllowedInPT_AddAppWithAllParams_CheckRpcsInDiffLvls) {
+ EXPECT_CALL(listener_, GetDevicesIds(application_id_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
// Arrange
AddSetDeviceData();
// File have empty parameters, so they are forbidden
LoadPTUFromJsonFile("json/sdl_update_pt_send_location_no_params.json");
- // Will be called each time permissions are checked
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(application_id_))
- .Times(4)
- .WillRepeatedly(Return(device_id_1_));
-
// Check RPC in each level
::policy::RPCParams input_params;
InsertRpcParametersInList(input_params);
::policy::CheckPermissionResult output;
// Rpc in FULL level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelFull, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelFull,
+ "SendLocation",
+ input_params,
+ output);
// Group which has RPC does not require user consent, so its auto-allowed for
// user. Since RPC 'parameters' section is present, but empty, that means
@@ -431,8 +471,12 @@ TEST_F(
ResetOutputList(output);
// Rpc in LIMITED level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelLimited, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelLimited,
+ "SendLocation",
+ input_params,
+ output);
EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
@@ -443,7 +487,8 @@ TEST_F(
ResetOutputList(output);
// Rpc in BACKGROUND level
- policy_manager_->CheckPermissions(application_id_,
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
kHmiLevelBackground,
"SendLocation",
input_params,
@@ -459,8 +504,12 @@ TEST_F(
ResetOutputList(output);
// Rpc in NONE level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelNone, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelNone,
+ "SendLocation",
+ input_params,
+ output);
EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
@@ -472,6 +521,8 @@ TEST_F(
TEST_F(PolicyManagerImplTest2,
CheckPermissions_SomeParamsAllowedInPT_CheckRpcsInDiffLvls) {
+ EXPECT_CALL(listener_, GetDevicesIds(application_id_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
// Arrange
AddSetDeviceData();
@@ -479,19 +530,18 @@ TEST_F(PolicyManagerImplTest2,
//"locationDescription", "phoneNumber" are allowed
LoadPTUFromJsonFile("json/sdl_update_pt_send_location_some_params.json");
- // Will be called each time permissions are checked
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(application_id_))
- .Times(4)
- .WillRepeatedly(Return(device_id_1_));
-
// Check RPC in each level
::policy::RPCParams input_params;
InsertRpcParametersInList(input_params);
::policy::CheckPermissionResult output;
// Rpc in FULL level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelFull, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelFull,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is allowed
EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
@@ -520,8 +570,12 @@ TEST_F(PolicyManagerImplTest2,
output.list_of_undefined_params.clear();
// Rpc in LIMITED level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelLimited, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelLimited,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is allowed
EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
@@ -539,7 +593,8 @@ TEST_F(PolicyManagerImplTest2,
ResetOutputList(output);
// Rpc in BACKGROUND level
- policy_manager_->CheckPermissions(application_id_,
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
kHmiLevelBackground,
"SendLocation",
input_params,
@@ -559,8 +614,12 @@ TEST_F(PolicyManagerImplTest2,
ResetOutputList(output);
// Rpc in NONE level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelNone, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelNone,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is disallowed
EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
// Check lists of parameters are empty
@@ -585,10 +644,12 @@ TEST_F(PolicyManagerImplTest2, GetCorrectStatus_PTUSuccessful) {
CreateLocalPT(preloaded_pt_filename_);
// Check
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
+ EXPECT_CALL(listener_, GetDevicesIds(application_id_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
// Adding changes PT status
- policy_manager_->AddApplication(application_id_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, application_id_, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
// Before load PT we should send notification about start updating
policy_manager_->OnUpdateStarted();
@@ -613,6 +674,8 @@ TEST_F(PolicyManagerImplTest2,
TEST_F(PolicyManagerImplTest2,
CheckPermissions_DiffParamsAllowedInGroups_CheckRpcsInDiffLvls) {
+ EXPECT_CALL(listener_, GetDevicesIds(application_id_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
// Arrange
AddSetDeviceData();
// Load Json to cache
@@ -621,19 +684,18 @@ TEST_F(PolicyManagerImplTest2,
// Allowed both groups of parameters
LoadPTUFromJsonFile("json/sdl_update_pt_2_groups_have_params.json");
- // Will be called each time permissions are checked
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(application_id_))
- .Times(4)
- .WillRepeatedly(Return(device_id_1_));
-
// Check RPC in each level
::policy::RPCParams input_params;
InsertRpcParametersInList(input_params);
::policy::CheckPermissionResult output;
// Rpc in FULL level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelFull, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelFull,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is allowed
EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
// Check list of allowed parameters is not empty
@@ -652,8 +714,12 @@ TEST_F(PolicyManagerImplTest2,
ResetOutputList(output);
// Rpc in LIMITED level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelLimited, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelLimited,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is allowed
EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
// Check list of allowed parameters is not empty
@@ -672,7 +738,8 @@ TEST_F(PolicyManagerImplTest2,
ResetOutputList(output);
// Rpc in BACKGROUND level
- policy_manager_->CheckPermissions(application_id_,
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
kHmiLevelBackground,
"SendLocation",
input_params,
@@ -696,8 +763,12 @@ TEST_F(PolicyManagerImplTest2,
ResetOutputList(output);
// Rpc in NONE level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelNone, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelNone,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is disallowed
EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
// Check lists of parameters are empty
@@ -726,27 +797,28 @@ TEST_F(PolicyManagerImplTest2,
2,
"Bluetooth"));
+ EXPECT_CALL(listener_, GetDevicesIds(application_id_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
// Add app from consented device. App will be assigned with default policies
- policy_manager_->AddApplication(application_id_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->SetUserConsentForDevice(device_id_1_, true);
+ policy_manager_->AddApplication(
+ device_id_1_, application_id_, HmiTypes(policy_table::AHT_DEFAULT));
std::ifstream ifile("json/sdl_update_pt_2_groups_no_params_in1.json");
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
if (ifile.is_open()) {
- reader.parse(ifile, root, true);
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr);
}
json = root.toStyledString();
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
- EXPECT_TRUE(policy_manager_->LoadPT(kFilePtUpdateJson, msg));
- EXPECT_FALSE(cache->IsPTPreloaded());
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
- // Will be called each time permissions are checked
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(application_id_))
- .Times(4)
- .WillRepeatedly(Return(device_id_1_));
+ EXPECT_FALSE(cache->IsPTPreloaded());
// Check RPC in each level
::policy::RPCParams input_params;
@@ -754,39 +826,52 @@ TEST_F(PolicyManagerImplTest2,
::policy::CheckPermissionResult output;
// Rpc in FULL level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelFull, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelFull,
+ "SendLocation",
+ input_params,
+ output);
- EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
- EXPECT_TRUE(output.list_of_allowed_params.empty());
- EXPECT_EQ(10u, output.list_of_undefined_params.size());
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ EXPECT_TRUE(output.list_of_undefined_params.empty());
+ EXPECT_EQ(10u, output.list_of_allowed_params.size());
ResetOutputList(output);
// Rpc in LIMITED level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelLimited, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelLimited,
+ "SendLocation",
+ input_params,
+ output);
- EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
- EXPECT_TRUE(output.list_of_allowed_params.empty());
- EXPECT_EQ(10u, output.list_of_undefined_params.size());
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ EXPECT_TRUE(output.list_of_undefined_params.empty());
+ EXPECT_EQ(10u, output.list_of_allowed_params.size());
ResetOutputList(output);
// Rpc in BACKGROUND level
- policy_manager_->CheckPermissions(application_id_,
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
kHmiLevelBackground,
"SendLocation",
input_params,
output);
- EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
- EXPECT_TRUE(output.list_of_allowed_params.empty());
- EXPECT_EQ(10u, output.list_of_undefined_params.size());
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ EXPECT_TRUE(output.list_of_undefined_params.empty());
+ EXPECT_EQ(10u, output.list_of_allowed_params.size());
// Reset output
ResetOutputList(output);
// Rpc in NONE level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelNone, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelNone,
+ "SendLocation",
+ input_params,
+ output);
EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
EXPECT_TRUE(output.list_of_allowed_params.empty());
@@ -813,28 +898,29 @@ TEST_F(PolicyManagerImplTest2,
2,
"Bluetooth"));
+ EXPECT_CALL(listener_, GetDevicesIds(application_id_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
// Add app from consented device. App will be assigned with default policies
- policy_manager_->AddApplication(application_id_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->SetUserConsentForDevice(device_id_1_, true);
+ policy_manager_->AddApplication(
+ device_id_1_, application_id_, HmiTypes(policy_table::AHT_DEFAULT));
std::ifstream ifile(
"json/sdl_update_pt_2_groups_no_params_in1_omitted_in2.json");
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
if (ifile.is_open()) {
- reader.parse(ifile, root, true);
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr);
}
json = root.toStyledString();
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
- EXPECT_TRUE(policy_manager_->LoadPT(kFilePtUpdateJson, msg));
- EXPECT_FALSE(cache->IsPTPreloaded());
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
- // Will be called each time permissions are checked
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(application_id_))
- .Times(4)
- .WillRepeatedly(Return(device_id_1_));
+ EXPECT_FALSE(cache->IsPTPreloaded());
// Check RPC in each level
::policy::RPCParams input_params;
@@ -842,37 +928,50 @@ TEST_F(PolicyManagerImplTest2,
::policy::CheckPermissionResult output;
// Rpc in FULL level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelFull, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelFull,
+ "SendLocation",
+ input_params,
+ output);
- EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
- EXPECT_TRUE(output.list_of_allowed_params.empty());
- EXPECT_EQ(10u, output.list_of_undefined_params.size());
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ EXPECT_TRUE(output.list_of_undefined_params.empty());
+ EXPECT_EQ(10u, output.list_of_allowed_params.size());
ResetOutputList(output);
// Rpc in LIMITED level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelLimited, "SendLocation", input_params, output);
- EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
- EXPECT_TRUE(output.list_of_allowed_params.empty());
- EXPECT_EQ(10u, output.list_of_undefined_params.size());
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelLimited,
+ "SendLocation",
+ input_params,
+ output);
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ EXPECT_TRUE(output.list_of_undefined_params.empty());
+ EXPECT_EQ(10u, output.list_of_allowed_params.size());
ResetOutputList(output);
// Rpc in BACKGROUND level
- policy_manager_->CheckPermissions(application_id_,
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
kHmiLevelBackground,
"SendLocation",
input_params,
output);
- EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
- EXPECT_TRUE(output.list_of_allowed_params.empty());
- EXPECT_EQ(10u, output.list_of_undefined_params.size());
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ EXPECT_TRUE(output.list_of_undefined_params.empty());
+ EXPECT_EQ(10u, output.list_of_allowed_params.size());
// Reset output
ResetOutputList(output);
// Rpc in NONE level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelNone, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelNone,
+ "SendLocation",
+ input_params,
+ output);
EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
EXPECT_TRUE(output.list_of_allowed_params.empty());
EXPECT_TRUE(output.list_of_disallowed_params.empty());
@@ -881,6 +980,8 @@ TEST_F(PolicyManagerImplTest2,
TEST_F(PolicyManagerImplTest, LoadPT_SetInvalidUpdatePT_PTIsNotLoaded) {
// Arrange
+ EXPECT_CALL(*cache_manager_, GenerateSnapshot())
+ .WillOnce(Return(default_pt_snapshot_));
policy_manager_->ForcePTExchange();
policy_manager_->OnUpdateStarted();
Json::Value table(Json::objectValue);
@@ -895,17 +996,26 @@ TEST_F(PolicyManagerImplTest, LoadPT_SetInvalidUpdatePT_PTIsNotLoaded) {
std::string json = table.toStyledString();
::policy::BinaryMessage msg(json.begin(), json.end());
+ auto pt = std::make_shared<policy_table::Table>();
+ *pt = update;
+
// Assert
- EXPECT_CALL(*cache_manager_, GenerateSnapshot()).Times(0);
EXPECT_CALL(*cache_manager_, ApplyUpdate(_)).Times(0);
EXPECT_CALL(listener_, GetAppName(_)).Times(0);
- EXPECT_CALL(listener_, OnUpdateStatusChanged(_)).Times(1);
EXPECT_CALL(*cache_manager_, SaveUpdateRequired(false)).Times(0);
EXPECT_CALL(*cache_manager_, TimeoutResponse()).Times(0);
EXPECT_CALL(*cache_manager_, SecondsBetweenRetries(_)).Times(0);
- EXPECT_FALSE(policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ EXPECT_CALL(*cache_manager_, GetVehicleDataItems())
+ .WillOnce(Return(std::vector<policy_table::VehicleDataItem>()));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kWrongPtReceived,
+ policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+
EXPECT_CALL(*cache_manager_, IsPTPreloaded());
EXPECT_FALSE(policy_manager_->GetCache()->IsPTPreloaded());
+
+ EXPECT_CALL(listener_, OnUpdateStatusChanged(_)).Times(1);
+ policy_manager_->OnPTUFinished(
+ PolicyManager::PtProcessingResult::kWrongPtReceived);
}
TEST_F(
@@ -917,16 +1027,16 @@ TEST_F(
GetPTU(kValidSdlPtUpdateJson);
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
// Try to add existing app
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
// Check no update required
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
}
uint32_t GetCurrentDaysCount() {
- TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ date_time::TimeDuration current_time = date_time::getCurrentTime();
const uint32_t kSecondsInDay = 60 * 60 * 24;
- return current_time.tv_sec / kSecondsInDay;
+ return date_time::getSecs(current_time) / kSecondsInDay;
}
TEST_F(PolicyManagerImplTest2,
@@ -939,14 +1049,14 @@ TEST_F(PolicyManagerImplTest2,
GetPTU(kValidSdlPtUpdateJson);
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
::policy::Counters counter = ::policy::Counters::DAYS_AFTER_EPOCH;
// Set PT was updated 10 days ago (limit is 30 days for now)
// So no limit exceeded
policy_manager_->PTUpdatedAt(counter, days - 10);
- policy_manager_->OnAppRegisteredOnMobile(app_id_2_);
+ policy_manager_->OnAppRegisteredOnMobile(device_id_2_, app_id_2_);
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
}
@@ -959,13 +1069,13 @@ TEST_F(PolicyManagerImplTest2,
GetPTU(kValidSdlPtUpdateJson);
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
::policy::Counters counter = ::policy::Counters::DAYS_AFTER_EPOCH;
// Set PT was updated 50 days ago (limit is 30 days for now)
policy_manager_->PTUpdatedAt(counter, days - 50);
- policy_manager_->OnAppRegisteredOnMobile(app_id_2_);
+ policy_manager_->OnAppRegisteredOnMobile(device_id_2_, app_id_2_);
EXPECT_EQ("UPDATE_NEEDED", policy_manager_->GetPolicyTableStatus());
}
@@ -979,8 +1089,8 @@ TEST_F(
GetPTU(kValidSdlPtUpdateJson);
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
// Try to add existing app
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
::policy::Counters counter = ::policy::Counters::DAYS_AFTER_EPOCH;
// Set PT was updated 10 days ago (limit is 30 days for now)
@@ -993,7 +1103,7 @@ TEST_F(
for (int i = 0; i < ign_cycles; ++i) {
policy_manager_->IncrementIgnitionCycles();
}
- policy_manager_->OnAppRegisteredOnMobile(app_id_2_);
+ policy_manager_->OnAppRegisteredOnMobile(device_id_2_, app_id_2_);
// Check update required
EXPECT_EQ("UPDATE_NEEDED", policy_manager_->GetPolicyTableStatus());
}
@@ -1022,10 +1132,10 @@ TEST_F(PolicyManagerImplTest2,
->SetUserPermissionsForDevice(
device_id_2_, consented_groups, disallowed_groups);
policy_manager_->SetUserConsentForDevice(device_id_2_, true);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_))
- .WillRepeatedly(Return(device_id_2_));
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_2_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
GetPTU(kValidSdlPtUpdateJson);
::policy::PermissionConsent perm_consent;
@@ -1045,7 +1155,8 @@ TEST_F(PolicyManagerImplTest2,
policy_manager_->SetUserConsentForApp(perm_consent,
policy::PolicyManager::kSilentMode);
- policy_manager_->SendNotificationOnPermissionsUpdated(app_id_2_);
+ policy_manager_->SendNotificationOnPermissionsUpdated(device_id_2_,
+ app_id_2_);
std::vector< ::policy::FunctionalGroupPermission> actual_groups_permissions;
std::vector< ::policy::FunctionalGroupPermission>::iterator it;
policy_manager_->GetUserConsentForApp(
@@ -1069,8 +1180,10 @@ TEST_F(PolicyManagerImplTest2,
CanAppKeepContext_SetPoliciesForAppUpdated_ExpectAppCanKeepContext) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_2_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
GetPTU(kValidSdlPtUpdateJson);
// Check keep context in updated policies for app
EXPECT_TRUE(policy_manager_->CanAppKeepContext(app_id_2_));
@@ -1080,31 +1193,15 @@ TEST_F(PolicyManagerImplTest2,
CanAppStealFocus_SetPoliciesForAppUpdated_ExpectAppCanStealFocus) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_2_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
GetPTU(kValidSdlPtUpdateJson);
// Check keep context in updated policies for app
EXPECT_TRUE(policy_manager_->CanAppKeepContext(app_id_2_));
}
-TEST_F(PolicyManagerImplTest2,
- GetVehicleInfo_SetVehicleInfo_ExpectReceivedInfoCorrect) {
- // Arrange
- CreateLocalPT(preloaded_pt_filename_);
- GetPTU(kValidSdlPtUpdateJson);
- utils::SharedPtr<policy_table::Table> pt =
- (policy_manager_->GetCache())->GetPT();
- policy_table::ModuleConfig& module_config = pt->policy_table.module_config;
- ::policy::VehicleInfo vehicle_info = policy_manager_->GetVehicleInfo();
-
- EXPECT_EQ(static_cast<std::string>(*module_config.vehicle_make),
- vehicle_info.vehicle_make);
- EXPECT_EQ(static_cast<std::string>(*module_config.vehicle_model),
- vehicle_info.vehicle_model);
- EXPECT_EQ(static_cast<std::string>(*module_config.vehicle_year),
- vehicle_info.vehicle_year);
-}
-
TEST_F(
PolicyManagerImplTest2,
GetPermissionsForApp_SetUserConsentForApp_ExpectReceivedPermissionsCorrect) {
@@ -1130,10 +1227,10 @@ TEST_F(
->SetUserPermissionsForDevice(
device_id_2_, consented_groups, disallowed_groups);
policy_manager_->SetUserConsentForDevice(device_id_2_, true);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_))
- .WillRepeatedly(Return(device_id_2_));
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_2_))
+ .WillRepeatedly(Return(transport_manager::DeviceList(1, device_id_2_)));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
GetPTU(kValidSdlPtUpdateJson);
::policy::PermissionConsent perm_consent;
@@ -1153,7 +1250,8 @@ TEST_F(
policy_manager_->SetUserConsentForApp(perm_consent,
policy::PolicyManager::kSilentMode);
- policy_manager_->SendNotificationOnPermissionsUpdated(app_id_2_);
+ policy_manager_->SendNotificationOnPermissionsUpdated(device_id_2_,
+ app_id_2_);
std::vector< ::policy::FunctionalGroupPermission> actual_groups_permissions;
std::vector< ::policy::FunctionalGroupPermission>::iterator it;
policy_manager_->GetPermissionsForApp(
@@ -1177,19 +1275,23 @@ TEST_F(
PolicyManagerImplTest2,
GetAppRequestTypes_AddApp_UpdateAppPolicies_ExpectReceivedRequestTypesCorrect) {
// Arrange
+ const transport_manager::DeviceHandle handle = 1;
CreateLocalPT(preloaded_pt_filename_);
-
- policy_manager_->AddApplication(app_id_3_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_3_))
+ .WillRepeatedly(Return(transport_manager::DeviceList(1, device_id_1_)));
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(handle, app_id_3_))
+ .WillRepeatedly(Return(device_id_1_));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_3_, HmiTypes(policy_table::AHT_DEFAULT));
::policy::StringArray app_requests =
- policy_manager_->GetAppRequestTypes(app_id_3_);
+ policy_manager_->GetAppRequestTypes(handle, app_id_3_);
EXPECT_EQ(1u, app_requests.size());
Json::Value root = GetPTU(kPtuRequestTypeJson);
Json::Value request_Types = Json::Value(Json::arrayValue);
request_Types =
root["policy_table"]["app_policies"][app_id_3_]["RequestType"];
- app_requests = policy_manager_->GetAppRequestTypes(app_id_3_);
+ app_requests = policy_manager_->GetAppRequestTypes(handle, app_id_3_);
EXPECT_EQ(request_Types.size(), app_requests.size());
// Check nicknames match
for (uint32_t i = 0; i < request_Types.size(); ++i) {
@@ -1202,7 +1304,7 @@ TEST_F(
HertBeatTimeout_AddApp_UpdateAppPolicies_ExpectReceivedHertBeatTimeoutCorrect) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
(policy_manager_->GetCache())->GetPT();
::policy_table::PolicyTableType type1 =
::policy_table::PolicyTableType::PT_PRELOADED;
@@ -1213,9 +1315,11 @@ TEST_F(
rpc::ValidationReport report("policy_table");
pt->ReportErrors(&report);
}
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_2_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
// Add new app
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
uint32_t result = policy_manager_->HeartBeatTimeout(app_id_2_);
// By default hertbeat timeout is 0
EXPECT_EQ(0u, result);
@@ -1261,10 +1365,10 @@ TEST_F(PolicyManagerImplTest2,
->SetUserPermissionsForDevice(
device_id_2_, consented_groups, disallowed_groups);
policy_manager_->SetUserConsentForDevice(device_id_2_, true);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_))
- .WillRepeatedly(Return(device_id_2_));
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_2_))
+ .WillRepeatedly(Return(transport_manager::DeviceList(1, device_id_2_)));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
GetPTU(kValidSdlPtUpdateJson);
::policy::PermissionConsent perm_consent;
@@ -1284,7 +1388,8 @@ TEST_F(PolicyManagerImplTest2,
policy_manager_->SetUserConsentForApp(perm_consent,
policy::PolicyManager::kSilentMode);
- policy_manager_->SendNotificationOnPermissionsUpdated(app_id_2_);
+ policy_manager_->SendNotificationOnPermissionsUpdated(device_id_2_,
+ app_id_2_);
std::vector< ::policy::FunctionalGroupPermission> actual_groups_permissions;
std::vector< ::policy::FunctionalGroupPermission>::iterator it;
policy_manager_->GetPermissionsForApp(
@@ -1302,7 +1407,7 @@ TEST_F(PolicyManagerImplTest2,
actual_groups_permissions[index].group_name);
EXPECT_EQ(group1_perm.group_id, actual_groups_permissions[index].group_id);
EXPECT_EQ(group1_perm.state, actual_groups_permissions[index].state);
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
(policy_manager_->GetCache())->GetPT();
uint32_t ucr_size = 0;
::policy_table::DeviceData& device_data = *pt->policy_table.device_data;
@@ -1330,20 +1435,22 @@ TEST_F(PolicyManagerImplTest2,
SingleInvalidRequestTypeInPTU_ExpectReplaceWithDefaultValues) {
// Arrange
const std::string section_name = app_id_2_;
+ const transport_manager::DeviceHandle handle = 1;
// Arrange
CreateLocalPT(preloaded_pt_filename_);
// Setting device consent to 'true' in order to have defult application
// permissions, request type etc.
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_))
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(handle, app_id_2_))
.WillRepeatedly(Return(device_id_1_));
policy_manager_->SetUserConsentForDevice(device_id_1_, true);
-
+ EXPECT_CALL(listener_, GetDevicesIds(section_name))
+ .WillRepeatedly(Return(transport_manager::DeviceList(1, device_id_1_)));
// Add app
- policy_manager_->AddApplication(section_name,
- HmiTypes(policy_table::AHT_DEFAULT));
- EXPECT_CALL(listener_, OnPendingPermissionChange(section_name));
+ policy_manager_->AddApplication(
+ device_id_1_, section_name, HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener_, OnPendingPermissionChange(device_id_1_, section_name));
// PTU has single invalid RequestTypes, which must be dropped and replaced
// with default RT
@@ -1351,18 +1458,18 @@ TEST_F(PolicyManagerImplTest2,
// Get RequestTypes from <app_id> section of app policies after PT update
::policy::StringArray app_request_types_after =
- policy_manager_->GetAppRequestTypes(section_name);
+ policy_manager_->GetAppRequestTypes(handle, section_name);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(kDefaultId))
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(handle, kDefaultId))
.WillOnce(Return(device_id_1_));
::policy::StringArray default_request_types_after =
- policy_manager_->GetAppRequestTypes(kDefaultId);
+ policy_manager_->GetAppRequestTypes(handle, kDefaultId);
// Check sizes of Request types of PT and PTU
EXPECT_EQ(4u, app_request_types_after.size());
::policy::AppPermissions permissions =
- policy_manager_->GetAppPermissionsChanges(section_name);
+ policy_manager_->GetAppPermissionsChanges(device_id_1_, section_name);
EXPECT_TRUE(permissions.requestTypeChanged);
policy_table::RequestType temp_res1;
@@ -1713,6 +1820,6 @@ TEST_F(
CompareRequestTypesContainers(correct_types, received_types);
}
-} // namespace policy
+} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc
index e666ac82de..f89a2ce0c7 100644
--- a/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc
+++ b/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc
@@ -53,27 +53,26 @@ TEST_F(PolicyManagerImplTest2, UpdatedPreloadedPT_ExpectLPT_IsUpdated) {
CreateLocalPT(preloaded_pt_filename_);
// Update preloadedPT
std::ifstream ifile(preloaded_pt_filename_);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
root["policy_table"]["module_config"]["preloaded_date"] =
new_data.new_date_;
Json::Value val(Json::objectValue);
Json::Value val2(Json::arrayValue);
val2[0] = hmi_level_[index_];
val[new_data.new_field_value_]["hmi_levels"] = val2;
- root["policy_table"]["functional_groupings"][new_data
- .new_field_name_]["rpcs"] =
- val;
+ root["policy_table"]["functional_groupings"][new_data.new_field_name_]
+ ["rpcs"] = val;
root["policy_table"]["functional_groupings"][new_data.new_field_name_]
["user_consent_prompt"] = new_data.new_field_name_;
}
ifile.close();
- Json::StyledStreamWriter writer;
std::ofstream ofile(preloaded_pt_filename_);
- writer.write(ofile, root);
+ ofile << root;
ofile.flush();
ofile.close();
@@ -84,7 +83,7 @@ TEST_F(PolicyManagerImplTest2, UpdatedPreloadedPT_ExpectLPT_IsUpdated) {
EXPECT_TRUE(cache->IsPTPreloaded());
// Arrange
- utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot();
+ std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot();
// Get FunctionalGroupings
policy_table::FunctionalGroupings& fc =
table->policy_table.functional_groupings;
@@ -119,7 +118,7 @@ TEST_F(PolicyManagerImplTest2,
// Arrange
CreateLocalPT(preloaded_pt_filename_);
policy_manager_->SetSystemLanguage("it-it");
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
(policy_manager_->GetCache())->GetPT();
::policy_table::ModuleMeta& ModuleMeta = *(pt->policy_table.module_meta);
EXPECT_EQ("it-it", static_cast<std::string>(*(ModuleMeta.language)));
@@ -130,7 +129,7 @@ TEST_F(PolicyManagerImplTest2, SetVINValue_ExpectVINSetSuccessfully) {
CreateLocalPT(preloaded_pt_filename_);
std::string vin_code("1FAPP6242VH100001");
policy_manager_->SetVINValue(vin_code);
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
(policy_manager_->GetCache())->GetPT();
::policy_table::ModuleMeta& ModuleMeta = *(pt->policy_table.module_meta);
EXPECT_EQ(vin_code, static_cast<std::string>(*(ModuleMeta.vin)));
@@ -141,7 +140,7 @@ TEST_F(PolicyManagerImplTest2, SetSystemInfo_ExpectSystemInfoSetSuccessfully) {
CreateLocalPT(preloaded_pt_filename_);
policy_manager_->SetSystemInfo("4.1.3.B_EB355B", "WAEGB", "ru-ru");
policy::CacheManagerInterfaceSPtr cache = policy_manager_->GetCache();
- utils::SharedPtr<policy_table::Table> pt = cache->GetPT();
+ std::shared_ptr<policy_table::Table> pt = cache->GetPT();
::policy_table::ModuleMeta& ModuleMeta = *(pt->policy_table.module_meta);
EXPECT_EQ("ru-ru", static_cast<std::string>(*(ModuleMeta.language)));
EXPECT_EQ("4.1.3.B_EB355B",
@@ -189,7 +188,7 @@ TEST_F(PolicyManagerImplTest2, CleanUnpairedDevice_ExpectDevicesDeleted) {
policy_manager_->AddDevice("AAA123456789RRR", "Bluetooth");
policy_manager_->SetDeviceInfo("AAA123456789RRR", dev_info3);
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
(policy_manager_->GetCache())->GetPT();
// Try to find first device in PT
policy_table::DeviceData::const_iterator iter =
@@ -260,25 +259,30 @@ TEST_F(
PolicyManagerImplTest2,
AddValidRequestTypeToPT_GetNewAppWithSpecificPoliciesViaPTU_ExpectRTAdded) {
const std::string& app_id = application_id_;
+ const transport_manager::DeviceHandle handle = 1;
// Arrange
CreateLocalPT(preloaded_pt_filename_);
+ EXPECT_CALL(listener_, GetDevicesIds(app_id))
+ .WillRepeatedly(Return(transport_manager::DeviceList(1, device_id_1_)));
// Add app
- policy_manager_->AddApplication(app_id, HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id, HmiTypes(policy_table::AHT_DEFAULT));
// Check app gets RequestTypes from pre_DataConsent of app_policies
// section
- pt_request_types_ = policy_manager_->GetAppRequestTypes(app_id);
+ pt_request_types_ = policy_manager_->GetAppRequestTypes(handle, app_id);
// Only single item as in pre_DataConsent in preloaded PT
EXPECT_EQ(1u, pt_request_types_.size());
- EXPECT_CALL(listener_, OnPendingPermissionChange(app_id)).Times(1);
+ EXPECT_CALL(listener_, OnPendingPermissionChange(device_id_1_, app_id))
+ .Times(1);
// PTU has RequestTypes as [] - means 'all allowed'
Json::Value root = GetPTU("json/PTU2.json");
// Setting device consent to 'true' in order to have appropriate application
// permissions, request type etc.
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(application_id_))
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(handle, app_id))
.WillRepeatedly(Return(device_id_1_));
policy_manager_->SetUserConsentForDevice(device_id_1_, true);
@@ -289,13 +293,13 @@ TEST_F(
pt_request_types_.clear();
// Get RequestTypes from <app_id> section of app policies after PT update
- pt_request_types_ = policy_manager_->GetAppRequestTypes(app_id);
+ pt_request_types_ = policy_manager_->GetAppRequestTypes(handle, app_id);
// Check sizes of Request types of PT and PTU
ASSERT_EQ(ptu_request_types_size_, pt_request_types_.size());
::policy::AppPermissions permissions =
- policy_manager_->GetAppPermissionsChanges(app_id);
+ policy_manager_->GetAppPermissionsChanges(device_id_1_, app_id);
EXPECT_TRUE(permissions.requestTypeChanged);
::policy::StringArray result;
@@ -316,7 +320,7 @@ TEST_F(PolicyManagerImplTest2, AddDevice_RegisterDevice_TRUE) {
const bool result =
(policy_manager_->GetCache())->AddDevice(device_id_1_, connection_type);
// Get Policy table
- const utils::SharedPtr<policy_table::Table> policy_table =
+ const std::shared_ptr<policy_table::Table> policy_table =
policy_manager_->GetCache()->GetPT();
// Get preloaded_pt flag from Policy table
const bool is_preloaded_pt =
@@ -333,6 +337,6 @@ TEST_F(PolicyManagerImplTest2, AddDevice_RegisterDevice_TRUE) {
EXPECT_TRUE(result);
}
-} // namespace policy
+} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/policy/policy_external/test/policy_manager_impl_stress_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_stress_test.cc
index 2f1cc5a9d3..f886108463 100644
--- a/src/components/policy/policy_external/test/policy_manager_impl_stress_test.cc
+++ b/src/components/policy/policy_external/test/policy_manager_impl_stress_test.cc
@@ -29,15 +29,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include <fstream>
+#include "gtest/gtest.h"
#include "mock_policy_listener.h"
#include "policy/policy_manager_impl.h"
-using ::testing::_;
-using ::policy::PolicyManagerImpl;
using ::policy::BinaryMessage;
using ::policy::MockPolicyListener;
+using ::policy::PolicyManagerImpl;
+using ::testing::_;
namespace test {
namespace components {
diff --git a/src/components/policy/policy_external/test/policy_manager_impl_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_test.cc
index f4e922e647..9e0b61c2dd 100644
--- a/src/components/policy/policy_external/test/policy_manager_impl_test.cc
+++ b/src/components/policy/policy_external/test/policy_manager_impl_test.cc
@@ -32,47 +32,22 @@
#include <fstream>
-#include "json/reader.h"
-#include "gtest/gtest.h"
#include <utility>
+#include "gtest/gtest.h"
+#include "json/reader.h"
#include "policy/policy_manager_impl_test_base.h"
-#include "utils/make_shared.h"
-#include "utils/shared_ptr.h"
+#include "utils/date_time.h"
using ::testing::_;
+using ::testing::AtLeast;
using ::testing::Return;
using ::testing::SetArgReferee;
-using ::testing::AtLeast;
namespace test {
namespace components {
namespace policy_test {
-TEST_F(
- PolicyManagerImplTest,
- RefreshRetrySequence_SetSecondsBetweenRetries_ExpectRetryTimeoutSequenceWithSameSeconds) {
- // Arrange
- std::vector<int> seconds;
- seconds.push_back(50);
- seconds.push_back(100);
- seconds.push_back(200);
-
- // Assert
- EXPECT_CALL(*cache_manager_, TimeoutResponse()).WillOnce(Return(60));
- EXPECT_CALL(*cache_manager_, SecondsBetweenRetries(_))
- .WillOnce(DoAll(SetArgReferee<0>(seconds), Return(true)));
-
- // Act
- policy_manager_->RefreshRetrySequence();
-
- // Assert
- EXPECT_EQ(50, policy_manager_->NextRetryTimeout());
- EXPECT_EQ(100, policy_manager_->NextRetryTimeout());
- EXPECT_EQ(200, policy_manager_->NextRetryTimeout());
- EXPECT_EQ(0, policy_manager_->NextRetryTimeout());
-}
-
TEST_F(PolicyManagerImplTest, GetNotificationsNumber) {
std::string priority = "EMERGENCY";
uint32_t notif_number = 100;
@@ -131,8 +106,10 @@ TEST_F(PolicyManagerImplTest, LoadPT_SetPT_PTIsLoaded) {
// Arrange
EXPECT_CALL(*cache_manager_, DaysBeforeExchange(_))
.WillOnce(Return(kNonZero));
+ ON_CALL(*cache_manager_, GenerateSnapshot())
+ .WillByDefault(Return(default_pt_snapshot_));
policy_manager_->ForcePTExchange();
- policy_manager_->SetSendOnUpdateFlags(true, false);
+ policy_manager_->SetSendOnUpdateFlags(true);
policy_manager_->OnUpdateStarted();
Json::Value table = createPTforLoad();
@@ -148,21 +125,28 @@ TEST_F(PolicyManagerImplTest, LoadPT_SetPT_PTIsLoaded) {
std::string json = table.toStyledString();
::policy::BinaryMessage msg(json.begin(), json.end());
- utils::SharedPtr<policy_table::Table> snapshot =
- new policy_table::Table(update.policy_table);
+ std::shared_ptr<policy_table::Table> snapshot =
+ std::make_shared<policy_table::Table>(update.policy_table);
+ ON_CALL(*cache_manager_, GenerateSnapshot()).WillByDefault(Return(snapshot));
+
// Assert
- EXPECT_CALL(*cache_manager_, GenerateSnapshot()).WillOnce(Return(snapshot));
EXPECT_CALL(*cache_manager_, ApplyUpdate(_)).WillOnce(Return(true));
- EXPECT_CALL(listener_, GetAppName("1234"))
- .WillOnce(Return(custom_str::CustomString("")));
- EXPECT_CALL(listener_, OnUpdateStatusChanged(_));
+ EXPECT_CALL(listener_, GetDevicesIds("1234"))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
EXPECT_CALL(*cache_manager_, SaveUpdateRequired(false));
- EXPECT_CALL(*cache_manager_, TimeoutResponse());
- EXPECT_CALL(*cache_manager_, SecondsBetweenRetries(_));
- EXPECT_TRUE(policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ EXPECT_CALL(*cache_manager_, GetVehicleDataItems())
+ .WillOnce(Return(std::vector<policy_table::VehicleDataItem>()));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+
EXPECT_CALL(*cache_manager_, IsPTPreloaded());
EXPECT_FALSE(policy_manager_->GetCache()->IsPTPreloaded());
+
+ EXPECT_CALL(*cache_manager_, TimeoutResponse());
+ EXPECT_CALL(*cache_manager_, SecondsBetweenRetries(_));
+ EXPECT_CALL(listener_, OnUpdateStatusChanged(_));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
}
TEST_F(PolicyManagerImplTest2,
@@ -190,42 +174,17 @@ TEST_F(PolicyManagerImplTest2, ForcePTExchange_ExpectUpdateNeeded) {
EXPECT_EQ("UPDATE_NEEDED", policy_manager_->GetPolicyTableStatus());
}
-TEST_F(PolicyManagerImplTest2, OnSystemReady) {
- // Arrange
- CreateLocalPT(preloaded_pt_filename_);
- // Check
- EXPECT_CALL(listener_, OnSystemInfoUpdateRequired());
- policy_manager_->OnSystemReady();
-}
-
TEST_F(PolicyManagerImplTest2, ResetRetrySequence) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- policy_manager_->ResetRetrySequence();
+ policy_manager_->ResetRetrySequence(
+ policy::ResetRetryCountType::kResetWithStatusUpdate);
EXPECT_EQ("UPDATE_NEEDED", policy_manager_->GetPolicyTableStatus());
- policy_manager_->SetSendOnUpdateFlags(false, false);
+ policy_manager_->SetSendOnUpdateFlags(false);
policy_manager_->OnUpdateStarted();
EXPECT_EQ("UPDATING", policy_manager_->GetPolicyTableStatus());
}
-TEST_F(PolicyManagerImplTest2, NextRetryTimeout_ExpectTimeoutsFromPT) {
- // Arrange
- std::ifstream ifile(preloaded_pt_filename_);
- Json::Reader reader;
- Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
- Json::Value seconds_between_retries = Json::Value(Json::arrayValue);
- seconds_between_retries =
- root["policy_table"]["module_config"]["seconds_between_retries"];
- uint32_t size = seconds_between_retries.size();
- CreateLocalPT(preloaded_pt_filename_);
- for (uint32_t i = 0; i < size; ++i) {
- EXPECT_EQ(seconds_between_retries[i],
- policy_manager_->NextRetryTimeout());
- }
- }
-}
-
TEST_F(PolicyManagerImplTest2, TimeOutExchange) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
@@ -236,9 +195,9 @@ TEST_F(PolicyManagerImplTest2, TimeOutExchange) {
TEST_F(PolicyManagerImplTest,
RequestPTUpdate_SetPT_GeneratedSnapshotAndPTUpdate) {
Json::Value table = createPTforLoad();
- utils::SharedPtr<policy_table::Table> p_table =
- utils::MakeShared<policy_table::Table>(&table);
- ASSERT_TRUE(p_table);
+ std::shared_ptr<policy_table::Table> p_table =
+ std::make_shared<policy_table::Table>(&table);
+ ASSERT_TRUE(p_table.get());
p_table->SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
EXPECT_TRUE(IsValid(*p_table));
@@ -249,9 +208,9 @@ TEST_F(PolicyManagerImplTest,
}
TEST_F(PolicyManagerImplTest, RequestPTUpdate_InvalidPT_PTUpdateFail) {
- utils::SharedPtr<policy_table::Table> p_table =
- utils::MakeShared<policy_table::Table>();
- ASSERT_TRUE(p_table);
+ std::shared_ptr<policy_table::Table> p_table =
+ std::make_shared<policy_table::Table>();
+ ASSERT_TRUE(p_table.get());
EXPECT_FALSE(IsValid(*p_table));
EXPECT_CALL(listener_, OnSnapshotCreated(_, _, _)).Times(0);
@@ -261,7 +220,7 @@ TEST_F(PolicyManagerImplTest, RequestPTUpdate_InvalidPT_PTUpdateFail) {
}
TEST_F(PolicyManagerImplTest, RequestPTUpdate_InvalidSnapshot_PTUpdateFail) {
- utils::SharedPtr<policy_table::Table> p_table;
+ std::shared_ptr<policy_table::Table> p_table;
EXPECT_FALSE(p_table);
EXPECT_CALL(listener_, OnSnapshotCreated(_, _, _)).Times(0);
@@ -289,6 +248,8 @@ TEST_F(PolicyManagerImplTest2, GetPolicyTableStatus_ExpectUpToDate) {
TEST_F(PolicyManagerImplTest,
SetUpdateStarted_GetPolicyTableStatus_Expect_Updating) {
// Arrange
+ EXPECT_CALL(*cache_manager_, GenerateSnapshot())
+ .WillOnce(Return(default_pt_snapshot_));
policy_manager_->ForcePTExchange();
EXPECT_CALL(*cache_manager_, SaveUpdateRequired(true));
policy_manager_->OnUpdateStarted();
@@ -300,9 +261,10 @@ TEST_F(PolicyManagerImplTest2,
RetrySequenceDelaysSeconds_Expect_CorrectValues) {
// Arrange
std::ifstream ifile(preloaded_pt_filename_);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
Json::Value seconds_between_retries = Json::Value(Json::arrayValue);
seconds_between_retries =
root["policy_table"]["module_config"]["seconds_between_retries"];
@@ -321,6 +283,8 @@ TEST_F(PolicyManagerImplTest2,
OnExceededTimeout_GetPolicyTableStatus_ExpectUpdateNeeded) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
+ ON_CALL(ptu_retry_handler_, IsAllowedRetryCountExceeded())
+ .WillByDefault(Return(false));
policy_manager_->ForcePTExchange();
policy_manager_->OnExceededTimeout();
// Check
@@ -338,13 +302,48 @@ TEST_F(PolicyManagerImplTest, MarkUnpairedDevice) {
EXPECT_CALL(*cache_manager_, IgnitionCyclesBeforeExchange());
EXPECT_CALL(*cache_manager_, DaysBeforeExchange(_));
// Act
+ EXPECT_CALL(*cache_manager_, GenerateSnapshot())
+ .WillOnce(Return(default_pt_snapshot_));
policy_manager_->MarkUnpairedDevice(unpaired_device_id_);
}
TEST_F(PolicyManagerImplTest2, GetCurrentDeviceId) {
// Arrange
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_)).Times(1);
- EXPECT_EQ("", policy_manager_->GetCurrentDeviceId(app_id_2_));
+ const transport_manager::DeviceHandle handle = 1;
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(handle, app_id_2_))
+ .Times(1);
+ EXPECT_EQ("", policy_manager_->GetCurrentDeviceId(handle, app_id_2_));
+}
+
+TEST_F(PolicyManagerImplTest2, UpdateApplication_AppServices) {
+ // Arrange
+ std::string kServiceType = "MEDIA";
+ CreateLocalPT(preloaded_pt_filename_);
+ EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
+ GetPTU("json/valid_sdl_pt_update.json");
+ EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
+ // Try to add existing app
+ policy_table::AppServiceParameters app_service_parameters =
+ policy_table::AppServiceParameters();
+ policy_manager_->GetAppServiceParameters(app_id_2_, &app_service_parameters);
+
+ ASSERT_FALSE(app_service_parameters.find(kServiceType) ==
+ app_service_parameters.end());
+
+ auto service_names = *(app_service_parameters[kServiceType].service_names);
+
+ ASSERT_TRUE(service_names.is_initialized());
+ ASSERT_EQ(service_names.size(), 2u);
+ EXPECT_EQ(static_cast<std::string>(service_names[0]), "SDL App");
+ EXPECT_EQ(static_cast<std::string>(service_names[1]), "SDL Music");
+
+ auto handled_rpcs = app_service_parameters[kServiceType].handled_rpcs;
+
+ ASSERT_TRUE(handled_rpcs.is_initialized());
+ EXPECT_EQ(handled_rpcs[0].function_id, 41);
+
+ // Check no update required
+ EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
}
TEST_F(
@@ -355,7 +354,7 @@ TEST_F(
PreconditionExternalConsentPreparePTWithAppGroupsAndConsents();
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
policy_manager_->GetCache()->GetPT();
// Checking groups consents before setting ExternalConsent status
@@ -395,7 +394,7 @@ TEST_F(
status.insert(ExternalConsentStatusItem(type_2_, id_2_, kStatusOn));
status.insert(ExternalConsentStatusItem(type_3_, id_3_, kStatusOn));
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_1_, _));
+ EXPECT_CALL(listener_, OnPermissionsUpdated(device_id_1_, app_id_1_, _));
EXPECT_TRUE(policy_manager_->SetExternalConsentStatus(status));
@@ -420,7 +419,7 @@ TEST_F(
PreconditionExternalConsentPreparePTWithAppGroupsAndConsents();
// Act
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
policy_manager_->GetCache()->GetPT();
// Checking ExternalConsent consents before setting new ExternalConsent status
@@ -444,7 +443,7 @@ TEST_F(
status.insert(ExternalConsentStatusItem(type_2_, id_2_, kStatusOn));
status.insert(ExternalConsentStatusItem(type_3_, id_3_, kStatusOn));
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_1_, _));
+ EXPECT_CALL(listener_, OnPermissionsUpdated(device_id_1_, app_id_1_, _));
EXPECT_TRUE(policy_manager_->SetExternalConsentStatus(status));
@@ -484,7 +483,7 @@ TEST_F(
PreconditionExternalConsentPreparePTWithAppPolicy();
// Act
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
policy_manager_->GetCache()->GetPT();
ExternalConsentStatus status;
@@ -500,12 +499,12 @@ TEST_F(
EXPECT_FALSE(pt->policy_table.device_data->end() != updated_device_data);
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_1_, _));
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_1_))
+ EXPECT_CALL(listener_, OnPermissionsUpdated(device_id_1_, app_id_1_, _));
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(_, app_id_1_))
.WillRepeatedly(Return(device_id_1_));
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
// Check ExternalConsent consents for application
updated_device_data = pt->policy_table.device_data->find(device_id_1_);
@@ -552,7 +551,7 @@ TEST_F(
PreconditionExternalConsentPreparePTWithAppPolicy();
// Act
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
policy_manager_->GetCache()->GetPT();
ExternalConsentStatus status;
@@ -568,12 +567,12 @@ TEST_F(
EXPECT_FALSE(pt->policy_table.device_data->end() != updated_device_data);
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_1_, _));
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_1_))
+ EXPECT_CALL(listener_, OnPermissionsUpdated(device_id_1_, app_id_1_, _));
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(_, app_id_1_))
.WillRepeatedly(Return(device_id_1_));
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
// Checking ExternalConsent consents after setting new ExternalConsent status
ApplicationPolicies::const_iterator app_parameters =
@@ -623,18 +622,15 @@ TEST_F(
EXPECT_TRUE(policy_manager_->GetCache()->ApplyUpdate(t));
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_1_, _));
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_1_))
- .WillOnce(Return(device_id_1_)) // registered
- .WillOnce(Return("")) // not registered
- .WillRepeatedly(Return(device_id_1_)); // again registered
-
+ EXPECT_CALL(listener_, OnPermissionsUpdated(device_id_1_, app_id_1_, _));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_1_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
// First register w/o app having groups to consent
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
// Act
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
policy_manager_->GetCache()->GetPT();
ExternalConsentStatus status;
@@ -662,8 +658,8 @@ TEST_F(
EXPECT_TRUE(policy_manager_->GetCache()->ApplyUpdate(t));
// Second time register w/ app having groups to consent
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
// Checking ExternalConsent consents after setting new ExternalConsent status
ApplicationPolicies::const_iterator app_parameters =
@@ -713,18 +709,14 @@ TEST_F(
EXPECT_TRUE(policy_manager_->GetCache()->ApplyUpdate(t));
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_1_, _));
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_1_))
- .WillOnce(Return(device_id_1_)) // registered
- .WillOnce(Return("")) // not registered
- .WillRepeatedly(Return(device_id_1_)); // registered again
+ EXPECT_CALL(listener_, OnPermissionsUpdated(device_id_1_, app_id_1_, _));
// First register w/o app having groups to consent
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
// Act
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
policy_manager_->GetCache()->GetPT();
ExternalConsentStatus status;
@@ -752,8 +744,8 @@ TEST_F(
EXPECT_TRUE(policy_manager_->GetCache()->ApplyUpdate(t));
// Second time register w/ app having groups to consent
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
// Check ExternalConsent consents for application
updated_device_data = pt->policy_table.device_data->find(device_id_1_);
@@ -811,14 +803,13 @@ TEST_F(PolicyManagerImplTest_ExternalConsent,
EXPECT_TRUE(policy_manager_->SetExternalConsentStatus(status));
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_1_, _));
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_1_))
- .WillRepeatedly(Return(device_id_1_));
+ EXPECT_CALL(listener_, OnPermissionsUpdated(device_id_1_, app_id_1_, _));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_1_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
-
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
policy_manager_->GetCache()->GetPT();
// Check ExternalConsent consents for application
@@ -875,7 +866,9 @@ TEST_F(PolicyManagerImplTest_ExternalConsent,
EXPECT_CALL(listener_, OnCertificateUpdated(_));
- EXPECT_TRUE(policy_manager_->LoadPT("DummyFileName", msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT("DummyFileName", msg));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
pt = policy_manager_->GetCache()->GetPT();
@@ -936,14 +929,13 @@ TEST_F(PolicyManagerImplTest_ExternalConsent,
EXPECT_TRUE(policy_manager_->SetExternalConsentStatus(status));
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_1_, _));
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_1_))
- .WillRepeatedly(Return(device_id_1_));
-
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener_, OnPermissionsUpdated(device_id_1_, app_id_1_, _));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_1_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
policy_manager_->GetCache()->GetPT();
// Check ExternalConsent consents for application
@@ -995,7 +987,9 @@ TEST_F(PolicyManagerImplTest_ExternalConsent,
EXPECT_CALL(listener_, OnCertificateUpdated(_));
- EXPECT_TRUE(policy_manager_->LoadPT("DummyFileName", msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT("DummyFileName", msg));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
pt = policy_manager_->GetCache()->GetPT();
@@ -1046,7 +1040,7 @@ TEST_F(
PreconditionExternalConsentPreparePTWithAppGroupsAndConsents();
// Act
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
policy_manager_->GetCache()->GetPT();
// Checking ExternalConsent consents before setting new ExternalConsent status
@@ -1070,7 +1064,7 @@ TEST_F(
status_on.insert(ExternalConsentStatusItem(type_2_, id_2_, kStatusOn));
status_on.insert(ExternalConsentStatusItem(type_3_, id_3_, kStatusOn));
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_1_, _));
+ EXPECT_CALL(listener_, OnPermissionsUpdated(device_id_1_, app_id_1_, _));
EXPECT_TRUE(policy_manager_->SetExternalConsentStatus(status_on));
@@ -1106,7 +1100,8 @@ TEST_F(
status_off.insert(ExternalConsentStatusItem(type_2_, id_2_, kStatusOff));
status_off.insert(ExternalConsentStatusItem(type_3_, id_3_, kStatusOff));
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_1_, _)).Times(1);
+ EXPECT_CALL(listener_, OnPermissionsUpdated(device_id_1_, app_id_1_, _))
+ .Times(1);
EXPECT_TRUE(policy_manager_->SetExternalConsentStatus(status_off));
@@ -1122,6 +1117,6 @@ TEST_F(
EXPECT_EQ(Boolean(false), updated_group_2->second);
}
-} // namespace policy
+} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc
index 48e86d24b7..7c2d231708 100644
--- a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc
+++ b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc
@@ -30,17 +30,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
-#include <fstream>
#include <stdint.h>
+#include <fstream>
+#include <string>
#include <vector>
#include "policy/policy_manager_impl_test_base.h"
#include "utils/file_system.h"
-#include "utils/make_shared.h"
+
#include "utils/gen_hash.h"
-#include "json/reader.h"
+#include "utils/jsoncpp_reader_wrapper.h"
#include "policy/mock_pt_ext_representation.h"
@@ -48,10 +48,10 @@ namespace test {
namespace components {
namespace policy_test {
+using ::testing::_;
+using ::testing::ContainerEq;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::ContainerEq;
-using ::testing::_;
// Help functions
char GenRandomChar(char range_from, char range_to) {
@@ -105,12 +105,12 @@ Json::Value createPTforLoad() {
"}"
"},"
"\"notifications_per_minute_by_priority\": {"
- "\"emergency\": 1,"
- "\"navigation\": 2,"
- "\"VOICECOMM\": 3,"
- "\"communication\": 4,"
- "\"normal\": 5,"
- "\"none\": 6"
+ "\"EMERGENCY\": 1,"
+ "\"NAVIGATION\": 2,"
+ "\"VOICECOM\": 3,"
+ "\"COMMUNICATION\": 4,"
+ "\"NORMAL\": 5,"
+ "\"NONE\": 6"
"},"
"\"vehicle_make\" : \"MakeT\","
"\"vehicle_model\" : \"ModelT\","
@@ -175,8 +175,8 @@ Json::Value createPTforLoad() {
"}");
Json::Value table(Json::objectValue);
- Json::Reader reader;
- EXPECT_TRUE(reader.parse(load_table, table));
+ utils::JsonReader reader;
+ EXPECT_TRUE(reader.parse(load_table, &table));
return table;
}
@@ -207,7 +207,7 @@ PolicyManagerImplTest::PolicyManagerImplTest()
void PolicyManagerImplTest::SetUp() {
policy_manager_ = new PolicyManagerImpl();
- cache_manager_ = new MockCacheManagerInterface();
+ cache_manager_ = new NiceMock<MockCacheManagerInterface>();
policy_manager_->set_cache_manager(cache_manager_);
policy_manager_->set_listener(&listener_);
@@ -218,6 +218,10 @@ void PolicyManagerImplTest::SetUp() {
ON_CALL(*cache_manager_, GetKnownLinksFromPT())
.WillByDefault(Return(std::map<std::string, std::string>()));
ON_CALL(listener_, GetRegisteredLinks(_)).WillByDefault(Return());
+ ON_CALL(listener_, ptu_retry_handler())
+ .WillByDefault(ReturnRef(ptu_retry_handler_));
+ Json::Value table = createPTforLoad();
+ default_pt_snapshot_ = std::make_shared<policy_table::Table>(&table);
}
void PolicyManagerImplTest::TearDown() {
@@ -253,6 +257,10 @@ PolicyManagerImplTest2::PolicyManagerImplTest2()
void PolicyManagerImplTest2::SetUp() {
ON_CALL(listener_, GetRegisteredLinks(_)).WillByDefault(Return());
+ ON_CALL(listener_, ptu_retry_handler())
+ .WillByDefault(ReturnRef(ptu_retry_handler_));
+ ON_CALL(listener_, GetDevicesIds(_))
+ .WillByDefault(Return(transport_manager::DeviceList()));
file_system::CreateDirectory(app_storage_folder_);
@@ -260,7 +268,7 @@ void PolicyManagerImplTest2::SetUp() {
ON_CALL(policy_settings_, app_storage_folder())
.WillByDefault(ReturnRef(app_storage_folder_));
policy_manager_->set_listener(&listener_);
- const char* levels[] = {"BACKGROUND", "FULL", "LIMITED", "NONE"};
+ const char* levels[] = {"FULL", "LIMITED", "BACKGROUND", "NONE"};
hmi_level_.assign(levels, levels + sizeof(levels) / sizeof(levels[0]));
srand(time(NULL));
index_ = rand() % 3;
@@ -278,16 +286,19 @@ void PolicyManagerImplTest2::SetUp() {
const Json::Value PolicyManagerImplTest2::GetPTU(const std::string& file_name) {
// Get PTU
std::ifstream ifile(file_name);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
json = root.toStyledString();
}
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
// Load Json to cache
- EXPECT_TRUE(policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ EXPECT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
EXPECT_FALSE(policy_manager_->GetCache()->IsPTPreloaded());
return root;
}
@@ -307,7 +318,10 @@ void PolicyManagerImplTest2::AddRTtoPT(const std::string& update_file_name,
// Arrange
CreateLocalPT(preloaded_pt_filename_);
// Get RequestTypes from section of preloaded_pt app_policies
- pt_request_types_ = policy_manager_->GetAppRequestTypes(section_name);
+ const transport_manager::DeviceHandle handle = 1;
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(handle, section_name))
+ .WillRepeatedly(Return(device_id_1_));
+ pt_request_types_ = policy_manager_->GetAppRequestTypes(handle, section_name);
EXPECT_EQ(rt_number, pt_request_types_.size());
Json::Value root = GetPTU(update_file_name);
// Get Request Types from JSON (PTU)
@@ -316,7 +330,7 @@ void PolicyManagerImplTest2::AddRTtoPT(const std::string& update_file_name,
ptu_request_types_size_ = ptu_request_types_.size();
pt_request_types_.clear();
// Get RequestTypes from section of PT app policies after update
- pt_request_types_ = policy_manager_->GetAppRequestTypes(section_name);
+ pt_request_types_ = policy_manager_->GetAppRequestTypes(handle, section_name);
// Check number of RT in PTU and PT now are equal
ASSERT_EQ(ptu_request_types_size_ - invalid_rt_number,
pt_request_types_.size());
@@ -329,14 +343,17 @@ void PolicyManagerImplTest2::AddRTtoAppSectionPT(
const uint32_t invalid_rt_number) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
+ const transport_manager::DeviceHandle handle = 1;
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(handle, section_name))
+ .WillRepeatedly(Return(device_id_1_));
// Add app
- policy_manager_->AddApplication(section_name,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, section_name, HmiTypes(policy_table::AHT_DEFAULT));
// Check app gets RequestTypes from pre_DataConsent of app_policies
// section
- pt_request_types_ = policy_manager_->GetAppRequestTypes(section_name);
+ pt_request_types_ = policy_manager_->GetAppRequestTypes(handle, section_name);
EXPECT_EQ(rt_number, pt_request_types_.size());
- EXPECT_CALL(listener_, OnPendingPermissionChange(section_name)).Times(1);
+ EXPECT_CALL(listener_, OnPendingPermissionChange(_, section_name)).Times(1);
Json::Value root = GetPTU(update_file_name);
// Get App Request Types from PTU
@@ -346,13 +363,13 @@ void PolicyManagerImplTest2::AddRTtoAppSectionPT(
pt_request_types_.clear();
// Get RequestTypes from <app_id> section of app policies after PT update
- pt_request_types_ = policy_manager_->GetAppRequestTypes(section_name);
+ pt_request_types_ = policy_manager_->GetAppRequestTypes(handle, section_name);
// Check sizes of Request types of PT and PTU
ASSERT_EQ(ptu_request_types_size_ - invalid_rt_number,
pt_request_types_.size());
::policy::AppPermissions permissions =
- policy_manager_->GetAppPermissionsChanges(section_name);
+ policy_manager_->GetAppPermissionsChanges(device_id_1_, section_name);
EXPECT_TRUE(permissions.requestTypeChanged);
}
@@ -414,7 +431,7 @@ void PolicyManagerImplTest2::GetFunctionalGroupingsFromManager(
// Get cache
::policy::CacheManagerInterfaceSPtr cache = policy_manager_->GetCache();
// Get table_snapshot
- utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot();
+ std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot();
// Set functional groupings from policy table
input_functional_groupings = table->policy_table.functional_groupings;
}
@@ -449,28 +466,30 @@ void PolicyManagerImplTest2::
2,
"Bluetooth"));
+ EXPECT_CALL(listener_, GetDevicesIds(application_id_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
+
// Add app from consented device. App will be assigned with default policies
- policy_manager_->AddApplication(application_id_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->SetUserConsentForDevice(device_id_1_, true);
+ policy_manager_->AddApplication(
+ device_id_1_, application_id_, HmiTypes(policy_table::AHT_DEFAULT));
// Expect all parameters are allowed
std::ifstream ifile(update_file);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
if (ifile.is_open()) {
- reader.parse(ifile, root, true);
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr);
}
json = root.toStyledString();
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
- EXPECT_TRUE(policy_manager_->LoadPT(kFilePtUpdateJson, msg));
- EXPECT_FALSE(cache->IsPTPreloaded());
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
- // Will be called each time permissions are checked
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(application_id_))
- .Times(4)
- .WillRepeatedly(Return(device_id_1_));
+ EXPECT_FALSE(cache->IsPTPreloaded());
// Check RPC in each level
::policy::RPCParams input_params;
@@ -478,8 +497,12 @@ void PolicyManagerImplTest2::
::policy::CheckPermissionResult output;
// Rpc in FULL level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelFull, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelFull,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is allowed
EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
// Check list of allowed parameters is not empty
@@ -489,8 +512,12 @@ void PolicyManagerImplTest2::
ResetOutputList(output);
// Rpc in LIMITED level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelLimited, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelLimited,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is allowed
EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
// Check list of allowed parameters is not empty
@@ -500,7 +527,8 @@ void PolicyManagerImplTest2::
ResetOutputList(output);
// Rpc in BACKGROUND level
- policy_manager_->CheckPermissions(application_id_,
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
kHmiLevelBackground,
"SendLocation",
input_params,
@@ -515,8 +543,12 @@ void PolicyManagerImplTest2::
ResetOutputList(output);
// Rpc in NONE level
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelNone, "SendLocation", input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelNone,
+ "SendLocation",
+ input_params,
+ output);
// Check RPC is disallowed
EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
// Check lists of parameters are empty
@@ -529,8 +561,12 @@ void PolicyManagerImplTest2::CheckRpcPermissions(
const std::string& rpc_name, const PermitResult& expected_permission) {
::policy::RPCParams input_params;
::policy::CheckPermissionResult output;
- policy_manager_->CheckPermissions(
- application_id_, kHmiLevelFull, rpc_name, input_params, output);
+ policy_manager_->CheckPermissions(device_id_1_,
+ application_id_,
+ kHmiLevelFull,
+ rpc_name,
+ input_params,
+ output);
EXPECT_EQ(expected_permission, output.hmi_level_permitted);
}
@@ -541,16 +577,17 @@ void PolicyManagerImplTest2::CheckRpcPermissions(
::policy::RPCParams input_params;
::policy::CheckPermissionResult output;
policy_manager_->CheckPermissions(
- app_id, kHmiLevelFull, rpc_name, input_params, output);
+ device_id_1_, app_id, kHmiLevelFull, rpc_name, input_params, output);
EXPECT_EQ(out_expected_permission, output.hmi_level_permitted);
}
void PolicyManagerImplTest2::EmulatePTAppRevoked(const std::string& ptu_name) {
std::ifstream ifile(ptu_name);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
// Emulate application is revoked
root["policy_table"]["app_policies"]["1234"]["is_revoked"] = 1;
json = root.toStyledString();
@@ -558,7 +595,9 @@ void PolicyManagerImplTest2::EmulatePTAppRevoked(const std::string& ptu_name) {
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
- ASSERT_TRUE(policy_manager_->LoadPT(kDummyUpdateFileName, msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT(kDummyUpdateFileName, msg));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
}
// To avoid duplicate arrange of test
@@ -576,8 +615,9 @@ void PolicyManagerImplTest2::AddSetDeviceData() {
"Bluetooth"));
// Add app from consented device. App will be assigned with default policies
- policy_manager_->AddApplication(application_id_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->SetUserConsentForDevice(device_id_1_, true);
+ policy_manager_->AddApplication(
+ device_id_1_, application_id_, HmiTypes(policy_table::AHT_DEFAULT));
(policy_manager_->GetCache())->AddDevice(device_id_1_, "Bluetooth");
}
@@ -586,16 +626,19 @@ void PolicyManagerImplTest2::LoadPTUFromJsonFile(
const std::string& update_file) {
// Load Json to cache
std::ifstream ifile(update_file);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
if (ifile.is_open()) {
- reader.parse(ifile, root, true);
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr);
}
json = root.toStyledString();
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
- EXPECT_TRUE(policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_->LoadPT(kFilePtUpdateJson, msg));
+ policy_manager_->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+
EXPECT_FALSE(policy_manager_->GetCache()->IsPTPreloaded());
}
@@ -636,10 +679,12 @@ PolicyManagerImplTest_RequestTypes::PolicyManagerImplTest_RequestTypes()
void PolicyManagerImplTest_RequestTypes::SetUp() {
ON_CALL(listener_, GetRegisteredLinks(_)).WillByDefault(Return());
+ ON_CALL(listener_, GetDevicesIds(_))
+ .WillByDefault(Return(transport_manager::DeviceList()));
file_system::CreateDirectory(app_storage_folder_);
const bool in_memory = true;
- policy_manager_impl_sptr_ = utils::MakeShared<PolicyManagerImpl>(in_memory);
+ policy_manager_impl_sptr_ = std::make_shared<PolicyManagerImpl>(in_memory);
policy_manager_impl_sptr_->set_listener(&listener_);
}
@@ -647,16 +692,21 @@ const Json::Value PolicyManagerImplTest_RequestTypes::GetPTU(
const std::string& file_name) {
// Get PTU
std::ifstream ifile(file_name);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
json = root.toStyledString();
}
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
// Load Json to cache
- EXPECT_TRUE(policy_manager_impl_sptr_->LoadPT(kFilePtUpdateJson, msg));
+ EXPECT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ policy_manager_impl_sptr_->LoadPT(kFilePtUpdateJson, msg));
+ policy_manager_impl_sptr_->OnPTUFinished(
+ PolicyManager::PtProcessingResult::kSuccess);
+
EXPECT_FALSE(policy_manager_impl_sptr_->GetCache()->IsPTPreloaded());
return root;
}
@@ -864,10 +914,11 @@ std::string PolicyManagerImplTest_ExternalConsent::PreparePTUWithNewGroup(
using namespace rpc;
std::ifstream ifile(preloaded_pt_filename_);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
Table t = PreparePTWithGroupsHavingExternalConsent();
ExternalConsentEntity entity_4(type, id);
diff --git a/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc
index 2f2162494f..1db23260a8 100644
--- a/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc
+++ b/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc
@@ -34,6 +34,7 @@
#include "policy/policy_manager_impl_test_base.h"
#include "utils/date_time.h"
+#include "utils/macro.h"
namespace test {
namespace components {
@@ -49,13 +50,15 @@ TEST_F(
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_1_))
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(_, app_id_1_))
.WillRepeatedly(Return(device_id_1_));
+ EXPECT_CALL(listener_, CanUpdate()).WillRepeatedly(Return(true));
+
policy_manager_->SetUserConsentForDevice(device_id_1_, true);
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_EQ("UPDATE_NEEDED", policy_manager_->GetPolicyTableStatus());
}
@@ -69,20 +72,21 @@ TEST_F(
// To set UP_TO_DATE before registration
GetPTU(kValidSdlPtUpdateJson);
- const TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ const date_time::TimeDuration current_time = date_time::getCurrentTime();
const int kSecondsInDay = 60 * 60 * 24;
- const int days_after_epoch = current_time.tv_sec / kSecondsInDay;
+ const int days_after_epoch = date_time::getSecs(current_time) / kSecondsInDay;
policy_manager_->PTUpdatedAt(DAYS_AFTER_EPOCH, days_after_epoch);
policy_manager_->PTUpdatedAt(KILOMETERS, 1000);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_1_))
+ const transport_manager::DeviceHandle handle = 1;
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(handle, app_id_1_))
.WillRepeatedly(Return(device_id_1_));
policy_manager_->SetUserConsentForDevice(device_id_1_, false);
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_EQ("UP_TO_DATE", policy_manager_->GetPolicyTableStatus());
}
@@ -92,10 +96,13 @@ TEST_F(
ReactOnUserDevConsentForApp_AddNewApplicationFromDeviceWithoutConsent_ExpectPreDataConsent) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ const transport_manager::DeviceHandle handle = 1;
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(handle, app_id_1_))
+ .WillRepeatedly(Return(device_id_1_));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
ASSERT_TRUE(policy_manager_->IsPredataPolicy(app_id_1_));
- policy_manager_->ReactOnUserDevConsentForApp(app_id_1_, false);
+ policy_manager_->ReactOnUserDevConsentForApp(handle, app_id_1_, false);
EXPECT_TRUE(policy_manager_->IsPredataPolicy(app_id_1_));
}
@@ -106,8 +113,8 @@ TEST_F(PolicyManagerImplTest2,
CreateLocalPT(kSdlPreloadedPtJson2);
ASSERT_TRUE(
(policy_manager_->GetCache())->AddDevice(device_id_2_, "Bluetooth"));
- policy_manager_->AddApplication(application_id_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_2_, application_id_, HmiTypes(policy_table::AHT_DEFAULT));
// Expect RPCs from pre_dataConsent group are allowed
// Next checks are equal to BaseBeforeDataConsent_APIs.xml checks from task
@@ -155,11 +162,11 @@ TEST_F(PolicyManagerImplTest2,
TEST_F(PolicyManagerImplTest2, CheckPreDataConsent_GetDefaultHmiLevel_NONE) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
std::string default_hmi;
// Default HMI level is NONE
- policy_manager_->GetDefaultHmi(app_id_2_, &default_hmi);
+ policy_manager_->GetDefaultHmi(device_id_1_, app_id_2_, &default_hmi);
EXPECT_EQ("NONE", default_hmi);
// Default priority level is NONE
@@ -173,11 +180,11 @@ TEST_F(PolicyManagerImplTest2,
CheckPreDataConsent_GetDefaultHmiLevel_BACKGROUNG) {
// Arrange
CreateLocalPT(kSdlPreloadedPtJson2);
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
std::string default_hmi;
// Default HMI level is BACKGROUND
- policy_manager_->GetDefaultHmi(app_id_2_, &default_hmi);
+ policy_manager_->GetDefaultHmi(device_id_1_, app_id_2_, &default_hmi);
EXPECT_EQ("BACKGROUND", default_hmi);
// Default priority level is EMERGENCY
std::string priority1;
@@ -191,10 +198,13 @@ TEST_F(
// Arrange
// RequestTypes for default & preDataConsent are different
CreateLocalPT("json/ptu_requestType.json");
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ const transport_manager::DeviceHandle handle = 1;
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(handle, app_id_1_))
+ .WillRepeatedly(Return(device_id_1_));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
ASSERT_TRUE(policy_manager_->IsPredataPolicy(app_id_1_));
- policy_manager_->ReactOnUserDevConsentForApp(app_id_1_, true);
+ policy_manager_->ReactOnUserDevConsentForApp(handle, app_id_1_, true);
EXPECT_FALSE(policy_manager_->IsPredataPolicy(app_id_1_));
// Expect app_id_1_ has default policy
EXPECT_TRUE((policy_manager_->GetCache())->IsDefaultPolicy(app_id_1_));
@@ -206,11 +216,14 @@ TEST_F(
// Arrange
// RequestTypes for default & preDataConsent are the same
CreateLocalPT(kPtu2RequestTypeJson);
- policy_manager_->AddApplication(app_id_1_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ const transport_manager::DeviceHandle handle = 1;
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(handle, app_id_1_))
+ .WillRepeatedly(Return(device_id_1_));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_1_, HmiTypes(policy_table::AHT_DEFAULT));
ASSERT_TRUE(policy_manager_->IsPredataPolicy(app_id_1_));
- EXPECT_CALL(listener_, OnPendingPermissionChange(app_id_1_)).Times(0);
- policy_manager_->ReactOnUserDevConsentForApp(app_id_1_, true);
+ EXPECT_CALL(listener_, OnPendingPermissionChange(_, app_id_1_)).Times(0);
+ policy_manager_->ReactOnUserDevConsentForApp(handle, app_id_1_, true);
EXPECT_FALSE(policy_manager_->IsPredataPolicy(app_id_1_));
EXPECT_TRUE((policy_manager_->GetCache())->IsDefaultPolicy(app_id_1_));
}
@@ -297,12 +310,12 @@ TEST_F(PolicyManagerImplTest2,
policy_manager_->GetUserConsentForDevice(device_id_2_);
// Check
EXPECT_EQ(::policy::DeviceConsent::kDeviceDisallowed, consent);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_))
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(_, app_id_2_))
.WillRepeatedly(Return(device_id_2_));
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
std::string default_hmi;
- policy_manager_->GetDefaultHmi(app_id_2_, &default_hmi);
+ policy_manager_->GetDefaultHmi(device_id_2_, app_id_2_, &default_hmi);
EXPECT_EQ("NONE", default_hmi);
}
@@ -310,12 +323,12 @@ TEST_F(PolicyManagerImplTest2,
GetDefaultHmi_SetDeviceAllowed_ExpectReceivedHmiCorrect) {
// Arrange
CreateLocalPT(kPtu2RequestTypeJson);
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
// Check if app has preData policy
EXPECT_TRUE(policy_manager_->IsPredataPolicy(app_id_2_));
std::string default_hmi1;
- policy_manager_->GetDefaultHmi(app_id_2_, &default_hmi1);
+ policy_manager_->GetDefaultHmi(device_id_1_, app_id_2_, &default_hmi1);
EXPECT_EQ("NONE", default_hmi1);
ASSERT_TRUE(
(policy_manager_->GetCache())->AddDevice(device_id_2_, "Bluetooth"));
@@ -333,13 +346,13 @@ TEST_F(PolicyManagerImplTest2,
policy_manager_->GetUserConsentForDevice(device_id_2_);
// Check
EXPECT_EQ(::policy::DeviceConsent::kDeviceAllowed, consent);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_))
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(_, app_id_2_))
.WillRepeatedly(Return(device_id_2_));
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_TRUE((policy_manager_->GetCache())->IsDefaultPolicy(app_id_2_));
std::string default_hmi2;
- policy_manager_->GetDefaultHmi(app_id_2_, &default_hmi2);
+ policy_manager_->GetDefaultHmi(device_id_2_, app_id_2_, &default_hmi2);
EXPECT_EQ("LIMITED", default_hmi2);
}
@@ -347,8 +360,8 @@ TEST_F(PolicyManagerImplTest2,
GetDefaultPriority_SetDeviceAllowed_ExpectReceivedPriorityCorrect) {
// Arrange
CreateLocalPT(kPtu2RequestTypeJson);
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
// Check if app has preData policy
EXPECT_TRUE(policy_manager_->IsPredataPolicy(app_id_2_));
std::string priority1;
@@ -370,10 +383,10 @@ TEST_F(PolicyManagerImplTest2,
policy_manager_->GetUserConsentForDevice(device_id_2_);
// Check
EXPECT_EQ(::policy::DeviceConsent::kDeviceAllowed, consent);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_))
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(_, app_id_2_))
.WillRepeatedly(Return(device_id_2_));
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_TRUE((policy_manager_->GetCache())->IsDefaultPolicy(app_id_2_));
std::string priority2;
EXPECT_TRUE(policy_manager_->GetPriority(app_id_2_, &priority2));
@@ -395,7 +408,7 @@ TEST_F(PolicyManagerImplTest2,
uint32_t size = result.size();
EXPECT_GT(size, 0u);
std::vector< ::policy::UserFriendlyMessage>::iterator result_iter;
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
(policy_manager_->GetCache())->GetPT();
policy_table::ConsumerFriendlyMessages& consumer_friendly_messages =
@@ -456,7 +469,7 @@ TEST_F(PolicyManagerImplTest2,
TEST_F(PolicyManagerImplTest2, SetDeviceInfo_ExpectDevInfoAddedToPT) {
// Arrange
::policy::DeviceInfo dev_info;
- utils::SharedPtr<policy_table::Table> pt =
+ std::shared_ptr<policy_table::Table> pt =
(policy_manager_->GetCache())->GetPT();
dev_info.hardware = "hardware IPX";
dev_info.firmware_rev = "v.8.0.1";
@@ -490,8 +503,10 @@ TEST_F(PolicyManagerImplTest2, SetDeviceInfo_ExpectDevInfoAddedToPT) {
TEST_F(PolicyManagerImplTest2, GetInitialAppData_ExpectReceivedConsentCorrect) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_2_))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
::policy::StringArray app_nicknames;
::policy::StringArray app_hmi_types;
policy_manager_->GetInitialAppData(app_id_2_, &app_nicknames, &app_hmi_types);
@@ -534,8 +549,8 @@ TEST_F(
CanAppKeepContext_AddAppFromUnconsentedDevice_ExpectAppCannotKeepContext) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
// Check if app has preData policy
EXPECT_TRUE(policy_manager_->IsPredataPolicy(app_id_2_));
// Check keep context in preData policy
@@ -548,8 +563,8 @@ TEST_F(PolicyManagerImplTest2,
CreateLocalPT(preloaded_pt_filename_);
ASSERT_TRUE(
(policy_manager_->GetCache())->AddDevice(device_id_2_, "Bluetooth"));
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
ASSERT_TRUE((policy_manager_->GetCache())
->SetDeviceData(device_id_2_,
"hardware IPX",
@@ -563,10 +578,10 @@ TEST_F(PolicyManagerImplTest2,
::policy::DeviceConsent consent =
policy_manager_->GetUserConsentForDevice(device_id_2_);
EXPECT_EQ(::policy::DeviceConsent::kDeviceAllowed, consent);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_))
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(_, app_id_2_))
.WillRepeatedly(Return(device_id_2_));
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_TRUE((policy_manager_->GetCache())->IsDefaultPolicy(app_id_2_));
// Check keep context in default policy
EXPECT_FALSE(policy_manager_->CanAppKeepContext(app_id_2_));
@@ -576,8 +591,8 @@ TEST_F(PolicyManagerImplTest2,
CanAppStealFocus_AddAppFromUnconsentedDevice_ExpectAppCannotStealFocus) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
// Check if app has preData policy
EXPECT_TRUE(policy_manager_->IsPredataPolicy(app_id_2_));
// Check keep context in preData policy
@@ -590,8 +605,8 @@ TEST_F(PolicyManagerImplTest2,
CreateLocalPT(preloaded_pt_filename_);
ASSERT_TRUE(
(policy_manager_->GetCache())->AddDevice(device_id_2_, "Bluetooth"));
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
ASSERT_TRUE((policy_manager_->GetCache())
->SetDeviceData(device_id_2_,
"hardware IPX",
@@ -605,10 +620,10 @@ TEST_F(PolicyManagerImplTest2,
::policy::DeviceConsent consent =
policy_manager_->GetUserConsentForDevice(device_id_2_);
EXPECT_EQ(::policy::DeviceConsent::kDeviceAllowed, consent);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_))
+ EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(_, app_id_2_))
.WillRepeatedly(Return(device_id_2_));
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_TRUE((policy_manager_->GetCache())->IsDefaultPolicy(app_id_2_));
// Check keep context in default policy
EXPECT_FALSE(policy_manager_->CanAppStealFocus(app_id_2_));
@@ -618,8 +633,8 @@ TEST_F(PolicyManagerImplTest2,
IsPredataPolicy_SetAppWIthPredataPolicy_ExpectPredataPolicy) {
// Arrange
CreateLocalPT(preloaded_pt_filename_);
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
// Check if app has preData policy
EXPECT_TRUE(policy_manager_->IsPredataPolicy(app_id_2_));
}
@@ -629,18 +644,18 @@ TEST_F(
SendNotificationOnPermissionsUpdated_SetDeviceAllowed_ExpectNotificationSent) {
// Arrange
CreateLocalPT(kPtu2RequestTypeJson);
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_2_)).Times(0);
+ policy_manager_->AddApplication(
+ device_id_1_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
// Check if app has preData policy
EXPECT_TRUE(policy_manager_->IsPredataPolicy(app_id_2_));
std::string default_hmi1;
- policy_manager_->GetDefaultHmi(app_id_2_, &default_hmi1);
+ policy_manager_->GetDefaultHmi(device_id_1_, app_id_2_, &default_hmi1);
EXPECT_EQ("NONE", default_hmi1);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_))
- .WillOnce(Return(""));
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_2_, _, default_hmi1))
+ EXPECT_CALL(listener_, OnPermissionsUpdated(device_id_1_, app_id_2_, _))
.Times(0);
- policy_manager_->SendNotificationOnPermissionsUpdated(app_id_2_);
+ policy_manager_->SendNotificationOnPermissionsUpdated(device_id_1_,
+ app_id_2_);
ASSERT_TRUE(
(policy_manager_->GetCache())->AddDevice(device_id_2_, "Bluetooth"));
@@ -658,18 +673,19 @@ TEST_F(
policy_manager_->GetUserConsentForDevice(device_id_2_);
// Check
EXPECT_EQ(::policy::DeviceConsent::kDeviceAllowed, consent);
- EXPECT_CALL(listener_, OnCurrentDeviceIdUpdateRequired(app_id_2_))
- .WillRepeatedly(Return(device_id_2_));
- policy_manager_->AddApplication(app_id_2_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener_, GetDevicesIds(app_id_2_)).Times(0);
+ policy_manager_->AddApplication(
+ device_id_2_, app_id_2_, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_TRUE((policy_manager_->GetCache())->IsDefaultPolicy(app_id_2_));
std::string default_hmi2;
- policy_manager_->GetDefaultHmi(app_id_2_, &default_hmi2);
+ policy_manager_->GetDefaultHmi(device_id_2_, app_id_2_, &default_hmi2);
EXPECT_EQ("LIMITED", default_hmi2);
- EXPECT_CALL(listener_, OnPermissionsUpdated(app_id_2_, _, default_hmi2));
- policy_manager_->SendNotificationOnPermissionsUpdated(app_id_2_);
+ EXPECT_CALL(listener_,
+ OnPermissionsUpdated(device_id_2_, app_id_2_, _, default_hmi2));
+ policy_manager_->SendNotificationOnPermissionsUpdated(device_id_2_,
+ app_id_2_);
}
-} // namespace policy
+} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc
index 92525c646d..7d40210ba4 100644
--- a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc
+++ b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc
@@ -29,29 +29,27 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <vector>
-#include <map>
+#include "policy/sql_pt_ext_representation.h"
#include <algorithm>
-#include <utility>
-#include <string>
-#include <iterator>
#include <iostream>
+#include <iterator>
+#include <map>
+#include <string>
+#include <utility>
+#include <vector>
#include "gtest/gtest.h"
-#include "policy/sql_pt_ext_representation.h"
-#include "utils/gen_hash.h"
-#include "utils/file_system.h"
-#include "sqlite_wrapper/sql_query.h"
-#include "rpc_base/rpc_base.h"
-#include "policy/policy_table/types.h"
#include "policy/mock_policy_settings.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
+#include "policy/policy_table/types.h"
+#include "rpc_base/rpc_base.h"
+#include "sqlite_wrapper/sql_query.h"
+#include "utils/file_system.h"
+#include "utils/gen_hash.h"
using namespace ::policy;
namespace policy_table = rpc::policy_table_interface_base;
-using std::string;
using std::map;
using std::pair;
+using std::string;
using std::vector;
using testing::ReturnRef;
@@ -393,7 +391,7 @@ TEST_F(SQLPTExtRepresentationTest,
ASSERT_TRUE(reps_->Save(update));
// Act
- utils::SharedPtr<policy_table::Table> snapshot = reps_->GenerateSnapshot();
+ std::shared_ptr<policy_table::Table> snapshot = reps_->GenerateSnapshot();
snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT);
policy_table["module_meta"] = Json::Value(Json::objectValue);
@@ -1506,7 +1504,7 @@ TEST_F(SQLPTExtRepresentationTest, SaveUserConsentRecords_ExpectedSaved) {
// Act
EXPECT_TRUE(reps_->Save(original_table));
- utils::SharedPtr<Table> loaded_table = reps_->GenerateSnapshot();
+ std::shared_ptr<Table> loaded_table = reps_->GenerateSnapshot();
// GetData/GetKeyData methods do internal existence check - no need to do it
// separately. In case of data is missing expectations will be violated.
@@ -1543,8 +1541,8 @@ TEST_F(SQLPTExtRepresentationTest, SaveFunctionalGroupings_ExpectedSaved) {
const HmiLevel test_level_1 = HL_FULL;
const HmiLevel test_level_2 = HL_LIMITED;
- const policy_table::Parameter test_parameter_1 = P_GPS;
- const policy_table::Parameter test_parameter_2 = P_SPEED;
+ const std::string test_parameter_1 = "P_GPS";
+ const std::string test_parameter_2 = "P_SPEED";
Rpcs rpcs;
@@ -1580,7 +1578,7 @@ TEST_F(SQLPTExtRepresentationTest, SaveFunctionalGroupings_ExpectedSaved) {
*another_rpcs.user_consent_prompt = another_user_consent_prompt;
const HmiLevel test_level_3 = HL_BACKGROUND;
- const policy_table::Parameter test_parameter_3 = P_BELTSTATUS;
+ const std::string test_parameter_3 = "P_BELTSTATUS";
RpcParameters another_parameters;
another_parameters.hmi_levels.push_back(test_level_3);
@@ -1591,7 +1589,7 @@ TEST_F(SQLPTExtRepresentationTest, SaveFunctionalGroupings_ExpectedSaved) {
// Act
EXPECT_TRUE(reps_->Save(original_table));
- utils::SharedPtr<Table> loaded_table = reps_->GenerateSnapshot();
+ std::shared_ptr<Table> loaded_table = reps_->GenerateSnapshot();
FunctionalGroupings loaded_groupings =
GetData<Table, FunctionalGroupings>(*loaded_table);
@@ -1617,10 +1615,10 @@ TEST_F(SQLPTExtRepresentationTest, SaveFunctionalGroupings_ExpectedSaved) {
EXPECT_TRUE(
(IsKeyExist<HmiLevels>(loaded_parameters.hmi_levels, test_level_2)));
- EXPECT_TRUE((
- IsKeyExist<Parameters>(*loaded_parameters.parameters, test_parameter_1)));
- EXPECT_TRUE((
- IsKeyExist<Parameters>(*loaded_parameters.parameters, test_parameter_2)));
+ EXPECT_TRUE((IsKeyExist<Parameters, std::string>(
+ *loaded_parameters.parameters, test_parameter_1)));
+ EXPECT_TRUE((IsKeyExist<Parameters, std::string>(
+ *loaded_parameters.parameters, test_parameter_2)));
Rpcs another_loaded_rpcs = GetKeyData<FunctionalGroupings, Rpcs>(
loaded_groupings, another_group_name);
@@ -1639,8 +1637,8 @@ TEST_F(SQLPTExtRepresentationTest, SaveFunctionalGroupings_ExpectedSaved) {
EXPECT_TRUE((IsKeyExist<HmiLevels>(another_loaded_parameters.hmi_levels,
test_level_3)));
- EXPECT_TRUE((IsKeyExist<Parameters>(*another_loaded_parameters.parameters,
- test_parameter_3)));
+ EXPECT_TRUE((IsKeyExist<Parameters, std::string>(
+ *another_loaded_parameters.parameters, test_parameter_3)));
}
TEST_F(SQLPTExtRepresentationTest, JsonContentsExternalConsent_ExpectParsed) {
diff --git a/src/components/policy/policy_external/test/sql_pt_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_representation_test.cc
index 0b0831eaad..2f85f8dc0a 100644
--- a/src/components/policy/policy_external/test/sql_pt_representation_test.cc
+++ b/src/components/policy/policy_external/test/sql_pt_representation_test.cc
@@ -29,39 +29,38 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <vector>
-#include <string>
-#include <algorithm>
-#include <fstream>
#include <stdio.h>
#include <sys/stat.h>
+#include <algorithm>
+#include <fstream>
#include <memory>
+#include <string>
+#include <vector>
#include "gtest/gtest.h"
-#include "policy/sql_pt_representation.h"
-#include "utils/file_system.h"
-#include "utils/system.h"
-#include "policy/sql_wrapper.h"
-#include "policy/policy_types.h"
-#include "json/writer.h"
#include "json/reader.h"
-#include "policy/policy_table/types.h"
+#include "json/writer.h"
+#include "policy/mock_policy_settings.h"
#include "policy/policy_table/enums.h"
+#include "policy/policy_table/types.h"
+#include "policy/policy_types.h"
+#include "policy/sql_pt_representation.h"
+#include "policy/sql_wrapper.h"
#include "rpc_base/rpc_base.h"
-#include "policy/mock_policy_settings.h"
-#include "utils/shared_ptr.h"
+#include "utils/file_system.h"
+#include "utils/system.h"
namespace policy_table = rpc::policy_table_interface_base;
-using policy::SQLPTRepresentation;
using policy::CheckPermissionResult;
-using policy::UserFriendlyMessage;
using policy::EndpointUrls;
+using policy::SQLPTRepresentation;
+using policy::UserFriendlyMessage;
using policy::VehicleInfo;
-using testing::ReturnRef;
-using testing::Return;
-using testing::NiceMock;
using testing::Mock;
+using testing::NiceMock;
+using testing::Return;
+using testing::ReturnRef;
namespace test {
namespace components {
@@ -81,14 +80,14 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
static const std::string kDatabaseName;
static utils::dbms::SQLQuery* query_wrapper_;
// Gtest can show message that this object doesn't destroyed
- static std::auto_ptr<policy_handler_test::MockPolicySettings>
+ static std::unique_ptr<policy_handler_test::MockPolicySettings>
policy_settings_;
static void SetUpTestCase() {
const std::string kAppStorageFolder = "storage_SQLPTRepresentationTest";
reps = new SQLPTRepresentation(in_memory_);
ASSERT_TRUE(reps != NULL);
- policy_settings_ = std::auto_ptr<policy_handler_test::MockPolicySettings>(
+ policy_settings_ = std::unique_ptr<policy_handler_test::MockPolicySettings>(
new policy_handler_test::MockPolicySettings());
ON_CALL(*policy_settings_, app_storage_folder())
.WillByDefault(ReturnRef(kAppStorageFolder));
@@ -177,7 +176,7 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
policy_table::Strings& temp_groups = apps_iter->second.groups;
StringsCompare(groups, temp_groups);
EXPECT_EQ(0u, (*(apps_iter->second.nicknames)).size());
- EXPECT_EQ(prio, apps_iter->second.priority);
+ EXPECT_EQ(prio, (apps_iter->second).priority);
EXPECT_EQ(0u, (*(apps_iter->second.AppHMIType)).size());
EXPECT_EQ(memory_kb, (*(apps_iter->second.memory_kb)));
EXPECT_EQ(heart_beat_timeout_ms,
@@ -348,7 +347,7 @@ SQLPTRepresentation* SQLPTRepresentationTest::reps = 0;
utils::dbms::SQLQuery* SQLPTRepresentationTest::query_wrapper_ = 0;
const std::string SQLPTRepresentationTest::kDatabaseName = ":memory:";
const bool SQLPTRepresentationTest::in_memory_ = true;
-std::auto_ptr<policy_handler_test::MockPolicySettings>
+std::unique_ptr<policy_handler_test::MockPolicySettings>
SQLPTRepresentationTest::policy_settings_;
class SQLPTRepresentationTest2 : public ::testing::Test {
@@ -377,6 +376,99 @@ class SQLPTRepresentationTest2 : public ::testing::Test {
const uint16_t kAttemptsToOpenPolicyDB = 2u;
};
+TEST_F(SQLPTRepresentationTest, VehicleDataItem_Store_Item) {
+ policy_table::VehicleDataItem rpm;
+ rpm.mark_initialized();
+ rpm.name = "rpm";
+ rpm.type = "Integer";
+ rpm.key = "OEM_REF_RPM";
+ rpm.mandatory = false;
+ *rpm.array = false;
+ rpm.params->mark_initialized();
+ ASSERT_FALSE(reps->VehicleDataItemExists(rpm));
+ ASSERT_TRUE(reps->InsertVehicleDataItem(rpm));
+ ASSERT_TRUE(reps->VehicleDataItemExists(rpm));
+
+ auto rpm_retrieved = reps->GetVehicleDataItem(rpm.name, rpm.key);
+
+ std::cout << rpm.ToJsonValue().toStyledString() << std::endl;
+ std::cout << rpm_retrieved.ToJsonValue().toStyledString() << std::endl;
+
+ ASSERT_EQ(rpm.ToJsonValue(), rpm_retrieved.begin()->ToJsonValue());
+}
+
+TEST_F(SQLPTRepresentationTest, VehicleDataItem_Store_Complete_Item) {
+ policy_table::VehicleDataItem message;
+ message.name = "messsageName";
+ message.type = "String";
+ message.key = "OEM_REF_MSG";
+ message.mandatory = false;
+ *message.array = false;
+ *message.since = "1.0";
+ *message.until = "5.0";
+ *message.removed = false;
+ *message.deprecated = false;
+ *message.minvalue = 0;
+ *message.maxvalue = 255;
+ *message.minsize = 0;
+ *message.maxsize = 255;
+ *message.minlength = 0;
+ *message.maxlength = 255;
+ message.params->mark_initialized();
+ ASSERT_TRUE(reps->InsertVehicleDataItem(message));
+
+ auto message_retrieved = reps->GetVehicleDataItem(message.name, message.key);
+ ASSERT_EQ(message.ToJsonValue(), message_retrieved.begin()->ToJsonValue());
+}
+
+TEST_F(SQLPTRepresentationTest, VehicleDataItem_Store_Struct) {
+ policy_table::VehicleDataItem alss;
+ alss.mark_initialized();
+ alss.name = "ambientLightSensorStatus";
+ alss.type = "AmbientLightStatus";
+ alss.key = "OEM_REF_AMB_LIGHT";
+ alss.mandatory = false;
+ alss.params->mark_initialized();
+ policy_table::VehicleDataItem lss;
+ lss.mark_initialized();
+ lss.name = "LightSensorStatus";
+ lss.type = "Struct";
+ lss.key = "OEM_REF_SEN_LIGHT";
+ lss.mandatory = false;
+ lss.params->mark_initialized();
+ (*lss.params).push_back(alss);
+
+ policy_table::VehicleDataItem hbo;
+ hbo.mark_initialized();
+ hbo.name = "highBeamsOn";
+ hbo.type = "Boolean";
+ hbo.key = "OEM_REF_HIGH_BEAM";
+ hbo.mandatory = true;
+ hbo.params->mark_initialized();
+ policy_table::VehicleDataItem lbo;
+ lbo.mark_initialized();
+ lbo.name = "lowBeamsOn";
+ lbo.type = "Boolean";
+ lbo.key = "OEM_REF_LOW_BEAM";
+ lbo.mandatory = false;
+ lbo.params->mark_initialized();
+ policy_table::VehicleDataItem hls;
+ hls.mark_initialized();
+ hls.name = "headLampStatus";
+ hls.type = "Struct";
+ hls.key = "OEM_REF_HLSTATUS";
+ hls.mandatory = false;
+ hls.params->mark_initialized();
+ (*hls.params).push_back(lss);
+ (*hls.params).push_back(lbo);
+ (*hls.params).push_back(hbo);
+ ASSERT_TRUE(reps->InsertVehicleDataItem(alss));
+ ASSERT_TRUE(reps->InsertVehicleDataItem(hls));
+
+ auto hls_retrieved = reps->GetVehicleDataItem(hls.name, hls.key);
+ ASSERT_EQ(hls.ToJsonValue(), hls_retrieved.begin()->ToJsonValue());
+}
+
TEST_F(SQLPTRepresentationTest2,
CheckActualAttemptsToOpenDB_ExpectCorrectNumber) {
EXPECT_EQ(::policy::FAIL, reps->Init(&policy_settings_));
@@ -407,8 +499,8 @@ TEST_F(SQLPTRepresentationTest,
query.Prepare(query_select);
query.Next();
- // 33 - is current total tables number created by schema
- const int policy_tables_number = 33;
+ // 41 - is current total tables number created by schema
+ const int policy_tables_number = 41;
ASSERT_EQ(policy_tables_number, query.GetInteger(0));
const std::string query_select_count_of_iap_buffer_full =
@@ -966,25 +1058,6 @@ TEST_F(
ASSERT_EQ(0, query.GetInteger(0));
}
-TEST_F(
- SQLPTRepresentationTest,
- GetVehicleInfo_ManuallySetVehcleInfoThenCallGetVehicleInfo_ExpectValuesReceived) {
- // Check
- const std::string query_insert_module_config =
- "UPDATE `module_config` SET `preloaded_pt` = 1, "
- " `exchange_after_x_ignition_cycles` = 50,"
- " `exchange_after_x_kilometers` = 2000, `exchange_after_x_days` = 30,"
- " `timeout_after_x_seconds` = 5, `vehicle_make` = 'FORD', "
- " `vehicle_model` = 'MUSTANG', `vehicle_year` = '2003', "
- "`preloaded_date` = '25.04.2015'";
- ASSERT_TRUE(query_wrapper_->Exec(query_insert_module_config));
- VehicleInfo info = reps->GetVehicleInfo();
-
- ASSERT_EQ("FORD", info.vehicle_make);
- ASSERT_EQ("MUSTANG", info.vehicle_model);
- ASSERT_EQ("2003", info.vehicle_year);
-}
-
TEST_F(SQLPTRepresentationTest,
GetUserFriendlyMsg_SetMsg_ExpectReceivedMsgSetInParams) {
// Arrange
@@ -1585,7 +1658,7 @@ TEST_F(SQLPTRepresentationTest,
ASSERT_TRUE(reps->Save(update));
// Act
- utils::SharedPtr<policy_table::Table> snapshot = reps->GenerateSnapshot();
+ std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot();
snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT);
// Remove fields which must be absent in snapshot
table["policy_table"]["consumer_friendly_messages"].removeMember("messages");
@@ -1609,13 +1682,15 @@ TEST_F(SQLPTRepresentationTest,
table["policy_table"]["module_meta"] = Json::Value(Json::objectValue);
table["policy_table"]["module_config"]["preloaded_pt"] = Json::Value(false);
policy_table::Table expected(&table);
- Json::StyledWriter writer;
+ Json::StreamWriterBuilder writer_builder;
// Checks
- EXPECT_EQ(writer.write(expected.ToJsonValue()),
- writer.write(snapshot->ToJsonValue()));
- std::cout << writer.write(snapshot->ToJsonValue()) << std::endl;
+ Json::Value snapshot_json_value = snapshot->ToJsonValue();
+ EXPECT_EQ(Json::writeString(writer_builder, expected.ToJsonValue()),
+ Json::writeString(writer_builder, snapshot_json_value));
+ std::cout << Json::writeString(writer_builder, snapshot_json_value)
+ << std::endl;
EXPECT_EQ(expected.ToJsonValue().toStyledString(),
- snapshot->ToJsonValue().toStyledString());
+ snapshot_json_value.toStyledString());
}
TEST_F(SQLPTRepresentationTest,
@@ -1696,9 +1771,8 @@ TEST_F(SQLPTRepresentationTest,
const ::policy_table::Parameters& parameters = *(rpc_iter->second.parameters);
EXPECT_EQ(1u, parameters.size());
- EXPECT_TRUE(parameters.end() != std::find(parameters.begin(),
- parameters.end(),
- policy_table::Parameter::P_SPEED));
+ EXPECT_TRUE(parameters.end() !=
+ std::find(parameters.begin(), parameters.end(), "P_SPEED"));
// Check Application Policies Section
GatherApplicationPoliciesSection(&policies);
const uint32_t apps_size = 3u;
diff --git a/src/components/policy/policy_external/test/update_status_manager_test.cc b/src/components/policy/policy_external/test/update_status_manager_test.cc
index 5546984ff4..29952bd18e 100644
--- a/src/components/policy/policy_external/test/update_status_manager_test.cc
+++ b/src/components/policy/policy_external/test/update_status_manager_test.cc
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "policy/update_status_manager.h"
#include "gtest/gtest.h"
#include "policy/mock_policy_listener.h"
+#include "policy/mock_ptu_retry_handler.h"
#include "policy/policy_manager_impl.h"
-#include "policy/update_status_manager.h"
-#include "utils/make_shared.h"
+
#include "utils/conditional_variable.h"
namespace test {
@@ -43,24 +44,26 @@ namespace policy_test {
using namespace ::policy;
using ::testing::_;
-using ::testing::Return;
using testing::NiceMock;
+using ::testing::Return;
class UpdateStatusManagerTest : public ::testing::Test {
protected:
- utils::SharedPtr<UpdateStatusManager> manager_;
+ std::shared_ptr<UpdateStatusManager> manager_;
PolicyTableStatus status_;
const uint32_t k_timeout_;
NiceMock<MockPolicyListener> listener_;
+ NiceMock<MockPTURetryHandler> mock_ptu_retry_handler_;
const std::string up_to_date_status_;
const std::string update_needed_status_;
const std::string updating_status_;
public:
UpdateStatusManagerTest()
- : manager_(utils::MakeShared<UpdateStatusManager>())
+ : manager_(std::make_shared<UpdateStatusManager>())
, k_timeout_(1000)
, listener_()
+ , mock_ptu_retry_handler_()
, up_to_date_status_("UP_TO_DATE")
, update_needed_status_("UPDATE_NEEDED")
, updating_status_("UPDATING") {}
@@ -68,6 +71,8 @@ class UpdateStatusManagerTest : public ::testing::Test {
void SetUp() OVERRIDE {
manager_->set_listener(&listener_);
ON_CALL(listener_, OnUpdateStatusChanged(_)).WillByDefault(Return());
+ ON_CALL(listener_, ptu_retry_handler())
+ .WillByDefault(ReturnRef(mock_ptu_retry_handler_));
}
void TearDown() OVERRIDE {}
@@ -105,12 +110,17 @@ class WaitAsync {
const uint32_t timeout_;
sync_primitives::ConditionalVariable cond_var_;
};
-}
+} // namespace
ACTION_P(NotifyAsync, waiter) {
waiter->Notify();
}
+ACTION_P2(RetryFailed, manager, listener) {
+ manager->OnResetRetrySequence();
+ listener->OnPTUFinished(false);
+}
+
TEST_F(UpdateStatusManagerTest,
OnUpdateSentOut_WaitForTimeoutExpired_ExpectStatusUpdateNeeded) {
// Arrange
@@ -131,6 +141,38 @@ TEST_F(UpdateStatusManagerTest,
EXPECT_EQ(StatusUpdateRequired, status_);
}
+TEST_F(
+ UpdateStatusManagerTest,
+ OnUpdateSentOut_WaitForTimeoutExpired_ExpectStatusUpdateNeeded_RetryExceeded) {
+ sync_primitives::Lock lock;
+ sync_primitives::AutoLock auto_lock(lock);
+ const uint32_t count = 3u;
+ const uint32_t timeout = 2u * k_timeout_;
+ WaitAsync waiter(count, timeout);
+ EXPECT_CALL(listener_, OnUpdateStatusChanged(_))
+ .WillRepeatedly(NotifyAsync(&waiter));
+ EXPECT_CALL(mock_ptu_retry_handler_, RetrySequenceFailed())
+ .WillOnce(RetryFailed(manager_, &listener_));
+ manager_->ScheduleUpdate();
+ manager_->OnUpdateSentOut(k_timeout_);
+ status_ = manager_->GetLastUpdateStatus();
+ {
+ ::testing::InSequence s;
+ EXPECT_CALL(mock_ptu_retry_handler_, IsAllowedRetryCountExceeded())
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(mock_ptu_retry_handler_, IsAllowedRetryCountExceeded())
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(mock_ptu_retry_handler_, IsAllowedRetryCountExceeded())
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(listener_, OnPTUFinished(false));
+ }
+ EXPECT_EQ(StatusUpdatePending, status_);
+ EXPECT_TRUE(waiter.Wait(auto_lock));
+ status_ = manager_->GetLastUpdateStatus();
+ // Check
+ EXPECT_EQ(StatusUpdateRequired, status_);
+}
+
TEST_F(UpdateStatusManagerTest,
OnUpdateTimeOutOccurs_ExpectStatusUpdateNeeded) {
// Arrange
@@ -245,7 +287,7 @@ TEST_F(UpdateStatusManagerTest, OnResetRetrySequence_ExpectStatusUpToDate) {
manager_->OnResetRetrySequence();
status_ = manager_->GetLastUpdateStatus();
// Check
- EXPECT_EQ(StatusUpdatePending, status_);
+ EXPECT_EQ(StatusUpdateRequired, status_);
}
TEST_F(UpdateStatusManagerTest,
@@ -287,42 +329,6 @@ TEST_F(UpdateStatusManagerTest, ScheduleUpdate_ExpectStatusUpdateNeeded) {
}
TEST_F(UpdateStatusManagerTest,
- OnPolicyInit_SetUpdateRequired_ExpectStatusUpdateNeeded) {
- // Arrange
- manager_->OnPolicyInit(true);
- status_ = manager_->GetLastUpdateStatus();
- // Checks
- EXPECT_EQ(StatusUpdateRequired, status_);
- EXPECT_FALSE(manager_->IsUpdatePending());
- EXPECT_TRUE(manager_->IsUpdateRequired());
-}
-
-TEST_F(UpdateStatusManagerTest,
- OnPolicyInit_SetUpdateNotRequired_ExpectStatusUpToDate) {
- // Arrange
- manager_->OnPolicyInit(false);
- status_ = manager_->GetLastUpdateStatus();
- // Checks
- EXPECT_EQ(StatusUpToDate, status_);
- EXPECT_FALSE(manager_->IsUpdatePending());
- EXPECT_FALSE(manager_->IsUpdateRequired());
-}
-
-TEST_F(UpdateStatusManagerTest,
- StringifiedUpdateStatus_SetStatuses_ExpectCorrectStringifiedStatuses) {
- // Arrange
- manager_->OnPolicyInit(false);
- // Check
- EXPECT_EQ("UP_TO_DATE", manager_->StringifiedUpdateStatus());
- manager_->OnPolicyInit(true);
- // Check
- EXPECT_EQ("UPDATE_NEEDED", manager_->StringifiedUpdateStatus());
- manager_->OnUpdateSentOut(k_timeout_);
- // Check
- EXPECT_EQ("UPDATING", manager_->StringifiedUpdateStatus());
-}
-
-TEST_F(UpdateStatusManagerTest,
OnAppSearchStartedCompleted_ExpectAppSearchCorrectStatus) {
// Arrange
manager_->OnAppsSearchStarted();
@@ -334,6 +340,12 @@ TEST_F(UpdateStatusManagerTest,
EXPECT_FALSE(manager_->IsAppsSearchInProgress());
}
-} // namespace policy
+TEST_F(UpdateStatusManagerTest, OnAppRegistered) {
+ manager_->ScheduleUpdate();
+ ASSERT_EQ(policy::kUpdateNeeded, manager_->StringifiedUpdateStatus());
+ manager_->ProcessEvent(policy::UpdateEvent::kOnNewAppRegistered);
+ EXPECT_EQ(policy::kUpdateNeeded, manager_->StringifiedUpdateStatus());
+}
+} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/policy/policy_regular/CMakeLists.txt b/src/components/policy/policy_regular/CMakeLists.txt
index 225e99329a..e14057ec89 100644
--- a/src/components/policy/policy_regular/CMakeLists.txt
+++ b/src/components/policy/policy_regular/CMakeLists.txt
@@ -30,24 +30,81 @@
include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/platform.cmake)
include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
+include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/generators.cmake)
include_directories (
- ${POLICY_PATH}/include
- ${POLICY_GLOBAL_INCLUDE_PATH}/
- ${COMPONENTS_DIR}/rpc_base/include
- ${JSONCPP_INCLUDE_DIRECTORY}
+ ${POLICY_PATH}/include/
+ ${COMPONENTS_DIR}/
${COMPONENTS_DIR}/utils/include/
${COMPONENTS_DIR}/config_profile/include
- ${LOG4CXX_INCLUDE_DIRECTORY}
+ ${COMPONENTS_DIR}/connection_handler/include/
+ ${COMPONENTS_DIR}/protocol_handler/include/
+ ${COMPONENTS_DIR}/config_profile/include/
+ ${COMPONENTS_DIR}/smart_objects/include/
+ ${COMPONENTS_DIR}/rpc_base/include/
+ ${CMAKE_BINARY_DIR}/src/components/
+ ${POLICY_GLOBAL_INCLUDE_PATH}/
+ ${BOOST_INCLUDE_DIR}/
+ ${JSONCPP_INCLUDE_DIRECTORY}/
+ ${LOG4CXX_INCLUDE_DIRECTORY}/
)
+set(GENERATED_MOBILE_POLICY_TYPES_CPP
+ "${CMAKE_CURRENT_BINARY_DIR}/generated_MOBILE_API_policy_types.cc"
+ "${CMAKE_CURRENT_BINARY_DIR}/generated_MOBILE_API_enum_schema_factory.cc")
+
+set(GENERATED_MOBILE_POLICY_TYPES_HPP
+ "${CMAKE_CURRENT_BINARY_DIR}/generated_MOBILE_API_policy_types.h")
+
+set(GENERATED_MOBILE_POLICY_TYPES
+ ${GENERATED_MOBILE_POLICY_TYPES_HPP}
+ ${GENERATED_MOBILE_POLICY_TYPES_CPP})
+
+generate_policy_types("${GENERATED_MOBILE_POLICY_TYPES}"
+ "${COMPONENTS_DIR}/interfaces/MOBILE_API.xml"
+ "rpc::policy_table_interface_base"
+ "mobile-policy-types")
+
+
+set(GENERATED_HMI_POLICY_TYPES_CPP
+ "${CMAKE_CURRENT_BINARY_DIR}/generated_HMI_API_policy_types.cc")
+
+set(GENERATED_HMI_POLICY_TYPES_HPP
+ "${CMAKE_CURRENT_BINARY_DIR}/generated_HMI_API_policy_types.h")
+
+set(GENERATED_HMI_POLICY_TYPES
+ ${GENERATED_HMI_POLICY_TYPES_HPP}
+ ${GENERATED_HMI_POLICY_TYPES_CPP})
+
+
+generate_policy_types("${GENERATED_HMI_POLICY_TYPES}"
+ "${COMPONENTS_DIR}/interfaces/HMI_API.xml"
+ "rpc::policy_table_interface_base"
+ "hmi-policy-types")
+
set(POLICY_TABLE_PATHS
${CMAKE_CURRENT_SOURCE_DIR}/include/policy/policy_table
${CMAKE_CURRENT_SOURCE_DIR}/src/policy_table
+ ${CMAKE_CURRENT_BINARY_DIR}/
+)
+
+set(POLICY_TABLE_SOURCES
+ ${GENERATED_MOBILE_POLICY_TYPES_CPP}
+ ${GENERATED_HMI_POLICY_TYPES_CPP}
+ ${POLICY_PATH}/src/policy_table/enums.cc
+ ${POLICY_PATH}/src/policy_table/types.cc
+ ${POLICY_PATH}/src/policy_table/validation.cc
)
-collect_sources(POLICY_TABLE_SOURCES "${POLICY_TABLE_PATHS}")
+
add_library(policy_struct ${POLICY_TABLE_SOURCES})
-target_link_libraries(policy_struct Utils)
+target_link_libraries(policy_struct
+ MOBILE_API
+ HMI_API
+ Utils
+ SmartObjects
+ formatters
+ jsoncpp
+)
set(USAGE_STATISTICS_PATHS
${CMAKE_CURRENT_SOURCE_DIR}/include/policy/usage_statistics
@@ -60,8 +117,6 @@ target_link_libraries(UsageStatistics Utils)
set(EXCLUDE_PATHS
${POLICY_TABLE_PATHS}
${USAGE_STATISTICS_PATHS}
- sql_pt_ext_queries.cc
- sql_pt_ext_representation.cc
)
set(PATHS
@@ -75,7 +130,6 @@ set(LIBRARIES
ConfigProfile
policy_struct
dbms
- jsoncpp
Utils
)
@@ -88,8 +142,13 @@ else ()
list(APPEND LIBRARIES sqlite3)
endif ()
-add_library(Policy SHARED ${SOURCES})
-target_link_libraries(Policy ${LIBRARIES})
+
+add_library(PolicyStatic ${SOURCES})
+target_link_libraries(PolicyStatic ${LIBRARIES})
+
+
+add_library(Policy SHARED "src/policy_manager_impl.cc")
+target_link_libraries(Policy PolicyStatic)
if(ENABLE_LOG)
target_link_libraries(Policy log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
diff --git a/src/components/policy/policy_regular/doc/doxygen/components/JSONHandler/Formatters/index.txt b/src/components/policy/policy_regular/doc/doxygen/components/JSONHandler/Formatters/index.txt
index 9854b88d5f..0144efaf7f 100644
--- a/src/components/policy/policy_regular/doc/doxygen/components/JSONHandler/Formatters/index.txt
+++ b/src/components/policy/policy_regular/doc/doxygen/components/JSONHandler/Formatters/index.txt
@@ -1,9 +1,9 @@
-/*! \page components_jsonhandler_formatters Smart Objects Formatters
+/*! \page components_jsonhandler_formatters Smart Objects formatters
In order to create JSON string representation from Smart Object or create Smart Object data structure from JSON string representation JSON Handler component has special classes called formatters.
-The interface of formatter is quite simple and defined by NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase class. Actually it has two methods - NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::objToJsonValue to convert JSON string to object and NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::jsonValueToObj to create JSON string from object.
+The interface of formatter is quite simple and defined by ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase class. Actually it has two methods - ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase::objToJsonValue to convert JSON string to object and ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase::jsonValueToObj to create JSON string from object.
-Current implementation has two different implementations of NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase class: NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonALRPCv1 for ALRPC.v1 and NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonALRPCv2 for ALRPC.v2. These implementations handle specifics of each format.
+Current implementation has two different implementations of ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase class: ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonALRPCv1 for ALRPC.v1 and ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonALRPCv2 for ALRPC.v2. These implementations handle specifics of each format.
*/
diff --git a/src/components/policy/policy_regular/include/policy/access_remote.h b/src/components/policy/policy_regular/include/policy/access_remote.h
index c4de9b7e1f..c0df6b729f 100644
--- a/src/components/policy/policy_regular/include/policy/access_remote.h
+++ b/src/components/policy/policy_regular/include/policy/access_remote.h
@@ -32,9 +32,9 @@
#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_ACCESS_REMOTE_H_
#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_ACCESS_REMOTE_H_
-#include <vector>
#include <ostream>
#include <string>
+#include <vector>
#include "policy/policy_table/types.h"
#include "policy/policy_types.h"
diff --git a/src/components/policy/policy_regular/include/policy/access_remote_impl.h b/src/components/policy/policy_regular/include/policy/access_remote_impl.h
index 933690dc49..dbe317667a 100644
--- a/src/components/policy/policy_regular/include/policy/access_remote_impl.h
+++ b/src/components/policy/policy_regular/include/policy/access_remote_impl.h
@@ -35,7 +35,7 @@
#include <map>
#include "policy/policy_table/types.h"
#include "utils/macro.h"
-#include "utils/shared_ptr.h"
+
#include "policy/access_remote.h"
#include "policy/cache_manager.h"
@@ -46,7 +46,7 @@ namespace policy {
class AccessRemoteImpl : public AccessRemote {
public:
AccessRemoteImpl();
- explicit AccessRemoteImpl(utils::SharedPtr<CacheManager> cache);
+ explicit AccessRemoteImpl(std::shared_ptr<CacheManager> cache);
/**
* @brief CheckModuleType check if module type is allowed for application
* @param app_id application id
@@ -139,7 +139,7 @@ class AccessRemoteImpl : public AccessRemote {
/**
* @brief cache_ contains pointer to cache manager instance
*/
- utils::SharedPtr<CacheManager> cache_;
+ std::shared_ptr<CacheManager> cache_;
/**
* @brief hmi_types_ contains list of default HMI types for applications
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h
index 4a0a09db83..00f0adab06 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager.h
@@ -35,17 +35,15 @@
#include <map>
-#include "utils/shared_ptr.h"
+#include "policy/cache_manager_interface.h"
#include "policy/pt_representation.h"
-#include "policy/pt_ext_representation.h"
#include "policy/usage_statistics/statistics_manager.h"
-#include "policy/cache_manager_interface.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
-#include "utils/lock.h"
-#include "utils/conditional_variable.h"
#include "policy/policy_types.h"
+#include "utils/conditional_variable.h"
+#include "utils/lock.h"
namespace policy {
class PolicySettings;
@@ -144,9 +142,113 @@ class CacheManager : public CacheManagerInterface {
virtual bool SecondsBetweenRetries(std::vector<int>& seconds);
/**
- * @brief Get information about vehicle
+ * @brief Gets copy of current policy table data
+ * @return policy_table as json object
+ */
+ virtual Json::Value GetPolicyTableData() const OVERRIDE;
+
+ /**
+ * @brief Gets vehicle data items
+ * @return Structure with vehicle data items
+ */
+ virtual const std::vector<policy_table::VehicleDataItem> GetVehicleDataItems()
+ const;
+
+ std::vector<policy_table::VehicleDataItem> GetRemovedVehicleDataItems()
+ const OVERRIDE;
+
+ const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
+
+ const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const OVERRIDE;
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const;
+
+ /**
+ * @brief Get a list of enabled local applications
+ * @return enabled_apps List filled with the policy app id of each enabled
+ * local application
+ */
+ std::vector<std::string> GetEnabledLocalApps() const OVERRIDE;
+
+ bool GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const OVERRIDE;
+
+ /**
+ * Initializes a new cloud application with default policies
+ * Then adds cloud specific policies
+ * @param app_id application id
+ * @return true if success
+ */
+ virtual void InitCloudApp(const std::string& policy_app_id);
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled);
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token);
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type);
+
+ /**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint);
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
*/
- virtual const VehicleInfo GetVehicleInfo() const;
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames);
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(const std::string& policy_app_id,
+ const std::string& hybrid_app_preference);
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const;
/**
* @brief Allows to update 'vin' field in module_meta table.
@@ -167,25 +269,28 @@ class CacheManager : public CacheManagerInterface {
* @return Array of appropriate messages parameters
*/
std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
- const std::vector<std::string>& msg_codes, const std::string& language);
+ const std::vector<std::string>& msg_codes,
+ const std::string& language) const;
/**
* @brief Get list of URLs related to particular service
* @param service_type If URLs for specific service are preset,
* return them otherwise default URLs.
*/
- virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points);
+ void GetUpdateUrls(const std::string& service_type,
+ EndpointUrls& out_end_points) const OVERRIDE;
+
+ void GetUpdateUrls(const uint32_t service_type,
+ EndpointUrls& out_end_points) const OVERRIDE;
- virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points);
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
*
- * @return url which point to the resourse where lock screen icon could be
+ * @return url which point to the resourse where icon could be
*obtained.
*/
- virtual std::string GetLockScreenIconUrl() const;
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const;
/**
* @brief Get allowed number of notifications
@@ -216,7 +321,7 @@ class CacheManager : public CacheManagerInterface {
* device_info, statistics, excluding user messages
* @return Generated structure for obtaining Json string.
*/
- virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot();
+ virtual std::shared_ptr<policy_table::Table> GenerateSnapshot();
/**
* Applies policy table to the current table
@@ -282,6 +387,12 @@ class CacheManager : public CacheManagerInterface {
bool GetFunctionalGroupings(policy_table::FunctionalGroupings& groups);
/**
+ * @brief Get policy app names from PT
+ * @return container of strings representing policy application names
+ */
+ const policy_table::Strings GetPolicyAppIDs() const OVERRIDE;
+
+ /**
* Checks if the application is represented in policy table
* @param app_id application id
* @return true if application is represented in policy table
@@ -721,9 +832,27 @@ class CacheManager : public CacheManagerInterface {
void MergeCFM(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt);
+ /**
+ * @brief MergeVD allows to merge VehicleDataItems section by
+ *definite rules.
+ *
+ * The rules are:
+ * 1. If vehicle_data_items key is not presented in the updated PolicyTable,
+ * update for VehicleDataItems should be ignored.
+ * 2. If vehicle_data_items presented in updated PolicyTable, the
+ * VehicleDataItems in the database (LocalPT) should be overwritten with
+ * updated data.
+ *
+ * @param new_pt the policy table loaded from updated preload JSON file.
+ *
+ * @param pt the exists database
+ */
+ void MergeVD(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt);
+
const PolicySettings& get_settings() const;
- utils::SharedPtr<policy_table::Table> pt() const {
+ std::shared_ptr<policy_table::Table> pt() const {
return pt_;
}
@@ -736,6 +865,24 @@ class CacheManager : public CacheManagerInterface {
void OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) OVERRIDE;
+ EncryptionRequired GetAppEncryptionRequiredFlag(
+ const std::string& application_policy_name) const OVERRIDE;
+
+ EncryptionRequired GetFunctionalGroupingEncryptionRequiredFlag(
+ const std::string& functional_group) const OVERRIDE;
+
+ void GetApplicationParams(
+ const std::string& application_name,
+ policy_table::ApplicationParams& application_policies) const OVERRIDE;
+
+ /**
+ * @brief Method for separate RPCSpec vehicle data items from custom
+ * @param full vehicle data items during PTU
+ * @return array with only custom vehicle items
+ */
+ static policy_table::VehicleDataItems CollectCustomVDItems(
+ const policy_table::VehicleDataItems& vd_items);
+
private:
std::string currentDateTime();
struct AppHMITypeToString {
@@ -755,6 +902,24 @@ class CacheManager : public CacheManagerInterface {
*/
void CheckSnapshotInitialization();
+ /**
+ * @brief Calculates difference between two provided custom vehicle data items
+ * @param items_before list of vehicle data items before PTU was applied
+ * @param items_after list of vehicle data items after PTU was applied
+ * @return list with calculated difference or empty list if two input lists
+ * are equal
+ */
+ policy_table::VehicleDataItems CalculateCustomVdItemsDiff(
+ const policy_table::VehicleDataItems& items_before,
+ const policy_table::VehicleDataItems& items_after) const;
+
+ /**
+ * @brief Sets the custom vehicle data items
+ * @param removed_items list of vehicle data items to set
+ */
+ void SetRemovedCustomVdItems(
+ const policy_table::VehicleDataItems& removed_items);
+
void PersistData();
/**
@@ -775,14 +940,15 @@ class CacheManager : public CacheManagerInterface {
policy::Permissions& permission);
private:
- utils::SharedPtr<policy_table::Table> pt_;
- utils::SharedPtr<policy_table::Table> snapshot_;
- utils::SharedPtr<PTRepresentation> backup_;
+ std::shared_ptr<policy_table::Table> pt_;
+ std::shared_ptr<policy_table::Table> snapshot_;
+ std::shared_ptr<PTRepresentation> backup_;
bool update_required;
typedef std::set<std::string> UnpairedDevices;
UnpairedDevices is_unpaired_;
+ policy_table::VehicleDataItems removed_custom_vd_items_;
- mutable sync_primitives::Lock cache_lock_;
+ mutable sync_primitives::RecursiveLock cache_lock_;
sync_primitives::Lock unpaired_lock_;
typedef std::map<std::string, Permissions> AppCalculatedPermissions;
diff --git a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
index 3dd2953865..fc1a6337aa 100644
--- a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
+++ b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h
@@ -35,12 +35,13 @@
#include <string>
#include <vector>
+#include "boost/optional.hpp"
-#include "utils/shared_ptr.h"
-#include "policy/usage_statistics/counter.h"
-#include "policy/policy_types.h"
#include "policy/policy_settings.h"
#include "policy/policy_table/types.h"
+#include "policy/policy_types.h"
+#include "policy/usage_statistics/counter.h"
+#include "utils/optional.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -148,11 +149,138 @@ class CacheManagerInterface {
virtual bool SecondsBetweenRetries(std::vector<int>& seconds) = 0;
/**
- * @brief Get information about vehicle
+ * @brief Gets copy of current policy table data
+ * @return policy_table as json object
+ */
+ virtual Json::Value GetPolicyTableData() const = 0;
+
+ /**
+ * @brief Gets vehicle data items
+ * @return Structure with vehicle data items
+ */
+ virtual const std::vector<policy_table::VehicleDataItem> GetVehicleDataItems()
+ const = 0;
+
+ /**
+ * @brief Gets vehicle data items removed after the last PTU
+ * @return List of removed vehicle data items
+ */
+ virtual std::vector<policy_table::VehicleDataItem>
+ GetRemovedVehicleDataItems() const = 0;
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ virtual void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const = 0;
+
+ /**
+ * @brief Get a list of enabled local applications
+ * @return enabled_apps List filled with the policy app id of each enabled
+ * local application
+ */
+ virtual std::vector<std::string> GetEnabledLocalApps() const = 0;
+
+ /**
+ * @brief Get app policy information, all fields that aren't set for a
+ * given app will be filled with empty strings
+ * @param policy_app_id policy app id
+ * @param out_app_properties application properties
+ * @return true if application presents in database, otherwise - false
+ */
+ virtual bool GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const = 0;
+
+ /**
+ * Initializes a new cloud application with default policies
+ * Then adds cloud specific policies
+ * @param app_id application id
+ * @return true if success
+ */
+ virtual void InitCloudApp(const std::string& policy_app_id) = 0;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
*/
- virtual const VehicleInfo GetVehicleInfo() const = 0;
+ virtual void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) = 0;
/**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
+ */
+ virtual void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) = 0;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ virtual void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) = 0;
+
+ /**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ virtual void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) = 0;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ virtual void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) = 0;
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ virtual void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) = 0;
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ virtual void GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const = 0;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ */
+ virtual bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Returns state of the lock screen that could be able to be dismissed
+ * while connected to SDL, allowing users the ability to interact with the
+ * app.
+ * @return bool True if lock screen can be dismissed.
+ */
+ virtual const boost::optional<bool> LockScreenDismissalEnabledState()
+ const = 0;
+
+ /**
+ * @brief Returns lock screen warning message. In case when specified language
+ * is absent in policy table will be returned message on default language
+ * ("en-us"). Otherwise returns uninitialized boost::optional<std::string>
+ * @return std::string Lock screen warning message
+ */
+ virtual const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language_code) const = 0;
+ /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
@@ -172,7 +300,7 @@ class CacheManagerInterface {
*/
virtual std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes,
- const std::string& language) = 0;
+ const std::string& language) const = 0;
/**
* @brief Get list of URLs related to particular service
@@ -180,17 +308,18 @@ class CacheManagerInterface {
* return them otherwise default URLs.
*/
virtual void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
virtual void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) = 0;
+ EndpointUrls& out_end_points) const = 0;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
*
- * @return url which point to the resourse where lock screen icon could be
+ * @return url which point to the resourse where icon could be
*obtained.
*/
- virtual std::string GetLockScreenIconUrl() const = 0;
+ virtual std::string GetIconUrl(const std::string& policy_app_id) const = 0;
/**
* @brief Get allowed number of notifications
@@ -222,7 +351,7 @@ class CacheManagerInterface {
* device_info, statistics, excluding user messages
* @return Generated structure for obtaining Json string.
*/
- virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() = 0;
+ virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() = 0;
/**
* Applies policy table to the current table
@@ -289,6 +418,12 @@ class CacheManagerInterface {
policy_table::FunctionalGroupings& groups) = 0;
/**
+ * @brief Get policy app names from PT
+ * @return container of strings representing policy application names
+ */
+ virtual const policy_table::Strings GetPolicyAppIDs() const = 0;
+
+ /**
* Checks if the application is represented in policy table
* @param app_id application id
* @return true if application is represented in policy table
@@ -349,10 +484,10 @@ class CacheManagerInterface {
std::string& default_hmi) const = 0;
/**
- * Gets HMI types from specific policy
- * @param app_id ID application
- * @return list of HMI types
- */
+ * Gets HMI types from specific policy
+ * @param app_id ID application
+ * @return list of HMI types
+ */
virtual const policy_table::AppHMITypes* GetHMITypes(
const std::string& app_id) = 0;
@@ -670,12 +805,12 @@ class CacheManagerInterface {
virtual std::string GetCertificate() const = 0;
/**
- * @brief pt allows to obtain SharedPtr to PT.
+ * @brief pt allows to obtain std::shared_ptr to PT.
* Used ONLY in Unit tests
- * @return SharedPTR to PT
+ * @return std::shared_ptr to PT
*
*/
- virtual utils::SharedPtr<policy_table::Table> pt() const = 0;
+ virtual std::shared_ptr<policy_table::Table> pt() const = 0;
/**
* @brief OnDeviceSwitching Processes existing policy permissions for devices
@@ -685,9 +820,39 @@ class CacheManagerInterface {
*/
virtual void OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) = 0;
+
+ /**
+ * @brief GetAppEncryptionRequiredFlag retrieves encryption required flag for
+ * given application
+ * @param application policy application name
+ * @return optional object containing encryption required flag
+ */
+ virtual rpc::Optional<rpc::Boolean> GetAppEncryptionRequiredFlag(
+ const std::string& application_policy_name) const = 0;
+
+ /**
+ * @brief GetFunctionalGroupingEncryptionRequiredFlag retrieves encryption
+ * required flag
+ * for
+ * given functional grouping
+ * @param functional_group policy functional group name
+ * @return optional object containing encryption required flag
+ */
+ virtual rpc::Optional<rpc::Boolean>
+ GetFunctionalGroupingEncryptionRequiredFlag(
+ const std::string& functional_group) const = 0;
+
+ /**
+ * @brief retreives application params
+ * @param application_name policy applicatoin name
+ * @param application_params application params
+ */
+ virtual void GetApplicationParams(
+ const std::string& application_name,
+ policy_table::ApplicationParams& application_params) const = 0;
};
-typedef utils::SharedPtr<CacheManagerInterface> CacheManagerInterfaceSPtr;
+typedef std::shared_ptr<CacheManagerInterface> CacheManagerInterfaceSPtr;
} // namespace policy
diff --git a/src/components/policy/policy_regular/include/policy/policy_helper.h b/src/components/policy/policy_regular/include/policy/policy_helper.h
index 7f27ab2676..d5155cf91b 100644
--- a/src/components/policy/policy_regular/include/policy/policy_helper.h
+++ b/src/components/policy/policy_regular/include/policy/policy_helper.h
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_HELPER_H_
#include "policy/policy_table/functions.h"
-#include "utils/shared_ptr.h"
+
#include "policy/policy_types.h"
namespace policy {
@@ -82,23 +82,12 @@ bool operator!=(const policy_table::ApplicationParams& first,
*/
struct CheckAppPolicy {
CheckAppPolicy(PolicyManagerImpl* pm,
- const utils::SharedPtr<policy_table::Table> update,
- const utils::SharedPtr<policy_table::Table> snapshot);
+ const std::shared_ptr<policy_table::Table> update,
+ const std::shared_ptr<policy_table::Table> snapshot,
+ CheckAppPolicyResults& out_results);
bool operator()(const AppPoliciesValueType& app_policy);
private:
- enum PermissionsCheckResult {
- RESULT_NO_CHANGES,
- RESULT_APP_REVOKED,
- RESULT_NICKNAME_MISMATCH,
- RESULT_PERMISSIONS_REVOKED,
- RESULT_CONSENT_NEEDED,
- RESULT_CONSENT_NOT_REQIURED,
- RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED,
- RESULT_REQUEST_TYPE_CHANGED,
- RESULT_REQUEST_SUBTYPE_CHANGED
- };
-
void SetPendingPermissions(const AppPoliciesValueType& app_policy,
PermissionsCheckResult result) const;
PermissionsCheckResult CheckPermissionsChanges(
@@ -107,6 +96,8 @@ struct CheckAppPolicy {
policy_table::Strings* revoked_groups = NULL) const;
bool HasNewGroups(const AppPoliciesValueType& app_policy,
policy_table::Strings* new_groups = NULL) const;
+ bool HasUpdatedGroups(const policy::AppPoliciesValueType& app_policy,
+ policy_table::Strings* updated_groups = NULL) const;
bool HasConsentNeededGroups(const AppPoliciesValueType& app_policy) const;
std::vector<FunctionalGroupPermission> GetRevokedGroups(
const AppPoliciesValueType& app_policy) const;
@@ -115,10 +106,18 @@ struct CheckAppPolicy {
const std::vector<FunctionalGroupPermission>& revoked_groups) const;
bool IsKnownAppication(const std::string& application_id) const;
void NotifySystem(const AppPoliciesValueType& app_policy) const;
- void SendPermissionsToApp(const std::string& app_id,
- const policy_table::Strings& groups) const;
bool IsAppRevoked(const AppPoliciesValueType& app_policy) const;
bool NicknamesMatch(const AppPoliciesValueType& app_policy) const;
+
+ /**
+ * @brief Check of current policy against incoming updated policy is
+ * performed.
+ * This function adds result code of this check to container.
+ * @param app_id Application id
+ * @param result Result value
+ */
+ void AddResult(const std::string& app_id, PermissionsCheckResult result);
+
/**
* @brief Allows to check if appropriate group requires any consent.
* @param group_name the group for which consent will be checked.
@@ -129,10 +128,35 @@ struct CheckAppPolicy {
bool IsRequestTypeChanged(const AppPoliciesValueType& app_policy) const;
bool IsRequestSubTypeChanged(const AppPoliciesValueType& app_policy) const;
+ bool IsEncryptionRequiredFlagChanged(
+ const AppPoliciesValueType& app_policy) const;
+
+ bool IsAppPropertiesChanged(const AppPoliciesValueType& app_policy) const;
+
+ bool IsAppPropertiesProvided(const AppPoliciesValueType& app_policy) const;
+
private:
PolicyManagerImpl* pm_;
- const utils::SharedPtr<policy_table::Table> update_;
- const utils::SharedPtr<policy_table::Table> snapshot_;
+ const std::shared_ptr<policy_table::Table> update_;
+ const std::shared_ptr<policy_table::Table> snapshot_;
+ CheckAppPolicyResults& out_results_;
+};
+
+/**
+ * @brief Helper struct for filling actions to be done for processed application
+ * using CheckAppPolicyResults data as a source
+ */
+struct FillActionsForAppPolicies {
+ FillActionsForAppPolicies(
+ ApplicationsPoliciesActions& actions,
+ const policy_table::ApplicationPolicies& app_policies)
+ : actions_(actions), app_policies_(app_policies) {}
+
+ void operator()(const policy::CheckAppPolicyResults::value_type& value);
+
+ private:
+ ApplicationsPoliciesActions& actions_;
+ const policy_table::ApplicationPolicies& app_policies_;
};
/*
@@ -174,6 +198,9 @@ struct ProcessFunctionalGroup {
private:
GroupConsent GetGroupState(const std::string& group_name);
+ void FillEncryptionFlagForRpcs(
+ const policy_table::Rpc& rpcs,
+ const policy::EncryptionRequired encryption_required);
const policy_table::FunctionalGroupings& fg_;
const std::vector<FunctionalGroupPermission>& group_permissions_;
Permissions& data_;
@@ -246,6 +273,6 @@ FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first,
* @return true, if succeded, otherwise - false
*/
bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies);
-}
+} // namespace policy
#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_HELPER_H_
diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
index c162d73011..aa77019613 100644
--- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
@@ -33,22 +33,22 @@
#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_MANAGER_IMPL_H_
#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_MANAGER_IMPL_H_
-#include <string>
-#include <list>
#include <cstdint>
+#include <list>
+#include <string>
-#include "utils/shared_ptr.h"
-#include "utils/lock.h"
+#include "application_manager/policies/policy_encryption_flag_getter.h"
+#include "policy/access_remote.h"
+#include "policy/access_remote_impl.h"
+#include "policy/cache_manager_interface.h"
+#include "policy/policy_helper.h"
#include "policy/policy_manager.h"
#include "policy/policy_table.h"
-#include "policy/cache_manager_interface.h"
-#include "policy/update_status_manager.h"
#include "policy/policy_table/functions.h"
+#include "policy/update_status_manager.h"
#include "policy/usage_statistics/statistics_manager.h"
-#include "policy/policy_helper.h"
+#include "utils/lock.h"
#include "utils/timer.h"
-#include "policy/access_remote.h"
-#include "policy/access_remote_impl.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -58,6 +58,45 @@ struct CheckAppPolicy;
class PolicyManagerImpl : public PolicyManager {
public:
PolicyManagerImpl();
+ /*
+ * \param policy_app_id policy app id
+ * \return true if the app need encryption
+ */
+ bool AppNeedEncryption(const std::string& policy_app_id) const OVERRIDE;
+
+ /*
+ * \param policy_app_id policy app id
+ * \return Optional app need encryption
+ */
+ const rpc::Optional<rpc::Boolean> GetAppEncryptionRequired(
+ const std::string& policy_app_id) const OVERRIDE;
+ /*
+ * \param policy_app_id policy app id
+ * \return groups that exist for app
+ */
+ const std::vector<std::string> GetFunctionalGroupsForApp(
+ const std::string& policy_app_id) const OVERRIDE;
+
+ const std::vector<std::string> GetApplicationPolicyIDs() const OVERRIDE;
+
+ /*
+ * \param policy_group group
+ * \return true if the group need encryption
+ */
+ bool FunctionGroupNeedEncryption(
+ const std::string& policy_group) const OVERRIDE;
+ /*
+ * \param policy_group group
+ * \return RPCs that exists in group
+ */
+ const std::vector<std::string> GetRPCsForFunctionGroup(
+ const std::string& group) const OVERRIDE;
+ /*
+ * \param function_id function id
+ * \return policy function name
+ */
+ const std::string GetPolicyFunctionName(
+ const uint32_t function_id) const OVERRIDE;
/**
* @brief set_listener set new policy listener instance
@@ -90,8 +129,35 @@ class PolicyManagerImpl : public PolicyManager {
* @param pt_content PTU as binary string
* @return true if successfully
*/
- bool LoadPT(const std::string& file,
- const BinaryMessage& pt_content) OVERRIDE;
+ PtProcessingResult LoadPT(const std::string& file,
+ const BinaryMessage& pt_content) OVERRIDE;
+
+ void OnPTUFinished(const PtProcessingResult ptu_result) OVERRIDE;
+
+ typedef policy_table::ApplicationPolicies::value_type AppPoliciesValueType;
+
+ /**
+ * @brief Notifies system by sending OnAppPermissionChanged notification
+ * @param device_id device identifier
+ * @param app_policy Reference to application policy
+ */
+ void NotifySystem(const std::string& device_id,
+ const AppPoliciesValueType& app_policy) const;
+
+ /**
+ * @brief Sends OnPermissionChange notification to application if its
+ * currently registered
+ * @param device_id device identifier
+ * @param app_policy Reference to application policy
+ */
+ void SendPermissionsToApp(const std::string& device_id,
+ const AppPoliciesValueType& app_policy);
+
+ /**
+ * @brief Resumes all policy actions for all apps, suspended during
+ * PTU applying
+ */
+ void ResumePendingAppPolicyActions();
/**
* @brief Resets Policy Table
@@ -106,21 +172,23 @@ class PolicyManagerImpl : public PolicyManager {
* @param out_end_points output vector of urls
*/
void GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
void GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) OVERRIDE;
+ EndpointUrls& out_end_points) const OVERRIDE;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- * @return url which point to the resourse where lock screen icon could be
+ * @brief Get Icon Url used for showing a cloud apps icon before the intial
+ *registration
+ *
+ * @return url which point to the resourse where icon could be
*obtained.
*/
- std::string GetLockScreenIconUrl() const OVERRIDE;
+ std::string GetIconUrl(const std::string& policy_app_id) const OVERRIDE;
/**
* @brief PTU is needed, for this PTS has to be formed and sent.
*/
- bool RequestPTUpdate() OVERRIDE;
+ bool RequestPTUpdate(const PTUIterationType iteration_type) OVERRIDE;
/**
* @brief Check if specified RPC for specified application
@@ -154,6 +222,11 @@ class PolicyManagerImpl : public PolicyManager {
*/
void KmsChanged(int kilometers) OVERRIDE;
+ const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
+
+ const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const OVERRIDE;
+
/**
* @brief Increments counter of ignition cycles
*/
@@ -165,6 +238,8 @@ class PolicyManagerImpl : public PolicyManager {
*/
std::string ForcePTExchange() OVERRIDE;
+ void StopRetrySequence() OVERRIDE;
+
/**
* @brief Exchange by user request
* @return Current status of policy table
@@ -179,8 +254,10 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Resets retry sequence
+ * @param send_event - if true corresponding event is sent to
+ * UpdateStatusManager
*/
- void ResetRetrySequence();
+ void ResetRetrySequence(const ResetRetryCountType reset_type) OVERRIDE;
/**
* @brief Gets timeout to wait before next retry updating PT
@@ -252,12 +329,15 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Update Application Policies as reaction
* on User allowing/disallowing device this app is running on.
+ * @param device_handle device identifier
* @param app_id Unique application id
* @param is_device_allowed true if user allowing device otherwise false
* @return true if operation was successful
*/
- bool ReactOnUserDevConsentForApp(const std::string app_id,
- const bool is_device_allowed) OVERRIDE;
+ bool ReactOnUserDevConsentForApp(
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string app_id,
+ const bool is_device_allowed) OVERRIDE;
/**
* @brief Retrieves data from app_policies about app on its registration:
@@ -298,12 +378,14 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Get default HMI level for application
+ * @param device_id device identifier
* @param policy_app_id Unique application id
* @param default_hmi Default HMI level for application or empty, if value
* was not set
* @return true, if succedeed, otherwise - false
*/
- bool GetDefaultHmi(const std::string& policy_app_id,
+ bool GetDefaultHmi(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi) const OVERRIDE;
/**
@@ -346,9 +428,11 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Return device id, which hosts specific application
+ * @param device_handle device identifier
* @param policy_app_id Application id, which is required to update device id
*/
std::string& GetCurrentDeviceId(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) const OVERRIDE;
/**
@@ -368,13 +452,6 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& language) OVERRIDE;
/**
- * @brief Runs necessary operations, which is depends on external system
- * state, e.g. getting system-specific parameters which are need to be
- * filled into policy table
- */
- void OnSystemReady() OVERRIDE;
-
- /**
* @brief Get number of notification by priority
* @param priority Specified priority
* @return notification number
@@ -390,11 +467,12 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Gets specific application permissions changes since last policy
* table update
+ * @param device_id device identifier
* @param policy_app_id Unique application id
* @return Permissions changes
*/
AppPermissions GetAppPermissionsChanges(
- const std::string& policy_app_id) OVERRIDE;
+ const std::string& device_id, const std::string& policy_app_id) OVERRIDE;
/**
* @brief Removes specific application permissions changes
@@ -404,10 +482,11 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Send OnPermissionsUpdated for choosen application
+ * @param device_id device identifier
* @param application_id Unique application id
*/
void SendNotificationOnPermissionsUpdated(
- const std::string& application_id) OVERRIDE;
+ const std::string& device_id, const std::string& application_id) OVERRIDE;
/**
* @brief Removes unpaired device records and related records from DB
@@ -438,20 +517,24 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Adds, application to the db or update existed one
* run PTU if policy update is necessary for application.
+ * @param device_id device identifier
* @param application_id Unique application id
* @param hmi_types application HMI types
* @return function that will notify update manager about new application
*/
StatusNotifier AddApplication(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) OVERRIDE;
/**
* @brief Assigns new HMI types for specified application
+ * @param device_handle device identifier
* @param application_id Unique application id
* @param hmi_types new HMI types list
*/
- void SetDefaultHmiTypes(const std::string& application_id,
+ void SetDefaultHmiTypes(const transport_manager::DeviceHandle& device_handle,
+ const std::string& application_id,
const std::vector<int>& hmi_types) OVERRIDE;
/**
@@ -467,7 +550,7 @@ class PolicyManagerImpl : public PolicyManager {
* @brief Setter for access_remote instance
* @param access_remote pointer to new access_remote instance
*/
- void set_access_remote(utils::SharedPtr<AccessRemote> access_remote) OVERRIDE;
+ void set_access_remote(std::shared_ptr<AccessRemote> access_remote) OVERRIDE;
/**
* @brief Sends notification about application HMI level changed
@@ -527,6 +610,8 @@ class PolicyManagerImpl : public PolicyManager {
*/
void OnAppsSearchCompleted(const bool trigger_ptu) OVERRIDE;
+ void UpdatePTUReadyAppsCount(const uint32_t new_app_count) OVERRIDE;
+
/**
* @brief Get state of request types for given application
* @param policy_app_id Unique application id
@@ -560,18 +645,120 @@ class PolicyManagerImpl : public PolicyManager {
const std::string& policy_app_id) const OVERRIDE;
/**
- * @brief Get information about vehicle
- * @return vehicle information
+ * @brief Gets vehicle data items
+ * @return Structure with vehicle data items
+ */
+ const std::vector<policy_table::VehicleDataItem> GetVehicleDataItems()
+ const OVERRIDE;
+
+ std::vector<policy_table::VehicleDataItem> GetRemovedVehicleDataItems()
+ const OVERRIDE;
+
+ /**
+ * @brief Gets copy of current policy table data
+ * @return policy_table as json object
+ */
+ Json::Value GetPolicyTableData() const OVERRIDE;
+
+ /**
+ * @brief Get a list of enabled cloud applications
+ * @param enabled_apps List filled with the policy app id of each enabled
+ * cloud application
+ */
+ void GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const OVERRIDE;
+
+ /**
+ * @brief Get a list of enabled local applications
+ * @return enabled_apps List filled with the policy app id of each enabled
+ * local application
+ */
+ std::vector<std::string> GetEnabledLocalApps() const OVERRIDE;
+
+ bool GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const OVERRIDE;
+
+ /**
+ * @ brief Initialize new cloud app in the policy table
+ * @ param policy_app_id Application ID
+ */
+
+ void InitCloudApp(const std::string& policy_app_id) OVERRIDE;
+
+ /**
+ * @brief Enable or disable a cloud application in the HMI
+ * @param enabled Cloud app enabled state
+ */
+ void SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) OVERRIDE;
+
+ /**
+ * @brief Set an app's auth token
+ * @param auth_token Cloud app authentication token
*/
- const VehicleInfo GetVehicleInfo() const OVERRIDE;
+ void SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) OVERRIDE;
+
+ /**
+ * @brief Set a cloud app's transport type
+ * @param cloud_transport_type Cloud app transport type
+ */
+ void SetAppCloudTransportType(
+ const std::string& policy_app_id,
+ const std::string& cloud_transport_type) OVERRIDE;
+
+ /**
+ * @brief Set a cloud app's endpoint url
+ * @param endpoint URL for websocket connection
+ */
+ void SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) OVERRIDE;
+
+ /**
+ * @brief Set a cloud app's nicknames
+ * @param nicknames Nicknames for cloud app
+ */
+ void SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) OVERRIDE;
+
+ /**
+ * @brief Set the user preference for how a hybrid (cloud and mobile) app
+ * should be used
+ * @param hybrid_app_preference Hybrid app user preference
+ */
+ void SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) OVERRIDE;
+
+ /**
+ * @brief Get app service parameters from the policy table
+ * @param policy_app_id Unique application id
+ * @param app_service_parameters Pointer to struct containing all app service
+ * information
+ */
+ void GetAppServiceParameters(const std::string& policy_app_id,
+ policy_table::AppServiceParameters*
+ app_service_parameters) const OVERRIDE;
+
+ /**
+ * @brief Check if an app can send unknown rpc requests to an app service
+ * provider
+ * @param policy_app_id Unique application id
+ * @return bool true if allowed
+ */
+ bool UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const OVERRIDE;
/**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
* succesfully registered on mobile device.
- * It will send OnAppPermissionSend notification and will try to start PTU. *
+ * It will send OnAppPermissionSend notification and will try to start PTU.
+ *
+ * @param device_id device identifier
* @param application_id registered application.
*/
- void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE;
+ void OnAppRegisteredOnMobile(const std::string& device_id,
+ const std::string& application_id) OVERRIDE;
void OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) OVERRIDE;
@@ -610,6 +797,11 @@ class PolicyManagerImpl : public PolicyManager {
AppIdURL RetrySequenceUrl(const struct RetrySequenceURL& rs,
const EndpointUrls& urls) const OVERRIDE;
+ /**
+ * @brief Trigger a PTU once on startup if it is required
+ */
+ virtual void TriggerPTUOnStartupIfRequired() OVERRIDE;
+
#ifdef BUILD_TESTS
/**
* @brief Getter for cache_manager instance
@@ -664,6 +856,12 @@ class PolicyManagerImpl : public PolicyManager {
int32_t timespan_seconds) OVERRIDE;
// Interface StatisticsManager (end)
+ void OnLocalAppAdded() OVERRIDE;
+
+ bool IsNewApplication(const std::string& application_id) const OVERRIDE;
+
+ void ResetTimeout() OVERRIDE;
+
protected:
#ifdef USE_HMI_PTU_DECRYPTION
/**
@@ -671,7 +869,7 @@ class PolicyManagerImpl : public PolicyManager {
* @param pt_content binary content of PT
* @return pointer to converted PT
*/
- virtual utils::SharedPtr<policy_table::Table> Parse(
+ virtual std::shared_ptr<policy_table::Table> Parse(
const BinaryMessage& pt_content);
#else
/**
@@ -679,7 +877,7 @@ class PolicyManagerImpl : public PolicyManager {
* @param pt_content binary content of PT
* @return pointer to converted PT
*/
- virtual utils::SharedPtr<policy_table::Table> ParseArray(
+ virtual std::shared_ptr<policy_table::Table> ParseArray(
const BinaryMessage& pt_content);
#endif
@@ -704,9 +902,29 @@ class PolicyManagerImpl : public PolicyManager {
* @param snapshot Shared pointer to current copy of policy table
* @return Collection per-application results
*/
- void CheckPermissionsChanges(
- const utils::SharedPtr<policy_table::Table> update,
- const utils::SharedPtr<policy_table::Table> snapshot);
+ CheckAppPolicyResults CheckPermissionsChanges(
+ const std::shared_ptr<policy_table::Table> update,
+ const std::shared_ptr<policy_table::Table> snapshot);
+
+ void ProcessAppPolicyCheckResults(
+ const CheckAppPolicyResults& results,
+ const rpc::policy_table_interface_base::ApplicationPolicies&
+ app_policies);
+
+ void ProcessActionsForAppPolicies(
+ const ApplicationsPoliciesActions& actions,
+ const policy_table::ApplicationPolicies& app_policies);
+
+ /**
+ * @brief Compares current policies to the updated one.
+ * Trigger actions in case if certain fields after update were changed.
+ * This function should be called after PT update.
+ * Actions require already updated policy table
+ * @param update Shared pointer to policy table update
+ * @param snapshot Shared pointer to old copy of policy table
+ */
+ void CheckPermissionsChangesAfterUpdate(const policy_table::Table& update,
+ const policy_table::Table& snapshot);
/**
* @brief Fill structure to be sent with OnPermissionsChanged notification
@@ -750,13 +968,6 @@ class PolicyManagerImpl : public PolicyManager {
DeviceConsent device_consent);
/**
- * @brief Check if certain application already in policy db.
- * @param policy application id.
- * @return true if application presents false otherwise.
- */
- bool IsNewApplication(const std::string& application_id) const;
-
- /**
* Checks existing and permissions of AppStorageFolder
* @return true if AppStorageFolder exists and has permissions read/write
*/
@@ -764,9 +975,12 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief Checks whether need ask the permission of users
+ * @param device_id device identifier
+ * @param app_id policy application id
* @return true if user consent is needed
*/
- virtual bool IsConsentNeeded(const std::string& app_id);
+ virtual bool IsConsentNeeded(const std::string& device_id,
+ const std::string& app_id);
/**
* @brief Changes isConsentNeeded for app pending permissions, in case
@@ -803,13 +1017,18 @@ class PolicyManagerImpl : public PolicyManager {
* @param type policy table type
* @return true if policy table valid, otherwise false
*/
- bool IsPTValid(utils::SharedPtr<policy_table::Table> policy_table,
+ bool IsPTValid(std::shared_ptr<policy_table::Table> policy_table,
policy_table::PolicyTableType type) const;
/**
* @brief Starts new retry sequence
*/
- void RetrySequence();
+ void OnPTUIterationTimeout();
+
+ /**
+ * @brief Check that new applications for PTU were registered
+ */
+ bool HasApplicationForPTU() const;
private:
/**
@@ -840,12 +1059,21 @@ class PolicyManagerImpl : public PolicyManager {
void SendAppPermissionsChanged(const std::string& device_id,
const std::string& application_id) OVERRIDE;
+ void SendOnAppPropertiesChangeNotification(
+ const std::string& policy_app_id) const OVERRIDE;
+
+ /**
+ * @brief notify listener of updated auth token for a given policy id
+ * @param policy_app_id the app id that has an updated auth token
+ */
+ void SendAuthTokenUpdated(const std::string policy_app_id);
+
/**
- * @brief Gets all allowed module types
- * @param policy_app_id unique identifier of application
- * @param modules list of allowed module types
- * @return true if application has allowed modules
- */
+ * @brief Gets all allowed module types
+ * @param policy_app_id unique identifier of application
+ * @param modules list of allowed module types
+ * @return true if application has allowed modules
+ */
bool GetModuleTypes(const std::string& policy_app_id,
std::vector<std::string>* modules) const OVERRIDE;
@@ -867,7 +1095,7 @@ class PolicyManagerImpl : public PolicyManager {
/**
* @brief pointer to AccessRemote instance for working with RC applications
*/
- utils::SharedPtr<AccessRemote> access_remote_;
+ std::shared_ptr<AccessRemote> access_remote_;
/**
* @brief lock guard for protecting applications list access
@@ -903,6 +1131,11 @@ class PolicyManagerImpl : public PolicyManager {
uint32_t retry_sequence_index_;
/**
+ * @brief Applications pending count ready for PTU
+ */
+ uint32_t applications_pending_ptu_count_;
+
+ /**
* @brief Lock for guarding retry sequence
*/
sync_primitives::Lock retry_sequence_lock_;
@@ -937,19 +1170,44 @@ class PolicyManagerImpl : public PolicyManager {
RetrySequenceURL retry_sequence_url_;
/**
- * @brief Flag for notifying that invalid PTU was received
+ * @brief Flag for notifying that PTU was started
*/
- bool wrong_ptu_update_received_;
+ bool send_on_update_sent_out_;
/**
- * @brief Flag for notifying that PTU was started
+ * @brief List of chnaged application properties
*/
- bool send_on_update_sent_out_;
+ std::vector<std::string> app_properties_changed_list_;
/**
* @brief Flag for notifying that invalid PTU should be triggered
*/
bool trigger_ptu_;
+
+ /**
+ * @brief Flag for notifying that PTU was requested
+ */
+ bool ptu_requested_;
+
+ /**
+ * @brief Last registered application id on mobile
+ */
+ std::string last_registered_policy_app_id_;
+
+ typedef std::list<std::pair<std::string, AppPoliciesValueType> >
+ PendingAppPolicyActionsList;
+
+ /**
+ * @brief List containing device_id and pending permissions structure pairs
+ * which can be processed later on demand
+ */
+ PendingAppPolicyActionsList notify_system_list_;
+
+ /**
+ * @brief List containing device_id and pending permissions structure pairs
+ * which can be processed later on demand
+ */
+ PendingAppPolicyActionsList send_permissions_list_;
};
} // namespace policy
diff --git a/src/components/policy/policy_regular/include/policy/policy_table.h b/src/components/policy/policy_regular/include/policy/policy_table.h
index afee8a34e4..8ef3cd7fc8 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table.h
@@ -33,16 +33,14 @@
#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_H_
#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_H_
-#include "utils/shared_ptr.h"
#include "policy/pt_representation.h"
-#include "policy/pt_ext_representation.h"
namespace policy {
class PolicyTable {
public:
PolicyTable();
- explicit PolicyTable(utils::SharedPtr<PTRepresentation> pt_data);
+ explicit PolicyTable(std::shared_ptr<PTRepresentation> pt_data);
virtual ~PolicyTable();
/**
@@ -50,12 +48,12 @@ class PolicyTable {
* actual class storing policy table.
* @return PTRepresentation* Policy Table Content Handler
*/
- utils::SharedPtr<PTRepresentation> pt_data() const {
+ std::shared_ptr<PTRepresentation> pt_data() const {
return pt_data_;
}
private:
- utils::SharedPtr<PTRepresentation> pt_data_;
+ std::shared_ptr<PTRepresentation> pt_data_;
};
} // namespace policy
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/enums.h b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
index 050ab63973..05b39a0082 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table/enums.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
@@ -34,132 +34,12 @@
#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_ENUMS_H_
#include <string>
+#include "generated_HMI_API_policy_types.h"
+#include "generated_MOBILE_API_policy_types.h"
namespace rpc {
namespace policy_table_interface_base {
-enum Priority {
- P_EMERGENCY,
- P_NAVIGATION,
- P_VOICECOM,
- P_COMMUNICATION,
- P_NORMAL,
- P_NONE,
-};
-
-bool IsValidEnum(Priority val);
-const char* EnumToJsonString(Priority val);
-bool EnumFromJsonString(const std::string& literal, Priority* result);
-
-enum HmiLevel {
- HL_BACKGROUND,
- HL_FULL,
- HL_LIMITED,
- HL_NONE,
-};
-bool IsValidEnum(HmiLevel val);
-const char* EnumToJsonString(HmiLevel val);
-bool EnumFromJsonString(const std::string& literal, HmiLevel* result);
-
-enum Parameter {
- P_GPS,
- P_SPEED,
- P_ENGINETORQUE,
- P_EXTERNALTEMPERATURE,
- P_TURNSIGNAL,
- P_FUELLEVEL,
- P_FUELLEVEL_STATE,
- P_HEADLAMPSTATUS,
- P_INSTANTFUELCONSUMPTION,
- P_FUELRANGE,
- P_ODOMETER,
- P_TIREPRESSURE,
- P_WIPERSTATUS,
- P_VIN,
- P_ACCPEDALPOSITION,
- P_BELTSTATUS,
- P_DRIVERBRAKING,
- P_PRNDL,
- P_RPM,
- P_STEERINGWHEELANGLE,
- P_ENGINEOILLIFE,
- P_MYKEY,
- P_AIRBAGSTATUS,
- P_BODYINFORMATION,
- P_CLUSTERMODESTATUS,
- P_DEVICESTATUS,
- P_EMERGENCYEVENT,
- P_ECALLINFO,
- P_EMPTY // Added to allow empty parameters handling
-};
-
-bool IsValidEnum(Parameter val);
-const char* EnumToJsonString(Parameter val);
-bool EnumFromJsonString(const std::string& literal, Parameter* result);
-
-enum AppHMIType {
- AHT_DEFAULT,
- AHT_COMMUNICATION,
- AHT_MEDIA,
- AHT_MESSAGING,
- AHT_NAVIGATION,
- AHT_INFORMATION,
- AHT_SOCIAL,
- AHT_BACKGROUND_PROCESS,
- AHT_TESTING,
- AHT_SYSTEM,
- AHT_PROJECTION,
- AHT_REMOTE_CONTROL
-};
-bool IsValidEnum(AppHMIType val);
-const char* EnumToJsonString(AppHMIType val);
-bool EnumFromJsonString(const std::string& literal, AppHMIType* result);
-
-enum RequestType {
- RT_HTTP,
- RT_FILE_RESUME,
- RT_AUTH_REQUEST,
- RT_AUTH_CHALLENGE,
- RT_AUTH_ACK,
- RT_PROPRIETARY,
- RT_QUERY_APPS,
- RT_LAUNCH_APP,
- RT_LOCK_SCREEN_ICON_URL,
- RT_TRAFFIC_MESSAGE_CHANNEL,
- RT_DRIVER_PROFILE,
- RT_VOICE_SEARCH,
- RT_NAVIGATION,
- RT_PHONE,
- RT_CLIMATE,
- RT_SETTINGS,
- RT_VEHICLE_DIAGNOSTICS,
- RT_EMERGENCY,
- RT_MEDIA,
- RT_FOTA,
- RT_OEM_SPECIFIC,
- RT_EMPTY // Added to allow empty Request Types handling
-};
-
-bool IsValidEnum(RequestType val);
-const char* EnumToJsonString(RequestType val);
-bool EnumFromJsonString(const std::string& literal, RequestType* result);
-
-enum Input {
- I_GUI,
- I_VUI,
-};
-bool IsValidEnum(Input val);
-const char* EnumToJsonString(Input val);
-bool EnumFromJsonString(const std::string& literal, Input* result);
-
-enum ModuleType {
- MT_CLIMATE,
- MT_RADIO,
-};
-bool IsValidEnum(ModuleType val);
-const char* EnumToJsonString(ModuleType val);
-bool EnumFromJsonString(const std::string& literal, ModuleType* result);
-
extern const std::string kDefaultApp;
extern const std::string kPreDataConsentApp;
extern const std::string kDeviceApp;
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/policy_enum_schema_factory.h b/src/components/policy/policy_regular/include/policy/policy_table/policy_enum_schema_factory.h
new file mode 100644
index 0000000000..2053923cfe
--- /dev/null
+++ b/src/components/policy/policy_regular/include/policy/policy_table/policy_enum_schema_factory.h
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2017, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_POLICY_ENUM_SCHEMA_FACTORY_H
+#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_POLICY_ENUM_SCHEMA_FACTORY_H
+#include <memory>
+#include <string>
+
+#include "smart_objects/smart_schema.h"
+
+namespace rpc {
+namespace policy_table_interface_base {
+
+class EnumSchemaItemFactory {
+ public:
+ /**
+ * @brief Get enum schema from enum name
+ * Implementation of this function should be generated from MOBILE_API.xml
+ * @param enum_name enum name to get schema factory for
+ * @return shared pointer to schema factory or empty shared pointer if
+ * enum_name is wrong
+ */
+ static std::shared_ptr<ns_smart_device_link::ns_smart_objects::ISchemaItem>
+ Get(const std::string& enum_name);
+
+ static bool IsRPCSpecVehicleDataType(const std::string& vd_name);
+};
+
+} // namespace policy_table_interface_base
+} // namespace rpc
+#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_POLICY_ENUM_SCHEMA_FACTORY_H
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/types.h b/src/components/policy/policy_regular/include/policy/policy_table/types.h
index ebfbb7f29f..2ffbf2e7ec 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table/types.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table/types.h
@@ -36,7 +36,9 @@
#include <climits>
#include "policy/policy_table/enums.h"
+#include "policy/policy_table/policy_enum_schema_factory.h"
#include "rpc_base/rpc_message.h"
+#include "utils/helpers.h"
namespace Json {
class Value;
@@ -46,10 +48,13 @@ namespace policy_table_interface_base {
struct AppLevel;
struct ApplicationParams;
struct DeviceParams;
+struct EndpointProperty;
struct MessageLanguages;
struct MessageString;
struct RpcParameters;
struct Rpcs;
+struct AppServiceHandledRpc;
+struct AppServiceInfo;
} // namespace policy_table_interface_base
} // namespace rpc
@@ -65,16 +70,18 @@ typedef Array<Enum<AppHMIType>, 0, 255> AppHMITypes;
typedef Array<Enum<HmiLevel>, 0, 4> HmiLevels;
-typedef Array<Enum<Parameter>, 0, 24> Parameters;
+typedef Array<String<0, 255>, 0, 255> Parameters;
typedef Map<RpcParameters, 0, UINT_MAX> Rpc;
-typedef Array<String<10, 255>, 1, 3> URL;
+typedef Array<String<10, INT_MAX>, 1, 3> URL;
typedef Map<URL, 1, 255> URLList;
typedef Map<URLList, 1, 255> ServiceEndpoints;
+typedef Map<EndpointProperty, 0, 255> ServiceEndpointProperties;
+
typedef uint8_t NumberOfNotificationsType;
typedef Map<Integer<NumberOfNotificationsType, 0, 255>, 0, 7>
NumberOfNotificationsPerMinute;
@@ -98,6 +105,13 @@ typedef Array<Enum<RequestType>, 0, 255> RequestTypes;
typedef Strings RequestSubTypes;
+typedef String<0, 255> AppServiceType;
+typedef String<0, 255> AppServiceName;
+typedef Array<AppServiceName, 0, 255> AppServiceNames;
+typedef Array<AppServiceHandledRpc, 0, 255> AppServiceHandledRpcs;
+typedef Map<AppServiceInfo, 0, 255> AppServiceParameters;
+typedef Integer<int32_t, 0, INT32_MAX> FunctionIDInt;
+
typedef Map<Strings, 0, 255> RemoteRpcs;
typedef Map<RemoteRpcs, 0, 255> AccessModules;
typedef Array<Enum<ModuleType>, 0, 255> ModuleTypes;
@@ -105,6 +119,45 @@ typedef Array<Enum<ModuleType>, 0, 255> ModuleTypes;
typedef AppHMIType AppHmiType;
typedef std::vector<AppHMIType> AppHmiTypes;
+struct AppServiceHandledRpc : CompositeType {
+ public:
+ FunctionIDInt function_id;
+
+ public:
+ AppServiceHandledRpc();
+ ~AppServiceHandledRpc();
+ AppServiceHandledRpc(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+ void ReportErrors(rpc::ValidationReport* report__) const;
+
+ private:
+ bool Validate() const;
+};
+
+struct AppServiceInfo : CompositeType {
+ public:
+ Optional<AppServiceNames> service_names;
+ AppServiceHandledRpcs handled_rpcs;
+
+ public:
+ AppServiceInfo();
+ ~AppServiceInfo();
+ AppServiceInfo(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+ void ReportErrors(rpc::ValidationReport* report__) const;
+
+ private:
+ bool Validate() const;
+};
+
struct PolicyBase : CompositeType {
public:
Enum<Priority> priority;
@@ -142,8 +195,20 @@ struct ApplicationParams : PolicyBase {
Optional<RequestSubTypes> RequestSubType;
Optional<Integer<uint16_t, 0, 65225> > memory_kb;
Optional<Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms;
- Optional<String<0, 255> > certificate;
+ Optional<String<0, 65535> > certificate;
mutable Optional<ModuleTypes> moduleType;
+ // Cloud application params
+ Optional<Enum<HybridAppPreference> > hybrid_app_preference;
+ Optional<String<0, 255> > endpoint;
+ Optional<Boolean> enabled;
+ Optional<String<0, 65535> > auth_token;
+ Optional<String<0, 255> > cloud_transport_type;
+ Optional<String<0, 65535> > icon_url;
+
+ // App Service Params
+ Optional<AppServiceParameters> app_service_parameters;
+ Optional<Boolean> allow_unknown_rpc_passthrough;
+ Optional<Boolean> encryption_required;
public:
ApplicationParams();
@@ -209,6 +274,7 @@ struct Rpcs : CompositeType {
public:
Optional<String<1, 255> > user_consent_prompt;
Nullable<Rpc> rpcs;
+ Optional<Boolean> encryption_required;
public:
Rpcs();
@@ -226,22 +292,45 @@ struct Rpcs : CompositeType {
bool Validate() const;
};
+struct EndpointProperty : CompositeType {
+ public:
+ Optional<String<0, 100> > version;
+
+ EndpointProperty();
+ ~EndpointProperty();
+ explicit EndpointProperty(const Json::Value* value__);
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport* report__) const;
+ void SetPolicyTableType(PolicyTableType pt_type) OVERRIDE;
+
+ private:
+ bool Validate() const;
+};
+
struct ModuleConfig : CompositeType {
public:
Optional<Map<String<0, 100>, 0, 255> > device_certificates;
Optional<Boolean> preloaded_pt;
+ Optional<Boolean> full_app_id_supported;
Integer<uint8_t, 0, 255> exchange_after_x_ignition_cycles;
Integer<int64_t, 0, 4294967296ll> exchange_after_x_kilometers;
Integer<uint8_t, 0, 255> exchange_after_x_days;
Integer<uint16_t, 0, 65535> timeout_after_x_seconds;
SecondsBetweenRetries seconds_between_retries;
ServiceEndpoints endpoints;
+ Optional<ServiceEndpointProperties> endpoint_properties;
NumberOfNotificationsPerMinute notifications_per_minute_by_priority;
Optional<String<1, 100> > vehicle_make;
Optional<String<1, 100> > vehicle_model;
Optional<String<4, 4> > vehicle_year;
Optional<String<0, 10> > preloaded_date;
Optional<String<0, 65535> > certificate;
+ Optional<Boolean> lock_screen_dismissal_enabled;
+
+ static const std::string kDefaultOemMappingServiceName;
public:
ModuleConfig();
@@ -251,6 +340,7 @@ struct ModuleConfig : CompositeType {
uint16_t timeout_after_x_seconds,
const SecondsBetweenRetries& seconds_between_retries,
const ServiceEndpoints& endpoints,
+ const ServiceEndpointProperties& endpoint_properties,
const NumberOfNotificationsPerMinute&
notifications_per_minute_by_priority);
~ModuleConfig();
@@ -434,6 +524,88 @@ struct DeviceParams : CompositeType {
bool Validate() const;
};
+struct VehicleDataItem : CompositeType {
+ public:
+ static const std::vector<std::string> kPODTypes;
+
+ static const std::string kInteger;
+ static const std::string kStruct;
+ static const std::string kString;
+ static const std::string kFloat;
+ static const std::string kDouble;
+ static const std::string kBoolean;
+ static const std::string kName;
+ static const std::string kParams;
+
+ String<1, 255> name;
+ String<0, 255> type;
+ String<1, 255> key;
+ Boolean mandatory;
+ Optional<Array<VehicleDataItem, 0, 255> > params;
+
+ Optional<Boolean> array;
+ Optional<String<0, 255> > since;
+ Optional<String<0, 255> > until;
+ Optional<Boolean> removed;
+ Optional<Boolean> deprecated;
+ Optional<Float<-INT32_MAX, INT32_MAX> > minvalue;
+ Optional<Float<-INT32_MAX, INT32_MAX> > maxvalue;
+ Optional<Integer<uint32_t, 0, UINT32_MAX> > minsize;
+ Optional<Integer<uint32_t, 0, UINT32_MAX> > maxsize;
+ Optional<Integer<uint32_t, 0, UINT32_MAX> > minlength;
+ Optional<Integer<uint32_t, 0, UINT32_MAX> > maxlength;
+
+ VehicleDataItem();
+ VehicleDataItem(const VehicleDataItem& policy_table);
+ explicit VehicleDataItem(const Json::Value* value__);
+
+ bool operator==(const VehicleDataItem& vd);
+
+ ~VehicleDataItem();
+
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_not_empty() const;
+ void ReportErrors(rpc::ValidationReport* report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+ /**
+ * @brief Validates type of vehicle data item according to
+ * POD types and generated from API enums.
+ * @return true if type is valid.
+ */
+ bool ValidateTypes() const;
+ bool IsPrimitiveType() const;
+ bool ValidateNaming(std::string str) const;
+
+ private:
+ bool Validate() const;
+};
+
+typedef Array<VehicleDataItem, 0, 255> VehicleDataItems;
+
+struct VehicleData : CompositeType {
+ public:
+ Optional<String<0, 100> > schema_version;
+ Optional<VehicleDataItems> schema_items;
+
+ VehicleData();
+ VehicleData(const VehicleData& vehicle_data);
+ VehicleData(const Json::Value* value__);
+ ~VehicleData();
+
+ Json::Value ToJsonValue() const;
+ bool is_valid() const;
+ bool is_initialized() const;
+ bool struct_empty() const;
+ void ReportErrors(rpc::ValidationReport* report__) const;
+ virtual void SetPolicyTableType(PolicyTableType pt_type);
+
+ private:
+ bool Validate() const;
+};
+
struct PolicyTable : CompositeType {
public:
ApplicationPoliciesSection app_policies_section;
@@ -443,6 +615,7 @@ struct PolicyTable : CompositeType {
Optional<ModuleMeta> module_meta;
Optional<UsageAndErrorCounts> usage_and_error_counts;
Optional<DeviceData> device_data;
+ Optional<VehicleData> vehicle_data;
public:
PolicyTable();
diff --git a/src/components/policy/policy_regular/include/policy/policy_types.h b/src/components/policy/policy_regular/include/policy/policy_types.h
index e0fc808e2f..7f95d9132b 100644
--- a/src/components/policy/policy_regular/include/policy/policy_types.h
+++ b/src/components/policy/policy_regular/include/policy/policy_types.h
@@ -34,14 +34,16 @@
#define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TYPES_H_
#include <algorithm>
-#include <string>
-#include <vector>
#include <map>
+#include <memory>
#include <set>
+#include <string>
#include <utility>
-#include "utils/shared_ptr.h"
-#include "utils/helpers.h"
+#include <vector>
+
+#include "policy/policy_table/types.h"
#include "transport_manager/common.h"
+#include "utils/helpers.h"
namespace policy {
@@ -73,13 +75,20 @@ enum PolicyTableStatus {
StatusUpToDate = 0,
StatusUpdatePending,
StatusUpdateRequired,
- StatusUnknown
+ StatusUnknown,
+ StatusProcessingSnapshot
};
+enum class PTUIterationType { DefaultIteration = 0, RetryIteration };
+
+enum class ResetRetryCountType { kResetWithStatusUpdate = 0, kResetInternally };
+
+typedef rpc::Optional<rpc::Boolean> EncryptionRequired;
+
// Code generator uses String class name, so this typedef was renamed to PTSring
typedef std::string PTString;
typedef std::vector<uint8_t> BinaryMessage;
-typedef utils::SharedPtr<BinaryMessage> BinaryMessageSptr;
+typedef std::shared_ptr<BinaryMessage> BinaryMessageSptr;
typedef std::string HMILevel;
typedef std::string Parameter;
@@ -101,6 +110,7 @@ struct ParameterPermissions
struct RpcPermissions {
HMIPermissions hmi_permissions;
ParameterPermissions parameter_permissions;
+ EncryptionRequired require_encryption;
};
typedef std::map<RpcName, RpcPermissions> Permissions;
@@ -118,10 +128,10 @@ typedef std::vector<std::string> StringArray;
enum PermitResult { kRpcAllowed = 0, kRpcDisallowed, kRpcUserDisallowed };
/**
- * @struct Stores result of check:
- * if HMI Level was allowed for RPC to work in
- * and list of parameters allowed for RPC if specified in PT.
- */
+ * @struct Stores result of check:
+ * if HMI Level was allowed for RPC to work in
+ * and list of parameters allowed for RPC if specified in PT.
+ */
struct CheckPermissionResult {
CheckPermissionResult() : hmi_level_permitted(kRpcDisallowed) {}
@@ -224,8 +234,11 @@ struct DeviceInfo {
using namespace helpers;
static const std::string bluetooth("BLUETOOTH");
static const std::string wifi("WIFI");
+ static const std::string webengine("WEBENGINE_WEBSOCKET");
if (Compare<std::string, EQ, ONE>(deviceType, bluetooth, wifi)) {
connection_type.assign("BTMAC");
+ } else if (Compare<std::string, EQ, ONE>(deviceType, webengine)) {
+ connection_type.assign("");
}
}
};
@@ -427,6 +440,30 @@ struct ExternalConsentStatusItemSorter {
};
/**
+ * @brief The ApplicationPolicyActions struct contains actions which should be
+ * done for some application
+ */
+struct ApplicationPolicyActions {
+ ApplicationPolicyActions()
+ : is_notify_system(false)
+ , is_send_permissions_to_app(false)
+ , is_consent_needed(false)
+ , app_properties_changed(false) {}
+
+ bool is_notify_system;
+ bool is_send_permissions_to_app;
+ bool is_consent_needed;
+ bool app_properties_changed;
+};
+
+/**
+ * @brief ApplicationsPoliciesActions map of actions to be done for every
+ * application
+ */
+typedef std::map<std::string, ApplicationPolicyActions>
+ ApplicationsPoliciesActions;
+
+/**
* @brief Customer connectivity settings status
*/
typedef std::set<ExternalConsentStatusItem, ExternalConsentStatusItemSorter>
@@ -472,10 +509,12 @@ enum PermissionsCheckResult {
RESULT_NICKNAME_MISMATCH,
RESULT_PERMISSIONS_REVOKED,
RESULT_CONSENT_NEEDED,
- RESULT_CONSENT_NOT_REQIURED,
+ RESULT_CONSENT_NOT_REQUIRED,
RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED,
RESULT_REQUEST_TYPE_CHANGED,
- RESULT_REQUEST_SUBTYPE_CHANGED
+ RESULT_REQUEST_SUBTYPE_CHANGED,
+ RESULT_ENCRYPTION_REQUIRED_FLAG_CHANGED,
+ RESULT_APP_PROPERTIES_CHANGED
};
/**
@@ -491,6 +530,68 @@ typedef std::set<std::pair<std::string, PermissionsCheckResult> >
*/
typedef std::pair<uint32_t, uint32_t> AppIdURL;
+/**
+ * @brief The AppProperties struct contains application properties
+ */
+struct AppProperties {
+ AppProperties()
+ : endpoint()
+ , certificate()
+ , enabled(false)
+ , auth_token()
+ , transport_type()
+ , hybrid_app_preference() {}
+
+ AppProperties(std::string endpoint,
+ std::string certificate,
+ bool enabled,
+ std::string auth_token,
+ std::string transport_type,
+ std::string hybrid_app_preference)
+ : endpoint(endpoint)
+ , certificate(certificate)
+ , enabled(enabled)
+ , auth_token(auth_token)
+ , transport_type(transport_type)
+ , hybrid_app_preference(hybrid_app_preference) {}
+
+ /**
+ * @brief endpoint Filled with the endpoint used to connect to the cloud
+ * application.
+ * @note should be absent for local applications
+ */
+ std::string endpoint;
+
+ /**
+ * @brief certificate Filled with the certificate used for creation
+ * of a secure connection to the cloud application
+ */
+ std::string certificate;
+
+ /**
+ * @brief enabled Whether or not the app is enabled
+ */
+ bool enabled;
+
+ /**
+ * @brief auth_token Filled with the token used for authentication when
+ * reconnecting to the cloud app
+ */
+ std::string auth_token;
+
+ /**
+ * @brief transport_type Filled with the transport type used by the
+ * cloud/local application (ex. "WSS")
+ */
+ std::string transport_type;
+
+ /**
+ * @brief hybrid_app_preference Filled with the hybrid app preference for the
+ * application set by the user
+ */
+ std::string hybrid_app_preference;
+};
+
} // namespace policy
#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TYPES_H_
diff --git a/src/components/policy/policy_regular/include/policy/pt_ext_representation.h b/src/components/policy/policy_regular/include/policy/pt_ext_representation.h
deleted file mode 100644
index f70946d1f5..0000000000
--- a/src/components/policy/policy_regular/include/policy/pt_ext_representation.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- Copyright (c) 2013, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_PT_EXT_REPRESENTATION_H_
-#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_PT_EXT_REPRESENTATION_H_
-
-#include "policy/pt_representation.h"
-
-namespace policy {
-
-enum StatisticsType {
- S_NONE = 0,
- S_IAP_BUFFER_FULL,
- S_SYNC_OUT_OF_MEMORY,
- S_SYNC_REBOOTS,
- S_MINS_HMI_FULL,
- S_MINS_HMI_LIMITED,
- S_MINS_HMI_BACKGROUND,
- S_MINS_HMI_NONE,
- S_RFCOM_LIMIT_REACHED,
- S_USER_SELECTIONS,
- S_REJECTIONS_SYNC_OUT_OF_MEMORY,
- S_REJECTIONS_NICKNAME_MISMATCH,
- S_REJECTIONS_DUPLICATE_NAME,
- S_REJECTED_RPC_CALLS,
- S_RPCS_IN_HMI_NONE,
- S_REMOVALS_MISBEHAVED,
- S_RUN_ATTEMPTS_WHILE_REVOKED
-};
-
-enum LanguageType { L_NONE = 0, L_GUI, L_VUI };
-
-class PTExtRepresentation : public virtual PTRepresentation {
- public:
- virtual ~PTExtRepresentation() {}
-
- /**
- * @brief Is application allowed to send notifications while in
- * Backgound or limited mode.
- * @param app_id Application id
- * @return bool Allowed/disallowed.
- */
- virtual bool CanAppKeepContext(const std::string& app_id) = 0;
-
- /**
- * @brief Is application allowed to move foreground at will?
- * @param app_id Application id
- * @return bool Allowed/disallowed.
- */
- virtual bool CanAppStealFocus(const std::string& app_id) = 0;
-
- /**
- * @brief Get default_hmi for given application
- * @param policy_app_id Unique application id
- * @param default_hmi Default HMI level for application or empty, if value was
- * not set
- * @return true, if succedeed, otherwise - false
- */
- virtual bool GetDefaultHMI(const std::string& policy_app_id,
- std::string* default_hmi) = 0;
-
- /**
- * @brief Reset user consent for device data and applications permissions
- * @return
- */
- virtual bool ResetUserConsent() = 0;
-
- /**
- * @brief Reset user consent for device data
- * @return
- */
- virtual bool ResetDeviceConsents() = 0;
-
- /**
- * @brief Reset user consent for applications permissions
- * @return
- */
- virtual bool ResetAppConsents() = 0;
-
- /**
- * @brief Get user permissions for device data usage
- * @param device_id Generated or obtained id of device
- * @param consented_groups Groups consented by user
- * @param disallowed_groups Groups not consented by user
- * @return true, if query was successfull, otherwise - false
- */
- virtual bool GetUserPermissionsForDevice(
- const std::string& device_id,
- StringArray* consented_groups = NULL,
- StringArray* disallowed_groups = NULL) = 0;
-
- /**
- * @brief Gets list of groups permissions from policy table
- * @param device_id Unique device id, which hosts specific application
- * @param policy_app_id Unique application id
- * @param group_types Group list sorted by permission status
- * @return true, if query was successfull, otherwise - false
- */
- virtual bool GetPermissionsForApp(const std::string& device_id,
- const std::string& policy_app_id,
- FunctionalIdType* group_types) = 0;
-
- /**
- * @brief Get device groups and preconsented groups from policies section
- * @param groups List of groups to be consented for device usage
- * @param preconsented_groups List of preconsented groups for device usage
- * @return true, if query was successful, otherwise - false
- */
- virtual bool GetDeviceGroupsFromPolicies(
- policy_table::Strings* groups = NULL,
- policy_table::Strings* preconsented_groups = NULL) = 0;
-
- /**
- * @brief Record information about mobile device in Policy Table.
- * @param device_id Generated or obtained id of device
- * @return bool Success of operation
- */
- virtual bool SetDeviceData(const std::string& device_id,
- const std::string& hardware = "",
- const std::string& firmware = "",
- const std::string& os = "",
- const std::string& os_version = "",
- const std::string& carrier = "",
- const uint32_t number_of_ports = 0,
- const std::string& connection_type = "") = 0;
-
- /**
- * @brief Sets user consent for particular mobile device,
- * i.e. to use device for exchanging of Policy Table.
- * @return bool Success of operation
- */
- virtual bool SetUserPermissionsForDevice(
- const std::string& device_id,
- const StringArray& consented_groups = StringArray(),
- const StringArray& disallowed_gropus = StringArray()) = 0;
-
- /**
- * @brief Update Application Policies as reaction
- * on User allowing/disallowing device this app is running on.
- */
- virtual bool ReactOnUserDevConsentForApp(const std::string& app_id,
- bool is_device_allowed) = 0;
-
- /**
- * @brief Set user consent on functional groups
- * @param permissions User consent on functional group
- * @return true, if operation succedeed, otherwise - false
- */
- virtual bool SetUserPermissionsForApp(
- const PermissionConsent& permissions) = 0;
-
- /**
- * @brief Counter for statistics information: adds 1 to existing number.
- * @param type Type of statistics (errors, mins in mode etc)
- * @return bool Success of operation
- */
- virtual bool IncreaseStatisticsData(StatisticsType type) = 0;
-
- /**
- * @brief Records information about what language
- * application tried to register with.
- * @param app_id Id of application
- * @param type - language for UI/VR
- * @param language Language
- * @return bool Success of operation
- */
- virtual bool SetAppRegistrationLanguage(const std::string& app_id,
- LanguageType type,
- const std::string& language) = 0;
-
- /**
- * @brief Records information about head unit system to PT
- * @return bool Success of operation
- */
- virtual bool SetMetaInfo(const std::string& ccpu_version,
- const std::string& wers_country_code,
- const std::string& language) = 0;
-
- /**
- * @brief Checks, if specific head unit is present in PT
- * @return boot Suceess, if present, otherwise - false
- */
- virtual bool IsMetaInfoPresent() = 0;
-
- /**
- * @brief Kms pass since last successfull PT update
- */
- virtual int GetKmFromSuccessfulExchange() = 0;
-
- /**
- * @brief Days pass since last successfull PT update
- */
- virtual int GetDayFromScsExchange() = 0;
-
- /**
- * @brief Ignition cycles pass since last successfull PT update
- */
- virtual int GetIgnitionsFromScsExchange() = 0;
-
- /**
- * @brief Set current system language
- * @param language System language
- * @return true, if succedeed, otherwise - false
- */
- virtual bool SetSystemLanguage(const std::string& language) = 0;
-
- /**
- * Increments global counter
- * @param type type of counter
- */
- virtual void Increment(const std::string& type) const = 0;
-
- /**
- * Increments counter of application
- * @param app_id id application
- * @param type type of counter
- */
- virtual void Increment(const std::string& app_id,
- const std::string& type) const = 0;
-
- /**
- * Sets value of application information
- * @param app_id id application
- * @param type type of information
- * @param value value of information
- */
- virtual void Set(const std::string& app_id,
- const std::string& type,
- const std::string& value) const = 0;
-
- /**
- * Adds value to stopwatch of application
- * @param app_id id application
- * @param type type of stopwatch
- * @param seconds value for adding in seconds
- */
- virtual void Add(const std::string& app_id,
- const std::string& type,
- int seconds) const = 0;
-
- virtual bool CountUnconsentedGroups(const std::string& policy_app_id,
- const std::string& device_id,
- int* result) const = 0;
-
- /**
- * @brief Gets functional group names and user_consent_prompts, if any
- * @param Array to be filled with group ids, names and functional prompts
- * @return true, if succeeded, otherwise - false
- */
- // TODO(AOleynik): Possibly, we can get rid of this method. Check this.
- virtual bool GetFunctionalGroupNames(policy::FunctionalGroupNames& names) = 0;
-
- /**
- * @brief Set app policy to pre_DataConsented policy
- * @param app_id Policy ID of application to be changed
- * @return true, if succeeded, otherwise - false
- */
- virtual bool SetPredataPolicy(const std::string& app_id) = 0;
-
- /**
- * @brief Updates application policy to either pre_DataConsented or not
- * @param app_id Policy Id of application to be checked
- * @param is_pre_data True of False to setting app policy to be
- * pre_DataConsented
- * @return true, if succeeded, otherwise - false
- */
- virtual bool SetIsPredata(const std::string& app_id, bool is_pre_data) = 0;
-
- /**
- * @brief Removes unpaired devices
- * @return true if success
- */
- virtual bool CleanupUnpairedDevices(const DeviceIds& device_ids) const = 0;
-
- /**
- * Sets flag of unpaired device
- * @param device_id Unique device id
- * @param unpaired True, if unpaired, otherwise - false
- * @return true if success
- */
- virtual bool SetUnpairedDevice(const std::string& device_id,
- bool unpaired) const = 0;
-
- /**
- * Gets list of unpaired devices
- * @param device_ids output list
- * @return true if success
- */
- virtual bool UnpairedDevicesList(DeviceIds* device_ids) const = 0;
-
- /**
- * @brief Remove application consent for particular group
- * @param policy_app_id Unique application id
- * @param functional_group_name Functional group name, which consents should
- * be removed
- * @return true, in case of success, otherwise - false
- */
- virtual bool RemoveAppConsentForGroup(
- const std::string& policy_app_id,
- const std::string& functional_group_name) const = 0;
- virtual bool SaveExternalConsentStatus(
- const ExternalConsentStatus& status) const = 0;
- virtual ExternalConsentStatus GetExternalConsentStatus() const = 0;
-};
-} // namespace policy
-
-#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_PT_EXT_REPRESENTATION_H_
diff --git a/src/components/policy/policy_regular/include/policy/pt_representation.h b/src/components/policy/policy_regular/include/policy/pt_representation.h
index 08bd6d4923..467fb4641f 100644
--- a/src/components/policy/policy_regular/include/policy/pt_representation.h
+++ b/src/components/policy/policy_regular/include/policy/pt_representation.h
@@ -33,11 +33,13 @@
#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_PT_REPRESENTATION_H_
#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_PT_REPRESENTATION_H_
-#include <vector>
+#include <memory>
#include <string>
-#include "policy/policy_types.h"
-#include "policy/policy_table/types.h"
+#include <vector>
#include "policy/policy_settings.h"
+#include "policy/policy_table/types.h"
+#include "policy/policy_types.h"
+#include "utils/macro.h"
namespace policy {
namespace policy_table = rpc::policy_table_interface_base;
@@ -121,11 +123,6 @@ class PTRepresentation {
virtual bool SecondsBetweenRetries(std::vector<int>* seconds) = 0;
/**
- * @brief Get information about vehicle
- */
- virtual const VehicleInfo GetVehicleInfo() const = 0;
-
- /**
* @brief Allows to update 'vin' field in module_meta table.
*
* @param new 'vin' value.
@@ -155,14 +152,6 @@ class PTRepresentation {
virtual EndpointUrls GetUpdateUrls(int service_type) = 0;
/**
- * @brief GetLockScreenIcon allows to obtain lock screen icon url;
- *
- * @return url which point to the resourse where lock screen icon could be
- *obtained.
- */
- virtual std::string GetLockScreenIconUrl() const = 0;
-
- /**
* @brief Get allowed number of notifications
* depending on application priority.
* @param priority Priority of application
@@ -208,7 +197,7 @@ class PTRepresentation {
* device_info, statistics, excluding user messages
* @return Generated structure for obtaining Json string.
*/
- virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const = 0;
+ virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const = 0;
virtual bool Save(const policy_table::Table& table) = 0;
@@ -263,10 +252,10 @@ class PTRepresentation {
virtual bool IsDefaultPolicy(const std::string& app_id) const = 0;
/**
- * Checks if the application has pre_data policy
- * @param app_id application id
- * @return true if application has pre_data policy
- */
+ * Checks if the application has pre_data policy
+ * @param app_id application id
+ * @return true if application has pre_data policy
+ */
virtual bool IsPredataPolicy(const std::string& app_id) const = 0;
/**
diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_ext_queries.h b/src/components/policy/policy_regular/include/policy/sql_pt_ext_queries.h
deleted file mode 100644
index 727c0b165d..0000000000
--- a/src/components/policy/policy_regular/include/policy/sql_pt_ext_queries.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- Copyright (c) 2013, " Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, " with or without
- modification, " are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, " this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice, "
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, " INCLUDING, " BUT NOT LIMITED TO, " THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, " INDIRECT, " INCIDENTAL, " SPECIAL, " EXEMPLARY, " OR
- CONSEQUENTIAL DAMAGES (INCLUDING, " BUT NOT LIMITED TO, " PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, " DATA, " OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, " WHETHER IN
- CONTRACT, " STRICT LIABILITY, " OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, " EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_QUERIES_H_
-#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_QUERIES_H_
-
-#include <string>
-
-namespace policy {
-namespace sql_pt_ext {
-
-extern const std::string kSelectKeepContext;
-extern const std::string kSelectStealFocus;
-extern const std::string kResetDeviceConsents;
-extern const std::string kResetAppConsents;
-extern const std::string kCountDeviceConsentGroup;
-extern const std::string kCountDevice;
-extern const std::string kSelectDeviceConsentedGroup;
-extern const std::string kUpdateDeviceConsentedGroup;
-extern const std::string kUpdateDevice;
-extern const std::string kInsertDeviceConsentedGroup;
-extern const std::string kInsertDevice;
-extern const std::string kSelectDeviceData;
-extern const std::string kSelectConsentGroup;
-extern const std::string kInsertPreconsentedGroups;
-extern const std::string kSelectPreconsentedGroups;
-extern const std::string kDeletePreconsentedGroups;
-extern const std::string kSelectUsageAndErrorCount;
-extern const std::string kSelectAppLevels;
-extern const std::string kUpdateGlobalCounters;
-extern const std::string kInsertDeviceData;
-extern const std::string kDeleteDeviceData;
-extern const std::string kInsertConsentGroups;
-extern const std::string kCountUnconsentedGroups;
-extern const std::string kSelectModuleMeta;
-extern const std::string kUpdateMetaParams;
-extern const std::string kUpdateModuleMetaVinParam;
-extern const std::string kSaveModuleMeta;
-extern const std::string kSelectMetaParams;
-extern const std::string kCountAppLevel;
-extern const std::string kUpdateGroupPermissions;
-extern const std::string kSelectDefaultHmi;
-extern const std::string kInsertApplication;
-extern const std::string kSelectFriendlyMsg;
-extern const std::string kCollectFriendlyMsg;
-extern const std::string kSelectAppGroupsId;
-extern const std::string kSelectConsentedGroupsId;
-extern const std::string kCountAppConsents;
-extern const std::string kSelectPreconsentedGroupsId;
-extern const std::string kSelectFunctionalGroupNames;
-extern const std::string kSelectAppPolicies;
-extern const std::string kUpdateMetaLanguage;
-extern const std::string kDeleteDeviceConsent;
-extern const std::string kDeleteAppGroupConsent;
-extern const std::string kSelectGroupId;
-extern const std::string kSelectApplicationIsPreData;
-extern const std::string kUpdateIsPredata;
-extern const std::string kHasAppPreloadedGroups;
-extern const std::string kUpdateUnpairedDevice;
-extern const std::string kSelectUnpairedDevices;
-extern const std::string kHasMsgLanguageCode;
-extern const std::string kDeletePreconsentedGroupsByApplicationId;
-extern const std::string kDeleteAppConsent;
-extern const std::string kSelectExternalConsentStatus;
-} // namespace sql_pt_ext
-} // namespace policy
-
-#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_QUERIES_H_
diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_ext_representation.h b/src/components/policy/policy_regular/include/policy/sql_pt_ext_representation.h
deleted file mode 100644
index 0958bad5e1..0000000000
--- a/src/components/policy/policy_regular/include/policy/sql_pt_ext_representation.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- Copyright (c) 2013, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_REPRESENTATION_H_
-#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_REPRESENTATION_H_
-
-#include <string>
-#include "policy/sql_pt_representation.h"
-#include "policy/pt_ext_representation.h"
-
-namespace policy {
-
-class SQLPTExtRepresentation : public SQLPTRepresentation,
- public PTExtRepresentation {
- public:
- bool CanAppKeepContext(const std::string& app_id);
- bool CanAppStealFocus(const std::string& app_id);
- bool GetDefaultHMI(const std::string& policy_app_id,
- std::string* default_hmi);
- bool ResetUserConsent();
- bool ResetDeviceConsents();
- bool ResetAppConsents();
- bool GetUserPermissionsForDevice(const std::string& device_id,
- StringArray* consented_groups = NULL,
- StringArray* disallowed_groups = NULL);
-
- bool GetPermissionsForApp(const std::string& device_id,
- const std::string& policy_app_id,
- FunctionalIdType* group_types);
-
- bool GetDeviceGroupsFromPolicies(
- policy_table::Strings* groups = NULL,
- policy_table::Strings* preconsented_groups = NULL);
- bool SetDeviceData(const std::string& device_id,
- const std::string& hardware = "",
- const std::string& firmware = "",
- const std::string& os = "",
- const std::string& os_version = "",
- const std::string& carrier = "",
- const uint32_t number_of_ports = 0,
- const std::string& connection_type = "");
- bool SetUserPermissionsForDevice(
- const std::string& device_id,
- const StringArray& consented_groups = StringArray(),
- const StringArray& disallowed_groups = StringArray());
-
- bool ReactOnUserDevConsentForApp(const std::string& app_id,
- bool is_device_allowed);
-
- bool SetUserPermissionsForApp(const PermissionConsent& permissions);
-
- std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
- const std::vector<std::string>& msg_codes, const std::string& language);
-
- bool IncreaseStatisticsData(StatisticsType type) {
- return true;
- }
- bool SetAppRegistrationLanguage(const std::string& app_id,
- LanguageType type,
- const std::string& language) {
- return true;
- }
-
- bool SetMetaInfo(const std::string& ccpu_version,
- const std::string& wers_country_code,
- const std::string& language);
-
- bool IsMetaInfoPresent();
-
- bool SetSystemLanguage(const std::string& language);
-
- int GetKmFromSuccessfulExchange() {
- return true;
- }
- int GetDayFromScsExchange() {
- return true;
- }
- int GetIgnitionsFromScsExchange() {
- return true;
- }
-
- bool GetFunctionalGroupNames(FunctionalGroupNames& names);
- bool CleanupUnpairedDevices(const DeviceIds& device_ids) const;
-
- void Increment(const std::string& type) const;
- void Increment(const std::string& app_id, const std::string& type) const;
- void Set(const std::string& app_id,
- const std::string& type,
- const std::string& value) const;
- void Add(const std::string& app_id,
- const std::string& type,
- int seconds) const;
- bool SetDefaultPolicy(const std::string& app_id);
- bool SetPredataPolicy(const std::string& app_id);
- bool SetIsPredata(const std::string& app_id, bool is_pre_data);
- bool IsPredataPolicy(const std::string& app_id) const;
- bool SetUnpairedDevice(const std::string& device_id, bool unpaired) const;
- bool UnpairedDevicesList(DeviceIds* device_ids) const;
- bool RemoveAppConsentForGroup(const std::string& policy_app_id,
- const std::string& functional_group_name) const;
-
- virtual bool SetVINValue(const std::string& value);
- bool SaveExternalConsentStatus(const ExternalConsentStatus& status) const;
- ExternalConsentStatus GetExternalConsentStatus() const;
-
- private:
- void GatherModuleMeta(policy_table::ModuleMeta* meta) const;
- void GatherPreconsentedGroup(const std::string& app_id,
- policy_table::Strings* groups) const;
- bool GatherUsageAndErrorCounts(
- policy_table::UsageAndErrorCounts* counts) const;
- bool GatherAppLevels(policy_table::AppLevels* apps) const;
- void GatherDeviceData(policy_table::DeviceData* data) const;
- void GatherConsentGroup(const std::string& device_id,
- policy_table::UserConsentRecords* records) const;
- bool GatherApplicationPoliciesSection(
- policy_table::ApplicationPoliciesSection* policies) const;
- bool SaveDeviceData(const policy_table::DeviceData& devices);
- bool GatherConsumerFriendlyMessages(
- policy_table::ConsumerFriendlyMessages* messages) const;
- bool SaveConsentGroup(const std::string& device_id,
- const policy_table::UserConsentRecords& records);
- bool SaveApplicationPoliciesSection(
- const policy_table::ApplicationPoliciesSection& policies);
- bool SaveSpecificAppPolicy(
- const policy_table::ApplicationPolicies::value_type& app);
- bool SaveDevicePolicy(const policy_table::DevicePolicy& device);
- bool SavePreconsentedGroup(const std::string& app_id,
- const policy_table::Strings& groups);
- bool SaveMessageString(const std::string& type,
- const std::string& lang,
- const policy_table::MessageString& strings);
-
- virtual bool SaveUsageAndErrorCounts(
- const policy_table::UsageAndErrorCounts& counts);
-
- virtual bool SaveModuleMeta(const policy_table::ModuleMeta& meta);
-
- bool SaveAppCounters(const policy_table::AppLevels& app_levels);
-
- bool SaveGlobalCounters(const policy_table::UsageAndErrorCounts& counts);
-
- bool IsExistAppLevel(const std::string& app_id) const;
-
- bool GetAllAppGroups(const std::string& policy_app_id,
- FunctionalGroupIDs& all_groups);
-
- bool GetConsentedGroups(const std::string& policy_app_id,
- const std::string& device_id,
- FunctionalGroupIDs& allowed_groups,
- FunctionalGroupIDs& disallowed_groups);
-
- bool GetPreconsentedGroups(const std::string& policy_app_id,
- FunctionalGroupIDs& preconsented_groups);
-
- void FillFunctionalGroupPermissions(
- FunctionalGroupIDs& ids,
- FunctionalGroupNames& names,
- GroupConsent state,
- std::vector<FunctionalGroupPermission>& permissions);
- bool CountUnconsentedGroups(const std::string& policy_app_id,
- const std::string& device_id,
- int* result) const;
-
- /**
- * @brief Checks, if there is message present with requested language in PT
- * @param message Message name
- * @param language Required message language
- * @return True, if message with requested language is present, otherwise -
- * false
- */
- bool IsMsgLanguagePresent(const std::string& message,
- const std::string& language);
-
-} // namespace policy
-
-#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_SQL_PT_EXT_REPRESENTATION_H_
diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_queries.h b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
index 5259ffa7e9..315c30b995 100644
--- a/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
+++ b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
@@ -49,7 +49,6 @@ extern const std::string kSelectPreloaded;
extern const std::string kIsFirstRun;
extern const std::string kSetNotFirstRun;
extern const std::string kSelectEndpoint;
-extern const std::string kSelectLockScreenIcon;
extern const std::string kSelectModuleConfig;
extern const std::string kSelectEndpoints;
extern const std::string kSelectNotificationsPerMin;
@@ -66,6 +65,9 @@ extern const std::string kSelectNicknames;
extern const std::string kSelectAppTypes;
extern const std::string kSelectRequestTypes;
extern const std::string kSelectRequestSubTypes;
+extern const std::string kSelectAppServiceTypes;
+extern const std::string kSelectAppServiceNames;
+extern const std::string kSelectAppServiceHandledRpcs;
extern const std::string kSelectSecondsBetweenRetries;
extern const std::string kSelectIgnitionCycles;
extern const std::string kSelectKilometers;
@@ -79,9 +81,10 @@ extern const std::string kInsertAppGroup;
extern const std::string kInsertNickname;
extern const std::string kInsertAppType;
extern const std::string kInsertRequestType;
-extern const std::string kInsertOmittedRequestType;
-extern const std::string kInsertOmittedRequestSubType;
extern const std::string kInsertRequestSubType;
+extern const std::string kInsertAppServiceTypes;
+extern const std::string kInsertAppServiceNames;
+extern const std::string kInsertAppServiceHandledRpcs;
extern const std::string kInsertMessageType;
extern const std::string kInsertLanguage;
extern const std::string kInsertMessageString;
@@ -102,6 +105,9 @@ extern const std::string kDeleteAppGroup;
extern const std::string kDeleteApplication;
extern const std::string kDeleteRequestType;
extern const std::string kDeleteRequestSubType;
+extern const std::string kDeleteAppServiceTypes;
+extern const std::string kDeleteAppServiceNames;
+extern const std::string kDeleteAppServiceHandledRpcs;
extern const std::string kDeleteDevice;
extern const std::string kIncrementIgnitionCycles;
extern const std::string kResetIgnitionCycles;
@@ -136,6 +142,19 @@ extern const std::string kSelectDBVersion;
extern const std::string kUpdateDBVersion;
extern const std::string kSaveModuleMeta;
extern const std::string kSelectModuleMeta;
+extern const std::string kInsertVehicleDataItem;
+extern const std::string kSelectVehicleDataItem;
+extern const std::string kDeleteVehicleDataItems;
+extern const std::string kInsertVehicleDataItemParams;
+extern const std::string kSelectVehicleDataItemParams;
+extern const std::string kDeleteVehicleDataItemParams;
+extern const std::string kSelectVehicleDataItemWithVersion;
+extern const std::string kSelectPrimitiveVehicleDataItems;
+extern const std::string kSelectCompositeVehicleDataItemsKey;
+extern const std::string kSelectVehicleDataSchemaVersion;
+extern const std::string kInsertVehicleDataSchemaVersion;
+extern const std::string kSelectEndpointProperties;
+extern const std::string kInsertEndpointVersion;
} // namespace sql_pt
} // namespace policy
diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h
index b26b2c9ede..5bc49ee973 100644
--- a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h
+++ b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h
@@ -35,15 +35,16 @@
#include <string>
#include <vector>
+#include "policy/policy_table/types.h"
#include "policy/pt_representation.h"
#include "rpc_base/rpc_base.h"
-#include "policy/policy_table/types.h"
namespace policy_table = rpc::policy_table_interface_base;
namespace utils {
namespace dbms {
class SQLDatabase;
+class SQLQuery;
} // namespace dbms
} // namespace utils
@@ -69,13 +70,11 @@ class SQLPTRepresentation : public virtual PTRepresentation {
virtual int TimeoutResponse();
virtual bool SecondsBetweenRetries(std::vector<int>* seconds);
virtual bool RefreshDB();
- virtual const VehicleInfo GetVehicleInfo() const;
virtual std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes, const std::string& language);
virtual EndpointUrls GetUpdateUrls(int service_type);
- virtual std::string GetLockScreenIconUrl() const;
virtual int GetNotificationsNumber(const std::string& priority);
virtual bool GetPriority(const std::string& policy_app_id,
std::string* priority);
@@ -84,7 +83,7 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool Clear();
bool Drop();
virtual void WriteDb();
- virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const;
+ virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const;
virtual bool Save(const policy_table::Table& table);
bool GetInitialAppData(const std::string& app_id,
StringArray* nicknames = NULL,
@@ -123,6 +122,9 @@ class SQLPTRepresentation : public virtual PTRepresentation {
policy_table::ConsumerFriendlyMessages* messages) const;
virtual bool GatherApplicationPoliciesSection(
policy_table::ApplicationPoliciesSection* policies) const;
+ virtual bool GatherVehicleDataItems(
+ policy_table::VehicleDataItems* vehicle_data_items) const;
+ virtual bool GatherVehicleData(policy_table::VehicleData* vehicle_data) const;
bool GatherAppGroup(const std::string& app_id,
policy_table::Strings* app_groups) const;
@@ -133,6 +135,10 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool GatherRequestSubType(
const std::string& app_id,
policy_table::RequestSubTypes* request_subtypes) const;
+ bool GatherAppServiceParameters(
+ const std::string& app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const;
+
bool GatherNickName(const std::string& app_id,
policy_table::Strings* nicknames) const;
@@ -155,6 +161,9 @@ class SQLPTRepresentation : public virtual PTRepresentation {
virtual bool SaveSpecificAppPolicy(
const policy_table::ApplicationPolicies::value_type& app);
virtual bool SaveDevicePolicy(const policy_table::DevicePolicy& device);
+ virtual bool SaveVehicleDataItems(
+ const policy_table::VehicleDataItems& vehicle_data_items);
+ virtual bool SaveVehicleData(const policy_table::VehicleData& vehicle_data);
virtual bool SaveMessageString(const std::string& type,
const std::string& lang,
@@ -171,6 +180,9 @@ class SQLPTRepresentation : public virtual PTRepresentation {
bool SaveRequestSubType(
const std::string& app_id,
const policy_table::RequestSubTypes& request_subtypes);
+ bool SaveAppServiceParameters(
+ const std::string& app_id,
+ const policy_table::AppServiceParameters& app_service_parameters);
public:
bool UpdateRequired() const;
@@ -195,6 +207,26 @@ class SQLPTRepresentation : public virtual PTRepresentation {
virtual bool IsDBVersionActual() const OVERRIDE;
virtual bool UpdateDBVersion() const OVERRIDE;
+ policy_table::VehicleDataItems GetVehicleDataItem(
+ const std::string& name, const std::string& key) const;
+ bool InsertVehicleDataItem(
+ const policy_table::VehicleDataItem& vehicle_data_item);
+ bool VehicleDataItemExists(
+ const policy_table::VehicleDataItem& vehicle_data_item) const;
+
+ /**
+ * @brief Retrieves vehicle data items of type Struct (which contains
+ * params) from the database including these parameters.
+ * @return Array of composite VehicleDataItems
+ */
+ policy_table::VehicleDataItems SelectCompositeVehicleDataItems() const;
+
+ /**
+ * @brief Retrieves vehicle data items of non Struct type from the database.
+ * @return Array of primitive VehicleDataItems
+ */
+ policy_table::VehicleDataItems SelectPrimitiveVehicleDataItems() const;
+
private:
static const std::string kDatabaseName;
utils::dbms::SQLDatabase* db_;
@@ -210,12 +242,17 @@ class SQLPTRepresentation : public virtual PTRepresentation {
const int32_t GetDBVersion() const;
bool SaveRpcs(int64_t group_id, const policy_table::Rpc& rpcs);
bool SaveServiceEndpoints(const policy_table::ServiceEndpoints& endpoints);
+ bool SaveServiceEndpointProperties(
+ const policy_table::ServiceEndpointProperties& endpoint_properties);
bool SaveSecondsBetweenRetries(
const policy_table::SecondsBetweenRetries& seconds);
bool SaveNumberOfNotificationsPerMinute(
const policy_table::NumberOfNotificationsPerMinute& notifications);
bool SaveMessageType(const std::string& type);
bool SaveLanguage(const std::string& code);
+ policy_table::VehicleDataItem PopulateVDIFromQuery(
+ const utils::dbms::SQLQuery& query) const;
+ bool DeleteVehicleDataItems() const;
bool is_in_memory;
};
diff --git a/src/components/policy/policy_regular/include/policy/status.h b/src/components/policy/policy_regular/include/policy/status.h
index c1ea2de4c1..4d8bc47dae 100644
--- a/src/components/policy/policy_regular/include/policy/status.h
+++ b/src/components/policy/policy_regular/include/policy/status.h
@@ -52,6 +52,7 @@ enum UpdateEvent {
kOnResetPolicyTableRequireUpdate,
kOnResetPolicyTableNoUpdate,
kScheduleUpdate,
+ kPendingUpdate,
kScheduleManualUpdate,
kOnResetRetrySequence,
kNoEvent
@@ -75,41 +76,41 @@ class Status {
const policy::PolicyTableStatus enum_status);
/**
- * @brief Destructor
- */
+ * @brief Destructor
+ */
virtual ~Status();
/**
- * @brief Process event by setting next status in case event can affect
- * current status or ignores the event
- * @param manager Status manager pointer
- * @param event Event which needs to be processed
- */
+ * @brief Process event by setting next status in case event can affect
+ * current status or ignores the event
+ * @param manager Status manager pointer
+ * @param event Event which needs to be processed
+ */
virtual void ProcessEvent(UpdateStatusManagerInterface* manager,
UpdateEvent event) = 0;
/**
- * @brief Return current status as string value
- * @return Status as string
- */
+ * @brief Return current status as string value
+ * @return Status as string
+ */
virtual const std::string get_status_string() const;
/**
- * @brief Return status as enum value
- * @return Status as enum value
- */
+ * @brief Return status as enum value
+ * @return Status as enum value
+ */
virtual PolicyTableStatus get_status() const;
/**
- * @brief Check whether update is required in terms of status
- * @return True if update is required, otherwise - false
- */
+ * @brief Check whether update is required in terms of status
+ * @return True if update is required, otherwise - false
+ */
virtual bool IsUpdateRequired() const;
/**
- * @brief Check whether update is pending in terms of status
- * @return True if update is pending, otherwise - false
- */
+ * @brief Check whether update is pending in terms of status
+ * @return True if update is pending, otherwise - false
+ */
virtual bool IsUpdatePending() const;
private:
@@ -118,6 +119,39 @@ class Status {
};
/**
+ * @brief The UpdatePendingStatus class represents cases when SDL knows that an
+ * update is required but before the snapshot is sent to the HMI
+ */
+class UpdatePendingStatus : public Status {
+ public:
+ /**
+ * @brief Constructor
+ */
+ UpdatePendingStatus();
+
+ /**
+ * @brief Process event by setting next status in case event can affect
+ * current status or ignores the event
+ * @param manager Status manager pointer
+ * @param event Event which needs to be processed
+ */
+ void ProcessEvent(UpdateStatusManagerInterface* manager,
+ UpdateEvent event) OVERRIDE;
+
+ /**
+ * @brief Check whether update is required in terms of status
+ * @return True if update is required, otherwise - false
+ */
+ bool IsUpdateRequired() const OVERRIDE;
+
+ /**
+ * @brief Check whether update is pending in terms of status
+ * @return True if update is pending, otherwise - false
+ */
+ bool IsUpdatePending() const OVERRIDE;
+};
+
+/**
* @brief The UpToDateStatus class represents 'up-to-date' status
*/
class UpToDateStatus : public Status {
@@ -128,11 +162,11 @@ class UpToDateStatus : public Status {
UpToDateStatus();
/**
- * @brief Process event by setting next status in case event can affect
- * current status or ignores the event
- * @param manager Status manager pointer
- * @param event Event which needs to be processed
- */
+ * @brief Process event by setting next status in case event can affect
+ * current status or ignores the event
+ * @param manager Status manager pointer
+ * @param event Event which needs to be processed
+ */
void ProcessEvent(UpdateStatusManagerInterface* manager,
UpdateEvent event) OVERRIDE;
};
@@ -148,18 +182,18 @@ class UpdateNeededStatus : public Status {
UpdateNeededStatus();
/**
- * @brief Process event by setting next status in case event can affect
- * current status or ignores the event
- * @param manager Status manager pointer
- * @param event Event which needs to be processed
- */
+ * @brief Process event by setting next status in case event can affect
+ * current status or ignores the event
+ * @param manager Status manager pointer
+ * @param event Event which needs to be processed
+ */
void ProcessEvent(UpdateStatusManagerInterface* manager,
UpdateEvent event) OVERRIDE;
/**
- * @brief Check whether update is required in terms of status
- * @return True if update is required, otherwise - false
- */
+ * @brief Check whether update is required in terms of status
+ * @return True if update is required, otherwise - false
+ */
bool IsUpdateRequired() const OVERRIDE;
};
@@ -174,26 +208,26 @@ class UpdatingStatus : public Status {
UpdatingStatus();
/**
- * @brief Process event by setting next status in case event can affect
- * current status or ignores the event
- * @param manager Status manager pointer
- * @param event Event which needs to be processed
- */
+ * @brief Process event by setting next status in case event can affect
+ * current status or ignores the event
+ * @param manager Status manager pointer
+ * @param event Event which needs to be processed
+ */
void ProcessEvent(UpdateStatusManagerInterface* manager,
UpdateEvent event) OVERRIDE;
/**
- * @brief Check whether update is required in terms of status
- * @return True if update is required, otherwise - false
- */
+ * @brief Check whether update is required in terms of status
+ * @return True if update is required, otherwise - false
+ */
bool IsUpdateRequired() const OVERRIDE;
/**
- * @brief Check whether update is pending in terms of status
- * @return True if update is pending, otherwise - false
- */
+ * @brief Check whether update is pending in terms of status
+ * @return True if update is pending, otherwise - false
+ */
bool IsUpdatePending() const OVERRIDE;
};
-}
+} // namespace policy
#endif // SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_STATUS_H_
diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager.h b/src/components/policy/policy_regular/include/policy/update_status_manager.h
index a68d986d10..fb679ac10b 100644
--- a/src/components/policy/policy_regular/include/policy/update_status_manager.h
+++ b/src/components/policy/policy_regular/include/policy/update_status_manager.h
@@ -33,15 +33,14 @@
#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_H_
#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_H_
-#include "policy/update_status_manager_interface.h"
#include "policy/policy_types.h"
-#include "utils/lock.h"
-#include "utils/threads/thread.h"
-#include "utils/threads/thread_delegate.h"
+#include "policy/update_status_manager_interface.h"
#include "utils/conditional_variable.h"
#include "utils/lock.h"
#include "utils/logger.h"
#include "utils/macro.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/thread_delegate.h"
namespace policy {
@@ -66,14 +65,14 @@ class UpdateStatusManager : public UpdateStatusManagerInterface {
* @brief Set next status during event processing
* @param status Status shared pointer
*/
- void SetNextStatus(utils::SharedPtr<Status> status);
+ void SetNextStatus(std::shared_ptr<Status> status);
/**
* @brief Set postponed status (will be set after next status) during event
* processing
* @param status Status shared pointer
*/
- void SetPostponedStatus(utils::SharedPtr<Status> status);
+ void SetPostponedStatus(std::shared_ptr<Status> status);
/**
* @brief Sets listener pointer
@@ -118,10 +117,10 @@ class UpdateStatusManager : public UpdateStatusManagerInterface {
void OnNewApplicationAdded(const DeviceConsent consent);
/**
- * @brief Update status handler for policy initialization
+ * @brief Update status handler on existed application registering
* @param is_update_required Update necessity flag
*/
- void OnPolicyInit(bool is_update_required);
+ void OnExistedApplicationAdded(const bool is_update_required);
/**
* @brief In case application from non-consented device has been registered
@@ -150,6 +149,12 @@ class UpdateStatusManager : public UpdateStatusManagerInterface {
void ScheduleUpdate();
/**
+ * @brief PendingUpdate will change state from Update_Needed
+ * to Update_Pending
+ */
+ void PendingUpdate();
+
+ /**
* @brief ScheduleUpdate allows to schedule next update.
* It will change state to Update_Needed, that's is
* and will not send any notifications about updating to HMI
@@ -198,17 +203,17 @@ class UpdateStatusManager : public UpdateStatusManagerInterface {
/**
* @brief Current update status
*/
- utils::SharedPtr<Status> current_status_;
+ std::shared_ptr<Status> current_status_;
/**
* @brief Next status after current to be set
*/
- utils::SharedPtr<Status> next_status_;
+ std::shared_ptr<Status> next_status_;
/**
* @brief Status to be set after 'next' status
*/
- utils::SharedPtr<Status> postponed_status_;
+ std::shared_ptr<Status> postponed_status_;
sync_primitives::Lock status_lock_;
UpdateEvent last_processed_event_;
@@ -216,6 +221,6 @@ class UpdateStatusManager : public UpdateStatusManagerInterface {
bool app_registered_from_non_consented_device_;
sync_primitives::Lock apps_search_in_progress_lock_;
};
-}
+} // namespace policy
#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_H_
diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h
index e118f9974f..4763ff2eb5 100644
--- a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h
+++ b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h
@@ -33,7 +33,6 @@
#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_INTERFACE_H_
#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_INTERFACE_H_
-#include "utils/shared_ptr.h"
#include "policy/policy_types.h"
#include "policy/status.h"
@@ -55,14 +54,14 @@ class UpdateStatusManagerInterface {
* @brief Set next status during event processing
* @param status Status shared pointer
*/
- virtual void SetNextStatus(utils::SharedPtr<Status> status) = 0;
+ virtual void SetNextStatus(std::shared_ptr<Status> status) = 0;
/**
* @brief Set postponed status (will be set after next status) during event
* processing
* @param status Status shared pointer
*/
- virtual void SetPostponedStatus(utils::SharedPtr<Status> status) = 0;
+ virtual void SetPostponedStatus(std::shared_ptr<Status> status) = 0;
/**
* @brief Sets listener pointer
* @param listener Pointer to policy listener implementation
@@ -106,13 +105,13 @@ class UpdateStatusManagerInterface {
virtual void OnNewApplicationAdded(DeviceConsent device_consent) = 0;
/**
- * @brief Update status handler for policy initialization
+ * @brief Update status handler on existed application registering
* @param is_update_required Update necessity flag
*/
- virtual void OnPolicyInit(bool is_update_required) = 0;
+ virtual void OnExistedApplicationAdded(const bool is_update_required) = 0;
};
-typedef utils::SharedPtr<UpdateStatusManagerInterface>
+typedef std::shared_ptr<UpdateStatusManagerInterface>
UpdateStatusManagerInterfaceSPtr;
} // namespace policy
diff --git a/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h b/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h
index 1e263ec9df..bd88815012 100644
--- a/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h
+++ b/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h
@@ -34,11 +34,11 @@
#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_USAGE_STATISTICS_COUNTER_H_
#include <ctime>
-#include "policy/usage_statistics/statistics_manager.h"
#include "policy/usage_statistics/app_stopwatch.h"
-#include "utils/shared_ptr.h"
-#include "utils/timer.h"
+#include "policy/usage_statistics/statistics_manager.h"
+
#include "utils/macro.h"
+#include "utils/timer.h"
namespace usage_statistics {
@@ -46,18 +46,18 @@ using timer::Timer;
class GlobalCounter {
public:
- GlobalCounter(utils::SharedPtr<StatisticsManager> statistics_manager,
+ GlobalCounter(std::shared_ptr<StatisticsManager> statistics_manager,
GlobalCounterId counter_type);
void operator++() const;
private:
GlobalCounterId counter_type_;
- utils::SharedPtr<StatisticsManager> statistics_manager_;
+ std::shared_ptr<StatisticsManager> statistics_manager_;
};
class AppCounter {
public:
- AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager,
+ AppCounter(std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id,
AppCounterId counter_type);
void operator++() const;
@@ -65,12 +65,12 @@ class AppCounter {
private:
std::string app_id_;
AppCounterId counter_type_;
- utils::SharedPtr<StatisticsManager> statistics_manager_;
+ std::shared_ptr<StatisticsManager> statistics_manager_;
};
class AppInfo {
public:
- AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager,
+ AppInfo(std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id,
AppInfoId info_type);
void Update(const std::string& new_info) const;
@@ -78,14 +78,14 @@ class AppInfo {
private:
std::string app_id_;
AppInfoId info_type_;
- utils::SharedPtr<StatisticsManager> statistics_manager_;
+ std::shared_ptr<StatisticsManager> statistics_manager_;
};
class AppStopwatchImpl : public AppStopwatch {
public:
- AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager,
+ AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id);
- AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager,
+ AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id,
std::uint32_t timeout);
void Start(AppStopwatchId stopwatch_type) OVERRIDE;
@@ -96,7 +96,7 @@ class AppStopwatchImpl : public AppStopwatch {
// Fields
std::string app_id_;
AppStopwatchId stopwatch_type_;
- utils::SharedPtr<StatisticsManager> statistics_manager_;
+ std::shared_ptr<StatisticsManager> statistics_manager_;
timer::Timer timer_;
const std::uint32_t time_out_;
DISALLOW_COPY_AND_ASSIGN(AppStopwatchImpl);
diff --git a/src/components/policy/policy_regular/policy_table_interface_ext.xml b/src/components/policy/policy_regular/policy_table_interface_ext.xml
deleted file mode 100644
index 742ed547a8..0000000000
--- a/src/components/policy/policy_regular/policy_table_interface_ext.xml
+++ /dev/null
@@ -1,283 +0,0 @@
-
-<?xml version="1.0" standalone="no"?>
-<?xml-stylesheet type="text/xml" href="protocol2html.xsl"?>
-
-<interface name="policy table interface base" version="0.0"
- date="2014-01-23">
-
- <!-- Common parameters start -->
- <enum name="Priority">
- <element name="EMERGENCY" />
- <element name="NAVIGATION" />
- <element name="VOICECOM" />
- <element name="COMMUNICATION" />
- <element name="NORMAL" />
- <element name="NONE" />
- </enum>
-
- <enum name="HmiLevel">
- <element name="BACKGROUND" />
- <element name="FULL" />
- <element name="LIMITED" />
- <element name="NONE" />
- </enum>
-
- <enum name="Parameter">
- <element name="gps" />
- <element name="speed" />
- <element name="engineTorque" />
- <element name="externalTemperature" />
- <element name="turnSignal" />
- <element name="fuelLevel" />
- <element name="fuelLevel_State" />
- <element name="headLampStatus" />
- <element name="instantFuelConsumption" />
- <element name="fuelRange" />
- <element name="odometer" />
- <element name="tirePressure" />
- <element name="wiperStatus" />
- <element name="vin" />
- <element name="accPedalPosition" />
- <element name="beltStatus" />
- <element name="driverBraking" />
- <element name="prndl" />
- <element name="rpm" />
- <element name="steeringWheelAngle" />
- <element name="engineOilLife" />
- <element name="myKey" />
- <element name="airbagStatus" />
- <element name="bodyInformation" />
- <element name="clusterModeStatus" />
- <element name="deviceStatus" />
- <element name="emergencyEvent" />
- <element name="eCallInfo" />
- </enum>
-
- <enum name="AppHMIType">
- <element name="DEFAULT" />
- <element name="COMMUNICATION" />
- <element name="MEDIA" />
- <element name="MESSAGING" />
- <element name="NAVIGATION" />
- <element name="INFORMATION" />
- <element name="SOCIAL" />
- <element name="BACKGROUND_PROCESS" />
- <element name="TESTING" />
- <element name="SYSTEM" />
- </enum>
- <!-- Common parameters end -->
-
- <!-- app_policies section start -->
-
- <typedef name="Strings" type="String" maxlength="255" array="true"
- maxsize="255" />
-
- <typedef name="AppHMITypes" type="AppHMIType" array="true"
- maxsize="255" />
-
- <struct name="ApplicationParams">
- <param name="groups" type="Strings" />
- <param name="nicknames" type="Strings" mandatory="false" />
- <param name="preconsented_groups" type="Strings" mandatory="false" />
- <param name="AppHMIType" type="AppHMITypes" mandatory="false" />
- <param name="priority" type="Priority" />
- <param name="default_hmi" type="HmiLevel" />
- <param name="keep_context" type="Boolean" />
- <param name="steal_focus" type="Boolean" />
- <param name="memory_kb" type="Integer" minvalue="1" maxvalue="65225" mandatory="false"/>
- <param name="watchdog_timer_ms" type="Integer" minvalue="1"
- maxvalue="65225" mandatory="false"/>
- <param name="certificate" type="String" minlength="0" maxlength="255"
- mandatory="false" />
- </struct>
-
- <typedef name="HmiLevels" type="HmiLevel" array="true"
- maxsize="4" />
- <typedef name="Parameters" type="Parameter" array="true"
- maxsize="24" />
-
- <struct name="RpcParameters">
- <!-- maxsizes are equal to number of currently known elements of
- given type -->
- <param name="hmi_levels" type="HmiLevels" />
- <param name="parameters" type="Parameters" mandatory="false" />
- </struct>
-
- <!-- maxsizes are equal to number of currently known elements of given
- type -->
- <typedef name="Rpc" type="RpcParameters" map="true" maxsize="50" null_values_allowed="true" />
-
- <struct name="Rpcs">
- <param name="user_consent_prompt" type="String" minlegth="1"
- maxlength="255" mandatory="false"/>
- <param name="rpcs" type="Rpc" null_values_allowed="true"/>
- </struct>
- <!-- app_policies section end -->
-
- <!-- module_config section start -->
- <!-- minlenght="10" since minimum expected is "http://a.b" -->
- <typedef name="URL" type="String" minlength="10" maxlength="255"
- array="true" minsize="1" maxsize="255" />
-
- <typedef name="URLList" type="URL" map="true" minsize="1"
- maxsize="255" />
-
- <!-- max number of services is limited to 255 according to protocol specification -->
- <typedef name="ServiceEndpoints" type="URLList" map="true"
- minsize="1" maxsize="255" />
-
- <typedef name="NumberOfNotificationsPerMinute" type="Integer"
- map="true" maxsize="7" minvalue="0" maxvalue="255" />
-
- <typedef name="SecondsBetweenRetries" type="Integer" array="true"
- maxsize="10" minvalue="1" maxvalue="1000" />
-
- <struct name="ModuleConfig">
- <param name="device_certificates" type="String" minlength="1" maxlength="100" mandatory="false" map="true" minsize="1" maxsize="255" />
- <param name="preloaded_pt" type="Boolean" mandatory="false" />
- <param name="exchange_after_x_ignition_cycles" type="Integer"
- maxvalue="255" />
- <param name="exchange_after_x_kilometers" type="Integer"
- maxvalue="4294967296" />
- <param name="exchange_after_x_days" type="Integer"
- maxvalue="255" />
- <param name="timeout_after_x_seconds" type="Integer"
- maxvalue="65535" />
- <param name="seconds_between_retries" type="SecondsBetweenRetries" />
- <param name="endpoints" type="ServiceEndpoints" />
- <param name="notifications_per_minute_by_priority" type="NumberOfNotificationsPerMinute" />
- <param name="vehicle_make" type="String" maxlength="100"
- mandatory="false" />
- <param name="vehicle_model" type="String" maxlength="100"
- mandatory="false" />
- <param name="vehicle_year" type="String" minlength="4" maxlength="4"
- mandatory="false" />
- </struct>
- <!-- module_config section end -->
-
- <!-- consumer_friendly_messages section start -->
- <struct name="MessageString">
- <param name="line1" type="String" maxlength="255"
- mandatory="false" />
- <param name="line2" type="String" maxlength="255"
- mandatory="false" />
- <param name="tts" type="String" maxlength="65535" mandatory="false" />
- <param name="label" type="String" maxlength="255"
- mandatory="false" />
- <param name="textBody" type="String" maxlength="500"
- mandatory="false" />
- </struct>
-
- <typedef name="Languages" map="true" type="MessageString"
- maxsize="500" mandatory="false" />
-
- <struct name="MessageLanguages">
- <param name="languages" type="Languages" />
- </struct>
-
- <typedef name="Messages" map="true" type="MessageLanguages"
- maxsize="255" />
-
- <struct name="ConsumerFriendlyMessages">
- <param name="version" type="String" maxlength="100" />
- <param name="messages" type="Messages" mandatory="false" />
- </struct>
- <!-- consumer_friendly_messages section end -->
-
- <!-- module_meta section start -->
- <struct name="ModuleMeta">
- <param name="ccpu_version" type="String" maxlength="250" mandatory="false"/>
- <param name="language" type="String" maxlength="250" mandatory="false"/>
- <param name="wers_country_code" type="String" maxlength="250" mandatory="false"/>
- <param name="pt_exchanged_at_odometer_x" type="Integer" minvalue="0" maxvalue="65535" mandatory="false"/>
- <param name="pt_exchanged_x_days_after_epoch" type="Integer" minvalue="0" maxvalue="65535" mandatory="false"/>
- <param name="ignition_cycles_since_last_exchange" type="Integer" minvalue="0" maxvalue="65535" mandatory="false"/>
- <param name="vin" type="String" maxlength="250" mandatory="false"/>
- </struct>
- <!-- module_meta section end -->
-
- <!-- usage_and_error_counts section start -->
- <struct name="AppLevel">
- <param name="minutes_in_hmi_full" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="app_registration_language_gui" type="String" minlength="1" maxlength="10" />
- <param name="app_registration_language_vui" type="String" minlength="1" maxlength="10" />
- <param name="count_of_rfcom_limit_reached" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="minutes_in_hmi_limited" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="minutes_in_hmi_background" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="minutes_in_hmi_none" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="count_of_user_selections" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="count_of_rejections_sync_out_of_memory" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="count_of_rejections_nickname_mismatch" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="count_of_rejections_duplicate_name" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="count_of_rejected_rpc_calls" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="count_of_rpcs_sent_in_hmi_none" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="count_of_removals_for_bad_behavior" type="Integer" minvalue="0" maxvalue="65535" />
- <param name="count_of_run_attempts_while_revoked" type="Integer" minvalue="0" maxvalue="65535" />
- </struct>
-
- <typedef name="AppLevels" type="AppLevel" map="true"
- maxsize="255" />
-
- <struct name="UsageAndErrorCounts">
- <param name="count_of_iap_buffer_full" type="Integer" minvalue="0" maxvalue="65535" mandatory="false" />
- <param name="count_sync_out_of_memory" type="Integer" minvalue="0" maxvalue="65535" mandatory="false" />
- <param name="count_of_sync_reboots" type="Integer" minvalue="0" maxvalue="65535" mandatory="false" />
- <param name="app_level" type="AppLevels" mandatory="false" />
- </struct>
- <!-- usage_and_error_counts section end -->
-
- <!-- device_data section start -->
- <enum name="Input" scope="internal">
- <element name="GUI" />
- <element name="VUI" />
- </enum>
-
- <typedef name="ConsentGroups" scope="internal" type="Boolean" map="true" maxsize="255" mandatory="false"/>
-
- <struct name="ConsentRecords" scope="internal">
- <param name="consent_groups" type="ConsentGroups" mandatory="false"/>
- <param name="input" type="Input" mandatory="false" />
- <param name="time_stamp" type="String" maxlength="255" mandatory="false" />
- </struct>
-
- <typedef name="UserConsentRecords" scope="internal" map="true" type="ConsentRecords" minsize="0" maxsize="1000"/>
-
- <struct name="DeviceParams" scope="internal">
- <param name="hardware" type="String" maxlength="255" mandatory="false"/>
- <param name="firmware_rev" type="String" maxlength="255" nullable="true" mandatory="false"/>
- <param name="os" type="String" maxlength="255" mandatory="false"/>
- <param name="os_version" type="String" maxlength="255" mandatory="false"/>
- <param name="carrier" type="String" maxlength="255" nullable="true" mandatory="false"/>
- <param name="user_consent_records" type="UserConsentRecords" mandatory="false"/>
- <param name="max_number_rfcom_ports" type="Integer" maxvalue="255" mandatory="false"/>
- </struct>
- <!-- device_data section end -->
-
- <!-- policy_table section start -->
- <typedef name="ApplicationPolicies" map="true" type="ApplicationParams"
- null_values_allowed="true" minsize="1" maxsize="1000" />
-
- <typedef name="FunctionalGroupings" map="true" type="Rpcs"
- minsize="1" maxsize="255" />
-
- <typedef name="DeviceData" map="true" type="DeviceParams"
- maxsize="255" />
-
- <struct name="PolicyTable">
- <!-- maxsize for app_policies can be changed, if necessary -->
- <param name="app_policies" type="ApplicationPolicies" />
- <param name="functional_groupings" type="FunctionalGroupings" />
- <param name="consumer_friendly_messages" type="ConsumerFriendlyMessages" />
- <param name="module_config" type="ModuleConfig" />
- <param name="module_meta" type="ModuleMeta" mandatory="false"/>
- <param name="usage_and_error_counts" type="UsageAndErrorCounts" mandatory="false" />
- <param name="device_data" type="DeviceData" mandatory="false" />
- </struct>
- <!-- policy_table section end -->
-
- <!-- Root element -->
- <struct name="Table">
- <param name="policy_table" type="PolicyTable" />
- </struct>
-
-</interface>
diff --git a/src/components/policy/policy_regular/src/access_remote_impl.cc b/src/components/policy/policy_regular/src/access_remote_impl.cc
index f99b226f2e..f743a4d56e 100644
--- a/src/components/policy/policy_regular/src/access_remote_impl.cc
+++ b/src/components/policy/policy_regular/src/access_remote_impl.cc
@@ -89,7 +89,7 @@ struct ToModuleType {
AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()) {}
-AccessRemoteImpl::AccessRemoteImpl(utils::SharedPtr<CacheManager> cache)
+AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache)
: cache_(cache) {}
bool AccessRemoteImpl::CheckModuleType(const PTString& app_id,
diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc
index 1d51b81af4..28ceec3ccb 100644
--- a/src/components/policy/policy_regular/src/cache_manager.cc
+++ b/src/components/policy/policy_regular/src/cache_manager.cc
@@ -33,23 +33,27 @@
#include "policy/cache_manager.h"
#include <algorithm>
-#include <functional>
-#include <ctime>
+#include <boost/algorithm/string.hpp>
#include <cmath>
+#include <ctime>
+#include <functional>
#include <sstream>
-#include "utils/file_system.h"
-#include "utils/helpers.h"
+#include "interfaces/MOBILE_API.h"
+#include "json/json_features.h"
#include "json/reader.h"
-#include "json/features.h"
#include "json/writer.h"
-#include "utils/logger.h"
+#include "smart_objects/enum_schema_item.h"
#include "utils/date_time.h"
+#include "utils/file_system.h"
#include "utils/gen_hash.h"
+#include "utils/helpers.h"
+#include "utils/logger.h"
#include "utils/macro.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
+#include "policy/policy_helper.h"
#include "policy/sql_pt_representation.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -104,7 +108,8 @@ CacheManager::CacheManager()
, pt_(new policy_table::Table)
, backup_(new SQLPTRepresentation())
, update_required(false)
- , cache_lock_(true) {
+ , removed_custom_vd_items_()
+ , settings_(nullptr) {
LOG4CXX_AUTO_TRACE(logger_);
backuper_ = new BackgroundBackuper(this);
backup_thread_ = threads::CreateThread("Backup thread", backuper_);
@@ -124,6 +129,20 @@ const policy_table::Strings& CacheManager::GetGroups(const PTString& app_id) {
return pt_->policy_table.app_policies_section.apps[app_id].groups;
}
+const policy_table::Strings CacheManager::GetPolicyAppIDs() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ const auto apps = pt_->policy_table.app_policies_section.apps;
+
+ policy_table::Strings policy_app_ids;
+ for (const auto& app : apps) {
+ policy_app_ids.push_back(app.first);
+ }
+
+ return policy_app_ids;
+}
+
bool CacheManager::CanAppKeepContext(const std::string& app_id) const {
CACHE_MANAGER_CHECK(false);
bool result = true;
@@ -282,11 +301,58 @@ bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) {
pt_->policy_table.consumer_friendly_messages.assign_if_valid(
update_pt.policy_table.consumer_friendly_messages);
+ pt_->policy_table.module_config.endpoint_properties =
+ update_pt.policy_table.module_config.endpoint_properties;
+
+ // Apply update for vehicle data
+ if (update_pt.policy_table.vehicle_data.is_initialized()) {
+ policy_table::VehicleDataItems custom_items_before_apply;
+ if (pt_->policy_table.vehicle_data->schema_items.is_initialized()) {
+ custom_items_before_apply =
+ CollectCustomVDItems(*pt_->policy_table.vehicle_data->schema_items);
+ }
+
+ if (!update_pt.policy_table.vehicle_data->schema_items.is_initialized() ||
+ update_pt.policy_table.vehicle_data->schema_items->empty()) {
+ pt_->policy_table.vehicle_data->schema_items =
+ rpc::Optional<policy_table::VehicleDataItems>();
+ } else {
+ policy_table::VehicleDataItems custom_items = CollectCustomVDItems(
+ *update_pt.policy_table.vehicle_data->schema_items);
+
+ pt_->policy_table.vehicle_data->schema_version =
+ update_pt.policy_table.vehicle_data->schema_version;
+ pt_->policy_table.vehicle_data->schema_items =
+ rpc::Optional<policy_table::VehicleDataItems>(custom_items);
+ }
+
+ policy_table::VehicleDataItems custom_items_after_apply =
+ *pt_->policy_table.vehicle_data->schema_items;
+ const auto& items_diff = CalculateCustomVdItemsDiff(
+ custom_items_before_apply, custom_items_after_apply);
+ SetRemovedCustomVdItems(items_diff);
+ }
+
ResetCalculatedPermissions();
Backup();
return true;
}
+policy_table::VehicleDataItems CacheManager::CollectCustomVDItems(
+ const policy_table::VehicleDataItems& vd_items) {
+ policy_table::VehicleDataItems result_items;
+ for (auto& item : vd_items) {
+ const std::string i_name = "VEHICLEDATA_" + std::string(item.name);
+ const std::string vd_name = boost::to_upper_copy<std::string>(i_name);
+ const bool is_rpc_spec =
+ policy_table::EnumSchemaItemFactory::IsRPCSpecVehicleDataType(vd_name);
+ if (!is_rpc_spec) {
+ result_items.push_back(item);
+ }
+ }
+ return result_items;
+}
+
void CacheManager::GetHMIAppTypeAfterUpdate(
std::map<std::string, StringArray>& app_hmi_types) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -512,14 +578,8 @@ void CacheManager::CheckPermissions(const policy_table::Strings& groups,
if (rpc_param.hmi_levels.end() != hmi_iter) {
result.hmi_level_permitted = PermitResult::kRpcAllowed;
- policy_table::Parameters::const_iterator params_iter =
- rpc_param.parameters->begin();
- policy_table::Parameters::const_iterator params_iter_end =
- rpc_param.parameters->end();
-
- for (; params_iter != params_iter_end; ++params_iter) {
- result.list_of_allowed_params.insert(
- policy_table::EnumToJsonString(*params_iter));
+ for (const auto& param : *rpc_param.parameters) {
+ result.list_of_allowed_params.insert(std::string(param));
}
}
}
@@ -646,7 +706,7 @@ int CacheManager::TimeoutResponse() {
CACHE_MANAGER_CHECK(0);
sync_primitives::AutoLock auto_lock(cache_lock_);
return pt_->policy_table.module_config.timeout_after_x_seconds *
- date_time::DateTime::MILLISECONDS_IN_SECOND;
+ date_time::MILLISECONDS_IN_SECOND;
}
bool CacheManager::SecondsBetweenRetries(std::vector<int>& seconds) {
@@ -666,24 +726,263 @@ bool CacheManager::SecondsBetweenRetries(std::vector<int>& seconds) {
return true;
}
-const policy::VehicleInfo CacheManager::GetVehicleInfo() const {
- CACHE_MANAGER_CHECK(VehicleInfo());
+const std::vector<policy_table::VehicleDataItem>
+CacheManager::GetVehicleDataItems() const {
+ CACHE_MANAGER_CHECK(std::vector<policy_table::VehicleDataItem>());
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+ if (pt_->policy_table.vehicle_data.is_initialized() &&
+ pt_->policy_table.vehicle_data->schema_items.is_initialized()) {
+ return *(pt_->policy_table.vehicle_data->schema_items);
+ }
+
+ return std::vector<policy_table::VehicleDataItem>();
+}
+
+std::vector<policy_table::VehicleDataItem>
+CacheManager::GetRemovedVehicleDataItems() const {
+ CACHE_MANAGER_CHECK(std::vector<policy_table::VehicleDataItem>());
+ return removed_custom_vd_items_;
+}
+
+Json::Value CacheManager::GetPolicyTableData() const {
+ return pt_->policy_table.ToJsonValue();
+}
+
+void CacheManager::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ enabled_apps.clear();
+ return;
+#else
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ for (policy_table::ApplicationPolicies::const_iterator it = policies.begin();
+ it != policies.end();
+ ++it) {
+ auto app_policy = (*it).second;
+ if (app_policy.enabled.is_initialized() && *app_policy.enabled) {
+ enabled_apps.push_back((*it).first);
+ }
+ }
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+}
+
+std::vector<std::string> CacheManager::GetEnabledLocalApps() const {
+#if !defined(WEBSOCKET_SERVER_TRANSPORT_SUPPORT)
+ return std::vector<std::string>();
+#else
+ std::vector<std::string> enabled_apps;
+ const policy_table::ApplicationPolicies& app_policies =
+ pt_->policy_table.app_policies_section.apps;
+ for (const auto& app_policies_item : app_policies) {
+ const auto app_policy = app_policies_item.second;
+ // Local (WebEngine) applications
+ // should not have "endpoint" field
+ if (app_policy.endpoint.is_initialized()) {
+ continue;
+ }
+ if (app_policy.enabled.is_initialized() && *app_policy.enabled) {
+ enabled_apps.push_back(app_policies_item.first);
+ }
+ }
+ return enabled_apps;
+#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+}
+
+bool CacheManager::GetAppProperties(const std::string& policy_app_id,
+ AppProperties& out_app_properties) const {
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ auto app_policy = (*policy_iter).second;
+ out_app_properties.endpoint = app_policy.endpoint.is_initialized()
+ ? *app_policy.endpoint
+ : std::string();
+ out_app_properties.auth_token = app_policy.auth_token.is_initialized()
+ ? *app_policy.auth_token
+ : std::string();
+ out_app_properties.transport_type =
+ app_policy.cloud_transport_type.is_initialized()
+ ? *app_policy.cloud_transport_type
+ : std::string();
+ out_app_properties.certificate = app_policy.certificate.is_initialized()
+ ? *app_policy.certificate
+ : std::string();
+ out_app_properties.hybrid_app_preference =
+ app_policy.hybrid_app_preference.is_initialized()
+ ? EnumToJsonString(*app_policy.hybrid_app_preference)
+ : std::string();
+ out_app_properties.enabled =
+ app_policy.enabled.is_initialized() && *app_policy.enabled;
+ return true;
+ }
+ return false;
+}
+
+void CacheManager::InitCloudApp(const std::string& policy_app_id) {
+ CACHE_MANAGER_CHECK_VOID();
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator default_iter =
+ policies.find(kDefaultId);
+ policy_table::ApplicationPolicies::const_iterator app_iter =
+ policies.find(policy_app_id);
+
+ if (default_iter != policies.end()) {
+ if (app_iter == policies.end()) {
+ policies[policy_app_id] = policies[kDefaultId];
+ }
+ }
+ // Add cloud app specific policies
+
+ Backup();
+}
+
+void CacheManager::SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.enabled = enabled;
+ }
+}
+
+void CacheManager::SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.auth_token = auth_token;
+ }
+}
+
+void CacheManager::SetAppCloudTransportType(
+ const std::string& policy_app_id, const std::string& cloud_transport_type) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.cloud_transport_type = cloud_transport_type;
+ }
+}
+
+void CacheManager::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ *(*policy_iter).second.endpoint = endpoint;
+ }
+}
+
+void CacheManager::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ (*(*policy_iter).second.nicknames) = nicknames;
+ }
+}
+
+void CacheManager::SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) {
+ policy_table::HybridAppPreference value;
+ bool valid = EnumFromJsonString(hybrid_app_preference, &value);
+ policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter && valid) {
+ *(*policy_iter).second.hybrid_app_preference = value;
+ }
+}
+
+void CacheManager::GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ auto app_policy = (*policy_iter).second;
+ if (app_policy.app_service_parameters.is_initialized()) {
+ *app_service_parameters = *(app_policy.app_service_parameters);
+ }
+ }
+}
+
+bool CacheManager::UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const {
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ const auto app_policy = (*policy_iter).second;
+ if (app_policy.allow_unknown_rpc_passthrough.is_initialized()) {
+ return *(app_policy.allow_unknown_rpc_passthrough);
+ }
+ }
+ return false;
+}
+
+const boost::optional<bool> CacheManager::LockScreenDismissalEnabledState()
+ const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ boost::optional<bool> empty;
+ CACHE_MANAGER_CHECK(empty);
sync_primitives::AutoLock auto_lock(cache_lock_);
policy_table::ModuleConfig& module_config = pt_->policy_table.module_config;
- VehicleInfo vehicle_info;
- vehicle_info.vehicle_make = *module_config.vehicle_make;
- vehicle_info.vehicle_model = *module_config.vehicle_model;
- vehicle_info.vehicle_year = *module_config.vehicle_year;
- LOG4CXX_DEBUG(
- logger_,
- "Vehicle info (make, model, year):" << vehicle_info.vehicle_make << ","
- << vehicle_info.vehicle_model << ","
- << vehicle_info.vehicle_year);
- return vehicle_info;
+ if (module_config.lock_screen_dismissal_enabled.is_initialized()) {
+ LOG4CXX_TRACE(logger_,
+ "state = " << *module_config.lock_screen_dismissal_enabled);
+ return boost::optional<bool>(*module_config.lock_screen_dismissal_enabled);
+ }
+ LOG4CXX_TRACE(logger_, "state = empty");
+ return empty;
+}
+
+const boost::optional<std::string>
+CacheManager::LockScreenDismissalWarningMessage(
+ const std::string& language) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ boost::optional<std::string> empty;
+ CACHE_MANAGER_CHECK(empty);
+
+ const std::string lock_screen_dismissal_warning_message =
+ "LockScreenDismissalWarning";
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ std::vector<std::string> msg_codes{lock_screen_dismissal_warning_message};
+
+ const auto messages = GetUserFriendlyMsg(msg_codes, language);
+
+ if (messages.empty() || messages[0].text_body.empty()) {
+ return empty;
+ }
+
+ return boost::optional<std::string>(messages[0].text_body);
}
std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
- const std::vector<std::string>& msg_codes, const std::string& language) {
+ const std::vector<std::string>& msg_codes,
+ const std::string& language) const {
LOG4CXX_AUTO_TRACE(logger_);
std::vector<UserFriendlyMessage> result;
CACHE_MANAGER_CHECK(result);
@@ -729,22 +1028,36 @@ std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
UserFriendlyMessage msg;
msg.message_code = *it;
+ msg.tts = *message_string.tts;
+ msg.label = *message_string.label;
+ msg.line1 = *message_string.line1;
+ msg.line2 = *message_string.line2;
+ msg.text_body = *message_string.textBody;
+
result.push_back(msg);
}
return result;
}
void CacheManager::GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) {
- std::stringstream service_type_stream;
- service_type_stream << (service_type <= 9 ? "0x0" : "0x") << service_type;
-
- const std::string service_type_str = service_type_stream.str();
- GetUpdateUrls(service_type_str, out_end_points);
+ EndpointUrls& out_end_points) const {
+ auto find_hexademical =
+ [service_type](policy_table::ServiceEndpoints::value_type end_point) {
+ uint32_t decimal;
+ std::istringstream(end_point.first) >> std::hex >> decimal;
+ return end_point.first.compare(0, 2, "0x") == 0 &&
+ decimal == service_type;
+ };
+ auto& end_points = pt_->policy_table.module_config.endpoints;
+ const auto end_point =
+ std::find_if(end_points.begin(), end_points.end(), find_hexademical);
+ if (end_point != end_points.end()) {
+ GetUpdateUrls(end_point->first, out_end_points);
+ }
}
void CacheManager::GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
@@ -771,11 +1084,19 @@ void CacheManager::GetUpdateUrls(const std::string& service_type,
}
}
-std::string CacheManager::GetLockScreenIconUrl() const {
- if (backup_) {
- return backup_->GetLockScreenIconUrl();
+std::string CacheManager::GetIconUrl(const std::string& policy_app_id) const {
+ CACHE_MANAGER_CHECK(std::string());
+ std::string url;
+ const policy_table::ApplicationPolicies& policies =
+ pt_->policy_table.app_policies_section.apps;
+ policy_table::ApplicationPolicies::const_iterator policy_iter =
+ policies.find(policy_app_id);
+ if (policies.end() != policy_iter) {
+ auto app_policy = (*policy_iter).second;
+ url = app_policy.icon_url.is_initialized() ? *app_policy.icon_url
+ : std::string();
}
- return std::string("");
+ return url;
}
rpc::policy_table_interface_base::NumberOfNotificationsType
@@ -826,6 +1147,9 @@ void CacheManager::CheckSnapshotInitialization() {
*(snapshot_->policy_table.module_config.preloaded_pt) = false;
+ *(snapshot_->policy_table.module_config.full_app_id_supported) =
+ get_settings().use_full_app_id();
+
// SDL must not send certificate in snapshot
snapshot_->policy_table.module_config.certificate =
rpc::Optional<rpc::String<0, 65535> >();
@@ -932,10 +1256,50 @@ void CacheManager::CheckSnapshotInitialization() {
}
}
+policy_table::VehicleDataItems CacheManager::CalculateCustomVdItemsDiff(
+ const policy_table::VehicleDataItems& items_before,
+ const policy_table::VehicleDataItems& items_after) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (items_before.empty()) {
+ LOG4CXX_DEBUG(logger_, "No custom VD items found in policy");
+ return policy_table::VehicleDataItems();
+ }
+
+ if (items_after.empty()) {
+ LOG4CXX_DEBUG(logger_,
+ "All custom VD items were removed after policy update");
+ return items_before;
+ }
+
+ policy_table::VehicleDataItems removed_items;
+ for (auto& item_to_search : items_before) {
+ auto item_predicate =
+ [&item_to_search](const policy_table::VehicleDataItem& item_to_check) {
+ return item_to_search.name == item_to_check.name;
+ };
+
+ auto it =
+ std::find_if(items_after.begin(), items_after.end(), item_predicate);
+ if (items_after.end() == it) {
+ removed_items.push_back(item_to_search);
+ }
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Found " << removed_items.size() << " removed VD items");
+ return removed_items;
+}
+
+void CacheManager::SetRemovedCustomVdItems(
+ const policy_table::VehicleDataItems& removed_items) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ removed_custom_vd_items_ = removed_items;
+}
+
void CacheManager::PersistData() {
LOG4CXX_AUTO_TRACE(logger_);
- if (backup_.valid()) {
- if (pt_.valid()) {
+ if (backup_.use_count() != 0) {
+ if (pt_.use_count() != 0) {
// Comma expression is used to hold the lock only during the constructor
// call
policy_table::Table copy_pt(
@@ -1029,10 +1393,10 @@ bool CacheManager::IsPermissionsCalculated(const std::string& device_id,
return false;
}
-utils::SharedPtr<policy_table::Table> CacheManager::GenerateSnapshot() {
+std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() {
CACHE_MANAGER_CHECK(snapshot_);
- snapshot_ = new policy_table::Table();
+ snapshot_ = std::make_shared<policy_table::Table>();
// Copy all members of policy table except messages in consumer friendly
// messages
@@ -1048,8 +1412,20 @@ utils::SharedPtr<policy_table::Table> CacheManager::GenerateSnapshot() {
snapshot_->policy_table.module_meta = pt_->policy_table.module_meta;
snapshot_->policy_table.usage_and_error_counts =
pt_->policy_table.usage_and_error_counts;
+ snapshot_->policy_table.usage_and_error_counts->app_level =
+ pt_->policy_table.usage_and_error_counts->app_level;
+ snapshot_->policy_table.usage_and_error_counts->mark_initialized();
+ snapshot_->policy_table.usage_and_error_counts->app_level->mark_initialized();
snapshot_->policy_table.device_data = pt_->policy_table.device_data;
+ if (pt_->policy_table.vehicle_data.is_initialized()) {
+ snapshot_->policy_table.vehicle_data =
+ rpc::Optional<policy_table::VehicleData>();
+ snapshot_->policy_table.vehicle_data->mark_initialized();
+ snapshot_->policy_table.vehicle_data->schema_version =
+ pt_->policy_table.vehicle_data->schema_version;
+ }
+
// Set policy table type to Snapshot
snapshot_->SetPolicyTableType(
rpc::policy_table_interface_base::PolicyTableType::PT_SNAPSHOT);
@@ -1426,16 +1802,22 @@ bool CacheManager::Init(const std::string& file_name,
result = LoadFromFile(file_name, *pt_);
- utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot();
+ std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot();
result &= snapshot->is_valid();
LOG4CXX_DEBUG(logger_,
"Check if snapshot is valid: " << std::boolalpha << result);
if (!result) {
rpc::ValidationReport report("policy_table");
snapshot->ReportErrors(&report);
+ LOG4CXX_DEBUG(logger_,
+ "Validation report: " << rpc::PrettyFormat(report));
return result;
}
+ if (!UnwrapAppPolicies(pt_->policy_table.app_policies_section.apps)) {
+ LOG4CXX_ERROR(logger_, "Cannot unwrap application policies");
+ }
+
backup_->UpdateDBVersion();
Backup();
} break;
@@ -1451,10 +1833,13 @@ bool CacheManager::Init(const std::string& file_name,
void CacheManager::FillDeviceSpecificData() {}
bool CacheManager::LoadFromBackup() {
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(cache_lock_);
pt_ = backup_->GenerateSnapshot();
update_required = backup_->UpdateRequired();
-
+ LOG4CXX_DEBUG(logger_,
+ "Update required flag from backup: " << std::boolalpha
+ << update_required);
FillDeviceSpecificData();
return true;
@@ -1490,13 +1875,16 @@ bool CacheManager::LoadFromFile(const std::string& file_name,
return false;
}
+ Json::CharReaderBuilder reader_builder;
+ Json::CharReaderBuilder::strictMode(&reader_builder.settings_);
+ auto reader =
+ std::unique_ptr<Json::CharReader>(reader_builder.newCharReader());
Json::Value value;
- Json::Reader reader(Json::Features::strictMode());
+ JSONCPP_STRING err;
std::string json(json_string.begin(), json_string.end());
- if (!reader.parse(json.c_str(), value)) {
- LOG4CXX_FATAL(
- logger_,
- "Preloaded PT is corrupted: " << reader.getFormattedErrorMessages());
+ const size_t json_len = json.length();
+ if (!reader->parse(json.c_str(), json.c_str() + json_len, &value, &err)) {
+ LOG4CXX_FATAL(logger_, "Preloaded PT is corrupted: " << err);
return false;
}
@@ -1505,9 +1893,10 @@ bool CacheManager::LoadFromFile(const std::string& file_name,
table = policy_table::Table(&value);
- Json::StyledWriter s_writer;
+ Json::StreamWriterBuilder writer_builder;
LOG4CXX_DEBUG(logger_, "PT out:");
- LOG4CXX_DEBUG(logger_, s_writer.write(table.ToJsonValue()));
+ LOG4CXX_DEBUG(logger_,
+ Json::writeString(writer_builder, table.ToJsonValue()));
MakeLowerCaseAppNames(table);
@@ -1680,6 +2069,7 @@ bool CacheManager::MergePreloadPT(const std::string& file_name) {
MergeFG(new_table, current);
MergeAP(new_table, current);
MergeCFM(new_table, current);
+ MergeVD(new_table, current);
Backup();
}
return true;
@@ -1711,8 +2101,9 @@ void CacheManager::MergeFG(const policy_table::PolicyTable& new_pt,
void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt,
policy_table::PolicyTable& pt) {
LOG4CXX_AUTO_TRACE(logger_);
- pt.app_policies_section.device = const_cast<policy_table::PolicyTable&>(
- new_pt).app_policies_section.device;
+ pt.app_policies_section.device =
+ const_cast<policy_table::PolicyTable&>(new_pt)
+ .app_policies_section.device;
pt.app_policies_section.apps[kDefaultId] =
const_cast<policy_table::PolicyTable&>(new_pt)
@@ -1746,6 +2137,12 @@ void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt,
}
}
+void CacheManager::MergeVD(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ pt.vehicle_data.assign_if_valid(new_pt.vehicle_data);
+}
+
const PolicySettings& CacheManager::get_settings() const {
DCHECK(settings_);
@@ -1811,4 +2208,46 @@ void CacheManager::BackgroundBackuper::DoBackup() {
backup_notifier_.NotifyOne();
}
+EncryptionRequired CacheManager::GetAppEncryptionRequiredFlag(
+ const std::string& application) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ return pt_->policy_table.app_policies_section.apps[application]
+ .encryption_required;
+}
+
+EncryptionRequired CacheManager::GetFunctionalGroupingEncryptionRequiredFlag(
+ const std::string& functional_group) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ const auto& functional_groupings = pt_->policy_table.functional_groupings;
+
+ const auto& grouping_itr = functional_groupings.find(functional_group);
+ if (grouping_itr == functional_groupings.end()) {
+ LOG4CXX_WARN(logger_, "Group " << functional_group << " not found");
+ return EncryptionRequired(rpc::Boolean(false));
+ }
+
+ return (*grouping_itr).second.encryption_required;
+}
+
+void CacheManager::GetApplicationParams(
+ const std::string& application_name,
+ policy_table::ApplicationParams& application_params) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+
+ const auto apps = pt_->policy_table.app_policies_section.apps;
+ const auto it = apps.find(application_name);
+ if (apps.end() == it) {
+ LOG4CXX_WARN(logger_,
+ "Application " << application_name << " was not found");
+ return;
+ }
+
+ application_params = (*it).second;
+}
+
} // namespace policy
diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc
index 796dd25ec4..08f1fbb177 100644
--- a/src/components/policy/policy_regular/src/policy_helper.cc
+++ b/src/components/policy/policy_regular/src/policy_helper.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -30,13 +30,13 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include "policy/policy_helper.h"
+#include <string.h>
#include <algorithm>
#include <sstream>
-#include <string.h>
-#include "utils/logger.h"
-#include "utils/custom_string.h"
-#include "policy/policy_helper.h"
#include "policy/policy_manager_impl.h"
+#include "utils/custom_string.h"
+#include "utils/logger.h"
namespace policy {
@@ -46,7 +46,8 @@ namespace {
CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
-bool Compare(const StringsValueType& first, const StringsValueType& second) {
+bool CompareStrings(const StringsValueType& first,
+ const StringsValueType& second) {
const std::string& first_str = first;
const std::string& second_str = second;
return (strcasecmp(first_str.c_str(), second_str.c_str()) < 0);
@@ -112,7 +113,7 @@ bool operator!=(const policy_table::ApplicationParams& first,
for (; it_first != it_first_end; ++it_first) {
CompareGroupName gp(*it_first);
StringsConstItr it = std::find_if(it_second, it_second_end, gp);
- if (it_first_end == it) {
+ if (it_second_end == it) {
return true;
}
}
@@ -121,9 +122,13 @@ bool operator!=(const policy_table::ApplicationParams& first,
CheckAppPolicy::CheckAppPolicy(
PolicyManagerImpl* pm,
- const utils::SharedPtr<policy_table::Table> update,
- const utils::SharedPtr<policy_table::Table> snapshot)
- : pm_(pm), update_(update), snapshot_(snapshot) {}
+ const std::shared_ptr<policy_table::Table> update,
+ const std::shared_ptr<policy_table::Table> snapshot,
+ CheckAppPolicyResults& out_results)
+ : pm_(pm)
+ , update_(update)
+ , snapshot_(snapshot)
+ , out_results_(out_results) {}
bool policy::CheckAppPolicy::HasRevokedGroups(
const policy::AppPoliciesValueType& app_policy,
@@ -132,10 +137,10 @@ bool policy::CheckAppPolicy::HasRevokedGroups(
snapshot_->policy_table.app_policies_section.apps.find(app_policy.first);
policy_table::Strings groups_new = app_policy.second.groups;
- std::sort(groups_new.begin(), groups_new.end(), Compare);
+ std::sort(groups_new.begin(), groups_new.end(), CompareStrings);
policy_table::Strings groups_curr = (*it).second.groups;
- std::sort(groups_curr.begin(), groups_curr.end(), Compare);
+ std::sort(groups_curr.begin(), groups_curr.end(), CompareStrings);
StringsConstItr it_groups_new = groups_new.begin();
StringsConstItr it_groups_new_end = groups_new.end();
@@ -149,18 +154,7 @@ bool policy::CheckAppPolicy::HasRevokedGroups(
it_groups_new,
it_groups_new_end,
std::back_inserter(revoked_group_list),
- Compare);
-
- // Remove groups which are not required user consent
- policy_table::Strings::iterator it_revoked = revoked_group_list.begin();
- for (; revoked_group_list.end() != it_revoked;) {
- if (!IsConsentRequired(app_policy.first, std::string(*it_revoked))) {
- revoked_group_list.erase(it_revoked);
- it_revoked = revoked_group_list.begin();
- } else {
- ++it_revoked;
- }
- }
+ CompareStrings);
if (revoked_groups) {
*revoked_groups = revoked_group_list;
@@ -169,6 +163,76 @@ bool policy::CheckAppPolicy::HasRevokedGroups(
return !revoked_group_list.empty();
}
+bool policy::CheckAppPolicy::HasUpdatedGroups(
+ const policy::AppPoliciesValueType& app_policy,
+ policy_table::Strings* updated_groups) const {
+ AppPoliciesConstItr it =
+ snapshot_->policy_table.app_policies_section.apps.find(app_policy.first);
+
+ policy_table::Strings groups_new = app_policy.second.groups;
+ std::sort(groups_new.begin(), groups_new.end(), CompareStrings);
+
+ policy_table::Strings groups_curr = (*it).second.groups;
+ std::sort(groups_curr.begin(), groups_curr.end(), CompareStrings);
+
+ policy_table::Strings intersection_list;
+ std::set_intersection(groups_new.begin(),
+ groups_new.end(),
+ groups_curr.begin(),
+ groups_curr.end(),
+ std::back_inserter(intersection_list));
+
+ auto IsGroupContentUpdated =
+ [this](const StringsValueType& groupName) -> bool {
+ const auto& func_group_from_update =
+ update_->policy_table.functional_groupings.find(groupName);
+ const auto& func_group_from_snapshot =
+ snapshot_->policy_table.functional_groupings.find(groupName);
+
+ const auto& update_fg_rpcs = func_group_from_update->second.rpcs;
+ const auto& snapshot_fg_rpcs = func_group_from_snapshot->second.rpcs;
+
+ if (update_fg_rpcs.is_null() || snapshot_fg_rpcs.is_null()) {
+ return !(update_fg_rpcs.is_null() && snapshot_fg_rpcs.is_null());
+ }
+
+ if (update_fg_rpcs.size() != snapshot_fg_rpcs.size()) {
+ return true;
+ }
+
+ for (const auto& rpc : update_fg_rpcs) {
+ const auto& old_rpc = snapshot_fg_rpcs.find(rpc.first);
+ if (snapshot_fg_rpcs.end() == old_rpc) {
+ return true;
+ }
+
+ const bool hmi_levels_same =
+ old_rpc->second.hmi_levels == rpc.second.hmi_levels;
+ const bool parameters_same =
+ *(old_rpc->second.parameters) == *(rpc.second.parameters);
+
+ if (!hmi_levels_same || !parameters_same) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+
+ policy_table::Strings updated_group_list;
+ for (const auto& item : intersection_list) {
+ if (IsGroupContentUpdated(item)) {
+ updated_group_list.push_back(item);
+ }
+ }
+
+ if (updated_groups) {
+ *updated_groups = updated_group_list;
+ }
+
+ return !updated_group_list.empty();
+}
+
bool policy::CheckAppPolicy::HasNewGroups(
const policy::AppPoliciesValueType& app_policy,
policy_table::Strings* new_groups) const {
@@ -176,10 +240,10 @@ bool policy::CheckAppPolicy::HasNewGroups(
snapshot_->policy_table.app_policies_section.apps.find(app_policy.first);
policy_table::Strings groups_new = app_policy.second.groups;
- std::sort(groups_new.begin(), groups_new.end(), Compare);
+ std::sort(groups_new.begin(), groups_new.end(), CompareStrings);
policy_table::Strings groups_curr = (*it).second.groups;
- std::sort(groups_curr.begin(), groups_curr.end(), Compare);
+ std::sort(groups_curr.begin(), groups_curr.end(), CompareStrings);
StringsConstItr it_groups_new = groups_new.begin();
StringsConstItr it_groups_new_end = groups_new.end();
@@ -193,7 +257,7 @@ bool policy::CheckAppPolicy::HasNewGroups(
it_groups_curr,
it_groups_curr_end,
std::back_inserter(new_group_list),
- Compare);
+ CompareStrings);
if (new_groups) {
*new_groups = new_group_list;
@@ -205,14 +269,23 @@ bool policy::CheckAppPolicy::HasNewGroups(
bool policy::CheckAppPolicy::HasConsentNeededGroups(
const policy::AppPoliciesValueType& app_policy) const {
policy_table::Strings new_groups;
- if (!HasNewGroups(app_policy, &new_groups)) {
+ policy_table::Strings updated_groups;
+ if (!HasNewGroups(app_policy, &new_groups) &&
+ !HasUpdatedGroups(app_policy, &updated_groups)) {
return false;
}
- StringsConstItr it_new = new_groups.begin();
- StringsConstItr it_new_end = new_groups.end();
- for (; it_new != it_new_end; ++it_new) {
- if (IsConsentRequired(app_policy.first, *it_new)) {
+ policy_table::Strings groups_to_check_consent;
+ std::set_union(new_groups.begin(),
+ new_groups.end(),
+ updated_groups.begin(),
+ updated_groups.end(),
+ std::back_inserter(groups_to_check_consent));
+
+ StringsConstItr it = groups_to_check_consent.begin();
+ StringsConstItr it_end = groups_to_check_consent.end();
+ for (; it != it_end; ++it) {
+ if (IsConsentRequired(app_policy.first, *it)) {
return true;
}
}
@@ -263,30 +336,18 @@ bool CheckAppPolicy::IsKnownAppication(
void policy::CheckAppPolicy::NotifySystem(
const policy::AppPoliciesValueType& app_policy) const {
- pm_->listener()->OnPendingPermissionChange(app_policy.first);
-}
-
-void CheckAppPolicy::SendPermissionsToApp(
- const std::string& app_id, const policy_table::Strings& groups) const {
- const std::string device_id = pm_->GetCurrentDeviceId(app_id);
- if (device_id.empty()) {
- LOG4CXX_WARN(logger_,
- "Couldn't find device info for application id: " << app_id);
+ auto& listener = *pm_->listener();
+ const auto devices_ids = listener.GetDevicesIds(app_policy.first);
+ if (devices_ids.empty()) {
+ LOG4CXX_WARN(
+ logger_,
+ "Couldn't find device info for application id: " << app_policy.first);
return;
}
- std::vector<FunctionalGroupPermission> group_permissons;
- pm_->GetPermissionsForApp(device_id, app_id, group_permissons);
-
- Permissions notification_data;
- pm_->PrepareNotificationData(update_->policy_table.functional_groupings,
- groups,
- group_permissons,
- notification_data);
- LOG4CXX_INFO(logger_, "Send notification for application_id: " << app_id);
- // Default_hmi is Ford-specific and should not be used with basic policy
- const std::string default_hmi;
- pm_->listener()->OnPermissionsUpdated(app_id, notification_data, default_hmi);
+ for (const auto& device_id : devices_ids) {
+ listener.OnPendingPermissionChange(device_id, app_policy.first);
+ }
}
bool CheckAppPolicy::IsAppRevoked(
@@ -317,9 +378,22 @@ bool CheckAppPolicy::NicknamesMatch(
return true;
}
+void CheckAppPolicy::AddResult(const std::string& app_id,
+ PermissionsCheckResult result) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto item = std::make_pair(app_id, result);
+ out_results_.insert(item);
+}
+
bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
const std::string app_id = app_policy.first;
+ const bool app_properties_changed = IsAppPropertiesChanged(app_policy);
+ const bool is_predefined_app = IsPredefinedApp(app_policy);
+ if (!is_predefined_app && app_properties_changed) {
+ AddResult(app_id, RESULT_APP_PROPERTIES_CHANGED);
+ }
+
if (!IsKnownAppication(app_id)) {
LOG4CXX_WARN(logger_,
"Application:" << app_id << " is not present in snapshot.");
@@ -328,13 +402,13 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
if (!IsPredefinedApp(app_policy) && IsAppRevoked(app_policy)) {
SetPendingPermissions(app_policy, RESULT_APP_REVOKED);
- NotifySystem(app_policy);
+ AddResult(app_id, RESULT_APP_REVOKED);
return true;
}
if (!IsPredefinedApp(app_policy) && !NicknamesMatch(app_policy)) {
SetPendingPermissions(app_policy, RESULT_NICKNAME_MISMATCH);
- NotifySystem(app_policy);
+ AddResult(app_id, RESULT_NICKNAME_MISMATCH);
return true;
}
@@ -345,49 +419,53 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
if (is_request_type_changed) {
SetPendingPermissions(app_policy, RESULT_REQUEST_TYPE_CHANGED);
+ AddResult(app_id, RESULT_REQUEST_TYPE_CHANGED);
}
if (is_request_subtype_changed) {
SetPendingPermissions(app_policy, RESULT_REQUEST_SUBTYPE_CHANGED);
- }
-
- if (is_request_type_changed || is_request_subtype_changed) {
- NotifySystem(app_policy);
+ AddResult(app_id, RESULT_REQUEST_SUBTYPE_CHANGED);
}
}
if (RESULT_NO_CHANGES == result) {
- LOG4CXX_INFO(logger_,
- "Permissions for application:" << app_id
- << " wasn't changed.");
+ LOG4CXX_INFO(
+ logger_,
+ "Permissions for application:" << app_id << " wasn't changed.");
+ AddResult(app_id, RESULT_NO_CHANGES);
return true;
}
- LOG4CXX_INFO(logger_,
- "Permissions for application:" << app_id
- << " have been changed.");
+ LOG4CXX_INFO(
+ logger_,
+ "Permissions for application:" << app_id << " have been changed.");
if (IsPredefinedApp(app_policy)) {
- for (const policy_table::ApplicationPolicies::value_type& app :
- snapshot_->policy_table.app_policies_section.apps) {
- if (app_policy.first == app.second.get_string()) {
- if (RESULT_CONSENT_NOT_REQIURED != result) {
- SetPendingPermissions(app, result);
- NotifySystem(app);
- }
- SendPermissionsToApp(app.first, app_policy.second.groups);
- }
+ const auto& snapshot_app_policy_begin =
+ snapshot_->policy_table.app_policies_section.apps.begin();
+ const auto& snapshot_app_policy_end =
+ snapshot_->policy_table.app_policies_section.apps.end();
+
+ auto find_app = [&app_id](AppPoliciesValueType& app) {
+ return app_id == app.second.get_string();
+ };
+
+ const auto& app = std::find_if(
+ snapshot_app_policy_begin, snapshot_app_policy_end, find_app);
+
+ if ((snapshot_app_policy_end != app) &&
+ (RESULT_CONSENT_NOT_REQUIRED != result)) {
+ SetPendingPermissions(*app, result);
+ AddResult(app_id, RESULT_CONSENT_NEEDED);
}
return true;
}
- if (!IsPredefinedApp(app_policy) && RESULT_CONSENT_NOT_REQIURED != result) {
- SetPendingPermissions(app_policy, result);
- NotifySystem(app_policy);
+ SetPendingPermissions(app_policy, result);
+ if (RESULT_CONSENT_NOT_REQUIRED != result) {
+ AddResult(app_id, RESULT_CONSENT_NEEDED);
+ return true;
}
- // Don't sent notification for predefined apps (e.g. default, device etc.)
- if (!IsPredefinedApp(app_policy)) {
- SendPermissionsToApp(app_policy.first, app_policy.second.groups);
- }
+ AddResult(app_id, result);
return true;
}
@@ -445,14 +523,18 @@ void policy::CheckAppPolicy::SetPendingPermissions(
pm_->app_permissions_diff_lock_.Release();
}
-policy::CheckAppPolicy::PermissionsCheckResult
-policy::CheckAppPolicy::CheckPermissionsChanges(
+policy::PermissionsCheckResult policy::CheckAppPolicy::CheckPermissionsChanges(
const policy::AppPoliciesValueType& app_policy) const {
- bool has_revoked_groups = HasRevokedGroups(app_policy);
+ const bool has_revoked_groups = HasRevokedGroups(app_policy);
+
+ const bool has_consent_needed_groups = HasConsentNeededGroups(app_policy);
- bool has_consent_needed_groups = HasConsentNeededGroups(app_policy);
+ const bool has_new_groups = HasNewGroups(app_policy);
- bool has_new_groups = HasNewGroups(app_policy);
+ const bool has_updated_groups = HasUpdatedGroups(app_policy);
+
+ const bool encryption_required_flag_changed =
+ IsEncryptionRequiredFlagChanged(app_policy);
if (has_revoked_groups && has_consent_needed_groups) {
return RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED;
@@ -460,8 +542,10 @@ policy::CheckAppPolicy::CheckPermissionsChanges(
return RESULT_PERMISSIONS_REVOKED;
} else if (has_consent_needed_groups) {
return RESULT_CONSENT_NEEDED;
- } else if (has_new_groups) {
- return RESULT_CONSENT_NOT_REQIURED;
+ } else if (has_new_groups || has_updated_groups) {
+ return RESULT_CONSENT_NOT_REQUIRED;
+ } else if (encryption_required_flag_changed) {
+ return RESULT_ENCRYPTION_REQUIRED_FLAG_CHANGED;
}
return RESULT_NO_CHANGES;
@@ -530,6 +614,200 @@ bool CheckAppPolicy::IsRequestSubTypeChanged(
return diff.size();
}
+bool CheckAppPolicy::IsAppPropertiesProvided(
+ const AppPoliciesValueType& app_policy) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (app_policy.second.hybrid_app_preference.is_initialized() ||
+ app_policy.second.endpoint.is_initialized() ||
+ app_policy.second.enabled.is_initialized() ||
+ app_policy.second.auth_token.is_initialized() ||
+ app_policy.second.cloud_transport_type.is_initialized() ||
+ app_policy.second.nicknames.is_initialized()) {
+ return true;
+ }
+ return false;
+}
+
+bool CheckAppPolicy::IsAppPropertiesChanged(
+ const AppPoliciesValueType& app_policy) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!IsAppPropertiesProvided(app_policy)) {
+ return false;
+ }
+
+ if (!IsKnownAppication(app_policy.first)) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "AppProperties provided for new application: " << app_policy.first);
+ return true;
+ }
+
+ policy::AppPoliciesConstItr it =
+ snapshot_->policy_table.app_policies_section.apps.find(app_policy.first);
+ const auto snapshot_properties = *it;
+
+ if (app_policy.second.enabled.is_initialized() &&
+ app_policy.second.enabled != snapshot_properties.second.enabled) {
+ LOG4CXX_DEBUG(logger_, "\"enabled\" was changed");
+ return true;
+ }
+
+ if (app_policy.second.endpoint.is_initialized() &&
+ app_policy.second.endpoint != snapshot_properties.second.endpoint) {
+ LOG4CXX_DEBUG(logger_, "\"endpoint\" was changed");
+ return true;
+ }
+
+ if (app_policy.second.hybrid_app_preference.is_initialized() &&
+ app_policy.second.hybrid_app_preference !=
+ snapshot_properties.second.hybrid_app_preference) {
+ LOG4CXX_DEBUG(logger_, "\"hybrid_app_preference\" was changed");
+ return true;
+ }
+
+ if (app_policy.second.auth_token.is_initialized() &&
+ app_policy.second.auth_token != snapshot_properties.second.auth_token) {
+ LOG4CXX_DEBUG(logger_, "\"auth_token\" was changed");
+ return true;
+ }
+
+ if (app_policy.second.cloud_transport_type.is_initialized() &&
+ app_policy.second.cloud_transport_type !=
+ snapshot_properties.second.cloud_transport_type) {
+ LOG4CXX_DEBUG(logger_, "\"cloud_transport_type\" was changed");
+ return true;
+ }
+
+ return false;
+}
+
+bool CheckAppPolicy::IsEncryptionRequiredFlagChanged(
+ const AppPoliciesValueType& app_policy) const {
+ auto get_app_encryption_needed =
+ [](const std::string& policy_app_id,
+ policy_table::ApplicationPolicies& policies)
+ -> rpc::Optional<rpc::Boolean> {
+ auto it = policies.find(policy_app_id);
+ if (policies.end() == it) {
+ LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id);
+ return rpc::Optional<rpc::Boolean>(false);
+ }
+ return it->second.encryption_required;
+ };
+
+ auto get_app_groups =
+ [](const std::string& policy_app_id,
+ policy_table::ApplicationPolicies& policies) -> policy_table::Strings {
+ policy_table::Strings result;
+ auto it = policies.find(policy_app_id);
+ if (policies.end() == it) {
+ LOG4CXX_WARN(logger_, "App is not present in policies" << policy_app_id);
+ return result;
+ }
+ auto& groups = it->second.groups;
+ std::copy(groups.begin(), groups.end(), std::back_inserter(result));
+ return result;
+ };
+
+ auto get_app_rpcs = [](const std::string group_name,
+ const FunctionalGroupings& groups)
+ -> rpc::Optional<policy_table::Rpcs> {
+ auto it = groups.find(group_name);
+ if (it == groups.end()) {
+ return rpc::Optional<policy_table::Rpcs>();
+ }
+ return rpc::Optional<policy_table::Rpcs>(it->second);
+ };
+
+ const auto snapshot_groups = get_app_groups(
+ app_policy.first, snapshot_->policy_table.app_policies_section.apps);
+ const auto update_groups = get_app_groups(
+ app_policy.first, update_->policy_table.app_policies_section.apps);
+
+ auto get_resulting_encryption_required_flag_for_app_groups =
+ [this, &get_app_rpcs](
+ const rpc::policy_table_interface_base::Strings& app_groups,
+ const std::shared_ptr<rpc::policy_table_interface_base::Table> pt) {
+ for (const auto& group : app_groups) {
+ const auto rpcs =
+ get_app_rpcs(group, pt->policy_table.functional_groupings);
+ if (*rpcs->encryption_required) {
+ return true;
+ }
+ }
+
+ return false;
+ };
+
+ auto group_res_en_flag_changed =
+ [this, &get_resulting_encryption_required_flag_for_app_groups](
+ const rpc::policy_table_interface_base::Strings& snapshot_groups,
+ const rpc::policy_table_interface_base::Strings& update_groups) {
+ return get_resulting_encryption_required_flag_for_app_groups(
+ snapshot_groups, snapshot_) !=
+ get_resulting_encryption_required_flag_for_app_groups(
+ update_groups, update_);
+ };
+
+ const auto snapshot_app_encryption_needed = get_app_encryption_needed(
+ app_policy.first, snapshot_->policy_table.app_policies_section.apps);
+ const auto update_app_encryption_needed = get_app_encryption_needed(
+ app_policy.first, update_->policy_table.app_policies_section.apps);
+
+ const bool app_encryption_needed_changed =
+ (snapshot_app_encryption_needed.is_initialized() !=
+ update_app_encryption_needed.is_initialized()) ||
+ (*snapshot_app_encryption_needed != *update_app_encryption_needed);
+
+ if ((!update_app_encryption_needed.is_initialized() ||
+ *update_app_encryption_needed) &&
+ group_res_en_flag_changed(snapshot_groups, update_groups)) {
+ return true;
+ }
+
+ return app_encryption_needed_changed;
+}
+
+void FillActionsForAppPolicies::operator()(
+ const policy::CheckAppPolicyResults::value_type& value) {
+ const std::string app_id = value.first;
+ const auto app_policy = app_policies_.find(app_id);
+ if (app_policies_.end() == app_policy) {
+ return;
+ }
+
+ if (IsPredefinedApp(*app_policy)) {
+ return;
+ }
+
+ switch (value.second) {
+ case RESULT_APP_REVOKED:
+ case RESULT_NICKNAME_MISMATCH:
+ actions_[app_id].is_notify_system = true;
+ return;
+ case RESULT_CONSENT_NEEDED:
+ case RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED:
+ actions_[app_id].is_consent_needed = true;
+ break;
+ case RESULT_APP_PROPERTIES_CHANGED:
+ actions_[app_id].app_properties_changed = true;
+ break;
+ case RESULT_CONSENT_NOT_REQUIRED:
+ case RESULT_PERMISSIONS_REVOKED:
+ case RESULT_REQUEST_TYPE_CHANGED:
+ case RESULT_REQUEST_SUBTYPE_CHANGED:
+ case RESULT_ENCRYPTION_REQUIRED_FLAG_CHANGED:
+ break;
+ case RESULT_NO_CHANGES:
+ default:
+ return;
+ }
+
+ actions_[app_id].is_notify_system = true;
+ actions_[app_id].is_send_permissions_to_app = true;
+}
+
FillNotificationData::FillNotificationData(Permissions& data,
GroupConsent group_state,
GroupConsent undefined_group_consent)
@@ -595,7 +873,7 @@ void FillNotificationData::UpdateParameters(
ParametersConstItr it_parameters_end = in_parameters.end();
for (; it_parameters != it_parameters_end; ++it_parameters) {
- out_parameter.insert(policy_table::EnumToJsonString(*it_parameters));
+ out_parameter.insert(*it_parameters);
}
}
@@ -713,10 +991,31 @@ bool ProcessFunctionalGroup::operator()(const StringsValueType& group_name) {
FillNotificationData filler(
data_, GetGroupState(group_name_str), undefined_group_consent_);
std::for_each(rpcs.begin(), rpcs.end(), filler);
+ FillEncryptionFlagForRpcs(rpcs, (*it).second.encryption_required);
}
return true;
}
+void ProcessFunctionalGroup::FillEncryptionFlagForRpcs(
+ const policy_table::Rpc& rpcs,
+ const EncryptionRequired encryption_required) {
+ auto update_encryption_required = [](EncryptionRequired& current,
+ const EncryptionRequired& incoming) {
+ if (!incoming.is_initialized()) {
+ return;
+ }
+ if (current.is_initialized() && *current) {
+ return;
+ }
+ current = incoming;
+ };
+
+ for (const auto& rpc : rpcs) {
+ auto& item = data_[rpc.first];
+ update_encryption_required(item.require_encryption, encryption_required);
+ }
+}
+
GroupConsent ProcessFunctionalGroup::GetGroupState(
const std::string& group_name) {
std::vector<FunctionalGroupPermission>::const_iterator it =
@@ -853,4 +1152,4 @@ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) {
return true;
}
-}
+} // namespace policy
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index d01631a2a2..c6389b503b 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -32,37 +32,30 @@
#include "policy/policy_manager_impl.h"
#include <algorithm>
-#include <set>
-#include <queue>
#include <iterator>
#include <limits>
-#include "json/reader.h"
+#include <queue>
+#include <set>
#include "json/writer.h"
+#include "policy/policy_helper.h"
#include "policy/policy_table.h"
#include "policy/pt_representation.h"
-#include "policy/policy_helper.h"
+#include "utils/date_time.h"
#include "utils/file_system.h"
+#include "utils/jsoncpp_reader_wrapper.h"
#include "utils/logger.h"
-#include "utils/date_time.h"
-#include "utils/make_shared.h"
+
+#include "config_profile/profile.h"
#include "policy/cache_manager.h"
#include "policy/update_status_manager.h"
-#include "config_profile/profile.h"
#include "utils/timer_task_impl.h"
-#include "utils/make_shared.h"
+
#include "policy/access_remote.h"
#include "policy/access_remote_impl.h"
-policy::PolicyManager* CreateManager() {
- return new policy::PolicyManagerImpl();
-}
-void DeleteManager(policy::PolicyManager* pm) {
- delete pm;
-}
-
namespace {
const uint32_t kDefaultRetryTimeoutInMSec =
- 60u * date_time::DateTime::MILLISECONDS_IN_SECOND;
+ 60u * date_time::MILLISECONDS_IN_SECOND;
} // namespace
namespace policy {
@@ -73,18 +66,21 @@ PolicyManagerImpl::PolicyManagerImpl()
: PolicyManager()
, listener_(NULL)
, cache_(new CacheManager)
- , access_remote_(new AccessRemoteImpl(
- CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_)))
+ , access_remote_(
+ new AccessRemoteImpl(std::static_pointer_cast<CacheManager>(cache_)))
, retry_sequence_timeout_(kDefaultRetryTimeoutInMSec)
, retry_sequence_index_(0)
- , timer_retry_sequence_("Retry sequence timer",
- new timer::TimerTaskImpl<PolicyManagerImpl>(
- this, &PolicyManagerImpl::RetrySequence))
+ , applications_pending_ptu_count_(0)
+ , timer_retry_sequence_(
+ "Retry sequence timer",
+ new timer::TimerTaskImpl<PolicyManagerImpl>(
+ this, &PolicyManagerImpl::OnPTUIterationTimeout))
, ignition_check(true)
, retry_sequence_url_(0, 0, "")
- , wrong_ptu_update_received_(false)
, send_on_update_sent_out_(false)
- , trigger_ptu_(false) {}
+ , trigger_ptu_(false)
+ , ptu_requested_(false)
+ , last_registered_policy_app_id_(std::string()) {}
void PolicyManagerImpl::set_listener(PolicyListener* listener) {
listener_ = listener;
@@ -93,35 +89,37 @@ void PolicyManagerImpl::set_listener(PolicyListener* listener) {
#ifdef USE_HMI_PTU_DECRYPTION
-utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse(
+std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse(
const BinaryMessage& pt_content) {
std::string json(pt_content.begin(), pt_content.end());
+ utils::JsonReader reader;
Json::Value value;
- Json::Reader reader;
- if (reader.parse(json.c_str(), value)) {
- return new policy_table::Table(&value);
+
+ if (reader.parse(json, &value)) {
+ return std::make_shared<policy_table::Table>(&value);
} else {
- return utils::SharedPtr<policy_table::Table>();
+ return std::make_shared<policy_table::Table>();
}
}
#else
-utils::SharedPtr<policy_table::Table> PolicyManagerImpl::ParseArray(
+std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray(
const BinaryMessage& pt_content) {
std::string json(pt_content.begin(), pt_content.end());
+ utils::JsonReader reader;
Json::Value value;
- Json::Reader reader;
- if (reader.parse(json.c_str(), value)) {
+
+ if (reader.parse(json, &value)) {
// For PT Update received from SDL Server.
if (value["data"].size() != 0) {
Json::Value data = value["data"];
- return new policy_table::Table(&data[0]);
+ return std::make_shared<policy_table::Table>(&data[0]);
} else {
- return new policy_table::Table(&value);
+ return std::make_shared<policy_table::Table>(&value);
}
} else {
- return utils::SharedPtr<policy_table::Table>();
+ return std::shared_ptr<policy_table::Table>();
}
}
@@ -143,8 +141,186 @@ void PolicyManagerImpl::CheckTriggers() {
}
}
-bool PolicyManagerImpl::LoadPT(const std::string& file,
- const BinaryMessage& pt_content) {
+/**
+ * @brief FilterInvalidFunctions filter functions that are absent in schema
+ * @param rpcs list of functions to filter
+ */
+void FilterInvalidFunctions(policy_table::Rpc& rpcs) {
+ policy_table::Rpc valid_rpcs;
+ for (const auto& rpc : rpcs) {
+ const std::string& rpc_name = rpc.first;
+ policy_table::FunctionID function_id;
+ if (policy_table::EnumFromJsonString(rpc_name, &function_id)) {
+ valid_rpcs.insert(rpc);
+ }
+ }
+ rpcs.swap(valid_rpcs);
+}
+
+/**
+ * @brief FilterInvalidRPCParameters filter parameters that not present in
+ * schema
+ * @param rpc_parameters parameters to filter
+ */
+void FilterInvalidRPCParameters(
+ policy_table::RpcParameters& rpc_parameters,
+ const std::vector<policy_table::VehicleDataItem>& vehicle_data_items) {
+ policy_table::HmiLevels valid_hmi_levels;
+ for (const auto& hmi_level : rpc_parameters.hmi_levels) {
+ if (hmi_level.is_valid()) {
+ valid_hmi_levels.push_back(hmi_level);
+ }
+ }
+ rpc_parameters.hmi_levels.swap(valid_hmi_levels);
+
+ auto ParamExists =
+ [&vehicle_data_items](const rpc::String<0, 255>& param_name) {
+ policy_table::Parameter parameter_enum;
+ if (policy_table::EnumFromJsonString(param_name, &parameter_enum)) {
+ return true;
+ }
+
+ // In case when this collection is empty that means collection is not
+ // initialized
+ if (vehicle_data_items.empty()) {
+ return false;
+ }
+
+ for (const auto& vdi : vehicle_data_items) {
+ if (param_name == vdi.name) {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ policy_table::Parameters valid_params;
+ const policy_table::Parameters& params = *(rpc_parameters.parameters);
+ for (const auto& param : params) {
+ if (param.is_valid() && ParamExists(param)) {
+ valid_params.push_back(param);
+ }
+ }
+ rpc_parameters.parameters->swap(valid_params);
+}
+
+/**
+ * @brief FilterInvalidPriorityValues filter notification priorities that are
+ * not present in schema
+ * @param notifications priorities to filter
+ */
+void FilterInvalidPriorityValues(
+ policy_table::NumberOfNotificationsPerMinute& notifications) {
+ policy_table::NumberOfNotificationsPerMinute valid_notifications;
+ for (const auto& notification : notifications) {
+ policy_table::Priority priority;
+ if (policy_table::EnumFromJsonString(notification.first, &priority)) {
+ valid_notifications.insert(notification);
+ }
+ }
+ notifications.swap(valid_notifications);
+}
+
+/**
+ * @brief FilterInvalidApplicationParameters filter app params that are not
+ * present in schema
+ * @param app_params object of app policy params to filter
+ */
+void FilterInvalidApplicationParameters(
+ policy_table::ApplicationParams& app_params) {
+ // Filter AppHMIType array
+ policy_table::AppHMITypes valid_app_hmi_types;
+ const policy_table::AppHMITypes& app_hmi_types = *(app_params.AppHMIType);
+ for (const auto& app_hmi_type : app_hmi_types) {
+ if (app_hmi_type.is_valid()) {
+ valid_app_hmi_types.push_back(app_hmi_type);
+ }
+ }
+ app_params.AppHMIType->swap(valid_app_hmi_types);
+
+ // Filter RequestTypes array
+ policy_table::RequestTypes valid_request_types;
+ const policy_table::RequestTypes& request_types = *(app_params.RequestType);
+ for (const auto& request_type : request_types) {
+ if (request_type.is_valid()) {
+ valid_request_types.push_back(request_type);
+ }
+ }
+ if (valid_request_types.empty() && !request_types.empty()) {
+ // An empty RequestType array will allow all request types. No valid
+ // parameters are in the filtered array, so assign an uninitialized value to
+ // for array to be "omitted"
+ *(app_params.RequestType) = policy_table::RequestTypes();
+ } else {
+ app_params.RequestType->swap(valid_request_types);
+ }
+
+ // Filter moduleType array
+ policy_table::ModuleTypes valid_module_types;
+ const policy_table::ModuleTypes& module_types = *(app_params.moduleType);
+ for (const auto& module_type : module_types) {
+ if (module_type.is_valid()) {
+ valid_module_types.push_back(module_type);
+ }
+ }
+ if (valid_module_types.empty() && !module_types.empty()) {
+ // An empty moduleType array will allow all request types. No valid
+ // parameters are in the filtered array, so assign an uninitialized value to
+ // for array to be "omitted"
+ *(app_params.moduleType) = policy_table::ModuleTypes();
+ } else {
+ app_params.moduleType->swap(valid_module_types);
+ }
+
+ // Filter priority
+ if (!app_params.priority.is_valid()) {
+ app_params.priority = policy_table::Priority();
+ }
+}
+
+/**
+ * @brief FilterPolicyTable filter values that not present in schema
+ * @param pt policy table to filter
+ */
+void FilterPolicyTable(
+ policy_table::PolicyTable& pt,
+ const std::vector<policy_table::VehicleDataItem>& current_vd_items) {
+ policy_table::ModuleConfig& module_config = pt.module_config;
+ if (module_config.is_initialized() &&
+ module_config.notifications_per_minute_by_priority.is_initialized()) {
+ FilterInvalidPriorityValues(
+ module_config.notifications_per_minute_by_priority);
+ }
+
+ if (pt.app_policies_section.is_initialized()) {
+ policy_table::ApplicationPolicies& apps = pt.app_policies_section.apps;
+ for (auto& app_policy : apps) {
+ FilterInvalidApplicationParameters(app_policy.second);
+ }
+ }
+
+ for (auto& group : pt.functional_groupings) {
+ policy_table::Rpc& rpcs = group.second.rpcs;
+ FilterInvalidFunctions(rpcs);
+
+ policy_table::VehicleDataItems vehicle_data_items;
+
+ if (!pt.vehicle_data->struct_empty()) {
+ vehicle_data_items =
+ pt.vehicle_data.is_initialized() &&
+ pt.vehicle_data->schema_items.is_initialized()
+ ? *pt.vehicle_data->schema_items
+ : current_vd_items;
+ }
+
+ for (auto& func : rpcs) {
+ FilterInvalidRPCParameters(func.second, vehicle_data_items);
+ }
+ }
+}
+
+PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT(
+ const std::string& file, const BinaryMessage& pt_content) {
LOG4CXX_INFO(logger_, "LoadPT of size " << pt_content.size());
LOG4CXX_DEBUG(
logger_,
@@ -154,101 +330,260 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
// Assuemes Policy Table was parsed, formatted, and/or decrypted by
// the HMI after system request before calling OnReceivedPolicyUpdate
// Parse message into table struct
- utils::SharedPtr<policy_table::Table> pt_update = Parse(pt_content);
+ std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content);
#else
// Message Received from server unecnrypted with PTU in first element
// of 'data' array. No Parsing was done by HMI.
- utils::SharedPtr<policy_table::Table> pt_update = ParseArray(pt_content);
+ std::shared_ptr<policy_table::Table> pt_update = ParseArray(pt_content);
#endif
if (!pt_update) {
- LOG4CXX_WARN(logger_, "Parsed table pointer is 0.");
- update_status_manager_.OnWrongUpdateReceived();
- return false;
+ LOG4CXX_WARN(logger_, "Parsed table pointer is NULL.");
+ ;
+ return PtProcessingResult::kWrongPtReceived;
}
file_system::DeleteFile(file);
+ auto current_vd_items = GetVehicleDataItems();
+
+ FilterPolicyTable(pt_update->policy_table, current_vd_items);
if (!IsPTValid(pt_update, policy_table::PT_UPDATE)) {
- wrong_ptu_update_received_ = true;
- update_status_manager_.OnWrongUpdateReceived();
- return false;
+ LOG4CXX_WARN(logger_, "Received policy table update is not valid");
+ return PtProcessingResult::kWrongPtReceived;
}
- update_status_manager_.OnValidUpdateReceived();
- cache_->SaveUpdateRequired(false);
-
// Update finished, no need retry
if (timer_retry_sequence_.is_running()) {
LOG4CXX_INFO(logger_, "Stop retry sequence");
timer_retry_sequence_.Stop();
}
- {
- sync_primitives::AutoLock lock(apps_registration_lock_);
+ cache_->SaveUpdateRequired(false);
- // Get current DB data, since it could be updated during awaiting of PTU
- utils::SharedPtr<policy_table::Table> policy_table_snapshot =
- cache_->GenerateSnapshot();
- if (!policy_table_snapshot) {
- LOG4CXX_ERROR(
- logger_,
- "Failed to create snapshot of policy table, trying another exchange");
- ForcePTExchange();
- return false;
- }
+ sync_primitives::AutoLock lock(apps_registration_lock_);
- // Checking of difference between PTU and current policy state
- // Must to be done before PTU applying since it is possible, that functional
- // groups, which had been present before are absent in PTU and will be
- // removed after update. So in case of revoked groups system has to know
- // names and ids of revoked groups before they will be removed.
- CheckPermissionsChanges(pt_update, policy_table_snapshot);
+ // Get current DB data, since it could be updated during awaiting of PTU
+ auto policy_table_snapshot = cache_->GenerateSnapshot();
+ if (!policy_table_snapshot) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Failed to create snapshot of policy table, trying another exchange");
+ return PtProcessingResult::kNewPtRequired;
+ }
- // Replace current data with updated
- if (!cache_->ApplyUpdate(*pt_update)) {
- LOG4CXX_WARN(
- logger_,
- "Unsuccessful save of updated policy table, trying another exchange");
- ForcePTExchange();
- return false;
- }
+ // Checking of difference between PTU and current policy state
+ // Must to be done before PTU applying since it is possible, that functional
+ // groups, which had been present before are absent in PTU and will be
+ // removed after update. So in case of revoked groups system has to know
+ // names and ids of revoked groups before they will be removed.
+ const auto results =
+ CheckPermissionsChanges(pt_update, policy_table_snapshot);
- listener_->OnCertificateUpdated(
- *(pt_update->policy_table.module_config.certificate));
+ // Replace current data with updated
+ if (!cache_->ApplyUpdate(*pt_update)) {
+ LOG4CXX_WARN(
+ logger_,
+ "Unsuccessful save of updated policy table, trying another exchange");
+ return PtProcessingResult::kNewPtRequired;
+ }
+ CheckPermissionsChangesAfterUpdate(*pt_update, *policy_table_snapshot);
- std::map<std::string, StringArray> app_hmi_types;
- cache_->GetHMIAppTypeAfterUpdate(app_hmi_types);
- if (!app_hmi_types.empty()) {
- LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType");
- listener_->OnUpdateHMIAppType(app_hmi_types);
- } else {
- LOG4CXX_INFO(logger_, "app_hmi_types empty" << pt_content.size());
- }
+ ProcessAppPolicyCheckResults(
+ results, pt_update->policy_table.app_policies_section.apps);
+
+ listener_->OnCertificateUpdated(
+ *(pt_update->policy_table.module_config.certificate));
+
+ std::map<std::string, StringArray> app_hmi_types;
+ cache_->GetHMIAppTypeAfterUpdate(app_hmi_types);
+ if (!app_hmi_types.empty()) {
+ LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType");
+ listener_->OnUpdateHMIAppType(app_hmi_types);
+ } else {
+ LOG4CXX_INFO(logger_, "app_hmi_types empty" << pt_content.size());
+ }
+
+ std::vector<std::string> enabled_apps;
+ cache_->GetEnabledCloudApps(enabled_apps);
+ for (auto it = enabled_apps.begin(); it != enabled_apps.end(); ++it) {
+ SendAuthTokenUpdated(*it);
+ }
+
+ return PtProcessingResult::kSuccess;
+}
+
+void PolicyManagerImpl::OnPTUFinished(const PtProcessingResult ptu_result) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ptu_requested_ = false;
+ if (PtProcessingResult::kWrongPtReceived == ptu_result) {
+ LOG4CXX_DEBUG(logger_, "Wrong PT was received");
+ update_status_manager_.OnWrongUpdateReceived();
+ return;
+ }
+
+ update_status_manager_.OnValidUpdateReceived();
+
+ if (PtProcessingResult::kNewPtRequired == ptu_result) {
+ LOG4CXX_DEBUG(logger_, "New PTU interation is required");
+ ForcePTExchange();
+ return;
}
+ ResumePendingAppPolicyActions();
+
// If there was a user request for policy table update, it should be started
// right after current update is finished
- if (update_status_manager_.IsUpdateRequired()) {
+ if (update_status_manager_.IsUpdateRequired() && HasApplicationForPTU()) {
+ LOG4CXX_DEBUG(logger_,
+ "PTU was successful and new PTU iteration was scheduled");
StartPTExchange();
- return true;
+ return;
}
RefreshRetrySequence();
- return true;
}
-void PolicyManagerImpl::CheckPermissionsChanges(
- const utils::SharedPtr<policy_table::Table> pt_update,
- const utils::SharedPtr<policy_table::Table> snapshot) {
- LOG4CXX_INFO(logger_, "Checking incoming permissions.");
+void PolicyManagerImpl::ProcessAppPolicyCheckResults(
+ const CheckAppPolicyResults& results,
+ const rpc::policy_table_interface_base::ApplicationPolicies& app_policies) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationsPoliciesActions actions_for_apps_policies;
+ FillActionsForAppPolicies filler(actions_for_apps_policies, app_policies);
+
+ std::for_each(results.begin(), results.end(), filler);
+
+ ProcessActionsForAppPolicies(actions_for_apps_policies, app_policies);
+}
+
+void PolicyManagerImpl::ProcessActionsForAppPolicies(
+ const ApplicationsPoliciesActions& actions,
+ const policy_table::ApplicationPolicies& app_policies) {
+ notify_system_list_.clear();
+ send_permissions_list_.clear();
+
+ ApplicationsPoliciesActions::const_iterator it_actions = actions.begin();
+ for (; it_actions != actions.end(); ++it_actions) {
+ auto app_policy = app_policies.find(it_actions->first);
+ if (app_policies.end() == app_policy) {
+ continue;
+ }
+
+ if (it_actions->second.app_properties_changed) {
+ app_properties_changed_list_.push_back(app_policy->first);
+ }
+
+ const auto devices_ids = listener()->GetDevicesIds(app_policy->first);
+ for (const auto& device_id : devices_ids) {
+ if (it_actions->second.is_consent_needed) {
+ // Post-check after ExternalConsent consent changes
+ const std::string& policy_app_id = app_policy->first;
+ if (!IsConsentNeeded(device_id, policy_app_id)) {
+ sync_primitives::AutoLock lock(app_permissions_diff_lock_);
+
+ PendingPermissions::iterator app_id_diff =
+ app_permissions_diff_.find(policy_app_id);
+
+ if (app_permissions_diff_.end() != app_id_diff) {
+ app_id_diff->second.appPermissionsConsentNeeded = false;
+ }
+ }
+ }
+ if (it_actions->second.is_notify_system) {
+ notify_system_list_.push_back(std::make_pair(device_id, *app_policy));
+ }
+ if (it_actions->second.is_send_permissions_to_app) {
+ send_permissions_list_.push_back(
+ std::make_pair(device_id, *app_policy));
+ }
+ }
+ }
+}
+
+void PolicyManagerImpl::SendOnAppPropertiesChangeNotification(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ listener_->SendOnAppPropertiesChangeNotification(policy_app_id);
+}
+
+void PolicyManagerImpl::ResumePendingAppPolicyActions() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ for (auto& notify_system_params : notify_system_list_) {
+ NotifySystem(notify_system_params.first, notify_system_params.second);
+ }
+ notify_system_list_.clear();
+
+ for (auto& send_permissions_params : send_permissions_list_) {
+ SendPermissionsToApp(send_permissions_params.first,
+ send_permissions_params.second);
+ }
+
+ for (auto& app : app_properties_changed_list_) {
+ SendOnAppPropertiesChangeNotification(app);
+ }
+
+ send_permissions_list_.clear();
+}
+
+void PolicyManagerImpl::NotifySystem(
+ const std::string& device_id,
+ const PolicyManagerImpl::AppPoliciesValueType& app_policy) const {
+ listener()->OnPendingPermissionChange(device_id, app_policy.first);
+}
+
+void PolicyManagerImpl::SendPermissionsToApp(
+ const std::string& device_id,
+ const PolicyManagerImpl::AppPoliciesValueType& app_policy) {
+ const std::string app_id = app_policy.first;
+
+ std::vector<FunctionalGroupPermission> group_permissons;
+ GetPermissionsForApp(device_id, app_id, group_permissons);
+
+ Permissions notification_data;
+
+ // Need to get rid of this call
+ auto policy_table_snapshot = cache_->GenerateSnapshot();
+
+ PrepareNotificationData(
+ policy_table_snapshot->policy_table.functional_groupings,
+ app_policy.second.groups,
+ group_permissons,
+ notification_data);
+
+ std::string default_hmi;
+ default_hmi = "NONE";
+ listener()->OnPermissionsUpdated(
+ device_id, app_id, notification_data, default_hmi);
+}
+
+CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges(
+ const std::shared_ptr<policy_table::Table> pt_update,
+ const std::shared_ptr<policy_table::Table> snapshot) {
+ LOG4CXX_AUTO_TRACE(logger_);
// Replace predefined policies with its actual setting, e.g. "123":"default"
// to actual values of default section
UnwrapAppPolicies(pt_update->policy_table.app_policies_section.apps);
+ CheckAppPolicyResults out_results;
+
std::for_each(pt_update->policy_table.app_policies_section.apps.begin(),
pt_update->policy_table.app_policies_section.apps.end(),
- CheckAppPolicy(this, pt_update, snapshot));
+ CheckAppPolicy(this, pt_update, snapshot, out_results));
+
+ return out_results;
+}
+
+void PolicyManagerImpl::CheckPermissionsChangesAfterUpdate(
+ const policy_table::Table& update, const policy_table::Table& snapshot) {
+ const auto new_lock_screen_dismissal_enabled =
+ update.policy_table.module_config.lock_screen_dismissal_enabled;
+ const auto old_lock_screen_dismissal_enabled =
+ snapshot.policy_table.module_config.lock_screen_dismissal_enabled;
+ if (new_lock_screen_dismissal_enabled != old_lock_screen_dismissal_enabled) {
+ listener()->OnLockScreenDismissalStateChanged();
+ }
}
void PolicyManagerImpl::PrepareNotificationData(
@@ -256,25 +591,26 @@ void PolicyManagerImpl::PrepareNotificationData(
const policy_table::Strings& group_names,
const std::vector<FunctionalGroupPermission>& group_permission,
Permissions& notification_data) {
- LOG4CXX_INFO(logger_, "Preparing data for notification.");
+ LOG4CXX_AUTO_TRACE(logger_);
ProcessFunctionalGroup processor(groups, group_permission, notification_data);
std::for_each(group_names.begin(), group_names.end(), processor);
}
void PolicyManagerImpl::GetUpdateUrls(const std::string& service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
cache_->GetUpdateUrls(service_type, out_end_points);
}
+
void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type,
- EndpointUrls& out_end_points) {
+ EndpointUrls& out_end_points) const {
LOG4CXX_AUTO_TRACE(logger_);
cache_->GetUpdateUrls(service_type, out_end_points);
}
-bool PolicyManagerImpl::RequestPTUpdate() {
+bool PolicyManagerImpl::RequestPTUpdate(const PTUIterationType iteration_type) {
LOG4CXX_AUTO_TRACE(logger_);
- utils::SharedPtr<policy_table::Table> policy_table_snapshot =
+ std::shared_ptr<policy_table::Table> policy_table_snapshot =
cache_->GenerateSnapshot();
if (!policy_table_snapshot) {
LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table");
@@ -284,19 +620,21 @@ bool PolicyManagerImpl::RequestPTUpdate() {
IsPTValid(policy_table_snapshot, policy_table::PT_SNAPSHOT);
Json::Value value = policy_table_snapshot->ToJsonValue();
- Json::FastWriter writer;
- std::string message_string = writer.write(value);
+ Json::StreamWriterBuilder writer_builder;
+ writer_builder["indentation"] = "";
+ std::string message_string = Json::writeString(writer_builder, value);
LOG4CXX_DEBUG(logger_, "Snapshot contents is : " << message_string);
BinaryMessage update(message_string.begin(), message_string.end());
-
- listener_->OnSnapshotCreated(update);
+ ptu_requested_ = true;
+ listener_->OnSnapshotCreated(update, iteration_type);
return true;
}
-std::string PolicyManagerImpl::GetLockScreenIconUrl() const {
- return cache_->GetLockScreenIconUrl();
+std::string PolicyManagerImpl::GetIconUrl(
+ const std::string& policy_app_id) const {
+ return cache_->GetIconUrl(policy_app_id);
}
void PolicyManagerImpl::StartPTExchange() {
@@ -321,14 +659,16 @@ void PolicyManagerImpl::StartPTExchange() {
return;
}
- if (listener_ && listener_->CanUpdate()) {
+ if (listener_) {
if (ignition_check) {
CheckTriggers();
ignition_check = false;
}
if (update_status_manager_.IsUpdateRequired()) {
- if (RequestPTUpdate() && !timer_retry_sequence_.is_running()) {
+ update_status_manager_.PendingUpdate();
+ if (RequestPTUpdate(PTUIterationType::DefaultIteration) &&
+ !timer_retry_sequence_.is_running()) {
// Start retry sequency
const uint32_t timeout_msec = NextRetryTimeout();
@@ -353,15 +693,36 @@ void PolicyManagerImpl::OnAppsSearchCompleted(const bool trigger_ptu) {
trigger_ptu_ = trigger_ptu;
- if (update_status_manager_.IsUpdateRequired()) {
+ if (update_status_manager_.IsUpdateRequired() && !ptu_requested_ &&
+ HasApplicationForPTU()) {
StartPTExchange();
}
}
-void PolicyManagerImpl::OnAppRegisteredOnMobile(
- const std::string& application_id) {
+void PolicyManagerImpl::OnLocalAppAdded() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ update_status_manager_.ScheduleUpdate();
StartPTExchange();
- SendNotificationOnPermissionsUpdated(application_id);
+}
+
+void PolicyManagerImpl::UpdatePTUReadyAppsCount(const uint32_t new_app_count) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ applications_pending_ptu_count_ = new_app_count;
+}
+
+void PolicyManagerImpl::OnAppRegisteredOnMobile(
+ const std::string& device_id, const std::string& application_id) {
+ if (application_id != last_registered_policy_app_id_) {
+ if (last_registered_policy_app_id_.empty()) {
+ LOG4CXX_DEBUG(logger_, "Stopping update after first app is registered");
+ // ResetRetrySequence(ResetRetryCountType::kResetInternally);
+ StopRetrySequence();
+ }
+ StartPTExchange();
+ last_registered_policy_app_id_ = application_id;
+ }
+
+ SendNotificationOnPermissionsUpdated(device_id, application_id);
}
void PolicyManagerImpl::OnDeviceSwitching(const std::string& device_id_from,
@@ -395,9 +756,79 @@ const std::vector<std::string> PolicyManagerImpl::GetAppRequestSubTypes(
cache_->GetAppRequestSubTypes(policy_app_id, request_subtypes);
return request_subtypes;
}
+const std::vector<policy_table::VehicleDataItem>
+PolicyManagerImpl::GetVehicleDataItems() const {
+ return cache_->GetVehicleDataItems();
+}
+
+std::vector<policy_table::VehicleDataItem>
+PolicyManagerImpl::GetRemovedVehicleDataItems() const {
+ return cache_->GetRemovedVehicleDataItems();
+}
+
+Json::Value PolicyManagerImpl::GetPolicyTableData() const {
+ return cache_->GetPolicyTableData();
+}
+
+void PolicyManagerImpl::GetEnabledCloudApps(
+ std::vector<std::string>& enabled_apps) const {
+ cache_->GetEnabledCloudApps(enabled_apps);
+}
-const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const {
- return cache_->GetVehicleInfo();
+std::vector<std::string> PolicyManagerImpl::GetEnabledLocalApps() const {
+ return cache_->GetEnabledLocalApps();
+}
+
+bool PolicyManagerImpl::GetAppProperties(
+ const std::string& policy_app_id, AppProperties& out_app_properties) const {
+ return cache_->GetAppProperties(policy_app_id, out_app_properties);
+}
+
+void PolicyManagerImpl::InitCloudApp(const std::string& policy_app_id) {
+ cache_->InitCloudApp(policy_app_id);
+}
+
+void PolicyManagerImpl::SetCloudAppEnabled(const std::string& policy_app_id,
+ const bool enabled) {
+ cache_->SetCloudAppEnabled(policy_app_id, enabled);
+}
+
+void PolicyManagerImpl::SetAppAuthToken(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ cache_->SetAppAuthToken(policy_app_id, auth_token);
+}
+
+void PolicyManagerImpl::SetAppCloudTransportType(
+ const std::string& policy_app_id, const std::string& cloud_transport_type) {
+ cache_->SetAppCloudTransportType(policy_app_id, cloud_transport_type);
+}
+
+void PolicyManagerImpl::SetAppEndpoint(const std::string& policy_app_id,
+ const std::string& endpoint) {
+ cache_->SetAppEndpoint(policy_app_id, endpoint);
+}
+
+void PolicyManagerImpl::SetAppNicknames(const std::string& policy_app_id,
+ const StringArray& nicknames) {
+ cache_->SetAppNicknames(policy_app_id, nicknames);
+}
+
+void PolicyManagerImpl::SetHybridAppPreference(
+ const std::string& policy_app_id,
+ const std::string& hybrid_app_preference) {
+ cache_->SetHybridAppPreference(policy_app_id, hybrid_app_preference);
+}
+
+void PolicyManagerImpl::GetAppServiceParameters(
+ const std::string& policy_app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ cache_->GetAppServiceParameters(policy_app_id, app_service_parameters);
+}
+
+bool PolicyManagerImpl::UnknownRPCPassthroughAllowed(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->UnknownRPCPassthroughAllowed(policy_app_id);
}
void PolicyManagerImpl::CheckPermissions(const PTString& device_id,
@@ -445,15 +876,8 @@ bool PolicyManagerImpl::ResetUserConsent() {
}
void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
- const std::string& application_id) {
+ const std::string& device_id, const std::string& application_id) {
LOG4CXX_AUTO_TRACE(logger_);
- const std::string device_id = GetCurrentDeviceId(application_id);
- if (device_id.empty()) {
- LOG4CXX_WARN(logger_,
- "Couldn't find device info for application id "
- "'" << application_id << "'");
- return;
- }
std::vector<FunctionalGroupPermission> app_group_permissions;
GetPermissionsForApp(device_id, application_id, app_group_permissions);
@@ -462,12 +886,8 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
cache_->GetFunctionalGroupings(functional_groupings);
policy_table::Strings app_groups;
- std::vector<FunctionalGroupPermission>::const_iterator it =
- app_group_permissions.begin();
- std::vector<FunctionalGroupPermission>::const_iterator it_end =
- app_group_permissions.end();
- for (; it != it_end; ++it) {
- app_groups.push_back((*it).group_name);
+ for (const auto& group_permission : app_group_permissions) {
+ app_groups.push_back(group_permission.group_name);
}
Permissions notification_data;
@@ -477,19 +897,19 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
notification_data);
LOG4CXX_INFO(logger_,
- "Send notification for application_id:" << application_id);
+ "Send notification for application_id: " << application_id);
- std::string default_hmi;
- default_hmi = "NONE";
+ std::string default_hmi = "NONE";
const ApplicationOnDevice who = {device_id, application_id};
if (access_remote_->IsAppRemoteControl(who)) {
- listener()->OnPermissionsUpdated(application_id, notification_data);
+ listener()->OnPermissionsUpdated(
+ device_id, application_id, notification_data);
return;
}
listener()->OnPermissionsUpdated(
- application_id, notification_data, default_hmi);
+ device_id, application_id, notification_data, default_hmi);
}
bool PolicyManagerImpl::CleanupUnpairedDevices() {
@@ -511,6 +931,9 @@ void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id,
DeviceConsent current_consent = GetUserConsentForDevice(device_id);
bool is_current_device_allowed =
DeviceConsent::kDeviceAllowed == current_consent ? true : false;
+ if (is_allowed) {
+ StartPTExchange();
+ }
if (DeviceConsent::kDeviceHasNoConsent != current_consent &&
is_current_device_allowed == is_allowed) {
const std::string consent = is_allowed ? "allowed" : "disallowed";
@@ -519,8 +942,13 @@ void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id,
}
}
-bool PolicyManagerImpl::ReactOnUserDevConsentForApp(const std::string app_id,
- bool is_device_allowed) {
+bool PolicyManagerImpl::ReactOnUserDevConsentForApp(
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string app_id,
+ bool is_device_allowed) {
+ UNUSED(device_handle);
+ UNUSED(app_id);
+ UNUSED(is_device_allowed);
return true;
}
@@ -631,11 +1059,11 @@ void PolicyManagerImpl::SetUserConsentForApp(
LOG4CXX_AUTO_TRACE(logger_);
}
-bool PolicyManagerImpl::GetDefaultHmi(const std::string& policy_app_id,
+bool PolicyManagerImpl::GetDefaultHmi(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi) const {
LOG4CXX_AUTO_TRACE(logger_);
- const std::string device_id = GetCurrentDeviceId(policy_app_id);
- DeviceConsent device_consent = GetUserConsentForDevice(device_id);
+ const DeviceConsent device_consent = GetUserConsentForDevice(device_id);
const std::string app_id = policy::kDeviceAllowed != device_consent
? kPreDataConsentId
: policy_app_id;
@@ -718,7 +1146,7 @@ void PolicyManagerImpl::GetPermissionsForApp(
app_id_to_check = kDefaultId;
allowed_by_default = true;
} else if (cache_->IsPredataPolicy(policy_app_id) ||
- policy::kDeviceDisallowed == GetUserConsentForDevice(device_id)) {
+ policy::kDeviceAllowed != GetUserConsentForDevice(device_id)) {
app_id_to_check = kPreDataConsentId;
allowed_by_default = true;
}
@@ -773,9 +1201,11 @@ void PolicyManagerImpl::GetPermissionsForApp(
}
std::string& PolicyManagerImpl::GetCurrentDeviceId(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) const {
LOG4CXX_AUTO_TRACE(logger_);
- last_device_id_ = listener()->OnCurrentDeviceIdUpdateRequired(policy_app_id);
+ last_device_id_ =
+ listener()->OnCurrentDeviceIdUpdateRequired(device_handle, policy_app_id);
return last_device_id_;
}
@@ -787,14 +1217,6 @@ void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
LOG4CXX_AUTO_TRACE(logger_);
}
-void PolicyManagerImpl::OnSystemReady() {
- // Update policy table for the first time with system information
- if (cache_->IsPTPreloaded()) {
- listener()->OnSystemInfoUpdateRequired();
- return;
- }
-}
-
uint32_t PolicyManagerImpl::GetNotificationsNumber(
const std::string& priority) const {
LOG4CXX_AUTO_TRACE(logger_);
@@ -806,7 +1228,7 @@ bool PolicyManagerImpl::ExceededIgnitionCycles() {
}
bool PolicyManagerImpl::IsPTValid(
- utils::SharedPtr<policy_table::Table> policy_table,
+ std::shared_ptr<policy_table::Table> policy_table,
policy_table::PolicyTableType type) const {
policy_table->SetPolicyTableType(type);
if (!policy_table->is_valid()) {
@@ -827,9 +1249,9 @@ const PolicySettings& PolicyManagerImpl::get_settings() const {
bool PolicyManagerImpl::ExceededDays() {
LOG4CXX_AUTO_TRACE(logger_);
- TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ date_time::TimeDuration current_time = date_time::getCurrentTime();
const int kSecondsInDay = 60 * 60 * 24;
- const int days = current_time.tv_sec / kSecondsInDay;
+ const int days = date_time::getSecs(current_time) / kSecondsInDay;
return 0 == cache_->DaysBeforeExchange(days);
}
@@ -840,19 +1262,45 @@ void PolicyManagerImpl::KmsChanged(int kilometers) {
LOG4CXX_INFO(logger_, "Enough kilometers passed to send for PT update.");
update_status_manager_.ScheduleUpdate();
StartPTExchange();
+ PTUpdatedAt(KILOMETERS, kilometers);
}
}
+const boost::optional<bool> PolicyManagerImpl::LockScreenDismissalEnabledState()
+ const {
+ return cache_->LockScreenDismissalEnabledState();
+}
+
+const boost::optional<std::string>
+PolicyManagerImpl::LockScreenDismissalWarningMessage(
+ const std::string& language) const {
+ return cache_->LockScreenDismissalWarningMessage(language);
+}
+
void PolicyManagerImpl::IncrementIgnitionCycles() {
cache_->IncrementIgnitionCycles();
}
std::string PolicyManagerImpl::ForcePTExchange() {
update_status_manager_.ScheduleUpdate();
+
+ ptu_requested_ = false;
StartPTExchange();
return update_status_manager_.StringifiedUpdateStatus();
}
+void PolicyManagerImpl::StopRetrySequence() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (timer_retry_sequence_.is_running()) {
+ timer_retry_sequence_.Stop();
+ }
+
+ if (cache_->UpdateRequired()) {
+ ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate);
+ }
+}
+
std::string PolicyManagerImpl::ForcePTExchangeAtUserRequest() {
update_status_manager_.ScheduleManualUpdate();
StartPTExchange();
@@ -864,6 +1312,7 @@ std::string PolicyManagerImpl::GetPolicyTableStatus() const {
}
uint32_t PolicyManagerImpl::NextRetryTimeout() {
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
LOG4CXX_DEBUG(logger_, "Index: " << retry_sequence_index_);
uint32_t next = 0u;
@@ -879,8 +1328,7 @@ uint32_t PolicyManagerImpl::NextRetryTimeout() {
}
for (uint32_t i = 0u; i < retry_sequence_index_; ++i) {
- next += retry_sequence_seconds_[i] *
- date_time::DateTime::MILLISECONDS_IN_SECOND;
+ next += retry_sequence_seconds_[i] * date_time::MILLISECONDS_IN_SECOND;
next += retry_sequence_timeout_;
}
++retry_sequence_index_;
@@ -890,16 +1338,23 @@ uint32_t PolicyManagerImpl::NextRetryTimeout() {
}
void PolicyManagerImpl::RefreshRetrySequence() {
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
retry_sequence_timeout_ = cache_->TimeoutResponse();
retry_sequence_seconds_.clear();
cache_->SecondsBetweenRetries(retry_sequence_seconds_);
}
-void PolicyManagerImpl::ResetRetrySequence() {
+void PolicyManagerImpl::ResetRetrySequence(
+ const ResetRetryCountType reset_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
retry_sequence_index_ = 0;
- update_status_manager_.OnResetRetrySequence();
+ retry_sequence_url_ = RetrySequenceURL();
+ ptu_requested_ = false;
+ if (ResetRetryCountType::kResetWithStatusUpdate == reset_type) {
+ update_status_manager_.OnResetRetrySequence();
+ }
}
uint32_t PolicyManagerImpl::TimeoutExchangeMSec() {
@@ -955,7 +1410,8 @@ bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const {
return cache_->IsApplicationRevoked(app_id);
}
-bool PolicyManagerImpl::IsConsentNeeded(const std::string& app_id) {
+bool PolicyManagerImpl::IsConsentNeeded(const std::string& device_id,
+ const std::string& app_id) {
LOG4CXX_AUTO_TRACE(logger_);
return false;
}
@@ -963,15 +1419,17 @@ bool PolicyManagerImpl::IsConsentNeeded(const std::string& app_id) {
void PolicyManagerImpl::SetVINValue(const std::string& value) {}
AppPermissions PolicyManagerImpl::GetAppPermissionsChanges(
- const std::string& policy_app_id) {
+ const std::string& device_id, const std::string& policy_app_id) {
typedef std::map<std::string, AppPermissions>::iterator PermissionsIt;
PermissionsIt app_id_diff = app_permissions_diff_.find(policy_app_id);
AppPermissions permissions(policy_app_id);
if (app_permissions_diff_.end() != app_id_diff) {
permissions = app_id_diff->second;
} else {
- permissions.appPermissionsConsentNeeded = IsConsentNeeded(policy_app_id);
+ permissions.appPermissionsConsentNeeded =
+ IsConsentNeeded(device_id, policy_app_id);
permissions.appRevoked = IsApplicationRevoked(policy_app_id);
+ permissions.isSDLAllowed = true;
GetPriority(permissions.application_id, &permissions.priority);
}
return permissions;
@@ -1058,20 +1516,22 @@ class CallStatusChange : public utils::Callable {
};
StatusNotifier PolicyManagerImpl::AddApplication(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) {
LOG4CXX_AUTO_TRACE(logger_);
- const std::string device_id = GetCurrentDeviceId(application_id);
- DeviceConsent device_consent = GetUserConsentForDevice(device_id);
+ auto device_consent = GetUserConsentForDevice(device_id);
sync_primitives::AutoLock lock(apps_registration_lock_);
if (IsNewApplication(application_id)) {
AddNewApplication(application_id, device_consent);
- return utils::MakeShared<CallStatusChange>(update_status_manager_,
- device_consent);
- } else {
- PromoteExistedApplication(application_id, device_consent);
- return utils::MakeShared<utils::CallNothing>();
+ return std::make_shared<CallStatusChange>(update_status_manager_,
+ device_consent);
}
+ PromoteExistedApplication(application_id, device_consent);
+ if (!ptu_requested_) {
+ update_status_manager_.OnExistedApplicationAdded(cache_->UpdateRequired());
+ }
+ return std::make_shared<utils::CallNothing>();
}
void PolicyManagerImpl::RemoveAppConsentForGroup(
@@ -1094,6 +1554,7 @@ void PolicyManagerImpl::AddNewApplication(const std::string& application_id,
void PolicyManagerImpl::PromoteExistedApplication(
const std::string& application_id, DeviceConsent device_consent) {
+ LOG4CXX_AUTO_TRACE(logger_);
// If device consent changed to allowed during application being
// disconnected, app permissions should be changed also
if (kDeviceAllowed == device_consent &&
@@ -1108,6 +1569,7 @@ bool PolicyManagerImpl::IsNewApplication(
}
bool PolicyManagerImpl::ResetPT(const std::string& file_name) {
+ LOG4CXX_AUTO_TRACE(logger_);
cache_->ResetCalculatedPermissions();
const bool result = cache_->ResetPT(file_name);
if (result) {
@@ -1146,11 +1608,15 @@ bool PolicyManagerImpl::InitPT(const std::string& file_name,
const bool ret = cache_->Init(file_name, settings);
if (ret) {
RefreshRetrySequence();
- update_status_manager_.OnPolicyInit(cache_->UpdateRequired());
const std::string certificate_data = cache_->GetCertificate();
if (!certificate_data.empty()) {
listener_->OnCertificateUpdated(certificate_data);
}
+ std::vector<std::string> enabled_cloud_apps;
+ cache_->GetEnabledCloudApps(enabled_cloud_apps);
+ for (auto app : enabled_cloud_apps) {
+ SendAuthTokenUpdated(app);
+ }
}
return ret;
}
@@ -1160,16 +1626,49 @@ uint32_t PolicyManagerImpl::HeartBeatTimeout(const std::string& app_id) const {
}
void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!is_update_needed) {
+ ResetRetrySequence(ResetRetryCountType::kResetInternally);
+ }
cache_->SaveUpdateRequired(is_update_needed);
}
void PolicyManagerImpl::set_cache_manager(
CacheManagerInterface* cache_manager) {
- cache_ = cache_manager;
+ cache_ = std::shared_ptr<CacheManagerInterface>(cache_manager);
+}
+
+void PolicyManagerImpl::ResetTimeout() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (update_status_manager_.IsUpdatePending()) {
+ if (timer_retry_sequence_.is_running()) {
+ timer_retry_sequence_.Stop();
+ }
+ timer_retry_sequence_.Start(cache_->TimeoutResponse(), timer::kSingleShot);
+ }
}
-void PolicyManagerImpl::RetrySequence() {
- LOG4CXX_INFO(logger_, "Start new retry sequence");
+void PolicyManagerImpl::OnPTUIterationTimeout() {
+ LOG4CXX_DEBUG(logger_, "Start new retry sequence");
+
+ const bool is_exceeded_retries_count =
+ (retry_sequence_seconds_.size() < retry_sequence_index_);
+
+ if (is_exceeded_retries_count) {
+ LOG4CXX_WARN(logger_, "Exceeded allowed PTU retry count");
+ listener_->OnPTUTimeOut();
+ ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate);
+ if (timer_retry_sequence_.is_running()) {
+ timer_retry_sequence_.Stop();
+ }
+
+ if (HasApplicationForPTU()) {
+ StartPTExchange();
+ }
+ return;
+ }
+
update_status_manager_.OnUpdateTimeoutOccurs();
const uint32_t timeout_msec = NextRetryTimeout();
@@ -1181,14 +1680,21 @@ void PolicyManagerImpl::RetrySequence() {
return;
}
- RequestPTUpdate();
+ RequestPTUpdate(PTUIterationType::RetryIteration);
timer_retry_sequence_.Start(timeout_msec, timer::kPeriodic);
}
-void PolicyManagerImpl::SetDefaultHmiTypes(const std::string& application_id,
- const std::vector<int>& hmi_types) {
+bool PolicyManagerImpl::HasApplicationForPTU() const {
+ return applications_pending_ptu_count_ > 0;
+}
+
+void PolicyManagerImpl::SetDefaultHmiTypes(
+ const transport_manager::DeviceHandle& device_handle,
+ const std::string& application_id,
+ const std::vector<int>& hmi_types) {
LOG4CXX_INFO(logger_, "SetDefaultHmiTypes");
- const std::string device_id = GetCurrentDeviceId(application_id);
+ const std::string device_id =
+ GetCurrentDeviceId(device_handle, application_id);
ApplicationOnDevice who = {device_id, application_id};
access_remote_->SetDefaultHmiTypes(who, hmi_types);
}
@@ -1226,12 +1732,12 @@ bool PolicyManagerImpl::CheckModule(const PTString& app_id,
void PolicyManagerImpl::SendHMILevelChanged(const ApplicationOnDevice& who) {
std::string default_hmi("NONE");
- if (GetDefaultHmi(who.app_id, &default_hmi)) {
+ if (GetDefaultHmi(who.dev_id, who.app_id, &default_hmi)) {
listener()->OnUpdateHMIStatus(who.dev_id, who.app_id, default_hmi);
} else {
- LOG4CXX_WARN(logger_,
- "Couldn't get default HMI level for application "
- << who.app_id);
+ LOG4CXX_WARN(
+ logger_,
+ "Couldn't get default HMI level for application " << who.app_id);
}
}
@@ -1263,7 +1769,14 @@ void PolicyManagerImpl::SendAppPermissionsChanged(
const std::string& device_id, const std::string& application_id) {
Permissions notification_data;
GetPermissions(device_id, application_id, &notification_data);
- listener()->OnPermissionsUpdated(application_id, notification_data);
+ listener()->OnPermissionsUpdated(
+ device_id, application_id, notification_data);
+}
+
+void PolicyManagerImpl::SendAuthTokenUpdated(const std::string policy_app_id) {
+ AppProperties app_properties;
+ cache_->GetAppProperties(policy_app_id, app_properties);
+ listener_->OnAuthTokenUpdated(policy_app_id, app_properties.auth_token);
}
void PolicyManagerImpl::OnPrimaryGroupsChanged(
@@ -1287,8 +1800,115 @@ bool PolicyManagerImpl::GetModuleTypes(
}
void PolicyManagerImpl::set_access_remote(
- utils::SharedPtr<AccessRemote> access_remote) {
+ std::shared_ptr<AccessRemote> access_remote) {
access_remote_ = access_remote;
}
+bool PolicyManagerImpl::AppNeedEncryption(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto encryption_required =
+ cache_->GetAppEncryptionRequiredFlag(policy_app_id);
+
+ return encryption_required.is_initialized() ? *encryption_required : true;
+}
+
+const rpc::Optional<rpc::Boolean> PolicyManagerImpl::GetAppEncryptionRequired(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->GetAppEncryptionRequiredFlag(policy_app_id);
+}
+
+const std::vector<std::string> PolicyManagerImpl::GetFunctionalGroupsForApp(
+ const std::string& policy_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace rpc::policy_table_interface_base;
+ DCHECK(kDeviceId != policy_app_id);
+
+ std::vector<std::string> function_groups;
+
+ ApplicationParams app_policies;
+ cache_->GetApplicationParams(policy_app_id, app_policies);
+
+ const auto& policy_function_group = app_policies.groups;
+
+ for (const auto& group : policy_function_group) {
+ function_groups.push_back(group);
+ }
+
+ return function_groups;
+}
+
+const std::vector<std::string> PolicyManagerImpl::GetApplicationPolicyIDs()
+ const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<std::string> policy_app_ids;
+
+ const auto apps = cache_->GetPolicyAppIDs();
+
+ for (const auto& app : apps) {
+ policy_app_ids.push_back(app);
+ }
+
+ return policy_app_ids;
+}
+
+bool PolicyManagerImpl::FunctionGroupNeedEncryption(
+ const std::string& policy_group) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ FunctionalGroupings functional_groupings;
+ cache_->GetFunctionalGroupings(functional_groupings);
+
+ const auto& grouping_itr = functional_groupings.find(policy_group);
+ if (grouping_itr == functional_groupings.end()) {
+ LOG4CXX_WARN(logger_, "Group " << policy_group << " not found");
+ return false;
+ }
+
+ const auto& grouping = (*grouping_itr).second;
+
+ return grouping.encryption_required.is_initialized()
+ ? *grouping.encryption_required
+ : false;
+}
+
+void PolicyManagerImpl::TriggerPTUOnStartupIfRequired() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (ignition_check) {
+ StartPTExchange();
+ }
+}
+
+const std::string PolicyManagerImpl::GetPolicyFunctionName(
+ const uint32_t function_id) const {
+ return policy_table::EnumToJsonString(
+ static_cast<policy_table::FunctionID>(function_id));
+}
+
+const std::vector<std::string> PolicyManagerImpl::GetRPCsForFunctionGroup(
+ const std::string& group) const {
+ std::vector<std::string> rpcs_for_group;
+
+ FunctionalGroupings functional_groupings;
+ cache_->GetFunctionalGroupings(functional_groupings);
+
+ const auto& rpcs = functional_groupings[group].rpcs;
+
+ for (const auto& rpc : rpcs) {
+ rpcs_for_group.push_back(rpc.first);
+ }
+
+ return rpcs_for_group;
+}
+
} // namespace policy
+
+__attribute__((visibility("default"))) policy::PolicyManager* CreateManager() {
+ return new policy::PolicyManagerImpl();
+}
+
+__attribute__((visibility("default"))) void DeleteManager(
+ policy::PolicyManager* pm) {
+ delete pm;
+ DELETE_THREAD_LOGGER(policy::logger_);
+}
diff --git a/src/components/policy/policy_regular/src/policy_table.cc b/src/components/policy/policy_regular/src/policy_table.cc
index c5c6e3e132..b0fa5739da 100644
--- a/src/components/policy/policy_regular/src/policy_table.cc
+++ b/src/components/policy/policy_regular/src/policy_table.cc
@@ -42,7 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
PolicyTable::PolicyTable() : pt_data_(new SQLPTRepresentation()) {}
-PolicyTable::PolicyTable(utils::SharedPtr<PTRepresentation> pt_data)
+PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data)
: pt_data_(pt_data) {}
PolicyTable::~PolicyTable() {
diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc
index e05ed8f064..8aabf54c5d 100644
--- a/src/components/policy/policy_regular/src/policy_table/enums.cc
+++ b/src/components/policy/policy_regular/src/policy_table/enums.cc
@@ -1,665 +1,8 @@
-// This file is generated, do not edit
#include "policy/policy_table/enums.h"
+#include <cstring>
namespace rpc {
namespace policy_table_interface_base {
-bool IsValidEnum(Priority val) {
- switch (val) {
- case P_EMERGENCY:
- return true;
- case P_NAVIGATION:
- return true;
- case P_VOICECOM:
- return true;
- case P_COMMUNICATION:
- return true;
- case P_NORMAL:
- return true;
- case P_NONE:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(Priority val) {
- switch (val) {
- case P_EMERGENCY:
- return "EMERGENCY";
- case P_NAVIGATION:
- return "NAVIGATION";
- case P_VOICECOM:
- return "VOICECOM";
- case P_COMMUNICATION:
- return "COMMUNICATION";
- case P_NORMAL:
- return "NORMAL";
- case P_NONE:
- return "NONE";
- default:
- return "";
- }
-}
-bool EnumFromJsonString(const std::string& literal, Priority* result) {
- if ("EMERGENCY" == literal) {
- *result = P_EMERGENCY;
- return true;
- } else if ("NAVIGATION" == literal) {
- *result = P_NAVIGATION;
- return true;
- } else if ("VOICECOM" == literal) {
- *result = P_VOICECOM;
- return true;
- } else if ("COMMUNICATION" == literal) {
- *result = P_COMMUNICATION;
- return true;
- } else if ("NORMAL" == literal) {
- *result = P_NORMAL;
- return true;
- } else if ("NONE" == literal) {
- *result = P_NONE;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(HmiLevel val) {
- switch (val) {
- case HL_BACKGROUND:
- return true;
- case HL_FULL:
- return true;
- case HL_LIMITED:
- return true;
- case HL_NONE:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(HmiLevel val) {
- switch (val) {
- case HL_BACKGROUND:
- return "BACKGROUND";
- case HL_FULL:
- return "FULL";
- case HL_LIMITED:
- return "LIMITED";
- case HL_NONE:
- return "NONE";
- default:
- return "";
- }
-}
-bool EnumFromJsonString(const std::string& literal, HmiLevel* result) {
- if ("BACKGROUND" == literal) {
- *result = HL_BACKGROUND;
- return true;
- } else if ("FULL" == literal) {
- *result = HL_FULL;
- return true;
- } else if ("LIMITED" == literal) {
- *result = HL_LIMITED;
- return true;
- } else if ("NONE" == literal) {
- *result = HL_NONE;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(Parameter val) {
- switch (val) {
- case P_GPS:
- return true;
- case P_SPEED:
- return true;
- case P_ENGINETORQUE:
- return true;
- case P_EXTERNALTEMPERATURE:
- return true;
- case P_TURNSIGNAL:
- return true;
- case P_FUELLEVEL:
- return true;
- case P_FUELLEVEL_STATE:
- return true;
- case P_HEADLAMPSTATUS:
- return true;
- case P_INSTANTFUELCONSUMPTION:
- return true;
- case P_FUELRANGE:
- return true;
- case P_ODOMETER:
- return true;
- case P_TIREPRESSURE:
- return true;
- case P_WIPERSTATUS:
- return true;
- case P_VIN:
- return true;
- case P_ACCPEDALPOSITION:
- return true;
- case P_BELTSTATUS:
- return true;
- case P_DRIVERBRAKING:
- return true;
- case P_PRNDL:
- return true;
- case P_RPM:
- return true;
- case P_STEERINGWHEELANGLE:
- return true;
- case P_ENGINEOILLIFE:
- return true;
- case P_MYKEY:
- return true;
- case P_AIRBAGSTATUS:
- return true;
- case P_BODYINFORMATION:
- return true;
- case P_CLUSTERMODESTATUS:
- return true;
- case P_DEVICESTATUS:
- return true;
- case P_EMERGENCYEVENT:
- return true;
- case P_ECALLINFO:
- return true;
- case P_EMPTY:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(Parameter val) {
- switch (val) {
- case P_GPS:
- return "gps";
- case P_SPEED:
- return "speed";
- case P_ENGINETORQUE:
- return "engineTorque";
- case P_EXTERNALTEMPERATURE:
- return "externalTemperature";
- case P_TURNSIGNAL:
- return "turnSignal";
- case P_FUELLEVEL:
- return "fuelLevel";
- case P_FUELLEVEL_STATE:
- return "fuelLevel_State";
- case P_HEADLAMPSTATUS:
- return "headLampStatus";
- case P_INSTANTFUELCONSUMPTION:
- return "instantFuelConsumption";
- case P_FUELRANGE:
- return "fuelRange";
- case P_ODOMETER:
- return "odometer";
- case P_TIREPRESSURE:
- return "tirePressure";
- case P_WIPERSTATUS:
- return "wiperStatus";
- case P_VIN:
- return "vin";
- case P_ACCPEDALPOSITION:
- return "accPedalPosition";
- case P_BELTSTATUS:
- return "beltStatus";
- case P_DRIVERBRAKING:
- return "driverBraking";
- case P_PRNDL:
- return "prndl";
- case P_RPM:
- return "rpm";
- case P_STEERINGWHEELANGLE:
- return "steeringWheelAngle";
- case P_ENGINEOILLIFE:
- return "engineOilLife";
- case P_MYKEY:
- return "myKey";
- case P_AIRBAGSTATUS:
- return "airbagStatus";
- case P_BODYINFORMATION:
- return "bodyInformation";
- case P_CLUSTERMODESTATUS:
- return "clusterModeStatus";
- case P_DEVICESTATUS:
- return "deviceStatus";
- case P_EMERGENCYEVENT:
- return "emergencyEvent";
- case P_ECALLINFO:
- return "eCallInfo";
- case P_EMPTY:
- return "EMPTY";
- default:
- return "";
- }
-}
-
-bool EnumFromJsonString(const std::string& literal, Parameter* result) {
- if ("gps" == literal) {
- *result = P_GPS;
- return true;
- } else if ("speed" == literal) {
- *result = P_SPEED;
- return true;
- } else if ("engineTorque" == literal) {
- *result = P_ENGINETORQUE;
- return true;
- } else if ("externalTemperature" == literal) {
- *result = P_EXTERNALTEMPERATURE;
- return true;
- } else if ("turnSignal" == literal) {
- *result = P_TURNSIGNAL;
- return true;
- } else if ("fuelLevel" == literal) {
- *result = P_FUELLEVEL;
- return true;
- } else if ("fuelLevel_State" == literal) {
- *result = P_FUELLEVEL_STATE;
- return true;
- } else if ("headLampStatus" == literal) {
- *result = P_HEADLAMPSTATUS;
- return true;
- } else if ("instantFuelConsumption" == literal) {
- *result = P_INSTANTFUELCONSUMPTION;
- return true;
- } else if ("fuelRange" == literal) {
- *result = P_FUELRANGE;
- return true;
- } else if ("odometer" == literal) {
- *result = P_ODOMETER;
- return true;
- } else if ("tirePressure" == literal) {
- *result = P_TIREPRESSURE;
- return true;
- } else if ("wiperStatus" == literal) {
- *result = P_WIPERSTATUS;
- return true;
- } else if ("vin" == literal) {
- *result = P_VIN;
- return true;
- } else if ("accPedalPosition" == literal) {
- *result = P_ACCPEDALPOSITION;
- return true;
- } else if ("beltStatus" == literal) {
- *result = P_BELTSTATUS;
- return true;
- } else if ("driverBraking" == literal) {
- *result = P_DRIVERBRAKING;
- return true;
- } else if ("prndl" == literal) {
- *result = P_PRNDL;
- return true;
- } else if ("rpm" == literal) {
- *result = P_RPM;
- return true;
- } else if ("steeringWheelAngle" == literal) {
- *result = P_STEERINGWHEELANGLE;
- return true;
- } else if ("engineOilLife" == literal) {
- *result = P_ENGINEOILLIFE;
- return true;
- } else if ("myKey" == literal) {
- *result = P_MYKEY;
- return true;
- } else if ("airbagStatus" == literal) {
- *result = P_AIRBAGSTATUS;
- return true;
- } else if ("bodyInformation" == literal) {
- *result = P_BODYINFORMATION;
- return true;
- } else if ("clusterModeStatus" == literal) {
- *result = P_CLUSTERMODESTATUS;
- return true;
- } else if ("deviceStatus" == literal) {
- *result = P_DEVICESTATUS;
- return true;
- } else if ("emergencyEvent" == literal) {
- *result = P_EMERGENCYEVENT;
- return true;
- } else if ("eCallInfo" == literal) {
- *result = P_ECALLINFO;
- return true;
- } else if ("EMPTY" == literal) {
- *result = P_EMPTY;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(AppHMIType val) {
- switch (val) {
- case AHT_DEFAULT:
- return true;
- case AHT_COMMUNICATION:
- return true;
- case AHT_MEDIA:
- return true;
- case AHT_MESSAGING:
- return true;
- case AHT_NAVIGATION:
- return true;
- case AHT_INFORMATION:
- return true;
- case AHT_SOCIAL:
- return true;
- case AHT_BACKGROUND_PROCESS:
- return true;
- case AHT_TESTING:
- return true;
- case AHT_SYSTEM:
- return true;
- case AHT_PROJECTION:
- return true;
- case AHT_REMOTE_CONTROL:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(AppHMIType val) {
- switch (val) {
- case AHT_DEFAULT:
- return "DEFAULT";
- case AHT_COMMUNICATION:
- return "COMMUNICATION";
- case AHT_MEDIA:
- return "MEDIA";
- case AHT_MESSAGING:
- return "MESSAGING";
- case AHT_NAVIGATION:
- return "NAVIGATION";
- case AHT_INFORMATION:
- return "INFORMATION";
- case AHT_SOCIAL:
- return "SOCIAL";
- case AHT_BACKGROUND_PROCESS:
- return "BACKGROUND_PROCESS";
- case AHT_TESTING:
- return "TESTING";
- case AHT_SYSTEM:
- return "SYSTEM";
- case AHT_PROJECTION:
- return "PROJECTION";
- case AHT_REMOTE_CONTROL:
- return "REMOTE_CONTROL";
- default:
- return "";
- }
-}
-bool EnumFromJsonString(const std::string& literal, AppHMIType* result) {
- if ("DEFAULT" == literal) {
- *result = AHT_DEFAULT;
- return true;
- } else if ("COMMUNICATION" == literal) {
- *result = AHT_COMMUNICATION;
- return true;
- } else if ("MEDIA" == literal) {
- *result = AHT_MEDIA;
- return true;
- } else if ("MESSAGING" == literal) {
- *result = AHT_MESSAGING;
- return true;
- } else if ("NAVIGATION" == literal) {
- *result = AHT_NAVIGATION;
- return true;
- } else if ("INFORMATION" == literal) {
- *result = AHT_INFORMATION;
- return true;
- } else if ("SOCIAL" == literal) {
- *result = AHT_SOCIAL;
- return true;
- } else if ("BACKGROUND_PROCESS" == literal) {
- *result = AHT_BACKGROUND_PROCESS;
- return true;
- } else if ("TESTING" == literal) {
- *result = AHT_TESTING;
- return true;
- } else if ("SYSTEM" == literal) {
- *result = AHT_SYSTEM;
- return true;
- } else if ("PROJECTION" == literal) {
- *result = AHT_PROJECTION;
- return true;
- } else if ("REMOTE_CONTROL" == literal) {
- *result = AHT_REMOTE_CONTROL;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(RequestType val) {
- switch (val) {
- case RT_HTTP:
- return true;
- case RT_FILE_RESUME:
- return true;
- case RT_AUTH_REQUEST:
- return true;
- case RT_AUTH_CHALLENGE:
- return true;
- case RT_AUTH_ACK:
- return true;
- case RT_PROPRIETARY:
- return true;
- case RT_QUERY_APPS:
- return true;
- case RT_LAUNCH_APP:
- return true;
- case RT_LOCK_SCREEN_ICON_URL:
- return true;
- case RT_TRAFFIC_MESSAGE_CHANNEL:
- return true;
- case RT_DRIVER_PROFILE:
- return true;
- case RT_VOICE_SEARCH:
- return true;
- case RT_NAVIGATION:
- return true;
- case RT_PHONE:
- return true;
- case RT_CLIMATE:
- return true;
- case RT_SETTINGS:
- return true;
- case RT_VEHICLE_DIAGNOSTICS:
- return true;
- case RT_EMERGENCY:
- return true;
- case RT_MEDIA:
- return true;
- case RT_FOTA:
- return true;
- case RT_OEM_SPECIFIC:
- return true;
- case RT_EMPTY:
- return true;
- default:
- return false;
- }
-}
-
-const char* EnumToJsonString(RequestType val) {
- switch (val) {
- case RT_HTTP:
- return "HTTP";
- case RT_FILE_RESUME:
- return "FILE_RESUME";
- case RT_AUTH_REQUEST:
- return "AUTH_REQUEST";
- case RT_AUTH_CHALLENGE:
- return "AUTH_CHALLENGE";
- case RT_AUTH_ACK:
- return "AUTH_ACK";
- case RT_PROPRIETARY:
- return "PROPRIETARY";
- case RT_QUERY_APPS:
- return "QUERY_APPS";
- case RT_LAUNCH_APP:
- return "LAUNCH_APP";
- case RT_LOCK_SCREEN_ICON_URL:
- return "LOCK_SCREEN_ICON_URL";
- case RT_TRAFFIC_MESSAGE_CHANNEL:
- return "TRAFFIC_MESSAGE_CHANNEL";
- case RT_DRIVER_PROFILE:
- return "DRIVER_PROFILE";
- case RT_VOICE_SEARCH:
- return "VOICE_SEARCH";
- case RT_NAVIGATION:
- return "NAVIGATION";
- case RT_PHONE:
- return "PHONE";
- case RT_CLIMATE:
- return "CLIMATE";
- case RT_SETTINGS:
- return "SETTINGS";
- case RT_VEHICLE_DIAGNOSTICS:
- return "VEHICLE_DIAGNOSTICS";
- case RT_EMERGENCY:
- return "EMERGENCY";
- case RT_MEDIA:
- return "MEDIA";
- case RT_FOTA:
- return "FOTA";
- case RT_OEM_SPECIFIC:
- return "OEM_SPECIFIC";
- case RT_EMPTY:
- return "EMPTY";
- default:
- return "";
- }
-}
-
-bool EnumFromJsonString(const std::string& literal, RequestType* result) {
- if ("HTTP" == literal) {
- *result = RT_HTTP;
- return true;
- }
- if ("FILE_RESUME" == literal) {
- *result = RT_FILE_RESUME;
- return true;
- }
- if ("AUTH_REQUEST" == literal) {
- *result = RT_AUTH_REQUEST;
- return true;
- }
- if ("AUTH_CHALLENGE" == literal) {
- *result = RT_AUTH_CHALLENGE;
- return true;
- }
- if ("AUTH_ACK" == literal) {
- *result = RT_AUTH_ACK;
- return true;
- }
- if ("PROPRIETARY" == literal) {
- *result = RT_PROPRIETARY;
- return true;
- }
- if ("QUERY_APPS" == literal) {
- *result = RT_QUERY_APPS;
- return true;
- }
- if ("LAUNCH_APP" == literal) {
- *result = RT_LAUNCH_APP;
- return true;
- }
- if ("LOCK_SCREEN_ICON_URL" == literal) {
- *result = RT_LOCK_SCREEN_ICON_URL;
- return true;
- }
- if ("TRAFFIC_MESSAGE_CHANNEL" == literal) {
- *result = RT_TRAFFIC_MESSAGE_CHANNEL;
- return true;
- }
- if ("DRIVER_PROFILE" == literal) {
- *result = RT_DRIVER_PROFILE;
- return true;
- }
- if ("VOICE_SEARCH" == literal) {
- *result = RT_VOICE_SEARCH;
- return true;
- }
- if ("NAVIGATION" == literal) {
- *result = RT_NAVIGATION;
- return true;
- }
- if ("PHONE" == literal) {
- *result = RT_PHONE;
- return true;
- }
- if ("CLIMATE" == literal) {
- *result = RT_CLIMATE;
- return true;
- }
- if ("SETTINGS" == literal) {
- *result = RT_SETTINGS;
- return true;
- }
- if ("VEHICLE_DIAGNOSTICS" == literal) {
- *result = RT_VEHICLE_DIAGNOSTICS;
- return true;
- }
- if ("EMERGENCY" == literal) {
- *result = RT_EMERGENCY;
- return true;
- }
- if ("MEDIA" == literal) {
- *result = RT_MEDIA;
- return true;
- }
- if ("FOTA" == literal) {
- *result = RT_FOTA;
- return true;
- }
- if ("OEM_SPECIFIC" == literal) {
- *result = RT_OEM_SPECIFIC;
- return true;
- }
- if ("EMPTY" == literal) {
- *result = RT_EMPTY;
- return true;
- } else {
- return false;
- }
-}
-
-bool IsValidEnum(ModuleType val) {
- switch (val) {
- case MT_CLIMATE:
- return true;
- case MT_RADIO:
- return true;
- default:
- return false;
- }
-}
-const char* EnumToJsonString(ModuleType val) {
- switch (val) {
- case MT_CLIMATE:
- return "CLIMATE";
- case MT_RADIO:
- return "RADIO";
- default:
- return "";
- }
-}
-
-bool EnumFromJsonString(const std::string& literal, ModuleType* result) {
- if ("CLIMATE" == literal) {
- *result = MT_CLIMATE;
- return true;
- } else if ("RADIO" == literal) {
- *result = MT_RADIO;
- return true;
- } else {
- return false;
- }
-}
const std::string kDefaultApp = "default";
const std::string kPreDataConsentApp = "pre_DataConsent";
diff --git a/src/components/policy/policy_regular/src/policy_table/types.cc b/src/components/policy/policy_regular/src/policy_table/types.cc
index c983e4f12b..3029ebb067 100644
--- a/src/components/policy/policy_regular/src/policy_table/types.cc
+++ b/src/components/policy/policy_regular/src/policy_table/types.cc
@@ -31,7 +31,6 @@ PolicyBase::~PolicyBase() {}
PolicyBase::PolicyBase(const Json::Value* value__)
: CompositeType(InitHelper(value__, &Json::Value::isObject))
, priority(impl::ValueMember(value__, "priority")) {}
-
Json::Value PolicyBase::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("priority", priority, &result__);
@@ -149,6 +148,109 @@ void ApplicationPoliciesSection::SetPolicyTableType(PolicyTableType pt_type) {
device.SetPolicyTableType(pt_type);
apps.SetPolicyTableType(pt_type);
}
+// Handled RPC Methods
+AppServiceHandledRpc::AppServiceHandledRpc() : CompositeType(kUninitialized) {}
+
+AppServiceHandledRpc::~AppServiceHandledRpc() {}
+
+AppServiceHandledRpc::AppServiceHandledRpc(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , function_id(impl::ValueMember(value__, "function_id")) {}
+
+Json::Value AppServiceHandledRpc::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("function_id", function_id, &result__);
+ return result__;
+}
+
+bool AppServiceHandledRpc::is_valid() const {
+ if (!function_id.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool AppServiceHandledRpc::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool AppServiceHandledRpc::struct_empty() const {
+ if (function_id.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+void AppServiceHandledRpc::SetPolicyTableType(PolicyTableType pt_type) {
+ function_id.SetPolicyTableType(pt_type);
+}
+
+void AppServiceHandledRpc::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!function_id.is_valid()) {
+ function_id.ReportErrors(&report__->ReportSubobject("function_id"));
+ }
+}
+
+// AppServiceInfo methods
+AppServiceInfo::AppServiceInfo() : CompositeType(kUninitialized) {}
+
+AppServiceInfo::~AppServiceInfo() {}
+
+AppServiceInfo::AppServiceInfo(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , service_names(impl::ValueMember(value__, "service_names"))
+ , handled_rpcs(impl::ValueMember(value__, "handled_rpcs")) {}
+
+Json::Value AppServiceInfo::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("service_names", service_names, &result__);
+ impl::WriteJsonField("parameters", handled_rpcs, &result__);
+ return result__;
+}
+
+bool AppServiceInfo::is_valid() const {
+ if (!service_names.is_valid()) {
+ return false;
+ }
+ if (!handled_rpcs.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool AppServiceInfo::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool AppServiceInfo::struct_empty() const {
+ if (service_names.is_initialized()) {
+ return false;
+ }
+ if (handled_rpcs.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+void AppServiceInfo::SetPolicyTableType(PolicyTableType pt_type) {
+ service_names.SetPolicyTableType(pt_type);
+ handled_rpcs.SetPolicyTableType(pt_type);
+}
+
+void AppServiceInfo::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!service_names.is_valid()) {
+ service_names.ReportErrors(&report__->ReportSubobject("service_names"));
+ }
+ if (!handled_rpcs.is_valid()) {
+ handled_rpcs.ReportErrors(&report__->ReportSubobject("handled_rpcs"));
+ }
+}
// ApplicationParams methods
ApplicationParams::ApplicationParams() : PolicyBase(), groups() {}
@@ -167,8 +269,18 @@ ApplicationParams::ApplicationParams(const Json::Value* value__)
, RequestSubType(impl::ValueMember(value__, "RequestSubType"))
, memory_kb(impl::ValueMember(value__, "memory_kb"), 0)
, heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms"))
- , certificate(impl::ValueMember(value__, "certificate"), "not_specified")
- , moduleType(impl::ValueMember(value__, "moduleType")) {}
+ , certificate(impl::ValueMember(value__, "certificate"))
+ , moduleType(impl::ValueMember(value__, "moduleType"))
+ , hybrid_app_preference(impl::ValueMember(value__, "hybrid_app_preference"))
+ , endpoint(impl::ValueMember(value__, "endpoint"))
+ , enabled(impl::ValueMember(value__, "enabled"))
+ , auth_token(impl::ValueMember(value__, "auth_token"))
+ , cloud_transport_type(impl::ValueMember(value__, "cloud_transport_type"))
+ , icon_url(impl::ValueMember(value__, "icon_url"))
+ , app_service_parameters(impl::ValueMember(value__, "app_services"))
+ , allow_unknown_rpc_passthrough(
+ impl::ValueMember(value__, "allow_unknown_rpc_passthrough"))
+ , encryption_required(impl::ValueMember(value__, "encryption_required")) {}
Json::Value ApplicationParams::ToJsonValue() const {
Json::Value result__(PolicyBase::ToJsonValue());
@@ -180,7 +292,21 @@ Json::Value ApplicationParams::ToJsonValue() const {
impl::WriteJsonField("memory_kb", memory_kb, &result__);
impl::WriteJsonField(
"heart_beat_timeout_ms", heart_beat_timeout_ms, &result__);
+ impl::WriteJsonField("certificate", certificate, &result__);
impl::WriteJsonField("moduleType", moduleType, &result__);
+ impl::WriteJsonField(
+ "hybrid_app_preference", hybrid_app_preference, &result__);
+ impl::WriteJsonField("endpoint", endpoint, &result__);
+ impl::WriteJsonField("enabled", enabled, &result__);
+ impl::WriteJsonField("auth_token", auth_token, &result__);
+ impl::WriteJsonField("cloud_transport_type", cloud_transport_type, &result__);
+ impl::WriteJsonField("icon_url", auth_token, &result__);
+ impl::WriteJsonField("app_services", app_service_parameters, &result__);
+ impl::WriteJsonField("allow_unknown_rpc_passthrough",
+ allow_unknown_rpc_passthrough,
+ &result__);
+ impl::WriteJsonField("encryption_required", encryption_required, &result__);
+
return result__;
}
@@ -212,6 +338,33 @@ bool ApplicationParams::is_valid() const {
if (!moduleType.is_valid()) {
return false;
}
+ if (!endpoint.is_valid()) {
+ return false;
+ }
+ if (!enabled.is_valid()) {
+ return false;
+ }
+ if (!auth_token.is_valid()) {
+ return false;
+ }
+ if (!cloud_transport_type.is_valid()) {
+ return false;
+ }
+ if (!hybrid_app_preference.is_valid()) {
+ return false;
+ }
+ if (!icon_url.is_valid()) {
+ return false;
+ }
+ if (!app_service_parameters.is_valid()) {
+ return false;
+ }
+ if (!allow_unknown_rpc_passthrough.is_valid()) {
+ return false;
+ }
+ if (!encryption_required.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -250,6 +403,33 @@ bool ApplicationParams::struct_empty() const {
if (moduleType.is_initialized()) {
return false;
}
+ if (endpoint.is_initialized()) {
+ return false;
+ }
+ if (enabled.is_initialized()) {
+ return false;
+ }
+ if (auth_token.is_initialized()) {
+ return false;
+ }
+ if (cloud_transport_type.is_initialized()) {
+ return false;
+ }
+ if (hybrid_app_preference.is_initialized()) {
+ return false;
+ }
+ if (icon_url.is_initialized()) {
+ return false;
+ }
+ if (app_service_parameters.is_initialized()) {
+ return false;
+ }
+ if (allow_unknown_rpc_passthrough.is_initialized()) {
+ return false;
+ }
+ if (encryption_required.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -288,6 +468,37 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
if (!moduleType.is_valid()) {
moduleType.ReportErrors(&report__->ReportSubobject("moduleType"));
}
+ if (!endpoint.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("endpoint"));
+ }
+ if (!enabled.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("enabled"));
+ }
+ if (!auth_token.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("auth_token"));
+ }
+ if (!cloud_transport_type.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("cloud_transport_type"));
+ }
+ if (!hybrid_app_preference.is_valid()) {
+ moduleType.ReportErrors(
+ &report__->ReportSubobject("hybrid_app_preference"));
+ }
+ if (!icon_url.is_valid()) {
+ moduleType.ReportErrors(&report__->ReportSubobject("icon_url"));
+ }
+ if (!app_service_parameters.is_valid()) {
+ app_service_parameters.ReportErrors(
+ &report__->ReportSubobject("app_services"));
+ }
+ if (!allow_unknown_rpc_passthrough.is_valid()) {
+ allow_unknown_rpc_passthrough.ReportErrors(
+ &report__->ReportSubobject("allow_unknown_rpc_passthrough"));
+ }
+ if (!encryption_required.is_valid()) {
+ encryption_required.ReportErrors(
+ &report__->ReportSubobject("encryption_required"));
+ }
}
void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
@@ -300,6 +511,13 @@ void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
heart_beat_timeout_ms.SetPolicyTableType(pt_type);
certificate.SetPolicyTableType(pt_type);
moduleType.SetPolicyTableType(pt_type);
+ endpoint.SetPolicyTableType(pt_type);
+ enabled.SetPolicyTableType(pt_type);
+ cloud_transport_type.SetPolicyTableType(pt_type);
+ hybrid_app_preference.SetPolicyTableType(pt_type);
+ icon_url.SetPolicyTableType(pt_type);
+ app_service_parameters.SetPolicyTableType(pt_type);
+ allow_unknown_rpc_passthrough.SetPolicyTableType(pt_type);
}
// RpcParameters methods
@@ -329,6 +547,7 @@ bool RpcParameters::is_valid() const {
if (!parameters.is_valid()) {
return false;
}
+
return Validate();
}
@@ -375,12 +594,14 @@ Rpcs::~Rpcs() {}
Rpcs::Rpcs(const Json::Value* value__)
: CompositeType(InitHelper(value__, &Json::Value::isObject))
, user_consent_prompt(impl::ValueMember(value__, "user_consent_prompt"))
- , rpcs(impl::ValueMember(value__, "rpcs")) {}
+ , rpcs(impl::ValueMember(value__, "rpcs"))
+ , encryption_required(impl::ValueMember(value__, "encryption_required")) {}
Json::Value Rpcs::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("user_consent_prompt", user_consent_prompt, &result__);
impl::WriteJsonField("rpcs", rpcs, &result__);
+ impl::WriteJsonField("encryption_required", encryption_required, &result__);
return result__;
}
@@ -391,6 +612,9 @@ bool Rpcs::is_valid() const {
if (!rpcs.is_valid()) {
return false;
}
+ if (!encryption_required.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -405,7 +629,9 @@ bool Rpcs::struct_empty() const {
if (rpcs.is_initialized()) {
return false;
}
-
+ if (encryption_required.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -420,6 +646,10 @@ void Rpcs::ReportErrors(rpc::ValidationReport* report__) const {
if (!rpcs.is_valid()) {
rpcs.ReportErrors(&report__->ReportSubobject("rpcs"));
}
+ if (!encryption_required.is_valid()) {
+ encryption_required.ReportErrors(
+ &report__->ReportSubobject("encryption_required"));
+ }
}
void Rpcs::SetPolicyTableType(PolicyTableType pt_type) {
@@ -428,9 +658,60 @@ void Rpcs::SetPolicyTableType(PolicyTableType pt_type) {
rpcs.SetPolicyTableType(pt_type);
}
+// EndpointProperties methods
+EndpointProperty::EndpointProperty() : CompositeType(kUninitialized) {}
+
+EndpointProperty::~EndpointProperty() {}
+
+EndpointProperty::EndpointProperty(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , version(impl::ValueMember(value__, "version")) {}
+
+Json::Value EndpointProperty::ToJsonValue() const {
+ Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("version", version, &result__);
+ return result__;
+}
+
+bool EndpointProperty::is_valid() const {
+ if (!version.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool EndpointProperty::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool EndpointProperty::struct_empty() const {
+ if (version.is_initialized()) {
+ return false;
+ }
+
+ return true;
+}
+
+void EndpointProperty::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!version.is_valid()) {
+ version.ReportErrors(&report__->ReportSubobject("version"));
+ }
+}
+
+void EndpointProperty::SetPolicyTableType(PolicyTableType pt_type) {
+ CompositeType::SetPolicyTableType(pt_type);
+ version.SetPolicyTableType(pt_type);
+}
+
// ModuleConfig methods
ModuleConfig::ModuleConfig() : CompositeType(kUninitialized) {}
+const std::string ModuleConfig::kDefaultOemMappingServiceName =
+ "custom_vehicle_data_mapping_url";
+
ModuleConfig::ModuleConfig(
uint8_t exchange_after_x_ignition_cycles,
int64_t exchange_after_x_kilometers,
@@ -438,6 +719,7 @@ ModuleConfig::ModuleConfig(
uint16_t timeout_after_x_seconds,
const SecondsBetweenRetries& seconds_between_retries,
const ServiceEndpoints& endpoints,
+ const ServiceEndpointProperties& endpoint_properties,
const NumberOfNotificationsPerMinute& notifications_per_minute_by_priority)
: CompositeType(kUninitialized)
, exchange_after_x_ignition_cycles(exchange_after_x_ignition_cycles)
@@ -446,6 +728,7 @@ ModuleConfig::ModuleConfig(
, timeout_after_x_seconds(timeout_after_x_seconds)
, seconds_between_retries(seconds_between_retries)
, endpoints(endpoints)
+ , endpoint_properties(endpoint_properties)
, notifications_per_minute_by_priority(
notifications_per_minute_by_priority) {}
@@ -455,6 +738,7 @@ ModuleConfig::ModuleConfig(const Json::Value* value__)
: CompositeType(InitHelper(value__, &Json::Value::isObject))
, device_certificates(impl::ValueMember(value__, "device_certificates"))
, preloaded_pt(impl::ValueMember(value__, "preloaded_pt"))
+ , full_app_id_supported(impl::ValueMember(value__, "full_app_id_supported"))
, exchange_after_x_ignition_cycles(
impl::ValueMember(value__, "exchange_after_x_ignition_cycles"))
, exchange_after_x_kilometers(
@@ -465,13 +749,16 @@ ModuleConfig::ModuleConfig(const Json::Value* value__)
, seconds_between_retries(
impl::ValueMember(value__, "seconds_between_retries"))
, endpoints(impl::ValueMember(value__, "endpoints"))
+ , endpoint_properties(impl::ValueMember(value__, "endpoint_properties"))
, notifications_per_minute_by_priority(
impl::ValueMember(value__, "notifications_per_minute_by_priority"))
, vehicle_make(impl::ValueMember(value__, "vehicle_make"))
, vehicle_model(impl::ValueMember(value__, "vehicle_model"))
, vehicle_year(impl::ValueMember(value__, "vehicle_year"))
, preloaded_date(impl::ValueMember(value__, "preloaded_date"))
- , certificate(impl::ValueMember(value__, "certificate")) {}
+ , certificate(impl::ValueMember(value__, "certificate"))
+ , lock_screen_dismissal_enabled(
+ impl::ValueMember(value__, "lock_screen_dismissal_enabled")) {}
void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
// device_certificates = from.device_certificates; // According to the
@@ -482,9 +769,12 @@ void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
timeout_after_x_seconds = from.timeout_after_x_seconds;
seconds_between_retries = from.seconds_between_retries;
endpoints = from.endpoints;
+ endpoint_properties = from.endpoint_properties;
notifications_per_minute_by_priority =
from.notifications_per_minute_by_priority;
+ lock_screen_dismissal_enabled = from.lock_screen_dismissal_enabled;
+
vehicle_make.assign_if_valid(from.vehicle_make);
vehicle_model.assign_if_valid(from.vehicle_model);
vehicle_year.assign_if_valid(from.vehicle_year);
@@ -494,6 +784,8 @@ void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
Json::Value ModuleConfig::ToJsonValue() const {
Json::Value result__(Json::objectValue);
impl::WriteJsonField("preloaded_pt", preloaded_pt, &result__);
+ impl::WriteJsonField(
+ "full_app_id_supported", full_app_id_supported, &result__);
impl::WriteJsonField("exchange_after_x_ignition_cycles",
exchange_after_x_ignition_cycles,
&result__);
@@ -506,6 +798,7 @@ Json::Value ModuleConfig::ToJsonValue() const {
impl::WriteJsonField(
"seconds_between_retries", seconds_between_retries, &result__);
impl::WriteJsonField("endpoints", endpoints, &result__);
+ impl::WriteJsonField("endpoint_properties", endpoint_properties, &result__);
impl::WriteJsonField("notifications_per_minute_by_priority",
notifications_per_minute_by_priority,
&result__);
@@ -514,6 +807,9 @@ Json::Value ModuleConfig::ToJsonValue() const {
impl::WriteJsonField("vehicle_year", vehicle_year, &result__);
impl::WriteJsonField("certificate", certificate, &result__);
impl::WriteJsonField("preloaded_date", preloaded_date, &result__);
+ impl::WriteJsonField("lock_screen_dismissal_enabled",
+ lock_screen_dismissal_enabled,
+ &result__);
return result__;
}
@@ -521,6 +817,9 @@ bool ModuleConfig::is_valid() const {
if (!preloaded_pt.is_valid()) {
return false;
}
+ if (!full_app_id_supported.is_valid()) {
+ return false;
+ }
if (!exchange_after_x_ignition_cycles.is_valid()) {
return false;
}
@@ -539,9 +838,15 @@ bool ModuleConfig::is_valid() const {
if (!endpoints.is_valid()) {
return false;
}
+ if (!endpoint_properties.is_valid()) {
+ return false;
+ }
if (!notifications_per_minute_by_priority.is_valid()) {
return false;
}
+ if (!lock_screen_dismissal_enabled.is_valid()) {
+ return false;
+ }
if (!vehicle_make.is_valid()) {
return false;
}
@@ -568,6 +873,9 @@ bool ModuleConfig::struct_empty() const {
if (preloaded_pt.is_initialized()) {
return false;
}
+ if (full_app_id_supported.is_initialized()) {
+ return false;
+ }
if (exchange_after_x_ignition_cycles.is_initialized()) {
return false;
@@ -586,13 +894,21 @@ bool ModuleConfig::struct_empty() const {
if (seconds_between_retries.is_initialized()) {
return false;
}
+
if (endpoints.is_initialized()) {
return false;
}
+ if (endpoint_properties.is_initialized()) {
+ return false;
+ }
+
if (notifications_per_minute_by_priority.is_initialized()) {
return false;
}
+ if (lock_screen_dismissal_enabled.is_initialized()) {
+ return false;
+ }
if (vehicle_make.is_initialized()) {
return false;
}
@@ -617,6 +933,10 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const {
if (!preloaded_pt.is_valid()) {
preloaded_pt.ReportErrors(&report__->ReportSubobject("preloaded_pt"));
}
+ if (!full_app_id_supported.is_valid()) {
+ full_app_id_supported.ReportErrors(
+ &report__->ReportSubobject("full_app_id_supported"));
+ }
if (!exchange_after_x_ignition_cycles.is_valid()) {
exchange_after_x_ignition_cycles.ReportErrors(
&report__->ReportSubobject("exchange_after_x_ignition_cycles"));
@@ -640,10 +960,18 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const {
if (!endpoints.is_valid()) {
endpoints.ReportErrors(&report__->ReportSubobject("endpoints"));
}
+ if (!endpoint_properties.is_valid()) {
+ endpoint_properties.ReportErrors(
+ &report__->ReportSubobject("endpoint_properties"));
+ }
if (!notifications_per_minute_by_priority.is_valid()) {
notifications_per_minute_by_priority.ReportErrors(
&report__->ReportSubobject("notifications_per_minute_by_priority"));
}
+ if (!lock_screen_dismissal_enabled.is_valid()) {
+ lock_screen_dismissal_enabled.ReportErrors(
+ &report__->ReportSubobject("lock_screen_dismissal_enabled"));
+ }
if (!vehicle_make.is_valid()) {
vehicle_make.ReportErrors(&report__->ReportSubobject("vehicle_make"));
}
@@ -675,13 +1003,16 @@ void ModuleConfig::ReportErrors(rpc::ValidationReport* report__) const {
void ModuleConfig::SetPolicyTableType(PolicyTableType pt_type) {
CompositeType::SetPolicyTableType(pt_type);
preloaded_pt.SetPolicyTableType(pt_type);
+ full_app_id_supported.SetPolicyTableType(pt_type);
exchange_after_x_ignition_cycles.SetPolicyTableType(pt_type);
exchange_after_x_kilometers.SetPolicyTableType(pt_type);
exchange_after_x_days.SetPolicyTableType(pt_type);
timeout_after_x_seconds.SetPolicyTableType(pt_type);
seconds_between_retries.SetPolicyTableType(pt_type);
endpoints.SetPolicyTableType(pt_type);
+ endpoint_properties.SetPolicyTableType(pt_type);
notifications_per_minute_by_priority.SetPolicyTableType(pt_type);
+ lock_screen_dismissal_enabled.SetPolicyTableType(pt_type);
vehicle_make.SetPolicyTableType(pt_type);
vehicle_model.SetPolicyTableType(pt_type);
vehicle_year.SetPolicyTableType(pt_type);
@@ -1301,6 +1632,414 @@ void DeviceParams::ReportErrors(rpc::ValidationReport* report__) const {
}
}
+// VehicleDataItem methods
+VehicleDataItem::VehicleDataItem() : CompositeType(kUninitialized) {}
+
+VehicleDataItem::VehicleDataItem(const VehicleDataItem& vehicle_data)
+ : CompositeType(vehicle_data.initialization_state__)
+ , name(vehicle_data.name)
+ , type(vehicle_data.type)
+ , key(vehicle_data.key)
+ , mandatory(vehicle_data.mandatory)
+ , params(vehicle_data.params)
+ , array(vehicle_data.array)
+ , since(vehicle_data.since)
+ , until(vehicle_data.until)
+ , removed(vehicle_data.removed)
+ , deprecated(vehicle_data.deprecated)
+ , minvalue(vehicle_data.minvalue)
+ , maxvalue(vehicle_data.maxvalue)
+ , minsize(vehicle_data.minsize)
+ , maxsize(vehicle_data.maxsize)
+ , minlength(vehicle_data.minlength)
+ , maxlength(vehicle_data.maxlength) {}
+
+VehicleDataItem::VehicleDataItem(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , name(impl::ValueMember(value__, "name"))
+ , type(impl::ValueMember(value__, "type"))
+ , key(impl::ValueMember(value__, "key"))
+ , mandatory(impl::ValueMember(value__, "mandatory"))
+ , params(impl::ValueMember(value__, "params"))
+ , array(impl::ValueMember(value__, "array"))
+ , since(impl::ValueMember(value__, "since"))
+ , until(impl::ValueMember(value__, "until"))
+ , removed(impl::ValueMember(value__, "removed"))
+ , deprecated(impl::ValueMember(value__, "deprecated"))
+ , minvalue(impl::ValueMember(value__, "minvalue"))
+ , maxvalue(impl::ValueMember(value__, "maxvalue"))
+ , minsize(impl::ValueMember(value__, "minsize"))
+ , maxsize(impl::ValueMember(value__, "maxsize"))
+ , minlength(impl::ValueMember(value__, "minlength"))
+ , maxlength(impl::ValueMember(value__, "maxlength")) {}
+
+VehicleDataItem::~VehicleDataItem() {}
+
+const std::string VehicleDataItem::kInteger = "Integer";
+const std::string VehicleDataItem::kStruct = "Struct";
+const std::string VehicleDataItem::kString = "String";
+const std::string VehicleDataItem::kFloat = "Float";
+const std::string VehicleDataItem::kDouble = "Double";
+const std::string VehicleDataItem::kBoolean = "Boolean";
+
+const std::vector<std::string> VehicleDataItem::kPODTypes = {
+ kInteger, kFloat, kDouble, kString, kBoolean};
+
+Json::Value VehicleDataItem::ToJsonValue() const {
+ Json::Value ret(Json::objectValue);
+ impl::WriteJsonField("name", name, &ret);
+ impl::WriteJsonField("type", type, &ret);
+ impl::WriteJsonField("key", key, &ret);
+ impl::WriteJsonField("array", array, &ret);
+ impl::WriteJsonField("mandatory", mandatory, &ret);
+ impl::WriteJsonField("params", params, &ret);
+ impl::WriteJsonField("since", since, &ret);
+ impl::WriteJsonField("until", until, &ret);
+ impl::WriteJsonField("removed", removed, &ret);
+ impl::WriteJsonField("deprecated", deprecated, &ret);
+ impl::WriteJsonField("minvalue", minvalue, &ret);
+ impl::WriteJsonField("maxvalue", maxvalue, &ret);
+ impl::WriteJsonField("minsize", minsize, &ret);
+ impl::WriteJsonField("maxsize", maxsize, &ret);
+ impl::WriteJsonField("minlength", minlength, &ret);
+ impl::WriteJsonField("maxlength", maxlength, &ret);
+ return ret;
+}
+
+bool VehicleDataItem::operator==(const VehicleDataItem& vd) {
+ return (name == vd.name && type == vd.type && key == vd.key &&
+ mandatory == vd.mandatory && params == vd.params &&
+ array == vd.array && since == vd.since && until == vd.until &&
+ removed == vd.removed && deprecated == vd.deprecated &&
+ minvalue == vd.minvalue && maxvalue == vd.maxvalue &&
+ minsize == vd.minsize && maxsize == vd.maxsize &&
+ minlength == vd.minlength && maxlength == vd.maxlength);
+}
+
+bool VehicleDataItem::is_valid() const {
+ if (!name.is_valid()) {
+ return false;
+ }
+ if (!type.is_valid()) {
+ return false;
+ }
+ if (!key.is_valid()) {
+ return false;
+ }
+ if (!array.is_valid()) {
+ return false;
+ }
+ if (!mandatory.is_valid()) {
+ return false;
+ }
+ if (!params.is_valid()) {
+ return false;
+ }
+ if (!since.is_valid()) {
+ return false;
+ }
+ if (!until.is_valid()) {
+ return false;
+ }
+ if (!removed.is_valid()) {
+ return false;
+ }
+ if (!deprecated.is_valid()) {
+ return false;
+ }
+ if (!minvalue.is_valid()) {
+ return false;
+ }
+ if (!maxvalue.is_valid()) {
+ return false;
+ }
+ if (!minsize.is_valid()) {
+ return false;
+ }
+ if (!maxsize.is_valid()) {
+ return false;
+ }
+ if (!minlength.is_valid()) {
+ return false;
+ }
+ if (!maxlength.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool VehicleDataItem::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (struct_not_empty());
+}
+
+bool VehicleDataItem::struct_not_empty() const {
+ if (!name.is_initialized()) {
+ return false;
+ }
+ if (!type.is_initialized()) {
+ return false;
+ }
+ if (!key.is_initialized()) {
+ return false;
+ }
+ if (!array.is_initialized()) {
+ return false;
+ }
+ if (!mandatory.is_initialized()) {
+ return false;
+ }
+ if (!params.is_initialized()) {
+ return false;
+ }
+ if (!since.is_initialized()) {
+ return false;
+ }
+ if (!until.is_initialized()) {
+ return false;
+ }
+ if (!removed.is_initialized()) {
+ return false;
+ }
+ if (!deprecated.is_initialized()) {
+ return false;
+ }
+ if (!minvalue.is_initialized()) {
+ return false;
+ }
+ if (!maxvalue.is_initialized()) {
+ return false;
+ }
+ if (!minsize.is_initialized()) {
+ return false;
+ }
+ if (!maxsize.is_initialized()) {
+ return false;
+ }
+ if (!minlength.is_initialized()) {
+ return false;
+ }
+ if (!maxlength.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+void VehicleDataItem::ReportErrors(rpc::ValidationReport* report__) const {
+ if (!struct_not_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ if (!name.is_valid()) {
+ name.ReportErrors(&report__->ReportSubobject("name"));
+ }
+ if (!ValidateNaming(std::string(name))) {
+ report__->set_validation_info(
+ "Invalid name values [" + std::string(name) +
+ "]. It should not contain spaces or invalid chars.");
+ }
+ if (!type.is_valid()) {
+ type.ReportErrors(&report__->ReportSubobject("type"));
+ }
+ if (type.is_initialized() && !ValidateTypes()) {
+ report__->set_validation_info("Unknown type [" + std::string(name) +
+ "]: '" + std::string(type) + "'.");
+ }
+ if (!key.is_valid()) {
+ key.ReportErrors(&report__->ReportSubobject("key"));
+ }
+ if (!ValidateNaming(std::string(key))) {
+ report__->set_validation_info(
+ "Invalid key values [" + std::string(key) +
+ "]. It should not contain spaces or invalid chars.");
+ }
+ if (!array.is_valid()) {
+ array.ReportErrors(&report__->ReportSubobject("array"));
+ }
+ if (!mandatory.is_valid()) {
+ mandatory.ReportErrors(&report__->ReportSubobject("mandatory"));
+ }
+ if (!params.is_valid()) {
+ params.ReportErrors(&report__->ReportSubobject("params"));
+ }
+ if (!since.is_valid()) {
+ since.ReportErrors(&report__->ReportSubobject("since"));
+ }
+ if (!until.is_valid()) {
+ until.ReportErrors(&report__->ReportSubobject("until"));
+ }
+ if (!removed.is_valid()) {
+ removed.ReportErrors(&report__->ReportSubobject("removed"));
+ }
+ if (!deprecated.is_valid()) {
+ deprecated.ReportErrors(&report__->ReportSubobject("deprecated"));
+ }
+ if (!minvalue.is_valid()) {
+ minvalue.ReportErrors(&report__->ReportSubobject("minvalue"));
+ }
+ if (!maxvalue.is_valid()) {
+ maxvalue.ReportErrors(&report__->ReportSubobject("maxvalue"));
+ }
+ if (!minsize.is_valid()) {
+ minsize.ReportErrors(&report__->ReportSubobject("minsize"));
+ }
+ if (!maxsize.is_valid()) {
+ maxsize.ReportErrors(&report__->ReportSubobject("maxsize"));
+ }
+ if (!minlength.is_valid()) {
+ minlength.ReportErrors(&report__->ReportSubobject("minlength"));
+ }
+ if (!maxlength.is_valid()) {
+ maxlength.ReportErrors(&report__->ReportSubobject("maxlength"));
+ }
+}
+
+void VehicleDataItem::SetPolicyTableType(PolicyTableType pt_type) {
+ CompositeType::SetPolicyTableType(pt_type);
+ name.SetPolicyTableType(pt_type);
+ type.SetPolicyTableType(pt_type);
+ key.SetPolicyTableType(pt_type);
+ array.SetPolicyTableType(pt_type);
+ mandatory.SetPolicyTableType(pt_type);
+ params.SetPolicyTableType(pt_type);
+ since.SetPolicyTableType(pt_type);
+ until.SetPolicyTableType(pt_type);
+ removed.SetPolicyTableType(pt_type);
+ deprecated.SetPolicyTableType(pt_type);
+ minvalue.SetPolicyTableType(pt_type);
+ maxvalue.SetPolicyTableType(pt_type);
+ minsize.SetPolicyTableType(pt_type);
+ maxsize.SetPolicyTableType(pt_type);
+ minlength.SetPolicyTableType(pt_type);
+ maxlength.SetPolicyTableType(pt_type);
+}
+
+bool VehicleDataItem::ValidateNaming(std::string str) const {
+ auto contains_spec_chars = [](std::string str) {
+ const auto invalid_chars = "!@#$%^&*";
+ return str.npos != str.find_first_of(invalid_chars);
+ };
+
+ auto contains_spaces = [](std::string str) {
+ const auto found_space =
+ std::find_if(str.begin(), str.end(), [](unsigned char ch) {
+ return std::isspace(ch);
+ });
+
+ return found_space != str.end();
+ };
+
+ auto empty_string = [](std::string str) {
+ str.erase(std::remove_if(str.begin(),
+ str.end(),
+ [](unsigned char ch) { return std::isspace(ch); }),
+ str.end());
+ return str.length() < 1;
+ };
+
+ return !empty_string(str) && !contains_spaces(str) &&
+ !contains_spec_chars(str);
+}
+
+bool VehicleDataItem::ValidateTypes() const {
+ if (VehicleDataItem::kStruct == std::string(type)) {
+ return params.is_initialized() && !(params->empty()) && params.is_valid();
+ }
+ // params should be empty for POD types and for enum values
+ return (!(params.is_initialized()) || params->empty());
+}
+
+bool VehicleDataItem::IsPrimitiveType() const {
+ return helpers::in_range(kPODTypes, std::string(type));
+}
+
+// VehicleData methods
+VehicleData::VehicleData() : CompositeType(kUninitialized) {}
+
+VehicleData::VehicleData(const VehicleData& vehicle_data)
+ : CompositeType(vehicle_data.initialization_state__)
+ , schema_version(vehicle_data.schema_version)
+ , schema_items(vehicle_data.schema_items) {}
+
+VehicleData::VehicleData(const Json::Value* value__)
+ : CompositeType(InitHelper(value__, &Json::Value::isObject))
+ , schema_version(impl::ValueMember(value__, "schema_version"))
+ , schema_items(impl::ValueMember(value__, "schema_items")) {}
+
+VehicleData::~VehicleData() {}
+
+bool VehicleData::is_valid() const {
+ if (!schema_version.is_valid()) {
+ return false;
+ }
+ if (!schema_items.is_valid()) {
+ return false;
+ }
+ return Validate();
+}
+
+bool VehicleData::is_initialized() const {
+ return (initialization_state__ != kUninitialized) || (!struct_empty());
+}
+
+bool VehicleData::struct_empty() const {
+ if (schema_version.is_initialized()) {
+ return false;
+ }
+ if (schema_items.is_initialized()) {
+ return false;
+ }
+ return true;
+}
+
+Json::Value VehicleData::ToJsonValue() const {
+ Json::Value ret(Json::objectValue);
+ impl::WriteJsonField("schema_version", schema_version, &ret);
+ impl::WriteJsonField("schema_items", schema_items, &ret);
+ return ret;
+}
+
+void VehicleData::ReportErrors(rpc::ValidationReport* report__) const {
+ if (struct_empty()) {
+ rpc::CompositeType::ReportErrors(report__);
+ }
+ const auto pt_type = GetPolicyTableType();
+ const auto pt_type_str = PolicyTableTypeToString(pt_type);
+ std::string validation_info = "";
+
+ if (PT_SNAPSHOT == pt_type) {
+ if (schema_items.is_initialized()) {
+ validation_info +=
+ "; schema_items " + omitted_validation_info + pt_type_str;
+ }
+ if (!schema_version.is_initialized()) {
+ validation_info +=
+ "; schema_version " + required_validation_info + pt_type_str;
+ }
+ report__->set_validation_info(validation_info);
+ }
+
+ if (PT_UPDATE == pt_type || PT_PRELOADED == pt_type) {
+ if ((schema_version.is_initialized() && !schema_items.is_initialized()) ||
+ (!schema_version.is_initialized() && schema_items.is_initialized())) {
+ validation_info += "; schema_version and schema_items " +
+ required_validation_info + pt_type_str;
+ }
+ report__->set_validation_info(validation_info);
+ }
+
+ if (!schema_version.is_valid()) {
+ schema_version.ReportErrors(&report__->ReportSubobject("schema_version"));
+ }
+ if (!schema_items.is_valid()) {
+ schema_items.ReportErrors(&report__->ReportSubobject("schema_items"));
+ }
+}
+
+void VehicleData::SetPolicyTableType(PolicyTableType pt_type) {
+ CompositeType::SetPolicyTableType(pt_type);
+ schema_version.SetPolicyTableType(pt_type);
+ schema_items.SetPolicyTableType(pt_type);
+}
+
// PolicyTable methods
PolicyTable::PolicyTable() : CompositeType(kUninitialized) {}
@@ -1327,7 +2066,8 @@ PolicyTable::PolicyTable(const Json::Value* value__)
, module_meta(impl::ValueMember(value__, "module_meta"))
, usage_and_error_counts(
impl::ValueMember(value__, "usage_and_error_counts"))
- , device_data(impl::ValueMember(value__, "device_data")) {}
+ , device_data(impl::ValueMember(value__, "device_data"))
+ , vehicle_data(impl::ValueMember(value__, "vehicle_data")) {}
Json::Value PolicyTable::ToJsonValue() const {
Json::Value result__(Json::objectValue);
@@ -1340,6 +2080,7 @@ Json::Value PolicyTable::ToJsonValue() const {
impl::WriteJsonField(
"usage_and_error_counts", usage_and_error_counts, &result__);
impl::WriteJsonField("device_data", device_data, &result__);
+ impl::WriteJsonField("vehicle_data", vehicle_data, &result__);
return result__;
}
@@ -1365,6 +2106,9 @@ bool PolicyTable::is_valid() const {
if (!device_data.is_valid()) {
return false;
}
+ if (!vehicle_data.is_valid()) {
+ return false;
+ }
return Validate();
}
@@ -1397,6 +2141,9 @@ bool PolicyTable::struct_empty() const {
if (device_data.is_initialized()) {
return false;
}
+ if (vehicle_data.is_initialized()) {
+ return false;
+ }
return true;
}
@@ -1439,6 +2186,9 @@ void PolicyTable::ReportErrors(rpc::ValidationReport* report__) const {
if (!device_data.is_valid()) {
device_data.ReportErrors(&report__->ReportSubobject("device_data"));
}
+ if (!vehicle_data.is_valid()) {
+ vehicle_data.ReportErrors(&report__->ReportSubobject("vehicle_data"));
+ }
}
void PolicyTable::SetPolicyTableType(PolicyTableType pt_type) {
@@ -1450,6 +2200,7 @@ void PolicyTable::SetPolicyTableType(PolicyTableType pt_type) {
module_meta.SetPolicyTableType(pt_type);
usage_and_error_counts.SetPolicyTableType(pt_type);
device_data.SetPolicyTableType(pt_type);
+ vehicle_data.SetPolicyTableType(pt_type);
}
// Table methods
diff --git a/src/components/policy/policy_regular/src/policy_table/validation.cc b/src/components/policy/policy_regular/src/policy_table/validation.cc
index 714dfaae5a..14b6d657c2 100644
--- a/src/components/policy/policy_regular/src/policy_table/validation.cc
+++ b/src/components/policy/policy_regular/src/policy_table/validation.cc
@@ -7,7 +7,7 @@ bool IsTypeInvalid(
rpc::Enum<rpc::policy_table_interface_base::RequestType> request) {
return !request.is_valid();
}
-}
+} // namespace
namespace rpc {
namespace policy_table_interface_base {
@@ -177,6 +177,14 @@ bool ApplicationParams::ValidateModuleTypes() const {
return true;
}
+bool AppServiceHandledRpc::Validate() const {
+ return true;
+}
+
+bool AppServiceInfo::Validate() const {
+ return true;
+}
+
bool ApplicationParams::Validate() const {
return ValidateModuleTypes();
}
@@ -188,6 +196,14 @@ bool Rpcs::Validate() const {
return true;
}
+bool EndpointProperty::Validate() const {
+ if (!version.is_valid()) {
+ return false;
+ }
+
+ return true;
+}
+
bool ModuleConfig::Validate() const {
if (PT_PRELOADED == GetPolicyTableType()) {
if (vehicle_make.is_initialized()) {
@@ -213,6 +229,14 @@ bool ModuleConfig::Validate() const {
}
}
+ if (endpoint_properties.is_initialized()) {
+ const auto& endpoint_property =
+ endpoint_properties->find(kDefaultOemMappingServiceName);
+ if (endpoint_properties->end() != endpoint_property) {
+ return (*endpoint_property).second.version.is_initialized();
+ }
+ }
+
return true;
}
@@ -260,6 +284,39 @@ bool DeviceParams::Validate() const {
return true;
}
+bool VehicleDataItem::Validate() const {
+ if (!ValidateNaming(std::string(name))) {
+ return false;
+ };
+
+ if (!ValidateNaming(std::string(key))) {
+ return false;
+ };
+
+ if (!ValidateTypes()) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Unknown type: " << std::string(type) << " of " << std::string(key));
+ return false;
+ }
+ return true;
+}
+
+bool VehicleData::Validate() const {
+ const PolicyTableType policy_table_type = GetPolicyTableType();
+ bool result = true;
+ if (PT_SNAPSHOT == policy_table_type) {
+ result =
+ (!schema_items.is_initialized()) && schema_version.is_initialized();
+ }
+ if (PT_UPDATE == policy_table_type || PT_PRELOADED == policy_table_type) {
+ result =
+ (schema_version.is_initialized() && schema_items.is_initialized()) ||
+ (!schema_version.is_initialized() && !schema_items.is_initialized());
+ }
+ return result;
+}
+
bool PolicyTable::Validate() const {
const PolicyTableType policy_table_type = GetPolicyTableType();
diff --git a/src/components/policy/policy_regular/src/sql_pt_ext_queries.cc b/src/components/policy/policy_regular/src/sql_pt_ext_queries.cc
deleted file mode 100644
index 3fde462a32..0000000000
--- a/src/components/policy/policy_regular/src/sql_pt_ext_queries.cc
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- Copyright (c) 2013, " Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, " with or without
- modification, " are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, " this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice, "
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, " INCLUDING, " BUT NOT LIMITED TO, " THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, " INDIRECT, " INCIDENTAL, " SPECIAL, " EXEMPLARY, " OR
- CONSEQUENTIAL DAMAGES (INCLUDING, " BUT NOT LIMITED TO, " PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, " DATA, " OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, " WHETHER IN
- CONTRACT, " STRICT LIABILITY, " OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, " EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "policy/sql_pt_ext_queries.h"
-
-namespace policy {
-namespace sql_pt_ext {
-
-const std::string kSelectKeepContext =
- "SELECT `keep_context` FROM `application` WHERE `id` = ? LIMIT 1";
-
-const std::string kSelectStealFocus =
- "SELECT `steal_focus` FROM `application` WHERE `id` = ? LIMIT 1";
-
-const std::string kSelectDefaultHmi =
- "SELECT `default_hmi` FROM `application` WHERE `id` = ? LIMIT 1";
-
-const std::string kResetDeviceConsents = "DELETE FROM `device_consent_group`";
-
-const std::string kResetAppConsents = "DELETE FROM `consent_group`";
-
-const std::string kCountDeviceConsentGroup =
- "SELECT COUNT (`device_id`) "
- "FROM `device_consent_group` WHERE `device_id` = ?";
-
-const std::string kCountDevice =
- "SELECT COUNT (`id`) "
- "FROM `device` WHERE `id` = ?";
-
-const std::string kSelectDeviceConsentedGroup =
- "SELECT * FROM `device_consent_group` WHERE `device_id` = ?";
-
-const std::string kUpdateDeviceConsentedGroup =
- "UPDATE `device_consent_group` SET `is_consented` = ?, `input` = ? WHERE "
- "(`device_id` = ? AND `functional_group_id` = ?)";
-
-const std::string kUpdateDevice =
- "UPDATE `device` SET `hardware` = ?, `firmware_rev` = ?, `os` = ?, "
- "`os_version` = ?, `carrier` = ?, `max_number_rfcom_ports` = ?, "
- " `connection_type` = ? WHERE `id` = ? ";
-
-const std::string kInsertDeviceConsentedGroup =
- "INSERT OR REPLACE INTO `device_consent_group` "
- "(`device_id`, `functional_group_id`, `is_consented`, `input`, "
- "`time_stamp`) "
- "VALUES (?,?,?,?,?)";
-
-const std::string kInsertDevice =
- "INSERT OR IGNORE INTO `device` "
- "(`id`, `hardware`, `firmware_rev`, `os`, `os_version`, `carrier`,"
- "`max_number_rfcom_ports`, `connection_type`) "
- "VALUES (?,?,?,?,?,?,?,?)";
-
-const std::string kSelectDeviceData = "SELECT * FROM `device`";
-
-const std::string kSelectConsentGroup =
- "SELECT * FROM `consent_group` WHERE `device_id` = ? ";
-
-const std::string kInsertPreconsentedGroups =
- "INSERT INTO `preconsented_group` (`application_id`, `functional_group_id`)"
- " SELECT ?, `id` FROM `functional_group` WHERE `name` = ? LIMIT 1";
-
-const std::string kSelectPreconsentedGroups =
- "SELECT `f`.`name` FROM `preconsented_group` AS `p`"
- " LEFT JOIN `functional_group` AS `f` "
- " ON (`f`.`id` = `p`.`functional_group_id`)"
- " WHERE `p`.`application_id` = ?";
-
-const std::string kDeletePreconsentedGroups =
- "DELETE FROM `preconsented_group`";
-
-const std::string kSelectUsageAndErrorCount =
- "SELECT `count_of_iap_buffer_full`, `count_sync_out_of_memory`, "
- " `count_of_sync_reboots` "
- "FROM `usage_and_error_count` LIMIT 1";
-
-const std::string kSelectAppLevels =
- "SELECT `application_id`, `minutes_in_hmi_full`, `minutes_in_hmi_limited`, "
- " `minutes_in_hmi_background`, `minutes_in_hmi_none`, "
- " `count_of_user_selections`, "
- " `count_of_rejections_sync_out_of_memory`, "
- " `count_of_rejections_nickname_mismatch`, "
- " `count_of_rejections_duplicate_name`, "
- " `count_of_rejected_rpcs_calls`, "
- " `count_of_rpcs_sent_in_hmi_none`, "
- " `count_of_removals_for_bad_behavior`, "
- " `count_of_run_attempts_while_revoked`, "
- " `app_registration_language_gui`, "
- " `app_registration_language_vui`, "
- " `count_of_tls_errors` "
- "FROM `app_level`";
-
-const std::string kUpdateGlobalCounters =
- "UPDATE `usage_and_error_count` SET "
- "`count_of_iap_buffer_full` = ?, "
- "`count_sync_out_of_memory` = ?, "
- "`count_of_sync_reboots` = ? ";
-
-const std::string kInsertDeviceData =
- "INSERT OR IGNORE INTO `device` "
- "(`id`, `hardware`, `firmware_rev`, `os`, `os_version`, `carrier`, "
- "`max_number_rfcom_ports`,`connection_type`) VALUES (?,?,?,?,?,?,?,?) ";
-
-const std::string kInsertConsentGroups =
- "INSERT OR REPLACE INTO `consent_group` "
- "(`device_id`, `application_id`, `functional_group_id`, `is_consented`, "
- "`input`, `time_stamp`) "
- "VALUES (?,?,?,?,?,?)";
-
-const std::string kDeleteAppGroupConsent =
- "DELETE FROM `consent_group` WHERE "
- "`application_id` = ? AND `functional_group_id` = ? ";
-
-const std::string kSelectGroupId =
- "SELECT `id` FROM `functional_group` WHERE `name` = ? ";
-
-const std::string kCountUnconsentedGroups =
- "SELECT COUNT(`a`.`functional_group_id`) FROM `app_group` AS `a` "
- " WHERE `a`.`application_id` = ? AND NOT EXISTS "
- " (SELECT NULL FROM `preconsented_group` AS `p` WHERE "
- " (`p`.`functional_group_id` = `a`.`functional_group_id` AND "
- " `p`.`application_id` = `a`.`application_id`)) "
- " AND NOT EXISTS (SELECT NULL FROM `consent_group` AS `c` "
- " WHERE (`c`.`application_id` = `a`.`application_id` "
- " AND `c`.`functional_group_id` = `a`.`functional_group_id` "
- " AND `c`.`device_id` = ?)) AND NOT EXISTS "
- " (SELECT NULL FROM `app_group` AS `def` WHERE "
- " (`def`.`application_id` = ? OR "
- " `def`.`application_id` = ?) "
- " AND `def`.`functional_group_id` = `a`.`functional_group_id`)"
- " AND NOT EXISTS (SELECT NULL FROM `functional_group` AS `f` "
- " WHERE (`a`.`functional_group_id` = `f`.`id`"
- " AND`f`.`user_consent_prompt` IS NULL))";
-
-const std::string kSelectModuleMeta = "SELECT* FROM `module_meta`";
-
-const std::string kUpdateMetaParams =
- "UPDATE `module_meta` SET "
- "`ccpu_version` = ?, `wers_country_code` = ?, `language` = ? ";
-
-const std::string kUpdateModuleMetaVinParam =
- "UPDATE `module_meta` SET `vin` = ? ";
-
-const std::string kSaveModuleMeta =
- "UPDATE `module_meta` SET `ccpu_version` = ?, `language` = ?,"
- "`wers_country_code` = ?, `pt_exchanged_at_odometer_x` = ?,"
- "`pt_exchanged_x_days_after_epoch` = ?,"
- "`ignition_cycles_since_last_exchange` = ?, `vin` = ?";
-
-const std::string kSelectMetaParams =
- "SELECT `ccpu_version`, "
- "`wers_country_code`, `language` from `module_meta`";
-
-const std::string kUpdateMetaLanguage =
- "UPDATE `module_meta` SET `language` = ? ";
-
-const std::string kCountAppLevel =
- "SELECT COUNT(`application_id`) FROM `app_level`"
- " WHERE `application_id` = ? ";
-
-const std::string kUpdateGroupPermissions =
- "UPDATE `consent_group` "
- "SET `is_consented` = ?, `input` = ? "
- "WHERE(`application_id` = ? AND `functional_group_id` = ? AND `device_id` "
- "= ?) ";
-
-const std::string kInsertApplication =
- "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, `steal_focus`, "
- " `default_hmi`, `priority_value`, `is_revoked`, `memory_kb`, "
- " `heart_beat_timeout_ms`, `certificate`) VALUES( ?, ?, ?, ?, ?, ?, ?, ?, "
- "?) ";
-
-const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
-
-const std::string kSelectFriendlyMsg =
- "SELECT `tts`, `label`, `line1`, `line2`, `textBody` FROM `message` "
- "WHERE `message_type_name` = ? AND `language_code` = ? LIMIT 1";
-
-const std::string kSelectAppGroupsId =
- "SELECT `functional_group_id` "
- "FROM `app_group` WHERE `application_id` = ? ";
-
-const std::string kSelectConsentedGroupsId =
- "SELECT `functional_group_id`, `is_consented` "
- "FROM `consent_group` WHERE(`application_id` = ? AND `device_id` = ?) ";
-
-const std::string kCountAppConsents =
- "SELECT COUNT(*) from `consent_group`"
- "WHERE(`device_id` = ? AND `application_id` = ? AND "
- "`functional_group_id` = ?) ";
-
-const std::string kSelectPreconsentedGroupsId =
- "SELECT `functional_group_id` "
- "FROM `preconsented_group` WHERE `application_id` = ? ";
-
-const std::string kSelectAppPolicies =
- "SELECT `id`, `priority_value`, `default_hmi`, `keep_context`, "
- "`steal_focus`, "
- " `memory_kb`, `heart_beat_timeout_ms`, `certificate` FROM `application`";
-
-const std::string kSelectFunctionalGroupNames =
- "SELECT `id`, `user_consent_prompt`, `name`"
- " FROM `functional_group`";
-
-const std::string kDeleteDeviceConsent =
- "DELETE FROM `device_consent_group` "
- "WHERE `device_id` = ? ";
-
-const std::string kDeleteAppConsent =
- "DELETE FROM `consent_group` "
- "WHERE `device_id` = ? ";
-
-const std::string kSelectApplicationIsPreData =
- "SELECT `is_predata` FROM `application` WHERE `id` = ? ";
-
-const std::string kUpdateIsPredata =
- "UPDATE `application` SET `is_predata` = ? WHERE `id` = ? ";
-
-const std::string kHasAppPreloadedGroups =
- "SELECT COUNT(`a1`.`functional_group_id`) FROM `app_group` "
- " AS `a1` JOIN `app_group` AS `a2` "
- " ON `a1`.`functional_group_id` = `a2`.`functional_group_id` "
- " WHERE `a1`.`application_id` = ? AND `a2`.`application_id` = ? ";
-
-const std::string kUpdateUnpairedDevice =
- "UPDATE `device` SET `unpaired` = ? WHERE `id` = ? ";
-
-const std::string kSelectUnpairedDevices =
- "SELECT `id` FROM `device` WHERE `unpaired` = 1";
-
-const std::string kHasMsgLanguageCode =
- "SELECT COUNT (`id`) FROM message "
- "WHERE `message_type_name` = ? AND `language_code` = ? ";
-
-const std::string kDeletePreconsentedGroupsByApplicationId =
- "DELETE FROM `preconsented_group` WHERE `application_id` = ?";
-
-} // namespace sql_pt_ext
-} // namespace policy
diff --git a/src/components/policy/policy_regular/src/sql_pt_ext_representation.cc b/src/components/policy/policy_regular/src/sql_pt_ext_representation.cc
deleted file mode 100644
index c64efaaede..0000000000
--- a/src/components/policy/policy_regular/src/sql_pt_ext_representation.cc
+++ /dev/null
@@ -1,1807 +0,0 @@
-/*
- Copyright (c) 2015, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-#include <algorithm>
-#include <utility>
-#include "utils/logger.h"
-#include "policy/sql_pt_ext_representation.h"
-#include "policy/sql_wrapper.h"
-#include "policy/sql_pt_queries.h"
-#include "policy/sql_pt_ext_queries.h"
-#include "policy/policy_helper.h"
-#include "policy/cache_manager.h"
-
-namespace policy {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
-
-bool SQLPTExtRepresentation::CanAppKeepContext(const std::string& app_id) {
- utils::dbms::SQLQuery query(db());
- if (query.Prepare(sql_pt_ext::kSelectKeepContext)) {
- query.Bind(0, app_id);
- if (query.Exec()) {
- return query.GetBoolean(0);
- }
- }
- return false;
-}
-
-bool SQLPTExtRepresentation::CanAppStealFocus(const std::string& app_id) {
- utils::dbms::SQLQuery query(db());
- if (query.Prepare(sql_pt_ext::kSelectStealFocus)) {
- query.Bind(0, app_id);
- if (query.Exec()) {
- return query.GetBoolean(0);
- }
- }
- return false;
-}
-
-bool SQLPTExtRepresentation::ResetUserConsent() {
- return ResetDeviceConsents() && ResetAppConsents();
-}
-
-bool SQLPTExtRepresentation::ResetDeviceConsents() {
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kResetDeviceConsents)) {
- LOG4CXX_WARN(logger_, "Incorrect delete statement from device_consents.");
- return false;
- }
- return query.Exec();
-}
-
-bool SQLPTExtRepresentation::ResetAppConsents() {
- return utils::dbms::SQLQuery(db()).Exec(sql_pt_ext::kResetAppConsents);
-}
-
-bool SQLPTExtRepresentation::GetUserPermissionsForDevice(
- const std::string& device_id,
- StringArray* consented_groups,
- StringArray* disallowed_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect select from device consented groups");
- return false;
- }
- query.Bind(0, device_id);
- while (query.Next()) {
- if (query.GetBoolean(2)) {
- if (!consented_groups) {
- continue;
- }
- consented_groups->push_back(query.GetString(1));
- } else {
- if (!disallowed_groups) {
- continue;
- }
- disallowed_groups->push_back(query.GetString(1));
- }
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::GetPermissionsForApp(
- const std::string& device_id,
- const std::string& policy_app_id,
- FunctionalIdType* group_types) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (!group_types) {
- LOG4CXX_WARN(logger_, "Input parameter for group types is null.");
- return false;
- }
- // Get all app groups for specified device and application
- FunctionalGroupIDs all_groups;
- if (!GetAllAppGroups(policy_app_id, all_groups)) {
- return false;
- }
- // Get preconsented group
- FunctionalGroupIDs preconsented_groups;
- if (!GetPreconsentedGroups(policy_app_id, preconsented_groups)) {
- return false;
- }
- // Get consented (allowed/disallowed) groups
- FunctionalGroupIDs allowed_groups;
- FunctionalGroupIDs disallowed_groups;
- if (!GetConsentedGroups(
- policy_app_id, device_id, allowed_groups, disallowed_groups)) {
- return false;
- }
- // Get all default groups
- FunctionalGroupIDs default_groups;
- if (!GetAllAppGroups(kDefaultId, default_groups)) {
- return false;
- }
-
- // Get all pre_DataConsent groups
- FunctionalGroupIDs predataconsented_groups;
- if (!GetAllAppGroups(kPreDataConsentId, predataconsented_groups)) {
- return false;
- }
-
- // Get all device groups
- FunctionalGroupIDs device_groups;
- if (!GetAllAppGroups(kDeviceId, device_groups)) {
- return false;
- }
-
- (*group_types)[kTypeDefault] = default_groups;
- (*group_types)[kTypeAllowed] = allowed_groups;
- (*group_types)[kTypeDisallowed] = disallowed_groups;
- (*group_types)[kTypePreconsented] = preconsented_groups;
- (*group_types)[kTypeGeneral] = all_groups;
- (*group_types)[kTypePreDataConsented] = predataconsented_groups;
- (*group_types)[kTypeDevice] = device_groups;
-
- return true;
-}
-
-bool SQLPTExtRepresentation::GetDeviceGroupsFromPolicies(
- policy_table::Strings* groups, policy_table::Strings* preconsented_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (groups) {
- GatherAppGroup(kDeviceId, groups);
- }
- if (preconsented_groups) {
- GatherPreconsentedGroup(kDeviceId, preconsented_groups);
- }
- return true;
-}
-
-bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id,
- const std::string& hardware,
- const std::string& firmware,
- const std::string& os,
- const std::string& os_version,
- const std::string& carrier,
- const uint32_t number_of_ports,
- const std::string& connection_type) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery count_query(db());
- if (!count_query.Prepare(sql_pt_ext::kCountDevice)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for count of device.");
- return false;
- }
-
- count_query.Bind(0, device_id);
-
- if (!count_query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect count of device.");
- return false;
- }
-
- bool update = count_query.GetInteger(0);
-
- // Update old value
- if (update) {
- utils::dbms::SQLQuery update_query(db());
- if (!update_query.Prepare(sql_pt_ext::kUpdateDevice)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for udpate device.");
- return false;
- }
-
- update_query.Bind(0, hardware);
- update_query.Bind(1, firmware);
- update_query.Bind(2, os);
- update_query.Bind(3, os_version);
- update_query.Bind(4, carrier);
- update_query.Bind(5, static_cast<int>(number_of_ports));
- update_query.Bind(6, device_id);
- update_query.Bind(7, connection_type);
-
- if (!update_query.Exec() || !update_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect update for device.");
- return false;
- }
-
- return true;
- }
-
- // Insert new data
- utils::dbms::SQLQuery insert_query(db());
- if (!insert_query.Prepare(sql_pt_ext::kInsertDevice)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for device.");
- return false;
- }
-
- insert_query.Bind(0, device_id);
- insert_query.Bind(1, hardware);
- insert_query.Bind(2, firmware);
- insert_query.Bind(3, os);
- insert_query.Bind(4, os_version);
- insert_query.Bind(5, carrier);
- insert_query.Bind(6, static_cast<int>(number_of_ports));
- insert_query.Bind(7, connection_type);
-
- if (!insert_query.Exec() || !insert_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert to device.");
- return false;
- }
-
- SetPreloaded(false);
-
- return true;
-}
-
-bool SQLPTExtRepresentation::SetUserPermissionsForDevice(
- const std::string& device_id,
- const StringArray& consented_groups,
- const StringArray& disallowed_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery count_query(db());
- if (!count_query.Prepare(sql_pt_ext::kCountDeviceConsentGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect count of device consented groups");
- return false;
- }
-
- count_query.Bind(0, device_id);
-
- if (!count_query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed count of device consented groups");
- return false;
- }
-
- bool update = count_query.GetInteger(0);
-
- // TODO(AOleynik): Split to several methods?
- utils::dbms::SQLQuery query(db());
- // Update old values
- if (update) {
- if (!query.Prepare(sql_pt_ext::kUpdateDeviceConsentedGroup)) {
- LOG4CXX_WARN(
- logger_,
- "Incorrect statement for updating consented groups on device");
- return false;
- }
-
- StringArray::const_iterator it_consented_groups = consented_groups.begin();
- StringArray::const_iterator it_consented_groups_end =
- consented_groups.end();
- for (; it_consented_groups != it_consented_groups_end;
- ++it_consented_groups) {
- query.Bind(0, true);
- query.Bind(1, std::string("GUI"));
- query.Bind(2, device_id);
- query.Bind(3, *it_consented_groups);
- // TODO(AOleynik): Get this info from external data
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Failed update of device allowed consented groups.");
- return false;
- }
- }
-
- StringArray::const_iterator it_disallowed_groups =
- disallowed_groups.begin();
- StringArray::const_iterator it_disallowed_groups_end =
- disallowed_groups.end();
- for (; it_disallowed_groups != it_disallowed_groups_end;
- ++it_disallowed_groups) {
- query.Bind(0, false);
- query.Bind(1);
- query.Bind(2, device_id);
- query.Bind(3, *it_disallowed_groups);
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Failed update of device disallowed consented groups.");
- return false;
- }
- }
-
- return true;
- }
-
- // Insert new values
- if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) {
- LOG4CXX_WARN(logger_,
- "Incorrect statement of inserting to device consented groups");
- return false;
- }
-
- StringArray::const_iterator it_consented_groups = consented_groups.begin();
- StringArray::const_iterator it_consented_groups_end = consented_groups.end();
- for (; it_consented_groups != it_consented_groups_end;
- ++it_consented_groups) {
- query.Bind(0, device_id);
- query.Bind(1, *it_consented_groups);
- query.Bind(2, true);
- // TODO(AOleynik): Get this info from external data
- query.Bind(3, std::string("GUI"));
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Failed insert to device allowed consented groups.");
- return false;
- }
- }
-
- StringArray::const_iterator it_disallowed_groups = disallowed_groups.begin();
- StringArray::const_iterator it_disallowed_groups_end =
- disallowed_groups.end();
- for (; it_disallowed_groups != it_disallowed_groups_end;
- ++it_disallowed_groups) {
- query.Bind(0, device_id);
- query.Bind(1, *it_disallowed_groups);
- query.Bind(2, false);
- query.Bind(3);
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Failed insert to device disallowed consented groups.");
- return false;
- }
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp(
- const std::string& app_id, bool is_device_allowed) {
- bool result = true;
- if (is_device_allowed) {
- // If app has pre_DataConsented groups it should be 'promoted' to default
- // If app has only pre_DataConsented flag it should be only set to false and
- // all groups get restored automatically
- if (IsPredataPolicy(app_id)) {
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kHasAppPreloadedGroups)) {
- LOG4CXX_WARN(logger_,
- "Incorrect statement for has app preloaded groups");
- return false;
- }
- query.Bind(0, app_id);
- query.Bind(1, kPreDataConsentId);
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_,
- "Incorrect select for app has predataconsted groups");
- return false;
- }
- if (query.GetInteger(0) > 0) {
- result = result && SetDefaultPolicy(app_id);
- } else {
- result = result && SetIsPredata(app_id, false);
- }
- }
- } else {
- // If app has default groups change them to pre_DataConsented
- // If app has 'normal' groups leave them as is and set
- // pre_DataConsented flag to true.
- if (IsDefaultPolicy(app_id)) {
- result = result && SetPredataPolicy(app_id);
- } else {
- result = result && SetIsPredata(app_id, true);
- }
- }
- return result;
-}
-
-bool SQLPTExtRepresentation::SetUserPermissionsForApp(
- const PermissionConsent& permissions) {
- LOG4CXX_AUTO_TRACE(logger_);
- // TODO(AOleynik): Handle situation, when no application was specified, i.e.
- // general permissions were set
- std::vector<FunctionalGroupPermission>::const_iterator it =
- permissions.group_permissions.begin();
- std::vector<FunctionalGroupPermission>::const_iterator it_end =
- permissions.group_permissions.end();
-
- utils::dbms::SQLQuery query(db());
- for (; it != it_end; ++it) {
- utils::dbms::SQLQuery counter(db());
- if (!counter.Prepare(sql_pt_ext::kCountAppConsents)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for consent group count.");
- return false;
- }
-
- counter.Bind(0, permissions.device_id);
- counter.Bind(1, permissions.policy_app_id);
- counter.Bind(2, static_cast<int>((*it).group_id));
- if (!counter.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrent count on consent groups.");
- return false;
- }
-
- bool update_required = counter.GetInteger(0);
-
- // Update already present consent record
- if (update_required) {
- if (!query.Prepare(sql_pt_ext::kUpdateGroupPermissions)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for update consent groups.");
- return false;
- }
-
- // Skip consent saving, if user didn't choose any state
- if (policy::kGroupUndefined == (*it).state) {
- continue;
- }
- query.Bind(0, (*it).state == kGroupAllowed ? 1 : 0);
- query.Bind(1, permissions.consent_source);
- query.Bind(2, permissions.policy_app_id);
- query.Bind(3, static_cast<int>((*it).group_id));
- query.Bind(4, permissions.device_id);
-
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Incorrect update on user defined permissions "
- "for app groups.");
- return false;
- }
- continue;
- }
-
- // Insert new consent record
- if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) {
- LOG4CXX_WARN(logger_,
- "Incorrect statement for update app group permissions.");
- return false;
- }
-
- // Skip consent saving, if user didn't choose any state
- if (policy::kGroupUndefined == (*it).state) {
- continue;
- }
- query.Bind(0, permissions.device_id);
- query.Bind(1, permissions.policy_app_id);
- query.Bind(2, static_cast<int>((*it).group_id));
- query.Bind(3, (*it).state == kGroupAllowed ? 1 : 0);
- query.Bind(4, permissions.consent_source);
-
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert to user defined permissions "
- "for app groups.");
- return false;
- }
- continue;
- }
- return true;
-}
-
-std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg(
- const std::vector<std::string>& msg_codes, const std::string& language) {
- utils::dbms::SQLQuery query(db());
- std::vector<UserFriendlyMessage> result;
- if (!query.Prepare(sql_pt_ext::kSelectFriendlyMsg)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages.");
- return result;
- }
-
- const std::string fallback_language = "en-us";
- std::vector<std::string>::const_iterator it = msg_codes.begin();
- std::vector<std::string>::const_iterator it_end = msg_codes.end();
- for (; it != it_end; ++it) {
- std::string msg_language = language;
- // If message has no records with required language, fallback language
- // should be used instead.
- if (!IsMsgLanguagePresent((*it), language)) {
- msg_language = fallback_language;
- }
- query.Bind(0, *it);
- query.Bind(1, msg_language);
-
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect select from friendly messages.");
- return result;
- }
-
- UserFriendlyMessage msg;
-
- msg.message_code = *it;
- msg.tts = query.GetString(0);
- msg.label = query.GetString(1);
- msg.line1 = query.GetString(2);
- msg.line2 = query.GetString(3);
- msg.text_body = query.GetString(4);
-
- result.push_back(msg);
-
- if (!query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Failed reset statement for selecting friendly "
- "messages.");
- return result;
- }
- }
-
- return result;
-}
-
-bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages(
- policy_table::ConsumerFriendlyMessages* messages) const {
- if (NULL == messages) {
- LOG4CXX_ERROR(logger_, "NULL pointer has been passed to fill");
- return false;
- }
-
- if (!SQLPTRepresentation::GatherConsumerFriendlyMessages(messages)) {
- return false;
- }
-
- utils::dbms::SQLQuery query(db());
- bool result = query.Prepare(sql_pt_ext::kCollectFriendlyMsg);
-
- if (result) {
- while (query.Next()) {
- UserFriendlyMessage msg;
-
- msg.tts = query.GetString(1);
- msg.label = query.GetString(2);
- msg.line1 = query.GetString(3);
- msg.line2 = query.GetString(4);
- msg.text_body = query.GetString(5);
- msg.message_code = query.GetString(7);
-
- std::string language = query.GetString(6);
-
- *(*messages->messages)[msg.message_code].languages[language].tts =
- msg.tts;
- *(*messages->messages)[msg.message_code].languages[language].label =
- msg.label;
- *(*messages->messages)[msg.message_code].languages[language].line1 =
- msg.line1;
- *(*messages->messages)[msg.message_code].languages[language].line2 =
- msg.line2;
- *(*messages->messages)[msg.message_code].languages[language].textBody =
- msg.text_body;
- }
- } else {
- LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages.");
- }
- return result;
-}
-
-bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version,
- const std::string& wers_country_code,
- const std::string& language) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kUpdateMetaParams)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for insert to module meta.");
- return false;
- }
-
- query.Bind(0, ccpu_version);
- query.Bind(1, wers_country_code);
- query.Bind(2, language);
-
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert to module meta.");
- return false;
- }
- return true;
-}
-
-bool SQLPTExtRepresentation::IsMetaInfoPresent() {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectMetaParams)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for selecting meta info.");
- return false;
- }
-
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect select from module meta.");
- return false;
- }
-
- return !query.IsNull(0) && !query.IsNull(1) && !query.IsNull(2);
-}
-
-bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kUpdateMetaLanguage)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for update meta language.");
- return false;
- }
-
- query.Bind(0, language);
-
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect update for meta language.");
- return false;
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::SaveApplicationPoliciesSection(
- const policy_table::ApplicationPoliciesSection& policies) {
- LOG4CXX_INFO(logger_, "SaveApplicationPolicies ext");
- utils::dbms::SQLQuery query_delete(db());
- if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from app_group.");
- return false;
- }
-
- utils::dbms::SQLQuery query_delete_preconsented(db());
- if (!query_delete_preconsented.Exec(sql_pt_ext::kDeletePreconsentedGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from preconsented_group.");
- return false;
- }
-
- if (!query_delete.Exec(sql_pt::kDeleteApplication)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from application.");
- return false;
- }
-
- if (!query_delete.Exec(sql_pt::kDeleteRequestType)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from request type.");
- return false;
- }
-
- // First, all predefined apps (e.g. default, pre_DataConsent) should be saved,
- // otherwise another app with the predefined permissions can get incorrect
- // permissions
- policy_table::ApplicationPolicies::const_iterator it_default =
- policies.apps.find(kDefaultId);
- if (policies.apps.end() != it_default) {
- if (!SaveSpecificAppPolicy(*it_default)) {
- return false;
- }
- }
- policy_table::ApplicationPolicies::const_iterator it_pre_data_consent =
- policies.apps.find(kPreDataConsentId);
- if (policies.apps.end() != it_pre_data_consent) {
- if (!SaveSpecificAppPolicy(*it_pre_data_consent)) {
- return false;
- }
- }
-
- if (!SaveDevicePolicy(policies.device)) {
- return false;
- }
-
- policy_table::ApplicationPolicies::const_iterator it;
- for (it = policies.apps.begin(); it != policies.apps.end(); ++it) {
- // Skip saving of predefined app, since they should be saved before
- if (IsPredefinedApp(*it)) {
- continue;
- }
- if (!SaveSpecificAppPolicy(*it)) {
- return false;
- }
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
- const policy_table::ApplicationPolicies::value_type& app) {
- if (app.second.is_string()) {
- if (kDefaultId.compare(app.second.get_string()) == 0) {
- if (!SetDefaultPolicy(app.first)) {
- return false;
- }
- if (!SaveRequestType(app.first, *app.second.RequestType)) {
- return false;
- }
- } else if (kPreDataConsentId.compare(app.second.get_string()) == 0) {
- if (!SetPredataPolicy(app.first)) {
- return false;
- }
- if (!SaveRequestType(app.first, *app.second.RequestType)) {
- return false;
- }
- }
-
- // Stop saving other params, since predefined permissions already set
- return true;
- }
-
- SetIsDefault(app.first, false);
- SetIsPredata(app.first, false);
-
- utils::dbms::SQLQuery app_query(db());
- if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement into application.");
- return false;
- }
-
- app_query.Bind(0, app.first);
- app_query.Bind(1, app.second.keep_context);
- app_query.Bind(2, app.second.steal_focus);
- app_query.Bind(
- 3, std::string(policy_table::EnumToJsonString(app.second.default_hmi)));
- app_query.Bind(
- 4, std::string(policy_table::EnumToJsonString(app.second.priority)));
- app_query.Bind(5, app.second.is_null());
- app_query.Bind(6, *app.second.memory_kb);
- app_query.Bind(7, static_cast<int64_t>(*app.second.heart_beat_timeout_ms));
- app.second.certificate.is_initialized()
- ? app_query.Bind(8, *app.second.certificate)
- : app_query.Bind(8, std::string());
-
- if (!app_query.Exec() || !app_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into application.");
- return false;
- }
-
- if (!SaveAppGroup(app.first, app.second.groups)) {
- return false;
- }
- // TODO(IKozyrenko): Check logic if optional container is missing
- if (!SaveNickname(app.first, *app.second.nicknames)) {
- return false;
- }
- // TODO(IKozyrenko): Check logic if optional container is missing
- if (!SaveAppType(app.first, *app.second.AppHMIType)) {
- return false;
- }
- // TODO(IKozyrenko): Check logic if optional container is missing
- if (!SavePreconsentedGroup(app.first, *app.second.preconsented_groups)) {
- return false;
- }
-
- return true;
-}
-
-bool policy::SQLPTExtRepresentation::SaveDevicePolicy(
- const policy_table::DevicePolicy& device) {
- dbms::SQLQuery app_query(db());
- if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement into application (device).");
- return false;
- }
- app_query.Bind(0, kDeviceId);
- app_query.Bind(1, device.keep_context);
- app_query.Bind(2, device.steal_focus);
- app_query.Bind(
- 3, std::string(policy_table::EnumToJsonString(device.default_hmi)));
- app_query.Bind(4,
- std::string(policy_table::EnumToJsonString(device.priority)));
- app_query.Bind(5, false);
- app_query.Bind(6, 0);
- app_query.Bind(7, 0);
- app_query.Bind(8, std::string());
-
- if (!app_query.Exec() || !app_query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into application.");
- return false;
- }
-
- if (!SaveAppGroup(kDeviceId, device.groups)) {
- return false;
- }
- if (!SavePreconsentedGroup(kDeviceId, *device.preconsented_groups)) {
- return false;
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::GatherApplicationPoliciesSection(
- policy_table::ApplicationPoliciesSection* policies) const {
- LOG4CXX_INFO(logger_, "Gather applications policies");
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectAppPolicies)) {
- LOG4CXX_WARN(logger_, "Incorrect select from app_policies");
- return false;
- }
-
- while (query.Next()) {
- rpc::Nullable<policy_table::ApplicationParams> params;
- const std::string& app_id = query.GetString(0);
- if (IsApplicationRevoked(app_id)) {
- params.set_to_null();
- (*policies).apps[app_id] = params;
- continue;
- }
- if (IsDefaultPolicy(app_id)) {
- (*policies).apps[app_id].set_to_string(kDefaultId);
- }
- if (IsPredataPolicy(app_id)) {
- (*policies).apps[app_id].set_to_string(kPreDataConsentId);
- }
- if (kDeviceId == app_id) {
- policy_table::DevicePolicy device_policy;
- policy_table::Priority priority;
- policy_table::EnumFromJsonString(query.GetString(1), &priority);
- device_policy.priority = priority;
- policy_table::HmiLevel hmi;
- policy_table::EnumFromJsonString(query.GetString(2), &hmi);
- device_policy.default_hmi = hmi;
- device_policy.keep_context = query.GetBoolean(3);
- device_policy.steal_focus = query.GetBoolean(4);
- if (!GatherAppGroup(app_id, &device_policy.groups)) {
- return false;
- }
- GatherPreconsentedGroup(app_id, &*device_policy.preconsented_groups);
- (*policies).device = device_policy;
- continue;
- }
- policy_table::Priority priority;
- policy_table::EnumFromJsonString(query.GetString(1), &priority);
- params.priority = priority;
- policy_table::HmiLevel hmi;
- policy_table::EnumFromJsonString(query.GetString(2), &hmi);
- params.default_hmi = hmi;
- params.keep_context = query.GetBoolean(3);
- params.steal_focus = query.GetBoolean(4);
- *params.memory_kb = query.GetInteger(5);
- *params.heart_beat_timeout_ms = query.GetUInteger(6);
- if (!query.IsNull(7)) {
- *params.certificate = query.GetString(7);
- }
- if (!GatherAppGroup(app_id, &params.groups)) {
- return false;
- }
- if (!GatherNickName(app_id, &*params.nicknames)) {
- return false;
- }
- if (!GatherAppType(app_id, &*params.AppHMIType)) {
- return false;
- }
- if (!GatherRequestType(app_id, &*params.RequestType)) {
- return false;
- }
- GatherPreconsentedGroup(app_id, &*params.preconsented_groups);
- (*policies).apps[app_id] = params;
- }
- return true;
-}
-
-void SQLPTExtRepresentation::GatherPreconsentedGroup(
- const std::string& app_id, policy_table::Strings* groups) const {
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect select from preconsented group");
- return;
- }
-
- query.Bind(0, app_id);
- while (query.Next()) {
- groups->push_back(query.GetString(0));
- }
-}
-
-bool SQLPTExtRepresentation::GatherUsageAndErrorCounts(
- policy_table::UsageAndErrorCounts* counts) const {
- LOG4CXX_INFO(logger_, "Gather Usage and Error Counts.");
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectUsageAndErrorCount) || !query.Exec()) {
- LOG4CXX_INFO(logger_, "Failed select from user_and_error_count");
- return false;
- }
-
- *counts->count_of_iap_buffer_full = query.GetInteger(0);
- *counts->count_sync_out_of_memory = query.GetInteger(1);
- *counts->count_of_sync_reboots = query.GetInteger(2);
-
- return GatherAppLevels(&*counts->app_level);
-}
-
-bool SQLPTExtRepresentation::GatherAppLevels(
- policy_table::AppLevels* apps) const {
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectAppLevels)) {
- LOG4CXX_INFO(logger_,
- "Failed select from app_level. SQLError = "
- << query.LastError().text());
- return false;
- }
- while (query.Next()) {
- policy_table::AppLevel level;
- // value of time fields database is seconds
- level.minutes_in_hmi_full = query.GetInteger(1);
- level.minutes_in_hmi_limited = query.GetInteger(2);
- level.minutes_in_hmi_background = query.GetInteger(3);
- level.minutes_in_hmi_none = query.GetInteger(4);
- level.count_of_user_selections = query.GetInteger(5);
- level.count_of_rejections_sync_out_of_memory = query.GetInteger(6);
- level.count_of_rejections_nickname_mismatch = query.GetInteger(7);
- level.count_of_rejections_duplicate_name = query.GetInteger(8);
- level.count_of_rejected_rpc_calls = query.GetInteger(9);
- level.count_of_rpcs_sent_in_hmi_none = query.GetInteger(10);
- level.count_of_removals_for_bad_behavior = query.GetInteger(11);
- level.count_of_run_attempts_while_revoked = query.GetInteger(12);
- level.app_registration_language_gui = query.GetString(13);
- level.app_registration_language_vui = query.GetString(14);
- level.count_of_tls_errors = query.GetInteger(15);
- (*apps)[query.GetString(0)] = level;
- }
-
- return true;
-}
-
-void SQLPTExtRepresentation::GatherDeviceData(
- policy_table::DeviceData* data) const {
- LOG4CXX_INFO(logger_, "Gather device data.");
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectDeviceData)) {
- LOG4CXX_WARN(logger_, "Incorrect select statement for device data.");
- return;
- }
- data->mark_initialized();
- while (query.Next()) {
- policy_table::DeviceParams* specific_device = &(*data)[query.GetString(0)];
- *specific_device->hardware = query.GetString(1);
- *specific_device->firmware_rev = query.GetString(2);
- *specific_device->os = query.GetString(3);
- *specific_device->os_version = query.GetString(4);
- *specific_device->carrier = query.GetString(5);
- *specific_device->max_number_rfcom_ports = query.GetInteger(6);
-
- // TODO(IKozyrenko): Check logic if optional container is missing
- GatherConsentGroup(query.GetString(0),
- &(*specific_device->user_consent_records));
- }
-}
-
-void SQLPTExtRepresentation::GatherConsentGroup(
- const std::string& device_id,
- policy_table::UserConsentRecords* records) const {
- LOG4CXX_INFO(logger_, "Gather consent records.");
- utils::dbms::SQLQuery query(db());
- // Fill data for device
- if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) {
- LOG4CXX_WARN(logger_,
- "Incorrect select statement for device consented groups.");
- return;
- }
-
- query.Bind(0, device_id);
-
- // Fill device_data -> user_consent_records -> "device"
- while (query.Next()) {
- policy_table::ConsentRecords* device_consent_records =
- &(*records)[kDeviceId];
- // TODO(IKozyrenko): Check logic if optional container is missing
- policy_table::ConsentGroups& consent_groups =
- *device_consent_records->consent_groups;
- consent_groups[query.GetString(1)] = query.GetBoolean(2);
- policy_table::Input input;
- policy_table::EnumFromJsonString(query.GetString(3), &input);
- *device_consent_records->input = input;
- *device_consent_records->time_stamp = query.GetString(4);
- }
-
- if (!query.Reset()) {
- return;
- }
-
- // Fill data for applications
- if (!query.Prepare(sql_pt_ext::kSelectConsentGroup)) {
- LOG4CXX_WARN(logger_,
- "Incorrect select statement for app consented groups.");
- return;
- }
-
- query.Bind(0, device_id);
-
- // Fill device_data -> user_consent_records -> <app_id>
- while (query.Next()) {
- policy_table::ConsentRecords* app_consent_records =
- &(*records)[query.GetString(1)];
- // TODO(IKozyrenko): Check logic if optional container is missing
- policy_table::ConsentGroups& consent_groups =
- *app_consent_records->consent_groups;
-
- consent_groups[query.GetString(2)] = query.GetBoolean(3);
- policy_table::Input input;
- policy_table::EnumFromJsonString(query.GetString(4), &input);
- *app_consent_records->input = input;
- *app_consent_records->time_stamp = query.GetString(5);
- }
-}
-
-bool SQLPTExtRepresentation::SaveDeviceData(
- const policy_table::DeviceData& devices) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery drop_device_query(db());
- const std::string drop_device = "DELETE FROM `device`";
- if (!drop_device_query.Exec(drop_device)) {
- LOG4CXX_WARN(logger_, "Could not clear device table.");
- return false;
- }
-
- utils::dbms::SQLQuery drop_device_consents_query(db());
- const std::string drop_device_consents = "DELETE FROM `device_consent_group`";
- if (!drop_device_consents_query.Exec(drop_device_consents)) {
- LOG4CXX_WARN(logger_, "Could not clear device consents.");
- return false;
- }
-
- utils::dbms::SQLQuery drop_user_consents_query(db());
- const std::string drop_user_consents = "DELETE FROM `consent_group`";
- if (!drop_user_consents_query.Exec(drop_user_consents)) {
- LOG4CXX_WARN(logger_, "Could not clear user consents.");
- return false;
- }
-
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kInsertDeviceData)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for device data.");
- return false;
- }
-
- policy_table::DeviceData::const_iterator it = devices.begin();
- policy_table::DeviceData::const_iterator it_end = devices.end();
- for (; it != it_end; ++it) {
- query.Bind(0, it->first);
- query.Bind(1, *(it->second.hardware));
- query.Bind(2, *(it->second.firmware_rev));
- query.Bind(3, *(it->second.os));
- query.Bind(4, *(it->second.os_version));
- query.Bind(5, *(it->second.carrier));
- query.Bind(6, *(it->second.max_number_rfcom_ports));
- query.Bind(7, *(it->second.connection_type));
-
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into device data.");
- return false;
- }
-
- // TODO(IKozyrenko): Check logic if optional container is missing
- if (!SaveConsentGroup(it->first, *it->second.user_consent_records)) {
- return false;
- }
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::SaveConsentGroup(
- const std::string& device_id,
- const policy_table::UserConsentRecords& records) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery query(db());
-
- policy_table::UserConsentRecords::const_iterator it = records.begin();
- policy_table::UserConsentRecords::const_iterator it_end = records.end();
- for (; it != it_end; ++it) {
- // TODO(IKozyrenko): Check logic if optional container is missing
- policy_table::ConsentGroups::const_iterator it_groups =
- it->second.consent_groups->begin();
- policy_table::ConsentGroups::const_iterator it_groups_end =
- it->second.consent_groups->end();
- for (; it_groups != it_groups_end; ++it_groups) {
- if (kDeviceId == it->first) {
- if (!query.Prepare(sql_pt_ext::kInsertDeviceConsentedGroup)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for device consent group.");
- return false;
- }
- query.Bind(0, device_id);
- query.Bind(1, it_groups->first);
- query.Bind(2, it_groups->second);
- query.Bind(
- 3,
- std::string(policy_table::EnumToJsonString(*(it->second.input))));
- query.Bind(4, std::string(*(it->second.time_stamp)));
- LOG4CXX_INFO(logger_,
- "Device:"
- << "time stamp "
- << std::string(*(it->second.time_stamp)) << " group "
- << it_groups->first << " consent "
- << it_groups->second);
- } else {
- if (!query.Prepare(sql_pt_ext::kInsertConsentGroups)) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert statement for consent group.");
- return false;
- }
- query.Bind(0, device_id);
- query.Bind(1, it->first);
- query.Bind(2, it_groups->first);
- query.Bind(3, it_groups->second);
- query.Bind(
- 4,
- std::string(policy_table::EnumToJsonString(*(it->second.input))));
- query.Bind(5, std::string(*(it->second.time_stamp)));
- LOG4CXX_INFO(logger_,
- "Device:"
- << "time stamp "
- << std::string(*(it->second.time_stamp)) << " group "
- << it_groups->first << " consent "
- << it_groups->second);
- }
-
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into consent group.");
- return false;
- }
- }
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::SavePreconsentedGroup(
- const std::string& app_id, const policy_table::Strings& groups) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kInsertPreconsentedGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for preconsented groups");
- return false;
- }
-
- policy_table::Strings::const_iterator it;
- for (it = groups.begin(); it != groups.end(); ++it) {
- query.Bind(0, app_id);
- query.Bind(1, *it);
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into preconsented groups.");
- return false;
- }
- }
-
- return true;
-}
-
-void SQLPTExtRepresentation::GatherModuleMeta(
- policy_table::ModuleMeta* meta) const {
- LOG4CXX_INFO(logger_, "Gather Module Meta Info");
- utils::dbms::SQLQuery query(db());
- if (query.Prepare(sql_pt_ext::kSelectModuleMeta) && query.Next()) {
- *meta->ccpu_version = query.GetString(0);
- *meta->language = query.GetString(1);
- *meta->wers_country_code = query.GetString(2);
- *meta->pt_exchanged_at_odometer_x = query.GetInteger(3);
- *meta->pt_exchanged_x_days_after_epoch = query.GetInteger(4);
- *meta->ignition_cycles_since_last_exchange = query.GetInteger(5);
- *meta->vin = query.GetString(6);
- }
-}
-
-void SQLPTExtRepresentation::Increment(const std::string& type) const {
- utils::dbms::SQLQuery query(db());
- std::string update_counter =
- "UPDATE `usage_and_error_count` SET `" + type + "` = `" + type + "` + 1";
- if (!query.Exec(update_counter)) {
- LOG4CXX_INFO(logger_, "Failed updating global counter");
- }
-}
-
-bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const {
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kCountAppLevel)) {
- LOG4CXX_INFO(logger_, "Incorrect statement of count app_level");
- return false;
- }
- query.Bind(0, app_id);
- if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Failed count app_level");
- return false;
- }
- return query.GetInteger(0) > 0;
-}
-
-bool SQLPTExtRepresentation::GetAllAppGroups(const std::string& policy_app_id,
- FunctionalGroupIDs& all_groups) {
- LOG4CXX_INFO(logger_, "GetAllAppGroups for '" << policy_app_id << "'");
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectAppGroupsId)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for select app groups id.");
- return false;
- }
-
- query.Bind(0, policy_app_id);
-
- while (query.Next()) {
- all_groups.push_back(query.GetInteger(0));
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::GetConsentedGroups(
- const std::string& policy_app_id,
- const std::string& device_id,
- FunctionalGroupIDs& allowed_groups,
- FunctionalGroupIDs& disallowed_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectConsentedGroupsId)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for select consent groups id.");
- return false;
- }
-
- query.Bind(0, policy_app_id);
- query.Bind(1, device_id);
-
- while (query.Next()) {
- if (query.GetBoolean(1)) {
- allowed_groups.push_back(query.GetInteger(0));
- } else {
- disallowed_groups.push_back(query.GetInteger(0));
- }
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::GetPreconsentedGroups(
- const std::string& policy_app_id, FunctionalGroupIDs& preconsented_groups) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroupsId)) {
- LOG4CXX_WARN(logger_,
- "Incorrect statement for select preconsented groups id.");
- return false;
- }
-
- query.Bind(0, policy_app_id);
-
- while (query.Next()) {
- preconsented_groups.push_back(query.GetInteger(0));
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::GetFunctionalGroupNames(
- FunctionalGroupNames& names) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectFunctionalGroupNames)) {
- LOG4CXX_WARN(logger_,
- "Incorrect statement for select functional groups names.");
- return false;
- }
-
- while (query.Next()) {
- // Some of functional grous doesn't have filled user_consent_prompt
- if (query.IsNull(1)) {
- names[query.GetInteger(0)] =
- std::make_pair<std::string, std::string>("", query.GetString(2));
- } else {
- names[query.GetInteger(0)] = std::make_pair<std::string, std::string>(
- query.GetString(1), query.GetString(2));
- }
- }
-
- return true;
-}
-
-void SQLPTExtRepresentation::FillFunctionalGroupPermissions(
- FunctionalGroupIDs& ids,
- FunctionalGroupNames& names,
- GroupConsent state,
- std::vector<FunctionalGroupPermission>& permissions) {
- FunctionalGroupIDs::const_iterator it = ids.begin();
- FunctionalGroupIDs::const_iterator it_end = ids.end();
- for (; it != it_end; ++it) {
- FunctionalGroupPermission current_group;
- current_group.group_id = *it;
- current_group.group_alias = names[*it].first;
- current_group.group_name = names[*it].second;
- current_group.state = state;
- permissions.push_back(current_group);
- }
-}
-
-void SQLPTExtRepresentation::Increment(const std::string& app_id,
- const std::string& type) const {
- utils::dbms::SQLQuery query(db());
- std::string sql_counter;
- if (IsExistAppLevel(app_id)) {
- // update
- sql_counter = "UPDATE `app_level` SET `" + type + "` = `" + type +
- "` + 1 WHERE `application_id` = ?";
- } else {
- // insert
- sql_counter = "INSERT INTO `app_level` (`application_id`, `" + type +
- "`) "
- "VALUES (?, 1)";
- }
- if (!query.Prepare(sql_counter)) {
- LOG4CXX_INFO(logger_, "Incorrect statement of update app counter");
- return;
- }
- query.Bind(0, app_id);
- if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Failed updating app counter");
- }
-}
-
-void SQLPTExtRepresentation::Set(const std::string& app_id,
- const std::string& type,
- const std::string& value) const {
- utils::dbms::SQLQuery query(db());
- std::string sql_info;
- if (IsExistAppLevel(app_id)) {
- // update
- sql_info = "UPDATE `app_level` SET `" + type +
- "` = ? "
- "WHERE `application_id` = ?";
- } else {
- // insert
- sql_info = "INSERT INTO `app_level` (`" + type +
- "`, `application_id`) "
- "VALUES (?, ?)";
- }
- if (!query.Prepare(sql_info)) {
- LOG4CXX_INFO(logger_, "Incorrect statement of update app info");
- return;
- }
- query.Bind(0, value);
- query.Bind(1, app_id);
- if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Failed updating app info");
- }
-}
-
-void SQLPTExtRepresentation::Add(const std::string& app_id,
- const std::string& type,
- int seconds) const {
- utils::dbms::SQLQuery query(db());
- std::string sql_stopwatch;
- if (IsExistAppLevel(app_id)) {
- // update
- sql_stopwatch = "UPDATE `app_level` SET `" + type + "` = `" + type +
- "` + ? WHERE `application_id` = ?";
- } else {
- // insert
- sql_stopwatch = "INSERT INTO `app_level` (`" + type +
- "`, `application_id`) "
- "VALUES (?, ?)";
- }
- if (!query.Prepare(sql_stopwatch)) {
- LOG4CXX_INFO(logger_, "Incorrect statement of update app stopwatch");
- return;
- }
- query.Bind(0, seconds);
- query.Bind(1, app_id);
- if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Failed updating app stopwatch");
- }
-}
-
-bool SQLPTExtRepresentation::GetDefaultHMI(const std::string& policy_app_id,
- std::string* default_hmi) {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectDefaultHmi)) {
- LOG4CXX_INFO(logger_, "Incorrect statement for default hmi.");
- return false;
- }
-
- query.Bind(0, policy_app_id);
-
- if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Error during default hmi getting.");
- return false;
- }
-
- if (query.IsNull(0)) {
- default_hmi->clear();
- return true;
- }
-
- default_hmi->assign(query.GetString(0));
-
- return true;
-}
-
-bool SQLPTExtRepresentation::CountUnconsentedGroups(
- const std::string& policy_app_id,
- const std::string& device_id,
- int* result) const {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kCountUnconsentedGroups)) {
- LOG4CXX_WARN(logger_, "Incorrect select for unconsented groups.");
- return false;
- }
-
- query.Bind(0, policy_app_id);
- query.Bind(1, device_id);
- query.Bind(2, kDefaultId);
- query.Bind(3, kPreDataConsentId);
-
- if (!query.Exec()) {
- LOG4CXX_INFO(logger_, "Error during executing unconsented groups.");
- return false;
- }
- *result = query.GetInteger(0);
- return true;
-}
-
-bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string& message,
- const std::string& language) {
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kHasMsgLanguageCode)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for message language check.");
- return false;
- }
-
- query.Bind(0, message);
- query.Bind(1, language);
-
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed to check message language code.");
- return false;
- }
-
- return query.GetInteger(0) != 0;
-}
-
-bool SQLPTExtRepresentation::SaveMessageString(
- const std::string& type,
- const std::string& lang,
- const policy_table::MessageString& strings) {
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt::kInsertMessageString)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for message.");
- return false;
- }
-
- query.Bind(0, *strings.tts);
- query.Bind(1, *strings.label);
- query.Bind(2, *strings.line1);
- query.Bind(3, *strings.line2);
- query.Bind(4, lang);
- query.Bind(5, type);
- query.Bind(6, *strings.textBody);
-
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into message.");
- return false;
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::SaveUsageAndErrorCounts(
- const policy_table::UsageAndErrorCounts& counts) {
- return SaveAppCounters(*counts.app_level) && SaveGlobalCounters(counts);
-}
-
-bool SQLPTExtRepresentation::SaveModuleMeta(
- const policy_table::ModuleMeta& meta) {
- utils::dbms::SQLQuery query(db());
-
- if (!query.Prepare(sql_pt_ext::kSaveModuleMeta)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for module_meta.");
- return false;
- }
- const int64_t odometer = *(meta.pt_exchanged_at_odometer_x);
-
- query.Bind(0, *(meta.ccpu_version));
- query.Bind(1, *(meta.language));
- query.Bind(2, *(meta.wers_country_code));
- query.Bind(3, odometer);
- query.Bind(4, *(meta.pt_exchanged_x_days_after_epoch));
- query.Bind(5, *(meta.ignition_cycles_since_last_exchange));
- query.Bind(6, *(meta.vin));
-
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect update for module_meta.");
- return false;
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::SaveAppCounters(
- const rpc::policy_table_interface_base::AppLevels& app_levels) {
- utils::dbms::SQLQuery query(db());
- if (!query.Exec(sql_pt::kDeleteAppLevel)) {
- LOG4CXX_WARN(logger_, "Incorrect delete from app level.");
- return false;
- }
- if (!query.Prepare(sql_pt::kInsertAppLevel)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for app level.");
- return false;
- }
-
- policy_table::AppLevels::const_iterator it;
- for (it = app_levels.begin(); it != app_levels.end(); ++it) {
- query.Bind(0, it->first);
- query.Bind(1, it->second.minutes_in_hmi_full);
- query.Bind(2, it->second.minutes_in_hmi_limited);
- query.Bind(3, it->second.minutes_in_hmi_background);
- query.Bind(4, it->second.minutes_in_hmi_none);
- query.Bind(5, it->second.count_of_user_selections);
- query.Bind(6, it->second.count_of_rejections_sync_out_of_memory);
- query.Bind(7, it->second.count_of_rejections_nickname_mismatch);
- query.Bind(8, it->second.count_of_rejections_duplicate_name);
- query.Bind(9, it->second.count_of_rejected_rpc_calls);
- query.Bind(10, it->second.count_of_rpcs_sent_in_hmi_none);
- query.Bind(11, it->second.count_of_removals_for_bad_behavior);
- query.Bind(12, it->second.count_of_run_attempts_while_revoked);
- query.Bind(13, it->second.app_registration_language_gui);
- query.Bind(14, it->second.app_registration_language_vui);
- query.Bind(15, it->second.count_of_tls_errors);
-
- if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into app level.");
- return false;
- }
- }
- return true;
-}
-
-bool SQLPTExtRepresentation::SaveGlobalCounters(
- const rpc::policy_table_interface_base::UsageAndErrorCounts& counts) {
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kUpdateGlobalCounters)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for global counters.");
- return false;
- }
-
- query.Bind(0, *counts.count_of_iap_buffer_full);
- query.Bind(1, *counts.count_sync_out_of_memory);
- query.Bind(2, *counts.count_of_sync_reboots);
-
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into global counters.");
- return false;
- }
-
- return true;
-}
-
-bool SQLPTExtRepresentation::CleanupUnpairedDevices(
- const DeviceIds& device_ids) const {
- LOG4CXX_AUTO_TRACE(logger_);
- utils::dbms::SQLQuery delete_device_query(db());
- if (!delete_device_query.Prepare(sql_pt::kDeleteDevice)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for device delete.");
- return true;
- }
-
- utils::dbms::SQLQuery delete_device_consent_query(db());
- if (!delete_device_consent_query.Prepare(sql_pt_ext::kDeleteDeviceConsent)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for delete device consent.");
- return false;
- }
-
- utils::dbms::SQLQuery delete_app_consent_query(db());
- if (!delete_app_consent_query.Prepare(sql_pt_ext::kDeleteAppConsent)) {
- LOG4CXX_WARN(logger_, "Incorrect statement for delete app consent.");
- return false;
- }
-
- DeviceIds::const_iterator it = device_ids.begin();
- DeviceIds::const_iterator it_end = device_ids.end();
- for (; it != it_end; ++it) {
- delete_device_query.Bind(0, (*it));
- if (!delete_device_query.Exec() || !delete_device_query.Reset()) {
- LOG4CXX_WARN(logger_, "Failed to delete from device");
- return false;
- }
-
- delete_device_consent_query.Bind(0, (*it));
- if (!delete_device_consent_query.Exec() ||
- !delete_device_consent_query.Reset()) {
- LOG4CXX_WARN(logger_, "Failed to delete from device consent.");
- return false;
- }
-
- delete_app_consent_query.Bind(0, (*it));
- if (!delete_app_consent_query.Exec() || !delete_app_consent_query.Reset()) {
- LOG4CXX_WARN(logger_, "Failed to delete from app consent.");
- return false;
- }
- }
- return true;
-}
-
-bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) {
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
- return false;
- }
- query.Bind(0, app_id);
- if (!query.Exec()) {
- LOG4CXX_ERROR(logger_, "Failed deleting from app_group.");
- return false;
- }
-
- if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
- return false;
- }
- query.Bind(0, app_id);
- if (!query.Exec()) {
- LOG4CXX_ERROR(logger_, "Failed deleting from app_group.");
- return false;
- }
-
- if (!CopyApplication(kDefaultId, app_id)) {
- return false;
- }
-
- SetPreloaded(false);
-
- policy_table::Strings default_groups;
- policy_table::Strings default_preconsented_groups;
- GatherAppGroup(kDefaultId, &default_groups);
- GatherPreconsentedGroup(kDefaultId, &default_preconsented_groups);
- if (SaveAppGroup(app_id, default_groups) &&
- SavePreconsentedGroup(app_id, default_preconsented_groups)) {
- return SetIsDefault(app_id, true) && SetIsPredata(app_id, false);
- }
-
- return false;
-}
-
-bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) {
- LOG4CXX_INFO(logger_,
- "SQLPTExtRepresentation::SetPredataPolicy for " << app_id);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
- return false;
- }
- query.Bind(0, app_id);
- if (!query.Exec()) {
- LOG4CXX_ERROR(logger_, "Failed deleting from app_group.");
- return false;
- }
-
- if (!query.Prepare(sql_pt_ext::kDeletePreconsentedGroupsByApplicationId)) {
- LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
- return false;
- }
- query.Bind(0, app_id);
- if (!query.Exec()) {
- LOG4CXX_ERROR(logger_, "Failed deleting from app_group.");
- return false;
- }
-
- if (!CopyApplication(kPreDataConsentId, app_id)) {
- return false;
- }
-
- SetPreloaded(false);
-
- policy_table::Strings predataconsent_groups;
- policy_table::Strings predataconsent_preconsented_groups;
- GatherAppGroup(kPreDataConsentId, &predataconsent_groups);
- GatherPreconsentedGroup(kPreDataConsentId, &predataconsent_groups);
- if (SaveAppGroup(app_id, predataconsent_groups) &&
- SavePreconsentedGroup(app_id, predataconsent_groups)) {
- return SetIsDefault(app_id, false) && SetIsPredata(app_id, true);
- }
- return false;
-}
-
-bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const {
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectApplicationIsPreData)) {
- LOG4CXX_WARN(logger_, "Incorrect select application is pre_dataConsented");
- return false;
- }
-
- query.Bind(0, app_id);
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed select application is pre_dataConsented");
- return false;
- }
- return query.IsNull(0) ? false : query.GetBoolean(0);
-}
-
-bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id,
- bool is_pre_data) {
- LOG4CXX_TRACE(logger_, "Set flag is_predata of application");
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kUpdateIsPredata)) {
- LOG4CXX_WARN(logger_, "Incorect statement for updating is_predata");
- return false;
- }
-
- query.Bind(0, is_pre_data);
- query.Bind(1, app_id);
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed update is_predata");
- return false;
- }
- return true;
-}
-
-bool SQLPTExtRepresentation::SetUnpairedDevice(const std::string& device_id,
- bool unpaired) const {
- LOG4CXX_TRACE(logger_, "Set unpaired device: " << device_id);
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kUpdateUnpairedDevice)) {
- LOG4CXX_WARN(logger_, "Incorect statement for updating unpaired device");
- return false;
- }
-
- query.Bind(0, unpaired);
- query.Bind(1, device_id);
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed update unpaired device");
- return false;
- }
- return true;
-}
-
-bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const {
- LOG4CXX_TRACE(logger_, "Get list of unpaired devices");
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kSelectUnpairedDevices)) {
- LOG4CXX_WARN(logger_, "Incorect statement for selecting unpaired devices");
- return false;
- }
-
- while (query.Next()) {
- device_ids->push_back(query.GetString(0));
- }
- return true;
-}
-
-bool SQLPTExtRepresentation::SetVINValue(const std::string& value) {
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kUpdateModuleMetaVinParam)) {
- LOG4CXX_WARN(logger_, "Incorect statement for updating module_meta params");
- return false;
- }
-
- query.Bind(0, value);
- const bool result = query.Exec();
-
- if (!result) {
- LOG4CXX_WARN(logger_, "Failed update module_meta");
- }
- return result;
-}
-
-bool SQLPTExtRepresentation::RemoveAppConsentForGroup(
- const std::string& policy_app_id,
- const std::string& functional_group_name) const {
- utils::dbms::SQLQuery query_group_id(db());
- if (!query_group_id.Prepare(sql_pt_ext::kSelectGroupId)) {
- LOG4CXX_WARN(logger_, "Incorect statement for select group name.");
- return false;
- }
-
- query_group_id.Bind(0, functional_group_name);
-
- if (!query_group_id.Exec()) {
- LOG4CXX_WARN(logger_, "Failed to select group id.");
- return false;
- }
-
- const int id = query_group_id.GetInteger(0);
-
- utils::dbms::SQLQuery query(db());
- if (!query.Prepare(sql_pt_ext::kDeleteAppGroupConsent)) {
- LOG4CXX_WARN(logger_, "Incorect statement for remove app consent.");
- return false;
- }
-
- query.Bind(0, policy_app_id);
- query.Bind(1, id);
-
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Failed to remove app consent.");
- return false;
- }
-
- return true;
-}
-
-} // namespace policy
diff --git a/src/components/policy/policy_regular/src/sql_pt_queries.cc b/src/components/policy/policy_regular/src/sql_pt_queries.cc
index 91a5573a04..79eee10d43 100644
--- a/src/components/policy/policy_regular/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc
@@ -71,12 +71,14 @@ const std::string kCreateSchema =
" `certificate` TEXT, "
" `vehicle_make` VARCHAR(45), "
" `vehicle_model` VARCHAR(45), "
- " `vehicle_year` VARCHAR(4) "
+ " `vehicle_year` VARCHAR(4), "
+ " `lock_screen_dismissal_enabled` BOOL"
"); "
"CREATE TABLE IF NOT EXISTS `functional_group`( "
" `id` INTEGER PRIMARY KEY NOT NULL, "
" `user_consent_prompt` TEXT, "
- " `name` VARCHAR(100) NOT NULL "
+ " `name` VARCHAR(100) NOT NULL, "
+ " `encryption_required` BOOLEAN "
"); "
"CREATE TABLE IF NOT EXISTS `priority`( "
" `value` VARCHAR(45) PRIMARY KEY NOT NULL "
@@ -84,6 +86,9 @@ const std::string kCreateSchema =
"CREATE TABLE IF NOT EXISTS `hmi_level`( "
" `value` VARCHAR(45) PRIMARY KEY NOT NULL "
"); "
+ "CREATE TABLE IF NOT EXISTS `hybrid_app_preference`( "
+ " `value` VARCHAR(45) PRIMARY KEY NOT NULL "
+ "); "
"CREATE TABLE IF NOT EXISTS `notifications_by_priority`( "
" `priority_value` VARCHAR(45) PRIMARY KEY NOT NULL, "
" `value` INTEGER NOT NULL, "
@@ -133,19 +138,33 @@ const std::string kCreateSchema =
" `is_predata` BOOLEAN, "
" `memory_kb` INTEGER NOT NULL, "
" `heart_beat_timeout_ms` INTEGER NOT NULL, "
- " `certificate` VARCHAR(45), "
+ " `certificate` VARCHAR(65535), "
+ " `hybrid_app_preference_value` VARCHAR(255), "
+ " `endpoint` VARCHAR(255), "
+ " `enabled` BOOLEAN, "
+ " `auth_token` VARCHAR(65535), "
+ " `cloud_transport_type` VARCHAR(255), "
+ " `icon_url` VARCHAR(65535), "
+ " `allow_unknown_rpc_passthrough` BOOLEAN, "
" `remote_control_denied` BOOLEAN NOT NULL DEFAULT 0, "
+ " `encryption_required` BOOLEAN, "
" CONSTRAINT `fk_application_hmi_level1` "
" FOREIGN KEY(`default_hmi`) "
" REFERENCES `hmi_level`(`value`), "
" CONSTRAINT `fk_application_priorities1` "
" FOREIGN KEY(`priority_value`) "
" REFERENCES `priority`(`value`) "
+ " CONSTRAINT `fk_application_hybrid_app_preference1` "
+ " FOREIGN KEY(`hybrid_app_preference_value`) "
+ " REFERENCES `hybrid_app_preference`(`value`) "
"); "
"CREATE INDEX IF NOT EXISTS `application.fk_application_hmi_level1_idx` "
" ON `application`(`default_hmi`); "
"CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` "
" ON `application`(`priority_value`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`application.fk_application_hybrid_app_preference1` "
+ " ON `application`(`hybrid_app_preference_value`); "
"CREATE TABLE IF NOT EXISTS `app_group`( "
" `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
" `functional_group_id` INTEGER NOT NULL, "
@@ -273,6 +292,30 @@ const std::string kCreateSchema =
" FOREIGN KEY(`application_id`) "
" REFERENCES `application`(`id`) "
"); "
+ "CREATE TABLE IF NOT EXISTS `app_service_types`( "
+ " `id` INTEGER PRIMARY KEY NOT NULL, "
+ " `service_type` VARCHAR(50), "
+ " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, "
+ " CONSTRAINT `fk_service_type_app_id` "
+ " FOREIGN KEY(`application_id`) "
+ " REFERENCES `application`(`id`) "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `app_service_names`( "
+ " `service_type_id` INTEGER NOT NULL, "
+ " `service_name` VARCHAR(45), "
+ " PRIMARY KEY(`service_name`,`service_type_id`), "
+ " CONSTRAINT `fk_service_name_service_type_id` "
+ " FOREIGN KEY(`service_type_id`) "
+ " REFERENCES `app_service_types`(`id`) "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `app_service_handled_rpcs`( "
+ " `service_type_id` INTEGER NOT NULL, "
+ " `function_id` INTEGER, "
+ " PRIMARY KEY(`function_id`,`service_type_id`), "
+ " CONSTRAINT `fk_function_id_service_type_id` "
+ " FOREIGN KEY(`service_type_id`) "
+ " REFERENCES `app_service_types`(`id`) "
+ "); "
"CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` "
" ON `app_type`(`application_id` COLLATE NOCASE); "
"CREATE TABLE IF NOT EXISTS `consent_group`( "
@@ -309,6 +352,13 @@ const std::string kCreateSchema =
"); "
"CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx` "
" ON `endpoint`(`application_id` COLLATE NOCASE); "
+
+ /*endpoint properties*/
+ "CREATE TABLE IF NOT EXISTS `endpoint_properties`( "
+ " `service` VARCHAR(100) NOT NULL, "
+ " `version` VARCHAR(100) NOT NULL "
+ ");"
+
"CREATE TABLE IF NOT EXISTS `message`( "
" `id` INTEGER PRIMARY KEY NOT NULL, "
" `tts` TEXT, "
@@ -366,6 +416,42 @@ const std::string kCreateSchema =
"CREATE TABLE IF NOT EXISTS `_internal_data`( "
" `db_version_hash` INTEGER "
" ); "
+
+ /*vehicle data*/
+ "CREATE TABLE IF NOT EXISTS `vehicle_data`( "
+ " `schema_version` VARCHAR(100) NOT NULL "
+ ");"
+
+ /* vehicle data item definition*/
+ "CREATE TABLE IF NOT EXISTS `vehicle_data_item_definition`( "
+ " `name` VARCHAR(255) NOT NULL, "
+ " `type` VARCHAR(255) NOT NULL, "
+ " `key` VARCHAR(255) NOT NULL, "
+ " `mandatory` BOOL NOT NULL, "
+ " `array` BOOL, "
+ " `since` VARCHAR(45), "
+ " `until` VARCHAR(45), "
+ " `removed` BOOL, "
+ " `deprecated` BOOL, "
+ " `minvalue` INTEGER, "
+ " `maxvalue` INTEGER, "
+ " `minsize` INTEGER, "
+ " `maxsize` INTEGER, "
+ " `minlength` INTEGER, "
+ " `maxlength` INTEGER "
+ "); "
+ "CREATE TABLE IF NOT EXISTS `vehicle_data_item_parameters`( "
+ " `parent_name` VARCHAR(255) NOT NULL, "
+ " `parent_key` VARCHAR(255) NOT NULL, "
+ " `param_name` VARCHAR(255) NOT NULL, "
+ " `param_key` VARCHAR(255) NOT NULL, "
+ " CONSTRAINT `fk_vdi_id` "
+ " FOREIGN KEY(`parent_name`, `parent_key`) "
+ " REFERENCES `vehicle_data_item_definition`(`name`, `key`), "
+ " CONSTRAINT `fk_vdi_param_id` "
+ " FOREIGN KEY(`param_name`, `param_key`) "
+ " REFERENCES `vehicle_data_item_definition`(`name`, `key`) "
+ "); "
"COMMIT;";
const std::string kInsertInitData =
@@ -379,8 +465,10 @@ const std::string kInsertInitData =
" VALUES (0, 0, 0, 0); "
"INSERT OR IGNORE INTO `module_config` (`preloaded_pt`, `is_first_run`,"
" `exchange_after_x_ignition_cycles`, `exchange_after_x_kilometers`, "
- " `exchange_after_x_days`, `timeout_after_x_seconds`) "
+ " `exchange_after_x_days`, `timeout_after_x_seconds`)"
" VALUES(1, 0, 0, 0, 0, 0); "
+ "INSERT OR IGNORE INTO `vehicle_data` (`schema_version`) "
+ "VALUES('0'); "
"INSERT OR IGNORE INTO `priority`(`value`) VALUES ('EMERGENCY'); "
"INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NAVIGATION'); "
"INSERT OR IGNORE INTO `priority`(`value`) VALUES ('VOICECOMMUNICATION'); "
@@ -391,6 +479,9 @@ const std::string kInsertInitData =
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('LIMITED'); "
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND'); "
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('MOBILE'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('CLOUD'); "
+ "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('BOTH'); "
"INSERT OR IGNORE INTO `version` (`number`) VALUES('0'); "
"INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); "
"";
@@ -442,6 +533,7 @@ const std::string kDropSchema =
"DROP TABLE IF EXISTS `message`; "
"DROP INDEX IF EXISTS `endpoint.fk_endpoint_application1_idx`; "
"DROP TABLE IF EXISTS `endpoint`; "
+ "DROP TABLE IF EXISTS `endpoint_properties`; "
"DROP INDEX IF EXISTS `consent_group.fk_consent_group_device1_idx`; "
"DROP INDEX IF EXISTS "
"`consent_group.fk_consent_group_functional_group1_idx`; "
@@ -450,6 +542,9 @@ const std::string kDropSchema =
"DROP TABLE IF EXISTS `app_type`; "
"DROP TABLE IF EXISTS `request_type`; "
"DROP TABLE IF EXISTS `request_subtype`; "
+ "DROP TABLE IF EXISTS `app_service_types`; "
+ "DROP TABLE IF EXISTS `app_service_names`; "
+ "DROP TABLE IF EXISTS `app_service_handled_rpcs`; "
"DROP INDEX IF EXISTS `nickname.fk_nickname_application1_idx`; "
"DROP TABLE IF EXISTS `nickname`; "
"DROP INDEX IF EXISTS `app_level.fk_app_level_language2_idx`; "
@@ -491,6 +586,7 @@ const std::string kDropSchema =
"`notifications_by_priority.fk_notifications_by_priority_priority1_idx`; "
"DROP TABLE IF EXISTS `notifications_by_priority`; "
"DROP TABLE IF EXISTS `hmi_level`; "
+ "DROP TABLE IF EXISTS `hybrid_app_preference`; "
"DROP TABLE IF EXISTS `priority`; "
"DROP TABLE IF EXISTS `functional_group`; "
"DROP TABLE IF EXISTS `module_config`; "
@@ -500,6 +596,9 @@ const std::string kDropSchema =
"DROP TABLE IF EXISTS `usage_and_error_count`; "
"DROP TABLE IF EXISTS `device`; "
"DROP TABLE IF EXISTS `_internal_data`; "
+ "DROP TABLE IF EXISTS `vehicle_data`; "
+ "DROP TABLE IF EXISTS `vehicle_data_item_definition`; "
+ "DROP TABLE IF EXISTS `vehicle_data_item_parameters`; "
"COMMIT; "
"VACUUM;";
@@ -508,6 +607,7 @@ const std::string kDeleteData =
"DELETE FROM `message`; "
"DELETE FROM `module_type`; "
"DELETE FROM `endpoint`; "
+ "DELETE FROM `endpoint_properties`; "
"DELETE FROM `consent_group`; "
"DELETE FROM `app_type`; "
"DELETE FROM `nickname`; "
@@ -531,6 +631,9 @@ const std::string kDeleteData =
"DELETE FROM `remote_rpc`; "
"DELETE FROM `usage_and_error_count`; "
"DELETE FROM `device`; "
+ "DELETE FROM `vehicle_data`; "
+ "DELETE FROM `vehicle_data_item_definition`; "
+ "DELETE FROM `vehicle_data_item_parameters`; "
"COMMIT; "
"VACUUM;";
@@ -538,6 +641,82 @@ const std::string kCheckDBIntegrity = "PRAGMA integrity_check";
const std::string kCheckPgNumber = "PRAGMA page_count";
+const std::string kSelectEndpointProperties =
+ "SELECT `service`, `version` FROM `endpoint_properties`";
+
+const std::string kSelectVehicleDataSchemaVersion =
+ "SELECT `schema_version` FROM `vehicle_data` ";
+
+const std::string kSelectVehicleDataItem =
+ "SELECT * FROM `vehicle_data_item_definition` "
+ "WHERE `name` IS ? AND `key` IS ?";
+
+const std::string kSelectVehicleDataItemWithVersion =
+ "SELECT * FROM `vehicle_data_item_definition` "
+ "WHERE `name` IS ? AND `key` IS ? AND `since` IS ? AND `until` IS ?";
+
+const std::string kSelectVehicleDataItemParams =
+ "SELECT * FROM `vehicle_data_item_parameters` "
+ "WHERE `parent_name` IS ? AND `parent_key` IS ?";
+
+const std::string kSelectCompositeVehicleDataItemsKey =
+ "SELECT DISTINCT `parent_name`, `parent_key` FROM "
+ "`vehicle_data_item_parameters` "
+ "LEFT JOIN "
+ "(SELECT DISTINCT `param_name`, `param_key` FROM "
+ "`vehicle_data_item_parameters`) `vdi_params` ON "
+ "`vehicle_data_item_parameters`.`parent_name` = `vdi_params`.`param_name` "
+ "AND "
+ "`vehicle_data_item_parameters`.`parent_key` = `vdi_params`.`param_key` "
+ "where `vdi_params`.`param_key` is null";
+
+const std::string kSelectPrimitiveVehicleDataItems =
+ "SELECT * FROM `vehicle_data_item_definition` "
+ "LEFT JOIN ( "
+ "SELECT `parent_name`, `parent_key` FROM `vehicle_data_item_parameters` "
+ "UNION "
+ "SELECT `param_name`, `param_key` FROM `vehicle_data_item_parameters`) "
+ "`vdi_params` ON "
+ "`vehicle_data_item_definition`.`name` = `vdi_params`.`parent_name` "
+ "AND "
+ "`vehicle_data_item_definition`.`key` = `vdi_params`.`parent_key` "
+ "WHERE `vdi_params`.`parent_key` IS NULL";
+
+const std::string kInsertVehicleDataSchemaVersion =
+ "UPDATE `vehicle_data` SET `schema_version` = ?";
+
+const std::string kInsertEndpointVersion =
+ "INSERT OR REPLACE INTO `endpoint_properties`(`service`, "
+ "`version`) "
+ "VALUES(?, ?)";
+
+const std::string kInsertVehicleDataItem =
+ "INSERT INTO `vehicle_data_item_definition` ("
+ " `name`, "
+ " `type`, "
+ " `key`, "
+ " `mandatory`, "
+ " `array`, "
+ " `since`, "
+ " `until`, "
+ " `removed`, "
+ " `deprecated`, "
+ " `minvalue`, "
+ " `maxvalue`, "
+ " `minsize`, "
+ " `maxsize`, "
+ " `minlength`, "
+ " `maxlength`) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
+
+const std::string kInsertVehicleDataItemParams =
+ "INSERT INTO `vehicle_data_item_parameters` ("
+ " `parent_name`, "
+ " `parent_key`, "
+ " `param_name`, "
+ " `param_key`) "
+ "VALUES (?, ?, ?, ?) ";
+
const std::string kSelectRpc =
"SELECT DISTINCT `rpc`.`parameter` FROM `rpc` "
" JOIN `app_group` AS `g` ON (`g`.`functional_group_id` = "
@@ -560,12 +739,10 @@ const std::string kSetNotFirstRun =
const std::string kSelectEndpoint =
"SELECT `url`, `application_id` FROM `endpoint` WHERE `service` = ? ";
-const std::string kSelectLockScreenIcon =
- "SELECT `url` FROM `endpoint` WHERE `service` = ? AND `application_id` = ?";
-
const std::string kInsertFunctionalGroup =
- "INSERT INTO `functional_group` (`id`, `name`, `user_consent_prompt`) "
- " VALUES (?, ?, ?)";
+ "INSERT INTO `functional_group` (`id`, `name`, `user_consent_prompt`, "
+ "`encryption_required`) "
+ " VALUES (?, ?, ?, ?)";
const std::string kInsertRpc =
"INSERT INTO `rpc` (`name`, `hmi_level_value`, `functional_group_id`) "
@@ -578,8 +755,12 @@ const std::string kInsertRpcWithParameter =
const std::string kInsertApplication =
"INSERT OR IGNORE INTO `application` (`id`, `priority_value`, "
- "`is_revoked`, `memory_kb`,"
- " `heart_beat_timeout_ms`, `certificate`) VALUES (?,?,?,?,?,?)";
+ "`is_revoked`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, "
+ "`hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token`, "
+ "`cloud_transport_type`, `icon_url`, `allow_unknown_rpc_passthrough` "
+ ",`encryption_required`) "
+ "VALUES "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kInsertAppGroup =
"INSERT INTO `app_group` (`application_id`, `functional_group_id`)"
@@ -595,18 +776,25 @@ const std::string kInsertRequestType =
"INSERT INTO `request_type` (`application_id`, `request_type`) "
"VALUES (?, ?)";
-const std::string kInsertOmittedRequestType =
- "INSERT INTO `request_type` (`application_id`) "
- "VALUES (?)";
-
const std::string kInsertRequestSubType =
"INSERT INTO `request_subtype` (`application_id`, "
"`request_subtype`) "
"VALUES (?, ?)";
-const std::string kInsertOmittedRequestSubType =
- "INSERT INTO `request_subtype` (`application_id`) "
- "VALUES (?)";
+const std::string kInsertAppServiceTypes =
+ "INSERT INTO `app_service_types` (`id`, "
+ "`service_type`, `application_id`) "
+ "VALUES (?, ?, ?)";
+
+const std::string kInsertAppServiceNames =
+ "INSERT INTO `app_service_names` (`service_type_id`, "
+ "`service_name`) "
+ "VALUES (?, ?)";
+
+const std::string kInsertAppServiceHandledRpcs =
+ "INSERT INTO `app_service_handled_rpcs` (`service_type_id`, "
+ "`function_id`) "
+ "VALUES (?, ?)";
const std::string kUpdateVersion = "UPDATE `version` SET `number`= ?";
@@ -617,15 +805,17 @@ const std::string kInsertLanguage =
"INSERT OR IGNORE INTO `language` (`code`) VALUES (?)";
const std::string kInsertMessageString =
- "INSERT INTO `message` (`language_code`, `message_type_name`) "
- "VALUES (?, ?)";
+ "INSERT INTO `message` (`language_code`, `message_type_name`, `tts`, "
+ "`label`, `line1`, `line2`, `textBody`) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?)";
const std::string kUpdateModuleConfig =
"UPDATE `module_config` SET `preloaded_pt` = ?, "
" `exchange_after_x_ignition_cycles` = ?,"
" `exchange_after_x_kilometers` = ?, `exchange_after_x_days` = ?, "
" `timeout_after_x_seconds` = ?, `certificate` = ?, `vehicle_make` = ?, "
- " `vehicle_model` = ?, `vehicle_year` = ? ";
+ " `vehicle_model` = ?, `vehicle_year` = ?, lock_screen_dismissal_enabled "
+ "= ?";
const std::string kInsertEndpoint =
"INSERT INTO `endpoint` (`service`, `url`, `application_id`) "
@@ -665,7 +855,7 @@ const std::string kSelectModuleConfig =
"SELECT `preloaded_pt`, `exchange_after_x_ignition_cycles`, "
" `exchange_after_x_kilometers`, `exchange_after_x_days`, "
" `timeout_after_x_seconds`, `certificate`, `vehicle_make`,"
- " `vehicle_model`, `vehicle_year` "
+ " `vehicle_model`, `vehicle_year` ,`lock_screen_dismissal_enabled`"
" FROM `module_config`";
const std::string kSelectEndpoints =
@@ -684,7 +874,7 @@ const std::string kSelectAppLevels =
const std::string kSelectDeviceData = "SELECT * FROM `device`";
const std::string kSelectFunctionalGroups =
- "SELECT `id`,`name`, `user_consent_prompt` "
+ "SELECT `id`,`name`, `user_consent_prompt`, `encryption_required` "
"FROM `functional_group`";
const std::string kSelectAllRpcs =
@@ -696,7 +886,11 @@ const std::string kSelectUserMsgsVersion =
const std::string kSelectAppPolicies =
"SELECT `id`, `priority_value`, `memory_kb`, "
- " `heart_beat_timeout_ms`, `certificate` FROM `application`";
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, `icon_url`, "
+ " `allow_unknown_rpc_passthrough`, `encryption_required`"
+ "FROM "
+ " `application`";
const std::string kCollectFriendlyMsg = "SELECT * FROM `message`";
@@ -723,6 +917,21 @@ const std::string kSelectRequestSubTypes =
"`application_id` "
"= ?";
+const std::string kSelectAppServiceTypes =
+ "SELECT `id`, `service_type` FROM `app_service_types` WHERE "
+ "`application_id` "
+ "= ?";
+
+const std::string kSelectAppServiceNames =
+ "SELECT DISTINCT `service_name` FROM `app_service_names` WHERE "
+ "`service_type_id` "
+ "= ?";
+
+const std::string kSelectAppServiceHandledRpcs =
+ "SELECT DISTINCT `function_id` FROM `app_service_handled_rpcs` WHERE "
+ "`service_type_id` "
+ "= ?";
+
const std::string kSelectSecondsBetweenRetries =
"SELECT `value` FROM `seconds_between_retry` ORDER BY `index`";
@@ -770,6 +979,19 @@ const std::string kDeleteRequestType = "DELETE FROM `request_type`";
const std::string kDeleteRequestSubType = "DELETE FROM `request_subtype`";
+const std::string kDeleteAppServiceTypes = "DELETE FROM `app_service_types`";
+
+const std::string kDeleteAppServiceNames = "DELETE FROM `app_service_names`";
+
+const std::string kDeleteAppServiceHandledRpcs =
+ "DELETE FROM `app_service_handled_rpcs`";
+
+const std::string kDeleteVehicleDataItems =
+ "DELETE FROM `vehicle_data_item_definition`";
+
+const std::string kDeleteVehicleDataItemParams =
+ "DELETE FROM `vehicle_data_item_parameters`";
+
const std::string kSelectApplicationRevoked =
"SELECT `is_revoked` FROM `application` WHERE `id` = ?";
@@ -793,15 +1015,23 @@ const std::string kDeleteAppGroupByApplicationId =
const std::string kInsertApplicationFull =
"INSERT OR IGNORE INTO `application` (`id`, `keep_context`, `steal_focus`, "
- " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
- "`is_predata`, "
- " `memory_kb`, `heart_beat_timeout_ms`, `certificate`) "
- " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ " `is_predata`, `memory_kb`, `heart_beat_timeout_ms`, "
+ " `certificate`, `hybrid_app_preference_value`, `endpoint`, `enabled`, "
+ " `auth_token`, `cloud_transport_type`, `icon_url`, "
+ "`allow_unknown_rpc_passthrough`, `encryption_required`)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
const std::string kSelectApplicationFull =
- "SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, "
+ "SELECT `keep_context`, `steal_focus`, `default_hmi`, "
+ "`priority_value`, "
" `is_revoked`, `is_default`, `is_predata`, `memory_kb`,"
- " `heart_beat_timeout_ms`, `certificate` FROM `application` WHERE `id` = "
+ " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, "
+ " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, "
+ "`icon_url`, "
+ " `allow_unknown_rpc_passthrough`, `encryption_required`"
+ "FROM `application` "
+ "WHERE `id` = "
"?";
const std::string kSelectDBVersion =
@@ -817,6 +1047,5 @@ const std::string kSaveModuleMeta =
"`ignition_cycles_since_last_exchange` = ? ";
const std::string kSelectModuleMeta = "SELECT* FROM `module_meta`";
-
} // namespace sql_pt
} // namespace policy
diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc
index b1e574578e..c6d0b60f89 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -30,22 +30,22 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sstream>
-#include <stdlib.h>
-#include <stdint.h>
#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
#include <unistd.h>
+#include <sstream>
-#include "utils/logger.h"
+#include "config_profile/profile.h"
+#include "policy/cache_manager.h"
+#include "policy/policy_helper.h"
+#include "policy/sql_pt_queries.h"
+#include "policy/sql_pt_representation.h"
+#include "policy/sql_wrapper.h"
#include "utils/date_time.h"
#include "utils/file_system.h"
#include "utils/gen_hash.h"
-#include "policy/sql_pt_representation.h"
-#include "policy/sql_wrapper.h"
-#include "policy/sql_pt_queries.h"
-#include "policy/policy_helper.h"
-#include "policy/cache_manager.h"
-#include "config_profile/profile.h"
+#include "utils/logger.h"
namespace policy {
@@ -81,9 +81,9 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRpc)) {
- LOG4CXX_WARN(logger_,
- "Incorrect select statement from rpcs"
- << query.LastError().text());
+ LOG4CXX_WARN(
+ logger_,
+ "Incorrect select statement from rpcs" << query.LastError().text());
return;
}
query.Bind(0, app_id);
@@ -187,10 +187,10 @@ int SQLPTRepresentation::TimeoutResponse() {
utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) {
LOG4CXX_INFO(logger_, "Can not select timeout response for retry sequence");
- const int defaultTimeout = 30 * date_time::DateTime::MILLISECONDS_IN_SECOND;
+ const int defaultTimeout = 30 * date_time::MILLISECONDS_IN_SECOND;
return defaultTimeout;
}
- return query.GetInteger(0) * date_time::DateTime::MILLISECONDS_IN_SECOND;
+ return query.GetInteger(0) * date_time::MILLISECONDS_IN_SECOND;
}
bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) {
@@ -241,28 +241,6 @@ EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) {
return ret;
}
-std::string SQLPTRepresentation::GetLockScreenIconUrl() const {
- utils::dbms::SQLQuery query(db());
- std::string ret;
- if (query.Prepare(sql_pt::kSelectLockScreenIcon)) {
- query.Bind(0, std::string("lock_screen_icon_url"));
- query.Bind(1, std::string("default"));
-
- if (!query.Exec()) {
- LOG4CXX_WARN(logger_, "Incorrect select from notifications by priority.");
- return ret;
- }
-
- if (!query.IsNull(0)) {
- ret = query.GetString(0);
- }
-
- } else {
- LOG4CXX_WARN(logger_, "Invalid select endpoints statement.");
- }
- return ret;
-}
-
int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) {
LOG4CXX_AUTO_TRACE(logger_);
utils::dbms::SQLQuery query(db());
@@ -378,9 +356,9 @@ InitResult SQLPTRepresentation::Init(const PolicySettings* settings) {
utils::dbms::SQLQuery check_first_run(db());
if (check_first_run.Prepare(sql_pt::kIsFirstRun) &&
check_first_run.Next()) {
- LOG4CXX_INFO(logger_,
- "Selecting is first run "
- << check_first_run.GetBoolean(0));
+ LOG4CXX_INFO(
+ logger_,
+ "Selecting is first run " << check_first_run.GetBoolean(0));
if (check_first_run.GetBoolean(0)) {
utils::dbms::SQLQuery set_not_first_run(db());
set_not_first_run.Exec(sql_pt::kSetNotFirstRun);
@@ -421,16 +399,6 @@ bool SQLPTRepresentation::Close() {
return db_->LastError().number() == utils::dbms::OK;
}
-const VehicleInfo SQLPTRepresentation::GetVehicleInfo() const {
- policy_table::ModuleConfig module_config;
- GatherModuleConfig(&module_config);
- VehicleInfo vehicle_info;
- vehicle_info.vehicle_make = *module_config.vehicle_make;
- vehicle_info.vehicle_model = *module_config.vehicle_model;
- vehicle_info.vehicle_year = *module_config.vehicle_year;
- return vehicle_info;
-}
-
bool SQLPTRepresentation::Drop() {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDropSchema)) {
@@ -483,10 +451,10 @@ bool SQLPTRepresentation::RefreshDB() {
return true;
}
-utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot()
+std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot()
const {
LOG4CXX_AUTO_TRACE(logger_);
- utils::SharedPtr<policy_table::Table> table = new policy_table::Table();
+ auto table = std::make_shared<policy_table::Table>();
GatherModuleMeta(&*table->policy_table.module_meta);
GatherModuleConfig(&table->policy_table.module_config);
GatherUsageAndErrorCounts(&*table->policy_table.usage_and_error_counts);
@@ -495,6 +463,11 @@ utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot()
GatherConsumerFriendlyMessages(
&*table->policy_table.consumer_friendly_messages);
GatherApplicationPoliciesSection(&table->policy_table.app_policies_section);
+ GatherVehicleData(&*table->policy_table.vehicle_data);
+ if (!table->policy_table.vehicle_data.is_initialized()) {
+ rpc::Optional<rpc::String<0, 100> > null_version;
+ table->policy_table.vehicle_data->schema_version = null_version;
+ }
return table;
}
@@ -525,7 +498,9 @@ void SQLPTRepresentation::GatherModuleConfig(
*config->vehicle_make = query.GetString(6);
*config->vehicle_model = query.GetString(7);
*config->vehicle_year = query.GetString(8);
- *config->preloaded_date = query.GetString(9);
+ if (!query.IsNull(9)) {
+ *config->lock_screen_dismissal_enabled = query.GetBoolean(9);
+ }
}
utils::dbms::SQLQuery endpoints(db());
@@ -540,6 +515,18 @@ void SQLPTRepresentation::GatherModuleConfig(
}
}
+ utils::dbms::SQLQuery endpoint_properties(db());
+ if (!endpoint_properties.Prepare(sql_pt::kSelectEndpointProperties)) {
+ LOG4CXX_ERROR(logger_, "Incorrect statement for Endpoint properties");
+ } else {
+ while (endpoint_properties.Next()) {
+ const std::string& service = endpoint_properties.GetString(0);
+ const std::string& version = endpoint_properties.GetString(1);
+ auto& ep_properties = (*config->endpoint_properties);
+ *ep_properties[service].version = version;
+ }
+ }
+
utils::dbms::SQLQuery notifications(db());
if (!notifications.Prepare(sql_pt::kSelectNotificationsPerMin)) {
LOG4CXX_WARN(logger_, "Incorrect select statement for notifications");
@@ -614,6 +601,10 @@ bool SQLPTRepresentation::GatherFunctionalGroupings(
*rpcs_structure.user_consent_prompt = functional_group.GetString(2);
}
+ if (!functional_group.IsNull(3)) {
+ *rpcs_structure.encryption_required = functional_group.GetBoolean(3);
+ }
+
const int group_id = functional_group.GetInteger(0);
// Collecting RPCs with their HMI levels and parameters (if any)
@@ -627,18 +618,17 @@ bool SQLPTRepresentation::GatherFunctionalGroupings(
}
}
if (!rpcs.IsNull(2)) {
- policy_table::Parameter param;
- if (EnumFromJsonString(rpcs.GetString(2), &param)) {
- // EMPTY is a special mark to specify that 'parameters' section is
- // present, but has no parameters. It is not valid parameter value.
- if (policy_table::P_EMPTY == param) {
- (*rpcs_structure.rpcs[rpcs.GetString(0)].parameters)
- .mark_initialized();
- continue;
- }
- InsertUnique(param,
- &(*rpcs_structure.rpcs[rpcs.GetString(0)].parameters));
+ std::string param = rpcs.GetString(2);
+ // EMPTY is a special mark to specify that 'parameters' section is
+ // present, but has no parameters. It is not valid parameter value.
+ if (policy_table::EnumToJsonString(policy_table::P_EMPTY) == param) {
+ (*rpcs_structure.rpcs[rpcs.GetString(0)].parameters)
+ .mark_initialized();
+ continue;
}
+
+ InsertUnique(param,
+ &(*rpcs_structure.rpcs[rpcs.GetString(0)].parameters));
}
}
@@ -668,10 +658,33 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
if (query.Prepare(sql_pt::kCollectFriendlyMsg)) {
while (query.Next()) {
UserFriendlyMessage msg;
+
+ msg.tts = query.GetString(1);
+ msg.label = query.GetString(2);
+ msg.line1 = query.GetString(3);
+ msg.line2 = query.GetString(4);
+ msg.text_body = query.GetString(5);
msg.message_code = query.GetString(7);
- std::string language = query.GetString(6);
- (*messages->messages)[msg.message_code].languages[language];
+ std::string language = query.GetString(6);
+ policy_table::Languages& languages =
+ (*messages->messages)[msg.message_code].languages;
+ policy_table::MessageString& specific_message = languages[language];
+ if (!msg.tts.empty()) {
+ *(specific_message).tts = msg.tts;
+ }
+ if (!msg.label.empty()) {
+ *(specific_message).label = msg.label;
+ }
+ if (!msg.line1.empty()) {
+ *(specific_message).line1 = msg.line1;
+ }
+ if (!msg.line2.empty()) {
+ *(specific_message).line2 = msg.line2;
+ }
+ if (!msg.text_body.empty()) {
+ *(specific_message).textBody = msg.text_body;
+ }
}
} else {
LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages.");
@@ -692,6 +705,7 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
while (query.Next()) {
rpc::Nullable<policy_table::ApplicationParams> params;
const std::string& app_id = query.GetString(0);
+
if (IsApplicationRevoked(app_id)) {
params.set_to_null();
(*policies).apps[app_id] = params;
@@ -717,32 +731,63 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
*params.memory_kb = query.GetInteger(2);
*params.heart_beat_timeout_ms = query.GetUInteger(3);
- if (!query.IsNull(3)) {
+ if (!query.IsNull(4)) {
*params.certificate = query.GetString(4);
}
- if (!GatherAppGroup(app_id, &params.groups)) {
+
+ // Read cloud app properties
+ policy_table::HybridAppPreference hap;
+ bool valid = policy_table::EnumFromJsonString(query.GetString(5), &hap);
+ if (valid) {
+ *params.hybrid_app_preference = hap;
+ }
+ *params.endpoint = query.GetString(6);
+ if (!query.IsNull(7)) {
+ *params.enabled = query.GetBoolean(7);
+ }
+ *params.auth_token = query.GetString(8);
+ *params.cloud_transport_type = query.GetString(9);
+ *params.icon_url = query.GetString(10);
+ *params.allow_unknown_rpc_passthrough = query.GetBoolean(11);
+
+ if (!query.IsNull(12)) {
+ *params.encryption_required = query.GetBoolean(12);
+ }
+
+ const auto& gather_app_id = ((*policies).apps[app_id].is_string())
+ ? (*policies).apps[app_id].get_string()
+ : app_id;
+ // Data should be gathered from db by "default" key if application has
+ // default policies
+
+ if (!GatherAppGroup(gather_app_id, &params.groups)) {
return false;
}
bool denied = false;
- if (!GatherRemoteControlDenied(app_id, &denied)) {
+ if (!GatherRemoteControlDenied(gather_app_id, &denied)) {
return false;
}
if (!denied) {
- if (!GatherModuleType(app_id, &*params.moduleType)) {
+ if (!GatherModuleType(gather_app_id, &*params.moduleType)) {
return false;
}
}
- if (!GatherNickName(app_id, &*params.nicknames)) {
+ if (!GatherNickName(gather_app_id, &*params.nicknames)) {
return false;
}
- if (!GatherAppType(app_id, &*params.AppHMIType)) {
+ if (!GatherAppType(gather_app_id, &*params.AppHMIType)) {
return false;
}
- if (!GatherRequestType(app_id, &*params.RequestType)) {
+ if (!GatherRequestType(gather_app_id, &*params.RequestType)) {
return false;
}
- if (!GatherRequestSubType(app_id, &*params.RequestSubType)) {
+ if (!GatherRequestSubType(gather_app_id, &*params.RequestSubType)) {
+ return false;
+ }
+
+ if (!GatherAppServiceParameters(gather_app_id,
+ &*params.app_service_parameters)) {
return false;
}
@@ -751,6 +796,44 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
return true;
}
+bool SQLPTRepresentation::GatherVehicleData(
+ policy_table::VehicleData* vehicle_data) const {
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kSelectVehicleDataSchemaVersion) ||
+ !query.Next()) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrect statement for vehicle data schema version");
+ return false;
+ }
+ *vehicle_data->schema_version = query.GetString(0);
+
+ vehicle_data->mark_initialized();
+ return GatherVehicleDataItems(&*vehicle_data->schema_items);
+}
+
+bool SQLPTRepresentation::GatherVehicleDataItems(
+ policy_table::VehicleDataItems* vehicle_data_items) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto parameterized_vdi = SelectCompositeVehicleDataItems();
+ if (!parameterized_vdi.is_initialized()) {
+ return false;
+ }
+
+ auto non_parameterized_vdi = SelectPrimitiveVehicleDataItems();
+ if (!non_parameterized_vdi.is_initialized()) {
+ return false;
+ }
+
+ vehicle_data_items->insert(vehicle_data_items->end(),
+ parameterized_vdi.begin(),
+ parameterized_vdi.end());
+ vehicle_data_items->insert(vehicle_data_items->end(),
+ non_parameterized_vdi.begin(),
+ non_parameterized_vdi.end());
+
+ return true;
+}
+
bool SQLPTRepresentation::Save(const policy_table::Table& table) {
LOG4CXX_AUTO_TRACE(logger_);
db_->BeginTransaction();
@@ -785,6 +868,10 @@ bool SQLPTRepresentation::Save(const policy_table::Table& table) {
db_->RollbackTransaction();
return false;
}
+ if (!SaveVehicleData(*table.policy_table.vehicle_data)) {
+ db_->RollbackTransaction();
+ return false;
+ }
db_->CommitTransaction();
return true;
}
@@ -824,7 +911,9 @@ bool SQLPTRepresentation::SaveFunctionalGroupings(
it->second.user_consent_prompt.is_initialized()
? query.Bind(2, *(it->second.user_consent_prompt))
: query.Bind(2);
-
+ it->second.encryption_required.is_initialized()
+ ? query.Bind(3, *(it->second.encryption_required))
+ : query.Bind(3);
if (!query.Exec() || !query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into functional groups");
return false;
@@ -861,8 +950,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
query_parameter.Bind(0, it->first);
query_parameter.Bind(
1, std::string(policy_table::EnumToJsonString(*hmi_it)));
- query_parameter.Bind(
- 2, std::string(policy_table::EnumToJsonString(*ps_it)));
+ query_parameter.Bind(2, std::string(*ps_it));
query_parameter.Bind(3, group_id);
if (!query_parameter.Exec() || !query_parameter.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into rpc with parameter");
@@ -922,6 +1010,21 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection(
return false;
}
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled rpcs.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from service names.");
+ return false;
+ }
+
+ if (!query_delete.Exec(sql_pt::kDeleteAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from handled service types.");
+ return false;
+ }
+
// All predefined apps (e.g. default, pre_DataConsent) should be saved first,
// otherwise another app with the predefined permissions can get incorrect
// permissions
@@ -976,6 +1079,32 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
app.second.certificate.is_initialized()
? app_query.Bind(5, *app.second.certificate)
: app_query.Bind(5);
+ app.second.hybrid_app_preference.is_initialized()
+ ? app_query.Bind(6,
+ std::string(policy_table::EnumToJsonString(
+ *app.second.hybrid_app_preference)))
+ : app_query.Bind(6);
+ app.second.endpoint.is_initialized() ? app_query.Bind(7, *app.second.endpoint)
+ : app_query.Bind(7);
+ app.second.enabled.is_initialized() ? app_query.Bind(8, *app.second.enabled)
+ : app_query.Bind(8);
+ app.second.auth_token.is_initialized()
+ ? app_query.Bind(9, *app.second.auth_token)
+ : app_query.Bind(9);
+ app.second.cloud_transport_type.is_initialized()
+ ? app_query.Bind(10, *app.second.cloud_transport_type)
+ : app_query.Bind(10);
+ app.second.icon_url.is_initialized()
+ ? app_query.Bind(11, *app.second.icon_url)
+ : app_query.Bind(11);
+ app.second.allow_unknown_rpc_passthrough.is_initialized()
+ ? app_query.Bind(12, *app.second.allow_unknown_rpc_passthrough)
+ : app_query.Bind(12);
+
+ app.second.encryption_required.is_initialized()
+ ? app_query.Bind(13, *app.second.encryption_required)
+ : app_query.Bind(13);
+
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
return false;
@@ -1014,6 +1143,11 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
return false;
}
+ if (!SaveAppServiceParameters(app.first,
+ *app.second.app_service_parameters)) {
+ return false;
+ }
+
return true;
}
@@ -1032,7 +1166,6 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy(
app_query.Bind(3, 0);
app_query.Bind(4, 0);
app_query.Bind(5);
-
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
return false;
@@ -1056,9 +1189,9 @@ bool SQLPTRepresentation::SaveAppGroup(
query.Bind(0, app_id);
query.Bind(1, *it);
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_,
- "Incorrect insert into app group."
- << query.LastError().text());
+ LOG4CXX_WARN(
+ logger_,
+ "Incorrect insert into app group." << query.LastError().text());
return false;
}
}
@@ -1137,18 +1270,6 @@ bool SQLPTRepresentation::SaveRequestType(
LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
return false;
}
- } else {
- utils::dbms::SQLQuery query_omitted(db());
- if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request types.");
- return false;
- }
- LOG4CXX_WARN(logger_, "Request types omitted.");
- query_omitted.Bind(0, app_id);
- if (!query_omitted.Exec() || !query_omitted.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
- return false;
- }
}
return true;
}
@@ -1176,23 +1297,92 @@ bool SQLPTRepresentation::SaveRequestSubType(
} else if (request_subtypes.is_initialized()) {
LOG4CXX_WARN(logger_, "Request subtypes empty.");
query.Bind(0, app_id);
- query.Bind(1, std::string("EMPTY"));
+ query.Bind(1,
+ std::string(policy_table::EnumToJsonString(
+ policy_table::RequestType::RT_EMPTY)));
if (!query.Exec() || !query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
return false;
}
- } else {
- utils::dbms::SQLQuery query_omitted(db());
- if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestSubType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes.");
+ }
+ return true;
+}
+
+bool SQLPTRepresentation::SaveAppServiceParameters(
+ const std::string& app_id,
+ const policy_table::AppServiceParameters& app_service_parameters) {
+ LOG4CXX_INFO(logger_, "Save app service parameters");
+ utils::dbms::SQLQuery query(db());
+
+ if (!query.Prepare(sql_pt::kInsertAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert statement for app service types");
+ return false;
+ }
+ policy_table::AppServiceParameters::const_iterator it;
+ for (it = app_service_parameters.begin(); it != app_service_parameters.end();
+ ++it) {
+ // Create service type id from hashing app_id and service_type
+ std::string str_to_hash = std::string(app_id + it->first);
+ const long int id = abs(CacheManager::GenerateHash(str_to_hash));
+ query.Bind(0, static_cast<int64_t>(id));
+ query.Bind(1, it->first);
+ query.Bind(2, app_id);
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_WARN(logger_, "Insert execute failed for into app service types");
return false;
}
- LOG4CXX_WARN(logger_, "Request subtypes omitted.");
- query_omitted.Bind(0, app_id);
- if (!query_omitted.Exec() || !query_omitted.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
+
+ // Insert app names array into db
+ utils::dbms::SQLQuery service_name_query(db());
+ if (!service_name_query.Prepare(sql_pt::kInsertAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert statement for app service names");
+ return false;
+ }
+
+ auto app_service_names = it->second.service_names;
+
+ if (app_service_names.is_initialized() && app_service_names->empty()) {
+ // App service names is an empty array
+ LOG4CXX_DEBUG(logger_, "App Service Names is Empty Array");
+ service_name_query.Bind(0, static_cast<int64_t>(id));
+ service_name_query.Bind(1);
+ if (!service_name_query.Exec() || !service_name_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into empty app service names");
+ return false;
+ }
+ } else {
+ policy_table::AppServiceNames::const_iterator names_it;
+ for (names_it = app_service_names->begin();
+ names_it != app_service_names->end();
+ ++names_it) {
+ service_name_query.Bind(0, static_cast<int64_t>(id));
+ service_name_query.Bind(1, *names_it);
+ if (!service_name_query.Exec() || !service_name_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into app service names");
+ return false;
+ }
+ }
+ }
+
+ // Insert handled rpcs array into db
+ utils::dbms::SQLQuery handled_rpcs_query(db());
+ if (!handled_rpcs_query.Prepare(sql_pt::kInsertAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_,
+ "Incorrect insert statement for app service handled rpcs");
return false;
}
+
+ auto handled_rpcs = it->second.handled_rpcs;
+ policy_table::AppServiceHandledRpcs::const_iterator rpc_it;
+ for (rpc_it = handled_rpcs.begin(); rpc_it != handled_rpcs.end();
+ ++rpc_it) {
+ handled_rpcs_query.Bind(0, static_cast<int64_t>(id));
+ handled_rpcs_query.Bind(1, static_cast<int32_t>(rpc_it->function_id));
+ if (!handled_rpcs_query.Exec() || !handled_rpcs_query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into app service handled rpcs");
+ return false;
+ }
+ }
}
return true;
}
@@ -1241,6 +1431,9 @@ bool SQLPTRepresentation::SaveModuleConfig(
: query.Bind(7);
config.vehicle_year.is_initialized() ? query.Bind(8, *(config.vehicle_year))
: query.Bind(8);
+ config.lock_screen_dismissal_enabled.is_initialized()
+ ? query.Bind(9, *(config.lock_screen_dismissal_enabled))
+ : query.Bind(9);
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Incorrect update module config");
return false;
@@ -1259,6 +1452,10 @@ bool SQLPTRepresentation::SaveModuleConfig(
return false;
}
+ if (!SaveServiceEndpointProperties(*config.endpoint_properties)) {
+ return false;
+ }
+
return true;
}
@@ -1297,6 +1494,31 @@ bool SQLPTRepresentation::SaveServiceEndpoints(
return true;
}
+bool SQLPTRepresentation::SaveServiceEndpointProperties(
+ const policy_table::ServiceEndpointProperties& endpoint_properties) {
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kInsertEndpointVersion)) {
+ LOG4CXX_WARN(
+ logger_,
+ "Incorrect insert of endpoint property to endpoint_properties.");
+ return false;
+ }
+
+ for (auto& endpoint_property : endpoint_properties) {
+ query.Bind(0, endpoint_property.first);
+ query.Bind(1, endpoint_property.second.version);
+
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_WARN(
+ logger_,
+ "Failed to insert endpoint property into endpoint_properties.");
+ return false;
+ }
+ }
+
+ return true;
+}
+
bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
const policy_table::ConsumerFriendlyMessages& messages) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1395,6 +1617,25 @@ bool SQLPTRepresentation::SaveMessageString(
query.Bind(0, lang);
query.Bind(1, type);
+ if (strings.tts.is_valid() && strings.tts.is_initialized()) {
+ query.Bind(2, (*strings.tts));
+ }
+
+ if (strings.label.is_valid() && strings.label.is_initialized()) {
+ query.Bind(3, (*strings.label));
+ }
+
+ if (strings.line1.is_valid() && strings.line1.is_initialized()) {
+ query.Bind(4, *(strings.line1));
+ }
+
+ if (strings.line2.is_valid() && strings.line2.is_initialized()) {
+ query.Bind(5, (*strings.line2));
+ }
+
+ if (strings.textBody.is_valid() && strings.textBody.is_initialized()) {
+ query.Bind(6, (*strings.textBody));
+ }
if (!query.Exec() || !query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into message.");
@@ -1497,6 +1738,44 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts(
return true;
}
+bool SQLPTRepresentation::SaveVehicleData(
+ const policy_table::VehicleData& vehicle_data) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (vehicle_data.is_initialized() &&
+ vehicle_data.schema_version.is_initialized()) {
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kInsertVehicleDataSchemaVersion)) {
+ LOG4CXX_WARN(logger_,
+ "Incorrect insert of schema_version to vehicle_data.");
+ return false;
+ }
+ query.Bind(0, (*vehicle_data.schema_version));
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_WARN(logger_, "Failed to insert schema_version to vehicle_data.");
+ return false;
+ }
+ }
+
+ auto vehicle_data_items = vehicle_data.is_initialized() &&
+ vehicle_data.schema_items.is_initialized()
+ ? *(vehicle_data.schema_items)
+ : policy_table::VehicleDataItems();
+
+ return SaveVehicleDataItems(vehicle_data_items);
+}
+
+bool SQLPTRepresentation::SaveVehicleDataItems(
+ const policy_table::VehicleDataItems& vehicle_data_items) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DeleteVehicleDataItems();
+ for (const auto& item : vehicle_data_items) {
+ if (!InsertVehicleDataItem(item)) {
+ return false;
+ }
+ }
+ return true;
+}
+
void SQLPTRepresentation::IncrementIgnitionCycles() {
utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kIncrementIgnitionCycles)) {
@@ -1626,7 +1905,8 @@ bool SQLPTRepresentation::GatherRequestSubType(
query.Bind(0, app_id);
while (query.Next()) {
const std::string request_subtype = query.GetString(0);
- if ("EMPTY" == request_subtype) {
+ if (policy_table::EnumToJsonString(policy_table::RT_EMPTY) ==
+ request_subtype) {
request_subtypes->mark_initialized();
continue;
}
@@ -1635,6 +1915,64 @@ bool SQLPTRepresentation::GatherRequestSubType(
return true;
}
+bool SQLPTRepresentation::GatherAppServiceParameters(
+ const std::string& app_id,
+ policy_table::AppServiceParameters* app_service_parameters) const {
+ LOG4CXX_INFO(logger_, "Gather app service info");
+ utils::dbms::SQLQuery service_type_query(db());
+ if (!service_type_query.Prepare(sql_pt::kSelectAppServiceTypes)) {
+ LOG4CXX_WARN(logger_, "Incorrect select from service_types");
+ return false;
+ }
+
+ utils::dbms::SQLQuery service_name_query(db());
+ if (!service_name_query.Prepare(sql_pt::kSelectAppServiceNames)) {
+ LOG4CXX_WARN(logger_, "Incorrect select all from app_service_names");
+ return false;
+ }
+
+ utils::dbms::SQLQuery handled_rpcs_query(db());
+ if (!handled_rpcs_query.Prepare(sql_pt::kSelectAppServiceHandledRpcs)) {
+ LOG4CXX_WARN(logger_, "Incorrect select all from app_service_handled_rpcs");
+ return false;
+ }
+
+ service_type_query.Bind(0, app_id);
+ while (service_type_query.Next()) {
+ const int service_type_id = service_type_query.GetInteger(0);
+ std::string service_type = service_type_query.GetString(1);
+ LOG4CXX_WARN(logger_, "Load service type from pt: " << service_type);
+ (*app_service_parameters)[service_type] = policy_table::AppServiceInfo();
+
+ service_name_query.Bind(0, service_type_id);
+ while (service_name_query.Next()) {
+ LOG4CXX_DEBUG(logger_, "Loading service name");
+ (*app_service_parameters)[service_type].service_names->push_back(
+ service_name_query.GetString(0));
+ (*app_service_parameters)[service_type].service_names->mark_initialized();
+ }
+
+ handled_rpcs_query.Bind(0, service_type_id);
+ while (handled_rpcs_query.Next()) {
+ policy_table::AppServiceHandledRpc handled_rpc;
+ handled_rpc.function_id = handled_rpcs_query.GetInteger(0);
+ (*app_service_parameters)[service_type].handled_rpcs.push_back(
+ handled_rpc);
+ }
+
+ if (!service_name_query.Reset()) {
+ LOG4CXX_ERROR(logger_, "Could not reset service_name query");
+ return false;
+ }
+ if (!handled_rpcs_query.Reset()) {
+ LOG4CXX_ERROR(logger_, "Could not reset handled_rpcs query");
+ return false;
+ }
+ }
+
+ return true;
+}
+
bool SQLPTRepresentation::GatherNickName(
const std::string& app_id, policy_table::Strings* nicknames) const {
utils::dbms::SQLQuery query(db());
@@ -1696,6 +2034,10 @@ bool SQLPTRepresentation::GatherModuleType(
if (!policy_table::EnumFromJsonString(query.GetString(0), &type)) {
return false;
}
+ if (policy_table::ModuleType::MT_EMPTY == type) {
+ app_types->mark_initialized();
+ continue;
+ }
app_types->push_back(type);
}
return true;
@@ -1728,18 +2070,30 @@ bool SQLPTRepresentation::SaveModuleType(
}
policy_table::ModuleTypes::const_iterator it;
- for (it = types.begin(); it != types.end(); ++it) {
+ if (!types.empty()) {
+ for (it = types.begin(); it != types.end(); ++it) {
+ query.Bind(0, app_id);
+ std::string module(policy_table::EnumToJsonString(*it));
+ query.Bind(1, module);
+ LOG4CXX_DEBUG(logger_,
+ "Module(app: " << app_id << ", type: " << module << ")");
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insert into module type.");
+ return false;
+ }
+ }
+ } else if (types.is_initialized()) {
query.Bind(0, app_id);
- std::string module(policy_table::EnumToJsonString(*it));
- query.Bind(1, module);
- LOG4CXX_DEBUG(logger_,
- "Module(app: " << app_id << ", type: " << module << ")");
+ query.Bind(1,
+ std::string(policy_table::EnumToJsonString(
+ policy_table::ModuleType::MT_EMPTY)));
if (!query.Exec() || !query.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into module type.");
+ LOG4CXX_WARN(logger_, "Incorrect insert into module types.");
return false;
}
+ } else {
+ LOG4CXX_WARN(logger_, "Module Type omitted.");
}
-
return true;
}
@@ -1969,6 +2323,12 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
return false;
}
+ policy_table::AppServiceParameters app_service_parameters;
+ if (!GatherAppServiceParameters(kDefaultId, &app_service_parameters) ||
+ !SaveAppServiceParameters(app_id, app_service_parameters)) {
+ return false;
+ }
+
return SetIsDefault(app_id, true);
}
@@ -2084,6 +2444,23 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
query.Bind(9, source_app.GetInteger(8));
source_app.IsNull(9) ? query.Bind(10)
: query.Bind(10, source_app.GetString(9));
+ source_app.IsNull(10) ? query.Bind(11)
+ : query.Bind(11, source_app.GetString(10));
+ source_app.IsNull(11) ? query.Bind(12)
+ : query.Bind(12, source_app.GetString(11));
+ source_app.IsNull(12) ? query.Bind(13)
+ : query.Bind(13, source_app.GetBoolean(12));
+ source_app.IsNull(13) ? query.Bind(14)
+ : query.Bind(14, source_app.GetString(13));
+ source_app.IsNull(14) ? query.Bind(15)
+ : query.Bind(15, source_app.GetString(14));
+ source_app.IsNull(15) ? query.Bind(16)
+ : query.Bind(16, source_app.GetString(15));
+ source_app.IsNull(16) ? query.Bind(17)
+ : query.Bind(17, source_app.GetBoolean(16));
+ source_app.IsNull(17) ? query.Bind(18)
+ : query.Bind(18, source_app.GetBoolean(17));
+
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Failed inserting into application.");
return false;
@@ -2109,4 +2486,314 @@ bool SQLPTRepresentation::SetVINValue(const std::string& value) {
return true;
}
+bool SQLPTRepresentation::VehicleDataItemExists(
+ const policy_table::VehicleDataItem& vehicle_data_item) const {
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kSelectVehicleDataItemWithVersion)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrent select statement for vehicle data item. "
+ << query.LastError().text());
+ return false;
+ }
+
+ query.Bind(0, vehicle_data_item.name);
+ query.Bind(1, vehicle_data_item.key);
+ vehicle_data_item.since.is_initialized()
+ ? query.Bind(2, std::string(*vehicle_data_item.since))
+ : query.Bind(2);
+ vehicle_data_item.until.is_initialized()
+ ? query.Bind(3, std::string(*vehicle_data_item.until))
+ : query.Bind(3);
+
+ if (!query.Exec()) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to retrieve vehicle data item: "
+ << std::string(vehicle_data_item.key)
+ << ". Error: " << query.LastError().text());
+ return false;
+ }
+ return !query.IsNull(0);
+}
+
+policy_table::VehicleDataItems SQLPTRepresentation::GetVehicleDataItem(
+ const std::string& name, const std::string& key) const {
+ policy_table::VehicleDataItems result;
+ utils::dbms::SQLQuery query(db());
+
+ if (!query.Prepare(sql_pt::kSelectVehicleDataItem)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
+ return result;
+ }
+
+ query.Bind(0, name);
+ query.Bind(1, key);
+
+ while (query.Next()) {
+ auto vdi = PopulateVDIFromQuery(query);
+ if (!vdi.is_initialized()) {
+ return policy_table::VehicleDataItems();
+ }
+
+ utils::dbms::SQLQuery param_query(db());
+ if (policy_table::VehicleDataItem::kStruct ==
+ static_cast<std::string>(vdi.type)) {
+ if (!param_query.Prepare(sql_pt::kSelectVehicleDataItemParams)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrent select statement of vehicle data item. "
+ << param_query.LastError().text());
+ return policy_table::VehicleDataItems();
+ }
+
+ param_query.Bind(0, name);
+ param_query.Bind(1, key);
+
+ while (param_query.Next()) {
+ const auto param_with_diff_versions = GetVehicleDataItem(
+ param_query.GetString(2), param_query.GetString(3));
+ if (!param_with_diff_versions.is_initialized()) {
+ return policy_table::VehicleDataItems();
+ }
+ for (const auto& param : param_with_diff_versions) {
+ vdi.params->push_back(param);
+ }
+ }
+ }
+
+ result.push_back(vdi);
+ }
+ if (!result.empty()) {
+ result.mark_initialized();
+ }
+
+ return result;
+}
+
+policy_table::VehicleDataItem SQLPTRepresentation::PopulateVDIFromQuery(
+ const utils::dbms::SQLQuery& query) const {
+ policy_table::VehicleDataItem result;
+
+ result.name = query.GetString(0);
+ result.type = query.GetString(1);
+ result.key = query.GetString(2);
+ result.mandatory = query.GetBoolean(3);
+
+ if (!query.IsNull(4)) {
+ *result.array = query.GetBoolean(4);
+ }
+ if (!query.IsNull(5)) {
+ *result.since = query.GetString(5);
+ }
+ if (!query.IsNull(6)) {
+ *result.until = query.GetString(6);
+ }
+ if (!query.IsNull(7)) {
+ *result.removed = query.GetBoolean(7);
+ }
+ if (!query.IsNull(8)) {
+ *result.deprecated = query.GetBoolean(8);
+ }
+ if (!query.IsNull(9)) {
+ *result.minvalue = query.GetInteger(9);
+ }
+ if (!query.IsNull(10)) {
+ *result.maxvalue = query.GetInteger(10);
+ }
+ if (!query.IsNull(11)) {
+ *result.minsize = query.GetUInteger(11);
+ }
+ if (!query.IsNull(12)) {
+ *result.maxsize = query.GetUInteger(12);
+ }
+ if (!query.IsNull(13)) {
+ *result.minlength = query.GetUInteger(13);
+ }
+ if (!query.IsNull(14)) {
+ *result.maxlength = query.GetUInteger(14);
+ }
+ result.params->mark_initialized();
+
+ result.mark_initialized();
+ return result;
+}
+
+bool SQLPTRepresentation::InsertVehicleDataItem(
+ const policy_table::VehicleDataItem& vehicle_data_item) {
+ utils::dbms::SQLQuery query(db());
+
+ if (!vehicle_data_item.is_initialized() || !vehicle_data_item.is_valid()) {
+ LOG4CXX_ERROR(logger_, "Vehicle data item is not initialized.");
+ return false;
+ }
+
+ if (VehicleDataItemExists(vehicle_data_item)) {
+ LOG4CXX_INFO(logger_,
+ static_cast<std::string>(vehicle_data_item.key)
+ << " is already stored.");
+ return true;
+ }
+
+ if (!query.Prepare(sql_pt::kInsertVehicleDataItem)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
+ return false;
+ }
+
+ query.Bind(0, vehicle_data_item.name);
+ query.Bind(1, vehicle_data_item.type);
+ query.Bind(2, vehicle_data_item.key);
+ query.Bind(3, vehicle_data_item.mandatory);
+ vehicle_data_item.array.is_initialized()
+ ? query.Bind(4, *vehicle_data_item.array)
+ : query.Bind(4);
+ vehicle_data_item.since.is_initialized()
+ ? query.Bind(5, *vehicle_data_item.since)
+ : query.Bind(5);
+ vehicle_data_item.until.is_initialized()
+ ? query.Bind(6, *vehicle_data_item.until)
+ : query.Bind(6);
+ vehicle_data_item.removed.is_initialized()
+ ? query.Bind(7, *vehicle_data_item.removed)
+ : query.Bind(7);
+ vehicle_data_item.deprecated.is_initialized()
+ ? query.Bind(8, *vehicle_data_item.deprecated)
+ : query.Bind(8);
+ vehicle_data_item.minvalue.is_initialized()
+ ? query.Bind(9, *vehicle_data_item.minvalue)
+ : query.Bind(9);
+ vehicle_data_item.maxvalue.is_initialized()
+ ? query.Bind(10, *vehicle_data_item.maxvalue)
+ : query.Bind(10);
+ vehicle_data_item.minsize.is_initialized()
+ ? query.Bind(11, static_cast<int64_t>(*vehicle_data_item.minsize))
+ : query.Bind(11);
+ vehicle_data_item.maxsize.is_initialized()
+ ? query.Bind(12, static_cast<int64_t>(*vehicle_data_item.maxsize))
+ : query.Bind(12);
+ vehicle_data_item.minlength.is_initialized()
+ ? query.Bind(13, static_cast<int64_t>(*vehicle_data_item.minlength))
+ : query.Bind(13);
+ vehicle_data_item.maxlength.is_initialized()
+ ? query.Bind(14, static_cast<int64_t>(*vehicle_data_item.maxlength))
+ : query.Bind(14);
+
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to insert vehicle data item: "
+ << static_cast<std::string>(vehicle_data_item.key)
+ << ". Error: " << query.LastError().text());
+ return false;
+ }
+
+ if (vehicle_data_item.params->is_initialized()) {
+ std::map<std::string, std::string> stored_vehicle_data_item_params;
+ for (const auto& param : *(vehicle_data_item.params)) {
+ if (!InsertVehicleDataItem(param)) {
+ return false;
+ }
+
+ if (stored_vehicle_data_item_params.end() !=
+ stored_vehicle_data_item_params.find(param.name)) {
+ LOG4CXX_DEBUG(logger_, "Parameter already stored.");
+ continue;
+ };
+
+ if (!query.Prepare(sql_pt::kInsertVehicleDataItemParams)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrent select statement of vehicle data item. "
+ << query.LastError().text());
+ return false;
+ }
+
+ query.Bind(0, vehicle_data_item.name);
+ query.Bind(1, vehicle_data_item.key);
+ query.Bind(2, param.name);
+ query.Bind(3, param.key);
+
+ if (!query.Exec() || !query.Reset()) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Failed to insert to vehicle data item relations helper table: "
+ << static_cast<std::string>(param.key)
+ << ". Error: " << query.LastError().text());
+ return false;
+ }
+ stored_vehicle_data_item_params[param.name] = param.key;
+ }
+ }
+
+ return true;
+}
+
+policy_table::VehicleDataItems
+SQLPTRepresentation::SelectCompositeVehicleDataItems() const {
+ utils::dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!query.Prepare(sql_pt::kSelectCompositeVehicleDataItemsKey)) {
+ LOG4CXX_ERROR(logger_,
+ "Incorrect statement for parameterized vehicle data items");
+ return policy_table::VehicleDataItems();
+ }
+
+ policy_table::VehicleDataItems result;
+ result.mark_initialized();
+
+ while (query.Next()) {
+ const auto vdi = GetVehicleDataItem(query.GetString(0), query.GetString(1));
+ if (!vdi.is_initialized()) {
+ return policy_table::VehicleDataItems();
+ }
+ for (const auto& item : vdi) {
+ result.push_back(item);
+ }
+ }
+
+ return result;
+}
+
+policy_table::VehicleDataItems
+SQLPTRepresentation::SelectPrimitiveVehicleDataItems() const {
+ utils::dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!query.Prepare(sql_pt::kSelectPrimitiveVehicleDataItems)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Incorrect statement for non parameterized vehicle data items");
+ return policy_table::VehicleDataItems();
+ }
+
+ auto result = policy_table::VehicleDataItems();
+ result.mark_initialized();
+
+ while (query.Next()) {
+ const auto vdi = PopulateVDIFromQuery(query);
+ if (!vdi.is_initialized()) {
+ return policy_table::VehicleDataItems();
+ }
+ result.push_back(vdi);
+ }
+ return result;
+}
+
+bool SQLPTRepresentation::DeleteVehicleDataItems() const {
+ utils::dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!query.Exec(sql_pt::kDeleteVehicleDataItems)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed clearing database: " << query.LastError().text());
+ return false;
+ }
+
+ if (!query.Exec(sql_pt::kDeleteVehicleDataItemParams)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed clearing database: " << query.LastError().text());
+ return false;
+ }
+
+ return true;
+}
+
} // namespace policy
diff --git a/src/components/policy/policy_regular/src/status.cc b/src/components/policy/policy_regular/src/status.cc
index 8d65c606d0..c870658622 100644
--- a/src/components/policy/policy_regular/src/status.cc
+++ b/src/components/policy/policy_regular/src/status.cc
@@ -32,7 +32,6 @@
#include "policy/status.h"
#include "policy/update_status_manager_interface.h"
-#include "utils/make_shared.h"
policy::UpToDateStatus::UpToDateStatus()
: Status("UP_TO_DATE", policy::PolicyTableStatus::StatusUpToDate) {}
@@ -44,7 +43,7 @@ void policy::UpToDateStatus::ProcessEvent(UpdateStatusManagerInterface* manager,
case kOnResetPolicyTableRequireUpdate:
case kScheduleUpdate:
case kOnResetRetrySequence:
- manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetNextStatus(std::make_shared<UpdateNeededStatus>());
break;
default:
break;
@@ -59,17 +58,19 @@ void policy::UpdateNeededStatus::ProcessEvent(
policy::UpdateStatusManagerInterface* manager, policy::UpdateEvent event) {
switch (event) {
case kOnUpdateSentOut:
- manager->SetNextStatus(utils::MakeShared<UpdatingStatus>());
+ manager->SetNextStatus(std::make_shared<UpdatingStatus>());
break;
case kOnResetPolicyTableRequireUpdate:
- manager->SetNextStatus(utils::MakeShared<UpToDateStatus>());
- manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
+ manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>());
break;
case kOnResetPolicyTableNoUpdate:
- manager->SetNextStatus(utils::MakeShared<UpToDateStatus>());
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
+ break;
+ case kPendingUpdate:
+ manager->SetNextStatus(std::make_shared<UpdatePendingStatus>());
break;
case kOnNewAppRegistered:
- manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>());
break;
default:
break;
@@ -80,6 +81,36 @@ bool policy::UpdateNeededStatus::IsUpdateRequired() const {
return true;
}
+policy::UpdatePendingStatus::UpdatePendingStatus()
+ : Status(kUpdateNeeded,
+ policy::PolicyTableStatus::StatusProcessingSnapshot) {}
+
+void policy::UpdatePendingStatus::ProcessEvent(
+ policy::UpdateStatusManagerInterface* manager, policy::UpdateEvent event) {
+ switch (event) {
+ case kOnUpdateSentOut:
+ manager->SetNextStatus(std::make_shared<UpdatingStatus>());
+ break;
+ case kOnResetPolicyTableRequireUpdate:
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
+ manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>());
+ break;
+ case kOnResetPolicyTableNoUpdate:
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
+ break;
+ default:
+ break;
+ }
+}
+
+bool policy::UpdatePendingStatus::IsUpdatePending() const {
+ return true;
+}
+
+bool policy::UpdatePendingStatus::IsUpdateRequired() const {
+ return true;
+}
+
policy::UpdatingStatus::UpdatingStatus()
: Status("UPDATING", policy::PolicyTableStatus::StatusUpdatePending) {}
@@ -88,22 +119,24 @@ void policy::UpdatingStatus::ProcessEvent(
switch (event) {
case kOnValidUpdateReceived:
case kOnResetPolicyTableNoUpdate:
- manager->SetNextStatus(utils::MakeShared<UpToDateStatus>());
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
break;
case kOnNewAppRegistered:
- manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>());
break;
case kOnWrongUpdateReceived:
case kOnUpdateTimeout:
- manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetNextStatus(std::make_shared<UpdateNeededStatus>());
break;
case kOnResetPolicyTableRequireUpdate:
- manager->SetNextStatus(utils::MakeShared<UpToDateStatus>());
- manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetNextStatus(std::make_shared<UpToDateStatus>());
+ manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>());
break;
case kScheduleUpdate:
+ manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>());
+ break;
case kOnResetRetrySequence:
- manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>());
+ manager->SetNextStatus(std::make_shared<UpdateNeededStatus>());
break;
default:
break;
diff --git a/src/components/policy/policy_regular/src/update_status_manager.cc b/src/components/policy/policy_regular/src/update_status_manager.cc
index 941113c753..1ba3d0f394 100644
--- a/src/components/policy/policy_regular/src/update_status_manager.cc
+++ b/src/components/policy/policy_regular/src/update_status_manager.cc
@@ -33,7 +33,6 @@
#include "policy/update_status_manager.h"
#include "policy/policy_listener.h"
#include "utils/logger.h"
-#include "utils/make_shared.h"
namespace policy {
@@ -41,7 +40,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
UpdateStatusManager::UpdateStatusManager()
: listener_(NULL)
- , current_status_(utils::MakeShared<UpToDateStatus>())
+ , current_status_(std::make_shared<UpToDateStatus>())
, last_processed_event_(kNoEvent)
, apps_search_in_progress_(false)
, app_registered_from_non_consented_device_(true) {}
@@ -55,11 +54,16 @@ void UpdateStatusManager::ProcessEvent(UpdateEvent event) {
DoTransition();
}
-void UpdateStatusManager::SetNextStatus(utils::SharedPtr<Status> status) {
+void UpdateStatusManager::PendingUpdate() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ProcessEvent(kPendingUpdate);
+}
+
+void UpdateStatusManager::SetNextStatus(std::shared_ptr<Status> status) {
next_status_ = status;
}
-void UpdateStatusManager::SetPostponedStatus(utils::SharedPtr<Status> status) {
+void UpdateStatusManager::SetPostponedStatus(std::shared_ptr<Status> status) {
postponed_status_ = status;
}
@@ -101,6 +105,15 @@ void UpdateStatusManager::OnResetRetrySequence() {
ProcessEvent(kOnResetRetrySequence);
}
+void UpdateStatusManager::OnExistedApplicationAdded(
+ const bool is_update_required) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (is_update_required) {
+ current_status_.reset(new UpToDateStatus());
+ ProcessEvent(kScheduleUpdate);
+ }
+}
+
void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) {
LOG4CXX_AUTO_TRACE(logger_);
if (kDeviceAllowed != consent) {
@@ -108,14 +121,11 @@ void UpdateStatusManager::OnNewApplicationAdded(const DeviceConsent consent) {
return;
}
app_registered_from_non_consented_device_ = false;
- ProcessEvent(kOnNewAppRegistered);
-}
-
-void UpdateStatusManager::OnPolicyInit(bool is_update_required) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (is_update_required) {
+ if (kOnResetRetrySequence == last_processed_event_) {
current_status_.reset(new UpToDateStatus());
ProcessEvent(kScheduleUpdate);
+ } else {
+ ProcessEvent(kOnNewAppRegistered);
}
}
@@ -173,7 +183,10 @@ void UpdateStatusManager::DoTransition() {
current_status_ = next_status_;
next_status_.reset();
LOG4CXX_DEBUG(logger_, "last_processed_event_ = " << last_processed_event_);
- if (last_processed_event_ != kScheduleManualUpdate) {
+ const bool is_update_pending =
+ policy::StatusProcessingSnapshot == current_status_->get_status();
+
+ if (last_processed_event_ != kScheduleManualUpdate && !is_update_pending) {
listener_->OnUpdateStatusChanged(current_status_->get_status_string());
}
if (!postponed_status_) {
diff --git a/src/components/policy/policy_regular/src/usage_statistics/counter.cc b/src/components/policy/policy_regular/src/usage_statistics/counter.cc
index 60e34a929d..340f900cac 100644
--- a/src/components/policy/policy_regular/src/usage_statistics/counter.cc
+++ b/src/components/policy/policy_regular/src/usage_statistics/counter.cc
@@ -33,16 +33,16 @@
#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_STATISTICS_MANAGER_H_
#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_STATISTICS_MANAGER_H_
-#include <cassert>
#include "policy/usage_statistics/counter.h"
+#include <cassert>
#include "utils/date_time.h"
-#include "utils/make_shared.h"
+
#include "utils/timer_task_impl.h"
namespace usage_statistics {
GlobalCounter::GlobalCounter(
- utils::SharedPtr<StatisticsManager> statistics_manager,
+ std::shared_ptr<StatisticsManager> statistics_manager,
GlobalCounterId counter_type)
: counter_type_(counter_type), statistics_manager_(statistics_manager) {}
@@ -52,7 +52,7 @@ void GlobalCounter::operator++() const {
}
}
-AppCounter::AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager,
+AppCounter::AppCounter(std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id,
AppCounterId counter_type)
: app_id_(app_id)
@@ -65,7 +65,7 @@ void AppCounter::operator++() const {
}
}
-AppInfo::AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager,
+AppInfo::AppInfo(std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id,
AppInfoId info_type)
: app_id_(app_id)
@@ -79,7 +79,7 @@ void AppInfo::Update(const std::string& new_info) const {
}
AppStopwatchImpl::AppStopwatchImpl(
- utils::SharedPtr<StatisticsManager> statistics_manager,
+ std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id)
: app_id_(app_id)
, stopwatch_type_(SECONDS_HMI_NONE)
@@ -90,7 +90,7 @@ AppStopwatchImpl::AppStopwatchImpl(
, time_out_(60) {}
AppStopwatchImpl::AppStopwatchImpl(
- utils::SharedPtr<StatisticsManager> statistics_manager,
+ std::shared_ptr<StatisticsManager> statistics_manager,
const std::string& app_id,
uint32_t timeout)
: app_id_(app_id)
@@ -103,8 +103,7 @@ AppStopwatchImpl::AppStopwatchImpl(
void AppStopwatchImpl::Start(AppStopwatchId stopwatch_type) {
stopwatch_type_ = stopwatch_type;
- timer_.Start(time_out_ * date_time::DateTime::MILLISECONDS_IN_SECOND,
- timer::kPeriodic);
+ timer_.Start(time_out_ * date_time::MILLISECONDS_IN_SECOND, timer::kPeriodic);
}
void AppStopwatchImpl::Switch(AppStopwatchId stopwatch_type) {
diff --git a/src/components/policy/policy_regular/test/CMakeLists.txt b/src/components/policy/policy_regular/test/CMakeLists.txt
index bd6af96867..428a056882 100644
--- a/src/components/policy/policy_regular/test/CMakeLists.txt
+++ b/src/components/policy/policy_regular/test/CMakeLists.txt
@@ -49,7 +49,7 @@ collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}")
set(LIBRARIES
gmock
Utils
- Policy
+ PolicyStatic
UsageStatistics
)
diff --git a/src/components/policy/policy_regular/test/PTU.json b/src/components/policy/policy_regular/test/PTU.json
index f53ceb735b..dbf16598f0 100644
--- a/src/components/policy/policy_regular/test/PTU.json
+++ b/src/components/policy/policy_regular/test/PTU.json
@@ -296,6 +296,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -308,6 +309,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -320,6 +322,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -332,6 +335,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -358,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -378,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -398,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -417,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_regular/test/PTU2.json b/src/components/policy/policy_regular/test/PTU2.json
index 6f24ee97f6..2c0063f69a 100644
--- a/src/components/policy/policy_regular/test/PTU2.json
+++ b/src/components/policy/policy_regular/test/PTU2.json
@@ -296,6 +296,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -308,6 +309,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -320,6 +322,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -332,6 +335,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -358,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -378,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -398,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -417,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_regular/test/PTU3.json b/src/components/policy/policy_regular/test/PTU3.json
index e1aaa953c5..d579fd3e3f 100644
--- a/src/components/policy/policy_regular/test/PTU3.json
+++ b/src/components/policy/policy_regular/test/PTU3.json
@@ -296,6 +296,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -308,6 +309,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -320,6 +322,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -332,6 +335,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -358,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -378,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -398,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -417,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_regular/test/PTU4.json b/src/components/policy/policy_regular/test/PTU4.json
index dad00de53e..84b6404010 100644
--- a/src/components/policy/policy_regular/test/PTU4.json
+++ b/src/components/policy/policy_regular/test/PTU4.json
@@ -296,6 +296,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -308,6 +309,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -320,6 +322,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -332,6 +335,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -358,6 +362,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -378,6 +383,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -398,6 +404,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -417,6 +424,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_regular/test/access_remote_impl_test.cc b/src/components/policy/policy_regular/test/access_remote_impl_test.cc
index d086144d86..d9dba45ef2 100644
--- a/src/components/policy/policy_regular/test/access_remote_impl_test.cc
+++ b/src/components/policy/policy_regular/test/access_remote_impl_test.cc
@@ -30,14 +30,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "policy/access_remote_impl.h"
+#include "gtest/gtest.h"
namespace policy {
TEST(AccessRemoteImplTest, CheckModuleType) {
AccessRemoteImpl access_remote;
- access_remote.cache_->pt_ = new policy_table::Table();
+ access_remote.cache_->pt_ = std::make_shared<policy_table::Table>();
// No application
EXPECT_FALSE(access_remote.CheckModuleType("1234", policy_table::MT_RADIO));
@@ -81,7 +81,7 @@ TEST(AccessRemoteImplTest, GetGroups) {
ApplicationOnDevice who = {"dev1", "1234"};
access_remote.hmi_types_[who].push_back(policy_table::AHT_REMOTE_CONTROL);
- access_remote.cache_->pt_ = new policy_table::Table();
+ access_remote.cache_->pt_ = std::make_shared<policy_table::Table>();
policy_table::ApplicationPolicies& apps =
access_remote.cache_->pt_->policy_table.app_policies_section.apps;
apps["1234"].groups.push_back("group_default");
diff --git a/src/components/policy/policy_regular/test/counter_test.cc b/src/components/policy/policy_regular/test/counter_test.cc
index 2c0ab73c0b..c09347fd9c 100644
--- a/src/components/policy/policy_regular/test/counter_test.cc
+++ b/src/components/policy/policy_regular/test/counter_test.cc
@@ -31,11 +31,11 @@
#include "gmock/gmock.h"
-#include "policy/usage_statistics/mock_statistics_manager.h"
#include "policy/usage_statistics/counter.h"
+#include "policy/usage_statistics/mock_statistics_manager.h"
-using ::testing::StrictMock;
using ::testing::InSequence;
+using ::testing::StrictMock;
namespace test {
namespace components {
@@ -53,7 +53,7 @@ TEST(
StatisticsManagerIncrementMethod1Arg,
GlobalCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
GlobalCounter reboots_counter(msm, SYNC_REBOOTS);
// Assert
@@ -67,7 +67,7 @@ TEST(
StatisticsManagerIncrementMethod1Arg,
GlobalCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
GlobalCounter reboots_counter(msm, SYNC_REBOOTS);
// Assert
@@ -82,7 +82,7 @@ TEST(
StatisticsManagerIncrementMethod2Args,
AppCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS);
// Assert
@@ -96,7 +96,7 @@ TEST(
StatisticsManagerIncrementMethod2Args,
AppCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS);
// Assert
@@ -110,7 +110,7 @@ TEST(
TEST(StatisticsManagerSetMethod,
AppInfoUpdateMethod_CallONCE_StatisticsManagerSetMethodCalledONCE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI);
// Assert
@@ -123,7 +123,7 @@ TEST(StatisticsManagerSetMethod,
TEST(StatisticsManagerSetMethod,
AppInfoUpdateMethod_CallTWICE_StatisticsManagerSetMethodCalledTWICE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI);
// Assert
@@ -138,7 +138,7 @@ TEST(StatisticsManagerSetMethod,
TEST(StatisticsManagerAddMethod,
AppStopwatchStartMethod_CallONCE_StatisticsManagerAddMethodCalledONCE) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
const std::uint32_t time_out = 1;
AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out);
@@ -155,7 +155,7 @@ TEST(StatisticsManagerAddMethod,
TEST(StatisticsManagerAddMethod,
DISABLED_AppStopwatchSwitchMethod_Call_StatisticsManagerAddMethodCalled) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp");
hmi_full_stopwatch.Start(SECONDS_HMI_FULL);
@@ -171,7 +171,7 @@ TEST(
StatisticsManagerAddMethod,
DISABLED_AppStopwatchSwitchMethod_CallAnd1SecSleepAfter_StatisticsManagerAddMethodCalledWith1SecTimespan) {
// Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
+ auto msm = std::make_shared<StrictMock<MockStatisticsManager> >();
const std::uint32_t time_out = 1;
AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out);
diff --git a/src/components/policy/policy_regular/test/generated_code_test.cc b/src/components/policy/policy_regular/test/generated_code_test.cc
index 671103bf51..2b79ef67fe 100644
--- a/src/components/policy/policy_regular/test/generated_code_test.cc
+++ b/src/components/policy/policy_regular/test/generated_code_test.cc
@@ -49,8 +49,9 @@ TEST(PolicyGeneratedCodeTest, TestValidPTPreloadJsonIsValid) {
std::ifstream json_file("sdl_preloaded_pt.json");
ASSERT_TRUE(json_file.is_open());
Json::Value valid_table;
- Json::Reader reader;
- ASSERT_TRUE(reader.parse(json_file, valid_table));
+ Json::CharReaderBuilder reader_builder;
+ ASSERT_TRUE(
+ Json::parseFromStream(reader_builder, json_file, &valid_table, nullptr));
Table table(&valid_table);
table.SetPolicyTableType(rpc::policy_table_interface_base::PT_PRELOADED);
ASSERT_RPCTYPE_VALID(table);
@@ -60,8 +61,9 @@ TEST(PolicyGeneratedCodeTest, TestValidPTUpdateJsonIsValid) {
std::ifstream json_file("valid_sdl_pt_update.json");
ASSERT_TRUE(json_file.is_open());
Json::Value valid_table;
- Json::Reader reader;
- ASSERT_TRUE(reader.parse(json_file, valid_table));
+ Json::CharReaderBuilder reader_builder;
+ ASSERT_TRUE(
+ Json::parseFromStream(reader_builder, json_file, &valid_table, nullptr));
Table table(&valid_table);
table.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
ASSERT_RPCTYPE_VALID(table);
diff --git a/src/components/policy/policy_regular/test/include/policy/driver_dbms.h b/src/components/policy/policy_regular/test/include/policy/driver_dbms.h
index 78b7add643..aa6fb0828b 100644
--- a/src/components/policy/policy_regular/test/include/policy/driver_dbms.h
+++ b/src/components/policy/policy_regular/test/include/policy/driver_dbms.h
@@ -152,7 +152,7 @@ class DBMS {
};
#endif // __QNX__
-} // namespace policy
+} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/policy/policy_regular/test/include/policy/mock_pt_ext_representation.h b/src/components/policy/policy_regular/test/include/policy/mock_pt_ext_representation.h
deleted file mode 100644
index 34ad6af5a6..0000000000
--- a/src/components/policy/policy_regular/test/include/policy/mock_pt_ext_representation.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/* Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_PT_EXT_REPRESENTATION_H_
-#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_PT_EXT_REPRESENTATION_H_
-
-#include <string>
-#include <vector>
-
-#include "gmock/gmock.h"
-
-#include "policy/pt_ext_representation.h"
-#include "rpc_base/rpc_base.h"
-#include "policy/policy_table/types.h"
-#include "mock_pt_representation.h"
-
-namespace policy_table = ::rpc::policy_table_interface_base;
-
-namespace policy {
-class MockPTExtRepresentation : public MockPTRepresentation,
- public PTExtRepresentation {
- public:
- MOCK_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
- MOCK_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
- MOCK_METHOD2(GetDefaultHMI,
- bool(const std::string& app_id, std::string* default_hmi));
- MOCK_METHOD0(ResetUserConsent, bool());
- MOCK_METHOD0(ResetDeviceConsents, bool());
- MOCK_METHOD0(ResetAppConsents, bool());
- MOCK_METHOD3(GetUserPermissionsForDevice,
- bool(const std::string&, StringArray*, StringArray*));
- MOCK_METHOD3(GetPermissionsForApp,
- bool(const std::string&,
- const std::string&,
- FunctionalIdType* group_types));
- MOCK_METHOD2(GetDeviceGroupsFromPolicies,
- bool(policy_table::Strings*, policy_table::Strings*));
- MOCK_METHOD2(
- GetUserFriendlyMsg,
- std::vector<UserFriendlyMessage>(const std::vector<std::string>& msg_code,
- const std::string& language));
- MOCK_METHOD8(SetDeviceData,
- bool(const std::string& device_id,
- const std::string& hardware,
- const std::string& firmware,
- const std::string& os,
- const std::string& os_version,
- const std::string& carrier,
- const uint32_t number_of_ports,
- const std::string& connection_type));
- MOCK_METHOD6(SetDeviceData,
- bool(const std::string&,
- const std::string&,
- const std::string&,
- const std::string&,
- const std::string&,
- const std::string&));
- MOCK_METHOD2(SetMaxNumberPorts,
- bool(const std::string& device_id,
- unsigned int number_of_ports));
- MOCK_METHOD3(SetUserPermissionsForDevice,
- bool(const std::string&,
- const StringArray&,
- const StringArray&));
- MOCK_METHOD1(SetUserPermissionsForApp, bool(const PermissionConsent&));
- MOCK_METHOD1(IncreaseStatisticsData, bool(StatisticsType type));
- MOCK_METHOD3(SetAppRegistrationLanguage,
- bool(const std::string& app_id,
- LanguageType type,
- const std::string& language));
- MOCK_METHOD3(SetMetaInfo,
- bool(const std::string& ccpu_version,
- const std::string& wers_country_code,
- const std::string& vin));
- MOCK_METHOD0(IsMetaInfoPresent, bool());
- MOCK_METHOD1(SetSystemLanguage, bool(const std::string& language));
- MOCK_METHOD0(GetKmFromSuccessfulExchange, int());
- MOCK_METHOD0(GetDayFromScsExchange, int());
- MOCK_METHOD0(GetIgnitionsFromScsExchange, int());
- MOCK_CONST_METHOD1(Increment, void(const std::string& type));
- MOCK_CONST_METHOD2(Increment,
- void(const std::string& app_id, const std::string& type));
- MOCK_CONST_METHOD3(Set,
- void(const std::string& app_id,
- const std::string& type,
- const std::string& value));
- MOCK_CONST_METHOD3(Add,
- void(const std::string& app_id,
- const std::string& type,
- int seconds));
- MOCK_CONST_METHOD3(CountUnconsentedGroups,
- bool(const std::string& app_id,
- const std::string& device_id,
- int* count));
- MOCK_METHOD1(GetFunctionalGroupNames, bool(FunctionalGroupNames& names));
- MOCK_CONST_METHOD1(CleanupUnpairedDevices, bool(const DeviceIds& device_ids));
- MOCK_METHOD2(ReactOnUserDevConsentForApp,
- bool(const std::string& app_id, bool is_device_allowed));
- MOCK_METHOD1(SetPredataPolicy, bool(const std::string& app_id));
- MOCK_METHOD2(SetIsPredata, bool(const std::string& app_id, bool is_predata));
- MOCK_CONST_METHOD2(SetUnpairedDevice,
- bool(const std::string& device_id, bool unpaired));
- MOCK_CONST_METHOD1(UnpairedDevicesList, bool(DeviceIds* device_ids));
- MOCK_CONST_METHOD2(RemoveAppConsentForGroup,
- bool(const std::string& policy_app_id,
- const std::string& functional_group));
-};
-
-} // namespace policy
-
-#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_PT_EXT_REPRESENTATION_H_
diff --git a/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h b/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h
index 8a47e7ca97..8cf3884c11 100644
--- a/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h
+++ b/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h
@@ -37,9 +37,9 @@
#include "gmock/gmock.h"
+#include "policy/policy_table/types.h"
#include "policy/pt_representation.h"
#include "rpc_base/rpc_base.h"
-#include "policy/policy_table/types.h"
namespace policy_table = ::rpc::policy_table_interface_base;
@@ -64,7 +64,6 @@ class MockPTRepresentation : virtual public PTRepresentation {
MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>* seconds));
MOCK_METHOD2(GetPriority,
bool(const std::string& app_id, std::string* priority));
- MOCK_CONST_METHOD0(GetVehicleInfo, const VehicleInfo());
MOCK_METHOD1(SetVINValue, bool(const std::string& value));
MOCK_METHOD2(
GetUserFriendlyMsg,
@@ -76,7 +75,7 @@ class MockPTRepresentation : virtual public PTRepresentation {
MOCK_METHOD0(Close, bool());
MOCK_METHOD0(Clear, bool());
MOCK_METHOD0(Drop, bool());
- MOCK_CONST_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>());
+ MOCK_CONST_METHOD0(GenerateSnapshot, std::shared_ptr<policy_table::Table>());
MOCK_METHOD1(Save, bool(const policy_table::Table& table));
MOCK_CONST_METHOD0(UpdateRequired, bool());
MOCK_METHOD1(SaveUpdateRequired, void(bool value));
diff --git a/src/components/policy/policy_regular/test/include/policy/mock_update_status_manager.h b/src/components/policy/policy_regular/test/include/policy/mock_update_status_manager.h
index 924284c8cc..e66d2012cb 100644
--- a/src/components/policy/policy_regular/test/include/policy/mock_update_status_manager.h
+++ b/src/components/policy/policy_regular/test/include/policy/mock_update_status_manager.h
@@ -47,8 +47,8 @@ class MockUpdateStatusManager : public UpdateStatusManager {
MOCK_METHOD0(OnWrongUpdateReceived, void());
MOCK_METHOD1(OnResetDefaultPT, void(bool is_update_required));
MOCK_METHOD0(OnResetRetrySequence, void());
+ MOCK_METHOD1(OnExistedApplicationAdded, void(const bool is_update_required));
MOCK_METHOD0(OnNewApplicationAdded, void());
- MOCK_METHOD1(OnPolicyInit, void(bool is_update_required));
MOCK_METHOD0(GetUpdateStatus, PolicyTableStatus());
};
diff --git a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
index e4e361c52c..37ef1afc0c 100644
--- a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
+++ b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
@@ -30,39 +30,39 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <vector>
+#include <ctime>
#include <fstream>
#include <string>
-#include <ctime>
+#include <vector>
-#include "json/reader.h"
-#include "json/writer.h"
#include "gtest/gtest.h"
+#include "json/writer.h"
+#include "utils/jsoncpp_reader_wrapper.h"
#include "config_profile/profile.h"
+#include "connection_handler/connection_handler.h"
+#include "policy/mock_cache_manager.h"
+#include "policy/mock_policy_listener.h"
+#include "policy/mock_policy_settings.h"
+#include "policy/mock_update_status_manager.h"
#include "policy/policy_manager_impl.h"
#include "policy/policy_table/enums.h"
#include "policy/policy_table/types.h"
-#include "policy/mock_policy_settings.h"
-#include "policy/mock_policy_listener.h"
-#include "policy/mock_cache_manager.h"
-#include "policy/mock_update_status_manager.h"
-#include "utils/macro.h"
-#include "utils/file_system.h"
#include "utils/date_time.h"
-#include "utils/make_shared.h"
+#include "utils/file_system.h"
#include "utils/gen_hash.h"
+#include "utils/macro.h"
+
#include "policy/mock_access_remote.h"
-using ::testing::ReturnRef;
-using ::testing::DoAll;
-using ::testing::SetArgReferee;
-using ::testing::NiceMock;
using ::testing::_;
-using ::testing::SetArgReferee;
using ::testing::AtLeast;
+using ::testing::DoAll;
+using ::testing::NiceMock;
using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::SetArgReferee;
using ::policy::PolicyManagerImpl;
using ::policy::PolicyTable;
@@ -77,6 +77,14 @@ namespace custom_str = utils::custom_string;
typedef std::multimap<std::string, policy_table::Rpcs&>
UserConsentPromptToRpcsConnections;
+typedef std::shared_ptr<policy_table::Table> PolicyTableSPtr;
+
+namespace {
+std::string kSpeed = "speed";
+std::string kRPM = "rpm";
+std::string kFuelLevel = "fuelLevel";
+} // namespace
+
template <typename T>
std::string NumberToString(T Number) {
std::ostringstream ss;
@@ -142,18 +150,22 @@ class PolicyManagerImplTest : public ::testing::Test {
protected:
PolicyManagerImpl* manager;
- MockCacheManagerInterface* cache_manager;
+ NiceMock<MockCacheManagerInterface>* cache_manager;
NiceMock<MockPolicyListener> listener;
+ NiceMock<MockUpdateStatusManager> update_status_manager;
const std::string device_id;
- utils::SharedPtr<access_remote_test::MockAccessRemote> access_remote;
+ std::shared_ptr<access_remote_test::MockAccessRemote> access_remote;
+ PolicyTableSPtr default_pt_snapshot_;
void SetUp() OVERRIDE {
manager = new PolicyManagerImpl();
manager->set_listener(&listener);
- cache_manager = new MockCacheManagerInterface();
+ cache_manager = new NiceMock<MockCacheManagerInterface>();
manager->set_cache_manager(cache_manager);
- access_remote = new access_remote_test::MockAccessRemote();
+ access_remote = std::make_shared<access_remote_test::MockAccessRemote>();
manager->set_access_remote(access_remote);
+ // Json::Value table = createPTforLoad();
+ default_pt_snapshot_ = std::make_shared<policy_table::Table>();
}
void TearDown() OVERRIDE {
@@ -169,6 +181,78 @@ class PolicyManagerImplTest : public ::testing::Test {
return ::testing::AssertionFailure() << ::rpc::PrettyFormat(report);
}
}
+
+ void PrepareUpdateWithFunctionalGroupingContent(policy_table::Table& update) {
+ using namespace application_manager;
+
+ update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
+
+ policy_table::Rpcs rpcs;
+ rpcs.mark_initialized();
+
+ policy_table::Rpc rpc;
+ rpc.mark_initialized();
+
+ policy_table::RpcParameters rpc_params;
+ rpc_params.mark_initialized();
+ rpc_params.hmi_levels.push_back(
+ rpc::policy_table_interface_base::HmiLevel::HL_FULL);
+ rpc_params.hmi_levels.push_back(
+ rpc::policy_table_interface_base::HmiLevel::HL_BACKGROUND);
+
+ (*rpc_params.parameters).push_back(kRPM);
+ (*rpc_params.parameters).push_back(kSpeed);
+
+ rpc["GetVehicleData"] = rpc_params;
+ rpcs.rpcs = rpc;
+
+ policy_table::FunctionalGroupings fg;
+ fg["TestGroup1"] = rpcs;
+
+ update.policy_table.functional_groupings = fg;
+
+ policy_table::ApplicationParams app_params;
+ app_params.mark_initialized();
+ app_params.priority =
+ rpc::policy_table_interface_base::Priority::P_COMMUNICATION;
+ app_params.groups.push_back("TestGroup1");
+ update.policy_table.app_policies_section.apps["1234"] = app_params;
+ }
+
+ void ExpectOnPermissionsUpdated() {
+ std::string dev_id_1 = "dev_id_1";
+ std::string app_id = "1234";
+
+ EXPECT_CALL(*cache_manager, IsDefaultPolicy(app_id)).WillOnce(Return(true));
+ EXPECT_CALL(*access_remote, IsAppRemoteControl(_)).WillOnce(Return(true));
+
+ FunctionalGroupNames fg_names;
+ fg_names[0] =
+ std::make_pair<std::string, std::string>("fg_name_1", "fg_name_2");
+ EXPECT_CALL(*cache_manager, GetFunctionalGroupNames(_))
+ .WillOnce(DoAll(SetArgReferee<0>(fg_names), Return(true)));
+
+ std::vector<std::string> device_ids;
+ device_ids.push_back(dev_id_1);
+ EXPECT_CALL(listener, GetDevicesIds(app_id))
+ .WillRepeatedly(Return(device_ids));
+
+ int32_t group_id = 0;
+ FunctionalGroupIDs group_ids;
+ group_ids.push_back(group_id);
+ FunctionalIdType group_types;
+ group_types[GroupType::kTypeGeneral] = group_ids;
+ EXPECT_CALL(*access_remote, GetPermissionsForApp(dev_id_1, app_id, _))
+ .WillRepeatedly(DoAll(SetArgReferee<2>(group_types), Return(true)));
+
+ EXPECT_CALL(listener, OnPermissionsUpdated(dev_id_1, app_id, _, _))
+ .Times(1);
+
+ EXPECT_CALL(listener, GetAppName(_))
+ .WillOnce(Return(custom_str::CustomString("")));
+
+ EXPECT_CALL(listener, OnUpdateStatusChanged(_)).Times(1);
+ }
};
class PolicyManagerImplTest2 : public ::testing::Test {
@@ -178,6 +262,8 @@ class PolicyManagerImplTest2 : public ::testing::Test {
, app_id2("1010101010")
, dev_id1("XXX123456789ZZZ")
, dev_id2("08-00-27-CE-76-FE")
+ , dev_handle1(123456789)
+ , dev_handle2(1010101010)
, PTU_request_types(Json::arrayValue) {}
protected:
@@ -191,6 +277,8 @@ class PolicyManagerImplTest2 : public ::testing::Test {
const std::string app_id2;
const std::string dev_id1;
const std::string dev_id2;
+ const connection_handler::DeviceHandle dev_handle1;
+ const connection_handler::DeviceHandle dev_handle2;
Json::Value PTU_request_types;
NiceMock<policy_handler_test::MockPolicySettings> policy_settings_;
const std::string kAppStorageFolder = "storage_PolicyManagerImplTest2";
@@ -202,8 +290,9 @@ class PolicyManagerImplTest2 : public ::testing::Test {
manager = new PolicyManagerImpl();
ON_CALL(policy_settings_, app_storage_folder())
.WillByDefault(ReturnRef(kAppStorageFolder));
+ ON_CALL(policy_settings_, use_full_app_id()).WillByDefault(Return(true));
manager->set_listener(&listener);
- const char* levels[] = {"BACKGROUND", "FULL", "LIMITED", "NONE"};
+ const char* levels[] = {"FULL", "LIMITED", "BACKGROUND", "NONE"};
hmi_level.assign(levels, levels + sizeof(levels) / sizeof(levels[0]));
srand(time(NULL));
index = rand() % 3;
@@ -221,16 +310,19 @@ class PolicyManagerImplTest2 : public ::testing::Test {
const Json::Value GetPTU(std::string file_name) {
// Get PTU
std::ifstream ifile(file_name);
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
json = root.toStyledString();
}
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
// Load Json to cache
- EXPECT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+ EXPECT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
return root;
}
@@ -238,9 +330,58 @@ class PolicyManagerImplTest2 : public ::testing::Test {
file_system::remove_directory_content(kAppStorageFolder);
ON_CALL(policy_settings_, app_storage_folder())
.WillByDefault(ReturnRef(kAppStorageFolder));
+ ON_CALL(policy_settings_, use_full_app_id()).WillByDefault(Return(true));
ASSERT_TRUE(manager->InitPT(file_name, &policy_settings_));
}
+ Json::Value AddWidgetSupportToPt(const std::string& section_name,
+ const uint32_t group_number) {
+ std::ifstream ifile("sdl_preloaded_pt.json");
+ Json::CharReaderBuilder reader_builder;
+ Json::Value root(Json::objectValue);
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
+ auto& groups =
+ root["policy_table"]["app_policies"][section_name]["groups"];
+ if (groups.empty()) {
+ groups = Json::Value(Json::arrayValue);
+ }
+ groups[group_number] = Json::Value("WidgetSupport");
+ }
+ ifile.close();
+ return root;
+ }
+
+ std::string AddWidgetSupportToPt(Json::Value* root,
+ const std::string& section_name,
+ const uint32_t group_number) {
+ if (root) {
+ auto& groups =
+ (*root)["policy_table"]["app_policies"][section_name]["groups"];
+ if (groups.empty()) {
+ groups = Json::Value(Json::arrayValue);
+ }
+ groups[group_number] = Json::Value("WidgetSupport");
+ return root->toStyledString();
+ }
+ return std::string();
+ }
+
+ std::string AddWidgetSupportToFunctionalGroups(Json::Value* root,
+ const std::string& rpc_name,
+ const std::string& hmi_level) {
+ if (root) {
+ Json::Value val(Json::objectValue);
+ Json::Value val2(Json::arrayValue);
+ val2[0] = hmi_level;
+ val[rpc_name]["hmi_levels"] = val2;
+ (*root)["policy_table"]["functional_groupings"]["WidgetSupport"]["rpcs"] =
+ val;
+ return root->toStyledString();
+ }
+ return std::string();
+ }
+
void AddRTtoPT(const std::string& update_file_name,
const std::string& section_name,
const uint32_t rt_number,
@@ -270,12 +411,13 @@ class PolicyManagerImplTest2 : public ::testing::Test {
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
// Add app
- manager->AddApplication(section_name, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id1, section_name, HmiTypes(policy_table::AHT_DEFAULT));
// Check app gets RequestTypes from pre_DataConsent of app_policies
// section
PT_request_types = manager->GetAppRequestTypes(section_name);
EXPECT_EQ(rt_number, PT_request_types.size());
- EXPECT_CALL(listener, OnPendingPermissionChange(section_name)).Times(1);
+ EXPECT_CALL(listener, OnPendingPermissionChange(_, section_name)).Times(1);
Json::Value root = GetPTU(update_file_name);
// Get App Request Types from PTU
@@ -291,7 +433,7 @@ class PolicyManagerImplTest2 : public ::testing::Test {
PT_request_types.size());
::policy::AppPermissions permissions =
- manager->GetAppPermissionsChanges(section_name);
+ manager->GetAppPermissionsChanges(dev_id1, section_name);
EXPECT_TRUE(permissions.requestTypeChanged);
}
@@ -352,7 +494,7 @@ class PolicyManagerImplTest2 : public ::testing::Test {
// Get cache
::policy::CacheManagerInterfaceSPtr cache = manager->GetCache();
// Get table_snapshot
- utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot();
+ std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot();
// Set functional groupings from policy table
input_functional_groupings = table->policy_table.functional_groupings;
}
@@ -381,12 +523,12 @@ Json::Value CreatePTforLoad() {
"}"
"},"
"\"notifications_per_minute_by_priority\": {"
- "\"emergency\": 1,"
- "\"navigation\": 2,"
- "\"VOICECOMM\": 3,"
- "\"communication\": 4,"
- "\"normal\": 5,"
- "\"none\": 6"
+ "\"EMERGENCY\": 1,"
+ "\"NAVIGATION\": 2,"
+ "\"VOICECOM\": 3,"
+ "\"COMMUNICATION\": 4,"
+ "\"NORMAL\": 5,"
+ "\"NONE\": 6"
"},"
"\"vehicle_make\" : \"MakeT\","
"\"vehicle_model\" : \"ModelT\","
@@ -450,8 +592,9 @@ Json::Value CreatePTforLoad() {
"}"
"}");
Json::Value table(Json::objectValue);
- Json::Reader reader;
- EXPECT_TRUE(reader.parse(load_table, table));
+ utils::JsonReader reader;
+
+ EXPECT_TRUE(reader.parse(load_table, &table));
return table;
}
@@ -466,6 +609,7 @@ TEST_F(PolicyManagerImplTest, GetNotificationsNumber) {
TEST_F(PolicyManagerImplTest2, GetNotificationsNumberAfterPTUpdate) {
// Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
Json::Value table = CreatePTforLoad();
manager->ForcePTExchange();
manager->SetSendOnUpdateSentOut(false);
@@ -475,48 +619,56 @@ TEST_F(PolicyManagerImplTest2, GetNotificationsNumberAfterPTUpdate) {
// Act
const std::string json = table.toStyledString();
::policy::BinaryMessage msg(json.begin(), json.end());
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+
EXPECT_CALL(listener, OnUpdateStatusChanged(_));
- EXPECT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
- std::string priority = "emergency";
+ std::string priority = "EMERGENCY";
uint32_t notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(1u, notif_number);
- priority = "navigation";
+ priority = "NAVIGATION";
notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(2u, notif_number);
- priority = "emergency";
+ priority = "EMERGENCY";
notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(1u, notif_number);
- priority = "VOICECOMM";
+ priority = "VOICECOM";
notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(3u, notif_number);
- priority = "normal";
+ priority = "NORMAL";
notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(5u, notif_number);
- priority = "none";
+ priority = "NONE";
notif_number = manager->GetNotificationsNumber(priority);
EXPECT_EQ(6u, notif_number);
}
TEST_F(PolicyManagerImplTest2, IsAppRevoked_SetRevokedAppID_ExpectAppRevoked) {
+ CreateLocalPT("sdl_preloaded_pt.json");
// Arrange
std::ifstream ifile("sdl_preloaded_pt.json");
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
root["policy_table"]["app_policies"][app_id1] = Json::nullValue;
json = root.toStyledString();
}
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
- ASSERT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+
EXPECT_TRUE(manager->IsApplicationRevoked(app_id1));
}
@@ -534,11 +686,14 @@ TEST_F(PolicyManagerImplTest2,
"Life",
2,
"Bluetooth");
- EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(app_id1))
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(_, app_id1))
.WillRepeatedly(Return(dev_id1));
manager->SetUserConsentForDevice(dev_id1, true);
// Add app from consented device. App will be assigned with default policies
- manager->AddApplication(app_id1, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id1, app_id1, HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener, GetDevicesIds(app_id1))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
// Check before action
policy_table::RpcParameters rpc_parameters;
rpc_parameters.hmi_levels.push_back(policy_table::HL_FULL);
@@ -557,17 +712,20 @@ TEST_F(PolicyManagerImplTest2,
ASSERT_TRUE(output.list_of_allowed_params.empty());
// Act
std::ifstream ifile("sdl_preloaded_pt.json");
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
root["policy_table"]["app_policies"][app_id1] = Json::nullValue;
json = root.toStyledString();
}
ifile.close();
::policy::BinaryMessage msg(json.begin(), json.end());
- ASSERT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
manager->CheckPermissions(
dev_id1, app_id1, std::string("FULL"), "Alert", input_params, output);
@@ -576,6 +734,130 @@ TEST_F(PolicyManagerImplTest2,
ASSERT_TRUE(output.list_of_allowed_params.empty());
}
+TEST_F(
+ PolicyManagerImplTest2,
+ CheckPermissions_PersistsWidgetAppPermissionsAfter_PTU_ExpectRPCAllowed) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ (manager->GetCache())->AddDevice(dev_id1, "Bluetooth");
+ (manager->GetCache())
+ ->SetDeviceData(dev_id1,
+ "hardware IPX",
+ "v.8.0.1",
+ "Android",
+ "4.4.2",
+ "Life",
+ 2,
+ "Bluetooth");
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(_, app_id1))
+ .WillRepeatedly(Return(dev_id1));
+ manager->SetUserConsentForDevice(dev_id1, true);
+ // Add app from consented device. App will be assigned with default policies
+ manager->AddApplication(
+ app_id1, app_id1, HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener, GetDevicesIds(app_id1))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
+ // Act
+ const char* const rpc_name = "CreateWindow";
+ const char* const hmi_level = "NONE";
+ const uint32_t group_number = 0;
+ Json::Value root = AddWidgetSupportToPt("default", group_number);
+ std::string json =
+ AddWidgetSupportToFunctionalGroups(&root, rpc_name, hmi_level);
+
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+
+ ::policy::RPCParams input_params;
+ ::policy::CheckPermissionResult output;
+
+ manager->CheckPermissions(
+ dev_id1, app_id1, hmi_level, rpc_name, input_params, output);
+
+ // Check RPC is allowed
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ ASSERT_TRUE(output.list_of_allowed_params.empty());
+ // Act
+ json = AddWidgetSupportToPt(&root, app_id1, group_number);
+ msg = BinaryMessage(json.begin(), json.end());
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+
+ output.hmi_level_permitted = ::policy::kRpcDisallowed;
+ manager->CheckPermissions(
+ dev_id1, app_id1, hmi_level, rpc_name, input_params, output);
+ // Check RPC is allowed
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ ASSERT_TRUE(output.list_of_allowed_params.empty());
+}
+
+TEST_F(
+ PolicyManagerImplTest2,
+ CheckPermissions_AbsenceOfWidgetPermissionsAfter_PTU_ExpectRPCDisallowed) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ (manager->GetCache())->AddDevice(dev_id1, "Bluetooth");
+ (manager->GetCache())
+ ->SetDeviceData(dev_id1,
+ "hardware IPX",
+ "v.8.0.1",
+ "Android",
+ "4.4.2",
+ "Life",
+ 2,
+ "Bluetooth");
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(_, app_id1))
+ .WillRepeatedly(Return(dev_id1));
+ manager->SetUserConsentForDevice(dev_id1, true);
+ // Add app from consented device. App will be assigned with default policies
+ manager->AddApplication(
+ dev_id1, app_id1, HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener, GetDevicesIds(app_id1))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
+ // Act
+ const char* const rpc_name = "DeleteWindow";
+ const char* const hmi_level = "NONE";
+ const uint32_t group_number = 0;
+ Json::Value root = AddWidgetSupportToPt("default", group_number);
+ std::string json =
+ AddWidgetSupportToFunctionalGroups(&root, rpc_name, hmi_level);
+
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+
+ ::policy::RPCParams input_params;
+ ::policy::CheckPermissionResult output;
+
+ manager->CheckPermissions(
+ dev_id1, app_id1, hmi_level, rpc_name, input_params, output);
+
+ // Check RPC is allowed
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ ASSERT_TRUE(output.list_of_allowed_params.empty());
+ output.hmi_level_permitted = ::policy::kRpcDisallowed;
+ // Act
+ root["policy_table"]["app_policies"][app_id1]["groups"] =
+ Json::Value(Json::arrayValue);
+ root["policy_table"]["app_policies"][app_id1]["groups"][group_number] =
+ Json::Value("Base-4");
+ json = root.toStyledString();
+ msg = BinaryMessage(json.begin(), json.end());
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+
+ manager->CheckPermissions(
+ dev_id1, app_id1, hmi_level, rpc_name, input_params, output);
+ // Check RPC is disallowed
+ EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
+ ASSERT_TRUE(output.list_of_allowed_params.empty());
+}
+
TEST_F(PolicyManagerImplTest2,
CheckPermissions_SetAppIDwithPolicies_ExpectRPCAllowed) {
// Arrange
@@ -591,17 +873,18 @@ TEST_F(PolicyManagerImplTest2,
"Life",
2,
"Bluetooth"));
- EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired("1234"))
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(_, "1234"))
.WillRepeatedly(Return(dev_id1));
manager->SetUserConsentForDevice(dev_id1, true);
// Add app from consented device. App will be assigned with default policies
- manager->AddApplication("1234", HmiTypes(policy_table::AHT_MEDIA));
+ manager->AddApplication(dev_id1, "1234", HmiTypes(policy_table::AHT_MEDIA));
// Emulate PTU with new policies for app added above
std::ifstream ifile("sdl_preloaded_pt.json");
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
std::string json;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
// Add AppID with policies
root["policy_table"]["app_policies"]["1234"] =
Json::Value(Json::objectValue);
@@ -632,7 +915,9 @@ TEST_F(PolicyManagerImplTest2,
::policy::BinaryMessage msg(json.begin(), json.end());
// Load Json to cache
- EXPECT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
policy_table::RpcParameters rpc_parameters;
rpc_parameters.hmi_levels.push_back(policy_table::HL_FULL);
@@ -705,6 +990,8 @@ TEST_F(PolicyManagerImplTest, ResetPT) {
TEST_F(PolicyManagerImplTest, LoadPT_SetPT_PTIsLoaded) {
// Arrange
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillOnce(Return(default_pt_snapshot_));
manager->ForcePTExchange();
manager->OnUpdateStarted();
Json::Value table = CreatePTforLoad();
@@ -720,24 +1007,254 @@ TEST_F(PolicyManagerImplTest, LoadPT_SetPT_PTIsLoaded) {
const std::string json = table.toStyledString();
::policy::BinaryMessage msg(json.begin(), json.end());
- utils::SharedPtr<policy_table::Table> snapshot =
- utils::MakeShared<policy_table::Table>(update.policy_table);
+ std::shared_ptr<policy_table::Table> snapshot =
+ std::make_shared<policy_table::Table>(update.policy_table);
// Assert
EXPECT_CALL(*cache_manager, GenerateSnapshot()).WillOnce(Return(snapshot));
+ EXPECT_CALL(*cache_manager, GetVehicleDataItems())
+ .WillOnce(Return(std::vector<policy_table::VehicleDataItem>()));
EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true));
- EXPECT_CALL(listener, GetAppName("1234"))
- .WillOnce(Return(custom_str::CustomString("")));
- EXPECT_CALL(listener, OnUpdateStatusChanged(_));
+ EXPECT_CALL(listener, GetDevicesIds("1234"))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
EXPECT_CALL(*cache_manager, SaveUpdateRequired(false));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+
EXPECT_CALL(*cache_manager, TimeoutResponse());
EXPECT_CALL(*cache_manager, SecondsBetweenRetries(_));
+ EXPECT_CALL(listener, OnUpdateStatusChanged(_));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+}
+
+TEST_F(PolicyManagerImplTest, LoadPT_FunctionalGroup_removeRPC_SendUpdate) {
+ // Arrange
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillOnce(Return(default_pt_snapshot_));
+ manager->ForcePTExchange();
+ manager->OnUpdateStarted();
+ Json::Value table = CreatePTforLoad();
+ policy_table::Table update(&table);
+
+ PrepareUpdateWithFunctionalGroupingContent(update);
+
+ std::shared_ptr<policy_table::Table> snapshot =
+ std::make_shared<policy_table::Table>(update.policy_table);
- EXPECT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+ const auto& fg_found =
+ update.policy_table.functional_groupings.find("TestGroup1");
+ fg_found->second.rpcs.erase("GetVehicleData");
+
+ ASSERT_TRUE(IsValid(update));
+
+ const std::string json = update.ToJsonValue().toStyledString();
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+
+ // Assert
+ EXPECT_CALL(*cache_manager, GetVehicleDataItems())
+ .WillOnce(Return(std::vector<policy_table::VehicleDataItem>()));
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillRepeatedly(Return(snapshot));
+ EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true));
+ ExpectOnPermissionsUpdated();
+
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+}
+
+TEST_F(PolicyManagerImplTest,
+ LoadPT_FunctionalGroup_removeRPCParams_SendUpdate) {
+ // Arrange
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillOnce(Return(default_pt_snapshot_));
+ manager->ForcePTExchange();
+ manager->OnUpdateStarted();
+ Json::Value table = CreatePTforLoad();
+ policy_table::Table update(&table);
+
+ PrepareUpdateWithFunctionalGroupingContent(update);
+
+ std::shared_ptr<policy_table::Table> snapshot =
+ std::make_shared<policy_table::Table>(update.policy_table);
+
+ const auto& fg_found =
+ update.policy_table.functional_groupings.find("TestGroup1");
+ policy_table::RpcParameters& new_rpc_params =
+ fg_found->second.rpcs["GetVehicleData"];
+ new_rpc_params.parameters->erase(new_rpc_params.parameters->begin());
+
+ ASSERT_TRUE(IsValid(update));
+
+ const std::string json = update.ToJsonValue().toStyledString();
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+
+ // Assert
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillRepeatedly(Return(snapshot));
+ EXPECT_CALL(*cache_manager, GetVehicleDataItems())
+ .WillOnce(Return(std::vector<policy_table::VehicleDataItem>()));
+ EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true));
+ ExpectOnPermissionsUpdated();
+
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+}
+
+TEST_F(PolicyManagerImplTest,
+ LoadPT_FunctionalGroup_removeRPC_HMILevels_SendUpdate) {
+ // Arrange
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillOnce(Return(default_pt_snapshot_));
+ manager->ForcePTExchange();
+ manager->OnUpdateStarted();
+ Json::Value table = CreatePTforLoad();
+ policy_table::Table update(&table);
+
+ PrepareUpdateWithFunctionalGroupingContent(update);
+
+ std::shared_ptr<policy_table::Table> snapshot =
+ std::make_shared<policy_table::Table>(update.policy_table);
+
+ const auto& fg_found =
+ update.policy_table.functional_groupings.find("TestGroup1");
+ policy_table::RpcParameters& new_rpc_params =
+ fg_found->second.rpcs["GetVehicleData"];
+ new_rpc_params.hmi_levels.erase(new_rpc_params.hmi_levels.begin());
+
+ ASSERT_TRUE(IsValid(update));
+
+ const std::string json = update.ToJsonValue().toStyledString();
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+
+ // Assert
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillRepeatedly(Return(snapshot));
+ EXPECT_CALL(*cache_manager, GetVehicleDataItems())
+ .WillOnce(Return(std::vector<policy_table::VehicleDataItem>()));
+ EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true));
+ ExpectOnPermissionsUpdated();
+
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+}
+
+TEST_F(PolicyManagerImplTest,
+ LoadPT_FunctionalGroup_addRPC_HMILevels_SendUpdate) {
+ // Arrange
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillOnce(Return(default_pt_snapshot_));
+ manager->ForcePTExchange();
+ manager->OnUpdateStarted();
+ Json::Value table = CreatePTforLoad();
+ policy_table::Table update(&table);
+
+ PrepareUpdateWithFunctionalGroupingContent(update);
+
+ std::shared_ptr<policy_table::Table> snapshot =
+ std::make_shared<policy_table::Table>(update.policy_table);
+
+ const auto& fg_found =
+ update.policy_table.functional_groupings.find("TestGroup1");
+ policy_table::RpcParameters& new_rpc_params =
+ fg_found->second.rpcs["GetVehicleData"];
+ new_rpc_params.hmi_levels.push_back(
+ rpc::policy_table_interface_base::HmiLevel::HL_LIMITED);
+
+ ASSERT_TRUE(IsValid(update));
+
+ const std::string json = update.ToJsonValue().toStyledString();
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+
+ // Assert
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillRepeatedly(Return(snapshot));
+ EXPECT_CALL(*cache_manager, GetVehicleDataItems())
+ .WillOnce(Return(std::vector<policy_table::VehicleDataItem>()));
+ EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true));
+ ExpectOnPermissionsUpdated();
+
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+}
+
+TEST_F(PolicyManagerImplTest, LoadPT_FunctionalGroup_addRPCParams_SendUpdate) {
+ using namespace application_manager;
+ // Arrange
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillOnce(Return(default_pt_snapshot_));
+ manager->ForcePTExchange();
+ manager->OnUpdateStarted();
+ Json::Value table = CreatePTforLoad();
+ policy_table::Table update(&table);
+
+ PrepareUpdateWithFunctionalGroupingContent(update);
+
+ std::shared_ptr<policy_table::Table> snapshot =
+ std::make_shared<policy_table::Table>(update.policy_table);
+
+ const auto& fg_found =
+ update.policy_table.functional_groupings.find("TestGroup1");
+ policy_table::RpcParameters& new_rpc_params =
+ fg_found->second.rpcs["GetVehicleData"];
+ (*new_rpc_params.parameters).push_back(kFuelLevel);
+
+ ASSERT_TRUE(IsValid(update));
+
+ const std::string json = update.ToJsonValue().toStyledString();
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+
+ // Assert
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillRepeatedly(Return(snapshot));
+ EXPECT_CALL(*cache_manager, GetVehicleDataItems())
+ .WillOnce(Return(std::vector<policy_table::VehicleDataItem>()));
+ EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true));
+ ExpectOnPermissionsUpdated();
+
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
+}
+
+TEST_F(PolicyManagerImplTest, LoadPT_FunctionalGroup_NoUpdate_DONT_SendUpdate) {
+ // Arrange
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillOnce(Return(default_pt_snapshot_));
+ manager->ForcePTExchange();
+ manager->OnUpdateStarted();
+ Json::Value table = CreatePTforLoad();
+ policy_table::Table update(&table);
+
+ PrepareUpdateWithFunctionalGroupingContent(update);
+
+ std::shared_ptr<policy_table::Table> snapshot =
+ std::make_shared<policy_table::Table>(update.policy_table);
+
+ ASSERT_TRUE(IsValid(update));
+
+ const std::string json = update.ToJsonValue().toStyledString();
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+
+ // Assert
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillRepeatedly(Return(snapshot));
+ EXPECT_CALL(*cache_manager, GetVehicleDataItems())
+ .WillOnce(Return(std::vector<policy_table::VehicleDataItem>()));
+ EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true));
+
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kSuccess,
+ manager->LoadPT("file_pt_update.json", msg));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kSuccess);
}
TEST_F(PolicyManagerImplTest, LoadPT_SetInvalidUpdatePT_PTIsNotLoaded) {
// Arrange
Json::Value table(Json::objectValue);
+ EXPECT_CALL(*cache_manager, GenerateSnapshot())
+ .WillOnce(Return(default_pt_snapshot_));
manager->ForcePTExchange();
manager->OnUpdateStarted();
@@ -751,15 +1268,23 @@ TEST_F(PolicyManagerImplTest, LoadPT_SetInvalidUpdatePT_PTIsNotLoaded) {
std::string json = table.toStyledString();
::policy::BinaryMessage msg(json.begin(), json.end());
+ std::shared_ptr<policy_table::Table> snapshot =
+ std::make_shared<policy_table::Table>(update.policy_table);
+ ON_CALL(*cache_manager, GenerateSnapshot()).WillByDefault(Return(snapshot));
+ ON_CALL(*cache_manager, GetVehicleDataItems())
+ .WillByDefault(Return(std::vector<policy_table::VehicleDataItem>()));
+
// Assert
- EXPECT_CALL(*cache_manager, GenerateSnapshot()).Times(0);
EXPECT_CALL(*cache_manager, ApplyUpdate(_)).Times(0);
EXPECT_CALL(listener, GetAppName(_)).Times(0);
- EXPECT_CALL(listener, OnUpdateStatusChanged(_)).Times(1);
EXPECT_CALL(*cache_manager, SaveUpdateRequired(false)).Times(0);
EXPECT_CALL(*cache_manager, TimeoutResponse()).Times(0);
EXPECT_CALL(*cache_manager, SecondsBetweenRetries(_)).Times(0);
- EXPECT_FALSE(manager->LoadPT("file_pt_update.json", msg));
+ ASSERT_EQ(PolicyManager::PtProcessingResult::kWrongPtReceived,
+ manager->LoadPT("file_pt_update.json", msg));
+
+ EXPECT_CALL(listener, OnUpdateStatusChanged(_));
+ manager->OnPTUFinished(PolicyManager::PtProcessingResult::kWrongPtReceived);
}
TEST_F(PolicyManagerImplTest2,
@@ -782,8 +1307,8 @@ TEST_F(
AddApplication_AddNewApplicationFromDeviceWithoutConsent_ExpectUpdateRequired) {
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
- ::policy::StatusNotifier notifyer =
- manager->AddApplication(app_id1, HmiTypes(policy_table::AHT_DEFAULT));
+ ::policy::StatusNotifier notifyer = manager->AddApplication(
+ dev_id1, app_id1, HmiTypes(policy_table::AHT_DEFAULT));
DCHECK(notifyer);
(*notifyer)();
EXPECT_EQ("UPDATE_NEEDED", manager->GetPolicyTableStatus());
@@ -795,9 +1320,10 @@ TEST_F(
// Arrange
// RequestTypes for default & preDataConsent are different
CreateLocalPT("ptu_requestType.json");
- manager->AddApplication(app_id1, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id1, app_id1, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_FALSE(manager->IsPredataPolicy(app_id1));
- manager->ReactOnUserDevConsentForApp(app_id1, true);
+ manager->ReactOnUserDevConsentForApp(dev_handle1, app_id1, true);
EXPECT_FALSE(manager->IsPredataPolicy(app_id1));
EXPECT_TRUE((manager->GetCache())->IsDefaultPolicy(app_id1));
}
@@ -808,10 +1334,11 @@ TEST_F(
// Arrange
// RequestTypes for default & preDataConsent are the same
CreateLocalPT("ptu2_requestType.json");
- manager->AddApplication(app_id1, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id1, app_id1, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_FALSE(manager->IsPredataPolicy(app_id1));
- EXPECT_CALL(listener, OnPendingPermissionChange(app_id1)).Times(0);
- manager->ReactOnUserDevConsentForApp(app_id1, true);
+ EXPECT_CALL(listener, OnPendingPermissionChange(_, app_id1)).Times(0);
+ manager->ReactOnUserDevConsentForApp(dev_handle1, app_id1, true);
EXPECT_FALSE(manager->IsPredataPolicy(app_id1));
EXPECT_TRUE((manager->GetCache())->IsDefaultPolicy(app_id1));
}
@@ -822,10 +1349,46 @@ TEST_F(
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+ ON_CALL(listener, GetDevicesIds(_))
+ .WillByDefault(Return(transport_manager::DeviceList()));
GetPTU("valid_sdl_pt_update.json");
EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
// Try to add existing app
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ // Check no update required
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+}
+
+TEST_F(PolicyManagerImplTest2, UpdateApplication_AppServices) {
+ std::string kServiceType = "MEDIA";
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+ ON_CALL(listener, GetDevicesIds(_))
+ .WillByDefault(Return(transport_manager::DeviceList()));
+ GetPTU("valid_sdl_pt_update.json");
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+ // Try to add existing app
+ policy_table::AppServiceParameters app_service_parameters =
+ policy_table::AppServiceParameters();
+ manager->GetAppServiceParameters(app_id2, &app_service_parameters);
+
+ ASSERT_FALSE(app_service_parameters.find(kServiceType) ==
+ app_service_parameters.end());
+
+ auto service_names = *(app_service_parameters[kServiceType].service_names);
+
+ ASSERT_TRUE(service_names.is_initialized());
+ ASSERT_EQ(service_names.size(), 2u);
+ EXPECT_EQ(static_cast<std::string>(service_names[0]), "SDL App");
+ EXPECT_EQ(static_cast<std::string>(service_names[1]), "SDL Music");
+
+ auto handled_rpcs = app_service_parameters[kServiceType].handled_rpcs;
+
+ ASSERT_TRUE(handled_rpcs.is_initialized());
+ EXPECT_EQ(handled_rpcs[0].function_id, 41);
+
// Check no update required
EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
}
@@ -834,21 +1397,24 @@ TEST_F(PolicyManagerImplTest2,
PTUpdatedAt_DaysNotExceedLimit_ExpectNoUpdateRequired) {
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
- TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ date_time::TimeDuration current_time = date_time::getCurrentTime();
const int kSecondsInDay = 60 * 60 * 24;
- int days = current_time.tv_sec / kSecondsInDay;
+ int days = date_time::getSecs(current_time) / kSecondsInDay;
EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+ ON_CALL(listener, GetDevicesIds(_))
+ .WillByDefault(Return(transport_manager::DeviceList()));
GetPTU("valid_sdl_pt_update.json");
EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
::policy::Counters counter = ::policy::Counters::DAYS_AFTER_EPOCH;
// Set PT was updated 10 days ago (limit is 30 days for now)
// So no limit exceeded
manager->PTUpdatedAt(counter, days - 10);
- manager->OnAppRegisteredOnMobile(app_id2);
+ manager->OnAppRegisteredOnMobile(dev_id2, app_id2);
EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
}
@@ -862,18 +1428,10 @@ TEST_F(PolicyManagerImplTest2, ForcePTExchange_ExpectUpdateNeeded) {
EXPECT_EQ("UPDATE_NEEDED", manager->GetPolicyTableStatus());
}
-TEST_F(PolicyManagerImplTest2, OnSystemReady) {
- // Arrange
- CreateLocalPT("sdl_preloaded_pt.json");
- // Check
- EXPECT_CALL(listener, OnSystemInfoUpdateRequired());
- manager->OnSystemReady();
-}
-
TEST_F(PolicyManagerImplTest2, ResetRetrySequence) {
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
- manager->ResetRetrySequence();
+ manager->ResetRetrySequence(ResetRetryCountType::kResetWithStatusUpdate);
EXPECT_EQ("UPDATE_NEEDED", manager->GetPolicyTableStatus());
manager->SetSendOnUpdateSentOut(false);
manager->OnUpdateStarted();
@@ -883,9 +1441,10 @@ TEST_F(PolicyManagerImplTest2, ResetRetrySequence) {
TEST_F(PolicyManagerImplTest2, NextRetryTimeout_ExpectTimeoutsFromPT) {
// Arrange
std::ifstream ifile("sdl_preloaded_pt.json");
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
Json::Value seconds_between_retries = Json::Value(Json::arrayValue);
seconds_between_retries =
root["policy_table"]["module_config"]["seconds_between_retries"];
@@ -894,24 +1453,23 @@ TEST_F(PolicyManagerImplTest2, NextRetryTimeout_ExpectTimeoutsFromPT) {
uint32_t timeout_after_x_seconds =
root["policy_table"]["module_config"]["timeout_after_x_seconds"]
.asInt() *
- date_time::DateTime::MILLISECONDS_IN_SECOND;
+ date_time::MILLISECONDS_IN_SECOND;
const uint32_t first_retry = timeout_after_x_seconds;
EXPECT_EQ(first_retry, manager->NextRetryTimeout());
- uint32_t next_retry = first_retry +
- seconds_between_retries[0].asInt() *
- date_time::DateTime::MILLISECONDS_IN_SECOND;
+ uint32_t next_retry = first_retry + seconds_between_retries[0].asInt() *
+ date_time::MILLISECONDS_IN_SECOND;
EXPECT_EQ(next_retry, manager->NextRetryTimeout());
- next_retry = first_retry + next_retry +
- seconds_between_retries[1].asInt() *
- date_time::DateTime::MILLISECONDS_IN_SECOND;
+ next_retry =
+ first_retry + next_retry +
+ seconds_between_retries[1].asInt() * date_time::MILLISECONDS_IN_SECOND;
EXPECT_EQ(next_retry, manager->NextRetryTimeout());
- next_retry = first_retry + next_retry +
- seconds_between_retries[2].asInt() *
- date_time::DateTime::MILLISECONDS_IN_SECOND;
+ next_retry =
+ first_retry + next_retry +
+ seconds_between_retries[2].asInt() * date_time::MILLISECONDS_IN_SECOND;
EXPECT_EQ(next_retry, manager->NextRetryTimeout());
- next_retry = first_retry + next_retry +
- seconds_between_retries[3].asInt() *
- date_time::DateTime::MILLISECONDS_IN_SECOND;
+ next_retry =
+ first_retry + next_retry +
+ seconds_between_retries[3].asInt() * date_time::MILLISECONDS_IN_SECOND;
EXPECT_EQ(next_retry, manager->NextRetryTimeout());
}
}
@@ -932,27 +1490,26 @@ TEST_F(PolicyManagerImplTest2, UpdatedPreloadedPT_ExpectLPT_IsUpdated) {
CreateLocalPT("sdl_preloaded_pt.json");
// Update preloadedPT
std::ifstream ifile("sdl_preloaded_pt.json");
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
root["policy_table"]["module_config"]["preloaded_date"] =
new_data.new_date_;
Json::Value val(Json::objectValue);
Json::Value val2(Json::arrayValue);
val2[0] = hmi_level[index];
val[new_data.new_field_value_]["hmi_levels"] = val2;
- root["policy_table"]["functional_groupings"][new_data
- .new_field_name_]["rpcs"] =
- val;
+ root["policy_table"]["functional_groupings"][new_data.new_field_name_]
+ ["rpcs"] = val;
root["policy_table"]["functional_groupings"][new_data.new_field_name_]
["user_consent_prompt"] = new_data.new_field_name_;
}
ifile.close();
- Json::StyledStreamWriter writer;
std::ofstream ofile("sdl_preloaded_pt.json");
- writer.write(ofile, root);
+ ofile << root;
ofile.flush();
ofile.close();
@@ -961,7 +1518,7 @@ TEST_F(PolicyManagerImplTest2, UpdatedPreloadedPT_ExpectLPT_IsUpdated) {
// Arrange
::policy::CacheManagerInterfaceSPtr cache = manager->GetCache();
- utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot();
+ std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot();
// Get FunctionalGroupings
policy_table::FunctionalGroupings& fc =
table->policy_table.functional_groupings;
@@ -1002,9 +1559,10 @@ TEST_F(PolicyManagerImplTest2,
RetrySequenceDelaysSeconds_Expect_CorrectValues) {
// Arrange
std::ifstream ifile("sdl_preloaded_pt.json");
- Json::Reader reader;
+ Json::CharReaderBuilder reader_builder;
Json::Value root(Json::objectValue);
- if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ if (ifile.is_open() &&
+ Json::parseFromStream(reader_builder, ifile, &root, nullptr)) {
Json::Value seconds_between_retries = Json::Value(Json::arrayValue);
seconds_between_retries =
root["policy_table"]["module_config"]["seconds_between_retries"];
@@ -1055,11 +1613,12 @@ TEST_F(PolicyManagerImplTest2,
DISABLED_GetDefaultHmi_SetDeviceAllowed_ExpectReceivedHmiCorrect) {
// Arrange
CreateLocalPT("ptu2_requestType.json");
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
// Check if app has preData policy
EXPECT_FALSE(manager->IsPredataPolicy(app_id2));
std::string default_hmi1;
- manager->GetDefaultHmi(app_id2, &default_hmi1);
+ manager->GetDefaultHmi(dev_id2, app_id2, &default_hmi1);
EXPECT_EQ("", default_hmi1);
ASSERT_TRUE((manager->GetCache())->AddDevice(dev_id2, "Bluetooth"));
ASSERT_TRUE((manager->GetCache())
@@ -1075,12 +1634,13 @@ TEST_F(PolicyManagerImplTest2,
::policy::DeviceConsent consent = manager->GetUserConsentForDevice(dev_id2);
// Check
EXPECT_EQ(::policy::DeviceConsent::kDeviceAllowed, consent);
- EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(app_id2))
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(_, app_id2))
.WillRepeatedly(Return(dev_id2));
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_TRUE((manager->GetCache())->IsDefaultPolicy(app_id2));
std::string default_hmi2;
- manager->GetDefaultHmi(app_id2, &default_hmi2);
+ manager->GetDefaultHmi(dev_id2, app_id2, &default_hmi2);
EXPECT_EQ("", default_hmi2);
}
@@ -1088,7 +1648,8 @@ TEST_F(PolicyManagerImplTest2,
GetDefaultPriority_SetDeviceAllowed_ExpectReceivedPriorityCorrect) {
// Arrange
CreateLocalPT("ptu2_requestType.json");
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
// Check if app has preData policy
EXPECT_FALSE(manager->IsPredataPolicy(app_id2));
std::string priority1;
@@ -1108,9 +1669,10 @@ TEST_F(PolicyManagerImplTest2,
::policy::DeviceConsent consent = manager->GetUserConsentForDevice(dev_id2);
// Check
EXPECT_EQ(::policy::DeviceConsent::kDeviceAllowed, consent);
- EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(app_id2))
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(_, app_id2))
.WillRepeatedly(Return(dev_id2));
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_TRUE((manager->GetCache())->IsDefaultPolicy(app_id2));
std::string priority2;
EXPECT_TRUE(manager->GetPriority(app_id2, &priority2));
@@ -1120,7 +1682,10 @@ TEST_F(PolicyManagerImplTest2,
TEST_F(PolicyManagerImplTest2, GetInitialAppData_ExpectReceivedConsentCorrect) {
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener, GetDevicesIds(app_id2))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
::policy::StringArray app_nicknames;
::policy::StringArray app_hmi_types;
manager->GetInitialAppData(app_id2, &app_nicknames, &app_hmi_types);
@@ -1162,7 +1727,8 @@ TEST_F(
CanAppKeepContext_AddAppFromUnconsentedDevice_ExpectAppCannotKeepContext) {
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
// Check if app has preData policy
EXPECT_FALSE(manager->IsPredataPolicy(app_id2));
// Check keep context in preData policy
@@ -1174,7 +1740,8 @@ TEST_F(PolicyManagerImplTest2,
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
ASSERT_TRUE((manager->GetCache())->AddDevice(dev_id2, "Bluetooth"));
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
ASSERT_TRUE((manager->GetCache())
->SetDeviceData(dev_id2,
"hardware IPX",
@@ -1187,9 +1754,10 @@ TEST_F(PolicyManagerImplTest2,
manager->SetUserConsentForDevice(dev_id2, true);
::policy::DeviceConsent consent = manager->GetUserConsentForDevice(dev_id2);
EXPECT_EQ(::policy::DeviceConsent::kDeviceAllowed, consent);
- EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(app_id2))
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(_, app_id2))
.WillRepeatedly(Return(dev_id2));
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_TRUE((manager->GetCache())->IsDefaultPolicy(app_id2));
// Check keep context in default policy
EXPECT_TRUE(manager->CanAppKeepContext(app_id2));
@@ -1199,7 +1767,10 @@ TEST_F(PolicyManagerImplTest2,
CanAppKeepContext_SetPoliciesForAppUpdated_ExpectAppCanKeepContext) {
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener, GetDevicesIds(app_id2))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
GetPTU("valid_sdl_pt_update.json");
// Check keep context in updated policies for app
EXPECT_TRUE(manager->CanAppKeepContext(app_id2));
@@ -1210,7 +1781,8 @@ TEST_F(PolicyManagerImplTest2,
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
ASSERT_TRUE((manager->GetCache())->AddDevice(dev_id2, "Bluetooth"));
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
ASSERT_TRUE((manager->GetCache())
->SetDeviceData(dev_id2,
"hardware IPX",
@@ -1223,9 +1795,10 @@ TEST_F(PolicyManagerImplTest2,
manager->SetUserConsentForDevice(dev_id2, true);
::policy::DeviceConsent consent = manager->GetUserConsentForDevice(dev_id2);
EXPECT_EQ(::policy::DeviceConsent::kDeviceAllowed, consent);
- EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(app_id2))
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(_, app_id2))
.WillRepeatedly(Return(dev_id2));
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
EXPECT_TRUE((manager->GetCache())->IsDefaultPolicy(app_id2));
// Check keep context in default policy
EXPECT_TRUE(manager->CanAppStealFocus(app_id2));
@@ -1235,7 +1808,10 @@ TEST_F(PolicyManagerImplTest2,
CanAppStealFocus_SetPoliciesForAppUpdated_ExpectAppCanStealFocus) {
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener, GetDevicesIds(app_id2))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
GetPTU("valid_sdl_pt_update.json");
// Check keep context in updated policies for app
EXPECT_TRUE(manager->CanAppKeepContext(app_id2));
@@ -1243,26 +1819,11 @@ TEST_F(PolicyManagerImplTest2,
TEST_F(PolicyManagerImplTest2, GetCurrentDeviceId) {
// Arrange
- EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(app_id2)).Times(2);
- EXPECT_EQ(custom_str::CustomString(""), manager->GetCurrentDeviceId(app_id2));
- EXPECT_EQ("", manager->GetCurrentDeviceId(app_id2));
-}
-
-TEST_F(PolicyManagerImplTest2,
- GetVehicleInfo_SetVehicleInfo_ExpectReceivedInfoCorrect) {
- // Arrange
- CreateLocalPT("sdl_preloaded_pt.json");
- GetPTU("valid_sdl_pt_update.json");
- utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->pt();
- policy_table::ModuleConfig& module_config = pt->policy_table.module_config;
- ::policy::VehicleInfo vehicle_info = manager->GetVehicleInfo();
-
- EXPECT_EQ(static_cast<std::string>(*module_config.vehicle_make),
- vehicle_info.vehicle_make);
- EXPECT_EQ(static_cast<std::string>(*module_config.vehicle_model),
- vehicle_info.vehicle_model);
- EXPECT_EQ(static_cast<std::string>(*module_config.vehicle_year),
- vehicle_info.vehicle_year);
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(dev_handle2, app_id2))
+ .Times(2);
+ EXPECT_EQ(custom_str::CustomString(""),
+ manager->GetCurrentDeviceId(dev_handle2, app_id2));
+ EXPECT_EQ("", manager->GetCurrentDeviceId(dev_handle2, app_id2));
}
TEST_F(
@@ -1289,9 +1850,12 @@ TEST_F(
->SetUserPermissionsForDevice(
dev_id2, consented_groups, disallowed_groups);
manager->SetUserConsentForDevice(dev_id2, true);
- EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(app_id2))
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(_, app_id2))
.WillRepeatedly(Return(dev_id2));
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener, GetDevicesIds(app_id2))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
GetPTU("valid_sdl_pt_update.json");
::policy::PermissionConsent perm_consent;
@@ -1310,7 +1874,7 @@ TEST_F(
perm_consent.group_permissions = groups_permissions;
manager->SetUserConsentForApp(perm_consent);
- manager->SendNotificationOnPermissionsUpdated(app_id2);
+ manager->SendNotificationOnPermissionsUpdated(dev_id2, app_id2);
std::vector< ::policy::FunctionalGroupPermission> actual_groups_permissions;
std::vector< ::policy::FunctionalGroupPermission>::iterator it;
manager->GetPermissionsForApp(dev_id2, app_id2, actual_groups_permissions);
@@ -1334,7 +1898,7 @@ TEST_F(
HertBeatTimeout_AddApp_UpdateAppPolicies_ExpectReceivedHertBeatTimeoutCorrect) {
// Arrange
CreateLocalPT("sdl_preloaded_pt.json");
- utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->pt();
+ std::shared_ptr<policy_table::Table> pt = (manager->GetCache())->pt();
::policy_table::PolicyTableType type1 =
::policy_table::PolicyTableType::PT_PRELOADED;
pt->SetPolicyTableType(type1);
@@ -1345,7 +1909,10 @@ TEST_F(
pt->ReportErrors(&report);
}
// Add new app
- manager->AddApplication(app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ manager->AddApplication(
+ dev_id2, app_id2, HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener, GetDevicesIds(app_id2))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
uint32_t result = manager->HeartBeatTimeout(app_id2);
// By default hertbeat timeout is 0
EXPECT_EQ(0u, result);
@@ -1368,6 +1935,80 @@ TEST_F(
EXPECT_EQ(heart_beat_timeout.asUInt(), result);
}
+TEST_F(PolicyManagerImplTest2, CacheManager_RemoveRPCSpecVehicleDataItems) {
+ policy_table::VehicleDataItems init;
+ policy_table::VehicleDataItem test_item;
+ test_item.name = "headLampStatus";
+ init.push_back(test_item);
+
+ const auto ret = CacheManager::CollectCustomVDItems(init);
+
+ EXPECT_EQ(0u, ret.size());
+}
+
+TEST_F(PolicyManagerImplTest2,
+ CacheManager_RemoveRPCSpecVehicleDataItemsAndRemainCustom) {
+ policy_table::VehicleDataItems init;
+ policy_table::VehicleDataItem rpc_spec_item;
+ rpc_spec_item.name = "headLampStatus";
+ policy_table::VehicleDataItem custom_item;
+ custom_item.name = "Custom";
+ init.push_back(rpc_spec_item);
+ init.push_back(custom_item);
+
+ EXPECT_EQ(2u, init.size());
+
+ const auto ret = CacheManager::CollectCustomVDItems(init);
+
+ EXPECT_EQ(1u, ret.size());
+ EXPECT_EQ(ret.at(0).name, "Custom");
+}
+
+TEST_F(PolicyManagerImplTest2, CacheManager_RemainCustomVehicleDataItems) {
+ policy_table::VehicleDataItems init;
+ policy_table::VehicleDataItem custom_item;
+ custom_item.name = "Custom";
+ init.push_back(custom_item);
+
+ EXPECT_EQ(1u, init.size());
+
+ const auto& ret = CacheManager::CollectCustomVDItems(init);
+
+ EXPECT_EQ(1u, ret.size());
+}
+
+TEST_F(PolicyManagerImplTest2,
+ CacheManager_CollectCustomItemWithRemainingRPCSpecItem) {
+ policy_table::VehicleDataItems init;
+ policy_table::VehicleDataItem rpc_spec_item;
+ rpc_spec_item.name = "headLampStatus";
+ policy_table::VehicleDataItem custom_item;
+ custom_item.name = "Custom";
+ init.push_back(rpc_spec_item);
+ init.push_back(custom_item);
+
+ EXPECT_EQ(2u, init.size());
+
+ const auto& ret = CacheManager::CollectCustomVDItems(init);
+
+ EXPECT_EQ(1u, ret.size());
+ EXPECT_EQ(ret.at(0).name, custom_item.name);
+}
+
+TEST_F(PolicyManagerImplTest2,
+ CacheManager_RemainRPCSpecVehicleDataItemsNoCustomItems) {
+ policy_table::VehicleDataItems init;
+ policy_table::VehicleDataItem custom_item;
+ custom_item.name = "headLampStatus";
+ init.push_back(custom_item);
+
+ EXPECT_EQ(1u, init.size());
+
+ const auto& ret = CacheManager::CollectCustomVDItems(init);
+
+ EXPECT_EQ(0u, ret.size());
+}
+
} // namespace policy_test
} // namespace components
} // namespace test
diff --git a/src/components/policy/policy_regular/test/ptu2_requestType.json b/src/components/policy/policy_regular/test/ptu2_requestType.json
index 1f23adda1c..9013971990 100644
--- a/src/components/policy/policy_regular/test/ptu2_requestType.json
+++ b/src/components/policy/policy_regular/test/ptu2_requestType.json
@@ -416,6 +416,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -432,6 +433,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -448,6 +450,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -464,6 +467,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -494,6 +498,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -518,6 +523,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -542,6 +548,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -565,6 +572,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_regular/test/ptu_requestType.json b/src/components/policy/policy_regular/test/ptu_requestType.json
index 998ab7f5d4..892a77f970 100644
--- a/src/components/policy/policy_regular/test/ptu_requestType.json
+++ b/src/components/policy/policy_regular/test/ptu_requestType.json
@@ -416,6 +416,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -432,6 +433,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -448,6 +450,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -464,6 +467,7 @@
"parameters": [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -494,6 +498,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -518,6 +523,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -542,6 +548,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -565,6 +572,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_regular/test/sdl_preloaded_pt.json b/src/components/policy/policy_regular/test/sdl_preloaded_pt.json
index 7f5436b5b6..ad264c8518 100644
--- a/src/components/policy/policy_regular/test/sdl_preloaded_pt.json
+++ b/src/components/policy/policy_regular/test/sdl_preloaded_pt.json
@@ -297,6 +297,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -309,6 +310,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -321,6 +323,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -333,6 +336,7 @@
"LIMITED"],
"parameters": ["accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -359,6 +363,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -379,6 +384,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -399,6 +405,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
@@ -418,6 +425,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"]
diff --git a/src/components/policy/policy_regular/test/sdl_pt_first_update.json b/src/components/policy/policy_regular/test/sdl_pt_first_update.json
index d28f70379c..440963ba48 100644
--- a/src/components/policy/policy_regular/test/sdl_pt_first_update.json
+++ b/src/components/policy/policy_regular/test/sdl_pt_first_update.json
@@ -1431,6 +1431,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1443,6 +1444,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1455,6 +1457,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1467,6 +1470,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1618,6 +1622,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1636,6 +1641,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1654,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1671,6 +1678,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_regular/test/sdl_pt_second_update.json b/src/components/policy/policy_regular/test/sdl_pt_second_update.json
index 7bf287671e..5900acbcfb 100644
--- a/src/components/policy/policy_regular/test/sdl_pt_second_update.json
+++ b/src/components/policy/policy_regular/test/sdl_pt_second_update.json
@@ -1431,6 +1431,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1443,6 +1444,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1455,6 +1457,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1467,6 +1470,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1618,6 +1622,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1636,6 +1641,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1654,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1671,6 +1678,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_regular/test/sdl_pt_update.json b/src/components/policy/policy_regular/test/sdl_pt_update.json
index cb9f9bddf6..6f5e223cae 100644
--- a/src/components/policy/policy_regular/test/sdl_pt_update.json
+++ b/src/components/policy/policy_regular/test/sdl_pt_update.json
@@ -1433,6 +1433,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1445,6 +1446,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1457,6 +1459,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1469,6 +1472,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1596,6 +1600,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1614,6 +1619,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1632,6 +1638,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1649,6 +1656,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
index a5f3741331..30536bbaa4 100644
--- a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
+++ b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc
@@ -29,40 +29,39 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <vector>
-#include <string>
+#include <stdio.h>
+#include <sys/stat.h>
#include <algorithm>
#include <fstream>
#include <memory>
-#include <stdio.h>
-#include <sys/stat.h>
+#include <string>
+#include <vector>
#include "gtest/gtest.h"
+#include "json/reader.h"
+#include "json/writer.h"
#include "policy/driver_dbms.h"
-#include "policy/sql_pt_representation.h"
-#include "policy/policy_types.h"
#include "policy/mock_policy_settings.h"
-#include "policy/policy_table/types.h"
#include "policy/policy_table/enums.h"
-#include "json/writer.h"
-#include "json/reader.h"
+#include "policy/policy_table/types.h"
+#include "policy/policy_types.h"
+#include "policy/sql_pt_representation.h"
#include "rpc_base/rpc_base.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
+
#include "utils/file_system.h"
#include "utils/sqlite_wrapper/sql_database.h"
namespace policy_table = rpc::policy_table_interface_base;
-using policy::SQLPTRepresentation;
using policy::CheckPermissionResult;
-using policy::UserFriendlyMessage;
using policy::EndpointUrls;
+using policy::SQLPTRepresentation;
+using policy::UserFriendlyMessage;
using policy::VehicleInfo;
-using testing::ReturnRef;
-using testing::Return;
-using testing::NiceMock;
using testing::Mock;
+using testing::NiceMock;
+using testing::Return;
+using testing::ReturnRef;
namespace test {
namespace components {
@@ -70,7 +69,7 @@ namespace policy_test {
using policy_handler_test::MockPolicySettings;
-class SQLPTRepresentationTest : public SQLPTRepresentation,
+class SQLPTRepresentationTest : protected SQLPTRepresentation,
public ::testing::Test {
protected:
DBMS* dbms;
@@ -78,12 +77,12 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
static const std::string kDatabaseName;
static const std::string kAppStorageFolder;
// Gtest can show message that this object doesn't destroyed
- std::auto_ptr<NiceMock<MockPolicySettings> > policy_settings_;
+ std::unique_ptr<NiceMock<MockPolicySettings> > policy_settings_;
void SetUp() OVERRIDE {
file_system::CreateDirectory(kAppStorageFolder);
reps = new SQLPTRepresentation;
- policy_settings_ = std::auto_ptr<NiceMock<MockPolicySettings> >(
+ policy_settings_ = std::unique_ptr<NiceMock<MockPolicySettings> >(
new NiceMock<MockPolicySettings>());
ON_CALL(*policy_settings_, app_storage_folder())
.WillByDefault(ReturnRef(kAppStorageFolder));
@@ -125,6 +124,13 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
policy_table::ApplicationPoliciesSection* policies) const {
return ::SQLPTRepresentation::GatherApplicationPoliciesSection(policies);
}
+
+ bool GatherAppServiceParameters(
+ const std::string& app_id,
+ policy_table::AppServiceParameters* policies) const {
+ return ::SQLPTRepresentation::GatherAppServiceParameters(app_id, policies);
+ }
+
virtual void GatherDeviceData(policy_table::DeviceData* data) const {
::SQLPTRepresentation::GatherDeviceData(data);
}
@@ -315,6 +321,23 @@ class SQLPTRepresentationTest : public SQLPTRepresentation,
app_policies["1234"]["keep_context"] = Json::Value(false);
app_policies["1234"]["steal_focus"] = Json::Value(false);
app_policies["1234"]["RequestType"] = Json::Value(Json::arrayValue);
+ app_policies["1234"]["app_services"] = Json::Value(Json::objectValue);
+ app_policies["1234"]["icon_url"] =
+ Json::Value("http:://www.sdl.com/image.png");
+ app_policies["1234"]["app_services"]["MEDIA"] =
+ Json::Value(Json::objectValue);
+ app_policies["1234"]["app_services"]["MEDIA"]["service_names"] =
+ Json::Value(Json::arrayValue);
+ app_policies["1234"]["app_services"]["MEDIA"]["service_names"][0] =
+ Json::Value("SDL App");
+ app_policies["1234"]["app_services"]["MEDIA"]["service_names"][1] =
+ Json::Value("SDL Music");
+ app_policies["1234"]["app_services"]["MEDIA"]["handled_rpcs"] =
+ Json::Value(Json::arrayValue);
+ app_policies["1234"]["app_services"]["MEDIA"]["handled_rpcs"][0] =
+ Json::Value(Json::objectValue);
+ app_policies["1234"]["app_services"]["MEDIA"]["handled_rpcs"][0]
+ ["function_id"] = Json::Value(41);
app_policies["device"] = Json::Value(Json::objectValue);
app_policies["device"]["groups"] = Json::Value(Json::arrayValue);
@@ -375,7 +398,7 @@ class SQLPTRepresentationTest2 : public ::testing::Test {
}
void TearDown() OVERRIDE {
- file_system::RemoveDirectory(kAppStorageFolder, true);
+ ASSERT_TRUE(file_system::RemoveDirectory(kAppStorageFolder, true));
delete reps;
}
@@ -405,6 +428,148 @@ class SQLPTRepresentationTest3 : public ::testing::Test {
const std::string kAppStorageFolder;
};
+TEST_F(SQLPTRepresentationTest, VehicleDataItem_Store_Item) {
+ policy_table::VehicleDataItem rpm;
+ rpm.mark_initialized();
+ rpm.name = "rpm";
+ rpm.type = "Integer";
+ rpm.key = "OEM_REF_RPM";
+ rpm.mandatory = false;
+ *rpm.array = false;
+ rpm.params->mark_initialized();
+ ASSERT_FALSE(reps->VehicleDataItemExists(rpm));
+ ASSERT_TRUE(reps->InsertVehicleDataItem(rpm));
+ ASSERT_TRUE(reps->VehicleDataItemExists(rpm));
+
+ auto rpm_retrieved = reps->GetVehicleDataItem(rpm.name, rpm.key);
+ ASSERT_EQ(rpm.ToJsonValue(), rpm_retrieved.begin()->ToJsonValue());
+}
+
+TEST_F(SQLPTRepresentationTest, VehicleDataItem_Store_Complete_Item) {
+ policy_table::VehicleDataItem message;
+ message.mark_initialized();
+ message.name = "messsageName";
+ message.type = "String";
+ message.key = "OEM_REF_MSG";
+ message.mandatory = false;
+ *message.array = false;
+ message.params->mark_initialized();
+ *message.since = "1.0";
+ *message.until = "5.0";
+ *message.removed = false;
+ *message.deprecated = false;
+ *message.minvalue = 0;
+ *message.maxvalue = 255;
+ *message.minsize = 0;
+ *message.maxsize = 255;
+ *message.minlength = 0;
+ *message.maxlength = 255;
+ ASSERT_TRUE(reps->InsertVehicleDataItem(message));
+
+ auto message_retrieved = reps->GetVehicleDataItem(message.name, message.key);
+ ASSERT_EQ(message.ToJsonValue(), message_retrieved.begin()->ToJsonValue());
+}
+
+TEST_F(SQLPTRepresentationTest, VehicleDataItem_Store_Struct) {
+ policy_table::VehicleDataItem alss;
+ alss.mark_initialized();
+ alss.name = "ambientLightSensorStatus";
+ alss.type = "AmbientLightStatus";
+ alss.key = "OEM_REF_AMB_LIGHT";
+ alss.mandatory = false;
+ alss.params->mark_initialized();
+ policy_table::VehicleDataItem lss;
+ lss.mark_initialized();
+ lss.name = "LightSensorStatus";
+ lss.type = "Struct";
+ lss.key = "OEM_REF_SEN_LIGHT";
+ lss.mandatory = false;
+ lss.params->mark_initialized();
+ lss.params->push_back(alss);
+
+ policy_table::VehicleDataItem hbo;
+ hbo.mark_initialized();
+ hbo.name = "highBeamsOn";
+ hbo.type = "Boolean";
+ hbo.key = "OEM_REF_HIGH_BEAM";
+ hbo.mandatory = true;
+ hbo.params->mark_initialized();
+ policy_table::VehicleDataItem lbo;
+ lbo.mark_initialized();
+ lbo.name = "lowBeamsOn";
+ lbo.type = "Boolean";
+ lbo.key = "OEM_REF_LOW_BEAM";
+ lbo.mandatory = false;
+ lbo.params->mark_initialized();
+ policy_table::VehicleDataItem hls;
+ hls.mark_initialized();
+ hls.name = "headLampStatus";
+ hls.type = "Struct";
+ hls.key = "OEM_REF_HLSTATUS";
+ hls.mandatory = false;
+ hls.params->mark_initialized();
+ hls.params->push_back(lss);
+ hls.params->push_back(lbo);
+ hls.params->push_back(hbo);
+ ASSERT_TRUE(reps->InsertVehicleDataItem(alss));
+ ASSERT_TRUE(reps->InsertVehicleDataItem(hls));
+
+ auto hls_retrieved = reps->GetVehicleDataItem(hls.name, hls.key);
+ ASSERT_EQ(hls.ToJsonValue(), hls_retrieved.begin()->ToJsonValue());
+}
+
+TEST_F(SQLPTRepresentationTest, VehicleDataItem_Select_NonParameterizedVDI) {
+ policy_table::VehicleDataItems non_parameterized_vdis;
+ policy_table::VehicleDataItem rpm;
+ rpm.mark_initialized();
+ rpm.name = "rpm";
+ rpm.type = "Integer";
+ rpm.key = "OEM_REF_RPM";
+ rpm.mandatory = false;
+ *rpm.array = false;
+ rpm.params->mark_initialized();
+ ASSERT_TRUE(reps->InsertVehicleDataItem(rpm));
+ policy_table::VehicleDataItem message;
+ message.mark_initialized();
+ message.name = "rpm";
+ message.type = "String";
+ message.key = "OEM_REF_MSG";
+ message.mandatory = false;
+ *message.array = false;
+ message.params->mark_initialized();
+ ASSERT_TRUE(reps->InsertVehicleDataItem(message));
+ non_parameterized_vdis.push_back(rpm);
+ non_parameterized_vdis.push_back(message);
+
+ policy_table::VehicleDataItems parameterized_vdis;
+ policy_table::VehicleDataItem alss;
+ alss.mark_initialized();
+ alss.name = "ambientLightSensorStatus";
+ alss.type = "AmbientLightStatus";
+ alss.key = "OEM_REF_AMB_LIGHT";
+ alss.mandatory = false;
+ alss.params->mark_initialized();
+ policy_table::VehicleDataItem lss;
+ lss.mark_initialized();
+ lss.name = "LightSensorStatus";
+ lss.type = "Struct";
+ lss.key = "OEM_REF_SEN_LIGHT";
+ lss.mandatory = false;
+ lss.params->mark_initialized();
+ lss.params->push_back(alss);
+ ASSERT_TRUE(reps->InsertVehicleDataItem(lss));
+ parameterized_vdis.push_back(lss);
+
+ auto non_param_vdi_retrieved = reps->SelectPrimitiveVehicleDataItems();
+
+ ASSERT_EQ(non_parameterized_vdis.ToJsonValue(),
+ non_param_vdi_retrieved.ToJsonValue());
+
+ auto param_vdi_retrieved = reps->SelectCompositeVehicleDataItems();
+ ASSERT_EQ(parameterized_vdis.ToJsonValue(),
+ param_vdi_retrieved.ToJsonValue());
+}
+
// {AKozoriz} : Unknown behavior (must try 8 times, tried 2 and opened)
TEST_F(SQLPTRepresentationTest2,
DISABLED_OpenAttemptTimeOut_ExpectCorrectNumber) {
@@ -427,8 +592,8 @@ TEST_F(SQLPTRepresentationTest,
ASSERT_TRUE(reps->RefreshDB());
// Check PT structure destroyed and tables number is 0
- // There are 29 tables in the database, now.
- const int32_t total_tables_number = 29;
+ // There are 35 tables in the database, now.
+ const int32_t total_tables_number = 37;
ASSERT_EQ(total_tables_number, dbms->FetchOneInt(query_select));
const char* query_select_count_of_iap_buffer_full =
"SELECT `count_of_iap_buffer_full` FROM `usage_and_error_count`";
@@ -1517,7 +1682,7 @@ TEST_F(SQLPTRepresentationTest,
ASSERT_TRUE(reps->Save(update));
// Act
- utils::SharedPtr<policy_table::Table> snapshot = reps->GenerateSnapshot();
+ std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot();
snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT);
// Remove fields which must be absent in snapshot
table["policy_table"]["consumer_friendly_messages"].removeMember("messages");
@@ -1540,10 +1705,10 @@ TEST_F(SQLPTRepresentationTest,
table["policy_table"]["device_data"] = Json::Value(Json::objectValue);
table["policy_table"]["module_meta"] = Json::Value(Json::objectValue);
policy_table::Table expected(&table);
- Json::StyledWriter writer;
+ Json::StreamWriterBuilder writer_builder;
// Checks
- EXPECT_EQ(writer.write(expected.ToJsonValue()),
- writer.write(snapshot->ToJsonValue()));
+ EXPECT_EQ(Json::writeString(writer_builder, expected.ToJsonValue()),
+ Json::writeString(writer_builder, snapshot->ToJsonValue()));
EXPECT_EQ(expected.ToJsonValue().toStyledString(),
snapshot->ToJsonValue().toStyledString());
}
@@ -1621,9 +1786,11 @@ TEST_F(SQLPTRepresentationTest, Save_SetPolicyTableThenSave_ExpectSavedToPT) {
const ::policy_table::Parameters& parameters = *(rpc_iter->second.parameters);
EXPECT_EQ(1u, parameters.size());
- EXPECT_TRUE(parameters.end() != std::find(parameters.begin(),
- parameters.end(),
- policy_table::Parameter::P_SPEED));
+ EXPECT_TRUE(parameters.end() !=
+ std::find(parameters.begin(),
+ parameters.end(),
+ policy_table::EnumToJsonString(
+ policy_table::Parameter::P_SPEED)));
// Check Application Policies Section
GatherApplicationPoliciesSection(&policies);
const uint32_t apps_size = 3u;
@@ -1707,6 +1874,28 @@ TEST_F(SQLPTRepresentationTest, Save_SetPolicyTableThenSave_ExpectSavedToPT) {
GatherDeviceData(&devices);
EXPECT_EQ(3u, devices.size());
+
+ const std::string kAppId = "1234";
+ const std::string kServiceType = "MEDIA";
+ policy_table::AppServiceParameters app_service_parameters;
+ GatherAppServiceParameters(kAppId, &app_service_parameters);
+ ASSERT_FALSE(app_service_parameters.find(kServiceType) ==
+ app_service_parameters.end());
+ auto service_names = *(app_service_parameters[kServiceType].service_names);
+ EXPECT_TRUE(service_names.is_initialized());
+ ASSERT_EQ(service_names.size(), 2u);
+ EXPECT_EQ(static_cast<std::string>(service_names[0]), "SDL App");
+ EXPECT_EQ(static_cast<std::string>(service_names[1]), "SDL Music");
+
+ auto handled_rpcs = app_service_parameters[kServiceType].handled_rpcs;
+
+ EXPECT_TRUE(handled_rpcs.is_initialized());
+ EXPECT_EQ(handled_rpcs[0].function_id, 41);
+
+ policy_table::ApplicationPolicies& apps = policies.apps;
+ auto icon_url = *(apps[kAppId].icon_url);
+
+ EXPECT_EQ(std::string(icon_url), "http:://www.sdl.com/image.png");
}
} // namespace policy_test
diff --git a/src/components/policy/policy_regular/test/update_status_manager_test.cc b/src/components/policy/policy_regular/test/update_status_manager_test.cc
index 9d0326d0be..459913fe72 100644
--- a/src/components/policy/policy_regular/test/update_status_manager_test.cc
+++ b/src/components/policy/policy_regular/test/update_status_manager_test.cc
@@ -30,11 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "policy/update_status_manager.h"
#include "gtest/gtest.h"
#include "policy/mock_policy_listener.h"
#include "policy/policy_manager_impl.h"
-#include "policy/update_status_manager.h"
-#include "utils/make_shared.h"
namespace test {
namespace components {
@@ -46,13 +45,13 @@ using ::testing::Return;
class UpdateStatusManagerTest : public ::testing::Test {
protected:
- utils::SharedPtr<UpdateStatusManager> manager_;
- utils::SharedPtr<MockPolicyListener> listener_;
+ std::shared_ptr<UpdateStatusManager> manager_;
+ std::shared_ptr<MockPolicyListener> listener_;
public:
UpdateStatusManagerTest()
- : manager_(utils::MakeShared<UpdateStatusManager>())
- , listener_(utils::MakeShared<MockPolicyListener>()) {}
+ : manager_(std::make_shared<UpdateStatusManager>())
+ , listener_(std::make_shared<MockPolicyListener>()) {}
void SetUp() OVERRIDE {
manager_->set_listener(listener_.get());
@@ -63,20 +62,6 @@ class UpdateStatusManagerTest : public ::testing::Test {
};
TEST_F(UpdateStatusManagerTest,
- StringifiedUpdateStatus_SetStatuses_ExpectCorrectStringifiedStatuses) {
- // Arrange
- manager_->OnPolicyInit(false);
- // Check
- EXPECT_EQ("UP_TO_DATE", manager_->StringifiedUpdateStatus());
- manager_->OnPolicyInit(true);
- // Check
- EXPECT_EQ("UPDATE_NEEDED", manager_->StringifiedUpdateStatus());
- manager_->OnUpdateSentOut();
- // Check
- EXPECT_EQ("UPDATING", manager_->StringifiedUpdateStatus());
-}
-
-TEST_F(UpdateStatusManagerTest,
OnAppSearchStartedCompleted_ExpectAppSearchCorrectStatus) {
// Arrange
manager_->OnAppsSearchStarted();
diff --git a/src/components/policy/policy_regular/test/valid_sdl_pt_update.json b/src/components/policy/policy_regular/test/valid_sdl_pt_update.json
index 81521a2e0b..acf18c5706 100644
--- a/src/components/policy/policy_regular/test/valid_sdl_pt_update.json
+++ b/src/components/policy/policy_regular/test/valid_sdl_pt_update.json
@@ -20,7 +20,13 @@
"nicknames" : [ "SyncProxyTester" ],
"priority" : "EMERGENCY",
"steal_focus" : true,
- "heart_beat_timeout_ms": 5000
+ "heart_beat_timeout_ms": 5000,
+ "app_services": {
+ "MEDIA": {
+ "service_names" : ["SDL App", "SDL Music"],
+ "handled_rpcs" : [{"function_id": 41}]
+ }
+ }
},
"default" : {
"default_hmi" : "NONE",
@@ -1431,6 +1437,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1443,6 +1450,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1455,6 +1463,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1467,6 +1476,7 @@
"parameters" : [
"accPedalPosition",
"beltStatus",
+ "electronicParkBrakeStatus",
"driverBraking",
"myKey",
"prndl",
@@ -1594,6 +1604,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1612,6 +1623,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"vin",
@@ -1630,6 +1642,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
@@ -1647,6 +1660,7 @@
"headLampStatus",
"instantFuelConsumption",
"fuelRange",
+ "cloudAppVehicleID",
"odometer",
"tirePressure",
"wiperStatus"
diff --git a/src/components/policy/policy_regular/test/vehicle_data_item_type_test.cc b/src/components/policy/policy_regular/test/vehicle_data_item_type_test.cc
new file mode 100644
index 0000000000..02818887a5
--- /dev/null
+++ b/src/components/policy/policy_regular/test/vehicle_data_item_type_test.cc
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE. */
+
+#include "gtest/gtest.h"
+#include "policy/policy_table/types.h"
+#include "utils/jsoncpp_reader_wrapper.h"
+
+#include <type_traits>
+
+namespace test {
+namespace vehicle_info_plugin_test {
+
+using namespace rpc::policy_table_interface_base;
+
+namespace {
+/*
+ * class TestString should be used for compact string creation with json value
+ */
+class TestString {
+ /**
+ * @brief Field contains json structure
+ */
+ std::string text_;
+ /**
+ * @brief Need for validate should not be returned closed json or empty string
+ */
+ bool is_initialized_;
+
+ public:
+ TestString() : is_initialized_(false) {}
+
+ /**
+ * @brief This method handling all types except string
+ * the name:value will be added to json string
+ * @param std::string& name - name of json filed
+ * @param const T& value - value of json filed
+ */
+ template <class T>
+ void AddField(const std::string& name, const T& value) {
+ const bool is_bool = std::is_same<T, bool>::value;
+ // Should be writed to json true/false not 1/0
+ const std::string text_value =
+ (is_bool ? (value ? "true" : "false") : std::to_string(value));
+ if (text_.empty()) {
+ is_initialized_ = true;
+ text_ = "{\"" + name + "\":" + text_value;
+ return;
+ }
+ text_ += ",\"" + name + "\":" + text_value;
+ }
+
+ /**
+ * @brief This method handling only string values
+ * the name:"value" will be added to json string
+ * this method is coverring value in quotes
+ * @param std::string& name - name of json filed
+ * @param const T& value - value of json filed
+ */
+ void AddField(const std::string& name, const char* value) {
+ if (text_.empty()) {
+ is_initialized_ = true;
+ text_ = "{\"" + name + "\":";
+ } else {
+ text_ += ",\"" + name + "\":";
+ }
+
+ text_ += value[0] == '{' || value[0] == '['
+ ? std::string(value)
+ : "\"" + std::string(value) + "\"";
+ }
+
+ /**
+ * @brief This method close json string before return
+ * @return all string and close json form by right bracket "}"
+ * or empty string if json structure is empty
+ */
+ std::string GetValue() {
+ return is_initialized_ ? text_ + "}" : "";
+ }
+};
+
+} // namespace
+
+class VehicleDataItemTypeTest : public ::testing::Test {
+ public:
+ std::string GetFullJsonString(const std::string& params_array = "") {
+ TestString str;
+ str.AddField("name", "VehicleDataItem");
+ str.AddField("type", "String");
+ str.AddField("key", "OEMDataRef");
+ str.AddField("array", true);
+ str.AddField("mandatory", true);
+ str.AddField("params", ("[" + params_array + "]").c_str());
+ str.AddField("since", "4.0");
+ str.AddField("until", "5.0");
+ str.AddField("removed", true);
+ str.AddField("deprecated", true);
+ str.AddField("minvalue", 1);
+ str.AddField("maxvalue", 2);
+ str.AddField("minsize", 10);
+ str.AddField("maxsize", 20);
+ str.AddField("minlength", 100);
+ str.AddField("maxlength", 200);
+
+ return str.GetValue();
+ }
+
+ protected:
+ virtual void TearDown() {
+ json_.clear();
+ }
+
+ Json::Value json_;
+ utils::JsonReader reader_;
+};
+
+TEST_F(VehicleDataItemTypeTest, Initialize_Success) {
+ const std::string str = GetFullJsonString();
+ reader_.parse(str, &json_);
+ VehicleDataItem vdi(&json_);
+
+ EXPECT_TRUE(vdi.is_initialized());
+}
+
+TEST_F(VehicleDataItemTypeTest, Initialize_Failed) {
+ VehicleDataItem vdi;
+
+ EXPECT_FALSE(vdi.is_initialized());
+}
+
+TEST_F(VehicleDataItemTypeTest, CheckConvertFromJsonToVehicleDataItem_Success) {
+ const std::string str = GetFullJsonString();
+ reader_.parse(str, &json_);
+ VehicleDataItem vdi(&json_);
+
+ EXPECT_TRUE((std::string)vdi.name == "VehicleDataItem");
+ EXPECT_TRUE((std::string)vdi.type == "String");
+ EXPECT_TRUE((std::string)vdi.key == "OEMDataRef");
+ EXPECT_TRUE(*vdi.array == true);
+ EXPECT_TRUE(vdi.mandatory == true);
+ EXPECT_TRUE(vdi.params->empty());
+ EXPECT_TRUE((std::string)*vdi.since == "4.0");
+ EXPECT_TRUE((std::string)*vdi.until == "5.0");
+ EXPECT_TRUE(*vdi.removed == true);
+ EXPECT_TRUE(*vdi.deprecated == true);
+ EXPECT_TRUE(*vdi.minvalue == 1);
+ EXPECT_TRUE(*vdi.maxvalue == 2);
+ EXPECT_TRUE(*vdi.minsize == 10);
+ EXPECT_TRUE(*vdi.maxsize == 20);
+ EXPECT_TRUE(*vdi.minlength == 100);
+ EXPECT_TRUE(*vdi.maxlength == 200);
+}
+
+TEST_F(VehicleDataItemTypeTest, CheckConvertFromVehicleDataItemToJson_Success) {
+ const std::string str = GetFullJsonString();
+ reader_.parse(str, &json_);
+ VehicleDataItem vdi(&json_);
+
+ auto jsonFrom = vdi.ToJsonValue();
+ VehicleDataItem vdi2(&jsonFrom);
+ EXPECT_TRUE(vdi == vdi2);
+}
+
+TEST_F(VehicleDataItemTypeTest, CheckIsValid_Failed) {
+ VehicleDataItem vdi;
+
+ EXPECT_FALSE(vdi.is_valid());
+}
+
+TEST_F(VehicleDataItemTypeTest, CheckIsValid_Struct_Success) {
+ std::string str = GetFullJsonString(GetFullJsonString());
+ reader_.parse(str, &json_);
+ VehicleDataItem vdi(&json_);
+
+ vdi.type = "Struct";
+ EXPECT_TRUE(vdi.is_valid());
+}
+
+TEST_F(VehicleDataItemTypeTest, CheckIsValid_Struct_EmptyParams_Failed) {
+ const std::string str = GetFullJsonString();
+ reader_.parse(str, &json_);
+
+ VehicleDataItem vdi(&json_);
+
+ vdi.type = "Struct";
+ EXPECT_FALSE(vdi.is_valid());
+}
+
+TEST_F(VehicleDataItemTypeTest, CheckIsValid_PODTypes_Success) {
+ const std::string str = GetFullJsonString();
+ reader_.parse(str, &json_);
+
+ VehicleDataItem vdi(&json_);
+
+ vdi.type = "Integer";
+ EXPECT_TRUE(vdi.is_valid());
+
+ vdi.type = "Float";
+ EXPECT_TRUE(vdi.is_valid());
+
+ vdi.type = "String";
+ EXPECT_TRUE(vdi.is_valid());
+
+ vdi.type = "Boolean";
+ EXPECT_TRUE(vdi.is_valid());
+}
+
+TEST_F(VehicleDataItemTypeTest, CheckEmptiness_True) {
+ VehicleDataItem vdi;
+ EXPECT_FALSE(vdi.struct_not_empty());
+}
+
+TEST_F(VehicleDataItemTypeTest, CheckEmptiness_False) {
+ const std::string str = GetFullJsonString();
+ reader_.parse(str, &json_);
+
+ VehicleDataItem vdi(&json_);
+ EXPECT_TRUE(vdi.struct_not_empty());
+}
+
+TEST_F(VehicleDataItemTypeTest, CheckCopyConstructor) {
+ const std::string str = GetFullJsonString();
+ reader_.parse(str, &json_);
+
+ VehicleDataItem vdi1(&json_);
+ VehicleDataItem vdi2(vdi1);
+
+ EXPECT_TRUE(vdi1 == vdi2);
+}
+
+} // namespace vehicle_info_plugin_test
+} // namespace test
diff --git a/src/components/protocol/src/bson_object_keys.cc b/src/components/protocol/src/bson_object_keys.cc
index fb225b1461..acafd3dbd2 100644
--- a/src/components/protocol/src/bson_object_keys.cc
+++ b/src/components/protocol/src/bson_object_keys.cc
@@ -12,6 +12,13 @@ const char* height = "height";
const char* width = "width";
const char* video_protocol = "videoProtocol";
const char* video_codec = "videoCodec";
+const char* secondary_transports = "secondaryTransports";
+const char* audio_service_transports = "audioServiceTransports";
+const char* video_service_transports = "videoServiceTransports";
+const char* tcp_ip_address = "tcpIpAddress";
+const char* tcp_port = "tcpPort";
+const char* reason = "reason";
+const char* auth_token = "authToken";
} // namespace strings
diff --git a/src/components/protocol/src/raw_message.cc b/src/components/protocol/src/raw_message.cc
index daffd0f2bd..72eb82394b 100644
--- a/src/components/protocol/src/raw_message.cc
+++ b/src/components/protocol/src/raw_message.cc
@@ -40,12 +40,14 @@ RawMessage::RawMessage(uint32_t connection_key,
uint32_t protocol_version,
const uint8_t* const data_param,
uint32_t data_sz,
+ bool protection,
uint8_t type,
uint32_t payload_size)
: connection_key_(connection_key)
, data_(NULL)
, data_size_(data_sz)
, protocol_version_(protocol_version)
+ , protection_(protection)
, service_type_(ServiceTypeFromByte(type))
, payload_size_(payload_size)
, waiting_(false) {
@@ -87,6 +89,10 @@ bool RawMessage::IsWaiting() const {
return waiting_;
}
+bool RawMessage::protection_flag() const {
+ return protection_;
+}
+
void RawMessage::set_waiting(bool v) {
waiting_ = v;
}
diff --git a/src/components/protocol_handler/CMakeLists.txt b/src/components/protocol_handler/CMakeLists.txt
index d57211040a..53ccd3c5c9 100644
--- a/src/components/protocol_handler/CMakeLists.txt
+++ b/src/components/protocol_handler/CMakeLists.txt
@@ -34,8 +34,12 @@ include_directories(
${COMPONENTS_DIR}/utils/include/
${COMPONENTS_DIR}/protocol_handler/include/
${COMPONENTS_DIR}/connection_handler/include/
+ ${COMPONENTS_DIR}/application_manager/include
+ ${CMAKE_BINARY_DIR}/src/components/
+ ${JSONCPP_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
${BSON_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
@@ -65,7 +69,7 @@ endforeach()
add_library(ProtocolHandler ${SOURCES})
-#add_dependencies(ProtocolHandler libbson)
+add_dependencies(ProtocolHandler libbson)
target_link_libraries(ProtocolHandler ${LIBRARIES})
if(BUILD_TESTS)
diff --git a/src/components/protocol_handler/docs/SDL.SDD.ServiceStatusUpdate.dox b/src/components/protocol_handler/docs/SDL.SDD.ServiceStatusUpdate.dox
new file mode 100644
index 0000000000..dea9ae5d0b
--- /dev/null
+++ b/src/components/protocol_handler/docs/SDL.SDD.ServiceStatusUpdate.dox
@@ -0,0 +1,116 @@
+/**
+\page service_status_update Service Status Update Detailed Design
+## Table of contents
+- \subpage service_status_update_intoduction
+ + \ref service_status_update_rationale "1.1 Rationale"
+ + \ref service_status_update_scope "1.2 Scope"
+- \subpage service_status_update_detail_design
+ + \ref service_status_update_design_solutions "2.1 Design solutions"
+ + \ref service_status_update_class_structure "2.2 Class Structure"
+ + \ref service_status_update_sequence_diagram "2.3 Sequence diagram"
+- \subpage service_status_update_data_structures
+ + \ref service_status_update_data_structure "3.1 Data structures"
+- \subpage service_status_update_references_and_history
+ + \ref service_status_update_history "4.1 References"
+*/
+//-----------------------------------------------------------
+/**
+\page service_status_update_intoduction 1 Introduction
+The document is intended to support software developers,
+maintenance and integration engineers with sufficient,
+detailed information concerning the design, development and
+deployment concepts, to accomplish their respective tasks without reliance on the authors.
+
+\anchor service_status_update_rationale
+## 1.1 Rationale
+ServiceStatusUpdateHandler and ServiceStatusUpdateHandlerListener classes are
+implemented to provide adequate levels of abstraction when passing data between ProtocolHandler,
+SecurityManager, ApplicationManager and PolicyHandler
+
+\anchor service_status_update_scope
+## 1.2 Scope
+ServiceStatusUpdateHandler is a part of protocol_handler namespace
+
+*/
+//-----------------------------------------------------------
+/**
+\page service_status_update_detail_design 2 Component detail design
+\anchor service_status_update_design_solutions
+### 2.1 Design solutions
+The following design approaches and patterns was used for ServiceStatusUpdateHandler:
+- Introducing extra layer to process data relevant only for ProtocolHandler or ApplicationManager
+ + ServiceStatusUpdateHandler converts ServiceStatus value relevant only for ProtocolHandler to
+ HMI API values relevant only for ApplicationManager
+- [Builder design pattern](https://sourcemaking.com/design_patterns/builder)
+ used for construction of OnServiceUpdate notification object
+- [Observer design pattern]
+ used for notifying ApplicationManager of service update occured
+
+
+#### Design description
+protocol_handler::ServiceStatusUpdateHandler is an entity to establish data transfer between
+ProtocolHandler and ApplicationManager about occuring service updates
+protocol_handler::ServiceStatusUpdateHandlerListener is an interface used
+to provide adequate level of abstraction between broadcasting and listening entity
+MessageHelper::ServiceStatusUpdateNotificationBuilder is an entity used
+for flexible construction of OnServiceUpdate notification object
+
+\anchor service_status_update_class_structure
+### 2.2 Class Structure
+The following UML class diagram shows the component structure.
+![Service Status Update class diagram](ServiceStatusUpdate_classes.png)
+For more information about class diagram follow:
+- http://www.uml-diagrams.org/class-diagrams-overview.htqml
+- https://sourcemaking.com/uml/modeling-it-systems/structural-view/class-diagram
+
+\anchor service_status_update_sequence_diagram
+### 2.3 Sequence diagram
+The following UML sequence diagram shows the component dynamic behavior.
+For more information about sequence diagram follow:
+- http://www.uml-diagrams.org/sequence-diagrams.html
+- https://sourcemaking.com/uml/modeling-it-systems/external-view/use-case-sequence-diagram
+
+Service Status Update basic flow:
+![Basic flow](ServiceStatusUpdate_sequence.png)
+
+Service Status Update invalid certificate:
+![Invalid Cert](invalid_cert.png)
+
+Service Status Update PTU failed:
+![PTU Failed](ptu_failed.png)
+
+Service Status Update PTU failed (EXTERNAL_PROPRIETARY):
+![PTU Failed EXTERNAL_PROPRIETARY](PTU_for_EXTERNAL_PROPRIETARY.png)
+
+Service Status Update GetSystemTime failed:
+![GetSystemTime failed](invalid_time.png)
+*/
+
+//-----------------------------------------------------------
+/**
+\page service_status_update_data_structures 3 Component data and resources
+\anchor service_status_update_data_structure
+### 3.1 Element Data Structure
+The following data types are used by the ServiceStatusUpdateHandler:
+ - protocol_handler::ServiceStatus
+
+//-----------------------------------------------------------
+/**
+\page service_status_update_references_and_history 4 References and history
+\anchor service_status_update_history
+### 4.1 Document history
+Document change history
+
+| Version | Date | Author/Editor | Change description |
+|-------------|------------|----------------------------------------|---------------------|
+| 0.1 | 02/21/2019 | [MKed](https://github.com/mked-luxoft) | Initial version from the previous [SDL SDD](https://adc.luxoft.com/confluence/pages/viewpage.action?pageId=279677125) |
+
+Document approve history
+
+| Version | Date | Author/Editor | Change description |
+|-------------|------------|-----------------------------|---------------------|
+| | | | |
+
+For more precise document change history follow github history -
+- https://github.com/smartdevicelink/sdl_core/commits/develop/src/components/protocol_handler/docs/SDL.SDD.ServiceStatusUpdate.dox
+*/ \ No newline at end of file
diff --git a/src/components/protocol_handler/docs/assets/PTU_for_EXTERNAL_PROPRIETARY.png b/src/components/protocol_handler/docs/assets/PTU_for_EXTERNAL_PROPRIETARY.png
new file mode 100644
index 0000000000..5962a1f08b
--- /dev/null
+++ b/src/components/protocol_handler/docs/assets/PTU_for_EXTERNAL_PROPRIETARY.png
Binary files differ
diff --git a/src/components/protocol_handler/docs/assets/ServiceStatusUpdate_classes.png b/src/components/protocol_handler/docs/assets/ServiceStatusUpdate_classes.png
new file mode 100644
index 0000000000..f604a80aa9
--- /dev/null
+++ b/src/components/protocol_handler/docs/assets/ServiceStatusUpdate_classes.png
Binary files differ
diff --git a/src/components/protocol_handler/docs/assets/ServiceStatusUpdate_sequence.png b/src/components/protocol_handler/docs/assets/ServiceStatusUpdate_sequence.png
new file mode 100644
index 0000000000..ac58aa9c48
--- /dev/null
+++ b/src/components/protocol_handler/docs/assets/ServiceStatusUpdate_sequence.png
Binary files differ
diff --git a/src/components/protocol_handler/docs/assets/invalid_cert.png b/src/components/protocol_handler/docs/assets/invalid_cert.png
new file mode 100644
index 0000000000..e208e27a52
--- /dev/null
+++ b/src/components/protocol_handler/docs/assets/invalid_cert.png
Binary files differ
diff --git a/src/components/protocol_handler/docs/assets/invalid_time.png b/src/components/protocol_handler/docs/assets/invalid_time.png
new file mode 100644
index 0000000000..c9c88a5ed3
--- /dev/null
+++ b/src/components/protocol_handler/docs/assets/invalid_time.png
Binary files differ
diff --git a/src/components/protocol_handler/docs/assets/ptu_failed.png b/src/components/protocol_handler/docs/assets/ptu_failed.png
new file mode 100644
index 0000000000..f9f5a6d144
--- /dev/null
+++ b/src/components/protocol_handler/docs/assets/ptu_failed.png
Binary files differ
diff --git a/src/components/protocol_handler/include/protocol_handler/handshake_handler.h b/src/components/protocol_handler/include/protocol_handler/handshake_handler.h
index 8b7f28d50e..9552d4c420 100644
--- a/src/components/protocol_handler/include/protocol_handler/handshake_handler.h
+++ b/src/components/protocol_handler/include/protocol_handler/handshake_handler.h
@@ -40,6 +40,8 @@
#include "protocol_handler/session_observer.h"
#include "security_manager/security_manager_listener.h"
+#include "utils/semantic_version.h"
+
namespace protocol_handler {
class ProtocolHandlerImpl;
@@ -50,25 +52,13 @@ class ProtocolHandlerImpl;
*/
class HandshakeHandler : public security_manager::SecurityManagerListener {
public:
- DEPRECATED HandshakeHandler(ProtocolHandlerImpl& protocol_handler,
- SessionObserver& session_observer,
- uint32_t connection_key,
- ConnectionID connection_id,
- uint8_t session_id,
- uint8_t protocol_version,
- uint32_t hash_id,
- ServiceType service_type,
- const std::vector<int>& force_protected_service,
- const bool is_new_service,
- ProtocolPacket::ProtocolVersion& full_version,
- std::shared_ptr<BsonObject> payload);
-
HandshakeHandler(ProtocolHandlerImpl& protocol_handler,
SessionObserver& session_observer,
- ProtocolPacket::ProtocolVersion& full_version,
+ utils::SemanticVersion& full_version,
const SessionContext& context,
const uint8_t protocol_version,
- std::shared_ptr<BsonObject> payload);
+ std::shared_ptr<BsonObject> payload,
+ ServiceStatusUpdateHandler& service_status_update_handler);
~HandshakeHandler();
@@ -93,19 +83,40 @@ class HandshakeHandler : public security_manager::SecurityManagerListener {
* @brief Notification about handshake failure
* @return true on success notification handling or false otherwise
*/
- bool OnHandshakeFailed() OVERRIDE;
+ bool OnGetSystemTimeFailed() OVERRIDE;
/**
* @brief Notification that certificate update is required.
*/
void OnCertificateUpdateRequired() OVERRIDE;
+ bool OnPTUFailed() OVERRIDE;
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ /**
+ * @brief OnCertDecryptFailed is called when certificate decryption fails in
+ * external flow
+ * @return since this callback is a part of SecurityManagerListener, bool
+ * return value is used to indicate whether listener instance can be deleted
+ * by calling entity. if true - listener can be deleted and removed from
+ * listeners by SecurityManager, false - listener retains its place within
+ * SecurityManager.
+ */
+ bool OnCertDecryptFailed() OVERRIDE;
+#endif
+
/**
* @brief Get connection key of this handler
* @return connection key
*/
uint32_t connection_key() const;
+ /**
+ * @brief Get primary connection key of this handler
+ * @return primary connection key
+ */
+ uint32_t primary_connection_key() const;
+
private:
/**
* @brief Performs related actions if handshake was successfully finished
@@ -118,15 +129,29 @@ class HandshakeHandler : public security_manager::SecurityManagerListener {
/**
* @brief Performs related actions if handshake was failed
* @param params set of params used in bson part of message
+ * @param service_status - service status to be sent to HMI
+ */
+ void ProcessFailedHandshake(BsonObject& params, ServiceStatus service_status);
+
+ /**
+ * @brief Determines whether service can be protected
+ * @return true is service can be protected, otherwise - false
+ */
+ bool CanBeProtected() const;
+
+ /**
+ * @brief Determines whether service is already protected
+ * @return true is service is already protected, otherwise - false
*/
- void ProcessFailedHandshake(BsonObject& params);
+ bool IsAlreadyProtected() const;
ProtocolHandlerImpl& protocol_handler_;
SessionObserver& session_observer_;
SessionContext context_;
- ProtocolPacket::ProtocolVersion full_version_;
+ utils::SemanticVersion full_version_;
const uint8_t protocol_version_;
std::shared_ptr<BsonObject> payload_;
+ ServiceStatusUpdateHandler& service_status_update_handler_;
};
} // namespace protocol_handler
diff --git a/src/components/protocol_handler/include/protocol_handler/incoming_data_handler.h b/src/components/protocol_handler/include/protocol_handler/incoming_data_handler.h
index 4633be6c6e..82bf563bc5 100644
--- a/src/components/protocol_handler/include/protocol_handler/incoming_data_handler.h
+++ b/src/components/protocol_handler/include/protocol_handler/incoming_data_handler.h
@@ -34,9 +34,9 @@
#include <map>
#include <vector>
-#include "utils/macro.h"
#include "protocol_handler/protocol_packet.h"
#include "transport_manager/common.h"
+#include "utils/macro.h"
namespace protocol_handler {
diff --git a/src/components/protocol_handler/include/protocol_handler/multiframe_builder.h b/src/components/protocol_handler/include/protocol_handler/multiframe_builder.h
index bac37b508c..3da63bd79f 100644
--- a/src/components/protocol_handler/include/protocol_handler/multiframe_builder.h
+++ b/src/components/protocol_handler/include/protocol_handler/multiframe_builder.h
@@ -33,13 +33,13 @@
#ifndef SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_MULTIFRAME_BUILDER_H_
#define SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_MULTIFRAME_BUILDER_H_
-#include <map>
-#include <ostream> // std::basic_ostream
-#include <iterator> // std::ostream_iterator
#include <algorithm> // std::copy
+#include <iterator> // std::ostream_iterator
+#include <map>
+#include <ostream> // std::basic_ostream
-#include "utils/date_time.h"
#include "protocol_handler/protocol_packet.h"
+#include "utils/date_time.h"
/**
*\namespace protocol_handlerHandler
@@ -60,7 +60,7 @@ typedef uint32_t MessageID;
struct ProtocolFrameData {
ProtocolFramePtr frame;
- TimevalStruct append_time;
+ date_time::TimeDuration append_time;
};
/**
*\brief Map of frames with last frame data for messages received in multiple
@@ -86,36 +86,36 @@ typedef std::map<ConnectionID, SessionToFrameMap> MultiFrameMap;
class MultiFrameBuilder {
public:
/**
- * @brief Constructor
- */
+ * @brief Constructor
+ */
MultiFrameBuilder();
/**
- *\brief Set timeout of waiting CONSECUTIVE frames
- */
+ *\brief Set timeout of waiting CONSECUTIVE frames
+ */
void set_waiting_timeout(const uint32_t consecutive_frame_wait_msecs);
/**
- * @brief Add connection for pending data
- * @return true on success
- */
+ * @brief Add connection for pending data
+ * @return true on success
+ */
bool AddConnection(const ConnectionID connection_id);
/**
- * @brief Clear all data related to connection_id
- * @return true on success
- */
+ * @brief Clear all data related to connection_id
+ * @return true on success
+ */
bool RemoveConnection(const ConnectionID connection_id);
/**
- *\brief Pop assembled and expired frames
- */
+ *\brief Pop assembled and expired frames
+ */
ProtocolFramePtrList PopMultiframes();
/**
- *\brief Handle Single or Consecutive frame
- * @return RESULT_OK on success, or RESULT_FAIL in case of any error
- */
+ *\brief Handle Single or Consecutive frame
+ * @return RESULT_OK on success, or RESULT_FAIL in case of any error
+ */
RESULT_CODE AddFrame(const ProtocolFramePtr packet);
private:
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
index 99f03b1c04..8dbfc4ed4d 100644
--- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
+++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
@@ -33,30 +33,34 @@
#ifndef SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_HANDLER_IMPL_H_
#define SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_HANDLER_IMPL_H_
+#include <stdint.h>
#include <map>
#include <memory>
#include <set>
-#include <stdint.h>
#include <utility> // std::make_pair
#include <vector>
-#include "utils/prioritized_queue.h"
#include "utils/message_queue.h"
+#include "utils/prioritized_queue.h"
#include "utils/threads/message_loop_thread.h"
-#include "utils/shared_ptr.h"
+
+#include "utils/custom_string.h"
#include "utils/messagemeter.h"
+#include "utils/semantic_version.h"
+#include "application_manager/policies/policy_handler_observer.h"
+#include "connection_handler/connection_handler.h"
+#include "protocol_handler/incoming_data_handler.h"
+#include "protocol_handler/multiframe_builder.h"
#include "protocol_handler/protocol_handler.h"
-#include "protocol_handler/protocol_packet.h"
#include "protocol_handler/protocol_handler_settings.h"
-#include "protocol_handler/session_observer.h"
#include "protocol_handler/protocol_observer.h"
-#include "protocol_handler/incoming_data_handler.h"
-#include "protocol_handler/multiframe_builder.h"
+#include "protocol_handler/protocol_packet.h"
+#include "protocol_handler/service_status_update_handler.h"
+#include "protocol_handler/session_observer.h"
#include "transport_manager/common.h"
+#include "transport_manager/transport_adapter/transport_adapter.h"
#include "transport_manager/transport_manager.h"
#include "transport_manager/transport_manager_listener_empty.h"
-#include "connection_handler/connection_handler.h"
-#include "application_manager/policies/policy_handler_observer.h"
#ifdef TELEMETRY_MONITOR
#include "protocol_handler/telemetry_observer.h"
@@ -64,8 +68,8 @@
#endif // TELEMETRY_MONITOR
#ifdef ENABLE_SECURITY
-#include "security_manager/security_manager.h"
#include "protocol_handler/handshake_handler.h"
+#include "security_manager/security_manager.h"
#endif // ENABLE_SECURITY
namespace connection_handler {
@@ -107,7 +111,8 @@ struct RawFordMessageFromMobile : public ProtocolFramePtr {
// PrioritizedQueue requires this method to decide which priority to assign
size_t PriorityOrder() const {
return MessagePriority::FromServiceType(
- ServiceTypeFromByte(get()->service_type())).OrderingValue();
+ ServiceTypeFromByte(get()->service_type()))
+ .OrderingValue();
}
};
@@ -119,7 +124,8 @@ struct RawFordMessageToMobile : public ProtocolFramePtr {
// PrioritizedQueue requires this method to decide which priority to assign
size_t PriorityOrder() const {
return MessagePriority::FromServiceType(
- ServiceTypeFromByte(get()->service_type())).OrderingValue();
+ ServiceTypeFromByte(get()->service_type()))
+ .OrderingValue();
}
// Signals whether connection to mobile must be closed after processing this
// message
@@ -128,9 +134,36 @@ struct RawFordMessageToMobile : public ProtocolFramePtr {
// Short type names for prioritized message queues
typedef threads::MessageLoopThread<
- utils::PrioritizedQueue<RawFordMessageFromMobile> > FromMobileQueue;
+ utils::PrioritizedQueue<RawFordMessageFromMobile> >
+ FromMobileQueue;
typedef threads::MessageLoopThread<
- utils::PrioritizedQueue<RawFordMessageToMobile> > ToMobileQueue;
+ utils::PrioritizedQueue<RawFordMessageToMobile> >
+ ToMobileQueue;
+
+// Type to allow easy mapping between a device type and transport
+// characteristics
+typedef enum {
+ TT_NONE = -1,
+ TT_USB = 0,
+ TT_BLUETOOTH = 1,
+ TT_WIFI = 2,
+ TT_WEBSOCKET = 3
+} TransportType;
+
+struct TransportDescription {
+ TransportDescription(const TransportType transport_type,
+ const bool ios_transport,
+ const bool android_transport)
+ : transport_type_(transport_type)
+ , ios_transport_(ios_transport)
+ , android_transport_(android_transport) {}
+
+ TransportType transport_type_;
+ bool ios_transport_;
+ bool android_transport_;
+};
+
+typedef std::map<std::string, TransportDescription> TransportTypes;
} // namespace impl
/**
@@ -148,10 +181,10 @@ class ProtocolHandlerImpl
public impl::FromMobileQueue::Handler,
public impl::ToMobileQueue::Handler
#ifdef TELEMETRY_MONITOR
- ,
+ ,
public telemetry_monitor::TelemetryObservable<PHTelemetryObserver>
#endif // TELEMETRY_MONITOR
- {
+{
public:
/**
* @brief Constructor
@@ -178,6 +211,16 @@ class ProtocolHandlerImpl
void RemoveProtocolObserver(ProtocolObserver* observer) OVERRIDE;
+ void ProcessFailedPTU() OVERRIDE;
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ /**
+ * @brief ProcessFailedCertDecrypt is called to notify security manager that
+ * certificate decryption failed in the external flow
+ */
+ void ProcessFailedCertDecrypt() OVERRIDE;
+#endif
+
#ifdef ENABLE_SECURITY
/**
* \brief Sets pointer for SecurityManager layer for managing protection
@@ -188,6 +231,9 @@ class ProtocolHandlerImpl
security_manager::SecurityManager* security_manager);
#endif // ENABLE_SECURITY
+ void set_service_status_update_handler(
+ std::unique_ptr<ServiceStatusUpdateHandler> handler);
+
/**
* \brief Stop all handling activity
*/
@@ -198,8 +244,11 @@ class ProtocolHandlerImpl
* \param message Message with params to be sent to Mobile App
*/
void SendMessageToMobileApp(const RawMessagePtr message,
+ bool needs_encryption,
bool final_message) OVERRIDE;
+ bool IsRPCServiceSecure(const uint32_t connection_key) const OVERRIDE;
+
/**
* \brief Sends number of processed frames in case of binary nav streaming
* \param connection_key Unique key used by other components as session
@@ -224,18 +273,26 @@ class ProtocolHandlerImpl
void SendHeartBeat(int32_t connection_id, uint8_t session_id);
/**
- * \brief Sends ending session to mobile application
- * \param connection_id Identifier of connection within which
- * session exists
- * \param session_id ID of session to be ended
- */
+ * \brief Sends ending session to mobile application
+ * \param connection_id Identifier of connection within which
+ * session exists
+ * \param session_id ID of session to be ended
+ */
void SendEndSession(int32_t connection_id, uint8_t session_id);
- void SendEndService(int32_t connection_id,
+ /**
+ * \brief Sends ending session to mobile application
+ * \param primary_connection_id Identifier of connection within which
+ * service exists
+ * \param connection_id Identifier of the actual transport for the service
+ * \param session_id ID of session to be ended
+ */
+ void SendEndService(int32_t primary_connection_id,
+ int32_t connection_id,
uint8_t session_id,
uint8_t service_type);
- void NotifyOnFailedHandshake() OVERRIDE;
+ void NotifyOnGetSystemTimeFailed() OVERRIDE;
// TODO(Ezamakhov): move Ack/Nack as interface for StartSessionHandler
/**
@@ -279,7 +336,7 @@ class ProtocolHandlerImpl
uint32_t hash_code,
uint8_t service_type,
bool protection,
- ProtocolPacket::ProtocolVersion& full_version);
+ utils::SemanticVersion& full_version);
/**
* \brief Sends acknowledgement of starting session to mobile application
@@ -303,7 +360,7 @@ class ProtocolHandlerImpl
uint32_t hash_code,
uint8_t service_type,
bool protection,
- ProtocolPacket::ProtocolVersion& full_version,
+ utils::SemanticVersion& full_version,
BsonObject& params);
const ProtocolHandlerSettings& get_settings() const OVERRIDE {
@@ -383,27 +440,6 @@ class ProtocolHandlerImpl
SessionObserver& get_session_observer() OVERRIDE;
/**
- * \brief Called by connection handler to notify the result of
- * OnSessionStartedCallback().
- * \param connection_id Identifier of connection within which session exists
- * \param session_id session ID passed to OnSessionStartedCallback()
- * \param generated_session_id Generated session ID, will be 0 if session is
- * not started
- * \param hash_id Generated Hash ID
- * \param protection whether the service will be protected
- * \param rejected_params list of parameters' name that are rejected.
- * Only valid when generated_session_id is 0. Note, even if
- * generated_session_id is 0, the list may be empty.
- */
- DEPRECATED void NotifySessionStartedResult(
- int32_t connection_id,
- uint8_t session_id,
- uint8_t generated_session_id,
- uint32_t hash_id,
- bool protection,
- std::vector<std::string>& rejected_params) OVERRIDE;
-
- /**
* @brief Called by connection handler to notify the result of
* OnSessionStartedCallback().
* @param context reference to structure with started session data
@@ -422,10 +458,21 @@ class ProtocolHandlerImpl
const impl::ToMobileQueue& get_to_mobile_queue() const {
return raw_ford_messages_to_mobile_;
}
+
+ void set_tcp_config(bool tcp_enabled,
+ std::string tcp_address,
+ std::string tcp_port) {
+ tcp_enabled_ = tcp_enabled;
+ tcp_ip_address_ = tcp_address;
+ tcp_port_ = tcp_port;
+ }
#endif
+ void OnAuthTokenUpdated(const std::string&, const std::string&) OVERRIDE;
+
private:
- void SendEndServicePrivate(int32_t connection_id,
+ void SendEndServicePrivate(int32_t primary_connection_id,
+ int32_t connection_id,
uint8_t session_id,
uint8_t service_type);
@@ -436,6 +483,28 @@ class ProtocolHandlerImpl
uint8_t session_id,
uint32_t message_id);
+ /*
+ * Prepare and send TransportUpdateEvent message
+ */
+ void SendTransportUpdateEvent(ConnectionID connection_id, uint8_t session_id);
+
+ /*
+ * Prepare and send RegisterSecondaryTransportAck message
+ */
+ RESULT_CODE SendRegisterSecondaryTransportAck(
+ ConnectionID connection_id,
+ ConnectionID primary_transport_connection_id,
+ uint8_t session_id);
+
+ /*
+ * Prepare and send RegisterSecondaryTransportNAck message
+ */
+ RESULT_CODE SendRegisterSecondaryTransportNAck(
+ ConnectionID connection_id,
+ ConnectionID primary_transport_connection_id,
+ uint8_t session_id,
+ BsonObject* reason = NULL);
+
/**
* @brief Notifies about receiving message from TM.
*
@@ -474,6 +543,23 @@ class ProtocolHandlerImpl
void OnConnectionClosed(
const transport_manager::ConnectionUID connection_id) OVERRIDE;
+ void OnUnexpectedDisconnect(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::CommunicationError& error) OVERRIDE;
+
+ void OnConnectionPending(
+ const transport_manager::DeviceInfo& device_info,
+ const transport_manager::ConnectionUID connection_id) OVERRIDE;
+
+ /**
+ * @brief Notifies that configuration of a transport has been updated.
+ *
+ * @param configs pairs of key and value that represent configuration.
+ */
+ void OnTransportConfigUpdated(
+ const transport_manager::transport_adapter::TransportConfig& configs)
+ OVERRIDE;
+
/**
* @brief Notifies subscribers about message
* received from mobile device.
@@ -499,6 +585,7 @@ class ProtocolHandlerImpl
const uint8_t service_type,
const size_t data_size,
const uint8_t* data,
+ const bool needs_encryption,
const bool is_final_message);
/**
@@ -521,6 +608,7 @@ class ProtocolHandlerImpl
const size_t data_size,
const uint8_t* data,
const size_t max_frame_size,
+ const bool needs_encryption,
const bool is_final_message);
/**
@@ -570,11 +658,11 @@ class ProtocolHandlerImpl
RESULT_CODE HandleControlMessageEndServiceACK(const ProtocolPacket& packet);
- DEPRECATED RESULT_CODE
- HandleControlMessageStartSession(const ProtocolPacket& packet);
-
RESULT_CODE HandleControlMessageStartSession(const ProtocolFramePtr packet);
+ RESULT_CODE HandleControlMessageRegisterSecondaryTransport(
+ const ProtocolFramePtr packet);
+
RESULT_CODE HandleControlMessageHeartBeat(const ProtocolPacket& packet);
void PopValideAndExpirateMultiframes();
@@ -603,6 +691,38 @@ class ProtocolHandlerImpl
*/
uint8_t SupportedSDLProtocolVersion() const;
+ const impl::TransportDescription GetTransportTypeFromConnectionType(
+ const std::string& device_type) const;
+
+ const bool ParseSecondaryTransportConfiguration(
+ const ConnectionID connection_id,
+ std::vector<std::string>& secondaryTransports,
+ std::vector<int32_t>& audioServiceTransports,
+ std::vector<int32_t>& videoServiceTransports) const;
+
+ void GenerateSecondaryTransportsForStartSessionAck(
+ const std::vector<std::string>& secondary_transport_types,
+ bool device_is_ios,
+ bool device_is_android,
+ std::vector<std::string>& secondaryTransports) const;
+
+ void GenerateServiceTransportsForStartSessionAck(
+ bool secondary_enabled,
+ const std::vector<std::string>& service_transports,
+ const std::string& primary_connection_type,
+ const impl::TransportType primary_transport_type,
+ const std::vector<std::string>& secondary_transport_types,
+ std::vector<int32_t>& serviceTransports) const;
+
+ const std::string TransportTypeFromTransport(
+ const utils::custom_string::CustomString& transport) const;
+
+ const ServiceStatus ServiceDisallowedBySettings(
+ const ServiceType service_type,
+ const ConnectionID connection_id,
+ const uint8_t session_id,
+ const bool protection) const;
+
const ProtocolHandlerSettings& settings_;
/**
@@ -689,6 +809,16 @@ class ProtocolHandlerImpl
sync_primitives::Lock start_session_frame_map_lock_;
StartSessionFrameMap start_session_frame_map_;
+ std::unique_ptr<ServiceStatusUpdateHandler> service_status_update_handler_;
+
+ // Map policy app id -> auth token
+ sync_primitives::Lock auth_token_map_lock_;
+ std::map<std::string, std::string> auth_token_map_;
+
+ bool tcp_enabled_;
+ std::string tcp_port_;
+ std::string tcp_ip_address_;
+
#ifdef TELEMETRY_MONITOR
PHTelemetryObserver* metric_observer_;
#endif // TELEMETRY_MONITOR
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h
index b6c05d4c46..215c63c685 100644
--- a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h
+++ b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h
@@ -34,9 +34,9 @@
#define SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_PACKET_H_
#include <list>
-#include "utils/macro.h"
#include "protocol/common.h"
#include "transport_manager/common.h"
+#include "utils/macro.h"
/**
*\namespace protocol_handlerHandler
@@ -64,58 +64,6 @@ class ProtocolPacket {
};
/**
- * \class ProtocolVersion
- * \brief Used for storing the full protocol version of a service
- * (major.minor.patch).
- */
- class ProtocolVersion {
- public:
- ProtocolVersion();
- ProtocolVersion(uint8_t majorVersion,
- uint8_t minorVersion,
- uint8_t patchVersion);
- ProtocolVersion(ProtocolVersion& other);
- ProtocolVersion(std::string versionString);
- uint8_t majorVersion;
- uint8_t minorVersion;
- uint8_t patchVersion;
- static inline int16_t cmp(const ProtocolVersion& version1,
- const ProtocolVersion& version2) {
- int16_t diff =
- static_cast<int16_t>(version1.majorVersion - version2.majorVersion);
- if (diff == 0) {
- diff =
- static_cast<int16_t>(version1.minorVersion - version2.minorVersion);
- if (diff == 0) {
- diff = static_cast<int16_t>(version1.patchVersion -
- version2.patchVersion);
- }
- }
- return diff;
- }
- inline bool operator==(const ProtocolVersion& other) {
- return ProtocolVersion::cmp(*this, other) == 0;
- }
- inline bool operator<(const ProtocolVersion& other) {
- return ProtocolVersion::cmp(*this, other) < 0;
- }
- bool operator>(const ProtocolVersion& other) {
- return ProtocolVersion::cmp(*this, other) > 0;
- }
- inline bool operator<=(const ProtocolVersion& other) {
- return ProtocolVersion::cmp(*this, other) <= 0;
- }
- bool operator>=(const ProtocolVersion& other) {
- return ProtocolVersion::cmp(*this, other) >= 0;
- }
- static inline ProtocolVersion* min(ProtocolVersion& version1,
- ProtocolVersion& version2) {
- return (version1 < version2) ? &version1 : &version2;
- }
- std::string to_string();
- };
-
- /**
* \class ProtocolHeader
* \brief Used for storing protocol header of a message.
*/
@@ -327,18 +275,23 @@ class ProtocolPacket {
/*End of Deserialization*/
/**
- * \brief Getter for Connection Identifier
- */
+ * \brief Getter for Connection Identifier
+ */
ConnectionID connection_id() const;
/**
- * \brief Getter for data payload size
- */
+ * \brief Setter of Connection Identifier
+ */
+ void set_connection_id(ConnectionID connection_id);
+
+ /**
+ * \brief Getter for data payload size
+ */
uint32_t payload_size() const;
/**
- * \brief Getter for full header information
- */
+ * \brief Getter for full header information
+ */
const ProtocolHeader& packet_header() const;
private:
@@ -358,9 +311,9 @@ class ProtocolPacket {
uint32_t payload_size_;
/**
- * \brief Connection Identifier
- * Obtained from connection_handler
- */
+ * \brief Connection Identifier
+ * Obtained from connection_handler
+ */
ConnectionID connection_id_;
DISALLOW_COPY_AND_ASSIGN(ProtocolPacket);
@@ -370,7 +323,7 @@ class ProtocolPacket {
* @brief Type definition for variable that hold shared pointer to protocolol
* packet
*/
-typedef utils::SharedPtr<protocol_handler::ProtocolPacket> ProtocolFramePtr;
+typedef std::shared_ptr<protocol_handler::ProtocolPacket> ProtocolFramePtr;
typedef std::list<ProtocolFramePtr> ProtocolFramePtrList;
template <typename _CharT>
diff --git a/src/components/protocol_handler/include/protocol_handler/service_status_update_handler.h b/src/components/protocol_handler/include/protocol_handler/service_status_update_handler.h
new file mode 100644
index 0000000000..c94ddb91e4
--- /dev/null
+++ b/src/components/protocol_handler/include/protocol_handler/service_status_update_handler.h
@@ -0,0 +1,89 @@
+/*
+ Copyright (c) 2019, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_SERVICE_STATUS_UPDATE_HANDLER_H_
+#define SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_SERVICE_STATUS_UPDATE_HANDLER_H_
+
+#include "protocol_handler/service_status_update_handler_listener.h"
+
+namespace protocol_handler {
+
+/**
+ * @brief ServiceStatus helper enum containing reasons for
+ * service
+ * status to be updated
+ */
+enum class ServiceStatus {
+ INVALID_ENUM = -1,
+ SERVICE_RECEIVED,
+ SERVICE_ACCEPTED,
+ SERVICE_START_FAILED,
+ PTU_FAILED,
+ CERT_INVALID,
+ INVALID_TIME,
+ PROTECTION_ENFORCED,
+ PROTECTION_DISABLED,
+ UNSECURE_START_FAILED
+};
+
+/**
+ * @brief ServiceStatusUpdateHandler class is used to notify listeners about
+ * occured events during service start
+ */
+class ServiceStatusUpdateHandler {
+ public:
+ /**
+ * @brief ServiceStatusUpdateHandler class constructor
+ * @param listener pointer to ServiceStatusUpdateHandlerListener instance
+ */
+ ServiceStatusUpdateHandler(ServiceStatusUpdateHandlerListener* listener)
+ : listener_(listener) {}
+
+ /**
+ * @brief OnServiceUpdate callback that is invoked in case of
+ * service status update needed
+ * @param connection_key - connection key
+ * @param service_type enum value containing type of service.
+ * @param service_status enum value containing status of service.
+ * received
+ */
+ void OnServiceUpdate(const uint32_t connection_key,
+ const protocol_handler::ServiceType service_type,
+ const ServiceStatus service_status);
+
+ private:
+ ServiceStatusUpdateHandlerListener* listener_;
+};
+
+} // namespace protocol_handler
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_SERVICE_STATUS_UPDATE_HANDLER_H_
diff --git a/src/components/protocol_handler/include/protocol_handler/service_status_update_handler_listener.h b/src/components/protocol_handler/include/protocol_handler/service_status_update_handler_listener.h
new file mode 100644
index 0000000000..3c782f72f8
--- /dev/null
+++ b/src/components/protocol_handler/include/protocol_handler/service_status_update_handler_listener.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_SERVICE_STATUS_UPDATE_HANDLER_LISTENER_H_
+#define SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_SERVICE_STATUS_UPDATE_HANDLER_LISTENER_H_
+
+#include "interfaces/HMI_API.h"
+#include "protocol_handler/protocol_handler.h"
+#include "transport_manager/transport_manager.h"
+#include "utils/optional.h"
+
+namespace protocol_handler {
+/**
+ * @brief Converts service type enum value from protocol_handler to hmi_apis.
+ * @param service_type protocol_handler enum value.
+ */
+hmi_apis::Common_ServiceType::eType GetHMIServiceType(
+ protocol_handler::ServiceType service_type);
+
+/**
+ * @brief ServiceStatusUpdateHandlerListener provides callbacks interface with
+ * a purpose to notify HMI on successful or failed state updates of different
+ * services
+ */
+class ServiceStatusUpdateHandlerListener {
+ public:
+ /**
+ * @brief ProcessServiceStatusUpdate callback that is invoked in case of
+ * service
+ * status update
+ * @param connection_key - connection key
+ * @param service_type enum value containing type of service.
+ * @param service_event enum value containing event that occured during
+ * service start.
+ * @param service_update_reason enum value containing reason why service_event
+ * occured.
+ */
+ virtual void ProcessServiceStatusUpdate(
+ const uint32_t connection_key,
+ hmi_apis::Common_ServiceType::eType service_type,
+ hmi_apis::Common_ServiceEvent::eType service_event,
+ utils::Optional<hmi_apis::Common_ServiceStatusUpdateReason::eType>
+ service_update_reason) = 0;
+};
+
+} // namespace protocol_handler
+
+#endif
diff --git a/src/components/protocol_handler/src/handshake_handler.cc b/src/components/protocol_handler/src/handshake_handler.cc
index 8db551cfd6..3b4ae6ef1f 100644
--- a/src/components/protocol_handler/src/handshake_handler.cc
+++ b/src/components/protocol_handler/src/handshake_handler.cc
@@ -36,8 +36,9 @@
#include "protocol_handler/protocol_handler_impl.h"
#include "protocol_handler/protocol_packet.h"
-#include "security_manager/security_manager.h"
#include "protocol_handler/session_observer.h"
+#include "security_manager/security_manager.h"
+#include "utils/helpers.h"
namespace protocol_handler {
@@ -46,36 +47,18 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
HandshakeHandler::HandshakeHandler(
ProtocolHandlerImpl& protocol_handler,
SessionObserver& session_observer,
- uint32_t connection_key,
- ConnectionID connection_id,
- uint8_t session_id,
- uint8_t protocol_version,
- uint32_t hash_id,
- ServiceType service_type,
- const std::vector<int>& force_protected_service,
- const bool is_new_service,
- ProtocolPacket::ProtocolVersion& full_version,
- std::shared_ptr<BsonObject> payload)
- : protocol_handler_(protocol_handler)
- , session_observer_(session_observer)
- , context_()
- , full_version_(full_version)
- , protocol_version_(protocol_version)
- , payload_(payload) {}
-
-HandshakeHandler::HandshakeHandler(
- ProtocolHandlerImpl& protocol_handler,
- SessionObserver& session_observer,
- ProtocolPacket::ProtocolVersion& full_version,
+ utils::SemanticVersion& full_version,
const SessionContext& context,
const uint8_t protocol_version,
- std::shared_ptr<BsonObject> payload)
+ std::shared_ptr<BsonObject> payload,
+ ServiceStatusUpdateHandler& service_status_update_handler)
: protocol_handler_(protocol_handler)
, session_observer_(session_observer)
, context_(context)
, full_version_(full_version)
, protocol_version_(protocol_version)
- , payload_(payload) {}
+ , payload_(payload)
+ , service_status_update_handler_(service_status_update_handler) {}
HandshakeHandler::~HandshakeHandler() {
LOG4CXX_DEBUG(logger_, "Destroying of HandshakeHandler: " << this);
@@ -86,35 +69,67 @@ uint32_t HandshakeHandler::connection_key() const {
context_.new_session_id_);
}
+uint32_t HandshakeHandler::primary_connection_key() const {
+ return session_observer_.KeyFromPair(context_.primary_connection_id_,
+ context_.new_session_id_);
+}
+
bool HandshakeHandler::GetPolicyCertificateData(std::string& data) const {
return false;
}
-void HandshakeHandler::OnCertificateUpdateRequired() {}
+void HandshakeHandler::OnCertificateUpdateRequired() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
-bool HandshakeHandler::OnHandshakeFailed() {
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
+bool HandshakeHandler::OnCertDecryptFailed() {
+ LOG4CXX_AUTO_TRACE(logger_);
if (payload_) {
- ProcessFailedHandshake(*payload_);
+ ProcessFailedHandshake(*payload_, ServiceStatus::CERT_INVALID);
+ }
+
+ return true;
+}
+#endif
+
+bool HandshakeHandler::OnGetSystemTimeFailed() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (payload_) {
+ ProcessFailedHandshake(*payload_, ServiceStatus::INVALID_TIME);
} else {
BsonObject params;
bson_object_initialize_default(&params);
- ProcessFailedHandshake(params);
+ ProcessFailedHandshake(params, ServiceStatus::INVALID_TIME);
bson_object_deinitialize(&params);
}
return true;
}
+bool HandshakeHandler::OnPTUFailed() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (payload_) {
+ ProcessFailedHandshake(*payload_, ServiceStatus::PTU_FAILED);
+ }
+
+ return true;
+}
+
bool HandshakeHandler::OnHandshakeDone(
uint32_t connection_key,
security_manager::SSLContext::HandshakeResult result) {
LOG4CXX_AUTO_TRACE(logger_);
- if (connection_key != this->connection_key()) {
+ LOG4CXX_DEBUG(logger_,
+ "OnHandshakeDone for service : " << context_.service_type_);
+
+ if (connection_key != this->primary_connection_key()) {
LOG4CXX_DEBUG(logger_,
"Listener " << this
<< " expects notification for connection id: "
- << this->connection_key()
+ << this->primary_connection_key()
<< ". Received notification for connection id "
<< connection_key << " will be ignored");
return false;
@@ -127,7 +142,7 @@ bool HandshakeHandler::OnHandshakeDone(
if (success) {
ProcessSuccessfulHandshake(connection_key, *payload_);
} else {
- ProcessFailedHandshake(*payload_);
+ ProcessFailedHandshake(*payload_, ServiceStatus::CERT_INVALID);
}
} else {
BsonObject params;
@@ -135,7 +150,7 @@ bool HandshakeHandler::OnHandshakeDone(
if (success) {
ProcessSuccessfulHandshake(connection_key, params);
} else {
- ProcessFailedHandshake(params);
+ ProcessFailedHandshake(params, ServiceStatus::CERT_INVALID);
}
bson_object_deinitialize(&params);
}
@@ -143,20 +158,25 @@ bool HandshakeHandler::OnHandshakeDone(
return true;
}
+bool HandshakeHandler::CanBeProtected() const {
+ const auto& force_unprotected =
+ protocol_handler_.get_settings().force_unprotected_service();
+
+ return !(helpers::in_range(force_unprotected, context_.service_type_));
+}
+
+bool HandshakeHandler::IsAlreadyProtected() const {
+ return (session_observer_.GetSSLContext(this->primary_connection_key(),
+ context_.service_type_) != NULL);
+}
+
void HandshakeHandler::ProcessSuccessfulHandshake(const uint32_t connection_key,
BsonObject& params) {
LOG4CXX_AUTO_TRACE(logger_);
- const std::vector<int>& force_unprotected =
- protocol_handler_.get_settings().force_unprotected_service();
- const bool can_be_protected =
- std::find(force_unprotected.begin(),
- force_unprotected.end(),
- context_.service_type_) == force_unprotected.end();
+ const bool is_service_already_protected = IsAlreadyProtected();
- const bool is_service_already_protected =
- session_observer_.GetSSLContext(connection_key, context_.service_type_) !=
- NULL;
+ const bool can_be_protected = CanBeProtected();
LOG4CXX_DEBUG(logger_,
"Service can be protected: " << can_be_protected
@@ -165,6 +185,10 @@ void HandshakeHandler::ProcessSuccessfulHandshake(const uint32_t connection_key,
if (can_be_protected && !is_service_already_protected) {
session_observer_.SetProtectionFlag(connection_key, context_.service_type_);
+ service_status_update_handler_.OnServiceUpdate(
+ this->connection_key(),
+ context_.service_type_,
+ ServiceStatus::SERVICE_ACCEPTED);
protocol_handler_.SendStartSessionAck(context_.connection_id_,
context_.new_session_id_,
protocol_version_,
@@ -174,6 +198,10 @@ void HandshakeHandler::ProcessSuccessfulHandshake(const uint32_t connection_key,
full_version_,
params);
} else {
+ service_status_update_handler_.OnServiceUpdate(
+ this->connection_key(),
+ context_.service_type_,
+ ServiceStatus::SERVICE_START_FAILED);
protocol_handler_.SendStartSessionNAck(context_.connection_id_,
context_.new_session_id_,
protocol_version_,
@@ -181,7 +209,8 @@ void HandshakeHandler::ProcessSuccessfulHandshake(const uint32_t connection_key,
}
}
-void HandshakeHandler::ProcessFailedHandshake(BsonObject& params) {
+void HandshakeHandler::ProcessFailedHandshake(BsonObject& params,
+ ServiceStatus service_status) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Handshake failed");
const std::vector<int>& force_protected =
@@ -198,6 +227,10 @@ void HandshakeHandler::ProcessFailedHandshake(BsonObject& params) {
<< context_.is_new_service_);
if (can_be_unprotected && context_.is_new_service_) {
+ service_status_update_handler_.OnServiceUpdate(
+ this->connection_key(),
+ context_.service_type_,
+ ServiceStatus::PROTECTION_DISABLED);
protocol_handler_.SendStartSessionAck(context_.connection_id_,
context_.new_session_id_,
protocol_version_,
@@ -207,6 +240,8 @@ void HandshakeHandler::ProcessFailedHandshake(BsonObject& params) {
full_version_,
params);
} else {
+ service_status_update_handler_.OnServiceUpdate(
+ this->connection_key(), context_.service_type_, service_status);
protocol_handler_.SendStartSessionNAck(context_.connection_id_,
context_.new_session_id_,
protocol_version_,
diff --git a/src/components/protocol_handler/src/incoming_data_handler.cc b/src/components/protocol_handler/src/incoming_data_handler.cc
index 4944ea9cc7..566b36f46d 100644
--- a/src/components/protocol_handler/src/incoming_data_handler.cc
+++ b/src/components/protocol_handler/src/incoming_data_handler.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "protocol_handler/incoming_data_handler.h"
-#include "utils/logger.h"
#include "protocol/common.h"
+#include "utils/logger.h"
namespace protocol_handler {
diff --git a/src/components/protocol_handler/src/multiframe_builder.cc b/src/components/protocol_handler/src/multiframe_builder.cc
index cf8a23ddc1..fbfc061490 100644
--- a/src/components/protocol_handler/src/multiframe_builder.cc
+++ b/src/components/protocol_handler/src/multiframe_builder.cc
@@ -35,9 +35,9 @@
#include <limits>
#include "utils/logger.h"
-#include "utils/make_shared.h"
-#include "utils/lock.h"
+
#include "utils/date_time.h"
+#include "utils/lock.h"
namespace protocol_handler {
@@ -124,7 +124,7 @@ ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() {
if (consecutive_frame_wait_msecs_ != 0) {
LOG4CXX_TRACE(logger_, "Expiration verification");
const int64_t time_left =
- date_time::DateTime::calculateTimeSpan(frame_data.append_time);
+ date_time::calculateTimeSpan(frame_data.append_time);
LOG4CXX_DEBUG(logger_, "mSecs left: " << time_left);
if (time_left >= consecutive_frame_wait_msecs_) {
LOG4CXX_WARN(logger_, "Expired frame: " << frame);
@@ -200,7 +200,7 @@ RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) {
<< connection_id
<< ", session_id: " << static_cast<int>(session_id)
<< ", message_id: " << message_id);
- messageId_map[message_id] = {packet, date_time::DateTime::getCurrentTime()};
+ messageId_map[message_id] = {packet, date_time::getCurrentTime()};
return RESULT_OK;
}
@@ -261,6 +261,11 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame(
}
}
+ const bool packet_protection_flag = packet->protection_flag();
+ if (!assembling_frame->protection_flag() && packet_protection_flag) {
+ assembling_frame->set_protection_flag(packet_protection_flag);
+ }
+
assembling_frame->set_frame_data(new_frame_data);
LOG4CXX_DEBUG(logger_,
@@ -279,7 +284,7 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame(
LOG4CXX_INFO(logger_,
"Assembled frame with payload size: "
<< assembling_frame->payload_size());
- frame_data.append_time = date_time::DateTime::getCurrentTime();
+ frame_data.append_time = date_time::getCurrentTime();
return RESULT_OK;
}
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index 636932f449..04c1529573 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -31,20 +31,21 @@
*/
#include "protocol_handler/protocol_handler_impl.h"
-#include <memory.h>
-#include <algorithm> // std::find
+#include <arpa/inet.h> // for INET6_ADDRSTRLEN
#include <bson_object.h>
+#include <memory.h>
#include <protocol/bson_object_keys.h>
+#include <algorithm> // std::find
#include "connection_handler/connection_handler_impl.h"
+#include "protocol/common.h"
#include "protocol_handler/session_observer.h"
#include "utils/byte_order.h"
#include "utils/helpers.h"
-#include "protocol/common.h"
#ifdef ENABLE_SECURITY
-#include "security_manager/ssl_context.h"
#include "security_manager/security_manager.h"
+#include "security_manager/ssl_context.h"
#endif // ENABLE_SECURITY
namespace protocol_handler {
@@ -58,9 +59,11 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
std::string ConvertPacketDataToString(const uint8_t* data,
const size_t data_size);
-const size_t kStackSize = 65536;
+const size_t kStackSize = 131072;
-ProtocolPacket::ProtocolVersion defaultProtocolVersion(5, 0, 0);
+utils::SemanticVersion default_protocol_version(5, 2, 0);
+utils::SemanticVersion min_multiple_transports_version(5, 1, 0);
+utils::SemanticVersion min_cloud_app_version(5, 2, 0);
ProtocolHandlerImpl::ProtocolHandlerImpl(
const ProtocolHandlerSettings& settings,
@@ -84,6 +87,7 @@ ProtocolHandlerImpl::ProtocolHandlerImpl(
"PH ToMobile", this, threads::ThreadOptions(kStackSize))
, start_session_frame_map_lock_()
, start_session_frame_map_()
+ , tcp_enabled_(false)
#ifdef TELEMETRY_MONITOR
, metric_observer_(NULL)
#endif // TELEMETRY_MONITOR
@@ -196,7 +200,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(ConnectionID connection_id,
uint8_t service_type,
bool protection) {
LOG4CXX_AUTO_TRACE(logger_);
- ProtocolPacket::ProtocolVersion fullVersion;
+ utils::SemanticVersion fullVersion;
SendStartSessionAck(connection_id,
session_id,
input_protocol_version,
@@ -213,7 +217,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
uint32_t hash_id,
uint8_t service_type,
bool protection,
- ProtocolPacket::ProtocolVersion& full_version) {
+ utils::SemanticVersion& full_version) {
LOG4CXX_AUTO_TRACE(logger_);
BsonObject empty_param;
@@ -238,16 +242,18 @@ void ProtocolHandlerImpl::SendStartSessionAck(
uint32_t hash_id,
uint8_t service_type,
bool protection,
- ProtocolPacket::ProtocolVersion& full_version,
+ utils::SemanticVersion& full_version,
BsonObject& params) {
LOG4CXX_AUTO_TRACE(logger_);
+ bool send_transport_update_event = false;
+
uint8_t ack_protocol_version = SupportedSDLProtocolVersion();
const bool proxy_supports_v5_protocol =
input_protocol_version >= PROTOCOL_VERSION_5 ||
(ServiceTypeFromByte(service_type) == kRpc &&
- full_version.majorVersion >= PROTOCOL_VERSION_5);
+ full_version.major_version_ >= PROTOCOL_VERSION_5);
if (kRpc != service_type) {
// In case if input protocol version os bigger then supported, SDL should
@@ -285,6 +291,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
static_cast<int64_t>(
protocol_header_validator_.max_payload_size_by_service_type(
serviceTypeValue)));
+ UNUSED(mtu_written)
LOG4CXX_DEBUG(logger_,
"MTU parameter was written to bson params: "
<< mtu_written << "; Value: "
@@ -295,6 +302,7 @@ void ProtocolHandlerImpl::SendStartSessionAck(
// Hash ID is only used in RPC case
const bool hash_written = bson_object_put_int32(
&params, strings::hash_id, static_cast<int32_t>(hash_id));
+ UNUSED(hash_written);
LOG4CXX_DEBUG(logger_,
"Hash parameter was written to bson params: "
<< hash_written << "; Value: "
@@ -302,25 +310,124 @@ void ProtocolHandlerImpl::SendStartSessionAck(
&params, strings::hash_id)));
// Minimum protocol version supported by both
- ProtocolPacket::ProtocolVersion* minVersion =
- (full_version.majorVersion < PROTOCOL_VERSION_5)
- ? &defaultProtocolVersion
- : ProtocolPacket::ProtocolVersion::min(full_version,
- defaultProtocolVersion);
- char protocolVersionString[256];
- strncpy(protocolVersionString, (*minVersion).to_string().c_str(), 255);
+ utils::SemanticVersion* min_version =
+ (full_version.major_version_ < PROTOCOL_VERSION_5)
+ ? &default_protocol_version
+ : utils::SemanticVersion::min(full_version,
+ default_protocol_version);
+ char protocol_version_string[256];
+ strncpy(protocol_version_string, (*min_version).toString().c_str(), 255);
const bool protocol_ver_written = bson_object_put_string(
- &params, strings::protocol_version, protocolVersionString);
+ &params, strings::protocol_version, protocol_version_string);
+ UNUSED(protocol_ver_written);
LOG4CXX_DEBUG(
logger_,
"Protocol version parameter was written to bson params: "
<< protocol_ver_written << "; Value: "
<< bson_object_get_string(&params, strings::protocol_version));
+
+ LOG4CXX_INFO(logger_,
+ "Protocol Version String " << protocol_version_string);
+
+ std::vector<std::string> secondaryTransports;
+ std::vector<int32_t> audioServiceTransports;
+ std::vector<int32_t> videoServiceTransports;
+ if (*min_version >= min_multiple_transports_version) {
+ if (ParseSecondaryTransportConfiguration(connection_id,
+ secondaryTransports,
+ audioServiceTransports,
+ videoServiceTransports)) {
+ LOG4CXX_DEBUG(logger_, "Multiple transports are enabled.");
+ BsonArray secondaryTransportsArr;
+ bson_array_initialize(&secondaryTransportsArr,
+ secondaryTransports.size());
+ for (unsigned int i = 0; i < secondaryTransports.size(); i++) {
+ char secondaryTransport[255];
+ strncpy(secondaryTransport,
+ secondaryTransports[i].c_str(),
+ sizeof(secondaryTransport));
+ secondaryTransport[sizeof(secondaryTransport) - 1] = '\0';
+ LOG4CXX_DEBUG(
+ logger_,
+ "Adding "
+ << secondaryTransport
+ << " to secondaryTransports parameter of StartSessionAck");
+ bson_array_add_string(&secondaryTransportsArr, secondaryTransport);
+ }
+ bson_object_put_array(
+ &params, strings::secondary_transports, &secondaryTransportsArr);
+
+ BsonArray audioServiceTransportsArr;
+ bson_array_initialize(&audioServiceTransportsArr,
+ audioServiceTransports.size());
+ for (unsigned int i = 0; i < audioServiceTransports.size(); i++) {
+ LOG4CXX_DEBUG(logger_,
+ "Adding " << audioServiceTransports[i]
+ << " to audioServiceTransports parameter "
+ "of StartSessionAck");
+ bson_array_add_int32(&audioServiceTransportsArr,
+ audioServiceTransports[i]);
+ }
+ bson_object_put_array(&params,
+ strings::audio_service_transports,
+ &audioServiceTransportsArr);
+
+ BsonArray videoServiceTransportsArr;
+ bson_array_initialize(&videoServiceTransportsArr,
+ videoServiceTransports.size());
+ for (unsigned int i = 0; i < videoServiceTransports.size(); i++) {
+ LOG4CXX_DEBUG(logger_,
+ "Adding " << videoServiceTransports[i]
+ << " to videoServiceTransports parameter "
+ "of StartSessionAck");
+ bson_array_add_int32(&videoServiceTransportsArr,
+ videoServiceTransports[i]);
+ }
+ bson_object_put_array(&params,
+ strings::video_service_transports,
+ &videoServiceTransportsArr);
+
+ if (settings_.multiple_transports_enabled()) {
+ send_transport_update_event = true;
+ } else {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Multiple transports feature is disabled by configuration");
+ // In this case, we must remember that this session will never have
+ // a secondary transport.
+ connection_handler_.SetSecondaryTransportID(session_id,
+ kDisabledSecondary);
+ }
+ } else {
+ LOG4CXX_WARN(
+ logger_,
+ "Failed to set up secondary transport and service type params");
+ connection_handler_.SetSecondaryTransportID(session_id,
+ kDisabledSecondary);
+ }
+ } else {
+ LOG4CXX_INFO(logger_, "Older protocol version. No multiple transports");
+ connection_handler_.SetSecondaryTransportID(session_id,
+ kDisabledSecondary);
+ }
+
+ std::string policy_app_id =
+ connection_handler_.GetCloudAppID(connection_id);
+ if (*min_version >= min_cloud_app_version && !policy_app_id.empty()) {
+ sync_primitives::AutoLock lock(auth_token_map_lock_);
+ auto it = auth_token_map_.find(policy_app_id);
+ if (it != auth_token_map_.end()) {
+ char auth_token[65536];
+ strncpy(auth_token, it->second.c_str(), 65535);
+ auth_token[sizeof(auth_token) - 1] = '\0';
+ bson_object_put_string(&params, strings::auth_token, auth_token);
+ }
+ }
}
- uint8_t* payloadBytes = bson_object_to_bytes(&params);
- ptr->set_data(payloadBytes, bson_object_size(&params));
- free(payloadBytes);
+ uint8_t* payload_bytes = bson_object_to_bytes(&params);
+ ptr->set_data(payload_bytes, bson_object_size(&params));
+ free(payload_bytes);
} else {
set_hash_id(hash_id, *ptr);
}
@@ -334,6 +441,16 @@ void ProtocolHandlerImpl::SendStartSessionAck(
<< static_cast<int32_t>(service_type) << " session_id "
<< static_cast<int32_t>(session_id) << " protection "
<< (protection ? "ON" : "OFF"));
+
+ if (send_transport_update_event) {
+ // Wait until the StartService ACK has been processed for sending.
+ // The TransportUpdateEvent has a higher priority, being that it's
+ // a SERVICE_TYPE_CONTROL message. (The ACK is SERVICE_TYPE_RPC.)
+ LOG4CXX_DEBUG(logger_, "Waiting for the MessageToMobile queue to be empty");
+ raw_ford_messages_to_mobile_.WaitDumpQueue();
+ LOG4CXX_DEBUG(logger_, "Sending the TransportUpdate event");
+ SendTransportUpdateEvent(connection_id, session_id);
+ }
}
void ProtocolHandlerImpl::SendStartSessionNAck(ConnectionID connection_id,
@@ -376,8 +493,9 @@ void ProtocolHandlerImpl::SendStartSessionNAck(
BsonArray rejectedParamsArr;
bson_array_initialize(&rejectedParamsArr, rejectedParams.size());
for (std::string param : rejectedParams) {
- char paramPtr[255];
- strncpy(paramPtr, param.c_str(), 255);
+ char paramPtr[256];
+ strncpy(paramPtr, param.c_str(), sizeof(paramPtr));
+ paramPtr[sizeof(paramPtr) - 1] = '\0';
bson_array_add_string(&rejectedParamsArr, paramPtr);
}
bson_object_put_array(
@@ -438,8 +556,9 @@ void ProtocolHandlerImpl::SendEndSessionNAck(
BsonArray rejectedParamsArr;
bson_array_initialize(&rejectedParamsArr, rejectedParams.size());
for (std::string param : rejectedParams) {
- char paramPtr[255];
- strncpy(paramPtr, param.c_str(), 255);
+ char paramPtr[256];
+ strncpy(paramPtr, param.c_str(), sizeof(paramPtr));
+ paramPtr[sizeof(paramPtr) - 1] = '\0';
bson_array_add_string(&rejectedParamsArr, paramPtr);
}
bson_object_put_array(
@@ -491,14 +610,18 @@ void ProtocolHandlerImpl::SendEndSessionAck(ConnectionID connection_id,
<< static_cast<int32_t>(session_id));
}
-void ProtocolHandlerImpl::SendEndServicePrivate(int32_t connection_id,
+void ProtocolHandlerImpl::SendEndServicePrivate(int32_t primary_connection_id,
+ int32_t connection_id,
uint8_t session_id,
uint8_t service_type) {
LOG4CXX_AUTO_TRACE(logger_);
uint8_t protocol_version;
if (session_observer_.ProtocolVersionUsed(
- connection_id, session_id, protocol_version)) {
+ primary_connection_id, session_id, protocol_version)) {
+ LOG4CXX_TRACE(logger_,
+ "SendEndServicePrivate using protocol version "
+ << static_cast<int32_t>(protocol_version));
ProtocolFramePtr ptr(
new protocol_handler::ProtocolPacket(connection_id,
protocol_version,
@@ -513,25 +636,31 @@ void ProtocolHandlerImpl::SendEndServicePrivate(int32_t connection_id,
raw_ford_messages_to_mobile_.PostMessage(
impl::RawFordMessageToMobile(ptr, false));
LOG4CXX_DEBUG(logger_,
- "SendEndSession() for connection "
- << connection_id << " for service_type " << service_type
+ "SendEndServicePrivate() for connection "
+ << connection_id << " for service_type "
+ << static_cast<int>(service_type)
+ << " primary connection " << primary_connection_id
<< " session_id " << static_cast<int32_t>(session_id));
} else {
LOG4CXX_WARN(
logger_,
- "SendEndSession is failed connection or session does not exist");
+ "SendEndServicePrivate is failed connection or session does not exist");
}
}
void ProtocolHandlerImpl::SendEndSession(int32_t connection_id,
uint8_t session_id) {
- SendEndServicePrivate(connection_id, session_id, SERVICE_TYPE_RPC);
+ // A session is always associated with a primary connection ID
+ SendEndServicePrivate(
+ connection_id, connection_id, session_id, SERVICE_TYPE_RPC);
}
-void ProtocolHandlerImpl::SendEndService(int32_t connection_id,
+void ProtocolHandlerImpl::SendEndService(int32_t primary_connection_id,
+ int32_t connection_id,
uint8_t session_id,
uint8_t service_type) {
- SendEndServicePrivate(connection_id, session_id, service_type);
+ SendEndServicePrivate(
+ primary_connection_id, connection_id, session_id, service_type);
}
RESULT_CODE ProtocolHandlerImpl::SendHeartBeatAck(ConnectionID connection_id,
@@ -563,6 +692,139 @@ RESULT_CODE ProtocolHandlerImpl::SendHeartBeatAck(ConnectionID connection_id,
return RESULT_FAIL;
}
+void ProtocolHandlerImpl::SendTransportUpdateEvent(ConnectionID connection_id,
+ uint8_t session_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ uint8_t protocol_version;
+ if (session_observer_.ProtocolVersionUsed(
+ connection_id, session_id, protocol_version)) {
+ ProtocolFramePtr ptr(
+ new protocol_handler::ProtocolPacket(connection_id,
+ protocol_version,
+ PROTECTION_OFF,
+ FRAME_TYPE_CONTROL,
+ SERVICE_TYPE_CONTROL,
+ FRAME_DATA_TRANSPORT_EVENT_UPDATE,
+ session_id,
+ 0,
+ message_counters_[session_id]++));
+
+ BsonObject payload_obj;
+ bson_object_initialize_default(&payload_obj);
+
+ int32_t tcp_port = atoi(tcp_port_.c_str());
+ char tcp_ip_address[INET6_ADDRSTRLEN + 1];
+ if (tcp_enabled_ && (tcp_port != 0)) {
+ strncpy(tcp_ip_address, tcp_ip_address_.c_str(), INET6_ADDRSTRLEN);
+ tcp_ip_address[INET6_ADDRSTRLEN] = '\0';
+ bson_object_put_string(
+ &payload_obj, strings::tcp_ip_address, tcp_ip_address);
+ bson_object_put_int32(&payload_obj, strings::tcp_port, tcp_port);
+ } else {
+ tcp_ip_address[0] = '\0';
+ bson_object_put_string(
+ &payload_obj, strings::tcp_ip_address, tcp_ip_address);
+ // omit TCP port number
+ }
+ LOG4CXX_INFO(logger_,
+ "SendTransportUpdateEvent IP address: "
+ << tcp_ip_address << " Port: " << tcp_port);
+
+ uint8_t* payloadBytes = bson_object_to_bytes(&payload_obj);
+ ptr->set_data(payloadBytes, bson_object_size(&payload_obj));
+ free(payloadBytes);
+ bson_object_deinitialize(&payload_obj);
+
+ raw_ford_messages_to_mobile_.PostMessage(
+ impl::RawFordMessageToMobile(ptr, false));
+
+ LOG4CXX_DEBUG(logger_,
+ "SendTransportUpdateEvent() for connection "
+ << connection_id << " for session "
+ << static_cast<int32_t>(session_id));
+ } else {
+ LOG4CXX_WARN(logger_,
+ "SendTransportUpdateEvent is failed connection or session "
+ "does not exist");
+ }
+}
+
+RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportAck(
+ ConnectionID connection_id,
+ ConnectionID primary_transport_connection_id,
+ uint8_t session_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // acquire the protocol version from primary transport
+ uint8_t protocol_version;
+ if (session_observer_.ProtocolVersionUsed(
+ primary_transport_connection_id, session_id, protocol_version)) {
+ ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(
+ connection_id,
+ protocol_version,
+ PROTECTION_OFF,
+ FRAME_TYPE_CONTROL,
+ SERVICE_TYPE_CONTROL,
+ FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_ACK,
+ session_id,
+ 0u,
+ 2));
+
+ raw_ford_messages_to_mobile_.PostMessage(
+ impl::RawFordMessageToMobile(ptr, false));
+ return RESULT_OK;
+ }
+ LOG4CXX_WARN(logger_,
+ "RegisterSecondaryTransportAck is failed connection or session "
+ "does not exist");
+ return RESULT_FAIL;
+}
+
+RESULT_CODE ProtocolHandlerImpl::SendRegisterSecondaryTransportNAck(
+ ConnectionID connection_id,
+ ConnectionID primary_transport_connection_id,
+ uint8_t session_id,
+ BsonObject* reason) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // If mobile sends an invalid session ID and we cannot find out the Connection
+ // ID of primary transport, then we use version 5. (The multiple-transports
+ // feature is added in 5.1.0.)
+ uint8_t protocol_version = PROTOCOL_VERSION_5;
+ if (primary_transport_connection_id > 0) {
+ // acquire the protocol version from primary transport
+ if (!session_observer_.ProtocolVersionUsed(
+ primary_transport_connection_id, session_id, protocol_version)) {
+ LOG4CXX_WARN(logger_,
+ "Failed to acquire protocol version for "
+ "RegisterSecondaryTransportNAck");
+ return RESULT_FAIL;
+ }
+ }
+
+ ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(
+ connection_id,
+ protocol_version,
+ PROTECTION_OFF,
+ FRAME_TYPE_CONTROL,
+ SERVICE_TYPE_CONTROL,
+ FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_NACK,
+ session_id,
+ 0u,
+ 2));
+
+ if (reason) {
+ uint8_t* payloadBytes = bson_object_to_bytes(reason);
+ ptr->set_data(payloadBytes, bson_object_size(reason));
+ free(payloadBytes);
+ }
+
+ raw_ford_messages_to_mobile_.PostMessage(
+ impl::RawFordMessageToMobile(ptr, false));
+ return RESULT_OK;
+}
+
void ProtocolHandlerImpl::SendHeartBeat(int32_t connection_id,
uint8_t session_id) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -590,9 +852,10 @@ void ProtocolHandlerImpl::SendHeartBeat(int32_t connection_id,
}
void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
+ bool needs_encryption,
bool final_message) {
#ifdef TELEMETRY_MONITOR
- const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
+ const date_time::TimeDuration start_time = date_time::getCurrentTime();
#endif // TELEMETRY_MONITOR
LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
@@ -657,6 +920,7 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
message->service_type(),
message->data_size(),
message->data(),
+ needs_encryption,
final_message);
if (result != RESULT_OK) {
LOG4CXX_ERROR(logger_,
@@ -674,6 +938,7 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
message->data_size(),
message->data(),
frame_size,
+ needs_encryption,
final_message);
if (result != RESULT_OK) {
LOG4CXX_ERROR(logger_,
@@ -682,8 +947,7 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
}
#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
- PHTelemetryObserver::MessageMetric* metric =
- new PHTelemetryObserver::MessageMetric();
+ auto metric = std::make_shared<PHTelemetryObserver::MessageMetric>();
metric->message_id = message_id;
metric->connection_key = message->connection_key();
metric->raw_msg = message;
@@ -716,9 +980,9 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) {
LOG4CXX_DEBUG(logger_, "Proccessed " << protocol_frames.size() << " frames");
if (result != RESULT_OK) {
if (result == RESULT_MALFORMED_OCCURS) {
- LOG4CXX_WARN(logger_,
- "Malformed message occurs, connection id "
- << connection_key);
+ LOG4CXX_WARN(
+ logger_,
+ "Malformed message occurs, connection id " << connection_key);
if (!get_settings().malformed_message_filtering()) {
LOG4CXX_DEBUG(logger_, "Malformed message filterign disabled");
session_observer_.OnMalformedMessageCallback(connection_key);
@@ -738,7 +1002,7 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) {
it != protocol_frames.end();
++it) {
#ifdef TELEMETRY_MONITOR
- const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
+ const date_time::TimeDuration start_time = date_time::getCurrentTime();
#endif // TELEMETRY_MONITOR
ProtocolFramePtr frame = *it;
#ifdef ENABLE_SECURITY
@@ -842,6 +1106,10 @@ void ProtocolHandlerImpl::OnTMMessageSendFailed(
<< "Error_text: " << error.text());
}
+void ProtocolHandlerImpl::OnConnectionPending(
+ const transport_manager::DeviceInfo& device_info,
+ const transport_manager::ConnectionUID connection_id) {}
+
void ProtocolHandlerImpl::OnConnectionEstablished(
const transport_manager::DeviceInfo& device_info,
const transport_manager::ConnectionUID connection_id) {
@@ -857,10 +1125,120 @@ void ProtocolHandlerImpl::OnConnectionClosed(
multiframe_builder_.RemoveConnection(connection_id);
}
-void ProtocolHandlerImpl::NotifyOnFailedHandshake() {
+void ProtocolHandlerImpl::OnUnexpectedDisconnect(
+ const transport_manager::ConnectionUID connection_id,
+ const transport_manager::CommunicationError& error) {
+ OnConnectionClosed(connection_id);
+}
+
+void ProtocolHandlerImpl::NotifyOnGetSystemTimeFailed() {
LOG4CXX_AUTO_TRACE(logger_);
#ifdef ENABLE_SECURITY
- security_manager_->NotifyListenersOnHandshakeFailed();
+ security_manager_->ResetPendingSystemTimeRequests();
+ security_manager_->NotifyListenersOnGetSystemTimeFailed();
+#endif // ENABLE_SECURITY
+}
+
+void ProtocolHandlerImpl::ProcessFailedPTU() {
+#ifdef ENABLE_SECURITY
+ security_manager_->ProcessFailedPTU();
+#endif // ENABLE_SECURITY
+}
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+void ProtocolHandlerImpl::ProcessFailedCertDecrypt() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ security_manager_->ProcessFailedCertDecrypt();
+}
+#endif
+
+void ProtocolHandlerImpl::OnTransportConfigUpdated(
+ const transport_manager::transport_adapter::TransportConfig& configs) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ transport_manager::transport_adapter::TransportConfig::const_iterator it =
+ configs.find(transport_manager::transport_adapter::tc_enabled);
+ if (configs.end() == it) {
+ LOG4CXX_WARN(logger_, "No enabled field in OnTransportConfigUpdated");
+ return;
+ }
+
+ bool tcp_enabled = (0 == strcmp("true", it->second.c_str()));
+ std::string tcp_port;
+
+ if (tcp_enabled) {
+ it = configs.find(transport_manager::transport_adapter::tc_tcp_port);
+ if (configs.end() == it) {
+ LOG4CXX_WARN(logger_, "No port field in OnTransportConfigUpdated");
+ return;
+ }
+ tcp_port = it->second;
+
+ it = configs.find(transport_manager::transport_adapter::tc_tcp_ip_address);
+ if (configs.end() == it) {
+ LOG4CXX_WARN(logger_, "No IP address field in OnTransportConfigUpdated");
+ return;
+ }
+ tcp_enabled_ = true;
+ tcp_port_ = tcp_port;
+ tcp_ip_address_ = it->second;
+ } else {
+ tcp_enabled_ = false;
+ tcp_port_.clear();
+ tcp_ip_address_.clear();
+ }
+
+ LOG4CXX_INFO(logger_,
+ "OnTransportConfigUpdated: new config enabled is "
+ << tcp_enabled_ << ". Port is " << tcp_port_
+ << ". IP Address is " << tcp_ip_address_);
+
+ // Walk the SessionConnection map and find all sessions that need a
+ // TransportUpdate Event. Sessions flagged with kDisabledSecondary in their
+ // secondary transport are ineligible for secondary transport, and
+ // therefore don't get this event.
+ DataAccessor<connection_handler::SessionConnectionMap>
+ session_connection_map_accessor =
+ connection_handler_.session_connection_map();
+ const connection_handler::SessionConnectionMap& session_connection_map =
+ session_connection_map_accessor.GetData();
+ connection_handler::SessionConnectionMap::const_iterator itr =
+ session_connection_map.begin();
+ while (itr != session_connection_map.end()) {
+ const connection_handler::SessionTransports st = itr->second;
+ LOG4CXX_INFO(logger_,
+ "OnTransportConfigUpdated found session "
+ << itr->first << " with primary connection "
+ << st.primary_transport << " and secondary connection "
+ << st.secondary_transport);
+ if (st.secondary_transport != kDisabledSecondary) {
+ SendTransportUpdateEvent(st.primary_transport, itr->first);
+ }
+ itr++;
+ }
+}
+
+void ProtocolHandlerImpl::OnAuthTokenUpdated(const std::string& policy_app_id,
+ const std::string& auth_token) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(auth_token_map_lock_);
+ if (auth_token.empty()) {
+ auth_token_map_.erase(policy_app_id);
+ } else {
+ auth_token_map_[policy_app_id] = auth_token;
+ }
+}
+
+bool ProtocolHandlerImpl::IsRPCServiceSecure(
+ const uint32_t connection_key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+#ifdef ENABLE_SECURITY
+
+ security_manager::SSLContext* context =
+ session_observer_.GetSSLContext(connection_key, ServiceType::kRpc);
+ return (context && context->IsInitCompleted());
+#else
+ return false;
#endif // ENABLE_SECURITY
}
@@ -908,13 +1286,18 @@ RESULT_CODE ProtocolHandlerImpl::SendSingleFrameMessage(
const uint8_t service_type,
const size_t data_size,
const uint8_t* data,
+ const bool needs_encryption,
const bool is_final_message) {
LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Packet needs encryption: " << std::boolalpha << needs_encryption);
+
ProtocolFramePtr ptr(
new protocol_handler::ProtocolPacket(connection_id,
protocol_version,
- PROTECTION_OFF,
+ needs_encryption,
FRAME_TYPE_SINGLE,
service_type,
FRAME_DATA_SINGLE,
@@ -936,12 +1319,13 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage(
const size_t data_size,
const uint8_t* data,
const size_t max_frame_size,
+ const bool needs_encryption,
const bool is_final_message) {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- " data size " << data_size << " max_frame_size "
- << max_frame_size);
+ LOG4CXX_DEBUG(
+ logger_,
+ " data size " << data_size << " max_frame_size " << max_frame_size);
// remainder of last frame
const size_t lastframe_remainder = data_size % max_frame_size;
@@ -976,7 +1360,7 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage(
const ProtocolFramePtr firstPacket(
new protocol_handler::ProtocolPacket(connection_id,
protocol_version,
- PROTECTION_OFF,
+ needs_encryption,
FRAME_TYPE_FIRST,
service_type,
FRAME_DATA_FIRST,
@@ -1000,7 +1384,7 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage(
const ProtocolFramePtr ptr(
new protocol_handler::ProtocolPacket(connection_id,
protocol_version,
- PROTECTION_OFF,
+ needs_encryption,
FRAME_TYPE_CONSECUTIVE,
service_type,
data_type,
@@ -1048,6 +1432,13 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage(
<< packet->data_size() << "; message "
<< ConvertPacketDataToString(packet->data(), packet->data_size()));
+ // Replace a potential secondary transport ID in the packet with the primary
+ // transport ID
+ const connection_handler::SessionTransports st =
+ connection_handler_.GetSessionTransports(packet->session_id());
+ if (st.primary_transport != 0) {
+ packet->set_connection_id(st.primary_transport);
+ }
const uint32_t connection_key = session_observer_.KeyFromPair(
packet->connection_id(), packet->session_id());
@@ -1055,6 +1446,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage(
packet->protocol_version(),
packet->data(),
packet->total_data_bytes(),
+ packet->protection_flag(),
packet->service_type(),
packet->payload_size()));
if (!rawMessage) {
@@ -1062,8 +1454,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage(
}
#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
- PHTelemetryObserver::MessageMetric* metric =
- new PHTelemetryObserver::MessageMetric();
+ auto metric = std::make_shared<PHTelemetryObserver::MessageMetric>();
metric->message_id = packet->message_id();
metric->connection_key = connection_key;
metric->raw_msg = rawMessage;
@@ -1080,6 +1471,14 @@ RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage(
const ProtocolFramePtr packet) {
LOG4CXX_AUTO_TRACE(logger_);
+ // Replace a potential secondary transport ID in the packet with the primary
+ // transport ID
+ const connection_handler::SessionTransports st =
+ connection_handler_.GetSessionTransports(packet->session_id());
+ if (st.primary_transport != 0) {
+ packet->set_connection_id(st.primary_transport);
+ }
+
if (multiframe_builder_.AddFrame(packet) != RESULT_OK) {
LOG4CXX_WARN(logger_, "Frame assembling issue");
}
@@ -1117,6 +1516,10 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessage(
<< packet->connection_id());
return RESULT_OK;
}
+ case FRAME_DATA_REGISTER_SECONDARY_TRANSPORT: {
+ LOG4CXX_TRACE(logger_, "FrameData: RegisterSecondaryTransport");
+ return HandleControlMessageRegisterSecondaryTransport(packet);
+ }
default:
LOG4CXX_WARN(logger_,
"Control message of type "
@@ -1137,11 +1540,18 @@ uint32_t get_hash_id(const ProtocolPacket& packet) {
return HASH_ID_WRONG;
}
if (packet.protocol_version() >= PROTOCOL_VERSION_5) {
- BsonObject obj = bson_object_from_bytes(packet.data());
- const uint32_t hash_id =
- (uint32_t)bson_object_get_int32(&obj, strings::hash_id);
- bson_object_deinitialize(&obj);
- return hash_id;
+ BsonObject obj;
+ size_t obj_size = bson_object_from_bytes_len(
+ &obj, packet.data(), packet.total_data_bytes());
+ if (obj_size > 0) {
+ const uint32_t hash_id =
+ (uint32_t)bson_object_get_int32(&obj, strings::hash_id);
+ bson_object_deinitialize(&obj);
+ return hash_id;
+ } else {
+ LOG4CXX_WARN(logger_, "Failed to parse BSON field for hash ID");
+ return HASH_ID_WRONG;
+ }
} else {
const uint32_t hash_be = *(reinterpret_cast<uint32_t*>(packet.data()));
const uint32_t hash_le = BE_TO_LE32(hash_be);
@@ -1176,7 +1586,8 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession(
<< " type.");
if (packet.protocol_version() >= PROTOCOL_VERSION_5) {
std::vector<std::string> rejectedParams;
- if (hash_id == protocol_handler::HASH_ID_WRONG) {
+ if (hash_id == protocol_handler::HASH_ID_WRONG &&
+ packet.service_type() == kRpc) {
rejectedParams.push_back(std::string(strings::hash_id));
}
SendEndSessionNAck(connection_id,
@@ -1194,6 +1605,59 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession(
return RESULT_OK;
}
+const ServiceStatus ProtocolHandlerImpl::ServiceDisallowedBySettings(
+ const ServiceType service_type,
+ const ConnectionID connection_id,
+ const uint8_t session_id,
+ const bool protection) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const std::string& transport =
+ session_observer_.TransportTypeProfileStringFromConnHandle(connection_id);
+
+ const auto video_transports = settings_.video_service_transports();
+ const bool is_video_allowed =
+ video_transports.empty() ||
+ std::find(video_transports.begin(), video_transports.end(), transport) !=
+ video_transports.end();
+
+ const auto audio_transports = settings_.audio_service_transports();
+ const bool is_audio_allowed =
+ audio_transports.empty() ||
+ std::find(audio_transports.begin(), audio_transports.end(), transport) !=
+ audio_transports.end();
+
+#ifdef ENABLE_SECURITY
+ const auto& force_protected = get_settings().force_protected_service();
+
+ const auto& force_unprotected = get_settings().force_unprotected_service();
+
+ const bool is_force_protected =
+ (helpers::in_range(force_protected, service_type));
+
+ const bool is_force_unprotected =
+ (helpers::in_range(force_unprotected, service_type));
+
+ const bool can_start_protected = is_force_protected && protection;
+
+ const bool can_start_unprotected = is_force_unprotected && !protection;
+
+ if (is_force_protected && !can_start_protected) {
+ return ServiceStatus::PROTECTION_ENFORCED;
+ }
+
+ if (is_force_unprotected && !can_start_unprotected) {
+ return ServiceStatus::UNSECURE_START_FAILED;
+ }
+#endif // ENABLE_SECURITY
+
+ if ((ServiceType::kMobileNav == service_type && !is_video_allowed) ||
+ (ServiceType::kAudio == service_type && !is_audio_allowed)) {
+ return ServiceStatus::SERVICE_START_FAILED;
+ }
+
+ return ServiceStatus::INVALID_ENUM;
+}
+
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK(
const ProtocolPacket& packet) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1214,166 +1678,6 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK(
return RESULT_OK;
}
-// Suppress warning for deprecated method used within another deprecated method
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
- const ProtocolPacket& packet) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
- "Protocol version:" << static_cast<int>(packet.protocol_version()));
- const ServiceType service_type = ServiceTypeFromByte(packet.service_type());
-
-#ifdef ENABLE_SECURITY
- const bool protection =
- // Protocol version 1 is not support protection
- (packet.protocol_version() > PROTOCOL_VERSION_1)
- ? packet.protection_flag()
- : false;
-#else
- const bool protection = false;
-#endif // ENABLE_SECURITY
-
- uint32_t hash_id;
- const ConnectionID connection_id = packet.connection_id();
- const uint32_t session_id = session_observer_.OnSessionStartedCallback(
- connection_id, packet.session_id(), service_type, protection, &hash_id);
-
- if (0 == session_id) {
- LOG4CXX_WARN(logger_,
- "Refused by session_observer to create service "
- << static_cast<int32_t>(service_type) << " type.");
- SendStartSessionNAck(connection_id,
- packet.session_id(),
- packet.protocol_version(),
- packet.service_type());
- return RESULT_OK;
- }
-
-#ifdef ENABLE_SECURITY
- // for packet is encrypted and security plugin is enable
- if (protection && security_manager_) {
- const uint32_t connection_key =
- session_observer_.KeyFromPair(connection_id, session_id);
-
- security_manager::SSLContext* ssl_context =
- security_manager_->CreateSSLContext(
- connection_key, security_manager::SecurityManager::kUseExisting);
- if (!ssl_context) {
- const std::string error("CreateSSLContext failed");
- LOG4CXX_ERROR(logger_, error);
- security_manager_->SendInternalError(
- connection_key,
- security_manager::SecurityManager::ERROR_INTERNAL,
- error);
- // Start service without protection
- SendStartSessionAck(connection_id,
- session_id,
- packet.protocol_version(),
- hash_id,
- packet.service_type(),
- PROTECTION_OFF);
- return RESULT_OK;
- }
- ProtocolPacket::ProtocolVersion* fullVersion;
- std::vector<std::string> rejectedParams(0, std::string(""));
- // Can't check protocol_version because the first packet is v1, but there
- // could still be a payload, in which case we can get the real protocol
- // version
- if (packet.service_type() == kRpc && packet.data_size() != 0) {
- BsonObject obj = bson_object_from_bytes(packet.data());
- fullVersion = new ProtocolPacket::ProtocolVersion(
- std::string(bson_object_get_string(&obj, "protocolVersion")));
- bson_object_deinitialize(&obj);
- // Constructed payloads added in Protocol v5
- if (fullVersion->majorVersion < PROTOCOL_VERSION_5) {
- rejectedParams.push_back(std::string("protocolVersion"));
- }
- } else {
- fullVersion = new ProtocolPacket::ProtocolVersion();
- }
- if (!rejectedParams.empty()) {
- SendStartSessionNAck(connection_id,
- packet.session_id(),
- packet.protocol_version(),
- packet.service_type(),
- rejectedParams);
- } else if (ssl_context->IsInitCompleted()) {
- // mark service as protected
- session_observer_.SetProtectionFlag(connection_key, service_type);
- // Start service as protected with current SSLContext
- SendStartSessionAck(connection_id,
- session_id,
- packet.protocol_version(),
- hash_id,
- packet.service_type(),
- PROTECTION_ON,
- *fullVersion);
- } else {
- security_manager_->AddListener(
- new HandshakeHandler(*this,
- session_observer_,
- connection_key,
- connection_id,
- session_id,
- packet.protocol_version(),
- hash_id,
- service_type,
- get_settings().force_protected_service(),
- false,
- *fullVersion,
- NULL));
- if (!ssl_context->IsHandshakePending()) {
- // Start handshake process
- security_manager_->StartHandshake(connection_key);
- }
- }
- delete fullVersion;
- LOG4CXX_DEBUG(logger_,
- "Protection establishing for connection "
- << connection_key << " is in progress");
- return RESULT_OK;
- }
-#endif // ENABLE_SECURITY
- if (packet.service_type() == kRpc && packet.data_size() != 0) {
- BsonObject obj = bson_object_from_bytes(packet.data());
- ProtocolPacket::ProtocolVersion fullVersion(
- bson_object_get_string(&obj, "protocolVersion"));
- bson_object_deinitialize(&obj);
-
- if (fullVersion.majorVersion >= PROTOCOL_VERSION_5) {
- // Start service without protection
- SendStartSessionAck(connection_id,
- session_id,
- packet.protocol_version(),
- hash_id,
- packet.service_type(),
- PROTECTION_OFF,
- fullVersion);
- } else {
- std::vector<std::string> rejectedParams(1,
- std::string("protocolVersion"));
- SendStartSessionNAck(connection_id,
- packet.session_id(),
- packet.protocol_version(),
- packet.service_type(),
- rejectedParams);
- }
-
- } else {
- // Start service without protection
- SendStartSessionAck(connection_id,
- session_id,
- packet.protocol_version(),
- hash_id,
- packet.service_type(),
- PROTECTION_OFF);
- }
- return RESULT_OK;
-}
-#pragma GCC diagnostic pop
-
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
const ProtocolFramePtr packet) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1381,15 +1685,9 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
logger_,
"Protocol version:" << static_cast<int>(packet->protocol_version()));
const ServiceType service_type = ServiceTypeFromByte(packet->service_type());
- BsonObject bson_obj;
- if (packet->data() != NULL) {
- bson_obj = bson_object_from_bytes(packet->data());
- } else {
- bson_object_initialize_default(&bson_obj);
- }
-#ifdef ENABLE_SECURITY
const uint8_t protocol_version = packet->protocol_version();
+#ifdef ENABLE_SECURITY
const bool protection =
// Protocol version 1 does not support protection
(protocol_version > PROTOCOL_VERSION_1) ? packet->protection_flag()
@@ -1400,6 +1698,30 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
const ConnectionID connection_id = packet->connection_id();
const uint8_t session_id = packet->session_id();
+ const uint32_t connection_key =
+ session_observer_.KeyFromPair(connection_id, session_id);
+
+ service_status_update_handler_->OnServiceUpdate(
+ connection_key, service_type, ServiceStatus::SERVICE_RECEIVED);
+
+ const auto settings_check = ServiceDisallowedBySettings(
+ service_type, connection_id, session_id, protection);
+
+ if (ServiceStatus::INVALID_ENUM != settings_check) {
+ LOG4CXX_DEBUG(logger_,
+ "Rejecting StartService for service:"
+ << service_type << ", disallowed by settings.");
+ service_status_update_handler_->OnServiceUpdate(
+ connection_key, service_type, settings_check);
+ SendStartSessionNAck(
+ connection_id, session_id, protocol_version, service_type);
+ return RESULT_OK;
+ }
+
+ LOG4CXX_INFO(logger_,
+ "StartSession ID " << static_cast<int>(session_id)
+ << " and Connection ID "
+ << static_cast<int>(connection_id));
{
sync_primitives::AutoLock auto_lock(start_session_frame_map_lock_);
@@ -1407,6 +1729,19 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
packet;
}
+ BsonObject bson_obj;
+ if (packet->data() != NULL) {
+ size_t bson_obj_size = bson_object_from_bytes_len(
+ &bson_obj, packet->data(), packet->total_data_bytes());
+ if (bson_obj_size == 0) {
+ LOG4CXX_WARN(logger_,
+ "Failed to parse BSON field of start service packet");
+ bson_object_initialize_default(&bson_obj);
+ }
+ } else {
+ bson_object_initialize_default(&bson_obj);
+ }
+
session_observer_.OnSessionStartedCallback(
connection_id, packet->session_id(), service_type, protection, &bson_obj);
bson_object_deinitialize(&bson_obj);
@@ -1414,21 +1749,48 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
return RESULT_OK;
}
-void ProtocolHandlerImpl::NotifySessionStartedResult(
- int32_t connection_id,
- uint8_t session_id,
- uint8_t generated_session_id,
- uint32_t hash_id,
- bool protection,
- std::vector<std::string>& rejected_params) {
+RESULT_CODE ProtocolHandlerImpl::HandleControlMessageRegisterSecondaryTransport(
+ const ProtocolFramePtr packet) {
LOG4CXX_AUTO_TRACE(logger_);
- protocol_handler::SessionContext context(connection_id,
- session_id,
- generated_session_id,
- ServiceType::kInvalidServiceType,
- hash_id,
- protection);
- NotifySessionStarted(context, rejected_params);
+ const uint8_t session_id = packet->session_id();
+ const ConnectionID connection_id = packet->connection_id();
+ ConnectionID primary_connection_id = 0;
+
+ LOG4CXX_INFO(logger_,
+ "RegisterSecondaryTransport ID "
+ << static_cast<int>(session_id) << " and Connection ID "
+ << static_cast<int>(connection_id));
+
+ if (connection_handler_.OnSecondaryTransportStarted(
+ primary_connection_id, connection_id, session_id)) {
+ SendRegisterSecondaryTransportAck(
+ connection_id, primary_connection_id, session_id);
+ } else {
+ char reason[256];
+ BsonObject registerSecondaryTransportNackObj;
+ bson_object_initialize_default(&registerSecondaryTransportNackObj);
+ if (0 == session_id) {
+ strncpy(reason,
+ "RegisterSecondaryTransport MUST include a non-zero session ID",
+ 255);
+ } else if (primary_connection_id == 0) {
+ strncpy(reason, "RegisterSecondaryTransport session ID not found", 255);
+ } else {
+ strncpy(
+ reason,
+ "RegisterSecondaryTransport session ID has already been registered",
+ 255);
+ }
+ bson_object_put_string(
+ &registerSecondaryTransportNackObj, strings::reason, reason);
+ SendRegisterSecondaryTransportNAck(connection_id,
+ primary_connection_id,
+ session_id,
+ &registerSecondaryTransportNackObj);
+ bson_object_deinitialize(&registerSecondaryTransportNackObj);
+ }
+
+ return RESULT_OK;
}
void ProtocolHandlerImpl::NotifySessionStarted(
@@ -1455,8 +1817,15 @@ void ProtocolHandlerImpl::NotifySessionStarted(
LOG4CXX_WARN(logger_,
"Refused by session_observer to create service "
<< static_cast<int32_t>(service_type) << " type.");
+ const auto session_id = packet->session_id();
+ const auto connection_key =
+ session_observer_.KeyFromPair(context.connection_id_, session_id);
+ service_status_update_handler_->OnServiceUpdate(
+ connection_key,
+ context.service_type_,
+ ServiceStatus::SERVICE_START_FAILED);
SendStartSessionNAck(context.connection_id_,
- packet->session_id(),
+ session_id,
protocol_version,
packet->service_type(),
rejected_params);
@@ -1469,54 +1838,70 @@ void ProtocolHandlerImpl::NotifySessionStarted(
// when video service is successfully started, copy input parameters
// ("width", "height", "videoProtocol", "videoCodec") to the ACK packet
if (packet->service_type() == kMobileNav && packet->data() != NULL) {
- BsonObject req_param = bson_object_from_bytes(packet->data());
- BsonElement* element = NULL;
-
- if ((element = bson_object_get(&req_param, strings::height)) != NULL &&
- element->type == TYPE_INT32) {
- bson_object_put_int32(start_session_ack_params.get(),
- strings::height,
- bson_object_get_int32(&req_param, strings::height));
- }
- if ((element = bson_object_get(&req_param, strings::width)) != NULL &&
- element->type == TYPE_INT32) {
- bson_object_put_int32(start_session_ack_params.get(),
- strings::width,
- bson_object_get_int32(&req_param, strings::width));
- }
- char* protocol =
- bson_object_get_string(&req_param, strings::video_protocol);
- if (protocol != NULL) {
- bson_object_put_string(
- start_session_ack_params.get(), strings::video_protocol, protocol);
- }
- char* codec = bson_object_get_string(&req_param, strings::video_codec);
- if (codec != NULL) {
- bson_object_put_string(
- start_session_ack_params.get(), strings::video_codec, codec);
+ BsonObject req_param;
+ size_t req_param_size = bson_object_from_bytes_len(
+ &req_param, packet->data(), packet->total_data_bytes());
+ if (req_param_size > 0) {
+ BsonElement* element = NULL;
+
+ if ((element = bson_object_get(&req_param, strings::height)) != NULL &&
+ element->type == TYPE_INT32) {
+ bson_object_put_int32(
+ start_session_ack_params.get(),
+ strings::height,
+ bson_object_get_int32(&req_param, strings::height));
+ }
+ if ((element = bson_object_get(&req_param, strings::width)) != NULL &&
+ element->type == TYPE_INT32) {
+ bson_object_put_int32(
+ start_session_ack_params.get(),
+ strings::width,
+ bson_object_get_int32(&req_param, strings::width));
+ }
+ char* protocol =
+ bson_object_get_string(&req_param, strings::video_protocol);
+ if (protocol != NULL) {
+ bson_object_put_string(
+ start_session_ack_params.get(), strings::video_protocol, protocol);
+ }
+ char* codec = bson_object_get_string(&req_param, strings::video_codec);
+ if (codec != NULL) {
+ bson_object_put_string(
+ start_session_ack_params.get(), strings::video_codec, codec);
+ }
+ bson_object_deinitialize(&req_param);
+ } else {
+ LOG4CXX_WARN(logger_,
+ "Failed to parse BSON field of start service (video)");
}
- bson_object_deinitialize(&req_param);
}
- std::shared_ptr<ProtocolPacket::ProtocolVersion> fullVersion;
+ std::shared_ptr<utils::SemanticVersion> fullVersion;
// Can't check protocol_version because the first packet is v1, but there
// could still be a payload, in which case we can get the real protocol
// version
if (packet->service_type() == kRpc && packet->data() != NULL) {
- BsonObject request_params = bson_object_from_bytes(packet->data());
- char* version_param =
- bson_object_get_string(&request_params, strings::protocol_version);
- std::string version_string(version_param == NULL ? "" : version_param);
- fullVersion =
- std::make_shared<ProtocolPacket::ProtocolVersion>(version_string);
- // Constructed payloads added in Protocol v5
- if (fullVersion->majorVersion < PROTOCOL_VERSION_5) {
- rejected_params.push_back(std::string(strings::protocol_version));
+ BsonObject request_params;
+ size_t request_params_size = bson_object_from_bytes_len(
+ &request_params, packet->data(), packet->total_data_bytes());
+ if (request_params_size > 0) {
+ char* version_param =
+ bson_object_get_string(&request_params, strings::protocol_version);
+ std::string version_string(version_param == NULL ? "" : version_param);
+ fullVersion = std::make_shared<utils::SemanticVersion>(version_string);
+ // Constructed payloads added in Protocol v5
+ if (fullVersion->major_version_ < PROTOCOL_VERSION_5) {
+ rejected_params.push_back(std::string(strings::protocol_version));
+ }
+ bson_object_deinitialize(&request_params);
+ } else {
+ LOG4CXX_WARN(logger_,
+ "Failed to parse start service packet for version string");
+ fullVersion = std::make_shared<utils::SemanticVersion>();
}
- bson_object_deinitialize(&request_params);
} else {
- fullVersion = std::make_shared<ProtocolPacket::ProtocolVersion>();
+ fullVersion = std::make_shared<utils::SemanticVersion>();
}
#ifdef ENABLE_SECURITY
@@ -1526,12 +1911,14 @@ void ProtocolHandlerImpl::NotifySessionStarted(
context.connection_id_, context.new_session_id_);
std::shared_ptr<HandshakeHandler> handler =
- std::make_shared<HandshakeHandler>(*this,
- session_observer_,
- *fullVersion,
- context,
- packet->protocol_version(),
- start_session_ack_params);
+ std::make_shared<HandshakeHandler>(
+ *this,
+ session_observer_,
+ *fullVersion,
+ context,
+ packet->protocol_version(),
+ start_session_ack_params,
+ *(service_status_update_handler_.get()));
security_manager::SSLContext* ssl_context =
security_manager_->CreateSSLContext(
@@ -1562,6 +1949,10 @@ void ProtocolHandlerImpl::NotifySessionStarted(
// mark service as protected
session_observer_.SetProtectionFlag(connection_key, service_type);
// Start service as protected with current SSLContext
+ service_status_update_handler_->OnServiceUpdate(
+ connection_key,
+ context.service_type_,
+ ServiceStatus::SERVICE_ACCEPTED);
SendStartSessionAck(context.connection_id_,
context.new_session_id_,
packet->protocol_version(),
@@ -1598,7 +1989,11 @@ void ProtocolHandlerImpl::NotifySessionStarted(
return;
}
#endif // ENABLE_SECURITY
+ const uint32_t connection_key = session_observer_.KeyFromPair(
+ context.connection_id_, context.new_session_id_);
if (rejected_params.empty()) {
+ service_status_update_handler_->OnServiceUpdate(
+ connection_key, context.service_type_, ServiceStatus::SERVICE_ACCEPTED);
SendStartSessionAck(context.connection_id_,
context.new_session_id_,
packet->protocol_version(),
@@ -1608,6 +2003,10 @@ void ProtocolHandlerImpl::NotifySessionStarted(
*fullVersion,
*start_session_ack_params);
} else {
+ service_status_update_handler_->OnServiceUpdate(
+ connection_key,
+ context.service_type_,
+ ServiceStatus::SERVICE_START_FAILED);
SendStartSessionNAck(context.connection_id_,
packet->session_id(),
protocol_version,
@@ -1619,9 +2018,9 @@ void ProtocolHandlerImpl::NotifySessionStarted(
RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat(
const ProtocolPacket& packet) {
const ConnectionID connection_id = packet.connection_id();
- LOG4CXX_DEBUG(logger_,
- "Sending heart beat acknowledgment for connection "
- << connection_id);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Sending heart beat acknowledgment for connection " << connection_id);
uint8_t protocol_version;
if (session_observer_.ProtocolVersionUsed(
connection_id, packet.session_id(), protocol_version)) {
@@ -1657,21 +2056,21 @@ void ProtocolHandlerImpl::PopValideAndExpirateMultiframes() {
const uint32_t connection_key = session_observer_.KeyFromPair(
frame->connection_id(), frame->session_id());
- LOG4CXX_DEBUG(logger_,
- "Result frame" << frame << "for connection "
- << connection_key);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Result frame" << frame << "for connection " << connection_key);
const RawMessagePtr rawMessage(new RawMessage(connection_key,
frame->protocol_version(),
frame->data(),
frame->total_data_bytes(),
+ frame->protection_flag(),
frame->service_type(),
frame->payload_size()));
DCHECK(rawMessage);
#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
- PHTelemetryObserver::MessageMetric* metric =
- new PHTelemetryObserver::MessageMetric();
+ auto metric = std::make_shared<PHTelemetryObserver::MessageMetric>();
metric->raw_msg = rawMessage;
metric_observer_->EndMessageProcess(metric);
}
@@ -1687,9 +2086,9 @@ bool ProtocolHandlerImpl::TrackMessage(const uint32_t& connection_key) {
if (frequency_time > 0u && frequency_count > 0u) {
const size_t message_frequency =
message_meter_.TrackMessage(connection_key);
- LOG4CXX_DEBUG(logger_,
- "Frequency of " << connection_key << " is "
- << message_frequency);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Frequency of " << connection_key << " is " << message_frequency);
if (message_frequency > frequency_count) {
LOG4CXX_WARN(logger_,
"Frequency of " << connection_key << " is marked as high.");
@@ -1715,9 +2114,9 @@ bool ProtocolHandlerImpl::TrackMalformedMessage(const uint32_t& connection_key,
<< malformed_message_frequency);
if (!get_settings().malformed_message_filtering() ||
malformed_message_frequency > malformed_frequency_count) {
- LOG4CXX_WARN(logger_,
- "Malformed frequency of " << connection_key
- << " is marked as high.");
+ LOG4CXX_WARN(
+ logger_,
+ "Malformed frequency of " << connection_key << " is marked as high.");
session_observer_.OnMalformedMessageCallback(connection_key);
malformed_message_meter_.RemoveIdentifier(connection_key);
return true;
@@ -1767,7 +2166,8 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageToMobile message) {
"Message to mobile app: connection id "
<< static_cast<int>(message->connection_id())
<< ";"
- " dataSize: " << message->data_size()
+ " dataSize: "
+ << message->data_size()
<< " ;"
" protocolVersion "
<< static_cast<int>(message->protocol_version()));
@@ -1788,6 +2188,11 @@ void ProtocolHandlerImpl::Stop() {
start_session_frame_map_.clear();
}
+void ProtocolHandlerImpl::set_service_status_update_handler(
+ std::unique_ptr<ServiceStatusUpdateHandler> handler) {
+ service_status_update_handler_ = std::move(handler);
+}
+
#ifdef ENABLE_SECURITY
void ProtocolHandlerImpl::set_security_manager(
security_manager::SecurityManager* security_manager) {
@@ -1815,7 +2220,12 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) {
packet->connection_id(), packet->session_id());
security_manager::SSLContext* context = session_observer_.GetSSLContext(
connection_key, ServiceTypeFromByte(packet->service_type()));
- if (!context || !context->IsInitCompleted()) {
+
+ LOG4CXX_DEBUG(
+ logger_,
+ "Protection flag is: " << packet->protection_flag() << std::boolalpha);
+ if ((!context || !context->IsInitCompleted()) || !packet->protection_flag()) {
+ LOG4CXX_DEBUG(logger_, "Ecryption is skipped!");
return RESULT_OK;
}
const uint8_t* out_data;
@@ -1989,4 +2399,244 @@ uint8_t ProtocolHandlerImpl::SupportedSDLProtocolVersion() const {
LOG4CXX_AUTO_TRACE(logger_);
return get_settings().max_supported_protocol_version();
}
+
+const impl::TransportTypes transportTypes = {
+ std::make_pair(
+ std::string("AOA_USB"),
+ impl::TransportDescription(impl::TransportType::TT_USB, false, true)),
+ std::make_pair(std::string("SPP_BLUETOOTH"),
+ impl::TransportDescription(
+ impl::TransportType::TT_BLUETOOTH, false, true)),
+ std::make_pair(std::string("IAP_BLUETOOTH"),
+ impl::TransportDescription(
+ impl::TransportType::TT_BLUETOOTH, true, false)),
+ std::make_pair(
+ std::string("IAP_USB"),
+ impl::TransportDescription(impl::TransportType::TT_USB, true, false)),
+ std::make_pair(
+ std::string("TCP_WIFI"),
+ impl::TransportDescription(impl::TransportType::TT_WIFI, true, true)),
+ std::make_pair(
+ std::string("IAP_USB_HOST_MODE"),
+ impl::TransportDescription(impl::TransportType::TT_USB, true, false)),
+ std::make_pair(
+ std::string("IAP_USB_DEVICE_MODE"),
+ impl::TransportDescription(impl::TransportType::TT_USB, true, false)),
+ std::make_pair(
+ std::string("IAP_CARPLAY"),
+ impl::TransportDescription(impl::TransportType::TT_WIFI, true, false)),
+ std::make_pair(std::string("WEBSOCKET"),
+ impl::TransportDescription(
+ impl::TransportType::TT_WEBSOCKET, false, false))};
+
+const impl::TransportDescription
+ProtocolHandlerImpl::GetTransportTypeFromConnectionType(
+ const std::string& connection_type) const {
+ impl::TransportDescription result =
+ impl::TransportDescription(impl::TransportType::TT_NONE, false, false);
+ impl::TransportTypes::const_iterator it =
+ transportTypes.find(connection_type);
+ if (it != transportTypes.end()) {
+ result = it->second;
+ } else {
+ LOG4CXX_ERROR(logger_, "Unknown connection type " << connection_type);
+ }
+
+ return result;
+}
+
+const bool ProtocolHandlerImpl::ParseSecondaryTransportConfiguration(
+ const ConnectionID connection_id,
+ std::vector<std::string>& secondaryTransports,
+ std::vector<int32_t>& audioServiceTransports,
+ std::vector<int32_t>& videoServiceTransports) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::vector<std::string> secondary_transport_types;
+
+ // First discover what the connection type of the primary transport is
+ // and look up the allowed secondary transports for that primary transport
+ const std::string connection_type =
+ session_observer_.TransportTypeProfileStringFromConnHandle(connection_id);
+ const impl::TransportDescription td =
+ GetTransportTypeFromConnectionType(connection_type);
+ if (settings_.multiple_transports_enabled()) {
+ if (td.transport_type_ == impl::TransportType::TT_USB) {
+ secondary_transport_types = settings_.secondary_transports_for_usb();
+ } else if (td.transport_type_ == impl::TransportType::TT_BLUETOOTH) {
+ secondary_transport_types =
+ settings_.secondary_transports_for_bluetooth();
+ } else if (td.transport_type_ == impl::TransportType::TT_WIFI) {
+ secondary_transport_types = settings_.secondary_transports_for_wifi();
+ } else {
+ LOG4CXX_ERROR(
+ logger_,
+ "Bad or unknown device type in ParseSecondaryTransportConfiguration");
+ return false;
+ }
+ }
+ // note: even if settings_.multiple_transports_enabled() is false, we still
+ // send out an empty "secondaryTransports" parameter, along with
+ // "videoServiceTransports" and "audioServiceTransports" params which are
+ // useful without secondary transport.
+
+ // Then, generate the "secondaryTransports" array for the StartSession ACK
+ GenerateSecondaryTransportsForStartSessionAck(secondary_transport_types,
+ td.ios_transport_,
+ td.android_transport_,
+ secondaryTransports);
+
+ // Next, figure out which connections audio or video services are allowed on
+ GenerateServiceTransportsForStartSessionAck(
+ settings_.multiple_transports_enabled(),
+ settings_.audio_service_transports(),
+ connection_type,
+ td.transport_type_,
+ secondary_transport_types,
+ audioServiceTransports);
+
+ GenerateServiceTransportsForStartSessionAck(
+ settings_.multiple_transports_enabled(),
+ settings_.video_service_transports(),
+ connection_type,
+ td.transport_type_,
+ secondary_transport_types,
+ videoServiceTransports);
+
+ return true;
+}
+
+void ProtocolHandlerImpl::GenerateSecondaryTransportsForStartSessionAck(
+ const std::vector<std::string>& secondary_transport_types,
+ bool device_is_ios,
+ bool device_is_android,
+ std::vector<std::string>& secondaryTransports) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // Parse the "secondary_transport_types" vector (which comes from
+ // smartDeviceLink.ini). For each entry in the vector, add an
+ // appropriate string to the secondaryTransports
+ std::vector<std::string>::const_iterator it =
+ secondary_transport_types.begin();
+ while (it != secondary_transport_types.end()) {
+ const utils::custom_string::CustomString transport_type(*it);
+ if (transport_type.CompareIgnoreCase("USB")) {
+ if (device_is_ios) {
+ LOG4CXX_TRACE(
+ logger_,
+ "Adding IAP_USB to secondaryTransports for StartSessionAck");
+ secondaryTransports.push_back("IAP_USB");
+ }
+ if (device_is_android) {
+ LOG4CXX_TRACE(
+ logger_,
+ "Adding AOA_USB to secondaryTransports for StartSessionAck");
+ secondaryTransports.push_back("AOA_USB");
+ }
+ } else if (transport_type.CompareIgnoreCase("Bluetooth")) {
+ if (device_is_ios) {
+ LOG4CXX_TRACE(
+ logger_,
+ "Adding IAP_BLUETOOTH to secondaryTransports for StartSessionAck");
+ secondaryTransports.push_back("IAP_BLUETOOTH");
+ }
+ if (device_is_android) {
+ LOG4CXX_TRACE(
+ logger_,
+ "Adding SPP_BLUETOOTH to secondaryTransports for StartSessionAck");
+ secondaryTransports.push_back("SPP_BLUETOOTH");
+ }
+ }
+ if (transport_type.CompareIgnoreCase("WiFi")) {
+ LOG4CXX_TRACE(
+ logger_,
+ "Adding TCP_WIFI to secondaryTransports for StartSessionAck");
+ secondaryTransports.push_back("TCP_WIFI");
+ }
+
+ it++;
+ }
+}
+
+void ProtocolHandlerImpl::GenerateServiceTransportsForStartSessionAck(
+ bool secondary_enabled,
+ const std::vector<std::string>& service_transports,
+ const std::string& primary_connection_type,
+ const impl::TransportType primary_transport_type,
+ const std::vector<std::string>& secondary_transport_types,
+ std::vector<int32_t>& serviceTransports) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (service_transports.size() == 0) {
+ if (secondary_enabled && !secondary_transport_types.empty()) {
+ LOG4CXX_TRACE(logger_,
+ "Empty Service Transports. Allowing service to run on both "
+ "connections");
+ serviceTransports.push_back(1);
+ serviceTransports.push_back(2);
+ } else {
+ serviceTransports.push_back(1);
+ }
+ } else {
+ bool fPrimaryAdded = false;
+ bool fSecondaryAdded = false;
+ std::vector<std::string>::const_iterator it = service_transports.begin();
+ for (; it != service_transports.end(); it++) {
+ const utils::custom_string::CustomString transport(*it);
+ LOG4CXX_TRACE(
+ logger_,
+ "Service Allowed to run on " << transport.c_str() << " transport");
+
+ if (!fPrimaryAdded &&
+ (transport.CompareIgnoreCase(primary_connection_type.c_str()) ||
+ (transport.CompareIgnoreCase("IAP_USB") &&
+ primary_transport_type == impl::TransportType::TT_USB))) {
+ LOG4CXX_TRACE(logger_, "Service allowed on primary transport");
+ serviceTransports.push_back(1);
+ fPrimaryAdded = true;
+ }
+
+ if (!fSecondaryAdded) {
+ const utils::custom_string::CustomString transport_type(
+ TransportTypeFromTransport(transport));
+ std::vector<std::string>::const_iterator found =
+ std::find_if(secondary_transport_types.begin(),
+ secondary_transport_types.end(),
+ [&](const std::string& secondary_transport_type) {
+ return transport_type.CompareIgnoreCase(
+ secondary_transport_type.c_str());
+ });
+ if (found != secondary_transport_types.end()) {
+ LOG4CXX_TRACE(logger_, "Service allowed on secondary transport");
+ serviceTransports.push_back(2);
+ fSecondaryAdded = true;
+ }
+ }
+
+ if (fPrimaryAdded && fSecondaryAdded) {
+ break;
+ }
+ }
+ }
+}
+
+const std::string ProtocolHandlerImpl::TransportTypeFromTransport(
+ const utils::custom_string::CustomString& transport) const {
+ std::string transport_type;
+
+ if (transport.CompareIgnoreCase("IAP_BLUETOOTH") ||
+ transport.CompareIgnoreCase("SPP_BLUETOOTH")) {
+ transport_type = "Bluetooth";
+ } else if (transport.CompareIgnoreCase("IAP_USB") ||
+ transport.CompareIgnoreCase("AOA_USB") ||
+ transport.CompareIgnoreCase("IAP_USB_HOST_MODE") ||
+ transport.CompareIgnoreCase("IAP_USB_DEVICE_MODE")) {
+ transport_type = "USB";
+ } else if (transport.CompareIgnoreCase("TCP_WIFI") ||
+ transport.CompareIgnoreCase("IAP_CARPLAY")) {
+ transport_type = "WiFi";
+ }
+
+ return transport_type;
+}
+
} // namespace protocol_handler
diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc
index a490916c99..1f9fc431ae 100644
--- a/src/components/protocol_handler/src/protocol_packet.cc
+++ b/src/components/protocol_handler/src/protocol_packet.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,68 +30,52 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdint.h>
#include <memory.h>
-#include <new>
-#include <memory>
+#include <stdint.h>
+#include <algorithm>
#include <cstring>
#include <limits>
+#include <memory>
+#include <new>
#include "protocol/common.h"
#include "protocol_handler/protocol_packet.h"
-#include "utils/macro.h"
#include "utils/byte_order.h"
+#include "utils/macro.h"
+#include "utils/semantic_version.h"
namespace protocol_handler {
CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
-ProtocolPacket::ProtocolData::ProtocolData() : data(NULL), totalDataBytes(0u) {}
+namespace {
+std::string StringifyFrameType(uint8_t type) {
+ switch (type) {
+ case FRAME_TYPE_SINGLE:
+ return "FRAME_TYPE_SINGLE";
-ProtocolPacket::ProtocolData::~ProtocolData() {
- delete[] data;
-}
+ case FRAME_TYPE_CONSECUTIVE:
+ return "FRAME_TYPE_CONSECUTIVE";
+
+ case FRAME_TYPE_CONTROL:
+ return "FRAME_TYPE_CONTROL";
-ProtocolPacket::ProtocolVersion::ProtocolVersion()
- : majorVersion(0), minorVersion(0), patchVersion(0) {}
-
-ProtocolPacket::ProtocolVersion::ProtocolVersion(uint8_t majorVersion,
- uint8_t minorVersion,
- uint8_t patchVersion)
- : majorVersion(majorVersion)
- , minorVersion(minorVersion)
- , patchVersion(patchVersion) {}
-
-ProtocolPacket::ProtocolVersion::ProtocolVersion(ProtocolVersion& other) {
- this->majorVersion = other.majorVersion;
- this->minorVersion = other.minorVersion;
- this->patchVersion = other.patchVersion;
-}
-
-ProtocolPacket::ProtocolVersion::ProtocolVersion(std::string versionString)
- : majorVersion(0), minorVersion(0), patchVersion(0) {
- unsigned int majorInt, minorInt, patchInt;
- int readElements = sscanf(
- versionString.c_str(), "%u.%u.%u", &majorInt, &minorInt, &patchInt);
- if (readElements != 3) {
- LOG4CXX_WARN(logger_,
- "Error while parsing version string: " << versionString);
- } else {
- majorVersion = static_cast<uint8_t>(majorInt);
- minorVersion = static_cast<uint8_t>(minorInt);
- patchVersion = static_cast<uint8_t>(patchInt);
+ case FRAME_TYPE_FIRST:
+ return "FRAME_TYPE_FIRST";
+
+ default:
+ LOG4CXX_ERROR(logger_, "Unknown frame type:" << static_cast<int>(type));
+ break;
}
+
+ return "";
}
+} // namespace
-std::string ProtocolPacket::ProtocolVersion::to_string() {
- char versionString[256];
- snprintf(versionString,
- 255,
- "%u.%u.%u",
- static_cast<unsigned int>(majorVersion),
- static_cast<unsigned int>(minorVersion),
- static_cast<unsigned int>(patchVersion));
- return std::string(versionString);
+ProtocolPacket::ProtocolData::ProtocolData() : data(NULL), totalDataBytes(0u) {}
+
+ProtocolPacket::ProtocolData::~ProtocolData() {
+ delete[] data;
}
ProtocolPacket::ProtocolHeader::ProtocolHeader()
@@ -159,9 +143,9 @@ void ProtocolPacket::ProtocolHeader::deserialize(const uint8_t* message,
case PROTOCOL_VERSION_4:
case PROTOCOL_VERSION_5: {
if (messageSize < PROTOCOL_HEADER_V2_SIZE) {
- LOG4CXX_DEBUG(logger_,
- "Message size less " << PROTOCOL_HEADER_V2_SIZE
- << " bytes");
+ LOG4CXX_DEBUG(
+ logger_,
+ "Message size less " << PROTOCOL_HEADER_V2_SIZE << " bytes");
return;
}
messageId = read_be_uint32(message + 8);
@@ -273,16 +257,13 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
// expected payload size will be calculated depending
// on used protocol version and service type
size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE;
- // Protocol version shall be from 1 to 4
switch (header.version) {
case PROTOCOL_VERSION_1:
case PROTOCOL_VERSION_2:
break;
case PROTOCOL_VERSION_3:
case PROTOCOL_VERSION_4:
- payload_size = max_payload_size_ > MAXIMUM_FRAME_DATA_V2_SIZE
- ? max_payload_size_
- : MAXIMUM_FRAME_DATA_V2_SIZE;
+ payload_size = std::max(max_payload_size_, MAXIMUM_FRAME_DATA_V2_SIZE);
break;
case PROTOCOL_VERSION_5:
payload_size = max_payload_size_by_service_type(
@@ -293,19 +274,20 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
"Unknown version:" << static_cast<int>(header.version));
return RESULT_FAIL;
}
+
// ServiceType shall be equal 0x0 (Control), 0x07 (RPC), 0x0A (PCM), 0x0B
// (Video), 0x0F (Bulk)
if (ServiceTypeFromByte(header.serviceType) == kInvalidServiceType) {
- LOG4CXX_WARN(logger_,
- "Invalide service type"
- << static_cast<int>(header.serviceType));
+ LOG4CXX_WARN(
+ logger_,
+ "Invalide service type" << static_cast<int>(header.serviceType));
return RESULT_FAIL;
}
// Check frame info for each frame type
// Frame type shall be 0x00 (Control), 0x01 (Single), 0x02 (First), 0x03
// (Consecutive)
- // For Control frames Frame info value shall be from 0x00 to 0x06 or 0xFE(Data
- // Ack), 0xFF(HB Ack)
+ // For Control frames Frame info value shall be from 0x00 to 0x09 or
+ // 0xFD(Transport Event Update), 0xFE(Data Ack), 0xFF(HB Ack)
// For Single and First frames Frame info value shall be equal 0x00
switch (header.frameType) {
case FRAME_TYPE_CONTROL: {
@@ -317,6 +299,10 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
case FRAME_DATA_END_SERVICE:
case FRAME_DATA_END_SERVICE_ACK:
case FRAME_DATA_END_SERVICE_NACK:
+ case FRAME_DATA_REGISTER_SECONDARY_TRANSPORT:
+ case FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_ACK:
+ case FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_NACK:
+ case FRAME_DATA_TRANSPORT_EVENT_UPDATE:
case FRAME_DATA_SERVICE_DATA_ACK:
case FRAME_DATA_HEART_BEAT_ACK:
break;
@@ -356,26 +342,40 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
// For Control frames Data Size value shall be less than MTU header
// For Single and Consecutive Data Size value shall be greater than 0x00
// and shall be less than payload size
- if (header.dataSize > payload_size) {
- LOG4CXX_WARN(logger_,
- "Packet data size is "
- << header.dataSize
- << " and bigger than allowed payload size " << payload_size
- << " bytes");
- return RESULT_FAIL;
- }
+ // For First Frame Data Size shall be equal 0x08 (payload of this packet will
+ // be 8 bytes).
+
switch (header.frameType) {
case FRAME_TYPE_SINGLE:
case FRAME_TYPE_CONSECUTIVE:
- if (header.dataSize <= 0u) {
+ case FRAME_TYPE_CONTROL: {
+ if (header.dataSize > payload_size ||
+ (FRAME_TYPE_CONTROL != header.frameType && header.dataSize == 0u)) {
+ UNUSED(StringifyFrameType);
+ LOG4CXX_WARN(
+ logger_,
+ "Packet data size of "
+ << StringifyFrameType(header.frameType)
+ << " frame must be in range (0, payload_size=" << payload_size
+ << "], but actual value is " << header.dataSize);
+ return RESULT_FAIL;
+ }
+ } break;
+
+ case FRAME_TYPE_FIRST:
+ if (FIRST_FRAME_DATA_SIZE != header.dataSize) {
LOG4CXX_WARN(logger_,
- "Data size of Single and Consecutive frame shall be not "
- "equal 0 byte ");
+ "Packet data size of FRAME_TYPE_FIRST frame must equal "
+ << static_cast<int>(FIRST_FRAME_DATA_SIZE)
+ << ", but actual value is " << header.dataSize);
return RESULT_FAIL;
}
break;
+
default:
- break;
+ LOG4CXX_WARN(logger_,
+ "Unknown frame type " << static_cast<int>(header.frameType));
+ return RESULT_FAIL;
}
// Message ID be equal or greater than 0x01 (not actual for 1 protocol version
// and Control frames)
@@ -383,7 +383,6 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
if (FRAME_TYPE_CONTROL != header.frameType &&
PROTOCOL_VERSION_1 != header.version) {
LOG4CXX_WARN(logger_, "Message ID shall be greater than 0x00");
- // Message ID shall be greater than 0x00, but not implemented in SPT
return RESULT_FAIL;
}
}
@@ -470,6 +469,7 @@ RawMessagePtr ProtocolPacket::serializePacket() const {
packet_header_.version,
packet,
total_packet_size,
+ false,
packet_header_.serviceType));
delete[] packet;
@@ -642,6 +642,10 @@ ConnectionID ProtocolPacket::connection_id() const {
return connection_id_;
}
+void ProtocolPacket::set_connection_id(ConnectionID connection_id) {
+ connection_id_ = connection_id;
+}
+
uint32_t ProtocolPacket::payload_size() const {
return payload_size_;
}
diff --git a/src/components/protocol_handler/src/protocol_payload.cc b/src/components/protocol_handler/src/protocol_payload.cc
index aa011bdf0f..8916fe91b0 100644
--- a/src/components/protocol_handler/src/protocol_payload.cc
+++ b/src/components/protocol_handler/src/protocol_payload.cc
@@ -44,7 +44,7 @@ static const size_t kCorrelationIdBits = 32;
static const size_t kJsonSizeBits = 32;
static const size_t PayloadHeaderBits =
kRpcTypeBits + kRpcFunctionIdBits + kCorrelationIdBits + kJsonSizeBits;
-}
+} // namespace
namespace protocol_handler {
diff --git a/src/components/protocol_handler/src/service_status_update_handler.cc b/src/components/protocol_handler/src/service_status_update_handler.cc
new file mode 100644
index 0000000000..7b2c67ea23
--- /dev/null
+++ b/src/components/protocol_handler/src/service_status_update_handler.cc
@@ -0,0 +1,117 @@
+#include "protocol_handler/service_status_update_handler.h"
+#include "interfaces/HMI_API.h"
+
+namespace protocol_handler {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "ServiceStatusUpdateHandler")
+
+hmi_apis::Common_ServiceType::eType GetHMIServiceType(
+ protocol_handler::ServiceType service_type) {
+ using namespace hmi_apis;
+ using namespace protocol_handler;
+ switch (service_type) {
+ case SERVICE_TYPE_RPC: {
+ return Common_ServiceType::RPC;
+ }
+ case SERVICE_TYPE_AUDIO: {
+ return Common_ServiceType::AUDIO;
+ }
+ case SERVICE_TYPE_NAVI: {
+ return Common_ServiceType::VIDEO;
+ }
+ default: { return Common_ServiceType::INVALID_ENUM; }
+ }
+}
+
+void ServiceStatusUpdateHandler::OnServiceUpdate(
+ const uint32_t connection_key,
+ const protocol_handler::ServiceType service_type,
+ ServiceStatus service_status) {
+ using namespace hmi_apis;
+ typedef utils::Optional<Common_ServiceStatusUpdateReason::eType>
+ UpdateReasonOptional;
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto hmi_service_type = GetHMIServiceType(service_type);
+
+ switch (service_status) {
+ case ServiceStatus::SERVICE_RECEIVED: {
+ return listener_->ProcessServiceStatusUpdate(
+ connection_key,
+ hmi_service_type,
+ Common_ServiceEvent::REQUEST_RECEIVED,
+ UpdateReasonOptional(UpdateReasonOptional::EMPTY));
+ }
+ case ServiceStatus::SERVICE_ACCEPTED: {
+ return listener_->ProcessServiceStatusUpdate(
+ connection_key,
+ hmi_service_type,
+ Common_ServiceEvent::REQUEST_ACCEPTED,
+ UpdateReasonOptional(UpdateReasonOptional::EMPTY));
+ }
+ case ServiceStatus::SERVICE_START_FAILED: {
+ return listener_->ProcessServiceStatusUpdate(
+ connection_key,
+ hmi_service_type,
+ Common_ServiceEvent::REQUEST_REJECTED,
+ UpdateReasonOptional(UpdateReasonOptional::EMPTY));
+ }
+ case ServiceStatus::PTU_FAILED: {
+ auto update_reason = Common_ServiceStatusUpdateReason::PTU_FAILED;
+ return listener_->ProcessServiceStatusUpdate(
+ connection_key,
+ hmi_service_type,
+ Common_ServiceEvent::REQUEST_REJECTED,
+ update_reason);
+ }
+ case ServiceStatus::CERT_INVALID: {
+ auto update_reason = Common_ServiceStatusUpdateReason::INVALID_CERT;
+ return listener_->ProcessServiceStatusUpdate(
+ connection_key,
+ hmi_service_type,
+ Common_ServiceEvent::REQUEST_REJECTED,
+ update_reason);
+ }
+ case ServiceStatus::INVALID_TIME: {
+ auto update_reason = Common_ServiceStatusUpdateReason::INVALID_TIME;
+ return listener_->ProcessServiceStatusUpdate(
+ connection_key,
+ hmi_service_type,
+ Common_ServiceEvent::REQUEST_REJECTED,
+ update_reason);
+ }
+ case ServiceStatus::PROTECTION_ENFORCED: {
+ auto update_reason =
+ Common_ServiceStatusUpdateReason::PROTECTION_ENFORCED;
+ return listener_->ProcessServiceStatusUpdate(
+ connection_key,
+ hmi_service_type,
+ Common_ServiceEvent::REQUEST_REJECTED,
+ update_reason);
+ }
+ case ServiceStatus::PROTECTION_DISABLED: {
+ auto update_reason =
+ Common_ServiceStatusUpdateReason::PROTECTION_DISABLED;
+ return listener_->ProcessServiceStatusUpdate(
+ connection_key,
+ hmi_service_type,
+ Common_ServiceEvent::REQUEST_ACCEPTED,
+ update_reason);
+ }
+ case ServiceStatus::UNSECURE_START_FAILED: {
+ auto update_reason =
+ Common_ServiceStatusUpdateReason::PROTECTION_DISABLED;
+ return listener_->ProcessServiceStatusUpdate(
+ connection_key,
+ hmi_service_type,
+ Common_ServiceEvent::REQUEST_REJECTED,
+ update_reason);
+ }
+ default: {
+ LOG4CXX_WARN(logger_,
+ "Received unknown ServiceStatus: "
+ << static_cast<int32_t>(service_status));
+ return;
+ }
+ }
+}
+} // namespace protocol_handler
diff --git a/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h b/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h
index 8f68003ada..a099cff225 100644
--- a/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h
+++ b/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h
@@ -32,10 +32,10 @@
#ifndef SRC_COMPONENTS_PROTOCOL_HANDLER_TEST_INCLUDE_PROTOCOL_HANDLER_CONTROL_MESSAGE_MATCHER_H_
#define SRC_COMPONENTS_PROTOCOL_HANDLER_TEST_INCLUDE_PROTOCOL_HANDLER_CONTROL_MESSAGE_MATCHER_H_
-#include "gmock/gmock.h"
#include <ios>
#include <string>
#include <vector>
+#include "gmock/gmock.h"
#include "protocol/raw_message.h"
#include "protocol_handler/protocol_packet.h"
@@ -43,11 +43,11 @@ namespace test {
namespace components {
namespace protocol_handler_test {
+using protocol_handler::FRAME_DATA_START_SERVICE_NACK;
+using protocol_handler::FRAME_TYPE_CONTROL;
using protocol_handler::ProtocolPacket;
using protocol_handler::RawMessagePtr;
using protocol_handler::RESULT_CODE;
-using protocol_handler::FRAME_TYPE_CONTROL;
-using protocol_handler::FRAME_DATA_START_SERVICE_NACK;
bool CheckRegularMatches(const ProtocolPacket& packet,
RESULT_CODE result,
diff --git a/src/components/protocol_handler/test/include/protocol_handler/mock_service_status_update_handler_listener.h b/src/components/protocol_handler/test/include/protocol_handler/mock_service_status_update_handler_listener.h
new file mode 100644
index 0000000000..ccbfeb8438
--- /dev/null
+++ b/src/components/protocol_handler/test/include/protocol_handler/mock_service_status_update_handler_listener.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_PROTOCOL_HANDLER_TEST_INCLUDE_MOCK_SERVICE_STATUS_UPDATE_HANDLER_LISTENER_H
+#define SRC_COMPONENTS_PROTOCOL_HANDLER_TEST_INCLUDE_MOCK_SERVICE_STATUS_UPDATE_HANDLER_LISTENER_H
+
+#include "gmock/gmock.h"
+#include "protocol_handler/service_status_update_handler_listener.h"
+
+namespace test {
+namespace components {
+namespace protocol_handler_test {
+
+class MockServiceStatusUpdateHandlerListener
+ : public protocol_handler::ServiceStatusUpdateHandlerListener {
+ public:
+ MOCK_METHOD4(
+ ProcessServiceStatusUpdate,
+ void(const uint32_t,
+ hmi_apis::Common_ServiceType::eType,
+ hmi_apis::Common_ServiceEvent::eType,
+ utils::Optional<hmi_apis::Common_ServiceStatusUpdateReason::eType>));
+};
+} // namespace protocol_handler_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_PROTOCOL_HANDLER_TEST_INCLUDE_MOCK_SERVICE_STATUS_UPDATE_HANDLER_LISTENER_H
diff --git a/src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h b/src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h
index a1c1f188d1..9a91a5d1f7 100644
--- a/src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h
+++ b/src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h
@@ -43,8 +43,9 @@ namespace protocol_handler_test {
class MockPHTelemetryObserver : public ::protocol_handler::PHTelemetryObserver {
public:
- MOCK_METHOD2(StartMessageProcess, void(uint32_t, const TimevalStruct&));
- MOCK_METHOD2(EndMessageProcess, void(utils::SharedPtr<MessageMetric>));
+ MOCK_METHOD2(StartMessageProcess,
+ void(uint32_t, const date_time::TimeDuration&));
+ MOCK_METHOD2(EndMessageProcess, void(std::shared_ptr<MessageMetric>));
};
} // namespace protocol_handler_test
diff --git a/src/components/protocol_handler/test/incoming_data_handler_test.cc b/src/components/protocol_handler/test/incoming_data_handler_test.cc
index d0a311583c..a187fe6cb5 100644
--- a/src/components/protocol_handler/test/incoming_data_handler_test.cc
+++ b/src/components/protocol_handler/test/incoming_data_handler_test.cc
@@ -30,11 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <gtest/gtest.h>
-#include <vector>
#include <list>
+#include <vector>
-#include "utils/macro.h"
#include "protocol_handler/incoming_data_handler.h"
+#include "utils/macro.h"
namespace test {
namespace components {
@@ -68,13 +68,15 @@ class IncomingDataHandlerTest : public ::testing::Test {
void ProcessData(transport_manager::ConnectionUID uid,
const uint8_t* const data,
const uint32_t data_size) {
- actual_frames = data_handler.ProcessData(
- RawMessage(uid, 0, data, data_size), &result_code, &malformed_occurs);
+ actual_frames =
+ data_handler.ProcessData(RawMessage(uid, 0, data, data_size, false),
+ &result_code,
+ &malformed_occurs);
}
void AppendPacketToTMData(const ProtocolPacket& packet) {
const RawMessagePtr msg = packet.serializePacket();
- EXPECT_TRUE(msg.valid());
+ EXPECT_TRUE(msg.use_count() != 0);
EXPECT_GT(msg->data_size(), 0u);
tm_data.insert(tm_data.end(), msg->data(), msg->data() + msg->data_size());
}
@@ -91,7 +93,7 @@ class IncomingDataHandlerTest : public ::testing::Test {
FrameList actual_frames;
RESULT_CODE result_code;
size_t malformed_occurs;
- uint8_t* some_data, *some_data2;
+ uint8_t *some_data, *some_data2;
size_t some_data_size, some_data2_size;
uint32_t protov1_message_id;
uint32_t some_message_id;
@@ -117,15 +119,17 @@ TEST_F(IncomingDataHandlerTest, NullData) {
TEST_F(IncomingDataHandlerTest, DataForUnknownConnection) {
size_t malformed_count = 0;
- actual_frames = data_handler.ProcessData(
- RawMessage(uid_unknown, 0, NULL, 0), &result_code, &malformed_count);
+ actual_frames =
+ data_handler.ProcessData(RawMessage(uid_unknown, 0, NULL, 0, false),
+ &result_code,
+ &malformed_count);
EXPECT_EQ(RESULT_FAIL, result_code);
EXPECT_EQ(malformed_count, 0u);
EXPECT_TRUE(actual_frames.empty());
AppendPacketToTMData(ProtocolPacket());
actual_frames = data_handler.ProcessData(
- RawMessage(uid_unknown, 0, tm_data.data(), tm_data.size()),
+ RawMessage(uid_unknown, 0, tm_data.data(), tm_data.size(), false),
&result_code,
&malformed_count);
EXPECT_EQ(RESULT_FAIL, result_code);
@@ -192,49 +196,51 @@ TEST_F(IncomingDataHandlerTest, Heartbeat_pack) {
TEST_F(IncomingDataHandlerTest, MixedPayloadData_TwoConnections) {
FrameList mobile_packets;
// single packet RPC
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_1,
- PROTECTION_OFF,
- FRAME_TYPE_SINGLE,
- kRpc,
- FRAME_DATA_SINGLE,
- some_session_id,
- some_data_size,
- protov1_message_id,
- some_data));
+ mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_1,
+ PROTECTION_OFF,
+ FRAME_TYPE_SINGLE,
+ kRpc,
+ FRAME_DATA_SINGLE,
+ some_session_id,
+ some_data_size,
+ protov1_message_id,
+ some_data));
// consecutive packet Audio
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_2,
- PROTECTION_ON,
- FRAME_TYPE_CONSECUTIVE,
- kAudio,
- FRAME_DATA_LAST_CONSECUTIVE,
- ++some_session_id,
- some_data2_size,
- some_message_id,
- some_data2));
+ mobile_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_2,
+ PROTECTION_ON,
+ FRAME_TYPE_CONSECUTIVE,
+ kAudio,
+ FRAME_DATA_LAST_CONSECUTIVE,
+ ++some_session_id,
+ some_data2_size,
+ some_message_id,
+ some_data2));
// single packet Nav
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_3,
- PROTECTION_ON,
- FRAME_TYPE_SINGLE,
- kMobileNav,
- FRAME_DATA_SINGLE,
- ++some_session_id,
- some_data_size,
- ++some_message_id,
- some_data));
+ mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_3,
+ PROTECTION_ON,
+ FRAME_TYPE_SINGLE,
+ kMobileNav,
+ FRAME_DATA_SINGLE,
+ ++some_session_id,
+ some_data_size,
+ ++some_message_id,
+ some_data));
// consecutive packet Bulk
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_3,
- PROTECTION_ON,
- FRAME_TYPE_CONSECUTIVE,
- kBulk,
- FRAME_DATA_LAST_CONSECUTIVE,
- ++some_session_id,
- some_data2_size,
- ++some_message_id,
- some_data2));
+ mobile_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_3,
+ PROTECTION_ON,
+ FRAME_TYPE_CONSECUTIVE,
+ kBulk,
+ FRAME_DATA_LAST_CONSECUTIVE,
+ ++some_session_id,
+ some_data2_size,
+ ++some_message_id,
+ some_data2));
for (FrameList::iterator it = mobile_packets.begin();
it != mobile_packets.end();
++it) {
@@ -249,8 +255,8 @@ TEST_F(IncomingDataHandlerTest, MixedPayloadData_TwoConnections) {
it != actual_frames.end();
++it, ++it_exp) {
// TODO(EZamakhov): investigate valgrind warning (unitialized value)
- EXPECT_EQ(**it, **it_exp) << "Element number "
- << std::distance(mobile_packets.begin(), it_exp);
+ EXPECT_EQ(**it, **it_exp)
+ << "Element number " << std::distance(mobile_packets.begin(), it_exp);
}
}
@@ -268,16 +274,17 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_Version) {
malformed_versions.push_back(version);
}
for (size_t i = 0; i < malformed_versions.size(); ++i) {
- malformed_packets.push_back(new ProtocolPacket(uid1,
- malformed_versions[i],
- PROTECTION_OFF,
- FRAME_TYPE_CONTROL,
- kControl,
- FRAME_DATA_HEART_BEAT,
- some_session_id,
- 0u,
- some_message_id,
- NULL));
+ malformed_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ malformed_versions[i],
+ PROTECTION_OFF,
+ FRAME_TYPE_CONTROL,
+ kControl,
+ FRAME_DATA_HEART_BEAT,
+ some_session_id,
+ 0u,
+ some_message_id,
+ nullptr));
}
// We count malformed only first time when it occurs after correct message
@@ -316,16 +323,17 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_ServiceType) {
malformed_serv_types.push_back(0x0D);
malformed_serv_types.push_back(0x0E);
for (size_t i = 0; i < malformed_serv_types.size(); ++i) {
- malformed_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_3,
- PROTECTION_OFF,
- FRAME_TYPE_CONTROL,
- malformed_serv_types[i],
- FRAME_DATA_HEART_BEAT,
- some_session_id,
- 0u,
- some_message_id,
- NULL));
+ malformed_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_3,
+ PROTECTION_OFF,
+ FRAME_TYPE_CONTROL,
+ malformed_serv_types[i],
+ FRAME_DATA_HEART_BEAT,
+ some_session_id,
+ 0u,
+ some_message_id,
+ nullptr));
}
// We count malformed only first time when it occurs after correct message
@@ -360,16 +368,17 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_FrameType) {
malformed_frame_types.push_back(frame_type);
}
for (size_t i = 0; i < malformed_frame_types.size(); ++i) {
- malformed_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_3,
- PROTECTION_OFF,
- malformed_frame_types[i],
- kControl,
- FRAME_DATA_HEART_BEAT,
- some_session_id,
- 0u,
- some_message_id,
- NULL));
+ malformed_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_3,
+ PROTECTION_OFF,
+ malformed_frame_types[i],
+ kControl,
+ FRAME_DATA_HEART_BEAT,
+ some_session_id,
+ 0u,
+ some_message_id,
+ nullptr));
}
// We count malformed only first time when it occurs after correct message
@@ -393,27 +402,28 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_FrameType) {
}
}
-// For Control frames Frame info value shall be from 0x00 to 0x06 or 0xFE(Data
-// Ack), 0xFF(HB Ack)
+// For Control frames Frame info value shall be from 0x00 to 0x09 or 0xFD
+// (Transport Update Event), 0xFE(Data Ack), 0xFF(HB Ack)
TEST_F(IncomingDataHandlerTest, MalformedPacket_ControlFrame) {
FrameList malformed_packets;
std::vector<uint8_t> malformed_frame_data;
- for (uint8_t frame_type = FRAME_DATA_END_SERVICE_NACK + 1;
- frame_type < FRAME_DATA_SERVICE_DATA_ACK;
+ for (uint8_t frame_type = FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_NACK + 1;
+ frame_type < FRAME_DATA_TRANSPORT_EVENT_UPDATE;
++frame_type) {
malformed_frame_data.push_back(frame_type);
}
for (size_t i = 0; i < malformed_frame_data.size(); ++i) {
- malformed_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_3,
- PROTECTION_OFF,
- FRAME_TYPE_CONTROL,
- kControl,
- malformed_frame_data[i],
- some_session_id,
- 0u,
- some_message_id,
- NULL));
+ malformed_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_3,
+ PROTECTION_OFF,
+ FRAME_TYPE_CONTROL,
+ kControl,
+ malformed_frame_data[i],
+ some_session_id,
+ 0u,
+ some_message_id,
+ nullptr));
}
// We count malformed only first time when it occurs after correct message
@@ -448,16 +458,17 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_SingleFrame) {
}
malformed_frame_data.push_back(FRAME_DATA_MAX_VALUE);
for (size_t i = 0; i < malformed_frame_data.size(); ++i) {
- malformed_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_3,
- PROTECTION_OFF,
- FRAME_TYPE_SINGLE,
- kControl,
- malformed_frame_data[i],
- some_session_id,
- 0u,
- some_message_id,
- NULL));
+ malformed_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_3,
+ PROTECTION_OFF,
+ FRAME_TYPE_SINGLE,
+ kControl,
+ malformed_frame_data[i],
+ some_session_id,
+ 0u,
+ some_message_id,
+ nullptr));
}
// We count malformed only first time when it occurs after correct message
@@ -492,16 +503,17 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_FirstFrame) {
}
malformed_frame_data.push_back(FRAME_DATA_MAX_VALUE);
for (size_t i = 0; i < malformed_frame_data.size(); ++i) {
- malformed_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_3,
- PROTECTION_OFF,
- FRAME_TYPE_SINGLE,
- kControl,
- malformed_frame_data[i],
- some_session_id,
- 0u,
- some_message_id,
- NULL));
+ malformed_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_3,
+ PROTECTION_OFF,
+ FRAME_TYPE_SINGLE,
+ kControl,
+ malformed_frame_data[i],
+ some_session_id,
+ 0u,
+ some_message_id,
+ nullptr));
}
// We count malformed only first time when it occurs after correct message
@@ -529,106 +541,110 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_FirstFrame) {
TEST_F(IncomingDataHandlerTest, MalformedPacket_AdditionalByte) {
FrameList mobile_packets;
// single packet RPC
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_1,
- PROTECTION_OFF,
- FRAME_TYPE_SINGLE,
- kRpc,
- FRAME_DATA_SINGLE,
- some_session_id,
- some_data_size,
- protov1_message_id,
- some_data));
+ mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_1,
+ PROTECTION_OFF,
+ FRAME_TYPE_SINGLE,
+ kRpc,
+ FRAME_DATA_SINGLE,
+ some_session_id,
+ some_data_size,
+ protov1_message_id,
+ some_data));
AppendPacketToTMData(*mobile_packets.back());
// Add malformed byte
tm_data.insert(tm_data.end(), 1, 0x1);
// consecutive packet Audio
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_2,
- PROTECTION_ON,
- FRAME_TYPE_CONSECUTIVE,
- kAudio,
- FRAME_DATA_LAST_CONSECUTIVE,
- ++some_session_id,
- some_data2_size,
- some_message_id,
- some_data2));
+ mobile_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_2,
+ PROTECTION_ON,
+ FRAME_TYPE_CONSECUTIVE,
+ kAudio,
+ FRAME_DATA_LAST_CONSECUTIVE,
+ ++some_session_id,
+ some_data2_size,
+ some_message_id,
+ some_data2));
AppendPacketToTMData(*mobile_packets.back());
// Add malformed bytes
tm_data.insert(tm_data.end(), 2, 0x2);
// single packet Nav
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_3,
- PROTECTION_ON,
- FRAME_TYPE_SINGLE,
- kMobileNav,
- FRAME_DATA_SINGLE,
- ++some_session_id,
- some_data_size,
- ++some_message_id,
- some_data));
+ mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_3,
+ PROTECTION_ON,
+ FRAME_TYPE_SINGLE,
+ kMobileNav,
+ FRAME_DATA_SINGLE,
+ ++some_session_id,
+ some_data_size,
+ ++some_message_id,
+ some_data));
AppendPacketToTMData(*mobile_packets.back());
// Add malformed bytes
tm_data.insert(tm_data.end(), 3, 0x3);
// consecutive packet Bulk
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_3,
- PROTECTION_ON,
- FRAME_TYPE_CONSECUTIVE,
- kBulk,
- FRAME_DATA_LAST_CONSECUTIVE,
- ++some_session_id,
- some_data2_size,
- ++some_message_id,
- some_data2));
+ mobile_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_3,
+ PROTECTION_ON,
+ FRAME_TYPE_CONSECUTIVE,
+ kBulk,
+ FRAME_DATA_LAST_CONSECUTIVE,
+ ++some_session_id,
+ some_data2_size,
+ ++some_message_id,
+ some_data2));
AppendPacketToTMData(*mobile_packets.back());
// Add malformed bytes
tm_data.insert(tm_data.end(), 4, 0x4);
// single packet RPC
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_1,
- PROTECTION_OFF,
- FRAME_TYPE_CONTROL,
- kRpc,
- FRAME_DATA_HEART_BEAT,
- some_session_id,
- some_data_size,
- protov1_message_id,
- some_data));
+ mobile_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_1,
+ PROTECTION_OFF,
+ FRAME_TYPE_CONTROL,
+ kRpc,
+ FRAME_DATA_HEART_BEAT,
+ some_session_id,
+ some_data_size,
+ protov1_message_id,
+ some_data));
AppendPacketToTMData(*mobile_packets.back());
// Add malformed bytes
tm_data.insert(tm_data.end(), 5, 0x5);
// single packet Audio
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_1,
- PROTECTION_OFF,
- FRAME_TYPE_CONTROL,
- kAudio,
- FRAME_DATA_HEART_BEAT,
- some_session_id,
- some_data_size,
- protov1_message_id,
- some_data));
+ mobile_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_1,
+ PROTECTION_OFF,
+ FRAME_TYPE_CONTROL,
+ kAudio,
+ FRAME_DATA_HEART_BEAT,
+ some_session_id,
+ some_data_size,
+ protov1_message_id,
+ some_data));
AppendPacketToTMData(*mobile_packets.back());
// Add malformed bytes
tm_data.insert(tm_data.end(), 6, 0x6);
// single packet RPC
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_1,
- PROTECTION_OFF,
- FRAME_TYPE_SINGLE,
- kRpc,
- FRAME_DATA_SINGLE,
- some_session_id,
- some_data_size,
- protov1_message_id,
- some_data));
+ mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_1,
+ PROTECTION_OFF,
+ FRAME_TYPE_SINGLE,
+ kRpc,
+ FRAME_DATA_SINGLE,
+ some_session_id,
+ some_data_size,
+ protov1_message_id,
+ some_data));
AppendPacketToTMData(*mobile_packets.back());
ProcessData(uid1, &tm_data[0], tm_data.size());
@@ -642,8 +658,8 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_AdditionalByte) {
it != actual_frames.end();
++it, ++it_exp) {
// TODO(EZamakhov): investigate valgrind warning (unitialized value)
- EXPECT_EQ(**it, **it_exp) << "Element number "
- << std::distance(mobile_packets.begin(), it_exp);
+ EXPECT_EQ(**it, **it_exp)
+ << "Element number " << std::distance(mobile_packets.begin(), it_exp);
}
}
@@ -651,29 +667,30 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_AdditionalByte) {
TEST_F(IncomingDataHandlerTest, MalformedPacket_Mix) {
FrameList mobile_packets;
// single packet RPC
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_1,
- PROTECTION_OFF,
- FRAME_TYPE_SINGLE,
- kRpc,
- FRAME_DATA_SINGLE,
- some_session_id,
- some_data_size,
- protov1_message_id,
- some_data));
+ mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_1,
+ PROTECTION_OFF,
+ FRAME_TYPE_SINGLE,
+ kRpc,
+ FRAME_DATA_SINGLE,
+ some_session_id,
+ some_data_size,
+ protov1_message_id,
+ some_data));
AppendPacketToTMData(*mobile_packets.back());
// consecutive packet Audio
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_2,
- PROTECTION_ON,
- FRAME_TYPE_CONSECUTIVE,
- kAudio,
- FRAME_DATA_LAST_CONSECUTIVE,
- ++some_session_id,
- some_data2_size,
- some_message_id,
- some_data2));
+ mobile_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_2,
+ PROTECTION_ON,
+ FRAME_TYPE_CONSECUTIVE,
+ kAudio,
+ FRAME_DATA_LAST_CONSECUTIVE,
+ ++some_session_id,
+ some_data2_size,
+ some_message_id,
+ some_data2));
AppendPacketToTMData(*mobile_packets.back());
// Malformed packet 1
@@ -691,16 +708,17 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_Mix) {
AppendPacketToTMData(malformed_packet1);
// consecutive packet Bulk
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_3,
- PROTECTION_ON,
- FRAME_TYPE_CONSECUTIVE,
- kBulk,
- FRAME_DATA_LAST_CONSECUTIVE,
- ++some_session_id,
- some_data2_size,
- ++some_message_id,
- some_data2));
+ mobile_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_3,
+ PROTECTION_ON,
+ FRAME_TYPE_CONSECUTIVE,
+ kBulk,
+ FRAME_DATA_LAST_CONSECUTIVE,
+ ++some_session_id,
+ some_data2_size,
+ ++some_message_id,
+ some_data2));
AppendPacketToTMData(*mobile_packets.back());
// Malformed packet 2
@@ -718,16 +736,17 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_Mix) {
AppendPacketToTMData(malformed_packet2);
// Audio packet
- mobile_packets.push_back(new ProtocolPacket(uid1,
- PROTOCOL_VERSION_3,
- PROTECTION_OFF,
- FRAME_TYPE_CONTROL,
- kAudio,
- FRAME_DATA_HEART_BEAT,
- some_session_id,
- some_data_size,
- protov1_message_id,
- some_data));
+ mobile_packets.push_back(
+ std::make_shared<ProtocolPacket>(uid1,
+ PROTOCOL_VERSION_3,
+ PROTECTION_OFF,
+ FRAME_TYPE_CONTROL,
+ kAudio,
+ FRAME_DATA_HEART_BEAT,
+ some_session_id,
+ some_data_size,
+ protov1_message_id,
+ some_data));
AppendPacketToTMData(*mobile_packets.back());
ProcessData(uid1, &tm_data[0], tm_data.size());
@@ -739,8 +758,8 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_Mix) {
it != actual_frames.end();
++it, ++it_exp) {
// TODO(EZamakhov): investigate valgrind warning (unitialized value)
- EXPECT_EQ(**it, **it_exp) << "Element number "
- << std::distance(mobile_packets.begin(), it_exp);
+ EXPECT_EQ(**it, **it_exp)
+ << "Element number " << std::distance(mobile_packets.begin(), it_exp);
}
}
diff --git a/src/components/protocol_handler/test/multiframe_builder_test.cc b/src/components/protocol_handler/test/multiframe_builder_test.cc
index ad8a39f79a..2859aeb8ae 100644
--- a/src/components/protocol_handler/test/multiframe_builder_test.cc
+++ b/src/components/protocol_handler/test/multiframe_builder_test.cc
@@ -29,13 +29,13 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include <vector>
-#include <map>
#include <algorithm>
-#include <utility>
#include <limits>
-#include "utils/make_shared.h"
+#include <map>
+#include <utility>
+#include <vector>
+#include "gtest/gtest.h"
+
#include "protocol_handler/multiframe_builder.h"
namespace test {
@@ -149,7 +149,7 @@ class MultiFrameBuilderTest : public ::testing::Test {
const ProtocolFramePtrList::const_iterator it_last = --(multiframes.end());
while (it != it_last) {
const ProtocolFramePtr frame = *it;
- ASSERT_TRUE(frame);
+ ASSERT_TRUE((bool)frame);
EXPECT_EQ(RESULT_OK, multiframe_builder_.AddFrame(frame))
<< "Non final CONSECUTIVE frame: " << frame;
EXPECT_EQ(ProtocolFramePtrList(), multiframe_builder_.PopMultiframes())
@@ -331,7 +331,7 @@ TEST_F(MultiFrameBuilderTest, Add_FirstFrames_NoConnections) {
const ProtocolFramePtrList& multiframes = multiframe_data.multiframes;
ASSERT_FALSE(multiframes.empty());
const ProtocolFramePtr first_frame = multiframes.front();
- ASSERT_TRUE(first_frame);
+ ASSERT_TRUE((bool)first_frame);
EXPECT_EQ(RESULT_FAIL, multiframe_builder_.AddFrame(first_frame))
<< "Non-existed connection " << connection_id
<< "- to be skipped first frame: " << first_frame;
@@ -365,7 +365,7 @@ TEST_F(MultiFrameBuilderTest, Add_FirstFrames_only) {
const ProtocolFramePtrList& multiframes = multiframe_data.multiframes;
ASSERT_FALSE(multiframes.empty());
const ProtocolFramePtr first_frame = multiframes.front();
- ASSERT_TRUE(first_frame);
+ ASSERT_TRUE((bool)first_frame);
EXPECT_EQ(RESULT_OK, multiframe_builder_.AddFrame(first_frame))
<< "First frame: " << first_frame;
@@ -440,7 +440,7 @@ TEST_F(MultiFrameBuilderTest, Add_ConsecutiveFrames_per1) {
ASSERT_FALSE(multiframes.empty());
const ProtocolFramePtr frame = multiframes.front();
- ASSERT_TRUE(frame);
+ ASSERT_TRUE((bool)frame);
EXPECT_EQ(RESULT_OK, multiframe_builder_.AddFrame(frame))
<< "Frame: " << frame;
@@ -501,7 +501,7 @@ TEST_F(MultiFrameBuilderTest, FrameExpired_OneMSec) {
const ProtocolFramePtrList& multiframes = multiframe_data.multiframes;
ASSERT_FALSE(multiframes.empty());
const ProtocolFramePtr first_frame = multiframes.front();
- ASSERT_TRUE(first_frame);
+ ASSERT_TRUE((bool)first_frame);
EXPECT_EQ(RESULT_OK, multiframe_builder_.AddFrame(first_frame))
<< "First frame: " << first_frame;
diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
index 0cb8e155d0..07b562f3a2 100644
--- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc
+++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
@@ -29,27 +29,39 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include <string>
-#include "protocol_handler/protocol_handler.h"
-#include "protocol_handler/protocol_handler_impl.h"
+#include "connection_handler/connection_handler_impl.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "gtest/gtest.h"
#include "protocol/bson_object_keys.h"
#include "protocol/common.h"
#include "protocol_handler/control_message_matcher.h"
#include "protocol_handler/mock_protocol_handler.h"
-#include "protocol_handler/mock_protocol_observer.h"
#include "protocol_handler/mock_protocol_handler_settings.h"
+#include "protocol_handler/mock_protocol_observer.h"
+#include "protocol_handler/mock_service_status_update_handler_listener.h"
#include "protocol_handler/mock_session_observer.h"
-#include "connection_handler/mock_connection_handler.h"
+#include "protocol_handler/protocol_handler.h"
+#include "protocol_handler/protocol_handler_impl.h"
#ifdef ENABLE_SECURITY
#include "security_manager/mock_security_manager.h"
#include "security_manager/mock_ssl_context.h"
#endif // ENABLE_SECURITY
#include "transport_manager/mock_transport_manager.h"
#include "utils/mock_system_time_handler.h"
-#include "utils/make_shared.h"
-#include "utils/test_async_waiter.h"
+#include "utils/semantic_version.h"
+
#include <bson_object.h>
+#include "utils/test_async_waiter.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+// taken from transport_adapter_impl.cc
+const char* tc_enabled = "enabled";
+const char* tc_tcp_port = "tcp_port";
+const char* tc_tcp_ip_address = "tcp_ip_address";
+} // namespace transport_adapter
+} // namespace transport_manager
namespace test {
namespace components {
@@ -59,46 +71,51 @@ namespace protocol_handler_test {
#define NEW_SESSION_ID 0u
#define SESSION_START_REJECT 0u
// Protocol Handler Entities
-using protocol_handler::ProtocolHandlerImpl;
-using protocol_handler::ServiceType;
-using protocol_handler::RawMessage;
-using protocol_handler::RawMessagePtr;
-using protocol_handler::PROTECTION_ON;
-using protocol_handler::PROTECTION_OFF;
-using protocol_handler::PROTOCOL_VERSION_1;
-using protocol_handler::PROTOCOL_VERSION_2;
-using protocol_handler::PROTOCOL_VERSION_3;
-using protocol_handler::PROTOCOL_VERSION_4;
-using protocol_handler::PROTOCOL_VERSION_5;
-using protocol_handler::PROTOCOL_VERSION_MAX;
-using protocol_handler::FRAME_TYPE_CONTROL;
-using protocol_handler::FRAME_TYPE_SINGLE;
-using protocol_handler::FRAME_TYPE_FIRST;
-using protocol_handler::FRAME_TYPE_CONSECUTIVE;
-using protocol_handler::FRAME_TYPE_MAX_VALUE;
-using protocol_handler::MAXIMUM_FRAME_DATA_V2_SIZE;
-using protocol_handler::FRAME_DATA_START_SERVICE;
-using protocol_handler::FRAME_DATA_START_SERVICE_ACK;
-using protocol_handler::FRAME_DATA_END_SERVICE_NACK;
-using protocol_handler::FRAME_DATA_END_SERVICE_ACK;
using protocol_handler::FRAME_DATA_END_SERVICE;
+using protocol_handler::FRAME_DATA_END_SERVICE_ACK;
+using protocol_handler::FRAME_DATA_END_SERVICE_NACK;
+using protocol_handler::FRAME_DATA_FIRST;
using protocol_handler::FRAME_DATA_HEART_BEAT;
using protocol_handler::FRAME_DATA_HEART_BEAT_ACK;
+using protocol_handler::FRAME_DATA_LAST_CONSECUTIVE;
+using protocol_handler::FRAME_DATA_REGISTER_SECONDARY_TRANSPORT;
+using protocol_handler::FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_ACK;
+using protocol_handler::FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_NACK;
using protocol_handler::FRAME_DATA_SERVICE_DATA_ACK;
using protocol_handler::FRAME_DATA_SINGLE;
-using protocol_handler::FRAME_DATA_FIRST;
-using protocol_handler::FRAME_DATA_LAST_CONSECUTIVE;
-using protocol_handler::kRpc;
-using protocol_handler::kControl;
+using protocol_handler::FRAME_DATA_START_SERVICE;
+using protocol_handler::FRAME_DATA_START_SERVICE_ACK;
+using protocol_handler::FRAME_DATA_TRANSPORT_EVENT_UPDATE;
+using protocol_handler::FRAME_TYPE_CONSECUTIVE;
+using protocol_handler::FRAME_TYPE_CONTROL;
+using protocol_handler::FRAME_TYPE_FIRST;
+using protocol_handler::FRAME_TYPE_MAX_VALUE;
+using protocol_handler::FRAME_TYPE_SINGLE;
using protocol_handler::kAudio;
-using protocol_handler::kMobileNav;
using protocol_handler::kBulk;
+using protocol_handler::kControl;
using protocol_handler::kInvalidServiceType;
+using protocol_handler::kMobileNav;
+using protocol_handler::kRpc;
+using protocol_handler::MAXIMUM_FRAME_DATA_V2_SIZE;
+using protocol_handler::PROTECTION_OFF;
+using protocol_handler::PROTECTION_ON;
+using protocol_handler::PROTOCOL_VERSION_1;
+using protocol_handler::PROTOCOL_VERSION_2;
+using protocol_handler::PROTOCOL_VERSION_3;
+using protocol_handler::PROTOCOL_VERSION_4;
+using protocol_handler::PROTOCOL_VERSION_5;
+using protocol_handler::PROTOCOL_VERSION_MAX;
+using protocol_handler::ProtocolHandlerImpl;
+using protocol_handler::RawMessage;
+using protocol_handler::RawMessagePtr;
+using protocol_handler::ServiceStatusUpdateHandler;
+using protocol_handler::ServiceType;
// For TM states
-using transport_manager::TransportManagerListener;
using test::components::security_manager_test::MockSystemTimeHandler;
-using transport_manager::E_SUCCESS;
using transport_manager::DeviceInfo;
+using transport_manager::E_SUCCESS;
+using transport_manager::TransportManagerListener;
#ifdef ENABLE_SECURITY
// For security
using ContextCreationStrategy =
@@ -107,21 +124,26 @@ using ContextCreationStrategy =
// For CH entities
using connection_handler::DeviceHandle;
// Google Testing Framework Entities
-using ::testing::Return;
-using ::testing::ReturnRefOfCopy;
-using ::testing::ReturnNull;
+using ::testing::_;
using ::testing::An;
using ::testing::AnyOf;
+using ::testing::AtLeast;
using ::testing::ByRef;
using ::testing::DoAll;
-using ::testing::SaveArg;
using ::testing::Eq;
-using ::testing::_;
using ::testing::Invoke;
-using ::testing::SetArgReferee;
+using ::testing::Return;
+using ::testing::ReturnNull;
+using ::testing::ReturnRef;
+using ::testing::ReturnRefOfCopy;
+using ::testing::SaveArg;
using ::testing::SetArgPointee;
+using ::testing::SetArgReferee;
typedef std::vector<uint8_t> UCharDataVector;
+typedef std::shared_ptr<
+ testing::NiceMock<MockServiceStatusUpdateHandlerListener> >
+ MockServiceStatusUpdateHandlerListenerPtr;
// custom action to call a member function with 6 arguments
ACTION_P4(InvokeMemberFuncWithArg2, ptr, memberFunc, a, b) {
@@ -132,7 +154,7 @@ namespace {
const uint32_t kAsyncExpectationsTimeout = 10000u;
const uint32_t kMicrosecondsInMillisecond = 1000u;
const uint32_t kAddSessionWaitTimeMs = 100u;
-}
+} // namespace
class ProtocolHandlerImplTest : public ::testing::Test {
protected:
@@ -169,10 +191,17 @@ class ProtocolHandlerImplTest : public ::testing::Test {
session_observer_mock,
connection_handler_mock,
transport_manager_mock));
+ std::unique_ptr<ServiceStatusUpdateHandler> service_status_update_handler_(
+ new ServiceStatusUpdateHandler(
+ &(*mock_service_status_update_handler_listener_)));
+ protocol_handler_impl->set_service_status_update_handler(
+ std::move(service_status_update_handler_));
tm_listener = protocol_handler_impl.get();
}
void SetUp() OVERRIDE {
+ mock_service_status_update_handler_listener_ = std::make_shared<
+ testing::NiceMock<MockServiceStatusUpdateHandlerListener> >();
InitProtocolHandlerImpl(0u, 0u);
connection_id = 0xAu;
session_id = 0xFFu;
@@ -190,13 +219,18 @@ class ProtocolHandlerImplTest : public ::testing::Test {
.
// Return false to avoid call KeepConnectionAlive
WillRepeatedly(Return(false));
+
+ session_connection_map_lock_ptr_ =
+ std::make_shared<sync_primitives::Lock>();
}
void TearDown() OVERRIDE {
const_cast<protocol_handler::impl::FromMobileQueue&>(
- protocol_handler_impl->get_from_mobile_queue()).WaitDumpQueue();
+ protocol_handler_impl->get_from_mobile_queue())
+ .WaitDumpQueue();
const_cast<protocol_handler::impl::ToMobileQueue&>(
- protocol_handler_impl->get_to_mobile_queue()).WaitDumpQueue();
+ protocol_handler_impl->get_to_mobile_queue())
+ .WaitDumpQueue();
}
// Emulate connection establish
@@ -216,6 +250,7 @@ class ProtocolHandlerImplTest : public ::testing::Test {
const uint32_t hash_id,
const bool protection_flag) {
return protocol_handler::SessionContext(connection_id,
+ connection_id,
initial_session_id,
new_session_id,
service_type,
@@ -223,7 +258,7 @@ class ProtocolHandlerImplTest : public ::testing::Test {
protection_flag);
}
- void AddSession(const ::utils::SharedPtr<TestAsyncWaiter>& waiter,
+ void AddSession(const std::shared_ptr<TestAsyncWaiter>& waiter,
uint32_t& times) {
using namespace protocol_handler;
ASSERT_TRUE(NULL != waiter.get());
@@ -248,6 +283,21 @@ class ProtocolHandlerImplTest : public ::testing::Test {
HASH_ID_WRONG,
callback_protection_flag);
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -320,10 +370,11 @@ class ProtocolHandlerImplTest : public ::testing::Test {
uint8_t service_type,
uint8_t sessionId,
uint32_t frame_data,
+ uint8_t protocol_version = PROTOCOL_VERSION_3,
uint32_t dataSize = 0u,
const uint8_t* data = NULL) {
SendTMMessage(connection_id,
- PROTOCOL_VERSION_3,
+ protocol_version,
protection,
FRAME_TYPE_CONTROL,
service_type,
@@ -334,8 +385,25 @@ class ProtocolHandlerImplTest : public ::testing::Test {
data);
}
+ void VerifySecondaryTransportParamsInStartSessionAck(
+ bool config_multiple_transports_enabled,
+ const std::vector<std::string>& config_secondary_transports_for_usb,
+ const std::vector<std::string>& config_secondary_transports_for_bluetooth,
+ const std::vector<std::string>& config_secondary_transports_for_wifi,
+ const std::vector<std::string>& config_audio_service_transports,
+ const std::vector<std::string>& config_video_service_transports,
+ const std::string& connection_type_string,
+ const std::vector<std::string>& expected_transport_strings,
+ const std::vector<int32_t>& expected_audio_service_transports,
+ const std::vector<int32_t>& expected_video_service_transports);
+
+ void VerifyCloudAppParamsInStartSessionAck(const std::string& policy_app_id,
+ char* auth_token);
+
testing::NiceMock<MockProtocolHandlerSettings> protocol_handler_settings_mock;
- ::utils::SharedPtr<ProtocolHandlerImpl> protocol_handler_impl;
+ std::shared_ptr<ProtocolHandlerImpl> protocol_handler_impl;
+ MockServiceStatusUpdateHandlerListenerPtr
+ mock_service_status_update_handler_listener_;
TransportManagerListener* tm_listener;
// Uniq connection
::transport_manager::ConnectionUID connection_id;
@@ -360,6 +428,10 @@ class ProtocolHandlerImplTest : public ::testing::Test {
std::vector<int> force_unprotected_services;
#endif // ENABLE_SECURITY
std::vector<std::string> empty_rejected_param_;
+ // Used by OnTransportConfigUpdated() tests. The lifetime of these objects
+ // should be longer than that of a test case.
+ connection_handler::SessionConnectionMap session_connection_map_;
+ std::shared_ptr<sync_primitives::Lock> session_connection_map_lock_ptr_;
};
#ifdef ENABLE_SECURITY
@@ -414,6 +486,24 @@ TEST_F(ProtocolHandlerImplTest,
TestAsyncWaiter waiter;
uint32_t times = 0;
ServiceType service_type;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .Times(call_times)
+ .WillRepeatedly(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .Times(call_times)
+ .WillRepeatedly(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .Times(call_times)
+ .WillRepeatedly(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(
session_observer_mock,
@@ -482,6 +572,24 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) {
TestAsyncWaiter waiter;
uint32_t times = 0;
ServiceType service_type;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .Times(call_times)
+ .WillRepeatedly(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .Times(call_times)
+ .WillRepeatedly(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .Times(call_times)
+ .WillRepeatedly(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(
session_observer_mock,
@@ -540,6 +648,21 @@ TEST_F(ProtocolHandlerImplTest,
TestAsyncWaiter waiter;
uint32_t times = 0;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -584,8 +707,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverAccept) {
SetProtocolVersion2();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -624,13 +746,12 @@ TEST_F(ProtocolHandlerImplTest,
const uint8_t session_id1 = 1u;
const ::transport_manager::ConnectionUID connection_id2 = 0xBu;
const uint8_t session_id2 = 2u;
+ EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id2, session_id2))
+ .WillRepeatedly(Return(connection_key));
#ifdef ENABLE_SECURITY
AddSecurityManager();
- EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id2, session_id2))
- .WillOnce(Return(connection_key));
-
EXPECT_CALL(session_observer_mock,
GetSSLContext(connection_key, start_service))
.Times(2)
@@ -657,6 +778,26 @@ TEST_F(ProtocolHandlerImplTest,
TestAsyncWaiter waiter;
uint32_t times = 0;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id1))
+ .WillOnce(Return("TCP_WIFI"));
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id2))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .Times(2)
+ .WillRepeatedly(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .Times(2)
+ .WillRepeatedly(ReturnRef(video_service_transports));
+
BsonObject bson_params1;
bson_object_initialize_default(&bson_params1);
bson_object_put_string(&bson_params1,
@@ -793,14 +934,91 @@ TEST_F(ProtocolHandlerImplTest,
bson_object_deinitialize(&bson_params2);
}
+/*
+ * ProtocolHandler shall send NAck on session_observer rejection
+ * Check protection flag OFF for all services from kControl to kBulk
+ */
+TEST_F(ProtocolHandlerImplTest, StartSession_Audio_RejectByTransportType) {
+ using namespace protocol_handler;
+ AddConnection();
+ const ServiceType start_service = kAudio;
+
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("AOA_USB");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
+ // Expect send Ack
+ EXPECT_CALL(transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
+ PROTECTION_OFF)))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+ SendControlMessage(
+ PROTECTION_OFF, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
+/*
+ * ProtocolHandler shall send NAck on session_observer rejection
+ * Check protection flag OFF for all services from kControl to kBulk
+ */
+TEST_F(ProtocolHandlerImplTest, StartSession_Video_RejectByTransportType) {
+ using namespace protocol_handler;
+ AddConnection();
+ const ServiceType start_service = kMobileNav;
+
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("AOA_USB");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
+ // Expect send Ack
+ EXPECT_CALL(transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK,
+ PROTECTION_OFF)))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+ SendControlMessage(
+ PROTECTION_OFF, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
// TODO(EZamakhov): add test for get_hash_id/set_hash_id from
// protocol_handler_impl.cc
/*
* ProtocolHandler shall send NAck on session_observer rejection
*/
TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) {
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -833,8 +1051,7 @@ TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) {
* ProtocolHandler shall send NAck on wrong hash code
*/
TEST_F(ProtocolHandlerImplTest, EndSession_Success) {
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -867,8 +1084,7 @@ TEST_F(ProtocolHandlerImplTest, EndSession_Success) {
#ifdef ENABLE_SECURITY
TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) {
using namespace protocol_handler;
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -876,6 +1092,21 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) {
// Add security manager
AddSecurityManager();
const ServiceType start_service = kRpc;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -932,6 +1163,21 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) {
TestAsyncWaiter waiter;
uint32_t times = 0;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -987,6 +1233,21 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) {
PROTECTION_ON);
context.is_new_service_ = true;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1040,6 +1301,21 @@ TEST_F(ProtocolHandlerImplTest,
TestAsyncWaiter waiter;
uint32_t times = 0;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1116,6 +1392,21 @@ TEST_F(ProtocolHandlerImplTest,
PROTECTION_ON);
context.is_new_service_ = true;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1138,7 +1429,7 @@ TEST_F(ProtocolHandlerImplTest,
services.push_back(0x0A);
services.push_back(0x0B);
EXPECT_CALL(protocol_handler_settings_mock, force_protected_service())
- .WillOnce(ReturnRefOfCopy(services));
+ .WillRepeatedly(ReturnRefOfCopy(services));
// call new SSLContext creation
EXPECT_CALL(security_manager_mock, CreateSSLContext(connection_key, _))
@@ -1197,6 +1488,21 @@ TEST_F(ProtocolHandlerImplTest,
TestAsyncWaiter waiter;
uint32_t times = 0;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1295,6 +1601,21 @@ TEST_F(
TestAsyncWaiter waiter;
uint32_t times = 0;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1391,6 +1712,21 @@ TEST_F(ProtocolHandlerImplTest,
TestAsyncWaiter waiter;
uint32_t times = 0;
+ // Expect verification of allowed transport
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillOnce(Return("TCP_WIFI"));
+
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(video_service_transports));
+
// Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id,
@@ -1485,14 +1821,1263 @@ TEST_F(ProtocolHandlerImplTest,
}
#endif // ENABLE_SECURITY
+void ProtocolHandlerImplTest::VerifySecondaryTransportParamsInStartSessionAck(
+ bool config_multiple_transports_enabled,
+ const std::vector<std::string>& config_secondary_transports_for_usb,
+ const std::vector<std::string>& config_secondary_transports_for_bluetooth,
+ const std::vector<std::string>& config_secondary_transports_for_wifi,
+ const std::vector<std::string>& config_audio_service_transports,
+ const std::vector<std::string>& config_video_service_transports,
+ const std::string& connection_type_string,
+ const std::vector<std::string>& expected_transport_strings,
+ const std::vector<int32_t>& expected_audio_service_transports,
+ const std::vector<int32_t>& expected_video_service_transports) {
+ const size_t maximum_rpc_payload_size = 1500;
+ EXPECT_CALL(protocol_handler_settings_mock, maximum_rpc_payload_size())
+ .WillRepeatedly(Return(maximum_rpc_payload_size));
+ InitProtocolHandlerImpl(0u, 0u);
+
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+
+ const uint8_t input_protocol_version = 5;
+ const uint32_t hash_id = 123456;
+ utils::SemanticVersion full_version(5, 1, 0);
+ char full_version_string[] = "5.1.0";
+
+ // configuration setup
+ EXPECT_CALL(protocol_handler_settings_mock, max_supported_protocol_version())
+ .WillRepeatedly(Return(PROTOCOL_VERSION_5));
+ EXPECT_CALL(protocol_handler_settings_mock, multiple_transports_enabled())
+ .WillRepeatedly(Return(config_multiple_transports_enabled));
+ EXPECT_CALL(protocol_handler_settings_mock, secondary_transports_for_usb())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_usb));
+ EXPECT_CALL(protocol_handler_settings_mock,
+ secondary_transports_for_bluetooth())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_bluetooth));
+ EXPECT_CALL(protocol_handler_settings_mock, secondary_transports_for_wifi())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_wifi));
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(config_audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(config_video_service_transports));
+
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillRepeatedly(Return(connection_type_string));
+
+ // Prepare expected BSON parameters. When we add another param in Start
+ // Service ACK frame in future, it should be also added here.
+ BsonObject expected_obj;
+ bson_object_initialize_default(&expected_obj);
+ // mtu
+ bson_object_put_int64(&expected_obj,
+ protocol_handler::strings::mtu,
+ static_cast<int64_t>(maximum_rpc_payload_size));
+ // hashId
+ bson_object_put_int32(&expected_obj,
+ protocol_handler::strings::hash_id,
+ static_cast<int32_t>(hash_id));
+ // protocolVersion
+ bson_object_put_string(&expected_obj,
+ protocol_handler::strings::protocol_version,
+ full_version_string);
+ // secondaryTransports
+ BsonArray secondary_transports;
+ bson_array_initialize(&secondary_transports,
+ expected_transport_strings.size());
+ for (std::vector<std::string>::const_iterator it =
+ expected_transport_strings.begin();
+ it != expected_transport_strings.end();
+ ++it) {
+ // note: if there is no transport allowed, we can either make the array
+ // empty, or completely omit the array. (The spec allows both cases.) In
+ // this test case we make the array empty.
+ bson_array_add_string(&secondary_transports,
+ const_cast<char*>(it->c_str()));
+ }
+ bson_object_put_array(&expected_obj,
+ protocol_handler::strings::secondary_transports,
+ &secondary_transports);
+ // audioServiceTransports
+ BsonArray audio_service_transports;
+ if (expected_audio_service_transports.size() > 0) {
+ bson_array_initialize(&audio_service_transports,
+ expected_audio_service_transports.size());
+ for (std::vector<int32_t>::const_iterator it =
+ expected_audio_service_transports.begin();
+ it != expected_audio_service_transports.end();
+ ++it) {
+ bson_array_add_int32(&audio_service_transports, *it);
+ }
+ bson_object_put_array(&expected_obj,
+ protocol_handler::strings::audio_service_transports,
+ &audio_service_transports);
+ }
+ // videoServiceTransports
+ BsonArray video_service_transports;
+ if (expected_video_service_transports.size() > 0) {
+ bson_array_initialize(&video_service_transports,
+ expected_video_service_transports.size());
+ for (std::vector<int32_t>::const_iterator it =
+ expected_video_service_transports.begin();
+ it != expected_video_service_transports.end();
+ ++it) {
+ bson_array_add_int32(&video_service_transports, *it);
+ }
+ bson_object_put_array(&expected_obj,
+ protocol_handler::strings::video_service_transports,
+ &video_service_transports);
+ }
+
+ std::vector<uint8_t> expected_param =
+ CreateVectorFromBsonObject(&expected_obj);
+
+ bson_object_deinitialize(&expected_obj);
+
+ EXPECT_CALL(
+ transport_manager_mock,
+ SendMessageToDevice(ControlMessage(
+ FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, connection_id, _)))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+#ifdef ENABLE_SECURITY
+ AddSecurityManager();
+
+ EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id, session_id))
+ .WillOnce(Return(connection_key));
+
+ EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
+ .WillOnce(ReturnNull());
+#endif // ENABLE_SECURITY
+
+ protocol_handler_impl->SendStartSessionAck(connection_id,
+ session_id,
+ input_protocol_version,
+ hash_id,
+ protocol_handler::SERVICE_TYPE_RPC,
+ false /* protection */,
+ full_version);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
+void ProtocolHandlerImplTest::VerifyCloudAppParamsInStartSessionAck(
+ const std::string& policy_app_id, char* auth_token) {
+ const size_t maximum_rpc_payload_size = 1500;
+ EXPECT_CALL(protocol_handler_settings_mock, maximum_rpc_payload_size())
+ .WillRepeatedly(Return(maximum_rpc_payload_size));
+ InitProtocolHandlerImpl(0u, 0u);
+
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+
+ const uint8_t input_protocol_version = 5;
+ const uint32_t hash_id = 123456;
+ utils::SemanticVersion full_version(5, 2, 0);
+ char full_version_string[] = "5.2.0";
+
+ // configuration setup
+ EXPECT_CALL(protocol_handler_settings_mock, max_supported_protocol_version())
+ .WillRepeatedly(Return(PROTOCOL_VERSION_5));
+ EXPECT_CALL(connection_handler_mock, GetCloudAppID(connection_id))
+ .WillOnce(Return(policy_app_id));
+ connection_handler::SessionTransports dummy_st = {0, 0};
+ EXPECT_CALL(connection_handler_mock,
+ SetSecondaryTransportID(_, kDisabledSecondary))
+ .WillOnce(Return(dummy_st));
+ EXPECT_CALL(protocol_handler_settings_mock, multiple_transports_enabled())
+ .WillRepeatedly(Return(false));
+ std::vector<std::string> empty_vec;
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillRepeatedly(ReturnRef(empty_vec));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillRepeatedly(ReturnRef(empty_vec));
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillRepeatedly(Return("WEBSOCKET"));
+
+ // Prepare expected BSON parameters. When we add another param in Start
+ // Service ACK frame in future, it should be also added here.
+ BsonObject expected_obj;
+ bson_object_initialize_default(&expected_obj);
+
+ // mtu
+ bson_object_put_int64(&expected_obj,
+ protocol_handler::strings::mtu,
+ static_cast<int64_t>(maximum_rpc_payload_size));
+ // hashId
+ bson_object_put_int32(&expected_obj,
+ protocol_handler::strings::hash_id,
+ static_cast<int32_t>(hash_id));
+ // protocolVersion
+ bson_object_put_string(&expected_obj,
+ protocol_handler::strings::protocol_version,
+ full_version_string);
+
+ // secondaryTransports
+ BsonArray secondary_transports;
+ bson_array_initialize(&secondary_transports, 0);
+ bson_object_put_array(&expected_obj,
+ protocol_handler::strings::secondary_transports,
+ &secondary_transports);
+
+ BsonArray audio_service_transports;
+ bson_array_initialize(&audio_service_transports, 1);
+ bson_array_add_int32(&audio_service_transports, 1);
+ bson_object_put_array(&expected_obj,
+ protocol_handler::strings::audio_service_transports,
+ &audio_service_transports);
+
+ BsonArray video_service_transports;
+ bson_array_initialize(&video_service_transports, 1);
+ bson_array_add_int32(&video_service_transports, 1);
+ bson_object_put_array(&expected_obj,
+ protocol_handler::strings::video_service_transports,
+ &video_service_transports);
+
+ // authToken
+ bson_object_put_string(
+ &expected_obj, protocol_handler::strings::auth_token, auth_token);
+
+ std::vector<uint8_t> expected_param =
+ CreateVectorFromBsonObject(&expected_obj);
+
+ bson_object_deinitialize(&expected_obj);
+
+ EXPECT_CALL(transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK,
+ PROTECTION_OFF,
+ connection_id,
+ Eq(expected_param))))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+#ifdef ENABLE_SECURITY
+ AddSecurityManager();
+
+ EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id, session_id))
+ .WillOnce(Return(connection_key));
+
+ EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
+ .WillOnce(ReturnNull());
+#endif // ENABLE_SECURITY
+
+ protocol_handler_impl->OnAuthTokenUpdated(policy_app_id,
+ std::string(auth_token));
+ protocol_handler_impl->SendStartSessionAck(connection_id,
+ session_id,
+ input_protocol_version,
+ hash_id,
+ protocol_handler::SERVICE_TYPE_RPC,
+ false /* protection */,
+ full_version);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
+TEST_F(ProtocolHandlerImplTest,
+ StartSessionAck_SecondaryTransportParams_Enabled) {
+ // config allows secondary transport only when connected through Bluetooth,
+ // and the secondary is Wi-Fi
+ std::vector<std::string> secondary_transports_for_usb; // empty
+ std::vector<std::string> secondary_transports_for_bluetooth;
+ secondary_transports_for_bluetooth.push_back("WiFi");
+ std::vector<std::string> secondary_transports_for_wifi; // empty
+ // config allows video and audio services to run on all transports except
+ // Bluetooth
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("IAP_USB");
+ audio_service_transports.push_back("IAP_USB_HOST_MODE");
+ audio_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ audio_service_transports.push_back("IAP_CARPLAY");
+ audio_service_transports.push_back("AOA_USB");
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("IAP_USB");
+ video_service_transports.push_back("IAP_USB_HOST_MODE");
+ video_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ video_service_transports.push_back("IAP_CARPLAY");
+ video_service_transports.push_back("AOA_USB");
+ video_service_transports.push_back("TCP_WIFI");
+
+ // assume the device is Android and is connected through Bluetooth SPP
+ std::string connection_type_string("SPP_BLUETOOTH");
+
+ // Core should specify WiFi for secondary transport, and should allow video
+ // and audio services only on secondary transport
+ std::vector<std::string> expected_transport_strings;
+ expected_transport_strings.push_back("TCP_WIFI");
+ std::vector<int32_t> expected_audio_service_transports;
+ expected_audio_service_transports.push_back(2);
+ std::vector<int32_t> expected_video_service_transports;
+ expected_video_service_transports.push_back(2);
+
+ // A TransportUpdateEvent is also issued after Start Service ACK. We don't
+ // check it in this test case.
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(Return(false));
+
+ VerifySecondaryTransportParamsInStartSessionAck(
+ true,
+ secondary_transports_for_usb,
+ secondary_transports_for_bluetooth,
+ secondary_transports_for_wifi,
+ audio_service_transports,
+ video_service_transports,
+ connection_type_string,
+ expected_transport_strings,
+ expected_audio_service_transports,
+ expected_video_service_transports);
+}
+
+TEST_F(ProtocolHandlerImplTest,
+ StartSessionAck_SecondaryTransportParams_NoSecondaryTransport) {
+ // config allows secondary transport only when connected through Bluetooth,
+ // and the secondary is Wi-Fi
+ std::vector<std::string> secondary_transports_for_usb; // empty
+ std::vector<std::string> secondary_transports_for_bluetooth;
+ secondary_transports_for_bluetooth.push_back("WiFi");
+ std::vector<std::string> secondary_transports_for_wifi; // empty
+ // config allows video and audio services to run on all transports except
+ // Bluetooth
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("IAP_USB");
+ audio_service_transports.push_back("IAP_USB_HOST_MODE");
+ audio_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ audio_service_transports.push_back("IAP_CARPLAY");
+ audio_service_transports.push_back("AOA_USB");
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("IAP_USB");
+ video_service_transports.push_back("IAP_USB_HOST_MODE");
+ video_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ video_service_transports.push_back("IAP_CARPLAY");
+ video_service_transports.push_back("AOA_USB");
+ video_service_transports.push_back("TCP_WIFI");
+
+ // assume the device is iOS and is connected through iAP over USB
+ std::string connection_type_string("IAP_USB");
+
+ // Core should not offer any secondary transport. It will allow both video
+ // and audio services on primary transport.
+ std::vector<std::string> expected_transport_strings; // empty
+ std::vector<int32_t> expected_audio_service_transports;
+ expected_audio_service_transports.push_back(1);
+ std::vector<int32_t> expected_video_service_transports;
+ expected_video_service_transports.push_back(1);
+
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(Return(false));
+
+ VerifySecondaryTransportParamsInStartSessionAck(
+ true,
+ secondary_transports_for_usb,
+ secondary_transports_for_bluetooth,
+ secondary_transports_for_wifi,
+ audio_service_transports,
+ video_service_transports,
+ connection_type_string,
+ expected_transport_strings,
+ expected_audio_service_transports,
+ expected_video_service_transports);
+}
+
+TEST_F(ProtocolHandlerImplTest,
+ StartSessionAck_SecondaryTransportParams_MultipleSecondaryTransports) {
+ // config allows secondary transport only when connected through Bluetooth,
+ // and the secondary is Wi-Fi and USB
+ std::vector<std::string> secondary_transports_for_usb; // empty
+ std::vector<std::string> secondary_transports_for_bluetooth;
+ secondary_transports_for_bluetooth.push_back("WiFi");
+ secondary_transports_for_bluetooth.push_back("USB");
+ std::vector<std::string> secondary_transports_for_wifi; // empty
+ // config allows video and audio services to run on all transports except
+ // Bluetooth
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("IAP_USB");
+ audio_service_transports.push_back("IAP_USB_HOST_MODE");
+ audio_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ audio_service_transports.push_back("IAP_CARPLAY");
+ audio_service_transports.push_back("AOA_USB");
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("IAP_USB");
+ video_service_transports.push_back("IAP_USB_HOST_MODE");
+ video_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ video_service_transports.push_back("IAP_CARPLAY");
+ video_service_transports.push_back("AOA_USB");
+ video_service_transports.push_back("TCP_WIFI");
+
+ // assume the device is iOS and is connected through iAP over Bluetooth
+ std::string connection_type_string("IAP_BLUETOOTH");
+
+ // Core should offer both Wi-Fi and USB for secondary transport. Since the
+ // device is iOS, Core should specify "IAP_USB".
+ std::vector<std::string> expected_transport_strings;
+ expected_transport_strings.push_back("TCP_WIFI");
+ expected_transport_strings.push_back("IAP_USB");
+ std::vector<int32_t> expected_audio_service_transports;
+ expected_audio_service_transports.push_back(2);
+ std::vector<int32_t> expected_video_service_transports;
+ expected_video_service_transports.push_back(2);
+
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(Return(false));
+
+ VerifySecondaryTransportParamsInStartSessionAck(
+ true,
+ secondary_transports_for_usb,
+ secondary_transports_for_bluetooth,
+ secondary_transports_for_wifi,
+ audio_service_transports,
+ video_service_transports,
+ connection_type_string,
+ expected_transport_strings,
+ expected_audio_service_transports,
+ expected_video_service_transports);
+}
+
+TEST_F(
+ ProtocolHandlerImplTest,
+ StartSessionAck_SecondaryTransportParams_ServiceAllowedOnBothTransports) {
+ std::vector<std::string> secondary_transports_for_usb;
+ secondary_transports_for_usb.push_back("WiFi");
+ std::vector<std::string> secondary_transports_for_bluetooth;
+ secondary_transports_for_bluetooth.push_back("USB");
+ std::vector<std::string> secondary_transports_for_wifi; // empty
+ // config allows video service to run on Wi-Fi transports only, and audio
+ // service to run on all transports
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("IAP_BLUETOOTH");
+ audio_service_transports.push_back("IAP_USB");
+ audio_service_transports.push_back("IAP_USB_HOST_MODE");
+ audio_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ audio_service_transports.push_back("IAP_CARPLAY");
+ audio_service_transports.push_back("SPP_BLUETOOTH");
+ audio_service_transports.push_back("AOA_USB");
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("IAP_CARPLAY");
+ video_service_transports.push_back("TCP_WIFI");
+
+ // assume the device is Android and is connected through AOA
+ std::string connection_type_string("AOA_USB");
+
+ // Core should offer Wi-Fi for secondary transport. It should allow audio
+ // service to run on both primary and secondary, while video service to run
+ // on secondary only. Since the list specifies AOA_USB then TCP_WIFI, the
+ // priority is primary > secondary.
+ std::vector<std::string> expected_transport_strings;
+ expected_transport_strings.push_back("TCP_WIFI");
+ std::vector<int32_t> expected_audio_service_transports;
+ expected_audio_service_transports.push_back(1); // primary preferred
+ expected_audio_service_transports.push_back(2);
+ std::vector<int32_t> expected_video_service_transports;
+ expected_video_service_transports.push_back(2);
+
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(Return(false));
+
+ VerifySecondaryTransportParamsInStartSessionAck(
+ true,
+ secondary_transports_for_usb,
+ secondary_transports_for_bluetooth,
+ secondary_transports_for_wifi,
+ audio_service_transports,
+ video_service_transports,
+ connection_type_string,
+ expected_transport_strings,
+ expected_audio_service_transports,
+ expected_video_service_transports);
+}
+
+TEST_F(ProtocolHandlerImplTest,
+ StartSessionAck_SecondaryTransportParams_SecondaryDisabled) {
+ std::vector<std::string> secondary_transports_for_usb; // empty
+ std::vector<std::string> secondary_transports_for_bluetooth; // empty
+ std::vector<std::string> secondary_transports_for_wifi; // empty
+ // config allows video and audio services to run on all transports
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("IAP_BLUETOOTH");
+ audio_service_transports.push_back("IAP_USB");
+ audio_service_transports.push_back("IAP_USB_HOST_MODE");
+ audio_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ audio_service_transports.push_back("IAP_CARPLAY");
+ audio_service_transports.push_back("SPP_BLUETOOTH");
+ audio_service_transports.push_back("AOA_USB");
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("IAP_BLUETOOTH");
+ video_service_transports.push_back("IAP_USB");
+ video_service_transports.push_back("IAP_USB_HOST_MODE");
+ video_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ video_service_transports.push_back("IAP_CARPLAY");
+ video_service_transports.push_back("SPP_BLUETOOTH");
+ video_service_transports.push_back("AOA_USB");
+ video_service_transports.push_back("TCP_WIFI");
+
+ // assume the device is iOS and is connected through iAP over Bluetooth
+ std::string connection_type_string("IAP_BLUETOOTH");
+
+ // Core should not offer any secondary transport. It should still send
+ // the video/audio service transport lists.
+ std::vector<std::string> expected_transport_strings; // empty
+ std::vector<int32_t> expected_audio_service_transports;
+ expected_audio_service_transports.push_back(1);
+ std::vector<int32_t> expected_video_service_transports;
+ expected_video_service_transports.push_back(1);
+
+ connection_handler::SessionTransports dummy_st = {0, 0};
+ EXPECT_CALL(connection_handler_mock,
+ SetSecondaryTransportID(_, kDisabledSecondary))
+ .WillOnce(Return(dummy_st));
+
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(Return(false));
+
+ VerifySecondaryTransportParamsInStartSessionAck(
+ false, /* disabled */
+ secondary_transports_for_usb,
+ secondary_transports_for_bluetooth,
+ secondary_transports_for_wifi,
+ audio_service_transports,
+ video_service_transports,
+ connection_type_string,
+ expected_transport_strings,
+ expected_audio_service_transports,
+ expected_video_service_transports);
+}
+
+TEST_F(ProtocolHandlerImplTest,
+ StartSessionAck_SecondaryTransportParams_ServicesMapEmpty) {
+ std::vector<std::string> secondary_transports_for_usb; // empty
+ std::vector<std::string> secondary_transports_for_bluetooth;
+ secondary_transports_for_bluetooth.push_back("USB");
+ std::vector<std::string> secondary_transports_for_wifi;
+ secondary_transports_for_wifi.push_back("USB");
+ // config does not specify video and audio services
+ std::vector<std::string> audio_service_transports; // empty
+ std::vector<std::string> video_service_transports; // empty
+
+ // assume the device is connected through Wi-Fi (so not sure if it's iOS or
+ // Android)
+ std::string connection_type_string("TCP_WIFI");
+
+ // Core should offer USB transport for secondary transport. (Since the OS type
+ // is unknown, it will offer both IAP_USB and AOA_USB.) Also, it should allow
+ // video/audio services on all transports.
+ std::vector<std::string> expected_transport_strings;
+ expected_transport_strings.push_back("IAP_USB");
+ expected_transport_strings.push_back("AOA_USB");
+ std::vector<int32_t> expected_audio_service_transports;
+ expected_audio_service_transports.push_back(1);
+ expected_audio_service_transports.push_back(2);
+ std::vector<int32_t> expected_video_service_transports;
+ expected_video_service_transports.push_back(1);
+ expected_video_service_transports.push_back(2);
+
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(Return(false));
+
+ VerifySecondaryTransportParamsInStartSessionAck(
+ true,
+ secondary_transports_for_usb,
+ secondary_transports_for_bluetooth,
+ secondary_transports_for_wifi,
+ audio_service_transports,
+ video_service_transports,
+ connection_type_string,
+ expected_transport_strings,
+ expected_audio_service_transports,
+ expected_video_service_transports);
+}
+
+TEST_F(
+ ProtocolHandlerImplTest,
+ StartSessionAck_SecondaryTransportParams_SecondaryDisabled_ServicesMapEmpty) {
+ std::vector<std::string> secondary_transports_for_usb; // empty
+ std::vector<std::string> secondary_transports_for_bluetooth; // empty
+ std::vector<std::string> secondary_transports_for_wifi; // empty
+ // config does not specify video and audio services
+ std::vector<std::string> audio_service_transports; // empty
+ std::vector<std::string> video_service_transports; // empty
+
+ std::string connection_type_string("IAP_BLUETOOTH");
+
+ // Core should not offer any secondary transport. It should still send
+ // the video/audio service transport lists.
+ std::vector<std::string> expected_transport_strings; // empty
+ std::vector<int32_t> expected_audio_service_transports;
+ expected_audio_service_transports.push_back(1);
+ std::vector<int32_t> expected_video_service_transports;
+ expected_video_service_transports.push_back(1);
+
+ connection_handler::SessionTransports dummy_st = {0, 0};
+ EXPECT_CALL(connection_handler_mock,
+ SetSecondaryTransportID(_, kDisabledSecondary))
+ .WillOnce(Return(dummy_st));
+
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(Return(false));
+
+ VerifySecondaryTransportParamsInStartSessionAck(
+ false, /* disabled */
+ secondary_transports_for_usb,
+ secondary_transports_for_bluetooth,
+ secondary_transports_for_wifi,
+ audio_service_transports,
+ video_service_transports,
+ connection_type_string,
+ expected_transport_strings,
+ expected_audio_service_transports,
+ expected_video_service_transports);
+}
+
+// Secondary transport param should not be included for apps with v5.0.0
+TEST_F(ProtocolHandlerImplTest,
+ StartSessionAck_Unprotected_NoSecondaryTransportParamsForV5) {
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+
+ const uint8_t input_protocol_version = 5;
+ const uint32_t hash_id = 123456;
+ utils::SemanticVersion full_version(5, 0, 0);
+ char full_version_string[] = "5.0.0";
+
+ const size_t maximum_rpc_payload_size = 1500;
+ EXPECT_CALL(protocol_handler_settings_mock, maximum_rpc_payload_size())
+ .WillRepeatedly(Return(maximum_rpc_payload_size));
+ InitProtocolHandlerImpl(0u, 0u);
+
+ // configuration
+ std::vector<std::string> config_secondary_transports_for_usb; // empty
+ std::vector<std::string> config_secondary_transports_for_bluetooth;
+ config_secondary_transports_for_bluetooth.push_back("USB");
+ std::vector<std::string> config_secondary_transports_for_wifi;
+ config_secondary_transports_for_wifi.push_back("USB");
+
+ // assume the device is iOS and is connected through iAP over Bluetooth
+ std::string connection_type_string("IAP_BLUETOOTH");
+
+ // configuration setup
+ EXPECT_CALL(protocol_handler_settings_mock, max_supported_protocol_version())
+ .WillRepeatedly(Return(PROTOCOL_VERSION_5));
+ EXPECT_CALL(protocol_handler_settings_mock, multiple_transports_enabled())
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(protocol_handler_settings_mock, secondary_transports_for_usb())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_usb));
+ EXPECT_CALL(protocol_handler_settings_mock,
+ secondary_transports_for_bluetooth())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_bluetooth));
+ EXPECT_CALL(protocol_handler_settings_mock, secondary_transports_for_wifi())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_wifi));
+
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillRepeatedly(Return(connection_type_string));
+
+ // BSON params should not include any of "secondaryTransports",
+ // "audioServiceTransports" and "videoServiceTransports" since v5.0.0 app
+ // does not understand them
+ BsonObject expected_obj;
+ bson_object_initialize_default(&expected_obj);
+ // mtu
+ bson_object_put_int64(&expected_obj,
+ protocol_handler::strings::mtu,
+ static_cast<int64_t>(maximum_rpc_payload_size));
+ // hashId
+ bson_object_put_int32(&expected_obj,
+ protocol_handler::strings::hash_id,
+ static_cast<int32_t>(hash_id));
+ // protocolVersion
+ bson_object_put_string(&expected_obj,
+ protocol_handler::strings::protocol_version,
+ full_version_string);
+
+ std::vector<uint8_t> expected_param =
+ CreateVectorFromBsonObject(&expected_obj);
+
+ bson_object_deinitialize(&expected_obj);
+
+ EXPECT_CALL(transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK,
+ PROTECTION_OFF,
+ connection_id,
+ Eq(expected_param))))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+ connection_handler::SessionTransports dummy_st = {0, 0};
+ EXPECT_CALL(connection_handler_mock,
+ SetSecondaryTransportID(_, kDisabledSecondary))
+ .WillOnce(Return(dummy_st));
+
+ // Since the protocol version is less than 5.1.0, Core should not issue
+ // TransportEventUpdate frame. Enable ProtocolVersionUsed() call and verify
+ // that transport_manager_mock will NOT receive another SendMessageToDevice()
+ // call.
+ ON_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillByDefault(Return(true));
+
+#ifdef ENABLE_SECURITY
+ AddSecurityManager();
+
+ EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id, session_id))
+ .WillOnce(Return(connection_key));
+
+ EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
+ .WillOnce(ReturnNull());
+#endif // ENABLE_SECURITY
+
+ protocol_handler_impl->SendStartSessionAck(connection_id,
+ session_id,
+ input_protocol_version,
+ hash_id,
+ protocol_handler::SERVICE_TYPE_RPC,
+ false /* protection */,
+ full_version);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
+TEST_F(ProtocolHandlerImplTest, StartSessionAck_PrimaryTransportUSBHostMode) {
+ // config allows secondary transport only when connected through Bluetooth,
+ // and the secondary is Wi-Fi
+ std::vector<std::string> secondary_transports_for_usb;
+ secondary_transports_for_usb.push_back("WiFi");
+ std::vector<std::string> secondary_transports_for_bluetooth; // empty
+ std::vector<std::string> secondary_transports_for_wifi; // empty
+ // config allows video and audio services to run on all transports except
+ // Bluetooth
+ std::vector<std::string> audio_service_transports;
+ audio_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ audio_service_transports.push_back("IAP_CARPLAY");
+ audio_service_transports.push_back("AOA_USB");
+ audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> video_service_transports;
+ video_service_transports.push_back("IAP_USB");
+ video_service_transports.push_back("IAP_CARPLAY");
+ video_service_transports.push_back("AOA_USB");
+ video_service_transports.push_back("TCP_WIFI");
+
+ // assume the device is IOS and is connected through USB Host Mode
+ std::string connection_type_string("IAP_USB_HOST_MODE");
+
+ // Core should specify WiFi for secondary transport, and should allow video
+ // services on both transports, and audio only on secondary transport
+ std::vector<std::string> expected_transport_strings;
+ expected_transport_strings.push_back("TCP_WIFI");
+ std::vector<int32_t> expected_audio_service_transports;
+ expected_audio_service_transports.push_back(2);
+ std::vector<int32_t> expected_video_service_transports;
+ expected_video_service_transports.push_back(1);
+ expected_video_service_transports.push_back(2);
+
+ // A TransportUpdateEvent is also issued after Start Service ACK. We don't
+ // check it in this test case.
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(Return(false));
+
+ VerifySecondaryTransportParamsInStartSessionAck(
+ true,
+ secondary_transports_for_usb,
+ secondary_transports_for_bluetooth,
+ secondary_transports_for_wifi,
+ audio_service_transports,
+ video_service_transports,
+ connection_type_string,
+ expected_transport_strings,
+ expected_audio_service_transports,
+ expected_video_service_transports);
+}
+
+TEST_F(ProtocolHandlerImplTest, StartSessionAck_CloudAppAuthTokenAvailable) {
+ std::string policy_id = "policy_id";
+ char auth_token[] = "Sample auth token";
+
+ // A TransportUpdateEvent is also issued after Start Service ACK. We don't
+ // check it in this test case.
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(Return(false));
+
+ VerifyCloudAppParamsInStartSessionAck(policy_id, auth_token);
+}
+
+TEST_F(ProtocolHandlerImplTest,
+ TransportEventUpdate_afterVersionNegotiation_TCPEnabled) {
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+
+ const uint8_t input_protocol_version = 5;
+ const uint32_t hash_id = 123456;
+ utils::SemanticVersion full_version(5, 1, 0);
+
+ const size_t maximum_rpc_payload_size = 1500;
+ EXPECT_CALL(protocol_handler_settings_mock, maximum_rpc_payload_size())
+ .WillRepeatedly(Return(maximum_rpc_payload_size));
+ InitProtocolHandlerImpl(0u, 0u);
+
+ // TCP configuration setup
+ bool tcp_enabled = true;
+ char tcp_address[] = "192.168.1.1";
+ int32_t tcp_port = 12345;
+ std::string tcp_port_str = "12345";
+ protocol_handler_impl->set_tcp_config(
+ tcp_enabled, std::string(tcp_address), tcp_port_str);
+
+ // configuration setup
+ std::vector<std::string> config_secondary_transports_for_usb; // empty
+ std::vector<std::string> config_secondary_transports_for_bluetooth;
+ config_secondary_transports_for_bluetooth.push_back("WiFi");
+ std::vector<std::string> config_secondary_transports_for_wifi; // empty
+ std::vector<std::string> config_audio_service_transports;
+ config_audio_service_transports.push_back("IAP_USB");
+ config_audio_service_transports.push_back("IAP_USB_HOST_MODE");
+ config_audio_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ config_audio_service_transports.push_back("IAP_CARPLAY");
+ config_audio_service_transports.push_back("AOA_USB");
+ config_audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> config_video_service_transports;
+ config_video_service_transports.push_back("IAP_USB");
+ config_video_service_transports.push_back("IAP_USB_HOST_MODE");
+ config_video_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ config_video_service_transports.push_back("IAP_CARPLAY");
+ config_video_service_transports.push_back("AOA_USB");
+ config_video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, max_supported_protocol_version())
+ .WillRepeatedly(Return(PROTOCOL_VERSION_5));
+ EXPECT_CALL(protocol_handler_settings_mock, multiple_transports_enabled())
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(protocol_handler_settings_mock, secondary_transports_for_usb())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_usb));
+ EXPECT_CALL(protocol_handler_settings_mock,
+ secondary_transports_for_bluetooth())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_bluetooth));
+ EXPECT_CALL(protocol_handler_settings_mock, secondary_transports_for_wifi())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_wifi));
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(config_audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(config_video_service_transports));
+
+ // assume the device is iOS and is connected through iAP over Bluetooth
+ std::string connection_type_string("IAP_BLUETOOTH");
+
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillRepeatedly(Return(connection_type_string));
+
+ EXPECT_CALL(
+ transport_manager_mock,
+ SendMessageToDevice(ControlMessage(
+ FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, connection_id, _)))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(
+ DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
+
+ BsonObject expected_obj;
+ bson_object_initialize_default(&expected_obj);
+ // IP address
+ bson_object_put_string(
+ &expected_obj, protocol_handler::strings::tcp_ip_address, tcp_address);
+ // TCP port number
+ bson_object_put_int32(
+ &expected_obj, protocol_handler::strings::tcp_port, tcp_port);
+
+ std::vector<uint8_t> expected_param =
+ CreateVectorFromBsonObject(&expected_obj);
+
+ bson_object_deinitialize(&expected_obj);
+
+ EXPECT_CALL(
+ transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_TRANSPORT_EVENT_UPDATE,
+ PROTECTION_OFF,
+ connection_id,
+ Eq(expected_param))))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+#ifdef ENABLE_SECURITY
+ AddSecurityManager();
+
+ EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id, session_id))
+ .WillOnce(Return(connection_key));
+
+ EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
+ .WillOnce(ReturnNull());
+#endif // ENABLE_SECURITY
+
+ protocol_handler_impl->SendStartSessionAck(connection_id,
+ session_id,
+ input_protocol_version,
+ hash_id,
+ protocol_handler::SERVICE_TYPE_RPC,
+ false /* protection */,
+ full_version);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
+TEST_F(ProtocolHandlerImplTest,
+ TransportEventUpdate_afterVersionNegotiation_TCPDisabled) {
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+
+ const uint8_t input_protocol_version = 5;
+ const uint32_t hash_id = 123456;
+ utils::SemanticVersion full_version(5, 1, 0);
+
+ const size_t maximum_rpc_payload_size = 1500;
+ EXPECT_CALL(protocol_handler_settings_mock, maximum_rpc_payload_size())
+ .WillRepeatedly(Return(maximum_rpc_payload_size));
+ InitProtocolHandlerImpl(0u, 0u);
+
+ // TCP configuration setup
+ bool tcp_enabled = false;
+ char tcp_address[] = "192.168.2.3";
+ std::string tcp_port_str = "12345";
+ protocol_handler_impl->set_tcp_config(
+ tcp_enabled, std::string(tcp_address), tcp_port_str);
+
+ std::vector<std::string> config_secondary_transports_for_usb; // empty
+ std::vector<std::string> config_secondary_transports_for_bluetooth;
+ config_secondary_transports_for_bluetooth.push_back("WiFi");
+ std::vector<std::string> config_secondary_transports_for_wifi; // empty
+ std::vector<std::string> config_audio_service_transports;
+ config_audio_service_transports.push_back("IAP_USB");
+ config_audio_service_transports.push_back("IAP_USB_HOST_MODE");
+ config_audio_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ config_audio_service_transports.push_back("IAP_CARPLAY");
+ config_audio_service_transports.push_back("AOA_USB");
+ config_audio_service_transports.push_back("TCP_WIFI");
+ std::vector<std::string> config_video_service_transports;
+ config_video_service_transports.push_back("IAP_USB");
+ config_video_service_transports.push_back("IAP_USB_HOST_MODE");
+ config_video_service_transports.push_back("IAP_USB_DEVICE_MODE");
+ config_video_service_transports.push_back("IAP_CARPLAY");
+ config_video_service_transports.push_back("AOA_USB");
+ config_video_service_transports.push_back("TCP_WIFI");
+
+ EXPECT_CALL(protocol_handler_settings_mock, max_supported_protocol_version())
+ .WillRepeatedly(Return(PROTOCOL_VERSION_5));
+ EXPECT_CALL(protocol_handler_settings_mock, multiple_transports_enabled())
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(protocol_handler_settings_mock, secondary_transports_for_usb())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_usb));
+ EXPECT_CALL(protocol_handler_settings_mock,
+ secondary_transports_for_bluetooth())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_bluetooth));
+ EXPECT_CALL(protocol_handler_settings_mock, secondary_transports_for_wifi())
+ .Times(AtLeast(0))
+ .WillRepeatedly(ReturnRef(config_secondary_transports_for_wifi));
+ EXPECT_CALL(protocol_handler_settings_mock, audio_service_transports())
+ .WillOnce(ReturnRef(config_audio_service_transports));
+ EXPECT_CALL(protocol_handler_settings_mock, video_service_transports())
+ .WillOnce(ReturnRef(config_video_service_transports));
+
+ // assume the device is iOS and is connected through iAP over Bluetooth
+ std::string connection_type_string("IAP_BLUETOOTH");
+
+ EXPECT_CALL(session_observer_mock,
+ TransportTypeProfileStringFromConnHandle(connection_id))
+ .WillRepeatedly(Return(connection_type_string));
+
+ EXPECT_CALL(
+ transport_manager_mock,
+ SendMessageToDevice(ControlMessage(
+ FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF, connection_id, _)))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(
+ DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
+
+ BsonObject expected_obj;
+ bson_object_initialize_default(&expected_obj);
+ // IP address
+ char empty_ip_address[] = "";
+ bson_object_put_string(&expected_obj,
+ protocol_handler::strings::tcp_ip_address,
+ empty_ip_address);
+ // TCP port number should be omitted
+
+ std::vector<uint8_t> expected_param =
+ CreateVectorFromBsonObject(&expected_obj);
+
+ bson_object_deinitialize(&expected_obj);
+
+ EXPECT_CALL(
+ transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_TRANSPORT_EVENT_UPDATE,
+ PROTECTION_OFF,
+ connection_id,
+ Eq(expected_param))))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+#ifdef ENABLE_SECURITY
+ AddSecurityManager();
+
+ EXPECT_CALL(session_observer_mock, KeyFromPair(connection_id, session_id))
+ .WillOnce(Return(connection_key));
+
+ EXPECT_CALL(session_observer_mock, GetSSLContext(connection_key, kRpc))
+ .WillOnce(ReturnNull());
+#endif // ENABLE_SECURITY
+
+ protocol_handler_impl->SendStartSessionAck(connection_id,
+ session_id,
+ input_protocol_version,
+ hash_id,
+ protocol_handler::SERVICE_TYPE_RPC,
+ false /* protection */,
+ full_version);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
+TEST_F(ProtocolHandlerImplTest,
+ OnTransportConfigUpdated_TransportEventUpdate_TCPEnabled) {
+ using connection_handler::SessionConnectionMap;
+ using connection_handler::SessionTransports;
+
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+
+ char tcp_address[] = "172.16.2.3";
+ int32_t tcp_port = 23456;
+ std::string tcp_port_str = "23456";
+
+ transport_manager::transport_adapter::TransportConfig configs;
+ configs[transport_manager::transport_adapter::tc_enabled] =
+ std::string("true");
+ configs[transport_manager::transport_adapter::tc_tcp_port] = tcp_port_str;
+ configs[transport_manager::transport_adapter::tc_tcp_ip_address] =
+ std::string(tcp_address);
+
+ transport_manager::ConnectionUID device1_primary_connection_id = 100;
+ transport_manager::ConnectionUID device2_primary_connection_id = 101;
+ transport_manager::ConnectionUID device2_secondary_connection_id = 150;
+
+ SessionTransports st1 = {device1_primary_connection_id, kDisabledSecondary};
+ SessionTransports st2 = {device2_primary_connection_id,
+ device2_secondary_connection_id};
+ session_connection_map_[0x11] = st1;
+ session_connection_map_[0x22] = st2;
+
+ EXPECT_CALL(connection_handler_mock, session_connection_map())
+ .WillOnce(Return(DataAccessor<SessionConnectionMap>(
+ session_connection_map_, session_connection_map_lock_ptr_)));
+
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(
+ DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
+
+ BsonObject expected_obj;
+ bson_object_initialize_default(&expected_obj);
+ // IP address
+ bson_object_put_string(
+ &expected_obj, protocol_handler::strings::tcp_ip_address, tcp_address);
+ // TCP port number
+ bson_object_put_int32(
+ &expected_obj, protocol_handler::strings::tcp_port, tcp_port);
+
+ std::vector<uint8_t> expected_param =
+ CreateVectorFromBsonObject(&expected_obj);
+
+ bson_object_deinitialize(&expected_obj);
+
+ // since device 1 doesn't support secondary transport feature,
+ // TransportEvetUpdate should be delivered only to device 2
+ EXPECT_CALL(
+ transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_TRANSPORT_EVENT_UPDATE,
+ PROTECTION_OFF,
+ device2_primary_connection_id,
+ Eq(expected_param))))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+ tm_listener->OnTransportConfigUpdated(configs);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
+TEST_F(ProtocolHandlerImplTest,
+ OnTransportConfigUpdated_TransportEventUpdate_TCPDisabled) {
+ using connection_handler::SessionConnectionMap;
+ using connection_handler::SessionTransports;
+
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+
+ char tcp_address[] = "172.16.2.3";
+ std::string tcp_port_str = "23456";
+
+ transport_manager::transport_adapter::TransportConfig configs;
+ configs[transport_manager::transport_adapter::tc_enabled] =
+ std::string("false");
+ configs[transport_manager::transport_adapter::tc_tcp_port] = tcp_port_str;
+ configs[transport_manager::transport_adapter::tc_tcp_ip_address] =
+ std::string(tcp_address);
+
+ transport_manager::ConnectionUID device1_primary_connection_id = 100;
+ transport_manager::ConnectionUID device1_secondary_connection_id = 150;
+ transport_manager::ConnectionUID device2_primary_connection_id = 101;
+ transport_manager::ConnectionUID device3_primary_connection_id = 102;
+ transport_manager::ConnectionUID device3_secondary_connection_id = 151;
+
+ SessionTransports st1 = {device1_primary_connection_id,
+ device1_secondary_connection_id};
+ SessionTransports st2 = {device2_primary_connection_id, kDisabledSecondary};
+ SessionTransports st3 = {device3_primary_connection_id,
+ device3_secondary_connection_id};
+ session_connection_map_[0x11] = st1;
+ session_connection_map_[0x22] = st2;
+ session_connection_map_[0x33] = st3;
+
+ EXPECT_CALL(connection_handler_mock, session_connection_map())
+ .WillOnce(Return(DataAccessor<SessionConnectionMap>(
+ session_connection_map_, session_connection_map_lock_ptr_)));
+
+ EXPECT_CALL(session_observer_mock, ProtocolVersionUsed(_, _, _))
+ .WillRepeatedly(
+ DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
+
+ BsonObject expected_obj;
+ bson_object_initialize_default(&expected_obj);
+ // IP address
+ char empty_ip_address[] = "";
+ bson_object_put_string(&expected_obj,
+ protocol_handler::strings::tcp_ip_address,
+ empty_ip_address);
+ // TCP port number should be omitted
+
+ std::vector<uint8_t> expected_param =
+ CreateVectorFromBsonObject(&expected_obj);
+
+ bson_object_deinitialize(&expected_obj);
+
+ // both device 1 and device 3 should receive TransportEventUpdate frames
+ EXPECT_CALL(
+ transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_TRANSPORT_EVENT_UPDATE,
+ PROTECTION_OFF,
+ device1_primary_connection_id,
+ Eq(expected_param))))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+ EXPECT_CALL(
+ transport_manager_mock,
+ SendMessageToDevice(ControlMessage(FRAME_DATA_TRANSPORT_EVENT_UPDATE,
+ PROTECTION_OFF,
+ device3_primary_connection_id,
+ Eq(expected_param))))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+ tm_listener->OnTransportConfigUpdated(configs);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
+TEST_F(ProtocolHandlerImplTest, RegisterSecondaryTransport_SUCCESS) {
+ AddConnection();
+
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+
+ transport_manager::ConnectionUID primary_connection_id = 123;
+
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(primary_connection_id, _, _))
+ .WillRepeatedly(
+ DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
+
+ EXPECT_CALL(connection_handler_mock,
+ OnSecondaryTransportStarted(_, connection_id, session_id))
+ .WillOnce(DoAll(SetArgReferee<0>(primary_connection_id), Return(true)));
+
+ EXPECT_CALL(transport_manager_mock,
+ SendMessageToDevice(
+ ControlMessage(FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_ACK,
+ PROTECTION_OFF,
+ connection_id,
+ _)))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+ SendControlMessage(PROTECTION_OFF,
+ kControl,
+ session_id,
+ FRAME_DATA_REGISTER_SECONDARY_TRANSPORT,
+ PROTOCOL_VERSION_5);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
+TEST_F(ProtocolHandlerImplTest, RegisterSecondaryTransport_FAILURE) {
+ AddConnection();
+
+ TestAsyncWaiter waiter;
+ uint32_t times = 0;
+
+ transport_manager::ConnectionUID primary_connection_id = 123;
+
+ EXPECT_CALL(session_observer_mock,
+ ProtocolVersionUsed(primary_connection_id, _, _))
+ .WillRepeatedly(
+ DoAll(SetArgReferee<2>(PROTOCOL_VERSION_5), Return(true)));
+
+ // check the behavior when OnSecondaryTransportStarted() returns false
+ EXPECT_CALL(connection_handler_mock,
+ OnSecondaryTransportStarted(_, connection_id, session_id))
+ .WillOnce(DoAll(SetArgReferee<0>(primary_connection_id), Return(false)));
+
+ EXPECT_CALL(transport_manager_mock,
+ SendMessageToDevice(
+ ControlMessage(FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_NACK,
+ PROTECTION_OFF,
+ connection_id,
+ _)))
+ .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(E_SUCCESS)));
+ times++;
+
+ SendControlMessage(PROTECTION_OFF,
+ kControl,
+ session_id,
+ FRAME_DATA_REGISTER_SECONDARY_TRANSPORT,
+ PROTOCOL_VERSION_5);
+
+ EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout));
+}
+
TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification) {
const size_t period_msec = 10000;
const size_t max_messages = 1000;
InitProtocolHandlerImpl(period_msec, max_messages);
AddConnection();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1529,8 +3114,7 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_ThresholdValue) {
InitProtocolHandlerImpl(period_msec, max_messages);
AddConnection();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1566,8 +3150,7 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_VideoFrameSkip) {
InitProtocolHandlerImpl(period_msec, max_messages);
AddConnection();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1595,8 +3178,7 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_AudioFrameSkip) {
InitProtocolHandlerImpl(period_msec, max_messages);
AddConnection();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1624,8 +3206,7 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerificationDisable) {
InitProtocolHandlerImpl(period_msec, max_messages);
AddConnection();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1653,8 +3234,7 @@ TEST_F(ProtocolHandlerImplTest, MalformedVerificationDisable) {
InitProtocolHandlerImpl(0u, 0u, false, period_msec, max_messages);
AddConnection();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1686,8 +3266,7 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_MalformedLimitVerification) {
InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages);
AddConnection();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1734,8 +3313,7 @@ TEST_F(ProtocolHandlerImplTest,
InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages);
AddConnection();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1806,8 +3384,7 @@ TEST_F(ProtocolHandlerImplTest, MalformedLimitVerification_MalformedOnly) {
InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages);
AddConnection();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1867,8 +3444,7 @@ TEST_F(ProtocolHandlerImplTest, MalformedLimitVerification_NullTimePeriod) {
InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages);
AddConnection();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1901,8 +3477,7 @@ TEST_F(ProtocolHandlerImplTest, MalformedLimitVerification_NullCount) {
InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages);
AddConnection();
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1945,8 +3520,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest,
DISABLED_SendEndServicePrivate_EndSession_MessageSent) {
// Arrange
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1970,8 +3544,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest,
SendEndServicePrivate_ServiceTypeControl_MessageSent) {
// Arrange
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -1990,7 +3563,8 @@ TEST_F(ProtocolHandlerImplTest,
times++;
// Act
- protocol_handler_impl->SendEndService(connection_id, session_id, kControl);
+ protocol_handler_impl->SendEndService(
+ connection_id, connection_id, session_id, kControl);
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
@@ -2009,8 +3583,7 @@ TEST_F(ProtocolHandlerImplTest, SendHeartBeat_NoConnection_NotSent) {
TEST_F(ProtocolHandlerImplTest, SendHeartBeat_Successful) {
// Arrange
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -2035,8 +3608,7 @@ TEST_F(ProtocolHandlerImplTest, SendHeartBeat_Successful) {
TEST_F(ProtocolHandlerImplTest, SendHeartBeatAck_Successful) {
// Arrange
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -2065,8 +3637,7 @@ TEST_F(ProtocolHandlerImplTest, SendHeartBeatAck_Successful) {
TEST_F(ProtocolHandlerImplTest,
DISABLED_SendHeartBeatAck_WrongProtocolVersion_NotSent) {
// Arrange
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -2082,7 +3653,8 @@ TEST_F(ProtocolHandlerImplTest,
SendMessageToDevice(ExpectedMessage(FRAME_TYPE_CONTROL,
FRAME_DATA_HEART_BEAT_ACK,
PROTECTION_OFF,
- kControl))).Times(0);
+ kControl)))
+ .Times(0);
// Act
SendControlMessage(
PROTECTION_OFF, kControl, session_id, FRAME_DATA_HEART_BEAT);
@@ -2095,8 +3667,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest,
SendMessageToMobileApp_SendSingleControlMessage) {
// Arrange
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -2104,8 +3675,12 @@ TEST_F(ProtocolHandlerImplTest,
const bool is_final = true;
const uint32_t total_data_size = 1;
UCharDataVector data(total_data_size);
- RawMessagePtr message = utils::MakeShared<RawMessage>(
- connection_key, PROTOCOL_VERSION_3, &data[0], total_data_size, kControl);
+ RawMessagePtr message = std::make_shared<RawMessage>(connection_key,
+ PROTOCOL_VERSION_3,
+ &data[0],
+ total_data_size,
+ false,
+ kControl);
// Expect getting pair from key from session observer
EXPECT_CALL(session_observer_mock,
PairFromKey(message->connection_key(), _, _))
@@ -2126,7 +3701,7 @@ TEST_F(ProtocolHandlerImplTest,
times++;
// Act
- protocol_handler_impl->SendMessageToMobileApp(message, is_final);
+ protocol_handler_impl->SendMessageToMobileApp(message, false, is_final);
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
@@ -2134,8 +3709,7 @@ TEST_F(ProtocolHandlerImplTest,
TEST_F(ProtocolHandlerImplTest,
SendMessageToMobileApp_SendSingleNonControlMessage) {
// Arrange
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -2143,8 +3717,12 @@ TEST_F(ProtocolHandlerImplTest,
const bool is_final = true;
const uint32_t total_data_size = 1;
UCharDataVector data(total_data_size);
- RawMessagePtr message = utils::MakeShared<RawMessage>(
- connection_key, PROTOCOL_VERSION_3, &data[0], total_data_size, kRpc);
+ RawMessagePtr message = std::make_shared<RawMessage>(connection_key,
+ PROTOCOL_VERSION_3,
+ &data[0],
+ total_data_size,
+ false,
+ kRpc);
// Expect getting pair from key from session observer
EXPECT_CALL(session_observer_mock,
PairFromKey(message->connection_key(), _, _))
@@ -2170,15 +3748,14 @@ TEST_F(ProtocolHandlerImplTest,
times++;
// Act
- protocol_handler_impl->SendMessageToMobileApp(message, is_final);
+ protocol_handler_impl->SendMessageToMobileApp(message, false, is_final);
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest, SendMessageToMobileApp_SendMultiframeMessage) {
// Arrange
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -2187,8 +3764,12 @@ TEST_F(ProtocolHandlerImplTest, SendMessageToMobileApp_SendMultiframeMessage) {
const uint32_t total_data_size = MAXIMUM_FRAME_DATA_V2_SIZE * 2;
UCharDataVector data(total_data_size);
const uint8_t first_consecutive_frame = 0x01;
- RawMessagePtr message = utils::MakeShared<RawMessage>(
- connection_key, PROTOCOL_VERSION_3, &data[0], total_data_size, kBulk);
+ RawMessagePtr message = std::make_shared<RawMessage>(connection_key,
+ PROTOCOL_VERSION_3,
+ &data[0],
+ total_data_size,
+ false,
+ kBulk);
// Expect getting pair from key from session observer
EXPECT_CALL(session_observer_mock,
PairFromKey(message->connection_key(), _, _))
@@ -2226,14 +3807,13 @@ TEST_F(ProtocolHandlerImplTest, SendMessageToMobileApp_SendMultiframeMessage) {
times++;
// Act
- protocol_handler_impl->SendMessageToMobileApp(message, is_final);
+ protocol_handler_impl->SendMessageToMobileApp(message, false, is_final);
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_PreVersion5) {
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -2259,8 +3839,7 @@ TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_PreVersion5) {
}
TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_AfterVersion5) {
- ::utils::SharedPtr<TestAsyncWaiter> waiter =
- utils::MakeShared<TestAsyncWaiter>();
+ std::shared_ptr<TestAsyncWaiter> waiter = std::make_shared<TestAsyncWaiter>();
uint32_t times = 0;
AddSession(waiter, times);
@@ -2277,7 +3856,8 @@ TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_AfterVersion5) {
SendMessageToDevice(ExpectedMessage(FRAME_TYPE_CONTROL,
FRAME_DATA_SERVICE_DATA_ACK,
PROTECTION_OFF,
- kMobileNav))).Times(0);
+ kMobileNav)))
+ .Times(0);
protocol_handler_impl->SendFramesNumber(connection_key, 0);
diff --git a/src/components/protocol_handler/test/protocol_header_validator_test.cc b/src/components/protocol_handler/test/protocol_header_validator_test.cc
index e42ba96251..ee48d2eb3d 100644
--- a/src/components/protocol_handler/test/protocol_header_validator_test.cc
+++ b/src/components/protocol_handler/test/protocol_header_validator_test.cc
@@ -31,11 +31,11 @@
*/
#include <gtest/gtest.h>
-#include <vector>
#include <list>
+#include <vector>
-#include "utils/macro.h"
#include "protocol_handler/protocol_packet.h"
+#include "utils/macro.h"
namespace {
const size_t MAXIMUM_FRAME_DATA_V3_SIZE = 131072;
@@ -230,12 +230,12 @@ TEST_F(ProtocolHeaderValidatorTest, Malformed_FrameType) {
}
}
-// For Control frames Frame info value shall be from 0x00 to 0x06 or 0xFE(Data
-// Ack), 0xFF(HB Ack)
+// For Control frames Frame info value shall be from 0x00 to 0x09 or 0xFD
+// (Transport Update Event), 0xFE(Data Ack), 0xFF(HB Ack)
TEST_F(ProtocolHeaderValidatorTest, Malformed_ControlFrame) {
std::vector<uint8_t> malformed_frame_data;
- for (uint8_t frame_type = FRAME_DATA_END_SERVICE_NACK + 1;
- frame_type < FRAME_DATA_SERVICE_DATA_ACK;
+ for (uint8_t frame_type = FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_NACK + 1;
+ frame_type < FRAME_DATA_TRANSPORT_EVENT_UPDATE;
++frame_type) {
malformed_frame_data.push_back(frame_type);
}
@@ -491,8 +491,10 @@ TEST_F(ProtocolHeaderValidatorTest, Malformed_MessageID) {
message_header.frameType = FRAME_TYPE_FIRST;
message_header.version = PROTOCOL_VERSION_1;
+ message_header.dataSize = FIRST_FRAME_DATA_SIZE;
EXPECT_EQ(RESULT_OK, header_validator.validate(message_header));
+ message_header.dataSize = 0u;
message_header.version = PROTOCOL_VERSION_2;
EXPECT_EQ(RESULT_FAIL, header_validator.validate(message_header));
message_header.version = PROTOCOL_VERSION_3;
diff --git a/src/components/protocol_handler/test/protocol_packet_test.cc b/src/components/protocol_handler/test/protocol_packet_test.cc
index 71c7726243..e4ea4be61f 100644
--- a/src/components/protocol_handler/test/protocol_packet_test.cc
+++ b/src/components/protocol_handler/test/protocol_packet_test.cc
@@ -30,42 +30,42 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include <vector>
+#include "gtest/gtest.h"
-#include "utils/macro.h"
-#include "protocol_handler/protocol_packet.h"
#include "protocol/common.h"
+#include "protocol_handler/protocol_packet.h"
+#include "utils/macro.h"
namespace test {
namespace components {
namespace protocol_handler_test {
-using protocol_handler::RawMessagePtr;
-using protocol_handler::ProtocolPacket;
using protocol_handler::ConnectionID;
-using protocol_handler::FRAME_TYPE_MAX_VALUE;
using protocol_handler::FRAME_DATA_FIRST;
-using protocol_handler::FRAME_TYPE_FIRST;
-using protocol_handler::PROTOCOL_VERSION_1;
-using protocol_handler::PROTOCOL_VERSION_3;
-using protocol_handler::PROTECTION_OFF;
-using protocol_handler::RESULT_CODE;
-using protocol_handler::RESULT_OK;
-using protocol_handler::RESULT_FAIL;
+using protocol_handler::FRAME_DATA_HEART_BEAT;
+using protocol_handler::FRAME_DATA_LAST_CONSECUTIVE;
+using protocol_handler::FRAME_DATA_START_SERVICE_ACK;
using protocol_handler::FRAME_TYPE_CONTROL;
-using protocol_handler::kControl;
-using protocol_handler::kRpc;
+using protocol_handler::FRAME_TYPE_FIRST;
+using protocol_handler::FRAME_TYPE_MAX_VALUE;
using protocol_handler::kAudio;
-using protocol_handler::kMobileNav;
using protocol_handler::kBulk;
+using protocol_handler::kControl;
using protocol_handler::kInvalidServiceType;
-using protocol_handler::FRAME_DATA_HEART_BEAT;
-using protocol_handler::FRAME_DATA_START_SERVICE_ACK;
-using protocol_handler::FRAME_DATA_LAST_CONSECUTIVE;
+using protocol_handler::kMobileNav;
+using protocol_handler::kRpc;
+using protocol_handler::PROTECTION_OFF;
using protocol_handler::PROTOCOL_HEADER_V1_SIZE;
using protocol_handler::PROTOCOL_HEADER_V2_SIZE;
+using protocol_handler::PROTOCOL_VERSION_1;
+using protocol_handler::PROTOCOL_VERSION_3;
using protocol_handler::PROTOCOL_VERSION_MAX;
+using protocol_handler::ProtocolPacket;
+using protocol_handler::RawMessagePtr;
+using protocol_handler::RESULT_CODE;
+using protocol_handler::RESULT_FAIL;
+using protocol_handler::RESULT_OK;
class ProtocolPacketTest : public ::testing::Test {
protected:
diff --git a/src/components/protocol_handler/test/protocol_payload_test.cc b/src/components/protocol_handler/test/protocol_payload_test.cc
index e56f8aadff..e89e6c7395 100644
--- a/src/components/protocol_handler/test/protocol_payload_test.cc
+++ b/src/components/protocol_handler/test/protocol_payload_test.cc
@@ -33,10 +33,10 @@
#include <gtest/gtest.h>
#include <vector>
-#include "utils/macro.h"
-#include "utils/bitstream.h"
-#include "protocol_handler/protocol_payload.h"
#include "protocol/common.h"
+#include "protocol_handler/protocol_payload.h"
+#include "utils/bitstream.h"
+#include "utils/macro.h"
namespace test {
namespace components {
diff --git a/src/components/protocol_handler/test/service_status_update_handler_test.cc b/src/components/protocol_handler/test/service_status_update_handler_test.cc
new file mode 100644
index 0000000000..7d4516a7ff
--- /dev/null
+++ b/src/components/protocol_handler/test/service_status_update_handler_test.cc
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "protocol_handler/service_status_update_handler.h"
+#include "gtest/gtest.h"
+#include "protocol_handler/mock_service_status_update_handler_listener.h"
+
+namespace test {
+namespace components {
+namespace protocol_handler_test {
+
+namespace {
+const uint32_t kConnectionKey = 123u;
+}
+
+using namespace protocol_handler;
+using ::testing::_;
+using ::testing::Return;
+using namespace hmi_apis;
+typedef utils::Optional<Common_ServiceStatusUpdateReason::eType>
+ UpdateReasonOptional;
+typedef std::shared_ptr<ServiceStatusUpdateHandler>
+ ServiceStatusUpdateHandlerPtr;
+typedef std::shared_ptr<MockServiceStatusUpdateHandlerListener>
+ MockServiceStatusUpdateHandlerListenerPtr;
+
+struct ServiceUpdate {
+ ServiceType service_type_;
+ ServiceStatus service_status_;
+ ServiceUpdate(ServiceType type, ServiceStatus status)
+ : service_type_(type), service_status_(status) {}
+};
+
+class ServiceStatusUpdateHandlerTest
+ : public ::testing::TestWithParam<ServiceUpdate> {
+ public:
+ ServiceStatusUpdateHandlerTest() {
+ mock_service_status_update_handler_listener_.reset(
+ new MockServiceStatusUpdateHandlerListener);
+ service_status_update_handler_ =
+ std::make_shared<ServiceStatusUpdateHandler>(
+ &(*mock_service_status_update_handler_listener_));
+ }
+
+ Common_ServiceEvent::eType GetServiceEvent(ServiceStatus status) {
+ switch (status) {
+ case ServiceStatus::SERVICE_ACCEPTED:
+ case ServiceStatus::PROTECTION_DISABLED: {
+ return Common_ServiceEvent::REQUEST_ACCEPTED;
+ }
+ case ServiceStatus::SERVICE_RECEIVED: {
+ return Common_ServiceEvent::REQUEST_RECEIVED;
+ }
+ case ServiceStatus::SERVICE_START_FAILED:
+ case ServiceStatus::PTU_FAILED:
+ case ServiceStatus::CERT_INVALID:
+ case ServiceStatus::INVALID_TIME:
+ case ServiceStatus::PROTECTION_ENFORCED: {
+ return Common_ServiceEvent::REQUEST_REJECTED;
+ }
+ default: { return Common_ServiceEvent::INVALID_ENUM; }
+ }
+ }
+
+ UpdateReasonOptional GetUpdateReason(ServiceStatus status) {
+ switch (status) {
+ case ServiceStatus::SERVICE_START_FAILED:
+ case ServiceStatus::SERVICE_ACCEPTED:
+ case ServiceStatus::SERVICE_RECEIVED: {
+ return UpdateReasonOptional::EMPTY;
+ }
+ case ServiceStatus::PTU_FAILED: {
+ auto reason = Common_ServiceStatusUpdateReason::PTU_FAILED;
+ return reason;
+ }
+ case ServiceStatus::CERT_INVALID: {
+ auto reason = Common_ServiceStatusUpdateReason::INVALID_CERT;
+ return reason;
+ }
+ case ServiceStatus::INVALID_TIME: {
+ auto reason = Common_ServiceStatusUpdateReason::INVALID_TIME;
+ return reason;
+ }
+ case ServiceStatus::PROTECTION_ENFORCED: {
+ auto reason = Common_ServiceStatusUpdateReason::PROTECTION_ENFORCED;
+ return reason;
+ }
+ case ServiceStatus::PROTECTION_DISABLED: {
+ auto reason = Common_ServiceStatusUpdateReason::PROTECTION_DISABLED;
+ return reason;
+ }
+ default: {
+ auto reason = Common_ServiceStatusUpdateReason::INVALID_ENUM;
+ return reason;
+ }
+ }
+ }
+
+ public:
+ MockServiceStatusUpdateHandlerListenerPtr
+ mock_service_status_update_handler_listener_;
+ ServiceStatusUpdateHandlerPtr service_status_update_handler_;
+};
+
+INSTANTIATE_TEST_CASE_P(
+ OnServiceUpdate_SERVICE_ACCEPTED,
+ ServiceStatusUpdateHandlerTest,
+ ::testing::Values(
+ ServiceUpdate(ServiceType::kAudio, ServiceStatus::SERVICE_ACCEPTED),
+ ServiceUpdate(ServiceType::kMobileNav, ServiceStatus::SERVICE_ACCEPTED),
+ ServiceUpdate(ServiceType::kRpc, ServiceStatus::SERVICE_ACCEPTED)));
+
+INSTANTIATE_TEST_CASE_P(
+ OnServiceUpdate_SERVICE_RECEIVED,
+ ServiceStatusUpdateHandlerTest,
+ ::testing::Values(
+ ServiceUpdate(ServiceType::kAudio, ServiceStatus::SERVICE_RECEIVED),
+ ServiceUpdate(ServiceType::kMobileNav, ServiceStatus::SERVICE_RECEIVED),
+ ServiceUpdate(ServiceType::kRpc, ServiceStatus::SERVICE_RECEIVED)));
+
+INSTANTIATE_TEST_CASE_P(
+ OnServiceUpdate_SERVICE_START_FAILED,
+ ServiceStatusUpdateHandlerTest,
+ ::testing::Values(
+ ServiceUpdate(ServiceType::kAudio, ServiceStatus::SERVICE_START_FAILED),
+ ServiceUpdate(ServiceType::kMobileNav,
+ ServiceStatus::SERVICE_START_FAILED),
+ ServiceUpdate(ServiceType::kRpc, ServiceStatus::SERVICE_START_FAILED)));
+
+INSTANTIATE_TEST_CASE_P(
+ OnServiceUpdate_CERT_INVALID,
+ ServiceStatusUpdateHandlerTest,
+ ::testing::Values(
+ ServiceUpdate(ServiceType::kAudio, ServiceStatus::CERT_INVALID),
+ ServiceUpdate(ServiceType::kMobileNav, ServiceStatus::CERT_INVALID),
+ ServiceUpdate(ServiceType::kRpc, ServiceStatus::CERT_INVALID)));
+
+INSTANTIATE_TEST_CASE_P(
+ OnServiceUpdate_INVALID_TIME,
+ ServiceStatusUpdateHandlerTest,
+ ::testing::Values(
+ ServiceUpdate(ServiceType::kAudio, ServiceStatus::INVALID_TIME),
+ ServiceUpdate(ServiceType::kMobileNav, ServiceStatus::INVALID_TIME),
+ ServiceUpdate(ServiceType::kRpc, ServiceStatus::INVALID_TIME)));
+
+INSTANTIATE_TEST_CASE_P(
+ OnServiceUpdate_PTU_FAILED,
+ ServiceStatusUpdateHandlerTest,
+ ::testing::Values(
+ ServiceUpdate(ServiceType::kAudio, ServiceStatus::PTU_FAILED),
+ ServiceUpdate(ServiceType::kMobileNav, ServiceStatus::PTU_FAILED),
+ ServiceUpdate(ServiceType::kRpc, ServiceStatus::PTU_FAILED)));
+
+INSTANTIATE_TEST_CASE_P(
+ OnServiceUpdate_PROTECTION_ENFRORCED,
+ ServiceStatusUpdateHandlerTest,
+ ::testing::Values(
+ ServiceUpdate(ServiceType::kAudio, ServiceStatus::PROTECTION_ENFORCED),
+ ServiceUpdate(ServiceType::kMobileNav,
+ ServiceStatus::PROTECTION_ENFORCED),
+ ServiceUpdate(ServiceType::kRpc, ServiceStatus::PROTECTION_ENFORCED)));
+
+INSTANTIATE_TEST_CASE_P(
+ OnServiceUpdate_PROTECTION_DISABLED,
+ ServiceStatusUpdateHandlerTest,
+ ::testing::Values(
+ ServiceUpdate(ServiceType::kAudio, ServiceStatus::PROTECTION_DISABLED),
+ ServiceUpdate(ServiceType::kMobileNav,
+ ServiceStatus::PROTECTION_DISABLED),
+ ServiceUpdate(ServiceType::kRpc, ServiceStatus::PROTECTION_DISABLED)));
+
+TEST_P(ServiceStatusUpdateHandlerTest, OnServiceUpdate) {
+ auto service_event_ = GetServiceEvent(GetParam().service_status_);
+ auto reason_ = GetUpdateReason(GetParam().service_status_);
+
+ EXPECT_CALL(
+ *mock_service_status_update_handler_listener_,
+ ProcessServiceStatusUpdate(kConnectionKey, _, service_event_, reason_))
+ .Times(1);
+
+ service_status_update_handler_->OnServiceUpdate(
+ kConnectionKey, GetParam().service_type_, GetParam().service_status_);
+}
+
+TEST_F(ServiceStatusUpdateHandlerTest, GetHMIServiceType) {
+ EXPECT_EQ(Common_ServiceType::RPC, GetHMIServiceType(ServiceType::kRpc));
+ EXPECT_EQ(Common_ServiceType::AUDIO, GetHMIServiceType(ServiceType::kAudio));
+ EXPECT_EQ(Common_ServiceType::VIDEO,
+ GetHMIServiceType(ServiceType::kMobileNav));
+ EXPECT_EQ(Common_ServiceType::INVALID_ENUM,
+ GetHMIServiceType(ServiceType::kInvalidServiceType));
+}
+
+} // namespace protocol_handler_test
+} // namespace components
+} // namespace test
diff --git a/src/components/resumption/CMakeLists.txt b/src/components/resumption/CMakeLists.txt
index a2c93b0689..73e7b88a74 100644
--- a/src/components/resumption/CMakeLists.txt
+++ b/src/components/resumption/CMakeLists.txt
@@ -36,6 +36,7 @@ include_directories (
${COMPONENTS_DIR}/config_profile/include/
${JSONCPP_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
diff --git a/src/components/resumption/include/resumption/last_state_impl.h b/src/components/resumption/include/resumption/last_state_impl.h
index 2da3147930..5eb4050d2d 100644
--- a/src/components/resumption/include/resumption/last_state_impl.h
+++ b/src/components/resumption/include/resumption/last_state_impl.h
@@ -33,7 +33,10 @@
#ifndef SRC_COMPONENTS_RESUMPTION_INCLUDE_RESUMPTION_LAST_STATE_IMPL_H_
#define SRC_COMPONENTS_RESUMPTION_INCLUDE_RESUMPTION_LAST_STATE_IMPL_H_
+#include <string>
+
#include "resumption/last_state.h"
+#include "utils/lock.h"
#include "utils/macro.h"
namespace resumption {
@@ -49,31 +52,53 @@ class LastStateImpl : public LastState {
*/
LastStateImpl(const std::string& app_storage_folder,
const std::string& app_info_storage);
-
/**
* @brief Destructor
*/
~LastStateImpl();
+ DEPRECATED
+ void SaveStateToFileSystem();
+
/**
* @brief Saving dictionary to filesystem
*/
- void SaveStateToFileSystem() OVERRIDE;
+ void SaveToFileSystem() OVERRIDE;
/**
- * @brief Get reference to dictionary
+ * @brief Remove dictionary from filesystem
*/
- Json::Value& get_dictionary() OVERRIDE;
+ void RemoveFromFileSystem() OVERRIDE;
- private:
- const std::string app_storage_folder_;
- const std::string app_info_storage_;
- Json::Value dictionary_;
+ /**
+ * @brief Get the dictionary
+ * @return A copy of the dictionary instance
+ */
+ Json::Value dictionary() const OVERRIDE;
/**
+ * @brief Get the dictionary
+ * @return Reference to the dictionary
+ */
+ DEPRECATED Json::Value& get_dictionary();
+
+ /**
+ * @brief Resets internal dictionary
+ * @param dictionary New dictionary json value to be set
+ */
+ void set_dictionary(const Json::Value& dictionary) OVERRIDE;
+
+ private:
+ /**
* @brief Load dictionary from filesystem
*/
- void LoadStateFromFileSystem();
+ void LoadFromFileSystem();
+
+ Json::Value dictionary_;
+ mutable sync_primitives::Lock dictionary_lock_;
+
+ std::string app_storage_folder_;
+ std::string app_info_storage_;
DISALLOW_COPY_AND_ASSIGN(LastStateImpl);
};
diff --git a/src/components/resumption/include/resumption/last_state.h b/src/components/resumption/include/resumption/last_state_wrapper_impl.h
index 3481fc9327..52ba8a4d2b 100644
--- a/src/components/resumption/include/resumption/last_state.h
+++ b/src/components/resumption/include/resumption/last_state_wrapper_impl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,33 +30,32 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_RESUMPTION_INCLUDE_RESUMPTION_LAST_STATE_H_
-#define SRC_COMPONENTS_RESUMPTION_INCLUDE_RESUMPTION_LAST_STATE_H_
+#ifndef SRC_COMPONENTS_RESUMPTION_INCLUDE_RESUMPTION_LAST_STATE_WRAPPER_IMPL_H_
+#define SRC_COMPONENTS_RESUMPTION_INCLUDE_RESUMPTION_LAST_STATE_WRAPPER_IMPL_H_
-#include <string>
+#include <memory>
-#include "json/json.h"
+#include "resumption/last_state_wrapper.h"
+#include "utils/lock.h"
+#include "utils/macro.h"
+#include "utils/mutable_data_accessor.h"
namespace resumption {
-class LastState {
+class LastStateWrapperImpl : public LastStateWrapper {
public:
/**
- * @brief Destructor
+ * @brief Constructor
*/
- virtual ~LastState() {}
+ explicit LastStateWrapperImpl(std::shared_ptr<LastState> last_state);
- /**
- * @brief Saving dictionary to filesystem
- */
- virtual void SaveStateToFileSystem() = 0;
+ LastStateAccessor get_accessor() const OVERRIDE;
- /**
- * @brief Get reference to dictionary
- */
- virtual Json::Value& get_dictionary() = 0;
+ private:
+ std::shared_ptr<LastState> last_state_;
+ mutable std::shared_ptr<sync_primitives::Lock> lock_;
};
} // namespace resumption
-#endif // SRC_COMPONENTS_RESUMPTION_INCLUDE_RESUMPTION_LAST_STATE_H_
+#endif // SRC_COMPONENTS_RESUMPTION_INCLUDE_RESUMPTION_LAST_STATE_WRAPPER_IMPL_H_
diff --git a/src/components/resumption/src/last_state_impl.cc b/src/components/resumption/src/last_state_impl.cc
index 4d3fd1526c..05c801d762 100644
--- a/src/components/resumption/src/last_state_impl.cc
+++ b/src/components/resumption/src/last_state_impl.cc
@@ -32,6 +32,7 @@
#include "resumption/last_state_impl.h"
#include "utils/file_system.h"
+#include "utils/jsoncpp_reader_wrapper.h"
#include "utils/logger.h"
namespace resumption {
@@ -42,35 +43,57 @@ LastStateImpl::LastStateImpl(const std::string& app_storage_folder,
const std::string& app_info_storage)
: app_storage_folder_(app_storage_folder)
, app_info_storage_(app_info_storage) {
- LoadStateFromFileSystem();
+ LoadFromFileSystem();
LOG4CXX_AUTO_TRACE(logger_);
}
LastStateImpl::~LastStateImpl() {
LOG4CXX_AUTO_TRACE(logger_);
- SaveStateToFileSystem();
+ SaveToFileSystem();
}
void LastStateImpl::SaveStateToFileSystem() {
LOG4CXX_AUTO_TRACE(logger_);
- const std::string& str = dictionary_.toStyledString();
- const std::vector<uint8_t> char_vector_pdata(str.begin(), str.end());
+ std::string styled_string;
+ {
+ sync_primitives::AutoLock lock(dictionary_lock_);
+ styled_string = dictionary_.toStyledString();
+ }
+
+ const std::vector<uint8_t> char_vector_pdata(styled_string.begin(),
+ styled_string.end());
DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_));
LOG4CXX_INFO(logger_,
- "LastState::SaveStateToFileSystem " << app_info_storage_ << str);
+ "LastState::SaveStateToFileSystem[DEPRECATED] "
+ << app_info_storage_ << styled_string);
DCHECK(file_system::Write(app_info_storage_, char_vector_pdata));
}
-Json::Value& LastStateImpl::get_dictionary() {
- return dictionary_;
+void LastStateImpl::SaveToFileSystem() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string styled_string;
+ {
+ sync_primitives::AutoLock lock(dictionary_lock_);
+ styled_string = dictionary_.toStyledString();
+ }
+
+ const std::vector<uint8_t> char_vector_pdata(styled_string.begin(),
+ styled_string.end());
+ DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_));
+ LOG4CXX_INFO(
+ logger_,
+ "LastState::SaveToFileSystem " << app_info_storage_ << styled_string);
+ DCHECK(file_system::Write(app_info_storage_, char_vector_pdata));
}
-void LastStateImpl::LoadStateFromFileSystem() {
+void LastStateImpl::LoadFromFileSystem() {
std::string buffer;
- bool result = file_system::ReadFile(app_info_storage_, buffer);
- Json::Reader m_reader;
- if (result && m_reader.parse(buffer, dictionary_)) {
+ const bool result = file_system::ReadFile(app_info_storage_, buffer);
+ utils::JsonReader reader;
+
+ if (result && reader.parse(buffer, &dictionary_)) {
LOG4CXX_INFO(logger_,
"Valid last state was found." << dictionary_.toStyledString());
return;
@@ -78,4 +101,28 @@ void LastStateImpl::LoadStateFromFileSystem() {
LOG4CXX_WARN(logger_, "No valid last state was found.");
}
-} // resumption
+void LastStateImpl::RemoveFromFileSystem() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!file_system::DeleteFile(app_info_storage_)) {
+ LOG4CXX_WARN(logger_, "Failed attempt to delete " << app_info_storage_);
+ }
+}
+
+Json::Value LastStateImpl::dictionary() const {
+ sync_primitives::AutoLock lock(dictionary_lock_);
+ return dictionary_;
+}
+
+Json::Value& LastStateImpl::get_dictionary() {
+ sync_primitives::AutoLock lock(dictionary_lock_);
+ return dictionary_;
+}
+
+void LastStateImpl::set_dictionary(const Json::Value& dictionary) {
+ DCHECK(dictionary.type() == Json::objectValue ||
+ dictionary.type() == Json::nullValue);
+ sync_primitives::AutoLock lock(dictionary_lock_);
+ dictionary_ = dictionary;
+}
+
+} // namespace resumption
diff --git a/src/components/resumption/src/last_state_wrapper_impl.cc b/src/components/resumption/src/last_state_wrapper_impl.cc
new file mode 100644
index 0000000000..61b325f53b
--- /dev/null
+++ b/src/components/resumption/src/last_state_wrapper_impl.cc
@@ -0,0 +1,49 @@
+/* Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "resumption/last_state_wrapper_impl.h"
+#include "utils/logger.h"
+
+namespace resumption {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+
+LastStateWrapperImpl::LastStateWrapperImpl(
+ std::shared_ptr<LastState> last_state)
+ : last_state_(last_state)
+ , lock_(std::make_shared<sync_primitives::Lock>()) {}
+
+LastStateAccessor LastStateWrapperImpl::get_accessor() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return MutableDataAccessor<LastState>(*last_state_, lock_);
+}
+
+} // namespace resumption
diff --git a/src/components/resumption/test/last_state_test.cc b/src/components/resumption/test/last_state_test.cc
index 15180fa12c..61c227bbf3 100644
--- a/src/components/resumption/test/last_state_test.cc
+++ b/src/components/resumption/test/last_state_test.cc
@@ -73,13 +73,13 @@ class LastStateTest : public ::testing::Test {
};
TEST_F(LastStateTest, Basic) {
- const Value& dictionary = last_state_.get_dictionary();
+ const Value& dictionary = last_state_.dictionary();
EXPECT_EQ(empty_dictionary_, dictionary.toStyledString());
}
TEST_F(LastStateTest, SetGetData) {
{
- Value& dictionary = last_state_.get_dictionary();
+ Value dictionary = last_state_.dictionary();
const Value& bluetooth_info =
dictionary["TransportManager"]["BluetoothAdapter"];
EXPECT_EQ(empty_dictionary_, bluetooth_info.toStyledString());
@@ -102,18 +102,19 @@ TEST_F(LastStateTest, SetGetData) {
dictionary["TransportManager"]["BluetoothAdapter"]["devices"] =
"bluetooth_device";
- last_state_.SaveStateToFileSystem();
+ last_state_.set_dictionary(dictionary);
+ last_state_.SaveToFileSystem();
}
- const Value& dictionary = last_state_.get_dictionary();
+ const Value dictionary = last_state_.dictionary();
const Value& bluetooth_info =
dictionary["TransportManager"]["BluetoothAdapter"];
const Value& tcp_adapter_info = dictionary["TransportManager"]["TcpAdapter"];
- EXPECT_EQ("{\n \"devices\" : \"bluetooth_device\"\n}\n",
+ EXPECT_EQ("{\n\t\"devices\" : \"bluetooth_device\"\n}\n",
bluetooth_info.toStyledString());
EXPECT_EQ(
- "{\n \"devices\" : {\n \"name\" : \"test_device\"\n }\n}\n",
+ "{\n\t\"devices\" : \n\t{\n\t\t\"name\" : \"test_device\"\n\t}\n}\n",
tcp_adapter_info.toStyledString());
}
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base.h b/src/components/rpc_base/include/rpc_base/rpc_base.h
index 6792f47732..6e06d61a7c 100644
--- a/src/components/rpc_base/include/rpc_base/rpc_base.h
+++ b/src/components/rpc_base/include/rpc_base/rpc_base.h
@@ -42,11 +42,6 @@ namespace Json {
class Value;
} // namespace Json
-namespace dbus {
-class MessageReader;
-class MessageWriter;
-} // namespace dbus
-
namespace rpc {
class ValidationReport;
@@ -62,7 +57,7 @@ const std::string omitted_validation_info = "should be omitted in ";
const std::string required_validation_info = "is required in ";
std::string PolicyTableTypeToString(const PolicyTableType pt_type);
-}
+} // namespace policy_table_interface_base
template <typename T>
class Range;
@@ -173,12 +168,11 @@ class Boolean : public PrimitiveType {
Boolean();
explicit Boolean(bool value);
explicit Boolean(const Json::Value* value);
- explicit Boolean(dbus::MessageReader* reader);
Boolean(const Json::Value* value, bool def_value);
Boolean& operator=(bool new_val);
operator bool() const;
Json::Value ToJsonValue() const;
- void ToDbusWriter(dbus::MessageWriter* writer) const;
+ bool operator==(const Boolean& that);
private:
// Fields
@@ -197,7 +191,6 @@ class Integer : public PrimitiveType {
explicit Integer(IntType value);
Integer(const Integer& value);
explicit Integer(const Json::Value* value);
- explicit Integer(dbus::MessageReader* reader);
Integer(const Json::Value* value, IntType def_value);
Integer& operator=(IntType new_val);
Integer& operator=(const Integer& new_val);
@@ -205,7 +198,6 @@ class Integer : public PrimitiveType {
Integer& operator+=(int value);
operator IntType() const;
Json::Value ToJsonValue() const;
- void ToDbusWriter(dbus::MessageWriter* writer) const;
private:
IntType value_;
@@ -219,12 +211,10 @@ class Float : public PrimitiveType {
Float();
explicit Float(double value);
explicit Float(const Json::Value* value);
- explicit Float(dbus::MessageReader* reader);
Float(const Json::Value* value, double def_value);
Float& operator=(double new_val);
operator double() const;
Json::Value ToJsonValue() const;
- void ToDbusWriter(dbus::MessageWriter* writer) const;
private:
double value_;
@@ -239,15 +229,16 @@ class String : public PrimitiveType {
explicit String(const std::string& value);
explicit String(const char* value);
explicit String(const Json::Value* value);
- explicit String(dbus::MessageReader* reader);
String(const Json::Value* value, const std::string& def_value);
bool operator<(const String& new_val) const;
String& operator=(const std::string& new_val);
String& operator=(const String& new_val);
bool operator==(const String& rhs) const;
+ bool operator==(const std::string& rhs) const;
+ bool operator!=(const String& rhs) const;
+ bool operator!=(const std::string& rhs) const;
operator const std::string&() const;
Json::Value ToJsonValue() const;
- void ToDbusWriter(dbus::MessageWriter* writer) const;
private:
std::string value_;
@@ -265,12 +256,10 @@ class Enum : public PrimitiveType {
Enum();
explicit Enum(EnumType value);
explicit Enum(const Json::Value* value);
- explicit Enum(dbus::MessageReader* reader);
Enum(const Json::Value* value, EnumType def_value);
Enum& operator=(const EnumType& new_val);
operator EnumType() const;
Json::Value ToJsonValue() const;
- void ToDbusWriter(dbus::MessageWriter* writer) const;
private:
// Fields
@@ -289,7 +278,6 @@ class Array : public std::vector<T>, public CompositeType {
// Need const and non-const versions to beat all-type accepting constructor
explicit Array(Json::Value* value);
explicit Array(const Json::Value* value);
- explicit Array(dbus::MessageReader* reader);
template <typename U>
explicit Array(const U& value);
template <typename U>
@@ -298,7 +286,7 @@ class Array : public std::vector<T>, public CompositeType {
template <typename U>
void push_back(const U& value);
Json::Value ToJsonValue() const;
- void ToDbusWriter(dbus::MessageWriter* writer) const;
+ bool operator==(const Array& that);
virtual bool is_valid() const;
bool is_initialized() const;
@@ -320,7 +308,6 @@ class Map : public std::map<std::string, T>, public CompositeType {
// Need const and non-const versions to beat all-type accepting constructor
explicit Map(Json::Value* value);
explicit Map(const Json::Value* value);
- explicit Map(dbus::MessageReader* reader);
template <typename U>
explicit Map(const U& value);
template <typename U>
@@ -329,7 +316,6 @@ class Map : public std::map<std::string, T>, public CompositeType {
template <typename U>
void insert(const std::pair<std::string, U>& value);
Json::Value ToJsonValue() const;
- void ToDbusWriter(dbus::MessageWriter* writer) const;
bool is_valid() const;
bool is_initialized() const;
@@ -343,7 +329,6 @@ class Nullable : public T {
public:
// Methods
Nullable();
- explicit Nullable(dbus::MessageReader* reader);
// Need const and non-const versions to beat all-type accepting constructor
explicit Nullable(Json::Value* value);
explicit Nullable(const Json::Value* value);
@@ -370,7 +355,6 @@ class Stringifyable : public T {
public:
// Methods
Stringifyable();
- explicit Stringifyable(dbus::MessageReader* reader);
// Need const and non-const versions to beat all-type accepting constructor
explicit Stringifyable(Json::Value* value);
explicit Stringifyable(const Json::Value* value);
@@ -398,15 +382,12 @@ class Optional {
public:
// Methods
Optional();
- explicit Optional(dbus::MessageReader* reader);
template <typename U>
explicit Optional(const U& value);
template <typename U>
Optional(const Json::Value* value, const U& def_value);
Json::Value ToJsonValue() const;
- void ToDbusWriter(dbus::MessageWriter* writer) const;
-
// Pointer semantics
T& operator*();
const T& operator*() const;
@@ -419,6 +400,8 @@ class Optional {
// casted to integral types
operator const void*() const;
+ bool operator==(const Optional<T>& that);
+
bool is_valid() const;
bool is_initialized() const;
void ReportErrors(ValidationReport* report) const;
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base_dbus_inl.h b/src/components/rpc_base/include/rpc_base/rpc_base_dbus_inl.h
deleted file mode 100644
index aae1a34ac2..0000000000
--- a/src/components/rpc_base/include/rpc_base/rpc_base_dbus_inl.h
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_RPC_BASE_INCLUDE_RPC_BASE_RPC_BASE_DBUS_INL_H_
-#define SRC_COMPONENTS_RPC_BASE_INCLUDE_RPC_BASE_RPC_BASE_DBUS_INL_H_
-
-#include "dbus/dbus_message.h"
-#include "json/value.h"
-#include "rpc_base/rpc_base.h"
-
-namespace rpc {
-
-// static
-inline PrimitiveType::ValueState PrimitiveType::InitHelper(bool is_next) {
- return is_next ? kValid : kInvalid;
-}
-
-// static
-inline CompositeType::InitializationState CompositeType::InitHelper(
- bool is_next) {
- return is_next ? kInitialized : kUninitialized;
-}
-
-namespace impl {
-
-// Helper functions to statically map int types to appropriate
-// MessageReader functions
-
-// Non-specialized versions doesn't have implementation
-
-// Tells if next element of reader is of type T
-template <typename T>
-inline bool NextIs(const dbus::MessageReader& reader);
-// Takes next element of type T from reader
-template <typename T>
-inline T Take(dbus::MessageReader* reader);
-
-template <>
-inline bool NextIs<int8_t>(const dbus::MessageReader& reader) {
- return reader.NextIsByte();
-}
-
-template <>
-inline int8_t Take<int8_t>(dbus::MessageReader* reader) {
- return static_cast<int8_t>(reader->TakeByte());
-}
-
-inline void Put(int8_t val, dbus::MessageWriter* writer) {
- writer->PutByte(static_cast<uint8_t>(val));
-}
-
-template <>
-inline bool NextIs<uint8_t>(const dbus::MessageReader& reader) {
- return reader.NextIsByte();
-}
-
-template <>
-inline uint8_t Take<uint8_t>(dbus::MessageReader* reader) {
- return reader->TakeByte();
-}
-
-inline void Put(uint8_t val, dbus::MessageWriter* writer) {
- writer->PutByte(val);
-}
-
-template <>
-inline bool NextIs<int16_t>(const dbus::MessageReader& reader) {
- return reader.NextIsInt16();
-}
-
-template <>
-inline int16_t Take<int16_t>(dbus::MessageReader* reader) {
- return reader->TakeInt16();
-}
-
-inline void Put(int16_t val, dbus::MessageWriter* writer) {
- writer->PutInt16(val);
-}
-
-template <>
-inline bool NextIs<uint16_t>(const dbus::MessageReader& reader) {
- return reader.NextIsUint16();
-}
-
-template <>
-inline uint16_t Take<uint16_t>(dbus::MessageReader* reader) {
- return reader->TakeUint16();
-}
-
-inline void Put(uint16_t val, dbus::MessageWriter* writer) {
- writer->PutUint16(val);
-}
-
-template <>
-inline bool NextIs<int32_t>(const dbus::MessageReader& reader) {
- return reader.NextIsInt32();
-}
-
-template <>
-inline int32_t Take<int32_t>(dbus::MessageReader* reader) {
- return reader->TakeInt32();
-}
-
-inline void Put(int32_t val, dbus::MessageWriter* writer) {
- writer->PutInt32(val);
-}
-
-template <>
-inline bool NextIs<uint32_t>(const dbus::MessageReader& reader) {
- return reader.NextIsUint32();
-}
-
-template <>
-inline uint32_t Take<uint32_t>(dbus::MessageReader* reader) {
- return reader->TakeUint32();
-}
-
-inline void Put(uint32_t val, dbus::MessageWriter* writer) {
- writer->PutUint32(val);
-}
-
-template <>
-inline bool NextIs<int64_t>(const dbus::MessageReader& reader) {
- return reader.NextIsInt64();
-}
-
-template <>
-inline int64_t Take<int64_t>(dbus::MessageReader* reader) {
- return reader->TakeInt64();
-}
-
-inline void Put(int64_t val, dbus::MessageWriter* writer) {
- writer->PutInt64(val);
-}
-
-template <>
-inline bool NextIs<uint64_t>(const dbus::MessageReader& reader) {
- return reader.NextIsUint64();
-}
-
-template <>
-inline uint64_t Take<uint64_t>(dbus::MessageReader* reader) {
- return reader->TakeUint64();
-}
-
-inline void Put(uint64_t val, dbus::MessageWriter* writer) {
- writer->PutUint64(val);
-}
-
-template <>
-inline std::string Take<std::string>(dbus::MessageReader* reader) {
- return reader->TakeString();
-}
-
-inline void Put(const std::string val, dbus::MessageWriter* writer) {
- writer->PutString(val);
-}
-
-// Type to DBus type id mappers
-template <typename T>
-char DbusTypeCode();
-template <>
-inline char DbusTypeCode<bool>() {
- return DBUS_TYPE_BOOLEAN;
-}
-// There is no dbus type for signed byte, map to unsigned
-template <>
-inline char DbusTypeCode<int8_t>() {
- return DBUS_TYPE_BYTE;
-}
-template <>
-inline char DbusTypeCode<uint8_t>() {
- return DBUS_TYPE_BYTE;
-}
-template <>
-inline char DbusTypeCode<int16_t>() {
- return DBUS_TYPE_INT16;
-}
-template <>
-inline char DbusTypeCode<uint16_t>() {
- return DBUS_TYPE_UINT16;
-}
-template <>
-inline char DbusTypeCode<int32_t>() {
- return DBUS_TYPE_INT32;
-}
-template <>
-inline char DbusTypeCode<uint32_t>() {
- return DBUS_TYPE_UINT32;
-}
-template <>
-inline char DbusTypeCode<int64_t>() {
- return DBUS_TYPE_INT64;
-}
-template <>
-inline char DbusTypeCode<uint64_t>() {
- return DBUS_TYPE_UINT64;
-}
-template <>
-inline char DbusTypeCode<double>() {
- return DBUS_TYPE_DOUBLE;
-}
-template <>
-inline char DbusTypeCode<std::string>() {
- return DBUS_TYPE_STRING;
-}
-template <>
-inline char DbusTypeCode<const std::string>() {
- return DBUS_TYPE_STRING;
-}
-
-// Non-specialized template supposes there is static
-// void GetDbusSignature(std::string*) method in T
-template <typename T>
-struct DbusSignatureHelper {
- static void DbusSignature(std::string* signature) {
- T::GetDbusSignature(signature);
- }
-};
-
-template <>
-struct DbusSignatureHelper<Boolean> {
- static void DbusSignature(std::string* signature) {
- (*signature) += rpc::impl::DbusTypeCode<bool>();
- }
-};
-
-template <typename T, T minval, T maxval>
-struct DbusSignatureHelper<Integer<T, minval, maxval> > {
- static void DbusSignature(std::string* signature) {
- (*signature) += rpc::impl::DbusTypeCode<T>();
- }
-};
-
-template <int64_t minnum, int64_t maxnum, int64_t minden, int64_t maxden>
-struct DbusSignatureHelper<Float<minnum, maxnum, minden, maxden> > {
- static void DbusSignature(std::string* signature) {
- (*signature) += rpc::impl::DbusTypeCode<double>();
- }
-};
-
-template <typename T>
-struct DbusSignatureHelper<Enum<T> > {
- static void DbusSignature(std::string* signature) {
- (*signature) += rpc::impl::DbusTypeCode<int32_t>();
- }
-};
-
-template <size_t minlen, size_t maxlen>
-struct DbusSignatureHelper<String<minlen, maxlen> > {
- static void DbusSignature(std::string* signature) {
- (*signature) += rpc::impl::DbusTypeCode<std::string>();
- }
-};
-
-template <typename K, typename V>
-struct DbusSignatureHelper<std::pair<K, V> > {
- static void DbusSignature(std::string* signature) {
- (*signature) += DBUS_DICT_ENTRY_BEGIN_CHAR;
- (*signature) += rpc::impl::DbusTypeCode<K>();
- rpc::impl::DbusSignatureHelper<V>::DbusSignature(signature);
- (*signature) += DBUS_DICT_ENTRY_END_CHAR;
- }
-};
-
-template <typename T, size_t minsize, size_t maxsize>
-struct DbusSignatureHelper<Array<T, minsize, maxsize> > {
- static void DbusSignature(std::string* signature) {
- (*signature) += DBUS_TYPE_ARRAY;
- rpc::impl::DbusSignatureHelper<T>::DbusSignature(signature);
- }
-};
-
-template <typename T, size_t minsize, size_t maxsize>
-struct DbusSignatureHelper<Map<T, minsize, maxsize> > {
- static void DbusSignature(std::string* signature) {
- (*signature) += DBUS_TYPE_ARRAY;
- rpc::impl::DbusSignatureHelper<typename Map<T, minsize, maxsize>::
- value_type>::DbusSignature(signature);
- }
-};
-
-template <typename T>
-struct DbusSignatureHelper<Optional<T> > {
- static void DbusSignature(std::string* signature) {
- (*signature) += DBUS_STRUCT_BEGIN_CHAR;
- (*signature) += rpc::impl::DbusTypeCode<bool>();
- rpc::impl::DbusSignatureHelper<T>::DbusSignature(signature);
- (*signature) += DBUS_STRUCT_END_CHAR;
- }
-};
-
-template <typename T>
-struct DbusSignatureHelper<Nullable<T> > {
- static void DbusSignature(std::string* signature) {
- (*signature) += DBUS_STRUCT_BEGIN_CHAR;
- (*signature) += rpc::impl::DbusTypeCode<bool>();
- rpc::impl::DbusSignatureHelper<T>::DbusSignature(signature);
- (*signature) += DBUS_STRUCT_END_CHAR;
- }
-};
-
-// Helper Optional type initialization functipon
-template <typename T>
-T TakeOptional(dbus::MessageReader* reader) {
- dbus::MessageReader struct_reader = reader->TakeStructReader();
- bool available = struct_reader.TakeBool();
- T value(&struct_reader);
- return available ? value : T();
-}
-
-// Helper Nullable type initialization functipon
-template <typename T>
-bool TakeNullable(dbus::MessageReader* reader) {
- dbus::MessageReader struct_reader = reader->TakeStructReader();
- bool is_null = struct_reader.TakeBool();
- return is_null;
-}
-
-} // namespace impl
-
-// Helper function that outputs dbus signature for type T
-template <typename T>
-void DbusSignature(std::string* signature) {
- impl::DbusSignatureHelper<T>::DbusSignature(signature);
-}
-
-// Type constructors
-inline Boolean::Boolean(dbus::MessageReader* reader)
- : PrimitiveType(InitHelper(reader->NextIsBool()))
- , value_(reader->TakeBool()) {}
-
-template <typename T, T minval, T maxval>
-inline Integer<T, minval, maxval>::Integer(dbus::MessageReader* reader)
- : PrimitiveType(InitHelper(impl::NextIs<IntType>(*reader)))
- , value_(impl::Take<IntType>(reader)) {
- if (is_valid()) {
- value_state_ = range_.Includes(value_) ? kValid : kInvalid;
- }
-}
-
-template <int64_t minnum, int64_t maxnum, int64_t minden, int64_t maxden>
-inline Float<minnum, maxnum, minden, maxden>::Float(dbus::MessageReader* reader)
- : PrimitiveType(InitHelper(reader->NextIsDouble()))
- , value_(reader->TakeDouble()) {
- if (is_valid()) {
- value_state_ = range_.Includes(value_) ? kValid : kInvalid;
- }
-}
-
-template <size_t minlen, size_t maxlen>
-inline String<minlen, maxlen>::String(dbus::MessageReader* reader)
- : PrimitiveType(InitHelper(reader->NextIsString()))
- , value_(reader->TakeString()) {
- if (is_valid()) {
- value_state_ = length_range_.Includes(value_.length()) ? kValid : kInvalid;
- }
-}
-
-template <typename T>
-inline Enum<T>::Enum(dbus::MessageReader* reader)
- : PrimitiveType(InitHelper(reader->NextIsInt32()))
- , value_(EnumType(reader->TakeInt32())) {
- if (is_valid()) {
- value_state_ = IsValidEnum(value_) ? kValid : kInvalid;
- }
-}
-
-template <typename T, size_t minsize, size_t maxsize>
-inline Array<T, minsize, maxsize>::Array(dbus::MessageReader* reader)
- : CompositeType(InitHelper(reader->NextIsArray())) {
- dbus::MessageReader array_reader = reader->TakeArrayReader();
- if (array_reader.has_failed()) {
- push_back(T());
- } else {
- while (array_reader.HasNext()) {
- push_back(T(&array_reader));
- }
- }
-}
-
-template <typename T, size_t minsize, size_t maxsize>
-inline Map<T, minsize, maxsize>::Map(dbus::MessageReader* reader)
- : CompositeType(InitHelper(reader->NextIsStruct())) {
- // Map key-value pairs are serialized into array
- dbus::MessageReader array_reader = reader->TakeArrayReader();
- if (array_reader.has_failed()) {
- this->insert(typename MapType::value_type("", T()));
- } else {
- while (array_reader.HasNext()) {
- dbus::MessageReader dictvalue_reader = array_reader.TakeDictEntryReader();
- typename MapType::key_type key =
- impl::Take<typename MapType::key_type>(&dictvalue_reader);
- this->insert(typename MapType::value_type(key, T(&dictvalue_reader)));
- }
- }
-}
-
-template <typename T>
-inline Nullable<T>::Nullable(dbus::MessageReader* reader)
- : T(reader), marked_null_(impl::TakeNullable<T>(reader)) {}
-
-template <typename T>
-inline Optional<T>::Optional(dbus::MessageReader* reader)
- : value_(impl::TakeOptional<T>(reader)) {}
-
-// MessageWriter serializers
-inline void Boolean::ToDbusWriter(dbus::MessageWriter* writer) const {
- writer->PutBool(value_);
-}
-
-template <typename T, T minval, T maxval>
-inline void Integer<T, minval, maxval>::ToDbusWriter(
- dbus::MessageWriter* writer) const {
- impl::Put(value_, writer);
-}
-
-template <int64_t minnum, int64_t maxnum, int64_t minden, int64_t maxden>
-inline void Float<minnum, maxnum, minden, maxden>::ToDbusWriter(
- dbus::MessageWriter* writer) const {
- writer->PutDouble(value_);
-}
-
-template <size_t minlen, size_t maxlen>
-inline void String<minlen, maxlen>::ToDbusWriter(
- dbus::MessageWriter* writer) const {
- writer->PutString(value_);
-}
-
-template <typename T>
-inline void Enum<T>::ToDbusWriter(dbus::MessageWriter* writer) const {
- writer->PutInt32(static_cast<int32_t>(value_));
-}
-
-template <typename T, size_t minsize, size_t maxsize>
-inline void Array<T, minsize, maxsize>::ToDbusWriter(
- dbus::MessageWriter* writer) const {
- std::string array_signature;
- DbusSignature<typename ArrayType::value_type>(&array_signature);
- dbus::MessageWriter array_writer(
- writer, dbus::kArray, array_signature.c_str());
- for (typename ArrayType::const_iterator i = this->begin(); i != this->end();
- ++i) {
- i->ToDbusWriter(&array_writer);
- }
-}
-
-template <typename T, size_t minsize, size_t maxsize>
-inline void Map<T, minsize, maxsize>::ToDbusWriter(
- dbus::MessageWriter* writer) const {
- std::string array_signature;
- DbusSignature<typename MapType::value_type>(&array_signature);
- dbus::MessageWriter array_writer(
- writer, dbus::kArray, array_signature.c_str());
- for (typename MapType::const_iterator i = this->begin(); i != this->end();
- ++i) {
- dbus::MessageWriter dictentry_writer(&array_writer, dbus::kDictEntry, NULL);
- impl::Put(i->first, &dictentry_writer);
- i->second.ToDbusWriter(&dictentry_writer);
- }
-}
-
-template <typename T>
-inline void Optional<T>::ToDbusWriter(dbus::MessageWriter* writer) const {
- dbus::MessageWriter struct_writer(writer, dbus::kStruct, NULL);
- struct_writer.PutBool(value_.is_initialized());
- value_.ToDbusWriter(&struct_writer);
-}
-
-} // namespace rpc
-
-#endif // SRC_COMPONENTS_RPC_BASE_INCLUDE_RPC_BASE_RPC_BASE_DBUS_INL_H_
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
index b6b47c2ed8..a7b477c009 100644
--- a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
+++ b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
@@ -46,8 +46,7 @@ namespace rpc {
* Range helper class
*/
template <typename T>
-Range<T>::Range(T min, T max)
- : min_(min), max_(max) {}
+Range<T>::Range(T min, T max) : min_(min), max_(max) {}
template <typename T>
T Range<T>::min() const {
@@ -139,6 +138,10 @@ inline Boolean::Boolean() : PrimitiveType(kUninitialized), value_(false) {}
inline Boolean::Boolean(bool value) : PrimitiveType(kValid), value_(value) {}
+inline bool Boolean::operator==(const Boolean& that) {
+ return value_ == that.value_;
+}
+
inline Boolean& Boolean::operator=(bool new_val) {
value_ = new_val;
value_state_ = kValid;
@@ -186,12 +189,14 @@ Integer<T, minval, maxval>& Integer<T, minval, maxval>::operator=(
template <typename T, T minval, T maxval>
Integer<T, minval, maxval>& Integer<T, minval, maxval>::operator++() {
++value_;
+ value_state_ = range_.Includes(value_) ? kValid : kInvalid;
return *this;
}
template <typename T, T minval, T maxval>
Integer<T, minval, maxval>& Integer<T, minval, maxval>::operator+=(int value) {
value_ += value;
+ value_state_ = range_.Includes(value_) ? kValid : kInvalid;
return *this;
}
@@ -236,8 +241,7 @@ template <size_t minlen, size_t maxlen>
const Range<size_t> String<minlen, maxlen>::length_range_(minlen, maxlen);
template <size_t minlen, size_t maxlen>
-String<minlen, maxlen>::String()
- : PrimitiveType(kUninitialized) {}
+String<minlen, maxlen>::String() : PrimitiveType(kUninitialized) {}
template <size_t minlen, size_t maxlen>
String<minlen, maxlen>::String(const std::string& value)
@@ -280,6 +284,21 @@ bool String<minlen, maxlen>::operator==(const String& rhs) const {
}
template <size_t minlen, size_t maxlen>
+bool String<minlen, maxlen>::operator==(const std::string& rhs) const {
+ return value_ == rhs;
+}
+
+template <size_t minlen, size_t maxlen>
+bool String<minlen, maxlen>::operator!=(const String& rhs) const {
+ return value_ != rhs.value_;
+}
+
+template <size_t minlen, size_t maxlen>
+bool String<minlen, maxlen>::operator!=(const std::string& rhs) const {
+ return value_ != rhs;
+}
+
+template <size_t minlen, size_t maxlen>
String<minlen, maxlen>::operator const std::string&() const {
return value_;
}
@@ -288,8 +307,7 @@ String<minlen, maxlen>::operator const std::string&() const {
* Enum class
*/
template <typename T>
-Enum<T>::Enum()
- : PrimitiveType(kUninitialized), value_(EnumType()) {}
+Enum<T>::Enum() : PrimitiveType(kUninitialized), value_(EnumType()) {}
template <typename T>
Enum<T>::Enum(EnumType value)
@@ -311,8 +329,7 @@ Enum<T>::operator EnumType() const {
* Array class
*/
template <typename T, size_t minsize, size_t maxsize>
-Array<T, minsize, maxsize>::Array()
- : CompositeType(kUninitialized) {}
+Array<T, minsize, maxsize>::Array() : CompositeType(kUninitialized) {}
template <typename T, size_t minsize, size_t maxsize>
template <typename U>
@@ -367,6 +384,20 @@ bool Array<T, minsize, maxsize>::is_initialized() const {
}
template <typename T, size_t minsize, size_t maxsize>
+bool Array<T, minsize, maxsize>::operator==(const Array& that) {
+ if (this->size() != that.size())
+ return false;
+
+ for (auto i = std::begin(*this), j = std::begin(that); i != std::end(*this);
+ ++i, ++j) {
+ if (!(*i == *j)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+template <typename T, size_t minsize, size_t maxsize>
void Array<T, minsize, maxsize>::ReportErrors(ValidationReport* report) const {
if (this->empty()) {
CompositeType::ReportErrors(report);
@@ -401,13 +432,11 @@ void Array<T, minsize, maxsize>::SetPolicyTableType(
* Map class
*/
template <typename T, size_t minsize, size_t maxsize>
-Map<T, minsize, maxsize>::Map()
- : CompositeType(kUninitialized) {}
+Map<T, minsize, maxsize>::Map() : CompositeType(kUninitialized) {}
template <typename T, size_t minsize, size_t maxsize>
template <typename U>
-Map<T, minsize, maxsize>::Map(const U& value)
- : CompositeType(kUninitialized) {
+Map<T, minsize, maxsize>::Map(const U& value) : CompositeType(kUninitialized) {
for (typename U::const_iterator i = value.begin(), e = value.end(); i != e;
++i) {
// Explicitly convert that value to T because all rpc_types have explicit
@@ -499,13 +528,11 @@ void Map<T, minsize, maxsize>::SetPolicyTableType(
* Nullable class
*/
template <typename T>
-Nullable<T>::Nullable()
- : marked_null_(false) {}
+Nullable<T>::Nullable() : marked_null_(false) {}
template <typename T>
template <typename U>
-Nullable<T>::Nullable(const U& value)
- : T(value), marked_null_(false) {}
+Nullable<T>::Nullable(const U& value) : T(value), marked_null_(false) {}
template <typename T>
template <typename U>
@@ -577,6 +604,11 @@ const T* Optional<T>::operator->() const {
}
template <typename T>
+bool Optional<T>::operator==(const Optional<T>& that) {
+ return value_ == that.value_;
+}
+
+template <typename T>
void Optional<T>::assign_if_valid(const Optional<T>& value) {
if (value.is_initialized()) {
value_ = value.value_;
@@ -623,8 +655,7 @@ void rpc::Optional<T>::SetPolicyTableType(
* Stringifyable class
*/
template <typename T>
-Stringifyable<T>::Stringifyable()
- : predefined_string_("") {}
+Stringifyable<T>::Stringifyable() : predefined_string_("") {}
template <typename T>
template <typename U>
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h b/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h
index 6c8bb359af..80e11994f1 100644
--- a/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h
+++ b/src/components/rpc_base/include/rpc_base/rpc_base_json_inl.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_RPC_BASE_INCLUDE_RPC_BASE_RPC_BASE_JSON_INL_H_
#define SRC_COMPONENTS_RPC_BASE_INCLUDE_RPC_BASE_RPC_BASE_JSON_INL_H_
-#include "rpc_base/rpc_base.h"
#include "json/value.h"
+#include "rpc_base/rpc_base.h"
namespace rpc {
@@ -164,7 +164,7 @@ Json::Value Integer<T, minval, maxval>::ToJsonValue() const {
template <int64_t minnum, int64_t maxnum, int64_t minden, int64_t maxden>
Float<minnum, maxnum, minden, maxden>::Float(const Json::Value* value)
- : PrimitiveType(InitHelper(value, &Json::Value::isDouble)), value_() {
+ : PrimitiveType(InitHelper(value, &Json::Value::isNumeric)), value_() {
if (is_valid()) {
value_ = value->asDouble();
value_state_ = range_.Includes(value_) ? kValid : kInvalid;
@@ -174,7 +174,7 @@ Float<minnum, maxnum, minden, maxden>::Float(const Json::Value* value)
template <int64_t minnum, int64_t maxnum, int64_t minden, int64_t maxden>
Float<minnum, maxnum, minden, maxden>::Float(const Json::Value* value,
double def_value)
- : PrimitiveType(InitHelper(value, &Json::Value::isDouble))
+ : PrimitiveType(InitHelper(value, &Json::Value::isNumeric))
, value_(def_value) {
if (!is_initialized()) {
value_state_ = kValid;
@@ -206,6 +206,7 @@ String<minlen, maxlen>::String(const Json::Value* value,
if (!is_initialized()) {
value_state_ = kValid;
} else if (is_valid()) {
+ value_ = value->asString();
value_state_ = length_range_.Includes(value_.length()) ? kValid : kInvalid;
}
}
diff --git a/src/components/rpc_base/test/CMakeLists.txt b/src/components/rpc_base/test/CMakeLists.txt
index ca4f41fe76..ae87bb71b7 100644
--- a/src/components/rpc_base/test/CMakeLists.txt
+++ b/src/components/rpc_base/test/CMakeLists.txt
@@ -31,8 +31,6 @@
include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake)
include_directories(
- ${COMPONENTS_DIR}/dbus/include
- ${COMPONENTS_DIR}/dbus/src
${COMPONENTS_DIR}/rpc_base/include
${GMOCK_INCLUDE_DIRECTORY}
${JSONCPP_INCLUDE_DIRECTORY}
@@ -43,16 +41,5 @@ set(LIBRARIES
jsoncpp
)
-if(${HMI_DBUS_API})
- include_directories(${DBUS_INCLUDE_DIRS})
- list(APPEND LIBRARIES
- DBus
- )
-else()
- set(EXCLUDE_PATHS
- rpc_base_dbus_test.cc
- )
-endif()
-
collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}" "${EXCLUDE_PATHS}")
create_test(rpc_base_test "${SOURCES}" "${LIBRARIES}")
diff --git a/src/components/rpc_base/test/rpc_base_dbus_test.cc b/src/components/rpc_base/test/rpc_base_dbus_test.cc
deleted file mode 100644
index 4a22e111a3..0000000000
--- a/src/components/rpc_base/test/rpc_base_dbus_test.cc
+++ /dev/null
@@ -1,682 +0,0 @@
-/* Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "gtest/gtest.h"
-#include "dbus/dbus_message.h"
-#include "rpc_base/rpc_base.h"
-#include "rpc_base/rpc_base_dbus_inl.h"
-
-namespace test {
-namespace components {
-namespace rpc_base_test {
-
-using namespace rpc;
-using namespace dbus;
-
-enum TestEnum { kValue0, kValue1, kInvalidValue };
-
-bool IsValidEnum(TestEnum val) {
- return val == kValue0 || val == kValue1;
-}
-
-bool EnumFromJsonString(const std::string& value, TestEnum* enm) {
- if (value == "kValue0") {
- *enm = kValue0;
- return true;
- } else if (value == "kValue1") {
- *enm = kValue1;
- return true;
- } else {
- return false;
- }
-}
-
-const char* EnumToJsonString(TestEnum enm) {
- switch (enm) {
- case kValue0:
- return "kValue0";
- case kValue1:
- return "kValue1";
- default:
- return "UNKNOWN";
- }
-}
-
-struct DbusDeserialization : public testing::Test {
- dbus::MessageRef msgref;
- DbusDeserialization()
- : msgref(dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL)) {}
-};
-
-TEST_F(DbusDeserialization, DeserializeBool) {
- {
- dbus::MessageWriter writer(msgref);
- writer.PutBool(true);
- }
- {
- dbus::MessageReader reader(msgref);
- Boolean booln(&reader);
- ASSERT_TRUE(booln);
- }
-}
-
-TEST_F(DbusDeserialization, DeserializeByte) {
- {
- dbus::MessageWriter writer(msgref);
- writer.PutByte(200);
- }
- {
- dbus::MessageReader reader(msgref);
- Integer<uint8_t, 1, 220> byte(&reader);
- ASSERT_TRUE(byte.is_initialized());
- ASSERT_TRUE(byte.is_valid());
- ASSERT_EQ(byte, 200);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, DeserializeInt64) {
- {
- dbus::MessageWriter writer(msgref);
- writer.PutInt64(-1);
- }
- {
- dbus::MessageReader reader(msgref);
- Integer<int64_t, -5, 220> int64(&reader);
- ASSERT_TRUE(int64.is_initialized());
- ASSERT_TRUE(int64.is_valid());
- ASSERT_EQ(int64, -1);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, DeserializeFloat) {
- {
- dbus::MessageWriter writer(msgref);
- writer.PutDouble(3.14);
- }
- {
- dbus::MessageReader reader(msgref);
- Float<3, 4> pi(&reader);
- ASSERT_TRUE(pi.is_initialized());
- ASSERT_TRUE(pi.is_valid());
- ASSERT_DOUBLE_EQ(pi, 3.14);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, DeserializeString) {
- {
- dbus::MessageWriter writer(msgref);
- writer.PutString("Hello");
- }
- {
- dbus::MessageReader reader(msgref);
- String<3, 10> hello(&reader);
- ASSERT_TRUE(hello.is_initialized());
- ASSERT_TRUE(hello.is_valid());
- ASSERT_EQ(std::string(hello), "Hello");
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, DeserializeEnum) {
- {
- dbus::MessageWriter writer(msgref);
- writer.PutInt32(kValue1);
- }
- {
- dbus::MessageReader reader(msgref);
- Enum<TestEnum> enm(&reader);
- ASSERT_TRUE(enm.is_initialized());
- ASSERT_TRUE(enm.is_valid());
- ASSERT_EQ(enm, kValue1);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, DeserializeArray) {
- {
- dbus::MessageWriter writer(msgref);
- std::string array_signature;
- rpc::DbusSignature<Integer<int32_t, 1, 50> >(&array_signature);
- dbus::MessageWriter array_writer(
- &writer, dbus::kArray, array_signature.c_str());
- array_writer.PutInt32(5);
- array_writer.PutInt32(33);
- }
- {
- dbus::MessageReader reader(msgref);
- Array<Integer<int32_t, 1, 50>, 1, 100> array(&reader);
- ASSERT_TRUE(array.is_initialized());
- ASSERT_TRUE(array.is_valid());
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- ASSERT_EQ(array.size(), 2u);
- ASSERT_EQ(array[0], 5);
- ASSERT_EQ(array[1], 33);
- }
-}
-
-TEST_F(DbusDeserialization, DeserializeArrayOfArrays) {
- {
- dbus::MessageWriter writer(msgref);
- std::string array_signature;
- rpc::DbusSignature<Array<Integer<int32_t, 1, 50>, 1, 5> >(&array_signature);
- dbus::MessageWriter array_writer(
- &writer, dbus::kArray, array_signature.c_str());
- int val = 5;
- for (int i = 0; i < 2; ++i) {
- std::string subarray_signature;
- rpc::DbusSignature<Integer<int32_t, 1, 50> >(&subarray_signature);
- dbus::MessageWriter subarray_wirter(
- &array_writer, dbus::kArray, subarray_signature.c_str());
-
- subarray_wirter.PutInt32(val++);
- subarray_wirter.PutInt32(val++);
- }
- }
- {
- dbus::MessageReader reader(msgref);
- Array<Array<Integer<int32_t, 1, 50>, 1, 5>, 1, 5> array(&reader);
- ASSERT_TRUE(array.is_initialized());
- ASSERT_TRUE(array.is_valid());
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- ASSERT_EQ(array.size(), 2u);
- ASSERT_EQ(array[0].size(), 2u);
- ASSERT_EQ(array[1].size(), 2u);
- ASSERT_EQ(array[0][0], 5);
- ASSERT_EQ(array[0][1], 6);
- ASSERT_EQ(array[1][0], 7);
- ASSERT_EQ(array[1][1], 8);
- }
-}
-
-TEST_F(DbusDeserialization, DeserializeMap) {
- {
- dbus::MessageWriter writer(msgref);
- std::string dict_signature;
- rpc::DbusSignature<Map<Enum<TestEnum>, 1, 5>::value_type>(&dict_signature);
- dbus::MessageWriter array_writer(
- &writer, dbus::kArray, dict_signature.c_str());
- const char* keys[] = {"Hello", "World"};
- int val = 0;
- for (int i = 0; i < 2; ++i) {
- dbus::MessageWriter dictval_wirter(&array_writer, dbus::kDictEntry, NULL);
- dictval_wirter.PutString(keys[val]);
- dictval_wirter.PutInt32(val++);
- }
- }
- {
- dbus::MessageReader reader(msgref);
- Map<Enum<TestEnum>, 1, 5> amap(&reader);
- ASSERT_TRUE(amap.is_initialized());
- ASSERT_TRUE(amap.is_valid());
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- ASSERT_EQ(amap.size(), 2u);
- ASSERT_EQ(amap["Hello"], kValue0);
- ASSERT_EQ(amap["World"], kValue1);
- }
-}
-
-TEST_F(DbusDeserialization, InconsistentTypesTest) {
- {
- dbus::MessageWriter writer(msgref);
- writer.PutString("Hello");
- }
- {
- dbus::MessageReader reader(msgref);
- Boolean badbool(&reader);
- ASSERT_TRUE(badbool.is_initialized());
- ASSERT_FALSE(badbool.is_valid());
- ASSERT_TRUE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, DeserializeOptionalString) {
- {
- dbus::MessageWriter writer(msgref);
- dbus::MessageWriter optwriter(&writer, dbus::kStruct, NULL);
- optwriter.PutBool(true);
- optwriter.PutString("Hello dear");
- }
- {
- dbus::MessageReader reader(msgref);
- Optional<String<1, 100> > readback(&reader);
- ASSERT_TRUE(readback.is_initialized());
- ASSERT_TRUE(readback.is_valid());
- ASSERT_EQ(std::string(*readback), "Hello dear");
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, DeserializeOptionalInt) {
- {
- dbus::MessageWriter writer(msgref);
- dbus::MessageWriter optwriter(&writer, dbus::kStruct, NULL);
- optwriter.PutBool(false);
- optwriter.PutInt32(42);
- }
- {
- dbus::MessageReader reader(msgref);
- Optional<Integer<int32_t, 1, 90> > readback(&reader);
- ASSERT_FALSE(readback.is_initialized());
- ASSERT_TRUE(readback.is_valid());
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, SerializeDeserializeBool) {
- {
- Boolean true_bool(true);
- dbus::MessageWriter writer(msgref);
- true_bool.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msgref);
- Boolean readback(&reader);
- ASSERT_TRUE(readback.is_initialized());
- ASSERT_TRUE(readback.is_valid());
- ASSERT_EQ(readback, true);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, SerializeDeserializeInt8t) {
- {
- Integer<int8_t, 1, 100> int8(42);
- dbus::MessageWriter writer(msgref);
- int8.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msgref);
- Integer<int8_t, 1, 100> readback(&reader);
- ASSERT_TRUE(readback.is_initialized());
- ASSERT_TRUE(readback.is_valid());
- ASSERT_EQ(readback, 42);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, BadSerializeDeserializeInt8t) {
- {
- Integer<int8_t, 1, 12> int8(42);
- dbus::MessageWriter writer(msgref);
- int8.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msgref);
- Integer<int8_t, 1, 12> readback(&reader);
- ASSERT_TRUE(readback.is_initialized());
- ASSERT_FALSE(readback.is_valid());
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, SerializeDeserializeInt64t) {
- {
- Integer<int64_t, 1, 0xFFFFFFFFFF> int64(0xFFFFFFFFF1);
- dbus::MessageWriter writer(msgref);
- int64.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msgref);
- Integer<int64_t, 1, 0xFFFFFFFFFF> readback(&reader);
- ASSERT_TRUE(readback.is_initialized());
- ASSERT_TRUE(readback.is_valid());
- ASSERT_EQ(readback, 0xFFFFFFFFF1);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, SerializeDeserializeDouble) {
- {
- Float<1, 5> flt(3.14);
- dbus::MessageWriter writer(msgref);
- flt.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msgref);
- Float<1, 5> readback(&reader);
- ASSERT_TRUE(readback.is_initialized());
- ASSERT_TRUE(readback.is_valid());
- ASSERT_DOUBLE_EQ(readback, 3.14);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, SerializeDeserializeString) {
- {
- String<1, 12> hello("Hello");
- dbus::MessageWriter writer(msgref);
- hello.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msgref);
- String<1, 12> readback(&reader);
- ASSERT_TRUE(readback.is_initialized());
- ASSERT_TRUE(readback.is_valid());
- ASSERT_EQ(std::string(readback), "Hello");
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, SerializeDeserializeEnum) {
- {
- Enum<TestEnum> te(kValue1);
- dbus::MessageWriter writer(msgref);
- te.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msgref);
- Enum<TestEnum> readback(&reader);
- ASSERT_TRUE(readback.is_initialized());
- ASSERT_TRUE(readback.is_valid());
- ASSERT_EQ(readback, kValue1);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, SerializeDeserializeArray) {
- {
- Array<Integer<int32_t, 1, 100>, 1, 90> ints;
- ints.push_back(42);
- ints.push_back(17);
- dbus::MessageWriter writer(msgref);
- ints.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msgref);
- Array<Integer<int32_t, 1, 100>, 1, 90> readback(&reader);
- ASSERT_TRUE(readback.is_initialized());
- ASSERT_TRUE(readback.is_valid());
- ASSERT_EQ(readback[0], 42);
- ASSERT_EQ(readback[1], 17);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, SerializeDeserializeMap) {
- {
- Map<Integer<int32_t, 1, 100>, 1, 90> ints;
- ints["first"] = 42;
- ints["second"] = 17;
- dbus::MessageWriter writer(msgref);
- ints.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msgref);
- Map<Integer<int32_t, 1, 100>, 1, 90> readback(&reader);
- ASSERT_TRUE(readback.is_initialized());
- ASSERT_TRUE(readback.is_valid());
- ASSERT_EQ(readback["first"], 42);
- ASSERT_EQ(readback["second"], 17);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusDeserialization, SerializeDeserializeMapOfArrays) {
- {
- Map<Array<Integer<int32_t, 1, 100>, 1, 5>, 1, 90> ints;
- ints["first"].push_back(1);
- ints["first"].push_back(42);
- ints["second"].push_back(17);
- ints["second"].push_back(3);
- dbus::MessageWriter writer(msgref);
- ints.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msgref);
- Map<Array<Integer<int32_t, 1, 100>, 1, 5>, 1, 90> readback(&reader);
- ASSERT_TRUE(readback.is_initialized());
- ASSERT_TRUE(readback.is_valid());
- ASSERT_EQ(readback.size(), 2u);
- ASSERT_EQ(readback["first"].size(), 2u);
- ASSERT_EQ(readback["second"].size(), 2u);
- ASSERT_EQ(readback["first"][0], 1);
- ASSERT_EQ(readback["first"][1], 42);
- ASSERT_EQ(readback["second"][0], 17);
- ASSERT_EQ(readback["second"][1], 3);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST(ValidatedTypes, TestBooleanDbusSignature) {
- std::string sign;
- DbusSignature<Boolean>(&sign);
- ASSERT_EQ(sign, "b");
-}
-
-TEST(ValidatedTypes, TestIntDbusSignature) {
- std::string sign;
- DbusSignature<Integer<int32_t, 1, 2> >(&sign);
- ASSERT_EQ(sign, "i");
-}
-
-TEST(ValidatedTypes, TestFloatDbusSignature) {
- std::string sign;
- DbusSignature<Float<1, 2> >(&sign);
- ASSERT_EQ(sign, "d");
-}
-
-TEST(ValidatedTypes, TestStringDbusSignature) {
- std::string sign;
- DbusSignature<String<1, 2> >(&sign);
- ASSERT_EQ(sign, "s");
-}
-
-TEST(ValidatedTypes, TestEnumDbusSignature) {
- std::string sign;
- DbusSignature<Enum<TestEnum> >(&sign);
- ASSERT_EQ(sign, "i");
-}
-
-TEST(ValidatedTypes, TestIntArrayDbusSignature) {
- std::string sign;
- DbusSignature<Array<Integer<int32_t, 1, 2>, 1, 3> >(&sign);
- ASSERT_EQ(sign, "ai");
-}
-
-TEST(ValidatedTypes, TestIntArrayArrayDbusSignature) {
- std::string sign;
- DbusSignature<Array<Array<Integer<int32_t, 1, 2>, 1, 3>, 4, 5> >(&sign);
- ASSERT_EQ(sign, "aai");
-}
-
-TEST(ValidatedTypes, TestMapDbusSignature) {
- std::string sign;
- DbusSignature<Map<Integer<int32_t, 1, 2>, 3, 4> >(&sign);
- ASSERT_EQ(sign, "a{si}");
-}
-
-TEST(ValidatedTypes, TestMandatoryEnumDbusSignature) {
- std::string sign;
- DbusSignature<Enum<TestEnum> >(&sign);
- ASSERT_EQ(sign, "i");
-}
-
-TEST(ValidatedTypes, TestOptionalEnumDbusSignature) {
- std::string sign;
- DbusSignature<Optional<Enum<TestEnum> > >(&sign);
- ASSERT_EQ(sign, "(bi)");
-}
-
-TEST(ValidatedTypes, TestOptionalFloatArrayDbusSignature) {
- std::string sign;
- DbusSignature<Optional<Array<Float<1, 2>, 3, 4> > >(&sign);
- ASSERT_EQ(sign, "(bad)");
-}
-
-TEST(DbusMessageConstructionTest, DbusMessageConstruction) {
- DBusMessage* rawmsg = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL);
- dbus::MessageRef msgref(rawmsg);
-}
-
-class DbusTest : public testing::Test {
- public:
- dbus::MessageRef msgref;
- DbusTest() : msgref(dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL)) {}
-};
-
-TEST_F(DbusTest, DbusWriterConstructionTest) {
- dbus::MessageWriter writer(msgref);
-}
-
-TEST_F(DbusTest, DbusEmptyMessageReaderTest) {
- dbus::MessageReader reader(msgref);
- ASSERT_TRUE(reader.has_failed());
-}
-
-TEST_F(DbusTest, DbusMessageWriterBoolWriteRead) {
- dbus::MessageWriter writer(msgref);
- writer.PutBool(true);
- dbus::MessageReader reader(msgref);
- bool redback_value = reader.TakeBool();
- ASSERT_FALSE(reader.has_failed());
- ASSERT_TRUE(redback_value);
-}
-
-TEST_F(DbusTest, DbusMessageWriterInt32WriteRead) {
- dbus::MessageWriter writer(msgref);
- writer.PutInt32(42);
- dbus::MessageReader reader(msgref);
- int32_t readback_value = reader.TakeInt32();
- ASSERT_FALSE(reader.has_failed());
- ASSERT_EQ(readback_value, 42);
-}
-
-TEST_F(DbusTest, DbusMessageWriterStringWriteRead) {
- dbus::MessageWriter writer(msgref);
- writer.PutString("Hello DBus!");
- dbus::MessageReader reader(msgref);
- std::string readback_value = reader.TakeString();
- ASSERT_FALSE(reader.has_failed());
- ASSERT_EQ(readback_value, "Hello DBus!");
-}
-
-TEST_F(DbusTest, DbusMultipleParamsReadWrite) {
- {
- dbus::MessageWriter writer(msgref);
- writer.PutString("Hello DBus!");
- writer.PutInt16(42);
- writer.PutDouble(3.14);
- }
- {
- dbus::MessageReader reader(msgref);
- std::string readback_string = reader.TakeString();
- ASSERT_FALSE(reader.has_failed());
- ASSERT_EQ(readback_string, "Hello DBus!");
- int16_t readback_int = reader.TakeInt16();
- ASSERT_FALSE(reader.has_failed());
- ASSERT_EQ(readback_int, 42);
- double readback_double = reader.TakeDouble();
- ASSERT_FALSE(reader.has_failed());
- ASSERT_DOUBLE_EQ(readback_double, 3.14);
- ASSERT_FALSE(reader.HasNext());
- }
-}
-
-TEST_F(DbusTest, DbusArrayTest) {
- {
- dbus::MessageWriter writer(msgref);
- dbus::MessageWriter array_writer(
- &writer, dbus::kArray, DBUS_TYPE_INT16_AS_STRING);
- array_writer.PutInt16(3);
- array_writer.PutInt16(4);
- array_writer.PutInt16(5);
- }
- {
- dbus::MessageReader reader(msgref);
- dbus::MessageReader array_reader = reader.TakeArrayReader();
- int16_t readback_val = array_reader.TakeInt16();
- ASSERT_FALSE(reader.has_failed());
- ASSERT_EQ(readback_val, 3);
- readback_val = array_reader.TakeInt16();
- ASSERT_FALSE(reader.has_failed());
- ASSERT_EQ(readback_val, 4);
- readback_val = array_reader.TakeInt16();
- ASSERT_FALSE(reader.has_failed());
- ASSERT_EQ(readback_val, 5);
- ASSERT_FALSE(array_reader.HasNext());
- }
-}
-
-class DbusFailuresTest : public testing::Test {
- public:
- dbus::MessageRef int_msg;
- DbusFailuresTest()
- : int_msg(dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL)) {
- dbus::MessageWriter writer(int_msg);
- writer.PutInt64(42);
- }
-};
-
-TEST_F(DbusFailuresTest, DbusInconsistentTypeReadFailureTest) {
- dbus::MessageReader reader(int_msg);
- std::string str = reader.TakeString();
- ASSERT_EQ(str, std::string(""));
- ASSERT_TRUE(reader.has_failed());
-}
-
-TEST_F(DbusFailuresTest, DbusNonExistentArrayReadTest) {
- dbus::MessageReader reader(int_msg);
- ASSERT_FALSE(reader.has_failed());
- dbus::MessageReader array_reader = reader.TakeArrayReader();
- ASSERT_TRUE(array_reader.has_failed());
- ASSERT_TRUE(reader.has_failed());
- int64_t val = array_reader.TakeInt64();
- ASSERT_TRUE(array_reader.has_failed());
- ASSERT_EQ(val, 0);
-}
-
-} // namespace rpc_base_test
-} // namespace components
-} // namespace test
diff --git a/src/components/rpc_base/test/rpc_base_json_test.cc b/src/components/rpc_base/test/rpc_base_json_test.cc
index cad9dd3a65..8db1c5549b 100644
--- a/src/components/rpc_base/test/rpc_base_json_test.cc
+++ b/src/components/rpc_base/test/rpc_base_json_test.cc
@@ -124,7 +124,7 @@ TEST(ValidatedTypesJson, IntegerAbsentValueTest) {
}
TEST(ValidatedTypesJson, IntegerFromOverflowingJsonTest) {
- Value int_val(0xFFFFFFFFFFll);
+ Value int_val(0xFFFFFFFFFFl);
Integer<int32_t, -5, 192> integer(&int_val);
ASSERT_TRUE(integer.is_initialized());
ASSERT_FALSE(integer.is_valid());
diff --git a/src/components/rpc_base/test/rpc_base_test.cc b/src/components/rpc_base/test/rpc_base_test.cc
index d81e01db6c..7c62fa3fb4 100644
--- a/src/components/rpc_base/test/rpc_base_test.cc
+++ b/src/components/rpc_base/test/rpc_base_test.cc
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "rpc_base/rpc_base.h"
#include "gtest/gtest.h"
#include "json/writer.h"
#include "rpc_base/gtest_support.h"
-#include "rpc_base/rpc_base.h"
namespace test {
namespace components {
@@ -191,18 +191,20 @@ TEST(ValidatedTypes, TestOptionalEmptyArray) {
Optional<Array<Integer<int8_t, 0, 10>, 0, 5> > ai;
ASSERT_RPCTYPE_VALID(ai);
ASSERT_FALSE(ai.is_initialized());
- Json::FastWriter fw;
- std::string serialized = fw.write(ai.ToJsonValue());
- ASSERT_EQ(serialized, "[]\n");
+ Json::StreamWriterBuilder writer_builder;
+ const std::string serialized =
+ Json::writeString(writer_builder, ai.ToJsonValue());
+ ASSERT_EQ("[]", serialized);
}
TEST(ValidatedTypes, TestMandatoryEmptyArray) {
Array<Integer<int8_t, 0, 10>, 0, 5> ai;
ASSERT_FALSE(ai.is_valid());
ASSERT_FALSE(ai.is_initialized());
- Json::FastWriter fw;
- std::string serialized = fw.write(ai.ToJsonValue());
- ASSERT_EQ(serialized, "[]\n");
+ Json::StreamWriterBuilder writer_builder;
+ const std::string serialized =
+ Json::writeString(writer_builder, ai.ToJsonValue());
+ ASSERT_EQ("[]", serialized);
}
TEST(ValidatedTypes, TestMap) {
@@ -230,9 +232,10 @@ TEST(ValidatedTypes, TestEmptyMandatoryMap) {
Map<Integer<int8_t, 0, 10>, 0, 5> im;
ASSERT_FALSE(im.is_valid());
ASSERT_FALSE(im.is_initialized());
- Json::FastWriter fw;
- std::string serialized = fw.write(im.ToJsonValue());
- ASSERT_EQ(serialized, "{}\n");
+ Json::StreamWriterBuilder writer_builder;
+ const std::string serialized =
+ Json::writeString(writer_builder, im.ToJsonValue());
+ ASSERT_EQ("{}", serialized);
}
TEST(ValidatedTypes, TestEnumConstructor) {
diff --git a/src/components/rpc_base/test/validation_report_test.cc b/src/components/rpc_base/test/validation_report_test.cc
index 10effe7dd2..5d3785d6cb 100644
--- a/src/components/rpc_base/test/validation_report_test.cc
+++ b/src/components/rpc_base/test/validation_report_test.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "rpc_base/validation_report.h"
#include <string>
#include "gtest/gtest.h"
-#include "rpc_base/validation_report.h"
namespace test {
namespace components {
diff --git a/src/components/security_manager/CMakeLists.txt b/src/components/security_manager/CMakeLists.txt
index 88bc1ddab4..272c7aad2f 100644
--- a/src/components/security_manager/CMakeLists.txt
+++ b/src/components/security_manager/CMakeLists.txt
@@ -39,6 +39,7 @@ include_directories(
${COMPONENTS_DIR}/utils/include/
${COMPONENTS_DIR}/application_manager/include/
${JSONCPP_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
${APR_INCLUDE_DIRECTORY}
)
diff --git a/src/components/security_manager/include/security_manager/crypto_manager_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_impl.h
index aa3be0f430..42abe6e3b6 100644
--- a/src/components/security_manager/include/security_manager/crypto_manager_impl.h
+++ b/src/components/security_manager/include/security_manager/crypto_manager_impl.h
@@ -33,20 +33,19 @@
#ifndef SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_IMPL_H_
#define SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_IMPL_H_
-#include <stdint.h>
#include <openssl/bio.h>
-#include <openssl/ssl.h>
#include <openssl/err.h>
-#include <string>
+#include <openssl/ssl.h>
+#include <stdint.h>
#include <map>
+#include <string>
#include "security_manager/crypto_manager.h"
-#include "security_manager/ssl_context.h"
#include "security_manager/security_manager_settings.h"
+#include "security_manager/ssl_context.h"
-#include "utils/macro.h"
#include "utils/lock.h"
-#include "utils/shared_ptr.h"
+#include "utils/macro.h"
namespace security_manager {
class CryptoManagerImpl : public CryptoManager {
@@ -138,7 +137,7 @@ class CryptoManagerImpl : public CryptoManager {
public:
explicit CryptoManagerImpl(
- const utils::SharedPtr<const CryptoManagerSettings> set);
+ const std::shared_ptr<const CryptoManagerSettings> set);
~CryptoManagerImpl();
bool Init() OVERRIDE;
@@ -203,10 +202,11 @@ class CryptoManagerImpl : public CryptoManager {
*/
bool SaveModuleKeyToFile(EVP_PKEY* key) const;
- const utils::SharedPtr<const CryptoManagerSettings> settings_;
+ const std::shared_ptr<const CryptoManagerSettings> settings_;
SSL_CTX* context_;
static uint32_t instance_count_;
static sync_primitives::Lock instance_lock_;
+ sync_primitives::Lock crypto_manager_lock_;
DISALLOW_COPY_AND_ASSIGN(CryptoManagerImpl);
};
} // namespace security_manager
diff --git a/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h
index f20d3e4034..47cc557976 100644
--- a/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h
+++ b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h
@@ -1,8 +1,8 @@
#ifndef SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_SETTINGS_IMPL_H_
#define SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_SETTINGS_IMPL_H_
-#include "security_manager/security_manager_settings.h"
#include "config_profile/profile.h"
+#include "security_manager/security_manager_settings.h"
namespace security_manager {
diff --git a/src/components/security_manager/include/security_manager/security_manager_impl.h b/src/components/security_manager/include/security_manager/security_manager_impl.h
index 70b87de0ef..ee00e0774a 100644
--- a/src/components/security_manager/include/security_manager/security_manager_impl.h
+++ b/src/components/security_manager/include/security_manager/security_manager_impl.h
@@ -34,18 +34,18 @@
#define SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_SECURITY_MANAGER_IMPL_H_
#include <list>
-#include <string>
-#include <set>
#include <memory>
+#include <set>
+#include <string>
#include "utils/macro.h"
#include "utils/message_queue.h"
#include "utils/threads/message_loop_thread.h"
+#include "protocol/common.h"
+#include "protocol_handler/protocol_handler.h"
#include "security_manager/security_manager.h"
#include "security_manager/security_query.h"
-#include "protocol_handler/protocol_handler.h"
-#include "protocol/common.h"
#include "utils/system_time_handler.h"
namespace security_manager {
@@ -195,18 +195,12 @@ class SecurityManagerImpl : public SecurityManager,
* @brief Notifiers for listeners.
* Allows to notify that certificate should be updated
*/
- DEPRECATED void NotifyOnCertififcateUpdateRequired();
-
- /**
- * @brief Notifiers for listeners.
- * Allows to notify that certificate should be updated
- */
void NotifyOnCertificateUpdateRequired() OVERRIDE;
/**
* @brief Notify all listeners that handshake was failed
*/
- void NotifyListenersOnHandshakeFailed() OVERRIDE;
+ void NotifyListenersOnGetSystemTimeFailed() OVERRIDE;
/**
* @brief Check is policy certificate data is empty
@@ -220,6 +214,16 @@ class SecurityManagerImpl : public SecurityManager,
*/
static const char* ConfigSection();
+ void ProcessFailedPTU() OVERRIDE;
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ /**
+ * @brief ProcessFailedCertDecrypt is called to notify listeners that
+ * certificate decryption failed in the external flow
+ */
+ void ProcessFailedCertDecrypt() OVERRIDE;
+#endif
+
private:
/**
* \brief Sends Handshake binary data to mobile application
@@ -286,6 +290,17 @@ class SecurityManagerImpl : public SecurityManager,
*/
void OnSystemTimeArrived(const time_t utc_time) OVERRIDE;
+ /**
+ * @brief OnSystemTimeFailed Notify about system request failure
+ */
+ void OnSystemTimeFailed() OVERRIDE;
+
+ /**
+ * @brief ResetPendingSystemTimeRequests resets waiting for system time
+ * requests flag
+ */
+ void ResetPendingSystemTimeRequests();
+
// Thread that pumps handshake data
SecurityMessageLoop security_messages_;
diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc
index 84c5db7c0e..48b3119bec 100644
--- a/src/components/security_manager/src/crypto_manager_impl.cc
+++ b/src/components/security_manager/src/crypto_manager_impl.cc
@@ -33,22 +33,22 @@
#include "security_manager/crypto_manager_impl.h"
#include <openssl/bio.h>
-#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/pkcs12.h>
+#include <openssl/ssl.h>
-#include <fstream>
-#include <iostream>
#include <stdio.h>
-#include <ctime>
#include <algorithm>
+#include <ctime>
+#include <fstream>
+#include <iostream>
#include "security_manager/security_manager.h"
-#include "utils/logger.h"
#include "utils/atomic.h"
+#include "utils/date_time.h"
+#include "utils/logger.h"
#include "utils/macro.h"
#include "utils/scope_guard.h"
-#include "utils/date_time.h"
#define TLS1_1_MINIMAL_VERSION 0x1000103fL
#define CONST_SSL_METHOD_MINIMAL_VERSION 0x00909000L
@@ -84,10 +84,10 @@ void free_ctx(SSL_CTX** ctx) {
*ctx = NULL;
}
}
-}
+} // namespace
CryptoManagerImpl::CryptoManagerImpl(
- const utils::SharedPtr<const CryptoManagerSettings> set)
+ const std::shared_ptr<const CryptoManagerSettings> set)
: settings_(set), context_(NULL) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(instance_lock_);
@@ -156,9 +156,9 @@ bool CryptoManagerImpl::Init() {
LOG4CXX_DEBUG(logger_,
"Peer verification "
<< (get_settings().verify_peer() ? "enabled" : "disabled"));
- LOG4CXX_DEBUG(logger_,
- "CA certificate file is \"" << get_settings().ca_cert_path()
- << '"');
+ LOG4CXX_DEBUG(
+ logger_,
+ "CA certificate file is \"" << get_settings().ca_cert_path() << '"');
#if OPENSSL_VERSION_NUMBER < CONST_SSL_METHOD_MINIMAL_VERSION
SSL_METHOD* method;
@@ -283,6 +283,7 @@ bool CryptoManagerImpl::Init() {
bool CryptoManagerImpl::OnCertificateUpdated(const std::string& data) {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(crypto_manager_lock_);
if (!context_) {
LOG4CXX_WARN(logger_, "Not initialized");
return false;
@@ -307,6 +308,8 @@ bool CryptoManagerImpl::OnCertificateUpdated(const std::string& data) {
}
SSLContext* CryptoManagerImpl::CreateSSLContext() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(crypto_manager_lock_);
if (NULL == context_) {
return NULL;
}
@@ -354,8 +357,8 @@ bool CryptoManagerImpl::IsCertificateUpdateRequired(
return true;
}
- return seconds <= (get_settings().update_before_hours() *
- date_time::DateTime::SECONDS_IN_HOUR);
+ return seconds <=
+ (get_settings().update_before_hours() * date_time::SECONDS_IN_HOUR);
}
const CryptoManagerSettings& CryptoManagerImpl::get_settings() const {
@@ -387,9 +390,9 @@ bool CryptoManagerImpl::SaveCertificateData(
UNUSED(cert_guard);
if (1 != BIO_reset(bio_cert)) {
- LOG4CXX_WARN(logger_,
- "Unabled to reset BIO in order to read private key, "
- << LastError());
+ LOG4CXX_WARN(
+ logger_,
+ "Unabled to reset BIO in order to read private key, " << LastError());
}
EVP_PKEY* pkey = NULL;
diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc
index 1faaddee1c..a24e48289d 100644
--- a/src/components/security_manager/src/security_manager_impl.cc
+++ b/src/components/security_manager/src/security_manager_impl.cc
@@ -32,12 +32,13 @@
#include "security_manager/security_manager_impl.h"
#include <functional>
-#include "security_manager/crypto_manager_impl.h"
+#include "json/json.h"
#include "protocol_handler/protocol_packet.h"
-#include "utils/logger.h"
+#include "security_manager/crypto_manager_impl.h"
#include "utils/byte_order.h"
-#include "json/json.h"
#include "utils/helpers.h"
+#include "utils/jsoncpp_reader_wrapper.h"
+#include "utils/logger.h"
namespace security_manager {
@@ -69,7 +70,7 @@ void SecurityManagerImpl::OnMessageReceived(
return;
}
- SecurityMessage securityMessagePtr(new SecurityQuery());
+ SecurityMessage securityMessagePtr(std::make_shared<SecurityQuery>());
const bool result =
securityMessagePtr->SerializeQuery(message->data(), message->data_size());
if (!result) {
@@ -213,6 +214,13 @@ void SecurityManagerImpl::ResumeHandshake(uint32_t connection_key) {
return;
}
+ LOG4CXX_DEBUG(logger_,
+ "Connection key : "
+ << connection_key
+ << " is waiting for certificate: " << std::boolalpha
+ << waiting_for_certificate_ << " and has certificate: "
+ << ssl_context->HasCertificate());
+
ssl_context->ResetConnection();
if (!waiting_for_certificate_ && !ssl_context->HasCertificate()) {
NotifyListenersOnHandshakeDone(connection_key,
@@ -228,6 +236,7 @@ void SecurityManagerImpl::StartHandshake(uint32_t connection_key) {
LOG4CXX_INFO(logger_, "StartHandshake: connection_key " << connection_key);
security_manager::SSLContext* ssl_context = session_observer_->GetSSLContext(
connection_key, protocol_handler::kControl);
+
if (!ssl_context) {
const std::string error_text(
"StartHandshake failed, "
@@ -277,6 +286,7 @@ void SecurityManagerImpl::ProceedHandshake(
time_t cert_due_date;
if (!ssl_context->GetCertificateDueDate(cert_due_date)) {
LOG4CXX_ERROR(logger_, "Failed to get certificate due date!");
+ PostponeHandshake(connection_key);
return;
}
@@ -388,6 +398,68 @@ void SecurityManagerImpl::OnSystemTimeArrived(const time_t utc_time) {
awaiting_time_connections_.clear();
}
+void SecurityManagerImpl::OnSystemTimeFailed() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ {
+ sync_primitives::AutoLock lock(waiters_lock_);
+ waiting_for_time_ = false;
+ }
+
+ NotifyListenersOnGetSystemTimeFailed();
+
+ awaiting_time_connections_.clear();
+}
+
+void SecurityManagerImpl::ProcessFailedPTU() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (listeners_.empty()) {
+ LOG4CXX_DEBUG(logger_, "listeners arrays IS EMPTY!");
+ return;
+ }
+
+ std::list<SecurityManagerListener*> listeners_to_remove;
+ for (auto listener : listeners_) {
+ if (listener->OnPTUFailed()) {
+ listeners_to_remove.push_back(listener);
+ }
+ }
+
+ for (auto& listener : listeners_to_remove) {
+ auto it = std::find(listeners_.begin(), listeners_.end(), listener);
+ DCHECK(it != listeners_.end());
+ LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it);
+ delete (*it);
+ listeners_.erase(it);
+ }
+}
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+void SecurityManagerImpl::ProcessFailedCertDecrypt() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ {
+ sync_primitives::AutoLock lock(waiters_lock_);
+ waiting_for_certificate_ = false;
+ }
+
+ std::list<SecurityManagerListener*> listeners_to_remove;
+ for (auto listener : listeners_) {
+ if (listener->OnCertDecryptFailed()) {
+ listeners_to_remove.push_back(listener);
+ }
+ }
+
+ for (auto& listener : listeners_to_remove) {
+ auto it = std::find(listeners_.begin(), listeners_.end(), listener);
+ DCHECK(it != listeners_.end());
+ LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it);
+ delete (*it);
+ listeners_.erase(it);
+ }
+
+ awaiting_certificate_connections_.clear();
+}
+#endif
+
void SecurityManagerImpl::NotifyListenersOnHandshakeDone(
const uint32_t& connection_key, SSLContext::HandshakeResult error) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -403,10 +475,6 @@ void SecurityManagerImpl::NotifyListenersOnHandshakeDone(
}
}
-void SecurityManagerImpl::NotifyOnCertififcateUpdateRequired() {
- NotifyOnCertificateUpdateRequired();
-}
-
void SecurityManagerImpl::NotifyOnCertificateUpdateRequired() {
LOG4CXX_AUTO_TRACE(logger_);
std::list<SecurityManagerListener*>::iterator it = listeners_.begin();
@@ -416,11 +484,15 @@ void SecurityManagerImpl::NotifyOnCertificateUpdateRequired() {
}
}
-void SecurityManagerImpl::NotifyListenersOnHandshakeFailed() {
+void SecurityManagerImpl::ResetPendingSystemTimeRequests() {
+ system_time_handler_->ResetPendingSystemTimeRequests();
+}
+
+void SecurityManagerImpl::NotifyListenersOnGetSystemTimeFailed() {
LOG4CXX_AUTO_TRACE(logger_);
std::list<SecurityManagerListener*>::iterator it = listeners_.begin();
while (it != listeners_.end()) {
- if ((*it)->OnHandshakeFailed()) {
+ if ((*it)->OnGetSystemTimeFailed()) {
LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it);
delete (*it);
it = listeners_.erase(it);
@@ -452,9 +524,9 @@ bool SecurityManagerImpl::ProccessHandshakeData(
const uint32_t seqNumber = inMessage->get_header().seq_number;
const uint32_t connection_key = inMessage->get_connection_key();
- LOG4CXX_DEBUG(logger_,
- "Received " << inMessage->get_data_size()
- << " bytes handshake data ");
+ LOG4CXX_DEBUG(
+ logger_,
+ "Received " << inMessage->get_data_size() << " bytes handshake data ");
if (!inMessage->get_data_size()) {
const std::string error_text("SendHandshakeData: null arguments size.");
@@ -518,11 +590,13 @@ bool SecurityManagerImpl::ProccessInternalError(
"Received InternalError with Json message"
<< inMessage->get_json_message());
Json::Value root;
- Json::Reader reader;
- const bool parsingSuccessful =
- reader.parse(inMessage->get_json_message(), root);
- if (!parsingSuccessful)
+ std::string str = inMessage->get_json_message();
+ utils::JsonReader reader;
+
+ if (!reader.parse(str, &root)) {
+ LOG4CXX_DEBUG(logger_, "Json parsing fails.");
return false;
+ }
LOG4CXX_DEBUG(logger_,
"Received InternalError id "
<< root[kErrId].asString()
@@ -586,10 +660,11 @@ void SecurityManagerImpl::SendQuery(const SecurityQuery& query,
protocol_version,
&data_sending[0],
data_sending.size(),
+ false,
protocol_handler::kControl));
DCHECK(protocol_handler_);
// Add RawMessage to ProtocolHandler message query
- protocol_handler_->SendMessageToMobileApp(rawMessagePtr, false);
+ protocol_handler_->SendMessageToMobileApp(rawMessagePtr, false, false);
}
}
diff --git a/src/components/security_manager/src/security_query.cc b/src/components/security_manager/src/security_query.cc
index 60233dde5e..fecfc4d723 100644
--- a/src/components/security_manager/src/security_query.cc
+++ b/src/components/security_manager/src/security_query.cc
@@ -32,8 +32,8 @@
#include "security_manager/security_query.h"
#include <cstring>
-#include "utils/macro.h"
#include "utils/byte_order.h"
+#include "utils/macro.h"
namespace security_manager {
diff --git a/src/components/security_manager/src/ssl_context_impl.cc b/src/components/security_manager/src/ssl_context_impl.cc
index 67be17db63..d5c892c07a 100644
--- a/src/components/security_manager/src/ssl_context_impl.cc
+++ b/src/components/security_manager/src/ssl_context_impl.cc
@@ -33,14 +33,14 @@
#include <assert.h>
#include <memory.h>
-#include <map>
+#include <time.h>
#include <algorithm>
+#include <map>
#include <vector>
-#include <time.h>
#include <openssl/bio.h>
-#include <openssl/ssl.h>
#include <openssl/err.h>
+#include <openssl/ssl.h>
#include "utils/macro.h"
@@ -249,9 +249,9 @@ CryptoManagerImpl::SSLContextImpl::CheckCertContext() {
<< start_seconds << " seconds");
return Handshake_Result_NotYetValid;
} else {
- LOG4CXX_DEBUG(logger_,
- "Time since certificate validity " << start_seconds
- << "seconds");
+ LOG4CXX_DEBUG(
+ logger_,
+ "Time since certificate validity " << start_seconds << "seconds");
}
if (end_seconds < 0) {
@@ -529,13 +529,18 @@ bool CryptoManagerImpl::SSLContextImpl::Decrypt(const uint8_t* const in_data,
}
size_t CryptoManagerImpl::SSLContextImpl::get_max_block_size(size_t mtu) const {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!max_block_size_) {
// FIXME(EZamakhov): add correct logics for TLS1/1.2/SSL3
// For SSL3.0 set temporary value 90, old TLS1.2 value is 29
assert(mtu > 90);
return mtu - 90;
}
- return max_block_size_(mtu);
+
+ const auto max_allowed_block_size =
+ mtu > SSL3_RT_MAX_PLAIN_LENGTH ? SSL3_RT_MAX_PLAIN_LENGTH : mtu;
+
+ return max_block_size_(max_allowed_block_size);
}
bool CryptoManagerImpl::SSLContextImpl::IsHandshakePending() const {
diff --git a/src/components/security_manager/test/crypto_manager_impl_test.cc b/src/components/security_manager/test/crypto_manager_impl_test.cc
index 74b071793d..d30fa5ef23 100644
--- a/src/components/security_manager/test/crypto_manager_impl_test.cc
+++ b/src/components/security_manager/test/crypto_manager_impl_test.cc
@@ -35,18 +35,17 @@
#else
#include <openssl/ssl.h>
#endif //__QNXNTO__
-#include <limits>
#include <fstream>
+#include <limits>
#include <sstream>
-#include "utils/make_shared.h"
#include "gtest/gtest.h"
#include "security_manager/crypto_manager_impl.h"
#include "security_manager/mock_security_manager_settings.h"
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
namespace {
const size_t kUpdatesBeforeHour = 24;
@@ -63,7 +62,7 @@ const std::string kFordCipher = SSL3_TXT_RSA_DES_192_CBC3_SHA;
// Used cipher from ford protocol requirement
const std::string kFordCipher = TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384;
#endif
-}
+} // namespace
namespace test {
namespace components {
@@ -90,9 +89,9 @@ class CryptoManagerTest : public testing::Test {
void SetUp() OVERRIDE {
ASSERT_FALSE(certificate_data_base64_.empty());
mock_security_manager_settings_ =
- utils::MakeShared<MockCryptoManagerSettings>();
+ std::make_shared<MockCryptoManagerSettings>();
crypto_manager_ =
- utils::MakeShared<CryptoManagerImpl>(mock_security_manager_settings_);
+ std::make_shared<CryptoManagerImpl>(mock_security_manager_settings_);
forced_protected_services_.reserve(kMaxSizeVector);
forced_unprotected_services_.reserve(kMaxSizeVector);
}
@@ -129,8 +128,8 @@ class CryptoManagerTest : public testing::Test {
.WillByDefault(Return(false));
}
- utils::SharedPtr<CryptoManagerImpl> crypto_manager_;
- utils::SharedPtr<MockCryptoManagerSettings> mock_security_manager_settings_;
+ std::shared_ptr<CryptoManagerImpl> crypto_manager_;
+ std::shared_ptr<MockCryptoManagerSettings> mock_security_manager_settings_;
static std::string certificate_data_base64_;
std::vector<int> forced_protected_services_;
std::vector<int> forced_unprotected_services_;
diff --git a/src/components/security_manager/test/security_manager_test.cc b/src/components/security_manager/test/security_manager_test.cc
index 3523bb7f44..7906ae7006 100644
--- a/src/components/security_manager/test/security_manager_test.cc
+++ b/src/components/security_manager/test/security_manager_test.cc
@@ -30,50 +30,50 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include <memory>
+#include <string>
#include "gtest/gtest.h"
-#include "utils/byte_order.h"
#include "protocol/common.h"
#include "security_manager/security_manager_impl.h"
+#include "utils/byte_order.h"
#include "protocol_handler/mock_protocol_handler.h"
#include "protocol_handler/mock_session_observer.h"
-#include "security_manager/mock_security_manager.h"
-#include "security_manager/mock_ssl_context.h"
#include "security_manager/mock_crypto_manager.h"
+#include "security_manager/mock_security_manager.h"
#include "security_manager/mock_security_manager_listener.h"
+#include "security_manager/mock_ssl_context.h"
#include "utils/mock_system_time_handler.h"
-#include "utils/make_shared.h"
+
#include "utils/test_async_waiter.h"
namespace test {
namespace components {
namespace security_manager_test {
-using protocol_handler::PROTOCOL_VERSION_2;
-using protocol_handler::ServiceType;
-using protocol_handler::kControl;
-using protocol_handler::kRpc;
using protocol_handler::kAudio;
-using protocol_handler::kMobileNav;
using protocol_handler::kBulk;
+using protocol_handler::kControl;
using protocol_handler::kInvalidServiceType;
-using protocol_handler::RawMessagePtr;
+using protocol_handler::kMobileNav;
+using protocol_handler::kRpc;
+using protocol_handler::PROTOCOL_VERSION_2;
using protocol_handler::RawMessage;
+using protocol_handler::RawMessagePtr;
+using protocol_handler::ServiceType;
-using security_manager::SecurityQuery;
-using security_manager::SSLContext;
using security_manager::SecurityManager;
using security_manager::SecurityManagerImpl;
+using security_manager::SecurityQuery;
+using security_manager::SSLContext;
using security_manager_test::InternalErrorWithErrId;
+using ::testing::_;
+using ::testing::DoAll;
using ::testing::Return;
using ::testing::ReturnNull;
-using ::testing::DoAll;
using ::testing::SetArgPointee;
-using ::testing::_;
namespace {
// Sample data for handshake data emulation
@@ -92,7 +92,7 @@ uint8_t* handshake_data_out_pointer = handshake_data_out;
const size_t handshake_data_out_size =
sizeof(handshake_data_out) / sizeof(handshake_data_out[0]);
const uint32_t kAsyncExpectationsTimeout = 10000u;
-}
+} // namespace
class SecurityManagerTest : public ::testing::Test {
protected:
@@ -104,8 +104,9 @@ class SecurityManagerTest : public ::testing::Test {
void SetUp() OVERRIDE {
security_manager_->set_session_observer(&mock_session_observer);
security_manager_->set_protocol_handler(&mock_protocol_handler);
- mock_sm_listener.reset(new testing::StrictMock<
- security_manager_test::MockSecurityManagerListener>());
+ mock_sm_listener.reset(
+ new testing::StrictMock<
+ security_manager_test::MockSecurityManagerListener>());
security_manager_->AddListener(mock_sm_listener.get());
}
@@ -120,8 +121,8 @@ class SecurityManagerTest : public ::testing::Test {
void call_OnMessageReceived(const uint8_t* const data,
uint32_t dataSize,
const ServiceType serviceType) {
- const RawMessagePtr rawMessagePtr(utils::MakeShared<RawMessage>(
- kKey, kProtocolVersion, data, dataSize, serviceType));
+ const RawMessagePtr rawMessagePtr(std::make_shared<RawMessage>(
+ kKey, kProtocolVersion, data, dataSize, false, serviceType));
security_manager_->OnMessageReceived(rawMessagePtr);
}
/*
@@ -170,8 +171,9 @@ class SecurityManagerTest : public ::testing::Test {
mock_ssl_context_new;
testing::StrictMock<security_manager_test::MockSSLContext>
mock_ssl_context_exists;
- std::unique_ptr<testing::StrictMock<
- security_manager_test::MockSecurityManagerListener> > mock_sm_listener;
+ std::unique_ptr<
+ testing::StrictMock<security_manager_test::MockSecurityManagerListener> >
+ mock_sm_listener;
std::unique_ptr<MockSystemTimeHandler> mock_system_time_handler;
std::shared_ptr<SecurityManagerImpl> security_manager_;
};
@@ -290,7 +292,9 @@ TEST_F(SecurityManagerTest, SecurityManager_NULLCryptoManager) {
EXPECT_CALL(mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_NOT_SUPPORTED),
- kIsFinal)).WillOnce(NotifyTestAsyncWaiter(&waiter));
+ false,
+ kIsFinal))
+ .WillOnce(NotifyTestAsyncWaiter(&waiter));
const SecurityQuery::QueryHeader header(SecurityQuery::REQUEST,
// It could be any query id
SecurityQuery::INVALID_QUERY_ID);
@@ -304,8 +308,8 @@ TEST_F(SecurityManagerTest, SecurityManager_NULLCryptoManager) {
*/
TEST_F(SecurityManagerTest, OnMobileMessageSent) {
const uint8_t* data_param = NULL;
- const RawMessagePtr rawMessagePtr(
- utils::MakeShared<RawMessage>(kKey, kProtocolVersion, data_param, 0));
+ const RawMessagePtr rawMessagePtr(std::make_shared<RawMessage>(
+ kKey, kProtocolVersion, data_param, 0, false));
security_manager_->OnMobileMessageSent(rawMessagePtr);
}
/*
@@ -335,6 +339,7 @@ TEST_F(SecurityManagerTest, GetEmptyQuery) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_SIZE),
+ false,
kIsFinal));
// Call with NULL data
call_OnMessageReceived(NULL, 0, kSecureServiceType);
@@ -356,6 +361,7 @@ TEST_F(SecurityManagerTest, GetWrongJSONSize) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_SIZE),
+ false,
kIsFinal));
SecurityQuery::QueryHeader header(SecurityQuery::REQUEST,
SecurityQuery::INVALID_QUERY_ID);
@@ -385,7 +391,9 @@ TEST_F(SecurityManagerTest, GetInvalidQueryId) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_ID),
- kIsFinal)).WillOnce(NotifyTestAsyncWaiter(&waiter));
+ false,
+ kIsFinal))
+ .WillOnce(NotifyTestAsyncWaiter(&waiter));
times++;
const SecurityQuery::QueryHeader header(SecurityQuery::REQUEST,
SecurityQuery::INVALID_QUERY_ID);
@@ -423,10 +431,11 @@ TEST_F(SecurityManagerTest, CreateSSLContext_ErrorCreateSSL) {
EXPECT_CALL(mock_session_observer,
ProtocolVersionUsed(connection_id, session_id, _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp(
- InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL), kIsFinal));
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL),
+ false,
+ kIsFinal));
// Emulate SessionObserver and CryptoManager result
EXPECT_CALL(mock_session_observer, GetSSLContext(kKey, kControl))
@@ -457,6 +466,7 @@ TEST_F(SecurityManagerTest, CreateSSLContext_SetSSLContextError) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_UNKNOWN_INTERNAL_ERROR),
+ false,
kIsFinal));
// Emulate SessionObserver and CryptoManager result
@@ -508,10 +518,11 @@ TEST_F(SecurityManagerTest, StartHandshake_ServiceStillUnprotected) {
ProtocolVersionUsed(connection_id, session_id, _))
.WillOnce(Return(true));
// Expect InternalError with ERROR_INTERNAL
- EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp(
- InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL), kIsFinal));
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL),
+ false,
+ kIsFinal));
// Expect notifying listeners (unsuccess)
EXPECT_CALL(*mock_sm_listener,
OnHandshakeDone(kKey, SSLContext::Handshake_Result_Fail))
@@ -546,10 +557,11 @@ TEST_F(SecurityManagerTest, StartHandshake_SSLInternalError) {
EXPECT_CALL(mock_session_observer, GetSSLContext(kKey, kControl))
.WillOnce(ReturnNull());
// Expect InternalError with ERROR_ID
- EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp(
- InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL), kIsFinal));
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL),
+ false,
+ kIsFinal));
security_manager_->StartHandshake(kKey);
mock_sm_listener.release();
@@ -575,7 +587,9 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_WrongDataSize) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_SIZE),
- kIsFinal)).WillOnce(NotifyTestAsyncWaiter(&waiter));
+ false,
+ kIsFinal))
+ .WillOnce(NotifyTestAsyncWaiter(&waiter));
EmulateMobileMessageHandshake(NULL, 0);
@@ -606,7 +620,9 @@ TEST_F(SecurityManagerTest,
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_SERVICE_NOT_PROTECTED),
- kIsFinal)).WillOnce(NotifyTestAsyncWaiter(&waiter));
+ false,
+ kIsFinal))
+ .WillOnce(NotifyTestAsyncWaiter(&waiter));
times++;
// Expect notifying listeners (unsuccess)
@@ -659,6 +675,7 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_InvalidData) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_SSL_INVALID_DATA),
+ false,
kIsFinal))
.Times(handshake_emulates)
.WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
@@ -737,9 +754,9 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_Answer) {
// Get size of raw message after
const size_t raw_message_size = 15;
- EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp(RawMessageEqSize(raw_message_size), kIsFinal))
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(
+ RawMessageEqSize(raw_message_size), false, kIsFinal))
.Times(handshake_emulates)
.WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
times += handshake_emulates;
@@ -866,7 +883,7 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_HandshakeFinished) {
.WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
times += 2; // matches to the number above
- EXPECT_CALL(mock_protocol_handler, SendMessageToMobileApp(_, kIsFinal))
+ EXPECT_CALL(mock_protocol_handler, SendMessageToMobileApp(_, false, kIsFinal))
.Times(2)
.WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
times += 2; // matches to the number above
diff --git a/src/components/security_manager/test/security_query_matcher.cc b/src/components/security_manager/test/security_query_matcher.cc
index 3b7f4dd298..1bf22bf8cd 100644
--- a/src/components/security_manager/test/security_query_matcher.cc
+++ b/src/components/security_manager/test/security_query_matcher.cc
@@ -33,8 +33,8 @@
#include <string>
#include "gmock/gmock.h"
-#include "utils/byte_order.h"
#include "security_manager/security_query.h"
+#include "utils/byte_order.h"
namespace test {
namespace components {
diff --git a/src/components/security_manager/test/security_query_test.cc b/src/components/security_manager/test/security_query_test.cc
index 80da10ea72..6becddaaf9 100644
--- a/src/components/security_manager/test/security_query_test.cc
+++ b/src/components/security_manager/test/security_query_test.cc
@@ -30,14 +30,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <vector>
#include <string>
+#include <vector>
#include "gtest/gtest.h"
-#include "security_manager/security_query.h"
#include "protocol_handler/protocol_payload.h"
-#include "utils/byte_order.h"
#include "security_manager/mock_security_manager.h"
+#include "security_manager/security_query.h"
+#include "utils/byte_order.h"
// Test values for compare after serialization and byteorder conversion
#define SEQ_NUMBER 0x12345678u
diff --git a/src/components/security_manager/test/ssl_certificate_handshake_test.cc b/src/components/security_manager/test/ssl_certificate_handshake_test.cc
index 83ffa33b44..1034bb3c83 100644
--- a/src/components/security_manager/test/ssl_certificate_handshake_test.cc
+++ b/src/components/security_manager/test/ssl_certificate_handshake_test.cc
@@ -87,14 +87,14 @@ class SSLHandshakeTest : public testing::TestWithParam<Protocol> {
security_manager_test::MockCryptoManagerSettings>();
server_manager_ = new security_manager::CryptoManagerImpl(
- utils::SharedPtr<security_manager::CryptoManagerSettings>(
+ std::shared_ptr<security_manager::CryptoManagerSettings>(
mock_server_manager_settings_));
ASSERT_TRUE(server_manager_);
mock_client_manager_settings_ = new testing::NiceMock<
security_manager_test::MockCryptoManagerSettings>();
client_manager_ = new security_manager::CryptoManagerImpl(
- utils::SharedPtr<security_manager::CryptoManagerSettings>(
+ std::shared_ptr<security_manager::CryptoManagerSettings>(
mock_client_manager_settings_));
ASSERT_TRUE(client_manager_);
server_ctx_ = NULL;
diff --git a/src/components/security_manager/test/ssl_context_test.cc b/src/components/security_manager/test/ssl_context_test.cc
index 20e509ebc6..e4d6c308bb 100644
--- a/src/components/security_manager/test/ssl_context_test.cc
+++ b/src/components/security_manager/test/ssl_context_test.cc
@@ -30,23 +30,21 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
+#include <openssl/ssl.h>
#include <fstream>
#include <sstream>
#include <string>
-#include <openssl/ssl.h>
+#include "gtest/gtest.h"
#include "security_manager/crypto_manager.h"
#include "security_manager/crypto_manager_impl.h"
+#include "security_manager/mock_security_manager_settings.h"
#include "security_manager/ssl_context.h"
#include "utils/custom_string.h"
-#include "security_manager/mock_security_manager_settings.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
namespace {
const std::string kCaPath = "";
@@ -100,20 +98,20 @@ class SSLTest : public testing::Test {
static void SetCertificate(const std::string& file_name,
std::string& out_certificate_data) {
std::ifstream certificate_file(file_name.c_str());
- ASSERT_TRUE(certificate_file.is_open()) << "Could not open " << file_name
- << "certificate data file";
+ ASSERT_TRUE(certificate_file.is_open())
+ << "Could not open " << file_name << "certificate data file";
std::stringstream certificate;
certificate << certificate_file.rdbuf();
certificate_file.close();
out_certificate_data = certificate.str();
- ASSERT_FALSE(out_certificate_data.empty()) << file_name
- << " data file is empty";
+ ASSERT_FALSE(out_certificate_data.empty())
+ << file_name << " data file is empty";
}
virtual void SetUp() OVERRIDE {
- mock_crypto_manager_settings_ = utils::MakeShared<
+ mock_crypto_manager_settings_ = std::make_shared<
NiceMock<security_manager_test::MockCryptoManagerSettings> >();
- utils::SharedPtr<security_manager::CryptoManagerSettings> crypto_set(
+ std::shared_ptr<security_manager::CryptoManagerSettings> crypto_set(
mock_crypto_manager_settings_);
crypto_manager_ = new security_manager::CryptoManagerImpl(crypto_set);
@@ -143,9 +141,9 @@ class SSLTest : public testing::Test {
const bool crypto_manager_initialization = crypto_manager_->Init();
EXPECT_TRUE(crypto_manager_initialization);
- mock_client_manager_settings_ = utils::MakeShared<
+ mock_client_manager_settings_ = std::make_shared<
NiceMock<security_manager_test::MockCryptoManagerSettings> >();
- utils::SharedPtr<security_manager::CryptoManagerSettings> client_crypto(
+ std::shared_ptr<security_manager::CryptoManagerSettings> client_crypto(
mock_client_manager_settings_);
client_manager_ = new security_manager::CryptoManagerImpl(client_crypto);
@@ -213,9 +211,9 @@ class SSLTest : public testing::Test {
const size_t kMaximumPayloadSize = 1000u;
security_manager::CryptoManager* crypto_manager_;
security_manager::CryptoManager* client_manager_;
- utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings> >
+ std::shared_ptr<NiceMock<security_manager_test::MockCryptoManagerSettings> >
mock_crypto_manager_settings_;
- utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings> >
+ std::shared_ptr<NiceMock<security_manager_test::MockCryptoManagerSettings> >
mock_client_manager_settings_;
security_manager::SSLContext* server_ctx_;
security_manager::SSLContext* client_ctx_;
@@ -244,9 +242,9 @@ class SSLTestParam : public testing::TestWithParam<ProtocolAndCipher> {
ASSERT_FALSE(certificate.empty()) << "Certificate data file is empty";
certificate_data_base64_ = certificate;
- mock_crypto_manager_settings_ = utils::MakeShared<
+ mock_crypto_manager_settings_ = std::make_shared<
NiceMock<security_manager_test::MockCryptoManagerSettings> >();
- utils::SharedPtr<security_manager::CryptoManagerSettings> server_crypto(
+ std::shared_ptr<security_manager::CryptoManagerSettings> server_crypto(
mock_crypto_manager_settings_);
crypto_manager_ = new security_manager::CryptoManagerImpl(server_crypto);
@@ -256,10 +254,10 @@ class SSLTestParam : public testing::TestWithParam<ProtocolAndCipher> {
const bool crypto_manager_initialization = crypto_manager_->Init();
EXPECT_TRUE(crypto_manager_initialization);
- mock_client_manager_settings_ = utils::MakeShared<
+ mock_client_manager_settings_ = std::make_shared<
NiceMock<security_manager_test::MockCryptoManagerSettings> >();
- utils::SharedPtr<security_manager::CryptoManagerSettings> client_crypto(
+ std::shared_ptr<security_manager::CryptoManagerSettings> client_crypto(
mock_client_manager_settings_);
client_manager_ = new security_manager::CryptoManagerImpl(client_crypto);
@@ -343,9 +341,9 @@ class SSLTestParam : public testing::TestWithParam<ProtocolAndCipher> {
.WillByDefault(ReturnRef(kClientPrivateKeyPath));
}
- utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings> >
+ std::shared_ptr<NiceMock<security_manager_test::MockCryptoManagerSettings> >
mock_crypto_manager_settings_;
- utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings> >
+ std::shared_ptr<NiceMock<security_manager_test::MockCryptoManagerSettings> >
mock_client_manager_settings_;
security_manager::CryptoManager* crypto_manager_;
security_manager::CryptoManager* client_manager_;
diff --git a/src/components/smart_objects/CMakeLists.txt b/src/components/smart_objects/CMakeLists.txt
index 84da05ce03..6bc70f8226 100644
--- a/src/components/smart_objects/CMakeLists.txt
+++ b/src/components/smart_objects/CMakeLists.txt
@@ -34,6 +34,8 @@ include_directories(
${COMPONENTS_DIR}/include
${COMPONENTS_DIR}/smart_objects/include
${COMPONENTS_DIR}/utils/include
+ ${CMAKE_BINARY_DIR}/src/components/interfaces
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
@@ -44,6 +46,7 @@ collect_sources(SOURCES "${PATHS}")
add_library("SmartObjects" ${SOURCES})
target_link_libraries("SmartObjects" Utils)
+add_dependencies("SmartObjects" MOBILE_API)
if(ENABLE_LOG)
target_link_libraries("SmartObjects" log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
diff --git a/src/components/smart_objects/include/smart_objects/always_false_schema_item.h b/src/components/smart_objects/include/smart_objects/always_false_schema_item.h
index cdddcfed55..05c53ec582 100644
--- a/src/components/smart_objects/include/smart_objects/always_false_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/always_false_schema_item.h
@@ -33,11 +33,10 @@
#ifndef SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ALWAYS_FALSE_SCHEMA_ITEM_H_
#define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ALWAYS_FALSE_SCHEMA_ITEM_H_
-#include "utils/shared_ptr.h"
#include "smart_objects/schema_item.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
/**
* @brief Always false schema item.
**/
@@ -47,27 +46,29 @@ class CAlwaysFalseSchemaItem : public ISchemaItem {
* @brief Create a new schema item.
* @return Shared pointer to a new schema item.
**/
- static utils::SharedPtr<CAlwaysFalseSchemaItem> create();
- /**
- * @deprecated
- * @brief Validate smart object.
- * @param Object Object to validate.
- * @return Errors::ERROR
- **/
- Errors::eType validate(const SmartObject& Object) OVERRIDE;
+ static std::shared_ptr<CAlwaysFalseSchemaItem> create();
+
/**
* @brief Validate smart object.
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
- * @return Errors::ERROR
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
+ * @return ns_smart_objects::errors::eType
**/
- Errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
private:
CAlwaysFalseSchemaItem();
DISALLOW_COPY_AND_ASSIGN(CAlwaysFalseSchemaItem);
};
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ALWAYS_FALSE_SCHEMA_ITEM_H_
diff --git a/src/components/smart_objects/include/smart_objects/always_true_schema_item.h b/src/components/smart_objects/include/smart_objects/always_true_schema_item.h
index e078ae3240..a2d305d0f9 100644
--- a/src/components/smart_objects/include/smart_objects/always_true_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/always_true_schema_item.h
@@ -33,11 +33,10 @@
#ifndef SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ALWAYS_TRUE_SCHEMA_ITEM_H_
#define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ALWAYS_TRUE_SCHEMA_ITEM_H_
-#include "utils/shared_ptr.h"
#include "smart_objects/schema_item.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
/**
* @brief Always true schema item.
**/
@@ -47,27 +46,29 @@ class CAlwaysTrueSchemaItem : public ISchemaItem {
* @brief Create a new schema item.
* @return Shared pointer to a new schema item.
**/
- static utils::SharedPtr<CAlwaysTrueSchemaItem> create();
- /**
- * @deprecated
- * @brief Validate smart object.
- * @param Object Object to validate.
- * @return NsSmartObjects::Errors::eType
- **/
- Errors::eType validate(const SmartObject& Object) OVERRIDE;
+ static std::shared_ptr<CAlwaysTrueSchemaItem> create();
+
/**
* @brief Validate smart object.
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
- * @return NsSmartObjects::Errors::eType
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
+ * @return ns_smart_objects::errors::eType
**/
- Errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
private:
CAlwaysTrueSchemaItem();
DISALLOW_COPY_AND_ASSIGN(CAlwaysTrueSchemaItem);
};
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ALWAYS_TRUE_SCHEMA_ITEM_H_
diff --git a/src/components/smart_objects/include/smart_objects/array_schema_item.h b/src/components/smart_objects/include/smart_objects/array_schema_item.h
index 937979f2fa..0e19d2237e 100644
--- a/src/components/smart_objects/include/smart_objects/array_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/array_schema_item.h
@@ -34,13 +34,14 @@
#include <stddef.h>
-#include "utils/shared_ptr.h"
-#include "smart_objects/schema_item.h"
#include "smart_objects/always_true_schema_item.h"
+#include "smart_objects/schema_item.h"
#include "smart_objects/schema_item_parameter.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+#include "utils/semantic_version.h"
+
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
/**
* @brief Array schema item.
**/
@@ -55,7 +56,7 @@ class CArraySchemaItem : public ISchemaItem {
*
* @return Shared pointer to a new schema item.
**/
- static utils::SharedPtr<CArraySchemaItem> create(
+ static std::shared_ptr<CArraySchemaItem> create(
const ISchemaItemPtr ElementSchemaItem = CAlwaysTrueSchemaItem::create(),
const TSchemaItemParameter<size_t>& MinSize =
TSchemaItemParameter<size_t>(),
@@ -63,45 +64,44 @@ class CArraySchemaItem : public ISchemaItem {
TSchemaItemParameter<size_t>());
/**
- * @deprecated
- *
- * @brief Validate smart object.
- *
- * @param Object Object to validate.
- *
- * @return NsSmartObjects::Errors::eType
- **/
- Errors::eType validate(const SmartObject& Object) OVERRIDE;
-
- /**
* @brief Validate smart object.
- *
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
- * message if an error occurs
- *
- * @return NsSmartObjects::Errors::eType
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
+ * @return ns_smart_objects::errors::eType
**/
- Errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
/**
* @brief Apply schema.
*
* @param Object Object to apply schema.
- *
- * @param RemoveFakeParameters contains true if need to remove fake parameters
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* from smart object otherwise contains false.
**/
void applySchema(SmartObject& Object,
- const bool RemoveFakeParameters) OVERRIDE;
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion =
+ utils::SemanticVersion()) OVERRIDE;
/**
* @brief Unapply schema.
*
* @param Object Object to unapply schema.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
**/
- void unapplySchema(SmartObject& Object) OVERRIDE;
+ void unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) OVERRIDE;
/**
* @brief Build smart object by smart schema having copied matched
@@ -138,7 +138,7 @@ class CArraySchemaItem : public ISchemaItem {
const TSchemaItemParameter<size_t> mMaxSize;
DISALLOW_COPY_AND_ASSIGN(CArraySchemaItem);
};
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ARRAY_SCHEMA_ITEM_H_
diff --git a/src/components/smart_objects/include/smart_objects/bool_schema_item.h b/src/components/smart_objects/include/smart_objects/bool_schema_item.h
index eca5a0e063..3a9f6c929d 100644
--- a/src/components/smart_objects/include/smart_objects/bool_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/bool_schema_item.h
@@ -33,12 +33,10 @@
#ifndef SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_BOOL_SCHEMA_ITEM_H_
#define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_BOOL_SCHEMA_ITEM_H_
-#include "utils/shared_ptr.h"
-
#include "smart_objects/default_shema_item.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
/**
* @brief Bool schema item.
**/
@@ -49,7 +47,7 @@ class CBoolSchemaItem : public CDefaultSchemaItem<bool> {
* @param DefaultValue Default value of a parameter.
* @return Shared pointer to a new schema item.
**/
- static utils::SharedPtr<CBoolSchemaItem> create(
+ static std::shared_ptr<CBoolSchemaItem> create(
const TSchemaItemParameter<bool>& DefaultValue =
TSchemaItemParameter<bool>());
@@ -61,6 +59,6 @@ class CBoolSchemaItem : public CDefaultSchemaItem<bool> {
private:
DISALLOW_COPY_AND_ASSIGN(CBoolSchemaItem);
};
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_BOOL_SCHEMA_ITEM_H_
diff --git a/src/components/smart_objects/include/smart_objects/default_shema_item.h b/src/components/smart_objects/include/smart_objects/default_shema_item.h
index 56952dbac1..16dbad4426 100644
--- a/src/components/smart_objects/include/smart_objects/default_shema_item.h
+++ b/src/components/smart_objects/include/smart_objects/default_shema_item.h
@@ -33,14 +33,13 @@
#define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_DEFAULT_SHEMA_ITEM_H_
#include "utils/macro.h"
-#include "utils/shared_ptr.h"
#include "smart_objects/schema_item.h"
#include "smart_objects/schema_item_parameter.h"
#include "smart_objects/smart_object.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
/**
* @brief Default schema item.
@@ -50,20 +49,21 @@ class CDefaultSchemaItem : public ISchemaItem {
public:
typedef TSchemaItemParameter<Type> ParameterType;
/**
- * @deprecated
- * @brief Validate smart object.
- * @param Object Object to validate.
- * @return Errors::ERROR
- **/
- Errors::eType validate(const SmartObject& Object) OVERRIDE;
- /**
* @brief Validate smart object.
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
- * @return Errors::ERROR
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
+ * @return ns_smart_objects::errors::eType
**/
- Errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
/**
* @brief Set default value to an object.
@@ -107,23 +107,20 @@ CDefaultSchemaItem<Type>::CDefaultSchemaItem(const ParameterType& DefaultValue)
: mDefaultValue(DefaultValue) {}
template <typename Type>
-Errors::eType CDefaultSchemaItem<Type>::validate(const SmartObject& Object) {
- rpc::ValidationReport report("RPC");
- return validate(Object, &report);
-}
-
-template <typename Type>
-Errors::eType CDefaultSchemaItem<Type>::validate(
- const SmartObject& Object, rpc::ValidationReport* report__) {
+errors::eType CDefaultSchemaItem<Type>::validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (getSmartType() != Object.getType()) {
- std::string validation_info = "Incorrect type, expected: " +
- SmartObject::typeToString(getSmartType()) +
- ", got: " +
- SmartObject::typeToString(Object.getType());
+ std::string validation_info =
+ "Incorrect type, expected: " +
+ SmartObject::typeToString(getSmartType()) +
+ ", got: " + SmartObject::typeToString(Object.getType());
report__->set_validation_info(validation_info);
- return Errors::INVALID_VALUE;
+ return errors::INVALID_VALUE;
} else {
- return Errors::OK;
+ return errors::OK;
}
}
@@ -149,6 +146,6 @@ void CDefaultSchemaItem<Type>::BuildObjectBySchema(
}
}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_DEFAULT_SHEMA_ITEM_H_
diff --git a/src/components/smart_objects/include/smart_objects/enum_schema_item.h b/src/components/smart_objects/include/smart_objects/enum_schema_item.h
index 524d966188..7fa5a65b35 100644
--- a/src/components/smart_objects/include/smart_objects/enum_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/enum_schema_item.h
@@ -39,11 +39,36 @@
#include <set>
#include <string>
-#include "utils/shared_ptr.h"
#include "smart_objects/default_shema_item.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+#include <boost/optional.hpp>
+#include "utils/semantic_version.h"
+
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
+
+struct ElementSignature {
+ boost::optional<utils::SemanticVersion> mSince;
+ boost::optional<utils::SemanticVersion> mUntil;
+ bool mRemoved;
+
+ ElementSignature(std::string since = "",
+ std::string until = "",
+ bool removed = false) {
+ utils::SemanticVersion since_struct(since);
+ utils::SemanticVersion until_struct(until);
+
+ if (since_struct.isValid()) {
+ mSince = since_struct;
+ }
+
+ if (until_struct.isValid()) {
+ mUntil = until_struct;
+ }
+
+ mRemoved = removed;
+ }
+};
template <typename EnumType>
class EnumConversionHelper;
@@ -60,41 +85,71 @@ class TEnumSchemaItem : public CDefaultSchemaItem<EnumType> {
* @param DefaultValue Default value.
* @return Shared pointer to a new schema item.
**/
- static utils::SharedPtr<TEnumSchemaItem> create(
+ static std::shared_ptr<TEnumSchemaItem> create(
const std::set<EnumType>& AllowedElements,
const TSchemaItemParameter<EnumType>& DefaultValue =
TSchemaItemParameter<EnumType>());
+
/**
- * @deprecated
- * @brief Validate smart object.
- * @param Object Object to validate.
- * @return NsSmartObjects::Errors::eType
+ * @brief Create a new schema item.
+ * @param AllowedElements Set of allowed enumeration elements.
+ * @param DefaultValue Default value.
+ * @return Shared pointer to a new schema item.
**/
- Errors::eType validate(const SmartObject& Object) OVERRIDE;
+ static std::shared_ptr<TEnumSchemaItem> createWithSignatures(
+ const std::set<EnumType>& AllowedElements,
+ const std::map<EnumType, std::vector<ElementSignature> >&
+ ElementSignatures,
+ const TSchemaItemParameter<EnumType>& DefaultValue =
+ TSchemaItemParameter<EnumType>());
+
/**
* @brief Validate smart object.
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
- * @return NsSmartObjects::Errors::eType
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
+ * @return ns_smart_objects::errors::eType
**/
- Errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
+ /**
+ * @brief Return the correct history signature based on message version.
+ * @param signatures Vector reference of enums history items.
+ * @param MessageVersion RPC Version of mobile app.
+ **/
+ const ElementSignature getSignature(
+ const std::vector<ElementSignature>& signatures,
+ const utils::SemanticVersion& MessageVersion);
+
/**
* @brief Apply schema.
* This implementation checks if enumeration is represented as string
* and tries to convert it to integer according to element-to-string
* map.
* @param Object Object to apply schema.
- * @param RemoveFakeParameters contains true if need to remove fake parameters
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* from smart object otherwise contains false.
**/
void applySchema(SmartObject& Object,
- const bool RemoveFakeParameters) OVERRIDE;
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion =
+ utils::SemanticVersion()) OVERRIDE;
/**
* @brief Unapply schema.
* @param Object Object to unapply schema.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
**/
- void unapplySchema(SmartObject& Object) OVERRIDE;
+ void unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) OVERRIDE;
private:
/**
@@ -104,12 +159,18 @@ class TEnumSchemaItem : public CDefaultSchemaItem<EnumType> {
**/
TEnumSchemaItem(const std::set<EnumType>& AllowedElements,
const TSchemaItemParameter<EnumType>& DefaultValue);
+
+ TEnumSchemaItem(const std::set<EnumType>& AllowedElements,
+ const TSchemaItemParameter<EnumType>& DefaultValue,
+ const std::map<EnumType, std::vector<ElementSignature> >&
+ ElementSignatures);
SmartType getSmartType() const OVERRIDE;
EnumType getDefaultValue() const OVERRIDE;
/**
* @brief Set of allowed enumeration elements.
**/
const std::set<EnumType> mAllowedElements;
+ std::map<EnumType, std::vector<ElementSignature> > mElementSignatures;
/**
* @brief Default value.
**/
@@ -142,6 +203,9 @@ class EnumConversionHelper {
typename CStringToEnumMap::const_iterator it =
cstring_to_enum_map().find(str);
if (it == cstring_to_enum_map().end()) {
+ if (value) {
+ *value = EnumType::INVALID_ENUM;
+ }
return false;
}
if (value) {
@@ -168,11 +232,10 @@ class EnumConversionHelper {
static bool EnumToString(const EnumType value, std::string* str) {
const char* cstr;
- if (EnumToCString(value, &cstr)) {
- return false;
- }
- if (str) {
+ bool success = EnumToCString(value, &cstr);
+ if (success && str) {
*str = cstr;
+ return true;
}
return false;
}
@@ -208,48 +271,118 @@ class EnumConversionHelper {
};
template <typename EnumType>
-utils::SharedPtr<TEnumSchemaItem<EnumType> > TEnumSchemaItem<EnumType>::create(
+std::shared_ptr<TEnumSchemaItem<EnumType> > TEnumSchemaItem<EnumType>::create(
+ const std::set<EnumType>& AllowedElements,
+ const TSchemaItemParameter<EnumType>& DefaultValue) {
+ return std::shared_ptr<TEnumSchemaItem<EnumType> >(
+ new TEnumSchemaItem<EnumType>(AllowedElements, DefaultValue));
+}
+
+template <typename EnumType>
+std::shared_ptr<TEnumSchemaItem<EnumType> >
+TEnumSchemaItem<EnumType>::createWithSignatures(
const std::set<EnumType>& AllowedElements,
+ const std::map<EnumType, std::vector<ElementSignature> >& ElementSignatures,
const TSchemaItemParameter<EnumType>& DefaultValue) {
- return new TEnumSchemaItem<EnumType>(AllowedElements, DefaultValue);
+ return std::shared_ptr<TEnumSchemaItem<EnumType> >(
+ new TEnumSchemaItem<EnumType>(
+ AllowedElements, DefaultValue, ElementSignatures));
}
template <typename EnumType>
-Errors::eType TEnumSchemaItem<EnumType>::validate(const SmartObject& Object) {
- rpc::ValidationReport report("RPC");
- return validate(Object, &report);
+const ElementSignature TEnumSchemaItem<EnumType>::getSignature(
+ const std::vector<ElementSignature>& signatures,
+ const utils::SemanticVersion& MessageVersion) {
+ for (uint i = 0; i < signatures.size(); i++) {
+ ElementSignature signature = signatures[i];
+ // Check if signature matches message version
+ if (signature.mSince != boost::none &&
+ MessageVersion < signature.mSince.get()) {
+ // Msg version predates 'since' field, check next entry
+ continue;
+ }
+ if (signature.mUntil != boost::none &&
+ (MessageVersion >= signature.mUntil.get())) {
+ continue; // Msg version newer than `until` field, check next entry
+ }
+ // Found correct signature
+ return signature;
+ }
+
+ // Could not match msg version to element siganture
+ ElementSignature ret;
+ return ret;
}
template <typename EnumType>
-Errors::eType TEnumSchemaItem<EnumType>::validate(
- const SmartObject& Object, rpc::ValidationReport* report__) {
+errors::eType TEnumSchemaItem<EnumType>::validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (SmartType_Integer != Object.getType()) {
std::string validation_info;
if (SmartType_String == Object.getType()) {
+ if (allow_unknown_enums) {
+ return errors::OK;
+ }
validation_info = "Invalid enum value: " + Object.asString();
} else {
- validation_info = "Incorrect type, expected: " +
- SmartObject::typeToString(SmartType_Integer) +
- " (enum), got: " +
- SmartObject::typeToString(Object.getType());
+ validation_info =
+ "Incorrect type, expected: " +
+ SmartObject::typeToString(SmartType_Integer) +
+ " (enum), got: " + SmartObject::typeToString(Object.getType());
}
report__->set_validation_info(validation_info);
- return Errors::INVALID_VALUE;
+ return errors::INVALID_VALUE;
}
- if (mAllowedElements.find(static_cast<EnumType>(Object.asInt())) ==
- mAllowedElements.end()) {
+
+ auto elements_it =
+ mAllowedElements.find(static_cast<EnumType>(Object.asInt()));
+
+ if (elements_it == mAllowedElements.end()) {
std::stringstream stream;
stream << "Invalid enum value: " << Object.asInt();
std::string validation_info = stream.str();
report__->set_validation_info(validation_info);
- return Errors::OUT_OF_RANGE;
+ return errors::OUT_OF_RANGE;
+ }
+
+ // Element exists in schema. Check if version is also valid.
+ if (MessageVersion.isValid()) {
+ EnumType value = *elements_it;
+ auto signatures_it = mElementSignatures.find(value);
+ if (signatures_it != mElementSignatures.end()) {
+ if (!signatures_it->second.empty()) {
+ ElementSignature signature =
+ getSignature(signatures_it->second, MessageVersion);
+ if (signature.mRemoved) {
+ // Element was removed for this version
+ std::string validation_info = "Enum value : " + Object.asString() +
+ " removed for SyncMsgVersion " +
+ MessageVersion.toString();
+ report__->set_validation_info(validation_info);
+ return errors::INVALID_VALUE;
+ } else if (signature.mSince == boost::none &&
+ signature.mUntil == boost::none) {
+ // Element does not exist for this version
+ std::string validation_info = "Enum value : " + Object.asString() +
+ " does not exist for SyncMsgVersion " +
+ MessageVersion.toString();
+ report__->set_validation_info(validation_info);
+ return errors::INVALID_VALUE;
+ }
+ }
+ }
}
- return Errors::OK;
+ return errors::OK;
}
template <typename EnumType>
-void TEnumSchemaItem<EnumType>::applySchema(SmartObject& Object,
- const bool RemoveFakeParameters) {
+void TEnumSchemaItem<EnumType>::applySchema(
+ SmartObject& Object,
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion) {
if (SmartType_String == Object.getType()) {
EnumType enum_val = static_cast<EnumType>(-1);
if (ConversionHelper::StringToEnum(Object.asString(), &enum_val)) {
@@ -259,7 +392,8 @@ void TEnumSchemaItem<EnumType>::applySchema(SmartObject& Object,
}
template <typename EnumType>
-void TEnumSchemaItem<EnumType>::unapplySchema(SmartObject& Object) {
+void TEnumSchemaItem<EnumType>::unapplySchema(
+ SmartObject& Object, const bool remove_unknown_parameters) {
if (SmartType_Integer == Object.getType()) {
const char* str;
if (ConversionHelper::EnumToCString(static_cast<EnumType>(Object.asInt()),
@@ -285,6 +419,15 @@ TEnumSchemaItem<EnumType>::TEnumSchemaItem(
: CDefaultSchemaItem<EnumType>(DefaultValue)
, mAllowedElements(AllowedElements) {}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+template <typename EnumType>
+TEnumSchemaItem<EnumType>::TEnumSchemaItem(
+ const std::set<EnumType>& AllowedElements,
+ const TSchemaItemParameter<EnumType>& DefaultValue,
+ const std::map<EnumType, std::vector<ElementSignature> >& ElementSignatures)
+ : CDefaultSchemaItem<EnumType>(DefaultValue)
+ , mAllowedElements(AllowedElements)
+ , mElementSignatures(ElementSignatures) {}
+
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ENUM_SCHEMA_ITEM_H_
diff --git a/src/components/smart_objects/include/smart_objects/errors.h b/src/components/smart_objects/include/smart_objects/errors.h
index 5d22d2386e..8fc73be049 100644
--- a/src/components/smart_objects/include/smart_objects/errors.h
+++ b/src/components/smart_objects/include/smart_objects/errors.h
@@ -31,9 +31,9 @@
#ifndef SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ERRORS_H_
#define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ERRORS_H_
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
-namespace Errors {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
+namespace errors {
/**
* @brief Enumeration that provides information about SmartObject validation
*errors
@@ -64,8 +64,8 @@ enum eType {
**/
ERROR
};
-} // namespace Errors
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace errors
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ERRORS_H_
diff --git a/src/components/smart_objects/include/smart_objects/number_schema_item.h b/src/components/smart_objects/include/smart_objects/number_schema_item.h
index 34c5e3a8a6..c3767e8e48 100644
--- a/src/components/smart_objects/include/smart_objects/number_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/number_schema_item.h
@@ -33,16 +33,16 @@
#ifndef SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_NUMBER_SCHEMA_ITEM_H_
#define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_NUMBER_SCHEMA_ITEM_H_
-#include <typeinfo>
#include <limits>
-#include "utils/shared_ptr.h"
+#include <typeinfo>
+
#include "smart_objects/default_shema_item.h"
#include "smart_objects/schema_item_parameter.h"
#include "utils/convert_utils.h"
#include "utils/helpers.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
/**
* @brief Number schema item.
* @tparam NumberType Number type.
@@ -57,7 +57,7 @@ class TNumberSchemaItem : public CDefaultSchemaItem<NumberType> {
* @param DefaultValue Default value.
* @return Shared pointer to a new schema item.
**/
- static utils::SharedPtr<TNumberSchemaItem> create(
+ static std::shared_ptr<TNumberSchemaItem> create(
const TSchemaItemParameter<NumberType>& MinValue =
TSchemaItemParameter<NumberType>(),
const TSchemaItemParameter<NumberType>& MaxValue =
@@ -66,20 +66,21 @@ class TNumberSchemaItem : public CDefaultSchemaItem<NumberType> {
TSchemaItemParameter<NumberType>());
/**
- * @deprecated
- * @brief Validate smart object.
- * @param Object Object to validate.
- * @return Errors::ERROR
- **/
- Errors::eType validate(const SmartObject& Object) OVERRIDE;
- /**
* @brief Validate smart object.
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
- * @return Errors::ERROR
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
+ * @return ns_smart_objects::errors::eType
**/
- Errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
private:
/**
@@ -112,11 +113,13 @@ class TNumberSchemaItem : public CDefaultSchemaItem<NumberType> {
};
template <typename NumberType>
-utils::SharedPtr<TNumberSchemaItem<NumberType> > TNumberSchemaItem<
- NumberType>::create(const TSchemaItemParameter<NumberType>& MinValue,
- const TSchemaItemParameter<NumberType>& MaxValue,
- const TSchemaItemParameter<NumberType>& DefaultValue) {
- return new TNumberSchemaItem<NumberType>(MinValue, MaxValue, DefaultValue);
+std::shared_ptr<TNumberSchemaItem<NumberType> >
+TNumberSchemaItem<NumberType>::create(
+ const TSchemaItemParameter<NumberType>& MinValue,
+ const TSchemaItemParameter<NumberType>& MaxValue,
+ const TSchemaItemParameter<NumberType>& DefaultValue) {
+ return std::shared_ptr<TNumberSchemaItem<NumberType> >(
+ new TNumberSchemaItem<NumberType>(MinValue, MaxValue, DefaultValue));
}
template <typename NumberType>
@@ -137,15 +140,11 @@ bool TNumberSchemaItem<NumberType>::isValidNumberType(SmartType type) {
}
template <typename NumberType>
-Errors::eType TNumberSchemaItem<NumberType>::validate(
- const SmartObject& Object) {
- rpc::ValidationReport report("RPC");
- return validate(Object, &report);
-}
-
-template <typename NumberType>
-Errors::eType TNumberSchemaItem<NumberType>::validate(
- const SmartObject& Object, rpc::ValidationReport* report__) {
+errors::eType TNumberSchemaItem<NumberType>::validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (!isValidNumberType(Object.getType())) {
SmartType expectedType = (typeid(double) == typeid(Object.getType()))
? SmartType_Double
@@ -154,7 +153,7 @@ Errors::eType TNumberSchemaItem<NumberType>::validate(
"Incorrect type, expected: " + SmartObject::typeToString(expectedType) +
", got: " + SmartObject::typeToString(Object.getType());
report__->set_validation_info(validation_info);
- return Errors::INVALID_VALUE;
+ return errors::INVALID_VALUE;
}
NumberType value(0);
if (typeid(int32_t) == typeid(value)) {
@@ -178,7 +177,7 @@ Errors::eType TNumberSchemaItem<NumberType>::validate(
<< ", minimum allowed: " << rangeLimit;
std::string validation_info = stream.str();
report__->set_validation_info(validation_info);
- return Errors::OUT_OF_RANGE;
+ return errors::OUT_OF_RANGE;
}
if (mMaxValue.getValue(rangeLimit) && (value > rangeLimit)) {
@@ -187,9 +186,9 @@ Errors::eType TNumberSchemaItem<NumberType>::validate(
<< ", maximum allowed: " << rangeLimit;
std::string validation_info = stream.str();
report__->set_validation_info(validation_info);
- return Errors::OUT_OF_RANGE;
+ return errors::OUT_OF_RANGE;
}
- return Errors::OK;
+ return errors::OK;
}
template <typename NumberType>
@@ -227,6 +226,6 @@ SmartType TNumberSchemaItem<int64_t>::getSmartType() const;
template <>
SmartType TNumberSchemaItem<double>::getSmartType() const;
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_NUMBER_SCHEMA_ITEM_H_
diff --git a/src/components/smart_objects/include/smart_objects/object_schema_item.h b/src/components/smart_objects/include/smart_objects/object_schema_item.h
index 8922caba45..58e13106d4 100644
--- a/src/components/smart_objects/include/smart_objects/object_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/object_schema_item.h
@@ -33,48 +33,71 @@
#define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_OBJECT_SCHEMA_ITEM_H_
#include <map>
-#include <string>
#include <set>
+#include <string>
+#include <boost/optional.hpp>
#include "utils/macro.h"
-#include "utils/shared_ptr.h"
+#include "utils/semantic_version.h"
#include "smart_objects/schema_item.h"
#include "smart_objects/schema_item_parameter.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
+
+/**
+ * @brief Object member.
+ **/
+struct SMember {
+ /**
+ * @brief Default constructor.
+ **/
+ SMember();
+ /**
+ * @brief Constructor.
+ * @param SchemaItem Member schema item.
+ * @param IsMandatory true if member is mandatory, false
+ * otherwise. Defaults to true.
+ **/
+
+ SMember(const ISchemaItemPtr SchemaItem,
+ const bool IsMandatory = true,
+ const std::string& Since = "",
+ const std::string& Until = "",
+ const bool IsDeprecated = false,
+ const bool IsRemoved = false,
+ const std::vector<SMember>& history_vector = {});
+
+ /**
+ * @brief Checks the version a parameter was removed (until)
+ * If the mobile's msg version is greater than or
+ **/
+ bool CheckHistoryFieldVersion(
+ const utils::SemanticVersion& MessageVersion) const;
+
+ /**
+ * @brief Member schema item.
+ **/
+ ISchemaItemPtr mSchemaItem;
+ /**
+ * @brief true if member is mandatory, false otherwise.
+ **/
+ bool mIsMandatory;
+ boost::optional<utils::SemanticVersion> mSince;
+ boost::optional<utils::SemanticVersion> mUntil;
+ bool mIsDeprecated;
+ bool mIsRemoved;
+ std::vector<SMember> mHistoryVector;
+};
+typedef std::map<std::string, SMember> Members;
+
/**
* @brief Object schema item.
**/
class CObjectSchemaItem : public ISchemaItem {
public:
/**
- * @brief Object member.
- **/
- struct SMember {
- /**
- * @brief Default constructor.
- **/
- SMember();
- /**
- * @brief Constructor.
- * @param SchemaItem Member schema item.
- * @param IsMandatory true if member is mandatory, false
- * otherwise. Defaults to true.
- **/
- SMember(const ISchemaItemPtr SchemaItem, const bool IsMandatory = true);
- /**
- * @brief Member schema item.
- **/
- ISchemaItemPtr mSchemaItem;
- /**
- * @brief true if member is mandatory, false otherwise.
- **/
- bool mIsMandatory;
- };
- typedef std::map<std::string, SMember> Members;
- /**
* @brief Create a new schema item.
*
* @param Members Map of member name to SMember structure
@@ -82,35 +105,43 @@ class CObjectSchemaItem : public ISchemaItem {
*
* @return Shared pointer to a new schema item.
**/
- static utils::SharedPtr<CObjectSchemaItem> create(const Members& Members);
- /**
- * @deprecated
- * @brief Validate smart object.
- * @param Object Object to validate.
- * @return NsSmartObjects::Errors::eType
- **/
- Errors::eType validate(const SmartObject& Object) OVERRIDE;
+ static std::shared_ptr<CObjectSchemaItem> create(const Members& Members);
+
/**
* @brief Validate smart object.
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
- * @return NsSmartObjects::Errors::eType
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
+ * @return ns_smart_objects::errors::eType
**/
- Errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
/**
* @brief Apply schema.
* @param Object Object to apply schema.
- * @param RemoveFakeParameters contains true if need to remove fake parameters
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* from smart object otherwise contains false.
**/
void applySchema(SmartObject& Object,
- const bool RemoveFakeParameters) OVERRIDE;
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion =
+ utils::SemanticVersion()) OVERRIDE;
/**
* @brief Unapply schema.
* @param Object Object to unapply schema.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
**/
- void unapplySchema(SmartObject& Object) OVERRIDE;
+ void unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) OVERRIDE;
/**
* @brief Build smart object by smart schema having copied matched
* parameters from pattern smart object
@@ -125,6 +156,12 @@ class CObjectSchemaItem : public ISchemaItem {
*/
size_t GetMemberSize() OVERRIDE;
+ boost::optional<SMember&> GetMemberSchemaItem(
+ const std::string& member_key) OVERRIDE;
+
+ void AddMemberSchemaItem(const std::string& member_key,
+ SMember& member) OVERRIDE;
+
protected:
/**
* @brief Constructor.
@@ -137,15 +174,26 @@ class CObjectSchemaItem : public ISchemaItem {
* @brief Removes fake parameters from object.
* @param Object Object to remove fake parameters.
**/
- void RemoveFakeParams(SmartObject& Object);
+ void RemoveFakeParams(SmartObject& Object,
+ const utils::SemanticVersion& MessageVersion);
+
+ /**
+ * @brief Returns the correct schema item based on message version.
+ * @param member Schema member
+ * @param MessageVersion Semantic Version of mobile message.
+ * @return Pointer to correct schema item if item found or nullptr, if item
+ *was not found.
+ **/
+ const SMember* GetCorrectMember(const SMember& member,
+ const utils::SemanticVersion& messageVersion);
/**
* @brief Map of member name to SMember structure describing the object
*member.
**/
- const Members mMembers;
+ Members mMembers;
DISALLOW_COPY_AND_ASSIGN(CObjectSchemaItem);
};
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_OBJECT_SCHEMA_ITEM_H_
diff --git a/src/components/smart_objects/include/smart_objects/schema_item.h b/src/components/smart_objects/include/smart_objects/schema_item.h
index 446c7fa65f..9c29e66f36 100644
--- a/src/components/smart_objects/include/smart_objects/schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/schema_item.h
@@ -33,14 +33,21 @@
#define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_SCHEMA_ITEM_H_
#include <stdlib.h>
-#include "utils/shared_ptr.h"
+
#include "rpc_base/validation_report.h"
#include "smart_objects/errors.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+#include <memory>
+#include <vector>
+#include "boost/optional/optional.hpp"
+#include "utils/macro.h"
+#include "utils/semantic_version.h"
+
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
class SmartObject;
+class SMember;
/**
* @brief Base schema item.
@@ -48,27 +55,23 @@ class SmartObject;
class ISchemaItem {
public:
/**
- * @deprecated
- *
- * @brief Validate smart object.
- *
- * @param Object Object to validate.
- *
- * @return NsSmartObjects::Errors::eType
- **/
- DEPRECATED virtual Errors::eType validate(const SmartObject& Object);
-
- /**
* @brief Validate smart object.
*
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
* message if an error occurs
- *
- * @return NsSmartObjects::Errors::eType
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
+ * @return ns_smart_objects::errors::eType
**/
- virtual Errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__);
+ virtual errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false);
/**
* @brief Set default value to an object.
@@ -92,20 +95,25 @@ class ISchemaItem {
* @brief Apply schema.
*
* @param Object Object to apply schema.
- * @param RemoveFakeParameters contains true if need to remove fake parameters
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* from smart object otherwise contains false.
**/
virtual void applySchema(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& Object,
- const bool RemoveFakeParameters);
+ ns_smart_device_link::ns_smart_objects::SmartObject& Object,
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion());
/**
* @brief Unapply schema.
*
* @param Object Object to unapply schema.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
**/
virtual void unapplySchema(
- NsSmartDeviceLink::NsSmartObjects::SmartObject& Object);
+ ns_smart_device_link::ns_smart_objects::SmartObject& Object,
+ const bool remove_unknown_parameters = true);
/**
* @brief Build smart object by smart schema having copied matched
@@ -117,6 +125,17 @@ class ISchemaItem {
virtual void BuildObjectBySchema(const SmartObject& pattern_object,
SmartObject& result_object);
+ virtual boost::optional<SMember&> GetMemberSchemaItem(
+ const std::string& member_key) {
+ UNUSED(member_key);
+ return boost::optional<SMember&>();
+ }
+
+ virtual void AddMemberSchemaItem(const std::string& member_key,
+ SMember& member) {
+ UNUSED(member_key);
+ UNUSED(member);
+ }
/**
* @brief Get value param, depends of children
*
@@ -126,7 +145,7 @@ class ISchemaItem {
virtual ~ISchemaItem() {}
};
-typedef utils::SharedPtr<ISchemaItem> ISchemaItemPtr;
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+typedef std::shared_ptr<ISchemaItem> ISchemaItemPtr;
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_SCHEMA_ITEM_H_
diff --git a/src/components/smart_objects/include/smart_objects/schema_item_parameter.h b/src/components/smart_objects/include/smart_objects/schema_item_parameter.h
index 49fdb9541b..f747b0ae89 100644
--- a/src/components/smart_objects/include/smart_objects/schema_item_parameter.h
+++ b/src/components/smart_objects/include/smart_objects/schema_item_parameter.h
@@ -34,8 +34,8 @@
#include "utils/macro.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
/**
* @brief SchemaItem parameter.
* Container for schema item parameter such as min/max value, size,
@@ -95,6 +95,6 @@ bool TSchemaItemParameter<ParameterType>::getValue(ParameterType& Value) const {
}
return mIsSpecified;
}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_SCHEMA_ITEM_PARAMETER_H_
diff --git a/src/components/smart_objects/include/smart_objects/smart_object.h b/src/components/smart_objects/include/smart_objects/smart_object.h
index cc2bc7e22c..f3aab0fc1e 100644
--- a/src/components/smart_objects/include/smart_objects/smart_object.h
+++ b/src/components/smart_objects/include/smart_objects/smart_object.h
@@ -33,17 +33,18 @@
#ifndef SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_SMART_OBJECT_H_
#define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_SMART_OBJECT_H_
+#include <map>
#include <set>
+#include <sstream>
#include <string>
#include <vector>
-#include <map>
+#include "rpc_base/validation_report.h"
#include "smart_objects/smart_schema.h"
#include "utils/custom_string.h"
-#include "rpc_base/validation_report.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
namespace custom_str = utils::custom_string;
@@ -126,7 +127,7 @@ typedef std::map<std::string, SmartObject> SmartMap;
**/
typedef std::vector<uint8_t> SmartBinary;
-typedef utils::SharedPtr<SmartObject> SmartObjectSPtr;
+typedef std::shared_ptr<SmartObject> SmartObjectSPtr;
/**
* @brief List of SmartObjects
@@ -298,8 +299,8 @@ class SmartObject FINAL {
bool operator==(const int64_t Value) const;
/**
- * @name Support of type: uint64_t
- * @{
+ * @name Support of type: uint64_t
+ * @{
**/
/**
@@ -671,20 +672,20 @@ class SmartObject FINAL {
bool isValid() const;
/**
- * @deprecated
- * @brief Validates object according to attached schema.
- *
- * @return Result of validation.
- */
- DEPRECATED Errors::eType validate();
-
- /**
* @brief Validates object according to attached schema.
*
* @param report__ object for reporting errors during validation
+ * @param messageVersion of the mobile app to check against RPC Spec Schema
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
* @return Result of validation.
*/
- Errors::eType validate(rpc::ValidationReport* report__);
+ errors::eType validate(
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false);
/**
* @brief Sets new schema
@@ -704,7 +705,7 @@ class SmartObject FINAL {
/**
* @brief Returns current object type
*
- * @return NsSmartObjects::SmartType
+ * @return ns_smart_objects::SmartType
**/
SmartType getType() const;
@@ -1053,9 +1054,9 @@ static SmartObject invalid_object_value(SmartType_Invalid);
* @brief Value that is used as invalid value for object type
**/
static const SmartBinary invalid_binary_value;
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
-namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+namespace smart_objects = ns_smart_device_link::ns_smart_objects;
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_SMART_OBJECT_H_
diff --git a/src/components/smart_objects/include/smart_objects/smart_schema.h b/src/components/smart_objects/include/smart_objects/smart_schema.h
index ada5646043..8cbafa53b2 100644
--- a/src/components/smart_objects/include/smart_objects/smart_schema.h
+++ b/src/components/smart_objects/include/smart_objects/smart_schema.h
@@ -32,11 +32,11 @@
#ifndef SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_SMART_SCHEMA_H_
#define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_SMART_SCHEMA_H_
-#include "utils/macro.h"
#include "smart_objects/schema_item.h"
+#include "utils/macro.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
class SmartObject;
/**
@@ -61,52 +61,62 @@ class CSmartSchema FINAL {
explicit CSmartSchema(const ISchemaItemPtr SchemaItem);
/**
- * @deprecated
- *
* @brief Validate smart object.
*
* @param Object Object to validate.
- *
- * @return NsSmartObjects::Errors::eType
+ * @param report__ object for reporting errors during validation
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
+ * @return ns_smart_objects::errors::eType
**/
- DEPRECATED Errors::eType validate(const SmartObject& Object) const;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& messageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) const;
/**
- * @brief Validate smart object.
- *
- * @param Object Object to validate.
- * @param report__ object for reporting errors during validation
+ * @brief Set new root schema item.
*
- * @return NsSmartObjects::Errors::eType
- **/
- Errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__) const;
+ * @param SchemaItem Root schema item.
+ */
+ void setSchemaItem(const ISchemaItemPtr SchemaItem);
/**
* @brief Set new root schema item.
*
* @param SchemaItem Root schema item.
*/
- void setSchemaItem(const ISchemaItemPtr SchemaItem);
+ ISchemaItemPtr getSchemaItem();
/**
* @brief Apply schema.
*
* @param Object Object to apply schema.
*
- * @param RemoveFakeParameters contains true if need to remove fake parameters
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
* from smart object otherwise contains false.
**/
- void applySchema(SmartObject& Object, const bool RemoveFakeParameters);
+ void applySchema(
+ SmartObject& Object,
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion());
/**
* @brief The reverse SmartObject conversion using schema.
*
* @param object Object to convert.
+ * @param remove_unknown_parameters contains true if need to remove unknown
+ *parameters
*/
// TODO(cpplint): Is this a non-const reference?
// If so, make const or use a pointer.
- void unapplySchema(SmartObject& object);
+ void unapplySchema(SmartObject& object,
+ const bool remove_unknown_parameters = true);
/**
* @brief Build smart object by smart schema having copied matched
@@ -124,6 +134,6 @@ class CSmartSchema FINAL {
*/
ISchemaItemPtr mSchemaItem;
};
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_SMART_SCHEMA_H_
diff --git a/src/components/smart_objects/include/smart_objects/string_schema_item.h b/src/components/smart_objects/include/smart_objects/string_schema_item.h
index 6c98dcc3b3..7104ff47a9 100644
--- a/src/components/smart_objects/include/smart_objects/string_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/string_schema_item.h
@@ -36,13 +36,11 @@
#include <stddef.h>
#include <string>
-#include "utils/shared_ptr.h"
-
#include "smart_objects/default_shema_item.h"
#include "smart_objects/schema_item_parameter.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
/**
* @brief String schema item.
**/
@@ -54,28 +52,30 @@ class CStringSchemaItem : public CDefaultSchemaItem<std::string> {
* @param DefaultValue Default value.
* @return Shared pointer to a new schema item.
**/
- static utils::SharedPtr<CStringSchemaItem> create(
+ static std::shared_ptr<CStringSchemaItem> create(
const TSchemaItemParameter<size_t>& MinLength =
TSchemaItemParameter<size_t>(),
const TSchemaItemParameter<size_t>& MaxLength =
TSchemaItemParameter<size_t>(),
const TSchemaItemParameter<std::string>& DefaultValue =
TSchemaItemParameter<std::string>());
- /**
- * @deprecated
- * @brief Validate smart object.
- * @param Object Object to validate.
- * @return NsSmartObjects::Errors::eType
- **/
- Errors::eType validate(const SmartObject& Object) OVERRIDE;
+
/**
* @brief Validate smart object.
* @param Object Object to validate.
* @param report__ object for reporting errors during validation
- * @return NsSmartObjects::Errors::eType
+ * @param MessageVersion to check mobile RPC version against RPC Spec History
+ * @param allow_unknown_enums
+ * false - unknown enum values (left as string values after applySchema)
+ * will be considered invalid.
+ * true - such values will be considered valid.
+ * @return ns_smart_objects::errors::eType
**/
- Errors::eType validate(const SmartObject& Object,
- rpc::ValidationReport* report__) OVERRIDE;
+ errors::eType validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion = utils::SemanticVersion(),
+ const bool allow_unknown_enums = false) OVERRIDE;
private:
/**
@@ -95,6 +95,6 @@ class CStringSchemaItem : public CDefaultSchemaItem<std::string> {
const TSchemaItemParameter<size_t> mMaxLength;
DISALLOW_COPY_AND_ASSIGN(CStringSchemaItem);
};
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
#endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_STRING_SCHEMA_ITEM_H_
diff --git a/src/components/smart_objects/src/always_false_schema_item.cc b/src/components/smart_objects/src/always_false_schema_item.cc
index 1893ed24d1..4f8f4584af 100644
--- a/src/components/smart_objects/src/always_false_schema_item.cc
+++ b/src/components/smart_objects/src/always_false_schema_item.cc
@@ -32,24 +32,23 @@
#include "smart_objects/always_false_schema_item.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
CAlwaysFalseSchemaItem::CAlwaysFalseSchemaItem() {}
-utils::SharedPtr<CAlwaysFalseSchemaItem> CAlwaysFalseSchemaItem::create() {
- return new CAlwaysFalseSchemaItem();
+std::shared_ptr<CAlwaysFalseSchemaItem> CAlwaysFalseSchemaItem::create() {
+ return std::shared_ptr<CAlwaysFalseSchemaItem>(new CAlwaysFalseSchemaItem());
}
-Errors::eType CAlwaysFalseSchemaItem::validate(const SmartObject& object) {
- rpc::ValidationReport report("RPC");
- return validate(object, &report);
-}
-
-Errors::eType CAlwaysFalseSchemaItem::validate(
- const SmartObject& object, rpc::ValidationReport* report__) {
+errors::eType CAlwaysFalseSchemaItem::validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
report__->set_validation_info("Generic error");
- return Errors::ERROR;
+ return errors::ERROR;
}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/src/always_true_schema_item.cc b/src/components/smart_objects/src/always_true_schema_item.cc
index 1e7115316d..855bfef2a0 100644
--- a/src/components/smart_objects/src/always_true_schema_item.cc
+++ b/src/components/smart_objects/src/always_true_schema_item.cc
@@ -30,23 +30,22 @@
#include "smart_objects/always_true_schema_item.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
CAlwaysTrueSchemaItem::CAlwaysTrueSchemaItem() {}
-utils::SharedPtr<CAlwaysTrueSchemaItem> CAlwaysTrueSchemaItem::create() {
- return new CAlwaysTrueSchemaItem();
+std::shared_ptr<CAlwaysTrueSchemaItem> CAlwaysTrueSchemaItem::create() {
+ return std::shared_ptr<CAlwaysTrueSchemaItem>(new CAlwaysTrueSchemaItem());
}
-Errors::eType CAlwaysTrueSchemaItem::validate(const SmartObject& object) {
- return Errors::OK;
+errors::eType CAlwaysTrueSchemaItem::validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
+ return errors::OK;
}
-Errors::eType CAlwaysTrueSchemaItem::validate(const SmartObject& object,
- rpc::ValidationReport* report__) {
- return Errors::OK;
-}
-
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/src/array_schema_item.cc b/src/components/smart_objects/src/array_schema_item.cc
index dca0a815e0..9420fe020f 100644
--- a/src/components/smart_objects/src/array_schema_item.cc
+++ b/src/components/smart_objects/src/array_schema_item.cc
@@ -31,30 +31,29 @@
#include "smart_objects/array_schema_item.h"
#include "smart_objects/smart_object.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
-utils::SharedPtr<CArraySchemaItem> CArraySchemaItem::create(
+std::shared_ptr<CArraySchemaItem> CArraySchemaItem::create(
const ISchemaItemPtr ElementSchemaItem,
const TSchemaItemParameter<size_t>& MinSize,
const TSchemaItemParameter<size_t>& MaxSize) {
- return new CArraySchemaItem(ElementSchemaItem, MinSize, MaxSize);
+ return std::shared_ptr<CArraySchemaItem>(
+ new CArraySchemaItem(ElementSchemaItem, MinSize, MaxSize));
}
-Errors::eType CArraySchemaItem::validate(const SmartObject& Object) {
- rpc::ValidationReport report("RPC");
- return validate(Object, &report);
-}
-
-Errors::eType CArraySchemaItem::validate(const SmartObject& Object,
- rpc::ValidationReport* report__) {
+errors::eType CArraySchemaItem::validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (SmartType_Array != Object.getType()) {
- std::string validation_info = "Incorrect type, expected: " +
- SmartObject::typeToString(SmartType_Array) +
- ", got: " +
- SmartObject::typeToString(Object.getType());
+ std::string validation_info =
+ "Incorrect type, expected: " +
+ SmartObject::typeToString(SmartType_Array) +
+ ", got: " + SmartObject::typeToString(Object.getType());
report__->set_validation_info(validation_info);
- return Errors::INVALID_VALUE;
+ return errors::INVALID_VALUE;
}
size_t sizeLimit;
const size_t array_len = Object.length();
@@ -65,7 +64,7 @@ Errors::eType CArraySchemaItem::validate(const SmartObject& Object,
<< ", minimum allowed: " << sizeLimit;
std::string validation_info = stream.str();
report__->set_validation_info(validation_info);
- return Errors::OUT_OF_RANGE;
+ return errors::OUT_OF_RANGE;
}
if (mMaxSize.getValue(sizeLimit) && (array_len > sizeLimit)) {
std::stringstream stream;
@@ -73,34 +72,41 @@ Errors::eType CArraySchemaItem::validate(const SmartObject& Object,
<< ", maximum allowed: " << sizeLimit;
std::string validation_info = stream.str();
report__->set_validation_info(validation_info);
- return Errors::OUT_OF_RANGE;
+ return errors::OUT_OF_RANGE;
}
for (size_t i = 0u; i < array_len; ++i) {
std::stringstream strVal;
strVal << i;
- const Errors::eType result = mElementSchemaItem->validate(
- Object.getElement(i), &report__->ReportSubobject(strVal.str()));
- if (Errors::OK != result) {
+ const errors::eType result =
+ mElementSchemaItem->validate(Object.getElement(i),
+ &report__->ReportSubobject(strVal.str()),
+ MessageVersion,
+ allow_unknown_enums);
+ if (errors::OK != result) {
return result;
}
}
- return Errors::OK;
+ return errors::OK;
}
-void CArraySchemaItem::applySchema(SmartObject& Object,
- const bool RemoveFakeParameters) {
+void CArraySchemaItem::applySchema(
+ SmartObject& Object,
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion) {
if (SmartType_Array == Object.getType()) {
for (size_t i = 0U; i < Object.length(); ++i) {
- mElementSchemaItem->applySchema(Object[i], RemoveFakeParameters);
+ mElementSchemaItem->applySchema(
+ Object[i], remove_unknown_parameters, MessageVersion);
}
}
}
-void CArraySchemaItem::unapplySchema(SmartObject& Object) {
+void CArraySchemaItem::unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) {
if (SmartType_Array == Object.getType()) {
for (size_t i = 0U; i < Object.length(); ++i) {
- mElementSchemaItem->unapplySchema(Object[i]);
+ mElementSchemaItem->unapplySchema(Object[i], remove_unknown_parameters);
}
}
}
@@ -128,5 +134,5 @@ CArraySchemaItem::CArraySchemaItem(const ISchemaItemPtr ElementSchemaItem,
, mMinSize(MinSize)
, mMaxSize(MaxSize) {}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/src/bool_schema_item.cc b/src/components/smart_objects/src/bool_schema_item.cc
index c1da95528a..a4875a1b24 100644
--- a/src/components/smart_objects/src/bool_schema_item.cc
+++ b/src/components/smart_objects/src/bool_schema_item.cc
@@ -32,12 +32,12 @@
#include "smart_objects/bool_schema_item.h"
#include "smart_objects/smart_object.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
-utils::SharedPtr<CBoolSchemaItem> CBoolSchemaItem::create(
+std::shared_ptr<CBoolSchemaItem> CBoolSchemaItem::create(
const TSchemaItemParameter<bool>& DefaultValue) {
- return new CBoolSchemaItem(DefaultValue);
+ return std::shared_ptr<CBoolSchemaItem>(new CBoolSchemaItem(DefaultValue));
}
CBoolSchemaItem::CBoolSchemaItem(const TSchemaItemParameter<bool>& DefaultValue)
@@ -51,5 +51,5 @@ bool CBoolSchemaItem::getDefaultValue() const {
return false;
}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/src/number_schema_item.cc b/src/components/smart_objects/src/number_schema_item.cc
index 9789434523..c383f6ecca 100644
--- a/src/components/smart_objects/src/number_schema_item.cc
+++ b/src/components/smart_objects/src/number_schema_item.cc
@@ -31,8 +31,8 @@
*/
#include "smart_objects/number_schema_item.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
template <>
SmartType TNumberSchemaItem<int32_t>::getSmartType() const {
@@ -54,5 +54,5 @@ SmartType TNumberSchemaItem<double>::getSmartType() const {
return SmartType_Double;
}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/src/object_schema_item.cc b/src/components/smart_objects/src/object_schema_item.cc
index 2bed3d9a26..27c64de7e2 100644
--- a/src/components/smart_objects/src/object_schema_item.cc
+++ b/src/components/smart_objects/src/object_schema_item.cc
@@ -33,6 +33,7 @@
#include <algorithm>
+#include "generated_msg_version.h"
#include "smart_objects/always_false_schema_item.h"
#include "smart_objects/smart_object.h"
@@ -40,36 +41,79 @@ namespace {
const char connection_key[] = "connection_key";
const char binary_data[] = "binary_data";
const char app_id[] = "appID";
-}
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+const utils::SemanticVersion kModuleVersion(application_manager::major_version,
+ application_manager::minor_version,
+ application_manager::patch_version);
+} // namespace
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
-CObjectSchemaItem::SMember::SMember()
- : mSchemaItem(CAlwaysFalseSchemaItem::create()), mIsMandatory(true) {}
+SMember::SMember()
+ : mSchemaItem(CAlwaysFalseSchemaItem::create())
+ , mIsMandatory(true)
+ , mIsDeprecated(false)
+ , mIsRemoved(false) {}
-CObjectSchemaItem::SMember::SMember(const ISchemaItemPtr SchemaItem,
- const bool IsMandatory)
- : mSchemaItem(SchemaItem), mIsMandatory(IsMandatory) {}
+SMember::SMember(const ISchemaItemPtr SchemaItem,
+ const bool IsMandatory,
+ const std::string& Since,
+ const std::string& Until,
+ const bool IsDeprecated,
+ const bool IsRemoved,
+ const std::vector<SMember>& history_vector)
+ : mSchemaItem(SchemaItem), mIsMandatory(IsMandatory) {
+ if (Since.size() > 0) {
+ utils::SemanticVersion since_struct(Since);
+ if (since_struct.isValid()) {
+ mSince = since_struct;
+ }
+ }
+ if (Until.size() > 0) {
+ utils::SemanticVersion until_struct(Until);
+ if (until_struct.isValid()) {
+ mUntil = until_struct;
+ }
+ }
+ mIsDeprecated = IsDeprecated;
+ mIsRemoved = IsRemoved;
+ mHistoryVector = history_vector;
+}
-utils::SharedPtr<CObjectSchemaItem> CObjectSchemaItem::create(
- const Members& members) {
- return new CObjectSchemaItem(members);
+bool SMember::CheckHistoryFieldVersion(
+ const utils::SemanticVersion& MessageVersion) const {
+ if (MessageVersion.isValid()) {
+ if (mSince != boost::none) {
+ if (MessageVersion < mSince.get()) {
+ return false;
+ }
+ }
+ if (mUntil != boost::none) {
+ if (MessageVersion >= mUntil.get()) {
+ return false; // Msg version newer than `until` field
+ }
+ }
+ }
+
+ return true; // All checks passed. Return true.
}
-Errors::eType CObjectSchemaItem::validate(const SmartObject& object) {
- rpc::ValidationReport report("RPC");
- return validate(object, &report);
+std::shared_ptr<CObjectSchemaItem> CObjectSchemaItem::create(
+ const Members& members) {
+ return std::shared_ptr<CObjectSchemaItem>(new CObjectSchemaItem(members));
}
-Errors::eType CObjectSchemaItem::validate(const SmartObject& object,
- rpc::ValidationReport* report__) {
+errors::eType CObjectSchemaItem::validate(
+ const SmartObject& object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (SmartType_Map != object.getType()) {
- std::string validation_info = "Incorrect type, expected: " +
- SmartObject::typeToString(SmartType_Map) +
- ", got: " +
- SmartObject::typeToString(object.getType());
+ std::string validation_info =
+ "Incorrect type, expected: " +
+ SmartObject::typeToString(SmartType_Map) +
+ ", got: " + SmartObject::typeToString(object.getType());
report__->set_validation_info(validation_info);
- return Errors::INVALID_VALUE;
+ return errors::INVALID_VALUE;
}
std::set<std::string> object_keys = object.enumerate();
@@ -78,54 +122,73 @@ Errors::eType CObjectSchemaItem::validate(const SmartObject& object,
++it) {
const std::string& key = it->first;
const SMember& member = it->second;
+ const SMember* correct_member = GetCorrectMember(member, MessageVersion);
std::set<std::string>::const_iterator key_it = object_keys.find(key);
if (object_keys.end() == key_it) {
- if (member.mIsMandatory) {
+ if (correct_member && correct_member->mIsMandatory == true &&
+ correct_member->mIsRemoved == false) {
std::string validation_info = "Missing mandatory parameter: " + key;
report__->set_validation_info(validation_info);
- return Errors::MISSING_MANDATORY_PARAMETER;
+ return errors::MISSING_MANDATORY_PARAMETER;
}
continue;
}
const SmartObject& field = object.getElement(key);
- const Errors::eType result =
- member.mSchemaItem->validate(field, &report__->ReportSubobject(key));
- if (Errors::OK != result) {
+
+ errors::eType result = errors::OK;
+ // Check if MessageVersion matches schema version
+ if (correct_member) {
+ result =
+ correct_member->mSchemaItem->validate(field,
+ &report__->ReportSubobject(key),
+ MessageVersion,
+ allow_unknown_enums);
+ } else {
+ result = errors::ERROR;
+ }
+
+ if (errors::OK != result) {
return result;
}
object_keys.erase(key_it);
}
- return Errors::OK;
+
+ return errors::OK;
}
-void CObjectSchemaItem::applySchema(SmartObject& Object,
- const bool RemoveFakeParameters) {
+void CObjectSchemaItem::applySchema(
+ SmartObject& Object,
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion) {
if (SmartType_Map != Object.getType()) {
return;
}
- if (RemoveFakeParameters) {
- RemoveFakeParams(Object);
+ if (remove_unknown_parameters) {
+ RemoveFakeParams(Object, MessageVersion);
}
SmartObject default_value;
- for (Members::const_iterator it = mMembers.begin(); it != mMembers.end();
- ++it) {
- const std::string& key = it->first;
- const SMember& member = it->second;
+
+ for (const auto& item : mMembers) {
+ const std::string& key = item.first;
+ const SMember& member = item.second;
if (!Object.keyExists(key)) {
if (member.mSchemaItem->setDefaultValue(default_value)) {
Object[key] = default_value;
- member.mSchemaItem->applySchema(Object[key], RemoveFakeParameters);
+ member.mSchemaItem->applySchema(
+ Object[key], remove_unknown_parameters, MessageVersion);
}
} else {
- member.mSchemaItem->applySchema(Object[key], RemoveFakeParameters);
+ member.mSchemaItem->applySchema(
+ Object[key], remove_unknown_parameters, MessageVersion);
}
}
}
-void CObjectSchemaItem::unapplySchema(SmartObject& Object) {
+void CObjectSchemaItem::unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) {
if (SmartType_Map != Object.getType()) {
return;
}
@@ -134,18 +197,17 @@ void CObjectSchemaItem::unapplySchema(SmartObject& Object) {
const std::string& key = it->first;
// move next to avoid wrong iterator on erase
++it;
- if (mMembers.end() == mMembers.find(key)) {
+ if (mMembers.end() == mMembers.find(key) && remove_unknown_parameters) {
// remove fake params
Object.erase(key);
}
}
-
for (Members::const_iterator it = mMembers.begin(); it != mMembers.end();
++it) {
const std::string& key = it->first;
const SMember& member = it->second;
if (Object.keyExists(key)) {
- member.mSchemaItem->unapplySchema(Object[key]);
+ member.mSchemaItem->unapplySchema(Object[key], remove_unknown_parameters);
}
}
}
@@ -170,25 +232,64 @@ size_t CObjectSchemaItem::GetMemberSize() {
return mMembers.size();
}
+boost::optional<SMember&> CObjectSchemaItem::GetMemberSchemaItem(
+ const std::string& member_key) {
+ auto it = mMembers.find(member_key);
+
+ if (it != mMembers.end()) {
+ return boost::optional<SMember&>(it->second);
+ }
+ return boost::optional<SMember&>();
+}
+
+void CObjectSchemaItem::AddMemberSchemaItem(const std::string& member_key,
+ SMember& member) {
+ mMembers[member_key] = member;
+}
+
CObjectSchemaItem::CObjectSchemaItem(const Members& members)
: mMembers(members) {}
-void CObjectSchemaItem::RemoveFakeParams(SmartObject& Object) {
- for (SmartMap::const_iterator it = Object.map_begin();
- it != Object.map_end();) {
- const std::string& key = it->first;
- if (mMembers.end() == mMembers.find(key)
- // FIXME(EZamakhov): Remove illegal usage of filed in AM
- &&
- key.compare(connection_key) != 0 && key.compare(binary_data) != 0 &&
- key.compare(app_id) != 0) {
- ++it;
+void CObjectSchemaItem::RemoveFakeParams(
+ SmartObject& Object, const utils::SemanticVersion& MessageVersion) {
+ for (const auto& key : Object.enumerate()) {
+ std::map<std::string, SMember>::const_iterator members_it =
+ mMembers.find(key);
+
+ if (mMembers.end() != members_it) {
+ const SMember* member =
+ GetCorrectMember(members_it->second, MessageVersion);
+ if (!member || member->mIsRemoved) {
+ Object.erase(key);
+ }
+ continue;
+ } else if (key.compare(connection_key) != 0 &&
+ key.compare(binary_data) != 0 && key.compare(app_id) != 0) {
Object.erase(key);
- } else {
- it++;
}
}
}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+const SMember* CObjectSchemaItem::GetCorrectMember(
+ const SMember& member, const utils::SemanticVersion& messageVersion) {
+ // Check if member is the correct version
+ if (member.CheckHistoryFieldVersion(messageVersion)) {
+ return &member;
+ }
+ // Check for history tag items
+ if (!member.mHistoryVector.empty()) {
+ for (uint i = 0; i < member.mHistoryVector.size(); i++) {
+ if (member.mHistoryVector[i].CheckHistoryFieldVersion(messageVersion)) {
+ return &member.mHistoryVector[i];
+ }
+ }
+ }
+
+ // Return member as default
+ return (member.mSince != boost::none && member.mSince.get() > kModuleVersion)
+ ? &member
+ : nullptr;
+}
+
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/src/schema_item.cc b/src/components/smart_objects/src/schema_item.cc
index 22735d40d5..8c40e2c7bd 100644
--- a/src/components/smart_objects/src/schema_item.cc
+++ b/src/components/smart_objects/src/schema_item.cc
@@ -32,16 +32,15 @@
#include "smart_objects/schema_item.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
-Errors::eType ISchemaItem::validate(const SmartObject& Object) {
- return Errors::ERROR;
-}
-
-Errors::eType ISchemaItem::validate(const SmartObject& object,
- rpc::ValidationReport* report__) {
- return Errors::ERROR;
+errors::eType ISchemaItem::validate(
+ const SmartObject& object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
+ return errors::ERROR;
}
bool ISchemaItem::setDefaultValue(SmartObject& Object) {
@@ -53,9 +52,11 @@ bool ISchemaItem::hasDefaultValue(SmartObject& Object) {
}
void ISchemaItem::applySchema(SmartObject& Object,
- const bool RemoveFakeParameters) {}
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion) {}
-void ISchemaItem::unapplySchema(SmartObject& Object) {}
+void ISchemaItem::unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) {}
void ISchemaItem::BuildObjectBySchema(const SmartObject& pattern_object,
SmartObject& result_object) {}
@@ -64,5 +65,5 @@ size_t ISchemaItem::GetMemberSize() {
return 0;
}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/src/smart_object.cc b/src/components/smart_objects/src/smart_object.cc
index a0925eef05..d13ca87848 100644
--- a/src/components/smart_objects/src/smart_object.cc
+++ b/src/components/smart_objects/src/smart_object.cc
@@ -34,16 +34,15 @@
#include <errno.h>
#include <inttypes.h>
-#include <limits>
#include <stdlib.h>
#include <algorithm>
-#include <sstream>
#include <iomanip>
#include <iterator>
#include <limits>
+#include <sstream>
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
/**
* @brief Value that is used as invalid value for string type
@@ -491,7 +490,7 @@ std::string SmartObject::convert_string() const {
default:
break;
}
- return NsSmartDeviceLink::NsSmartObjects::invalid_cstr_value;
+ return ns_smart_device_link::ns_smart_objects::invalid_cstr_value;
}
custom_str::CustomString SmartObject::convert_custom_string() const {
@@ -701,6 +700,9 @@ void SmartObject::duplicate(const SmartObject& OtherObject) {
case SmartType_Integer:
newData.int_value = OtherObject.m_data.int_value;
break;
+ case SmartType_UInteger:
+ newData.int_value = OtherObject.m_data.int_value;
+ break;
case SmartType_Double:
newData.double_value = OtherObject.m_data.double_value;
break;
@@ -732,16 +734,32 @@ void SmartObject::duplicate(const SmartObject& OtherObject) {
void SmartObject::cleanup_data() {
switch (m_type) {
case SmartType_String:
- delete m_data.str_value;
+ if (m_data.str_value) {
+ delete m_data.str_value;
+ m_data.str_value = nullptr;
+ m_type = SmartType_Null;
+ }
break;
case SmartType_Map:
- delete m_data.map_value;
+ if (m_data.map_value) {
+ delete m_data.map_value;
+ m_data.map_value = nullptr;
+ m_type = SmartType_Null;
+ }
break;
case SmartType_Array:
- delete m_data.array_value;
+ if (m_data.array_value) {
+ delete m_data.array_value;
+ m_data.array_value = nullptr;
+ m_type = SmartType_Null;
+ }
break;
case SmartType_Binary:
- delete m_data.binary_value;
+ if (m_data.binary_value) {
+ delete m_data.binary_value;
+ m_data.binary_value = nullptr;
+ m_type = SmartType_Null;
+ }
break;
default:
break;
@@ -870,16 +888,15 @@ bool SmartObject::erase(const std::string& Key) {
bool SmartObject::isValid() const {
rpc::ValidationReport report("RPC");
- return (Errors::OK == m_schema.validate(*this, &report));
-}
-
-Errors::eType SmartObject::validate() {
- rpc::ValidationReport report("RPC");
- return validate(&report);
+ return (errors::OK == m_schema.validate(*this, &report));
}
-Errors::eType SmartObject::validate(rpc::ValidationReport* report__) {
- return m_schema.validate(*this, report__);
+errors::eType SmartObject::validate(
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
+ return m_schema.validate(
+ *this, report__, MessageVersion, allow_unknown_enums);
}
void SmartObject::setSchema(const CSmartSchema& schema) {
@@ -890,5 +907,5 @@ CSmartSchema SmartObject::getSchema() {
return m_schema;
}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/src/smart_schema.cc b/src/components/smart_objects/src/smart_schema.cc
index 7509ea80f1..6107d19266 100644
--- a/src/components/smart_objects/src/smart_schema.cc
+++ b/src/components/smart_objects/src/smart_schema.cc
@@ -32,35 +32,40 @@
#include "smart_objects/smart_schema.h"
#include "smart_objects/always_true_schema_item.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
CSmartSchema::CSmartSchema() : mSchemaItem(CAlwaysTrueSchemaItem::create()) {}
CSmartSchema::CSmartSchema(const ISchemaItemPtr SchemaItem)
: mSchemaItem(SchemaItem) {}
-Errors::eType CSmartSchema::validate(const SmartObject& Object) const {
- rpc::ValidationReport report("RPC");
- return validate(Object, &report);
-}
-
-Errors::eType CSmartSchema::validate(const SmartObject& object,
- rpc::ValidationReport* report__) const {
- return mSchemaItem->validate(object, report__);
+errors::eType CSmartSchema::validate(
+ const SmartObject& object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) const {
+ return mSchemaItem->validate(
+ object, report__, MessageVersion, allow_unknown_enums);
}
void CSmartSchema::setSchemaItem(const ISchemaItemPtr schemaItem) {
mSchemaItem = schemaItem;
}
+ISchemaItemPtr CSmartSchema::getSchemaItem() {
+ return mSchemaItem;
+}
+
void CSmartSchema::applySchema(SmartObject& Object,
- const bool RemoveFakeParameters) {
- mSchemaItem->applySchema(Object, RemoveFakeParameters);
+ const bool remove_unknown_parameters,
+ const utils::SemanticVersion& MessageVersion) {
+ mSchemaItem->applySchema(Object, remove_unknown_parameters, MessageVersion);
}
-void CSmartSchema::unapplySchema(SmartObject& Object) {
- mSchemaItem->unapplySchema(Object);
+void CSmartSchema::unapplySchema(SmartObject& Object,
+ const bool remove_unknown_parameters) {
+ mSchemaItem->unapplySchema(Object, remove_unknown_parameters);
}
void CSmartSchema::BuildObjectBySchema(const SmartObject& pattern_object,
@@ -68,5 +73,5 @@ void CSmartSchema::BuildObjectBySchema(const SmartObject& pattern_object,
mSchemaItem->BuildObjectBySchema(pattern_object, result_object);
}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/src/string_schema_item.cc b/src/components/smart_objects/src/string_schema_item.cc
index 1e4c8372f0..c4382174d0 100644
--- a/src/components/smart_objects/src/string_schema_item.cc
+++ b/src/components/smart_objects/src/string_schema_item.cc
@@ -29,36 +29,35 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "smart_objects/smart_object.h"
#include "smart_objects/string_schema_item.h"
+#include "smart_objects/smart_object.h"
#include "utils/custom_string.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
namespace custom_str = utils::custom_string;
-utils::SharedPtr<CStringSchemaItem> CStringSchemaItem::create(
+std::shared_ptr<CStringSchemaItem> CStringSchemaItem::create(
const TSchemaItemParameter<size_t>& MinLength,
const TSchemaItemParameter<size_t>& MaxLength,
const TSchemaItemParameter<std::string>& DefaultValue) {
- return new CStringSchemaItem(MinLength, MaxLength, DefaultValue);
-}
-
-Errors::eType CStringSchemaItem::validate(const SmartObject& Object) {
- rpc::ValidationReport report("RPC");
- return validate(Object, &report);
+ return std::shared_ptr<CStringSchemaItem>(
+ new CStringSchemaItem(MinLength, MaxLength, DefaultValue));
}
-Errors::eType CStringSchemaItem::validate(const SmartObject& Object,
- rpc::ValidationReport* report__) {
+errors::eType CStringSchemaItem::validate(
+ const SmartObject& Object,
+ rpc::ValidationReport* report__,
+ const utils::SemanticVersion& MessageVersion,
+ const bool allow_unknown_enums) {
if (SmartType_String != Object.getType()) {
- std::string validation_info = "Incorrect type, expected: " +
- SmartObject::typeToString(SmartType_String) +
- ", got: " +
- SmartObject::typeToString(Object.getType());
+ std::string validation_info =
+ "Incorrect type, expected: " +
+ SmartObject::typeToString(SmartType_String) +
+ ", got: " + SmartObject::typeToString(Object.getType());
report__->set_validation_info(validation_info);
- return Errors::INVALID_VALUE;
+ return errors::INVALID_VALUE;
}
const custom_str::CustomString value = Object.asCustomString();
@@ -70,7 +69,7 @@ Errors::eType CStringSchemaItem::validate(const SmartObject& Object,
<< ", minimum allowed: " << length;
std::string validation_info = stream.str();
report__->set_validation_info(validation_info);
- return Errors::OUT_OF_RANGE;
+ return errors::OUT_OF_RANGE;
}
if (mMaxLength.getValue(length) && (value.size() > length)) {
std::stringstream stream;
@@ -78,9 +77,9 @@ Errors::eType CStringSchemaItem::validate(const SmartObject& Object,
<< ", maximum allowed: " << length;
std::string validation_info = stream.str();
report__->set_validation_info(validation_info);
- return Errors::OUT_OF_RANGE;
+ return errors::OUT_OF_RANGE;
}
- return Errors::OK;
+ return errors::OK;
}
SmartType CStringSchemaItem::getSmartType() const {
@@ -99,5 +98,5 @@ CStringSchemaItem::CStringSchemaItem(
, mMinLength(MinLength)
, mMaxLength(MaxLength) {}
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/test/AlwaysFalseSchemaItem_test.cc b/src/components/smart_objects/test/AlwaysFalseSchemaItem_test.cc
index 9d88178598..cded041bcc 100644
--- a/src/components/smart_objects/test/AlwaysFalseSchemaItem_test.cc
+++ b/src/components/smart_objects/test/AlwaysFalseSchemaItem_test.cc
@@ -34,14 +34,14 @@
#include "gmock/gmock.h"
-#include "smart_objects/smart_object.h"
#include "smart_objects/always_false_schema_item.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace smart_object_test {
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
/**
* Test AlwaysFalseSchemaItem
@@ -54,38 +54,38 @@ TEST(test_AlwaysFalseSchemaItemTest, simple_test) {
obj = 5;
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::ERROR, resultType);
+ EXPECT_EQ(errors::ERROR, resultType);
EXPECT_EQ(5, obj.asInt());
obj = true;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::ERROR, resultType);
+ EXPECT_EQ(errors::ERROR, resultType);
EXPECT_TRUE(obj.asBool());
obj = "Test";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::ERROR, resultType);
+ EXPECT_EQ(errors::ERROR, resultType);
EXPECT_EQ(std::string("Test"), obj.asString());
obj["First"] = "Some string";
obj["Second"] = 555;
resultType = item->validate(obj["First"], &report);
- EXPECT_EQ(Errors::ERROR, resultType);
+ EXPECT_EQ(errors::ERROR, resultType);
resultType = item->validate(obj["Second"], &report);
- EXPECT_EQ(Errors::ERROR, resultType);
+ EXPECT_EQ(errors::ERROR, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::ERROR, resultType);
+ EXPECT_EQ(errors::ERROR, resultType);
EXPECT_EQ(std::string("Some string"), obj["First"].asString());
EXPECT_EQ(555, obj["Second"].asInt());
obj[0] = true;
obj[1] = false;
resultType = item->validate(obj[0], &report);
- EXPECT_EQ(Errors::ERROR, resultType);
+ EXPECT_EQ(errors::ERROR, resultType);
resultType = item->validate(obj[1], &report);
- EXPECT_EQ(Errors::ERROR, resultType);
+ EXPECT_EQ(errors::ERROR, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::ERROR, resultType);
+ EXPECT_EQ(errors::ERROR, resultType);
EXPECT_TRUE(obj[0].asBool());
EXPECT_FALSE(obj[1].asBool());
}
diff --git a/src/components/smart_objects/test/AlwaysTrueSchemaItem_test.cc b/src/components/smart_objects/test/AlwaysTrueSchemaItem_test.cc
index 40c827e17b..54a9c8684f 100644
--- a/src/components/smart_objects/test/AlwaysTrueSchemaItem_test.cc
+++ b/src/components/smart_objects/test/AlwaysTrueSchemaItem_test.cc
@@ -34,14 +34,14 @@
#include "gmock/gmock.h"
-#include "smart_objects/smart_object.h"
#include "smart_objects/always_true_schema_item.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace smart_object_test {
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
/**
* Test AlwaysTrueSchemaItem
@@ -54,38 +54,38 @@ TEST(test_AlwaysTrueSchemaItemTest, simple_test) {
obj = 5;
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_EQ(5, obj.asInt());
obj = true;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_TRUE(obj.asBool());
obj = "Test";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_EQ(std::string("Test"), obj.asString());
obj["First"] = "Some string";
obj["Second"] = 555;
resultType = item->validate(obj["First"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj["Second"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_EQ(std::string("Some string"), obj["First"].asString());
EXPECT_EQ(555, obj["Second"].asInt());
obj[0] = true;
obj[1] = false;
resultType = item->validate(obj[0], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj[1], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_TRUE(obj[0].asBool());
EXPECT_FALSE(obj[1].asBool());
}
diff --git a/src/components/smart_objects/test/ArraySchemaItem_test.cc b/src/components/smart_objects/test/ArraySchemaItem_test.cc
index 9831f08442..a22a27399d 100644
--- a/src/components/smart_objects/test/ArraySchemaItem_test.cc
+++ b/src/components/smart_objects/test/ArraySchemaItem_test.cc
@@ -34,8 +34,8 @@
#include "gmock/gmock.h"
-#include "smart_objects/smart_object.h"
#include "smart_objects/array_schema_item.h"
+#include "smart_objects/smart_object.h"
#include "smart_objects/string_schema_item.h"
namespace test {
@@ -46,7 +46,7 @@ namespace smart_object_test {
* Test ArraySchemaItem no schema item, no min and max size
**/
TEST(test_no_default_value, test_ArraySchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
ISchemaItemPtr item =
@@ -68,28 +68,28 @@ TEST(test_no_default_value, test_ArraySchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj[0], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[1], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[2], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[3], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
item->applySchema(obj, false);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj[0], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[1], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[2], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[3], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_EQ(38, obj[0].asInt());
EXPECT_TRUE(obj[1].asBool());
@@ -103,19 +103,19 @@ TEST(test_no_default_value, test_ArraySchemaItemTest) {
ASSERT_EQ(std::string("New valid string"), obj.asString());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
// Obj - bool
obj = true;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
// Object - number
obj = 3.1415926;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
}
/**
@@ -125,7 +125,7 @@ TEST(test_no_default_value, test_ArraySchemaItemTest) {
* only if all array elements are valid schema item objects
**/
TEST(test_item_with_default_value, test_ArraySchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
ISchemaItemPtr item = CArraySchemaItem::create(); // No min and max size
@@ -140,24 +140,24 @@ TEST(test_item_with_default_value, test_ArraySchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj[0], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[1], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[2], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
item->applySchema(obj, false);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj[0], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[1], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[2], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
EXPECT_EQ(std::string("Some String"), obj[0].asString());
EXPECT_EQ(std::string("true"), obj[1].asString());
@@ -172,21 +172,21 @@ TEST(test_item_with_default_value, test_ArraySchemaItemTest) {
EXPECT_EQ(std::string("Another String"), obj[3][2].asString());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj[3], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
obj[3][3] = "Another very very loooooong String";
resultType = item->validate(obj[3], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
}
/**
* Test ArraySchemaItem with min size
**/
TEST(test_array_with_min_size, test_ArraySchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
ISchemaItemPtr item = CArraySchemaItem::create(
@@ -197,17 +197,17 @@ TEST(test_array_with_min_size, test_ArraySchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
obj[1] = "true";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
obj[2] = "New String";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
EXPECT_EQ(std::string("Some String"), obj[0].asString());
EXPECT_EQ(std::string("true"), obj[1].asString());
@@ -218,7 +218,7 @@ TEST(test_array_with_min_size, test_ArraySchemaItemTest) {
* Test ArraySchemaItem with min size
**/
TEST(test_array_with_max_size, test_ArraySchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
ISchemaItemPtr item = CArraySchemaItem::create(
@@ -231,22 +231,22 @@ TEST(test_array_with_max_size, test_ArraySchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
obj[1] = "true";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
obj[2] = "New String";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
obj[3] = "Another String";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
EXPECT_EQ(std::string("Some String"), obj[0].asString());
EXPECT_EQ(std::string("true"), obj[1].asString());
@@ -258,7 +258,7 @@ TEST(test_array_with_max_size, test_ArraySchemaItemTest) {
* Test ArraySchemaItem with min and max size
**/
TEST(test_array_with_min_and_max_size, test_ArraySchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
ISchemaItemPtr item = CArraySchemaItem::create(
@@ -271,27 +271,27 @@ TEST(test_array_with_min_and_max_size, test_ArraySchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
obj[1] = "true";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
obj[2] = "New String";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
obj[3] = "Another String";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
obj[4] = "Out of array";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
EXPECT_EQ(std::string("Some String"), obj[0].asString());
EXPECT_EQ(std::string("true"), obj[1].asString());
@@ -301,7 +301,7 @@ TEST(test_array_with_min_and_max_size, test_ArraySchemaItemTest) {
}
TEST(test_map_validate, test_ArraySchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
ISchemaItemPtr item = CArraySchemaItem::create(
@@ -314,29 +314,29 @@ TEST(test_map_validate, test_ArraySchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj["array"], &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
obj["array"][1] = "true";
resultType = item->validate(obj["array"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
obj["array"][2] = "New String";
resultType = item->validate(obj["array"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
obj["array"][3] = "Another String";
resultType = item->validate(obj["array"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
obj["array"][4] = "Out of array";
resultType = item->validate(obj["array"], &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
EXPECT_EQ(std::string("Some String"), obj["array"][0].asString());
EXPECT_EQ(std::string("true"), obj["array"][1].asString());
diff --git a/src/components/smart_objects/test/BoolSchemaItem_test.cc b/src/components/smart_objects/test/BoolSchemaItem_test.cc
index 8d67aa59b2..7400729116 100644
--- a/src/components/smart_objects/test/BoolSchemaItem_test.cc
+++ b/src/components/smart_objects/test/BoolSchemaItem_test.cc
@@ -34,16 +34,14 @@
#include "gmock/gmock.h"
-#include "utils/shared_ptr.h"
-
-#include "smart_objects/smart_object.h"
#include "smart_objects/bool_schema_item.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace smart_object_test {
-using NsSmartDeviceLink::NsSmartObjects::ISchemaItemPtr;
+using ns_smart_device_link::ns_smart_objects::ISchemaItemPtr;
/**
* Test BoolSchemaItem no default value
@@ -53,26 +51,26 @@ using NsSmartDeviceLink::NsSmartObjects::ISchemaItemPtr;
* and leave SmartObject in previous state.
**/
TEST(test_no_default_value, test_BoolSchemaItemTest) {
- NsSmartDeviceLink::NsSmartObjects::SmartObject obj;
+ ns_smart_device_link::ns_smart_objects::SmartObject obj;
ISchemaItemPtr item =
- NsSmartDeviceLink::NsSmartObjects::CBoolSchemaItem::create(); // No
- // default
- // value
+ ns_smart_device_link::ns_smart_objects::CBoolSchemaItem::create(); // No
+ // default
+ // value
obj = 5;
ASSERT_EQ(5, obj.asInt());
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
obj = true;
ASSERT_TRUE(obj.asBool());
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
bool resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
EXPECT_TRUE(obj.asBool());
@@ -81,12 +79,12 @@ TEST(test_no_default_value, test_BoolSchemaItemTest) {
ASSERT_EQ(std::string("Test"), obj.asString());
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
}
@@ -100,11 +98,11 @@ TEST(test_no_default_value, test_BoolSchemaItemTest) {
*value.
**/
TEST(test_item_with_default_value, test_BoolSchemaItemTest) {
- NsSmartDeviceLink::NsSmartObjects::SmartObject obj;
+ ns_smart_device_link::ns_smart_objects::SmartObject obj;
ISchemaItemPtr item =
- NsSmartDeviceLink::NsSmartObjects::CBoolSchemaItem::create(
- NsSmartDeviceLink::NsSmartObjects::TSchemaItemParameter<bool>(
+ ns_smart_device_link::ns_smart_objects::CBoolSchemaItem::create(
+ ns_smart_device_link::ns_smart_objects::TSchemaItemParameter<bool>(
false)); // Default value = false
obj = 5;
@@ -112,14 +110,14 @@ TEST(test_item_with_default_value, test_BoolSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
obj = true;
ASSERT_TRUE(obj.asBool());
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
bool resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_FALSE(obj.asBool());
@@ -128,22 +126,22 @@ TEST(test_item_with_default_value, test_BoolSchemaItemTest) {
ASSERT_EQ(std::string("Test"), obj.asString());
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_FALSE(obj.asBool());
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
EXPECT_FALSE(obj.asBool());
}
TEST(test_map_validate, test_BoolSchemaItemTest) {
- NsSmartDeviceLink::NsSmartObjects::SmartObject obj;
+ ns_smart_device_link::ns_smart_objects::SmartObject obj;
ISchemaItemPtr item =
- NsSmartDeviceLink::NsSmartObjects::CBoolSchemaItem::create(
- NsSmartDeviceLink::NsSmartObjects::TSchemaItemParameter<bool>(
+ ns_smart_device_link::ns_smart_objects::CBoolSchemaItem::create(
+ ns_smart_device_link::ns_smart_objects::TSchemaItemParameter<bool>(
false)); // Default value = false
obj["aa"] = true;
@@ -151,10 +149,10 @@ TEST(test_map_validate, test_BoolSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj["aa"], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
bool resDefault = item->setDefaultValue(obj["aa"]);
@@ -166,18 +164,18 @@ TEST(test_map_validate, test_BoolSchemaItemTest) {
EXPECT_FALSE(obj.asBool());
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
obj["ind"] = true;
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
}
TEST(test_array_validate, test_BoolSchemaItemTest) {
- NsSmartDeviceLink::NsSmartObjects::SmartObject obj;
+ ns_smart_device_link::ns_smart_objects::SmartObject obj;
ISchemaItemPtr item =
- NsSmartDeviceLink::NsSmartObjects::CBoolSchemaItem::create();
+ ns_smart_device_link::ns_smart_objects::CBoolSchemaItem::create();
obj[0] = true;
obj[1] = false;
@@ -187,13 +185,13 @@ TEST(test_array_validate, test_BoolSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj[0], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
resultType = item->validate(obj[1], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
bool resDefault = item->setDefaultValue(obj[0]);
@@ -205,13 +203,13 @@ TEST(test_array_validate, test_BoolSchemaItemTest) {
EXPECT_FALSE(obj[1].asBool());
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
obj = false;
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
}
} // namespace smart_object_test
diff --git a/src/components/smart_objects/test/CMakeLists.txt b/src/components/smart_objects/test/CMakeLists.txt
index e0cc37e104..9c89079d94 100644
--- a/src/components/smart_objects/test/CMakeLists.txt
+++ b/src/components/smart_objects/test/CMakeLists.txt
@@ -53,5 +53,11 @@ set(EXCLUDE_PATHS
SmartObjectConvertionTime_test.cc
)
+# Enable detect Double-free, invalid free
+# AddressSanitizer is a fast memory error detector.
+# It consists of a compiler instrumentation module and a run-time library.
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
+set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
+
collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}" "${EXCLUDE_PATHS}")
create_test(smart_object_test "${SOURCES}" "${LIBRARIES}")
diff --git a/src/components/smart_objects/test/CObjectSchemaItem_test.cc b/src/components/smart_objects/test/CObjectSchemaItem_test.cc
index 523b25a8d8..8a7d09f31e 100644
--- a/src/components/smart_objects/test/CObjectSchemaItem_test.cc
+++ b/src/components/smart_objects/test/CObjectSchemaItem_test.cc
@@ -32,24 +32,25 @@
#include <string>
+#include "formatters/CSmartFactory.h"
+#include "formatters/generic_json_formatter.h"
#include "gmock/gmock.h"
-#include "smart_objects/smart_object.h"
-#include "smart_objects/smart_schema.h"
#include "smart_objects/array_schema_item.h"
#include "smart_objects/bool_schema_item.h"
-#include "smart_objects/string_schema_item.h"
#include "smart_objects/enum_schema_item.h"
#include "smart_objects/number_schema_item.h"
-#include "smart_objects/schema_item_parameter.h"
#include "smart_objects/object_schema_item.h"
-#include "formatters/generic_json_formatter.h"
-#include "formatters/CSmartFactory.h"
+#include "smart_objects/schema_item_parameter.h"
+#include "smart_objects/smart_object.h"
+#include "smart_objects/smart_schema.h"
+#include "smart_objects/string_schema_item.h"
+#include "utils/semantic_version.h"
-namespace formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
-namespace smartobj = NsSmartDeviceLink::NsSmartObjects;
+namespace formatters = ns_smart_device_link::ns_json_handler::formatters;
+namespace smartobj = ns_smart_device_link::ns_smart_objects;
-using namespace NsSmartDeviceLink::NsSmartObjects;
-using namespace NsSmartDeviceLink::NsJSONHandler::strings;
+using namespace ns_smart_device_link::ns_smart_objects;
+using namespace ns_smart_device_link::ns_json_handler::strings;
namespace test {
namespace components {
@@ -88,7 +89,7 @@ namespace Keys {
const char RESULT_CODE[] = "resultCode";
const char INFO[] = "info";
const char SUCCESS[] = "success";
-}
+} // namespace Keys
class ObjectSchemaItemTest : public ::testing::Test {
protected:
@@ -116,31 +117,59 @@ class ObjectSchemaItemTest : public ::testing::Test {
resultCode_values.insert(ResultType::GENERIC_ERROR);
resultCode_values.insert(ResultType::DISALLOWED);
- CObjectSchemaItem::Members paramsMembersMap;
- paramsMembersMap[S_FUNCTION_ID] = CObjectSchemaItem::SMember(
+ Members paramsMembersMap;
+ paramsMembersMap[S_FUNCTION_ID] = SMember(
TEnumSchemaItem<FunctionID::eType>::create(function_values), true);
paramsMembersMap[S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- paramsMembersMap[S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(
- TNumberSchemaItem<int>::create(TSchemaItemParameter<int>(1),
- TSchemaItemParameter<int>(2)),
- true);
-
- CObjectSchemaItem::Members schemaMembersMap;
- schemaMembersMap[Keys::RESULT_CODE] = CObjectSchemaItem::SMember(
+ SMember(TNumberSchemaItem<int>::create(), true);
+ paramsMembersMap[S_PROTOCOL_VERSION] =
+ SMember(TNumberSchemaItem<int>::create(TSchemaItemParameter<int>(1),
+ TSchemaItemParameter<int>(2)),
+ true);
+
+ Members schemaMembersMap;
+ schemaMembersMap[Keys::RESULT_CODE] = SMember(
TEnumSchemaItem<ResultType::eType>::create(resultCode_values), false);
- schemaMembersMap[Keys::INFO] = CObjectSchemaItem::SMember(
- CStringSchemaItem::create(TSchemaItemParameter<size_t>(0),
- TSchemaItemParameter<size_t>(10)),
- false);
- schemaMembersMap[Keys::SUCCESS] =
- CObjectSchemaItem::SMember(CBoolSchemaItem::create(), false);
-
- CObjectSchemaItem::Members rootMembersMap;
- rootMembersMap[S_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(paramsMembersMap), true);
- rootMembersMap[S_MSG_PARAMS] = CObjectSchemaItem::SMember(
- CObjectSchemaItem::create(schemaMembersMap), true);
+ schemaMembersMap[Keys::INFO] =
+ SMember(CStringSchemaItem::create(TSchemaItemParameter<size_t>(0),
+ TSchemaItemParameter<size_t>(10)),
+ false);
+ schemaMembersMap[Keys::SUCCESS] = SMember(CBoolSchemaItem::create(), false);
+
+ // Create fake param that has breaking history changes
+ std::vector<SMember> fake_param_history_vector;
+
+ std::shared_ptr<ISchemaItem> fake_param_SchemaItem =
+ CArraySchemaItem::create(
+ CStringSchemaItem::create(TSchemaItemParameter<size_t>(1),
+ TSchemaItemParameter<size_t>(99),
+ TSchemaItemParameter<std::string>()),
+ TSchemaItemParameter<size_t>(1),
+ TSchemaItemParameter<size_t>(100));
+
+ std::shared_ptr<ISchemaItem> fake_param_history_v1_SchemaItem =
+ CArraySchemaItem::create(
+ CStringSchemaItem::create(TSchemaItemParameter<size_t>(1),
+ TSchemaItemParameter<size_t>(99),
+ TSchemaItemParameter<std::string>()),
+ TSchemaItemParameter<size_t>(1),
+ TSchemaItemParameter<size_t>(100));
+
+ fake_param_history_vector.push_back(SMember(
+ fake_param_history_v1_SchemaItem, true, "", "4.5.0", false, false));
+ schemaMembersMap["fakeParam"] = SMember(fake_param_SchemaItem,
+ false,
+ "4.5.0",
+ "",
+ false,
+ false,
+ fake_param_history_vector);
+
+ Members rootMembersMap;
+ rootMembersMap[S_PARAMS] =
+ SMember(CObjectSchemaItem::create(paramsMembersMap), true);
+ rootMembersMap[S_MSG_PARAMS] =
+ SMember(CObjectSchemaItem::create(schemaMembersMap), true);
schema_item = CObjectSchemaItem::create(rootMembersMap);
}
@@ -156,10 +185,40 @@ TEST_F(ObjectSchemaItemTest, validation_correct) {
obj[S_MSG_PARAMS][Keys::SUCCESS] = true;
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
+}
+
+TEST_F(ObjectSchemaItemTest, validation_correct_with_new_version) {
+ SmartObject obj;
+ obj[S_PARAMS][S_FUNCTION_ID] = 0;
+ obj[S_PARAMS][S_CORRELATION_ID] = 0XFF0;
+ obj[S_PARAMS][S_PROTOCOL_VERSION] = 1;
+ obj[S_MSG_PARAMS][Keys::RESULT_CODE] = 0;
+ obj[S_MSG_PARAMS][Keys::INFO] = "0123456789";
+ obj[S_MSG_PARAMS][Keys::SUCCESS] = true;
+
+ utils::SemanticVersion messageVersion(4, 5, 0);
+ rpc::ValidationReport report("RPC");
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report, messageVersion));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
}
+TEST_F(ObjectSchemaItemTest, validation_invalid_data_with_old_version) {
+ SmartObject obj;
+ obj[S_PARAMS][S_FUNCTION_ID] = 0;
+ obj[S_PARAMS][S_CORRELATION_ID] = 0XFF0;
+ obj[S_PARAMS][S_PROTOCOL_VERSION] = 1;
+ obj[S_MSG_PARAMS][Keys::RESULT_CODE] = 0;
+ obj[S_MSG_PARAMS][Keys::INFO] = "0123456789";
+ obj[S_MSG_PARAMS][Keys::SUCCESS] = true;
+
+ utils::SemanticVersion messageVersion(3, 0, 0);
+ rpc::ValidationReport report("RPC");
+ EXPECT_EQ(errors::MISSING_MANDATORY_PARAMETER,
+ schema_item->validate(obj, &report, messageVersion));
+}
+
TEST_F(ObjectSchemaItemTest, validation_correct_skip_not_mandatory) {
SmartObject obj;
obj[S_PARAMS][S_FUNCTION_ID] = 1;
@@ -170,7 +229,7 @@ TEST_F(ObjectSchemaItemTest, validation_correct_skip_not_mandatory) {
obj[S_MSG_PARAMS][Keys::SUCCESS] = false;
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
}
@@ -180,7 +239,7 @@ TEST_F(ObjectSchemaItemTest, validation_invalid_param) {
obj[S_MSG_PARAMS] = "some message parameters";
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::INVALID_VALUE, schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
obj[S_PARAMS][S_FUNCTION_ID] = "some function";
@@ -190,33 +249,33 @@ TEST_F(ObjectSchemaItemTest, validation_invalid_param) {
obj[S_MSG_PARAMS][Keys::SUCCESS] = 0xABC;
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::INVALID_VALUE, schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
obj[S_PARAMS][S_FUNCTION_ID] = 1;
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::INVALID_VALUE, schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
obj[S_PARAMS][S_CORRELATION_ID] = -0xFF1;
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::INVALID_VALUE, schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
obj[S_PARAMS][S_PROTOCOL_VERSION] = 2;
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::INVALID_VALUE, schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
obj[S_MSG_PARAMS][Keys::RESULT_CODE] = 1;
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::INVALID_VALUE, schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
obj[S_MSG_PARAMS][Keys::SUCCESS] = false;
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
}
TEST_F(ObjectSchemaItemTest, validation_invalid_not_mandatory_param) {
@@ -230,24 +289,24 @@ TEST_F(ObjectSchemaItemTest, validation_invalid_not_mandatory_param) {
// invalid non-mandatory obj[S_MSG_PARAMS][Keys::INFO]
obj[S_MSG_PARAMS][Keys::INFO] = 0x10;
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::INVALID_VALUE, schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
// invalid non-mandatory obj[S_MSG_PARAMS][Keys::INFO]
obj[S_MSG_PARAMS][Keys::INFO] = true;
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::INVALID_VALUE, schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
// invalid non-mandatory obj[S_MSG_PARAMS][Keys::INFO]
obj[S_MSG_PARAMS][Keys::INFO] = SmartObject();
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::INVALID_VALUE, schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
obj[S_MSG_PARAMS][Keys::INFO] = "info";
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
}
@@ -261,27 +320,27 @@ TEST_F(ObjectSchemaItemTest, validation_missing_mandatory) {
obj[S_MSG_PARAMS][Keys::SUCCESS] = false;
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::MISSING_MANDATORY_PARAMETER,
+ EXPECT_EQ(errors::MISSING_MANDATORY_PARAMETER,
schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
obj[S_PARAMS][S_FUNCTION_ID] = 2;
// S_CORRELATION_ID and S_PROTOCOL_VERSION is still missed
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::MISSING_MANDATORY_PARAMETER,
+ EXPECT_EQ(errors::MISSING_MANDATORY_PARAMETER,
schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
obj[S_PARAMS][S_CORRELATION_ID] = 0XFF2;
// S_PROTOCOL_VERSION is still missed
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::MISSING_MANDATORY_PARAMETER,
+ EXPECT_EQ(errors::MISSING_MANDATORY_PARAMETER,
schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
obj[S_PARAMS][S_PROTOCOL_VERSION] = 1;
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
}
@@ -301,19 +360,19 @@ TEST_F(ObjectSchemaItemTest, validation_unexpected_param) {
obj[fake1] = SmartObject(static_cast<int64_t>(0));
// any fake parameter is OK
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
obj[S_PARAMS][fake2] = SmartObject("123");
// any fake parameters are OK
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
obj[S_MSG_PARAMS][fake3] = true;
// any fake parameters are OK
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
}
@@ -341,7 +400,7 @@ TEST_F(ObjectSchemaItemTest, validation_unexpected_param_remove) {
EXPECT_TRUE(obj[S_PARAMS].keyExists(fake2));
EXPECT_TRUE(obj[S_MSG_PARAMS].keyExists(fake3));
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
// Check apply schema, remove fake parameter
@@ -356,7 +415,7 @@ TEST_F(ObjectSchemaItemTest, validation_unexpected_param_remove) {
EXPECT_TRUE(obj[S_MSG_PARAMS].keyExists(Keys::INFO));
EXPECT_TRUE(obj[S_MSG_PARAMS].keyExists(Keys::SUCCESS));
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
obj[fake1] = SmartObject(static_cast<int64_t>(0));
@@ -372,7 +431,7 @@ TEST_F(ObjectSchemaItemTest, validation_unexpected_param_remove) {
EXPECT_FALSE(obj[S_MSG_PARAMS].keyExists(fake3));
// Invalide state after enum convertion
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::INVALID_VALUE, schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
}
@@ -388,18 +447,18 @@ TEST_F(ObjectSchemaItemTest, validation_empty_params) {
obj[S_MSG_PARAMS]["FAKE_PARAM3"] = SmartObject("2");
rpc::ValidationReport report("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
schema_item->applySchema(obj, false);
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(obj, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
schema_item->unapplySchema(obj);
// Invalide state after enum convertion
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report));
+ EXPECT_EQ(errors::INVALID_VALUE, schema_item->validate(obj, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
}
@@ -436,12 +495,12 @@ TEST_F(ObjectSchemaItemTest, test_strings_to_enum_conversion) {
// S_FUNCTION_ID and RESULT_CODE are not converted to int
rpc::ValidationReport report("RPC");
- EXPECT_NE(Errors::OK, schema_item->validate(object, &report));
+ EXPECT_NE(errors::OK, schema_item->validate(object, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
schema_item->applySchema(object, false);
report = rpc::ValidationReport("RPC");
- EXPECT_EQ(Errors::OK, schema_item->validate(object, &report));
+ EXPECT_EQ(errors::OK, schema_item->validate(object, &report));
EXPECT_EQ(std::string(""), rpc::PrettyFormat(report));
// check conversion result
@@ -451,7 +510,7 @@ TEST_F(ObjectSchemaItemTest, test_strings_to_enum_conversion) {
schema_item->unapplySchema(object);
// S_FUNCTION_ID and RESULT_CODE are string
report = rpc::ValidationReport("RPC");
- EXPECT_NE(Errors::OK, schema_item->validate(object, &report));
+ EXPECT_NE(errors::OK, schema_item->validate(object, &report));
EXPECT_NE(std::string(""), rpc::PrettyFormat(report));
// check conversion result
@@ -466,8 +525,8 @@ TEST_F(ObjectSchemaItemTest, test_strings_to_enum_conversion) {
} // namespace components
} // namespace test
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
namespace FunctionID = test::components::smart_object_test::FunctionID;
typedef EnumConversionHelper<FunctionID::eType> FunctionConvertor;
@@ -541,5 +600,5 @@ const ResultType::eType ResultTypeConvertor::enum_values_[] = {
ResultType::USER_DISALLOWED,
ResultType::GENERIC_ERROR,
ResultType::DISALLOWED};
-} // namespace NsSmartObjects
-} // namespace NsSmartDeviceLink
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/test/EnumSchemaItem_test.cc b/src/components/smart_objects/test/EnumSchemaItem_test.cc
index 9914167e5a..4f675ab181 100644
--- a/src/components/smart_objects/test/EnumSchemaItem_test.cc
+++ b/src/components/smart_objects/test/EnumSchemaItem_test.cc
@@ -32,8 +32,8 @@
#include "gmock/gmock.h"
-#include "smart_objects/smart_object.h"
#include "smart_objects/enum_schema_item.h"
+#include "smart_objects/smart_object.h"
#include "smart_objects/string_schema_item.h"
#include <string>
@@ -42,7 +42,7 @@ namespace test {
namespace components {
namespace smart_object_test {
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
namespace TestType {
enum eType {
INVALID_ENUM = -1,
@@ -94,7 +94,7 @@ TEST_F(EnumSchemaItemTest, test_item_with_default_value) {
obj = TestType::BLUETOOTH_OFF;
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
bool resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_EQ(TestType::FACTORY_DEFAULTS, obj.asInt());
@@ -103,7 +103,7 @@ TEST_F(EnumSchemaItemTest, test_item_with_default_value) {
obj = true;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_EQ(TestType::FACTORY_DEFAULTS, obj.asInt());
@@ -112,7 +112,7 @@ TEST_F(EnumSchemaItemTest, test_item_with_default_value) {
obj = 3.1415926;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
@@ -121,7 +121,7 @@ TEST_F(EnumSchemaItemTest, test_item_with_default_value) {
// Object - string
obj = "Some string";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
@@ -145,7 +145,7 @@ TEST_F(EnumSchemaItemTest, test_item_without_default_value) {
obj = TestType::BLUETOOTH_OFF;
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
bool resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
EXPECT_EQ(TestType::BLUETOOTH_OFF, obj.asInt());
@@ -154,7 +154,7 @@ TEST_F(EnumSchemaItemTest, test_item_without_default_value) {
obj = true;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
EXPECT_TRUE(obj.asBool());
@@ -163,7 +163,7 @@ TEST_F(EnumSchemaItemTest, test_item_without_default_value) {
obj = 3.1415926;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
@@ -172,7 +172,7 @@ TEST_F(EnumSchemaItemTest, test_item_without_default_value) {
// Object - string
obj = "Some string";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
@@ -181,12 +181,12 @@ TEST_F(EnumSchemaItemTest, test_item_without_default_value) {
// Object - int in range of enum
obj = 6;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object - int out of enum range
obj = 15;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
}
/**
@@ -203,31 +203,31 @@ TEST_F(EnumSchemaItemTest, test_apply_unapply_schema) {
obj = TestType::BLUETOOTH_OFF;
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
bool resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_EQ(TestType::FACTORY_DEFAULTS, obj.asInt());
item->unapplySchema(obj);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
EXPECT_EQ(std::string("FACTORY_DEFAULTS"), obj.asString());
item->applySchema(obj, false);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_EQ(TestType::FACTORY_DEFAULTS, obj.asInt());
obj = "TOO_MANY_REQUESTS";
item->applySchema(obj, false);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_EQ(TestType::TOO_MANY_REQUESTS, obj.asInt());
obj = "ENOUGH_REQUESTS";
item->applySchema(obj, false);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
EXPECT_EQ(std::string("ENOUGH_REQUESTS"), obj.asString());
}
@@ -235,8 +235,8 @@ TEST_F(EnumSchemaItemTest, test_apply_unapply_schema) {
} // namespace components
} // namespace test
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
template <>
const EnumConversionHelper<test::components::SmartObjects::SchemaItem::
@@ -278,5 +278,5 @@ const test::components::SmartObjects::SchemaItem::TestType::eType
test::components::SmartObjects::SchemaItem::TestType::MASTER_RESET,
test::components::SmartObjects::SchemaItem::TestType::FACTORY_DEFAULTS,
test::components::SmartObjects::SchemaItem::TestType::APP_UNAUTHORIZED};
-}
-}
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/test/NumberSchemaItem_test.cc b/src/components/smart_objects/test/NumberSchemaItem_test.cc
index 0315bcedb3..04010be3f3 100644
--- a/src/components/smart_objects/test/NumberSchemaItem_test.cc
+++ b/src/components/smart_objects/test/NumberSchemaItem_test.cc
@@ -33,14 +33,14 @@
#include <string>
#include "gmock/gmock.h"
-#include "smart_objects/smart_object.h"
#include "smart_objects/number_schema_item.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace smart_object_test {
-using NsSmartDeviceLink::NsSmartObjects::ISchemaItemPtr;
+using ns_smart_device_link::ns_smart_objects::ISchemaItemPtr;
/**
* Test NumberSchemaItem as INT with no default value
@@ -50,7 +50,7 @@ using NsSmartDeviceLink::NsSmartObjects::ISchemaItemPtr;
* and leave SmartObject in previous state.
**/
TEST(test_int_no_default_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -63,20 +63,20 @@ TEST(test_int_no_default_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Obj bool
obj = true;
ASSERT_TRUE(obj.asBool());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
// Set default value
bool resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
EXPECT_TRUE(obj.asBool());
// Obj string
@@ -84,18 +84,18 @@ TEST(test_int_no_default_value, test_NumberSchemaItemTest) {
ASSERT_EQ(std::string("Test"), obj.asString());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
}
/**
* Test NumberSchemaItem as INT with setted min value
**/
TEST(test_int_min_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -108,28 +108,28 @@ TEST(test_int_min_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object int incorrect
obj = 9;
ASSERT_EQ(9, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Object int correct
obj = 10;
ASSERT_EQ(10, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
}
/**
* Test NumberSchemaItem as INT with setted max value
**/
TEST(test_int_max_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -143,28 +143,28 @@ TEST(test_int_max_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object int incorrect
obj = 750;
ASSERT_EQ(750, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Object int correct
obj = -750;
ASSERT_EQ(-750, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
}
/**
* Test NumberSchemaItem as INT with setted min and max value
**/
TEST(test_int_min_max_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -178,35 +178,35 @@ TEST(test_int_min_max_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object int incorrect
obj = 750;
ASSERT_EQ(750, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Object int correct
obj = -949;
ASSERT_EQ(-949, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object int incorrect
obj = -950;
ASSERT_EQ(-950, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
}
/**
* Test NumberSchemaItem as INT with correct default value
**/
TEST(test_int_correct_default_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -221,44 +221,44 @@ TEST(test_int_correct_default_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object int incorrect
obj = -12001;
ASSERT_EQ(-12001, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Object int correct
obj = 100;
ASSERT_EQ(100, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object int incorrect
obj = 101;
ASSERT_EQ(101, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Set default value
bool resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_EQ(-38, obj.asInt());
// Object string
obj = "string";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_EQ(-38, obj.asInt());
}
@@ -266,7 +266,7 @@ TEST(test_int_correct_default_value, test_NumberSchemaItemTest) {
* Test NumberSchemaItem as INT with default value out of range
**/
TEST(test_int_default_value_out_of_range, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -281,49 +281,49 @@ TEST(test_int_default_value_out_of_range, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object int incorrect
obj = 89;
ASSERT_EQ(89, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Object int correct
obj = 100;
ASSERT_EQ(100, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object int incorrect
obj = 101;
ASSERT_EQ(101, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Set default value
bool resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
EXPECT_EQ(50, obj.asInt());
// Object string
obj = "string";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
EXPECT_EQ(50, obj.asInt());
}
TEST(test_int_map_validate, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -339,15 +339,15 @@ TEST(test_int_map_validate, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj["min"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj["max"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj["out_of_min"], &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
resultType = item->validate(obj["out_of_max"], &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
// Set default value
bool resDefault = item->setDefaultValue(obj["aa"]);
@@ -359,17 +359,17 @@ TEST(test_int_map_validate, test_NumberSchemaItemTest) {
EXPECT_EQ(-38, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj["min"], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
}
TEST(test_int_array_validate, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -385,21 +385,21 @@ TEST(test_int_array_validate, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj[0], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OUT_OF_RANGE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OUT_OF_RANGE,
resultType);
resultType = item->validate(obj[1], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
resultType = item->validate(obj[2], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
resultType = item->validate(obj[3], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OUT_OF_RANGE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OUT_OF_RANGE,
resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
bool resDefault = item->setDefaultValue(obj[0]);
@@ -411,14 +411,14 @@ TEST(test_int_array_validate, test_NumberSchemaItemTest) {
EXPECT_EQ(-38, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
resultType = item->validate(obj[0], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
}
@@ -430,7 +430,7 @@ TEST(test_int_array_validate, test_NumberSchemaItemTest) {
* and leave SmartObject in previous state.
**/
TEST(test_double_no_default_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -443,20 +443,20 @@ TEST(test_double_no_default_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Obj bool
obj = true;
ASSERT_TRUE(obj.asBool());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
// Set default value
bool resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
EXPECT_TRUE(obj.asBool());
// Obj string
@@ -464,20 +464,20 @@ TEST(test_double_no_default_value, test_NumberSchemaItemTest) {
ASSERT_EQ(std::string("Test"), obj.asString());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
// Set default value
resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
}
/**
* Test NumberSchemaItem as DOUBLE with setted min value
**/
TEST(test_double_min_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -490,28 +490,28 @@ TEST(test_double_min_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object double incorrect
obj = 9.999999;
ASSERT_EQ(9.999999, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
/*
//Object int
obj = 10;
ASSERT_EQ(10, obj.asInt());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);*/
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);*/
}
/**
* Test NumberSchemaItem as DOUBLE with setted max value
**/
TEST(test_double_max_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -525,28 +525,28 @@ TEST(test_double_max_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object double incorrect
obj = 749.0001;
ASSERT_EQ(749.0001, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Object double correct
obj = -750.0;
ASSERT_EQ(-750.0, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
}
/**
* Test NumberSchemaItem as DOUBLE with setted min and max value
**/
TEST(test_double_min_max_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -560,35 +560,35 @@ TEST(test_double_min_max_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object double incorrect
obj = 749.001;
ASSERT_EQ(749.001, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Object double correct
obj = -949.0;
ASSERT_EQ(-949.0, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object double incorrect
obj = -949.00001;
ASSERT_EQ(-949.00001, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
}
/**
* Test NumberSchemaItem as DOUBLE with correct default value
**/
TEST(test_double_correct_default_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -603,44 +603,44 @@ TEST(test_double_correct_default_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object double incorrect
obj = -12000.01;
ASSERT_EQ(-12000.01, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Object double correct
obj = 100.0;
ASSERT_EQ(100.0, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object double incorrect
obj = 100.001;
ASSERT_EQ(100.001, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Set default value
bool resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_EQ(-38.0, obj.asDouble());
// Object string
obj = "string";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_EQ(-38.0, obj.asDouble());
}
@@ -648,7 +648,7 @@ TEST(test_double_correct_default_value, test_NumberSchemaItemTest) {
* Test NumberSchemaItem as DOUBLE with default value out of range
**/
TEST(test_double_default_value_out_of_range, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -663,49 +663,49 @@ TEST(test_double_default_value_out_of_range, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object double incorrect
obj = 89.999;
ASSERT_EQ(89.999, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Object double correct
obj = 100.0;
ASSERT_EQ(100.0, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
// Object double incorrect
obj = 100.001;
ASSERT_EQ(100.001, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
// Set default value
bool resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
EXPECT_EQ(50.0, obj.asDouble());
// Object string
obj = "string";
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
EXPECT_EQ(50.0, obj.asDouble());
}
TEST(test_double_map_validate, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -721,15 +721,15 @@ TEST(test_double_map_validate, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj["min"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj["max"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj["out_of_min"], &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
resultType = item->validate(obj["out_of_max"], &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
bool resDefault = item->setDefaultValue(obj["aa"]);
EXPECT_TRUE(resDefault);
@@ -740,17 +740,17 @@ TEST(test_double_map_validate, test_NumberSchemaItemTest) {
EXPECT_EQ(-38.0, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj["min"], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
}
TEST(test_double_array_validate, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
@@ -766,21 +766,21 @@ TEST(test_double_array_validate, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj[0], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OUT_OF_RANGE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OUT_OF_RANGE,
resultType);
resultType = item->validate(obj[1], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
resultType = item->validate(obj[2], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
resultType = item->validate(obj[3], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OUT_OF_RANGE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OUT_OF_RANGE,
resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
bool resDefault = item->setDefaultValue(obj[0]);
@@ -792,19 +792,19 @@ TEST(test_double_array_validate, test_NumberSchemaItemTest) {
EXPECT_EQ(-38.0, obj.asDouble());
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType);
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::OK, resultType);
resultType = item->validate(obj[0], &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE,
+ EXPECT_EQ(ns_smart_device_link::ns_smart_objects::errors::INVALID_VALUE,
resultType);
}
TEST(test_int_double_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
ISchemaItemPtr item = TNumberSchemaItem<int>::create(
TSchemaItemParameter<int>(10),
@@ -817,11 +817,11 @@ TEST(test_int_double_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
}
TEST(test_double_int_value, test_NumberSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
ISchemaItemPtr item = TNumberSchemaItem<double>::create(
TSchemaItemParameter<double>(10.0),
@@ -834,7 +834,7 @@ TEST(test_double_int_value, test_NumberSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
}
} // namespace smart_object_test
diff --git a/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc b/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc
index b11560914e..555239c489 100644
--- a/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc
+++ b/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc
@@ -36,30 +36,28 @@
#include "gmock/gmock.h"
-#include "utils/shared_ptr.h"
-
-#include "smart_objects/smart_object.h"
-#include "smart_objects/smart_schema.h"
-#include "smart_objects/schema_item.h"
-#include "formatters/CFormatterJsonSDLRPCv2.h"
#include "formatters/CFormatterJsonSDLRPCv1.h"
+#include "formatters/CFormatterJsonSDLRPCv2.h"
#include "smart_objects/array_schema_item.h"
#include "smart_objects/bool_schema_item.h"
-#include "smart_objects/object_schema_item.h"
-#include "smart_objects/string_schema_item.h"
#include "smart_objects/enum_schema_item.h"
#include "smart_objects/number_schema_item.h"
+#include "smart_objects/object_schema_item.h"
+#include "smart_objects/schema_item.h"
#include "smart_objects/schema_item_parameter.h"
+#include "smart_objects/smart_object.h"
+#include "smart_objects/smart_schema.h"
+#include "smart_objects/string_schema_item.h"
-#include <string>
#include <time.h>
+#include <string>
namespace test {
namespace components {
namespace smart_object_test {
-using namespace NsSmartDeviceLink::NsJSONHandler::strings;
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_json_handler::strings;
+using namespace ns_smart_device_link::ns_smart_objects;
namespace TestType {
enum eType {
@@ -98,7 +96,7 @@ class SmartObjectConvertionTimeTest : public ::testing::Test {
clock_gettime(CLOCK_REALTIME, &convertionStartTime);
// SmartObjects --> JSON
- NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonSDLRPCv2::
+ ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonSDLRPCv2::
toString(srcObj, jsonString);
clock_gettime(CLOCK_REALTIME, &convertionEndTime);
@@ -116,7 +114,7 @@ class SmartObjectConvertionTimeTest : public ::testing::Test {
clock_gettime(CLOCK_REALTIME, &convertionStartTime);
// JSON --> SmartObjects
- NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonSDLRPCv2::
+ ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonSDLRPCv2::
fromString<FunctionIdTest::eType, MessageTypeTest::eType>(
jsonString,
dstObj,
@@ -138,7 +136,7 @@ class SmartObjectConvertionTimeTest : public ::testing::Test {
clock_gettime(CLOCK_REALTIME, &convertionStartTime);
// SmartObjects --> JSON
- NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonSDLRPCv1::
+ ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonSDLRPCv1::
toString(srcObj, jsonString);
clock_gettime(CLOCK_REALTIME, &convertionEndTime);
@@ -155,7 +153,7 @@ class SmartObjectConvertionTimeTest : public ::testing::Test {
clock_gettime(CLOCK_REALTIME, &convertionStartTime);
// JSON --> SmartObjects
- NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonSDLRPCv1::
+ ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonSDLRPCv1::
fromString<FunctionIdTest::eType, MessageTypeTest::eType>(jsonString,
dstObj);
@@ -254,20 +252,20 @@ class SmartObjectConvertionTimeTest : public ::testing::Test {
TEnumSchemaItem<MessageTypeTest::eType>::create(
messageType_allowedEnumSubsetValues);
- CObjectSchemaItem::Members paramsMembersMap;
- paramsMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID] =
- CObjectSchemaItem::SMember(functionId_SchemaItem, true);
+ Members paramsMembersMap;
+ paramsMembersMap
+ [ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID] =
+ SMember(functionId_SchemaItem, true);
paramsMembersMap
- [NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE] =
- CObjectSchemaItem::SMember(messageType_SchemaItem, true);
+ [ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE] =
+ SMember(messageType_SchemaItem, true);
paramsMembersMap
- [NsSmartDeviceLink::NsJSONHandler::strings::S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ [ns_smart_device_link::ns_json_handler::strings::S_CORRELATION_ID] =
+ SMember(TNumberSchemaItem<int>::create(), true);
- std::map<std::string, CObjectSchemaItem::SMember> rootMembersMap;
- rootMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] =
- CObjectSchemaItem::SMember(CObjectSchemaItem::create(paramsMembersMap),
- true);
+ std::map<std::string, SMember> rootMembersMap;
+ rootMembersMap[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] =
+ SMember(CObjectSchemaItem::create(paramsMembersMap), true);
return CSmartSchema(CObjectSchemaItem::create(rootMembersMap));
}
@@ -319,49 +317,43 @@ class SmartObjectConvertionTimeTest : public ::testing::Test {
TSchemaItemParameter<int>(2000000000),
TSchemaItemParameter<int>());
- std::map<std::string, CObjectSchemaItem::SMember> schemaMembersMap;
-
- schemaMembersMap["success"] =
- CObjectSchemaItem::SMember(success_SchemaItem, true);
- schemaMembersMap["resultCode"] =
- CObjectSchemaItem::SMember(resultCode_SchemaItem, true);
- schemaMembersMap["info"] =
- CObjectSchemaItem::SMember(info_SchemaItem, false);
- schemaMembersMap["tryAgainTime"] =
- CObjectSchemaItem::SMember(tryAgainTime_SchemaItem, true);
-
- std::map<std::string, CObjectSchemaItem::SMember> paramsMembersMap;
- paramsMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID] =
- CObjectSchemaItem::SMember(
- TEnumSchemaItem<FunctionIdTest::eType>::create(
- functionId_allowedEnumSubsetValues),
- true);
+ std::map<std::string, SMember> schemaMembersMap;
+
+ schemaMembersMap["success"] = SMember(success_SchemaItem, true);
+ schemaMembersMap["resultCode"] = SMember(resultCode_SchemaItem, true);
+ schemaMembersMap["info"] = SMember(info_SchemaItem, false);
+ schemaMembersMap["tryAgainTime"] = SMember(tryAgainTime_SchemaItem, true);
+
+ std::map<std::string, SMember> paramsMembersMap;
paramsMembersMap
- [NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE] =
- CObjectSchemaItem::SMember(
- TEnumSchemaItem<MessageTypeTest::eType>::create(
- messageType_allowedEnumSubsetValues),
- true);
+ [ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID] =
+ SMember(TEnumSchemaItem<FunctionIdTest::eType>::create(
+ functionId_allowedEnumSubsetValues),
+ true);
+ paramsMembersMap
+ [ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE] =
+ SMember(TEnumSchemaItem<MessageTypeTest::eType>::create(
+ messageType_allowedEnumSubsetValues),
+ true);
paramsMembersMap
- [NsSmartDeviceLink::NsJSONHandler::strings::S_CORRELATION_ID] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ [ns_smart_device_link::ns_json_handler::strings::S_CORRELATION_ID] =
+ SMember(TNumberSchemaItem<int>::create(), true);
paramsMembersMap
- [NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_VERSION] =
- CObjectSchemaItem::SMember(
+ [ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_VERSION] =
+ SMember(
TNumberSchemaItem<int>::create(TSchemaItemParameter<int>(1),
TSchemaItemParameter<int>(2)),
true);
paramsMembersMap
- [NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_TYPE] =
- CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
-
- std::map<std::string, CObjectSchemaItem::SMember> rootMembersMap;
- rootMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_MSG_PARAMS] =
- CObjectSchemaItem::SMember(CObjectSchemaItem::create(schemaMembersMap),
- true);
- rootMembersMap[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] =
- CObjectSchemaItem::SMember(CObjectSchemaItem::create(paramsMembersMap),
- true);
+ [ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_TYPE] =
+ SMember(TNumberSchemaItem<int>::create(), true);
+
+ std::map<std::string, SMember> rootMembersMap;
+ rootMembersMap
+ [ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS] =
+ SMember(CObjectSchemaItem::create(schemaMembersMap), true);
+ rootMembersMap[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] =
+ SMember(CObjectSchemaItem::create(paramsMembersMap), true);
return CSmartSchema(CObjectSchemaItem::create(rootMembersMap));
}
};
@@ -640,8 +632,8 @@ TEST_F(SmartObjectConvertionTimeTest, test_object_without_enum_convertion) {
} // namespace components
} // namespace test
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
template <>
const EnumConversionHelper<test::components::SmartObjects::
@@ -782,5 +774,5 @@ const test::components::SmartObjects::SmartObjectConvertionTimeTest::
MessageTypeTest::response,
test::components::SmartObjects::SmartObjectConvertionTimeTest::
MessageTypeTest::notification};
-}
-}
+} // namespace ns_smart_objects
+} // namespace ns_smart_device_link
diff --git a/src/components/smart_objects/test/SmartObjectDraft_test.cc b/src/components/smart_objects/test/SmartObjectDraft_test.cc
index de8103771c..d2382be51d 100644
--- a/src/components/smart_objects/test/SmartObjectDraft_test.cc
+++ b/src/components/smart_objects/test/SmartObjectDraft_test.cc
@@ -37,15 +37,15 @@
#include "smart_objects/smart_object.h"
-using ::testing::ElementsAre;
using ::testing::ContainerEq;
+using ::testing::ElementsAre;
namespace test {
namespace components {
namespace smart_object_test {
-using NsSmartDeviceLink::NsSmartObjects::SmartObject;
-using NsSmartDeviceLink::NsSmartObjects::SmartType;
+using ns_smart_device_link::ns_smart_objects::SmartObject;
+using ns_smart_device_link::ns_smart_objects::SmartType;
TEST(SmartObjectsDraftTest, primitive_types) {
SmartObject obj;
@@ -126,7 +126,7 @@ TEST(SmartObjectsDraftTest, test_public_interface) {
ASSERT_EQ(std::string("Hello, world"), obj.asString());
// ---- Binary ---- //
- NsSmartDeviceLink::NsSmartObjects::SmartBinary binaryData;
+ ns_smart_device_link::ns_smart_objects::SmartBinary binaryData;
binaryData.push_back('\0');
binaryData.push_back('a');
obj = binaryData;
@@ -203,7 +203,7 @@ TEST(SmartObjectsDraftTest, test_helper_methods) {
ASSERT_EQ(std::string("Hello, world"), obj.asString());
// ---- Binary ---- //
- NsSmartDeviceLink::NsSmartObjects::SmartBinary binaryData;
+ ns_smart_device_link::ns_smart_objects::SmartBinary binaryData;
binaryData.push_back('\0');
binaryData.push_back('a');
obj = binaryData;
diff --git a/src/components/smart_objects/test/SmartObjectInvalid_test.cc b/src/components/smart_objects/test/SmartObjectInvalid_test.cc
index 68afbb6237..ff5949df6a 100644
--- a/src/components/smart_objects/test/SmartObjectInvalid_test.cc
+++ b/src/components/smart_objects/test/SmartObjectInvalid_test.cc
@@ -40,7 +40,7 @@ namespace test {
namespace components {
namespace smart_object_test {
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
TEST(test_SmartObjectInvalidTest, simple_type_can_be_set_in_constructor) {
SmartObject objMap(SmartType_Map);
@@ -116,7 +116,7 @@ TEST(test_SmartObjectInvalidTest, invalid_object_remains_invalid) {
ASSERT_EQ(invalid_string_value, obj.asString());
// ---- BINARY ---- //
- NsSmartDeviceLink::NsSmartObjects::SmartBinary binaryData;
+ ns_smart_device_link::ns_smart_objects::SmartBinary binaryData;
binaryData.push_back('\0');
binaryData.push_back('a');
obj = binaryData;
diff --git a/src/components/smart_objects/test/SmartObjectStress_test.cc b/src/components/smart_objects/test/SmartObjectStress_test.cc
index 698bd0415a..4c0234589f 100644
--- a/src/components/smart_objects/test/SmartObjectStress_test.cc
+++ b/src/components/smart_objects/test/SmartObjectStress_test.cc
@@ -40,7 +40,7 @@
namespace test {
namespace components {
namespace smart_object_test {
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
class StressTestHelper : public ::testing::Test {
private:
@@ -184,8 +184,8 @@ class StressTestHelper : public ::testing::Test {
std::string strVal("c:");
strVal += strDataVal;
- NsSmartDeviceLink::NsSmartObjects::SmartBinary binaryVal(dataSize,
- randomChar);
+ ns_smart_device_link::ns_smart_objects::SmartBinary binaryVal(
+ dataSize, randomChar);
obj = binaryVal; // string with binary data filled with random chars
mVerifyMap[key_path] = strVal;
@@ -259,10 +259,10 @@ TEST_F(StressTestHelper, StressTest) {
if (!value.compare(0, 2, "c:")) {
std::string etalonData = value.substr(2);
- ASSERT_EQ(NsSmartDeviceLink::NsSmartObjects::SmartType_Binary,
+ ASSERT_EQ(ns_smart_device_link::ns_smart_objects::SmartType_Binary,
obj.getType());
- NsSmartDeviceLink::NsSmartObjects::SmartBinary binaryData =
+ ns_smart_device_link::ns_smart_objects::SmartBinary binaryData =
obj.asBinary();
ASSERT_EQ(etalonData.size(), binaryData.size());
@@ -270,10 +270,10 @@ TEST_F(StressTestHelper, StressTest) {
{
std::string etalonData = value.substr(2);
- ASSERT_EQ(NsSmartDeviceLink::NsSmartObjects::SmartType_Binary,
+ ASSERT_EQ(ns_smart_device_link::ns_smart_objects::SmartType_Binary,
obj.getType());
- NsSmartDeviceLink::NsSmartObjects::SmartBinary binaryData =
+ ns_smart_device_link::ns_smart_objects::SmartBinary binaryData =
obj.asBinary();
ASSERT_EQ(etalonData.size(), binaryData.size());
diff --git a/src/components/smart_objects/test/SmartObjectUnit_test.cc b/src/components/smart_objects/test/SmartObjectUnit_test.cc
index 0a67b7e922..4a2fadfbe9 100644
--- a/src/components/smart_objects/test/SmartObjectUnit_test.cc
+++ b/src/components/smart_objects/test/SmartObjectUnit_test.cc
@@ -31,18 +31,19 @@
*/
#include "gmock/gmock.h"
+#define final // Disable error: cannot derive from ‘final’ base
#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace smart_object_test {
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
class TestHelper : public ::testing::Test {
protected:
void makeMapObject(SmartObject& obj, const int size) const {
- char i_key[8], j_key[8], k_key[8], value[8];
+ char i_key[32], j_key[32], k_key[32], value[32];
for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++)
@@ -56,7 +57,7 @@ class TestHelper : public ::testing::Test {
}
void checkMapObject(SmartObject& obj, const int size) const {
- char i_key[8], j_key[8], k_key[8], value[8];
+ char i_key[32], j_key[32], k_key[32], value[32];
for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++)
@@ -585,6 +586,29 @@ TEST(MapEraseTest, SmartObjectTest) {
}
// TODO: Add a test to check accessing an array at strange indexes.
+TEST(DoubleCleanupDataTest, SmartObjectTest) {
+ class DerivedSmartObject : public SmartObject {
+ public:
+ DerivedSmartObject(SmartType Type) : SmartObject(Type) {}
+ using SmartObject::operator=;
+ void cleanup_data() {
+ SmartObject::cleanup_data();
+ }
+ };
+
+ DerivedSmartObject obj(SmartType_String);
+ ASSERT_EQ(SmartType_String, obj.getType());
+
+ obj = "test string_value";
+ ASSERT_EQ(std::string("test string_value"), obj.asString());
+
+ obj.cleanup_data();
+ ASSERT_EQ(std::string(""), obj.asCharArray());
+
+ obj.cleanup_data();
+ ASSERT_EQ(std::string(""), obj.asCharArray());
+}
+
} // namespace smart_object_test
} // namespace components
} // namespace test
diff --git a/src/components/smart_objects/test/StringSchemaItem_test.cc b/src/components/smart_objects/test/StringSchemaItem_test.cc
index 4e4688d354..7bf0d0ed89 100644
--- a/src/components/smart_objects/test/StringSchemaItem_test.cc
+++ b/src/components/smart_objects/test/StringSchemaItem_test.cc
@@ -49,7 +49,7 @@ namespace smart_object_test {
* and leave SmartObject in previous state.
**/
TEST(test_no_default_value, test_StringSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
ISchemaItemPtr item =
@@ -61,7 +61,7 @@ TEST(test_no_default_value, test_StringSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
bool resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
EXPECT_EQ(std::string("New valid string"), obj.asString());
@@ -70,7 +70,7 @@ TEST(test_no_default_value, test_StringSchemaItemTest) {
obj = true;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
EXPECT_TRUE(obj.asBool());
@@ -79,12 +79,12 @@ TEST(test_no_default_value, test_StringSchemaItemTest) {
obj = 3.1415926;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_FALSE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
EXPECT_EQ(3.1415926, obj.asDouble());
}
@@ -98,7 +98,7 @@ TEST(test_no_default_value, test_StringSchemaItemTest) {
*default value.
**/
TEST(test_item_with_default_value, test_StringSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
ISchemaItemPtr item = CStringSchemaItem::create(
@@ -113,7 +113,7 @@ TEST(test_item_with_default_value, test_StringSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
bool resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_EQ(std::string("Default string"), obj.asString());
@@ -122,7 +122,7 @@ TEST(test_item_with_default_value, test_StringSchemaItemTest) {
obj = true;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_EQ(std::string("Default string"), obj.asString());
@@ -131,12 +131,12 @@ TEST(test_item_with_default_value, test_StringSchemaItemTest) {
obj = 3.1415926;
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
EXPECT_EQ(std::string("Default string"), obj.asString());
}
@@ -144,7 +144,7 @@ TEST(test_item_with_default_value, test_StringSchemaItemTest) {
* Test StringSchemaItem with max length
**/
TEST(test_item_with_max_length, test_StringSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
ISchemaItemPtr item = CStringSchemaItem::create(
@@ -158,7 +158,7 @@ TEST(test_item_with_max_length, test_StringSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
bool resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_EQ(std::string("Default string"), obj.asString());
@@ -168,17 +168,17 @@ TEST(test_item_with_max_length, test_StringSchemaItemTest) {
ASSERT_EQ(std::string("New very very loooooong string"), obj.asString());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_EQ(std::string("Default string"), obj.asString());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
}
TEST(test_map_validate, test_StringSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
ISchemaItemPtr item = CStringSchemaItem::create(
@@ -193,19 +193,19 @@ TEST(test_map_validate, test_StringSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj["str"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj["long"], &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
resultType = item->validate(obj["bool"], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj["num"], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
bool resDefault = item->setDefaultValue(obj["str"]);
EXPECT_TRUE(resDefault);
@@ -220,27 +220,27 @@ TEST(test_map_validate, test_StringSchemaItemTest) {
EXPECT_EQ(std::string("Default string"), obj["num"].asString());
resultType = item->validate(obj["str"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj["long"], &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
resultType = item->validate(obj["bool"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj["num"], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_EQ(std::string("Default string"), obj.asString());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
}
TEST(test_array_validate, test_StringSchemaItemTest) {
- using namespace NsSmartDeviceLink::NsSmartObjects;
+ using namespace ns_smart_device_link::ns_smart_objects;
SmartObject obj;
ISchemaItemPtr item = CStringSchemaItem::create(
@@ -256,22 +256,22 @@ TEST(test_array_validate, test_StringSchemaItemTest) {
rpc::ValidationReport report("RPC");
int resultType = item->validate(obj[0], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj[1], &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
resultType = item->validate(obj[2], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[3], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[4], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
bool resDefault = item->setDefaultValue(obj[0]);
EXPECT_TRUE(resDefault);
@@ -290,24 +290,24 @@ TEST(test_array_validate, test_StringSchemaItemTest) {
EXPECT_EQ(std::string("Default string"), obj[5].asString());
resultType = item->validate(obj[0], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj[1], &report);
- EXPECT_EQ(Errors::OUT_OF_RANGE, resultType);
+ EXPECT_EQ(errors::OUT_OF_RANGE, resultType);
resultType = item->validate(obj[2], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj[3], &report);
- EXPECT_EQ(Errors::INVALID_VALUE, resultType);
+ EXPECT_EQ(errors::INVALID_VALUE, resultType);
resultType = item->validate(obj[4], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resultType = item->validate(obj[5], &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
resDefault = item->setDefaultValue(obj);
EXPECT_TRUE(resDefault);
EXPECT_EQ(std::string("Default string"), obj.asString());
resultType = item->validate(obj, &report);
- EXPECT_EQ(Errors::OK, resultType);
+ EXPECT_EQ(errors::OK, resultType);
}
} // namespace smart_object_test
diff --git a/src/components/smart_objects/test/map_performance_test.cc b/src/components/smart_objects/test/map_performance_test.cc
index b0544a94d4..be29a93553 100644
--- a/src/components/smart_objects/test/map_performance_test.cc
+++ b/src/components/smart_objects/test/map_performance_test.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <map>
#include <string>
#include <vector>
-#include <map>
#include "gmock/gmock.h"
@@ -59,7 +59,7 @@ void MakeMapObject(Map& obj, const int size) {
obj[i_key] = array;
}
}
-}
+} // namespace
TEST(SmartObjectPerformanceTest, SmartObjectMapPerformance) {
Map object;
diff --git a/src/components/smart_objects/test/smart_object_performance_test.cc b/src/components/smart_objects/test/smart_object_performance_test.cc
index 503652dcda..ebf39e6b5c 100644
--- a/src/components/smart_objects/test/smart_object_performance_test.cc
+++ b/src/components/smart_objects/test/smart_object_performance_test.cc
@@ -30,14 +30,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include <set>
+#include <string>
#include "gmock/gmock.h"
#include "smart_objects/smart_object.h"
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
namespace test {
namespace components {
@@ -58,7 +58,7 @@ void MakeMapObject(SmartObject& obj, const int size) {
obj[i_key] = array;
}
}
-}
+} // namespace
TEST(SmartObjectPerformanceTest, SmartObjectPerformance) {
SmartObject object;
diff --git a/src/components/telemetry_monitor/CMakeLists.txt b/src/components/telemetry_monitor/CMakeLists.txt
index bb33857ecd..3e8b2a9741 100644
--- a/src/components/telemetry_monitor/CMakeLists.txt
+++ b/src/components/telemetry_monitor/CMakeLists.txt
@@ -47,9 +47,11 @@ include_directories (
${COMPONENTS_DIR}/media_manager/include/
${COMPONENTS_DIR}/smart_objects/include/
${COMPONENTS_DIR}/config_profile/include/
+ ${COMPONENTS_DIR}/resumption/include
${JSONCPP_INCLUDE_DIRECTORY}
${CMAKE_BINARY_DIR}/src/components/
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
set(PATHS
@@ -62,7 +64,7 @@ set(LIBRARIES
HMI_API
MOBILE_API
Utils
- Policy
+ PolicyStatic
)
add_library("TelemetryMonitor" ${SOURCES})
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h
index 3c3de20e0e..7ee5729c9b 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h
@@ -35,8 +35,8 @@
#include <string>
-#include "telemetry_monitor/metric_wrapper.h"
#include "telemetry_monitor/application_manager_observer.h"
+#include "telemetry_monitor/metric_wrapper.h"
namespace telemetry_monitor {
@@ -44,9 +44,9 @@ class ApplicationManagerObserver;
class ApplicationManagerMetricWrapper : public MetricWrapper {
public:
- utils::SharedPtr<application_manager::AMTelemetryObserver::MessageMetric>
+ std::shared_ptr<application_manager::AMTelemetryObserver::MessageMetric>
message_metric;
virtual Json::Value GetJsonMetric();
};
-}
+} // namespace telemetry_monitor
#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_APPLICATION_MANAGER_METRIC_WRAPPER_H_
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h
index ecb9c8002a..826bc66c7f 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_APPLICATION_MANAGER_OBSERVER_H_
#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_APPLICATION_MANAGER_OBSERVER_H_
-#include "utils/message_queue.h"
#include "application_manager/telemetry_observer.h"
#include "telemetry_monitor/application_manager_metric_wrapper.h"
+#include "utils/message_queue.h"
namespace telemetry_monitor {
@@ -45,10 +45,10 @@ class ApplicationManagerObserver
: public application_manager::AMTelemetryObserver {
public:
explicit ApplicationManagerObserver(TelemetryMonitor* telemetry_monitor);
- virtual void OnMessage(utils::SharedPtr<MessageMetric> metric);
+ virtual void OnMessage(std::shared_ptr<MessageMetric> metric);
private:
TelemetryMonitor* telemetry_monitor_;
};
-}
+} // namespace telemetry_monitor
#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_APPLICATION_MANAGER_OBSERVER_H_
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/json_keys.h b/src/components/telemetry_monitor/include/telemetry_monitor/json_keys.h
index 899c76b2e8..94911bcaef 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/json_keys.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/json_keys.h
@@ -47,6 +47,6 @@ const char connection_key[] = "connection_key";
const char stime[] = "stime";
const char utime[] = "utime";
const char memory[] = "RAM";
-}
-}
+} // namespace strings
+} // namespace telemetry_monitor
#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_JSON_KEYS_H_
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/metric_wrapper.h b/src/components/telemetry_monitor/include/telemetry_monitor/metric_wrapper.h
index 431e255c7b..f69efada82 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/metric_wrapper.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/metric_wrapper.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_METRIC_WRAPPER_H_
#include <string>
-#include "utils/resource_usage.h"
#include "json/json.h"
+#include "utils/resource_usage.h"
namespace telemetry_monitor {
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h
index daf602e9ca..a3af8e7048 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h
@@ -34,15 +34,15 @@
#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_PROTOCOL_HANDLER_METRIC_WRAPPER_H_
#include <string>
-#include "utils/shared_ptr.h"
-#include "telemetry_monitor/metric_wrapper.h"
+
#include "protocol_handler_observer.h"
+#include "telemetry_monitor/metric_wrapper.h"
namespace telemetry_monitor {
class ProtocolHandlerMecticWrapper : public MetricWrapper {
public:
- utils::SharedPtr<protocol_handler::PHTelemetryObserver::MessageMetric>
+ std::shared_ptr<protocol_handler::PHTelemetryObserver::MessageMetric>
message_metric;
virtual Json::Value GetJsonMetric();
};
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h
index 69e5658382..27a4fda868 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h
@@ -45,13 +45,13 @@ class ProtocolHandlerObserver : public protocol_handler::PHTelemetryObserver {
explicit ProtocolHandlerObserver(TelemetryMonitor* telemetry_monitor);
virtual void StartMessageProcess(uint32_t message_id,
- const TimevalStruct& start_time);
+ const date_time::TimeDuration& start_time);
- virtual void EndMessageProcess(utils::SharedPtr<MessageMetric> m);
+ virtual void EndMessageProcess(std::shared_ptr<MessageMetric> m);
private:
TelemetryMonitor* telemetry_monitor_;
- std::map<uint32_t, TimevalStruct> time_starts;
+ std::map<uint32_t, date_time::TimeDuration> time_starts;
};
} // namespace telemetry_monitor
#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_PROTOCOL_HANDLER_OBSERVER_H_
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
index 618901ffa8..b7d8f6da2b 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
@@ -35,21 +35,16 @@
#include <string>
-#include "utils/message_queue.h"
-#include "utils/threads/thread.h"
-#include "utils/threads/thread_delegate.h"
-#include "telemetry_monitor/metric_wrapper.h"
+#include "application_manager/application_manager.h"
+#include "protocol_handler/protocol_handler_impl.h"
+#include "protocol_handler_observer.h"
#include "telemetry_monitor/application_manager_observer.h"
-#include "application_manager/application_manager_impl.h"
+#include "telemetry_monitor/metric_wrapper.h"
#include "telemetry_monitor/transport_manager_observer.h"
#include "transport_manager/transport_manager_impl.h"
-#include "protocol_handler_observer.h"
-#include "protocol_handler/protocol_handler_impl.h"
-
-namespace utils {
-template <typename T>
-class SharedPtr;
-}
+#include "utils/message_queue.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/thread_delegate.h"
namespace telemetry_monitor {
@@ -62,7 +57,7 @@ class Streamer : public threads::ThreadDelegate {
void threadMain() OVERRIDE;
void exitThreadMain() OVERRIDE;
- virtual void PushMessage(utils::SharedPtr<MetricWrapper> metric);
+ virtual void PushMessage(std::shared_ptr<MetricWrapper> metric);
volatile bool is_client_connected_;
private:
@@ -75,7 +70,7 @@ class Streamer : public threads::ThreadDelegate {
int32_t server_socket_fd_;
int32_t client_socket_fd_;
volatile bool stop_flag_;
- MessageQueue<utils::SharedPtr<MetricWrapper> > messages_;
+ MessageQueue<std::shared_ptr<MetricWrapper> > messages_;
DISALLOW_COPY_AND_ASSIGN(Streamer);
};
@@ -83,17 +78,17 @@ class TelemetryMonitor {
public:
TelemetryMonitor(const std::string& server_address, uint16_t port);
virtual ~TelemetryMonitor();
- virtual void Init(TelemetryObservable<protocol_handler::PHTelemetryObserver>*
- protocol_handler,
- TelemetryObservable<
- application_manager::AMTelemetryObserver>* app_manager,
- TelemetryObservable<transport_manager::TMTelemetryObserver>*
- transport_manager);
+ virtual void Init(
+ TelemetryObservable<protocol_handler::PHTelemetryObserver>*
+ protocol_handler,
+ TelemetryObservable<application_manager::AMTelemetryObserver>*
+ app_manager,
+ TelemetryObservable<transport_manager::TMTelemetryObserver>*
+ transport_manager);
virtual void Stop();
virtual void Start();
- virtual void SendMetric(utils::SharedPtr<MetricWrapper> metric);
- DEPRECATED void set_streamer(Streamer* streamer);
- void set_streamer(utils::SharedPtr<Streamer> streamer);
+ virtual void SendMetric(std::shared_ptr<MetricWrapper> metric);
+ void set_streamer(std::shared_ptr<Streamer> streamer);
const std::string& ip() const;
int16_t port() const;
@@ -101,7 +96,7 @@ class TelemetryMonitor {
std::string server_address_;
int16_t port_;
threads::Thread* thread_;
- utils::SharedPtr<Streamer> streamer_;
+ std::shared_ptr<Streamer> streamer_;
ApplicationManagerObserver app_observer;
TransportManagerObserver tm_observer;
ProtocolHandlerObserver ph_observer;
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h b/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h
index b601e89b18..d1239c9d1b 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h
@@ -41,7 +41,7 @@ namespace telemetry_monitor {
class TransportManagerMecticWrapper : public MetricWrapper {
public:
- utils::SharedPtr<transport_manager::TMTelemetryObserver::MessageMetric>
+ std::shared_ptr<transport_manager::TMTelemetryObserver::MessageMetric>
message_metric;
virtual Json::Value GetJsonMetric();
};
diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_observer.h b/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_observer.h
index bff5834586..f79e27d2a0 100644
--- a/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_observer.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_observer.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_TRANSPORT_MANAGER_OBSERVER_H_
#include "transport_manager/telemetry_observer.h"
-#include "utils/message_queue.h"
#include "utils/date_time.h"
+#include "utils/message_queue.h"
namespace telemetry_monitor {
@@ -49,7 +49,8 @@ class TransportManagerObserver : public transport_manager::TMTelemetryObserver {
private:
TelemetryMonitor* telemetry_monitor_;
- std::map<const protocol_handler::RawMessage*, TimevalStruct> time_starts;
+ std::map<const protocol_handler::RawMessage*, date_time::TimeDuration>
+ time_starts;
};
} // namespace telemetry_monitor
#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_TRANSPORT_MANAGER_OBSERVER_H_
diff --git a/src/components/telemetry_monitor/src/application_manager_metric_wrapper.cc b/src/components/telemetry_monitor/src/application_manager_metric_wrapper.cc
index b693d9df22..9bf4ec494b 100644
--- a/src/components/telemetry_monitor/src/application_manager_metric_wrapper.cc
+++ b/src/components/telemetry_monitor/src/application_manager_metric_wrapper.cc
@@ -31,8 +31,8 @@
*/
#include "telemetry_monitor/application_manager_metric_wrapper.h"
-#include "telemetry_monitor/json_keys.h"
#include "application_manager/smart_object_keys.h"
+#include "telemetry_monitor/json_keys.h"
#include "utils/convert_utils.h"
namespace telemetry_monitor {
@@ -41,15 +41,14 @@ Json::Value ApplicationManagerMetricWrapper::GetJsonMetric() {
Json::Value result = MetricWrapper::GetJsonMetric();
result[strings::logger] = "ApplicationManager";
result[strings::begin] =
- Json::Int64(date_time::DateTime::getuSecs(message_metric->begin));
- result[strings::end] =
- Json::Int64(date_time::DateTime::getuSecs(message_metric->end));
- const NsSmartDeviceLink::NsSmartObjects::SmartObject& params =
+ Json::Int64(date_time::getuSecs(message_metric->begin));
+ result[strings::end] = Json::Int64(date_time::getuSecs(message_metric->end));
+ const ns_smart_device_link::ns_smart_objects::SmartObject& params =
message_metric->message->getElement(application_manager::strings::params);
- result[strings::correlation_id] = utils::ConvertInt64ToLongLongInt(
- params[application_manager::strings::correlation_id].asInt());
- result[strings::connection_key] = utils::ConvertInt64ToLongLongInt(
- params[application_manager::strings::connection_key].asInt());
+ result[strings::correlation_id] =
+ params[application_manager::strings::correlation_id].asInt();
+ result[strings::connection_key] =
+ params[application_manager::strings::connection_key].asInt();
return result;
}
} // namespace telemetry_monitor
diff --git a/src/components/telemetry_monitor/src/application_manager_observer.cc b/src/components/telemetry_monitor/src/application_manager_observer.cc
index cb390eddeb..1a18d87ad8 100644
--- a/src/components/telemetry_monitor/src/application_manager_observer.cc
+++ b/src/components/telemetry_monitor/src/application_manager_observer.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "telemetry_monitor/application_manager_observer.h"
-#include "utils/shared_ptr.h"
-#include "telemetry_monitor/telemetry_monitor.h"
+
#include "telemetry_monitor/application_manager_metric_wrapper.h"
+#include "telemetry_monitor/telemetry_monitor.h"
namespace telemetry_monitor {
@@ -41,8 +41,8 @@ ApplicationManagerObserver::ApplicationManagerObserver(
: telemetry_monitor_(telemetry_monitor) {}
void ApplicationManagerObserver::OnMessage(
- utils::SharedPtr<MessageMetric> metric) {
- ApplicationManagerMetricWrapper* m = new ApplicationManagerMetricWrapper();
+ std::shared_ptr<MessageMetric> metric) {
+ auto m = std::make_shared<ApplicationManagerMetricWrapper>();
m->message_metric = metric;
m->grabResources();
telemetry_monitor_->SendMetric(m);
diff --git a/src/components/telemetry_monitor/src/metric_wrapper.cc b/src/components/telemetry_monitor/src/metric_wrapper.cc
index 937a705ef7..fdcd8f6a9c 100644
--- a/src/components/telemetry_monitor/src/metric_wrapper.cc
+++ b/src/components/telemetry_monitor/src/metric_wrapper.cc
@@ -45,7 +45,6 @@ bool MetricWrapper::grabResources() {
} else {
return false;
}
- flush(std::cout);
}
std::string MetricWrapper::GetStyledString() {
@@ -55,9 +54,9 @@ std::string MetricWrapper::GetStyledString() {
Json::Value MetricWrapper::GetJsonMetric() {
Json::Value result;
if (resources) {
- result[strings::stime] = resources->stime;
- result[strings::utime] = resources->utime;
- result[strings::memory] = resources->memory;
+ result[strings::stime] = static_cast<Json::Int64>(resources->stime);
+ result[strings::utime] = static_cast<Json::Int64>(resources->utime);
+ result[strings::memory] = static_cast<Json::Int64>(resources->memory);
}
return result;
}
@@ -72,4 +71,4 @@ void MetricWrapper::Clear() {
MetricWrapper::~MetricWrapper() {
Clear();
}
-}
+} // namespace telemetry_monitor
diff --git a/src/components/telemetry_monitor/src/protocol_handler_metric_wrapper.cc b/src/components/telemetry_monitor/src/protocol_handler_metric_wrapper.cc
index 335f0dbb29..1591e00af8 100644
--- a/src/components/telemetry_monitor/src/protocol_handler_metric_wrapper.cc
+++ b/src/components/telemetry_monitor/src/protocol_handler_metric_wrapper.cc
@@ -40,9 +40,8 @@ Json::Value ProtocolHandlerMecticWrapper::GetJsonMetric() {
Json::Value result = MetricWrapper::GetJsonMetric();
result[strings::logger] = "ProtocolHandler";
result[strings::begin] =
- Json::Int64(date_time::DateTime::getuSecs(message_metric->begin));
- result[strings::end] =
- Json::Int64(date_time::DateTime::getuSecs(message_metric->end));
+ Json::Int64(date_time::getuSecs(message_metric->begin));
+ result[strings::end] = Json::Int64(date_time::getuSecs(message_metric->end));
result[strings::message_id] = message_metric->message_id;
result[strings::connection_key] = message_metric->connection_key;
return result;
diff --git a/src/components/telemetry_monitor/src/protocol_handler_observer.cc b/src/components/telemetry_monitor/src/protocol_handler_observer.cc
index 2244cb2259..e696e58506 100644
--- a/src/components/telemetry_monitor/src/protocol_handler_observer.cc
+++ b/src/components/telemetry_monitor/src/protocol_handler_observer.cc
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "utils/date_time.h"
#include "telemetry_monitor/protocol_handler_observer.h"
#include "telemetry_monitor/protocol_handler_metric_wrapper.h"
#include "telemetry_monitor/telemetry_monitor.h"
+#include "utils/date_time.h"
namespace telemetry_monitor {
@@ -44,7 +44,7 @@ ProtocolHandlerObserver::ProtocolHandlerObserver(
: telemetry_monitor_(telemetry_monitor) {}
void ProtocolHandlerObserver::StartMessageProcess(
- uint32_t message_id, const TimevalStruct& start_time) {
+ uint32_t message_id, const date_time::TimeDuration& start_time) {
if (message_id == 0) {
return;
}
@@ -58,17 +58,17 @@ void ProtocolHandlerObserver::StartMessageProcess(
}
void ProtocolHandlerObserver::EndMessageProcess(
- utils::SharedPtr<MessageMetric> m) {
+ std::shared_ptr<MessageMetric> m) {
uint32_t message_id = m->message_id;
- std::map<uint32_t, TimevalStruct>::const_iterator it =
+ std::map<uint32_t, date_time::TimeDuration>::const_iterator it =
time_starts.find(message_id);
if (it == time_starts.end()) {
LOG4CXX_WARN(logger_, "Cant find start time for message" << message_id);
return;
}
m->begin = time_starts[message_id];
- m->end = date_time::DateTime::getCurrentTime();
- ProtocolHandlerMecticWrapper* metric = new ProtocolHandlerMecticWrapper();
+ m->end = date_time::getCurrentTime();
+ auto metric = std::make_shared<ProtocolHandlerMecticWrapper>();
metric->message_metric = m;
metric->grabResources();
telemetry_monitor_->SendMetric(metric);
diff --git a/src/components/telemetry_monitor/src/telemetry_monitor.cc b/src/components/telemetry_monitor/src/telemetry_monitor.cc
index 53a5a2dc70..e2f45b7576 100644
--- a/src/components/telemetry_monitor/src/telemetry_monitor.cc
+++ b/src/components/telemetry_monitor/src/telemetry_monitor.cc
@@ -1,49 +1,48 @@
/*
-* Copyright (c) 2014, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
#include "telemetry_monitor/telemetry_monitor.h"
-#include <sys/socket.h>
-#include <sys/types.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
#include <sys/select.h>
+#include <sys/socket.h>
#include <sys/time.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
+#include <sys/types.h>
#include <unistd.h>
#include "transport_manager/transport_manager_default.h"
#include "utils/resource_usage.h"
-#include "utils/make_shared.h"
-#include "utils/shared_ptr.h"
+
#include "telemetry_monitor/telemetry_observable.h"
namespace telemetry_monitor {
@@ -60,13 +59,11 @@ TelemetryMonitor::TelemetryMonitor(const std::string& server_address,
, ph_observer(this) {}
void TelemetryMonitor::Start() {
- streamer_ = streamer_ ? streamer_ : utils::MakeShared<Streamer>(this);
+ streamer_ = streamer_ ? streamer_ : std::make_shared<Streamer>(this);
thread_ = threads::CreateThread("TelemetryMonitor", streamer_.get());
}
-void TelemetryMonitor::set_streamer(Streamer* streamer) {}
-
-void TelemetryMonitor::set_streamer(utils::SharedPtr<Streamer> streamer) {
+void TelemetryMonitor::set_streamer(std::shared_ptr<Streamer> streamer) {
LOG4CXX_AUTO_TRACE(logger_);
if (thread_ && !thread_->is_running()) {
streamer_ = streamer;
@@ -115,7 +112,7 @@ void TelemetryMonitor::Stop() {
thread_ = NULL;
}
-void TelemetryMonitor::SendMetric(utils::SharedPtr<MetricWrapper> metric) {
+void TelemetryMonitor::SendMetric(std::shared_ptr<MetricWrapper> metric) {
if (streamer_ && streamer_->is_client_connected_) {
streamer_->PushMessage(metric);
}
@@ -149,7 +146,7 @@ void Streamer::threadMain() {
is_client_connected_ = true;
while (is_client_connected_) {
while (!messages_.empty()) {
- utils::SharedPtr<MetricWrapper> metric;
+ std::shared_ptr<MetricWrapper> metric;
if (!messages_.pop(metric)) {
continue;
}
@@ -251,8 +248,9 @@ bool Streamer::IsReady() const {
fd_set fds;
FD_ZERO(&fds);
FD_SET(client_socket_fd_, &fds);
- TimevalStruct tv = {0, 0};
- tv.tv_sec = 5; // set a 5 second timeout
+ // need to construct a timeval for the duration, can't use duration
+ struct timeval tv;
+ tv.tv_sec = 5;
tv.tv_usec = 0;
const int retval = select(client_socket_fd_ + 1, 0, &fds, 0, &tv);
@@ -282,7 +280,7 @@ bool Streamer::Send(const std::string& msg) {
return true;
}
-void Streamer::PushMessage(utils::SharedPtr<MetricWrapper> metric) {
+void Streamer::PushMessage(std::shared_ptr<MetricWrapper> metric) {
messages_.push(metric);
}
} // namespace telemetry_monitor
diff --git a/src/components/telemetry_monitor/src/transport_manager_metric_wrapper.cc b/src/components/telemetry_monitor/src/transport_manager_metric_wrapper.cc
index a891aa1118..3a89c9245a 100644
--- a/src/components/telemetry_monitor/src/transport_manager_metric_wrapper.cc
+++ b/src/components/telemetry_monitor/src/transport_manager_metric_wrapper.cc
@@ -31,9 +31,9 @@
*/
#include "telemetry_monitor/transport_manager_metric_wrapper.h"
+#include "application_manager/smart_object_keys.h"
#include "json/json.h"
#include "telemetry_monitor/json_keys.h"
-#include "application_manager/smart_object_keys.h"
namespace telemetry_monitor {
@@ -41,9 +41,8 @@ Json::Value TransportManagerMecticWrapper::GetJsonMetric() {
Json::Value result = MetricWrapper::GetJsonMetric();
result[strings::logger] = "TransportManager";
result[strings::begin] =
- Json::Int64(date_time::DateTime::getuSecs(message_metric->begin));
- result[strings::end] =
- Json::Int64(date_time::DateTime::getuSecs(message_metric->end));
+ Json::Int64(date_time::getuSecs(message_metric->begin));
+ result[strings::end] = Json::Int64(date_time::getuSecs(message_metric->end));
result[strings::data_size] = static_cast<uint32_t>(message_metric->data_size);
return result;
}
diff --git a/src/components/telemetry_monitor/src/transport_manager_observer.cc b/src/components/telemetry_monitor/src/transport_manager_observer.cc
index b3e57ac22a..15338eddff 100644
--- a/src/components/telemetry_monitor/src/transport_manager_observer.cc
+++ b/src/components/telemetry_monitor/src/transport_manager_observer.cc
@@ -33,8 +33,8 @@
#include <time.h>
-#include "telemetry_monitor/transport_manager_metric_wrapper.h"
#include "telemetry_monitor/telemetry_monitor.h"
+#include "telemetry_monitor/transport_manager_metric_wrapper.h"
namespace telemetry_monitor {
@@ -44,20 +44,20 @@ TransportManagerObserver::TransportManagerObserver(
void TransportManagerObserver::StartRawMsg(
const protocol_handler::RawMessage* ptr) {
- time_starts[ptr] = date_time::DateTime::getCurrentTime();
+ time_starts[ptr] = date_time::getCurrentTime();
}
void TransportManagerObserver::StopRawMsg(
const protocol_handler::RawMessage* ptr) {
- std::map<const protocol_handler::RawMessage*, TimevalStruct>::const_iterator
- it;
+ std::map<const protocol_handler::RawMessage*,
+ date_time::TimeDuration>::const_iterator it;
it = time_starts.find(ptr);
if (it != time_starts.end()) {
- TransportManagerMecticWrapper* m = new TransportManagerMecticWrapper();
- m->message_metric =
- new transport_manager::TMTelemetryObserver::MessageMetric();
+ auto m = std::make_shared<TransportManagerMecticWrapper>();
+ m->message_metric = std::make_shared<
+ transport_manager::TMTelemetryObserver::MessageMetric>();
m->message_metric->begin = it->second;
- m->message_metric->end = date_time::DateTime::getCurrentTime();
+ m->message_metric->end = date_time::getCurrentTime();
m->message_metric->data_size = ptr->data_size();
m->grabResources();
telemetry_monitor_->SendMetric(m);
diff --git a/src/components/telemetry_monitor/test/application_manager_metric_test.cc b/src/components/telemetry_monitor/test/application_manager_metric_test.cc
index 9029c41bc4..4af5ba82b5 100644
--- a/src/components/telemetry_monitor/test/application_manager_metric_test.cc
+++ b/src/components/telemetry_monitor/test/application_manager_metric_test.cc
@@ -30,11 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "application_manager/smart_object_keys.h"
#include "gtest/gtest.h"
+#include "telemetry_monitor/application_manager_metric_wrapper.h"
#include "telemetry_monitor/json_keys.h"
#include "utils/resource_usage.h"
-#include "application_manager/smart_object_keys.h"
-#include "telemetry_monitor/application_manager_metric_wrapper.h"
namespace test {
namespace components {
@@ -50,22 +50,20 @@ TEST(ApplicationManagerMetricWrapper, grabResources) {
TEST(ApplicationManagerMetricWrapper, GetJsonMetric) {
ApplicationManagerMetricWrapper metric_test;
- TimevalStruct start_time;
- start_time.tv_sec = 1;
- start_time.tv_usec = 0;
+ date_time::TimeDuration start_time = date_time::seconds(1);
+
+ date_time::TimeDuration end_time = date_time::seconds(10);
- TimevalStruct end_time;
- end_time.tv_sec = 10;
- end_time.tv_usec = 0;
- metric_test.message_metric =
- new application_manager::AMTelemetryObserver::MessageMetric();
+ metric_test.message_metric = std::make_shared<
+ application_manager::AMTelemetryObserver::MessageMetric>();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
- NsSmartDeviceLink::NsSmartObjects::SmartObject obj;
+ ns_smart_device_link::ns_smart_objects::SmartObject obj;
obj["params"][application_manager::strings::correlation_id] = 11;
obj["params"][application_manager::strings::connection_key] = 12;
metric_test.message_metric->message =
- new NsSmartDeviceLink::NsSmartObjects::SmartObject(obj);
+ std::make_shared<ns_smart_device_link::ns_smart_objects::SmartObject>(
+ obj);
Json::Value jvalue = metric_test.GetJsonMetric();
EXPECT_EQ("null\n",
@@ -75,9 +73,9 @@ TEST(ApplicationManagerMetricWrapper, GetJsonMetric) {
EXPECT_EQ("null\n",
jvalue[telemetry_monitor::strings::memory].toStyledString());
- EXPECT_EQ(date_time::DateTime::getuSecs(start_time),
+ EXPECT_EQ(date_time::getuSecs(start_time),
jvalue[telemetry_monitor::strings::begin].asInt64());
- EXPECT_EQ(date_time::DateTime::getuSecs(end_time),
+ EXPECT_EQ(date_time::getuSecs(end_time),
jvalue[telemetry_monitor::strings::end].asInt64());
EXPECT_EQ(obj["params"][application_manager::strings::correlation_id].asInt(),
jvalue[telemetry_monitor::strings::correlation_id].asInt64());
@@ -90,37 +88,34 @@ TEST(ApplicationManagerMetricWrapper, GetJsonMetricWithGrabResources) {
utils::ResourseUsage* resources = utils::Resources::getCurrentResourseUsage();
EXPECT_TRUE(metric_test.grabResources());
- TimevalStruct start_time;
- start_time.tv_sec = 1;
- start_time.tv_usec = 0;
+ date_time::TimeDuration start_time = date_time::seconds(1);
- TimevalStruct end_time;
- end_time.tv_sec = 10;
- end_time.tv_usec = 0;
+ date_time::TimeDuration end_time = date_time::seconds(10);
- metric_test.message_metric =
- new application_manager::AMTelemetryObserver::MessageMetric();
+ metric_test.message_metric = std::make_shared<
+ application_manager::AMTelemetryObserver::MessageMetric>();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
- NsSmartDeviceLink::NsSmartObjects::SmartObject obj;
+ ns_smart_device_link::ns_smart_objects::SmartObject obj;
obj["params"][application_manager::strings::correlation_id] = 11;
obj["params"][application_manager::strings::connection_key] = 12;
metric_test.message_metric->message =
- new NsSmartDeviceLink::NsSmartObjects::SmartObject(obj);
+ std::make_shared<ns_smart_device_link::ns_smart_objects::SmartObject>(
+ obj);
Json::Value jvalue = metric_test.GetJsonMetric();
- EXPECT_EQ(date_time::DateTime::getuSecs(start_time),
+ EXPECT_EQ(date_time::getuSecs(start_time),
jvalue[telemetry_monitor::strings::begin].asInt64());
- EXPECT_EQ(date_time::DateTime::getuSecs(end_time),
+ EXPECT_EQ(date_time::getuSecs(end_time),
jvalue[telemetry_monitor::strings::end].asInt64());
EXPECT_EQ(obj["params"][application_manager::strings::correlation_id].asInt(),
jvalue[telemetry_monitor::strings::correlation_id].asInt64());
EXPECT_EQ(obj["params"][application_manager::strings::connection_key].asInt(),
jvalue[telemetry_monitor::strings::connection_key].asInt());
- EXPECT_EQ(date_time::DateTime::getuSecs(start_time),
+ EXPECT_EQ(date_time::getuSecs(start_time),
jvalue[telemetry_monitor::strings::begin].asInt64());
- EXPECT_EQ(date_time::DateTime::getuSecs(end_time),
+ EXPECT_EQ(date_time::getuSecs(end_time),
jvalue[telemetry_monitor::strings::end].asInt64());
EXPECT_NEAR(
diff --git a/src/components/telemetry_monitor/test/application_manager_observer_test.cc b/src/components/telemetry_monitor/test/application_manager_observer_test.cc
index 5b7a551247..daf3890485 100644
--- a/src/components/telemetry_monitor/test/application_manager_observer_test.cc
+++ b/src/components/telemetry_monitor/test/application_manager_observer_test.cc
@@ -30,12 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "telemetry_monitor/mock_telemetry_monitor.h"
+#include "telemetry_monitor/application_manager_observer.h"
#include "application_manager/telemetry_observer.h"
+#include "gtest/gtest.h"
#include "telemetry_monitor/application_manager_metric_wrapper.h"
-#include "telemetry_monitor/application_manager_observer.h"
-#include "utils/shared_ptr.h"
+#include "telemetry_monitor/mock_telemetry_monitor.h"
+
#include "telemetry_monitor/telemetry_monitor.h"
namespace test {
@@ -49,7 +49,7 @@ TEST(ApplicationManagerObserver, CallOnMessage) {
MockTelemetryMonitor mock_telemetry_monitor;
ApplicationManagerObserver app_observer(&mock_telemetry_monitor);
typedef application_manager::AMTelemetryObserver::MessageMetric AMMetric;
- utils::SharedPtr<AMMetric> ptr =
+ std::shared_ptr<AMMetric> ptr =
application_manager::AMTelemetryObserver::MessageMetricSharedPtr();
EXPECT_CALL(mock_telemetry_monitor, SendMetric(_));
app_observer.OnMessage(ptr);
diff --git a/src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h b/src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h
index fdda58bd08..9b41d5a9ac 100644
--- a/src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h
+++ b/src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h
@@ -35,9 +35,8 @@
#include <string>
#include "gmock/gmock.h"
-#include "telemetry_monitor/telemetry_monitor.h"
#include "telemetry_monitor/metric_wrapper.h"
-#include "utils/shared_ptr.h"
+#include "telemetry_monitor/telemetry_monitor.h"
namespace test {
namespace components {
@@ -50,9 +49,9 @@ class MockTelemetryMonitor : public telemetry_monitor::TelemetryMonitor {
MOCK_METHOD0(Stop, void());
MOCK_METHOD0(Start, void());
MOCK_METHOD1(SendMetric,
- void(utils::SharedPtr<telemetry_monitor::MetricWrapper> metric));
+ void(std::shared_ptr<telemetry_monitor::MetricWrapper> metric));
};
-} // namespace transport_manager_test
+} // namespace telemetry_monitor_test
} // namespace components
} // namespace test
#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_TEST_INCLUDE_TELEMETRY_MONITOR_MOCK_TELEMETRY_MONITOR_H_
diff --git a/src/components/telemetry_monitor/test/metric_wrapper_test.cc b/src/components/telemetry_monitor/test/metric_wrapper_test.cc
index f1e3c77db4..5501877ec8 100644
--- a/src/components/telemetry_monitor/test/metric_wrapper_test.cc
+++ b/src/components/telemetry_monitor/test/metric_wrapper_test.cc
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "telemetry_monitor/metric_wrapper.h"
-#include "telemetry_monitor/json_keys.h"
+#include "gtest/gtest.h"
#include "json/json.h"
+#include "telemetry_monitor/json_keys.h"
#include "utils/resource_usage.h"
namespace test {
diff --git a/src/components/telemetry_monitor/test/protocol_handler_metric_test.cc b/src/components/telemetry_monitor/test/protocol_handler_metric_test.cc
index 8253cf2553..8662321be3 100644
--- a/src/components/telemetry_monitor/test/protocol_handler_metric_test.cc
+++ b/src/components/telemetry_monitor/test/protocol_handler_metric_test.cc
@@ -31,11 +31,11 @@
*/
#include "gtest/gtest.h"
-#include "telemetry_monitor/json_keys.h"
#include "json/json.h"
-#include "utils/resource_usage.h"
-#include "telemetry_monitor/protocol_handler_metric_wrapper.h"
#include "protocol_handler/telemetry_observer.h"
+#include "telemetry_monitor/json_keys.h"
+#include "telemetry_monitor/protocol_handler_metric_wrapper.h"
+#include "utils/resource_usage.h"
namespace test {
namespace components {
@@ -51,15 +51,12 @@ TEST(ProtocolHandlerMetricTest, grabResources) {
TEST(ProtocolHandlerMetricTest, GetJsonMetric) {
ProtocolHandlerMecticWrapper metric_test;
- TimevalStruct start_time;
- start_time.tv_sec = 1;
- start_time.tv_usec = 0;
+ date_time::TimeDuration start_time = date_time::seconds(1);
+
+ date_time::TimeDuration end_time = date_time::seconds(10);
- TimevalStruct end_time;
- end_time.tv_sec = 10;
- end_time.tv_usec = 0;
metric_test.message_metric =
- new protocol_handler::PHTelemetryObserver::MessageMetric();
+ std::make_shared<protocol_handler::PHTelemetryObserver::MessageMetric>();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
metric_test.message_metric->message_id = 5;
@@ -71,10 +68,8 @@ TEST(ProtocolHandlerMetricTest, GetJsonMetric) {
EXPECT_EQ("null\n", jvalue[strings::utime].toStyledString());
EXPECT_EQ("null\n", jvalue[strings::memory].toStyledString());
- EXPECT_EQ(date_time::DateTime::getuSecs(start_time),
- jvalue[strings::begin].asInt64());
- EXPECT_EQ(date_time::DateTime::getuSecs(end_time),
- jvalue[strings::end].asInt64());
+ EXPECT_EQ(date_time::getuSecs(start_time), jvalue[strings::begin].asInt64());
+ EXPECT_EQ(date_time::getuSecs(end_time), jvalue[strings::end].asInt64());
EXPECT_EQ(5, jvalue[strings::message_id].asInt64());
EXPECT_EQ(2, jvalue[strings::connection_key].asInt());
}
@@ -85,15 +80,12 @@ TEST(ProtocolHandlerMetricTest, GetJsonMetricWithGrabResources) {
EXPECT_TRUE(resources != NULL);
EXPECT_TRUE(metric_test.grabResources());
- TimevalStruct start_time;
- start_time.tv_sec = 1;
- start_time.tv_usec = 0;
+ date_time::TimeDuration start_time = date_time::seconds(1);
+
+ date_time::TimeDuration end_time = date_time::seconds(10);
- TimevalStruct end_time;
- end_time.tv_sec = 10;
- end_time.tv_usec = 0;
metric_test.message_metric =
- new protocol_handler::PHTelemetryObserver::MessageMetric();
+ std::make_shared<protocol_handler::PHTelemetryObserver::MessageMetric>();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
metric_test.message_metric->message_id = 5;
@@ -107,10 +99,8 @@ TEST(ProtocolHandlerMetricTest, GetJsonMetricWithGrabResources) {
EXPECT_NE("null/n", jvalue[strings::utime].toStyledString());
EXPECT_NE("null/n", jvalue[strings::memory].toStyledString());
- EXPECT_EQ(date_time::DateTime::getuSecs(start_time),
- jvalue[strings::begin].asInt64());
- EXPECT_EQ(date_time::DateTime::getuSecs(end_time),
- jvalue[strings::end].asInt64());
+ EXPECT_EQ(date_time::getuSecs(start_time), jvalue[strings::begin].asInt64());
+ EXPECT_EQ(date_time::getuSecs(end_time), jvalue[strings::end].asInt64());
EXPECT_EQ(5, jvalue[strings::message_id].asInt64());
EXPECT_EQ(2, jvalue[strings::connection_key].asInt());
diff --git a/src/components/telemetry_monitor/test/protocol_handler_observer_test.cc b/src/components/telemetry_monitor/test/protocol_handler_observer_test.cc
index 784e809da6..b74434da3c 100644
--- a/src/components/telemetry_monitor/test/protocol_handler_observer_test.cc
+++ b/src/components/telemetry_monitor/test/protocol_handler_observer_test.cc
@@ -31,9 +31,9 @@
*/
#include "gtest/gtest.h"
-#include "telemetry_monitor/telemetry_monitor.h"
-#include "telemetry_monitor/mock_telemetry_monitor.h"
#include "protocol_handler/telemetry_observer.h"
+#include "telemetry_monitor/mock_telemetry_monitor.h"
+#include "telemetry_monitor/telemetry_monitor.h"
namespace test {
namespace components {
@@ -47,13 +47,12 @@ TEST(ProtocolHandlerObserverTest, MessageProcess) {
ProtocolHandlerObserver pr_handler(&mock_telemetry_monitor);
uint32_t message_id = 1;
- TimevalStruct start_time;
- start_time.tv_sec = 1;
- start_time.tv_usec = 0;
+ date_time::TimeDuration start_time = date_time::seconds(1);
+
pr_handler.StartMessageProcess(message_id, start_time);
typedef protocol_handler::PHTelemetryObserver::MessageMetric MetricType;
- utils::SharedPtr<MetricType> message_metric = new MetricType();
+ std::shared_ptr<MetricType> message_metric = std::make_shared<MetricType>();
message_metric->message_id = 1;
EXPECT_CALL(mock_telemetry_monitor, SendMetric(_));
pr_handler.EndMessageProcess(message_metric);
@@ -64,13 +63,12 @@ TEST(ProtocolHandlerObserverTest, MessageProcessWithZeroMessageId) {
ProtocolHandlerObserver pr_handler(&mock_telemetry_monitor);
uint32_t message_id = 0;
- TimevalStruct start_time;
- start_time.tv_sec = 1;
- start_time.tv_usec = 0;
+ date_time::TimeDuration start_time = date_time::seconds(1);
+
pr_handler.StartMessageProcess(message_id, start_time);
typedef protocol_handler::PHTelemetryObserver::MessageMetric MetricType;
- utils::SharedPtr<MetricType> message_metric = new MetricType();
+ std::shared_ptr<MetricType> message_metric = std::make_shared<MetricType>();
message_metric->message_id = 0;
EXPECT_CALL(mock_telemetry_monitor, SendMetric(_)).Times(0);
pr_handler.EndMessageProcess(message_metric);
diff --git a/src/components/telemetry_monitor/test/telemetry_monitor_test.cc b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc
index 5235f0a469..f7b74ac278 100644
--- a/src/components/telemetry_monitor/test/telemetry_monitor_test.cc
+++ b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc
@@ -30,21 +30,19 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "telemetry_monitor/telemetry_monitor.h"
-#include "protocol_handler/telemetry_observer.h"
-#include "protocol_handler/protocol_handler.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "gtest/gtest.h"
#include "protocol_handler//mock_protocol_handler.h"
-#include "protocol_handler/mock_session_observer.h"
#include "protocol_handler/mock_protocol_handler_settings.h"
-#include "connection_handler/mock_connection_handler.h"
-#include "transport_manager/mock_transport_manager.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "protocol_handler/protocol_handler.h"
+#include "protocol_handler/telemetry_observer.h"
#include "telemetry_monitor/mock_telemetry_observable.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
+#include "transport_manager/mock_transport_manager.h"
-using testing::Return;
using testing::_;
+using testing::Return;
namespace test {
namespace components {
@@ -57,7 +55,7 @@ class StreamerMock : public Streamer {
StreamerMock(TelemetryMonitor* const server) : Streamer(server) {
is_client_connected_ = true;
}
- MOCK_METHOD1(PushMessage, void(utils::SharedPtr<MetricWrapper> metric));
+ MOCK_METHOD1(PushMessage, void(std::shared_ptr<MetricWrapper> metric));
};
TEST(TelemetryMonitorTest, MessageProcess) {
@@ -92,14 +90,14 @@ TEST(TelemetryMonitorTest, MessageProcess) {
EXPECT_CALL(am_observeble, SetTelemetryObserver(_));
EXPECT_CALL(transport_manager_mock, SetTelemetryObserver(_));
telemetry_monitor::TelemetryMonitor telemetry_monitor(server_address, port);
- utils::SharedPtr<StreamerMock> streamer_mock =
- utils::MakeShared<StreamerMock>(&telemetry_monitor);
+ std::shared_ptr<StreamerMock> streamer_mock =
+ std::make_shared<StreamerMock>(&telemetry_monitor);
// streamer_mock will be freed by telemetry_monitor on destruction
telemetry_monitor.Start();
telemetry_monitor.set_streamer(streamer_mock);
telemetry_monitor.Init(
&protocol_handler_mock, &am_observeble, &transport_manager_mock);
- utils::SharedPtr<telemetry_monitor::MetricWrapper> test_metric;
+ std::shared_ptr<telemetry_monitor::MetricWrapper> test_metric;
EXPECT_CALL(*streamer_mock, PushMessage(test_metric));
telemetry_monitor.SendMetric(test_metric);
}
diff --git a/src/components/telemetry_monitor/test/transport_manager_metric_test.cc b/src/components/telemetry_monitor/test/transport_manager_metric_test.cc
index 6eb479387a..3b3ac07577 100644
--- a/src/components/telemetry_monitor/test/transport_manager_metric_test.cc
+++ b/src/components/telemetry_monitor/test/transport_manager_metric_test.cc
@@ -31,11 +31,11 @@
*/
#include "gtest/gtest.h"
-#include "telemetry_monitor/json_keys.h"
#include "json/json.h"
-#include "utils/resource_usage.h"
-#include "telemetry_monitor/transport_manager_metric_wrapper.h"
#include "protocol_handler/telemetry_observer.h"
+#include "telemetry_monitor/json_keys.h"
+#include "telemetry_monitor/transport_manager_metric_wrapper.h"
+#include "utils/resource_usage.h"
namespace test {
namespace components {
@@ -51,15 +51,11 @@ TEST(TransportManagerMetricWrapper, grabResources) {
TEST(TransportManagerMetricWrapper, GetJsonMetric) {
TransportManagerMecticWrapper metric_test;
- TimevalStruct start_time;
- start_time.tv_sec = 1;
- start_time.tv_usec = 0;
+ date_time::TimeDuration start_time = date_time::seconds(1);
- TimevalStruct end_time;
- end_time.tv_sec = 10;
- end_time.tv_usec = 0;
+ date_time::TimeDuration end_time = date_time::seconds(10);
metric_test.message_metric =
- new transport_manager::TMTelemetryObserver::MessageMetric();
+ std::make_shared<transport_manager::TMTelemetryObserver::MessageMetric>();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
metric_test.message_metric->data_size = 1000;
@@ -69,10 +65,8 @@ TEST(TransportManagerMetricWrapper, GetJsonMetric) {
EXPECT_EQ("null\n", jvalue[strings::utime].toStyledString());
EXPECT_EQ("null\n", jvalue[strings::memory].toStyledString());
- EXPECT_EQ(date_time::DateTime::getuSecs(start_time),
- jvalue[strings::begin].asInt64());
- EXPECT_EQ(date_time::DateTime::getuSecs(end_time),
- jvalue[strings::end].asInt64());
+ EXPECT_EQ(date_time::getuSecs(start_time), jvalue[strings::begin].asInt64());
+ EXPECT_EQ(date_time::getuSecs(end_time), jvalue[strings::end].asInt64());
EXPECT_EQ(1000, jvalue[strings::data_size].asInt());
}
@@ -82,15 +76,11 @@ TEST(TransportManagerMetricWrapper, GetJsonMetricWithGrabResources) {
EXPECT_TRUE(resources != NULL);
EXPECT_TRUE(metric_test.grabResources());
- TimevalStruct start_time;
- start_time.tv_sec = 1;
- start_time.tv_usec = 0;
+ date_time::TimeDuration start_time = date_time::seconds(1);
- TimevalStruct end_time;
- end_time.tv_sec = 10;
- end_time.tv_usec = 0;
+ date_time::TimeDuration end_time = date_time::seconds(10);
metric_test.message_metric =
- new transport_manager::TMTelemetryObserver::MessageMetric();
+ std::make_shared<transport_manager::TMTelemetryObserver::MessageMetric>();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
@@ -98,10 +88,8 @@ TEST(TransportManagerMetricWrapper, GetJsonMetricWithGrabResources) {
Json::Value jvalue = metric_test.GetJsonMetric();
EXPECT_EQ("\"TransportManager\"\n", jvalue[strings::logger].toStyledString());
- EXPECT_EQ(date_time::DateTime::getuSecs(start_time),
- jvalue[strings::begin].asInt64());
- EXPECT_EQ(date_time::DateTime::getuSecs(end_time),
- jvalue[strings::end].asInt64());
+ EXPECT_EQ(date_time::getuSecs(start_time), jvalue[strings::begin].asInt64());
+ EXPECT_EQ(date_time::getuSecs(end_time), jvalue[strings::end].asInt64());
EXPECT_EQ(1000, jvalue[strings::data_size].asInt());
EXPECT_NEAR(resources->stime, jvalue[strings::stime].asInt(), 1);
diff --git a/src/components/telemetry_monitor/test/transport_manager_observer_test.cc b/src/components/telemetry_monitor/test/transport_manager_observer_test.cc
index adc857d6cc..c0501ac45e 100644
--- a/src/components/telemetry_monitor/test/transport_manager_observer_test.cc
+++ b/src/components/telemetry_monitor/test/transport_manager_observer_test.cc
@@ -30,11 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "telemetry_monitor/transport_manager_observer.h"
#include "gtest/gtest.h"
-#include "telemetry_monitor/mock_telemetry_monitor.h"
#include "protocol_handler/telemetry_observer.h"
+#include "telemetry_monitor/mock_telemetry_monitor.h"
#include "telemetry_monitor/transport_manager_metric_wrapper.h"
-#include "telemetry_monitor/transport_manager_observer.h"
namespace test {
namespace components {
@@ -47,7 +47,7 @@ TEST(TransportManagerObserverTest, MessageProcess) {
MockTelemetryMonitor mock_telemetry_monitor;
TransportManagerObserver tr_observer(&mock_telemetry_monitor);
protocol_handler::RawMessage* ptr =
- new ::protocol_handler::RawMessage(0, 0, NULL, 0);
+ new ::protocol_handler::RawMessage(0, 0, NULL, 0, false);
tr_observer.StartRawMsg(ptr);
EXPECT_CALL(mock_telemetry_monitor, SendMetric(_));
tr_observer.StopRawMsg(ptr);
diff --git a/src/components/test_main.cc b/src/components/test_main.cc
index 61606756fe..8912ed9bd2 100644
--- a/src/components/test_main.cc
+++ b/src/components/test_main.cc
@@ -1,7 +1,7 @@
+#include <iostream>
#include "gmock/gmock.h"
-#include "utils/logger.h"
#include "utils/custom_string.h"
-#include <iostream>
+#include "utils/logger.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain")
int main(int argc, char** argv) {
diff --git a/src/components/transport_manager/CMakeLists.txt b/src/components/transport_manager/CMakeLists.txt
index 4fa224393d..82cc00baf2 100644
--- a/src/components/transport_manager/CMakeLists.txt
+++ b/src/components/transport_manager/CMakeLists.txt
@@ -41,8 +41,15 @@ include_directories (
${POLICY_GLOBAL_INCLUDE_PATH}/
${JSONCPP_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
+if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
+ include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include/transport_manager/tcp/platform_specific/qnx")
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include/transport_manager/tcp/platform_specific/linux")
+endif ()
+
set(PATHS
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src
@@ -66,15 +73,25 @@ else()
)
endif()
+if(BUILD_CLOUD_APP_SUPPORT)
+ GET_PROPERTY(BOOST_LIBS_DIRECTORY GLOBAL PROPERTY GLOBAL_BOOST_LIBS)
+ list(APPEND LIBRARIES boost_system boost_regex -L${BOOST_LIBS_DIRECTORY})
+else()
+ list(APPEND EXCLUDE_PATHS
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/transport_manager/cloud
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/cloud
+ )
+endif()
+
if(BUILD_USB_SUPPORT)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
- set(EXCLUDE_PATHS
+ list(APPEND EXCLUDE_PATHS
${COMPONENTS_DIR}/transport_manager/include/transport_manager/usb/qnx
${COMPONENTS_DIR}/transport_manager/src/usb/qnx
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "QNX")
- set(EXCLUDE_PATHS
+ list(APPEND EXCLUDE_PATHS
${COMPONENTS_DIR}/transport_manager/include/transport_manager/usb/libusb
${COMPONENTS_DIR}/transport_manager/src/usb/libusb
)
@@ -89,15 +106,42 @@ else()
)
endif()
-if(NOT BUILD_TESTS)
- list (APPEND EXCLUDE_PATH
+if(NOT BUILD_WEBSOCKET_SERVER_SUPPORT)
+ list(APPEND EXCLUDE_PATHS
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/transport_manager/websocket_server
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/websocket_server
+ )
+elseif(NOT ENABLE_SECURITY)
+ list(APPEND EXCLUDE_PATHS
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/transport_manager/websocket_server/websocket_secure_session.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/websocket_server/websocket_secure_session.cc
+ )
+endif()
+
+if(NOT ENABLE_IAP2EMULATION)
+ list (APPEND EXCLUDE_PATHS
${CMAKE_CURRENT_SOURCE_DIR}/include/iap2_emulation/iap2_transport_adapter.h
${CMAKE_CURRENT_SOURCE_DIR}/src/iap2_emulation/iap2_transport_adapter.cc
)
endif()
+# exclude platform-dependent files before running collect_sources
+list(APPEND EXCLUDE_PATHS
+ ${COMPONENTS_DIR}/transport_manager/include/transport_manager/tcp/platform_specific
+ ${COMPONENTS_DIR}/transport_manager/src/tcp/platform_specific
+)
+
collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}")
+# then add platform-dependent files later
+set(PLATFORM_DEPENDENT_SOURCES)
+if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
+ collect_sources(PLATFORM_DEPENDENT_SOURCES "${COMPONENTS_DIR}/transport_manager/src/tcp/platform_specific/qnx")
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ collect_sources(PLATFORM_DEPENDENT_SOURCES "${COMPONENTS_DIR}/transport_manager/src/tcp/platform_specific/linux")
+endif ()
+list(APPEND SOURCES ${PLATFORM_DEPENDENT_SOURCES})
+
add_library("TransportManager" ${SOURCES})
target_link_libraries("TransportManager" ${LIBRARIES})
@@ -108,3 +152,4 @@ endif()
if(BUILD_TESTS)
add_subdirectory(test)
endif()
+
diff --git a/src/components/transport_manager/docs/SDL.SDD.WebEngineSupport.dox b/src/components/transport_manager/docs/SDL.SDD.WebEngineSupport.dox
new file mode 100644
index 0000000000..77ab46e247
--- /dev/null
+++ b/src/components/transport_manager/docs/SDL.SDD.WebEngineSupport.dox
@@ -0,0 +1,127 @@
+/**
+\page web_engine_support Web Engine Support Detailed Design
+## Table of contents
+- \subpage wes_intoduction
+ + \ref wes_rationale "1.1 Rationale"
+ + \ref wes_scope "1.2 Scope"
+- \subpage wes_detail_design
+ + \ref wes_design_solutions "2.1 Design solutions"
+ + \ref wes_class_structure "2.2 Class Structure"
+ + \ref wes_sequence_diagram "2.3 Sequence diagram"
+- \subpage wes_data_structures
+ + \ref wes_data_structure "3.1 Data structures"
+- \subpage wes_references_and_history
+ + \ref wes_history "4.1 References"
+*/
+//-----------------------------------------------------------
+/**
+\page wes_intoduction 1 Introduction
+The document is intended to support software developers,
+maintenance and integration engineers with sufficient,
+detailed information concerning the design, development and
+deployment concepts, to accomplish their respective tasks without reliance on the authors.
+
+\anchor wes_rationale
+## 1.1 Rationale
+Boost asio libraries were utilized to enable websocket server connection for web engine.
+To split responsibilities, the following entities were introduces to enable server connections:
+- WebSocketListener
+- WebSocketConnection
+- WebSocketSession
+- WebSocketSecureSession
+
+
+\anchor wes_scope
+## 1.2 Scope
+All aforementioned entities are part of transport_manager namespace
+
+*/
+//-----------------------------------------------------------
+/**
+\page wes_detail_design 2 Component detail design
+\anchor wes_design_solutions
+### 2.1 Design solutions
+
+- WebSocket server was implemented using several layers (e.g. WebSocketConnection, WebSocketSession, WebSocketSecureSession).
+- Utilizing boost::asio library to host a websocket server and establish websocket connections
+- Utilizing asynchronous programming to make all server calls nonblocking
+- CRTP and template specialization to facilitate code reuse.
+
+
+
+#### Design description
+transport_manager::WebSocketListener is an entity that is responsible for creating and listening for connections.
+It includes creating boost library objects to establish a connection, deducing security parameters during its initialization,
+opening a port and accepting new connections.
+The following parameters are used to configure security connection:
+- WSServerCertificatePath (path to websocket server certificate)
+- WSServerKeyPath (path to websocket server private key path)
+- WSServerCACertificatePath (path to CA certificate)
+
+SDL will run in WSS mode only if ALL these parameters are present and have valid values.
+To run SDL as a WS server, one should remove ALL these parameters from smartDeviceLink.ini file (including parameter KEY and VALUE).
+All other cases of parameter configuration (e.g. two of three params are set) are considered to be misconfiguration,
+and SDL will launch with no websocket server transport.
+
+transport_manager::WebSocketConnection is a class that is used as an additional layer between WebSocketListener and WebSocketSession,
+with ability to hadle input/output errors.
+
+transport_manager::WebSocketSession is a class that represents the lowest layer of abstraction in regards of WS server connection. It is used to read
+data from socket to buffer and notifying its observers about connection events.
+
+transport_manager::WebSocketSecureSession is a class that inherits WebSocketSession with an additional role of supporting TLS handshake.
+
+\anchor wes_class_structure
+### 2.2 Class Structure
+The following UML class diagram shows the component structure:
+![Web Engine Support class diagram](WES_classes.png)
+For more information about class diagram follow:
+- http://www.uml-diagrams.org/class-diagrams-overview.htqml
+- https://sourcemaking.com/uml/modeling-it-systems/structural-view/class-diagram
+
+\anchor wes_sequence_diagram
+### 2.3 Sequence diagram
+The following UML sequence diagram shows the component dynamic behavior.
+For more information about sequence diagram follow:
+- http://www.uml-diagrams.org/sequence-diagrams.html
+- https://sourcemaking.com/uml/modeling-it-systems/external-view/use-case-sequence-diagram
+
+Establishing WebSocket connection:
+![WES Basic flow](WES_sequence.png)
+*/
+
+//-----------------------------------------------------------
+/**
+\page wes_data_structures 3 Component data and resources
+\anchor wes_data_structure
+### 3.1 Element Data Structure
+The following data types are used by WebSocketListener:
+ - transport_manager::TransportAdapterController
+ - boost::asio::io_context
+ - boost::ssl::context
+ - boost::asio::tcp::acceptor
+ - boost::asio::tcp::socket
+ - boost::asio::thread_pool
+ - WebSocketConnection
+ - transport_manager::TransportManagerSettings
+
+//-----------------------------------------------------------
+/**
+\page wes_references_and_history 4 References and history
+\anchor wes_history
+### 4.1 Document history
+Document change history
+
+| Version | Date | Author/Editor | Change description |
+|-------------|------------|----------------------------------------|---------------------|
+| 0.1 | 02/03/2020 | [MKed](https://github.com/mked-luxoft) | Initial version from the previous [SDL SDD](https://adc.luxoft.com/confluence/pages/viewpage.action?pageId=279677125) |
+
+Document approve history
+
+| Version | Date | Author/Editor | Change description |
+|-------------|------------|-----------------------------|---------------------|
+| | | | |
+
+For more precise document change history follow github history -
+- https://github.com/smartdevicelink/sdl_core/commits/develop/src/components/transport_manager/docs/SDL.SDD.WebEngineSupport.dox
+*/ \ No newline at end of file
diff --git a/src/components/transport_manager/docs/assets/WES_classes.png b/src/components/transport_manager/docs/assets/WES_classes.png
new file mode 100644
index 0000000000..bbb19b8f02
--- /dev/null
+++ b/src/components/transport_manager/docs/assets/WES_classes.png
Binary files differ
diff --git a/src/components/transport_manager/docs/assets/WES_sequence.png b/src/components/transport_manager/docs/assets/WES_sequence.png
new file mode 100644
index 0000000000..61aa5e35fb
--- /dev/null
+++ b/src/components/transport_manager/docs/assets/WES_sequence.png
Binary files differ
diff --git a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h
index dc38a971f5..768d9ebb54 100644
--- a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h
+++ b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_device_scanner.h
@@ -39,9 +39,9 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
+#include <bluetooth/rfcomm.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
-#include <bluetooth/rfcomm.h>
#include "transport_manager/transport_adapter/device_scanner.h"
#include "utils/conditional_variable.h"
@@ -70,6 +70,11 @@ class BluetoothDeviceScanner : public DeviceScanner {
BluetoothDeviceScanner(TransportAdapterController* controller,
bool auto_repeat_search,
int repeat_search_pause_sec);
+
+ BluetoothDeviceScanner(TransportAdapterController* controller,
+ bool auto_repeat_search,
+ int repeat_search_pause_sec,
+ const uint8_t* smart_device_link_service_uuid_data);
/**
* @brief Destructor.
*/
diff --git a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h
index c4bd02d64b..14f954286f 100644
--- a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h
+++ b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h
@@ -49,7 +49,11 @@ class BluetoothTransportAdapter : public TransportAdapterImpl {
/**
* @brief Constructor.
*/
- BluetoothTransportAdapter(resumption::LastState& last_state,
+ BluetoothTransportAdapter(resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings);
+
+ DEPRECATED
+ BluetoothTransportAdapter(resumption::LastState&,
const TransportManagerSettings& settings);
/**
diff --git a/src/components/transport_manager/include/transport_manager/cloud/cloud_device.h b/src/components/transport_manager/include/transport_manager/cloud/cloud_device.h
new file mode 100644
index 0000000000..15d23bba7f
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/cloud/cloud_device.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2018, Livio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file Cloud_device.h
+ * \brief CloudDevice class header file.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_DEVICE_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_DEVICE_H_
+
+#include "transport_manager/transport_adapter/device.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+struct CloudAppEndpoint {
+ std::string host;
+ std::string port;
+ std::string path;
+ std::string query;
+ std::string fragment;
+};
+
+class CloudDevice : public Device {
+ public:
+ CloudDevice(std::string& host, std::string& port, std::string& name);
+
+ CloudDevice(CloudAppEndpoint& endpoint, std::string& name);
+
+ virtual const std::string& GetHost() const;
+
+ virtual const std::string& GetPort() const;
+
+ virtual const std::string GetTarget() const;
+
+ protected:
+ virtual bool IsSameAs(const Device* other_device) const;
+
+ virtual ApplicationList GetApplicationList() const;
+
+ private:
+ const CloudAppEndpoint endpoint_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_DEVICE_H_
diff --git a/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_connection_factory.h b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_connection_factory.h
new file mode 100644
index 0000000000..ef1754a6e7
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_connection_factory.h
@@ -0,0 +1,98 @@
+/*
+ * \file cloud_websocket_connection_factory.h
+ * \brief CloudWebsocketConnectionFactory class header file.
+ *
+ * Copyright (c) 2018, Livio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_WEBSOCKET_CONNECTION_FACTORY_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_WEBSOCKET_CONNECTION_FACTORY_H_
+
+#include "transport_manager/transport_adapter/server_connection_factory.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+class TransportAdapterController;
+
+/**
+ * @brief Create connections.
+ */
+class CloudWebsocketConnectionFactory : public ServerConnectionFactory {
+ public:
+ /**
+ * @brief Constructor.
+ *
+ * @param controller Pointer to the device adapter controller.
+ */
+ CloudWebsocketConnectionFactory(TransportAdapterController* controller);
+
+ protected:
+ /**
+ * @brief Start cloud websocket connection factory.
+ */
+ virtual TransportAdapter::Error Init();
+
+ /**
+ * @brief Create cloud boost websocket connection.
+ *
+ * @param device_uid Device unique identifier.
+ * @param ap_handle Handle of application.
+ */
+ virtual TransportAdapter::Error CreateConnection(
+ const DeviceUID& device_uid, const ApplicationHandle& app_handle);
+
+ /**
+ * @brief
+ */
+ virtual void Terminate();
+
+ /**
+ * @brief Check for initialization.
+ *
+ * @return true - initialized.
+ * false - not initialized.
+ */
+ virtual bool IsInitialised() const;
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~CloudWebsocketConnectionFactory();
+
+ private:
+ TransportAdapterController* controller_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_WEBSOCKET_CONNECTION_FACTORY_H_
diff --git a/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h
new file mode 100644
index 0000000000..c8b2cc9508
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/cloud/cloud_websocket_transport_adapter.h
@@ -0,0 +1,107 @@
+/*
+ * \file cloud_websocket_transport_adapter.h
+ * \brief Cloud Websocket Transport Adapterclass header file.
+ *
+ * Copyright (c) 2018, Livio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_WEBSOCKET_TRANSPORT_ADAPTER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_CLOUD_WEBSOCKET_TRANSPORT_ADAPTER_H_
+
+#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+/**
+ * @brief Cloud transport adapter that uses websockets.
+ */
+class CloudWebsocketTransportAdapter : public TransportAdapterImpl {
+ public:
+ /**
+ * @brief Constructor.
+ */
+ explicit CloudWebsocketTransportAdapter(
+ resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings);
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~CloudWebsocketTransportAdapter();
+
+ /**
+ * @brief Set CloudTransportConfig for specified app_id
+ *
+ * @param app_id app ID string
+ * @param properties New cloud app properties for the app
+ */
+ void SetAppCloudTransportConfig(std::string app_id,
+ CloudAppProperties properties);
+
+ /**
+ * @brief Get CloudTransportConfig for specified app_id
+ *
+ * @param app_id app ID string
+ * @return CloudAppProperties for the app
+ */
+ const CloudAppProperties& GetAppCloudTransportConfig(std::string app_id);
+
+ protected:
+ /**
+ * @brief Return type of device.
+ *
+ * @return String with device type.
+ */
+ virtual DeviceType GetDeviceType() const;
+
+ /**
+ * @brief Store adapter state in last state singleton
+ */
+ virtual void Store() const;
+
+ /**
+ * @brief Restore adapter state from last state singleton
+ *
+ * @return True on success false otherwise
+ */
+ virtual bool Restore();
+
+ void CreateDevice(const std::string& uid) OVERRIDE;
+
+ private:
+ CloudAppTransportConfig transport_config_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_TCP_TRANSPORT_ADAPTER_H_
diff --git a/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h b/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h
new file mode 100644
index 0000000000..76c8ca73cd
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/cloud/websocket_client_connection.h
@@ -0,0 +1,205 @@
+/*
+ * \file websocket_client_connection.h
+ * \brief WebsocketClientConnection class header file.
+ *
+ * Copyright (c) 2018, Livio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_WEBSOCKET_CLIENT_CONNECTION_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_CLOUD_WEBSOCKET_CLIENT_CONNECTION_H_
+
+#include <boost/asio/connect.hpp>
+#include <boost/asio/ip/tcp.hpp>
+#include <boost/asio/thread_pool.hpp>
+#include <boost/beast/core.hpp>
+#include <boost/beast/websocket.hpp>
+#ifdef ENABLE_SECURITY
+#include <boost/asio/ssl/stream.hpp>
+#include <boost/beast/websocket/ssl.hpp>
+#endif // ENABLE_SECURITY
+#include <cstdlib>
+#include <functional>
+#include <iostream>
+#include <memory>
+#include <string>
+#include <thread>
+#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
+#include "transport_manager/transport_adapter/connection.h"
+#include "utils/message_queue.h"
+#include "utils/threads/message_loop_thread.h"
+#include "utils/threads/thread.h"
+
+namespace websocket =
+ boost::beast::websocket; // from <boost/beast/websocket.hpp>
+
+using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
+typedef websocket::stream<tcp::socket> WS;
+
+#ifdef ENABLE_SECURITY
+namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
+typedef websocket::stream<ssl::stream<tcp::socket> > WSS;
+#endif // ENABLE_SECURITY
+
+using ::utils::MessageQueue;
+
+typedef std::queue<protocol_handler::RawMessagePtr> AsyncQueue;
+typedef protocol_handler::RawMessagePtr Message;
+
+namespace transport_manager {
+namespace transport_adapter {
+
+class TransportAdapterController;
+
+/**
+ * @brief Class responsible for communication over bluetooth sockets.
+ */
+class WebsocketClientConnection
+ : public std::enable_shared_from_this<WebsocketClientConnection>,
+ public Connection {
+ public:
+ /**
+ * @brief Constructor.
+ *
+ * @param device_uid Device unique identifier.
+ * @param app_handle Handle of device.
+ * @param controller Pointer to the device adapter controller.
+ */
+ WebsocketClientConnection(const DeviceUID& device_uid,
+ const ApplicationHandle& app_handle,
+ TransportAdapterController* controller);
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~WebsocketClientConnection();
+
+ /**
+ * @brief Check if we can start the connection attempt and establish
+ *connection status.
+ *
+ * @param error contains information of any error that occurred during
+ *connection attempt.
+ *
+ * @return result that states whether we successfully connected or not.
+ */
+ TransportAdapter::Error Start();
+
+ /**
+ * @brief Send data frame.
+ *
+ * @param message Smart pointer to the raw message.
+ *
+ * @return Error Information about possible reason of sending data failure.
+ */
+ TransportAdapter::Error SendData(::protocol_handler::RawMessagePtr message);
+
+ /**
+ * @brief Disconnect the current connection.
+ *
+ * @return Error Information about possible reason of Disconnect failure.
+ */
+ TransportAdapter::Error Disconnect();
+
+#ifdef ENABLE_SECURITY
+ /**
+ * @brief Attempt to add provided certificate to the ssl::context
+ *
+ * @param cert Certificate string from policy table
+ */
+ void AddCertificateAuthority(std::string cert, boost::system::error_code& ec);
+#endif // ENABLE_SECURITY
+
+ void Shutdown();
+
+ void Recv(boost::system::error_code ec);
+
+ void OnRead(boost::system::error_code ec, std::size_t bytes_transferred);
+
+ private:
+ TransportAdapterController* controller_;
+ boost::asio::io_context ioc_;
+ tcp::resolver resolver_;
+ boost::beast::flat_buffer buffer_;
+ std::string host_;
+ std::string text_;
+ WS ws_;
+#ifdef ENABLE_SECURITY
+ ssl::context ctx_;
+ WSS wss_;
+#endif // ENABLE_SECURITY
+
+ std::atomic_bool shutdown_;
+
+ CloudAppProperties cloud_properties;
+ typedef std::queue<protocol_handler::RawMessagePtr> FrameQueue;
+ FrameQueue frames_to_send_;
+ mutable sync_primitives::Lock frames_to_send_mutex_;
+
+ MessageQueue<Message, AsyncQueue> message_queue_;
+
+ class LoopThreadDelegate : public threads::ThreadDelegate {
+ public:
+ LoopThreadDelegate(MessageQueue<Message, AsyncQueue>* message_queue,
+ WebsocketClientConnection* handler);
+
+ virtual void threadMain() OVERRIDE;
+ virtual void exitThreadMain() OVERRIDE;
+
+ void OnWrite();
+
+ void SetShutdown();
+
+ private:
+ void DrainQueue();
+ MessageQueue<Message, AsyncQueue>& message_queue_;
+ WebsocketClientConnection& handler_;
+ sync_primitives::Lock queue_lock_;
+ sync_primitives::ConditionalVariable queue_new_items_;
+ std::atomic_bool write_pending_;
+ std::atomic_bool shutdown_;
+
+ sync_primitives::Lock write_lock_;
+ };
+
+ LoopThreadDelegate* thread_delegate_;
+ threads::Thread* write_thread_;
+ std::thread io_service_thread_;
+
+ const DeviceUID device_uid_;
+ const ApplicationHandle app_handle_;
+
+ boost::asio::thread_pool io_pool_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_BLUETOOTH_BLUETOOTH_SOCKET_CONNECTION_H_
diff --git a/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h b/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h
index 36a2b374dd..3dabfb39ca 100644
--- a/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h
+++ b/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_IAP2_EMULATION_IAP2_TRANSPORT_ADAPTER_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_IAP2_EMULATION_IAP2_TRANSPORT_ADAPTER_H_
+#include "resumption/last_state_wrapper.h"
#include "transport_manager/tcp/tcp_transport_adapter.h"
#include "transport_manager/transport_manager_settings.h"
-#include "resumption/last_state.h"
#include "utils/macro.h"
#include "utils/threads/thread_delegate.h"
@@ -60,9 +60,14 @@ class IAP2BluetoothEmulationTransportAdapter : public TcpTransportAdapter {
*/
IAP2BluetoothEmulationTransportAdapter(
const uint16_t port,
- resumption::LastState& last_state,
+ resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings);
+ DEPRECATED
+ IAP2BluetoothEmulationTransportAdapter(
+ const uint16_t port,
+ resumption::LastState& last_state_wrapper,
+ const TransportManagerSettings& settings);
/**
* @brief DeviceSwitched is called during switching from iAP2 Bluetooth to
* iAP2 USB transport.
@@ -74,6 +79,15 @@ class IAP2BluetoothEmulationTransportAdapter : public TcpTransportAdapter {
*/
void DeviceSwitched(const DeviceUID& device_handle) OVERRIDE;
+ /**
+ * @brief Notification that transport's configuration is updated. This
+ * override is needed so that a OnTransportConfigUpdated is not sent to the
+ * mobile device for the emulated transport.
+ *
+ * @param new_config The new configuration of the transport
+ */
+ void TransportConfigUpdated(const TransportConfig& new_config) OVERRIDE;
+
protected:
/**
* @brief GetDeviceType Provides SDL device type for transport adapter
@@ -94,13 +108,20 @@ class IAP2USBEmulationTransportAdapter : public TcpTransportAdapter {
* @param last_state LastState instance reference
* @param settings Settings reference
*/
+ IAP2USBEmulationTransportAdapter(
+ const uint16_t port,
+ resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings);
+
+ DEPRECATED
IAP2USBEmulationTransportAdapter(const uint16_t port,
- resumption::LastState& last_state,
- const TransportManagerSettings& settings);
+ resumption::LastState&,
+ const TransportManagerSettings& settings) =
+ delete;
/**
- * Destructor
- */
+ * Destructor
+ */
~IAP2USBEmulationTransportAdapter();
/**
@@ -110,6 +131,15 @@ class IAP2USBEmulationTransportAdapter : public TcpTransportAdapter {
*/
void DeviceSwitched(const DeviceUID& device_handle) OVERRIDE;
+ /**
+ * @brief Notification that transport's configuration is updated. This
+ * override is needed so that a OnTransportConfigUpdated is not sent to the
+ * mobile device for the emulated transport.
+ *
+ * @param new_config The new configuration of the transport
+ */
+ void TransportConfigUpdated(const TransportConfig& new_config) OVERRIDE;
+
protected:
/**
* @brief GetDeviceType Provides SDL device type for transport adapter
diff --git a/src/components/transport_manager/include/transport_manager/tcp/network_interface_listener.h b/src/components/transport_manager/include/transport_manager/tcp/network_interface_listener.h
new file mode 100644
index 0000000000..8154503077
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/tcp/network_interface_listener.h
@@ -0,0 +1,41 @@
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_NETWORK_INTERFACE_LISTENER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_NETWORK_INTERFACE_LISTENER_H_
+
+namespace transport_manager {
+namespace transport_adapter {
+
+/**
+ * @brief Listener to detect various events on network interfaces
+ */
+class NetworkInterfaceListener {
+ public:
+ /**
+ * @brief Destructor
+ */
+ virtual ~NetworkInterfaceListener() {}
+
+ /**
+ * @brief Initialize this listener
+ */
+ virtual bool Init() = 0;
+
+ /**
+ * @brief Deinitialize this listener
+ */
+ virtual void Deinit() = 0;
+
+ /**
+ * @brief Start this listener
+ */
+ virtual bool Start() = 0;
+
+ /**
+ * @brief Stop this listener
+ */
+ virtual bool Stop() = 0;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_NETWORK_INTERFACE_LISTENER_H_
diff --git a/src/components/transport_manager/include/transport_manager/tcp/network_interface_listener_impl.h b/src/components/transport_manager/include/transport_manager/tcp/network_interface_listener_impl.h
new file mode 100644
index 0000000000..272b28b6b2
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/tcp/network_interface_listener_impl.h
@@ -0,0 +1,63 @@
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_NETWORK_INTERFACE_LISTENER_IMPL_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_NETWORK_INTERFACE_LISTENER_IMPL_H_
+
+#include <memory>
+#include <string>
+
+#include "transport_manager/tcp/network_interface_listener.h"
+#include "utils/macro.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+class TcpClientListener;
+
+/**
+ * @brief Listener to detect various events on network interfaces
+ */
+class NetworkInterfaceListenerImpl : public NetworkInterfaceListener {
+ public:
+ /**
+ * @brief Constructor
+ *
+ * @param tcp_client_listener an instance of TcpClientListener which receives
+ * status updates
+ * @param designated_interface if we want to listen only on a specific
+ * network interface, specify its name
+ */
+ NetworkInterfaceListenerImpl(TcpClientListener* tcp_client_listener,
+ const std::string designated_interface);
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~NetworkInterfaceListenerImpl();
+
+ /**
+ * @brief Initialize this listener
+ */
+ bool Init() OVERRIDE;
+
+ /**
+ * @brief Deinitialize this listener
+ */
+ void Deinit() OVERRIDE;
+
+ /**
+ * @brief Start this listener
+ */
+ bool Start() OVERRIDE;
+
+ /**
+ * @brief Stop this listener
+ */
+ bool Stop() OVERRIDE;
+
+ private:
+ std::unique_ptr<NetworkInterfaceListener> platform_specific_impl_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_NETWORK_INTERFACE_LISTENER_IMPL_H_
diff --git a/src/components/transport_manager/include/transport_manager/tcp/platform_specific/linux/platform_specific_network_interface_listener_impl.h b/src/components/transport_manager/include/transport_manager/tcp/platform_specific/linux/platform_specific_network_interface_listener_impl.h
new file mode 100644
index 0000000000..bb60b09a9d
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/tcp/platform_specific/linux/platform_specific_network_interface_listener_impl.h
@@ -0,0 +1,201 @@
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_PLATFORM_SPECIFIC_LINUX_PLATFORM_SPECIFIC_NETWORK_INTERFACE_LISTENER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_PLATFORM_SPECIFIC_LINUX_PLATFORM_SPECIFIC_NETWORK_INTERFACE_LISTENER_H_
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include <netinet/in.h>
+#include "transport_manager/tcp/network_interface_listener.h"
+#include "utils/macro.h"
+#include "utils/threads/thread_delegate.h"
+
+struct ifaddrmsg;
+
+namespace transport_manager {
+namespace transport_adapter {
+
+class TcpClientListener;
+
+/**
+ * @brief Struct to keep network interface's status flags and IP addresses
+ */
+class InterfaceStatus {
+ public:
+ InterfaceStatus()
+ : flags_(0)
+ , has_ipv4_(false)
+ , has_ipv6_(false)
+ , ipv4_address_()
+ , ipv6_address_() {}
+ ~InterfaceStatus() {}
+
+ bool IsAvailable() const;
+ bool IsLoopback() const;
+ // only for debugging output
+ unsigned int GetFlags() const {
+ return flags_;
+ }
+
+ bool HasIPAddress() const;
+ std::string GetIPv4Address() const;
+ std::string GetIPv6Address() const;
+
+ void SetFlags(unsigned int flags) {
+ flags_ = flags;
+ }
+
+ // specify NULL to remove existing address
+ void SetIPv4Address(struct in_addr* addr);
+ void SetIPv6Address(struct in6_addr* addr);
+
+ private:
+ unsigned int flags_;
+ bool has_ipv4_;
+ bool has_ipv6_;
+ struct in_addr ipv4_address_;
+ struct in6_addr ipv6_address_;
+};
+
+typedef std::map<std::string, InterfaceStatus> InterfaceStatusTable;
+
+/**
+ * @brief Listener to detect various events on network interfaces
+ */
+class PlatformSpecificNetworkInterfaceListener
+ : public NetworkInterfaceListener {
+ public:
+ /**
+ * @brief Constructor
+ *
+ * @param tcp_client_listener an instance of TcpClientListener which receives
+ * status updates
+ * @param designated_interface if we want to listen only on a specific
+ * network interface, specify its name
+ */
+ PlatformSpecificNetworkInterfaceListener(
+ TcpClientListener* tcp_client_listener,
+ const std::string designated_interface = "");
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~PlatformSpecificNetworkInterfaceListener();
+
+ /**
+ * @brief Initialize this listener
+ */
+ bool Init() OVERRIDE;
+
+ /**
+ * @brief Deinitialize this listener
+ */
+ void Deinit() OVERRIDE;
+
+ /**
+ * @brief Start this listener
+ */
+ bool Start() OVERRIDE;
+
+ /**
+ * @brief Stop this listener
+ */
+ bool Stop() OVERRIDE;
+
+#ifdef BUILD_TESTS
+ void SetTesting(bool enabled) {
+ testing_ = enabled;
+ }
+
+ int GetSocket() const {
+ return socket_;
+ }
+
+ threads::Thread* GetThread() const {
+ return thread_;
+ }
+
+ void OverwriteStatusTable(const InterfaceStatusTable dummy_table) {
+ status_table_ = dummy_table;
+ }
+
+ void testCallNotifyIPAddresses() {
+ NotifyIPAddresses();
+ }
+
+ const std::string& GetSelectedInterfaceName() const {
+ return selected_interface_;
+ }
+#endif // BUILD_TESTS
+
+ private:
+ // Struct to hold an event on a network interface.
+ // The event can be either an update on flags or an update on IP address.
+ struct EventParam {
+ unsigned int if_index;
+ unsigned int flags;
+ struct sockaddr_storage address;
+
+ EventParam(int interface_index, unsigned int interface_flags = 0)
+ : if_index(interface_index), flags(interface_flags), address() {}
+ };
+
+ // parent class which we will notify the events to
+ TcpClientListener* tcp_client_listener_;
+ // if configured, NetworkInterfaceListener will always look into the IP
+ // addresses of this interface
+ const std::string designated_interface_;
+
+ // a map to store status of each interface
+ InterfaceStatusTable status_table_;
+ // this is the name of the interface we are currently focusing on
+ std::string selected_interface_;
+ // previous IP addresses that we have notified
+ std::string notified_ipv4_addr_;
+ std::string notified_ipv6_addr_;
+
+ int socket_;
+ int pipe_fds_[2];
+ threads::Thread* thread_;
+
+#ifdef BUILD_TESTS
+ bool testing_;
+#endif
+
+ void Loop();
+ bool StopLoop();
+
+ // reset status_table_ by fetching current status of each interface
+ bool InitializeStatus();
+ // update status_table_ by applying the events
+ bool UpdateStatus(uint16_t type, std::vector<EventParam>& params);
+ // update notified_ipv4_addr_ and notified_ipv6_addr_ then notify the parent
+ // class of the change if necessary
+ void NotifyIPAddresses();
+ // Select an appropriate network interface that we will get IP addresses. Also
+ // update selected_interface_.
+ const std::string SelectInterface();
+ // convert ifaddrmsg to a list of EventParam structs
+ std::vector<EventParam> ParseIFAddrMessage(struct ifaddrmsg* message,
+ unsigned int size);
+ // for debugging
+ void DumpTable() const;
+
+ class ListenerThreadDelegate : public threads::ThreadDelegate {
+ public:
+ explicit ListenerThreadDelegate(
+ PlatformSpecificNetworkInterfaceListener* parent);
+ virtual void threadMain();
+ void exitThreadMain();
+
+ private:
+ PlatformSpecificNetworkInterfaceListener* parent_;
+ };
+
+ DISALLOW_COPY_AND_ASSIGN(PlatformSpecificNetworkInterfaceListener);
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_PLATFORM_SPECIFIC_LINUX_PLATFORM_SPECIFIC_NETWORK_INTERFACE_LISTENER_H_
diff --git a/src/components/transport_manager/include/transport_manager/tcp/platform_specific/qnx/platform_specific_network_interface_listener_impl.h b/src/components/transport_manager/include/transport_manager/tcp/platform_specific/qnx/platform_specific_network_interface_listener_impl.h
new file mode 100644
index 0000000000..2cb5eb47a7
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/tcp/platform_specific/qnx/platform_specific_network_interface_listener_impl.h
@@ -0,0 +1,70 @@
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_PLATFORM_SPECIFIC_QNX_PLATFORM_SPECIFIC_NETWORK_INTERFACE_LISTENER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_PLATFORM_SPECIFIC_QNX_PLATFORM_SPECIFIC_NETWORK_INTERFACE_LISTENER_H_
+
+#include <map>
+#include <string>
+#include <vector>
+
+#include <netinet/in.h>
+#include "transport_manager/tcp/network_interface_listener.h"
+#include "utils/macro.h"
+#include "utils/threads/thread_delegate.h"
+
+class Thread;
+struct ifaddrmsg;
+
+namespace transport_manager {
+namespace transport_adapter {
+
+class TcpClientListener;
+
+/**
+ * @brief Listener to detect various events on network interfaces
+ */
+class PlatformSpecificNetworkInterfaceListener
+ : public NetworkInterfaceListener {
+ public:
+ /**
+ * @brief Constructor
+ *
+ * @param tcp_client_listener an instance of TcpClientListener which receives
+ * status updates
+ * @param designated_interface if we want to listen only on a specific
+ * network interface, specify its name
+ */
+ PlatformSpecificNetworkInterfaceListener(
+ TcpClientListener* tcp_client_listener,
+ const std::string designated_interface = "");
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~PlatformSpecificNetworkInterfaceListener();
+
+ /**
+ * @brief Initialize this listener
+ */
+ bool Init() OVERRIDE;
+
+ /**
+ * @brief Deinitialize this listener
+ */
+ void Deinit() OVERRIDE;
+
+ /**
+ * @brief Start this listener
+ */
+ bool Start() OVERRIDE;
+
+ /**
+ * @brief Stop this listener
+ */
+ bool Stop() OVERRIDE;
+
+ private:
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_PLATFORM_SPECIFIC_QNX_PLATFORM_SPECIFIC_NETWORK_INTERFACE_LISTENER_H_
diff --git a/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h b/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h
index 2640049ecc..f033d35bf7 100644
--- a/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h
+++ b/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h
@@ -36,15 +36,18 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_TCP_CLIENT_LISTENER_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_TCP_CLIENT_LISTENER_H_
-#include "utils/threads/thread_delegate.h"
#include "transport_manager/transport_adapter/client_connection_listener.h"
+#include "utils/lock.h"
+#include "utils/threads/thread_delegate.h"
class Thread;
+struct in_addr;
namespace transport_manager {
namespace transport_adapter {
class TransportAdapterController;
+class NetworkInterfaceListener;
/**
* @brief Listener of device adapter that use TCP transport.
@@ -57,11 +60,15 @@ class TcpClientListener : public ClientConnectionListener {
* @param controller Pointer to the device adapter controller.
* @param port Port No.
* @param enable_keepalive If true enables TCP keepalive on accepted
+ * @param designated_interface Specify the name of the network interface to
+ *listen on. If empty, then this process will listen on all network
+ *interfaces.
*connections
*/
TcpClientListener(TransportAdapterController* controller,
uint16_t port,
- bool enable_keepalive);
+ bool enable_keepalive,
+ const std::string designated_interface = "");
/**
* @brief Destructor.
@@ -101,7 +108,22 @@ class TcpClientListener : public ClientConnectionListener {
*/
virtual TransportAdapter::Error StopListening();
+ TransportAdapter::Error SuspendListening() OVERRIDE;
+
+ TransportAdapter::Error ResumeListening() OVERRIDE;
+
+ /**
+ * @brief Called from NetworkInterfaceListener when IP address of the network
+ * interface is changed.
+ */
+ virtual void OnIPAddressUpdated(const std::string ipv4_addr,
+ const std::string ipv6_addr);
+
#ifdef BUILD_TESTS
+ void set_network_interface_listener(NetworkInterfaceListener* listener) {
+ interface_listener_ = listener;
+ }
+
uint16_t port() const {
return port_;
}
@@ -113,19 +135,47 @@ class TcpClientListener : public ClientConnectionListener {
threads::Thread* thread() const {
return thread_;
}
+
+ static void set_testing(bool enabled) {
+ testing_ = enabled;
+ }
#endif // BUILD_TESTS
private:
const uint16_t port_;
const bool enable_keepalive_;
TransportAdapterController* controller_;
+ bool initialized_;
+ bool started_;
threads::Thread* thread_;
int socket_;
bool thread_stop_requested_;
+ int pipe_fds_[2];
+ NetworkInterfaceListener* interface_listener_;
+ const std::string designated_interface_;
+ std::string current_ip_address_;
+ sync_primitives::Lock start_stop_lock_;
+
+#ifdef BUILD_TESTS
+ static bool testing_;
+#endif // BUILD_TESTS
void Loop();
void StopLoop();
+ TransportAdapter::Error StartListeningThread();
+ TransportAdapter::Error StopListeningThread();
+
+ bool StartOnNetworkInterface();
+ bool StopOnNetworkInterface();
+ bool IsListeningOnSpecificInterface() const;
+
+ static int CreateIPv4ServerSocket(uint16_t port,
+ const std::string interface_name = "");
+ static void DestroyServerSocket(int sock);
+ static bool GetIPv4Address(const std::string interface_name,
+ struct in_addr* ip_address);
+
class ListeningThreadDelegate : public threads::ThreadDelegate {
public:
explicit ListeningThreadDelegate(TcpClientListener* parent);
diff --git a/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h b/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h
index 7aa0b72687..5b746662f1 100644
--- a/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h
+++ b/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h
@@ -36,19 +36,19 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_TCP_DEVICE_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_TCP_DEVICE_H_
-#include <memory.h>
-#include <signal.h>
-#include <errno.h>
#include <arpa/inet.h>
+#include <errno.h>
+#include <memory.h>
#include <netinet/in.h>
-#include <sys/types.h>
+#include <signal.h>
#include <sys/socket.h>
+#include <sys/types.h>
#include <map>
#include <string>
-#include "utils/lock.h"
#include "transport_manager/transport_adapter/device.h"
+#include "utils/lock.h"
namespace transport_manager {
namespace transport_adapter {
@@ -66,7 +66,7 @@ class TcpDevice : public Device {
**/
TcpDevice(const in_addr_t& in_addr, const std::string& name);
-#if defined(BUILD_TESTS)
+#if defined(ENABLE_IAP2EMULATION)
/**
* @brief TcpDevice
* @param in_addr IP address of device
diff --git a/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h b/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h
index 5431b4455d..c5948062c9 100644
--- a/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h
+++ b/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h
@@ -49,15 +49,32 @@ class TcpTransportAdapter : public TransportAdapterImpl {
/**
* @brief Constructor.
*/
- explicit TcpTransportAdapter(uint16_t port,
- resumption::LastState& last_state,
- const TransportManagerSettings& settings);
+ TcpTransportAdapter(uint16_t port,
+ resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings);
+
+ DEPRECATED
+ TcpTransportAdapter(uint16_t port,
+ resumption::LastState&,
+ const TransportManagerSettings& settings) = delete;
/**
* @brief Destructor.
*/
virtual ~TcpTransportAdapter();
+ /**
+ * @brief Notification that transport's configuration is updated
+ *
+ * @param new_config The new configuration of the transport
+ */
+ void TransportConfigUpdated(const TransportConfig& new_config) OVERRIDE;
+
+ /**
+ * @brief Returns the transport's configuration information
+ */
+ virtual TransportConfig GetTransportConfiguration() const OVERRIDE;
+
protected:
/**
* @brief Return type of device.
@@ -77,6 +94,19 @@ class TcpTransportAdapter : public TransportAdapterImpl {
* @return True on success false otherwise
*/
virtual bool Restore();
+
+ private:
+ /**
+ * @brief Keeps transport specific configuration
+ *
+ * TCP transport uses following information:
+ * - "enabled": whether the transport is currently enabled or not. Value can
+ * be "true" or "false".
+ * - "tcp_ip_address": string representation of IP address (either IPv4 or
+ * IPv6)
+ * - "tcp_port": string representation of TCP port number (e.g. "12345")
+ */
+ TransportConfig transport_config_;
};
} // namespace transport_adapter
diff --git a/src/components/transport_manager/include/transport_manager/telemetry_observer.h b/src/components/transport_manager/include/transport_manager/telemetry_observer.h
index 5e42289a03..b4f321d23f 100644
--- a/src/components/transport_manager/include/transport_manager/telemetry_observer.h
+++ b/src/components/transport_manager/include/transport_manager/telemetry_observer.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TELEMETRY_OBSERVER_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TELEMETRY_OBSERVER_H_
-#include "transport_manager/common.h"
#include "protocol/raw_message.h"
+#include "transport_manager/common.h"
#include "utils/date_time.h"
namespace transport_manager {
@@ -42,8 +42,8 @@ namespace transport_manager {
class TMTelemetryObserver {
public:
struct MessageMetric {
- TimevalStruct begin;
- TimevalStruct end;
+ date_time::TimeDuration begin;
+ date_time::TimeDuration end;
size_t data_size;
};
virtual void StartRawMsg(const protocol_handler::RawMessage* ptr) = 0;
@@ -51,5 +51,5 @@ class TMTelemetryObserver {
virtual ~TMTelemetryObserver() {}
};
-} // transport_manager
+} // namespace transport_manager
#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TELEMETRY_OBSERVER_H_
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/client_connection_listener.h b/src/components/transport_manager/include/transport_manager/transport_adapter/client_connection_listener.h
index f905e11c43..e49a355e53 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/client_connection_listener.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/client_connection_listener.h
@@ -76,6 +76,18 @@ class ClientConnectionListener {
virtual TransportAdapter::Error StopListening() = 0;
/**
+ * @brief Suspends current listening thread
+ * @return Error information about possible reason of failure.
+ */
+ virtual TransportAdapter::Error SuspendListening() = 0;
+
+ /**
+ * @brief Resumes current listening thread
+ * @return Error information about possible reason of failure.
+ */
+ virtual TransportAdapter::Error ResumeListening() = 0;
+
+ /**
* @brief Destructor.
*/
virtual ~ClientConnectionListener() {}
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h b/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h
index 537e94b055..4d9910b9f3 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h
@@ -35,7 +35,6 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_CONNECTION_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_CONNECTION_H_
-#include "utils/shared_ptr.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
namespace transport_manager {
@@ -65,9 +64,16 @@ class Connection {
* @brief Disconnect the current connection.
*/
virtual TransportAdapter::Error Disconnect() = 0;
+
+ /**
+ * @brief Terminate method may implement the logic of correct thread
+ * termination, if necessary for specific connection. Unlike the disconnect
+ * method, which manipulates physical descriptors
+ */
+ virtual void Terminate() {}
};
-typedef utils::SharedPtr<Connection> ConnectionSPtr;
+typedef std::shared_ptr<Connection> ConnectionSPtr;
} // namespace transport_adapter
} // namespace transport_manager
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/threaded_socket_connection.h b/src/components/transport_manager/include/transport_manager/transport_adapter/threaded_socket_connection.h
index 3792b94d7c..7c4e07fa59 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/threaded_socket_connection.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/threaded_socket_connection.h
@@ -38,11 +38,11 @@
#include <poll.h>
#include <queue>
-#include "transport_manager/transport_adapter/connection.h"
+#include <atomic>
#include "protocol/common.h"
-#include "utils/atomic_object.h"
-#include "utils/threads/thread_delegate.h"
+#include "transport_manager/transport_adapter/connection.h"
#include "utils/lock.h"
+#include "utils/threads/thread_delegate.h"
using ::transport_manager::transport_adapter::Connection;
@@ -74,6 +74,8 @@ class ThreadedSocketConnection : public Connection {
*/
TransportAdapter::Error Disconnect();
+ void Terminate() OVERRIDE;
+
/**
* @brief Start thread creation.
*
@@ -201,7 +203,7 @@ class ThreadedSocketConnection : public Connection {
FrameQueue frames_to_send_;
mutable sync_primitives::Lock frames_to_send_mutex_;
- sync_primitives::atomic_int socket_;
+ std::atomic_int socket_;
bool terminate_flag_;
bool unexpected_disconnect_;
const DeviceUID device_uid_;
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h
index 0b38f82637..92a3a2c2f4 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_controller.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_CONTROLLER_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_CONTROLLER_H_
-#include "transport_manager/transport_adapter/device.h"
-#include "transport_manager/transport_adapter/connection.h"
#include "protocol/common.h"
+#include "transport_manager/transport_adapter/connection.h"
+#include "transport_manager/transport_adapter/device.h"
namespace transport_manager {
namespace transport_adapter {
@@ -88,6 +88,10 @@ class TransportAdapterController {
*/
virtual DeviceSptr FindDevice(const DeviceUID& device_handle) const = 0;
+ virtual ConnectionSPtr FindPendingConnection(
+ const DeviceUID& device_handle,
+ const ApplicationHandle& app_handle) const = 0;
+
/**
* @brief Create connection and fill its parameters.
*
@@ -100,6 +104,16 @@ class TransportAdapterController {
const ApplicationHandle& app_handle) = 0;
/**
+ * @brief Set state of specified connection - PENDING and launch
+ *OnConnectPending event in device adapter listener.
+ *
+ * @param devcie_handle Device unique identifier.
+ * @param app_handle Handle of application.
+ */
+ virtual void ConnectPending(const DeviceUID& device_handle,
+ const ApplicationHandle& app_handle) = 0;
+
+ /**
* @brief Make state of specified connection - ESTABLISHED and launch
*OnConnectDone event in device adapter listener.
*
@@ -160,12 +174,12 @@ class TransportAdapterController {
const ApplicationHandle& app_handle) = 0;
/**
- * @brief Launch OnDataReceiveDone event in the device adapter listener.
- *
- * @param device_handle Device unique identifier.
- * @param app_handle Handle of application.
- * @param message Smart pointer to the raw message.
- */
+ * @brief Launch OnDataReceiveDone event in the device adapter listener.
+ *
+ * @param device_handle Device unique identifier.
+ * @param app_handle Handle of application.
+ * @param message Smart pointer to the raw message.
+ */
virtual void DataReceiveDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message) = 0;
@@ -204,6 +218,15 @@ class TransportAdapterController {
const ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message,
const DataSendError&) = 0;
+
+ /**
+ * @brief Notification that transport's configuration is updated
+ *
+ * @param new_config The new configuration of the transport
+ */
+ virtual void TransportConfigUpdated(const TransportConfig& new_config) = 0;
+
+ virtual DeviceSptr GetWebEngineDevice() const = 0;
};
} // namespace transport_adapter
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h
index 2b1ada79ad..cfc886cb15 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h
@@ -33,20 +33,21 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_IMPL_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_IMPL_H_
-#include <queue>
-#include <set>
#include <map>
#include <memory>
+#include <queue>
+#include <set>
#include <string>
#include "utils/lock.h"
#include "utils/rwlock.h"
+#include "utils/timer.h"
+#include "resumption/last_state_wrapper.h"
+#include "transport_manager/transport_adapter/connection.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
#include "transport_manager/transport_adapter/transport_adapter_controller.h"
-#include "transport_manager/transport_adapter/connection.h"
#include "transport_manager/transport_manager_settings.h"
-#include "resumption/last_state.h"
#ifdef TELEMETRY_MONITOR
#include "transport_manager/telemetry_observer.h"
@@ -61,6 +62,8 @@ class DeviceScanner;
class ServerConnectionFactory;
class ClientConnectionListener;
+typedef std::shared_ptr<timer::Timer> TimerSPtr;
+
/*
* @brief Implementation of device adapter class.
**/
@@ -79,9 +82,16 @@ class TransportAdapterImpl : public TransportAdapter,
TransportAdapterImpl(DeviceScanner* device_scanner,
ServerConnectionFactory* server_connection_factory,
ClientConnectionListener* client_connection_listener,
- resumption::LastState& last_state,
+ resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings);
+ DEPRECATED
+ TransportAdapterImpl(DeviceScanner* device_scanner,
+ ServerConnectionFactory* server_connection_factory,
+ ClientConnectionListener* client_connection_listener,
+ resumption::LastState& last_state,
+ const TransportManagerSettings& settings) = delete;
+
/**
* @brief Destructor.
**/
@@ -147,6 +157,22 @@ class TransportAdapterImpl : public TransportAdapter,
const DeviceUID& device_handle) OVERRIDE;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ ConnectionStatus GetConnectionStatus(
+ const DeviceUID& device_handle) const OVERRIDE;
+
+ /**
+ * @brief Notifies the application manager that a cloud connection status has
+ * updated and should trigger an UpdateAppList RPC to the HMI
+ */
+ void ConnectionStatusUpdated(DeviceSptr device, ConnectionStatus status);
+
+ /**
* @brief Disconnect from specified session.
*
* @param devcie_handle Device unique identifier.
@@ -183,19 +209,8 @@ class TransportAdapterImpl : public TransportAdapter,
const ApplicationHandle& app_handle,
const ::protocol_handler::RawMessagePtr data) OVERRIDE;
- /**
- * @brief Start client listener.
- *
- * @return Error information about possible reason of failure.
- */
- TransportAdapter::Error StartClientListening() OVERRIDE;
-
- /**
- * @brief Stop client listener.
- *
- * @return Error information about possible reason of failure.
- */
- TransportAdapter::Error StopClientListening() OVERRIDE;
+ TransportAdapter::Error ChangeClientListening(
+ TransportAction required_change) OVERRIDE;
/**
* @brief Notify that device scanner is available.
@@ -245,6 +260,10 @@ class TransportAdapterImpl : public TransportAdapter,
*/
DeviceSptr FindDevice(const DeviceUID& device_handle) const OVERRIDE;
+ ConnectionSPtr FindPendingConnection(
+ const DeviceUID& device_handle,
+ const ApplicationHandle& app_handle) const OVERRIDE;
+
/**
* @brief Search for device in container of devices, if it is not there - adds
*it.
@@ -264,13 +283,6 @@ class TransportAdapterImpl : public TransportAdapter,
*/
void SearchDeviceFailed(const SearchDeviceError& error) OVERRIDE;
- /**
- * @brief Add device to the container(map), if container doesn't hold it yet.
- *
- * @param device Smart pointer to the device.
- *
- * @return Smart pointer to the device.
- */
DeviceSptr AddDevice(DeviceSptr device) OVERRIDE;
/**
@@ -306,6 +318,16 @@ class TransportAdapterImpl : public TransportAdapter,
const CommunicationError& error) OVERRIDE;
/**
+ * @brief Set state of specified connection - PENDING and launch
+ *OnConnectPending event in device adapter listener.
+ *
+ * @param devcie_handle Device unique identifier.
+ * @param app_handle Handle of application.
+ */
+ void ConnectPending(const DeviceUID& device_handle,
+ const ApplicationHandle& app_handle) OVERRIDE;
+
+ /**
* @brief Set state of specified connection - ESTABLISHED and launch
*OnConnectDone event in device adapter listener.
*
@@ -400,6 +422,13 @@ class TransportAdapterImpl : public TransportAdapter,
const DataSendError& error) OVERRIDE;
/**
+ * @brief Notification that transport's configuration is updated
+ *
+ * @param new_config The new configuration of the transport
+ */
+ void TransportConfigUpdated(const TransportConfig& new_config) OVERRIDE;
+
+ /**
* @brief DoTransportSwitch notifies listeners of transport adapter events
* that transport switching is requested by system
*/
@@ -420,6 +449,18 @@ class TransportAdapterImpl : public TransportAdapter,
SwitchableDevices GetSwitchableDevices() const OVERRIDE;
/**
+ * @brief Returns the transport's configuration information
+ */
+ virtual TransportConfig GetTransportConfiguration() const OVERRIDE {
+ // default is empty
+ return TransportConfig();
+ }
+
+ void CreateDevice(const std::string& uid) OVERRIDE {
+ return;
+ }
+
+ /**
* @brief Return name of device.
*
* @param device_id Device unique identifier.
@@ -459,7 +500,7 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @param observer - pointer to observer
*/
- void SetTelemetryObserver(TMTelemetryObserver* observer);
+ void SetTelemetryObserver(TMTelemetryObserver* observer) OVERRIDE;
/**
* @brief Return Time metric observer
@@ -469,6 +510,12 @@ class TransportAdapterImpl : public TransportAdapter,
TMTelemetryObserver* GetTelemetryObserver() OVERRIDE;
#endif // TELEMETRY_MONITOR
+ /**
+ * @brief GetWebEngineDevice
+ * @return shared pointer to WebEngine device
+ */
+ DeviceSptr GetWebEngineDevice() const OVERRIDE;
+
protected:
/**
* @brief Store adapter state where applicable
@@ -518,6 +565,33 @@ class TransportAdapterImpl : public TransportAdapter,
TransportAdapter::Error ConnectDevice(DeviceSptr device);
/**
+ * @brief Reattempt the last failed connection to a device
+ */
+ void RetryConnection();
+
+ /**
+ * @brief Clear any retry timers which have been completed
+ */
+ void ClearCompletedTimers();
+
+ /**
+ * @brief Retrieve the next device available for a reattempted connection
+ * @return The handle first device with an expired retry timer if present,
+ * otherwise an empty string
+ */
+ DeviceUID GetNextRetryDevice();
+
+ /**
+ * @brief Remove a connection from the list without triggering
+ *the connection's destructor inside of a list lock
+ *
+ * @param device_handle Device unique identifier.
+ * @param app_handle Handle of application.
+ */
+ void RemoveConnection(const DeviceUID& device_id,
+ const ApplicationHandle& app_handle);
+
+ /**
* @brief Remove specified device
* @param device_handle Device unique identifier.
*/
@@ -549,7 +623,7 @@ class TransportAdapterImpl : public TransportAdapter,
ConnectionSPtr connection;
DeviceUID device_id;
ApplicationHandle app_handle;
- enum { NEW, ESTABLISHED, FINALISING } state;
+ enum { NEW, ESTABLISHED, FINALISING, PENDING } state;
};
/**
@@ -579,6 +653,18 @@ class TransportAdapterImpl : public TransportAdapter,
ConnectionMap connections_;
/**
+ * @brief Queue of retry timers.
+ */
+ std::queue<std::pair<TimerSPtr, DeviceUID> > retry_timer_pool_;
+ sync_primitives::Lock retry_timer_pool_lock_;
+
+ /**
+ * @brief Queue of completed retry timers.
+ */
+ std::queue<std::pair<TimerSPtr, DeviceUID> > completed_timer_pool_;
+ sync_primitives::Lock completed_timer_pool_lock_;
+
+ /**
* @brief Mutex restricting access to connections map.
**/
mutable sync_primitives::RWLock connections_lock_;
@@ -592,7 +678,7 @@ class TransportAdapterImpl : public TransportAdapter,
#endif // TELEMETRY_MONITOR
resumption::LastState& last_state() const {
- return last_state_;
+ return last_state_wrapper_->get_accessor().GetMutableData();
}
/**
@@ -610,7 +696,7 @@ class TransportAdapterImpl : public TransportAdapter,
*/
ClientConnectionListener* client_connection_listener_;
- resumption::LastState& last_state_;
+ resumption::LastStateWrapperPtr last_state_wrapper_;
const TransportManagerSettings& settings_;
};
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h
index 424fa53dea..4db9a3b710 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_LISTENER_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_LISTENER_H_
+#include "protocol/common.h"
#include "transport_manager/common.h"
#include "transport_manager/error.h"
-#include "protocol/common.h"
namespace transport_manager {
namespace transport_adapter {
@@ -92,6 +92,25 @@ class TransportAdapterListener {
const TransportAdapter* adapter) = 0;
/**
+ * @brief Reaction to connection status update
+ * @param adapter Current transport adapter
+ */
+ virtual void OnConnectionStatusUpdated(const TransportAdapter* adapter) = 0;
+
+ /**
+ * @brief Search specified device adapter in the container of shared pointers
+ * to device adapters to be sure it is available,
+ * launch event ON_CONNECT_PENDING in transport manager.
+ *
+ * @param device_adater Pointer to the device adapter.
+ * @param device_handle Device unique identifier.
+ * @param app_id Handle of application.
+ */
+ virtual void OnConnectPending(const TransportAdapter* adapter,
+ const DeviceUID& device_handle,
+ const ApplicationHandle& app_id) = 0;
+
+ /**
* @brief Search specified device adapter in the container of shared pointers
*to device adapters to be sure it is available,
* launch event ON_CONNECT_DONE in transport manager.
@@ -277,8 +296,17 @@ class TransportAdapterListener {
*/
virtual void OnTransportSwitchRequested(
const TransportAdapter* transport_adapter) = 0;
+
+ /**
+ * @brief Notification that the transport's specific configuration has been
+ * updated.
+ *
+ * @param transport_adapter pointer to the transport adapter
+ */
+ virtual void OnTransportConfigUpdated(
+ const TransportAdapter* transport_adapter) = 0;
};
-} // transport_adapter namespace
-} // transport_manager namespace
+} // namespace transport_adapter
+} // namespace transport_manager
#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_LISTENER_H_
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h
index 8a8031c3cf..d00ae1c498 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_TRANSPORT_ADAPTER_LISTENER_IMPL_H_
#include "transport_manager/common.h"
-#include "transport_manager/transport_adapter/transport_adapter_listener.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
+#include "transport_manager/transport_adapter/transport_adapter_listener.h"
#include "transport_manager/transport_manager.h"
namespace transport_manager {
@@ -88,6 +88,24 @@ class TransportAdapterListenerImpl
virtual void OnFindNewApplicationsRequest(const TransportAdapter* adapter);
/**
+ * @brief Passes notification to that the cloud conection status has updated
+ */
+ virtual void OnConnectionStatusUpdated(const TransportAdapter* adapter);
+
+ /**
+ * @brief Search specified device adapter in the container of shared pointers
+ * to device adapters to be sure it is available,
+ * launch event ON_CONNECT_PENDING in transport manager.
+ *
+ * @param device_adater Pointer to the device adapter.
+ * @param device_handle Device unique identifier.
+ * @param app_id Handle of application.
+ */
+ virtual void OnConnectPending(const TransportAdapter* adapter,
+ const DeviceUID& device_handle,
+ const ApplicationHandle& app_id);
+
+ /**
* @brief Search specified device adapter in the container of shared pointers
*to device adapters to be sure it is available,
* launch event ON_CONNECT_DONE in transport manager.
@@ -272,6 +290,15 @@ class TransportAdapterListenerImpl
*/
void OnTransportSwitchRequested(const TransportAdapter* adapter) OVERRIDE;
+ /**
+ * @brief Notification that the transport's specific configuration has been
+ * updated.
+ *
+ * @param transport_adapter pointer to the transport adapter
+ */
+ void OnTransportConfigUpdated(
+ const transport_adapter::TransportAdapter* adapter) OVERRIDE;
+
private:
TransportManager* transport_manager_;
TransportAdapter* transport_adapter_;
diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_default.h b/src/components/transport_manager/include/transport_manager/transport_manager_default.h
index 8039f9c985..81fc92dc38 100644
--- a/src/components/transport_manager/include/transport_manager/transport_manager_default.h
+++ b/src/components/transport_manager/include/transport_manager/transport_manager_default.h
@@ -38,24 +38,51 @@
#include "transport_manager/transport_manager_impl.h"
-namespace resumption {
-class LastState;
-}
-
namespace transport_manager {
+struct TransportAdapterFactory {
+ TransportAdapterFactory();
+ template <typename... Args>
+ using CreatorTA =
+ std::function<transport_adapter::TransportAdapter*(Args&&... args)>;
+#ifdef BLUETOOTH_SUPPORT
+ CreatorTA<resumption::LastStateWrapperPtr&, const TransportManagerSettings&>
+ ta_bluetooth_creator_;
+#endif
+ CreatorTA<const uint16_t,
+ resumption::LastStateWrapperPtr&,
+ const TransportManagerSettings&>
+ ta_tcp_creator_;
+#if defined(USB_SUPPORT)
+ CreatorTA<resumption::LastStateWrapperPtr&, const TransportManagerSettings&>
+ ta_usb_creator_;
+#endif
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ CreatorTA<resumption::LastStateWrapperPtr&, const TransportManagerSettings&>
+ ta_cloud_creator_;
+#endif
+#if defined(WEBSOCKET_SERVER_TRANSPORT_SUPPORT)
+ CreatorTA<resumption::LastStateWrapperPtr&, const TransportManagerSettings&>
+ ta_websocket_server_creator_;
+#endif
+};
+
/**
* @brief Default realization of transport_manager_impl class.
*/
class TransportManagerDefault : public TransportManagerImpl {
public:
- explicit TransportManagerDefault(const TransportManagerSettings& settings);
+ explicit TransportManagerDefault(const TransportManagerSettings& settings,
+ const TransportAdapterFactory& ta_factory_);
/**
* @brief Initialize transport manager.
*
* @return Code error.
*/
+ int Init(resumption::LastStateWrapperPtr last_state_wrapper) OVERRIDE;
+
+ DEPRECATED
int Init(resumption::LastState& last_state) OVERRIDE;
/**
@@ -63,8 +90,10 @@ class TransportManagerDefault : public TransportManagerImpl {
*/
virtual ~TransportManagerDefault();
+ private:
+ TransportAdapterFactory ta_factory_;
DISALLOW_COPY_AND_ASSIGN(TransportManagerDefault);
};
-}
+} // namespace transport_manager
#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_DEFAULT_H_
diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
index eaa71ce3bb..85d96bac55 100644
--- a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
+++ b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
@@ -33,30 +33,29 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_IMPL_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_IMPL_H_
-#include <queue>
-#include <map>
-#include <list>
-#include <vector>
-#include <utility>
#include <algorithm>
-#include <tuple>
#include <functional>
+#include <list>
+#include <map>
+#include <queue>
+#include <tuple>
+#include <utility>
+#include <vector>
-#include "utils/timer.h"
-#include "utils/timer_task_impl.h"
#include "utils/rwlock.h"
+#include "utils/timer.h"
+#include "protocol/common.h"
+#include "transport_manager/transport_adapter/transport_adapter_listener_impl.h"
#include "transport_manager/transport_manager.h"
#include "transport_manager/transport_manager_listener.h"
-#include "transport_manager/transport_adapter/transport_adapter_listener_impl.h"
-#include "protocol/common.h"
#ifdef TELEMETRY_MONITOR
-#include "transport_manager/telemetry_observer.h"
#include "telemetry_monitor/telemetry_observable.h"
+#include "transport_manager/telemetry_observer.h"
#endif // TELEMETRY_MONITOR
-#include "utils/threads/message_loop_thread.h"
#include "transport_manager/transport_adapter/transport_adapter_event.h"
#include "transport_manager/transport_manager_settings.h"
+#include "utils/threads/message_loop_thread.h"
namespace transport_manager {
@@ -64,7 +63,7 @@ typedef threads::MessageLoopThread<std::queue<protocol_handler::RawMessagePtr> >
RawMessageLoopThread;
typedef threads::MessageLoopThread<std::queue<TransportAdapterEvent> >
TransportAdapterEventLoopThread;
-typedef utils::SharedPtr<timer::Timer> TimerSPtr;
+typedef std::shared_ptr<timer::Timer> TimerSPtr;
typedef std::map<DeviceUID, TransportAdapter*> DeviceToAdapterMap;
/**
@@ -75,10 +74,10 @@ class TransportManagerImpl
public RawMessageLoopThread::Handler,
public TransportAdapterEventLoopThread::Handler
#ifdef TELEMETRY_MONITOR
- ,
+ ,
public telemetry_monitor::TelemetryObservable<TMTelemetryObserver>
#endif // TELEMETRY_MONITOR
- {
+{
public:
struct Connection {
ConnectionUID id;
@@ -125,6 +124,9 @@ class TransportManagerImpl
*
* @return Code error.
*/
+ int Init(resumption::LastStateWrapperPtr last_state_wrapper) OVERRIDE;
+
+ DEPRECATED
int Init(resumption::LastState& last_state) OVERRIDE;
/**
@@ -133,6 +135,12 @@ class TransportManagerImpl
*/
virtual int Reinit() OVERRIDE;
+ virtual void Deinit() OVERRIDE;
+
+ void StopEventsProcessing() OVERRIDE;
+
+ void StartEventsProcessing() OVERRIDE;
+
/**
* @brief Start scanning for new devices.
*
@@ -140,6 +148,12 @@ class TransportManagerImpl
**/
int SearchDevices() OVERRIDE;
+ void AddCloudDevice(
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) OVERRIDE;
+
+ void RemoveCloudDevice(const DeviceHandle device_id) OVERRIDE;
+
/**
* @brief Connect to all applications discovered on device.
*
@@ -150,6 +164,16 @@ class TransportManagerImpl
int ConnectDevice(const DeviceHandle device_id) OVERRIDE;
/**
+ * @brief Retrieves the connection status of a given device
+ *
+ * @param device_handle Handle of device to query
+ *
+ * @return The connection status of the given device
+ */
+ ConnectionStatus GetConnectionStatus(
+ const DeviceHandle& device_handle) const OVERRIDE;
+
+ /**
* @brief Disconnect from all applications connected on device.
*
* @param device_id Handle of device to Disconnect from.
@@ -235,22 +259,12 @@ class TransportManagerImpl
**/
int RemoveDevice(const DeviceHandle device) OVERRIDE;
- /**
- * @brief Turns on or off visibility of SDL to mobile devices
- * when visibility is ON (on_off = true) mobile devices are able to connect
- * otherwise ((on_off = false)) SDL is not visible from outside
- *
- * @return Code error.
- */
- int Visibility(const bool& on_off) const OVERRIDE;
+ int PerformActionOnClients(
+ const TransportAction required_action) const OVERRIDE;
- /**
- * DEPRECATED
- * Must be moved under 'private' section
- * @brief Updates total device list with info from specific transport adapter.
- * @param ta Transport adapter
- */
- void UpdateDeviceList(TransportAdapter* ta);
+ void CreateWebEngineDevice() OVERRIDE;
+
+ const DeviceInfo& GetWebEngineDeviceInfo() const OVERRIDE;
/**
* @brief OnDeviceListUpdated updates device list and sends appropriate
@@ -320,9 +334,9 @@ class TransportManagerImpl
private:
/**
- * @brief Structure that contains conversion functions (Device ID -> Device
- * Handle; Device Handle -> Device ID)
- */
+ * @brief Structure that contains conversion functions (Device ID -> Device
+ * Handle; Device Handle -> Device ID)
+ */
struct Handle2GUIDConverter {
/**
* @brief ConversionTable Records uid/connection type/handle
@@ -373,7 +387,7 @@ class TransportManagerImpl
* @brief Converter variable (Device ID -> Device Handle; Device Handle ->
* Device ID)
*/
- Handle2GUIDConverter converter_;
+ mutable Handle2GUIDConverter converter_;
#ifdef BUILD_TESTS
public:
@@ -388,7 +402,7 @@ class TransportManagerImpl
int connection_id_counter_;
sync_primitives::RWLock connections_lock_;
std::vector<ConnectionInternal> connections_;
- sync_primitives::RWLock device_to_adapter_map_lock_;
+ mutable sync_primitives::RWLock device_to_adapter_map_lock_;
typedef std::map<DeviceUID, TransportAdapter*> DeviceToAdapterMap;
DeviceToAdapterMap device_to_adapter_map_;
std::vector<TransportAdapter*> transport_adapters_;
@@ -407,6 +421,12 @@ class TransportManagerImpl
sync_primitives::Lock device_lock_;
DeviceUID device_to_reconnect_;
+ std::atomic_bool events_processing_is_active_;
+ sync_primitives::Lock events_processing_lock_;
+ sync_primitives::ConditionalVariable events_processing_cond_var_;
+
+ DeviceInfo web_engine_device_info_;
+
/**
* @brief Adds new incoming connection to connections list
* @param c New connection
@@ -414,18 +434,18 @@ class TransportManagerImpl
void AddConnection(const ConnectionInternal& c);
/**
- * @brief Removes connection from connections list
- * @param id Identifier of connection to be removed
- * @param transport_adapter Pointer to transport adapter
- * that holds connection
- */
+ * @brief Removes connection from connections list
+ * @param id Identifier of connection to be removed
+ * @param transport_adapter Pointer to transport adapter
+ * that holds connection
+ */
void RemoveConnection(const uint32_t id,
transport_adapter::TransportAdapter* transport_adapter);
/**
- * @brief Deactivates all connections related to certain device
- * @param device_uid Device unique identifier
- */
+ * @brief Deactivates all connections related to certain device
+ * @param device_uid Device unique identifier
+ */
void DeactivateDeviceConnections(const DeviceUID& device_uid);
/**
* @brief Returns connection from connections list by connection identifier
@@ -445,14 +465,14 @@ class TransportManagerImpl
const ApplicationHandle& application);
/**
- * @brief Returns active connection from connections list by device unique
+ * @brief Returns active connection from connections list by device unique
* id
- * and application handle
- * (this method returns only active connections as opposed to previous one)
- * @param device Device unique identifier
- * @param application Application handle
- * @return Pointer to connection or NULL if connection could not be found
- */
+ * and application handle
+ * (this method returns only active connections as opposed to previous one)
+ * @param device Device unique identifier
+ * @param application Application handle
+ * @return Pointer to connection or NULL if connection could not be found
+ */
ConnectionInternal* GetActiveConnection(const DeviceUID& device,
const ApplicationHandle& application);
@@ -501,6 +521,13 @@ class TransportManagerImpl
* @return True if mapping has been updated, otherwise - false
*/
bool UpdateDeviceMapping(TransportAdapter* ta);
+
+ /**
+ * @brief Updates total device list with info from specific transport adapter.
+ * @param ta Transport adapter
+ * @return True if device list has been changed, otherwise - false
+ */
+ bool UpdateDeviceList(TransportAdapter* ta);
}; // class TransportManagerImpl
} // namespace transport_manager
#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_IMPL_H_
diff --git a/src/components/transport_manager/include/transport_manager/usb/common.h b/src/components/transport_manager/include/transport_manager/usb/common.h
index 1c6011dbb2..d15e1fdd96 100644
--- a/src/components/transport_manager/include/transport_manager/usb/common.h
+++ b/src/components/transport_manager/include/transport_manager/usb/common.h
@@ -35,8 +35,6 @@
#include <stdint.h>
-#include "utils/shared_ptr.h"
-
#if defined(__QNXNTO__)
#include "transport_manager/usb/qnx/usb_handler.h"
#else
@@ -64,7 +62,7 @@ static const uint16_t kApplePid8 = 0x12a8; // iPhone 5
static const int kUsbConfiguration = 1;
-typedef utils::SharedPtr<UsbHandler> UsbHandlerSptr;
+typedef std::shared_ptr<UsbHandler> UsbHandlerSptr;
class UsbDeviceListener {
public:
@@ -112,7 +110,7 @@ inline bool IsAppleDevice(const PlatformUsbDevice* device) {
return IsAppleIAPDevice(device) || IsAppleIAP2Device(device);
}
-} // namespace
-} // namespace
+} // namespace transport_adapter
+} // namespace transport_manager
#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_USB_COMMON_H_
diff --git a/src/components/transport_manager/include/transport_manager/usb/libusb/platform_usb_device.h b/src/components/transport_manager/include/transport_manager/usb/libusb/platform_usb_device.h
index baec1938b1..201f3787e0 100644
--- a/src/components/transport_manager/include/transport_manager/usb/libusb/platform_usb_device.h
+++ b/src/components/transport_manager/include/transport_manager/usb/libusb/platform_usb_device.h
@@ -36,8 +36,8 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_USB_LIBUSB_PLATFORM_USB_DEVICE_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_USB_LIBUSB_PLATFORM_USB_DEVICE_H_
-#include <string>
#include <libusb-1.0/libusb.h>
+#include <string>
namespace transport_manager {
diff --git a/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h b/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h
index 5f6bd40957..0fb9c599c7 100644
--- a/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h
+++ b/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h
@@ -37,8 +37,8 @@
#include "utils/lock.h"
-#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "transport_manager/transport_adapter/connection.h"
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "transport_manager/usb/common.h"
namespace transport_manager {
@@ -60,9 +60,9 @@ class UsbConnection : public Connection {
virtual TransportAdapter::Error Disconnect();
private:
- void PopOutMessage();
+ TransportAdapter::Error PopOutMessage();
bool PostInTransfer();
- bool PostOutTransfer();
+ TransportAdapter::Error PostOutTransfer();
void OnInTransfer(struct libusb_transfer*);
void OnOutTransfer(struct libusb_transfer*);
void Finalise();
diff --git a/src/components/transport_manager/include/transport_manager/usb/libusb/usb_handler.h b/src/components/transport_manager/include/transport_manager/usb/libusb/usb_handler.h
index bed631ea2e..9c16b49df6 100644
--- a/src/components/transport_manager/include/transport_manager/usb/libusb/usb_handler.h
+++ b/src/components/transport_manager/include/transport_manager/usb/libusb/usb_handler.h
@@ -39,8 +39,8 @@
#include <libusb-1.0/libusb.h>
#include "transport_manager/transport_adapter/transport_adapter.h"
-#include "transport_manager/usb/usb_control_transfer.h"
#include "transport_manager/usb/libusb/platform_usb_device.h"
+#include "transport_manager/usb/usb_control_transfer.h"
#include "utils/threads/thread.h"
@@ -76,6 +76,7 @@ class UsbHandler {
public:
explicit UsbHandlerDelegate(UsbHandler* handler);
void threadMain() OVERRIDE;
+ void exitThreadMain() OVERRIDE;
private:
UsbHandler* handler_;
diff --git a/src/components/transport_manager/include/transport_manager/usb/qnx/platform_usb_device.h b/src/components/transport_manager/include/transport_manager/usb/qnx/platform_usb_device.h
index 9755a5eacd..738675754d 100644
--- a/src/components/transport_manager/include/transport_manager/usb/qnx/platform_usb_device.h
+++ b/src/components/transport_manager/include/transport_manager/usb/qnx/platform_usb_device.h
@@ -36,8 +36,8 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_USB_QNX_PLATFORM_USB_DEVICE_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_USB_QNX_PLATFORM_USB_DEVICE_H_
-#include <string>
#include <sys/usbdi.h>
+#include <string>
namespace transport_manager {
diff --git a/src/components/transport_manager/include/transport_manager/usb/qnx/usb_connection.h b/src/components/transport_manager/include/transport_manager/usb/qnx/usb_connection.h
index e9f7344ee2..ba7e263b4c 100644
--- a/src/components/transport_manager/include/transport_manager/usb/qnx/usb_connection.h
+++ b/src/components/transport_manager/include/transport_manager/usb/qnx/usb_connection.h
@@ -38,8 +38,8 @@
#include "utils/lock.h"
-#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "transport_manager/transport_adapter/connection.h"
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "transport_manager/usb/common.h"
namespace transport_manager {
diff --git a/src/components/transport_manager/include/transport_manager/usb/qnx/usb_handler.h b/src/components/transport_manager/include/transport_manager/usb/qnx/usb_handler.h
index c33e0f2361..53600309ec 100644
--- a/src/components/transport_manager/include/transport_manager/usb/qnx/usb_handler.h
+++ b/src/components/transport_manager/include/transport_manager/usb/qnx/usb_handler.h
@@ -39,8 +39,8 @@
#include <sys/usbdi.h>
#include "transport_manager/transport_adapter/transport_adapter.h"
-#include "transport_manager/usb/usb_control_transfer.h"
#include "transport_manager/usb/qnx/platform_usb_device.h"
+#include "transport_manager/usb/usb_control_transfer.h"
namespace transport_manager {
diff --git a/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h b/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h
index ee7039efde..45c6d4c0e4 100644
--- a/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h
+++ b/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h
@@ -44,8 +44,13 @@ namespace transport_adapter {
class UsbAoaAdapter : public TransportAdapterImpl {
public:
- UsbAoaAdapter(resumption::LastState& last_state,
+ UsbAoaAdapter(resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings);
+
+ DEPRECATED
+ UsbAoaAdapter(resumption::LastState&,
+ const TransportManagerSettings& settings) = delete;
+
virtual ~UsbAoaAdapter();
protected:
diff --git a/src/components/transport_manager/include/transport_manager/usb/usb_control_transfer.h b/src/components/transport_manager/include/transport_manager/usb/usb_control_transfer.h
index 850902bea3..a47574353e 100644
--- a/src/components/transport_manager/include/transport_manager/usb/usb_control_transfer.h
+++ b/src/components/transport_manager/include/transport_manager/usb/usb_control_transfer.h
@@ -100,7 +100,7 @@ class UsbControlTransferSequence {
Transfers transfers_;
};
-} // namespace
-} // namespace
+} // namespace transport_adapter
+} // namespace transport_manager
#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_USB_USB_CONTROL_TRANSFER_H_
diff --git a/src/components/transport_manager/include/transport_manager/usb/usb_device.h b/src/components/transport_manager/include/transport_manager/usb/usb_device.h
index 8ca1a32a28..ea31bb0376 100644
--- a/src/components/transport_manager/include/transport_manager/usb/usb_device.h
+++ b/src/components/transport_manager/include/transport_manager/usb/usb_device.h
@@ -54,9 +54,9 @@ class UsbDevice : public Device {
return usb_device_;
}
- protected:
virtual ~UsbDevice() {}
+ protected:
virtual bool IsSameAs(const Device* other_device) const {
return unique_device_id() == other_device->unique_device_id();
}
diff --git a/src/components/transport_manager/include/transport_manager/usb/usb_device_scanner.h b/src/components/transport_manager/include/transport_manager/usb/usb_device_scanner.h
index a6065de2b2..9d99b1b548 100644
--- a/src/components/transport_manager/include/transport_manager/usb/usb_device_scanner.h
+++ b/src/components/transport_manager/include/transport_manager/usb/usb_device_scanner.h
@@ -38,9 +38,9 @@
#include <list>
-#include "utils/lock.h"
#include "transport_manager/transport_adapter/device_scanner.h"
#include "transport_manager/usb/common.h"
+#include "utils/lock.h"
namespace transport_manager {
@@ -48,7 +48,8 @@ namespace transport_adapter {
class UsbDeviceScanner : public DeviceScanner, public UsbDeviceListener {
public:
- UsbDeviceScanner(class TransportAdapterController* controller);
+ UsbDeviceScanner(class TransportAdapterController* controller,
+ const TransportManagerSettings& settings);
virtual ~UsbDeviceScanner();
protected:
@@ -65,13 +66,14 @@ class UsbDeviceScanner : public DeviceScanner, public UsbDeviceListener {
void SupportedDeviceFound(PlatformUsbDevice* device);
TransportAdapterController* controller_;
+ const TransportManagerSettings& settings_;
typedef std::list<PlatformUsbDevice*> Devices;
Devices devices_;
sync_primitives::Lock devices_mutex_;
};
-} // namespace
-} // namespace
+} // namespace transport_adapter
+} // namespace transport_manager
#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_USB_USB_DEVICE_SCANNER_H_
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_connection.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_connection.h
new file mode 100644
index 0000000000..fb904d645e
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_connection.h
@@ -0,0 +1,126 @@
+/*
+Copyright (c) 2020 Livio, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of SmartDeviceLink Consortium, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_CONNECTION_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_CONNECTION_H_
+
+#include <memory>
+#include <queue>
+#include "transport_manager/transport_adapter/connection.h"
+#include "utils/message_queue.h"
+#include "utils/threads/thread.h"
+
+#ifdef ENABLE_SECURITY
+#include "transport_manager/websocket_server/websocket_secure_session.h"
+#else
+#include "transport_manager/websocket_server/websocket_session.h"
+#endif // ENABLE_SECURITY
+
+namespace transport_manager {
+namespace transport_adapter {
+
+using ::utils::MessageQueue;
+
+typedef ::protocol_handler::RawMessagePtr Message;
+typedef std::queue<Message> AsyncQueue;
+
+class TransportAdapterController;
+
+template <typename Session = WebSocketSession<> >
+class WebSocketConnection
+ : public std::enable_shared_from_this<WebSocketConnection<Session> >,
+ public Connection {
+ public:
+ WebSocketConnection(const DeviceUID& device_uid,
+ const ApplicationHandle& app_handle,
+ boost::asio::ip::tcp::socket socket,
+ TransportAdapterController* controller);
+
+#ifdef ENABLE_SECURITY
+ WebSocketConnection(const DeviceUID& device_uid,
+ const ApplicationHandle& app_handle,
+ boost::asio::ip::tcp::socket socket,
+ ssl::context& ctx,
+ TransportAdapterController* controller);
+#endif // ENABLE_SECURITY
+
+ ~WebSocketConnection();
+
+ TransportAdapter::Error Disconnect() OVERRIDE;
+
+ TransportAdapter::Error SendData(
+ protocol_handler::RawMessagePtr message) OVERRIDE;
+
+ void DataReceive(protocol_handler::RawMessagePtr frame);
+ void Run();
+ bool IsShuttingDown();
+
+ protected:
+ void Shutdown();
+ void OnError();
+
+ private:
+ const DeviceUID device_uid_;
+ const ApplicationHandle app_handle_;
+ std::shared_ptr<Session> session_;
+ TransportAdapterController* controller_;
+
+ std::atomic_bool shutdown_;
+
+ MessageQueue<Message, AsyncQueue> message_queue_;
+
+ class LoopThreadDelegate : public threads::ThreadDelegate {
+ public:
+ LoopThreadDelegate(MessageQueue<Message, AsyncQueue>* message_queue,
+ DataWriteCallback data_write,
+ OnIOErrorCallback on_io_error);
+
+ virtual void threadMain() OVERRIDE;
+ virtual void exitThreadMain() OVERRIDE;
+
+ void OnWrite();
+
+ void SetShutdown();
+
+ private:
+ void DrainQueue();
+ MessageQueue<Message, AsyncQueue>& message_queue_;
+ DataWriteCallback data_write_;
+ OnIOErrorCallback on_io_error_;
+ };
+
+ LoopThreadDelegate* thread_delegate_;
+ threads::Thread* thread_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_CONNECTION_H_
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_device.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_device.h
new file mode 100644
index 0000000000..10c6e54424
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_device.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2020, Livio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file websocket_device.h
+ * \brief WebSocketDevice class header file.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_DEVICE_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_DEVICE_H_
+
+#include <boost/beast/websocket.hpp>
+#include <string>
+#include "transport_manager/transport_adapter/device.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
+using protocol_type = boost::asio::basic_stream_socket<tcp>::protocol_type;
+
+class WebSocketDevice : public Device {
+ public:
+ WebSocketDevice(const std::string& name, const DeviceUID& unique_device_id);
+
+ virtual const std::string& GetHost() const;
+ virtual const std::string& GetPort() const;
+ virtual const std::string GetTarget() const;
+ virtual void AddApplication(const ApplicationHandle& app_handle);
+
+ protected:
+ bool IsSameAs(const Device* other_device) const OVERRIDE;
+ ApplicationList GetApplicationList() const OVERRIDE;
+
+ private:
+ std::string host_;
+ std::string port_;
+ bool is_secure_connect_;
+ protocol_type protocol_;
+ ApplicationList app_list_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_DEVICE_H_
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_listener.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_listener.h
new file mode 100644
index 0000000000..3a0131f087
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_listener.h
@@ -0,0 +1,120 @@
+/*
+ * \file websocket_listener.h
+ * \brief WebSocketListener class header file.
+ *
+ * Copyright (c) 2020
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_LISTENER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_LISTENER_H_
+
+#include <boost/asio/thread_pool.hpp>
+#include <memory>
+#include <vector>
+#include "transport_manager/transport_adapter/client_connection_listener.h"
+#include "transport_manager/transport_manager_settings.h"
+#include "transport_manager/websocket_server/websocket_connection.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+class TransportAdapterController;
+
+/**
+ * @brief Class responsible for communication over websockets.
+ */
+class WebSocketListener : public ClientConnectionListener {
+ public:
+ /**
+ * @brief Constructor.
+ * @param controller Pointer to the device adapter controller.
+ * @param number of threads for listen incoming connections
+ */
+ WebSocketListener(TransportAdapterController* controller,
+ const TransportManagerSettings& settings,
+ const int num_threads = 1);
+
+ /**
+ * @brief Destructor.
+ */
+ ~WebSocketListener();
+
+ TransportAdapter::Error Init() OVERRIDE;
+ void Terminate() OVERRIDE;
+ bool IsInitialised() const OVERRIDE {
+ return true;
+ }
+ TransportAdapter::Error StartListening() OVERRIDE;
+ TransportAdapter::Error StopListening() OVERRIDE {
+ return TransportAdapter::OK;
+ }
+ TransportAdapter::Error SuspendListening() OVERRIDE {
+ return TransportAdapter::OK;
+ }
+ TransportAdapter::Error ResumeListening() OVERRIDE {
+ return TransportAdapter::OK;
+ }
+
+ protected:
+#ifdef ENABLE_SECURITY
+ TransportAdapter::Error AddCertificateAuthority();
+#endif
+ bool Run();
+ bool WaitForConnection();
+ void StartSession(boost::system::error_code ec);
+ void Shutdown();
+
+ template <typename Connection>
+ void ProcessConnection(std::shared_ptr<Connection> connection,
+ const DeviceSptr,
+ const ApplicationHandle);
+
+ private:
+ TransportAdapterController* controller_;
+ boost::asio::io_context ioc_;
+#ifdef ENABLE_SECURITY
+ ssl::context ctx_;
+ bool start_secure_;
+#endif // ENABLE_SECURITY
+ tcp::acceptor acceptor_;
+ tcp::socket socket_;
+ std::unique_ptr<boost::asio::thread_pool> io_pool_;
+ const int num_threads_;
+ std::atomic_bool shutdown_;
+ std::vector<std::shared_ptr<Connection> > connection_list_;
+ sync_primitives::Lock connection_list_lock;
+ const TransportManagerSettings& settings_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_LISTENER_H_
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h
new file mode 100644
index 0000000000..a3ead8e5a5
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_secure_session.h
@@ -0,0 +1,64 @@
+/*
+Copyright (c) 2020 Livio, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of SmartDeviceLink Consortium, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SECURE_SESSION_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SECURE_SESSION_H_
+
+#include <memory>
+#include "transport_manager/websocket_server/websocket_session.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+CREATE_LOGGERPTR_GLOBAL(wss_logger_, "WebSocketSecureSession")
+
+template <typename ExecutorType = ssl::stream<tcp::socket&> >
+class WebSocketSecureSession : public WebSocketSession<ExecutorType> {
+ public:
+ WebSocketSecureSession(tcp::socket,
+ ssl::context& ctx,
+ DataReceiveCallback data_receive,
+ OnIOErrorCallback on_errror);
+
+ void AsyncAccept() OVERRIDE;
+ virtual void AsyncHandshake(boost::system::error_code ec);
+
+ std::shared_ptr<WebSocketSecureSession<ExecutorType> > shared_from_this() {
+ auto base_ptr =
+ static_cast<WebSocketSession<ExecutorType>*>(this)->shared_from_this();
+ return std::static_pointer_cast<WebSocketSecureSession<ExecutorType> >(
+ base_ptr);
+ }
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SECURE_SESSION_H_
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_server_transport_adapter.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_server_transport_adapter.h
new file mode 100644
index 0000000000..23122b2e98
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_server_transport_adapter.h
@@ -0,0 +1,136 @@
+/*
+ * \file websocket_transport_adapter.h
+ * \brief WebSocketTransportAdapter class header file.
+ *
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SERVER_TRANSPORT_ADAPTER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SERVER_TRANSPORT_ADAPTER_H_
+
+#include <string>
+#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+/**
+ * @brief Transport adapter that uses WebSocket transport.
+ */
+class WebSocketServerTransportAdapter : public TransportAdapterImpl {
+ public:
+ /**
+ * @brief Constructor.
+ */
+ WebSocketServerTransportAdapter(
+ resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings);
+
+ /**
+ * @brief Destructor.
+ */
+ virtual ~WebSocketServerTransportAdapter();
+
+ /**
+ * @brief Websocket server transport adapter
+ * specific Init() method
+ * @note Perform additional actions required by WS transport adapter
+ * then calls basic class Init()
+ */
+ TransportAdapter::Error Init() OVERRIDE;
+
+ /**
+ * @brief Adds webengine device to internal storage
+ * of related WebSocket transport adapter
+ * @param device webengine device to add
+ * @note webengine device storage required
+ * to be used in Low Voltage conditions
+ */
+ DeviceSptr AddDevice(DeviceSptr device) OVERRIDE;
+
+ /**
+ * @brief Notification that transport's configuration is updated
+ *
+ * @param new_config The new configuration of the transport
+ */
+ void TransportConfigUpdated(const TransportConfig& new_config) OVERRIDE;
+
+ /**
+ * @brief Returns the transport's configuration information
+ */
+ virtual TransportConfig GetTransportConfiguration() const OVERRIDE;
+
+ /**
+ * @brief Store adapter state in last state
+ */
+ void Store() const OVERRIDE;
+
+ /**
+ * @brief Restore adapter state from last state
+ * @return True on success false otherwise
+ */
+ bool Restore() OVERRIDE;
+
+ /**
+ * @brief Get stored device ID
+ * @return stored unique device id, or empty string if no stored device id
+ * present in last saved state
+ */
+ std::string GetStoredDeviceID() const;
+
+ protected:
+ /**
+ * @brief Return type of device.
+ *
+ * @return String with device type.
+ */
+ DeviceType GetDeviceType() const OVERRIDE;
+
+ private:
+ /**
+ * @brief Keeps transport specific configuration
+ *
+ * TCP transport uses following information:
+ * - "enabled": whether the transport is currently enabled or not. Value can
+ * be "true" or "false".
+ * - "tcp_ip_address": string representation of IP address (either IPv4 or
+ * IPv6)
+ * - "tcp_port": string representation of TCP port number (e.g. "12345")
+ */
+ TransportConfig transport_config_;
+ DeviceSptr webengine_device_;
+ std::string webengine_device_id_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SERVER_TRANSPORT_ADAPTER_H_
diff --git a/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h
new file mode 100644
index 0000000000..a8dadc9831
--- /dev/null
+++ b/src/components/transport_manager/include/transport_manager/websocket_server/websocket_session.h
@@ -0,0 +1,107 @@
+/*
+Copyright (c) 2020 Livio, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of SmartDeviceLink Consortium, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SESSION_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SESSION_H_
+
+#include <boost/asio/bind_executor.hpp>
+#include <boost/asio/strand.hpp>
+#include <boost/beast/core.hpp>
+#include <boost/beast/websocket.hpp>
+#include "protocol/raw_message.h"
+#include "transport_manager/transport_adapter/transport_adapter.h"
+#include "utils/logger.h"
+
+#ifdef ENABLE_SECURITY
+#include <boost/beast/websocket/ssl.hpp>
+#endif // ENABLE_SECURITY
+
+namespace transport_manager {
+namespace transport_adapter {
+
+using DataReceiveCallback =
+ std::function<void(protocol_handler::RawMessagePtr)>;
+using DataWriteCallback = std::function<TransportAdapter::Error(
+ protocol_handler::RawMessagePtr message)>;
+using OnIOErrorCallback = std::function<void()>;
+
+using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
+namespace websocket =
+ boost::beast::websocket; // from <boost/beast/websocket.hpp>
+#ifdef ENABLE_SECURITY
+namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
+#endif // ENABLE_SECURITY
+
+CREATE_LOGGERPTR_GLOBAL(ws_logger_, "WebSocketSession")
+
+class TransportAdapterController;
+
+template <typename ExecutorType = tcp::socket&>
+class WebSocketSession
+ : public std::enable_shared_from_this<WebSocketSession<ExecutorType> > {
+ public:
+ WebSocketSession(boost::asio::ip::tcp::socket socket,
+ DataReceiveCallback data_receive,
+ OnIOErrorCallback on_error);
+
+#ifdef ENABLE_SECURITY
+ WebSocketSession(boost::asio::ip::tcp::socket socket,
+ ssl::context& ctx,
+ DataReceiveCallback data_receive,
+ OnIOErrorCallback on_error);
+#endif // ENABLE_SECURITY
+
+ virtual ~WebSocketSession();
+
+ virtual void AsyncAccept();
+
+ virtual void AsyncRead(boost::system::error_code ec);
+
+ virtual TransportAdapter::Error WriteDown(
+ ::protocol_handler::RawMessagePtr message);
+
+ virtual void Read(boost::system::error_code ec,
+ std::size_t bytes_transferred);
+
+ virtual bool Shutdown();
+
+ protected:
+ tcp::socket socket_;
+ websocket::stream<ExecutorType> ws_;
+ boost::asio::strand<boost::asio::io_context::executor_type> strand_;
+ boost::beast::flat_buffer buffer_;
+ DataReceiveCallback data_receive_;
+ OnIOErrorCallback on_io_error_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SESSION_H_
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc b/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc
index 0d8a77c88f..19f4078443 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc
@@ -33,11 +33,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "transport_manager/bluetooth/bluetooth_connection_factory.h"
#include "transport_manager/bluetooth/bluetooth_socket_connection.h"
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "utils/logger.h"
-#include "utils/make_shared.h"
namespace transport_manager {
namespace transport_adapter {
@@ -55,8 +54,8 @@ TransportAdapter::Error BluetoothConnectionFactory::Init() {
TransportAdapter::Error BluetoothConnectionFactory::CreateConnection(
const DeviceUID& device_uid, const ApplicationHandle& app_handle) {
LOG4CXX_AUTO_TRACE(logger_);
- utils::SharedPtr<BluetoothSocketConnection> connection =
- utils::MakeShared<BluetoothSocketConnection>(
+ std::shared_ptr<BluetoothSocketConnection> connection =
+ std::make_shared<BluetoothSocketConnection>(
device_uid, app_handle, controller_);
controller_->ConnectionCreated(connection, device_uid, app_handle);
TransportAdapter::Error error = connection->Start();
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device.cc
index 038515170d..734d8fe1e9 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_device.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_device.cc
@@ -36,15 +36,16 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
+#include <bluetooth/rfcomm.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
-#include <bluetooth/rfcomm.h>
#include <errno.h>
-#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/types.h>
#include <algorithm>
+#include <iostream>
#include <limits>
#include "utils/logger.h"
@@ -56,7 +57,8 @@ bool BluetoothDevice::GetRfcommChannel(const ApplicationHandle app_handle,
uint8_t* channel_out) {
LOG4CXX_TRACE(logger_,
"enter. app_handle: " << app_handle
- << ", channel_out: " << channel_out);
+ << ", channel_out: " << std::hex
+ << reinterpret_cast<void*>(channel_out));
if (app_handle < 0 || app_handle > std::numeric_limits<uint8_t>::max()) {
LOG4CXX_TRACE(logger_,
"exit with FALSE. Condition: app_handle < 0 || app_handle > "
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
index 743c95f2e6..4759b2003a 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc
@@ -38,18 +38,18 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
+#include <bluetooth/rfcomm.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
-#include <bluetooth/rfcomm.h>
#include <errno.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
+#include <sys/types.h>
#include <unistd.h>
-#include <vector>
#include <sstream>
-#include "transport_manager/bluetooth/bluetooth_transport_adapter.h"
+#include <vector>
#include "transport_manager/bluetooth/bluetooth_device.h"
+#include "transport_manager/bluetooth/bluetooth_transport_adapter.h"
#include "utils/logger.h"
#include "utils/threads/thread.h"
@@ -133,7 +133,27 @@ BluetoothDeviceScanner::BluetoothDeviceScanner(
0xA8};
sdp_uuid128_create(&smart_device_link_service_uuid_,
smart_device_link_service_uuid_data);
- thread_ = threads::CreateThread("BT Device Scaner",
+ thread_ = threads::CreateThread("BT Device Scanner",
+ new BluetoothDeviceScannerDelegate(this));
+}
+
+BluetoothDeviceScanner::BluetoothDeviceScanner(
+ TransportAdapterController* controller,
+ bool auto_repeat_search,
+ int auto_repeat_pause_sec,
+ const uint8_t* smart_device_link_service_uuid_data)
+ : controller_(controller)
+ , thread_(NULL)
+ , shutdown_requested_(false)
+ , ready_(true)
+ , device_scan_requested_(false)
+ , device_scan_requested_lock_()
+ , device_scan_requested_cv_()
+ , auto_repeat_search_(auto_repeat_search)
+ , auto_repeat_pause_sec_(auto_repeat_pause_sec) {
+ sdp_uuid128_create(&smart_device_link_service_uuid_,
+ smart_device_link_service_uuid_data);
+ thread_ = threads::CreateThread("BT Device Scanner",
new BluetoothDeviceScannerDelegate(this));
}
@@ -262,8 +282,8 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices(
deviceName[name_len - 1] = '\0';
}
- Device* bluetooth_device =
- new BluetoothDevice(bd_address, deviceName, sdl_rfcomm_channels[i]);
+ auto bluetooth_device = std::make_shared<BluetoothDevice>(
+ bd_address, deviceName, sdl_rfcomm_channels[i]);
if (bluetooth_device) {
LOG4CXX_INFO(logger_, "Bluetooth device created successfully");
discovered_devices->push_back(bluetooth_device);
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
index b4370e4b12..78597ac2ad 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_socket_connection.cc
@@ -33,13 +33,13 @@
#include "transport_manager/bluetooth/bluetooth_socket_connection.h"
-#include <unistd.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
+#include <bluetooth/rfcomm.h>
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
-#include <bluetooth/rfcomm.h>
+#include <unistd.h>
#include "transport_manager/bluetooth/bluetooth_device.h"
#include "transport_manager/transport_adapter/transport_adapter_controller.h"
@@ -93,9 +93,9 @@ bool BluetoothSocketConnection::Establish(ConnectError** error) {
do {
rfcomm_socket = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
if (-1 == rfcomm_socket) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_,
- "Failed to create RFCOMM socket for device "
- << device_handle());
+ LOG4CXX_ERROR_WITH_ERRNO(
+ logger_,
+ "Failed to create RFCOMM socket for device " << device_handle());
*error = new ConnectError();
LOG4CXX_TRACE(logger_, "exit with FALSE");
return false;
diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc
index 0f83f32c60..066751c474 100644
--- a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc
+++ b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc
@@ -34,18 +34,18 @@
*/
#include <errno.h>
-#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/types.h>
#include <unistd.h>
+#include <bluetooth/bluetooth.h>
#include <iomanip>
#include <set>
-#include <bluetooth/bluetooth.h>
-#include "transport_manager/bluetooth/bluetooth_transport_adapter.h"
-#include "transport_manager/bluetooth/bluetooth_device_scanner.h"
#include "transport_manager/bluetooth/bluetooth_connection_factory.h"
#include "transport_manager/bluetooth/bluetooth_device.h"
+#include "transport_manager/bluetooth/bluetooth_device_scanner.h"
+#include "transport_manager/bluetooth/bluetooth_transport_adapter.h"
#include "utils/logger.h"
@@ -57,12 +57,14 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
BluetoothTransportAdapter::~BluetoothTransportAdapter() {}
BluetoothTransportAdapter::BluetoothTransportAdapter(
- resumption::LastState& last_state, const TransportManagerSettings& settings)
- : TransportAdapterImpl(new BluetoothDeviceScanner(this, true, 0),
- new BluetoothConnectionFactory(this),
- NULL,
- last_state,
- settings) {}
+ resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings)
+ : TransportAdapterImpl(
+ new BluetoothDeviceScanner(this, true, 0, settings.bluetooth_uuid()),
+ new BluetoothConnectionFactory(this),
+ NULL,
+ last_state_wrapper,
+ settings) {}
DeviceType BluetoothTransportAdapter::GetDeviceType() const {
return BLUETOOTH;
@@ -80,8 +82,8 @@ void BluetoothTransportAdapter::Store() const {
if (!device) { // device could have been disconnected
continue;
}
- utils::SharedPtr<BluetoothDevice> bluetooth_device =
- DeviceSptr::static_pointer_cast<BluetoothDevice>(device);
+ std::shared_ptr<BluetoothDevice> bluetooth_device =
+ std::static_pointer_cast<BluetoothDevice>(device);
Json::Value device_dictionary;
device_dictionary["name"] = bluetooth_device->name();
char address[18];
@@ -111,23 +113,25 @@ void BluetoothTransportAdapter::Store() const {
}
}
bluetooth_adapter_dictionary["devices"] = devices_dictionary;
- Json::Value& dictionary = last_state().get_dictionary();
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
dictionary["TransportManager"]["BluetoothAdapter"] =
bluetooth_adapter_dictionary;
+ accessor.GetMutableData().set_dictionary(dictionary);
LOG4CXX_TRACE(logger_, "exit");
}
bool BluetoothTransportAdapter::Restore() {
LOG4CXX_TRACE(logger_, "enter");
bool errors_occured = false;
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
const Json::Value bluetooth_adapter_dictionary =
- last_state().get_dictionary()["TransportManager"]["BluetoothAdapter"];
+ dictionary["TransportManager"]["BluetoothAdapter"];
const Json::Value devices_dictionary =
bluetooth_adapter_dictionary["devices"];
- for (Json::Value::const_iterator i = devices_dictionary.begin();
- i != devices_dictionary.end();
- ++i) {
- const Json::Value device_dictionary = *i;
+ for (const auto& bt_device : devices_dictionary) {
+ const Json::Value device_dictionary = bt_device;
std::string name = device_dictionary["name"].asString();
std::string address_record = device_dictionary["address"].asString();
bdaddr_t address;
@@ -135,10 +139,8 @@ bool BluetoothTransportAdapter::Restore() {
RfcommChannelVector rfcomm_channels;
const Json::Value applications_dictionary =
device_dictionary["applications"];
- for (Json::Value::const_iterator j = applications_dictionary.begin();
- j != applications_dictionary.end();
- ++j) {
- const Json::Value application_dictionary = *j;
+ for (const auto& application : applications_dictionary) {
+ const Json::Value application_dictionary = application;
std::string rfcomm_channel_record =
application_dictionary["rfcomm_channel"].asString();
uint8_t rfcomm_channel =
@@ -149,11 +151,9 @@ bool BluetoothTransportAdapter::Restore() {
new BluetoothDevice(address, name.c_str(), rfcomm_channels);
DeviceSptr device(bluetooth_device);
AddDevice(device);
- for (RfcommChannelVector::const_iterator j = rfcomm_channels.begin();
- j != rfcomm_channels.end();
- ++j) {
+ for (const auto& channel : rfcomm_channels) {
ApplicationHandle app_handle =
- *j; // for Bluetooth device app_handle is just RFCOMM channel
+ channel; // for Bluetooth device app_handle is just RFCOMM channel
if (Error::OK != Connect(device->unique_device_id(), app_handle)) {
errors_occured = true;
}
diff --git a/src/components/transport_manager/src/cloud/cloud_device.cc b/src/components/transport_manager/src/cloud/cloud_device.cc
new file mode 100644
index 0000000000..9225589d57
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/cloud_device.cc
@@ -0,0 +1,97 @@
+/*
+ *
+ * Copyright (c) 2018, Livio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "transport_manager/cloud/cloud_device.h"
+
+#include "utils/logger.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+CloudDevice::CloudDevice(std::string& host,
+ std::string& port,
+ std::string& name)
+ : Device(name, std::string(name))
+ , endpoint_(CloudAppEndpoint{.host = host,
+ .port = port,
+ .path = "/",
+ .query = "",
+ .fragment = ""}) {}
+
+CloudDevice::CloudDevice(CloudAppEndpoint& endpoint, std::string& name)
+ : Device(name, std::string(name)), endpoint_(endpoint) {}
+
+bool CloudDevice::IsSameAs(const Device* other) const {
+ LOG4CXX_TRACE(logger_, "enter. device: " << other);
+
+ const CloudDevice* other_cloud_device =
+ dynamic_cast<const CloudDevice*>(other);
+
+ if (!other_cloud_device) {
+ return false;
+ }
+
+ if (GetHost() != other_cloud_device->GetHost()) {
+ return false;
+ }
+
+ if (GetPort() != other_cloud_device->GetPort()) {
+ return false;
+ }
+
+ if (GetTarget() != other_cloud_device->GetTarget()) {
+ return false;
+ }
+
+ return true;
+}
+
+ApplicationList CloudDevice::GetApplicationList() const {
+ return ApplicationList{0};
+}
+
+const std::string& CloudDevice::GetHost() const {
+ return endpoint_.host;
+}
+
+const std::string& CloudDevice::GetPort() const {
+ return endpoint_.port;
+}
+
+const std::string CloudDevice::GetTarget() const {
+ return endpoint_.path + endpoint_.query + endpoint_.fragment;
+}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc b/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc
new file mode 100644
index 0000000000..d072685eef
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/cloud_websocket_connection_factory.cc
@@ -0,0 +1,85 @@
+/*
+ * \file cloud_websocket_connection_factory.cc
+ * \brief CloudWebsocketConnectionFactory class source file.
+ *
+ * Copyright (c) 2018, Livio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "transport_manager/cloud/cloud_websocket_connection_factory.h"
+#include "transport_manager/cloud/websocket_client_connection.h"
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
+#include "utils/logger.h"
+
+#include "transport_manager/cloud/cloud_device.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+CloudWebsocketConnectionFactory::CloudWebsocketConnectionFactory(
+ TransportAdapterController* controller)
+ : controller_(controller) {}
+
+TransportAdapter::Error CloudWebsocketConnectionFactory::Init() {
+ return TransportAdapter::OK;
+}
+
+TransportAdapter::Error CloudWebsocketConnectionFactory::CreateConnection(
+ const DeviceUID& device_uid, const ApplicationHandle& app_handle) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto connection = controller_->FindPendingConnection(device_uid, app_handle);
+
+ std::shared_ptr<WebsocketClientConnection> ws_connection =
+ std::dynamic_pointer_cast<WebsocketClientConnection>(connection);
+ if (ws_connection.use_count() == 0) {
+ return TransportAdapter::Error::BAD_PARAM;
+ }
+
+ TransportAdapter::Error error = ws_connection->Start();
+ if (TransportAdapter::OK != error) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Cloud Websocket connection::Start() failed with error: " << error);
+ }
+ return error;
+}
+
+void CloudWebsocketConnectionFactory::Terminate() {}
+
+bool CloudWebsocketConnectionFactory::IsInitialised() const {
+ return true;
+}
+
+CloudWebsocketConnectionFactory::~CloudWebsocketConnectionFactory() {}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
new file mode 100644
index 0000000000..2d1de703b1
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2018, Livio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
+#include "transport_manager/cloud/cloud_websocket_connection_factory.h"
+
+#include "transport_manager/cloud/cloud_device.h"
+#include "transport_manager/cloud/websocket_client_connection.h"
+
+#include <boost/regex.hpp>
+
+namespace transport_manager {
+namespace transport_adapter {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+CloudWebsocketTransportAdapter::CloudWebsocketTransportAdapter(
+ resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings)
+ : TransportAdapterImpl(NULL,
+ new CloudWebsocketConnectionFactory(this),
+ NULL,
+ last_state_wrapper,
+ settings) {}
+
+CloudWebsocketTransportAdapter::~CloudWebsocketTransportAdapter() {}
+
+void CloudWebsocketTransportAdapter::SetAppCloudTransportConfig(
+ std::string app_id, CloudAppProperties properties) {
+ transport_config_[app_id] = properties;
+}
+
+const CloudAppProperties&
+CloudWebsocketTransportAdapter::GetAppCloudTransportConfig(std::string app_id) {
+ return transport_config_[app_id];
+}
+
+DeviceType CloudWebsocketTransportAdapter::GetDeviceType() const {
+ return CLOUD_WEBSOCKET;
+}
+
+void CloudWebsocketTransportAdapter::Store() const {}
+
+bool CloudWebsocketTransportAdapter::Restore() {
+ return true;
+}
+
+void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) {
+ // If the device has already been created, just ignore the request
+ DeviceSptr device = FindDevice(uid);
+ if (device.use_count() != 0) {
+ return;
+ }
+
+ std::string protocol_pattern = "(wss?)";
+ std::string host_pattern =
+ "(([^?#%\\\\/@:\\s]{1,})\\:?([^?#%\\\\/@\\s]*)\\@?([^?#%\\\\/\\s]*))";
+ std::string port_pattern = "(\\d{2,5})";
+ // Optional parameters
+ std::string path_pattern = "((\\/[^\\/#?\\s]+)*)?\\/?";
+ std::string query_pattern = "(\\?[^=&#\\s]*=?[^#\\s]*&?)?";
+ std::string fragment_pattern = "(#[^\\s]*)?";
+
+ // Extract host and port from endpoint string
+ boost::regex group_pattern(protocol_pattern + ":\\/\\/" + host_pattern + ":" +
+ port_pattern + path_pattern + query_pattern +
+ fragment_pattern,
+ boost::regex::icase);
+ boost::smatch results;
+ std::string str = uid;
+
+ if (!boost::regex_search(str, results, group_pattern)) {
+ LOG4CXX_DEBUG(logger_, "Invalid Pattern: " << uid);
+ return;
+ }
+
+ LOG4CXX_DEBUG(logger_, "#Results: " << results.size());
+ std::string results_str;
+ for (size_t i = 0; i < results.size(); i++) {
+ results_str += " R[" + std::to_string(i) + "]:";
+ results_str +=
+ (results[i].length() != 0) ? results[i] : std::string("<EMPTY>");
+ }
+ LOG4CXX_DEBUG(logger_, "Results: " << results_str);
+
+ std::string device_id = uid;
+
+ CloudAppEndpoint endpoint{.host = results[2],
+ .port = results[6],
+ .path = results[7] + "/",
+ .query = results[9],
+ .fragment = results[10]};
+
+ LOG4CXX_DEBUG(logger_,
+ "Creating Cloud Device For Host: "
+ << endpoint.host << " at Port: " << endpoint.port
+ << " with Target: "
+ << (endpoint.path + endpoint.query + endpoint.fragment));
+
+ auto cloud_device = std::make_shared<CloudDevice>(endpoint, device_id);
+
+ DeviceVector devices{cloud_device};
+
+ SearchDeviceDone(devices);
+
+ // Create connection object, do not start until app is activated
+ std::shared_ptr<WebsocketClientConnection> connection =
+ std::make_shared<WebsocketClientConnection>(uid, 0, this);
+
+ ConnectionCreated(connection, uid, 0);
+ ConnectPending(uid, 0);
+
+ return;
+}
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/cloud/websocket_client_connection.cc b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
new file mode 100644
index 0000000000..794cf57208
--- /dev/null
+++ b/src/components/transport_manager/src/cloud/websocket_client_connection.cc
@@ -0,0 +1,358 @@
+/*
+ *
+ * Copyright (c) 2018, Livio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "transport_manager/cloud/websocket_client_connection.h"
+#include "transport_manager/cloud/cloud_device.h"
+
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
+
+#include "utils/logger.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+WebsocketClientConnection::WebsocketClientConnection(
+ const DeviceUID& device_uid,
+ const ApplicationHandle& app_handle,
+ TransportAdapterController* controller)
+ : controller_(controller)
+ , resolver_(ioc_)
+ , ws_(ioc_)
+#ifdef ENABLE_SECURITY
+ , ctx_(ssl::context::sslv23_client)
+ , wss_(ioc_, ctx_)
+#endif // ENABLE_SECURITY
+ , shutdown_(false)
+ , thread_delegate_(new LoopThreadDelegate(&message_queue_, this))
+ , write_thread_(threads::CreateThread("WS Async Send", thread_delegate_))
+ , device_uid_(device_uid)
+ , app_handle_(app_handle)
+ , io_pool_(1) {
+}
+
+WebsocketClientConnection::~WebsocketClientConnection() {
+ ioc_.stop();
+ io_pool_.join();
+}
+
+#ifdef ENABLE_SECURITY
+void WebsocketClientConnection::AddCertificateAuthority(
+ const std::string cert, boost::system::error_code& ec) {
+ ctx_.add_certificate_authority(boost::asio::buffer(cert.data(), cert.size()),
+ ec);
+ if (ec) {
+ return;
+ }
+
+ wss_.next_layer().set_verify_mode(ssl::verify_peer);
+}
+#endif // ENABLE_SECURITY
+
+TransportAdapter::Error WebsocketClientConnection::Start() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DeviceSptr device = controller_->FindDevice(device_uid_);
+ CloudDevice* cloud_device = static_cast<CloudDevice*>(device.get());
+ CloudWebsocketTransportAdapter* cloud_ta =
+ static_cast<CloudWebsocketTransportAdapter*>(controller_);
+ cloud_properties = cloud_ta->GetAppCloudTransportConfig(device_uid_);
+ auto const host = cloud_device->GetHost();
+ auto const port = cloud_device->GetPort();
+ boost::system::error_code ec;
+
+ LOG4CXX_DEBUG(logger_, "Cloud app endpoint: " << cloud_properties.endpoint);
+ LOG4CXX_DEBUG(logger_,
+ "Cloud app certificate: " << cloud_properties.certificate);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Cloud app authentication token: " << cloud_properties.auth_token);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Cloud app transport type: " << cloud_properties.cloud_transport_type);
+ LOG4CXX_DEBUG(logger_,
+ "Cloud app hybrid app preference: "
+ << cloud_properties.hybrid_app_preference);
+
+ auto const results = resolver_.resolve(host, port, ec);
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_, "Could not resolve host/port: " << str_err);
+ return TransportAdapter::FAIL;
+ }
+
+ // Make Connection to host IP Address over TCP
+ if (cloud_properties.cloud_transport_type == "WS") {
+ boost::asio::connect(ws_.next_layer(), results.begin(), results.end(), ec);
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ boost::asio::connect(
+ wss_.next_layer().next_layer(), results.begin(), results.end(), ec);
+ }
+#endif // ENABLE_SECURITY
+
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ "Could not connect to websocket: " << host << ":" << port);
+ LOG4CXX_ERROR(logger_, str_err);
+ return TransportAdapter::FAIL;
+ }
+
+#ifdef ENABLE_SECURITY
+ if (cloud_properties.cloud_transport_type == "WSS") {
+ AddCertificateAuthority(cloud_properties.certificate, ec);
+
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ "Failed to add certificate authority: "
+ << cloud_properties.certificate);
+ LOG4CXX_ERROR(logger_, str_err);
+ Shutdown();
+ return TransportAdapter::FAIL;
+ }
+
+ // Perform SSL Handshake
+ wss_.next_layer().handshake(ssl::stream_base::client, ec);
+
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ "Could not complete SSL Handshake failed with host/port: "
+ << host << ":" << port);
+ LOG4CXX_ERROR(logger_, str_err);
+ Shutdown();
+ return TransportAdapter::FAIL;
+ }
+ }
+#endif // ENABLE_SECURITY
+
+ // Perform websocket handshake
+ if (cloud_properties.cloud_transport_type == "WS") {
+ ws_.handshake(host, cloud_device->GetTarget(), ec);
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ wss_.handshake(host, cloud_device->GetTarget(), ec);
+ }
+#endif // ENABLE_SECURITY
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(
+ logger_,
+ "Could not complete handshake with host/port: " << host << ":" << port);
+ LOG4CXX_ERROR(logger_, str_err);
+ return TransportAdapter::FAIL;
+ }
+
+ // Set the binary message write option
+ if (cloud_properties.cloud_transport_type == "WS") {
+ ws_.binary(true);
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ wss_.binary(true);
+ }
+#endif // ENABLE_SECURITY
+ write_thread_->start(threads::ThreadOptions());
+ controller_->ConnectDone(device_uid_, app_handle_);
+
+ // Start async read
+ if (cloud_properties.cloud_transport_type == "WS") {
+ ws_.async_read(buffer_,
+ std::bind(&WebsocketClientConnection::OnRead,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2));
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ wss_.async_read(buffer_,
+ std::bind(&WebsocketClientConnection::OnRead,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2));
+ }
+#endif // ENABLE_SECURITY
+
+ boost::asio::post(io_pool_, [&]() { ioc_.run(); });
+
+ LOG4CXX_DEBUG(
+ logger_,
+ "Successfully started websocket connection @: " << host << ":" << port);
+ return TransportAdapter::OK;
+}
+
+void WebsocketClientConnection::Recv(boost::system::error_code ec) {
+ if (shutdown_) {
+ return;
+ }
+
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_, str_err);
+ Shutdown();
+ return;
+ }
+ if (cloud_properties.cloud_transport_type == "WS") {
+ ws_.async_read(buffer_,
+ std::bind(&WebsocketClientConnection::OnRead,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2));
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ wss_.async_read(buffer_,
+ std::bind(&WebsocketClientConnection::OnRead,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2));
+ }
+#endif // ENABLE_SECURITY
+}
+
+void WebsocketClientConnection::OnRead(boost::system::error_code ec,
+ std::size_t bytes_transferred) {
+ boost::ignore_unused(bytes_transferred);
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(logger_, str_err);
+ ws_.lowest_layer().close();
+ ioc_.stop();
+ Shutdown();
+ return;
+ }
+ std::string data_str = boost::beast::buffers_to_string(buffer_.data());
+
+ ssize_t size = (ssize_t)buffer_.size();
+ const uint8_t* data = boost::asio::buffer_cast<const uint8_t*>(
+ boost::beast::buffers_front(buffer_.data()));
+
+ ::protocol_handler::RawMessagePtr frame(
+ new protocol_handler::RawMessage(0, 0, data, size, false));
+
+ controller_->DataReceiveDone(device_uid_, app_handle_, frame);
+
+ buffer_.consume(buffer_.size());
+ Recv(ec);
+}
+
+TransportAdapter::Error WebsocketClientConnection::SendData(
+ ::protocol_handler::RawMessagePtr message) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(frames_to_send_mutex_);
+ message_queue_.push(message);
+ return TransportAdapter::OK;
+}
+
+TransportAdapter::Error WebsocketClientConnection::Disconnect() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ Shutdown();
+ return TransportAdapter::OK;
+}
+
+void WebsocketClientConnection::Shutdown() {
+ shutdown_ = true;
+
+ if (thread_delegate_) {
+ thread_delegate_->SetShutdown();
+ write_thread_->join();
+ delete thread_delegate_;
+ thread_delegate_ = NULL;
+ threads::DeleteThread(write_thread_);
+ write_thread_ = NULL;
+ }
+ if (buffer_.size()) {
+ buffer_.consume(buffer_.size());
+ }
+ controller_->DisconnectDone(device_uid_, app_handle_);
+}
+
+WebsocketClientConnection::LoopThreadDelegate::LoopThreadDelegate(
+ MessageQueue<Message, AsyncQueue>* message_queue,
+ WebsocketClientConnection* handler)
+ : message_queue_(*message_queue), handler_(*handler), shutdown_(false) {}
+
+void WebsocketClientConnection::LoopThreadDelegate::threadMain() {
+ while (!message_queue_.IsShuttingDown() && !shutdown_) {
+ DrainQueue();
+ message_queue_.wait();
+ }
+ DrainQueue();
+}
+
+void WebsocketClientConnection::LoopThreadDelegate::exitThreadMain() {
+ shutdown_ = true;
+ if (!message_queue_.IsShuttingDown()) {
+ message_queue_.Shutdown();
+ }
+}
+
+void WebsocketClientConnection::LoopThreadDelegate::DrainQueue() {
+ while (!message_queue_.empty()) {
+ Message message_ptr;
+ message_queue_.pop(message_ptr);
+ if (!shutdown_) {
+ boost::system::error_code ec;
+ if (handler_.cloud_properties.cloud_transport_type == "WS") {
+ handler_.ws_.write(
+ boost::asio::buffer(message_ptr->data(), message_ptr->data_size()));
+ }
+#ifdef ENABLE_SECURITY
+ else if (handler_.cloud_properties.cloud_transport_type == "WSS") {
+ handler_.wss_.write(
+ boost::asio::buffer(message_ptr->data(), message_ptr->data_size()));
+ }
+#endif // ENABLE_SECURITY
+ if (ec) {
+ LOG4CXX_ERROR(logger_, "Error writing to websocket");
+ handler_.controller_->DataSendFailed(handler_.device_uid_,
+ handler_.app_handle_,
+ message_ptr,
+ DataSendError());
+ }
+ }
+ }
+}
+
+void WebsocketClientConnection::LoopThreadDelegate::SetShutdown() {
+ shutdown_ = true;
+ if (!message_queue_.IsShuttingDown()) {
+ message_queue_.Shutdown();
+ }
+}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc
index 6b7d44ea8d..6a43f66c64 100644
--- a/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc
+++ b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc
@@ -32,14 +32,14 @@
#include "transport_manager/iap2_emulation/iap2_transport_adapter.h"
-#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
-#include <unistd.h>
#include <stdio.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
-#include "utils/threads/thread.h"
#include "utils/file_system.h"
+#include "utils/threads/thread.h"
namespace {
static const mode_t mode = 0666;
@@ -54,9 +54,9 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "IAP2Emulation");
IAP2BluetoothEmulationTransportAdapter::IAP2BluetoothEmulationTransportAdapter(
const uint16_t port,
- resumption::LastState& last_state,
+ resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings)
- : TcpTransportAdapter(port, last_state, settings) {}
+ : TcpTransportAdapter(port, last_state_wrapper, settings) {}
void IAP2BluetoothEmulationTransportAdapter::DeviceSwitched(
const DeviceUID& device_handle) {
@@ -69,15 +69,21 @@ DeviceType IAP2BluetoothEmulationTransportAdapter::GetDeviceType() const {
return IOS_BT;
}
+void IAP2BluetoothEmulationTransportAdapter::TransportConfigUpdated(
+ const TransportConfig& new_config) {
+ return;
+}
+
IAP2USBEmulationTransportAdapter::IAP2USBEmulationTransportAdapter(
const uint16_t port,
- resumption::LastState& last_state,
+ resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings)
- : TcpTransportAdapter(port, last_state, settings), out_(0) {
+ : TcpTransportAdapter(port, last_state_wrapper, settings), out_(0) {
auto delegate = new IAPSignalHandlerDelegate(*this);
signal_handler_ = threads::CreateThread("iAP signal handler", delegate);
signal_handler_->start();
const auto result = mkfifo(out_signals_channel, mode);
+ UNUSED(result);
LOG4CXX_DEBUG(logger_, "Out signals channel creation result: " << result);
}
@@ -119,10 +125,16 @@ DeviceType IAP2USBEmulationTransportAdapter::GetDeviceType() const {
return IOS_USB;
}
+void IAP2USBEmulationTransportAdapter::TransportConfigUpdated(
+ const TransportConfig& new_config) {
+ return;
+}
+
IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate::
IAPSignalHandlerDelegate(IAP2USBEmulationTransportAdapter& adapter)
: adapter_(adapter), run_flag_(true), in_(0) {
const auto result = mkfifo(in_signals_channel, mode);
+ UNUSED(result);
LOG4CXX_DEBUG(logger_, "In signals channel creation result: " << result);
}
@@ -170,5 +182,5 @@ void IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate::
run_flag_ = false;
ThreadDelegate::exitThreadMain();
}
-}
-} // namespace transport_manager::transport_adapter
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/tcp/network_interface_listener_impl.cc b/src/components/transport_manager/src/tcp/network_interface_listener_impl.cc
new file mode 100644
index 0000000000..85c479134d
--- /dev/null
+++ b/src/components/transport_manager/src/tcp/network_interface_listener_impl.cc
@@ -0,0 +1,42 @@
+#include "transport_manager/tcp/network_interface_listener_impl.h"
+#include "platform_specific_network_interface_listener_impl.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+NetworkInterfaceListenerImpl::NetworkInterfaceListenerImpl(
+ TcpClientListener* tcp_client_listener,
+ const std::string designated_interface)
+ : platform_specific_impl_(new PlatformSpecificNetworkInterfaceListener(
+ tcp_client_listener, designated_interface)) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+NetworkInterfaceListenerImpl::~NetworkInterfaceListenerImpl() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+bool NetworkInterfaceListenerImpl::Init() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return platform_specific_impl_->Init();
+}
+
+void NetworkInterfaceListenerImpl::Deinit() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ platform_specific_impl_->Deinit();
+}
+
+bool NetworkInterfaceListenerImpl::Start() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return platform_specific_impl_->Start();
+}
+
+bool NetworkInterfaceListenerImpl::Stop() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return platform_specific_impl_->Stop();
+}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc b/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc
new file mode 100644
index 0000000000..2e79e84f2e
--- /dev/null
+++ b/src/components/transport_manager/src/tcp/platform_specific/linux/platform_specific_network_interface_listener.cc
@@ -0,0 +1,673 @@
+#include "transport_manager/tcp/platform_specific/linux/platform_specific_network_interface_listener_impl.h"
+
+#include <arpa/inet.h>
+#include <asm/types.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <ifaddrs.h>
+#include <net/if.h>
+#include <sys/select.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+
+#include "transport_manager/tcp/tcp_client_listener.h"
+#include "utils/logger.h"
+#include "utils/threads/thread.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+static std::string GetInterfaceName(unsigned int if_index);
+static bool SetNonblocking(int s);
+
+bool InterfaceStatus::IsAvailable() const {
+ // check if the interface is UP and RUNNING
+ return ((flags_ & IFF_UP) > 0) && ((flags_ & IFF_RUNNING) > 0);
+}
+
+bool InterfaceStatus::IsLoopback() const {
+ return flags_ & IFF_LOOPBACK;
+}
+
+bool InterfaceStatus::HasIPAddress() const {
+ return has_ipv4_ || has_ipv6_;
+}
+
+std::string InterfaceStatus::GetIPv4Address() const {
+ char buf[INET_ADDRSTRLEN] = "";
+ if (has_ipv4_ && IsAvailable()) {
+ inet_ntop(AF_INET, &ipv4_address_, buf, sizeof(buf));
+ }
+ return std::string(buf);
+}
+
+std::string InterfaceStatus::GetIPv6Address() const {
+ char buf[INET6_ADDRSTRLEN] = "";
+ if (has_ipv6_ && IsAvailable()) {
+ inet_ntop(AF_INET6, &ipv6_address_, buf, sizeof(buf));
+ }
+ return std::string(buf);
+}
+
+void InterfaceStatus::SetIPv4Address(struct in_addr* addr) {
+ if (addr == NULL) {
+ has_ipv4_ = false;
+ } else {
+ ipv4_address_ = *addr;
+ has_ipv4_ = true;
+ }
+}
+
+void InterfaceStatus::SetIPv6Address(struct in6_addr* addr) {
+ if (addr == NULL) {
+ has_ipv6_ = false;
+ } else {
+ ipv6_address_ = *addr;
+ has_ipv6_ = true;
+ }
+}
+
+PlatformSpecificNetworkInterfaceListener::
+ PlatformSpecificNetworkInterfaceListener(
+ TcpClientListener* tcp_client_listener,
+ const std::string designated_interface)
+ : tcp_client_listener_(tcp_client_listener)
+ , designated_interface_(designated_interface)
+ , selected_interface_("")
+ , notified_ipv4_addr_("")
+ , notified_ipv6_addr_("")
+ , socket_(-1)
+#ifdef BUILD_TESTS
+ , testing_(false)
+#endif // BUILD_TESTS
+{
+ pipe_fds_[0] = pipe_fds_[1] = -1;
+ thread_ = threads::CreateThread("PlatformSpecificNetworkInterfaceListener",
+ new ListenerThreadDelegate(this));
+}
+
+PlatformSpecificNetworkInterfaceListener::
+ ~PlatformSpecificNetworkInterfaceListener() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ Stop();
+ Deinit();
+
+ delete thread_->delegate();
+ threads::DeleteThread(thread_);
+}
+
+bool PlatformSpecificNetworkInterfaceListener::Init() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Init socket: " << socket_);
+ if (socket_ >= 0) {
+ LOG4CXX_WARN(logger_, "Network interface listener is already initialized");
+ return false;
+ }
+
+ socket_ = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+ if (socket_ == -1) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create netlink socket");
+ return false;
+ }
+
+ if (!SetNonblocking(socket_)) {
+ LOG4CXX_WARN(logger_, "Failed to configure netlink socket to non-blocking");
+ }
+
+ struct sockaddr_nl addr;
+ memset(&addr, 0, sizeof(addr));
+ addr.nl_family = AF_NETLINK;
+ addr.nl_pad = 0;
+ addr.nl_pid = 0;
+ addr.nl_groups = RTMGRP_LINK | RTMGRP_IPV4_IFADDR | RTMGRP_IPV6_IFADDR;
+
+ if (bind(socket_, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) != 0) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to bind netlink socket");
+ close(socket_);
+ socket_ = -1;
+ return false;
+ }
+
+ if (pipe(pipe_fds_) != 0) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create internal pipe");
+ close(socket_);
+ socket_ = -1;
+ return false;
+ }
+
+ if (!SetNonblocking(pipe_fds_[0])) {
+ LOG4CXX_WARN(logger_, "Failed to configure pipe to non-blocking");
+ }
+
+ return true;
+}
+
+void PlatformSpecificNetworkInterfaceListener::Deinit() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Deinit socket: " << socket_);
+ if (socket_ >= 0) {
+ close(socket_);
+ socket_ = -1;
+ }
+ if (pipe_fds_[1] >= 0) {
+ close(pipe_fds_[1]);
+ pipe_fds_[1] = -1;
+ }
+ if (pipe_fds_[0] >= 0) {
+ close(pipe_fds_[0]);
+ pipe_fds_[0] = -1;
+ }
+}
+
+bool PlatformSpecificNetworkInterfaceListener::Start() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (socket_ < 0) {
+ LOG4CXX_WARN(logger_, "Interface listener is not initialized");
+ return false;
+ }
+
+ if (thread_->is_running()) {
+ LOG4CXX_WARN(logger_, "Interface listener is already started");
+ return false;
+ }
+
+ if (!thread_->start()) {
+ LOG4CXX_ERROR(logger_, "Failed to start interface listener");
+ return false;
+ }
+
+ LOG4CXX_INFO(logger_, "Network interface listener started");
+ return true;
+}
+
+bool PlatformSpecificNetworkInterfaceListener::Stop() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!thread_->is_running()) {
+ LOG4CXX_DEBUG(logger_, "interface listener is not running");
+ return false;
+ }
+
+ thread_->join();
+
+ LOG4CXX_INFO(logger_, "Network interface listener stopped");
+ return true;
+}
+
+void PlatformSpecificNetworkInterfaceListener::Loop() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // Initialize status_table_ by acquiring a list of interfaces and their
+ // current statuses. Also we will notify an event to the listener if IP
+ // address is already available.
+ InitializeStatus();
+ NotifyIPAddresses();
+
+ // I am not sure required buffer size for netlink data structures. Most of
+ // implementation I found online uses 4096 so I followed them.
+ char buf[4096];
+ fd_set rfds;
+
+ while (1) {
+ FD_ZERO(&rfds);
+ FD_SET(socket_, &rfds);
+ FD_SET(pipe_fds_[0], &rfds);
+ int nfds = socket_ > pipe_fds_[0] ? socket_ : pipe_fds_[0];
+
+ // wait for some data from netlink socket (socket_) and our internal pipe
+ int ret = select(nfds + 1, &rfds, NULL, NULL, NULL);
+ if (ret < 0) {
+ if (errno == EINTR) {
+ continue;
+ } else {
+ LOG4CXX_WARN(logger_,
+ "select failed for netlink. Aborting interface listener.");
+ break;
+ }
+ }
+
+ // Received data from internal pipe, indicating StopLoop() is called.
+ // We'll break the while() loop and eventually exit this thread.
+ if (FD_ISSET(pipe_fds_[0], &rfds)) {
+ ret = read(pipe_fds_[0], buf, sizeof(buf));
+ if (ret < 0) {
+ if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) {
+ LOG4CXX_WARN(
+ logger_,
+ "Failed to read from pipe. Aborting interface listener.");
+ break;
+ }
+ } else if (ret == 0) {
+ LOG4CXX_WARN(logger_,
+ "Pipe disconnected. Aborting interface listener.");
+ break;
+ } else {
+ LOG4CXX_DEBUG(logger_, "received terminating event through pipe");
+ break;
+ }
+ }
+
+#ifdef BUILD_TESTS
+ if (testing_) { // don't enable events from network interface while testing
+ continue;
+ }
+#endif // BUILD_TESTS
+
+ // received data from netlink socket
+ if (FD_ISSET(socket_, &rfds)) {
+ ret = recv(socket_, buf, sizeof(buf), 0);
+ if (ret < 0) {
+ if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) {
+ LOG4CXX_WARN(logger_,
+ "Failed to read from netlink socket. Aborting interface "
+ "listener.");
+ break;
+ }
+ } else if (ret == 0) {
+ LOG4CXX_WARN(
+ logger_,
+ "Netlink socket disconnected. Aborting interface listener.");
+ break;
+ } else {
+ struct nlmsghdr* header = reinterpret_cast<struct nlmsghdr*>(buf);
+ int len = ret;
+
+ // Parse the stream. We may receive multiple (header + data) pairs at a
+ // time so we use for-loop to go through.
+ for (; NLMSG_OK(header, len); header = NLMSG_NEXT(header, len)) {
+ if (header->nlmsg_type == NLMSG_ERROR) {
+ LOG4CXX_WARN(logger_, "received error event from netlink");
+ break;
+ }
+
+ std::vector<EventParam> params;
+
+ if (header->nlmsg_type == RTM_NEWLINK ||
+ header->nlmsg_type == RTM_DELLINK) {
+ // For these events, data part contains an ifinfomsg struct and a
+ // series of rtattr structures. See rtnetlink(7).
+ // We are only interested in interface index and flags.
+ struct ifinfomsg* ifinfo_msg =
+ reinterpret_cast<struct ifinfomsg*>(NLMSG_DATA(header));
+ EventParam param(ifinfo_msg->ifi_index, ifinfo_msg->ifi_flags);
+ params.push_back(param);
+
+ } else if (header->nlmsg_type == RTM_NEWADDR ||
+ header->nlmsg_type == RTM_DELADDR) {
+ // For these events, data part contains an ifaddrmsg struct and
+ // optionally some rtattr structures. We'll extract IP address(es)
+ // from them.
+ struct ifaddrmsg* ifaddr_msg =
+ reinterpret_cast<struct ifaddrmsg*>(NLMSG_DATA(header));
+ unsigned int size = IFA_PAYLOAD(header);
+ params = ParseIFAddrMessage(ifaddr_msg, size);
+
+ } else {
+ continue;
+ }
+
+ // update status_table_ based on received data
+ UpdateStatus(header->nlmsg_type, params);
+ }
+ }
+
+ // notify the listener if necessary
+ NotifyIPAddresses();
+ }
+ }
+}
+
+bool PlatformSpecificNetworkInterfaceListener::StopLoop() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ LOG4CXX_INFO(logger_, "Stopping network interface listener");
+
+ if (pipe_fds_[1] < 0) {
+ LOG4CXX_WARN(logger_, "StopLoop called in invalid state");
+ return false;
+ }
+
+ char dummy[1] = {0};
+ int ret = write(pipe_fds_[1], dummy, sizeof(dummy));
+ if (ret <= 0) {
+ LOG4CXX_WARN_WITH_ERRNO(
+ logger_, "Failed to send stop message to interface listener");
+ return false;
+ }
+
+ return true;
+}
+
+bool PlatformSpecificNetworkInterfaceListener::InitializeStatus() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+#ifdef BUILD_TESTS
+ if (testing_) {
+ // don't actually call getifaddrs()
+ return true;
+ }
+#endif // BUILD_TESTS
+
+ struct ifaddrs *if_list, *interface;
+ if (getifaddrs(&if_list) != 0) {
+ LOG4CXX_WARN(logger_,
+ "getifaddr failed, interface status won't be available until "
+ "a change occurs");
+ return false;
+ }
+
+ // clear existing table
+ status_table_.clear();
+
+ for (interface = if_list; interface != NULL;
+ interface = interface->ifa_next) {
+ if (interface->ifa_name == NULL || interface->ifa_name[0] == '\0') {
+ continue;
+ }
+ if (interface->ifa_addr == NULL) {
+ continue;
+ }
+
+ std::string ifname(interface->ifa_name);
+ InterfaceStatus& status = status_table_[ifname];
+
+ switch (interface->ifa_addr->sa_family) {
+ case AF_INET: {
+ struct sockaddr_in* addr =
+ reinterpret_cast<struct sockaddr_in*>(interface->ifa_addr);
+ status.SetIPv4Address(&addr->sin_addr);
+ break;
+ }
+ case AF_INET6: {
+ struct sockaddr_in6* addr =
+ reinterpret_cast<struct sockaddr_in6*>(interface->ifa_addr);
+ status.SetIPv6Address(&addr->sin6_addr);
+ break;
+ }
+ default:
+ continue;
+ }
+ status.SetFlags(interface->ifa_flags);
+ }
+
+ freeifaddrs(if_list);
+
+ LOG4CXX_DEBUG(logger_, "Successfully acquired network interface status");
+ DumpTable();
+ return true;
+}
+
+bool PlatformSpecificNetworkInterfaceListener::UpdateStatus(
+ uint16_t type, std::vector<EventParam>& params) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ for (std::vector<EventParam>::iterator it = params.begin();
+ it != params.end();
+ ++it) {
+ std::string ifname = GetInterfaceName(it->if_index);
+ if (ifname.empty()) {
+ continue;
+ }
+
+ InterfaceStatus& status = status_table_[ifname];
+
+ switch (type) {
+ case RTM_NEWLINK: {
+ LOG4CXX_DEBUG(
+ logger_,
+ "netlink event: interface " << ifname << " created or updated");
+ status.SetFlags(it->flags);
+ break;
+ }
+ case RTM_DELLINK:
+ LOG4CXX_DEBUG(logger_,
+ "netlink event: interface " << ifname << " removed");
+ status_table_.erase(ifname);
+ break;
+ case RTM_NEWADDR: {
+ sockaddr* addr = reinterpret_cast<sockaddr*>(&it->address);
+ if (addr->sa_family == AF_INET) {
+ sockaddr_in* addr_in = reinterpret_cast<sockaddr_in*>(addr);
+ status.SetIPv4Address(&addr_in->sin_addr);
+ LOG4CXX_DEBUG(logger_,
+ "netlink event: IPv4 address of interface "
+ << ifname << " updated to "
+ << status.GetIPv4Address());
+ } else if (addr->sa_family == AF_INET6) {
+ sockaddr_in6* addr_in6 = reinterpret_cast<sockaddr_in6*>(addr);
+ status.SetIPv6Address(&addr_in6->sin6_addr);
+ LOG4CXX_DEBUG(logger_,
+ "netlink event: IPv6 address of interface "
+ << ifname << " updated to "
+ << status.GetIPv6Address());
+ }
+ break;
+ }
+ case RTM_DELADDR: {
+ sockaddr* addr = reinterpret_cast<sockaddr*>(&it->address);
+ if (addr->sa_family == AF_INET) {
+ LOG4CXX_DEBUG(logger_,
+ "netlink event: IPv4 address of interface "
+ << ifname << " removed");
+ status.SetIPv4Address(NULL);
+ } else if (addr->sa_family == AF_INET6) {
+ LOG4CXX_DEBUG(logger_,
+ "netlink event: IPv6 address of interface "
+ << ifname << " removed");
+ status.SetIPv6Address(NULL);
+ }
+ break;
+ }
+ default:
+ LOG4CXX_WARN(logger_, "Unsupported netlink event (" << type << ")");
+ break;
+ }
+ }
+ return true;
+}
+
+void PlatformSpecificNetworkInterfaceListener::NotifyIPAddresses() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string ipv4_addr;
+ std::string ipv6_addr;
+ const std::string interface_name = SelectInterface();
+
+ // note that if interface_name is empty (i.e. no interface is selected),
+ // the IP addresses will be empty
+ if (!interface_name.empty()) {
+ InterfaceStatusTable::iterator it = status_table_.find(interface_name);
+ if (status_table_.end() != it) {
+ InterfaceStatus& status = it->second;
+ ipv4_addr = status.GetIPv4Address();
+ ipv6_addr = status.GetIPv6Address();
+ }
+ }
+
+ if (notified_ipv4_addr_ != ipv4_addr || notified_ipv6_addr_ != ipv6_addr) {
+ LOG4CXX_INFO(logger_,
+ "IP address updated: \"" << notified_ipv4_addr_ << "\" -> \""
+ << ipv4_addr << "\", \""
+ << notified_ipv6_addr_ << "\" -> \""
+ << ipv6_addr << "\"");
+
+ notified_ipv4_addr_ = ipv4_addr;
+ notified_ipv6_addr_ = ipv6_addr;
+
+ tcp_client_listener_->OnIPAddressUpdated(notified_ipv4_addr_,
+ notified_ipv6_addr_);
+ }
+}
+
+const std::string PlatformSpecificNetworkInterfaceListener::SelectInterface() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!designated_interface_.empty()) {
+ return designated_interface_;
+ }
+
+ InterfaceStatusTable::iterator it;
+
+ if (!selected_interface_.empty()) {
+ // if current network interface is still available and has IP address, then
+ // we use it
+ it = status_table_.find(selected_interface_);
+ if (it != status_table_.end()) {
+ InterfaceStatus& status = it->second;
+ if (status.IsAvailable() && status.HasIPAddress()) {
+ return selected_interface_;
+ }
+ }
+ }
+
+ // pick a network interface that has IP address
+ for (it = status_table_.begin(); it != status_table_.end(); ++it) {
+ InterfaceStatus& status = it->second;
+ // ignore loopback interfaces
+ if (status.IsLoopback()) {
+ continue;
+ }
+ // if the interface has to be UP and RUNNING, and must have an IP address
+ if (!(status.IsAvailable() && status.HasIPAddress())) {
+ continue;
+ }
+
+ selected_interface_ = it->first;
+ LOG4CXX_DEBUG(logger_,
+ "selecting network interface: " << selected_interface_);
+ return selected_interface_;
+ }
+
+ selected_interface_ = "";
+ return selected_interface_;
+}
+
+std::vector<PlatformSpecificNetworkInterfaceListener::EventParam>
+PlatformSpecificNetworkInterfaceListener::ParseIFAddrMessage(
+ struct ifaddrmsg* message, unsigned int size) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::vector<EventParam> params;
+
+ // Iterate through rtattr structs. (The first one can be acquired through
+ // IFA_RTA() macro)
+ for (struct rtattr* attr = IFA_RTA(message); RTA_OK(attr, size);
+ attr = RTA_NEXT(attr, size)) {
+ if (!(attr->rta_type == IFA_LOCAL || attr->rta_type == IFA_ADDRESS)) {
+ continue;
+ }
+
+ EventParam param(message->ifa_index);
+
+ if (message->ifa_family == AF_INET) {
+ // make sure the size of data is >= 4 bytes
+ if (RTA_PAYLOAD(attr) < sizeof(struct in_addr)) {
+ LOG4CXX_DEBUG(logger_,
+ "Invalid netlink event: insufficient IPv4 address data");
+ continue;
+ }
+
+ // Data part of rtattr contains IPv4 address. Copy it to param.address
+ struct in_addr* ipv4_addr =
+ reinterpret_cast<struct in_addr*>(RTA_DATA(attr));
+
+ struct sockaddr_in* sockaddr =
+ reinterpret_cast<struct sockaddr_in*>(&param.address);
+ sockaddr->sin_family = AF_INET;
+ sockaddr->sin_addr = *ipv4_addr;
+
+ } else if (message->ifa_family == AF_INET6) {
+ // make sure the size of data is >= 16 bytes
+ if (RTA_PAYLOAD(attr) < sizeof(struct in6_addr)) {
+ LOG4CXX_DEBUG(logger_,
+ "Invalid netlink event: insufficient IPv6 address data");
+ continue;
+ }
+
+ // Data part of rtattr contains IPv6 address. Copy it to param.address
+ struct in6_addr* ipv6_addr =
+ reinterpret_cast<struct in6_addr*>(RTA_DATA(attr));
+
+ struct sockaddr_in6* sockaddr =
+ reinterpret_cast<struct sockaddr_in6*>(&param.address);
+ sockaddr->sin6_family = AF_INET6;
+ sockaddr->sin6_addr = *ipv6_addr;
+
+ } else {
+ LOG4CXX_WARN(logger_,
+ "Unsupported family (" << message->ifa_family << ")");
+ continue;
+ }
+
+ params.push_back(param);
+ }
+
+ return params;
+}
+
+void PlatformSpecificNetworkInterfaceListener::DumpTable() const {
+ LOG4CXX_DEBUG(logger_,
+ "Number of network interfaces: " << status_table_.size());
+
+ for (auto it = status_table_.begin(); it != status_table_.end(); ++it) {
+ const std::string ifname = it->first;
+ const InterfaceStatus& status = it->second;
+ UNUSED(status);
+
+ LOG4CXX_DEBUG(
+ logger_,
+ " " << ifname << " : flags=" << status.GetFlags()
+ << " : available: " << (status.IsAvailable() ? "yes" : "no")
+ << " IPv4: " << status.GetIPv4Address()
+ << " IPv6: " << status.GetIPv6Address()
+ << (status.IsLoopback() ? " (loopback)" : ""));
+ }
+}
+
+PlatformSpecificNetworkInterfaceListener::ListenerThreadDelegate::
+ ListenerThreadDelegate(PlatformSpecificNetworkInterfaceListener* parent)
+ : parent_(parent) {}
+
+void PlatformSpecificNetworkInterfaceListener::ListenerThreadDelegate::
+ threadMain() {
+ parent_->Loop();
+}
+
+void PlatformSpecificNetworkInterfaceListener::ListenerThreadDelegate::
+ exitThreadMain() {
+ parent_->StopLoop();
+}
+
+static std::string GetInterfaceName(unsigned int if_index) {
+ char buf[IFNAMSIZ + 1] = "";
+ if_indextoname(if_index, buf);
+ return std::string(buf);
+}
+
+static bool SetNonblocking(int s) {
+ int prev_flag = fcntl(s, F_GETFL, 0);
+ if (prev_flag == -1) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to acquire socket flag");
+ return false;
+ }
+
+ int ret = fcntl(s, F_SETFL, prev_flag | O_NONBLOCK);
+ if (ret == -1) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Failed to configure socket to non-blocking");
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc b/src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc
new file mode 100644
index 0000000000..15b3814999
--- /dev/null
+++ b/src/components/transport_manager/src/tcp/platform_specific/qnx/platform_specific_network_interface_listener.cc
@@ -0,0 +1,38 @@
+#include "transport_manager/tcp/platform_specific/qnx/platform_specific_network_interface_listener_impl.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+PlatformSpecificNetworkInterfaceListener::
+ PlatformSpecificNetworkInterfaceListener(
+ TcpClientListener* tcp_client_listener,
+ const std::string designated_interface) {}
+
+PlatformSpecificNetworkInterfaceListener::
+ ~PlatformSpecificNetworkInterfaceListener() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+bool PlatformSpecificNetworkInterfaceListener::Init() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return true;
+}
+
+void PlatformSpecificNetworkInterfaceListener::Deinit() {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+bool PlatformSpecificNetworkInterfaceListener::Start() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return true;
+}
+
+bool PlatformSpecificNetworkInterfaceListener::Stop() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return true;
+}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/tcp/tcp_client_listener.cc b/src/components/transport_manager/src/tcp/tcp_client_listener.cc
index 207149eb8c..c2cbac4e13 100644
--- a/src/components/transport_manager/src/tcp/tcp_client_listener.cc
+++ b/src/components/transport_manager/src/tcp/tcp_client_listener.cc
@@ -33,103 +33,123 @@
#include "transport_manager/tcp/tcp_client_listener.h"
+#include <arpa/inet.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <ifaddrs.h>
#include <memory.h>
#include <signal.h>
-#include <errno.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/sysctl.h>
+#include <sys/select.h>
#include <sys/socket.h>
+#include <sys/sysctl.h>
+#include <sys/types.h>
+#include <unistd.h>
#ifdef __linux__
#include <linux/tcp.h>
#else // __linux__
-#include <sys/time.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netinet/tcp_var.h>
+#include <sys/time.h>
#endif // __linux__
#include <sstream>
#include "utils/logger.h"
-#include "utils/make_shared.h"
-#include "utils/threads/thread.h"
-#include "transport_manager/transport_adapter/transport_adapter_controller.h"
+
+#include "transport_manager/tcp/network_interface_listener_impl.h"
#include "transport_manager/tcp/tcp_device.h"
#include "transport_manager/tcp/tcp_socket_connection.h"
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
+#include "utils/threads/thread.h"
namespace transport_manager {
namespace transport_adapter {
CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+static bool SetNonblocking(int s);
+
+#ifdef BUILD_TESTS
+bool TcpClientListener::testing_ = false;
+#endif // BUILD_TESTS
+
TcpClientListener::TcpClientListener(TransportAdapterController* controller,
const uint16_t port,
- const bool enable_keepalive)
+ const bool enable_keepalive,
+ const std::string designated_interface)
: port_(port)
, enable_keepalive_(enable_keepalive)
, controller_(controller)
+ , initialized_(false)
+ , started_(false)
, thread_(0)
, socket_(-1)
- , thread_stop_requested_(false) {
+ , thread_stop_requested_(false)
+ , designated_interface_(designated_interface) {
+ pipe_fds_[0] = pipe_fds_[1] = -1;
thread_ = threads::CreateThread("TcpClientListener",
new ListeningThreadDelegate(this));
+ interface_listener_ =
+ new NetworkInterfaceListenerImpl(this, designated_interface);
}
TransportAdapter::Error TcpClientListener::Init() {
LOG4CXX_AUTO_TRACE(logger_);
thread_stop_requested_ = false;
- socket_ = socket(AF_INET, SOCK_STREAM, 0);
- if (-1 == socket_) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create socket");
- return TransportAdapter::FAIL;
- }
-
- sockaddr_in server_address = {0};
- server_address.sin_family = AF_INET;
- server_address.sin_port = htons(port_);
- server_address.sin_addr.s_addr = INADDR_ANY;
-
- int optval = 1;
- if (0 !=
- setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval))) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt SO_REUSEADDR failed");
+ if (!IsListeningOnSpecificInterface()) {
+ // Network interface is not specified. We will listen on all interfaces
+ // using INADDR_ANY. If socket creation fails, we will treat it an error.
+ socket_ = CreateIPv4ServerSocket(port_);
+ if (-1 == socket_) {
+ LOG4CXX_ERROR(logger_, "Failed to create TCP socket");
+ return TransportAdapter::FAIL;
+ }
+ } else {
+ // Network interface is specified and we wiill listen only on the interface.
+ // In this case, the server socket will be created once
+ // NetworkInterfaceListener notifies the interface's IP address.
+ LOG4CXX_INFO(logger_,
+ "TCP server socket will listen on "
+ << designated_interface_
+ << " once it has an IPv4 address.");
}
- if (bind(socket_,
- reinterpret_cast<sockaddr*>(&server_address),
- sizeof(server_address)) != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "bind() failed");
+ if (!interface_listener_->Init()) {
+ if (socket_ >= 0) {
+ close(socket_);
+ socket_ = -1;
+ }
return TransportAdapter::FAIL;
}
- const int kBacklog = 128;
- if (0 != listen(socket_, kBacklog)) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "listen() failed");
- return TransportAdapter::FAIL;
- }
+ initialized_ = true;
return TransportAdapter::OK;
}
void TcpClientListener::Terminate() {
LOG4CXX_AUTO_TRACE(logger_);
- if (socket_ == -1) {
- LOG4CXX_WARN(logger_, "Socket has been closed");
+
+ if (!initialized_) {
return;
}
- if (shutdown(socket_, SHUT_RDWR) != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to shutdown socket");
- }
- if (close(socket_) != 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to close socket");
+
+ if (!IsListeningOnSpecificInterface()) {
+ DestroyServerSocket(socket_);
+ socket_ = -1;
+ } else {
+ sync_primitives::AutoLock auto_lock(start_stop_lock_);
+ DestroyServerSocket(socket_);
+ socket_ = -1;
}
- socket_ = -1;
+
+ interface_listener_->Deinit();
+ initialized_ = false;
}
bool TcpClientListener::IsInitialised() const {
- return thread_;
+ return initialized_;
}
TcpClientListener::~TcpClientListener() {
@@ -138,6 +158,7 @@ TcpClientListener::~TcpClientListener() {
delete thread_->delegate();
threads::DeleteThread(thread_);
Terminate();
+ delete interface_listener_;
}
void SetKeepaliveOptions(const int fd) {
@@ -203,108 +224,206 @@ void SetKeepaliveOptions(const int fd) {
void TcpClientListener::Loop() {
LOG4CXX_AUTO_TRACE(logger_);
- while (!thread_stop_requested_) {
- sockaddr_in client_address;
- socklen_t client_address_size = sizeof(client_address);
- const int connection_fd = accept(
- socket_, (struct sockaddr*)&client_address, &client_address_size);
- if (thread_stop_requested_) {
- LOG4CXX_DEBUG(logger_, "thread_stop_requested_");
- close(connection_fd);
- break;
- }
-
- if (connection_fd < 0) {
- LOG4CXX_ERROR_WITH_ERRNO(logger_, "accept() failed");
- continue;
- }
+ fd_set rfds;
+ char dummy[16];
- if (AF_INET != client_address.sin_family) {
- LOG4CXX_DEBUG(logger_, "Address of connected client is invalid");
- close(connection_fd);
- continue;
+ while (!thread_stop_requested_) {
+ FD_ZERO(&rfds);
+ FD_SET(socket_, &rfds);
+ FD_SET(pipe_fds_[0], &rfds);
+ int nfds = socket_ > pipe_fds_[0] ? socket_ : pipe_fds_[0];
+
+ int ret = select(nfds + 1, &rfds, NULL, NULL, NULL);
+ if (ret < 0) {
+ if (errno == EINTR) {
+ continue;
+ } else {
+ LOG4CXX_WARN(logger_, "select failed for TCP server socket");
+ break;
+ }
}
- char device_name[32];
- strncpy(device_name,
- inet_ntoa(client_address.sin_addr),
- sizeof(device_name) / sizeof(device_name[0]));
- LOG4CXX_INFO(logger_, "Connected client " << device_name);
- LOG4CXX_INFO(logger_, "Port is: " << port_);
-
- if (enable_keepalive_) {
- SetKeepaliveOptions(connection_fd);
+ if (FD_ISSET(pipe_fds_[0], &rfds)) {
+ ret = read(pipe_fds_[0], dummy, sizeof(dummy));
+ if (ret < 0) {
+ if (errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) {
+ LOG4CXX_WARN(
+ logger_,
+ "Failed to read from pipe, aborting TCP server socket loop.");
+ break;
+ }
+ } else if (ret == 0) {
+ LOG4CXX_WARN(logger_,
+ "Pipe disconnected, aborting TCP server socket loop.");
+ break;
+ } else {
+ LOG4CXX_DEBUG(logger_,
+ "received stop command of TCP server socket loop");
+ break;
+ }
}
- const auto device_uid =
- device_name + std::string(":") + std::to_string(port_);
-
-#if defined(BUILD_TESTS)
- TcpDevice* tcp_device =
- new TcpDevice(client_address.sin_addr.s_addr, device_uid, device_name);
+ if (FD_ISSET(socket_, &rfds)) {
+ sockaddr_in client_address;
+ socklen_t client_address_size = sizeof(client_address);
+ const int connection_fd = accept(
+ socket_, (struct sockaddr*)&client_address, &client_address_size);
+ if (thread_stop_requested_) {
+ LOG4CXX_DEBUG(logger_, "thread_stop_requested_");
+ close(connection_fd);
+ break;
+ }
+
+ if (connection_fd < 0) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "accept() failed");
+ continue;
+ }
+
+ if (AF_INET != client_address.sin_family) {
+ LOG4CXX_DEBUG(logger_, "Address of connected client is invalid");
+ close(connection_fd);
+ continue;
+ }
+
+ char device_name[32];
+ size_t size = sizeof(device_name) / sizeof(device_name[0]);
+ strncpy(device_name, inet_ntoa(client_address.sin_addr), size);
+
+ device_name[size - 1] = '\0';
+ LOG4CXX_INFO(logger_, "Connected client " << device_name);
+ LOG4CXX_INFO(logger_, "Port is: " << port_);
+
+ if (enable_keepalive_) {
+ SetKeepaliveOptions(connection_fd);
+ }
+
+ const auto device_uid =
+ device_name + std::string(":") + std::to_string(port_);
+
+#if defined(ENABLE_IAP2EMULATION)
+ auto tcp_device = std::make_shared<TcpDevice>(
+ client_address.sin_addr.s_addr, device_uid, device_name);
#else
- TcpDevice* tcp_device =
- new TcpDevice(client_address.sin_addr.s_addr, device_uid);
-#endif // BUILD_TESTS
-
- DeviceSptr device = controller_->AddDevice(tcp_device);
- tcp_device = static_cast<TcpDevice*>(device.get());
- const ApplicationHandle app_handle =
- tcp_device->AddIncomingApplication(connection_fd);
-
- utils::SharedPtr<TcpSocketConnection> connection =
- utils::MakeShared<TcpSocketConnection>(
- device->unique_device_id(), app_handle, controller_);
- controller_->ConnectionCreated(
- connection, device->unique_device_id(), app_handle);
- connection->set_socket(connection_fd);
- const TransportAdapter::Error error = connection->Start();
- if (TransportAdapter::OK != error) {
- LOG4CXX_ERROR(logger_,
- "TCP connection::Start() failed with error: " << error);
+ auto tcp_device = std::make_shared<TcpDevice>(
+ client_address.sin_addr.s_addr, device_uid);
+#endif // ENABLE_IAP2EMULATION
+
+ DeviceSptr device = controller_->AddDevice(tcp_device);
+ auto tcp_device_raw = static_cast<TcpDevice*>(device.get());
+ const ApplicationHandle app_handle =
+ tcp_device_raw->AddIncomingApplication(connection_fd);
+
+ std::shared_ptr<TcpSocketConnection> connection =
+ std::make_shared<TcpSocketConnection>(
+ device->unique_device_id(), app_handle, controller_);
+ controller_->ConnectionCreated(
+ connection, device->unique_device_id(), app_handle);
+ connection->set_socket(connection_fd);
+ const TransportAdapter::Error error = connection->Start();
+ if (TransportAdapter::OK != error) {
+ LOG4CXX_ERROR(logger_,
+ "TCP connection::Start() failed with error: " << error);
+ }
}
}
+
+ LOG4CXX_INFO(logger_, "TCP server socket loop is terminated.");
}
void TcpClientListener::StopLoop() {
LOG4CXX_AUTO_TRACE(logger_);
+ if (pipe_fds_[1] < 0) {
+ LOG4CXX_WARN(logger_, "StopLoop called in invalid state");
+ return;
+ }
+
thread_stop_requested_ = true;
- // We need to connect to the listening socket to unblock accept() call
- int byesocket = socket(AF_INET, SOCK_STREAM, 0);
- sockaddr_in server_address = {0};
- server_address.sin_family = AF_INET;
- server_address.sin_port = htons(port_);
- server_address.sin_addr.s_addr = INADDR_ANY;
- if (0 != connect(byesocket,
- reinterpret_cast<sockaddr*>(&server_address),
- sizeof(server_address))) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "Failed to connect byesocket");
- } else {
- // Can only shutdown socket if connected
- if (0 != shutdown(byesocket, SHUT_RDWR)) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "Failed to shutdown byesocket");
- }
+
+ char dummy[1] = {0};
+ int ret = write(pipe_fds_[1], dummy, sizeof(dummy));
+ if (ret <= 0) {
+ LOG4CXX_WARN_WITH_ERRNO(
+ logger_, "Failed to send stop message to TCP server socket loop");
}
- close(byesocket);
}
TransportAdapter::Error TcpClientListener::StartListening() {
LOG4CXX_AUTO_TRACE(logger_);
- if (thread_->is_running()) {
+ if (started_) {
LOG4CXX_WARN(
logger_,
"TransportAdapter::BAD_STATE. Listener has already been started");
return TransportAdapter::BAD_STATE;
}
- if (!thread_->start()) {
- LOG4CXX_ERROR(logger_, "Tcp client listener thread start failed");
+ if (!interface_listener_->Start()) {
return TransportAdapter::FAIL;
}
+
+ if (!IsListeningOnSpecificInterface()) {
+ TransportAdapter::Error ret = StartListeningThread();
+ if (TransportAdapter::OK != ret) {
+ LOG4CXX_ERROR(logger_, "Tcp client listener thread start failed");
+ interface_listener_->Stop();
+ return ret;
+ }
+ }
+
+ started_ = true;
LOG4CXX_INFO(logger_, "Tcp client listener has started successfully");
return TransportAdapter::OK;
}
+TransportAdapter::Error TcpClientListener::ResumeListening() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ interface_listener_->Init();
+ StartListeningThread();
+ started_ = true;
+
+ LOG4CXX_INFO(logger_, "Tcp client listener was resumed successfully");
+ return TransportAdapter::OK;
+}
+
+TransportAdapter::Error TcpClientListener::StopListening() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!started_) {
+ LOG4CXX_DEBUG(logger_, "TcpClientListener is not running now");
+ return TransportAdapter::BAD_STATE;
+ }
+
+ interface_listener_->Stop();
+
+ StopListeningThread();
+
+ started_ = false;
+ LOG4CXX_INFO(logger_, "Tcp client listener was stopped successfully");
+ return TransportAdapter::OK;
+}
+
+TransportAdapter::Error TcpClientListener::SuspendListening() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!started_) {
+ LOG4CXX_DEBUG(logger_, "TcpClientListener is not running now");
+ return TransportAdapter::BAD_STATE;
+ }
+
+ if (shutdown(socket_, SHUT_RDWR) != 0) {
+ LOG4CXX_WARN(logger_, "Socket was unable to be shutdowned");
+ }
+
+ if (close(socket_) != 0) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to close socket");
+ }
+
+ interface_listener_->Deinit();
+ StopListeningThread();
+ started_ = false;
+
+ LOG4CXX_INFO(logger_, "Tcp client listener was suspended");
+ return TransportAdapter::OK;
+}
+
void TcpClientListener::ListeningThreadDelegate::exitThreadMain() {
parent_->StopLoop();
}
@@ -317,18 +436,272 @@ TcpClientListener::ListeningThreadDelegate::ListeningThreadDelegate(
TcpClientListener* parent)
: parent_(parent) {}
-TransportAdapter::Error TcpClientListener::StopListening() {
+TransportAdapter::Error TcpClientListener::StartListeningThread() {
LOG4CXX_AUTO_TRACE(logger_);
- if (!thread_->is_running()) {
- LOG4CXX_DEBUG(logger_, "TcpClientListener is not running now");
- return TransportAdapter::BAD_STATE;
+
+ // StartListening() can be called from multiple threads
+ sync_primitives::AutoLock auto_lock(start_stop_lock_);
+
+ if (pipe_fds_[0] < 0 || pipe_fds_[1] < 0) {
+ // recreate the pipe every time, so that the thread loop will not get
+ // leftover
+ // data inside pipe after it is started
+ if (pipe(pipe_fds_) != 0) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create internal pipe");
+ return TransportAdapter::FAIL;
+ }
+ if (!SetNonblocking(pipe_fds_[0])) {
+ LOG4CXX_WARN(logger_, "Failed to configure pipe to non-blocking");
+ }
}
+ thread_stop_requested_ = false;
+
+ if (!thread_->start()) {
+ return TransportAdapter::FAIL;
+ }
+ return TransportAdapter::OK;
+}
+
+TransportAdapter::Error TcpClientListener::StopListeningThread() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // StopListening() can be called from multiple threads
+ sync_primitives::AutoLock auto_lock(start_stop_lock_);
+
thread_->join();
- LOG4CXX_INFO(logger_, "Tcp client listener has stopped successfully");
+ close(pipe_fds_[1]);
+ pipe_fds_[1] = -1;
+ close(pipe_fds_[0]);
+ pipe_fds_[0] = -1;
+
return TransportAdapter::OK;
}
+void TcpClientListener::OnIPAddressUpdated(const std::string ipv4_addr,
+ const std::string ipv6_addr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // Since we only create a TCP socket with IPv4 option (AF_INET), currently we
+ // do not use IPv6 address.
+ if (ipv4_addr != current_ip_address_) {
+ if (IsListeningOnSpecificInterface()) {
+ if (!current_ip_address_.empty()) {
+ // the server socket is running, terminate it
+ LOG4CXX_DEBUG(
+ logger_,
+ "Stopping current TCP server socket on " << designated_interface_);
+ StopOnNetworkInterface();
+ }
+ if (!ipv4_addr.empty()) {
+ // start (or restart) server socket with the new IP address
+ LOG4CXX_DEBUG(
+ logger_, "Starting TCP server socket on " << designated_interface_);
+ StartOnNetworkInterface();
+ }
+ }
+
+ current_ip_address_ = ipv4_addr;
+
+ std::string enabled = !current_ip_address_.empty() ? "true" : "false";
+ std::ostringstream oss;
+ oss << port_;
+
+ TransportConfig config;
+ config.insert(std::make_pair(tc_enabled, enabled));
+ config.insert(std::make_pair(tc_tcp_ip_address, current_ip_address_));
+ config.insert(std::make_pair(tc_tcp_port, oss.str()));
+
+ controller_->TransportConfigUpdated(config);
+ }
+}
+
+bool TcpClientListener::StartOnNetworkInterface() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // this method is only for the case that network interface is specified
+ if (IsListeningOnSpecificInterface()) {
+ {
+ // make sure that two threads will not update socket_ at the same time
+ sync_primitives::AutoLock auto_lock(start_stop_lock_);
+ if (socket_ < 0) {
+ socket_ = CreateIPv4ServerSocket(port_, designated_interface_);
+ if (-1 == socket_) {
+ LOG4CXX_WARN(logger_, "Failed to create TCP socket");
+ return false;
+ }
+ }
+ }
+
+ if (TransportAdapter::OK != StartListeningThread()) {
+ LOG4CXX_WARN(logger_, "Failed to start TCP client listener");
+ return false;
+ }
+ LOG4CXX_INFO(logger_,
+ "TCP server socket started on " << designated_interface_);
+ }
+ return true;
+}
+
+bool TcpClientListener::StopOnNetworkInterface() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (IsListeningOnSpecificInterface()) {
+ if (TransportAdapter::OK != StopListeningThread()) {
+ LOG4CXX_WARN(logger_, "Failed to stop TCP client listener");
+ return false;
+ }
+
+ {
+ sync_primitives::AutoLock auto_lock(start_stop_lock_);
+ DestroyServerSocket(socket_);
+ socket_ = -1;
+ }
+
+ LOG4CXX_INFO(
+ logger_,
+ "TCP server socket on " << designated_interface_ << " stopped");
+ }
+ return true;
+}
+
+bool TcpClientListener::IsListeningOnSpecificInterface() const {
+ return !designated_interface_.empty();
+}
+
+int TcpClientListener::CreateIPv4ServerSocket(
+ uint16_t port, const std::string interface_name) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ struct in_addr ipv4_address;
+ memset(&ipv4_address, 0, sizeof(ipv4_address));
+ if (interface_name.empty()) {
+ ipv4_address.s_addr = htonl(INADDR_ANY);
+ } else if (!GetIPv4Address(interface_name, &ipv4_address)) {
+ return -1;
+ }
+
+ int sock = socket(AF_INET, SOCK_STREAM, 0);
+ if (-1 == sock) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to create socket");
+ return -1;
+ }
+
+ sockaddr_in server_address = {0};
+ server_address.sin_family = AF_INET;
+ server_address.sin_port = htons(port);
+ server_address.sin_addr = ipv4_address;
+
+ int optval = 1;
+ if (0 !=
+ setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval))) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "setsockopt SO_REUSEADDR failed");
+ }
+
+ if (bind(sock,
+ reinterpret_cast<sockaddr*>(&server_address),
+ sizeof(server_address)) != 0) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "bind() failed");
+ close(sock);
+ return -1;
+ }
+
+ const int kBacklog = 128;
+ if (0 != listen(sock, kBacklog)) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "listen() failed");
+ close(sock);
+ return -1;
+ }
+
+ return sock;
+}
+
+void TcpClientListener::DestroyServerSocket(int sock) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (sock >= 0) {
+ if (shutdown(sock, SHUT_RDWR) != 0) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to shutdown socket");
+ }
+ if (close(sock) != 0) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to close socket");
+ }
+ }
+}
+
+bool TcpClientListener::GetIPv4Address(const std::string interface_name,
+ struct in_addr* ip_address) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+#ifdef BUILD_TESTS
+ if (testing_) {
+ // don't actually call getifaddrs(), instead return a dummy address of
+ // INADDR_LOOPBACK
+ struct in_addr dummy_addr;
+ dummy_addr.s_addr = htonl(INADDR_LOOPBACK);
+
+ if (ip_address != NULL) {
+ *ip_address = dummy_addr;
+ }
+ return true;
+ }
+#endif // BUILD_TESTS
+
+ struct ifaddrs* if_list;
+ if (getifaddrs(&if_list) != 0) {
+ LOG4CXX_WARN(logger_, "getifaddrs failed");
+ return false;
+ }
+
+ struct ifaddrs* interface;
+ bool found = false;
+
+ for (interface = if_list; interface != NULL;
+ interface = interface->ifa_next) {
+ if (interface->ifa_name == NULL) {
+ continue;
+ }
+ if (interface_name == interface->ifa_name) {
+ if (interface->ifa_addr == NULL) {
+ continue;
+ }
+ switch (interface->ifa_addr->sa_family) {
+ case AF_INET: {
+ struct sockaddr_in* addr =
+ reinterpret_cast<struct sockaddr_in*>(interface->ifa_addr);
+ if (ip_address != NULL) {
+ *ip_address = addr->sin_addr;
+ }
+ found = true;
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+
+ freeifaddrs(if_list);
+
+ return found;
+}
+
+static bool SetNonblocking(int s) {
+ int prev_flag = fcntl(s, F_GETFL, 0);
+ if (prev_flag == -1) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_, "Failed to acquire socket flag");
+ return false;
+ }
+
+ int ret = fcntl(s, F_SETFL, prev_flag | O_NONBLOCK);
+ if (ret == -1) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Failed to configure socket to non-blocking");
+ return false;
+ }
+
+ return true;
+}
+
} // namespace transport_adapter
} // namespace transport_manager
diff --git a/src/components/transport_manager/src/tcp/tcp_connection_factory.cc b/src/components/transport_manager/src/tcp/tcp_connection_factory.cc
index 114425076a..50d1c74fa7 100644
--- a/src/components/transport_manager/src/tcp/tcp_connection_factory.cc
+++ b/src/components/transport_manager/src/tcp/tcp_connection_factory.cc
@@ -30,12 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "transport_manager/tcp/tcp_connection_factory.h"
#include "transport_manager/tcp/tcp_server_originated_socket_connection.h"
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "utils/logger.h"
-#include "utils/make_shared.h"
namespace transport_manager {
namespace transport_adapter {
@@ -53,11 +52,11 @@ TransportAdapter::Error TcpConnectionFactory::Init() {
TransportAdapter::Error TcpConnectionFactory::CreateConnection(
const DeviceUID& device_uid, const ApplicationHandle& app_handle) {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "DeviceUID: " << &device_uid
- << ", ApplicationHandle: " << &app_handle);
- utils::SharedPtr<TcpServerOriginatedSocketConnection> connection =
- utils::MakeShared<TcpServerOriginatedSocketConnection>(
+ LOG4CXX_DEBUG(
+ logger_,
+ "DeviceUID: " << &device_uid << ", ApplicationHandle: " << &app_handle);
+ std::shared_ptr<TcpServerOriginatedSocketConnection> connection =
+ std::make_shared<TcpServerOriginatedSocketConnection>(
device_uid, app_handle, controller_);
controller_->ConnectionCreated(connection, device_uid, app_handle);
const TransportAdapter::Error error = connection->Start();
diff --git a/src/components/transport_manager/src/tcp/tcp_device.cc b/src/components/transport_manager/src/tcp/tcp_device.cc
index dbcb5d38cb..16abdfc22d 100644
--- a/src/components/transport_manager/src/tcp/tcp_device.cc
+++ b/src/components/transport_manager/src/tcp/tcp_device.cc
@@ -30,8 +30,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "utils/logger.h"
#include "transport_manager/tcp/tcp_device.h"
+#include "utils/logger.h"
namespace transport_manager {
namespace transport_adapter {
@@ -46,7 +46,7 @@ TcpDevice::TcpDevice(const in_addr_t& in_addr, const std::string& name)
LOG4CXX_AUTO_TRACE(logger_);
}
-#if defined(BUILD_TESTS)
+#if defined(ENABLE_IAP2EMULATION)
TcpDevice::TcpDevice(const in_addr_t& in_addr,
const std::string& device_uid,
const std::string& transport_switch_id)
@@ -57,11 +57,11 @@ TcpDevice::TcpDevice(const in_addr_t& in_addr,
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_,
"Device created with transport switch emulation support.");
- LOG4CXX_DEBUG(logger_,
- "Device parameters: " << device_uid << " / "
- << transport_switch_id);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Device parameters: " << device_uid << " / " << transport_switch_id);
}
-#endif // BUILD_TESTS
+#endif // ENABLE_IAP2EMULATION
bool TcpDevice::IsSameAs(const Device* other) const {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc b/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc
index 516f2d3ec4..690b2d25b3 100644
--- a/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc
+++ b/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc
@@ -56,7 +56,7 @@ bool TcpServerOriginatedSocketConnection::Establish(ConnectError** error) {
DCHECK(error);
LOG4CXX_DEBUG(logger_, "error " << error);
DeviceSptr device = controller()->FindDevice(device_handle());
- if (!device.valid()) {
+ if (device.use_count() == 0) {
LOG4CXX_ERROR(logger_, "Device " << device_handle() << " not found");
*error = new ConnectError();
return false;
@@ -65,9 +65,9 @@ bool TcpServerOriginatedSocketConnection::Establish(ConnectError** error) {
const int port = tcp_device->GetApplicationPort(application_handle());
if (-1 == port) {
- LOG4CXX_ERROR(logger_,
- "Application port for " << application_handle()
- << " not found");
+ LOG4CXX_ERROR(
+ logger_,
+ "Application port for " << application_handle() << " not found");
*error = new ConnectError();
return false;
}
diff --git a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc
index 0e9e63263b..54eb3a7b6d 100644
--- a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc
+++ b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc
@@ -32,19 +32,19 @@
#include "transport_manager/tcp/tcp_transport_adapter.h"
+#include <errno.h>
#include <memory.h>
#include <signal.h>
-#include <errno.h>
#include <stdio.h>
#include <cstdlib>
#include <sstream>
-#include "utils/logger.h"
-#include "utils/threads/thread_delegate.h"
#include "transport_manager/tcp/tcp_client_listener.h"
#include "transport_manager/tcp/tcp_connection_factory.h"
#include "transport_manager/tcp/tcp_device.h"
+#include "utils/logger.h"
+#include "utils/threads/thread_delegate.h"
namespace transport_manager {
namespace transport_adapter {
@@ -53,16 +53,37 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
TcpTransportAdapter::TcpTransportAdapter(
const uint16_t port,
- resumption::LastState& last_state,
+ resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings)
- : TransportAdapterImpl(NULL,
- new TcpConnectionFactory(this),
- new TcpClientListener(this, port, true),
- last_state,
- settings) {}
+ : TransportAdapterImpl(
+ NULL,
+ new TcpConnectionFactory(this),
+ new TcpClientListener(
+ this,
+ port,
+ true,
+ settings.transport_manager_tcp_adapter_network_interface()),
+ last_state_wrapper,
+ settings) {}
TcpTransportAdapter::~TcpTransportAdapter() {}
+void TcpTransportAdapter::TransportConfigUpdated(
+ const TransportConfig& new_config) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ transport_config_ = new_config;
+
+ // call the method of parent class to trigger OnTransportConfigUpdated() for
+ // the listeners
+ TransportAdapterImpl::TransportConfigUpdated(new_config);
+}
+
+TransportConfig TcpTransportAdapter::GetTransportConfiguration() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return transport_config_;
+}
+
DeviceType TcpTransportAdapter::GetDeviceType() const {
return TCP;
}
@@ -79,8 +100,8 @@ void TcpTransportAdapter::Store() const {
if (!device) { // device could have been disconnected
continue;
}
- utils::SharedPtr<TcpDevice> tcp_device =
- DeviceSptr::static_pointer_cast<TcpDevice>(device);
+ std::shared_ptr<TcpDevice> tcp_device =
+ std::static_pointer_cast<TcpDevice>(device);
Json::Value device_dictionary;
device_dictionary["name"] = tcp_device->name();
struct in_addr address;
@@ -110,20 +131,22 @@ void TcpTransportAdapter::Store() const {
}
}
tcp_adapter_dictionary["devices"] = devices_dictionary;
- Json::Value& dictionary = last_state().get_dictionary();
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
dictionary["TransportManager"]["TcpAdapter"] = tcp_adapter_dictionary;
+ accessor.GetMutableData().set_dictionary(dictionary);
}
bool TcpTransportAdapter::Restore() {
LOG4CXX_AUTO_TRACE(logger_);
bool errors_occurred = false;
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
const Json::Value tcp_adapter_dictionary =
- last_state().get_dictionary()["TransportManager"]["TcpAdapter"];
+ dictionary["TransportManager"]["TcpAdapter"];
const Json::Value devices_dictionary = tcp_adapter_dictionary["devices"];
- for (Json::Value::const_iterator i = devices_dictionary.begin();
- i != devices_dictionary.end();
- ++i) {
- const Json::Value device_dictionary = *i;
+ for (const auto& tcp_adapter_device : devices_dictionary) {
+ const Json::Value device_dictionary = tcp_adapter_device;
std::string name = device_dictionary["name"].asString();
std::string address_record = device_dictionary["address"].asString();
in_addr_t address = inet_addr(address_record.c_str());
@@ -132,10 +155,8 @@ bool TcpTransportAdapter::Restore() {
AddDevice(device);
const Json::Value applications_dictionary =
device_dictionary["applications"];
- for (Json::Value::const_iterator j = applications_dictionary.begin();
- j != applications_dictionary.end();
- ++j) {
- const Json::Value application_dictionary = *j;
+ for (const auto& application : applications_dictionary) {
+ const Json::Value application_dictionary = application;
std::string port_record = application_dictionary["port"].asString();
int port = atoi(port_record.c_str());
ApplicationHandle app_handle = tcp_device->AddDiscoveredApplication(port);
diff --git a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
index 9d594affe4..7d96c685f1 100644
--- a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
+++ b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc
@@ -30,13 +30,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <algorithm>
#include <errno.h>
#include <fcntl.h>
#include <memory.h>
-#include <unistd.h>
-#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <algorithm>
#include "utils/logger.h"
#include "utils/threads/thread.h"
@@ -62,7 +62,7 @@ ThreadedSocketConnection::ThreadedSocketConnection(
, unexpected_disconnect_(false)
, device_uid_(device_id)
, app_handle_(app_handle)
- , thread_(NULL) {
+ , thread_(nullptr) {
const std::string thread_name = std::string("Socket ") + device_handle();
thread_ = threads::CreateThread(thread_name.c_str(),
new SocketConnectionDelegate(this));
@@ -70,7 +70,7 @@ ThreadedSocketConnection::ThreadedSocketConnection(
ThreadedSocketConnection::~ThreadedSocketConnection() {
LOG4CXX_AUTO_TRACE(logger_);
- DCHECK(NULL == thread_);
+ DCHECK(nullptr == thread_);
if (-1 != read_fd_) {
close(read_fd_);
@@ -82,10 +82,12 @@ ThreadedSocketConnection::~ThreadedSocketConnection() {
void ThreadedSocketConnection::StopAndJoinThread() {
Disconnect();
- thread_->join();
- delete thread_->delegate();
- threads::DeleteThread(thread_);
- thread_ = NULL;
+ if (thread_) {
+ thread_->join();
+ delete thread_->delegate();
+ threads::DeleteThread(thread_);
+ thread_ = nullptr;
+ }
}
void ThreadedSocketConnection::Abort() {
@@ -167,16 +169,23 @@ TransportAdapter::Error ThreadedSocketConnection::Disconnect() {
return Notify();
}
+void ThreadedSocketConnection::Terminate() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ StopAndJoinThread();
+}
+
void ThreadedSocketConnection::threadMain() {
LOG4CXX_AUTO_TRACE(logger_);
- ConnectError* connect_error = NULL;
+ ConnectError* connect_error = nullptr;
if (!Establish(&connect_error)) {
LOG4CXX_ERROR(logger_, "Connection Establish failed");
delete connect_error;
Abort();
+ } else {
+ LOG4CXX_DEBUG(logger_, "Connection established");
+ controller_->ConnectDone(device_handle(), application_handle());
}
- LOG4CXX_DEBUG(logger_, "Connection established");
- controller_->ConnectDone(device_handle(), application_handle());
+
while (!terminate_flag_) {
Transmit();
}
@@ -300,11 +309,11 @@ bool ThreadedSocketConnection::Receive() {
bytes_read = recv(socket_, buffer, sizeof(buffer), MSG_DONTWAIT);
if (bytes_read > 0) {
- LOG4CXX_DEBUG(logger_,
- "Received " << bytes_read << " bytes for connection "
- << this);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Received " << bytes_read << " bytes for connection " << this);
::protocol_handler::RawMessagePtr frame(
- new protocol_handler::RawMessage(0, 0, buffer, bytes_read));
+ new protocol_handler::RawMessage(0, 0, buffer, bytes_read, false));
controller_->DataReceiveDone(
device_handle(), application_handle(), frame);
} else if (bytes_read < 0) {
diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
index bdacd68006..36f6dd98d0 100644
--- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
+++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
@@ -31,37 +31,50 @@
*/
#include "config_profile/profile.h"
-#include "utils/logger.h"
#include "utils/helpers.h"
+#include "utils/logger.h"
+#include "utils/timer_task_impl.h"
-#include "transport_manager/transport_adapter/transport_adapter_impl.h"
-#include "transport_manager/transport_adapter/transport_adapter_listener.h"
+#include "transport_manager/transport_adapter/client_connection_listener.h"
#include "transport_manager/transport_adapter/device_scanner.h"
#include "transport_manager/transport_adapter/server_connection_factory.h"
-#include "transport_manager/transport_adapter/client_connection_listener.h"
+#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+#include "transport_manager/transport_adapter/transport_adapter_listener.h"
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+#include "transport_manager/websocket_server/websocket_device.h"
+#endif
namespace transport_manager {
namespace transport_adapter {
+const char* tc_enabled = "enabled";
+const char* tc_tcp_port = "tcp_port";
+const char* tc_tcp_ip_address = "tcp_ip_address";
+
CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
namespace {
-// @deprecated DeviceTypes: PASA_AOA, PASA_BLUETOOTH, MME
DeviceTypes devicesType = {
std::make_pair(DeviceType::AOA, std::string("USB_AOA")),
- std::make_pair(DeviceType::PASA_AOA, std::string("USB_AOA")),
std::make_pair(DeviceType::BLUETOOTH, std::string("BLUETOOTH")),
- std::make_pair(DeviceType::PASA_BLUETOOTH, std::string("BLUETOOTH")),
- std::make_pair(DeviceType::MME, std::string("USB_IOS")),
std::make_pair(DeviceType::IOS_BT, std::string("BLUETOOTH_IOS")),
std::make_pair(DeviceType::IOS_USB, std::string("USB_IOS")),
- std::make_pair(DeviceType::TCP, std::string("WIFI"))};
+ std::make_pair(DeviceType::TCP, std::string("WIFI")),
+ std::make_pair(DeviceType::IOS_USB_HOST_MODE,
+ std::string("USB_IOS_HOST_MODE")),
+ std::make_pair(DeviceType::IOS_USB_DEVICE_MODE,
+ std::string("USB_IOS_DEVICE_MODE")),
+ std::make_pair(DeviceType::IOS_CARPLAY_WIRELESS,
+ std::string("CARPLAY_WIRELESS_IOS")),
+ std::make_pair(DeviceType::CLOUD_WEBSOCKET, std::string("CLOUD_WEBSOCKET")),
+ std::make_pair(DeviceType::WEBENGINE_WEBSOCKET,
+ std::string("WEBENGINE_WEBSOCKET"))};
}
TransportAdapterImpl::TransportAdapterImpl(
DeviceScanner* device_scanner,
ServerConnectionFactory* server_connection_factory,
ClientConnectionListener* client_connection_listener,
- resumption::LastState& last_state,
+ resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings)
: listeners_()
, initialised_(0)
@@ -77,7 +90,7 @@ TransportAdapterImpl::TransportAdapterImpl(
device_scanner_(device_scanner)
, server_connection_factory_(server_connection_factory)
, client_connection_listener_(client_connection_listener)
- , last_state_(last_state)
+ , last_state_wrapper_(last_state_wrapper)
, settings_(settings) {
}
@@ -91,16 +104,16 @@ TransportAdapterImpl::~TransportAdapterImpl() {
LOG4CXX_DEBUG(logger_, "device_scanner_ deleted.");
}
if (server_connection_factory_) {
- LOG4CXX_DEBUG(logger_,
- "Deleting server_connection_factory "
- << server_connection_factory_);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Deleting server_connection_factory " << server_connection_factory_);
delete server_connection_factory_;
LOG4CXX_DEBUG(logger_, "server_connection_factory deleted.");
}
if (client_connection_listener_) {
- LOG4CXX_DEBUG(logger_,
- "Deleting client_connection_listener_ "
- << client_connection_listener_);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Deleting client_connection_listener_ " << client_connection_listener_);
delete client_connection_listener_;
LOG4CXX_DEBUG(logger_, "client_connection_listener_ deleted.");
}
@@ -129,6 +142,12 @@ void TransportAdapterImpl::Terminate() {
connections_lock_.AcquireForWriting();
std::swap(connections, connections_);
connections_lock_.Release();
+ for (const auto& connection : connections) {
+ auto& info = connection.second;
+ if (info.connection) {
+ info.connection->Terminate();
+ }
+ }
connections.clear();
LOG4CXX_DEBUG(logger_, "Connections deleted");
@@ -184,9 +203,9 @@ TransportAdapter::Error TransportAdapterImpl::SearchDevices() {
TransportAdapter::Error TransportAdapterImpl::Connect(
const DeviceUID& device_id, const ApplicationHandle& app_handle) {
- LOG4CXX_TRACE(logger_,
- "enter. DeviceUID " << device_id << " ApplicationHandle "
- << app_handle);
+ LOG4CXX_TRACE(
+ logger_,
+ "enter. DeviceUID " << device_id << " ApplicationHandle " << app_handle);
if (server_connection_factory_ == 0) {
LOG4CXX_TRACE(logger_, "exit with NOT_SUPPORTED");
return NOT_SUPPORTED;
@@ -201,17 +220,21 @@ TransportAdapter::Error TransportAdapterImpl::Connect(
}
connections_lock_.AcquireForWriting();
+
+ std::pair<DeviceUID, ApplicationHandle> connection_key =
+ std::make_pair(device_id, app_handle);
const bool already_exists =
- connections_.end() !=
- connections_.find(std::make_pair(device_id, app_handle));
+ connections_.end() != connections_.find(connection_key);
+ ConnectionInfo& info = connections_[connection_key];
if (!already_exists) {
- ConnectionInfo& info = connections_[std::make_pair(device_id, app_handle)];
info.app_handle = app_handle;
info.device_id = device_id;
info.state = ConnectionInfo::NEW;
}
+ const bool pending_app = ConnectionInfo::PENDING == info.state;
connections_lock_.Release();
- if (already_exists) {
+
+ if (already_exists && !pending_app) {
LOG4CXX_TRACE(logger_, "exit with ALREADY_EXISTS");
return ALREADY_EXISTS;
}
@@ -219,9 +242,9 @@ TransportAdapter::Error TransportAdapterImpl::Connect(
const TransportAdapter::Error err =
server_connection_factory_->CreateConnection(device_id, app_handle);
if (TransportAdapter::OK != err) {
- connections_lock_.AcquireForWriting();
- connections_.erase(std::make_pair(device_id, app_handle));
- connections_lock_.Release();
+ if (!pending_app) {
+ RemoveConnection(device_id, app_handle);
+ }
}
LOG4CXX_TRACE(logger_, "exit with error: " << err);
return err;
@@ -233,6 +256,33 @@ TransportAdapter::Error TransportAdapterImpl::ConnectDevice(
DeviceSptr device = FindDevice(device_handle);
if (device) {
TransportAdapter::Error err = ConnectDevice(device);
+ if (FAIL == err && GetDeviceType() == DeviceType::CLOUD_WEBSOCKET) {
+ LOG4CXX_TRACE(logger_,
+ "Error occurred while connecting cloud app: " << err);
+ // Update retry count
+ if (device->retry_count() >=
+ get_settings().cloud_app_max_retry_attempts()) {
+ device->reset_retry_count();
+ ConnectionStatusUpdated(device, ConnectionStatus::PENDING);
+ return err;
+ } else if (device->connection_status() == ConnectionStatus::PENDING) {
+ ConnectionStatusUpdated(device, ConnectionStatus::RETRY);
+ }
+
+ device->next_retry();
+
+ // Start timer for next retry
+ TimerSPtr retry_timer(std::make_shared<timer::Timer>(
+ "RetryConnectionTimer",
+ new timer::TimerTaskImpl<TransportAdapterImpl>(
+ this, &TransportAdapterImpl::RetryConnection)));
+ sync_primitives::AutoLock locker(retry_timer_pool_lock_);
+ retry_timer_pool_.push(std::make_pair(retry_timer, device_handle));
+ retry_timer->Start(get_settings().cloud_app_retry_timeout(),
+ timer::kSingleShot);
+ } else if (OK == err) {
+ ConnectionStatusUpdated(device, ConnectionStatus::CONNECTED);
+ }
LOG4CXX_TRACE(logger_, "exit with error: " << err);
return err;
} else {
@@ -241,11 +291,65 @@ TransportAdapter::Error TransportAdapterImpl::ConnectDevice(
}
}
+void TransportAdapterImpl::RetryConnection() {
+ ClearCompletedTimers();
+ const DeviceUID device_id = GetNextRetryDevice();
+ if (device_id.empty()) {
+ LOG4CXX_ERROR(logger_,
+ "Unable to find timer, ignoring RetryConnection request");
+ return;
+ }
+ ConnectDevice(device_id);
+}
+
+void TransportAdapterImpl::ClearCompletedTimers() {
+ // Cleanup any retry timers which have completed execution
+ sync_primitives::AutoLock locker(completed_timer_pool_lock_);
+ while (!completed_timer_pool_.empty()) {
+ auto timer_entry = completed_timer_pool_.front();
+ if (timer_entry.first->is_completed()) {
+ completed_timer_pool_.pop();
+ }
+ }
+}
+
+DeviceUID TransportAdapterImpl::GetNextRetryDevice() {
+ sync_primitives::AutoLock retry_locker(retry_timer_pool_lock_);
+ if (retry_timer_pool_.empty()) {
+ return std::string();
+ }
+ auto timer_entry = retry_timer_pool_.front();
+ retry_timer_pool_.pop();
+
+ // Store reference for cleanup later
+ sync_primitives::AutoLock completed_locker(completed_timer_pool_lock_);
+ completed_timer_pool_.push(timer_entry);
+
+ return timer_entry.second;
+}
+
+ConnectionStatus TransportAdapterImpl::GetConnectionStatus(
+ const DeviceUID& device_handle) const {
+ DeviceSptr device = FindDevice(device_handle);
+ return device.use_count() == 0 ? ConnectionStatus::INVALID
+ : device->connection_status();
+}
+
+void TransportAdapterImpl::ConnectionStatusUpdated(DeviceSptr device,
+ ConnectionStatus status) {
+ device->set_connection_status(status);
+ for (TransportAdapterListenerList::iterator it = listeners_.begin();
+ it != listeners_.end();
+ ++it) {
+ (*it)->OnConnectionStatusUpdated(this);
+ }
+}
+
TransportAdapter::Error TransportAdapterImpl::Disconnect(
const DeviceUID& device_id, const ApplicationHandle& app_handle) {
- LOG4CXX_TRACE(logger_,
- "enter. device_id: " << &device_id
- << ", device_id: " << &device_id);
+ LOG4CXX_TRACE(
+ logger_,
+ "enter. device_id: " << &device_id << ", device_id: " << &device_id);
if (!initialised_) {
LOG4CXX_TRACE(logger_, "exit with BAD_STATE");
return BAD_STATE;
@@ -270,6 +374,12 @@ TransportAdapter::Error TransportAdapterImpl::DisconnectDevice(
}
Error error = OK;
+ DeviceSptr device = FindDevice(device_id);
+ if (!device) {
+ LOG4CXX_WARN(logger_, "Device with id: " << device_id << " Not found");
+ return BAD_PARAM;
+ }
+ ConnectionStatusUpdated(device, ConnectionStatus::CLOSING);
std::vector<ConnectionInfo> to_disconnect;
connections_lock_.AcquireForReading();
@@ -320,8 +430,9 @@ TransportAdapter::Error TransportAdapterImpl::SendData(
}
}
-TransportAdapter::Error TransportAdapterImpl::StartClientListening() {
- LOG4CXX_TRACE(logger_, "enter");
+TransportAdapter::Error TransportAdapterImpl::ChangeClientListening(
+ TransportAction required_change) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (client_connection_listener_ == 0) {
LOG4CXX_TRACE(logger_, "exit with NOT_SUPPORTED");
return NOT_SUPPORTED;
@@ -330,27 +441,43 @@ TransportAdapter::Error TransportAdapterImpl::StartClientListening() {
LOG4CXX_TRACE(logger_, "exit with BAD_STATE");
return BAD_STATE;
}
- TransportAdapter::Error err = client_connection_listener_->StartListening();
- LOG4CXX_TRACE(logger_, "exit with error: " << err);
- return err;
-}
-TransportAdapter::Error TransportAdapterImpl::StopClientListening() {
- LOG4CXX_TRACE(logger_, "enter");
- if (client_connection_listener_ == 0) {
- LOG4CXX_TRACE(logger_, "exit with NOT_SUPPORTED");
- return NOT_SUPPORTED;
- }
- if (!client_connection_listener_->IsInitialised()) {
- LOG4CXX_TRACE(logger_, "exit with BAD_STATE");
- return BAD_STATE;
- }
- TransportAdapter::Error err = client_connection_listener_->StopListening();
- sync_primitives::AutoLock locker(devices_mutex_);
- for (DeviceMap::iterator it = devices_.begin(); it != devices_.end(); ++it) {
- it->second->Stop();
+ TransportAdapter::Error err = TransportAdapter::Error::UNKNOWN;
+
+ switch (required_change) {
+ case transport_manager::TransportAction::kVisibilityOn:
+ err = client_connection_listener_->StartListening();
+ break;
+
+ case transport_manager::TransportAction::kListeningOn:
+ err = client_connection_listener_->ResumeListening();
+ break;
+
+ case transport_manager::TransportAction::kListeningOff:
+ err = client_connection_listener_->SuspendListening();
+ {
+ sync_primitives::AutoLock locker(devices_mutex_);
+ for (DeviceMap::iterator it = devices_.begin(); it != devices_.end();
+ ++it) {
+ it->second->Stop();
+ }
+ }
+ break;
+
+ case transport_manager::TransportAction::kVisibilityOff:
+ err = client_connection_listener_->StopListening();
+ {
+ sync_primitives::AutoLock locker(devices_mutex_);
+ for (DeviceMap::iterator it = devices_.begin(); it != devices_.end();
+ ++it) {
+ it->second->Stop();
+ }
+ }
+ break;
+ default:
+ NOTREACHED();
}
- LOG4CXX_TRACE(logger_, "exit with error: " << err);
+ LOG4CXX_TRACE(logger_, "Exit with error: " << err);
return err;
}
@@ -367,6 +494,32 @@ DeviceList TransportAdapterImpl::GetDeviceList() const {
return devices;
}
+DeviceSptr TransportAdapterImpl::GetWebEngineDevice() const {
+#ifndef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+ LOG4CXX_TRACE(logger_,
+ "Web engine support is disabled. Device does not exist");
+ return DeviceSptr();
+#else
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock locker(devices_mutex_);
+
+ auto web_engine_device =
+ std::find_if(devices_.begin(),
+ devices_.end(),
+ [](const std::pair<DeviceUID, DeviceSptr> device) {
+ return webengine_constants::kWebEngineDeviceName ==
+ device.second->name();
+ });
+
+ if (devices_.end() != web_engine_device) {
+ return web_engine_device->second;
+ }
+
+ LOG4CXX_ERROR(logger_, "WebEngine device not found!");
+ return std::make_shared<transport_adapter::WebSocketDevice>("", "");
+#endif
+}
+
DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) {
LOG4CXX_TRACE(logger_, "enter. device: " << device);
DeviceSptr existing_device;
@@ -389,6 +542,7 @@ DeviceSptr TransportAdapterImpl::AddDevice(DeviceSptr device) {
LOG4CXX_TRACE(logger_, "exit with TRUE. Condition: same_device_found");
return existing_device;
} else {
+ device->set_connection_status(ConnectionStatus::PENDING);
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end();
++it) {
@@ -539,9 +693,9 @@ void TransportAdapterImpl::ConnectionCreated(
void TransportAdapterImpl::DeviceDisconnected(
const DeviceUID& device_handle, const DisconnectDeviceError& error) {
const DeviceUID device_uid = device_handle;
- LOG4CXX_TRACE(logger_,
- "enter. device_handle: " << &device_uid
- << ", error: " << &error);
+ LOG4CXX_TRACE(
+ logger_,
+ "enter. device_handle: " << &device_uid << ", error: " << &error);
ApplicationList app_list = GetApplicationList(device_uid);
for (ApplicationList::const_iterator i = app_list.begin();
i != app_list.end();
@@ -563,14 +717,12 @@ void TransportAdapterImpl::DeviceDisconnected(
listener->OnDisconnectDeviceDone(this, device_uid);
}
- connections_lock_.AcquireForWriting();
for (ApplicationList::const_iterator i = app_list.begin();
i != app_list.end();
++i) {
ApplicationHandle app_handle = *i;
- connections_.erase(std::make_pair(device_uid, app_handle));
+ RemoveConnection(device_uid, app_handle);
}
- connections_lock_.Release();
RemoveDevice(device_uid);
LOG4CXX_TRACE(logger_, "exit");
@@ -599,9 +751,9 @@ void TransportAdapterImpl::DisconnectDone(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) {
const DeviceUID device_uid = device_handle;
const ApplicationHandle app_uid = app_handle;
- LOG4CXX_TRACE(logger_,
- "enter. device_id: " << &device_uid
- << ", app_handle: " << &app_uid);
+ LOG4CXX_TRACE(
+ logger_,
+ "enter. device_id: " << &device_uid << ", app_handle: " << &app_uid);
DeviceSptr device = FindDevice(device_handle);
if (!device) {
LOG4CXX_WARN(logger_, "Device: uid " << &device_uid << " not found");
@@ -620,9 +772,7 @@ void TransportAdapterImpl::DisconnectDone(const DeviceUID& device_handle,
listener->OnDisconnectDeviceDone(this, device_uid);
}
}
- connections_lock_.AcquireForWriting();
- connections_.erase(std::make_pair(device_uid, app_uid));
- connections_lock_.Release();
+ RemoveConnection(device_uid, app_uid);
if (device_disconnected) {
RemoveDevice(device_uid);
@@ -695,6 +845,16 @@ void TransportAdapterImpl::DataSendFailed(
LOG4CXX_TRACE(logger_, "exit");
}
+void TransportAdapterImpl::TransportConfigUpdated(
+ const TransportConfig& new_config) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ for (TransportAdapterListenerList::iterator it = listeners_.begin();
+ it != listeners_.end();
+ ++it) {
+ (*it)->OnTransportConfigUpdated(this);
+ }
+}
+
void TransportAdapterImpl::DoTransportSwitch() const {
LOG4CXX_AUTO_TRACE(logger_);
std::for_each(
@@ -712,6 +872,26 @@ void TransportAdapterImpl::DeviceSwitched(const DeviceUID& device_handle) {
UNUSED(device_handle);
}
+ConnectionSPtr TransportAdapterImpl::FindPendingConnection(
+ const DeviceUID& device_id, const ApplicationHandle& app_handle) const {
+ LOG4CXX_TRACE(
+ logger_,
+ "enter. device_id: " << &device_id << ", app_handle: " << &app_handle);
+ ConnectionSPtr connection;
+ connections_lock_.AcquireForReading();
+ ConnectionMap::const_iterator it =
+ connections_.find(std::make_pair(device_id, app_handle));
+ if (it != connections_.end()) {
+ const ConnectionInfo& info = it->second;
+ if (info.state == ConnectionInfo::PENDING) {
+ connection = info.connection;
+ }
+ }
+ connections_lock_.Release();
+ LOG4CXX_TRACE(logger_, "exit with Connection: " << connection);
+ return connection;
+}
+
DeviceSptr TransportAdapterImpl::FindDevice(const DeviceUID& device_id) const {
LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id);
DeviceSptr ret;
@@ -727,11 +907,39 @@ DeviceSptr TransportAdapterImpl::FindDevice(const DeviceUID& device_id) const {
return ret;
}
+void TransportAdapterImpl::ConnectPending(const DeviceUID& device_id,
+ const ApplicationHandle& app_handle) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ connections_lock_.AcquireForWriting();
+ ConnectionMap::iterator it_conn =
+ connections_.find(std::make_pair(device_id, app_handle));
+ if (it_conn != connections_.end()) {
+ ConnectionInfo& info = it_conn->second;
+ info.state = ConnectionInfo::PENDING;
+ }
+ connections_lock_.Release();
+
+ DeviceSptr device = FindDevice(device_id);
+ if (device.use_count() == 0) {
+ LOG4CXX_ERROR(
+ logger_, "Unable to find device, cannot set connection pending status");
+ return;
+ } else {
+ device->set_connection_status(ConnectionStatus::PENDING);
+ }
+
+ for (TransportAdapterListenerList::iterator it = listeners_.begin();
+ it != listeners_.end();
+ ++it) {
+ (*it)->OnConnectPending(this, device_id, app_handle);
+ }
+}
+
void TransportAdapterImpl::ConnectDone(const DeviceUID& device_id,
const ApplicationHandle& app_handle) {
- LOG4CXX_TRACE(logger_,
- "enter. device_id: " << &device_id
- << ", app_handle: " << &app_handle);
+ LOG4CXX_TRACE(
+ logger_,
+ "enter. device_id: " << &device_id << ", app_handle: " << &app_handle);
connections_lock_.AcquireForReading();
ConnectionMap::iterator it_conn =
connections_.find(std::make_pair(device_id, app_handle));
@@ -759,9 +967,7 @@ void TransportAdapterImpl::ConnectFailed(const DeviceUID& device_handle,
LOG4CXX_TRACE(logger_,
"enter. device_id: " << &device_uid << ", app_handle: "
<< &app_uid << ", error: " << &error);
- connections_lock_.AcquireForWriting();
- connections_.erase(std::make_pair(device_uid, app_uid));
- connections_lock_.Release();
+ RemoveConnection(device_uid, app_uid);
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end();
++it) {
@@ -774,23 +980,70 @@ void TransportAdapterImpl::RemoveFinalizedConnection(
const DeviceUID& device_handle, const ApplicationHandle& app_handle) {
const DeviceUID device_uid = device_handle;
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoWriteLock lock(connections_lock_);
- ConnectionMap::iterator it_conn =
- connections_.find(std::make_pair(device_uid, app_handle));
- if (it_conn == connections_.end()) {
- LOG4CXX_WARN(logger_,
- "Device_id: " << &device_uid << ", app_handle: " << &app_handle
- << " connection not found");
- return;
+ {
+ connections_lock_.AcquireForWriting();
+ auto it_conn = connections_.find(std::make_pair(device_uid, app_handle));
+ if (connections_.end() == it_conn) {
+ LOG4CXX_WARN(logger_,
+ "Device_id: " << &device_uid << ", app_handle: "
+ << &app_handle << " connection not found");
+ connections_lock_.Release();
+ return;
+ }
+ const ConnectionInfo& info = it_conn->second;
+ if (ConnectionInfo::FINALISING != info.state) {
+ LOG4CXX_WARN(logger_,
+ "Device_id: " << &device_uid << ", app_handle: "
+ << &app_handle << " connection not finalized");
+ connections_lock_.Release();
+ return;
+ }
+ // By copying the info.connection shared pointer into this local variable,
+ // we can delay the connection's destructor until after
+ // connections_lock_.Release.
+ LOG4CXX_DEBUG(
+ logger_,
+ "RemoveFinalizedConnection copying connection with Device_id: "
+ << &device_uid << ", app_handle: " << &app_handle);
+ ConnectionSPtr connection = info.connection;
+ connections_.erase(it_conn);
+ connections_lock_.Release();
+ LOG4CXX_DEBUG(logger_,
+ "RemoveFinalizedConnection Connections Lock Released");
}
- const ConnectionInfo& info = it_conn->second;
- if (info.state != ConnectionInfo::FINALISING) {
- LOG4CXX_WARN(logger_,
- "Device_id: " << &device_uid << ", app_handle: " << &app_handle
- << " connection not finalized");
+
+ DeviceSptr device = FindDevice(device_handle);
+ if (!device) {
+ LOG4CXX_WARN(logger_, "Device: uid " << &device_uid << " not found");
return;
}
- connections_.erase(it_conn);
+
+ if (ToBeAutoDisconnected(device) &&
+ IsSingleApplication(device_handle, app_handle)) {
+ RemoveDevice(device_uid);
+ }
+}
+
+void TransportAdapterImpl::RemoveConnection(
+ const DeviceUID& device_id, const ApplicationHandle& app_handle) {
+ ConnectionSPtr connection;
+ connections_lock_.AcquireForWriting();
+ ConnectionMap::const_iterator it =
+ connections_.find(std::make_pair(device_id, app_handle));
+ if (it != connections_.end()) {
+ // By copying the connection from the map to this shared pointer,
+ // we can erase the object from the map without triggering the destructor
+ LOG4CXX_DEBUG(logger_,
+ "Copying connection with Device_id: "
+ << &device_id << ", app_handle: " << &app_handle);
+ connection = it->second.connection;
+ connections_.erase(it);
+ }
+ connections_lock_.Release();
+ LOG4CXX_DEBUG(logger_, "Connections Lock Released");
+
+ // And now, "connection" goes out of scope, triggering the destructor outside
+ // of the "connections_lock_"
}
void TransportAdapterImpl::AddListener(TransportAdapterListener* listener) {
@@ -803,24 +1056,24 @@ ApplicationList TransportAdapterImpl::GetApplicationList(
const DeviceUID& device_id) const {
LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id);
DeviceSptr device = FindDevice(device_id);
- if (device.valid()) {
+ if (device.use_count() != 0) {
ApplicationList lst = device->GetApplicationList();
LOG4CXX_TRACE(logger_,
"exit with ApplicationList. It's size = "
- << lst.size() << " Condition: device.valid()");
+ << lst.size() << " Condition: device.use_count() != 0");
return lst;
}
- LOG4CXX_TRACE(
- logger_,
- "exit with empty ApplicationList. Condition: NOT device.valid()");
+ LOG4CXX_TRACE(logger_,
+ "exit with empty ApplicationList. Condition: NOT "
+ "device.use_count() != 0");
return ApplicationList();
}
void TransportAdapterImpl::ConnectionFinished(
const DeviceUID& device_id, const ApplicationHandle& app_handle) {
- LOG4CXX_TRACE(logger_,
- "enter. device_id: " << &device_id
- << ", app_handle: " << &app_handle);
+ LOG4CXX_TRACE(
+ logger_,
+ "enter. device_id: " << &device_id << ", app_handle: " << &app_handle);
connections_lock_.AcquireForReading();
ConnectionMap::iterator it =
connections_.find(std::make_pair(device_id, app_handle));
@@ -875,7 +1128,7 @@ bool TransportAdapterImpl::IsInitialised() const {
std::string TransportAdapterImpl::DeviceName(const DeviceUID& device_id) const {
DeviceSptr device = FindDevice(device_id);
- if (device.valid()) {
+ if (device.use_count() != 0) {
return device->name();
} else {
return "";
@@ -944,9 +1197,9 @@ bool TransportAdapterImpl::ToBeAutoDisconnected(DeviceSptr device) const {
ConnectionSPtr TransportAdapterImpl::FindEstablishedConnection(
const DeviceUID& device_id, const ApplicationHandle& app_handle) const {
- LOG4CXX_TRACE(logger_,
- "enter. device_id: " << &device_id
- << ", app_handle: " << &app_handle);
+ LOG4CXX_TRACE(
+ logger_,
+ "enter. device_id: " << &device_id << ", app_handle: " << &app_handle);
ConnectionSPtr connection;
connections_lock_.AcquireForReading();
ConnectionMap::const_iterator it =
@@ -1020,12 +1273,13 @@ void TransportAdapterImpl::RunAppOnDevice(const DeviceUID& device_uid,
void TransportAdapterImpl::RemoveDevice(const DeviceUID& device_handle) {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_, "Device_handle: " << &device_handle);
+ LOG4CXX_DEBUG(logger_, "Remove Device_handle: " << &device_handle);
sync_primitives::AutoLock locker(devices_mutex_);
DeviceMap::iterator i = devices_.find(device_handle);
if (i != devices_.end()) {
DeviceSptr device = i->second;
- if (!device->keep_on_disconnect()) {
+ bool is_cloud_device = (GetDeviceType() == DeviceType::CLOUD_WEBSOCKET);
+ if (!device->keep_on_disconnect() || is_cloud_device) {
devices_.erase(i);
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end();
diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
index f1181ce921..bf2d3dbdf4 100644
--- a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
+++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
@@ -34,9 +34,9 @@
#include "utils/logger.h"
+#include "transport_manager/transport_adapter/transport_adapter_event.h"
#include "transport_manager/transport_adapter/transport_adapter_listener_impl.h"
#include "transport_manager/transport_manager_impl.h"
-#include "transport_manager/transport_adapter/transport_adapter_event.h"
namespace transport_manager {
CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
@@ -116,6 +116,44 @@ void TransportAdapterListenerImpl::OnFindNewApplicationsRequest(
LOG4CXX_TRACE(logger_, "exit");
}
+void TransportAdapterListenerImpl::OnConnectionStatusUpdated(
+ const TransportAdapter* adapter) {
+ LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter);
+ const TransportAdapterEvent event(EventTypeEnum::ON_CONNECTION_STATUS_UPDATED,
+ transport_adapter_,
+ "",
+ 0,
+ ::protocol_handler::RawMessagePtr(),
+ BaseErrorPtr(new BaseError()));
+ if (transport_manager_ != NULL &&
+ transport_manager::E_SUCCESS !=
+ transport_manager_->ReceiveEventFromDevice(event)) {
+ LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ }
+ LOG4CXX_TRACE(logger_, "exit");
+}
+
+void TransportAdapterListenerImpl::OnConnectPending(
+ const TransportAdapter* adapter,
+ const DeviceUID& device,
+ const ApplicationHandle& application_id) {
+ LOG4CXX_TRACE(logger_,
+ "enter adapter*: " << adapter << ", device: " << &device
+ << ", application_id: " << &application_id);
+ const TransportAdapterEvent event(EventTypeEnum::ON_CONNECT_PENDING,
+ transport_adapter_,
+ device,
+ application_id,
+ ::protocol_handler::RawMessagePtr(),
+ BaseErrorPtr(new BaseError()));
+ if (transport_manager_ != NULL &&
+ transport_manager::E_SUCCESS !=
+ transport_manager_->ReceiveEventFromDevice(event)) {
+ LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ }
+ LOG4CXX_TRACE(logger_, "exit");
+}
+
void TransportAdapterListenerImpl::OnConnectDone(
const TransportAdapter* adapter,
const DeviceUID& device,
@@ -275,7 +313,7 @@ void TransportAdapterListenerImpl::OnDataSendDone(
device,
app_id,
data_container,
- new BaseError());
+ std::make_shared<BaseError>());
if (transport_manager_ != NULL &&
transport_manager::E_SUCCESS !=
transport_manager_->ReceiveEventFromDevice(event)) {
@@ -376,4 +414,23 @@ void TransportAdapterListenerImpl::OnTransportSwitchRequested(
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
}
+
+void TransportAdapterListenerImpl::OnTransportConfigUpdated(
+ const transport_adapter::TransportAdapter* adapter) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const TransportAdapterEvent event(EventTypeEnum::ON_TRANSPORT_CONFIG_UPDATED,
+ transport_adapter_,
+ "",
+ 0,
+ ::protocol_handler::RawMessagePtr(),
+ BaseErrorPtr());
+
+ if (transport_manager_ != NULL &&
+ transport_manager::E_SUCCESS !=
+ transport_manager_->ReceiveEventFromDevice(event)) {
+ LOG4CXX_WARN(logger_, "Failed to receive event from device");
+ }
+}
+
} // namespace transport_manager
diff --git a/src/components/transport_manager/src/transport_manager_default.cc b/src/components/transport_manager/src/transport_manager_default.cc
index 196ad09af4..74c5b9ceee 100644
--- a/src/components/transport_manager/src/transport_manager_default.cc
+++ b/src/components/transport_manager/src/transport_manager_default.cc
@@ -44,84 +44,156 @@
#include "transport_manager/usb/usb_aoa_adapter.h"
#endif // USB_SUPPORT
-#if defined(BUILD_TESTS)
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+#include "transport_manager/websocket_server/websocket_server_transport_adapter.h"
+#endif
+
+#if defined(ENABLE_IAP2EMULATION)
#include "transport_manager/iap2_emulation/iap2_transport_adapter.h"
-#endif // BUILD_TEST
+#endif // ENABLE_IAP2EMULATION
namespace transport_manager {
CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+TransportAdapterFactory::TransportAdapterFactory() {
+#ifdef BLUETOOTH_SUPPORT
+ ta_bluetooth_creator_ = [](resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings) {
+ return new transport_adapter::BluetoothTransportAdapter(last_state_wrapper,
+ settings);
+ };
+#endif
+ ta_tcp_creator_ = [](const uint16_t port,
+ resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings) {
+ return new transport_adapter::TcpTransportAdapter(
+ port, last_state_wrapper, settings);
+ };
+#if defined(USB_SUPPORT)
+ ta_usb_creator_ = [](resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings) {
+ return new transport_adapter::UsbAoaAdapter(last_state_wrapper, settings);
+ };
+#endif
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ ta_cloud_creator_ = [](resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings) {
+ return new transport_adapter::CloudWebsocketTransportAdapter(
+ last_state_wrapper, settings);
+ };
+#endif
+
+#if defined(WEBSOCKET_SERVER_TRANSPORT_SUPPORT)
+ ta_websocket_server_creator_ =
+ [](resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings) {
+ return new transport_adapter::WebSocketServerTransportAdapter(
+ last_state_wrapper, settings);
+ };
+#endif
+}
+
TransportManagerDefault::TransportManagerDefault(
- const TransportManagerSettings& settings)
- : TransportManagerImpl(settings) {}
+ const TransportManagerSettings& settings,
+ const TransportAdapterFactory& ta_factory)
+ : TransportManagerImpl(settings), ta_factory_(ta_factory) {}
-int TransportManagerDefault::Init(resumption::LastState& last_state) {
+int TransportManagerDefault::Init(
+ resumption::LastStateWrapperPtr last_state_wrapper) {
LOG4CXX_TRACE(logger_, "enter");
- if (E_SUCCESS != TransportManagerImpl::Init(last_state)) {
+ if (E_SUCCESS != TransportManagerImpl::Init(last_state_wrapper)) {
LOG4CXX_TRACE(logger_,
"exit with E_TM_IS_NOT_INITIALIZED. Condition: E_SUCCESS != "
"TransportManagerImpl::Init()");
return E_TM_IS_NOT_INITIALIZED;
}
-#ifdef BLUETOOTH_SUPPORT
- transport_adapter::TransportAdapterImpl* ta_bluetooth =
- new transport_adapter::BluetoothTransportAdapter(last_state,
- get_settings());
+ const auto& settings = get_settings();
+
+#if defined(BLUETOOTH_SUPPORT)
+ auto ta_bluetooth =
+ ta_factory_.ta_bluetooth_creator_(last_state_wrapper, settings);
#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
ta_bluetooth->SetTelemetryObserver(metric_observer_);
}
#endif // TELEMETRY_MONITOR
AddTransportAdapter(ta_bluetooth);
- ta_bluetooth = NULL;
-#endif
+#endif // BLUETOOTH_SUPPORT
- const uint16_t port = get_settings().transport_manager_tcp_adapter_port();
- transport_adapter::TransportAdapterImpl* ta_tcp =
- new transport_adapter::TcpTransportAdapter(
- port, last_state, get_settings());
+ auto ta_tcp =
+ ta_factory_.ta_tcp_creator_(settings.transport_manager_tcp_adapter_port(),
+ last_state_wrapper,
+ settings);
#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
ta_tcp->SetTelemetryObserver(metric_observer_);
}
#endif // TELEMETRY_MONITOR
AddTransportAdapter(ta_tcp);
- ta_tcp = NULL;
#if defined(USB_SUPPORT)
- transport_adapter::TransportAdapterImpl* ta_usb =
- new transport_adapter::UsbAoaAdapter(last_state, get_settings());
+ auto ta_usb = ta_factory_.ta_usb_creator_(last_state_wrapper, settings);
#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
ta_usb->SetTelemetryObserver(metric_observer_);
}
#endif // TELEMETRY_MONITOR
AddTransportAdapter(ta_usb);
- ta_usb = NULL;
#endif // USB_SUPPORT
-#if defined BUILD_TESTS
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ auto ta_cloud = ta_factory_.ta_cloud_creator_(last_state_wrapper, settings);
+#ifdef TELEMETRY_MONITOR
+ if (metric_observer_) {
+ ta_cloud->SetTelemetryObserver(metric_observer_);
+ }
+#endif // TELEMETRY_MONITOR
+ AddTransportAdapter(ta_cloud);
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+ auto ta_websocket =
+ ta_factory_.ta_websocket_server_creator_(last_state_wrapper, settings);
+
+#ifdef TELEMETRY_MONITOR
+ if (metric_observer_) {
+ ta_websocket->SetTelemetryObserver(metric_observer_);
+ }
+#endif // TELEMETRY_MONITOR
+ AddTransportAdapter(ta_websocket);
+ ta_websocket = NULL;
+#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+
+#if defined ENABLE_IAP2EMULATION
const uint16_t iap2_bt_emu_port = 23456;
transport_adapter::IAP2BluetoothEmulationTransportAdapter*
iap2_bt_emu_adapter =
new transport_adapter::IAP2BluetoothEmulationTransportAdapter(
- iap2_bt_emu_port, last_state, get_settings());
+ iap2_bt_emu_port, last_state_wrapper, settings);
AddTransportAdapter(iap2_bt_emu_adapter);
const uint16_t iap2_usb_emu_port = 34567;
transport_adapter::IAP2USBEmulationTransportAdapter* iap2_usb_emu_adapter =
new transport_adapter::IAP2USBEmulationTransportAdapter(
- iap2_usb_emu_port, last_state, get_settings());
+ iap2_usb_emu_port, last_state_wrapper, settings);
AddTransportAdapter(iap2_usb_emu_adapter);
-#endif // BUILD_TEST
+#endif // ENABLE_IAP2EMULATION
LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
return E_SUCCESS;
}
+int TransportManagerDefault::Init(resumption::LastState&) {
+ return 1;
+}
+
TransportManagerDefault::~TransportManagerDefault() {}
} // namespace transport_manager
diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc
index a364220a64..ddff4f3780 100644
--- a/src/components/transport_manager/src/transport_manager_impl.cc
+++ b/src/components/transport_manager/src/transport_manager_impl.cc
@@ -33,25 +33,32 @@
#include "transport_manager/transport_manager_impl.h"
#include <stdint.h>
+#include <algorithm>
#include <cstring>
+#include <functional>
+#include <iostream>
+#include <limits>
#include <queue>
#include <set>
-#include <algorithm>
-#include <limits>
-#include <functional>
#include <sstream>
-#include <iostream>
-#include "utils/macro.h"
#include "utils/logger.h"
-#include "utils/make_shared.h"
-#include "utils/timer_task_impl.h"
+#include "utils/macro.h"
+
+#include "config_profile/profile.h"
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
+#endif
#include "transport_manager/common.h"
-#include "transport_manager/transport_manager_listener.h"
-#include "transport_manager/transport_manager_listener_empty.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
#include "transport_manager/transport_adapter/transport_adapter_event.h"
-#include "config_profile/profile.h"
+#include "transport_manager/transport_manager_listener.h"
+#include "transport_manager/transport_manager_listener_empty.h"
+#ifdef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+#include "transport_manager/websocket_server/websocket_device.h"
+#include "transport_manager/websocket_server/websocket_server_transport_adapter.h"
+#endif
+#include "utils/timer_task_impl.h"
using ::transport_manager::transport_adapter::TransportAdapter;
@@ -64,6 +71,7 @@ struct ConnectionFinder {
return id_ == connection.id;
}
};
+
} // namespace
namespace transport_manager {
@@ -97,7 +105,14 @@ TransportManagerImpl::TransportManagerImpl(
, device_switch_timer_(
"Device reconection timer",
new timer::TimerTaskImpl<TransportManagerImpl>(
- this, &TransportManagerImpl::ReconnectionTimeout)) {
+ this, &TransportManagerImpl::ReconnectionTimeout))
+ , events_processing_is_active_(true)
+ , events_processing_lock_()
+ , events_processing_cond_var_()
+ , web_engine_device_info_(0,
+ "",
+ webengine_constants::kWebEngineDeviceName,
+ webengine_constants::kWebEngineConnectionType) {
LOG4CXX_TRACE(logger_, "TransportManager has created");
}
@@ -129,6 +144,48 @@ void TransportManagerImpl::ReconnectionTimeout() {
device_to_reconnect_);
}
+void TransportManagerImpl::AddCloudDevice(
+ const transport_manager::transport_adapter::CloudAppProperties&
+ cloud_properties) {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+#else
+ transport_adapter::DeviceType type = transport_adapter::DeviceType::UNKNOWN;
+ if (cloud_properties.cloud_transport_type == "WS") {
+ type = transport_adapter::DeviceType::CLOUD_WEBSOCKET;
+ }
+#ifdef ENABLE_SECURITY
+ else if (cloud_properties.cloud_transport_type == "WSS") {
+ type = transport_adapter::DeviceType::CLOUD_WEBSOCKET;
+ }
+#endif // ENABLE_SECURITY
+ else {
+ return;
+ }
+
+ std::vector<TransportAdapter*>::iterator ta = transport_adapters_.begin();
+ for (; ta != transport_adapters_.end(); ++ta) {
+ if ((*ta)->GetDeviceType() == type) {
+ (*ta)->CreateDevice(cloud_properties.endpoint);
+ transport_adapter::CloudWebsocketTransportAdapter* cta =
+ static_cast<transport_adapter::CloudWebsocketTransportAdapter*>(*ta);
+ cta->SetAppCloudTransportConfig(cloud_properties.endpoint,
+ cloud_properties);
+ }
+ }
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+ return;
+}
+
+void TransportManagerImpl::RemoveCloudDevice(const DeviceHandle device_handle) {
+#if !defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ LOG4CXX_TRACE(logger_, "Cloud app support is disabled. Exiting function");
+ return;
+#else
+ DisconnectDevice(device_handle);
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+}
+
int TransportManagerImpl::ConnectDevice(const DeviceHandle device_handle) {
LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle);
if (!this->is_initialized_) {
@@ -157,6 +214,22 @@ int TransportManagerImpl::ConnectDevice(const DeviceHandle device_handle) {
return err;
}
+ConnectionStatus TransportManagerImpl::GetConnectionStatus(
+ const DeviceHandle& device_handle) const {
+ DeviceUID device_id = converter_.HandleToUid(device_handle);
+
+ sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_);
+ DeviceToAdapterMap::const_iterator it =
+ device_to_adapter_map_.find(device_id);
+ if (it == device_to_adapter_map_.end()) {
+ LOG4CXX_ERROR(logger_, "No device adapter found by id " << device_handle);
+ LOG4CXX_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta");
+ return ConnectionStatus::INVALID;
+ }
+ transport_adapter::TransportAdapter* ta = it->second;
+ return ta->GetConnectionStatus(device_id);
+}
+
int TransportManagerImpl::DisconnectDevice(const DeviceHandle device_handle) {
LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle);
if (!this->is_initialized_) {
@@ -318,9 +391,9 @@ int TransportManagerImpl::Stop() {
int TransportManagerImpl::SendMessageToDevice(
const ::protocol_handler::RawMessagePtr message) {
LOG4CXX_TRACE(logger_, "enter. RawMessageSptr: " << message);
- LOG4CXX_INFO(logger_,
- "Send message to device called with arguments "
- << message.get());
+ LOG4CXX_INFO(
+ logger_,
+ "Send message to device called with arguments " << message.get());
if (false == this->is_initialized_) {
LOG4CXX_ERROR(logger_, "TM is not initialized.");
LOG4CXX_TRACE(logger_,
@@ -516,8 +589,18 @@ int TransportManagerImpl::SearchDevices() {
return transport_adapter_search;
}
+int TransportManagerImpl::Init(
+ resumption::LastStateWrapperPtr last_state_wrapper) {
+ // Last state wrapper required to initialize Transport adapters
+ UNUSED(last_state_wrapper);
+ LOG4CXX_TRACE(logger_, "enter");
+ is_initialized_ = true;
+ LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
+ return E_SUCCESS;
+}
+
int TransportManagerImpl::Init(resumption::LastState& last_state) {
- // Last state requred to initialize Transport adapters
+ // Last state required to initialize Transport adapters
UNUSED(last_state);
LOG4CXX_TRACE(logger_, "enter");
is_initialized_ = true;
@@ -525,19 +608,36 @@ int TransportManagerImpl::Init(resumption::LastState& last_state) {
return E_SUCCESS;
}
-int TransportManagerImpl::Reinit() {
+void TransportManagerImpl::Deinit() {
LOG4CXX_AUTO_TRACE(logger_);
DisconnectAllDevices();
TerminateAllAdapters();
+ device_to_adapter_map_.clear();
+ connection_id_counter_ = 0;
+}
+
+int TransportManagerImpl::Reinit() {
int ret = InitAllAdapters();
return ret;
}
-int TransportManagerImpl::Visibility(const bool& on_off) const {
- LOG4CXX_TRACE(logger_, "enter. On_off: " << &on_off);
- TransportAdapter::Error ret;
+void TransportManagerImpl::StopEventsProcessing() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ events_processing_is_active_ = false;
+}
- LOG4CXX_DEBUG(logger_, "Visibility change requested to " << on_off);
+void TransportManagerImpl::StartEventsProcessing() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ events_processing_is_active_ = true;
+ events_processing_cond_var_.Broadcast();
+}
+
+int TransportManagerImpl::PerformActionOnClients(
+ const TransportAction required_action) const {
+ LOG4CXX_TRACE(logger_,
+ "The following action requested: "
+ << static_cast<int>(required_action)
+ << " to be performed on connected clients");
if (!is_initialized_) {
LOG4CXX_ERROR(logger_, "TM is not initialized");
LOG4CXX_TRACE(logger_,
@@ -546,26 +646,82 @@ int TransportManagerImpl::Visibility(const bool& on_off) const {
return E_TM_IS_NOT_INITIALIZED;
}
- for (std::vector<TransportAdapter*>::const_iterator it =
- transport_adapters_.begin();
- it != transport_adapters_.end();
- ++it) {
- if (on_off) {
- ret = (*it)->StartClientListening();
- } else {
- ret = (*it)->StopClientListening();
- }
+ TransportAdapter::Error ret = TransportAdapter::Error::UNKNOWN;
+
+ for (auto adapter_ptr : transport_adapters_) {
+ ret = adapter_ptr->ChangeClientListening(required_action);
+
if (TransportAdapter::Error::NOT_SUPPORTED == ret) {
LOG4CXX_DEBUG(logger_,
- "Visibility change is not supported for adapter "
- << *it << "[" << (*it)->GetDeviceType() << "]");
+ "Requested action on client is not supported for adapter "
+ << adapter_ptr << "[" << adapter_ptr->GetDeviceType()
+ << "]");
}
}
+
LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
return E_SUCCESS;
}
-void TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) {
+void TransportManagerImpl::CreateWebEngineDevice() {
+#ifndef WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+ LOG4CXX_TRACE(logger_, "Web engine support is disabled. Exiting function");
+#else
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto web_socket_ta_iterator = std::find_if(
+ transport_adapters_.begin(),
+ transport_adapters_.end(),
+ [](const TransportAdapter* ta) {
+ return transport_adapter::DeviceType::WEBENGINE_WEBSOCKET ==
+ ta->GetDeviceType();
+ });
+
+ if (transport_adapters_.end() == web_socket_ta_iterator) {
+ LOG4CXX_WARN(logger_,
+ "WebSocketServerTransportAdapter not found."
+ "Impossible to create WebEngineDevice");
+ return;
+ }
+
+ auto web_socket_ta =
+ dynamic_cast<transport_adapter::WebSocketServerTransportAdapter*>(
+ *web_socket_ta_iterator);
+
+ if (!web_socket_ta) {
+ LOG4CXX_ERROR(logger_,
+ "Unable to cast from Transport Adapter to "
+ "WebSocketServerTransportAdapter."
+ "Impossible to create WebEngineDevice");
+ return;
+ }
+
+ std::string unique_device_id = web_socket_ta->GetStoredDeviceID();
+
+ DeviceHandle device_handle = converter_.UidToHandle(
+ unique_device_id, webengine_constants::kWebEngineConnectionType);
+
+ web_engine_device_info_ =
+ DeviceInfo(device_handle,
+ unique_device_id,
+ webengine_constants::kWebEngineDeviceName,
+ webengine_constants::kWebEngineConnectionType);
+
+ auto ws_device = std::make_shared<transport_adapter::WebSocketDevice>(
+ web_engine_device_info_.name(), web_engine_device_info_.mac_address());
+
+ ws_device->set_keep_on_disconnect(true);
+
+ web_socket_ta->AddDevice(ws_device);
+ OnDeviceListUpdated(web_socket_ta);
+#endif // WEBSOCKET_SERVER_TRANSPORT_SUPPORT
+}
+
+const DeviceInfo& TransportManagerImpl::GetWebEngineDeviceInfo() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return web_engine_device_info_;
+}
+
+bool TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) {
LOG4CXX_TRACE(logger_, "enter. TransportAdapter: " << ta);
std::set<DeviceInfo> old_devices;
std::set<DeviceInfo> new_devices;
@@ -617,7 +773,9 @@ void TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) {
++it) {
RaiseEvent(&TransportManagerListener::OnDeviceRemoved, *it);
}
+
LOG4CXX_TRACE(logger_, "exit");
+ return added_devices.size() + removed_devices.size() > 0;
}
void TransportManagerImpl::PostMessage(
@@ -718,9 +876,9 @@ TransportManagerImpl::ConnectionInternal*
TransportManagerImpl::GetActiveConnection(
const DeviceUID& device, const ApplicationHandle& application) {
LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "DeviceUID: " << device
- << " ApplicationHandle: " << application);
+ LOG4CXX_DEBUG(
+ logger_,
+ "DeviceUID: " << device << " ApplicationHandle: " << application);
for (std::vector<ConnectionInternal>::iterator it = connections_.begin();
it != connections_.end();
++it) {
@@ -766,9 +924,9 @@ void TransportManagerImpl::TryDeviceSwitch(
IOSBTAdapterFinder());
if (transport_adapters_.end() == ios_bt_adapter) {
- LOG4CXX_WARN(
- logger_,
- "There is no iAP2 Bluetooth adapter found. Switching is not possible.");
+ LOG4CXX_WARN(logger_,
+ "There is no iAP2 Bluetooth adapter found. Switching is not "
+ "possible.");
return;
}
@@ -869,9 +1027,9 @@ bool TransportManagerImpl::UpdateDeviceMapping(
item = device_to_adapter_map_.begin();
}
- LOG4CXX_DEBUG(logger_,
- "After cleanup. Device map size is "
- << device_to_adapter_map_.size());
+ LOG4CXX_DEBUG(
+ logger_,
+ "After cleanup. Device map size is " << device_to_adapter_map_.size());
for (DeviceList::const_iterator it = adapter_device_list.begin();
it != adapter_device_list.end();
@@ -881,10 +1039,10 @@ bool TransportManagerImpl::UpdateDeviceMapping(
device_to_adapter_map_.insert(std::make_pair(device_uid, ta));
if (!result.second) {
LOG4CXX_WARN(logger_,
- "Device UID "
- << device_uid
- << " is known already. Processing skipped."
- "Connection type is: " << ta->GetConnectionType());
+ "Device UID " << device_uid
+ << " is known already. Processing skipped."
+ "Connection type is: "
+ << ta->GetConnectionType());
continue;
}
DeviceHandle device_handle =
@@ -896,9 +1054,9 @@ bool TransportManagerImpl::UpdateDeviceMapping(
RaiseEvent(&TransportManagerListener::OnDeviceFound, info);
}
- LOG4CXX_DEBUG(logger_,
- "After update. Device map size is "
- << device_to_adapter_map_.size());
+ LOG4CXX_DEBUG(
+ logger_,
+ "After update. Device map size is " << device_to_adapter_map_.size());
return true;
}
@@ -909,7 +1067,12 @@ void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) {
LOG4CXX_ERROR(logger_, "Device list update failed.");
return;
}
- UpdateDeviceList(ta);
+
+ if (!UpdateDeviceList(ta)) {
+ LOG4CXX_DEBUG(logger_, "Device list was not changed");
+ return;
+ }
+
std::vector<DeviceInfo> device_infos;
device_list_lock_.AcquireForReading();
for (DeviceInfoList::const_iterator it = device_list_.begin();
@@ -924,6 +1087,13 @@ void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) {
void TransportManagerImpl::Handle(TransportAdapterEvent event) {
LOG4CXX_TRACE(logger_, "enter");
+
+ if (!events_processing_is_active_) {
+ LOG4CXX_DEBUG(logger_, "Waiting for events handling unlock");
+ sync_primitives::AutoLock auto_lock(events_processing_lock_);
+ events_processing_cond_var_.Wait(auto_lock);
+ }
+
switch (event.event_type) {
case EventTypeEnum::ON_SEARCH_DONE: {
RaiseEvent(&TransportManagerListener::OnScanDevicesFinished);
@@ -952,22 +1122,93 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
LOG4CXX_DEBUG(logger_, "event_type = ON_FIND_NEW_APPLICATIONS_REQUEST");
break;
}
+ case EventTypeEnum::ON_CONNECTION_STATUS_UPDATED: {
+ RaiseEvent(&TransportManagerListener::OnConnectionStatusUpdated);
+ LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECTION_STATUS_UPDATED");
+ break;
+ }
+ case EventTypeEnum::ON_CONNECT_PENDING: {
+ const DeviceHandle device_handle = converter_.UidToHandle(
+ event.device_uid, event.transport_adapter->GetConnectionType());
+ int connection_id = 0;
+ std::vector<ConnectionInternal>::iterator it = connections_.begin();
+ std::vector<ConnectionInternal>::iterator end = connections_.end();
+ for (; it != end; ++it) {
+ if (it->transport_adapter != event.transport_adapter) {
+ continue;
+ } else if (it->Connection::device != event.device_uid) {
+ continue;
+ } else if (it->Connection::application != event.application_id) {
+ continue;
+ } else if (it->device_handle_ != device_handle) {
+ continue;
+ } else {
+ LOG4CXX_DEBUG(logger_, "Connection Object Already Exists");
+ connection_id = it->Connection::id;
+ break;
+ }
+ }
+
+ if (it == end) {
+ AddConnection(ConnectionInternal(this,
+ event.transport_adapter,
+ ++connection_id_counter_,
+ event.device_uid,
+ event.application_id,
+ device_handle));
+ connection_id = connection_id_counter_;
+ }
+
+ RaiseEvent(
+ &TransportManagerListener::OnConnectionPending,
+ DeviceInfo(device_handle,
+ event.device_uid,
+ event.transport_adapter->DeviceName(event.device_uid),
+ event.transport_adapter->GetConnectionType()),
+ connection_id);
+ LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_PENDING");
+ break;
+ }
case EventTypeEnum::ON_CONNECT_DONE: {
const DeviceHandle device_handle = converter_.UidToHandle(
event.device_uid, event.transport_adapter->GetConnectionType());
- AddConnection(ConnectionInternal(this,
- event.transport_adapter,
- ++connection_id_counter_,
- event.device_uid,
- event.application_id,
- device_handle));
+
+ int connection_id = 0;
+ std::vector<ConnectionInternal>::iterator it = connections_.begin();
+ std::vector<ConnectionInternal>::iterator end = connections_.end();
+ for (; it != end; ++it) {
+ if (it->transport_adapter != event.transport_adapter) {
+ continue;
+ } else if (it->Connection::device != event.device_uid) {
+ continue;
+ } else if (it->Connection::application != event.application_id) {
+ continue;
+ } else if (it->device_handle_ != device_handle) {
+ continue;
+ } else {
+ LOG4CXX_DEBUG(logger_, "Connection Object Already Exists");
+ connection_id = it->Connection::id;
+ break;
+ }
+ }
+
+ if (it == end) {
+ AddConnection(ConnectionInternal(this,
+ event.transport_adapter,
+ ++connection_id_counter_,
+ event.device_uid,
+ event.application_id,
+ device_handle));
+ connection_id = connection_id_counter_;
+ }
+
RaiseEvent(
&TransportManagerListener::OnConnectionEstablished,
DeviceInfo(device_handle,
event.device_uid,
event.transport_adapter->DeviceName(event.device_uid),
event.transport_adapter->GetConnectionType()),
- connection_id_counter_);
+ connection_id);
LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_DONE");
break;
}
@@ -1066,7 +1307,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
LOG4CXX_ERROR(logger_, "Transport adapter failed to send data");
// TODO(YK): potential error case -> thread unsafe
// update of message content
- if (event.event_data.valid()) {
+ if (event.event_data.use_count() != 0) {
event.event_data->set_waiting(true);
} else {
LOG4CXX_DEBUG(logger_, "Data is invalid");
@@ -1144,6 +1385,13 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
LOG4CXX_DEBUG(logger_, "eevent_type = ON_UNEXPECTED_DISCONNECT");
break;
}
+ case EventTypeEnum::ON_TRANSPORT_CONFIG_UPDATED: {
+ LOG4CXX_DEBUG(logger_, "event_type = ON_TRANSPORT_CONFIG_UPDATED");
+ transport_adapter::TransportConfig config =
+ event.transport_adapter->GetTransportConfiguration();
+ RaiseEvent(&TransportManagerListener::OnTransportConfigUpdated, config);
+ break;
+ }
} // switch
LOG4CXX_TRACE(logger_, "exit");
}
@@ -1156,6 +1404,13 @@ void TransportManagerImpl::SetTelemetryObserver(TMTelemetryObserver* observer) {
void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) {
LOG4CXX_TRACE(logger_, "enter");
+
+ if (!events_processing_is_active_) {
+ LOG4CXX_DEBUG(logger_, "Waiting for events handling unlock");
+ sync_primitives::AutoLock auto_lock(events_processing_lock_);
+ events_processing_cond_var_.Wait(auto_lock);
+ }
+
sync_primitives::AutoReadLock lock(connections_lock_);
ConnectionInternal* connection = GetConnection(msg->connection_key());
if (connection == NULL) {
@@ -1203,9 +1458,9 @@ TransportManagerImpl::ConnectionInternal::ConnectionInternal(
const DeviceHandle device_handle)
: transport_manager(transport_manager)
, transport_adapter(transport_adapter)
- , timer(utils::MakeShared<timer::Timer,
- const char*,
- ::timer::TimerTaskImpl<ConnectionInternal>*>(
+ , timer(std::make_shared<timer::Timer,
+ const char*,
+ ::timer::TimerTaskImpl<ConnectionInternal>*>(
"TM DiscRoutine",
new ::timer::TimerTaskImpl<ConnectionInternal>(
this, &ConnectionInternal::DisconnectFailedRoutine)))
diff --git a/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc b/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc
index 33709cf0f6..7d7fb49e6e 100644
--- a/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc
+++ b/src/components/transport_manager/src/usb/libusb/platform_usb_device.cc
@@ -83,5 +83,5 @@ std::string PlatformUsbDevice::GetSerialNumber() const {
return GetDescString(device_descriptor_.iSerialNumber);
}
-} // namespace
-} // namespace
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/usb/libusb/usb_connection.cc b/src/components/transport_manager/src/usb/libusb/usb_connection.cc
index e9ab2bae8e..4b7b22394d 100644
--- a/src/components/transport_manager/src/usb/libusb/usb_connection.cc
+++ b/src/components/transport_manager/src/usb/libusb/usb_connection.cc
@@ -38,8 +38,8 @@
#include <sstream>
-#include "transport_manager/usb/libusb/usb_connection.h"
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+#include "transport_manager/usb/libusb/usb_connection.h"
#include "utils/logger.h"
@@ -137,7 +137,7 @@ void UsbConnection::OnInTransfer(libusb_transfer* transfer) {
<< transfer->actual_length << ", data:"
<< hex_data(transfer->buffer, transfer->actual_length));
::protocol_handler::RawMessagePtr data(new protocol_handler::RawMessage(
- 0, 0, in_buffer_, transfer->actual_length));
+ 0, 0, in_buffer_, transfer->actual_length, false));
controller_->DataReceiveDone(device_uid_, app_handle_, data);
} else {
LOG4CXX_ERROR(logger_,
@@ -159,26 +159,30 @@ void UsbConnection::OnInTransfer(libusb_transfer* transfer) {
LOG4CXX_TRACE(logger_, "exit");
}
-void UsbConnection::PopOutMessage() {
+TransportAdapter::Error UsbConnection::PopOutMessage() {
LOG4CXX_TRACE(logger_, "enter");
bytes_sent_ = 0;
+ auto error_code = TransportAdapter::OK;
if (out_messages_.empty()) {
current_out_message_.reset();
} else {
current_out_message_ = out_messages_.front();
out_messages_.pop_front();
- PostOutTransfer();
+ error_code = PostOutTransfer();
}
LOG4CXX_TRACE(logger_, "exit");
+ return error_code;
}
-bool UsbConnection::PostOutTransfer() {
+TransportAdapter::Error UsbConnection::PostOutTransfer() {
LOG4CXX_TRACE(logger_, "enter");
out_transfer_ = libusb_alloc_transfer(0);
- if (0 == out_transfer_) {
+ if (nullptr == out_transfer_) {
LOG4CXX_ERROR(logger_, "libusb_alloc_transfer failed");
- LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: 0 == out_transfer_");
- return false;
+ LOG4CXX_TRACE(logger_,
+ "exit with TransportAdapter::BAD_STATE. Condition: nullptr "
+ "== out_transfer_");
+ return TransportAdapter::BAD_STATE;
}
libusb_fill_bulk_transfer(out_transfer_,
device_handle_,
@@ -192,43 +196,50 @@ bool UsbConnection::PostOutTransfer() {
if (LIBUSB_SUCCESS != libusb_ret) {
LOG4CXX_ERROR(
logger_,
- "libusb_submit_transfer failed: " << libusb_error_name(libusb_ret)
- << ". Abort connection.");
- AbortConnection();
+ "libusb_submit_transfer failed: " << libusb_error_name(libusb_ret));
LOG4CXX_TRACE(logger_,
- "exit with FALSE. Condition: "
+ "exit with TransportAdapter::FAIL. Condition: "
<< "LIBUSB_SUCCESS != libusb_fill_bulk_transfer");
- return false;
+ return TransportAdapter::FAIL;
}
- LOG4CXX_TRACE(logger_, "exit with TRUE");
- return true;
+ LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK");
+ return TransportAdapter::OK;
}
void UsbConnection::OnOutTransfer(libusb_transfer* transfer) {
LOG4CXX_TRACE(logger_, "enter with Libusb_transfer*: " << transfer);
- sync_primitives::AutoLock locker(out_messages_mutex_);
- if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
- bytes_sent_ += transfer->actual_length;
- if (bytes_sent_ == current_out_message_->data_size()) {
- LOG4CXX_DEBUG(
+ auto error_code = TransportAdapter::OK;
+ {
+ sync_primitives::AutoLock locker(out_messages_mutex_);
+ if (LIBUSB_TRANSFER_COMPLETED == transfer->status) {
+ bytes_sent_ += transfer->actual_length;
+ if (current_out_message_->data_size() == bytes_sent_) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "USB out transfer, data sent: " << current_out_message_.get());
+ controller_->DataSendDone(
+ device_uid_, app_handle_, current_out_message_);
+ error_code = PopOutMessage();
+ }
+ } else {
+ LOG4CXX_ERROR(
logger_,
- "USB out transfer, data sent: " << current_out_message_.get());
- controller_->DataSendDone(device_uid_, app_handle_, current_out_message_);
- PopOutMessage();
+ "USB out transfer failed: " << libusb_error_name(transfer->status));
+ controller_->DataSendFailed(
+ device_uid_, app_handle_, current_out_message_, DataSendError());
+ error_code = PopOutMessage();
+ }
+ if (current_out_message_.use_count() == 0) {
+ libusb_free_transfer(transfer);
+ out_transfer_ = nullptr;
+ waiting_out_transfer_cancel_ = false;
}
- } else {
- LOG4CXX_ERROR(
- logger_,
- "USB out transfer failed: " << libusb_error_name(transfer->status));
- controller_->DataSendFailed(
- device_uid_, app_handle_, current_out_message_, DataSendError());
- PopOutMessage();
}
- if (!current_out_message_.valid()) {
- libusb_free_transfer(transfer);
- out_transfer_ = NULL;
- waiting_out_transfer_cancel_ = false;
+
+ if (TransportAdapter::FAIL == error_code) {
+ AbortConnection();
}
+
LOG4CXX_TRACE(logger_, "exit");
}
@@ -241,22 +252,35 @@ TransportAdapter::Error UsbConnection::SendData(
<< "disconnecting_");
return TransportAdapter::BAD_STATE;
}
- sync_primitives::AutoLock locker(out_messages_mutex_);
- if (current_out_message_.valid()) {
- out_messages_.push_back(message);
- } else {
- current_out_message_ = message;
- if (!PostOutTransfer()) {
- controller_->DataSendFailed(
- device_uid_, app_handle_, message, DataSendError());
- LOG4CXX_TRACE(
- logger_,
- "exit with TransportAdapter::FAIL. Condition: !PostOutTransfer()");
- return TransportAdapter::FAIL;
+
+ auto process_message = [this, &message]() {
+ sync_primitives::AutoLock locker(out_messages_mutex_);
+ if (current_out_message_.use_count() == 0) {
+ current_out_message_ = message;
+ return PostOutTransfer();
}
+ out_messages_.push_back(message);
+ return TransportAdapter::OK;
+ };
+
+ auto error_code = process_message();
+
+ if (TransportAdapter::OK == error_code) {
+ LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK.");
+ return TransportAdapter::OK;
}
- LOG4CXX_TRACE(logger_, "exit with TransportAdapter::OK.");
- return TransportAdapter::OK;
+
+ controller_->DataSendFailed(
+ device_uid_, app_handle_, message, DataSendError());
+
+ if (TransportAdapter::FAIL == error_code) {
+ AbortConnection();
+ }
+
+ LOG4CXX_TRACE(logger_,
+ "exit with TransportAdapter::FAIL. PostOutTransfer сondition: "
+ << error_code);
+ return TransportAdapter::FAIL;
}
void UsbConnection::Finalise() {
@@ -293,9 +317,9 @@ void UsbConnection::Finalise() {
void UsbConnection::AbortConnection() {
LOG4CXX_TRACE(logger_, "enter");
+ Finalise();
controller_->ConnectionAborted(
device_uid_, app_handle_, CommunicationError());
- Disconnect();
LOG4CXX_TRACE(logger_, "exit");
}
diff --git a/src/components/transport_manager/src/usb/libusb/usb_handler.cc b/src/components/transport_manager/src/usb/libusb/usb_handler.cc
index c62e80d1be..d1fc0af7f7 100644
--- a/src/components/transport_manager/src/usb/libusb/usb_handler.cc
+++ b/src/components/transport_manager/src/usb/libusb/usb_handler.cc
@@ -33,14 +33,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <cstring>
#include <cstdlib>
+#include <cstring>
-#include "transport_manager/usb/common.h"
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+#include "transport_manager/usb/common.h"
-#include "utils/macro.h"
#include "utils/logger.h"
+#include "utils/macro.h"
#include "utils/threads/thread.h"
namespace transport_manager {
@@ -77,12 +77,12 @@ class UsbHandler::ControlTransferSequenceState {
UsbHandler::UsbHandler()
: shutdown_requested_(false)
- , thread_(NULL)
+ , thread_(nullptr)
, usb_device_listeners_()
, devices_()
, transfer_sequences_()
, device_handles_to_close_()
- , libusb_context_(NULL)
+ , libusb_context_(nullptr)
, arrived_callback_handle_()
, left_callback_handle_() {
thread_ = threads::CreateThread("UsbHandler", new UsbHandlerDelegate(this));
@@ -90,20 +90,24 @@ UsbHandler::UsbHandler()
UsbHandler::~UsbHandler() {
shutdown_requested_ = true;
- if (libusb_context_ != 0) {
+ LOG4CXX_INFO(logger_, "UsbHandler thread finished");
+
+ if (libusb_context_) {
+ // The libusb_hotplug_deregister_callback() wakes up blocking call of
+ // libusb_handle_events_completed() in the Thread() method of delegate
libusb_hotplug_deregister_callback(libusb_context_,
arrived_callback_handle_);
libusb_hotplug_deregister_callback(libusb_context_, left_callback_handle_);
}
- thread_->stop();
- LOG4CXX_INFO(logger_, "UsbHandler thread finished");
- if (libusb_context_) {
- libusb_exit(libusb_context_);
- libusb_context_ = 0;
- }
+
thread_->join();
delete thread_->delegate();
threads::DeleteThread(thread_);
+
+ if (libusb_context_) {
+ libusb_exit(libusb_context_);
+ libusb_context_ = nullptr;
+ }
}
void UsbHandler::DeviceArrived(libusb_device* device_libusb) {
@@ -518,5 +522,11 @@ void UsbHandler::UsbHandlerDelegate::threadMain() {
handler_->Thread();
}
+void UsbHandler::UsbHandlerDelegate::exitThreadMain() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ // Empty method required in order to avoid force delegate thread
+ // finishing by exitThreadMain() of the base class
+}
+
} // namespace transport_adapter
} // namespace transport_manager
diff --git a/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc b/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc
index e85ab12b10..bb6e341659 100644
--- a/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc
+++ b/src/components/transport_manager/src/usb/qnx/platform_usb_device.cc
@@ -76,5 +76,5 @@ std::string PlatformUsbDevice::GetSerialNumber() const {
return GetDescString(device_descriptor_.iSerialNumber);
}
-} // namespace
-} // namespace
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/usb/qnx/usb_connection.cc b/src/components/transport_manager/src/usb/qnx/usb_connection.cc
index 516a367ebc..2945639ce9 100644
--- a/src/components/transport_manager/src/usb/qnx/usb_connection.cc
+++ b/src/components/transport_manager/src/usb/qnx/usb_connection.cc
@@ -37,8 +37,8 @@
#include <sched.h>
#include <cstring>
-#include "transport_manager/usb/qnx/usb_connection.h"
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+#include "transport_manager/usb/qnx/usb_connection.h"
#include "utils/logger.h"
@@ -144,7 +144,7 @@ void UsbConnection::OnInTransfer(usbd_urb* urb) {
device_uid_, app_handle_, DataReceiveError());
} else {
::protocol_handler::RawMessagePtr msg(
- new protocol_handler::RawMessage(0, 0, in_buffer_, len));
+ new protocol_handler::RawMessage(0, 0, in_buffer_, len, false));
controller_->DataReceiveDone(device_uid_, app_handle_, msg);
}
@@ -230,7 +230,7 @@ void UsbConnection::OnOutTransfer(usbd_urb* urb) {
}
}
- if ((!disconnecting_) && current_out_message_.valid()) {
+ if ((!disconnecting_) && (current_out_message_.use_count() != 0)) {
PostOutTransfer();
} else {
pending_out_transfer_ = false;
@@ -243,7 +243,7 @@ TransportAdapter::Error UsbConnection::SendData(
return TransportAdapter::BAD_STATE;
}
sync_primitives::AutoLock locker(out_messages_mutex_);
- if (current_out_message_.valid()) {
+ if (current_out_message_.use_count() != 0) {
out_messages_.push_back(message);
} else {
current_out_message_ = message;
diff --git a/src/components/transport_manager/src/usb/qnx/usb_handler.cc b/src/components/transport_manager/src/usb/qnx/usb_handler.cc
index 2336a05f16..9ac4a40d92 100644
--- a/src/components/transport_manager/src/usb/qnx/usb_handler.cc
+++ b/src/components/transport_manager/src/usb/qnx/usb_handler.cc
@@ -35,11 +35,11 @@
#include <errno.h>
-#include <cstring>
#include <cstdlib>
+#include <cstring>
-#include "transport_manager/usb/common.h"
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+#include "transport_manager/usb/common.h"
#include "utils/logger.h"
@@ -321,5 +321,5 @@ TransportAdapter::Error UsbHandler::Init() {
return TransportAdapter::OK;
}
-} // namespace
-} // namespace
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc
index b7faf1ef6b..9ce571eb6c 100644
--- a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc
+++ b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc
@@ -34,21 +34,21 @@
*/
#include "transport_manager/usb/usb_aoa_adapter.h"
-#include "transport_manager/usb/usb_device_scanner.h"
-#include "transport_manager/usb/usb_connection_factory.h"
#include "transport_manager/usb/common.h"
+#include "transport_manager/usb/usb_connection_factory.h"
+#include "transport_manager/usb/usb_device_scanner.h"
#include "utils/logger.h"
namespace transport_manager {
namespace transport_adapter {
CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
-UsbAoaAdapter::UsbAoaAdapter(resumption::LastState& last_state,
+UsbAoaAdapter::UsbAoaAdapter(resumption::LastStateWrapperPtr last_state_wrapper,
const TransportManagerSettings& settings)
- : TransportAdapterImpl(new UsbDeviceScanner(this),
+ : TransportAdapterImpl(new UsbDeviceScanner(this, settings),
new UsbConnectionFactory(this),
NULL,
- last_state,
+ last_state_wrapper,
settings)
, is_initialised_(false)
, usb_handler_(new UsbHandler()) {
diff --git a/src/components/transport_manager/src/usb/usb_connection_factory.cc b/src/components/transport_manager/src/usb/usb_connection_factory.cc
index 1136dfad21..401dde2534 100644
--- a/src/components/transport_manager/src/usb/usb_connection_factory.cc
+++ b/src/components/transport_manager/src/usb/usb_connection_factory.cc
@@ -31,10 +31,9 @@
*/
#include "transport_manager/usb/usb_connection_factory.h"
-#include "transport_manager/usb/usb_device.h"
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+#include "transport_manager/usb/usb_device.h"
#include "utils/logger.h"
-#include "utils/make_shared.h"
#if defined(__QNXNTO__)
#include "transport_manager/usb/qnx/usb_connection.h"
@@ -65,21 +64,21 @@ TransportAdapter::Error UsbConnectionFactory::CreateConnection(
"enter DeviceUID: " << &device_uid
<< ", ApplicationHandle: " << &app_handle);
DeviceSptr device = controller_->FindDevice(device_uid);
- if (!device.valid()) {
+ if (device.use_count() == 0) {
LOG4CXX_ERROR(logger_, "device " << device_uid << " not found");
- LOG4CXX_TRACE(
- logger_,
- "exit with TransportAdapter::BAD_PARAM. Condition: !device.valid()");
+ LOG4CXX_TRACE(logger_,
+ "exit with TransportAdapter::BAD_PARAM. Condition: "
+ "device.use_count() == 0");
return TransportAdapter::BAD_PARAM;
}
UsbDevice* usb_device = static_cast<UsbDevice*>(device.get());
- utils::SharedPtr<UsbConnection> connection =
- utils::MakeShared<UsbConnection>(device_uid,
- app_handle,
- controller_,
- usb_handler_,
- usb_device->usb_device());
+ std::shared_ptr<UsbConnection> connection =
+ std::make_shared<UsbConnection>(device_uid,
+ app_handle,
+ controller_,
+ usb_handler_,
+ usb_device->usb_device());
controller_->ConnectionCreated(connection, device_uid, app_handle);
if (connection->Init()) {
LOG4CXX_INFO(logger_, "USB connection initialised");
diff --git a/src/components/transport_manager/src/usb/usb_device_scanner.cc b/src/components/transport_manager/src/usb/usb_device_scanner.cc
index 092fd29f1a..51d521c1bf 100644
--- a/src/components/transport_manager/src/usb/usb_device_scanner.cc
+++ b/src/components/transport_manager/src/usb/usb_device_scanner.cc
@@ -33,9 +33,9 @@
#include <sstream>
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
-#include "transport_manager/usb/usb_device_scanner.h"
-#include "transport_manager/usb/usb_device.h"
#include "transport_manager/usb/common.h"
+#include "transport_manager/usb/usb_device.h"
+#include "transport_manager/usb/usb_device_scanner.h"
#include "utils/logger.h"
@@ -47,6 +47,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
class AoaInitSequence : public UsbControlTransferSequence {
public:
AoaInitSequence();
+ AoaInitSequence(const TransportManagerSettings& settings);
virtual ~AoaInitSequence() {}
private:
@@ -86,8 +87,9 @@ void UsbDeviceScanner::OnDeviceLeft(PlatformUsbDevice* device) {
}
}
-UsbDeviceScanner::UsbDeviceScanner(TransportAdapterController* controller)
- : controller_(controller) {}
+UsbDeviceScanner::UsbDeviceScanner(TransportAdapterController* controller,
+ const TransportManagerSettings& settings)
+ : controller_(controller), settings_(settings) {}
UsbDeviceScanner::~UsbDeviceScanner() {}
@@ -171,28 +173,29 @@ class AoaInitSequence::AoaTurnIntoAccessoryMode : public UsbControlOutTransfer {
}
};
-static char manufacturer[] = "SDL";
-static char model_name[] = "Core";
-static char description[] = "SmartDeviceLink Core Component USB";
-static char version[] = "1.0";
-static char uri[] = "http://www.smartdevicelink.org";
-static char serial_num[] = "N000000";
-
-AoaInitSequence::AoaInitSequence() : UsbControlTransferSequence() {
+AoaInitSequence::AoaInitSequence(const TransportManagerSettings& settings)
+ : UsbControlTransferSequence() {
+ auto manufacturer = settings.aoa_filter_manufacturer().c_str();
+ auto model_name = settings.aoa_filter_model_name().c_str();
+ auto description = settings.aoa_filter_description().c_str();
+ auto version = settings.aoa_filter_version().c_str();
+ auto uri = settings.aoa_filter_uri().c_str();
+ auto serial_num = settings.aoa_filter_serial_number().c_str();
AddTransfer(new AoaGetProtocolRequest);
- AddTransfer(new AoaSendIdString(0, manufacturer, sizeof(manufacturer)));
- AddTransfer(new AoaSendIdString(1, model_name, sizeof(model_name)));
- AddTransfer(new AoaSendIdString(2, description, sizeof(description)));
- AddTransfer(new AoaSendIdString(3, version, sizeof(version)));
- AddTransfer(new AoaSendIdString(4, uri, sizeof(uri)));
- AddTransfer(new AoaSendIdString(5, serial_num, sizeof(serial_num)));
+ AddTransfer(new AoaSendIdString(0, manufacturer, strlen(manufacturer)));
+ AddTransfer(new AoaSendIdString(1, model_name, strlen(model_name)));
+ AddTransfer(new AoaSendIdString(2, description, strlen(description)));
+ AddTransfer(new AoaSendIdString(3, version, strlen(version)));
+ AddTransfer(new AoaSendIdString(4, uri, strlen(uri)));
+ AddTransfer(new AoaSendIdString(5, serial_num, strlen(serial_num)));
AddTransfer(new AoaTurnIntoAccessoryMode);
}
void UsbDeviceScanner::TurnIntoAccessoryMode(PlatformUsbDevice* device) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "PlatformUsbDevice: " << device);
- GetUsbHandler()->StartControlTransferSequence(new AoaInitSequence, device);
+ GetUsbHandler()->StartControlTransferSequence(new AoaInitSequence(settings_),
+ device);
}
void UsbDeviceScanner::SupportedDeviceFound(PlatformUsbDevice* device) {
@@ -247,5 +250,5 @@ bool UsbDeviceScanner::IsInitialised() const {
return true;
}
-} // namespace
-} // namespace
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/websocket_server/websocket_connection.cc b/src/components/transport_manager/src/websocket_server/websocket_connection.cc
new file mode 100644
index 0000000000..7bcc4baef2
--- /dev/null
+++ b/src/components/transport_manager/src/websocket_server/websocket_connection.cc
@@ -0,0 +1,218 @@
+/*
+Copyright (c) 2020 Livio, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of SmartDeviceLink Consortium, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "transport_manager/websocket_server/websocket_connection.h"
+#include <unistd.h>
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+CREATE_LOGGERPTR_GLOBAL(wsc_logger_, "WebSocketConnection")
+
+using namespace boost::beast::websocket;
+
+template <>
+WebSocketConnection<WebSocketSession<> >::WebSocketConnection(
+ const DeviceUID& device_uid,
+ const ApplicationHandle& app_handle,
+ boost::asio::ip::tcp::socket socket,
+ TransportAdapterController* controller)
+ : device_uid_(device_uid)
+ , app_handle_(app_handle)
+ , session_(new WebSocketSession<>(
+ std::move(socket),
+ std::bind(
+ &WebSocketConnection::DataReceive, this, std::placeholders::_1),
+ std::bind(&WebSocketConnection::OnError, this)))
+ , controller_(controller)
+ , shutdown_(false)
+ , thread_delegate_(new LoopThreadDelegate(
+ &message_queue_,
+ std::bind(&WebSocketSession<>::WriteDown,
+ session_.get(),
+ std::placeholders::_1),
+ std::bind(&WebSocketConnection::OnError, this)))
+ , thread_(threads::CreateThread("WS Async Send", thread_delegate_)) {
+ thread_->start(threads::ThreadOptions());
+}
+
+#ifdef ENABLE_SECURITY
+template <>
+WebSocketConnection<WebSocketSecureSession<> >::WebSocketConnection(
+ const DeviceUID& device_uid,
+ const ApplicationHandle& app_handle,
+ boost::asio::ip::tcp::socket socket,
+ ssl::context& ctx,
+ TransportAdapterController* controller)
+ : device_uid_(device_uid)
+ , app_handle_(app_handle)
+ , session_(new WebSocketSecureSession<>(
+ std::move(socket),
+ ctx,
+ std::bind(
+ &WebSocketConnection::DataReceive, this, std::placeholders::_1),
+ std::bind(&WebSocketConnection::OnError, this)))
+ , controller_(controller)
+ , shutdown_(false)
+ , thread_delegate_(new LoopThreadDelegate(
+ &message_queue_,
+ std::bind(&WebSocketSecureSession<>::WriteDown,
+ session_.get(),
+ std::placeholders::_1),
+ std::bind(&WebSocketConnection::OnError, this)))
+ , thread_(threads::CreateThread("WS Async Send", thread_delegate_)) {
+ thread_->start(threads::ThreadOptions());
+}
+template class WebSocketConnection<WebSocketSecureSession<> >;
+#endif // ENABLE_SECURITY
+
+template <typename Session>
+WebSocketConnection<Session>::~WebSocketConnection() {
+ if (!IsShuttingDown()) {
+ Shutdown();
+ }
+}
+
+template <typename Session>
+void WebSocketConnection<Session>::OnError() {
+ LOG4CXX_AUTO_TRACE(wsc_logger_);
+
+ controller_->ConnectionAborted(
+ device_uid_, app_handle_, CommunicationError());
+
+ session_->Shutdown();
+}
+
+template <typename Session>
+TransportAdapter::Error WebSocketConnection<Session>::Disconnect() {
+ LOG4CXX_AUTO_TRACE(wsc_logger_);
+ if (!IsShuttingDown()) {
+ Shutdown();
+ controller_->DisconnectDone(device_uid_, app_handle_);
+ return TransportAdapter::OK;
+ }
+ return TransportAdapter::BAD_STATE;
+}
+
+template <typename Session>
+TransportAdapter::Error WebSocketConnection<Session>::SendData(
+ ::protocol_handler::RawMessagePtr message) {
+ if (IsShuttingDown()) {
+ return TransportAdapter::BAD_STATE;
+ }
+
+ message_queue_.push(message);
+
+ return TransportAdapter::OK;
+}
+
+template <typename Session>
+void WebSocketConnection<Session>::DataReceive(
+ protocol_handler::RawMessagePtr frame) {
+ controller_->DataReceiveDone(device_uid_, app_handle_, frame);
+}
+
+template <typename Session>
+void WebSocketConnection<Session>::Run() {
+ LOG4CXX_AUTO_TRACE(wsc_logger_);
+ session_->AsyncAccept();
+}
+
+template <typename Session>
+void WebSocketConnection<Session>::Shutdown() {
+ LOG4CXX_AUTO_TRACE(wsc_logger_);
+ shutdown_ = true;
+ if (thread_delegate_) {
+ session_->Shutdown();
+ thread_delegate_->SetShutdown();
+ thread_->join();
+ delete thread_delegate_;
+ thread_delegate_ = nullptr;
+ threads::DeleteThread(thread_);
+ thread_ = nullptr;
+ }
+}
+
+template <typename Session>
+bool WebSocketConnection<Session>::IsShuttingDown() {
+ return shutdown_;
+}
+
+template <typename Session>
+WebSocketConnection<Session>::LoopThreadDelegate::LoopThreadDelegate(
+ MessageQueue<Message, AsyncQueue>* message_queue,
+ DataWriteCallback data_write,
+ OnIOErrorCallback on_io_error)
+ : message_queue_(*message_queue)
+ , data_write_(data_write)
+ , on_io_error_(on_io_error) {}
+
+template <typename Session>
+void WebSocketConnection<Session>::LoopThreadDelegate::threadMain() {
+ while (!message_queue_.IsShuttingDown()) {
+ DrainQueue();
+ message_queue_.wait();
+ }
+ DrainQueue();
+}
+
+template <typename Session>
+void WebSocketConnection<Session>::LoopThreadDelegate::exitThreadMain() {
+ if (!message_queue_.IsShuttingDown()) {
+ message_queue_.Shutdown();
+ }
+}
+
+template <typename Session>
+void WebSocketConnection<Session>::LoopThreadDelegate::DrainQueue() {
+ Message message_ptr;
+ while (!message_queue_.IsShuttingDown() && message_queue_.pop(message_ptr)) {
+ auto res = data_write_(message_ptr);
+ if (TransportAdapter::FAIL == res) {
+ LOG4CXX_WARN(wsc_logger_,
+ "Writing to websocket stream failed. Will now close "
+ "websocket connection.");
+ on_io_error_();
+ }
+ }
+}
+
+template <typename Session>
+void WebSocketConnection<Session>::LoopThreadDelegate::SetShutdown() {
+ if (!message_queue_.IsShuttingDown()) {
+ message_queue_.Shutdown();
+ }
+}
+
+template class WebSocketConnection<WebSocketSession<> >;
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/websocket_server/websocket_device.cc b/src/components/transport_manager/src/websocket_server/websocket_device.cc
new file mode 100644
index 0000000000..502daf349b
--- /dev/null
+++ b/src/components/transport_manager/src/websocket_server/websocket_device.cc
@@ -0,0 +1,94 @@
+/*
+ *
+ * Copyright (c) 2020, Livio
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "transport_manager/websocket_server/websocket_device.h"
+
+#include "utils/logger.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
+
+WebSocketDevice::WebSocketDevice(const std::string& name,
+ const DeviceUID& unique_device_id)
+ : Device(name, unique_device_id)
+ , is_secure_connect_(false)
+ , protocol_(boost::asio::ip::tcp::v4()) {}
+
+bool WebSocketDevice::IsSameAs(const Device* other) const {
+ LOG4CXX_TRACE(logger_, "enter. device: " << other);
+
+ const WebSocketDevice* other_websocket_device =
+ dynamic_cast<const WebSocketDevice*>(other);
+
+ if (!other_websocket_device) {
+ return false;
+ }
+
+ if (GetHost() != other_websocket_device->GetHost()) {
+ return false;
+ }
+
+ if (GetPort() != other_websocket_device->GetPort()) {
+ return false;
+ }
+
+ if (GetTarget() != other_websocket_device->GetTarget()) {
+ return false;
+ }
+
+ return true;
+}
+
+ApplicationList WebSocketDevice::GetApplicationList() const {
+ return app_list_;
+}
+
+const std::string& WebSocketDevice::GetHost() const {
+ return host_;
+}
+
+const std::string& WebSocketDevice::GetPort() const {
+ return port_;
+}
+
+const std::string WebSocketDevice::GetTarget() const {
+ return host_ + port_ + name();
+}
+
+void WebSocketDevice::AddApplication(const ApplicationHandle& app_handle) {
+ app_list_.push_back(app_handle);
+}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/websocket_server/websocket_listener.cc b/src/components/transport_manager/src/websocket_server/websocket_listener.cc
new file mode 100644
index 0000000000..87fff3acbc
--- /dev/null
+++ b/src/components/transport_manager/src/websocket_server/websocket_listener.cc
@@ -0,0 +1,299 @@
+#include "transport_manager/websocket_server/websocket_listener.h"
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
+#include "transport_manager/websocket_server/websocket_device.h"
+#include "utils/file_system.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+CREATE_LOGGERPTR_GLOBAL(logger_, "WebSocketListener")
+
+WebSocketListener::WebSocketListener(TransportAdapterController* controller,
+ const TransportManagerSettings& settings,
+ const int num_threads)
+ : controller_(controller)
+ , ioc_(num_threads)
+#ifdef ENABLE_SECURITY
+ , ctx_(ssl::context::sslv23)
+ , start_secure_(false)
+#endif // ENABLE_SECURITY
+ , acceptor_(ioc_)
+ , socket_(ioc_)
+ , io_pool_(new boost::asio::thread_pool(num_threads))
+ , num_threads_(num_threads)
+ , shutdown_(false)
+ , settings_(settings) {
+}
+
+WebSocketListener::~WebSocketListener() {
+ Terminate();
+}
+
+TransportAdapter::Error WebSocketListener::Init() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto old_shutdown_value = shutdown_.exchange(false);
+ if (old_shutdown_value) {
+ ioc_.restart();
+ io_pool_.reset(new boost::asio::thread_pool(num_threads_));
+ }
+ return StartListening();
+}
+
+void WebSocketListener::Terminate() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ Shutdown();
+}
+
+TransportAdapter::Error WebSocketListener::StartListening() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (acceptor_.is_open()) {
+ return TransportAdapter::OK;
+ }
+
+#ifdef ENABLE_SECURITY
+ auto const ta_error = AddCertificateAuthority();
+ if (TransportAdapter::OK != ta_error) {
+ return ta_error;
+ }
+#endif
+
+ auto const address =
+ boost::asio::ip::make_address(settings_.websocket_server_address());
+ tcp::endpoint endpoint = {address, settings_.websocket_server_port()};
+
+ // Open the acceptor
+ boost::system::error_code ec;
+ acceptor_.open(endpoint.protocol(), ec);
+ if (ec) {
+ auto str_err = "ErrorOpen: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ str_err << " host/port: " << endpoint.address().to_string()
+ << "/" << endpoint.port());
+ return TransportAdapter::FAIL;
+ }
+
+ acceptor_.set_option(boost::asio::socket_base::reuse_address(true), ec);
+ if (ec) {
+ std::string str_err = "ErrorSetOption: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ str_err << " host/port: " << endpoint.address().to_string()
+ << "/" << endpoint.port());
+ return TransportAdapter::FAIL;
+ }
+
+ // Bind to the server address
+ acceptor_.bind(endpoint, ec);
+ if (ec) {
+ std::string str_err = "ErrorBind: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ str_err << " host/port: " << endpoint.address().to_string()
+ << "/" << endpoint.port());
+ return TransportAdapter::FAIL;
+ }
+
+ // Start listening for connections
+ acceptor_.listen(boost::asio::socket_base::max_listen_connections, ec);
+ if (ec) {
+ std::string str_err = "ErrorListen: " + ec.message();
+ LOG4CXX_ERROR(logger_,
+ str_err << " host/port: " << endpoint.address().to_string()
+ << "/" << endpoint.port());
+ return TransportAdapter::FAIL;
+ }
+
+ if (false == Run()) {
+ return TransportAdapter::FAIL;
+ }
+
+ return TransportAdapter::OK;
+}
+
+#ifdef ENABLE_SECURITY
+TransportAdapter::Error WebSocketListener::AddCertificateAuthority() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const auto cert_path = settings_.ws_server_cert_path();
+ LOG4CXX_DEBUG(logger_, "Path to certificate : " << cert_path);
+ const auto key_path = settings_.ws_server_key_path();
+ LOG4CXX_DEBUG(logger_, "Path to key : " << key_path);
+ const auto ca_cert_path = settings_.ws_server_ca_cert_path();
+ LOG4CXX_DEBUG(logger_, "Path to ca cert : " << ca_cert_path);
+ start_secure_ = settings_.wss_server_supported();
+
+ if (start_secure_ && (!file_system::FileExists(cert_path) ||
+ !file_system::FileExists(key_path) ||
+ !file_system::FileExists(ca_cert_path))) {
+ LOG4CXX_ERROR(logger_, "Certificate or key file not found");
+ return TransportAdapter::FAIL;
+ }
+
+ if (!start_secure_) {
+ auto check_config = [](const std::string& config,
+ const std::string config_name) {
+ bool start_unsecure = config.empty();
+ if (!start_unsecure) {
+ LOG4CXX_ERROR(logger_,
+ "Configuration for secure WS is incomplete. "
+ << config_name
+ << " config is "
+ "present, meanwhile others may be missing. Please "
+ "check INI file");
+ }
+ return start_unsecure;
+ };
+ if (!check_config(cert_path, "Server cert") ||
+ !check_config(key_path, "Server key") ||
+ !check_config(ca_cert_path, "CA cert")) {
+ return TransportAdapter::FAIL;
+ }
+ } else {
+ LOG4CXX_INFO(logger_, "WebSocket server will start secure connection");
+ ctx_.add_verify_path(cert_path);
+ ctx_.set_options(boost::asio::ssl::context::default_workarounds);
+ using context = boost::asio::ssl::context_base;
+ ctx_.set_verify_mode(ssl::verify_peer | ssl::verify_fail_if_no_peer_cert);
+ boost::system::error_code sec_ec;
+ ctx_.use_certificate_chain_file(cert_path, sec_ec);
+ ctx_.load_verify_file(ca_cert_path);
+ if (sec_ec) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Loading WS server certificate failed: " << sec_ec.message());
+ return TransportAdapter::FAIL;
+ }
+ sec_ec.clear();
+ ctx_.use_private_key_file(key_path, context::pem, sec_ec);
+ if (sec_ec) {
+ LOG4CXX_ERROR(logger_,
+ "Loading WS server key failed: " << sec_ec.message());
+ return TransportAdapter::FAIL;
+ }
+ }
+
+ return TransportAdapter::OK;
+}
+#endif // ENABLE_SECURITY
+
+bool WebSocketListener::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const bool is_connection_open = WaitForConnection();
+ if (is_connection_open) {
+ boost::asio::post(*io_pool_.get(), [&]() { ioc_.run(); });
+ } else {
+ LOG4CXX_ERROR(logger_, "Connection is shutdown or acceptor isn't open");
+ }
+
+ return is_connection_open;
+}
+
+bool WebSocketListener::WaitForConnection() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!shutdown_ && acceptor_.is_open()) {
+ acceptor_.async_accept(
+ socket_,
+ std::bind(
+ &WebSocketListener::StartSession, this, std::placeholders::_1));
+ return true;
+ }
+ return false;
+}
+
+template <>
+void WebSocketListener::ProcessConnection(
+ std::shared_ptr<WebSocketConnection<WebSocketSession<> > > connection,
+ const DeviceSptr device,
+ const ApplicationHandle app_handle) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ controller_->ConnectionCreated(
+ connection, device->unique_device_id(), app_handle);
+
+ controller_->ConnectDone(device->unique_device_id(), app_handle);
+
+ connection->Run();
+
+ connection_list_lock.Acquire();
+ connection_list_.push_back(connection);
+ connection_list_lock.Release();
+
+ WaitForConnection();
+}
+
+#ifdef ENABLE_SECURITY
+template <>
+void WebSocketListener::ProcessConnection(
+ std::shared_ptr<WebSocketConnection<WebSocketSecureSession<> > > connection,
+ const DeviceSptr device,
+ const ApplicationHandle app_handle) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ controller_->ConnectionCreated(
+ connection, device->unique_device_id(), app_handle);
+
+ controller_->ConnectDone(device->unique_device_id(), app_handle);
+
+ connection->Run();
+
+ connection_list_lock.Acquire();
+ connection_list_.push_back(connection);
+ connection_list_lock.Release();
+
+ WaitForConnection();
+}
+#endif // ENABLE_SECURITY
+
+void WebSocketListener::StartSession(boost::system::error_code ec) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (ec) {
+ std::string str_err = "ErrorAccept: " + ec.message();
+ LOG4CXX_ERROR(logger_, str_err);
+ return;
+ }
+
+ if (shutdown_) {
+ return;
+ }
+
+ const ApplicationHandle app_handle = socket_.native_handle();
+
+ std::shared_ptr<WebSocketDevice> device =
+ std::static_pointer_cast<WebSocketDevice>(
+ controller_->GetWebEngineDevice());
+
+ LOG4CXX_INFO(logger_, "Connected client: " << app_handle);
+
+#ifdef ENABLE_SECURITY
+ if (start_secure_) {
+ auto connection =
+ std::make_shared<WebSocketConnection<WebSocketSecureSession<> > >(
+ device->unique_device_id(),
+ app_handle,
+ std::move(socket_),
+ ctx_,
+ controller_);
+ ProcessConnection(connection, device, app_handle);
+ return;
+ }
+#endif // ENABLE_SECURITY
+
+ auto connection = std::make_shared<WebSocketConnection<WebSocketSession<> > >(
+ device->unique_device_id(), app_handle, std::move(socket_), controller_);
+ ProcessConnection(connection, device, app_handle);
+}
+
+void WebSocketListener::Shutdown() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (false == shutdown_.exchange(true)) {
+ ioc_.stop();
+ socket_.close();
+ boost::system::error_code ec;
+ acceptor_.close(ec);
+
+ if (ec) {
+ LOG4CXX_ERROR(logger_, "Acceptor closed with error: " << ec);
+ }
+
+ io_pool_->stop();
+ io_pool_->join();
+ }
+}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc b/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc
new file mode 100644
index 0000000000..9be94119b6
--- /dev/null
+++ b/src/components/transport_manager/src/websocket_server/websocket_secure_session.cc
@@ -0,0 +1,79 @@
+/*
+Copyright (c) 2020 Livio, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of SmartDeviceLink Consortium, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "transport_manager/websocket_server/websocket_secure_session.h"
+#include <unistd.h>
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+using namespace boost::beast::websocket;
+
+template <typename ExecutorType>
+WebSocketSecureSession<ExecutorType>::WebSocketSecureSession(
+ tcp::socket socket,
+ ssl::context& ctx,
+ DataReceiveCallback data_receive,
+ OnIOErrorCallback on_error)
+ : WebSocketSession<ExecutorType>(
+ std::move(socket), ctx, data_receive, on_error) {}
+
+template <typename ExecutorType>
+void WebSocketSecureSession<ExecutorType>::AsyncAccept() {
+ LOG4CXX_AUTO_TRACE(ws_logger_);
+ // Perform the SSL handshake
+ WebSocketSecureSession<ExecutorType>::ws_.next_layer().async_handshake(
+ ssl::stream_base::server,
+ boost::asio::bind_executor(
+ WebSocketSecureSession<ExecutorType>::strand_,
+ std::bind(&WebSocketSecureSession::AsyncHandshake,
+ this->shared_from_this(),
+ std::placeholders::_1)));
+}
+
+template <typename ExecutorType>
+void WebSocketSecureSession<ExecutorType>::AsyncHandshake(
+ boost::system::error_code ec) {
+ LOG4CXX_AUTO_TRACE(ws_logger_);
+ if (ec) {
+ auto str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(ws_logger_, str_err);
+ WebSocketSession<ExecutorType>::on_io_error_();
+ return;
+ }
+
+ WebSocketSession<ExecutorType>::AsyncAccept();
+}
+
+template class WebSocketSecureSession<ssl::stream<tcp::socket&> >;
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc
new file mode 100644
index 0000000000..ac8789eee8
--- /dev/null
+++ b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "transport_manager/websocket_server/websocket_server_transport_adapter.h"
+
+#include <errno.h>
+#include <memory.h>
+#include <signal.h>
+#include <stdio.h>
+
+#include <cstdlib>
+#include <sstream>
+
+#include "transport_manager/websocket_server/websocket_listener.h"
+#include "utils/gen_hash.h"
+#include "utils/logger.h"
+#include "utils/threads/thread_delegate.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "WebSocketTransportAdapter")
+
+WebSocketServerTransportAdapter::WebSocketServerTransportAdapter(
+ resumption::LastStateWrapperPtr last_state_wrapper,
+ const TransportManagerSettings& settings)
+ : TransportAdapterImpl(nullptr,
+ nullptr,
+ new WebSocketListener(this, settings),
+ last_state_wrapper,
+ settings) {}
+
+WebSocketServerTransportAdapter::~WebSocketServerTransportAdapter() {}
+
+void WebSocketServerTransportAdapter::TransportConfigUpdated(
+ const TransportConfig& new_config) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ transport_config_ = new_config;
+
+ // call the method of parent class to trigger OnTransportConfigUpdated() for
+ // the listeners
+ TransportAdapterImpl::TransportConfigUpdated(new_config);
+}
+
+TransportConfig WebSocketServerTransportAdapter::GetTransportConfiguration()
+ const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return transport_config_;
+}
+
+DeviceType WebSocketServerTransportAdapter::GetDeviceType() const {
+ return WEBENGINE_WEBSOCKET;
+}
+
+DeviceSptr WebSocketServerTransportAdapter::AddDevice(DeviceSptr device) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ webengine_device_ = device;
+ Store();
+ return TransportAdapterImpl::AddDevice(webengine_device_);
+}
+
+TransportAdapter::Error WebSocketServerTransportAdapter::Init() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (webengine_device_) {
+ AddDevice(webengine_device_);
+ }
+ return TransportAdapterImpl::Init();
+}
+
+void WebSocketServerTransportAdapter::Store() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (webengine_device_) {
+ Json::Value& dictionary = last_state().get_dictionary();
+ if (dictionary["TransportManager"].isMember("WebsocketServerAdapter")) {
+ LOG4CXX_DEBUG(
+ logger_, "WebsocketServerAdapter already exists. Storing is skipped");
+ return;
+ }
+
+ Json::Value device_dictionary;
+ device_dictionary["unique_id"] = webengine_device_->unique_device_id();
+
+ Json::Value ws_adapter_dictionary;
+ ws_adapter_dictionary["device"] = device_dictionary;
+ dictionary["TransportManager"]["WebsocketServerAdapter"] =
+ ws_adapter_dictionary;
+ }
+}
+
+bool WebSocketServerTransportAdapter::Restore() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const Json::Value& dictionary = last_state().get_dictionary();
+ const Json::Value ws_adapter_dictionary =
+ dictionary["TransportManager"]["WebsocketServerAdapter"];
+ webengine_device_id_ =
+ ws_adapter_dictionary["device"]["unique_id"].asString();
+ if (webengine_device_id_.empty()) {
+ srand(time(0));
+ const size_t device_id_length = 64u;
+ webengine_device_id_ = utils::gen_hash(device_id_length);
+ }
+ return true;
+}
+
+std::string WebSocketServerTransportAdapter::GetStoredDeviceID() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return webengine_device_id_;
+}
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/src/websocket_server/websocket_session.cc b/src/components/transport_manager/src/websocket_server/websocket_session.cc
new file mode 100644
index 0000000000..ab62530963
--- /dev/null
+++ b/src/components/transport_manager/src/websocket_server/websocket_session.cc
@@ -0,0 +1,162 @@
+/*
+Copyright (c) 2020 Livio, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of SmartDeviceLink Consortium, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "transport_manager/websocket_server/websocket_session.h"
+#include <unistd.h>
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+using namespace boost::beast::websocket;
+
+template <>
+WebSocketSession<tcp::socket&>::WebSocketSession(
+ boost::asio::ip::tcp::socket socket,
+ DataReceiveCallback data_receive,
+ OnIOErrorCallback on_error)
+ : socket_(std::move(socket))
+ , ws_(socket_)
+ , strand_(ws_.get_executor())
+ , data_receive_(data_receive)
+ , on_io_error_(on_error) {
+ ws_.binary(true);
+}
+
+#ifdef ENABLE_SECURITY
+template <>
+WebSocketSession<ssl::stream<tcp::socket&> >::WebSocketSession(
+ boost::asio::ip::tcp::socket socket,
+ ssl::context& ctx,
+ DataReceiveCallback data_receive,
+ OnIOErrorCallback on_error)
+ : socket_(std::move(socket))
+ , ws_(socket_, ctx)
+ , strand_(ws_.get_executor())
+ , data_receive_(data_receive)
+ , on_io_error_(on_error) {
+ ws_.binary(true);
+}
+template class WebSocketSession<ssl::stream<tcp::socket&> >;
+#endif // ENABLE_SECURITY
+
+template <typename ExecutorType>
+WebSocketSession<ExecutorType>::~WebSocketSession() {}
+
+template <typename ExecutorType>
+void WebSocketSession<ExecutorType>::AsyncAccept() {
+ LOG4CXX_AUTO_TRACE(ws_logger_);
+ ws_.async_accept(
+ boost::asio::bind_executor(strand_,
+ std::bind(&WebSocketSession::AsyncRead,
+ this->shared_from_this(),
+ std::placeholders::_1)));
+}
+
+template <typename ExecutorType>
+void WebSocketSession<ExecutorType>::AsyncRead(boost::system::error_code ec) {
+ LOG4CXX_AUTO_TRACE(ws_logger_);
+ if (ec) {
+ auto str_err = "ErrorMessage: " + ec.message();
+ LOG4CXX_ERROR(ws_logger_, str_err);
+ return;
+ }
+
+ ws_.async_read(buffer_,
+ boost::asio::bind_executor(strand_,
+ std::bind(&WebSocketSession::Read,
+ this->shared_from_this(),
+ std::placeholders::_1,
+ std::placeholders::_2)));
+}
+
+template <typename ExecutorType>
+TransportAdapter::Error WebSocketSession<ExecutorType>::WriteDown(
+ ::protocol_handler::RawMessagePtr message) {
+ boost::system::error_code ec;
+ ws_.write(boost::asio::buffer(message->data(), message->data_size()), ec);
+
+ if (ec) {
+ LOG4CXX_ERROR(ws_logger_, "A system error has occurred: " << ec.message());
+ return TransportAdapter::FAIL;
+ }
+
+ return TransportAdapter::OK;
+}
+
+template <typename ExecutorType>
+void WebSocketSession<ExecutorType>::Read(boost::system::error_code ec,
+ std::size_t bytes_transferred) {
+ LOG4CXX_AUTO_TRACE(ws_logger_);
+ boost::ignore_unused(bytes_transferred);
+ if (ec) {
+ LOG4CXX_ERROR(ws_logger_, ec.message());
+ buffer_.consume(buffer_.size());
+ on_io_error_();
+ return;
+ }
+
+ auto size = buffer_.size();
+ const auto data = boost::asio::buffer_cast<const uint8_t*>(
+ boost::beast::buffers_front(buffer_.data()));
+
+ LOG4CXX_DEBUG(ws_logger_,
+ "Msg: " << boost::beast::buffers_to_string(buffer_.data())
+ << " Size: " << size;);
+
+ ::protocol_handler::RawMessagePtr frame(
+ new protocol_handler::RawMessage(0, 0, data, size, false));
+
+ data_receive_(frame);
+
+ buffer_.consume(buffer_.size());
+ AsyncRead(ec);
+}
+
+template <typename ExecutorType>
+bool WebSocketSession<ExecutorType>::Shutdown() {
+ LOG4CXX_AUTO_TRACE(ws_logger_);
+ boost::system::error_code ec;
+ if (socket_.is_open()) {
+ socket_.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
+ socket_.close();
+ }
+ buffer_.consume(buffer_.size());
+ if (ec) {
+ LOG4CXX_ERROR(ws_logger_, ec.message());
+ return false;
+ }
+ return true;
+}
+
+template class WebSocketSession<tcp::socket&>;
+
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/test/CMakeLists.txt b/src/components/transport_manager/test/CMakeLists.txt
index 41aae296ac..76680b2fad 100644
--- a/src/components/transport_manager/test/CMakeLists.txt
+++ b/src/components/transport_manager/test/CMakeLists.txt
@@ -42,11 +42,32 @@ include_directories(
)
set(EXCLUDE_PATHS
+ platform_specific
raw_message_matcher.cc
)
+if (NOT BUILD_CLOUD_APP_SUPPORT)
+ list(APPEND EXCLUDE_PATHS
+ ${CMAKE_CURRENT_SOURCE_DIR}/sample_websocket_server.cc
+ )
+endif()
+
+if (NOT BUILD_WEBSOCKET_SERVER_SUPPORT)
+ list(APPEND EXCLUDE_PATHS
+ ${CMAKE_CURRENT_SOURCE_DIR}/websocket_client_connection_test.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/websocket_connection_test.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/websocket_server_listener_test.cc
+ )
+endif()
+
collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}" "${EXCLUDE_PATHS}")
+set(PLATFORM_DEPENDENT_SOURCES)
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ collect_sources(PLATFORM_DEPENDENT_SOURCES platform_specific/linux)
+endif()
+list(APPEND SOURCES ${PLATFORM_DEPENDENT_SOURCES})
+
set(LIBRARIES
gmock
ConfigProfile
@@ -68,6 +89,12 @@ if (BUILD_BT_SUPPORT)
endif()
endif()
+if(BUILD_CLOUD_APP_SUPPORT)
+ GET_PROPERTY(BOOST_LIBS_DIRECTORY GLOBAL PROPERTY GLOBAL_BOOST_LIBS)
+ list(APPEND LIBRARIES boost_system boost_regex crypto ssl -L${BOOST_LIBS_DIRECTORY})
+endif()
+
create_test("transport_manager_test" "${SOURCES}" "${LIBRARIES}")
file(COPY smartDeviceLink_test.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY "test_certs/" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/test_certs)
diff --git a/src/components/transport_manager/test/include/transport_manager/bt/mock_bluetooth_transport_adapter.h b/src/components/transport_manager/test/include/transport_manager/bt/mock_bluetooth_transport_adapter.h
new file mode 100644
index 0000000000..ffd8cd9647
--- /dev/null
+++ b/src/components/transport_manager/test/include/transport_manager/bt/mock_bluetooth_transport_adapter.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_BT_MOCK_BLUETOOTH_TRANSPORT_ADAPTER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_BT_MOCK_BLUETOOTH_TRANSPORT_ADAPTER_H_
+
+#include "transport_manager/transport_adapter/mock_transport_adapter.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+using namespace ::transport_manager::transport_adapter;
+
+class MockBluetoothTransportAdapter : public MockTransportAdapter {
+ public:
+ MOCK_CONST_METHOD0(GetDeviceType, DeviceType());
+ MOCK_CONST_METHOD0(Store, void());
+ MOCK_METHOD0(Restore, bool());
+};
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_BT_MOCK_BLUETOOTH_TRANSPORT_ADAPTER_H_
diff --git a/src/components/transport_manager/test/include/transport_manager/cloud/mock_cloud_websocket_transport_adapter.h b/src/components/transport_manager/test/include/transport_manager/cloud/mock_cloud_websocket_transport_adapter.h
new file mode 100644
index 0000000000..6e74ae759f
--- /dev/null
+++ b/src/components/transport_manager/test/include/transport_manager/cloud/mock_cloud_websocket_transport_adapter.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_CLOUD_MOCK_CLOUD_WEBSOCKET_TRANSPORT_ADAPTER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_CLOUD_MOCK_CLOUD_WEBSOCKET_TRANSPORT_ADAPTER_H_
+
+#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+using namespace ::transport_manager::transport_adapter;
+
+class MockCloudWebsocketTransportAdapter
+ : public CloudWebsocketTransportAdapter {
+ public:
+ MockCloudWebsocketTransportAdapter(
+ resumption::LastStateWrapperPtr last_state_wrapper,
+ const transport_manager::TransportManagerSettings& settings)
+ : CloudWebsocketTransportAdapter(last_state_wrapper, settings) {}
+ MOCK_CONST_METHOD0(GetDeviceType, DeviceType());
+ MOCK_CONST_METHOD0(Store, void());
+ MOCK_METHOD0(Restore, bool());
+ MOCK_CONST_METHOD0(IsInitialised, bool());
+ MOCK_METHOD1(AddListener, void(TransportAdapterListener* listener));
+ MOCK_METHOD0(Init, TransportAdapter::Error());
+ MOCK_METHOD0(Terminate, void());
+};
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_CLOUD_MOCK_CLOUD_WEBSOCKET_TRANSPORT_ADAPTER_H_
diff --git a/src/components/transport_manager/test/include/transport_manager/cloud/sample_websocket_server.h b/src/components/transport_manager/test/include/transport_manager/cloud/sample_websocket_server.h
new file mode 100644
index 0000000000..e29f182059
--- /dev/null
+++ b/src/components/transport_manager/test/include/transport_manager/cloud/sample_websocket_server.h
@@ -0,0 +1,165 @@
+
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_CLOUD_SAMPLE_WEBSOCKET_SERVER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_CLOUD_SAMPLE_WEBSOCKET_SERVER_H_
+
+#include <boost/asio/bind_executor.hpp>
+#include <boost/asio/ip/tcp.hpp>
+#include <boost/asio/placeholders.hpp>
+#include <boost/asio/ssl/stream.hpp>
+#include <boost/asio/strand.hpp>
+#include <boost/asio/thread_pool.hpp>
+#include <boost/beast/core.hpp>
+#include <boost/beast/websocket.hpp>
+#include <boost/beast/websocket/ssl.hpp>
+#include <boost/make_shared.hpp>
+#include <boost/thread/thread.hpp>
+#include <iostream>
+#include <queue>
+#include <set>
+#include <string>
+#include <thread>
+
+namespace sample {
+namespace websocket {
+
+namespace beast = boost::beast; // from <boost/beast.hpp>
+namespace http = beast::http; // from <boost/beast/http.hpp>
+namespace websocket = beast::websocket; // from <boost/beast/websocket.hpp>
+namespace net = boost::asio; // from <boost/asio.hpp>
+namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
+using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
+
+// Accepts incoming connections and launches the WSServer
+class WSSession : public std::enable_shared_from_this<WSSession> {
+ private:
+ class WSServer : public std::enable_shared_from_this<WSServer> {
+ public:
+ explicit WSServer(tcp::socket&& socket);
+ void AddURLRoute(const std::string& route);
+ // Start the asynchronous operation
+ void Run();
+
+ private:
+ void OnWebsocketHandshake(const boost::system::error_code& ec);
+ void OnAccept(beast::error_code ec);
+ // Check if route can be handled by the server
+ bool CanHandleRoute(const std::string& route);
+ std::string ParseRouteFromTarget(const std::string& target);
+
+ websocket::stream<tcp::socket> ws_;
+ beast::flat_buffer buffer_;
+ boost::asio::strand<boost::asio::io_context::executor_type> strand_;
+ http::request<http::string_body> req_;
+ std::set<std::string> url_routes_;
+ };
+
+ public:
+ WSSession(const std::string& address, uint16_t port);
+ // Start Accepting incoming connections
+ void Run();
+ void Stop();
+ // Add route endpoint which can be handled the server
+ void AddRoute(const std::string& route);
+
+ private:
+ void on_accept(boost::system::error_code ec);
+ boost::asio::io_context ioc_;
+ boost::asio::thread_pool io_pool_;
+ const std::string& address_;
+ uint16_t port_;
+ tcp::acceptor acceptor_;
+ tcp::socket socket_;
+ beast::flat_buffer buffer_;
+ boost::asio::ip::tcp::endpoint endpoint_;
+ std::shared_ptr<WSServer> ws_;
+ std::queue<std::string> buffered_routes_;
+};
+
+// Accepts incoming connections and launches the sessions
+class WSSSession : public std::enable_shared_from_this<WSSSession> {
+ private:
+ class WSSServer : public std::enable_shared_from_this<WSSServer> {
+ public:
+ // Take ownership of the socket
+ WSSServer(tcp::socket&& socket, ssl::context& ctx);
+ void AddURLRoute(const std::string& route);
+ // Start the asynchronous operation
+ void Run();
+
+ private:
+ void OnSSLHandshake(beast::error_code ec);
+ void OnWebsocketHandshake(const boost::system::error_code& ec);
+ void OnAccept(beast::error_code ec);
+
+ // Check if route can be handled by the server
+ bool CanHandleRoute(const std::string& route);
+ std::string ParseRouteFromTarget(const std::string& target);
+
+ websocket::stream<ssl::stream<tcp::socket> > wss_;
+ beast::flat_buffer buffer_;
+ http::request<http::string_body> req_;
+ std::set<std::string> url_routes_;
+ };
+
+ public:
+ WSSSession(const std::string& address,
+ uint16_t port,
+ const std::string& certificate,
+ const std::string& private_key);
+ // Start accepting incoming connections
+ void Run();
+ void Stop();
+ // Add route endpoint which can be handled the server
+ void AddRoute(const std::string& route);
+
+ private:
+ void do_accept();
+ void on_accept(boost::system::error_code ec);
+
+ private:
+ boost::asio::io_context ioc_;
+ boost::asio::thread_pool io_pool_;
+ tcp::acceptor acceptor_;
+ tcp::socket socket_;
+ ssl::context ctx_;
+ tcp::endpoint endpoint_;
+ std::shared_ptr<WSSServer> wss_;
+ std::queue<std::string> buffered_routes_;
+};
+
+} // namespace websocket
+} // namespace sample
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_CLOUD_SAMPLE_WEBSOCKET_SERVER_H_
diff --git a/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h b/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h
index e94586a856..758d22dae2 100644
--- a/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h
+++ b/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h
@@ -33,10 +33,10 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_IMPL_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_IMPL_H_
-#include "gmock/gmock.h"
#include "config_profile/profile.h"
-#include "transport_manager/transport_manager_impl.h"
+#include "gmock/gmock.h"
#include "transport_manager/mock_transport_manager_settings.h"
+#include "transport_manager/transport_manager_impl.h"
#include "transport_manager/transport_manager_settings.h"
namespace test {
diff --git a/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_listener.h b/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_listener.h
index 58e143342a..0c9ca959e9 100644
--- a/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_listener.h
+++ b/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_listener.h
@@ -33,10 +33,10 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_LISTENER_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_LISTENER_H_
-#include <vector>
#include <gmock/gmock.h>
-#include "transport_manager/transport_manager_listener.h"
+#include <vector>
#include "protocol/raw_message.h"
+#include "transport_manager/transport_manager_listener.h"
namespace test {
namespace components {
@@ -56,6 +56,9 @@ class MockTransportManagerListener : public TransportManagerListener {
MOCK_METHOD1(OnDeviceRemoved, void(const DeviceInfo& device_info));
MOCK_METHOD0(OnScanDevicesFinished, void());
MOCK_METHOD1(OnScanDevicesFailed, void(const SearchDeviceError& error));
+ MOCK_METHOD2(OnConnectionPending,
+ void(const DeviceInfo& device_info,
+ const ConnectionUID connection_id));
MOCK_METHOD2(OnConnectionEstablished,
void(const DeviceInfo& device_info,
const ConnectionUID connection_id));
diff --git a/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h b/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h
index bb15c19d3b..2ee699096f 100644
--- a/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h
+++ b/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h
@@ -38,8 +38,8 @@
#include <gmock/gmock.h>
-#include "transport_manager/common.h"
#include "protocol/common.h"
+#include "transport_manager/common.h"
using ::testing::Matcher;
using ::testing::MatcherInterface;
@@ -57,8 +57,8 @@ class RawMessageMatcher : public MatcherInterface<RawMessagePtr> {
virtual bool MatchAndExplain(const RawMessagePtr ptr,
MatchResultListener* listener) const;
- virtual void DescribeTo(::std::ostream* os) const;
- virtual void DescribeNegationTo(::std::ostream* os) const;
+ virtual void DescribeTo(std::ostream* os) const;
+ virtual void DescribeNegationTo(std::ostream* os) const;
private:
const RawMessagePtr ptr_;
diff --git a/src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_client_listener.h b/src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_client_listener.h
new file mode 100644
index 0000000000..d18500b02d
--- /dev/null
+++ b/src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_client_listener.h
@@ -0,0 +1,34 @@
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TCP_MOCK_TCP_CLIENT_LISTENER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TCP_MOCK_TCP_CLIENT_LISTENER_H_
+
+#include "gmock/gmock.h"
+#include "transport_manager/tcp/tcp_client_listener.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+using namespace ::transport_manager::transport_adapter;
+
+class MockTcpClientListener : public TcpClientListener {
+ public:
+ MockTcpClientListener(TransportAdapterController* controller,
+ uint16_t port,
+ bool enable_keepalive,
+ const std::string designated_interface = "")
+ : TcpClientListener(
+ controller, port, enable_keepalive, designated_interface) {}
+ MOCK_METHOD0(Init, TransportAdapter::Error());
+ MOCK_METHOD0(Terminate, void());
+ MOCK_CONST_METHOD0(IsInitialised, bool());
+ MOCK_METHOD0(StartListening, TransportAdapter::Error());
+ MOCK_METHOD0(StopListening, TransportAdapter::Error());
+ MOCK_METHOD2(OnIPAddressUpdated,
+ void(const std::string ipv4_addr, const std::string ipv6_addr));
+};
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TCP_MOCK_TCP_CLIENT_LISTENER_H_
diff --git a/src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_transport_adapter.h b/src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_transport_adapter.h
index 432e4f3fa0..dbac183d32 100644
--- a/src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_transport_adapter.h
+++ b/src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_transport_adapter.h
@@ -33,9 +33,7 @@
#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TCP_MOCK_TCP_TRANSPORT_ADAPTER_H_
#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TCP_MOCK_TCP_TRANSPORT_ADAPTER_H_
-#include "gmock/gmock.h"
#include "transport_manager/tcp/tcp_transport_adapter.h"
-#include "transport_manager/transport_manager_settings.h"
namespace test {
namespace components {
@@ -47,17 +45,26 @@ class MockTCPTransportAdapter : public TcpTransportAdapter {
public:
MockTCPTransportAdapter(
uint16_t port,
- resumption::LastState& last_state,
+ resumption::LastStateWrapperPtr last_state_wrapper,
const transport_manager::TransportManagerSettings& settings)
- : TcpTransportAdapter(port, last_state, settings) {}
- MOCK_CONST_METHOD2(FindEstablishedConnection,
- ConnectionSPtr(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
+ : TcpTransportAdapter(port, last_state_wrapper, settings) {}
+ MOCK_CONST_METHOD2(
+ FindEstablishedConnection,
+ ConnectionSPtr(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle));
- MOCK_CONST_METHOD1(FindDevice, DeviceSptr(const DeviceUID& device_handle));
+ MOCK_CONST_METHOD1(
+ FindDevice,
+ DeviceSptr(const transport_manager::DeviceUID& device_handle));
MOCK_METHOD2(Connect,
- TransportAdapter::Error(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
+ TransportAdapter::Error(
+ const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle));
+
+ MOCK_CONST_METHOD0(IsInitialised, bool());
+ MOCK_METHOD1(AddListener, void(TransportAdapterListener* listener));
+ MOCK_METHOD0(Init, TransportAdapter::Error());
+ MOCK_METHOD0(Terminate, void());
void CallStore() {
Store();
}
diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_client_connection_listener.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_client_connection_listener.h
index 0f6f1e9f14..6d451294de 100644
--- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_client_connection_listener.h
+++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_client_connection_listener.h
@@ -51,6 +51,12 @@ class MockClientConnectionListener
StartListening,
::transport_manager::transport_adapter::TransportAdapter::Error());
MOCK_METHOD0(
+ SuspendListening,
+ ::transport_manager::transport_adapter::TransportAdapter::Error());
+ MOCK_METHOD0(
+ ResumeListening,
+ ::transport_manager::transport_adapter::TransportAdapter::Error());
+ MOCK_METHOD0(
StopListening,
::transport_manager::transport_adapter::TransportAdapter::Error());
};
diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_connection.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_connection.h
index d1f48c1ed9..7bb272c82e 100644
--- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_connection.h
+++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_connection.h
@@ -48,6 +48,7 @@ class MockConnection : public Connection {
SendData,
TransportAdapter::Error(::protocol_handler::RawMessagePtr message));
MOCK_METHOD0(Disconnect, TransportAdapter::Error());
+ MOCK_METHOD0(Terminate, void());
};
} // namespace transport_manager_test
diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_controller.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_controller.h
index 642c193d63..7ddb84001c 100644
--- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_controller.h
+++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_controller.h
@@ -45,53 +45,66 @@ using namespace ::transport_manager::transport_adapter;
class MockTransportAdapterController : public TransportAdapterController {
public:
MOCK_METHOD1(AddDevice, DeviceSptr(DeviceSptr device));
- MOCK_METHOD1(SearchDeviceDone, void(DeviceVector device));
+ MOCK_METHOD1(SearchDeviceDone, void(const DeviceVector& device));
MOCK_METHOD1(ApplicationListUpdated,
- ApplicationListUpdated(const DeviceUID& device_handle));
+ void(const transport_manager::DeviceUID& device_handle));
MOCK_METHOD0(FindNewApplicationsRequest, void());
- MOCK_METHOD1(SearchDeviceFailed, void(const SearchDeviceError& error));
- MOCK_CONST_METHOD1(FindDevice, DeviceSptr(const DeviceUID& device_handle));
- MOCK_CONST_METHOD3(FindDevice,
- void(ConnectionSPtr connection,
- const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
+ MOCK_METHOD1(SearchDeviceFailed,
+ void(const transport_manager::SearchDeviceError& error));
+ MOCK_CONST_METHOD1(
+ FindDevice,
+ DeviceSptr(const transport_manager::DeviceUID& device_handle));
+ MOCK_CONST_METHOD2(
+ FindPendingConnection,
+ ConnectionSPtr(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle));
+ MOCK_METHOD3(ConnectionCreated,
+ void(ConnectionSPtr connection,
+ const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle));
+ MOCK_METHOD2(ConnectPending,
+ void(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle));
MOCK_METHOD2(ConnectDone,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
+ void(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle));
MOCK_METHOD3(ConnectFailed,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const ConnectError& error));
+ void(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle,
+ const transport_manager::ConnectError& error));
MOCK_METHOD2(ConnectionFinished,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
+ void(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle));
MOCK_METHOD3(ConnectionAborted,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const CommunicationError& error));
+ void(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle,
+ const transport_manager::CommunicationError& error));
MOCK_METHOD2(DeviceDisconnected,
- void(const DeviceUID& device_handle,
- const DisconnectDeviceError& error));
+ void(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::DisconnectDeviceError& error));
MOCK_METHOD2(DisconnectDone,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
+ void(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle));
MOCK_METHOD3(DataReceiveDone,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
+ void(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message));
MOCK_METHOD3(DataReceiveFailed,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const DataReceiveError& error));
+ void(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle,
+ const transport_manager::DataReceiveError& error));
MOCK_METHOD3(DataSendDone,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
+ void(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message));
- MOCK_METHOD3(DataReceiveFailed,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
+
+ MOCK_METHOD4(DataSendFailed,
+ void(const transport_manager::DeviceUID& device_handle,
+ const transport_manager::ApplicationHandle& app_handle,
::protocol_handler::RawMessagePtr message,
- const DataSendError& error));
+ const transport_manager::DataSendError&));
+ MOCK_METHOD1(TransportConfigUpdated, void(const TransportConfig& new_config));
+ MOCK_CONST_METHOD0(GetWebEngineDevice, DeviceSptr());
};
} // namespace transport_manager_test
diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h
index 384f55605a..7b1d720ba2 100644
--- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h
+++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h
@@ -34,17 +34,19 @@
#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_MOCK_TRANSPORT_ADAPTER_IMPL_H_
#include "gmock/gmock.h"
-#include "transport_manager/transport_manager_settings.h"
+#include "transport_manager/common.h"
+#include "transport_manager/transport_adapter/device.h"
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+#include "transport_manager/transport_manager_settings.h"
-using ::transport_manager::transport_adapter::TransportAdapterImpl;
-using ::transport_manager::transport_adapter::DeviceScanner;
-using ::transport_manager::transport_adapter::ServerConnectionFactory;
+using ::transport_manager::ApplicationHandle;
+using ::transport_manager::DeviceUID;
using ::transport_manager::transport_adapter::ClientConnectionListener;
-using ::transport_manager::transport_adapter::DeviceType;
using ::transport_manager::transport_adapter::ConnectionSPtr;
-using ::transport_manager::DeviceUID;
-using ::transport_manager::ApplicationHandle;
+using ::transport_manager::transport_adapter::DeviceScanner;
+using ::transport_manager::transport_adapter::DeviceType;
+using ::transport_manager::transport_adapter::ServerConnectionFactory;
+using ::transport_manager::transport_adapter::TransportAdapterImpl;
namespace test {
namespace components {
@@ -56,29 +58,38 @@ class MockTransportAdapterImpl : public TransportAdapterImpl {
DeviceScanner* device_scanner,
ServerConnectionFactory* server_connection_factory,
ClientConnectionListener* client_connection_listener,
- resumption::LastState& last_state,
+ resumption::LastStateWrapperPtr last_state_wrapper,
const transport_manager::TransportManagerSettings& settings)
: TransportAdapterImpl(device_scanner,
server_connection_factory,
client_connection_listener,
- last_state,
+ last_state_wrapper,
settings) {}
+ DEPRECATED
+ MockTransportAdapterImpl(DeviceScanner*,
+ ServerConnectionFactory*,
+ ClientConnectionListener*,
+ resumption::LastState&,
+ const transport_manager::TransportManagerSettings&);
+
ConnectionSPtr FindStatedConnection(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) {
return this->FindEstablishedConnection(device_handle, app_handle);
}
virtual ~MockTransportAdapterImpl() {}
- virtual DeviceType GetDeviceType() const {
- return DeviceType::UNKNOWN;
- }
-
MOCK_CONST_METHOD0(Store, void());
MOCK_METHOD0(Restore, bool());
MOCK_CONST_METHOD1(FindDevice,
transport_manager::transport_adapter::DeviceSptr(
const DeviceUID& device_id));
+ MOCK_METHOD2(ConnectionStatusUpdated,
+ void(transport_manager::transport_adapter::DeviceSptr device,
+ ::transport_manager::ConnectionStatus status));
+ MOCK_CONST_METHOD0(GetDeviceType,
+ ::transport_manager::transport_adapter::DeviceType());
+ MOCK_METHOD0(RetryConnection, void());
};
} // namespace transport_manager_test
diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h
index 03e7630e8b..f7bebf69c3 100644
--- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h
+++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h
@@ -59,6 +59,12 @@ class MockTransportAdapterListener : public TransportAdapterListener {
const SearchDeviceError& error));
MOCK_METHOD1(OnFindNewApplicationsRequest,
void(const TransportAdapter* adapter));
+ MOCK_METHOD1(OnConnectionStatusUpdated,
+ void(const TransportAdapter* adapter));
+ MOCK_METHOD3(OnConnectPending,
+ void(const TransportAdapter* adapter,
+ const DeviceUID& device_handle,
+ const ApplicationHandle& app_id));
MOCK_METHOD1(OnDeviceListUpdated,
void(const TransportAdapter* transport_adapter));
MOCK_METHOD3(OnConnectDone,
@@ -122,6 +128,8 @@ class MockTransportAdapterListener : public TransportAdapterListener {
const ApplicationHandle&));
MOCK_METHOD1(OnTransportSwitchRequested,
void(const TransportAdapter* transport_adapter));
+ MOCK_METHOD1(OnTransportConfigUpdated,
+ void(const TransportAdapter* transport_adapter));
};
} // namespace transport_manager_test
diff --git a/src/components/transport_manager/test/include/transport_manager/usb/mock_usb_aoa_adapter.h b/src/components/transport_manager/test/include/transport_manager/usb/mock_usb_aoa_adapter.h
new file mode 100644
index 0000000000..affd6aee47
--- /dev/null
+++ b/src/components/transport_manager/test/include/transport_manager/usb/mock_usb_aoa_adapter.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_USB_MOCK_USB_AOA_ADAPTER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_USB_MOCK_USB_AOA_ADAPTER_H_
+
+#include "transport_manager/usb/usb_aoa_adapter.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+using namespace ::transport_manager::transport_adapter;
+
+class MockUsbAoaAdapter : public UsbAoaAdapter {
+ public:
+ MockUsbAoaAdapter(resumption::LastStateWrapperPtr last_state_wrapper,
+ const transport_manager::TransportManagerSettings& settings)
+ : UsbAoaAdapter(last_state_wrapper, settings) {}
+ MOCK_CONST_METHOD0(GetDeviceType, DeviceType());
+ MOCK_CONST_METHOD0(IsInitialised, bool());
+ MOCK_METHOD1(AddListener, void(TransportAdapterListener* listener));
+ MOCK_METHOD0(Init, TransportAdapter::Error());
+ MOCK_METHOD0(Terminate, void());
+
+ MOCK_CONST_METHOD1(ToBeAutoConnected, bool(DeviceSptr device));
+};
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_USB_MOCK_USB_AOA_ADAPTER_H_
diff --git a/src/components/transport_manager/test/include/transport_manager/websocket_server/websocket_sample_client.h b/src/components/transport_manager/test/include/transport_manager/websocket_server/websocket_sample_client.h
new file mode 100644
index 0000000000..138502e02c
--- /dev/null
+++ b/src/components/transport_manager/test/include/transport_manager/websocket_server/websocket_sample_client.h
@@ -0,0 +1,117 @@
+/*
+ * \file websocket_listener.h
+ * \brief WebSocketListener class header file.
+ *
+ * Copyright (c) 2020
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SAMPLE_CLIENT_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SAMPLE_CLIENT_
+
+#include <boost/asio/bind_executor.hpp>
+#include <boost/asio/connect.hpp>
+#include <boost/asio/ssl/stream.hpp>
+#include <boost/asio/strand.hpp>
+#include <boost/asio/thread_pool.hpp>
+#include <boost/beast/core.hpp>
+#include <boost/beast/websocket.hpp>
+#include <boost/beast/websocket/ssl.hpp>
+#include <boost/beast/websocket/stream.hpp>
+#include <cstdlib>
+#include <functional>
+#include <iostream>
+#include <memory>
+#include <string>
+
+namespace transport_manager {
+namespace transport_adapter {
+
+namespace beast = boost::beast;
+namespace http = beast::http;
+namespace websocket = beast::websocket;
+namespace asio = boost::asio;
+namespace ssl = boost::asio::ssl;
+using tcp = boost::asio::ip::tcp;
+
+using WS = websocket::stream<tcp::socket>;
+using WSS = websocket::stream<ssl::stream<tcp::socket> >;
+
+struct SecurityParams {
+ std::string ca_cert_;
+ std::string client_cert_;
+ std::string client_key_;
+};
+
+template <typename Stream = WS>
+class WSSampleClient
+ : public std::enable_shared_from_this<WSSampleClient<Stream> > {
+ public:
+ WSSampleClient(const std::string& host, const std::string& port);
+ WSSampleClient(const std::string& host,
+ const std::string& port,
+ const SecurityParams& params);
+ ~WSSampleClient() {}
+
+ /**
+ * @brief Inside a Run(), functions are invoked from the boost (connection,
+ * handshake, message) which are blocking calls
+ * @return true if Run() did without errors
+ **/
+ bool Run();
+
+ void OnRead(beast::error_code ec, std::size_t bytes_transferred);
+
+ bool Connect(tcp::resolver::results_type& results);
+
+ bool Handshake(const std::string& host, const std::string& target);
+
+ void OnHandshakeTimeout();
+
+ bool IsHandshakeSuccessful() const;
+
+ void Stop();
+
+ private:
+ asio::io_context ioc_;
+ tcp::resolver resolver_;
+ ssl::context ctx_;
+ std::unique_ptr<Stream> ws_;
+ boost::asio::thread_pool io_pool_;
+ beast::flat_buffer buffer_;
+ std::string host_;
+ std::string port_;
+ std::atomic_bool handshake_successful_;
+};
+
+} // namespace transport_adapter
+} // namespace transport_manager
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_WEBSOCKET_SERVER_WEBSOCKET_SAMPLE_CLIENT_
diff --git a/src/components/transport_manager/test/network_interface_listener_test.cc b/src/components/transport_manager/test/network_interface_listener_test.cc
new file mode 100644
index 0000000000..c6e007b62a
--- /dev/null
+++ b/src/components/transport_manager/test/network_interface_listener_test.cc
@@ -0,0 +1,57 @@
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <time.h>
+
+#include "gtest/gtest.h"
+#include "transport_manager/tcp/mock_tcp_client_listener.h"
+#include "transport_manager/tcp/network_interface_listener_impl.h"
+#include "utils/test_async_waiter.h"
+#include "utils/threads/thread.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+namespace {
+const long kThreadStartWaitMsec = 10;
+const uint32_t kStartNotificationTimeoutMsec = 500;
+} // namespace
+
+using ::testing::_;
+using ::testing::AtLeast;
+using ::testing::SaveArg;
+
+class NetworkInterfaceListenerTest : public ::testing::Test {
+ public:
+ NetworkInterfaceListenerTest()
+ : interface_listener_impl_(NULL)
+ , mock_tcp_client_listener_(NULL, 0, false, "") {}
+
+ virtual ~NetworkInterfaceListenerTest() {}
+
+ protected:
+ struct InterfaceEntry {
+ const char* name;
+ const char* ipv4_address;
+ const char* ipv6_address;
+ unsigned int flags;
+ };
+
+ void Deinit() {
+ delete interface_listener_impl_;
+ }
+
+ void SleepFor(long msec) const {
+ if (msec > 0) {
+ struct timespec ts = {0, msec * 1000 * 1000};
+ nanosleep(&ts, NULL);
+ }
+ }
+
+ NetworkInterfaceListenerImpl* interface_listener_impl_;
+ MockTcpClientListener mock_tcp_client_listener_;
+};
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc b/src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc
new file mode 100644
index 0000000000..97c8fac9c9
--- /dev/null
+++ b/src/components/transport_manager/test/platform_specific/linux/linux_network_interface_listener_test.cc
@@ -0,0 +1,578 @@
+#include <arpa/inet.h>
+#include <net/if.h>
+#include <time.h>
+
+#include "gtest/gtest.h"
+#include "platform_specific_network_interface_listener_impl.h"
+#include "transport_manager/tcp/mock_tcp_client_listener.h"
+#include "utils/test_async_waiter.h"
+#include "utils/threads/thread.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+namespace {
+const long kThreadStartWaitMsec = 10;
+const uint32_t kStartNotificationTimeoutMsec = 500;
+} // namespace
+
+using ::testing::_;
+using ::testing::AtLeast;
+using ::testing::SaveArg;
+
+class NetworkInterfaceListenerTest : public ::testing::Test {
+ public:
+ NetworkInterfaceListenerTest()
+ : interface_listener_impl_(NULL)
+ , mock_tcp_client_listener_(NULL, 0, false, "") {}
+
+ virtual ~NetworkInterfaceListenerTest() {}
+
+ protected:
+ struct InterfaceEntry {
+ const char* name;
+ const char* ipv4_address;
+ const char* ipv6_address;
+ unsigned int flags;
+ };
+
+ void Init(const std::string interface_name) {
+ interface_listener_impl_ = new PlatformSpecificNetworkInterfaceListener(
+ &mock_tcp_client_listener_, interface_name);
+ // disable events from actual network interfaces
+ interface_listener_impl_->SetTesting(true);
+ }
+
+ void Deinit() {
+ delete interface_listener_impl_;
+ }
+
+ void SetDummyInterfaceTable(struct InterfaceEntry* entries) {
+ InterfaceStatusTable dummy_table;
+
+ while (entries->name != NULL) {
+ InterfaceStatus status;
+ if (entries->ipv4_address != NULL) {
+ struct in_addr addr;
+ ASSERT_EQ(1, inet_pton(AF_INET, entries->ipv4_address, &addr));
+ status.SetIPv4Address(&addr);
+ }
+ if (entries->ipv6_address != NULL) {
+ struct in6_addr addr6;
+ ASSERT_EQ(1, inet_pton(AF_INET6, entries->ipv6_address, &addr6));
+ status.SetIPv6Address(&addr6);
+ }
+ status.SetFlags(entries->flags);
+
+ dummy_table.insert(std::make_pair(entries->name, status));
+ entries++;
+ }
+
+ interface_listener_impl_->OverwriteStatusTable(dummy_table);
+ }
+
+ void SleepFor(long msec) const {
+ if (msec > 0) {
+ struct timespec ts = {0, msec * 1000 * 1000};
+ nanosleep(&ts, NULL);
+ }
+ }
+
+ PlatformSpecificNetworkInterfaceListener* interface_listener_impl_;
+ MockTcpClientListener mock_tcp_client_listener_;
+};
+
+TEST_F(NetworkInterfaceListenerTest, Init) {
+ Init("");
+
+ EXPECT_TRUE(interface_listener_impl_->Init());
+ EXPECT_TRUE(0 <= interface_listener_impl_->GetSocket());
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, Deinit) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ interface_listener_impl_->Deinit();
+
+ EXPECT_EQ(-1, interface_listener_impl_->GetSocket());
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, Start_success) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries[] = {
+ {"dummy_int0", "1.2.3.4", NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+ SetDummyInterfaceTable(entries);
+
+ // after stated, it is expected that the listener notifies current IP address
+ // (if it's available)
+ TestAsyncWaiter waiter;
+ EXPECT_CALL(mock_tcp_client_listener_,
+ OnIPAddressUpdated(entries[0].ipv4_address, ""))
+ .WillOnce(NotifyTestAsyncWaiter(&waiter));
+
+ EXPECT_TRUE(interface_listener_impl_->Start());
+
+ // the "isThreadRunning_" flag of the thread will be update slightly later
+ SleepFor(kThreadStartWaitMsec);
+
+ EXPECT_TRUE(interface_listener_impl_->GetThread()->is_running());
+
+ EXPECT_TRUE(waiter.WaitFor(1, kStartNotificationTimeoutMsec));
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, Start_twice) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ // ignore OnIPAddressUpdated call
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated(_, _))
+ .Times(AtLeast(0));
+
+ EXPECT_TRUE(interface_listener_impl_->Start());
+ SleepFor(kThreadStartWaitMsec);
+
+ EXPECT_FALSE(interface_listener_impl_->Start());
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, Stop_success) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ // ignore OnIPAddressUpdated call
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated(_, _))
+ .Times(AtLeast(0));
+
+ EXPECT_TRUE(interface_listener_impl_->Start());
+ SleepFor(kThreadStartWaitMsec);
+
+ EXPECT_TRUE(interface_listener_impl_->Stop());
+ SleepFor(kThreadStartWaitMsec);
+
+ EXPECT_FALSE(interface_listener_impl_->GetThread()->is_running());
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, Stop_twice) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ // ignore OnIPAddressUpdated call
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated(_, _))
+ .Times(AtLeast(0));
+
+ EXPECT_TRUE(interface_listener_impl_->Start());
+ SleepFor(kThreadStartWaitMsec);
+
+ EXPECT_TRUE(interface_listener_impl_->Stop());
+
+ EXPECT_FALSE(interface_listener_impl_->Stop());
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, Stop_without_Start) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ EXPECT_FALSE(interface_listener_impl_->Stop());
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, DesignatedInterface_IPAddressChanged) {
+ Init("dummy_int0");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries1[] = {
+ {"dummy_int0", "1.2.3.4", NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+ struct InterfaceEntry entries2[] = {
+ {"dummy_int0", "5.6.7.8", NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ SetDummyInterfaceTable(entries1);
+
+ EXPECT_CALL(mock_tcp_client_listener_,
+ OnIPAddressUpdated(entries1[0].ipv4_address, ""))
+ .Times(1);
+
+ // this test case doesn't call Start() - we only check the behavior of
+ // NotifyIPAddresses()
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ SetDummyInterfaceTable(entries2);
+
+ EXPECT_CALL(mock_tcp_client_listener_,
+ OnIPAddressUpdated(entries2[0].ipv4_address, ""))
+ .Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, DesignatedInterface_IPAddressNotChanged) {
+ Init("dummy_int0");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries1[] = {
+ {"dummy_int0", "1.2.3.4", NULL, IFF_UP | IFF_RUNNING},
+ {"dummy_int1", "10.10.10.12", NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+ struct InterfaceEntry entries2[] = {
+ {"dummy_int0", "1.2.3.4", NULL, IFF_UP | IFF_RUNNING},
+ {"dummy_int1", "172.16.23.30", NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ SetDummyInterfaceTable(entries1);
+
+ EXPECT_CALL(mock_tcp_client_listener_,
+ OnIPAddressUpdated(entries1[0].ipv4_address, ""))
+ .Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ SetDummyInterfaceTable(entries2);
+
+ // OnIPAddressUpdated() shouldn't be notified
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated(_, _)).Times(0);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, DesignatedInterface_GoesUnavailable) {
+ Init("dummy_int0");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries1[] = {
+ {"dummy_int0", "1.2.3.4", "fdc2:12af:327a::1", IFF_UP | IFF_RUNNING},
+ {"dummy_int1", "10.10.10.12", NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+ struct InterfaceEntry entries2[] = {
+ {"dummy_int0", "1.2.3.4", "fdc2:12af:327a::1", IFF_UP},
+ {"dummy_int1", "10.10.10.12", NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ SetDummyInterfaceTable(entries1);
+
+ EXPECT_CALL(
+ mock_tcp_client_listener_,
+ OnIPAddressUpdated(entries1[0].ipv4_address, entries1[0].ipv6_address))
+ .Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ SetDummyInterfaceTable(entries2);
+
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated("", "")).Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, DesignatedInterface_Removed) {
+ Init("dummy_int0");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries1[] = {
+ {"dummy_int0", "1.2.3.4", "fdc2:12af:327a::1", IFF_UP | IFF_RUNNING},
+ {"dummy_int1", "10.10.10.12", NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+ struct InterfaceEntry entries2[] = {
+ {"dummy_int1", "10.10.10.12", NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ SetDummyInterfaceTable(entries1);
+
+ EXPECT_CALL(
+ mock_tcp_client_listener_,
+ OnIPAddressUpdated(entries1[0].ipv4_address, entries1[0].ipv6_address))
+ .Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ SetDummyInterfaceTable(entries2);
+
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated("", "")).Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, DesignatedInterface_Added) {
+ Init("dummy_int0");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries1[] = {
+ {"dummy_int1", "10.10.10.12", NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+ struct InterfaceEntry entries2[] = {
+ {"dummy_int1", "10.10.10.12", NULL, IFF_UP | IFF_RUNNING},
+ {"dummy_int0", "1.2.3.4", NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ SetDummyInterfaceTable(entries1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ SetDummyInterfaceTable(entries2);
+
+ EXPECT_CALL(mock_tcp_client_listener_,
+ OnIPAddressUpdated(entries2[1].ipv4_address, ""))
+ .Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, AutoSelectInterface_SelectInterface) {
+ // automatically select network interface
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries[] = {
+ {"dummy_int1", "10.10.10.12", NULL, IFF_UP | IFF_RUNNING},
+ {"net_dummy2", "192.168.2.3", "fdc2:12af:327a::22", IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ SetDummyInterfaceTable(entries);
+
+ std::string output_ipv4_address;
+ std::string output_ipv6_address;
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&output_ipv4_address),
+ SaveArg<1>(&output_ipv6_address)));
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ std::string selected_interface =
+ interface_listener_impl_->GetSelectedInterfaceName();
+
+ // the interface listener should pick one of the interfaces
+ EXPECT_TRUE((selected_interface == entries[0].name &&
+ output_ipv4_address == entries[0].ipv4_address &&
+ output_ipv6_address == "") ||
+ (selected_interface == entries[1].name &&
+ output_ipv4_address == entries[1].ipv4_address &&
+ output_ipv6_address == entries[1].ipv6_address));
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest,
+ AutoSelectInterface_SkipUnavailableInterface) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries[] = {
+ {"dummy_int1", "10.10.10.12", NULL, IFF_UP},
+ {"net_dummy2", "192.168.2.3", "fdc2:12af:327a::22", IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ SetDummyInterfaceTable(entries);
+
+ // dummy_int1 should not be selected
+ struct InterfaceEntry* expected = &entries[1];
+ EXPECT_CALL(
+ mock_tcp_client_listener_,
+ OnIPAddressUpdated(expected->ipv4_address, expected->ipv6_address))
+ .Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ EXPECT_EQ(expected->name,
+ interface_listener_impl_->GetSelectedInterfaceName());
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, AutoSelectInterface_SkipEmptyInterface) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries[] = {
+ {"dummy_int1", "10.10.10.12", NULL, IFF_UP | IFF_RUNNING},
+ {"net_dummy2", NULL, NULL, IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ SetDummyInterfaceTable(entries);
+
+ // net_dummy2 should not be selected
+ struct InterfaceEntry* expected = &entries[0];
+ EXPECT_CALL(mock_tcp_client_listener_,
+ OnIPAddressUpdated(expected->ipv4_address, ""))
+ .Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ EXPECT_EQ(expected->name,
+ interface_listener_impl_->GetSelectedInterfaceName());
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest,
+ AutoSelectInterface_SkipLoopbackInterface) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries[] = {
+ {"dummy_int1", "10.10.10.12", NULL, IFF_UP | IFF_RUNNING | IFF_LOOPBACK},
+ {"net_dummy2", "192.168.2.3", "fdc2:12af:327a::22", IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ // dummy_int1 should not be selected
+ struct InterfaceEntry* expected = &entries[1];
+ EXPECT_CALL(
+ mock_tcp_client_listener_,
+ OnIPAddressUpdated(expected->ipv4_address, expected->ipv6_address))
+ .Times(1);
+
+ SetDummyInterfaceTable(entries);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ EXPECT_EQ(expected->name,
+ interface_listener_impl_->GetSelectedInterfaceName());
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, AutoSelectInterface_DisableInterface) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries[] = {
+ {"net_dummy0", "192.168.2.3", "fdc2:12af:327a::22", IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated(_, _)).Times(1);
+ SetDummyInterfaceTable(entries);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ // make the interface "not running"
+ entries[0].flags &= ~IFF_RUNNING;
+ SetDummyInterfaceTable(entries);
+
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated("", "")).Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ EXPECT_EQ("", interface_listener_impl_->GetSelectedInterfaceName());
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, AutoSelectInterface_EnableInterface) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries[] = {
+ {"net_dummy0", "192.168.2.3", "fdc2:12af:327a::22", IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated(_, _)).Times(1);
+ SetDummyInterfaceTable(entries);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ // make the interface "not running"
+ entries[0].flags &= ~IFF_RUNNING;
+ SetDummyInterfaceTable(entries);
+
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated(_, _)).Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ // make it running again
+ entries[0].flags |= IFF_RUNNING;
+ SetDummyInterfaceTable(entries);
+
+ EXPECT_CALL(
+ mock_tcp_client_listener_,
+ OnIPAddressUpdated(entries[0].ipv4_address, entries[0].ipv6_address))
+ .Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ EXPECT_EQ(entries[0].name,
+ interface_listener_impl_->GetSelectedInterfaceName());
+
+ Deinit();
+}
+
+TEST_F(NetworkInterfaceListenerTest, AutoSelectInterface_SwitchInterface) {
+ Init("");
+ EXPECT_TRUE(interface_listener_impl_->Init());
+
+ struct InterfaceEntry entries[] = {
+ {"dummy_int1",
+ "10.10.10.12",
+ "fd53:ba79:241d:30c1::78",
+ IFF_UP | IFF_RUNNING},
+ {"net_dummy2", "192.168.2.3", "fdc2:12af:327a::22", IFF_UP | IFF_RUNNING},
+ {NULL, NULL, NULL, 0}};
+
+ EXPECT_CALL(mock_tcp_client_listener_, OnIPAddressUpdated(_, _)).Times(1);
+ SetDummyInterfaceTable(entries);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ const std::string selected_interface =
+ interface_listener_impl_->GetSelectedInterfaceName();
+ struct InterfaceEntry* selected = &entries[0];
+ while (selected->name != NULL) {
+ if (selected->name == selected_interface) {
+ break;
+ }
+ selected++;
+ }
+ ASSERT_TRUE(selected->name != NULL);
+
+ // make the interface "not running"
+ selected->flags &= ~IFF_RUNNING;
+ SetDummyInterfaceTable(entries);
+
+ struct InterfaceEntry* switched;
+ if (selected == &entries[0]) {
+ switched = &entries[1];
+ } else {
+ switched = &entries[0];
+ }
+
+ EXPECT_CALL(
+ mock_tcp_client_listener_,
+ OnIPAddressUpdated(switched->ipv4_address, switched->ipv6_address))
+ .Times(1);
+
+ interface_listener_impl_->testCallNotifyIPAddresses();
+
+ EXPECT_EQ(switched->name,
+ interface_listener_impl_->GetSelectedInterfaceName());
+
+ Deinit();
+}
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/transport_manager/test/sample_websocket_server.cc b/src/components/transport_manager/test/sample_websocket_server.cc
new file mode 100644
index 0000000000..9b0e5b59d5
--- /dev/null
+++ b/src/components/transport_manager/test/sample_websocket_server.cc
@@ -0,0 +1,391 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "transport_manager/cloud/sample_websocket_server.h"
+
+namespace {
+// Report a failure
+void Fail(char const* tag, boost::system::error_code ec) {
+ std::cerr << tag << ": " << ec.message() << "\n";
+}
+} // namespace
+
+namespace sample {
+namespace websocket {
+
+WSSession::WSServer::WSServer(tcp::socket&& socket)
+ : ws_(std::move(socket)), strand_(ws_.get_executor()) {}
+
+void WSSession::WSServer::AddURLRoute(const std::string& target) {
+ url_routes_.insert(ParseRouteFromTarget(target));
+}
+
+void WSSession::WSServer::Run() {
+ req_ = {};
+ http::async_read(ws_.next_layer(),
+ buffer_,
+ req_,
+ std::bind(&WSServer::OnWebsocketHandshake,
+ shared_from_this(),
+ std::placeholders::_1));
+}
+
+void WSSession::WSServer::OnWebsocketHandshake(
+ const boost::system::error_code& ec) {
+ if (ec) {
+ return Fail("ERROR_HTTP_REQUEST_READ", ec);
+ }
+ if (websocket::is_upgrade(req_)) {
+ // Check target
+ std::string route = ParseRouteFromTarget(req_.target().to_string());
+ if (!CanHandleRoute(route)) {
+ auto error = boost::system::errc::make_error_code(
+ boost::system::errc::address_not_available);
+ ws_.next_layer().close();
+ return Fail("ERROR_INVALID_TARGET", error);
+ }
+ // Accept the websocket handshake
+ ws_.async_accept(
+ req_,
+ boost::asio::bind_executor(strand_,
+ std::bind(&WSServer::OnAccept,
+ shared_from_this(),
+ std::placeholders::_1)));
+ }
+}
+
+void WSSession::WSServer::OnAccept(beast::error_code ec) {
+ if (ec) {
+ return Fail("ERROR_WEBSOCKET_HANDSHAKE", ec);
+ }
+}
+
+bool WSSession::WSServer::CanHandleRoute(const std::string& route) {
+ if (url_routes_.find(route) == url_routes_.end()) {
+ return false;
+ }
+ return true;
+}
+
+std::string WSSession::WSServer::ParseRouteFromTarget(
+ const std::string& target) {
+ std::string route = target;
+ // Remove fragment
+ auto fragment_pos = route.find('#');
+ if (fragment_pos != std::string::npos) {
+ route = route.substr(0, fragment_pos);
+ }
+ // Remove query
+ auto query_pos = route.find('?');
+ if (query_pos != std::string::npos) {
+ route = route.substr(0, query_pos);
+ }
+
+ return route;
+}
+
+WSSession::WSSession(const std::string& address, uint16_t port)
+ : io_pool_(1)
+ , address_(address)
+ , port_(port)
+ , acceptor_(ioc_)
+ , socket_(ioc_)
+ , ws_(nullptr) {
+ endpoint_ = {boost::asio::ip::make_address(address), port};
+ boost::system::error_code error;
+
+ // Open the acceptor
+ acceptor_.open(endpoint_.protocol(), error);
+ if (error) {
+ Fail("ERROR_ACCEPTOR_OPEN", error);
+ return;
+ }
+
+ // Allow address reuse
+ acceptor_.set_option(boost::asio::socket_base::reuse_address(true), error);
+ if (error) {
+ Fail("ERROR_SET_OPTION", error);
+ return;
+ }
+
+ // Bind to the server address
+ acceptor_.bind(endpoint_, error);
+ if (error) {
+ Fail("ERROR_BIND", error);
+ return;
+ }
+
+ // Start listening for connections
+ acceptor_.listen(boost::asio::socket_base::max_listen_connections, error);
+ if (error) {
+ Fail("ERROR_LISTEN", error);
+ return;
+ }
+}
+
+void WSSession::Run() {
+ if (acceptor_.is_open()) {
+ acceptor_.async_accept(
+ socket_,
+ std::bind(
+ &WSSession::on_accept, shared_from_this(), std::placeholders::_1));
+ boost::asio::post(io_pool_, [&]() { ioc_.run(); });
+ }
+}
+
+void WSSession::Stop() {
+ try {
+ ioc_.stop();
+ acceptor_.close();
+ io_pool_.join();
+ } catch (...) {
+ std::cerr << "Failed to close connection" << std::endl;
+ }
+}
+
+void WSSession::AddRoute(const std::string& route) {
+ if (ws_ == nullptr) {
+ buffered_routes_.push(route);
+ return;
+ }
+ ws_->AddURLRoute(route);
+}
+
+void WSSession::on_accept(boost::system::error_code ec) {
+ if (ec) {
+ Fail("ERROR_ON_ACCEPT", ec);
+ ioc_.stop();
+ return;
+ }
+
+ // Make websocket object and start
+ ws_ = std::make_shared<WSServer>(std::move(socket_));
+ // Load routes stored in buffer
+ while (!buffered_routes_.empty()) {
+ ws_->AddURLRoute(buffered_routes_.front());
+ buffered_routes_.pop();
+ }
+ ws_->Run();
+}
+
+WSSSession::WSSServer::WSSServer(tcp::socket&& socket, ssl::context& ctx)
+ : wss_(std::move(socket), ctx) {}
+
+void WSSSession::WSSServer::AddURLRoute(const std::string& target) {
+ url_routes_.insert(ParseRouteFromTarget(target));
+}
+void WSSSession::WSSServer::Run() {
+ // Perform the SSL handshake
+ wss_.next_layer().async_handshake(ssl::stream_base::server,
+ std::bind(&WSSServer::OnSSLHandshake,
+ shared_from_this(),
+ std::placeholders::_1));
+}
+
+void WSSSession::WSSServer::OnSSLHandshake(beast::error_code ec) {
+ if (ec) {
+ return Fail("ERROR_SSL_HANDSHAKE", ec);
+ }
+
+ req_ = {};
+ http::async_read(wss_.next_layer(),
+ buffer_,
+ req_,
+ std::bind(&WSSServer::OnWebsocketHandshake,
+ shared_from_this(),
+ std::placeholders::_1));
+}
+
+void WSSSession::WSSServer::OnWebsocketHandshake(
+ const boost::system::error_code& ec) {
+ if (ec) {
+ return Fail("ERROR_HTTP_REQUEST_READ", ec);
+ }
+ if (websocket::is_upgrade(req_)) {
+ // Check target
+ std::string route = ParseRouteFromTarget(req_.target().to_string());
+ if (!CanHandleRoute(route)) {
+ auto error = boost::system::errc::make_error_code(
+ boost::system::errc::address_not_available);
+ wss_.next_layer().next_layer().close();
+ return Fail("ERROR_INVALID_TARGET", error);
+ }
+ // Accept the websocket handshake
+ wss_.async_accept(
+ req_,
+ std::bind(
+ &WSSServer::OnAccept, shared_from_this(), std::placeholders::_1));
+ }
+}
+
+void WSSSession::WSSServer::OnAccept(beast::error_code ec) {
+ if (ec) {
+ return Fail("ERROR_ON_ACCEPT", ec);
+ }
+}
+
+bool WSSSession::WSSServer::CanHandleRoute(const std::string& route) {
+ if (url_routes_.find(route) == url_routes_.end()) {
+ return false;
+ }
+ return true;
+}
+
+std::string WSSSession::WSSServer::ParseRouteFromTarget(
+ const std::string& target) {
+ std::string route = target;
+ // Remove fragment
+ auto fragment_pos = route.find('#');
+ if (fragment_pos != std::string::npos) {
+ route = route.substr(0, fragment_pos);
+ }
+ // Remove query
+ auto query_pos = route.find('?');
+ if (query_pos != std::string::npos) {
+ route = route.substr(0, query_pos);
+ }
+
+ return route;
+}
+
+WSSSession::WSSSession(const std::string& address,
+ uint16_t port,
+ const std::string& certificate,
+ const std::string& private_key)
+ : io_pool_(1)
+ , acceptor_(ioc_)
+ , socket_(ioc_)
+ , ctx_(ssl::context::sslv23_server)
+ , wss_(nullptr) {
+ beast::error_code ec;
+ endpoint_ = {boost::asio::ip::make_address(address), port};
+
+ // Load the certificate
+ ctx_.use_certificate(
+ boost::asio::buffer(certificate.c_str(), certificate.size()),
+ ssl::context::file_format::pem,
+ ec);
+ if (ec) {
+ Fail("ERROR_USE_CERTIFICATE", ec);
+ return;
+ }
+
+ // Load the private key
+ ctx_.use_rsa_private_key(
+ boost::asio::buffer(private_key.c_str(), private_key.size()),
+ ssl::context::file_format::pem,
+ ec);
+ if (ec) {
+ Fail("ERROR_USE_RSA_PRIVATE_KEY", ec);
+ return;
+ }
+
+ // Open the acceptor
+ acceptor_.open(endpoint_.protocol(), ec);
+ if (ec) {
+ Fail("EEROR_ACCEPTOR_OPEN", ec);
+ return;
+ }
+
+ // Allow address reuse
+ acceptor_.set_option(net::socket_base::reuse_address(true), ec);
+ if (ec) {
+ Fail("ERROR_SET_OPTION", ec);
+ return;
+ }
+
+ // Bind to the server address
+ acceptor_.bind(endpoint_, ec);
+ if (ec) {
+ Fail("ERROR_BIND", ec);
+ return;
+ }
+
+ // Start listening for connections
+ acceptor_.listen(net::socket_base::max_listen_connections, ec);
+ if (ec) {
+ Fail("ERROR_LISTEN", ec);
+ return;
+ }
+}
+
+// Start accepting incoming connections
+void WSSSession::Run() {
+ do_accept();
+}
+
+void WSSSession::Stop() {
+ try {
+ ioc_.stop();
+ acceptor_.close();
+ io_pool_.join();
+ } catch (...) {
+ std::cerr << "Failed to close connection" << std::endl;
+ }
+}
+
+void WSSSession::AddRoute(const std::string& route) {
+ if (wss_ == nullptr) {
+ buffered_routes_.push(route);
+ return;
+ }
+ wss_->AddURLRoute(route);
+}
+
+void WSSSession::do_accept() {
+ if (acceptor_.is_open()) {
+ acceptor_.async_accept(
+ socket_,
+ std::bind(
+ &WSSSession::on_accept, shared_from_this(), std::placeholders::_1));
+ boost::asio::post(io_pool_, [&]() { ioc_.run(); });
+ }
+}
+
+void WSSSession::on_accept(boost::system::error_code ec) {
+ if (ec) {
+ Fail("ERROR_ON_ACCEPT", ec);
+ ioc_.stop();
+ return;
+ }
+ // Create the session and run it
+ wss_ = std::make_shared<WSSServer>(std::move(socket_), ctx_);
+ // Load routes stored in buffer
+ while (!buffered_routes_.empty()) {
+ wss_->AddURLRoute(buffered_routes_.front());
+ buffered_routes_.pop();
+ }
+ wss_->Run();
+}
+
+} // namespace websocket
+} // namespace sample
diff --git a/src/components/transport_manager/test/tcp_client_listener_test.cc b/src/components/transport_manager/test/tcp_client_listener_test.cc
index b179f63ece..dbd7799b62 100644
--- a/src/components/transport_manager/test/tcp_client_listener_test.cc
+++ b/src/components/transport_manager/test/tcp_client_listener_test.cc
@@ -30,102 +30,527 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <time.h>
+#include <unistd.h>
+
#include "gtest/gtest.h"
-#include "transport_manager/transport_adapter/mock_transport_adapter.h"
-#include "transport_manager/tcp/tcp_client_listener.h"
#include "transport_manager/mock_transport_manager.h"
+#include "transport_manager/tcp/network_interface_listener.h"
+#include "transport_manager/tcp/tcp_client_listener.h"
+#include "transport_manager/transport_adapter/mock_device.h"
+#include "transport_manager/transport_adapter/mock_transport_adapter.h"
+#include "transport_manager/transport_adapter/mock_transport_adapter_controller.h"
#include "transport_manager/transport_adapter/transport_adapter_controller.h"
-#include "transport_manager/transport_adapter/device.h"
+
+#include "utils/test_async_waiter.h"
+#include "utils/threads/thread.h"
namespace test {
namespace components {
namespace transport_manager_test {
+using ::testing::_;
+using ::testing::AtLeast;
using ::testing::Return;
using namespace ::transport_manager;
using namespace ::transport_manager::transport_adapter;
-class MockTransportAdapterController : public TransportAdapterController {
+namespace {
+const long kThreadStartWaitMsec = 10;
+const uint32_t kConnectionCreatedTimeoutMsec = 200;
+} // namespace
+
+class MockNetworkInterfaceListener : public NetworkInterfaceListener {
public:
- MOCK_METHOD1(AddDevice, DeviceSptr(DeviceSptr device));
- MOCK_METHOD0(AckDevices, void());
- MOCK_METHOD1(SearchDeviceDone, void(const DeviceVector& devices));
- MOCK_METHOD1(SearchDeviceFailed, void(const SearchDeviceError& error));
- MOCK_CONST_METHOD1(FindDevice, DeviceSptr(const DeviceUID& device_handle));
- MOCK_METHOD3(ConnectionCreated,
- void(ConnectionSPtr connection,
- const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
- MOCK_METHOD2(ConnectDone,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
- MOCK_METHOD3(ConnectFailed,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const ConnectError& error));
- MOCK_METHOD2(ConnectionFinished,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
- MOCK_METHOD3(ConnectionAborted,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const CommunicationError& error));
- MOCK_METHOD2(DisconnectDone,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
- MOCK_METHOD3(DataReceiveDone,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const ::protocol_handler::RawMessagePtr message));
- MOCK_METHOD3(DataReceiveFailed,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const DataReceiveError& error));
- MOCK_METHOD3(DataSendDone,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const ::protocol_handler::RawMessagePtr message));
- MOCK_METHOD4(DataSendFailed,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const ::protocol_handler::RawMessagePtr message,
- const DataSendError& error));
- MOCK_METHOD0(FindNewApplicationsRequest, void());
- MOCK_METHOD1(ApplicationListUpdated, void(const DeviceUID& device_handle));
- MOCK_METHOD2(DeviceDisconnected,
- void(const DeviceUID& device_handle,
- const DisconnectDeviceError& error));
+ MOCK_METHOD0(Init, bool());
+ MOCK_METHOD0(Deinit, void());
+ MOCK_METHOD0(Start, bool());
+ MOCK_METHOD0(Stop, bool());
};
-class TcpClientListenerTest : public ::testing::Test {
+class TcpClientListenerTest : public ::testing::TestWithParam<std::string> {
public:
TcpClientListenerTest()
- : port_(0)
+ : port_(0) /* On Linux, binding to port 0 lets the system choose an
+ available port */
, enable_keep_alive_(false)
- , tcp_client_listener_(
- &adapter_controller_mock_, port_, enable_keep_alive_) {}
+ , interface_listener_mock_(NULL)
+ , tcp_client_listener_(NULL) {}
+ virtual ~TcpClientListenerTest() {
+ delete tcp_client_listener_;
+ }
protected:
+ void SetUp() OVERRIDE {
+ tcp_client_listener_ = new TcpClientListener(
+ &adapter_controller_mock_, port_, enable_keep_alive_, GetParam());
+ interface_listener_mock_ = new MockNetworkInterfaceListener();
+ tcp_client_listener_->set_testing(true);
+ tcp_client_listener_->set_network_interface_listener(
+ interface_listener_mock_);
+ }
+
+ bool InterfaceNameSpecified() const {
+ return "" != GetParam();
+ }
+
+ void SleepFor(long msec) const {
+ if (msec > 0) {
+ struct timespec ts = {0, msec * 1000 * 1000};
+ nanosleep(&ts, NULL);
+ }
+ }
+
uint16_t port_;
bool enable_keep_alive_;
MockTransportAdapterController adapter_controller_mock_;
- TcpClientListener tcp_client_listener_;
+ MockNetworkInterfaceListener* interface_listener_mock_;
+ TcpClientListener* tcp_client_listener_;
};
-TEST_F(TcpClientListenerTest, Ctor_test) {
- EXPECT_EQ(0, tcp_client_listener_.port());
- EXPECT_TRUE(NULL != tcp_client_listener_.thread());
- EXPECT_EQ(-1, tcp_client_listener_.get_socket());
+TEST_P(TcpClientListenerTest, Ctor_test) {
+ EXPECT_EQ(0, tcp_client_listener_->port());
+ EXPECT_TRUE(NULL != tcp_client_listener_->thread());
+ EXPECT_EQ(-1, tcp_client_listener_->get_socket());
+}
+
+TEST_P(TcpClientListenerTest, IsInitialised) {
+ // should return false until Init() is called
+ EXPECT_FALSE(tcp_client_listener_->IsInitialised());
+}
+
+TEST_P(TcpClientListenerTest, Init) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+
+ if (InterfaceNameSpecified()) {
+ // TcpClientListener will create socket once IP address of the network is
+ // notified.
+ EXPECT_EQ(-1, tcp_client_listener_->get_socket());
+ } else {
+ // Interface name is not designated. In this case, TcpClientListener will
+ // create socket with Init().
+ EXPECT_TRUE(0 <= tcp_client_listener_->get_socket());
+ }
+
+ EXPECT_TRUE(tcp_client_listener_->IsInitialised());
+
+ // Deinit() will be called during destructor
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
+}
+
+TEST_P(TcpClientListenerTest, Terminate) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
+
+ tcp_client_listener_->Terminate();
+
+ EXPECT_EQ(-1, tcp_client_listener_->get_socket());
+}
+
+TEST_P(TcpClientListenerTest, StartListening) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+
+ EXPECT_CALL(*interface_listener_mock_, Start()).WillOnce(Return(true));
+
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StartListening());
+
+ // the "isThreadRunning_" flag of the thread will be update slightly later
+ SleepFor(kThreadStartWaitMsec);
+
+ if (InterfaceNameSpecified()) {
+ EXPECT_FALSE(tcp_client_listener_->thread()->is_running());
+ } else {
+ EXPECT_TRUE(tcp_client_listener_->thread()->is_running());
+ }
+
+ // Stop() and Deinit() will be called during destructor
+ EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
+}
+
+TEST_P(TcpClientListenerTest, StartListening_twice) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+ EXPECT_CALL(*interface_listener_mock_, Start()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StartListening());
+
+ // call again
+ EXPECT_EQ(TransportAdapter::BAD_STATE,
+ tcp_client_listener_->StartListening());
+
+ // Stop() and Deinit() will be called during destructor
+ EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
+}
+
+TEST_P(TcpClientListenerTest, StopListening) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+ EXPECT_CALL(*interface_listener_mock_, Start()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StartListening());
+
+ EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
+
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StopListening());
+ EXPECT_FALSE(tcp_client_listener_->thread()->is_running());
+
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
+}
+
+TEST_P(TcpClientListenerTest, StopListening_twice) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+ EXPECT_CALL(*interface_listener_mock_, Start()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StartListening());
+ EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StopListening());
+
+ // call again
+ EXPECT_EQ(TransportAdapter::BAD_STATE, tcp_client_listener_->StopListening());
+
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
}
-TEST_F(TcpClientListenerTest, IsInitialised) {
- EXPECT_TRUE(tcp_client_listener_.IsInitialised());
+TEST_P(TcpClientListenerTest, ClientConnection) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+ EXPECT_CALL(*interface_listener_mock_, Start()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StartListening());
+
+ if (InterfaceNameSpecified()) {
+ // set up a server socket by notifying a dummy IP address
+ EXPECT_CALL(adapter_controller_mock_, TransportConfigUpdated(_)).Times(1);
+ tcp_client_listener_->OnIPAddressUpdated(std::string("192.168.1.1"),
+ std::string(""));
+ }
+
+ // get the port number (assigned by system) that the socket is listening on
+ struct sockaddr_in server_addr;
+ socklen_t server_addr_len = sizeof(server_addr);
+ EXPECT_EQ(0,
+ getsockname(tcp_client_listener_->get_socket(),
+ reinterpret_cast<struct sockaddr*>(&server_addr),
+ &server_addr_len));
+
+ // try connecting to the socket
+ struct sockaddr_in client_addr;
+ client_addr.sin_family = AF_INET;
+ client_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ client_addr.sin_port = server_addr.sin_port;
+ socklen_t client_addr_len = sizeof(client_addr);
+
+ int s = socket(AF_INET, SOCK_STREAM, 0);
+ EXPECT_TRUE(0 <= s);
+
+ TestAsyncWaiter waiter;
+
+ // controller should be notified of AddDevice event
+ DeviceSptr mock_device = std::make_shared<MockTCPDevice>(
+ htonl(INADDR_LOOPBACK), "dummy_tcp_device");
+ EXPECT_CALL(adapter_controller_mock_, AddDevice(_))
+ .WillOnce(Return(mock_device));
+ EXPECT_CALL(adapter_controller_mock_, ConnectionCreated(_, _, _))
+ .WillOnce(NotifyTestAsyncWaiter(&waiter));
+
+ // adapter_controller_mock_ may also receive ConnectDone() and
+ // ConnectionFinished() from ThreadedSocketConnection. Ignore them as hey are
+ // not part ly client listener's tests.
+ EXPECT_CALL(adapter_controller_mock_, ConnectDone(_, _)).Times(AtLeast(0));
+ EXPECT_CALL(adapter_controller_mock_, ConnectionFinished(_, _))
+ .Times(AtLeast(0));
+
+ EXPECT_EQ(0,
+ connect(s,
+ reinterpret_cast<struct sockaddr*>(&client_addr),
+ client_addr_len));
+
+ // since the connection is handled on another thread, wait for some time
+ EXPECT_TRUE(waiter.WaitFor(1, kConnectionCreatedTimeoutMsec));
+
+ close(s);
+
+ EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
}
-TEST_F(TcpClientListenerTest, Init) {
- EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_.Init());
+TEST_P(TcpClientListenerTest, OnIPAddressUpdated_ValidIPv4Address) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+ EXPECT_CALL(*interface_listener_mock_, Start()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StartListening());
+
+ const std::string test_ipv4_addr = "192.168.1.1";
+ const std::string test_ipv6_addr = "";
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%u", port_);
+ const std::string test_port(buf);
+
+ TransportConfig expected_config;
+ expected_config.insert(std::make_pair(tc_enabled, "true"));
+ expected_config.insert(std::make_pair(tc_tcp_ip_address, test_ipv4_addr));
+ expected_config.insert(std::make_pair(tc_tcp_port, test_port));
+
+ EXPECT_CALL(adapter_controller_mock_, TransportConfigUpdated(expected_config))
+ .Times(1);
+
+ tcp_client_listener_->OnIPAddressUpdated(test_ipv4_addr, test_ipv6_addr);
+
+ if (InterfaceNameSpecified()) {
+ // when the client listener runs with designated interface name, it should
+ // start the thread here
+ EXPECT_TRUE(0 <= tcp_client_listener_->get_socket());
+
+ SleepFor(kThreadStartWaitMsec);
+
+ EXPECT_TRUE(tcp_client_listener_->thread()->is_running());
+ }
+
+ EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
}
+TEST_P(TcpClientListenerTest, OnIPAddressUpdated_IPv4Address_changed) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+ EXPECT_CALL(*interface_listener_mock_, Start()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StartListening());
+
+ const std::string test_ipv4_addr_1 = "192.168.1.1";
+ const std::string test_ipv6_addr = "";
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%u", port_);
+ const std::string test_port(buf);
+
+ TransportConfig expected_config_1;
+ expected_config_1.insert(std::make_pair(tc_enabled, "true"));
+ expected_config_1.insert(std::make_pair(tc_tcp_ip_address, test_ipv4_addr_1));
+ expected_config_1.insert(std::make_pair(tc_tcp_port, test_port));
+
+ EXPECT_CALL(adapter_controller_mock_,
+ TransportConfigUpdated(expected_config_1))
+ .Times(1);
+
+ tcp_client_listener_->OnIPAddressUpdated(test_ipv4_addr_1, test_ipv6_addr);
+
+ const std::string test_ipv4_addr_2 = "172.16.2.3";
+ TransportConfig expected_config_2;
+ expected_config_2.insert(std::make_pair(tc_enabled, "true"));
+ expected_config_2.insert(std::make_pair(tc_tcp_ip_address, test_ipv4_addr_2));
+ expected_config_2.insert(std::make_pair(tc_tcp_port, test_port));
+
+ EXPECT_CALL(adapter_controller_mock_,
+ TransportConfigUpdated(expected_config_2))
+ .Times(1);
+
+ tcp_client_listener_->OnIPAddressUpdated(test_ipv4_addr_2, test_ipv6_addr);
+
+ if (InterfaceNameSpecified()) {
+ EXPECT_TRUE(0 <= tcp_client_listener_->get_socket());
+
+ SleepFor(kThreadStartWaitMsec);
+
+ EXPECT_TRUE(tcp_client_listener_->thread()->is_running());
+ }
+
+ EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
+}
+
+TEST_P(TcpClientListenerTest, OnIPAddressUpdated_IPv4Address_same) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+ EXPECT_CALL(*interface_listener_mock_, Start()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StartListening());
+
+ const std::string test_ipv4_addr_1 = "192.168.1.1";
+ const std::string test_ipv6_addr = "";
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%u", port_);
+ const std::string test_port(buf);
+
+ TransportConfig expected_config_1;
+ expected_config_1.insert(std::make_pair(tc_enabled, "true"));
+ expected_config_1.insert(std::make_pair(tc_tcp_ip_address, test_ipv4_addr_1));
+ expected_config_1.insert(std::make_pair(tc_tcp_port, test_port));
+
+ EXPECT_CALL(adapter_controller_mock_,
+ TransportConfigUpdated(expected_config_1))
+ .Times(1);
+
+ tcp_client_listener_->OnIPAddressUpdated(test_ipv4_addr_1, test_ipv6_addr);
+
+ const std::string test_ipv4_addr_2 = "192.168.1.1"; // same as before
+ TransportConfig expected_config_2;
+ expected_config_2.insert(std::make_pair(tc_enabled, "true"));
+ expected_config_2.insert(std::make_pair(tc_tcp_ip_address, test_ipv4_addr_2));
+ expected_config_2.insert(std::make_pair(tc_tcp_port, test_port));
+
+ // client listener should not generate TransportConfigUpdated event
+ EXPECT_CALL(adapter_controller_mock_, TransportConfigUpdated(_)).Times(0);
+
+ tcp_client_listener_->OnIPAddressUpdated(test_ipv4_addr_2, test_ipv6_addr);
+
+ if (InterfaceNameSpecified()) {
+ EXPECT_TRUE(0 <= tcp_client_listener_->get_socket());
+
+ SleepFor(kThreadStartWaitMsec);
+
+ EXPECT_TRUE(tcp_client_listener_->thread()->is_running());
+ }
+
+ EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
+}
+
+TEST_P(TcpClientListenerTest, OnIPAddressUpdated_IPv4Address_disabled) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+ EXPECT_CALL(*interface_listener_mock_, Start()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StartListening());
+
+ const std::string test_ipv4_addr_1 = "192.168.1.1";
+ const std::string test_ipv6_addr = "";
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%u", port_);
+ const std::string test_port(buf);
+
+ TransportConfig expected_config_1;
+ expected_config_1.insert(std::make_pair(tc_enabled, "true"));
+ expected_config_1.insert(std::make_pair(tc_tcp_ip_address, test_ipv4_addr_1));
+ expected_config_1.insert(std::make_pair(tc_tcp_port, test_port));
+
+ EXPECT_CALL(adapter_controller_mock_,
+ TransportConfigUpdated(expected_config_1))
+ .Times(1);
+
+ tcp_client_listener_->OnIPAddressUpdated(test_ipv4_addr_1, test_ipv6_addr);
+
+ const std::string test_ipv4_addr_2 = "";
+ TransportConfig expected_config_2;
+ expected_config_2.insert(std::make_pair(tc_enabled, "false"));
+ expected_config_2.insert(std::make_pair(tc_tcp_ip_address, test_ipv4_addr_2));
+ expected_config_2.insert(std::make_pair(tc_tcp_port, test_port));
+
+ EXPECT_CALL(adapter_controller_mock_,
+ TransportConfigUpdated(expected_config_2))
+ .Times(1);
+
+ tcp_client_listener_->OnIPAddressUpdated(test_ipv4_addr_2, test_ipv6_addr);
+
+ if (InterfaceNameSpecified()) {
+ EXPECT_EQ(-1, tcp_client_listener_->get_socket());
+
+ SleepFor(kThreadStartWaitMsec);
+
+ EXPECT_FALSE(tcp_client_listener_->thread()->is_running());
+ }
+
+ EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
+}
+
+TEST_P(TcpClientListenerTest, OnIPAddressUpdated_IPv4Address_reenabled) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+ EXPECT_CALL(*interface_listener_mock_, Start()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StartListening());
+
+ const std::string test_ipv4_addr_1 = "192.168.1.1";
+ const std::string test_ipv6_addr = "";
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%u", port_);
+ const std::string test_port(buf);
+
+ TransportConfig expected_config_1;
+ expected_config_1.insert(std::make_pair(tc_enabled, "true"));
+ expected_config_1.insert(std::make_pair(tc_tcp_ip_address, test_ipv4_addr_1));
+ expected_config_1.insert(std::make_pair(tc_tcp_port, test_port));
+
+ EXPECT_CALL(adapter_controller_mock_,
+ TransportConfigUpdated(expected_config_1))
+ .Times(1);
+
+ tcp_client_listener_->OnIPAddressUpdated(test_ipv4_addr_1, test_ipv6_addr);
+
+ const std::string test_ipv4_addr_2 = "";
+ TransportConfig expected_config_2;
+ expected_config_2.insert(std::make_pair(tc_enabled, "false"));
+ expected_config_2.insert(std::make_pair(tc_tcp_ip_address, test_ipv4_addr_2));
+ expected_config_2.insert(std::make_pair(tc_tcp_port, test_port));
+
+ EXPECT_CALL(adapter_controller_mock_,
+ TransportConfigUpdated(expected_config_2))
+ .Times(1);
+
+ tcp_client_listener_->OnIPAddressUpdated(test_ipv4_addr_2, test_ipv6_addr);
+
+ const std::string test_ipv4_addr_3 = "192.168.1.1";
+ TransportConfig expected_config_3;
+ expected_config_3.insert(std::make_pair(tc_enabled, "true"));
+ expected_config_3.insert(std::make_pair(tc_tcp_ip_address, test_ipv4_addr_3));
+ expected_config_3.insert(std::make_pair(tc_tcp_port, test_port));
+
+ EXPECT_CALL(adapter_controller_mock_,
+ TransportConfigUpdated(expected_config_3))
+ .Times(1);
+
+ tcp_client_listener_->OnIPAddressUpdated(test_ipv4_addr_3, test_ipv6_addr);
+
+ if (InterfaceNameSpecified()) {
+ EXPECT_TRUE(0 <= tcp_client_listener_->get_socket());
+
+ SleepFor(kThreadStartWaitMsec);
+
+ EXPECT_TRUE(tcp_client_listener_->thread()->is_running());
+ }
+
+ EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
+}
+
+TEST_P(TcpClientListenerTest, OnIPAddressUpdated_EmptyIPv4Address) {
+ EXPECT_CALL(*interface_listener_mock_, Init()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->Init());
+ EXPECT_CALL(*interface_listener_mock_, Start()).WillOnce(Return(true));
+ EXPECT_EQ(TransportAdapter::OK, tcp_client_listener_->StartListening());
+
+ const std::string test_ipv4_addr = "";
+ const std::string test_ipv6_addr = "";
+ char buf[16];
+ snprintf(buf, sizeof(buf), "%u", port_);
+ const std::string test_port(buf);
+
+ // if the client listener receives an empty IP address after started, it
+ // should ignore it
+ EXPECT_CALL(adapter_controller_mock_, TransportConfigUpdated(_)).Times(0);
+
+ tcp_client_listener_->OnIPAddressUpdated(test_ipv4_addr, test_ipv6_addr);
+
+ if (InterfaceNameSpecified()) {
+ EXPECT_EQ(-1, tcp_client_listener_->get_socket());
+
+ SleepFor(kThreadStartWaitMsec);
+
+ EXPECT_FALSE(tcp_client_listener_->thread()->is_running());
+ }
+
+ EXPECT_CALL(*interface_listener_mock_, Stop()).WillOnce(Return(true));
+ EXPECT_CALL(*interface_listener_mock_, Deinit()).Times(1);
+}
+
+INSTANTIATE_TEST_CASE_P(NetworkInterfaceName,
+ TcpClientListenerTest,
+ ::testing::Values(std::string(""),
+ std::string("dummy_interface0")));
+
} // namespace transport_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/transport_manager/test/tcp_device_test.cc b/src/components/transport_manager/test/tcp_device_test.cc
index 55fa5ac5d3..f52270d1ee 100644
--- a/src/components/transport_manager/test/tcp_device_test.cc
+++ b/src/components/transport_manager/test/tcp_device_test.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "transport_manager/tcp/tcp_device.h"
+#include "gtest/gtest.h"
#include "transport_manager/transport_adapter/device.h"
namespace test {
diff --git a/src/components/transport_manager/test/tcp_transport_adapter_test.cc b/src/components/transport_manager/test/tcp_transport_adapter_test.cc
index dd587569d3..cacdfb6fbd 100644
--- a/src/components/transport_manager/test/tcp_transport_adapter_test.cc
+++ b/src/components/transport_manager/test/tcp_transport_adapter_test.cc
@@ -30,25 +30,25 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "transport_manager/tcp/tcp_transport_adapter.h"
-#include "resumption/last_state_impl.h"
+#include "gtest/gtest.h"
#include "protocol/raw_message.h"
+#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "transport_manager/mock_transport_manager_settings.h"
+#include "transport_manager/tcp/mock_tcp_transport_adapter.h"
#include "transport_manager/transport_adapter/connection.h"
-#include "transport_manager/transport_adapter/mock_transport_adapter_listener.h"
-#include "transport_manager/transport_adapter/mock_device.h"
#include "transport_manager/transport_adapter/mock_connection.h"
-#include "transport_manager/tcp/mock_tcp_transport_adapter.h"
-#include "transport_manager/mock_transport_manager_settings.h"
-
-#include "utils/make_shared.h"
+#include "transport_manager/transport_adapter/mock_device.h"
+#include "transport_manager/transport_adapter/mock_transport_adapter_listener.h"
namespace test {
namespace components {
namespace transport_manager_test {
-using ::testing::Return;
using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
using namespace ::protocol_handler;
using namespace ::transport_manager;
@@ -56,19 +56,31 @@ using namespace transport_manager::transport_adapter;
class TcpAdapterTest : public ::testing::Test {
protected:
- TcpAdapterTest() : last_state_("app_storage_folder", "app_info_storage") {}
+ TcpAdapterTest() {
+ last_state_wrapper_ = std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>("app_storage_folder",
+ "app_info_storage"));
+ }
MockTransportManagerSettings transport_manager_settings;
- resumption::LastStateImpl last_state_;
+ std::shared_ptr<resumption::LastStateWrapperImpl> last_state_wrapper_;
const uint32_t port = 12345;
const std::string string_port = "12345";
+ std::string network_interface = "";
+
+ void SetUp() OVERRIDE {
+ EXPECT_CALL(transport_manager_settings,
+ transport_manager_tcp_adapter_network_interface())
+ .WillRepeatedly(ReturnRef(network_interface));
+ }
};
TEST_F(TcpAdapterTest, StoreDataWithOneDeviceAndOneApplication) {
// Prepare
MockTCPTransportAdapter transport_adapter(
- port, last_state_, transport_manager_settings);
+ port, last_state_wrapper_, transport_manager_settings);
std::string uniq_id = "unique_device_name";
- utils::SharedPtr<MockTCPDevice> mockdev = new MockTCPDevice(port, uniq_id);
+ std::shared_ptr<MockTCPDevice> mockdev =
+ std::make_shared<MockTCPDevice>(port, uniq_id);
transport_adapter.AddDevice(mockdev);
std::vector<std::string> devList = transport_adapter.GetDeviceList();
@@ -79,7 +91,7 @@ TEST_F(TcpAdapterTest, StoreDataWithOneDeviceAndOneApplication) {
std::vector<int> intList = {app_handle};
EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(intList));
- ConnectionSPtr mock_connection = new MockConnection();
+ ConnectionSPtr mock_connection = std::make_shared<MockConnection>();
EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
EXPECT_CALL(transport_adapter, FindEstablishedConnection(uniq_id, app_handle))
.WillOnce(Return(mock_connection));
@@ -89,8 +101,9 @@ TEST_F(TcpAdapterTest, StoreDataWithOneDeviceAndOneApplication) {
transport_adapter.CallStore();
// Check that value is saved
- Json::Value& tcp_dict =
- last_state_.get_dictionary()["TransportManager"]["TcpAdapter"];
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ const Json::Value dictionary = accessor.GetData().dictionary();
+ const Json::Value& tcp_dict = dictionary["TransportManager"]["TcpAdapter"];
ASSERT_TRUE(tcp_dict.isObject());
ASSERT_FALSE(tcp_dict["devices"].isNull());
@@ -105,15 +118,15 @@ TEST_F(TcpAdapterTest, StoreDataWithOneDeviceAndOneApplication) {
TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndOneApplication) {
// Prepare
MockTCPTransportAdapter transport_adapter(
- port, last_state_, transport_manager_settings);
+ port, last_state_wrapper_, transport_manager_settings);
const uint32_t count_dev = 10;
- utils::SharedPtr<MockTCPDevice> mockdev[count_dev];
+ std::shared_ptr<MockTCPDevice> mockdev[count_dev];
std::string uniq_id[count_dev];
for (uint32_t i = 0; i < count_dev; i++) {
char numb[12];
std::snprintf(numb, 12, "%d", i);
uniq_id[i] = "unique_device_name" + std::string(numb);
- mockdev[i] = new MockTCPDevice(port, uniq_id[i]);
+ mockdev[i] = std::make_shared<MockTCPDevice>(port, uniq_id[i]);
EXPECT_CALL(*(mockdev[i]), IsSameAs(_)).WillRepeatedly(Return(false));
transport_adapter.AddDevice(mockdev[i]);
}
@@ -125,7 +138,7 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndOneApplication) {
const int app_handle = 1;
std::vector<int> intList = {app_handle};
- ConnectionSPtr mock_connection = new MockConnection();
+ ConnectionSPtr mock_connection = std::make_shared<MockConnection>();
for (uint32_t i = 0; i < count_dev; i++) {
EXPECT_CALL(transport_adapter, FindDevice(uniq_id[i]))
.WillOnce(Return(mockdev[i]));
@@ -141,8 +154,9 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndOneApplication) {
transport_adapter.CallStore();
// Check that values are saved
- Json::Value& tcp_dict =
- last_state_.get_dictionary()["TransportManager"]["TcpAdapter"];
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ const Json::Value dictionary = accessor.GetData().dictionary();
+ const Json::Value& tcp_dict = dictionary["TransportManager"]["TcpAdapter"];
ASSERT_TRUE(tcp_dict.isObject());
ASSERT_FALSE(tcp_dict["devices"].isNull());
@@ -159,16 +173,16 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndOneApplication) {
TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndSeveralApplications) {
// Prepare
MockTCPTransportAdapter transport_adapter(
- port, last_state_, transport_manager_settings);
+ port, last_state_wrapper_, transport_manager_settings);
const uint32_t count_dev = 10;
- utils::SharedPtr<MockTCPDevice> mockdev[count_dev];
+ std::shared_ptr<MockTCPDevice> mockdev[count_dev];
std::string uniq_id[count_dev];
for (uint32_t i = 0; i < count_dev; i++) {
char numb[12];
std::snprintf(numb, 12, "%d", i);
uniq_id[i] = "unique_device_name" + std::string(numb);
- mockdev[i] = new MockTCPDevice(port, uniq_id[i]);
+ mockdev[i] = std::make_shared<MockTCPDevice>(port, uniq_id[i]);
EXPECT_CALL(*(mockdev[i]), IsSameAs(_)).WillRepeatedly(Return(false));
transport_adapter.AddDevice(mockdev[i]);
}
@@ -182,7 +196,7 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndSeveralApplications) {
std::vector<int> intList = {app_handle[0], app_handle[1], app_handle[2]};
const std::string ports[connection_count] = {"11111", "67890", "98765"};
const int int_port[connection_count] = {11111, 67890, 98765};
- ConnectionSPtr mock_connection = new MockConnection();
+ ConnectionSPtr mock_connection = std::make_shared<MockConnection>();
for (uint32_t i = 0; i < count_dev; i++) {
EXPECT_CALL(transport_adapter, FindDevice(uniq_id[i]))
.WillOnce(Return(mockdev[i]));
@@ -199,8 +213,9 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndSeveralApplications) {
transport_adapter.CallStore();
// Check that value is saved
- Json::Value& tcp_dict =
- last_state_.get_dictionary()["TransportManager"]["TcpAdapter"];
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ const Json::Value dictionary = accessor.GetData().dictionary();
+ const Json::Value& tcp_dict = dictionary["TransportManager"]["TcpAdapter"];
ASSERT_TRUE(tcp_dict.isObject());
ASSERT_FALSE(tcp_dict["devices"].isNull());
@@ -218,9 +233,9 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndSeveralApplications) {
TEST_F(TcpAdapterTest, StoreData_ConnectionNotExist_DataNotStored) {
// Prepare
MockTCPTransportAdapter transport_adapter(
- port, last_state_, transport_manager_settings);
+ port, last_state_wrapper_, transport_manager_settings);
std::string uniq_id = "unique_device_name";
- utils::SharedPtr<MockTCPDevice> mockdev = new MockTCPDevice(port, uniq_id);
+ auto mockdev = std::make_shared<MockTCPDevice>(port, uniq_id);
transport_adapter.AddDevice(mockdev);
std::vector<std::string> devList = transport_adapter.GetDeviceList();
@@ -236,28 +251,35 @@ TEST_F(TcpAdapterTest, StoreData_ConnectionNotExist_DataNotStored) {
transport_adapter.CallStore();
// Check that value is not saved
- Json::Value& tcp_dict =
- last_state_.get_dictionary()["TransportManager"]["TcpAdapter"]["devices"];
+ resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor();
+ const Json::Value dictionary = accessor.GetData().dictionary();
+ const Json::Value& tcp_dict =
+ dictionary["TransportManager"]["TcpAdapter"]["devices"];
ASSERT_TRUE(tcp_dict.isNull());
}
TEST_F(TcpAdapterTest, RestoreData_DataNotStored) {
- Json::Value& tcp_adapter_dictionary =
- last_state_.get_dictionary()["TransportManager"]["TcpAdapter"];
-
- tcp_adapter_dictionary = Json::Value();
+ {
+ resumption::LastStateAccessor accessor =
+ last_state_wrapper_->get_accessor();
+ Json::Value dictionary = accessor.GetData().dictionary();
+ Json::Value& tcp_dictionary = dictionary["TransportManager"]["TcpAdapter"];
+ tcp_dictionary = Json::Value();
+ accessor.GetMutableData().set_dictionary(dictionary);
+ }
MockTCPTransportAdapter transport_adapter(
- port, last_state_, transport_manager_settings);
+ port, last_state_wrapper_, transport_manager_settings);
EXPECT_CALL(transport_adapter, Connect(_, _)).Times(0);
EXPECT_TRUE(transport_adapter.CallRestore());
}
TEST_F(TcpAdapterTest, StoreDataWithOneDevice_RestoreData) {
MockTCPTransportAdapter transport_adapter(
- port, last_state_, transport_manager_settings);
+ port, last_state_wrapper_, transport_manager_settings);
std::string uniq_id = "unique_device_name";
- utils::SharedPtr<MockTCPDevice> mockdev = new MockTCPDevice(port, uniq_id);
+ std::shared_ptr<MockTCPDevice> mockdev =
+ std::make_shared<MockTCPDevice>(port, uniq_id);
transport_adapter.AddDevice(mockdev);
std::vector<std::string> devList = transport_adapter.GetDeviceList();
@@ -268,7 +290,7 @@ TEST_F(TcpAdapterTest, StoreDataWithOneDevice_RestoreData) {
std::vector<int> intList = {app_handle};
EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(intList));
- ConnectionSPtr mock_connection = new MockConnection();
+ ConnectionSPtr mock_connection = std::make_shared<MockConnection>();
EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
EXPECT_CALL(transport_adapter, FindEstablishedConnection(uniq_id, app_handle))
.WillOnce(Return(mock_connection));
@@ -289,16 +311,16 @@ TEST_F(TcpAdapterTest, StoreDataWithOneDevice_RestoreData) {
TEST_F(TcpAdapterTest, StoreDataWithSeveralDevices_RestoreData) {
MockTCPTransportAdapter transport_adapter(
- port, last_state_, transport_manager_settings);
+ port, last_state_wrapper_, transport_manager_settings);
const uint32_t count_dev = 10;
- utils::SharedPtr<MockTCPDevice> mockdev[count_dev];
+ std::shared_ptr<MockTCPDevice> mockdev[count_dev];
std::string uniq_id[count_dev];
for (uint32_t i = 0; i < count_dev; i++) {
char numb[12];
std::snprintf(numb, 12, "%d", i);
uniq_id[i] = "unique_device_name" + std::string(numb);
- mockdev[i] = new MockTCPDevice(port, uniq_id[i]);
+ mockdev[i] = std::make_shared<MockTCPDevice>(port, uniq_id[i]);
EXPECT_CALL(*(mockdev[i]), IsSameAs(_)).WillRepeatedly(Return(false));
transport_adapter.AddDevice(mockdev[i]);
}
@@ -310,7 +332,7 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevices_RestoreData) {
const int app_handle = 1;
std::vector<int> intList = {app_handle};
- ConnectionSPtr mock_connection = new MockConnection();
+ ConnectionSPtr mock_connection = std::make_shared<MockConnection>();
for (uint32_t i = 0; i < count_dev; i++) {
EXPECT_CALL(transport_adapter, FindDevice(uniq_id[i]))
.WillOnce(Return(mockdev[i]));
@@ -339,6 +361,39 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevices_RestoreData) {
}
}
+TEST_F(TcpAdapterTest, NotifyTransportConfigUpdated) {
+ MockTransportAdapterListener mock_adapter_listener;
+
+ TcpTransportAdapter transport_adapter(
+ port, last_state_wrapper_, transport_manager_settings);
+ transport_adapter.AddListener(&mock_adapter_listener);
+
+ TransportConfig config;
+ config[tc_enabled] = std::string("true");
+ config[tc_tcp_ip_address] = std::string("192.168.1.1");
+ config[tc_tcp_port] = std::string("12345");
+
+ EXPECT_CALL(mock_adapter_listener,
+ OnTransportConfigUpdated(&transport_adapter))
+ .Times(1);
+
+ transport_adapter.TransportConfigUpdated(config);
+}
+
+TEST_F(TcpAdapterTest, GetTransportConfiguration) {
+ MockTCPTransportAdapter transport_adapter(
+ port, last_state_wrapper_, transport_manager_settings);
+
+ TransportConfig config;
+ config[tc_enabled] = std::string("true");
+ config[tc_tcp_ip_address] = std::string("192.168.1.1");
+ config[tc_tcp_port] = std::string("12345");
+
+ transport_adapter.TransportConfigUpdated(config);
+
+ EXPECT_EQ(config, transport_adapter.GetTransportConfiguration());
+}
+
} // namespace transport_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/transport_manager/test/test_certs/ca-cert.pem b/src/components/transport_manager/test/test_certs/ca-cert.pem
new file mode 100644
index 0000000000..e28684043c
--- /dev/null
+++ b/src/components/transport_manager/test/test_certs/ca-cert.pem
@@ -0,0 +1,23 @@
+-----BEGIN CERTIFICATE-----
+MIIDyzCCArOgAwIBAgIJAM6Tk4KJmUgsMA0GCSqGSIb3DQEBCwUAMHwxCzAJBgNV
+BAYTAlVBMQ8wDQYDVQQIDAZPZGVzc2ExDzANBgNVBAcMBk9kZXNzYTEPMA0GA1UE
+CgwGTHV4b2Z0MQ0wCwYDVQQLDARGVENOMQ8wDQYDVQQDDAZMdXgtQ0ExGjAYBgkq
+hkiG9w0BCQEWC2NhQGZ0Y24uY29tMB4XDTIwMDExMDE0MzA1OFoXDTIyMTAwNjE0
+MzA1OFowfDELMAkGA1UEBhMCVUExDzANBgNVBAgMBk9kZXNzYTEPMA0GA1UEBwwG
+T2Rlc3NhMQ8wDQYDVQQKDAZMdXhvZnQxDTALBgNVBAsMBEZUQ04xDzANBgNVBAMM
+Bkx1eC1DQTEaMBgGCSqGSIb3DQEJARYLY2FAZnRjbi5jb20wggEiMA0GCSqGSIb3
+DQEBAQUAA4IBDwAwggEKAoIBAQDWEz7yGIAEs6w/7CdMjkZ5J0O9IghL0f9wZVFO
+ficeREJglClInPrD7BwG7MG1tydPULbrf1rXgxi1NdDY+lsJLFmkxrGVlgJUJl55
+cGpWGliTUepfPz/6CgIabRw2fEMx/eIUlcE+WjY+f4uowVyRYjmNj7IydlQ5UjcL
+wWhjg1QMcjgmDzh8Jdx8I+JHYuOP9CtEEfFZy5DjVPFDSlTYhhnNclfw+4NkOYcs
+hp+EcMBr6egfxpG2dZbdCJtGw6QqHGG7kqqtLr+9wM5VFhuvebus5waM1G18dIME
+SgZmDdgvHO3bbylR+DRmAjJVn4DaDW6uszK9MSPsk53idOUXAgMBAAGjUDBOMB0G
+A1UdDgQWBBSSRwc4sGpz6V1kb0H371ZqhDuQDzAfBgNVHSMEGDAWgBSSRwc4sGpz
+6V1kb0H371ZqhDuQDzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCb
+ZYtM2nrokFL1D34bhozrLu0MxWwDF+gQrUsRr45s63Y5Pv7BVvuS6gF2MubMXskw
+mVeCerFw2vQHJKqe7leTy69hwIydPxPQWWno7MamwBDm3VQThr+b18rEpcjbmBMm
+p50usYzU9nxEEbIaiSbxfuZNvInLNmvMhKnKO/CIazJnYin9TGdOj9vZnh0UkWF3
+780mMBisycfxG+VwPXQZz5OzWWFB1uMiYrRVdwU6Y5umc2Oce7+ykWy+fXeefMhb
+lLJXHZK584qY/krmW0Ec6ZWSbiWcLW5SjGh756n05gBGLDBwijHnfEHNaqn+KlnZ
+qqIAImNTA9F+DlMQ7BV3
+-----END CERTIFICATE-----
diff --git a/src/components/transport_manager/test/test_certs/client-cert.pem b/src/components/transport_manager/test/test_certs/client-cert.pem
new file mode 100644
index 0000000000..47e85876c8
--- /dev/null
+++ b/src/components/transport_manager/test/test_certs/client-cert.pem
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDeDCCAmACAQIwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVUExDzANBgNV
+BAgMBk9kZXNzYTEPMA0GA1UEBwwGT2Rlc3NhMQ8wDQYDVQQKDAZMdXhvZnQxDTAL
+BgNVBAsMBEZUQ04xDzANBgNVBAMMBkx1eC1DQTEaMBgGCSqGSIb3DQEJARYLY2FA
+ZnRjbi5jb20wHhcNMjAwMTEwMTQzODQxWhcNMjIxMDA2MTQzODQxWjCBhzELMAkG
+A1UEBhMCVUExDTALBgNVBAgMBEt5aXYxDTALBgNVBAcMBEt5aXYxDzANBgNVBAoM
+Bkx1eG9mdDEVMBMGA1UECwwMQXBwc0VueXdoZXJlMRIwEAYDVQQDDAlsb2NhbGhv
+c3QxHjAcBgkqhkiG9w0BCQEWD2NsaWVudEBmdGNuLmNvbTCCASIwDQYJKoZIhvcN
+AQEBBQADggEPADCCAQoCggEBALV4qI/gRvVip3u5JtT+n+7j7gUsUVW5DtwHruIy
+drzNvQbG1Ukd3EXvU69HTG4BtoDRubqlSe/sjvO5Ypmg/UvpzV36IbjrA46s98uR
+T6fKpJU/Zl2zwAHH++iWpFo3mqIDmu7i0KVBieKaGpz+Ft0zh7wHAztS7b6Mjns4
+QynpjDO+iaLIaHqBjc1hLn8dIBXNolOtLu8F8CL7RLRpWP2I2Fk2k0+Q5YKajbil
+gptA53Uu55wCBVLTOfUYzTarGwS00+7txLY06g2x20FHD8UQxfCK7kSAeZwSNkbt
+SUhXc9OWUvT1uggb2/wBHJN3fwj7y6pvzUJy7p09212hw7UCAwEAATANBgkqhkiG
+9w0BAQsFAAOCAQEAjfASZwfJMTPKk45XVbvuNqdlbiI20SNV7pQQ/FqTBKbFmh4g
+ndNCvECmBEUH5YdZegiGaONQlsQujmtIkguu3HnA0+2pO2SncmK6D1DLzJv1IFDC
+25tTStA6806hWcTK31sxEbi5/aPdy7FMmsRfyhRr/yew0TqlWCVOfJRwgDSc3NKH
+/AXgDBrqHzSBegnWe9v3xL8NxehFp41dJG2fyUab03cHzmNtR9v7/NrBglSdK9VS
+AU4BCmjmvYlbvmvhZai23y+uLqzlWZ9OtK3qhEWkg6QHor11iBvxBQFeYKp1ZjMl
+sQuTxyBLmXOZ/u3hkqLcKvasx9W4DmmPjG2T8Q==
+-----END CERTIFICATE-----
diff --git a/src/components/transport_manager/test/test_certs/client-key.pem b/src/components/transport_manager/test/test_certs/client-key.pem
new file mode 100644
index 0000000000..b286854bd5
--- /dev/null
+++ b/src/components/transport_manager/test/test_certs/client-key.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC1eKiP4Eb1Yqd7
+uSbU/p/u4+4FLFFVuQ7cB67iMna8zb0GxtVJHdxF71OvR0xuAbaA0bm6pUnv7I7z
+uWKZoP1L6c1d+iG46wOOrPfLkU+nyqSVP2Zds8ABx/volqRaN5qiA5ru4tClQYni
+mhqc/hbdM4e8BwM7Uu2+jI57OEMp6YwzvomiyGh6gY3NYS5/HSAVzaJTrS7vBfAi
++0S0aVj9iNhZNpNPkOWCmo24pYKbQOd1LuecAgVS0zn1GM02qxsEtNPu7cS2NOoN
+sdtBRw/FEMXwiu5EgHmcEjZG7UlIV3PTllL09boIG9v8ARyTd38I+8uqb81Ccu6d
+PdtdocO1AgMBAAECggEALiPCf+pfQE7YFJ4L4IXo9h1fzFLrTydhPtJ5RavdAr4w
+vINbgV6lPebO2TcAmMu4smIgnfMerHDyG8fb6QHExUNp4uYRIuomGmWiD1Ef9qKQ
+XB4lkdd9Dzbgts9udD3FBEJ0Zx6mPA5A16uk7puwBofukAEccj3wks08ANpaQVJh
+LoYQdVY9Q2QHUucED9uO2hOv66bDM5aunk0x4Q/b0gIOAnJyqk0xXnmnU76FbkgI
+bU3YQ73ZEJKTFLF8B2JaE9REASmHyLQChYqGA9SPdObVhgxJ8gz5AWp5yHgMmYjf
+Dp66tCsyGnmfgTlG4Wi13HInxLpRWDWT2JWIy9cUlQKBgQDshRq/rTj4tuVW09hX
+bWlAEV2IDn7JOWEZqPagnxew0atqow44VORW+OoUZ5760aOVjvmXeyGXpWCJk5ch
+qsFRL9rLRzIy9oC6C/chkJQAprcaOBOSXvj3HnFHVChjbIBENf4dvtsYZHOW42h2
+br0kszv1bbBzVIyTTY0OvGsBUwKBgQDEauIuC6RiDN+qFAf4/lHkUx7wG6DPhvDm
+EhpkiVEHYVjH5vm132/cc12y9CvsFS4MJPK4KQR9P+HFhEu/uH3uLa1vvKY+69iU
+dZ1bfe4UrEm/bwBepDSbqlQk58WC6NyJ6fwMq0BYJVvx593znEbU2wLVUTm8H7l2
+yzyxQwXd1wKBgBkYvo/cJ5FshsVB0VDlkSd1MEGBmD5t0jnQzeqZNwBSHyg/iQC9
+MUVxQBVOMXZXzE3QT/ec3yGiMK4odP7jiYO92i97rH3v3hTftCdhmfK/veoQTTNY
+1H4UQtzYtzhliO6z8/TgDYt3DTTTiIAYnAVK52/RZcm3DPuMXQ1VPN11AoGBAIN5
+eASSTmpDa8OQvPVyZqaK7P6Tv8Sp8r5OB9ScBd0G0EKe3S9cbKgHoQSUZIIWe0gt
+wzp6WkLsa9emgn3GpKS1do6AnFcpz0MwpzACz0aPPJ4jUwAGsiAwlzpM2eySqmy2
+brycNOnLuAvoxKy4QsFgCDl5sUe3hJF74RhWYKrpAoGAUrJMF5IaAAsv367nD8CX
+CfDsDlez54H/sZD7iKj8LhyuspAQBU3vQ3xKfaKRi4px8bgnty3stOMZxEC7I6BC
+jHH1hQK8l9nqRhOjPvoViUM6aOpabCkVsOZjWKD+OCz3X9+MmlGkMuNd22GRdwlb
+Emb3yEoFr5vDbez0IQNxnLs=
+-----END PRIVATE KEY-----
diff --git a/src/components/transport_manager/test/test_certs/invalid_cert.pem b/src/components/transport_manager/test/test_certs/invalid_cert.pem
new file mode 100644
index 0000000000..70d124c2b7
--- /dev/null
+++ b/src/components/transport_manager/test/test_certs/invalid_cert.pem
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDlDCCAnwCCQDIe7AwFpWRlDANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMC
+UlUxEzARBgNVBAgMClNvbWUtU3RhdGUxGTAXBgNVBAcMEFNhaW50LVBldGVyc2J1
+cmcxDzANBgNVBAoMBkx1eG9mdDEXMBUGA1UEAwwORG1pdHJ5IENobWVyZXYxIjAg
+BgkqhkiG9w0BCQEWE2RjaG1lcmV2QGx1eG9mdC5jb20wHhcNMTQwMjI1MDkxODUz
+WhcNMTYxMTIyMDkxODUzWjCBizELMAkGA1UEBhMCUlUxEzARBgNVBAgMClNvbWUt
+U3RhdGUxGTAXBgNVBAcMEFNhaW50LVBldGVyc2J1cmcxDzANBgNVBAoMBkx1eG9m
+dDEXMBUGA1UEAwwORG1pdHJ5IENobWVyZXYxIjAgBgkqhkiG9w0BCQEWE2RjaG1l
+cmV2QGx1eG9mdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCn
+Mu9wNmXKaKOnefSv5iT8G2ESLjq+eYlxys/XAnDfkmnlgGYAcPno+XMhRj/lNV/c
+3A0L/R4631GFJA8vaM8m9Bn47FrPP4AXIHEQh9acA4qXiLfhhA8+9PPt4xVkjQYj
+bmexBLqDvRgT3MJwwFecUn/UABBlVZRCspn+6DkjiodbgmBOqyi1p0ng8BFeUbEH
++fLQVILCX3pjnMiP2bBtvq/7njgZT2luVtAAcOdRwRTuZT0YbgaXrHYsOa6VYDl1
+I0uOcdD8qENBXtBnykEqH+jZtKu6Rej1DsGOYWqz3AAaGiR1GJauNBxh+4v+i/eB
+0aCIA8T8qUqyuVVg48S/AgMBAAEwDQYJKoZIhvcNAQEFBQADggEBACliraOJYijK
+yS+Sl6S6pFRqdF/evPdYF6zDJlM3P+/9qHoEy751vbBTzRkVbC/azyiZLwQMuyED
+6oCpkI7MqnrRip1ZelGx9K7ChaHOpX/QRN+3eqiDhzvMTGd2nPJf9np4xi8SJpGP
+UUROYI5fToIY5MaOKuOIR2a6c8xIuLWMG1XKJxXrRetLJZDgBqQPkuqaZIjYCY+q
+HQRjNUFNX4Mc453tKd90gFLGI3fxs1fJDIRSGfKJsj0qc+amSz4Sgiz4QUBcUQKd
+hJxUpStYhliZGZchEopLsShtIGfKKFaaPCIOTpVAwSr1oIDm9lpkdxeuQfedKT5f
+ZZmkez2pAF8=
+-----END CERTIFICATE-----
diff --git a/src/components/transport_manager/test/test_certs/invalid_key.pem b/src/components/transport_manager/test/test_certs/invalid_key.pem
new file mode 100644
index 0000000000..d2aacc1638
--- /dev/null
+++ b/src/components/transport_manager/test/test_certs/invalid_key.pem
@@ -0,0 +1,28 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEApzLvcDZlymijp3n0r+Yk/BthEi46vnmJccrP1wJw35Jp5YBm
+AHD56PlzIUY/5TVf3NwNC/0eOt9RhSQPL2jPJvQZ+Oxazz+AFyBxEIfWnAOKl4i3
+4YQPPvTz7eMVZI0GI25nsQS6g70YE9zCcMBXnFJ/1AAQZVWUQrKZ/ug5I4qHW4Jg
+TqsotadJ4PARXlGxB/ny0FSCwl96Y5zIj9mwbb6v+544GU9pblbQAHDnUcEU7mU9
+GG4Gl6x2LDmulWA5dSNLjnHQ/KhDQV7QZ8pBKh/o2bSrukXo9Q7BjmFqs9wAGhok
+dRiWrjQcYfuL/ov3gdGgiAPE/KlKsrlVYOPEvwIDAQABAoIBAQCAjkNXzhuZ87bR
+UI34qUYKqaqLZgw45A3v9naz5OaQoGzXz0+eSz98CECjdvYt8EoS8Qb/DtGthoOR
+kVYzp6yPUOSfZmu0Kij8ny8P/MHgF0D6nl50ASwPxhu/7vhF5cCwgXUswGwAWuYm
+b3j5ZIp4YV5zzNDOeWyTk+uf+UHltqFD7Ae4M9z58r17/OWhva5mtusTuuEYjzC6
+AE/fsOC0gLNSM4+SfclfCkHpH+GikzNMSQ2H0hlXllPmR73BoC6N6aoY5hQWBLV7
+LxtYbJqx7TAqRyypBQekjJe36roRetXtzy3i6V/y69045td5kk70cVjmFhl79475
+82rnRLHBAoGBANgq4axr5OotTUmPkGd0afoaWSRPJfiTTdNeMkqTzM6zIcVLSKhB
+78ERwdDD9FOu+Bgivg4DlpmH7ArWn8QNDtdkhmPfKYfTqX6qH7AK4cybvYICMlct
+EdW4TvKm/ZB3mrVOP9JVPjdyFMp+Je6N+qp1w+ui9mxX8pWnrC/+DfTvAoGBAMYC
+GFjnw/O9hjF2Mb00qUarmM+reJZMXv/pVik+cm0eAiYvgGvKbAYkIXwdb7rLBw9k
+baJmxP0PrAoXy5TpPdfROqPwrRCyReKymKkEZeTpONgD0s8MbX167ovZu1OQVKQo
+IyJeUzWa0kpglnbL2lLVu49x8jWHDJdYhmkDNE0xAoGAR4ux07qGMoe5693rYoJi
+TRgJZv4XSDWg7ZNgu9Q9VjBtvfoT2zSvoMw6xNkGdegUTxC4rLS9VKVrF48/o8ja
+n6my3T1QZpdEoxq1kDOZ1nm5eF03wii1nXH6F0/z3qvndZingPsbs4g7n2WvMkyl
+qWN+6++s9eEJ9kRftia1AdsCgYAUnU05nE97RcT9y0dcYmopMF5FaJ2yUBsn23wb
+6SNylsg0f4eIMVfTv9k4mbvzH4YJpTQAz2A81G/d0SJhy3Kj0GWhgcIS1eyOsHdS
+SWHuVhWT77n30lxnzu+c4bst9P3K5V7bCiTxlL/F/I5NqeV98ECJq5xC1F+MNiww
+LKQ6UQKBgC2zL59Vf8QnRkRN0gOUfs3ejrLcxFRzTXvcKqcHtbaqzCs3qSNC6UvV
+wjBazEwQCo1wnM81X8uT5fLhnjXebWtnYexQo5P38PiaqTQDgrbAdhP5P8NwRCXM
+G3SNEz0XeL27jmWjf0VJdwD0LuHXYhcwAWq4alhJ024rjgVHwOze
+-----END RSA PRIVATE KEY-----
+
diff --git a/src/components/transport_manager/test/test_certs/server-cert.pem b/src/components/transport_manager/test/test_certs/server-cert.pem
new file mode 100644
index 0000000000..d2b1cf0ec8
--- /dev/null
+++ b/src/components/transport_manager/test/test_certs/server-cert.pem
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDdDCCAlwCAQEwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVUExDzANBgNV
+BAgMBk9kZXNzYTEPMA0GA1UEBwwGT2Rlc3NhMQ8wDQYDVQQKDAZMdXhvZnQxDTAL
+BgNVBAsMBEZUQ04xDzANBgNVBAMMBkx1eC1DQTEaMBgGCSqGSIb3DQEJARYLY2FA
+ZnRjbi5jb20wHhcNMjAwMTEwMTQzMzM2WhcNMjIxMDA2MTQzMzM2WjCBgzELMAkG
+A1UEBhMCVUExDzANBgNVBAgMBk9kZXNzYTEPMA0GA1UEBwwGT2Rlc3NhMQ8wDQYD
+VQQKDAZMdXhvZnQxDTALBgNVBAsMBEZUQ04xEjAQBgNVBAMMCWxvY2FsaG9zdDEe
+MBwGCSqGSIb3DQEJARYPc2VydmVyQGZ0Y24uY29tMIIBIjANBgkqhkiG9w0BAQEF
+AAOCAQ8AMIIBCgKCAQEApnW3zyWadWiD1eMPszMM0Hyzm3Zd6mr21LMtQMwqw10p
+PxMpZLo0rgCkJevVRxO/y4J+TcE9LtralzzsWK+DD/i2Gf8CfAOapcDETJ8b68jM
+rUMwmN3tdiEBqimHBKEKIgDOiJt2Y08Jw2AWR41LuyjtD+IWSWo1kqJF3rxpsfz0
+SfTQWkvHVXg1c0qbfsp2i82Nvt5HzvDdk0jzX+GNHSmkUECcE0GIhK8GHxAFYugk
+siRU/tgY/wzP9iUkj7UbPWb5k+d8Z3sqUFpVAa4dXhIzx5L0l5peXvhunYqr7Vk+
+cfBAHIQZKJa7coBBahA7gjBylz+BbIOadGYYoYZVBQIDAQABMA0GCSqGSIb3DQEB
+CwUAA4IBAQDNUMIv6X9scvVN8II/PbvvQzWAxi0qzDejnEF579PA9MCNt6JY20lj
+JTscUN5lWNuLGJtkUuscBMBYe21ePtGeS855Q6csoUe6m0fnY+ybKVYIKk+SL5Hx
+1vurBIsHOyX6097e8VIzWyxcWW1074oTYLpYfEWr0vECrGodoXGtPdEeyB0+QdbI
+H0Pcngqu5yLoWxoWwuAj94YG7eX3sJv6PXOW71i4yMmT8ToYNXFwqTK/xq/pl6H2
+KH150zDNOaE2Z5+u21Elau+3qWPWQ6C9KpxhmJ/iDftRe+hgMISSygYK0nwk0zk4
+rmNODAeuTvsrh9bNsYQfjERsh0VYaG24
+-----END CERTIFICATE-----
diff --git a/src/components/transport_manager/test/test_certs/server-key.pem b/src/components/transport_manager/test/test_certs/server-key.pem
new file mode 100644
index 0000000000..6ff13eaf28
--- /dev/null
+++ b/src/components/transport_manager/test/test_certs/server-key.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCmdbfPJZp1aIPV
+4w+zMwzQfLObdl3qavbUsy1AzCrDXSk/EylkujSuAKQl69VHE7/Lgn5NwT0u2tqX
+POxYr4MP+LYZ/wJ8A5qlwMRMnxvryMytQzCY3e12IQGqKYcEoQoiAM6Im3ZjTwnD
+YBZHjUu7KO0P4hZJajWSokXevGmx/PRJ9NBaS8dVeDVzSpt+ynaLzY2+3kfO8N2T
+SPNf4Y0dKaRQQJwTQYiErwYfEAVi6CSyJFT+2Bj/DM/2JSSPtRs9ZvmT53xneypQ
+WlUBrh1eEjPHkvSXml5e+G6diqvtWT5x8EAchBkolrtygEFqEDuCMHKXP4Fsg5p0
+ZhihhlUFAgMBAAECggEBAJ35UfuxACk0iwlNd/TlGeAyuHFtoCt8X8v0T5oTKPJH
+U4GcucfyP1RzH1Utvza5M2f768n2/g2dfZ3SH6r6xjM+IfQB42W2NengS2s8BM97
+vWMhRNmOpHFbWa0XxB9MhcVHZrqWb4BH3kggxIQbQCfa60ALnIMH3NfQUObVgKl8
+khPU3fWx5zH2fbLNiLbImr5U5ViNoOKw592cmAEocIgIE33SDf2LHuuByikb38/r
+98bAp6IdNhRb7qY/Jllq3fu06fLubGQusVT01vu3sp//G2gCzFwp0O/qX2M1JBPS
+JYKKGXrNxeaQNzzD6cEcSkADpZvIG/CmmnR9u/FjIXECgYEA2palcAJKXPWsnwLb
+QtDd7MQ6sG3qvkCaiiDsn5BAGkxn1rZ3NRGMxBx4Fb9oiIl6SBpQ/YdMkd7tMkLX
+MEmbPyOcHPnsxcCqeFGsiTejpx1OyPSUAtxtpxGc/D63wCPhHGO3xNdQ2FiYb5K3
+jG8cslE39gH+/9XSN8kS2gZZ4d8CgYEAwvMUbXSBYx01I+jjqsjSI9afk3w9VwKM
+vuW9MgUBYLP5ryadNqt2cuHydT5KJiZ7YUQSLNztZ++g5WR7yamWpLzoGFmrSyWb
+304xA9jdLRJHMsBM0V32abdfTV5+EW+24309UmcaUtsQoUTxXOSqwDaHF4Mq1zLg
+jwb2phYlzZsCgYEAtz5q2gdRh7R8TaD7ZnvqTz4BZT3/+BX4d6s6MlmfI2zB8AFu
+1ZIsy4qCMNkRLMTzOda15pOx4OddOTFHbDeIadnUWYY6s1zci5kMZsu56bJsBZLj
+MbLQSao+TEfXir+JS19dAyrtnzBGOeJo9NWA3QuxOg5aUuZRIGrz3spMN0kCgYB3
+ZLnpAwZO9k9aS8JLESypqEMY52kFxdj+/OKvJKOgXvkWzPZRyhcD6t878McmsEC1
+5COheDipg/etJaouan+JKuyWJSykHEdnLpMUQRfMB7q1GVKykvJb8mMaljltYlbG
+4ifRNLXJcsKvkfKkKqNsjriTrNBq9YzT67bZJw1F6wKBgGlEd9O+qWY4dSPKN60N
+khG1Splz+eBbbsqcISeFGZepEc4HaEIcYgIHTh8nw5ycYxh8A1UBdaBZmU9UHdfl
+j9M2u0htKZ27ntVVNZJCLeSgufaPUDIfvnK4o5q630NGhKJmVcYD3WeggIrPfca3
+fP8WaHq9fx5k4YZokD2VHOJb
+-----END PRIVATE KEY-----
diff --git a/src/components/transport_manager/test/transport_adapter_listener_test.cc b/src/components/transport_manager/test/transport_adapter_listener_test.cc
index 14b8850b49..9f18d5bc13 100644
--- a/src/components/transport_manager/test/transport_adapter_listener_test.cc
+++ b/src/components/transport_manager/test/transport_adapter_listener_test.cc
@@ -76,7 +76,8 @@ TEST_F(TransportAdapterListenerTest, OnCommunicationError) {
ReceiveEventFromDevice(IsEvent(EventTypeEnum::ON_COMMUNICATION_ERROR,
&adapter_mock,
dev_id,
- app_handle))).WillOnce(Return(E_SUCCESS));
+ app_handle)))
+ .WillOnce(Return(E_SUCCESS));
transport_listener.OnCommunicationError(&adapter_mock, dev_id, app_handle);
}
@@ -129,7 +130,7 @@ TEST_F(TransportAdapterListenerTest, OnDataReceiveFailed) {
TEST_F(TransportAdapterListenerTest, OnDataSendDone) {
unsigned char data[3] = {0x20, 0x07, 0x01};
::protocol_handler::RawMessagePtr data_container =
- new ::protocol_handler::RawMessage(1, 1, data, 3);
+ std::make_shared< ::protocol_handler::RawMessage>(1, 1, data, 3, false);
EXPECT_CALL(tr_mock,
ReceiveEventFromDevice(IsEvent(EventTypeEnum::ON_SEND_DONE,
@@ -145,7 +146,7 @@ TEST_F(TransportAdapterListenerTest, OnDataSendDone) {
TEST_F(TransportAdapterListenerTest, OnDataSendFailed) {
unsigned char data[3] = {0x20, 0x07, 0x01};
::protocol_handler::RawMessagePtr data_container =
- new ::protocol_handler::RawMessage(1, 1, data, 3);
+ std::make_shared< ::protocol_handler::RawMessage>(1, 1, data, 3, false);
DataSendError err;
EXPECT_CALL(tr_mock,
@@ -195,7 +196,8 @@ TEST_F(TransportAdapterListenerTest, OnFindNewApplicationsRequest) {
IsEvent(EventTypeEnum::ON_FIND_NEW_APPLICATIONS_REQUEST,
&adapter_mock,
"",
- 0))).WillOnce(Return(E_SUCCESS));
+ 0)))
+ .WillOnce(Return(E_SUCCESS));
transport_listener.OnFindNewApplicationsRequest(&adapter_mock);
}
@@ -225,11 +227,21 @@ TEST_F(TransportAdapterListenerTest, OnUnexpectedDisconnect) {
ReceiveEventFromDevice(IsEvent(EventTypeEnum::ON_UNEXPECTED_DISCONNECT,
&adapter_mock,
dev_id,
- app_handle))).WillOnce(Return(E_SUCCESS));
+ app_handle)))
+ .WillOnce(Return(E_SUCCESS));
transport_listener.OnUnexpectedDisconnect(
&adapter_mock, dev_id, app_handle, err);
}
+TEST_F(TransportAdapterListenerTest, OnTransportConfigUpdated) {
+ EXPECT_CALL(
+ tr_mock,
+ ReceiveEventFromDevice(IsEvent(
+ EventTypeEnum::ON_TRANSPORT_CONFIG_UPDATED, &adapter_mock, "", 0)))
+ .WillOnce(Return(E_SUCCESS));
+ transport_listener.OnTransportConfigUpdated(&adapter_mock);
+}
+
} // namespace transport_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/transport_manager/test/transport_adapter_test.cc b/src/components/transport_manager/test/transport_adapter_test.cc
index 6d709e0c17..1773ecfb67 100644
--- a/src/components/transport_manager/test/transport_adapter_test.cc
+++ b/src/components/transport_manager/test/transport_adapter_test.cc
@@ -31,39 +31,46 @@
*/
#include "gtest/gtest.h"
-#include "transport_manager/transport_adapter/mock_device_scanner.h"
+#include "transport_manager/mock_transport_manager_settings.h"
#include "transport_manager/transport_adapter/mock_client_connection_listener.h"
-#include "transport_manager/transport_adapter/mock_server_connection_factory.h"
-#include "transport_manager/transport_adapter/mock_device.h"
#include "transport_manager/transport_adapter/mock_connection.h"
-#include "transport_manager/transport_adapter/mock_transport_adapter_listener.h"
+#include "transport_manager/transport_adapter/mock_device.h"
+#include "transport_manager/transport_adapter/mock_device_scanner.h"
+#include "transport_manager/transport_adapter/mock_server_connection_factory.h"
#include "transport_manager/transport_adapter/mock_transport_adapter_impl.h"
-#include "transport_manager/mock_transport_manager_settings.h"
+#include "transport_manager/transport_adapter/mock_transport_adapter_listener.h"
+#include "utils/test_async_waiter.h"
+#include "protocol/raw_message.h"
+#include "transport_manager/cloud/cloud_device.h"
+#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
+#include "transport_manager/transport_adapter/connection.h"
+#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
#include "transport_manager/transport_adapter/transport_adapter_listener.h"
-#include "transport_manager/transport_adapter/transport_adapter_controller.h"
-#include "transport_manager/transport_adapter/connection.h"
-#include "protocol/raw_message.h"
-#include "utils/make_shared.h"
-#include "resumption/last_state_impl.h"
+
#include "config_profile/profile.h"
+#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
namespace test {
namespace components {
namespace transport_manager_test {
-using ::testing::Return;
-using ::testing::ReturnRef;
using ::testing::_;
using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnRef;
using namespace ::transport_manager;
using namespace ::protocol_handler;
class TransportAdapterTest : public ::testing::Test {
protected:
- TransportAdapterTest()
- : last_state_("app_storage_folder", "app_info_storage") {}
+ TransportAdapterTest() {
+ last_state_wrapper_ = std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>("app_storage_folder",
+ "app_info_storage"));
+ }
void SetUp() OVERRIDE {
dev_id = "device_id";
@@ -73,11 +80,149 @@ class TransportAdapterTest : public ::testing::Test {
.WillByDefault(Return(true));
}
+ void SetDefaultExpectations(MockTransportAdapterImpl& adapter) {
+ ON_CALL(adapter, GetDeviceType())
+ .WillByDefault(Return(DeviceType::UNKNOWN));
+ }
+
NiceMock<MockTransportManagerSettings> transport_manager_settings;
- resumption::LastStateImpl last_state_;
+ std::shared_ptr<resumption::LastStateWrapperImpl> last_state_wrapper_;
std::string dev_id;
std::string uniq_id;
int app_handle;
+
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ struct TestEndpoint {
+ std::string test_string;
+ std::string host;
+ std::string port;
+ std::string target;
+ };
+
+ CloudAppProperties test_cloud_properties_{.endpoint = "",
+ .certificate = "no cert",
+ .enabled = true,
+ .auth_token = "no auth token",
+ .cloud_transport_type = "WS",
+ .hybrid_app_preference = "CLOUD"};
+ std::vector<std::string> kWebsocketProtocols{"ws://", "wss://"};
+
+ std::vector<TestEndpoint> kValidTestEndpoints{
+ // Host and port
+ TestEndpoint{"localhost:40/", "localhost", "40", "/"},
+ TestEndpoint{"[::1]:40", "[::1]", "40", "/"},
+ TestEndpoint{"username:password@localhost.com:80",
+ "username:password@localhost.com",
+ "80",
+ "/"},
+ // With path
+ TestEndpoint{
+ "localhost:440/file.html", "localhost", "440", "/file.html/"},
+ TestEndpoint{"101.180.1.213:23234/folder/img_index(1)/file.html",
+ "101.180.1.213",
+ "23234",
+ "/folder/img_index(1)/file.html/"},
+ TestEndpoint{"[2600:3c00::f03c:91ff:fe73:2b08]:31333/folder/img_index(1)/"
+ "file.html",
+ "[2600:3c00::f03c:91ff:fe73:2b08]",
+ "31333",
+ "/folder/img_index(1)/file.html/"},
+ // With query and/or fragment
+ TestEndpoint{
+ "username@localhost:22/folder/img_index(1)/"
+ "file.html?eventId=2345&eventName='some%20event'&eventSuccess=true",
+ "username@localhost",
+ "22",
+ "/folder/img_index(1)/file.html/"
+ "?eventId=2345&eventName='some%20event'&eventSuccess="
+ "true"},
+ TestEndpoint{"username@localhost.com:80/folder/img_index(1)/"
+ "file.html?eventId=2345&eventName='some%20event'&"
+ "eventSuccess=true#section1",
+ "username@localhost.com",
+ "80",
+ "/folder/img_index(1)/file.html/"
+ "?eventId=2345&eventName='some%20event'&eventSuccess=true#"
+ "section1"},
+ TestEndpoint{
+ "localhost:443/"
+ "?eventId=2345&eventName='some%20event'&eventSuccess=true#section1",
+ "localhost",
+ "443",
+ "/?eventId=2345&eventName='some%20event'&eventSuccess=true#"
+ "section1"},
+ TestEndpoint{"a1-b2.com:443/folder/img_index(1)/file.html#section1",
+ "a1-b2.com",
+ "443",
+ "/folder/img_index(1)/file.html/#section1"},
+ TestEndpoint{"a1-b2.com:23#section1", "a1-b2.com", "23", "/#section1"}};
+
+ std::vector<TestEndpoint> kInvalidTestEndpoints{
+ // Invalid hostname
+ TestEndpoint{"/localhost:80", "localhost", "80", "/"},
+ TestEndpoint{"local?host:80", "local?host", "80", "/"},
+ TestEndpoint{"local#host:80", "local#host", "80", "/"},
+ TestEndpoint{"local\%host:80", "local\%host", "80", "/"},
+ TestEndpoint{"local\\host:80", "local\\host", "80", "/"},
+ TestEndpoint{"local/host:80", "local/host", "80", "/"},
+ TestEndpoint{"local host:80", "local host", "80", "/"},
+ TestEndpoint{"local\thost:80", "local\thost", "80", "/"},
+ TestEndpoint{":80#section1", "", "80", "/#section1"},
+ // Invalid port
+ TestEndpoint{"username:password@localhost.com",
+ "username:password@localhost.com",
+ "",
+ "/"},
+ TestEndpoint{"username:password@localhost.com:5",
+ "username:password@localhost.com",
+ "5",
+ "/"},
+ TestEndpoint{"201.123.213:2h32/", "201.123.213", "2h32", "/"}};
+ std::vector<TestEndpoint> kIncorrectTestEndpoints{
+ // Incorrect port number
+ TestEndpoint{"201.123.1.213:232454/folder/img_index(1)/file.html",
+ "201.123.1.213",
+ "232454",
+ "/folder/img_index(1)/file.html/"},
+ // Incorrect path
+ TestEndpoint{"201.123.1.213:232//folder/img_index(1)/file.html",
+ "201.123.1.213",
+ "232",
+ "//folder/img_index(1)/file.html/"},
+ TestEndpoint{"201.123.1.213:232/folder/img_index(1)//file.html",
+ "201.123.1.213",
+ "232",
+ "/folder/img_index(1)//file.html/"},
+ TestEndpoint{"201.123.1.213:232/folder/img index(1)//file.html",
+ "201.123.1.213",
+ "232",
+ "/folder/img index(1)//file.html/"},
+ TestEndpoint{"201.123.1.213:232/folder/img\tindex(1)//file.html",
+ "201.123.1.213",
+ "232",
+ "/folder/img\tindex(1)//file.html/"},
+ // Incorrect query
+ TestEndpoint{"username@localhost:443/?eventId=2345&eventName='some "
+ "event'&eventSuccess=true",
+ "username@localhost",
+ "443",
+ "?eventId=2345&eventName='some event'&eventSuccess=true"},
+ TestEndpoint{"username@localhost:443/"
+ "?eventId=2345&eventName='some\tevent'&eventSuccess=true",
+ "username@localhost",
+ "443",
+ "?eventId=2345&eventName='some\tevent'&eventSuccess=true"},
+ // Incorrect fragment
+ TestEndpoint{"a1(b2).com:80/folder/img_index(1)/file.html#section 1",
+ "a1(b2).com",
+ "80",
+ "/folder/img_index(1)/file.html#section 1"},
+ TestEndpoint{"a1(b2).com:80/folder/img_index(1)/file.html#section\t1",
+ "a1(b2).com",
+ "80",
+ "/folder/img_index(1)/file.html#section\t1"}};
+
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
};
TEST_F(TransportAdapterTest, Init) {
@@ -87,8 +232,9 @@ TEST_F(TransportAdapterTest, Init) {
MockTransportAdapterImpl transport_adapter(dev_mock,
serverMock,
clientMock,
- last_state_,
+ last_state_wrapper_,
transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -105,8 +251,11 @@ TEST_F(TransportAdapterTest, Init) {
TEST_F(TransportAdapterTest, SearchDevices_WithoutScanner) {
MockClientConnectionListener* clientMock = new MockClientConnectionListener();
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
- MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, clientMock, last_state_, transport_manager_settings);
+ MockTransportAdapterImpl transport_adapter(NULL,
+ serverMock,
+ clientMock,
+ last_state_wrapper_,
+ transport_manager_settings);
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -122,7 +271,8 @@ TEST_F(TransportAdapterTest, SearchDevices_WithoutScanner) {
TEST_F(TransportAdapterTest, SearchDevices_DeviceNotInitialized) {
MockDeviceScanner* dev_mock = new MockDeviceScanner();
MockTransportAdapterImpl transport_adapter(
- dev_mock, NULL, NULL, last_state_, transport_manager_settings);
+ dev_mock, NULL, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -137,7 +287,8 @@ TEST_F(TransportAdapterTest, SearchDevices_DeviceNotInitialized) {
TEST_F(TransportAdapterTest, SearchDevices_DeviceInitialized) {
MockDeviceScanner* dev_mock = new MockDeviceScanner();
MockTransportAdapterImpl transport_adapter(
- dev_mock, NULL, NULL, last_state_, transport_manager_settings);
+ dev_mock, NULL, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -152,14 +303,15 @@ TEST_F(TransportAdapterTest, SearchDevices_DeviceInitialized) {
TEST_F(TransportAdapterTest, SearchDeviceDone_DeviceExisting) {
MockTransportAdapterImpl transport_adapter(
- NULL, NULL, NULL, last_state_, transport_manager_settings);
+ NULL, NULL, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
- utils::SharedPtr<MockDevice> mockdev = new MockDevice(dev_id, uniq_id);
+ auto mockdev = std::make_shared<MockDevice>(dev_id, uniq_id);
transport_adapter.AddDevice(mockdev);
- std::vector<utils::SharedPtr<Device> > devList;
+ std::vector<std::shared_ptr<Device> > devList;
devList.push_back(mockdev);
EXPECT_CALL(*mockdev, IsSameAs(_)).WillOnce(Return(true));
@@ -168,7 +320,8 @@ TEST_F(TransportAdapterTest, SearchDeviceDone_DeviceExisting) {
TEST_F(TransportAdapterTest, SearchDeviceFailed) {
MockTransportAdapterImpl transport_adapter(
- NULL, NULL, NULL, last_state_, transport_manager_settings);
+ NULL, NULL, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
@@ -182,15 +335,16 @@ TEST_F(TransportAdapterTest, SearchDeviceFailed) {
TEST_F(TransportAdapterTest, AddDevice) {
MockTransportAdapterImpl transport_adapter(
- NULL, NULL, NULL, last_state_, transport_manager_settings);
+ NULL, NULL, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
MockTransportAdapterListener mock_listener;
transport_adapter.AddListener(&mock_listener);
- utils::SharedPtr<MockDevice> mockdev =
- utils::MakeShared<MockDevice>(dev_id, uniq_id);
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter));
transport_adapter.AddDevice(mockdev);
@@ -199,7 +353,8 @@ TEST_F(TransportAdapterTest, AddDevice) {
TEST_F(TransportAdapterTest, Connect_ServerNotSupported) {
MockClientConnectionListener* clientMock = new MockClientConnectionListener();
MockTransportAdapterImpl transport_adapter(
- NULL, NULL, clientMock, last_state_, transport_manager_settings);
+ NULL, NULL, clientMock, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -216,7 +371,8 @@ TEST_F(TransportAdapterTest, Connect_ServerNotSupported) {
TEST_F(TransportAdapterTest, Connect_ServerNotInitialized) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -233,7 +389,8 @@ TEST_F(TransportAdapterTest, Connect_ServerNotInitialized) {
TEST_F(TransportAdapterTest, Connect_Success) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -251,7 +408,8 @@ TEST_F(TransportAdapterTest, Connect_Success) {
TEST_F(TransportAdapterTest, Connect_DeviceAddedTwice) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -273,12 +431,13 @@ TEST_F(TransportAdapterTest, Connect_DeviceAddedTwice) {
TEST_F(TransportAdapterTest, ConnectDevice_ServerNotAdded_DeviceAdded) {
MockTransportAdapterImpl transport_adapter(
- NULL, NULL, NULL, last_state_, transport_manager_settings);
+ NULL, NULL, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
- utils::SharedPtr<MockDevice> mockdev =
- utils::MakeShared<MockDevice>(dev_id, uniq_id);
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
transport_adapter.AddDevice(mockdev);
std::vector<std::string> devList = transport_adapter.GetDeviceList();
@@ -292,12 +451,14 @@ TEST_F(TransportAdapterTest, ConnectDevice_ServerNotAdded_DeviceAdded) {
TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::FAIL, res);
+ EXPECT_NE(ConnectionStatus::CONNECTED, mockdev->connection_status());
}
TEST_F(TransportAdapterTest, ConnectDevice_DeviceNotAdded) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
@@ -307,7 +468,7 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceNotAdded) {
EXPECT_CALL(*serverMock, IsInitialised()).Times(0);
EXPECT_CALL(*serverMock, CreateConnection(_, _)).Times(0);
EXPECT_CALL(transport_adapter, FindDevice(uniq_id))
- .WillOnce(Return(utils::SharedPtr<MockDevice>()));
+ .WillOnce(Return(std::shared_ptr<MockDevice>()));
TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::BAD_PARAM, res);
@@ -317,14 +478,15 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceNotAdded) {
TEST_F(TransportAdapterTest, ConnectDevice_DeviceAdded) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
- utils::SharedPtr<MockDevice> mockdev =
- utils::MakeShared<MockDevice>(dev_id, uniq_id);
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
transport_adapter.AddDevice(mockdev);
std::vector<std::string> devList = transport_adapter.GetDeviceList();
@@ -341,21 +503,60 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAdded) {
EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, res);
+ EXPECT_EQ(ConnectionStatus::CONNECTED, mockdev->connection_status());
EXPECT_CALL(*serverMock, Terminate());
}
+TEST_F(TransportAdapterTest, ConnectDevice_DeviceAdded_ConnectFailedRetry) {
+ MockServerConnectionFactory* server_mock = new MockServerConnectionFactory();
+ MockTransportAdapterImpl transport_adapter(
+ NULL, server_mock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
+
+ EXPECT_CALL(*server_mock, Init()).WillOnce(Return(TransportAdapter::OK));
+ EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
+ transport_adapter.Init();
+
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
+ transport_adapter.AddDevice(mockdev);
+
+ std::vector<std::string> dev_list = transport_adapter.GetDeviceList();
+ ASSERT_EQ(1u, dev_list.size());
+ EXPECT_EQ(uniq_id, dev_list[0]);
+
+ int app_handle = 1;
+ std::vector<int> int_list = {app_handle};
+ EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(int_list));
+
+ EXPECT_CALL(*server_mock, IsInitialised()).WillOnce(Return(true));
+ EXPECT_CALL(*server_mock, CreateConnection(uniq_id, app_handle))
+ .WillOnce(Return(TransportAdapter::FAIL));
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
+ EXPECT_CALL(transport_adapter, GetDeviceType())
+ .WillOnce(Return(DeviceType::CLOUD_WEBSOCKET));
+ EXPECT_CALL(transport_manager_settings, cloud_app_max_retry_attempts())
+ .WillOnce(Return(0));
+ TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
+ EXPECT_EQ(TransportAdapter::FAIL, res);
+ EXPECT_EQ(ConnectionStatus::PENDING, mockdev->connection_status());
+
+ EXPECT_CALL(*server_mock, Terminate());
+}
+
TEST_F(TransportAdapterTest, ConnectDevice_DeviceAddedTwice) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
- utils::SharedPtr<MockDevice> mockdev =
- utils::MakeShared<MockDevice>(dev_id, uniq_id);
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
transport_adapter.AddDevice(mockdev);
std::vector<std::string> devList = transport_adapter.GetDeviceList();
@@ -372,6 +573,7 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAddedTwice) {
EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, res);
+ EXPECT_EQ(ConnectionStatus::CONNECTED, mockdev->connection_status());
// Try to connect device second time
@@ -382,6 +584,7 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAddedTwice) {
EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
TransportAdapter::Error newres = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, newres);
+ EXPECT_EQ(ConnectionStatus::CONNECTED, mockdev->connection_status());
EXPECT_CALL(*serverMock, Terminate());
}
@@ -389,7 +592,8 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAddedTwice) {
TEST_F(TransportAdapterTest, Disconnect_ConnectDoneSuccess) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -401,32 +605,249 @@ TEST_F(TransportAdapterTest, Disconnect_ConnectDoneSuccess) {
TransportAdapter::Error res = transport_adapter.Connect(dev_id, app_handle);
EXPECT_EQ(TransportAdapter::OK, res);
- MockConnection* mock_connection = new MockConnection();
+ auto mock_connection = std::make_shared<MockConnection>();
+ transport_adapter.ConnectionCreated(mock_connection, dev_id, app_handle);
+
+ EXPECT_CALL(transport_adapter, Store());
+ transport_adapter.ConnectDone(dev_id, app_handle);
+
+ EXPECT_CALL(*mock_connection, Disconnect())
+ .WillOnce(Return(TransportAdapter::OK));
+ TransportAdapter::Error new_res =
+ transport_adapter.Disconnect(dev_id, app_handle);
+ EXPECT_EQ(TransportAdapter::OK, new_res);
+
+ EXPECT_CALL(*serverMock, Terminate());
+ EXPECT_CALL(*mock_connection, Terminate());
+}
+
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+TEST_F(TransportAdapterTest, FindPending) {
+ MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
+ MockTransportAdapterImpl transport_adapter(
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
+
+ EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
+ EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
+ transport_adapter.Init();
+
+ MockTransportAdapterListener mock_listener;
+ transport_adapter.AddListener(&mock_listener);
+
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
+ DeviceVector devices{mockdev};
+ transport_adapter.SearchDeviceDone(devices);
+
+ // Create cloud app device with connection in pending state
+ std::shared_ptr<MockConnection> connection =
+ std::make_shared<MockConnection>();
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
+ transport_adapter.ConnectionCreated(connection, uniq_id, 0);
+ transport_adapter.ConnectPending(uniq_id, 0);
+
+ std::vector<std::string> dev_list = transport_adapter.GetDeviceList();
+ ASSERT_EQ(1u, dev_list.size());
+ EXPECT_EQ(uniq_id, dev_list[0]);
+ EXPECT_EQ(ConnectionStatus::PENDING, mockdev->connection_status());
+
+ ConnectionSPtr mock_connection =
+ transport_adapter.FindPendingConnection(uniq_id, 0);
+ ASSERT_TRUE(mock_connection.use_count() != 0);
+
+ ConnectionSPtr mock_connection_fake =
+ transport_adapter.FindPendingConnection(uniq_id, 1);
+ ASSERT_TRUE(mock_connection_fake.use_count() == 0);
+
+ EXPECT_CALL(*serverMock, Terminate());
+ EXPECT_CALL(*connection, Terminate());
+}
+
+TEST_F(TransportAdapterTest,
+ Pending_Connect_Disconnect_ConnectDoneSuccess_PendingDeviceAdded) {
+ MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
+ MockTransportAdapterImpl transport_adapter(
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
+
+ EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
+ EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
+ transport_adapter.Init();
+
+ MockTransportAdapterListener mock_listener;
+ transport_adapter.AddListener(&mock_listener);
+
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
+ DeviceVector devices{mockdev};
+ transport_adapter.SearchDeviceDone(devices);
+
+ // Create cloud app device with connection in pending state
+ std::shared_ptr<MockConnection> connection =
+ std::make_shared<MockConnection>();
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
+ transport_adapter.ConnectionCreated(connection, uniq_id, 0);
+ transport_adapter.ConnectPending(uniq_id, 0);
+
+ std::vector<std::string> dev_list = transport_adapter.GetDeviceList();
+ ASSERT_EQ(1u, dev_list.size());
+ EXPECT_EQ(uniq_id, dev_list[0]);
+ EXPECT_EQ(ConnectionStatus::PENDING, mockdev->connection_status());
+
+ // Connect cloud app
+ int app_handle = 0;
+ std::vector<int> int_list = {app_handle};
+ EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(int_list));
+
+ EXPECT_CALL(*serverMock, IsInitialised()).WillOnce(Return(true));
+ EXPECT_CALL(*serverMock, CreateConnection(uniq_id, app_handle))
+ .WillOnce(Return(TransportAdapter::OK));
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
+
+ TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
+
+ EXPECT_EQ(TransportAdapter::OK, res);
+ EXPECT_EQ(ConnectionStatus::CONNECTED, mockdev->connection_status());
+
+ auto mock_connection = std::make_shared<MockConnection>();
transport_adapter.ConnectionCreated(mock_connection, dev_id, app_handle);
EXPECT_CALL(transport_adapter, Store());
transport_adapter.ConnectDone(dev_id, app_handle);
+ // Disconnect cloud app
EXPECT_CALL(*mock_connection, Disconnect())
.WillOnce(Return(TransportAdapter::OK));
TransportAdapter::Error new_res =
transport_adapter.Disconnect(dev_id, app_handle);
EXPECT_EQ(TransportAdapter::OK, new_res);
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
+ EXPECT_CALL(transport_adapter, GetDeviceType())
+ .WillOnce(Return(DeviceType::CLOUD_WEBSOCKET));
+ EXPECT_CALL(mock_listener,
+ OnDisconnectDeviceDone(&transport_adapter, uniq_id));
+ EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter)).Times(2);
+ EXPECT_CALL(transport_adapter, Store());
+ transport_adapter.DisconnectDone(uniq_id, 0);
+
+ dev_list = transport_adapter.GetDeviceList();
+ ASSERT_EQ(0u, dev_list.size());
+
+ // Recreate device and put cloud app back into pending state
+ std::shared_ptr<MockDevice> mockdev2 =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
+ DeviceVector devices2{mockdev2};
+ transport_adapter.SearchDeviceDone(devices2);
+
+ std::shared_ptr<MockConnection> connection2 =
+ std::make_shared<MockConnection>();
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id))
+ .WillOnce(Return(mockdev2));
+ transport_adapter.ConnectionCreated(connection2, uniq_id, 0);
+ transport_adapter.ConnectPending(uniq_id, 0);
+
+ dev_list = transport_adapter.GetDeviceList();
+ ASSERT_EQ(1u, dev_list.size());
+ EXPECT_EQ(uniq_id, dev_list[0]);
+ EXPECT_EQ(ConnectionStatus::PENDING, mockdev2->connection_status());
+
EXPECT_CALL(*serverMock, Terminate());
+ EXPECT_CALL(*mock_connection, Terminate());
+ EXPECT_CALL(*connection2, Terminate());
+}
+
+TEST_F(TransportAdapterTest, WebsocketEndpointParsing_SUCCESS) {
+ std::shared_ptr<CloudWebsocketTransportAdapter> cta =
+ std::make_shared<CloudWebsocketTransportAdapter>(
+ last_state_wrapper_, transport_manager_settings);
+
+ for (auto protocol : kWebsocketProtocols) {
+ for (auto endpoint : kValidTestEndpoints) {
+ test_cloud_properties_.endpoint = protocol + endpoint.test_string;
+ cta->SetAppCloudTransportConfig("cloud app", test_cloud_properties_);
+
+ auto ta = std::dynamic_pointer_cast<TransportAdapter>(cta);
+ ASSERT_NE(ta.use_count(), 0);
+
+ ta->CreateDevice(test_cloud_properties_.endpoint);
+
+ auto device = cta->FindDevice(test_cloud_properties_.endpoint);
+ ASSERT_NE(device.use_count(), 0);
+
+ std::shared_ptr<CloudDevice> cloud_device =
+ std::dynamic_pointer_cast<CloudDevice>(device);
+ ASSERT_NE(cloud_device.use_count(), 0);
+
+ EXPECT_EQ(cloud_device->GetHost(), endpoint.host);
+ EXPECT_EQ(cloud_device->GetPort(), endpoint.port);
+ EXPECT_EQ(cloud_device->GetTarget(), endpoint.target);
+ }
+ }
+}
+TEST_F(TransportAdapterTest, WebsocketEndpointParsing_INVALID) {
+ std::shared_ptr<CloudWebsocketTransportAdapter> cta =
+ std::make_shared<CloudWebsocketTransportAdapter>(
+ last_state_wrapper_, transport_manager_settings);
+
+ for (auto protocol : kWebsocketProtocols) {
+ for (auto endpoint : kInvalidTestEndpoints) {
+ test_cloud_properties_.endpoint = protocol + endpoint.test_string;
+ cta->SetAppCloudTransportConfig("cloud app", test_cloud_properties_);
+
+ auto ta = std::dynamic_pointer_cast<TransportAdapter>(cta);
+ ASSERT_NE(ta.use_count(), 0);
+
+ ta->CreateDevice(test_cloud_properties_.endpoint);
+
+ auto device = cta->FindDevice(test_cloud_properties_.endpoint);
+ EXPECT_EQ(device.use_count(), 0);
+ }
+ }
+}
+TEST_F(TransportAdapterTest, WebsocketEndpointParsing_INCORRECT) {
+ std::shared_ptr<CloudWebsocketTransportAdapter> cta =
+ std::make_shared<CloudWebsocketTransportAdapter>(
+ last_state_wrapper_, transport_manager_settings);
+
+ for (auto protocol : kWebsocketProtocols) {
+ for (auto endpoint : kIncorrectTestEndpoints) {
+ test_cloud_properties_.endpoint = protocol + endpoint.test_string;
+ cta->SetAppCloudTransportConfig("cloud app", test_cloud_properties_);
+
+ auto ta = std::dynamic_pointer_cast<TransportAdapter>(cta);
+ ASSERT_NE(ta.use_count(), 0);
+
+ ta->CreateDevice(test_cloud_properties_.endpoint);
+
+ auto device = cta->FindDevice(test_cloud_properties_.endpoint);
+ ASSERT_NE(device.use_count(), 0);
+
+ std::shared_ptr<CloudDevice> cloud_device =
+ std::dynamic_pointer_cast<CloudDevice>(device);
+ ASSERT_NE(cloud_device.use_count(), 0);
+
+ EXPECT_FALSE(cloud_device->GetHost() == endpoint.host &&
+ cloud_device->GetPort() == endpoint.port &&
+ cloud_device->GetTarget() == endpoint.target);
+ }
+ }
}
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
TEST_F(TransportAdapterTest, DisconnectDevice_DeviceAddedConnectionCreated) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
- utils::SharedPtr<MockDevice> mockdev =
- utils::MakeShared<MockDevice>(dev_id, uniq_id);
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
transport_adapter.AddDevice(mockdev);
std::vector<std::string> devList = transport_adapter.GetDeviceList();
@@ -439,11 +860,13 @@ TEST_F(TransportAdapterTest, DisconnectDevice_DeviceAddedConnectionCreated) {
EXPECT_CALL(*serverMock, IsInitialised()).WillOnce(Return(true));
EXPECT_CALL(*serverMock, CreateConnection(uniq_id, app_handle))
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
+ EXPECT_CALL(transport_adapter, FindDevice(uniq_id))
+ .WillRepeatedly(Return(mockdev));
TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, res);
+ EXPECT_EQ(ConnectionStatus::CONNECTED, mockdev->connection_status());
- MockConnection* mock_connection = new MockConnection();
+ auto mock_connection = std::make_shared<MockConnection>();
transport_adapter.ConnectionCreated(mock_connection, uniq_id, app_handle);
EXPECT_CALL(*mock_connection, Disconnect())
@@ -451,14 +874,17 @@ TEST_F(TransportAdapterTest, DisconnectDevice_DeviceAddedConnectionCreated) {
TransportAdapter::Error new_res = transport_adapter.DisconnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, new_res);
+ EXPECT_EQ(ConnectionStatus::CLOSING, mockdev->connection_status());
EXPECT_CALL(*serverMock, Terminate());
+ EXPECT_CALL(*mock_connection, Terminate());
}
TEST_F(TransportAdapterTest, DeviceDisconnected) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -467,8 +893,8 @@ TEST_F(TransportAdapterTest, DeviceDisconnected) {
MockTransportAdapterListener mock_listener;
transport_adapter.AddListener(&mock_listener);
- utils::SharedPtr<MockDevice> mockdev =
- utils::MakeShared<MockDevice>(dev_id, uniq_id);
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter));
transport_adapter.AddDevice(mockdev);
@@ -484,9 +910,10 @@ TEST_F(TransportAdapterTest, DeviceDisconnected) {
.WillOnce(Return(TransportAdapter::OK));
TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id);
EXPECT_EQ(TransportAdapter::OK, res);
+ EXPECT_EQ(ConnectionStatus::CONNECTED, mockdev->connection_status());
- utils::SharedPtr<MockConnection> mock_connection =
- utils::MakeShared<MockConnection>();
+ std::shared_ptr<MockConnection> mock_connection =
+ std::make_shared<MockConnection>();
transport_adapter.ConnectionCreated(mock_connection, uniq_id, app_handle);
EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter));
@@ -506,7 +933,8 @@ TEST_F(TransportAdapterTest, DeviceDisconnected) {
TEST_F(TransportAdapterTest, AbortedConnectSuccess) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -531,8 +959,12 @@ TEST_F(TransportAdapterTest, AbortedConnectSuccess) {
TEST_F(TransportAdapterTest, SendData) {
MockDeviceScanner* dev_mock = new MockDeviceScanner();
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
- MockTransportAdapterImpl transport_adapter(
- dev_mock, serverMock, NULL, last_state_, transport_manager_settings);
+ MockTransportAdapterImpl transport_adapter(dev_mock,
+ serverMock,
+ NULL,
+ last_state_wrapper_,
+ transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -545,7 +977,7 @@ TEST_F(TransportAdapterTest, SendData) {
TransportAdapter::Error res = transport_adapter.Connect(dev_id, app_handle);
EXPECT_EQ(TransportAdapter::OK, res);
- MockConnection* mock_connection = new MockConnection();
+ auto mock_connection = std::make_shared<MockConnection>();
transport_adapter.ConnectionCreated(mock_connection, dev_id, app_handle);
EXPECT_CALL(transport_adapter, Store());
@@ -553,7 +985,8 @@ TEST_F(TransportAdapterTest, SendData) {
const unsigned int kSize = 3;
unsigned char data[kSize] = {0x20, 0x07, 0x01};
- const RawMessagePtr kMessage = new RawMessage(1, 1, data, kSize);
+ const RawMessagePtr kMessage =
+ std::make_shared<RawMessage>(1, 1, data, kSize, false);
EXPECT_CALL(*mock_connection, SendData(kMessage))
.WillOnce(Return(TransportAdapter::OK));
@@ -562,6 +995,7 @@ TEST_F(TransportAdapterTest, SendData) {
EXPECT_CALL(*dev_mock, Terminate());
EXPECT_CALL(*serverMock, Terminate());
+ EXPECT_CALL(*mock_connection, Terminate());
}
TEST_F(TransportAdapterTest, SendData_ConnectionNotEstablished) {
@@ -571,8 +1005,9 @@ TEST_F(TransportAdapterTest, SendData_ConnectionNotEstablished) {
MockTransportAdapterImpl transport_adapter(dev_mock,
serverMock,
clientMock,
- last_state_,
+ last_state_wrapper_,
transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -586,12 +1021,13 @@ TEST_F(TransportAdapterTest, SendData_ConnectionNotEstablished) {
TransportAdapter::Error res = transport_adapter.Connect(dev_id, app_handle);
EXPECT_EQ(TransportAdapter::OK, res);
- MockConnection* mock_connection = new MockConnection();
+ auto mock_connection = std::make_shared<MockConnection>();
transport_adapter.ConnectionCreated(mock_connection, dev_id, app_handle);
const unsigned int kSize = 3;
unsigned char data[kSize] = {0x20, 0x07, 0x01};
- const RawMessagePtr kMessage = new RawMessage(1, 1, data, kSize);
+ const RawMessagePtr kMessage =
+ std::make_shared<RawMessage>(1, 1, data, kSize, false);
EXPECT_CALL(*mock_connection, SendData(kMessage)).Times(0);
res = transport_adapter.SendData(dev_id, app_handle, kMessage);
@@ -600,13 +1036,18 @@ TEST_F(TransportAdapterTest, SendData_ConnectionNotEstablished) {
EXPECT_CALL(*dev_mock, Terminate());
EXPECT_CALL(*clientMock, Terminate());
EXPECT_CALL(*serverMock, Terminate());
+ EXPECT_CALL(*mock_connection, Terminate());
}
TEST_F(TransportAdapterTest, StartClientListening_ClientNotInitialized) {
MockDeviceScanner* dev_mock = new MockDeviceScanner();
MockClientConnectionListener* clientMock = new MockClientConnectionListener();
- MockTransportAdapterImpl transport_adapter(
- dev_mock, NULL, clientMock, last_state_, transport_manager_settings);
+ MockTransportAdapterImpl transport_adapter(dev_mock,
+ NULL,
+ clientMock,
+ last_state_wrapper_,
+ transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -616,7 +1057,8 @@ TEST_F(TransportAdapterTest, StartClientListening_ClientNotInitialized) {
EXPECT_CALL(*clientMock, IsInitialised()).WillOnce(Return(false));
EXPECT_CALL(*clientMock, StartListening()).Times(0);
- TransportAdapter::Error res = transport_adapter.StartClientListening();
+ TransportAdapter::Error res = transport_adapter.ChangeClientListening(
+ transport_manager::TransportAction::kVisibilityOn);
EXPECT_EQ(TransportAdapter::BAD_STATE, res);
EXPECT_CALL(*dev_mock, Terminate());
@@ -626,8 +1068,12 @@ TEST_F(TransportAdapterTest, StartClientListening_ClientNotInitialized) {
TEST_F(TransportAdapterTest, StartClientListening) {
MockDeviceScanner* dev_mock = new MockDeviceScanner();
MockClientConnectionListener* clientMock = new MockClientConnectionListener();
- MockTransportAdapterImpl transport_adapter(
- dev_mock, NULL, clientMock, last_state_, transport_manager_settings);
+ MockTransportAdapterImpl transport_adapter(dev_mock,
+ NULL,
+ clientMock,
+ last_state_wrapper_,
+ transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -638,7 +1084,8 @@ TEST_F(TransportAdapterTest, StartClientListening) {
EXPECT_CALL(*clientMock, StartListening())
.WillOnce(Return(TransportAdapter::OK));
- TransportAdapter::Error res = transport_adapter.StartClientListening();
+ TransportAdapter::Error res = transport_adapter.ChangeClientListening(
+ transport_manager::TransportAction::kVisibilityOn);
EXPECT_EQ(TransportAdapter::OK, res);
EXPECT_CALL(*dev_mock, Terminate());
@@ -652,8 +1099,9 @@ TEST_F(TransportAdapterTest, StopClientListening_Success) {
MockTransportAdapterImpl transport_adapter(dev_mock,
serverMock,
clientMock,
- last_state_,
+ last_state_wrapper_,
transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -671,7 +1119,8 @@ TEST_F(TransportAdapterTest, StopClientListening_Success) {
EXPECT_CALL(*clientMock, StopListening())
.WillOnce(Return(TransportAdapter::OK));
- res = transport_adapter.StopClientListening();
+ res = transport_adapter.ChangeClientListening(
+ transport_manager::TransportAction::kVisibilityOff);
EXPECT_EQ(TransportAdapter::OK, res);
EXPECT_CALL(*dev_mock, Terminate());
@@ -686,8 +1135,9 @@ TEST_F(TransportAdapterTest, FindNewApplicationsRequest) {
MockTransportAdapterImpl transport_adapter(dev_mock,
serverMock,
clientMock,
- last_state_,
+ last_state_wrapper_,
transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*dev_mock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(*clientMock, Init()).WillOnce(Return(TransportAdapter::OK));
@@ -708,12 +1158,13 @@ TEST_F(TransportAdapterTest, FindNewApplicationsRequest) {
TEST_F(TransportAdapterTest, GetDeviceAndApplicationLists) {
MockTransportAdapterImpl transport_adapter(
- NULL, NULL, NULL, last_state_, transport_manager_settings);
+ NULL, NULL, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
- utils::SharedPtr<MockDevice> mockdev =
- utils::MakeShared<MockDevice>(dev_id, uniq_id);
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id, uniq_id);
transport_adapter.AddDevice(mockdev);
std::vector<std::string> devList = transport_adapter.GetDeviceList();
@@ -732,7 +1183,8 @@ TEST_F(TransportAdapterTest, GetDeviceAndApplicationLists) {
TEST_F(TransportAdapterTest, FindEstablishedConnection) {
MockServerConnectionFactory* serverMock = new MockServerConnectionFactory();
MockTransportAdapterImpl transport_adapter(
- NULL, serverMock, NULL, last_state_, transport_manager_settings);
+ NULL, serverMock, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
EXPECT_CALL(*serverMock, Init()).WillOnce(Return(TransportAdapter::OK));
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
@@ -744,7 +1196,7 @@ TEST_F(TransportAdapterTest, FindEstablishedConnection) {
TransportAdapter::Error res = transport_adapter.Connect(dev_id, app_handle);
EXPECT_EQ(TransportAdapter::OK, res);
- ConnectionSPtr mock_connection = new MockConnection();
+ auto mock_connection = std::make_shared<MockConnection>();
transport_adapter.ConnectionCreated(mock_connection, dev_id, app_handle);
EXPECT_CALL(transport_adapter, Store());
@@ -755,22 +1207,24 @@ TEST_F(TransportAdapterTest, FindEstablishedConnection) {
EXPECT_EQ(mock_connection, conn);
EXPECT_CALL(*serverMock, Terminate());
+ EXPECT_CALL(*mock_connection, Terminate());
}
TEST_F(TransportAdapterTest, RunAppOnDevice_NoDeviseWithAskedId_UNSUCCESS) {
const std::string bundle_id = "test_bundle_id";
MockTransportAdapterImpl transport_adapter(
- NULL, NULL, NULL, last_state_, transport_manager_settings);
+ NULL, NULL, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
- utils::SharedPtr<MockDevice> mock_device =
- utils::MakeShared<MockDevice>("test_device_name", "test_device_uid0");
+ std::shared_ptr<MockDevice> mock_device =
+ std::make_shared<MockDevice>("test_device_name", "test_device_uid0");
transport_adapter.AddDevice(mock_device);
EXPECT_CALL(*mock_device, LaunchApp(bundle_id)).Times(0);
EXPECT_CALL(transport_adapter, FindDevice("test_device_uid1"))
- .WillOnce(Return(utils::SharedPtr<MockDevice>()));
+ .WillOnce(Return(std::shared_ptr<MockDevice>()));
transport_adapter.RunAppOnDevice("test_device_uid1", bundle_id);
}
@@ -780,10 +1234,11 @@ TEST_F(TransportAdapterTest, RunAppOnDevice_DeviseWithAskedIdWasFound_SUCCESS) {
const std::string device_uid = "test_device_uid";
MockTransportAdapterImpl transport_adapter(
- NULL, NULL, NULL, last_state_, transport_manager_settings);
+ NULL, NULL, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
- utils::SharedPtr<MockDevice> mock_device =
- utils::MakeShared<MockDevice>("test_device_name", device_uid);
+ std::shared_ptr<MockDevice> mock_device =
+ std::make_shared<MockDevice>("test_device_name", device_uid);
transport_adapter.AddDevice(mock_device);
@@ -796,11 +1251,11 @@ TEST_F(TransportAdapterTest, RunAppOnDevice_DeviseWithAskedIdWasFound_SUCCESS) {
TEST_F(TransportAdapterTest, StopDevice) {
MockTransportAdapterImpl transport_adapter(
- NULL, NULL, NULL, last_state_, transport_manager_settings);
+ NULL, NULL, NULL, last_state_wrapper_, transport_manager_settings);
EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
transport_adapter.Init();
- auto mockdev = utils::MakeShared<MockDevice>(dev_id, uniq_id);
+ auto mockdev = std::make_shared<MockDevice>(dev_id, uniq_id);
transport_adapter.AddDevice(mockdev);
EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev));
@@ -809,6 +1264,37 @@ TEST_F(TransportAdapterTest, StopDevice) {
transport_adapter.StopDevice(uniq_id);
}
+TEST_F(TransportAdapterTest, TransportConfigUpdated) {
+ MockTransportAdapterImpl transport_adapter(
+ NULL, NULL, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
+ EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
+ transport_adapter.Init();
+
+ MockTransportAdapterListener mock_listener;
+ transport_adapter.AddListener(&mock_listener);
+
+ TransportConfig config;
+ config[tc_enabled] = std::string("true");
+ config[tc_tcp_ip_address] = std::string("192.168.1.1");
+ config[tc_tcp_port] = std::string("12345");
+
+ EXPECT_CALL(mock_listener, OnTransportConfigUpdated(_));
+ transport_adapter.TransportConfigUpdated(config);
+}
+
+TEST_F(TransportAdapterTest, GetTransportConfigration) {
+ MockTransportAdapterImpl transport_adapter(
+ NULL, NULL, NULL, last_state_wrapper_, transport_manager_settings);
+ SetDefaultExpectations(transport_adapter);
+ EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true));
+ transport_adapter.Init();
+
+ TransportConfig empty_config;
+
+ EXPECT_EQ(empty_config, transport_adapter.GetTransportConfiguration());
+}
+
} // namespace transport_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/transport_manager/test/transport_manager_default_test.cc b/src/components/transport_manager/test/transport_manager_default_test.cc
index d095a51cb6..67b4a0a8ba 100644
--- a/src/components/transport_manager/test/transport_manager_default_test.cc
+++ b/src/components/transport_manager/test/transport_manager_default_test.cc
@@ -30,20 +30,28 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "transport_manager/transport_manager.h"
#include "transport_manager/transport_manager_default.h"
-#include "transport_manager/mock_transport_manager_settings.h"
+#include "gtest/gtest.h"
+#include "resumption/last_state_wrapper_impl.h"
#include "resumption/mock_last_state.h"
+#include "transport_manager/bt/mock_bluetooth_transport_adapter.h"
+#include "transport_manager/cloud/mock_cloud_websocket_transport_adapter.h"
+#include "transport_manager/mock_transport_manager_settings.h"
+#include "transport_manager/tcp/mock_tcp_transport_adapter.h"
+#include "transport_manager/transport_adapter/mock_device.h"
+#include "transport_manager/transport_adapter/mock_transport_adapter_listener.h"
+#include "transport_manager/transport_manager.h"
+#include "transport_manager/usb/mock_usb_aoa_adapter.h"
namespace test {
namespace components {
namespace transport_manager_test {
using resumption_test::MockLastState;
+using ::testing::_;
+using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::NiceMock;
namespace {
const std::string kDeviceName = "name";
@@ -57,88 +65,253 @@ const std::string kTransportManager = "TransportManager";
const std::string kTcpAdapter = "TcpAdapter";
const std::string kBluetoothAdapter = "BluetoothAdapter";
const std::string kDevices = "devices";
+const uint16_t kPort = 12345u;
+const std::string kAddress = "127.0.0.1";
+const std::string kServerCertPath = "server_certificate.crt";
+const std::string kServerCACertPath = "ca-certificate.crt";
+const std::string kWSServerKeyPathKey = "WSServerKeyPath";
+const std::string kWSServerCACertPath = "WSServerCACertificatePath";
+std::vector<uint8_t> kBTUUID = {0x93,
+ 0x6D,
+ 0xA0,
+ 0x1F,
+ 0x9A,
+ 0xBD,
+ 0x4D,
+ 0x9D,
+ 0x80,
+ 0xC7,
+ 0x02,
+ 0xAF,
+ 0x85,
+ 0xC8,
+ 0x22,
+ 0xA8};
} // namespace
-TEST(TestTransportManagerDefault, Init_LastStateNotUsed) {
- MockTransportManagerSettings transport_manager_settings;
- transport_manager::TransportManagerDefault transport_manager(
- transport_manager_settings);
+class TestTransportManagerDefault : public ::testing::Test {
+ public:
+ TestTransportManagerDefault()
+ : transport_manager_settings_()
+ , mock_last_state_(std::make_shared<MockLastState>())
+ , unique_tcp_dev_name_("unique_tcp_device_name")
+ , dev_id_("device_id")
+ , tcp_adapter_port_(1u)
+ , network_interface_("test_iface")
+ , last_state_wrapper_(std::make_shared<resumption::LastStateWrapperImpl>(
+ mock_last_state_)) {}
- NiceMock<MockLastState> mock_last_state;
- Json::Value custom_dictionary = Json::Value();
+ void SetUp() OVERRIDE {
+ EXPECT_CALL(transport_manager_settings_,
+ transport_manager_tcp_adapter_network_interface())
+ .WillRepeatedly(ReturnRef(network_interface_));
- ON_CALL(mock_last_state, get_dictionary())
- .WillByDefault(ReturnRef(custom_dictionary));
+ // Replace creation of real transport adapters by mock objects
+ // to be able to check related function calls
+ mock_bt_ta_ = new MockBluetoothTransportAdapter();
+ mock_tcp_ta_ = new MockTCPTransportAdapter(
+ tcp_adapter_port_, last_state_wrapper_, transport_manager_settings_);
+ mock_usb_aoa_ta_ =
+ new MockUsbAoaAdapter(last_state_wrapper_, transport_manager_settings_);
+ mock_cloud_websocket_ta_ = new MockCloudWebsocketTransportAdapter(
+ last_state_wrapper_, transport_manager_settings_);
- EXPECT_CALL(transport_manager_settings, use_last_state())
- .WillRepeatedly(Return(false));
- EXPECT_CALL(transport_manager_settings, transport_manager_tcp_adapter_port())
- .WillRepeatedly(Return(12345u));
+ TransportAdapterFactory ta_factory;
+#ifdef BLUETOOTH_SUPPORT
+ ta_factory.ta_bluetooth_creator_ =
+ [&](resumption::LastStateWrapperPtr& last_state_wrapper,
+ const TransportManagerSettings& settings) {
+ UNUSED(last_state_wrapper);
+ UNUSED(settings);
+ return mock_bt_ta_;
+ };
+#endif
+ ta_factory.ta_tcp_creator_ =
+ [&](const uint16_t port,
+ resumption::LastStateWrapperPtr& last_state_wrapper,
+ const TransportManagerSettings& settings) {
+ UNUSED(port);
+ UNUSED(last_state_wrapper);
+ UNUSED(settings);
+ return mock_tcp_ta_;
+ };
+#if defined(USB_SUPPORT)
+ ta_factory.ta_usb_creator_ =
+ [&](resumption::LastStateWrapperPtr& last_state_wrapper,
+ const TransportManagerSettings& settings) {
+ UNUSED(last_state_wrapper);
+ UNUSED(settings);
+ return mock_usb_aoa_ta_;
+ };
+#endif
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ ta_factory.ta_cloud_creator_ =
+ [&](resumption::LastStateWrapperPtr& last_state_wrapper,
+ const TransportManagerSettings& settings) {
+ UNUSED(last_state_wrapper);
+ UNUSED(settings);
+ return mock_cloud_websocket_ta_;
+ };
+#endif
+ transport_manager_ = std::unique_ptr<TransportManagerDefault>(
+ new TransportManagerDefault(transport_manager_settings_, ta_factory));
+ }
- transport_manager.Init(mock_last_state);
- transport_manager.Stop();
-}
+ void ExpectationsSettings_TM(const bool use_last_state);
+ void ExpectationsBluetooth_TA();
+ void ExpectationsTCP_TA();
+ void ExpectationsUSB_TA();
+ void ExpectationsCloudWebsocket_TA();
-TEST(TestTransportManagerDefault, Init_LastStateUsed) {
- MockTransportManagerSettings transport_manager_settings;
- transport_manager::TransportManagerDefault transport_manager(
- transport_manager_settings);
+ protected:
+ MockTransportManagerSettings transport_manager_settings_;
+ std::unique_ptr<TransportManagerDefault> transport_manager_;
+ std::shared_ptr<MockLastState> mock_last_state_;
+ Json::Value custom_dictionary_;
+ const std::string unique_tcp_dev_name_;
+ const std::string dev_id_;
+ const uint16_t tcp_adapter_port_;
+ std::string network_interface_;
+ std::string dummy_parameter_;
+ // Arrange necessary transport adapters mock objects
+ MockBluetoothTransportAdapter* mock_bt_ta_;
+ MockTCPTransportAdapter* mock_tcp_ta_;
+ MockUsbAoaAdapter* mock_usb_aoa_ta_;
+ MockCloudWebsocketTransportAdapter* mock_cloud_websocket_ta_;
+ std::shared_ptr<resumption::LastStateWrapperImpl> last_state_wrapper_;
+};
- NiceMock<MockLastState> mock_last_state;
- Json::Value custom_dictionary;
+void TestTransportManagerDefault::ExpectationsSettings_TM(
+ const bool use_last_state) {
+ // Arrange TM Settings expectations
Json::Value tcp_device;
- tcp_device[kDeviceName] = "unique_tcp_device_name";
- tcp_device[kDeviceAddress] = "127.0.0.1";
- tcp_device[kDeviceApplications][0][kApplicationPort] = kApplicationPortValue;
+ tcp_device[kDeviceName] = unique_tcp_dev_name_;
+ tcp_device[kDeviceAddress] = kAddress;
+ tcp_device[kDeviceApplications][0][kApplicationPort] = "1";
Json::Value bluetooth_device;
- bluetooth_device[kDeviceName] = "unique_bluetooth_device_name";
+
+ std::string unique_bt_dev_name("unique_bluetooth_device_name");
+ bluetooth_device[kDeviceName] = unique_bt_dev_name;
bluetooth_device[kDeviceAddress] = "AB:CD:EF:GH:IJ:KL";
bluetooth_device[kDeviceApplications][0][kApplicationRfcomm] =
kApplicationRfcommValue;
- custom_dictionary[kTransportManager][kTcpAdapter][kDevices][0] = tcp_device;
- custom_dictionary[kTransportManager][kBluetoothAdapter][kDevices][0] =
+ custom_dictionary_[kTransportManager][kTcpAdapter][kDevices][0] = tcp_device;
+ custom_dictionary_[kTransportManager][kBluetoothAdapter][kDevices][0] =
bluetooth_device;
+ ON_CALL(transport_manager_settings_, websocket_server_port())
+ .WillByDefault(Return(kPort));
+ ON_CALL(transport_manager_settings_, websocket_server_address())
+ .WillByDefault(ReturnRef(kAddress));
+ ON_CALL(transport_manager_settings_, ws_server_cert_path())
+ .WillByDefault(ReturnRef(kServerCertPath));
+ ON_CALL(transport_manager_settings_, ws_server_key_path())
+ .WillByDefault(ReturnRef(kWSServerKeyPathKey));
+ ON_CALL(transport_manager_settings_, ws_server_ca_cert_path())
+ .WillByDefault(ReturnRef(kWSServerCACertPath));
+ ON_CALL(*mock_last_state_, dictionary())
+ .WillByDefault(Return(custom_dictionary_));
+ ON_CALL(*mock_last_state_, get_dictionary())
+ .WillByDefault(ReturnRef(custom_dictionary_));
- ON_CALL(mock_last_state, get_dictionary())
- .WillByDefault(ReturnRef(custom_dictionary));
+ EXPECT_CALL(transport_manager_settings_, use_last_state())
+ .WillRepeatedly(Return(use_last_state));
+ EXPECT_CALL(transport_manager_settings_, transport_manager_tcp_adapter_port())
+ .WillRepeatedly(Return(tcp_adapter_port_));
- EXPECT_CALL(transport_manager_settings, use_last_state())
- .WillRepeatedly(Return(true));
- EXPECT_CALL(transport_manager_settings, transport_manager_tcp_adapter_port())
- .WillRepeatedly(Return(12345u));
- transport_manager.Init(mock_last_state);
- transport_manager.Stop();
+ EXPECT_CALL(transport_manager_settings_, bluetooth_uuid())
+ .WillRepeatedly(Return(kBTUUID.data()));
+
+ EXPECT_CALL(transport_manager_settings_, aoa_filter_manufacturer())
+ .WillRepeatedly(ReturnRef(dummy_parameter_));
+ EXPECT_CALL(transport_manager_settings_, aoa_filter_model_name())
+ .WillRepeatedly(ReturnRef(dummy_parameter_));
+ EXPECT_CALL(transport_manager_settings_, aoa_filter_description())
+ .WillRepeatedly(ReturnRef(dummy_parameter_));
+ EXPECT_CALL(transport_manager_settings_, aoa_filter_version())
+ .WillRepeatedly(ReturnRef(dummy_parameter_));
+ EXPECT_CALL(transport_manager_settings_, aoa_filter_uri())
+ .WillRepeatedly(ReturnRef(dummy_parameter_));
+ EXPECT_CALL(transport_manager_settings_, aoa_filter_serial_number())
+ .WillRepeatedly(ReturnRef(dummy_parameter_));
}
-TEST(TestTransportManagerDefault, Init_LastStateUsed_InvalidPort) {
- MockTransportManagerSettings transport_manager_settings;
- transport_manager::TransportManagerDefault transport_manager(
- transport_manager_settings);
+void TestTransportManagerDefault::ExpectationsBluetooth_TA() {
+ // Expectations for Mock of bluetooth transport adapter
+#ifdef BLUETOOTH_SUPPORT
+ EXPECT_CALL(*mock_bt_ta_, AddListener(_));
+ EXPECT_CALL(*mock_bt_ta_, IsInitialised()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*mock_bt_ta_, Init())
+ .WillRepeatedly(Return(TransportAdapter::OK));
+ EXPECT_CALL(*mock_bt_ta_, Terminate());
+#endif
+}
- NiceMock<MockLastState> mock_last_state;
- Json::Value custom_dictionary;
- Json::Value tcp_device;
- tcp_device[kDeviceName] = "unique_tcp_device_name";
- tcp_device[kDeviceAddress] = "127.0.0.1";
- tcp_device[kDeviceApplications][0][kApplicationPort] = "1";
- Json::Value bluetooth_device;
- bluetooth_device[kDeviceName] = "unique_bluetooth_device_name";
- bluetooth_device[kDeviceAddress] = "AB:CD:EF:GH:IJ:KL";
- bluetooth_device[kDeviceApplications][0][kApplicationRfcomm] =
- kApplicationRfcommValue;
- custom_dictionary[kTransportManager][kTcpAdapter][kDevices][0] = tcp_device;
- custom_dictionary[kTransportManager][kBluetoothAdapter][kDevices][0] =
- bluetooth_device;
+void TestTransportManagerDefault::ExpectationsTCP_TA() {
+ // Expectations for Mock of TCP transport adapter
+ EXPECT_CALL(*mock_tcp_ta_, AddListener(_));
+ EXPECT_CALL(*mock_tcp_ta_, IsInitialised()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*mock_tcp_ta_, Init())
+ .WillRepeatedly(Return(TransportAdapter::OK));
+
+ std::shared_ptr<MockDevice> mockdev =
+ std::make_shared<MockDevice>(dev_id_, unique_tcp_dev_name_);
+ EXPECT_CALL(*mock_tcp_ta_, FindDevice(unique_tcp_dev_name_))
+ .WillRepeatedly(Return(mockdev));
+ const int app_handle = 1;
+ EXPECT_CALL(*mock_tcp_ta_, Connect(unique_tcp_dev_name_, app_handle))
+ .Times(0);
+ EXPECT_CALL(*mock_tcp_ta_, Terminate());
+}
- ON_CALL(mock_last_state, get_dictionary())
- .WillByDefault(ReturnRef(custom_dictionary));
+void TestTransportManagerDefault::ExpectationsUSB_TA() {
+ // Expectations for Mock of USB transport adapter
+#if defined(USB_SUPPORT)
+ EXPECT_CALL(*mock_usb_aoa_ta_, AddListener(_));
+ EXPECT_CALL(*mock_usb_aoa_ta_, IsInitialised()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*mock_usb_aoa_ta_, Init())
+ .WillRepeatedly(Return(TransportAdapter::OK));
+ EXPECT_CALL(*mock_usb_aoa_ta_, Terminate());
+#endif
+}
- EXPECT_CALL(transport_manager_settings, use_last_state())
+void TestTransportManagerDefault::ExpectationsCloudWebsocket_TA() {
+ // Expectations for Mock of Cloud Websocket transport adapter
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ EXPECT_CALL(*mock_cloud_websocket_ta_, AddListener(_));
+ EXPECT_CALL(*mock_cloud_websocket_ta_, IsInitialised())
.WillRepeatedly(Return(true));
- EXPECT_CALL(transport_manager_settings, transport_manager_tcp_adapter_port())
- .WillRepeatedly(Return(1u));
- transport_manager.Init(mock_last_state);
- transport_manager.Stop();
+ EXPECT_CALL(*mock_cloud_websocket_ta_, Init())
+ .WillRepeatedly(Return(TransportAdapter::OK));
+ EXPECT_CALL(*mock_cloud_websocket_ta_, Terminate());
+#endif
+}
+
+TEST_F(TestTransportManagerDefault, Init_LastStateNotUsed) {
+ const bool use_last_state = false;
+ ExpectationsSettings_TM(use_last_state);
+
+ ExpectationsBluetooth_TA();
+ ExpectationsTCP_TA();
+ ExpectationsUSB_TA();
+ ExpectationsCloudWebsocket_TA();
+
+ // Act
+ transport_manager_->Init(last_state_wrapper_);
+ transport_manager_->Stop();
+}
+
+TEST_F(TestTransportManagerDefault, Init_LastStateUsed) {
+ const bool use_last_state = true;
+ ExpectationsSettings_TM(use_last_state);
+
+ ExpectationsBluetooth_TA();
+ ExpectationsTCP_TA();
+ ExpectationsUSB_TA();
+ ExpectationsCloudWebsocket_TA();
+
+ // Act
+ transport_manager_->Init(last_state_wrapper_);
+ transport_manager_->Stop();
}
} // namespace transport_manager_test
diff --git a/src/components/transport_manager/test/transport_manager_impl_test.cc b/src/components/transport_manager/test/transport_manager_impl_test.cc
index eebb247908..db4813be9a 100644
--- a/src/components/transport_manager/test/transport_manager_impl_test.cc
+++ b/src/components/transport_manager/test/transport_manager_impl_test.cc
@@ -30,32 +30,31 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "transport_manager/transport_manager_impl.h"
#include <string>
#include "gtest/gtest.h"
#include "protocol/raw_message.h"
+#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
#include "transport_manager/common.h"
-#include "transport_manager/transport_manager_impl.h"
#include "transport_manager/mock_telemetry_observer.h"
-#include "transport_manager/mock_transport_manager_listener.h"
-#include "transport_manager/mock_telemetry_observer.h"
-#include "transport_manager/transport_adapter/mock_transport_adapter.h"
#include "transport_manager/mock_transport_manager_impl.h"
+#include "transport_manager/mock_transport_manager_listener.h"
#include "transport_manager/mock_transport_manager_settings.h"
-#include "resumption/last_state_impl.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
+#include "transport_manager/transport_adapter/mock_transport_adapter.h"
+
#include "utils/test_async_waiter.h"
using ::testing::_;
using ::testing::AtLeast;
+using ::testing::DoAll;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::DoAll;
using ::protocol_handler::RawMessage;
using ::protocol_handler::RawMessagePtr;
-using utils::MakeShared;
+using std::make_shared;
namespace test {
namespace components {
@@ -65,7 +64,7 @@ namespace {
const std::string kAppStorageFolder = "app_storage_folder";
const std::string kAppInfoFolder = "app_info_folder";
const uint32_t kAsyncExpectationsTimeout = 10000u;
-}
+} // namespace
class TransportManagerImplTest : public ::testing::Test {
protected:
@@ -81,11 +80,13 @@ class TransportManagerImplTest : public ::testing::Test {
device_handle_, mac_address_, device_name_, connection_type_) {}
void SetUp() OVERRIDE {
- resumption::LastStateImpl last_state_("app_storage_folder",
- "app_info_storage");
- tm_.Init(last_state_);
+ std::shared_ptr<resumption::LastStateWrapperImpl> wrapper =
+ std::make_shared<resumption::LastStateWrapperImpl>(
+ std::make_shared<resumption::LastStateImpl>("app_storage_folder",
+ "app_info_storage"));
+ tm_.Init(wrapper);
mock_adapter_ = new MockTransportAdapter();
- tm_listener_ = MakeShared<MockTransportManagerListener>();
+ tm_listener_ = std::make_shared<MockTransportManagerListener>();
#ifdef TELEMETRY_MONITOR
tm_.SetTelemetryObserver(&mock_metric_observer_);
@@ -96,14 +97,14 @@ class TransportManagerImplTest : public ::testing::Test {
EXPECT_EQ(E_SUCCESS, tm_.AddTransportAdapter(mock_adapter_));
connection_key_ = 1;
- error_ = MakeShared<BaseError>();
+ error_ = std::make_shared<BaseError>();
const unsigned int version_protocol_ = 1;
const unsigned int kSize = 12;
unsigned char data[kSize] = {
0x20, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- test_message_ =
- MakeShared<RawMessage>(connection_key_, version_protocol_, data, kSize);
+ test_message_ = std::make_shared<RawMessage>(
+ connection_key_, version_protocol_, data, kSize, false);
}
DeviceInfo ConstructDeviceInfo(const std::string& mac_address,
@@ -191,6 +192,26 @@ class TransportManagerImplTest : public ::testing::Test {
tm_.TestHandle(test_event);
}
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+ void HandlePending() {
+ TransportAdapterEvent test_event(EventTypeEnum::ON_CONNECT_PENDING,
+ mock_adapter_,
+ dev_info_.mac_address(),
+ application_id_,
+ test_message_,
+ error_);
+
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
+ .WillRepeatedly(Return(dev_info_.connection_type()));
+
+ EXPECT_CALL(*tm_listener_, OnConnectionPending(dev_info_, connection_key_));
+
+ tm_.TestHandle(test_event);
+ }
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+
void HandleConnectionFailed() {
TransportAdapterEvent test_event(EventTypeEnum::ON_CONNECT_FAIL,
mock_adapter_,
@@ -331,7 +352,7 @@ class TransportManagerImplTest : public ::testing::Test {
#endif // TELEMETRY_MONITOR
MockTransportAdapter* mock_adapter_;
- utils::SharedPtr<MockTransportManagerListener> tm_listener_;
+ std::shared_ptr<MockTransportManagerListener> tm_listener_;
MockTransportManagerImpl tm_;
const ApplicationHandle application_id_ = 1;
ConnectionUID connection_key_;
@@ -406,6 +427,34 @@ TEST_F(TransportManagerImplTest, DisconnectDevice_DeviceNotConnected) {
EXPECT_EQ(E_INVALID_HANDLE, tm_.DisconnectDevice(device_handle_));
}
+#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
+TEST_F(TransportManagerImplTest, Pending) {
+ // Calling HandlePending twice verifies the connection_id stays the same if
+ // the connection exists.
+ HandlePending();
+ HandlePending();
+
+ // Now create pending event for new app id and verify connection_id is
+ // incremented
+ TransportAdapterEvent test_event(EventTypeEnum::ON_CONNECT_PENDING,
+ mock_adapter_,
+ dev_info_.mac_address(),
+ application_id_ + 1,
+ test_message_,
+ error_);
+
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
+ .WillRepeatedly(Return(dev_info_.connection_type()));
+
+ EXPECT_CALL(*tm_listener_,
+ OnConnectionPending(dev_info_, connection_key_ + 1));
+
+ tm_.TestHandle(test_event);
+}
+#endif // CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT
+
TEST_F(TransportManagerImplTest, Disconnect) {
// Arrange
HandleConnection();
@@ -618,15 +667,23 @@ TEST_F(TransportManagerImplTest, RemoveDevice_DeviceWasAdded) {
}
TEST_F(TransportManagerImplTest, SetVisibilityOn_StartClientListening) {
- EXPECT_CALL(*mock_adapter_, StartClientListening())
+ EXPECT_CALL(
+ *mock_adapter_,
+ ChangeClientListening(transport_manager::TransportAction::kVisibilityOn))
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_EQ(::transport_manager::E_SUCCESS, tm_.Visibility(true));
+ EXPECT_EQ(::transport_manager::E_SUCCESS,
+ tm_.PerformActionOnClients(
+ transport_manager::TransportAction::kVisibilityOn));
}
TEST_F(TransportManagerImplTest, SetVisibilityOff_StopClientListening) {
- EXPECT_CALL(*mock_adapter_, StopClientListening())
+ EXPECT_CALL(
+ *mock_adapter_,
+ ChangeClientListening(transport_manager::TransportAction::kVisibilityOff))
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_EQ(::transport_manager::E_SUCCESS, tm_.Visibility(false));
+ EXPECT_EQ(::transport_manager::E_SUCCESS,
+ tm_.PerformActionOnClients(
+ transport_manager::TransportAction::kVisibilityOff));
}
TEST_F(TransportManagerImplTest, StopTransportManager) {
@@ -645,12 +702,14 @@ TEST_F(TransportManagerImplTest, StopTransportManager) {
TEST_F(TransportManagerImplTest, Reinit) {
EXPECT_CALL(*mock_adapter_, Terminate());
EXPECT_CALL(*mock_adapter_, Init()).WillOnce(Return(TransportAdapter::OK));
+ tm_.Deinit();
EXPECT_EQ(E_SUCCESS, tm_.Reinit());
}
TEST_F(TransportManagerImplTest, Reinit_InitAdapterFailed) {
EXPECT_CALL(*mock_adapter_, Terminate());
EXPECT_CALL(*mock_adapter_, Init()).WillOnce(Return(TransportAdapter::FAIL));
+ tm_.Deinit();
EXPECT_EQ(E_ADAPTERS_FAIL, tm_.Reinit());
}
@@ -894,17 +953,22 @@ TEST_F(TransportManagerImplTest, RemoveDevice_TMIsNotInitialized) {
TEST_F(TransportManagerImplTest, Visibility_TMIsNotInitialized) {
// Arrange
- const bool visible = true;
+ const transport_manager::TransportAction action =
+ transport_manager::TransportAction::kVisibilityOn;
// Check before Act
UninitializeTM();
// Act and Assert
- EXPECT_CALL(*mock_adapter_, StartClientListening()).Times(0);
- EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, tm_.Visibility(visible));
+ EXPECT_CALL(
+ *mock_adapter_,
+ ChangeClientListening(transport_manager::TransportAction::kVisibilityOn))
+ .Times(0);
+ EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, tm_.PerformActionOnClients(action));
}
TEST_F(TransportManagerImplTest, HandleMessage_ConnectionNotExist) {
EXPECT_CALL(*mock_adapter_,
- SendData(mac_address_, application_id_, test_message_)).Times(0);
+ SendData(mac_address_, application_id_, test_message_))
+ .Times(0);
TestAsyncWaiter waiter;
EXPECT_CALL(*tm_listener_, OnTMMessageSendFailed(_, test_message_))
@@ -924,16 +988,24 @@ TEST_F(TransportManagerImplTest, SearchDevices_TMIsNotInitialized) {
}
TEST_F(TransportManagerImplTest, SetVisibilityOn_TransportAdapterNotSupported) {
- EXPECT_CALL(*mock_adapter_, StartClientListening())
+ EXPECT_CALL(
+ *mock_adapter_,
+ ChangeClientListening(transport_manager::TransportAction::kVisibilityOn))
.WillOnce(Return(TransportAdapter::NOT_SUPPORTED));
- EXPECT_EQ(E_SUCCESS, tm_.Visibility(true));
+ EXPECT_EQ(E_SUCCESS,
+ tm_.PerformActionOnClients(
+ transport_manager::TransportAction::kVisibilityOn));
}
TEST_F(TransportManagerImplTest,
SetVisibilityOff_TransportAdapterNotSupported) {
- EXPECT_CALL(*mock_adapter_, StopClientListening())
+ EXPECT_CALL(
+ *mock_adapter_,
+ ChangeClientListening(transport_manager::TransportAction::kVisibilityOff))
.WillOnce(Return(TransportAdapter::NOT_SUPPORTED));
- EXPECT_EQ(E_SUCCESS, tm_.Visibility(false));
+ EXPECT_EQ(E_SUCCESS,
+ tm_.PerformActionOnClients(
+ transport_manager::TransportAction::kVisibilityOff));
}
TEST_F(TransportManagerImplTest,
@@ -1144,7 +1216,7 @@ TEST_F(TransportManagerImplTest,
test_message_,
error_));
- auto second_mock_adapter = utils::MakeShared<MockTransportAdapter>();
+ auto second_mock_adapter = std::make_shared<MockTransportAdapter>();
const auto usb_serial = "USB_serial";
DeviceInfo second_device =
@@ -1185,7 +1257,8 @@ TEST_F(TransportManagerImplTest,
EXPECT_CALL(mock_transport_manager_settings_, app_transport_change_timer())
.WillOnce(Return(timeout));
EXPECT_CALL(mock_transport_manager_settings_,
- app_transport_change_timer_addition()).WillOnce(Return(0));
+ app_transport_change_timer_addition())
+ .WillOnce(Return(0));
EXPECT_CALL(*tm_listener_, OnDeviceSwitchingStart(mac_address_, usb_serial));
@@ -1220,7 +1293,7 @@ TEST_F(TransportManagerImplTest,
test_message_,
error_));
- auto second_mock_adapter = utils::MakeShared<MockTransportAdapter>();
+ auto second_mock_adapter = std::make_shared<MockTransportAdapter>();
DeviceInfo second_device =
ConstructDeviceInfo("MA:CA:DR:ES:S", "USB_IOS", "SecondDeviceName");
@@ -1323,6 +1396,29 @@ TEST_F(TransportManagerImplTest,
tm_.OnDeviceListUpdated(mock_adapter_);
}
+TEST_F(TransportManagerImplTest, OnTransportConfigUpdated) {
+ TransportAdapterEvent test_event(EventTypeEnum::ON_TRANSPORT_CONFIG_UPDATED,
+ mock_adapter_,
+ "",
+ 0,
+ test_message_,
+ error_);
+
+ transport_adapter::TransportConfig config;
+ config[transport_manager::transport_adapter::tc_enabled] =
+ std::string("true");
+ config[transport_manager::transport_adapter::tc_tcp_ip_address] =
+ std::string("192.168.1.1");
+ config[transport_manager::transport_adapter::tc_tcp_port] =
+ std::string("12345");
+
+ EXPECT_CALL(*mock_adapter_, GetTransportConfiguration())
+ .WillOnce(Return(config));
+
+ EXPECT_CALL(*tm_listener_, OnTransportConfigUpdated(config));
+ tm_.TestHandle(test_event);
+}
+
} // namespace transport_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/transport_manager/test/websocket_client_connection_test.cc b/src/components/transport_manager/test/websocket_client_connection_test.cc
new file mode 100644
index 0000000000..b9aa6f7c7e
--- /dev/null
+++ b/src/components/transport_manager/test/websocket_client_connection_test.cc
@@ -0,0 +1,482 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "transport_manager/cloud/websocket_client_connection.h"
+#include "gtest/gtest.h"
+#include "resumption/last_state_impl.h"
+#include "resumption/last_state_wrapper_impl.h"
+#include "transport_manager/cloud/cloud_websocket_transport_adapter.h"
+#include "transport_manager/cloud/sample_websocket_server.h"
+#include "transport_manager/transport_adapter/connection.h"
+#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+
+#include "transport_manager/mock_transport_manager_settings.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+using ::testing::_;
+using ::testing::NiceMock;
+using ::testing::Return;
+using namespace ::transport_manager;
+using namespace ::transport_manager::transport_adapter;
+namespace websocket = sample::websocket;
+
+class WebsocketConnectionTest : public ::testing::Test {
+ public:
+ struct WebsocketClient {
+ std::shared_ptr<CloudWebsocketTransportAdapter> adapter;
+ std::shared_ptr<WebsocketClientConnection> connection;
+ };
+
+ void InitWebsocketClient(
+ const transport_manager::transport_adapter::CloudAppProperties&
+ properties,
+ WebsocketClient& client_out) {
+ uniq_id = dev_id = properties.endpoint;
+
+ client_out =
+ WebsocketClient{std::make_shared<CloudWebsocketTransportAdapter>(
+ last_state_wrapper_, transport_manager_settings),
+ nullptr};
+ client_out.adapter->SetAppCloudTransportConfig(uniq_id, properties);
+
+ TransportAdapterImpl* ta_cloud =
+ dynamic_cast<TransportAdapterImpl*>(client_out.adapter.get());
+ ta_cloud->CreateDevice(uniq_id);
+
+ auto connection = client_out.adapter->FindPendingConnection(dev_id, 0);
+
+ ASSERT_NE(connection, nullptr);
+
+ client_out.connection =
+ std::dynamic_pointer_cast<WebsocketClientConnection>(connection);
+
+ ASSERT_NE(client_out.connection.use_count(), 0);
+ }
+
+ void StartWSServer(std::string path) {
+ ws_session = std::make_shared<websocket::WSSession>(kHost, kPort);
+ ws_session->AddRoute(path);
+ ws_session->Run();
+ }
+
+ void StartWSSServer(std::string path) {
+ wss_session = std::make_shared<websocket::WSSSession>(
+ kHost, kPort, kCertificate, kPrivateKey);
+ wss_session->AddRoute(path);
+ wss_session->Run();
+ }
+
+ protected:
+ WebsocketConnectionTest()
+ : last_state_(std::make_shared<resumption::LastStateImpl>(
+ "app_storage_folder", "app_info_storage"))
+ , last_state_wrapper_(
+ std::make_shared<resumption::LastStateWrapperImpl>(last_state_)) {}
+
+ ~WebsocketConnectionTest() {}
+
+ void SetUp() OVERRIDE {
+ ON_CALL(transport_manager_settings, use_last_state())
+ .WillByDefault(Return(true));
+ }
+
+ NiceMock<MockTransportManagerSettings> transport_manager_settings;
+ std::shared_ptr<resumption::LastStateImpl> last_state_;
+ std::shared_ptr<resumption::LastStateWrapperImpl> last_state_wrapper_;
+ std::string dev_id;
+ std::string uniq_id;
+ std::shared_ptr<websocket::WSSession> ws_session;
+ std::shared_ptr<websocket::WSSSession> wss_session;
+ WebsocketClient ws_client;
+ std::string kHost = "127.0.0.1";
+ uint16_t kPort = 8080;
+ std::string kPath = "/folder/file.html/";
+ std::string kQuery = "?eventId=2345&eventName='Test'&expectedResult=true";
+ std::string kFragment = "#section_1";
+
+ // Sample certificate for localhost
+ std::string kCertificate =
+ "-----BEGIN "
+ "CERTIFICATE-----\nMIIDqTCCApECCQC/"
+ "5LlQ+"
+ "GLgqTANBgkqhkiG9w0BAQsFADAXMRUwEwYDVQQDDAwx\nMjcuMC4wLjEgQ0EwIBcNMTkwNTA"
+ "2MTkzMjM2WhgPMjExOTA0MTIxOTMyMzZaMBQx\nEjAQBgNVBAMMCTEyNy4wLjAuMTCCAiIwD"
+ "QYJKoZIhvcNAQEBBQADggIPADCCAgoC\nggIBALbeIoAHFaFeNqbMnhtAO5QTgRd0X9qxpB0"
+ "d4M0dEeog2l/+inNA/eu+CCvm\nJj2I8+6MWH2TUrl/"
+ "2xfhHjzsMrtISCdpNcjaNzCnvi8ZcspFi3evknvs3+uo2/"
+ "wn\nyNZ04jp0oQ0k1cZ6WBpLTYV7WgmueemiWEiAfw+YE+wtRg+"
+ "0H7rksrbpeNPnxQHX\nBDDkWqwvfkD15Sd0XFQkW27K72/"
+ "et2uKuAcJHCIUbsA4iZyJw4Uu4eusy7W5kddX\nThE7Y1WqTXyA4j/"
+ "ZCYigXmsHbWrikPLVXbORhiMF4/60u8RDs0jI8xtgRQhLR9Vp\n3xys7/"
+ "5tHZX00s6x6OVy8aMSZIIVS0eWoVN8bGd9B4+fDMOcNT0YODeQA10w/"
+ "85P\nEiZDQ8AxneQkh8H3qjD2+"
+ "G9oHZaTk0zHTyaKRg3xGP3N9C96onaJX4Rm6nNvApO8\nU7lQ+xHkLwjKCQke39W+"
+ "r3FHwwQvUDeoJBXf6iVkIMFoUPAHNZqKf9Db6KKIEp8i\nDgIhbBxiB4MSn36Zly4SOMojyM"
+ "ZFri+"
+ "HzMbuHFlm8e8QRWGmM4UM2rHIpl4OJolg\nejesDqO8YZR5mZXV0FJRiPgLo2Q4OTtb3tEHJ"
+ "ZLmlT+"
+ "f42bge4ZCZmGPrkNfr68Y\nDEnJ6z4ksOVkMefOp2SNYLYYGPYyiKwa9qVkH9Obkect1omNA"
+ "gMBAAEwDQYJKoZI\nhvcNAQELBQADggEBABFJQtOTftrzbLBA5Vm6aPkbUyxhcaOpz+d+"
+ "Ljd6pIs4H+"
+ "Eb\nXkoHhmay4stZkDc2HVSKESZloI3Ylup8z3aRJjfOexJqHlYzk2vraYryWm8odgID\n5V"
+ "B0Zle8ofpHTJw1LCOXHkzKt1G6vdQpuq/"
+ "4OKpmggaIqqEC1bfOYZt5t6vIx3OF\nxjPz91NTR9gZ4lKrho1+sfS+"
+ "jbSjKkqVAhE4yTpKLPHRshQnBFEhvATXNvdZGftF\n+tXxqKsBZ9aX0/"
+ "YmPFIXFcjdjSSiuq1F1DjiqIZo88qfa9jlTg6VJdayyQ/"
+ "cu41C\nBucY8YTF0Ui8ccIS55h2UTzPy5/4PbrwI4P+Zgo=\n-----END "
+ "CERTIFICATE-----\n";
+ // Sample private key
+ std::string kPrivateKey =
+ "-----BEGIN RSA PRIVATE "
+ "KEY-----\nMIIJKAIBAAKCAgEAtt4igAcVoV42psyeG0A7lBOBF3Rf2rGkHR3gzR0R6iDaX/"
+ "6K\nc0D9674IK+YmPYjz7oxYfZNSuX/"
+ "bF+EePOwyu0hIJ2k1yNo3MKe+LxlyykWLd6+S\ne+zf66jb/"
+ "CfI1nTiOnShDSTVxnpYGktNhXtaCa556aJYSIB/"
+ "D5gT7C1GD7QfuuSy\ntul40+fFAdcEMORarC9+"
+ "QPXlJ3RcVCRbbsrvb963a4q4BwkcIhRuwDiJnInDhS7h\n66zLtbmR11dOETtjVapNfIDiP9"
+ "kJiKBeawdtauKQ8tVds5GGIwXj/rS7xEOzSMjz\nG2BFCEtH1WnfHKzv/"
+ "m0dlfTSzrHo5XLxoxJkghVLR5ahU3xsZ30Hj58Mw5w1PRg4\nN5ADXTD/"
+ "zk8SJkNDwDGd5CSHwfeqMPb4b2gdlpOTTMdPJopGDfEY/"
+ "c30L3qidolf\nhGbqc28Ck7xTuVD7EeQvCMoJCR7f1b6vcUfDBC9QN6gkFd/"
+ "qJWQgwWhQ8Ac1mop/"
+ "\n0NvooogSnyIOAiFsHGIHgxKffpmXLhI4yiPIxkWuL4fMxu4cWWbx7xBFYaYzhQza\nscim"
+ "Xg4miWB6N6wOo7xhlHmZldXQUlGI+AujZDg5O1ve0QclkuaVP5/"
+ "jZuB7hkJm\nYY+uQ1+"
+ "vrxgMScnrPiSw5WQx586nZI1gthgY9jKIrBr2pWQf05uR5y3WiY0CAwEA\nAQKCAgBGSDGyS"
+ "wbBMliG2vWZO6KqUqS2wv9kKgoNNsKDkryj42SKqGXFziDJTgwN\n8zKXS9+Uu1P3T3vn13/"
+ "5OYhJme4VlL5Gh2UogNXdWVr69yjrHLdxlIUUJAIbrJZ/"
+ "\n3zqNUfbwyIptZs7SrYrW8EInHzWHqwsoBEEx/"
+ "FDZSXW+u9fFiVD4n5UgP7M0nktV\nXbI6qElBDC/V/"
+ "6vG8i3aGO8bMdu8fzi3mGUKLzIk1v2J2zDofPosYcxqq8rPWTb4\nMJHMhaqz7fRB+"
+ "bb7GwtS+2/Oathe0B0td1u//Bo1s7ng1s2jrPFm8/"
+ "SbfPCLM4O0\nPjCF8OF8Q6uvSp0K283LAdZk+liuDztc/"
+ "Ed8mcnCZQhBp86mJQi0Jj3Mje7prOAY\nXojMroYj7r2igCJvcwGb1y6zZWSj3jXuHze3bLy"
+ "fv7pCD+hkiZR7mZhQpOhQRZaU\ntdFGc+"
+ "DuykxKPqVjAPy7iVQXYnMjpo36SGIWoZLuepQto3GvU6czyOwhK0/"
+ "Mwbwd\nZpYpLH3L9IetY8GcPefmUR5wQUlUTrpxgGElIzkkWW8zmUWBXwrGbAtN1HJWpJdN"
+ "\neVshKod2fo03IQMPywSdENCJVeSrgRMuwPyFaOM+"
+ "CVrBJwD66K9YWn4cVRUIZsTq\nAXhQ8DzF+WCOZshhMUbCJX+KpcOFI8nxOrPp+"
+ "J1s1YpLLvdmcQKCAQEA7bwvOiCD\nHvaqpYg1jJak6l/"
+ "iY3QIOOpFyjfYrQXS0BNRmmxK8Lzevi/"
+ "NPTqu146QKDaIGvzu\n+"
+ "bXnuV1LmZqnOm5J6Kdx0Mk4Fb88akRtS9gOdzU7WWMYIGkeF1oih0ZrhHuIey6e\nCeLSmJh"
+ "UDaTIWcCirALRHcLWUS6BTGGuE+up5QG7djIW/"
+ "LD17lhGE6fXPlbYXb7l\nPbYwL1Yr0urIp9Un+zrExw+77TTGK7T37T1ZJv46qnro0/"
+ "HK8XxZ+"
+ "JNc18F763O4\nPmwu8KWrx4qnyPYAuB1rbVntK6UxYks9jvk93XecCUP6HHp0I0tV/"
+ "kBNd2+"
+ "18zux\n033xFEVKrUksmwKCAQEAxOrPGyBVFp29V4gQsMQdmafkDAgCLREgjQTOamFsYL5+"
+ "\nZWq+6VhT/"
+ "B650sIoRdX0N8timnSLBfjeqaBG5VVhhyKZhP5hulfRjALhdbGBOYvf\n0gLSffImwWdYQfx"
+ "jtCSO+"
+ "XCLVdAJGOOWeBVVKzH18ZvCFQwUr3Yrp7KmKWKAqgf7\n6rYovWh8T5LLYS0NzXCEwf9nJ0N"
+ "JMOy7I9B7EtF8Cs6tK3aaHVqDz7zufwosS7gI\n3aI51Qh4a5D1p95+"
+ "YU09beWjWGYnPiCKk4D47zaeOe7OQINaWugExlelHtJh9unO\nnhOFXhziav2Kxq1CICAuXl"
+ "Vx3A+gn/cU3niNHz2A9wKCAQEAws+aw78ws4bef5cG\nipZHveek1GqY8krHtdXdsKs8/"
+ "VVXYXusTWn3/VGelbYo4GrqpolJLxRloCr4IGXb\nNZwNvUvzNLtCAR1i4C89irdX+Paro/"
+ "PzFmSluKlrByfNc5y5Lm8sgATLbL56ZKEu\n/58wrpu0sc/"
+ "9HK40gYHiYn0I8ToElqy8uTaCr78zSIT9p826DFOOKgPsRo2tHp02\nfDf5Bc8eXDjkV1sFX"
+ "HQKkHZTVA0ZqWJbIKhncoaJDyofcBsR0ZuzuFWzfTOZo4mf\nInz00TEFldpF1e4C8+"
+ "kCdtHBOA/2Ki2Bp/YUVpHh6aoqZZa75Euehhs8tVpW242M\njEOSUQKCAQAM64sjMH/kt/"
+ "zQXXEa6AM5LbbcwznBUzpbhlE00aeWwWjxpotYLB92\nj12J4otZ6avYbVPO5o6omaeiYY3F"
+ "RlDb2P1RqI8o9tIc6aN5YWglKnRJBz5gXR8F\n2Y4E5lZ0X2GyJBxASSIPq/"
+ "8Xae7ooqKMc7fMQbqpuIssuaAFXx0qCtQQllsd8lkV\nr4AApEAflp5fTC6seNG4kA/"
+ "HTcqFdZE59E2QaHu8KVA0tSTA2R4G6dBLGnXI8IFW\nLXCwzvxjzfmV2FdbWXiBrwjonLG4o"
+ "FDJZE3MFdI73LVTfjSrTQp4dObFoGpDvols\nk64jUwLfsLzaG6kY0z2qwT9xSV+"
+ "ZCSQJAoIBADsSBeyELc5KnmOhT0Xue2o0bkAS\n8KcGWdAoQlaLCIs3vtdlC7DXDXO1l8FkT"
+ "Qrd+GwP3eWDq6ymtO4vkJ3m4cZ1PEsv\n6Qet7qtkVhUfa+"
+ "FYKtDzSMRuSaFPW3Ro1PesFa1H3y+sw5HL36vhRaSK+T4Wy5k2\nf7EwNZIf/"
+ "ZZeA+"
+ "sEtqj33obOBIiuU9htAjN81Kz4a0Xlh6jc4q6iwYKL8nZ76JYV\n8hXWIz6OXxLXE158+"
+ "QtJSZaRCvdr6L5UtWfMPKSMqgfhXfTYViPDleQCkJ132mIS\nH28UoET0Y5wI8M6pMkWpSqW"
+ "WcKPFGwyLInvHdxgnTAsutowkldA7qFwoRz4=\n-----END RSA PRIVATE KEY-----\n";
+ // Sample CA certificate(used to sign the server certificate)
+ std::string kCACertificate =
+ "-----BEGIN "
+ "CERTIFICATE-----"
+ "\nMIIDBjCCAe6gAwIBAgIJAPyCrKRDl3SWMA0GCSqGSIb3DQEBCwUAMBcxFTATBgNV\nBAMM"
+ "DDEyNy4wLjAuMSBDQTAgFw0xOTA1MDYxOTMyMzZaGA8yMTE5MDQxMjE5MzIz\nNlowFzEVMB"
+ "MGA1UEAwwMMTI3LjAuMC4xIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC\nAQ8AMIIBCgKCAQEA"
+ "xrNHoY5+"
+ "JCgnyvEdG2dvvOaZ3sg6uhuF5Ssb5snyo9ixrxO5\nZkDGWwUqFO9PiYuO5ovNeq9LZtPG6s"
+ "K8zsCS062ChZX/7tZHndf4MKCUDzv/"
+ "LPHe\nnROoPi9n2FAiOPctY5hpgpIJDPI5Ofx0el2KPeFGeUO/"
+ "W3yqnfol1ZqzZ2h3uErR\noHkgT2Ja4K+5gnPkr/"
+ "RluJIu3AmWYw4eKi8i3+"
+ "PoThGmCFvoGfcWvRoctgnOHYHE\n4bDRirXL9nGkZ5FMzOVDeoIAEAShOqJwL08VcY+Pg/"
+ "qFQjzRrTmiKgm6QsHNnm0q\nzg70XaD88VJimiGYZOuJHNZpX8o0W+1Ls/"
+ "NbawIDAQABo1MwUTAdBgNVHQ4EFgQU\nkW3hgFWYMpVUkq9AlzGlI3awTGEwHwYDVR0jBBgw"
+ "FoAUkW3hgFWYMpVUkq9AlzGl\nI3awTGEwDwYDVR0TAQH/BAUwAwEB/"
+ "zANBgkqhkiG9w0BAQsFAAOCAQEAZeMkILiG\neEcELWb8cktP3LzvS47O8hys9+"
+ "6TFmftuO7kjDBd9YH2v8iQ7qCcUvMJ7bqL5RP1\nQssKfNOHZtw/"
+ "MMcKE6E3nl4yQSKc8ymivvYSVu5SYtQCedcgfRLb5zvVxXw8JmCp\nGNS3/"
+ "OlIYZAamh76GxkKSaV3tv0XZB6n3rUVQZShncFbMpyJRW0XWxReGWrhXv4s\nNxMeC1r07EE"
+ "WIDecv8KKf1F8uT4UF48HnC0VBpXiOyDGvn35NiKp+"
+ "Q5k7QV6jdCS\ngPRcnZhs6jiU0jnV8C9A1A+"
+ "3pXSSPrAed7tvECOgHCfS10CLsLWsLuSjc93BE5Vt\nav7kmxSwrdvQ2A==\n-----END "
+ "CERTIFICATE-----\n";
+ std::string kIncorrectCertificate =
+ "-----BEGIN "
+ "CERTIFICATE-----\nMIIC/"
+ "jCCAeagAwIBAgIJAIZjLucUID1mMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV\nBAMMCTEyNy4"
+ "wLjAuMTAeFw0xOTA1MDYxNDA1MzdaFw0yOjA1MDZxNDA1MzdaMBQx\nEjAQBgNVBAMMCTEyN"
+ "y4wLjAuMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC\nggEBALfE5Qhc2mHTIux30l7"
+ "eHFjFLdzYeXE8vcaXKodalCG8EkRxojDOfUv+y2DV\nJzHAMiGxMFAEcSz71k+"
+ "jFZwhNG8PLY0b36ChnUsrGkOSJWq3OKUFrg8KxO9At9dL\nJsa+"
+ "R0N0D1bMoPYdpCi3m0b0q2ITHe56qKuTLTrIPia+"
+ "qXGEVD7EoEhU9tnwlcwE\npsUURMXCn2+FhHyqN9wjFkldmu4k8U3OJOK4385L+"
+ "4RJoIV8dsYawAMAf+"
+ "WuxyWq\niPQTPxr8q33ZZm6z0XrgsgxHYCCsryx8L9Ub9Zwu0mie7eL63rYdr86gULvnF1bY"
+ "\ncOunKFc71rBYFalbD6YYsre733kCAwEAAaNTMFEwHQYDVR0OBBYEFKW9ByUNG84Z\nYiSc"
+ "hUrB7KV9FinZMB8GA1UdIwQYMBaAFKW9ByUNG84ZYiSchUrB7KV9FinZMA8G\nA1UdEwEB/"
+ "wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHYROS1EL2qnrwmAsR6c\nqo8yrk8qzLKt4os"
+ "41nv7QMUQFIO+QLPE8SbH4fK1YOMMUJ4ppARQBDaIIR3UEhp1\nZHT/"
+ "wGjK9qxcuQ1EXLyHOY0rxS5q57dYGxOyQo4v6IoLVMZ1ij+RJGPYI/"
+ "2fDXs0\nbDldeJyC1voHmG6lqTN5nLG7Y3j9j6rtSqJyRz5muaecQNiFPQOM2OTp0rC4VeAF"
+ "\ndejmTmLhUFVuHMzLF+"
+ "bpzsN76GnnQquJy2jexzFoWgbEfFVLKuyhTHQAalRb4ccq\nXCIx1hecNDYRY3Sc2Gzv5qxk"
+ "kWF8zqltT/0d5tx0JwN3k5nP4SlaEldFvD6BELxy\nVkU=\n-----END "
+ "CERTIFICATE-----\n";
+};
+
+TEST_F(WebsocketConnectionTest, WSConnection_SUCCESS) {
+ transport_manager::transport_adapter::CloudAppProperties properties{
+ .endpoint = "ws://" + kHost + ":" + std::to_string(kPort),
+ .certificate = "no cert",
+ .enabled = true,
+ .auth_token = "auth_token",
+ .cloud_transport_type = "WS",
+ .hybrid_app_preference = "CLOUD"};
+
+ // Start server
+ StartWSServer("/");
+
+ // Start client
+ InitWebsocketClient(properties, ws_client);
+ std::shared_ptr<WebsocketClientConnection> ws_connection =
+ ws_client.connection;
+
+ // Check websocket connection
+ TransportAdapter::Error ret_code = ws_connection->Start();
+ EXPECT_EQ(TransportAdapter::OK, ret_code);
+
+ // Stop client
+ ret_code = ws_connection->Disconnect();
+ EXPECT_EQ(TransportAdapter::OK, ret_code);
+
+ // Stop server thread
+ ws_session->Stop();
+}
+
+TEST_F(WebsocketConnectionTest, WSConnection_SUCCESS_ValidTarget) {
+ transport_manager::transport_adapter::CloudAppProperties properties{
+ .endpoint = "ws://" + kHost + ":" + std::to_string(kPort) + kPath +
+ kQuery + kFragment,
+ .certificate = "no cert",
+ .enabled = true,
+ .auth_token = "auth_token",
+ .cloud_transport_type = "WS",
+ .hybrid_app_preference = "CLOUD"};
+
+ // Start server
+ StartWSServer(kPath);
+
+ // Start client
+ InitWebsocketClient(properties, ws_client);
+ std::shared_ptr<WebsocketClientConnection> ws_connection =
+ ws_client.connection;
+
+ // Check websocket connection
+ TransportAdapter::Error ret_code = ws_connection->Start();
+ EXPECT_EQ(TransportAdapter::OK, ret_code);
+
+ // Stop client
+ ret_code = ws_connection->Disconnect();
+ EXPECT_EQ(TransportAdapter::OK, ret_code);
+
+ // Stop server thread
+ ws_session->Stop();
+}
+
+TEST_F(WebsocketConnectionTest, WSConnection_FAILURE_InvalidTarget) {
+ transport_manager::transport_adapter::CloudAppProperties properties{
+ .endpoint = "ws://" + kHost + ":" + std::to_string(kPort) + kPath +
+ kQuery + kFragment,
+ .certificate = "no cert",
+ .enabled = true,
+ .auth_token = "auth_token",
+ .cloud_transport_type = "WS",
+ .hybrid_app_preference = "CLOUD"};
+
+ // Start server
+ StartWSServer("/");
+
+ // Start client
+ InitWebsocketClient(properties, ws_client);
+ std::shared_ptr<WebsocketClientConnection> ws_connection =
+ ws_client.connection;
+
+ // Check websocket connection
+ TransportAdapter::Error ret_code = ws_connection->Start();
+ EXPECT_EQ(TransportAdapter::FAIL, ret_code);
+
+ // Stop client
+ ret_code = ws_connection->Disconnect();
+ EXPECT_EQ(TransportAdapter::OK, ret_code);
+
+ // Stop server thread
+ ws_session->Stop();
+}
+
+TEST_F(WebsocketConnectionTest, WSSConnection_SUCCESS) {
+ transport_manager::transport_adapter::CloudAppProperties properties{
+ .endpoint = "wss://" + kHost + ":" + std::to_string(kPort),
+ .certificate = kCACertificate,
+ .enabled = true,
+ .auth_token = "auth_token",
+ .cloud_transport_type = "WSS",
+ .hybrid_app_preference = "CLOUD"};
+
+ // Start server
+ StartWSSServer("/");
+
+ // Start client
+ InitWebsocketClient(properties, ws_client);
+ std::shared_ptr<WebsocketClientConnection> wss_connection =
+ ws_client.connection;
+
+ // Check websocket connection
+ TransportAdapter::Error ret_code = wss_connection->Start();
+ EXPECT_EQ(TransportAdapter::OK, ret_code);
+
+ // Stop client
+ ret_code = wss_connection->Disconnect();
+ EXPECT_EQ(TransportAdapter::OK, ret_code);
+
+ // Stop server thread
+ wss_session->Stop();
+}
+
+TEST_F(WebsocketConnectionTest, WSSConnection_SUCCESS_ValidTarget) {
+ transport_manager::transport_adapter::CloudAppProperties properties{
+ .endpoint = "wss://" + kHost + ":" + std::to_string(kPort) + kPath,
+ .certificate = kCACertificate,
+ .enabled = true,
+ .auth_token = "auth_token",
+ .cloud_transport_type = "WSS",
+ .hybrid_app_preference = "CLOUD"};
+
+ // Start server
+ StartWSSServer((kPath + kQuery + kFragment));
+
+ // Start client
+ InitWebsocketClient(properties, ws_client);
+ std::shared_ptr<WebsocketClientConnection> wss_connection =
+ ws_client.connection;
+
+ // Check websocket connection
+ TransportAdapter::Error ret_code = wss_connection->Start();
+ EXPECT_EQ(TransportAdapter::OK, ret_code);
+
+ // Stop client
+ ret_code = wss_connection->Disconnect();
+ EXPECT_EQ(TransportAdapter::OK, ret_code);
+
+ // Stop server thread
+ wss_session->Stop();
+}
+
+#ifdef ENABLE_SECURITY
+TEST_F(WebsocketConnectionTest, WSSConnection_FAILURE_InvalidTarget) {
+ transport_manager::transport_adapter::CloudAppProperties properties{
+ .endpoint = "wss://" + kHost + ":" + std::to_string(kPort),
+ .certificate = kCACertificate,
+ .enabled = true,
+ .auth_token = "auth_token",
+ .cloud_transport_type = "WSS",
+ .hybrid_app_preference = "CLOUD"};
+
+ // Start server
+ StartWSSServer(kPath);
+
+ // Start client
+ InitWebsocketClient(properties, ws_client);
+ std::shared_ptr<WebsocketClientConnection> wss_connection =
+ ws_client.connection;
+
+ // Check websocket connection
+ TransportAdapter::Error ret_code = wss_connection->Start();
+ EXPECT_EQ(TransportAdapter::FAIL, ret_code);
+
+ // Stop client
+ ret_code = wss_connection->Disconnect();
+ EXPECT_EQ(TransportAdapter::OK, ret_code);
+
+ // Stop server thread
+ wss_session->Stop();
+}
+
+TEST_F(WebsocketConnectionTest, WSSConnection_FAILURE_IncorrectCert) {
+ transport_manager::transport_adapter::CloudAppProperties properties{
+ .endpoint = "wss://" + kHost + ":" + std::to_string(kPort),
+ .certificate = kIncorrectCertificate,
+ .enabled = true,
+ .auth_token = "auth_token",
+ .cloud_transport_type = "WSS",
+ .hybrid_app_preference = "CLOUD"};
+
+ // Start server
+ StartWSSServer("/");
+
+ // Start client
+ InitWebsocketClient(properties, ws_client);
+ std::shared_ptr<WebsocketClientConnection> wss_connection =
+ ws_client.connection;
+
+ // Check websocket connection
+ TransportAdapter::Error ret_code = wss_connection->Start();
+ EXPECT_EQ(TransportAdapter::FAIL, ret_code);
+
+ // Stop client
+ ret_code = wss_connection->Disconnect();
+ EXPECT_EQ(TransportAdapter::OK, ret_code);
+
+ // Stop server thread
+ wss_session->Stop();
+}
+#endif // ENABLE_SECURITY
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/transport_manager/test/websocket_connection_test.cc b/src/components/transport_manager/test/websocket_connection_test.cc
new file mode 100644
index 0000000000..306bdc4784
--- /dev/null
+++ b/src/components/transport_manager/test/websocket_connection_test.cc
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+
+#include <memory>
+#include <string>
+
+#include "resumption/last_state_impl.h"
+#include "transport_manager/websocket_server/websocket_connection.h"
+#include "transport_manager/websocket_server/websocket_session.h"
+
+#include "transport_manager/mock_transport_manager_settings.h"
+#include "transport_manager/transport_adapter/mock_transport_adapter_controller.h"
+
+namespace {
+const std::string kHost = "127.0.0.1";
+const uint16_t kPort = 8080;
+const std::string kPath = "/folder/file.html/";
+const std::uint32_t kConnectionKey = 1u;
+const std::uint32_t kProtocolVersion = 5u;
+const std::string kDeviceUid_ = "deviceUID";
+const transport_manager::ApplicationHandle kAppHandle = 12345u;
+} // namespace
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+using ::testing::_;
+using ::testing::NiceMock;
+using ::testing::Return;
+
+using protocol_handler::RawMessagePtr;
+using protocol_handler::ServiceType;
+
+using namespace ::transport_manager;
+using namespace ::transport_manager::transport_adapter;
+
+class WebsocketNotSecureSessionConnectionTest : public testing::Test {
+ public:
+ WebsocketNotSecureSessionConnectionTest()
+ : websocket_connection_(
+ std::make_shared<WebSocketConnection<WebSocketSession<> > >(
+ kDeviceUid_,
+ kAppHandle,
+ boost::asio::ip::tcp::socket(i_co_),
+ &mock_transport_adapter_ctrl_))
+
+ , last_state_("test_app_folder", "test_app_info_storage") {}
+
+ void SetUp() OVERRIDE {
+ ON_CALL(mock_transport_manager_settings_, use_last_state())
+ .WillByDefault(Return(true));
+ }
+
+ RawMessagePtr CreateDefaultRawMessage() {
+ const uint32_t data_sending_size = 3u;
+ unsigned char data_sending[data_sending_size] = {0x20, 0x07, 0x01};
+ RawMessagePtr raw_message_ptr(
+ new ::protocol_handler::RawMessage(kConnectionKey,
+ kProtocolVersion,
+ data_sending,
+ data_sending_size,
+ false,
+ ServiceType::kAudio));
+ return raw_message_ptr;
+ }
+
+ protected:
+ boost::asio::io_context i_co_;
+ std::shared_ptr<WebSocketConnection<WebSocketSession<> > >
+ websocket_connection_;
+ NiceMock<MockTransportAdapterController> mock_transport_adapter_ctrl_;
+ NiceMock<MockTransportManagerSettings> mock_transport_manager_settings_;
+ resumption::LastStateImpl last_state_;
+};
+
+TEST_F(WebsocketNotSecureSessionConnectionTest, Disconnect_SUCCESS) {
+ websocket_connection_->Run();
+ EXPECT_CALL(mock_transport_adapter_ctrl_,
+ DisconnectDone(kDeviceUid_, kAppHandle))
+ .Times(1);
+
+ auto error = websocket_connection_->Disconnect();
+
+ ASSERT_EQ(TransportAdapter::Error::OK, error);
+}
+
+TEST_F(WebsocketNotSecureSessionConnectionTest, SecondDisconnect_UNSUCCESS) {
+ websocket_connection_->Run();
+ EXPECT_CALL(mock_transport_adapter_ctrl_,
+ DisconnectDone(kDeviceUid_, kAppHandle))
+ .Times(1);
+
+ auto result_error = websocket_connection_->Disconnect();
+
+ ASSERT_EQ(TransportAdapter::Error::OK, result_error);
+
+ EXPECT_CALL(mock_transport_adapter_ctrl_,
+ DisconnectDone(kDeviceUid_, kAppHandle))
+ .Times(0);
+
+ result_error = websocket_connection_->Disconnect();
+
+ ASSERT_EQ(TransportAdapter::Error::BAD_STATE, result_error);
+}
+
+TEST_F(WebsocketNotSecureSessionConnectionTest, SUCCESS_SendData) {
+ auto message = CreateDefaultRawMessage();
+
+ auto error = websocket_connection_->SendData(message);
+
+ ASSERT_EQ(TransportAdapter::Error::OK, error);
+}
+
+TEST_F(WebsocketNotSecureSessionConnectionTest, UNSUCCESS_SendData_BAD_STATE) {
+ websocket_connection_->Run();
+ auto message = CreateDefaultRawMessage();
+
+ auto disconnect_error = websocket_connection_->Disconnect();
+
+ auto send_data_error = websocket_connection_->SendData(message);
+
+ ASSERT_EQ(TransportAdapter::Error::OK, disconnect_error);
+ ASSERT_EQ(TransportAdapter::Error::BAD_STATE, send_data_error);
+}
+
+TEST_F(WebsocketNotSecureSessionConnectionTest, DataReceive_SUCCESS) {
+ auto message = CreateDefaultRawMessage();
+
+ EXPECT_CALL(mock_transport_adapter_ctrl_,
+ DataReceiveDone(kDeviceUid_, kAppHandle, _))
+ .Times(1);
+
+ websocket_connection_->DataReceive(message);
+}
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/transport_manager/test/websocket_sample_client/websocket_sample_client.cc b/src/components/transport_manager/test/websocket_sample_client/websocket_sample_client.cc
new file mode 100644
index 0000000000..88525ad29d
--- /dev/null
+++ b/src/components/transport_manager/test/websocket_sample_client/websocket_sample_client.cc
@@ -0,0 +1,193 @@
+/*
+ * \file websocket_listener.h
+ * \brief WebSocketListener class header file.
+ *
+ * Copyright (c) 2020
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "transport_manager/websocket_server/websocket_sample_client.h"
+
+namespace transport_manager {
+namespace transport_adapter {
+
+template <>
+WSSampleClient<websocket::stream<ssl::stream<tcp::socket> > >::WSSampleClient(
+ const std::string& host,
+ const std::string& port,
+ const SecurityParams& params)
+ : resolver_(ioc_)
+ , ctx_(ssl::context::sslv23_client)
+ , ws_(nullptr)
+ , io_pool_(1)
+ , host_(host)
+ , port_(port)
+ , handshake_successful_(false) {
+ ctx_.set_verify_mode(ssl::context::verify_peer);
+ ctx_.load_verify_file(params.ca_cert_);
+ ctx_.use_certificate_chain_file(params.client_cert_);
+ ctx_.use_private_key_file(params.client_key_, boost::asio::ssl::context::pem);
+ ws_.reset(new WSS(ioc_, ctx_));
+}
+
+template <>
+WSSampleClient<WS>::WSSampleClient(const std::string& host,
+ const std::string& port)
+ : resolver_(ioc_)
+ , ctx_(ssl::context::sslv23_client)
+ , ws_(new WS(ioc_))
+ , host_(host)
+ , port_(port) {}
+
+template <typename Stream>
+bool WSSampleClient<Stream>::Run() {
+ boost::system::error_code ec;
+ ctx_.set_verify_mode(ssl::verify_none);
+
+ auto results = resolver_.resolve(host_, port_, ec);
+ if (ec) {
+ std::cout << "ErrorMessage: " + ec.message() << std::endl;
+ return false;
+ }
+
+ if (!Connect(results)) {
+ return false;
+ }
+
+ if (!Handshake(host_, "/")) {
+ return false;
+ }
+
+ ws_->async_read(buffer_,
+ std::bind(&WSSampleClient::OnRead,
+ this->shared_from_this(),
+ std::placeholders::_1,
+ std::placeholders::_2));
+ boost::asio::post(io_pool_, [&]() { ioc_.run(); });
+ return true;
+}
+
+template <typename Stream>
+void WSSampleClient<Stream>::OnRead(beast::error_code ec,
+ std::size_t bytes_transferred) {
+ boost::ignore_unused(bytes_transferred);
+}
+
+template <>
+bool WSSampleClient<WS>::Connect(tcp::resolver::results_type& results) {
+ boost::system::error_code ec;
+ boost::asio::connect(ws_->next_layer(), results.begin(), results.end(), ec);
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ return false;
+ }
+ return true;
+}
+
+template <>
+bool WSSampleClient<WSS>::Connect(tcp::resolver::results_type& results) {
+ boost::system::error_code ec;
+ boost::asio::connect(ws_->lowest_layer(), results.begin(), results.end(), ec);
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ return false;
+ }
+ return true;
+}
+
+template <>
+bool WSSampleClient<WS>::Handshake(const std::string& host,
+ const std::string& target) {
+ boost::system::error_code ec;
+ ws_->handshake(host, target, ec);
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ return false;
+ }
+ return true;
+}
+
+template <>
+void WSSampleClient<WS>::Stop() {
+ ioc_.stop();
+ ws_->lowest_layer().close();
+
+ io_pool_.stop();
+ io_pool_.join();
+}
+
+template <>
+bool WSSampleClient<WSS>::Handshake(const std::string& host,
+ const std::string& target) {
+ boost::system::error_code ec;
+
+ ws_->next_layer().handshake(ssl::stream_base::client, ec);
+ if (ec) {
+ std::cout << "ErrorMessage: " + ec.message() << std::endl;
+ return false;
+ }
+
+ ws_->handshake(host, target, ec);
+ if (ec) {
+ std::string str_err = "ErrorMessage: " + ec.message();
+ return false;
+ }
+
+ handshake_successful_ = true;
+ return true;
+}
+
+template <>
+void WSSampleClient<WSS>::Stop() {
+ ioc_.stop();
+ ws_->next_layer().next_layer().shutdown(
+ boost::asio::ip::tcp::socket::shutdown_both);
+ ws_->lowest_layer().close();
+
+ io_pool_.stop();
+ io_pool_.join();
+}
+
+template <>
+void WSSampleClient<WSS>::OnHandshakeTimeout() {
+ if (!handshake_successful_) {
+ Stop();
+ }
+}
+
+template <>
+bool WSSampleClient<WSS>::IsHandshakeSuccessful() const {
+ return handshake_successful_;
+}
+
+template class WSSampleClient<WS>;
+template class WSSampleClient<WSS>;
+} // namespace transport_adapter
+} // namespace transport_manager
diff --git a/src/components/transport_manager/test/websocket_server_listener_test.cc b/src/components/transport_manager/test/websocket_server_listener_test.cc
new file mode 100644
index 0000000000..7991c6f1cb
--- /dev/null
+++ b/src/components/transport_manager/test/websocket_server_listener_test.cc
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2020, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "transport_manager/mock_transport_manager_settings.h"
+#include "transport_manager/transport_adapter/mock_transport_adapter_controller.h"
+#include "transport_manager/websocket_server/websocket_device.h"
+#include "transport_manager/websocket_server/websocket_listener.h"
+#include "utils/timer.h"
+#include "utils/timer_task_impl.h"
+
+#include <thread>
+#include "transport_manager/websocket_server/websocket_sample_client.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+using ::testing::_;
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnArg;
+using ::testing::ReturnPointee;
+using ::testing::ReturnRef;
+using namespace ::transport_manager;
+using namespace ::transport_manager::transport_adapter;
+
+namespace {
+const std::string kDefaultAddress = "127.0.0.1";
+const std::string kDefaultCertPath = "";
+const std::string kDefaultKeyPath = "";
+const std::string kDefaultCACertPath = "";
+const uint32_t kDefaultPort = 2021;
+const std::string kDefaultPortStr = "2021";
+const uint32_t kWrongPort = 1000;
+const std::string kCACertPath = "./test_certs/ca-cert.pem";
+const std::string kClientCertPath = "./test_certs/client-cert.pem";
+const std::string kClientKeyPath = "./test_certs/client-key.pem";
+const std::string kServerCert = "./test_certs/server-cert.pem";
+const std::string kServerKey = "./test_certs/server-key.pem";
+const std::string kCACert = "./test_certs/ca-cert.pem";
+const std::string kDefaultDeviceName = "Web Engine";
+const int kNumThreads = 2;
+} // namespace
+
+class WebSocketListenerTest : public ::testing::Test {
+ protected:
+ MockTransportAdapterController mock_ta_controller_;
+ MockTransportManagerSettings mock_tm_settings_;
+
+ public:
+ WebSocketListenerTest() {}
+ ~WebSocketListenerTest() {}
+
+ void SetUp() OVERRIDE {
+ ON_CALL(mock_tm_settings_, websocket_server_address())
+ .WillByDefault(ReturnRef(kDefaultAddress));
+ ON_CALL(mock_tm_settings_, websocket_server_port())
+ .WillByDefault(Return(kDefaultPort));
+ ON_CALL(mock_tm_settings_, ws_server_cert_path())
+ .WillByDefault(ReturnRef(kServerCert));
+ ON_CALL(mock_tm_settings_, ws_server_key_path())
+ .WillByDefault(ReturnRef(kServerKey));
+ ON_CALL(mock_tm_settings_, ws_server_ca_cert_path())
+ .WillByDefault(ReturnRef(kCACert));
+ ON_CALL(mock_tm_settings_, wss_server_supported())
+ .WillByDefault(Return(true));
+ }
+
+ std::shared_ptr<WebSocketDevice> CreateDevice(const bool secure_connection) {
+ return std::make_shared<WebSocketDevice>(kDefaultDeviceName,
+ kDefaultDeviceName);
+ }
+};
+
+TEST_F(WebSocketListenerTest, StartListening_ClientConnect_SUCCESS) {
+ ON_CALL(mock_tm_settings_, ws_server_cert_path())
+ .WillByDefault(ReturnRef(kDefaultCertPath));
+ ON_CALL(mock_tm_settings_, ws_server_key_path())
+ .WillByDefault(ReturnRef(kDefaultKeyPath));
+ ON_CALL(mock_tm_settings_, ws_server_ca_cert_path())
+ .WillByDefault(ReturnRef(kDefaultCACertPath));
+ ON_CALL(mock_tm_settings_, wss_server_supported())
+ .WillByDefault(Return(false));
+
+ const auto ws_listener = std::make_shared<WebSocketListener>(
+ &mock_ta_controller_, mock_tm_settings_, kNumThreads);
+ const auto ws_client =
+ std::make_shared<WSSampleClient<WS> >(kDefaultAddress, kDefaultPortStr);
+
+ EXPECT_CALL(mock_ta_controller_, ConnectDone(_, _));
+ EXPECT_CALL(mock_ta_controller_, ConnectionCreated(_, _, _));
+ EXPECT_CALL(mock_ta_controller_, GetWebEngineDevice())
+ .WillOnce(Return(CreateDevice(false)));
+
+ ws_listener->StartListening();
+ EXPECT_TRUE(ws_client->Run());
+ ws_client->Stop();
+}
+
+TEST_F(WebSocketListenerTest, StartListening_ClientConnectSecure_SUCCESS) {
+ const auto ws_listener = std::make_shared<WebSocketListener>(
+ &mock_ta_controller_, mock_tm_settings_, kNumThreads);
+ const SecurityParams params{kCACertPath, kClientCertPath, kClientKeyPath};
+ const auto wss_client = std::make_shared<WSSampleClient<WSS> >(
+ kDefaultAddress, kDefaultPortStr, params);
+
+ EXPECT_CALL(mock_ta_controller_, ConnectDone(_, _));
+ EXPECT_CALL(mock_ta_controller_, ConnectionCreated(_, _, _));
+ EXPECT_CALL(mock_ta_controller_, GetWebEngineDevice())
+ .WillOnce(Return(CreateDevice(true)));
+
+ ws_listener->StartListening();
+ EXPECT_TRUE(wss_client->Run());
+ wss_client->Stop();
+}
+
+TEST_F(WebSocketListenerTest,
+ StartListening_ClientConnectSecureInvalidCert_FAIL) {
+ const auto ws_listener = std::make_shared<WebSocketListener>(
+ &mock_ta_controller_, mock_tm_settings_, kNumThreads);
+ const SecurityParams params{kCACertPath,
+ "./test_certs/invalid_cert.pem",
+ "./test_certs/invalid_key.pem"};
+ const auto wss_client = std::make_shared<WSSampleClient<WSS> >(
+ kDefaultAddress, kDefaultPortStr, params);
+
+ EXPECT_CALL(mock_ta_controller_, ConnectDone(_, _));
+ EXPECT_CALL(mock_ta_controller_, ConnectionCreated(_, _, _));
+ EXPECT_CALL(mock_ta_controller_, GetWebEngineDevice())
+ .WillOnce(Return(CreateDevice(true)));
+ EXPECT_CALL(mock_ta_controller_, ConnectionAborted(_, _, _));
+
+ ws_listener->StartListening();
+ timer::Timer handshake_timer(
+ "HandshakeTimer",
+ new ::timer::TimerTaskImpl<WSSampleClient<WSS> >(
+ wss_client.get(), &WSSampleClient<WSS>::OnHandshakeTimeout));
+ handshake_timer.Start(3000, timer::kSingleShot);
+ wss_client->Run();
+ EXPECT_EQ(wss_client->IsHandshakeSuccessful(), false);
+}
+
+TEST_F(WebSocketListenerTest, StartListening_CertificateNotFound_Fail) {
+ const std::string server_cert = "./test_certs/server-cert.pem";
+ const std::string server_key = "./test_certs/server-key.pem";
+ const std::string ca_cert = "./not_valid_path/ca-cert.pem";
+ ON_CALL(mock_tm_settings_, ws_server_cert_path())
+ .WillByDefault(ReturnRef(server_cert));
+ ON_CALL(mock_tm_settings_, ws_server_key_path())
+ .WillByDefault(ReturnRef(server_key));
+ ON_CALL(mock_tm_settings_, ws_server_ca_cert_path())
+ .WillByDefault(ReturnRef(ca_cert));
+
+ const auto ws_listener_ = std::make_shared<WebSocketListener>(
+ &mock_ta_controller_, mock_tm_settings_, kNumThreads);
+ const auto ws_client_ =
+ std::make_shared<WSSampleClient<WS> >(kDefaultAddress, kDefaultPortStr);
+
+ EXPECT_EQ(TransportAdapter::Error::FAIL, ws_listener_->StartListening());
+}
+
+TEST_F(WebSocketListenerTest, StartListening_WrongConfig_FAIL) {
+ const std::string server_cert = "./test_certs/server-cert.pem";
+
+ ON_CALL(mock_tm_settings_, ws_server_cert_path())
+ .WillByDefault(ReturnRef(server_cert));
+ ON_CALL(mock_tm_settings_, ws_server_key_path())
+ .WillByDefault(ReturnRef(kDefaultKeyPath));
+ EXPECT_CALL(mock_tm_settings_, ws_server_ca_cert_path())
+ .WillOnce(ReturnRef(kDefaultCACertPath));
+
+ const auto ws_listener_ = std::make_shared<WebSocketListener>(
+ &mock_ta_controller_, mock_tm_settings_, kNumThreads);
+ const auto ws_client_ =
+ std::make_shared<WSSampleClient<WS> >(kDefaultAddress, kDefaultPortStr);
+
+ EXPECT_EQ(TransportAdapter::Error::FAIL, ws_listener_->StartListening());
+}
+
+TEST_F(WebSocketListenerTest, StartListening_BindToTheServerAddress_FAIL) {
+ ON_CALL(mock_tm_settings_, ws_server_cert_path())
+ .WillByDefault(ReturnRef(kDefaultCertPath));
+ ON_CALL(mock_tm_settings_, ws_server_key_path())
+ .WillByDefault(ReturnRef(kDefaultKeyPath));
+ ON_CALL(mock_tm_settings_, wss_server_supported())
+ .WillByDefault(Return(false));
+ EXPECT_CALL(mock_tm_settings_, ws_server_ca_cert_path())
+ .WillOnce(ReturnRef(kDefaultCACertPath));
+ EXPECT_CALL(mock_tm_settings_, websocket_server_port())
+ .WillOnce(Return(kWrongPort));
+
+ const auto ws_listener_ = std::make_shared<WebSocketListener>(
+ &mock_ta_controller_, mock_tm_settings_, kNumThreads);
+ const auto ws_client_ =
+ std::make_shared<WSSampleClient<WS> >(kDefaultAddress, kDefaultPortStr);
+
+ EXPECT_EQ(TransportAdapter::Error::FAIL, ws_listener_->StartListening());
+}
+
+TEST_F(WebSocketListenerTest, StartListening_AcceptorIsOpen_SUCCESS) {
+ ON_CALL(mock_tm_settings_, ws_server_cert_path())
+ .WillByDefault(ReturnRef(kDefaultCertPath));
+ ON_CALL(mock_tm_settings_, ws_server_key_path())
+ .WillByDefault(ReturnRef(kDefaultKeyPath));
+ ON_CALL(mock_tm_settings_, wss_server_supported())
+ .WillByDefault(Return(false));
+
+ EXPECT_CALL(mock_ta_controller_, ConnectDone(_, _));
+ EXPECT_CALL(mock_ta_controller_, ConnectionCreated(_, _, _));
+ EXPECT_CALL(mock_ta_controller_, GetWebEngineDevice())
+ .WillOnce(Return(CreateDevice(false)));
+
+ EXPECT_CALL(mock_tm_settings_, ws_server_ca_cert_path())
+ .WillOnce(ReturnRef(kDefaultCACertPath));
+
+ const auto ws_listener = std::make_shared<WebSocketListener>(
+ &mock_ta_controller_, mock_tm_settings_, kNumThreads);
+ const auto ws_client =
+ std::make_shared<WSSampleClient<WS> >(kDefaultAddress, kDefaultPortStr);
+
+ ws_listener->StartListening();
+ ws_client->Run();
+ EXPECT_EQ(TransportAdapter::Error::OK, ws_listener->StartListening());
+ ws_client->Stop();
+}
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt
index b256a2fadc..451a8a629e 100644
--- a/src/components/utils/CMakeLists.txt
+++ b/src/components/utils/CMakeLists.txt
@@ -40,6 +40,8 @@ include_directories (
${COMPONENTS_DIR}/protocol_handler/include
${JSONCPP_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
+ ${CMAKE_SOURCE_DIR}/src
)
# dbms
@@ -56,7 +58,10 @@ set(EXCLUDE_PATHS
${DBMS_PATHS}
)
-set(LIBRARIES)
+set(LIBRARIES
+ encryption
+ jsoncpp
+)
if(NOT BUILD_BACKTRACE_SUPPORT)
list(APPEND EXCLUDE_PATHS
@@ -102,7 +107,7 @@ set(PATHS
collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}")
if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
- # --- QDB Wrapper
+ # --- QDB Wrapper
add_subdirectory(./src/qdb_wrapper)
else ()
# --- SQLite Wrapper
@@ -110,14 +115,21 @@ else ()
endif ()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
- list(APPEND LIBRARIES dl pthread ${RTLIB})
+ list(APPEND LIBRARIES dl pthread ${RTLIB})
endif()
add_library("Utils" ${SOURCES})
+GET_PROPERTY(BOOST_LIBS_DIRECTORY GLOBAL PROPERTY GLOBAL_BOOST_LIBS)
+list(APPEND LIBRARIES boost_system -L${BOOST_LIBS_DIRECTORY})
+list(APPEND LIBRARIES boost_thread -L${BOOST_LIBS_DIRECTORY})
+list(APPEND LIBRARIES boost_date_time -L${BOOST_LIBS_DIRECTORY})
+list(APPEND LIBRARIES boost_filesystem -L${BOOST_LIBS_DIRECTORY})
target_link_libraries("Utils" ${LIBRARIES})
+add_dependencies("Utils" Boost)
+
if(ENABLE_LOG)
- add_dependencies("Utils" install-3rd_party_logger)
+ add_dependencies("Utils" install-3rd_party_logger Boost)
endif()
if(BUILD_TESTS)
diff --git a/src/components/utils/include/utils/back_trace.h b/src/components/utils/include/utils/back_trace.h
index 180714e5a6..f23f87e60c 100644
--- a/src/components/utils/include/utils/back_trace.h
+++ b/src/components/utils/include/utils/back_trace.h
@@ -33,8 +33,8 @@
#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_BACK_TRACE_H_
#include <ostream>
-#include <vector>
#include <string>
+#include <vector>
#include "utils/threads/thread.h"
namespace utils {
diff --git a/src/components/utils/include/utils/file_system.h b/src/components/utils/include/utils/file_system.h
index 22c200934f..f575da129f 100644
--- a/src/components/utils/include/utils/file_system.h
+++ b/src/components/utils/include/utils/file_system.h
@@ -33,17 +33,19 @@
#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_FILE_SYSTEM_H_
#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_FILE_SYSTEM_H_
-#include <string.h>
#include <stdint.h>
+#include <string.h>
+#include <time.h>
+#include <fstream>
+#include <iostream>
#include <string>
#include <vector>
-#include <iostream>
-#include <fstream>
namespace file_system {
/**
- * @brief Get available disc space.
+ * @brief Get available disc space of directory. Returns 0 if the directory does
+ * not exist.
*
* @param path to directory
* @return free disc space.
@@ -51,26 +53,27 @@ namespace file_system {
uint64_t GetAvailableDiskSpace(const std::string& path);
/*
- * @brief Get size of current directory
+ * @brief Get size of given directory
*
* @param path to directory
+ * @return size of directory, return 0 if dir not exist
*/
size_t DirectorySize(const std::string& path);
/*
- * @brief Get size of current file
+ * @brief Get size of given file
*
* @param path to file
* @return size of file, return 0 if file not exist
*/
-int64_t FileSize(const std::string& path);
+uint64_t FileSize(const std::string& path);
/**
- * @brief Creates directory
- * @param name path to directory
- * @return path to created directory.
+ * @brief Creates directory with owner_all permissions
+ * @param name directory to create
+ * @return true if directory was created or already existed.
*/
-std::string CreateDirectory(const std::string& name);
+bool CreateDirectory(const std::string& name);
/**
* @brief Creates directory recursively
@@ -80,76 +83,75 @@ std::string CreateDirectory(const std::string& name);
bool CreateDirectoryRecursively(const std::string& path);
/**
- * @brief Checks the file to see whether the file is a directory
- * @param name path to file
- * @return returns true if file is directory.
- */
+ * @brief Checks the file to see whether the file is a directory
+ * @param name path to file
+ * @return returns true if file is directory.
+ */
bool IsDirectory(const std::string& name);
/**
- * @brief Is directory exist
- * @param name path to directory
- * @return returns true if directory is exists.
- */
+ * @brief Does directory exist
+ * @param name path to directory
+ * @return returns true if the file exists and is a directory.
+ */
bool DirectoryExists(const std::string& name);
/**
- * @brief Is file exist
- * @param name path to file
- * @return returns true if file is exists.
- */
+ * @brief Does file exist
+ * @param name path to file
+ * @return returns true if the file exists.
+ */
bool FileExists(const std::string& name);
/**
- * @brief Writes to file
- *
- * @remark - create file if it doesn't exist
- * @param name path to file
- * @param data data to write
- * @return returns true if the operation is successfully.
- */
+ * @brief Writes to file
+ *
+ * @remark - create file if it doesn't exist
+ * @param name path to file
+ * @param data data to write
+ * @return returns true if the operation is successful.
+ */
bool Write(const std::string& file_name,
const std::vector<uint8_t>& data,
std::ios_base::openmode mode = std::ios_base::out);
/**
- * @brief Opens file stream for writing
- * @param file_name path to file to write data to
- * @return returns pointer to opened stream in case of success;
- * otherwise returns NULL
- */
+ * @brief Opens file stream for writing
+ * @param file_name path to file to write data to
+ * @return returns pointer to opened stream in case of success;
+ * otherwise returns NULL
+ */
std::ofstream* Open(const std::string& file_name,
std::ios_base::openmode mode = std::ios_base::out);
/**
- * @brief Writes to file stream
- * @param file_stream file stream to be written to
- * @param data data to be written to file
- * @param data_size size of data to be written to file
- * @return returns true if the operation is successfully.
- */
+ * @brief Writes to file stream
+ * @param file_stream file stream to be written to
+ * @param data data to be written to file
+ * @param data_size size of data to be written to file
+ * @return returns true if the operation is successful.
+ */
bool Write(std::ofstream* const file_stream,
const uint8_t* data,
uint32_t data_size);
/**
- * @brief Closes file stream
- * @param file_stream file stream to be closed
- */
+ * @brief Closes file stream
+ * @param file_stream file stream to be closed
+ */
void Close(std::ofstream* file_stream);
/**
- * @brief Returns current working directory path
- * If filename begins with "/", return unchanged filename
- * @param name file name
- * @return returns full file path.
- */
+ * @brief Returns current working directory path
+ * @return returns full file path.
+ */
std::string CurrentWorkingDirectory();
/**
- * @brief Allows to obtaine absolute path for certain path.
- * @param path the file name for which absolute path have to be calculated.
- * @return absolute path for certain path.
+ * @brief Convert a path to its absolute form.
+ * @param path the file name to convert.
+ * @return corresponding absolute path for a valid path, otherwise an empty
+ * string.
*/
std::string GetAbsolutePath(const std::string& path);
@@ -162,55 +164,63 @@ std::string GetAbsolutePath(const std::string& path);
bool IsFileNameValid(const std::string& file_name);
/**
- * @brief Removes file
- *
- * @param name path to file
- * @return returns true if the file is successfully deleted.
- */
+ * @brief Removes file
+ *
+ * @param name path to file
+ * @return returns true if the file is successfully deleted.
+ */
bool DeleteFile(const std::string& name);
/**
+ * @brief Removes contents of directory but not directory itself
+ *
+ * @param directory_name path to directory.
+ */
+void remove_directory_content(const std::string& directory_name);
+
+/**
* @brief Removes directory.
*
- * @param name path to directory.
+ * @param directory_name path to directory.
* @param is_recursively true if you need delete directory recursively,
- *otherwise false.
+ * otherwise false. A non-empty directory with is_recursively == false will
+ * return false.
* @return returns true if the directory is successfully deleted.
*/
bool RemoveDirectory(const std::string& directory_name,
- bool is_recursively = true);
+ const bool is_recursively = true);
/**
- * @brief Check access rights
- *
- * @param name path to file.
- * @param how Read/write attribute.
- * @return returns true if file has the given mode.
- */
-bool IsAccessible(const std::string& name, int32_t how);
+ * @brief Check access rights
+ *
+ * @param name path to file.
+ * @param how Read/write attribute.
+ * @return returns true if file has the given mode.
+ */
+bool IsAccessible(const std::string& name, const int32_t how);
/**
- * @brief Check access rights for writing
- *
- * @param name path to file or folder
- * @return returns true if has access rights.
- */
+ * @brief Check access rights for writing
+ *
+ * @param name path to file or folder
+ * @return returns true if has access rights.
+ */
bool IsWritingAllowed(const std::string& name);
/**
- * @brief Check access rights for reading
- *
- * @param name path to file.
- * @return returns true if file has access rights.
- */
+ * @brief Check access rights for reading
+ *
+ * @param name path to file.
+ * @return returns true if file has access rights.
+ */
bool IsReadingAllowed(const std::string& name);
/**
- * @brief Lists all files in given directory
- *
- * @param name path to directory.
- * @return returns list of files.
- */
+ * @brief Lists all files in given directory
+ *
+ * @param name path to directory.
+ * @return returns list of files.
+ */
std::vector<std::string> ListFiles(const std::string& directory_name);
/**
@@ -223,30 +233,43 @@ bool WriteBinaryFile(const std::string& name,
const std::vector<uint8_t>& contents);
/**
- * @brief Reads from file
- *
- * @param name path to file
- * @param result read data
- * @return returns true if the operation is successfully.
- */
+ * @brief Reads from file
+ *
+ * @param name path to file
+ * @param result read data
+ * @return returns true if the operation is successfully.
+ */
bool ReadBinaryFile(const std::string& name, std::vector<uint8_t>& result);
+/**
+ * @brief Reads from file
+ *
+ * @param name path to file
+ * @param result read data
+ * @param offset number of bytes to be ignored from begining of file
+ * @return returns true if the operation is successfully.
+ */
+bool ReadBinaryFile(const std::string& name,
+ std::vector<uint8_t>& result,
+ uint32_t offset,
+ uint32_t length);
+
bool ReadFile(const std::string& name, std::string& result);
/**
- * @brief Convert special symbols in system path to percent-encoded
- *
- * @param name path to file
- * @return returns converted path.
-*/
+ * @brief Convert special symbols in system path to percent-encoded
+ *
+ * @param name path to file
+ * @return returns converted path.
+ */
const std::string ConvertPathForURL(const std::string& path);
/**
- * @brief Create empty file
- *
- * @param name path to file
- * @return if result success return true
-*/
+ * @brief Create empty file
+ *
+ * @param name path to file
+ * @return if result success return true
+ */
bool CreateFile(const std::string& path);
/**
@@ -254,28 +277,26 @@ bool CreateFile(const std::string& path);
* @param path Path to file
* @return Modification time in nanoseconds
*/
-uint64_t GetFileModificationTime(const std::string& path);
+time_t GetFileModificationTime(const std::string& path);
/**
- * @brief Copy file from source to destination
- *
- * @param src Source file path
- * @param dst Destination file path
- * @return if result success return true
-*/
+ * @brief Copy file from source to destination
+ *
+ * @param src Source file path
+ * @param dst Destination file path
+ * @return if result success return true
+ */
bool CopyFile(const std::string& src, const std::string& dst);
/**
- * @brief Move file from source to destination
- *
- * @param src Source file path
- * @param dst Destination file path
- * @return if result success return true
-*/
+ * @brief Move file from source to destination
+ *
+ * @param src Source file path
+ * @param dst Destination file path
+ * @return if result success return true
+ */
bool MoveFile(const std::string& src, const std::string& dst);
-void remove_directory_content(const std::string& directory_name);
-
} // namespace file_system
#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_FILE_SYSTEM_H_
diff --git a/src/components/utils/include/utils/helpers.h b/src/components/utils/include/utils/helpers.h
index f13d69aa83..1ef336dadd 100644
--- a/src/components/utils/include/utils/helpers.h
+++ b/src/components/utils/include/utils/helpers.h
@@ -132,6 +132,6 @@ bool in_range(const Container& container,
return std::find(container.begin(), container.end(), value) !=
container.end();
}
-}
+} // namespace helpers
#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_HELPERS_H_
diff --git a/src/components/utils/include/utils/jsoncpp_reader_wrapper.h b/src/components/utils/include/utils/jsoncpp_reader_wrapper.h
new file mode 100644
index 0000000000..deebe23cae
--- /dev/null
+++ b/src/components/utils/include/utils/jsoncpp_reader_wrapper.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_JSONCPP_READER_WRAPPER_H_
+#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_JSONCPP_READER_WRAPPER_H_
+
+#include <memory>
+#include <string>
+#include "json/reader.h"
+
+namespace utils {
+
+class JsonReader {
+ public:
+ JsonReader();
+ bool parse(const std::string& json, Json::Value* root);
+
+ private:
+ std::unique_ptr<Json::CharReader> reader_;
+ Json::CharReaderBuilder reader_builder_;
+};
+} // namespace utils
+#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_JSONCPP_READER_WRAPPER_H_
diff --git a/src/components/utils/include/utils/log_message_loop_thread.h b/src/components/utils/include/utils/log_message_loop_thread.h
index d6a9edd072..b0cac75c71 100644
--- a/src/components/utils/include/utils/log_message_loop_thread.h
+++ b/src/components/utils/include/utils/log_message_loop_thread.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOG_MESSAGE_LOOP_THREAD_H_
#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOG_MESSAGE_LOOP_THREAD_H_
-#include <string>
-#include <queue>
#include <log4cxx/logger.h>
+#include <queue>
+#include <string>
#include "utils/macro.h"
#include "utils/threads/message_loop_thread.h"
@@ -56,18 +56,14 @@ typedef std::queue<LogMessage> LogMessageQueue;
typedef threads::MessageLoopThread<LogMessageQueue>
LogMessageLoopThreadTemplate;
-class LogMessageHandler : public LogMessageLoopThreadTemplate::Handler {
- public:
- virtual void Handle(const LogMessage message) OVERRIDE;
-};
-
-class LogMessageLoopThread : public LogMessageLoopThreadTemplate {
+class LogMessageLoopThread : public LogMessageLoopThreadTemplate,
+ public LogMessageLoopThreadTemplate::Handler {
public:
LogMessageLoopThread();
~LogMessageLoopThread();
+ void Handle(const LogMessage message) OVERRIDE;
private:
- LogMessageHandler* handler_;
DISALLOW_COPY_AND_ASSIGN(LogMessageLoopThread);
};
diff --git a/src/components/utils/include/utils/optional.h b/src/components/utils/include/utils/optional.h
index 0395945de0..626c166a02 100644
--- a/src/components/utils/include/utils/optional.h
+++ b/src/components/utils/include/utils/optional.h
@@ -79,5 +79,5 @@ class Optional {
bool is_initialized_;
};
-} // utils utils
+} // namespace utils
#endif // ERROR_OR_H
diff --git a/src/components/utils/include/utils/qdb_wrapper/sql_query.h b/src/components/utils/include/utils/qdb_wrapper/sql_query.h
index bc3e7a592b..b324fd5d40 100644
--- a/src/components/utils/include/utils/qdb_wrapper/sql_query.h
+++ b/src/components/utils/include/utils/qdb_wrapper/sql_query.h
@@ -33,11 +33,11 @@
#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_QDB_WRAPPER_SQL_QUERY_H_
#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_QDB_WRAPPER_SQL_QUERY_H_
-#include <stdint.h>
#include <qdb/qdb.h>
+#include <stdint.h>
#include <string>
-#include <vector>
#include <utility>
+#include <vector>
#include "qdb_wrapper/sql_error.h"
#include "utils/lock.h"
diff --git a/src/components/utils/include/utils/resource_usage.h b/src/components/utils/include/utils/resource_usage.h
index d358c49225..d34897eded 100644
--- a/src/components/utils/include/utils/resource_usage.h
+++ b/src/components/utils/include/utils/resource_usage.h
@@ -38,9 +38,9 @@
#include <sys/procfs.h>
#endif
-#include "utils/macro.h"
-#include <string>
#include <iostream>
+#include <string>
+#include "utils/macro.h"
#include "utils/logger.h"
@@ -171,6 +171,6 @@ class Resources {
*/
static const char* proc;
};
-}
+} // namespace utils
#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_RESOURCE_USAGE_H_
diff --git a/src/components/utils/include/utils/signals.h b/src/components/utils/include/utils/signals.h
index 72d29a9e28..bda83f315f 100644
--- a/src/components/utils/include/utils/signals.h
+++ b/src/components/utils/include/utils/signals.h
@@ -38,11 +38,61 @@ typedef void (*sighandler_t)(int);
#else
#include <signal.h>
#endif
+#include "appMain/low_voltage_signals_handler.h"
namespace utils {
-bool UnsibscribeFromTermination();
-bool WaitTerminationSignals(sighandler_t sig_handler);
+class Signals {
+ public:
+ /**
+ * @brief Unsubscribe thread from termination signals SIGINT and SIGTERM
+ * @return True if thread unsubscribed successfuly, otherwise false
+ */
+ static bool UnsubscribeFromTermination();
+
+ /**
+ * @brief Triggers thread to wait for termination signals SIGINT and SIGTERM
+ * @param sig_handler - handler to work with signals specidied above
+ * @return True if handler handles signals successfuly, otherwise false
+ */
+ static bool WaitTerminationSignals(sighandler_t sig_handler);
+
+ /**
+ * @brief Unsubscribe thread from low voltage signals
+ * SIGLOWVOLTAGE, SIGWAKEUP and SIGIGNOFF
+ * @return True if thread unsubscribed successfuly, otherwise false
+ */
+ static bool UnsubscribeFromLowVoltageSignals(
+ const main_namespace::LowVoltageSignalsOffset& offset_data);
+
+ /**
+ * @brief Sends signal to specified process
+ * @param signal to send
+ * @param destination process signal to be sent to
+ */
+ static void SendSignal(const int signo, const pid_t pid);
+
+ /**
+ * @brief Creates child process
+ * @return created process id or -1 in case of error
+ */
+ static pid_t Fork();
+
+ /**
+ * @brief Wait for child process to be terminated
+ * @param cpid - process to wait for termination
+ * @param status store status information in the int to which it points
+ * @param options - options for exit form function
+ * detailed options can be found here: https://linux.die.net/man/2/waitpid
+ */
+ static void WaitPid(pid_t cpid, int* status, int options);
+
+ /**
+ * @brief Exits for process
+ * @param status - exit status code
+ */
+ static void ExitProcess(const int status);
+};
} // namespace utils
diff --git a/src/components/utils/include/utils/singleton.h b/src/components/utils/include/utils/singleton.h
index b73780ee1d..54fc113aba 100644
--- a/src/components/utils/include/utils/singleton.h
+++ b/src/components/utils/include/utils/singleton.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_SINGLETON_H_
#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_SINGLETON_H_
+#include "utils/atomic.h"
#include "utils/lock.h"
#include "utils/memory_barrier.h"
-#include "utils/atomic.h"
namespace utils {
diff --git a/src/components/utils/include/utils/sqlite_wrapper/sql_database.h b/src/components/utils/include/utils/sqlite_wrapper/sql_database.h
index f68c5e215e..1bedbea01e 100644
--- a/src/components/utils/include/utils/sqlite_wrapper/sql_database.h
+++ b/src/components/utils/include/utils/sqlite_wrapper/sql_database.h
@@ -34,8 +34,8 @@
#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_SQLITE_WRAPPER_SQL_DATABASE_H_
#include <string>
-#include "utils/sqlite_wrapper/sql_error.h"
#include "utils/lock.h"
+#include "utils/sqlite_wrapper/sql_error.h"
struct sqlite3;
diff --git a/src/components/utils/include/utils/sqlite_wrapper/sql_query.h b/src/components/utils/include/utils/sqlite_wrapper/sql_query.h
index dc45be7ed1..e7fe75f9c9 100644
--- a/src/components/utils/include/utils/sqlite_wrapper/sql_query.h
+++ b/src/components/utils/include/utils/sqlite_wrapper/sql_query.h
@@ -35,8 +35,8 @@
#include <stdint.h>
#include <string>
-#include "utils/sqlite_wrapper/sql_error.h"
#include "utils/lock.h"
+#include "utils/sqlite_wrapper/sql_error.h"
struct sqlite3_stmt;
diff --git a/src/components/utils/include/utils/stl_utils.h b/src/components/utils/include/utils/stl_utils.h
index 4a4e3d2fe8..48511e6fb3 100644
--- a/src/components/utils/include/utils/stl_utils.h
+++ b/src/components/utils/include/utils/stl_utils.h
@@ -32,6 +32,7 @@
#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_STL_UTILS_H_
#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_STL_UTILS_H_
+#include <cstddef>
#include "utils/macro.h"
namespace utils {
diff --git a/src/components/utils/include/utils/system.h b/src/components/utils/include/utils/system.h
index 3b34d78526..f975f74510 100644
--- a/src/components/utils/include/utils/system.h
+++ b/src/components/utils/include/utils/system.h
@@ -91,6 +91,6 @@ class System {
std::vector<std::string> argv_;
};
-} // utils
+} // namespace utils
#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_SYSTEM_H_
diff --git a/src/components/utils/include/utils/system_time_handler.h b/src/components/utils/include/utils/system_time_handler.h
index 15b2dd0cca..2013622f30 100644
--- a/src/components/utils/include/utils/system_time_handler.h
+++ b/src/components/utils/include/utils/system_time_handler.h
@@ -50,6 +50,11 @@ class SystemTimeListener {
* @param utc_time current system time.
*/
virtual void OnSystemTimeArrived(const time_t utc_time) = 0;
+
+ /**
+ * @brief OnSystemTimeFailed Notify about system request failure
+ */
+ virtual void OnSystemTimeFailed() = 0;
};
/**
@@ -97,6 +102,12 @@ class SystemTimeHandler {
time_t GetUTCTime();
/**
+ * @brief ResetPendingSystemTimeRequests resets waiting for system time
+ * requests flag
+ */
+ virtual void ResetPendingSystemTimeRequests() = 0;
+
+ /**
* @brief Checks if system time is ready
* and can be requested by GetSystemTime request
* @return True if HMI is ready to provide UTC time
diff --git a/src/components/utils/include/utils/threads/pulse_thread_delegate.h b/src/components/utils/include/utils/threads/pulse_thread_delegate.h
index 623e12b261..ad6df6fca7 100644
--- a/src/components/utils/include/utils/threads/pulse_thread_delegate.h
+++ b/src/components/utils/include/utils/threads/pulse_thread_delegate.h
@@ -55,23 +55,23 @@ namespace threads {
class PulseThreadDelegate : public ThreadDelegate {
public:
/**
- * @brief default constructor
- */
+ * @brief default constructor
+ */
PulseThreadDelegate();
virtual void threadMain();
virtual void exitThreadMain();
protected:
/**
- * @brief This method is to be implemented to arm events of interest
- * @param event pointer to structure sigevent
- * @return If this method returns true, thread is blocked on
+ * @brief This method is to be implemented to arm events of interest
+ * @param event pointer to structure sigevent
+ * @return If this method returns true, thread is blocked on
* MsgReceivePulse() waiting for Pulse
- */
+ */
virtual bool ArmEvent(struct sigevent* event) = 0;
/**
- * @brief This method is invoked from threadMain() when Pulse comes
- */
+ * @brief This method is invoked from threadMain() when Pulse comes
+ */
virtual void OnPulse() = 0;
/**
@@ -83,9 +83,9 @@ class PulseThreadDelegate : public ThreadDelegate {
}
/**
- * Finalizes thread
- * Can free resources
- */
+ * Finalizes thread
+ * Can free resources
+ */
virtual void Finalize() {}
private:
diff --git a/src/components/utils/include/utils/threads/thread_manager.h b/src/components/utils/include/utils/threads/thread_manager.h
index 3f53c902c4..4f28d0cb15 100644
--- a/src/components/utils/include/utils/threads/thread_manager.h
+++ b/src/components/utils/include/utils/threads/thread_manager.h
@@ -37,16 +37,16 @@
#include <pthread.h>
+#include <list>
#include <map>
-#include <string>
#include <set>
-#include <list>
+#include <string>
-#include "utils/macro.h"
-#include "utils/singleton.h"
-#include "utils/lock.h"
#include "utils/conditional_variable.h"
+#include "utils/lock.h"
+#include "utils/macro.h"
#include "utils/message_queue.h"
+#include "utils/singleton.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
diff --git a/src/components/utils/include/utils/timer.h b/src/components/utils/include/utils/timer.h
index ab3d48ef6f..a47b52a030 100644
--- a/src/components/utils/include/utils/timer.h
+++ b/src/components/utils/include/utils/timer.h
@@ -32,15 +32,15 @@
#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_H_
#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_H_
-#include <string>
#include <stdint.h>
#include <memory>
+#include <string>
-#include "utils/macro.h"
#include "utils/lock.h"
-#include "utils/timer_task.h"
+#include "utils/macro.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
+#include "utils/timer_task.h"
namespace timer {
@@ -102,6 +102,8 @@ class Timer {
*/
bool is_running() const;
+ bool is_completed() const;
+
/**
* @brief Gets current timer timeout
* @return Current timeout in milliseconds.
@@ -119,7 +121,7 @@ class Timer {
* @brief Constructor
* @param timer Timer instance pointer for callback calling
*/
- TimerDelegate(const Timer* timer, sync_primitives::Lock& state_lock_ref);
+ TimerDelegate(Timer* timer, sync_primitives::Lock& state_lock_ref);
/**
* @brief Sets timer timeout
@@ -161,7 +163,7 @@ class Timer {
void exitThreadMain() OVERRIDE;
private:
- const Timer* timer_;
+ Timer* timer_;
Milliseconds timeout_;
/**
@@ -187,13 +189,13 @@ class Timer {
* Not thread-safe
* @param timeout Timer timeout
*/
- void StartDelegate(const Milliseconds timeout) const;
+ void StartDelegate(const Milliseconds timeout);
/**
* @brief Sets up timer delegate to stop state.
* Not thread-safe
*/
- void StopDelegate() const;
+ void StopDelegate();
/**
* @brief Starts timer thread.
@@ -211,14 +213,14 @@ class Timer {
* @brief Callback called on timeout.
* Not thread-safe
*/
- void OnTimeout() const;
+ void OnTimeout();
const std::string name_;
TimerTask* task_;
mutable sync_primitives::Lock state_lock_;
- mutable std::auto_ptr<TimerDelegate> delegate_;
+ std::unique_ptr<TimerDelegate> delegate_;
threads::Thread* thread_;
/**
@@ -226,6 +228,8 @@ class Timer {
*/
bool single_shot_;
+ bool completed_flag_;
+
DISALLOW_COPY_AND_ASSIGN(Timer);
};
diff --git a/src/components/utils/include/utils/timer_task_impl.h b/src/components/utils/include/utils/timer_task_impl.h
index 28618551ec..9ed6dd702d 100644
--- a/src/components/utils/include/utils/timer_task_impl.h
+++ b/src/components/utils/include/utils/timer_task_impl.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_TASK_IMPL_H_
#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_TASK_IMPL_H_
-#include "utils/timer_task.h"
#include "utils/macro.h"
+#include "utils/timer_task.h"
namespace timer {
diff --git a/src/components/utils/src/back_trace.cc b/src/components/utils/src/back_trace.cc
index c587643cc6..65f9e72070 100644
--- a/src/components/utils/src/back_trace.cc
+++ b/src/components/utils/src/back_trace.cc
@@ -33,8 +33,8 @@
#include "utils/back_trace.h"
#include <algorithm>
-#include <vector>
#include <sstream>
+#include <vector>
#include <cxxabi.h>
#include <execinfo.h>
@@ -63,7 +63,7 @@ string demangle(const char* symbol) {
}
return symbol;
}
-}
+} // namespace
Backtrace::Backtrace(int32_t count, int32_t skip_top)
: thread_id_(threads::Thread::CurrentId()) {
diff --git a/src/components/utils/src/conditional_variable_boost.cc b/src/components/utils/src/conditional_variable_boost.cc
new file mode 100644
index 0000000000..c70b727d66
--- /dev/null
+++ b/src/components/utils/src/conditional_variable_boost.cc
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "utils/conditional_variable.h"
+
+#include <errno.h>
+#include <time.h>
+
+#include <boost/exception/diagnostic_information.hpp>
+#include "utils/lock.h"
+#include "utils/logger.h"
+
+namespace {
+const long kNanosecondsPerSecond = 1000000000;
+const long kMillisecondsPerSecond = 1000;
+const long kNanosecondsPerMillisecond = 1000000;
+} // namespace
+
+namespace sync_primitives {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+
+ConditionalVariable::ConditionalVariable() {}
+
+ConditionalVariable::~ConditionalVariable() {}
+
+void ConditionalVariable::NotifyOne() {
+ cond_var_.notify_one();
+}
+
+void ConditionalVariable::Broadcast() {
+ cond_var_.notify_all();
+}
+
+bool ConditionalVariable::Wait(BaseLock& lock) {
+ // NOTE this grossness is due to boost mutex and recursive mutex not sharing a
+ // superclass
+ try {
+ lock.AssertTakenAndMarkFree();
+ // What kind of lock are we ?
+ if (Lock* test_lock = dynamic_cast<Lock*>(&lock)) {
+ // Regular lock
+ cond_var_.wait<boost::mutex>(test_lock->mutex_);
+ } else if (RecursiveLock* test_rec_lock =
+ dynamic_cast<RecursiveLock*>(&lock)) {
+ // Recursive lock
+ cond_var_.wait<boost::recursive_mutex>(test_rec_lock->mutex_);
+ } else {
+ // unknown, give up the lock
+ LOG4CXX_ERROR(logger_, "Unknown lock type!");
+ NOTREACHED();
+ }
+ lock.AssertFreeAndMarkTaken();
+ } catch (const boost::exception& error) {
+ std::string error_string = boost::diagnostic_information(error);
+ LOG4CXX_FATAL(logger_, error_string);
+ NOTREACHED();
+ }
+ return true;
+}
+
+bool ConditionalVariable::Wait(AutoLock& auto_lock) {
+ BaseLock& lock = auto_lock.GetLock();
+ return Wait(lock);
+}
+
+ConditionalVariable::WaitStatus ConditionalVariable::WaitFor(
+ AutoLock& auto_lock, uint32_t milliseconds) {
+ BaseLock& lock = auto_lock.GetLock();
+
+ WaitStatus wait_status = kNoTimeout;
+ try {
+ lock.AssertTakenAndMarkFree();
+ bool timeout = true;
+
+ // What kind of lock are we ?
+ if (Lock* test_lock = dynamic_cast<Lock*>(&lock)) {
+ // Regular lock
+ // cond_var_.wait<boost::mutex>(test_lock->mutex_);
+ timeout = cond_var_.timed_wait<boost::mutex>(
+ test_lock->mutex_, boost::posix_time::milliseconds(milliseconds));
+ } else if (RecursiveLock* test_rec_lock =
+ dynamic_cast<RecursiveLock*>(&lock)) {
+ // Recursive lock
+ // cond_var_.wait<boost::recursive_mutex>(test_rec_lock->mutex_);
+ timeout = cond_var_.timed_wait<boost::recursive_mutex>(
+ test_rec_lock->mutex_, boost::posix_time::milliseconds(milliseconds));
+ } else {
+ // this is an unknown lock, we have an issue
+ LOG4CXX_ERROR(logger_, "Unknown lock type!");
+ NOTREACHED();
+ }
+
+ if (!timeout) {
+ wait_status = kTimeout;
+ }
+ lock.AssertFreeAndMarkTaken();
+ } catch (const boost::exception& error) {
+ std::string error_string = boost::diagnostic_information(error);
+ LOG4CXX_FATAL(logger_, error_string);
+ NOTREACHED();
+ }
+
+ return wait_status;
+}
+
+} // namespace sync_primitives
diff --git a/src/components/utils/src/conditional_variable_posix.cc b/src/components/utils/src/conditional_variable_posix.cc
deleted file mode 100644
index 50ebc74556..0000000000
--- a/src/components/utils/src/conditional_variable_posix.cc
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#include "utils/conditional_variable.h"
-
-#include <errno.h>
-#include <time.h>
-
-#include "utils/lock.h"
-#include "utils/logger.h"
-
-namespace {
-const long kNanosecondsPerSecond = 1000000000;
-const long kMillisecondsPerSecond = 1000;
-const long kNanosecondsPerMillisecond = 1000000;
-}
-
-namespace sync_primitives {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
-
-ConditionalVariable::ConditionalVariable() {
- pthread_condattr_t attrs;
- int initialized = pthread_condattr_init(&attrs);
- if (initialized != 0)
- LOG4CXX_ERROR(logger_,
- "Failed to initialize "
- "conditional variable attributes");
- pthread_condattr_setclock(&attrs, CLOCK_MONOTONIC);
- initialized = pthread_cond_init(&cond_var_, &attrs);
- if (initialized != 0)
- LOG4CXX_ERROR(logger_,
- "Failed to initialize "
- "conditional variable");
- int rv = pthread_condattr_destroy(&attrs);
- if (rv != 0)
- LOG4CXX_ERROR(logger_,
- "Failed to destroy "
- "conditional variable attributes");
-}
-
-ConditionalVariable::~ConditionalVariable() {
- pthread_cond_destroy(&cond_var_);
-}
-
-void ConditionalVariable::NotifyOne() {
- int signaled = pthread_cond_signal(&cond_var_);
- if (signaled != 0)
- LOG4CXX_ERROR(logger_, "Failed to signal conditional variable");
-}
-
-void ConditionalVariable::Broadcast() {
- int signaled = pthread_cond_broadcast(&cond_var_);
- if (signaled != 0)
- LOG4CXX_ERROR(logger_, "Failed to broadcast conditional variable");
-}
-
-bool ConditionalVariable::Wait(Lock& lock) {
- lock.AssertTakenAndMarkFree();
- int wait_status = pthread_cond_wait(&cond_var_, &lock.mutex_);
- lock.AssertFreeAndMarkTaken();
- if (wait_status != 0) {
- LOG4CXX_ERROR(logger_, "Failed to wait for conditional variable");
- return false;
- }
- return true;
-}
-
-bool ConditionalVariable::Wait(AutoLock& auto_lock) {
- Lock& lock = auto_lock.GetLock();
- lock.AssertTakenAndMarkFree();
- int wait_status = pthread_cond_wait(&cond_var_, &lock.mutex_);
- lock.AssertFreeAndMarkTaken();
- if (wait_status != 0) {
- LOG4CXX_ERROR(logger_, "Failed to wait for conditional variable");
- return false;
- }
- return true;
-}
-
-ConditionalVariable::WaitStatus ConditionalVariable::WaitFor(
- AutoLock& auto_lock, uint32_t milliseconds) {
- struct timespec now;
- clock_gettime(CLOCK_MONOTONIC, &now);
- timespec wait_interval;
- wait_interval.tv_sec = now.tv_sec + (milliseconds / kMillisecondsPerSecond);
- wait_interval.tv_nsec =
- now.tv_nsec +
- (milliseconds % kMillisecondsPerSecond) * kNanosecondsPerMillisecond;
- wait_interval.tv_sec += wait_interval.tv_nsec / kNanosecondsPerSecond;
- wait_interval.tv_nsec %= kNanosecondsPerSecond;
- Lock& lock = auto_lock.GetLock();
- lock.AssertTakenAndMarkFree();
- int timedwait_status =
- pthread_cond_timedwait(&cond_var_, &lock.mutex_, &wait_interval);
- lock.AssertFreeAndMarkTaken();
- WaitStatus wait_status = kNoTimeout;
- switch (timedwait_status) {
- case 0: {
- wait_status = kNoTimeout;
- break;
- }
- case EINTR: {
- wait_status = kNoTimeout;
- break;
- }
- case ETIMEDOUT: {
- wait_status = kTimeout;
- break;
- }
- default: {
- LOG4CXX_ERROR(
- logger_,
- "Failed to timewait for conditional variable timedwait_status: "
- << timedwait_status);
- }
- }
- return wait_status;
-}
-
-} // namespace sync_primitives
diff --git a/src/components/utils/src/convert_utils.cc b/src/components/utils/src/convert_utils.cc
index 319b231a96..9d90318731 100644
--- a/src/components/utils/src/convert_utils.cc
+++ b/src/components/utils/src/convert_utils.cc
@@ -32,8 +32,8 @@
#include "utils/convert_utils.h"
#include <stdint.h>
-#include <limits>
#include <algorithm>
+#include <limits>
#include "utils/macro.h"
long long int utils::ConvertInt64ToLongLongInt(const int64_t value) {
diff --git a/src/components/utils/src/custom_string.cc b/src/components/utils/src/custom_string.cc
index 8254a98180..7bbe5f2da8 100644
--- a/src/components/utils/src/custom_string.cc
+++ b/src/components/utils/src/custom_string.cc
@@ -31,14 +31,14 @@
*/
#include "utils/custom_string.h"
-#include <cwchar>
-#include <cstdlib>
+#include <string.h>
+#include <algorithm>
#include <clocale>
+#include <cstdlib>
+#include <cwchar>
#include <cwctype>
#include <new>
-#include <algorithm>
#include <vector>
-#include <string.h>
#include "utils/logger.h"
#include "utils/macro.h"
@@ -76,7 +76,7 @@ void ConvertWStringToLowerCase(std::wstring& str) {
std::transform(str.begin(), str.end(), str.begin(), towlower);
setlocale(LC_ALL, current_locale.c_str());
}
-}
+} // namespace
namespace utils {
namespace custom_string {
diff --git a/src/components/utils/src/date_time.cc b/src/components/utils/src/date_time.cc
index fdf0926eb2..cea35a977e 100644
--- a/src/components/utils/src/date_time.cc
+++ b/src/components/utils/src/date_time.cc
@@ -30,94 +30,71 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/time.h>
-#include <stdint.h>
#include "utils/date_time.h"
-namespace date_time {
+#include <stdint.h>
+#include <sys/time.h>
+#include "boost/date_time/posix_time/posix_time.hpp"
-TimevalStruct DateTime::getCurrentTime() {
- TimevalStruct currentTime;
- timezone timeZone;
+namespace bpt = boost::posix_time;
+using namespace boost::date_time;
+namespace date_time {
- gettimeofday(&currentTime, &timeZone);
+/* Set of helper functions for the TimeDuration struct
+ */
- return currentTime;
+TimeDuration getCurrentTime() {
+ return bpt::microsec_clock::local_time() - bpt::from_time_t(0);
+}
+TimeDuration TimeDurationZero() {
+ return TimeDuration(0, 0, 0, 0);
+}
+int64_t getSecs(const TimeDuration& t) {
+ return t.total_seconds();
}
-int64_t date_time::DateTime::getSecs(const TimevalStruct& time) {
- const TimevalStruct times = ConvertionUsecs(time);
- return static_cast<int64_t>(times.tv_sec);
+int64_t getmSecs(const TimeDuration& t) {
+ return t.total_milliseconds();
}
-int64_t DateTime::getmSecs(const TimevalStruct& time) {
- const TimevalStruct times = ConvertionUsecs(time);
- return static_cast<int64_t>(times.tv_sec) * MILLISECONDS_IN_SECOND +
- times.tv_usec / MICROSECONDS_IN_MILLISECOND;
+int64_t getuSecs(const TimeDuration& t) {
+ return t.total_microseconds();
}
-int64_t DateTime::getuSecs(const TimevalStruct& time) {
- const TimevalStruct times = ConvertionUsecs(time);
- return static_cast<int64_t>(times.tv_sec) * MILLISECONDS_IN_SECOND *
- MICROSECONDS_IN_MILLISECOND +
- times.tv_usec;
+int64_t get_just_mSecs(const TimeDuration& t) {
+ return t.total_milliseconds() % MILLISECONDS_IN_SECOND;
}
-int64_t DateTime::calculateTimeSpan(const TimevalStruct& sinceTime) {
- return calculateTimeDiff(getCurrentTime(), sinceTime);
+int64_t get_just_uSecs(const TimeDuration& t) {
+ return t.total_microseconds() % MICROSECONDS_IN_SECOND;
}
-int64_t DateTime::calculateTimeDiff(const TimevalStruct& time1,
- const TimevalStruct& time2) {
- const TimevalStruct times1 = ConvertionUsecs(time1);
- const TimevalStruct times2 = ConvertionUsecs(time2);
- TimevalStruct ret;
- if (Greater(times1, times2)) {
- ret = Sub(times1, times2);
- } else {
- ret = Sub(times2, times1);
- }
- return getmSecs(ret);
+int64_t calculateTimeSpan(const TimeDuration& sinceTime) {
+ return calculateTimeDiff(getCurrentTime(), sinceTime);
}
-void DateTime::AddMilliseconds(TimevalStruct& time, uint32_t milliseconds) {
- const uint32_t sec = milliseconds / MILLISECONDS_IN_SECOND;
- const uint32_t usec =
- (milliseconds % MILLISECONDS_IN_SECOND) * MICROSECONDS_IN_MILLISECOND;
- time.tv_sec += sec;
- time.tv_usec += usec;
- time = ConvertionUsecs(time);
+int64_t calculateTimeDiff(const TimeDuration& time1,
+ const TimeDuration& time2) {
+ return std::abs((time1 + -time2).total_milliseconds());
}
-TimevalStruct DateTime::Sub(const TimevalStruct& time1,
- const TimevalStruct& time2) {
- const TimevalStruct times1 = ConvertionUsecs(time1);
- const TimevalStruct times2 = ConvertionUsecs(time2);
- TimevalStruct ret;
- timersub(&times1, &times2, &ret);
- return ret;
+void AddMilliseconds(TimeDuration& t, uint32_t milliseconds) {
+ t += bpt::milliseconds(milliseconds);
}
-bool DateTime::Greater(const TimevalStruct& time1, const TimevalStruct& time2) {
- const TimevalStruct times1 = ConvertionUsecs(time1);
- const TimevalStruct times2 = ConvertionUsecs(time2);
- return timercmp(&times1, &times2, > );
+bool Greater(const TimeDuration& time1, const TimeDuration& time2) {
+ return time1 > time2;
}
-bool DateTime::Less(const TimevalStruct& time1, const TimevalStruct& time2) {
- const TimevalStruct times1 = ConvertionUsecs(time1);
- const TimevalStruct times2 = ConvertionUsecs(time2);
- return timercmp(&times1, &times2, < );
+bool Less(const TimeDuration& time1, const TimeDuration& time2) {
+ return time1 < time2;
}
-bool DateTime::Equal(const TimevalStruct& time1, const TimevalStruct& time2) {
- const TimevalStruct times1 = ConvertionUsecs(time1);
- const TimevalStruct times2 = ConvertionUsecs(time2);
- return !timercmp(&times1, &times2, != );
+bool Equal(const TimeDuration& time1, const TimeDuration& time2) {
+ return time1 == time2;
}
-TimeCompare date_time::DateTime::compareTime(const TimevalStruct& time1,
- const TimevalStruct& time2) {
+TimeCompare compareTime(const TimeDuration& time1, const TimeDuration& time2) {
if (Greater(time1, time2))
return GREATER;
if (Less(time1, time2))
@@ -125,28 +102,17 @@ TimeCompare date_time::DateTime::compareTime(const TimevalStruct& time1,
return EQUAL;
}
-TimevalStruct date_time::DateTime::ConvertionUsecs(const TimevalStruct& time) {
- if (time.tv_usec >= MICROSECONDS_IN_SECOND) {
- TimevalStruct time1;
- time1.tv_sec = static_cast<int64_t>(time.tv_sec) +
- (time.tv_usec / MICROSECONDS_IN_SECOND);
- time1.tv_usec = static_cast<int64_t>(time.tv_usec) % MICROSECONDS_IN_SECOND;
- return time1;
- }
- return time;
-}
+int64_t calculateAmountDaysFromDate(const std::time_t& start_date) {
+ const time_t current_date = std::time(NULL);
-} // namespace date_time
+ // std::difftime returns difference between two timepoints in seconds
+ const uint32_t diff_consent_and_current_dates = (static_cast<uint32_t>(
+ std::fabs(std::difftime(current_date, start_date))));
-bool operator<(const TimevalStruct& time1, const TimevalStruct& time2) {
- return date_time::DateTime::Less(time1, time2);
-}
+ const uint32_t past_period_in_days =
+ diff_consent_and_current_dates / date_time::SECONDS_IN_DAY;
-bool operator==(const TimevalStruct& time1, const TimevalStruct& time2) {
- return date_time::DateTime::Equal(time1, time2);
+ return past_period_in_days;
}
-const TimevalStruct operator-(const TimevalStruct& time1,
- const TimevalStruct& time2) {
- return date_time::DateTime::Sub(time1, time2);
-}
+} // namespace date_time
diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc
index 62a090550d..015dc25a22 100644
--- a/src/components/utils/src/file_system.cc
+++ b/src/components/utils/src/file_system.cc
@@ -33,127 +33,176 @@
#include "utils/file_system.h"
#include "utils/logger.h"
-#include <sys/statvfs.h>
#include <sys/stat.h>
+#include <sys/statvfs.h>
#include <sys/types.h>
#include <sstream>
#include <dirent.h>
#include <unistd.h>
// TODO(VS): lint error: Streams are highly discouraged.
-#include <fstream>
+#include <algorithm>
+#include <boost/filesystem.hpp>
#include <cstddef>
#include <cstdio>
-#include <algorithm>
+#include <fstream>
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "Utils::FileSystem")
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+// Easier reference
+namespace fs = boost::filesystem;
+using boost::system::error_code;
uint64_t file_system::GetAvailableDiskSpace(const std::string& path) {
- struct statvfs fsInfo = {0};
- if (statvfs(path.c_str(), &fsInfo) == 0) {
- return fsInfo.f_bsize * fsInfo.f_bfree;
- } else {
- return 0;
+ LOG4CXX_AUTO_TRACE(logger_);
+ error_code ec;
+ fs::space_info si = {0, 0, 0};
+ si = fs::space(path, ec);
+
+ if (ec) {
+ // If something went wrong, assume no free space
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Unable to get available disk space: '"
+ << path << "', reason: " << ec.message());
}
+ return si.free;
}
-int64_t file_system::FileSize(const std::string& path) {
- if (file_system::FileExists(path)) {
- struct stat file_info = {0};
- if (0 != stat(path.c_str(), &file_info)) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "Could not get file size: " << path);
- } else {
- return file_info.st_size;
- }
+uint64_t file_system::FileSize(const std::string& path) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ error_code ec;
+ // Boost returns sizes as unsigned
+ const uint64_t fsize = static_cast<uint64_t>(fs::file_size(path, ec));
+
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(
+ logger_,
+ "Unable to get file size: '" << path << "', reason: " << ec.message());
+ return 0;
}
- return 0;
+ return fsize;
}
size_t file_system::DirectorySize(const std::string& path) {
- size_t size = 0;
- DIR* directory = NULL;
-
- struct dirent* result = NULL;
- struct stat file_info = {0};
- directory = opendir(path.c_str());
- if (NULL != directory) {
- result = readdir(directory);
- for (; NULL != result; result = readdir(directory)) {
- if (0 == strcmp(result->d_name, "..") ||
- 0 == strcmp(result->d_name, ".")) {
- continue;
- }
- std::string full_element_path = path + "/" + result->d_name;
- if (file_system::IsDirectory(full_element_path)) {
- size += DirectorySize(full_element_path);
+ LOG4CXX_AUTO_TRACE(logger_);
+ size_t dir_size = 0;
+ error_code ec;
+ // Recursively iterate through directory to accumulate file sizes
+ fs::recursive_directory_iterator iter(path, ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Unable to get directory size: '"
+ << path << "', reason: " << ec.message());
+ return 0;
+ }
+
+ // default constructor gives end iterator
+ fs::recursive_directory_iterator end;
+ while (end != iter) {
+ const bool is_directory = fs::is_directory(iter->path(), ec);
+ if (ec) {
+ LOG4CXX_WARN_WITH_ERRNO(
+ logger_,
+ "Failed check if '" << iter->path()
+ << "' is directory, reason: " << ec.message());
+ }
+
+ if (!is_directory && !ec) {
+ const size_t fsize = fs::file_size(iter->path(), ec);
+ if (ec) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_,
+ "Failed to get file_size: '"
+ << path << "', reason: " << ec.message());
} else {
- stat(full_element_path.c_str(), &file_info);
- size += file_info.st_size;
+ // No error means we can add the file
+ dir_size += fsize;
+ LOG4CXX_DEBUG(logger_, "Adding: " << fsize << ", total: " << dir_size);
}
}
- }
- closedir(directory);
- return size;
-}
-std::string file_system::CreateDirectory(const std::string& name) {
- if (!DirectoryExists(name)) {
- if (0 != mkdir(name.c_str(), S_IRWXU)) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "Unable to create directory: " << name);
+ // Increment the iterator to point to next entry in recursive iteration
+ iter.increment(ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Failed to increment iterator for path '"
+ << path << "', reason: " << ec.message());
+ return dir_size;
}
}
- return name;
+ return dir_size;
}
-bool file_system::CreateDirectoryRecursively(const std::string& path) {
- size_t pos = 0;
- bool ret_val = true;
-
- while (ret_val == true && pos <= path.length()) {
- pos = path.find('/', pos + 1);
- if (!DirectoryExists(path.substr(0, pos))) {
- if (0 != mkdir(path.substr(0, pos).c_str(), S_IRWXU)) {
- ret_val = false;
- }
- }
+// NOTE that boost makes 0777 permissions by default
+bool file_system::CreateDirectory(const std::string& name) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ error_code ec;
+ const bool success = fs::create_directory(name, ec);
+ if (!success || ec) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_, "Unable to create directory: " << name);
+ } else {
+ // Set 0700 permissions to maintain previous API
+ fs::permissions(name, fs::perms::owner_all, ec);
}
-
- return ret_val;
+ return success;
}
-bool file_system::IsDirectory(const std::string& name) {
- struct stat status = {0};
+bool file_system::CreateDirectoryRecursively(const std::string& path) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ error_code ec;
+ // Create directory and all parents
+ fs::create_directories(path, ec);
+
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Unable to create directory recursively: '"
+ << path << "', reason: " << ec.message());
- if (-1 == stat(name.c_str(), &status)) {
return false;
}
-
- return S_ISDIR(status.st_mode);
+ // return true if we made something or if it already existed
+ return true;
}
-bool file_system::DirectoryExists(const std::string& name) {
- struct stat status = {0};
-
- if (-1 == stat(name.c_str(), &status) || !S_ISDIR(status.st_mode)) {
- return false;
+bool file_system::IsDirectory(const std::string& name) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ error_code ec;
+ const bool is_directory = fs::is_directory(name, ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Unable to check if it is directory: "
+ << name << " reason: " << ec.message());
}
+ return is_directory;
+}
- return true;
+// NOTE this may be a duplicate of IsDirectory since it already checks
+// existence
+bool file_system::DirectoryExists(const std::string& name) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const bool exists = FileExists(name) && IsDirectory(name);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Directory '" << name << "' " << (exists ? "exists" : "NOT exists"));
+ return exists;
}
bool file_system::FileExists(const std::string& name) {
- struct stat status = {0};
-
- if (-1 == stat(name.c_str(), &status)) {
- return false;
+ LOG4CXX_AUTO_TRACE(logger_);
+ error_code ec;
+ const bool exists = fs::exists(name, ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Unable to check that file exists: "
+ << name << " reason: " << ec.message());
}
- return true;
+ return exists;
}
bool file_system::Write(const std::string& file_name,
const std::vector<uint8_t>& data,
std::ios_base::openmode mode) {
+ LOG4CXX_AUTO_TRACE(logger_);
std::ofstream file(file_name.c_str(), std::ios_base::binary | mode);
if (file.is_open()) {
for (uint32_t i = 0; i < data.size(); ++i) {
@@ -167,6 +216,7 @@ bool file_system::Write(const std::string& file_name,
std::ofstream* file_system::Open(const std::string& file_name,
std::ios_base::openmode mode) {
+ LOG4CXX_AUTO_TRACE(logger_);
std::ofstream* file = new std::ofstream();
file->open(file_name.c_str(), std::ios_base::binary | mode);
if (file->is_open()) {
@@ -174,12 +224,13 @@ std::ofstream* file_system::Open(const std::string& file_name,
}
delete file;
- return NULL;
+ return nullptr;
}
bool file_system::Write(std::ofstream* const file_stream,
const uint8_t* data,
uint32_t data_size) {
+ LOG4CXX_AUTO_TRACE(logger_);
bool result = false;
if (file_stream) {
for (size_t i = 0; i < data_size; ++i) {
@@ -191,123 +242,173 @@ bool file_system::Write(std::ofstream* const file_stream,
}
void file_system::Close(std::ofstream* file_stream) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (file_stream) {
file_stream->close();
}
}
std::string file_system::CurrentWorkingDirectory() {
- const size_t filename_max_length = 1024;
- char path[filename_max_length];
- if (0 == getcwd(path, filename_max_length)) {
- LOG4CXX_WARN(logger_, "Could not get CWD");
+ LOG4CXX_AUTO_TRACE(logger_);
+ error_code ec;
+ const fs::path currpath = fs::current_path(ec);
+ if (ec) {
+ LOG4CXX_WARN_WITH_ERRNO(logger_,
+ "Unable to get current working directory: '"
+ << currpath << "' reason: " << ec.message());
}
- return std::string(path);
+ return currpath.string();
}
std::string file_system::GetAbsolutePath(const std::string& path) {
- char abs_path[PATH_MAX];
- if (NULL == realpath(path.c_str(), abs_path)) {
- return std::string();
+ LOG4CXX_AUTO_TRACE(logger_);
+ error_code ec;
+ const fs::path absolute = fs::canonical(path, ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Unable to get absolute path: '"
+ << path << "', reason: " << ec.message());
+ return std::string(); // invalid path
}
-
- return std::string(abs_path);
+ return absolute.string();
}
bool file_system::IsFileNameValid(const std::string& file_name) {
+ LOG4CXX_AUTO_TRACE(logger_);
return file_name.end() == std::find(file_name.begin(), file_name.end(), '/');
}
+// Does not remove if file is write-protected
bool file_system::DeleteFile(const std::string& name) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (FileExists(name) && IsAccessible(name, W_OK)) {
- return !remove(name.c_str());
+ error_code ec;
+ const bool success = fs::remove(name.c_str(), ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Unable to delete file: '"
+ << name << "', reason: " << ec.message()
+ << "success: " << success);
+ }
+
+ return success && !ec;
}
+ LOG4CXX_WARN(
+ logger_,
+ "Unable to delete file either doesn't exist or is not accessible");
return false;
}
void file_system::remove_directory_content(const std::string& directory_name) {
- DIR* directory = NULL;
- struct dirent* result = NULL;
-
- directory = opendir(directory_name.c_str());
-
- if (NULL != directory) {
- result = readdir(directory);
-
- for (; NULL != result; result = readdir(directory)) {
- if (0 == strcmp(result->d_name, "..") ||
- 0 == strcmp(result->d_name, ".")) {
- continue;
- }
-
- std::string full_element_path = directory_name + "/" + result->d_name;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ error_code ec;
+ fs::directory_iterator dir_iter(directory_name, ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(
+ logger_,
+ "Unable to remove directory contents: " << directory_name
+ << " reason: " << ec.message());
+ }
- if (file_system::IsDirectory(full_element_path)) {
- remove_directory_content(full_element_path);
- rmdir(full_element_path.c_str());
- } else {
- if (0 != remove(full_element_path.c_str())) {
- LOG4CXX_WARN_WITH_ERRNO(
- logger_, "Unable to remove file: " << full_element_path);
- }
- }
+ // According to Boost's documentation, removing shouldn't invalidate the
+ // iterator, although it may cause the removed entry to appear again,
+ // duplicating the warning message. See here:
+ // https://www.boost.org/doc/libs/1_67_0/libs/filesystem/doc/reference.html#Class-directory_iterator
+ const fs::directory_iterator end;
+ while (dir_iter != end) {
+ fs::remove_all(dir_iter->path(), ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(
+ logger_,
+ "Unable to remove file: " << dir_iter->path().string() << " reason "
+ << ec.message());
+ }
+ dir_iter.increment(ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(
+ logger_, "Unable to increment dir_iter: reason " << ec.message());
+ break;
}
}
-
- closedir(directory);
}
bool file_system::RemoveDirectory(const std::string& directory_name,
- bool is_recursively) {
- if (DirectoryExists(directory_name) && IsAccessible(directory_name, W_OK)) {
- if (is_recursively) {
- remove_directory_content(directory_name);
+ const bool is_recursively) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ // Make sure the directory exists
+ if (!DirectoryExists(directory_name) && IsAccessible(directory_name, W_OK)) {
+ LOG4CXX_WARN(
+ logger_,
+ "Unable to remove directory either doesn't exist or is not accessible");
+ return false;
+ }
+ error_code ec;
+ bool success;
+ // If recursive, just force full remove
+ if (is_recursively) {
+ success = (fs::remove_all(directory_name, ec) != 0);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Unable to remove all: '" << directory_name
+ << "', reason "
+ << ec.message());
+ }
+ } else {
+ // Otherwise try to remove
+ success = fs::remove(directory_name, ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Unable to remove: '" << directory_name
+ << "', reason "
+ << ec.message());
}
-
- return !rmdir(directory_name.c_str());
}
- return false;
+ return success && !ec;
}
-bool file_system::IsAccessible(const std::string& name, int32_t how) {
+bool file_system::IsAccessible(const std::string& name, const int32_t how) {
+ LOG4CXX_AUTO_TRACE(logger_);
return !access(name.c_str(), how);
}
bool file_system::IsWritingAllowed(const std::string& name) {
+ LOG4CXX_AUTO_TRACE(logger_);
return IsAccessible(name, W_OK);
}
bool file_system::IsReadingAllowed(const std::string& name) {
+ LOG4CXX_AUTO_TRACE(logger_);
return IsAccessible(name, R_OK);
}
std::vector<std::string> file_system::ListFiles(
const std::string& directory_name) {
- std::vector<std::string> listFiles;
- if (!DirectoryExists(directory_name)) {
- return listFiles;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ error_code ec;
+ fs::directory_iterator iter(directory_name, ec), end;
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(
+ logger_,
+ "Unable to get directory_iterator: " << directory_name << " reason "
+ << ec.message());
+ return std::vector<std::string>();
}
- DIR* directory = NULL;
- struct dirent* result = NULL;
-
- directory = opendir(directory_name.c_str());
- if (NULL != directory) {
- result = readdir(directory);
-
- for (; NULL != result; result = readdir(directory)) {
- if (0 == strcmp(result->d_name, "..") ||
- 0 == strcmp(result->d_name, ".")) {
- continue;
- }
-
- listFiles.push_back(std::string(result->d_name));
+ std::vector<std::string> list_files;
+ while (end != iter) {
+ list_files.push_back(iter->path().filename().string());
+ iter.increment(ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Failed to increment iterator for path '"
+ << directory_name
+ << "', reason: " << ec.message());
+ return list_files;
}
-
- closedir(directory);
}
-
- return listFiles;
+ return list_files;
}
bool file_system::WriteBinaryFile(const std::string& name,
@@ -321,14 +422,43 @@ bool file_system::WriteBinaryFile(const std::string& name,
bool file_system::ReadBinaryFile(const std::string& name,
std::vector<uint8_t>& result) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Filename: " << name);
if (!FileExists(name) || !IsAccessible(name, R_OK)) {
+ LOG4CXX_ERROR(logger_, "Not able to read binary file: " << name);
+ return false;
+ }
+
+ std::ifstream file(name.c_str(), std::ios::in | std::ios_base::binary);
+ if (!file.is_open()) {
+ return false;
+ }
+
+ std::vector<uint8_t> content((std::istreambuf_iterator<char>(file)),
+ std::istreambuf_iterator<char>());
+ result.swap(content);
+
+ return true;
+}
+
+bool file_system::ReadBinaryFile(const std::string& name,
+ std::vector<uint8_t>& result,
+ uint32_t offset,
+ uint32_t length) {
+ if (!FileExists(name) || !IsAccessible(name, R_OK)) {
+ LOG4CXX_ERROR(logger_, "Not able to read binary file: " << name);
return false;
}
std::ifstream file(name.c_str(), std::ios_base::binary);
- std::ostringstream ss;
- ss << file.rdbuf();
- const std::string s = ss.str();
+ if (!file.is_open()) {
+ return false;
+ }
+
+ file.ignore(offset);
+ std::string s;
+ s.resize(length);
+ file.read(&s[0], length);
result.resize(s.length());
std::copy(s.begin(), s.end(), result.begin());
@@ -336,11 +466,16 @@ bool file_system::ReadBinaryFile(const std::string& name,
}
bool file_system::ReadFile(const std::string& name, std::string& result) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!FileExists(name) || !IsAccessible(name, R_OK)) {
+ LOG4CXX_ERROR(logger_, "Not able to read file: " << name);
return false;
}
-
std::ifstream file(name.c_str());
+ if (!file) {
+ LOG4CXX_ERROR(logger_, "Not able to open binary file: " << name);
+ return false;
+ }
std::ostringstream ss;
ss << file.rdbuf();
result = ss.str();
@@ -348,78 +483,92 @@ bool file_system::ReadFile(const std::string& name, std::string& result) {
}
const std::string file_system::ConvertPathForURL(const std::string& path) {
- std::string::const_iterator it_path = path.begin();
- std::string::const_iterator it_path_end = path.end();
-
+ LOG4CXX_AUTO_TRACE(logger_);
const std::string reserved_symbols = "!#$&'()*+,:;=?@[] ";
size_t pos = std::string::npos;
std::string converted_path;
- for (; it_path != it_path_end; ++it_path) {
- pos = reserved_symbols.find_first_of(*it_path);
+ for (const auto symbol : path) {
+ pos = reserved_symbols.find_first_of(symbol);
if (pos != std::string::npos) {
const size_t size = 100;
char percent_value[size];
- snprintf(percent_value, size, "%%%x", *it_path);
+ snprintf(percent_value, size, "%%%x", symbol);
converted_path += percent_value;
} else {
- converted_path += *it_path;
+ converted_path += symbol;
}
}
return converted_path;
}
bool file_system::CreateFile(const std::string& path) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
std::ofstream file(path);
if (!(file.is_open())) {
+ LOG4CXX_WARN(logger_, "failed to create file: " << path);
return false;
- } else {
- file.close();
- return true;
}
+ file.close();
+ return true;
}
-uint64_t file_system::GetFileModificationTime(const std::string& path) {
- struct stat info;
- if (0 != stat(path.c_str(), &info)) {
- LOG4CXX_WARN_WITH_ERRNO(logger_, "Could not get file mod time: " << path);
+time_t file_system::GetFileModificationTime(const std::string& path) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ error_code ec;
+ std::time_t time = fs::last_write_time(path, ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(logger_,
+ "Unable to get file modification time: "
+ << path << " reason " << ec.message());
+
+ return 0;
}
- return static_cast<uint64_t>(info.st_mtim.tv_nsec);
+ return time;
}
bool file_system::CopyFile(const std::string& src, const std::string& dst) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!FileExists(src) || FileExists(dst) || !CreateFile(dst)) {
+ LOG4CXX_WARN(
+ logger_,
+ "Failed to copy file from: '" << src << "', to: '" << dst << "'");
return false;
}
- std::vector<uint8_t> data;
- if (!ReadBinaryFile(src, data) || !WriteBinaryFile(dst, data)) {
- DeleteFile(dst);
+ error_code ec;
+ fs::copy_file(src, dst, ec);
+ if (ec) {
+ LOG4CXX_ERROR_WITH_ERRNO(
+ logger_,
+ "Unable to copy file: '" << src << "', reason: " << ec.message());
+ // something failed
return false;
}
return true;
}
bool file_system::MoveFile(const std::string& src, const std::string& dst) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
if (std::rename(src.c_str(), dst.c_str()) == 0) {
return true;
- } else {
- // In case of src and dst on different file systems std::rename returns
- // an error (at least on QNX).
- // Seems, streams are not recommended for use, so have
- // to find another way to do this.
- std::ifstream s_src(src, std::ios::binary);
- if (!s_src.good()) {
- return false;
- }
- std::ofstream s_dst(dst, std::ios::binary);
- if (!s_dst.good()) {
- return false;
- }
- s_dst << s_src.rdbuf();
- s_dst.close();
- s_src.close();
- DeleteFile(src);
- return true;
}
- return false;
+ // In case of src and dst on different file systems std::rename returns
+ // an error (at least on QNX).
+ // Instead, copy the file over and delete the old one
+ bool success = CopyFile(src, dst);
+ if (!success) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Failed to copy file from: '" << src << "', to: '" << dst << "'");
+ return false;
+ }
+ success = DeleteFile(src);
+ if (!success) {
+ LOG4CXX_ERROR(logger_, "Failed to delete file '" << src << "'");
+ return false;
+ }
+ return true;
}
diff --git a/src/components/utils/src/gen_hash.cc b/src/components/utils/src/gen_hash.cc
index a43b8feb03..0b85798b00 100644
--- a/src/components/utils/src/gen_hash.cc
+++ b/src/components/utils/src/gen_hash.cc
@@ -32,8 +32,8 @@
#include "utils/gen_hash.h"
#include <cstdlib>
-#include <string>
#include <locale>
+#include <string>
#include "utils/custom_string.h"
namespace utils {
diff --git a/src/components/utils/src/jsoncpp_reader_wrapper.cc b/src/components/utils/src/jsoncpp_reader_wrapper.cc
new file mode 100644
index 0000000000..69da386eed
--- /dev/null
+++ b/src/components/utils/src/jsoncpp_reader_wrapper.cc
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "utils/jsoncpp_reader_wrapper.h"
+#include "utils/logger.h"
+
+namespace utils {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "JsoncppReaderWrapper")
+
+JsonReader::JsonReader() {
+ reader_ = std::unique_ptr<Json::CharReader>(reader_builder_.newCharReader());
+}
+
+bool JsonReader::parse(const std::string& json, Json::Value* root) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ JSONCPP_STRING err;
+ bool is_parsing_ok = false;
+ const size_t json_len = json.length();
+ try {
+ is_parsing_ok =
+ reader_->parse(json.c_str(), json.c_str() + json_len, root, &err);
+ } catch (Json::RuntimeError& e) {
+ LOG4CXX_DEBUG(logger_, "Exception caught during parse json: " << e.what());
+ return false;
+ }
+
+ if (!is_parsing_ok) {
+ LOG4CXX_ERROR(logger_, "Json parsing fails: " << err);
+ }
+ return is_parsing_ok;
+}
+} // namespace utils
diff --git a/src/components/utils/src/lock_posix.cc b/src/components/utils/src/lock_boost.cc
index e5e6d7fad0..2299bcf77d 100644
--- a/src/components/utils/src/lock_posix.cc
+++ b/src/components/utils/src/lock_boost.cc
@@ -30,94 +30,51 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "utils/lock.h"
#include <errno.h>
#include <stdint.h>
-#include <stdio.h>
#include <string.h>
#include <cstring>
+#include "utils/lock.h"
#include "utils/logger.h"
namespace sync_primitives {
CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
-Lock::Lock()
-#ifndef NDEBUG
- : lock_taken_(0)
- , is_mutex_recursive_(false)
-#endif // NDEBUG
-{
- Init(false);
-}
-
-Lock::Lock(bool is_recursive)
-#ifndef NDEBUG
- : lock_taken_(0)
- , is_mutex_recursive_(is_recursive)
-#endif // NDEBUG
-{
- Init(is_recursive);
-}
+Lock::Lock() : lock_taken_(0) {}
Lock::~Lock() {
-#ifndef NDEBUG
if (lock_taken_ > 0) {
- LOG4CXX_FATAL(logger_, "Destroying non-released mutex " << &mutex_);
- NOTREACHED();
- }
-#endif
- int32_t status = pthread_mutex_destroy(&mutex_);
- if (status != 0) {
- LOG4CXX_FATAL(logger_,
- "Failed to destroy mutex " << &mutex_ << ": "
- << strerror(status));
- NOTREACHED();
+ LOG4CXX_FATAL(logger_, "Destroying non-released regular mutex " << &mutex_);
}
}
void Lock::Acquire() {
- const int32_t status = pthread_mutex_lock(&mutex_);
- if (status != 0) {
- LOG4CXX_FATAL(logger_,
- "Failed to acquire mutex " << &mutex_ << ": "
- << strerror(status));
- NOTREACHED();
- } else {
- AssertFreeAndMarkTaken();
- }
+ mutex_.lock();
+ AssertFreeAndMarkTaken();
}
void Lock::Release() {
AssertTakenAndMarkFree();
- const int32_t status = pthread_mutex_unlock(&mutex_);
- if (status != 0) {
- LOG4CXX_FATAL(logger_,
- "Failed to unlock mutex" << &mutex_ << ": "
- << strerror(status));
- NOTREACHED();
- }
+ mutex_.unlock();
}
bool Lock::Try() {
- const int32_t status = pthread_mutex_trylock(&mutex_);
- if (status == 0) {
-#ifndef NDEBUG
- lock_taken_++;
-#endif
- return true;
+ bool status = mutex_.try_lock();
+ if (status) {
+ AssertFreeAndMarkTaken();
}
- return false;
+ return status;
}
-#ifndef NDEBUG
void Lock::AssertFreeAndMarkTaken() {
- if ((lock_taken_ > 0) && !is_mutex_recursive_) {
+ if (lock_taken_ != 0) {
LOG4CXX_FATAL(logger_, "Locking already taken not recursive mutex");
NOTREACHED();
}
lock_taken_++;
}
+
void Lock::AssertTakenAndMarkFree() {
if (lock_taken_ == 0) {
LOG4CXX_FATAL(logger_, "Unlocking a mutex that is not taken");
@@ -125,25 +82,46 @@ void Lock::AssertTakenAndMarkFree() {
}
lock_taken_--;
}
-#endif
-void Lock::Init(bool is_recursive) {
- pthread_mutexattr_t attr;
- pthread_mutexattr_init(&attr);
+// Recursive lock looks the same on the surface, some code duplication is
+// necessary since they don't have a shared parent superclass
+RecursiveLock::RecursiveLock() : lock_taken_(0) {}
- const int32_t mutex_type =
- is_recursive ? PTHREAD_MUTEX_RECURSIVE : PTHREAD_MUTEX_ERRORCHECK;
+RecursiveLock::~RecursiveLock() {
+ if (lock_taken_ > 0) {
+ LOG4CXX_FATAL(logger_,
+ "Destroying non-released recursive mutex " << &mutex_);
+ }
+}
- pthread_mutexattr_settype(&attr, mutex_type);
- const int32_t status = pthread_mutex_init(&mutex_, &attr);
+void RecursiveLock::Acquire() {
+ mutex_.lock();
+ AssertFreeAndMarkTaken();
+}
- pthread_mutexattr_destroy(&attr);
+void RecursiveLock::Release() {
+ AssertTakenAndMarkFree();
+ mutex_.unlock();
+}
- if (status != 0) {
- LOG4CXX_FATAL(logger_,
- "Failed to initialize mutex. " << std::strerror(status));
- DCHECK(status != 0);
+bool RecursiveLock::Try() {
+ bool status = mutex_.try_lock();
+ if (status) {
+ AssertFreeAndMarkTaken();
}
+ return status;
+}
+
+void RecursiveLock::AssertFreeAndMarkTaken() {
+ lock_taken_++;
+}
+
+void RecursiveLock::AssertTakenAndMarkFree() {
+ if (lock_taken_ == 0) {
+ LOG4CXX_FATAL(logger_, "Unlocking a recursive mutex that is not taken");
+ NOTREACHED();
+ }
+ lock_taken_--;
}
} // namespace sync_primitives
diff --git a/src/components/utils/src/log_message_loop_thread.cc b/src/components/utils/src/log_message_loop_thread.cc
index 2b7f28fbfd..182eb64534 100644
--- a/src/components/utils/src/log_message_loop_thread.cc
+++ b/src/components/utils/src/log_message_loop_thread.cc
@@ -35,7 +35,7 @@
namespace logger {
-void LogMessageHandler::Handle(const LogMessage message) {
+void LogMessageLoopThread::Handle(const LogMessage message) {
message.logger->forcedLog(message.level,
message.entry,
message.timeStamp,
@@ -44,14 +44,13 @@ void LogMessageHandler::Handle(const LogMessage message) {
}
LogMessageLoopThread::LogMessageLoopThread()
- : LogMessageLoopThreadTemplate("Logger",
- handler_ = new LogMessageHandler()) {}
+ : LogMessageLoopThreadTemplate("Logger", this) {}
LogMessageLoopThread::~LogMessageLoopThread() {
// we'll have to drop messages
// while deleting logger thread
logger_status = DeletingLoggerThread;
- delete handler_;
+ LogMessageLoopThreadTemplate::Shutdown();
}
} // namespace logger
diff --git a/src/components/utils/src/logger.cc b/src/components/utils/src/logger.cc
index 4e93ca3d14..5a7922afc4 100644
--- a/src/components/utils/src/logger.cc
+++ b/src/components/utils/src/logger.cc
@@ -31,16 +31,16 @@
*/
#include "utils/logger.h"
+#include <apr_time.h>
#include "utils/log_message_loop_thread.h"
#include "utils/logger_status.h"
-#include <apr_time.h>
void deinit_logger() {
CREATE_LOGGERPTR_LOCAL(logger_, "Utils")
LOG4CXX_DEBUG(logger_, "Logger deinitialization");
logger::set_logs_enabled(false);
- logger::delete_log_message_loop_thread();
log4cxx::LoggerPtr rootLogger = log4cxx::Logger::getRootLogger();
+ logger::delete_log_message_loop_thread(rootLogger);
log4cxx::spi::LoggerRepositoryPtr repository =
rootLogger->getLoggerRepository();
log4cxx::LoggerList loggers = repository->getCurrentLoggers();
diff --git a/src/components/utils/src/push_log.cc b/src/components/utils/src/push_log.cc
index 6e16c99181..f9d1cd738a 100644
--- a/src/components/utils/src/push_log.cc
+++ b/src/components/utils/src/push_log.cc
@@ -36,8 +36,21 @@
namespace logger {
-static bool logs_enabled_ = false;
-static LogMessageLoopThread* log_message_loop_thread = NULL;
+struct __attribute__((visibility("default"))) LogsEnabled {
+ static std::atomic_bool logs_enabled_;
+};
+
+std::atomic_bool LogsEnabled::logs_enabled_(false);
+
+template <typename T>
+using logger_ptr = std::unique_ptr<T, std::function<void(T*)> >;
+
+static logger_ptr<LogMessageLoopThread> log_message_loop_thread;
+
+auto deinit_logger = [](LogMessageLoopThread* logMsgThread) {
+ delete logMsgThread;
+ logger::logger_status = logger::LoggerThreadNotCreated;
+};
bool push_log(log4cxx::LoggerPtr logger,
log4cxx::LevelPtr level,
@@ -73,22 +86,46 @@ bool push_log(log4cxx::LoggerPtr logger,
}
bool logs_enabled() {
- return logs_enabled_;
+ return LogsEnabled::logs_enabled_;
}
void set_logs_enabled(bool state) {
- logs_enabled_ = state;
+ LogsEnabled::logs_enabled_ = state;
}
void create_log_message_loop_thread() {
if (!log_message_loop_thread) {
- log_message_loop_thread = new LogMessageLoopThread();
+ log_message_loop_thread = logger_ptr<LogMessageLoopThread>(
+ new LogMessageLoopThread, deinit_logger);
}
}
-void delete_log_message_loop_thread() {
- delete log_message_loop_thread;
- log_message_loop_thread = NULL;
+void delete_log_message_loop_thread(log4cxx::LoggerPtr& logger) {
+ if (logger::logger_status == logger::LoggerThreadCreated) {
+ logger::flush_logger();
+ }
+
+ log_message_loop_thread.reset();
+
+ if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {
+ ::log4cxx::helpers::MessageBuffer oss_;
+ logger->forcedLog(::log4cxx::Level::getDebug(),
+ oss_.str(oss_ << "Logger loop thread deinitialized"),
+ LOG4CXX_LOCATION);
+ }
+
+ if (logger->getRootLogger() == logger) {
+ return;
+ }
+
+ if (LOG4CXX_UNLIKELY(logger->isDebugEnabled())) {
+ ::log4cxx::helpers::MessageBuffer oss_;
+ logger->forcedLog(::log4cxx::Level::getDebug(),
+ oss_.str(oss_ << "Logger calling removeAllAppenders"),
+ LOG4CXX_LOCATION);
+ }
+
+ logger->removeAllAppenders();
}
void flush_logger() {
diff --git a/src/components/utils/src/qdb_wrapper/sql_database.cc b/src/components/utils/src/qdb_wrapper/sql_database.cc
index b95fe17845..e2a51753b2 100644
--- a/src/components/utils/src/qdb_wrapper/sql_database.cc
+++ b/src/components/utils/src/qdb_wrapper/sql_database.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <cstring>
#include "qdb_wrapper/sql_database.h"
+#include <cstring>
#include "utils/logger.h"
namespace utils {
diff --git a/src/components/utils/src/qdb_wrapper/sql_query.cc b/src/components/utils/src/qdb_wrapper/sql_query.cc
index e5facb5853..d101e80718 100644
--- a/src/components/utils/src/qdb_wrapper/sql_query.cc
+++ b/src/components/utils/src/qdb_wrapper/sql_query.cc
@@ -31,12 +31,12 @@
*/
#include "qdb_wrapper/sql_query.h"
+#include <errno.h>
#include <string.h>
-#include <cassert>
#include <algorithm>
+#include <cassert>
#include "qdb_wrapper/sql_database.h"
#include "utils/logger.h"
-#include <errno.h>
namespace utils {
namespace dbms {
diff --git a/src/components/utils/src/resource_usage.cc b/src/components/utils/src/resource_usage.cc
index 385c2bfa2e..15a8c71e70 100644
--- a/src/components/utils/src/resource_usage.cc
+++ b/src/components/utils/src/resource_usage.cc
@@ -10,11 +10,11 @@
#include <sys/types.h>
#include <unistd.h>
#endif
-#include <sys/resource.h>
#include <errno.h>
+#include <stdio.h>
+#include <sys/resource.h>
#include <sys/types.h>
#include <unistd.h>
-#include <stdio.h>
#include <sstream>
#include "utils/file_system.h"
diff --git a/src/components/utils/src/rwlock_posix.cc b/src/components/utils/src/rwlock_posix.cc
index 08edb8cb0c..81bf5feee1 100644
--- a/src/components/utils/src/rwlock_posix.cc
+++ b/src/components/utils/src/rwlock_posix.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "utils/rwlock.h"
#include "utils/logger.h"
+#include "utils/rwlock.h"
namespace sync_primitives {
diff --git a/src/components/utils/test/atomic_object_test.cc b/src/components/utils/src/semantic_version.cc
index 44975fd004..9f0991e991 100644
--- a/src/components/utils/test/atomic_object_test.cc
+++ b/src/components/utils/src/semantic_version.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Ford Motor Company
+ * Copyright (c) 2018, Livio
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,29 +29,11 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "utils/semantic_version.h"
-#include "utils/atomic_object.h"
-#include "gtest/gtest.h"
+namespace utils {
-namespace test {
-namespace components {
-namespace utils_test {
+const SemanticVersion base_rpc_version(4, 5, 1);
+const SemanticVersion rpc_version_5(5, 0, 0);
-TEST(AtomicObjectTest, Construct) {
- sync_primitives::atomic_int var(5);
- EXPECT_EQ(5, var);
-
- var = 8;
- EXPECT_EQ(8, var);
-
- sync_primitives::atomic_bool flag = true;
-
- EXPECT_TRUE(flag == true);
-
- flag = false;
- EXPECT_FALSE(flag == true);
-}
-
-} // namespace utils_test
-} // namespace components
-} // namespace test
+} // namespace utils \ No newline at end of file
diff --git a/src/components/utils/src/signals_posix.cc b/src/components/utils/src/signals_posix.cc
index 274c254716..9b23aba804 100644
--- a/src/components/utils/src/signals_posix.cc
+++ b/src/components/utils/src/signals_posix.cc
@@ -29,13 +29,16 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <stdint.h>
+#include <sys/wait.h>
#include <csignal>
#include <cstdlib>
-#include <stdint.h>
+#include <iostream>
#include "utils/signals.h"
-bool utils::UnsibscribeFromTermination() {
+namespace utils {
+bool Signals::UnsubscribeFromTermination() {
// Disable some system signals receiving in thread
// by blocking those signals
// (system signals processes only in the main thread)
@@ -51,6 +54,42 @@ bool utils::UnsibscribeFromTermination() {
return !pthread_sigmask(SIG_BLOCK, &signal_set, NULL);
}
+bool Signals::UnsubscribeFromLowVoltageSignals(
+ const main_namespace::LowVoltageSignalsOffset& offset_data) {
+ // Disable Low Voltage signals in main thread
+ // due to all further threads will inherit signals mask
+ sigset_t signal_set;
+ sigemptyset(&signal_set);
+ const int SIGLOWVOLTAGE = SIGRTMIN + offset_data.low_voltage_signal_offset;
+ const int SIGWAKEUP = SIGRTMIN + offset_data.wake_up_signal_offset;
+ const int SIGIGNOFF = SIGRTMIN + offset_data.ignition_off_signal_offset;
+ sigaddset(&signal_set, SIGLOWVOLTAGE);
+ sigaddset(&signal_set, SIGWAKEUP);
+ sigaddset(&signal_set, SIGIGNOFF);
+
+ // Set signals mask to be blocked by thread
+ return !pthread_sigmask(SIG_BLOCK, &signal_set, nullptr);
+}
+
+void Signals::SendSignal(const int signo, const pid_t pid) {
+ if (kill(pid, signo) == -1) {
+ std::cerr << "Error sending signal: " << strsignal(signo) << " to " << pid
+ << " .Error: " << strerror(errno) << std::endl;
+ }
+}
+
+pid_t Signals::Fork() {
+ return fork();
+}
+
+void Signals::ExitProcess(const int status) {
+ _Exit(status);
+}
+
+void Signals::WaitPid(pid_t cpid, int* status, int options) {
+ waitpid(cpid, status, options);
+}
+
namespace {
bool CatchSIGSEGV(sighandler_t handler) {
struct sigaction act;
@@ -63,7 +102,7 @@ bool CatchSIGSEGV(sighandler_t handler) {
}
} // namespace
-bool utils::WaitTerminationSignals(sighandler_t sig_handler) {
+bool Signals::WaitTerminationSignals(sighandler_t sig_handler) {
sigset_t signal_set;
int sig = -1;
@@ -81,3 +120,4 @@ bool utils::WaitTerminationSignals(sighandler_t sig_handler) {
}
return false;
}
+} // namespace utils
diff --git a/src/components/utils/src/system.cc b/src/components/utils/src/system.cc
index 6c3cf56133..2acc7acf92 100644
--- a/src/components/utils/src/system.cc
+++ b/src/components/utils/src/system.cc
@@ -32,16 +32,16 @@
#ifdef __QNX__
#include <process.h>
#else // __QNX__
+#include <fcntl.h>
+#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <sys/stat.h>
-#include <fcntl.h>
#include <unistd.h>
#endif // __QNX__
#include <algorithm>
-#include <functional>
#include <cstring>
+#include <functional>
#include <iostream>
#include "utils/logger.h"
@@ -87,7 +87,7 @@ bool System::Execute() {
bool System::Execute(bool wait) {
size_t size = argv_.size();
- char** argv = new char* [size + 1];
+ char** argv = new char*[size + 1];
std::transform(argv_.begin(), argv_.end(), argv, GetCString());
argv[size] = NULL;
@@ -137,7 +137,7 @@ bool System::Execute(bool wait) {
dup2(fd_dev0, STDERR_FILENO);
size_t size = argv_.size();
- char** argv = new char* [size + 1];
+ char** argv = new char*[size + 1];
std::transform(argv_.begin(), argv_.end(), argv, GetCString());
argv[size] = NULL;
@@ -173,4 +173,4 @@ bool System::Execute(bool wait) {
#endif // __QNX__
-} // utils
+} // namespace utils
diff --git a/src/components/utils/src/threads/async_runner.cc b/src/components/utils/src/threads/async_runner.cc
index 131aaa3f78..740db016be 100644
--- a/src/components/utils/src/threads/async_runner.cc
+++ b/src/components/utils/src/threads/async_runner.cc
@@ -110,4 +110,4 @@ void AsyncRunner::AsyncRunnerDelegate::runDelegate(ThreadDelegate* delegate) {
delegate_notifier_.NotifyOne();
}
-} // namespace policy.
+} // namespace threads
diff --git a/src/components/utils/src/threads/pulse_thread_delegate.cc b/src/components/utils/src/threads/pulse_thread_delegate.cc
index 37e6c670d1..a76b17368a 100644
--- a/src/components/utils/src/threads/pulse_thread_delegate.cc
+++ b/src/components/utils/src/threads/pulse_thread_delegate.cc
@@ -32,8 +32,8 @@
#include <sys/netmgr.h>
-#include "utils/threads/pulse_thread_delegate.h"
#include "utils/logger.h"
+#include "utils/threads/pulse_thread_delegate.h"
namespace threads {
diff --git a/src/components/utils/src/threads/thread_delegate.cc b/src/components/utils/src/threads/thread_delegate.cc
index 917603f92c..e071959522 100644
--- a/src/components/utils/src/threads/thread_delegate.cc
+++ b/src/components/utils/src/threads/thread_delegate.cc
@@ -34,8 +34,8 @@
#include <pthread.h>
-#include "utils/threads/thread.h"
#include "utils/lock.h"
+#include "utils/threads/thread.h"
namespace threads {
diff --git a/src/components/utils/src/threads/thread_manager.cc b/src/components/utils/src/threads/thread_manager.cc
index 2959a86cb7..8825510d74 100644
--- a/src/components/utils/src/threads/thread_manager.cc
+++ b/src/components/utils/src/threads/thread_manager.cc
@@ -31,16 +31,16 @@
*/
#include "utils/threads/thread_manager.h"
-#include "utils/threads/thread_delegate.h"
-#include "utils/lock.h"
#include "utils/conditional_variable.h"
-#include "utils/threads/thread.h"
+#include "utils/lock.h"
#include "utils/logger.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/thread_delegate.h"
#include <pthread.h>
-#include <sstream>
#include <list>
+#include <sstream>
#if defined(OS_LINUX)
#include <sys/syscall.h>
diff --git a/src/components/utils/src/threads/thread_posix.cc b/src/components/utils/src/threads/thread_posix.cc
index 51e59fa108..35c1cd7084 100644
--- a/src/components/utils/src/threads/thread_posix.cc
+++ b/src/components/utils/src/threads/thread_posix.cc
@@ -32,16 +32,16 @@
#include <errno.h>
#include <limits.h>
-#include <stddef.h>
-#include <signal.h>
#include <pthread.h>
+#include <signal.h>
+#include <stddef.h>
#include <algorithm>
#include <functional>
-#include "utils/threads/thread.h"
#include "utils/atomic.h"
-#include "utils/threads/thread_delegate.h"
#include "utils/logger.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/thread_delegate.h"
#ifndef __QNXNTO__
const int EOK = 0;
@@ -172,9 +172,9 @@ bool Thread::start(const ThreadOptions& options) {
}
if (isThreadRunning_) {
- LOG4CXX_TRACE(logger_,
- "EXIT thread " << name_ << " #" << handle_
- << " is already running");
+ LOG4CXX_TRACE(
+ logger_,
+ "EXIT thread " << name_ << " #" << handle_ << " is already running");
return true;
}
diff --git a/src/components/utils/src/threads/thread_validator.cc b/src/components/utils/src/threads/thread_validator.cc
index 4024522ae4..3b753e79b5 100644
--- a/src/components/utils/src/threads/thread_validator.cc
+++ b/src/components/utils/src/threads/thread_validator.cc
@@ -31,8 +31,8 @@
*/
#include "utils/threads/thread_validator.h"
-#include "utils/logger.h"
#include "utils/back_trace.h"
+#include "utils/logger.h"
namespace threads {
@@ -46,14 +46,15 @@ SingleThreadSimpleValidator::~SingleThreadSimpleValidator() {}
void SingleThreadSimpleValidator::AssertRunningOnCreationThread() const {
PlatformThreadHandle current_id = Thread::CurrentId();
if (creation_thread_id_ != current_id) {
- LOG4CXX_ERROR(logger_,
- "Single-threaded object created at thread "
- << creation_thread_id_ << " is accessed from thread "
- << current_id
+ LOG4CXX_ERROR(
+ logger_,
+ "Single-threaded object created at thread "
+ << creation_thread_id_ << " is accessed from thread " << current_id
#ifdef BACKTRACE_SUPPORT
- << "\n" << utils::Backtrace()
+ << "\n"
+ << utils::Backtrace()
#endif
- );
+ );
}
}
@@ -80,7 +81,7 @@ void SingleThreadValidator::AssertRunningOnValidThread() const {
#ifdef BACKTRACE_SUPPORT
<< utils::Backtrace()
#endif
- );
+ );
}
}
diff --git a/src/components/utils/src/timer.cc b/src/components/utils/src/timer.cc
index b819b56f54..8e854654de 100644
--- a/src/components/utils/src/timer.cc
+++ b/src/components/utils/src/timer.cc
@@ -33,13 +33,13 @@
#include <string>
-#include "utils/macro.h"
-#include "utils/logger.h"
-#include "utils/lock.h"
-#include "utils/timer_task.h"
#include "utils/conditional_variable.h"
+#include "utils/lock.h"
+#include "utils/logger.h"
+#include "utils/macro.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
+#include "utils/timer_task.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
@@ -49,7 +49,8 @@ timer::Timer::Timer(const std::string& name, TimerTask* task)
, state_lock_()
, delegate_(new TimerDelegate(this, state_lock_))
, thread_(threads::CreateThread(name_.c_str(), delegate_.get()))
- , single_shot_(true) {
+ , single_shot_(true)
+ , completed_flag_(false) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK(!name_.empty());
DCHECK(task_);
@@ -76,6 +77,7 @@ void timer::Timer::Start(const Milliseconds timeout,
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(state_lock_);
StopThread();
+ completed_flag_ = false;
switch (timer_type) {
case kSingleShot: {
single_shot_ = true;
@@ -106,17 +108,21 @@ bool timer::Timer::is_running() const {
return !delegate_->stop_flag();
}
+bool timer::Timer::is_completed() const {
+ return completed_flag_;
+}
+
timer::Milliseconds timer::Timer::timeout() const {
sync_primitives::AutoLock auto_lock(state_lock_);
return delegate_->timeout();
}
-void timer::Timer::StartDelegate(const Milliseconds timeout) const {
+void timer::Timer::StartDelegate(const Milliseconds timeout) {
delegate_->set_stop_flag(false);
delegate_->set_timeout(timeout);
}
-void timer::Timer::StopDelegate() const {
+void timer::Timer::StopDelegate() {
delegate_->set_stop_flag(true);
delegate_->set_timeout(0);
}
@@ -148,7 +154,7 @@ void timer::Timer::StopThread() {
}
}
-void timer::Timer::OnTimeout() const {
+void timer::Timer::OnTimeout() {
{
sync_primitives::AutoLock auto_lock(state_lock_);
if (single_shot_) {
@@ -158,10 +164,11 @@ void timer::Timer::OnTimeout() const {
DCHECK_OR_RETURN_VOID(task_);
task_->run();
+ completed_flag_ = true;
}
timer::Timer::TimerDelegate::TimerDelegate(
- const Timer* timer, sync_primitives::Lock& state_lock_ref)
+ Timer* timer, sync_primitives::Lock& state_lock_ref)
: timer_(timer)
, timeout_(0)
, stop_flag_(true)
diff --git a/src/components/utils/test/CMakeLists.txt b/src/components/utils/test/CMakeLists.txt
index f6bd24ff09..b5127ccabc 100644
--- a/src/components/utils/test/CMakeLists.txt
+++ b/src/components/utils/test/CMakeLists.txt
@@ -87,7 +87,7 @@ collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}" "${EXCLUDE_PATHS}")
set(LIBRARIES
gmock
Utils
- Policy
+ PolicyStatic
ConfigProfile
)
diff --git a/src/components/utils/test/async_runner_test.cc b/src/components/utils/test/async_runner_test.cc
index 65abad65c2..e26f80d954 100644
--- a/src/components/utils/test/async_runner_test.cc
+++ b/src/components/utils/test/async_runner_test.cc
@@ -30,17 +30,15 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "utils/threads/async_runner.h"
#include <stdlib.h>
#include <ctime>
#include <memory>
-#include "utils/lock.h"
-#include "utils/threads/async_runner.h"
#include "utils/conditional_variable.h"
-#include "utils/shared_ptr.h"
-#include "utils/make_shared.h"
+#include "utils/lock.h"
-#include "gtest/gtest.h"
#include "gmock/gmock.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
@@ -51,7 +49,7 @@ using namespace threads;
namespace {
size_t kCheckValue = 0u;
const size_t kDelegatesAmount = 4u;
-}
+} // namespace
// ThreadDelegate successor
class TestThreadDelegate : public ThreadDelegate {
@@ -92,10 +90,10 @@ class AsyncRunnerTest : public ::testing::Test {
protected:
ThreadDelegate** delegates_;
- ::utils::SharedPtr<AsyncRunner> async_runner_;
+ std::shared_ptr<AsyncRunner> async_runner_;
void CreateThreadsArray() {
- delegates_ = new ThreadDelegate* [kDelegatesAmount];
+ delegates_ = new ThreadDelegate*[kDelegatesAmount];
}
void DeleteThreadsArray() {
@@ -103,7 +101,7 @@ class AsyncRunnerTest : public ::testing::Test {
}
void CreateAsyncRunner() {
- async_runner_ = ::utils::MakeShared<AsyncRunner>("test");
+ async_runner_ = std::make_shared<AsyncRunner>("test");
}
};
@@ -128,8 +126,8 @@ TEST_F(AsyncRunnerTest, StopThenRun_ExpectDelegateNotStarted) {
// Check that delegate was not started due to Stop() called before AsyncRun()
EXPECT_CALL(mock_thread_delegate, threadMain()).Times(0);
{
- ::utils::SharedPtr<AsyncRunner> async_runner =
- ::utils::MakeShared<AsyncRunner>("test");
+ std::shared_ptr<AsyncRunner> async_runner =
+ std::make_shared<AsyncRunner>("test");
async_runner->Stop();
async_runner->AsyncRun(&mock_thread_delegate);
}
diff --git a/src/components/utils/test/auto_trace_test.cc b/src/components/utils/test/auto_trace_test.cc
index 1290ce7e96..41dc90cae4 100644
--- a/src/components/utils/test/auto_trace_test.cc
+++ b/src/components/utils/test/auto_trace_test.cc
@@ -30,19 +30,19 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <fstream>
#include <ctime>
+#include <fstream>
#include "gtest/gtest.h"
#include "utils/auto_trace.h"
-#include "utils/logger.h"
+#include "utils/date_time.h"
+#include "utils/file_system.h"
+#include "utils/helpers.h"
#include "utils/log_message_loop_thread.h"
+#include "utils/logger.h"
+#include "utils/logger_status.h"
#include "utils/threads/message_loop_thread.h"
-#include "utils/file_system.h"
#include "utils/threads/thread.h"
-#include "utils/date_time.h"
-#include "utils/logger_status.h"
-#include "utils/helpers.h"
namespace test {
namespace components {
@@ -115,7 +115,7 @@ bool CheckAutoTraceDebugInFile(const std::string& debug_message) {
bool trace_exit = false;
for (std::string line;
Compare<bool, EQ, ONE>(false, debug_found, trace_enter, trace_exit) &&
- getline(file_log, line);) {
+ getline(file_log, line);) {
debug_found = debug_found
? debug_found
: IsLogLineContains(line, debug_log_level, debug_message);
diff --git a/src/components/utils/test/back_trace_test.cc b/src/components/utils/test/back_trace_test.cc
index dcb2a79baa..2c8c61439b 100644
--- a/src/components/utils/test/back_trace_test.cc
+++ b/src/components/utils/test/back_trace_test.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "utils/back_trace.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
diff --git a/src/components/utils/test/bitstream_test.cc b/src/components/utils/test/bitstream_test.cc
index caec4b3970..3d20845dc4 100644
--- a/src/components/utils/test/bitstream_test.cc
+++ b/src/components/utils/test/bitstream_test.cc
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "utils/bitstream.h"
#include <unistd.h>
#include "gtest/gtest.h"
#include "utils/macro.h"
-#include "utils/bitstream.h"
namespace test {
namespace components {
diff --git a/src/components/utils/test/conditional_variable_test.cc b/src/components/utils/test/conditional_variable_test.cc
index 48e2e53200..1ef29685e6 100644
--- a/src/components/utils/test/conditional_variable_test.cc
+++ b/src/components/utils/test/conditional_variable_test.cc
@@ -30,14 +30,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <iostream>
#include <pthread.h>
+#include <iostream>
#include "gtest/gtest.h"
+#include "utils/conditional_variable.h"
#include "utils/lock.h"
#include "utils/macro.h"
-#include "utils/conditional_variable.h"
namespace test {
namespace components {
@@ -102,6 +102,7 @@ TEST_F(ConditionalVariableTest,
cond_var_.WaitFor(test_lock, 2000);
std::string last_value("changed again by thread 1");
EXPECT_EQ(last_value, test_value_);
+ pthread_join(thread1, NULL);
}
TEST_F(ConditionalVariableTest,
diff --git a/src/components/utils/test/custom_string_test.cc b/src/components/utils/test/custom_string_test.cc
index bca332be5a..cf03f6099f 100644
--- a/src/components/utils/test/custom_string_test.cc
+++ b/src/components/utils/test/custom_string_test.cc
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "utils/custom_string.h"
#include <iostream>
#include <string>
#include "gtest/gtest.h"
-#include "utils/custom_string.h"
namespace custom_str = utils::custom_string;
diff --git a/src/components/utils/test/data_accessor_test.cc b/src/components/utils/test/data_accessor_test.cc
index 24b7bab282..b9d8f3b4f9 100644
--- a/src/components/utils/test/data_accessor_test.cc
+++ b/src/components/utils/test/data_accessor_test.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "utils/data_accessor.h"
+#include "gtest/gtest.h"
#include "utils/lock.h"
namespace test {
diff --git a/src/components/utils/test/date_time_test.cc b/src/components/utils/test/date_time_test.cc
index a209ab4d43..4cde9a4fc4 100644
--- a/src/components/utils/test/date_time_test.cc
+++ b/src/components/utils/test/date_time_test.cc
@@ -30,372 +30,279 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "utils/date_time.h"
+#include <boost/thread/thread.hpp>
+#include "gtest/gtest.h"
namespace test {
namespace components {
namespace utils_test {
using namespace date_time;
+
+namespace bpt = boost::posix_time;
TEST(DateTimeTest, GetCurrentTime) {
// arrange
- const TimevalStruct time1 = date_time::DateTime::getCurrentTime();
+ const date_time::TimeDuration time1 = getCurrentTime();
// assert
- ASSERT_NE(0, time1.tv_sec);
- ASSERT_GE(time1.tv_usec, 0);
+ ASSERT_NE(0, time1.total_seconds());
+ ASSERT_GE(get_just_uSecs(time1), 0);
// act
- const TimevalStruct time2 = date_time::DateTime::getCurrentTime();
+ const date_time::TimeDuration time2 = getCurrentTime();
// assert
- ASSERT_NE(0, time2.tv_sec);
- ASSERT_GE(time2.tv_usec, 0);
- ASSERT_GE(time2.tv_sec, time1.tv_sec);
+ ASSERT_NE(0, time2.total_seconds());
+ ASSERT_GE(get_just_uSecs(time1), 0);
+ ASSERT_GE(time2.total_seconds(), time1.total_seconds());
}
TEST(DateTimeTest, GetSecs) {
// arrange
- TimevalStruct time;
- time.tv_sec = 1;
- time.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
+ date_time::TimeDuration time1 = bpt::seconds(1) + bpt::milliseconds(2);
// assert
- ASSERT_EQ(1, date_time::DateTime::getSecs(time));
+ ASSERT_EQ(1, getSecs(time1));
}
TEST(DateTimeTest, GetmSecs) {
// arrange
- TimevalStruct time;
- time.tv_sec = 1;
- time.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
+ date_time::TimeDuration time1 = bpt::seconds(1) + bpt::milliseconds(2);
+ int expected = 1 * MILLISECONDS_IN_SECOND + 2;
- int64_t expect_value =
- time.tv_sec * date_time::DateTime::MILLISECONDS_IN_SECOND +
- time.tv_usec / date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
// assert
- ASSERT_EQ(expect_value, date_time::DateTime::getmSecs(time));
+ ASSERT_EQ(expected, getmSecs(time1));
}
TEST(DateTimeTest, GetuSecs) {
// arrange
- TimevalStruct time;
- time.tv_sec = 3;
- time.tv_usec = 4;
-
- int64_t expect_value = time.tv_sec *
- date_time::DateTime::MILLISECONDS_IN_SECOND *
- date_time::DateTime::MICROSECONDS_IN_MILLISECOND +
- time.tv_usec;
+ date_time::TimeDuration time1 = bpt::seconds(3) + bpt::microseconds(4);
+ int expect_value =
+ 3 * MILLISECONDS_IN_SECOND * MICROSECONDS_IN_MILLISECOND + 4;
+
// assert
- ASSERT_EQ(expect_value, date_time::DateTime::getuSecs(time));
+ ASSERT_EQ(expect_value, getuSecs(time1));
}
TEST(DateTimeTest, GetuSecsmSecs) {
// arrange
- TimevalStruct time;
- time.tv_sec = 5;
- time.tv_usec = 6;
+ date_time::TimeDuration time1 = bpt::seconds(5) + bpt::microseconds(6);
- int64_t expect_value = date_time::DateTime::getuSecs(time) /
- date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
+ int64_t expect_value = getuSecs(time1) / MICROSECONDS_IN_MILLISECOND;
// assert
- ASSERT_EQ(expect_value, date_time::DateTime::getmSecs(time));
+ ASSERT_EQ(expect_value, getmSecs(time1));
}
TEST(DateTimeTest, CalculateTimeSpan) {
// arrange
- const TimevalStruct time = date_time::DateTime::getCurrentTime();
+ const date_time::TimeDuration time1 = getCurrentTime();
const uint32_t sleep_time_mSec = 10;
- usleep(sleep_time_mSec * date_time::DateTime::MICROSECONDS_IN_MILLISECOND);
+ // sleep current thread
+ boost::this_thread::sleep(boost::posix_time::milliseconds(sleep_time_mSec));
// assert
- ASSERT_GE(date_time::DateTime::calculateTimeSpan(time), sleep_time_mSec);
+ ASSERT_GE(calculateTimeSpan(time1), sleep_time_mSec);
}
TEST(DateTimeTest, CalculateTimeDiff) {
// arrange
- TimevalStruct time1;
- time1.tv_sec = 1;
- time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
- TimevalStruct time2;
- time2.tv_sec = 3;
- time2.tv_usec = 4 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
+ date_time::TimeDuration time1 = bpt::seconds(2) + bpt::milliseconds(2);
+ date_time::TimeDuration time2 = bpt::seconds(3) + bpt::milliseconds(4);
// time2 to time1
- TimevalStruct diff1;
- diff1.tv_sec = time2.tv_sec - time1.tv_sec;
- diff1.tv_usec = time2.tv_usec - time1.tv_usec;
-
- const int64_t mSecDiff =
- static_cast<int64_t>(diff1.tv_sec) * 1000 + diff1.tv_usec / 1000;
+ date_time::TimeDuration diff1 = bpt::seconds(1) + bpt::milliseconds(2);
// assert
- ASSERT_EQ(mSecDiff, date_time::DateTime::calculateTimeDiff(time2, time1));
-
- // time1 to time2
- TimevalStruct diff2;
- diff2.tv_sec = time1.tv_sec - time2.tv_sec;
- diff2.tv_usec = time1.tv_usec - time2.tv_usec;
+ ASSERT_EQ(diff1.total_milliseconds(), calculateTimeDiff(time2, time1));
- const int64_t mSecDiff2 =
- -(static_cast<int64_t>(diff2.tv_sec) * 1000 + diff2.tv_usec / 1000);
+ // time1 to time2, but calculateTimeDiff returns an absolute value
+ date_time::TimeDuration diff2 = -diff1.invert_sign();
// assert
- ASSERT_EQ(mSecDiff2, date_time::DateTime::calculateTimeDiff(time1, time2));
+ ASSERT_EQ(diff2.total_milliseconds(), calculateTimeDiff(time1, time2));
}
TEST(DateTimeTest, CalculateEqualTimeDiff) {
- TimevalStruct time1;
- time1.tv_sec = 1;
- time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
+ date_time::TimeDuration time1 = bpt::seconds(1) + bpt::milliseconds(2);
- TimevalStruct time2;
- time2.tv_sec = 1;
- time2.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
+ date_time::TimeDuration time2 = bpt::seconds(1) + bpt::milliseconds(2);
- ASSERT_EQ(0, date_time::DateTime::calculateTimeDiff(time2, time1));
- ASSERT_EQ(0, date_time::DateTime::calculateTimeDiff(time1, time2));
+ ASSERT_EQ(0, calculateTimeDiff(time2, time1));
+ ASSERT_EQ(0, calculateTimeDiff(time1, time2));
}
TEST(DateTimeTest, compareTime) {
// arrange
- TimevalStruct time1;
- time1.tv_sec = 1;
- time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
+ date_time::TimeDuration time1 = bpt::seconds(1) + bpt::milliseconds(2);
- TimevalStruct time2;
- time2.tv_sec = 2;
- time2.tv_usec = 4 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
+ date_time::TimeDuration time2 = bpt::seconds(2) + bpt::milliseconds(4);
// assert
- ASSERT_EQ(LESS, date_time::DateTime::compareTime(time1, time2));
- ASSERT_EQ(GREATER, date_time::DateTime::compareTime(time2, time1));
- ASSERT_NE(EQUAL, date_time::DateTime::compareTime(time2, time1));
+ ASSERT_EQ(LESS, compareTime(time1, time2));
+ ASSERT_EQ(GREATER, compareTime(time2, time1));
+ ASSERT_NE(EQUAL, compareTime(time2, time1));
// act
- TimevalStruct time3 = date_time::DateTime::Sub(time2, time1);
+ date_time::TimeDuration time3 = time2 - time1;
// assert
- ASSERT_EQ(EQUAL, date_time::DateTime::compareTime(time1, time3));
+ ASSERT_EQ(EQUAL, compareTime(time1, time3));
}
TEST(DateTimeTest, GetSecs_UsecConvertedInSec) {
// arrange
- TimevalStruct time1;
- time1.tv_sec = 0;
- time1.tv_usec = date_time::DateTime::MICROSECONDS_IN_SECOND;
+ date_time::TimeDuration time1 = bpt::microseconds(MICROSECONDS_IN_SECOND);
// assert
- ASSERT_EQ(1, date_time::DateTime::getSecs(time1));
+ ASSERT_EQ(1, getSecs(time1));
}
TEST(DateTimeTest, compareTime_UsecConvertedInSec) {
// arrange
- TimevalStruct time1;
- time1.tv_sec = 1;
- time1.tv_usec = 0;
-
- TimevalStruct time2;
- time2.tv_sec = 0;
- time2.tv_usec = date_time::DateTime::MICROSECONDS_IN_SECOND;
-
- // assert
- ASSERT_EQ(1, date_time::DateTime::getSecs(time1));
- ASSERT_EQ(1, date_time::DateTime::getSecs(time2));
- ASSERT_EQ(EQUAL, date_time::DateTime::compareTime(time1, time2));
-}
-
-TEST(DateTimeTest, compareEqualTime_UsecConvertedInSec) {
- // arrange
- TimevalStruct time1;
- time1.tv_sec = 1;
- time1.tv_usec = 0;
+ date_time::TimeDuration time1 = bpt::seconds(1);
- TimevalStruct time2;
- time2.tv_sec = 0;
- time2.tv_usec = date_time::DateTime::MICROSECONDS_IN_SECOND;
+ date_time::TimeDuration time2 = bpt::microseconds(MICROSECONDS_IN_SECOND);
// assert
- ASSERT_TRUE(date_time::DateTime::Equal(time1, time2));
+ ASSERT_EQ(1, getSecs(time1));
+ ASSERT_EQ(1, getSecs(time2));
+ ASSERT_EQ(EQUAL, compareTime(time1, time2));
+ ASSERT_TRUE(Equal(time1, time2));
}
TEST(DateTimeTest, compareLessTime_UsecConvertedInSec) {
// arrange
- TimevalStruct time1;
- time1.tv_sec = 1;
- time1.tv_usec = 0;
+ date_time::TimeDuration time1 = bpt::seconds(1);
- TimevalStruct time2;
- time2.tv_sec = 0;
- time2.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_SECOND;
+ date_time::TimeDuration time2 = bpt::microseconds(2 * MICROSECONDS_IN_SECOND);
// assert
- ASSERT_TRUE(date_time::DateTime::Less(time1, time2));
+ ASSERT_TRUE(Less(time1, time2));
}
TEST(DateTimeTest, compareGreaterTime_UsecConvertedInSec) {
// arrange
- TimevalStruct time1;
- time1.tv_sec = 1;
- time1.tv_usec = 0;
+ date_time::TimeDuration time1 = bpt::seconds(1);
- TimevalStruct time2;
- time2.tv_sec = 0;
- time2.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_SECOND;
+ date_time::TimeDuration time2 = bpt::milliseconds(2 * MICROSECONDS_IN_SECOND);
// assert
- ASSERT_TRUE(date_time::DateTime::Greater(time2, time1));
+ ASSERT_TRUE(Greater(time2, time1));
}
TEST(DateTimeTest, CalculateTimeSub_UsecConvertedInSec) {
// arrange
- TimevalStruct time1;
- time1.tv_sec = 1;
- time1.tv_usec = 0;
+ date_time::TimeDuration time1 = bpt::seconds(1);
- TimevalStruct time2;
- time2.tv_sec = 0;
- time2.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_SECOND;
+ date_time::TimeDuration time2 = bpt::microseconds(2 * MICROSECONDS_IN_SECOND);
- TimevalStruct time3 = date_time::DateTime::Sub(time2, time1);
+ date_time::TimeDuration time3 = time2 - time1;
// assert
- ASSERT_EQ(EQUAL, date_time::DateTime::compareTime(time1, time3));
+ ASSERT_EQ(EQUAL, compareTime(time1, time3));
}
TEST(DateTimeTest, CalculateTimeDiff_UsecConvertedInSec) {
// arrange
- TimevalStruct time1;
- time1.tv_sec = 2;
- time1.tv_usec = 5 * date_time::DateTime::MICROSECONDS_IN_SECOND;
- TimevalStruct time2;
- time2.tv_sec = 3;
- time2.tv_usec = 1 * date_time::DateTime::MICROSECONDS_IN_SECOND;
+ date_time::TimeDuration time1 =
+ bpt::seconds(2) + bpt::microseconds(5 * MICROSECONDS_IN_SECOND);
+ date_time::TimeDuration time2 =
+ bpt::seconds(3) + bpt::microseconds(1 * MICROSECONDS_IN_SECOND);
// assert
- ASSERT_EQ(3000, date_time::DateTime::calculateTimeDiff(time2, time1));
- ASSERT_EQ(3000, date_time::DateTime::calculateTimeDiff(time1, time2));
+ ASSERT_EQ(3000, calculateTimeDiff(time2, time1));
+ ASSERT_EQ(3000, calculateTimeDiff(time1, time2));
}
TEST(DateTimeTest, CalculateEqualTimeDiff_UsecConvertedInSec) {
- // arrange
- TimevalStruct time1;
- time1.tv_sec = 2;
- time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_SECOND;
-
- TimevalStruct time2;
- time2.tv_sec = 3;
- time2.tv_usec = 1 * date_time::DateTime::MICROSECONDS_IN_SECOND;
+ date_time::TimeDuration time1 =
+ bpt::seconds(2) + bpt::microseconds(2 * MICROSECONDS_IN_SECOND);
+ date_time::TimeDuration time2 =
+ bpt::seconds(3) + bpt::microseconds(1 * MICROSECONDS_IN_SECOND);
// assert
- ASSERT_EQ(0, date_time::DateTime::calculateTimeDiff(time2, time1));
- ASSERT_EQ(0, date_time::DateTime::calculateTimeDiff(time1, time2));
-}
+ ASSERT_EQ(0, calculateTimeDiff(time2, time1));
+ ASSERT_EQ(0, calculateTimeDiff(time1, time2));
-TEST(DateTimeTest, CalculateEqualTimeSub_UsecConvertedInSec) {
- // arrange
- TimevalStruct time1;
- time1.tv_sec = 3;
- time1.tv_usec = 0;
-
- TimevalStruct time2;
- time2.tv_sec = 2;
- time2.tv_usec = 1 * date_time::DateTime::MICROSECONDS_IN_SECOND;
+ date_time::TimeDuration time3 = time2 - time1;
+ date_time::TimeDuration time4 = time1 - time2;
- TimevalStruct time3 = date_time::DateTime::Sub(time2, time1);
- TimevalStruct time4 = date_time::DateTime::Sub(time1, time2);
+ date_time::TimeDuration time_expected(0, 0, 0, 0);
- TimevalStruct time_expected;
- time_expected.tv_sec = 0;
- time_expected.tv_usec = 0;
- // assert
- ASSERT_EQ(EQUAL, date_time::DateTime::compareTime(time_expected, time3));
- ASSERT_EQ(EQUAL, date_time::DateTime::compareTime(time_expected, time4));
+ ASSERT_EQ(EQUAL, compareTime(time_expected, time3));
+ ASSERT_EQ(EQUAL, compareTime(time_expected, time4));
}
TEST(DateTimeTest,
AddMilliseconds_SetMillisecondMultiplesSecond_ExpectChangeTime) {
- TimevalStruct time1;
- time1.tv_sec = 3;
- time1.tv_usec = 0;
+ date_time::TimeDuration time1 = bpt::seconds(3);
uint32_t milliseconds = 7000;
- date_time::DateTime::AddMilliseconds(time1, milliseconds);
- ASSERT_EQ(10, time1.tv_sec);
- ASSERT_EQ(0, time1.tv_usec);
+ AddMilliseconds(time1, milliseconds);
+ ASSERT_EQ(10, getSecs(time1));
+ ASSERT_EQ(0, get_just_mSecs(time1));
}
TEST(DateTimeTest,
AddMilliseconds_SetMillisecondNotMultiplesSecond_ExpectChangeTime) {
- TimevalStruct time1;
+ date_time::TimeDuration time1 = bpt::seconds(3);
uint32_t milliseconds = 7500;
- time1.tv_sec = 3;
- time1.tv_usec = 0;
- date_time::DateTime::AddMilliseconds(time1, milliseconds);
- ASSERT_EQ(10, time1.tv_sec);
- ASSERT_EQ(500000, time1.tv_usec);
+
+ AddMilliseconds(time1, milliseconds);
+ ASSERT_EQ(10, time1.total_seconds());
+ ASSERT_EQ(500000, get_just_uSecs(time1));
}
TEST(DateTimeTest,
AddMilliseconds_SetMilliSecondLessThenSeconds_ExpectChangeTime) {
- TimevalStruct time1;
+ date_time::TimeDuration time1 = bpt::seconds(3);
uint32_t milliseconds = 500;
- time1.tv_sec = 3;
- time1.tv_usec = 0;
- date_time::DateTime::AddMilliseconds(time1, milliseconds);
- ASSERT_EQ(3, time1.tv_sec);
- ASSERT_EQ(500000, time1.tv_usec);
+
+ AddMilliseconds(time1, milliseconds);
+ ASSERT_EQ(3, getSecs(time1));
+ ASSERT_EQ(500000, get_just_uSecs(time1));
}
TEST(DateTimeTest,
AddMilliseconds_SetMillisecondEqualNull_ExpectNotChangeTime) {
- TimevalStruct time1;
+ date_time::TimeDuration time1 = bpt::seconds(3);
uint32_t milliseconds = 0;
- time1.tv_sec = 3;
- time1.tv_usec = 0;
- date_time::DateTime::AddMilliseconds(time1, milliseconds);
- ASSERT_EQ(3, time1.tv_sec);
- ASSERT_EQ(0, time1.tv_usec);
+
+ AddMilliseconds(time1, milliseconds);
+ ASSERT_EQ(3, getSecs(time1));
+ ASSERT_EQ(0, get_just_mSecs(time1));
}
TEST(DateTimeTest, AddMilliseconds_SetOverlowMicrosecond_ExpectChangeTime) {
- TimevalStruct time1;
+ date_time::TimeDuration time1 = bpt::seconds(3);
uint32_t milliseconds = 7600;
- time1.tv_sec = 3;
- time1.tv_usec = 500000;
- date_time::DateTime::AddMilliseconds(time1, milliseconds);
- ASSERT_EQ(11, time1.tv_sec);
- ASSERT_EQ(100000, time1.tv_usec);
+
+ AddMilliseconds(time1, milliseconds);
+ ASSERT_EQ(10, getSecs(time1));
+ ASSERT_EQ(600000, get_just_uSecs(time1));
}
-TEST(DateTimeTest, Operator_minus_TimevalStruct_positive) {
- TimevalStruct time1;
- TimevalStruct time2;
- TimevalStruct time3;
- time1.tv_sec = 3;
- time1.tv_usec = 0;
- time2.tv_sec = 3;
- time2.tv_usec = 0;
- time3.tv_sec = 2;
- time3.tv_usec = 9000000;
- ASSERT_EQ(0, date_time::DateTime::getSecs(time1 - time2));
- ASSERT_EQ(8000000, date_time::DateTime::getuSecs(time3 - time1));
+TEST(DateTimeTest, Operator_minus_TimeDuration_positive) {
+ date_time::TimeDuration time1 = bpt::seconds(3);
+ date_time::TimeDuration time2 = bpt::seconds(3);
+ date_time::TimeDuration time3 =
+ bpt::seconds(2) + bpt::microseconds(9 * MICROSECONDS_IN_SECOND);
+ date_time::TimeDuration diff1 = time1 - time2;
+ ASSERT_EQ(0, getSecs(diff1));
+ ASSERT_EQ(8000000, getuSecs(time3 - time1));
}
-TEST(DateTimeTest, Operator_minus_TimevalStruct_negative) {
- TimevalStruct time1;
- TimevalStruct time2;
- time1.tv_sec = 3;
- time1.tv_usec = 0;
- time2.tv_sec = 2;
- time2.tv_usec = 9000000;
- ASSERT_NE(1, date_time::DateTime::getSecs(time1 - time2));
- ASSERT_NE(-8000000, date_time::DateTime::getSecs(time2 - time1));
+TEST(DateTimeTest, Operator_minus_TimeDuration_negative) {
+ date_time::TimeDuration time1 = bpt::seconds(3);
+ date_time::TimeDuration time2 =
+ bpt::seconds(2) + bpt::microseconds(9 * MICROSECONDS_IN_SECOND);
+
+ ASSERT_NE(1, getSecs(time1 - time2));
+ ASSERT_NE(-8000000, getSecs(time2 - time1));
}
} // namespace utils_test
diff --git a/src/components/utils/test/file_system_test.cc b/src/components/utils/test/file_system_test.cc
index 95469766f8..3d518e599f 100644
--- a/src/components/utils/test/file_system_test.cc
+++ b/src/components/utils/test/file_system_test.cc
@@ -32,8 +32,8 @@
#include <algorithm>
#include <fstream>
-#include <vector>
#include <string>
+#include <vector>
#include "gtest/gtest.h"
#include "utils/file_system.h"
@@ -57,7 +57,7 @@ StringArray MergeStringsToArray(const std::string& first,
return array_of_strings;
}
-}
+} // namespace
TEST(FileSystemTest, CreateDeleteDirectory) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
@@ -990,13 +990,13 @@ TEST(FileSystemTest,
TEST(FileSystemTest, WriteFileGetSize) {
ASSERT_FALSE(FileExists("./test file"));
EXPECT_TRUE(CreateFile("./test file"));
- EXPECT_EQ(0, FileSize("./test file"));
+ EXPECT_EQ(0u, FileSize("./test file"));
unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(Write("./test file", data));
- EXPECT_NE(0, FileSize("./test file"));
+ EXPECT_NE(0u, FileSize("./test file"));
EXPECT_TRUE(DeleteFile("./test file"));
EXPECT_FALSE(FileExists("./test file"));
@@ -1022,13 +1022,14 @@ TEST(FileSystemTest, GetFileModificationTime) {
EXPECT_TRUE(CreateFile("./test file"));
- uint64_t modif_time = GetFileModificationTime("./test file");
- EXPECT_LE(0ul, modif_time);
+ time_t modif_time = GetFileModificationTime("./test file");
+ EXPECT_LE(0ul, static_cast<unsigned long>(modif_time));
std::vector<uint8_t> data(1, 1);
EXPECT_TRUE(WriteBinaryFile("./test file", data));
- EXPECT_LE(0ul, GetFileModificationTime("./test file"));
+ EXPECT_LE(0ul,
+ static_cast<unsigned long>(GetFileModificationTime("./test file")));
EXPECT_LE(modif_time, GetFileModificationTime("./test file"));
EXPECT_TRUE(DeleteFile("./test file"));
diff --git a/src/components/utils/test/generated_code_with_sqlite_test.cc b/src/components/utils/test/generated_code_with_sqlite_test.cc
index 1c829c838c..b75ec5c58f 100644
--- a/src/components/utils/test/generated_code_with_sqlite_test.cc
+++ b/src/components/utils/test/generated_code_with_sqlite_test.cc
@@ -29,9 +29,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "utils/generated_code_with_sqlite_test.h"
#include <sqlite3.h>
#include "gtest/gtest.h"
-#include "utils/generated_code_with_sqlite_test.h"
namespace test {
namespace components {
diff --git a/src/components/utils/test/include/utils/generated_code_with_sqlite_test.h b/src/components/utils/test/include/utils/generated_code_with_sqlite_test.h
index e21fd75f87..0e75b8ba87 100644
--- a/src/components/utils/test/include/utils/generated_code_with_sqlite_test.h
+++ b/src/components/utils/test/include/utils/generated_code_with_sqlite_test.h
@@ -35,8 +35,8 @@
#include <string>
#include "policy/policy_table/types.h"
#include "rpc_base/rpc_base.h"
-#include "utils/sqlite_wrapper/sql_query.h"
#include "utils/sqlite_wrapper/sql_database.h"
+#include "utils/sqlite_wrapper/sql_query.h"
namespace test {
namespace components {
diff --git a/src/components/utils/test/include/utils/mock_signals_posix.h b/src/components/utils/test/include/utils/mock_signals_posix.h
new file mode 100644
index 0000000000..363708a668
--- /dev/null
+++ b/src/components/utils/test/include/utils/mock_signals_posix.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_UTILS_TEST_INCLUDE_UTILS_MOCK_SIGNALS_POSIX_H_
+#define SRC_COMPONENTS_UTILS_TEST_INCLUDE_UTILS_MOCK_SIGNALS_POSIX_H_
+
+#include <signal.h>
+#include "appMain/low_voltage_signals_handler.h"
+#include "gmock/gmock.h"
+#include "utils/signals.h"
+
+namespace utils {
+
+class MockSignalsPosix {
+ public:
+ MOCK_METHOD0(UnsubscribeFromTermination, bool());
+ MOCK_METHOD1(WaitTerminationSignals, bool(sighandler_t sig_handler));
+ MOCK_METHOD1(
+ UnsubscribeFromLowVoltageSignals,
+ bool(const main_namespace::LowVoltageSignalsOffset& offset_data));
+ MOCK_METHOD2(SendSignal, void(const int signo, const pid_t pid));
+ MOCK_METHOD0(Fork, pid_t());
+ MOCK_METHOD1(ExitProcess, void(const int status));
+ MOCK_METHOD3(WaitPid, void(pid_t cpid, int* status, int options));
+
+ static MockSignalsPosix* signals_posix_mock();
+};
+
+} // namespace utils
+#endif // SRC_COMPONENTS_UTILS_TEST_INCLUDE_UTILS_MOCK_SIGNALS_POSIX_H_
diff --git a/src/components/utils/test/lock_posix_test.cc b/src/components/utils/test/lock_boost_test.cc
index a78659ab31..0da735a990 100644
--- a/src/components/utils/test/lock_posix_test.cc
+++ b/src/components/utils/test/lock_boost_test.cc
@@ -38,8 +38,9 @@ namespace components {
namespace utils_test {
using sync_primitives::Lock;
+using sync_primitives::RecursiveLock;
-TEST(LockPosixTest, DefaultCtorTest_ExpectNonRecursiveMutexCreated) {
+TEST(LockBoostTest, TestNonRecursive) {
// Create Lock object
Lock test_mutex;
// Lock mutex
@@ -50,20 +51,9 @@ TEST(LockPosixTest, DefaultCtorTest_ExpectNonRecursiveMutexCreated) {
test_mutex.Release();
}
-TEST(LockPosixTest, CtorTestWithFalseArgument_ExpectNonRecursiveMutexCreated) {
+TEST(LockBoostTest, TestRecursive) {
// Create Lock object
- Lock test_mutex(false);
- // Lock mutex
- test_mutex.Acquire();
- // Check if created mutex is non-recursive
- EXPECT_FALSE(test_mutex.Try());
- // Release mutex before destroy
- test_mutex.Release();
-}
-
-TEST(LockPosixTest, CtorTestWithTrueArgument_ExpectRecursiveMutexCreated) {
- // Create Lock object
- Lock test_mutex(true);
+ RecursiveLock test_mutex;
// Lock mutex
test_mutex.Acquire();
// Check if created mutex is recursive
@@ -73,17 +63,7 @@ TEST(LockPosixTest, CtorTestWithTrueArgument_ExpectRecursiveMutexCreated) {
test_mutex.Release();
}
-TEST(LockPosixTest, AcquireMutex_ExpectMutexLocked) {
- // Create Lock object (non-recursive mutex)
- Lock test_mutex;
- // Lock mutex
- test_mutex.Acquire();
- // Try to lock it again. If locked expect false
- EXPECT_FALSE(test_mutex.Try());
- test_mutex.Release();
-}
-
-TEST(LockPosixTest, ReleaseMutex_ExpectMutexReleased) {
+TEST(LockBoostTest, ReleaseMutex_ExpectMutexReleased) {
// Create Lock object (non-recursive mutex)
Lock test_mutex;
// Lock mutex
@@ -95,7 +75,7 @@ TEST(LockPosixTest, ReleaseMutex_ExpectMutexReleased) {
test_mutex.Release();
}
-TEST(LockPosixTest, TryLockNonRecursiveMutex_ExpectMutexNotLockedTwice) {
+TEST(LockBoostTest, TryLockNonRecursiveMutex_ExpectMutexNotLockedTwice) {
// Create Lock object (non-recursive mutex)
Lock test_mutex;
// Lock mutex
@@ -105,9 +85,9 @@ TEST(LockPosixTest, TryLockNonRecursiveMutex_ExpectMutexNotLockedTwice) {
test_mutex.Release();
}
-TEST(LockPosixTest, TryLockRecursiveMutex_ExpectMutexLockedTwice) {
+TEST(LockBoostTest, TryLockRecursiveMutex_ExpectMutexLockedTwice) {
// Create Lock object (recursive mutex)
- Lock test_mutex(true);
+ RecursiveLock test_mutex;
// Lock mutex
test_mutex.Try();
// Try to lock it again. Expect true and internal counter increase
diff --git a/src/components/utils/test/log_message_loop_thread_test.cc b/src/components/utils/test/log_message_loop_thread_test.cc
index 032c7ecae1..74b1f5094f 100644
--- a/src/components/utils/test/log_message_loop_thread_test.cc
+++ b/src/components/utils/test/log_message_loop_thread_test.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
#include "utils/log_message_loop_thread.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
#include "utils/logger_status.h"
namespace test {
@@ -57,7 +57,7 @@ TEST(LogMessageLoopThread, DestroyLogMessage_loggerStatusDeletingLogger) {
logger::logger_status = LoggerThreadNotCreated;
}
-class MockLogMessageTest : public LogMessageHandler {
+class MockLogMessageTest : public LogMessageLoopThread {
public:
MOCK_CONST_METHOD1(Handle, void(const LogMessage message));
};
diff --git a/src/components/utils/test/message_queue_test.cc b/src/components/utils/test/message_queue_test.cc
index ddc1aa1d81..b3c654420a 100644
--- a/src/components/utils/test/message_queue_test.cc
+++ b/src/components/utils/test/message_queue_test.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "utils/message_queue.h"
#include <unistd.h>
#include "gtest/gtest.h"
-#include "utils/message_queue.h"
namespace test {
namespace components {
@@ -158,6 +158,8 @@ TEST_F(MessageQueueTest,
ASSERT_EQ(test_val_1, test_line);
// Check the size of queue after 1 element was removed
ASSERT_EQ(0u, test_queue.size());
+ pthread_join(thread1, NULL);
+ pthread_join(thread2, NULL);
}
TEST_F(MessageQueueTest,
@@ -169,6 +171,7 @@ TEST_F(MessageQueueTest,
test_queue.wait();
check_value = true;
ASSERT_TRUE(check_value);
+ pthread_join(thread1, NULL);
}
} // namespace utils_test
diff --git a/src/components/utils/test/messagemeter_test.cc b/src/components/utils/test/messagemeter_test.cc
index 4ec14ac1cc..fdfca113a8 100644
--- a/src/components/utils/test/messagemeter_test.cc
+++ b/src/components/utils/test/messagemeter_test.cc
@@ -1,44 +1,44 @@
/*
-* Copyright (c) 2015, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
#include <unistd.h>
-#include "gtest/gtest.h"
#include "gmock/gmock.h"
+#include "gtest/gtest.h"
#include "utils/macro.h"
-#include "utils/messagemeter.h"
#include "utils/date_time.h"
+#include "utils/messagemeter.h"
namespace test {
namespace components {
@@ -57,25 +57,25 @@ const TimePair testing_time_pairs[] = {TimePair(0, 50),
class MessageMeterTest : public ::testing::TestWithParam<TimePair> {
protected:
void SetUp() OVERRIDE {
- usecs = date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
+ usecs = date_time::MICROSECONDS_IN_MILLISECOND;
id1 = 0x0;
id2 = 0xABCDEF;
id3 = 0xFEBCDA;
const TimePair time_pair = GetParam();
EXPECT_GT(usecs, time_pair.second) << "Wrong time (msecs) value";
+ time_range = date_time::seconds(time_pair.first) +
+ date_time::microseconds(time_pair.second * usecs);
- time_range.tv_sec = time_pair.first;
- time_range.tv_usec = time_pair.second * usecs;
- EXPECT_LT(0, date_time::DateTime::getuSecs(time_range))
+ EXPECT_LT(0, date_time::getuSecs(time_range))
<< "Wrong test case with null range value";
meter.set_time_range(time_range);
- time_range_msecs = date_time::DateTime::getmSecs(time_range);
+ time_range_msecs = date_time::getmSecs(time_range);
}
void TearDown() OVERRIDE {}
::utils::MessageMeter<int> meter;
- TimevalStruct time_range = {0, 0};
+ date_time::TimeDuration time_range = date_time::TimeDurationZero();
int64_t time_range_msecs;
int usecs;
int id1, id2, id3;
@@ -83,27 +83,25 @@ class MessageMeterTest : public ::testing::TestWithParam<TimePair> {
TEST(MessageMeterTest, DefaultTimeRange) {
const ::utils::MessageMeter<int> default_meter;
- const TimevalStruct time_second{1, 0};
+ const date_time::TimeDuration time_second = date_time::seconds(1);
EXPECT_EQ(time_second, default_meter.time_range());
}
TEST(MessageMeterTest, TimeRangeSetter) {
::utils::MessageMeter<int> meter;
- TimevalStruct time_range{0, 0};
+ date_time::TimeDuration time_range;
const int test_count_secs = 1000;
- // Skip 1000th msec value as wrong for TimevalStruct
+ // Skip 1000th msec value as wrong for date_time::TimeDuration
const int test_count_msecs = 999;
for (int sec = test_count_secs; sec >= 0; --sec) {
for (int msec = test_count_msecs; msec >= 0; --msec) {
- time_range.tv_sec = sec;
- time_range.tv_usec =
- msec * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
- // Setter TimevalStruct
+ time_range = date_time::seconds(sec) + date_time::milliseconds(msec);
+
+ // Setter date_time::TimeDuration
meter.set_time_range(time_range);
EXPECT_EQ(time_range, meter.time_range()) << sec << "." << msec << " sec";
// Setter mSecs
- meter.set_time_range(sec * date_time::DateTime::MILLISECONDS_IN_SECOND +
- msec);
+ meter.set_time_range(sec * date_time::MILLISECONDS_IN_SECOND + msec);
EXPECT_EQ(time_range, meter.time_range()) << sec << "." << msec << " sec";
}
}
@@ -113,7 +111,7 @@ TEST(MessageMeterTest, AddingWithNullTimeRange) {
::utils::MessageMeter<int> meter;
const int id1 = 1;
const int id2 = 2;
- const TimevalStruct null_time_range{0, 0};
+ const date_time::TimeDuration null_time_range = date_time::TimeDurationZero();
meter.set_time_range(null_time_range);
for (int i = 0; i < 10000; ++i) {
// 1st Connection
@@ -129,10 +127,10 @@ TEST(MessageMeterTest, AddingWithNullTimeRange) {
TEST_P(MessageMeterTest,
DISABLED_TrackMessage_AddingOverPeriod_CorrectCountOfMessages) {
size_t messages = 0;
- const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
+ const date_time::TimeDuration start_time = date_time::getCurrentTime();
// Add messages for less range period
int64_t time_span;
- while ((time_span = date_time::DateTime::calculateTimeSpan(start_time)) <
+ while ((time_span = date_time::calculateTimeSpan(start_time)) <
time_range_msecs) {
++messages;
@@ -153,10 +151,10 @@ TEST_P(MessageMeterTest,
TEST_P(MessageMeterTest,
DISABLED_TrackMessage_AddingOverPeriodMultiIds_CorrectCountOfMessages) {
size_t messages = 0;
- const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
+ const date_time::TimeDuration start_time = date_time::getCurrentTime();
// Add messages for less range period
int64_t time_span;
- while ((time_span = date_time::DateTime::calculateTimeSpan(start_time)) <
+ while ((time_span = date_time::calculateTimeSpan(start_time)) <
time_range_msecs) {
++messages;
@@ -188,14 +186,14 @@ TEST_P(MessageMeterTest,
TEST_P(MessageMeterTest,
DISABLED_Frequency_CountingOverPeriod_CorrectCountOfMessages) {
const size_t one_message = 1;
- const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
+ const date_time::TimeDuration start_time = date_time::getCurrentTime();
EXPECT_EQ(one_message, meter.TrackMessage(id1));
EXPECT_EQ(one_message, meter.TrackMessage(id2));
EXPECT_EQ(one_message, meter.TrackMessage(id3));
// Check messages count over period
int64_t time_span;
- while ((time_span = date_time::DateTime::calculateTimeSpan(start_time)) <
+ while ((time_span = date_time::calculateTimeSpan(start_time)) <
time_range_msecs) {
usleep(time_range_msecs);
diff --git a/src/components/utils/test/mock_signals_posix.cc b/src/components/utils/test/mock_signals_posix.cc
new file mode 100644
index 0000000000..93c08a690d
--- /dev/null
+++ b/src/components/utils/test/mock_signals_posix.cc
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "utils/mock_signals_posix.h"
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+#include "utils/signals.h"
+
+namespace utils {
+
+bool Signals::UnsubscribeFromTermination() {
+ return MockSignalsPosix::signals_posix_mock()->UnsubscribeFromTermination();
+}
+
+bool Signals::WaitTerminationSignals(sighandler_t sig_handler) {
+ return MockSignalsPosix::signals_posix_mock()->WaitTerminationSignals(
+ sig_handler);
+}
+
+bool Signals::UnsubscribeFromLowVoltageSignals(
+ const main_namespace::LowVoltageSignalsOffset& offset_data) {
+ return MockSignalsPosix::signals_posix_mock()
+ ->UnsubscribeFromLowVoltageSignals(offset_data);
+}
+
+void Signals::SendSignal(const int signo, const pid_t pid) {
+ MockSignalsPosix::signals_posix_mock()->SendSignal(signo, pid);
+}
+
+void Signals::ExitProcess(const int status) {
+ MockSignalsPosix::signals_posix_mock()->ExitProcess(status);
+}
+
+void Signals::WaitPid(pid_t cpid, int* status, int options) {
+ MockSignalsPosix::signals_posix_mock()->WaitPid(cpid, status, options);
+}
+
+pid_t Signals::Fork() {
+ return MockSignalsPosix::signals_posix_mock()->Fork();
+}
+
+MockSignalsPosix* MockSignalsPosix::signals_posix_mock() {
+ static ::testing::NiceMock<MockSignalsPosix> signals_posix_mock;
+ return &signals_posix_mock;
+}
+
+} // namespace utils
diff --git a/src/components/utils/test/posix_thread_test.cc b/src/components/utils/test/posix_thread_test.cc
index a44e1b9b89..4bf0c8c092 100644
--- a/src/components/utils/test/posix_thread_test.cc
+++ b/src/components/utils/test/posix_thread_test.cc
@@ -52,7 +52,7 @@ const char* threadName("test thread");
const std::string test_thread_name("THREAD");
sync_primitives::ConditionalVariable cond_var_;
sync_primitives::Lock test_mutex_;
-};
+}; // namespace
// ThreadDelegate successor
class TestThreadDelegate : public threads::ThreadDelegate {
diff --git a/src/components/utils/test/prioritized_queue_test.cc b/src/components/utils/test/prioritized_queue_test.cc
index 082ff56713..ed22c2db48 100644
--- a/src/components/utils/test/prioritized_queue_test.cc
+++ b/src/components/utils/test/prioritized_queue_test.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "utils/prioritized_queue.h"
+#include "gtest/gtest.h"
namespace test {
namespace components {
diff --git a/src/components/utils/test/qdb_wrapper/sql_database_test.cc b/src/components/utils/test/qdb_wrapper/sql_database_test.cc
index 4e1a822b57..33dfe69119 100644
--- a/src/components/utils/test/qdb_wrapper/sql_database_test.cc
+++ b/src/components/utils/test/qdb_wrapper/sql_database_test.cc
@@ -33,11 +33,11 @@
#include "gtest/gtest.h"
-#include "qdb_wrapper/sql_error.h"
#include "qdb_wrapper/sql_database.h"
+#include "qdb_wrapper/sql_error.h"
-using ::utils::dbms::SQLError;
using ::utils::dbms::SQLDatabase;
+using ::utils::dbms::SQLError;
namespace test {
namespace components {
diff --git a/src/components/utils/test/qdb_wrapper/sql_query_test.cc b/src/components/utils/test/qdb_wrapper/sql_query_test.cc
index e575e4f575..6279f4d8a1 100644
--- a/src/components/utils/test/qdb_wrapper/sql_query_test.cc
+++ b/src/components/utils/test/qdb_wrapper/sql_query_test.cc
@@ -34,12 +34,12 @@
#include "gtest/gtest.h"
-#include "qdb_wrapper/sql_error.h"
#include "qdb_wrapper/sql_database.h"
+#include "qdb_wrapper/sql_error.h"
#include "qdb_wrapper/sql_query.h"
-using ::utils::dbms::SQLError;
using ::utils::dbms::SQLDatabase;
+using ::utils::dbms::SQLError;
using ::utils::dbms::SQLQuery;
namespace test {
diff --git a/src/components/utils/test/resource_usage_test.cc b/src/components/utils/test/resource_usage_test.cc
index 96b4fe4b49..ac8825c841 100644
--- a/src/components/utils/test/resource_usage_test.cc
+++ b/src/components/utils/test/resource_usage_test.cc
@@ -34,8 +34,8 @@
#include "gtest/gtest.h"
#include "utils/macro.h"
-#include "utils/resource_usage.h"
#include "utils/file_system.h"
+#include "utils/resource_usage.h"
namespace utils {
@@ -80,7 +80,7 @@ TEST_F(ResourceUsagePrivateTest, GetProcPathTest) {
// assert
EXPECT_EQ(filename, fd + "/stat");
}
-}
+} // namespace utils
namespace test {
namespace components {
diff --git a/src/components/utils/test/scope_guard_test.cc b/src/components/utils/test/scope_guard_test.cc
index 5e685d6aba..1f9224effa 100644
--- a/src/components/utils/test/scope_guard_test.cc
+++ b/src/components/utils/test/scope_guard_test.cc
@@ -30,18 +30,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gmock/gmock.h"
#include "utils/scope_guard.h"
+#include "gmock/gmock.h"
#include "utils/macro.h"
namespace test {
namespace components {
namespace utils_test {
-using ::utils::ScopeGuard;
+using ::testing::Mock;
using ::utils::MakeGuard;
using ::utils::MakeObjGuard;
-using ::testing::Mock;
+using ::utils::ScopeGuard;
class TestCalleeObject {
public:
@@ -55,7 +55,7 @@ void dealloc(char* ptr) {
delete ptr;
++call_with_param_count;
}
-}
+} // namespace
TEST(ScopeGuardTest, CallFreeFunctionWithParam) {
{
@@ -118,4 +118,4 @@ TEST(ScopeGuardTest, DismissCallObjectFunctionWithParam) {
} // namespace utils_test
} // namespace components
-} // namesapce test
+} // namespace test
diff --git a/src/components/utils/test/shared_ptr_test.cc b/src/components/utils/test/shared_ptr_test.cc
deleted file mode 100644
index 99fe4f7dd7..0000000000
--- a/src/components/utils/test/shared_ptr_test.cc
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdlib.h>
-#include <vector>
-#include <iostream>
-#include "gmock/gmock.h"
-#include "utils/shared_ptr.h"
-
-namespace test {
-namespace components {
-namespace utils_test {
-
-class CMockObject {
- public:
- CMockObject(int id);
- virtual ~CMockObject();
- virtual int getId() const;
-
- MOCK_METHOD0(destructor, void());
-
- private:
- int mId_;
-};
-
-class CExtendedMockObject : public CMockObject {
- public:
- CExtendedMockObject(int id);
-};
-
-using ::testing::NiceMock;
-
-CMockObject::CMockObject(int id) : mId_(id) {}
-
-CMockObject::~CMockObject() {
- destructor();
-}
-
-int CMockObject::getId() const {
- return mId_;
-}
-
-CExtendedMockObject::CExtendedMockObject(int id) : CMockObject(id) {}
-
-typedef utils::SharedPtr<CMockObject> tMockObjectPtr;
-typedef utils::SharedPtr<CExtendedMockObject> tExtendedMockObjectPtr;
-
-TEST(SharedPtrTest, DefaultConstructorTest) {
- // Constructor checks
- tMockObjectPtr p0;
- ASSERT_EQ(0, p0.get());
- ASSERT_FALSE(p0.valid());
-}
-
-TEST(SharedPtrTest, ConstructorWithOneParameterTest) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- EXPECT_CALL(*object1, destructor()).Times(1);
-
- // Constructor checks
- tMockObjectPtr p1(object1);
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(1u, *(p1.get_ReferenceCounter()));
-}
-
-TEST(SharedPtrTest, CopyConstructorTest) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- EXPECT_CALL(*object1, destructor()).Times(1);
-
- // Constructor checks
- tMockObjectPtr p1(object1);
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(1u, *(p1.get_ReferenceCounter()));
-
- tMockObjectPtr p2(p1);
- ASSERT_EQ(1, p2->getId());
- ASSERT_EQ(2u, *(p2.get_ReferenceCounter()));
- tMockObjectPtr p3 = p2;
- ASSERT_EQ(1, p3->getId());
- ASSERT_EQ(3u, *(p3.get_ReferenceCounter()));
- {
- tMockObjectPtr p4 = p3;
- ASSERT_EQ(1, p4->getId());
- ASSERT_EQ(4u, *(p3.get_ReferenceCounter()));
- }
- // Check reference counter decreased
- ASSERT_EQ(3u, *(p3.get_ReferenceCounter()));
-}
-
-TEST(SharedPtrTest, SecondConstructorWithOneParameterTest) {
- // Arrange
- CExtendedMockObject* object1 = new CExtendedMockObject(2);
- EXPECT_CALL(*object1, destructor()).Times(0);
-
- // Constructors checks
- tExtendedMockObjectPtr p1(object1);
- ASSERT_EQ(2, p1->getId());
- ASSERT_EQ(1u, *(p1.get_ReferenceCounter()));
-
- tMockObjectPtr p2(p1);
- ASSERT_EQ(2, p2->getId());
- ASSERT_EQ(2u, *(p2.get_ReferenceCounter()));
- EXPECT_CALL(*object1, destructor());
-}
-
-TEST(SharedPtrTest, AssignmentOperatorTest) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- CMockObject* object2 = new CMockObject(2);
-
- EXPECT_CALL(*object1, destructor()).Times(0);
- EXPECT_CALL(*object2, destructor()).Times(0);
-
- tMockObjectPtr p1(object1);
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(1u, *(p1.get_ReferenceCounter()));
-
- tMockObjectPtr p2(object2);
- ASSERT_EQ(2, p2->getId());
- ASSERT_EQ(1u, *(p2.get_ReferenceCounter()));
-
- tMockObjectPtr p3(p1);
- ASSERT_EQ(1, p3->getId());
- ASSERT_EQ(2u, *(p3.get_ReferenceCounter()));
-
- tMockObjectPtr p4(p3);
- ASSERT_EQ(1, p4->getId());
- ASSERT_EQ(3u, *(p4.get_ReferenceCounter()));
-
- tMockObjectPtr p5(p4);
- ASSERT_EQ(1, p5->getId());
- ASSERT_EQ(4u, *(p5.get_ReferenceCounter()));
-
- p5 = p2;
-
- // Check reference counter for new SharedPtr increased
- ASSERT_EQ(2, p5->getId());
- ASSERT_EQ(2u, *(p5.get_ReferenceCounter()));
-
- // Check reference counter for old SharedPtr decreased
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(3u, *(p1.get_ReferenceCounter()));
-
- EXPECT_CALL(*object1, destructor());
- EXPECT_CALL(*object2, destructor());
-}
-
-TEST(SharedPtrTest, SecondAssignmentOperatorTest) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- CExtendedMockObject* object2 = new CExtendedMockObject(2);
-
- EXPECT_CALL(*object1, destructor()).Times(0);
- EXPECT_CALL(*object2, destructor()).Times(0);
-
- tMockObjectPtr p1(object1);
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(1u, *(p1.get_ReferenceCounter()));
-
- tExtendedMockObjectPtr p2(object2);
- ASSERT_EQ(2, p2->getId());
- ASSERT_EQ(1u, *(p2.get_ReferenceCounter()));
-
- tMockObjectPtr p3(p1);
- ASSERT_EQ(1, p3->getId());
- ASSERT_EQ(2u, *(p3.get_ReferenceCounter()));
-
- tMockObjectPtr p4(p3);
- ASSERT_EQ(1, p4->getId());
- ASSERT_EQ(3u, *(p4.get_ReferenceCounter()));
-
- tMockObjectPtr p5(p4);
- ASSERT_EQ(1, p5->getId());
- ASSERT_EQ(4u, *(p5.get_ReferenceCounter()));
- // Use assignment operator
- p5 = p2;
-
- // Check reference counter for new SharedPtr increased
- ASSERT_EQ(2, p5->getId());
- ASSERT_EQ(2u, *(p5.get_ReferenceCounter()));
-
- // Check reference counter for old SharedPtr decreased
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(3u, *(p1.get_ReferenceCounter()));
-
- EXPECT_CALL(*object1, destructor());
- EXPECT_CALL(*object2, destructor());
-}
-
-TEST(SharedPtrTest, EqualOperatorTest) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- CMockObject* object2 = new CMockObject(2);
-
- EXPECT_CALL(*object1, destructor()).Times(0);
- EXPECT_CALL(*object2, destructor()).Times(0);
-
- tMockObjectPtr p1(object1);
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(1u, *(p1.get_ReferenceCounter()));
-
- tMockObjectPtr p2(object2);
- ASSERT_EQ(2, p2->getId());
- ASSERT_EQ(1u, *(p2.get_ReferenceCounter()));
-
- tMockObjectPtr p3(p1);
- ASSERT_EQ(1, p3->getId());
- ASSERT_EQ(2u, *(p3.get_ReferenceCounter()));
-
- tMockObjectPtr p4(p3);
- ASSERT_EQ(1, p4->getId());
- ASSERT_EQ(3u, *(p4.get_ReferenceCounter()));
-
- tMockObjectPtr p5(p4);
- ASSERT_EQ(1, p5->getId());
- ASSERT_EQ(4u, *(p5.get_ReferenceCounter()));
- // Checks
- ASSERT_TRUE(p1 == p3);
- ASSERT_TRUE(p1 == p4);
- ASSERT_TRUE(p4 == p3);
- ASSERT_FALSE(p1 == p2);
-
- EXPECT_CALL(*object1, destructor());
- EXPECT_CALL(*object2, destructor());
-}
-
-TEST(SharedPtrTest, LessThanOperatorTest) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- CMockObject* object2 = new CMockObject(2);
-
- EXPECT_CALL(*object1, destructor()).Times(0);
- EXPECT_CALL(*object2, destructor()).Times(0);
-
- tMockObjectPtr p1(object1);
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(1u, *(p1.get_ReferenceCounter()));
-
- tMockObjectPtr p2(object2);
- ASSERT_EQ(2, p2->getId());
- ASSERT_EQ(1u, *(p2.get_ReferenceCounter()));
-
- // Checks
- if (object1 < object2) {
- ASSERT_TRUE(p1 < p2);
- } else {
- ASSERT_FALSE(p1 < p2);
- }
-
- EXPECT_CALL(*object1, destructor());
- EXPECT_CALL(*object2, destructor());
-}
-
-TEST(SharedPtrTest, StaticPointerCastTest_DerivedToBase_ExpectCastOk) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- CExtendedMockObject* object2 = new CExtendedMockObject(2);
-
- EXPECT_CALL(*object1, destructor()).Times(1);
- EXPECT_CALL(*object2, destructor()).Times(0);
-
- tMockObjectPtr p1(object1);
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(1u, *(p1.get_ReferenceCounter()));
-
- tExtendedMockObjectPtr ep1(object2);
- ASSERT_EQ(2, ep1->getId());
- ASSERT_EQ(1u, *(ep1.get_ReferenceCounter()));
- // Cast from SharedPtr to Derived class to SharedPtr to Base class
- p1 = utils::SharedPtr<CExtendedMockObject>::static_pointer_cast<CMockObject>(
- ep1);
- // Checks
- ASSERT_EQ(2, p1->getId());
- ASSERT_EQ(2u, *(p1.get_ReferenceCounter()));
- ASSERT_TRUE(p1 == ep1);
-
- EXPECT_CALL(*object2, destructor());
-}
-
-TEST(SharedPtrTest, StaticPointerCastTest_BaseToDerived_ExpectCastOk) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- CExtendedMockObject* object2 = new CExtendedMockObject(2);
-
- EXPECT_CALL(*object1, destructor()).Times(0);
- EXPECT_CALL(*object2, destructor()).Times(1);
-
- tMockObjectPtr p1(object1);
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(1u, *(p1.get_ReferenceCounter()));
-
- tExtendedMockObjectPtr ep1(object2);
- ASSERT_EQ(2, ep1->getId());
- ASSERT_EQ(1u, *(ep1.get_ReferenceCounter()));
- // Cast from SharedPtr to Base class to SharedPtr to Derived class
- ep1 = utils::SharedPtr<CMockObject>::static_pointer_cast<CExtendedMockObject>(
- p1);
- // Checks
- ASSERT_EQ(1, ep1->getId());
- ASSERT_EQ(2u, *(ep1.get_ReferenceCounter()));
- ASSERT_TRUE(p1 == ep1);
-
- EXPECT_CALL(*object1, destructor());
-}
-
-TEST(SharedPtrTest, DynamicPointerCastTest_DerivedToBase_ExpectCastOk) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- CExtendedMockObject* object2 = new CExtendedMockObject(2);
-
- EXPECT_CALL(*object1, destructor()).Times(1);
- EXPECT_CALL(*object2, destructor()).Times(0);
-
- tMockObjectPtr p1(object1);
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(1u, *(p1.get_ReferenceCounter()));
-
- tExtendedMockObjectPtr ep1(object2);
- ASSERT_EQ(2, ep1->getId());
- ASSERT_EQ(1u, *(ep1.get_ReferenceCounter()));
- // Cast from SharedPtr to Derived class to SharedPtr to Base class
- p1 = utils::SharedPtr<CExtendedMockObject>::dynamic_pointer_cast<CMockObject>(
- ep1);
- // Checks
- ASSERT_EQ(2, p1->getId());
- ASSERT_EQ(2u, *(p1.get_ReferenceCounter()));
- ASSERT_TRUE(p1 == ep1);
-
- EXPECT_CALL(*object2, destructor());
-}
-
-TEST(SharedPtrTest, DynamicPointerCastTest_BaseToDerived_ExpectNullPtr) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- CExtendedMockObject* object2 = new CExtendedMockObject(2);
-
- EXPECT_CALL(*object1, destructor()).Times(0);
- EXPECT_CALL(*object2, destructor()).Times(1);
-
- tMockObjectPtr p1(object1);
- ASSERT_EQ(1, p1->getId());
- ASSERT_EQ(1u, *(p1.get_ReferenceCounter()));
-
- tExtendedMockObjectPtr ep1(object2);
- ASSERT_EQ(2, ep1->getId());
- ASSERT_EQ(1u, *(ep1.get_ReferenceCounter()));
- // Cast from SharedPtr to Base class to SharedPtr to Derived class
- ep1 =
- utils::SharedPtr<CMockObject>::dynamic_pointer_cast<CExtendedMockObject>(
- p1);
- // Checks
- ASSERT_EQ(NULL, ep1);
-
- EXPECT_CALL(*object1, destructor());
-}
-
-TEST(SharedPtrTest, ArrowOperatorTest) {
- // Arrange
- CExtendedMockObject* object1 = new CExtendedMockObject(1);
- CExtendedMockObject* object2 = new CExtendedMockObject(2);
-
- EXPECT_CALL(*object1, destructor()).Times(1);
- EXPECT_CALL(*object2, destructor()).Times(1);
-
- tExtendedMockObjectPtr ep1(object1);
- // Check
- ASSERT_EQ(1, ep1->getId());
-
- tMockObjectPtr p1(ep1);
- // Check
- ASSERT_EQ(1, p1->getId());
-
- tExtendedMockObjectPtr ep2(object2);
- // Check
- ASSERT_EQ(2, ep2->getId());
-}
-
-TEST(SharedPtrTest, DereferenceOperatorTest) {
- // Arrange
- CExtendedMockObject* object1 = new CExtendedMockObject(1);
- CExtendedMockObject* object2 = new CExtendedMockObject(2);
-
- EXPECT_CALL(*object1, destructor()).Times(1);
- EXPECT_CALL(*object2, destructor()).Times(1);
-
- tExtendedMockObjectPtr ep1(object1);
- // Check
- ASSERT_EQ(1, (*ep1).getId());
-
- tMockObjectPtr p1(ep1);
- // Check
- ASSERT_EQ(1, (*p1).getId());
-
- tExtendedMockObjectPtr ep2(object2);
- // Check
- ASSERT_EQ(2, (*ep2).getId());
-}
-
-TEST(SharedPtrTest, BoolOperatorTest) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- tMockObjectPtr p1(object1);
- tMockObjectPtr p2;
-
- // Checks
- ASSERT_TRUE(p1);
- ASSERT_FALSE(p2);
- EXPECT_CALL(*object1, destructor());
-}
-
-TEST(SharedPtrTest, ResetWithoutArgsTest) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- CMockObject* object2 = new CMockObject(2);
-
- EXPECT_CALL(*object1, destructor()).Times(1);
- EXPECT_CALL(*object2, destructor()).Times(1);
-
- tMockObjectPtr p1(object1);
- tMockObjectPtr p2(object2);
- ASSERT_EQ(2, p2->getId());
- ASSERT_EQ(1u, *(p2.get_ReferenceCounter()));
-
- tMockObjectPtr p3(p1);
- tMockObjectPtr p4(p3);
- ASSERT_EQ(1, p4->getId());
- ASSERT_EQ(3u, *(p4.get_ReferenceCounter()));
- // Act
- p2.reset();
- // Check
- EXPECT_EQ(NULL, p2.get());
- EXPECT_EQ(1u, *(p2.get_ReferenceCounter()));
- p4.reset();
- // Check
- EXPECT_EQ(NULL, p4.get());
- EXPECT_EQ(1u, *(p4.get_ReferenceCounter()));
-}
-
-TEST(SharedPtrTest, ResetWithArgumentTest) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- CMockObject* object2 = new CMockObject(27);
-
- EXPECT_CALL(*object1, destructor()).Times(1);
- EXPECT_CALL(*object2, destructor()).Times(1);
-
- tMockObjectPtr p1(object1);
- tMockObjectPtr p3(p1);
- tMockObjectPtr p4(p3);
- ASSERT_EQ(1, p4->getId());
- ASSERT_EQ(3u, *(p4.get_ReferenceCounter()));
- // Act
- p4.reset(object2);
- // Check
- EXPECT_EQ(27, (*p4).getId());
- EXPECT_EQ(1u, *(p4.get_ReferenceCounter()));
-}
-
-TEST(SharedPtrTest, GetMethodTest_ExpectObjPointer) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- EXPECT_CALL(*object1, destructor()).Times(1);
- tMockObjectPtr p1(object1);
- // Check
- ASSERT_EQ(object1, p1.get());
-}
-
-TEST(SharedPtrTest, ValidMethodTest_ExpectCorrectValidation) {
- // Arrange
- CMockObject* object1 = new CMockObject(1);
- EXPECT_CALL(*object1, destructor()).Times(1);
-
- tMockObjectPtr p1(object1);
- tMockObjectPtr p2;
- // Check
- ASSERT_TRUE(p1.valid());
- ASSERT_FALSE(p2.valid());
-}
-
-TEST(SharedPtrTest, DISABLED_StressTest) {
- // Arrange
- const size_t kNumIterations = 1024U * 1024U;
-
- size_t objectCreated = 0U;
- size_t pointersCopied = 0U;
- std::vector<tMockObjectPtr> objects;
-
- for (size_t i = 0U; i < kNumIterations; ++i) {
- if ((true == objects.empty()) || (0 == rand() % 256)) {
- CMockObject* object = new CMockObject(0);
- EXPECT_CALL(*object, destructor());
- objects.push_back(object);
- ++objectCreated;
- } else {
- size_t objectIndex = static_cast<size_t>(rand()) % objects.size();
-
- if (rand() % 2) {
- objects.push_back(objects[objectIndex]);
- ++pointersCopied;
- } else {
- objects.erase(objects.begin() + objectIndex);
- }
- }
- }
- printf("%zu objects created, %zu pointers copied\n",
- objectCreated,
- pointersCopied);
-}
-
-} // namespace utils_test
-} // namespace components
-} // namespace test
diff --git a/src/components/utils/test/singleton_test.cc b/src/components/utils/test/singleton_test.cc
index ae05b6cbab..a38f51726c 100644
--- a/src/components/utils/test/singleton_test.cc
+++ b/src/components/utils/test/singleton_test.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "utils/singleton.h"
#include <pthread.h>
+#include "gtest/gtest.h"
namespace test {
namespace components {
diff --git a/src/components/utils/test/sqlite_wrapper/sql_database_test.cc b/src/components/utils/test/sqlite_wrapper/sql_database_test.cc
index 9732fbe078..0195e02121 100644
--- a/src/components/utils/test/sqlite_wrapper/sql_database_test.cc
+++ b/src/components/utils/test/sqlite_wrapper/sql_database_test.cc
@@ -1,40 +1,40 @@
/* Copyright (c) 2014, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "utils/sqlite_wrapper/sql_database.h"
#include "gtest/gtest.h"
#include "utils/sqlite_wrapper/sql_error.h"
-#include "utils/sqlite_wrapper/sql_database.h"
-using ::utils::dbms::SQLError;
using ::utils::dbms::SQLDatabase;
+using ::utils::dbms::SQLError;
namespace test {
namespace components {
diff --git a/src/components/utils/test/sqlite_wrapper/sql_query_test.cc b/src/components/utils/test/sqlite_wrapper/sql_query_test.cc
index c10c26a2c7..b2d3c747cd 100644
--- a/src/components/utils/test/sqlite_wrapper/sql_query_test.cc
+++ b/src/components/utils/test/sqlite_wrapper/sql_query_test.cc
@@ -29,17 +29,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string>
#include <sqlite3.h>
+#include <string>
#include "gtest/gtest.h"
-#include "utils/sqlite_wrapper/sql_error.h"
#include "utils/sqlite_wrapper/sql_database.h"
+#include "utils/sqlite_wrapper/sql_error.h"
#include "utils/sqlite_wrapper/sql_query.h"
-using ::utils::dbms::SQLError;
using ::utils::dbms::SQLDatabase;
+using ::utils::dbms::SQLError;
using ::utils::dbms::SQLQuery;
namespace test {
diff --git a/src/components/utils/test/stl_utils_test.cc b/src/components/utils/test/stl_utils_test.cc
index 5250a7a514..c2701c1558 100644
--- a/src/components/utils/test/stl_utils_test.cc
+++ b/src/components/utils/test/stl_utils_test.cc
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <vector>
+#include "utils/stl_utils.h"
#include <map>
+#include <vector>
#include "gtest/gtest.h"
-#include "utils/stl_utils.h"
namespace test {
namespace components {
diff --git a/src/components/utils/test/system_test.cc b/src/components/utils/test/system_test.cc
index b479823aa5..b9daa575ba 100644
--- a/src/components/utils/test/system_test.cc
+++ b/src/components/utils/test/system_test.cc
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gmock/gmock.h"
#include "utils/system.h"
+#include "gmock/gmock.h"
namespace test {
namespace components {
diff --git a/src/components/utils/test/test_generator/CMakeLists.txt b/src/components/utils/test/test_generator/CMakeLists.txt
index 5a7f939659..cd4243930a 100644
--- a/src/components/utils/test/test_generator/CMakeLists.txt
+++ b/src/components/utils/test/test_generator/CMakeLists.txt
@@ -41,8 +41,8 @@ include_directories (
set(XML_NAME ${CMAKE_SOURCE_DIR}/src/components/interfaces/MOBILE_API.xml)
add_custom_target(generate_version
- COMMAND ${INTEFRACE_GENERATOR_CMD} ${XML_NAME} "mobile_apis"
- ${CMAKE_CURRENT_BINARY_DIR} "--parser-type" "sdlrpcv2"
+ COMMAND ${INTEFRACE_GENERATOR_CMD} "--source-xml" "${XML_NAME}" "--namespace" "mobile_apis"
+ "--output-dir" "${CMAKE_CURRENT_BINARY_DIR}" "--parser-type" "sdlrpcv2" "-y"
DEPENDS ${INTERFACE_GENERATOR_DEPENDENCIES} ${XML_NAME}
VERBATIM
)
diff --git a/src/components/utils/test/test_generator/generated_msg_version_test.cc b/src/components/utils/test/test_generator/generated_msg_version_test.cc
index c9647dcad0..4d1d70a5d6 100644
--- a/src/components/utils/test/test_generator/generated_msg_version_test.cc
+++ b/src/components/utils/test/test_generator/generated_msg_version_test.cc
@@ -30,11 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <iostream>
+#include "generated_msg_version.h"
#include <fstream>
+#include <iostream>
#include <string>
#include "gtest/gtest.h"
-#include "generated_msg_version.h"
#include "utils/file_system.h"
using namespace std;
diff --git a/src/components/utils/test/timer_test.cc b/src/components/utils/test/timer_test.cc
index ea5c9f0b84..d7b196876d 100644
--- a/src/components/utils/test/timer_test.cc
+++ b/src/components/utils/test/timer_test.cc
@@ -30,12 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
#include "utils/timer.h"
-#include "utils/mock_timer_task.h"
+#include "gtest/gtest.h"
#include "utils/conditional_variable.h"
#include "utils/lock.h"
#include "utils/macro.h"
+#include "utils/mock_timer_task.h"
#include "utils/timer_task_impl.h"
namespace test {
diff --git a/third_party.md b/third_party.md
new file mode 100644
index 0000000000..0737d7a657
--- /dev/null
+++ b/third_party.md
@@ -0,0 +1,103 @@
+### SDL CORE
+
+Copyright (C) 2018 - 2020, SmartDeviceLink Consortium, Inc.
+
+#### License
+Copyright (c) 2017 - 2020, SmartDeviceLink Consortium, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+* Neither the name of SmartDeviceLink Consortium, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#### Third Party Licenses
+
+Both the source and binary distributions of this software contain
+some third party software. All the third party software included
+or linked is redistributed under the terms and conditions of their
+original licenses.
+
+The third party software included and used by this project is:
+
+**googlemock 1.7.0**
+
+* Copyright 2008, Google Inc
+* Licensed under BSD 3-clause
+* The library is included in Google C++ Mocking Framework
+* See [https://github.com/google/googletest/tree/master/googlemock](https://github.com/google/googletest/tree/master/googlemock)
+
+**googlemock 1.7.0**
+
+* Copyright [2007] Neal Norwitz
+* Portions Copyright [2007] Google Inc
+* Licensed under the Apache License, Version 2.0
+* The library is included in the Google Mock class generator
+* See [https://github.com/google/googletest/tree/master/googlemock](https://github.com/google/googletest/tree/master/googlemock)
+
+**json-cpp 1.9.2**
+
+* Any copyright is dedicated to the Public Domain
+* The library is included as a git submodule in jsoncpp 3rd party static src folder
+* See [https://github.com/open-source-parsers/jsoncpp/releases/tag/1.9.2](https://github.com/open-source-parsers/jsoncpp/releases/tag/1.9.2)
+
+**Apache log4cxx 0.10.0**
+
+* Copyright 2004-2007 The Apache Software Foundation
+* Licensed under the Apache License, Version 2.0
+* The library is included in apache-log4cxx-0.10.0 3rd party src folder
+* See [https://github.com/apache/logging-log4cxx/releases](https://github.com/apache/logging-log4cxx/releases)
+
+**Apache Portable Runtime 1.5**
+
+* Copyright (c) 2000-2013 The Apache Software Foundation.
+* Licensed under the Apache License, Version 2.0.
+* The library is included in apr-1.5.0 3rd party src folder.
+* See [https://github.com/apache/apr/releases/tag/1.5.0](https://github.com/apache/apr/releases/tag/1.5.0)
+
+**Apache Portable Runtime Utility 1.5.3**
+
+* Copyright (c) 2000-2013 The Apache Software Foundation
+* Licensed under the Apache License, Version 2.0
+* The library is included in apr-util-1.5.3 3rd party src folder
+* See [https://github.com/apache/apr-util/releases/tag/1.5.3](https://github.com/apache/apr-util/releases/tag/1.5.3)
+
+**Apache Portable Runtime 1.5**
+
+* Copyright (c) 1987, 1992, 1993, 1994, The Regents of the University of California
+* Licensed under BSD 4-clause
+* The library is included in apr-1.5.0 3rd party src folder
+* See [https://github.com/apache/apr/releases/tag/1.5.0](https://github.com/apache/apr/releases/tag/1.5.0)
+
+**inetlib**
+
+* Copyright (c) 1996 by Internet Software Consortium
+* Licensed under ISC License
+* The library is included in the unix folder of network_io, under the apr-1.5.0 3rd party src folder
+
+**Expat 2.1.0**
+
+* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd and Clark Cooper
+* Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers
+* Licensed under MIT License
+* The library is included in expat-2.1.0 3rd party src folder
+* See [https://github.com/libexpat/libexpat/tree/defusedexpat-2.1.0/expat](https://github.com/libexpat/libexpat/tree/defusedexpat-2.1.0/expat)
+
+**Expat 2.1.0**
+
+* Licensed under GNU Free Documentation License v1.1
+* The library is included in the doc folder, under the expat-2.1.0 3rd party src folder
+* See [https://github.com/libexpat/libexpat/tree/defusedexpat-2.1.0/expat/doc](https://github.com/libexpat/libexpat/tree/defusedexpat-2.1.0/expat/doc)
+
+**Pugixml 1.2**
+
+* Copyright (C) 2006-2012, by Arseny Kapoulkine
+* Licensed under MIT License
+* The library is used as an XML processing library, located in the tools folder
+* See [https://github.com/zeux/pugixml/releases/tag/v1.2](https://github.com/zeux/pugixml/releases/tag/v1.2) \ No newline at end of file
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index cf3e2c692c..58a2cf5873 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -5,7 +5,8 @@ include(ExternalProject)
set(intergen_SOURCES "${CMAKE_CURRENT_LIST_DIR}/intergen")
set(intergen_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/intergen")
set(intergen_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/intergen")
-set(intergen_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_INSTALL_PREFIX=${intergen_INSTALL_DIR})
+set(intergen_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_INSTALL_PREFIX=${intergen_INSTALL_DIR} -DCMAKE_CXX_FLAGS="-std=gnu++0x")
+
ExternalProject_Add(intergen
SOURCE_DIR ${intergen_SOURCES}
diff --git a/tools/InterfaceGenerator/Generator.py b/tools/InterfaceGenerator/Generator.py
index 932620c153..6f90f62e71 100755
--- a/tools/InterfaceGenerator/Generator.py
+++ b/tools/InterfaceGenerator/Generator.py
@@ -16,108 +16,161 @@ optional arguments:
--parser-type {sdlrpcv2}
"""
-import os.path
-import argparse
-import errno
+import os
+import re
import sys
-
-import generator.parsers.SDLRPCV1
-import generator.parsers.SDLRPCV2
-import generator.parsers.JSONRPC
-import generator.generators.SmartFactorySDLRPC
-import generator.generators.SmartFactoryJSONRPC
-import MsgVersionGenerate
-
-from generator.parsers.RPCBase import ParseError
-from generator.generators.SmartFactoryBase import GenerateError
-
-SUPPORTED_FORMATS = {
- "sdlrpcv1": (generator.parsers.SDLRPCV1.Parser,
- generator.generators.SmartFactorySDLRPC.CodeGenerator),
- "sdlrpcv2": (generator.parsers.SDLRPCV2.Parser,
- generator.generators.SmartFactorySDLRPC.CodeGenerator),
- "jsonrpc": (generator.parsers.JSONRPC.Parser,
- generator.generators.SmartFactoryJSONRPC.CodeGenerator)
-}
-
-
-def _create_parser():
- """Create parser for parsing command-line arguments.
-
- Returns an instance of argparse.ArgumentParser
-
- """
-
- parser = argparse.ArgumentParser(
- description="SmartSchema interface generator"
- )
- parser.add_argument("source-xml")
- parser.add_argument("namespace")
- parser.add_argument("output-dir")
- parser.add_argument("--parser-type",
- choices=SUPPORTED_FORMATS.keys(),
- required=True)
- return parser
-
-
-def _handle_fatal_error(error):
- """Handle fatal error during parsing or code generation.
-
- Keyword arguments:
- error -- base exception to handle.
+from argparse import ArgumentParser
+from pathlib import Path
+
+ROOT = Path(__file__).absolute().parents[1]
+sys.path.append(ROOT.joinpath('rpc_spec/InterfaceParser').as_posix())
+
+try:
+ from model.interface import Interface
+ from parsers import sdl_rpc_v2
+ from parsers.parse_error import ParseError
+ from MsgVersionGenerate import generate_msg_version
+ from generator.generators import SmartFactorySDLRPC, SmartFactoryJSONRPC, PolicyTypes
+ from generator.generators.SmartFactoryBase import GenerateError
+ from generator.parsers import SDLRPCV1, JSONRPC
+except ModuleNotFoundError as error:
+ print(str(error) + '\nPlease make sure the RPC Spec Generator Submodule is initialized.\n'
+ 'Check the sdl_core source directory in `tools/rpc_spec`.\n'
+ 'Try running in the source directory:\n'
+ '$ git submodule init\n'
+ '$ git submodule update')
+ sys.exit(1)
+
+
+class Generator:
+ """Generator application that generates c++ interfaces code from xml description
"""
- print(error.message)
- print
- sys.exit(errno.EINVAL)
-
-def main():
- """Main function of the generator that does actual work."""
-
- args = vars(_create_parser().parse_args())
-
- src_xml = args["source-xml"]
- src_xml_name = os.path.splitext(os.path.basename(src_xml))[0]
- namespace = args["namespace"]
- output_dir = args["output-dir"]
- parser_type = args["parser_type"]
-
- print("""
+ def __init__(self):
+ self._supported_formats = {
+ 'sdlrpcv1': (SDLRPCV1.Parser, SmartFactorySDLRPC.CodeGenerator),
+ 'sdlrpcv2': (sdl_rpc_v2.Parser, SmartFactorySDLRPC.CodeGenerator),
+ 'jsonrpc': (JSONRPC.Parser, SmartFactoryJSONRPC.CodeGenerator),
+ 'mobile-policy-types': (sdl_rpc_v2.Parser, PolicyTypes.CodeGenerator),
+ 'hmi-policy-types': (JSONRPC.Parser, PolicyTypes.CodeGenerator)
+ }
+
+ @property
+ def supported_formats(self):
+ """
+ :return: dictionary with supported_formats
+ """
+ return self._supported_formats
+
+ def _create_parser(self):
+ """
+ Parsing command-line arguments, or evaluating required Paths interactively.
+ :return: an instance of argparse.ArgumentParser
+ """
+ if len(sys.argv) == 2 and sys.argv[1] in ('-v', '--version'):
+ print('1.0.0')
+ sys.exit(0)
+
+ parser = ArgumentParser(description='Proxy Library RPC Generator')
+ parser.add_argument('-xml', '--source-xml', '--input-file', required=True,
+ help='should point to MOBILE_API.xml')
+ parser.add_argument('-ns', '--namespace', required=True)
+ parser.add_argument('-d', '-o', '--output-dir', required=True,
+ help='define the place where the generated output should be placed')
+ parser.add_argument('-t', '--parser-type', required=True, choices=self.supported_formats.keys())
+ parser.add_argument('-v', '--version', action='store_true', help='print the version and exit')
+ parser.add_argument('-r', '--regex-pattern', required=False,
+ help='only elements matched with defined regex pattern will be parsed and generated')
+ parser.add_argument('--verbose', action='store_true', help='display additional details like logs etc')
+ parser.add_argument('-e', '--enums', required=False, action='store_true',
+ help='only specified elements will be generated, if present')
+ parser.add_argument('-s', '--structs', required=False, action='store_true',
+ help='only specified elements will be generated, if present')
+ parser.add_argument('-m', '-f', '--functions', required=False, action='store_true',
+ help='only specified elements will be generated, if present')
+ parser.add_argument('-y', '--overwrite', action='store_true',
+ help='force overwriting of existing files in output directory, ignore confirmation message')
+ parser.add_argument('-n', '--skip', action='store_true',
+ help='skip overwriting of existing files in output directory, ignore confirmation message')
+
+ args, unknown = parser.parse_known_args()
+
+ if unknown:
+ print('found unknown arguments: ' + ' '.join(unknown))
+ parser.print_help(sys.stderr)
+ sys.exit(1)
+
+ if args.skip and args.overwrite or not args.skip and not args.overwrite:
+ print('please select one option skip or overwrite')
+ sys.exit(1)
+
+ if not args.enums and not args.structs and not args.functions:
+ args.enums = args.structs = args.functions = True
+
+ return args
+
+ @staticmethod
+ def filter_pattern(interface, pattern):
+ """
+ Filtring model according to regex pattern
+ :param interface: Interface model
+ :param pattern: regex pattern
+ :return:
+ """
+ match = {i: {} for i in vars(interface).keys()}
+ match['params'] = interface.params
+ if pattern:
+ for key, value in vars(interface).items():
+ if key == 'params':
+ continue
+ for name, item in value.items():
+ if re.match(pattern, item.name):
+ if key in match:
+ match[key].update({name: item})
+ else:
+ return interface
+
+ return Interface(**match)
+
+ def main(self):
+ """Main function of the generator that does actual work."""
+
+ args = self._create_parser()
+
+ print("""
Generating interface source code with following parameters:
Source xml : {0}
Namespace : {1}
Output directory: {2}
Parser type : {3}
-""".format(src_xml, namespace, output_dir, parser_type))
+ overwrite : {4}
+""".format(args.source_xml, args.namespace, args.output_dir, args.parser_type, args.overwrite))
- # Select required parser and code generator
- parser = SUPPORTED_FORMATS[parser_type][0]()
- code_generator = SUPPORTED_FORMATS[parser_type][1]()
+ # Select required parser and code generator
+ parser = self.supported_formats[args.parser_type][0]()
+ code_generator = self.supported_formats[args.parser_type][1]()
- # Convert incoming xml to internal model
- try:
- interface = parser.parse(args["source-xml"])
- except ParseError as error:
- _handle_fatal_error(error)
-
- # Parse sdl version from MOBILE_API.xml and create source file with this version
- if src_xml_name == "MOBILE_API":
+ # Convert incoming xml to internal model
try:
- MsgVersionGenerate.generate_msg_version(src_xml, output_dir)
- except ParseError as error:
- _handle_fatal_error(error)
+ interface = parser.parse(args.source_xml)
+ filtered = self.filter_pattern(interface, args.regex_pattern)
+ src_xml_name = os.path.splitext(os.path.basename(args.source_xml))[0]
+ # Parse sdl version from MOBILE_API.xml and create source file with this version
+ if src_xml_name == "MOBILE_API":
+ generate_msg_version(args.source_xml, args.output_dir)
+
+ # Generate SmartFactory source code from internal model
+ code_generator.generate(filtered,
+ src_xml_name,
+ args.namespace,
+ args.output_dir)
+ except (ParseError, GenerateError) as error1:
+ print(error1)
+ sys.exit(1)
- # Generate SmartFactory source code from internal model
- try:
- code_generator.generate(interface,
- src_xml_name,
- namespace,
- output_dir)
- except GenerateError as error:
- _handle_fatal_error(error)
+ print('Done.')
- print("Done.")
if __name__ == '__main__':
- main()
+ Generator().main()
diff --git a/tools/InterfaceGenerator/MsgVersionGenerate.py b/tools/InterfaceGenerator/MsgVersionGenerate.py
index 86251cd419..85b3cfd38f 100644
--- a/tools/InterfaceGenerator/MsgVersionGenerate.py
+++ b/tools/InterfaceGenerator/MsgVersionGenerate.py
@@ -4,27 +4,40 @@ Generate file with major and minor msg_version.
import xml.etree.ElementTree
from string import Template
import re
-from generator.parsers import RPCBase
-
+
+from parsers.parse_error import ParseError
+
+
def generate_msg_version(file_name, path_to_storage):
"""Parses MOBILE_API.xml in order to
receive major_version, minor_version, and patch_version
"""
tree = xml.etree.ElementTree.parse(file_name)
root = tree.getroot()
- if (root.tag == "interface" and "version" in root.attrib):
+ if (root.tag == "interface" and "version" and "minVersion" in root.attrib):
check_version_format(root.attrib["version"])
array = (root.attrib["version"]).split(".")
major_version = array[0]
minor_version = array[1]
patch_version = array[2]
- if (major_version.isdigit() and minor_version.isdigit() and patch_version.isdigit):
- data_for_storage = prepare_data_for_storage(major_version, minor_version, patch_version)
+
+ check_minimum_version_format(root.attrib["minVersion"])
+ minimum_version_array = (root.attrib["minVersion"]).split(".")
+ if (len(minimum_version_array) == 2):
+ minimum_version_array.append("0")
+ minimum_major_version = minimum_version_array[0]
+ minimum_minor_version = minimum_version_array[1]
+ minimum_patch_version = minimum_version_array[2]
+
+ if (major_version.isdigit() and minor_version.isdigit() and patch_version.isdigit() and
+ minimum_major_version.isdigit() and minimum_minor_version.isdigit() and minimum_patch_version.isdigit()):
+ data_for_storage = prepare_data_for_storage(major_version, minor_version, patch_version,
+ minimum_major_version, minimum_minor_version, minimum_patch_version)
store_data_to_file(path_to_storage, data_for_storage)
else:
- raise RPCBase.ParseError("Attribute version has incorect value in MOBILE_API.xml")
+ raise ParseError("Attribute version has incorect value in MOBILE_API.xml")
else:
- raise RPCBase.ParseError("Check MOBILE_API.xml file, parser can not find first element "
+ raise ParseError("Check MOBILE_API.xml file, parser can not find first element "
" with tag interface or atribute version")
def store_data_to_file(path_to_storage, data_for_storage):
@@ -42,14 +55,23 @@ def check_version_format(version):
p = re.compile('\d+\\.\d+\\.\d+')
result = p.match(version)
if result == None or (result.end() != len(version)):
- raise RPCBase.ParseError("Incorrect format of version please check MOBILE_API.xml. "
+ raise ParseError("Incorrect format of version please check MOBILE_API.xml. "
"Need format of version major_version.minor_version.patch_version")
-def prepare_data_for_storage(major_version, minor_version, patch_version):
+
+def check_minimum_version_format(version):
+ """Checks correctness of format of version
+ """
+ p = re.compile('\d+\\.\d+\\.\d+|\d+\\.\d+')
+ result = p.match(version)
+ if result == None or (result.end() != len(version)):
+ raise ParseError("Incorrect format of version please check MOBILE_API.xml. "
+ "Need format of minVersion major_version.minor_version or major_version.minor_version.patch_version")
+def prepare_data_for_storage(major_version, minor_version, patch_version, minimum_major_version, minimum_minor_version, minimum_patch_version):
"""Prepares data to store to file.
"""
temp = Template(
- u'''/*Copyright (c) 2016, Ford Motor Company\n'''
+ u'''/*Copyright (c) 2019, SmartDeviceLink Consortium, Inc.\n'''
u'''All rights reserved.\n'''
u'''Redistribution and use in source and binary forms, with or without\n'''
u'''modification, are permitted provided that the following conditions are met:\n'''
@@ -59,9 +81,9 @@ def prepare_data_for_storage(major_version, minor_version, patch_version):
u'''this list of conditions and the following\n'''
u'''disclaimer in the documentation and/or other materials provided with the\n'''
u'''distribution.\n'''
- u'''Neither the name of the Ford Motor Company nor the names of its contributors\n'''
- u'''may be used to endorse or promote products derived from this software\n'''
- u'''without specific prior written permission.\n'''
+ u'''Neither the name of the SmartDeviceLink Consortium, Inc. nor the names of its\n'''
+ u'''contributors may be used to endorse or promote products derived from this\n'''
+ u'''software without specific prior written permission.\n'''
u'''THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n'''
u'''AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n'''
u'''IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n'''
@@ -76,12 +98,17 @@ def prepare_data_for_storage(major_version, minor_version, patch_version):
u'''*/\n'''
u'''#ifndef GENERATED_MSG_VERSION_H\n'''
u'''#define GENERATED_MSG_VERSION_H\n\n'''
+ u'''#include <cstdint>\n\n'''
u'''namespace application_manager {\n\n'''
u'''const uint16_t major_version = $m_version;\n'''
u'''const uint16_t minor_version = $min_version;\n'''
u'''const uint16_t patch_version = $p_version;\n'''
+ u'''const uint16_t minimum_major_version = $min_major_version;\n'''
+ u'''const uint16_t minimum_minor_version = $min_minor_version;\n'''
+ u'''const uint16_t minimum_patch_version = $min_patch_version;\n'''
u'''} // namespace application_manager\n'''
u'''#endif // GENERATED_MSG_VERSION_H''')
- data_to_file = temp.substitute(m_version = major_version, min_version = minor_version, p_version = patch_version)
+ data_to_file = temp.substitute(m_version = major_version, min_version = minor_version, p_version = patch_version,
+ min_major_version = minimum_major_version, min_minor_version = minimum_minor_version, min_patch_version = minimum_patch_version)
return data_to_file
diff --git a/tools/InterfaceGenerator/generator/Model.py b/tools/InterfaceGenerator/generator/Model.py
deleted file mode 100755
index ee458d934a..0000000000
--- a/tools/InterfaceGenerator/generator/Model.py
+++ /dev/null
@@ -1,326 +0,0 @@
-"""Interface model.
-
-Interface model is represented by Interface class.
-Parser must provide an instance of this model as a result of parsing
-interface definition file.
-Generator must take an instance of this model as input for generating
-output files.
-"""
-
-# In this module there are classes that are used as data container
-# pylint: disable=R0903
-
-import collections
-
-
-class Boolean(object):
-
- """Boolean type.
-
- default_value -- default value
-
- """
-
- def __init__(self, default_value=None):
- self.default_value = default_value
-
-
-class Integer(object):
-
- """Integer type.
-
- Instance variables:
- min_value -- minimum allowed value
- max_value -- maximum allowed value
- default_value -- default value
-
- """
-
- def __init__(self, min_value=None, max_value=None, default_value=None):
- self.min_value = min_value
- self.max_value = max_value
- self.default_value = default_value
-
-
-class Double(object):
-
- """Floating-point type.
-
- Instance variables:
- min_value -- minimum allowed value
- max_value -- maximum allowed value
- default_value -- default value
-
- """
-
- def __init__(self, min_value=None, max_value=None, default_value=None):
- self.min_value = min_value
- self.max_value = max_value
- self.default_value = default_value
-
-class String(object):
-
- """String type.
-
- Instance variables:
- min_length -- minimum string length
- max_length -- maximum string length
- default_value -- default value
-
- """
-
- def __init__(self, min_length=None, max_length=None, default_value=None):
- self.min_length = min_length
- self.max_length = max_length
- self.default_value = default_value
-
-
-class Array(object):
-
- """Array type.
-
- Instance variables:
- min_size -- minimum array size
- max_size -- maximum array size
- element_type -- type of array element
-
- """
-
- def __init__(self, min_size=None, max_size=None, element_type=None):
- self.min_size = min_size
- self.max_size = max_size
- self.element_type = element_type
-
-
-class Issue(object):
-
- """Issue.
-
- Instance variables:
- creator -- issue creator
- value -- issue text
-
- """
-
- def __init__(self, creator=None, value=None):
- self.creator = creator
- self.value = value
-
-
-class InterfaceItemBase(object):
-
- """Base class for interface item.
-
- Instance variables:
- name -- item name
- description -- list of string description elements
- design_description -- list of string design description elements
- issues -- list of issues
- todos -- list of string todo elements
- platform -- optional platform (string or None)
- default_value -- default value
- scope -- optional scope: internal, partner or none (none by defaul, means public)
-
- """
-
- def __init__(self, name, description=None, design_description=None,
- issues=None, todos=None, platform=None, default_value=None, scope=None):
- self.name = name
- self.description = description if description is not None else []
- self.design_description = \
- design_description if design_description is not None else []
- self.issues = issues if issues is not None else []
- self.todos = todos if todos is not None else []
- self.platform = platform
- self.default_value = default_value
- self.scope = scope
-
-
-class EnumElement(InterfaceItemBase):
-
- """Element of enumeration.
-
- Instance variables:
- internal_name -- internal name of an element must be used by a
- generator if it is provided (not None)
- value -- optional element value
-
- """
-
- def __init__(self, name, description=None, design_description=None,
- issues=None, todos=None, platform=None, internal_name=None,
- value=None):
- super(EnumElement, self).__init__(
- name, description=description,
- design_description=design_description, issues=issues, todos=todos,
- platform=platform)
- self.internal_name = internal_name
- self.value = value
-
- @property
- def primary_name(self):
- """Primary name of the EnumElement.
-
- Return the 'internal_name' property if presented or 'name' property
- otherwise.
-
- """
- return self.name if self.internal_name is None else self.internal_name
-
-
-class Enum(InterfaceItemBase):
-
- """Enumeration.
-
- Instance variables:
- internal_scope -- optional internal scope
- elements -- enumeration elements
-
- """
-
- def __init__(self, name, description=None, design_description=None,
- issues=None, todos=None, platform=None, internal_scope=None,
- elements=None, scope=None):
- super(Enum, self).__init__(
- name, description=description,
- design_description=design_description, issues=issues, todos=todos,
- platform=platform, scope=scope)
-
- self.internal_scope = internal_scope
- self.elements = \
- elements if elements is not None else collections.OrderedDict()
-
-
-class EnumSubset(InterfaceItemBase):
-
- """Enumeration subset.
-
- Instance variables:
- enum -- enumeration
- allowed_elements -- dictionary of elements of enumeration
- which are allowed in this subset
-
- """
-
- def __init__(self, name, enum, description=None, design_description=None,
- issues=None, todos=None, platform=None,
- allowed_elements=None):
- super(EnumSubset, self).__init__(
- name, description=description,
- design_description=design_description, issues=issues, todos=todos,
- platform=platform)
-
- self.enum = enum
- self.allowed_elements = \
- allowed_elements if allowed_elements is not None else {}
-
-
-class Param(InterfaceItemBase):
-
- """Parameter.
-
- Instance variables:
- is_mandatory -- boolean value indicating whether
- this parameter is mandatory
- param_type -- parameter type
- default_value -- default value
-
- """
-
- def __init__(self, name, param_type, description=None,
- design_description=None, issues=None, todos=None,
- platform=None, is_mandatory=True, default_value=None, scope=None):
- super(Param, self).__init__(
- name, description=description,
- design_description=design_description, issues=issues, todos=todos,
- platform=platform, default_value=default_value, scope=scope)
-
- self.is_mandatory = is_mandatory
- self.param_type = param_type
- self.default_value = default_value
-
-
-class FunctionParam(Param):
-
- """Function parameter.
-
- Instance variables:
- default_value -- optional default value of this parameter
-
- """
-
- def __init__(self, name, param_type, description=None,
- design_description=None, issues=None, todos=None,
- platform=None, is_mandatory=True, default_value=None, scope=None):
- super(FunctionParam, self).__init__(
- name, param_type=param_type, description=description,
- design_description=design_description, issues=issues, todos=todos,
- platform=platform, is_mandatory=is_mandatory, default_value=default_value, scope=scope)
-
- self.default_value = default_value
-
-
-class Struct(InterfaceItemBase):
-
- """Structure.
-
- Instance variables:
- members -- dictionary of structure members (instances of Param class)
-
- """
-
- def __init__(self, name, description=None, design_description=None,
- issues=None, todos=None, platform=None, members=None, scope=None):
- super(Struct, self).__init__(
- name, description=description,
- design_description=design_description, issues=issues, todos=todos,
- platform=platform, scope=scope)
-
- self.members = \
- members if members is not None else collections.OrderedDict()
-
-
-class Function(InterfaceItemBase):
-
- """Function.
-
- Instance variables:
- function_id -- function identifier (EnumElement from Enum "FunctionID")
- message_type -- message type (EnumElement from Enum "messageType")
- params -- function parameters
-
- """
-
- def __init__(self, name, function_id, message_type, description=None,
- design_description=None, issues=None, todos=None,
- platform=None, params=None, scope=None):
- super(Function, self).__init__(
- name, description=description,
- design_description=design_description, issues=issues, todos=todos,
- platform=platform, scope=scope)
-
- self.function_id = function_id
- self.message_type = message_type
- self.params = \
- params if params is not None else collections.OrderedDict()
-
-
-class Interface(object):
-
- """Interface.
-
- Instance variables:
- enums -- dictionary of enumerations
- structs -- dictionary of structures
- functions -- dictionary of functions
- params -- dictionary of interface parameters (name, version, etc.)
-
- """
-
- def __init__(self, enums=None, structs=None, functions=None, params=None):
- self.enums = enums if enums is not None else collections.OrderedDict()
- self.structs = \
- structs if structs is not None else collections.OrderedDict()
- self.functions = \
- functions if functions is not None else collections.OrderedDict()
- self.params = params if params is not None else {}
diff --git a/tools/InterfaceGenerator/generator/generators/PolicyTypes.py b/tools/InterfaceGenerator/generator/generators/PolicyTypes.py
new file mode 100644
index 0000000000..53c3062f30
--- /dev/null
+++ b/tools/InterfaceGenerator/generator/generators/PolicyTypes.py
@@ -0,0 +1,689 @@
+"""SmartFactory code generator base.
+
+Base of code generator for SmartFactory that provides SmartSchema object in
+accordance with given internal model.
+
+"""
+# pylint: disable=W0402
+# pylint: disable=C0302
+import codecs
+import os
+import string
+import uuid
+import re
+
+from model.enum import Enum
+from model.enum_element import EnumElement
+from model.function import Function
+
+
+class GenerateError(Exception):
+
+ """Generate error.
+
+ This exception is raised when generator is unable to create
+ output from given model.
+
+ """
+
+ pass
+
+def to_camel_case(snake_str):
+ components = snake_str.split('_')
+ return components[0].lower() + "".join(x.title() for x in components[1:])
+
+def to_snake_case(camel_str):
+ s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', camel_str)
+ return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1)
+
+class CodeGenerator(object):
+
+ """Base PolicyTypes generator.
+
+ This class provides service which allows to generate *.h files with types required for Policy
+
+ """
+
+ def __init__(self):
+ """Construct new object."""
+
+ self._generated_structs = []
+ self._structs_add_code = u""
+
+ def generate_vehicledatatype_names(self, enum):
+ template = string.Template('''static std::set<std::string> ${enum_name}_enum_names = { \n${values}\n};\n''')
+ enum_element_name = lambda enum_element: enum_element.internal_name if enum_element.internal_name else enum_element.name
+ values = ", \n".join([" \"{}\"".format(enum_element_name(enum_element)) for enum_element in enum.elements.values()])
+ return template.substitute(enum_name=enum.name, values = values)
+
+ def generate_all_enum_values(self, enum):
+ template = string.Template('''static std::set<mobile_apis::${enum_name}::eType> ${enum_name}_all_enum_values = { \n${values}\n};\n''')
+ enum_element_name = lambda enum_element: enum_element.internal_name if enum_element.internal_name else enum_element.name
+ values = ", \n".join([" mobile_apis::{}::{}".format(enum.name, enum_element_name(enum_element)) for enum_element in enum.elements.values()])
+ return template.substitute(enum_name=enum.name, values = values)
+
+ def generate_enums_schema_factory_content(self, enums):
+ return "\n".join([self._enum_factory_element_template.substitute(enum_name = enum.name) for enum in enums])
+
+ def generate_enums_schema_factory_impl(self, enums):
+ enums_values = ""
+ for enum in enums:
+ enums_values += "\n".join([self.generate_all_enum_values(enum)])
+ if enum.name == "VehicleDataType":
+ enums_values += "\n".join([self.generate_vehicledatatype_names(enum)])
+ return self._enum_factory_template.substitute(enums_values = enums_values,
+ enum_factory_content = self.generate_enums_schema_factory_content(enums))
+
+ def generate_POD_types_schema_factory_impl(self, enums):
+ pod_types = {
+ "Integer" : "int32_t",
+ "Float" : "double",
+ }
+ '''if (enum_name == "DriverDistractionState") {
+ return Get<mobile_apis::DriverDistractionState::eType>(DriverDistractionState_all_enum_values);
+ }'''
+ enums_values = "\n".join([self.generate_all_enum_values(enum) for enum in enums])
+ return self._enum_factory_template.substitute(enums_values = enums_values,
+ enum_factory_content = self.generate_enums_schema_factory_content(enums))
+
+ def generate(self, interface, filename, namespace, destination_dir):
+ """ Generate SmartFactory source files.
+
+ Generates source code files at destination directory in
+ accordance with given model in specified namespace.
+
+ Keyword arguments:
+ interface -- model of the interface to generate source code for.
+ filename -- name of initial XML file.
+ namespace -- name of destination namespace.
+ destination_dir -- directory to create source files.
+
+ """
+
+ if interface is None:
+ raise GenerateError("Given interface is None.")
+
+ params_set = set()
+ for func in interface.functions.values():
+ for param in func.params:
+ params_set.add(param)
+ parameter_enum = Enum('Parameter')
+
+ for item in params_set:
+ parameter_enum.elements[item.upper()] = EnumElement(item)
+
+
+ required_enums_for_policy = [
+ "HMILevel",
+ "FunctionID",
+ "HybridAppPreference",
+ "AppHMIType",
+ "RequestType",
+ "ModuleType",
+ "Common_AppPriority",
+ "Parameter"
+ ]
+
+ self.required_empty_value = [
+ "RequestType",
+ "ModuleType",
+ "Parameter"
+ ]
+
+ self.enum_items_naming_conversion_ = {
+ "HMILevel" : lambda item_name : "HL_" + item_name.replace("HMI_", ""),
+ "AppHMIType" : lambda item_name : "AHT_" + item_name,
+ "FunctionID" : lambda item_name : item_name,
+ "HybridAppPreference" : lambda item_name : item_name,
+ "RequestType" : lambda item_name : "RT_" + item_name,
+ "ModuleType" : lambda item_name : "MT_" + item_name,
+ "Common_AppPriority" : lambda item_name : "P_" + item_name if not item_name == "VOICE_COMMUNICATION" else "P_VOICECOM",
+ "Parameter" : lambda item_name : "P_" + to_snake_case(item_name).upper()
+ }
+
+ self.enum_items_string_naming_conversion_ = {
+ "HMILevel" : lambda item_name : item_name,
+ "AppHMIType" : lambda item_name : item_name,
+ "FunctionID" : lambda item_name : item_name[:item_name.rfind("ID")],
+ "HybridAppPreference" : lambda item_name : item_name,
+ "RequestType" : lambda item_name : item_name,
+ "ModuleType" : lambda item_name : item_name,
+ "Common_AppPriority" : lambda item_name : item_name if not item_name == "VOICE_COMMUNICATION" else "VOICECOM",
+ "Parameter" : lambda item_name : item_name
+ }
+
+ self.enum_naming_conversion_ = {
+ "HMILevel" : "HmiLevel",
+ "AppHMIType" : "AppHMIType",
+ "FunctionID" : "FunctionID",
+ "HybridAppPreference" : "HybridAppPreference",
+ "RequestType" : "RequestType",
+ "ModuleType" : "ModuleType",
+ "Common_AppPriority" : "Priority",
+ "Parameter" : "Parameter"
+ }
+
+
+ # In case if "." is in FunctionID name this is HMI_API function ID and should not be included in Policy enums
+
+ required_enum_values = list(filter(lambda e: e.name in required_enums_for_policy
+ and "." not in list(e.elements.values())[0].name, list(interface.enums.values())))
+
+ if filename == "MOBILE_API":
+ self._write_cc_with_enum_schema_factory(filename, namespace, destination_dir, interface.enums.values())
+
+ # Params should be generated as enum for MOBILE_API to validate RPCSpec parameters
+ required_enum_values.append(parameter_enum)
+
+ self._write_header_with_enums(filename, namespace, destination_dir, required_enum_values)
+ self._write_cc_with_enums(filename, namespace, destination_dir, required_enum_values)
+
+ def _write_cc_with_enum_schema_factory(self,filename, namespace, destination_dir, required_enum_values):
+ class_name = u"generated_{0}_enum_schema_factory".format(filename)
+ header_file_name = '''policy/policy_table/policy_enum_schema_factory.h'''
+ cc_file_name = u"".join("{0}.cc".format(class_name))
+ if not os.path.exists(destination_dir):
+ os.makedirs(destination_dir)
+ print(os.path.join(destination_dir, cc_file_name))
+ with codecs.open(os.path.join(destination_dir, cc_file_name),
+ encoding="utf-8",
+ mode="w") as f_cc:
+ guard = u"_{0}_{1}_CC__".format( class_name.upper(),
+ uuid.uuid1().hex.capitalize())
+ namespace_open, namespace_close = self._namespaces_strings(namespace)
+ includes = '''#include <set>\n'''\
+ '''#include "interfaces/MOBILE_API.h"\n'''\
+ '''#include "smart_objects/enum_schema_item.h"\n'''
+ f_cc.write(self._cc_file_template.substitute(
+ class_name=class_name,
+ header_file=header_file_name,
+ includes = includes,
+ namespace_open=namespace_open,
+ enums_content=self.generate_enums_schema_factory_impl(required_enum_values),
+ namespace_close=namespace_close))
+
+ def _write_header_with_enums(self,filename, namespace, destination_dir, required_enum_values):
+ class_name = u"generated_{0}_policy_types".format(filename)
+ header_file_name = u"".join("{0}.h".format(class_name))
+ if not os.path.exists(destination_dir):
+ os.makedirs(destination_dir)
+ with codecs.open(os.path.join(destination_dir, header_file_name),
+ encoding="utf-8",
+ mode="w") as f_h:
+ guard = u"_{0}_{1}_H__".format( class_name.upper(),
+ uuid.uuid1().hex.capitalize())
+ namespace_open, namespace_close = self._namespaces_strings(namespace)
+ f_h.write(self._h_file_template.substitute(
+ class_name=class_name,
+ guard=guard,
+ includes="",
+ namespace_open=namespace_open,
+ enums_content=self._gen_enums(required_enum_values
+ ),
+ namespace_close=namespace_close))
+
+ def _write_cc_with_enums(self,filename, namespace, destination_dir, required_enum_values):
+ class_name = u"generated_{0}_policy_types".format(filename)
+ header_file_name = u"".join("{0}.h".format(class_name))
+ cc_file_name = u"".join("{0}.cc".format(class_name))
+ if not os.path.exists(destination_dir):
+ os.makedirs(destination_dir)
+ with codecs.open(os.path.join(destination_dir, cc_file_name),
+ encoding="utf-8",
+ mode="w") as f_cc:
+ guard = u"_{0}_{1}_CC__".format( class_name.upper(),
+ uuid.uuid1().hex.capitalize())
+ namespace_open, namespace_close = self._namespaces_strings(namespace)
+ f_cc.write(self._cc_file_template.substitute(
+ class_name=class_name,
+ header_file=header_file_name,
+ includes="",
+ namespace_open=namespace_open,
+ enums_content=self.gen_enums_processing(required_enum_values
+ ),
+ namespace_close=namespace_close))
+
+ def _namespaces_strings(self, namespace):
+
+ """ Generate open and close namespaces strings
+
+ Generates source code for opening and close namespaces
+
+ Keyword arguments:
+ namespace -- name of destination namespace.
+
+ Returns:
+ Tuple with namespace open string and namespace close string
+ """
+
+ namespace_open = u""
+ namespace_close = u""
+ if namespace:
+ parts = namespace.split(u"::")
+ for part in parts:
+ namespace_open = u"".join(
+ [namespace_open,
+ self._namespace_open_template.substitute(name=part)])
+ namespace_close = u"".join(
+ [namespace_close,
+ "}} // {0}\n".format(part)])
+
+ return namespace_open, namespace_close
+
+
+ def _gen_enums(self, enums):
+ """Generate enums for header file.
+
+ Generates declaration of enumerations for the header file.
+
+ Keyword arguments:
+ enums -- list of enums to generate.
+
+ Returns:
+ String with enums declaration source code.
+
+ """
+
+ if enums is None:
+ raise GenerateError("Enums is None")
+
+ return u"\n".join([self._gen_enum(x) for x in enums])
+
+ def _gen_enum(self, enum):
+ """Generate enum for header file.
+
+ Generates declaration of enumeration for the header file.
+
+ Keyword arguments:
+ enum -- enum to generate.
+
+ Returns:
+ String with enum declaration source code.
+
+ """
+
+ enum_elements = enum.elements.values()
+ return self._enum_template.substitute(
+ comment=self._gen_comment(enum),
+ name=self.enum_naming_conversion_[enum.name],
+ enum_items=self._indent_code(self._gen_enum_elements(
+ enum_elements, enum.name), 1))
+
+ def _gen_enum_elements(self, enum_elements, enum_name):
+ """Generate enum elements for header file.
+
+ Generates declaration of enumeration elements for the header file.
+
+ Keyword arguments:
+ enum_elements -- list of enum elements to generate.
+
+ Returns:
+ String with enum elements declaration source code.
+
+ """
+ enum_elements = [self._gen_enum_element(x, enum_name)
+ for x in enum_elements]
+ if (enum_name in self.required_empty_value):
+ enum_elements.append(self._gen_empty_enum_element(enum_name))
+ return u",\n\n".join(enum_elements)
+
+ def _gen_empty_enum_element(self, enum_name) :
+ return self._enum_element_with_value_template.substitute(
+ comment="",
+ name=self.enum_items_naming_conversion_[enum_name]("EMPTY"),
+ value=-1)
+
+ def _gen_enum_element(self, enum_element, enum_name):
+ """Generate enum element for header file.
+
+ Generates declaration of enumeration element for the header file.
+
+ Keyword arguments:
+ enum_element -- enum element to generate.
+
+ Returns:
+ String with enum element declaration source code.
+
+ """
+
+ if enum_element.value is not None:
+ return self._enum_element_with_value_template.substitute(
+ comment=self._gen_comment(enum_element),
+ name=self.enum_items_naming_conversion_[enum_name](enum_element.primary_name),
+ value=enum_element.value)
+ else:
+ return self._enum_element_with_no_value_template.substitute(
+ comment=self._gen_comment(enum_element),
+ name=self.enum_items_naming_conversion_[enum_name](enum_element.primary_name))
+
+ def gen_enums_processing(self, enums):
+ validation = "\n".join([self._gen_enum_validation(enum) for enum in enums])
+ to_json = "\n".join([self._gen_enum_to_json(enum) for enum in enums])
+ from_json = "\n".join([self._gen_enum_from_json(enum) for enum in enums])
+ return "\n".join([validation, to_json, from_json])
+
+ def _gen_enum_validation(self, enum):
+ return self._valiation_enum_template.substitute(
+ name = self.enum_naming_conversion_[enum.name],
+ enum_items = "\n".join([self._gen_enum_item_validation(enum_item.name, enum.name) for enum_item in enum.elements.values()])
+ )
+
+ def _gen_enum_item_validation(self, item_name, enum_name):
+ return self._valiation_enum_item_template.substitute(
+ name = self.enum_items_naming_conversion_[enum_name](item_name))
+
+ def _gen_enum_to_json(self, enum):
+ name = self.enum_naming_conversion_[enum.name]
+ enum_items = "\n".join([self._gen_enum_item_to_json(enum_item.name, enum.name) for enum_item in enum.elements.values()])
+ if (enum.name in self.required_empty_value):
+ enum_items+= "\n" + self._gen_enum_item_to_json("EMPTY", enum.name)
+ return self._enum_to_json_template.substitute(
+ name = name,
+ enum_items = enum_items
+ )
+
+ def _gen_enum_item_to_json(self, item_name, enum_name):
+ return self._enum_to_json_item_template.substitute(
+ name = self.enum_items_naming_conversion_[enum_name](item_name),
+ string_name = self.enum_items_string_naming_conversion_[enum_name](item_name)
+ )
+
+
+ def _gen_enum_from_json(self, enum):
+ name = self.enum_naming_conversion_[enum.name]
+ enum_items = "\n".join([self._gen_enum_item_from_json(enum_item.name, enum.name) for enum_item in enum.elements.values()])
+ if (enum.name in self.required_empty_value):
+ enum_items += "\n" + self._gen_enum_item_from_json("EMPTY", enum.name)
+ return self._enum_from_json_template.substitute(
+ name = name,
+ enum_items = enum_items
+ )
+
+ def _gen_enum_item_from_json(self, item_name, enum_name):
+ return self._enum_from_json_item_template.substitute(
+ name = self.enum_items_naming_conversion_[enum_name](item_name),
+ string_name = self.enum_items_string_naming_conversion_[enum_name](item_name)
+ )
+
+ def _gen_comment(self, interface_item_base, use_doxygen=True):
+ """Generate doxygen comment for iterface_item_base for header file.
+
+ Generates doxygen comment for any iterface_item_base for the header
+ file.
+
+ Keyword arguments:
+ interface_item_base -- object to generate doxygen comment for.
+ use_doxygen -- Flag that indicates does function uses doxygen or not.
+
+ Returns:
+ String with generated doxygen comment.
+
+ """
+
+ brief_type_title = None
+ interface_item_base_classname = interface_item_base.__class__.__name__
+ if interface_item_base_classname in self._model_types_briefs:
+ brief_type_title = \
+ self._model_types_briefs[interface_item_base_classname]
+ else:
+ raise GenerateError("Unable to create comment for unknown type " +
+ interface_item_base_classname)
+
+ name = interface_item_base.primary_name if \
+ type(interface_item_base) is EnumElement else \
+ interface_item_base.name
+ brief_description = (u" * @brief {0}{1}.\n" if use_doxygen is
+ True else u"// {0}{1}.\n").format(
+ brief_type_title,
+ name)
+
+ description = u"".join([(u" * {0}\n" if use_doxygen
+ is True else u"// {0}\n").format(x)
+ for x in self._normalize_multiline_comments(
+ interface_item_base.description)])
+ if description is not u"":
+ description = u"".join([u" *\n" if use_doxygen
+ is True else u"//\n", description])
+
+ design_description = u"".join([(u" * {0}\n" if use_doxygen is
+ True else u"// {0}\n").format(x)
+ for x in
+ self._normalize_multiline_comments(
+ interface_item_base.
+ design_description)])
+ if design_description is not u"":
+ design_description = u"".join([u" *\n" if use_doxygen is
+ True else "//\n",
+ design_description])
+
+ issues = u"".join([(u" * @note {0}\n" if use_doxygen is
+ True else u"// Note: {0}\n").format(x)
+ for x in self._normalize_multiline_comments(
+ [x.value for x in interface_item_base.issues])])
+ if issues is not u"":
+ issues = u"".join([u" *\n" if use_doxygen is
+ True else u"//\n", issues])
+
+ todos = u"".join([(u" * @todo {0}\n" if use_doxygen is
+ True else u"// ToDo: {0}\n").format(x)
+ for x in self._normalize_multiline_comments(
+ interface_item_base.todos)])
+ if todos is not u"":
+ todos = u"".join([u" *\n" if use_doxygen is
+ True else u"//\n", todos])
+
+ returns = u""
+ if type(interface_item_base) is Function:
+ returns = u"".join([u" *\n", self._function_return_comment])
+
+ template = self._comment_doxygen_template if use_doxygen is \
+ True else self._comment_cc_template
+
+ return template.substitute(
+ brief_description=brief_description,
+ description=description,
+ design_description=design_description,
+ issues=issues,
+ todos=todos,
+ returns=returns)
+
+ def _indent_code(self, code, indent_level):
+ """Indent given source code.
+
+ Indents given source code right by given indentation level.
+
+ Keyword arguments:
+ code -- given source code.
+ indent_level -- desired indentation level.
+
+ Returns:
+ String with processed code.
+
+ """
+
+ code_lines = code.split("\n")
+ return u"".join(
+ [u"{0}{1}\n".format(
+ self._indent_template * indent_level,
+ x) if x is not u"" else u"\n" for x in code_lines])
+
+ @staticmethod
+ def _normalize_multiline_comments(initial_strings):
+ """Normalize multiline comments.
+
+ Makes multiline comment clean of any line breaks creating additional
+ strings for the comment.
+
+ Keyword arguments:
+ initial_strings -- initial list of strings to process.
+
+ Returns:
+ New list of the strings (with contains no strings with line breaks).
+
+ """
+
+ result = []
+ for initial_string in initial_strings:
+ result = result + initial_string.splitlines()
+ return result
+
+ _model_types_briefs = dict(
+ {u"EnumElement": u"",
+ u"Enum": u"Enumeration ",
+ u"Function": u"Method that generates schema for function ",
+ u"Struct": u"Method that generates schema item for structure ",
+ u"Param": u"Struct member ",
+ u"FunctionParam": u"Function parameter "})
+
+ _cc_file_template = string.Template(
+ u'''/**\n'''
+ u''' * @file ${class_name}.h\n'''
+ u''' * @brief Generated class ${class_name} source file.\n'''
+ u''' *\n'''
+ u'''*/\n'''
+ u'''#include "${header_file}"\n'''
+ u'''${includes}'''
+ u'''\n\n'''
+ u'''$namespace_open'''
+ u'''\n'''
+ u'''$enums_content'''
+ u'''\n'''
+ u'''$namespace_close'''
+ u'''\n\n''')
+
+
+ _h_file_template = string.Template(
+ u'''/**\n'''
+ u''' * @file ${class_name}.h\n'''
+ u''' * @brief Generated class ${class_name} header file.\n'''
+ u''' *\n'''
+ u'''* Copyright (c) 2017, Ford Motor Company\n'''
+ u'''* All rights reserved.\n'''
+ u'''*\n'''
+ u'''* Redistribution and use in source and binary forms, with or without\n'''
+ u'''* modification, are permitted provided that the following conditions are met:\n'''
+ u'''*\n'''
+ u'''* Redistributions of source code must retain the above copyright notice, this\n'''
+ u'''* list of conditions and the following disclaimer.\n'''
+ u'''*\n'''
+ u'''* Redistributions in binary form must reproduce the above copyright notice,\n'''
+ u'''* this list of conditions and the following\n'''
+ u'''* disclaimer in the documentation and/or other materials provided with the\n'''
+ u'''* distribution.\n'''
+ u'''*\n'''
+ u'''* Neither the name of the Ford Motor Company nor the names of its contributors\n'''
+ u'''* may be used to endorse or promote products derived from this software\n'''
+ u'''* without specific prior written permission.\n'''
+ u'''*\n'''
+ u'''* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\n'''
+ u'''* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n'''
+ u'''* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n'''
+ u'''* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n'''
+ u'''* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n'''
+ u'''* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n'''
+ u'''* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n'''
+ u'''* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n'''
+ u'''* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n'''
+ u'''* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n'''
+ u'''* POSSIBILITY OF SUCH DAMAGE.\n'''
+ u'''*/\n'''
+ u'''\n'''
+ u'''#ifndef $guard\n'''
+ u'''#define $guard\n'''
+ u'''#include <string>\n'''
+ u'''${includes}'''
+ u'''\n'''
+ u'''$namespace_open'''
+ u'''$enums_content'''
+ u'''$namespace_close'''
+ u'''#endif //$guard\n'''
+ u'''\n\n''')
+
+
+ _namespace_open_template = string.Template(
+ u'''namespace $name {\n''')
+
+ _comment_doxygen_template = string.Template(
+ u'''/**\n'''
+ u'''$brief_description'''
+ u'''$description'''
+ u'''$design_description'''
+ u'''$issues'''
+ u'''$todos'''
+ u'''$returns */''')
+
+ _enum_template = string.Template(
+ u'''$comment\n'''
+ u'''enum $name {\n'''
+ u'''$enum_items};\n'''
+ u'''bool IsValidEnum($name val);\n'''
+ u'''const char* EnumToJsonString($name val);\n'''
+ u'''bool EnumFromJsonString(const std::string& literal, $name* result);\n'''
+ )
+ _valiation_enum_template = string.Template(
+ u'''bool IsValidEnum($name val) {\n'''
+ u''' return !(std::string(EnumToJsonString(val)).empty());\n'''
+ u'''};\n''')
+
+ _valiation_enum_item_template = string.Template(
+ u''' case $name: return true;''')
+
+ _enum_to_json_template = string.Template(
+ u'''const char* EnumToJsonString($name val) {\n'''
+ u''' switch (val) {\n'''
+ u'''$enum_items\n'''
+ u''' default: return "";\n'''
+ u''' }\n'''
+ u'''};\n''')
+
+ _enum_to_json_item_template = string.Template(
+ u''' case $name: return "$string_name";''')
+
+ _enum_from_json_template = string.Template(
+ u'''bool EnumFromJsonString(const std::string& literal, $name* result) {\n'''
+ u'''$enum_items'''
+ u''' return false;\n'''
+ u'''};\n''')
+
+ _enum_from_json_item_template = string.Template(
+ u''' if ("$string_name" == literal) {\n'''
+ u''' *result = $name;\n'''
+ u''' return true;\n'''
+ u''' }\n''')
+
+ _enum_element_with_value_template = string.Template(
+ u'''$comment\n'''
+ u'''$name = $value''')
+
+ _enum_element_with_no_value_template = string.Template(
+ u'''$comment\n'''
+ u'''$name''')
+ _enum_factory_template = string.Template(
+ '''${enums_values}\n'''
+ '''template<typename EnumType>\n'''
+ '''std::shared_ptr<smart_objects::ISchemaItem> Create(const std::set<EnumType>& all_enum_values) {\n'''
+ '''using namespace smart_objects;\n'''
+ ''' static auto schemaItem = TEnumSchemaItem<EnumType>::create(all_enum_values, TSchemaItemParameter<EnumType>());\n'''
+ ''' return schemaItem;\n'''
+ '''}\n\n'''
+ '''std::shared_ptr<smart_objects::ISchemaItem> EnumSchemaItemFactory::Get(const std::string & enum_name) {\n'''
+ '''${enum_factory_content}\n'''
+ ''' return std::shared_ptr<smart_objects::ISchemaItem>();\n'''
+ '''}\n\n'''
+ '''bool EnumSchemaItemFactory::IsRPCSpecVehicleDataType(const std::string& vd_name) {\n'''
+ ''' for(auto& item_name : VehicleDataType_enum_names) {\n'''
+ ''' if (vd_name == item_name) {\n'''
+ ''' return true;\n'''
+ ''' }\n'''
+ ''' }\n'''
+ ''' return false;\n'''
+ '''}\n''')
+ _enum_factory_element_template = string.Template(
+ ''' if (enum_name == "${enum_name}") {\n'''
+ ''' return Create<mobile_apis::${enum_name}::eType>(${enum_name}_all_enum_values);\n'''
+ ''' }''')
+ _POD_type_factory_element_template = string.Template(
+ ''' if (typename == "${type_name}") {\n'''
+ ''' return TNumberSchemaItem<${cpp_type}>::create(TSchemaItemParameter<double>(${min_val}), TSchemaItemParameter<double>(${${max_val}}), TSchemaItemParameter<${cpp_type}>());'''
+ ''' }''')
+ _indent_template = u" "
diff --git a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
index d13ac29c9b..de0067bba8 100755
--- a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
+++ b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
@@ -12,7 +12,17 @@ import os
import string
import uuid
-from generator import Model
+from model.array import Array
+from model.boolean import Boolean
+from model.float import Float
+from model.enum import Enum
+from model.enum_element import EnumElement
+from model.enum_subset import EnumSubset
+from model.function import Function
+from model.integer import Integer
+from model.param import Param
+from model.string import String
+from model.struct import Struct
class GenerateError(Exception):
@@ -56,8 +66,6 @@ class CodeGenerator(object):
"""
- namespace = unicode(namespace)
-
if interface is None:
raise GenerateError("Given interface is None.")
@@ -84,16 +92,16 @@ class CodeGenerator(object):
[namespace_close,
"}} // {0}\n".format(part)])
- class_name = unicode(os.path.splitext(filename)[0])
+ class_name = os.path.splitext(filename)[0]
guard = u"__CSMARTFACTORY_{0}_{1}_H__".format(
class_name.upper(),
- unicode(uuid.uuid1().hex.capitalize()))
+ uuid.uuid1().hex.capitalize())
header_file_name = u"".join("{0}.h".format(class_name))
with codecs.open(os.path.join(destination_dir, header_file_name),
encoding="utf-8",
mode="w") as f_h:
- f_h.write(self._h_file_tempalte.substitute(
+ f_h.write(self._h_file_template.substitute(
class_name=class_name,
guard=guard,
namespace_open=namespace_open,
@@ -127,14 +135,14 @@ class CodeGenerator(object):
header_file_name = "".join("{0}_schema.h".format(class_name))
guard = u"__CSMARTFACTORY_{0}_{1}_HPP__".format(
class_name.upper(),
- unicode(uuid.uuid1().hex.capitalize()))
+ uuid.uuid1().hex.capitalize())
with codecs.open(os.path.join(destination_dir, header_file_name),
encoding="utf-8",
mode="w") as f_h:
- f_h.write(self._hpp_schema_file_tempalte.substitute(
+ f_h.write(self._hpp_schema_file_template.substitute(
class_name=class_name,
guard=guard,
- header_file_name=unicode("".join("{0}.h".format(class_name))),
+ header_file_name="".join("{0}.h".format(class_name)),
namespace_open=namespace_open,
class_content=self._gen_h_class(
class_name,
@@ -147,7 +155,7 @@ class CodeGenerator(object):
u"".join("{0}_schema.cc".format(class_name))),
encoding="utf-8", mode="w") as f_s:
f_s.write(self._cc_file_template.substitute(
- header_file_name=unicode(header_file_name),
+ header_file_name=header_file_name,
namespace=namespace,
class_name=class_name,
function_id_items=self._indent_code(function_id_items, 1),
@@ -157,6 +165,8 @@ class CodeGenerator(object):
interface.functions.values()),
function_schemas=self._gen_function_schemas(
interface.functions.values()),
+ function_schemas_switch=self._gen_function_schema_switch(
+ interface.functions.values()),
init_function_impls=self._gen_function_impls(
interface.functions.values(),
namespace,
@@ -380,7 +390,7 @@ class CodeGenerator(object):
"""
- if type(member.param_type) is Model.Struct:
+ if type(member.param_type) is Struct:
self._ensure_struct_generated(member.param_type)
def _ensure_struct_generated(self, struct):
@@ -450,6 +460,48 @@ class CodeGenerator(object):
self._gen_function_schema(x), 1)
for x in functions])
+ def _gen_function_schema_switch(self, functions):
+ """Generate initialization code of each function for source file.
+
+ Generates function schema initialization code that should be used
+ in the source file.
+
+ Keyword arguments:
+ function -- function to generate method for.
+
+ Returns:
+ String with switch for functions initialization source code.
+
+ """
+
+ if functions is None:
+ raise GenerateError("Functions is None")
+
+ def function_id_switch(self, message_type, functions):
+ case_list = [self._function_id_case_template.substitute(
+ function_id=x.function_id.primary_name,
+ message_type=x.message_type.primary_name)
+ for x in functions if x.message_type.primary_name == message_type ]
+ case_list.append("default:\n break;\n")
+ switch_function_id_cases = self._indent_code(u"".join(case_list), 1)[:-1]
+
+ return self._indent_code(self._function_switch_template.substitute(
+ switchable="function_id",
+ cases=switch_function_id_cases
+ ), 1)[:-1]
+
+ message_type_case_list = [self._message_type_case_template.substitute(
+ message_type = message_type,
+ case_body = function_id_switch(self, message_type, functions)
+ ) for message_type in set([x.message_type.primary_name for x in functions])]
+ message_type_case_list.append("default:\n break;\n")
+ message_type_cases = self._indent_code(u"".join(message_type_case_list), 1)[:-1]
+
+ return self._indent_code(self._function_switch_template.substitute(
+ switchable="message_type",
+ cases=message_type_cases
+ ), 1)[:-1]
+
def _gen_function_schema(self, function):
"""Generate function initialization code for source file.
@@ -505,7 +557,6 @@ class CodeGenerator(object):
String with structs implementation source code.
"""
-
processed_enums = []
return self._struct_impl_template.substitute(
namespace=namespace,
@@ -518,9 +569,46 @@ class CodeGenerator(object):
schema_items_decl=self._gen_schema_items_decls(
struct.members.values()),
schema_item_fill=self._gen_schema_items_fill(
- struct.members.values())),
+ struct.members.values(), struct.since, struct.until, struct.deprecated, struct.removed)),
1))
+
+ def _enum_has_history_present(self, enum):
+ '''
+ Check if any elements in an enum has history signature
+ '''
+ for element in enum.param_type.elements.values():
+ if ( element.history is not None or
+ element.since is not None or
+ element.until is not None or
+ element.removed is not None ):
+ return True
+ return False
+
+ def _element_has_history_present(self, element):
+ '''
+ Check if a specific element has a history signature
+ '''
+ if ( element.history is not None or
+ element.since is not None or
+ element.until is not None or
+ element.removed is not None ):
+ return True
+ return False
+
+ def _enum_param_type_has_history_present(self, param_type):
+ '''
+ Check if any elements in an enum has history signature
+ '''
+ for element in param_type.elements.values():
+ if ( element.history is not None or
+ element.since is not None or
+ element.until is not None or
+ element.removed is not None ):
+ return True
+ return False
+
+
def _gen_schema_loc_decls(self, members, processed_enums):
"""Generate local declarations of variables for schema.
@@ -538,8 +626,9 @@ class CodeGenerator(object):
result = u""
for member in members:
- if type(member.param_type) is Model.Enum and \
+ if type(member.param_type) is Enum and \
member.param_type.name not in processed_enums:
+ has_history = self._enum_has_history_present(member)
local_var = self._gen_schema_loc_emum_var_name(
member.param_type)
result = u"\n".join(
@@ -555,9 +644,49 @@ class CodeGenerator(object):
enum=member.param_type.name,
value=x.primary_name)
for x in member.param_type.elements.values()])])
+
+ if has_history == True:
+ history_result = u"\n"
+ history_result += self._impl_code_loc_decl_enum_history_set_template.substitute(
+ type=member.param_type.name)
+ history_result += u"\n"
+ history_result += u"\n".join(
+ [self._impl_code_loc_decl_enum_history_set_value_init_template.substitute(
+ enum=member.param_type.name,
+ value=x.primary_name)
+ for x in member.param_type.elements.values() if self._element_has_history_present(x)])
+ history_result += u"\n"
+ history_map_result = []
+
+ for x in member.param_type.elements.values():
+ if self._element_has_history_present(x):
+ history_map_result.append(
+ self._impl_code_loc_decl_enum_history_set_insert_template.
+ substitute(
+ enum=member.param_type.name,
+ value=x.primary_name,
+ since=x.since if x.since is not None else "",
+ until=x.until if x.until is not None else "",
+ removed=x.removed if x.removed is not None else u"false"))
+ if(x.history is not None) :
+ history_list = x.history
+ for item in history_list:
+ history_map_result.append(
+ self._impl_code_loc_decl_enum_history_set_insert_template.
+ substitute(
+ enum=member.param_type.name,
+ value=x.primary_name,
+ since=item.since if item.since is not None else "",
+ until=item.until if item.until is not None else "",
+ removed=item.removed if item.removed is not None else u"false"))
+
+ history_result += u"\n".join(history_map_result)
+ result += "\n"
+ result += history_result
+
processed_enums.append(member.param_type.name)
result = u"".join([result, u"\n\n"]) if result else u""
- elif type(member.param_type) is Model.EnumSubset:
+ elif type(member.param_type) is EnumSubset:
local_var = self._gen_schema_loc_emum_s_var_name(member.name)
result = u"\n".join(
[u"".join(
@@ -574,12 +703,12 @@ class CodeGenerator(object):
for x in member.param_type.
allowed_elements.values()])])
result = u"".join([result, u"\n\n"]) if result else u""
- elif type(member.param_type) is Model.Array:
+ elif type(member.param_type) is Array:
result = u"".join(
[result, self._gen_schema_loc_decls(
- [Model.Param(name=member.param_type.element_type.name
+ [Param(name=member.param_type.element_type.name
if type(member.param_type.element_type) is
- Model.EnumSubset else "",
+ EnumSubset else "",
param_type=member.param_type.element_type)],
processed_enums)])
@@ -599,10 +728,40 @@ class CodeGenerator(object):
"""
- result = u"\n\n".join(
- [self._gen_schema_item_decl(x) for x in members])
+ result_array = []
+ for x in members:
+ result_array.append(self._gen_schema_item_decl(x))
+ count = 0
+ if x.history is not None:
+ history_list = x.history
+ for item in history_list:
+ item.name += "_history_v" + str(len(history_list)-count)
+ result_array.append(self._gen_schema_item_decl(item))
+ count += 1
+ result_array.append(self._gen_history_vector_decl(history_list, x.name))
+
+ result = u"\n\n".join(result_array)
+ return result
+
+ def _gen_history_vector_decl(self, history_list, name):
+ """Generate History Vector Declaration.
+
+ Generates the declaration and initialization
+ of a vector of schema items
+
+ Arguments:
+ history_list -> list of history items
+ name -> name of parent parameter name
+
+ Returns:
+ String with history array code.
+ """
+ result_array = []
+ result_array.append(self._impl_code_shared_ptr_vector_template.substitute(var_name = name))
+ result = u"\n".join(result_array)
+ return result
+
- return u"".join([result, u"\n\n"]) if result else u""
def _gen_schema_item_decl(self, member):
"""Generate schema item declaration.
@@ -642,13 +801,13 @@ class CodeGenerator(object):
"""
code = u""
- if type(param) is Model.Boolean:
+ if type(param) is Boolean:
code = self._impl_code_bool_item_template.substitute(
params=self._gen_schema_item_param_values(
[[u"bool", None if param.default_value is None
else u"true" if param.default_value is True else u"false"]]))
- elif type(param) is Model.Integer:
- if param.max_value < 2 ** 31:
+ elif type(param) is Integer:
+ if not param.max_value or param.max_value and param.max_value < 2 ** 31:
code = self._impl_code_integer_item_template.substitute(
type=u"int32_t",
params=self._gen_schema_item_param_values(
@@ -664,14 +823,14 @@ class CodeGenerator(object):
[u"int64_t", param.default_value]]))
else:
raise GenerateError("Parameter value too large: " + str(param.max_value))
- elif type(param) is Model.Double:
+ elif type(param) is Float:
code = self._impl_code_integer_item_template.substitute(
type=u"double",
params=self._gen_schema_item_param_values(
[[u"double", param.min_value],
[u"double", param.max_value],
[u"double", param.default_value]]))
- elif type(param) is Model.String:
+ elif type(param) is String:
code = self._impl_code_string_item_template.substitute(
params=self._gen_schema_item_param_values(
[[u"size_t", param.min_length],
@@ -679,34 +838,48 @@ class CodeGenerator(object):
[u"std::string", u"".join(
[u'"', param.default_value, u'"']) if param.default_value
is not None else u""]]))
- elif type(param) is Model.Array:
+ elif type(param) is Array:
code = self._impl_code_array_item_template.substitute(
params=u"".join(
[u"".join(
[self._gen_schema_item_decl_code(
param.element_type,
param.element_type.name if type(param.element_type)
- is Model.EnumSubset else u"",
+ is EnumSubset else u"",
None),
u", "]),
self._gen_schema_item_param_values(
[[u"size_t", param.min_size],
[u"size_t", param.max_size]])]))
- elif type(param) is Model.Struct:
+ elif type(param) is Struct:
code = self._impl_code_struct_item_template.substitute(
name=param.name)
- elif type(param) is Model.Enum:
- code = self._impl_code_enum_item_template.substitute(
- type=param.name,
- params=u"".join(
- [self._gen_schema_loc_emum_var_name(param),
- u", ",
- self._gen_schema_item_param_values(
- [[u"".join([param.name, u"::eType"]),
- u"".join([param.name, u"::",
- default_value.primary_name]) if
- default_value is not None else None]])]))
- elif type(param) is Model.EnumSubset:
+ elif type(param) is Enum:
+ if self._enum_param_type_has_history_present(param):
+ code = self._impl_code_enum_item_with_history_template.substitute(
+ type=param.name,
+ params=u"".join(
+ [self._gen_schema_loc_emum_var_name(param),
+ u", ",
+ self._impl_gen_schema_enum_history_map_template.substitute(name=param.name),
+ u", ",
+ self._gen_schema_item_param_values(
+ [[u"".join([param.name, u"::eType"]),
+ u"".join([param.name, u"::",
+ default_value.primary_name]) if
+ default_value is not None else None]])]))
+ else:
+ code = self._impl_code_enum_item_template.substitute(
+ type=param.name,
+ params=u"".join(
+ [self._gen_schema_loc_emum_var_name(param),
+ u", ",
+ self._gen_schema_item_param_values(
+ [[u"".join([param.name, u"::eType"]),
+ u"".join([param.name, u"::",
+ default_value.primary_name]) if
+ default_value is not None else None]])]))
+ elif type(param) is EnumSubset:
code = self._impl_code_enum_item_template.substitute(
type=param.enum.name,
params=u"".join(
@@ -746,7 +919,7 @@ class CodeGenerator(object):
return result
- def _gen_schema_items_fill(self, members):
+ def _gen_schema_items_fill(self, members=None, since=None, until=None, deprecated=None, removed=None):
"""Generate schema items fill code.
Generates source code that fills new schema with items.
@@ -758,10 +931,16 @@ class CodeGenerator(object):
String with function schema items fill code.
"""
-
- result = u"\n".join(
- [self._gen_schema_item_fill(x) for x in members])
-
+ result_array = []
+ for x in members:
+ #If history, create Smember History vector first
+ if x.history is not None:
+ history_list = x.history
+ for item in history_list:
+ result_array.append(self._gen_history_vector_item_fill(item, x.name))
+ result_array.append(self._gen_schema_item_fill(x, since, until, deprecated, removed))
+
+ result = u"\n".join(result_array)
return u"".join([result, u"\n\n"]) if result else u""
def _gen_schema_params_fill(self, message_type_name):
@@ -781,7 +960,34 @@ class CodeGenerator(object):
raise GenerateError("Unexpected call to the unimplemented function.")
- def _gen_schema_item_fill(self, member):
+ def _check_member_history(self, member):
+ """
+ Checks set of rules that history items are valid
+ Raises error if rules are violated
+ """
+ if (member.since is None and
+ member.until is None and
+ member.deprecated is None and
+ member.removed is None and
+ member.history is None):
+ return
+ if (member.history is not None and member.since is None):
+ raise GenerateError("Error: Missing since version parameter for " + member.name)
+ if (member.until is not None):
+ raise GenerateError("Error: Until should only exist in history tag for " + member.name)
+ if (member.history is None):
+ if(member.until is not None or
+ member.deprecated is not None or
+ member.removed is not None):
+ raise GenerateError("Error: No history present for " + member.name)
+ if (member.deprecated is not None and member.removed is not None):
+ raise GenerateError("Error: Deprecated and removed should not be present together for " + member.name)
+ if(member.history is not None):
+ for item in member.history:
+ if item.since is None or item.until is None:
+ raise GenerateError("Error: History items require since and until parameters for " + member.name)
+
+ def _gen_schema_item_fill(self, member, since, until, deprecated, removed):
"""Generate schema item fill code.
Generates source code that fills new schema with item.
@@ -793,11 +999,62 @@ class CodeGenerator(object):
String with schema item fill code.
"""
+ self._check_member_history(member)
+
+ if (since is not None or
+ member.since is not None):
+ if member.history is not None:
+ return self._impl_code_item_fill_template_with_version_and_history_vector.substitute(
+ name=member.name,
+ var_name=self._gen_schema_item_var_name(member),
+ is_mandatory=u"true" if member.is_mandatory is True else u"false",
+ since=member.since if member.since is not None else since if since is not None else "",
+ until=member.until if member.until is not None else until if until is not None else "",
+ deprecated=member.deprecated if member.deprecated is not None else deprecated if deprecated is not None else u"false",
+ removed=member.removed if member.removed is not None else removed if removed is not None else u"false",
+ vector_name=member.name)
+ else:
+ return self._impl_code_item_fill_template_with_version.substitute(
+ name=member.name,
+ var_name=self._gen_schema_item_var_name(member),
+ is_mandatory=u"true" if member.is_mandatory is True else u"false",
+ since=member.since if member.since is not None else since if since is not None else "",
+ until=member.until if member.until is not None else until if until is not None else "",
+ deprecated=member.deprecated if member.deprecated is not None else deprecated if deprecated is not None else u"false",
+ removed=member.removed if member.removed is not None else removed if removed is not None else u"false")
+ else:
+ return self._impl_code_item_fill_template.substitute(
+ name=member.name,
+ var_name=self._gen_schema_item_var_name(member),
+ is_mandatory=u"true" if member.is_mandatory is True else u"false")
- return self._impl_code_item_fill_template.substitute(
- name=member.name,
- var_name=self._gen_schema_item_var_name(member),
- is_mandatory=u"true" if member.is_mandatory is True else u"false")
+ def _gen_history_vector_item_fill(self, member, vector_name):
+ """Generate schema item fill code.
+
+ Generates source code that fills history vector with item.
+
+ Keyword arguments:
+ member -- struct member/function parameter to process.
+
+ Returns:
+ String with schema item fill code.
+
+ """
+
+ if (member.since is not None or
+ member.until is not None or
+ member.deprecated is not None or
+ member.removed is not None):
+ return self._impl_code_append_history_vector_template.substitute(
+ vector_name=vector_name,
+ name=member.name,
+ mandatory=u"true" if member.is_mandatory is True else u"false",
+ since=member.since if member.since is not None else "",
+ until=member.until if member.until is not None else "",
+ deprecated=member.deprecated if member.deprecated is not None else u"false",
+ removed=member.removed if member.removed is not None else u"false")
+ else:
+ print("Warning! History item does not have any version history. Omitting " + member.name)
@staticmethod
def _gen_schema_item_var_name(member):
@@ -899,7 +1156,7 @@ class CodeGenerator(object):
schema_items_decl=self._gen_schema_items_decls(
function.params.values()),
schema_item_fill=self._gen_schema_items_fill(
- function.params.values()),
+ function.params.values(), function.since, function.until, function.deprecated, function.removed),
schema_params_fill=self._gen_schema_params_fill(
function.message_type.name)),
1))
@@ -926,11 +1183,11 @@ class CodeGenerator(object):
if structs:
struct_id_enum_elements = collections.OrderedDict()
for struct in structs:
- struct_id_enum_elements[struct.name] = Model.EnumElement(
+ struct_id_enum_elements[struct.name] = EnumElement(
name=struct.name)
return u"\n".join(
[self._gen_enum(
- Model.Enum(name="StructIdentifiers",
+ Enum(name="StructIdentifiers",
elements=struct_id_enum_elements)),
u"\n".join([self._gen_enum(x) for x in enums])])
@@ -949,8 +1206,8 @@ class CodeGenerator(object):
"""
- enum_elements = enum.elements.values()
- enum_elements.insert(0, Model.EnumElement(
+ enum_elements = list(enum.elements.values())
+ enum_elements.insert(0, EnumElement(
name=u"INVALID_ENUM",
description=None,
design_description=None,
@@ -1051,7 +1308,7 @@ class CodeGenerator(object):
interface_item_base_classname)
name = interface_item_base.primary_name if \
- type(interface_item_base) is Model.EnumElement else \
+ type(interface_item_base) is EnumElement else \
interface_item_base.name
brief_description = (u" * @brief {0}{1}.\n" if use_doxygen is
True else u"// {0}{1}.\n").format(
@@ -1094,7 +1351,7 @@ class CodeGenerator(object):
True else u"//\n", todos])
returns = u""
- if type(interface_item_base) is Model.Function:
+ if type(interface_item_base) is Function:
returns = u"".join([u" *\n", self._function_return_comment])
template = self._comment_doxygen_template if use_doxygen is \
@@ -1156,7 +1413,7 @@ class CodeGenerator(object):
u"Param": u"Struct member ",
u"FunctionParam": u"Function parameter "})
- _h_file_tempalte = string.Template(
+ _h_file_template = string.Template(
u'''/**\n'''
u''' * @file ${class_name}.h\n'''
u''' * @brief Generated class ${class_name} header file.\n'''
@@ -1221,7 +1478,7 @@ class CodeGenerator(object):
u'''#endif //$guard\n'''
u'''\n\n''')
- _hpp_schema_file_tempalte = string.Template(
+ _hpp_schema_file_template = string.Template(
u'''/**\n'''
u''' * @file ${class_name}.h\n'''
u''' * @brief Generated class ${class_name} header file.\n'''
@@ -1283,7 +1540,7 @@ class CodeGenerator(object):
u'''#include "formatters/CSmartFactory.h"\n'''
u'''#include "smart_objects/smart_schema.h"\n'''
u'''#include "smart_objects/schema_item.h"\n'''
- u'''#include "utils/shared_ptr.h"\n'''
+ u'''#include "smart_objects/object_schema_item.h"\n'''
u'''#include "$header_file_name"\n'''
u'''\n'''
u'''$namespace_open'''
@@ -1308,7 +1565,7 @@ class CodeGenerator(object):
u'''SmartSchemas\n'''
u''' * in accordance with definitions from ${class_name}.xml file\n'''
u''' */\n'''
- u'''// Copyright (c) 2013, Ford Motor Company\n'''
+ u'''// Copyright (c) 2019, SmartDeviceLink Consortium, Inc.\n'''
u'''// All rights reserved.\n'''
u'''//\n'''
u'''// Redistribution and use in source and binary forms, '''
@@ -1327,11 +1584,11 @@ class CodeGenerator(object):
u'''provided with the\n'''
u'''// distribution.\n'''
u'''//\n'''
- u'''// Neither the name of the Ford Motor Company nor the names '''
- u'''of its contributors\n'''
- u'''// may be used to endorse or promote products derived '''
- u'''from this software\n'''
- u'''// without specific prior written permission.\n'''
+ u'''// Neither the name of the SmartDeviceLink Consortium, Inc. nor the names '''
+ u'''of its\n'''
+ u'''// contributors may be used to endorse or promote products derived '''
+ u'''from this\n'''
+ u'''// software without specific prior written permission.\n'''
u'''//\n'''
u'''// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND '''
u'''CONTRIBUTORS "AS IS"\n'''
@@ -1368,10 +1625,10 @@ class CodeGenerator(object):
u'''#include "smart_objects/number_schema_item.h"\n'''
u'''#include "smart_objects/schema_item_parameter.h"\n'''
u'''\n'''
- u'''using namespace NsSmartDeviceLink::NsSmartObjects;\n'''
+ u'''using namespace ns_smart_device_link::ns_smart_objects;\n'''
u'''\n'''
u'''$namespace::$class_name::$class_name()\n'''
- u''' : NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::eType, '''
+ u''' : ns_smart_device_link::ns_json_handler::CSmartFactory<FunctionID::eType, '''
u'''messageType::eType, StructIdentifiers::eType>() {\n'''
u''' TStructsSchemaItems struct_schema_items;\n'''
u''' InitStructSchemes(struct_schema_items);\n'''
@@ -1386,7 +1643,7 @@ class CodeGenerator(object):
u'''message_type_items);\n'''
u'''}\n'''
u'''\n'''
- u'''utils::SharedPtr<ISchemaItem> $namespace::$class_name::'''
+ u'''std::shared_ptr<ISchemaItem> $namespace::$class_name::'''
u'''ProvideObjectSchemaItemForStruct(\n'''
u''' const TStructsSchemaItems &struct_schema_items,\n'''
u''' const StructIdentifiers::eType struct_id) {\n'''
@@ -1396,10 +1653,36 @@ class CodeGenerator(object):
u''' return it->second;\n'''
u''' }\n'''
u'''\n'''
- u''' return NsSmartDeviceLink::NsSmartObjects::'''
+ u''' return ns_smart_device_link::ns_smart_objects::'''
u'''CAlwaysFalseSchemaItem::create();\n'''
u'''}\n'''
u'''\n'''
+ u'''bool $namespace::$class_name::AddCustomMember(FunctionID::eType function_id,\n'''
+ u''' messageType::eType message_type,\n'''
+ u''' std::string member_key, ns_smart_device_link::ns_smart_objects::SMember member) {\n'''
+ u''' using namespace ns_smart_device_link::ns_json_handler;\n'''
+ u''' using namespace ns_smart_device_link::ns_smart_objects;\n'''
+ u''' SmartSchemaKey<FunctionID::eType, messageType::eType> shema_key(function_id, message_type);\n'''
+ u''' auto function_schema = functions_schemes_.find(shema_key);\n'''
+ u''' if (functions_schemes_.end() == function_schema){\n'''
+ u''' return false;\n'''
+ u''' }\n'''
+ u'''\n'''
+ u''' auto schema = function_schema->second.getSchemaItem();\n'''
+ u''' auto msg_params_schema_item = schema->GetMemberSchemaItem(ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS);\n'''
+ u''' if (!msg_params_schema_item.is_initialized()){\n'''
+ u''' return false;\n'''
+ u''' }\n'''
+ u'''\n'''
+ u''' msg_params_schema_item->mSchemaItem->AddMemberSchemaItem(member_key, member);\n'''
+ u''' return true;\n'''
+ u'''}\n'''
+ u'''\n'''
+ u'''void $namespace::$class_name::ResetFunctionSchema(FunctionID::eType function_id,\n'''
+ u''' messageType::eType message_type) {\n'''
+ u''' InitFunctionSchema(function_id, message_type);\n'''
+ u'''}\n'''
+ u'''\n'''
u'''void $namespace::$class_name::InitStructSchemes(\n'''
u''' TStructsSchemaItems &struct_schema_items) {'''
u'''$struct_schema_items'''
@@ -1413,6 +1696,19 @@ class CodeGenerator(object):
u'''$function_schemas'''
u'''}\n'''
u'''\n'''
+ u'''void $namespace::$class_name::InitFunctionSchema(\n'''
+ u''' const FunctionID::eType &function_id,\n'''
+ u''' const messageType::eType &message_type) {\n'''
+ u'''\n'''
+ u''' TStructsSchemaItems struct_schema_items;\n'''
+ u''' InitStructSchemes(struct_schema_items);\n'''
+ u'''\n'''
+ u''' std::set<FunctionID::eType> function_id_items { function_id };\n'''
+ u''' std::set<messageType::eType> message_type_items { message_type };\n'''
+ u'''\n'''
+ u'''$function_schemas_switch'''
+ u'''}\n'''
+ u'''\n'''
u'''//------------- Functions schemes initialization -------------\n'''
u'''\n'''
u'''$init_function_impls'''
@@ -1423,13 +1719,13 @@ class CodeGenerator(object):
u'''\n'''
u'''//-------------- String to value enum mapping ----------------\n'''
u'''\n'''
- u'''namespace NsSmartDeviceLink {\n'''
- u'''namespace NsSmartObjects {\n'''
+ u'''namespace ns_smart_device_link {\n'''
+ u'''namespace ns_smart_objects {\n'''
u'''\n'''
u'''$enum_string_coversions'''
u'''\n'''
- u'''} // NsSmartObjects\n'''
- u'''} // NsSmartDeviceLink\n'''
+ u'''} // ns_smart_objects\n'''
+ u'''} // ns_smart_device_link\n'''
u'''\n''')
_enum_to_str_converter_template = string.Template(
@@ -1464,8 +1760,28 @@ class CodeGenerator(object):
u'''};\n'''
u'''\n''')
+ _function_switch_template = string.Template(
+ u'''switch(${switchable}) {\n'''
+ u'''${cases}'''
+ u'''}\n''')
+
+ _message_type_case_template = string.Template(
+ u'''case messageType::${message_type}: {\n'''
+ u'''${case_body}'''
+ u''' break;\n'''
+ u'''}\n''')
+
+ _function_id_case_template = string.Template(
+ u'''case FunctionID::${function_id}: {\n'''
+ u''' ns_smart_device_link::ns_json_handler::SmartSchemaKey<FunctionID::eType, messageType::eType> shema_key(function_id, message_type);\n'''
+ u''' functions_schemes_[shema_key] = '''
+ u'''InitFunction_${function_id}_${message_type}('''
+ u'''struct_schema_items, function_id_items, message_type_items);\n'''
+ u''' break;\n'''
+ u'''}\n''')
+
_struct_schema_item_template = string.Template(
- u'''utils::SharedPtr<ISchemaItem> struct_schema_item_${name} = '''
+ u'''std::shared_ptr<ISchemaItem> struct_schema_item_${name} = '''
u'''InitStructSchemaItem_${name}(struct_schema_items);\n'''
u'''struct_schema_items.insert(std::make_pair('''
u'''StructIdentifiers::${name}, struct_schema_item_${name}));\n'''
@@ -1474,15 +1790,15 @@ class CodeGenerator(object):
u'''struct_schema_item_${name})));''')
_function_schema_template = string.Template(
- u'''functions_schemes_.insert(std::make_pair(NsSmartDeviceLink::'''
- u'''NsJSONHandler::'''
+ u'''functions_schemes_.insert(std::make_pair(ns_smart_device_link::'''
+ u'''ns_json_handler::'''
u'''SmartSchemaKey<FunctionID::eType, messageType::eType>'''
u'''(FunctionID::$function_id, messageType::$message_type), '''
u'''InitFunction_${function_id}_${message_type}('''
u'''struct_schema_items, function_id_items, message_type_items)));''')
_struct_impl_template = string.Template(
- u'''utils::SharedPtr<ISchemaItem> $namespace::$class_name::'''
+ u'''std::shared_ptr<ISchemaItem> $namespace::$class_name::'''
u'''InitStructSchemaItem_${struct_name}(\n'''
u''' const TStructsSchemaItems &struct_schema_items) {\n'''
u'''$code'''
@@ -1491,7 +1807,7 @@ class CodeGenerator(object):
_struct_impl_code_tempate = string.Template(
u'''${schema_loc_decl}'''
u'''${schema_items_decl}'''
- u'''CObjectSchemaItem::Members '''
+ u'''Members '''
u'''schema_members;\n\n'''
u'''${schema_item_fill}'''
u'''return CObjectSchemaItem::create(schema_members);''')
@@ -1499,12 +1815,31 @@ class CodeGenerator(object):
_impl_code_loc_decl_enum_template = string.Template(
u'''std::set<${type}::eType> ${var_name};''')
+ _impl_code_loc_decl_enum_history_set_template = string.Template(
+ u'''std::map<${type}::eType, std::vector<ElementSignature>> ${type}_element_signatures;''')
+
_impl_code_loc_decl_enum_insert_template = string.Template(
u'''${var_name}.insert(${enum}::${value});''')
+ _impl_code_loc_decl_enum_history_set_value_init_template = string.Template(
+ u'''${enum}_element_signatures[${enum}::${value}] = std::vector<ElementSignature>();'''
+ )
+
+ _impl_code_loc_decl_enum_history_set_insert_template = string.Template(
+ u'''${enum}_element_signatures[${enum}::${value}].push_back(ElementSignature("${since}", "${until}", ${removed}));''')
+
+ _impl_gen_schema_enum_history_map_template = string.Template(
+ u'''${name}_element_signatures''')
+
_impl_code_item_decl_temlate = string.Template(
u'''${comment}'''
- u'''utils::SharedPtr<ISchemaItem> ${var_name} = ${item_decl};''')
+ u'''std::shared_ptr<ISchemaItem> ${var_name} = ${item_decl};''')
+
+ _impl_code_shared_ptr_vector_template = string.Template(
+ u'''std::vector<SMember> ${var_name}_history_vector;''')
+
+ _impl_code_append_history_vector_template = string.Template(
+ u'''${vector_name}_history_vector.push_back(SMember(${name}_SchemaItem, ${mandatory}, "${since}", "${until}", ${deprecated}, ${removed}));''')
_impl_code_integer_item_template = string.Template(
u'''TNumberSchemaItem<${type}>::create(${params})''')
@@ -1525,12 +1860,20 @@ class CodeGenerator(object):
_impl_code_enum_item_template = string.Template(
u'''TEnumSchemaItem<${type}::eType>::create(${params})''')
+ _impl_code_enum_item_with_history_template = string.Template(
+ u'''TEnumSchemaItem<${type}::eType>::createWithSignatures(${params})''')
+
_impl_code_item_param_value_template = string.Template(
u'''TSchemaItemParameter<$type>($value)''')
_impl_code_item_fill_template = string.Template(
- u'''schema_members["${name}"] = CObjectSchemaItem::'''
- u'''SMember(${var_name}, ${is_mandatory});''')
+ u'''schema_members["${name}"] = SMember(${var_name}, ${is_mandatory});''')
+
+ _impl_code_item_fill_template_with_version = string.Template(
+ u'''schema_members["${name}"] = SMember(${var_name}, ${is_mandatory}, "${since}", "${until}", ${deprecated}, ${removed});''')
+
+ _impl_code_item_fill_template_with_version_and_history_vector = string.Template(
+ u'''schema_members["${name}"] = SMember(${var_name}, ${is_mandatory}, "${since}", "${until}", ${deprecated}, ${removed}, ${vector_name}_history_vector);''')
_function_impl_template = string.Template(
u'''CSmartSchema $namespace::$class_name::'''
@@ -1544,29 +1887,29 @@ class CodeGenerator(object):
_function_impl_code_tempate = string.Template(
u'''${schema_loc_decl}'''
u'''${schema_items_decl}'''
- u'''CObjectSchemaItem::Members '''
+ u'''Members '''
u'''schema_members;\n\n'''
u'''${schema_item_fill}'''
- u'''CObjectSchemaItem::Members '''
+ u'''Members '''
u'''params_members;\n'''
u'''${schema_params_fill}'''
u'''\n'''
- u'''CObjectSchemaItem::Members '''
+ u'''Members '''
u'''root_members_map;\n'''
- u'''root_members_map[NsSmartDeviceLink::NsJSONHandler::'''
+ u'''root_members_map[ns_smart_device_link::ns_json_handler::'''
u'''strings::S_MSG_PARAMS] = '''
- u'''CObjectSchemaItem::SMember(CObjectSchemaItem::'''
+ u'''SMember(CObjectSchemaItem::'''
u'''create(schema_members), true);\n'''
- u'''root_members_map[NsSmartDeviceLink::NsJSONHandler::'''
+ u'''root_members_map[ns_smart_device_link::ns_json_handler::'''
u'''strings::S_PARAMS] = '''
- u'''CObjectSchemaItem::SMember(CObjectSchemaItem::'''
+ u'''SMember(CObjectSchemaItem::'''
u'''create(params_members), true);\n\n'''
u'''return CSmartSchema(CObjectSchemaItem::'''
u'''create(root_members_map));''')
_class_h_template = string.Template(
u'''$comment\n'''
- u'''class $class_name : public NsSmartDeviceLink::NsJSONHandler::'''
+ u'''class $class_name : public ns_smart_device_link::ns_json_handler::'''
u'''CSmartFactory<FunctionID::eType, messageType::eType, '''
u'''StructIdentifiers::eType> {\n'''
u''' public:\n'''
@@ -1575,24 +1918,37 @@ class CodeGenerator(object):
u''' */\n'''
u''' $class_name();\n'''
u'''\n'''
- u''' protected:\n'''
+ u''' /**\n'''
+ u''' * @brief Adds custom members to existing list of params.\n'''
+ u''' */\n'''
+ u''' bool AddCustomMember(FunctionID::eType function_id,\n'''
+ u''' messageType::eType message_type,\n'''
+ u''' std::string member_key, ns_smart_device_link::ns_smart_objects::SMember member);\n'''
+ u'''\n'''
+ u''' /**\n'''
+ u''' * @brief Reset function schema to state defined in API.\n'''
+ u''' */\n'''
+ u''' void ResetFunctionSchema(FunctionID::eType function_id,\n'''
+ u''' messageType::eType message_type);\n'''
+ u'''\n'''
u''' /**\n'''
u''' * @brief Type that maps of struct IDs to schema items.\n'''
u''' */\n'''
u''' typedef std::map<const StructIdentifiers::eType, '''
- u'''utils::SharedPtr<NsSmartDeviceLink::NsSmartObjects::'''
+ u'''std::shared_ptr<ns_smart_device_link::ns_smart_objects::'''
u'''ISchemaItem> > TStructsSchemaItems;\n'''
u'''\n'''
+ u''' protected:\n'''
u''' /**\n'''
u''' * @brief Helper that allows to make reference to struct\n'''
u''' *\n'''
u''' * @param struct_schema_items Struct schema items.\n'''
u''' * @param struct_id ID of structure to provide.\n'''
u''' *\n'''
- u''' * @return utils::SharedPtr of strucute\n'''
+ u''' * @return std::shared_ptr of strucute\n'''
u''' */\n'''
u''' static '''
- u'''utils::SharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> '''
+ u'''std::shared_ptr<ns_smart_device_link::ns_smart_objects::ISchemaItem> '''
u'''ProvideObjectSchemaItemForStruct(\n'''
u''' const TStructsSchemaItems &struct_schema_items,\n'''
u''' const StructIdentifiers::eType struct_id);\n'''
@@ -1618,17 +1974,28 @@ class CodeGenerator(object):
u''' const std::set<messageType::eType> '''
u'''&message_type_items);\n'''
u'''\n'''
+ u''' /**\n'''
+ u''' * @brief Initializes single function schema.\n'''
+ u''' *\n'''
+ u''' * @param function_id Function ID of schema to be initialized.\n'''
+ u''' * @param message_type Message type of schema to be initialized.\n'''
+ u''' */\n'''
+ u''' void InitFunctionSchema(\n'''
+ u''' const FunctionID::eType &function_id,\n'''
+ u''' const messageType::eType &message_type);\n'''
+ u'''\n'''
u'''$init_function_decls'''
u'''\n'''
+ u''' public:\n'''
u'''$init_struct_decls'''
u'''};''')
- _function_return_comment = u''' * @return NsSmartDeviceLink::''' \
- u'''NsSmartObjects::CSmartSchema\n'''
+ _function_return_comment = u''' * @return ns_smart_device_link::''' \
+ u'''ns_smart_objects::CSmartSchema\n'''
_function_decl_template = string.Template(
u'''$comment\n'''
- u'''static NsSmartDeviceLink::NsSmartObjects::CSmartSchema '''
+ u'''static ns_smart_device_link::ns_smart_objects::CSmartSchema '''
u'''InitFunction_${function_id}_${message_type}(\n'''
u''' const TStructsSchemaItems &struct_schema_items,\n'''
u''' const std::set<FunctionID::eType> &function_id_items,\n'''
@@ -1637,7 +2004,7 @@ class CodeGenerator(object):
_struct_decl_template = string.Template(
u'''$comment\n'''
u'''static '''
- u'''utils::SharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> '''
+ u'''std::shared_ptr<ns_smart_device_link::ns_smart_objects::ISchemaItem> '''
u'''InitStructSchemaItem_${struct_name}(\n'''
u''' const TStructsSchemaItems &struct_schema_items);''')
diff --git a/tools/InterfaceGenerator/generator/generators/SmartFactoryJSONRPC.py b/tools/InterfaceGenerator/generator/generators/SmartFactoryJSONRPC.py
index cf9887d39d..f7241af30c 100755
--- a/tools/InterfaceGenerator/generator/generators/SmartFactoryJSONRPC.py
+++ b/tools/InterfaceGenerator/generator/generators/SmartFactoryJSONRPC.py
@@ -6,7 +6,7 @@ Defines JSONRPC format specific code generation rules.
import string
from generator.generators import SmartFactoryBase
-from generator import Model
+from model.enum_element import EnumElement
class CodeGenerator(SmartFactoryBase.CodeGenerator):
@@ -40,7 +40,7 @@ class CodeGenerator(SmartFactoryBase.CodeGenerator):
code = u""
for function in functions:
- if unicode(function.message_type.primary_name) == u"response":
+ if function.message_type.primary_name == u"response":
code = u"".join(
[code, self._error_response_insert_template.substitute(
function_id=function.function_id.primary_name)])
@@ -66,7 +66,7 @@ class CodeGenerator(SmartFactoryBase.CodeGenerator):
"""
if "response" in message_type.elements:
- message_type.elements[u"error_response"] = Model.EnumElement(
+ message_type.elements[u"error_response"] = EnumElement(
name=u"error_response")
return message_type
@@ -88,47 +88,47 @@ class CodeGenerator(SmartFactoryBase.CodeGenerator):
return u"".join(
[self._base_params,
self._correlation_id_param
- if unicode(message_type_name) != u"notification" else u"",
+ if message_type_name != u"notification" else u"",
self._additional_response_params
- if unicode(message_type_name) == u"response" else u""])
+ if message_type_name == u"response" else u""])
_error_response_insert_template = string.Template(
u'''functions_schemes_.insert(std::make_pair('''
- u'''NsSmartDeviceLink::NsJSONHandler::'''
+ u'''ns_smart_device_link::ns_json_handler::'''
u'''SmartSchemaKey<FunctionID::eType, messageType::eType>('''
u'''FunctionID::${function_id}, messageType::error_response), '''
u'''error_response_schema));\n''')
_error_response_schema_template = (
- u'''CObjectSchemaItem::Members '''
+ u'''Members '''
u'''params_members;\n'''
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember('''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::S_FUNCTION_ID] = SMember('''
u'''TEnumSchemaItem<FunctionID::eType>::create('''
u'''function_id_items), true);\n'''
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember('''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::S_MESSAGE_TYPE] = SMember('''
u'''TEnumSchemaItem<messageType::eType>::create('''
u'''message_type_items), true);\n'''
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember('''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::S_PROTOCOL_VERSION] = SMember('''
u'''TNumberSchemaItem<int>::create(), true);\n'''
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember('''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::S_PROTOCOL_TYPE] = SMember('''
u'''TNumberSchemaItem<int>::create(), true);\n'''
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::S_CORRELATION_ID] = CObjectSchemaItem::SMember('''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::S_CORRELATION_ID] = SMember('''
u'''TNumberSchemaItem<int>::create(), true);\n'''
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::kCode] = CObjectSchemaItem::SMember('''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::kCode] = SMember('''
u'''TNumberSchemaItem<int>::create(), true);\n'''
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::kMessage] = CObjectSchemaItem::SMember('''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::kMessage] = SMember('''
u'''CStringSchemaItem::create(), true);\n'''
u'''\n'''
- u'''CObjectSchemaItem::Members root_members_map;\n'''
- u'''root_members_map[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::S_PARAMS] = CObjectSchemaItem::SMember('''
+ u'''Members root_members_map;\n'''
+ u'''root_members_map[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::S_PARAMS] = SMember('''
u'''CObjectSchemaItem::create(params_members), true);\n'''
u'''\n'''
u'''CSmartSchema error_response_schema('''
@@ -136,30 +136,24 @@ class CodeGenerator(SmartFactoryBase.CodeGenerator):
u'''\n''')
_base_params = (
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::S_FUNCTION_ID] = CObjectSchemaItem::'''
- u'''SMember(TEnumSchemaItem<FunctionID::eType>::'''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::S_FUNCTION_ID] = SMember(TEnumSchemaItem<FunctionID::eType>::'''
u'''create(function_id_items), true);\n'''
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::S_MESSAGE_TYPE] = CObjectSchemaItem::'''
- u'''SMember(TEnumSchemaItem<messageType::eType>::'''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::S_MESSAGE_TYPE] = SMember(TEnumSchemaItem<messageType::eType>::'''
u'''create(message_type_items), true);\n'''
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::'''
- u'''SMember(TNumberSchemaItem<int>::create(), true);\n'''
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::'''
- u'''SMember(TNumberSchemaItem<int>::create(), true);\n'''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::S_PROTOCOL_VERSION] = SMember(TNumberSchemaItem<int>::create(), true);\n'''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::S_PROTOCOL_TYPE] = SMember(TNumberSchemaItem<int>::create(), true);\n'''
)
_correlation_id_param = (
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::S_CORRELATION_ID] = CObjectSchemaItem::'''
- u'''SMember(TNumberSchemaItem<int>::create(), true);\n'''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::S_CORRELATION_ID] = SMember(TNumberSchemaItem<int>::create(), true);\n'''
)
_additional_response_params = (
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::'''
- u'''strings::kCode] = CObjectSchemaItem::'''
- u'''SMember(TNumberSchemaItem<int>::create(), true);\n'''
+ u'''params_members[ns_smart_device_link::ns_json_handler::'''
+ u'''strings::kCode] = SMember(TNumberSchemaItem<int>::create(), true);\n'''
)
diff --git a/tools/InterfaceGenerator/generator/generators/SmartFactorySDLRPC.py b/tools/InterfaceGenerator/generator/generators/SmartFactorySDLRPC.py
index b3fb61f4a9..ef5cf9286b 100755
--- a/tools/InterfaceGenerator/generator/generators/SmartFactorySDLRPC.py
+++ b/tools/InterfaceGenerator/generator/generators/SmartFactorySDLRPC.py
@@ -67,26 +67,21 @@ class CodeGenerator(SmartFactoryBase.CodeGenerator):
"""
base_params = \
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::''' \
- u'''strings::S_FUNCTION_ID] = CObjectSchemaItem::''' \
- u'''SMember(TEnumSchemaItem<FunctionID::eType>::''' \
+ u'''params_members[ns_smart_device_link::ns_json_handler::''' \
+ u'''strings::S_FUNCTION_ID] = SMember(TEnumSchemaItem<FunctionID::eType>::''' \
u'''create(function_id_items), true);\n''' \
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::''' \
- u'''strings::S_MESSAGE_TYPE] = CObjectSchemaItem::''' \
- u'''SMember(TEnumSchemaItem<messageType::eType>::''' \
+ u'''params_members[ns_smart_device_link::ns_json_handler::''' \
+ u'''strings::S_MESSAGE_TYPE] = SMember(TEnumSchemaItem<messageType::eType>::''' \
u'''create(message_type_items), true);\n''' \
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::''' \
- u'''strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::''' \
- u'''SMember(TNumberSchemaItem<int>::create(), true);\n''' \
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::''' \
- u'''strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::''' \
- u'''SMember(TNumberSchemaItem<int>::create(), true);\n'''
+ u'''params_members[ns_smart_device_link::ns_json_handler::''' \
+ u'''strings::S_PROTOCOL_VERSION] = SMember(TNumberSchemaItem<int>::create(), true);\n''' \
+ u'''params_members[ns_smart_device_link::ns_json_handler::''' \
+ u'''strings::S_PROTOCOL_TYPE] = SMember(TNumberSchemaItem<int>::create(), true);\n'''
correlation_id_param = \
- u'''params_members[NsSmartDeviceLink::NsJSONHandler::''' \
- u'''strings::S_CORRELATION_ID] = CObjectSchemaItem::''' \
- u'''SMember(TNumberSchemaItem<int>::create(), true);\n'''
+ u'''params_members[ns_smart_device_link::ns_json_handler::''' \
+ u'''strings::S_CORRELATION_ID] = SMember(TNumberSchemaItem<int>::create(), true);\n'''
return u"".join([base_params, correlation_id_param
- if unicode(message_type_name) !=
+ if message_type_name !=
u"notification" else u""])
diff --git a/tools/InterfaceGenerator/generator/parsers/JSONRPC.py b/tools/InterfaceGenerator/generator/parsers/JSONRPC.py
index 092f41ec17..e63bcc38aa 100755
--- a/tools/InterfaceGenerator/generator/parsers/JSONRPC.py
+++ b/tools/InterfaceGenerator/generator/parsers/JSONRPC.py
@@ -4,13 +4,17 @@ Contains parser for JSON RPC XML format.
"""
-from generator.parsers import RPCBase
+from parsers.parse_error import ParseError
+from parsers.rpc_base import RPCBase
-class Parser(RPCBase.Parser):
-
+class Parser(RPCBase):
"""JSON RPC parser."""
+ @property
+ def get_version(self):
+ return '1.0.0'
+
def __init__(self):
"""Constructor."""
super(Parser, self).__init__()
@@ -32,16 +36,27 @@ class Parser(RPCBase.Parser):
for element in root:
if element.tag != "interface":
- raise RPCBase.ParseError("Subelement '" + element.tag +
- "' is unexpected in interfaces")
+ raise ParseError("Subelement '" + element.tag +
+ "' is unexpected in interfaces")
if "name" not in element.attrib:
- raise RPCBase.ParseError(
+ raise ParseError(
"Name is not specified for interface")
self._interface_name = element.attrib["name"]
self._parse_interface(element, self._interface_name + "_")
+ def _check_enum_name(self, enum):
+ """Check enum name.
+
+ This method is called to check whether the newly parsed enum's name
+ conflicts with some predefined enum.
+ As SDLRPCV2 has no predefined enums this implementation does nothing.
+
+ """
+
+ pass
+
def _provide_enum_element_for_function(self, enum_name, element_name):
"""Provide enum element for functions.
@@ -60,7 +75,7 @@ class Parser(RPCBase.Parser):
if "FunctionID" == enum_name:
prefix_length = len(self._interface_name) + 1
if element_name[:prefix_length] != self._interface_name + '_':
- raise RPCBase.ParseError(
+ raise ParseError(
"Unexpected prefix for function id '" +
element_name + "'")
name = self._interface_name + "." + element_name[prefix_length:]
@@ -83,7 +98,7 @@ class Parser(RPCBase.Parser):
"""
if function_param_name in ['method', 'code']:
- raise RPCBase.ParseError(
+ raise ParseError(
"'" + function_param_name +
"' is a predefined name and can't be used" +
" as a function parameter name")
diff --git a/tools/InterfaceGenerator/generator/parsers/RPCBase.py b/tools/InterfaceGenerator/generator/parsers/RPCBase.py
deleted file mode 100755
index 4853916dad..0000000000
--- a/tools/InterfaceGenerator/generator/parsers/RPCBase.py
+++ /dev/null
@@ -1,767 +0,0 @@
-"""RPC XML base parser.
-
-Contains base parser for SDLRPC v1/v2 and JSON RPC XML format.
-
-"""
-
-import collections
-import xml.etree.ElementTree
-
-from generator import Model
-
-
-class ParseError(Exception):
-
- """Parse error.
-
- This exception is raised when XML contains errors and can't be parsed.
-
- """
-
- pass
-
-
-class Parser(object):
-
- """RPC XML Parser base.
-
- This class must not be used directly. One of its subclasses must be used
- instead.
-
- """
-
- def __init__(self):
- """Constructor."""
- self._types = {}
- self._enums = collections.OrderedDict()
- self._structs = collections.OrderedDict()
- self._functions = collections.OrderedDict()
- self._params = {}
-
- def parse(self, filename):
- """Parse XML.
-
- Returns an instance of generator.Model.Interface containing parsed
- interface or raises ParseError if input XML contains errors
- and can't be parsed.
-
- Keyword arguments:
- filename -- name of input XML file.
-
- """
-
- tree = xml.etree.ElementTree.parse(filename)
- root = tree.getroot()
-
- self._enums = self._initialize_enums()
- self._structs = collections.OrderedDict()
- self._functions = collections.OrderedDict()
- self._params = {}
-
- self._types = dict(self._enums.items())
-
- self._parse_root(root)
-
- return Model.Interface(enums=self._enums, structs=self._structs,
- functions=self._functions, params=self._params)
-
- def _initialize_enums(self):
- """Initialize enums.
-
- The default implementation returns an OrderedDict with two empty
- enums: "FunctionID" and "messageType". Required for formats where
- these enums must be generated automatically according to the declared
- in the XML functions.
-
- These enums are filled during the parsing of the functions.
-
- """
- return collections.OrderedDict(
- [("FunctionID", Model.Enum(name="FunctionID")),
- ("messageType", Model.Enum(name="messageType"))])
-
- def _check_enum_name(self, enum):
- """Check enum name.
-
- This method is called to check whether the newly parsed enum's name
- conflicts with some predefined enum.
-
- This implementation raises an error if enum name is one of the
- predefined enums "FunctionID" or "messageType" which must not be
- declared explicitly in the XML.
-
- """
- if enum.name in ["FunctionID", "messageType"]:
- raise ParseError(
- "Enum '" + enum.name +
- "' is generated automatically in SDLRPCV1 and"
- " must not be declared in xml file")
-
- def _check_function_param_name(self, function_param_name):
- """Check function param name.
-
- This method is called to check whether the newly parsed function
- parameter name conflicts with some predefined name.
-
- This implementation doesn't check anything because there is no
- predefined names in base RPC XML.
- """
-
- pass
-
- def _parse_root(self, root):
- """Parse root XML element.
-
- Default implementation parses root as interface element without a
- prefix.
-
- Keyword arguments:
- root -- root element.
-
- """
-
- self._parse_interface(root, "")
-
- def _parse_interface(self, interface, prefix):
- """Parse interface element.
-
- Keyword arguments:
- interface -- interface element.
- prefix -- string prefix for all types of the interface.
-
- """
- if interface.tag != "interface":
- raise ParseError("Invalid interface tag: " + interface.tag)
-
- params, subelements, attrib = self._parse_base_item(interface, "")
-
- for param in ["description", "design_description", "todos"]:
- if 0 != len(params[param]):
- attrib[param] = "\n".join(params[param])
-
- if 0 != len(params["issues"]):
- attrib["issues"] = "\n".join(i.value for i in params["issues"])
-
- self._params = dict(
- self._params.items() +
- [(prefix + p[0], p[1]) for p in attrib.items()])
-
- for element in subelements:
- if element.tag == "enum":
- enum = self._parse_enum(element, prefix)
- self._check_enum_name(enum)
- self._add_item(self._enums, enum)
- self._add_type(enum)
- elif element.tag == "struct":
- struct = self._parse_struct(element, prefix)
- self._add_item(self._structs, struct)
- self._add_type(struct)
- elif element.tag == "function":
- function = self._parse_function(element, prefix)
- self._add_item(self._functions, function,
- (function.function_id, function.message_type))
- else:
- raise ParseError("Unexpected element: " + element.tag)
-
- @staticmethod
- def _add_item(items, item, key=None):
- """Add new item in the items dictionary with given key.
-
- Performs additional check for presence in the dictionary and throws
- ParseError exception if key already exist.
-
- """
- if key is None:
- key = item.name
-
- if key in items:
- raise ParseError(type(item).__name__ + " '" + str(key) +
- "' is declared more than once")
- items[key] = item
-
- def _add_type(self, _type):
- """Add new type in the internal types dictionary.
-
- Performs additional check for presence type with same name in the
- dictionary and throws ParseError exception if key already exist.
-
- """
- if _type.name in self._types:
- raise ParseError("Type '" + _type.name +
- "' is declared as both struct and enum")
-
- self._types[_type.name] = _type
-
- def _parse_enum(self, element, prefix):
- """Parse element as enumeration.
-
- Returns an instance of generator.Model.Enum
-
- """
- params, subelements, attributes = \
- self._parse_base_item(element, prefix)
-
- internal_scope = None
- scope = None
- for attribute in attributes:
- if attribute == "internal_scope":
- internal_scope = attributes[attribute]
- elif attribute == "scope":
- scope = attributes[attribute]
- else:
- raise ParseError("Unexpected attribute '" + attribute +
- "' in enum '" + params["name"] + "'")
- params["internal_scope"] = internal_scope
- params["scope"] = scope
-
- elements = collections.OrderedDict()
- for subelement in subelements:
- if subelement.tag == "element":
- self._add_item(elements, self._parse_enum_element(subelement))
- else:
- raise ParseError("Unexpected element '" + subelement.tag +
- "' in enum '" + params["name"] + "'")
- params["elements"] = elements
-
- # Magic usage is correct
- # pylint: disable=W0142
- return Model.Enum(**params)
-
- def _parse_struct(self, element, prefix):
- """Parse element as structure.
-
- Returns an instance of generator.Model.Struct
-
- """
- params, subelements, attrib = self._parse_base_item(element, prefix)
-
- scope = None
- for attribute in attrib:
- if attribute == "scope":
- scope = attrib[attribute]
- else:
- raise ParseError("Unexpected attribute '" + attribute +
- "' in struct '" + params["name"] + "'")
- params["scope"] = scope
-
- members = collections.OrderedDict()
- for subelement in subelements:
- if subelement.tag == "param":
- self._add_item(members, self._parse_param(subelement, prefix))
- else:
- raise ParseError("Unexpected subelement '" + subelement.name +
- "' in struct '" + params["name"] + "'")
- params["members"] = members
-
- # Magic usage is correct
- # pylint: disable=W0142
- return Model.Struct(**params)
-
- def _parse_function(self, element, prefix):
- """Parse element as function.
-
- Returns an instance of generator.Model.Function
-
- """
- params, subelements, attributes = \
- self._parse_base_item(element, prefix)
-
- function_id, message_type = self._parse_function_id_type(
- params["name"],
- attributes)
-
- scope = None
- for attribute in attributes:
- if attribute == "scope":
- scope = attributes[attribute]
-
- params["function_id"] = function_id
- params["message_type"] = message_type
- params["scope"] = scope
-
- function_params = collections.OrderedDict()
- for subelement in subelements:
- if subelement.tag == "param":
- function_param = self._parse_function_param(subelement,
- prefix)
- self._check_function_param_name(function_param.name)
- if function_param.name in function_params:
- raise ParseError("Parameter '" + function_param.name +
- "' is specified more than once" +
- " for function '" + params["name"] + "'")
- function_params[function_param.name] = function_param
- else:
- raise ParseError("Unexpected subelement '" + subelement.tag +
- "' in function '" + params["name"] + "'")
- params["params"] = function_params
-
- # Magic usage is correct
- # pylint: disable=W0142
- return Model.Function(**params)
-
- def _parse_function_id_type(self, function_name, attrib):
- """Parse function id and message type according to XML format.
-
- This implementation takes function name as function id and extracts
- attribute "messagetype" as message type and searches them in enums
- "FunctionID" and "messageType" adding the missing elements if
- necessary.
-
- Returns function id and message type as an instances of EnumElement.
-
- """
- if "messagetype" not in attrib:
- raise ParseError("No messagetype specified for function '" +
- function_name + "'")
-
- function_id = self._provide_enum_element_for_function(
- "FunctionID",
- function_name)
-
- message_type = self._provide_enum_element_for_function(
- "messageType",
- self._extract_attrib(attrib, "messagetype"))
-
- return function_id, message_type
-
- def _provide_enum_element_for_function(self, enum_name, element_name):
- """Provide enum element for functions.
-
- Search an element in an enum and add it if it is missing.
-
- Returns EnumElement.
-
- """
- if enum_name not in self._types:
- raise ParseError("Enum '" + enum_name +
- "' is not initialized")
-
- enum = self._types[enum_name]
-
- if not isinstance(enum, Model.Enum):
- raise ParseError("'" + enum_name + "' is not an enum")
-
- if element_name not in enum.elements:
- enum.elements[element_name] = Model.EnumElement(name=element_name)
-
- return enum.elements[element_name]
-
- def _parse_base_item(self, element, prefix):
- """Parse element as base item.
-
- Returns an params, sub-elements and attributes of the element
-
- """
- params = {}
-
- description = []
- design_description = []
- issues = []
- todos = []
- subelements = []
-
- if "name" not in element.attrib:
- raise ParseError("Name is not specified for " + element.tag)
-
- params["name"] = prefix + element.attrib["name"]
- attrib = dict(element.attrib.items())
- del attrib["name"]
-
- params["platform"] = self._extract_attrib(attrib, "platform")
-
- for subelement in element:
- if subelement.tag == "description":
- description.append(self._parse_simple_element(subelement))
- elif subelement.tag == "designdescription":
- design_description.append(
- self._parse_simple_element(subelement))
- elif subelement.tag == "todo":
- todos.append(self._parse_simple_element(subelement))
- elif subelement.tag == "issue":
- issues.append(self._parse_issue(subelement))
- else:
- subelements.append(subelement)
-
- params["description"] = description
- params["design_description"] = design_description
- params["issues"] = issues
- params["todos"] = todos
-
- return params, subelements, attrib
-
- @staticmethod
- def _parse_simple_element(element):
- """Parse element as simple element and returns it's text.
-
- Element is simple when it contains no subelements and attributes.
-
- Returns element text if present or empty string if not
-
- """
- if len(element) != 0:
- raise ParseError("Unexpected subelements in '" +
- element.tag + "'")
- if len(element.attrib) != 0:
- raise ParseError("Unexpected attributes in '" +
- element.tag + "'")
- return element.text if element.text is not None else ""
-
- @staticmethod
- def _parse_issue(element):
- """Parse element as issue.
-
- Issue must not contain subelements and attributes.
-
- Returns an instance of generator.Model.Issue
-
- """
- if len(element) != 0:
- raise ParseError("Unexpected subelements in issue")
- if "creator" not in element.attrib:
- raise ParseError("No creator in issue")
- if len(element.attrib) != 1:
- raise ParseError("Unexpected attributes in issue")
-
- return Model.Issue(
- creator=element.attrib["creator"],
- value=element.text if element.text is not None else "")
-
- def _parse_enum_element(self, element):
- """Parse element as element of enumeration.
-
- Returns an instance of generator.Model.EnumElement
-
- """
- params, subelements, attributes = self._parse_base_item(element, "")
-
- if len(subelements) != 0:
- raise ParseError("Unexpected subelements in enum element")
-
- self._ignore_attribute(attributes, "hexvalue")
- self._ignore_attribute(attributes, "scope")
- self._ignore_attribute(attributes, "rootscreen")
-
- internal_name = None
- value = None
- for attribute in attributes:
- if attribute == "internal_name":
- internal_name = attributes[attribute]
- elif attribute == "value":
- try:
- value = int(attributes[attribute])
- except:
- raise ParseError("Invalid value for enum element: '" +
- attributes[attribute] + "'")
- params["internal_name"] = internal_name
- params["value"] = value
-
- # Magic usage is correct
- # pylint: disable=W0142
- return Model.EnumElement(**params)
-
- def _parse_param(self, element, prefix):
- """Parse element as structure parameter.
-
- Returns an instance of generator.Model.Param
-
- """
- params, subelements, attrib = \
- self._parse_param_base_item(element, prefix)
-
- if len(attrib) != 0:
- raise ParseError("""Unknown attribute(s) {0} in param {1}
- """.format(attrib, params["name"]))
-
- if len(subelements) != 0:
- raise ParseError("Unknown subelements in param '" +
- params["name"] + "'")
-
- # Magic usage is correct
- # pylint: disable=W0142
- return Model.Param(**params)
-
- def _parse_function_param(self, element, prefix):
- """Parse element as function parameter.
-
- Returns an instance of generator.Model.FunctionParam
-
- """
- params, subelements, attrib = \
- self._parse_param_base_item(element, prefix)
-
- default_value = None
- default_value_string = self._extract_attrib(attrib, "defvalue")
- if default_value_string is not None:
- param_type = params["param_type"]
- if type(param_type) is Model.Boolean:
- default_value = \
- self._get_bool_from_string(default_value_string)
- elif type(param_type) is Model.Integer:
- try:
- default_value = int(default_value_string)
- except:
- raise ParseError("Invalid value for integer: '" +
- default_value_string + "'")
- elif type(param_type) is Model.Double:
- try:
- default_value = float(default_value_string)
- except:
- raise ParseError("Invalid value for float: '" +
- default_value_string + "'")
- elif type(param_type) is Model.String:
- default_value = default_value_string
- elif type(param_type) is Model.Enum or \
- type(param_type) is Model.EnumSubset:
- if type(param_type) is Model.EnumSubset:
- allowed_elements = param_type.allowed_elements
- else:
- allowed_elements = param_type.elements
- if default_value_string not in allowed_elements:
- raise ParseError("Default value '" + default_value_string +
- "' for parameter '" + params["name"] +
- "' is not a member of " +
- type(param_type).__name__ +
- "'" + params["name"] + "'")
- default_value = allowed_elements[default_value_string]
- else:
- raise ParseError("Default value specified for " +
- type(param_type).__name__)
- params["default_value"] = default_value
-
- if len(attrib) != 0:
- raise ParseError("Unexpected attributes in parameter '" +
- params["name"] + "'")
-
- if len(subelements) != 0:
- raise ParseError("Unexpected subelements in parameter '" +
- params["name"] + "'")
-
- # Magic usage is correct
- # pylint: disable=W0142
- return Model.FunctionParam(**params)
-
- def _parse_param_base_item(self, element, prefix):
- """Parse base param items.
-
- Returns params, other subelements and attributes.
-
- """
- params, subelements, attrib = self._parse_base_item(element, "")
-
- is_mandatory = self._extract_attrib(attrib, "mandatory")
- if is_mandatory is None:
- raise ParseError("'mandatory' is not specified for parameter '" +
- params["name"] + "'")
-
- params["is_mandatory"] = self._get_bool_from_string(is_mandatory)
-
- scope = self._extract_attrib(attrib, "scope")
- if scope is not None:
- params["scope"] = scope
-
- default_value = None;
- param_type = None
- type_name = self._extract_attrib(attrib, "type")
- if type_name is None:
- raise ParseError("Type is not specified for parameter '" +
- params["name"] + "'")
- if type_name == "Boolean":
- default_value = self._extract_attrib(
- attrib, "defvalue")
- if default_value != None:
- default_value = self._get_bool_from_string(default_value);
- param_type = Model.Boolean(default_value=default_value)
- elif type_name == "Integer" or \
- type_name == "Float" or \
- type_name == "Double" :
- min_value = self._extract_optional_number_attrib(
- attrib, "minvalue", int if type_name == "Integer" else float)
- max_value = self._extract_optional_number_attrib(
- attrib, "maxvalue", int if type_name == "Integer" else float)
- default_value = self._extract_optional_number_attrib(
- attrib, "defvalue", int if type_name == "Integer" else float)
-
- param_type = \
- (Model.Integer if type_name == "Integer" else Model.Double)(
- min_value=min_value,
- max_value=max_value,
- default_value=default_value)
- elif type_name == "String":
- min_length = self._extract_optional_number_attrib(
- attrib, "minlength")
- # if minlength is not defined default value is 1
- if min_length is None:
- min_length = 1
- max_length = self._extract_optional_number_attrib(
- attrib, "maxlength")
- default_value = self._extract_attrib(attrib, "defvalue")
- param_type = Model.String(min_length=min_length, max_length=max_length, default_value=default_value)
- else:
- if 1 == type_name.count("."):
- custom_type_name = type_name.replace(".", "_")
- else:
- custom_type_name = prefix + type_name
-
- if custom_type_name in self._types:
- param_type = self._types[custom_type_name]
- default_value = self._extract_attrib(attrib, "defvalue")
- if default_value != None:
- if default_value not in param_type.elements:
- raise ParseError("Default value '" + default_value +
- "' for parameter '" + params["name"] +
- "' is not a member of " +
- type(param_type).__name__ +
- "'" + params["name"] + "'")
- default_value = param_type.elements[default_value]
- else:
- raise ParseError("Unknown type '" + type_name + "'")
-
- if self._extract_optional_bool_attrib(attrib, "array", False):
- min_size = self._extract_optional_number_attrib(attrib,
- "minsize")
- max_size = self._extract_optional_number_attrib(attrib,
- "maxsize")
- param_type = Model.Array(element_type=param_type,
- min_size=min_size,
- max_size=max_size)
-
- base_type = \
- param_type.element_type if isinstance(param_type, Model.Array) \
- else param_type
-
- other_subelements = []
- for subelement in subelements:
- if subelement.tag == "element":
- if type(base_type) is not Model.Enum and \
- type(base_type) is not Model.EnumSubset:
- raise ParseError("Elements specified for parameter '" +
- params["name"] + "' of type " +
- type(base_type).__name__)
- if type(base_type) is Model.Enum:
- base_type = Model.EnumSubset(
- name=params["name"],
- enum=base_type,
- description=params["description"],
- design_description=params["design_description"],
- issues=params["issues"],
- todos=params["todos"],
- allowed_elements={})
- if "name" not in subelement.attrib:
- raise ParseError(
- "Element name is not specified for parameter '" +
- params["name"] + "'")
- element_name = subelement.attrib["name"]
- if len(subelement.attrib) != 1:
- raise ParseError("Unexpected attributes for element '" +
- element_name + "' of parameter '" +
- params["name"])
- children = subelement.getchildren()
- for child in children:
- if child.tag == "description":
- children.remove(child)
- if len(children) != 0:
- raise ParseError("Unexpected subelements for element '" +
- element_name + "' of parameter '" +
- params["name"])
- if element_name in base_type.allowed_elements:
- raise ParseError("Element '" + element_name +
- "' is specified more than once for" +
- " parameter '" + params["name"] + "'")
- if element_name not in base_type.enum.elements:
- raise ParseError("Element '" + element_name +
- "' is not a member of enum '" +
- base_type.enum.name + "'")
- base_type.allowed_elements[element_name] = \
- base_type.enum.elements[element_name]
- else:
- other_subelements.append(subelement)
-
- if isinstance(param_type, Model.Array):
- param_type.element_type = base_type
- else:
- param_type = base_type
-
- params["param_type"] = param_type
- if default_value is not None:
- params["default_value"] = default_value
-
- return params, other_subelements, attrib
-
- def _extract_optional_bool_attrib(self, attrib, name, default):
- """Extract boolean attribute with given name.
-
- Returns value of the attribute.
-
- """
- value = self._extract_attrib(attrib, name)
-
- if value is None:
- value = default
- else:
- value = self._get_bool_from_string(value)
-
- return value
-
- def _extract_optional_number_attrib(self, attrib, name, _type=int):
- """Extract number attribute with given name.
-
- Returns value of the attribute.
-
- """
- value = self._extract_attrib(attrib, name)
-
- if value is not None:
- try:
- value = _type(value)
- except:
- raise ParseError("Invlaid value for " + _type.__name__ +
- ": '" + value + "'")
-
- return value
-
- @staticmethod
- def _extract_attrib(attrib, name):
- """Extract attribute with given name.
-
- Returns value of the attribute.
-
- """
- value = None
-
- if name in attrib:
- value = attrib[name]
- del attrib[name]
-
- return value
-
- @staticmethod
- def _get_bool_from_string(bool_string):
- """Convert string representation of boolean to real bool value.
-
- Returns converted value.
-
- """
- value = None
-
- if bool_string in ['0', 'false']:
- value = False
- elif bool_string in ['1', 'true']:
- value = True
- else:
- raise ParseError("Invalid value for bool: '" +
- bool_string + "'")
-
- return value
-
- def _ignore_attribute(self, attrib, name):
- """To be called when attribute is meaningless in terms
- of code generation but it's presence is not issue.
-
- Removes this attribute from attribute list.
-
- """
- if name in attrib:
- del attrib[name]
- print ("Ignoring attribute '" +
- name + "'")
- return True
diff --git a/tools/InterfaceGenerator/generator/parsers/SDLRPCV1.py b/tools/InterfaceGenerator/generator/parsers/SDLRPCV1.py
index 52158ee93b..eacf9d9f09 100755
--- a/tools/InterfaceGenerator/generator/parsers/SDLRPCV1.py
+++ b/tools/InterfaceGenerator/generator/parsers/SDLRPCV1.py
@@ -3,12 +3,12 @@
Contains parser for SDLRPCV1 XML format.
"""
+from parsers.rpc_base import RPCBase
-from generator.parsers import RPCBase
-
-
-class Parser(RPCBase.Parser):
+class Parser(RPCBase):
"""SDLRPCV1 parser."""
- pass
+ @property
+ def get_version(self):
+ return '1.0.0'
diff --git a/tools/InterfaceGenerator/generator/parsers/SDLRPCV2.py b/tools/InterfaceGenerator/generator/parsers/SDLRPCV2.py
deleted file mode 100755
index 3d67c6e4c6..0000000000
--- a/tools/InterfaceGenerator/generator/parsers/SDLRPCV2.py
+++ /dev/null
@@ -1,88 +0,0 @@
-"""SDLRPCV2 parser.
-
-Contains parser for SDLRPCV2 XML format.
-
-"""
-
-import collections
-
-from generator import Model
-from generator.parsers import RPCBase
-
-
-class Parser(RPCBase.Parser):
-
- """SDLRPCV2 parser."""
-
- def _initialize_enums(self):
- """Initialize enums.
-
- This implementation returns empty OrderedDict because in SDLRPCV2
- all enums must be declared explicitly in the XML file.
-
- """
- return collections.OrderedDict()
-
- def _check_enum_name(self, enum):
- """Check enum name.
-
- This method is called to check whether the newly parsed enum's name
- conflicts with some predefined enum.
- As SDLRPCV2 has no predefined enums this implementation does nothing.
-
- """
- pass
-
- def _parse_function_id_type(self, function_name, attrib):
- """Parse function id and message type according to XML format.
-
- This implementation extracts attribute "FunctionID" as function id
- and messagetype as message type and searches them in enums
- "FunctionID" and "messageType". If at least one of them (or the entire
- enum) is missing it raises an error.
-
- Returns function id and message type as an instances of EnumElement.
-
- """
- if "functionID" not in attrib:
- raise RPCBase.ParseError(
- "No functionID specified for function '" +
- function_name + "'")
-
- if "messagetype" not in attrib:
- raise RPCBase.ParseError(
- "No messagetype specified for function '" +
- function_name + "'")
-
- function_id = self._get_enum_element_for_function(
- "FunctionID",
- self._extract_attrib(attrib, "functionID"))
- message_type = self._get_enum_element_for_function(
- "messageType",
- self._extract_attrib(attrib, "messagetype"))
-
- return function_id, message_type
-
- def _get_enum_element_for_function(self, enum_name, element_name):
- """Get enum element with given name from given enumeration.
-
- Returns an instance of generator.Model.EnumElement.
-
- """
- if enum_name not in self._types:
- raise RPCBase.ParseError(
- "Enumeration '" + enum_name +
- "' must be declared before any function")
-
- enum = self._types[enum_name]
-
- if type(enum) is not Model.Enum:
- raise RPCBase.ParseError("'" + enum_name +
- "' is not an enumeration")
-
- if element_name not in enum.elements:
- raise RPCBase.ParseError(
- "'" + element_name +
- "' is not a member of enum '" + enum_name + "'")
-
- return enum.elements[element_name]
diff --git a/tools/InterfaceGenerator/requirements.txt b/tools/InterfaceGenerator/requirements.txt
index af21f6cb96..a76759eea6 100644
--- a/tools/InterfaceGenerator/requirements.txt
+++ b/tools/InterfaceGenerator/requirements.txt
@@ -1,6 +1,3 @@
-flake8
-pep8-naming
-pep257
-mccabe
+xmlschema
pylint
-mock \ No newline at end of file
+coverage
diff --git a/tools/InterfaceGenerator/test/CodeFormatAndQuality.py b/tools/InterfaceGenerator/test/CodeFormatAndQuality.py
new file mode 100755
index 0000000000..d403c821ab
--- /dev/null
+++ b/tools/InterfaceGenerator/test/CodeFormatAndQuality.py
@@ -0,0 +1,39 @@
+# pylint: disable=C0103, C0301, C0115, C0116
+"""Interface model unit test
+
+"""
+
+import unittest
+from os import walk
+from os.path import join
+from pathlib import Path
+
+from pylint.lint import Run
+
+
+class TestCodeFormatAndQuality(unittest.TestCase):
+ MINIMUM_SCORE = 3.7
+
+ def setUp(self):
+ """Searching for all python files to be checked
+
+ """
+ self.list_of_files = []
+ root = Path(__file__).absolute().parents[1]
+ for (directory, _, filenames) in walk(root.as_posix()):
+ self.list_of_files += [join(directory, file) for file in filenames
+ if file.endswith('.py') and not file.startswith('test')]
+ self.list_of_files.append('--max-line-length=130')
+ # self.list_of_files.append('--rcfile=../pylint.ini')
+
+ def test_pylint_conformance(self):
+ """Performing checks by PyLint
+
+ """
+ results = Run(self.list_of_files, do_exit=False)
+ score = results.linter.stats['global_note']
+ self.assertGreaterEqual(score, self.MINIMUM_SCORE)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/InterfaceGenerator/test/generator/generators/test_SmartFactoryBase.py b/tools/InterfaceGenerator/test/generator/generators/test_SmartFactoryBase.py
index aea91f4a45..08f231abe6 100755
--- a/tools/InterfaceGenerator/test/generator/generators/test_SmartFactoryBase.py
+++ b/tools/InterfaceGenerator/test/generator/generators/test_SmartFactoryBase.py
@@ -5,10 +5,21 @@ Verifies common helper functions and produced source code.
"""
import collections
import unittest
-
-from generator.generators import SmartFactoryBase
-from generator import Model
-
+from pathlib import Path
+
+import sys
+
+sys.path.append(Path(__file__).absolute().parents[3].as_posix())
+sys.path.append(Path(__file__).absolute().parents[4].joinpath('rpc_spec/InterfaceParser').as_posix())
+try:
+ from generator.generators import SmartFactoryBase
+ from model.enum import Enum
+ from model.enum_element import EnumElement
+ from model.issue import Issue
+ from generator.generators import SmartFactoryBase
+except ModuleNotFoundError as error:
+ print('{}.\nProbably you did not initialize submodule'.format(error))
+ sys.exit(1)
EXPECTED_RESULT_FULL_COMMENT = u"""/**
* @brief Enumeration Test Name.
@@ -133,15 +144,14 @@ DESCRIPTION = [u"Description Line1", u"Description Line2"]
DESIGN_DESCRIPTION = [u"Design Line1"]
-ISSUES = [Model.Issue(value=u"Issue1"),
- Model.Issue(value=u"Issue2"),
- Model.Issue(value=u"Issue3")]
+ISSUES = [Issue(value=u"Issue1"),
+ Issue(value=u"Issue2"),
+ Issue(value=u"Issue3")]
TODOS = [u"Do1", u"Do2"]
class Test(unittest.TestCase):
-
"""Test for SmartFactory base generator.
This class holds set of test cases for the SmartFactory base generator.
@@ -156,11 +166,11 @@ class Test(unittest.TestCase):
"""
generator = SmartFactoryBase.CodeGenerator()
- enum = Model.Enum(name=u"Test Name",
- description=DESCRIPTION,
- design_description=DESIGN_DESCRIPTION,
- issues=ISSUES,
- todos=TODOS)
+ enum = Enum(name=u"Test Name",
+ description=DESCRIPTION,
+ design_description=DESIGN_DESCRIPTION,
+ issues=ISSUES,
+ todos=TODOS)
self.assertEqual(generator._gen_comment(enum),
EXPECTED_RESULT_FULL_COMMENT,
"Full comment for enum is invalid")
@@ -173,16 +183,16 @@ class Test(unittest.TestCase):
"""
generator = SmartFactoryBase.CodeGenerator()
- enum_element1 = Model.EnumElement(name=u"Element1",
- internal_name=u"InternalName",
- value=u"10")
+ enum_element1 = EnumElement(name=u"Element1",
+ internal_name=u"InternalName",
+ value=u"10")
self.assertEqual(
generator._gen_enum_element(enum_element1),
EXPECTED_RESULT_ENUM_ELEMENT1,
"Short commented enum element with internal name is invalid")
- enum_element2 = Model.EnumElement(
+ enum_element2 = EnumElement(
name=u"NO_VALUE_ELEMENT",
description=DESCRIPTION,
design_description=DESIGN_DESCRIPTION)
@@ -198,14 +208,14 @@ class Test(unittest.TestCase):
"""
generator = SmartFactoryBase.CodeGenerator()
- elements = [Model.EnumElement(name=u"name1",
- design_description=DESIGN_DESCRIPTION,
- todos=TODOS,
- value=u"1"),
- Model.EnumElement(name=u"name2",
- description=DESCRIPTION,
- issues=ISSUES,
- internal_name=u"internal_name2")]
+ elements = [EnumElement(name=u"name1",
+ design_description=DESIGN_DESCRIPTION,
+ todos=TODOS,
+ value=u"1"),
+ EnumElement(name=u"name2",
+ description=DESCRIPTION,
+ issues=ISSUES,
+ internal_name=u"internal_name2")]
self.assertEqual(generator._gen_enum_elements(elements),
EXPECTED_RESULT_ENUM_ELEMENTS1,
"Simple enum elements are invalid")
@@ -219,35 +229,35 @@ class Test(unittest.TestCase):
generator = SmartFactoryBase.CodeGenerator()
elements1 = collections.OrderedDict()
- elements1[u"name1"] = Model.EnumElement(
+ elements1[u"name1"] = EnumElement(
name=u"name1",
design_description=DESIGN_DESCRIPTION,
todos=TODOS,
value=u"1")
- elements1[u"name2"] = Model.EnumElement(
+ elements1[u"name2"] = EnumElement(
name=u"name2",
description=DESCRIPTION,
issues=ISSUES,
internal_name=u"internal_name2")
- enum1 = Model.Enum(name=u"Enum1",
- todos=TODOS,
- elements=elements1)
+ enum1 = Enum(name=u"Enum1",
+ todos=TODOS,
+ elements=elements1)
self.assertEqual(generator._gen_enum(enum1),
EXPECTED_RESULT_ENUM1,
"Simple enum is invalid")
elements2 = collections.OrderedDict()
- elements2[u"xxx"] = Model.EnumElement(name=u"xxx",
- internal_name=u"val_1")
- elements2[u"yyy"] = Model.EnumElement(name=u"yyy",
- internal_name=u"val_2",
- value=u"100")
- elements2[u"zzz"] = Model.EnumElement(name=u"val_3")
-
- enum2 = Model.Enum(name=u"E2",
- elements=elements2)
+ elements2[u"xxx"] = EnumElement(name=u"xxx",
+ internal_name=u"val_1")
+ elements2[u"yyy"] = EnumElement(name=u"yyy",
+ internal_name=u"val_2",
+ value=u"100")
+ elements2[u"zzz"] = EnumElement(name=u"val_3")
+
+ enum2 = Enum(name=u"E2",
+ elements=elements2)
self.assertEqual(generator._gen_enum(enum2),
EXPECTED_RESULT_ENUM2,
"Long enum is invalid")
@@ -279,5 +289,6 @@ class Test(unittest.TestCase):
"aaa aaa"]),
["aaa", "1", "bbb", "2", "ccc", "3", "aaa aaa"])
+
if __name__ == '__main__':
unittest.main()
diff --git a/tools/InterfaceGenerator/test/generator/generators/test_SmartFactoryJSONRPC.py b/tools/InterfaceGenerator/test/generator/generators/test_SmartFactoryJSONRPC.py
index b21e320038..d3262c8da2 100755
--- a/tools/InterfaceGenerator/test/generator/generators/test_SmartFactoryJSONRPC.py
+++ b/tools/InterfaceGenerator/test/generator/generators/test_SmartFactoryJSONRPC.py
@@ -3,117 +3,135 @@
Verifies format specific functions and produced source code.
"""
-import collections
import codecs
+import collections
import os
import unittest
import uuid
-
-from mock import MagicMock
-from mock import call
-
-from generator.generators import SmartFactoryJSONRPC
-from generator import Model
-
+from pathlib import Path
+from unittest.mock import MagicMock
+from unittest.mock import call
+
+import sys
+
+sys.path.append(Path(__file__).absolute().parents[3].as_posix())
+sys.path.append(Path(__file__).absolute().parents[4].joinpath('rpc_spec/InterfaceParser').as_posix())
+try:
+ from generator.generators import SmartFactoryJSONRPC
+ from model.array import Array
+ from model.boolean import Boolean
+ from model.float import Float
+ from model.enum import Enum
+ from model.enum_element import EnumElement
+ from model.enum_subset import EnumSubset
+ from model.function import Function
+ from model.integer import Integer
+ from model.interface import Interface
+ from model.issue import Issue
+ from model.param import Param
+ from model.struct import Struct
+except ModuleNotFoundError as error:
+ print('{}.\nProbably you did not initialize submodule'.format(error))
+ sys.exit(1)
EXPECTED_RESULT_REQUEST = (
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_FUNCTION_ID] = SMember("""
u"""TEnumSchemaItem<FunctionID::eType>::create("""
u"""function_id_items), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_MESSAGE_TYPE] = SMember("""
u"""TEnumSchemaItem<messageType::eType>::create("""
u"""message_type_items), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_PROTOCOL_VERSION] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_PROTOCOL_TYPE] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_CORRELATION_ID] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_CORRELATION_ID] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
)
EXPECTED_RESULT_RESPONSE = (
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_FUNCTION_ID] = SMember("""
u"""TEnumSchemaItem<FunctionID::eType>::create("""
u"""function_id_items), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_MESSAGE_TYPE] = SMember("""
u"""TEnumSchemaItem<messageType::eType>::create("""
u"""message_type_items), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_PROTOCOL_VERSION] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_PROTOCOL_TYPE] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_CORRELATION_ID] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_CORRELATION_ID] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::kCode] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::kCode] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
)
EXPECTED_RESULT_NOTIFICATION = (
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_FUNCTION_ID] = SMember("""
u"""TEnumSchemaItem<FunctionID::eType>::create("""
u"""function_id_items), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_MESSAGE_TYPE] = SMember("""
u"""TEnumSchemaItem<messageType::eType>::create("""
u"""message_type_items), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_PROTOCOL_VERSION] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_PROTOCOL_TYPE] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
)
EXPECTED_PRE_FUNCTION_CODE = (
- u""" std::map<std::string, CObjectSchemaItem::SMember> """
+ u""" std::map<std::string, SMember> """
u"""params_members;\n"""
- u""" params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember("""
+ u""" params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_FUNCTION_ID] = SMember("""
u"""TEnumSchemaItem<FunctionID::eType>::create("""
u"""function_id_items), true);\n"""
- u""" params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember("""
+ u""" params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_MESSAGE_TYPE] = SMember("""
u"""TEnumSchemaItem<messageType::eType>::create("""
u"""message_type_items), true);\n"""
- u""" params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember("""
+ u""" params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_PROTOCOL_VERSION] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
- u""" params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember("""
+ u""" params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_PROTOCOL_TYPE] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
- u""" params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_CORRELATION_ID] = CObjectSchemaItem::SMember("""
+ u""" params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_CORRELATION_ID] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
- u""" params_members[NsSmartDeviceLink::NsJSONHandler"""
- u"""::strings::kCode] = CObjectSchemaItem::SMember("""
+ u""" params_members[ns_smart_device_link::ns_json_handler"""
+ u"""::strings::kCode] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
- u""" params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::kMessage] = CObjectSchemaItem::SMember("""
+ u""" params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::kMessage] = SMember("""
u"""CStringSchemaItem::create(), true);\n"""
u"""\n"""
- u""" std::map<std::string, CObjectSchemaItem::SMember> """
+ u""" std::map<std::string, SMember> """
u"""root_members_map;\n"""
- u""" root_members_map[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_PARAMS] = CObjectSchemaItem::SMember("""
+ u""" root_members_map[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_PARAMS] = SMember("""
u"""CObjectSchemaItem::create(params_members), true);\n"""
u"""\n"""
u""" CSmartSchema error_response_schema(CObjectSchemaItem::create("""
u"""root_members_map));\n"""
u"""\n"""
u""" functions_schemes_.insert(std::make_pair("""
- u"""NsSmartDeviceLink::NsJSONHandler::SmartSchemaKey<"""
+ u"""ns_smart_device_link::ns_json_handler::SmartSchemaKey<"""
u"""FunctionID::eType, messageType::eType>("""
u"""FunctionID::request, messageType::error_response)"""
u""", error_response_schema));\n"""
@@ -124,15 +142,14 @@ DESCRIPTION = [u"Description Line1", u"Description Line2"]
DESIGN_DESCRIPTION = [u"Design Line1"]
-ISSUES = [Model.Issue(value=u"Issue1"),
- Model.Issue(value=u"Issue2"),
- Model.Issue(value=u"Issue3")]
+ISSUES = [Issue(value=u"Issue1"),
+ Issue(value=u"Issue2"),
+ Issue(value=u"Issue3")]
TODOS = [u"Do1", u"Do2"]
class Test(unittest.TestCase):
-
"""Test for JSONRPC SmartFactory generator.
This class holds set of test cases for the JSONRPC SmartFactory generator.
@@ -183,14 +200,14 @@ class Test(unittest.TestCase):
generator = SmartFactoryJSONRPC.CodeGenerator()
message_type_elements = collections.OrderedDict()
- message_type_elements[u"request"] = Model.EnumElement(name=u"request")
- message_type_elements[u"response"] = Model.EnumElement(
+ message_type_elements[u"request"] = EnumElement(name=u"request")
+ message_type_elements[u"response"] = EnumElement(
name=u"response")
- message_type_elements[u"notification"] = Model.EnumElement(
+ message_type_elements[u"notification"] = EnumElement(
name=u"notification")
- message_type = Model.Enum(name=u"messageType",
- elements=message_type_elements)
+ message_type = Enum(name=u"messageType",
+ elements=message_type_elements)
result_enum = generator._preprocess_message_type(message_type)
@@ -199,12 +216,12 @@ class Test(unittest.TestCase):
result_enum.elements["error_response"].primary_name)
message_type_elements = collections.OrderedDict()
- message_type_elements[u"request"] = Model.EnumElement(name=u"request")
- message_type_elements[u"notification"] = Model.EnumElement(
+ message_type_elements[u"request"] = EnumElement(name=u"request")
+ message_type_elements[u"notification"] = EnumElement(
name=u"notification")
- message_type = Model.Enum(name=u"messageType",
- elements=message_type_elements)
+ message_type = Enum(name=u"messageType",
+ elements=message_type_elements)
result_enum = generator._preprocess_message_type(message_type)
@@ -217,6 +234,7 @@ class Test(unittest.TestCase):
function.
"""
+ self.maxDiff = None
generator = SmartFactoryJSONRPC.CodeGenerator()
@@ -225,16 +243,16 @@ class Test(unittest.TestCase):
"Invalid code for empty functions list")
message_type_elements = collections.OrderedDict()
- message_type_elements[u"request"] = Model.EnumElement(name=u"request")
- message_type_elements[u"response"] = Model.EnumElement(
+ message_type_elements[u"request"] = EnumElement(name=u"request")
+ message_type_elements[u"response"] = EnumElement(
name=u"response")
- message_type_elements[u"notification"] = Model.EnumElement(
+ message_type_elements[u"notification"] = EnumElement(
name=u"notification")
- message_type = Model.Enum(name=u"messageType",
- elements=message_type_elements)
+ message_type = Enum(name=u"messageType",
+ elements=message_type_elements)
- function1 = Model.Function(
+ function1 = Function(
"func1", function_id=message_type.elements[u"request"],
message_type=message_type.elements[u"request"])
@@ -242,18 +260,20 @@ class Test(unittest.TestCase):
generator._gen_pre_function_schemas([function1]),
"Invalid code for empty functions list")
- function2 = Model.Function(
+ function2 = Function(
"func2", function_id=message_type.elements[u"request"],
message_type=message_type.elements[u"response"])
-
- self.assertEqual(EXPECTED_PRE_FUNCTION_CODE,
- generator._gen_pre_function_schemas([function2]),
- "Invalid code for single response function")
-
- self.assertEqual(EXPECTED_PRE_FUNCTION_CODE,
- generator._gen_pre_function_schemas([function1,
- function2]),
- "Invalid code for mixed function list")
+ try:
+ self.assertEqual(EXPECTED_PRE_FUNCTION_CODE,
+ generator._gen_pre_function_schemas([function2]),
+ "Invalid code for single response function")
+
+ self.assertEqual(EXPECTED_PRE_FUNCTION_CODE,
+ generator._gen_pre_function_schemas([function1,
+ function2]),
+ "Invalid code for mixed function list")
+ except AssertionError as message:
+ print(message)
def test_full_generation(self):
"""Test full generation using JSONRPC SmartSchema generator.
@@ -264,66 +284,66 @@ class Test(unittest.TestCase):
directory as this module.
"""
-
- expected_h_file_content = open("test_expected_jsonrpc.h", "r").read()
- expected_cc_file_content = open("test_expected_jsonrpc.cc", "r").read()
+ self.maxDiff = None
+ expected_h_file_content = Path(__file__).parents[0].joinpath("test_expected_jsonrpc.h").read_text()
+ expected_cc_file_content = Path(__file__).parents[0].joinpath("test_expected_jsonrpc.cc").read_text()
generator = SmartFactoryJSONRPC.CodeGenerator()
message_type_elements = collections.OrderedDict()
- message_type_elements[u"request"] = Model.EnumElement(name=u"request")
- message_type_elements[u"response"] = Model.EnumElement(
+ message_type_elements[u"request"] = EnumElement(name=u"request")
+ message_type_elements[u"response"] = EnumElement(
name=u"response")
- message_type_elements[u"notification"] = Model.EnumElement(
+ message_type_elements[u"notification"] = EnumElement(
name=u"notification")
- message_type = Model.Enum(name=u"messageType",
- elements=message_type_elements)
+ message_type = Enum(name=u"messageType",
+ elements=message_type_elements)
elements1 = collections.OrderedDict()
- elements1[u"name1"] = Model.EnumElement(
+ elements1[u"name1"] = EnumElement(
name=u"name1",
design_description=DESIGN_DESCRIPTION,
todos=TODOS,
value=u"1")
- elements1[u"name2"] = Model.EnumElement(
+ elements1[u"name2"] = EnumElement(
name="name2",
description=DESCRIPTION,
issues=ISSUES,
internal_name=u"internal_name2")
- enum1 = Model.Enum(name=u"Enum1",
- todos=TODOS,
- elements=elements1)
+ enum1 = Enum(name=u"Enum1",
+ todos=TODOS,
+ elements=elements1)
elements2 = collections.OrderedDict()
- elements2[u"xxx"] = Model.EnumElement(name=u"xxx",
- internal_name=u"val_1")
- elements2[u"yyy"] = Model.EnumElement(name=u"yyy",
- internal_name=u"val_2",
- value=u"100")
- elements2[u"zzz"] = Model.EnumElement(name=u"val_3")
+ elements2[u"xxx"] = EnumElement(name=u"xxx",
+ internal_name=u"val_1")
+ elements2[u"yyy"] = EnumElement(name=u"yyy",
+ internal_name=u"val_2",
+ value=u"100")
+ elements2[u"zzz"] = EnumElement(name=u"val_3")
- enum2 = Model.Enum(name=u"E2",
- elements=elements2)
+ enum2 = Enum(name=u"E2",
+ elements=elements2)
elements3 = collections.OrderedDict()
- elements3["1"] = Model.EnumElement(name="xxx",
- internal_name="_1")
- elements3["2"] = Model.EnumElement(name="xxx",
- internal_name="_2")
- elements3["3"] = Model.EnumElement(name="xxx",
- internal_name="_3")
- enum3 = Model.Enum(name="Enum_new2",
- elements=elements3)
+ elements3["1"] = EnumElement(name="xxx",
+ internal_name="_1")
+ elements3["2"] = EnumElement(name="xxx",
+ internal_name="_2")
+ elements3["3"] = EnumElement(name="xxx",
+ internal_name="_3")
+ enum3 = Enum(name="Enum_new2",
+ elements=elements3)
elements4 = collections.OrderedDict()
- elements4["name1"] = Model.EnumElement(name="xxx",
- internal_name="_11")
- elements4["name2"] = Model.EnumElement(name="xxx",
- internal_name="_22")
- enum4 = Model.Enum(name="Enum_new4",
- elements=elements4)
+ elements4["name1"] = EnumElement(name="xxx",
+ internal_name="_11")
+ elements4["name2"] = EnumElement(name="xxx",
+ internal_name="_22")
+ enum4 = Enum(name="Enum_new4",
+ elements=elements4)
enums = collections.OrderedDict()
enums["Enum1"] = enum1
@@ -333,7 +353,7 @@ class Test(unittest.TestCase):
enums["messageType"] = message_type
params1 = collections.OrderedDict()
- params1["1"] = Model.FunctionParam(
+ params1["1"] = Param(
name="param1",
design_description=DESIGN_DESCRIPTION,
description=DESCRIPTION,
@@ -341,110 +361,110 @@ class Test(unittest.TestCase):
todos=TODOS,
param_type=enum4,
default_value=elements4["name1"])
- params1["2"] = Model.FunctionParam(
+ params1["2"] = Param(
name="param2",
- param_type=Model.EnumSubset(
+ param_type=EnumSubset(
name="sub1",
enum=enum1,
allowed_elements={"e1": elements1["name1"]}),
default_value=elements1["name1"])
functions = collections.OrderedDict()
- functions["Function1"] = Model.Function(
+ functions["Function1"] = Function(
name="Function1",
function_id=elements1["name1"],
message_type=message_type_elements["request"],
params=params1)
- functions["Function2"] = Model.Function(
+ functions["Function2"] = Function(
name="Function2",
function_id=elements2["xxx"],
message_type=message_type_elements["response"])
- functions["Function3"] = Model.Function(
+ functions["Function3"] = Function(
name="Function2",
function_id=elements2["yyy"],
message_type=message_type_elements["notification"])
members1 = collections.OrderedDict()
- members1["m1"] = Model.Param(name="intParam",
- param_type=Model.Integer(max_value=2))
- members1["m11"] = Model.Param(name="doubleParam",
- param_type=Model.Double(min_value=0.333),
- is_mandatory=False)
- members1["m222"] = Model.Param(name="boolParam",
- param_type=Model.Boolean())
- members1["m2"] = Model.Param(name="structParam",
- param_type=Model.Struct(name="Struct2"))
- members1["aaa"] = Model.Param(name="enumParam",
- param_type=enum1)
- members1["bbb"] = Model.Param(name="enumParam1",
- param_type=enum1)
- members1["xxx"] = Model.Param(
+ members1["m1"] = Param(name="intParam",
+ param_type=Integer(max_value=2))
+ members1["m11"] = Param(name="doubleParam",
+ param_type=Float(min_value=0.333),
+ is_mandatory=False)
+ members1["m222"] = Param(name="boolParam",
+ param_type=Boolean())
+ members1["m2"] = Param(name="structParam",
+ param_type=Struct(name="Struct2"))
+ members1["aaa"] = Param(name="enumParam",
+ param_type=enum1)
+ members1["bbb"] = Param(name="enumParam1",
+ param_type=enum1)
+ members1["xxx"] = Param(
name="enumSubset1",
- param_type=Model.EnumSubset(
+ param_type=EnumSubset(
name="sub",
enum=enum1,
allowed_elements={"e1": elements1["name1"]}),
is_mandatory=False)
- members1["1"] = Model.Param(
+ members1["1"] = Param(
name="arrayOfInt",
- param_type=Model.Array(min_size=0,
- max_size=20,
- element_type=Model.Boolean()),
+ param_type=Array(min_size=0,
+ max_size=20,
+ element_type=Boolean()),
is_mandatory=False)
- members1["2"] = Model.Param(
+ members1["2"] = Param(
name="arrayOfEnum1",
- param_type=Model.Array(min_size=0,
- max_size=20,
- element_type=enum1),
+ param_type=Array(min_size=0,
+ max_size=20,
+ element_type=enum1),
is_mandatory=False)
- members1["3"] = Model.Param(
+ members1["3"] = Param(
name="arrayOfEnum3",
- param_type=Model.Array(min_size=10,
- max_size=40,
- element_type=enum3),
+ param_type=Array(min_size=10,
+ max_size=40,
+ element_type=enum3),
is_mandatory=True)
- members1["4"] = Model.Param(
+ members1["4"] = Param(
name="arrayOfEnum4",
- param_type=Model.Array(
+ param_type=Array(
min_size=10,
max_size=41,
- element_type=Model.EnumSubset(
+ element_type=EnumSubset(
name="sub1",
enum=enum1,
allowed_elements={"e1": elements1["name1"]})))
- members1["5"] = Model.Param(
+ members1["5"] = Param(
name="arrayOfEnum5",
- param_type=Model.Array(
+ param_type=Array(
min_size=10,
max_size=42,
- element_type=Model.EnumSubset(
+ element_type=EnumSubset(
name="sub2",
enum=enum1,
allowed_elements={"e1": elements1["name2"]})))
- members1["6"] = Model.Param(
+ members1["6"] = Param(
name="arrayOfEnum6",
- param_type=Model.Array(
+ param_type=Array(
min_size=10,
max_size=43,
- element_type=Model.EnumSubset(
+ element_type=EnumSubset(
name="sub3",
enum=enum4,
allowed_elements={"e1": elements4["name2"]})))
structs = collections.OrderedDict()
- structs["Struct1"] = Model.Struct(
+ structs["Struct1"] = Struct(
name="Struct1",
design_description=DESIGN_DESCRIPTION,
issues=ISSUES,
members=members1)
- structs["Struct2"] = Model.Struct(name="Struct2",
- issues=ISSUES)
+ structs["Struct2"] = Struct(name="Struct2",
+ issues=ISSUES)
- interface = Model.Interface(enums=enums,
- structs=structs,
- functions=functions,
- params={"param1": "value1",
- "param2": "value2"})
+ interface = Interface(enums=enums,
+ structs=structs,
+ functions=functions,
+ params={"param1": "value1",
+ "param2": "value2"})
os.path.exists = MagicMock(return_value=True)
uuid.uuid1 = MagicMock(
@@ -468,15 +488,21 @@ class Test(unittest.TestCase):
"Invalid header file creation")
self.assertEqual(mock_calls[4],
- call('/some/test/dir/Test.cc',
+ call('/some/test/dir/Test_schema.h',
mode='w',
encoding='utf-8'),
"Invalid source file creation")
+ try:
+ self.assertSequenceEqual(str(mock_calls[2])[27:-2].replace("\\n", "\n"),
+ expected_h_file_content,
+ "Invalid header file content")
+
+ self.assertSequenceEqual(str(mock_calls[6])[27:-2].replace("\\n", "\n"),
+ expected_cc_file_content,
+ "Invalid source file content")
+ except AssertionError as message:
+ print(message)
- self.assertEqual(str(mock_calls[2])[27:-2].replace("\\n", "\n"),
- expected_h_file_content,
- "Invalid header file content")
- self.assertEqual(str(mock_calls[6])[27:-2].replace("\\n", "\n"),
- expected_cc_file_content,
- "Invalid source file content")
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/InterfaceGenerator/test/generator/generators/test_SmartFactorySDLRPC.py b/tools/InterfaceGenerator/test/generator/generators/test_SmartFactorySDLRPC.py
index 111ffb3cbc..4b21a64ec1 100755
--- a/tools/InterfaceGenerator/test/generator/generators/test_SmartFactorySDLRPC.py
+++ b/tools/InterfaceGenerator/test/generator/generators/test_SmartFactorySDLRPC.py
@@ -3,53 +3,70 @@
Verifies format specific functions and produced source code.
"""
-import collections
import codecs
+import collections
import os
import unittest
import uuid
-
-from mock import MagicMock
-from mock import call
-
-from generator.generators import SmartFactorySDLRPC
-from generator import Model
-
+from pathlib import Path
+from unittest.mock import MagicMock
+from unittest.mock import call
+
+import sys
+
+sys.path.append(Path(__file__).absolute().parents[3].as_posix())
+sys.path.append(Path(__file__).absolute().parents[4].joinpath('rpc_spec/InterfaceParser').as_posix())
+try:
+ from generator.generators import SmartFactorySDLRPC
+ from model.array import Array
+ from model.boolean import Boolean
+ from model.float import Float
+ from model.enum import Enum
+ from model.enum_element import EnumElement
+ from model.enum_subset import EnumSubset
+ from model.function import Function
+ from model.integer import Integer
+ from model.interface import Interface
+ from model.issue import Issue
+ from model.param import Param
+ from model.struct import Struct
+except ModuleNotFoundError as error:
+ print('{}.\nProbably you did not initialize submodule'.format(error))
+ sys.exit(1)
EXPECTED_NOTIFICATION_RESULT = (
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_FUNCTION_ID] = SMember("""
u"""TEnumSchemaItem<FunctionID::eType>::create("""
u"""function_id_items), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_MESSAGE_TYPE] = SMember("""
u"""TEnumSchemaItem<messageType::eType>::create("""
u"""message_type_items), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_PROTOCOL_VERSION] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n"""
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_PROTOCOL_TYPE] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n""")
EXPECTED_REQ_RESP_RESULT = "".join([EXPECTED_NOTIFICATION_RESULT, (
- u"""params_members[NsSmartDeviceLink::NsJSONHandler::"""
- u"""strings::S_CORRELATION_ID] = CObjectSchemaItem::SMember("""
+ u"""params_members[ns_smart_device_link::ns_json_handler::"""
+ u"""strings::S_CORRELATION_ID] = SMember("""
u"""TNumberSchemaItem<int>::create(), true);\n""")])
DESCRIPTION = [u"Description Line1", u"Description Line2"]
DESIGN_DESCRIPTION = [u"Design Line1"]
-ISSUES = [Model.Issue(value=u"Issue1"),
- Model.Issue(value=u"Issue2"),
- Model.Issue(value=u"Issue3")]
+ISSUES = [Issue(value=u"Issue1"),
+ Issue(value=u"Issue2"),
+ Issue(value=u"Issue3")]
TODOS = [u"Do1", u"Do2"]
class Test(unittest.TestCase):
-
"""Test for SLDRPC SmartFactory generator.
This class holds set of test cases for the SDLRPC SmartFactory generator.
@@ -107,66 +124,66 @@ class Test(unittest.TestCase):
this module.
"""
-
- expected_h_file_content = open("test_expected_sdlrpc.h", "r").read()
- expected_cc_file_content = open("test_expected_sdlrpc.cc", "r").read()
+ self.maxDiff = None
+ expected_h_file_content = Path(__file__).parents[0].joinpath('test_expected_sdlrpc.h').read_text()
+ expected_cc_file_content = Path(__file__).parents[0].joinpath('test_expected_sdlrpc.cc').read_text()
generator = SmartFactorySDLRPC.CodeGenerator()
message_type_elements = collections.OrderedDict()
- message_type_elements[u"request"] = Model.EnumElement(name=u"request")
- message_type_elements[u"response"] = Model.EnumElement(
+ message_type_elements[u"request"] = EnumElement(name=u"request")
+ message_type_elements[u"response"] = EnumElement(
name=u"response")
- message_type_elements[u"notification"] = Model.EnumElement(
+ message_type_elements[u"notification"] = EnumElement(
name=u"notification")
- message_type = Model.Enum(name=u"messageType",
- elements=message_type_elements)
+ message_type = Enum(name=u"messageType",
+ elements=message_type_elements)
elements1 = collections.OrderedDict()
- elements1[u"name1"] = Model.EnumElement(
+ elements1[u"name1"] = EnumElement(
name=u"name1",
design_description=DESIGN_DESCRIPTION,
todos=TODOS,
value=u"1")
- elements1[u"name2"] = Model.EnumElement(
+ elements1[u"name2"] = EnumElement(
name="name2",
description=DESCRIPTION,
issues=ISSUES,
internal_name=u"internal_name2")
- enum1 = Model.Enum(name=u"Enum1",
- todos=TODOS,
- elements=elements1)
+ enum1 = Enum(name=u"Enum1",
+ todos=TODOS,
+ elements=elements1)
elements2 = collections.OrderedDict()
- elements2[u"xxx"] = Model.EnumElement(name=u"xxx",
- internal_name=u"val_1")
- elements2[u"yyy"] = Model.EnumElement(name=u"yyy",
- internal_name=u"val_2",
- value=u"100")
- elements2[u"zzz"] = Model.EnumElement(name=u"val_3")
+ elements2[u"xxx"] = EnumElement(name=u"xxx",
+ internal_name=u"val_1")
+ elements2[u"yyy"] = EnumElement(name=u"yyy",
+ internal_name=u"val_2",
+ value=u"100")
+ elements2[u"zzz"] = EnumElement(name=u"val_3")
- enum2 = Model.Enum(name=u"E2",
- elements=elements2)
+ enum2 = Enum(name=u"E2",
+ elements=elements2)
elements3 = collections.OrderedDict()
- elements3["1"] = Model.EnumElement(name="xxx",
- internal_name="_1")
- elements3["2"] = Model.EnumElement(name="xxx",
- internal_name="_2")
- elements3["3"] = Model.EnumElement(name="xxx",
- internal_name="_3")
- enum3 = Model.Enum(name="Enum_new2",
- elements=elements3)
+ elements3["1"] = EnumElement(name="xxx",
+ internal_name="_1")
+ elements3["2"] = EnumElement(name="xxx",
+ internal_name="_2")
+ elements3["3"] = EnumElement(name="xxx",
+ internal_name="_3")
+ enum3 = Enum(name="Enum_new2",
+ elements=elements3)
elements4 = collections.OrderedDict()
- elements4["name1"] = Model.EnumElement(name="xxx",
- internal_name="_11")
- elements4["name2"] = Model.EnumElement(name="xxx",
- internal_name="_22")
- enum4 = Model.Enum(name="Enum_new4",
- elements=elements4)
+ elements4["name1"] = EnumElement(name="xxx",
+ internal_name="_11")
+ elements4["name2"] = EnumElement(name="xxx",
+ internal_name="_22")
+ enum4 = Enum(name="Enum_new4",
+ elements=elements4)
enums = collections.OrderedDict()
enums["Enum1"] = enum1
@@ -176,7 +193,7 @@ class Test(unittest.TestCase):
enums["messageType"] = message_type
params1 = collections.OrderedDict()
- params1["1"] = Model.FunctionParam(
+ params1["1"] = Param(
name="param1",
design_description=DESIGN_DESCRIPTION,
description=DESCRIPTION,
@@ -184,110 +201,110 @@ class Test(unittest.TestCase):
todos=TODOS,
param_type=enum4,
default_value=elements4["name1"])
- params1["2"] = Model.FunctionParam(
+ params1["2"] = Param(
name="param2",
- param_type=Model.EnumSubset(
+ param_type=EnumSubset(
name="sub1",
enum=enum1,
allowed_elements={"e1": elements1["name1"]}),
default_value=elements1["name1"])
functions = collections.OrderedDict()
- functions["Function1"] = Model.Function(
+ functions["Function1"] = Function(
name="Function1",
function_id=elements1["name1"],
message_type=message_type_elements["request"],
params=params1)
- functions["Function2"] = Model.Function(
+ functions["Function2"] = Function(
name="Function2",
function_id=elements2["xxx"],
message_type=message_type_elements["response"])
- functions["Function3"] = Model.Function(
+ functions["Function3"] = Function(
name="Function2",
function_id=elements2["yyy"],
message_type=message_type_elements["notification"])
members1 = collections.OrderedDict()
- members1["m1"] = Model.Param(name="intParam",
- param_type=Model.Integer(max_value=2))
- members1["m11"] = Model.Param(name="doubleParam",
- param_type=Model.Double(min_value=0.333),
- is_mandatory=False)
- members1["m222"] = Model.Param(name="boolParam",
- param_type=Model.Boolean())
- members1["m2"] = Model.Param(name="structParam",
- param_type=Model.Struct(name="Struct2"))
- members1["aaa"] = Model.Param(name="enumParam",
- param_type=enum1)
- members1["bbb"] = Model.Param(name="enumParam1",
- param_type=enum1)
- members1["xxx"] = Model.Param(
+ members1["m1"] = Param(name="intParam",
+ param_type=Integer(max_value=2))
+ members1["m11"] = Param(name="doubleParam",
+ param_type=Float(min_value=0.333),
+ is_mandatory=False)
+ members1["m222"] = Param(name="boolParam",
+ param_type=Boolean())
+ members1["m2"] = Param(name="structParam",
+ param_type=Struct(name="Struct2"))
+ members1["aaa"] = Param(name="enumParam",
+ param_type=enum1)
+ members1["bbb"] = Param(name="enumParam1",
+ param_type=enum1)
+ members1["xxx"] = Param(
name="enumSubset1",
- param_type=Model.EnumSubset(
+ param_type=EnumSubset(
name="sub",
enum=enum1,
allowed_elements={"e1": elements1["name1"]}),
is_mandatory=False)
- members1["1"] = Model.Param(
+ members1["1"] = Param(
name="arrayOfInt",
- param_type=Model.Array(min_size=0,
- max_size=20,
- element_type=Model.Boolean()),
+ param_type=Array(min_size=0,
+ max_size=20,
+ element_type=Boolean()),
is_mandatory=False)
- members1["2"] = Model.Param(
+ members1["2"] = Param(
name="arrayOfEnum1",
- param_type=Model.Array(min_size=0,
- max_size=20,
- element_type=enum1),
+ param_type=Array(min_size=0,
+ max_size=20,
+ element_type=enum1),
is_mandatory=False)
- members1["3"] = Model.Param(
+ members1["3"] = Param(
name="arrayOfEnum3",
- param_type=Model.Array(min_size=10,
- max_size=40,
- element_type=enum3),
+ param_type=Array(min_size=10,
+ max_size=40,
+ element_type=enum3),
is_mandatory=True)
- members1["4"] = Model.Param(
+ members1["4"] = Param(
name="arrayOfEnum4",
- param_type=Model.Array(
+ param_type=Array(
min_size=10,
max_size=41,
- element_type=Model.EnumSubset(
+ element_type=EnumSubset(
name="sub1",
enum=enum1,
allowed_elements={"e1": elements1["name1"]})))
- members1["5"] = Model.Param(
+ members1["5"] = Param(
name="arrayOfEnum5",
- param_type=Model.Array(
+ param_type=Array(
min_size=10,
max_size=42,
- element_type=Model.EnumSubset(
+ element_type=EnumSubset(
name="sub2",
enum=enum1,
allowed_elements={"e1": elements1["name2"]})))
- members1["6"] = Model.Param(
+ members1["6"] = Param(
name="arrayOfEnum6",
- param_type=Model.Array(
+ param_type=Array(
min_size=10,
max_size=43,
- element_type=Model.EnumSubset(
+ element_type=EnumSubset(
name="sub3",
enum=enum4,
allowed_elements={"e1": elements4["name2"]})))
structs = collections.OrderedDict()
- structs["Struct1"] = Model.Struct(
+ structs["Struct1"] = Struct(
name="Struct1",
design_description=DESIGN_DESCRIPTION,
issues=ISSUES,
members=members1)
- structs["Struct2"] = Model.Struct(name="Struct2",
- issues=ISSUES)
+ structs["Struct2"] = Struct(name="Struct2",
+ issues=ISSUES)
- interface = Model.Interface(enums=enums,
- structs=structs,
- functions=functions,
- params={"param1": "value1",
- "param2": "value2"})
+ interface = Interface(enums=enums,
+ structs=structs,
+ functions=functions,
+ params={"param1": "value1",
+ "param2": "value2"})
os.path.exists = MagicMock(return_value=True)
uuid.uuid1 = MagicMock(
@@ -311,15 +328,21 @@ class Test(unittest.TestCase):
"Invalid header file creation")
self.assertEqual(mock_calls[4],
- call('/some/test/dir/Test.cc',
+ call('/some/test/dir/Test_schema.h',
mode='w',
encoding='utf-8'),
"Invalid source file creation")
+ try:
+ self.assertSequenceEqual(str(mock_calls[2])[27:-2].replace("\\n", "\n"),
+ expected_h_file_content,
+ "Invalid header file content")
+
+ self.assertSequenceEqual(str(mock_calls[6])[27:-2].replace("\\n", "\n"),
+ expected_cc_file_content,
+ "Invalid source file content")
+ except AssertionError as message:
+ print(message)
- self.assertEqual(str(mock_calls[2])[27:-2].replace("\\n", "\n"),
- expected_h_file_content,
- "Invalid header file content")
- self.assertEqual(str(mock_calls[6])[27:-2].replace("\\n", "\n"),
- expected_cc_file_content,
- "Invalid source file content")
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tools/InterfaceGenerator/test/generator/generators/test_expected_jsonrpc.cc b/tools/InterfaceGenerator/test/generator/generators/test_expected_jsonrpc.cc
index 458c27543b..05795ecf3b 100644
--- a/tools/InterfaceGenerator/test/generator/generators/test_expected_jsonrpc.cc
+++ b/tools/InterfaceGenerator/test/generator/generators/test_expected_jsonrpc.cc
@@ -50,7 +50,7 @@
#include "SmartObjects/TNumberSchemaItem.hpp"
#include "SmartObjects/TSchemaItemParameter.hpp"
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
XXX::YYY::ZZZ::Test::Test()
: CSmartFactory<FunctionID::eType, messageType::eType, StructIdentifiers::eType>() {
@@ -77,7 +77,7 @@ TSharedPtr<ISchemaItem> XXX::YYY::ZZZ::Test::ProvideObjectSchemaItemForStruct(
return it->second;
}
- return NsSmartDeviceLink::NsSmartObjects::CAlwaysFalseSchemaItem::create();
+ return ns_smart_device_link::ns_smart_objects::CAlwaysFalseSchemaItem::create();
}
void XXX::YYY::ZZZ::Test::InitStructSchemes(
@@ -95,25 +95,25 @@ void XXX::YYY::ZZZ::Test::InitFunctionSchemes(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items) {
- std::map<std::string, CObjectSchemaItem::SMember> params_members;
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_CORRELATION_ID] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::kCode] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::kMessage] = CObjectSchemaItem::SMember(CStringSchemaItem::create(), true);
-
- std::map<std::string, CObjectSchemaItem::SMember> root_members_map;
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(params_members), true);
+ std::map<std::string, SMember> params_members;
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID] = SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE] = SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_VERSION] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_TYPE] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_CORRELATION_ID] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::kCode] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::kMessage] = SMember(CStringSchemaItem::create(), true);
+
+ std::map<std::string, SMember> root_members_map;
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] = SMember(CObjectSchemaItem::create(params_members), true);
CSmartSchema error_response_schema(CObjectSchemaItem::create(root_members_map));
- functions_schemes_.insert(std::make_pair(NsSmartDeviceLink::NsJSONHandler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::val_1, messageType::error_response), error_response_schema));
+ functions_schemes_.insert(std::make_pair(ns_smart_device_link::ns_json_handler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::val_1, messageType::error_response), error_response_schema));
- functions_schemes_.insert(std::make_pair(NsSmartDeviceLink::NsJSONHandler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::name1, messageType::request), InitFunction_name1_request(struct_schema_items, function_id_items, message_type_items)));
- functions_schemes_.insert(std::make_pair(NsSmartDeviceLink::NsJSONHandler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::val_1, messageType::response), InitFunction_val_1_response(struct_schema_items, function_id_items, message_type_items)));
- functions_schemes_.insert(std::make_pair(NsSmartDeviceLink::NsJSONHandler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::val_2, messageType::notification), InitFunction_val_2_notification(struct_schema_items, function_id_items, message_type_items)));
+ functions_schemes_.insert(std::make_pair(ns_smart_device_link::ns_json_handler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::name1, messageType::request), InitFunction_name1_request(struct_schema_items, function_id_items, message_type_items)));
+ functions_schemes_.insert(std::make_pair(ns_smart_device_link::ns_json_handler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::val_1, messageType::response), InitFunction_val_1_response(struct_schema_items, function_id_items, message_type_items)));
+ functions_schemes_.insert(std::make_pair(ns_smart_device_link::ns_json_handler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::val_2, messageType::notification), InitFunction_val_2_notification(struct_schema_items, function_id_items, message_type_items)));
}
//------------- Functions schemes initialization -------------
@@ -147,21 +147,21 @@ CSmartSchema XXX::YYY::ZZZ::Test::InitFunction_name1_request(
// Function parameter param2.
TSharedPtr<ISchemaItem> param2_SchemaItem = TEnumSchemaItem<Enum1::eType>::create(param2_allowed_enum_subset_values, TSchemaItemParameter<Enum1::eType>(name1));
- std::map<std::string, CObjectSchemaItem::SMember> schema_members;
+ std::map<std::string, SMember> schema_members;
- schema_members["param1"] = CObjectSchemaItem::SMember(param1_SchemaItem, true);
- schema_members["param2"] = CObjectSchemaItem::SMember(param2_SchemaItem, true);
+ schema_members["param1"] = SMember(param1_SchemaItem, true);
+ schema_members["param2"] = SMember(param2_SchemaItem, true);
- std::map<std::string, CObjectSchemaItem::SMember> params_members;
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_CORRELATION_ID] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ std::map<std::string, SMember> params_members;
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID] = SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE] = SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_VERSION] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_TYPE] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_CORRELATION_ID] = SMember(TNumberSchemaItem<int>::create(), true);
- std::map<std::string, CObjectSchemaItem::SMember> root_members_map;
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_MSG_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(schema_members), true);
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(params_members), true);
+ std::map<std::string, SMember> root_members_map;
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS] = SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] = SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
@@ -170,19 +170,19 @@ CSmartSchema XXX::YYY::ZZZ::Test::InitFunction_val_1_response(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items) {
- std::map<std::string, CObjectSchemaItem::SMember> schema_members;
+ std::map<std::string, SMember> schema_members;
- std::map<std::string, CObjectSchemaItem::SMember> params_members;
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_CORRELATION_ID] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::kCode] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ std::map<std::string, SMember> params_members;
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID] = SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE] = SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_VERSION] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_TYPE] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_CORRELATION_ID] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::kCode] = SMember(TNumberSchemaItem<int>::create(), true);
- std::map<std::string, CObjectSchemaItem::SMember> root_members_map;
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_MSG_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(schema_members), true);
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(params_members), true);
+ std::map<std::string, SMember> root_members_map;
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS] = SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] = SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
@@ -191,17 +191,17 @@ CSmartSchema XXX::YYY::ZZZ::Test::InitFunction_val_2_notification(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items) {
- std::map<std::string, CObjectSchemaItem::SMember> schema_members;
+ std::map<std::string, SMember> schema_members;
- std::map<std::string, CObjectSchemaItem::SMember> params_members;
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ std::map<std::string, SMember> params_members;
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID] = SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE] = SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_VERSION] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_TYPE] = SMember(TNumberSchemaItem<int>::create(), true);
- std::map<std::string, CObjectSchemaItem::SMember> root_members_map;
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_MSG_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(schema_members), true);
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(params_members), true);
+ std::map<std::string, SMember> root_members_map;
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS] = SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] = SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
@@ -270,36 +270,36 @@ TSharedPtr<ISchemaItem> XXX::YYY::ZZZ::Test::InitStructSchemaItem_Struct1(
// Struct member arrayOfEnum6.
TSharedPtr<ISchemaItem> arrayOfEnum6_SchemaItem = CArraySchemaItem::create(TEnumSchemaItem<Enum_new4::eType>::create(sub3_allowed_enum_subset_values, TSchemaItemParameter<Enum_new4::eType>()), TSchemaItemParameter<size_t>(10), TSchemaItemParameter<size_t>(43));
- std::map<std::string, CObjectSchemaItem::SMember> schema_members;
-
- schema_members["intParam"] = CObjectSchemaItem::SMember(intParam_SchemaItem, true);
- schema_members["doubleParam"] = CObjectSchemaItem::SMember(doubleParam_SchemaItem, false);
- schema_members["boolParam"] = CObjectSchemaItem::SMember(boolParam_SchemaItem, true);
- schema_members["structParam"] = CObjectSchemaItem::SMember(structParam_SchemaItem, true);
- schema_members["enumParam"] = CObjectSchemaItem::SMember(enumParam_SchemaItem, true);
- schema_members["enumParam1"] = CObjectSchemaItem::SMember(enumParam1_SchemaItem, true);
- schema_members["enumSubset1"] = CObjectSchemaItem::SMember(enumSubset1_SchemaItem, false);
- schema_members["arrayOfInt"] = CObjectSchemaItem::SMember(arrayOfInt_SchemaItem, false);
- schema_members["arrayOfEnum1"] = CObjectSchemaItem::SMember(arrayOfEnum1_SchemaItem, false);
- schema_members["arrayOfEnum3"] = CObjectSchemaItem::SMember(arrayOfEnum3_SchemaItem, true);
- schema_members["arrayOfEnum4"] = CObjectSchemaItem::SMember(arrayOfEnum4_SchemaItem, true);
- schema_members["arrayOfEnum5"] = CObjectSchemaItem::SMember(arrayOfEnum5_SchemaItem, true);
- schema_members["arrayOfEnum6"] = CObjectSchemaItem::SMember(arrayOfEnum6_SchemaItem, true);
+ std::map<std::string, SMember> schema_members;
+
+ schema_members["intParam"] = SMember(intParam_SchemaItem, true);
+ schema_members["doubleParam"] = SMember(doubleParam_SchemaItem, false);
+ schema_members["boolParam"] = SMember(boolParam_SchemaItem, true);
+ schema_members["structParam"] = SMember(structParam_SchemaItem, true);
+ schema_members["enumParam"] = SMember(enumParam_SchemaItem, true);
+ schema_members["enumParam1"] = SMember(enumParam1_SchemaItem, true);
+ schema_members["enumSubset1"] = SMember(enumSubset1_SchemaItem, false);
+ schema_members["arrayOfInt"] = SMember(arrayOfInt_SchemaItem, false);
+ schema_members["arrayOfEnum1"] = SMember(arrayOfEnum1_SchemaItem, false);
+ schema_members["arrayOfEnum3"] = SMember(arrayOfEnum3_SchemaItem, true);
+ schema_members["arrayOfEnum4"] = SMember(arrayOfEnum4_SchemaItem, true);
+ schema_members["arrayOfEnum5"] = SMember(arrayOfEnum5_SchemaItem, true);
+ schema_members["arrayOfEnum6"] = SMember(arrayOfEnum6_SchemaItem, true);
return CObjectSchemaItem::create(schema_members);
}
TSharedPtr<ISchemaItem> XXX::YYY::ZZZ::Test::InitStructSchemaItem_Struct2(
const TStructsSchemaItems &struct_schema_items) {
- std::map<std::string, CObjectSchemaItem::SMember> schema_members;
+ std::map<std::string, SMember> schema_members;
return CObjectSchemaItem::create(schema_members);
}
//-------------- String to value enum mapping ----------------
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
template <>
const std::map<XXX::YYY::ZZZ::Enum1::eType, std::string> &TEnumSchemaItem<XXX::YYY::ZZZ::Enum1::eType>::getEnumElementsStringRepresentation() {
@@ -380,6 +380,6 @@ const std::map<XXX::YYY::ZZZ::messageType::eType, std::string> &TEnumSchemaItem<
return enum_string_representation;
}
-} // NsSmartObjects
-} // NsSmartDeviceLink
+} // ns_smart_objects
+} // ns_smart_device_link
diff --git a/tools/InterfaceGenerator/test/generator/generators/test_expected_jsonrpc.h b/tools/InterfaceGenerator/test/generator/generators/test_expected_jsonrpc.h
index b265603480..d7310e4d0f 100644
--- a/tools/InterfaceGenerator/test/generator/generators/test_expected_jsonrpc.h
+++ b/tools/InterfaceGenerator/test/generator/generators/test_expected_jsonrpc.h
@@ -223,7 +223,7 @@ enum eType {
* param2 - value2
* param1 - value1
*/
-class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::eType, messageType::eType, StructIdentifiers::eType> {
+class Test : public ns_smart_device_link::ns_json_handler::CSmartFactory<FunctionID::eType, messageType::eType, StructIdentifiers::eType> {
public:
/**
* @brief Constructor.
@@ -234,7 +234,7 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
/**
* @brief Type that maps of struct IDs to schema items.
*/
- typedef std::map<const StructIdentifiers::eType, NsSmartDeviceLink::NsSmartObjects::TSharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> > TStructsSchemaItems;
+ typedef std::map<const StructIdentifiers::eType, ns_smart_device_link::ns_smart_objects::TSharedPtr<ns_smart_device_link::ns_smart_objects::ISchemaItem> > TStructsSchemaItems;
/**
* @brief Helper that allows to make reference to struct
@@ -244,7 +244,7 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
*
* @return TSharedPtr of strucute
*/
- static NsSmartDeviceLink::NsSmartObjects::TSharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> ProvideObjectSchemaItemForStruct(
+ static ns_smart_device_link::ns_smart_objects::TSharedPtr<ns_smart_device_link::ns_smart_objects::ISchemaItem> ProvideObjectSchemaItemForStruct(
const TStructsSchemaItems &struct_schema_items,
const StructIdentifiers::eType struct_id);
@@ -268,9 +268,9 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
/**
* @brief Method that generates schema for function Function1.
*
- * @return NsSmartDeviceLink::NsSmartObjects::CSmartSchema
+ * @return ns_smart_device_link::ns_smart_objects::CSmartSchema
*/
- static NsSmartDeviceLink::NsSmartObjects::CSmartSchema InitFunction_name1_request(
+ static ns_smart_device_link::ns_smart_objects::CSmartSchema InitFunction_name1_request(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items);
@@ -278,9 +278,9 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
/**
* @brief Method that generates schema for function Function2.
*
- * @return NsSmartDeviceLink::NsSmartObjects::CSmartSchema
+ * @return ns_smart_device_link::ns_smart_objects::CSmartSchema
*/
- static NsSmartDeviceLink::NsSmartObjects::CSmartSchema InitFunction_val_1_response(
+ static ns_smart_device_link::ns_smart_objects::CSmartSchema InitFunction_val_1_response(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items);
@@ -288,9 +288,9 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
/**
* @brief Method that generates schema for function Function2.
*
- * @return NsSmartDeviceLink::NsSmartObjects::CSmartSchema
+ * @return ns_smart_device_link::ns_smart_objects::CSmartSchema
*/
- static NsSmartDeviceLink::NsSmartObjects::CSmartSchema InitFunction_val_2_notification(
+ static ns_smart_device_link::ns_smart_objects::CSmartSchema InitFunction_val_2_notification(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items);
@@ -304,7 +304,7 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
* @note Issue2
* @note Issue3
*/
- static NsSmartDeviceLink::NsSmartObjects::TSharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> InitStructSchemaItem_Struct1(
+ static ns_smart_device_link::ns_smart_objects::TSharedPtr<ns_smart_device_link::ns_smart_objects::ISchemaItem> InitStructSchemaItem_Struct1(
const TStructsSchemaItems &struct_schema_items);
/**
@@ -314,7 +314,7 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
* @note Issue2
* @note Issue3
*/
- static NsSmartDeviceLink::NsSmartObjects::TSharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> InitStructSchemaItem_Struct2(
+ static ns_smart_device_link::ns_smart_objects::TSharedPtr<ns_smart_device_link::ns_smart_objects::ISchemaItem> InitStructSchemaItem_Struct2(
const TStructsSchemaItems &struct_schema_items);
};
diff --git a/tools/InterfaceGenerator/test/generator/generators/test_expected_sdlrpc.cc b/tools/InterfaceGenerator/test/generator/generators/test_expected_sdlrpc.cc
index 53e5b7f78a..30b9b645ab 100644
--- a/tools/InterfaceGenerator/test/generator/generators/test_expected_sdlrpc.cc
+++ b/tools/InterfaceGenerator/test/generator/generators/test_expected_sdlrpc.cc
@@ -50,7 +50,7 @@
#include "SmartObjects/TNumberSchemaItem.hpp"
#include "SmartObjects/TSchemaItemParameter.hpp"
-using namespace NsSmartDeviceLink::NsSmartObjects;
+using namespace ns_smart_device_link::ns_smart_objects;
XXX::YYY::ZZZ::Test::Test()
: CSmartFactory<FunctionID::eType, messageType::eType, StructIdentifiers::eType>() {
@@ -76,7 +76,7 @@ TSharedPtr<ISchemaItem> XXX::YYY::ZZZ::Test::ProvideObjectSchemaItemForStruct(
return it->second;
}
- return NsSmartDeviceLink::NsSmartObjects::CAlwaysFalseSchemaItem::create();
+ return ns_smart_device_link::ns_smart_objects::CAlwaysFalseSchemaItem::create();
}
void XXX::YYY::ZZZ::Test::InitStructSchemes(
@@ -94,9 +94,9 @@ void XXX::YYY::ZZZ::Test::InitFunctionSchemes(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items) {
- functions_schemes_.insert(std::make_pair(NsSmartDeviceLink::NsJSONHandler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::name1, messageType::request), InitFunction_name1_request(struct_schema_items, function_id_items, message_type_items)));
- functions_schemes_.insert(std::make_pair(NsSmartDeviceLink::NsJSONHandler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::val_1, messageType::response), InitFunction_val_1_response(struct_schema_items, function_id_items, message_type_items)));
- functions_schemes_.insert(std::make_pair(NsSmartDeviceLink::NsJSONHandler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::val_2, messageType::notification), InitFunction_val_2_notification(struct_schema_items, function_id_items, message_type_items)));
+ functions_schemes_.insert(std::make_pair(ns_smart_device_link::ns_json_handler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::name1, messageType::request), InitFunction_name1_request(struct_schema_items, function_id_items, message_type_items)));
+ functions_schemes_.insert(std::make_pair(ns_smart_device_link::ns_json_handler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::val_1, messageType::response), InitFunction_val_1_response(struct_schema_items, function_id_items, message_type_items)));
+ functions_schemes_.insert(std::make_pair(ns_smart_device_link::ns_json_handler::SmartSchemaKey<FunctionID::eType, messageType::eType>(FunctionID::val_2, messageType::notification), InitFunction_val_2_notification(struct_schema_items, function_id_items, message_type_items)));
}
//------------- Functions schemes initialization -------------
@@ -130,21 +130,21 @@ CSmartSchema XXX::YYY::ZZZ::Test::InitFunction_name1_request(
// Function parameter param2.
TSharedPtr<ISchemaItem> param2_SchemaItem = TEnumSchemaItem<Enum1::eType>::create(param2_allowed_enum_subset_values, TSchemaItemParameter<Enum1::eType>(name1));
- std::map<std::string, CObjectSchemaItem::SMember> schema_members;
+ std::map<std::string, SMember> schema_members;
- schema_members["param1"] = CObjectSchemaItem::SMember(param1_SchemaItem, true);
- schema_members["param2"] = CObjectSchemaItem::SMember(param2_SchemaItem, true);
+ schema_members["param1"] = SMember(param1_SchemaItem, true);
+ schema_members["param2"] = SMember(param2_SchemaItem, true);
- std::map<std::string, CObjectSchemaItem::SMember> params_members;
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_CORRELATION_ID] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ std::map<std::string, SMember> params_members;
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID] = SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE] = SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_VERSION] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_TYPE] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_CORRELATION_ID] = SMember(TNumberSchemaItem<int>::create(), true);
- std::map<std::string, CObjectSchemaItem::SMember> root_members_map;
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_MSG_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(schema_members), true);
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(params_members), true);
+ std::map<std::string, SMember> root_members_map;
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS] = SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] = SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
@@ -153,18 +153,18 @@ CSmartSchema XXX::YYY::ZZZ::Test::InitFunction_val_1_response(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items) {
- std::map<std::string, CObjectSchemaItem::SMember> schema_members;
+ std::map<std::string, SMember> schema_members;
- std::map<std::string, CObjectSchemaItem::SMember> params_members;
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_CORRELATION_ID] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ std::map<std::string, SMember> params_members;
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID] = SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE] = SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_VERSION] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_TYPE] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_CORRELATION_ID] = SMember(TNumberSchemaItem<int>::create(), true);
- std::map<std::string, CObjectSchemaItem::SMember> root_members_map;
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_MSG_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(schema_members), true);
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(params_members), true);
+ std::map<std::string, SMember> root_members_map;
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS] = SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] = SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
@@ -173,17 +173,17 @@ CSmartSchema XXX::YYY::ZZZ::Test::InitFunction_val_2_notification(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items) {
- std::map<std::string, CObjectSchemaItem::SMember> schema_members;
+ std::map<std::string, SMember> schema_members;
- std::map<std::string, CObjectSchemaItem::SMember> params_members;
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_FUNCTION_ID] = CObjectSchemaItem::SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_MESSAGE_TYPE] = CObjectSchemaItem::SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_VERSION] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
- params_members[NsSmartDeviceLink::NsJSONHandler::strings::S_PROTOCOL_TYPE] = CObjectSchemaItem::SMember(TNumberSchemaItem<int>::create(), true);
+ std::map<std::string, SMember> params_members;
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_FUNCTION_ID] = SMember(TEnumSchemaItem<FunctionID::eType>::create(function_id_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_MESSAGE_TYPE] = SMember(TEnumSchemaItem<messageType::eType>::create(message_type_items), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_VERSION] = SMember(TNumberSchemaItem<int>::create(), true);
+ params_members[ns_smart_device_link::ns_json_handler::strings::S_PROTOCOL_TYPE] = SMember(TNumberSchemaItem<int>::create(), true);
- std::map<std::string, CObjectSchemaItem::SMember> root_members_map;
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_MSG_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(schema_members), true);
- root_members_map[NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS] = CObjectSchemaItem::SMember(CObjectSchemaItem::create(params_members), true);
+ std::map<std::string, SMember> root_members_map;
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_MSG_PARAMS] = SMember(CObjectSchemaItem::create(schema_members), true);
+ root_members_map[ns_smart_device_link::ns_json_handler::strings::S_PARAMS] = SMember(CObjectSchemaItem::create(params_members), true);
return CSmartSchema(CObjectSchemaItem::create(root_members_map));
}
@@ -252,36 +252,36 @@ TSharedPtr<ISchemaItem> XXX::YYY::ZZZ::Test::InitStructSchemaItem_Struct1(
// Struct member arrayOfEnum6.
TSharedPtr<ISchemaItem> arrayOfEnum6_SchemaItem = CArraySchemaItem::create(TEnumSchemaItem<Enum_new4::eType>::create(sub3_allowed_enum_subset_values, TSchemaItemParameter<Enum_new4::eType>()), TSchemaItemParameter<size_t>(10), TSchemaItemParameter<size_t>(43));
- std::map<std::string, CObjectSchemaItem::SMember> schema_members;
-
- schema_members["intParam"] = CObjectSchemaItem::SMember(intParam_SchemaItem, true);
- schema_members["doubleParam"] = CObjectSchemaItem::SMember(doubleParam_SchemaItem, false);
- schema_members["boolParam"] = CObjectSchemaItem::SMember(boolParam_SchemaItem, true);
- schema_members["structParam"] = CObjectSchemaItem::SMember(structParam_SchemaItem, true);
- schema_members["enumParam"] = CObjectSchemaItem::SMember(enumParam_SchemaItem, true);
- schema_members["enumParam1"] = CObjectSchemaItem::SMember(enumParam1_SchemaItem, true);
- schema_members["enumSubset1"] = CObjectSchemaItem::SMember(enumSubset1_SchemaItem, false);
- schema_members["arrayOfInt"] = CObjectSchemaItem::SMember(arrayOfInt_SchemaItem, false);
- schema_members["arrayOfEnum1"] = CObjectSchemaItem::SMember(arrayOfEnum1_SchemaItem, false);
- schema_members["arrayOfEnum3"] = CObjectSchemaItem::SMember(arrayOfEnum3_SchemaItem, true);
- schema_members["arrayOfEnum4"] = CObjectSchemaItem::SMember(arrayOfEnum4_SchemaItem, true);
- schema_members["arrayOfEnum5"] = CObjectSchemaItem::SMember(arrayOfEnum5_SchemaItem, true);
- schema_members["arrayOfEnum6"] = CObjectSchemaItem::SMember(arrayOfEnum6_SchemaItem, true);
+ std::map<std::string, SMember> schema_members;
+
+ schema_members["intParam"] = SMember(intParam_SchemaItem, true);
+ schema_members["doubleParam"] = SMember(doubleParam_SchemaItem, false);
+ schema_members["boolParam"] = SMember(boolParam_SchemaItem, true);
+ schema_members["structParam"] = SMember(structParam_SchemaItem, true);
+ schema_members["enumParam"] = SMember(enumParam_SchemaItem, true);
+ schema_members["enumParam1"] = SMember(enumParam1_SchemaItem, true);
+ schema_members["enumSubset1"] = SMember(enumSubset1_SchemaItem, false);
+ schema_members["arrayOfInt"] = SMember(arrayOfInt_SchemaItem, false);
+ schema_members["arrayOfEnum1"] = SMember(arrayOfEnum1_SchemaItem, false);
+ schema_members["arrayOfEnum3"] = SMember(arrayOfEnum3_SchemaItem, true);
+ schema_members["arrayOfEnum4"] = SMember(arrayOfEnum4_SchemaItem, true);
+ schema_members["arrayOfEnum5"] = SMember(arrayOfEnum5_SchemaItem, true);
+ schema_members["arrayOfEnum6"] = SMember(arrayOfEnum6_SchemaItem, true);
return CObjectSchemaItem::create(schema_members);
}
TSharedPtr<ISchemaItem> XXX::YYY::ZZZ::Test::InitStructSchemaItem_Struct2(
const TStructsSchemaItems &struct_schema_items) {
- std::map<std::string, CObjectSchemaItem::SMember> schema_members;
+ std::map<std::string, SMember> schema_members;
return CObjectSchemaItem::create(schema_members);
}
//-------------- String to value enum mapping ----------------
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
+namespace ns_smart_device_link {
+namespace ns_smart_objects {
template <>
const std::map<XXX::YYY::ZZZ::Enum1::eType, std::string> &TEnumSchemaItem<XXX::YYY::ZZZ::Enum1::eType>::getEnumElementsStringRepresentation() {
@@ -361,6 +361,6 @@ const std::map<XXX::YYY::ZZZ::messageType::eType, std::string> &TEnumSchemaItem<
return enum_string_representation;
}
-} // NsSmartObjects
-} // NsSmartDeviceLink
+} // ns_smart_objects
+} // ns_smart_device_link
diff --git a/tools/InterfaceGenerator/test/generator/generators/test_expected_sdlrpc.h b/tools/InterfaceGenerator/test/generator/generators/test_expected_sdlrpc.h
index 826ea55ce1..cf22f0711f 100644
--- a/tools/InterfaceGenerator/test/generator/generators/test_expected_sdlrpc.h
+++ b/tools/InterfaceGenerator/test/generator/generators/test_expected_sdlrpc.h
@@ -218,7 +218,7 @@ enum eType {
* param2 - value2
* param1 - value1
*/
-class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::eType, messageType::eType, StructIdentifiers::eType> {
+class Test : public ns_smart_device_link::ns_json_handler::CSmartFactory<FunctionID::eType, messageType::eType, StructIdentifiers::eType> {
public:
/**
* @brief Constructor.
@@ -229,7 +229,7 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
/**
* @brief Type that maps of struct IDs to schema items.
*/
- typedef std::map<const StructIdentifiers::eType, NsSmartDeviceLink::NsSmartObjects::TSharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> > TStructsSchemaItems;
+ typedef std::map<const StructIdentifiers::eType, ns_smart_device_link::ns_smart_objects::TSharedPtr<ns_smart_device_link::ns_smart_objects::ISchemaItem> > TStructsSchemaItems;
/**
* @brief Helper that allows to make reference to struct
@@ -239,7 +239,7 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
*
* @return TSharedPtr of strucute
*/
- static NsSmartDeviceLink::NsSmartObjects::TSharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> ProvideObjectSchemaItemForStruct(
+ static ns_smart_device_link::ns_smart_objects::TSharedPtr<ns_smart_device_link::ns_smart_objects::ISchemaItem> ProvideObjectSchemaItemForStruct(
const TStructsSchemaItems &struct_schema_items,
const StructIdentifiers::eType struct_id);
@@ -263,9 +263,9 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
/**
* @brief Method that generates schema for function Function1.
*
- * @return NsSmartDeviceLink::NsSmartObjects::CSmartSchema
+ * @return ns_smart_device_link::ns_smart_objects::CSmartSchema
*/
- static NsSmartDeviceLink::NsSmartObjects::CSmartSchema InitFunction_name1_request(
+ static ns_smart_device_link::ns_smart_objects::CSmartSchema InitFunction_name1_request(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items);
@@ -273,9 +273,9 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
/**
* @brief Method that generates schema for function Function2.
*
- * @return NsSmartDeviceLink::NsSmartObjects::CSmartSchema
+ * @return ns_smart_device_link::ns_smart_objects::CSmartSchema
*/
- static NsSmartDeviceLink::NsSmartObjects::CSmartSchema InitFunction_val_1_response(
+ static ns_smart_device_link::ns_smart_objects::CSmartSchema InitFunction_val_1_response(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items);
@@ -283,9 +283,9 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
/**
* @brief Method that generates schema for function Function2.
*
- * @return NsSmartDeviceLink::NsSmartObjects::CSmartSchema
+ * @return ns_smart_device_link::ns_smart_objects::CSmartSchema
*/
- static NsSmartDeviceLink::NsSmartObjects::CSmartSchema InitFunction_val_2_notification(
+ static ns_smart_device_link::ns_smart_objects::CSmartSchema InitFunction_val_2_notification(
const TStructsSchemaItems &struct_schema_items,
const std::set<FunctionID::eType> &function_id_items,
const std::set<messageType::eType> &message_type_items);
@@ -299,7 +299,7 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
* @note Issue2
* @note Issue3
*/
- static NsSmartDeviceLink::NsSmartObjects::TSharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> InitStructSchemaItem_Struct1(
+ static ns_smart_device_link::ns_smart_objects::TSharedPtr<ns_smart_device_link::ns_smart_objects::ISchemaItem> InitStructSchemaItem_Struct1(
const TStructsSchemaItems &struct_schema_items);
/**
@@ -309,7 +309,7 @@ class Test : public NsSmartDeviceLink::NsJSONHandler::CSmartFactory<FunctionID::
* @note Issue2
* @note Issue3
*/
- static NsSmartDeviceLink::NsSmartObjects::TSharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> InitStructSchemaItem_Struct2(
+ static ns_smart_device_link::ns_smart_objects::TSharedPtr<ns_smart_device_link::ns_smart_objects::ISchemaItem> InitStructSchemaItem_Struct2(
const TStructsSchemaItems &struct_schema_items);
};
diff --git a/tools/InterfaceGenerator/test/generator/parsers/test_JSONRPC.py b/tools/InterfaceGenerator/test/generator/parsers/test_JSONRPC.py
index f2fecdb901..90700fdbb9 100755
--- a/tools/InterfaceGenerator/test/generator/parsers/test_JSONRPC.py
+++ b/tools/InterfaceGenerator/test/generator/parsers/test_JSONRPC.py
@@ -1,13 +1,25 @@
"""JSONRPC XML parser unit test."""
import os
+import sys
import unittest
-
-import generator.Model
-import generator.parsers.JSONRPC
+from pathlib import Path
+
+sys.path.append(Path(__file__).absolute().parents[3].as_posix())
+sys.path.append(Path(__file__).absolute().parents[4].joinpath('rpc_spec/InterfaceParser').as_posix())
+try:
+ import generator.parsers.JSONRPC
+ from model.array import Array
+ from model.boolean import Boolean
+ from model.enum_subset import EnumSubset
+ from model.integer import Integer
+ from model.float import Float
+ from model.string import String
+except ModuleNotFoundError as error:
+ print('{}.\nJSONRPC\tProbably you did not initialize submodule'.format(error))
+ sys.exit(1)
class TestJSONRPCVParser(unittest.TestCase):
-
"""Test for JSONRPC xml parser."""
class _Issue:
@@ -21,7 +33,7 @@ class TestJSONRPCVParser(unittest.TestCase):
def setUp(self):
"""Test initialization."""
self.valid_xml_name = os.path.dirname(os.path.realpath(__file__)) + \
- "/valid_JSONRPC.xml"
+ "/valid_JSONRPC.xml"
self.parser = generator.parsers.JSONRPC.Parser()
def test_valid_xml(self):
@@ -37,7 +49,7 @@ class TestJSONRPCVParser(unittest.TestCase):
"interface1_design_description": "dd",
"interface2_attribute": "value",
"interface2_description":
- "Description of interface2",
+ "Description of interface2",
"interface2_todos": "i2 todo"},
interface.params)
@@ -217,7 +229,7 @@ class TestJSONRPCVParser(unittest.TestCase):
name="member1",
description=["Param1 description"])
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Integer)
+ self.assertIsInstance(member.param_type, Integer)
self.assertIsNone(member.param_type.min_value)
self.assertIsNone(member.param_type.max_value)
@@ -226,13 +238,13 @@ class TestJSONRPCVParser(unittest.TestCase):
self.verify_base_item(item=member, name="member2",
platform="member2 platform")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Boolean)
+ self.assertIsInstance(member.param_type, Boolean)
self.assertIn("member3", struct.members)
member = struct.members["member3"]
self.verify_base_item(item=member, name="member3")
self.assertEqual(False, member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Double)
+ self.assertIsInstance(member.param_type, Float)
self.assertIsNone(member.param_type.min_value)
self.assertAlmostEqual(20.5, member.param_type.max_value)
@@ -240,11 +252,11 @@ class TestJSONRPCVParser(unittest.TestCase):
member = struct.members["member4"]
self.verify_base_item(item=member, name="member4")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Array)
+ self.assertIsInstance(member.param_type, Array)
self.assertIsNone(member.param_type.min_size)
self.assertIsNone(member.param_type.max_size)
self.assertIsInstance(member.param_type.element_type,
- generator.Model.Integer)
+ Integer)
self.assertEqual(11, member.param_type.element_type.min_value)
self.assertEqual(100, member.param_type.element_type.max_value)
@@ -263,18 +275,18 @@ class TestJSONRPCVParser(unittest.TestCase):
member = struct.members["m1"]
self.verify_base_item(item=member, name="m1")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.String)
+ self.assertIsInstance(member.param_type, String)
self.assertIsNone(member.param_type.max_length)
self.assertIn("m2", struct.members)
member = struct.members["m2"]
self.verify_base_item(item=member, name="m2")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Array)
+ self.assertIsInstance(member.param_type, Array)
self.assertEqual(1, member.param_type.min_size)
self.assertEqual(50, member.param_type.max_size)
self.assertIsInstance(member.param_type.element_type,
- generator.Model.String)
+ String)
self.assertEqual(100, member.param_type.element_type.max_length)
self.assertIn("m3", struct.members)
@@ -287,7 +299,7 @@ class TestJSONRPCVParser(unittest.TestCase):
member = struct.members["m4"]
self.verify_base_item(item=member, name="m4")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Array)
+ self.assertIsInstance(member.param_type, Array)
self.assertIsNone(member.param_type.min_size)
self.assertEqual(10, member.param_type.max_size)
self.assertIs(member.param_type.element_type,
@@ -305,7 +317,7 @@ class TestJSONRPCVParser(unittest.TestCase):
member = struct.members["m_1"]
self.verify_base_item(item=member, name="m_1")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Array)
+ self.assertIsInstance(member.param_type, Array)
self.assertEqual(1, member.param_type.min_size)
self.assertEqual(10, member.param_type.max_size)
self.assertIs(member.param_type.element_type,
@@ -321,7 +333,7 @@ class TestJSONRPCVParser(unittest.TestCase):
member = struct.members["m_3"]
self.verify_base_item(item=member, name="m_3")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.String)
+ self.assertIsInstance(member.param_type, String)
self.assertEqual(20, member.param_type.max_length)
# Functions
@@ -357,9 +369,10 @@ class TestJSONRPCVParser(unittest.TestCase):
name="param1",
issues=[TestJSONRPCVParser._Issue(creator="", value="")])
self.assertEqual(False, param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.String)
+ self.assertIsInstance(param.param_type, String)
self.assertIsNone(param.param_type.max_length)
- self.assertEqual("String default value", param.default_value)
+ self.assertIsNone(param.default_value)
+ self.assertEqual("String default value", param.param_type.default_value)
self.assertIn("param2", function.params)
param = function.params["param2"]
@@ -370,7 +383,7 @@ class TestJSONRPCVParser(unittest.TestCase):
todos=["Param2 todo"],
platform="param2 platform")
self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.Integer)
+ self.assertIsInstance(param.param_type, Integer)
self.assertIsNone(param.param_type.min_value)
self.assertIsNone(param.param_type.max_value)
self.assertIsNone(param.default_value)
@@ -418,16 +431,18 @@ class TestJSONRPCVParser(unittest.TestCase):
self.verify_base_item(item=param, name="p2")
self.assertTrue(param.is_mandatory)
self.assertIs(param.param_type, interface.enums["interface1_enum1"])
- self.assertIs(
- param.default_value,
- interface.enums["interface1_enum1"].elements["element2"])
+ self.assertIsNone(param.default_value)
+ self.assertIsNone(param.param_type.default_value)
+ self.assertIs(param.param_type.elements["element2"],
+ interface.enums["interface1_enum1"].elements["element2"])
self.assertIn("p3", function.params)
param = function.params["p3"]
self.verify_base_item(item=param, name="p3", design_description=[""])
self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.Boolean)
- self.assertEqual(False, param.default_value)
+ self.assertIsInstance(param.param_type, Boolean)
+ self.assertIsNone(param.default_value)
+ self.assertFalse(param.param_type.default_value)
# Function notification "interface1_Function2"
@@ -454,14 +469,14 @@ class TestJSONRPCVParser(unittest.TestCase):
param = function.params["n1"]
self.verify_base_item(item=param, name="n1", todos=["n1 todo"])
self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.EnumSubset)
+ self.assertIsInstance(param.param_type, EnumSubset)
self.assertIs(param.param_type.enum,
interface.enums["interface1_enum1"])
self.assertDictEqual(
{"element2":
- interface.enums["interface1_enum1"].elements["element2"],
+ interface.enums["interface1_enum1"].elements["element2"],
"element3":
- interface.enums["interface1_enum1"].elements["element3"]},
+ interface.enums["interface1_enum1"].elements["element3"]},
param.param_type.allowed_elements)
self.assertIsNone(param.default_value)
@@ -469,18 +484,18 @@ class TestJSONRPCVParser(unittest.TestCase):
param = function.params["n2"]
self.verify_base_item(item=param, name="n2", todos=["n2 todo"])
self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.Array)
+ self.assertIsInstance(param.param_type, Array)
self.assertEqual(1, param.param_type.min_size)
self.assertEqual(100, param.param_type.max_size)
self.assertIsInstance(param.param_type.element_type,
- generator.Model.EnumSubset)
+ EnumSubset)
self.assertIs(param.param_type.element_type.enum,
interface.enums["interface1_enum1"])
self.assertDictEqual(
{"element1":
- interface.enums["interface1_enum1"].elements["element1"],
+ interface.enums["interface1_enum1"].elements["element1"],
"element3":
- interface.enums["interface1_enum1"].elements["element3"]},
+ interface.enums["interface1_enum1"].elements["element3"]},
param.param_type.element_type.allowed_elements)
self.assertIsNone(param.default_value)
@@ -521,7 +536,7 @@ class TestJSONRPCVParser(unittest.TestCase):
param = function.params["param2"]
self.verify_base_item(item=param, name="param2")
self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.Array)
+ self.assertIsInstance(param.param_type, Array)
self.assertEqual(5, param.param_type.min_size)
self.assertEqual(25, param.param_type.max_size)
self.assertIs(param.param_type.element_type,
@@ -555,14 +570,14 @@ class TestJSONRPCVParser(unittest.TestCase):
param = function.params["param"]
self.verify_base_item(item=param, name="param")
self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.EnumSubset)
+ self.assertIsInstance(param.param_type, EnumSubset)
self.assertIs(param.param_type.enum,
interface.enums["interface2_enum2"])
self.assertDictEqual(
{"element2":
- interface.enums["interface2_enum2"].elements["element2"],
+ interface.enums["interface2_enum2"].elements["element2"],
"element3":
- interface.enums["interface2_enum2"].elements["element3"]},
+ interface.enums["interface2_enum2"].elements["element3"]},
param.param_type.allowed_elements)
self.assertIsNone(param.default_value)
@@ -591,5 +606,6 @@ class TestJSONRPCVParser(unittest.TestCase):
"""Return provided list or empty list if None is provided."""
return list if list is not None else []
+
if __name__ == "__main__":
unittest.main()
diff --git a/tools/InterfaceGenerator/test/generator/parsers/test_SDLRPCV1.py b/tools/InterfaceGenerator/test/generator/parsers/test_SDLRPCV1.py
index 1464658ff4..b039473c24 100755
--- a/tools/InterfaceGenerator/test/generator/parsers/test_SDLRPCV1.py
+++ b/tools/InterfaceGenerator/test/generator/parsers/test_SDLRPCV1.py
@@ -1,13 +1,25 @@
"""SDLRPCV1 XML parser unit test."""
import os
+import sys
import unittest
-
-import generator.Model
-import generator.parsers.SDLRPCV1
+from pathlib import Path
+
+sys.path.append(Path(__file__).absolute().parents[3].as_posix())
+sys.path.append(Path(__file__).absolute().parents[4].joinpath('rpc_spec/InterfaceParser').as_posix())
+try:
+ import generator.parsers.SDLRPCV1
+ from model.array import Array
+ from model.boolean import Boolean
+ from model.enum_subset import EnumSubset
+ from model.float import Float
+ from model.integer import Integer
+ from model.string import String
+except ModuleNotFoundError as error:
+ print('{}.\nProbably you did not initialize submodule'.format(error))
+ sys.exit(1)
class TestSDLRPCV1Parser(unittest.TestCase):
-
"""Test for SDLRPCV1 xml parser."""
class _Issue:
@@ -21,7 +33,7 @@ class TestSDLRPCV1Parser(unittest.TestCase):
def setUp(self):
"""Test initialization."""
self.valid_xml_name = os.path.dirname(os.path.realpath(__file__)) + \
- "/valid_SDLRPCV1.xml"
+ "/valid_SDLRPCV1.xml"
self.parser = generator.parsers.SDLRPCV1.Parser()
def test_valid_xml(self):
@@ -150,7 +162,7 @@ class TestSDLRPCV1Parser(unittest.TestCase):
name="member1",
description=["Param1 description"])
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Integer)
+ self.assertIsInstance(member.param_type, Integer)
self.assertIsNone(member.param_type.min_value)
self.assertIsNone(member.param_type.max_value)
@@ -159,13 +171,13 @@ class TestSDLRPCV1Parser(unittest.TestCase):
self.verify_base_item(item=member, name="member2",
platform="member2 platform")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Boolean)
+ self.assertIsInstance(member.param_type, Boolean)
self.assertIn("member3", struct.members)
member = struct.members["member3"]
self.verify_base_item(item=member, name="member3")
self.assertEqual(False, member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Double)
+ self.assertIsInstance(member.param_type, Float)
self.assertIsNone(member.param_type.min_value)
self.assertAlmostEqual(20.5, member.param_type.max_value)
@@ -173,11 +185,11 @@ class TestSDLRPCV1Parser(unittest.TestCase):
member = struct.members["member4"]
self.verify_base_item(item=member, name="member4")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Array)
+ self.assertIsInstance(member.param_type, Array)
self.assertIsNone(member.param_type.min_size)
self.assertIsNone(member.param_type.max_size)
self.assertIsInstance(member.param_type.element_type,
- generator.Model.Integer)
+ Integer)
self.assertEqual(11, member.param_type.element_type.min_value)
self.assertEqual(100, member.param_type.element_type.max_value)
@@ -196,18 +208,18 @@ class TestSDLRPCV1Parser(unittest.TestCase):
member = struct.members["m1"]
self.verify_base_item(item=member, name="m1")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.String)
+ self.assertIsInstance(member.param_type, String)
self.assertIsNone(member.param_type.max_length)
self.assertIn("m2", struct.members)
member = struct.members["m2"]
self.verify_base_item(item=member, name="m2")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Array)
+ self.assertIsInstance(member.param_type, Array)
self.assertEqual(1, member.param_type.min_size)
self.assertEqual(50, member.param_type.max_size)
self.assertIsInstance(member.param_type.element_type,
- generator.Model.String)
+ String)
self.assertEqual(100, member.param_type.element_type.max_length)
self.assertIn("m3", struct.members)
@@ -220,7 +232,7 @@ class TestSDLRPCV1Parser(unittest.TestCase):
member = struct.members["m4"]
self.verify_base_item(item=member, name="m4")
self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Array)
+ self.assertIsInstance(member.param_type, Array)
self.assertIsNone(member.param_type.min_size)
self.assertEqual(10, member.param_type.max_size)
self.assertIs(member.param_type.element_type,
@@ -258,9 +270,10 @@ class TestSDLRPCV1Parser(unittest.TestCase):
name="param1",
issues=[TestSDLRPCV1Parser._Issue(creator="", value="")])
self.assertEqual(False, param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.String)
+ self.assertIsInstance(param.param_type, String)
self.assertIsNone(param.param_type.max_length)
- self.assertEqual("String default value", param.default_value)
+ self.assertIsNone(param.default_value)
+ self.assertEqual("String default value", param.param_type.default_value)
self.assertIn("param2", function.params)
param = function.params["param2"]
@@ -271,7 +284,7 @@ class TestSDLRPCV1Parser(unittest.TestCase):
todos=["Param2 todo"],
platform="param2 platform")
self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.Integer)
+ self.assertIsInstance(param.param_type, Integer)
self.assertIsNone(param.param_type.min_value)
self.assertIsNone(param.param_type.max_value)
self.assertIsNone(param.default_value)
@@ -317,15 +330,17 @@ class TestSDLRPCV1Parser(unittest.TestCase):
self.verify_base_item(item=param, name="p2")
self.assertTrue(param.is_mandatory)
self.assertIs(param.param_type, interface.enums["enum1"])
- self.assertIs(param.default_value,
- interface.enums["enum1"].elements["element2"])
+ self.assertIsNone(param.default_value)
+ self.assertIsNone(param.param_type.default_value)
+ self.assertIs(param.param_type.elements["element2"], interface.enums["enum1"].elements["element2"])
self.assertIn("p3", function.params)
param = function.params["p3"]
self.verify_base_item(item=param, name="p3", design_description=[""])
self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.Boolean)
- self.assertEqual(False, param.default_value)
+ self.assertIsInstance(param.param_type, Boolean)
+ self.assertIsNone(param.default_value)
+ self.assertFalse(param.param_type.default_value)
# Function notification "Function2"
@@ -351,7 +366,7 @@ class TestSDLRPCV1Parser(unittest.TestCase):
param = function.params["n1"]
self.verify_base_item(item=param, name="n1", todos=["n1 todo"])
self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.EnumSubset)
+ self.assertIsInstance(param.param_type, EnumSubset)
self.assertIs(param.param_type.enum, interface.enums["enum1"])
self.assertDictEqual(
{"element2": interface.enums["enum1"].elements["element2"],
@@ -363,11 +378,11 @@ class TestSDLRPCV1Parser(unittest.TestCase):
param = function.params["n2"]
self.verify_base_item(item=param, name="n2", todos=["n2 todo"])
self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.Array)
+ self.assertIsInstance(param.param_type, Array)
self.assertEqual(1, param.param_type.min_size)
self.assertEqual(100, param.param_type.max_size)
self.assertIsInstance(param.param_type.element_type,
- generator.Model.EnumSubset)
+ EnumSubset)
self.assertIs(param.param_type.element_type.enum,
interface.enums["enum1"])
self.assertDictEqual(
@@ -400,5 +415,6 @@ class TestSDLRPCV1Parser(unittest.TestCase):
"""Return provided list or empty list if None is provided."""
return list if list is not None else []
+
if __name__ == "__main__":
unittest.main()
diff --git a/tools/InterfaceGenerator/test/generator/parsers/test_SDLRPCV2.py b/tools/InterfaceGenerator/test/generator/parsers/test_SDLRPCV2.py
deleted file mode 100755
index c37962cfe6..0000000000
--- a/tools/InterfaceGenerator/test/generator/parsers/test_SDLRPCV2.py
+++ /dev/null
@@ -1,417 +0,0 @@
-"""SDLRPCV2 XML parser unit test."""
-import os
-import unittest
-
-import generator.Model
-import generator.parsers.SDLRPCV2
-
-
-class TestSDLRPCV2Parser(unittest.TestCase):
-
- """Test for SDLRPCV2 xml parser."""
-
- class _Issue:
- def __init__(self, creator, value):
- self.creator = creator
- self.value = value
-
- def __eq__(self, other):
- return self.creator == other.creator and self.value == other.value
-
- def setUp(self):
- """Test initialization."""
- self.valid_xml_name = os.path.dirname(os.path.realpath(__file__)) + \
- "/valid_SDLRPCV2.xml"
- self.parser = generator.parsers.SDLRPCV2.Parser()
-
- def test_valid_xml(self):
- """Test parsing of valid xml."""
- interface = self.parser.parse(self.valid_xml_name)
-
- self.assertEqual(2, len(interface.params))
- self.assertDictEqual({"attribute1": "value1", "attribute2": "value2"},
- interface.params)
-
- # Enumerations
-
- self.assertEqual(3, len(interface.enums))
-
- # Enumeration "FunctionID"
-
- self.assertIn("FunctionID", interface.enums)
- enum = interface.enums["FunctionID"]
- self.verify_base_item(item=enum,
- name="FunctionID",
- description=["Description string 1",
- "Description string 2"],
- todos=['Function id todo'])
- self.assertIsNone(enum.internal_scope)
-
- self.assertEqual(2, len(enum.elements))
-
- self.assertIn("Function1_id", enum.elements)
- element = enum.elements["Function1_id"]
- self.verify_base_item(
- item=element,
- name="Function1_id",
- design_description=["Function1 element design description"])
- self.assertIsNone(element.internal_name)
- self.assertEqual(10, element.value)
-
- self.assertIn("Function2_id", enum.elements)
- element = enum.elements["Function2_id"]
- self.verify_base_item(
- item=element,
- name="Function2_id")
- self.assertEqual("Function2_internal", element.internal_name)
- self.assertIsNone(element.value)
-
- # Enumeration "messageType"
-
- self.assertIn("messageType", interface.enums)
- enum = interface.enums["messageType"]
- self.verify_base_item(
- item=enum,
- name="messageType",
- design_description=["messageType design description",
- "messageType design description 2"],
- issues=[TestSDLRPCV2Parser._Issue(
- creator="messageType issue creator",
- value="Issue text")])
- self.assertIsNone(enum.internal_scope)
-
- self.assertEqual(3, len(enum.elements))
-
- self.assertIn("request", enum.elements)
- element = enum.elements["request"]
- self.verify_base_item(item=element,
- name="request",
- todos=["request todo 1", "request todo 2"],
- issues=[TestSDLRPCV2Parser._Issue(
- creator="issue creator",
- value="request issue")])
- self.assertIsNone(element.internal_name)
- self.assertEqual(0, element.value)
-
- self.assertIn("response", enum.elements)
- element = enum.elements["response"]
- self.verify_base_item(item=element, name="response")
- self.assertIsNone(element.internal_name)
- self.assertEqual(1, element.value)
-
- self.assertIn("notification", enum.elements)
- element = enum.elements["notification"]
- self.verify_base_item(item=element, name="notification")
- self.assertIsNone(element.internal_name)
- self.assertEqual(2, element.value)
-
- # Enumeration "enum1"
-
- self.assertIn("enum1", interface.enums)
- enum = interface.enums["enum1"]
- self.verify_base_item(item=enum, name="enum1",
- platform="enum1 platform")
- self.assertEqual("scope", enum.internal_scope)
-
- self.assertEqual(3, len(enum.elements))
-
- self.assertIn("element1", enum.elements)
- element = enum.elements["element1"]
- self.verify_base_item(item=element, name="element1")
- self.assertIsNone(element.internal_name)
- self.assertEqual(10, element.value)
-
- self.assertIn("element2", enum.elements)
- element = enum.elements["element2"]
- self.verify_base_item(item=element, name="element2")
- self.assertEqual("element2_internal", element.internal_name)
- self.assertEqual(11, element.value)
-
- self.assertIn("element3", enum.elements)
- element = enum.elements["element3"]
- self.verify_base_item(
- item=element,
- name="element3",
- design_description=["Element design description"],
- platform="element3 platform")
- self.assertIsNone(element.internal_name)
- self.assertIsNone(element.value)
-
- # Structures
-
- self.assertEqual(2, len(interface.structs))
-
- # Structure "struct1"
-
- self.assertIn("struct1", interface.structs)
- struct = interface.structs["struct1"]
- self.verify_base_item(
- item=struct,
- name="struct1",
- description=["Struct description"],
- issues=[TestSDLRPCV2Parser._Issue(creator="creator1",
- value="Issue1"),
- TestSDLRPCV2Parser._Issue(creator="creator2",
- value="Issue2")])
-
- self.assertEqual(4, len(struct.members))
-
- self.assertIn("member1", struct.members)
- member = struct.members["member1"]
- self.verify_base_item(
- item=member,
- name="member1",
- description=["Param1 description"])
- self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Integer)
- self.assertIsNone(member.param_type.min_value)
- self.assertIsNone(member.param_type.max_value)
-
- self.assertIn("member2", struct.members)
- member = struct.members["member2"]
- self.verify_base_item(item=member, name="member2",
- platform="member2 platform")
- self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Boolean)
-
- self.assertIn("member3", struct.members)
- member = struct.members["member3"]
- self.verify_base_item(item=member, name="member3")
- self.assertEqual(False, member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Double)
- self.assertIsNone(member.param_type.min_value)
- self.assertAlmostEqual(20.5, member.param_type.max_value)
-
- self.assertIn("member4", struct.members)
- member = struct.members["member4"]
- self.verify_base_item(item=member, name="member4")
- self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Array)
- self.assertIsNone(member.param_type.min_size)
- self.assertIsNone(member.param_type.max_size)
- self.assertIsInstance(member.param_type.element_type,
- generator.Model.Integer)
- self.assertEqual(11, member.param_type.element_type.min_value)
- self.assertEqual(100, member.param_type.element_type.max_value)
-
- # Structure "struct2"
-
- self.assertIn("struct2", interface.structs)
- struct = interface.structs["struct2"]
- self.verify_base_item(item=struct,
- name="struct2",
- description=["Description of struct2"],
- platform="struct2 platform")
-
- self.assertEqual(4, len(struct.members))
-
- self.assertIn("m1", struct.members)
- member = struct.members["m1"]
- self.verify_base_item(item=member, name="m1")
- self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.String)
- self.assertIsNone(member.param_type.max_length)
-
- self.assertIn("m2", struct.members)
- member = struct.members["m2"]
- self.verify_base_item(item=member, name="m2")
- self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Array)
- self.assertEqual(1, member.param_type.min_size)
- self.assertEqual(50, member.param_type.max_size)
- self.assertIsInstance(member.param_type.element_type,
- generator.Model.String)
- self.assertEqual(100, member.param_type.element_type.max_length)
-
- self.assertIn("m3", struct.members)
- member = struct.members["m3"]
- self.verify_base_item(item=member, name="m3")
- self.assertTrue(member.is_mandatory)
- self.assertIs(member.param_type, interface.enums["enum1"])
-
- self.assertIn("m4", struct.members)
- member = struct.members["m4"]
- self.verify_base_item(item=member, name="m4")
- self.assertTrue(member.is_mandatory)
- self.assertIsInstance(member.param_type, generator.Model.Array)
- self.assertIsNone(member.param_type.min_size)
- self.assertEqual(10, member.param_type.max_size)
- self.assertIs(member.param_type.element_type,
- interface.structs["struct1"])
-
- # Functions
-
- self.assertEqual(3, len(interface.functions))
-
- # Function request "Function1"
-
- self.assertIn(
- (interface.enums["FunctionID"].elements["Function1_id"],
- interface.enums["messageType"].elements["request"]),
- interface.functions)
- function = interface.functions[
- (interface.enums["FunctionID"].elements["Function1_id"],
- interface.enums["messageType"].elements["request"])]
- self.verify_base_item(
- item=function,
- name="Function1",
- description=["Description of request Function1"],
- todos=["Function1 request todo"])
- self.assertIs(function.function_id,
- interface.enums["FunctionID"].elements["Function1_id"])
- self.assertIs(function.message_type,
- interface.enums["messageType"].elements["request"])
-
- self.assertEqual(3, len(function.params))
-
- self.assertIn("param1", function.params)
- param = function.params["param1"]
- self.verify_base_item(
- item=param,
- name="param1",
- issues=[TestSDLRPCV2Parser._Issue(creator="", value="")])
- self.assertEqual(False, param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.String)
- self.assertIsNone(param.param_type.max_length)
- self.assertEqual("String default value", param.default_value)
-
- self.assertIn("param2", function.params)
- param = function.params["param2"]
- self.verify_base_item(
- item=param,
- name="param2",
- description=["Param2 description", ""],
- todos=["Param2 todo"],
- platform="param2 platform")
- self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.Integer)
- self.assertIsNone(param.param_type.min_value)
- self.assertIsNone(param.param_type.max_value)
- self.assertIsNone(param.default_value)
-
- self.assertIn("param3", function.params)
- param = function.params["param3"]
- self.verify_base_item(item=param, name="param3")
- self.assertEqual(False, param.is_mandatory)
- self.assertIs(param.param_type, interface.structs["struct1"])
- self.assertIsNone(param.default_value)
-
- # Function response "Function1"
-
- self.assertIn(
- (interface.enums["FunctionID"].elements["Function1_id"],
- interface.enums["messageType"].elements["response"]),
- interface.functions)
- function = interface.functions[
- (interface.enums["FunctionID"].elements["Function1_id"],
- interface.enums["messageType"].elements["response"])]
- self.verify_base_item(
- item=function,
- name="Function1",
- issues=[TestSDLRPCV2Parser._Issue(creator="c1", value=""),
- TestSDLRPCV2Parser._Issue(creator="c2", value="")],
- platform="")
- self.assertIs(function.function_id,
- interface.enums["FunctionID"].elements["Function1_id"])
- self.assertIs(function.message_type,
- interface.enums["messageType"].elements["response"])
-
- self.assertEqual(3, len(function.params))
-
- self.assertIn("p1", function.params)
- param = function.params["p1"]
- self.verify_base_item(item=param, name="p1")
- self.assertTrue(param.is_mandatory)
- self.assertIs(param.param_type, interface.enums["enum1"])
- self.assertIsNone(param.default_value)
-
- self.assertIn("p2", function.params)
- param = function.params["p2"]
- self.verify_base_item(item=param, name="p2")
- self.assertTrue(param.is_mandatory)
- self.assertIs(param.param_type, interface.enums["enum1"])
- self.assertIs(param.default_value,
- interface.enums["enum1"].elements["element2"])
-
- self.assertIn("p3", function.params)
- param = function.params["p3"]
- self.verify_base_item(item=param, name="p3", design_description=[""])
- self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.Boolean)
- self.assertEqual(False, param.default_value)
-
- # Function notification "Function2"
-
- self.assertIn(
- (interface.enums["FunctionID"].elements["Function2_id"],
- interface.enums["messageType"].elements["notification"]),
- interface.functions)
- function = interface.functions[
- (interface.enums["FunctionID"].elements["Function2_id"],
- interface.enums["messageType"].elements["notification"])]
- self.verify_base_item(item=function,
- name="Function2",
- description=["Function2 description"],
- platform="function2 platform")
- self.assertIs(function.function_id,
- interface.enums["FunctionID"].elements["Function2_id"])
- self.assertIs(function.message_type,
- interface.enums["messageType"].elements["notification"])
-
- self.assertEqual(3, len(function.params))
-
- self.assertIn("n1", function.params)
- param = function.params["n1"]
- self.verify_base_item(item=param, name="n1", todos=["n1 todo"])
- self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.EnumSubset)
- self.assertIs(param.param_type.enum, interface.enums["enum1"])
- self.assertDictEqual(
- {"element2": interface.enums["enum1"].elements["element2"],
- "element3": interface.enums["enum1"].elements["element3"]},
- param.param_type.allowed_elements)
- self.assertIsNone(param.default_value)
-
- self.assertIn("n2", function.params)
- param = function.params["n2"]
- self.verify_base_item(item=param, name="n2", todos=["n2 todo"])
- self.assertTrue(param.is_mandatory)
- self.assertIsInstance(param.param_type, generator.Model.Array)
- self.assertEqual(1, param.param_type.min_size)
- self.assertEqual(100, param.param_type.max_size)
- self.assertIsInstance(param.param_type.element_type,
- generator.Model.EnumSubset)
- self.assertIs(param.param_type.element_type.enum,
- interface.enums["enum1"])
- self.assertDictEqual(
- {"element1": interface.enums["enum1"].elements["element1"],
- "element3": interface.enums["enum1"].elements["element3"]},
- param.param_type.element_type.allowed_elements)
- self.assertIsNone(param.default_value)
-
- self.assertIn("n3", function.params)
- param = function.params["n3"]
- self.verify_base_item(item=param, name="n3")
- self.assertEqual(False, param.is_mandatory)
- self.assertIs(param.param_type, interface.structs["struct2"])
- self.assertIsNone(param.default_value)
-
- def verify_base_item(self, item, name, description=None,
- design_description=None, issues=None, todos=None,
- platform=None):
- """Verify base interface item variables."""
- self.assertEqual(name, item.name)
- self.assertSequenceEqual(self.get_list(description), item.description)
- self.assertSequenceEqual(self.get_list(design_description),
- item.design_description)
- self.assertSequenceEqual(self.get_list(issues), item.issues)
- self.assertSequenceEqual(self.get_list(todos), item.todos)
- self.assertEqual(platform, item.platform)
-
- @staticmethod
- def get_list(list=None):
- """Return provided list or empty list if None is provided."""
- return list if list is not None else []
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/tools/InterfaceGenerator/test/generator/parsers/valid_JSONRPC.xml b/tools/InterfaceGenerator/test/generator/parsers/valid_JSONRPC.xml
index a754e5714e..a964ce6e92 100644
--- a/tools/InterfaceGenerator/test/generator/parsers/valid_JSONRPC.xml
+++ b/tools/InterfaceGenerator/test/generator/parsers/valid_JSONRPC.xml
@@ -2,7 +2,7 @@
<interfaces attr1="v1" attr2="v2">
<interface name="interface1" attribute1="value1" attribute2="value2">
<struct name="struct1">
- <param name="member1" type="Integer">
+ <param name="member1" type="Integer" mandatory="true">
<description>Param1 description</description>
</param>
<issue creator="creator1">Issue1</issue>
@@ -10,7 +10,7 @@
<param name="member3" type="Float" maxvalue="20.5" mandatory="false"/>
<description>Struct description</description>
<issue creator="creator2">Issue2</issue>
- <param name="member4" type="Integer" minvalue="11" maxvalue="100" array="true"/>
+ <param name="member4" type="Integer" minvalue="11" maxvalue="100" array="true" mandatory="true"/>
</struct>
<issue creator="c">Issue1</issue>
<function name="Function1" messagetype="request">
@@ -18,7 +18,7 @@
<param name="param1" type="String" mandatory="false" defvalue="String default value">
<issue creator=""/>
</param>
- <param name="param2" type="Integer" platform="param2 platform">
+ <param name="param2" type="Integer" platform="param2 platform" mandatory="true">
<description>Param2 description</description>
<todo>Param2 todo</todo>
<description/>
@@ -36,29 +36,29 @@
<designdescription>dd</designdescription>
<issue creator="c">Issue2</issue>
<function name="Function1" messagetype="response" platform="">
- <param name="p1" type="enum1"/>
+ <param name="p1" type="enum1" mandatory="true"/>
<issue creator="c1"/>
- <issue creator="c2"></issue>
- <param name="p2" type="enum1" defvalue="element2"/>
- <param name="p3" type="Boolean" defvalue="false">
+ <issue creator="c2"/>
+ <param name="p2" type="enum1" defvalue="element2" mandatory="true"/>
+ <param name="p3" type="Boolean" defvalue="false" mandatory="true">
<designdescription/>
</param>
</function>
<struct name="struct2" platform="struct2 platform">
<description>Description of struct2</description>
- <param name="m1" type="String"/>
- <param name="m2" type="String" maxlength="100" array="true" minsize="1" maxsize="50"/>
- <param name="m3" type="enum1"/>
- <param name="m4" type="struct1" array="true" maxsize="10"/>
+ <param name="m1" type="String" mandatory="true"/>
+ <param name="m2" type="String" maxlength="100" array="true" minsize="1" maxsize="50" mandatory="true"/>
+ <param name="m3" type="enum1" mandatory="true"/>
+ <param name="m4" type="struct1" array="true" maxsize="10" mandatory="true"/>
</struct>
<function name="Function2" messagetype="notification" platform="function2 platform">
<description>Function2 description</description>
- <param name="n1" type="enum1">
+ <param name="n1" type="enum1" mandatory="true">
<element name="element2"/>
<element name="element3"/>
<todo>n1 todo</todo>
</param>
- <param name="n2" type="enum1" array="true" minsize="1" maxsize="100">
+ <param name="n2" type="enum1" array="true" minsize="1" maxsize="100" mandatory="true">
<element name="element3"/>
<todo>n2 todo</todo>
<element name="element1"/>
@@ -79,22 +79,22 @@
<element name="element3"/>
</enum>
<struct name="struct1">
- <param name="m_1" type="enum1" minsize="1" maxsize="10" array="true"/>
- <param name="m_2" type="enum2"/>
- <param name="m_3" type="String" maxlength="20"/>
+ <param name="m_1" type="enum1" minsize="1" maxsize="10" array="true" mandatory="true"/>
+ <param name="m_2" type="enum2" mandatory="true"/>
+ <param name="m_3" type="String" maxlength="20" mandatory="true"/>
</struct>
<function name="Function1" messagetype="request">
<param name="param1" type="enum1" mandatory="false"/>
- <param name="param2" type="struct1" array="true" minsize="5" maxsize="25"/>
+ <param name="param2" type="struct1" array="true" minsize="5" maxsize="25" mandatory="true"/>
</function>
<todo>i2 todo</todo>
<function name="Function1" messagetype="notification" platform="platform">
<issue creator="c">Issue text</issue>
- <param name="param" type="enum2">
+ <param name="param" type="enum2" mandatory="true">
<element name="element2"/>
<element name="element3"/>
</param>
- <param name="i1" type="interface1.struct2"/>
+ <param name="i1" type="interface1.struct2" mandatory="true"/>
</function>
</interface>
</interfaces> \ No newline at end of file
diff --git a/tools/InterfaceGenerator/test/generator/parsers/valid_SDLRPCV1.xml b/tools/InterfaceGenerator/test/generator/parsers/valid_SDLRPCV1.xml
index 37ebf39d3a..05a83c5834 100644
--- a/tools/InterfaceGenerator/test/generator/parsers/valid_SDLRPCV1.xml
+++ b/tools/InterfaceGenerator/test/generator/parsers/valid_SDLRPCV1.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<interface name="test_interface" attribute1="value1" attribute2="value2">
<struct name="struct1">
- <param name="member1" type="Integer">
+ <param name="member1" type="Integer" mandatory="true">
<description>Param1 description</description>
</param>
<issue creator="creator1">Issue1</issue>
@@ -9,14 +9,14 @@
<param name="member3" type="Float" maxvalue="20.5" mandatory="false"/>
<description>Struct description</description>
<issue creator="creator2">Issue2</issue>
- <param name="member4" type="Integer" minvalue="11" maxvalue="100" array="true"/>
+ <param name="member4" type="Integer" minvalue="11" maxvalue="100" array="true" mandatory="true"/>
</struct>
- <function name="Function1" messagetype="request">
+ <function name="Function1" functionID="Function1_id" messagetype="request">
<description>Description of request Function1</description>
<param name="param1" type="String" mandatory="false" defvalue="String default value">
<issue creator=""/>
</param>
- <param name="param2" type="Integer" platform="param2 platform">
+ <param name="param2" type="Integer" platform="param2 platform" mandatory="true">
<description>Param2 description</description>
<todo>Param2 todo</todo>
<description/>
@@ -31,30 +31,30 @@
<designdescription>Element design description</designdescription>
</element>
</enum>
- <function name="Function1" messagetype="response" platform="">
- <param name="p1" type="enum1"/>
+ <function name="Function1" functionID="Function1_id" messagetype="response" platform="">
+ <param name="p1" type="enum1" mandatory="true"/>
<issue creator="c1"/>
- <issue creator="c2"></issue>
- <param name="p2" type="enum1" defvalue="element2"/>
- <param name="p3" type="Boolean" defvalue="false">
+ <issue creator="c2"/>
+ <param name="p2" type="enum1" defvalue="element2" mandatory="true"/>
+ <param name="p3" type="Boolean" defvalue="false" mandatory="true">
<designdescription/>
</param>
</function>
<struct name="struct2" platform="struct2 platform">
<description>Description of struct2</description>
- <param name="m1" type="String"/>
- <param name="m2" type="String" maxlength="100" array="true" minsize="1" maxsize="50"/>
- <param name="m3" type="enum1"/>
- <param name="m4" type="struct1" array="true" maxsize="10"/>
+ <param name="m1" type="String" mandatory="true"/>
+ <param name="m2" type="String" maxlength="100" array="true" minsize="1" maxsize="50" mandatory="true"/>
+ <param name="m3" type="enum1" mandatory="true"/>
+ <param name="m4" type="struct1" array="true" maxsize="10" mandatory="true"/>
</struct>
- <function name="Function2" messagetype="notification" platform="function2 platform">
+ <function name="Function2" functionID="Function2_id" messagetype="notification" platform="function2 platform">
<description>Function2 description</description>
- <param name="n1" type="enum1">
+ <param name="n1" type="enum1" mandatory="true">
<element name="element2"/>
<element name="element3"/>
<todo>n1 todo</todo>
</param>
- <param name="n2" type="enum1" array="true" minsize="1" maxsize="100">
+ <param name="n2" type="enum1" array="true" minsize="1" maxsize="100" mandatory="true">
<element name="element3"/>
<todo>n2 todo</todo>
<element name="element1"/>
diff --git a/tools/InterfaceGenerator/test/generator/parsers/valid_SDLRPCV2.xml b/tools/InterfaceGenerator/test/generator/parsers/valid_SDLRPCV2.xml
deleted file mode 100644
index cdc5f1ae85..0000000000
--- a/tools/InterfaceGenerator/test/generator/parsers/valid_SDLRPCV2.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0"?>
-<interface name="test_interface" attribute1="value1" attribute2="value2">
- <enum name="FunctionID">
- <description>Description string 1</description>
- <element name="Function1_id" value="10">
- <designdescription>Function1 element design description</designdescription>
- </element>
- <description>Description string 2</description>
- <todo>Function id todo</todo>
- <element name="Function2_id" internal_name="Function2_internal"/>
- </enum>
- <enum name="messageType">
- <element name="request" value="0">
- <todo>request todo 1</todo>
- <issue creator="issue creator">request issue</issue>
- <todo>request todo 2</todo>
- </element>
- <designdescription>messageType design description</designdescription>
- <issue creator="messageType issue creator">Issue text</issue>
- <element name="response" value="1"/>
- <element name="notification" value="2"/>
- <designdescription>messageType design description 2</designdescription>
- </enum>
- <struct name="struct1">
- <param name="member1" type="Integer">
- <description>Param1 description</description>
- </param>
- <issue creator="creator1">Issue1</issue>
- <param name="member2" type="Boolean" mandatory="true" platform="member2 platform"/>
- <param name="member3" type="Float" maxvalue="20.5" mandatory="false"/>
- <description>Struct description</description>
- <issue creator="creator2">Issue2</issue>
- <param name="member4" type="Integer" minvalue="11" maxvalue="100" array="true"/>
- </struct>
- <function name="Function1" functionID="Function1_id" messagetype="request">
- <description>Description of request Function1</description>
- <param name="param1" type="String" mandatory="false" defvalue="String default value">
- <issue creator=""/>
- </param>
- <param name="param2" type="Integer" platform="param2 platform">
- <description>Param2 description</description>
- <todo>Param2 todo</todo>
- <description/>
- </param>
- <todo>Function1 request todo</todo>
- <param name="param3" type="struct1" mandatory="false"/>
- </function>
- <enum name="enum1" internal_scope="scope" platform="enum1 platform">
- <element name="element1" value="10"/>
- <element name="element2" internal_name="element2_internal" value="11"/>
- <element name="element3" platform="element3 platform">
- <designdescription>Element design description</designdescription>
- </element>
- </enum>
- <function name="Function1" functionID="Function1_id" messagetype="response" platform="">
- <param name="p1" type="enum1"/>
- <issue creator="c1"/>
- <issue creator="c2"></issue>
- <param name="p2" type="enum1" defvalue="element2"/>
- <param name="p3" type="Boolean" defvalue="false">
- <designdescription/>
- </param>
- </function>
- <struct name="struct2" platform="struct2 platform">
- <description>Description of struct2</description>
- <param name="m1" type="String"/>
- <param name="m2" type="String" maxlength="100" array="true" minsize="1" maxsize="50"/>
- <param name="m3" type="enum1"/>
- <param name="m4" type="struct1" array="true" maxsize="10"/>
- </struct>
- <function name="Function2" functionID="Function2_id" messagetype="notification" platform="function2 platform">
- <description>Function2 description</description>
- <param name="n1" type="enum1">
- <element name="element2"/>
- <element name="element3"/>
- <todo>n1 todo</todo>
- </param>
- <param name="n2" type="enum1" array="true" minsize="1" maxsize="100">
- <element name="element3"/>
- <todo>n2 todo</todo>
- <element name="element1"/>
- </param>
- <param name="n3" type="struct2" mandatory="false"/>
- </function>
-</interface>
diff --git a/tools/InterfaceGenerator/test/generator/test_Model.py b/tools/InterfaceGenerator/test/generator/test_Model.py
deleted file mode 100755
index 55f6a54705..0000000000
--- a/tools/InterfaceGenerator/test/generator/test_Model.py
+++ /dev/null
@@ -1,27 +0,0 @@
-"""Interface model unit test"""
-import unittest
-
-import generator.Model
-
-
-class TestInterfaceModel(unittest.TestCase):
-
- """Test for interface model."""
-
- def test_enum_element_primary_name(self):
- """Test property primary_name of EnumElement."""
- element = generator.Model.EnumElement(name="name1")
- self.assertEqual("name1", element.primary_name)
-
- element = generator.Model.EnumElement(name="name2",
- internal_name="internal_name1")
- self.assertEqual("internal_name1", element.primary_name)
-
- element.internal_name = None
- self.assertEqual("name2", element.primary_name)
-
- element.internal_name = "internal_name2"
- self.assertEqual("internal_name2", element.primary_name)
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/tools/InterfaceGenerator/test/test_CodeFormatAndQuality.py b/tools/InterfaceGenerator/test/test_CodeFormatAndQuality.py
deleted file mode 100755
index 3ce56e0fae..0000000000
--- a/tools/InterfaceGenerator/test/test_CodeFormatAndQuality.py
+++ /dev/null
@@ -1,59 +0,0 @@
-import subprocess
-import unittest
-import flake8.main
-import pep257
-import os.path
-import fnmatch
-import os
-import pylint.lint
-import sys
-
-class TestCodeFormatAndQuality(unittest.TestCase):
-
- def setUp(self):
- self.projectRootDir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
- projectTestsDir = os.path.join(self.projectRootDir, "test")
- self.filesToAnalyze = []
- for root, dirnames, filenames in os.walk(self.projectRootDir):
- if root.startswith(projectTestsDir):
- continue # Currently we skipping test files
- for filename in fnmatch.filter(filenames, '*.py'):
- fullFileName = os.path.join(root, filename)
- relativeFileName = os.path.relpath(fullFileName, self.projectRootDir)
- self.filesToAnalyze.append(relativeFileName)
-
- def test_pep8_conformance(self):
- maxCyclomaticComplexity = 10
- errors = 0
- for file in self.filesToAnalyze:
- errors = errors + flake8.main.check_file(file, None, maxCyclomaticComplexity)
-
- self.assertEqual(errors, 0, "Found code style errors or warnings.")
-
- def test_pep257_conformance(self):
- errors = []
-
- for filePath in self.filesToAnalyze:
- print("Processing file: {0}".format(filePath))
- result = pep257.check_files([filePath])
- if result:
- errors.extend(result)
- for error in result:
- print(error)
- print
- self.assertEqual(len(errors), 0, "Found Docstring Conventions violations.")
-
- def test_pylint_conformance(self):
- print
- self.assertEqual(0,
- subprocess.call(
- ["pylint",
- '--rcfile=pylint.cfg',
- 'generator',
- 'Generator.py']
- ), "Found Pylint violations")
- return
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/tools/cmake/helpers/generators.cmake b/tools/cmake/helpers/generators.cmake
index 64f7c1f670..1a5a4b8fa1 100644
--- a/tools/cmake/helpers/generators.cmake
+++ b/tools/cmake/helpers/generators.cmake
@@ -28,12 +28,12 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
-find_package(PythonInterp REQUIRED)
+find_package(PythonInterp 3.5 REQUIRED)
if(NOT PYTHONINTERP_FOUND)
message(STATUS "Python interpreter is not found")
message(STATUS "To install it type in the command line:")
- message(STATUS "sudo apt-get install python")
+ message(STATUS "sudo apt-get install python3")
message(FATAL_ERROR "Exiting!")
endif(NOT PYTHONINTERP_FOUND)
@@ -41,6 +41,19 @@ set(INTEFRACE_GENERATOR "${CMAKE_SOURCE_DIR}/tools/InterfaceGenerator/Generator.
set(INTEFRACE_GENERATOR_CMD ${PYTHON_EXECUTABLE} -B ${INTEFRACE_GENERATOR})
file(GLOB_RECURSE INTERFACE_GENERATOR_DEPENDENCIES "${CMAKE_SOURCE_DIR}/tools/InterfaceGenerator/*.*")
+macro(generate_policy_types GENERATED_FILES
+ ARG_FULL_XML_NAME
+ ARG_NAMESPACE
+ PARSER_TYPE)
+ add_custom_command(
+ OUTPUT ${GENERATED_FILES}
+ COMMAND ${INTEFRACE_GENERATOR_CMD} "--source-xml" "${ARG_FULL_XML_NAME}" "--namespace" "${ARG_NAMESPACE}" "--output-dir" "${CMAKE_CURRENT_BINARY_DIR}" "--parser-type" "${PARSER_TYPE}" "-y"
+ DEPENDS ${INTERFACE_GENERATOR_DEPENDENCIES} ${ARG_FULL_XML_NAME}
+ COMMENT "Generating files:\n\t${GENERATED_FILES}\nfrom:\n\t${ARG_FULL_XML_NAME}\n\
+ ${INTEFRACE_GENERATOR_CMD} --source-xml ${ARG_FULL_XML_NAME} --namespace ${ARG_NAMESPACE} --output-dir ${CMAKE_CURRENT_BINARY_DIR} --parser-type ${PARSER_TYPE}" -y
+ VERBATIM)
+endmacro()
+
macro(generate_interface ARG_XML_NAME ARG_NAMESPACE PARSER_TYPE)
string(REGEX MATCH "^[a-zA-Z_0-9]*[^.]" FILE_NAME ${ARG_XML_NAME}) # TODO: make expression more robust
@@ -54,7 +67,7 @@ macro(generate_interface ARG_XML_NAME ARG_NAMESPACE PARSER_TYPE)
add_custom_command(
OUTPUT ${HPP_FILE} ${CPP_FILE}
- COMMAND ${INTEFRACE_GENERATOR_CMD} ${FULL_XML_NAME} ${ARG_NAMESPACE} ${CMAKE_CURRENT_BINARY_DIR} "--parser-type" "${PARSER_TYPE}"
+ COMMAND ${INTEFRACE_GENERATOR_CMD} "--source-xml" "${FULL_XML_NAME}" "--namespace" "${ARG_NAMESPACE}" "--output-dir" "${CMAKE_CURRENT_BINARY_DIR}" "--parser-type" "${PARSER_TYPE}" "-y"
DEPENDS ${INTERFACE_GENERATOR_DEPENDENCIES} ${FULL_XML_NAME}
COMMENT "Generating files:\n ${HPP_FILE}\n ${CPP_FILE}\nfrom:\n ${FULL_XML_NAME} ..."
VERBATIM
diff --git a/tools/cmake/modules/FindDBus.cmake b/tools/cmake/modules/FindDBus.cmake
deleted file mode 100644
index 1d0f29dd75..0000000000
--- a/tools/cmake/modules/FindDBus.cmake
+++ /dev/null
@@ -1,59 +0,0 @@
-# - Try to find DBus
-# Once done, this will define
-#
-# DBUS_FOUND - system has DBus
-# DBUS_INCLUDE_DIRS - the DBus include directories
-# DBUS_LIBRARIES - link these to use DBus
-#
-# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
-# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-FIND_PACKAGE(PkgConfig)
-PKG_CHECK_MODULES(PC_DBUS QUIET dbus-1)
-
-FIND_LIBRARY(DBUS_LIBRARIES
- NAMES dbus-1
- HINTS ${PC_DBUS_LIBDIR}
- ${PC_DBUS_LIBRARY_DIRS}
-)
-
-FIND_PATH(DBUS_INCLUDE_DIR
- NAMES dbus/dbus.h
- HINTS ${PC_DBUS_INCLUDEDIR}
- ${PC_DBUS_INCLUDE_DIRS}
-)
-
-GET_FILENAME_COMPONENT(_DBUS_LIBRARY_DIR ${DBUS_LIBRARIES} PATH)
-FIND_PATH(DBUS_ARCH_INCLUDE_DIR
- NAMES dbus/dbus-arch-deps.h
- HINTS ${PC_DBUS_INCLUDEDIR}
- ${PC_DBUS_INCLUDE_DIRS}
- ${_DBUS_LIBRARY_DIR}
- ${DBUS_INCLUDE_DIR}
- PATH_SUFFIXES include
-)
-
-SET(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
-
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBUS REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES) \ No newline at end of file
diff --git a/tools/cmake/modules/FindQt5DBus.cmake b/tools/cmake/modules/FindQt5DBus.cmake
deleted file mode 100644
index d850010e97..0000000000
--- a/tools/cmake/modules/FindQt5DBus.cmake
+++ /dev/null
@@ -1,10 +0,0 @@
-execute_process(
- COMMAND ${CMAKE_SOURCE_DIR}/FindQt.sh -v ${qt_version} Qt5DBusConfig.cmake
- OUTPUT_VARIABLE config_file
-)
-
-if(config_file STREQUAL "")
- message(FATAL_ERROR "Qt5 DBus module not found")
-endif(config_file STREQUAL "")
-
-include(${config_file})
diff --git a/tools/infrastructure/check_style.sh b/tools/infrastructure/check_style.sh
index 08ae1b9860..006dd340d9 100755
--- a/tools/infrastructure/check_style.sh
+++ b/tools/infrastructure/check_style.sh
@@ -27,7 +27,7 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-FORMATER=clang-format-3.6
+FORMATER=clang-format-6.0
INSTALL_CMD="sudo apt-get install -f $FORMATER"
if [ "$1" = "--help" ]
diff --git a/tools/infrastructure/git-hooks/pre-commit b/tools/infrastructure/git-hooks/pre-commit
index 9c46f195f3..710f0656c3 100755
--- a/tools/infrastructure/git-hooks/pre-commit
+++ b/tools/infrastructure/git-hooks/pre-commit
@@ -72,10 +72,10 @@ if [ "$?" -ne "0" ]; then
exit 1
fi
-# Auto update c++ files with clang-format-3.6
-CLANG_FORMAT=clang-format-3.6
+# Auto update c++ files with clang-format-6.0
+CLANG_FORMAT=clang-format-6.0
# Verify clang-format
-CLANG_FORMAT_REQUIRED_VERSION=3.6
+CLANG_FORMAT_REQUIRED_VERSION=6.0
CLANG_FORMAT_CURRENT_VERSION=$($CLANG_FORMAT -version)
if [[ $CLANG_FORMAT_CURRENT_VERSION != *$CLANG_FORMAT_REQUIRED_VERSION* ]]
then
diff --git a/tools/intergen/GenerateInterfaceLibrary.cmake b/tools/intergen/GenerateInterfaceLibrary.cmake
index bec35e1e3a..31b06880c6 100644
--- a/tools/intergen/GenerateInterfaceLibrary.cmake
+++ b/tools/intergen/GenerateInterfaceLibrary.cmake
@@ -11,20 +11,14 @@ set(GENERATED_LIB_HEADER_DEPENDENCIES
# |generated_interface_names| should contain list of generated interfaces
# if |AUTO_FUNC_IDS| is added to argument list, intergen is called with "-a"
# flag telling intergen to generate function ids automatically
-# if |DBUS_SUPPORT| is added to argument list, intergen is called with "-d"
-# flag that enables DBus serialization code generation
# from xml_file (intergen creates separate directory for every interface).
# Their names are written lowercase_underscored_style.
function (GenerateInterfaceLibrary xml_file_name generated_interface_names)
- set(options AUTO_FUNC_IDS DBUS_SUPPORT)
+ set(options AUTO_FUNC_IDS)
cmake_parse_arguments(GenerateInterfaceLibrary "${options}" "" "" ${ARGN})
if (GenerateInterfaceLibrary_AUTO_FUNC_IDS)
set(AUTOID "-a")
endif()
- if (GenerateInterfaceLibrary_DBUS_SUPPORT)
- set(NEED_DBUS "-d")
- list(APPEND GENERATED_LIB_HEADER_DEPENDENCIES ${DBUS_INCLUDE_DIRS})
- endif()
foreach(interface_name ${generated_interface_names})
set(HEADERS
@@ -41,7 +35,7 @@ function (GenerateInterfaceLibrary xml_file_name generated_interface_names)
${interface_name}/interface.cc
)
add_custom_command( OUTPUT ${HEADERS} ${SOURCES}
- COMMAND ${INTERGEN_CMD} -f ${CMAKE_CURRENT_SOURCE_DIR}/${xml_file_name} -j ${AUTOID} ${NEED_DBUS} -i ${interface_name}
+ COMMAND ${INTERGEN_CMD} -f ${CMAKE_CURRENT_SOURCE_DIR}/${xml_file_name} -j ${AUTOID} -i ${interface_name}
DEPENDS ${INTERGEN_CMD} ${xml_file_name}
COMMENT "Generating interface ${interface_name} from ${xml_file_name}"
VERBATIM
diff --git a/tools/intergen/cppgen/CMakeLists.txt b/tools/intergen/cppgen/CMakeLists.txt
index c6e052a2ae..d20f3d9ab3 100644
--- a/tools/intergen/cppgen/CMakeLists.txt
+++ b/tools/intergen/cppgen/CMakeLists.txt
@@ -27,7 +27,6 @@ set (SOURCES
src/cppgen/namespace.cc
src/cppgen/naming_convention.cc
src/cppgen/struct_type_constructor.cc
- src/cppgen/struct_type_dbus_serializer.cc
src/cppgen/struct_type_from_json_method.cc
src/cppgen/struct_type_is_initialized_method.cc
src/cppgen/struct_type_is_valid_method.cc
@@ -58,7 +57,6 @@ set (HEADERS
include/cppgen/namespace.h
include/cppgen/naming_convention.h
include/cppgen/struct_type_constructor.h
- include/cppgen/struct_type_dbus_serializer.h
include/cppgen/struct_type_from_json_method.h
include/cppgen/struct_type_is_initialized_method.h
include/cppgen/struct_type_is_valid_method.h
diff --git a/tools/intergen/cppgen/include/cppgen/generator_preferences.h b/tools/intergen/cppgen/include/cppgen/generator_preferences.h
index 5278a24417..d0a58950e2 100644
--- a/tools/intergen/cppgen/include/cppgen/generator_preferences.h
+++ b/tools/intergen/cppgen/include/cppgen/generator_preferences.h
@@ -43,18 +43,15 @@ struct TypePreferences {
int minimum_interger_size;
bool avoid_unsigned;
bool generate_json;
- bool generate_dbus;
TypePreferences(int minimum_interger_size,
bool avoid_unsigned,
- bool generate_json,
- bool generate_dbus);
+ bool generate_json);
};
struct Preferences {
Preferences(int minimum_interger_size,
bool avoid_unsigned,
bool generate_json,
- bool generate_dbus,
const std::set<std::string>& requested_interfaces);
TypePreferences type_preferences;
std::set<std::string> requested_interfaces;
diff --git a/tools/intergen/cppgen/include/cppgen/message_factory_function.h b/tools/intergen/cppgen/include/cppgen/message_factory_function.h
index da63b4453a..aa8a0ab6c4 100644
--- a/tools/intergen/cppgen/include/cppgen/message_factory_function.h
+++ b/tools/intergen/cppgen/include/cppgen/message_factory_function.h
@@ -46,8 +46,7 @@ class Interface;
class MessageFactoryFunction: public CppFunction {
public:
enum SerializationType {
- kJson,
- kDbus
+ kJson
};
// Methods
diff --git a/tools/intergen/cppgen/include/cppgen/struct_type_dbus_serializer.h b/tools/intergen/cppgen/include/cppgen/struct_type_dbus_serializer.h
deleted file mode 100644
index 64872f3265..0000000000
--- a/tools/intergen/cppgen/include/cppgen/struct_type_dbus_serializer.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CPPGEN_STRUCT_TYPE_DBUS_SERIALIZER_H
-#define CPPGEN_STRUCT_TYPE_DBUS_SERIALIZER_H
-
-#include "cppgen/cpp_function.h"
-
-namespace codegen {
-class Interface;
-class Struct;
-class TypePreferences;
-
-class StructTypeDbusMessageSignatureMethod: public CppFunction {
- public:
- StructTypeDbusMessageSignatureMethod(const TypePreferences* preferences,
- const Struct* strct,
- bool substructure);
- ~StructTypeDbusMessageSignatureMethod();
- private:
- // CppFunction interface
- void DefineBody(std::ostream* os) const;
- private:
- const TypePreferences* preferences_;
- bool substructure_;
- const Struct* strct_;
-};
-
-class StructTypeFromDbusReaderConstructor : public CppStructConstructor {
- public:
- StructTypeFromDbusReaderConstructor(const TypePreferences* preferences,
- const Struct* strct,
- bool substructure,
- const std::string& base_class_name);
- ~StructTypeFromDbusReaderConstructor();
- private:
- // CppFunction interface
- void DefineBody(std::ostream* os) const;
- private:
- const TypePreferences* preferences_;
- bool substructure_;
- const Struct* strct_;
-};
-
-class StructTypeToDbusWriterMethod : public CppFunction {
- public:
- StructTypeToDbusWriterMethod(const Struct* strct,
- bool substructure);
- ~StructTypeToDbusWriterMethod();
- private:
- // CppFunction interface
- void DefineBody(std::ostream* os) const;
- private:
- bool substructure_;
- const Struct* strct_;
-};
-
-} // namespace codegen
-
-#endif // CPPGEN_STRUCT_TYPE_DBUS_SERIALIZER_H
diff --git a/tools/intergen/cppgen/src/cppgen/cpp_interface_code_generator.cc b/tools/intergen/cppgen/src/cppgen/cpp_interface_code_generator.cc
index 49bd758b6e..519e6a06e2 100644
--- a/tools/intergen/cppgen/src/cppgen/cpp_interface_code_generator.cc
+++ b/tools/intergen/cppgen/src/cppgen/cpp_interface_code_generator.cc
@@ -183,9 +183,6 @@ void CppInterfaceCodeGenerator::GenerateMessageFactories() {
if (preferences_->generate_json) {
ser_types[ser_types_count++] = MessageFactoryFunction::kJson;
}
- if (preferences_->generate_dbus) {
- ser_types[ser_types_count++] = MessageFactoryFunction::kDbus;
- }
for (size_t i = 0; i < ser_types_count; ++i) {
MessageFactoryFunction request_factory(interface_,
diff --git a/tools/intergen/cppgen/src/cppgen/declaration_generator.cc b/tools/intergen/cppgen/src/cppgen/declaration_generator.cc
index 46e459198e..649ffd8c68 100644
--- a/tools/intergen/cppgen/src/cppgen/declaration_generator.cc
+++ b/tools/intergen/cppgen/src/cppgen/declaration_generator.cc
@@ -47,7 +47,6 @@
#include "cppgen/module_manager.h"
#include "cppgen/naming_convention.h"
#include "cppgen/struct_type_constructor.h"
-#include "cppgen/struct_type_dbus_serializer.h"
#include "cppgen/struct_type_from_json_method.h"
#include "cppgen/struct_type_is_initialized_method.h"
#include "cppgen/struct_type_is_valid_method.h"
@@ -98,14 +97,6 @@ void DeclareExternalTypes(const TypePreferences& prefs, Namespace* ns) {
Namespace::ForwardDeclaration(
Namespace::ForwardDeclaration::kClass, "Value"));
}
- if (prefs.generate_dbus) {
- ns->nested("dbus").ForwardDeclare(
- Namespace::ForwardDeclaration(
- Namespace::ForwardDeclaration::kClass, "MessageReader"));
- ns->nested("dbus").ForwardDeclare(
- Namespace::ForwardDeclaration(
- Namespace::ForwardDeclaration::kClass, "MessageWriter"));
- }
}
}
@@ -172,13 +163,6 @@ void DeclarationGenerator::GenerateCodeForStruct(const Struct* strct) {
StructTypeFromJsonConstructor(strct, base_class_name).Declare(&o , true);
StructTypeToJsonMethod(strct).Declare(&o , true);
}
- if (preferences_->generate_dbus) {
- StructTypeFromDbusReaderConstructor(
- preferences_, strct, true, base_class_name).Declare(&o, true);
- StructTypeToDbusWriterMethod(strct, true).Declare(&o , true);
- StructTypeDbusMessageSignatureMethod(preferences_,
- strct, true).Declare(&o, true);
- }
StructTypeIsValidMethod(strct).Declare(&o, true);
StructTypeIsInitializedMethod(strct).Declare(&o, true);
StructTypeStructEmptyMethod(strct).Declare(&o, true);
@@ -284,13 +268,6 @@ void DeclarationGenerator::GenerateCodeForRequest(const Request& request,
StructTypeFromJsonConstructor(&request, base_class_name).Declare(&o , true);
StructTypeToJsonMethod(&request).Declare(&o , true);
}
- if (preferences_->generate_dbus) {
- StructTypeFromDbusReaderConstructor(preferences_, &request, false,
- base_class_name).Declare(&o, true);
- StructTypeToDbusWriterMethod(&request, false).Declare(&o , true);
- StructTypeDbusMessageSignatureMethod(preferences_,
- &request, false).Declare(&o, true);
- }
StructTypeIsValidMethod(&request).Declare(&o, true);
StructTypeIsInitializedMethod(&request).Declare(&o, true);
StructTypeStructEmptyMethod(&request).Declare(&o, true);
@@ -336,14 +313,6 @@ void DeclarationGenerator::GenerateCodeForResponse(const Response& response) {
StructTypeToJsonMethod(&response).Declare(&o , true);
}
- if (preferences_->generate_dbus) {
- StructTypeFromDbusReaderConstructor(preferences_, &response, false,
- base_class_name).Declare(&o, true);
- StructTypeToDbusWriterMethod(&response, false).Declare(&o , true);
-
- StructTypeDbusMessageSignatureMethod(preferences_,
- &response, false).Declare(&o, true);
- }
StructTypeIsValidMethod(&response).Declare(&o, true);
StructTypeIsInitializedMethod(&response).Declare(&o, true);
StructTypeStructEmptyMethod(&response).Declare(&o, true);
@@ -389,13 +358,6 @@ void DeclarationGenerator::GenerateCodeForNotification(
StructTypeFromJsonConstructor(&notification, base_class_name).Declare(&o , true);
StructTypeToJsonMethod(&notification).Declare(&o , true);
}
- if (preferences_->generate_dbus) {
- StructTypeFromDbusReaderConstructor(preferences_, &notification, false,
- base_class_name).Declare(&o , true);
- StructTypeToDbusWriterMethod(&notification, false).Declare(&o , true);
- StructTypeDbusMessageSignatureMethod(preferences_,
- &notification, false).Declare(&o, true);
- }
StructTypeIsValidMethod(&notification).Declare(&o, true);
StructTypeIsInitializedMethod(&notification).Declare(&o, true);
StructTypeStructEmptyMethod(&notification).Declare(&o, true);
diff --git a/tools/intergen/cppgen/src/cppgen/definition_generator.cc b/tools/intergen/cppgen/src/cppgen/definition_generator.cc
index e2ad0ded04..b5e404fa71 100644
--- a/tools/intergen/cppgen/src/cppgen/definition_generator.cc
+++ b/tools/intergen/cppgen/src/cppgen/definition_generator.cc
@@ -40,7 +40,6 @@
#include "cppgen/message_handle_with_method.h"
#include "cppgen/module_manager.h"
#include "cppgen/struct_type_constructor.h"
-#include "cppgen/struct_type_dbus_serializer.h"
#include "cppgen/struct_type_from_json_method.h"
#include "cppgen/struct_type_is_initialized_method.h"
#include "cppgen/struct_type_is_valid_method.h"
@@ -97,13 +96,6 @@ void DefinitionGenerator::GenerateCodeForStruct(const Struct* strct) {
StructTypeFromJsonConstructor(strct, base_class_name).Define(&o , false);
StructTypeToJsonMethod(strct).Define(&o , false);
}
- if (preferences_->generate_dbus) {
- StructTypeFromDbusReaderConstructor(preferences_, strct, true,
- base_class_name).Define(&o , false);
- StructTypeToDbusWriterMethod(strct, true).Define(&o , false);
- StructTypeDbusMessageSignatureMethod(preferences_,
- strct, true).Define(&o, false);
- }
StructTypeIsValidMethod(strct).Define(&o, false);
StructTypeIsInitializedMethod(strct).Define(&o, false);
StructTypeStructEmptyMethod(strct).Define(&o, false);
@@ -137,13 +129,6 @@ void DefinitionGenerator::GenerateCodeForResponse(const Response& response) {
StructTypeFromJsonConstructor(&response, base_class_name).Define(&o , false);
StructTypeToJsonMethod(&response).Define(&o , false);
}
- if (preferences_->generate_dbus) {
- StructTypeFromDbusReaderConstructor(preferences_, &response, false,
- base_class_name).Define(&o , false);
- StructTypeToDbusWriterMethod(&response, false).Define(&o , false);
- StructTypeDbusMessageSignatureMethod(preferences_,
- &response, false).Define(&o, false);
- }
MessageHandleWithMethod(response.name()).Define(&o, false);
StructTypeIsValidMethod(&response).Define(&o, false);
StructTypeIsInitializedMethod(&response).Define(&o, false);
@@ -173,13 +158,6 @@ void DefinitionGenerator::GenerateCodeForNotification(
StructTypeFromJsonConstructor(&notification, base_class_name).Define(&o , false);
StructTypeToJsonMethod(&notification).Define(&o , false);
}
- if (preferences_->generate_dbus) {
- StructTypeFromDbusReaderConstructor(preferences_, &notification, false,
- base_class_name).Define(&o, false);
- StructTypeToDbusWriterMethod(&notification, false).Define(&o , false);
- StructTypeDbusMessageSignatureMethod(preferences_,
- &notification, false).Define(&o, false);
- }
MessageHandleWithMethod(notification.name()).Define(&o, false);
StructTypeIsValidMethod(&notification).Define(&o, false);
StructTypeIsInitializedMethod(&notification).Define(&o, false);
@@ -209,13 +187,6 @@ void DefinitionGenerator::GenerateCodeForRequest(const Request& request,
StructTypeFromJsonConstructor(&request, base_class_name).Define(&o , false);
StructTypeToJsonMethod(&request).Define(&o , false);
}
- if (preferences_->generate_dbus) {
- StructTypeFromDbusReaderConstructor(preferences_, &request, false,
- base_class_name).Define(&o , false);
- StructTypeToDbusWriterMethod(&request, false).Define(&o , false);
- StructTypeDbusMessageSignatureMethod(preferences_,
- &request, false).Define(&o, false);
- }
StructTypeIsValidMethod(&request).Define(&o, false);
StructTypeIsInitializedMethod(&request).Define(&o, false);
StructTypeStructEmptyMethod(&request).Define(&o, false);
diff --git a/tools/intergen/cppgen/src/cppgen/generator_preferences.cc b/tools/intergen/cppgen/src/cppgen/generator_preferences.cc
index ca5b12e2d9..cc3bbe0819 100644
--- a/tools/intergen/cppgen/src/cppgen/generator_preferences.cc
+++ b/tools/intergen/cppgen/src/cppgen/generator_preferences.cc
@@ -44,21 +44,18 @@ namespace codegen {
TypePreferences::TypePreferences(int minimum_interger_size,
bool avoid_unsigned,
- bool generate_json,
- bool generate_dbus)
+ bool generate_json)
: minimum_interger_size(minimum_interger_size),
avoid_unsigned(avoid_unsigned),
- generate_json(generate_json),
- generate_dbus(generate_dbus) {
+ generate_json(generate_json) {
}
Preferences::Preferences(int minimum_interger_size,
bool avoid_unsigned,
bool generate_json,
- bool generate_dbus,
const std::set<std::string>& requested_interfaces)
: type_preferences(minimum_interger_size, avoid_unsigned,
- generate_json, generate_dbus),
+ generate_json),
requested_interfaces(requested_interfaces) {
}
diff --git a/tools/intergen/cppgen/src/cppgen/handler_interface.cc b/tools/intergen/cppgen/src/cppgen/handler_interface.cc
index 57b41523fd..a078b7af9a 100644
--- a/tools/intergen/cppgen/src/cppgen/handler_interface.cc
+++ b/tools/intergen/cppgen/src/cppgen/handler_interface.cc
@@ -76,7 +76,7 @@ void HandlerInterface::CollectMethods() {
assert(!"Unexpected function message type");
}
}
- std::auto_ptr<CppClass::Method> destructor(
+ std::unique_ptr<CppClass::Method> destructor(
new CppClass::Method(this, CppClass::kPublic,
"~"+name(), "",
CppFunction::kVirtual));
@@ -93,7 +93,7 @@ void HandlerInterface::AddFunctionMessageHandlers(
message_ns.ForwardDeclare(Namespace::ForwardDeclaration(
Namespace::ForwardDeclaration::kStruct,
func_msg->name()));
- std::auto_ptr<CppClass::Method> method(
+ std::unique_ptr<CppClass::Method> method(
new CppClass::Method(
this, CppClass::kPublic, "Handle" + func_msg->name(),
"void", CppFunction::kVirtual | CppFunction::kAbstract));
diff --git a/tools/intergen/cppgen/src/cppgen/message_factory_function.cc b/tools/intergen/cppgen/src/cppgen/message_factory_function.cc
index 2cfc3ea0cd..bce7ef50b2 100644
--- a/tools/intergen/cppgen/src/cppgen/message_factory_function.cc
+++ b/tools/intergen/cppgen/src/cppgen/message_factory_function.cc
@@ -47,15 +47,15 @@ MessageFactoryFunction::MessageFactoryFunction(
SerializationType serialization_type,
FunctionMessage::MessageType factory_type)
: CppFunction("",
- serialization_type == kJson ? "NewFromJson" : "NewFromDbus",
+ "NewFromJson",
Capitalize(
FunctionMessage::MessageTypeToString(
factory_type)) + "*"),
interface_(interface),
factory_type_(factory_type) {
Add(MessageFactoryFunction::Parameter(
- serialization_type == kJson ? "json" : "reader",
- serialization_type == kJson ? "const Json::Value*": "dbus::MessageReader*"));
+ "json",
+ "const Json::Value*"));
Add(MessageFactoryFunction::Parameter("function_id", "FunctionID"));
}
diff --git a/tools/intergen/cppgen/src/cppgen/module_manager.cc b/tools/intergen/cppgen/src/cppgen/module_manager.cc
index 494e279e5c..104e3fa856 100644
--- a/tools/intergen/cppgen/src/cppgen/module_manager.cc
+++ b/tools/intergen/cppgen/src/cppgen/module_manager.cc
@@ -105,12 +105,6 @@ ModuleManager::ModuleManager(const std::string& name,
functions_source_.Include(
CppFile::Header("rpc_base/rpc_base_json_inl.h", true));
}
- if (prefs.generate_dbus) {
- structs_source_.Include(
- CppFile::Header("rpc_base/rpc_base_dbus_inl.h", true));
- functions_source_.Include(
- CppFile::Header("rpc_base/rpc_base_dbus_inl.h", true));
- }
}
ModuleManager::~ModuleManager() {
diff --git a/tools/intergen/cppgen/src/cppgen/struct_type_dbus_serializer.cc b/tools/intergen/cppgen/src/cppgen/struct_type_dbus_serializer.cc
deleted file mode 100644
index 5040652e43..0000000000
--- a/tools/intergen/cppgen/src/cppgen/struct_type_dbus_serializer.cc
+++ /dev/null
@@ -1,177 +0,0 @@
-/* Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "cppgen/struct_type_dbus_serializer.h"
-
-#include "cppgen/naming_convention.h"
-#include "cppgen/type_name_code_generator.h"
-#include "model/composite_type.h"
-#include "utils/safeformat.h"
-
-using typesafe_format::strmfmt;
-
-namespace codegen {
-
-StructTypeDbusMessageSignatureMethod::StructTypeDbusMessageSignatureMethod(
- const TypePreferences* preferences,
- const Struct* strct,
- bool substructure)
- : CppFunction(strct->name(), "GetDbusSignature", "void", kStatic),
- preferences_(preferences),
- substructure_(substructure),
- strct_(strct) {
- Add(Parameter("signature", "std::string*"));
-}
-
-StructTypeDbusMessageSignatureMethod::~StructTypeDbusMessageSignatureMethod() {
-}
-
-void StructTypeDbusMessageSignatureMethod::DefineBody(std::ostream* os) const {
- const Struct::FieldsList& fields = strct_->fields();
- if (!fields.empty()) {
- if (substructure_) {
- *os << "(*signature) += DBUS_STRUCT_BEGIN_CHAR;\n";
- }
- for (Struct::FieldsList::const_iterator i = fields.begin(),
- end = fields.end(); i != end; ++i) {
- // Field is considered optional if it has mandatory=false attribute and
- // if it does NOT have default values. Fields that have default values are
- // always available no mater if they present in input or not
- bool field_is_optional = false;
- if (!i->is_mandatory()) {
- if (i->default_value() == NULL) {
- field_is_optional = true;
- }
- }
- std::string field_type = RpcTypeNameGenerator(&strct_->interface(),
- preferences_,
- i->type(),
- field_is_optional).result();
- strmfmt(*os, "rpc::DbusSignature< {0} >({1});\n",
- field_type, parameters_[0].name);
-
- }
- if (substructure_) {
- *os << "(*signature) += DBUS_STRUCT_END_CHAR;\n";
- }
- }
-}
-
-StructTypeFromDbusReaderConstructor::StructTypeFromDbusReaderConstructor(
- const TypePreferences* preferences,
- const Struct* strct,
- bool substructure,
- const std::string& base_class_name)
- : CppStructConstructor(strct->name()),
- preferences_(preferences),
- strct_(strct),
- substructure_(substructure) {
- Add(Parameter("reader__", "dbus::MessageReader*"));
- std::string base_initializer = "reader__";
- if (!strct->frankenstruct()) {
- base_initializer = "InitHelper(true)";
- }
- Add(Initializer(base_class_name, base_initializer));
- // In case of non-substructure use initializer list to initialize fields
- // From MessageReader passed in
- if (!substructure_) {
- const Struct::FieldsList& fields = strct->fields();
- for (Struct::FieldsList::const_iterator i = fields.begin(), end = fields.end();
- i != end; ++i) {
- Add(Initializer(AvoidKeywords(i->name()),
- "reader__"));
- }
- }
-}
-
-StructTypeFromDbusReaderConstructor::~StructTypeFromDbusReaderConstructor() {
-}
-
-void StructTypeFromDbusReaderConstructor::DefineBody(std::ostream* os) const {
- const Struct::FieldsList& fields = strct_->fields();
- // If initializing substructure (a structure that is used as
- // a field of other structure) additional structure reading iterator
- // should be created
- if (substructure_ && !fields.empty()) {
- *os << "dbus::MessageReader subreader__ = reader__->TakeStructReader();\n";
- for (Struct::FieldsList::const_iterator i = fields.begin(), end = fields.end();
- i != end; ++i) {
- // Field is considered optional if it has mandatory=false attribute and
- // if it does NOT have default values. Fields that have default values are
- // always available no mater if they present in input or not
- bool field_is_optional = false;
- if (!i->is_mandatory()) {
- if (i->default_value() == NULL) {
- field_is_optional = true;
- }
- }
- std::string field_type = RpcTypeNameGenerator(&strct_->interface(),
- preferences_,
- i->type(),
- field_is_optional).result();
- strmfmt(*os, "{0} = {1}(&subreader__);\n", i->name(), field_type);
- }
- }
-}
-
-StructTypeToDbusWriterMethod::StructTypeToDbusWriterMethod(
- const Struct* strct,
- bool substructure)
- : CppFunction(strct->name(), "ToDbusWriter", "void", kConst),
- substructure_(substructure),
- strct_(strct) {
- Add(Parameter("writer__", "dbus::MessageWriter*"));
-}
-
-StructTypeToDbusWriterMethod::~StructTypeToDbusWriterMethod() {
-
-}
-
-void StructTypeToDbusWriterMethod::DefineBody(std::ostream* os) const {
- const Struct::FieldsList& fields = strct_->fields();
- if (!fields.empty()) {
- std::string writer_ptr_name = parameters_[0].name;
- if (substructure_) {
- strmfmt(*os, "dbus::MessageWriter subwriter__({0}, dbus::kStruct, NULL);\n",
- writer_ptr_name);
- writer_ptr_name = "&subwriter__";
- }
- for (Struct::FieldsList::const_iterator i = fields.begin(), end = fields.end();
- i != end; ++i) {
- strmfmt(*os, "{0}.ToDbusWriter({1});\n",
- i->name(),
- writer_ptr_name);
- }
- }
-}
-
-
-} // namespace codegen
diff --git a/tools/intergen/model/src/model/composite_type.cc b/tools/intergen/model/src/model/composite_type.cc
index 57e89cce54..d4b0687c5a 100644
--- a/tools/intergen/model/src/model/composite_type.cc
+++ b/tools/intergen/model/src/model/composite_type.cc
@@ -332,6 +332,7 @@ bool NullableType::operator<(const NullableType& that) const {
if (type_ != that.type_) {
return type_ < that.type_;
}
+ return false;
}
TypeCodeGenerator* NullableType::Apply(
diff --git a/tools/intergen/test/CMakeLists.txt b/tools/intergen/test/CMakeLists.txt
index f2973dd71c..7695ec419c 100644
--- a/tools/intergen/test/CMakeLists.txt
+++ b/tools/intergen/test/CMakeLists.txt
@@ -30,11 +30,7 @@
if(BUILD_TESTS)
include(${CMAKE_SOURCE_DIR}/tools/intergen/GenerateInterfaceLibrary.cmake)
-if (${HMI_DBUS_API})
- GenerateInterfaceLibrary("test_interface.xml" test_rpc_interface DBUS_SUPPORT)
-else()
- GenerateInterfaceLibrary("test_interface.xml" test_rpc_interface)
-endif()
+GenerateInterfaceLibrary("test_interface.xml" test_rpc_interface)
set (TEST_HMI_INTERFACES
common
@@ -45,11 +41,7 @@ set (TEST_HMI_INTERFACES
ui
)
-if (${HMI_DBUS_API})
- GenerateInterfaceLibrary("test_hmi_interface.xml" "${TEST_HMI_INTERFACES}" AUTO_FUNC_IDS DBUS_SUPPORT)
-else()
- GenerateInterfaceLibrary("test_hmi_interface.xml" "${TEST_HMI_INTERFACES}" AUTO_FUNC_IDS)
-endif()
+GenerateInterfaceLibrary("test_hmi_interface.xml" "${TEST_HMI_INTERFACES}" AUTO_FUNC_IDS)
include_directories (
${CMAKE_SOURCE_DIR}/src/components/rpc_base/include
@@ -70,16 +62,5 @@ set (SOURCES
generated_interface_json_tests.cc
)
-if (${HMI_DBUS_API})
- # Build dbus tests
- include_directories(
- ${CMAKE_SOURCE_DIR}/src/components/dbus/include
- ${DBUS_INCLUDE_DIRS}
- )
- set (LIBRARIES ${LIBRARIES} DBus)
- set (SOURCES ${SOURCES} generated_interface_dbus_tests.cc)
-endif ()
-
-
create_test(test_generated_interface "${SOURCES}" "${LIBRARIES}")
endif()
diff --git a/tools/intergen/test/generated_interface_dbus_tests.cc b/tools/intergen/test/generated_interface_dbus_tests.cc
deleted file mode 100644
index a510ccd77a..0000000000
--- a/tools/intergen/test/generated_interface_dbus_tests.cc
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "gmock/gmock.h"
-
-#include <test_rpc_interface/interface.h>
-#include <test_rpc_interface/functions.h>
-
-#include "dbus/dbus_message.h"
-
-namespace test {
-using namespace rpc::test_rpc_interface;
-
-TEST(GeneratedInterfaceDbusTests, TestFailedDbusDeserialization) {
- dbus::MessageRef msg(dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL));
- {
- dbus::MessageWriter writer(msg);
- }
- {
- dbus::MessageReader reader(msg);
- request::DiagnosticMessage dm(&reader);
- ASSERT_TRUE(reader.has_failed());
- ASSERT_TRUE(dm.is_initialized());
- ASSERT_FALSE(dm.is_valid());
- }
-}
-
-TEST(GeneratedInterfaceDbusTests, TestDbusDeserialization) {
- dbus::MessageRef msg(dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL));
- {
- dbus::MessageWriter writer(msg);
- writer.PutUint16(22);
- writer.PutUint16(42);
- dbus::MessageWriter array_writer(&writer, dbus::kArray, DBUS_TYPE_BYTE_AS_STRING);
- array_writer.PutByte(11);
- }
- {
- dbus::MessageReader reader(msg);
- request::DiagnosticMessage dm(&reader);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- ASSERT_TRUE(dm.is_initialized());
- ASSERT_TRUE(dm.is_valid());
- ASSERT_EQ(dm.targetID, 22);
- ASSERT_EQ(dm.messageLength, 42);
- ASSERT_EQ(dm.messageData.size(), 1u);
- }
-}
-
-TEST(GeneratedInterfaceDbusTests, TestDbusSerializationDeserialization) {
- dbus::MessageRef msg(dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL));
- {
- dbus::MessageWriter writer(msg);
- request::DiagnosticMessage dm;
- dm.targetID = 70;
- dm.messageLength = 1;
- dm.messageData.push_back(42);
- dm.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msg);
- request::DiagnosticMessage dm(&reader);
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- ASSERT_TRUE(dm.is_initialized());
- ASSERT_TRUE(dm.is_valid());
- ASSERT_EQ(dm.targetID, 70);
- ASSERT_EQ(dm.messageLength, 1);
- ASSERT_EQ(dm.messageData.size(), 1u);
- ASSERT_EQ(dm.messageData[0], 42u);
- }
-}
-
-TEST(GeneratedInterfaceDbusTests, TestDbusAddSubMenuSerializatioDeserialization) {
- dbus::MessageRef msg(dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_CALL));
- {
- dbus::MessageWriter writer(msg);
- notification::DummyNotification dn;
- TdStruct tds;
- tds.resArrMap["Hello"].push_back(R_SUCCESS);
- (*tds.optionalResArrMap)["World"].push_back(R_INVALID_DATA);
- dn.tds.push_back(tds);
- ASSERT_TRUE(dn.is_valid());
- dn.ToDbusWriter(&writer);
- }
- {
- dbus::MessageReader reader(msg);
- notification::DummyNotification dn(&reader);
- ASSERT_TRUE(dn.is_initialized());
- ASSERT_TRUE(dn.is_valid());
- ASSERT_FALSE(reader.has_failed());
- ASSERT_FALSE(reader.HasNext());
- ASSERT_EQ(dn.tds[0].resArrMap["Hello"][0], R_SUCCESS);
- ASSERT_EQ((*dn.tds[0].optionalResArrMap)["World"][0], R_INVALID_DATA);
- }
-}
-
-} // namespace test
diff --git a/tools/intergen/test/generated_interface_json_tests.cc b/tools/intergen/test/generated_interface_json_tests.cc
index ee1db2167b..7601441707 100644
--- a/tools/intergen/test/generated_interface_json_tests.cc
+++ b/tools/intergen/test/generated_interface_json_tests.cc
@@ -35,7 +35,7 @@
#include <test_rpc_interface/interface.h>
#include <test_rpc_interface/functions.h>
-#include "json/reader.h"
+#include "utils/jsoncpp_reader_wrapper.h"
#include "json/writer.h"
#include "rpc_base/gtest_support.h"
@@ -52,23 +52,30 @@ public:
class GeneratedInterfaceTests: public ::testing::Test {
public:
+ GeneratedInterfaceTests(){
+ reader_ = std::unique_ptr<Json::CharReader>(reader_builder_.newCharReader());
+ writer_builder_.settings_["indentation"] = "";
+ }
+
Json::Value JsonValue(const char* json) {
+ utils::JsonReader reader_;
Json::Value value;
- reader.parse(json, value);
+ reader_.parse(json, &value);
return value;
}
- Json::Reader reader;
- Json::FastWriter writer;
+
+ std::unique_ptr<Json::CharReader> reader_;
+ Json::CharReaderBuilder reader_builder_;
+ Json::StreamWriterBuilder writer_builder_;
};
TEST_F(GeneratedInterfaceTests, ScrollableMessageTest) {
- const char* org_json = "{\"reason\":\"MASTER_RESET\"}\n";
+ const char* org_json = "{\"reason\":\"MASTER_RESET\"}";
Value json_value = JsonValue(org_json);
notification::OnAppInterfaceUnregistered oaiu(&json_value);
ASSERT_TRUE(oaiu.is_initialized());
ASSERT_RPCTYPE_VALID(oaiu);
-
- std::string serialized = writer.write(oaiu.ToJsonValue());
+ const std::string serialized = Json::writeString(writer_builder_, oaiu.ToJsonValue());
ASSERT_EQ(org_json, serialized);
}
@@ -79,26 +86,26 @@ TEST_F(GeneratedInterfaceTests, FunctionWithoutParams) {
oapt.mark_initialized();
ASSERT_TRUE(oapt.is_initialized());
ASSERT_RPCTYPE_VALID(oapt);
- std::string serialized = writer.write(oapt.ToJsonValue());
- ASSERT_EQ("{}\n", serialized);
+ const std::string serialized = Json::writeString(writer_builder_, oapt.ToJsonValue());
+ ASSERT_EQ("{}", serialized);
}
TEST_F(GeneratedInterfaceTests, DefValueTest) {
const char* org_json = "{\"menuID\":2,\"menuName\":\"Hello\"}";
- const char* awaited_json = "{\"menuID\":2,\"menuName\":\"Hello\",\"position\":1000}\n";
+ const char* awaited_json = "{\"menuID\":2,\"menuName\":\"Hello\",\"position\":1000}";
Value json_value = JsonValue(org_json);
request::AddSubMenu aasm(&json_value);
ASSERT_TRUE(aasm.is_initialized());
ASSERT_RPCTYPE_VALID(aasm);
ASSERT_EQ(aasm.position, 1000);
- std::string serialized = writer.write(aasm.ToJsonValue());
+ const std::string serialized = Json::writeString(writer_builder_, aasm.ToJsonValue());
ASSERT_EQ(awaited_json, serialized);
}
TEST_F(GeneratedInterfaceTests, MapTest) {
const char* expected_json =
- "{\"choiceID\":1,\"menuName\":\"Menu name\",\"vrCommands\":{\"one\":\"First value\",\"two\":\"Second value\"}}\n";
+ "{\"choiceID\":1,\"menuName\":\"Menu name\",\"vrCommands\":{\"one\":\"First value\",\"two\":\"Second value\"}}";
Choice choice;
ASSERT_FALSE(choice.is_initialized());
@@ -110,20 +117,20 @@ TEST_F(GeneratedInterfaceTests, MapTest) {
ASSERT_TRUE(choice.is_initialized());
ASSERT_RPCTYPE_VALID(choice);
- std::string serialized = writer.write(choice.ToJsonValue());
+ const std::string serialized = Json::writeString(writer_builder_, choice.ToJsonValue());
ASSERT_EQ(expected_json, serialized);
}
TEST_F(GeneratedInterfaceTests, TypedefTest) {
const char* expected_json =
- "{\"optionalResArrMap\":{\"World\":[\"INVALID_DATA\"]},\"resArrMap\":{\"Hello\":[\"SUCCESS\"]}}\n";
+ "{\"optionalResArrMap\":{\"World\":[\"INVALID_DATA\"]},\"resArrMap\":{\"Hello\":[\"SUCCESS\"]}}";
TdStruct ts;
ts.resArrMap["Hello"].push_back(R_SUCCESS);
(*ts.optionalResArrMap)["World"].push_back(R_INVALID_DATA);
ASSERT_TRUE(ts.is_initialized());
ASSERT_RPCTYPE_VALID(ts);
- std::string serialized = writer.write(ts.ToJsonValue());
+ const std::string serialized = Json::writeString(writer_builder_, ts.ToJsonValue());
ASSERT_EQ(expected_json, serialized);
}
@@ -182,26 +189,26 @@ TEST_F(GeneratedInterfaceTests, TestNullableStructMember) {
TEST_F(GeneratedInterfaceTests, TestNullableStructMemberNullInitializationFromJson) {
const char* input_json =
- "{\"nullableInt\":null}\n";
+ "{\"nullableInt\":null}";
Value json_value = JsonValue(input_json);
TestStructWithNullableParam with_nullable(&json_value);
ASSERT_TRUE(with_nullable.is_initialized());
ASSERT_RPCTYPE_VALID(with_nullable);
ASSERT_TRUE(with_nullable.nullableInt.is_null());
- std::string result = writer.write(with_nullable.ToJsonValue());
+ const std::string result = Json::writeString(writer_builder_, with_nullable.ToJsonValue());
ASSERT_EQ(input_json, result);
}
TEST_F(GeneratedInterfaceTests, TestNullableStructMemberInitializationFromJson) {
const char* input_json =
- "{\"nullableInt\":3}\n";
+ "{\"nullableInt\":3}";
Value json_value = JsonValue(input_json);
TestStructWithNullableParam with_nullable(&json_value);
ASSERT_TRUE(with_nullable.is_initialized());
ASSERT_RPCTYPE_VALID(with_nullable);
ASSERT_FALSE(with_nullable.nullableInt.is_null());
ASSERT_EQ(3, with_nullable.nullableInt);
- std::string result = writer.write(with_nullable.ToJsonValue());
+ const std::string result = Json::writeString(writer_builder_, with_nullable.ToJsonValue());
ASSERT_EQ(input_json, result);
}
@@ -211,15 +218,15 @@ TEST_F(GeneratedInterfaceTests, TestNullableEnumInitialization) {
strct_with_nullable.nonNullableEnum = IT_STATIC;
ASSERT_TRUE(strct_with_nullable.is_initialized());
ASSERT_RPCTYPE_VALID(strct_with_nullable);
- std::string result = writer.write(strct_with_nullable.ToJsonValue());
- const char* awaited_json1 = "{\"nonNullableEnum\":\"STATIC\",\"nullableEnum\":\"DYNAMIC\"}\n";
+ std::string result = Json::writeString(writer_builder_, strct_with_nullable.ToJsonValue());
+ const char* awaited_json1 = "{\"nonNullableEnum\":\"STATIC\",\"nullableEnum\":\"DYNAMIC\"}";
ASSERT_EQ(awaited_json1, result);
strct_with_nullable.nullableEnum.set_to_null();
ASSERT_TRUE(strct_with_nullable.is_initialized());
ASSERT_RPCTYPE_VALID(strct_with_nullable);
- result = writer.write(strct_with_nullable.ToJsonValue());
- const char* awaited_json2 = "{\"nonNullableEnum\":\"STATIC\",\"nullableEnum\":null}\n";
+ result = Json::writeString(writer_builder_, strct_with_nullable.ToJsonValue());
+ const char* awaited_json2 = "{\"nonNullableEnum\":\"STATIC\",\"nullableEnum\":null}";
ASSERT_EQ(awaited_json2, result);
}
@@ -233,8 +240,8 @@ TEST_F(GeneratedInterfaceTests, TestStructWithNullableTypedef) {
ASSERT_EQ(R_SUCCESS, swntd.nullableTdResult);
swntd.nullableTdResult.set_to_null();
- const char* awaited_json = "{\"nullableTdResult\":null}\n";
- std::string result = writer.write(swntd.ToJsonValue());
+ const char* awaited_json = "{\"nullableTdResult\":null}";
+ const std::string result = Json::writeString(writer_builder_, swntd.ToJsonValue());
ASSERT_EQ(awaited_json, result);
}
@@ -247,8 +254,8 @@ TEST_F(GeneratedInterfaceTests, TestNullingStructWithNullableMapOfNullableInts)
ASSERT_TRUE(nmoni.is_initialized());
ASSERT_RPCTYPE_VALID(nmoni);
ASSERT_TRUE(nmoni.nullableMap.is_null());
- const char* awaited_json = "{\"nullableMap\":null}\n";
- std::string result = writer.write(nmoni.ToJsonValue());
+ const char* awaited_json = "{\"nullableMap\":null}";
+ const std::string result = Json::writeString(writer_builder_, nmoni.ToJsonValue());
ASSERT_EQ(awaited_json, result);
}
@@ -263,8 +270,8 @@ TEST_F(GeneratedInterfaceTests, TestNullingValueInStructWithNullableMapOfNullabl
ASSERT_RPCTYPE_VALID(nmoni);
ASSERT_FALSE(nmoni.nullableMap.is_null());
ASSERT_TRUE(nmoni.nullableMap["Hello"].is_null());
- const char* awaited_json = "{\"nullableMap\":{\"Hello\":null}}\n";
- std::string result = writer.write(nmoni.ToJsonValue());
+ const char* awaited_json = "{\"nullableMap\":{\"Hello\":null}}";
+ const std::string result = Json::writeString(writer_builder_, nmoni.ToJsonValue());
ASSERT_EQ(awaited_json, result);
}
@@ -303,8 +310,8 @@ TEST_F(GeneratedInterfaceTests, EmptyStructJsonTests) {
e.mark_initialized();
ASSERT_RPCTYPE_VALID(e);
ASSERT_TRUE(e.is_initialized());
- const char* expected_json = "{}\n";
- ASSERT_EQ(expected_json, writer.write(e.ToJsonValue()));
+ const char* expected_json = "{}";
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, e.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithOptionalEmptyStructFieldJsonTest) {
@@ -314,8 +321,8 @@ TEST_F(GeneratedInterfaceTests, StructWithOptionalEmptyStructFieldJsonTest) {
oe.mark_initialized();
ASSERT_RPCTYPE_VALID(oe);
ASSERT_TRUE(oe.is_initialized());
- const char* expected_json = "{}\n";
- ASSERT_EQ(expected_json, writer.write(oe.ToJsonValue()));
+ const char* expected_json = "{}";
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, oe.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithMandatoryEmptyStructFieldJsonTest) {
@@ -325,8 +332,8 @@ TEST_F(GeneratedInterfaceTests, StructWithMandatoryEmptyStructFieldJsonTest) {
me.emptyOne.mark_initialized();
ASSERT_RPCTYPE_VALID(me);
ASSERT_TRUE(me.is_initialized());
- const char* expected_json = "{\"emptyOne\":{}}\n";
- ASSERT_EQ(expected_json, writer.write(me.ToJsonValue()));
+ const char* expected_json = "{\"emptyOne\":{}}";
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, me.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithOneOptionalIntFieldTest) {
@@ -350,18 +357,18 @@ TEST_F(GeneratedInterfaceTests, StructWithOneOptionalIntFieldJsonTest) {
ASSERT_FALSE(soo.is_valid());
ASSERT_FALSE(soo.is_initialized());
soo.mark_initialized();
- const char* expected_json = "{}\n";
- ASSERT_EQ(expected_json, writer.write(soo.ToJsonValue()));
+ const char* expected_json = "{}";
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, soo.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithOneInitializedOptionalIntFieldJsonTest) {
- const char* input_json = "{\"optionalInt\":11}\n";
+ const char* input_json = "{\"optionalInt\":11}";
Json::Value json_value = JsonValue(input_json);
StructWithOneOptionalIntField soo(&json_value);
ASSERT_RPCTYPE_VALID(soo);
ASSERT_TRUE(soo.is_initialized());
ASSERT_EQ(11, *soo.optionalInt);
- ASSERT_EQ(input_json, writer.write(soo.ToJsonValue()));
+ ASSERT_EQ(input_json, Json::writeString(writer_builder_, soo.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithFieldOfStructThatMightBeEmptyTest) {
@@ -384,18 +391,18 @@ TEST_F(GeneratedInterfaceTests, StructWithFieldOfStructThatMightBeEmptyJsonNoVal
ASSERT_FALSE(sfme.struct_empty());
ASSERT_RPCTYPE_VALID(sfme);
ASSERT_TRUE(sfme.is_initialized());
- const char* expcected_json = "{\"fieldThatMightBeEmpty\":{}}\n";
- ASSERT_EQ(expcected_json, writer.write(sfme.ToJsonValue()));
+ const char* expcected_json = "{\"fieldThatMightBeEmpty\":{}}";
+ ASSERT_EQ(expcected_json, Json::writeString(writer_builder_, sfme.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithFieldOfStructThatMightBeEmptyJsonHasValueTest) {
- const char* input_json = "{\"fieldThatMightBeEmpty\":{\"optionalInt\":12}}\n";
+ const char* input_json = "{\"fieldThatMightBeEmpty\":{\"optionalInt\":12}}";
Json::Value json_value = JsonValue(input_json);
StructWithFieldOfStructThatMightBeEmpty sfme(&json_value);
ASSERT_RPCTYPE_VALID(sfme);
ASSERT_TRUE(sfme.is_initialized());
ASSERT_EQ(12, *sfme.fieldThatMightBeEmpty.optionalInt);
- ASSERT_EQ(input_json, writer.write(sfme.ToJsonValue()));
+ ASSERT_EQ(input_json, Json::writeString(writer_builder_, sfme.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithFieldOfOptionalMapTest) {
@@ -418,8 +425,8 @@ TEST_F(GeneratedInterfaceTests, StructWithFieldOfOptionalMapToJsonTest) {
ASSERT_TRUE(snom.struct_empty());
ASSERT_RPCTYPE_VALID(snom);
ASSERT_TRUE(snom.is_initialized());
- const char* expected_json = "{}\n";
- ASSERT_EQ(expected_json, writer.write(snom.ToJsonValue()));
+ const char* expected_json = "{}";
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, snom.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithFieldOfOptionalMapNulledToJsonTest) {
@@ -431,64 +438,64 @@ TEST_F(GeneratedInterfaceTests, StructWithFieldOfOptionalMapNulledToJsonTest) {
ASSERT_FALSE(snom.struct_empty());
ASSERT_RPCTYPE_VALID(snom);
ASSERT_TRUE(snom.is_initialized());
- const char* expected_json = "{\"nullableOptionalIntMap\":null}\n";
- ASSERT_EQ(expected_json, writer.write(snom.ToJsonValue()));
+ const char* expected_json = "{\"nullableOptionalIntMap\":null}";
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, snom.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithFieldOfOptionalMapNulledInJsonTest) {
- const char* input_json = "{\"nullableOptionalIntMap\":null}\n";
+ const char* input_json = "{\"nullableOptionalIntMap\":null}";
Json::Value json_value = JsonValue(input_json);
StructWithNullableOptionalMap snom(&json_value);
ASSERT_RPCTYPE_VALID(snom);
ASSERT_TRUE(snom.is_initialized());
ASSERT_TRUE(snom.nullableOptionalIntMap->is_null());
- ASSERT_EQ(input_json, writer.write(snom.ToJsonValue()));
+ ASSERT_EQ(input_json, Json::writeString(writer_builder_, snom.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithFieldOfOptionalMapInitializedInJsonTest) {
- const char* input_json = "{\"nullableOptionalIntMap\":{\"Hello\":2}}\n";
+ const char* input_json = "{\"nullableOptionalIntMap\":{\"Hello\":2}}";
Json::Value json_value = JsonValue(input_json);
StructWithNullableOptionalMap snom(&json_value);
ASSERT_RPCTYPE_VALID(snom);
ASSERT_TRUE(snom.is_initialized());
ASSERT_FALSE(snom.nullableOptionalIntMap->is_null());
- ASSERT_EQ(input_json, writer.write(snom.ToJsonValue()));
+ ASSERT_EQ(input_json, Json::writeString(writer_builder_, snom.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithOptionalArrayTest) {
- const char* expected_json = "{}\n";
+ const char* expected_json = "{}";
StructWithOptionalIntArray soia;
ASSERT_TRUE(soia.struct_empty());
ASSERT_FALSE(soia.is_valid());
ASSERT_FALSE(soia.is_initialized());
soia.mark_initialized();
- ASSERT_EQ(expected_json, writer.write(soia.ToJsonValue()));
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, soia.ToJsonValue()));
(*soia.optionalIntArray).push_back(2);
ASSERT_RPCTYPE_VALID(soia);
ASSERT_TRUE(soia.is_initialized());
- const char* expected_json2 = "{\"optionalIntArray\":[2]}\n";
- ASSERT_EQ(expected_json2, writer.write(soia.ToJsonValue()));
+ const char* expected_json2 = "{\"optionalIntArray\":[2]}";
+ ASSERT_EQ(expected_json2, Json::writeString(writer_builder_, soia.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithMandatoryArrayTest) {
- const char* expected_json = "{\"mandatoryIntArray\":[]}\n";
+ const char* expected_json = "{\"mandatoryIntArray\":[]}";
StructWithMandatoryIntArray smia;
ASSERT_FALSE(smia.is_valid());
ASSERT_FALSE(smia.is_initialized());
smia.mandatoryIntArray.mark_initialized();
ASSERT_RPCTYPE_VALID(smia);
ASSERT_TRUE(smia.is_initialized());
- ASSERT_EQ(expected_json, writer.write(smia.ToJsonValue()));
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, smia.ToJsonValue()));
smia.mandatoryIntArray.push_back(3);
ASSERT_RPCTYPE_VALID(smia);
ASSERT_TRUE(smia.is_initialized());
- const char* expected_json2 = "{\"mandatoryIntArray\":[3]}\n";
- ASSERT_EQ(expected_json2, writer.write(smia.ToJsonValue()));
+ const char* expected_json2 = "{\"mandatoryIntArray\":[3]}";
+ ASSERT_EQ(expected_json2, Json::writeString(writer_builder_, smia.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithOptionalMapTest) {
- const char* expected_json = "{}\n";
+ const char* expected_json = "{}";
StructWithOptionalIntMap soim;
ASSERT_TRUE(soim.struct_empty());
ASSERT_FALSE(soim.is_valid());
@@ -497,32 +504,32 @@ TEST_F(GeneratedInterfaceTests, StructWithOptionalMapTest) {
ASSERT_TRUE(soim.struct_empty());
ASSERT_RPCTYPE_VALID(soim);
ASSERT_TRUE(soim.is_initialized());
- ASSERT_EQ(expected_json, writer.write(soim.ToJsonValue()));
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, soim.ToJsonValue()));
(*soim.optionalIntMap)["Yay"] = 2;
ASSERT_RPCTYPE_VALID(soim);
ASSERT_TRUE(soim.is_initialized());
- const char* expected_json2 = "{\"optionalIntMap\":{\"Yay\":2}}\n";
- ASSERT_EQ(expected_json2, writer.write(soim.ToJsonValue()));
+ const char* expected_json2 = "{\"optionalIntMap\":{\"Yay\":2}}";
+ ASSERT_EQ(expected_json2, Json::writeString(writer_builder_, soim.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithMandatoryMapTest) {
- const char* expected_json = "{\"mandatoryIntMap\":{}}\n";
+ const char* expected_json = "{\"mandatoryIntMap\":{}}";
StructWithMandatoryIntMap smim;
ASSERT_FALSE(smim.is_valid());
ASSERT_FALSE(smim.is_initialized());
smim.mandatoryIntMap.mark_initialized();
ASSERT_RPCTYPE_VALID(smim);
ASSERT_TRUE(smim.is_initialized());
- ASSERT_EQ(expected_json, writer.write(smim.ToJsonValue()));
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, smim.ToJsonValue()));
smim.mandatoryIntMap["Yay"] = 2;
ASSERT_RPCTYPE_VALID(smim);
ASSERT_TRUE(smim.is_initialized());
- const char* expected_json2 = "{\"mandatoryIntMap\":{\"Yay\":2}}\n";
- ASSERT_EQ(expected_json2, writer.write(smim.ToJsonValue()));
+ const char* expected_json2 = "{\"mandatoryIntMap\":{\"Yay\":2}}";
+ ASSERT_EQ(expected_json2, Json::writeString(writer_builder_, smim.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, StructWithMandatoryMapInitFromWrongJsonTest) {
- const char* empty_json = "{}\n";
+ const char* empty_json = "{}";
Json::Value json_value = JsonValue(empty_json);
StructWithMandatoryIntMap smim(&json_value);
@@ -535,8 +542,8 @@ TEST_F(GeneratedInterfaceTests, StructWithMandatoryMapInitFromWrongJsonTest) {
ASSERT_FALSE(smim.struct_empty());
ASSERT_RPCTYPE_VALID(smim);
ASSERT_TRUE(smim.is_initialized());
- const char* expected_json = "{\"mandatoryIntMap\":{\"Yay\":2}}\n";
- ASSERT_EQ(expected_json, writer.write(smim.ToJsonValue()));
+ const char* expected_json = "{\"mandatoryIntMap\":{\"Yay\":2}}";
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, smim.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, ReportIncorrectlyInitializedMap1) {
@@ -584,7 +591,7 @@ TEST_F(GeneratedInterfaceTests, TestFrankenstructCreation) {
}
TEST_F(GeneratedInterfaceTests, FrankenstructToJson) {
- const char* expected_json = "{\"hello\":\"str\",\"mandatoryInt\":2}\n";
+ const char* expected_json = "{\"hello\":\"str\",\"mandatoryInt\":2}";
FrankenstructOfEmptyStringWithMandatoryInt fbmi;
fbmi.mandatoryInt = 2;
fbmi["hello"] = "str";
@@ -592,12 +599,11 @@ TEST_F(GeneratedInterfaceTests, FrankenstructToJson) {
ASSERT_RPCTYPE_VALID(fbmi);
ASSERT_FALSE(fbmi.empty());
ASSERT_FALSE(fbmi.struct_empty());
- ASSERT_EQ(expected_json,
- writer.write(fbmi.ToJsonValue()));
+ ASSERT_EQ(expected_json, Json::writeString(writer_builder_, fbmi.ToJsonValue()));
}
TEST_F(GeneratedInterfaceTests, FrankenstructFromJson) {
- const char* input_json = "{\"hello\":\"str\",\"mandatoryInt\":2}\n";
+ const char* input_json = "{\"hello\":\"str\",\"mandatoryInt\":2}";
Json::Value json_value = JsonValue(input_json);
FrankenstructOfEmptyStringWithMandatoryInt fbmi(&json_value);
ASSERT_TRUE(fbmi.is_initialized());
@@ -610,7 +616,7 @@ TEST_F(GeneratedInterfaceTests, FrankenstructFromJson) {
}
TEST_F(GeneratedInterfaceTests, FrankenstructFromInvalidJson) {
- const char* input_json = "{\"hello\":true,\"mandatoryInt\":2}\n";
+ const char* input_json = "{\"hello\":true,\"mandatoryInt\":2}";
Json::Value json_value = JsonValue(input_json);
FrankenstructOfEmptyStringWithMandatoryInt fbmi(&json_value);
ASSERT_TRUE(fbmi.is_initialized());
diff --git a/tools/intergen/test/test_hmi_interface.xml b/tools/intergen/test/test_hmi_interface.xml
index 16f2892327..7573d35ef9 100644
--- a/tools/intergen/test/test_hmi_interface.xml
+++ b/tools/intergen/test/test_hmi_interface.xml
@@ -66,6 +66,7 @@
<enum name="ButtonName">
<description>Defines the hard (physical) and soft (touchscreen) buttons available from SYNC</description>
<element name="OK"/>
+ <element name="PLAY_PAUSE"/>
<element name="SEEKLEFT"/>
<element name="SEEKRIGHT"/>
<element name="TUNEUP"/>
@@ -2777,938 +2778,573 @@
</description>
</param>
</function>
-
-<!--Qt HMI version of GetVehicleData-->
- <function name="GetGpsData" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetGpsData" messagetype="response">
- <param name="gps" type="Common.GPSData" mandatory="true">
+ <function name="SubscribeVehicleData" messagetype="request">
+ <description>
+ Subscribes for specific published data items.
+ The data will be only sent if it has changed.
+ The application will be notified by the onVehicleData notification whenever new data is available.
+ To unsubscribe the notifications, use unsubscribe with the same subscriptionType.
+ </description>
+ <param name="gps" type="Boolean" mandatory="false">
<description>See GPSData</description>
</param>
- </function>
-
- <function name="GetSpeed" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetSpeed" messagetype="response">
- <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="true">
+ <param name="speed" type="Boolean" mandatory="false">
<description>The vehicle speed in kilometers per hour</description>
</param>
- </function>
-
- <function name="GetRpm" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetRpm" messagetype="response">
- <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="true">
+ <param name="rpm" type="Boolean" mandatory="false">
<description>The number of revolutions per minute of the engine</description>
</param>
- </function>
-
- <function name="GetFuelLevel" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetFuelLevel" messagetype="response">
- <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="true">
+ <param name="fuelLevel" type="Boolean" mandatory="false">
<description>The fuel level in the tank (percentage)</description>
</param>
- </function>
-
- <function name="GetFuelLevelState" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetFuelLevelState" messagetype="response">
- <param name="fuelLevel_State" type="Common.ComponentVolumeStatus" mandatory="true">
+ <param name="fuelLevel_State" type="Boolean" mandatory="false">
<description>The fuel level state</description>
</param>
- </function>
-
- <function name="GetInstantFuelConsumption" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetInstantFuelConsumption" messagetype="response">
- <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="true">
+ <param name="instantFuelConsumption" type="Boolean" mandatory="false">
<description>The instantaneous fuel consumption in microlitres</description>
</param>
- </function>
-
- <function name="GetExternalTemperature" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetExternalTemperature" messagetype="response">
- <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="true">
+ <param name="externalTemperature" type="Boolean" mandatory="false">
<description>The external temperature in degrees celsius</description>
</param>
- </function>
-
- <function name="GetVin" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetVin" messagetype="response">
- <param name="vin" type="String" maxlength="17" mandatory="true">
- <description>Vehicle identification number</description>
- </param>
- </function>
-
- <function name="GetPrndl" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetPrndl" messagetype="response">
- <param name="prndl" type="Common.PRNDL" mandatory="true">
+ <param name="prndl" type="Boolean" mandatory="false">
<description>See PRNDL</description>
</param>
- </function>
-
- <function name="GetTirePressure" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetTirePressure" messagetype="response">
- <param name="tirePressure" type="Common.TireStatus" mandatory="true">
+ <param name="tirePressure" type="Boolean" mandatory="false">
<description>See TireStatus</description>
</param>
- </function>
-
- <function name="GetOdometer" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetOdometer" messagetype="response">
- <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="true">
+ <param name="odometer" type="Boolean" mandatory="false">
<description>Odometer in km</description>
</param>
- </function>
-
- <function name="GetBeltStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetBeltStatus" messagetype="response">
- <param name="beltStatus" type="Common.BeltStatus" mandatory="true">
+ <param name="beltStatus" type="Boolean" mandatory="false">
<description>The status of the seat belts</description>
</param>
- </function>
-
- <function name="GetBodyInformation" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetBodyInformation" messagetype="response">
- <param name="bodyInformation" type="Common.BodyInformation" mandatory="true">
+ <param name="bodyInformation" type="Boolean" mandatory="false">
<description>The body information including power modes</description>
</param>
- </function>
-
- <function name="GetDeviceStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetDeviceStatus" messagetype="response">
- <param name="deviceStatus" type="Common.DeviceStatus" mandatory="true">
+ <param name="deviceStatus" type="Boolean" mandatory="false">
<description>The device status including signal and battery strength</description>
</param>
- </function>
-
- <function name="GetDriverBraking" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetDriverBraking" messagetype="response">
- <param name="driverBraking" type="Common.VehicleDataEventStatus" mandatory="true">
+ <param name="driverBraking" type="Boolean" mandatory="false">
<description>The status of the brake pedal</description>
</param>
- </function>
-
- <function name="GetWiperStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetWiperStatus" messagetype="response">
- <param name="wiperStatus" type="Common.WiperStatus" mandatory="true">
+ <param name="wiperStatus" type="Boolean" mandatory="false">
<description>The status of the wipers</description>
</param>
- </function>
-
- <function name="GetHeadLampStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetHeadLampStatus" messagetype="response">
- <param name="headLampStatus" type="Common.HeadLampStatus" mandatory="true">
+ <param name="headLampStatus" type="Boolean" mandatory="false">
<description>Status of the head lamps</description>
</param>
- </function>
-
- <function name="GetEngineTorque" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetEngineTorque" messagetype="response">
- <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="true">
+ <param name="engineTorque" type="Boolean" mandatory="false">
<description>Torque value for engine (in Nm) on non-diesel variants</description>
</param>
- </function>
-
- <function name="GetAccPedalPosition" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetAccPedalPosition" messagetype="response">
- <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="true">
+ <param name="accPedalPosition" type="Boolean" mandatory="false">
<description>Accelerator pedal position (percentage depressed)</description>
</param>
- </function>
-
- <function name="GetSteeringWheelAngle" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetSteeringWheelAngle" messagetype="response">
- <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="true">
+ <param name="steeringWheelAngle" type="Boolean" mandatory="false">
<description>Current angle of the steering wheel (in deg)</description>
</param>
- </function>
-
- <function name="GetECallInfo" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="engineOilLife" type="Boolean" mandatory="false">
+ <description>The estimated percentage of remaining oil life of the engine.</description>
</param>
- </function>
- <function name="GetECallInfo" messagetype="response">
- <param name="eCallInfo" type="Common.ECallInfo" mandatory="true">
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="Boolean" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
- </function>
-
- <function name="GetAirbagStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetAirbagStatus" messagetype="response">
- <param name="airbagStatus" type="Common.AirbagStatus" mandatory="true">
+ <param name="airbagStatus" type="Boolean" mandatory="false">
<description>The status of the air bags</description>
</param>
- </function>
-
- <function name="GetEmergencyEvent" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetEmergencyEvent" messagetype="response">
- <param name="emergencyEvent" type="Common.EmergencyEvent" mandatory="true">
+ <param name="emergencyEvent" type="Boolean" mandatory="false">
<description>Information related to an emergency event (and if it occurred)</description>
</param>
- </function>
-
- <function name="GetClusterModeStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetClusterModeStatus" messagetype="response">
- <param name="clusterModeStatus" type="Common.ClusterModeStatus" mandatory="true">
+ <param name="clusterModeStatus" type="Boolean" mandatory="false">
<description>The status modes of the cluster</description>
</param>
- </function>
-
- <function name="GetMyKey" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
- </function>
- <function name="GetMyKey" messagetype="response">
- <param name="myKey" type="Common.MyKey" mandatory="true">
+ <param name="myKey" type="Boolean" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
+ <!-- / Ford Specific Data Items -->
</function>
-<!--end Qt HMI version of GetVehicleData-->
-
-<!--Qt HMI version of OnVehicleData-->
- <function name="OnGpsData" messagetype="notification">
- <param name="gps" type="Common.GPSData" mandatory="true">
+ <function name="SubscribeVehicleData" messagetype="response">
+ <param name="gps" type="Common.VehicleDataResult" mandatory="false">
<description>See GPSData</description>
</param>
- </function>
-
- <function name="OnSpeed" messagetype="notification">
- <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="true">
+ <param name="speed" type="Common.VehicleDataResult" mandatory="false">
<description>The vehicle speed in kilometers per hour</description>
</param>
- </function>
-
- <function name="OnRpm" messagetype="notification">
- <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="true">
+ <param name="rpm" type="Common.VehicleDataResult" mandatory="false">
<description>The number of revolutions per minute of the engine</description>
</param>
- </function>
-
- <function name="OnFuelLevel" messagetype="notification">
- <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="true">
+ <param name="fuelLevel" type="Common.VehicleDataResult" mandatory="false">
<description>The fuel level in the tank (percentage)</description>
</param>
- </function>
-
- <function name="OnFuelLevelState" messagetype="notification">
- <param name="fuelLevel_State" type="Common.ComponentVolumeStatus" mandatory="true">
+ <param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="false">
<description>The fuel level state</description>
</param>
- </function>
-
- <function name="OnInstantFuelConsumption" messagetype="notification">
- <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="true">
+ <param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="false">
<description>The instantaneous fuel consumption in microlitres</description>
</param>
- </function>
-
- <function name="OnExternalTemperature" messagetype="notification">
- <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="true">
- <description>The external temperature in degrees celsius</description>
- </param>
- </function>
-
- <function name="OnVin" messagetype="notification">
- <param name="vin" type="String" maxlength="17" mandatory="true">
- <description>Vehicle identification number.</description>
+ <param name="externalTemperature" type="Common.VehicleDataResult" mandatory="false">
+ <description>The external temperature in degrees celsius.</description>
</param>
- </function>
-
- <function name="OnPrndl" messagetype="notification">
- <param name="prndl" type="Common.PRNDL" mandatory="true">
+ <param name="prndl" type="Common.VehicleDataResult" mandatory="false">
<description>See PRNDL</description>
</param>
- </function>
-
- <function name="OnTirePressure" messagetype="notification">
- <param name="tirePressure" type="Common.TireStatus" mandatory="true">
+ <param name="tirePressure" type="Common.VehicleDataResult" mandatory="false">
<description>See TireStatus</description>
</param>
- </function>
-
- <function name="OnOdometer" messagetype="notification">
- <param name="odometer" type="Integer" minvalue="0" maxvalue="2000000" mandatory="true">
+ <param name="odometer" type="Common.VehicleDataResult" mandatory="false">
<description>Odometer in km</description>
</param>
- </function>
-
- <function name="OnBeltStatus" messagetype="notification">
- <param name="beltStatus" type="Common.BeltStatus" mandatory="true">
+ <param name="beltStatus" type="Common.VehicleDataResult" mandatory="false">
<description>The status of the seat belts</description>
</param>
- </function>
-
- <function name="OnBodyInformation" messagetype="notification">
- <param name="bodyInformation" type="Common.BodyInformation" mandatory="true">
+ <param name="bodyInformation" type="Common.VehicleDataResult" mandatory="false">
<description>The body information including power modes</description>
</param>
- </function>
-
- <function name="OnDeviceStatus" messagetype="notification">
- <param name="deviceStatus" type="Common.DeviceStatus" mandatory="true">
+ <param name="deviceStatus" type="Common.VehicleDataResult" mandatory="false">
<description>The device status including signal and battery strength</description>
</param>
- </function>
-
- <function name="OnDriverBraking" messagetype="notification">
- <param name="driverBraking" type="Common.VehicleDataEventStatus" mandatory="true">
+ <param name="driverBraking" type="Common.VehicleDataResult" mandatory="false">
<description>The status of the brake pedal</description>
</param>
- </function>
-
- <function name="OnWiperStatus" messagetype="notification">
- <param name="wiperStatus" type="Common.WiperStatus" mandatory="true">
+ <param name="wiperStatus" type="Common.VehicleDataResult" mandatory="false">
<description>The status of the wipers</description>
</param>
- </function>
-
- <function name="OnHeadLampStatus" messagetype="notification">
- <param name="headLampStatus" type="Common.HeadLampStatus" mandatory="true">
+ <param name="headLampStatus" type="Common.VehicleDataResult" mandatory="false">
<description>Status of the head lamps</description>
</param>
- </function>
-
- <function name="OnEngineTorque" messagetype="notification">
- <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="true">
+ <param name="engineTorque" type="Common.VehicleDataResult" mandatory="false">
<description>Torque value for engine (in Nm) on non-diesel variants</description>
</param>
- </function>
-
- <function name="OnAccPedalPosition" messagetype="notification">
- <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="true">
+ <param name="accPedalPosition" type="Common.VehicleDataResult" mandatory="false">
<description>Accelerator pedal position (percentage depressed)</description>
</param>
- </function>
-
- <function name="OnSteeringWheelAngle" messagetype="notification">
- <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="true">
+ <param name="steeringWheelAngle" type="Common.VehicleDataResult" mandatory="false">
<description>Current angle of the steering wheel (in deg)</description>
</param>
- </function>
-
- <function name="OnMyKey" messagetype="notification">
- <param name="myKey" type="Common.MyKey" mandatory="true">
+ <param name="engineOilLife" type="Common.VehicleDataResult" mandatory="false">
+ <description>The estimated percentage of remaining oil life of the engine.</description>
+ </param>
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="Common.VehicleDataResult" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModes" type="Common.VehicleDataResult" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="Common.VehicleDataResult" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
+ <!-- / Ford Specific Data Items -->
</function>
-<!--end Qt HMI version of OnVehicleData-->
-
-<!--Qt HMI version of SubscribeVehicleData/UnsubscribeVehicleData-->
- <function name="SubscribeGps" messagetype="request">
+ <function name="UnsubscribeVehicleData" messagetype="request">
+ <description>
+ This function is used to unsubscribe the notifications from the subscribeVehicleData function.
+ </description>
<param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <description>ID of application that requested this RPC.</description>
</param>
- </function>
- <function name="SubscribeGps" messagetype="response">
- <param name="gps" type="Common.VehicleDataResult" mandatory="true">
+ <param name="gps" type="Boolean" mandatory="false">
<description>See GPSData</description>
</param>
- </function>
- <function name="UnsubscribeGps" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="speed" type="Boolean" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
</param>
- </function>
- <function name="UnsubscribeGps" messagetype="response">
- <param name="gps" type="Common.VehicleDataResult" mandatory="true">
- <description>See GPSData</description>
+ <param name="rpm" type="Boolean" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
</param>
- </function>
-
- <function name="SubscribeSpeed" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="fuelLevel" type="Boolean" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
</param>
- </function>
- <function name="SubscribeSpeed" messagetype="response">
- <param name="speed" type="Common.VehicleDataResult" mandatory="true">
- <description>The vehicle speed in kilometers per hour</description>
+ <param name="fuelLevel_State" type="Boolean" mandatory="false">
+ <description>The fuel level state</description>
</param>
- </function>
- <function name="UnsubscribeSpeed" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="instantFuelConsumption" type="Boolean" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
</param>
- </function>
- <function name="UnsubscribeSpeed" messagetype="response">
- <param name="speed" type="Common.VehicleDataResult" mandatory="true">
- <description>The vehicle speed in kilometers per hour</description>
+ <param name="externalTemperature" type="Boolean" mandatory="false">
+ <description>The external temperature in degrees celsius.</description>
</param>
- </function>
-
- <function name="SubscribeRpm" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="prndl" type="Boolean" mandatory="false">
+ <description>See PRNDL</description>
</param>
- </function>
- <function name="SubscribeRpm" messagetype="response">
- <param name="rpm" type="Common.VehicleDataResult" mandatory="true">
- <description>The number of revolutions per minute of the engine</description>
+ <param name="tirePressure" type="Boolean" mandatory="false">
+ <description>See TireStatus</description>
</param>
- </function>
- <function name="UnsubscribeRpm" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="odometer" type="Boolean" mandatory="false">
+ <description>Odometer in km</description>
</param>
- </function>
- <function name="UnsubscribeRpm" messagetype="response">
- <param name="rpm" type="Common.VehicleDataResult" mandatory="true">
- <description>The number of revolutions per minute of the engine</description>
+ <param name="beltStatus" type="Boolean" mandatory="false">
+ <description>The status of the seat belts</description>
</param>
- </function>
-
- <function name="SubscribeFuelLevel" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="bodyInformation" type="Boolean" mandatory="false">
+ <description>The body information including power modes</description>
</param>
- </function>
- <function name="SubscribeFuelLevel" messagetype="response">
- <param name="fuelLevel" type="Common.VehicleDataResult" mandatory="true">
- <description>The fuel level in the tank (percentage)</description>
+ <param name="deviceStatus" type="Boolean" mandatory="false">
+ <description>The device status including signal and battery strength</description>
</param>
- </function>
- <function name="UnsubscribeFuelLevel" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="driverBraking" type="Boolean" mandatory="false">
+ <description>The status of the brake pedal</description>
</param>
- </function>
- <function name="UnsubscribeFuelLevel" messagetype="response">
- <param name="fuelLevel" type="Common.VehicleDataResult" mandatory="true">
- <description>The fuel level in the tank (percentage)</description>
+ <param name="wiperStatus" type="Boolean" mandatory="false">
+ <description>The status of the wipers</description>
</param>
- </function>
-
- <function name="SubscribeFuelLevel_State" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="headLampStatus" type="Boolean" mandatory="false">
+ <description>Status of the head lamps</description>
</param>
- </function>
- <function name="SubscribeFuelLevel_State" messagetype="response">
- <param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="true">
- <description>The fuel level state</description>
+ <param name="engineTorque" type="Boolean" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
</param>
- </function>
- <function name="UnsubscribeFuelLevel_State" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="accPedalPosition" type="Boolean" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
</param>
- </function>
- <function name="UnsubscribeFuelLevel_State" messagetype="response">
- <param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="true">
- <description>The fuel level state</description>
+ <param name="steeringWheelAngle" type="Boolean" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
</param>
- </function>
-
- <function name="SubscribeInstantFuelConsumption" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="engineOilLife" type="Boolean" mandatory="false">
+ <description>The estimated percentage of remaining oil life of the engine.</description>
</param>
- </function>
- <function name="SubscribeInstantFuelConsumption" messagetype="response">
- <param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="true">
- <description>The instantaneous fuel consumption in microlitres</description>
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="Boolean" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
</param>
- </function>
- <function name="UnsubscribeInstantFuelConsumption" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="airbagStatus" type="Boolean" mandatory="false">
+ <description>The status of the air bags</description>
</param>
- </function>
- <function name="UnsubscribeInstantFuelConsumption" messagetype="response">
- <param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="true">
- <description>The instantaneous fuel consumption in microlitres</description>
+ <param name="emergencyEvent" type="Boolean" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
</param>
- </function>
-
- <function name="SubscribeExternalTemperature" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="clusterModeStatus" type="Boolean" mandatory="false">
+ <description>The status modes of the cluster</description>
</param>
- </function>
- <function name="SubscribeExternalTemperature" messagetype="response">
- <param name="externalTemperature" type="Common.VehicleDataResult" mandatory="true">
- <description>The external temperature in degrees celsius</description>
+ <param name="myKey" type="Boolean" mandatory="false">
+ <description>Information related to the MyKey feature</description>
</param>
+ <!-- / Ford Specific Data Items -->
</function>
- <function name="UnsubscribeExternalTemperature" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <function name="UnsubscribeVehicleData" messagetype="response">
+ <param name="gps" type="Common.VehicleDataResult" mandatory="false">
+ <description>See GPSData</description>
</param>
- </function>
- <function name="UnsubscribeExternalTemperature" messagetype="response">
- <param name="externalTemperature" type="Common.VehicleDataResult" mandatory="true">
- <description>The external temperature in degrees celsius</description>
+ <param name="speed" type="Common.VehicleDataResult" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
</param>
- </function>
-
- <function name="SubscribePrndl" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="rpm" type="Common.VehicleDataResult" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
</param>
- </function>
- <function name="SubscribePrndl" messagetype="response">
- <param name="prndl" type="Common.VehicleDataResult" mandatory="true">
- <description>See PRNDL</description>
+ <param name="fuelLevel" type="Common.VehicleDataResult" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
</param>
- </function>
- <function name="UnsubscribePrndl" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="false">
+ <description>The fuel level state</description>
</param>
- </function>
- <function name="UnsubscribePrndl" messagetype="response">
- <param name="prndl" type="Common.VehicleDataResult" mandatory="true">
+ <param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Common.VehicleDataResult" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="prndl" type="Common.VehicleDataResult" mandatory="false">
<description>See PRNDL</description>
</param>
- </function>
-
- <function name="SubscribeVin" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="tirePressure" type="Common.VehicleDataResult" mandatory="false">
+ <description>See TireStatus</description>
</param>
- </function>
- <function name="SubscribeVin" messagetype="response">
- <param name="vin" type="String" maxlength="17" mandatory="true">
- <description>Vehicle identification number</description>
+ <param name="odometer" type="Common.VehicleDataResult" mandatory="false">
+ <description>Odometer in km</description>
</param>
- </function>
- <function name="UnsubscribeVin" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="beltStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>The status of the seat belts</description>
</param>
- </function>
- <function name="UnsubscribeVin" messagetype="response">
- <param name="vin" type="String" maxlength="17" mandatory="true">
- <description>Vehicle identification number</description>
+ <param name="bodyInformation" type="Common.VehicleDataResult" mandatory="false">
+ <description>The body information including power modes</description>
</param>
- </function>
-
- <function name="SubscribeTirePressure" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="deviceStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>The device status including signal and battery strength</description>
</param>
- </function>
- <function name="SubscribeTirePressure" messagetype="response">
- <param name="tirePressure" type="Common.VehicleDataResult" mandatory="true">
- <description>See TireStatus</description>
+ <param name="driverBraking" type="Common.VehicleDataResult" mandatory="false">
+ <description>The status of the brake pedal</description>
</param>
- </function>
- <function name="UnsubscribeTirePressure" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="wiperStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>The status of the wipers</description>
</param>
- </function>
- <function name="UnsubscribeTirePressure" messagetype="response">
- <param name="tirePressure" type="Common.VehicleDataResult" mandatory="true">
- <description>See TireStatus</description>
+ <param name="headLampStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>Status of the head lamps</description>
</param>
- </function>
-
- <function name="SubscribeOdometer" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="engineTorque" type="Common.VehicleDataResult" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
</param>
- </function>
- <function name="SubscribeOdometer" messagetype="response">
- <param name="odometer" type="Common.VehicleDataResult" mandatory="true">
- <description>Odometer in km</description>
+ <param name="accPedalPosition" type="Common.VehicleDataResult" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
</param>
- </function>
- <function name="UnsubscribeOdometer" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="steeringWheelAngle" type="Common.VehicleDataResult" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
</param>
- </function>
- <function name="UnsubscribeOdometer" messagetype="response">
- <param name="odometer" type="Common.VehicleDataResult" mandatory="true">
- <description>Odometer in km</description>
+ <param name="engineOilLife" type="Common.VehicleDataResult" mandatory="false">
+ <description>The estimated percentage of remaining oil life of the engine.</description>
</param>
- </function>
-
- <function name="SubscribeBeltStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <!-- Ford Specific Data Items -->
+ <param name="eCallInfo" type="Common.VehicleDataResult" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
</param>
- </function>
- <function name="SubscribeBeltStatus" messagetype="response">
- <param name="beltStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the seat belts</description>
+ <param name="airbagStatus" type="Common.VehicleDataResult" mandatory="false">
+ <description>The status of the air bags</description>
</param>
- </function>
- <function name="UnsubscribeBeltStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="emergencyEvent" type="Common.VehicleDataResult" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
</param>
- </function>
- <function name="UnsubscribeBeltStatus" messagetype="response">
- <param name="beltStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the seat belts</description>
+ <param name="clusterModes" type="Common.VehicleDataResult" mandatory="false">
+ <description>The status modes of the cluster</description>
</param>
- </function>
-
- <function name="SubscribeBodyInformation" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="myKey" type="Common.VehicleDataResult" mandatory="false">
+ <description>Information related to the MyKey feature</description>
</param>
+ <!-- / Ford Specific Data Items -->
</function>
- <function name="SubscribeBodyInformation" messagetype="response">
- <param name="bodyInformation" type="Common.VehicleDataResult" mandatory="true">
- <description>The body information including power modes</description>
+ <function name="GetVehicleData" messagetype="request">
+ <description>Non periodic vehicle data read request.</description>
+ <param name="gps" type="Boolean" mandatory="false">
+ <description>See GPSData</description>
</param>
- </function>
- <function name="UnsubscribeBodyInformation" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="speed" type="Boolean" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
</param>
- </function>
- <function name="UnsubscribeBodyInformation" messagetype="response">
- <param name="bodyInformation" type="Common.VehicleDataResult" mandatory="true">
- <description>The body information including power modes</description>
+ <param name="rpm" type="Boolean" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
</param>
- </function>
-
- <function name="SubscribeDeviceStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="fuelLevel" type="Boolean" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
</param>
- </function>
- <function name="SubscribeDeviceStatus" messagetype="response">
- <param name="deviceStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The device status including signal and battery strength</description>
+ <param name="fuelLevel_State" type="Boolean" mandatory="false">
+ <description>The fuel level state</description>
</param>
- </function>
- <function name="UnsubscribeDeviceStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="instantFuelConsumption" type="Boolean" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
</param>
- </function>
- <function name="UnsubscribeDeviceStatus" messagetype="response">
- <param name="deviceStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The device status including signal and battery strength</description>
+ <param name="externalTemperature" type="Boolean" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
</param>
- </function>
-
- <function name="SubscribeDriverBraking" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="vin" type="Boolean" mandatory="false">
+ <description>Vehicle identification number</description>
</param>
- </function>
- <function name="SubscribeDriverBraking" messagetype="response">
- <param name="driverBraking" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the brake pedal</description>
+ <param name="prndl" type="Boolean" mandatory="false">
+ <description>See PRNDL</description>
</param>
- </function>
- <function name="UnsubscribeDriverBraking" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="tirePressure" type="Boolean" mandatory="false">
+ <description>See TireStatus</description>
</param>
- </function>
- <function name="UnsubscribeDriverBraking" messagetype="response">
- <param name="driverBraking" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the brake pedal</description>
+ <param name="odometer" type="Boolean" mandatory="false">
+ <description>Odometer in km</description>
</param>
- </function>
-
- <function name="SubscribeWiperStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="beltStatus" type="Boolean" mandatory="false">
+ <description>The status of the seat belts</description>
</param>
- </function>
- <function name="SubscribeWiperStatus" messagetype="response">
- <param name="wiperStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the wipers</description>
+ <param name="bodyInformation" type="Boolean" mandatory="false">
+ <description>The body information including ignition status and internal temp</description>
</param>
- </function>
- <function name="UnsubscribeWiperStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="deviceStatus" type="Boolean" mandatory="false">
+ <description>The device status including signal and battery strength</description>
</param>
- </function>
- <function name="UnsubscribeWiperStatus" messagetype="response">
- <param name="wiperStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the wipers</description>
+ <param name="driverBraking" type="Boolean" mandatory="false">
+ <description>The status of the brake pedal</description>
</param>
- </function>
-
- <function name="SubscribeHeadLampStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="wiperStatus" type="Boolean" mandatory="false">
+ <description>The status of the wipers</description>
</param>
- </function>
- <function name="SubscribeHeadLampStatus" messagetype="response">
- <param name="headLampStatus" type="Common.VehicleDataResult" mandatory="true">
+ <param name="headLampStatus" type="Boolean" mandatory="false">
<description>Status of the head lamps</description>
</param>
- </function>
- <function name="UnsubscribeHeadLampStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="engineTorque" type="Boolean" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
</param>
- </function>
- <function name="UnsubscribeHeadLampStatus" messagetype="response">
- <param name="headLampStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>Status of the head lamps</description>
+ <param name="accPedalPosition" type="Boolean" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
</param>
- </function>
-
- <function name="SubscribeEngineTorque" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="steeringWheelAngle" type="Boolean" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
</param>
- </function>
- <function name="SubscribeEngineTorque" messagetype="response">
- <param name="engineTorque" type="Common.VehicleDataResult" mandatory="true">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ <param name="engineOilLife" type="Boolean" mandatory="false">
+ <description>The estimated percentage of remaining oil life of the engine.</description>
</param>
- </function>
- <function name="UnsubscribeEngineTorque" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="eCallInfo" type="Boolean" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
</param>
- </function>
- <function name="UnsubscribeEngineTorque" messagetype="response">
- <param name="engineTorque" type="Common.VehicleDataResult" mandatory="true">
- <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ <param name="airbagStatus" type="Boolean" mandatory="false">
+ <description>The status of the air bags</description>
</param>
- </function>
-
- <function name="SubscribeAccPedalPosition" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="emergencyEvent" type="Boolean" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
</param>
- </function>
- <function name="SubscribeAccPedalPosition" messagetype="response">
- <param name="accPedalPosition" type="Common.VehicleDataResult" mandatory="true">
- <description>Accelerator pedal position (percentage depressed)</description>
+ <param name="clusterModeStatus" type="Boolean" mandatory="false">
+ <description>The status modes of the cluster</description>
</param>
- </function>
- <function name="UnsubscribeAccPedalPosition" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="myKey" type="Boolean" mandatory="false">
+ <description>Information related to the MyKey feature</description>
</param>
</function>
- <function name="UnsubscribeAccPedalPosition" messagetype="response">
- <param name="accPedalPosition" type="Common.VehicleDataResult" mandatory="true">
- <description>Accelerator pedal position (percentage depressed)</description>
+ <function name="GetVehicleData" messagetype="response">
+ <param name="gps" type="Common.GPSData" mandatory="false">
+ <description>See GPSData</description>
</param>
- </function>
-
- <function name="SubscribeSteeringWheelAngle" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
</param>
- </function>
- <function name="SubscribeSteeringWheelAngle" messagetype="response">
- <param name="steeringWheelAngle" type="Common.VehicleDataResult" mandatory="true">
- <description>Current angle of the steering wheel (in deg)</description>
+ <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
</param>
- </function>
- <function name="UnsubscribeSteeringWheelAngle" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
</param>
- </function>
- <function name="UnsubscribeSteeringWheelAngle" messagetype="response">
- <param name="steeringWheelAngle" type="Common.VehicleDataResult" mandatory="true">
+ <param name="fuelLevel_State" type="Common.ComponentVolumeStatus" mandatory="false">
+ <description>The fuel level state</description>
+ </param>
+ <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
+ </param>
+ <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
+ </param>
+ <param name="vin" type="String" maxlength="17" mandatory="false">
+ <description>Vehicle identification number</description>
+ </param>
+ <param name="prndl" type="Common.PRNDL" mandatory="false">
+ <description>See PRNDL</description>
+ </param>
+ <param name="tirePressure" type="Common.TireStatus" mandatory="false">
+ <description>See TireStatus</description>
+ </param>
+ <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="false">
+ <description>Odometer in km</description>
+ </param>
+ <param name="beltStatus" type="Common.BeltStatus" mandatory="false">
+ <description>The status of the seat belts</description>
+ </param>
+ <param name="bodyInformation" type="Common.BodyInformation" mandatory="false">
+ <description>The body information including power modes</description>
+ </param>
+ <param name="deviceStatus" type="Common.DeviceStatus" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="Common.VehicleDataEventStatus" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="Common.WiperStatus" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="Common.HeadLampStatus" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
<description>Current angle of the steering wheel (in deg)</description>
</param>
- </function>
-
- <function name="SubscribeECallInfo" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="engineOilLife" type="Float" minvalue="0" maxvalue="100" mandatory="false">
+ <description>The estimated percentage of remaining oil life of the engine.</description>
</param>
- </function>
- <function name="SubscribeECallInfo" messagetype="response">
- <param name="eCallInfo" type="Common.VehicleDataResult" mandatory="true">
+ <param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
<description>Emergency Call notification and confirmation data</description>
</param>
- </function>
- <function name="UnsubscribeECallInfo" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="airbagStatus" type="Common.AirbagStatus" mandatory="false">
+ <description>The status of the air bags</description>
</param>
- </function>
- <function name="UnsubscribeECallInfo" messagetype="response">
- <param name="eCallInfo" type="Common.VehicleDataResult" mandatory="true">
- <description>Emergency Call notification and confirmation data</description>
+ <param name="emergencyEvent" type="Common.EmergencyEvent" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
</param>
- </function>
-
- <function name="SubscribeAirbagStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="clusterModeStatus" type="Common.ClusterModeStatus" mandatory="false">
+ <description>The status modes of the cluster</description>
</param>
- </function>
- <function name="SubscribeAirbagStatus" messagetype="response">
- <param name="airbagStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the air bags</description>
+ <param name="myKey" type="Common.MyKey" mandatory="false">
+ <description>Information related to the MyKey feature</description>
</param>
</function>
- <function name="UnsubscribeAirbagStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <function name="OnVehicleData" messagetype="notification">
+ <description>Callback for the periodic and non periodic vehicle data read function.</description>
+ <param name="gps" type="Common.GPSData" mandatory="false">
+ <description>See GPSData</description>
</param>
- </function>
- <function name="UnsubscribeAirbagStatus" messagetype="response">
- <param name="airbagStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status of the air bags</description>
+ <param name="speed" type="Float" minvalue="0" maxvalue="700" mandatory="false">
+ <description>The vehicle speed in kilometers per hour</description>
</param>
- </function>
-
- <function name="SubscribeEmergencyEvent" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="rpm" type="Integer" minvalue="0" maxvalue="20000" mandatory="false">
+ <description>The number of revolutions per minute of the engine</description>
</param>
- </function>
- <function name="SubscribeEmergencyEvent" messagetype="response">
- <param name="emergencyEvent" type="Common.VehicleDataResult" mandatory="true">
- <description>Information related to an emergency event (and if it occurred)</description>
+ <param name="fuelLevel" type="Float" minvalue="-6" maxvalue="106" mandatory="false">
+ <description>The fuel level in the tank (percentage)</description>
</param>
- </function>
- <function name="UnsubscribeEmergencyEvent" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="fuelLevel_State" type="Common.ComponentVolumeStatus" mandatory="false">
+ <description>The fuel level state</description>
</param>
- </function>
- <function name="UnsubscribeEmergencyEvent" messagetype="response">
- <param name="emergencyEvent" type="Common.VehicleDataResult" mandatory="true">
- <description>Information related to an emergency event (and if it occurred)</description>
+ <param name="instantFuelConsumption" type="Float" minvalue="0" maxvalue="25575" mandatory="false">
+ <description>The instantaneous fuel consumption in microlitres</description>
</param>
- </function>
-
- <function name="SubscribeClusterModeStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="externalTemperature" type="Float" minvalue="-40" maxvalue="100" mandatory="false">
+ <description>The external temperature in degrees celsius</description>
</param>
- </function>
- <function name="SubscribeClusterModeStatus" messagetype="response">
- <param name="clusterModeStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status modes of the cluster</description>
+ <param name="vin" type="String" maxlength="17" mandatory="false">
+ <description>Vehicle identification number.</description>
</param>
- </function>
- <function name="UnsubscribeClusterModeStatus" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="prndl" type="Common.PRNDL" mandatory="false">
+ <description>See PRNDL</description>
</param>
- </function>
- <function name="UnsubscribeClusterModeStatus" messagetype="response">
- <param name="clusterModeStatus" type="Common.VehicleDataResult" mandatory="true">
- <description>The status modes of the cluster</description>
+ <param name="tirePressure" type="Common.TireStatus" mandatory="false">
+ <description>See TireStatus</description>
</param>
- </function>
-
- <function name="SubscribeMyKey" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="odometer" type="Integer" minvalue="0" maxvalue="17000000" mandatory="false">
+ <description>Odometer in km</description>
</param>
- </function>
- <function name="SubscribeMyKey" messagetype="response">
- <param name="myKey" type="Common.VehicleDataResult" mandatory="true">
- <description>Information related to the MyKey feature</description>
+ <param name="beltStatus" type="Common.BeltStatus" mandatory="false">
+ <description>The status of the seat belts</description>
</param>
- </function>
- <function name="UnsubscribeMyKey" messagetype="request">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
+ <param name="bodyInformation" type="Common.BodyInformation" mandatory="false">
+ <description>The body information including power modes</description>
</param>
- </function>
- <function name="UnsubscribeMyKey" messagetype="response">
- <param name="myKey" type="Common.VehicleDataResult" mandatory="true">
+ <param name="deviceStatus" type="Common.DeviceStatus" mandatory="false">
+ <description>The device status including signal and battery strength</description>
+ </param>
+ <param name="driverBraking" type="Common.VehicleDataEventStatus" mandatory="false">
+ <description>The status of the brake pedal</description>
+ </param>
+ <param name="wiperStatus" type="Common.WiperStatus" mandatory="false">
+ <description>The status of the wipers</description>
+ </param>
+ <param name="headLampStatus" type="Common.HeadLampStatus" mandatory="false">
+ <description>Status of the head lamps</description>
+ </param>
+ <param name="engineTorque" type="Float" minvalue="-1000" maxvalue="2000" mandatory="false">
+ <description>Torque value for engine (in Nm) on non-diesel variants</description>
+ </param>
+ <param name="accPedalPosition" type="Float" minvalue="0" maxvalue="100" mandatory="false">
+ <description>Accelerator pedal position (percentage depressed)</description>
+ </param>
+ <param name="steeringWheelAngle" type="Float" minvalue="-2000" maxvalue="2000" mandatory="false">
+ <description>Current angle of the steering wheel (in deg)</description>
+ </param>
+ <param name="eCallInfo" type="Common.ECallInfo" mandatory="false">
+ <description>Emergency Call notification and confirmation data</description>
+ </param>
+ <param name="airbagStatus" type="Common.AirbagStatus" mandatory="false">
+ <description>The status of the air bags</description>
+ </param>
+ <param name="emergencyEvent" type="Common.EmergencyEvent" mandatory="false">
+ <description>Information related to an emergency event (and if it occurred)</description>
+ </param>
+ <param name="clusterModeStatus" type="Common.ClusterModeStatus" mandatory="false">
+ <description>The status modes of the cluster</description>
+ </param>
+ <param name="myKey" type="Common.MyKey" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
</function>
-<!--end Qt HMI version of SubscribeVehicleData/UnsubscribeVehicleData-->
</interface>
</interfaces>
diff --git a/tools/intergen/tool/intergen.cc b/tools/intergen/tool/intergen.cc
index bad87b178b..8fc8302dcc 100644
--- a/tools/intergen/tool/intergen.cc
+++ b/tools/intergen/tool/intergen.cc
@@ -54,7 +54,6 @@ struct Options {
char* interface_xml;
bool auto_generate_function_ids;
bool generate_json_code;
- bool generate_dbus_code;
std::set<std::string> requested_interfaces;
std::set<std::string> excluded_scopes;
bool avoid_unsigned;
@@ -63,7 +62,6 @@ struct Options {
: interface_xml(NULL),
auto_generate_function_ids(false),
generate_json_code(false),
- generate_dbus_code(false),
avoid_unsigned(false),
minimum_word_size(8) {
}
@@ -138,10 +136,6 @@ int main(int argc, char* argv[]) {
options.generate_json_code = true;
break;
}
- case 'd': {
- options.generate_dbus_code = true;
- break;
- }
default: {
cerr << "Invalid option: '" << opt << "'" << '\n';
return EXIT_FAILURE;
@@ -165,7 +159,6 @@ int main(int argc, char* argv[]) {
codegen::Preferences(options.minimum_word_size,
options.avoid_unsigned,
options.generate_json_code,
- options.generate_dbus_code,
options.requested_interfaces));
if (bad.empty()) {
return EXIT_SUCCESS;
diff --git a/tools/policy_table_validator/CMakeLists.txt b/tools/policy_table_validator/CMakeLists.txt
index eabe4cfd5c..6b9f26f01a 100644
--- a/tools/policy_table_validator/CMakeLists.txt
+++ b/tools/policy_table_validator/CMakeLists.txt
@@ -3,14 +3,18 @@
include_directories(
${CMAKE_SOURCE_DIR}/src/components/rpc_base/include/
${CMAKE_SOURCE_DIR}/src/components/utils/include/
- ${JSONCPP_INCLUDE_DIRECTORY}
+ ${COMPONENTS_DIR}/smart_objects/include/
+ ${JSONCPP_INCLUDE_DIRECTORY}
+ ${BOOST_INCLUDE_DIR}
)
message(STATUS "Using ${EXTENDED_POLICY} policy mode")
if (${EXTENDED_POLICY} STREQUAL "EXTERNAL_PROPRIETARY")
include_directories(${CMAKE_SOURCE_DIR}/src/components/policy/policy_external/include/)
+ include_directories(${CMAKE_BINARY_DIR}/src/components/policy/policy_external/)
else()
include_directories(${CMAKE_SOURCE_DIR}/src/components/policy/policy_regular/include/)
+ include_directories(${CMAKE_BINARY_DIR}/src/components/policy/policy_regular/)
endif()
link_directories (
diff --git a/tools/policy_table_validator/main.cpp b/tools/policy_table_validator/main.cpp
index 99a4b7d7f9..80c5e2eddc 100644
--- a/tools/policy_table_validator/main.cpp
+++ b/tools/policy_table_validator/main.cpp
@@ -2,7 +2,7 @@
#include <cstdlib>
#include "policy/policy_table/types.h"
-#include "json/reader.h"
+#include "utils/jsoncpp_reader_wrapper.h"
#include "utils/file_system.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -59,12 +59,11 @@ int main(int argc, char** argv) {
exit(READ_ERROR);
}
- Json::Reader reader;
+ utils::JsonReader reader;
Json::Value value;
+ bool parse_result = reader.parse(json_string, &value);
- bool parce_result = reader.parse(json_string, value);
- if (false == parce_result) {
- std::cout << "Json parce fails" << std::endl;
+ if (false == parse_result) {
exit(PARSE_ERROR);
}
std::cout << "DEFAULT_POLICY" << std::endl;
diff --git a/tools/rpc_spec b/tools/rpc_spec
new file mode 160000
+Subproject 53e3dfb3cd7ff75a3425312ae4aeb758a1e0fc5